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.
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.
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 10.1.
open ("symlink", O_NOFOLLOW ...)
fails with errno
set to
EFTYPE
instead of the POSIX-required ELOOP
on some
platforms:
NetBSD 6.1.
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.