Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F153830988
D56365.id.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
Size
1 KB
Referenced Files
None
Subscribers
None
D56365.id.diff
View Options
diff --git a/include/unistd.h b/include/unistd.h
--- a/include/unistd.h
+++ b/include/unistd.h
@@ -518,6 +518,7 @@
int feature_present(const char *);
int fchroot(int);
char *fflagstostr(u_long);
+ssize_t freadlink(int fd, char *buf, size_t bufsize);
int getdomainname(char *, int);
int getentropy(void *, size_t);
int getgrouplist(const char *, gid_t, gid_t *, int *);
diff --git a/lib/libc/gen/Makefile.inc b/lib/libc/gen/Makefile.inc
--- a/lib/libc/gen/Makefile.inc
+++ b/lib/libc/gen/Makefile.inc
@@ -56,6 +56,7 @@
fmtmsg.c \
fnmatch.c \
fpclassify.c \
+ freadlink.c \
frexp.c \
fstab.c \
ftok.c \
diff --git a/lib/libc/gen/Symbol.map b/lib/libc/gen/Symbol.map
--- a/lib/libc/gen/Symbol.map
+++ b/lib/libc/gen/Symbol.map
@@ -475,6 +475,7 @@
};
FBSD_1.9 {
+ freadlink;
posix_spawn_file_actions_addchdir;
posix_spawn_file_actions_addfchdir;
posix_spawnattr_getexecfd_np;
diff --git a/lib/libc/gen/freadlink.c b/lib/libc/gen/freadlink.c
new file mode 100644
--- /dev/null
+++ b/lib/libc/gen/freadlink.c
@@ -0,0 +1,16 @@
+/*-
+ * SPDX-License-Identifier: BSD-2-Clause
+ *
+ * Copyright 2026 The FreeBSD Foundation
+ *
+ * This software were developed by Konstantin Belousov <kib@FreeBSD.org>
+ * under sponsorship from the FreeBSD Foundation.
+ */
+
+#include <unistd.h>
+
+ssize_t
+freadlink(int fd, char *buf, size_t bufsize)
+{
+ return (readlinkat(fd, "", buf, bufsize));
+}
diff --git a/sys/sys/fcntl.h b/sys/sys/fcntl.h
--- a/sys/sys/fcntl.h
+++ b/sys/sys/fcntl.h
@@ -142,6 +142,13 @@
#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
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Sat, Apr 25, 2:24 AM (5 h, 16 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
32105444
Default Alt Text
D56365.id.diff (1 KB)
Attached To
Mode
D56365: Add O_SYMLINK emulation and freadlink(3)
Attached
Detach File
Event Timeline
Log In to Comment