summaryrefslogtreecommitdiff
path: root/libc/sysdeps
diff options
context:
space:
mode:
authorEric Andersen <andersen@codepoet.org>2002-01-02 12:18:50 +0000
committerEric Andersen <andersen@codepoet.org>2002-01-02 12:18:50 +0000
commitb88ff80f703931b368d27ebd898accdae5b31e60 (patch)
tree79aa8e4d9b249e165973423a04fb3b4889308aa3 /libc/sysdeps
parentcac4a2ef934d7ac5314c874b88b62e922fc70690 (diff)
Once again, rework the signal handling to be even more correct. We no
longer segfault when running test/signal/sigchld.c, which exposed a bit of a rats nest. The problem ended up being a erroneous syscall defination, but in the process of finding that out, I scrubbed things up nicely and adapted things to use the rt_ signals if they are available. This now passes all the signal tests. -Erik
Diffstat (limited to 'libc/sysdeps')
-rw-r--r--libc/sysdeps/linux/common/syscalls.c80
1 files changed, 65 insertions, 15 deletions
diff --git a/libc/sysdeps/linux/common/syscalls.c b/libc/sysdeps/linux/common/syscalls.c
index d2a04a922..889e15616 100644
--- a/libc/sysdeps/linux/common/syscalls.c
+++ b/libc/sysdeps/linux/common/syscalls.c
@@ -503,12 +503,15 @@ _syscall0(pid_t, setsid);
#endif
//#define __NR_sigaction 67
+#ifndef __NR_rt_sigaction
+#define __NR___sigaction __NR_sigaction
#ifdef L_sigaction
#include <signal.h>
#undef sigaction
-_syscall3(int, sigaction, int, signum, const struct sigaction *, act,
+_syscall3(int, __sigaction, int, signum, const struct sigaction *, act,
struct sigaction *, oldact);
#endif
+#endif
//#define __NR_sgetmask 68
@@ -527,24 +530,28 @@ _syscall2(int, setregid, gid_t, rgid, gid_t, egid);
#endif
//#define __NR_sigsuspend 72
-#define __NR__sigsuspend __NR_sigsuspend
+#ifndef __NR_rt_sigsuspend
+#define __NR___sigsuspend __NR_sigsuspend
#ifdef L__sigsuspend
#include <signal.h>
-#undef _sigsuspend
-_syscall1(int, _sigsuspend, unsigned long int, mask);
+#undef sigsuspend
+_syscall3(int, __sigsuspend, int a, unsigned long int b, unsigned long int, c);
int sigsuspend (const sigset_t *set)
{
- return _sigsuspend(set->__val[0]);
+ return __sigsuspend(0, 0, set->__val[0]);
}
#endif
+#endif
//#define __NR_sigpending 73
+#ifndef __NR_rt_sigpending
#ifdef L_sigpending
#include <signal.h>
#undef sigpending
_syscall1(int, sigpending, sigset_t *, set);
#endif
+#endif
//#define __NR_sethostname 74
#ifdef L_sethostname
@@ -956,11 +963,13 @@ _syscall3(int, mprotect, void *, addr, size_t, len, int, prot);
#endif
//#define __NR_sigprocmask 126
+#ifndef __NR_rt_sigprocmask
#ifdef L_sigprocmask
#include <signal.h>
#undef sigprocmask
-_syscall3(int, sigprocmask, int, how, const sigset_t *, set, sigset_t *,
- oldset);
+_syscall3(int, sigprocmask, int, how, const sigset_t *, set,
+ sigset_t *, oldset);
+#endif
#endif
//#define __NR_create_module 127
@@ -1058,15 +1067,9 @@ _syscall3(int, getdents, int, fd, char *, dirp, size_t, count);
#include <unistd.h>
extern int _newselect(int n, fd_set *readfds, fd_set *writefds,
fd_set *exceptfds, struct timeval *timeout);
-
_syscall5(int, _newselect, int, n, fd_set *, readfds, fd_set *, writefds,
- fd_set *, exceptfds, struct timeval *, timeout);
-
-int select(int n, fd_set * readfds, fd_set * writefds, fd_set * exceptfds,
- struct timeval *timeout)
-{
- return (_newselect(n, readfds, writefds, exceptfds, timeout));
-}
+ fd_set *, exceptfds, struct timeval *, timeout);
+weak_alias(_newselect, select);
#endif
//#define __NR_flock 143
@@ -1186,11 +1189,58 @@ _syscall3(int, poll, struct pollfd *, fds, unsigned long int, nfds, int, timeout
//#define __NR_prctl 172
//#define __NR_rt_sigreturn 173
//#define __NR_rt_sigaction 174
+#define __NR___rt_sigaction __NR_rt_sigaction
+#ifdef L___rt_sigaction
+#include <signal.h>
+#undef sigaction
+_syscall4(int, __rt_sigaction, int, signum, const struct sigaction *, act,
+ struct sigaction *, oldact, size_t, size);
+#endif
+
//#define __NR_rt_sigprocmask 175
+#define __NR___rt_sigprocmask __NR_rt_sigprocmask
+#ifdef L___rt_sigprocmask
+#include <signal.h>
+#undef sigprocmask
+_syscall4(int, __rt_sigprocmask, int, how, const sigset_t *, set,
+ sigset_t *, oldset, size_t, size);
+
+int sigprocmask(int how, const sigset_t *set, sigset_t *oldset)
+{
+ return __rt_sigprocmask(how, set, oldset, _NSIG/8);
+}
+
+#endif
+
//#define __NR_rt_sigpending 176
+#define __NR___rt_sigpending __NR_rt_sigpending
+#ifdef L___rt_sigpending
+#include <signal.h>
+#undef sigpending
+_syscall2(int, __rt_sigpending, sigset_t *, set, size_t, size);
+
+int sigpending(sigset_t *set)
+{
+ return __rt_sigpending(set, _NSIG/8);
+}
+#endif
+
//#define __NR_rt_sigtimedwait 177
//#define __NR_rt_sigqueueinfo 178
+
//#define __NR_rt_sigsuspend 179
+#define __NR___rt_sigsuspend __NR_rt_sigsuspend
+#ifdef L___rt_sigsuspend
+#include <signal.h>
+#undef _sigsuspend
+_syscall2(int, __rt_sigsuspend, const sigset_t *, mask, size_t, size);
+
+int sigsuspend (const sigset_t *mask)
+{
+ return __rt_sigsuspend(mask, _NSIG/8);
+}
+#endif
+
//#define __NR_pread 180
//#define __NR_pwrite 181
//#define __NR_chown 182