code wiki / (root) / nx_dir.nx

nx_dir.nx

buildroot/runtime/nx_dir.nx

11265 B321 linesdepth 5pulls 5 transitivereach 40 importersview sourcekind library
docsdependenciesstructsconstsfunctions

about

nx_dir.nx -- higher-level directory walker over nx_dirent. module: nishi-core.io.dir depends: nishi-core.io.dirent, nishi-core.io.fcntl, nishi-core.io.syscalls disk_kb: 4 capability: IO wired_status: FULLY_WIRED license_tier: PUBLIC_NISHI_SUBSTRATE genealogy_id: posix_1003_1_2017_readdir_pattern + nishi_no_skipping_build_the_missing_dependency_cardinal + nishi_bounded_loop_jpl_rule_2_cardinal Per cardinal [[feedback-no-skipping-build-the-missing-dependency]]: nx_dirent.nx exposes raw getdents64 batch + iter primitives. The honesty audits (nx_claim_audit / nx_adversarial_pattern_audit / nx_canary_value whole-file scan) all wanted a per-file callback abstraction over a directory. This primitive IS that brick. Per cardinal [[feedback-bounded-loop-discipline-jpl-rule-2]]: every loop here has an explicit BUDGET ceiling + sealed LoopVerdict. No sentinel-flag hacks.

dependencies 3 imports · 29 importers

syscalls.nx nx_fcntl.nx nx_dirent.nx nx_dir.nx nx_antipattern_catalog.nx nx_canary_value.nx nx_code_archscan.nx nx_code_depgraph.nx nx_contactsheet.nx nx_dir_test.nx nx_doc_census.nx nx_doc_census_real_audit_test.nx nx_doc_census_real_listing_test.nx nx_doc_census_run_test.nx

diagram shows first 10 each side; +0 more imports, +19 more importers in the complete lists below.

imports: syscalls.nxnx_fcntl.nxnx_dirent.nx

imported by: nx_antipattern_catalog.nxnx_canary_value.nxnx_code_archscan.nxnx_code_depgraph.nxnx_contactsheet.nxnx_dir_test.nxnx_doc_census.nxnx_doc_census_real_audit_test.nxnx_doc_census_real_listing_test.nxnx_doc_census_run_test.nxnx_doc_inref.nxnx_doc_xref.nxnx_doc_xref_dual_audit_test.nxnx_doc_xref_real_audit_test.nxnx_find.nxnx_find_test.nxnx_fix_putn.nxnx_gate_discover.nxnx_imgfacts.nxnx_imgsearch.nxnx_ingest_batch.nxnx_jpegprobe.nxnx_parallelism_census.nxnx_pipeline_recursive_walker.nxnx_res_census.nxnx_scaffolding_audit.nxnx_tool_census.nxnx_tool_census_run_test.nxnx_webpprobe.nx

structs

63struct NxDirRow
74struct NxDirResult

consts

33const NX_DIR_OK: i64 = 1
34const NX_DIR_EMPTY: i64 = 2 // directory has no entries (besides . and ..)
35const NX_DIR_TRUNCATED: i64 = 3 // entries omitted because out_capacity reached
36const NX_DIR_NAME_ARENA_EXHAUSTED: i64 = 4 // copy aborted before full enumeration
37const NX_DIR_OPEN_FAILED: i64 = 5
38const NX_DIR_GETDENTS_FAILED: i64 = 6
39const NX_DIR_BAD_ARGS: i64 = 7
54const NX_DIR_GETDENTS_BUF_BYTES: i64 = 8192
55const NX_DIR_MAX_READ_ROUNDS: i64 = 16384 // 16384 * 8KiB = 128MiB worth of dir bytes
56const NX_DIR_MAX_ENTRIES_PER_BATCH: i64 = 65536 // upper bound per nx_dirent_iter walk
70const NX_DIR_ROW_BYTES: i64 = 32
82const NX_DIR_RESULT_BYTES: i64 = 40

functions

41func nx_dir_verdict_name(v: i64) -> *u8
86func nx_dir_name_strlen(name: *u8) -> i64
called by 1: nx_dir_list
101func nx_dir_is_dotlike(name: *u8) -> i64
called by 1: nx_dir_list
112func nx_dir_arena_copy_name(
called by 1: nx_dir_list
146func nx_dir_list(
275func nx_dir_name_ends_with(
306func nx_dir_row_at(rows: *NxDirRow, idx: i64) -> *NxDirRow
310func nx_dir_row_is_regular_file(row: *NxDirRow) -> i64
316func nx_dir_row_is_subdirectory(row: *NxDirRow) -> i64