From: Markos Chandras <markos.chand...@imgtec.com>

Signed-off-by: Markos Chandras <markos.chand...@imgtec.com>
---
 include/unistd.h                   | 1 +
 libc/sysdeps/linux/common/link.c   | 9 +++++++++
 libc/sysdeps/linux/common/linkat.c | 1 +
 3 files changed, 11 insertions(+)

diff --git a/include/unistd.h b/include/unistd.h
index 1540aa9..ee08e19 100644
--- a/include/unistd.h
+++ b/include/unistd.h
@@ -823,6 +823,7 @@ extern int link (__const char *__from, __const char *__to)
 extern int linkat (int __fromfd, __const char *__from, int __tofd,
                   __const char *__to, int __flags)
      __THROW __nonnull ((2, 4)) __wur;
+libc_hidden_proto(linkat)
 #endif
 
 #if defined __USE_BSD || defined __USE_XOPEN_EXTENDED || defined __USE_XOPEN2K
diff --git a/libc/sysdeps/linux/common/link.c b/libc/sysdeps/linux/common/link.c
index b5e5536..5856caa 100644
--- a/libc/sysdeps/linux/common/link.c
+++ b/libc/sysdeps/linux/common/link.c
@@ -8,5 +8,14 @@
  */
 
 #include <sys/syscall.h>
+#include <fcntl.h>
 #include <unistd.h>
+
+#if defined(__NR_linkat) && !defined(__NR_link)
+int link(const char *oldpath, const char *newpath)
+{
+       return linkat(AT_FDCWD, oldpath, AT_FDCWD, newpath, 0);
+}
+#else
 _syscall2(int, link, const char *, oldpath, const char *, newpath)
+#endif
diff --git a/libc/sysdeps/linux/common/linkat.c 
b/libc/sysdeps/linux/common/linkat.c
index 9abe9ec..26a3d08 100644
--- a/libc/sysdeps/linux/common/linkat.c
+++ b/libc/sysdeps/linux/common/linkat.c
@@ -11,6 +11,7 @@
 
 #ifdef __NR_linkat
 _syscall5(int, linkat, int, fromfd, const char *, from, int, tofd, const char 
*, to, int, flags)
+libc_hidden_def(linkat)
 #else
 /* should add emulation with link() and /proc/self/fd/ ... */
 #endif
-- 
1.8.0


_______________________________________________
uClibc mailing list
uClibc@uclibc.org
http://lists.busybox.net/mailman/listinfo/uclibc

Reply via email to