summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorBryant Mairs <bryant@mai.rs>2017-07-16 21:25:50 -0700
committerBryant Mairs <bryant@mai.rs>2017-07-18 13:04:31 -0700
commit74ea3c7220e616ada07544d9d82d39acd12c2588 (patch)
tree9b3937d78e34e05e4acd1866e69251ec83794c77 /src
parent79ad5fa487d3d746aa3d03dc70bb133b96053d40 (diff)
downloadnix-74ea3c7220e616ada07544d9d82d39acd12c2588.zip
Remove signalfd feature in favor of conditional compilation
Note that this is now only available for Linux as support is missing in libc for Android (see rust-lang/libc#671). As part of this work the SIGUSR2 signal mutex was altered to be a general signal mutex. This is because all signal handling is shared across all threads in the Rust test harness, so if you alter one signal, depending on whether it's additive or may overwrite the mask for other signals, it could break the other ones. Instead of putting this on the user, just broaden the scope of the mutex so that any altering of signal handling needs to use it.
Diffstat (limited to 'src')
-rw-r--r--src/sys/mod.rs4
-rw-r--r--src/sys/signalfd.rs10
2 files changed, 5 insertions, 9 deletions
diff --git a/src/sys/mod.rs b/src/sys/mod.rs
index 796a00a1..9636f93d 100644
--- a/src/sys/mod.rs
+++ b/src/sys/mod.rs
@@ -23,8 +23,8 @@ pub mod sendfile;
pub mod signal;
-#[cfg(any(target_os = "linux", target_os = "android"))]
-#[cfg(feature = "signalfd")]
+// FIXME: Add to Android once libc#671 lands in a release
+#[cfg(target_os = "linux")]
pub mod signalfd;
pub mod socket;
diff --git a/src/sys/signalfd.rs b/src/sys/signalfd.rs
index a3dfb6be..fcf2efa9 100644
--- a/src/sys/signalfd.rs
+++ b/src/sys/signalfd.rs
@@ -60,12 +60,10 @@ pub fn signalfd(fd: RawFd, mask: &SigSet, flags: SfdFlags) -> Result<RawFd> {
/// # Examples
///
/// ```
-/// use nix::sys::signalfd::*;
-///
+/// # use nix::sys::signalfd::*;
+/// // Set the thread to block the SIGUSR1 signal, otherwise the default handler will be used
/// let mut mask = SigSet::empty();
-/// mask.add(signal::SIGUSR1).unwrap();
-///
-/// // Block the signal, otherwise the default handler will be invoked instead.
+/// mask.add(signal::SIGUSR1);
/// mask.thread_block().unwrap();
///
/// // Signals are queued up on the file descriptor
@@ -74,11 +72,9 @@ pub fn signalfd(fd: RawFd, mask: &SigSet, flags: SfdFlags) -> Result<RawFd> {
/// match sfd.read_signal() {
/// // we caught a signal
/// Ok(Some(sig)) => (),
-///
/// // there were no signals waiting (only happens when the SFD_NONBLOCK flag is set,
/// // otherwise the read_signal call blocks)
/// Ok(None) => (),
-///
/// Err(err) => (), // some error happend
/// }
/// ```