Chapter Contents

Previous

Next
siggen

siggen



Generate an Artificial Signal with Additional Information

Portability: SAS/C extension


SYNOPSIS
DESCRIPTION
RETURN VALUE
CAUTION
EXAMPLE
RELATED FUNCTIONS
SEE ALSO


SYNOPSIS

#include <lcsignal.h>

int siggen(int signum, void *info);


DESCRIPTION

siggen artificially generates a signal and provides information about the signal. The argument signum is the number of the signal that is to be generated. You should specify this argument symbolically using one of the signal names listed in Supported Signals. When you call siggen , the signal is handled as established by a previous call to signal or by the default handler if signal is not called.

The argument info defines the value to be returned by the siginfo function, if siginfo is called by the signal handler. For some signals, such as SIGABRT, the info pointer is also meaningful to the default handler for the signal. If default handling is in effect for an USS signal generated by siggen , siggen invokes the kill function to enable USS to perform default handling.

A signal generated by siggen is always handled immediately, regardless of whether the signal is asynchronous or whether it is blocked.


RETURN VALUE

siggen returns 0 if it is successful or a nonzero value if it is not successful. Note that siggen may not return if the handler for the signal terminates with a call to longjmp , exit , or abort , or if the handler for the signal defaults to abnormal program termination.


CAUTION

If info is not NULL , it should be a value of the appropriate pointer type.

See the description of the signal for the information returned by a call to siginfo when a signal occurs naturally. For example, the expected type for the SIGSEGV signal is SEGV_t. Declarations for these types (except the types for SIGIUCV) are included in <lcsignal.h> .

If you use siggen to test signal handling in a program, keep in mind that signals generated by siggen are treated somewhat differently than signals that occur naturally. Signals generated by siggen are always handled immediately, so you should not use siggen to test signal blocking. You may also encounter problems if you use siggen to test the handler for an asynchronous signal because the handler for the signal is executed immediately, not just when a function is called or returns.


EXAMPLE

The following code fragment illustrates the use of siggen .

#include <lcsignal.h>

/* Abort execution with ABEND code 611. */
ABRT_t abrt_info;
abtr_info.ABEND_str = "";
abrt_info.ABEND_info = NULL;
abrt_info.ABEND_code = 611;
.
.
.
siggen(SIGABRT, &abrt_info);


RELATED FUNCTIONS

abort , kill , raise


SEE ALSO


Chapter Contents

Previous

Next

Top of Page

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