Is there a list of process states somewhere?

Yujiri

New Member


Messages: 10

By "process states" I mean the states shown in the default SIGINFO output, like 'ttyin', 'runnable', 'uwrlck', `nanslp`.
 
OP
Y

Yujiri

New Member


Messages: 10

Either one, but I was asking for a list of the possible states. Which according to the thread, there isn't one. Shame, but thanks for answering my question
 

Emrion

Well-Known Member

Reaction score: 116
Messages: 435

If you speak about the "STATE" that top ouputs, actually it's forged from different sources:

/usr/src/usr.bin/top/machine.c
Code:
/* generate "STATE" field */
    switch (state = pp->ki_stat) {
    case SRUN:
        if (smpmode && pp->ki_oncpu != NOCPU)
            sprintf(status, "CPU%d", pp->ki_oncpu);
        else
            strcpy(status, "RUN");
        break;
    case SLOCK:
        if (pp->ki_kiflag & KI_LOCKBLOCK) {
            sprintf(status, "*%.6s", pp->ki_lockname);
            break;
        }
        /* fall through */
    case SSLEEP:
        sprintf(status, "%.6s", pp->ki_wmesg);
        break;
    default:
        if (state < nitems(state_abbrev)) {
            sprintf(status, "%.6s", state_abbrev[state]);
        } else {
            sprintf(status, "?%5zu", state);
        }
        break;
    }

pp is a struct kinfo_proc*, you can find its definition in /usr/src/sys/sys/user.h.
You can find additional informations in /usr/sys/sys/proc.h

For instance, the state "uwait" comes from sys/kern/kern_umtx.c. You will probably find numerous files that contain a state or another. That said, it would be a good thing to have an explanation of these states in top(1), even if it can't be exhaustive.
 
Top