Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 03 May 2026 19:59:03 +0000
From:      Konstantin Belousov <kib@FreeBSD.org>
To:        src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org
Subject:   git: 2213820b6f4c - main - Add O_SYMLINK emulation
Message-ID:  <69f7a907.3d8c9.3214c104@gitrepo.freebsd.org>

index | next in thread | raw e-mail

The branch main has been updated by kib:

URL: https://cgit.FreeBSD.org/src/commit/?id=2213820b6f4cd22bbfdc0f45741c3e7d17ae82c0

commit 2213820b6f4cd22bbfdc0f45741c3e7d17ae82c0
Author:     Konstantin Belousov <kib@FreeBSD.org>
AuthorDate: 2026-04-20 20:02:13 +0000
Commit:     Konstantin Belousov <kib@FreeBSD.org>
CommitDate: 2026-05-03 19:58:36 +0000

    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:      1 week
    Differential revision:  https://reviews.freebsd.org/D56365
---
 sys/sys/fcntl.h | 7 +++++++
 1 file changed, 7 insertions(+)

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


home | help

Want to link to this message? Use this
URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?69f7a907.3d8c9.3214c104>