summaryrefslogtreecommitdiff
path: root/test
AgeCommit message (Collapse)Author
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.
2017-12-05Expose `from_raw` on `WaitStatus` and make it return a `Result`Robert O'Callahan
2017-12-04Stop reexporting `Errno` and its variantsJonas Schievink
cc #664 (unsure if this is everything needed)
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-11-19unistd: add execveat() on Linux and AndroidLuca Bruno
This adds execveat() to `nix::unistd`. It uses the execveat(2) Linux kernel syscall, which is available since 3.19. This is a Linux-specific extension which is not covered by POSIX and does not have any userland libc wrapper. Ref: http://man7.org/linux/man-pages/man2/execveat.2.html
2017-11-19sys/socket: add UnixAddr abstract name getterLuca Bruno
This introduces an `as_abstract()` getter to `UnixAddr` in order to retrieve the name of an abstract unix socket. This also adds tests around abstract addresses and clarify docs, adding explicit semantics.
2017-11-12unistd: groups: Respond to minor PR feedback itemsJamie Hewland
2017-11-12groups tests: Add groups mutex and print message when tests skippedJamie Hewland
Fix groups mutex name
2017-11-12test_unistd: Add test for getgrouplist/initgroups()Jamie Hewland
2017-11-12test_unistd: Add test for getgroups/setgroups()Jamie Hewland
2017-11-08Add process_vm_readv and process_vm_writevGeoffrey Thomas
2017-10-20Merge #780bors[bot]
780: Add a test for ppoll r=Susurrus a=asomers
2017-10-14Add a test for ppollAlan Somers