Closed magicant closed 4 months ago
The changes in this update focus on improving signal handling in the yash-env
project. Key modifications include altering the sigmask
method to use a tuple of SigmaskHow
and signal numbers, replacing SigSet
with Vec<signal::Number>
, and updating the Process
struct to use BTreeSet
for managing signals. These adjustments enhance flexibility and control over signal manipulation within the system.
Files | Change Summaries |
---|---|
yash-env/CHANGELOG.md |
Summarized changes in system::System and system::virtual::Process modules, updated sigmask method parameters, and modified signal handling. |
yash-env/src/lib.rs |
Removed import of nix::sys::signal::Signal , replaced Signal::SIGCHLD with &SIGCHLD in assertions. |
yash-env/src/subshell.rs |
Imported signal module, replaced SigSet with Vec<signal::Number> , refactored signal handling for SIGINT and SIGQUIT . |
yash-env/src/system.rs |
Modified System and SystemEx traits, changed sigmask method parameters, updated signal handling logic, removed pub use nix::sys::signal::SigmaskHow . |
yash-env/src/system/real.rs |
Updated sigmask method to accept op as a tuple and old_mask as a mutable reference to a vector, modified signal mask handling in pselect . |
yash-env/src/system/real/signal.rs |
Introduced all_signals() function, added sigset_to_vec() function for converting signal sets to vectors. |
yash-env/src/system/virtual.rs |
Updated sigmask and select methods to use tuples and slices of signal numbers instead of SigSet , restructured signal mask handling. |
yash-env/src/system/virtual/process.rs |
Replaced SigSet with BTreeSet for managing blocked and pending signals in Process struct, updated methods to accommodate this change. |
yash-env/src/system/virtual/signal.rs |
Removed Number struct and its methods for converting signal numbers between real and virtual systems. |
sequenceDiagram
participant User
participant Subshell
participant System
participant Signal
User->>Subshell: block_sigint_sigquit()
Subshell->>System: sigmask(Some((SIG_BLOCK, &[sigint, sigquit])), Some(&mut old_mask))
System->>Signal: Retrieve signal numbers
Signal-->>System: Return signal numbers
System-->>Subshell: Block signals and update old_mask
Subshell-->>User: Return success/failure
System
API independent of the nix
crate by removing re-exports and using internal representations for signals and signal masks.In the land of code, where signals play, A rabbit hops, clearing the way. From
SigSet
to vectors, changes unfold, Enhancing the system, making it bold. With signals now managed, clear and precise, The code runs smoother, a paradise. 🐇✨
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 commit replaces the SigSet type with an array of Signal in the System trait. This change is necessary because the SigSet type is specific to the nix crate, and the System trait should not depend on specific types from external crates.
This commit also updates the implementations of the System trait to reflect this change. SelectSystem::wait_mask is now an optional Vec of Signal, and virtual Process now uses a BTreeSet of Signal instead of SigSet.
Summary by CodeRabbit
Refactor
SigSet
withVec<signal::Number>
for better flexibility and performance.New Features
all_signals()
function to iterate over all signal numbers.sigset_to_vec()
function to convert signal sets to vectors.Bug Fixes