Age | Commit message (Collapse) | Author |
|
|
|
Using features reduces build time and size for consumer crates. By
default all features are enabled.
|
|
And this time, start running Clippy in CI
|
|
Also, test rustdoc in CI, and demote missing_docs from a deny to a
warning (but still deny it in CI).
|
|
Switch from allow(missing_docs) to deny(missing_docs), which should
gradually help us moving forward. Also, add a few missing docs, such as
for sched and aio.
|
|
Since libc may add new variants at any time, Nix's consumers should not
use exhaustive match patterns.
Fixes #1182
|
|
Now that Nix's weird error types are eliminated, there's no reason not
to simply use Errno as the Error type.
|
|
For many of Nix's consumers it be convenient to easily convert a Nix
error into a std::io::Error. That's currently not possible because of
the InvalidPath, InvalidUtf8, and UnsupportedOperation types that have
no equivalent in std::io::Error.
However, very few of Nix's public APIs actually return those unusual
errors. So a more useful API would be for Nix's standard error type to
implement Into<std::io::Error>.
This commit makes Error a simple NewType around Errno. For most
functions it's a drop-in replacement. There are only three exceptions:
* clearenv now returns a bespoke error type. It was the only Nix
function whose error couldn't be cleanly mapped onto an Errno.
* sys::signal::signal now returns Error(Errno::ENOTSUP) instead of
Error::UnsupportedOperation when the user passes an incompatible
argument to `handler`.
* When a NixPath exceeds PATH_MAX, it will now return
Error(Errno::ENAMETOOLONG) instead of Error::InvalidPath.
In the latter two cases there is now some abiguity about whether the
error code was generated by Nix or by the OS. But I think the ambiguity
is worth it for the sake of being able to implement Into<io::Error>.
This commit also introduces Error::Sys() as a migration aid. Previously
that as an enum variant. Now it's a function, but it will work in many
of the same contexts as the original.
Fixes #1155
|
|
|
|
* Fix race conditions in the tests. Two tests were grabbing a mutex but
immediately dropping it. Thank you, Clippy.
* Remove vestigial Windows support. Remove some code added to support
Windows in 2015. Nix is no longer intended to ever run on Windows.
* Various other minor Clippy lints.
|
|
* libc::aiocb must not be moved while the kernel has a pointer to it.
This change enforces that requirement by using std::pin.
* Split LioCbBuilder out of LioCb. struct LioCb relied on the
(incorrect) assumption that a Vec's elements have a stable location in
memory. That's not true; they can be moved during Vec::push. The
solution is to use a Vec in the new Builder struct, but finalize it to
a boxed slice (which doesn't support push) before allowing it to be
submitted to the kernel.
* Eliminate owned buffer types. mio-aio no longer uses owned buffers
with nix::aio. There's little need for it in the world of
async/await. I'm not aware of any other consumers. This
substantially simplifies the code.
|
|
|
|
|
|
|
|
|
|
* Replace obsolete range syntax "..." with inclusive range "..="
* Use dyn Trait syntax instead of Box<Trait>
* Raise MSRV to 1.27.0 (for dyn Trait syntax)
* Raise MSRV to 1.31.0 (because of rand)
tempfile pulls in rand, and rand pulls in fuchsia-cprng, which requires
1.31.0. Why rand pulls in fuchsia-cprng I don't know. It's specified
as a target-specific dependency, but Cargo tries to build it anyway
(only on Linux, not on FreeBSD or OSX). A bug in Cargo 1.27.0?
|
|
Derive Clone, Copy, Eq, Hash, and PartialEq for all types. Not all
traits are supported by all types, which is why many are missing
some.
|
|
I previously advocated for the latter syntax on stylistic grounds. But
it generates less efficient code, because it creates a new lambda
function for each usage. The optimizer does not combine them. This
change saves about 6KB of code.
|
|
It helps deal with errors like EAGAIN, which can result in a subset of
an LioCb's operations being queued. The test is only enabled on
FreeBSD, because it requires intimate knowledge of AIO system limits.
|
|
Supporting the bytes crate was unnecessarily specific. This change
replaces from_bytes and from_bytes_mut with from_boxed_slice and
from_boxed_mut_slice, which can work with anything that implements
Borrow<[u8]> and BorrowMut<[u8]>, respectively.
|
|
A double panic can screw up the first panic's stack trace. Better not
to assert! anything when the thread is already panicing.
|
|
The new LioCb structure allows us to control the exact arguments passed
to lio_listio, guaranteeing that each call gets a unique storage
location for the list argument. This prevents clients from misusing
lio_listio in a way that causes events to get dropped from a kqueue
Fixes #870
|
|
|
|
|
|
|
|
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
|
|
|
|
|
|
806: Cleanup all doc warnings r=asomers a=Susurrus
With the impending switch to Pulldown as the default doc generator, warnings
have been enabled for incompatible syntax. This fixes all of said warnings.
|
|
With the impending switch to Pulldown as the default doc generator, warnings
have been enabled for incompatible syntax. This fixes all of said warnings.
|
|
cc #664 (unsure if this is everything needed)
|
|
Bitrig is in the process of re-merging with OpenBSD as is no longer
actively developed. Additionally it was never tested, and probably
was quite broken, for nix. So let's remove all references and not
even pretend to support it.
|
|
|
|
Some enums which use different names for values than libc still set the
discriminators manually.
closes #254
|
|
|
|
Previously, the `AioCb`'s `in_progress` field would erroneously be set
to `true`, even if the syscall had an error
Fixes #714
|
|
Printing a warning message to stderr isn't really appropriate, because
there's no way to guarantee that stderr is even valid. Nor is
aio_suspend necessarily an appropriate action to take.
|
|
These were exported for some weird reason and then left in
for documentation. Also some parts of certain modules used
them and others used the libc:: prefix. This was removed to
improve the docs and also code consistency
|
|
The existing AioCb constructors work for simple programs where
everything is stored on the stack. But in more complicated programs the
borrow checker can't prove that a buffer will outlive the AioCb that
references it. Fix this problem by introducting
AioCb::from_boxed_slice, which takes a reference-counted buffer.
Fixes #575
|
|
Also, fix style bug in AIO tests
|
|
|
|
If an AioCb has any in-kernel state, AioCb.drop will print a warning and
wait for it to complete.
|
|
Prevent immutable buffers from being used with aio_read or lio_listio
with LIO_READ. AioCb.from_slice no longer needs to be unsafe.
|
|
|
|
|
|
POSIX AIO is a standard for asynchronous file I/O. Read, write, and
fsync operations can all take place in the background, with completion
notification delivered by a signal, by a new thread, by kqueue, or not
at all. This commit supports all standard AIO functions. However,
lio_listio is disabled on macos because it doesn't seem to work, even
though the syscall is present.
The SigEvent class, used for AIO notifications among other things, is
also added.
Also, impl AsRef for TimeVal and TimeSpec
|