openat ¶POSIX specification:
https://pubs.opengroup.org/onlinepubs/9799919799/functions/openat.html
Portability problems fixed by Gnulib:
O_CLOEXEC:
AIX 7.1, Solaris 10.
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.
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).
openat (fd, "symlink", O_NOFOLLOW ...) fails with errno
set to EMLINK instead of the POSIX-required ELOOP on
some platforms:
FreeBSD 10.1.
openat (fd, "symlink", O_NOFOLLOW ...) fails with errno
set to EFTYPE instead of the POSIX-required ELOOP on
some platforms:
NetBSD 6.1.