PROPHET/OS
NAME
safestate: which service can be brought to rest, and which one is held there
SYNOPSIS
safestate [--tui]
DESCRIPTION
Which service can be brought to rest, and which one is held there.
The supervisor knows three answers when something goes wrong: start the module again, take the next provider, end the program. For a machine with a motor on it a fourth one is missing, and it is the important one: bring the outputs into a state that harms nobody and stay there. This tool shows that fourth answer.
The table
One row per service that declared something.
Kind says what the service does to the world outside the machine: drives is a motor, a valve, a bus, computes is a checksum. Safe state is what the service itself called its state of rest, in its own words, and none is a legitimate answer for a checksum and not for a motor: a service with outputs and no safe state is refused at its declaration and never reaches this table.
State is running or held. Held means the fault manager brought this service to rest and is keeping it there. Read back says how well that is known: reached means the service read its own outputs back and they stand in the safe state, claimed means it has no read back and only said it was done, missed means the state was asked for and not reached. A missed row is red, because then nobody knows where those outputs stand.
Reason says why it was entered: supervisor is the end of the escalation above, that is a service with no fallback left, deadline is a deadline of the watchdog that lapsed, hand is somebody who asked for it.
Reset is given while a reset stands open for this service, and Refused counts how often the way out was asked for without one.
The way out is a reset
A machine that leaves its safe state by itself because the symptom went away is the failure mode this exists to prevent, so the latch holds. The supervisor asks for the way out the same way everybody else does and gets the same no, and a restart therefore cannot carry a service out of its rest.
The reset is a deliberate act and goes through the control tree:
conf safe.reset <service>
Whoever may set it is in the superuser group, the tree holds who set it and when, and kernel read shows it afterwards. Nothing else opens the latch.
What the picture says
Under the table stand the manager's numbers and one sentence in plain words, so nobody has to reason the state out of the counters.
declared 0 is the honest line for a desktop board: nothing here drives an output that could harm anybody, so there is no safe state to declare and no row to show. That is not a machine without safety, it is a machine with nothing to make safe, and the first service that drives something declares itself and appears here.
See also
watchdog finds a machine that stands and is the source of the second reason above. The reset is a setting of the kernel, kernel read shows it. /state/safestate is the file both shapes of this tool read.
EXAMPLE
$ safestate --help safestate [--tui] which service can be brought to rest, and which one is held there --tui live on the whole screen, q leaves