* modules/unistd-h (Depends-on): Add fcntl-h.
* lib/unistd.in.h: Include fcntl.h if inclusion of unistd.h does not
define O_CLOEXEC.
* doc/posix-headers/unistd.texi: Document the platforms that do not
define O_CLOEXEC in unistd.h.
+2025-02-16 Collin Funk <collin.funk1@gmail.com>
+
+ unistd-h: Make sure O_CLOEXEC is defined.
+ * modules/unistd-h (Depends-on): Add fcntl-h.
+ * lib/unistd.in.h: Include fcntl.h if inclusion of unistd.h does not
+ define O_CLOEXEC.
+ * doc/posix-headers/unistd.texi: Document the platforms that do not
+ define O_CLOEXEC in unistd.h.
+
2025-02-16 Bruno Haible <bruno@clisp.org>
strncasecmp: Add tests.
@item
The @code{_exit} function is not declared in this file on some platforms:
mingw.
+@item
+This header file does not define @code{O_CLOEXEC} on some platforms:
+glibc 2.41, FreeBSD 14.0, NetBSD 10.0, OpenBSD 7.5, Solaris 11.4, Cygwin 3.5, mingw, MSVC 14.
@item
Some platforms provide a @code{NULL} macro that cannot be used in arbitrary
# include <stdio.h>
#endif
+/* FreeBSD 14.0, NetBSD 10.0, OpenBSD 7.5, Solaris 11.4, and glibc 2.41
+ do not define O_CLOEXEC in <unistd.h>. */
/* Cygwin 1.7.1 and Android 4.3 declare unlinkat in <fcntl.h>, not in
<unistd.h>. */
/* But avoid namespace pollution on glibc systems. */
-#if (@GNULIB_UNLINKAT@ || defined GNULIB_POSIXCHECK) \
- && (defined __CYGWIN__ || defined __ANDROID__) \
- && ! defined __GLIBC__
+#if ! defined O_CLOEXEC \
+ || ((@GNULIB_UNLINKAT@ || defined GNULIB_POSIXCHECK) \
+ && (defined __CYGWIN__ || defined __ANDROID__) \
+ && ! defined __GLIBC__)
# include <fcntl.h>
#endif
snippet/arg-nonnull
snippet/c++defs
snippet/warn-on-use
+fcntl-h
ssize_t
stddef-h
sys_types-h