cgroup-util.h revision ad929bcc27e2c6c1aa731053e45882686e9babab
6c03089c32c251d823173bda4d809a9e643219f0Lennart Poettering/*-*- Mode: C; c-basic-offset: 8; indent-tabs-mode: nil -*-*/
6c03089c32c251d823173bda4d809a9e643219f0Lennart Poettering This file is part of systemd.
6c03089c32c251d823173bda4d809a9e643219f0Lennart Poettering Copyright 2010 Lennart Poettering
6c03089c32c251d823173bda4d809a9e643219f0Lennart Poettering systemd is free software; you can redistribute it and/or modify it
6c03089c32c251d823173bda4d809a9e643219f0Lennart Poettering under the terms of the GNU Lesser General Public License as published by
6c03089c32c251d823173bda4d809a9e643219f0Lennart Poettering the Free Software Foundation; either version 2.1 of the License, or
6c03089c32c251d823173bda4d809a9e643219f0Lennart Poettering (at your option) any later version.
6c03089c32c251d823173bda4d809a9e643219f0Lennart Poettering systemd is distributed in the hope that it will be useful, but
6c03089c32c251d823173bda4d809a9e643219f0Lennart Poettering WITHOUT ANY WARRANTY; without even the implied warranty of
6c03089c32c251d823173bda4d809a9e643219f0Lennart Poettering MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
6c03089c32c251d823173bda4d809a9e643219f0Lennart Poettering Lesser General Public License for more details.
6c03089c32c251d823173bda4d809a9e643219f0Lennart Poettering You should have received a copy of the GNU Lesser General Public License
6c03089c32c251d823173bda4d809a9e643219f0Lennart Poettering along with systemd; If not, see <http://www.gnu.org/licenses/>.
7027ff61a34a12487712b382a061c654acc3a679Lennart Poettering/* A bit mask of well known cgroup controllers */
7027ff61a34a12487712b382a061c654acc3a679Lennart Poettering * General rules:
d7bd3de0654669e65b9642c248c5fa6d1d9a9f61Lennart Poettering * We accept named hierarchies in the syntax "foo" and "name=foo".
6c03089c32c251d823173bda4d809a9e643219f0Lennart Poettering * We expect that named hierarchies do not conflict in name with a
6c03089c32c251d823173bda4d809a9e643219f0Lennart Poettering * kernel hierarchy, modulo the "name=" prefix.
6c03089c32c251d823173bda4d809a9e643219f0Lennart Poettering * We always generate "normalized" controller names, i.e. without the
6c03089c32c251d823173bda4d809a9e643219f0Lennart Poettering * "name=" prefix.
6c03089c32c251d823173bda4d809a9e643219f0Lennart Poettering * We require absolute cgroup paths. When returning, we will always
6c03089c32c251d823173bda4d809a9e643219f0Lennart Poettering * generate paths with multiple adjacent / removed.
9444b1f20e311f073864d81e913bd4f32fe95cfdLennart Poetteringint cg_enumerate_processes(const char *controller, const char *path, FILE **_f);
d7bd3de0654669e65b9642c248c5fa6d1d9a9f61Lennart Poetteringint cg_enumerate_subgroups(const char *controller, const char *path, DIR **_d);
d7bd3de0654669e65b9642c248c5fa6d1d9a9f61Lennart Poetteringint cg_kill(const char *controller, const char *path, int sig, bool sigcont, bool ignore_self, Set *s);
9444b1f20e311f073864d81e913bd4f32fe95cfdLennart Poetteringint cg_kill_recursive(const char *controller, const char *path, int sig, bool sigcont, bool ignore_self, bool remove, Set *s);
d7bd3de0654669e65b9642c248c5fa6d1d9a9f61Lennart Poetteringint cg_kill_recursive_and_wait(const char *controller, const char *path, bool remove);
9444b1f20e311f073864d81e913bd4f32fe95cfdLennart Poetteringint cg_migrate(const char *cfrom, const char *pfrom, const char *cto, const char *pto, bool ignore_self);
6c03089c32c251d823173bda4d809a9e643219f0Lennart Poetteringint cg_migrate_recursive(const char *cfrom, const char *pfrom, const char *cto, const char *pto, bool ignore_self, bool remove);
6c03089c32c251d823173bda4d809a9e643219f0Lennart Poetteringint cg_split_spec(const char *spec, char **controller, char **path);
6c03089c32c251d823173bda4d809a9e643219f0Lennart Poetteringint cg_join_spec(const char *controller, const char *path, char **spec);
6c03089c32c251d823173bda4d809a9e643219f0Lennart Poetteringint cg_mangle_path(const char *path, char **result);
6c03089c32c251d823173bda4d809a9e643219f0Lennart Poetteringint cg_get_path(const char *controller, const char *path, const char *suffix, char **fs);
9444b1f20e311f073864d81e913bd4f32fe95cfdLennart Poetteringint cg_get_path_and_check(const char *controller, const char *path, const char *suffix, char **fs);
374ec6abf31ada6ca554cc8ea99b282373fac010Lennart Poetteringint cg_pid_get_path(const char *controller, pid_t pid, char **path);
374ec6abf31ada6ca554cc8ea99b282373fac010Lennart Poetteringint cg_trim(const char *controller, const char *path, bool delete_root);
d7bd3de0654669e65b9642c248c5fa6d1d9a9f61Lennart Poetteringint cg_rmdir(const char *controller, const char *path);
d7bd3de0654669e65b9642c248c5fa6d1d9a9f61Lennart Poetteringint cg_delete(const char *controller, const char *path);
9444b1f20e311f073864d81e913bd4f32fe95cfdLennart Poetteringint cg_create(const char *controller, const char *path);
d7bd3de0654669e65b9642c248c5fa6d1d9a9f61Lennart Poetteringint cg_attach(const char *controller, const char *path, pid_t pid);
7027ff61a34a12487712b382a061c654acc3a679Lennart Poetteringint cg_create_and_attach(const char *controller, const char *path, pid_t pid);
9444b1f20e311f073864d81e913bd4f32fe95cfdLennart Poetteringint cg_set_attribute(const char *controller, const char *path, const char *attribute, const char *value);
9444b1f20e311f073864d81e913bd4f32fe95cfdLennart Poetteringint cg_set_group_access(const char *controller, const char *path, mode_t mode, uid_t uid, gid_t gid);
9444b1f20e311f073864d81e913bd4f32fe95cfdLennart Poetteringint cg_set_task_access(const char *controller, const char *path, mode_t mode, uid_t uid, gid_t gid);
96cde13ace6406582688028f3df5668a172ba628Zbigniew Jędrzejewski-Szmekint cg_install_release_agent(const char *controller, const char *agent);
96cde13ace6406582688028f3df5668a172ba628Zbigniew Jędrzejewski-Szmekint cg_uninstall_release_agent(const char *controller);
374ec6abf31ada6ca554cc8ea99b282373fac010Lennart Poetteringint cg_is_empty(const char *controller, const char *path, bool ignore_self);
374ec6abf31ada6ca554cc8ea99b282373fac010Lennart Poetteringint cg_is_empty_by_spec(const char *spec, bool ignore_self);
9444b1f20e311f073864d81e913bd4f32fe95cfdLennart Poetteringint cg_is_empty_recursive(const char *controller, const char *path, bool ignore_self);
9444b1f20e311f073864d81e913bd4f32fe95cfdLennart Poetteringint cg_path_get_session(const char *path, char **session);
7027ff61a34a12487712b382a061c654acc3a679Lennart Poetteringint cg_path_get_owner_uid(const char *path, uid_t *uid);
9444b1f20e311f073864d81e913bd4f32fe95cfdLennart Poetteringint cg_path_get_unit(const char *path, char **unit);
9444b1f20e311f073864d81e913bd4f32fe95cfdLennart Poetteringint cg_path_get_user_unit(const char *path, char **unit);
9444b1f20e311f073864d81e913bd4f32fe95cfdLennart Poetteringint cg_path_get_machine_name(const char *path, char **machine);
9444b1f20e311f073864d81e913bd4f32fe95cfdLennart Poetteringint cg_path_get_slice(const char *path, char **slice);
374ec6abf31ada6ca554cc8ea99b282373fac010Lennart Poetteringint cg_pid_get_path_shifted(pid_t pid, char **root, char **cgroup);
9444b1f20e311f073864d81e913bd4f32fe95cfdLennart Poetteringint cg_pid_get_session(pid_t pid, char **session);
9444b1f20e311f073864d81e913bd4f32fe95cfdLennart Poetteringint cg_pid_get_owner_uid(pid_t pid, uid_t *uid);
7027ff61a34a12487712b382a061c654acc3a679Lennart Poetteringint cg_pid_get_unit(pid_t pid, char **unit);
9444b1f20e311f073864d81e913bd4f32fe95cfdLennart Poetteringint cg_pid_get_user_unit(pid_t pid, char **unit);
9444b1f20e311f073864d81e913bd4f32fe95cfdLennart Poetteringint cg_pid_get_machine_name(pid_t pid, char **machine);
7027ff61a34a12487712b382a061c654acc3a679Lennart Poetteringint cg_pid_get_slice(pid_t pid, char **slice);
9444b1f20e311f073864d81e913bd4f32fe95cfdLennart Poetteringint cg_path_decode_unit(const char *cgroup, char **unit);
9444b1f20e311f073864d81e913bd4f32fe95cfdLennart Poetteringchar **cg_shorten_controllers(char **controllers);
374ec6abf31ada6ca554cc8ea99b282373fac010Lennart Poetteringint cg_controller_from_attr(const char *attr, char **controller);
374ec6abf31ada6ca554cc8ea99b282373fac010Lennart Poetteringchar *cg_escape(const char *p);
9444b1f20e311f073864d81e913bd4f32fe95cfdLennart Poetteringbool cg_controller_is_valid(const char *p, bool allow_named);
9444b1f20e311f073864d81e913bd4f32fe95cfdLennart Poetteringint cg_slice_to_path(const char *unit, char **ret);
9444b1f20e311f073864d81e913bd4f32fe95cfdLennart Poetteringint cg_create_with_mask(CGroupControllerMask mask, const char *path);
9444b1f20e311f073864d81e913bd4f32fe95cfdLennart Poetteringint cg_attach_with_mask(CGroupControllerMask mask, const char *path, pid_t pid);
9444b1f20e311f073864d81e913bd4f32fe95cfdLennart Poetteringint cg_attach_many_with_mask(CGroupControllerMask mask, const char *path, Set* pids);
7027ff61a34a12487712b382a061c654acc3a679Lennart Poetteringint cg_migrate_with_mask(CGroupControllerMask mask, const char *from, const char *to);
7027ff61a34a12487712b382a061c654acc3a679Lennart Poetteringint cg_trim_with_mask(CGroupControllerMask mask, const char *path, bool delete_root);