Event ring and delivery
Every real evaluation — a published forest judged the traversal, or a
fail-closed drop — appends one struct peios_ntfe_event to a bounded
ring. Permissive traversals emit nothing: there is no decision to
attribute, and the status tells that story instead. A packet answered by
its flow's cached sentence emits nothing either: there was no
evaluation, and flow_cached counts it. The layouts are in NTFE ABI Reference; this
page is what they mean.
The ring and its reader #
The ring holds 4096 events under a spinlock (irqsave: emission happens
in softirq). A full ring overwrites the oldest event and counts the
loss in events_dropped — the honesty rule: a slow reader loses data
and is told so, in the status and by the gap in sequence numbers.
/dev/peios-ntfe is a misc device, mode 0600. Any number of files may
be open on it, because the status and dump ioctls are asked by tools
while a viewer holds the stream, but the ring has one drain: the first
file to read() claims it until it closes, and another file's read()
returns -EBUSY meanwhile. read() returns whole
records only, up to 64 per call, and blocks on an empty ring unless
O_NONBLOCK; poll() raises POLLIN when events wait. A reader that
reconnects resumes from whatever the ring still holds, and catches the
gap from the sequence numbers.
The viewer daemon reads it with a small wrinkle worth knowing about: its
own HTTP responses to a viewer are judged traffic too, so every event it
sends produces another event — a feedback loop. pnpd hides events about
its own TCP port from what it serves and counts them (own_verdicts_hidden),
which is the same treatment the wire tap gives its own frames.