If argument passing to register case (ex. -mregparam=3).
This case set all parameters set to register from caller.
But callee refer to stack. So can't get parameter.
Signed-off-by: Yoshinori Sato <ysato(a)users.sourceforge.jp>
---
include/fcntl.h | 4 ++--
libc/sysdeps/linux/common/open.c | 4 ++--
libc/sysdeps/linux/common/openat.c | 15 ++++++++++++++-
3 files changed, 18 insertions(+), 5 deletions(-)
diff --git a/include/fcntl.h b/include/fcntl.h
index adcd7ef..683f976 100644
--- a/include/fcntl.h
+++ b/include/fcntl.h
@@ -108,8 +108,8 @@ libc_hidden_proto(fcntl64)
extern int open (const char *__file, int __oflag, ...) __nonnull ((1));
libc_hidden_proto(open)
# ifdef _LIBC
-extern int __open2_nocancel(const char *, int) __nonnull ((1)) attribute_hidden;
-extern int __open_nocancel(const char *, int, mode_t) __nonnull ((1)) attribute_hidden;
+extern int __open2_nocancel(const char *, int, ...) __nonnull ((1)) attribute_hidden;
+extern int __open_nocancel(const char *, int, ...) __nonnull ((1)) attribute_hidden;
# endif
#else
# ifdef __REDIRECT
diff --git a/libc/sysdeps/linux/common/open.c b/libc/sysdeps/linux/common/open.c
index aab0fb5..909201a 100644
--- a/libc/sysdeps/linux/common/open.c
+++ b/libc/sysdeps/linux/common/open.c
@@ -21,8 +21,8 @@ strong_alias_untyped(__syscall_open,__NC(open))
# define __NR___open2_nocancel __NR_open
_syscall2(int, __NC(open2), const char *, file, int, flags)
#else
-int __open2_nocancel(const char *, int) __nonnull ((1)) attribute_hidden;
-int __open_nocancel(const char *, int, mode_t) __nonnull ((1)) attribute_hidden;
+int __open2_nocancel(const char *, int, ...) __nonnull ((1)) attribute_hidden;
+int __open_nocancel(const char *, int, ...) __nonnull ((1)) attribute_hidden;
#endif
int open(const char *file, int oflag, ...)
diff --git a/libc/sysdeps/linux/common/openat.c b/libc/sysdeps/linux/common/openat.c
index f6032da..f71567c 100644
--- a/libc/sysdeps/linux/common/openat.c
+++ b/libc/sysdeps/linux/common/openat.c
@@ -8,11 +8,24 @@
#include <sys/syscall.h>
#include <fcntl.h>
+#include <stdarg.h>
#ifdef __NR_openat
# define __NR___syscall_openat __NR_openat
static __inline__ _syscall4(int, __syscall_openat, int, fd, const char *, file, int,
oflag, mode_t, mode)
-strong_alias_untyped(__syscall_openat,openat)
+
+int __openat(int fd, const char *file, int o_flag, ...)
+{
+ va_list ap;
+ mode_t mode;
+
+ va_start(ap, o_flag);
+ mode = va_arg(ap, int);
+ va_end(ap);
+ return __syscall_openat(fd, file, o_flag, mode);
+}
+
+strong_alias_untyped(__openat,openat)
libc_hidden_def(openat)
#else
/* should add emulation with open() and /proc/self/fd/ ... */
--
2.6.1