]> git.ipfire.org Git - people/ms/systemd.git/blob - cgroup.h
sysv: implement /dev/initctl compatibility
[people/ms/systemd.git] / cgroup.h
1 /*-*- Mode: C; c-basic-offset: 8 -*-*/
2
3 #ifndef foocgrouphfoo
4 #define foocgrouphfoo
5
6 /***
7 This file is part of systemd.
8
9 Copyright 2010 Lennart Poettering
10
11 systemd is free software; you can redistribute it and/or modify it
12 under the terms of the GNU General Public License as published by
13 the Free Software Foundation; either version 2 of the License, or
14 (at your option) any later version.
15
16 systemd is distributed in the hope that it will be useful, but
17 WITHOUT ANY WARRANTY; without even the implied warranty of
18 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
19 General Public License for more details.
20
21 You should have received a copy of the GNU General Public License
22 along with systemd; If not, see <http://www.gnu.org/licenses/>.
23 ***/
24
25 #include <libcgroup.h>
26
27 typedef struct CGroupBonding CGroupBonding;
28
29 #include "unit.h"
30
31 /* Binds a cgroup to a name */
32 struct CGroupBonding {
33 char *controller;
34 char *path;
35
36 Unit *unit;
37
38 struct cgroup *cgroup;
39
40 /* When shutting down, kill all tasks? */
41 bool kill_all:1;
42
43 /* When shutting down, remove cgroup? */
44 bool clean_up:1;
45
46 /* When our tasks are the only ones in this group */
47 bool only_us:1;
48
49 /* Inherit parameters from parent group */
50 bool inherit:1;
51
52 /* For the Unit::cgroup_bondings list */
53 LIST_FIELDS(CGroupBonding, by_unit);
54
55 /* For the Manager::cgroup_bondings hashmap */
56 LIST_FIELDS(CGroupBonding, by_path);
57 };
58
59 int cgroup_bonding_realize(CGroupBonding *b);
60 int cgroup_bonding_realize_list(CGroupBonding *first);
61
62 void cgroup_bonding_free(CGroupBonding *b);
63 void cgroup_bonding_free_list(CGroupBonding *first);
64
65 int cgroup_bonding_install(CGroupBonding *b, pid_t pid);
66 int cgroup_bonding_install_list(CGroupBonding *first, pid_t pid);
67
68 int cgroup_bonding_kill(CGroupBonding *b, int sig);
69 int cgroup_bonding_kill_list(CGroupBonding *first, int sig);
70
71 int cgroup_bonding_is_empty(CGroupBonding *b);
72 int cgroup_bonding_is_empty_list(CGroupBonding *first);
73
74 CGroupBonding *cgroup_bonding_find_list(CGroupBonding *first, const char *controller);
75
76 #include "manager.h"
77
78 int manager_setup_cgroup(Manager *m);
79 int manager_shutdown_cgroup(Manager *m);
80
81 int cgroup_notify_empty(Manager *m, const char *group);
82
83 #endif