Fix hurd build (#1064)
authorSamuel Thibault <samuel.thibault@ens-lyon.org>
Tue, 28 May 2024 16:20:53 +0000 (18:20 +0200)
committerFabian Grünbichler <debian@fabian.gruenbichler.email>
Tue, 29 Oct 2024 12:18:35 +0000 (13:18 +0100)
Forwarded: https://github.com/bytecodealliance/rustix/pull/1064

Gbp-Pq: Topic vendor
Gbp-Pq: Name u-hurd-rustix.patch

vendor/rustix-0.38.34/src/fs/mod.rs

index a4282088ef9e9ea56aee504454d249f123ae8b21..110cf79b88a6ab84249f99ad67d661225f1b47a1 100644 (file)
@@ -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
+    }
+}