chiark / gitweb /
Cleaned up more unneeded types and functions.
[elogind.git] / src / core / cgroup.h
1 /*-*- Mode: C; c-basic-offset: 8; indent-tabs-mode: nil -*-*/
2
3 #pragma once
4
5 /***
6   This file is part of systemd.
7
8   Copyright 2013 Lennart Poettering
9
10   systemd is free software; you can redistribute it and/or modify it
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
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
18   Lesser General Public License for more details.
19
20   You should have received a copy of the GNU Lesser General Public License
21   along with systemd; If not, see <http://www.gnu.org/licenses/>.
22 ***/
23
24 #include <stdbool.h>
25
26 // #include "list.h"
27 // #include "time-util.h"
28 #include "logind.h"
29
30 // UNNEEDED typedef struct CGroupContext CGroupContext;
31 // UNNEEDED Stypedef struct CGroupDeviceAllow CGroupDeviceAllow;
32 // UNNEEDED typedef struct CGroupBlockIODeviceWeight CGroupBlockIODeviceWeight;
33 // UNNEEDED typedef struct CGroupBlockIODeviceBandwidth CGroupBlockIODeviceBandwidth;
34
35 /// UNNEEDED by elogind
36 #if 0
37 typedef enum CGroupDevicePolicy {
38
39         /* When devices listed, will allow those, plus built-in ones,
40         if none are listed will allow everything. */
41         CGROUP_AUTO,
42
43         /* Everything forbidden, except built-in ones and listed ones. */
44         CGROUP_CLOSED,
45
46         /* Everythings forbidden, except for the listed devices */
47         CGROUP_STRICT,
48
49         _CGROUP_DEVICE_POLICY_MAX,
50         _CGROUP_DEVICE_POLICY_INVALID = -1
51 } CGroupDevicePolicy;
52
53 struct CGroupDeviceAllow {
54         LIST_FIELDS(CGroupDeviceAllow, device_allow);
55         char *path;
56         bool r:1;
57         bool w:1;
58         bool m:1;
59 };
60
61 struct CGroupBlockIODeviceWeight {
62         LIST_FIELDS(CGroupBlockIODeviceWeight, device_weights);
63         char *path;
64         unsigned long weight;
65 };
66
67 struct CGroupBlockIODeviceBandwidth {
68         LIST_FIELDS(CGroupBlockIODeviceBandwidth, device_bandwidths);
69         char *path;
70         uint64_t bandwidth;
71         bool read;
72 };
73
74 struct CGroupContext {
75         bool cpu_accounting;
76         bool blockio_accounting;
77         bool memory_accounting;
78
79         unsigned long cpu_shares;
80         unsigned long startup_cpu_shares;
81         usec_t cpu_quota_per_sec_usec;
82
83         unsigned long blockio_weight;
84         unsigned long startup_blockio_weight;
85         LIST_HEAD(CGroupBlockIODeviceWeight, blockio_device_weights);
86         LIST_HEAD(CGroupBlockIODeviceBandwidth, blockio_device_bandwidths);
87
88         uint64_t memory_limit;
89
90         CGroupDevicePolicy device_policy;
91         LIST_HEAD(CGroupDeviceAllow, device_allow);
92
93         bool delegate;
94 };
95 #endif // 0
96
97 // #include "unit.h"
98 // #include "cgroup-util.h"
99
100 // UNNNEEDE void cgroup_context_init(CGroupContext *c);
101 // UNNEEDED void cgroup_context_done(CGroupContext *c);
102 // UNNEEDED void cgroup_context_dump(CGroupContext *c, FILE* f, const char *prefix);
103 // UNNEEDED void cgroup_context_apply(CGroupContext *c, CGroupMask mask, const char *path, ManagerState state);
104
105 // UNNEEDED CGroupMask cgroup_context_get_mask(CGroupContext *c);
106
107 // UNNEEDED void cgroup_context_free_device_allow(CGroupContext *c, CGroupDeviceAllow *a);
108 // UNNEEDED void cgroup_context_free_blockio_device_weight(CGroupContext *c, CGroupBlockIODeviceWeight *w);
109 // UNNEEDED void cgroup_context_free_blockio_device_bandwidth(CGroupContext *c, CGroupBlockIODeviceBandwidth *b);
110
111 // UNNEEDED CGroupMask unit_get_own_mask(Unit *u);
112 // UNNEEDED CGroupMask unit_get_siblings_mask(Unit *u);
113 // UNNEEDED CGroupMask unit_get_members_mask(Unit *u);
114 // UNNEEDED CGroupMask unit_get_subtree_mask(Unit *u);
115
116 // UNNEEDED vCGroupMask unit_get_target_mask(Unit *u);
117 // UNNEEDED CGroupMask unit_get_enable_mask(Unit *u);
118
119 // UNNEEDED void unit_update_cgroup_members_masks(Unit *u);
120
121 // UNNEEDED har *unit_default_cgroup_path(Unit *u);
122 // UNNEEDED int unit_set_cgroup_path(Unit *u, const char *path);
123
124 // UNNEEDED int unit_realize_cgroup(Unit *u);
125 // UNNEEDED void unit_release_cgroup(Unit *u);
126 // UNNEEDED void unit_prune_cgroup(Unit *u);
127 // UNNEEDED int unit_watch_cgroup(Unit *u);
128
129 // UNNEEDED int unit_attach_pids_to_cgroup(Unit *u);
130
131 int manager_setup_cgroup(Manager *m);
132 void manager_shutdown_cgroup(Manager *m, bool delete);
133
134 // UNNEEDED unsigned manager_dispatch_cgroup_queue(Manager *m);
135
136 // UNNEEDED Unit *manager_get_unit_by_cgroup(Manager *m, const char *cgroup);
137 // UNNEEDED Unit *manager_get_unit_by_pid_cgroup(Manager *m, pid_t pid);
138 // UNNEEDED Unit* manager_get_unit_by_pid(Manager *m, pid_t pid);
139
140 // UNNEEDED int unit_search_main_pid(Unit *u, pid_t *ret);
141 // UNNEEDED int unit_watch_all_pids(Unit *u);
142
143 // UNNEEDED int unit_get_memory_current(Unit *u, uint64_t *ret);
144 // UNNEEDED int unit_get_cpu_usage(Unit *u, nsec_t *ret);
145 // UNNEEDED int unit_reset_cpu_usage(Unit *u);
146
147 // UNNEEDED bool unit_cgroup_delegate(Unit *u);
148
149 // UNNEEDED int unit_notify_cgroup_empty(Unit *u);
150 // UNNEEDED int manager_notify_cgroup_empty(Manager *m, const char *group);
151
152 // UNNEEDED const char* cgroup_device_policy_to_string(CGroupDevicePolicy i) _const_;
153 // UNNEEDED CGroupDevicePolicy cgroup_device_policy_from_string(const char *s) _pure_;