code wiki / (root) / nx_signal.nx

nx_signal.nx

buildroot/runtime/nx_signal.nx

5069 B144 linesdepth 3pulls 3 transitivereach 6 importersview sourcekind tool
docsdependenciesstructsconstsfunctions

about

nx_signal.nx -- POSIX signal numbers + sigaction syscall wrapper. Used by: - Panic handler (catch SIGSEGV / SIGBUS / SIGILL / SIGFPE and print a structured backtrace before the kernel writes a core file). - Long-running daemons (catch SIGTERM / SIGINT for clean shutdown). - Profilers (catch SIGPROF for sampling). - Self-modifying code probes (catch SIGTRAP for breakpoint handling outside a debugger). We provide the constants + a minimal wrapper around the Linux rt_sigaction(2) syscall. The handler signature is func(sig: i64, info: *u8, ctx: *u8) -> i64 (3-arg SA_SIGINFO form). Today NishiLang doesn't yet have first-class function pointers, so we accept a raw i64 address the caller resolves via inline asm or by leaking the symbol.

dependencies 1 imports · 4 importers

syscalls.nx nx_signal.nx nx_browser.nx nx_sig2_bp_gate.nx nx_signalfd.nx nx_signaling_v2.nx

imports: syscalls.nx

imported by: nx_browser.nxnx_sig2_bp_gate.nxnx_signalfd.nxnx_signaling_v2.nx

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

main nx_signal_action_new nx_signal_ignore nx_signal_action_new ↻ nx_signal_action_install nx_signal_default nx_signal_action_new ↻ nx_signal_action_install ↻

structs

67struct NxSigAction

consts

29const NX_SIGHUP: i64 = 1
30const NX_SIGINT: i64 = 2
31const NX_SIGQUIT: i64 = 3
32const NX_SIGILL: i64 = 4
33const NX_SIGTRAP: i64 = 5
34const NX_SIGABRT: i64 = 6
35const NX_SIGBUS: i64 = 7
36const NX_SIGFPE: i64 = 8
37const NX_SIGKILL: i64 = 9
38const NX_SIGUSR1: i64 = 10
39const NX_SIGSEGV: i64 = 11
40const NX_SIGUSR2: i64 = 12
41const NX_SIGPIPE: i64 = 13
42const NX_SIGALRM: i64 = 14
43const NX_SIGTERM: i64 = 15
44const NX_SIGCHLD: i64 = 17
45const NX_SIGCONT: i64 = 18
46const NX_SIGSTOP: i64 = 19
47const NX_SIGPROF: i64 = 27
50const NX_SA_NOCLDSTOP: i64 = 0x00000001
51const NX_SA_NOCLDWAIT: i64 = 0x00000002
52const NX_SA_SIGINFO: i64 = 0x00000004
53const NX_SA_ONSTACK: i64 = 0x08000000
54const NX_SA_RESTART: i64 = 0x10000000
55const NX_SA_NODEFER: i64 = 0x40000000
56const NX_SA_RESETHAND: i64 = 0x80000000
59const NX_SIG_DFL: i64 = 0
60const NX_SIG_IGN: i64 = 1
74const NX_SIGACTION_BYTES: i64 = 32

functions

76func nx_signal_action_new(handler: i64, flags: i64, mask: i64) -> *NxSigAction
93func nx_signal_action_install(sig: i64, act: *NxSigAction, old: *NxSigAction) -> i64
99func nx_signal_ignore(sig: i64) -> i64
105func nx_signal_default(sig: i64) -> i64
112func nx_signal_kill(pid: i64, sig: i64) -> i64
called by 1: nx_signal_raise
116func nx_signal_raise(sig: i64) -> i64
calls 1: nx_signal_kill
123func main() -> i64