@@ -63,6 +63,14 @@ pub struct SandboxConfiguration {
6363     /// signal can be delivered to the thread, but the thread may not yet 
6464     /// have entered kernel space. 
6565     interrupt_retry_delay :  Duration , 
66+     /// Offset from `SIGRTMIN` used to determine the signal number for interrupting 
67+      /// the VCPU thread. The actual signal sent is `SIGRTMIN + interrupt_vcpu_sigrtmin_offset`. 
68+      /// 
69+      /// This signal must fall within the valid real-time signal range supported by the host. 
70+      /// 
71+      /// Note: Since real-time signals can vary across platforms, ensure that the offset 
72+      /// results in a signal number that is not already in use by other components of the system. 
73+      interrupt_vcpu_sigrtmin_offset :  usize , 
6674} 
6775
6876impl  SandboxConfiguration  { 
@@ -76,6 +84,8 @@ impl SandboxConfiguration {
7684     pub  const  MIN_OUTPUT_SIZE :  usize  = 0x2000 ; 
7785    /// The default interrupt retry delay 
7886     pub  const  DEFAULT_INTERRUPT_RETRY_DELAY :  Duration  = Duration :: from_micros ( 500 ) ; 
87+     /// The default signal offset from `SIGRTMIN` used to determine the signal number for interrupting 
88+      pub  const  INTERRUPT_VCPU_SIGRTMIN_OFFSET :  usize  = 0 ; 
7989
8090    #[ allow( clippy:: too_many_arguments) ]  
8191    /// Create a new configuration for a sandbox with the given sizes. 
@@ -86,6 +96,7 @@ impl SandboxConfiguration {
8696        stack_size_override :  Option < u64 > , 
8797        heap_size_override :  Option < u64 > , 
8898        interrupt_retry_delay :  Duration , 
99+         interrupt_vcpu_sigrtmin_offset :  usize , 
89100        #[ cfg( gdb) ]   guest_debug_info :  Option < DebugInfo > , 
90101    )  -> Self  { 
91102        Self  { 
@@ -94,7 +105,7 @@ impl SandboxConfiguration {
94105            stack_size_override :  stack_size_override. unwrap_or ( 0 ) , 
95106            heap_size_override :  heap_size_override. unwrap_or ( 0 ) , 
96107            interrupt_retry_delay, 
97- 
108+             interrupt_vcpu_sigrtmin_offset , 
98109            #[ cfg( gdb) ]  
99110            guest_debug_info, 
100111        } 
@@ -136,6 +147,20 @@ impl SandboxConfiguration {
136147        self . interrupt_retry_delay 
137148    } 
138149
150+     /// Get the signal offset from `SIGRTMIN` used to determine the signal number for interrupting the VCPU thread 
151+      pub  fn  get_interrupt_vcpu_sigrtmin_offset ( & self )  -> usize  { 
152+         self . interrupt_vcpu_sigrtmin_offset 
153+     } 
154+ 
155+     /// Sets the offset from `SIGRTMIN` to determine the real-time signal used for 
156+      /// interrupting the VCPU thread. 
157+      /// 
158+      /// The final signal number is computed as `SIGRTMIN + offset`, and it must fall within 
159+      /// the valid range of real-time signals supported by the host system. 
160+      pub  fn  set_interrupt_vcpu_sigrtmin_offset ( & mut  self ,  offset :  usize )  { 
161+         self . interrupt_vcpu_sigrtmin_offset  = offset; 
162+     } 
163+ 
139164    /// Sets the configuration for the guest debug 
140165     #[ cfg( gdb) ]  
141166    #[ instrument( skip_all,  parent = Span :: current( ) ,  level= "Trace" ) ]  
@@ -195,6 +220,7 @@ impl Default for SandboxConfiguration {
195220            None , 
196221            None , 
197222            Self :: DEFAULT_INTERRUPT_RETRY_DELAY , 
223+             Self :: INTERRUPT_VCPU_SIGRTMIN_OFFSET , 
198224            #[ cfg( gdb) ]  
199225            None , 
200226        ) 
@@ -218,6 +244,7 @@ mod tests {
218244            Some ( STACK_SIZE_OVERRIDE ) , 
219245            Some ( HEAP_SIZE_OVERRIDE ) , 
220246            SandboxConfiguration :: DEFAULT_INTERRUPT_RETRY_DELAY , 
247+             SandboxConfiguration :: INTERRUPT_VCPU_SIGRTMIN_OFFSET , 
221248            #[ cfg( gdb) ]  
222249            None , 
223250        ) ; 
@@ -244,6 +271,7 @@ mod tests {
244271            None , 
245272            None , 
246273            SandboxConfiguration :: DEFAULT_INTERRUPT_RETRY_DELAY , 
274+             SandboxConfiguration :: INTERRUPT_VCPU_SIGRTMIN_OFFSET , 
247275            #[ cfg( gdb) ]  
248276            None , 
249277        ) ; 
0 commit comments