1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27
//! Linux `statx`.
use crate::{imp, io, path};
use imp::fd::AsFd;
use imp::fs::{AtFlags, Statx};
/// `STATX_*` constants.
pub use imp::fs::StatxFlags;
/// `statx(dirfd, path, flags, mask, statxbuf)`
///
/// Note that this isn't available on Linux before 4.11; returns `ENOSYS` in
/// that case.
///
/// # References
/// - [Linux]
///
/// [Linux]: https://man7.org/linux/man-pages/man2/statx.2.html
#[inline]
pub fn statx<P: path::Arg, Fd: AsFd>(
dirfd: Fd,
path: P,
flags: AtFlags,
mask: StatxFlags,
) -> io::Result<Statx> {
path.into_with_z_str(|path| imp::fs::syscalls::statx(dirfd.as_fd(), path, flags, mask))
}