I have two options:
1) write my own signal handler for SIG_CLD and specify this
as the argument for the signal(SIG_CLD, ---) system call
2) grab the default setting for SIG_CLD from the initial signal call
action=signal(SIG_CLD, SIG_IGN)
as it returns the previous setting and use *this* as an argument
to reset the handler with
signal(SIG_CLD,action)
But I'm still confused...
My personal feeling is this: I prefer to use wait() as my "signal
handler" rather than reproducing it as my own signal handler.
So I prefer option two.
But I am surprised that the signal() system call has no
documented argument to send it for SIG_CLD that will allow
SIG_CLD to be wait()-ed for.
Another way of putting this is, if signal() takes a SIG_DFL argument
to "reset" the signal handler to the *default* action for any
given signal --> why does it not return the handler for SIG_CLD
to its initial state (which IS: when a child process dies the
kernel saves the exit status of the child and stays that way until
the parent calls wait() ). Instead SIG_DFL sets the handler to SIG_IGN,
and the kernel discards the exit status.
Doesn't this seem a bit bizarre?
Thanks for all the responses.
============================================================================
|Rob D. Oliver | Internet: bcst...@bnr.ca| The opinions expressed |
|Bell-Northern Research | ESN: 393-7077 | above are those of the |
|P.O. Box 3511, Station C| Tel: (613) 763-7077 | author and not those of|
|Ottawa, Ontario | | Northern Telecom or |
|K1Y 4H7 | | Bell-Northern Research.|
============================================================================