1From 56984b19469ff5b69b8b8e180dc75cf825bb1123 Mon Sep 17 00:00:00 2001
2From: Khem Raj <raj.khem@gmail.com>
3Date: Tue, 25 Jan 2022 22:28:11 -0800
4Subject: [PATCH] check for mips targets for stat.st_dev definitions
5
6st_dev has wrong type in glibc when using mips/O32 ABI
7its type should be dev_t but it is set to unsigned long int
8this is specific issue on mips/o32 ABI in glibc for details
9
10See
11https://sourceware.org/bugzilla/show_bug.cgi?id=17786
12
13currently the build fails on mips archirecture with type mismatches
14
15      Fixes
16      error[E0308]: mismatched types
17*        --> /usr/src/debug/python3-pyruvate/1.1.2-r0/cargo_home/bitbake/libsystemd-0.4.1/src/logging.rs:296:25
18          |
19      296 |                 device: stat.st_dev,
20          |                         ^^^^^^^^^^^ expected `u64`, found `u32`
21
22Drop this patch when libsystemd-rs crate bumps to 0.6.0+
23
24Upstream-Status: Backport [https://github.com/lucab/libsystemd-rs/pull/104]
25Signed-off-by: Khem Raj <raj.khem@gmail.com>
26---
27 src/logging.rs | 3 +++
28 1 file changed, 3 insertions(+)
29
30diff --git a/src/logging.rs b/src/logging.rs
31index a68c36a..6e374ae 100644
32--- a/src/logging.rs
33+++ b/src/logging.rs
34@@ -292,7 +292,10 @@ impl JournalStream {
35     pub fn from_fd<F: AsRawFd>(fd: F) -> std::io::Result<Self> {
36         nix::sys::stat::fstat(fd.as_raw_fd())
37             .map(|stat| JournalStream {
38+                #[cfg(not(target_arch = "mips"))]
39                 device: stat.st_dev,
40+                #[cfg(target_arch = "mips")]
41+                device: stat.st_dev as u64,
42                 inode: stat.st_ino,
43             })
44             .map_err(std::io::Error::from)
45--
462.35.0
47
48