[FEATURE] Add bounded POSIX pipes with atomic publication and native SIGPIPE #24

Closed
opened 2026-09-30 12:08:25 +02:00 by erikinkinen · 0 comments
Owner

Problem and motivation

Compatibility clients need pipe/pipe2 semantics for shell pipelines and compiler subprocesses. Existing configured byte channels do not provide pipe creation, atomic small writes, or native default SIGPIPE handling.

Proposed behavior and scope

Add a capability-free pipe request returning the two lowest available process-local descriptors. Publish both ends together after accepted native completion, with separate read/write descriptions and atomic NONBLOCK, CLOSE_ON_EXEC and CLOSE_ON_FORK selection. Reserve channel rows and ring bytes from the original explicit realm resource plan; no hidden allocator or implicit quota is introduced.

Preserve FIFO order, atomic writes up to the advertised POSIX pipe bound, larger positive short writes, EOF after the last writer, and EPIPE plus SIGPIPE after the last reader. Retained waits inspect their original description and channel only. Reuse requires complete end retirement and scrubbing of the original buffer. Event-driven poll/select and libc entry points remain separately tracked requirements.

Authority, security and reliability

Only the authenticated live client may allocate its own pair from the sealed realm budget. Numeric descriptors and channel indices carry no native authority. Reservations remain unusable before publication; resource exhaustion and refused results must not leak one end or stale data. Aliases retain original description generations and end counts. Default SIGPIPE termination must use the existing original process controller and exact native client generation; Posixd must not acquire a general process-kill capability. Preserve actual serving/caller custody across cancellation, refusal, uncertainty and terminal cleanup. Blocked, ignored and caught signal policies remain distinct.

Acceptance criteria

Checklist
  • Explicit pool admission, exhaustion and safe reuse within counted immutable resources.
  • Atomic lowest-free descriptor-pair reservation/publication and flag handling, including cancellation and refused completion.
  • FIFO buffering, scalar/vector small-write atomicity, blocking/nonblocking behavior, EOF, affected-waiter readiness and alias-aware closure.
  • SIGPIPE generation with ignored, caught, blocked and original-controller default termination behavior.
  • Authored positive, negative, ownership and cleanup controls plus a native workload; updated contracts/manual; signed coherent dependency publication.

Alternatives and tradeoffs

Reusing generic short-write channels alone would not satisfy pipe atomicity. Returning EPIPE without SIGPIPE would omit observable behavior. Giving the mediator a general process controller would unnecessarily widen its authority. Use explicitly counted storage and the retained original controller relationship instead. Consult the POSIX pipe contract and POSIX write contract; implementation remains independently authored.

Tracking and rollout

Counted pipes and original-controller default SIGPIPE are implemented and signed/published: lib-ipc fdbe4e08, lib-posixabi 980a332e, posixd 645be685, launchd dfcb4d7d, procd f198cbf5, exsh 165f2613, integration c51e2f93, docs 47a75253. The separate Integration helper 60a44c20 precedes final catalogs. The coherent closure contains 56 signed commits across 55 repositories, 206 Cargo selectors and 111 catalog selectors, with exact remote branch equality.

RCF1/RCP1 version1.5 admits explicit unused rings of at least512 bytes, including pool-only plans without inherited descriptors. Compatibility1.11 adds Pipe opcode21 and matching Rust/C constants. Two lowest-free fd numbers, independent descriptions and one generation-bound counted ring remain unpublished until accepted native COMPLETE. Refusal cancels both ends; native invocation custody remains independently retained. FIFO scalar/vector writes of at most512 bytes are atomic, larger writes may be short, and blocking calls retain the original description and required free-space condition. Final aliases drive EOF/EPIPE; both-end retirement scrubs the whole ring before reuse. Unrelated closure cannot satisfy a wait.

Ignored, blocked and caught SIGPIPE preserve their distinct EPIPE/pending/handoff behavior. Default unblocked SIGPIPE freezes the original client. Posixd authenticates the original controller CLAIM and complete native context/digest before a one-shot policy decision. Procd polls through its existing mediator SEND, reserves both original rows through actual caller retirement, revalidates the original live relationship and issues at most one generation-checked kill. Native terminal observation, accounting, destruction and notification remain independently owned. A retiring original client discharges a drained poll without another kill; uncertain native custody stays fail-stop. Posixd receives no process-control capability, outbound route, ambient discovery or hidden capacity.

Ordinary byte/binding native clients exercise successful pipes, atomic writes, wraparound, alias closure, reuse and nondefault SIGPIPE. The separate realm-pipes scenario selects realm-pipe-client and requires real Killed(SIGPIPE), retained through retirement and reuse; an EPIPE return or normal exit fails that diagnostic. Explicit1024-byte packets and H=4/Q=1038 pool geometry are configured, with872-byte or3432-byte plan arenas. Existing native authority, lender and120-second deadline gates remain. Unit, transcript, selector and packaging controls are authored and unrun. The Exsh transcript ordering defect is repaired and published.

