nx_flock.nx
buildroot/runtime/nx_flock.nx
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
imports: syscalls.nx
imported by: nobody (leaf or entry point)
call flow from main pre-order; caps 40 nodes / depth 6 declared; ↻ = already shown
structs
| none |
consts
| 29 | const NX_SYS_FLOCK: i64 = 32 |
| 31 | const NX_LOCK_SH: i64 = 1 |
| 32 | const NX_LOCK_EX: i64 = 2 |
| 33 | const NX_LOCK_NB: i64 = 4 |
| 34 | const NX_LOCK_UN: i64 = 8 |
functions
| 39 | func nx_flock(fd: i64, op: i64) -> i64 |
| 44 | func nx_flock_ex(fd: i64) -> i64 calls 1: nx_flock |
| 50 | func nx_flock_try_ex(fd: i64) -> i64 |
| 57 | func nx_flock_sh(fd: i64) -> i64 calls 1: nx_flock |
| 61 | func nx_flock_un(fd: i64) -> i64 |
| 67 | func main() -> i64 |