diff options
Diffstat (limited to 'sysdeps')
63 files changed, 292 insertions, 287 deletions
diff --git a/sysdeps/unix/sysdep.h b/sysdeps/unix/sysdep.h index c4316db..52dad58 100644 --- a/sysdeps/unix/sysdep.h +++ b/sysdeps/unix/sysdep.h @@ -73,22 +73,3 @@ #ifndef INLINE_SYSCALL #define INLINE_SYSCALL(name, nr, args...) __syscall_##name (args) #endif - -/* Similar to INLINE_SYSCALL, but with return type. It should only be - used with function return. */ -#ifndef INLINE_SYSCALL_RETURN -#define INLINE_SYSCALL_RETURN(name, nr, type, args...) \ - INLINE_SYSCALL (name, nr, args) -#endif - -/* Set error number and return value. It should only be used with - function return. ERR is the negative error number returned from - the majority of Linux kernels for which -ERR is no-op - with INTERNAL_SYSCALL_ERRNO. */ -#ifndef INLINE_SYSCALL_ERROR_RETURN -#define INLINE_SYSCALL_ERROR_RETURN(err, type, value) \ - ({ \ - __set_errno (-err); \ - (type) (value); \ - }) -#endif diff --git a/sysdeps/unix/sysv/linux/adjtime.c b/sysdeps/unix/sysv/linux/adjtime.c index ad54cf8..b6fb7cf 100644 --- a/sysdeps/unix/sysv/linux/adjtime.c +++ b/sysdeps/unix/sysv/linux/adjtime.c @@ -61,7 +61,10 @@ ADJTIME (const struct TIMEVAL *itv, struct TIMEVAL *otv) tmp.tv_sec = itv->tv_sec + itv->tv_usec / 1000000L; tmp.tv_usec = itv->tv_usec % 1000000L; if (tmp.tv_sec > MAX_SEC || tmp.tv_sec < MIN_SEC) - return INLINE_SYSCALL_ERROR_RETURN (-EINVAL, int, -1); + { + __set_errno (EINVAL); + return -1; + } tntx.offset = tmp.tv_usec + tmp.tv_sec * 1000000L; tntx.modes = ADJ_OFFSET_SINGLESHOT; } diff --git a/sysdeps/unix/sysv/linux/aio_sigqueue.c b/sysdeps/unix/sysv/linux/aio_sigqueue.c index c56b94f..6a48e62 100644 --- a/sysdeps/unix/sysv/linux/aio_sigqueue.c +++ b/sysdeps/unix/sysv/linux/aio_sigqueue.c @@ -47,8 +47,7 @@ __aio_sigqueue (sig, val, caller_pid) info.si_uid = getuid (); info.si_value = val; - return INLINE_SYSCALL_RETURN (rt_sigqueueinfo, 3, int, info.si_pid, - sig, &info); + return INLINE_SYSCALL (rt_sigqueueinfo, 3, info.si_pid, sig, &info); } #else # include <rt/aio_sigqueue.c> diff --git a/sysdeps/unix/sysv/linux/dl-openat64.c b/sysdeps/unix/sysv/linux/dl-openat64.c index ffb13f3..732097d 100644 --- a/sysdeps/unix/sysv/linux/dl-openat64.c +++ b/sysdeps/unix/sysv/linux/dl-openat64.c @@ -31,9 +31,9 @@ openat64 (dfd, file, oflag) assert (!__OPEN_NEEDS_MODE (oflag)); #ifdef __NR_openat - return INLINE_SYSCALL_RETURN (openat, 3, int, dfd, file, - oflag | O_LARGEFILE); + return INLINE_SYSCALL (openat, 3, dfd, file, oflag | O_LARGEFILE); #else - return INLINE_SYSCALL_ERROR_RETURN (-ENOSYS, int, -1); + __set_errno (ENOSYS); + return -1; #endif } diff --git a/sysdeps/unix/sysv/linux/eventfd.c b/sysdeps/unix/sysv/linux/eventfd.c index 1496a0e..d4ffb3c 100644 --- a/sysdeps/unix/sysv/linux/eventfd.c +++ b/sysdeps/unix/sysv/linux/eventfd.c @@ -25,14 +25,11 @@ int eventfd (unsigned int count, int flags) { #ifdef __NR_eventfd2 + int res = INLINE_SYSCALL (eventfd2, 2, count, flags); # ifndef __ASSUME_EVENTFD2 - INTERNAL_SYSCALL_DECL (err); - int res = INTERNAL_SYSCALL (eventfd2, err, 2, count, flags); - if (!__glibc_unlikely (INTERNAL_SYSCALL_ERROR_P (res, err)) - || INTERNAL_SYSCALL_ERRNO (res, err) != ENOSYS) - return res; + if (res != -1 || errno != ENOSYS) # endif - return INLINE_SYSCALL_RETURN (eventfd2, 2, int, count, flags); + return res; #endif #ifndef __ASSUME_EVENTFD2 @@ -41,12 +38,16 @@ eventfd (unsigned int count, int flags) kernel (sys_indirect) before implementing setting flags like O_NONBLOCK etc. */ if (flags != 0) - return INLINE_SYSCALL_ERROR_RETURN (-EINVAL, int, -1) + { + __set_errno (EINVAL); + return -1; + } # ifdef __NR_eventfd - return INLINE_SYSCALL_RETURN (eventfd, 1, int, count) + return INLINE_SYSCALL (eventfd, 1, count); # else - return INLINE_SYSCALL_ERROR_RETURN (-ENOSYS, int, -1) + __set_errno (ENOSYS); + return -1; # endif #elif !defined __NR_eventfd2 # error "__ASSUME_EVENTFD2 defined but not __NR_eventfd2" diff --git a/sysdeps/unix/sysv/linux/faccessat.c b/sysdeps/unix/sysv/linux/faccessat.c index 6a0b1b7..1bb544f 100644 --- a/sysdeps/unix/sysv/linux/faccessat.c +++ b/sysdeps/unix/sysv/linux/faccessat.c @@ -35,10 +35,13 @@ faccessat (fd, file, mode, flag) int flag; { if (flag & ~(AT_SYMLINK_NOFOLLOW | AT_EACCESS)) - return INLINE_SYSCALL_ERROR_RETURN (-EINVAL, int, -1); + { + __set_errno (EINVAL); + return -1; + } if ((flag == 0 || ((flag & ~AT_EACCESS) == 0 && ! __libc_enable_secure))) - return INLINE_SYSCALL_RETURN (faccessat, 3, int, fd, file, mode); + return INLINE_SYSCALL (faccessat, 3, fd, file, mode); struct stat64 stats; if (__fxstatat64 (_STAT_VER, fd, file, &stats, flag & AT_SYMLINK_NOFOLLOW)) @@ -71,5 +74,6 @@ faccessat (fd, file, mode, flag) if (granted == mode) return 0; - return INLINE_SYSCALL_ERROR_RETURN (-EACCES, int, -1); + __set_errno (EACCES); + return -1; } diff --git a/sysdeps/unix/sysv/linux/fchmodat.c b/sysdeps/unix/sysv/linux/fchmodat.c index 025634b..e278426 100644 --- a/sysdeps/unix/sysv/linux/fchmodat.c +++ b/sysdeps/unix/sysv/linux/fchmodat.c @@ -34,11 +34,17 @@ fchmodat (fd, file, mode, flag) int flag; { if (flag & ~AT_SYMLINK_NOFOLLOW) - return INLINE_SYSCALL_ERROR_RETURN (-EINVAL, int, -1); + { + __set_errno (EINVAL); + return -1; + } #ifndef __NR_lchmod /* Linux so far has no lchmod syscall. */ if (flag & AT_SYMLINK_NOFOLLOW) - return INLINE_SYSCALL_ERROR_RETURN (-ENOTSUP, int, -1); + { + __set_errno (ENOTSUP); + return -1; + } #endif - return INLINE_SYSCALL_RETURN (fchmodat, 3, int, fd, file, mode); + return INLINE_SYSCALL (fchmodat, 3, fd, file, mode); } diff --git a/sysdeps/unix/sysv/linux/fcntl.c b/sysdeps/unix/sysv/linux/fcntl.c index a9a6b65..fa184db 100644 --- a/sysdeps/unix/sysv/linux/fcntl.c +++ b/sysdeps/unix/sysv/linux/fcntl.c @@ -28,7 +28,7 @@ static int do_fcntl (int fd, int cmd, void *arg) { if (cmd != F_GETOWN) - return INLINE_SYSCALL_RETURN (fcntl, 3, int, fd, cmd, arg); + return INLINE_SYSCALL (fcntl, 3, fd, cmd, arg); INTERNAL_SYSCALL_DECL (err); struct f_owner_ex fex; @@ -36,8 +36,8 @@ do_fcntl (int fd, int cmd, void *arg) if (!INTERNAL_SYSCALL_ERROR_P (res, err)) return fex.type == F_OWNER_GID ? -fex.pid : fex.pid; - return INLINE_SYSCALL_ERROR_RETURN (-INTERNAL_SYSCALL_ERRNO (res, err), - int, -1); + __set_errno (INTERNAL_SYSCALL_ERRNO (res, err)); + return -1; } diff --git a/sysdeps/unix/sysv/linux/fstatfs64.c b/sysdeps/unix/sysv/linux/fstatfs64.c index bba9918..af83830 100644 --- a/sysdeps/unix/sysv/linux/fstatfs64.c +++ b/sysdeps/unix/sysv/linux/fstatfs64.c @@ -35,17 +35,12 @@ __fstatfs64 (int fd, struct statfs64 *buf) if (! __no_statfs64) # endif { + int result = INLINE_SYSCALL (fstatfs64, 3, fd, sizeof (*buf), buf); + # if __ASSUME_STATFS64 == 0 - INTERNAL_SYSCALL_DECL (err); - int result = INTERNAL_SYSCALL (fstatfs64, err, 3, fd, - sizeof (*buf), buf); - if (!__glibc_unlikely (INTERNAL_SYSCALL_ERROR_P (result, err)) - || INTERNAL_SYSCALL_ERRNO (result, err) != ENOSYS) - return result; -# else - return INLINE_SYSCALL_RETURN (fstatfs64, 3, int, fd, - sizeof (*buf), buf); + if (result == 0 || errno != ENOSYS) # endif + return result; # if __ASSUME_STATFS64 == 0 __no_statfs64 = 1; diff --git a/sysdeps/unix/sysv/linux/ftruncate64.c b/sysdeps/unix/sysv/linux/ftruncate64.c index b466229..cc3c43c 100644 --- a/sysdeps/unix/sysv/linux/ftruncate64.c +++ b/sysdeps/unix/sysv/linux/ftruncate64.c @@ -29,7 +29,8 @@ __ftruncate64 (int fd, off64_t length) { unsigned int low = length & 0xffffffff; unsigned int high = length >> 32; - return INLINE_SYSCALL_RETURN (ftruncate64, 3, int, fd, - __LONG_LONG_PAIR (high, low)); + int result = INLINE_SYSCALL (ftruncate64, 3, fd, + __LONG_LONG_PAIR (high, low)); + return result; } weak_alias (__ftruncate64, ftruncate64) diff --git a/sysdeps/unix/sysv/linux/futimens.c b/sysdeps/unix/sysv/linux/futimens.c index dfc21c0..5f2b8a5 100644 --- a/sysdeps/unix/sysv/linux/futimens.c +++ b/sysdeps/unix/sysv/linux/futimens.c @@ -33,11 +33,15 @@ futimens (int fd, const struct timespec tsp[2]) { #ifdef __NR_utimensat if (fd < 0) - return INLINE_SYSCALL_ERROR_RETURN (-EBADF, int, -1); + { + __set_errno (EBADF); + return -1; + } /* Avoid implicit array coercion in syscall macros. */ - return INLINE_SYSCALL_RETURN (utimensat, 4, int, fd, NULL, &tsp[0], 0); + return INLINE_SYSCALL (utimensat, 4, fd, NULL, &tsp[0], 0); #else - return INLINE_SYSCALL_ERROR_RETURN (-ENOSYS, int, -1); + __set_errno (ENOSYS); + return -1; #endif } #ifndef __NR_utimensat diff --git a/sysdeps/unix/sysv/linux/futimes.c b/sysdeps/unix/sysv/linux/futimes.c index 72094b6..69ddfe1 100644 --- a/sysdeps/unix/sysv/linux/futimes.c +++ b/sysdeps/unix/sysv/linux/futimes.c @@ -40,13 +40,15 @@ __futimes (int fd, const struct timeval tvp[2]) { if (tvp[0].tv_usec < 0 || tvp[0].tv_usec >= 1000000 || tvp[1].tv_usec < 0 || tvp[1].tv_usec >= 1000000) - return INLINE_SYSCALL_ERROR_RETURN (-EINVAL, int, -1); + { + __set_errno (EINVAL); + return -1; + } TIMEVAL_TO_TIMESPEC (&tvp[0], &ts[0]); TIMEVAL_TO_TIMESPEC (&tvp[1], &ts[1]); } - return INLINE_SYSCALL_RETURN (utimensat, 4, int, fd, NULL, - tvp ? &ts : NULL, 0); + return INLINE_SYSCALL (utimensat, 4, fd, NULL, tvp ? &ts : NULL, 0); } weak_alias (__futimes, futimes) diff --git a/sysdeps/unix/sysv/linux/futimesat.c b/sysdeps/unix/sysv/linux/futimesat.c index 76ccec7..27d6870 100644 --- a/sysdeps/unix/sysv/linux/futimesat.c +++ b/sysdeps/unix/sysv/linux/futimesat.c @@ -34,5 +34,5 @@ futimesat (int fd, const char *file, const struct timeval tvp[2]) return __futimes (fd, tvp); /* Avoid implicit array coercion in syscall macros. */ - return INLINE_SYSCALL_RETURN (futimesat, 3, int, fd, file, &tvp[0]); + return INLINE_SYSCALL (futimesat, 3, fd, file, &tvp[0]); } diff --git a/sysdeps/unix/sysv/linux/fxstat.c b/sysdeps/unix/sysv/linux/fxstat.c index e81dc3f..8d8c4e1 100644 --- a/sysdeps/unix/sysv/linux/fxstat.c +++ b/sysdeps/unix/sysv/linux/fxstat.c @@ -36,21 +36,20 @@ int __fxstat (int vers, int fd, struct stat *buf) { if (vers == _STAT_VER_KERNEL) - return INLINE_SYSCALL_RETURN (fstat, 2, fd, - (struct kernel_stat *) buf); + return INLINE_SYSCALL (fstat, 2, fd, (struct kernel_stat *) buf); #ifdef STAT_IS_KERNEL_STAT - return INLINE_SYSCALL_ERROR_RETURN (-EINVAL, int, -1); + errno = EINVAL; + return -1; #else struct kernel_stat kbuf; - INTERNAL_SYSCALL_DECL (err); - int result = INTERNAL_SYSCALL (fstat, err, 2, fd, &kbuf); - if (__glibc_unlikely (INTERNAL_SYSCALL_ERROR_P (result, err))) - return INLINE_SYSCALL_ERROR_RETURN (-INTERNAL_SYSCALL_ERRNO (result, - err), - int, -1); - else - return __xstat_conv (vers, &kbuf, buf); + int result; + + result = INLINE_SYSCALL (fstat, 2, fd, &kbuf); + if (result == 0) + result = __xstat_conv (vers, &kbuf, buf); + + return result; #endif } diff --git a/sysdeps/unix/sysv/linux/fxstat64.c b/sysdeps/unix/sysv/linux/fxstat64.c index 97b06a8..7a0168d 100644 --- a/sysdeps/unix/sysv/linux/fxstat64.c +++ b/sysdeps/unix/sysv/linux/fxstat64.c @@ -31,12 +31,8 @@ int ___fxstat64 (int vers, int fd, struct stat64 *buf) { - INTERNAL_SYSCALL_DECL (err); - int result = INTERNAL_SYSCALL (fstat64, err, 2, fd, buf); - if (__glibc_unlikely (INTERNAL_SYSCALL_ERROR_P (result, err))) - return INLINE_SYSCALL_ERROR_RETURN (-INTERNAL_SYSCALL_ERRNO (result, - err), - int, -1); + int result; + result = INLINE_SYSCALL (fstat64, 2, fd, buf); #if defined _HAVE_STAT64___ST_INO && __ASSUME_ST_INO_64_BIT == 0 if (__builtin_expect (!result, 1) && buf->__st_ino != (__ino_t) buf->st_ino) buf->st_ino = buf->__st_ino; diff --git a/sysdeps/unix/sysv/linux/fxstatat.c b/sysdeps/unix/sysv/linux/fxstatat.c index 5259931..c88bcec 100644 --- a/sysdeps/unix/sysv/linux/fxstatat.c +++ b/sysdeps/unix/sysv/linux/fxstatat.c @@ -45,11 +45,7 @@ __fxstatat (int vers, int fd, const char *file, struct stat *st, int flag) #endif result = INTERNAL_SYSCALL (newfstatat, err, 4, fd, file, &kst, flag); - if (__glibc_unlikely (INTERNAL_SYSCALL_ERROR_P (result, err))) - return INLINE_SYSCALL_ERROR_RETURN (-INTERNAL_SYSCALL_ERRNO (result, - err), - int, -1); - else + if (!__builtin_expect (INTERNAL_SYSCALL_ERROR_P (result, err), 1)) { #ifdef STAT_IS_KERNEL_STAT return 0; @@ -57,6 +53,11 @@ __fxstatat (int vers, int fd, const char *file, struct stat *st, int flag) return __xstat_conv (vers, &kst, st); #endif } + else + { + __set_errno (INTERNAL_SYSCALL_ERRNO (result, err)); + return -1; + } } libc_hidden_def (__fxstatat) #ifdef XSTAT_IS_XSTAT64 diff --git a/sysdeps/unix/sysv/linux/fxstatat64.c b/sysdeps/unix/sysv/linux/fxstatat64.c index f4cd094..a55cf1d 100644 --- a/sysdeps/unix/sysv/linux/fxstatat64.c +++ b/sysdeps/unix/sysv/linux/fxstatat64.c @@ -32,17 +32,21 @@ int __fxstatat64 (int vers, int fd, const char *file, struct stat64 *st, int flag) { if (__glibc_unlikely (vers != _STAT_VER_LINUX)) - return INLINE_SYSCALL_ERROR_RETURN (-EINVAL, int, -1); + { + __set_errno (EINVAL); + return -1; + } int result; INTERNAL_SYSCALL_DECL (err); result = INTERNAL_SYSCALL (fstatat64, err, 4, fd, file, st, flag); - if (__glibc_unlikely (INTERNAL_SYSCALL_ERROR_P (result, err))) - return INLINE_SYSCALL_ERROR_RETURN (-INTERNAL_SYSCALL_ERRNO (result, - err), - int, -1); - else + if (!__builtin_expect (INTERNAL_SYSCALL_ERROR_P (result, err), 1)) return 0; + else + { + __set_errno (INTERNAL_SYSCALL_ERRNO (result, err)); + return -1; + } } libc_hidden_def (__fxstatat64) diff --git a/sysdeps/unix/sysv/linux/gai_sigqueue.c b/sysdeps/unix/sysv/linux/gai_sigqueue.c index fe4f36f..404dd68 100644 --- a/sysdeps/unix/sysv/linux/gai_sigqueue.c +++ b/sysdeps/unix/sysv/linux/gai_sigqueue.c @@ -47,8 +47,7 @@ __gai_sigqueue (sig, val, caller_pid) info.si_uid = __getuid (); info.si_value = val; - return INLINE_SYSCALL_RETURN (rt_sigqueueinfo, 3, int, info.si_pid, - sig, &info); + return INLINE_SYSCALL (rt_sigqueueinfo, 3, info.si_pid, sig, &info); } #else # include <resolv/gai_sigqueue.c> diff --git a/sysdeps/unix/sysv/linux/getpriority.c b/sysdeps/unix/sysv/linux/getpriority.c index 444995e..9c691bb 100644 --- a/sysdeps/unix/sysv/linux/getpriority.c +++ b/sysdeps/unix/sysv/linux/getpriority.c @@ -34,14 +34,12 @@ int __getpriority (enum __priority_which which, id_t who) { - INTERNAL_SYSCALL_DECL (err); - int res = INTERNAL_SYSCALL (getpriority, err, 2, (int) which, who); - if (__glibc_unlikely (INTERNAL_SYSCALL_ERROR_P (res, err))) - return INLINE_SYSCALL_ERROR_RETURN (-INTERNAL_SYSCALL_ERRNO (res, - err), - int, -1); - else - return PZERO - res; + int res; + + res = INLINE_SYSCALL (getpriority, 2, (int) which, who); + if (res >= 0) + res = PZERO - res; + return res; } libc_hidden_def (__getpriority) weak_alias (__getpriority, getpriority) diff --git a/sysdeps/unix/sysv/linux/getrlimit64.c b/sysdeps/unix/sysv/linux/getrlimit64.c index b0c8533..100ba62 100644 --- a/sysdeps/unix/sysv/linux/getrlimit64.c +++ b/sysdeps/unix/sysv/linux/getrlimit64.c @@ -27,15 +27,11 @@ int __getrlimit64 (enum __rlimit_resource resource, struct rlimit64 *rlimits) { #ifdef __ASSUME_PRLIMIT64 - return INLINE_SYSCALL_RETURN (prlimit64, 4, int, 0, resource, - NULL, rlimits); + return INLINE_SYSCALL (prlimit64, 4, 0, resource, NULL, rlimits); #else # ifdef __NR_prlimit64 - INTERNAL_SYSCALL_DECL (err); - int res = INTERNAL_SYSCALL (prlimit64, err, 4, 0, resource, NULL, - rlimits); - if (!__glibc_unlikely (INTERNAL_SYSCALL_ERROR_P (res, err)) - || INTERNAL_SYSCALL_ERRNO (res, err) != ENOSYS) + int res = INLINE_SYSCALL (prlimit64, 4, 0, resource, NULL, rlimits); + if (res == 0 || errno != ENOSYS) return res; # endif struct rlimit rlimits32; diff --git a/sysdeps/unix/sysv/linux/llseek.c b/sysdeps/unix/sysv/linux/llseek.c index 116e55b..80ac5e6 100644 --- a/sysdeps/unix/sysv/linux/llseek.c +++ b/sysdeps/unix/sysv/linux/llseek.c @@ -29,17 +29,10 @@ loff_t __llseek (int fd, loff_t offset, int whence) { loff_t retval; - INTERNAL_SYSCALL_DECL (err); - int result = INTERNAL_SYSCALL (_llseek, err, 5, fd, - (off_t) (offset >> 32), - (off_t) (offset & 0xffffffff), - &retval, whence); - if (__glibc_unlikely (INTERNAL_SYSCALL_ERROR_P (result, err))) - return INLINE_SYSCALL_ERROR_RETURN (-INTERNAL_SYSCALL_ERRNO (result, - err), - loff_t, -1); - else - return retval; + + return (loff_t) (INLINE_SYSCALL (_llseek, 5, fd, (off_t) (offset >> 32), + (off_t) (offset & 0xffffffff), + &retval, whence) ?: retval); } weak_alias (__llseek, llseek) strong_alias (__llseek, __libc_lseek64) diff --git a/sysdeps/unix/sysv/linux/lutimes.c b/sysdeps/unix/sysv/linux/lutimes.c index 3597c18..9e51305 100644 --- a/sysdeps/unix/sysv/linux/lutimes.c +++ b/sysdeps/unix/sysv/linux/lutimes.c @@ -34,16 +34,20 @@ lutimes (const char *file, const struct timeval tvp[2]) { if (tvp[0].tv_usec < 0 || tvp[0].tv_usec >= 1000000 || tvp[1].tv_usec < 0 || tvp[1].tv_usec >= 1000000) - return INLINE_SYSCALL_ERROR_RETURN (-EINVAL, int, -1); + { + __set_errno (EINVAL); + return -1; + } TIMEVAL_TO_TIMESPEC (&tvp[0], &ts[0]); TIMEVAL_TO_TIMESPEC (&tvp[1], &ts[1]); } - return INLINE_SYSCALL_RETURN (utimensat, 4, int, AT_FDCWD, file, - tvp ? ts : NULL, AT_SYMLINK_NOFOLLOW); + return INLINE_SYSCALL (utimensat, 4, AT_FDCWD, file, tvp ? ts : NULL, + AT_SYMLINK_NOFOLLOW); #else - return INLINE_SYSCALL_ERROR_RETURN (-ENOSYS, int, -1); + __set_errno (ENOSYS); + return -1; #endif } diff --git a/sysdeps/unix/sysv/linux/lxstat.c b/sysdeps/unix/sysv/linux/lxstat.c index ae3f33c..948665c 100644 --- a/sysdeps/unix/sysv/linux/lxstat.c +++ b/sysdeps/unix/sysv/linux/lxstat.c @@ -35,21 +35,20 @@ int __lxstat (int vers, const char *name, struct stat *buf) { if (vers == _STAT_VER_KERNEL) - return INLINE_SYSCALL_ERROR_RETURN (lstat, 2, int, name, - (struct kernel_stat *) buf); + return INLINE_SYSCALL (lstat, 2, name, (struct kernel_stat *) buf); #ifdef STAT_IS_KERNEL_STAT - return INLINE_SYSCALL_ERROR_RETURN (-EINVAL, int, -1) + errno = EINVAL; + return -1; #else struct kernel_stat kbuf; - INTERNAL_SYSCALL_DECL (err); - int result = INTERNAL_SYSCALL (lstat, err, 2, name, &kbuf); - if (__glibc_unlikely (INTERNAL_SYSCALL_ERROR_P (result, err))) - return INLINE_SYSCALL_ERROR_RETURN (-INTERNAL_SYSCALL_ERRNO (result, - err), - int, -1) - else - return __xstat_conv (vers, &kbuf, buf); + int result; + + result = INLINE_SYSCALL (lstat, 2, name, &kbuf); + if (result == 0) + result = __xstat_conv (vers, &kbuf, buf); + + return result; #endif } diff --git a/sysdeps/unix/sysv/linux/lxstat64.c b/sysdeps/unix/sysv/linux/lxstat64.c index 5b4d806..5d0c051 100644 --- a/sysdeps/unix/sysv/linux/lxstat64.c +++ b/sysdeps/unix/sysv/linux/lxstat64.c @@ -30,12 +30,8 @@ int ___lxstat64 (int vers, const char *name, struct stat64 *buf) { - INTERNAL_SYSCALL_DECL (err); - int result = INTERNAL_SYSCALL (lstat64, err, 2, name, buf); - if (__glibc_unlikely (INTERNAL_SYSCALL_ERROR_P (result, err))) - return INLINE_SYSCALL_ERROR_RETURN (-INTERNAL_SYSCALL_ERRNO (result, - err), - int, -1); + int result; + result = INLINE_SYSCALL (lstat64, 2, name, buf); #if defined _HAVE_STAT64___ST_INO && __ASSUME_ST_INO_64_BIT == 0 if (__builtin_expect (!result, 1) && buf->__st_ino != (__ino_t) buf->st_ino) buf->st_ino = buf->__st_ino; diff --git a/sysdeps/unix/sysv/linux/mmap64.c b/sysdeps/unix/sysv/linux/mmap64.c index 4dbe28b..0b160b6 100644 --- a/sysdeps/unix/sysv/linux/mmap64.c +++ b/sysdeps/unix/sysv/linux/mmap64.c @@ -46,9 +46,15 @@ __mmap64 (void *addr, size_t len, int prot, int flags, int fd, off64_t offset) } #endif if (offset & ((1 << page_shift) - 1)) - return INLINE_SYSCALL_ERROR_RETURN (-EINVAL, void *, MAP_FAILED); - return INLINE_SYSCALL_RETURN (mmap2, 6, void *, addr, - len, prot, flags, fd, - (off_t) (offset >> page_shift)); + { + __set_errno (EINVAL); + return MAP_FAILED; + } + void *result; + result = (void *) + INLINE_SYSCALL (mmap2, 6, addr, + len, prot, flags, fd, + (off_t) (offset >> page_shift)); + return result; } weak_alias (__mmap64, mmap64) diff --git a/sysdeps/unix/sysv/linux/mq_close.c b/sysdeps/unix/sysv/linux/mq_close.c index 1d5b664..58d5aea 100644 --- a/sysdeps/unix/sysv/linux/mq_close.c +++ b/sysdeps/unix/sysv/linux/mq_close.c @@ -26,7 +26,7 @@ int mq_close (mqd_t mqdes) { - return INLINE_SYSCALL_RETURN (close, 1, int, mqdes); + return INLINE_SYSCALL (close, 1, mqdes); } #else diff --git a/sysdeps/unix/sysv/linux/mq_open.c b/sysdeps/unix/sysv/linux/mq_open.c index ecadd08..46c0cc8 100644 --- a/sysdeps/unix/sysv/linux/mq_open.c +++ b/sysdeps/unix/sysv/linux/mq_open.c @@ -35,7 +35,10 @@ mqd_t __mq_open (const char *name, int oflag, ...) { if (name[0] != '/') - return INLINE_SYSCALL_ERROR_RETURN (-EINVAL, int, -1); + { + __set_errno (EINVAL); + return -1; + } mode_t mode = 0; struct mq_attr *attr = NULL; @@ -49,8 +52,7 @@ __mq_open (const char *name, int oflag, ...) va_end (ap); } - return INLINE_SYSCALL_RETURN (mq_open, 4, int, name + 1, oflag, mode, - attr); + return INLINE_SYSCALL (mq_open, 4, name + 1, oflag, mode, attr); } strong_alias (__mq_open, mq_open); diff --git a/sysdeps/unix/sysv/linux/mq_unlink.c b/sysdeps/unix/sysv/linux/mq_unlink.c index 0b133d1..a876c3c 100644 --- a/sysdeps/unix/sysv/linux/mq_unlink.c +++ b/sysdeps/unix/sysv/linux/mq_unlink.c @@ -26,7 +26,10 @@ int mq_unlink (const char *name) { if (name[0] != '/') - return INLINE_SYSCALL_ERROR_RETURN (-EINVAL, int, -1); + { + __set_errno (EINVAL); + return -1; + } INTERNAL_SYSCALL_DECL (err); int ret = INTERNAL_SYSCALL (mq_unlink, err, 1, name + 1); @@ -38,7 +41,8 @@ mq_unlink (const char *name) ret = INTERNAL_SYSCALL_ERRNO (ret, err); if (ret == EPERM) ret = EACCES; - return INLINE_SYSCALL_ERROR_RETURN (-ret, int, -1); + __set_errno (ret); + ret = -1; } return ret; diff --git a/sysdeps/unix/sysv/linux/msgget.c b/sysdeps/unix/sysv/linux/msgget.c index fdc4796..ca8932c 100644 --- a/sysdeps/unix/sysv/linux/msgget.c +++ b/sysdeps/unix/sysv/linux/msgget.c @@ -32,6 +32,5 @@ msgget (key, msgflg) key_t key; int msgflg; { - return INLINE_SYSCALL_RETURN (ipc, 5, int, IPCOP_msgget, key, msgflg, - 0, NULL); + return INLINE_SYSCALL (ipc, 5, IPCOP_msgget, key, msgflg, 0, NULL); } diff --git a/sysdeps/unix/sysv/linux/prlimit.c b/sysdeps/unix/sysv/linux/prlimit.c index ad164c4..db88ba8 100644 --- a/sysdeps/unix/sysv/linux/prlimit.c +++ b/sysdeps/unix/sysv/linux/prlimit.c @@ -44,15 +44,10 @@ prlimit (__pid_t pid, enum __rlimit_resource resource, new_rlimit64 = &new_rlimit64_mem; } - INTERNAL_SYSCALL_DECL (err); - int res = INTERNAL_SYSCALL (prlimit64, err, 4, pid, resource, - new_rlimit64, old_rlimit64); + int res = INLINE_SYSCALL (prlimit64, 4, pid, resource, new_rlimit64, + old_rlimit64); - if (__glibc_unlikely (INTERNAL_SYSCALL_ERROR_P (res, err))) - return INLINE_SYSCALL_ERROR_RETURN (-INTERNAL_SYSCALL_ERRNO (res, - err), - int, -1); - else if (old_rlimit != NULL) + if (res == 0 && old_rlimit != NULL) { /* The prlimit64 syscall is ill-designed for 32-bit machines. We have to provide a 32-bit variant since otherwise the LFS @@ -64,14 +59,20 @@ prlimit (__pid_t pid, enum __rlimit_resource resource, if (old_rlimit->rlim_cur != old_rlimit64_mem.rlim_cur) { if (new_rlimit == NULL) - return INLINE_SYSCALL_ERROR_RETURN (-EOVERFLOW, int, -1); + { + __set_errno (EOVERFLOW); + return -1; + } old_rlimit->rlim_cur = RLIM_INFINITY; } old_rlimit->rlim_max = old_rlimit64_mem.rlim_max; if (old_rlimit->rlim_max != old_rlimit64_mem.rlim_max) { if (new_rlimit == NULL) - return INLINE_SYSCALL_ERROR_RETURN (-EOVERFLOW, int, -1); + { + __set_errno (EOVERFLOW); + return -1; + } old_rlimit->rlim_max = RLIM_INFINITY; } } @@ -83,7 +84,8 @@ int prlimit (__pid_t pid, enum __rlimit_resource resource, const struct rlimit *new_rlimit, struct rlimit *old_rlimit) { - return INLINE_SYSCALL_ERROR_RETURN (-ENOSYS, int, -1); + __set_errno (ENOSYS); + return -1; } stub_warning (prlimit) #endif diff --git a/sysdeps/unix/sysv/linux/pt-raise.c b/sysdeps/unix/sysv/linux/pt-raise.c index 1e14439..307b9dc 100644 --- a/sysdeps/unix/sysv/linux/pt-raise.c +++ b/sysdeps/unix/sysv/linux/pt-raise.c @@ -33,6 +33,6 @@ raise (sig) if (__glibc_unlikely (pid < 0)) pid = -pid; - return INLINE_SYSCALL_RETURN (tgkill, 3, int, pid, - THREAD_GETMEM (THREAD_SELF, tid), sig); + return INLINE_SYSCALL (tgkill, 3, pid, THREAD_GETMEM (THREAD_SELF, tid), + sig); } diff --git a/sysdeps/unix/sysv/linux/raise.c b/sysdeps/unix/sysv/linux/raise.c index 2e6bb6b..e281063 100644 --- a/sysdeps/unix/sysv/linux/raise.c +++ b/sysdeps/unix/sysv/linux/raise.c @@ -52,7 +52,7 @@ raise (sig) if (__glibc_unlikely (pid <= 0)) pid = (pid & INT_MAX) == 0 ? selftid : -pid; - return INLINE_SYSCALL_RETURN (tgkill, 3, int, pid, selftid, sig); + return INLINE_SYSCALL (tgkill, 3, pid, selftid, sig); } libc_hidden_def (raise) weak_alias (raise, gsignal) diff --git a/sysdeps/unix/sysv/linux/readahead.c b/sysdeps/unix/sysv/linux/readahead.c index 0c3e585..c47df0d 100644 --- a/sysdeps/unix/sysv/linux/readahead.c +++ b/sysdeps/unix/sysv/linux/readahead.c @@ -29,16 +29,17 @@ ssize_t __readahead (int fd, off64_t offset, size_t count) { - return INLINE_SYSCALL_RETURN (readahead, 4, int, fd, - __LONG_LONG_PAIR ((off_t) (offset >> 32), - (off_t) (offset & 0xffffffff)), - count); + return INLINE_SYSCALL (readahead, 4, fd, + __LONG_LONG_PAIR ((off_t) (offset >> 32), + (off_t) (offset & 0xffffffff)), + count); } #else ssize_t __readahead (int fd, off64_t offset, size_t count) { - return INLINE_SYSCALL_ERROR_RETURN (-ENOSYS, int, -1); + __set_errno (ENOSYS); + return -1; } stub_warning (readahead) #endif diff --git a/sysdeps/unix/sysv/linux/reboot.c b/sysdeps/unix/sysv/linux/reboot.c index e525245..a016321 100644 --- a/sysdeps/unix/sysv/linux/reboot.c +++ b/sysdeps/unix/sysv/linux/reboot.c @@ -25,6 +25,5 @@ int reboot (int howto) { - return INLINE_SYSCALL_RETURN (reboot, 3, int, (int) 0xfee1dead, - 672274793, howto); + return INLINE_SYSCALL (reboot, 3, (int) 0xfee1dead, 672274793, howto); } diff --git a/sysdeps/unix/sysv/linux/sched_getaffinity.c b/sysdeps/unix/sysv/linux/sched_getaffinity.c index d66b6fa..9850806 100644 --- a/sysdeps/unix/sysv/linux/sched_getaffinity.c +++ b/sysdeps/unix/sysv/linux/sched_getaffinity.c @@ -25,22 +25,12 @@ #ifdef __NR_sched_getaffinity -# if SHLIB_COMPAT (libc, GLIBC_2_3_3, GLIBC_2_3_4) -extern int __sched_getaffinity_new (pid_t, size_t, cpu_set_t *); -libc_hidden_proto (__sched_getaffinity_new) -# endif - int __sched_getaffinity_new (pid_t pid, size_t cpusetsize, cpu_set_t *cpuset) { - INTERNAL_SYSCALL_DECL (err); - int res = INTERNAL_SYSCALL (sched_getaffinity, err, 3, pid, - MIN (INT_MAX, cpusetsize), cpuset); - if (__glibc_unlikely (INTERNAL_SYSCALL_ERROR_P (res, err))) - return INLINE_SYSCALL_ERROR_RETURN (-INTERNAL_SYSCALL_ERRNO (res, - err), - int, -1); - else + int res = INLINE_SYSCALL (sched_getaffinity, 3, pid, + MIN (INT_MAX, cpusetsize), cpuset); + if (res != -1) { /* Clean the rest of the memory the kernel didn't do. */ memset ((char *) cpuset + res, '\0', cpusetsize - res); @@ -54,8 +44,6 @@ versioned_symbol (libc, __sched_getaffinity_new, sched_getaffinity, # if SHLIB_COMPAT (libc, GLIBC_2_3_3, GLIBC_2_3_4) -libc_hidden_def (__sched_getaffinity_new) - int attribute_compat_text_section __sched_getaffinity_old (pid_t pid, cpu_set_t *cpuset) diff --git a/sysdeps/unix/sysv/linux/semget.c b/sysdeps/unix/sysv/linux/semget.c index c75835d..7221ff2 100644 --- a/sysdeps/unix/sysv/linux/semget.c +++ b/sysdeps/unix/sysv/linux/semget.c @@ -33,6 +33,5 @@ semget (key, nsems, semflg) int nsems; int semflg; { - return INLINE_SYSCALL_RETURN (ipc, 5, int, IPCOP_semget, key, nsems, - semflg, NULL); + return INLINE_SYSCALL (ipc, 5, IPCOP_semget, key, nsems, semflg, NULL); } diff --git a/sysdeps/unix/sysv/linux/semop.c b/sysdeps/unix/sysv/linux/semop.c index b40014c..dc936be 100644 --- a/sysdeps/unix/sysv/linux/semop.c +++ b/sysdeps/unix/sysv/linux/semop.c @@ -31,6 +31,5 @@ semop (semid, sops, nsops) struct sembuf *sops; size_t nsops; { - return INLINE_SYSCALL_RETURN (ipc, 5, int, IPCOP_semop, semid, - (int) nsops, 0, sops); + return INLINE_SYSCALL (ipc, 5, IPCOP_semop, semid, (int) nsops, 0, sops); } diff --git a/sysdeps/unix/sysv/linux/semtimedop.c b/sysdeps/unix/sysv/linux/semtimedop.c index 57e7485..02df07e 100644 --- a/sysdeps/unix/sysv/linux/semtimedop.c +++ b/sysdeps/unix/sysv/linux/semtimedop.c @@ -32,6 +32,7 @@ semtimedop (semid, sops, nsops, timeout) size_t nsops; const struct timespec *timeout; { - return INLINE_SYSCALL_RETURN (ipc, 6, int, IPCOP_semtimedop, semid, - (int) nsops, 0, sops, timeout); + return INLINE_SYSCALL (ipc, 6, IPCOP_semtimedop, + semid, (int) nsops, 0, sops, + timeout); } diff --git a/sysdeps/unix/sysv/linux/setrlimit64.c b/sysdeps/unix/sysv/linux/setrlimit64.c index 1989af6..17f95cb 100644 --- a/sysdeps/unix/sysv/linux/setrlimit64.c +++ b/sysdeps/unix/sysv/linux/setrlimit64.c @@ -30,15 +30,11 @@ setrlimit64 (resource, rlimits) const struct rlimit64 *rlimits; { #ifdef __ASSUME_PRLIMIT64 - return INLINE_SYSCALL_RETURN (prlimit64, 4, int, 0, resource, - rlimits, NULL); + return INLINE_SYSCALL (prlimit64, 4, 0, resource, rlimits, NULL); #else # ifdef __NR_prlimit64 - INTERNAL_SYSCALL_DECL (err); - int res = INTERNAL_SYSCALL (prlimit64, err, 4, 0, resource, rlimits, - NULL); - if (!__glibc_unlikely (INTERNAL_SYSCALL_ERROR_P (res, err)) - || INTERNAL_SYSCALL_ERRNO (res, err) != ENOSYS) + int res = INLINE_SYSCALL (prlimit64, 4, 0, resource, rlimits, NULL); + if (res == 0 || errno != ENOSYS) return res; # endif struct rlimit rlimits32; diff --git a/sysdeps/unix/sysv/linux/shmat.c b/sysdeps/unix/sysv/linux/shmat.c index 45ebd11..94d18d3 100644 --- a/sysdeps/unix/sysv/linux/shmat.c +++ b/sysdeps/unix/sysv/linux/shmat.c @@ -42,10 +42,11 @@ shmat (shmid, shmaddr, shmflg) shmid, shmflg, (long int) &raddr, (void *) shmaddr); - if (__glibc_unlikely (INTERNAL_SYSCALL_ERROR_P (resultvar, err))) - return INLINE_SYSCALL_ERROR_RETURN (-INTERNAL_SYSCALL_ERRNO (resultvar, - err), - void *, -1l); - else - return raddr; + if (INTERNAL_SYSCALL_ERROR_P (resultvar, err)) + { + __set_errno (INTERNAL_SYSCALL_ERRNO (resultvar, err)); + return (void *) -1l; + } + + return raddr; } diff --git a/sysdeps/unix/sysv/linux/shmdt.c b/sysdeps/unix/sysv/linux/shmdt.c index 0bb6370..51bad71 100644 --- a/sysdeps/unix/sysv/linux/shmdt.c +++ b/sysdeps/unix/sysv/linux/shmdt.c @@ -30,6 +30,5 @@ int shmdt (shmaddr) const void *shmaddr; { - return INLINE_SYSCALL_RETURN (ipc, 5, int, IPCOP_shmdt, 0, 0, 0, - (void *) shmaddr); + return INLINE_SYSCALL (ipc, 5, IPCOP_shmdt, 0, 0, 0, (void *) shmaddr); } diff --git a/sysdeps/unix/sysv/linux/shmget.c b/sysdeps/unix/sysv/linux/shmget.c index c9720f4..b3d74e6 100644 --- a/sysdeps/unix/sysv/linux/shmget.c +++ b/sysdeps/unix/sysv/linux/shmget.c @@ -33,6 +33,5 @@ shmget (key, size, shmflg) size_t size; int shmflg; { - return INLINE_SYSCALL_RETURN (ipc, 5, int, IPCOP_shmget, key, size, - shmflg, NULL); + return INLINE_SYSCALL (ipc, 5, IPCOP_shmget, key, size, shmflg, NULL); } diff --git a/sysdeps/unix/sysv/linux/signalfd.c b/sysdeps/unix/sysv/linux/signalfd.c index e07b56c..f3ae8c1 100644 --- a/sysdeps/unix/sysv/linux/signalfd.c +++ b/sysdeps/unix/sysv/linux/signalfd.c @@ -26,17 +26,11 @@ int signalfd (int fd, const sigset_t *mask, int flags) { #ifdef __NR_signalfd4 + int res = INLINE_SYSCALL (signalfd4, 4, fd, mask, _NSIG / 8, flags); # ifndef __ASSUME_SIGNALFD4 - INTERNAL_SYSCALL_DECL (err); - int res = INTERNAL_SYSCALL (signalfd4, err, 4, fd, mask, _NSIG / 8, - flags); - if (!__glibc_unlikely (INTERNAL_SYSCALL_ERROR_P (res, err)) - || INTERNAL_SYSCALL_ERRNO (res, err) != ENOSYS) - return res; -# else - return INLINE_SYSCALL_RETURN (signalfd4, 4, int, fd, mask, _NSIG / 8, - flags); + if (res != -1 || errno != ENOSYS) # endif + return res; #endif #ifndef __ASSUME_SIGNALFD4 @@ -45,12 +39,16 @@ signalfd (int fd, const sigset_t *mask, int flags) kernel (sys_indirect) before implementing setting flags like O_NONBLOCK etc. */ if (flags != 0) - return INLINE_SYSCALL_ERROR_RETURN (-EINVAL, int, -1); + { + __set_errno (EINVAL); + return -1; + } # ifdef __NR_signalfd - return INLINE_SYSCALL_RETURN (signalfd, 3, int, fd, mask, _NSIG / 8); + return INLINE_SYSCALL (signalfd, 3, fd, mask, _NSIG / 8); # else - return INLINE_SYSCALL_ERROR_RETURN (-ENOSYS, int, -1); + __set_errno (ENOSYS); + return -1; # endif #elif !defined __NR_signalfd4 # error "__ASSUME_SIGNALFD4 defined but not __NR_signalfd4" diff --git a/sysdeps/unix/sysv/linux/sigpending.c b/sysdeps/unix/sysv/linux/sigpending.c index 4ad0982..c8f3a8e 100644 --- a/sysdeps/unix/sysv/linux/sigpending.c +++ b/sysdeps/unix/sysv/linux/sigpending.c @@ -29,5 +29,5 @@ int sigpending (set) sigset_t *set; { - return INLINE_SYSCALL_RETURN (rt_sigpending, 2, int, set, _NSIG / 8); + return INLINE_SYSCALL (rt_sigpending, 2, set, _NSIG / 8); } diff --git a/sysdeps/unix/sysv/linux/sigprocmask.c b/sysdeps/unix/sysv/linux/sigprocmask.c index 452f8a1..574f0d2 100644 --- a/sysdeps/unix/sysv/linux/sigprocmask.c +++ b/sysdeps/unix/sysv/linux/sigprocmask.c @@ -54,7 +54,6 @@ __sigprocmask (how, set, oset) } #endif - return INLINE_SYSCALL_RETURN (rt_sigprocmask, 4, int, how, set, oset, - _NSIG / 8); + return INLINE_SYSCALL (rt_sigprocmask, 4, how, set, oset, _NSIG / 8); } weak_alias (__sigprocmask, sigprocmask) diff --git a/sysdeps/unix/sysv/linux/sigqueue.c b/sysdeps/unix/sysv/linux/sigqueue.c index 9009174..7970a7c 100644 --- a/sysdeps/unix/sysv/linux/sigqueue.c +++ b/sysdeps/unix/sysv/linux/sigqueue.c @@ -43,7 +43,7 @@ __sigqueue (pid, sig, val) info.si_uid = __getuid (); info.si_value = val; - return INLINE_SYSCALL_RETURN (rt_sigqueueinfo, 3, int, pid, sig, &info); + return INLINE_SYSCALL (rt_sigqueueinfo, 3, pid, sig, &info); } weak_alias (__sigqueue, sigqueue) #else diff --git a/sysdeps/unix/sysv/linux/speed.c b/sysdeps/unix/sysv/linux/speed.c index 2ed9f15..3ac0640 100644 --- a/sysdeps/unix/sysv/linux/speed.c +++ b/sysdeps/unix/sysv/linux/speed.c @@ -60,7 +60,10 @@ cfsetospeed (termios_p, speed) { if ((speed & ~CBAUD) != 0 && (speed < B57600 || speed > __MAX_BAUD)) - return INLINE_SYSCALL_ERROR_RETURN (-EINVAL, int, -1); + { + __set_errno (EINVAL); + return -1; + } #ifdef _HAVE_STRUCT_TERMIOS_C_OSPEED termios_p->c_ospeed = speed; @@ -84,7 +87,10 @@ cfsetispeed (termios_p, speed) { if ((speed & ~CBAUD) != 0 && (speed < B57600 || speed > __MAX_BAUD)) - return INLINE_SYSCALL_ERROR_RETURN (-EINVAL, int, -1); + { + __set_errno (EINVAL); + return -1; + } #ifdef _HAVE_STRUCT_TERMIOS_C_ISPEED termios_p->c_ispeed = speed; diff --git a/sysdeps/unix/sysv/linux/statfs64.c b/sysdeps/unix/sysv/linux/statfs64.c index 0d9e16c..ac5c33f 100644 --- a/sysdeps/unix/sysv/linux/statfs64.c +++ b/sysdeps/unix/sysv/linux/statfs64.c @@ -37,18 +37,12 @@ __statfs64 (const char *file, struct statfs64 *buf) if (! __no_statfs64) # endif { -# if __ASSUME_STATFS64 == 0 - INTERNAL_SYSCALL_DECL (err); - int result = INTERNAL_SYSCALL (statfs64, err, 3, file, - sizeof (*buf), buf); + int result = INLINE_SYSCALL (statfs64, 3, file, sizeof (*buf), buf); - if (!__glibc_unlikely (INTERNAL_SYSCALL_ERROR_P (result, err)) - || INTERNAL_SYSCALL_ERRNO (result, err) != ENOSYS) - return result; -# else - return INLINE_SYSCALL_RETURN (statfs64, 3, int, file, - sizeof (*buf), buf); +# if __ASSUME_STATFS64 == 0 + if (result == 0 || errno != ENOSYS) # endif + return result; # if __ASSUME_STATFS64 == 0 __no_statfs64 = 1; diff --git a/sysdeps/unix/sysv/linux/sysctl.c b/sysdeps/unix/sysv/linux/sysctl.c index d0fe55c..2d4eb1d 100644 --- a/sysdeps/unix/sysv/linux/sysctl.c +++ b/sysdeps/unix/sysv/linux/sysctl.c @@ -37,7 +37,7 @@ __sysctl (int *name, int nlen, void *oldval, size_t *oldlenp, .newlen = newlen }; - return INLINE_SYSCALL_RETURN (_sysctl, 1, int, &args); + return INLINE_SYSCALL (_sysctl, 1, &args); } libc_hidden_def (__sysctl) weak_alias (__sysctl, sysctl) diff --git a/sysdeps/unix/sysv/linux/tcsendbrk.c b/sysdeps/unix/sysv/linux/tcsendbrk.c index 508efbb..4a43209 100644 --- a/sysdeps/unix/sysv/linux/tcsendbrk.c +++ b/sysdeps/unix/sysv/linux/tcsendbrk.c @@ -39,6 +39,7 @@ tcsendbreak (int fd, int duration) /* ioctl can't send a break of any other duration for us. This could be changed to use trickery (e.g. lower speed and send a '\0') to send the break, but for now just return an error. */ - return INLINE_SYSCALL_ERROR_RETURN (-EINVAL, int, -1); + __set_errno (EINVAL); + return -1; #endif } diff --git a/sysdeps/unix/sysv/linux/tcsetattr.c b/sysdeps/unix/sysv/linux/tcsetattr.c index 96f7287..d7afc63 100644 --- a/sysdeps/unix/sysv/linux/tcsetattr.c +++ b/sysdeps/unix/sysv/linux/tcsetattr.c @@ -61,7 +61,8 @@ tcsetattr (fd, optional_actions, termios_p) cmd = TCSETSF; break; default: - return INLINE_SYSCALL_ERROR_RETURN (-EINVAL, int, -1); + __set_errno (EINVAL); + return -1; } k_termios.c_iflag = termios_p->c_iflag & ~IBAUD0; @@ -78,6 +79,6 @@ tcsetattr (fd, optional_actions, termios_p) memcpy (&k_termios.c_cc[0], &termios_p->c_cc[0], __KERNEL_NCCS * sizeof (cc_t)); - return INLINE_SYSCALL_RETURN (ioctl, 3, int, fd, cmd, &k_termios); + return INLINE_SYSCALL (ioctl, 3, fd, cmd, &k_termios); } libc_hidden_def (tcsetattr) diff --git a/sysdeps/unix/sysv/linux/timer_getoverr.c b/sysdeps/unix/sysv/linux/timer_getoverr.c index 2bcac79..8f00192 100644 --- a/sysdeps/unix/sysv/linux/timer_getoverr.c +++ b/sysdeps/unix/sysv/linux/timer_getoverr.c @@ -35,5 +35,7 @@ timer_getoverrun (timerid) struct timer *kt = (struct timer *) timerid; /* Get the information from the kernel. */ - return INLINE_SYSCALL_RETURN (timer_getoverrun, 1, int, kt->ktimerid); + int res = INLINE_SYSCALL (timer_getoverrun, 1, kt->ktimerid); + + return res; } diff --git a/sysdeps/unix/sysv/linux/timer_gettime.c b/sysdeps/unix/sysv/linux/timer_gettime.c index e9ca59a..79705cf 100644 --- a/sysdeps/unix/sysv/linux/timer_gettime.c +++ b/sysdeps/unix/sysv/linux/timer_gettime.c @@ -37,6 +37,7 @@ timer_gettime (timerid, value) struct timer *kt = (struct timer *) timerid; /* Delete the kernel timer object. */ - return INLINE_SYSCALL_RETURN (timer_gettime, 2, int, kt->ktimerid, - value); + int res = INLINE_SYSCALL (timer_gettime, 2, kt->ktimerid, value); + + return res; } diff --git a/sysdeps/unix/sysv/linux/timer_settime.c b/sysdeps/unix/sysv/linux/timer_settime.c index d8687fd..87c6519 100644 --- a/sysdeps/unix/sysv/linux/timer_settime.c +++ b/sysdeps/unix/sysv/linux/timer_settime.c @@ -39,6 +39,8 @@ timer_settime (timerid, flags, value, ovalue) struct timer *kt = (struct timer *) timerid; /* Delete the kernel timer object. */ - return INLINE_SYSCALL_RETURN (timer_settime, 4, int, kt->ktimerid, - flags, value, ovalue); + int res = INLINE_SYSCALL (timer_settime, 4, kt->ktimerid, flags, + value, ovalue); + + return res; } diff --git a/sysdeps/unix/sysv/linux/truncate64.c b/sysdeps/unix/sysv/linux/truncate64.c index d4500b1..0002247 100644 --- a/sysdeps/unix/sysv/linux/truncate64.c +++ b/sysdeps/unix/sysv/linux/truncate64.c @@ -29,6 +29,7 @@ truncate64 (const char *path, off64_t length) { unsigned int low = length & 0xffffffff; unsigned int high = length >> 32; - return INLINE_SYSCALL_RETURN (truncate64, 3, int, path, - __LONG_LONG_PAIR (high, low)); + int result = INLINE_SYSCALL (truncate64, 3, path, + __LONG_LONG_PAIR (high, low)); + return result; } diff --git a/sysdeps/unix/sysv/linux/ustat.c b/sysdeps/unix/sysv/linux/ustat.c index 1d78c20..8d495ca 100644 --- a/sysdeps/unix/sysv/linux/ustat.c +++ b/sysdeps/unix/sysv/linux/ustat.c @@ -31,8 +31,10 @@ ustat (dev_t dev, struct ustat *ubuf) /* We must convert the value to dev_t type used by the kernel. */ k_dev = dev & ((1ULL << 32) - 1); if (k_dev != dev) - return INLINE_SYSCALL_ERROR_RETURN (-EINVAL, int, -1); + { + __set_errno (EINVAL); + return -1; + } - return INLINE_SYSCALL_RETURN (ustat, 2, int, (unsigned int) k_dev, - ubuf); + return INLINE_SYSCALL (ustat, 2, (unsigned int) k_dev, ubuf); } diff --git a/sysdeps/unix/sysv/linux/utimensat.c b/sysdeps/unix/sysv/linux/utimensat.c index 9b645a1..81b565f 100644 --- a/sysdeps/unix/sysv/linux/utimensat.c +++ b/sysdeps/unix/sysv/linux/utimensat.c @@ -30,13 +30,16 @@ utimensat (int fd, const char *file, const struct timespec tsp[2], int flags) { if (file == NULL) - return INLINE_SYSCALL_ERROR_RETURN (-EINVAL, int, -1); + { + __set_errno (EINVAL); + return -1; + } #ifdef __NR_utimensat /* Avoid implicit array coercion in syscall macros. */ - return INLINE_SYSCALL_RETURN (utimensat, 4, int, fd, file, &tsp[0], - flags); + return INLINE_SYSCALL (utimensat, 4, fd, file, &tsp[0], flags); #else - return INLINE_SYSCALL_ERROR_RETURN (-ENOSYS, int, -1); + __set_errno (ENOSYS); + return -1; #endif } #ifndef __NR_utimensat diff --git a/sysdeps/unix/sysv/linux/utimes.c b/sysdeps/unix/sysv/linux/utimes.c index 10b5593..2a1f2f9 100644 --- a/sysdeps/unix/sysv/linux/utimes.c +++ b/sysdeps/unix/sysv/linux/utimes.c @@ -30,7 +30,7 @@ int __utimes (const char *file, const struct timeval tvp[2]) { /* Avoid implicit array coercion in syscall macros. */ - return INLINE_SYSCALL_RETURN (utimes, 2, int, file, &tvp[0]); + return INLINE_SYSCALL (utimes, 2, file, &tvp[0]); } weak_alias (__utimes, utimes) diff --git a/sysdeps/unix/sysv/linux/xmknod.c b/sysdeps/unix/sysv/linux/xmknod.c index 92f714d..b940273 100644 --- a/sysdeps/unix/sysv/linux/xmknod.c +++ b/sysdeps/unix/sysv/linux/xmknod.c @@ -33,15 +33,20 @@ __xmknod (int vers, const char *path, mode_t mode, dev_t *dev) unsigned long long int k_dev; if (vers != _MKNOD_VER) - return INLINE_SYSCALL_ERROR_RETURN (-EINVAL, int, -1); + { + __set_errno (EINVAL); + return -1; + } /* We must convert the value to dev_t type used by the kernel. */ k_dev = (*dev) & ((1ULL << 32) - 1); if (k_dev != *dev) - return INLINE_SYSCALL_ERROR_RETURN (-EINVAL, int, -1); + { + __set_errno (EINVAL); + return -1; + } - return INLINE_SYSCALL_RETURN (mknod, 3, int, path, mode, - (unsigned int) k_dev); + return INLINE_SYSCALL (mknod, 3, path, mode, (unsigned int) k_dev); } weak_alias (__xmknod, _xmknod) diff --git a/sysdeps/unix/sysv/linux/xmknodat.c b/sysdeps/unix/sysv/linux/xmknodat.c index 04ad458..f30b9b3 100644 --- a/sysdeps/unix/sysv/linux/xmknodat.c +++ b/sysdeps/unix/sysv/linux/xmknodat.c @@ -34,15 +34,20 @@ int __xmknodat (int vers, int fd, const char *file, mode_t mode, dev_t *dev) { if (vers != _MKNOD_VER) - return INLINE_SYSCALL_ERROR_RETURN (-EINVAL, int, -1); + { + __set_errno (EINVAL); + return -1; + } /* We must convert the value to dev_t type used by the kernel. */ unsigned long long int k_dev = (*dev) & ((1ULL << 32) - 1); if (k_dev != *dev) - return INLINE_SYSCALL_ERROR_RETURN (-EINVAL, int, -1); + { + __set_errno (EINVAL); + return -1; + } - return INLINE_SYSCALL_RETURN (mknodat, 4, int, fd, file, mode, - (unsigned int) k_dev); + return INLINE_SYSCALL (mknodat, 4, fd, file, mode, (unsigned int) k_dev); } libc_hidden_def (__xmknodat) diff --git a/sysdeps/unix/sysv/linux/xstat.c b/sysdeps/unix/sysv/linux/xstat.c index 8734e0b..6218963 100644 --- a/sysdeps/unix/sysv/linux/xstat.c +++ b/sysdeps/unix/sysv/linux/xstat.c @@ -35,22 +35,20 @@ int __xstat (int vers, const char *name, struct stat *buf) { if (vers == _STAT_VER_KERNEL) - return INLINE_SYSCALL_RETURN (stat, 2, int, name, - (struct kernel_stat *) buf); + return INLINE_SYSCALL (stat, 2, name, (struct kernel_stat *) buf); #ifdef STAT_IS_KERNEL_STAT errno = EINVAL; return -1; #else struct kernel_stat kbuf; - INTERNAL_SYSCALL_DECL (err); - int result = INTERNAL_SYSCALL (stat, err, 2, name, &kbuf); - if (__glibc_unlikely (INTERNAL_SYSCALL_ERROR_P (result, err))) - return INLINE_SYSCALL_ERROR_RETURN (-INTERNAL_SYSCALL_ERRNO (result, - err), - int, -1); - else - return __xstat_conv (vers, &kbuf, buf); + int result; + + result = INLINE_SYSCALL (stat, 2, name, &kbuf); + if (result == 0) + result = __xstat_conv (vers, &kbuf, buf); + + return result; #endif } hidden_def (__xstat) diff --git a/sysdeps/unix/sysv/linux/xstat64.c b/sysdeps/unix/sysv/linux/xstat64.c index 55ff8a1..c909b56 100644 --- a/sysdeps/unix/sysv/linux/xstat64.c +++ b/sysdeps/unix/sysv/linux/xstat64.c @@ -31,12 +31,8 @@ int ___xstat64 (int vers, const char *name, struct stat64 *buf) { - INTERNAL_SYSCALL_DECL (err); - int result = INTERNAL_SYSCALL (stat64, err, 2, name, buf); - if (__glibc_unlikely (INTERNAL_SYSCALL_ERROR_P (result, err))) - return INLINE_SYSCALL_ERROR_RETURN (-INTERNAL_SYSCALL_ERRNO (result, - err), - int, -1); + int result; + result = INLINE_SYSCALL (stat64, 2, name, buf); #if defined _HAVE_STAT64___ST_INO && __ASSUME_ST_INO_64_BIT == 0 if (__builtin_expect (!result, 1) && buf->__st_ino != (__ino_t) buf->st_ino) buf->st_ino = buf->__st_ino; diff --git a/sysdeps/unix/sysv/linux/xstatconv.c b/sysdeps/unix/sysv/linux/xstatconv.c index 5aae78e..6504414 100644 --- a/sysdeps/unix/sysv/linux/xstatconv.c +++ b/sysdeps/unix/sysv/linux/xstatconv.c @@ -96,7 +96,8 @@ __xstat_conv (int vers, struct kernel_stat *kbuf, void *ubuf) break; default: - return INLINE_SYSCALL_ERROR_RETURN (-EINVAL, int, -1); + __set_errno (EINVAL); + return -1; } return 0; @@ -169,7 +170,8 @@ __xstat64_conv (int vers, struct kernel_stat *kbuf, void *ubuf) _STAT_VER_KERNEL does not make sense. */ case _STAT_VER_KERNEL: default: - return INLINE_SYSCALL_ERROR_RETURN (-EINVAL, int, -1); + __set_errno (EINVAL); + return -1; } return 0; @@ -199,13 +201,19 @@ __xstat32_conv (int vers, struct stat64 *kbuf, struct stat *buf) buf->st_ino = kbuf->st_ino; if (sizeof (buf->st_ino) != sizeof (kbuf->st_ino) && buf->st_ino != kbuf->st_ino) - return INLINE_SYSCALL_ERROR_RETURN (-EOVERFLOW, int, -1); + { + __set_errno (EOVERFLOW); + return -1; + } } #else buf->st_ino = kbuf->st_ino; if (sizeof (buf->st_ino) != sizeof (kbuf->st_ino) && buf->st_ino != kbuf->st_ino) - return INLINE_SYSCALL_ERROR_RETURN (-EOVERFLOW, int, -1); + { + __set_errno (EOVERFLOW); + return -1; + } #endif buf->st_mode = kbuf->st_mode; buf->st_nlink = kbuf->st_nlink; @@ -219,13 +227,19 @@ __xstat32_conv (int vers, struct stat64 *kbuf, struct stat *buf) /* Check for overflow. */ if (sizeof (buf->st_size) != sizeof (kbuf->st_size) && buf->st_size != kbuf->st_size) - return INLINE_SYSCALL_ERROR_RETURN (-EOVERFLOW, int, -1); + { + __set_errno (EOVERFLOW); + return -1; + } buf->st_blksize = kbuf->st_blksize; buf->st_blocks = kbuf->st_blocks; /* Check for overflow. */ if (sizeof (buf->st_blocks) != sizeof (kbuf->st_blocks) && buf->st_blocks != kbuf->st_blocks) - return INLINE_SYSCALL_ERROR_RETURN (-EOVERFLOW, int, -1); + { + __set_errno (EOVERFLOW); + return -1; + } #ifdef _HAVE_STAT_NSEC buf->st_atim.tv_sec = kbuf->st_atim.tv_sec; buf->st_atim.tv_nsec = kbuf->st_atim.tv_nsec; @@ -261,7 +275,8 @@ __xstat32_conv (int vers, struct stat64 *kbuf, struct stat *buf) _STAT_VER_KERNEL does not make sense. */ case _STAT_VER_KERNEL: default: - return INLINE_SYSCALL_ERROR_RETURN (-EINVAL, int, -1); + __set_errno (EINVAL); + return -1; } return 0; |