← All posts

VFS Grows POSIX Muscles — mmap, Events, poll/select, dup

June 28, 2026
Sigil-FSSigil-FSPR →
fs0.7.0

An OS that wants to host real software eventually has to speak the I/O dialect that software expects. Over a run of VFS builds, sigilOS picked up four of the load-bearing ones — mmap, an event queue, poll/select, and dup/dup2 — and did it the Sigil way: fixed-size, capability-gated, and green before it shipped.

The four primitives

fs_mmap
Zero-copy mapped access, rewritten over the content-addressed store — a 16-slot table, flag-checked read/write. The page is the store's bytes, not a copy of them.
fs_event
An async event queue — a 32-event ring, 10 event types, a monotonic sequence number, overflow-safe. The notification spine the rest of the I/O stack signals through.
fs_poll
poll/select multiplexing over pipes and event queues — an 8-entry poll set, POLLIN/POLLOUT bitmask, readiness dispatched by handle type. Wait on many things, wake on the first ready.
fs_dup
An FD table with dup/dup2 — 16 slots carrying type + target + offset. The redirection primitive shells and pipelines are built on.

The four pillars, in the I/O layer

FAST

fs_mmap is zero-copy — mapped pages are the content-addressed store's own bytes, so there's no read-into-a-buffer round trip.

EFFICIENT

Every structure is fixed-size — 16-slot mmap/FD tables, a 32-event ring, an 8-entry poll set. Bounded memory, overflow-safe, sized for the Pi floor.

SECURE

Access is capability-gated and flag-checked: an mmap is read or write because the capability says so, and an FD is a typed, scoped handle — not an ambient integer into the kernel.

STABLE

Each landed green under the full ABCDEFGH battery — the VFS test count climbed 33 → 34 → 51 across the run with zero reds.

None of these are glamorous on their own. Together they're the difference between "a filesystem" and "an I/O system a real program can run on" — pipes you can wait on, files you can map, descriptors you can redirect. The plumbing that makes the rest possible.