[RFC PATCH 38/38] Fixup not_cancel versions of open

Jonas Bonn jonas at southpole.se
Tue Sep 6 08:31:02 UTC 2011


If __NR_open isn't defined, as for new architectures in Linux, then we
should be using the openat syscall instead.  The easiest way to do this
is to simply invoke the open() function.

Signed-off-by: Jonas Bonn <jonas at southpole.se>
---
 libc/sysdeps/linux/common/not-cancel.h             |    6 ++++++
 .../linuxthreads.old/sysdeps/pthread/not-cancel.h  |    5 +++++
 2 files changed, 11 insertions(+), 0 deletions(-)

diff --git a/libc/sysdeps/linux/common/not-cancel.h b/libc/sysdeps/linux/common/not-cancel.h
index 9418417..aa6dd9d 100644
--- a/libc/sysdeps/linux/common/not-cancel.h
+++ b/libc/sysdeps/linux/common/not-cancel.h
@@ -20,11 +20,17 @@
 
 #include <sysdep.h>
 
+#ifndef __NR_open
+#define open_not_cancel(name, flags, mode) open(name, flags, mode)
+#define open_not_cancel_2(name, flags) open(name, flags)
+
+#else
 /* Uncancelable open.  */
 #define open_not_cancel(name, flags, mode) \
    INLINE_SYSCALL (open, 3, (const char *) (name), (flags), (mode))
 #define open_not_cancel_2(name, flags) \
    INLINE_SYSCALL (open, 2, (const char *) (name), (flags))
+#endif
 
 /* Uncancelable close.  */
 #define close_not_cancel(fd) \
diff --git a/libpthread/linuxthreads.old/sysdeps/pthread/not-cancel.h b/libpthread/linuxthreads.old/sysdeps/pthread/not-cancel.h
index 80d33be..03a0598 100644
--- a/libpthread/linuxthreads.old/sysdeps/pthread/not-cancel.h
+++ b/libpthread/linuxthreads.old/sysdeps/pthread/not-cancel.h
@@ -20,12 +20,17 @@
 
 #include <sys/types.h>
 #include <sysdep.h>
+#define open_not_cancel(name, flags, mode) open(name, flags, mode)
+#define open_not_cancel_2(name, flags) open(name, flags)
 
+#ifndef __NR_open
+#else
 /* Uncancelable open.  */
 #define open_not_cancel(name, flags, mode) \
    INLINE_SYSCALL (open, 3, (const char *) (name), (flags), (mode))
 #define open_not_cancel_2(name, flags) \
    INLINE_SYSCALL (open, 2, (const char *) (name), (flags))
+#endif
 
 /* Uncancelable openat.  */
 #if !defined NOT_IN_libc || defined IS_IN_libpthread || defined IS_IN_librt
-- 
1.7.5.4



More information about the uClibc mailing list