Re: Strangeness with signals

Philippe Troin
2005-09-28T01:19:28Z

Simon Kirby <sim@netnation.com> writes:

> Hi folks,
>
> I'm not sure if this is buggy, strange or just perfectly normal
> behaviour. I was trying to write an application that does some simple
> network performance polling with setitimer() and also keeps a look out
> for SIGWINCH to see if the window size changes. I was interested to
> find out that when I resized the window, the signal was never noticed.
> Even more interesting is the fact that if I run it in strace or even
> GDB to figure out what's going on, it works!
>
> I've simplified the program to this simple test case which will show
> clearly that (both on 2.4 and 2.6), SIGALRM and SIGHUP are received as
> expected but that without setting a special sa_sigaction handler,
> SIGWINCH and SIGCHLD don't appear to wake up sigwaitinfo(). Also,
> applying a sigaction() to all signals won't change the situation unless
> an sa_sigaction is set; sa_handler does not appear to change anything.
>
> Some people mentioned blocked and ignored signals, but as can be seen in
> this example, differing behaviour can be seen across signals even with
> all signals blocked and ignored.

The SIGWINCH and SIGCHLD signals are not generated if their
disposition is set to SIG_DFL. I believe SIGCONT and SIGURG also
behave similarly. If you want to see them from your application, you
have to establish a (potentially empty) signal handler.

Phil.