z/OS Using REXX and z/OS UNIX System Services
Previous topic | Next topic | Contents | Contact z/OS | Library | PDF


sigaction

z/OS Using REXX and z/OS UNIX System Services
SA23-2283-00

Read syntax diagramSkip visual syntax diagram
>>-sigaction--signal--new_handler--new_flag--------------------->

>--old_handler--old_flag---------------------------------------><

Function

sigaction invokes the sigaction callable service to examine, change, or both examine and change the action associated with a specific signal for all the threads in the process.

Note: All threads within a process share the signal handlers (a set of additional signals to be masked) and the flags specified by the sigaction callable service.

Parameters

signal
The signal, as specified by a numeric value or a predefined variable beginning with SIG.
Variable Description
SIGABND Abend
SIGABRT Abnormal termination
SIGALRM Timeout
SIGBUS Bus error
SIGCHLD Child process terminated or stopped
SIGCONT Continue if stopped
SIGFPE Erroneous arithmetic operation, such as division by zero or an operation resulting in an overflow
SIGHUP Hangup detected on the controlling terminal
SIGILL Termination that cannot be caught or ignored
SIGINT Interactive attention
SIGIO Completion of input or output
SIGIOERR Error on input/output; used by the C runtime library
SIGKILL Termination that cannot be caught or ignored
SIGPIPE Write on a pipe with no readers
SIGPOLL Pollable event
SIGPROF Profiling timer expired
SIGQUIT Interactive termination
SIGSEGV Detection of an incorrect memory reference
SIGSTOP Stop that cannot be caught or ignored
SIGSYS Bad system call
SIGTERM Termination
SIGTRAP Trap used by the ptrace callable service
SIGTSTP Interactive stop
SIGTTIN Read from a controlling terminal attempted by a member of a background process group
SIGTTOU Write from a controlling terminal attempted by a member of a background process group
SIGURG High bandwidth data is available at a socket
SIGUSR1 Reserved as application-defined signal 1
SIGUSR2 Reserved as application-defined signal 2
SIGVTALRM Virtual timer expired
SIGXCPU CPU time limit exceeded
SIGXFSZ File size limit exceeded
new_handler
Specifies the new setting for handling the signal. The following predefined variables can be used for new_handler:
Variable Description
SIG_CAT Set signal handling to catch the signal.
SIG_DFL Set signal handling to the default action.
SIG_IGN Set signal handling to ignore the signal.
SIG_QRY Query the handling for that signal.
new_flag
Used to modify the behavior of the specified signal. Specify one of these:
Variable Description
0 Use the default behavior.
SA_NOCLDWAIT Do not create zombie processes when child processes exit.
SA_RESETHAND Reset the signal action to the default, SIG_DFL, when delivered.
SA_NOCLDSTOP Do not generate SIGCHLD when the child processes stop.
old_handler
A variable name for the buffer where the system returns the old (current) signal handling action.
old_flag
The name of the variable that will store the old (current) signal action flags.

Usage notes

  1. If new_handler is set to the action SIG_DFL for a signal that cannot be caught or ignored, the sigaction request is ignored and the return value is set to 0.
  2. Setting a signal action to ignore for a signal that is pending causes the pending signal to be discarded.
  3. Setting signal action SIG_IGN or catch for signals SIGSTOP or SIGKILL is not allowed.
  4. Setting signal action SIG_IGN for SIGCHLD or SIGIO is not allowed.
  5. The sigaction caller's thread must be registered for signals. You can register the thread by calling syscalls('SIGON'). If the thread is not registered for signals, the sigaction service fails with an ERRNO of EINVAL and ERRNOJR of JRNotSigSetup.

Example

To catch a SIGALRM signal:
"sigaction" sigalrm sig_cat 0 "prevhndlr prevflag"

Go to the previous page Go to the next page




Copyright IBM Corporation 1990, 2014