Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/driver/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ impl Inner {
self.uring.submission().sync();
return Ok(());
}
Err(ref e) if e.kind() == io::ErrorKind::Other => {
Err(ref e) if e.raw_os_error() == Some(libc::EBUSY) => {
self.tick();
}
Err(e) => {
Expand Down
4 changes: 4 additions & 0 deletions src/driver/op.rs
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,10 @@ pub(crate) struct Op<T: 'static> {
pub(crate) struct Completion<T> {
pub(crate) data: T,
pub(crate) result: io::Result<u32>,
#[cfg_attr(
not(test), // the field is currently only read in tests
allow(dead_code)
)]
pub(crate) flags: u32,
}

Expand Down
6 changes: 4 additions & 2 deletions src/fs/directory.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,10 @@ use std::path::Path;
///
/// fn main() -> Result<(), Box<dyn std::error::Error>> {
/// tokio_uring::start(async {
/// remove_dir("/some/dir")?;
/// });
/// remove_dir("/some/dir").await?;
/// Ok::<(), std::io::Error>(())
/// })?;
/// Ok(())
/// }
/// ```
pub async fn remove_dir<P: AsRef<Path>>(path: P) -> io::Result<()> {
Expand Down
8 changes: 5 additions & 3 deletions src/fs/file.rs
Original file line number Diff line number Diff line change
Expand Up @@ -349,12 +349,14 @@ impl fmt::Debug for File {
/// # Examples
///
/// ```no_run
/// use tokio_uring::fs::remove_dir;
/// use tokio_uring::fs::remove_file;
///
/// fn main() -> Result<(), Box<dyn std::error::Error>> {
/// tokio_uring::start(async {
/// remove_file("/some/file.txt")?;
/// });
/// remove_file("/some/file.txt").await?;
/// Ok::<(), std::io::Error>(())
/// })?;
/// Ok(())
/// }
/// ```
pub async fn remove_file<P: AsRef<Path>>(path: P) -> io::Result<()> {
Expand Down
3 changes: 1 addition & 2 deletions tests/fs_file.rs
Original file line number Diff line number Diff line change
Expand Up @@ -138,13 +138,12 @@ async fn poll_once(future: impl std::future::Future) {

fn assert_invalid_fd(fd: RawFd) {
use std::fs::File;
use std::io;

let mut f = unsafe { File::from_raw_fd(fd) };
let mut buf = vec![];

match f.read_to_end(&mut buf) {
Err(ref e) if e.kind() == io::ErrorKind::Other => {}
Err(ref e) if e.raw_os_error() == Some(libc::EBADF) => {}
res => panic!("{:?}", res),
}
}