ssignal, gsignal
Purpose
Implements a software signal facility.
Library
Standard C Library (libc.a)
Syntax
#include <signal.h>
int (*ssignal (sig, action)) ( ) int gsignal (sig)
int sig, (*action) ( ); int sig;
Description
The ssignal and gsignal subroutines implement a software
facility similar to that of the signal and kill system
calls. However, there is no connection between the two
facilities. User programs can use ssignal and gsignal to
handle exceptional processing within an application.
signal and related system calls handle system-defined
exceptions.
The software signals available are associated with inte-
gers in the range 1 through 15. Other values are
reserved for use by the C library and should not be used.
The ssignal subroutine associates the procedure specified
by the action parameter with the software signal speci-
fied by the sig parameter. The gsignal subroutine
"raises" the signal sig, causing the procedure specified
by the action parameter to be taken.
The action parameter is either a pointer to a user-
defined subroutine, or one of the constants SIG_DFL
(default action) and SIG_IGN (ignore signal). The
ssignal subroutine returns the procedure that was previ-
ously established for that signal. If no procedure was
established before, or if the signal number is illegal,
then ssignal returns the value SIG_DFL.
The gsignal subroutine "raises" the signal specified by
the sig parameter by doing the following:
o If the procedure for sig is SIG_DFL, then the gsignal
subroutine returns a value of 0 and takes no other
action.
o If the procedure for sig is SIG_IGN, then the gsignal
subroutine returns a value of 1 and takes no other
action.
o If the procedure for sig is a subroutine, then the
action value is reset to SIG_DFL and the subroutine
is called with sig passed as its parameter. The
gsignal subroutine returns the value that is returned
by the signal-handling subroutine.
o If the procedure for sig is an illegal value or if no
procedure was ever specified for that signal, then
gsignal returns a value of 0 and takes no other
action.
Related Information
In this book: "kill" and "signal."