@@ -2,31 +2,43 @@
#include <io/fcntl.h>
#ifndef _ISOMAC
+
+#ifdef FCNTL_INTERNAL_NAMED_ARGS
+#define MODE mode_t mode
+#define FCNTL_ARG void *arg
+#else
+#define MODE ...
+#define FCNTL_ARG ...
+#endif
+
/* Now define the internal interfaces. */
-extern int __open64 (const char *__file, int __oflag, ...);
+extern int __open64 (const char *__file, int __oflag, MODE);
libc_hidden_proto (__open64)
-extern int __libc_open64 (const char *file, int oflag, ...);
-extern int __libc_open (const char *file, int oflag, ...);
+extern int __libc_open64 (const char *file, int oflag, MODE);
+extern int __libc_open (const char *file, int oflag, MODE);
libc_hidden_proto (__libc_open)
-extern int __libc_fcntl (int fd, int cmd, ...);
+extern int __libc_fcntl (int fd, int cmd, FCNTL_ARG);
libc_hidden_proto (__libc_fcntl)
extern int __fcntl64_nocancel_adjusted (int fd, int cmd, void *arg)
attribute_hidden;
-extern int __libc_fcntl64 (int fd, int cmd, ...);
+extern int __libc_fcntl64 (int fd, int cmd, FCNTL_ARG);
libc_hidden_proto (__libc_fcntl64)
-extern int __open (const char *__file, int __oflag, ...);
+extern int __open (const char *__file, int __oflag, MODE);
libc_hidden_proto (__open)
-extern int __fcntl (int __fd, int __cmd, ...);
+extern int __fcntl (int __fd, int __cmd, FCNTL_ARG);
libc_hidden_proto (__fcntl)
-extern int __fcntl64 (int __fd, int __cmd, ...) attribute_hidden;
+extern int __fcntl64 (int __fd, int __cmd, FCNTL_ARG) attribute_hidden;
libc_hidden_proto (__fcntl64)
-extern int __openat (int __fd, const char *__file, int __oflag, ...)
+extern int __openat (int __fd, const char *__file, int __oflag, MODE)
__nonnull ((2));
libc_hidden_proto (__openat)
-extern int __openat64 (int __fd, const char *__file, int __oflag, ...)
+extern int __openat64 (int __fd, const char *__file, int __oflag, MODE)
__nonnull ((2));
libc_hidden_proto (__openat64)
+#undef MODE
+#undef FCNTL_ARG
+
extern int __open_2 (const char *__path, int __oflag);
extern int __open64_2 (const char *__path, int __oflag);
extern int __openat_2 (int __fd, const char *__path, int __oflag);
@@ -16,14 +16,23 @@
License along with the GNU C Library; if not, see
<https://www.gnu.org/licenses/>. */
+#include <sysdep-cancel.h>
+
+#ifdef __ASSUME_SYSCALL_NAMED_WORKS
+#define FCNTL_INTERNAL_NAMED_ARGS 1
+#define fcntl64 __no_decl_fcntl64
+#else
+#include <stdarg.h>
+#endif
+
#define fcntl __no_decl_fcntl
#define __fcntl __no_decl___fcntl
#include <fcntl.h>
#undef fcntl
#undef __fcntl
-#include <stdarg.h>
+#undef fcntl64
+
#include <errno.h>
-#include <sysdep-cancel.h>
#ifndef __NR_fcntl64
# define __NR_fcntl64 __NR_fcntl
@@ -33,6 +42,24 @@
# define FCNTL_ADJUST_CMD(__cmd) __cmd
#endif
+static inline int
+do_fcntl64 (int fd, int cmd, void *arg)
+{
+ cmd = FCNTL_ADJUST_CMD (cmd);
+
+ if (cmd == F_SETLKW || cmd == F_SETLKW64 || cmd == F_OFD_SETLKW)
+ return SYSCALL_CANCEL (fcntl64, fd, cmd, arg);
+
+ return __fcntl64_nocancel_adjusted (fd, cmd, arg);
+}
+
+#if __ASSUME_SYSCALL_NAMED_WORKS
+int
+__libc_fcntl64 (int fd, int cmd, void *arg)
+{
+ return do_fcntl64 (fd, cmd, arg);
+}
+#else
int
__libc_fcntl64 (int fd, int cmd, ...)
{
@@ -43,13 +70,10 @@ __libc_fcntl64 (int fd, int cmd, ...)
arg = va_arg (ap, void *);
va_end (ap);
- cmd = FCNTL_ADJUST_CMD (cmd);
-
- if (cmd == F_SETLKW || cmd == F_SETLKW64 || cmd == F_OFD_SETLKW)
- return SYSCALL_CANCEL (fcntl64, fd, cmd, arg);
-
- return __fcntl64_nocancel_adjusted (fd, cmd, arg);
+ return do_fcntl64 (fd, cmd, arg);
}
+#endif
+
libc_hidden_def (__libc_fcntl64)
weak_alias (__libc_fcntl64, __fcntl64)
libc_hidden_weak (__fcntl64)
@@ -16,10 +16,17 @@
License along with the GNU C Library; if not, see
<https://www.gnu.org/licenses/>. */
-#include <fcntl.h>
+#include <sysdep-cancel.h>
+
+#ifdef __ASSUME_SYSCALL_NAMED_WORKS
+#define FCNTL_INTERNAL_NAMED_ARGS 1
+#else
#include <stdarg.h>
+#endif
+
#include <errno.h>
-#include <sysdep-cancel.h>
+
+#include <fcntl.h>
#include <not-cancel.h>
#ifndef __NR_fcntl64
@@ -30,6 +37,19 @@
# define FCNTL_ADJUST_CMD(__cmd) __cmd
#endif
+static inline int
+do_fcntl64_nocancel (int fd, int cmd, void *arg)
+{
+ return __fcntl64_nocancel_adjusted (fd, FCNTL_ADJUST_CMD (cmd), arg);
+}
+
+#ifdef __ASSUME_SYSCALL_NAMED_WORKS
+int
+__fcntl64_nocancel (int fd, int cmd, void *arg)
+{
+ return do_fcntl64_nocancel (fd, cmd, arg);
+}
+#else
int
__fcntl64_nocancel (int fd, int cmd, ...)
{
@@ -40,10 +60,10 @@ __fcntl64_nocancel (int fd, int cmd, ...)
arg = va_arg (ap, void *);
va_end (ap);
- cmd = FCNTL_ADJUST_CMD (cmd);
-
- return __fcntl64_nocancel_adjusted (fd, cmd, arg);
+ return do_fcntl64_nocancel (fd, cmd, arg);
}
+#endif
+
hidden_def (__fcntl64_nocancel)
int
@@ -16,19 +16,18 @@
License along with the GNU C Library. If not, see
<https://www.gnu.org/licenses/>. */
+#include <sysdep.h>
+
+#ifndef __ASSUME_SYSCALL_NAMED_WORKS
#include <stdarg.h>
#include <sys/ioctl.h>
-#include <sysdep.h>
+#endif
+
#include <internal-ioctl.h>
-int
-__ioctl (int fd, unsigned long int request, ...)
+static inline int
+do_ioctl (int fd, unsigned long int request, void *arg)
{
- va_list args;
- va_start (args, request);
- void *arg = va_arg (args, void *);
- va_end (args);
-
int r;
if (!__ioctl_arch (&r, fd, request, arg))
{
@@ -41,6 +40,29 @@ __ioctl (int fd, unsigned long int request, ...)
}
return r;
}
+
+#ifdef __ASSUME_SYSCALL_NAMED_WORKS
+__typeof (do_ioctl) __ioctl;
+libc_hidden_proto(__ioctl)
+
+int
+__ioctl (int fd, unsigned long int request, void *arg)
+{
+ return do_ioctl (fd, request, arg);
+}
+#else
+int
+__ioctl (int fd, unsigned long int request, ...)
+{
+ va_list args;
+ va_start (args, request);
+ void *arg = va_arg (args, void *);
+ va_end (args);
+
+ return do_ioctl (fd, request, arg);
+}
+#endif
+
libc_hidden_def (__ioctl)
weak_alias (__ioctl, ioctl)
@@ -16,11 +16,40 @@
License along with the GNU C Library; if not, see
<https://www.gnu.org/licenses/>. */
-#include <sys/mman.h>
#include <sysdep.h>
+
+#ifdef __ASSUME_SYSCALL_NAMED_WORKS
+#define mremap __no_decl_mremap
+#define __mremap __no_decl___mremap
+#else
#include <stdarg.h>
+#endif
+
+#include <sys/mman.h>
+
+#undef mremap
+#undef __mremap
+
#include <stddef.h>
+static inline void *
+do_mremap (void *addr, size_t old_len, size_t new_len, int flags,
+ void *new_addr)
+{
+ return (void *) INLINE_SYSCALL_CALL (mremap, addr, old_len, new_len, flags,
+ new_addr);
+}
+
+#ifdef __ASSUME_SYSCALL_NAMED_WORKS
+__typeof (do_mremap) __mremap;
+libc_hidden_proto (__mremap)
+
+void *
+__mremap (void *addr, size_t old_len, size_t new_len, int flags, void *new_addr)
+{
+ return do_mremap (addr, old_len, new_len, flags, new_addr);
+}
+#else
void *
__mremap (void *addr, size_t old_len, size_t new_len, int flags, ...)
{
@@ -34,8 +63,9 @@ __mremap (void *addr, size_t old_len, size_t new_len, int flags, ...)
va_end (va);
}
- return (void *) INLINE_SYSCALL_CALL (mremap, addr, old_len, new_len, flags,
- new_addr);
+ return do_mremap (addr, old_len, new_len, flags, new_addr);
}
+#endif
+
libc_hidden_def (__mremap)
weak_alias (__mremap, mremap)
@@ -29,16 +29,16 @@
#include <time.h>
/* Non cancellable open syscall. */
-__typeof (open) __open_nocancel;
+__typeof (__open) __open_nocancel;
/* Non cancellable open syscall (LFS version). */
-__typeof (open64) __open64_nocancel;
+__typeof (__open64) __open64_nocancel;
/* Non cancellable openat syscall. */
-__typeof (openat) __openat_nocancel;
+__typeof (__openat) __openat_nocancel;
/* Non cacellable openat syscall (LFS version). */
-__typeof (openat64) __openat64_nocancel;
+__typeof (__openat64) __openat64_nocancel;
/* Non cancellable read syscall. */
__typeof (__read) __read_nocancel;
@@ -18,17 +18,42 @@
#include <sys/types.h>
#include <sys/stat.h>
-#include <fcntl.h>
-#include <stdarg.h>
#include <sysdep-cancel.h>
#include <shlib-compat.h>
+#ifdef __ASSUME_SYSCALL_NAMED_WORKS
+#define FCNTL_INTERNAL_NAMED_ARGS 1
+#define open64 __no_decl_open64
+#define open __no_decl_open
+#else
+#include <stdarg.h>
+#endif
+
+#include <fcntl.h>
+
+#undef open64
+#undef open
+
+static inline int
+do_open64 (const char *file, int oflag, mode_t mode)
+{
+ return SYSCALL_CANCEL (openat, AT_FDCWD, file, oflag | O_LARGEFILE,
+ mode);
+}
+
/* Open FILE with access OFLAG. If O_CREAT or O_TMPFILE is in OFLAG,
a third argument is the file protection. */
+#ifdef __ASSUME_SYSCALL_NAMED_WORKS
+int
+__libc_open64 (const char *file, int oflag, mode_t mode)
+{
+ return do_open64 (file, oflag, mode);
+}
+#else
int
__libc_open64 (const char *file, int oflag, ...)
{
- int mode = 0;
+ mode_t mode = 0;
if (__OPEN_NEEDS_MODE (oflag))
{
@@ -38,9 +63,9 @@ __libc_open64 (const char *file, int oflag, ...)
va_end (arg);
}
- return SYSCALL_CANCEL (openat, AT_FDCWD, file, oflag | O_LARGEFILE,
- mode);
+ return do_open64 (file, oflag, mode);
}
+#endif
strong_alias (__libc_open64, __open64)
libc_hidden_weak (__open64)
@@ -16,17 +16,38 @@
License along with the GNU C Library; if not, see
<https://www.gnu.org/licenses/>. */
+#include <sysdep.h>
+
+#ifdef __ASSUME_SYSCALL_NAMED_WORKS
+#define FCNTL_INTERNAL_NAMED_ARGS 1
+#else
+#include <stdarg.h>
+#endif
+
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
-#include <stdarg.h>
#include <not-cancel.h>
+static inline int
+do_open64_nocancel (const char *file, int oflag, mode_t mode)
+{
+ return INLINE_SYSCALL_CALL (openat, AT_FDCWD, file, oflag | O_LARGEFILE,
+ mode);
+}
+
+#ifdef __ASSUME_SYSCALL_NAMED_WORKS
+int
+__open64_nocancel (const char *file, int oflag, mode_t mode)
+{
+ return do_open64_nocancel (file, oflag, mode);
+}
+#else
int
__open64_nocancel (const char *file, int oflag, ...)
{
- int mode = 0;
+ mode_t mode = 0;
if (__OPEN_NEEDS_MODE (oflag))
{
@@ -36,9 +57,9 @@ __open64_nocancel (const char *file, int oflag, ...)
va_end (arg);
}
- return INLINE_SYSCALL_CALL (openat, AT_FDCWD, file, oflag | O_LARGEFILE,
- mode);
+ return do_open64_nocancel (file, oflag, mode);
}
+#endif
hidden_def (__open64_nocancel)
@@ -16,14 +16,37 @@
License along with the GNU C Library; if not, see
<https://www.gnu.org/licenses/>. */
-#include <fcntl.h>
+#include <sysdep-cancel.h>
+
+#ifdef __ASSUME_SYSCALL_NAMED_WORKS
+#define FCNTL_INTERNAL_NAMED_ARGS 1
+#define openat64 __no_decl_openat64
+#define openat __no_decl_openat
+#else
#include <stdarg.h>
+#endif
-#include <sysdep-cancel.h>
+#include <fcntl.h>
+
+#undef openat64
+#undef openat
+
+static inline int
+do_openat64 (int fd, const char *file, int oflag, mode_t mode)
+{
+ return SYSCALL_CANCEL (openat, fd, file, oflag | O_LARGEFILE, mode);
+}
/* Open FILE with access OFLAG. Interpret relative paths relative to
the directory associated with FD. If OFLAG includes O_CREAT or
O_TMPFILE, a fourth argument is the file protection. */
+#ifdef __ASSUME_SYSCALL_NAMED_WORKS
+int
+__libc_openat64 (int fd, const char *file, int oflag, mode_t mode)
+{
+ return do_openat64 (fd, file, oflag, mode);
+}
+#else
int
__libc_openat64 (int fd, const char *file, int oflag, ...)
{
@@ -36,8 +59,9 @@ __libc_openat64 (int fd, const char *file, int oflag, ...)
va_end (arg);
}
- return SYSCALL_CANCEL (openat, fd, file, oflag | O_LARGEFILE, mode);
+ return do_openat64 (fd, file, oflag, mode);
}
+#endif
strong_alias (__libc_openat64, __openat64)
libc_hidden_weak (__openat64)
@@ -16,12 +16,32 @@
License along with the GNU C Library; if not, see
<https://www.gnu.org/licenses/>. */
-#include <fcntl.h>
+#include <sysdep-cancel.h>
+
+#ifdef __ASSUME_SYSCALL_NAMED_WORKS
+#define FCNTL_INTERNAL_NAMED_ARGS 1
+#else
#include <stdarg.h>
+#endif
+
+#include <fcntl.h>
-#include <sysdep-cancel.h>
#include <not-cancel.h>
+static inline int
+do_openat64_nocancel (int fd, const char *file, int oflag, mode_t mode)
+{
+ return INLINE_SYSCALL_CALL (openat, fd, file, oflag | O_LARGEFILE,
+ mode);
+}
+
+#ifdef __ASSUME_SYSCALL_NAMED_WORKS
+int
+__openat64_nocancel (int fd, const char *file, int oflag, mode_t mode)
+{
+ return do_openat64_nocancel (fd, file, oflag, mode);
+}
+#else
int
__openat64_nocancel (int fd, const char *file, int oflag, ...)
{
@@ -34,9 +54,10 @@ __openat64_nocancel (int fd, const char *file, int oflag, ...)
va_end (arg);
}
- return INLINE_SYSCALL_CALL (openat, fd, file, oflag | O_LARGEFILE,
- mode);
+ return do_openat64_nocancel (fd, file, oflag, mode);
}
+#endif
+
hidden_def (__openat64_nocancel)
#ifdef __OFF_T_MATCHES_OFF64_T
@@ -17,14 +17,34 @@
<https://www.gnu.org/licenses/>. */
#include <sysdep.h>
+
+#ifndef __ASSUME_SYSCALL_NAMED_WORKS
#include <stdarg.h>
#include <sys/prctl.h>
+#endif
+
+static inline int
+do_prctl (int option, unsigned long int arg2, unsigned long int arg3,
+ unsigned long int arg4, unsigned long int arg5)
+{
+ return INLINE_SYSCALL_CALL (prctl, option, arg2, arg3, arg4, arg5);
+}
/* Unconditionally read all potential arguments. This may pass
garbage values to the kernel, but avoids the need for teaching
glibc the argument counts of individual options (including ones
that are added to the kernel in the future). */
+#ifdef __ASSUME_SYSCALL_NAMED_WORKS
+__typeof (do_prctl) __prctl;
+libc_hidden_proto (__prctl)
+int
+__prctl (int option, unsigned long int arg2, unsigned long int arg3,
+ unsigned long int arg4, unsigned long int arg5)
+{
+ return do_prctl (option, arg2, arg3, arg4, arg5);
+}
+#else
int
__prctl (int option, ...)
{
@@ -35,8 +55,9 @@ __prctl (int option, ...)
unsigned long int arg4 = va_arg (arg, unsigned long int);
unsigned long int arg5 = va_arg (arg, unsigned long int);
va_end (arg);
- return INLINE_SYSCALL_CALL (prctl, option, arg2, arg3, arg4, arg5);
+ return do_prctl (option, arg2, arg3, arg4, arg5);
}
+#endif
libc_hidden_def (__prctl)
weak_alias (__prctl, prctl)
@@ -17,7 +17,6 @@
#include <errno.h>
#include <sys/types.h>
-#include <sys/ptrace.h>
#include <sys/user.h>
#include <stdarg.h>
#include <signal.h>
@@ -25,19 +24,17 @@
#include <sysdep.h>
#include <sys/syscall.h>
-long int
-ptrace (enum __ptrace_request request, ...)
+#ifdef __ASSUME_SYSCALL_NAMED_WORKS
+#define ptrace __no_decl_ptrace
+#endif
+
+#include <sys/ptrace.h>
+#undef ptrace
+
+static inline long int
+do_ptrace (enum __ptrace_request request, pid_t pid, void *addr, void *data)
{
long int res, ret;
- va_list ap;
- pid_t pid;
- void *addr, *data;
-
- va_start (ap, request);
- pid = va_arg (ap, pid_t);
- addr = va_arg (ap, void *);
- data = va_arg (ap, void *);
- va_end (ap);
if (request > 0 && request < 4)
data = &ret;
@@ -51,3 +48,27 @@ ptrace (enum __ptrace_request request, ...)
return res;
}
+
+#ifdef __ASSUME_SYSCALL_NAMED_WORKS
+long int
+ptrace (enum __ptrace_request request, pid_t pid, void *addr, void *data)
+{
+ return do_ptrace (request, pid, addr, data);
+}
+#else
+long int
+ptrace (enum __ptrace_request request, ...)
+{
+ va_list ap;
+ pid_t pid;
+ void *addr, *data;
+
+ va_start (ap, request);
+ pid = va_arg (ap, pid_t);
+ addr = va_arg (ap, void *);
+ data = va_arg (ap, void *);
+ va_end (ap);
+
+ return do_ptrace (request, pid, addr, data);
+}
+#endif