]> git.ipfire.org Git - thirdparty/systemd.git/blame - src/shared/cgroup-util.h
systemctl: don't show cgroup field for a unit if cgroup is empty
[thirdparty/systemd.git] / src / shared / cgroup-util.h
CommitLineData
03467c88 1/*-*- Mode: C; c-basic-offset: 8; indent-tabs-mode: nil -*-*/
8c6db833 2
c2f1db8f 3#pragma once
8c6db833
LP
4
5/***
6 This file is part of systemd.
7
8 Copyright 2010 Lennart Poettering
9
10 systemd is free software; you can redistribute it and/or modify it
5430f7f2
LP
11 under the terms of the GNU Lesser General Public License as published by
12 the Free Software Foundation; either version 2.1 of the License, or
8c6db833
LP
13 (at your option) any later version.
14
15 systemd is distributed in the hope that it will be useful, but
16 WITHOUT ANY WARRANTY; without even the implied warranty of
17 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
5430f7f2 18 Lesser General Public License for more details.
8c6db833 19
5430f7f2 20 You should have received a copy of the GNU Lesser General Public License
8c6db833
LP
21 along with systemd; If not, see <http://www.gnu.org/licenses/>.
22***/
23
24#include <sys/types.h>
c6c18be3 25#include <stdio.h>
35d2e7ec 26#include <dirent.h>
c6c18be3
LP
27
28#include "set.h"
f6a6225e 29#include "def.h"
8c6db833 30
c6c18be3
LP
31int cg_enumerate_processes(const char *controller, const char *path, FILE **_f);
32int cg_enumerate_tasks(const char *controller, const char *path, FILE **_f);
c6c18be3
LP
33int cg_read_pid(FILE *f, pid_t *_pid);
34
35d2e7ec
LP
35int cg_enumerate_subgroups(const char *controller, const char *path, DIR **_d);
36int cg_read_subgroup(DIR *d, char **fn);
37
430c18ed
LP
38int cg_kill(const char *controller, const char *path, int sig, bool sigcont, bool ignore_self, Set *s);
39int cg_kill_recursive(const char *controller, const char *path, int sig, bool sigcont, bool ignore_self, bool remove, Set *s);
35d2e7ec 40int cg_kill_recursive_and_wait(const char *controller, const char *path, bool remove);
8c6db833
LP
41
42int cg_migrate(const char *controller, const char *from, const char *to, bool ignore_self);
35d2e7ec
LP
43int cg_migrate_recursive(const char *controller, const char *from, const char *to, bool ignore_self, bool remove);
44
45int cg_split_spec(const char *spec, char **controller, char **path);
46int cg_join_spec(const char *controller, const char *path, char **spec);
47int cg_fix_path(const char *path, char **result);
8c6db833
LP
48
49int cg_get_path(const char *controller, const char *path, const char *suffix, char **fs);
3474ae3c 50int cg_get_path_and_check(const char *controller, const char *path, const char *suffix, char **fs);
8c6db833
LP
51int cg_get_by_pid(const char *controller, pid_t pid, char **path);
52
53int cg_trim(const char *controller, const char *path, bool delete_root);
35d2e7ec 54
ad293f5a 55int cg_rmdir(const char *controller, const char *path, bool honour_sticky);
8c6db833
LP
56int cg_delete(const char *controller, const char *path);
57
58int cg_create(const char *controller, const char *path);
59int cg_attach(const char *controller, const char *path, pid_t pid);
60int cg_create_and_attach(const char *controller, const char *path, pid_t pid);
61
62int cg_set_group_access(const char *controller, const char *path, mode_t mode, uid_t uid, gid_t gid);
8d53b453 63int cg_set_task_access(const char *controller, const char *path, mode_t mode, uid_t uid, gid_t gid, int sticky);
8c6db833
LP
64
65int cg_install_release_agent(const char *controller, const char *agent);
66
67int cg_is_empty(const char *controller, const char *path, bool ignore_self);
b08121d0 68int cg_is_empty_by_spec(const char *spec, bool ignore_self);
8c6db833
LP
69int cg_is_empty_recursive(const char *controller, const char *path, bool ignore_self);
70
1f73f0f1 71int cg_get_user_path(char **path);
ba1261bc
LP
72int cg_pid_get_cgroup(pid_t pid, char **root, char **cgroup);
73int cg_pid_get_unit(pid_t pid, char **unit);
1f73f0f1 74
b59e2465 75char **cg_shorten_controllers(char **controllers);