Paul Eggert wrote: > Despite that disadvantage, it would be a win for users or Gnulib, who > could stop worrying about the possibility that O_CLOEXEC == 0. I > installed the attached patch to try to implement this. I don't use > MS-Windows, though, and may well have missed something.
Looks quite nice. I've verified the value of O_CLOEXEC fits: 1) All systems appear to "book" the O_* bit values, starting with the small ones. Linux max is 0x400000 Hurd max is 0x400000 Mac OS X 10.7 max is 0x200000 FreeBSD 6.4 max is 0x10000 NetBSD 5.0 max is 0x80000 OpenBSD 3.8 max is 0x8000 MirBSD max is 0x8000 Minix 3.1.8 max is 0x1000 AIX 7.1 collision with _FKERNEL - probably harmless HP-UX 11.31 max is 0x1000000 IRIX 6.5 max is 0x40000 OSF/1 5.1 max is 0x40000 Solaris 11 2011-11 max is 0x2000000 Cygwin max is 0x100000 mingw max is 0x40000 MSVC 14 max is 0x40000 Interix 3.5 max is 0x2000 BeOS max is 0x8000 2) The collision with _FKERNEL on AIX is probably harmless, since this flag probably only exists in kernel code. Here's an update of the documentation: 2017-08-14 Bruno Haible <[email protected]> open, openat: Update doc about O_CLOEXEC. * doc/posix-functions/open.texi: More concrete list of platforms. * doc/posix-functions/openat.texi: Likewise. diff --git a/doc/posix-functions/open.texi b/doc/posix-functions/open.texi index f1565c3..7e9df26 100644 --- a/doc/posix-functions/open.texi +++ b/doc/posix-functions/open.texi @@ -10,7 +10,7 @@ Portability problems fixed by the Gnulib module open: @itemize @item Some platforms do not support @code{O_CLOEXEC}: -Solaris 10, probably many others. +Mac OS X 10.5, FreeBSD 6.0, NetBSD 5.0, OpenBSD 3.8, Minix 3.1.8, AIX 5.1, HP-UX 11, IRIX 6.5, OSF/1 5.1, Solaris 10, Cygwin, mingw, MSVC 14, Interix 3.5. @item On platforms where @code{off_t} is a 32-bit type, @code{open} may not work correctly with files larger than 2 GB. (Cf. @code{AC_SYS_LARGEFILE}.) diff --git a/doc/posix-functions/openat.texi b/doc/posix-functions/openat.texi index 9f7632b..4a20636 100644 --- a/doc/posix-functions/openat.texi +++ b/doc/posix-functions/openat.texi @@ -15,7 +15,7 @@ AIX 5.1, HP-UX 11, IRIX 6.5, OSF/1 5.1, Cygwin 1.5.x, mingw, MSVC 14, Interix 3. But the replacement function is not safe to be used in libraries and is not multithread-safe. @item Some platforms do not support @code{O_CLOEXEC}: -Solaris 10. +AIX 7.1, Solaris 10. @item On platforms where @code{off_t} is a 32-bit type, @code{open} may not work correctly with files larger than 2 GB. (Cf. @code{AC_SYS_LARGEFILE}.)
