[FEATURE] Mediated C file operations in the process-root runtime #14

Open
opened 2026-10-27 05:08:56 +01:00 by erikinkinen · 4 comments
Owner

Problem and motivation

C build tools need file operations beyond read, write and close. Posixd already mediates acquisition, shared offsets, metadata, namespace changes and filesystem controls, but C callers cannot yet use those contracts through the process-root runtime.

Proposed behavior and scope

Extend the existing explicitly bound C I/O runtime with fixed, namespaced C and Rust file interfaces. Cover open/openat intent, descriptor duplication and flags, positioned and vector I/O, seek, path and descriptor status, namespace mutations and readlink, truncation and synchronization, permissions, access checks, umask and advisory locks. Reuse the existing Posixd ABI and original realm admission. Preserve byte paths, signed offsets, short progress and current-thread errno.

Keep all requests and replies typed. Snapshot variable input in each call's original process-heap allocation before native effects; retain independent packet and output storage through acknowledged retirement. Derive request capacity from the admitted protocol rather than adding a pathname or vector-count policy limit.

Conventional POSIX aliases, C signal delivery, ordinary compatibility startup, directory streams, poll/select and terminal interfaces remain separate. Timestamp-setting and current-directory changes need their own mediator contracts before adapters can expose them; do not report unsupported operations as success.

Authority, security and reliability

The original admitted realm supplies all authority. Paths and descriptor integers remain descriptive, with no provider lookup or host syscall fallback. Extend the same immutable process-root binding rather than publishing another transport owner. Concurrent calls keep separate original requests, native callers and buffers; no metadata gate spans blocking work.

Expected terminal service errors set errno. Contradictory replies, unreturned callbacks and uncertain retirement retain their original evidence and physical backing, close ordinary admission and use the existing terminal owner once. Never replay a mutation, fabricate metadata or release a caller buffer on uncertain custody.

Acceptance criteria

  • Implement and document the typed runtime contract, namespaced C/Rust interfaces and partial C/C++ headers for the existing mediated file operations.
  • Consume the operations through the actual Posixd backend with complete immutable request snapshots, checked output geometry and retirement before output publication or deallocation.
  • Add C workloads and positive, malformed, denial, overflow, shared-offset and concurrent-lifetime controls; preserve existing heap, thread and byte-I/O coverage.
  • Adopt the original source graph and update component contracts and the technical manual.
  • Complete warning-denied builds, strict Clippy, owning unit tests and relevant guest acceptance without claiming host execution as an in-EriX build.

Alternatives and tradeoffs

Direct provider calls would bypass Posixd policy. A shared mutable packet would serialize calls and prevent a writer from unblocking a reader. Reusing the existing process runtime and allocating independent request snapshots preserves both mediation and concurrency. Fixed namespaced calls keep unfinished conventional ABI and startup work explicit.

Tracking and rollout

Extends mediated C byte I/O and Posixd descriptor semantics, under the C runtime and Phase 6. Implement the typed contract and original backend together, then adopt native consumers and documentation before enabling conventional imported-tool interfaces.

