From: Markos Chandras <markos.chand...@imgtec.com> Signed-off-by: Markos Chandras <markos.chand...@imgtec.com> --- include/unistd.h | 1 + libc/sysdeps/linux/common/symlink.c | 13 +++++++++++++ libc/sysdeps/linux/common/symlinkat.c | 1 + 3 files changed, 15 insertions(+)
diff --git a/include/unistd.h b/include/unistd.h index bd75bbf..7f4db6d 100644 --- a/include/unistd.h +++ b/include/unistd.h @@ -845,6 +845,7 @@ libc_hidden_proto(readlink) /* Like symlink but a relative path in TO is interpreted relative to TOFD. */ extern int symlinkat (__const char *__from, int __tofd, __const char *__to) __THROW __nonnull ((1, 3)) __wur; +libc_hidden_proto(symlinkat) /* Like readlink but a relative PATH is interpreted relative to FD. */ extern ssize_t readlinkat (int __fd, __const char *__restrict __path, diff --git a/libc/sysdeps/linux/common/symlink.c b/libc/sysdeps/linux/common/symlink.c index e53e8d4..ab52015 100644 --- a/libc/sysdeps/linux/common/symlink.c +++ b/libc/sysdeps/linux/common/symlink.c @@ -9,6 +9,19 @@ #include <sys/syscall.h> #if defined __USE_BSD || defined __USE_UNIX98 || defined __USE_XOPEN2K +#include <fcntl.h> #include <unistd.h> + +#if defined(__NR_symlinkat) && !defined(__NR_symlink) +int symlink(const char *oldpath, const char *newpath) +{ + return symlinkat(oldpath, AT_FDCWD, newpath); +} + +#else + _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 6381b33..9181581 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 -- 1.8.0 _______________________________________________ uClibc mailing list uClibc@uclibc.org http://lists.busybox.net/mailman/listinfo/uclibc