Visit Our UNIX and Linux User Community

Linux and UNIX Man Pages

Test Your Knowledge in Computers #986
Difficulty: Medium
The X Window System is installed by default in FreeBSD.
True or False?
Linux & Unix Commands - Search Man Pages

signal(2) [osf1 man page]

signal(2)							System Calls Manual							 signal(2)

NAME
signal - Modifies signal functions SYNOPSIS
#include <signal.h> void (*signal( int sig, void (*function)(int)) (int) ); STANDARDS
Interfaces documented on this reference page conform to industry standards as follows: signal(): XPG4, XPG4-UNIX Refer to the standards(5) reference page for more information about industry standards and associated tags. PARAMETERS
Defines the signal. All signals are valid with the exception of SIGKILL and SIGSTOP. Specifies the address of a signal handler. DESCRIPTION
The signal function provides compatibility for older versions of the operating system whose function is a subset of the sigaction function. The signal function sets the action associated with a signal. The function parameter uses the values SIG_DFL, SIG_IGN, or it can point to an address of a signal handler. A SIG_DFL value specifies the default action that is to be taken when the signal is delivered. A value of SIG_IGN specifies that the sig- nal has no effect on the receiving process. A pointer to a function requests that the signal be caught; that is, the signal should cause the function to be called. These actions are more fully described in the <signal.h> file. NOTES
The sigaction() function provides a more comprehensive and reliable mechanism for controlling signals and is recommended instead of sig- nal() for new applications. [Tru64 UNIX] The effect of calling the signal function behavior differs depending on whether the calling program is linked with either of the special libraries, libbsd or libsys5, which supply BSD or System V signaling characteristics respectively. If neither library is used, the behavior is the same as that of the sigaction function with all the flags set to 0 (zero). If the libsys5 library is used (through compilation with the -lsys5 switch), then the specified signal is not blocked from delivery when the handler is entered, and the disposi- tion of the signal reverts to SIG_DFL when the signal is delivered. If the libbsd library or the bsd_signal() function is used, the behav- ior is the same as that of the sigaction() function with the SA_RESTART flag set. [Tru64 UNIX] When compiled in the X/Open UNIX environment, calls to the signal() function are internally renamed by prepending _E to the function name. When you are debugging a module that includes the libc version of the signal() function and for which _XOPEN_SOURCE_EXTENDED has been defined, use _Esignal to refer to the signal() call. See standards(5) for information on when the _XOPEN_SOURCE_EXTENDED macro is defined. RETURN VALUES
Upon successful completion of the signal function, the value of the previous signal action is returned. Otherwise, SIG_ERR is returned and errno is set to indicate the error. ERRORS
The signal() function sets errno to the specified values for the following conditions: The sig parameter is not a valid 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
Commands: kill(1) Functions: acct(2), bsd_signal(2), exit(2), kill(2), pause(3), ptrace(2), setjmp(3), sigaction(2), sigblock(2), sigpause(3), sigproc- mask(2), sigstack(2), sigsuspend(2), sigvec(2), umask(2), wait(2) Files: signal(4) Standards: standards(5) signal(2)

Check Out this Related Man Page

sigset(3)						     Library Functions Manual							 sigset(3)

NAME
sigset, sighold, sigrelse, sigignore - Compatibility interfaces for signal management LIBRARY
Standard C Library (libc.so, libc.a) SYNOPSIS
#include<signal.h> void (*sigset( int signal, void (*function) (int))) (int) int sighold( int signal ); int sigrelse( int signal ); int sigignore( int signal ); STANDARDS
Interfaces documented on this reference page conform to industry standards as follows: sigset(), sighold(), sigrelse(), sigignore(): XSH4.2 Refer to the standards(5) reference page for more information about industry standards and associated tags. PARAMETERS
Specifies the signal. The signal parameter can be assigned any of the signals defined in the signal.h header file, except SIGKILL and SIGSTOP. Specifies one of four values: SIG_DFL, SIG_IGN, SIG_HOLD, or an address of a signal-catching function. The function parameter is declared as type pointer to a function returning void. DESCRIPTION
The sigset(), sighold(), sigrelse(), and sigignore() functions provide simplified signal management. The sigset() function is used to modify signal dispositions. The value of the function parameter determines the system signal action to be taken upon receipt of signal, as follows: If function is the address of a signal-catching function, the system adds signal to the calling process' signal mask before executing the signal-catching function. When the signal-catching function returns, the system restores the calling process' signal mask to its state prior to delivery of the signal. If function is equal to SIG_HOLD, signal is added to the call- ing process' signal mask and the disposition of signal remains unchanged. If function is not SIG_HOLD, signal is removed from the calling process' signal mask. The sighold() function adds signal to the calling process' signal mask. The sigrelse() function removes signal from the calling process' signal mask. The sigignore() function sets the disposition of signal to SIG_IGN. The sighold() function, in conjunction with sigrelse() and sigpause(), may be used to establish critical regions of code that require the delivery of a signal to be temporarily deferred. NOTES
These interfaces are provided for compatibility only. New programs should use sigaction() and sigprocmask() to control the disposition of signals. [Tru64 UNIX] When compiled in the X/Open UNIX environment, calls to the sigset() function are internally renamed by prepending _E to the function name. When you are debugging a module that includes the sigset() function and for which _XOPEN_SOURCE_EXTENDED has been defined, use _Esigset to refer to the sigset() call. See standards(5) for information on when the _XOPEN_SOURCE_EXTENDED macro is defined. RETURN VALUES
Upon successful completion, the sigset() function returns the previous value of the system signal action for the specified signal. Other- wise, it returns SIG_ERR and errno is set to indicate the error. For the sighold(), sigrelse(), and sigignore() functions, a value of 0 (zero) is returned upon success. Otherwise, a value of -1 is returned and errno is set to indicate the error. ERRORS
The sigset(), sighold(), sigrelse(), and sigignore() functions set errno to the specified values for the following conditions: The signal parameter is either an illegal signal number or SIGKILL, or the default handling of signal cannot be changed. RELATED INFORMATION
Functions: kill(2), setjmp(3), sigaction(2), sigpause(3), sigprocmask(2), wait(2) Files: signal(4) Standards: standards(5) delim off sigset(3)

Featured Tech Videos