Re: [hackers] [dwm][PATCH] do not call signal-unsafe function inside sighanlder

From: François-Xavier Carton <>
Date: Thu, 21 Jul 2022 21:13:09 +0200

On Tue, Jul 19, 2022 at 09:27:35AM +0200, Hiltjo Posthuma wrote:
> On Tue, Jul 19, 2022 at 12:05:48AM +0200, François-Xavier Carton wrote:
> > Technically, no standard guarantees that the handler stays after being
> > called once. The implementation could reset it to the default action.
> > One may want to re-add a call to signal here, without error checking, to
> > ensure the handler remains in case SIGCHLD is raised multiple times.
> >
> Do you have a reference of a description of this behaviour in an other system,
> specification or standard?

C89 (, C99 (, POSIX 2001 and 2008 all say that "the
equivalent of signal(sig, SIG_DFL)" may be executed prior to executing
the signal handler (but is not required as long as the signal is blocked
until the handler has returned).

As for implementations, my signal(2) man page says BSD and glibc systems
do not reset the handler, but the linux syscall does, as well as
"original UNIX systems" and System V. I've no idea what other libcs do.
Received on Thu Jul 21 2022 - 21:13:09 CEST

This archive was generated by hypermail 2.3.0 : Thu Jul 21 2022 - 21:24:31 CEST