[PATCH v2 41/46] open64: Use openat if arch does not have the open syscall

Markos Chandras markos.chandras at gmail.com
Mon Nov 26 14:24:23 UTC 2012


From: Markos Chandras <markos.chandras at imgtec.com>

Signed-off-by: Markos Chandras <markos.chandras at imgtec.com>
---
 libc/sysdeps/linux/common/open64.c | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)

diff --git a/libc/sysdeps/linux/common/open64.c b/libc/sysdeps/linux/common/open64.c
index c1f5400..cb43af6 100644
--- a/libc/sysdeps/linux/common/open64.c
+++ b/libc/sysdeps/linux/common/open64.c
@@ -34,11 +34,18 @@ int open64 (const char *file, int oflag, ...)
 
 #ifdef __UCLIBC_HAS_THREADS_NATIVE__
   if (SINGLE_THREAD_P)
+#if defined(__NR_openat) && !defined(__NR_open)
+    return INLINE_SYSCALL (openat, 4, AT_FDCWD, file, oflag | O_LARGEFILE, mode);
+#else
     return INLINE_SYSCALL (open, 3, file, oflag | O_LARGEFILE, mode);
+#endif
 
   int oldtype = LIBC_CANCEL_ASYNC ();
-
+#if defined(__NR_openat) && !defined(__NR_open)
+  int result = INLINE_SYSCALL (openat, 4, AT_FDCWD, file, oflag | O_LARGEFILE, mode);
+#else
   int result = INLINE_SYSCALL (open, 3, file, oflag | O_LARGEFILE, mode);
+#endif
 
   LIBC_CANCEL_RESET (oldtype);
 
-- 
1.8.0




More information about the uClibc mailing list