Skip to main content

kernel_explainer/
states.rs

1// Process state char → human description (R, S, D, Z, T, t, I, ...).
2//
3// Mirrors the mapping previously implemented in `peek-core::proc::linux`.
4pub fn state_description(c: char) -> String {
5    match c {
6        'R' => "Running".to_string(),
7        'S' => "Sleeping (interruptible)".to_string(),
8        'D' => "Uninterruptible sleep (disk/NFS wait)".to_string(),
9        'Z' => "Zombie".to_string(),
10        'T' => "Stopped (signal)".to_string(),
11        't' => "Tracing stop".to_string(),
12        'W' => "Paging".to_string(),
13        'X' | 'x' => "Dead".to_string(),
14        'I' => "Idle".to_string(),
15        other => other.to_string(),
16    }
17}