summaryrefslogtreecommitdiff
path: root/src/sys
diff options
context:
space:
mode:
authorbors[bot] <bors[bot]@users.noreply.github.com>2017-07-19 06:28:12 +0000
committerbors[bot] <bors[bot]@users.noreply.github.com>2017-07-19 06:28:12 +0000
commit07e6c2f5c2d2a95fcfcd509556c4d1441a91adfb (patch)
treee5ae497aac510dacc277c5decbca2c10d80f880b /src/sys
parent3d24ae9588ebad1e495bedc909a226c84662a4c2 (diff)
parentbee13c8c348324f7dabb5eed8d4be17be2c2efd2 (diff)
downloadnix-07e6c2f5c2d2a95fcfcd509556c4d1441a91adfb.zip
Merge #681
681: Remove feature flags r=Susurrus These are vestiges of the initial push to get this working on Rust 1.0. These feature flags are undocumented and so hard to discover (only learned about them today!), prevent functions being included that should be and this also affects documentation on docs.rs, and none of the features are tested in CI and the `execvpe` has been broken for forever. The solution is to conditionally compile everything supported for a given platform and do away completely with the feature flags. The `execvpe` function is completely removed as it's not available for *nix platforms in libc and is already broken, so no loss removing it. We'll add it back once it's back in libc (rust-lang/libc#670). Closes #98. Closes #206. Closes #306. Closes #308.
Diffstat (limited to 'src/sys')
-rw-r--r--src/sys/mod.rs7
-rw-r--r--src/sys/signalfd.rs10
-rw-r--r--src/sys/uio.rs6
3 files changed, 9 insertions, 14 deletions
diff --git a/src/sys/mod.rs b/src/sys/mod.rs
index 627f7697..9636f93d 100644
--- a/src/sys/mod.rs
+++ b/src/sys/mod.rs
@@ -9,8 +9,7 @@ pub mod epoll;
target_os = "dragonfly", target_os = "openbsd", target_os = "netbsd"))]
pub mod event;
-// TODO: switch from feature flags to conditional builds
-#[cfg(feature = "eventfd")]
+#[cfg(target_os = "linux")]
pub mod eventfd;
#[cfg(target_os = "linux")]
@@ -24,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
/// }
/// ```
diff --git a/src/sys/uio.rs b/src/sys/uio.rs
index 5af10930..edca8cb4 100644
--- a/src/sys/uio.rs
+++ b/src/sys/uio.rs
@@ -18,7 +18,7 @@ pub fn readv(fd: RawFd, iov: &mut [IoVec<&mut [u8]>]) -> Result<usize> {
Errno::result(res).map(|r| r as usize)
}
-#[cfg(feature = "preadv_pwritev")]
+#[cfg(target_os = "linux")]
pub fn pwritev(fd: RawFd, iov: &[IoVec<&[u8]>],
offset: off_t) -> Result<usize> {
let res = unsafe {
@@ -28,7 +28,7 @@ pub fn pwritev(fd: RawFd, iov: &[IoVec<&[u8]>],
Errno::result(res).map(|r| r as usize)
}
-#[cfg(feature = "preadv_pwritev")]
+#[cfg(target_os = "linux")]
pub fn preadv(fd: RawFd, iov: &mut [IoVec<&mut [u8]>],
offset: off_t) -> Result<usize> {
let res = unsafe {
@@ -57,7 +57,7 @@ pub fn pread(fd: RawFd, buf: &mut [u8], offset: off_t) -> Result<usize>{
}
#[repr(C)]
-pub struct IoVec<T>(libc::iovec, PhantomData<T>);
+pub struct IoVec<T>(libc::iovec, PhantomData<T>);
impl<T> IoVec<T> {
#[inline]