procFS
procFS(
table,opts?):Fileserver
Defined in: packages/core/src/kernel/fileservers/proc.ts:472
Create a /proc fileserver backed by the kernel process table.
Parameters
Section titled “Parameters”Map<Pid, Process>
Live process table the kernel mutates. The fileserver holds
this map by reference — entries added/removed by the kernel
become visible on the next /proc readdir.
Optional callbacks that gate individual virtual files; see ProcFSOpts.
Returns
Section titled “Returns”A read-mostly Fileserver projecting the process table.
Remarks
Section titled “Remarks”Mount at /proc to expose a live view of the process table as a
Plan-9-style synthetic tree:
/proc/<pid>/status— formatted pid/ppid/state/uid/cwd./proc/<pid>/env,/argv,/cwd,/fd— scalar projections./proc/<pid>/ctl— writable control file (present iffopts.signalsupplied)./proc/<pid>/ns— namespace mount list (present iffopts.getNssupplied)./proc/log— kernel log snapshot (present iffopts.logsupplied).
Reads are snapshot-at-open: a reader holding a long-lived fd observes the
state captured when open() was called. To re-read fresh state, close
and re-open.
All writes to non-ctl paths throw EACCES; all mkdir / remove /
rename / wstat operations throw EPERM.
Example
Section titled “Example”import { procFS } from '@fishnet/core'const fs = procFS(kernel.processTable, { log: kernel.log, signal: (pid, sig) => kernel.signal(pid, sig), getNs: (pid) => formatNamespace(kernel.processTable.get(pid)),})Caveat
Section titled “Caveat”The signal / getNs / getSuspended callbacks typically close
over a kernel reference that is only initialized after procFS
returns (see createContainerKernel). Wire them with a mutable
let kernel forward-reference if you compose this factory yourself.