FS/net/pipes layer: trait expansion, shutdown, UDP fixes, vfork-aware pipes#745
Open
wdcui wants to merge 2 commits intowdcui/stacked/pr4-fd-layerfrom
Open
FS/net/pipes layer: trait expansion, shutdown, UDP fixes, vfork-aware pipes#745wdcui wants to merge 2 commits intowdcui/stacked/pr4-fd-layerfrom
wdcui wants to merge 2 commits intowdcui/stacked/pr4-fd-layerfrom
Conversation
… pipes Expand the FileSystem trait with ~15 new methods (open_at, stat_at, unlink_at, readlink_at, rename_at, mkdir_at, fd_path, rename, etc.) all with default Err(...) bodies so concrete implementations can land in later PRs. Add new error types (CreateAnonymousFileError, RenameError, ReadLinkError, SymlinkError, LinkError, ShutdownError) and extend existing enums with variants needed by the process layer (Interrupted, ClosedFd, NotADirectory, WouldBlock, SymlinkLoop). Network: add shutdown() with NetworkProxy delegation, fix UDP local_port leak (track allocation across bind/connect/sendto/close), fix TCP INADDR_ANY listen (use None instead of 0.0.0.0 for smoltcp wildcard), add ip_listen_endpoint_v4 helper. Pipes: implement Clone, add vfork-aware read with deadlock detection via fd_ref_count tracking, replace enable_fds_for_subsystem! macro with manual FdEnabledSubsystemEntry that overrides on_dup/on_close for ref counting, add readable_bytes() and Deadlock error variant. Use Release ordering on fd_ref_count mutations to pair with Acquire loads in the deadlock check.
- Backtick-escape Arc<WriteEnd> in pipes.rs doc comment (rustdoc invalid_html_tags error). - Remove get/set_pty_termios and get/set_pty_foreground_pgrp from the FileSystem trait — these are PTY-device-specific and belong in the PTY subsystem layer, not the generic FS trait. - Remove PtyTermios type alias from devices.rs (no remaining callers).
6448a31 to
046443d
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 2 (part 1 of 2) of the stacked PR series. Expands the core FS, network, and pipes subsystems with the interfaces and fixes needed by the process layer.
FileSystem trait expansion (~234 lines in fs/mod.rs)
open_at,stat_at,unlink_at,readlink_at,rename_at,mkdir_at,fd_path,rename,create_anonymous_file,symlink,link, PTY termios methods, etc.Err(...)bodies so concrete implementations (in_mem, tar_ro, layered, devices) can be added in later PRsFileType::Symlinkvariant,FileStatus: ClonePtyTermiostype alias infs/devices.rsNew error types (91 lines in fs/errors.rs, 10 in net/errors.rs)
CreateAnonymousFileError,RenameError,ReadLinkError,SymlinkError,LinkError,ShutdownErrorOpenError,CloseError,ReadError,WriteError,UnlinkError,FileStatusErrorNetwork fixes and additions (~160 lines in net/mod.rs + 16 in socket_channel.rs)
shutdown()method withNetworkProxydelegation toStreamSocketChannelLocalPortallocation across bind/connect/sendto/closeNoneinstead ofIpv4Address::new(0,0,0,0)for smoltcp wildcardip_listen_endpoint_v4helperPipes enhancements (~156 lines)
Cloneimpl forPipesread_vfork_aware()/read_inner()refactor with deadlock detection viafd_ref_countreadable_bytes()query method,Deadlockerror variantFdEnabledSubsystemEntryimpl replacingenable_fds_for_subsystem!macro, overridingon_dup()/on_close()to track writer FD reference countsReleaseordering onfd_ref_countmutations paired withAcquireloadsMatch exhaustiveness (37 lines in layered.rs)
FileType::Symlink,FileStatusError::NotADirectory/SymlinkLoop,OpenError::Interrupted/ClosedFd/NotADirectory, etc.) in existing layered FS match statementsStacked on
Testing