You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The nix::sys::signal::Signal enum type does not cover real-time signals.
In the current env code, this means that trying to block e.g. SIGRTMIN+7
is silently ignored, apply_signal_action() silently drops signals that
cannot be represented as that enum.
However, the enum cannot simply be extended to represent the real-time
signals, because SIGRTMIN and SIGRTMAX cannot be considered constants.
To workaround this, do not use the Signal enum type, and use libc where
needed instead of the wrappers.
Fixes: #11151
// On some platforms ALL_SIGNALS may contain values that are not valid in libc.
1079
1081
// Skip those invalid ones and continue (GNU env also ignores undefined signals).
1080
-
letOk(sig) = signal_from_value(sig_value)else{
1082
+
if !signal_is_valid(sig_value){
1081
1083
returnOk(());
1082
-
};
1083
-
signal_fn(sig)?;
1084
+
}
1085
+
1086
+
signal_fn(sig_value)?;
1084
1087
log.record(sig_value, action_kind, explicit);
1085
1088
1086
1089
// Set environment variable to communicate to Rust child processes
@@ -1096,9 +1099,14 @@ where
1096
1099
}
1097
1100
1098
1101
#[cfg(unix)]
1099
-
fnignore_signal(sig:Signal) -> UResult<()>{
1102
+
fnignore_signal(sig:usize) -> UResult<()>{
1100
1103
// SAFETY: This is safe because we write the handler for each signal only once, and therefore "the current handler is the default", as the documentation requires it.
1101
-
let result = unsafe{signal(sig,SigIgn)};
1104
+
// nix::sys::signal::Signal does not cover real-time signals, so we need to call
1105
+
// libc::signal directly.
1106
+
let result = unsafe{
1107
+
let res = libc::signal(sig as libc::c_int, libc::SIG_IGN);
0 commit comments