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 c4316db4bc..52dad582ce 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 ad54cf8ff8..b6fb7cf5db 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 c56b94f911..6a48e6251b 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 ffb13f3acb..732097dd92 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 1496a0e651..d4ffb3cedc 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 6a0b1b7018..1bb544fd4d 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 025634b278..e278426de1 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 a9a6b6548b..fa184db7fe 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 bba99186b5..af8383010f 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; |
