Re: lockf - EBADF also if fd is open for reading

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hello Mikel,

On Wed, Mar 9, 2011 at 11:43 AM, Mikel Ward <mikel@xxxxxxxxxxxxx> wrote:
> Hi
>
> http://www.kernel.org/doc/man-pages/online/pages/man3/lockf.3.html
> says:
>
>       EBADF  fd is not an open file descriptor.
>
> However it can also happen if the file descriptor is open, but not for writing.
>
> The POSIX docs say this
> http://pubs.opengroup.org/onlinepubs/009695399/functions/lockf.html
>
> and a simple test program confirms it is the case.

Yes, thanks for the report! For man-pages-3.33, I applied the patch below.

Cheers,

Michael

--- a/man3/lockf.3
+++ b/man3/lockf.3
@@ -19,7 +19,7 @@
 .\" Added section stuff, aeb, 2002-04-22.
 .\" Corrected include file, drepper, 2003-06-15.
 .\"
-.TH LOCKF 3 2010-09-20 "GNU" "Linux Programmer's Manual"
+.TH LOCKF 3 2011-09-11 "GNU" "Linux Programmer's Manual"
 .SH NAME
 lockf \- apply, test or remove a POSIX lock on an open file
 .SH SYNOPSIS
@@ -124,7 +124,15 @@ been memory-mapped by another process.
 .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


-- 
Michael Kerrisk
Linux man-pages maintainer; http://www.kernel.org/doc/man-pages/
Author of "The Linux Programming Interface"; http://man7.org/tlpi/
--
To unsubscribe from this list: send the line "unsubscribe linux-man" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Kernel Documentation]     [Netdev]     [Linux Ethernet Bridging]     [Linux Wireless]     [Kernel Newbies]     [Security]     [Linux for Hams]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux Admin]     [Samba]

  Powered by Linux