version 1, including all changes.
.
Rev |
Author |
# |
Line |
1 |
perry |
1 |
LOCKF |
|
|
2 |
!!!LOCKF |
|
|
3 |
NAME |
|
|
4 |
SYNOPSIS |
|
|
5 |
DESCRIPTION |
|
|
6 |
RETURN VALUE |
|
|
7 |
ERRORS |
|
|
8 |
CONFORMING TO |
|
|
9 |
SEE ALSO |
|
|
10 |
---- |
|
|
11 |
!!NAME |
|
|
12 |
|
|
|
13 |
|
|
|
14 |
lockf - apply, test or remove a POSIX lock on an open file |
|
|
15 |
!!SYNOPSIS |
|
|
16 |
|
|
|
17 |
|
|
|
18 |
__#include __ |
|
|
19 |
|
|
|
20 |
|
|
|
21 |
__int lockf(int__ fd__, int__ cmd__, off_t__ |
|
|
22 |
len__);__ |
|
|
23 |
!!DESCRIPTION |
|
|
24 |
|
|
|
25 |
|
|
|
26 |
Apply, test or remove a POSIX lock on an open file. The file |
|
|
27 |
is specified by ''fd''. This call is just an interface |
|
|
28 |
for fcntl(2). Valid operations are given |
|
|
29 |
below: |
|
|
30 |
|
|
|
31 |
|
|
|
32 |
__F_LOCK__ |
|
|
33 |
|
|
|
34 |
|
|
|
35 |
Set an exclusive lock to the file. Only one process may hold |
|
|
36 |
an exclusive lock for a given file at a given time. If the |
|
|
37 |
file is already locked it blocks until the previous lock is |
|
|
38 |
released. |
|
|
39 |
|
|
|
40 |
|
|
|
41 |
__F_TLOCK__ |
|
|
42 |
|
|
|
43 |
|
|
|
44 |
Same as __F_LOCK__ but never blocks and return error |
|
|
45 |
instead if the file is already locked. |
|
|
46 |
|
|
|
47 |
|
|
|
48 |
__F_ULOCK__ |
|
|
49 |
|
|
|
50 |
|
|
|
51 |
Unlock the file. |
|
|
52 |
|
|
|
53 |
|
|
|
54 |
__F_TEST__ |
|
|
55 |
|
|
|
56 |
|
|
|
57 |
Test the lock: return 0 if ''fd'' is unlocked or locked |
|
|
58 |
by this process; return -1, set ''errno'' to |
|
|
59 |
__EACCES__, if another process holds the |
|
|
60 |
lock. |
|
|
61 |
!!RETURN VALUE |
|
|
62 |
|
|
|
63 |
|
|
|
64 |
On success, zero is returned. On error, -1 is returned, and |
|
|
65 |
''errno'' is set appropriately. |
|
|
66 |
!!ERRORS |
|
|
67 |
|
|
|
68 |
|
|
|
69 |
__EAGAIN__ |
|
|
70 |
|
|
|
71 |
|
|
|
72 |
The file is locked and the __LOCK_NB__ flag was selected, |
|
|
73 |
or operation is prohibited because the file has been |
|
|
74 |
memory-mapped by another process. |
|
|
75 |
|
|
|
76 |
|
|
|
77 |
__EBADF__ |
|
|
78 |
|
|
|
79 |
|
|
|
80 |
''fd'' is not an open file descriptor. |
|
|
81 |
|
|
|
82 |
|
|
|
83 |
__EDEADLK__ |
|
|
84 |
|
|
|
85 |
|
|
|
86 |
Specified lock operation would cause a |
|
|
87 |
deadlock. |
|
|
88 |
|
|
|
89 |
|
|
|
90 |
__EINVAL__ |
|
|
91 |
|
|
|
92 |
|
|
|
93 |
An invalid operation was specified in |
|
|
94 |
''fd''. |
|
|
95 |
|
|
|
96 |
|
|
|
97 |
__ENOLCK__ |
|
|
98 |
|
|
|
99 |
|
|
|
100 |
Too many segment locks open, lock table is |
|
|
101 |
full. |
|
|
102 |
!!CONFORMING TO |
|
|
103 |
|
|
|
104 |
|
|
|
105 |
SYSV |
|
|
106 |
!!SEE ALSO |
|
|
107 |
|
|
|
108 |
|
|
|
109 |
fcntl(2), flock(2) |
|
|
110 |
There are also ''locks.txt'' and ''mandatory.txt'' in |
|
|
111 |
''/usr/src/linux/Documentation''. |
|
|
112 |
---- |