berksignal(3)
_________________________________________________________________
berksignal, signal Subroutine
simplified software signal facilities in DG/UX
_________________________________________________________________
SYNTAX
#include <berksignal.h>
(*signal(sig, func))()
void (*func)();
DESCRIPTION
Signal is a simplified interface to the more general sigvec(2)
facility.
A signal is generated by some abnormal event, initiated by a user
at a terminal (quit, interrupt, stop), by a program error (bus
error, etc.), by request of another program (kill), or when a
process is stopped because it wishes to access its control
terminal while in the background (see tty(4)). Signals are
optionally generated when a process resumes after being stopped,
when the status of child processes changes, or when input is
ready at the control terminal. Most signals cause termination of
the receiving process if no action is taken; some signals instead
cause the process receiving them to be stopped, or are simply
discarded if the process has not requested otherwise. Except for
the SIGKILL and SIGSTOP signals, the signal call allows signals
either to be ignored or to cause an interrupt to a specified
location. The following is a list of all signals with names as
in the include file < berk_signal.h >:
SIGHUP 1(T) hangup
SIGINT 2(T) interrupt
SIGQUIT 3(C) quit
SIGILL 4(C) illegal instruction
SIGTRAP 5(C) trace trap
SIGIOT 6(C) IOT instruction
SIGEMT 7(C) EMT instruction
SIGFPE 8(C) floating point exception
SIGKILL 9(T) kill (cannot be caught, blocked, or ignored)
SIGBUS 10(C) bus error
SIGSEGV 11(C) segmentation violation
SIGSYS 12(C) bad argument to system call
SIGPIPE 13(T) write on a pipe with no one to read it
SIGALRM 14(T) alarm clock
SIGTERM 15(T) software termination signal
SIGUSR1 16(T) user defined signal 1
DG/UX 4.00 Page 1
Licensed material--property of copyright holder(s)
berksignal(3)
SIGUSR2 17(T) user defined signal 2
SIGCLD 18(I) death of a child
SIGCHLD 18(I) child status has changed
SIGPWR 19(I) power-fail restart
SIGSTOP 20(S) sendable stop signal not from tty
SIGTSTP 21(S) stop signal from tty
SIGCONT 22(I) continue a stopped process
SIGTTIN 23(S) background read attempt
SIGTTOU 24(S) background write attempt
SIGTINT 25(I) input record is available
SIGXCPU 26(I) exceeded CPU time limit
SIGXFSZ 27(T) exceeded file size limit
SIGURG 28(I) urgent condition sockets
SIGVTALRM 29(T) virtual time alarm
SIGPROF 30(T) profiling timer alarm
The parenthesized labels (T)erminate, (C)ore dump, (I)gnore, and
(S)top indicate the default consequence when the signal is
presented to a process.
If func is SIG_DFL, the default action for signal sig is
reinstated. If func is SIG_IGN the signal is subsequently
ignored and pending instances of the signal are discarded.
Otherwise, when the signal occurs further occurences of the
signal are automatically blocked and func is called.
A return from the function unblocks the handled signal and
continues the process at the point it was interrupted. Unlike
previous signal facilities, the handler func remains installed
after a signal has been delivered.
If a caught signal occurs during certain system calls, causing
the call to terminate prematurely, the call is automatically
restarted. In particular this can occur during a read or
write(2) on a slow device (such as a terminal; but not a file)
and during a wait(2).
The value of signal is the previous (or initial) value of func
for the particular signal.
After a fork(2) or vfork(2) the child inherits all signals.
Execve(2) resets all caught signals to the default action;
ignored signals remain ignored.
RETURN VALUE
The previous action is returned on a successful call. Otherwise,
-1 is returned and errno is set to indicate the error.
DG/UX 4.00 Page 2
Licensed material--property of copyright holder(s)
berksignal(3)
ERRORS
Signal will fail and no action will take place if one of the
following occur:
[EINVAL] Sig is not a valid signal number.
[EINVAL] An attempt is made to ignore or supply a handler
for SIGKILL or SIGSTOP.
[EINVAL] An attempt is made to ignore SIGCONT (by default
SIGCONT is ignored).
SEE ALSO
kill(1), ptrace(2), kill(2), sigvec(2), sigblock(2), signal(2),
sigsetmask(2), sigpause(2), sigstack(2), setjmp(3), tty(4)
NOTES
Signal(3) provides compatibility with BSD 4.2 signal handling
while signal(2) is System 5.2 based. You can use signal(3) in
either of the following ways:
1) Include < berk_signal.h > and call signal(). This will
translate to berk_signal() which is signal(3). Signal(2) is
unavailable with this method.
2) Include < signal.h > and call berk_signal(). With this
method you can use both System 5.2 signal facilities (call
signal() to get signal(2)) and BSD 4.2 signal facilities
(call berk_signal() to get signal(3)).
DG/UX 4.00 Page 3
Licensed material--property of copyright holder(s)