From d5364cc6818c26066845717208f78ad809cf8804 Mon Sep 17 00:00:00 2001
From: "H.J. Lu" <hjl.tools@gmail.com>
Date: Fri, 21 Aug 2015 08:51:03 -0700
Subject: [PATCH] Remove return value from INLINE_SYSCALL_ERROR_RETURN
Syscall should return -1 when there is an error. This patch removes
return value from INLINE_SYSCALL_ERROR_RETURN and makes it always
return -1.
* sysdeps/unix/sysdep.h (INLINE_SYSCALL_ERROR_RETURN): Remove
return value and return -1 casted to type. Update comments.
* sysdeps/unix/sysv/linux/adjtime.c (ADJTIME): Updated.
* sysdeps/unix/sysv/linux/dl-openat64.c (openat64): Likewise.
* sysdeps/unix/sysv/linux/eventfd.c (eventfd): Likewise.
* sysdeps/unix/sysv/linux/faccessat.c (faccessat): Likewise.
* sysdeps/unix/sysv/linux/fchmodat.c (fchmodat): Likewise.
* sysdeps/unix/sysv/linux/fcntl.c (do_fcntl): Likewise.
* sysdeps/unix/sysv/linux/futimens.c (futimens): Likewise.
* sysdeps/unix/sysv/linux/futimes.c (__futimes): Likewise.
* sysdeps/unix/sysv/linux/fxstat.c (__fxstat): Likewise.
* sysdeps/unix/sysv/linux/fxstat64.c (___fxstat64): Likewise.
* sysdeps/unix/sysv/linux/fxstatat.c (__fxstatat): Likewise.
* sysdeps/unix/sysv/linux/fxstatat64.c (__fxstatat64): Likewise.
* sysdeps/unix/sysv/linux/getpriority.c (__getpriority): Likewise.
* sysdeps/unix/sysv/linux/llseek.c (__llseek): Likewise.
* sysdeps/unix/sysv/linux/lutimes.c (lutimes): Likewise.
* sysdeps/unix/sysv/linux/lxstat.c (__lxstat): Likewise.
* sysdeps/unix/sysv/linux/lxstat64.c (___lxstat64): Likewise.
* sysdeps/unix/sysv/linux/mmap64.c (__mmap64): Likewise.
* sysdeps/unix/sysv/linux/mq_open.c (__mq_open): Likewise.
* sysdeps/unix/sysv/linux/mq_unlink.c (mq_unlink): Likewise.
* sysdeps/unix/sysv/linux/prlimit.c (prlimit): Likewise.
* sysdeps/unix/sysv/linux/readahead.c (__readahead): Likewise.
* sysdeps/unix/sysv/linux/sched_getaffinity.c
(__sched_getaffinity_new): Likewise.
* sysdeps/unix/sysv/linux/shmat.c (shmat): Likewise.
* sysdeps/unix/sysv/linux/signalfd.c (signalfd): Likewise.
* sysdeps/unix/sysv/linux/speed.c (cfsetospeed): Likewise.
* sysdeps/unix/sysv/linux/tcsendbrk.c (tcsendbreak): Likewise.
* sysdeps/unix/sysv/linux/tcsetattr.c (tcsetattr): Likewise.
* sysdeps/unix/sysv/linux/ustat.c (ustat): Likewise.
* sysdeps/unix/sysv/linux/utimensat.c (utimensat): Likewise.
* sysdeps/unix/sysv/linux/xmknod.c (__xmknod): Likewise.
* sysdeps/unix/sysv/linux/xmknodat.c (__xmknodat): Likewise.
* sysdeps/unix/sysv/linux/xstat.c (__xstat): Likewise.
* sysdeps/unix/sysv/linux/xstat64.c (___xstat64): Likewise.
* sysdeps/unix/sysv/linux/xstatconv.c (__xstat_conv): Likewise.
(__xstat64_conv): Likewise.
(__xstat32_conv): Likewise.
---
sysdeps/unix/sysdep.h | 12 ++++++------
sysdeps/unix/sysv/linux/adjtime.c | 2 +-
sysdeps/unix/sysv/linux/dl-openat64.c | 2 +-
sysdeps/unix/sysv/linux/eventfd.c | 4 ++--
sysdeps/unix/sysv/linux/faccessat.c | 4 ++--
sysdeps/unix/sysv/linux/fchmodat.c | 4 ++--
sysdeps/unix/sysv/linux/fcntl.c | 2 +-
sysdeps/unix/sysv/linux/futimens.c | 4 ++--
sysdeps/unix/sysv/linux/futimes.c | 2 +-
sysdeps/unix/sysv/linux/fxstat.c | 4 ++--
sysdeps/unix/sysv/linux/fxstat64.c | 2 +-
sysdeps/unix/sysv/linux/fxstatat.c | 2 +-
sysdeps/unix/sysv/linux/fxstatat64.c | 4 ++--
sysdeps/unix/sysv/linux/getpriority.c | 2 +-
sysdeps/unix/sysv/linux/llseek.c | 2 +-
sysdeps/unix/sysv/linux/lutimes.c | 4 ++--
sysdeps/unix/sysv/linux/lxstat.c | 4 ++--
sysdeps/unix/sysv/linux/lxstat64.c | 2 +-
sysdeps/unix/sysv/linux/mmap64.c | 2 +-
sysdeps/unix/sysv/linux/mq_open.c | 2 +-
sysdeps/unix/sysv/linux/mq_unlink.c | 4 ++--
sysdeps/unix/sysv/linux/prlimit.c | 8 ++++----
sysdeps/unix/sysv/linux/readahead.c | 2 +-
sysdeps/unix/sysv/linux/sched_getaffinity.c | 2 +-
sysdeps/unix/sysv/linux/shmat.c | 2 +-
sysdeps/unix/sysv/linux/signalfd.c | 4 ++--
sysdeps/unix/sysv/linux/speed.c | 4 ++--
sysdeps/unix/sysv/linux/tcsendbrk.c | 2 +-
sysdeps/unix/sysv/linux/tcsetattr.c | 2 +-
sysdeps/unix/sysv/linux/ustat.c | 2 +-
sysdeps/unix/sysv/linux/utimensat.c | 4 ++--
sysdeps/unix/sysv/linux/xmknod.c | 4 ++--
sysdeps/unix/sysv/linux/xmknodat.c | 4 ++--
sysdeps/unix/sysv/linux/xstat.c | 5 ++---
sysdeps/unix/sysv/linux/xstat64.c | 2 +-
sysdeps/unix/sysv/linux/xstatconv.c | 14 +++++++-------
36 files changed, 65 insertions(+), 66 deletions(-)
@@ -81,14 +81,14 @@
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. */
+/* Set error number and return -1 which is casted to TYPE. It should
+ only be used as function return value for syscall error. 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) \
+#define INLINE_SYSCALL_ERROR_RETURN(err, type) \
({ \
__set_errno (-err); \
- (type) (value); \
+ (type) -1; \
})
#endif
@@ -61,7 +61,7 @@ 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);
+ return INLINE_SYSCALL_ERROR_RETURN (-EINVAL, int);
tntx.offset = tmp.tv_usec + tmp.tv_sec * 1000000L;
tntx.modes = ADJ_OFFSET_SINGLESHOT;
}
@@ -34,6 +34,6 @@ openat64 (dfd, file, oflag)
return INLINE_SYSCALL_RETURN (openat, 3, int, dfd, file,
oflag | O_LARGEFILE);
#else
- return INLINE_SYSCALL_ERROR_RETURN (-ENOSYS, int, -1);
+ return INLINE_SYSCALL_ERROR_RETURN (-ENOSYS, int);
#endif
}
@@ -41,12 +41,12 @@ 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)
+ return INLINE_SYSCALL_ERROR_RETURN (-EINVAL, int)
# ifdef __NR_eventfd
return INLINE_SYSCALL_RETURN (eventfd, 1, int, count)
# else
- return INLINE_SYSCALL_ERROR_RETURN (-ENOSYS, int, -1)
+ return INLINE_SYSCALL_ERROR_RETURN (-ENOSYS, int)
# endif
#elif !defined __NR_eventfd2
# error "__ASSUME_EVENTFD2 defined but not __NR_eventfd2"
@@ -35,7 +35,7 @@ faccessat (fd, file, mode, flag)
int flag;
{
if (flag & ~(AT_SYMLINK_NOFOLLOW | AT_EACCESS))
- return INLINE_SYSCALL_ERROR_RETURN (-EINVAL, int, -1);
+ return INLINE_SYSCALL_ERROR_RETURN (-EINVAL, int);
if ((flag == 0 || ((flag & ~AT_EACCESS) == 0 && ! __libc_enable_secure)))
return INLINE_SYSCALL_RETURN (faccessat, 3, int, fd, file, mode);
@@ -71,5 +71,5 @@ faccessat (fd, file, mode, flag)
if (granted == mode)
return 0;
- return INLINE_SYSCALL_ERROR_RETURN (-EACCES, int, -1);
+ return INLINE_SYSCALL_ERROR_RETURN (-EACCES, int);
}
@@ -34,10 +34,10 @@ fchmodat (fd, file, mode, flag)
int flag;
{
if (flag & ~AT_SYMLINK_NOFOLLOW)
- return INLINE_SYSCALL_ERROR_RETURN (-EINVAL, int, -1);
+ return INLINE_SYSCALL_ERROR_RETURN (-EINVAL, int);
#ifndef __NR_lchmod /* Linux so far has no lchmod syscall. */
if (flag & AT_SYMLINK_NOFOLLOW)
- return INLINE_SYSCALL_ERROR_RETURN (-ENOTSUP, int, -1);
+ return INLINE_SYSCALL_ERROR_RETURN (-ENOTSUP, int);
#endif
return INLINE_SYSCALL_RETURN (fchmodat, 3, int, fd, file, mode);
@@ -37,7 +37,7 @@ do_fcntl (int fd, int cmd, void *arg)
return fex.type == F_OWNER_GID ? -fex.pid : fex.pid;
return INLINE_SYSCALL_ERROR_RETURN (-INTERNAL_SYSCALL_ERRNO (res, err),
- int, -1);
+ int);
}
@@ -33,11 +33,11 @@ futimens (int fd, const struct timespec tsp[2])
{
#ifdef __NR_utimensat
if (fd < 0)
- return INLINE_SYSCALL_ERROR_RETURN (-EBADF, int, -1);
+ return INLINE_SYSCALL_ERROR_RETURN (-EBADF, int);
/* Avoid implicit array coercion in syscall macros. */
return INLINE_SYSCALL_RETURN (utimensat, 4, int, fd, NULL, &tsp[0], 0);
#else
- return INLINE_SYSCALL_ERROR_RETURN (-ENOSYS, int, -1);
+ return INLINE_SYSCALL_ERROR_RETURN (-ENOSYS, int);
#endif
}
#ifndef __NR_utimensat
@@ -40,7 +40,7 @@ __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);
+ return INLINE_SYSCALL_ERROR_RETURN (-EINVAL, int);
TIMEVAL_TO_TIMESPEC (&tvp[0], &ts[0]);
TIMEVAL_TO_TIMESPEC (&tvp[1], &ts[1]);
@@ -40,7 +40,7 @@ __fxstat (int vers, int fd, struct stat *buf)
(struct kernel_stat *) buf);
#ifdef STAT_IS_KERNEL_STAT
- return INLINE_SYSCALL_ERROR_RETURN (-EINVAL, int, -1);
+ return INLINE_SYSCALL_ERROR_RETURN (-EINVAL, int);
#else
struct kernel_stat kbuf;
INTERNAL_SYSCALL_DECL (err);
@@ -48,7 +48,7 @@ __fxstat (int vers, int fd, struct stat *buf)
if (__glibc_unlikely (INTERNAL_SYSCALL_ERROR_P (result, err)))
return INLINE_SYSCALL_ERROR_RETURN (-INTERNAL_SYSCALL_ERRNO (result,
err),
- int, -1);
+ int;
else
return __xstat_conv (vers, &kbuf, buf);
#endif
@@ -36,7 +36,7 @@ ___fxstat64 (int vers, int fd, struct stat64 *buf)
if (__glibc_unlikely (INTERNAL_SYSCALL_ERROR_P (result, err)))
return INLINE_SYSCALL_ERROR_RETURN (-INTERNAL_SYSCALL_ERRNO (result,
err),
- int, -1);
+ int);
#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;
@@ -48,7 +48,7 @@ __fxstatat (int vers, int fd, const char *file, struct stat *st, int flag)
if (__glibc_unlikely (INTERNAL_SYSCALL_ERROR_P (result, err)))
return INLINE_SYSCALL_ERROR_RETURN (-INTERNAL_SYSCALL_ERRNO (result,
err),
- int, -1);
+ int);
else
{
#ifdef STAT_IS_KERNEL_STAT
@@ -32,7 +32,7 @@ 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);
+ return INLINE_SYSCALL_ERROR_RETURN (-EINVAL, int);
int result;
INTERNAL_SYSCALL_DECL (err);
@@ -41,7 +41,7 @@ __fxstatat64 (int vers, int fd, const char *file, struct stat64 *st, int flag)
if (__glibc_unlikely (INTERNAL_SYSCALL_ERROR_P (result, err)))
return INLINE_SYSCALL_ERROR_RETURN (-INTERNAL_SYSCALL_ERRNO (result,
err),
- int, -1);
+ int);
else
return 0;
}
@@ -39,7 +39,7 @@ __getpriority (enum __priority_which which, id_t who)
if (__glibc_unlikely (INTERNAL_SYSCALL_ERROR_P (res, err)))
return INLINE_SYSCALL_ERROR_RETURN (-INTERNAL_SYSCALL_ERRNO (res,
err),
- int, -1);
+ int);
else
return PZERO - res;
}
@@ -37,7 +37,7 @@ __llseek (int fd, loff_t offset, int whence)
if (__glibc_unlikely (INTERNAL_SYSCALL_ERROR_P (result, err)))
return INLINE_SYSCALL_ERROR_RETURN (-INTERNAL_SYSCALL_ERRNO (result,
err),
- loff_t, -1);
+ loff_t);
else
return retval;
}
@@ -34,7 +34,7 @@ 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);
+ return INLINE_SYSCALL_ERROR_RETURN (-EINVAL, int);
TIMEVAL_TO_TIMESPEC (&tvp[0], &ts[0]);
TIMEVAL_TO_TIMESPEC (&tvp[1], &ts[1]);
@@ -43,7 +43,7 @@ lutimes (const char *file, const struct timeval tvp[2])
return INLINE_SYSCALL_RETURN (utimensat, 4, int, AT_FDCWD, file,
tvp ? ts : NULL, AT_SYMLINK_NOFOLLOW);
#else
- return INLINE_SYSCALL_ERROR_RETURN (-ENOSYS, int, -1);
+ return INLINE_SYSCALL_ERROR_RETURN (-ENOSYS, int);
#endif
}
@@ -39,7 +39,7 @@ __lxstat (int vers, const char *name, struct stat *buf)
(struct kernel_stat *) buf);
#ifdef STAT_IS_KERNEL_STAT
- return INLINE_SYSCALL_ERROR_RETURN (-EINVAL, int, -1)
+ return INLINE_SYSCALL_ERROR_RETURN (-EINVAL, int)
#else
struct kernel_stat kbuf;
INTERNAL_SYSCALL_DECL (err);
@@ -47,7 +47,7 @@ __lxstat (int vers, const char *name, struct stat *buf)
if (__glibc_unlikely (INTERNAL_SYSCALL_ERROR_P (result, err)))
return INLINE_SYSCALL_ERROR_RETURN (-INTERNAL_SYSCALL_ERRNO (result,
err),
- int, -1)
+ int)
else
return __xstat_conv (vers, &kbuf, buf);
#endif
@@ -35,7 +35,7 @@ ___lxstat64 (int vers, const char *name, struct stat64 *buf)
if (__glibc_unlikely (INTERNAL_SYSCALL_ERROR_P (result, err)))
return INLINE_SYSCALL_ERROR_RETURN (-INTERNAL_SYSCALL_ERRNO (result,
err),
- int, -1);
+ int);
#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;
@@ -46,7 +46,7 @@ __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_ERROR_RETURN (-EINVAL, void *);
return INLINE_SYSCALL_RETURN (mmap2, 6, void *, addr,
len, prot, flags, fd,
(off_t) (offset >> page_shift));
@@ -35,7 +35,7 @@ mqd_t
__mq_open (const char *name, int oflag, ...)
{
if (name[0] != '/')
- return INLINE_SYSCALL_ERROR_RETURN (-EINVAL, int, -1);
+ return INLINE_SYSCALL_ERROR_RETURN (-EINVAL, int);
mode_t mode = 0;
struct mq_attr *attr = NULL;
@@ -26,7 +26,7 @@ int
mq_unlink (const char *name)
{
if (name[0] != '/')
- return INLINE_SYSCALL_ERROR_RETURN (-EINVAL, int, -1);
+ return INLINE_SYSCALL_ERROR_RETURN (-EINVAL, int);
INTERNAL_SYSCALL_DECL (err);
int ret = INTERNAL_SYSCALL (mq_unlink, err, 1, name + 1);
@@ -38,7 +38,7 @@ mq_unlink (const char *name)
ret = INTERNAL_SYSCALL_ERRNO (ret, err);
if (ret == EPERM)
ret = EACCES;
- return INLINE_SYSCALL_ERROR_RETURN (-ret, int, -1);
+ return INLINE_SYSCALL_ERROR_RETURN (-ret, int);
}
return ret;
@@ -51,7 +51,7 @@ prlimit (__pid_t pid, enum __rlimit_resource resource,
if (__glibc_unlikely (INTERNAL_SYSCALL_ERROR_P (res, err)))
return INLINE_SYSCALL_ERROR_RETURN (-INTERNAL_SYSCALL_ERRNO (res,
err),
- int, -1);
+ int);
else if (old_rlimit != NULL)
{
/* The prlimit64 syscall is ill-designed for 32-bit machines.
@@ -64,14 +64,14 @@ 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);
+ return INLINE_SYSCALL_ERROR_RETURN (-EOVERFLOW, int);
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);
+ return INLINE_SYSCALL_ERROR_RETURN (-EOVERFLOW, int);
old_rlimit->rlim_max = RLIM_INFINITY;
}
}
@@ -83,7 +83,7 @@ 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);
+ return INLINE_SYSCALL_ERROR_RETURN (-ENOSYS, int);
}
stub_warning (prlimit)
#endif
@@ -38,7 +38,7 @@ __readahead (int fd, off64_t offset, size_t count)
ssize_t
__readahead (int fd, off64_t offset, size_t count)
{
- return INLINE_SYSCALL_ERROR_RETURN (-ENOSYS, int, -1);
+ return INLINE_SYSCALL_ERROR_RETURN (-ENOSYS, int);
}
stub_warning (readahead)
#endif
@@ -39,7 +39,7 @@ __sched_getaffinity_new (pid_t pid, size_t cpusetsize, cpu_set_t *cpuset)
if (__glibc_unlikely (INTERNAL_SYSCALL_ERROR_P (res, err)))
return INLINE_SYSCALL_ERROR_RETURN (-INTERNAL_SYSCALL_ERRNO (res,
err),
- int, -1);
+ int);
else
{
/* Clean the rest of the memory the kernel didn't do. */
@@ -45,7 +45,7 @@ shmat (shmid, shmaddr, shmflg)
if (__glibc_unlikely (INTERNAL_SYSCALL_ERROR_P (resultvar, err)))
return INLINE_SYSCALL_ERROR_RETURN (-INTERNAL_SYSCALL_ERRNO (resultvar,
err),
- void *, -1l);
+ void *);
else
return raddr;
}
@@ -45,12 +45,12 @@ 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);
+ return INLINE_SYSCALL_ERROR_RETURN (-EINVAL, int);
# ifdef __NR_signalfd
return INLINE_SYSCALL_RETURN (signalfd, 3, int, fd, mask, _NSIG / 8);
# else
- return INLINE_SYSCALL_ERROR_RETURN (-ENOSYS, int, -1);
+ return INLINE_SYSCALL_ERROR_RETURN (-ENOSYS, int);
# endif
#elif !defined __NR_signalfd4
# error "__ASSUME_SIGNALFD4 defined but not __NR_signalfd4"
@@ -60,7 +60,7 @@ cfsetospeed (termios_p, speed)
{
if ((speed & ~CBAUD) != 0
&& (speed < B57600 || speed > __MAX_BAUD))
- return INLINE_SYSCALL_ERROR_RETURN (-EINVAL, int, -1);
+ return INLINE_SYSCALL_ERROR_RETURN (-EINVAL, int);
#ifdef _HAVE_STRUCT_TERMIOS_C_OSPEED
termios_p->c_ospeed = speed;
@@ -84,7 +84,7 @@ cfsetispeed (termios_p, speed)
{
if ((speed & ~CBAUD) != 0
&& (speed < B57600 || speed > __MAX_BAUD))
- return INLINE_SYSCALL_ERROR_RETURN (-EINVAL, int, -1);
+ return INLINE_SYSCALL_ERROR_RETURN (-EINVAL, int);
#ifdef _HAVE_STRUCT_TERMIOS_C_ISPEED
termios_p->c_ispeed = speed;
@@ -39,6 +39,6 @@ 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);
+ return INLINE_SYSCALL_ERROR_RETURN (-EINVAL, int);
#endif
}
@@ -61,7 +61,7 @@ tcsetattr (fd, optional_actions, termios_p)
cmd = TCSETSF;
break;
default:
- return INLINE_SYSCALL_ERROR_RETURN (-EINVAL, int, -1);
+ return INLINE_SYSCALL_ERROR_RETURN (-EINVAL, int);
}
k_termios.c_iflag = termios_p->c_iflag & ~IBAUD0;
@@ -31,7 +31,7 @@ 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);
+ return INLINE_SYSCALL_ERROR_RETURN (-EINVAL, int);
return INLINE_SYSCALL_RETURN (ustat, 2, int, (unsigned int) k_dev,
ubuf);
@@ -30,13 +30,13 @@ utimensat (int fd, const char *file, const struct timespec tsp[2],
int flags)
{
if (file == NULL)
- return INLINE_SYSCALL_ERROR_RETURN (-EINVAL, int, -1);
+ return INLINE_SYSCALL_ERROR_RETURN (-EINVAL, int);
#ifdef __NR_utimensat
/* Avoid implicit array coercion in syscall macros. */
return INLINE_SYSCALL_RETURN (utimensat, 4, int, fd, file, &tsp[0],
flags);
#else
- return INLINE_SYSCALL_ERROR_RETURN (-ENOSYS, int, -1);
+ return INLINE_SYSCALL_ERROR_RETURN (-ENOSYS, int);
#endif
}
#ifndef __NR_utimensat
@@ -33,12 +33,12 @@ __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);
+ return INLINE_SYSCALL_ERROR_RETURN (-EINVAL, int);
/* 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);
+ return INLINE_SYSCALL_ERROR_RETURN (-EINVAL, int);
return INLINE_SYSCALL_RETURN (mknod, 3, int, path, mode,
(unsigned int) k_dev);
@@ -34,12 +34,12 @@ 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);
+ return INLINE_SYSCALL_ERROR_RETURN (-EINVAL, int);
/* 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);
+ return INLINE_SYSCALL_ERROR_RETURN (-EINVAL, int);
return INLINE_SYSCALL_RETURN (mknodat, 4, int, fd, file, mode,
(unsigned int) k_dev);
@@ -39,8 +39,7 @@ __xstat (int vers, const char *name, struct stat *buf)
(struct kernel_stat *) buf);
#ifdef STAT_IS_KERNEL_STAT
- errno = EINVAL;
- return -1;
+ return INLINE_SYSCALL_ERROR_RETURN (-EINVAL, int);
#else
struct kernel_stat kbuf;
INTERNAL_SYSCALL_DECL (err);
@@ -48,7 +47,7 @@ __xstat (int vers, const char *name, struct stat *buf)
if (__glibc_unlikely (INTERNAL_SYSCALL_ERROR_P (result, err)))
return INLINE_SYSCALL_ERROR_RETURN (-INTERNAL_SYSCALL_ERRNO (result,
err),
- int, -1);
+ int);
else
return __xstat_conv (vers, &kbuf, buf);
#endif
@@ -36,7 +36,7 @@ ___xstat64 (int vers, const char *name, struct stat64 *buf)
if (__glibc_unlikely (INTERNAL_SYSCALL_ERROR_P (result, err)))
return INLINE_SYSCALL_ERROR_RETURN (-INTERNAL_SYSCALL_ERRNO (result,
err),
- int, -1);
+ int);
#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;
@@ -96,7 +96,7 @@ __xstat_conv (int vers, struct kernel_stat *kbuf, void *ubuf)
break;
default:
- return INLINE_SYSCALL_ERROR_RETURN (-EINVAL, int, -1);
+ return INLINE_SYSCALL_ERROR_RETURN (-EINVAL, int);
}
return 0;
@@ -169,7 +169,7 @@ __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);
+ return INLINE_SYSCALL_ERROR_RETURN (-EINVAL, int);
}
return 0;
@@ -199,13 +199,13 @@ __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);
+ return INLINE_SYSCALL_ERROR_RETURN (-EOVERFLOW, int);
}
#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);
+ return INLINE_SYSCALL_ERROR_RETURN (-EOVERFLOW, int);
#endif
buf->st_mode = kbuf->st_mode;
buf->st_nlink = kbuf->st_nlink;
@@ -219,13 +219,13 @@ __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);
+ return INLINE_SYSCALL_ERROR_RETURN (-EOVERFLOW, int);
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);
+ return INLINE_SYSCALL_ERROR_RETURN (-EOVERFLOW, int);
#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 +261,7 @@ __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);
+ return INLINE_SYSCALL_ERROR_RETURN (-EINVAL, int);
}
return 0;
--
2.4.3