[RFC PATCH 04/38] link: prefer linkat syscall

Jonas Bonn jonas at southpole.se
Tue Sep 6 08:30:28 UTC 2011


Signed-off-by: Jonas Bonn <jonas at southpole.se>
---
 libc/sysdeps/linux/common/link.c |   10 ++++++++++
 1 files changed, 10 insertions(+), 0 deletions(-)

diff --git a/libc/sysdeps/linux/common/link.c b/libc/sysdeps/linux/common/link.c
index b5e5536..e805949 100644
--- a/libc/sysdeps/linux/common/link.c
+++ b/libc/sysdeps/linux/common/link.c
@@ -9,4 +9,14 @@
 
 #include <sys/syscall.h>
 #include <unistd.h>
+#include <fcntl.h>
+
+#ifdef __NR_linkat
+int link(const char* oldpath, const char* newpath)
+{
+	return linkat(AT_FDCWD, oldpath, AT_FDCWD, newpath, 0);
+}
+
+#elif defined __NR_link
 _syscall2(int, link, const char *, oldpath, const char *, newpath)
+#endif
-- 
1.7.5.4



More information about the uClibc mailing list