We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 2abfdb4 commit 1f69c1dCopy full SHA for 1f69c1d
src/sys/sysinfo.rs
@@ -10,6 +10,12 @@ use crate::errno::Errno;
10
#[repr(transparent)]
11
pub struct SysInfo(libc::sysinfo);
12
13
+// The fields are c_ulong on 32-bit linux, u64 on 64-bit linux; x32's ulong is u32
14
+#[cfg(all(target_arch = "x86_64", target_pointer_width = "32"))]
15
+type mem_blocks_t = u64;
16
+#[cfg(not(all(target_arch = "x86_64", target_pointer_width = "32")))]
17
+type mem_blocks_t = libc::c_ulong;
18
+
19
impl SysInfo {
20
/// Returns the load average tuple.
21
///
@@ -58,7 +64,7 @@ impl SysInfo {
58
64
self.scale_mem(self.0.freeram)
59
65
}
60
66
61
- fn scale_mem(&self, units: libc::c_ulong) -> u64 {
67
+ fn scale_mem(&self, units: mem_blocks_t) -> u64 {
62
68
units as u64 * self.0.mem_unit as u64
63
69
70
0 commit comments