summaryrefslogtreecommitdiff
path: root/src/sys/aio.rs
AgeCommit message (Collapse)Author
2020-05-31Convert the crate to edition 2018Alan Somers
2019-12-01Reenable a test that had been disabled due to old CI infrastructureAlan Somers
2019-08-29Clippy cleanupAlan Somers
2019-07-13Fix warnings on Rust 1.37.0Alan Somers
* 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?
2019-06-09Add extra traits for all typesBryant Mairs
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.
2018-11-28Prefer `map(drop)` to `map(|_| ())`Alan Somers
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.
2018-04-06Add LioCb::listio_resubmitAlan Somers
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.
2018-03-22Replace AioCb::from_bytes with more generic from_boxed_sliceAlan Somers
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.
2018-03-22Fix an annoying double panicAlan Somers
A double panic can screw up the first panic's stack trace. Better not to assert! anything when the thread is already panicing.
2018-03-22Change sys::aio::lio_listio to sys::aio::LioCb::listioAlan Somers
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
2018-01-28Fail to compile for any unused codeBryant Mairs
2018-01-15aio: more documentationAlan Somers
2018-01-15aio: Clippy cleanupAlan Somers
2018-01-15aio: use `Bytes` instead of `Rc<[u8]>`Alan Somers
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
2018-01-15Add AioCb::from_ptr and AioCb::from_mut_ptrAlan Somers
2017-12-20Use implicit returnsBryant Mairs
2017-12-11Merge #806bors[bot]
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.
2017-12-10Cleanup doc warningsBryant Mairs
With the impending switch to Pulldown as the default doc generator, warnings have been enabled for incompatible syntax. This fixes all of said warnings.
2017-12-04Stop reexporting `Errno` and its variantsJonas Schievink
cc #664 (unsure if this is everything needed)
2017-11-16Remove bitrig #[cfgsBryant Mairs
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.
2017-11-11Alphabetize some target_os configurationsWolfgang Ginolas
2017-11-05Use libc_enum! where possibleWolfgang Ginolas
Some enums which use different names for values than libc still set the discriminators manually. closes #254
2017-10-02Add more accessors for AioCbAlan Somers
2017-09-03Fixed error handling in `AioCb::{fsync,read,write}`Alan Somers
Previously, the `AioCb`'s `in_progress` field would erroneously be set to `true`, even if the syscall had an error Fixes #714
2017-09-03AioCb::Drop will now panic for in-progress AioCbAlan Somers
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.
2017-07-19Remove c_int and c_void from rootBryant Mairs
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
2017-04-15Add AioCb::from_boxed_sliceAlan Somers
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
2017-02-24impl Debug for AioCb and SigevNotifyAlan Somers
Also, fix style bug in AIO tests
2017-02-16Fix some identifiers in commentsAlan Somers
2017-02-05Implement Drop for AioCbAlan Somers
If an AioCb has any in-kernel state, AioCb.drop will print a warning and wait for it to complete.
2017-02-05Add runtime checks to AioCb methodsAlan Somers
Prevent immutable buffers from being used with aio_read or lio_listio with LIO_READ. AioCb.from_slice no longer needs to be unsafe.
2017-01-26Turn most aio functions into AioCb methodsAlan Somers
2017-01-25Add PhantomData to AioCb to track buffer's lifetimeAlan Somers
2016-12-16Add POSIX AIO supportAlan Somers
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