summaryrefslogtreecommitdiff
path: root/src/sys/epoll.rs
AgeCommit message (Collapse)Author
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
2020-05-31Convert the crate to edition 2018Alan Somers
2020-05-16Apply `repr(transparent)` to several FFI typesAlan Somers
repr(transparent) is required in order to safely cast between an FFI type and its NewType. This commit applies that attribute to PollFd, EpollEvent, IpMembershipRequest, Ipv6MembershipRequest, TimeVal, and IoVec. Fixes #1241
2019-06-09Add extra traits for all typesBryant Mairs
Derive Clone, Copy, Eq, Hash, and PartialEq for all types. Not all traits are supported by all types, which is why many are missing some.
2018-01-28Require Debug impls for all typesBryant Mairs
2018-01-28Deny unused qualificationsBryant Mairs
2017-12-10Add more derives for SignalFd and various enumsBryant Mairs
2017-12-04Stop reexporting `Errno` and its variantsJonas Schievink
cc #664 (unsure if this is everything needed)
2017-12-01Fix UB in epoll_ctlBryant Mairs
When passing None as an argument to `epoll_ctl`, UB is elicited within the `Into<&EpollEvent>` impl because it passes a null pointer as a `&mut EpollEvent`. Instead we remove that implementation completely and handle this case directly within the `epoll_ctl` function. Thanks to Arnavion for helping to debug this.
2017-08-16Replace ffi constants with libc in epollBryant Mairs
2017-08-16Match libc_bitflags! syntax to upstream bitflags!Bryant Mairs
2017-02-25Remove EPOLLWAKEUP and SIGEV_THREAD_ID when cross-compiling to MIPS.Johan Anderholm
2017-02-25epoll: Use libc_bitflags for EpollFlagsKamal Marhubi
This is possible now that EPOLLEXCLUSIVE was added to libc in https://github.com/rust-lang/libc/pull/526
2017-02-22Fix the inner type of EpollFlagsMathias Svensson
2017-02-19Fix the style for bitflags!Mathias Svensson
Prefer libc_bitflags! over bitflags!. Prefer libc::CONSTANTS over writing the constant manually.
2017-02-16Update bitflags to 0.7Simon Sapin
2016-12-19fix all and update CHANGELOG.mdqupeng
2016-12-12EpollEvent::empty(): using mem::zeroed instead of mem::uninitialized.qupeng
2016-12-12epoll: improve EpollEvent::empty() by using mem::uninitialized.qupeng
2016-12-11fix EpollEvent::empty()qupeng
2016-12-11add empty() in EpollEvent.qupeng
2016-12-11fix #480 and add simple test cases for that.qupeng
r? @fiveop
2016-09-15Rename EpollEventKind to EpollFlags, according to convention.Philipp Matthias Schaefer
2016-09-15Add EpollCrateFlags bitflag type.Philipp Matthias Schaefer
2016-09-08Add property readers to EpollEventPhilipp Matthias Schaefer
2016-09-08Readd EpollEventPhilipp Matthias Schaefer
2016-09-08Use libc's declarationsHiroki Noda
2016-09-08Not to set EPOLL_CLOEXEC by default.Hiroki Noda
2016-09-08Add epoll_create1 and set EPOLL_CLOEXEC flag by default.Hiroki Noda
2016-03-28epoll: Add EPOLLEXCLUSIVE flag.kubo39
EPOLLEXCLUSIVE flag is available in Linux4.5.
2016-01-28Move errno::Result back to crate rootarcnmx
2016-01-28Errno::result()arcnmx
2015-09-03Fix the struct packing of EpollEventAlex Gulyás
2015-08-12Update some stuff for upstream bitflags changesCorey Richardson
2015-07-20Derive Clone for EpollEvent on android.Carl Lerche
Fixes #165
2015-05-28Remove std::os::unix::io::RawFd re-exportCarl Lerche
2015-05-24Change epoll_wait to use isize timeout_ms.Cole Reynolds
A timeout of -1 makes epoll block indefinitely, a usize timeout means we can't specify this behavior; using isize fixes this.
2015-04-03'derive(Copy)' needs Clone nowFlorian Hartwig
2015-03-24NixResult -> nix::Result; NixError -> nix::ErrorCarl Lerche
2015-03-13Amend some files to make it compile on arm-linux-androideabi.kennytm
2015-02-10Add `NixPath`, `NixError`, and `NixResult`.Utkarsh Kukreti
2015-01-27Fix warnings for `rustc 1.0.0-dev (e365e4c05 2015-01-27 08:40:39)`.Utkarsh Kukreti
2015-01-13changed uint and int to usize and isize respectivelyRick Richardson
2015-01-04Fix a few remaining deprecation noticesCarl Lerche
2014-12-18Add all now needed ';' after macro invocations.Victor Berger
2014-12-15bitflags! derives Copy for you now, so remove our derivings.Jonathan Reem
2014-12-10Fallout of Copy becoming opt-in.Victor Berger
2014-12-10Fix improper_ctypes warnings.Victor Berger
2014-10-10Update static->constTilde Engineering
2014-09-14EpollEvent is a packed structCarl Lerche