[FEATURE] Wait for original descriptor readiness without lost events #33

Closed
opened 2026-10-02 09:58:26 +02:00 by erikinkinen · 0 comments
Owner

Problem and motivation

Build tools need poll/select to wait for pipe, stream and descriptor readiness with real timeout and cancellation semantics. The original channel/stream operations used cooperative native probing. This feature adds owned atomic event waits and integrates descriptor readiness consumers. Periodic status queries or fabricated timeouts do not satisfy this requirement.

Proposed behavior and scope

Implement poll/select-compatible counted readiness intent, immediate/infinite/finite waits, duplicate and negative descriptors, invalid-descriptor behavior, EOF/hangup/errors, descriptor-generation retention and required signal-mask/cancellation semantics. Local rings, retained regular files and inherited streams must use their actual original backends. Regular files are immediately ready; no namespace reopening substitutes for an original description.

Add the native event/wakeup mechanism needed to atomically observe, arm and sleep without losing an event between inspection and registration. A process may wait only on its own actual native transport/receiver custody; copied process IDs or an unrelated global activity counter confer no observation authority. Producers notify actual readiness changes. Deadline waits use the original explicit clock grant and a real monotonic source, with no default clock endpoint or iteration-derived time. Integrate providers, native consumers and the scheduler rather than stopping at a wire codec.

Authority, security and reliability

Preserve exact native process, receiver, invocation and descriptor generations. Waiting grants no I/O, namespace, process-control or arbitrary event-source authority. Retain the original subscriptions, timer and serving/caller owners through cancellation, signal interruption, timeout, revocation and terminal cleanup. A completed or cancelled registration cannot address a replacement owner. Complete byte/storage admission precedes registration effects; exhaustion refuses without partial ordinary publication. Temporary masks restore on every completed exit. Keep security, reliability and performance in that order.

Acceptance criteria

Checklist
  • Specify and implement exact counted poll/select readiness, result and timeout/signal contracts with full framing and atomic output admission.
  • Implement native race-free registration, event wakeup, scheduling and original-generation teardown without periodic readiness scans or lost events.
  • Implement explicit original-clock deadline delivery and cancellation; refuse absent or unavailable clock authority without synthetic elapsed time.
  • Integrate actual local rings, retained files and required inherited-stream providers with event-driven mediator/client serving and original descriptor lifetime.
  • Cover immediate/infinite/finite waits, zero descriptors, duplicates/negative/invalid descriptors, hangup/error, replacement, signal-mask restoration, cancellation, revocation and exhaustion with independent controls.
  • Author native multi-client/multi-realm workloads and race/deadline controls; document exact source and performance evidence without claiming deferred execution.
  • Complete inline documentation, authority/size audit, maintained component/manual contracts, signed immutable dependency adoption and issue/review/phase tracking before whole-item acceptance.

Alternatives and tradeoffs

A repeated status-query loop would retain the current performance and lost-wakeup risks. Host clocks, hidden timer grants and caller-supplied foreign process selectors are not acceptable substitutes. A process-local native change epoch can support atomic sleep while preserving actual custody; exact descriptor subscriptions and authorized deadline delivery remain required above that mechanism. Choose storage from actual admitted budgets, not an arbitrary fd-set, waiter or timeout ceiling. Keep the existing native transport compatible while replacing obsolete consumer polling paths where the new event mechanism applies.

Tracking and rollout

Coordinate filesystem services, advisory locking, Posixd review, Kernel review and phase completion. Derive original implementation from the POSIX poll/ppoll specification and select/pselect specification, without importing implementation code. Tests, builds, lint, generated documentation, VM/profiler execution and CI observation remain deferred. Full EriX guest builds and external Rust/LLVM rebuilding remain required.

Detailed scope and contracts

Counted readiness completion — 2 October 2026

The existing multi-client/multi-realm binaries now exercise real poll/select traffic, duplicate/negative/invalid descriptors, zero descriptors, genuine delegated expiry and missing-clock refusal, submitted-call cancellation, supervisor interruption, temporary-mask handler entry/restoration, peer hangup/EOF, inherited stream readiness and retained file aliases without moving their shared cursor.

The readiness issue is closed with all seven criteria checked under the testing waiver. Phase accounting is now 21.04% weighted and 9.61% whole-item acceptance: 32 of 460 parents and 493 of 953 sub-items complete.

Both full EriX guest generations and external Rust/LLVM rebuilding inside EriX remain required and unperformed.

Native readiness activity and atomic idle — 2 October 2026

A concurrent native event prevents sleep or wakes the actual task; no timer, foreign process selector or new authority grant is introduced.

Local queue, peer-retirement and signal revisions wake them even when a later native result publication is refused.

Ten additional controls are authored for exact epoch use, invalid/exhausted wait receipts, ambiguous watch custody, dormant subscriptions, completion races, local wakeups despite refused publication, signals and receiver retirement.

Native multi-client/multi-realm readiness workloads and complete libc handler dispatch remain unfinished. Overall checklist accounting remains 20.64% weighted and 9.21% whole-item acceptance, with 31 of 460 parent items and 493 of 953 sub-items complete.

Neither full EriX guest build generations nor external Rust/LLVM rebuilding inside EriX has been demonstrated; both remain required.

Counted readiness mediator — 2 October 2026

Duplicate poll numbers share a subscription while keeping separate output positions; negative entries stay empty, invalid positive poll entries retain NVAL, and select rejects invalid descriptors before effects. Close, replacement and terminal cleanup cannot discard that custody.

Cancellation restores the mask without inventing EINTR; terminal retirement never resurrects old policy.

There is no new endpoint, capability grant, allocator or fixed descriptor-array limit.

Whole-process activity gating and atomic idle, native multi-client/multi-realm readiness workloads, and full libc handler dispatch before application-visible EINTR remain unfinished. Overall checklist accounting remains 20.64% weighted and 9.21% whole-item acceptance, with 31 of 460 parent items and 493 of 953 sub-items complete.

Neither full EriX guest build generations nor external Rust/LLVM rebuilding inside EriX has been demonstrated; both remain required.

Owned blocking-stream consumer checkpoint — 2 October 2026

Readiness reserves no bytes and cannot fabricate EOF or EPIPE; stale readiness may produce another confirmed zero-progress result and a new original subscription.

Canonical provider refusal becomes EIO after release. No endpoint, authority or resource limit is added. Existing fair native/liveness turns remain; whole-process activity gating and atomic idle are still unfinished.

Seven new service controls are authored and unrun for dormant subscriptions, stale readiness, signal/draining, caller loss, malformed frames, canonical refusal and hangup/EOF.

The complete descriptor-readiness feature stays open: counted original subscriptions, local/file observations, temporary-mask lifetime and retained interruption, clock composition, atomic idle and native multi-client/multi-realm workloads remain required. No whole-feature acceptance credit is added. Full EriX guest generations and external Rust/LLVM guest rebuilding remain required and unperformed.

Signal restoration and original caller cancellation checkpoint — 2 October 2026

Both masks exclude immutable/catalog-invalid bits, while only entry must exclude the delivered signal. The final word carries restoration; older minors are rejected and Rust/C constants, literal fixtures, consumers and documentation migrate together.

The whole descriptor-readiness feature stays open: actual mediator temporary-mask lifetime and retained interruption, counted original subscriptions, clock composition and native multi-client/multi-realm workloads remain required. This checkpoint adds no whole-feature acceptance credit. Full EriX guest generations and external Rust/LLVM guest rebuilding remain required and unperformed.

Counted descriptor consumer checkpoint — 2 October 2026

Numeric
deadline arithmetic clamps only at the actual monotonic representation and
confers no clock authority.

Refusal or uncertainty leaves
output unchanged and cannot authorize replay.

The readiness feature remains open;
this checkpoint does not accept the whole feature. Full EriX
guest generations and external Rust/LLVM rebuilding inside EriX remain required.

Original recipient readiness checkpoint — 2 October 2026

Public request IDs grant no authority.

Shared publication policy permits one empty refusal after definite output-budget rejection without replay. Unknown native outcomes require terminal exit, with a trap if exit unexpectedly returns.

No new grant or endpoint is introduced.

The complete descriptor readiness feature stays open: POSIX poll/select consumers, descriptor occupation subscriptions, explicit clock/signal composition and end-to-end native readiness workloads remain unfinished. Both complete EriX guest generations and external Rust/LLVM guest rebuilding remain required.

Original PTY readiness checkpoint — 2 October 2026

Original cancellation, acknowledged draining, definite result-capacity refusal and uncertain publication remain distinct; unknown custody forbids replay and requires terminal teardown.

TTYd registers original private input/output receivers before either bootstrap or dynamic session creation exports SEND aliases. Actual occupancy, capacity and closure drive readiness; unchanged waits issue no repeated status RPC or native custody probe.

The signed image requires explicit TTY waiter capacity, admits pristine compiler geometry, checks alignment/native extent and places exact trailing waiter rows above core state and below the terminal stack.

This checkpoint adds no whole-feature acceptance: Launchd delegated-view forwarding, original descriptor subscriptions, complete POSIX consumers, signal/deadline composition and end-to-end native readiness workloads remain unfinished. Both complete EriX guest generations and external Rust/LLVM rebuilding inside EriX remain required and unperformed.

Counted public clock deadlines — 2 October 2026

One earliest native timer uses only Timed's existing Time SEND binding; no Time capability is delegated to clients.

Original caller cancellation, source failure, definite result-capacity refusal and uncertain timer/result custody remain distinct.

Image packaging requires explicit waiter capacity, validates pristine compiler geometry and checked native extent, expands the signed arena and shifts its terminal stack. Zero capacity deliberately refuses deferred admissions; padding never adds rows.

Its required TIMED_DEADLINES_OK marker follows all assertions. The dedicated scenario retains a 90-second external diagnostic budget; the existing time profile also requires the workload and actual APIC wake backend. Hosted adapters cannot fabricate guest success.

Original descriptor/provider subscriptions, mediator/client consumers, signal masks and complete poll/select workloads remain unfinished. Overall phase checklist acceptance is unchanged. Both complete EriX guest generations and rebuilding external Rust/LLVM inside EriX remain required and unperformed.

Authorized native deadlines — 2 October 2026

ARM_DEADLINE (0x59) derives the actual current running process, generation and CSpace, validates the original dedicated Time SEND binding and syscall window, admits a calibrated clock and real interrupt source, and reserves storage before returning an original timer selector. No extra service grant, copied capability, retained user pointer, relative overflow or arbitrary duration/count ceiling is introduced.

Binding loss retains one final original wake; terminal cleanup ends all custody, and serials never wrap/reset.

Runtime and owned-invocation images include the real APIC backend; unsupported profiles refuse timer admission. Elapsed decisions use calibrated monotonic nanoseconds, never interrupt counts.

It requires actual native blocking, increased hardware acknowledgment, a newer epoch, elapsed status and GP/direction canaries, then cancels the original timer. The required deadline marker follows every native/user assertion.

This prerequisite adds no phase acceptance. Timed still needs counted original public deadline waiters/cancellation; descriptor/provider subscriptions, mediator/client consumers, signals and complete poll/select workloads remain unfinished. A service must cover every real event source before replacing cooperative yielding with atomic waiting. Both complete EriX guest generations and external Rust/LLVM rebuilding inside EriX remain required and unperformed.

Explicit legacy receiver watches — 2 October 2026

WATCH_RECEIVER (0x57) authenticates the actual current running generation, CSpace, syscall window and original generic endpoint RECV binding. Registration receives no data, retains no capability, creates no owned-request intake and grants no implicit clock or provider route. Repeated registration of the same binding is idempotent; serials never wrap, including across quiescent storage resets.

Backpressure does not claim CALL acceptance or move capabilities.

Ten new native unit controls cover original versus foreign watchers, observe/arm arrival, identical registration, SEND denial, absence of implicit owned intake, alias and binding retirement, same-slot replacement, transfer rendezvous, allocation refusal, exact register shapes and process teardown. Its required legacy-watch marker follows all native and user assertions.

This prerequisite adds no phase acceptance. Authorized monotonic deadlines, counted original waiters, descriptor/provider subscriptions, mediator/client consumers, signals and complete poll/select workloads remain unfinished. A service must cover every real event source before replacing cooperative yielding with atomic waiting. Both complete EriX guest generations and external Rust/LLVM rebuilding inside EriX remain required and unperformed.

Original native activity and atomic wait — 2 October 2026

Epoch exhaustion refuses sleep without wrap. Accepted COMPLETE ends serving observation custody, so the former server cannot observe later caller collection or retirement.

Ten new native-object and scheduling controls are authored, alongside extended literal and hosted-refusal controls. The original real-CPL3 scenario now makes the server capture its actual epoch and sleep; cancellation of its original delivery wakes it, and user instructions require a strictly newer returned epoch before acknowledgment. The scenario requires the activity-wake marker only after the complete original workload.

This is prerequisite implementation, with no new checklist acceptance. Explicit legacy receiver watches, authorized finite deadlines, original descriptor subscriptions, mediator/provider consumers, signal handling and full poll/select workloads remain unfinished. Mixed legacy/native loops must not yet replace their yielding with native-only waiting. Both complete EriX guest generations and external Rust/LLVM rebuilding remain required and unperformed.

Owned public clock transport repair — 2 October 2026

No new grant, private RTC route, clock-adjustment authority or hidden clock lookup is introduced.

Legacy receive calls are nonblocking so they cannot park the daemon while the separate owned queue has work. Definite short-result-budget rejection permits one empty refusal on the same owner, without resampling; uncertain publication retains custody through original cancellation and acknowledgment.

The complete descriptor-readiness feature remains open: native atomic sleep/wakeup, explicit monotonic deadlines, original descriptor subscriptions, actual mediator/provider consumers, signal/cancellation behavior and native workloads are still unfinished. This prerequisite adds no checklist acceptance. Both full guest EriX generations and external Rust/LLVM rebuilding remain required and unperformed.

Authorized deadline implementation design

Native deadline registration will require the actual current process and an existing dedicated Time endpoint SEND binding. Absolute deadlines use the same calibrated monotonic nanosecond domain as the existing explicit clock read. Pending, expired and failed observations stay scoped to the original registration; cancellation, binding removal and process teardown retire it before reuse. A numeric selector never grants a foreign clock or timer route. Admission reserves real storage before effects, with no fixed waiter ceiling.

The actual hardware timer path must be connected before native wake acceptance; see the boot timer routing defect. Interrupt entry must preserve actual state and cannot switch through diagnostic scheduler contexts. Timed will multiplex counted original public waiters and existing legacy/native sources through its actual Time control grant. Descriptor consumers continue to use their delegated clock service route. Complete readiness acceptance remains open, and execution stays deferred.

Original stream readiness implementation design

Use a cap-free owned stream READINESS operation on the caller's already delegated original stream view. The request distinguishes an immediate snapshot from a wait for selected read, write or priority readiness; zero interests still observe terminal error/hangup. Exact correlated replies report only requested ordinary events plus unconditional terminal events. No request identifier, descriptor number, notification endpoint, clock grant or copied native owner creates authority. The original caller's native RELEASE cancels the wait.

Providers must retain multiple original waits in explicit deployment-counted storage, separate from ordinary stream I/O and immutable pending results. This prevents a long wait from blocking the operations that can make its stream ready. Native CLAIM ownership precedes parsing, output rejection must not replay an operation, and cancellation/receiver retirement must settle the original owner before row reuse. Uncertain custody requires terminal teardown. Zero capacity and exhaustion are explicit errors.

PTY readiness is derived from the actual retained input/output stream state and its authenticated byte capacity. Mutation marks readiness changes; unchanged providers are not repeatedly queried. Launchd follows only an original attenuated recipient view to its retained local provider or exact external backend. It preserves direction restrictions, view-local closure, native outbound custody and lender lifetime. Local and external stream waits must retain descriptor/provider generations and must not attach to replacements. Complete original cancellation precedes view disposal or storage reuse.

The mediator combines these provider subscriptions with original local rings, regular files, explicit public clock deadlines and native observe-before-inspect/wait. No periodic status RPC loop or retry counter may stand in for readiness or elapsed time. Independent framing, duplicates, empty sets, direction, EOF/hangup/error, cancellation, replacement, capacity and masked-signal controls and real native workloads remain part of the full feature. Tests and CI execution remain waived; no runtime success is asserted. Whole descriptor-readiness acceptance remains open until the complete path is implemented.

Signed current revision: 1987e63c.

Original recipient readiness forwarding

Launchd uses its existing full-width owned receiver intake for both ordinary stream requests and READINESS. A readiness request moves its actual noncopyable serving custody into separately counted rows; it does not use a competing smaller CLAIM budget or block ordinary I/O. Each deferred external request owns one actual native outbound call to the resolved original backend, with strict response correlation and release before publication or row reuse. Local waits retain the exact endpoint and logical-stream generations, deriving write readiness from the actual shared byte arena. Original view closure and cancellation end outbound custody before provider disposal; replacement numeric slots cannot revive an old wait. Unknown native outcomes stop the service.

The signed Launchd image describes the waiter type geometry and an explicit deployment count in the existing arena. Zero and exhaustion remain explicit, and alignment padding supplies no extra records. Native activity and actual local mutations gate unchanged wait inspection. Controls cover concurrent data and waits, independent same-ID callers, direction attenuation, local shared capacity, external completion/cancellation/refusal, view disposal, stale generations and counted packaging. Execution of tests and CI remains deferred. Full descriptor-readiness acceptance stays open.

Signed current revision: 1987e63c.

Counted descriptor consumer contract

Extend the compatibility minor version with one readiness operation shared by poll/ppoll and select/pselect. Carry an explicit poll-versus-select mode, an exact counted descriptor/interest list, an optional relative seconds/nanoseconds timeout and an optional temporary signal mask. No process pointer, native owner, notification endpoint or clock selector appears in the request. Infinite and zero intervals stay distinct. Results retain exact row order and cardinality; the original request admits every ordinary returned event, while poll terminal events remain unconditional. Negative poll descriptors produce zero results and duplicate poll entries count separately. Select uses ascending unique selected descriptors and read/write/exception interest bits, reports invalid descriptors as EBADF, and counts ready bits across the three sets. This sparse representation adds no fixed wire fd-set ceiling.

Resolve every live descriptor under the original authenticated client, preserving both its local-number occupation generation and original shared description. Duplicating the same shared description back to a reused number cannot revive an earlier subscription. Duplicate poll entries may share one original backend subscription, but retain separate result positions. Count subscription storage from actual provisioned descriptor rows; preflight all request, result and persistent storage before any registration or temporary mask effect. Regular-file readiness is local to the retained original candidate; stream readiness uses one owned subscription to its original delegated backend. No reopening or repeated provider status request supplies readiness.

Install a temporary mask before the first readiness observation and restore it on normal completion, error, interruption and cancellation. Preserve the original caught condition for normal handler delivery. Readiness takes precedence when readiness and a caught signal are observed together; otherwise caught signals interrupt the wait, including restart-marked actions. Finite waits use the existing explicit public clock role and original Timed monotonic deadline request, with checked relative-to-absolute arithmetic. The actual monotonic representation supplies the maximum finite interval, not an invented duration ceiling. Native observe-before-inspect and atomic wait must cover all registered receiver/caller and local mutation work before idle.

Keep borrowed codecs, client output conversion, original native ownership and service state machines separate. Author independent framing/correlation, descriptor reuse, terminal, time/mask, cancellation and native multi-client controls. Tests and CI execution remain deferred; the whole feature stays open until the mediator, clients, provisioning and native workloads are complete.

Signed current revision: 367dd12b.

Temporary wait mask and caught handoff contract

A caught signal needs two distinct effective masks. The entry mask is the actual task mask under which the condition was selected; handler entry adds the original action mask and, unless NODEFER applies, the selected signal. The restoration mask is the task mask required after normal handler return. They agree for ordinary delivery. For an interrupted temporary-mask wait, the entry mask is the admitted temporary mask and the restoration mask is the original pre-wait mask, which may block the selected signal.

Extend the compatibility minor version and use the final word of the existing 40-byte SignalTake reply for this explicit restoration mask. Preserve the entry mask field and reject every older minor rather than reinterpreting an old reserved word. Both masks exclude immutable signals; the entry mask must not block the selected signal. A restoration mask may block it. The empty handoff stays exactly all-zero. Producers, handler consumers, Rust/C constants, independent literal fixtures and documentation must migrate together. Mask values remain descriptive policy, never native delivery or context-restoration authority.

The mediator retains temporary-mask lifetime beside the original authenticated wait. Admission precedes installation. Readiness wins over a simultaneously observed caught signal; otherwise an actual caught condition interrupts. Selection for interruption retains the original action and both masks, removes only that selected pending occurrence, and restores the pre-wait mask before publishing the wait result. A later generation of the same coalesced condition must survive handoff. SignalTake consumes the retained selection even if the restored mask now blocks that signal; subsequent handler return restores the explicit restoration mask. Cancellation without interruption restores the original mask and leaves pending conditions available under that mask. Terminal client disposal clears temporary and retained handoff state; uncertain publication forbids ordinary reuse.

No later wait may overwrite a retained handoff. Raw compatibility consumers must finish SignalTake and handler restoration before beginning another temporary-mask operation; refusal must be effect-free and must preserve the first handoff. Normal libc orchestration must perform this sequence before returning an interrupted POSIX wait to application code. New controls must cover newly unblocked signals, distinct entry/restoration masks, NODEFER/RESETHAND, independent clients, repeated generation, output admission, cancellation and original-owner mismatch. Complete mediator and libc orchestration remain required for whole-feature completion.

Signed current revision: 8ec0305e.

Signed current revision: 005fec33.

Signed current revision: 6934ccda.

Signed current revision: 94c99d6d.

Signed current revision: 861e27da.

