Private archive copy · Unofficial site · Content copyright belongs to Runoob Tutorial and the original authors · View Original

C Library Function – sigfillset()

C Library Function - sigfillset()

C Standard Library - <signal.h> C Standard Library -

Description

sigfillset The function is a function in the C standard library, used to initialize a signal set so that it contains all defined signals. This function is defined in header.

Syntax

int sigfillset(sigset_t *set);

Parameters

Return Value

Example

The following is an example of using sigfillset Example program demonstrating the function initializing a signal set. The program initializes a signal set to contain all signals and checks whether it contains a specific signal.

Example

#include

#include

int

main

(

)

{

    sigset_t set

;

   

// initialize the signal set to include all signals

   

if

(

sigfillset

(

&

set

)

==

1

)

{

       

perror

(

"sigfillset"

)

;

       

return

1

;

   

}

   

// check whether the signal set contains SIGINT

   

if

(

sigismember

(

&

set

,

SIGINT

)

)

{

       

printf

(

"SIGINT is in the set\n"

)

;

   

}

else

{

       

printf

(

"SIGINT is not in the set\n"

)

;

   

}

   

return

0

;

}

Running the above example program may produce the following output:

SIGINT is in the set

The program initializes the signal set to contain all signals and checks whether the signal set contains SIGINT signal, and the result shows that SIGINT signal is in the signal set.

Explanation

Notes

C Standard Library - <signal.h> C Standard Library -