1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159
|
.\" Copyright 1997 Nicolas Lichtmaier <nick@debian.org>
.\" Created Thu Aug 7 00:44:00 ART 1997
.\"
.\" This is free documentation; you can redistribute it and/or
.\" modify it under the terms of the GNU General Public License as
.\" published by the Free Software Foundation; either version 2 of
.\" the License, or (at your option) any later version.
.\"
.\" The GNU General Public License's references to "object code"
.\" and "executables" are to be interpreted as the output of any
.\" document formatting or typesetting system, including
.\" intermediate and printed output.
.\"
.\" This manual is distributed in the hope that it will be useful,
.\" but WITHOUT ANY WARRANTY; without even the implied warranty of
.\" MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
.\" GNU General Public License for more details.
.\"
.\" Added section stuff, aeb, 2002-04-22.
.\" Corrected include file, drepper, 2003-06-15.
.\"
.\" Japanese Version Copyright (c) 2000-2002 Yuichi SATO
.\" all rights reserved.
.\" Translated Tue Jul 11 19:02:58 JST 2000
.\" by Yuichi SATO <ysato@h4.dion.ne.jp>
.\" Updated & Modified Mon Jul 15 02:10:29 JST 2002 by Yuichi SATO
.\"
.\"WORD: apply Ŭ
.\"WORD: remove
.\"WORD: exclusive ¾
.\"WORD: descriptor ǥץ
.\"WORD:
.\"
.TH LOCKF 3 2007-07-26 "GNU" "Linux Programmer's Manual"
.SH ̾
lockf \- ƤեФ POSIX åŬѡƥȡ롣
.SH
.B #include <unistd.h>
.sp
.BI "int lockf(int " fd ", int " cmd ", off_t " len );
.sp
.in -4n
glibc εǽޥ
.RB ( feature_test_macros (7)
):
.in
.sp
.BR lockf ():
_BSD_SOURCE || _SVID_SOURCE || _XOPEN_SOURCE\ >=\ 500
.SH
ƤեΥФơ
POSIX åŬѡƥȡ롣
ե
.I fd
ǻꤵ롣
ϽߤΤ˥ץեǥץǤ롣
.I cmd
ǻꤵ롣
.I pos
ߤΥե֤Ȥȡ
.I len
ξ硢ϥХȰ
.IR pos .. pos + len \-1
Ǥ롣
.I len
ξ硢ϥХȰ
.IR pos - len .. pos \-1
Ǥ롣
.I len
0 ξ硢ϸߤΥե̵֤ޤǤȤʤ
(Ĥޤ긽ߤΡ뤤ѹ줿ϾΡե뽪ü֤ޤ)
ɤξˤƤ⡢ϰΥե뽪ü礵줦롣
.LP
Linux Ǥϡδؿñ
.BR fcntl (2)
ؤΥեǤ롣
(̤ˤϡ
.BR lockf ()
.BR fcntl (2)
δطϻꤵƤʤ)
.LP
ͭʥץʲ˵롣
.TP
.B F_LOCK
եλꤵ줿¾åꤹ롣
Υ (ΰ) ˥åƤ硢
ΥåޤǴؿθƤӽФ֥å롣
Υ˥åƤ륻ȽŤʤä硢
2 ĤΥϷ礵롣
åݻƤץ
ΥեΥեǥץȡ
եåϲ롣
ҥץϥåѾʤ
.TP
.B F_TLOCK
.B F_LOCK
ƱͤǤ뤬ե뤬˥åƤ硢
ؿθƤӽФϥ֥åԤ鷺˥顼֤
.TP
.B F_ULOCK
եλꤵ줿Υå롣
ˤå줿 2 Ĥʬ䤵뤫⤷ʤ
.TP
.B F_TEST
Τ褦˥åΥƥȤ롣
ꤵ줿åƤʤ
ΥץˤåƤ硢0 ֤
¾ΥץåݻƤ硢\-1 ֤
.I errno
.B EAGAIN
(Ĥ¾ΥƥǤ
.BR EACCES )
ꤹ롣
.SH ֤
硢0 ֤롣
顼ξ硢\-1 ֤졢
.I errno
顼бͤꤵ롣
.SH 顼
.TP
.BR EACCES " ⤷ " EAGAIN
ե뤬åơ
.B F_TLOCK
ޤ
.B F_TEST
ե饰Ƥ롣
ޤϡե뤬¾ΥץˤޥåפƤ뤿ˡ
ػߤƤ롣
.TP
.B EBADF
.I fd
ƤեΥǥץǤϤʤ
.TP
.B EDEADLK
ޥɤ
.B T_LOCK
ǤꡢΥåǥåɥåƤ롣
.TP
.B EINVAL
.I fd
̵ꤵ줿
.TP
.B ENOLCK
¿Υȥå졢åơ֥뤬줿
.SH
SVr4, POSIX.1-2001
.SH Ϣ
.BR fcntl (2),
.BR flock (2)
.br
.I /usr/src/linux/Documentation
ˤ
.I locks.txt
.I mandatory.txt
⻲Ȥ뤳ȡ
|