fix nu-system build on arm64 FreeBSD (#13196)

# 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.
This commit is contained in:
Devyn Cairns 2024-06-21 03:03:10 -07:00 committed by GitHub
parent 4c82a748c1
commit 9845d13347
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -1,6 +1,7 @@
use itertools::{EitherOrBoth, Itertools}; use itertools::{EitherOrBoth, Itertools};
use libc::{ 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::{ use std::{
ffi::CStr, ffi::CStr,
@ -16,7 +17,7 @@ pub struct ProcessInfo {
pub ppid: i32, pub ppid: i32,
pub name: String, pub name: String,
pub argv: Vec<u8>, pub argv: Vec<u8>,
pub stat: i8, pub stat: c_char,
pub percent_cpu: f64, pub percent_cpu: f64,
pub mem_resident: u64, // in bytes pub mem_resident: u64, // in bytes
pub mem_virtual: u64, // in bytes pub mem_virtual: u64, // in bytes