Skip to content

Commit d4d790e

Browse files
committed
Auto merge of #520 - Susurrus:master, r=fiveop
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 4ab234c + 5d4967e commit d4d790e

File tree

2 files changed

+20
-0
lines changed

2 files changed

+20
-0
lines changed

CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,8 @@ This project adheres to [Semantic Versioning](http://semver.org/).
4141
([#508](https://github.com/nix-rust/nix/pull/508))
4242
- Fixed the style of many bitflags and use `libc` in more places.
4343
([#503](https://github.com/nix-rust/nix/pull/503))
44+
- Added `ppoll` in `::nix::poll`
45+
([#520](https://github.com/nix-rust/nix/pull/520))
4446

4547
### Changed
4648
- `::nix::sys::termios::{cfgetispeed, cfsetispeed, cfgetospeed, cfsetospeed}`

src/poll.rs

Lines changed: 18 additions & 0 deletions
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)