[RFC PATCH 03/38] open: prefer openat syscall
Jonas Bonn
jonas at southpole.se
Tue Sep 6 08:30:27 UTC 2011
Signed-off-by: Jonas Bonn <jonas at southpole.se>
---
libc/sysdeps/linux/common/open.c | 7 +++++++
1 files changed, 7 insertions(+), 0 deletions(-)
diff --git a/libc/sysdeps/linux/common/open.c b/libc/sysdeps/linux/common/open.c
index 9fb694d..c94b0d1 100644
--- a/libc/sysdeps/linux/common/open.c
+++ b/libc/sysdeps/linux/common/open.c
@@ -14,9 +14,11 @@
#include <string.h>
#include <sys/param.h>
+#if ! defined __NR_openat
#define __NR___syscall_open __NR_open
static __inline__ _syscall3(int, __syscall_open, const char *, file,
int, flags, __kernel_mode_t, mode)
+#endif
int open(const char *file, int oflag, ...)
{
@@ -29,8 +31,13 @@ int open(const char *file, int oflag, ...)
va_end(arg);
}
+#ifdef __NR_openat
+ return openat(AT_FDCWD, file, oflag, mode);
+#else
return __syscall_open(file, oflag, mode);
+#endif
}
+
#ifndef __LINUXTHREADS_OLD__
libc_hidden_def(open)
#else
--
1.7.5.4
More information about the uClibc
mailing list