mirror of
https://sourceware.org/git/glibc.git
synced 2025-01-03 16:21:06 +00:00
Update.
1999-09-18 Ulrich Drepper <drepper@cygnus.com> * pthread.c (pthread_handle_sigrestart_rt): New function. Use this instead of pthread_handle_sigrestart if the signal is an RT signal. * signals.c: Handle passing through of sighandler arguments also for real-time signals.
This commit is contained in:
parent
c68d04feb7
commit
9cf44e6564
@ -1,3 +1,12 @@
|
|||||||
|
1999-09-18 Ulrich Drepper <drepper@cygnus.com>
|
||||||
|
|
||||||
|
* pthread.c (pthread_handle_sigrestart_rt): New function. Use
|
||||||
|
this instead of pthread_handle_sigrestart if the signal is an RT
|
||||||
|
signal.
|
||||||
|
|
||||||
|
* signals.c: Handle passing through of sighandler arguments also
|
||||||
|
for real-time signals.
|
||||||
|
|
||||||
1999-09-03 Andreas Schwab <schwab@suse.de>
|
1999-09-03 Andreas Schwab <schwab@suse.de>
|
||||||
|
|
||||||
* ptfork.c (__fork): Renamed from fork and use __libc_fork. Add
|
* ptfork.c (__fork): Renamed from fork and use __libc_fork. Add
|
||||||
|
@ -21,6 +21,9 @@
|
|||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
#include <fcntl.h>
|
#include <fcntl.h>
|
||||||
|
#ifdef __i386__
|
||||||
|
# include <ucontext.h>
|
||||||
|
#endif
|
||||||
#include <sys/wait.h>
|
#include <sys/wait.h>
|
||||||
#include <sys/resource.h>
|
#include <sys/resource.h>
|
||||||
#include "pthread.h"
|
#include "pthread.h"
|
||||||
@ -161,6 +164,8 @@ static void pthread_handle_sigrestart(int sig);
|
|||||||
#else
|
#else
|
||||||
static void pthread_handle_sigcancel(int sig, struct sigcontext ctx);
|
static void pthread_handle_sigcancel(int sig, struct sigcontext ctx);
|
||||||
static void pthread_handle_sigrestart(int sig, struct sigcontext ctx);
|
static void pthread_handle_sigrestart(int sig, struct sigcontext ctx);
|
||||||
|
static void pthread_handle_sigrestart_rt(int sig, struct siginfo *si,
|
||||||
|
struct ucontext *uc);
|
||||||
#endif
|
#endif
|
||||||
static void pthread_handle_sigdebug(int sig);
|
static void pthread_handle_sigdebug(int sig);
|
||||||
|
|
||||||
@ -318,7 +323,10 @@ static void pthread_initialize(void)
|
|||||||
#ifndef __i386__
|
#ifndef __i386__
|
||||||
sa.sa_handler = pthread_handle_sigrestart;
|
sa.sa_handler = pthread_handle_sigrestart;
|
||||||
#else
|
#else
|
||||||
sa.sa_handler = (__sighandler_t) pthread_handle_sigrestart;
|
if (__pthread_sig_restart >= SIGRTMIN)
|
||||||
|
sa.sa_handler = (__sighandler_t) pthread_handle_sigrestart_rt;
|
||||||
|
else
|
||||||
|
sa.sa_handler = (__sighandler_t) pthread_handle_sigrestart;
|
||||||
#endif
|
#endif
|
||||||
sigemptyset(&sa.sa_mask);
|
sigemptyset(&sa.sa_mask);
|
||||||
sa.sa_flags = 0;
|
sa.sa_flags = 0;
|
||||||
@ -568,6 +576,20 @@ static void pthread_handle_sigrestart(int sig, struct sigcontext ctx)
|
|||||||
siglongjmp(*THREAD_GETMEM(self, p_signal_jmp), 1);
|
siglongjmp(*THREAD_GETMEM(self, p_signal_jmp), 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef __i386__
|
||||||
|
static void pthread_handle_sigrestart_rt(int sig, struct siginfo *si,
|
||||||
|
struct ucontext *uc)
|
||||||
|
{
|
||||||
|
pthread_descr self;
|
||||||
|
asm volatile ("movw %w0,%%gs" : : "r" (uc->uc_mcontext.gregs[GS]));
|
||||||
|
self = thread_self();
|
||||||
|
THREAD_SETMEM(self, p_signal, sig);
|
||||||
|
if (THREAD_GETMEM(self, p_signal_jmp) != NULL)
|
||||||
|
siglongjmp(*THREAD_GETMEM(self, p_signal_jmp), 1);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
/* The handler for the CANCEL signal checks for cancellation
|
/* The handler for the CANCEL signal checks for cancellation
|
||||||
(in asynchronous mode), for process-wide exit and exec requests.
|
(in asynchronous mode), for process-wide exit and exec requests.
|
||||||
For the thread manager thread, redirect the signal to
|
For the thread manager thread, redirect the signal to
|
||||||
|
@ -19,6 +19,7 @@
|
|||||||
#include "pthread.h"
|
#include "pthread.h"
|
||||||
#include "internals.h"
|
#include "internals.h"
|
||||||
#include "spinlock.h"
|
#include "spinlock.h"
|
||||||
|
#include <ucontext.h>
|
||||||
#include <sigcontextinfo.h>
|
#include <sigcontextinfo.h>
|
||||||
|
|
||||||
int pthread_sigmask(int how, const sigset_t * newmask, sigset_t * oldmask)
|
int pthread_sigmask(int how, const sigset_t * newmask, sigset_t * oldmask)
|
||||||
@ -69,7 +70,11 @@ int pthread_kill(pthread_t thread, int signo)
|
|||||||
|
|
||||||
/* User-provided signal handlers */
|
/* User-provided signal handlers */
|
||||||
typedef void (*arch_sighandler_t) __PMT ((int, SIGCONTEXT));
|
typedef void (*arch_sighandler_t) __PMT ((int, SIGCONTEXT));
|
||||||
static arch_sighandler_t sighandler[NSIG];
|
static union
|
||||||
|
{
|
||||||
|
arch_sighandler_t old;
|
||||||
|
void (*rt) (int, struct siginfo *, struct ucontext *);
|
||||||
|
} sighandler[NSIG];
|
||||||
|
|
||||||
/* The wrapper around user-provided signal handlers */
|
/* The wrapper around user-provided signal handlers */
|
||||||
static void pthread_sighandler(int signo, SIGCONTEXT ctx)
|
static void pthread_sighandler(int signo, SIGCONTEXT ctx)
|
||||||
@ -88,7 +93,30 @@ static void pthread_sighandler(int signo, SIGCONTEXT ctx)
|
|||||||
in_sighandler = THREAD_GETMEM(self, p_in_sighandler);
|
in_sighandler = THREAD_GETMEM(self, p_in_sighandler);
|
||||||
if (in_sighandler == NULL)
|
if (in_sighandler == NULL)
|
||||||
THREAD_SETMEM(self, p_in_sighandler, CURRENT_STACK_FRAME);
|
THREAD_SETMEM(self, p_in_sighandler, CURRENT_STACK_FRAME);
|
||||||
sighandler[signo](signo, SIGCONTEXT_EXTRA_ARGS ctx);
|
sighandler[signo].old(signo, SIGCONTEXT_EXTRA_ARGS 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 = thread_self();
|
||||||
|
char * in_sighandler;
|
||||||
|
/* 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)
|
if (in_sighandler == NULL)
|
||||||
THREAD_SETMEM(self, p_in_sighandler, NULL);
|
THREAD_SETMEM(self, p_in_sighandler, NULL);
|
||||||
}
|
}
|
||||||
@ -110,7 +138,12 @@ int sigaction(int sig, const struct sigaction * act,
|
|||||||
newact = *act;
|
newact = *act;
|
||||||
if (act->sa_handler != SIG_IGN && act->sa_handler != SIG_DFL
|
if (act->sa_handler != SIG_IGN && act->sa_handler != SIG_DFL
|
||||||
&& sig > 0 && sig < NSIG)
|
&& sig > 0 && sig < NSIG)
|
||||||
newact.sa_handler = (__sighandler_t) pthread_sighandler;
|
{
|
||||||
|
if (sig >= SIGRTMIN)
|
||||||
|
newact.sa_handler = (__sighandler_t) pthread_sighandler_rt;
|
||||||
|
else
|
||||||
|
newact.sa_handler = (__sighandler_t) pthread_sighandler;
|
||||||
|
}
|
||||||
newactp = &newact;
|
newactp = &newact;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@ -120,9 +153,11 @@ int sigaction(int sig, const struct sigaction * act,
|
|||||||
if (sig > 0 && sig < NSIG)
|
if (sig > 0 && sig < NSIG)
|
||||||
{
|
{
|
||||||
if (oact != NULL)
|
if (oact != NULL)
|
||||||
oact->sa_handler = (__sighandler_t) sighandler[sig];
|
oact->sa_handler = (__sighandler_t) sighandler[sig].old;
|
||||||
if (act)
|
if (act)
|
||||||
sighandler[sig] = (arch_sighandler_t) act->sa_handler;
|
/* For the assignment is does not matter whether it's a normal
|
||||||
|
or real-time signal. */
|
||||||
|
sighandler[sig].old = (arch_sighandler_t) act->sa_handler;
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@ -153,9 +188,9 @@ int sigwait(const sigset_t * set, int * sig)
|
|||||||
s != __pthread_sig_cancel &&
|
s != __pthread_sig_cancel &&
|
||||||
s != __pthread_sig_debug) {
|
s != __pthread_sig_debug) {
|
||||||
sigdelset(&mask, s);
|
sigdelset(&mask, s);
|
||||||
if (sighandler[s] == NULL ||
|
if (sighandler[s].old == NULL ||
|
||||||
sighandler[s] == (arch_sighandler_t) SIG_DFL ||
|
sighandler[s].old == (arch_sighandler_t) SIG_DFL ||
|
||||||
sighandler[s] == (arch_sighandler_t) SIG_IGN) {
|
sighandler[s].old == (arch_sighandler_t) SIG_IGN) {
|
||||||
sa.sa_handler = pthread_null_sighandler;
|
sa.sa_handler = pthread_null_sighandler;
|
||||||
sigemptyset(&sa.sa_mask);
|
sigemptyset(&sa.sa_mask);
|
||||||
sa.sa_flags = 0;
|
sa.sa_flags = 0;
|
||||||
|
Loading…
Reference in New Issue
Block a user