4.3. Kernel Commands

gsh provides a set of commands to control the GNO kernel. These commands mainly deal with job control. See the chapter on Process Management in the GNO Kernel Reference Manual.

bg (%job | pid)

Starts the specified job, if stopped, and places it in the background.

fg (%job | pid)

Starts the specified job, if stopped, and places it in the foreground.

jobs [-l]

Displays a list of the shell's jobs. If the -l switch is specified, the process id is included in the job list.

kill {[-SIGNAL] | %job | pid | [-l] }

The kill command will send the signal SIGNAL to the process number pid. The ps command documented below describes how to list all process ID's currently executing.

SIGNAL can be either a numeric value or string representing the signal to be sent to the process. All signals are documented in the chapter on Interprocess Communication in the GNO Kernel Reference Manual. Alternatively, specifying the -l option will list all the signals and their names.

If the process number isn't known, but the job number is, replace the pid with a '%' followed by the job number.

ps

This command takes no arguments. When invoked, a list of all currently running processes is displayed:


[2] 9:52pm root> ls -lR :hard:gno > /ram5/dev &
[1] + 35 Running ls -lR :hard:gno &
[3] 9:53pm root> ps
  ID STATE   TT MMID  UID TIME COMMAND
   1 ready   co 1002 0000 0:26 NullProcess
   2 ready   co 1005 0000 0:02 gsh
  35 ready   co 100A 0000 0:01 ls -lR :hard:gno
  36 running co 1007 0000 0:00 ps
[4] 9:53pm root> 
[1] + Done ls -lR :hard:gno

The fields of the ps output are as shown below:

ID

A unique process ID assigned to a command by GNO. Use this number to reference any process.

STATE

Current state of the process. Each process can be in any of the following states:

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.

TTY

Terminal connected to the process.

MMID

Memory Manager ID assigned to the process.

UID

ID of the user who initiated the process.

TIME

How much CPU time this process has used. This is not the elapsed time of the process.

COMMAND

Command-line string used to invoke process.

setdebug { val | {+|-}flag }

Turns GNO kernel debugging code on or off. The value passed consists of a bit field, where each bit specifies a different type of debugging code to activate. An alternate method is to provide a list of debug flags, either preceded by a '+' or a '-'. Those preceded by a '+' are activated, and those preceeded with a '-' are deactivated. All debugging is deactivated by passing a value of 0. Running setdebug wtth no arguments returns a list of the debugging flags. Legal flags include:

Table 4-2. Kernel Debug Flags

FlagMeaning
gsostrace Trace GS/OS calls.
gsosblocks Trace GS/OS parameter blocks.
gsoserrors Trace GS/OS errors.
pathtrace Trace GS/OS pathnames.
sigtrace Trace signals.
systrace Trace GNO Kernel system calls.

stop { %job | pid }

Stops the execution of all processes in a specified job.