Skip to content

Commit 83d778e

Browse files
committed
Remove signalfd feature in favor of conditional compilation
1 parent 85b9696 commit 83d778e

File tree

4 files changed

+12
-27
lines changed

4 files changed

+12
-27
lines changed

Cargo.toml

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@ exclude = [
1717

1818
[features]
1919
execvpe = []
20-
signalfd = []
2120

2221
[dependencies]
2322
libc = "0.2.25"
@@ -36,12 +35,6 @@ nix-test = { path = "nix-test", version = "0.0.1" }
3635
name = "test"
3736
path = "test/test.rs"
3837

39-
[[test]]
40-
name = "test-signalfd"
41-
path = "test/test_signalfd.rs"
42-
harness = false
43-
test = true
44-
4538
[[test]]
4639
name = "test-mount"
4740
path = "test/test_mount.rs"

src/sys/mod.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,6 @@ pub mod sendfile;
2424
pub mod signal;
2525

2626
#[cfg(any(target_os = "linux", target_os = "android"))]
27-
#[cfg(feature = "signalfd")]
2827
pub mod signalfd;
2928

3029
pub mod socket;

test/test.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ extern crate nix_test as nixtest;
1111

1212
mod sys;
1313
mod test_fcntl;
14-
#[cfg(any(target_os = "linux"))]
14+
#[cfg(target_os = "linux")]
1515
mod test_mq;
1616
mod test_net;
1717
mod test_nix_path;
@@ -20,6 +20,8 @@ mod test_poll;
2020
mod test_pty;
2121
#[cfg(any(target_os = "linux", target_os = "android"))]
2222
mod test_sendfile;
23+
#[cfg(target_os = "linux")]
24+
mod test_signalfd;
2325
mod test_stat;
2426
mod test_unistd;
2527

test/test_signalfd.rs

Lines changed: 9 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,12 @@
1-
extern crate nix;
2-
3-
#[cfg(feature = "signalfd")]
4-
use nix::sys::signalfd::SignalFd;
5-
#[cfg(feature = "signalfd")]
6-
use nix::sys::signal;
7-
#[cfg(feature = "signalfd")]
8-
use nix::unistd;
9-
10-
#[cfg(feature = "signalfd")]
11-
fn main() {
12-
print!("test test_signalfd ... ");
1+
#[cfg(target_os = "linux")]
2+
#[test]
3+
fn test_signalfd() {
4+
use nix::sys::signalfd::SignalFd;
5+
use nix::sys::signal;
6+
use nix::unistd;
137

148
let mut mask = signal::SigSet::empty();
15-
mask.add(signal::SIGUSR1).unwrap();
9+
mask.add(signal::SIGUSR1);
1610
mask.thread_block().unwrap();
1711

1812
let mut fd = SignalFd::new(&mask).unwrap();
@@ -22,9 +16,6 @@ fn main() {
2216

2317
let res = fd.read_signal();
2418

25-
assert_eq!(res.unwrap().unwrap().ssi_signo as i32, signal::SIGUSR1);
26-
println!("ok");
19+
let signo = signal::Signal::from_c_int(res.unwrap().unwrap().ssi_signo as i32).unwrap();
20+
assert_eq!(signo, signal::SIGUSR1);
2721
}
28-
29-
#[cfg(not(feature = "signalfd"))]
30-
fn main() {}

0 commit comments

Comments
 (0)