summaryrefslogtreecommitdiff
AgeCommit message (Collapse)Author
2020-05-17Remove warnings when compiling for RedoxXavier L'Heureux
2020-05-17Add redoxer testing for travisXavier L'Heureux
2020-05-17Disable mkfifo for RedoxXavier L'Heureux
FIFOs are not supported (yet?) by RedoxFS, so disable it
2020-05-17Remove temporarily the failing tests for RedoxXavier L'Heureux
TODO: Fix them in Relibc
2020-05-17Make sure to leave the values as-is in openXavier L'Heureux
2020-05-17Add pollXavier L'Heureux
2020-05-17Add termio supportXavier L'Heureux
2020-05-17Remove more unsupported functions and make it possible to run testsXavier L'Heureux
2020-05-17Add Redox support for most of the modulesXavier L'Heureux
Some things are not implemented yet in redox, so a lot of annotations were added to remove functions when compiling for redox. Those functions will hopefully be added in time, but for now it's better to have partial support than none. Blocked by https://github.com/rust-lang/libc/pull/1438
2020-05-17Merge #1239bors[bot]
1239: Replace void crate with Rust standard lib Infallible type r=asomers a=oherrala [`std::convert::Infallible`](https://doc.rust-lang.org/stable/std/convert/enum.Infallible.html) has been available since Rust 1.34 and nix currently targets Rust 1.36 or later so this should not cause problems. Fixes #1238 Co-authored-by: Ossi Herrala <oherrala@iki.fi>
2020-05-17Replace void crate with Rust standard lib Infallible typeOssi Herrala
std::convert::Infallible has been available since Rust 1.34 and nix currently targets Rust 1.36 or later so this should not cause problems. Fixes #1238
2020-05-17Merge #1242bors[bot]
1242: Don't implement `NixPath` for `Option<&P> where P: NixPath` r=asomers a=asomers Most Nix functions that accept `NixPath` arguments can't do anything useful with `None`. The exceptions (`mount` and `quotactl_sync`) already take explicitly optional arguments. Also, this changes the behavior of `mount` with `None` arguments. Previously, it would call mount(2) with empty strings for those arguments. Now, it will use null pointers. Co-authored-by: Alan Somers <asomers@gmail.com>
2020-05-17Merge #1245bors[bot]
1245: Make ptrace::write unsafe on Linux r=asomers a=asomers It always should've been unsafe, because it dereferences a user-provided pointer. Co-authored-by: Alan Somers <asomers@gmail.com>
2020-05-16Merge #1243bors[bot]
1243: Apply `repr(transparent)` to several FFI types r=asomers a=asomers repr(transparent) is required in order to safely cast between an FFI type and its NewType. This commit applies that attribute to PollFd, EpollEvent, IpMembershipRequest, Ipv6MembershipRequest, TimeVal, and IoVec. Fixes #1241 Co-authored-by: Alan Somers <asomers@gmail.com>
2020-05-16Make ptrace::write unsafe on LinuxAlan Somers
It always should've been unsafe, because it dereferences a user-provided pointer.
2020-05-16Apply `repr(transparent)` to several FFI typesAlan Somers
repr(transparent) is required in order to safely cast between an FFI type and its NewType. This commit applies that attribute to PollFd, EpollEvent, IpMembershipRequest, Ipv6MembershipRequest, TimeVal, and IoVec. Fixes #1241
2020-05-16Don't implement `NixPath` for `Option<&P> where P: NixPath`Alan Somers
Most Nix functions that accept `NixPath` arguments can't do anything useful with `None`. The exceptions (`mount` and `quotactl_sync`) already take explicitly optional arguments. Also, this changes the behavior of `mount` with `None` arguments. Previously, it would call mount(2) with empty strings for those arguments. Now, it will use null pointers.
2020-05-16Merge #1232bors[bot]
1232: Document O_DIRECT flag for pipe2 r=asomers a=hberntsen From the man page linked in the description Co-authored-by: Harm Berntsen <git@harmberntsen.nl>
2020-05-15Document additional OS-specific flags for pipe2Harm Berntsen
See https://netbsd.gw.com/cgi-bin/man-cgi?pipe2+2+NetBSD-current and http://man7.org/linux/man-pages/man2/pipe.2.html
2020-05-12Merge #1231bors[bot]
1231: Add support for reading symlinks longer than `PATH_MAX` to `readlink` and `readlinkat` r=asomers a=SolraBizna This is in response to issue #1178. The new logic uses the following approach. - At any time, if `readlink` returns an error, or a value ≥ 0 and < (not ≤!) the buffer size, we're done. - Attempt to `readlink` into a `PATH_MAX` sized buffer. (This will almost always succeed, and saves a system call over calling `lstat` first.) - Try to `lstat` the link. If it succeeds and returns a sane value, allocate the buffer to be that large plus one byte. Otherwise, allocate the buffer to be `PATH_MAX.max(128) << 1` bytes. - Repeatedly attempt to `readlink`. Any time its result is ≥ (not >!) the buffer size, double the buffer size and try again. While testing this, I discovered that ext4 doesn't allow creation of a symlink > 4095 (Linux's `PATH_MAX` minus one) bytes long. This is in spite of Linux happily allowing paths in other contexts to be longer than this—including on ext4! This was probably instated to avoid breaking programs that assume `PATH_MAX` will always be enough, but ironically hindered my attempt to test support for *not* assuming. I tested the code using an artificially small `PATH_MAX` and (separately) a wired-to-fail `lstat`. `strace` showed the code behaving precisely as expected. Unfortunately, I can't add an automatic test for this. Other changes made by this PR: - `wrap_readlink_result` now calls `shrink_to_fit` on the buffer before returning, potentially reclaiming kilobytes of memory per call. This could be very important if the returned buffer is long-lived. - `readlink` and `readlink_at` now both call an `inner_readlink` function that contains the bulk of the logic, avoiding copy-pasting of code. (This is much more important now that the logic is more than a few lines long.) Notably, this PR does *not* add support for systems that don't define `PATH_MAX` at all. As far as I know, I don't have access to any POSIX-ish OS that doesn't have `PATH_MAX`, and I suspect it would have other compatibility issues with `nix` anyway. Co-authored-by: Solra Bizna <solra@bizna.name>
2020-05-10Add support for reading symlinks longer than `PATH_MAX` to `readlink` and ↵Solra Bizna
`readlinkat`
2020-05-08Merge #1233bors[bot]
1233: Add SO_BINDTODEVICE sockopt r=asomers a=jeandudey This is available only on Linux as far I know, [socket(7)](https://linux.die.net/man/7/socket) has some information about the `SO_BINDTODEVICE` sockopt. In simple words it binds a socket to an specific network device (specified as an string like "wlo1", "eth0", etc.), to only process packets from that device. Note: this is untested (for now, i'll test it today), but should work out of the box. Co-authored-by: Jean Pierre Dudey <jeandudey@hotmail.com>
2020-05-08Add SO_BINDTODEVICE sockoptJean Pierre Dudey
This is available only on Linux as far I know, [socket(7)](https://linux.die.net/man/7/socket) has some information about the `SO_BINDTODEVICE` sockopt. In simple words it binds a socket to an specific network device (specified as an string like "wlo1", "eth0", etc.), to only process packets from that device. Signed-off-by: Jean Pierre Dudey <jeandudey@hotmail.com>
2020-05-03Fix an "unused import" warning on FreeBSD in test_scm_credentialsAlan Somers
2020-05-02Merge #1216bors[bot]
1216: Add UnixCredentials support on FreeBSD/DragonFly r=asomers a=myfreeweb This allows working with `SCM_CREDS` messages, which are like `SCM_CREDENTIALS` on Linux, but slightly different (always overwritten by the kernel, contain a bit more info — euid and groups). With this PR, it is possible to write portable code that would use the appropriate message for the platform, but one remaining quirk is that `PassCred` thing still has to be present and `cfg`'d to Linux. Adding the `SCM_CREDS` constant to libc: https://github.com/rust-lang/libc/pull/1740 Co-authored-by: Greg V <greg@unrelenting.technology>
2020-05-02Merge #1227 #1228bors[bot]
1227: Test on Rust stable again r=asomers a=asomers This commit reverts eba3b516f7f76465e2fbe1c16724786144f01e8e, which worked around a Travis CI bug that has since been fixed. The effect is to resume testing on the latest Rust stable. 1228: Fix an "unused macro" warning on non-Linux platforms r=asomers a=asomers cc @glebpom Co-authored-by: Alan Somers <asomers@gmail.com>
2020-05-02Add UnixCredentials support on FreeBSD/DragonFly (cmsgcred/SCM_CREDS)Greg V
2020-05-02Fix an "unused macro" warning on non-Linux platformsAlan Somers
2020-05-02Test on Rust stable againAlan Somers
This commit reverts eba3b516f7f76465e2fbe1c16724786144f01e8e, which worked around a Travis CI bug that has since been fixed. The effect is to resume testing on the latest Rust stable.
2020-05-01Merge #1215bors[bot]
1215: Remove sys::socket::addr::from_libc_sockaddr from the public API r=posborne a=asomers This function never should've been public, since it's basically impossible to use directly. It's only public due to an oversight from PR #667 . Co-authored-by: Alan Somers <asomers@gmail.com>
2020-04-26Merge #1208bors[bot]
1208: Support sendmmsg/recvmmsg r=asomers a=glebpom This pull request adds `sendmmsg` and `recvmmsg` functions. They are used to send and receive multiple messages per one call. Additionally, `AsMut` implemented for both `TimeSpec` and `TimeVal`. This is still WIP, because we need to find the best way on how to pass multiple values to *mmsg functions. Current approach with iterators doesn't seem ergonomic. Co-authored-by: Gleb Pomykalov <gleb@lancastr.com> Co-authored-by: Alan Somers <asomers@gmail.com>
2020-04-26Eliminate a mem::zeroed() in recvmmsgAlan Somers
2020-04-26Support sendmmsg/recvmmsgGleb Pomykalov
2020-04-25Merge #1209bors[bot]
1209: Support UDP GSO and GRO on linux r=asomers a=glebpom This PR implements support for UDP GSO and GRO on Linux. It provides the way to send/receive UDP payloads bigger than interface MTU. The goal is to improve UDP performance. GSO was introduced in Linux 4.18, GRO in 5.3 Co-authored-by: Gleb Pomykalov <gleb@lancastr.com>
2020-04-25Merge #1221bors[bot]
1221: Fix compilation on DragonFly (statfs) r=asomers a=mneumann Co-authored-by: Michael Neumann <mneumann@ntecs.de>
2020-04-25Support UDP GSO and GRO on linuxGleb Pomykalov
2020-04-25Merge #1220bors[bot]
1220: Fix RISC-V support r=asomers a=andreas-schwab Don't try to use PTRACE_[GS]ETREGS, PTRACE_[GS]ETFPREGS or PTRACE_[GS]ETFPXREGS on riscv64, they are legacy-only. Co-authored-by: Andreas Schwab <schwab@suse.de>
2020-04-25Fix compilation on DragonFly (statfs)Michael Neumann
2020-04-25Fix RISC-V supportAndreas Schwab
Don't try to use PTRACE_[GS]ETREGS, PTRACE_[GS]ETFPREGS or PTRACE_[GS]ETFPXREGS on riscv64, they are legacy-only.
2020-04-24Merge #1210bors[bot]
1210: impl io::{Read,Write} for PtyMaster r=asomers a=cuviper `PtyMaster` acts like an owned file descriptor, even closing on `Drop`. Implementing `io::Read` and `io::Write` lets it be used directly in standard I/O operations. Co-authored-by: Josh Stone <jistone@redhat.com>
2020-04-22Merge #1211bors[bot]
1211: Feature/hugepage size r=asomers a=GuillaumeDIDIER Should solve #1194 . Co-authored-by: GuillaumeDIDIER <guillaume.didier95@hotmail.fr>
2020-04-21impl io::{Read,Write} for PtyMasterJosh Stone
`PtyMaster` acts like an owned file descriptor, even closing on `Drop`. Implementing `io::Read` and `io::Write` lets it be used directly in standard I/O operations.
2020-04-21Add the MAP_HUGE_<SIZE> flags for linux.GuillaumeDIDIER
Closes #1194 Use git libc for development (Remember to reset this to released version for the next nix release, once libc has released >=0.2.69)
2020-04-19Merge #1217 #1218bors[bot]
1217: Remove a few more cases of mem::uninitialized in the tests r=asomers a=asomers Somehow I didn't noticed these in PR #1158, probably because they're only built on Linux. 1218: Update the FreeBSD CI image to 11.3. r=asomers a=asomers 11.2 is EOL. Co-authored-by: Alan Somers <asomers@gmail.com>
2020-04-19Update the FreeBSD CI image to an 11.3 snapshotAlan Somers
11.2 is EOL.
2020-04-19Merge #1207bors[bot]
1207: Add select::FdSet::fds() method r=asomers a=zombiezen To be more consistent with most Rust APIs and enable cloning of the iterator, I made `FdSet::contains` operate on an immutable borrow instead of a mutable one by copying the set. If this is not desirable, I can roll that back from this PR and focus purely on the `fds()` method. Co-authored-by: Ross Light <ross@zombiezen.com>
2020-04-19Remove a few more cases of mem::uninitialized in the testsAlan Somers
Somehow I didn't noticed these in PR #1158, probably because they're only built on Linux.
2020-04-19Merge #1206bors[bot]
1206: Fix unaligned casting of cmsg data to af_alg_iv r=asomers a=glebpom Casting a pointer to `cmsg_data` to `af_alg_iv` is incorrect since it's not properly aligned. As of the [`cmsg` man page](http://man7.org/linux/man-pages/man3/cmsg.3.html) "Applications should not cast it to a pointer type matching the payload, but should instead use memcpy(3) to copy data to or from a suitably declared object." Co-authored-by: Gleb Pomykalov <gleb@lancastr.com>
2020-04-14Remove stray # in CHANGELOGRoss Light
2020-04-14Added fds testRoss Light