diff options
author | Ulrich Drepper <drepper@redhat.com> | 2002-05-03 07:39:22 +0000 |
---|---|---|
committer | Ulrich Drepper <drepper@redhat.com> | 2002-05-03 07:39:22 +0000 |
commit | 38a7d8baf498dd46f81ff49ea28eb3b3b7775544 (patch) | |
tree | 9ab47cc3c0a86d3239957903d475564d28cdc5db /linuxthreads/signals.c | |
parent | 3dbbe24e84fe0f5f87e274ffdba56d6bfd552244 (diff) | |
download | glibc-38a7d8baf498dd46f81ff49ea28eb3b3b7775544.tar.gz glibc-38a7d8baf498dd46f81ff49ea28eb3b3b7775544.tar.xz glibc-38a7d8baf498dd46f81ff49ea28eb3b3b7775544.zip |
Update.
2002-05-02 Jakub Jelinek <jakub@redhat.com> * sysdeps/ia64/Makefile: Add ia64libgcc in csu subdir. * sysdeps/ia64/Versions (__divtf3, __divdf3, __divsf3, __divdi3, __moddi3, __udivdi3, __umoddi3, __multi3): Export at GLIBC_2.0. * sysdeps/ia64/ia64libgcc.S: New file. 2002-05-02 Ulrich Drepper <drepper@redhat.com> * sysdeps/generic/dl-tls.c (oom): Implement using _dl_fatal_printf. * malloc/memusage.c: Distinguish anonymous mmap.
Diffstat (limited to 'linuxthreads/signals.c')
-rw-r--r-- | linuxthreads/signals.c | 79 |
1 files changed, 12 insertions, 67 deletions
diff --git a/linuxthreads/signals.c b/linuxthreads/signals.c index da3ce69a4d..a11f865e73 100644 --- a/linuxthreads/signals.c +++ b/linuxthreads/signals.c @@ -20,7 +20,7 @@ #include "internals.h" #include "spinlock.h" #include <ucontext.h> -#include <sigcontextinfo.h> + int pthread_sigmask(int how, const sigset_t * newmask, sigset_t * oldmask) { @@ -68,60 +68,8 @@ int pthread_kill(pthread_t thread, int signo) return 0; } -/* User-provided signal handlers */ -typedef void (*arch_sighandler_t) (int, SIGCONTEXT); -static union -{ - arch_sighandler_t old; - void (*rt) (int, struct siginfo *, struct ucontext *); -} sighandler[NSIG] = { [1 ... NSIG - 1] = { (arch_sighandler_t) SIG_ERR } }; - -/* The wrapper around user-provided signal handlers */ -static void pthread_sighandler(int signo, SIGCONTEXT ctx) -{ - pthread_descr self; - char * in_sighandler; - self = thread_self(); - /* If we're in a sigwait operation, just record the signal received - and return without calling the user's handler */ - if (THREAD_GETMEM(self, p_sigwaiting)) { - THREAD_SETMEM(self, p_sigwaiting, 0); - THREAD_SETMEM(self, p_signal, signo); - return; - } - /* Record that we're in a signal handler and call the user's - handler function */ - in_sighandler = THREAD_GETMEM(self, p_in_sighandler); - if (in_sighandler == NULL) - THREAD_SETMEM(self, p_in_sighandler, CURRENT_STACK_FRAME); - CALL_SIGHANDLER(sighandler[signo].old, signo, ctx); - if (in_sighandler == NULL) - THREAD_SETMEM(self, p_in_sighandler, NULL); -} - -/* The same, this time for real-time signals. */ -static void pthread_sighandler_rt(int signo, struct siginfo *si, - struct ucontext *uc) -{ - pthread_descr self; - char * in_sighandler; - self = thread_self(); - /* If we're in a sigwait operation, just record the signal received - and return without calling the user's handler */ - if (THREAD_GETMEM(self, p_sigwaiting)) { - THREAD_SETMEM(self, p_sigwaiting, 0); - THREAD_SETMEM(self, p_signal, signo); - return; - } - /* Record that we're in a signal handler and call the user's - handler function */ - in_sighandler = THREAD_GETMEM(self, p_in_sighandler); - if (in_sighandler == NULL) - THREAD_SETMEM(self, p_in_sighandler, CURRENT_STACK_FRAME); - sighandler[signo].rt(signo, si, uc); - if (in_sighandler == NULL) - THREAD_SETMEM(self, p_in_sighandler, NULL); -} +union sighandler __sighandler[NSIG] = + { [1 ... NSIG - 1] = { (arch_sighandler_t) SIG_ERR } }; /* The wrapper around sigaction. Install our own signal handler around the signal. */ @@ -145,9 +93,9 @@ int __sigaction(int sig, const struct sigaction * act, && sig > 0 && sig < NSIG) { if (act->sa_flags & SA_SIGINFO) - newact.sa_handler = (__sighandler_t) pthread_sighandler_rt; + newact.sa_handler = (__sighandler_t) __pthread_sighandler_rt; else - newact.sa_handler = (__sighandler_t) pthread_sighandler; + newact.sa_handler = (__sighandler_t) __pthread_sighandler; } newactp = &newact; } @@ -161,20 +109,17 @@ int __sigaction(int sig, const struct sigaction * act, /* We may have inherited SIG_IGN from the parent, so return the kernel's idea of the signal handler the first time through. */ - && (__sighandler_t) sighandler[sig].old != SIG_ERR) - oact->sa_handler = (__sighandler_t) sighandler[sig].old; + && (__sighandler_t) __sighandler[sig].old != SIG_ERR) + oact->sa_handler = (__sighandler_t) __sighandler[sig].old; if (act) /* For the assignment it does not matter whether it's a normal or real-time signal. */ - sighandler[sig].old = (arch_sighandler_t) act->sa_handler; + __sighandler[sig].old = (arch_sighandler_t) act->sa_handler; } return 0; } strong_alias(__sigaction, sigaction) -/* A signal handler that does nothing */ -static void pthread_null_sighandler(int sig) { } - /* sigwait -- synchronously wait for a signal */ int sigwait(const sigset_t * set, int * sig) { @@ -198,10 +143,10 @@ int sigwait(const sigset_t * set, int * sig) s != __pthread_sig_cancel && s != __pthread_sig_debug) { sigdelset(&mask, s); - if (sighandler[s].old == (arch_sighandler_t) SIG_ERR || - sighandler[s].old == (arch_sighandler_t) SIG_DFL || - sighandler[s].old == (arch_sighandler_t) SIG_IGN) { - sa.sa_handler = pthread_null_sighandler; + if (__sighandler[s].old == (arch_sighandler_t) SIG_ERR || + __sighandler[s].old == (arch_sighandler_t) SIG_DFL || + __sighandler[s].old == (arch_sighandler_t) SIG_IGN) { + sa.sa_handler = __pthread_null_sighandler; sigfillset(&sa.sa_mask); sa.sa_flags = 0; sigaction(s, &sa, NULL); |