pid.rs 338 B

123456789101112131415161718
  1. #[allow(dead_code)]
  2. #[derive(Debug, Clone, Copy)]
  3. #[repr(u8)]
  4. pub enum PidType {
  5. /// pid类型是进程id
  6. PID = 1,
  7. TGID = 2,
  8. PGID = 3,
  9. SID = 4,
  10. MAX = 5,
  11. }
  12. /// 为PidType实现判断相等的trait
  13. impl PartialEq for PidType {
  14. fn eq(&self, other: &PidType) -> bool {
  15. *self as u8 == *other as u8
  16. }
  17. }