File: default.rs

package info (click to toggle)
rust-signal-hook 0.3.17-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 344 kB
  • sloc: ansic: 46; sh: 14; makefile: 2
file content (25 lines) | stat: -rw-r--r-- 579 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
//! Check the hack of SIG_DFL for windows.
//!
//! Libc doesn't export SIG_DFL on windows. It seems to be 0 on all platforms, though, but just to
//! make sure, we observe it is so. We try to read the previous signal on startup and it must be
//! the default.

extern crate libc;

use libc::{sighandler_t, signal, SIGTERM};

const SIG_DFL: sighandler_t = 0;

#[test]
fn sig_dfl() {
    unsafe {
        let prev = signal(SIGTERM, SIG_DFL);
        assert_eq!(SIG_DFL, prev);
    }
}

#[cfg(not(windows))]
#[test]
fn sig_dfl_static() {
    assert_eq!(::libc::SIG_DFL, SIG_DFL);
}