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
Platform Linux thinkpad 5.16.11-arch1-1 #1 SMP PREEMPT Thu, 24 Feb 2022 02:18:20 +0000 x86_64 GNU/Linux
Description
I'm trying to listen to signals between libc::SIGRTMIN() and libc::SIGRTMAX(), which should be possible according to the POSIX standard (and it worked with the signal-hook crate).
I tried this code:
use tokio::signal::unix::{signal,SignalKind};fnmain(){let _signal = signal(SignalKind::from_raw(libc::SIGRTMIN() + 3)).unwrap();}
And it panicked with "signal too large".
I tracked the error down with gdb, and the reason it fails, is because of this check in tokio/src/signal/unix.rs:
fnsignal_enable(signal:SignalKind,handle:&Handle) -> io::Result<()>{// ...let globals = globals();let siginfo = match globals.storage().get(signal asEventId){Some(slot) => slot,None => returnErr(io::Error::new(io::ErrorKind::Other,"signal too large")),};// ...}
The text was updated successfully, but these errors were encountered:
I dug a bit in the source code and I think I found the issue.
The number of unix signals is defined in tokio/src/signal/unix.rs:
// Number of different unix signals// (FreeBSD has 33)constSIGNUM:usize = 33;
However, that is simply not true, because the POSIX standard allows for signals up to SIGRTMAX, which is greater than 33.
My proposed solution would be just replacing this:
// Number of different unix signals// (FreeBSD has 33)constSIGNUM:usize = 33;implInitforOsStorage{fninit() -> Self{(0..SIGNUM).map(|_| SignalInfo::default()).collect()}}
Version
tokio v1.17.0
Platform
Linux thinkpad 5.16.11-arch1-1 #1 SMP PREEMPT Thu, 24 Feb 2022 02:18:20 +0000 x86_64 GNU/Linux
Description
I'm trying to listen to signals between
libc::SIGRTMIN()
andlibc::SIGRTMAX()
, which should be possible according to the POSIX standard (and it worked with thesignal-hook
crate).I tried this code:
And it panicked with "signal too large".
I tracked the error down with
gdb
, and the reason it fails, is because of this check intokio/src/signal/unix.rs
:The text was updated successfully, but these errors were encountered: