signal: Increase number of signals to 33 for the sake of FreeBSD

Fixes alexcrichton/tokio-signal#21
This commit is contained in:
Markus Westerlind
2018-09-10 11:30:04 -07:00
committed by Carl Lerche
parent 9a4e4f2308
commit 31b51004f2
+4 -3
View File
@@ -33,7 +33,8 @@ pub use self::libc::{SIGUSR1, SIGUSR2, SIGINT, SIGTERM};
pub use self::libc::{SIGALRM, SIGHUP, SIGPIPE, SIGQUIT, SIGTRAP}; pub use self::libc::{SIGALRM, SIGHUP, SIGPIPE, SIGQUIT, SIGTRAP};
// Number of different unix signals // Number of different unix signals
const SIGNUM: usize = 32; // (FreeBSD has 33)
const SIGNUM: usize = 33;
struct SignalInfo { struct SignalInfo {
pending: AtomicBool, pending: AtomicBool,
@@ -48,7 +49,7 @@ struct SignalInfo {
struct Globals { struct Globals {
sender: UnixStream, sender: UnixStream,
receiver: UnixStream, receiver: UnixStream,
signals: [SignalInfo; SIGNUM], signals: Vec<SignalInfo>,
} }
impl Default for SignalInfo { impl Default for SignalInfo {
@@ -74,7 +75,7 @@ fn globals() -> &'static Globals {
let globals = Globals { let globals = Globals {
sender: sender, sender: sender,
receiver: receiver, receiver: receiver,
signals: Default::default(), signals: (0..SIGNUM).map(|_| Default::default()).collect(),
}; };
GLOBALS = Box::into_raw(Box::new(globals)); GLOBALS = Box::into_raw(Box::new(globals));
}); });