Skip to content

Commit 54af29b

Browse files
committed
Add ppoll()
1 parent 2bb718c commit 54af29b

File tree

2 files changed

+16
-0
lines changed

2 files changed

+16
-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

+14
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,14 @@ pub fn poll(fds: &mut [PollFd], timeout: libc::c_int) -> Result<libc::c_int> {
4750

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

0 commit comments

Comments
 (0)