Device operations and errors
NTFE ABI Reference is generated from include/uapi/pkm/ntfe.h and holds only what a
compiler can measure. This appendix holds the rest.
Stability #
The ABI is experimental while NTFE grows (PEI-598): no stability
promise until the design ships. peios_ntfe_status.abi carries
PEIOS_NTFE_ABI_VERSION; a consumer checks it before trusting any other
field or record layout. Version 2 (the machinery slice) added the
event's reject_kind, the store confessions and counter_cells and
reporting_level in the status, and the counters ioctl. Version 3 (the
Flow layer) added the LOCAL_OUT seat and Flow layer ids, the
REJUDGED event flag, the Flow and refusal counters in the status, and
the flows ioctl. Version 4 (the identity facts) added the endpoints'
identities to the event and the flow record, the IDENTITY_UNRESOLVED
event flag and the identity_unresolved counter (in a reserved slot,
so the status kept its size). Version 5 renamed the device and every
symbol from pnp to ntfe, let more than one file hold the device open,
and added changes_noted, changes_walked and contexts to the status:
the first took one of the two reserved words version 4 left, the other
two are new, so the status grew by two words and keeps one reserved. pnpd and the kernel ship together on the
experimental edition, so the check is a guard, not a negotiation.
/dev/peios-ntfe #
A misc device, created mode 0600 and owned by uid 0. Those Unix fields
do not grant native access: KACS checks an open() using the opener's
token and the node's security descriptor
(File Descriptor Storage). On devtmpfs that descriptor is inherited from the seeded
root's, which grants GENERIC_ALL to SYSTEM alone, so the device is
SYSTEM's unless trusted userspace sets another.
| Operation | Semantics | Errors |
|---|---|---|
open() | Any number of openers. | — |
read(buf, len) | Returns whole struct peios_ntfe_event records only — never a partial one — up to 64 per call, oldest first, consuming them. Blocks on an empty ring unless O_NONBLOCK. | EINVAL — len smaller than one record; EBUSY — another open file is the stream's reader; EAGAIN — empty and non-blocking; EINTR; ENOMEM; EFAULT — the records it took are lost (below) |
poll() | POLLIN | POLLRDNORM when at least one event waits. | — |
ioctl(PEIOS_NTFE_IOC_STATUS, struct peios_ntfe_status *) | Fills the status snapshot. Cumulative counters since boot. | EFAULT |
ioctl(PEIOS_NTFE_IOC_COUNTERS, struct peios_ntfe_counters_query *) | buf/buf_len describe a user buffer of struct peios_ntfe_counter_rec; on return count is how many were written and total how many cells exist. A short buffer is not an error — the two numbers disagree. Best-effort snapshot: cells may change between records. | EFAULT; ENOMEM |
ioctl(PEIOS_NTFE_IOC_FLOWS, struct peios_ntfe_flows_query *) | Same contract over struct peios_ntfe_flow_rec: count written, total live flows the walk saw. Records are copied out between hash buckets, so the dump is a best-effort picture of a table that changes under it. | EFAULT; ENOMEM |
ioctl(PEIOS_NTFE_IOC_LISTENERS, struct peios_ntfe_listeners_query *) | Same contract over struct peios_ntfe_listener_rec: every TCP socket in the listening state and every bound UDP / UDP-Lite socket of the root network namespace, with the identity KACS stamped on it (The identity facts). total is how many the walk saw. A hash bucket holding more sockets than one copy-out batch is walked again from where the batch filled, so with room for every record count equals total. | EFAULT; ENOMEM |
| other ioctls | — | ENOTTY |
Sequence numbers are monotonic per boot. A gap between consecutive
records read is the number of events the ring overwrote while the
reader was away, plus any a faulting read() consumed; events_dropped in the status is the running
total of the overwrites. A read() that fails with EFAULT has
already taken its records off the ring: they are lost, and counted
nowhere but in that gap.