Flashnux

GNU/Linux man pages

Livre :
Expressions régulières,
Syntaxe et mise en oeuvre :

ISBN : 978-2-7460-9712-4
EAN : 9782746097124
(Editions ENI)

Unix

Unix v6

signal(2)



signal catch or ignore signals (signal = 48.)
sys signal; sig; label

(old value in r0) signal(sig, func)

int (*func)( ); A is generated by some abnormal event, initiated either by user at a typewriter (quit, interrupt), by a program error (bus error, etc.), or by request of another program (kill). Normally all signals cause termination of the receiving process, but this call allows them either to be ignored or to cause an interrupt to a specified location. Here is the list of signals: 1

hangup 2

interrupt 3*

quit 4*

illegal instruction (not reset when caught) 5*

trace trap (not reset when caught) 6*

IOT instruction 7*

EMT instruction 8*

floating point exception 9

kill (cannot be caught or ignored) 10*

bus error 11*

segmentation violation 12*

bad argument to system call 13

write on a pipe with no one to read it In the assembler call, if is 0, the process is terminated when the signal occurs; this is the default action. If is odd, the signal is ignored. Any other even specifies an address in the process where an interrupt is simulated. An RTI or RTT instruction will return from the interrupt. Except as indicated, a signal is reset to 0 after being caught. Thus if it is desired to catch every such signal, the catching routine must issue another call. In C, if is 0, the default action for signal (termination) is reinstated. If is 1, the signal is ignored. If is non-zero and even, it is assumed to be the address of a function entry point. When the signal occurs, the function will be called. A return from the function will continue the process at the point it was interrupted. As in the assembler call, must in general be called again to catch subsequent signals. When a caught signal occurs during certain system calls, the call terminates prematurely. In particular this can occur during a or on a slow device (like a typewriter; but not a file); and during or When such a signal occurs, the saved user status is arranged in such a way that when return from the signal-catching takes place, it will appear that the system call returned a characteristic error status. The user’s program may then, if it wishes, re-execute the call. The starred signals in the list above cause a core image if not caught or ignored. The value of the call is the old action defined for the signal. After a (II) the child inherits all signals. (II) resets all caught signals to default action. kill (I), kill (II), ptrace (II), reset (III) The error bit (c-bit) is set if the given signal is out of range. In C, a 1 indicates an error; 0 indicates success.



signal(2)