signal(S)
signal --
set a signal action
Syntax
cc . . . -lc
#include <signal.h>
void (*signal (int sig, void (*func) (int))) (int);
Description
The signal
routine is not considered to be completely reliable
for some applications. Therefore, it is strongly
recommended that the
sigaction
routine, which supersedes the
signal
routine, be used in all new applications instead.
The signal and the sigaction
routines should never be used in the same application
to control the same signal as this results in
undefined behavior of the
sigaction
routine.
The
signal
routine is still included largely for
backward compatibility.
The
signal
routine
allows the calling process to choose one of three ways
to handle the receipt of a specified signal.
The argument
sig
specifies the particular signal and
the argument
func
specifies the course of action to be taken.
The
sig
argument can be assigned any of the values documented on the
signal(M)
manual page
except SIGKILL and SIGSTOP.
A call to signal cancels a pending signal sig
except for a pending
SIGKILL or SIGSTOP signal.
Return value
Upon successful completion,
signal
returns the previous value of
func
for the specified signal
sig.
Otherwise, a value of SIG_ERR is returned and
errno
is set to indicate the error.
SIG_ERR is defined in the include file <signal.h>.
Diagnostics
If the following condition occurs,
the signal routine returns a value of SIG_ERR
in func and sets errno
to the corresponding value:
[EINVAL]-
The value of the sig
argument is an invalid or unsupported signal number, or an
attempt was made to catch a signal that cannot be caught
or to ignore a signal that cannot be ignored.
See also
sigaction(S),
signal(M),
sigprocmask(S),
sigpending(S),
sigsuspend(S),
sigset(S),
sigsetv(S),
sigsetjmp(S),
Intro(S),
kill(S),
pause(S),
ptrace(S),
wait(S),
kill(C)
Standards conformance
signal is conformant with:
X/Open Portability Guide, Issue 3, 1989
;
and
ANSI X3.159-1989 Programming Language -- C
.
© 2003 Caldera International, Inc. All rights reserved.
SCO OpenServer Release 5.0.7 -- 11 February 2003