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

Markos Chandras markos.chandras at gmail.com
Tue Nov 13 11:31:50 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 files changed, 8 insertions(+), 1 deletions(-)

diff --git a/libc/sysdeps/linux/common/open64.c b/libc/sysdeps/linux/common/open64.c
index c1f5400..675f8e1 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.7.1




More information about the uClibc mailing list