nx_signal.nx
buildroot/runtime/nx_signal.nx
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
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
structs
| 67 | struct NxSigAction |
consts
| 29 | const NX_SIGHUP: i64 = 1 |
| 30 | const NX_SIGINT: i64 = 2 |
| 31 | const NX_SIGQUIT: i64 = 3 |
| 32 | const NX_SIGILL: i64 = 4 |
| 33 | const NX_SIGTRAP: i64 = 5 |
| 34 | const NX_SIGABRT: i64 = 6 |
| 35 | const NX_SIGBUS: i64 = 7 |
| 36 | const NX_SIGFPE: i64 = 8 |
| 37 | const NX_SIGKILL: i64 = 9 |
| 38 | const NX_SIGUSR1: i64 = 10 |
| 39 | const NX_SIGSEGV: i64 = 11 |
| 40 | const NX_SIGUSR2: i64 = 12 |
| 41 | const NX_SIGPIPE: i64 = 13 |
| 42 | const NX_SIGALRM: i64 = 14 |
| 43 | const NX_SIGTERM: i64 = 15 |
| 44 | const NX_SIGCHLD: i64 = 17 |
| 45 | const NX_SIGCONT: i64 = 18 |
| 46 | const NX_SIGSTOP: i64 = 19 |
| 47 | const NX_SIGPROF: i64 = 27 |
| 50 | const NX_SA_NOCLDSTOP: i64 = 0x00000001 |
| 51 | const NX_SA_NOCLDWAIT: i64 = 0x00000002 |
| 52 | const NX_SA_SIGINFO: i64 = 0x00000004 |
| 53 | const NX_SA_ONSTACK: i64 = 0x08000000 |
| 54 | const NX_SA_RESTART: i64 = 0x10000000 |
| 55 | const NX_SA_NODEFER: i64 = 0x40000000 |
| 56 | const NX_SA_RESETHAND: i64 = 0x80000000 |
| 59 | const NX_SIG_DFL: i64 = 0 |
| 60 | const NX_SIG_IGN: i64 = 1 |
| 74 | const NX_SIGACTION_BYTES: i64 = 32 |
functions
| 76 | func nx_signal_action_new(handler: i64, flags: i64, mask: i64) -> *NxSigAction |
| 93 | func nx_signal_action_install(sig: i64, act: *NxSigAction, old: *NxSigAction) -> i64 |
| 99 | func nx_signal_ignore(sig: i64) -> i64 |
| 105 | func nx_signal_default(sig: i64) -> i64 |
| 112 | func nx_signal_kill(pid: i64, sig: i64) -> i64 called by 1: nx_signal_raise |
| 116 | func nx_signal_raise(sig: i64) -> i64 calls 1: nx_signal_kill |
| 123 | func main() -> i64 |