Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix hurd build #1064

Merged
merged 2 commits into from
May 28, 2024
Merged
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
26 changes: 24 additions & 2 deletions src/fs/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,7 @@ pub use std::os::wasi::fs::{DirEntryExt, FileExt, FileTypeExt, MetadataExt, Open
/// the Unix epoch. Until the next semver bump, these unsigned fields are
/// deprecated, and this trait provides accessors which return their values
/// as signed integers.
#[cfg(all(unix, not(any(target_os = "aix", target_os = "nto"))))]
#[cfg(all(unix))]
pub trait StatExt {
/// Return the value of the `st_atime` field, casted to the correct type.
fn atime(&self) -> i64;
Expand All @@ -160,7 +160,10 @@ pub trait StatExt {
fn ctime(&self) -> i64;
}

#[cfg(all(unix, not(any(target_os = "aix", target_os = "nto"))))]
#[cfg(all(
unix,
not(any(target_os = "aix", target_os = "hurd", target_os = "nto"))
))]
#[allow(deprecated)]
impl StatExt for Stat {
#[inline]
Expand All @@ -178,3 +181,22 @@ impl StatExt for Stat {
self.st_ctime as i64
}
}

#[cfg(any(target_os = "aix", target_os = "hurd", target_os = "nto"))]
#[allow(deprecated)]
impl StatExt for Stat {
#[inline]
fn atime(&self) -> i64 {
self.st_atim.tv_sec as i64
}

#[inline]
fn mtime(&self) -> i64 {
self.st_mtim.tv_sec as i64
}

#[inline]
fn ctime(&self) -> i64 {
self.st_ctim.tv_sec as i64
}
}
Loading