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 calling process

&pagelevel(4)&pagelevel

Syntax

#include <signal.h>

int raise (int sig); 

Description

If the function is called with POSIX functionality, its behavior conforms with XPG4 as described below:

raise() sends the signal sig to the calling process. The defined signals are listed in signal.h.

If threads are used, then the function affects the process or a thread in the following manner:

  • Sends a signal to the calling thread. The effect of raise(sig) is equivalent to calling pthread_kill(pthread_self(), sig).

    BS2000

  • The following deviations in behavior must be noted if the function is called with BS2000 functionality:

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

The following subset of the signals defined in signal.h may be used for sig:

Signal

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

SIGTIM

TIMER

A time interval has elapsed (CPU time)

SIGINTR

INTR

SEND-MESSAGE command

(End)

Return val.

0

if the signal was sent successfully.


-1

if an error occurs. errno is set to indicate the error.

Fehler

raise() will fail if:

Erweiterung


EINVAL

The value of sig is an invalid signal number. (End)

Notes

raise(int sig) uses the following call to kill to send the signal to the calling process:

kill(getpid(), sig);

A detailed list of error conditions can be found under kill().

BS2000
With the exception of SIGKILL and SIGSTOP, the above signals can be intercepted with the signal() function (see signal()).

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

"CCM0101 signal occurred: signal"

"CCM0999 Exit -1"

The SIGABRT signal 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.

The SIGKILL signal 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. (End)

See also

atexit(), exit(), _exit(), kill(), sigaction(), signal(), signal.h.