procfs: RUNNING processes should have state R

This commit is contained in:
K. Lange 2022-09-02 13:15:24 +09:00
parent 9fd1c854b4
commit 5815adca7d

View File

@ -151,9 +151,17 @@ static void proc_status_func(fs_node_t *node) {
return;
}
char state = (proc->flags & PROC_FLAG_FINISHED) ? 'Z' :
((proc->flags & PROC_FLAG_SUSPENDED) ? 'T' :
(process_is_ready(proc) ? 'R' : 'S'));
char state = 'S';
/* Base state */
if ((proc->flags & PROC_FLAG_RUNNING) || process_is_ready(proc)) {
state = 'R'; /* Running or runnable */
} else if ((proc->flags & PROC_FLAG_FINISHED)) {
state = 'Z'; /* Zombie - exited but not yet reaped */
} else if ((proc->flags & PROC_FLAG_SUSPENDED)) {
state = 'T'; /* Stopped; TODO can we differentiate stopped tracees correctly? */
}
char * name = proc->name + strlen(proc->name) - 1;
while (1) {