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
-
// Skip those invalid ones and continue (GNU env also ignores undefined signals).
1080
-
letOk(sig) = signal_from_value(sig_value)else{
1081
-
returnOk(());
1082
-
};
1083
-
signal_fn(sig)?;
1063
+
signal_fn(sig_value)?;
1084
1064
log.record(sig_value, action_kind, explicit);
1085
1065
1086
1066
// Set environment variable to communicate to Rust child processes
@@ -1096,9 +1076,14 @@ where
1096
1076
}
1097
1077
1098
1078
#[cfg(unix)]
1099
-
fnignore_signal(sig:Signal) -> UResult<()>{
1079
+
fnignore_signal(sig:usize) -> UResult<()>{
1100
1080
// 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)};
1081
+
// nix::sys::signal::Signal does not cover real-time signals, so we need to call
1082
+
// libc::signal directly.
1083
+
let result = unsafe{
1084
+
let res = libc::signal(sig as libc::c_int, libc::SIG_IGN);
0 commit comments