fn get_linux_extension_long_running_process()

in proxy_agent_extension/src/handler_main.rs [303:322]


fn get_linux_extension_long_running_process() -> Option<i32> {
    // check if the process GuestProxyAgentVMExtension running AND without parameters
    let system = System::new_with_specifics(
        RefreshKind::new().with_processes(
            ProcessRefreshKind::new()
                .with_cmd(UpdateKind::Always)
                .with_exe(UpdateKind::Always),
        ),
    );

    for p in system.processes_by_exact_name(constants::EXTENSION_PROCESS_NAME) {
        let cmd = p.cmd();
        logger::write(format!("cmd: {:?}", cmd));
        if cmd.len() == 1 {
            logger::write(format!("ProxyAgentExt running with pid: {}", p.pid()));
            return Some(p.pid().as_u32() as i32);
        }
    }
    None
}