code wiki / (root) / nx_flock.nx

nx_flock.nx

buildroot/runtime/nx_flock.nx

2770 B87 linesdepth 3pulls 3 transitivereach 0 importersview sourcekind tool
docsdependenciesstructsconstsfunctions

about

nx_flock.nx -- BSD-style file locking via flock(2). Two flavors of file locking on Linux: 1. flock(2) -- whole-file advisory lock, simpler, less powerful 2. fcntl(2) F_SETLK -- byte-range lock, more flexible This module covers (1). flock() is what most build tools and daemons use: - Lockfile to prevent two builds from running concurrently - Daemon PID file lock (acquire on startup, release at exit) - Crash-safe single-instance enforcement Linux RV64 syscall: 32 (flock). Lock types: LOCK_SH shared (read) lock LOCK_EX exclusive (write) lock LOCK_UN unlock LOCK_NB non-blocking (OR with one of the above)

dependencies 1 imports · 0 importers

syscalls.nx nx_flock.nx

imports: syscalls.nx

imported by: nobody (leaf or entry point)

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

main nx_flock_try_ex nx_flock nx_flock_un nx_flock ↻

structs

none

consts

29const NX_SYS_FLOCK: i64 = 32
31const NX_LOCK_SH: i64 = 1
32const NX_LOCK_EX: i64 = 2
33const NX_LOCK_NB: i64 = 4
34const NX_LOCK_UN: i64 = 8

functions

39func nx_flock(fd: i64, op: i64) -> i64
44func nx_flock_ex(fd: i64) -> i64
calls 1: nx_flock
50func nx_flock_try_ex(fd: i64) -> i64
called by 1: main calls 1: nx_flock
57func nx_flock_sh(fd: i64) -> i64
calls 1: nx_flock
61func nx_flock_un(fd: i64) -> i64
called by 1: main calls 1: nx_flock
67func main() -> i64