sigdelset()--Delete Signal from Signal Set


  Syntax
 #include <signal.h>

 int sigdelset( sigset_t *set, int signo );   

  Service Program Name: QPOSSRV1

  Default Public Authority: *USE

  Threadsafe: Yes

The sigdelset() function is part of a family of functions that manipulate signal sets. Signal sets are data objects that let a thread keep track of groups of signals. For example, a thread might create a signal set to record which signals it is blocking, and another signal set to record which signals are pending. Signal sets are used to manipulate groups of signals used by other functions (such as sigprocmask()) or to examine signal sets returned by other functions (such as sigpending()).

sigdelset() removes the specified signo from the list of signals recorded in set.


Authorities and Locks

None.


Parameters

*set
(Input) A pointer to a signal set.

signo
(Input) A signal from the list defined in Control Signals Table.

Return Value

0 sigdelset() successfully deleted from the signal set.
-1 sigdelset() was not successful. The errno variable is set to indicate the error.


Error Conditions

If sigdelset() is not successful, errno usually indicates the following error. Under some conditions, errno could indicate an error other than that listed here.

[EINVAL]

The value specified for the argument is not correct.

A function was passed incorrect argument values, or an operation was attempted on an object and the operation specified is not supported for that type of object.

An argument value is not valid, out of range, or NULL.

The value of signo is not within the range of valid signals or specifies a signal that is not supported.


Related Information


Example

The following example deletes a signal from a set of signals.

Note: By using the code examples, you agree to the terms of the Code license and disclaimer information.

#include <stdio.h>
#include <unistd.h>
#include <signal.h>

void catcher( int sig ) {

    printf( "catcher() has gained control\n" );
}

int main( int argc, char *argv[] ) {

    struct sigaction sigact;
    sigset_t sigset;

    sigemptyset( &sigact.sa_mask );
    sigact.sa_flags = 0;
    sigact.sa_handler = catcher;
    sigaction( SIGUSR1, &sigact, NULL );

    /*
     * Blocking all signals prevents the blockable
     * signals from being delivered until they are
     * unblocked, so the catcher will not gain
     * control.
     */

    sigfillset( &sigset );
    sigaddset( &sigset, SIGUSR1 );
    sigprocmask( SIG_SETMASK, &,sigset, NULL );

    printf( "before kill()\n" );
    kill( getpid(), SIGUSR1 );

    printf( "before unblocking SIGUSR1\n" );
    sigdelset( &sigset, SIGUSR1 );
    sigprocmask( SIG_SETMASK, &sigset, NULL );

    printf( "after unblocking SIGUSR1\n" );

    return( 0 );
}

Output:

    before kill()
    before unblocking SIGUSR1
    catcher() has gained control
    after unblocking SIGUSR1


API introduced: V3R6

[ Back to top | UNIX-Type APIs | APIs by category ]