Your Browser is not longer supported

Please use Google Chrome, Mozilla Firefox or Microsoft Edge to view the page correctly
Loading...

{{viewport.spaceProperty.prod}}

raise - Send signal to own program

&pagelevel(4)&pagelevel

Definition   

#include <signal.h>

int raise(int sig);

raise sends the signal sig to its own program.

raise can be used both to simulate STXIT events as well as to send STXIT-independent signals (self-defined or predefined by the C runtime system).

Parameters


int sig

Signal to be sent to its own program. The symbolic constants listed in the following overview under “SIGNR” may be used for sig. These constants are defined in the include file <signal.h>.

SIGNR

STXIT class

Meaning

SIGHUP

ABEND

Disconnection of link to terminal

SIGINT

ESCPBRK

Interrupt from the terminal with [K2]

SIGILL

PROCHK

Execution of an invalid instruction

SIGABRT

-

raise signal for program abort with _exit(-1)

SIGFPE

PROCHK

Error in a floating-point operation

SIGKILL

-

raise signal for program abort with exit(-1)

SIGSEGV

ERROR

Memory access with invalid segment access

SIGALRM

RTIMER

A time interval has elapsed (real time)

SIGTERM

TERM

Signal at program termination

SIGUSR1

-

Defined by the user

SIGUSR2

-

Defined by the user

SIGDVZ

PROCHK

Division by 0

SIGXCPU

RUNOUT

CPU time has run out

SIGBPT +

SVC

Breakpoint (currently not supported)

SIGTIM

TIMER

A time interval has elapsed (CPU time)

SIGINTR

INTR

SEND-MESSAGE command

SIGSVC +

SVC

SVC call (currently not supported)

Signals makred with + are currently not supported.

Return val.

0

the signal was sent successfully.


-1

the signal could not be sent, because sig is not a valid signal number. In addition, errno is set to EINVAL (invalid signal number).

Notes

With the exception of SIGKILL, the raise signals can be intercepted with the signal function. You will find detailed information on this topic under signal.

If the program does not provide for the handling of raise signals, it is terminated with exit(-1) when a signal arrives, and the following messages are displayed:

"CCM0101 signal occurred: signal"

"CCM0999 Exit -1"

Signal SIGABRT
SIGABRT causes the program to terminate with _exit(-1). In contrast to exit(-1), the termination routines registered with atexit are not called and open files are not closed.

Signal SIGKILL
SIGKILL causes the program to terminate with exit(-1). In contrast to SIGABRT, SIGKILL cannot be intercepted, i.e. signal calls which specify the name of a self-defined function or SIG_IGN as the argument are not valid for SIGKILL.

Example

A program that aborts itself.

#include <signal.h>
int main(void)
{
  for(;;)
    raise(SIGKILL);
  return 0;
}

See also

alarm, atexit, exit, _exit, signal