Next: signal, Previous: psignal, Up: Signals [Contents][Index]

### 7.2 `raise`—send a signal

Synopsis

    #include <signal.h>
    int raise(int sig);

    int _raise_r(void *reent, int sig);

Description
Send the signal sig (one of the macros from ‘`sys/signal.h`’). This interrupts your program’s normal flow of execution, and allows a signal handler (if you’ve defined one, using `signal`) to take control.

The alternate function `_raise_r` is a reentrant version. The extra argument reent is a pointer to a reentrancy structure.

Returns
The result is `0` if sig was successfully raised, `1` otherwise. However, the return value (since it depends on the normal flow of execution) may not be visible, unless the signal handler for sig terminates with a `return` or unless `SIG_IGN` is in effect for this signal.

Portability
ANSI C requires `raise`, but allows the full set of signal numbers to vary from one implementation to another.

Required OS subroutines: `getpid`, `kill`.