Age | Commit message (Collapse) | Author |
|
1635: Remove EventFlag::EV_SYSFLAG r=rtzoeller a=rtzoeller
It is not stable across OpenBSD versions and is reserved by the system on FreeBSD and NetBSD.
This should fix the nix build for OpenBSD, which is failing due to https://github.com/rust-lang/libc/pull/2596. Bump the libc dependency to uptake that change.
Co-authored-by: Ryan Zoeller <rtzoeller@rtzoeller.com>
|
|
It is not stable across OpenBSD versions and is reserved by the system
on FreeBSD and NetBSD.
|
|
1610: Re-enable deprecation warnings on DragonFly r=asomers a=rtzoeller
Reverts 0df82ded4704caf78c32df941c170cdacc9688dc and ac159d9c4e4165d74af25dc8b4913e6b7efe7272.
Co-authored-by: Ryan Zoeller <rtzoeller@rtzoeller.com>
|
|
Use latest nightly compiler.
|
|
1630: Change port used by test_txtime to avoid conflict r=asomers a=rtzoeller
The socket tests request specific ports, and `test_timestamping` and `test_txtime` are currently conflicting in the port they request.
This leads to the second of the tests failing with `EADDRINUSE` when run locally.
Co-authored-by: Ryan Zoeller <rtzoeller@rtzoeller.com>
|
|
1628: Add getresuid/gid and setresuid/gid on BSDs r=asomers a=rtzoeller
Co-authored-by: Ryan Zoeller <rtzoeller@rtzoeller.com>
|
|
|
|
|
|
1615: Add sendfile(2) for DragonFly r=rtzoeller a=rtzoeller
The code is copied from the Mac OS and FreeBSD implementations.
Co-authored-by: Ryan Zoeller <rtzoeller@rtzoeller.com>
|
|
|
|
1625: Correct MAP_FIXED documentation for NetBSD r=rtzoeller a=rtzoeller
The previous documentation described the default behavior, rather than the behavior when the flag was set.
Also fix a test which is failing due to passing this flag erroneously.
Co-authored-by: Ryan Zoeller <rtzoeller@rtzoeller.com>
|
|
The previous documentation described the default behavior, rather than
the behavior when the flag was set.
Also fix a test which is failing due to passing this flag erroneously.
|
|
1624: Fix mq tests on NetBSD and DragonFly r=asomers a=rtzoeller
NetBSD (and DragonFly, which borrows its implementation) include additional flags beyond O_NONBLOCK in MqAttr, such as the flags passed to mq_open(). Modify the mq tests to validate _at least_ the expected flags are set, but don't require strict equality on these platforms.
Verified these tests pass on DragonFly and NetBSD locally.
Co-authored-by: Ryan Zoeller <rtzoeller@rtzoeller.com>
|
|
1626: Fix intermittency in test_timer::alarm_fires r=rtzoeller a=asomers
The test was disabling the signal handler before disabling the timer.
Fix intermittent failures but reversing the cleanup order.
Also, speed up the timer to make the test suite complete faster.
Co-authored-by: Alan Somers <asomers@gmail.com>
|
|
The test was disabling the signal handler before disabling the timer.
Fix intermittent failures by:
* Reversing the cleanup order.
* Sleeping for a while before removing the signal handler, since POSIX
does not guarantee that timer_delete will clear pending signals.
Also, speed up the timer to make the test suite complete faster.
|
|
NetBSD (and DragonFly, which borrows its implementation) include
additional flags beyond O_NONBLOCK in MqAttr, such as the flags
passed to mq_open().
|
|
1622: Introduce `timer_*` support r=asomers a=blt
This commit adds support for the signal timer mechanism in POSIX, the mirror to timerfd on Linux. I wasn't _quite_ sure of how to fit into the project organization but hopefully this patch isn't too far off.
Resolves #1424
Signed-off-by: Brian L. Troutwine <brian@troutwine.us>
1623: Remove cc dependency on DragonFly r=asomers a=rtzoeller
f5ee22db489f78b9c003ef60b7ad1b837503bc4a removed the need for this dependency.
Co-authored-by: Brian L. Troutwine <brian@troutwine.us>
Co-authored-by: Ryan Zoeller <rtzoeller@rtzoeller.com>
|
|
1618: Refactor UnixAddr r=asomers a=asomers
* Within UnixAddr, replace the path_len variable (length of the sun_path
field) with sun_len (length of the whole structure). This is more
similar to how other sockaddr types work, and it's the same way that the
BSDs use the sun_len field.
Also, don't require that sun_path be nul-terminated. The OS doesn't
require it.
* On BSD-derived operating systems, struct sockaddr has a sa_len field
that holds the length of the structure. UnixAddr's path_len field is
redundant. Remove path_len on BSD-derived OSes, retaining it only for
Illumos and Linux-based OSes.
Co-authored-by: Alan Somers <asomers@gmail.com>
|
|
This commit adds support for the signal timer mechanism in POSIX, the
mirror to timerfd on Linux.
Resolves #1424
Signed-off-by: Brian L. Troutwine <brian@troutwine.us>
|
|
On BSD-derived operating systems, struct sockaddr has a sa_len field
that holds the length of the structure. UnixAddr's path_len field is
redundant. Remove path_len on BSD-derived OSes, retaining it only for
Illumos and Linux-based OSes.
Also, ensure that two UnixAddrs compare equal if they differ only by the
presence of a trailing NUL. On Linux, syscalls like getsockname add a
trailing NUL to the sockaddr they return, even if no NUL was present on
the sockaddr originally passed to the kernel via a syscall like bind,
and even though the docs explicitly say that any NUL passed to bind is
not considered to be part of the address. Work around this bug by
stripping it in UnixAddrKind::get(), so that at least two UnixAddrs will
compare identical even if they differ in the presence of a trailing NUL.
|
|
f5ee22db489f78b9c003ef60b7ad1b837503bc4a removed the need for this dependency.
|
|
1564: Add support for the SO_TXTIME sockopt and SCM_TXTIME control message r=asomers a=ghedo
Co-authored-by: Alessandro Ghedini <alessandro@cloudflare.com>
|
|
|
|
1619: Added getters for the MqAttr struct r=rtzoeller a=fpagliughi
With the existing code, if you call `mq_getattr()`, there does not appear to be a way to get any of the attributes from the returned `MqAttr` struct, other than the flags. This adds getter functions to retrieve the size parameters of the queue, and the current number of messages in the queue.
Co-authored-by: fpagliughi <fpagliughi@mindspring.com>
|
|
|
|
1596: Add NetBSD configuration for supported process resources r=asomers a=schctl
In addition to existing resources, NetBSD supports `RLIMIT_MEMLOCK`, `RLIMIT_NPROC` and `RLIMIT_RSS`.
https://man.netbsd.org/setrlimit.2
`RLIMIT_AS` is also supported, but it looks like it was added [after version 5.0](https://mail-index.netbsd.org/tech-kern/2009/03/28/msg004702.html), so I'm not sure if that should be enabled.
1621: Add posix_fallocate on DragonFly r=asomers a=rtzoeller
Enable the existing `posix_fallocate()` tests as they are passing locally.
Co-authored-by: Sachin Cherian <sachinctl@protonmail.com>
Co-authored-by: Ryan Zoeller <rtzoeller@rtzoeller.com>
|
|
1620: Fix typos in documentation r=asomers a=rtzoeller
Co-authored-by: Ryan Zoeller <rtzoeller@rtzoeller.com>
|
|
|
|
|
|
1547: feat: Add glibc::SOF_TIMESTAMPING_* support r=asomers a=pacak
Support for kernel and hardware receive timestamps
Co-authored-by: Michael Baikov <manpacket@gmail.com>
|
|
1616: Disable mknod and mknodat tests on DragonFly r=asomers a=rtzoeller
Like FreeBSD, DragonFly does not support creating regular files (i.e. `S_IFREG`) with `mknod` or `mknodat`. These tests should be disabled as they always fail.
There are still a few other failing tests on DragonFly, but it is unclear to me if they are due to faulty/inapplicable test logic or a bug in DragonFly.
Co-authored-by: Ryan Zoeller <rtzoeller@rtzoeller.com>
|
|
|
|
1614: Improve the sockaddr interface: r=asomers a=asomers
* All sockaddr newtypes should be repr(transparent)
* All sockaddr newtypes should be opaque, so the user can't do something
like change the sa_family field in a way that violates invariants.
This is a prerequisite for #1544.
Co-authored-by: Alan Somers <asomers@gmail.com>
|
|
|
|
|
|
1582: impl Send and Sync for IoVec r=rtzoeller a=asomers
Co-authored-by: Alan Somers <asomers@gmail.com>
|
|
1613: Fix clippy warning by adding #[must_use] r=asomers a=rtzoeller
Clippy added a lint for non-constructor methods which return `self`, encouraging them to be marked as `#[must_use]`.
Mark the methods which are failing with the latest nightly's clippy.
```
$ cargo clippy
warning: missing `#[must_use]` attribute on a method returning `Self`
--> src/sys/aio.rs:1068:5
|
1068 | / pub fn emplace_slice(mut self, fd: RawFd, offs: off_t, buf: &'a [u8],
1069 | | prio: libc::c_int, sigev_notify: SigevNotify,
1070 | | opcode: LioOpcode) -> Self
1071 | | {
... |
1074 | | self
1075 | | }
| |_____^
|
= note: `#[warn(clippy::return_self_not_must_use)]` on by default
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#return_self_not_must_use
warning: missing `#[must_use]` attribute on a method returning `Self`
--> src/sys/aio.rs:1084:5
|
1084 | / pub fn emplace_mut_slice(mut self, fd: RawFd, offs: off_t,
1085 | | buf: &'a mut [u8], prio: libc::c_int,
1086 | | sigev_notify: SigevNotify, opcode: LioOpcode)
1087 | | -> Self
... |
1091 | | self
1092 | | }
| |_____^
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#return_self_not_must_use
warning: `nix` (lib) generated 2 warnings
Finished dev [unoptimized + debuginfo] target(s) in 0.01s
```
Co-authored-by: Ryan Zoeller <rtzoeller@rtzoeller.com>
|
|
1537: DragonFly BSD supports `sched_getaffinity()` and `sched_setaffinity()` r=rtzoeller a=rtzoeller
Move `CpuSet`, `sched_getaffinity()`, and `sched_setaffinity()` from the `sched_linux_like` namespace to `sched_affinity`. Declare support for DragonFly BSD.
`test_sched_affinity()` passes locally on DragonFly BSD.
Co-authored-by: Ryan Zoeller <rtzoeller@rtzoeller.com>
|
|
|
|
|
|
1581: Add fdatasync for missing platforms r=rtzoeller a=rtzoeller
These platforms stub out `fdatasync()` by just calling `fsync()`, but that is a conforming implementation.
DragonFly recently provided [an implementation](https://github.com/DragonFlyBSD/DragonFlyBSD/commit/74fa2560ac77f9db4a34b2a7c72450126fec4ed6), but it has not made it into a release or rust-lang/libc.
Co-authored-by: Ryan Zoeller <rtzoeller@rtzoeller.com>
|
|
|
|
1567: Recent versions of Android support EPOLLEXCLUSIVE r=rtzoeller a=rtzoeller
[Corresponding libc change](https://github.com/rust-lang/libc/commit/36be4cd4f65c326f2a30d3afee50db78c014f07f).
Enable the epoll tests on Android, because they are passing.
Co-authored-by: Ryan Zoeller <rtzoeller@rtzoeller.com>
|
|
Enable epoll tests on Android, because they are passing.
|
|
1577: DragonFly 6.0 added fexecve(2) r=rtzoeller a=rtzoeller
Enable `fexecve()` on DragonFly, as it was added in the 6.0 release.
Co-authored-by: Ryan Zoeller <rtzoeller@rtzoeller.com>
|
|
Within UnixAddr, replace the path_len variable (length of the sun_path
field) with sun_len (length of the whole structure). This is more
similar to how other sockaddr types work, and it's the same way that the
BSDs use the sun_len field.
Also, don't require that sun_path be nul-terminated. The OS doesn't
require it.
|
|
1571: Remove broken newlib support r=rtzoeller a=asomers
Nix has never supported a newlib target, but there were a few cfg checks
for it in our codebase. Some of them were misspelled (newlibc vs
newlib), and some of the checks were wrong. Removing them makes the
code much more readable.
Co-authored-by: Alan Somers <asomers@gmail.com>
|
|
|
|
1583: Remove unsafe in with_nix_path() for [u8] r=asomers a=rtzoeller
Remove use of `unsafe` in the implementation of `with_nix_path()` for `[u8]`. This also comes with a nice determinism win across input sizes, and is fairly performance neutral (slightly slower for small strings, much faster for large strings).
I suspect the performance degradation in the existing implementation is related to the following note in the `CStr::from_ptr()` documentation:
> Note: This operation is intended to be a 0-cost cast but it is currently implemented with an up-front calculation of the length of the string. This is not guaranteed to always be the case.
---
Tested with `cargo 1.57.0-nightly (7fbbf4e8f 2021-10-19)`, with variations of the following benchmarking code:
```rs
#[bench]
fn bench_with_nix_path_1024(b: &mut test::Bencher) {
let bytes = std::hint::black_box([70u8; 1024]);
b.iter(|| {
bytes.with_nix_path(|cstr| {
std::hint::black_box(&cstr);
}).unwrap();
})
}
```
| Length | Before Change | After Change |
|--------|-----------------------|-----------------------|
| 16 | 37 ns/iter (+/- 0) | 44 ns/iter (+/- 0) |
| 64 | 39 ns/iter (+/- 0) | 44 ns/iter (+/- 0) |
| 256 | 84 ns/iter (+/- 0) | 48 ns/iter (+/- 0) |
| 1024 | 232 ns/iter (+/- 1) | 50 ns/iter (+/- 1) |
| 4095 | 796 ns/iter (+/- 8) | 62 ns/iter (+/- 2) |
Co-authored-by: Ryan Zoeller <rtzoeller@rtzoeller.com>
|
|
* All sockaddr newtypes should be repr(transparent)
* All sockaddr newtypes should be opaque, so the user can't do something
like change the sa_family field in a way that violates invariants.
This is a prerequisite for #1544.
|