Functions | |
int | signalfd_init (void) |
void | signalfd_catch (int sig) |
void | signalfd_uncatch (int sig) |
void | signalfd_close (void) |
void signalfd_catch | ( | int | sig | ) |
Mark a signal as being caught through the signalfd interface.
void signalfd_close | ( | void | ) |
Close the signalfd interface.
int signalfd_init | ( | void | ) |
Initialize the signal file descriptor.
This function creates a pipe through which signals will get passed. This is a way of handling signals that avoids most problems posed by UNIX signals. When a signal is caught by this interface, the numerical value of the signal is passed down the pipe as a native integer. The file descriptor is set to non-blocking mode to prevent blocking when reading from it.
To use the file descriptor, use either poll
or select
to determine when it is readable. When it becomes readable, read a single byte from it. The value of this byte indicates what signal was caught.
Due to the global nature of UNIX signal handling, only a single signalfd interface may be active at any time. Do not call signalfd_init
multiple times without calling signalfd_close
first.
void signalfd_uncatch | ( | int | sig | ) |
Unmark a signal as being caught through the signalfd interface.