Expand description
signalfd – Signal notification file descriptor
Provides a file descriptor for receiving signals via read(2) instead of signal handlers. Integrable with epoll/poll for unified I/O event loops. Used by D-Bus daemon and systemd-compatible service managers.
§Syscall Interface
signalfd_create(fd, mask_ptr, mask_size, flags) -> fd(syscall 334)- Read via standard
read(2)on returned fd
§Semantics
- read: Returns one or more
SignalfdSiginfostructs (128 bytes each) for pending signals in the mask. Signals consumed by signalfd are removed from the process’s pending set. - Creating with fd == -1 creates a new signalfd; passing an existing fd updates the signal mask.
Structs§
- SigSet
- Signal mask – a bitmask of signal numbers to monitor.
- Signal
FdNode - VfsNode wrapper around a signalfd instance.
- Signalfd
Siginfo - Signal information returned by read(2) on a signalfd.
Matches Linux’s
struct signalfd_siginfolayout (128 bytes).
Constants§
- SFD_
CLOEXEC - SFD_CLOEXEC: Set close-on-exec.
- SFD_
NONBLOCK - SFD_NONBLOCK: Return EAGAIN instead of blocking on empty read.
Functions§
- deliver_
signal - Deliver a signal to all signalfds of a given process that have the signal in their mask.
- is_
readable - Query whether a signalfd has pending signals. Used by epoll to check readiness without consuming data.
- signalfd_
close - Close (destroy) a signalfd instance.
- signalfd_
create - Create or update a signalfd.
- signalfd_
read - Read one pending signal from a signalfd.