Lines Matching refs:controller
41 static int cg_enumerate_items(const char *controller, const char *path, FILE **_f, const char *item… in cg_enumerate_items() argument
48 r = cg_get_path(controller, path, item, &fs); in cg_enumerate_items()
60 int cg_enumerate_processes(const char *controller, const char *path, FILE **_f) { in cg_enumerate_processes() argument
61 return cg_enumerate_items(controller, path, _f, "cgroup.procs"); in cg_enumerate_processes()
90 const char *controller, in cg_read_event() argument
98 r = cg_get_path(controller, path, "cgroup.events", &events); in cg_read_event()
180 int cg_enumerate_subgroups(const char *controller, const char *path, DIR **_d) { in cg_enumerate_subgroups() argument
189 r = cg_get_path(controller, path, NULL, &fs); in cg_enumerate_subgroups()
225 int cg_rmdir(const char *controller, const char *path) { in cg_rmdir() argument
229 r = cg_get_path(controller, path, NULL, &p); in cg_rmdir()
241 if (streq(controller, SYSTEMD_CGROUP_CONTROLLER)) { in cg_rmdir()
251 const char *controller, in cg_kill_items() argument
289 r = cg_enumerate_items(controller, path, &f, item); in cg_kill_items()
353 const char *controller, in cg_kill() argument
362 r = cg_kill_items(controller, path, sig, flags, s, log_kill, userdata, "cgroup.procs"); in cg_kill()
369 r = cg_unified_controller(controller); in cg_kill()
373 return cg_kill_items(controller, path, sig, flags, s, log_kill, userdata, "cgroup.threads"); in cg_kill()
376 int cg_kill_kernel_sigkill(const char *controller, const char *path) { in cg_kill_kernel_sigkill() argument
388 r = cg_get_path(controller, path, "cgroup.kill", &killfile); in cg_kill_kernel_sigkill()
400 const char *controller, in cg_kill_recursive() argument
419 ret = cg_kill_kernel_sigkill(controller, path); in cg_kill_recursive()
429 ret = cg_kill(controller, path, sig, flags, s, log_kill, userdata); in cg_kill_recursive()
431 r = cg_enumerate_subgroups(controller, path, &d); in cg_kill_recursive()
447 r = cg_kill_recursive(controller, p, sig, flags, s, log_kill, userdata); in cg_kill_recursive()
456 r = cg_rmdir(controller, path); in cg_kill_recursive()
464 static const char *controller_to_dirname(const char *controller) { in controller_to_dirname() argument
465 assert(controller); in controller_to_dirname()
471 if (streq(controller, SYSTEMD_CGROUP_CONTROLLER)) { in controller_to_dirname()
473 controller = SYSTEMD_CGROUP_CONTROLLER_HYBRID; in controller_to_dirname()
475 controller = SYSTEMD_CGROUP_CONTROLLER_LEGACY; in controller_to_dirname()
478 return startswith(controller, "name=") ?: controller; in controller_to_dirname()
481 static int join_path_legacy(const char *controller, const char *path, const char *suffix, char **re… in join_path_legacy() argument
486 assert(controller); in join_path_legacy()
488 dn = controller_to_dirname(controller); in join_path_legacy()
525 int cg_get_path(const char *controller, const char *path, const char *suffix, char **ret) { in cg_get_path() argument
530 if (!controller) { in cg_get_path()
552 if (!cg_controller_is_valid(controller)) in cg_get_path()
561 r = join_path_legacy(controller, path, suffix, ret); in cg_get_path()
569 static int controller_is_v1_accessible(const char *root, const char *controller) { in controller_is_v1_accessible() argument
572 assert(controller); in controller_is_v1_accessible()
574 dn = controller_to_dirname(controller); in controller_is_v1_accessible()
584 int cg_get_path_and_check(const char *controller, const char *path, const char *suffix, char **fs) { in cg_get_path_and_check() argument
587 assert(controller); in cg_get_path_and_check()
590 if (!cg_controller_is_valid(controller)) in cg_get_path_and_check()
599 if (startswith(controller, "name=")) in cg_get_path_and_check()
603 r = controller_is_v1_accessible(NULL, controller); in cg_get_path_and_check()
608 return cg_get_path(controller, path, suffix, fs); in cg_get_path_and_check()
611 int cg_set_xattr(const char *controller, const char *path, const char *name, const void *value, siz… in cg_set_xattr() argument
619 r = cg_get_path(controller, path, NULL, &fs); in cg_set_xattr()
626 int cg_get_xattr(const char *controller, const char *path, const char *name, void *value, size_t si… in cg_get_xattr() argument
634 r = cg_get_path(controller, path, NULL, &fs); in cg_get_xattr()
645 int cg_get_xattr_malloc(const char *controller, const char *path, const char *name, char **ret) { in cg_get_xattr_malloc() argument
652 r = cg_get_path(controller, path, NULL, &fs); in cg_get_xattr_malloc()
663 int cg_get_xattr_bool(const char *controller, const char *path, const char *name) { in cg_get_xattr_bool() argument
670 r = cg_get_xattr_malloc(controller, path, name, &val); in cg_get_xattr_bool()
677 int cg_remove_xattr(const char *controller, const char *path, const char *name) { in cg_remove_xattr() argument
684 r = cg_get_path(controller, path, NULL, &fs); in cg_remove_xattr()
691 int cg_pid_get_path(const char *controller, pid_t pid, char **ret_path) { in cg_pid_get_path() argument
699 if (controller) { in cg_pid_get_path()
700 if (!cg_controller_is_valid(controller)) in cg_pid_get_path()
703 controller = SYSTEMD_CGROUP_CONTROLLER; in cg_pid_get_path()
705 unified = cg_unified_controller(controller); in cg_pid_get_path()
709 if (streq(controller, SYSTEMD_CGROUP_CONTROLLER)) in cg_pid_get_path()
712 controller_str = controller; in cg_pid_get_path()
775 int cg_install_release_agent(const char *controller, const char *agent) { in cg_install_release_agent() argument
782 r = cg_unified_controller(controller); in cg_install_release_agent()
788 r = cg_get_path(controller, NULL, "release_agent", &fs); in cg_install_release_agent()
805 r = cg_get_path(controller, NULL, "notify_on_release", &fs); in cg_install_release_agent()
829 int cg_uninstall_release_agent(const char *controller) { in cg_uninstall_release_agent() argument
833 r = cg_unified_controller(controller); in cg_uninstall_release_agent()
839 r = cg_get_path(controller, NULL, "notify_on_release", &fs); in cg_uninstall_release_agent()
849 r = cg_get_path(controller, NULL, "release_agent", &fs); in cg_uninstall_release_agent()
860 int cg_is_empty(const char *controller, const char *path) { in cg_is_empty() argument
867 r = cg_enumerate_processes(controller, path, &f); in cg_is_empty()
880 int cg_is_empty_recursive(const char *controller, const char *path) { in cg_is_empty_recursive() argument
886 if (controller && empty_or_root(path)) in cg_is_empty_recursive()
889 r = cg_unified_controller(controller); in cg_is_empty_recursive()
898 r = cg_read_event(controller, path, "populated", &t); in cg_is_empty_recursive()
909 r = cg_is_empty(controller, path); in cg_is_empty_recursive()
913 r = cg_enumerate_subgroups(controller, path, &d); in cg_is_empty_recursive()
927 r = cg_is_empty_recursive(controller, p); in cg_is_empty_recursive()
939 _cleanup_free_ char *controller = NULL, *path = NULL; in cg_split_spec() local
960 controller = strndup(spec, e-spec); in cg_split_spec()
961 if (!controller) in cg_split_spec()
963 if (!cg_controller_is_valid(controller)) in cg_split_spec()
983 controller = strdup(spec); in cg_split_spec()
984 if (!controller) in cg_split_spec()
991 *ret_controller = TAKE_PTR(controller); in cg_split_spec()
1691 int cg_is_threaded(const char *controller, const char *path) { in cg_is_threaded() argument
1696 r = cg_get_path(controller, path, "cgroup.type", &fs); in cg_is_threaded()
1715 int cg_set_attribute(const char *controller, const char *path, const char *attribute, const char *v… in cg_set_attribute() argument
1719 r = cg_get_path(controller, path, attribute, &p); in cg_set_attribute()
1726 int cg_get_attribute(const char *controller, const char *path, const char *attribute, char **ret) { in cg_get_attribute() argument
1730 r = cg_get_path(controller, path, attribute, &p); in cg_get_attribute()
1737 int cg_get_attribute_as_uint64(const char *controller, const char *path, const char *attribute, uin… in cg_get_attribute_as_uint64() argument
1744 r = cg_get_attribute(controller, path, attribute, &value); in cg_get_attribute_as_uint64()
1763 int cg_get_attribute_as_bool(const char *controller, const char *path, const char *attribute, bool … in cg_get_attribute_as_bool() argument
1769 r = cg_get_attribute(controller, path, attribute, &value); in cg_get_attribute_as_bool()
1783 int cg_get_owner(const char *controller, const char *path, uid_t *ret_uid) { in cg_get_owner() argument
1790 r = cg_get_path(controller, path, NULL, &f); in cg_get_owner()
1803 const char *controller, in cg_get_keyed_attribute_full() argument
1823 r = cg_get_path(controller, path, attribute, &filename); in cg_get_keyed_attribute_full()
2047 _cleanup_free_ char *controller = NULL; in cg_kernel_controllers() local
2051 if (fscanf(f, "%ms %*i %*i %i", &controller, &enabled) != 2) { in cg_kernel_controllers()
2065 if (!cg_controller_is_valid(controller)) in cg_kernel_controllers()
2068 r = set_ensure_consume(&controllers, &string_hash_ops_free, TAKE_PTR(controller)); in cg_kernel_controllers()
2151 int cg_unified_controller(const char *controller) { in cg_unified_controller() argument
2164 return streq_ptr(controller, SYSTEMD_CGROUP_CONTROLLER); in cg_unified_controller()