-.\" Copyright 1997 Nicolás Lichtmaier <nick@debian.org>
+.\" Copyright 1997 Nicolás Lichtmaier <nick@debian.org>
.\" Created Thu Aug 7 00:44:00 ART 1997
.\"
+.\" %%%LICENSE_START(GPLv2+_DOC_FULL)
.\" 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
.\" MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
.\" GNU General Public License for more details.
.\"
+.\" You should have received a copy of the GNU General Public
+.\" License along with this manual; if not, see
+.\" <http://www.gnu.org/licenses/>.
+.\" %%%LICENSE_END
+.\"
.\" Added section stuff, aeb, 2002-04-22.
.\" Corrected include file, drepper, 2003-06-15.
.\"
-.TH LOCKF 3 2009-07-25 "GNU" "Linux Programmer's Manual"
+.TH LOCKF 3 2014-06-13 "GNU" "Linux Programmer's Manual"
.SH NAME
lockf \- apply, test or remove a POSIX lock on an open file
.SH SYNOPSIS
.in
.sp
.BR lockf ():
-_BSD_SOURCE || _SVID_SOURCE || _XOPEN_SOURCE\ >=\ 500
+.ad l
+.RS 4
+_BSD_SOURCE || _SVID_SOURCE || _XOPEN_SOURCE\ >=\ 500 ||
+_XOPEN_SOURCE\ &&\ _XOPEN_SOURCE_EXTENDED
+.RE
+.ad
.SH DESCRIPTION
Apply, test or remove a POSIX lock on a section of an open file.
The file is specified by
.RB ( EACCES
on some other systems),
if another process holds a lock.
-.SH "RETURN VALUE"
+.SH RETURN VALUE
On success, zero is returned.
On error, \-1 is returned, and
.I errno
.TP
.B EBADF
.I fd
-is not an open file descriptor.
+is not an open file descriptor; or
+.I cmd
+is
+.B F_LOCK
+or
+.BR F_TLOCK
+and
+.I fd
+is not a writable file descriptor.
.TP
.B EDEADLK
The command was
-.B T_LOCK
+.B F_LOCK
and this lock operation would cause a deadlock.
.TP
.B EINVAL
An invalid operation was specified in
-.IR fd .
+.IR cmd .
.TP
.B ENOLCK
Too many segment locks open, lock table is full.
-.SH "CONFORMING TO"
+.SH ATTRIBUTES
+.SS Multithreading (see pthreads(7))
+The
+.BR lockf ()
+function is thread-safe.
+.SH CONFORMING TO
SVr4, POSIX.1-2001.
-.SH "SEE ALSO"
+.SH SEE ALSO
.BR fcntl (2),
.BR flock (2)
-.br
-There are also
+
.I locks.txt
and
.I mandatory-locking.txt
-in the kernel source directory
-.IR Documentation/filesystems .
-(On older kernels, these files are directly under the
-.I Documentation/
+in the Linux kernel source directory
+.IR Documentation/filesystems
+(on older kernels, these files are directly under the
+.I Documentation
directory, and
.I mandatory-locking.txt
is called
-.IR mandatory.txt .)
+.IR mandatory.txt )
+.SH COLOPHON
+This page is part of release 3.79 of the Linux
+.I man-pages
+project.
+A description of the project,
+information about reporting bugs,
+and the latest version of this page,
+can be found at
+\%http://www.kernel.org/doc/man\-pages/.