code wiki / (root) / nx_connect_gate.nx

nx_connect_gate.nx

buildroot/runtime/nx_connect_gate.nx

6758 B156 linesdepth 5pulls 7 transitivereach 0 importersview sourcekind gate/prooftopic connect
docsdependenciesstructsconstsfunctions

about

nx_connect_gate.nx -- proves nx_connect_bounded actually BOUNDS a connect, and that it is a safe drop-in for the 100 raw sys_connect sites. THE NON-VACUITY TOOTH is T2: it dials 192.0.2.1 (RFC5737 TEST-NET-1, guaranteed unroutable, so the SYN is black-holed rather than refused) with a 2s budget. A RAW sys_connect against that address returns after the kernel's SYN-retry ceiling of ~127 SECONDS. If T2 comes back in ~2s the bound is real; if it comes back in ~127s the primitive is decorative. The gate MEASURES the elapsed time and fails on the number -- it does not take the return code's word for it. expect_exit: 0 license_tier: ORIGINAL

dependencies 5 imports · 0 importers

nx_syscalls.nx nx_connect.nx nx_fcntl.nx nx_clock.nx nx_gate_verdict.nx nx_connect_gate.nx

imports: nx_syscalls.nxnx_connect.nxnx_fcntl.nxnx_clock.nxnx_gate_verdict.nx

imported by: nobody (leaf or entry point)

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

main g_puts sys_write sys_socket nx_fcntl sys_close g_putn sys_mmap sys_write ↻ g_tooth g_puts ↻ g_sa sys_mmap ↻ sys_bind sys_listen nx_connect_bounded nx_fcntl ↻ sys_connect sys_mmap ↻ sys_poll nx_clock_monotonic_ns sys_mmap ↻ sys_clock_gettime_mono gv_ctr sys_mmap ↻ gv_verdict gv_puts sys_write ↻ gv_num sys_mmap ↻ sys_write ↻ sys_munmap gv_journal sys_openat_append sys_mmap ↻ gv_catn sys_mmap ↻ sys_munmap ↻ sys_now_realtime_sec sys_mmap ↻

structs

none

consts

16const G_PORT_LIVE: i64 = 19781
17const G_PORT_CLOSED: i64 = 19782
18const G_BUDGET_MS: i64 = 2000
19const G_SLACK_MS: i64 = 5000
20const G_NS_PER_MS: i64 = 1000000
22const G_MIN_MS: i64 = 1500

functions

24func g_puts(s: *u8) -> i64 { var n: i64 = 0; while s[n] != (0 as u8) { n = n + 1 } sys_write(1, s, n); return 0 }
called by 2: g_toothmain calls 1: sys_write
25func g_putn(v: i64) -> i64
called by 1: main calls 2: sys_mmapsys_write
43func g_sa(a: i64, b: i64, c: i64, d: i64, port: i64) -> *u8
called by 1: main calls 1: sys_mmap
58func g_tooth(name: *u8, ok: i64) -> i64
called by 1: main calls 1: g_puts
64func main(argc: i64, argv: *i64) -> i64