File: use-timespec-new.patch

package info (click to toggle)
rust-laurel 0.6.5-1
  • links: PTS, VCS
  • area: main
  • in suites: sid, trixie
  • size: 944 kB
  • sloc: ansic: 3,553; makefile: 65; sh: 50
file content (25 lines) | stat: -rw-r--r-- 1,149 bytes parent folder | download
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
Description: Use TimeSpec::new( instead of TimeSpec::from(libc::timespec {
 The time64 patches to rust-libc add padding to the libc::timespec structure
 meaning it can no longer be created by structure instantiation. rust-nix
 already contains code that avoids this problem, so lets use it.
Author: Peter Michael Green <plugwash@debian.org>

Index: laurel/src/procfs.rs
===================================================================
--- laurel.orig/src/procfs.rs
+++ laurel/src/procfs.rs
@@ -149,10 +149,10 @@ pub(crate) fn parse_proc_pid(pid: u32) -
 
     // Use the boottime-based clock to calculate process start
     // time, convert to Unix-epoch-based-time.
-    let proc_boottime = TimeSpec::from(libc::timespec {
-        tv_sec: (starttime / *CLK_TCK) as _,
-        tv_nsec: ((starttime % *CLK_TCK) * (1_000_000_000 / *CLK_TCK)) as _,
-    });
+    let proc_boottime = TimeSpec::new(
+        (starttime / *CLK_TCK) as _,
+        ((starttime % *CLK_TCK) * (1_000_000_000 / *CLK_TCK)) as _,
+    );
     #[cfg(not(target_os = "linux"))]
     let proc_age = TimeSpec::from(std::time::Duration::ZERO);
     #[cfg(target_os = "linux")]