diff options
author | Michal Sekletár <msekleta@redhat.com> | 2020-04-29 17:53:43 +0200 |
---|---|---|
committer | Michal Sekletár <msekleta@redhat.com> | 2020-04-30 19:02:51 +0200 |
commit | d9e45bc3abb8adf5a1cb20816ba8f2d2aa65b17e (patch) | |
tree | 7c7dcdd6e921fc80e1026915c8df2eee3b5f7d71 /src/basic/unit-def.h | |
parent | basic/cgroup-util: introduce cg_get_keyed_attribute_full() (diff) | |
download | systemd-d9e45bc3abb8adf5a1cb20816ba8f2d2aa65b17e.tar.xz systemd-d9e45bc3abb8adf5a1cb20816ba8f2d2aa65b17e.zip |
core: introduce support for cgroup freezer
With cgroup v2 the cgroup freezer is implemented as a cgroup
attribute called cgroup.freeze. cgroup can be frozen by writing "1"
to the file and kernel will send us a notification through
"cgroup.events" after the operation is finished and processes in the
cgroup entered quiescent state, i.e. they are not scheduled to
run. Writing "0" to the attribute file does the inverse and process
execution is resumed.
This commit exposes above low-level functionality through systemd's DBus
API. Each unit type must provide specialized implementation for these
methods, otherwise, we return an error. So far only service, scope, and
slice unit types provide the support. It is possible to check if a
given unit has the support using CanFreeze() DBus property.
Note that DBus API has a synchronous behavior and we dispatch the reply
to freeze/thaw requests only after the kernel has notified us that
requested operation was completed.
Diffstat (limited to 'src/basic/unit-def.h')
-rw-r--r-- | src/basic/unit-def.h | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/src/basic/unit-def.h b/src/basic/unit-def.h index edb3ff8fe8..a7d6781988 100644 --- a/src/basic/unit-def.h +++ b/src/basic/unit-def.h @@ -48,6 +48,15 @@ typedef enum UnitActiveState { _UNIT_ACTIVE_STATE_INVALID = -1 } UnitActiveState; +typedef enum FreezerState { + FREEZER_RUNNING, + FREEZER_FREEZING, + FREEZER_FROZEN, + FREEZER_THAWING, + _FREEZER_STATE_MAX, + _FREEZER_STATE_INVALID = -1 +} FreezerState; + typedef enum AutomountState { AUTOMOUNT_DEAD, AUTOMOUNT_WAITING, @@ -253,6 +262,9 @@ UnitLoadState unit_load_state_from_string(const char *s) _pure_; const char *unit_active_state_to_string(UnitActiveState i) _const_; UnitActiveState unit_active_state_from_string(const char *s) _pure_; +const char *freezer_state_to_string(FreezerState i) _const_; +FreezerState freezer_state_from_string(const char *s) _pure_; + const char* automount_state_to_string(AutomountState i) _const_; AutomountState automount_state_from_string(const char *s) _pure_; |