SIGNAL(2) DOMAIN/IX SYS5 SIGNAL(2)
NAME
signal - specify what to do upon receipt of a signal
USAGE
#include <signal.h>
int(*signal(sig, func))()
int sig;
void (*func)();
DESCRIPTION
Signal allows the calling process to choose one of three
ways to handle the receipt of a specific signal. Sig speci-
fies the signal and func specifies the choice.
Sig can be any one of the following except SIGKILL or SIG-
STOP.
SIGHUP 1 hang-up
SIGINT 2 interrupt
SIGQUIT 3 quit
SIGILL 4 illegal instruction
SIGTRAP 5 trace trap
SIGIOT 6 IOT instruction
SIGEMT 7 EMT instruction
SIGFPE 8 floating-point exception
SIGKILL 9 kill (cannot be caught, blocked, or ignored)
SIGBUS 10 bus error
SIGSEGV 11 segmentation violation
SIGSYS 12* bad argument to system call
SIGPIPE 13 write on a pipe with no one to read it
SIGALRM 14 alarm clock
SIGTERM 15 software termination signal
SIGUSR1 16 user-defined signal 1
SIGUSR2 17 user-defined signal 2
SIGCLD 18 death of a child
SIGAPOLLO 19 DOMAIN System fault with no UNIX equivalent
SIGSTOP 20 stop, cannot be caught, held, or ignored
SIGTSTP 21 stop signal generated from keyboard
SIGCONT 22 continue after stop
SIGCHLD 23 child status has changed
SIGTTIN 24 background read attempted from control terminal
SIGTTOU 25 background write attempted to control terminal
SIGIO 26 I/O is possible on a descriptor
SIGTINT 26 input record is available at control terminal
SIGXCPU 27 cpu time limit exceeded
SIGXFSZ 28 file size limit exceeded
SIGVTALRM 29 virtual time alarm
SIGPROF 30 profiling timer alarm
SIGURG 31 urgent condition present on socket
Printed 12/4/86 SIGNAL-1
SIGNAL(2) DOMAIN/IX SYS5 SIGNAL(2)
Func is assigned one of three values: SIG_DFL, SIG_IGN, or a
function address. The actions prescribed by these values
are as follows:
SIG_DFL Terminate the process upon receipt of a signal.
Upon receipt of the signal sig, the receiving
process will be terminated with the consequences
outlined in exit(2).
SIG_IGN Ignore the signal specified by sig. (The sig-
nals SIGKILL and SIGSTOP cannot be ignored.)
function address
Catch the signal. Upon receipt of the signal
sig, the receiving process executes the signal-
catching function defined by func. The signal
number sig is passed to the signal-catching
function as the only argument. Additional argu-
ments are passed to the signal-catching function
for hardware-generated signals. Before entering
the signal-catching function, the value of func
for the caught signal is set to SIG_DFL unless
the signal is SIGILL or SIGTRAP.
Upon return from the signal-catching function,
the receiving process will resume execution at
the point where it was interrupted.
When a signal that is to be caught occurs during
a read(2), a write(2), an open(2), or an
ioctl(2) system call on a slow device, during a
pause(2) system call, or during a wait(2) system
call that does not return immediately, the sig-
nal catching function will be executed and then
the interrupted system call may return a -1 to
the calling process and set errno to EINTR.
NOTES
A call to signal cancels a pending signal sig except for a
pending SIGKILL or SIGSTOP signal.
DOMAIN systems send the signal SIGAPOLLO whenever a fault
occurs that is not otherwise mapped into a signal. Typical
generators of SIGAPOLLO include network failures, display-
acquire timeouts, and disk full errors.
For SIGFPE, SIGILL, and SIGAPOLLO, you may use a routine
like the one below as the signal-catching func.
handler(sig, code)
SIGNAL-2 Printed 12/4/86
SIGNAL(2) DOMAIN/IX SYS5 SIGNAL(2)
int sig, code;
Sig is the signal number into which the hardware faults and
traps are mapped as defined below. Code is a 32-bit value.
If the signal is SIGAPOLLO, code is the DOMAIN System status
code describing the fault. (To generate a list of DOMAIN
System status codes and brief explanations of their mean-
ings, run the command /systest/ssr_util/all_stcode.) Other-
wise, code is a value associated with one of the constants
listed below.
DOMAIN System Hardware traps are mapped to signals and codes
as indicated below. All of these symbols are defined in
<sys/signal.h>:
Hardware condition Signal Code
Arithmetic traps:
Integer overflow SIGFPE FPE_INTOVF_TRAP
Integer division by zero SIGFPE FPE_INTDIV_TRAP
Floating overflow trap SIGFPE FPE_FLTOVF_TRAP
Floating/decimal division by zero SIGFPE FPE_FLTDIV_TRAP
Floating underflow trap SIGFPE FPE_FLTUND_TRAP
Decimal overflow trap SIGFPE FPE_DECOVF_TRAP
Subscript-range SIGFPE FPE_SUBRNG_TRAP
Floating overflow fault SIGFPE FPE_FLTOVF_FAULT
Floating divide by zero fault SIGFPE FPE_FLTDIV_FAULT
Floating underflow fault SIGFPE FPE_FLTUND_FAULT
Length access control SIGSEGV
Protection violation SIGBUS
Reserved instruction SIGILL ILL_RESAD_FAULT
Customer-reserved instr. SIGEMT
Reserved operand SIGILL ILL_PRIVIN_FAULT
Reserved addressing SIGILL ILL_RESOP_FAULT
Trace pending SIGTRAP
Bpt instruction SIGTRAP
In DOMAIN/IX, you cannot send a signal to a dead child pro-
cess. A process that attempts to discover information about
a dead child by posting a signal to it will fail with errno
set to ESRCH (no such process).
DOMAIN/IX supports an additional signal, included strictly
to maintain compatibility with previous releases. We do not
encourage its continued use, and we cannot promise its con-
tinued support.
SIGCLD 18 death of a child (reset when caught)
Printed 12/4/86 SIGNAL-3
SIGNAL(2) DOMAIN/IX SYS5 SIGNAL(2)
For this signal, func is assigned one of three values:
SIG_DFL, SIG_IGN, or a function address. The actions
prescribed by these values are as follows:
SIG_DFL Ignore the signal.
SIG_IGN Ignore the signal. Do not let the calling
process's child processes create "pseudo-
processes" when they terminate; see exit(2).
function address
same as described above for func equal to function
address. except that, while the process is exe-
cuting the signal-catching function, any received
SIGCLD signals will be queued and the signal-
catching function will be re-entered until the
queue is empty.
The SIGCLD signal affects two other system calls (wait(2),
and exit(2)) in the following ways:
wait If the func value of SIGCLD is set to SIG_IGN and
a wait is executed, the wait will block until all
of the calling process's child processes ter-
minate; it will then return a value of -1 with
errno set to ECHILD.
exit If in the exiting process's parent process the func
value of SIGCLD is set to SIG_IGN, the exiting pro-
cess will not create a pseudo-process.
When processing a pipeline, the shell makes the last process
in the pipeline the parent of the proceeding processes. A
process that may be piped into (and thus become the parent
of other processes) should not let SIGCLD be caught.
RETURN VALUE
Upon successful completion, signal returns the previous
value of func for the specified signal sig. A failed call
returns -1 and sets errno as indicated below.
ERRORS
[EINVAL] Signal will fail if sig is an uncatchable signal
(SIGKILL or SIGSTOP).
RELATED INFORMATION
kill(1), kill(2), pause(2), wait(2), setjmp(3C)
SIGNAL-4 Printed 12/4/86