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:


Usage Notes

  1. 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:

    Any of the Pthread APIs. See Pthread APIs for more information.

  2. 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.

  3. 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.

  4. 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


Example

See Code disclaimer information for information pertaining to code examples.

The following example shows how a process can reset its signal vector and signal blocking mask:

#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
Top | UNIX-Type APIs | APIs by category