Retrieving the caught signal within a handler

Is there a way to retrieve the signal within the signal handler? I would like to know the signal that I caught. Thanks, Joel -- http://wagerlabs.com/

Hello Joel, Tuesday, December 06, 2005, 1:39:10 PM, you wrote: JR> Is there a way to retrieve the signal within the signal handler? JR> I would like to know the signal that I caught. just pass signal number to the handler you installs :) installHandler sigPIPE Ignore Nothing flip mapM_ [sigINT, sigHUP, sigABRT, sigTERM] $ \sig -> do installHandler sig handler Nothing where handler = Catch $ exitWith (ExitFailure 1) replace for example last line with where handler = Catch $ exitWith (ExitFailure sig) -- Best regards, Bulat mailto:bulatz@HotPOP.com

Thanks Bulat! This is what I ended up doing before you posted. Sometimes just the mere fact of asking makes you come up with a solution. I use #haskell for that alot :-). On Dec 6, 2005, at 4:17 PM, Bulat Ziganshin wrote:
Hello Joel,
Tuesday, December 06, 2005, 1:39:10 PM, you wrote:
JR> Is there a way to retrieve the signal within the signal handler?
JR> I would like to know the signal that I caught.
just pass signal number to the handler you installs :)
installHandler sigPIPE Ignore Nothing flip mapM_ [sigINT, sigHUP, sigABRT, sigTERM] $ \sig -> do installHandler sig handler Nothing where handler = Catch $ exitWith (ExitFailure 1)

On a related note, it would be nice if we could get at the information in the siginfo_t structure which can be read about in sigaction(2). John -- John Meacham - ⑆repetae.net⑆john⑈
participants (3)
-
Bulat Ziganshin
-
Joel Reymont
-
John Meacham