Qp0sEnableSignals()--Enable Process for Signals
Syntax
#include <signal.h> int Qp0sEnableSignals( void );
Service Program Name: QPOSSRV1
Default Public Authority: *USE
Threadsafe: Yes
The Qp0sEnableSignals() function enables the process to receive signals.
The Qp0sEnableSignals() function causes the process signal vector to be initialized for the set of supported signals. The signal handling action for each supported signal is set to the default action, as defined by sigaction() (see sigaction()--Examine and Change Signal Action). The signal blocking mask of the calling thread is set to the empty signal set (see sigemptyset()--Initialize and Empty Signal Set).
If the process is currently enabled for signals, a call to the Qp0sEnableSignals() has no effect. That is, the process signal vector and the signal blocking mask of the calling thread are unchanged and an [EALREADY] error is returned.
Authorities and Locks
None.
Parameters
None.
Return Value
0 | Qp0sEnableSignals() was successful. |
-1 | Qp0sEnableSignals() was not successful. The errno variable is set to indicate the error. |
Error Conditions
If Qp0sEnableSignals() is not successful, errno usually indicates one of the following errors. Under some conditions, errno could indicate an error other than those listed here.
- [EALREADY]
-
Operation already in progress.
The calling process is currently enabled for signals.
- [ENOTSIGINIT]
-
Process not enabled for signals.
An attempt was made to call a signal function under one of the following conditions:
- The signal function is being called for a process that is not enabled for asynchronous signals.
- The signal function is being called when the system signal controls have not been initialized.
Usage Notes
- Processes, by default, are not eligible to receive signals from other
processes or the system. The Qp0sEnableSignals() function
allows the calling process to receive signals from other processes or the
system without having to call other signal functions that enable the process
for signals.
Use of the following functions enable a process for signals:
- alarm()
- getpgrp()
- getpid()
- kill()
- pause()
- Qp0wGetPgrp()
- Qp0wGetPid()
- setitimer()
- sigaction()
- sigprocmask()
- sigsuspend()
- sigtimedwait()
- sigwait()
- sigwaitinfo()
- sleep()
Any of the Pthread APIs. See Pthread APIs for more information.
- Once a process has been enabled for signals, it remains eligible to receive
signals until either it ends or some user action is taken to prevent the
delivery of signals. The user of signals can prevent the signals from being
delivered by calling the sigprocmask() function. The user can
also ignore the signal by calling the sigaction() function.
However, not all signals can be blocked or ignored. For details, see sigaction()--Examine and Change Signal Action and sigprocmask()--Examine and Change Blocked Signals.
- If a process has not been enabled for signals, the signal blocking mask for
any thread created in the process will be set to the empty set.
- If a process with multiple threads is disabled for signals by calling Qp0sDisableSignals() and then later re-enabled for signals, only the thread that causes signals to be enabled will have its signal blocking mask changed. The signal blocking mask for all other threads will be the value last used to set the signal blocking mask for those threads.
Related Information
- The <signal.h> file (see Header
Files for UNIX®-Type Functions)
- alarm()--Set Schedule for Alarm Signal
- kill()--Send Signal to Process or Group of
Processes
- pause()--Suspend Process Until Signal
Received
- Qp0sDisableSignals()--Disable Process for
Signals
- setitimer()--Set Value for Interval Timer
- sigaction()--Examine and Change Signal Action
- sigprocmask()--Examine and Change Blocked
Signals
- sigsuspend()--Wait for Signal
- sigtimedwait()--Synchronously Accept a Signal
for Interval of Time
- sigwait()--Synchronously Accept a Signal
- sigwaitinfo()--Synchronously Accept a Signal and
Signal Data
- sleep()--Suspend Processing for Interval of Time
Example
The following example shows how a process can reset its signal vector and signal blocking mask.
Note: By using the code examples, you agree to the terms of the Code license and disclaimer information.
#include <signal.h> #include <errno.h> int resetSignals( void ) { int return_value; return_value = Qp0sEnableSignals(); if( return_value == -1 ) { Qp0sDisableSignals(); return_value = Qp0sEnableSignals(); } return( return_value ); }
API introduced: V3R6