summaryrefslogtreecommitdiff
path: root/src/sys
AgeCommit message (Collapse)Author
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-10Refactor statvfs moduleBryant Mairs
* Use upstream libc FFI declarations and constants * Use more Rust-y interface of returning entire struct versus passing it as an argument to (f)statvfs. * Replace field accesses with accessor methods * Flatten vfs module into parent * Remove all non-libc-based interfaces for working with the statvfs struct
2017-08-09Merge #688bors[bot]
688: Support for OpenBSD r=Susurrus Fixes #685 These changes get nix building on OpenBSD 6.1. There is one failing test that I want a little guidance on: ``` error[E0308]: mismatched types --> src/sys/event.rs:333:30 | 333 | assert!(expected.data == actual.data()); | ^^^^^^^^^^^^^ expected i64, found isize ``` `KEvent::data` is: ``` pub fn data(&self) -> intptr_t { self.kevent.data as intptr_t } ``` I assume the test should be updated to cast to the expected type but wanted to confirm that before making the change.
2017-08-08Add a convenience method .pid() to WaitStatus.Marcin Mielniczuk
2017-08-05Correct access of cmsg ancillary data on first headerWesley Moore
Also updates cmsg types to match structs on non-Linux OSes. The implementation of CmsgInterator did not correctly mirror the way the CMSG_FIRSTHDR and CMSG_NEXTHDR macros work in C. CMSG_FIRSTHDR does not attempt to align access since the pointer is already aligned due to being part of the msghdr struct. CmsgInterator was always aligning access which happened to work on all platforms except OpenBSD where the use of alignment was adding unexpected bytes to the expected size and causing the `cmsg_align(cmsg_len) > self.buf.len()` guard clause to return early.
2017-08-05Fix tests on OpenBSDWesley Moore
There appears to be some interaction with test_pathconf_limited and another one when they are run in parallel, causing it to return ENOENT so the path has been changed from . to /.
2017-08-05Add OpenBSD compatibility to signalsWesley Moore
2017-08-05Add OpenBSD compatibility to eventsWesley Moore
2017-08-01Document AddressFamily and SockTypeNicolas Dusart
2017-08-01add SockProtocol type for third argument of socket and socketpairNicolas Dusart
2017-08-01Document `MsgFlags` constantsNicolas Dusart
2017-08-01add socket constants already present in libcNicolas Dusart
2017-08-01remove sys::sockets::consts module as it's libc goal to define themNicolas Dusart
2017-07-25Allow doc attributes in ioctl macroroblabla
2017-07-25Document WaitStatus and its variantsGeoffrey Thomas
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-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-25Unify argument names to generated ioctl functionsBryant Mairs
2017-07-25Remove unnecessary constantsBryant Mairs
2017-07-25Remove c_int and c_void from rootBryant Mairs
These were exported for some weird reason and then left in for documentation. Also some parts of certain modules used them and others used the libc:: prefix. This was removed to improve the docs and also code consistency
2017-07-25Use the proper ioctl number type depending on targetBryant Mairs
This also means that we need to properly mask off bits to the valid range of ioctl numbers.
2017-07-25Remove ioc_* functionsBryant Mairs
These are low-level functions that shouldn't be exposed
2017-07-25Revise ioctl module documentationBryant Mairs
This refactors the examples to more directly address the exact use cases for the `ioctl!` macro that `nix` provides. Additionally other macros that should not be used by end users are no longer discussed.
2017-07-25Remove unnecessary path aliasingBryant Mairs
2017-07-25Hide internal macros/types within ioctlBryant Mairs
2017-07-25Add a "bad none" variant to the ioctl macroBryant Mairs
2017-07-25Re-add bad variant of ioctl!Bryant Mairs
2017-07-25Remove old workaroundBryant Mairs
2017-07-20Rename the public ptrace_* functions.Marcin Mielniczuk
Unlike in C, we have namespacing in Rust. Renaming the functions allows us to avoid a `use nix::sys::ptrace::*` in favor of `use nix::sys::ptrace` and then calling, for example, `ptrace::traceme()`
2017-07-19Merge #681bors[bot]
681: Remove feature flags r=Susurrus These are vestiges of the initial push to get this working on Rust 1.0. These feature flags are undocumented and so hard to discover (only learned about them today!), prevent functions being included that should be and this also affects documentation on docs.rs, and none of the features are tested in CI and the `execvpe` has been broken for forever. The solution is to conditionally compile everything supported for a given platform and do away completely with the feature flags. The `execvpe` function is completely removed as it's not available for *nix platforms in libc and is already broken, so no loss removing it. We'll add it back once it's back in libc (rust-lang/libc#670). Closes #98. Closes #206. Closes #306. Closes #308.
2017-07-18Remove signalfd feature in favor of conditional compilationBryant Mairs
Note that this is now only available for Linux as support is missing in libc for Android (see rust-lang/libc#671). As part of this work the SIGUSR2 signal mutex was altered to be a general signal mutex. This is because all signal handling is shared across all threads in the Rust test harness, so if you alter one signal, depending on whether it's additive or may overwrite the mask for other signals, it could break the other ones. Instead of putting this on the user, just broaden the scope of the mutex so that any altering of signal handling needs to use it.
2017-07-17Remove preadv_pwritev feature in favor of conditional includeBryant Mairs
2017-07-17Remove eventfd feature in favor of conditional includeBryant Mairs
2017-07-17Refactor ptrace_get_dataBryant Mairs
The boxing and unboxing was unnecessary and instead the references to the type on the stack can just be cast.
2017-07-17Fix UnsupportedOperation when using ptrace_* functionsBryant Mairs
2017-07-10Enable termios on iOS and move it to Tier 2Bryant Mairs
2017-07-10Add tcgetsid()Bryant Mairs
2017-07-10Add cfmakeraw and cfsetspeedBryant Mairs
2017-07-10Use libc types for termiosBryant Mairs
This also removes the incorrect TCSASOFT definition as an enum type because it's actually a bitfield.
2017-07-10Fix sendmsg on macOS when passing a zero entry cmsgs array.Matthew Gregan
2017-07-10Simplify Vec allocation in sendmsg after 077d979a removed alignment hacks.Matthew Gregan
2017-07-09Merge #624bors[bot]
624: Enable ptrace on all Linux platforms r=Susurrus Nothing that nix currently binds is architecture-specific, and Android supports ptrace just as much as non-Android Linux.
2017-07-08Support syscalls on mips64Bryant Mairs
2017-07-08Enable syscalls on s390xBryant Mairs
2017-07-08SIGSTKFLT doesn't exist on Linux/GNU/mips(64)Bryant Mairs
2017-07-08Enable ioctl on mips64 and s390xBryant Mairs
2017-07-08Enable ptrace on all Linux platformsGeoffrey Thomas
Nothing that nix currently binds is architecture-specific, and Android supports ptrace just as much as non-Android Linux.
2017-07-07sys/statfs: use statfs from libcJörg Thalheim
the previous definition were linux specific.