signal, _sendsig - receiving and sending signals


#include <stdio_p.h>
#include <signal_p.h>

int (*signal (sig, func))()
int sig;
int (*func)();

int _sendsig(sig, fd, flag)
FD fd;
int flag;


signal allows the calling program to choose one of three ways in which it is possible to handle the receipt of a specific signal. sig specifies the signal and func specifies the choice.

sig can be assigned any of the following:

SIGRST		00	reset
SIGHALT		00	halt
SIGPF		00	power fail
SIGBUS		01	bus error
SIGADR		02	odd address error
SIGILL		03	illegal instruction (not reset when caught)
SIGDIV0		04	divide by zero
SIGCHK		05	CHK instruction
SIGTRPV		06	TRAPV instruction
SIGPRIV		07	privilege instruction
SIGTRAP		08	trace trap (not reset when caught)
SIGEMT1		09	Line 1010 EMT instruction
SIGEMT2		10	Line 1111 EMT instruction
SIGSPUR		11	spurious interrupt
SIGTRP		12	trap instruction
SIGALRM		13	alarm line clock
SIGCHAR		14	terminal character mode
SIGLINE		15	terminal line mode
SIGQUIT		16	terminal FS quit
SIGINT		17	terminal interrupt
SIGST2		18	schmitt trigger 2
SIGOVF		19	programmable clock overflow
SIGEOC		20	end of A/D conversion
SIGADC		21	ADAC A/D end-of-conversion
SIGDAD		22	DMA A/D end-of-conversion(s) signal
SIGDDA		24	DMA D/A end-of-conversion(s) signal
SIGIB		25	request A interrupt of input buffer
SIGTTL		26	1632 TTL request
SIGMG		27	Magatek driver error
func is assigned one of three value: SIG_DFL, SIG_IGN, or a function address. The actions prescribed the these values are as follows:

terminate program upon receipt of a signal. Upon receipt of the signal sig, the receiving program is to be terminated.

ignore signal. The signal sig is to be ignored.

function address
Upon receipt of signal sig, the receiving program is to execute the signal-catching function pointed to by func. The signal number sig and program counter will be passed to the signal-catching function for non-I/O associated signals. The signal number sig, the file descriptor FD and a value depending on the I/O device (see Section 4) will be passed to the signal-catching function for I/O associated signals.

Upon return from the signal-catching fucntion, the receiving program will resume execution at the point it was interrupted and the value of func for the caught signal will be set to SIG_DFL.

A call on signal cancels a pending signal sig.

signal will fail if sig is an illegal signal number. [EINVAL]

_sendsig allows a user to send a signal sig passing a signal number sig , a file descriptor fd with an extra value flag.


Upon successful completion, signal returns the previous value of func for the specified signal sig. Otherwise, a value of -1 is returned and errno is set to indicate the error.