-
Notifications
You must be signed in to change notification settings - Fork 677
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
715: Fix multiple issues with POSIX AIO r=asomers a=asomers Fixed error handling in `AioCb::fsync`, `AioCb::read`, and `AioCb::write` Previously, the `AioCb`'s `in_progress` field would erroneously be set to `true`, even if the syscall had an error Fixes #714 AioCb::Drop will now panic for in-progress AioCb 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.
- Loading branch information
Showing
5 changed files
with
109 additions
and
54 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
extern crate nix; | ||
extern crate tempfile; | ||
|
||
use nix::sys::aio::*; | ||
use nix::sys::signal::*; | ||
use std::os::unix::io::AsRawFd; | ||
use tempfile::tempfile; | ||
|
||
// Test dropping an AioCb that hasn't yet finished. | ||
// This must happen in its own process, because on OSX this test seems to hose | ||
// the AIO subsystem and causes subsequent tests to fail | ||
#[test] | ||
#[should_panic(expected = "Dropped an in-progress AioCb")] | ||
#[cfg(not(target_env = "musl"))] | ||
fn test_drop() { | ||
const WBUF: &'static [u8] = b"CDEF"; | ||
|
||
let f = tempfile().unwrap(); | ||
f.set_len(6).unwrap(); | ||
let mut aiocb = AioCb::from_slice( f.as_raw_fd(), | ||
2, //offset | ||
&WBUF, | ||
0, //priority | ||
SigevNotify::SigevNone, | ||
LioOpcode::LIO_NOP); | ||
aiocb.write().unwrap(); | ||
} |