Bump procfs to 0.16.0 (#11115)

Fix the breaking changes.
Get's rid of some outdated transitive dependencies.
Sadly we need to expose more of `procfs` to `nu-command` based on how
the features of `nu-system` are exposed right now.

Conditional compilation/dependencies from hell included

Supersedes #11101
This commit is contained in:
Stefan Holderbach
2023-11-20 21:22:35 +01:00
committed by GitHub
parent 869b01205c
commit 8ad5d8bb6a
5 changed files with 37 additions and 36 deletions

View File

@ -21,7 +21,7 @@ sysinfo = "0.29"
nix = { version = "0.27", default-features = false, features = ["fs", "term", "process", "signal"] }
[target.'cfg(any(target_os = "linux", target_os = "android"))'.dependencies]
procfs = "0.15"
procfs = "0.16"
[target.'cfg(target_os = "macos")'.dependencies]
libproc = "0.14"

View File

@ -1,6 +1,6 @@
use log::info;
use procfs::process::{FDInfo, Io, Process, Stat, Status};
use procfs::{ProcError, ProcessCgroup};
use procfs::{ProcError, ProcessCGroups, WithCurrentSystemInfo};
use std::path::PathBuf;
use std::thread;
use std::time::{Duration, Instant};
@ -25,7 +25,7 @@ impl ProcessTask {
}
}
pub fn cgroups(&self) -> Result<Vec<ProcessCgroup>, ProcError> {
pub fn cgroups(&self) -> Result<ProcessCGroups, ProcError> {
match self {
ProcessTask::Process(x) => x.cgroups(),
_ => Err(ProcError::Other("not supported".to_string())),
@ -218,7 +218,7 @@ impl ProcessInfo {
/// Memory size in number of bytes
pub fn mem_size(&self) -> u64 {
match self.curr_proc.stat() {
Ok(p) => p.rss_bytes(),
Ok(p) => p.rss_bytes().get(),
Err(_) => 0,
}
}