summaryrefslogtreecommitdiff
path: root/src
AgeCommit message (Collapse)Author
2019-03-03Reenable test_sigwait on OSXAlan Somers
It was disabled long ago and nobody remembered to reenable it. I'm guessing it's fixed by now.
2019-03-03Delete a useless unit test that never did anything.Alan Somers
2019-03-03Fix test_thread_signal* test failures with Cargo 1.33.0Alan Somers
Previous versions of Cargo would create and destroy a new thread for each test. Cargo 1.33.0 instead creates a thread pool and reuses the same thread for multiple tests. Some Nix tests that changed the per-thread sigmask began to fail as a result, because they didn't do any cleanup. The easiest solution is to spawn a new thread for each of those tests.
2019-03-03Fix the build on OSX with libc 0.2.49Alan Somers
Several symbols are now marked as deprecated on OSX. Fix the build by marking these symbols' Nix wrappers as deprecated, too.
2019-02-14Enable IPv4PacketInfo and Ipv6PacketInfo on more OSes.Alan Somers
This was an oversight from PR #1002
2019-02-14Fix misaligned references when using recvmsg with control messagesAlan Somers
On some platforms the alignment of cmsg_data could be less than the alignment of the messages that it contains. That led to unaligned reads on those platforms. This change fixes the issue by always copying the message contents into aligned objects. The change is not 100% backwards compatible when using recvmsg. Users may have to replace code like this: ```rust if let ControlMessage::ScmRights(&fds) = cmsg { ``` with this: ```rust if let ControlMessageOwned::ScmRights(fds) = cmsg { ``` Fixes #999
2019-02-14Replace CmsgSpace with a macroAlan Somers
CmsgSpace had three problems: 1) It would oversize buffers that expect multiple control messages 2) It didn't use the libc CMSG_SPACE(3) macro, so it might actually undersize a buffer for a single control message. 3) It could do bad things on drop, if you instantiate it with a type that implements Drop (which none of the currently supported ControlMessage types do). Fixes #994
2019-02-14Fix error handling of RecvMsgAlan Somers
There were two problems: 1) It would always return Ok, even on error 2) It could panic if there was an error, because sockaddr_storage_to_addr would be called on uninitialized memory.
2019-02-14Replace hand-rolled cmsg logic with libc's cmsg(3) functions.Alan Somers
Our hand-rolled logic had subtle alignment bugs that caused test_scm_rights to fail on OpenBSD (and probably could cause problems on other platforms too). Using cmsg(3) is much cleaner, shorter, and more portable. No user-visible changes.
2019-02-12`PollFd` event flags renamed to `PollFlags` from `EventFlags`.Amanjeev Sethi
Most of the EventFlags have been renamed already, but Poll was the only one remaining. This commit fixes that. Issue 317 https://github.com/nix-rust/nix/issues/317
2019-01-23Add IP_RECVIF & IP_RECVDSTADDR.Tom Pusateri
Include IP_PKTINFO and IP6_PKTINFO on netbsd/openbsd.
2019-01-22add `mman::mprotect`Adam C. Foltzer
2019-01-15Fix build and tests issues on OpenBSD 6.4+Andrei-Marius Radu
1) lutimes doesn't exist on OpenBSD so it needs to be under conditional compilation. The only "reference" that I could find related to this is the discussion here: https://github.com/rust-lang/libc/pull/790 . 2) fexecve doesn't exist on OpenBSD so add conditional compilation for it in unistd and in related tests. The only "reference" that I could find is a mention that fexecve is not implemented on OpenBSD in the manual pages for signal(3) and sigaction(2): Official repository (search for "fexecve"): https://cvsweb.openbsd.org/src/lib/libc/sys/sigaction.2?rev=1.75&content-type=text/x-cvsweb-markup Github mirror: https://github.com/openbsd/src/blob/master/lib/libc/sys/sigaction.2#L619 3) AIO doesn't work on OpenBSD so put test_aio_drop under conditional compilation. 4) Add relevant changelog entries. P.S. On OpenBSD remains the issue of test_scm_rights which builds correctly but fails at runtime.
2019-01-13Implement nix wrapper for libc::signalRobert Gardner
Closes #476
2019-01-09Added ptrace getregs and setregsWill Povell
2019-01-06Make ScmTimestamp's doc test more robustAlan Somers
The old test made assumptions about the responsiveness of the test environment. The new test does not, and it's simpler too.
2018-12-17Merge #993bors[bot]
993: Don't reference packed structs. r=asomers a=pusateri Fixes #992. Don't merge this yet. I have more testing to do. I just am pushing it up for others. Co-authored-by: Tom Pusateri <pusateri@bangj.com>
2018-12-17Merge #990bors[bot]
990: Add cmsg PKTINFO for IPv4 and IPv6. r=asomers a=pusateri Replaces #891 and attempts to address all previous concerns. Co-authored-by: Tom Pusateri <pusateri@bangj.com>
2018-12-16Allow 'cargo test' to complete successfully on NetBSD 8.0.Tom Pusateri
Some tests have been disabled and will need further review.
2018-12-15Add cmsg PKTINFO for IPv4 and IPv6.Tom Pusateri
ignore pktinfo tests on qemu mips,mips64,powerpc64 Original work by @mcginty.
2018-12-12Implement symlinkatoblique
2018-12-08Replace try! with ?Alan Somers
try! is not available in Rust 2018
2018-12-06Merge #972bors[bot]
972: Add support of TCP_CONGESTION for setsockopt r=asomers a=Fensteer Implementation proposal for support of TCP_CONGESTION param for `setsockopt`and `getsockopt` with the CString type. Co-authored-by: Fensteer <fensteer@protonmail.com>
2018-12-06Add support of TCP_CONGESTION for setsockoptFensteer
2018-12-06Merge #989bors[bot]
989: DragonflyBSD: Remove unused Errno's r=asomers a=levex EUNUSED* were removed from <sys/errno.h> in DragonflyBSD, so there is no need for them to be in nix either. This also fixes the build on DragonflyBSD. r? @asomers cc/ @mneumann Signed-off-by: Levente Kurusa <lkurusa@acm.org> Co-authored-by: Levente Kurusa <lkurusa@acm.org>
2018-12-03DragonflyBSD: Remove unused Errno'sLevente Kurusa
EUNUSED* were removed from <sys/errno.h> in DragonflyBSD, so there is no need for them to be in nix either. This also fixes the build on DragonflyBSD. Signed-off-by: Levente Kurusa <lkurusa@acm.org>
2018-12-01Remove duplicate termios constantsBryant Mairs
These constants have the same value on sparc64, so need to be removed as enums in Rust can't have multiple names for the same value.
2018-12-01Add ioctl definitions for sparc64-linuxBryant Mairs
2018-12-01Fix missing SIGSTKFLT on sparc64-linuxBryant Mairs
2018-12-01Correct architecture checkBryant Mairs
2018-12-01Fix baud rate constants on sparc64-linuxBryant Mairs
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>