code wiki / (root) / nx_signalfd.nx

nx_signalfd.nx

buildroot/runtime/nx_signalfd.nx

4103 B109 linesdepth 4pulls 4 transitivereach 0 importersview sourcekind tool
docsdependenciesstructsconstsfunctions

about

nx_signalfd.nx -- Linux signalfd(2) wrapper. signalfd lets the kernel deliver signals via file descriptor reads instead of signal handlers. This is the modern way to integrate signal handling with poll/epoll-driven event loops: you add the signalfd to your poll set and react to signals inline, no async-signal-safe constraints. Linux RV64 syscall: 74 (signalfd4). To receive a signal via signalfd, you ALSO need to mask the signal in the process's normal signal mask via rt_sigprocmask (otherwise the kernel still delivers it normally). We expose nx_signalfd_install which does both steps. Read returns one or more struct signalfd_siginfo records (128 bytes each); the first 4 bytes are the signal number (i32). Pairs with nx_signal (constants + sigaction) + nx_poll (consumer in event loops).

dependencies 2 imports · 0 importers

syscalls.nx nx_signal.nx nx_signalfd.nx

imports: syscalls.nxnx_signal.nx

imported by: nobody (leaf or entry point)

call flow from main pre-order; caps 40 nodes / depth 6 declared; ↻ = already shown

main nx_signalfd_mask_one nx_signalfd_new nx_signalfd_mask_one ↻

structs

none

consts

31const NX_SYS_SIGNALFD4: i64 = 74
32const NX_SYS_RT_SIGPROCMASK: i64 = 135
34const NX_SFD_NONBLOCK: i64 = 0x800
35const NX_SFD_CLOEXEC: i64 = 0x80000
38const NX_SIG_BLOCK: i64 = 0
39const NX_SIG_UNBLOCK: i64 = 1
40const NX_SIG_SETMASK: i64 = 2
43const NX_SSI_BYTES: i64 = 128

functions

48func nx_signalfd_mask_one(sig: i64) -> i64
55func nx_signalfd_block(sig: i64) -> i64
65func nx_signalfd_new(sig: i64, flags: i64) -> i64
74func nx_signalfd_install(sig: i64, flags: i64) -> i64
84func nx_signalfd_read_one(fd: i64, out: *u8) -> i64
calls 1: sys_read
93func main() -> i64