This is the mail archive of the
glibc-cvs@sourceware.org
mailing list for the glibc project.
GNU C Library master sources branch hjl/i386 created. glibc-2.22-73-ge671d82
- From: hjl at sourceware dot org
- To: glibc-cvs at sourceware dot org
- Date: 14 Aug 2015 14:12:41 -0000
- Subject: GNU C Library master sources branch hjl/i386 created. glibc-2.22-73-ge671d82
This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "GNU C Library master sources".
The branch, hjl/i386 has been created
at e671d82a8840eb0c31b602e9ea9c91e381a7361a (commit)
- Log -----------------------------------------------------------------
http://sourceware.org/git/gitweb.cgi?p=glibc.git;a=commitdiff;h=e671d82a8840eb0c31b602e9ea9c91e381a7361a
commit e671d82a8840eb0c31b602e9ea9c91e381a7361a
Author: H.J. Lu <hjl.tools@gmail.com>
Date: Fri Aug 14 07:12:10 2015 -0700
Fix Linux sysdep need to fix mq_open
diff --git a/sysdeps/unix/sysdep.h b/sysdeps/unix/sysdep.h
index eddf2cf..ea91f03 100644
--- a/sysdeps/unix/sysdep.h
+++ b/sysdeps/unix/sysdep.h
@@ -78,9 +78,11 @@
call and return. */
#ifndef INLINE_SYSCALL_RETURN
#define INLINE_SYSCALL_RETURN(name, nr, type, args...) \
- { \
- return (type) INLINE_SYSCALL (name, nr, args); \
- }
+ do \
+ { \
+ return (type) INLINE_SYSCALL (name, nr, args); \
+ } \
+ while (0)
#endif
/* Define a macro to return for a system call error. ERR is the
@@ -88,8 +90,10 @@
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); \
- return (type) (value); \
- }
+ do \
+ { \
+ __set_errno (-err); \
+ return (type) (value); \
+ } \
+ while (0)
#endif
diff --git a/sysdeps/unix/sysv/linux/aio_sigqueue.c b/sysdeps/unix/sysv/linux/aio_sigqueue.c
index 28917a0..714afb8 100644
--- a/sysdeps/unix/sysv/linux/aio_sigqueue.c
+++ b/sysdeps/unix/sysv/linux/aio_sigqueue.c
@@ -47,7 +47,8 @@ __aio_sigqueue (sig, val, caller_pid)
info.si_uid = getuid ();
info.si_value = val;
- INLINE_SYSCALL_RETURN (rt_sigqueueinfo, 3, int, info.si_pid, sig, &info);
+ INLINE_SYSCALL_RETURN (rt_sigqueueinfo, 3, int, 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 7a130d3..24e3b11 100644
--- a/sysdeps/unix/sysv/linux/dl-openat64.c
+++ b/sysdeps/unix/sysv/linux/dl-openat64.c
@@ -31,8 +31,9 @@ openat64 (dfd, file, oflag)
assert (!__OPEN_NEEDS_MODE (oflag));
#ifdef __NR_openat
- INLINE_SYSCALL_RETURN (openat, 3, int, dfd, file, oflag | O_LARGEFILE)
+ INLINE_SYSCALL_RETURN (openat, 3, int, dfd, file,
+ oflag | O_LARGEFILE);
#else
- INLINE_SYSCALL_ERROR_RETURN (-ENOSYS, int, -1)
+ INLINE_SYSCALL_ERROR_RETURN (-ENOSYS, int, -1);
#endif
}
diff --git a/sysdeps/unix/sysv/linux/eventfd.c b/sysdeps/unix/sysv/linux/eventfd.c
index fd42622..8ba5487 100644
--- a/sysdeps/unix/sysv/linux/eventfd.c
+++ b/sysdeps/unix/sysv/linux/eventfd.c
@@ -30,7 +30,7 @@ eventfd (unsigned int count, int flags)
if (res != -1 || errno != ENOSYS)
return res;
# endif
- INLINE_SYSCALL_RETURN (eventfd2, 2, int, count, flags)
+ INLINE_SYSCALL_RETURN (eventfd2, 2, int, count, flags);
#endif
#ifndef __ASSUME_EVENTFD2
diff --git a/sysdeps/unix/sysv/linux/fchmodat.c b/sysdeps/unix/sysv/linux/fchmodat.c
index 58c18e0..9148c2f 100644
--- a/sysdeps/unix/sysv/linux/fchmodat.c
+++ b/sysdeps/unix/sysv/linux/fchmodat.c
@@ -34,11 +34,11 @@ fchmodat (fd, file, mode, flag)
int flag;
{
if (flag & ~AT_SYMLINK_NOFOLLOW)
- INLINE_SYSCALL_ERROR_RETURN (-EINVAL, int, -1)
+ INLINE_SYSCALL_ERROR_RETURN (-EINVAL, int, -1);
#ifndef __NR_lchmod /* Linux so far has no lchmod syscall. */
if (flag & AT_SYMLINK_NOFOLLOW)
- INLINE_SYSCALL_ERROR_RETURN (-ENOTSUP, int, -1)
+ INLINE_SYSCALL_ERROR_RETURN (-ENOTSUP, int, -1);
#endif
- INLINE_SYSCALL_RETURN (fchmodat, 3, int, fd, file, mode)
+ INLINE_SYSCALL_RETURN (fchmodat, 3, int, fd, file, mode);
}
diff --git a/sysdeps/unix/sysv/linux/fcntl.c b/sysdeps/unix/sysv/linux/fcntl.c
index 2b6df6c..56deff0 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)
- INLINE_SYSCALL_RETURN (fcntl, 3, int, fd, cmd, arg)
+ INLINE_SYSCALL_RETURN (fcntl, 3, int, fd, cmd, arg);
INTERNAL_SYSCALL_DECL (err);
struct f_owner_ex fex;
@@ -37,7 +37,7 @@ do_fcntl (int fd, int cmd, void *arg)
return fex.type == F_OWNER_GID ? -fex.pid : fex.pid;
INLINE_SYSCALL_ERROR_RETURN (-INTERNAL_SYSCALL_ERRNO (res, err),
- int, -1)
+ int, -1);
}
diff --git a/sysdeps/unix/sysv/linux/fstatfs64.c b/sysdeps/unix/sysv/linux/fstatfs64.c
index b28e261..b7dc64f 100644
--- a/sysdeps/unix/sysv/linux/fstatfs64.c
+++ b/sysdeps/unix/sysv/linux/fstatfs64.c
@@ -41,7 +41,7 @@ __fstatfs64 (int fd, struct statfs64 *buf)
if (result == 0 || errno != ENOSYS)
return result;
# else
- INLINE_SYSCALL_RETURN (fstatfs64, 3, int, fd, sizeof (*buf), buf)
+ INLINE_SYSCALL_RETURN (fstatfs64, 3, int, fd, sizeof (*buf), buf);
# endif
# if __ASSUME_STATFS64 == 0
diff --git a/sysdeps/unix/sysv/linux/ftruncate64.c b/sysdeps/unix/sysv/linux/ftruncate64.c
index 2ebe31c..414dac8 100644
--- a/sysdeps/unix/sysv/linux/ftruncate64.c
+++ b/sysdeps/unix/sysv/linux/ftruncate64.c
@@ -30,6 +30,6 @@ __ftruncate64 (int fd, off64_t length)
unsigned int low = length & 0xffffffff;
unsigned int high = length >> 32;
INLINE_SYSCALL_RETURN (ftruncate64, 3, int, fd,
- __LONG_LONG_PAIR (high, low))
+ __LONG_LONG_PAIR (high, low));
}
weak_alias (__ftruncate64, ftruncate64)
diff --git a/sysdeps/unix/sysv/linux/futimens.c b/sysdeps/unix/sysv/linux/futimens.c
index 0d99476..7ce8127 100644
--- a/sysdeps/unix/sysv/linux/futimens.c
+++ b/sysdeps/unix/sysv/linux/futimens.c
@@ -33,11 +33,11 @@ futimens (int fd, const struct timespec tsp[2])
{
#ifdef __NR_utimensat
if (fd < 0)
- INLINE_SYSCALL_ERROR_RETURN (-EBADF, int, -1)
+ INLINE_SYSCALL_ERROR_RETURN (-EBADF, int, -1);
/* Avoid implicit array coercion in syscall macros. */
- INLINE_SYSCALL_RETURN (utimensat, 4, int, fd, NULL, &tsp[0], 0)
+ INLINE_SYSCALL_RETURN (utimensat, 4, int, fd, NULL, &tsp[0], 0);
#else
- INLINE_SYSCALL_ERROR_RETURN (-ENOSYS, int, -1)
+ INLINE_SYSCALL_ERROR_RETURN (-ENOSYS, int, -1);
#endif
}
#ifndef __NR_utimensat
diff --git a/sysdeps/unix/sysv/linux/futimes.c b/sysdeps/unix/sysv/linux/futimes.c
index 59ae777..a5c0448 100644
--- a/sysdeps/unix/sysv/linux/futimes.c
+++ b/sysdeps/unix/sysv/linux/futimes.c
@@ -40,15 +40,13 @@ __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)
- {
- __set_errno (EINVAL);
- return -1;
- }
+ INLINE_SYSCALL_ERROR_RETURN (-EINVAL, int, -1);
TIMEVAL_TO_TIMESPEC (&tvp[0], &ts[0]);
TIMEVAL_TO_TIMESPEC (&tvp[1], &ts[1]);
}
- INLINE_SYSCALL_RETURN (utimensat, 4, int, fd, NULL, tvp ? &ts : NULL, 0)
+ INLINE_SYSCALL_RETURN (utimensat, 4, int, 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 221885b..a03321d 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. */
- INLINE_SYSCALL_RETURN (futimesat, 3, int, fd, file, &tvp[0])
+ INLINE_SYSCALL_RETURN (futimesat, 3, int, fd, file, &tvp[0]);
}
diff --git a/sysdeps/unix/sysv/linux/fxstat.c b/sysdeps/unix/sysv/linux/fxstat.c
index 4ef32a8..cbc5d36 100644
--- a/sysdeps/unix/sysv/linux/fxstat.c
+++ b/sysdeps/unix/sysv/linux/fxstat.c
@@ -36,17 +36,17 @@ int
__fxstat (int vers, int fd, struct stat *buf)
{
if (vers == _STAT_VER_KERNEL)
- INLINE_SYSCALL_RETURN (fstat, 2, fd, (struct kernel_stat *) buf);
+ INLINE_SYSCALL_RETURN (fstat, 2, fd, (struct kernel_stat *) buf);;
#ifdef STAT_IS_KERNEL_STAT
- INLINE_SYSCALL_ERROR_RETURN (-EINVAL, int, -1)
+ INLINE_SYSCALL_ERROR_RETURN (-EINVAL, int, -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)))
INLINE_SYSCALL_ERROR_RETURN (-INTERNAL_SYSCALL_ERRNO (result, err),
- int, -1)
+ int, -1);
else
return __xstat_conv (vers, &kbuf, buf);
#endif
diff --git a/sysdeps/unix/sysv/linux/fxstat64.c b/sysdeps/unix/sysv/linux/fxstat64.c
index 4f67b30..565eefb 100644
--- a/sysdeps/unix/sysv/linux/fxstat64.c
+++ b/sysdeps/unix/sysv/linux/fxstat64.c
@@ -35,7 +35,7 @@ ___fxstat64 (int vers, int fd, struct stat64 *buf)
int result = INTERNAL_SYSCALL (fstat64, err, 2, fd, buf);
if (__glibc_unlikely (INTERNAL_SYSCALL_ERROR_P (result, err)))
INLINE_SYSCALL_ERROR_RETURN (-INTERNAL_SYSCALL_ERRNO (result, err),
- int, -1)
+ int, -1);
#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/gai_sigqueue.c b/sysdeps/unix/sysv/linux/gai_sigqueue.c
index 95f0911..d76d694 100644
--- a/sysdeps/unix/sysv/linux/gai_sigqueue.c
+++ b/sysdeps/unix/sysv/linux/gai_sigqueue.c
@@ -48,7 +48,7 @@ __gai_sigqueue (sig, val, caller_pid)
info.si_value = val;
INLINE_SYSCALL_RETURN (rt_sigqueueinfo, 3, int, info.si_pid, sig,
- &info)
+ &info);
}
#else
# include <resolv/gai_sigqueue.c>
diff --git a/sysdeps/unix/sysv/linux/getpriority.c b/sysdeps/unix/sysv/linux/getpriority.c
index 59c82b8..8d9381b 100644
--- a/sysdeps/unix/sysv/linux/getpriority.c
+++ b/sysdeps/unix/sysv/linux/getpriority.c
@@ -38,7 +38,7 @@ __getpriority (enum __priority_which which, id_t who)
int res = INTERNAL_SYSCALL (getpriority, err, 2, (int) which, who);
if (__glibc_unlikely (INTERNAL_SYSCALL_ERROR_P (res, err)))
INLINE_SYSCALL_ERROR_RETURN (-INTERNAL_SYSCALL_ERRNO (res, err),
- int, -1)
+ int, -1);
else
return PZERO - res;
}
diff --git a/sysdeps/unix/sysv/linux/getrlimit64.c b/sysdeps/unix/sysv/linux/getrlimit64.c
index 739304a..475225c 100644
--- a/sysdeps/unix/sysv/linux/getrlimit64.c
+++ b/sysdeps/unix/sysv/linux/getrlimit64.c
@@ -27,7 +27,7 @@ int
__getrlimit64 (enum __rlimit_resource resource, struct rlimit64 *rlimits)
{
#ifdef __ASSUME_PRLIMIT64
- INLINE_SYSCALL_RETURN (prlimit64, 4, int, 0, resource, NULL, rlimits)
+ INLINE_SYSCALL_RETURN (prlimit64, 4, int, 0, resource, NULL, rlimits);
#else
# ifdef __NR_prlimit64
int res = INLINE_SYSCALL (prlimit64, 4, 0, resource, NULL, rlimits);
diff --git a/sysdeps/unix/sysv/linux/llseek.c b/sysdeps/unix/sysv/linux/llseek.c
index 05c3bab..a9e2b0e 100644
--- a/sysdeps/unix/sysv/linux/llseek.c
+++ b/sysdeps/unix/sysv/linux/llseek.c
@@ -36,7 +36,7 @@ __llseek (int fd, loff_t offset, int whence)
&retval, whence);
if (__glibc_unlikely (INTERNAL_SYSCALL_ERROR_P (result, err)))
INLINE_SYSCALL_ERROR_RETURN (-INTERNAL_SYSCALL_ERRNO (result, err),
- loff_t, -1)
+ loff_t, -1);
else
return retval;
}
diff --git a/sysdeps/unix/sysv/linux/lutimes.c b/sysdeps/unix/sysv/linux/lutimes.c
index f3a9eee..dd70acb 100644
--- a/sysdeps/unix/sysv/linux/lutimes.c
+++ b/sysdeps/unix/sysv/linux/lutimes.c
@@ -34,19 +34,16 @@ 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)
- {
- __set_errno (EINVAL);
- return -1;
- }
+ INLINE_SYSCALL_ERROR_RETURN (-EINVAL, int, -1);
TIMEVAL_TO_TIMESPEC (&tvp[0], &ts[0]);
TIMEVAL_TO_TIMESPEC (&tvp[1], &ts[1]);
}
INLINE_SYSCALL_RETURN (utimensat, 4, int, AT_FDCWD, file,
- tvp ? ts : NULL, AT_SYMLINK_NOFOLLOW)
+ tvp ? ts : NULL, AT_SYMLINK_NOFOLLOW);
#else
- INLINE_SYSCALL_ERROR_RETURN (-ENOSYS, int, -1)
+ INLINE_SYSCALL_ERROR_RETURN (-ENOSYS, int, -1);
#endif
}
diff --git a/sysdeps/unix/sysv/linux/lxstat64.c b/sysdeps/unix/sysv/linux/lxstat64.c
index 015150d..76ed9cf 100644
--- a/sysdeps/unix/sysv/linux/lxstat64.c
+++ b/sysdeps/unix/sysv/linux/lxstat64.c
@@ -34,7 +34,7 @@ ___lxstat64 (int vers, const char *name, struct stat64 *buf)
int result = INTERNAL_SYSCALL (lstat64, err, 2, name, buf);
if (__glibc_unlikely (INTERNAL_SYSCALL_ERROR_P (result, err)))
INLINE_SYSCALL_ERROR_RETURN (-INTERNAL_SYSCALL_ERRNO (result, err),
- int, -1)
+ int, -1);
#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 9b5e499..aa025b8 100644
--- a/sysdeps/unix/sysv/linux/mmap64.c
+++ b/sysdeps/unix/sysv/linux/mmap64.c
@@ -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))
- INLINE_SYSCALL_ERROR_RETURN (-EINVAL, void *, MAP_FAILED)
+ INLINE_SYSCALL_ERROR_RETURN (-EINVAL, void *, MAP_FAILED);
INLINE_SYSCALL_RETURN (mmap2, 6, void *, addr,
len, prot, flags, fd,
(off_t) (offset >> page_shift));
diff --git a/sysdeps/unix/sysv/linux/mq_close.c b/sysdeps/unix/sysv/linux/mq_close.c
index e811143..bd5fd9b 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)
{
- INLINE_SYSCALL_RETURN (close, 1, int, mqdes)
+ INLINE_SYSCALL_RETURN (close, 1, int, mqdes);
}
#else
diff --git a/sysdeps/unix/sysv/linux/mq_open.c b/sysdeps/unix/sysv/linux/mq_open.c
index 8bf2fc4..7636ed5 100644
--- a/sysdeps/unix/sysv/linux/mq_open.c
+++ b/sysdeps/unix/sysv/linux/mq_open.c
@@ -24,6 +24,9 @@
#ifdef __NR_mq_open
+extern mqd_t __mq_open (const char *, int, ...);
+libc_hidden_proto (__mq_open)
+
/* Establish connection between a process and a message queue NAME and
return message queue descriptor or (mqd_t) -1 on error. OFLAG determines
the type of access used. If O_CREAT is on OFLAG, the third argument is
@@ -35,10 +38,7 @@ mqd_t
__mq_open (const char *name, int oflag, ...)
{
if (name[0] != '/')
- {
- __set_errno (EINVAL);
- return -1;
- }
+ INLINE_SYSCALL_ERROR_RETURN (-EINVAL, int, -1);
mode_t mode = 0;
struct mq_attr *attr = NULL;
@@ -52,9 +52,10 @@ __mq_open (const char *name, int oflag, ...)
va_end (ap);
}
- INLINE_SYSCALL_RETURN (mq_open, 4, int, name + 1, oflag, mode, attr)
+ INLINE_SYSCALL_RETURN (mq_open, 4, int, name + 1, oflag, mode, attr);
}
strong_alias (__mq_open, mq_open);
+libc_hidden_def (__mq_open)
mqd_t
__mq_open_2 (const char *name, int oflag)
diff --git a/sysdeps/unix/sysv/linux/msgget.c b/sysdeps/unix/sysv/linux/msgget.c
index 615a447..aff17dc 100644
--- a/sysdeps/unix/sysv/linux/msgget.c
+++ b/sysdeps/unix/sysv/linux/msgget.c
@@ -32,5 +32,6 @@ msgget (key, msgflg)
key_t key;
int msgflg;
{
- INLINE_SYSCALL_RETURN (ipc, 5, int, IPCOP_msgget, key, msgflg, 0, NULL)
+ INLINE_SYSCALL_RETURN (ipc, 5, int, IPCOP_msgget, key, msgflg, 0,
+ NULL);
}
diff --git a/sysdeps/unix/sysv/linux/prlimit.c b/sysdeps/unix/sysv/linux/prlimit.c
index fb17639..2b3b0fb 100644
--- a/sysdeps/unix/sysv/linux/prlimit.c
+++ b/sysdeps/unix/sysv/linux/prlimit.c
@@ -50,7 +50,7 @@ prlimit (__pid_t pid, enum __rlimit_resource resource,
if (__glibc_unlikely (INTERNAL_SYSCALL_ERROR_P (res, err)))
INLINE_SYSCALL_ERROR_RETURN (-INTERNAL_SYSCALL_ERRNO (res, err),
- int, -1)
+ int, -1);
else if (old_rlimit != NULL)
{
/* The prlimit64 syscall is ill-designed for 32-bit machines.
@@ -63,14 +63,14 @@ prlimit (__pid_t pid, enum __rlimit_resource resource,
if (old_rlimit->rlim_cur != old_rlimit64_mem.rlim_cur)
{
if (new_rlimit == NULL)
- INLINE_SYSCALL_ERROR_RETURN (-EOVERFLOW, int, -1)
+ INLINE_SYSCALL_ERROR_RETURN (-EOVERFLOW, int, -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)
- INLINE_SYSCALL_ERROR_RETURN (-EOVERFLOW, int, -1)
+ INLINE_SYSCALL_ERROR_RETURN (-EOVERFLOW, int, -1);
old_rlimit->rlim_max = RLIM_INFINITY;
}
}
diff --git a/sysdeps/unix/sysv/linux/raise.c b/sysdeps/unix/sysv/linux/raise.c
index e07c9f7..ebef77a 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;
- INLINE_SYSCALL_RETURN (tgkill, 3, int, pid, selftid, sig)
+ INLINE_SYSCALL_RETURN (tgkill, 3, int, 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 51fb4f8..2e5aaf0 100644
--- a/sysdeps/unix/sysv/linux/readahead.c
+++ b/sysdeps/unix/sysv/linux/readahead.c
@@ -32,7 +32,7 @@ __readahead (int fd, off64_t offset, size_t count)
INLINE_SYSCALL_RETURN (readahead, 4, int, fd,
__LONG_LONG_PAIR ((off_t) (offset >> 32),
(off_t) (offset & 0xffffffff)),
- count)
+ count);
}
#else
ssize_t
diff --git a/sysdeps/unix/sysv/linux/reboot.c b/sysdeps/unix/sysv/linux/reboot.c
index 4a7413d..9367d40 100644
--- a/sysdeps/unix/sysv/linux/reboot.c
+++ b/sysdeps/unix/sysv/linux/reboot.c
@@ -26,5 +26,5 @@ int
reboot (int howto)
{
INLINE_SYSCALL_RETURN (reboot, 3, int, (int) 0xfee1dead, 672274793,
- howto)
+ howto);
}
diff --git a/sysdeps/unix/sysv/linux/sched_getaffinity.c b/sysdeps/unix/sysv/linux/sched_getaffinity.c
index 97a24b9..716af6a 100644
--- a/sysdeps/unix/sysv/linux/sched_getaffinity.c
+++ b/sysdeps/unix/sysv/linux/sched_getaffinity.c
@@ -38,7 +38,7 @@ __sched_getaffinity_new (pid_t pid, size_t cpusetsize, cpu_set_t *cpuset)
MIN (INT_MAX, cpusetsize), cpuset);
if (__glibc_unlikely (INTERNAL_SYSCALL_ERROR_P (res, err)))
INLINE_SYSCALL_ERROR_RETURN (-INTERNAL_SYSCALL_ERRNO (res, err),
- int, -1)
+ int, -1);
else
{
/* Clean the rest of the memory the kernel didn't do. */
diff --git a/sysdeps/unix/sysv/linux/semget.c b/sysdeps/unix/sysv/linux/semget.c
index af4f4fa..c7c5d02 100644
--- a/sysdeps/unix/sysv/linux/semget.c
+++ b/sysdeps/unix/sysv/linux/semget.c
@@ -34,5 +34,5 @@ semget (key, nsems, semflg)
int semflg;
{
INLINE_SYSCALL_RETURN (ipc, 5, int, IPCOP_semget, key, nsems, semflg,
- NULL)
+ NULL);
}
diff --git a/sysdeps/unix/sysv/linux/semop.c b/sysdeps/unix/sysv/linux/semop.c
index b5d3e17..1d5433f 100644
--- a/sysdeps/unix/sysv/linux/semop.c
+++ b/sysdeps/unix/sysv/linux/semop.c
@@ -32,5 +32,5 @@ semop (semid, sops, nsops)
size_t nsops;
{
INLINE_SYSCALL_RETURN (ipc, 5, int, IPCOP_semop, semid, (int) nsops, 0,
- sops)
+ sops);
}
diff --git a/sysdeps/unix/sysv/linux/semtimedop.c b/sysdeps/unix/sysv/linux/semtimedop.c
index a351a7d..4e98b7b 100644
--- a/sysdeps/unix/sysv/linux/semtimedop.c
+++ b/sysdeps/unix/sysv/linux/semtimedop.c
@@ -33,5 +33,5 @@ semtimedop (semid, sops, nsops, timeout)
const struct timespec *timeout;
{
INLINE_SYSCALL_RETURN (ipc, 6, int, IPCOP_semtimedop, semid,
- (int) nsops, 0, sops, timeout)
+ (int) nsops, 0, sops, timeout);
}
diff --git a/sysdeps/unix/sysv/linux/setrlimit64.c b/sysdeps/unix/sysv/linux/setrlimit64.c
index cd438ce..d13a0df 100644
--- a/sysdeps/unix/sysv/linux/setrlimit64.c
+++ b/sysdeps/unix/sysv/linux/setrlimit64.c
@@ -30,7 +30,8 @@ setrlimit64 (resource, rlimits)
const struct rlimit64 *rlimits;
{
#ifdef __ASSUME_PRLIMIT64
- INLINE_SYSCALL_RETURN (prlimit64, 4, int, 0, resource, rlimits, NULL)
+ INLINE_SYSCALL_RETURN (prlimit64, 4, int, 0, resource, rlimits,
+ NULL);
#else
# ifdef __NR_prlimit64
int res = INLINE_SYSCALL (prlimit64, 4, 0, resource, rlimits, NULL);
diff --git a/sysdeps/unix/sysv/linux/shmdt.c b/sysdeps/unix/sysv/linux/shmdt.c
index 240b8df..3cec3af 100644
--- a/sysdeps/unix/sysv/linux/shmdt.c
+++ b/sysdeps/unix/sysv/linux/shmdt.c
@@ -31,5 +31,5 @@ shmdt (shmaddr)
const void *shmaddr;
{
INLINE_SYSCALL_RETURN (ipc, 5, int, IPCOP_shmdt, 0, 0, 0,
- (void *) shmaddr)
+ (void *) shmaddr);
}
diff --git a/sysdeps/unix/sysv/linux/shmget.c b/sysdeps/unix/sysv/linux/shmget.c
index 1349565..ad096c2 100644
--- a/sysdeps/unix/sysv/linux/shmget.c
+++ b/sysdeps/unix/sysv/linux/shmget.c
@@ -34,5 +34,5 @@ shmget (key, size, shmflg)
int shmflg;
{
INLINE_SYSCALL_RETURN (ipc, 5, int, IPCOP_shmget, key, size, shmflg,
- NULL)
+ NULL);
}
diff --git a/sysdeps/unix/sysv/linux/signalfd.c b/sysdeps/unix/sysv/linux/signalfd.c
index efad019..02b29dc 100644
--- a/sysdeps/unix/sysv/linux/signalfd.c
+++ b/sysdeps/unix/sysv/linux/signalfd.c
@@ -31,7 +31,7 @@ signalfd (int fd, const sigset_t *mask, int flags)
if (res != -1 || errno != ENOSYS)
return res;
# else
- INLINE_SYSCALL_RETURN (signalfd4, 4, int, fd, mask, _NSIG / 8, flags)
+ INLINE_SYSCALL_RETURN (signalfd4, 4, int, fd, mask, _NSIG / 8, flags);
# endif
#endif
@@ -41,12 +41,12 @@ signalfd (int fd, const sigset_t *mask, int flags)
kernel (sys_indirect) before implementing setting flags like
O_NONBLOCK etc. */
if (flags != 0)
- INLINE_SYSCALL_ERROR_RETURN (-EINVAL, int, -1)
+ INLINE_SYSCALL_ERROR_RETURN (-EINVAL, int, -1);
# ifdef __NR_signalfd
- INLINE_SYSCALL_RETURN (signalfd, 3, int, fd, mask, _NSIG / 8)
+ INLINE_SYSCALL_RETURN (signalfd, 3, int, fd, mask, _NSIG / 8);
# else
- INLINE_SYSCALL_ERROR_RETURN (-ENOSYS, int, -1)
+ INLINE_SYSCALL_ERROR_RETURN (-ENOSYS, int, -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 7c6f62f..8b43697 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;
{
- INLINE_SYSCALL_RETURN (rt_sigpending, 2, int, set, _NSIG / 8)
+ INLINE_SYSCALL_RETURN (rt_sigpending, 2, int, set, _NSIG / 8);
}
diff --git a/sysdeps/unix/sysv/linux/sigprocmask.c b/sysdeps/unix/sysv/linux/sigprocmask.c
index 03ba586..1d17f72 100644
--- a/sysdeps/unix/sysv/linux/sigprocmask.c
+++ b/sysdeps/unix/sysv/linux/sigprocmask.c
@@ -55,6 +55,6 @@ __sigprocmask (how, set, oset)
#endif
INLINE_SYSCALL_RETURN (rt_sigprocmask, 4, int, how, set, oset,
- _NSIG / 8)
+ _NSIG / 8);
}
weak_alias (__sigprocmask, sigprocmask)
diff --git a/sysdeps/unix/sysv/linux/sigqueue.c b/sysdeps/unix/sysv/linux/sigqueue.c
index 9f33b47..fbe3a28 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;
- INLINE_SYSCALL_RETURN (rt_sigqueueinfo, 3, int, pid, sig, &info)
+ INLINE_SYSCALL_RETURN (rt_sigqueueinfo, 3, int, pid, sig, &info);
}
weak_alias (__sigqueue, sigqueue)
#else
diff --git a/sysdeps/unix/sysv/linux/statfs64.c b/sysdeps/unix/sysv/linux/statfs64.c
index edf2690..051c7de 100644
--- a/sysdeps/unix/sysv/linux/statfs64.c
+++ b/sysdeps/unix/sysv/linux/statfs64.c
@@ -43,7 +43,7 @@ __statfs64 (const char *file, struct statfs64 *buf)
if (result == 0 || errno != ENOSYS)
return result;
# else
- INLINE_SYSCALL_RETURN (statfs64, 3, int, file, sizeof (*buf), buf)
+ INLINE_SYSCALL_RETURN (statfs64, 3, int, file, sizeof (*buf), buf);
# endif
# if __ASSUME_STATFS64 == 0
diff --git a/sysdeps/unix/sysv/linux/sysctl.c b/sysdeps/unix/sysv/linux/sysctl.c
index 27720b0..7826f10 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
};
- INLINE_SYSCALL_RETURN (_sysctl, 1, int, &args)
+ INLINE_SYSCALL_RETURN (_sysctl, 1, int, &args);
}
libc_hidden_def (__sysctl)
weak_alias (__sysctl, sysctl)
diff --git a/sysdeps/unix/sysv/linux/tcsetattr.c b/sysdeps/unix/sysv/linux/tcsetattr.c
index a208bcf..4339470 100644
--- a/sysdeps/unix/sysv/linux/tcsetattr.c
+++ b/sysdeps/unix/sysv/linux/tcsetattr.c
@@ -78,6 +78,6 @@ tcsetattr (fd, optional_actions, termios_p)
memcpy (&k_termios.c_cc[0], &termios_p->c_cc[0],
__KERNEL_NCCS * sizeof (cc_t));
- INLINE_SYSCALL_RETURN (ioctl, 3, int, fd, cmd, &k_termios)
+ INLINE_SYSCALL_RETURN (ioctl, 3, int, 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 11d4ba3..4f08a31 100644
--- a/sysdeps/unix/sysv/linux/timer_getoverr.c
+++ b/sysdeps/unix/sysv/linux/timer_getoverr.c
@@ -35,5 +35,5 @@ timer_getoverrun (timerid)
struct timer *kt = (struct timer *) timerid;
/* Get the information from the kernel. */
- INLINE_SYSCALL_RETURN (timer_getoverrun, 1, int, kt->ktimerid)
+ INLINE_SYSCALL_RETURN (timer_getoverrun, 1, int, kt->ktimerid);
}
diff --git a/sysdeps/unix/sysv/linux/timer_gettime.c b/sysdeps/unix/sysv/linux/timer_gettime.c
index cf7956e..dbe464a 100644
--- a/sysdeps/unix/sysv/linux/timer_gettime.c
+++ b/sysdeps/unix/sysv/linux/timer_gettime.c
@@ -37,5 +37,5 @@ timer_gettime (timerid, value)
struct timer *kt = (struct timer *) timerid;
/* Delete the kernel timer object. */
- INLINE_SYSCALL_RETURN (timer_gettime, 2, int, kt->ktimerid, value)
+ INLINE_SYSCALL_RETURN (timer_gettime, 2, int, kt->ktimerid, value);
}
diff --git a/sysdeps/unix/sysv/linux/timer_settime.c b/sysdeps/unix/sysv/linux/timer_settime.c
index fcfadf2..454da13 100644
--- a/sysdeps/unix/sysv/linux/timer_settime.c
+++ b/sysdeps/unix/sysv/linux/timer_settime.c
@@ -40,5 +40,5 @@ timer_settime (timerid, flags, value, ovalue)
/* Delete the kernel timer object. */
INLINE_SYSCALL_RETURN (timer_settime, 4, int, kt->ktimerid, flags,
- value, ovalue)
+ value, ovalue);
}
diff --git a/sysdeps/unix/sysv/linux/truncate64.c b/sysdeps/unix/sysv/linux/truncate64.c
index 3b75a0b..cb7f278 100644
--- a/sysdeps/unix/sysv/linux/truncate64.c
+++ b/sysdeps/unix/sysv/linux/truncate64.c
@@ -30,5 +30,5 @@ truncate64 (const char *path, off64_t length)
unsigned int low = length & 0xffffffff;
unsigned int high = length >> 32;
INLINE_SYSCALL_RETURN (truncate64, 3, int, path,
- __LONG_LONG_PAIR (high, low))
+ __LONG_LONG_PAIR (high, low));
}
diff --git a/sysdeps/unix/sysv/linux/ustat.c b/sysdeps/unix/sysv/linux/ustat.c
index 9513f4a..cd32f70 100644
--- a/sysdeps/unix/sysv/linux/ustat.c
+++ b/sysdeps/unix/sysv/linux/ustat.c
@@ -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)
- INLINE_SYSCALL_ERROR_RETURN (-EINVAL, int, -1)
+ INLINE_SYSCALL_ERROR_RETURN (-EINVAL, int, -1);
- INLINE_SYSCALL_RETURN (ustat, 2, int, (unsigned int) k_dev, ubuf)
+ INLINE_SYSCALL_RETURN (ustat, 2, int, (unsigned int) k_dev, ubuf);
}
diff --git a/sysdeps/unix/sysv/linux/utimensat.c b/sysdeps/unix/sysv/linux/utimensat.c
index c0ed4a4..8ae5a25 100644
--- a/sysdeps/unix/sysv/linux/utimensat.c
+++ b/sysdeps/unix/sysv/linux/utimensat.c
@@ -30,12 +30,12 @@ utimensat (int fd, const char *file, const struct timespec tsp[2],
int flags)
{
if (file == NULL)
- INLINE_SYSCALL_ERROR_RETURN (-EINVAL, int, -1)
+ INLINE_SYSCALL_ERROR_RETURN (-EINVAL, int, -1);
#ifdef __NR_utimensat
/* Avoid implicit array coercion in syscall macros. */
- INLINE_SYSCALL_RETURN (utimensat, 4, int, fd, file, &tsp[0], flags)
+ INLINE_SYSCALL_RETURN (utimensat, 4, int, fd, file, &tsp[0], flags);
#else
- INLINE_SYSCALL_ERROR_RETURN (-ENOSYS, int, -1)
+ INLINE_SYSCALL_ERROR_RETURN (-ENOSYS, int, -1);
#endif
}
#ifndef __NR_utimensat
diff --git a/sysdeps/unix/sysv/linux/utimes.c b/sysdeps/unix/sysv/linux/utimes.c
index 7ce324a..133dca6 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. */
- INLINE_SYSCALL_RETURN (utimes, 2, int, file, &tvp[0])
+ INLINE_SYSCALL_RETURN (utimes, 2, int, file, &tvp[0]);
}
weak_alias (__utimes, utimes)
diff --git a/sysdeps/unix/sysv/linux/xmknod.c b/sysdeps/unix/sysv/linux/xmknod.c
index f871ec0..a914918 100644
--- a/sysdeps/unix/sysv/linux/xmknod.c
+++ b/sysdeps/unix/sysv/linux/xmknod.c
@@ -33,14 +33,14 @@ __xmknod (int vers, const char *path, mode_t mode, dev_t *dev)
unsigned long long int k_dev;
if (vers != _MKNOD_VER)
- INLINE_SYSCALL_ERROR_RETURN (-EINVAL, int, -1)
+ INLINE_SYSCALL_ERROR_RETURN (-EINVAL, int, -1);
/* We must convert the value to dev_t type used by the kernel. */
k_dev = (*dev) & ((1ULL << 32) - 1);
if (k_dev != *dev)
- INLINE_SYSCALL_ERROR_RETURN (-EINVAL, int, -1)
+ INLINE_SYSCALL_ERROR_RETURN (-EINVAL, int, -1);
- INLINE_SYSCALL_RETURN (mknod, 3, int, path, mode, (unsigned int) k_dev)
+ INLINE_SYSCALL_RETURN (mknod, 3, int, 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 3428e30..6a85ef7 100644
--- a/sysdeps/unix/sysv/linux/xmknodat.c
+++ b/sysdeps/unix/sysv/linux/xmknodat.c
@@ -34,15 +34,15 @@ int
__xmknodat (int vers, int fd, const char *file, mode_t mode, dev_t *dev)
{
if (vers != _MKNOD_VER)
- INLINE_SYSCALL_ERROR_RETURN (-EINVAL, int, -1)
+ INLINE_SYSCALL_ERROR_RETURN (-EINVAL, int, -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)
- INLINE_SYSCALL_ERROR_RETURN (-EINVAL, int, -1)
+ INLINE_SYSCALL_ERROR_RETURN (-EINVAL, int, -1);
INLINE_SYSCALL_RETURN (mknodat, 4, int, fd, file, mode,
- (unsigned int) k_dev)
+ (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 f7b36fa..3054883 100644
--- a/sysdeps/unix/sysv/linux/xstat.c
+++ b/sysdeps/unix/sysv/linux/xstat.c
@@ -35,7 +35,8 @@ int
__xstat (int vers, const char *name, struct stat *buf)
{
if (vers == _STAT_VER_KERNEL)
- INLINE_SYSCALL_RETURN (stat, 2, int, name, (struct kernel_stat *) buf)
+ INLINE_SYSCALL_RETURN (stat, 2, int, name,
+ (struct kernel_stat *) buf);
#ifdef STAT_IS_KERNEL_STAT
errno = EINVAL;
@@ -46,7 +47,7 @@ __xstat (int vers, const char *name, struct stat *buf)
int result = INTERNAL_SYSCALL (stat, err, 2, name, &kbuf);
if (__glibc_unlikely (INTERNAL_SYSCALL_ERROR_P (result, err)))
INLINE_SYSCALL_ERROR_RETURN (-INTERNAL_SYSCALL_ERRNO (result, err),
- int, -1)
+ int, -1);
else
return __xstat_conv (vers, &kbuf, buf);
#endif
diff --git a/sysdeps/unix/sysv/linux/xstat64.c b/sysdeps/unix/sysv/linux/xstat64.c
index 8cb970f..8afc6ce 100644
--- a/sysdeps/unix/sysv/linux/xstat64.c
+++ b/sysdeps/unix/sysv/linux/xstat64.c
@@ -35,7 +35,7 @@ ___xstat64 (int vers, const char *name, struct stat64 *buf)
int result = INTERNAL_SYSCALL (stat64, err, 2, name, buf);
if (__glibc_unlikely (INTERNAL_SYSCALL_ERROR_P (result, err)))
INLINE_SYSCALL_ERROR_RETURN (-INTERNAL_SYSCALL_ERRNO (result, err),
- int, -1)
+ int, -1);
#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;
http://sourceware.org/git/gitweb.cgi?p=glibc.git;a=commitdiff;h=af19672b82b8d55693cec32151ca9f60fe169c91
commit af19672b82b8d55693cec32151ca9f60fe169c91
Author: H.J. Lu <hjl.tools@gmail.com>
Date: Fri Aug 14 07:11:59 2015 -0700
Fix i386 sysdep
diff --git a/sysdeps/unix/sysv/linux/i386/brk.c b/sysdeps/unix/sysv/linux/i386/brk.c
index 98c28ff..e49905a 100644
--- a/sysdeps/unix/sysv/linux/i386/brk.c
+++ b/sysdeps/unix/sysv/linux/i386/brk.c
@@ -35,7 +35,7 @@ __brk (void *addr)
void *newbrk = (void *) INTERNAL_SYSCALL (brk, err, 1, addr);
__curbrk = newbrk;
if (newbrk < addr)
- INLINE_SYSCALL_ERROR_RETURN (-ENOMEM, int, )
+ INLINE_SYSCALL_ERROR_RETURN (-ENOMEM, int, );
return 0;
}
weak_alias (__brk, brk)
diff --git a/sysdeps/unix/sysv/linux/i386/fcntl.c b/sysdeps/unix/sysv/linux/i386/fcntl.c
index 2744aaa..eae84b5 100644
--- a/sysdeps/unix/sysv/linux/i386/fcntl.c
+++ b/sysdeps/unix/sysv/linux/i386/fcntl.c
@@ -34,7 +34,7 @@ __fcntl_nocancel (int fd, int cmd, ...)
arg = va_arg (ap, void *);
va_end (ap);
- INLINE_SYSCALL_RETURN (fcntl64, 3, int, fd, cmd, arg)
+ INLINE_SYSCALL_RETURN (fcntl64, 3, int, fd, cmd, arg);
}
#endif /* NO_CANCELLATION */
@@ -50,7 +50,7 @@ __libc_fcntl (int fd, int cmd, ...)
va_end (ap);
if ((cmd != F_SETLKW) && (cmd != F_SETLKW64))
- INLINE_SYSCALL_RETURN (fcntl64, 3, int, fd, cmd, arg)
+ INLINE_SYSCALL_RETURN (fcntl64, 3, int, fd, cmd, arg);
return SYSCALL_CANCEL (fcntl64, fd, cmd, arg);
}
diff --git a/sysdeps/unix/sysv/linux/i386/fxstat.c b/sysdeps/unix/sysv/linux/i386/fxstat.c
index a471644..b97a26d 100644
--- a/sysdeps/unix/sysv/linux/i386/fxstat.c
+++ b/sysdeps/unix/sysv/linux/i386/fxstat.c
@@ -37,7 +37,7 @@ __fxstat (int vers, int fd, struct stat *buf)
int result;
if (vers == _STAT_VER_KERNEL)
- INLINE_SYSCALL_RETURN (fstat, 2, int, fd, (struct kernel_stat *) buf)
+ INLINE_SYSCALL_RETURN (fstat, 2, int, fd, (struct kernel_stat *) buf);
{
struct stat64 buf64;
@@ -45,7 +45,7 @@ __fxstat (int vers, int fd, struct stat *buf)
INTERNAL_SYSCALL_DECL (err);
result = INTERNAL_SYSCALL (fstat64, err, 2, fd, &buf64);
if (__glibc_unlikely (INTERNAL_SYSCALL_ERROR_P (result, )))
- INLINE_SYSCALL_ERROR_RETURN (result, int, )
+ INLINE_SYSCALL_ERROR_RETURN (result, int, );
else
return __xstat32_conv (vers, &buf64, buf);
}
diff --git a/sysdeps/unix/sysv/linux/i386/fxstatat.c b/sysdeps/unix/sysv/linux/i386/fxstatat.c
index ed0ed65..0f7fb06 100644
--- a/sysdeps/unix/sysv/linux/i386/fxstatat.c
+++ b/sysdeps/unix/sysv/linux/i386/fxstatat.c
@@ -43,7 +43,7 @@ __fxstatat (int vers, int fd, const char *file, struct stat *st, int flag)
result = INTERNAL_SYSCALL (fstatat64, err, 4, fd, file, &st64, flag);
if (__glibc_unlikely (INTERNAL_SYSCALL_ERROR_P (result, )))
- INLINE_SYSCALL_ERROR_RETURN (result, int, )
+ INLINE_SYSCALL_ERROR_RETURN (result, int, );
else
return __xstat32_conv (vers, &st64, st);
}
diff --git a/sysdeps/unix/sysv/linux/i386/getmsg.c b/sysdeps/unix/sysv/linux/i386/getmsg.c
index c192b68..a19ba36 100644
--- a/sysdeps/unix/sysv/linux/i386/getmsg.c
+++ b/sysdeps/unix/sysv/linux/i386/getmsg.c
@@ -31,7 +31,7 @@ getmsg (fildes, ctlptr, dataptr, flagsp)
int *flagsp;
{
INLINE_SYSCALL_RETURN (getpmsg, 5, int, fildes, ctlptr, dataptr,
- NULL, flagsp)
+ NULL, flagsp);
}
#else
# include <streams/getmsg.c>
diff --git a/sysdeps/unix/sysv/linux/i386/lockf64.c b/sysdeps/unix/sysv/linux/i386/lockf64.c
index b93c633..d203086 100644
--- a/sysdeps/unix/sysv/linux/i386/lockf64.c
+++ b/sysdeps/unix/sysv/linux/i386/lockf64.c
@@ -45,10 +45,10 @@ lockf64 (int fd, int cmd, off64_t len64)
INTERNAL_SYSCALL_DECL (err);
result = INTERNAL_SYSCALL (fcntl64, err, 3, fd, F_GETLK64, &fl64);
if (__glibc_unlikely (INTERNAL_SYSCALL_ERROR_P (result, )))
- INLINE_SYSCALL_ERROR_RETURN (result, int, )
+ INLINE_SYSCALL_ERROR_RETURN (result, int, );
if (fl64.l_type == F_UNLCK || fl64.l_pid == __getpid ())
return 0;
- INLINE_SYSCALL_ERROR_RETURN (-EACCES, int, )
+ INLINE_SYSCALL_ERROR_RETURN (-EACCES, int, );
case F_ULOCK:
fl64.l_type = F_UNLCK;
cmd64 = F_SETLK64;
@@ -63,7 +63,7 @@ lockf64 (int fd, int cmd, off64_t len64)
break;
default:
- INLINE_SYSCALL_ERROR_RETURN (-EINVAL, int, )
+ INLINE_SYSCALL_ERROR_RETURN (-EINVAL, int, );
}
- INLINE_SYSCALL_RETURN (fcntl64, 3, int, fd, cmd64, &fl64)
+ INLINE_SYSCALL_RETURN (fcntl64, 3, int, fd, cmd64, &fl64);
}
diff --git a/sysdeps/unix/sysv/linux/i386/lxstat.c b/sysdeps/unix/sysv/linux/i386/lxstat.c
index 65be113..778c939 100644
--- a/sysdeps/unix/sysv/linux/i386/lxstat.c
+++ b/sysdeps/unix/sysv/linux/i386/lxstat.c
@@ -39,7 +39,7 @@ __lxstat (int vers, const char *name, struct stat *buf)
if (vers == _STAT_VER_KERNEL)
INLINE_SYSCALL_RETURN (lstat, 2, int, name,
- (struct kernel_stat *) buf)
+ (struct kernel_stat *) buf);
{
struct stat64 buf64;
@@ -47,7 +47,7 @@ __lxstat (int vers, const char *name, struct stat *buf)
INTERNAL_SYSCALL_DECL (err);
result = INTERNAL_SYSCALL (lstat64, err, 2, name, &buf64);
if (__glibc_unlikely (INTERNAL_SYSCALL_ERROR_P (result, )))
- INLINE_SYSCALL_ERROR_RETURN (result, int, )
+ INLINE_SYSCALL_ERROR_RETURN (result, int, );
else
return __xstat32_conv (vers, &buf64, buf);
}
diff --git a/sysdeps/unix/sysv/linux/i386/msgctl.c b/sysdeps/unix/sysv/linux/i386/msgctl.c
index 3bd9603..28beefb 100644
--- a/sysdeps/unix/sysv/linux/i386/msgctl.c
+++ b/sysdeps/unix/sysv/linux/i386/msgctl.c
@@ -55,7 +55,7 @@ int
attribute_compat_text_section
__old_msgctl (int msqid, int cmd, struct __old_msqid_ds *buf)
{
- INLINE_SYSCALL_RETURN (ipc, 5, int, IPCOP_msgctl, msqid, cmd, 0, buf)
+ INLINE_SYSCALL_RETURN (ipc, 5, int, IPCOP_msgctl, msqid, cmd, 0, buf);
}
compat_symbol (libc, __old_msgctl, msgctl, GLIBC_2_0);
#endif
@@ -64,7 +64,7 @@ int
__new_msgctl (int msqid, int cmd, struct msqid_ds *buf)
{
INLINE_SYSCALL_RETURN (ipc, 5, int, IPCOP_msgctl, msqid,
- cmd | __IPC_64, 0, buf)
+ cmd | __IPC_64, 0, buf);
}
versioned_symbol (libc, __new_msgctl, msgctl, GLIBC_2_2);
diff --git a/sysdeps/unix/sysv/linux/i386/putmsg.c b/sysdeps/unix/sysv/linux/i386/putmsg.c
index 9e6cf98..228011a 100644
--- a/sysdeps/unix/sysv/linux/i386/putmsg.c
+++ b/sysdeps/unix/sysv/linux/i386/putmsg.c
@@ -31,7 +31,7 @@ putmsg (fildes, ctlptr, dataptr, flags)
int flags;
{
INLINE_SYSCALL_RETURN (putpmsg, 5, int, fildes, ctlptr, dataptr, -1,
- flags)
+ flags);
}
#else
# include <streams/putmsg.c>
diff --git a/sysdeps/unix/sysv/linux/i386/semctl.c b/sysdeps/unix/sysv/linux/i386/semctl.c
index 3bf4a4d..5220f71 100644
--- a/sysdeps/unix/sysv/linux/i386/semctl.c
+++ b/sysdeps/unix/sysv/linux/i386/semctl.c
@@ -72,7 +72,7 @@ __old_semctl (int semid, int semnum, int cmd, ...)
va_end (ap);
INLINE_SYSCALL_RETURN (ipc, 5, int, IPCOP_semctl, semid, semnum, cmd,
- &arg)
+ &arg);
}
compat_symbol (libc, __old_semctl, semctl, GLIBC_2_0);
#endif
@@ -91,7 +91,7 @@ __new_semctl (int semid, int semnum, int cmd, ...)
va_end (ap);
INLINE_SYSCALL_RETURN (ipc, 5, int, IPCOP_semctl, semid, semnum,
- cmd | __IPC_64, &arg)
+ cmd | __IPC_64, &arg);
}
versioned_symbol (libc, __new_semctl, semctl, GLIBC_2_2);
diff --git a/sysdeps/unix/sysv/linux/i386/setegid.c b/sysdeps/unix/sysv/linux/i386/setegid.c
index f223b0c..f510ee6 100644
--- a/sysdeps/unix/sysv/linux/i386/setegid.c
+++ b/sysdeps/unix/sysv/linux/i386/setegid.c
@@ -23,7 +23,7 @@ int
setegid (gid_t gid)
{
if (gid == (gid_t) ~0)
- INLINE_SYSCALL_ERROR_RETURN (-EINVAL, int, )
- INLINE_SYSCALL_RETURN (setresgid32, 3, int, -1, gid, -1)
+ INLINE_SYSCALL_ERROR_RETURN (-EINVAL, int, );
+ INLINE_SYSCALL_RETURN (setresgid32, 3, int, -1, gid, -1);
}
libc_hidden_def (setegid)
diff --git a/sysdeps/unix/sysv/linux/i386/seteuid.c b/sysdeps/unix/sysv/linux/i386/seteuid.c
index 88eac78..dbefac7 100644
--- a/sysdeps/unix/sysv/linux/i386/seteuid.c
+++ b/sysdeps/unix/sysv/linux/i386/seteuid.c
@@ -23,7 +23,7 @@ int
seteuid (uid_t uid)
{
if (uid == (uid_t) ~0)
- INLINE_SYSCALL_ERROR_RETURN (-EINVAL, int, )
- INLINE_SYSCALL_RETURN (setresuid32, 3, int, -1, uid, -1)
+ INLINE_SYSCALL_ERROR_RETURN (-EINVAL, int, );
+ INLINE_SYSCALL_RETURN (setresuid32, 3, int, -1, uid, -1);
}
libc_hidden_def (seteuid)
diff --git a/sysdeps/unix/sysv/linux/i386/shmctl.c b/sysdeps/unix/sysv/linux/i386/shmctl.c
index 2ae6e76..6794335 100644
--- a/sysdeps/unix/sysv/linux/i386/shmctl.c
+++ b/sysdeps/unix/sysv/linux/i386/shmctl.c
@@ -62,7 +62,7 @@ int
attribute_compat_text_section
__old_shmctl (int shmid, int cmd, struct __old_shmid_ds *buf)
{
- INLINE_SYSCALL_RETURN (ipc, 5, int, IPCOP_shmctl, shmid, cmd, 0, buf)
+ INLINE_SYSCALL_RETURN (ipc, 5, int, IPCOP_shmctl, shmid, cmd, 0, buf);
}
compat_symbol (libc, __old_shmctl, shmctl, GLIBC_2_0);
#endif
@@ -71,7 +71,7 @@ int
__new_shmctl (int shmid, int cmd, struct shmid_ds *buf)
{
INLINE_SYSCALL_RETURN (ipc, 5, int, IPCOP_shmctl, shmid,
- cmd | __IPC_64, 0, buf)
+ cmd | __IPC_64, 0, buf);
}
versioned_symbol (libc, __new_shmctl, shmctl, GLIBC_2_2);
diff --git a/sysdeps/unix/sysv/linux/i386/sigaction.c b/sysdeps/unix/sysv/linux/i386/sigaction.c
index cfc37aa..7e830cd 100644
--- a/sysdeps/unix/sysv/linux/i386/sigaction.c
+++ b/sysdeps/unix/sysv/linux/i386/sigaction.c
@@ -74,7 +74,7 @@ __libc_sigaction (int sig, const struct sigaction *act, struct sigaction *oact)
sig, act ? &kact : NULL,
oact ? &koact : NULL, _NSIG / 8);
if (__glibc_unlikely (INTERNAL_SYSCALL_ERROR_P (result, )))
- INLINE_SYSCALL_ERROR_RETURN (result, int, )
+ INLINE_SYSCALL_ERROR_RETURN (result, int, );
else if (oact && result >= 0)
{
oact->sa_handler = koact.k_sa_handler;
diff --git a/sysdeps/unix/sysv/linux/i386/sysdep.h b/sysdeps/unix/sysv/linux/i386/sysdep.h
index 5c87165..b43e0f7 100644
--- a/sysdeps/unix/sysv/linux/i386/sysdep.h
+++ b/sysdeps/unix/sysv/linux/i386/sysdep.h
@@ -285,17 +285,23 @@ struct libc_do_syscall_args
call and return. */
#undef INLINE_SYSCALL_RETURN
#define INLINE_SYSCALL_RETURN(name, nr, type, args...) \
- { \
- unsigned int resultvar = INTERNAL_SYSCALL (name, , nr, args); \
- if (__glibc_unlikely (INTERNAL_SYSCALL_ERROR_P (resultvar, ))) \
- INLINE_SYSCALL_ERROR_RETURN (resultvar, type, ) \
- return (type) resultvar; \
- }
+ do \
+ { \
+ unsigned int resultvar = INTERNAL_SYSCALL (name, , nr, args); \
+ if (__glibc_unlikely (INTERNAL_SYSCALL_ERROR_P (resultvar, ))) \
+ INLINE_SYSCALL_ERROR_RETURN (resultvar, type, ); \
+ return (type) resultvar; \
+ } \
+ while (0)
/* Define a macro to return for a system call error. */
#undef INLINE_SYSCALL_ERROR_RETURN
#define INLINE_SYSCALL_ERROR_RETURN(resultvar, type, value) \
- return (type) __syscall_error (resultvar);
+ do \
+ { \
+ return (type) __syscall_error (resultvar); \
+ } \
+ while (0)
/* List of system calls which are supported as vsyscalls. */
# define HAVE_CLOCK_GETTIME_VSYSCALL 1
diff --git a/sysdeps/unix/sysv/linux/i386/xstat.c b/sysdeps/unix/sysv/linux/i386/xstat.c
index d84c992..22a949b 100644
--- a/sysdeps/unix/sysv/linux/i386/xstat.c
+++ b/sysdeps/unix/sysv/linux/i386/xstat.c
@@ -38,7 +38,8 @@ __xstat (int vers, const char *name, struct stat *buf)
int result;
if (vers == _STAT_VER_KERNEL)
- INLINE_SYSCALL_RETURN (stat, 2, int, name, (struct kernel_stat *) buf)
+ INLINE_SYSCALL_RETURN (stat, 2, int, name,
+ (struct kernel_stat *) buf);
{
struct stat64 buf64;
@@ -46,7 +47,7 @@ __xstat (int vers, const char *name, struct stat *buf)
INTERNAL_SYSCALL_DECL (err);
result = INTERNAL_SYSCALL (stat64, err, 2, name, &buf64);
if (__glibc_unlikely (INTERNAL_SYSCALL_ERROR_P (result, )))
- INLINE_SYSCALL_ERROR_RETURN (result, int, )
+ INLINE_SYSCALL_ERROR_RETURN (result, int, );
else
return __xstat32_conv (vers, &buf64, buf);
}
http://sourceware.org/git/gitweb.cgi?p=glibc.git;a=commitdiff;h=9e642151a5f0f0a990c3851edc1073aeac9619e1
commit 9e642151a5f0f0a990c3851edc1073aeac9619e1
Author: H.J. Lu <hjl.tools@gmail.com>
Date: Fri Aug 14 07:11:52 2015 -0700
Fix i386 mmap
diff --git a/sysdeps/unix/sysv/linux/i386/mmap.c b/sysdeps/unix/sysv/linux/i386/mmap.c
index c74e0a2..2839ac3 100644
--- a/sysdeps/unix/sysv/linux/i386/mmap.c
+++ b/sysdeps/unix/sysv/linux/i386/mmap.c
@@ -28,10 +28,10 @@ __ptr_t
__mmap (__ptr_t addr, size_t len, int prot, int flags, int fd, off_t offset)
{
if (offset & ((1 << MMAP_PAGE_SHIFT) - 1))
- INLINE_SYSCALL_ERROR_RETURN (-EINVAL, __ptr_t, )
+ INLINE_SYSCALL_ERROR_RETURN (-EINVAL, __ptr_t, );
INLINE_SYSCALL_RETURN (mmap2, 6, __ptr_t, addr, len, prot, flags, fd,
- offset >> MMAP_PAGE_SHIFT)
+ offset >> MMAP_PAGE_SHIFT);
}
weak_alias (__mmap, mmap)
http://sourceware.org/git/gitweb.cgi?p=glibc.git;a=commitdiff;h=4981ad32995fc46f2a1db7a525dd4019ca7a8677
commit 4981ad32995fc46f2a1db7a525dd4019ca7a8677
Author: H.J. Lu <hjl.tools@gmail.com>
Date: Thu Aug 13 15:37:50 2015 -0700
Compile sched_getaffinity.c with -fno-builtin-memset
Since sched_getaffinity.c calls memset which may not be inlined, we
should compile it with -fno-builtin-memset so that the internal hidden
memset is called without PLT.
* sysdeps/unix/sysv/linux/Makefile (CFLAGS-sched_getaffinity.c):
New. Set to -fno-builtin-memset.
diff --git a/sysdeps/unix/sysv/linux/Makefile b/sysdeps/unix/sysv/linux/Makefile
index bfbabd4..368f57b 100644
--- a/sysdeps/unix/sysv/linux/Makefile
+++ b/sysdeps/unix/sysv/linux/Makefile
@@ -144,6 +144,8 @@ tests += tst-getcpu
CFLAGS-fork.c = $(libio-mtsafe)
CFLAGS-getpid.o = -fomit-frame-pointer
CFLAGS-getpid.os = -fomit-frame-pointer
+# Use the internal hidden memset.
+CFLAGS-sched_getaffinity.c = -fno-builtin-memset
endif
ifeq ($(subdir),inet)
http://sourceware.org/git/gitweb.cgi?p=glibc.git;a=commitdiff;h=083c5b79c723c94f7d0f050dcfc5c558cab82825
commit 083c5b79c723c94f7d0f050dcfc5c558cab82825
Author: H.J. Lu <hjl.tools@gmail.com>
Date: Thu Aug 13 15:06:59 2015 -0700
Call __setcontext with HIDDEN_JUMPTARGET
i386 __makecontext should call __setcontext with HIDDEN_JUMPTARGET.
[BZ #18822]
* sysdeps/unix/sysv/linux/i386/makecontext.S (__makecontext):
Don't load %ebx when calling __setcontext. Call __setcontext
with HIDDEN_JUMPTARGET.
* sysdeps/unix/sysv/linux/i386/setcontext.S (__setcontext): Add
libc_hidden_def.
diff --git a/sysdeps/unix/sysv/linux/i386/makecontext.S b/sysdeps/unix/sysv/linux/i386/makecontext.S
index bcf8de6..fd1abf8 100644
--- a/sysdeps/unix/sysv/linux/i386/makecontext.S
+++ b/sysdeps/unix/sysv/linux/i386/makecontext.S
@@ -102,15 +102,10 @@ L(exitcode):
parameters (see above). */
leal (%esp,%ebx,4), %esp
-#ifdef PIC
- call 1f
-1: popl %ebx
- addl $_GLOBAL_OFFSET_TABLE_+[.-1b], %ebx
-#endif
cmpl $0, (%esp) /* Check the next context. */
je 2f /* If it is zero exit. */
- call JUMPTARGET(__setcontext)
+ call HIDDEN_JUMPTARGET(__setcontext)
/* If this returns (which can happen if the syscall fails) we'll
exit the program with the return error value (-1). */
diff --git a/sysdeps/unix/sysv/linux/i386/setcontext.S b/sysdeps/unix/sysv/linux/i386/setcontext.S
index 13609b0..75b4447 100644
--- a/sysdeps/unix/sysv/linux/i386/setcontext.S
+++ b/sysdeps/unix/sysv/linux/i386/setcontext.S
@@ -91,5 +91,6 @@ ENTRY(__setcontext)
ret
PSEUDO_END(__setcontext)
+libc_hidden_def (__setcontext)
weak_alias (__setcontext, setcontext)
http://sourceware.org/git/gitweb.cgi?p=glibc.git;a=commitdiff;h=8a7540af90c35dedfbfaff1fdd4bfbfc75b51e13
commit 8a7540af90c35dedfbfaff1fdd4bfbfc75b51e13
Author: H.J. Lu <hjl.tools@gmail.com>
Date: Thu Aug 13 15:02:39 2015 -0700
Mark __xstatXX_conv as hidden
__xstat_conv, __xstat64_conv and __xstat32_conv are internal to glibc.
They should be marked as hidden so that they can't be called without
PLT.
[BZ #18822]
* sysdeps/unix/sysv/linux/xstatconv.h (__xstat_conv): Add
attribute_hidden.
(__xstat64_conv): Likewise.
(__xstat32_conv): Likewise.
diff --git a/sysdeps/unix/sysv/linux/xstatconv.h b/sysdeps/unix/sysv/linux/xstatconv.h
index 229e24c..d21d9a0 100644
--- a/sysdeps/unix/sysv/linux/xstatconv.h
+++ b/sysdeps/unix/sysv/linux/xstatconv.h
@@ -17,7 +17,10 @@
<http://www.gnu.org/licenses/>. */
#ifndef STAT_IS_KERNEL_STAT
-extern int __xstat_conv (int vers, struct kernel_stat *kbuf, void *ubuf);
-extern int __xstat64_conv (int vers, struct kernel_stat *kbuf, void *ubuf);
+extern int __xstat_conv (int vers, struct kernel_stat *kbuf, void *ubuf)
+ attribute_hidden;
+extern int __xstat64_conv (int vers, struct kernel_stat *kbuf, void *ubuf)
+ attribute_hidden;
#endif
-extern int __xstat32_conv (int vers, struct stat64 *kbuf, struct stat *buf);
+extern int __xstat32_conv (int vers, struct stat64 *kbuf, struct stat *buf)
+ attribute_hidden;
http://sourceware.org/git/gitweb.cgi?p=glibc.git;a=commitdiff;h=7127f30a99c3aa1da1ec27417fecea35763a3186
commit 7127f30a99c3aa1da1ec27417fecea35763a3186
Author: H.J. Lu <hjl.tools@gmail.com>
Date: Wed Aug 12 12:10:06 2015 -0700
i386: Remove syscall assembly codes with 6 arguments
This patch removes i386 assembly implementation for epoll_wait, mmap,
mmap64, semtimeop now that i386 have 6 argument syscall support from
C code and GCC 5 can inline syscalls with 6 argument. We also compile
epoll_pwait.c, mmap.c, mmap64.c and semtimedop.c with -fomit-frame-pointer
since %ebp may be used to pass the 6th argument to syscall.
Fo sysdeps/unix/sysv/linux/i386/mmap.c, with -O2 -march=i686
-mtune=generic, GCC 5.2 now generates:
<__mmap>:
0: sub $0x10,%esp
3: mov 0x28(%esp),%eax
7: mov %ebx,(%esp)
a: mov 0x18(%esp),%ecx
e: mov %esi,0x4(%esp)
12: mov 0x14(%esp),%ebx
16: mov %edi,0x8(%esp)
1a: mov 0x1c(%esp),%edx
1e: test $0xfff,%eax
23: mov 0x20(%esp),%esi
27: mov %ebp,0xc(%esp)
2b: mov 0x24(%esp),%edi
2f: jne 60 <__mmap+0x60>
31: sar $0xc,%eax
34: mov %eax,%ebp
36: mov $0xc0,%eax
3b: call *%gs:0x10
42: cmp $0xfffff000,%eax
47: ja 65 <__mmap+0x65>
49: mov (%esp),%ebx
4c: mov 0x4(%esp),%esi
50: mov 0x8(%esp),%edi
54: mov 0xc(%esp),%ebp
58: add $0x10,%esp
5b: ret
5c: lea 0x0(%esi,%eiz,1),%esi
60: mov $0xffffffea,%eax
65: mov (%esp),%ebx
68: mov 0x4(%esp),%esi
6c: mov 0x8(%esp),%edi
70: mov 0xc(%esp),%ebp
74: add $0x10,%esp
77: jmp 78 <__mmap+0x78> 78: R_386_PC32 __syscall_error
vs sysdeps/unix/sysv/linux/i386/mmap.S:
<__mmap>:
0: push %ebp
1: push %ebx
2: push %esi
3: push %edi
4: mov 0x14(%esp),%ebx
8: mov 0x18(%esp),%ecx
c: mov 0x1c(%esp),%edx
10: mov 0x20(%esp),%esi
14: mov 0x24(%esp),%edi
18: mov 0x28(%esp),%ebp
1c: test $0xfff,%ebp
22: mov $0xffffffea,%eax
27: jne 38 <__mmap+0x38>
29: shr $0xc,%ebp
2c: mov $0xc0,%eax
31: call *%gs:0x10
38: pop %edi
39: pop %esi
3a: pop %ebx
3b: pop %ebp
3c: cmp $0xfffff000,%eax
41: ja 44 <__mmap+0x44>
43: ret
44: call 45 <__mmap+0x45> 45: R_386_PC32 __x86.get_pc_thunk.cx
49: add $0x2,%ecx 4b: R_386_GOTPC _GLOBAL_OFFSET_TABLE_
4f: mov 0x0(%ecx),%ecx 51: R_386_TLS_GOTIE __libc_errno
55: neg %eax
57: mov %eax,%gs:(%ecx)
5a: or $0xffffffff,%eax
5d: ret
The C version has:
3: mov 0x28(%esp),%eax
...
1e: test $0xfff,%eax
...
31: sar $0xc,%eax
34: mov %eax,%ebp
is due to missing $ebx register constraint for inline asm. We have
to use "r" constraint with
register unsigned int _a6 asm ("ebp") = (unsigned int) (arg6);
and compiler chose %eax for offset (arg6) in
if (offset & ((1 << MMAP_PAGE_SHIFT) - 1))
* sysdeps/unix/sysv/linux/i386/Makefile (CFLAGS-epoll_pwait.c):
Add -fomit-frame-pointer.
(CFLAGS-mmap.c): Likewise.
(CFLAGS-mmap64.c): Likewise.
(CFLAGS-semtimedop.c): Likewise.
* sysdeps/unix/sysv/linux/i386/mmap.c: New file.
* sysdeps/unix/sysv/linux/i386/epoll_pwait.S: Remove file.
* sysdeps/unix/sysv/linux/i386/mmap.S: Likewise.
* sysdeps/unix/sysv/linux/i386/mmap64.S: Likewise.
* sysdeps/unix/sysv/linux/i386/semtimedop.S: Likewise.
diff --git a/sysdeps/unix/sysv/linux/i386/Makefile b/sysdeps/unix/sysv/linux/i386/Makefile
index e10d133..b484217 100644
--- a/sysdeps/unix/sysv/linux/i386/Makefile
+++ b/sysdeps/unix/sysv/linux/i386/Makefile
@@ -3,6 +3,15 @@ default-abi := 32
ifeq ($(subdir),misc)
sysdep_routines += ioperm iopl vm86
+# %ebp may be used to pass the 6th argument to syscall.
+CFLAGS-epoll_pwait.c += -fomit-frame-pointer
+CFLAGS-mmap.c += -fomit-frame-pointer
+CFLAGS-mmap64.c += -fomit-frame-pointer
+endif
+
+ifeq ($(subdir),sysvipc)
+# %ebp may be used to pass the 6th argument to syscall.
+CFLAGS-semtimedop.c += -fomit-frame-pointer
endif
ifeq ($(subdir),elf)
diff --git a/sysdeps/unix/sysv/linux/i386/epoll_pwait.S b/sysdeps/unix/sysv/linux/i386/epoll_pwait.S
deleted file mode 100644
index 65cfb98..0000000
--- a/sysdeps/unix/sysv/linux/i386/epoll_pwait.S
+++ /dev/null
@@ -1,78 +0,0 @@
-/* Copyright (C) 2007-2015 Free Software Foundation, Inc.
- This file is part of the GNU C Library.
-
- The GNU C Library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Lesser General Public
- License as published by the Free Software Foundation; either
- version 2.1 of the License, or (at your option) any later version.
-
- The GNU C Library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Lesser General Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with the GNU C Library; if not, see
- <http://www.gnu.org/licenses/>. */
-
-#include <sysdep.h>
-#define _ERRNO_H
-#include <bits/errno.h>
-#define _SIGNAL_H
-#include <bits/signum.h>
-
-
- .text
-ENTRY (epoll_pwait)
-
-#ifdef __NR_epoll_pwait
-
- /* Save registers. */
- pushl %ebp
- cfi_adjust_cfa_offset (4)
- pushl %ebx
- cfi_adjust_cfa_offset (4)
- pushl %esi
- cfi_adjust_cfa_offset (4)
- pushl %edi
- cfi_adjust_cfa_offset (4)
- cfi_rel_offset (edi, 0)
- cfi_rel_offset (esi, 4)
- cfi_rel_offset (ebx, 8)
- cfi_rel_offset (ebp, 12)
-
- movl 20(%esp), %ebx
- movl 24(%esp), %ecx
- movl 28(%esp), %edx
- movl 32(%esp), %esi
- movl 36(%esp), %edi
- movl $_NSIG/8, %ebp
- movl $__NR_epoll_pwait, %eax
-
- ENTER_KERNEL
-
- /* Restore registers. */
- popl %edi
- cfi_adjust_cfa_offset (-4)
- cfi_restore (edi)
- popl %esi
- cfi_adjust_cfa_offset (-4)
- cfi_restore (esi)
- popl %ebx
- cfi_adjust_cfa_offset (-4)
- cfi_restore (ebx)
- popl %ebp
- cfi_adjust_cfa_offset (-4)
- cfi_restore (ebp)
-
- /* If 0 > %eax > -4096 there was an error. */
- cmpl $-4096, %eax
- ja SYSCALL_ERROR_LABEL
-
- /* Successful; return the syscall's value. */
-#else
- movl $-ENOSYS, %eax
- jmp SYSCALL_ERROR_LABEL
-#endif
- ret
-PSEUDO_END (epoll_pwait)
diff --git a/sysdeps/unix/sysv/linux/i386/mmap.S b/sysdeps/unix/sysv/linux/i386/mmap.S
deleted file mode 100644
index daf807a..0000000
--- a/sysdeps/unix/sysv/linux/i386/mmap.S
+++ /dev/null
@@ -1,79 +0,0 @@
-/* Copyright (C) 1995-2015 Free Software Foundation, Inc.
- This file is part of the GNU C Library.
-
- The GNU C Library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Lesser General Public
- License as published by the Free Software Foundation; either
- version 2.1 of the License, or (at your option) any later version.
-
- The GNU C Library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Lesser General Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with the GNU C Library; if not, see
- <http://www.gnu.org/licenses/>. */
-
-#include <sysdep.h>
-
-#define EINVAL 22
-
- .text
-
-ENTRY (__mmap)
-
- /* Save registers. */
- pushl %ebp
- cfi_adjust_cfa_offset (4)
- pushl %ebx
- cfi_adjust_cfa_offset (4)
- pushl %esi
- cfi_adjust_cfa_offset (4)
- pushl %edi
- cfi_adjust_cfa_offset (4)
-
- movl 20(%esp), %ebx
- cfi_rel_offset (ebx, 8)
- movl 24(%esp), %ecx
- movl 28(%esp), %edx
- movl 32(%esp), %esi
- cfi_rel_offset (esi, 4)
- movl 36(%esp), %edi
- cfi_rel_offset (edi, 0)
- movl 40(%esp), %ebp
- cfi_rel_offset (ebp, 12)
- testl $0xfff, %ebp
- movl $-EINVAL, %eax
- jne L(skip)
- shrl $12, %ebp /* mmap2 takes the offset in pages. */
-
- movl $SYS_ify(mmap2), %eax /* System call number in %eax. */
-
- /* Do the system call trap. */
- ENTER_KERNEL
-L(skip):
- /* Restore registers. */
- popl %edi
- cfi_adjust_cfa_offset (-4)
- cfi_restore (edi)
- popl %esi
- cfi_adjust_cfa_offset (-4)
- cfi_restore (esi)
- popl %ebx
- cfi_adjust_cfa_offset (-4)
- cfi_restore (ebx)
- popl %ebp
- cfi_adjust_cfa_offset (-4)
- cfi_restore (ebp)
-
- /* If 0 > %eax > -4096 there was an error. */
- cmpl $-4096, %eax
- ja SYSCALL_ERROR_LABEL
-
- /* Successful; return the syscall's value. */
- ret
-
-PSEUDO_END (__mmap)
-
-weak_alias (__mmap, mmap)
diff --git a/sysdeps/unix/sysv/linux/i386/mmap.c b/sysdeps/unix/sysv/linux/i386/mmap.c
new file mode 100644
index 0000000..c74e0a2
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/i386/mmap.c
@@ -0,0 +1,37 @@
+/* Copyright (C) 2015 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, see
+ <http://www.gnu.org/licenses/>. */
+
+#include <sys/types.h>
+#include <sys/mman.h>
+#include <errno.h>
+#include <sysdep.h>
+
+#ifndef MMAP_PAGE_SHIFT
+#define MMAP_PAGE_SHIFT 12
+#endif
+
+__ptr_t
+__mmap (__ptr_t addr, size_t len, int prot, int flags, int fd, off_t offset)
+{
+ if (offset & ((1 << MMAP_PAGE_SHIFT) - 1))
+ INLINE_SYSCALL_ERROR_RETURN (-EINVAL, __ptr_t, )
+
+ INLINE_SYSCALL_RETURN (mmap2, 6, __ptr_t, addr, len, prot, flags, fd,
+ offset >> MMAP_PAGE_SHIFT)
+}
+
+weak_alias (__mmap, mmap)
diff --git a/sysdeps/unix/sysv/linux/i386/mmap64.S b/sysdeps/unix/sysv/linux/i386/mmap64.S
deleted file mode 100644
index 3cf6eb9..0000000
--- a/sysdeps/unix/sysv/linux/i386/mmap64.S
+++ /dev/null
@@ -1,116 +0,0 @@
-/* Copyright (C) 1995-2015 Free Software Foundation, Inc.
- This file is part of the GNU C Library.
-
- The GNU C Library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Lesser General Public
- License as published by the Free Software Foundation; either
- version 2.1 of the License, or (at your option) any later version.
-
- The GNU C Library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Lesser General Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with the GNU C Library; if not, see
- <http://www.gnu.org/licenses/>. */
-
-#include <sysdep.h>
-
-#define EINVAL 22
-#define ENOSYS 38
-
-#define SVRSP 16 /* saved register space */
-#define PARMS 4+SVRSP /* space for 4 saved regs */
-#define ADDR PARMS
-#define LEN ADDR+4
-#define PROT LEN+4
-#define FLAGS PROT+4
-#define FD FLAGS+4
-#define OFFLO FD+4
-#define OFFHI OFFLO+4
-
- .text
-ENTRY (__mmap64)
-
- /* Save registers. */
- pushl %ebp
- cfi_adjust_cfa_offset (4)
- pushl %ebx
- cfi_adjust_cfa_offset (4)
- pushl %esi
- cfi_adjust_cfa_offset (4)
- pushl %edi
- cfi_adjust_cfa_offset (4)
-
- movl OFFLO(%esp), %edx
- movl OFFHI(%esp), %ecx
- testl $0xfff, %edx
- jne L(einval)
- shrdl $12, %ecx, %edx /* mmap2 takes the offset in pages. */
- shrl $12, %ecx
- jne L(einval)
- movl %edx, %ebp
- cfi_rel_offset (ebp, 12)
-
- movl ADDR(%esp), %ebx
- cfi_rel_offset (ebx, 8)
- movl LEN(%esp), %ecx
- movl PROT(%esp), %edx
- movl FLAGS(%esp), %esi
- cfi_rel_offset (esi, 4)
- movl FD(%esp), %edi
- cfi_rel_offset (edi, 0)
-
- movl $SYS_ify(mmap2), %eax /* System call number in %eax. */
-
- /* Do the system call trap. */
-L(do_syscall):
- ENTER_KERNEL
-
- /* Restore registers. */
- popl %edi
- cfi_adjust_cfa_offset (-4)
- cfi_restore (edi)
- popl %esi
- cfi_adjust_cfa_offset (-4)
- cfi_restore (esi)
- popl %ebx
- cfi_adjust_cfa_offset (-4)
- cfi_restore (ebx)
- popl %ebp
- cfi_adjust_cfa_offset (-4)
- cfi_restore (ebp)
-
- /* If 0 > %eax > -4096 there was an error. */
- cmpl $-4096, %eax
- ja SYSCALL_ERROR_LABEL
-
- /* Successful; return the syscall's value. */
- ret
-
- cfi_adjust_cfa_offset (16)
- cfi_rel_offset (ebp, 12)
- cfi_rel_offset (ebx, 8)
- cfi_rel_offset (esi, 4)
- cfi_rel_offset (edi, 0)
- /* This means the offset value is too large. */
-L(einval):
- popl %edi
- cfi_adjust_cfa_offset (-4)
- cfi_restore (edi)
- popl %esi
- cfi_adjust_cfa_offset (-4)
- cfi_restore (esi)
- popl %ebx
- cfi_adjust_cfa_offset (-4)
- cfi_restore (ebx)
- popl %ebp
- cfi_adjust_cfa_offset (-4)
- cfi_restore (ebp)
- movl $-EINVAL, %eax
- jmp SYSCALL_ERROR_LABEL
-
-PSEUDO_END (__mmap64)
-
-weak_alias (__mmap64, mmap64)
diff --git a/sysdeps/unix/sysv/linux/i386/semtimedop.S b/sysdeps/unix/sysv/linux/i386/semtimedop.S
deleted file mode 100644
index 80477b7..0000000
--- a/sysdeps/unix/sysv/linux/i386/semtimedop.S
+++ /dev/null
@@ -1,73 +0,0 @@
-/* Copyright (C) 2003-2015 Free Software Foundation, Inc.
- This file is part of the GNU C Library.
- Contributed by Ulrich Drepper <drepper@redhat.com>, 2003.
-
- The GNU C Library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Lesser General Public
- License as published by the Free Software Foundation; either
- version 2.1 of the License, or (at your option) any later version.
-
- The GNU C Library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Lesser General Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with the GNU C Library; if not, see
- <http://www.gnu.org/licenses/>. */
-
-#include <sysdep.h>
-
-#define SYSOP_semtimedop 4
-
-#define SVRSP 12 /* saved register space */
-#define PARMS 4+SVRSP /* space for 3 saved regs */
-#define SEMID PARMS
-#define SOPS SEMID+4
-#define NSOPS SOPS+4
-#define TIMEOUT NSOPS+4
-
- .text
-ENTRY (semtimedop)
-
- pushl %ebp
- cfi_adjust_cfa_offset (4)
- pushl %ebx
- cfi_adjust_cfa_offset (4)
- pushl %edi
- cfi_adjust_cfa_offset (4)
-
- movl $SYSOP_semtimedop, %ebx
- cfi_rel_offset (ebx, 4)
- movl SEMID(%esp), %ecx
- movl NSOPS(%esp), %edx
- movl SOPS(%esp), %edi
- cfi_rel_offset (edi, 0)
- movl TIMEOUT(%esp), %ebp
- cfi_rel_offset (ebp, 8)
- movl $__NR_ipc, %eax
-
- ENTER_KERNEL
-
- /* Restore registers. */
- popl %edi
- cfi_adjust_cfa_offset (-4)
- cfi_restore (edi)
- popl %ebx
- cfi_adjust_cfa_offset (-4)
- cfi_restore (ebx)
- popl %ebp
- cfi_adjust_cfa_offset (-4)
- cfi_restore (ebp)
-
- /* If 0 > %eax > -4096 there was an error. */
- cmpl $-4096, %eax
- ja SYSCALL_ERROR_LABEL
-
- /* Successful; return the syscall's value. */
- ret
-
-#ifdef PIC
- .align 4
-#endif
-PSEUDO_END (semtimedop)
http://sourceware.org/git/gitweb.cgi?p=glibc.git;a=commitdiff;h=533c777232e5af3def5830010fe6bf84e27b521b
commit 533c777232e5af3def5830010fe6bf84e27b521b
Author: H.J. Lu <hjl.tools@gmail.com>
Date: Wed Aug 12 09:13:29 2015 -0700
Optimize i386 syscall inlining
Define INLINE_SYSCALL_RETURN and INLINE_SYSCALL_ERROR_RETURN so
that i386 can optimize setting errno by branching to the internal
__syscall_error without PLT.
Since GCC 5 and above can properly spill %ebx when needed, we can inline
syscalls with 6 arguments if GCC 5 or above is used to compile glibc.
This patch rewrites INTERNAL_SYSCALL macros and skips __libc_do_syscall
for GCC 5.
For sysdeps/unix/sysv/linux/i386/brk.c, with -O2 -march=i686
-mtune=generic, GCC 5.2 now generates:
<__brk>:
0: push %ebx
1: mov $0x2d,%eax
6: mov 0x8(%esp),%ebx
a: call b <__brk+0xb> b: R_386_PC32 __x86.get_pc_thunk.dx
f: add $0x2,%edx 11: R_386_GOTPC _GLOBAL_OFFSET_TABLE_
15: call *%gs:0x10
1c: mov 0x0(%edx),%edx 1e: R_386_GOT32 __curbrk
22: cmp %eax,%ebx
24: mov %eax,(%edx)
26: ja 30 <__brk+0x30>
28: xor %eax,%eax
2a: pop %ebx
2b: ret
instead of
<__brk>:
0: push %ebx
1: mov 0x8(%esp),%ecx
5: call 6 <__brk+0x6> 6: R_386_PC32 __x86.get_pc_thunk.bx
a: add $0x2,%ebx c: R_386_GOTPC _GLOBAL_OFFSET_TABLE_
10: xchg %ecx,%ebx
12: mov $0x2d,%eax
17: call *%gs:0x10
1e: xchg %ecx,%ebx
20: mov %eax,%edx
22: mov 0x0(%ebx),%eax 24: R_386_GOT32 __curbrk
28: mov %edx,(%eax)
2a: xor %eax,%eax
2c: cmp %edx,%ecx
2e: ja 38 <__brk+0x38>
30: pop %ebx
31: ret
The new one is shorter by 2 instructions.
* sysdeps/unix/sysv/linux/i386/Makefile [$(subdir) == csu]
(sysdep-dl-routines): Add sysdep.
[$(subdir) == nptl] (libpthread-routines): Likewise.
[$(subdir) == rt] (librt-routines): Likewise.
* sysdeps/unix/sysv/linux/i386/brk.c (__brk): Add
INTERNAL_SYSCALL_DECL. Use INLINE_SYSCALL_ERROR_RETURN.
* sysdeps/unix/sysv/linux/i386/clone.S (__clone): Don't check
PIC when branching to SYSCALL_ERROR_LABEL.
* sysdeps/unix/sysv/linux/i386/fcntl.c (__fcntl_nocancel): Use
INLINE_SYSCALL_RETURN and INLINE_SYSCALL_ERROR_RETURN.
(__libc_fcntl): Likewise.
* sysdeps/unix/sysv/linux/i386/fxstat.c (__fxstat): Likewise.
* sysdeps/unix/sysv/linux/i386/fxstatat.c (__fxstatat):
Likewise.
* sysdeps/unix/sysv/linux/i386/getmsg.c (getmsg): Likewise.
* sysdeps/unix/sysv/linux/i386/lockf64.c (lockf64): Likewise.
* sysdeps/unix/sysv/linux/i386/lxstat.c (__lxstat): Likewise.
* sysdeps/unix/sysv/linux/i386/msgctl.c (__old_msgctl):
Likewise.
(__new_msgctl): Likewise.
* sysdeps/unix/sysv/linux/i386/putmsg.c (putmsg): Likewise.
* sysdeps/unix/sysv/linux/i386/semctl.c (__old_semctl):
Likewise.
(__new_semctl): Likewise.
* sysdeps/unix/sysv/linux/i386/setegid.c (setegid): Likewise.
* sysdeps/unix/sysv/linux/i386/seteuid.c (seteuid): Likewise.
* sysdeps/unix/sysv/linux/i386/shmctl.c (__old_shmctl):
Likewise.
(__new_shmctl): Likewise.
* sysdeps/unix/sysv/linux/i386/sigaction.c (__libc_sigaction):
Likewise.
* sysdeps/unix/sysv/linux/i386/xstat.c (__xstat): Likewise.
* sysdeps/unix/sysv/linux/i386/libc-do-syscall.S
(__libc_do_syscall): Defined only if !__GNUC_PREREQ (5,0).
* sysdeps/unix/sysv/linux/i386/sysdep.S: Removed.
* sysdeps/unix/sysv/linux/i386/sysdep.c: New file.
* sysdeps/unix/sysv/linux/i386/sysdep.h: Define assembler macros
only if !__GNUC_PREREQ (5,0).
(SYSCALL_ERROR_LABEL): Changed to __syscall_error.
(SYSCALL_ERROR_HANDLER): Changed to empty.
(SYSCALL_ERROR_ERRNO): Removed.
(SYSCALL_ERROR_HANDLER_TLS_STORE): Likewise.
(__syscall_error): New prototype.
(INLINE_SYSCALL_RETURN): New.
(INLINE_SYSCALL_ERROR_RETURN): Likewise.
(LOADREGS_0): Likewise.
(ASMARGS_0): Likewise.
(LOADREGS_1): Likewise.
(ASMARGS_1): Likewise.
(LOADREGS_2): Likewise.
(ASMARGS_2): Likewise.
(LOADREGS_3): Likewise.
(ASMARGS_3): Likewise.
(LOADREGS_4): Likewise.
(ASMARGS_4): Likewise.
(LOADREGS_5): Likewise.
(ASMARGS_5): Likewise.
(LOADREGS_6): Likewise.
(ASMARGS_6): Likewise.
(INTERNAL_SYSCALL_MAIN_6): Optimize for GCC 5.
(INTERNAL_SYSCALL_MAIN_INLINE): Likewise.
(INTERNAL_SYSCALL_NCS): Likewise.
diff --git a/sysdeps/unix/sysv/linux/i386/Makefile b/sysdeps/unix/sysv/linux/i386/Makefile
index 80da593..e10d133 100644
--- a/sysdeps/unix/sysv/linux/i386/Makefile
+++ b/sysdeps/unix/sysv/linux/i386/Makefile
@@ -27,3 +27,17 @@ endif
ifeq ($(subdir),stdlib)
gen-as-const-headers += ucontext_i.sym
endif
+
+ifeq ($(subdir),csu)
+sysdep-dl-routines += sysdep
+endif
+
+ifeq ($(subdir),nptl)
+# pull in __syscall_error routine
+libpthread-routines += sysdep
+endif
+
+ifeq ($(subdir),rt)
+# pull in __syscall_error routine
+librt-routines += sysdep
+endif
diff --git a/sysdeps/unix/sysv/linux/i386/brk.c b/sysdeps/unix/sysv/linux/i386/brk.c
index 5b9a0ce..98c28ff 100644
--- a/sysdeps/unix/sysv/linux/i386/brk.c
+++ b/sysdeps/unix/sysv/linux/i386/brk.c
@@ -31,19 +31,11 @@ weak_alias (__curbrk, ___brk_addr)
int
__brk (void *addr)
{
- void *newbrk;
-
INTERNAL_SYSCALL_DECL (err);
- newbrk = (void *) INTERNAL_SYSCALL (brk, err, 1, addr);
-
+ void *newbrk = (void *) INTERNAL_SYSCALL (brk, err, 1, addr);
__curbrk = newbrk;
-
if (newbrk < addr)
- {
- __set_errno (ENOMEM);
- return -1;
- }
-
+ INLINE_SYSCALL_ERROR_RETURN (-ENOMEM, int, )
return 0;
}
weak_alias (__brk, brk)
diff --git a/sysdeps/unix/sysv/linux/i386/clone.S b/sysdeps/unix/sysv/linux/i386/clone.S
index 243dbfe..2aafb3a 100644
--- a/sysdeps/unix/sysv/linux/i386/clone.S
+++ b/sysdeps/unix/sysv/linux/i386/clone.S
@@ -47,19 +47,11 @@ ENTRY (__clone)
/* Sanity check arguments. */
movl $-EINVAL,%eax
movl FUNC(%esp),%ecx /* no NULL function pointers */
-#ifdef PIC
- jecxz SYSCALL_ERROR_LABEL
-#else
testl %ecx,%ecx
jz SYSCALL_ERROR_LABEL
-#endif
movl STACK(%esp),%ecx /* no NULL stack pointers */
-#ifdef PIC
- jecxz SYSCALL_ERROR_LABEL
-#else
testl %ecx,%ecx
jz SYSCALL_ERROR_LABEL
-#endif
/* Insert the argument onto the new stack. Make sure the new
thread is started with an alignment of (mod 16). */
diff --git a/sysdeps/unix/sysv/linux/i386/fcntl.c b/sysdeps/unix/sysv/linux/i386/fcntl.c
index 56f4bd1..2744aaa 100644
--- a/sysdeps/unix/sysv/linux/i386/fcntl.c
+++ b/sysdeps/unix/sysv/linux/i386/fcntl.c
@@ -34,7 +34,7 @@ __fcntl_nocancel (int fd, int cmd, ...)
arg = va_arg (ap, void *);
va_end (ap);
- return INLINE_SYSCALL (fcntl64, 3, fd, cmd, arg);
+ INLINE_SYSCALL_RETURN (fcntl64, 3, int, fd, cmd, arg)
}
#endif /* NO_CANCELLATION */
@@ -50,7 +50,7 @@ __libc_fcntl (int fd, int cmd, ...)
va_end (ap);
if ((cmd != F_SETLKW) && (cmd != F_SETLKW64))
- return INLINE_SYSCALL (fcntl64, 3, fd, cmd, arg);
+ INLINE_SYSCALL_RETURN (fcntl64, 3, int, fd, cmd, arg)
return SYSCALL_CANCEL (fcntl64, fd, cmd, arg);
}
diff --git a/sysdeps/unix/sysv/linux/i386/fxstat.c b/sysdeps/unix/sysv/linux/i386/fxstat.c
index 2f7a8fe..a471644 100644
--- a/sysdeps/unix/sysv/linux/i386/fxstat.c
+++ b/sysdeps/unix/sysv/linux/i386/fxstat.c
@@ -37,15 +37,17 @@ __fxstat (int vers, int fd, struct stat *buf)
int result;
if (vers == _STAT_VER_KERNEL)
- return INLINE_SYSCALL (fstat, 2, fd, (struct kernel_stat *) buf);
+ INLINE_SYSCALL_RETURN (fstat, 2, int, fd, (struct kernel_stat *) buf)
{
struct stat64 buf64;
- result = INLINE_SYSCALL (fstat64, 2, fd, &buf64);
- if (result == 0)
- result = __xstat32_conv (vers, &buf64, buf);
- return result;
+ INTERNAL_SYSCALL_DECL (err);
+ result = INTERNAL_SYSCALL (fstat64, err, 2, fd, &buf64);
+ if (__glibc_unlikely (INTERNAL_SYSCALL_ERROR_P (result, )))
+ INLINE_SYSCALL_ERROR_RETURN (result, int, )
+ else
+ return __xstat32_conv (vers, &buf64, buf);
}
}
diff --git a/sysdeps/unix/sysv/linux/i386/fxstatat.c b/sysdeps/unix/sysv/linux/i386/fxstatat.c
index 6f3c251..ed0ed65 100644
--- a/sysdeps/unix/sysv/linux/i386/fxstatat.c
+++ b/sysdeps/unix/sysv/linux/i386/fxstatat.c
@@ -42,13 +42,10 @@ __fxstatat (int vers, int fd, const char *file, struct stat *st, int flag)
struct stat64 st64;
result = INTERNAL_SYSCALL (fstatat64, err, 4, fd, file, &st64, flag);
- if (!__builtin_expect (INTERNAL_SYSCALL_ERROR_P (result, err), 1))
- return __xstat32_conv (vers, &st64, st);
+ if (__glibc_unlikely (INTERNAL_SYSCALL_ERROR_P (result, )))
+ INLINE_SYSCALL_ERROR_RETURN (result, int, )
else
- {
- __set_errno (INTERNAL_SYSCALL_ERRNO (result, err));
- return -1;
- }
+ return __xstat32_conv (vers, &st64, st);
}
libc_hidden_def (__fxstatat)
#ifdef XSTAT_IS_XSTAT64
diff --git a/sysdeps/unix/sysv/linux/i386/getmsg.c b/sysdeps/unix/sysv/linux/i386/getmsg.c
index 255b867..c192b68 100644
--- a/sysdeps/unix/sysv/linux/i386/getmsg.c
+++ b/sysdeps/unix/sysv/linux/i386/getmsg.c
@@ -30,7 +30,8 @@ getmsg (fildes, ctlptr, dataptr, flagsp)
struct strbuf *dataptr;
int *flagsp;
{
- return INLINE_SYSCALL (getpmsg, 5, fildes, ctlptr, dataptr, NULL, flagsp);
+ INLINE_SYSCALL_RETURN (getpmsg, 5, int, fildes, ctlptr, dataptr,
+ NULL, flagsp)
}
#else
# include <streams/getmsg.c>
diff --git a/sysdeps/unix/sysv/linux/i386/libc-do-syscall.S b/sysdeps/unix/sysv/linux/i386/libc-do-syscall.S
index af5c6f0..cdef3d5 100644
--- a/sysdeps/unix/sysv/linux/i386/libc-do-syscall.S
+++ b/sysdeps/unix/sysv/linux/i386/libc-do-syscall.S
@@ -18,6 +18,8 @@
#include <sysdep.h>
+#if !__GNUC_PREREQ (5,0)
+
/* %eax, %ecx, %edx and %esi contain the values expected by the kernel.
%edi points to a structure with the values of %ebx, %edi and %ebp. */
@@ -48,3 +50,4 @@ ENTRY (__libc_do_syscall)
cfi_restore (ebx)
ret
END (__libc_do_syscall)
+#endif
diff --git a/sysdeps/unix/sysv/linux/i386/lockf64.c b/sysdeps/unix/sysv/linux/i386/lockf64.c
index 61fcf22..b93c633 100644
--- a/sysdeps/unix/sysv/linux/i386/lockf64.c
+++ b/sysdeps/unix/sysv/linux/i386/lockf64.c
@@ -29,6 +29,7 @@ lockf64 (int fd, int cmd, off64_t len64)
{
struct flock64 fl64;
int cmd64;
+ int result;
memset ((char *) &fl64, '\0', sizeof (fl64));
fl64.l_whence = SEEK_CUR;
@@ -41,12 +42,13 @@ lockf64 (int fd, int cmd, off64_t len64)
/* Test the lock: return 0 if FD is unlocked or locked by this process;
return -1, set errno to EACCES, if another process holds the lock. */
fl64.l_type = F_RDLCK;
- if (INLINE_SYSCALL (fcntl64, 3, fd, F_GETLK64, &fl64) < 0)
- return -1;
+ INTERNAL_SYSCALL_DECL (err);
+ result = INTERNAL_SYSCALL (fcntl64, err, 3, fd, F_GETLK64, &fl64);
+ if (__glibc_unlikely (INTERNAL_SYSCALL_ERROR_P (result, )))
+ INLINE_SYSCALL_ERROR_RETURN (result, int, )
if (fl64.l_type == F_UNLCK || fl64.l_pid == __getpid ())
return 0;
- __set_errno (EACCES);
- return -1;
+ INLINE_SYSCALL_ERROR_RETURN (-EACCES, int, )
case F_ULOCK:
fl64.l_type = F_UNLCK;
cmd64 = F_SETLK64;
@@ -61,8 +63,7 @@ lockf64 (int fd, int cmd, off64_t len64)
break;
default:
- __set_errno (EINVAL);
- return -1;
+ INLINE_SYSCALL_ERROR_RETURN (-EINVAL, int, )
}
- return INLINE_SYSCALL (fcntl64, 3, fd, cmd64, &fl64);
+ INLINE_SYSCALL_RETURN (fcntl64, 3, int, fd, cmd64, &fl64)
}
diff --git a/sysdeps/unix/sysv/linux/i386/lxstat.c b/sysdeps/unix/sysv/linux/i386/lxstat.c
index 0891127..65be113 100644
--- a/sysdeps/unix/sysv/linux/i386/lxstat.c
+++ b/sysdeps/unix/sysv/linux/i386/lxstat.c
@@ -38,15 +38,18 @@ __lxstat (int vers, const char *name, struct stat *buf)
int result;
if (vers == _STAT_VER_KERNEL)
- return INLINE_SYSCALL (lstat, 2, name, (struct kernel_stat *) buf);
+ INLINE_SYSCALL_RETURN (lstat, 2, int, name,
+ (struct kernel_stat *) buf)
{
struct stat64 buf64;
- result = INLINE_SYSCALL (lstat64, 2, name, &buf64);
- if (result == 0)
- result = __xstat32_conv (vers, &buf64, buf);
- return result;
+ INTERNAL_SYSCALL_DECL (err);
+ result = INTERNAL_SYSCALL (lstat64, err, 2, name, &buf64);
+ if (__glibc_unlikely (INTERNAL_SYSCALL_ERROR_P (result, )))
+ INLINE_SYSCALL_ERROR_RETURN (result, int, )
+ else
+ return __xstat32_conv (vers, &buf64, buf);
}
}
diff --git a/sysdeps/unix/sysv/linux/i386/msgctl.c b/sysdeps/unix/sysv/linux/i386/msgctl.c
index e42f71d..3bd9603 100644
--- a/sysdeps/unix/sysv/linux/i386/msgctl.c
+++ b/sysdeps/unix/sysv/linux/i386/msgctl.c
@@ -55,7 +55,7 @@ int
attribute_compat_text_section
__old_msgctl (int msqid, int cmd, struct __old_msqid_ds *buf)
{
- return INLINE_SYSCALL (ipc, 5, IPCOP_msgctl, msqid, cmd, 0, buf);
+ INLINE_SYSCALL_RETURN (ipc, 5, int, IPCOP_msgctl, msqid, cmd, 0, buf)
}
compat_symbol (libc, __old_msgctl, msgctl, GLIBC_2_0);
#endif
@@ -63,8 +63,8 @@ compat_symbol (libc, __old_msgctl, msgctl, GLIBC_2_0);
int
__new_msgctl (int msqid, int cmd, struct msqid_ds *buf)
{
- return INLINE_SYSCALL (ipc, 5, IPCOP_msgctl,
- msqid, cmd | __IPC_64, 0, buf);
+ INLINE_SYSCALL_RETURN (ipc, 5, int, IPCOP_msgctl, msqid,
+ cmd | __IPC_64, 0, buf)
}
versioned_symbol (libc, __new_msgctl, msgctl, GLIBC_2_2);
diff --git a/sysdeps/unix/sysv/linux/i386/putmsg.c b/sysdeps/unix/sysv/linux/i386/putmsg.c
index ab0112d..9e6cf98 100644
--- a/sysdeps/unix/sysv/linux/i386/putmsg.c
+++ b/sysdeps/unix/sysv/linux/i386/putmsg.c
@@ -30,7 +30,8 @@ putmsg (fildes, ctlptr, dataptr, flags)
const struct strbuf *dataptr;
int flags;
{
- return INLINE_SYSCALL (putpmsg, 5, fildes, ctlptr, dataptr, -1, flags);
+ INLINE_SYSCALL_RETURN (putpmsg, 5, int, fildes, ctlptr, dataptr, -1,
+ flags)
}
#else
# include <streams/putmsg.c>
diff --git a/sysdeps/unix/sysv/linux/i386/semctl.c b/sysdeps/unix/sysv/linux/i386/semctl.c
index 8f13649..3bf4a4d 100644
--- a/sysdeps/unix/sysv/linux/i386/semctl.c
+++ b/sysdeps/unix/sysv/linux/i386/semctl.c
@@ -71,8 +71,8 @@ __old_semctl (int semid, int semnum, int cmd, ...)
va_end (ap);
- return INLINE_SYSCALL (ipc, 5, IPCOP_semctl, semid, semnum, cmd,
- &arg);
+ INLINE_SYSCALL_RETURN (ipc, 5, int, IPCOP_semctl, semid, semnum, cmd,
+ &arg)
}
compat_symbol (libc, __old_semctl, semctl, GLIBC_2_0);
#endif
@@ -90,8 +90,8 @@ __new_semctl (int semid, int semnum, int cmd, ...)
va_end (ap);
- return INLINE_SYSCALL (ipc, 5, IPCOP_semctl, semid, semnum, cmd | __IPC_64,
- &arg);
+ INLINE_SYSCALL_RETURN (ipc, 5, int, IPCOP_semctl, semid, semnum,
+ cmd | __IPC_64, &arg)
}
versioned_symbol (libc, __new_semctl, semctl, GLIBC_2_2);
diff --git a/sysdeps/unix/sysv/linux/i386/setegid.c b/sysdeps/unix/sysv/linux/i386/setegid.c
index 8c39784..f223b0c 100644
--- a/sysdeps/unix/sysv/linux/i386/setegid.c
+++ b/sysdeps/unix/sysv/linux/i386/setegid.c
@@ -17,23 +17,13 @@
#include <errno.h>
#include <unistd.h>
-#include <setxid.h>
int
-setegid (gid)
- gid_t gid;
+setegid (gid_t gid)
{
- int result;
-
if (gid == (gid_t) ~0)
- {
- __set_errno (EINVAL);
- return -1;
- }
-
- result = INLINE_SETXID_SYSCALL (setresgid32, 3, -1, gid, -1);
-
- return result;
+ INLINE_SYSCALL_ERROR_RETURN (-EINVAL, int, )
+ INLINE_SYSCALL_RETURN (setresgid32, 3, int, -1, gid, -1)
}
libc_hidden_def (setegid)
diff --git a/sysdeps/unix/sysv/linux/i386/seteuid.c b/sysdeps/unix/sysv/linux/i386/seteuid.c
index d6a7a27..88eac78 100644
--- a/sysdeps/unix/sysv/linux/i386/seteuid.c
+++ b/sysdeps/unix/sysv/linux/i386/seteuid.c
@@ -17,22 +17,13 @@
#include <errno.h>
#include <unistd.h>
-#include <setxid.h>
int
seteuid (uid_t uid)
{
- int result;
-
if (uid == (uid_t) ~0)
- {
- __set_errno (EINVAL);
- return -1;
- }
-
- result = INLINE_SETXID_SYSCALL (setresuid32, 3, -1, uid, -1);
-
- return result;
+ INLINE_SYSCALL_ERROR_RETURN (-EINVAL, int, )
+ INLINE_SYSCALL_RETURN (setresuid32, 3, int, -1, uid, -1)
}
libc_hidden_def (seteuid)
diff --git a/sysdeps/unix/sysv/linux/i386/shmctl.c b/sysdeps/unix/sysv/linux/i386/shmctl.c
index eeb4453..2ae6e76 100644
--- a/sysdeps/unix/sysv/linux/i386/shmctl.c
+++ b/sysdeps/unix/sysv/linux/i386/shmctl.c
@@ -62,7 +62,7 @@ int
attribute_compat_text_section
__old_shmctl (int shmid, int cmd, struct __old_shmid_ds *buf)
{
- return INLINE_SYSCALL (ipc, 5, IPCOP_shmctl, shmid, cmd, 0, buf);
+ INLINE_SYSCALL_RETURN (ipc, 5, int, IPCOP_shmctl, shmid, cmd, 0, buf)
}
compat_symbol (libc, __old_shmctl, shmctl, GLIBC_2_0);
#endif
@@ -70,8 +70,8 @@ compat_symbol (libc, __old_shmctl, shmctl, GLIBC_2_0);
int
__new_shmctl (int shmid, int cmd, struct shmid_ds *buf)
{
- return INLINE_SYSCALL (ipc, 5, IPCOP_shmctl,
- shmid, cmd | __IPC_64, 0, buf);
+ INLINE_SYSCALL_RETURN (ipc, 5, int, IPCOP_shmctl, shmid,
+ cmd | __IPC_64, 0, buf)
}
versioned_symbol (libc, __new_shmctl, shmctl, GLIBC_2_2);
diff --git a/sysdeps/unix/sysv/linux/i386/sigaction.c b/sysdeps/unix/sysv/linux/i386/sigaction.c
index b20a9b9..cfc37aa 100644
--- a/sysdeps/unix/sysv/linux/i386/sigaction.c
+++ b/sysdeps/unix/sysv/linux/i386/sigaction.c
@@ -69,11 +69,13 @@ __libc_sigaction (int sig, const struct sigaction *act, struct sigaction *oact)
/* XXX The size argument hopefully will have to be changed to the
real size of the user-level sigset_t. */
- result = INLINE_SYSCALL (rt_sigaction, 4,
- sig, act ? &kact : NULL,
- oact ? &koact : NULL, _NSIG / 8);
-
- if (oact && result >= 0)
+ INTERNAL_SYSCALL_DECL (err);
+ result = INTERNAL_SYSCALL (rt_sigaction, err, 4,
+ sig, act ? &kact : NULL,
+ oact ? &koact : NULL, _NSIG / 8);
+ if (__glibc_unlikely (INTERNAL_SYSCALL_ERROR_P (result, )))
+ INLINE_SYSCALL_ERROR_RETURN (result, int, )
+ else if (oact && result >= 0)
{
oact->sa_handler = koact.k_sa_handler;
memcpy (&oact->sa_mask, &koact.sa_mask, sizeof (sigset_t));
diff --git a/sysdeps/unix/sysv/linux/i386/sysdep.S b/sysdeps/unix/sysv/linux/i386/sysdep.S
deleted file mode 100644
index 4e6c262..0000000
--- a/sysdeps/unix/sysv/linux/i386/sysdep.S
+++ /dev/null
@@ -1,40 +0,0 @@
-/* Copyright (C) 1995-2015 Free Software Foundation, Inc.
- This file is part of the GNU C Library.
-
- The GNU C Library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Lesser General Public
- License as published by the Free Software Foundation; either
- version 2.1 of the License, or (at your option) any later version.
-
- The GNU C Library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Lesser General Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with the GNU C Library; if not, see
- <http://www.gnu.org/licenses/>. */
-
-#include <sysdep.h>
-
-/* The following code is only used in the shared library when we
- compile the reentrant version. Otherwise each system call defines
- each own version. */
-
-#ifndef PIC
-
-/* The syscall stubs jump here when they detect an error.
- The code for Linux is almost identical to the canonical Unix/i386
- code, except that the error number in %eax is negated. */
-
-#undef CALL_MCOUNT
-#define CALL_MCOUNT /* Don't insert the profiling call, it clobbers %eax. */
-
- .text
-ENTRY (__syscall_error)
- negl %eax
-
-#define __syscall_error __syscall_error_1
-#include <sysdeps/unix/i386/sysdep.S>
-
-#endif /* !PIC */
diff --git a/sysdeps/unix/sysv/linux/i386/seteuid.c b/sysdeps/unix/sysv/linux/i386/sysdep.c
similarity index 68%
copy from sysdeps/unix/sysv/linux/i386/seteuid.c
copy to sysdeps/unix/sysv/linux/i386/sysdep.c
index d6a7a27..2fcc6f8 100644
--- a/sysdeps/unix/sysv/linux/i386/seteuid.c
+++ b/sysdeps/unix/sysv/linux/i386/sysdep.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1998-2015 Free Software Foundation, Inc.
+/* Copyright (C) 2015 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
@@ -16,23 +16,15 @@
<http://www.gnu.org/licenses/>. */
#include <errno.h>
-#include <unistd.h>
-#include <setxid.h>
-
-
+#include <sysdep.h>
+
+/* This routine is jumped to by all the syscall handlers, to stash
+ an error number into errno. ERROR is the negative error number
+ returned from the x86 kernel. */
int
-seteuid (uid_t uid)
+__attribute__ ((__regparm__ (1)))
+__syscall_error (int error)
{
- int result;
-
- if (uid == (uid_t) ~0)
- {
- __set_errno (EINVAL);
- return -1;
- }
-
- result = INLINE_SETXID_SYSCALL (setresuid32, 3, -1, uid, -1);
-
- return result;
+ __set_errno (-error);
+ return -1;
}
-libc_hidden_def (seteuid)
diff --git a/sysdeps/unix/sysv/linux/i386/sysdep.h b/sysdeps/unix/sysv/linux/i386/sysdep.h
index d76aca5..5c87165 100644
--- a/sysdeps/unix/sysv/linux/i386/sysdep.h
+++ b/sysdeps/unix/sysv/linux/i386/sysdep.h
@@ -55,11 +55,7 @@
/* We don't want the label for the error handle to be global when we define
it here. */
-#ifdef PIC
-# define SYSCALL_ERROR_LABEL 0f
-#else
-# define SYSCALL_ERROR_LABEL syscall_error
-#endif
+#define SYSCALL_ERROR_LABEL __syscall_error
#undef PSEUDO
#define PSEUDO(name, syscall_name, args) \
@@ -100,55 +96,7 @@
#define ret_ERRVAL ret
-#ifndef PIC
-# define SYSCALL_ERROR_HANDLER /* Nothing here; code in sysdep.S is used. */
-#else
-
-# if RTLD_PRIVATE_ERRNO
-# define SYSCALL_ERROR_HANDLER \
-0:SETUP_PIC_REG(cx); \
- addl $_GLOBAL_OFFSET_TABLE_, %ecx; \
- negl %eax; \
- movl %eax, rtld_errno@GOTOFF(%ecx); \
- orl $-1, %eax; \
- ret;
-
-# elif defined _LIBC_REENTRANT
-
-# if IS_IN (libc)
-# define SYSCALL_ERROR_ERRNO __libc_errno
-# else
-# define SYSCALL_ERROR_ERRNO errno
-# endif
-# define SYSCALL_ERROR_HANDLER \
-0:SETUP_PIC_REG (cx); \
- addl $_GLOBAL_OFFSET_TABLE_, %ecx; \
- movl SYSCALL_ERROR_ERRNO@GOTNTPOFF(%ecx), %ecx; \
- negl %eax; \
- SYSCALL_ERROR_HANDLER_TLS_STORE (%eax, %ecx); \
- orl $-1, %eax; \
- ret;
-# ifndef NO_TLS_DIRECT_SEG_REFS
-# define SYSCALL_ERROR_HANDLER_TLS_STORE(src, destoff) \
- movl src, %gs:(destoff)
-# else
-# define SYSCALL_ERROR_HANDLER_TLS_STORE(src, destoff) \
- addl %gs:0, destoff; \
- movl src, (destoff)
-# endif
-# else
-/* Store (- %eax) into errno through the GOT. */
-# define SYSCALL_ERROR_HANDLER \
-0:SETUP_PIC_REG(cx); \
- addl $_GLOBAL_OFFSET_TABLE_, %ecx; \
- negl %eax; \
- movl errno@GOT(%ecx), %ecx; \
- movl %eax, (%ecx); \
- orl $-1, %eax; \
- ret;
-# endif /* _LIBC_REENTRANT */
-#endif /* PIC */
-
+#define SYSCALL_ERROR_HANDLER /* Nothing here; code in sysdep.c is used. */
/* The original calling convention for system calls on Linux/i386 is
to use int $0x80. */
@@ -275,6 +223,10 @@
#else /* !__ASSEMBLER__ */
+extern int __syscall_error (int)
+ attribute_hidden __attribute__ ((__regparm__ (1)));
+
+#if !__GNUC_PREREQ (5,0)
/* We need some help from the assembler to generate optimal code. We
define some macros here which later will be used. */
asm (".L__X'%ebx = 1\n\t"
@@ -314,6 +266,7 @@ struct libc_do_syscall_args
{
int ebx, edi, ebp;
};
+#endif
/* Define a macro which expands inline into the wrapper code for a system
call. */
@@ -328,6 +281,22 @@ struct libc_do_syscall_args
} \
(int) resultvar; })
+/* Define a macro which expands inline into the wrapper code for a system
+ call and return. */
+#undef INLINE_SYSCALL_RETURN
+#define INLINE_SYSCALL_RETURN(name, nr, type, args...) \
+ { \
+ unsigned int resultvar = INTERNAL_SYSCALL (name, , nr, args); \
+ if (__glibc_unlikely (INTERNAL_SYSCALL_ERROR_P (resultvar, ))) \
+ INLINE_SYSCALL_ERROR_RETURN (resultvar, type, ) \
+ return (type) resultvar; \
+ }
+
+/* Define a macro to return for a system call error. */
+#undef INLINE_SYSCALL_ERROR_RETURN
+#define INLINE_SYSCALL_ERROR_RETURN(resultvar, type, value) \
+ return (type) __syscall_error (resultvar);
+
/* List of system calls which are supported as vsyscalls. */
# define HAVE_CLOCK_GETTIME_VSYSCALL 1
# define HAVE_GETTIMEOFDAY_VSYSCALL 1
@@ -354,8 +323,12 @@ struct libc_do_syscall_args
INTERNAL_SYSCALL_MAIN_INLINE(name, err, 5, args)
/* Each object using 6-argument inline syscalls must include a
definition of __libc_do_syscall. */
-#define INTERNAL_SYSCALL_MAIN_6(name, err, arg1, arg2, arg3, \
- arg4, arg5, arg6) \
+#if __GNUC_PREREQ (5,0)
+# define INTERNAL_SYSCALL_MAIN_6(name, err, args...) \
+ INTERNAL_SYSCALL_MAIN_INLINE(name, err, 6, args)
+#else /* GCC 5 */
+# define INTERNAL_SYSCALL_MAIN_6(name, err, arg1, arg2, arg3, \
+ arg4, arg5, arg6) \
struct libc_do_syscall_args _xv = \
{ \
(int) (arg1), \
@@ -368,14 +341,52 @@ struct libc_do_syscall_args
: "=a" (resultvar) \
: "i" (__NR_##name), "c" (arg2), "d" (arg3), "S" (arg4), "D" (&_xv) \
: "memory", "cc")
+#endif /* GCC 5 */
#define INTERNAL_SYSCALL(name, err, nr, args...) \
({ \
register unsigned int resultvar; \
INTERNAL_SYSCALL_MAIN_##nr (name, err, args); \
(int) resultvar; })
#ifdef I386_USE_SYSENTER
-# ifdef SHARED
-# define INTERNAL_SYSCALL_MAIN_INLINE(name, err, nr, args...) \
+# if __GNUC_PREREQ (5,0)
+# ifdef SHARED
+# define INTERNAL_SYSCALL_MAIN_INLINE(name, err, nr, args...) \
+ LOADREGS_##nr(args) \
+ asm volatile ( \
+ "call *%%gs:%P2" \
+ : "=a" (resultvar) \
+ : "a" (__NR_##name), "i" (offsetof (tcbhead_t, sysinfo)) \
+ ASMARGS_##nr(args) : "memory", "cc")
+# define INTERNAL_SYSCALL_NCS(name, err, nr, args...) \
+ ({ \
+ register unsigned int resultvar; \
+ LOADREGS_##nr(args) \
+ asm volatile ( \
+ "call *%%gs:%P2" \
+ : "=a" (resultvar) \
+ : "a" (name), "i" (offsetof (tcbhead_t, sysinfo)) \
+ ASMARGS_##nr(args) : "memory", "cc"); \
+ (int) resultvar; })
+# else
+# define INTERNAL_SYSCALL_MAIN_INLINE(name, err, nr, args...) \
+ LOADREGS_##nr(args) \
+ asm volatile ( \
+ "call *_dl_sysinfo" \
+ : "=a" (resultvar) \
+ : "a" (__NR_##name) ASMARGS_##nr(args) : "memory", "cc")
+# define INTERNAL_SYSCALL_NCS(name, err, nr, args...) \
+ ({ \
+ register unsigned int resultvar; \
+ LOADREGS_##nr(args) \
+ asm volatile ( \
+ "call *_dl_sysinfo" \
+ : "=a" (resultvar) \
+ : "a" (name) ASMARGS_##nr(args) : "memory", "cc"); \
+ (int) resultvar; })
+# endif
+# else /* GCC 5 */
+# ifdef SHARED
+# define INTERNAL_SYSCALL_MAIN_INLINE(name, err, nr, args...) \
EXTRAVAR_##nr \
asm volatile ( \
LOADARGS_##nr \
@@ -385,7 +396,7 @@ struct libc_do_syscall_args
: "=a" (resultvar) \
: "i" (__NR_##name), "i" (offsetof (tcbhead_t, sysinfo)) \
ASMFMT_##nr(args) : "memory", "cc")
-# define INTERNAL_SYSCALL_NCS(name, err, nr, args...) \
+# define INTERNAL_SYSCALL_NCS(name, err, nr, args...) \
({ \
register unsigned int resultvar; \
EXTRAVAR_##nr \
@@ -397,8 +408,8 @@ struct libc_do_syscall_args
: "0" (name), "i" (offsetof (tcbhead_t, sysinfo)) \
ASMFMT_##nr(args) : "memory", "cc"); \
(int) resultvar; })
-# else
-# define INTERNAL_SYSCALL_MAIN_INLINE(name, err, nr, args...) \
+# else
+# define INTERNAL_SYSCALL_MAIN_INLINE(name, err, nr, args...) \
EXTRAVAR_##nr \
asm volatile ( \
LOADARGS_##nr \
@@ -407,7 +418,7 @@ struct libc_do_syscall_args
RESTOREARGS_##nr \
: "=a" (resultvar) \
: "i" (__NR_##name) ASMFMT_##nr(args) : "memory", "cc")
-# define INTERNAL_SYSCALL_NCS(name, err, nr, args...) \
+# define INTERNAL_SYSCALL_NCS(name, err, nr, args...) \
({ \
register unsigned int resultvar; \
EXTRAVAR_##nr \
@@ -418,9 +429,27 @@ struct libc_do_syscall_args
: "=a" (resultvar) \
: "0" (name) ASMFMT_##nr(args) : "memory", "cc"); \
(int) resultvar; })
-# endif
+# endif
+# endif /* GCC 5 */
#else
-# define INTERNAL_SYSCALL_MAIN_INLINE(name, err, nr, args...) \
+# if __GNUC_PREREQ (5,0)
+# define INTERNAL_SYSCALL_MAIN_INLINE(name, err, nr, args...) \
+ LOADREGS_##nr(args) \
+ asm volatile ( \
+ "int $0x80" \
+ : "=a" (resultvar) \
+ : "a" (__NR_##name) ASMARGS_##nr(args) : "memory", "cc")
+# define INTERNAL_SYSCALL_NCS(name, err, nr, args...) \
+ ({ \
+ register unsigned int resultvar; \
+ LOADREGS_##nr(args) \
+ asm volatile ( \
+ "int $0x80" \
+ : "=a" (resultvar) \
+ : "a" (name) ASMARGS_##nr(args) : "memory", "cc"); \
+ (int) resultvar; })
+# else /* GCC 5 */
+# define INTERNAL_SYSCALL_MAIN_INLINE(name, err, nr, args...) \
EXTRAVAR_##nr \
asm volatile ( \
LOADARGS_##nr \
@@ -429,7 +458,7 @@ struct libc_do_syscall_args
RESTOREARGS_##nr \
: "=a" (resultvar) \
: "i" (__NR_##name) ASMFMT_##nr(args) : "memory", "cc")
-# define INTERNAL_SYSCALL_NCS(name, err, nr, args...) \
+# define INTERNAL_SYSCALL_NCS(name, err, nr, args...) \
({ \
register unsigned int resultvar; \
EXTRAVAR_##nr \
@@ -440,6 +469,7 @@ struct libc_do_syscall_args
: "=a" (resultvar) \
: "0" (name) ASMFMT_##nr(args) : "memory", "cc"); \
(int) resultvar; })
+# endif /* GCC 5 */
#endif
#undef INTERNAL_SYSCALL_DECL
@@ -504,6 +534,36 @@ struct libc_do_syscall_args
# define RESTOREARGS_5
#endif
+#if __GNUC_PREREQ (5,0)
+# define LOADREGS_0()
+# define ASMARGS_0()
+# define LOADREGS_1(arg1) \
+ LOADREGS_0 ()
+# define ASMARGS_1(arg1) \
+ ASMARGS_0 (), "b" ((unsigned int) (arg1))
+# define LOADREGS_2(arg1, arg2) \
+ LOADREGS_1 (arg1)
+# define ASMARGS_2(arg1, arg2) \
+ ASMARGS_1 (arg1), "c" ((unsigned int) (arg2))
+# define LOADREGS_3(arg1, arg2, arg3) \
+ LOADREGS_2 (arg1, arg2)
+# define ASMARGS_3(arg1, arg2, arg3) \
+ ASMARGS_2 (arg1, arg2), "d" ((unsigned int) (arg3))
+# define LOADREGS_4(arg1, arg2, arg3, arg4) \
+ LOADREGS_3 (arg1, arg2, arg3)
+# define ASMARGS_4(arg1, arg2, arg3, arg4) \
+ ASMARGS_3 (arg1, arg2, arg3), "S" ((unsigned int) (arg4))
+# define LOADREGS_5(arg1, arg2, arg3, arg4, arg5) \
+ LOADREGS_4 (arg1, arg2, arg3, arg4)
+# define ASMARGS_5(arg1, arg2, arg3, arg4, arg5) \
+ ASMARGS_4 (arg1, arg2, arg3, arg4), "D" ((unsigned int) (arg5))
+# define LOADREGS_6(arg1, arg2, arg3, arg4, arg5, arg6) \
+ register unsigned int _a6 asm ("ebp") = (unsigned int) (arg6); \
+ LOADREGS_5 (arg1, arg2, arg3, arg4, arg5)
+# define ASMARGS_6(arg1, arg2, arg3, arg4, arg5, arg6) \
+ ASMARGS_5 (arg1, arg2, arg3, arg4, arg5), "r" (_a6)
+#endif /* GCC 5 */
+
#define ASMFMT_0()
#ifdef __PIC__
# define ASMFMT_1(arg1) \
diff --git a/sysdeps/unix/sysv/linux/i386/xstat.c b/sysdeps/unix/sysv/linux/i386/xstat.c
index 2424434..d84c992 100644
--- a/sysdeps/unix/sysv/linux/i386/xstat.c
+++ b/sysdeps/unix/sysv/linux/i386/xstat.c
@@ -38,15 +38,17 @@ __xstat (int vers, const char *name, struct stat *buf)
int result;
if (vers == _STAT_VER_KERNEL)
- return INLINE_SYSCALL (stat, 2, name, (struct kernel_stat *) buf);
+ INLINE_SYSCALL_RETURN (stat, 2, int, name, (struct kernel_stat *) buf)
{
struct stat64 buf64;
- result = INLINE_SYSCALL (stat64, 2, name, &buf64);
- if (result == 0)
- result = __xstat32_conv (vers, &buf64, buf);
- return result;
+ INTERNAL_SYSCALL_DECL (err);
+ result = INTERNAL_SYSCALL (stat64, err, 2, name, &buf64);
+ if (__glibc_unlikely (INTERNAL_SYSCALL_ERROR_P (result, )))
+ INLINE_SYSCALL_ERROR_RETURN (result, int, )
+ else
+ return __xstat32_conv (vers, &buf64, buf);
}
}
hidden_def (__xstat)
http://sourceware.org/git/gitweb.cgi?p=glibc.git;a=commitdiff;h=71f697ab640389aadb316555c74a3222e2f48630
commit 71f697ab640389aadb316555c74a3222e2f48630
Author: H.J. Lu <hjl.tools@gmail.com>
Date: Thu Aug 13 15:40:05 2015 -0700
Add INLINE_SYSCALL_RETURN/INLINE_SYSCALL_ERROR_RETURN
For ia32 PIC, the first thing of many syscalls does is to call
__x86.get_pc_thunk.reg to load PC into reg in case there is an error,
which is required for setting errno. In most cases, there are no
errors. But we still call __x86.get_pc_thunk.reg. This patch adds
INLINE_SYSCALL_RETURN and INLINE_SYSCALL_ERROR_RETURN so that i386
can optimize setting errno by branching to the internal __syscall_error
without PLT.
INLINE_SYSCALL_ERROR_RETURN is designed to take the negative error
number returned from the majority of Linux kernels for which negating
is a no-op with INTERNAL_SYSCALL_ERRNO.
With i386 INLINE_SYSCALL_RETURN, INLINE_SYSCALL_ERROR_RETURN and
i386 syscall inlining optimization for GCC 5, for
sysdeps/unix/sysv/linux/fchmodat.c with -O2 -march=i686
-mtune=generic, GCC 5.2 now generates:
<fchmodat>:
0: push %ebx
1: mov 0x14(%esp),%eax
5: mov 0x8(%esp),%ebx
9: mov 0xc(%esp),%ecx
d: mov 0x10(%esp),%edx
11: test $0xfffffeff,%eax
16: jne 38 <fchmodat+0x38>
18: test $0x1,%ah
1b: jne 48 <fchmodat+0x48>
1d: mov $0x132,%eax
22: call *%gs:0x10
29: cmp $0xfffff000,%eax
2e: ja 58 <fchmodat+0x58>
30: pop %ebx
31: ret
32: lea 0x0(%esi),%esi
38: pop %ebx
39: mov $0xffffffea,%eax
3e: jmp 3f <fchmodat+0x3f> 3f: R_386_PC32 __syscall_error
43: nop
44: lea 0x0(%esi,%eiz,1),%esi
48: pop %ebx
49: mov $0xffffffa1,%eax
4e: jmp 4f <fchmodat+0x4f> 4f: R_386_PC32 __syscall_error
53: nop
54: lea 0x0(%esi,%eiz,1),%esi
58: pop %ebx
59: jmp 5a <fchmodat+0x5a> 5a: R_386_PC32 __syscall_error
instead of
<fchmodat>:
0: sub $0x8,%esp
3: mov 0x18(%esp),%eax
7: mov %ebx,(%esp)
a: call b <fchmodat+0xb> b: R_386_PC32 __x86.get_pc_thunk.bx
f: add $0x2,%ebx 11: R_386_GOTPC _GLOBAL_OFFSET_TABLE_
15: mov %edi,0x4(%esp)
19: test $0xfffffeff,%eax
1e: jne 70 <fchmodat+0x70>
20: test $0x1,%ah
23: jne 88 <fchmodat+0x88>
25: mov 0x14(%esp),%edx
29: mov 0x10(%esp),%ecx
2d: mov 0xc(%esp),%edi
31: xchg %ebx,%edi
33: mov $0x132,%eax
38: call *%gs:0x10
3f: xchg %edi,%ebx
41: cmp $0xfffff000,%eax
46: ja 58 <fchmodat+0x58>
48: mov (%esp),%ebx
4b: mov 0x4(%esp),%edi
4f: add $0x8,%esp
52: ret
53: nop
54: lea 0x0(%esi,%eiz,1),%esi
58: mov 0x0(%ebx),%edx 5a: R_386_TLS_GOTIE __libc_errno
5e: neg %eax
60: mov %eax,%gs:(%edx)
63: mov $0xffffffff,%eax
68: jmp 48 <fchmodat+0x48>
6a: lea 0x0(%esi),%esi
70: mov 0x0(%ebx),%eax 72: R_386_TLS_GOTIE __libc_errno
76: movl $0x16,%gs:(%eax)
7d: mov $0xffffffff,%eax
82: jmp 48 <fchmodat+0x48>
84: lea 0x0(%esi,%eiz,1),%esi
88: mov 0x0(%ebx),%eax 8a: R_386_TLS_GOTIE __libc_errno
8e: movl $0x5f,%gs:(%eax)
95: mov $0xffffffff,%eax
9a: jmp 48 <fchmodat+0x48>
* sysdeps/unix/sysdep.h (INLINE_SYSCALL_RETURN): New.
(INLINE_SYSCALL_ERROR_RETURN): Likewise.
* sysdeps/unix/sysv/linux/aio_sigqueue.c (__aio_sigqueue): Use
INLINE_SYSCALL_RETURN, INLINE_SYSCALL_ERROR_RETURN and
INTERNAL_SYSCALL.
* sysdeps/unix/sysv/linux/dl-openat64.c (openat64): Likewise.
* sysdeps/unix/sysv/linux/eventfd.c (eventfd): Likewise.
* sysdeps/unix/sysv/linux/fchmodat.c (fchmodat): Likewise.
* sysdeps/unix/sysv/linux/fcntl.c (do_fcntl): Likewise.
* sysdeps/unix/sysv/linux/fstatfs64.c (__fstatfs64): Likewise.
* sysdeps/unix/sysv/linux/ftruncate64.c (__ftruncate64): Likewise.
* sysdeps/unix/sysv/linux/futimens.c (futimens): Likewise.
* sysdeps/unix/sysv/linux/futimes.c (__futimes): Likewise.
* sysdeps/unix/sysv/linux/futimesat.c (futimesat): Likewise.
* sysdeps/unix/sysv/linux/fxstat.c (__fxstat): Likewise.
* sysdeps/unix/sysv/linux/fxstat64.c (___fxstat64): Likewise.
* sysdeps/unix/sysv/linux/gai_sigqueue.c (__gai_sigqueue):
Likewise.
* sysdeps/unix/sysv/linux/getpriority.c (__getpriority): Likewise.
* sysdeps/unix/sysv/linux/getrlimit64.c (__getrlimit64): 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_close.c (mq_close): Likewise.
* sysdeps/unix/sysv/linux/mq_open.c (__mq_open): Likewise.
* sysdeps/unix/sysv/linux/msgget.c (msgget): Likewise.
* sysdeps/unix/sysv/linux/prlimit.c (prlimit): Likewise.
* sysdeps/unix/sysv/linux/pt-raise.c (raise): Likewise.
* sysdeps/unix/sysv/linux/raise.c (raise): Likewise.
* sysdeps/unix/sysv/linux/readahead.c (__readahead): Likewise.
* sysdeps/unix/sysv/linux/reboot.c (reboot): Likewise.
* sysdeps/unix/sysv/linux/sched_getaffinity.c
(__sched_getaffinity_new): Likewise.
* sysdeps/unix/sysv/linux/semget.c (semget): Likewise.
* sysdeps/unix/sysv/linux/semop.c (semop): Likewise.
* sysdeps/unix/sysv/linux/semtimedop.c (semtimedop): Likewise.
* sysdeps/unix/sysv/linux/setrlimit64.c (setrlimit64): Likewise.
* sysdeps/unix/sysv/linux/shmdt.c (shmdt): Likewise.
* sysdeps/unix/sysv/linux/shmget.c (shmget): Likewise.
* sysdeps/unix/sysv/linux/signalfd.c (signalfd): Likewise.
* sysdeps/unix/sysv/linux/sigpending.c (sigpending): Likewise.
* sysdeps/unix/sysv/linux/sigprocmask.c ( __sigprocmask): Likewise.
* sysdeps/unix/sysv/linux/sigqueue.c (__sigqueue): Likewise.
* sysdeps/unix/sysv/linux/statfs64.c (__statfs64): Likewise.
* sysdeps/unix/sysv/linux/sysctl.c (__sysctl): Likewise.
* sysdeps/unix/sysv/linux/tcsetattr.c (tcsetattr): Likewise.
* sysdeps/unix/sysv/linux/timer_getoverr.c (timer_getoverrun):
Likewise.
* sysdeps/unix/sysv/linux/timer_gettime.c (timer_gettime):
Likewise.
* sysdeps/unix/sysv/linux/timer_settime.c (timer_settime):
Likewise.
* sysdeps/unix/sysv/linux/truncate64.c (truncate64): Likewise.
* sysdeps/unix/sysv/linux/ustat.c (ustat): Likewise.
* sysdeps/unix/sysv/linux/utimensat.c (utimensat): Likewise.
* sysdeps/unix/sysv/linux/utimes.c (__utimes): 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.
diff --git a/sysdeps/unix/sysdep.h b/sysdeps/unix/sysdep.h
index 52dad58..eddf2cf 100644
--- a/sysdeps/unix/sysdep.h
+++ b/sysdeps/unix/sysdep.h
@@ -73,3 +73,23 @@
#ifndef INLINE_SYSCALL
#define INLINE_SYSCALL(name, nr, args...) __syscall_##name (args)
#endif
+
+/* Define a macro which expands inline into the wrapper code for a system
+ call and return. */
+#ifndef INLINE_SYSCALL_RETURN
+#define INLINE_SYSCALL_RETURN(name, nr, type, args...) \
+ { \
+ return (type) INLINE_SYSCALL (name, nr, args); \
+ }
+#endif
+
+/* Define a macro to return for a system call 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) \
+ { \
+ __set_errno (-err); \
+ return (type) (value); \
+ }
+#endif
diff --git a/sysdeps/unix/sysv/linux/aio_sigqueue.c b/sysdeps/unix/sysv/linux/aio_sigqueue.c
index 6a48e62..28917a0 100644
--- a/sysdeps/unix/sysv/linux/aio_sigqueue.c
+++ b/sysdeps/unix/sysv/linux/aio_sigqueue.c
@@ -47,7 +47,7 @@ __aio_sigqueue (sig, val, caller_pid)
info.si_uid = getuid ();
info.si_value = val;
- return INLINE_SYSCALL (rt_sigqueueinfo, 3, info.si_pid, sig, &info);
+ INLINE_SYSCALL_RETURN (rt_sigqueueinfo, 3, int, 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 732097d..7a130d3 100644
--- a/sysdeps/unix/sysv/linux/dl-openat64.c
+++ b/sysdeps/unix/sysv/linux/dl-openat64.c
@@ -31,9 +31,8 @@ openat64 (dfd, file, oflag)
assert (!__OPEN_NEEDS_MODE (oflag));
#ifdef __NR_openat
- return INLINE_SYSCALL (openat, 3, dfd, file, oflag | O_LARGEFILE);
+ INLINE_SYSCALL_RETURN (openat, 3, int, dfd, file, oflag | O_LARGEFILE)
#else
- __set_errno (ENOSYS);
- return -1;
+ INLINE_SYSCALL_ERROR_RETURN (-ENOSYS, int, -1)
#endif
}
diff --git a/sysdeps/unix/sysv/linux/eventfd.c b/sysdeps/unix/sysv/linux/eventfd.c
index d4ffb3c..fd42622 100644
--- a/sysdeps/unix/sysv/linux/eventfd.c
+++ b/sysdeps/unix/sysv/linux/eventfd.c
@@ -25,11 +25,12 @@ int
eventfd (unsigned int count, int flags)
{
#ifdef __NR_eventfd2
- int res = INLINE_SYSCALL (eventfd2, 2, count, flags);
# ifndef __ASSUME_EVENTFD2
+ int res = INLINE_SYSCALL (eventfd2, 2, count, flags);
if (res != -1 || errno != ENOSYS)
-# endif
return res;
+# endif
+ INLINE_SYSCALL_RETURN (eventfd2, 2, int, count, flags)
#endif
#ifndef __ASSUME_EVENTFD2
@@ -38,16 +39,12 @@ eventfd (unsigned int count, int flags)
kernel (sys_indirect) before implementing setting flags like
O_NONBLOCK etc. */
if (flags != 0)
- {
- __set_errno (EINVAL);
- return -1;
- }
+ INLINE_SYSCALL_ERROR_RETURN (-EINVAL, int, -1)
# ifdef __NR_eventfd
- return INLINE_SYSCALL (eventfd, 1, count);
+ INLINE_SYSCALL_RETURN (eventfd, 1, int, count)
# else
- __set_errno (ENOSYS);
- return -1;
+ INLINE_SYSCALL_ERROR_RETURN (-ENOSYS, int, -1)
# endif
#elif !defined __NR_eventfd2
# error "__ASSUME_EVENTFD2 defined but not __NR_eventfd2"
diff --git a/sysdeps/unix/sysv/linux/fchmodat.c b/sysdeps/unix/sysv/linux/fchmodat.c
index e278426..58c18e0 100644
--- a/sysdeps/unix/sysv/linux/fchmodat.c
+++ b/sysdeps/unix/sysv/linux/fchmodat.c
@@ -34,17 +34,11 @@ fchmodat (fd, file, mode, flag)
int flag;
{
if (flag & ~AT_SYMLINK_NOFOLLOW)
- {
- __set_errno (EINVAL);
- return -1;
- }
+ INLINE_SYSCALL_ERROR_RETURN (-EINVAL, int, -1)
#ifndef __NR_lchmod /* Linux so far has no lchmod syscall. */
if (flag & AT_SYMLINK_NOFOLLOW)
- {
- __set_errno (ENOTSUP);
- return -1;
- }
+ INLINE_SYSCALL_ERROR_RETURN (-ENOTSUP, int, -1)
#endif
- return INLINE_SYSCALL (fchmodat, 3, fd, file, mode);
+ INLINE_SYSCALL_RETURN (fchmodat, 3, int, fd, file, mode)
}
diff --git a/sysdeps/unix/sysv/linux/fcntl.c b/sysdeps/unix/sysv/linux/fcntl.c
index fa184db..2b6df6c 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 (fcntl, 3, fd, cmd, arg);
+ INLINE_SYSCALL_RETURN (fcntl, 3, int, 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;
- __set_errno (INTERNAL_SYSCALL_ERRNO (res, err));
- return -1;
+ INLINE_SYSCALL_ERROR_RETURN (-INTERNAL_SYSCALL_ERRNO (res, err),
+ int, -1)
}
diff --git a/sysdeps/unix/sysv/linux/fstatfs64.c b/sysdeps/unix/sysv/linux/fstatfs64.c
index af83830..b28e261 100644
--- a/sysdeps/unix/sysv/linux/fstatfs64.c
+++ b/sysdeps/unix/sysv/linux/fstatfs64.c
@@ -35,12 +35,14 @@ __fstatfs64 (int fd, struct statfs64 *buf)
if (! __no_statfs64)
# endif
{
+# if __ASSUME_STATFS64 == 0
int result = INLINE_SYSCALL (fstatfs64, 3, fd, sizeof (*buf), buf);
-# if __ASSUME_STATFS64 == 0
if (result == 0 || errno != ENOSYS)
-# endif
return result;
+# else
+ INLINE_SYSCALL_RETURN (fstatfs64, 3, int, fd, sizeof (*buf), buf)
+# endif
# if __ASSUME_STATFS64 == 0
__no_statfs64 = 1;
diff --git a/sysdeps/unix/sysv/linux/ftruncate64.c b/sysdeps/unix/sysv/linux/ftruncate64.c
index cc3c43c..2ebe31c 100644
--- a/sysdeps/unix/sysv/linux/ftruncate64.c
+++ b/sysdeps/unix/sysv/linux/ftruncate64.c
@@ -29,8 +29,7 @@ __ftruncate64 (int fd, off64_t length)
{
unsigned int low = length & 0xffffffff;
unsigned int high = length >> 32;
- int result = INLINE_SYSCALL (ftruncate64, 3, fd,
- __LONG_LONG_PAIR (high, low));
- return result;
+ INLINE_SYSCALL_RETURN (ftruncate64, 3, int, fd,
+ __LONG_LONG_PAIR (high, low))
}
weak_alias (__ftruncate64, ftruncate64)
diff --git a/sysdeps/unix/sysv/linux/futimens.c b/sysdeps/unix/sysv/linux/futimens.c
index 5f2b8a5..0d99476 100644
--- a/sysdeps/unix/sysv/linux/futimens.c
+++ b/sysdeps/unix/sysv/linux/futimens.c
@@ -33,15 +33,11 @@ futimens (int fd, const struct timespec tsp[2])
{
#ifdef __NR_utimensat
if (fd < 0)
- {
- __set_errno (EBADF);
- return -1;
- }
+ INLINE_SYSCALL_ERROR_RETURN (-EBADF, int, -1)
/* Avoid implicit array coercion in syscall macros. */
- return INLINE_SYSCALL (utimensat, 4, fd, NULL, &tsp[0], 0);
+ INLINE_SYSCALL_RETURN (utimensat, 4, int, fd, NULL, &tsp[0], 0)
#else
- __set_errno (ENOSYS);
- return -1;
+ INLINE_SYSCALL_ERROR_RETURN (-ENOSYS, int, -1)
#endif
}
#ifndef __NR_utimensat
diff --git a/sysdeps/unix/sysv/linux/futimes.c b/sysdeps/unix/sysv/linux/futimes.c
index 69ddfe1..59ae777 100644
--- a/sysdeps/unix/sysv/linux/futimes.c
+++ b/sysdeps/unix/sysv/linux/futimes.c
@@ -49,6 +49,6 @@ __futimes (int fd, const struct timeval tvp[2])
TIMEVAL_TO_TIMESPEC (&tvp[1], &ts[1]);
}
- return INLINE_SYSCALL (utimensat, 4, fd, NULL, tvp ? &ts : NULL, 0);
+ INLINE_SYSCALL_RETURN (utimensat, 4, int, 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 27d6870..221885b 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 (futimesat, 3, fd, file, &tvp[0]);
+ INLINE_SYSCALL_RETURN (futimesat, 3, int, fd, file, &tvp[0])
}
diff --git a/sysdeps/unix/sysv/linux/fxstat.c b/sysdeps/unix/sysv/linux/fxstat.c
index 8d8c4e1..4ef32a8 100644
--- a/sysdeps/unix/sysv/linux/fxstat.c
+++ b/sysdeps/unix/sysv/linux/fxstat.c
@@ -36,20 +36,19 @@ int
__fxstat (int vers, int fd, struct stat *buf)
{
if (vers == _STAT_VER_KERNEL)
- return INLINE_SYSCALL (fstat, 2, fd, (struct kernel_stat *) buf);
+ INLINE_SYSCALL_RETURN (fstat, 2, fd, (struct kernel_stat *) buf);
#ifdef STAT_IS_KERNEL_STAT
- errno = EINVAL;
- return -1;
+ INLINE_SYSCALL_ERROR_RETURN (-EINVAL, int, -1)
#else
struct kernel_stat kbuf;
- int result;
-
- result = INLINE_SYSCALL (fstat, 2, fd, &kbuf);
- if (result == 0)
- result = __xstat_conv (vers, &kbuf, buf);
-
- return result;
+ INTERNAL_SYSCALL_DECL (err);
+ int result = INTERNAL_SYSCALL (fstat, err, 2, fd, &kbuf);
+ if (__glibc_unlikely (INTERNAL_SYSCALL_ERROR_P (result, err)))
+ INLINE_SYSCALL_ERROR_RETURN (-INTERNAL_SYSCALL_ERRNO (result, err),
+ int, -1)
+ else
+ return __xstat_conv (vers, &kbuf, buf);
#endif
}
diff --git a/sysdeps/unix/sysv/linux/fxstat64.c b/sysdeps/unix/sysv/linux/fxstat64.c
index 7a0168d..4f67b30 100644
--- a/sysdeps/unix/sysv/linux/fxstat64.c
+++ b/sysdeps/unix/sysv/linux/fxstat64.c
@@ -31,8 +31,11 @@
int
___fxstat64 (int vers, int fd, struct stat64 *buf)
{
- int result;
- result = INLINE_SYSCALL (fstat64, 2, fd, buf);
+ INTERNAL_SYSCALL_DECL (err);
+ int result = INTERNAL_SYSCALL (fstat64, err, 2, fd, buf);
+ if (__glibc_unlikely (INTERNAL_SYSCALL_ERROR_P (result, err)))
+ INLINE_SYSCALL_ERROR_RETURN (-INTERNAL_SYSCALL_ERRNO (result, err),
+ int, -1)
#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/gai_sigqueue.c b/sysdeps/unix/sysv/linux/gai_sigqueue.c
index 404dd68..95f0911 100644
--- a/sysdeps/unix/sysv/linux/gai_sigqueue.c
+++ b/sysdeps/unix/sysv/linux/gai_sigqueue.c
@@ -47,7 +47,8 @@ __gai_sigqueue (sig, val, caller_pid)
info.si_uid = __getuid ();
info.si_value = val;
- return INLINE_SYSCALL (rt_sigqueueinfo, 3, info.si_pid, sig, &info);
+ INLINE_SYSCALL_RETURN (rt_sigqueueinfo, 3, int, 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 9c691bb..59c82b8 100644
--- a/sysdeps/unix/sysv/linux/getpriority.c
+++ b/sysdeps/unix/sysv/linux/getpriority.c
@@ -34,12 +34,13 @@
int
__getpriority (enum __priority_which which, id_t who)
{
- int res;
-
- res = INLINE_SYSCALL (getpriority, 2, (int) which, who);
- if (res >= 0)
- res = PZERO - res;
- return res;
+ INTERNAL_SYSCALL_DECL (err);
+ int res = INTERNAL_SYSCALL (getpriority, err, 2, (int) which, who);
+ if (__glibc_unlikely (INTERNAL_SYSCALL_ERROR_P (res, err)))
+ INLINE_SYSCALL_ERROR_RETURN (-INTERNAL_SYSCALL_ERRNO (res, err),
+ int, -1)
+ else
+ return PZERO - 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 100ba62..739304a 100644
--- a/sysdeps/unix/sysv/linux/getrlimit64.c
+++ b/sysdeps/unix/sysv/linux/getrlimit64.c
@@ -27,7 +27,7 @@ int
__getrlimit64 (enum __rlimit_resource resource, struct rlimit64 *rlimits)
{
#ifdef __ASSUME_PRLIMIT64
- return INLINE_SYSCALL (prlimit64, 4, 0, resource, NULL, rlimits);
+ INLINE_SYSCALL_RETURN (prlimit64, 4, int, 0, resource, NULL, rlimits)
#else
# ifdef __NR_prlimit64
int res = INLINE_SYSCALL (prlimit64, 4, 0, resource, NULL, rlimits);
diff --git a/sysdeps/unix/sysv/linux/llseek.c b/sysdeps/unix/sysv/linux/llseek.c
index 80ac5e6..05c3bab 100644
--- a/sysdeps/unix/sysv/linux/llseek.c
+++ b/sysdeps/unix/sysv/linux/llseek.c
@@ -29,10 +29,16 @@ loff_t
__llseek (int fd, loff_t offset, int whence)
{
loff_t retval;
-
- return (loff_t) (INLINE_SYSCALL (_llseek, 5, fd, (off_t) (offset >> 32),
- (off_t) (offset & 0xffffffff),
- &retval, whence) ?: 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)))
+ INLINE_SYSCALL_ERROR_RETURN (-INTERNAL_SYSCALL_ERRNO (result, err),
+ loff_t, -1)
+ else
+ return 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 9e51305..f3a9eee 100644
--- a/sysdeps/unix/sysv/linux/lutimes.c
+++ b/sysdeps/unix/sysv/linux/lutimes.c
@@ -43,11 +43,10 @@ lutimes (const char *file, const struct timeval tvp[2])
TIMEVAL_TO_TIMESPEC (&tvp[1], &ts[1]);
}
- return INLINE_SYSCALL (utimensat, 4, AT_FDCWD, file, tvp ? ts : NULL,
- AT_SYMLINK_NOFOLLOW);
+ INLINE_SYSCALL_RETURN (utimensat, 4, int, AT_FDCWD, file,
+ tvp ? ts : NULL, AT_SYMLINK_NOFOLLOW)
#else
- __set_errno (ENOSYS);
- return -1;
+ INLINE_SYSCALL_ERROR_RETURN (-ENOSYS, int, -1)
#endif
}
diff --git a/sysdeps/unix/sysv/linux/lxstat.c b/sysdeps/unix/sysv/linux/lxstat.c
index 948665c..b2fe663 100644
--- a/sysdeps/unix/sysv/linux/lxstat.c
+++ b/sysdeps/unix/sysv/linux/lxstat.c
@@ -35,20 +35,20 @@ int
__lxstat (int vers, const char *name, struct stat *buf)
{
if (vers == _STAT_VER_KERNEL)
- return INLINE_SYSCALL (lstat, 2, name, (struct kernel_stat *) buf);
+ INLINE_SYSCALL_ERROR_RETURN (lstat, 2, int, name,
+ (struct kernel_stat *) buf);
#ifdef STAT_IS_KERNEL_STAT
- errno = EINVAL;
- return -1;
+ INLINE_SYSCALL_ERROR_RETURN (-EINVAL, int, -1)
#else
struct kernel_stat kbuf;
- int result;
-
- result = INLINE_SYSCALL (lstat, 2, name, &kbuf);
- if (result == 0)
- result = __xstat_conv (vers, &kbuf, buf);
-
- return result;
+ INTERNAL_SYSCALL_DECL (err);
+ int result = INTERNAL_SYSCALL (lstat, err, 2, name, &kbuf);
+ if (__glibc_unlikely (INTERNAL_SYSCALL_ERROR_P (result, err)))
+ INLINE_SYSCALL_ERROR_RETURN (-INTERNAL_SYSCALL_ERRNO (result, err),
+ int, -1)
+ else
+ return __xstat_conv (vers, &kbuf, buf);
#endif
}
diff --git a/sysdeps/unix/sysv/linux/lxstat64.c b/sysdeps/unix/sysv/linux/lxstat64.c
index 5d0c051..015150d 100644
--- a/sysdeps/unix/sysv/linux/lxstat64.c
+++ b/sysdeps/unix/sysv/linux/lxstat64.c
@@ -30,8 +30,11 @@
int
___lxstat64 (int vers, const char *name, struct stat64 *buf)
{
- int result;
- result = INLINE_SYSCALL (lstat64, 2, name, buf);
+ INTERNAL_SYSCALL_DECL (err);
+ int result = INTERNAL_SYSCALL (lstat64, err, 2, name, buf);
+ if (__glibc_unlikely (INTERNAL_SYSCALL_ERROR_P (result, err)))
+ INLINE_SYSCALL_ERROR_RETURN (-INTERNAL_SYSCALL_ERRNO (result, err),
+ int, -1)
#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 0b160b6..9b5e499 100644
--- a/sysdeps/unix/sysv/linux/mmap64.c
+++ b/sysdeps/unix/sysv/linux/mmap64.c
@@ -46,15 +46,9 @@ __mmap64 (void *addr, size_t len, int prot, int flags, int fd, off64_t offset)
}
#endif
if (offset & ((1 << page_shift) - 1))
- {
- __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;
+ INLINE_SYSCALL_ERROR_RETURN (-EINVAL, void *, MAP_FAILED)
+ INLINE_SYSCALL_RETURN (mmap2, 6, void *, addr,
+ len, prot, flags, fd,
+ (off_t) (offset >> page_shift));
}
weak_alias (__mmap64, mmap64)
diff --git a/sysdeps/unix/sysv/linux/mq_close.c b/sysdeps/unix/sysv/linux/mq_close.c
index 58d5aea..e811143 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 (close, 1, mqdes);
+ INLINE_SYSCALL_RETURN (close, 1, int, mqdes)
}
#else
diff --git a/sysdeps/unix/sysv/linux/mq_open.c b/sysdeps/unix/sysv/linux/mq_open.c
index 46c0cc8..8bf2fc4 100644
--- a/sysdeps/unix/sysv/linux/mq_open.c
+++ b/sysdeps/unix/sysv/linux/mq_open.c
@@ -52,7 +52,7 @@ __mq_open (const char *name, int oflag, ...)
va_end (ap);
}
- return INLINE_SYSCALL (mq_open, 4, name + 1, oflag, mode, attr);
+ INLINE_SYSCALL_RETURN (mq_open, 4, int, name + 1, oflag, mode, attr)
}
strong_alias (__mq_open, mq_open);
diff --git a/sysdeps/unix/sysv/linux/msgget.c b/sysdeps/unix/sysv/linux/msgget.c
index ca8932c..615a447 100644
--- a/sysdeps/unix/sysv/linux/msgget.c
+++ b/sysdeps/unix/sysv/linux/msgget.c
@@ -32,5 +32,5 @@ msgget (key, msgflg)
key_t key;
int msgflg;
{
- return INLINE_SYSCALL (ipc, 5, IPCOP_msgget, key, msgflg, 0, NULL);
+ INLINE_SYSCALL_RETURN (ipc, 5, int, IPCOP_msgget, key, msgflg, 0, NULL)
}
diff --git a/sysdeps/unix/sysv/linux/prlimit.c b/sysdeps/unix/sysv/linux/prlimit.c
index db88ba8..fb17639 100644
--- a/sysdeps/unix/sysv/linux/prlimit.c
+++ b/sysdeps/unix/sysv/linux/prlimit.c
@@ -44,10 +44,14 @@ prlimit (__pid_t pid, enum __rlimit_resource resource,
new_rlimit64 = &new_rlimit64_mem;
}
- int res = INLINE_SYSCALL (prlimit64, 4, pid, resource, new_rlimit64,
- old_rlimit64);
+ INTERNAL_SYSCALL_DECL (err);
+ int res = INTERNAL_SYSCALL (prlimit64, err, 4, pid, resource,
+ new_rlimit64, old_rlimit64);
- if (res == 0 && old_rlimit != NULL)
+ if (__glibc_unlikely (INTERNAL_SYSCALL_ERROR_P (res, err)))
+ INLINE_SYSCALL_ERROR_RETURN (-INTERNAL_SYSCALL_ERRNO (res, err),
+ int, -1)
+ else if (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
@@ -59,20 +63,14 @@ prlimit (__pid_t pid, enum __rlimit_resource resource,
if (old_rlimit->rlim_cur != old_rlimit64_mem.rlim_cur)
{
if (new_rlimit == NULL)
- {
- __set_errno (EOVERFLOW);
- return -1;
- }
+ INLINE_SYSCALL_ERROR_RETURN (-EOVERFLOW, int, -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)
- {
- __set_errno (EOVERFLOW);
- return -1;
- }
+ INLINE_SYSCALL_ERROR_RETURN (-EOVERFLOW, int, -1)
old_rlimit->rlim_max = RLIM_INFINITY;
}
}
diff --git a/sysdeps/unix/sysv/linux/pt-raise.c b/sysdeps/unix/sysv/linux/pt-raise.c
index 307b9dc..b2f2d54 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 (tgkill, 3, pid, THREAD_GETMEM (THREAD_SELF, tid),
- sig);
+ INLINE_SYSCALL_RETURN (tgkill, 3, int, pid,
+ THREAD_GETMEM (THREAD_SELF, tid), sig);
}
diff --git a/sysdeps/unix/sysv/linux/raise.c b/sysdeps/unix/sysv/linux/raise.c
index e281063..e07c9f7 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 (tgkill, 3, pid, selftid, sig);
+ INLINE_SYSCALL_RETURN (tgkill, 3, int, 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 c47df0d..51fb4f8 100644
--- a/sysdeps/unix/sysv/linux/readahead.c
+++ b/sysdeps/unix/sysv/linux/readahead.c
@@ -29,10 +29,10 @@
ssize_t
__readahead (int fd, off64_t offset, size_t count)
{
- return INLINE_SYSCALL (readahead, 4, fd,
+ INLINE_SYSCALL_RETURN (readahead, 4, int, fd,
__LONG_LONG_PAIR ((off_t) (offset >> 32),
(off_t) (offset & 0xffffffff)),
- count);
+ count)
}
#else
ssize_t
diff --git a/sysdeps/unix/sysv/linux/reboot.c b/sysdeps/unix/sysv/linux/reboot.c
index a016321..4a7413d 100644
--- a/sysdeps/unix/sysv/linux/reboot.c
+++ b/sysdeps/unix/sysv/linux/reboot.c
@@ -25,5 +25,6 @@
int
reboot (int howto)
{
- return INLINE_SYSCALL (reboot, 3, (int) 0xfee1dead, 672274793, howto);
+ INLINE_SYSCALL_RETURN (reboot, 3, int, (int) 0xfee1dead, 672274793,
+ howto)
}
diff --git a/sysdeps/unix/sysv/linux/sched_getaffinity.c b/sysdeps/unix/sysv/linux/sched_getaffinity.c
index 9850806..97a24b9 100644
--- a/sysdeps/unix/sysv/linux/sched_getaffinity.c
+++ b/sysdeps/unix/sysv/linux/sched_getaffinity.c
@@ -25,12 +25,21 @@
#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)
{
- int res = INLINE_SYSCALL (sched_getaffinity, 3, pid,
- MIN (INT_MAX, cpusetsize), cpuset);
- if (res != -1)
+ 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)))
+ INLINE_SYSCALL_ERROR_RETURN (-INTERNAL_SYSCALL_ERRNO (res, err),
+ int, -1)
+ else
{
/* Clean the rest of the memory the kernel didn't do. */
memset ((char *) cpuset + res, '\0', cpusetsize - res);
@@ -44,6 +53,8 @@ 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 7221ff2..af4f4fa 100644
--- a/sysdeps/unix/sysv/linux/semget.c
+++ b/sysdeps/unix/sysv/linux/semget.c
@@ -33,5 +33,6 @@ semget (key, nsems, semflg)
int nsems;
int semflg;
{
- return INLINE_SYSCALL (ipc, 5, IPCOP_semget, key, nsems, semflg, NULL);
+ INLINE_SYSCALL_RETURN (ipc, 5, int, IPCOP_semget, key, nsems, semflg,
+ NULL)
}
diff --git a/sysdeps/unix/sysv/linux/semop.c b/sysdeps/unix/sysv/linux/semop.c
index dc936be..b5d3e17 100644
--- a/sysdeps/unix/sysv/linux/semop.c
+++ b/sysdeps/unix/sysv/linux/semop.c
@@ -31,5 +31,6 @@ semop (semid, sops, nsops)
struct sembuf *sops;
size_t nsops;
{
- return INLINE_SYSCALL (ipc, 5, IPCOP_semop, semid, (int) nsops, 0, sops);
+ INLINE_SYSCALL_RETURN (ipc, 5, int, IPCOP_semop, semid, (int) nsops, 0,
+ sops)
}
diff --git a/sysdeps/unix/sysv/linux/semtimedop.c b/sysdeps/unix/sysv/linux/semtimedop.c
index 02df07e..a351a7d 100644
--- a/sysdeps/unix/sysv/linux/semtimedop.c
+++ b/sysdeps/unix/sysv/linux/semtimedop.c
@@ -32,7 +32,6 @@ semtimedop (semid, sops, nsops, timeout)
size_t nsops;
const struct timespec *timeout;
{
- return INLINE_SYSCALL (ipc, 6, IPCOP_semtimedop,
- semid, (int) nsops, 0, sops,
- timeout);
+ INLINE_SYSCALL_RETURN (ipc, 6, int, 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 17f95cb..cd438ce 100644
--- a/sysdeps/unix/sysv/linux/setrlimit64.c
+++ b/sysdeps/unix/sysv/linux/setrlimit64.c
@@ -30,7 +30,7 @@ setrlimit64 (resource, rlimits)
const struct rlimit64 *rlimits;
{
#ifdef __ASSUME_PRLIMIT64
- return INLINE_SYSCALL (prlimit64, 4, 0, resource, rlimits, NULL);
+ INLINE_SYSCALL_RETURN (prlimit64, 4, int, 0, resource, rlimits, NULL)
#else
# ifdef __NR_prlimit64
int res = INLINE_SYSCALL (prlimit64, 4, 0, resource, rlimits, NULL);
diff --git a/sysdeps/unix/sysv/linux/shmdt.c b/sysdeps/unix/sysv/linux/shmdt.c
index 51bad71..240b8df 100644
--- a/sysdeps/unix/sysv/linux/shmdt.c
+++ b/sysdeps/unix/sysv/linux/shmdt.c
@@ -30,5 +30,6 @@ int
shmdt (shmaddr)
const void *shmaddr;
{
- return INLINE_SYSCALL (ipc, 5, IPCOP_shmdt, 0, 0, 0, (void *) shmaddr);
+ INLINE_SYSCALL_RETURN (ipc, 5, int, IPCOP_shmdt, 0, 0, 0,
+ (void *) shmaddr)
}
diff --git a/sysdeps/unix/sysv/linux/shmget.c b/sysdeps/unix/sysv/linux/shmget.c
index b3d74e6..1349565 100644
--- a/sysdeps/unix/sysv/linux/shmget.c
+++ b/sysdeps/unix/sysv/linux/shmget.c
@@ -33,5 +33,6 @@ shmget (key, size, shmflg)
size_t size;
int shmflg;
{
- return INLINE_SYSCALL (ipc, 5, IPCOP_shmget, key, size, shmflg, NULL);
+ INLINE_SYSCALL_RETURN (ipc, 5, int, IPCOP_shmget, key, size, shmflg,
+ NULL)
}
diff --git a/sysdeps/unix/sysv/linux/signalfd.c b/sysdeps/unix/sysv/linux/signalfd.c
index f3ae8c1..efad019 100644
--- a/sysdeps/unix/sysv/linux/signalfd.c
+++ b/sysdeps/unix/sysv/linux/signalfd.c
@@ -26,11 +26,13 @@ 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
+ int res = INLINE_SYSCALL (signalfd4, 4, fd, mask, _NSIG / 8, flags);
if (res != -1 || errno != ENOSYS)
-# endif
return res;
+# else
+ INLINE_SYSCALL_RETURN (signalfd4, 4, int, fd, mask, _NSIG / 8, flags)
+# endif
#endif
#ifndef __ASSUME_SIGNALFD4
@@ -39,16 +41,12 @@ signalfd (int fd, const sigset_t *mask, int flags)
kernel (sys_indirect) before implementing setting flags like
O_NONBLOCK etc. */
if (flags != 0)
- {
- __set_errno (EINVAL);
- return -1;
- }
+ INLINE_SYSCALL_ERROR_RETURN (-EINVAL, int, -1)
# ifdef __NR_signalfd
- return INLINE_SYSCALL (signalfd, 3, fd, mask, _NSIG / 8);
+ INLINE_SYSCALL_RETURN (signalfd, 3, int, fd, mask, _NSIG / 8)
# else
- __set_errno (ENOSYS);
- return -1;
+ INLINE_SYSCALL_ERROR_RETURN (-ENOSYS, int, -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 c8f3a8e..7c6f62f 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 (rt_sigpending, 2, set, _NSIG / 8);
+ INLINE_SYSCALL_RETURN (rt_sigpending, 2, int, set, _NSIG / 8)
}
diff --git a/sysdeps/unix/sysv/linux/sigprocmask.c b/sysdeps/unix/sysv/linux/sigprocmask.c
index 574f0d2..03ba586 100644
--- a/sysdeps/unix/sysv/linux/sigprocmask.c
+++ b/sysdeps/unix/sysv/linux/sigprocmask.c
@@ -54,6 +54,7 @@ __sigprocmask (how, set, oset)
}
#endif
- return INLINE_SYSCALL (rt_sigprocmask, 4, how, set, oset, _NSIG / 8);
+ INLINE_SYSCALL_RETURN (rt_sigprocmask, 4, int, 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 7970a7c..9f33b47 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 (rt_sigqueueinfo, 3, pid, sig, &info);
+ INLINE_SYSCALL_RETURN (rt_sigqueueinfo, 3, int, pid, sig, &info)
}
weak_alias (__sigqueue, sigqueue)
#else
diff --git a/sysdeps/unix/sysv/linux/statfs64.c b/sysdeps/unix/sysv/linux/statfs64.c
index ac5c33f..edf2690 100644
--- a/sysdeps/unix/sysv/linux/statfs64.c
+++ b/sysdeps/unix/sysv/linux/statfs64.c
@@ -37,12 +37,14 @@ __statfs64 (const char *file, struct statfs64 *buf)
if (! __no_statfs64)
# endif
{
+# if __ASSUME_STATFS64 == 0
int result = INLINE_SYSCALL (statfs64, 3, file, sizeof (*buf), buf);
-# if __ASSUME_STATFS64 == 0
if (result == 0 || errno != ENOSYS)
-# endif
return result;
+# else
+ INLINE_SYSCALL_RETURN (statfs64, 3, int, file, sizeof (*buf), buf)
+# endif
# if __ASSUME_STATFS64 == 0
__no_statfs64 = 1;
diff --git a/sysdeps/unix/sysv/linux/sysctl.c b/sysdeps/unix/sysv/linux/sysctl.c
index 2d4eb1d..27720b0 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 (_sysctl, 1, &args);
+ INLINE_SYSCALL_RETURN (_sysctl, 1, int, &args)
}
libc_hidden_def (__sysctl)
weak_alias (__sysctl, sysctl)
diff --git a/sysdeps/unix/sysv/linux/tcsetattr.c b/sysdeps/unix/sysv/linux/tcsetattr.c
index d7afc63..a208bcf 100644
--- a/sysdeps/unix/sysv/linux/tcsetattr.c
+++ b/sysdeps/unix/sysv/linux/tcsetattr.c
@@ -61,8 +61,7 @@ tcsetattr (fd, optional_actions, termios_p)
cmd = TCSETSF;
break;
default:
- __set_errno (EINVAL);
- return -1;
+ INLINE_SYSCALL_ERROR_RETURN (-EINVAL, int, -1);
}
k_termios.c_iflag = termios_p->c_iflag & ~IBAUD0;
@@ -79,6 +78,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 (ioctl, 3, fd, cmd, &k_termios);
+ INLINE_SYSCALL_RETURN (ioctl, 3, int, 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 8f00192..11d4ba3 100644
--- a/sysdeps/unix/sysv/linux/timer_getoverr.c
+++ b/sysdeps/unix/sysv/linux/timer_getoverr.c
@@ -35,7 +35,5 @@ timer_getoverrun (timerid)
struct timer *kt = (struct timer *) timerid;
/* Get the information from the kernel. */
- int res = INLINE_SYSCALL (timer_getoverrun, 1, kt->ktimerid);
-
- return res;
+ INLINE_SYSCALL_RETURN (timer_getoverrun, 1, int, kt->ktimerid)
}
diff --git a/sysdeps/unix/sysv/linux/timer_gettime.c b/sysdeps/unix/sysv/linux/timer_gettime.c
index 79705cf..cf7956e 100644
--- a/sysdeps/unix/sysv/linux/timer_gettime.c
+++ b/sysdeps/unix/sysv/linux/timer_gettime.c
@@ -37,7 +37,5 @@ timer_gettime (timerid, value)
struct timer *kt = (struct timer *) timerid;
/* Delete the kernel timer object. */
- int res = INLINE_SYSCALL (timer_gettime, 2, kt->ktimerid, value);
-
- return res;
+ INLINE_SYSCALL_RETURN (timer_gettime, 2, int, kt->ktimerid, value)
}
diff --git a/sysdeps/unix/sysv/linux/timer_settime.c b/sysdeps/unix/sysv/linux/timer_settime.c
index 87c6519..fcfadf2 100644
--- a/sysdeps/unix/sysv/linux/timer_settime.c
+++ b/sysdeps/unix/sysv/linux/timer_settime.c
@@ -39,8 +39,6 @@ timer_settime (timerid, flags, value, ovalue)
struct timer *kt = (struct timer *) timerid;
/* Delete the kernel timer object. */
- int res = INLINE_SYSCALL (timer_settime, 4, kt->ktimerid, flags,
- value, ovalue);
-
- return res;
+ INLINE_SYSCALL_RETURN (timer_settime, 4, int, kt->ktimerid, flags,
+ value, ovalue)
}
diff --git a/sysdeps/unix/sysv/linux/truncate64.c b/sysdeps/unix/sysv/linux/truncate64.c
index 0002247..3b75a0b 100644
--- a/sysdeps/unix/sysv/linux/truncate64.c
+++ b/sysdeps/unix/sysv/linux/truncate64.c
@@ -29,7 +29,6 @@ truncate64 (const char *path, off64_t length)
{
unsigned int low = length & 0xffffffff;
unsigned int high = length >> 32;
- int result = INLINE_SYSCALL (truncate64, 3, path,
- __LONG_LONG_PAIR (high, low));
- return result;
+ INLINE_SYSCALL_RETURN (truncate64, 3, int, path,
+ __LONG_LONG_PAIR (high, low))
}
diff --git a/sysdeps/unix/sysv/linux/ustat.c b/sysdeps/unix/sysv/linux/ustat.c
index 8d495ca..9513f4a 100644
--- a/sysdeps/unix/sysv/linux/ustat.c
+++ b/sysdeps/unix/sysv/linux/ustat.c
@@ -31,10 +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)
- {
- __set_errno (EINVAL);
- return -1;
- }
+ INLINE_SYSCALL_ERROR_RETURN (-EINVAL, int, -1)
- return INLINE_SYSCALL (ustat, 2, (unsigned int) k_dev, ubuf);
+ INLINE_SYSCALL_RETURN (ustat, 2, int, (unsigned int) k_dev, ubuf)
}
diff --git a/sysdeps/unix/sysv/linux/utimensat.c b/sysdeps/unix/sysv/linux/utimensat.c
index 81b565f..c0ed4a4 100644
--- a/sysdeps/unix/sysv/linux/utimensat.c
+++ b/sysdeps/unix/sysv/linux/utimensat.c
@@ -30,16 +30,12 @@ utimensat (int fd, const char *file, const struct timespec tsp[2],
int flags)
{
if (file == NULL)
- {
- __set_errno (EINVAL);
- return -1;
- }
+ INLINE_SYSCALL_ERROR_RETURN (-EINVAL, int, -1)
#ifdef __NR_utimensat
/* Avoid implicit array coercion in syscall macros. */
- return INLINE_SYSCALL (utimensat, 4, fd, file, &tsp[0], flags);
+ INLINE_SYSCALL_RETURN (utimensat, 4, int, fd, file, &tsp[0], flags)
#else
- __set_errno (ENOSYS);
- return -1;
+ INLINE_SYSCALL_ERROR_RETURN (-ENOSYS, int, -1)
#endif
}
#ifndef __NR_utimensat
diff --git a/sysdeps/unix/sysv/linux/utimes.c b/sysdeps/unix/sysv/linux/utimes.c
index 2a1f2f9..7ce324a 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 (utimes, 2, file, &tvp[0]);
+ INLINE_SYSCALL_RETURN (utimes, 2, int, file, &tvp[0])
}
weak_alias (__utimes, utimes)
diff --git a/sysdeps/unix/sysv/linux/xmknod.c b/sysdeps/unix/sysv/linux/xmknod.c
index b940273..f871ec0 100644
--- a/sysdeps/unix/sysv/linux/xmknod.c
+++ b/sysdeps/unix/sysv/linux/xmknod.c
@@ -33,20 +33,14 @@ __xmknod (int vers, const char *path, mode_t mode, dev_t *dev)
unsigned long long int k_dev;
if (vers != _MKNOD_VER)
- {
- __set_errno (EINVAL);
- return -1;
- }
+ INLINE_SYSCALL_ERROR_RETURN (-EINVAL, int, -1)
/* We must convert the value to dev_t type used by the kernel. */
k_dev = (*dev) & ((1ULL << 32) - 1);
if (k_dev != *dev)
- {
- __set_errno (EINVAL);
- return -1;
- }
+ INLINE_SYSCALL_ERROR_RETURN (-EINVAL, int, -1)
- return INLINE_SYSCALL (mknod, 3, path, mode, (unsigned int) k_dev);
+ INLINE_SYSCALL_RETURN (mknod, 3, int, 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 f30b9b3..3428e30 100644
--- a/sysdeps/unix/sysv/linux/xmknodat.c
+++ b/sysdeps/unix/sysv/linux/xmknodat.c
@@ -34,20 +34,15 @@ int
__xmknodat (int vers, int fd, const char *file, mode_t mode, dev_t *dev)
{
if (vers != _MKNOD_VER)
- {
- __set_errno (EINVAL);
- return -1;
- }
+ INLINE_SYSCALL_ERROR_RETURN (-EINVAL, int, -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)
- {
- __set_errno (EINVAL);
- return -1;
- }
+ INLINE_SYSCALL_ERROR_RETURN (-EINVAL, int, -1)
- return INLINE_SYSCALL (mknodat, 4, fd, file, mode, (unsigned int) k_dev);
+ INLINE_SYSCALL_RETURN (mknodat, 4, int, 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 6218963..f7b36fa 100644
--- a/sysdeps/unix/sysv/linux/xstat.c
+++ b/sysdeps/unix/sysv/linux/xstat.c
@@ -35,20 +35,20 @@ int
__xstat (int vers, const char *name, struct stat *buf)
{
if (vers == _STAT_VER_KERNEL)
- return INLINE_SYSCALL (stat, 2, name, (struct kernel_stat *) buf);
+ INLINE_SYSCALL_RETURN (stat, 2, int, name, (struct kernel_stat *) buf)
#ifdef STAT_IS_KERNEL_STAT
errno = EINVAL;
return -1;
#else
struct kernel_stat kbuf;
- int result;
-
- result = INLINE_SYSCALL (stat, 2, name, &kbuf);
- if (result == 0)
- result = __xstat_conv (vers, &kbuf, buf);
-
- return result;
+ INTERNAL_SYSCALL_DECL (err);
+ int result = INTERNAL_SYSCALL (stat, err, 2, name, &kbuf);
+ if (__glibc_unlikely (INTERNAL_SYSCALL_ERROR_P (result, err)))
+ INLINE_SYSCALL_ERROR_RETURN (-INTERNAL_SYSCALL_ERRNO (result, err),
+ int, -1)
+ else
+ return __xstat_conv (vers, &kbuf, buf);
#endif
}
hidden_def (__xstat)
diff --git a/sysdeps/unix/sysv/linux/xstat64.c b/sysdeps/unix/sysv/linux/xstat64.c
index c909b56..8cb970f 100644
--- a/sysdeps/unix/sysv/linux/xstat64.c
+++ b/sysdeps/unix/sysv/linux/xstat64.c
@@ -31,8 +31,11 @@
int
___xstat64 (int vers, const char *name, struct stat64 *buf)
{
- int result;
- result = INLINE_SYSCALL (stat64, 2, name, buf);
+ INTERNAL_SYSCALL_DECL (err);
+ int result = INTERNAL_SYSCALL (stat64, err, 2, name, buf);
+ if (__glibc_unlikely (INTERNAL_SYSCALL_ERROR_P (result, err)))
+ INLINE_SYSCALL_ERROR_RETURN (-INTERNAL_SYSCALL_ERRNO (result, err),
+ int, -1)
#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;
-----------------------------------------------------------------------
hooks/post-receive
--
GNU C Library master sources