1999-08-19  Ulrich Drepper  <drepper@cygnus.com>

	* signals.c: Pass sigcontext through wrapper to the user function.
This commit is contained in:
Ulrich Drepper 1999-08-19 18:35:13 +00:00
parent e1b13a63d0
commit 70aea399c8
2 changed files with 14 additions and 8 deletions

View File

@ -1,3 +1,7 @@
1999-08-19 Ulrich Drepper <drepper@cygnus.com>
* signals.c: Pass sigcontext through wrapper to the user function.
1999-08-01 Ulrich Drepper <drepper@cygnus.com>
* Versions [ld.so] (GLIBC_2.0): Export __libc_internal_tsd_get and

View File

@ -19,6 +19,7 @@
#include "pthread.h"
#include "internals.h"
#include "spinlock.h"
#include <sigcontextinfo.h>
int pthread_sigmask(int how, const sigset_t * newmask, sigset_t * oldmask)
{
@ -67,10 +68,11 @@ int pthread_kill(pthread_t thread, int signo)
}
/* User-provided signal handlers */
static __sighandler_t sighandler[NSIG];
typedef void (*arch_sighandler_t) __PMT ((int, SIGCONTEXT));
static arch_sighandler_t sighandler[NSIG];
/* The wrapper around user-provided signal handlers */
static void pthread_sighandler(int signo)
static void pthread_sighandler(int signo, SIGCONTEXT ctx)
{
pthread_descr self = thread_self();
char * in_sighandler;
@ -86,7 +88,7 @@ static void pthread_sighandler(int signo)
in_sighandler = THREAD_GETMEM(self, p_in_sighandler);
if (in_sighandler == NULL)
THREAD_SETMEM(self, p_in_sighandler, CURRENT_STACK_FRAME);
sighandler[signo](signo);
sighandler[signo](signo, ctx);
if (in_sighandler == NULL)
THREAD_SETMEM(self, p_in_sighandler, NULL);
}
@ -108,7 +110,7 @@ int sigaction(int sig, const struct sigaction * act,
newact = *act;
if (act->sa_handler != SIG_IGN && act->sa_handler != SIG_DFL
&& sig > 0 && sig < NSIG)
newact.sa_handler = pthread_sighandler;
newact.sa_handler = (__sighandler_t) pthread_sighandler;
newactp = &newact;
}
else
@ -118,9 +120,9 @@ int sigaction(int sig, const struct sigaction * act,
if (sig > 0 && sig < NSIG)
{
if (oact != NULL)
oact->sa_handler = sighandler[sig];
oact->sa_handler = (__sighandler_t) sighandler[sig];
if (act)
sighandler[sig] = act->sa_handler;
sighandler[sig] = (arch_sighandler_t) act->sa_handler;
}
return 0;
}
@ -152,8 +154,8 @@ int sigwait(const sigset_t * set, int * sig)
s != __pthread_sig_debug) {
sigdelset(&mask, s);
if (sighandler[s] == NULL ||
sighandler[s] == SIG_DFL ||
sighandler[s] == SIG_IGN) {
sighandler[s] == (arch_sighandler_t) SIG_DFL ||
sighandler[s] == (arch_sighandler_t) SIG_IGN) {
sa.sa_handler = pthread_null_sighandler;
sigemptyset(&sa.sa_mask);
sa.sa_flags = 0;