summaryrefslogtreecommitdiff
path: root/src
AgeCommit message (Collapse)Author
2018-11-28Prefer `map(drop)` to `map(|_| ())`Alan Somers
I previously advocated for the latter syntax on stylistic grounds. But it generates less efficient code, because it creates a new lambda function for each usage. The optimizer does not combine them. This change saves about 6KB of code.
2018-11-27Merge #977bors[bot]
977: Error as i32 r=asomers a=asomers Add Error::as_errno This method is useful when it can be statically determined that a nix::Error be an errno, which I find to be very common. Also, fix some recently introduced compiler warnings. Co-authored-by: Alan Somers <asomers@gmail.com>
2018-11-27Merge #967bors[bot]
967: Add a wrapper for lutimes(2) r=asomers a=jmmv PR #944 added wrappers for the more-modern futimens(2) and utimesat(2), but unfortunately these APIs are not available on old-ish systems. In particular, macOS Sierra and below don't implement them, making the new APIs unusable. Whether we should care about such "old" systems is debatable, but the problem is that, at the moment, this is the only macOS version usable on Travis to test kexts and, thus, to test FUSE file systems. This should have been part of PR #946, which added a wrapper for utimes(2) following this same rationale, but missed lutimes(2) because I simply didn't notice it existed. Co-authored-by: Julio Merino <julio@meroh.net>
2018-11-23Add Error::as_errnoAlan Somers
This method is useful when it can be statically determined that a nix::Error be an errno, which I find to be very common.
2018-11-19Add execvpe support, conditional on platformF1rst-Unicorn
2018-11-09Add example for setsockoptPovilas Balciunas
Makes it easier for newcomers :)
2018-11-07Add a wrapper for lutimes(2)Julio Merino
PR #944 added wrappers for the more-modern futimens(2) and utimesat(2), but unfortunately these APIs are not available on old-ish systems. In particular, macOS Sierra and below don't implement them, making the new APIs unusable. Whether we should care about such "old" systems is debatable, but the problem is that, at the moment, this is the only macOS version usable on Travis to test kexts and, thus, to test FUSE file systems. This should have been part of PR #946, which added a wrapper for utimes(2) following this same rationale, but missed lutimes(2) because I simply didn't notice it existed.
2018-11-07Make sys::time::{time_t, suseconds_t} publicJulio Merino
This allows handling the return values of other public functions (such as TimeVal's tv_sec and tv_usec) without having to pull in these types from libc (which is ugly if a project is trying to use nix exclusively to avoid libc's unsafety).
2018-11-02Add sync (fix #959)Roey Darwish Dror
2018-10-28Removed Peek and poke user from unsupportedOpxd009642
2018-10-24Added AddressType typexd009642
This was added to the BSD ptrace API and probably should have been added to tyhe linux API to make it easier to write code for both platforms without the user having to reexport the types to their own crate.
2018-10-21Add acct(2) wrapper APIJosh Abraham
This patch adds a wrapper for the acct(2) syscall, with two functions for enabling and disabling process accounting.
2018-10-21Added ptrace support for BSDsxd009642
* Moved ptrace API into it's own module with cfg'ed modules exported for linux/android or BSDs. * Replicated current linux API for BSD * Added API functions to peek and poke memory to avoid needing to replicate deprecated linux API and remaining feature complete * Added helper function for `PTRACE_KILL` requests * Updated tests based on new API changes * Added addition kill calls to `test_ptrace_cont` as inferior death doesn't happen immediately on OSX which caused issues in the tests.
2018-10-19Add a fchownat(2) wrapperJulio Merino
2018-10-19Merge #956bors[bot]
956: Add a truncate(2) wrapper r=asomers a=jmmv This also adds a test for truncate (obviously) but, while doing so, also adds a test for the already-existing ftruncate. Co-authored-by: Julio Merino <julio@meroh.net>
2018-10-18Document ioctl_param_typeRukai
2018-10-17Add a truncate(2) wrapperJulio Merino
This also adds a test for truncate (obviously) but, while doing so, also adds a test for the already-existing ftruncate.
2018-10-16Make sys::stat::mode_t publicJulio Merino
This allows using e.g. sys::stat::Mode::from_bits() without having to pull the mode_t type from libc (which is ugly if a project is trying to use nix exclusively to avoid libc's unsafety). This change mimics dev_t which was already exposed as public.
2018-10-15socket: add AF_UNSPEC to AddressFamilyLevente Kurusa
Signed-off-by: Levente Kurusa <lkurusa@acm.org>
2018-10-09Fix #945 - documentation fixJosh Abraham
Correct references to user ids to group ids.
2018-10-02Add a wrapper for utimes(2)Julio Merino
PR #944 added wrappers for the more-modern futimens(2) and utimesat(2), but unfortunately these APIs are not available on old-ish systems. In particular, macOS Sierra and below don't implement them, making the new APIs unusable. Whether we should care about such "old" systems is debatable, but the problem is that, at the moment, this is the only macOS version usable on Travis to test kexts and, thus, to test FUSE file systems.
2018-09-29Add wrappers for futimens(2) and utimesat(2)Julio Merino
2018-09-05Add wrapper for linux kernel module loadingPascal Bach
- init_module and finit_module to load kernel modules - delete_module to unload kernel modules Signed-off-by: Pascal Bach <pascal.bach@nextrem.ch>
2018-09-05Replace allow unused directive with _ prefixPascal Bach
2018-09-05Merge #884bors[bot]
884: impl FromStr for sys::Signal r=Susurrus a=quodlibetor This implements both ALLCAPS and lowercase full name (including SIG) and short name. This matches what `kill` accepts in many shells, and it also allows the `Debug` representation of `Signal`, which means it can be round-tripped, if desired. Co-authored-by: Brandon W Maister <quodlibetor@gmail.com>
2018-09-04impl FromStr and Display for sys::SignalBrandon W Maister
This is a subset of what `kill` accepts in many shells. The Display implementation matches the `Debug` representation of `Signal`. The `FromStr` matches both Debug/Display which means it can be round-tripped, if desired.
2018-09-03new dir moduleScott Lamb
This is a lower-level interface than `std::fs::ReadDir`. Notable differences: * can be opened from a file descriptor (as returned by `openat`, perhaps before knowing if the path represents a file or directory). Uses `fdopendir` for this, available on all Unix platforms as of rust-lang/libc#1018. * implements `AsRawFd`, so it can be passed to `fstat`, `openat`, etc. * can be iterated through multiple times without closing and reopening the file descriptor. Each iteration rewinds when finished. * returns entries for `.` (current directory) and `..` (parent directory). * returns entries' names as a `CStr` (no allocation or conversion beyond whatever libc does).
2018-09-01deps: update tempfile to 3Igor Gnatenko
Signed-off-by: Igor Gnatenko <i.gnatenko.brain@gmail.com>
2018-08-15sendmsg: remove unneeded mutIgor Gnatenko
Signed-off-by: Igor Gnatenko <i.gnatenko.brain@gmail.com>
2018-07-27Fix *decoding* of cmsgs and add `ScmCredentials`.Jonas Schievink
2018-07-11Enable the select tests on powerpc and mipsJonas Schievink
They pass at least on my machine with QEMU, so the underlying bugs might have been fixed.
2018-07-05Merge #921bors[bot]
921: Get `SO_PEERCRED` working on all Linux targets r=asomers a=jonas-schievink These were disabled for ARM way back in 0db6ed1a28b4fb4d408cd9b7c4dba0a79bccf1f7 and 09c00ed7d9d92db2a79baa3ed212e7e239edceb9. Try to enable them for all arches and Android as well, since the removal wasn't really explained and I see no reason why this shouldn't work. Co-authored-by: Jonas Schievink <jonasschievink@gmail.com>
2018-07-05Merge #918bors[bot]
918: Fix passing multiple file descriptors / control messages via sendmsg r=asomers a=jonas-schievink Fixes #464 Closes #874 because it's incorporated here Closes #756 because it adds the test from that issue (with fixes) Co-authored-by: alecmocatta <alec@mocatta.net>
2018-07-05Get `SO_PEERCRED` working on all Linux targetsJonas Schievink
2018-07-04Add a sysinfo wrapperJonas Schievink
2018-07-04Clean up cmsg code and fix passing multiple cmsgsalecmocatta
2018-07-03Make preadv take immutable slice of IoVecs, fixes #913Jakub OkoĊ„ski
2018-06-03Fix compilation on aarch64-unknown-linux-muslBryant 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-05-28Fix bind() on Android 64-bitBryant Mairs
libc fixed `bind()` for Android 64-bit targets, so change our code to match.
2018-05-22TypoXavier Bestel
2018-05-06Merge #893bors[bot]
893: Remove IFF_NOTRAILERS for openbsd r=asomers a=kpcyrd nix currently doesn't compile on openbsd because `IFF_NOTRAILERS` isn't found. This PR fixes the openbsd build again (tested on 6.3). It seems it was changed in this commit: https://github.com/openbsd/src/commit/beb8b0dd5985e55a615b52e593da6e75bab33f3f Co-authored-by: kpcyrd <git@rxv.cc>
2018-05-05Add documentation to signal-handling functionsRoss Light
2018-05-02OpenBSD: remove IFF_NOTRAILERSkpcyrd
IFF_NOTRAILERS has been removed in OpenBSD 6.3 https://github.com/openbsd/src/commit/beb8b0dd5985e55a615b52e593da6e75bab33f3f
2018-04-29Merge #892bors[bot]
892: Fixed ptrace::Request cfg conditions r=asomers a=dalance The cfg condition of ptrace::Request seems to be different from libc. For example, PTRACE_GETREGS is defined by libc to i686-unknown-linux-gnu target, but it is not defined in ptrace::Request. I tried to change the cfg condition to the same as libc's condition. I thinks this change covers the definitions under src/unix/notbsd directory in libc repository. Co-authored-by: dalance <dalance@gmail.com>
2018-04-29Enabled more ptrace::Request definitions for uncommon Linux platformsdalance
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-18Support preadv/pwritev on BSDsAndrew Morrow