diff options
author | Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl> | 2021-07-02 17:00:00 +0200 |
---|---|---|
committer | Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl> | 2021-07-19 11:33:52 +0200 |
commit | 5e1669ff26198a916c4fe1532448b8bf908b2eaa (patch) | |
tree | 5b48592ec5c89e41b2331ba18ab9deb738aadad3 /src/core/unit.h | |
parent | 48d83e33682654fd01ffc43e5c6ae999e53c8e79 (diff) | |
download | systemd-5e1669ff26198a916c4fe1532448b8bf908b2eaa.tar.gz |
core: add helper to retrieve service.status_text
Diffstat (limited to 'src/core/unit.h')
-rw-r--r-- | src/core/unit.h | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/src/core/unit.h b/src/core/unit.h index 759104ffa7..48074d8ca5 100644 --- a/src/core/unit.h +++ b/src/core/unit.h @@ -631,6 +631,9 @@ typedef struct UnitVTable { * exit code of the "main" process of the service or similar. */ int (*exit_status)(Unit *u); + /* Return a copy of the status string pointer. */ + const char* (*status_text)(Unit *u); + /* Like the enumerate() callback further down, but only enumerates the perpetual units, i.e. all units that * unconditionally exist and are always active. The main reason to keep both enumeration functions separate is * philosophical: the state of perpetual units should be put in place by coldplug(), while the state of those @@ -744,6 +747,12 @@ static inline bool unit_is_extrinsic(Unit *u) { (UNIT_VTABLE(u)->is_extrinsic && UNIT_VTABLE(u)->is_extrinsic(u)); } +static inline const char* unit_status_text(Unit *u) { + if (u && UNIT_VTABLE(u)->status_text) + return UNIT_VTABLE(u)->status_text(u); + return NULL; +} + void unit_add_to_load_queue(Unit *u); void unit_add_to_dbus_queue(Unit *u); void unit_add_to_cleanup_queue(Unit *u); |