raise Subroutine

Purpose

Sends a signal to the currently running program.

Libraries

Standard C Library (libc.a)

Threads Library (libpthreads.a)

Syntax

#include <sys/signal.h>

int raise ( Signal)
int Signal;

Description

The raise subroutine sends the signal specified by the Signal parameter to the executing process or thread, depending if the POSIX threads API (the libpthreads.a library) is used or not. When the program is not linked with the threads library, the raise subroutine sends the signal to the calling process as follows:

return kill(getpid(), Signal);

When the program is linked with the threads library, the raise subroutine sends the signal to the calling thread as follows:

return pthread_kill(pthread_self(), Signal);

When using the threads library, it is important to ensure that the threads library is linked before the standard C library.

Parameter

Item Description
Signal Specifies a signal number.

Return Values

Upon successful completion of the raise subroutine, a value of 0 is returned. Otherwise, a nonzero value is returned, and the errno global variable is set to indicate the error.

Error Code

Item Description
EINVAL The value of the sig argument is an invalid signal number