summaryrefslogtreecommitdiff
path: root/libc
diff options
context:
space:
mode:
Diffstat (limited to 'libc')
-rw-r--r--libc/sysdeps/linux/common/stubs.c2
-rw-r--r--libc/sysdeps/linux/common/symlink.c16
-rw-r--r--libc/sysdeps/linux/common/symlinkat.c1
3 files changed, 16 insertions, 3 deletions
diff --git a/libc/sysdeps/linux/common/stubs.c b/libc/sysdeps/linux/common/stubs.c
index 1fc23933c..1f985e05f 100644
--- a/libc/sysdeps/linux/common/stubs.c
+++ b/libc/sysdeps/linux/common/stubs.c
@@ -403,7 +403,7 @@ make_stub(swapoff)
make_stub(swapon)
#endif
-#ifndef __NR_symlink
+#if !defined __NR_symlink && !defined __NR_symlinkat
make_stub(symlink)
#endif
diff --git a/libc/sysdeps/linux/common/symlink.c b/libc/sysdeps/linux/common/symlink.c
index 15a576d70..eee6e8fa0 100644
--- a/libc/sysdeps/linux/common/symlink.c
+++ b/libc/sysdeps/linux/common/symlink.c
@@ -8,8 +8,20 @@
*/
#include <sys/syscall.h>
-
-#if defined __NR_symlink && (defined __USE_BSD || defined __USE_UNIX98 || defined __USE_XOPEN2K)
+#if defined __USE_BSD || defined __USE_UNIX98 || defined __USE_XOPEN2K
# include <unistd.h>
+
+# if defined __NR_symlinkat && !defined __NR_symlink
+# include <fcntl.h>
+int symlink(const char *oldpath, const char *newpath)
+{
+ return symlinkat(oldpath, AT_FDCWD, newpath);
+}
+
+# elif defined(__NR_symlink)
+
_syscall2(int, symlink, const char *, oldpath, const char *, newpath)
+
+# endif
+
#endif
diff --git a/libc/sysdeps/linux/common/symlinkat.c b/libc/sysdeps/linux/common/symlinkat.c
index 6381b3319..91815810c 100644
--- a/libc/sysdeps/linux/common/symlinkat.c
+++ b/libc/sysdeps/linux/common/symlinkat.c
@@ -11,6 +11,7 @@
#ifdef __NR_symlinkat
_syscall3(int, symlinkat, const char *, from, int, tofd, const char *, to)
+libc_hidden_def(symlinkat)
#else
/* should add emulation with symlink() and /proc/self/fd/ ... */
#endif