Skip to content

Commit 5d4967e

Browse files
committed
Add ppoll()
1 parent 4c9e42f commit 5d4967e

File tree

2 files changed

+20
-0
lines changed

2 files changed

+20
-0
lines changed

CHANGELOG.md

+2
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,8 @@ This project adheres to [Semantic Versioning](http://semver.org/).
3939
([#508](https://github.com/nix-rust/nix/pull/508))
4040
- Fixed the style of many bitflags and use `libc` in more places.
4141
([#503](https://github.com/nix-rust/nix/pull/503))
42+
- Added `ppoll` in `::nix::poll`
43+
([#520](https://github.com/nix-rust/nix/pull/520))
4244

4345
### Changed
4446
- `epoll_ctl` now could accept None as argument `event`

src/poll.rs

+18
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
1+
#[cfg(any(target_os = "linux", target_os = "android"))]
2+
use sys::time::TimeSpec;
3+
#[cfg(any(target_os = "linux", target_os = "android"))]
4+
use sys::signal::SigSet;
5+
16
use libc;
27
use {Errno, Result};
38

@@ -47,3 +52,16 @@ pub fn poll(fds: &mut [PollFd], timeout: libc::c_int) -> Result<libc::c_int> {
4752

4853
Errno::result(res)
4954
}
55+
56+
#[cfg(any(target_os = "linux", target_os = "android"))]
57+
pub fn ppoll(fds: &mut [PollFd], timeout: TimeSpec, sigmask: SigSet) -> Result<libc::c_int> {
58+
59+
60+
let res = unsafe {
61+
libc::ppoll(fds.as_mut_ptr() as *mut libc::pollfd,
62+
fds.len() as libc::nfds_t,
63+
timeout.as_ref(),
64+
sigmask.as_ref())
65+
};
66+
Errno::result(res)
67+
}

0 commit comments

Comments
 (0)