sinf 0.1.0

Library for obtaining in-depth system information at both the hardware and software levels
Documentation
use libc::kill;

use super::*;

impl ProcessInner {
    pub(crate) fn cgroup_limits(&self) -> Option<crate::CGroupLimits> {
        None
    }

    pub(crate) fn new_empty(pid: Pid) -> Self {
        Self {
            name: OsString::new(),
            pid,
            parent: None,
            cmd: Vec::new(),
            environ: Vec::new(),
            exe: None,
            cwd: None,
            root: None,
            memory: 0,
            virtual_memory: 0,
            cpu_usage: 0.,
            old_utime: 0,
            old_stime: 0,
            updated: true,
            start_time: 0,
            run_time: 0,
            user_id: None,
            effective_user_id: None,
            group_id: None,
            effective_group_id: None,
            process_status: ProcessStatus::Unknown(0),
            status: None,
            old_read_bytes: 0,
            old_written_bytes: 0,
            read_bytes: 0,
            written_bytes: 0,
            accumulated_cpu_time: 0,
            exists: true,
            #[cfg(feature = "gpu")]
            gpu_usage: None,
            #[cfg(feature = "gpu")]
            gpu_time: 0,
            #[cfg(feature = "gpu")]
            gpu_instant: None,
        }
    }

    pub(crate) fn new(pid: Pid, parent: Option<Pid>, start_time: u64, run_time: u64) -> Self {
        Self {
            name: OsString::new(),
            pid,
            parent,
            cmd: Vec::new(),
            environ: Vec::new(),
            exe: None,
            cwd: None,
            root: None,
            memory: 0,
            virtual_memory: 0,
            cpu_usage: 0.,
            old_utime: 0,
            old_stime: 0,
            updated: true,
            start_time,
            run_time,
            user_id: None,
            effective_user_id: None,
            group_id: None,
            effective_group_id: None,
            process_status: ProcessStatus::Unknown(0),
            status: None,
            old_read_bytes: 0,
            old_written_bytes: 0,
            read_bytes: 0,
            written_bytes: 0,
            accumulated_cpu_time: 0,
            exists: true,
            #[cfg(feature = "gpu")]
            gpu_usage: None,
            #[cfg(feature = "gpu")]
            gpu_time: 0,
            #[cfg(feature = "gpu")]
            gpu_instant: None,
        }
    }

    pub(crate) fn kill_with(&self, signal: Signal) -> Option<bool> {
        let c_signal = crate::sys::system::convert_signal(signal)?;
        unsafe { Some(kill(self.pid.0, c_signal) == 0) }
    }
}