Process Table

Information about processes is maintained in the process table, which contains one entry for each possible process (NPROC, defined in the C header file <gno/conf.h>. There is other per-process information spread about the kernel, but those are usually used for maintaining compatibility with older software, and thus are not described here. Please note that the data in this section is informational only (e.g. for programs like ps(1)). Do not attempt to modify kernel data structures or the GNO Kernel will likely respond with a resounding crash. Only 'interesting' fields are documented.

Copies of process entries should be obtained by using the Kernel Virtual Memory (KVM) routines (kvm_open(2), and so forth). These are documented in the electronic manual pages.

processState
Processes have a state associate with them. The state of the process is a description of what the process is doing. The possible process states (as listed in <gno/proc.h> and described here) are:

RUNNING
The process is currently in execution.
READY
The process is not currently executing, but is ready to be executed as soon as it is assigned a time slice.
BLOCKED
The process is waiting for a slow I/O operation to complete (for instance, a read from a TTY).
NEW
The process has been created, but has not executed yet.
SUSPENDED
The process was stopped with SIGSTOP, SIGTSTP, SIGTTIN, or SIGTTOU.
WAITING
The process is waiting on a semaphore “signal” operation. Programs waiting for data from a pipe have this state.
WAITSIGCH
The process is waiting to receive a SIGCHLD signal.
PAUSED
The process is waiting for any signal.

ttyID
The device number of the controlling TTY for this process. This is not a GS/OS refnum; rather, it is an index into the kernel's internal character device table. The value of this field can be interpreted as follows:

0 .null
1 .ttya
2 .ttyb
3 .ttyco
6 .ptyq0 pty0 master side
7 .ttyq0 pty0 slave side

Other values may be appropriate depending on the /etc/tty.config file. Namely, 1 and 2 (by default the modem and printer port drivers), and 4 and 5 (unassigned by default) may be assigned to different devices.

ticks
The number of full ticks this process has executed. If a process gives up it's time slice due to an I/O operation, this value is not incremented. A tick is 1/60 second.

alarmCount
If an alarm(2) request was made, this is the number of seconds remaining until the process is sent SIGALRM.

openFiles
This is a structure which stores information about the files a process has open. See struct ftable and struct fdentry in <gno/proc.h> .

irq_A, irq_X, irq_Y, irq_S, irq_D, irq_B, irq_P, irq_state, irq_PC, irq_K
Context information for the process. These fields are the values of the 65816 registers at the last context switch. They only truly represent the machine state of the process if the process is not RUNNING.

args
This is a NULL-terminated (C-style) string that contains the command line with which the process was invoked. This string begins with “BYTEWRKS”, the shell identifier.

For more details and an example of how to investigate process information, look at the source code for the “GNO Snooper CDA”.

Feedback