summaryrefslogtreecommitdiff
path: root/libc/sysdeps/linux/common
diff options
context:
space:
mode:
Diffstat (limited to 'libc/sysdeps/linux/common')
-rw-r--r--libc/sysdeps/linux/common/readlink.c8
-rw-r--r--libc/sysdeps/linux/common/readlinkat.c1
2 files changed, 9 insertions, 0 deletions
diff --git a/libc/sysdeps/linux/common/readlink.c b/libc/sysdeps/linux/common/readlink.c
index ef9e83539..f64aeb947 100644
--- a/libc/sysdeps/linux/common/readlink.c
+++ b/libc/sysdeps/linux/common/readlink.c
@@ -10,5 +10,13 @@
#include <sys/syscall.h>
#include <unistd.h>
+#if defined(__NR_readlinkat) && !defined(__NR_readlink)
+# include <fcntl.h>
+ssize_t readlink (const char *path, char *buf, size_t len)
+{
+ return readlinkat(AT_FDCWD, path, buf, len);
+}
+#else
_syscall3(ssize_t, readlink, const char *, path, char *, buf, size_t, bufsiz)
+#endif
libc_hidden_def(readlink)
diff --git a/libc/sysdeps/linux/common/readlinkat.c b/libc/sysdeps/linux/common/readlinkat.c
index d0a98e115..995b9e2c1 100644
--- a/libc/sysdeps/linux/common/readlinkat.c
+++ b/libc/sysdeps/linux/common/readlinkat.c
@@ -11,6 +11,7 @@
#ifdef __NR_readlinkat
_syscall4(ssize_t, readlinkat, int, fd, const char *, path, char *, buf, size_t, len)
+libc_hidden_def(readlinkat)
#else
/* should add emulation with readlink() and /proc/self/fd/ ... */
#endif