Expand description
The files the hold reads (see the crate docs, the single source).
Constants§
- AHEAD_
SECS - A stamp further ahead than this is not trusted either (the hold’s script).
- CLOCK
- The clock every
<t>is on: seconds since boot, suspend included (the first field of/proc/uptime), so a wall-clock step cannot make a stale file look fresh. - DIR
- Where the footprints live.
- FRESH_
SECS - A file confirmed longer ago than this is stale.
- STATE 🔒
- netwatch’s own record of who claimed what, across its restarts (a
dot-file: the hold reads only
.watchand.unattributed). - TICK_
SECS - How often netwatch rewrites every file.
- UNATTRIBUTED 🔒
- WATCH 🔒
Functions§
- file_
name - The file name of a unit’s footprint: systemd’s
%N(the unit name with any@instance, without.service). Network tools are system services. - hold_
may_ release - The hold’s condition on a failure, as lane-nix’s script implements it
(crate docs, “The hold’s order”): it may release only when the unit’s
footprint describes the invocation that failed (
invocation, systemd’sInvocationID), that invocation hasended(its cgroup is gone and the ring drained after, so nothing it did is still to come), and the footprint readsprotecting noatnow, with nothing unattributed. Anything else holds. The reference the property tests check. - one_
line 🔒 - parse_
footprint 🔒 - proto 🔒
- put 🔒
- Write
nameindiratomically: a temporary file, synced, renamed over it. - read
- Read what
dirholds. Fail closed: a footprint that does not parse is left out (so it reads as missing, which counts as protecting), and an unreadable or unknown.watchisWatchState::Unknown. - read_
claims - The claims kept before a restart:
.stateif it reads, else the footprint files’ifacelines (Tracker::claims_from_files). - render 🔒
- write
- Write
viewtodir:.watch,.unattributed(present or removed), and one file per unit; a unit’s file that is no longer in the view is removed, so a reader never trusts a footprint netwatch no longer keeps. - write_
state - Keep the tracker’s claims in
dir/.state, atomically.