ssignal(3) CLIX ssignal(3)
NAME
ssignal, gsignal - Signals the software
LIBRARY
Standard C Library libc.a
SYNOPSIS
#include <signal.h>
int (*ssignal(
int sig ,
int (*action)() ))( );
int gsignal(
int sig );
PARAMETERS
action The name of a user defined action function or one of the
constants SIG_DFL or SIG_IGN
sig An integer representing the type of signal
DESCRIPTION
The ssignal() and gsignal() functions form part of the C Programming
Language Utilities. They implement a software facility similar to the
signal() function. This facility, used by the Standard C Library, allows
users to indicate the disposition of error conditions and is made
available to users for their own purposes.
Software signals made available to users are associated with integers in
the inclusive range 1 through 16. A call to the ssignal() function
associates a procedure or action with the software signal sig. The sig
software signal is alerted by a call to the gsignal() function. Creating
a software signal causes the action established for that signal to be
taken.
The first argument to the ssignal() function is a number identifying the
type of signal for which an action is to be established. The second
argument defines the action; it is either the name of a (user-defined)
action function or one of the manifest constants SIG_DFL (default) or
SIG_IGN (ignore).
The gsignal() function creates a signal identified by its argument, sig.
If an action function has been established for sig, then that action is
reset to SIG_DFL, and the action function is entered with the argument
sig.
2/94 - Intergraph Corporation 1
ssignal(3) CLIX ssignal(3)
EXAMPLES
The following example demonstrates how an action may be defined for a
given signal and then executes later by raising that signal:
signal_hit(sig)
int sig;
{
printf("signal %d received\n", sig);
}
.
.
.
ssignal(1, signal_hit);
.
.
.
gsignal(1);
CAUTIONS
There are signals with numbers outside the range 1 through 16 which are
used by the Standard C Library to indicate error conditions. Thus, some
signal numbers outside the range 1 through 16 are legal, although their
use may interfere with the operation of the Standard C Library.
RETURN VALUES
The ssignal() function returns the action previously established for that
signal type. If no action has been established or the signal number is
illegal, this ssignal() function returns SIG_DFL.
The gsignal() function returns the value returned to it by the action
function. If the action for sig is SIG_IGN, the gsignal() function
returns the value 1 and takes no other action.
If the action for sig is SIG_DFL, the gsignal() function returns the value
0 and takes no other action. If sig has an illegal value or no action was
ever specified for sig, the gsignal() function returns the value 0 and
takes no other action.
ERRORS
There are signals with numbers outside the range 1 through 16 that are
used by the Standard C Library to indicate error conditions.
RELATED INFORMATION
Functions: signal(2), sigset(2)
2 Intergraph Corporation - 2/94