From: Samuel Thibault <samuel.thibault@ens-lyon.org>
Date: Tue May 28 18:20:53 2024 +0200
Subject: Fix hurd build (#1064)

Forwarded: https://github.com/bytecodealliance/rustix/pull/1064
---
commit 3346526711e885611c770ad09764b8ff8d2924ce
Author: Samuel Thibault <samuel.thibault@ens-lyon.org>
Date:   Tue May 28 18:20:53 2024 +0200

    Fix hurd build (#1064)
    
    * hurd: Fix build
    
    6ec74e03c8ba ("Fix handling of negative timestamps in `Stat`. (#999)") broke
    the hurd build, where we have a st_[acm]tim timespec instead of st_[acm],
    like on aix and nto.
    
    * aix, nto, hurd: Implement impl StatExt

diff --git a/vendor/rustix/src/fs/mod.rs b/vendor/rustix/src/fs/mod.rs
index a4282088..110cf79b 100644
--- a/vendor/rustix/src/fs/mod.rs
+++ b/vendor/rustix/src/fs/mod.rs
@@ -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;
@@ -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]
@@ -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
+    }
+}
