signal

signal — defines an expression to be evaluated at an OS generated signal.

Syntax

signal (signal, action[, action]...)

		

Arguments

signal

A signal number. Normally one of the built-in signal values.

action

Any Gamma or Lisp expression.

Returns

t

Description

This function defines an expression to be evaluated whenever the operating system generates signal number signal to this process. A signal handler may be of any complexity, though it is advisable to keep signal handlers as simple as possible. All signals and timers are blocked for the duration of the signal handler. In addition, the signal handler runs in a separate, smaller heap. If the signal handler is large, this could result in memory inefficiency. Signal handlers are typically used to ensure that the Gamma application does not exit when a signal occurs.

Table 15. Signals

SignalDescription
SIGABRTAbort signal from the abort() C function.
SIGALRMA timer has occurred. This signal is reserved in most operating system implementations of Gamma for use with the after, at and every functions. This signal is not available in Linux because it is used by the timer processing internally to Gamma. In QNX, it is the timer signal from the alarm() C function.
SIGBUSBus error.
SIGCHLDChild died. Generated when a child process of the current process has died.
SIGCONTContinue. Causes the task to restart after a SIGSTP.
SIGFPEFloating point exception. Generated by an illegal mathematical function call (such as division by zero).
SIGHUPHangup. Typically generated when a terminal session disconnects.
SIGILLIllegal instruction. This is an internal error.
SIGINTKeyboard interrupt. Generated by CTRL-C.
SIGIOI/O processing is required. This signal is generated when a socket or file descriptor has incoming data which must be processed.
SIGIOTIOT trap. A synonym for SIGABRT.
SIGKILLKilled. Kills the process with extreme prejudice. This signal cannot be caught.
SIGPIPEBroken pipe. This occurs when a TCP/IP socket or a pipe to an inferior process is broken.
SIGPOLLA pollable event. Synonym of SIGIO.
SIGPWRPower failure. This is generated by a power monitor program to indicate that a power loss is imminent.
SIGQUITQuit.
SIGSEGVSegmentation fault. This signal is generated by an attempt to access illegal memory. If this signal occurs, it represents a fault in the LISP interpreter and should be reported along with the corresponding memory address of the fault.
SIGSTOPStop execution immediately. This is used by the operating system to implement multi-tasking. This signal cannot be caught.
SIGSYSBad argument to a system routine. This happens very rarely.
SIGTERMTerminated. This is generated by other programs which wish to terminate the job.
SIGTRAPTrace/breakpoint trap.
SIGTSTPTerminal stop. This signal is generated when the user attempts to stop a process (in operating systems which support job control).
SIGTTINTerminal input is available.
SIGTTOUTerminal output is required.
SIGURGUrgent. An urgent condition has occurred.
SIGUSR1User-defined signal 1.
SIGUSR2User-defined signal 2.
SIGWINCHWindow change. This is used to indicate that a change has been made to the size or position of the window in which the process is running.

Example

Gamma> getpid();
10341
Gamma> signal(SIGUSR1,#princ("Got the signal.\n"));
t
Gamma> kill(10341,SIGUSR1);
Got the signal.
t
Gamma> 

See Also

after, at, every