Skip to content

Commit f46c1c5

Browse files
committed
Auto merge of #520 - Susurrus:master, r=kamalmarhubi
Add ppoll() This will currently fail CI, as the necessary changes haven't hit libc yet. That is tracked in rust-lang/libc#537. This does build on my computer using the changes tracked on that PR, so I'd appreciate any visual review of this code as it should be "done". I also wanted to get this submitted so hopefully it'd be in the queue for the 0.8 release.
2 parents c3905ee + c96d818 commit f46c1c5

File tree

2 files changed

+17
-0
lines changed

2 files changed

+17
-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` for Linux and Android
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

+15
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
use sys::time::TimeSpec;
2+
use sys::signal::SigSet;
3+
14
use libc;
25
use {Errno, Result};
36

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

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

0 commit comments

Comments
 (0)