summaryrefslogtreecommitdiff
path: root/libc/sysdeps/linux
diff options
context:
space:
mode:
Diffstat (limited to 'libc/sysdeps/linux')
-rw-r--r--libc/sysdeps/linux/common/__rt_sigtimedwait.c5
-rw-r--r--libc/sysdeps/linux/common/__syscall_fcntl.c9
-rw-r--r--libc/sysdeps/linux/common/__syscall_fcntl64.c7
-rw-r--r--libc/sysdeps/linux/common/bits/syscalls-common.h6
-rw-r--r--libc/sysdeps/linux/common/ioctl.c7
-rw-r--r--libc/sysdeps/linux/common/open.c9
-rw-r--r--libc/sysdeps/linux/common/posix_fadvise64.c7
-rw-r--r--libc/sysdeps/linux/common/pselect.c9
-rw-r--r--libc/sysdeps/linux/common/sched_setaffinity.c9
9 files changed, 44 insertions, 24 deletions
diff --git a/libc/sysdeps/linux/common/__rt_sigtimedwait.c b/libc/sysdeps/linux/common/__rt_sigtimedwait.c
index 422a95201..9c74322ef 100644
--- a/libc/sysdeps/linux/common/__rt_sigtimedwait.c
+++ b/libc/sysdeps/linux/common/__rt_sigtimedwait.c
@@ -25,6 +25,9 @@
int __NC(sigtimedwait)(const sigset_t *set, siginfo_t *info,
const struct timespec *timeout)
{
+# if defined SI_TKILL && defined SI_USER
+ int result;
+# endif
# ifdef SIGCANCEL
sigset_t tmpset;
@@ -50,7 +53,7 @@ int __NC(sigtimedwait)(const sigset_t *set, siginfo_t *info,
/* XXX The size argument hopefully will have to be changed to the
real size of the user-level sigset_t. */
/* on uClibc we use the kernel sigset_t size */
- int result = INLINE_SYSCALL(rt_sigtimedwait, 4, set, info,
+ result = INLINE_SYSCALL(rt_sigtimedwait, 4, set, info,
timeout, __SYSCALL_SIGSET_T_SIZE);
/* The kernel generates a SI_TKILL code in si_code in case tkill is
diff --git a/libc/sysdeps/linux/common/__syscall_fcntl.c b/libc/sysdeps/linux/common/__syscall_fcntl.c
index 17c67182e..86cc60d1a 100644
--- a/libc/sysdeps/linux/common/__syscall_fcntl.c
+++ b/libc/sysdeps/linux/common/__syscall_fcntl.c
@@ -39,6 +39,9 @@ int fcntl(int fd, int cmd, ...)
{
va_list ap;
long arg;
+#ifdef __NEW_THREADS
+ int oldtype, result;
+#endif
va_start (ap, cmd);
arg = va_arg (ap, long);
@@ -51,11 +54,11 @@ int fcntl(int fd, int cmd, ...)
return INLINE_SYSCALL(fcntl64, 3, fd, cmd, arg);
#endif
#ifdef __NEW_THREADS
- int oldtype = LIBC_CANCEL_ASYNC ();
+ oldtype = LIBC_CANCEL_ASYNC ();
#if defined __NR_fcntl
- int result = __NC(fcntl)(fd, cmd, arg);
+ result = __NC(fcntl)(fd, cmd, arg);
#else
- int result = INLINE_SYSCALL(fcntl64, 3, fd, cmd, arg);
+ result = INLINE_SYSCALL(fcntl64, 3, fd, cmd, arg);
#endif
LIBC_CANCEL_RESET (oldtype);
return result;
diff --git a/libc/sysdeps/linux/common/__syscall_fcntl64.c b/libc/sysdeps/linux/common/__syscall_fcntl64.c
index eaef22b3b..88b2b143b 100644
--- a/libc/sysdeps/linux/common/__syscall_fcntl64.c
+++ b/libc/sysdeps/linux/common/__syscall_fcntl64.c
@@ -23,6 +23,9 @@ int fcntl64(int fd, int cmd, ...)
{
long arg;
va_list list;
+# ifdef __NEW_THREADS
+ int oldtype, result;
+# endif
va_start(list, cmd);
arg = va_arg(list, long);
@@ -31,8 +34,8 @@ int fcntl64(int fd, int cmd, ...)
if (SINGLE_THREAD_P || (cmd != F_SETLKW64))
return __NC(fcntl64)(fd, cmd, arg);
# ifdef __NEW_THREADS
- int oldtype = LIBC_CANCEL_ASYNC();
- int result = __NC(fcntl64)(fd, cmd, arg);
+ oldtype = LIBC_CANCEL_ASYNC();
+ result = __NC(fcntl64)(fd, cmd, arg);
LIBC_CANCEL_RESET(oldtype);
return result;
# endif
diff --git a/libc/sysdeps/linux/common/bits/syscalls-common.h b/libc/sysdeps/linux/common/bits/syscalls-common.h
index 86fe26c50..3665345a6 100644
--- a/libc/sysdeps/linux/common/bits/syscalls-common.h
+++ b/libc/sysdeps/linux/common/bits/syscalls-common.h
@@ -42,10 +42,11 @@
# define INLINE_SYSCALL_NCS(num, nr, args...) \
(__extension__ \
({ \
+ long __res; \
INTERNAL_SYSCALL_DECL(__err); \
(__extension__ \
({ \
- long __res = INTERNAL_SYSCALL_NCS(num, __err, nr, args); \
+ __res = INTERNAL_SYSCALL_NCS(num, __err, nr, args); \
if (unlikely(INTERNAL_SYSCALL_ERROR_P(__res, __err))) { \
__set_errno(INTERNAL_SYSCALL_ERRNO(__res, __err)); \
__res = -1L; \
@@ -59,8 +60,9 @@
#ifndef INLINE_SYSCALL_NOERR_NCS
# define INLINE_SYSCALL_NOERR_NCS(num, nr, args...) \
({ \
+ long __res; \
INTERNAL_SYSCALL_DECL(__err); \
- long __res = INTERNAL_SYSCALL_NCS(num, __err, nr, args); \
+ __res = INTERNAL_SYSCALL_NCS(num, __err, nr, args); \
__res; \
})
#endif
diff --git a/libc/sysdeps/linux/common/ioctl.c b/libc/sysdeps/linux/common/ioctl.c
index 9a00e614a..374b6247b 100644
--- a/libc/sysdeps/linux/common/ioctl.c
+++ b/libc/sysdeps/linux/common/ioctl.c
@@ -20,6 +20,9 @@ int ioctl(int fd, unsigned long int request, ...)
{
void *arg;
va_list list;
+#ifdef __NEW_THREADS
+ int oldtype, result;
+#endif
va_start(list, request);
arg = va_arg(list, void *);
@@ -28,8 +31,8 @@ int ioctl(int fd, unsigned long int request, ...)
if (SINGLE_THREAD_P)
return __syscall_ioctl(fd, request, arg);
#ifdef __NEW_THREADS
- int oldtype = LIBC_CANCEL_ASYNC ();
- int result = __syscall_ioctl(fd, request, arg);
+ oldtype = LIBC_CANCEL_ASYNC ();
+ result = __syscall_ioctl(fd, request, arg);
LIBC_CANCEL_RESET (oldtype);
return result;
#endif
diff --git a/libc/sysdeps/linux/common/open.c b/libc/sysdeps/linux/common/open.c
index fd37ea0f0..bfcb341de 100644
--- a/libc/sysdeps/linux/common/open.c
+++ b/libc/sysdeps/linux/common/open.c
@@ -28,6 +28,9 @@ int __open_nocancel(const char *, int, mode_t) __nonnull ((1)) attribute_hidden;
int open(const char *file, int oflag, ...)
{
mode_t mode = 0;
+#ifdef __NEW_THREADS
+ int oldtype, result;
+#endif
if (oflag & O_CREAT) {
va_list arg;
@@ -44,11 +47,11 @@ int open(const char *file, int oflag, ...)
#endif
#ifdef __NEW_THREADS
- int oldtype = LIBC_CANCEL_ASYNC ();
+ oldtype = LIBC_CANCEL_ASYNC ();
# if defined(__NR_open)
- int result = __NC(open)(file, oflag, mode);
+ result = __NC(open)(file, oflag, mode);
# else
- int result = openat(AT_FDCWD, file, oflag, mode);
+ result = openat(AT_FDCWD, file, oflag, mode);
# endif
LIBC_CANCEL_RESET (oldtype);
return result;
diff --git a/libc/sysdeps/linux/common/posix_fadvise64.c b/libc/sysdeps/linux/common/posix_fadvise64.c
index 37fb269ca..eb722ec20 100644
--- a/libc/sysdeps/linux/common/posix_fadvise64.c
+++ b/libc/sysdeps/linux/common/posix_fadvise64.c
@@ -22,22 +22,23 @@
int posix_fadvise64(int fd, off64_t offset, off64_t len, int advice)
{
+ int ret;
INTERNAL_SYSCALL_DECL (err);
/* ARM has always been funky. */
#if defined (__arm__) || \
(defined(__UCLIBC_SYSCALL_ALIGN_64BIT__) && (defined(__powerpc__) || defined(__xtensa__)))
/* arch with 64-bit data in even reg alignment #1: [powerpc/xtensa]
* custom syscall handler (rearranges @advice to avoid register hole punch) */
- int ret = INTERNAL_SYSCALL (fadvise64_64, err, 6, fd, advice,
+ ret = INTERNAL_SYSCALL (fadvise64_64, err, 6, fd, advice,
OFF64_HI_LO (offset), OFF64_HI_LO (len));
#elif defined(__UCLIBC_SYSCALL_ALIGN_64BIT__)
/* arch with 64-bit data in even reg alignment #2: [arcv2/others-in-future]
* stock syscall handler in kernel (reg hole punched) */
- int ret = INTERNAL_SYSCALL (fadvise64_64, err, 7, fd, 0,
+ ret = INTERNAL_SYSCALL (fadvise64_64, err, 7, fd, 0,
OFF64_HI_LO (offset), OFF64_HI_LO (len),
advice);
# else
- int ret = INTERNAL_SYSCALL (fadvise64_64, err, 6, fd,
+ ret = INTERNAL_SYSCALL (fadvise64_64, err, 6, fd,
OFF64_HI_LO (offset), OFF64_HI_LO (len),
advice);
# endif
diff --git a/libc/sysdeps/linux/common/pselect.c b/libc/sysdeps/linux/common/pselect.c
index fbe85b780..bf2c08375 100644
--- a/libc/sysdeps/linux/common/pselect.c
+++ b/libc/sysdeps/linux/common/pselect.c
@@ -36,10 +36,6 @@ static int __NC(pselect)(int nfds, fd_set *readfds, fd_set *writefds,
*/
struct timespec _ts;
- if (timeout != NULL) {
- _ts = *timeout;
- timeout = &_ts;
- }
/* Note: the system call expects 7 values but on most architectures
we can only pass in 6 directly. If there is an architecture with
support for more parameters a new version of this file needs to
@@ -49,6 +45,11 @@ static int __NC(pselect)(int nfds, fd_set *readfds, fd_set *writefds,
__kernel_size_t ss_len;
} data;
+ if (timeout != NULL) {
+ _ts = *timeout;
+ timeout = &_ts;
+ }
+
if (sigmask != NULL) {
data.ss = (__kernel_ulong_t) sigmask;
data.ss_len = __SYSCALL_SIGSET_T_SIZE;
diff --git a/libc/sysdeps/linux/common/sched_setaffinity.c b/libc/sysdeps/linux/common/sched_setaffinity.c
index 927744ea5..3d513ef4b 100644
--- a/libc/sysdeps/linux/common/sched_setaffinity.c
+++ b/libc/sysdeps/linux/common/sched_setaffinity.c
@@ -32,12 +32,13 @@ static size_t __kernel_cpumask_size;
int sched_setaffinity(pid_t pid, size_t cpusetsize, const cpu_set_t *cpuset)
{
size_t cnt;
+ int res;
+ size_t psize = 128;
+ void *p = alloca (psize);
+
if (unlikely (__kernel_cpumask_size == 0)) {
- INTERNAL_SYSCALL_DECL (err);
- int res;
- size_t psize = 128;
- void *p = alloca (psize);
+ INTERNAL_SYSCALL_DECL (err);
while (res = INTERNAL_SYSCALL (sched_getaffinity, err, 3, getpid (),
psize, p),
INTERNAL_SYSCALL_ERROR_P (res, err)