Age | Commit message (Collapse) | Author |
|
820: Change AioCb to primarily use Bytes instead of Rc<[u8]> r=Susurrus a=asomers
`Rc<[u8]>` isn't a very good buffer type to use for aio. For one thing, it lacks interior mutability. For another, a single `Rc<[u8]>` can't be carved up into smaller buffers of the same type. `Bytes` and `BytesMut` fix both problems. This PR removes the ability to construct an `AioCb` from `Rc<[u8]>` and adds the ability to construct one from `Bytes`, `BytesMut`, or raw pointers (for consumers who need even more flexibility). At this stage, the PR has the following warts:
1. A hack is necessary to force small `Bytes` buffers to allocate on the heap. I plan to fix this with an enhancement to the bytes crate.
2. The `AioCb::buffer` method is necessary due to a deficiency in the tokio-core crate. Once I fix that, then only `AioCb::into_buffer`will need to be public.
|
|
|
|
|
|
It's not actually safe to read into an `Rc<[u8]>`. It only worked
because of a coincidental `unsafe` block. Replace that type with
`BytesMut` from the bytes crate. For consistency's sake, use `Bytes`
for writing too, and completely remove methods relating to `Rc<[u8]>`.
Note that the `AioCb` will actually own the `BytesMut` object. The
caller must call `into_buffer` to get it back once the I/O is complete.
Fixes #788
|
|
|
|
`pause` will always return `-1` as a result and sets `errno` to
`EINTR`, which indicates that a signal was caught by the process. Since
this is the point of `pause` return an error here makes little sense.
Closes #827.
|
|
|
|
|
|
More Rusty to use &X and &mut X where X is a container type.
|
|
|
|
Reads a little bit easier
|
|
|
|
Looks like a copy/paste error might have caused this
|
|
|
|
Makes it more clear what's being cloned
|
|
|
|
|
|
|
|
|
|
|
|
It's unclear why these were static in the first place.
|
|
As of Rust 1.17 'static lifetimes are implied when
declaring consts.
|
|
|
|
|
|
A little easier to read
|
|
Several tests make the assumption that all data is written, which
is not guaranteed with write(), so use write_all() instead.
|
|
799: Fix nix on Dragonfly r=Susurrus a=mneumann
This commit replaces pull request https://github.com/nix-rust/nix/pull/684. It fixes building `nix` on DragonFly. All tests pass. This requires most recent libc to build: https://github.com/rust-lang/libc/pull/851.
|
|
* DragonFly does not have a O_DSYNC flag
* Fix type_of_cmsg_data on DragonFly
* No fexecve() on DragonFly
* Do not run aio test cases on DragonFly
* Keep target lists in alphabetical order
* Unscrable #[cfg] directives and use cfg_if! macro instead
* Fix errno on DragonFly
Below follows an explanation why we have to use a C extension
to get errno working on DragonFly:
DragonFly uses a thread-local errno variable, but #[thread_local] is
feature-gated and not available in stable Rust as of this writing (Rust
1.21.0). We have to use a C extension (src/errno_dragonfly.c) to access
it.
Tracking issue for `thread_local` stabilization:
https://github.com/rust-lang/rust/issues/29594
Once this becomes stable, we can remove build.rs, src/errno_dragonfly.c,
remove the build-dependency from Cargo.toml, and use:
extern {
#[thread_local]
static errno: c_int;
}
Now all targets will use the build.rs script, but only on DragonFly this
will do something. Also, there are no additional dependencies for
targets other than DragonFly (no gcc dep).
|
|
741: Expose `decode` on `WaitStatus` and make it return a `Result` r=Susurrus a=rocallahan
Closes #740.
|
|
807: Switch to libc definitons of errno constants r=Susurrus a=Susurrus
Still need to do OpenBSD and NetBSD. Primary goal with this first pass is to see what doesn't exist properly in `libc`.
Closes #487.
|
|
777: Use the real pipe2(2) on most targets r=asomers a=asomers
FreeBSD added pipe2(2) in version 10.0.
|
|
All supported non-Apple platforms now use the native syscall. Only ios
and macos lack it. Deprecate pipe2 on those platforms, because it's
impossible to guarantee atomicity with a userland implementation. It
was added in:
* DragonflyBSD 4.2
* FreeBSD 10.0
* NetBSD 6.0
* OpenBSD 5.7
|
|
This was doing testing for errno constants and a few other
types that is no longer necessary now that these types are
all tested within the libc project itself.
|
|
|
|
cc #664 (unsure if this is everything needed)
|
|
The libc_bitflags! macro was replaced with a non-recursive one supporting
only public structs. I could not figure out how to make the old macro work
with the upgrade, so I reworked part of the bitflags! macro directly to suit
our needs, much as the original recursive macro was made. There are no uses
of this macro for non-public structs, so this is not a problem for internal code.
|
|
This adds execveat() to `nix::unistd`. It uses the execveat(2) Linux
kernel syscall, which is available since 3.19.
This is a Linux-specific extension which is not covered by POSIX and
does not have any userland libc wrapper.
Ref: http://man7.org/linux/man-pages/man2/execveat.2.html
|
|
This introduces an `as_abstract()` getter to `UnixAddr` in order to
retrieve the name of an abstract unix socket.
This also adds tests around abstract addresses and clarify docs,
adding explicit semantics.
|
|
|
|
Fix groups mutex name
|
|
|
|
|
|
|
|
780: Add a test for ppoll r=Susurrus a=asomers
|
|
|
|
|
|
|
|
773: Add more accessors for AioCb r=asomers a=asomers
|
|
This fixes the following warning during run of cargo test
warning: variable does not need to be mutable
--> test/sys/test_aio.rs:16:13
|
16 | fn poll_aio(mut aiocb: &mut AioCb) -> Result<()> {
| ^^^^^^^^^
|
= note: #[warn(unused_mut)] on by default
|
|
|