* Correctly handle possibly misaligned pointers in readdir This reapplies #615, which was inadvertently reverted. * Tidy up unneeded `self::` qualifiers. * Make Dir's contents private. Also remove the `unsafe` from `impl_iter`. With `Dir`'s field being private, we can rely on the pointer being only what we've assigned to it. * Make `poll`'s timeout argument a `libc::c_int`. This clarifies that there are no subsequent conversions before calling the underlying libc API. * Use clock_gettime instead of clock_getres to get the time. * Mark FileType::from_raw as safe. It handles unknown values, so it can be marked safe.
29 lines
825 B
Rust
29 lines
825 B
Rust
use crate::{dir::SeekLoc, Result};
|
|
use cfg_if::cfg_if;
|
|
|
|
cfg_if! {
|
|
if #[cfg(any(target_os = "linux",
|
|
target_os = "android"))] {
|
|
mod linux;
|
|
pub(crate) use linux::*;
|
|
} else if #[cfg(target_os = "emscripten")] {
|
|
mod emscripten;
|
|
pub(crate) use emscripten::*;
|
|
} else if #[cfg(any(target_os = "macos",
|
|
target_os = "ios",
|
|
target_os = "freebsd",
|
|
target_os = "netbsd",
|
|
target_os = "openbsd",
|
|
target_os = "dragonfly"))] {
|
|
mod bsd;
|
|
pub(crate) use bsd::*;
|
|
} else {
|
|
compile_error!("yanix doesn't compile for this platform yet");
|
|
}
|
|
}
|
|
|
|
pub trait EntryExt {
|
|
fn ino(&self) -> u64;
|
|
fn seek_loc(&self) -> Result<SeekLoc>;
|
|
}
|