Age | Commit message (Collapse) | Author |
|
It's small and `Copy`, so pass by value is more efficient. This is
technically a breaking change, but most code should compile without
changes.
|
|
|
|
|
|
It already fully validated its arguments, so there's no need for it to
be `unsafe`.
|
|
Reported-by: Clippy
|
|
1222: Add Ipv{4,6}PacketInfo support to ControlMessage for send{m,}msg. r=asomers a=isomer
This adds Ipv4PacketInfo and Ipv6PacketInfo to ControlMessage, allowing these to be used with sendmsg/sendmmsg.
Co-authored-by: Perry Lorier <perryl@google.com>
|
|
This adds Ipv4PacketInfo and Ipv6PacketInfo to ControlMessage,
allowing these to be used with sendmsg/sendmmsg.
This change contains the following squashed commits:
Add Ipv{4,6}PacketInfo to ControlMessage.
Add documentation links to Ipv{4,6}PacketInfo
Add changelog entry for Ipv{4,6}PacketInfo
Add link to PR in the Changelog.
Add extra build environments.
Add tests for Ipv{4,6}PacketInfo.
Swap #[test] and #[cfg]
The CI appears to be running the test, even though it's not cfg'd for
that platform. I _think_ this might be due to these being in the wrong
order. So lets try swapping them.
s/freebsd/netbsd/ for Ipv4PacketInfo
netbsd supports in_pktinfo, not freebsd.
Fix the cfg for Ipv{4,6}PacketInfo usage.
Ah, I see what I did wrong. I had fixed the definitions, but I had the
wrong cfg() in the usage. This has the usage match the definitions.
Change SOL_IPV6 to IPPROTO_IPV6.
FreeBSD doesn't have SOL_IPV6, but does have IPPROTO_IPV6, and the two
constants are defined as being equal. So change to use IPPROTO_IPV6.
Skip Ipv6PacketInfo test if v6 is not available.
If IPv6 is not available, then when we try and bind to ip6-localhost,
we'll get a EADDRNOTAVAIL, so skip the test.
This should mean that the test will run on any machine that has a v6
loopback address.
More architecture cfg() fixes.
These all need to be the same, and they were not. Make them them all
the same. Attempt III.
Fix up mismatched cfg's again.
Take IV. Make sure the cfg's that use a enum variant match the enum
definition.
|
|
1255: Remove several deprecated constants and functions r=asomers a=asomers
* `unistd::daemon` on Apple
* `unistd::pipe2` on Apple
* `sys::event::FilterFlag::NOTE_EXIT_REPARENTED` on Apple
* `sys::event::FilterFlag::NOTE_REAP` on Apple
* `sys::ptrace::ptrace` on Android and Linux
All have been deprecated for more than two releases and one year.
Co-authored-by: Alan Somers <asomers@gmail.com>
|
|
1257: Add fchown(2) wrapper r=asomers a=nateavers
Mentioned [in #1029](https://github.com/nix-rust/nix/issues/1029#issuecomment-622972782).
Co-authored-by: Nate Avers <nathan.avers@alumni.case.edu>
|
|
|
|
|
|
Limit internal termios API to pub(crate)
|
|
* `unistd::daemon` on Apple
* `unistd::pipe2` on Apple
* `sys::event::FilterFlag::NOTE_EXIT_REPARENTED` on Apple
* `sys::event::FilterFlag::NOTE_REAP` on Apple
* `sys::ptrace::ptrace` on Android and Linux
All have been deprecated for more than two releases and one year.
|
|
|
|
|
|
This test cannot be compiled under Redox. PR #1098 attempted to disable
it for Redox, but actually disabled it everywhere. AFAICT, Cargo has no
syntax to conditionally enable a target, except based on features.
Instead, use conditional compilation within the test.
|
|
|
|
1252: Add EV_DISPATCH, EV_RECEIPT items for EventFlags, and fix build on OpenBSD r=asomers a=nickpelone
This pull request:
- Adds `EV_DISPATCH` and `EV_RECEIPT` to `EventFlags`. OpenBSD supports these now.
c379d1a
- Fixes a regression that caused `nix` to be unable to build on OpenBSD since #1208.
dd0a990
- Makes a change to avoid a deprecation warning from `libc` crate, which breaks tests.
0f9fcbd
Since I know y'all don't have OpenBSD in CI right now, I've attached the results of a `cargo test` run on OpenBSD 6.7.
Thanks for your time!
[testresults.txt](https://github.com/nix-rust/nix/files/4684597/testresults.txt)
Fixes #1251
Co-authored-by: Nick Pelone <nick.pelone@calyptix.com>
|
|
|
|
successfully. This type was deprecated in libc 0.2.55.
|
|
sendmmsg() / recvmmsg() in #1208.
In #1208, sendmmsg() / recvmmsg() were added, but OpenBSD(who doesn't support these)
was included on the list of allowed operating systems for sendmmsg() related things.
This broke the build on OpenBSD.
For more Rust-world examples, see: https://github.com/rust-lang/libc/commit/6f6297301d49ff67b8ca044d651f36a56950298c
|
|
|
|
1098: Add Redox support for most of the modules r=asomers a=AdminXVII
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
Co-authored-by: Xavier L'Heureux <xavier.lheureux@icloud.com>
Co-authored-by: Xavier L'Heureux <dev.xlheureux@gmail.com>
|
|
|
|
|
|
- Make sure all tests pass the CI
- Redox does not (yet) have passwd functions, so remove it
|
|
|
|
|
|
|
|
FIFOs are not supported (yet?) by RedoxFS, so disable it
|
|
TODO: Fix them in Relibc
|
|
|
|
|
|
|
|
|
|
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
|
|
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>
|
|
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
|
|
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>
|
|
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>
|
|
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>
|
|
It always should've been unsafe, because it dereferences a user-provided
pointer.
|
|
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
|
|
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.
|
|
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>
|
|
See https://netbsd.gw.com/cgi-bin/man-cgi?pipe2+2+NetBSD-current and
http://man7.org/linux/man-pages/man2/pipe.2.html
|
|
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>
|
|
`readlinkat`
|
|
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>
|
|
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>
|