aboutsummaryrefslogtreecommitdiff
path: root/hurd/hurdsig.c
diff options
context:
space:
mode:
authorSamuel Thibault <samuel.thibault@ens-lyon.org>2020-12-26 17:57:52 +0100
committerSamuel Thibault <samuel.thibault@ens-lyon.org>2020-12-26 18:03:31 +0100
commite42efa01c9305eb27616bae2bc314d8e44d129e0 (patch)
treefb3768a7fa119aba0d9e51cceb400579f2834865 /hurd/hurdsig.c
parenta39b95b975929f12359d4bc55f25bd88c3ec02c5 (diff)
downloadglibc-e42efa01c9305eb27616bae2bc314d8e44d129e0.tar
glibc-e42efa01c9305eb27616bae2bc314d8e44d129e0.tar.gz
glibc-e42efa01c9305eb27616bae2bc314d8e44d129e0.tar.bz2
glibc-e42efa01c9305eb27616bae2bc314d8e44d129e0.zip
hurd: set sigaction for signal preemptors in arch-independent file
Instead of having the arch-specific trampoline setup code detect whether preemption happened or not, we'd rather pass it the sigaction. In the future, this may also allow to change sa_flags from post_signal().
Diffstat (limited to 'hurd/hurdsig.c')
-rw-r--r--hurd/hurdsig.c22
1 files changed, 16 insertions, 6 deletions
diff --git a/hurd/hurdsig.c b/hurd/hurdsig.c
index 6fdbf383ee..dcc1da35e5 100644
--- a/hurd/hurdsig.c
+++ b/hurd/hurdsig.c
@@ -624,6 +624,13 @@ post_signal (struct hurd_sigstate *ss,
enum { stop, ignore, core, term, handle } act;
int ss_suspended;
+ /* sigaction for preemptors */
+ struct sigaction preempt_sigaction = {
+ .sa_flags = SA_RESTART
+ };
+
+ struct sigaction *action;
+
/* Mark the signal as pending. */
void mark_pending (void)
{
@@ -780,12 +787,17 @@ post_signal (struct hurd_sigstate *ss,
/* Ignore the signal altogether. */
act = ignore;
else if (handler != SIG_ERR)
- /* Run the preemption-provided handler. */
- act = handle;
+ {
+ /* Run the preemption-provided handler. */
+ action = &preempt_sigaction;
+ act = handle;
+ }
else
{
/* No preemption. Do normal handling. */
+ action = & _hurd_sigstate_actions (ss) [signo];
+
if (!untraced && __sigismember (&_hurdsig_traced, signo))
{
/* We are being traced. Stop to tell the debugger of the signal. */
@@ -800,7 +812,7 @@ post_signal (struct hurd_sigstate *ss,
return NULL;
}
- handler = _hurd_sigstate_actions (ss) [signo].sa_handler;
+ handler = action->sa_handler;
if (handler == SIG_DFL)
/* Figure out the default action for this signal. */
@@ -1072,7 +1084,7 @@ post_signal (struct hurd_sigstate *ss,
/* Call the machine-dependent function to set the thread up
to run the signal handler, and preserve its old context. */
- scp = _hurd_setup_sighandler (ss, handler, signo, detail,
+ scp = _hurd_setup_sighandler (ss, action, handler, signo, detail,
wait_for_reply, &thread_state);
if (scp == NULL)
goto sigbomb;
@@ -1111,8 +1123,6 @@ post_signal (struct hurd_sigstate *ss,
}
}
- struct sigaction *action = & _hurd_sigstate_actions (ss) [signo];
-
/* Backdoor extra argument to signal handler. */
scp->sc_error = detail->error;