summaryrefslogtreecommitdiff
path: root/test/sys
AgeCommit message (Collapse)Author
2017-12-20Add backticks to types in doccommentsBryant Mairs
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-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-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-08Add process_vm_readv and process_vm_writevGeoffrey Thomas
2017-10-07Merge #773bors[bot]
773: Add more accessors for AioCb r=asomers a=asomers
2017-10-05Fix variable does not need to be mutable warning for aio testSanchayan Maity
This fixes the following warning during run of cargo test warning: variable does not need to be mutable --> test/sys/test_aio.rs:16:13 | 16 | fn poll_aio(mut aiocb: &mut AioCb) -> Result<()> { | ^^^^^^^^^ | = note: #[warn(unused_mut)] on by default
2017-10-02Add more accessors for AioCbAlan Somers
2017-09-03Fixed error handling in `AioCb::{fsync,read,write}`Alan Somers
Previously, the `AioCb`'s `in_progress` field would erroneously be set to `true`, even if the syscall had an error Fixes #714
2017-09-03AioCb::Drop will now panic for in-progress AioCbAlan Somers
Printing a warning message to stderr isn't really appropriate, because there's no way to guarantee that stderr is even valid. Nor is aio_suspend necessarily an appropriate action to take.
2017-09-03Merge #746bors[bot]
746: Replace socket FFI with libc versions r=asomers a=Susurrus Getting this up there to get some CI run on it. Replacing the `msghdr`, `cmsghdr`, and other FFI function declarations will be a little more involved so I wanted to run this through first.
2017-08-30Merge #745bors[bot]
745: Use upstream libc definitions for fcntl FFI r=asomers a=Susurrus
2017-08-29Use upstream libc definitions for fcntl FFIBryant Mairs
2017-08-28Moved ptrace constants into enum types added minor functionality.xd009642
Used the libc_enum! macro to create enums for the ptrace event, request, and libc_bitflags for options constants defined in libc. Also, replicated functionality to move from c_int to PtraceEvent enum in PR #728 as it appears to be abandoned. Added utility function for detaching from tracee. Updated names and removed ptrace::ptrace namespace
2017-08-26Fix unused variable in testsBryant Mairs
2017-08-17Merge #700bors[bot]
700: Get rid of a lot of transmutes r=asomers Most could be replaced by simple raw pointer casts (or even perfectly safe coercions!). cc #373
2017-08-11Merge #701bors[bot]
701: Calculate `nfds` parameter for `select` r=asomers Doing this behind the scenes makes the API less error-prone and easier to use. It should also fix my issue in https://github.com/nix-rust/nix/issues/679#issuecomment-316838148
2017-08-11Get rid of a lot of transmutesJonas Schievink
Most could be replaced by simple raw pointer casts (or even perfectly safe coercions!). cc #373
2017-08-11Calculate `nfds` parameter for `select`Jonas Schievink
Doing this behind the scenes makes the API less error-prone and easier to use. It should also fix https://github.com/nix-rust/nix/issues/679#issuecomment-316838148
2017-08-10Merge remote-tracking branch 'upstream/master' into ptrace-noregMarcin Mielniczuk
2017-08-08Add a convenience method .pid() to WaitStatus.Marcin Mielniczuk
2017-08-03Merge remote-tracking branch 'upstream/master' into ptrace-noregMarcin Mielniczuk
2017-08-02Reword the comment.Marcin Mielniczuk
2017-08-01add SockProtocol type for third argument of socket and socketpairNicolas Dusart
2017-07-31Extra docMarcin Mielniczuk
2017-07-31Add a line break.Marcin Mielniczuk
2017-07-31Possibly fix tests failing on qemu architectures.Marcin Mielniczuk
2017-07-31Add tests for ptrace::contMarcin Mielniczuk
2017-07-31support delivering a signal with ptrace::contMarcin Mielniczuk
2017-07-26Mark nix::sys::ptrace::ptrace as unsafe, add safe variants of source routines.Marcin Mielniczuk
These include: * PTRACE_TRACEME * PTRACE_CONT * PTRACE_ATTACH * PTRACE_SYSCALL
2017-07-25Remove the TODO comments, add unwrap() for ptrace.Marcin Mielniczuk
2017-07-25Fix the tests compilingMarcin Mielniczuk
2017-07-25Disable failing tests on mips64Bryant Mairs
These are assumed to be QEMU issues, as they also fail on mips.
2017-07-25Replace remaining process::exit with libc::_exitJonas Schievink
Note that ptrace isn't documented as signal-safe, but it's supposed to just be a light syscall wrapper, so it should be fine.
2017-07-25Document invariants of fork and fix testsJonas Schievink
Some tests were invoking non-async-signal-safe functions from the child process after a `fork`. Since they might be invoked in parallel, this could lead to problems.
2017-07-25Allow doc attributes in ioctl macroroblabla
2017-07-25Add WaitStatus::PtraceSyscall for use with PTRACE_O_TRACESYSGOODGeoffrey Thomas
The recommended way to trace syscalls with ptrace is to set the PTRACE_O_TRACESYSGOOD option, to distinguish syscall stops from receiving an actual SIGTRAP. In C, this would cause WSTOPSIG to return SIGTRAP | 0x80, but nix wants to parse that as an actual signal. Add another wait status type for syscall stops (in the language of the ptrace(2) manpage, "PTRACE_EVENT stops" and "Syscall-stops" are different things), and mask out bit 0x80 from signals before trying to parse it. Closes #550
2017-07-25Add tests of actual ioctl usageBryant Mairs
2017-07-25fix some tests for AndroidNicolas Dusart
2017-07-25Fix thread safety issues in pty and termios testsAlan Somers
ptsname(3) returns a pointer to a global variable, so it isn't thread-safe. Protect it with a mutex.
2017-07-25Refactor ioctl! for buffersBryant Mairs
Instead of relying on the macro user to calculate the length in bytes do that within the macro itself
2017-07-25Add 'bad' prefixes for read, write_*, and readwrite ioctlsBryant Mairs
2017-07-25Split ioctl!(write ...) into write_ptr and write_intBryant Mairs
There two different write semantics used with ioctls: one involves passing a pointer the other involves passing an int. Previously the ioctl! macro did not distinguish between these cases and left it up to the user to set the proper datatype. This previous version was not type safe and prone to errors. The solution here is to split the "write" variant into a "write_ptr" and "write_int" variant that makes the semantics more explicit and improves type safety by specifying arguments better.
2017-07-25Add a "bad none" variant to the ioctl macroBryant Mairs
2017-07-25Re-add bad variant of ioctl!Bryant Mairs