File descriptor layer: dup/close hooks, fork support, WeakEntryHandle#744
Open
wdcui wants to merge 1 commit intowdcui/stacked/pr3-foundation-typesfrom
Open
File descriptor layer: dup/close hooks, fork support, WeakEntryHandle#744wdcui wants to merge 1 commit intowdcui/stacked/pr3-foundation-typesfrom
wdcui wants to merge 1 commit intowdcui/stacked/pr3-foundation-typesfrom
Conversation
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
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)