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; return;
} }
char state = (proc->flags & PROC_FLAG_FINISHED) ? 'Z' : char state = 'S';
((proc->flags & PROC_FLAG_SUSPENDED) ? 'T' :
(process_is_ready(proc) ? 'R' : '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; char * name = proc->name + strlen(proc->name) - 1;
while (1) { while (1) {