feat: update sysinfo from forked 0.15.x to official 0.37#176
Closed
bvaisvil wants to merge 8 commits into
Closed
Conversation
Migrate from the forked sysinfo (zenith_changes_15.1_mem_fix branch) to the official sysinfo 0.37 crate from crates.io. Key changes: - Remove *Ext traits (SystemExt, ProcessExt, DiskExt, etc.) - methods are now directly on structs - Rename Processor to Cpu, get_processors() to cpus() - Add separate Components, Disks, Networks types to CPUTimeApp - Update all method calls (get_* prefix removed) - Handle Option<f32> return types for temperature/max - Convert Pid wrapper type to i32 for internal use - Use procfs crate on Linux for priority, nice, threads_total (these fields were removed from sysinfo) Note: On macOS, priority/nice/threads_total default to 0/0/1 as these fields are not available in sysinfo 0.37. A TODO comment marks this for future platform-specific implementation.
093af69 to
aefed5c
Compare
4439375 to
2d9dcb6
Compare
- Remove empty lines after doc comments - Use is_multiple_of() instead of manual modulo check - Use is_some_and() instead of map_or(false, ...) - Remove unused lifetime parameter - Add #[allow] for too_many_arguments on existing functions
The Equal variant from Ordering is used in Linux-specific field comparators but was accidentally removed. Add #[allow(unused_imports)] since it's only used on Linux.
Use libc::getpriority() to get the nice value and proc_pidinfo() with PROC_PIDTASKINFO to get the thread count on macOS. This removes the TODO comments and provides full functionality on both Linux and macOS for these process fields.
Instead of calculating priority from nice value, use the actual pti_priority field from ProcTaskInfo. Also properly handle getpriority errors by checking errno.
0d1ed0c to
7a39007
Compare
…, with fallback to sysconf(_SC_PAGESIZE)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Migrate zenith from the forked sysinfo crate (
zenith_changes_15.1_mem_fixbranch) to the official sysinfo 0.37 from crates.io.libc::getpriority()andproc_pidinfo()for priority, nice, threads_totalChanges
Cargo.toml
sysinfofrom git fork tosysinfo = "0.37"procfs = "0.17"for Linux (to get priority, nice, threads_total)src/metrics/mod.rs
*Exttraits, addedComponents,Disks,Networkscomponents,disks_cache,networksget_*→ no prefix)get_macos_process_info()src/metrics/zprocess.rs
from_user_and_process()signature to acceptuidparameterlibc::getpriority()andproc_pidinfo()ProcessStatusExtimplementation (single match for all platforms)ProcessStatusvariants:UninterruptibleDiskSleep,LockBlockedsrc/metrics/disk.rs
DiskExttrait importPlatform Support
prioritynicethreads_totalTest plan
cargo build --releasesucceeds on macOScargo build --releaseon Linux (CI)cargo clippypassescargo fmtpasses🤖 Generated with Claude Code