[FEATURE] Process-root C adapters for mediated descriptor I/O #13

Open
opened 2026-10-27 00:28:10 +01:00 by erikinkinen · 1 comment
Owner

Problem and motivation

Libc I/O needs to pass through Posixd. Existing C fixtures exercise allocation and environment data, while the retained Posixd byte operations have Rust consumers. C code needs a reusable descriptor bridge before buffered stdio and build-tool adoption.

Proposed behavior and scope

Add explicitly bound erix_c_read, erix_c_write and erix_c_close adapters, namespaced Rust declarations and partial C/C++ headers. Use the existing authenticated Read/Write/Close protocol, signed LP64 return counts and current-thread errno. Validate short progress without allocating the whole caller buffer. Zero-count operations avoid buffer access while preserving descriptor and access checks.

Use the authenticated realm heap client as the first native C consumer. Conventional POSIX aliases, libc signal-handler delivery, FILE buffering and the ordinary compatibility-startup descriptor bridge remain separate work. These adapters expose the existing mediated operation contract without claiming those missing semantics.

Authority, security and reliability

Bind one original admitted realm context explicitly. Descriptor numbers confer no capabilities and cannot discover providers. Each concurrent call retains its own original request, native caller, packet and buffer lifetime through acknowledged retirement. Do not hold a global packet lock across blocking I/O.

Completed errno results remain distinct from transport, framing and custody failures. An uncertain call cannot return an ordinary result, replay effects or free physical backing. Preserve first failures and independent cleanup. Keep mediator broken-pipe/default-controller behavior and pipe atomicity; derive packet capacity from the existing protocol and PIPE_BUF contract.

Acceptance criteria

  • Implement the three C/Rust interfaces and explicit original-root binding, documenting pointers, counts, errno, concurrency and lifetime.
  • Cover binary, empty and short I/O, EOF, shared cursors, aliases, repeated close, denial followed by allowed use, checked arithmetic and success-errno preservation.
  • Cover partial progress, terminal EINTR/EAGAIN/EPIPE, malformed replies, failed retirement and callback unwind, retaining physical backing without replay.
  • Exercise actual C calls through authenticated Posixd intake, including simultaneous calls, while preserving existing reciprocal, heap, thread and terminal scenarios.
  • Update original-source production, headers, component contracts and the technical manual. Keep authored coverage, compiled checks and guest acceptance distinct.

Alternatives and tradeoffs

A single mutable process packet would prevent a sibling writer from unblocking a reader. Independent call storage preserves concurrency and makes retirement explicit. Reusing direct LibCli fixture output would bypass the Posixd descriptor contract.

The explicit adapter names allow C adoption while keeping unfinished POSIX signal delivery visible. Buffered stdio can then build on the reviewed descriptor path.

Tracking and rollout

Part of the C runtime, coordinated with Posixd descriptor semantics. Reuse the shared heap and process-root startup.

Implement and consume the mediated adapters first. Complete compatibility startup and libc signal delivery before conventional POSIX aliases and buffered stdio. Overall scope remains tracked in Phase 6.

## Problem and motivation Libc I/O needs to pass through Posixd. Existing C fixtures exercise allocation and environment data, while the retained Posixd byte operations have Rust consumers. C code needs a reusable descriptor bridge before buffered stdio and build-tool adoption. ## Proposed behavior and scope Add explicitly bound `erix_c_read`, `erix_c_write` and `erix_c_close` adapters, namespaced Rust declarations and partial C/C++ headers. Use the existing authenticated Read/Write/Close protocol, signed LP64 return counts and current-thread errno. Validate short progress without allocating the whole caller buffer. Zero-count operations avoid buffer access while preserving descriptor and access checks. Use the authenticated realm heap client as the first native C consumer. Conventional POSIX aliases, libc signal-handler delivery, FILE buffering and the ordinary compatibility-startup descriptor bridge remain separate work. These adapters expose the existing mediated operation contract without claiming those missing semantics. ## Authority, security and reliability Bind one original admitted realm context explicitly. Descriptor numbers confer no capabilities and cannot discover providers. Each concurrent call retains its own original request, native caller, packet and buffer lifetime through acknowledged retirement. Do not hold a global packet lock across blocking I/O. Completed errno results remain distinct from transport, framing and custody failures. An uncertain call cannot return an ordinary result, replay effects or free physical backing. Preserve first failures and independent cleanup. Keep mediator broken-pipe/default-controller behavior and pipe atomicity; derive packet capacity from the existing protocol and PIPE_BUF contract. ## Acceptance criteria - [x] Implement the three C/Rust interfaces and explicit original-root binding, documenting pointers, counts, errno, concurrency and lifetime. - [ ] Cover binary, empty and short I/O, EOF, shared cursors, aliases, repeated close, denial followed by allowed use, checked arithmetic and success-errno preservation. - [ ] Cover partial progress, terminal EINTR/EAGAIN/EPIPE, malformed replies, failed retirement and callback unwind, retaining physical backing without replay. - [ ] Exercise actual C calls through authenticated Posixd intake, including simultaneous calls, while preserving existing reciprocal, heap, thread and terminal scenarios. - [x] Update original-source production, headers, component contracts and the technical manual. Keep authored coverage, compiled checks and guest acceptance distinct. ## Alternatives and tradeoffs A single mutable process packet would prevent a sibling writer from unblocking a reader. Independent call storage preserves concurrency and makes retirement explicit. Reusing direct LibCli fixture output would bypass the Posixd descriptor contract. The explicit adapter names allow C adoption while keeping unfinished POSIX signal delivery visible. Buffered stdio can then build on the reviewed descriptor path. ## Tracking and rollout Part of [the C runtime](https://git.erikinkinen.fi/erix/lib-cstd/issues/1), coordinated with [Posixd descriptor semantics](https://git.erikinkinen.fi/erix/posixd/issues/2). Reuse [the shared heap](https://git.erikinkinen.fi/erix/lib-cstd/issues/8) and [process-root startup](https://git.erikinkinen.fi/erix/lib-cstd/issues/9). Implement and consume the mediated adapters first. Complete compatibility startup and libc signal delivery before conventional POSIX aliases and buffered stdio. Overall scope remains tracked in [Phase 6](https://git.erikinkinen.fi/erix/integration/issues/65).
Author
Owner

Published the namespaced C/Rust descriptor bridge with an explicitly bound original Posixd realm and independent storage for concurrent calls. The provider is linked only into the process root; headers, native source graphs and the technical manual are updated.

Conventional aliases, libc signal delivery, compatibility startup and guest acceptance remain open.

Published the namespaced C/Rust descriptor bridge with an explicitly bound original Posixd realm and independent storage for concurrent calls. The provider is linked only into the process root; headers, native source graphs and the technical manual are updated. Conventional aliases, libc signal delivery, compatibility startup and guest 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#13
No description provided.