From: Luca Boccassi Date: Thu, 3 Oct 2024 19:50:38 +0000 (+0100) Subject: man: consolidate list of active unit states into a shared table X-Git-Tag: v257-rc1~326 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=3509fe124d3a4fe2934028f83ae156ade050c8fe;p=thirdparty%2Fsystemd.git man: consolidate list of active unit states into a shared table Avoids the need to maintain the same list over and over again, and link it to the defition table in the implementation as a reminder too --- diff --git a/man/org.freedesktop.systemd1.xml b/man/org.freedesktop.systemd1.xml index aa4f69deb19..dd144a6cba0 100644 --- a/man/org.freedesktop.systemd1.xml +++ b/man/org.freedesktop.systemd1.xml @@ -2550,18 +2550,9 @@ node /org/freedesktop/systemd1/unit/avahi_2ddaemon_2eservice { was already active). ActiveState contains a state value that reflects whether the unit is currently - active or not. The following states are currently defined: active, - reloading, inactive, failed, - activating, and deactivating. active indicates - that unit is active (obviously...). reloading indicates that the unit is active and - currently reloading its configuration. inactive indicates that it is inactive and - the previous run was successful or no previous run has taken place yet. failed - indicates that it is inactive and the previous run was not successful (more information about the - reason for this is available on the unit type specific interfaces, for example for services in the - Result property, see below). activating indicates that the unit - has previously been inactive but is currently in the process of entering an active state. Conversely - deactivating indicates that the unit is currently in the process of - deactivation. + active or not. The following states are currently defined: + + SubState encodes states of the same state machine that ActiveState covers, but knows more fine-grained states that are diff --git a/man/systemctl.xml b/man/systemctl.xml index 11da7a9b73c..5820478335b 100644 --- a/man/systemctl.xml +++ b/man/systemctl.xml @@ -96,12 +96,15 @@ To show all installed unit files use 'systemctl list-unit-files'.The LOAD column shows the load state, one of loaded, not-found, bad-setting, error, - masked. The ACTIVE columns shows the general unit state, one of - active, reloading, inactive, - failed, activating, deactivating. The SUB - column shows the unit-type-specific detailed state of the unit, possible values vary by unit type. The list - of possible LOAD, ACTIVE, and SUB states is not constant and new systemd releases may both add and remove - values. systemctl --state=help command may be used to display the + masked. The ACTIVE columns shows the general unit state, one of the + following: + + + + The SUB column shows the unit-type-specific detailed state of the unit, possible values + vary by unit type. The list of possible LOAD, ACTIVE, and SUB states is not constant and new + systemd releases may both add and remove values. + systemctl --state=help command may be used to display the current set of possible values. This is the default command. diff --git a/man/systemd.xml b/man/systemd.xml index af1681352e8..71da1ec8f1d 100644 --- a/man/systemd.xml +++ b/man/systemd.xml @@ -95,16 +95,11 @@ described in systemd.unit5, however some are created automatically from other configuration files, dynamically from system state or - programmatically at runtime. Units may be "active" (meaning started, bound, plugged in, …, depending on - the unit type, see below), or "inactive" (meaning stopped, unbound, unplugged, …), as well as in the - process of being activated or deactivated, i.e. between the two states (these states are called - "activating", "deactivating"). A special "failed" state is available as well, which is very similar to - "inactive" and is entered when the service failed in some way (process returned error code on exit, or - crashed, an operation timed out, or after too many restarts). If this state is entered, the cause will - be logged, for later reference. Units may also be in a special transient state for a time, to indicate - that some operation is being performed on them, before reverting to the previous state, such as - "maintenance", "reloading" or "refreshing". Note that the various unit types may have a number of - additional substates, which are mapped to the five generalized unit states described here. + programmatically at runtime. Units may be in a number of states, described in the following table. Note + that the various unit types may have a number of additional substates, which are mapped to the + generalized unit states described here. + + The following unit types are available: diff --git a/man/unit-states.xml b/man/unit-states.xml new file mode 100644 index 00000000000..436e4fa005e --- /dev/null +++ b/man/unit-states.xml @@ -0,0 +1,61 @@ + + + + + + + + + <table id="table"> + <title>Unit ACTIVE states + + + + + + State + Description + + + + + active + Started, bound, plugged in, …, depending on the unit type. + + + inactive + Stopped, unbound, unplugged, …, depending on the unit type. + + + failed + Similar as inactive, but the unit failed in some way (process returned error code on exit, or crashed, an operation timed out, or after too many restarts). + + + + activating + Changing from inactive to active. + + + deactivating + Changing from active to inactive. + + + maintenance + Unit is inactive and a maintenance operation is in progress. + + + reloading + Unit is active and it is reloading its configuration. + + + refreshing + Unit is active and a new mount is being activated in its namespace. + + + + + + + diff --git a/src/basic/unit-def.c b/src/basic/unit-def.c index e3292a8a447..03dc663b9a6 100644 --- a/src/basic/unit-def.c +++ b/src/basic/unit-def.c @@ -104,6 +104,7 @@ static const char* const unit_load_state_table[_UNIT_LOAD_STATE_MAX] = { DEFINE_STRING_TABLE_LOOKUP(unit_load_state, UnitLoadState); +/* Keep in sync with man/unit-states.xml */ static const char* const unit_active_state_table[_UNIT_ACTIVE_STATE_MAX] = { [UNIT_ACTIVE] = "active", [UNIT_RELOADING] = "reloading",