mirror of https://github.com/mkerrisk/man-pages
Date: Mon, 13 Dec 2004 12:09:43 +0100 (MET)
From: "Michael Kerrisk" <mtk-manpages@gmx.net> To: Andries Brouwer <Andries.Brouwer@cwi.nl> Subject: Re: errno Hi Andries, > On Fri, Dec 10, 2004 at 05:07:36PM +0100, Michael Kerrisk wrote: > > > I added this text to fcntl.2: > > > > BUGS > > A limitation of the Linux system call conventions means that > > if a (negative) process group ID to be returned by 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 fcntl() will be -1, and errno > > will contain the (positive) process group ID. > > Yes. > > (Maybe glibc always did this, early libc considered any negative > return value an error. On the other hand, not all the world is an i386 - > IBM has just decided that we don't need any i386's anymore > and sold their stuff to the Chinese - we must use PPC, as Linus > does already - and on other architectures we do not have this > ugliness, I think.) > > You might consider adding "i386" somewhere: > A limitation of the Linux i386 system call conventions ... Some testing on ia64 (RedHat EL 3.0, 2.4.21) and alpha (2.4.18, Debian 3.0) showed that any negative PGID value causes F_GETOWN to fail. My limited reading of the ia64 source: sysdeps/unix/sysv/linux/ia64/sysdep.h shows that there is a comment about the -4095 value there, but that doesn't seem to reflect the reality of the code. Reading the source, the -4095 limit seems to hold on some other architectures, e.g.: sysdeps/unix/sysv/linux/m68k/sysdep.h sysdeps/unix/sysv/linux/hppa/sysdep.h sysdeps/unix/sysv/linux/s390/s390-32/sysdep.h sysdeps/unix/sysv/linux/s390/s390-64/sysdep.h sysdeps/unix/sysv/linux/x86_64/sysdep.h Unfortunately, I have no non-x86 systems other than the above alpha and ia64 (HP-testdrive) on which I can test. I modified the text a little: BUGS A limitation of the Linux system call conventions on some architectures (notably x86) means that if a (negative) pro‐ cess group ID to be returned by 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 fcntl() will be -1, and errno will contain the (positive) process group ID. I've left a FIXME in the man page source noting that details have yet to be sorted out for ia64, alpha, etc.
This commit is contained in:
parent
d3c8b3e9b7
commit
8505c1f1d6
10
man2/fcntl.2
10
man2/fcntl.2
|
@ -729,16 +729,22 @@ Clearly,
|
|||
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
|
||||
A limitation of the Linux system call conventions on some
|
||||
architectures (notably x86) 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;
|
||||
.\" glibc source: sysdeps/unix/sysv/linux/i386/sysdep.h
|
||||
that is, the return value of
|
||||
.BR fcntl ()
|
||||
will be \-1, and
|
||||
.I errno
|
||||
will contain the (positive) process group ID.
|
||||
.\" FIXME Dec 04: some limited testing on alpha and ia64 seems to
|
||||
.\" indicate that ANY negative PGID value will cause F_GETOWN
|
||||
.\" to misintepret the return as an error.Some other architectures
|
||||
.\" seem to have the same range check as x86. -- MTK
|
||||
.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
|
||||
|
|
Loading…
Reference in New Issue