aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKonstantin Belousov <kib@FreeBSD.org>2026-04-20 20:02:13 +0000
committerKonstantin Belousov <kib@FreeBSD.org>2026-05-10 14:53:20 +0000
commit428da7d65b1c41c81a8786f66c1ce2f4242ac8bb (patch)
tree5c2296699bc0ea0b7ef92ee39642c025173493ff
parenta2e0822543e93a8d815acd2d1c3d51ef73d6e262 (diff)
Add O_SYMLINK emulation
for MacOSX partial compatibility, defined as O_PATH | O_NOFOLLOW. fstat(2) and freadlink(3) works on the resulting file descriptors, but reads on the regular file do not. More complete but more hackish version was developed but deemed too hackish. Sponsored by: The FreeBSD Foundation MFC after: 2 weeks Differential revision: https://reviews.freebsd.org/D56365
-rw-r--r--sys/sys/fcntl.h7
1 files changed, 7 insertions, 0 deletions
diff --git a/sys/sys/fcntl.h b/sys/sys/fcntl.h
index 0b13241f0ee3..80cbca4ea753 100644
--- a/sys/sys/fcntl.h
+++ b/sys/sys/fcntl.h
@@ -142,6 +142,13 @@ typedef __pid_t pid_t;
#define O_EMPTY_PATH 0x02000000
#define O_NAMEDATTR 0x04000000 /* NFSv4 named attributes */
#define O_XATTR O_NAMEDATTR /* Solaris compatibility */
+
+/*
+ * Emulate MacOSX compatibility flag without consuming a flags bit.
+ * It is not fully correct since reads over regular files opened with
+ * this definition fail.
+ */
+#define O_SYMLINK (O_PATH | O_NOFOLLOW)
#endif
#if __POSIX_VISIBLE >= 202405