Skip to content

Commit

Permalink
flock: Convert docs to docparse
Browse files Browse the repository at this point in the history
Signed-off-by: Petr Vorel <pvorel@suse.cz>
  • Loading branch information
pevik committed Oct 21, 2024
1 parent 4aa4309 commit 1a32f6b
Show file tree
Hide file tree
Showing 5 changed files with 52 additions and 35 deletions.
8 changes: 6 additions & 2 deletions testcases/kernel/syscalls/flock/flock01.c
Original file line number Diff line number Diff line change
@@ -1,9 +1,13 @@
// SPDX-License-Identifier: GPL-2.0-or-later
/* Copyright (c) Wipro Technologies Ltd, 2002. All Rights Reserved.
* Copyright (c) Linux Test Project, 2007-2018
* Author: Vatsal Avasthi
*/

/*\
* [Description]
*
* Test Description:
* This test verifies that flock() succeeds with all kind of locks.
* Basic test for flock(2), uses LOCK_SH, LOCK_UN, LOCK_EX locks.
*/

#include <errno.h>
Expand Down
17 changes: 10 additions & 7 deletions testcases/kernel/syscalls/flock/flock02.c
Original file line number Diff line number Diff line change
@@ -1,15 +1,18 @@
// SPDX-License-Identifier: GPL-2.0-or-later
/*
* Copyright (c) Wipro Technologies Ltd, 2002. All Rights Reserved.
* Copyright (c) Linux Test Project, 2002-2018
* Author: Vatsal Avasthi
*/

/*\
* [Description]
*
* Verify flock(2) returns -1 and set proper errno:
*
* Test Description:
* 1) flock() returns -1 and sets error number to EBADF if the file descriptor
* is invalid.
* 2) flock() returns -1 and sets error number to EINVAL if the argument
* operation does not include LOCK_SH,LOCK_EX,LOCK_UN.
* 3) flock() returns -1 and sets error number to EINVAL if an invalid
* combination of locking modes is used i.e LOCK_SH with LOCK_EX
* - EBADF if the file descriptor is invalid
* - EINVAL if the argument operation does not include LOCK_SH,LOCK_EX,LOCK_UN
* - EINVAL if an invalid combination of locking modes is used i.e LOCK_SH with LOCK_EX
*/

#include <errno.h>
Expand Down
22 changes: 12 additions & 10 deletions testcases/kernel/syscalls/flock/flock03.c
Original file line number Diff line number Diff line change
@@ -1,18 +1,20 @@
// SPDX-License-Identifier: GPL-2.0-or-later
/*
* Copyright (c) International Business Machines Corp., 2002
* Author: Cyril Hrubis
* Copyright (c) 2012-2015 Cyril Hrubis <chrubis@suse.cz>
* Copyright (c) Linux Test Project, 2002-2018
*/

/*\
* [Description]
*
* Test Description:
* This test verifies that flock() cannot unlock a file locked by another
* task.
* Verify that flock(2) cannot unlock a file locked by another task.
*
* Test Steps:
* Fork a child processes The parent flocks a file with LOCK_EX Child waits
* for that to happen, then checks to make sure it is locked. Child then
* tries to unlock the file. If the unlock succeeds, the child attempts to
* lock the file with LOCK_EX. The test passes if the child is able to lock
* the file.
* Fork a child processes. The parent flocks a file with LOCK_EX. Child waits
* for that to happen, then checks to make sure it is locked. Child then
* tries to unlock the file. If the unlock succeeds, the child attempts to
* lock the file with LOCK_EX. The test passes if the child is able to lock
* the file.
*/

#include <errno.h>
Expand Down
19 changes: 12 additions & 7 deletions testcases/kernel/syscalls/flock/flock04.c
Original file line number Diff line number Diff line change
@@ -1,14 +1,19 @@
// SPDX-License-Identifier: GPL-2.0-or-later
/* Copyright (c) Wipro Technologies Ltd, 2002. All Rights Reserved.
* Copyright (c) Linux Test Project, 2003-2021
* Author: Vatsal Avasthi
*/

/*\
* [Description]
*
* Test verifies that flock() behavior with different locking combinations along
* with LOCK_SH and LOCK_EX:
*
* Test Description:
* This test verifies that flock() behavior with different locking
* combinations along with LOCK_SH and LOCK_EX:
* 1) flock() succeeded in acquiring shared lock on shared lock file.
* 2) flock() failed to acquire exclusive lock on shared lock file.
* 3) flock() failed to acquire shared lock on exclusive lock file.
* 4) flock() failed to acquire exclusive lock on exclusive lock file.
* - flock() succeeded in acquiring shared lock on shared lock file.
* - flock() failed to acquire exclusive lock on shared lock file.
* - flock() failed to acquire shared lock on exclusive lock file.
* - flock() failed to acquire exclusive lock on exclusive lock file.
*/

#include <errno.h>
Expand Down
21 changes: 12 additions & 9 deletions testcases/kernel/syscalls/flock/flock06.c
Original file line number Diff line number Diff line change
@@ -1,17 +1,20 @@
// SPDX-License-Identifier: GPL-2.0-or-later
/* Copyright (c) Matthew Wilcox for Hewlett Packard 2003
* Copyright (c) Linux Test Project, 2007-2018
* Author: Matthew Wilcox
*/

/*\
* [Description]
*
* Test Description:
* This test verifies that flock locks held on one fd conflict with flock
* locks held on a different fd.
* Test verifies that flock locks held on one file descriptor conflict with
* flock locks held on a different file descriptor.
*
* Test Steps:
* The process opens two file descriptors on the same file. It acquires
* an exclusive flock on the first descriptor, checks that attempting to
* acquire an flock on the second descriptor fails. Then it removes the
* first descriptor's lock and attempts to acquire an exclusive lock on
* the second descriptor.
* The process opens two file descriptors on the same file. It acquires
* an exclusive flock on the first descriptor, checks that attempting to
* acquire an flock on the second descriptor fails. Then it removes the
* first descriptor's lock and attempts to acquire an exclusive lock on
* the second descriptor.
*/

#include <errno.h>
Expand Down

0 comments on commit 1a32f6b

Please sign in to comment.