code wiki / (root) / nx_audit_server_daemon.nx

nx_audit_server_daemon.nx

buildroot/runtime/nx_audit_server_daemon.nx

3842 B95 linesdepth 4pulls 7 transitivereach 0 importersview sourcekind servicetopic audit
docsdependenciesstructsconstsfunctions

about

nx_audit_server_daemon.nx -- accept-loop variant of audit server. Sibling of nx_audit_server_main.nx (accept-once, used by the loopback bench). This file is the LONG-RUNNING daemon: binds 127.0.0.1:51847, accepts forever, serves docs/audit/{index.html, snapshot.json} via nx_pages_static. Per cardinal user-owns-every-bit: this binary does NOT install itself as a service. Caller installs via: - bench/nx_audit_serve.sh (bash supervisor wrapper) - or by hand: `./nx_audit_server_daemon &` Per cardinal feedback-bounded-loop-discipline-jpl-rule-2: the accept loop is bounded by an inner request budget (1M requests before clean exit to let the parent supervisor recycle). This is the Erlang let-it-crash discipline applied -- a long-lived process gives the parent supervisor an opportunity to refresh state periodically. expect_exit: 0 (never, in normal operation; bench runs with a kill-after-N-seconds harness)

dependencies 3 imports · 0 importers

nx_syscalls_x86_64.nx nx_http_server.nx nx_pages_static.nx nx_audit_server_daemon.nx

imports: nx_syscalls_x86_64.nxnx_http_server.nxnx_pages_static.nx

imported by: nobody (leaf or entry point)

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

main nx_http_server_addr_loopba nx_http_server_make_sockad nx_http_server_listen sys_ignore_sigpipe sys_mmap sys_socket sys_mmap ↻ sys_setsockopt sys_bind sys_close sys_listen nx_http_server_accept_one sys_accept nx_http_server_read_reques sys_read nx_http_parse_request nx_pages_serve_file nx_pages_emit_405 nxpg_put_cstr nxpg_put nx_pages_emit_404 nxpg_put_cstr ↻ sys_mmap ↻ nx_path_canonicalize nxp_is_dotdot_segment nx_pages_emit_403 nxpg_put_cstr ↻ nx_path_join nx_pages_emit_500 nxpg_put_cstr ↻ sys_read_file sys_openat_rd sys_lseek sys_mmap ↻ sys_read ↻ sys_close ↻ nx_pages_mime_from_path nxpg_ends_with_5 nxpg_ends_with_4

structs

none

consts

27const NXAD_PORT: i64 = 51847
28const NXAD_REQ_CAP: i64 = 8192
29const NXAD_RESP_CAP: i64 = 524288 // 512 KB
30const NXAD_REQUEST_BUDGET: i64 = 1000000 // recycle after 1M reqs

functions

32func main() -> i64