summaryrefslogtreecommitdiff
path: root/src/poll.rs
diff options
context:
space:
mode:
authorBryant Mairs <bryant@mai.rs>2017-02-23 15:27:11 -0800
committerBryant Mairs <bryant@mai.rs>2017-02-25 08:53:24 -0800
commit5d4967ee9af8b2feeffd18534eef433066ad36c5 (patch)
tree59a9f5aba89c7e32538401629fc232188da9a4c7 /src/poll.rs
parent4c9e42f0f776f1533f03e78af25f0efbf628fb88 (diff)
downloadnix-5d4967ee9af8b2feeffd18534eef433066ad36c5.zip
Add ppoll()
Diffstat (limited to 'src/poll.rs')
-rw-r--r--src/poll.rs18
1 files changed, 18 insertions, 0 deletions
diff --git a/src/poll.rs b/src/poll.rs
index 72988d8c..8a3de5f1 100644
--- a/src/poll.rs
+++ b/src/poll.rs
@@ -1,3 +1,8 @@
+#[cfg(any(target_os = "linux", target_os = "android"))]
+use sys::time::TimeSpec;
+#[cfg(any(target_os = "linux", target_os = "android"))]
+use sys::signal::SigSet;
+
use libc;
use {Errno, Result};
@@ -47,3 +52,16 @@ pub fn poll(fds: &mut [PollFd], timeout: libc::c_int) -> Result<libc::c_int> {
Errno::result(res)
}
+
+#[cfg(any(target_os = "linux", target_os = "android"))]
+pub fn ppoll(fds: &mut [PollFd], timeout: TimeSpec, sigmask: SigSet) -> Result<libc::c_int> {
+
+
+ let res = unsafe {
+ libc::ppoll(fds.as_mut_ptr() as *mut libc::pollfd,
+ fds.len() as libc::nfds_t,
+ timeout.as_ref(),
+ sigmask.as_ref())
+ };
+ Errno::result(res)
+}