summaryrefslogtreecommitdiff
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-14Merge #1020bors[bot]
1020: Major cmsg cleanup r=asomers a=asomers This PR fixes multiple bugs in the cmsg code. Fixes #994 Fixes #999 Fixes #1013 Co-authored-by: Alan Somers <asomers@gmail.com>
2019-02-14Enable IPv4PacketInfo and Ipv6PacketInfo on more OSes.Alan Somers
This was an oversight from PR #1002
2019-02-14Add CHANGELOG entry.Alan Somers
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-12Merge #1027bors[bot]
1027: Bump the rand dependency to 0.6 r=asomers a=asomers Also, bump the tempfile dependency so it will be using the same version of rand. Fixes #1026 Co-authored-by: Alan Somers <asomers@gmail.com>
2019-02-12Merge #1024bors[bot]
1024: Fix for #317 - Some event flags renaming r=asomers a=amanjeev I tried to grep and replace for #317. Please let me know if I need to fix something else as well but in my search I saw that most were fixed earlier. Co-authored-by: Amanjeev Sethi <aj@amanjeev.com>
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-02-12Bump the rand dependency to 0.6Alan Somers
Also, bump the tempfile dependency so it will be using the same version of rand. Fixes #1026
2019-01-30Merge #1002bors[bot]
1002: Add IP_RECVIF & IP_RECVDSTADDR. r=asomers a=pusateri Add IP_RECVIF & IP_RECVDSTADDR on freebsd, ios, macos, netbsd, openbsd Include IP_PKTINFO on netbsd Include IP6_PKTINFO on netbsd, openbsd. FreeBSD/OpenBSD do not support IP_PKTINFO for IPv4 but use IP_RECVIF for interface index and use IP_RECVDSTADDR for destination address. NetBSD and macOS also support IP_RECVIF and IP_RECVDSTADDR in addition to IP_PKTINFO for IPv4. (For IPv6, all use IPV6_PKTINFO) Co-authored-by: Tom Pusateri <pusateri@bangj.com>
2019-01-23Add IP_RECVIF & IP_RECVDSTADDR.Tom Pusateri
Include IP_PKTINFO and IP6_PKTINFO on netbsd/openbsd.
2019-01-22Merge #991bors[bot]
991: Add `mman::mprotect` r=asomers a=acfoltzer It doesn't look like there's an existing test suite for `mmap` and friends, so this is regrettably untested. Co-authored-by: Adam C. Foltzer <acfoltzer@acfoltzer.net>
2019-01-22add `mman::mprotect`Adam C. Foltzer
2019-01-15Merge #1015bors[bot]
1015: Start the next dev cycle r=asomers a=asomers Co-authored-by: Alan Somers <asomers@gmail.com>
2019-01-15Start the next dev cycleAlan Somers
2019-01-15Merge #1014bors[bot]
1014: Prepare for release 0.13.0 r=asomers a=asomers Co-authored-by: Alan Somers <asomers@gmail.com>
2019-01-15Prepare for release 0.13.0Alan Somers
2019-01-14Merge #1000bors[bot]
1000: Make nix build again on OpenBSD 6.4-current r=asomers a=thendiscard First of all, I'm not a rust developer so please be gentle :) I'm using https://github.com/jwilm/alacritty on OpenBSD. I'm trying to track the latest versions of both OpenBSD and alacritty so I'm recompiling alacritty fairly often. However the latest version of alacritty updated some of it's nix dependencies to v0.12.0 and that doesn't build on OpenBSD anymore: ```bash user1 ~/ALACRITTY/nix $ sysctl kern.version kern.version=OpenBSD 6.4-current (GENERIC.MP) #529: Tue Dec 18 22:36:49 MST 2018 deraadt@amd64.openbsd.org:/usr/src/sys/arch/amd64/compile/GENERIC.MP user1 ~/ALACRITTY/nix $ rustc -vV rustc 1.31.0 binary: rustc commit-hash: unknown commit-date: unknown host: x86_64-unknown-openbsd release: 1.31.0 LLVM version: 6.0 user1 ~/ALACRITTY/nix $ cargo build Updating crates.io index Updating git repository `https://github.com/rust-lang/libc/` Compiling libc v0.2.45 (https://github.com/rust-lang/libc/#027d4834) Compiling nix v0.12.0 (/home/user1/ALACRITTY/nix) Compiling bitflags v1.0.4 Compiling cfg-if v0.1.6 Compiling void v1.0.2 error[E0425]: cannot find function `lutimes` in module `libc` --> src/sys/stat.rs:216:15 | 216 | libc::lutimes(cstr.as_ptr(), &times[0]) | ^^^^^^^ did you mean `futimes`? help: possible candidate is found in another module, you can import it into scope | 1 | use sys::stat::lutimes; | error: aborting due to previous error ``` In order to build nix v0.12.0 on OpenBSD 6.4-current the change in 85ae87c is sufficient, however in order to get the tests to build the 2 additional commits I've included in this PR are required. However even with 680ff30 & 6bdd9f2 the tests build but there is 1 failure: ```bash user1 ~/ALACRITTY/nix $ cargo build Compiling libc v0.2.45 (https://github.com/rust-lang/libc/#027d4834) Compiling nix v0.12.0 (/home/user1/ALACRITTY/nix) Compiling void v1.0.2 Compiling cfg-if v0.1.6 Compiling bitflags v1.0.4 Finished dev [unoptimized + debuginfo] target(s) in 15.14s user1 ~/ALACRITTY/nix $ cargo test Compiling semver-parser v0.7.0 Compiling libc v0.2.45 Compiling rand_core v0.3.0 Compiling byteorder v1.2.7 Compiling remove_dir_all v0.5.1 Compiling lazy_static v1.2.0 Compiling rand_xorshift v0.1.0 Compiling rand_hc v0.1.0 Compiling rand_isaac v0.1.1 Compiling rand_core v0.2.2 Compiling semver v0.9.0 Compiling iovec v0.1.2 Compiling rand v0.5.5 Compiling rustc_version v0.2.3 Compiling bytes v0.4.11 Compiling rand_chacha v0.1.0 Compiling rand_pcg v0.1.1 Compiling rand v0.6.1 Compiling tempfile v3.0.5 Compiling nix v0.12.0 (/home/user1/ALACRITTY/nix) warning: unused import: `nix::sys::signal::*` --> test/sys/test_aio_drop.rs:6:5 | 6 | use nix::sys::signal::*; | ^^^^^^^^^^^^^^^^^^^ | = note: #[warn(unused_imports)] on by default < ..................................... > test sys::time::test::test_timeval_fmt ... ok test sys::time::test::test_timeval_neg ... ok test result: ok. 35 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out Running target/debug/deps/test-6e77230ab75553a1 running 88 tests test sys::test_ioctl::bsd::test_op_read_64 ... ok test sys::test_ioctl::bsd::test_op_none ... ok < ..................................... > test test_unistd::test_alarm ... ok test test_unistd::test_canceling_alarm ... ok failures: ---- sys::test_socket::test_scm_rights stdout ---- thread 'sys::test_socket::test_scm_rights' panicked at 'slice index starts at 24 but ends at 20', libcore/slice/mod.rs:2340:5 note: Run with `RUST_BACKTRACE=1` for a backtrace. failures: sys::test_socket::test_scm_rights test result: FAILED. 87 passed; 1 failed; 0 ignored; 0 measured; 0 filtered out error: test failed, to rerun pass '--test test' user1 ~/ALACRITTY/nix $ RUST_BACKTRACE=1 cargo test < ..................................... > failures: ---- sys::test_socket::test_scm_rights stdout ---- thread 'sys::test_socket::test_scm_rights' panicked at 'slice index starts at 24 but ends at 20', libcore/slice/mod.rs:2340:5 stack backtrace: 0: __register_frame_info 1: __register_frame_info 2: __register_frame_info 3: __register_frame_info 4: __register_frame_info 5: __register_frame_info 6: __register_frame_info 7: __register_frame_info 8: __register_frame_info 9: __register_frame_info 10: __register_frame_info 11: __register_frame_info 12: __register_frame_info 13: __register_frame_info 14: __register_frame_info 15: __register_frame_info 16: __register_frame_info 17: __register_frame_info 18: __register_frame_info 19: __register_frame_info 20: __register_frame_info 21: __register_frame_info 22: __register_frame_info 23: __register_frame_info 24: pthread_create failures: sys::test_socket::test_scm_rights test result: FAILED. 87 passed; 1 failed; 0 ignored; 0 measured; 0 filtered out error: test failed, to rerun pass '--test test' ``` I could add a conditional compilation attribute for `test_scm_rights` but I'm not sure if it's the best option, maybe someone with actual rust skills wants to fix it. Apart from that 1 failed test nix works fine for me and I can build and use alacritty. Co-authored-by: Andrei-Marius Radu <thendiscard@users.noreply.github.com>
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-13Merge #817bors[bot]
817: Implement nix wrapper for libc::signal r=asomers a=rgardner This implements `nix::sys::signal::signal` and adds corresponding documentation and tests. Closes #476 Co-authored-by: Robert Gardner <bob.hn.gardner@gmail.com>
2019-01-13Implement nix wrapper for libc::signalRobert Gardner
Closes #476
2019-01-10Merge #1010bors[bot]
1010: Added `ptrace::{getregs, setregs}` r=asomers a=wpovell I needed `ptrace`'s `getregs` and `setregs` for a project I was working on, so I added them! First time contributor, so let me know if I should change / fix anything. Things work fine in my project which uses both functions, let me know if further testing is needed. Co-authored-by: Will Povell <william_povell@brown.edu>
2019-01-09Added ptrace getregs and setregsWill Povell
2019-01-07Merge #1005bors[bot]
1005: Make ScmTimestamp's doc test more robust r=asomers a=asomers The old test made assumptions about the responsiveness of the test environment. The new test does not, and it's simpler too. Co-authored-by: Alan Somers <asomers@gmail.com>
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-31Merge #1003bors[bot]
1003: Switch FreeBSD CI builds from BuildBot to cirrus-ci.com r=asomers a=asomers This change does the following: 1) Adds a CI build on cirrus-ci.com 2) Switches FreeBSD's CI from a jail to a full VM 3) Switches FreeBSD i386's CI from a 32-bit jail to simply using a cross-compiled binary on a 64-bit VM. 4) Switches FreeBSD i386's CI from using stable rust to 1.24.1 (back when I added buildbot, rustup didn't support i686-unknown-freebsd) 5) Switches bors to gate on cirrus-ci rather than buildbot This change does _not_ disable buildbot. That must happen outside of git. Fixes #996 Co-authored-by: Alan Somers <asomers@gmail.com>
2018-12-29Switch FreeBSD CI builds from BuildBot to cirrus-ci.comAlan Somers
This change does the following: 1) Adds a CI build on cirrus-ci.com 2) Switches FreeBSD's CI from a jail to a full VM 3) Switches FreeBSD i386's CI from a 32-bit jail to simply using a cross-compiled binary on a 64-bit VM. 4) Switches FreeBSD i386's CI from using stable rust to 1.24.1 (back when I added buildbot, rustup didn't support i686-unknown-freebsd) 5) Switches bors to gate on cirrus-ci rather than buildbot This change does _not_ disable buildbot. That must happen outside of git. Fixes #996
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-12Merge #997bors[bot]
997: Implement symlinkat r=asomers a=oblique Co-authored-by: oblique <psyberbits@gmail.com>
2018-12-12Implement symlinkatoblique
2018-12-09Merge #995bors[bot]
995: Replace try! with ? r=asomers a=asomers try! is not available in Rust 2018. It would be premature to convert the entire project to Rust 2018, since that would bump the minimum compiler to 1.31.0. But his change will help us when we do convert it eventually. Co-authored-by: Alan Somers <asomers@gmail.com>
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-03Merge #987bors[bot]
987: Fix builds on sparc64-unknown-linux-gnu r=asomers a=Susurrus Co-authored-by: Bryant Mairs <bryant@mai.rs>
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