* sigaction question
@ 1995-03-30 5:00 Michel van der List
1995-04-06 4:00 ` Jeffrey M. Denham
0 siblings, 1 reply; 2+ messages in thread
From: Michel van der List @ 1995-03-30 5:00 UTC (permalink / raw)
Hi there.
I was looking through the man pages to try to figure out how
sigaction works. Most things are pretty straight-forward, but
one thing is eluding me. I'm reading about the sa_flags and the
SA_SIGINFO bit:
If this bit is cleared and the signal is caught, the
argument specified by the signal parameter is passed as
the only argument to the signal catching function. Two
additional arguments are also available. The second
argument provides an exception-specific code defined in
<sys/signal.h>; this value is always zero (0) for
nonexception signals. The third argument is a pointer
to a sigcontext structure.
So how many arguments do I get passed to my handler? One or
three? What does it mean when 'the signal parameter is passed
as the only argument', but 'Two additional arguments are also
available'? Can somebody enlighted me? Does somebody have some
example code to get to the sigcontext structure through signal
handling?
a d v
Michel a
e c n
--
----------------------+--------------------------+-----------------------------
Michel van der List | 'Dat typies hollands | The Fox Chase Cancer Center
M_vanderlist@fccc.edu | vingertje' | 7701 Burholme Avenue
(215) 728-3660 | | Philadelphia, PA 19111
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: sigaction question
1995-03-30 5:00 sigaction question Michel van der List
@ 1995-04-06 4:00 ` Jeffrey M. Denham
0 siblings, 0 replies; 2+ messages in thread
From: Jeffrey M. Denham @ 1995-04-06 4:00 UTC (permalink / raw)
In article <3leb5g$72a@taurus.fccc.edu>, Michel van der List <M_vanderList@fccc.edu> writes:
|>Hi there.
|>
|>I was looking through the man pages to try to figure out how
|>sigaction works. Most things are pretty straight-forward, but
|>one thing is eluding me. I'm reading about the sa_flags and the
|>SA_SIGINFO bit:
|>
|> If this bit is cleared and the signal is caught, the
|> argument specified by the signal parameter is passed as
|> the only argument to the signal catching function. Two
|> additional arguments are also available. The second
|> argument provides an exception-specific code defined in
|> <sys/signal.h>; this value is always zero (0) for
|> nonexception signals. The third argument is a pointer
|> to a sigcontext structure.
|>
|>So how many arguments do I get passed to my handler? One or
|>three? What does it mean when 'the signal parameter is passed
|>as the only argument', but 'Two additional arguments are also
|>available'? Can somebody enlighted me? Does somebody have some
|>example code to get to the sigcontext structure through signal
|>handling?
I believe that language has been cleaned up a bit recently.
Basically, the handler is always passed 3 arguments. You can access
as many as you declare for your signal handler, e.g.:
void
handler(int sig)
void
handler(int sig, int code, struct sigcontext *scp)
Etc.
Two events under user control determine the nature of the 2nd and 3rd
arguments:
Argument 2:
If SA_SIGINFO is set for the signal via sigaction(), the second
argument is a siginfo_t *:
void
handler(int sig, siginfo_t *sip, struct sigcontext *scp)
If SA_SIGINFO is not set, the second argument is an int code:
void
handler(int sig, int code, struct sigcontext *scp)
Argument 3:
If the application was built with our System V environment (linked
against libsys5), the third argument becomes a pointer to a ucontext_t:
void
handler(int sig, int OR siginfo_t *, ucontext_t *ucp)
This holds true for our Spec 1170 (XPG4.2) implementation, which
chose to follow the SVID3 specification.
So, what's in the 2nd and 3rd args is independent, and the user has
control over the nature of each one.
Hope that helps.
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~1995-04-06 4:00 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
1995-03-30 5:00 sigaction question Michel van der List
1995-04-06 4:00 ` Jeffrey M. Denham
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox