File descriptor layer: dup/close hooks, fork support, WeakEntryHandle#744
Closed
wdcui wants to merge 4 commits intowdcui/stacked/pr3-foundation-typesfrom
Closed
File descriptor layer: dup/close hooks, fork support, WeakEntryHandle#744wdcui wants to merge 4 commits intowdcui/stacked/pr3-foundation-typesfrom
wdcui wants to merge 4 commits intowdcui/stacked/pr3-foundation-typesfrom
Conversation
…yMap clone support Layer 0 of the core litebox crate changes for multi-process support: Platform traits: - AddressSpaceProvider trait for per-process address spaces - RawMessageProvider for direct guest-broker byte channels - StdioProvider expansion (terminal attrs, window size, nonblocking stdin, cancel, host TTY device info) - SendError::Io, ReceiveError::ProtocolError/Eof, StdioReadError::WouldBlock - SystemInfoProvider::current_processor_number() - Provider supertrait: + RawMessageProvider + AddressSpaceProvider Event/sync: - IOPollable::needs_host_poll(), should_block_read() defaults - Observer::prune_dead_observers() to GC stale Weak refs on register - Waker::ptr_eq() utility - FutexManager wait/wake: address_space_id parameter for multi-process - trace_fs feature gate for RawSyncPrimitivesProvider Utilities: - AnyMap: Clone bound on insert, type-erased Clone impl - PageManagementProvider::allocate_pages: noreserve parameter - copy_pages: fix chunk-length bug (was using old_range.len() per chunk) Caller updates across all platform crates and litebox_shim_linux.
Add RawMessageProvider and AddressSpaceProvider implementations for WindowsUserland, and add the _noreserve parameter to allocate_pages. These are required by the Provider supertrait expansion and PageManagementProvider signature change in the foundation types PR.
e3a4c2f to
152485f
Compare
Refactor the Descriptors table to support dup/close lifecycle hooks, close_and_remove semantics, fork-aware cloning, and WeakEntryHandle. Remove DescriptorObjectId in favor of identity_addr() (Arc pointer identity).
152485f to
2480a40
Compare
0bee7b2 to
6c425be
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Layer 1 of the core litebox crate changes. Refactors
fd/mod.rsto support process-level operations (fork, dup, fd passing) needed by the upcoming process registry.Part of the stacked PR series — base: PR #743 (foundation types)
Changes
fd/mod.rs (~396 insertions, ~153 deletions)
on_dup()/on_close()hooks: Default-empty trait methods onFdEnabledSubsystemEntryfor ref-counting subsystems (e.g., pipes, PTYs)close_and_remove: Replacesclose_and_duplicate_if_sharedwith simpler always-remove semantics (Releasedvariant replacesDuplicated)duplicate_raw_fd: Fork-time entry duplication by rawOwnedFdWeakEntryHandle+EntryHandle::downgrade(): Weak references to descriptor entriesPassedFd/duplicate_for_passing/insert_passed_fd: SCM_RIGHTS-style fd passing between processesclone_for_forkonRawDescriptorStorage: Deep-clone descriptor table for forkentry_handles: Iterator over all alive entries of a subsystemEntryHandle: Restructured to named fields withClonesupport, addsobject_id()andidentity_addr()fd/tests.rs
DescriptorObjectIdpreservation acrossduplicateandclone_for_forknet/mod.rs (minimal caller updates)
close_and_duplicate_if_shared→close_and_removeCloseResult::Duplicated→CloseResult::Releasedqueued_for_closurefield andattempt_to_close_queued()(no longer needed)PR Stack
wdcui/stacked/pr1c-rewriter-interface)wdcui/stacked/pr1b-trampoline-format)wdcui/stacked/pr2-packager-crossplatform)wdcui/stacked/pr3-foundation-types)wdcui/stacked/pr4-fd-layer)