logo
Free, unlimited AI code reviews that run on commit
git-lrc git-lrc GitHub Install Now We'd appreciate a star git-lrc - Free, unlimited AI code reviews that run on commit | Product Hunt git-lrc - Free, unlimited AI code reviews that run on commit | Product Hunt

sigemptyset, sigfillset, sigaddset, sigdelset, sigismember - POSIX signal set operations

Attributes

       For an explanation of the terms used in this section, see attributes(7).
       ┌─────────────────────────────────────────────────────────────────────────────┬───────────────┬─────────┐
       │ InterfaceAttributeValue   │
       ├─────────────────────────────────────────────────────────────────────────────┼───────────────┼─────────┤
       │ sigemptyset(), sigfillset(), sigaddset(), sigdelset(), sigismember(),       │ Thread safety │ MT-Safe │
       │ sigisemptyset(), sigorset(), sigandset()                                    │               │         │
       └─────────────────────────────────────────────────────────────────────────────┴───────────────┴─────────┘

Description

       These functions allow the manipulation of POSIX signal sets.

       sigemptyset() initializes the signal set given by set to empty, with all signals excluded from the set.

       sigfillset() initializes set to full, including all signals.

       sigaddset() and sigdelset() add and delete respectively signal signum from set.

       sigismember() tests whether signum is a member of set.

       Objects  of  type  sigset_t  must be initialized by a call to either sigemptyset() or sigfillset() before
       being passed to the functions  sigaddset(),  sigdelset(),  and  sigismember()  or  the  additional  glibc
       functions  described  below (sigisemptyset(), sigandset(), and sigorset()).  The results are undefined if
       this is not done.

Errors

EINVALsignum is not a valid signal.

History

       POSIX.1-2001.

Library

       Standard C library (libc, -lc)

Name

       sigemptyset, sigfillset, sigaddset, sigdelset, sigismember - POSIX signal set operations

Notes

       When  creating  a  filled  signal set, the glibc sigfillset() function does not include the two real-time
       signals used internally by the NPTL threading implementation.  See nptl(7) for details.

Return Value

sigemptyset(), sigfillset(), sigaddset(), and sigdelset() return 0 on success and -1 on error.

       sigismember() returns 1 if signum is a member of set, 0 if signum is not a member, and -1 on error.

       On error, these functions set errno to indicate the error.

See Also

sigaction(2), sigpending(2), sigprocmask(2), sigsuspend(2)

Linux man-pages 6.9.1                              2024-05-02                                       SIGSETOPS(3)

Standards

       POSIX.1-2008.

Synopsis

#include<signal.h>intsigemptyset(sigset_t*set);intsigfillset(sigset_t*set);intsigaddset(sigset_t*set,intsignum);intsigdelset(sigset_t*set,intsignum);intsigismember(constsigset_t*set,intsignum);

   Feature Test Macro Requirements for glibc (see feature_test_macros(7)):

       sigemptyset(), sigfillset(), sigaddset(), sigdelset(), sigismember():
           _POSIX_C_SOURCE

Versions

GNU
       If the _GNU_SOURCE feature test macro is defined, then  <signal.h>  exposes  three  other  functions  for
       manipulating signal sets:

       intsigisemptyset(constsigset_t*set);intsigorset(sigset_t*dest,constsigset_t*left,constsigset_t*right);intsigandset(sigset_t*dest,constsigset_t*left,constsigset_t*right);sigisemptyset() returns 1 if set contains no signals, and 0 otherwise.

       sigorset()  places  the union of the sets left and right in dest.  sigandset() places the intersection of
       the sets left and right in dest.  Both functions return 0 on success, and -1 on failure.

       These functions are nonstandard (a few other systems provide similar functions) and their use  should  be
       avoided in portable applications.