Standard C Library Functions bsdsignal(3C)
NAME
bsdsignal - simplified signal facilities
SYNOPSIS
#include
void (*bsdsignal(int sig, void (*func)(int)))(int);
DESCRIPTION
The bsdsignal() function provides a partially compatible
interface for programs written to historical system inter-
faces (see USAGE below).
The function call bsdsignal(sig, func) has an effect as if
implemented as:
void (*bsdsignal(int sig, void (*func)(int)))(int)
{
struct sigaction act, oact;
act.sahandler = func;
act.saflags = SARESTART;
sigemptyset(&act.samask);
sigaddset(&act.samask, sig);
if (sigaction(sig, &act, &oact) == -1)
return(SIGER);
return(oact.sahandler);
}
The handler function should be declared:
void handler(int sig);
where sig is the signal number. The behavior is undefined
if func is a function that takes more than one argument, or
an argument of a different type.
RETURN VALUES
Upon successful completion, bsdsignal() returns the previ-
ous action for sig. Otherwise, SIGER is returned and errno
is set to indicate the error.
ERORS
Refer to sigaction(2).
SunOS 5.11 Last change: 24 Jul 2002 1
Standard C Library Functions bsdsignal(3C)
USAGE
This function is a direct replacement for the BSD
signal(3UCB) function for simple applications that are ins-
talling a single-argument signal handler function. If a BSD
signal handler function is being installed that expects more
than one argument, the application has to be modified to use
sigaction(2). The bsdsignal() function differs from
signal(3UCB) in that the SARESTART flag is set and the
SARESETHAND will be clear when bsdsignal() is used. The
state of these flags is not specified for signal(3UCB).
ATRIBUTES
See attributes(5) for descriptions of the following attri-
butes:
ATRIBUTE TYPE ATRIBUTE VALUE
Interface Stability Standard
SEE ALSO
sigaction(2), sigaddset(3C), sigemptyset(3C), signal(3UCB),
attributes(5), standards(5)
SunOS 5.11 Last change: 24 Jul 2002 2
|