HP-UX Reference (11i v1 05/09) - 2 System Calls (vol 5)
s
signal(2) signal(2)
The sigpause() function removes sig from the calling process’ signal mask and suspends the calling process
until a signal is received.
If the action for the SIGCHLD signal is set to
SIG_IGN, child processes of the calling processes will not be
transformed into zombie processes when they terminate. If the calling process subsequently waits for its
children, and the process has no unwaited for children that were transformed into zombie processes, it will
block until all of its children terminate, and
wait(), wait3(), waitid() and waitpid() will fail
and set
errno to ECHILD.
RETURN VALUE
If the request can be honoured, signal()
returns the value of func() for the most recent call to sig-
nal()
for the specified signal sig. Otherwise,
SIG_ERR is returned and a positive value is stored in
errno.
Upon successful completion, sigset() returns SIG_HOLD if the signal had been blocked and the signal’s
previous disposition if it had not been blocked. Otherwise,
SIG_ERR is returned and errno is set to indi-
cate the error.
For all other functions, upon successful completion, 0 is returned. Otherwise, −1 is returned and
errno is
set to indicate the error.
ERRORS
The
signal() function will fail if:
[EINVAL] The sig argument is not a valid signal number or an attempt is made to catch a signal
that cannot be caught or ignore a signal that cannot be ignored.
The signal() function may fail if:
[EINVAL] An attempt was made to set the action to
SIG_DFL for a signal that cannot be caught
or ignored (or both).
The
sigset(), sighold() , sigrelse() , sigignore() , and sigpause() functions will fail if:
[EINVAL] The sig argument is an illegal signal number.
The sigset(), and sigignore() functions will fail if:
[EINVAL] An attempt is made to catch a signal that cannot be caught, or to ignore a signal that
cannot be ignored.
APPLICATION USAGE
The sigaction() function provides a more comprehensive and reliable mechanism for controlling sig-
nals; new applications should use sigaction() rather than signal().
The sighold() function, in conjunction with sigrelse() or sigpause() , may be used to establish
critical regions of code that require the delivery of a signal to be temporarily deferred.
The sigsuspend() function should be used in preference to sigpause() for broader portability.
Threads Considerations
The signal disposition (such as catch/ignore/default) established by
signal() is shared by all threads in
the process. Blocked signal masks are maintained by each thread.
If
signal() is used to set the signal disposition for sig to SIG_IGN or to SIG_DFL for a signal whose
default action is to ignore the signal, any instances of sig pending on the process or any of the threads will
be discarded. The signals are discarded regardless of whether the signal is blocked by any of the threads.
For more information regarding signals and threads, refer to signal(5).
SEE ALSO
exec(2), pause(2), sigaction(2), waitid(2), <signal.h>.
CHANGE HISTORY
First released in Issue 1.
Derived from Issue 1 of the SVID.
Section 2−−370 Hewlett-Packard Company − 2 − HP-UX 11i Version 1: September 2005