SIGHUP and Program Flow in a 6.2 Application
Derek Ragona
derek at computinginnovations.com
Wed Mar 5 22:04:14 UTC 2008
At 03:26 PM 3/5/2008, Martin McCormick wrote:
> A SIGHUP signal to a running process needs a signal
>handler like
>
>signal( SIGHUP ,startlogging);
>
> What sort of end statement needs to be in the function
>called to allow program execution to resume back in the main
>caller?
>
> I had put a return; statement in the function and
>noticed that things were wrong after the application stopped
>catching the SIGHUP after the first call.
>
> A gdb trace shows that the signal causes a branch to the
>code pointed to by the signal statement. The code runs and then
>if it reaches the return; statement, the flow is lost and knows
>not where to go next.
>
> Thank you.
>
>
>Martin McCormick WB5AGZ Stillwater, OK
>Systems Engineer
>OSU Information Technology Department Network Operations Group
Nothing needs to be in your handler function to continue running simply
return from your function. However, depending on the signal you may wish
to call the original signal handler. Signals like interrupts are chained
linked lists of handlers. You can choose to break the chain, and have only
your handler called, or keep the chain intact calling the other handlers.
Read the man page on signal for more information.
-Derek
--
This message has been scanned for viruses and
dangerous content by MailScanner, and is
believed to be clean.
More information about the freebsd-questions
mailing list