Please sign in to comment.
Hurd signals: implement global signal dispositions
Currently each thread has a full "sigstate" structure which keeps track of the signal dispositions, blocking mask and pending signals for this thread. Process-wide signals are delivered to the main thread. However, the semantics for POSIX threads is that all of them share the same signal dispositions, although their blocking masks may differ. Signals sent to the process as a whole can be delivered to any thread which does not block them. This is implemented here in addition to the current behavior: libpthread will call _hurd_sigstate_set_global_rcv to mark newly created threads as global signal receivers, while cthreads-based programs can continue to rely on the Hurd semantics. * hurd/hurdsig.c: Replace _hurd_sigthread with a _hurd_global_sigstate. (_hurd_thread_sigstate): accept MACH_PORT_NULL as the global sigstate's thread. (_hurd_sigstate_set_global_rcv): New function to mark some threads as global signal receiver. (sigstate_is_global_rcv): New function, test a thread's status as a global receiver. (_hurd_sigstate_lock, _hurd_sigstate_unlock): New function, lock a sigstate structure and possibly _hurd_global_sigstate, so that the set of pending signals can be queried safely. (sigstate_clear_pending): New function, pulls a signal out of a thread's pending mask. (_hurd_sigstate_pending): New function, retreive a thread's pending mask, taking into account its status as a global receiver. (_hurd_sigstate_actions): New function, retreive a thread's actions vector, taking into account its status as a global receiver. (abort_thread): Use _hurd_sigstate_actions. (post_signal, post_pending, post_all_pending_signals, _hurd_internal_post_signal): Take into account the possibility of ss == _hurd_global_sigstate. Use _hurd_sigstate_lock, _hurd_sigstate_action and _hurd_sigstate_pending. (_S_msg_sig_post, _S_msg_sig_post_untraced): Post signals against _hurd_global_sigstate instead of _hurd_sigthread. (_hurdsig_init): Initialize _hurd_global_sigstate. * hurd/hurd/signal.h: Document the new behavior of hurd_sigstate.actions. Declare the new symbols _hurd_global_sigstate, _hurd_sigstate_set_global_rcv, _hurd_sigstate_lock, _hurd_sigstate_actions, _hurd_sigstate_pending and _hurd_sigstate_unlock. (_hurd_critical_section_unlock): Update querying of the pending mask. * hurd/hurdmsg.c (get_int): Replace _hurd_sigthread with _hurd_global_sigstate. * sysdeps/mach/hurd/fork.c (__fork): Mark the main thread as a global receiver. Reclaim _hurd_global_sigstate along the with main thread's sigstate. * sysdeps/mach/hurd/sigaction.c (__sigaction), sysdeps/mach/hurd/sigpending.c (__sigpending), sysdeps/mach/hurd/sigprocmask.c (__sigprocmask), sysdeps/mach/hurd/sigsuspend.c (__sigsuspend), sysdeps/mach/hurd/sigwait.c (__sigwait), sysdeps/mach/hurd/spawni.c (__spawni): Use the new accessors to query sigstate pending masks and action vectors. * Versions.def: Add the new version GLIBC_2.13. * hurd/Versions: Export the new symbols _hurd_sigstate_set_global_rcv, _hurd_sigstate_lock, _hurd_sigstate_pending and _hurd_sigstate_unlock, for libpthread's benefit.
- Loading branch information...
Showing with 232 additions and 115 deletions.
- +1 −0 Versions.def
- +7 −0 hurd/Versions
- +26 −9 hurd/hurd/signal.h
- +6 −6 hurd/hurdmsg.c
- +140 −52 hurd/hurdsig.c
- +9 −10 sysdeps/mach/hurd/fork.c
- +8 −8 sysdeps/mach/hurd/sigaction.c
- +3 −3 sysdeps/mach/hurd/sigpending.c
- +4 −4 sysdeps/mach/hurd/sigprocmask.c
- +8 −7 sysdeps/mach/hurd/sigsuspend.c
- +6 −5 sysdeps/mach/hurd/sigwait.c
- +14 −11 sysdeps/mach/hurd/spawni.c
Oops, something went wrong.