## Problem and motivation C build tools need file operations beyond read, write and close. Posixd already mediates acquisition, shared offsets, metadata, namespace changes and filesystem controls, but C callers cannot yet use those contracts through the process-root runtime. ## Proposed behavior and scope Extend the existing explicitly bound C I/O runtime with fixed, namespaced C and Rust file interfaces. Cover open/openat intent, descriptor duplication and flags, positioned and vector I/O, seek, path and descriptor status, namespace mutations and readlink, truncation and synchronization, permissions, access checks, umask and advisory locks. Reuse the existing Posixd ABI and original realm admission. Preserve byte paths, signed offsets, short progress and current-thread errno. Keep all requests and replies typed. Snapshot variable input in each call's original process-heap allocation before native effects; retain independent packet and output storage through acknowledged retirement. Derive request capacity from the admitted protocol rather than adding a pathname or vector-count policy limit. Conventional POSIX aliases, C signal delivery, ordinary compatibility startup, directory streams, poll/select and terminal interfaces remain separate. Timestamp-setting and current-directory changes need their own mediator contracts before adapters can expose them; do not report unsupported operations as success. ## Authority, security and reliability The original admitted realm supplies all authority. Paths and descriptor integers remain descriptive, with no provider lookup or host syscall fallback. Extend the same immutable process-root binding rather than publishing another transport owner. Concurrent calls keep separate original requests, native callers and buffers; no metadata gate spans blocking work. Expected terminal service errors set errno. Contradictory replies, unreturned callbacks and uncertain retirement retain their original evidence and physical backing, close ordinary admission and use the existing terminal owner once. Never replay a mutation, fabricate metadata or release a caller buffer on uncertain custody. ## Acceptance criteria - [x] Implement and document the typed runtime contract, namespaced C/Rust interfaces and partial C/C++ headers for the existing mediated file operations. - [x] Consume the operations through the actual Posixd backend with complete immutable request snapshots, checked output geometry and retirement before output publication or deallocation. - [x] Add C workloads and positive, malformed, denial, overflow, shared-offset and concurrent-lifetime controls; preserve existing heap, thread and byte-I/O coverage. - [x] Adopt the original source graph and update component contracts and the technical manual. - [ ] Complete warning-denied builds, strict Clippy, owning unit tests and relevant guest acceptance without claiming host execution as an in-EriX build. ## Alternatives and tradeoffs Direct provider calls would bypass Posixd policy. A shared mutable packet would serialize calls and prevent a writer from unblocking a reader. Reusing the existing process runtime and allocating independent request snapshots preserves both mediation and concurrency. Fixed namespaced calls keep unfinished conventional ABI and startup work explicit. ## Tracking and rollout Extends [mediated C byte I/O](https://git.erikinkinen.fi/erix/lib-cstd/issues/13) and [Posixd descriptor semantics](https://git.erikinkinen.fi/erix/posixd/issues/2), under [the C runtime](https://git.erikinkinen.fi/erix/lib-cstd/issues/1) and [Phase 6](https://git.erikinkinen.fi/erix/integration/issues/65). Implement the typed contract and original backend together, then adopt native consumers and documentation before enabling conventional imported-tool interfaces.
Author
Owner

The source implementation and native consumer are in place: 35 fixed C/Rust file interfaces share the existing process-root binding. Posixd retains complete request and vector snapshots in each call allocation and publishes output after caller retirement. The heap product includes the new C workload alongside its allocation and byte-I/O fixtures.

Timestamp setting, current-directory changes and conventional POSIX adoption remain separate work. The final execution criterion stays open.

The source implementation and native consumer are in place: 35 fixed C/Rust file interfaces share the existing process-root binding. Posixd retains complete request and vector snapshots in each call allocation and publishes output after caller retirement. The heap product includes the new C workload alongside its allocation and byte-I/O fixtures. Timestamp setting, current-directory changes and conventional POSIX adoption remain separate work. The final execution criterion stays open.
Author
Owner

Timestamp setting now extends the file bridge with counted futimens/utimensat calls. Their checked settings use the existing binding, heap and call retirement; clients receive no clock or provider grant.

[Timestamp setting](https://git.erikinkinen.fi/erix/posixd/issues/43) now extends the file bridge with counted futimens/utimensat calls. Their checked settings use the existing binding, heap and call retirement; clients receive no clock or provider grant.
Author
Owner

C pipe creation now uses the existing Posixd descriptor backend. erix_c_pipe creates a default pair; erix_c_pipe2 takes separate EriX descriptor and status flags. Both publish the pair after the original call retires, leaving output unchanged on an ordinary error. The C fixture exercises both entry points using the existing counted pool.

Implementation: C runtime, Posixd, native workload.

C pipe creation now uses the existing Posixd descriptor backend. `erix_c_pipe` creates a default pair; `erix_c_pipe2` takes separate EriX descriptor and status flags. Both publish the pair after the original call retires, leaving output unchanged on an ordinary error. The C fixture exercises both entry points using the existing counted pool. Implementation: [C runtime](https://git.erikinkinen.fi/erix/lib-cstd/pulls/3), [Posixd](https://git.erikinkinen.fi/erix/posixd/pulls/5), [native workload](https://git.erikinkinen.fi/erix/integration/pulls/12).
Author
Owner

The C file workload now links and renames raw names through distinct held directory bases and checks a physical cwd spanning two replies. It covers short buffers, unchanged tails and cleanup through retained parent descriptors. Posixd source; Integration scenario. Native workload and stack acceptance remain open.

The C file workload now links and renames raw names through distinct held directory bases and checks a physical cwd spanning two replies. It covers short buffers, unchanged tails and cleanup through retained parent descriptors. [Posixd source](https://git.erikinkinen.fi/erix/posixd/commit/40aafe5900878e128325968cb62e8840bb79e62c); [Integration scenario](https://git.erikinkinen.fi/erix/integration/commit/5c0810b29536edb215d3e25f1773748746855bc6). Native workload and stack acceptance remain open.
erikinkinen added this to the Alpha 1 milestone 2026-10-30 09:34:40 +01:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
erix/lib-cstd#14
No description provided.