On Thu, Nov 12, 2020 at 10:04:08PM +0100, Heinrich Schuchardt wrote: > Am 12. November 2020 22:01:58 MEZ schrieb "Michael Kerrisk (man-pages)" <mtk.manpages@xxxxxxxxx>: > >> Is there a function to change the signal mask without leaving the > >handler? > > > >sigprocmask(2). > > You might want to add a link to the function in the note section. Actually, this is best avoided IMHO: The behaviour of sigprocmask() is unspecified in multithreaded programs, while pthread_sigmask() is not specified to be safe in signal handlers. (Yay, POSIX.) For these reasons, execve()'ing directly from a signal handler is not a great idea. It would probably be better to escape from the signal handler with siglongjmp() or setcontext(), with the target sigjmp_buf or ucontext previously set up do the execve(). With SA_SIGINFO, you can also update uc->uc_sigmask inside the signal handler if you want to change the signal mask on return. But that's awkward to do portably, since sigaddset() and sigdelset() are not specified to be safe in signal handlers either. Cheers ---Dave