Debian Codegraph @

debian/rust-vendor/signal-hook/tests/default.rs

raw
1 //! Check the hack of SIG_DFL for windows.
2 //!
3 //! Libc doesn't export SIG_DFL on windows. It seems to be 0 on all platforms, though, but just to
4 //! make sure, we observe it is so. We try to read the previous signal on startup and it must be
5 //! the default.
6
7 extern crate libc;
8
9 use libc::{sighandler_t, signal, SIGTERM};
10
11 const SIG_DFL: sighandler_t = 0;
12
13 #[test]
14 fn sig_dfl() {
15 unsafe {
16 let prev = signal(SIGTERM, SIG_DFL);
17 assert_eq!(SIG_DFL, prev);
18 }
19 }
20
21 #[cfg(not(windows))]
22 #[test]
23 fn sig_dfl_static() {
24 assert_eq!(::libc::SIG_DFL, SIG_DFL);
25 }