DOC HOME SITE MAP MAN PAGES GNU INFO SEARCH PRINT BOOK
 

signal(S-osr5)


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-osr5), signal(M), sigprocmask(S-osr5), sigpending(S-osr5), sigsuspend(S-osr5), sigset(S-osr5), sigsetv(S-osr5), sigsetjmp(S-osr5), Intro(S-osr5), kill(S-osr5), pause(S-osr5), ptrace(S-osr5), wait(S-osr5), kill(C)

Standards conformance

signal is conformant with:

X/Open Portability Guide, Issue 3, 1989 ;
and ANSI X3.159-1989 Programming Language -- C .


© 2005 The SCO Group, Inc. All rights reserved.
SCO OpenServer Release 6.0.0 -- 02 June 2005