The pipe feature is accepted under that waiver. Event-driven poll/select, complete libc wrappers, asynchronous handlers and other native signal defaults remain separate work. Both full EriX guest-build generations and rebuilding external Rust/LLVM inside EriX remain required and unperformed.

Current progress is 17.84% weighted and 6.41% whole acceptance: 24/460 parents and 454/914 sub-items under 161 decomposed parents. One complete pipe parent and its seven explicit sub-items are accepted; original parent weights are unchanged.

Pipe contract, descriptor/namespace work, Phase6 master. Reviews: lib-ipc, lib-posixabi, posixd, launchd, procd, exsh, integration, docs.

Tracks the pipe requirement in Posixd compatibility support and Phase 6 completion. Coordinate LibPosixABI, LibIPC, Posixd, the original native controller, native clients and Integration. Existing Posixd PR, LibPosixABI PR and Integration PR carry the rollout. Land coherent wire revisions and retire superseded internal paths in the same dependency graph.

## Problem and motivation Compatibility clients need pipe/pipe2 semantics for shell pipelines and compiler subprocesses. Existing configured byte channels do not provide pipe creation, atomic small writes, or native default SIGPIPE handling. ## Proposed behavior and scope Add a capability-free pipe request returning the two lowest available process-local descriptors. Publish both ends together after accepted native completion, with separate read/write descriptions and atomic NONBLOCK, CLOSE_ON_EXEC and CLOSE_ON_FORK selection. Reserve channel rows and ring bytes from the original explicit realm resource plan; no hidden allocator or implicit quota is introduced. Preserve FIFO order, atomic writes up to the advertised POSIX pipe bound, larger positive short writes, EOF after the last writer, and EPIPE plus SIGPIPE after the last reader. Retained waits inspect their original description and channel only. Reuse requires complete end retirement and scrubbing of the original buffer. Event-driven poll/select and libc entry points remain separately tracked requirements. ## Authority, security and reliability Only the authenticated live client may allocate its own pair from the sealed realm budget. Numeric descriptors and channel indices carry no native authority. Reservations remain unusable before publication; resource exhaustion and refused results must not leak one end or stale data. Aliases retain original description generations and end counts. Default SIGPIPE termination must use the existing original process controller and exact native client generation; Posixd must not acquire a general process-kill capability. Preserve actual serving/caller custody across cancellation, refusal, uncertainty and terminal cleanup. Blocked, ignored and caught signal policies remain distinct. ## Acceptance criteria <details> <summary>Checklist</summary> - [x] Explicit pool admission, exhaustion and safe reuse within counted immutable resources. - [x] Atomic lowest-free descriptor-pair reservation/publication and flag handling, including cancellation and refused completion. - [x] FIFO buffering, scalar/vector small-write atomicity, blocking/nonblocking behavior, EOF, affected-waiter readiness and alias-aware closure. - [x] SIGPIPE generation with ignored, caught, blocked and original-controller default termination behavior. - [x] Authored positive, negative, ownership and cleanup controls plus a native workload; updated contracts/manual; signed coherent dependency publication. </details> ## Alternatives and tradeoffs Reusing generic short-write channels alone would not satisfy pipe atomicity. Returning EPIPE without SIGPIPE would omit observable behavior. Giving the mediator a general process controller would unnecessarily widen its authority. Use explicitly counted storage and the retained original controller relationship instead. Consult the [POSIX pipe contract](https://pubs.opengroup.org/onlinepubs/9799919799/functions/pipe.html) and [POSIX write contract](https://pubs.opengroup.org/onlinepubs/9699919799/functions/write.html); implementation remains independently authored. ## Tracking and rollout Counted pipes and original-controller default SIGPIPE are implemented and signed/published: [lib-ipc `fdbe4e08`](https://git.erikinkinen.fi/erix/lib-ipc/commit/fdbe4e0850de6b245b455d70ee0b25357ceeb2a9), [lib-posixabi `980a332e`](https://git.erikinkinen.fi/erix/lib-posixabi/commit/980a332e1aa60936b871a2e34e1bc92ce505b062), [posixd `645be685`](https://git.erikinkinen.fi/erix/posixd/commit/645be685bf786ceeda5da5691b4bc9c5bc34beee), [launchd `dfcb4d7d`](https://git.erikinkinen.fi/erix/launchd/commit/dfcb4d7da3c546f93f2bd4d647e12af635f50a1e), [procd `f198cbf5`](https://git.erikinkinen.fi/erix/procd/commit/f198cbf5a5334ab7dcf54e45df7c2e056c7ba713), [exsh `165f2613`](https://git.erikinkinen.fi/erix/exsh/commit/165f26134165b34c9cbe55e98999435f41b95253), [integration `c51e2f93`](https://git.erikinkinen.fi/erix/integration/commit/c51e2f93a0c63b7febbab11321d8a8d1203635b8), [docs `47a75253`](https://git.erikinkinen.fi/erix/docs/commit/47a752537345cb08d41f482408597da48c6bfc2f). The separate [Integration helper `60a44c20`](https://git.erikinkinen.fi/erix/integration/commit/60a44c20c6bf75ffae0715f80d6fcc8f3d615da5) precedes final catalogs. The coherent closure contains 56 signed commits across 55 repositories, 206 Cargo selectors and 111 catalog selectors, with exact remote branch equality. RCF1/RCP1 version1.5 admits explicit unused rings of at least512 bytes, including pool-only plans without inherited descriptors. Compatibility1.11 adds Pipe opcode21 and matching Rust/C constants. Two lowest-free fd numbers, independent descriptions and one generation-bound counted ring remain unpublished until accepted native COMPLETE. Refusal cancels both ends; native invocation custody remains independently retained. FIFO scalar/vector writes of at most512 bytes are atomic, larger writes may be short, and blocking calls retain the original description and required free-space condition. Final aliases drive EOF/EPIPE; both-end retirement scrubs the whole ring before reuse. Unrelated closure cannot satisfy a wait. Ignored, blocked and caught SIGPIPE preserve their distinct EPIPE/pending/handoff behavior. Default unblocked SIGPIPE freezes the original client. Posixd authenticates the original controller CLAIM and complete native context/digest before a one-shot policy decision. Procd polls through its existing mediator SEND, reserves both original rows through actual caller retirement, revalidates the original live relationship and issues at most one generation-checked kill. Native terminal observation, accounting, destruction and notification remain independently owned. A retiring original client discharges a drained poll without another kill; uncertain native custody stays fail-stop. Posixd receives no process-control capability, outbound route, ambient discovery or hidden capacity. Ordinary byte/binding native clients exercise successful pipes, atomic writes, wraparound, alias closure, reuse and nondefault SIGPIPE. The separate realm-pipes scenario selects realm-pipe-client and requires real Killed(SIGPIPE), retained through retirement and reuse; an EPIPE return or normal exit fails that diagnostic. Explicit1024-byte packets and H=4/Q=1038 pool geometry are configured, with872-byte or3432-byte plan arenas. Existing native authority, lender and120-second deadline gates remain. Unit, transcript, selector and packaging controls are authored and unrun. The [Exsh transcript ordering defect](https://git.erikinkinen.fi/erix/exsh/issues/12) is repaired and published. The [pipe feature](https://git.erikinkinen.fi/erix/posixd/issues/24) is accepted under that waiver. Event-driven poll/select, complete libc wrappers, asynchronous handlers and other native signal defaults remain separate work. Both full EriX guest-build generations and rebuilding external Rust/LLVM inside EriX remain required and unperformed. Current progress is 17.84% weighted and 6.41% whole acceptance: 24/460 parents and 454/914 sub-items under 161 decomposed parents. One complete pipe parent and its seven explicit sub-items are accepted; original parent weights are unchanged. [Pipe contract](https://git.erikinkinen.fi/erix/posixd/src/branch/feature/posix-compat/docs/pipes.md), [descriptor/namespace work](https://git.erikinkinen.fi/erix/posixd/issues/2), [Phase6 master](https://git.erikinkinen.fi/erix/integration/issues/65). Reviews: [lib-ipc](https://git.erikinkinen.fi/erix/lib-ipc/pulls/2), [lib-posixabi](https://git.erikinkinen.fi/erix/lib-posixabi/pulls/3), [posixd](https://git.erikinkinen.fi/erix/posixd/pulls/5), [launchd](https://git.erikinkinen.fi/erix/launchd/pulls/2), [procd](https://git.erikinkinen.fi/erix/procd/pulls/2), [exsh](https://git.erikinkinen.fi/erix/exsh/pulls/3), [integration](https://git.erikinkinen.fi/erix/integration/pulls/12), [docs](https://git.erikinkinen.fi/erix/docs/pulls/4). Tracks the pipe requirement in [Posixd compatibility support](https://git.erikinkinen.fi/erix/posixd/issues/2) and [Phase 6 completion](https://git.erikinkinen.fi/erix/integration/issues/65). Coordinate LibPosixABI, LibIPC, Posixd, the original native controller, native clients and Integration. Existing [Posixd PR](https://git.erikinkinen.fi/erix/posixd/pulls/5), [LibPosixABI PR](https://git.erikinkinen.fi/erix/lib-posixabi/pulls/3) and [Integration PR](https://git.erikinkinen.fi/erix/integration/pulls/12) carry the rollout. Land coherent wire revisions and retire superseded internal paths in the same dependency graph.
erikinkinen added this to the Alpha 1 milestone 2026-10-30 09:35:06 +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/posixd#24
No description provided.