Introduction to the operation methods of initializing adding and deleting process signals in C language

  • 2020-04-02 03:21:28
  • OfStack

C language sigemptyset() function: initializes the signal set
The header file:


#include <signal.h>

Definition function:


int sigemptyset(sigset_t *set);

Sigemptyset () is used to initialize and empty the set signal set.

Return value: 0 on success or -1 on error.

Error code: the EFAULT parameter set pointer address cannot be accessed.

C language sigaddset() function: add a signal to the signal set
The header file:


#include <signal.h>

Definition function:


int sigaddset(sigset_t *set, int signum);

Sigaddset () is used to add the signal represented by the parameter signum to the set signal set.

Return value: 0 on success or -1 on error.

Error code:
1. The address of the EFAULT parameter set pointer cannot be accessed.
2. Illegal signal number of EINVAL parameter signum.

C language sigdelset() function: remove a signal from the signal set
The header file:


#include <signal.h>

Definition function:


int sigdelset(sigset_t * set, int signum);

Sigdelset () is used to remove the signal represented by the parameter signum from the set signal set.

Return value: 0 on success or -1 on error.

Error code:
1. The address of the EFAULT parameter set pointer cannot be accessed.
2. Illegal signal number of EINVAL parameter signum.


Related articles: