summaryrefslogtreecommitdiff
path: root/test
AgeCommit message (Collapse)Author
2018-06-01Remove tests that weren't mineBryant Mairs
2018-06-01Remove emulation of FD_CLOEXEC/O_NONBLOCKBryant Mairs
Rather than using the native implementation of these constants on supported platforms, the native implementation was instead emulated. This was also hidden from the user even though this could result in data races and the functionality being broken. Native functionality is, however, not support on macos/ios. Rather than enable this emulation solely for this platform, it should be removed as this is a dangerous abstraction.
2018-05-28Implement sendfile on FreeBSD and DarwinAndrew Morrow
2018-04-28select: add pselect syscallAndreas Fuchs
This is a straight port of @abbradar's work in #276, with two (somewhat weak) tests and a bit of documentation.
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.
2018-04-10Implement equivalent for _IOWINT for FreeBSD-like targetsBryant Mairs
ioctls on FreeBSD and DragonflyBSD have a separate request code generation macro `_IOWINT` which is now exposed as `request_code_write_int`. `ioctl_write_int` is also fixed on these platforms to use this new request
2018-04-10Refactor the ioctl API and documentationBryant Mairs
* Split `ioctl!` into separate macros. This makes documentation easier to read. * For every `ioctl_*!` macro include a description of the macro arguments as, the function prototype for the generated wrapper function, and an example if we have one. * Expose `request_code_*!` in the documentation to make the `ioctl_*_bad` macros easier to use. * Reorganize the file hierarchy to be simpler
2018-04-07Merge #872bors[bot]
872: Change sys::aio::lio_listio to sys::aio::LioCb::listio r=asomers a=asomers The new LioCb structure allows us to control the exact arguments passed to lio_listio, guaranteeing that each call gets a unique storage location for the list argument. This prevents clients from misusing lio_listio in a way that causes events to get dropped from a kqueue Fixes #870
2018-04-06Add LioCb::listio_resubmitAlan Somers
It helps deal with errors like EAGAIN, which can result in a subset of an LioCb's operations being queued. The test is only enabled on FreeBSD, because it requires intimate knowledge of AIO system limits.
2018-03-23Add fchmod, fchmodat functions.Anton Ageev
2018-03-22Replace AioCb::from_bytes with more generic from_boxed_sliceAlan Somers
Supporting the bytes crate was unnecessarily specific. This change replaces from_bytes and from_bytes_mut with from_boxed_slice and from_boxed_mut_slice, which can work with anything that implements Borrow<[u8]> and BorrowMut<[u8]>, respectively.
2018-03-22Change sys::aio::lio_listio to sys::aio::LioCb::listioAlan Somers
The new LioCb structure allows us to control the exact arguments passed to lio_listio, guaranteeing that each call gets a unique storage location for the list argument. This prevents clients from misusing lio_listio in a way that causes events to get dropped from a kqueue Fixes #870
2018-03-02Change SigAction::flags to use from_bits_truncatedAntti Keränen
On Linux, if the signal trampoline code is in the C library, sigaction sets the SA_RESTORER flag (0x04000000) in the sa_flags field of old sigaction (see sigreturn(2)). This is not intended for application use and is missing from SaFlags, therefore from_bits fails and unwrapping panics the user program. This fix just drops the bits that are not defined in SaFlags.
2018-02-06Merge #851bors[bot]
851: Added `getsid` in `::nix::unistd` r=asomers a=ggriffiniii Resolves Issue #850
2018-02-05Add test for getsid.Glenn Griffin
2018-02-02Add alarm moduleThomas de Zeeuw
This module has two functions; set: set an alarm, and cancel: cancels a previously set alarm.
2018-01-25Support arbitrary baud rates on BSDsBryant Mairs
2018-01-21Merge #820bors[bot]
820: Change AioCb to primarily use Bytes instead of Rc<[u8]> r=Susurrus a=asomers `Rc<[u8]>` isn't a very good buffer type to use for aio. For one thing, it lacks interior mutability. For another, a single `Rc<[u8]>` can't be carved up into smaller buffers of the same type. `Bytes` and `BytesMut` fix both problems. This PR removes the ability to construct an `AioCb` from `Rc<[u8]>` and adds the ability to construct one from `Bytes`, `BytesMut`, or raw pointers (for consumers who need even more flexibility). At this stage, the PR has the following warts: 1. A hack is necessary to force small `Bytes` buffers to allocate on the heap. I plan to fix this with an enhancement to the bytes crate. 2. The `AioCb::buffer` method is necessary due to a deficiency in the tokio-core crate. Once I fix that, then only `AioCb::into_buffer`will need to be public.
2018-01-15aio: more documentationAlan Somers
2018-01-15aio: Clippy cleanupAlan Somers
2018-01-15aio: use `Bytes` instead of `Rc<[u8]>`Alan Somers
It's not actually safe to read into an `Rc<[u8]>`. It only worked because of a coincidental `unsafe` block. Replace that type with `BytesMut` from the bytes crate. For consistency's sake, use `Bytes` for writing too, and completely remove methods relating to `Rc<[u8]>`. Note that the `AioCb` will actually own the `BytesMut` object. The caller must call `into_buffer` to get it back once the I/O is complete. Fixes #788
2018-01-15Add AioCb::from_ptr and AioCb::from_mut_ptrAlan Somers
2018-01-11Remove return value from `pause`Thomas de Zeeuw
`pause` will always return `-1` as a result and sets `errno` to `EINTR`, which indicates that a signal was caught by the process. Since this is the point of `pause` return an error here makes little sense. Closes #827.
2018-01-10Expose mqueue functions for all supported OSesAlan Somers
2018-01-06Add sigprocmaskThomas de Zeeuw
2017-12-20Remove uses of .iter()/.iter_mut()Bryant Mairs
More Rusty to use &X and &mut X where X is a container type.
2017-12-20Remove match statements with one armBryant Mairs
2017-12-20Use '!' instead of '== false'Bryant Mairs
Reads a little bit easier
2017-12-20Remove unnecessary mutBryant Mairs
2017-12-20Correct ioctl read and write_ptr testsBryant Mairs
Looks like a copy/paste error might have caused this
2017-12-20Remove useless Err(_) match armsBryant Mairs
2017-12-20Use Rc::clone() instead of .clone()Bryant Mairs
Makes it more clear what's being cloned
2017-12-20Remove unnecessary referencesBryant Mairs
2017-12-20Use println!() instead of print!(...n)Bryant Mairs
2017-12-20Make numeric literals easier to readBryant Mairs
2017-12-20Remove unnecessary .ok()Bryant Mairs
2017-12-20Use iter::Cloned() instead of closureBryant Mairs
2017-12-20Remove 'static from variablesBryant Mairs
It's unclear why these were static in the first place.
2017-12-20Remove elided 'static lifetimeBryant Mairs
As of Rust 1.17 'static lifetimes are implied when declaring consts.
2017-12-20Remove useless vec![]Bryant Mairs
2017-12-20Add backticks to types in doccommentsBryant Mairs
2017-12-20Use byte strings instead of String.as_bytes()Bryant Mairs
A little easier to read
2017-12-20Use write_all instead of writeBryant Mairs
Several tests make the assumption that all data is written, which is not guaranteed with write(), so use write_all() instead.
2017-12-19Merge #799bors[bot]
799: Fix nix on Dragonfly r=Susurrus a=mneumann This commit replaces pull request https://github.com/nix-rust/nix/pull/684. It fixes building `nix` on DragonFly. All tests pass. This requires most recent libc to build: https://github.com/rust-lang/libc/pull/851.
2017-12-19Fix support for DragonFlyMichael Neumann
* DragonFly does not have a O_DSYNC flag * Fix type_of_cmsg_data on DragonFly * No fexecve() on DragonFly * Do not run aio test cases on DragonFly * Keep target lists in alphabetical order * Unscrable #[cfg] directives and use cfg_if! macro instead * Fix errno on DragonFly Below follows an explanation why we have to use a C extension to get errno working on DragonFly: DragonFly uses a thread-local errno variable, but #[thread_local] is feature-gated and not available in stable Rust as of this writing (Rust 1.21.0). We have to use a C extension (src/errno_dragonfly.c) to access it. Tracking issue for `thread_local` stabilization: https://github.com/rust-lang/rust/issues/29594 Once this becomes stable, we can remove build.rs, src/errno_dragonfly.c, remove the build-dependency from Cargo.toml, and use: extern { #[thread_local] static errno: c_int; } Now all targets will use the build.rs script, but only on DragonFly this will do something. Also, there are no additional dependencies for targets other than DragonFly (no gcc dep).
2017-12-09Merge #741bors[bot]
741: Expose `decode` on `WaitStatus` and make it return a `Result` r=Susurrus a=rocallahan Closes #740.
2017-12-08Merge #807bors[bot]
807: Switch to libc definitons of errno constants r=Susurrus a=Susurrus Still need to do OpenBSD and NetBSD. Primary goal with this first pass is to see what doesn't exist properly in `libc`. Closes #487.
2017-12-08Merge #777bors[bot]
777: Use the real pipe2(2) on most targets r=asomers a=asomers FreeBSD added pipe2(2) in version 10.0.
2017-12-07Use the real pipe2(2) on all BSD targets.Alan Somers
All supported non-Apple platforms now use the native syscall. Only ios and macos lack it. Deprecate pipe2 on those platforms, because it's impossible to guarantee atomicity with a userland implementation. It was added in: * DragonflyBSD 4.2 * FreeBSD 10.0 * NetBSD 6.0 * OpenBSD 5.7
2017-12-05Remove nix-test subcrateBryant Mairs
This was doing testing for errno constants and a few other types that is no longer necessary now that these types are all tested within the libc project itself.