summaryrefslogtreecommitdiff
path: root/test/test_poll.rs
AgeCommit message (Collapse)Author
2021-09-07Implement AsRawFd for PollFdConrad Meyer
Implement the trait on PollFd, providing an `as_raw_fd()` accessor to get the RawFd associated with the PollFd. Subsumes #1147, #1286. Closes #1146. Test: `cargo test --test test test_pollfd_fd`
2021-07-07Collapse Error into ErrnoAlan Somers
Now that Nix's weird error types are eliminated, there's no reason not to simply use Errno as the Error type.
2021-07-07Overhaul Nix's error typesAlan Somers
For many of Nix's consumers it be convenient to easily convert a Nix error into a std::io::Error. That's currently not possible because of the InvalidPath, InvalidUtf8, and UnsupportedOperation types that have no equivalent in std::io::Error. However, very few of Nix's public APIs actually return those unusual errors. So a more useful API would be for Nix's standard error type to implement Into<std::io::Error>. This commit makes Error a simple NewType around Errno. For most functions it's a drop-in replacement. There are only three exceptions: * clearenv now returns a bespoke error type. It was the only Nix function whose error couldn't be cleanly mapped onto an Errno. * sys::signal::signal now returns Error(Errno::ENOTSUP) instead of Error::UnsupportedOperation when the user passes an incompatible argument to `handler`. * When a NixPath exceeds PATH_MAX, it will now return Error(Errno::ENAMETOOLONG) instead of Error::InvalidPath. In the latter two cases there is now some abiguity about whether the error code was generated by Nix or by the OS. But I think the ambiguity is worth it for the sake of being able to implement Into<io::Error>. This commit also introduces Error::Sys() as a migration aid. Previously that as an enum variant. Now it's a function, but it will work in many of the same contexts as the original. Fixes #1155
2021-02-20Fix a non_fmt_panic warning with Rustc 1.52.0Alan Somers
2020-12-06Make the poll tests resilient against signalsAlan Somers
When run in Cirrus-CI's environment, the tests generate copious SIGRT_1 signals. This commit ensures that the poll tests will retry on EINTR.
2020-07-26Support nullable timeout in ppollMikail Bagishov
2019-06-09Remove test of impl Debug for PollFdBryant Mairs
As this is now derived, having a test is unnecessary
2019-02-12`PollFd` event flags renamed to `PollFlags` from `EventFlags`.Amanjeev Sethi
Most of the EventFlags have been renamed already, but Poll was the only one remaining. This commit fixes that. Issue 317 https://github.com/nix-rust/nix/issues/317
2018-12-16Allow 'cargo test' to complete successfully on NetBSD 8.0.Tom Pusateri
Some tests have been disabled and will need further review.
2018-04-19Implement Debug trait for PollFdZhouyu Qian
This is useful when using printf-style debugging to observe the variables of the program. Also includes a test. Fixes #885.
2017-12-02Upgrade to Bitflags 1.0Bryant Mairs
The libc_bitflags! macro was replaced with a non-recursive one supporting only public structs. I could not figure out how to make the old macro work with the upgrade, so I reworked part of the bitflags! macro directly to suit our needs, much as the original recursive macro was made. There are no uses of this macro for non-public structs, so this is not a problem for internal code.
2017-10-14Add a test for ppollAlan Somers
2017-03-02Remove revents from PollFd::newBryant Mairs
revents is an output field so regardless of what value it is set to it will be overwritten by many of the function calls that take a PollFd. The only value that makes sense for the caller to pass in in `EventFlags::empty()` so we just hardcode that instead of making the caller do it.
2016-08-31Use libc in poll.rsPhilipp Matthias Schaefer
2016-01-25Add everything from poll.h.Utkarsh Kukreti