Chapter Contents

Previous

Next
Signal-Handling Functions

Types of Signal Support

Starting with Release 6.00, signals are supported either directly by the SAS/C library or in cooperation with USS. To provide backward compatibility, a few differences exist between the way the SAS/C library manages signals and the way USS, with its POSIX support, manages them.


SAS/C Library

The SAS/C library distinguishes between synchronous and asynchronous signals. You can define signal handlers for both types of signals, but the timing for executing a handler differs depending on the type of signal. When a synchronous signal occurs, the handler for that signal is called immediately. When an asynchronous signal occurs, the library delays calling the handler until a function is called or returns or until the special function sigchk is called to discover pending asynchronous signals. See Discovering Asynchronous Signals for details on how the SAS/C library treats asynchronous signals.

Synchronous Signals

The synchronous signals defined by the library are

SIGABND SIGFPE SIGIDIV SIGSEGV
SIGABRT SIGFPOFL SIGILL SIGTERM
SIGFPDIV SIGFPUFL SIGMEM

Eight synchronous user signals ( SIGUSR1 through SIGUSR8 ) are also available.

Asynchronous Signals

The asynchronous signals defined by the library are

SIGALRM SIGINT SIGIUCV

Eight asynchronous user signals ( SIGASY1 through SIGASY8 ) are also available.


USS and POSIX

The POSIX.1 standard defines a large number of signals that may be sent to a process. Signals may be sent synchronously or asynchronously, but this does not depend on signal type. For instance, the signal SIGPIPE may be raised synchronously by USS when an attempt is made to read a pipe without a writer process, or it may be raised asynchronously by another process's use of the kill function to send this signal. Each signal has a default action, which is usually abnormal process termination, with some exceptions. For example, the default handling for the SIGTSTP signal is to suspend process execution.

Almost all signals can be blocked, which means they are delayed from having an effect on the target process until that process unblocks the signal. (Two signals, SIGKILL and SIGSTOP , cannot be blocked. These signals also cannot be handled and, therefore, always cause their default actions.)

Note:    This definition differs considerably from the way SAS/C previously implemented signals. Traditionally, SAS/C only allowed asynchronous signals to be blocked. The synchronous/asynchronous distinction does not apply to POSIX signals, and blocking has an effect even on synchronously generated signals like SIGPIPE , with a few exceptions.  [cautionend]


Chapter Contents

Previous

Next

Top of Page

Copyright © 2001 by SAS Institute Inc., Cary, NC, USA. All rights reserved.