1 /* SPDX-License-Identifier: LGPL-2.1-or-later */ 2 #pragma once 3 4 #include <stdbool.h> 5 #include <stdint.h> 6 #include <sys/types.h> 7 8 #include "cgroup-util.h" 9 10 bool cg_is_unified_wanted(void); 11 bool cg_is_legacy_wanted(void); 12 bool cg_is_hybrid_wanted(void); 13 14 int cg_weight_parse(const char *s, uint64_t *ret); 15 int cg_cpu_shares_parse(const char *s, uint64_t *ret); 16 int cg_blkio_weight_parse(const char *s, uint64_t *ret); 17 18 int cg_trim(const char *controller, const char *path, bool delete_root); 19 20 int cg_create(const char *controller, const char *path); 21 int cg_attach(const char *controller, const char *path, pid_t pid); 22 int cg_attach_fallback(const char *controller, const char *path, pid_t pid); 23 int cg_create_and_attach(const char *controller, const char *path, pid_t pid); 24 25 int cg_migrate(const char *cfrom, const char *pfrom, const char *cto, const char *pto, CGroupFlags flags); 26 int cg_migrate_recursive(const char *cfrom, const char *pfrom, const char *cto, const char *pto, CGroupFlags flags); 27 int cg_migrate_recursive_fallback(const char *cfrom, const char *pfrom, const char *cto, const char *pto, CGroupFlags flags); 28 29 int cg_create_everywhere(CGroupMask supported, CGroupMask mask, const char *path); 30 int cg_attach_everywhere(CGroupMask supported, const char *path, pid_t pid, cg_migrate_callback_t callback, void *userdata); 31 int cg_migrate_v1_controllers(CGroupMask supported, CGroupMask mask, const char *from, cg_migrate_callback_t to_callback, void *userdata); 32 int cg_trim_everywhere(CGroupMask supported, const char *path, bool delete_root); 33 int cg_trim_v1_controllers(CGroupMask supported, CGroupMask mask, const char *path, bool delete_root); 34 int cg_enable_everywhere(CGroupMask supported, CGroupMask mask, const char *p, CGroupMask *ret_result_mask); 35