| James Antill 2005-07-19, 5:54 pm |
| On Tue, 19 Jul 2005 16:17:27 -0400, Michael B Allen wrote:
> I want to register the same signal handler for all signals that simply
> prints information about the signal and then invokes the default behavior
> for that signal. I have tried saving the 'oldact' parameter of sigaction
> but upon inspection all members appear to be NULL and 0.
>
> Is there a way to invoke the default signal handler for a signal for
> which a signal handler has already been registered?
The only way I know how to do this is...
struct sigaction sa;
if (sigemptyset(&sa.sa_mask) == -1)
err(EXIT_FAILURE, "signal init");
sa.sa_flags = SA_RESTART;
sa.sa_handler = SIG_DFL;
if (sigaction(s_ig_num, &sa, NULL) == -1)
err(EXIT_FAILURE, "signal("%d")", s_gi_num);
/* log info. */
vlg_sig_info(vlg, "SIG[%d]: %s\n", s_ig_num, strsignal(s_ig_num));
raise(s_ig_num); /* "call default handler" */
....which obviously only works the first time.
--
James Antill -- james@and.org
http://www.and.org/vstr/httpd
|