Related records and contracts
Repository Links
docs PR 4
integration PR 12, descriptor-readiness.md, public-deadlines.md
launchd issue 17, PR 2
lib-ipc PR 2, native-activity.md, native-deadlines.md, public-deadlines.md, stream-readiness.md
lib-posixabi PR 3, readiness.md
lib-stdio PR 2
posixd descriptor-readiness.md, inherited-stream-io.md
rootd PR 2
timed issue 3, issue 4, PR 2, owned-clock.md
ttyd PR 3
## Problem and motivation Build tools need poll/select to wait for pipe, stream and descriptor readiness with real timeout and cancellation semantics. The original channel/stream operations used cooperative native probing. This feature adds owned atomic event waits and integrates descriptor readiness consumers. Periodic status queries or fabricated timeouts do not satisfy this requirement. ## Proposed behavior and scope Implement poll/select-compatible counted readiness intent, immediate/infinite/finite waits, duplicate and negative descriptors, invalid-descriptor behavior, EOF/hangup/errors, descriptor-generation retention and required signal-mask/cancellation semantics. Local rings, retained regular files and inherited streams must use their actual original backends. Regular files are immediately ready; no namespace reopening substitutes for an original description. Add the native event/wakeup mechanism needed to atomically observe, arm and sleep without losing an event between inspection and registration. A process may wait only on its own actual native transport/receiver custody; copied process IDs or an unrelated global activity counter confer no observation authority. Producers notify actual readiness changes. Deadline waits use the original explicit clock grant and a real monotonic source, with no default clock endpoint or iteration-derived time. Integrate providers, native consumers and the scheduler rather than stopping at a wire codec. ## Authority, security and reliability Preserve exact native process, receiver, invocation and descriptor generations. Waiting grants no I/O, namespace, process-control or arbitrary event-source authority. Retain the original subscriptions, timer and serving/caller owners through cancellation, signal interruption, timeout, revocation and terminal cleanup. A completed or cancelled registration cannot address a replacement owner. Complete byte/storage admission precedes registration effects; exhaustion refuses without partial ordinary publication. Temporary masks restore on every completed exit. Keep security, reliability and performance in that order. ## Acceptance criteria <details> <summary>Checklist</summary> - [x] Specify and implement exact counted poll/select readiness, result and timeout/signal contracts with full framing and atomic output admission. - [x] Implement native race-free registration, event wakeup, scheduling and original-generation teardown without periodic readiness scans or lost events. - [x] Implement explicit original-clock deadline delivery and cancellation; refuse absent or unavailable clock authority without synthetic elapsed time. - [x] Integrate actual local rings, retained files and required inherited-stream providers with event-driven mediator/client serving and original descriptor lifetime. - [x] Cover immediate/infinite/finite waits, zero descriptors, duplicates/negative/invalid descriptors, hangup/error, replacement, signal-mask restoration, cancellation, revocation and exhaustion with independent controls. - [x] Author native multi-client/multi-realm workloads and race/deadline controls; document exact source and performance evidence without claiming deferred execution. - [x] Complete inline documentation, authority/size audit, maintained component/manual contracts, signed immutable dependency adoption and issue/review/phase tracking before whole-item acceptance. </details> ## Alternatives and tradeoffs A repeated status-query loop would retain the current performance and lost-wakeup risks. Host clocks, hidden timer grants and caller-supplied foreign process selectors are not acceptable substitutes. A process-local native change epoch can support atomic sleep while preserving actual custody; exact descriptor subscriptions and authorized deadline delivery remain required above that mechanism. Choose storage from actual admitted budgets, not an arbitrary fd-set, waiter or timeout ceiling. Keep the existing native transport compatible while replacing obsolete consumer polling paths where the new event mechanism applies. ## Tracking and rollout Coordinate [filesystem services](https://git.erikinkinen.fi/erix/posixd/issues/2), [advisory locking](https://git.erikinkinen.fi/erix/posixd/issues/32), [Posixd review](https://git.erikinkinen.fi/erix/posixd/pulls/5), [Kernel review](https://git.erikinkinen.fi/erix/kernel/pulls/3) and [phase completion](https://git.erikinkinen.fi/erix/integration/issues/65). Derive original implementation from the [POSIX poll/ppoll specification](https://pubs.opengroup.org/onlinepubs/9799919799/functions/poll.html) and [select/pselect specification](https://pubs.opengroup.org/onlinepubs/9799919799/functions/pselect.html), without importing implementation code. Tests, builds, lint, generated documentation, VM/profiler execution and CI observation remain deferred. Full EriX guest builds and external Rust/LLVM rebuilding remain required. <details> <summary>Detailed scope and contracts</summary> ### Counted readiness completion — 2 October 2026 The existing multi-client/multi-realm binaries now exercise real poll/select traffic, duplicate/negative/invalid descriptors, zero descriptors, genuine delegated expiry and missing-clock refusal, submitted-call cancellation, supervisor interruption, temporary-mask handler entry/restoration, peer hangup/EOF, inherited stream readiness and retained file aliases without moving their shared cursor. The readiness issue is closed with all seven criteria checked under the testing waiver. Phase accounting is now 21.04% weighted and 9.61% whole-item acceptance: 32 of 460 parents and 493 of 953 sub-items complete. Both full EriX guest generations and external Rust/LLVM rebuilding inside EriX remain required and unperformed. ### Native readiness activity and atomic idle — 2 October 2026 A concurrent native event prevents sleep or wakes the actual task; no timer, foreign process selector or new authority grant is introduced. Local queue, peer-retirement and signal revisions wake them even when a later native result publication is refused. Ten additional controls are authored for exact epoch use, invalid/exhausted wait receipts, ambiguous watch custody, dormant subscriptions, completion races, local wakeups despite refused publication, signals and receiver retirement. Native multi-client/multi-realm readiness workloads and complete libc handler dispatch remain unfinished. Overall checklist accounting remains 20.64% weighted and 9.21% whole-item acceptance, with 31 of 460 parent items and 493 of 953 sub-items complete. Neither full EriX guest build generations nor external Rust/LLVM rebuilding inside EriX has been demonstrated; both remain required. ### Counted readiness mediator — 2 October 2026 Duplicate poll numbers share a subscription while keeping separate output positions; negative entries stay empty, invalid positive poll entries retain NVAL, and select rejects invalid descriptors before effects. Close, replacement and terminal cleanup cannot discard that custody. Cancellation restores the mask without inventing EINTR; terminal retirement never resurrects old policy. There is no new endpoint, capability grant, allocator or fixed descriptor-array limit. Whole-process activity gating and atomic idle, native multi-client/multi-realm readiness workloads, and full libc handler dispatch before application-visible EINTR remain unfinished. Overall checklist accounting remains 20.64% weighted and 9.21% whole-item acceptance, with 31 of 460 parent items and 493 of 953 sub-items complete. Neither full EriX guest build generations nor external Rust/LLVM rebuilding inside EriX has been demonstrated; both remain required. ### Owned blocking-stream consumer checkpoint — 2 October 2026 Readiness reserves no bytes and cannot fabricate EOF or EPIPE; stale readiness may produce another confirmed zero-progress result and a new original subscription. Canonical provider refusal becomes EIO after release. No endpoint, authority or resource limit is added. Existing fair native/liveness turns remain; whole-process activity gating and atomic idle are still unfinished. Seven new service controls are authored and unrun for dormant subscriptions, stale readiness, signal/draining, caller loss, malformed frames, canonical refusal and hangup/EOF. The [complete descriptor-readiness feature](https://git.erikinkinen.fi/erix/posixd/issues/33) stays open: counted original subscriptions, local/file observations, temporary-mask lifetime and retained interruption, clock composition, atomic idle and native multi-client/multi-realm workloads remain required. No whole-feature acceptance credit is added. Full EriX guest generations and external Rust/LLVM guest rebuilding remain required and unperformed. ### Signal restoration and original caller cancellation checkpoint — 2 October 2026 Both masks exclude immutable/catalog-invalid bits, while only entry must exclude the delivered signal. The final word carries restoration; older minors are rejected and Rust/C constants, literal fixtures, consumers and documentation migrate together. The whole [descriptor-readiness feature](https://git.erikinkinen.fi/erix/posixd/issues/33) stays open: actual mediator temporary-mask lifetime and retained interruption, counted original subscriptions, clock composition and native multi-client/multi-realm workloads remain required. This checkpoint adds no whole-feature acceptance credit. Full EriX guest generations and external Rust/LLVM guest rebuilding remain required and unperformed. ### Counted descriptor consumer checkpoint — 2 October 2026 Numeric deadline arithmetic clamps only at the actual monotonic representation and confers no clock authority. Refusal or uncertainty leaves output unchanged and cannot authorize replay. [The readiness feature](https://git.erikinkinen.fi/erix/posixd/issues/33) remains open; this checkpoint does not accept the whole feature. Full EriX guest generations and external Rust/LLVM rebuilding inside EriX remain required. ### Original recipient readiness checkpoint — 2 October 2026 Public request IDs grant no authority. Shared publication policy permits one empty refusal after definite output-budget rejection without replay. Unknown native outcomes require terminal exit, with a trap if exit unexpectedly returns. No new grant or endpoint is introduced. The complete [descriptor readiness feature](https://git.erikinkinen.fi/erix/posixd/issues/33) stays open: POSIX poll/select consumers, descriptor occupation subscriptions, explicit clock/signal composition and end-to-end native readiness workloads remain unfinished. Both complete EriX guest generations and external Rust/LLVM guest rebuilding remain required. ### Original PTY readiness checkpoint — 2 October 2026 Original cancellation, acknowledged draining, definite result-capacity refusal and uncertain publication remain distinct; unknown custody forbids replay and requires terminal teardown. TTYd registers original private input/output receivers before either bootstrap or dynamic session creation exports SEND aliases. Actual occupancy, capacity and closure drive readiness; unchanged waits issue no repeated status RPC or native custody probe. The signed image requires explicit TTY waiter capacity, admits pristine compiler geometry, checks alignment/native extent and places exact trailing waiter rows above core state and below the terminal stack. This checkpoint adds no whole-feature acceptance: Launchd delegated-view forwarding, original descriptor subscriptions, complete POSIX consumers, signal/deadline composition and end-to-end native readiness workloads remain unfinished. Both complete EriX guest generations and external Rust/LLVM rebuilding inside EriX remain required and unperformed. ### Counted public clock deadlines — 2 October 2026 One earliest native timer uses only Timed's existing Time SEND binding; no Time capability is delegated to clients. Original caller cancellation, source failure, definite result-capacity refusal and uncertain timer/result custody remain distinct. Image packaging requires explicit waiter capacity, validates pristine compiler geometry and checked native extent, expands the signed arena and shifts its terminal stack. Zero capacity deliberately refuses deferred admissions; padding never adds rows. Its required TIMED_DEADLINES_OK marker follows all assertions. The dedicated scenario retains a 90-second external diagnostic budget; the existing time profile also requires the workload and actual APIC wake backend. Hosted adapters cannot fabricate guest success. Original descriptor/provider subscriptions, mediator/client consumers, signal masks and complete poll/select workloads remain unfinished. Overall phase checklist acceptance is unchanged. Both complete EriX guest generations and rebuilding external Rust/LLVM inside EriX remain required and unperformed. ### Authorized native deadlines — 2 October 2026 ARM_DEADLINE (0x59) derives the actual current running process, generation and CSpace, validates the original dedicated Time SEND binding and syscall window, admits a calibrated clock and real interrupt source, and reserves storage before returning an original timer selector. No extra service grant, copied capability, retained user pointer, relative overflow or arbitrary duration/count ceiling is introduced. Binding loss retains one final original wake; terminal cleanup ends all custody, and serials never wrap/reset. Runtime and owned-invocation images include the real APIC backend; unsupported profiles refuse timer admission. Elapsed decisions use calibrated monotonic nanoseconds, never interrupt counts. It requires actual native blocking, increased hardware acknowledgment, a newer epoch, elapsed status and GP/direction canaries, then cancels the original timer. The required deadline marker follows every native/user assertion. This prerequisite adds no phase acceptance. Timed still needs counted original public deadline waiters/cancellation; descriptor/provider subscriptions, mediator/client consumers, signals and complete poll/select workloads remain unfinished. A service must cover every real event source before replacing cooperative yielding with atomic waiting. Both complete EriX guest generations and external Rust/LLVM rebuilding inside EriX remain required and unperformed. ### Explicit legacy receiver watches — 2 October 2026 WATCH_RECEIVER (0x57) authenticates the actual current running generation, CSpace, syscall window and original generic endpoint RECV binding. Registration receives no data, retains no capability, creates no owned-request intake and grants no implicit clock or provider route. Repeated registration of the same binding is idempotent; serials never wrap, including across quiescent storage resets. Backpressure does not claim CALL acceptance or move capabilities. Ten new native unit controls cover original versus foreign watchers, observe/arm arrival, identical registration, SEND denial, absence of implicit owned intake, alias and binding retirement, same-slot replacement, transfer rendezvous, allocation refusal, exact register shapes and process teardown. Its required legacy-watch marker follows all native and user assertions. This prerequisite adds no phase acceptance. Authorized monotonic deadlines, counted original waiters, descriptor/provider subscriptions, mediator/client consumers, signals and complete poll/select workloads remain unfinished. A service must cover every real event source before replacing cooperative yielding with atomic waiting. Both complete EriX guest generations and external Rust/LLVM rebuilding inside EriX remain required and unperformed. ### Original native activity and atomic wait — 2 October 2026 Epoch exhaustion refuses sleep without wrap. Accepted COMPLETE ends serving observation custody, so the former server cannot observe later caller collection or retirement. Ten new native-object and scheduling controls are authored, alongside extended literal and hosted-refusal controls. The original real-CPL3 scenario now makes the server capture its actual epoch and sleep; cancellation of its original delivery wakes it, and user instructions require a strictly newer returned epoch before acknowledgment. The scenario requires the activity-wake marker only after the complete original workload. This is prerequisite implementation, with no new checklist acceptance. Explicit legacy receiver watches, authorized finite deadlines, original descriptor subscriptions, mediator/provider consumers, signal handling and full poll/select workloads remain unfinished. Mixed legacy/native loops must not yet replace their yielding with native-only waiting. Both complete EriX guest generations and external Rust/LLVM rebuilding remain required and unperformed. ### Owned public clock transport repair — 2 October 2026 No new grant, private RTC route, clock-adjustment authority or hidden clock lookup is introduced. Legacy receive calls are nonblocking so they cannot park the daemon while the separate owned queue has work. Definite short-result-budget rejection permits one empty refusal on the same owner, without resampling; uncertain publication retains custody through original cancellation and acknowledgment. The complete descriptor-readiness feature remains open: native atomic sleep/wakeup, explicit monotonic deadlines, original descriptor subscriptions, actual mediator/provider consumers, signal/cancellation behavior and native workloads are still unfinished. This prerequisite adds no checklist acceptance. Both full guest EriX generations and external Rust/LLVM rebuilding remain required and unperformed. ### Authorized deadline implementation design Native deadline registration will require the actual current process and an existing dedicated Time endpoint SEND binding. Absolute deadlines use the same calibrated monotonic nanosecond domain as the existing explicit clock read. Pending, expired and failed observations stay scoped to the original registration; cancellation, binding removal and process teardown retire it before reuse. A numeric selector never grants a foreign clock or timer route. Admission reserves real storage before effects, with no fixed waiter ceiling. The actual hardware timer path must be connected before native wake acceptance; see [the boot timer routing defect](https://git.erikinkinen.fi/erix/kernel/issues/43). Interrupt entry must preserve actual state and cannot switch through diagnostic scheduler contexts. Timed will multiplex counted original public waiters and existing legacy/native sources through its actual Time control grant. Descriptor consumers continue to use their delegated clock service route. Complete readiness acceptance remains open, and execution stays deferred. ### Original stream readiness implementation design Use a cap-free owned stream READINESS operation on the caller's already delegated original stream view. The request distinguishes an immediate snapshot from a wait for selected read, write or priority readiness; zero interests still observe terminal error/hangup. Exact correlated replies report only requested ordinary events plus unconditional terminal events. No request identifier, descriptor number, notification endpoint, clock grant or copied native owner creates authority. The original caller's native RELEASE cancels the wait. Providers must retain multiple original waits in explicit deployment-counted storage, separate from ordinary stream I/O and immutable pending results. This prevents a long wait from blocking the operations that can make its stream ready. Native CLAIM ownership precedes parsing, output rejection must not replay an operation, and cancellation/receiver retirement must settle the original owner before row reuse. Uncertain custody requires terminal teardown. Zero capacity and exhaustion are explicit errors. PTY readiness is derived from the actual retained input/output stream state and its authenticated byte capacity. Mutation marks readiness changes; unchanged providers are not repeatedly queried. Launchd follows only an original attenuated recipient view to its retained local provider or exact external backend. It preserves direction restrictions, view-local closure, native outbound custody and lender lifetime. Local and external stream waits must retain descriptor/provider generations and must not attach to replacements. Complete original cancellation precedes view disposal or storage reuse. The mediator combines these provider subscriptions with original local rings, regular files, explicit public clock deadlines and native observe-before-inspect/wait. No periodic status RPC loop or retry counter may stand in for readiness or elapsed time. Independent framing, duplicates, empty sets, direction, EOF/hangup/error, cancellation, replacement, capacity and masked-signal controls and real native workloads remain part of the full feature. Tests and CI execution remain waived; no runtime success is asserted. Whole descriptor-readiness acceptance remains open until the complete path is implemented. Signed current revision: [1987e63c](https://git.erikinkinen.fi/erix/posixd/commit/1987e63c6632740714b161f2c06a0b7efb8b2dfc). ### Original recipient readiness forwarding Launchd uses its existing full-width owned receiver intake for both ordinary stream requests and READINESS. A readiness request moves its actual noncopyable serving custody into separately counted rows; it does not use a competing smaller CLAIM budget or block ordinary I/O. Each deferred external request owns one actual native outbound call to the resolved original backend, with strict response correlation and release before publication or row reuse. Local waits retain the exact endpoint and logical-stream generations, deriving write readiness from the actual shared byte arena. Original view closure and cancellation end outbound custody before provider disposal; replacement numeric slots cannot revive an old wait. Unknown native outcomes stop the service. The signed Launchd image describes the waiter type geometry and an explicit deployment count in the existing arena. Zero and exhaustion remain explicit, and alignment padding supplies no extra records. Native activity and actual local mutations gate unchanged wait inspection. Controls cover concurrent data and waits, independent same-ID callers, direction attenuation, local shared capacity, external completion/cancellation/refusal, view disposal, stale generations and counted packaging. Execution of tests and CI remains deferred. Full descriptor-readiness acceptance stays open. Signed current revision: [1987e63c](https://git.erikinkinen.fi/erix/posixd/commit/1987e63c6632740714b161f2c06a0b7efb8b2dfc). ### Counted descriptor consumer contract Extend the compatibility minor version with one readiness operation shared by poll/ppoll and select/pselect. Carry an explicit poll-versus-select mode, an exact counted descriptor/interest list, an optional relative seconds/nanoseconds timeout and an optional temporary signal mask. No process pointer, native owner, notification endpoint or clock selector appears in the request. Infinite and zero intervals stay distinct. Results retain exact row order and cardinality; the original request admits every ordinary returned event, while poll terminal events remain unconditional. Negative poll descriptors produce zero results and duplicate poll entries count separately. Select uses ascending unique selected descriptors and read/write/exception interest bits, reports invalid descriptors as EBADF, and counts ready bits across the three sets. This sparse representation adds no fixed wire fd-set ceiling. Resolve every live descriptor under the original authenticated client, preserving both its local-number occupation generation and original shared description. Duplicating the same shared description back to a reused number cannot revive an earlier subscription. Duplicate poll entries may share one original backend subscription, but retain separate result positions. Count subscription storage from actual provisioned descriptor rows; preflight all request, result and persistent storage before any registration or temporary mask effect. Regular-file readiness is local to the retained original candidate; stream readiness uses one owned subscription to its original delegated backend. No reopening or repeated provider status request supplies readiness. Install a temporary mask before the first readiness observation and restore it on normal completion, error, interruption and cancellation. Preserve the original caught condition for normal handler delivery. Readiness takes precedence when readiness and a caught signal are observed together; otherwise caught signals interrupt the wait, including restart-marked actions. Finite waits use the existing explicit public clock role and original Timed monotonic deadline request, with checked relative-to-absolute arithmetic. The actual monotonic representation supplies the maximum finite interval, not an invented duration ceiling. Native observe-before-inspect and atomic wait must cover all registered receiver/caller and local mutation work before idle. Keep borrowed codecs, client output conversion, original native ownership and service state machines separate. Author independent framing/correlation, descriptor reuse, terminal, time/mask, cancellation and native multi-client controls. Tests and CI execution remain deferred; the whole feature stays open until the mediator, clients, provisioning and native workloads are complete. Signed current revision: [367dd12b](https://git.erikinkinen.fi/erix/posixd/commit/367dd12b9a289d07b1a7a22fcb0789e793249813). ### Temporary wait mask and caught handoff contract A caught signal needs two distinct effective masks. The entry mask is the actual task mask under which the condition was selected; handler entry adds the original action mask and, unless NODEFER applies, the selected signal. The restoration mask is the task mask required after normal handler return. They agree for ordinary delivery. For an interrupted temporary-mask wait, the entry mask is the admitted temporary mask and the restoration mask is the original pre-wait mask, which may block the selected signal. Extend the compatibility minor version and use the final word of the existing 40-byte SignalTake reply for this explicit restoration mask. Preserve the entry mask field and reject every older minor rather than reinterpreting an old reserved word. Both masks exclude immutable signals; the entry mask must not block the selected signal. A restoration mask may block it. The empty handoff stays exactly all-zero. Producers, handler consumers, Rust/C constants, independent literal fixtures and documentation must migrate together. Mask values remain descriptive policy, never native delivery or context-restoration authority. The mediator retains temporary-mask lifetime beside the original authenticated wait. Admission precedes installation. Readiness wins over a simultaneously observed caught signal; otherwise an actual caught condition interrupts. Selection for interruption retains the original action and both masks, removes only that selected pending occurrence, and restores the pre-wait mask before publishing the wait result. A later generation of the same coalesced condition must survive handoff. SignalTake consumes the retained selection even if the restored mask now blocks that signal; subsequent handler return restores the explicit restoration mask. Cancellation without interruption restores the original mask and leaves pending conditions available under that mask. Terminal client disposal clears temporary and retained handoff state; uncertain publication forbids ordinary reuse. No later wait may overwrite a retained handoff. Raw compatibility consumers must finish SignalTake and handler restoration before beginning another temporary-mask operation; refusal must be effect-free and must preserve the first handoff. Normal libc orchestration must perform this sequence before returning an interrupted POSIX wait to application code. New controls must cover newly unblocked signals, distinct entry/restoration masks, NODEFER/RESETHAND, independent clients, repeated generation, output admission, cancellation and original-owner mismatch. Complete mediator and libc orchestration remain required for whole-feature completion. Signed current revision: [8ec0305e](https://git.erikinkinen.fi/erix/posixd/commit/8ec0305e73f9a49ba3ffe8512f3559bdaa1f0f18). Signed current revision: [005fec33](https://git.erikinkinen.fi/erix/posixd/commit/005fec332c193bd0a7349c5fd675798b1252708c). Signed current revision: [6934ccda](https://git.erikinkinen.fi/erix/posixd/commit/6934ccdaecc2e19d82d30e13665d351486bd4948). Signed current revision: [94c99d6d](https://git.erikinkinen.fi/erix/posixd/commit/94c99d6db75b94eccabbc37d83ccf90959323495). Signed current revision: [861e27da](https://git.erikinkinen.fi/erix/posixd/commit/861e27dacabfc6ba9e7adc7b26733c6243f85c0b). </details> <details> <summary>Related records and contracts</summary> | Repository | Links | | --- | --- | | docs | [PR 4](https://git.erikinkinen.fi/erix/docs/pulls/4) | | integration | [PR 12](https://git.erikinkinen.fi/erix/integration/pulls/12), [descriptor-readiness.md](https://git.erikinkinen.fi/erix/integration/src/branch/feature/posix-compat/docs/descriptor-readiness.md), [public-deadlines.md](https://git.erikinkinen.fi/erix/integration/src/branch/feature/posix-compat/docs/public-deadlines.md) | | launchd | [issue 17](https://git.erikinkinen.fi/erix/launchd/issues/17), [PR 2](https://git.erikinkinen.fi/erix/launchd/pulls/2) | | lib-ipc | [PR 2](https://git.erikinkinen.fi/erix/lib-ipc/pulls/2), [native-activity.md](https://git.erikinkinen.fi/erix/lib-ipc/src/branch/feature/posix-compat/docs/native-activity.md), [native-deadlines.md](https://git.erikinkinen.fi/erix/lib-ipc/src/branch/feature/posix-compat/docs/native-deadlines.md), [public-deadlines.md](https://git.erikinkinen.fi/erix/lib-ipc/src/branch/feature/posix-compat/docs/public-deadlines.md), [stream-readiness.md](https://git.erikinkinen.fi/erix/lib-ipc/src/branch/feature/posix-compat/docs/stream-readiness.md) | | lib-posixabi | [PR 3](https://git.erikinkinen.fi/erix/lib-posixabi/pulls/3), [readiness.md](https://git.erikinkinen.fi/erix/lib-posixabi/src/branch/feature/posix-compat/docs/readiness.md) | | lib-stdio | [PR 2](https://git.erikinkinen.fi/erix/lib-stdio/pulls/2) | | posixd | [descriptor-readiness.md](https://git.erikinkinen.fi/erix/posixd/src/branch/feature/posix-compat/docs/descriptor-readiness.md), [inherited-stream-io.md](https://git.erikinkinen.fi/erix/posixd/src/branch/feature/posix-compat/docs/inherited-stream-io.md) | | rootd | [PR 2](https://git.erikinkinen.fi/erix/rootd/pulls/2) | | timed | [issue 3](https://git.erikinkinen.fi/erix/timed/issues/3), [issue 4](https://git.erikinkinen.fi/erix/timed/issues/4), [PR 2](https://git.erikinkinen.fi/erix/timed/pulls/2), [owned-clock.md](https://git.erikinkinen.fi/erix/timed/src/branch/feature/posix-compat/docs/owned-clock.md) | | ttyd | [PR 3](https://git.erikinkinen.fi/erix/ttyd/pulls/3) | </details>
erikinkinen 2026-10-02 16:05:44 +02:00
  • closed this issue
  • added the
    refactor
    label
erikinkinen added this to the Alpha 1 milestone 2026-10-30 09:35:07 +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#33
No description provided.