Closed magicant closed 3 months ago
This update enhances the yash-env
project by reworking the handling of file descriptor flags, transitioning from singular flag types to an EnumSet<FdFlag>
model. This change promotes more flexible and extensible flag management, allowing multiple flags to be used simultaneously. The modifications span various modules, improving clarity, functionality, and maintaining consistency throughout the codebase.
Files | Change Summary |
---|---|
yash-builtin/src/source/semantics.rs |
Updated assertions in tests to utilize EnumSet<FdFlag> for flag handling. |
yash-env/CHANGELOG.md |
Documented major type redefinitions and method signature changes for FdFlag and Mode . |
yash-env/src/system.rs |
Updated System trait methods to use EnumSet<FdFlag> for handling flags instead of FdFlag . |
yash-env/src/system/fd_flag.rs |
Introduced a new FdFlag enum with EnumSetType , enhancing flag management capabilities. |
yash-env/src/system/real.rs |
Altered RealSystem methods to accept and return EnumSet<FdFlag> for file descriptor operations. |
yash-env/src/system/shared.rs |
Updated SharedSystem to use EnumSet<FdFlag> in various file descriptor-related methods. |
yash-env/src/system/virtual.rs |
Adjusted VirtualSystem to replace FdFlag with EnumSet<FdFlag> in flag handling. |
yash-env/src/system/virtual/io.rs |
Changed FdBody structure to hold flags: EnumSet<FdFlag> instead of a single FdFlag . |
yash-env/src/system/virtual/process.rs |
Renamed flag to flags in FdBody , updating logic to handle multiple flags. |
yash-semantics/src/command/pipeline.rs |
Modified flag checks and assertions to utilize EnumSet for improved file descriptor management. |
yash-semantics/src/redir.rs |
Renamed FD_CLOEXEC to CloseOnExec , updating function calls to reflect the new naming. |
sequenceDiagram
participant User
participant System
participant FdFlag
participant EnumSet
User->>System: Request file descriptor operation
System->>FdFlag: Check flags
FdFlag->>EnumSet: Convert to EnumSet<FdFlag>
System->>EnumSet: Process multiple flags
EnumSet-->>System: Return flag status
System-->>User: Respond with operation result
π In a world of flags so bright,
The rabbit hops with pure delight.
With EnumSet, we can now play,
Managing bits in a clever way!
Hooray for changes, letβs all cheer,
For clearer code and less to fear! π
Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?
This pull request is part of https://github.com/magicant/yash-rs/issues/353 and replaces the
FdFlag
type with a platform-independent definition.Summary by CodeRabbit
New Features
Bug Fixes
EnumSet
type for file descriptor flags, improving accuracy and consistency.Refactor
EnumSet<FdFlag>
, improving flexibility and clarity in flag handling.Documentation