.\" @(#)signal.3f 1.4 86/01/02 SMI; from UCB 4.2 .TH SIGNAL 3F "98/09/17" .SH NAME signal \- change the action for a signal .SH SYNOPSIS .\" .IX signal "" \fLsignal\fP .IX change "action for signal" .IX "action for signal" .\" .B integer*4 function signal(signum, proc, flag) .br .B integer*4 signum, flag .br .B external proc .sp For 64-bit environments: .br .B integer*8 function signal(signum, proc, flag) .sp When compiling for 64-bit environments, with compiler option .BR -xarch=v9 , .B signal must be declared .B integer*8 signal as well as any variables receiving the result from .BR signal . .\" .SH DESCRIPTION If a process incurs a signal (see .BR signal (3)), the default action is usually to clean up and abort. You can choose to write an alternative signal handling routine. A call to .B signal is the way this alternate action is specified to the system. .PP Input: .in +1 .sp .2 .I signum is the signal number (see .BR signal (3)). .sp .2 .I proc is the name of a user signal handling routine. .sp .2 If .I flag is negative, then .I proc must be the name of the user signal handling routine. .sp .2 If .I flag is zero or positive, then .I proc is ignored and the value of .I flag is passed to the system as the signal action definition. In particular, this is how previously saved signal actions can be restored. .sp .2 Two possible values for .I flag have specific meanings: .br .nf .in +1 0 means "use the default action." See \f3NOTES\f1 below. 1 means "ignore this signal." .in -1 .fi .PP Output: .in +1 .sp .2 A positive returned value is the previous action definition. .sp .2 A value greater than 1 is the address of a routine that was to have been called on occurrence of the given signal. .sp .2 A negative returned value is the negation of a system error code. See .BR perror (3F). .sp .2 The returned value can be used in subsequent calls to .B signal to restore a previous action definition. .in -1 .\" .SH FILES .\" .B libF77.a .SH "SEE ALSO" .BR kill (1), .BR signal (3), .BR kill (3F) .SH NOTES .B f77 arranges to trap certain signals when a process is started. The only way to restore the default .B f77 action is to save the returned value from the first call to .BR signal . .PP If the user signal handler is called, it is passed the signal number as an integer argument.