Re: Strangeness with signals

From: Philippe Troin
Date: Tue Sep 27 2005 - 20:19:48 EST


Simon Kirby <sim@xxxxxxxxxxxxx> 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.

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/