signal()

handle receipt of signal 

Function


SYNOPSIS

#include <signal.h>

void(*signal(int sig, void (*disp)(int)))(int);


DESCRIPTION

The signal() function is used to modify signal disposition by handling receipt of the signal number sig in one of three ways: taking the default action for the signal, ignoring the signal, or catching the signal. If the value of disp is SIG_DFL, default handling for that signal will occur. If SIGCHLD disposition is changed to a handler from SIG_DFL and if there are zombie processes, a SIGCHLD is raised. If the value of disp is SIG_IGN, the signal is ignored. Otherwise, disp points to a function (a signal handler) to be called when that signal occurs.

If disp is the address of a signal handler and sig is not SIGILL, SIGTRAP, or SIGPWR, the system first sets the signal's disposition to SIG_DFL before executing the signal handler.

If signal() is used to set the disposition of SIGCHLD to a signal handler, SIGCHLD is not sent when the children of the calling process are stopped or continued.

If signal() is used to set the disposition of SIGCHLD to SIG_IGN, the child processes of the calling process does not create zombie processes when they terminate. If the calling process subsequently waits for its children, it blocks until all of its children terminate; it then returns a value of -1 with errno set to ECHILD.

The sigaction() function provides a more comprehensive and reliable mechanism for controlling signals; new applications should use sigaction() rather than signal().

Refer to api_intro for a discussion of the signals that the NuTCRACKER Platform supports and their default actions.


PARAMETERS

sig 

Specifies the signal, which may be any signal except SIGKILL or SIGSTOP.

disp 

Points to the signal's disposition, which may be SIG_DFL, SIG_IGN, or the address of a signal handler.


RETURN VALUES

If successful, signal() returns the signal's previous disposition. On failure, it returns SIG_ERR and sets errno to one of the following values:

EINVAL 

The value of sig is not a valid signal or is equal to SIGKILL or SIGSTOP.


CONFORMANCE

POSIX.1 (1996).


MULTITHREAD SAFETY LEVEL

MT-Safe.


PORTING ISSUES

None.


AVAILABILITY

PTC MKS Toolkit for Professional Developers
PTC MKS Toolkit for Professional Developers 64-Bit Edition
PTC MKS Toolkit for Enterprise Developers
PTC MKS Toolkit for Enterprise Developers 64-Bit Edition


SEE ALSO

api_intro

Functions:
bsd_signal(), kill(), pause(), sigaction(), sighold(), sigignore(), siginterrupt(), sigpause(), sigrelse(), sigset(), wait()


PTC MKS Toolkit 10.4 Documentation Build 39.