Skip to content

Commit

Permalink
fix nu-system build on arm64 FreeBSD (#13196)
Browse files Browse the repository at this point in the history
# Description

Fixes #13194

`ki_stat` is supposed to be a `c_char`, but was defined was `i8`.
Unfortunately, `c_char` is `u8` on Aarch64 (on all platforms), so this
doesn't compile. I fixed it to use `c_char` instead.

Double checked whether NetBSD is affected, but the `libc` code defines
it as `i8` for some reason (erroneously, really) but that doesn't matter
too much. Anyway should be ok there.

Confirmed to be working.
  • Loading branch information
devyn committed Jun 21, 2024
1 parent 4c82a74 commit 9845d13
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions crates/nu-system/src/freebsd.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
use itertools::{EitherOrBoth, Itertools};
use libc::{
kinfo_proc, sysctl, CTL_HW, CTL_KERN, KERN_PROC, KERN_PROC_ALL, KERN_PROC_ARGS, TDF_IDLETD,
c_char, kinfo_proc, sysctl, CTL_HW, CTL_KERN, KERN_PROC, KERN_PROC_ALL, KERN_PROC_ARGS,
TDF_IDLETD,
};
use std::{
ffi::CStr,
Expand All @@ -16,7 +17,7 @@ pub struct ProcessInfo {
pub ppid: i32,
pub name: String,
pub argv: Vec<u8>,
pub stat: i8,
pub stat: c_char,
pub percent_cpu: f64,
pub mem_resident: u64, // in bytes
pub mem_virtual: u64, // in bytes
Expand Down

0 comments on commit 9845d13

Please sign in to comment.