(pid: pid_t)
| 50 | } |
| 51 | |
| 52 | fn get_parent_pid(pid: pid_t) -> Option<pid_t> { |
| 53 | let s = SYSTEM.get_or_init(|| { |
| 54 | System::new_with_specifics( |
| 55 | RefreshKind::nothing().with_processes(ProcessRefreshKind::nothing()), |
| 56 | ) |
| 57 | }); |
| 58 | |
| 59 | let current_pid = Pid::from_u32(pid as u32); |
| 60 | |
| 61 | s.process(current_pid) |
| 62 | .and_then(|p| p.parent()) |
| 63 | .map(|pid| pid.as_u32() as pid_t) |
| 64 | } |
| 65 | |
| 66 | fn get_state_file_path(base_dir: &Path, pid: pid_t) -> PathBuf { |
| 67 | base_dir.join(pid.to_string()) |