Re: Should parent's WIFSIGNALED(siginfo->si_status) be true EVEN IF the SIGNAL was caught by the child?

!MAILaRCHIVE_VOTE_RePLACE
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]

On Saturday 22 September 2007 11:49:09 Michael Kerrisk wrote:

...snip...


Attached is a (somewhat) short program that demonstates the behavior.  I 
simply compile it with 'make sigtest'.

My observed behavior is:

$ ./sigtest
sigtest started
child1 started
child2 started
selecting...
sigCaught: 3366 receieved signal 15
sigtest 3366 exiting
sigChld: 3365 receieved signal 17
sigChld: 3365 child 3366 WIFEXITED with childStat 15
sigChld: 3365 child 3366 WIFSIGNALED with si_status 15
select error: Interrupted system call
selecting...
sigCaught: 3367 receieved signal 15
sigtest 3367 exiting
sigChld: 3365 receieved signal 17
sigChld: 3365 child 3367 WIFEXITED with childStat 15
sigChld: 3365 child 3367 WIFSIGNALED with si_status 15
select error: Interrupted system call
selecting...
sigCaught: 3365 receieved signal 15
sigtest 3365 exiting
$

To get this output, I ran, from another shell, the following sequence:

$ ps -eaf | grep sigtest
zoltan    3365  2307  0 13:04 pts/0    00:00:00 ./sigtest
zoltan    3366  3365 98 13:04 pts/0    00:00:06 ./sigtest
zoltan    3367  3365 98 13:04 pts/0    00:00:06 ./sigtest
$ kill -SIGTERM 3366
$ kill -SIGTERM 3367
$ kill -SIGTERM 3365

That's it.  What I find odd is that the wait_pid() status and the 
si_status are the same for both a WIFEXITED and a WIFSIGNALED, which 
should be impossible, if I read the documentation right.

Thanks for your responses,
John
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]

Messages in current thread:
Re: Should parent's WIFSIGNALED(siginfo->si_status) be tr..., John Z. Bohach, (Sat Sep 22, 4:18 pm)