From 7c3b0e957d716aa3bb84a3255506cefeb73a7050 Mon Sep 17 00:00:00 2001 From: Michael Kerrisk Date: Fri, 10 Dec 2004 16:26:28 +0000 Subject: [PATCH] noted F_GETOWN bug after suggestion from aeb. --- man2/fcntl.2 | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/man2/fcntl.2 b/man2/fcntl.2 index 701d29b92..45de5fccf 100644 --- a/man2/fcntl.2 +++ b/man2/fcntl.2 @@ -44,6 +44,7 @@ .\" Modified, 27 May 2004, Michael Kerrisk .\" Added notes on capability requirements .\" Modified 2004-12-08, added O_NOATIME after note from Martin Pool +.\" 2004-12-10, mtk, noted F_GETOWN bug after suggestion from aeb. .\" .TH FCNTL 2 2004-12-08 "Linux 2.6.9" "Linux Programmer's Manual" .SH NAME @@ -333,7 +334,7 @@ are used to manage I/O availability signals: Get the process ID or process group currently receiving SIGIO and SIGURG signals for events on file descriptor .IR fd . -Process groups are returned as negative values. +Process groups are returned as negative values (but see BUGS below). .TP .B F_SETOWN Set the process ID or process group that will receive SIGIO @@ -727,7 +728,17 @@ Clearly, .I l_pid alone is not going to be very useful if the process holding the lock may live on a different machine. - +.SH BUGS +A limitation of the Linux system call conventions means that if +a (negative) process group ID to be returned by +.B F_GETOWN +falls in the range -1 to -4095, then the return value is wrongly +interpreted by glibc as an error in the system call; +that is, the return value of +.BR fcntl () +will be \-1, and +.I errno +will contain the (positive) process group ID. .SH "CONFORMING TO" SVr4, SVID, POSIX, X/OPEN, BSD 4.3. Only the operations F_DUPFD, F_GETFD, F_SETFD, F_GETFL, F_SETFL, F_GETLK, F_SETLK and F_SETLKW are