signal ?-restart? action siglist ?command? Warning: If signals are being used as an event source (a trap action), rather than generating an error to terminate a task; one must use the -restart option. This causes a blocked system call, such as read or waitpid to be restarted rather than generate an error. Failure to do this may results in unexpected errors when a signal arrives while in one of these system calls. When available, the -restart option can prevent this problem. If -restart is specified, restart blocking system calls rather than generating an error. The signal will be handled once the Tcl command that issued the system call completes. The -restart options is not available on all operating systems and its use will generate an error when it is not supported. Use infox have_signal_restart to check for availability. Specify the action to take when a Unix signal is received by Extended Tcl, or a program that embeds it. Siglist is a list of either the symbolic or numeric Unix signal (the SIG prefix is optional). Action is one of the following actions to be performed on receipt of the signal. To specify all modifiable signals, use `*' (this will not include SIGKILL and SIGSTOP, as they can not be modified). default Perform system default action when signal is received (see signal system call documentation). ignore Ignore the signal. error Generate a catchable Tcl error. It will be as if the command that was running returned an error. The error code will be in the form: POSIX SIG signame For the death of child signal, signame will always be SIGCHLD, rather than SIGCLD, to allow writing portable code. trap When the signal occurs, execute command and con- tinue execution if an error is not returned by command. The command will be executed in the glo- bal context. The command will be edited before execution, replacing occurrences of "%S" with the signal name. Occurrences of "%%" result in a sin- gle "%". This editing occurs just before the trap command is evaluated. If an error is returned, then follow the standard Tcl error mechanism. Often command will just do an exit. get Retrieve the current settings of the specified signals. A keyed list will be returned were the keys are one of the specified signals and the values are a list consisting of the action associ- ated with the signal, a 0 if the signal may be delivered (not block) and a 1 if it is blocked and a flag indicating if restarting of system calls is specified. The actions maybe one of `default',`ignore', `error' or `trap'. If the action is trap, the third element is the command associated with the action. The action `unknown' is returned if a non-Tcl signal handler has been associated with the signal. set Set signals from a keyed list in the format returned by the get. For this action, siglist is the keyed list of signal state. Signals with an action of `unknown' are not modified. block Block the specified signals from being received. (Posix systems only). unblock Allow the specified signal to be received. Pending signals will not occur. (Posix systems only). The signal action will remain enabled after the speci- fied signal has occurred. The exception to this is SIGCHLD on systems without Posix signals. For these systems, SIGCHLD is not be automatically reenabled. After a SIGCHLD signal is received, a call to wait must be performed to retrieve the exit status of the child process before issuing another signal SIGCHLD ... com- mand. For code that is to be portable between both types of systems, use this approach. Signals are not processed until after the completion of the Tcl command that is executing when the signal is received. If an interactive Tcl shell is running, then the SIGINT will be set to error, non-interactive Tcl sessions leave SIGINT unchanged from when the process started (normally default for foreground processes and ignore for processes in the background). This command is provided by Extended Tcl.