open ¶POSIX specification:
https://pubs.opengroup.org/onlinepubs/9799919799/functions/open.html
Portability problems fixed by the Gnulib module open:
O_CLOEXEC:
Mac OS X 10.6, FreeBSD 8.4, NetBSD 5.1, OpenBSD 4.9, Minix 3.1.8, AIX 7.1, HP-UX 11, Solaris 10, Cygwin 1.7.x, mingw, MSVC 14.
O_DIRECTORY:
glibc 2.0, Mac OS X 10.4, FreeBSD 7.4, NetBSD 4.0.1, OpenBSD 4.9, HP-UX 11, Solaris 10, Cygwin 1.5.x, mingw, MSVC 14.
off_t is a 32-bit type, open may not work
correctly with files 2 GiB and larger. See Large File Support.
O_NONBLOCK flag when it is defined
by the gnulib module nonblocking on some platforms:
mingw, MSVC 14.
Portability problems fixed by the Gnulib module fchdir:
Portability problems not fixed by Gnulib:
O_CLOEXEC is not atomic, and so is
not safe in the presence of multiple threads or signal handlers.
O_SEARCH may require read access
instead of search/execute access.
O_SEARCH may reject directories
where you have search access even though O_SEARCH is not replaced:
macOS 12.6.
O_CREAT | O_DIRECTORY is unspecified.
Most platforms fail with EINVAL in this case.
However, in Linux kernels 6.3 and earlier, this function
creates a regular file and then either returns successfully
(Linux kernel 5.6 and earlier) or fails with ENOTDIR
(Linux kernels 5.7–6.3).
open ("symlink", O_CREAT ...) fails when the argument points to a
nonexistent file in an existing directory on some platforms:
Haiku.
open ("symlink", O_NOFOLLOW ...) fails with errno set to
EMLINK instead of the POSIX-required ELOOP on some
platforms:
FreeBSD 14.2.
open ("symlink", O_NOFOLLOW ...) fails with errno set to
EFTYPE instead of the POSIX-required ELOOP on some
platforms:
NetBSD 10.0.
O_TEXT mode by
default; this means that it translates '\n' to CR/LF by default. Use the
O_BINARY flag if you need reliable binary I/O.