File: | build-scan/../src/core/dbus-cgroup.c |
Warning: | line 1020, column 25 Although the value stored to 'r' is used in the enclosing expression, the value is never actually read from 'r' |
Press '?' to see keyboard shortcuts
Keyboard shortcuts:
1 | /* SPDX-License-Identifier: LGPL-2.1+ */ |
2 | |
3 | #include <arpa/inet.h> |
4 | #include <stdio_ext.h> |
5 | |
6 | #include "af-list.h" |
7 | #include "alloc-util.h" |
8 | #include "bpf-firewall.h" |
9 | #include "bus-util.h" |
10 | #include "cgroup-util.h" |
11 | #include "cgroup.h" |
12 | #include "dbus-cgroup.h" |
13 | #include "dbus-util.h" |
14 | #include "fd-util.h" |
15 | #include "fileio.h" |
16 | #include "path-util.h" |
17 | |
18 | static BUS_DEFINE_PROPERTY_GET_ENUM(property_get_cgroup_device_policy, cgroup_device_policy, CGroupDevicePolicy)int property_get_cgroup_device_policy(sd_bus *bus, const char *path, const char *interface, const char *property, sd_bus_message *reply, void *userdata, sd_bus_error *error) { CGroupDevicePolicy *data = userdata; do { if ((__builtin_expect(!!(!(bus)),0))) log_assert_failed_realm(LOG_REALM_SYSTEMD, ("bus"), "../src/core/dbus-cgroup.c" , 18, __PRETTY_FUNCTION__); } while (0); do { if ((__builtin_expect (!!(!(reply)),0))) log_assert_failed_realm(LOG_REALM_SYSTEMD, ("reply"), "../src/core/dbus-cgroup.c", 18, __PRETTY_FUNCTION__ ); } while (0); do { if ((__builtin_expect(!!(!(data)),0))) log_assert_failed_realm (LOG_REALM_SYSTEMD, ("data"), "../src/core/dbus-cgroup.c", 18 , __PRETTY_FUNCTION__); } while (0); return sd_bus_message_append (reply, "s", cgroup_device_policy_to_string((*(data)))); }; |
19 | |
20 | static int property_get_delegate_controllers( |
21 | sd_bus *bus, |
22 | const char *path, |
23 | const char *interface, |
24 | const char *property, |
25 | sd_bus_message *reply, |
26 | void *userdata, |
27 | sd_bus_error *error) { |
28 | |
29 | CGroupContext *c = userdata; |
30 | CGroupController cc; |
31 | int r; |
32 | |
33 | assert(bus)do { if ((__builtin_expect(!!(!(bus)),0))) log_assert_failed_realm (LOG_REALM_SYSTEMD, ("bus"), "../src/core/dbus-cgroup.c", 33, __PRETTY_FUNCTION__); } while (0); |
34 | assert(reply)do { if ((__builtin_expect(!!(!(reply)),0))) log_assert_failed_realm (LOG_REALM_SYSTEMD, ("reply"), "../src/core/dbus-cgroup.c", 34 , __PRETTY_FUNCTION__); } while (0); |
35 | assert(c)do { if ((__builtin_expect(!!(!(c)),0))) log_assert_failed_realm (LOG_REALM_SYSTEMD, ("c"), "../src/core/dbus-cgroup.c", 35, __PRETTY_FUNCTION__ ); } while (0); |
36 | |
37 | if (!c->delegate) |
38 | return sd_bus_message_append(reply, "as", 0); |
39 | |
40 | r = sd_bus_message_open_container(reply, 'a', "s"); |
41 | if (r < 0) |
42 | return r; |
43 | |
44 | for (cc = 0; cc < _CGROUP_CONTROLLER_MAX; cc++) { |
45 | if ((c->delegate_controllers & CGROUP_CONTROLLER_TO_MASK(cc)(1 << (cc))) == 0) |
46 | continue; |
47 | |
48 | r = sd_bus_message_append(reply, "s", cgroup_controller_to_string(cc)); |
49 | if (r < 0) |
50 | return r; |
51 | } |
52 | |
53 | return sd_bus_message_close_container(reply); |
54 | } |
55 | |
56 | static int property_get_cpuset( |
57 | sd_bus *bus, |
58 | const char *path, |
59 | const char *interface, |
60 | const char *property, |
61 | sd_bus_message *reply, |
62 | void *userdata, |
63 | sd_bus_error *error) { |
64 | |
65 | CPUSet *cpus = userdata; |
66 | _cleanup_free___attribute__((cleanup(freep))) uint8_t *array = NULL((void*)0); |
67 | size_t allocated; |
68 | |
69 | assert(bus)do { if ((__builtin_expect(!!(!(bus)),0))) log_assert_failed_realm (LOG_REALM_SYSTEMD, ("bus"), "../src/core/dbus-cgroup.c", 69, __PRETTY_FUNCTION__); } while (0); |
70 | assert(reply)do { if ((__builtin_expect(!!(!(reply)),0))) log_assert_failed_realm (LOG_REALM_SYSTEMD, ("reply"), "../src/core/dbus-cgroup.c", 70 , __PRETTY_FUNCTION__); } while (0); |
71 | assert(cpus)do { if ((__builtin_expect(!!(!(cpus)),0))) log_assert_failed_realm (LOG_REALM_SYSTEMD, ("cpus"), "../src/core/dbus-cgroup.c", 71 , __PRETTY_FUNCTION__); } while (0); |
72 | |
73 | (void) cpu_set_to_dbus(cpus, &array, &allocated); |
74 | return sd_bus_message_append_array(reply, 'y', array, allocated); |
75 | } |
76 | |
77 | static int property_get_io_device_weight( |
78 | sd_bus *bus, |
79 | const char *path, |
80 | const char *interface, |
81 | const char *property, |
82 | sd_bus_message *reply, |
83 | void *userdata, |
84 | sd_bus_error *error) { |
85 | |
86 | CGroupContext *c = userdata; |
87 | CGroupIODeviceWeight *w; |
88 | int r; |
89 | |
90 | assert(bus)do { if ((__builtin_expect(!!(!(bus)),0))) log_assert_failed_realm (LOG_REALM_SYSTEMD, ("bus"), "../src/core/dbus-cgroup.c", 90, __PRETTY_FUNCTION__); } while (0); |
91 | assert(reply)do { if ((__builtin_expect(!!(!(reply)),0))) log_assert_failed_realm (LOG_REALM_SYSTEMD, ("reply"), "../src/core/dbus-cgroup.c", 91 , __PRETTY_FUNCTION__); } while (0); |
92 | assert(c)do { if ((__builtin_expect(!!(!(c)),0))) log_assert_failed_realm (LOG_REALM_SYSTEMD, ("c"), "../src/core/dbus-cgroup.c", 92, __PRETTY_FUNCTION__ ); } while (0); |
93 | |
94 | r = sd_bus_message_open_container(reply, 'a', "(st)"); |
95 | if (r < 0) |
96 | return r; |
97 | |
98 | LIST_FOREACH(device_weights, w, c->io_device_weights)for ((w) = (c->io_device_weights); (w); (w) = (w)->device_weights_next ) { |
99 | r = sd_bus_message_append(reply, "(st)", w->path, w->weight); |
100 | if (r < 0) |
101 | return r; |
102 | } |
103 | |
104 | return sd_bus_message_close_container(reply); |
105 | } |
106 | |
107 | static int property_get_io_device_limits( |
108 | sd_bus *bus, |
109 | const char *path, |
110 | const char *interface, |
111 | const char *property, |
112 | sd_bus_message *reply, |
113 | void *userdata, |
114 | sd_bus_error *error) { |
115 | |
116 | CGroupContext *c = userdata; |
117 | CGroupIODeviceLimit *l; |
118 | int r; |
119 | |
120 | assert(bus)do { if ((__builtin_expect(!!(!(bus)),0))) log_assert_failed_realm (LOG_REALM_SYSTEMD, ("bus"), "../src/core/dbus-cgroup.c", 120 , __PRETTY_FUNCTION__); } while (0); |
121 | assert(reply)do { if ((__builtin_expect(!!(!(reply)),0))) log_assert_failed_realm (LOG_REALM_SYSTEMD, ("reply"), "../src/core/dbus-cgroup.c", 121 , __PRETTY_FUNCTION__); } while (0); |
122 | assert(c)do { if ((__builtin_expect(!!(!(c)),0))) log_assert_failed_realm (LOG_REALM_SYSTEMD, ("c"), "../src/core/dbus-cgroup.c", 122, __PRETTY_FUNCTION__ ); } while (0); |
123 | |
124 | r = sd_bus_message_open_container(reply, 'a', "(st)"); |
125 | if (r < 0) |
126 | return r; |
127 | |
128 | LIST_FOREACH(device_limits, l, c->io_device_limits)for ((l) = (c->io_device_limits); (l); (l) = (l)->device_limits_next ) { |
129 | CGroupIOLimitType type; |
130 | |
131 | type = cgroup_io_limit_type_from_string(property); |
132 | if (type < 0 || l->limits[type] == cgroup_io_limit_defaults[type]) |
133 | continue; |
134 | |
135 | r = sd_bus_message_append(reply, "(st)", l->path, l->limits[type]); |
136 | if (r < 0) |
137 | return r; |
138 | } |
139 | |
140 | return sd_bus_message_close_container(reply); |
141 | } |
142 | |
143 | static int property_get_io_device_latency( |
144 | sd_bus *bus, |
145 | const char *path, |
146 | const char *interface, |
147 | const char *property, |
148 | sd_bus_message *reply, |
149 | void *userdata, |
150 | sd_bus_error *error) { |
151 | |
152 | CGroupContext *c = userdata; |
153 | CGroupIODeviceLatency *l; |
154 | int r; |
155 | |
156 | assert(bus)do { if ((__builtin_expect(!!(!(bus)),0))) log_assert_failed_realm (LOG_REALM_SYSTEMD, ("bus"), "../src/core/dbus-cgroup.c", 156 , __PRETTY_FUNCTION__); } while (0); |
157 | assert(reply)do { if ((__builtin_expect(!!(!(reply)),0))) log_assert_failed_realm (LOG_REALM_SYSTEMD, ("reply"), "../src/core/dbus-cgroup.c", 157 , __PRETTY_FUNCTION__); } while (0); |
158 | assert(c)do { if ((__builtin_expect(!!(!(c)),0))) log_assert_failed_realm (LOG_REALM_SYSTEMD, ("c"), "../src/core/dbus-cgroup.c", 158, __PRETTY_FUNCTION__ ); } while (0); |
159 | |
160 | r = sd_bus_message_open_container(reply, 'a', "(st)"); |
161 | if (r < 0) |
162 | return r; |
163 | |
164 | LIST_FOREACH(device_latencies, l, c->io_device_latencies)for ((l) = (c->io_device_latencies); (l); (l) = (l)->device_latencies_next ) { |
165 | r = sd_bus_message_append(reply, "(st)", l->path, l->target_usec); |
166 | if (r < 0) |
167 | return r; |
168 | } |
169 | |
170 | return sd_bus_message_close_container(reply); |
171 | } |
172 | |
173 | static int property_get_blockio_device_weight( |
174 | sd_bus *bus, |
175 | const char *path, |
176 | const char *interface, |
177 | const char *property, |
178 | sd_bus_message *reply, |
179 | void *userdata, |
180 | sd_bus_error *error) { |
181 | |
182 | CGroupContext *c = userdata; |
183 | CGroupBlockIODeviceWeight *w; |
184 | int r; |
185 | |
186 | assert(bus)do { if ((__builtin_expect(!!(!(bus)),0))) log_assert_failed_realm (LOG_REALM_SYSTEMD, ("bus"), "../src/core/dbus-cgroup.c", 186 , __PRETTY_FUNCTION__); } while (0); |
187 | assert(reply)do { if ((__builtin_expect(!!(!(reply)),0))) log_assert_failed_realm (LOG_REALM_SYSTEMD, ("reply"), "../src/core/dbus-cgroup.c", 187 , __PRETTY_FUNCTION__); } while (0); |
188 | assert(c)do { if ((__builtin_expect(!!(!(c)),0))) log_assert_failed_realm (LOG_REALM_SYSTEMD, ("c"), "../src/core/dbus-cgroup.c", 188, __PRETTY_FUNCTION__ ); } while (0); |
189 | |
190 | r = sd_bus_message_open_container(reply, 'a', "(st)"); |
191 | if (r < 0) |
192 | return r; |
193 | |
194 | LIST_FOREACH(device_weights, w, c->blockio_device_weights)for ((w) = (c->blockio_device_weights); (w); (w) = (w)-> device_weights_next) { |
195 | r = sd_bus_message_append(reply, "(st)", w->path, w->weight); |
196 | if (r < 0) |
197 | return r; |
198 | } |
199 | |
200 | return sd_bus_message_close_container(reply); |
201 | } |
202 | |
203 | static int property_get_blockio_device_bandwidths( |
204 | sd_bus *bus, |
205 | const char *path, |
206 | const char *interface, |
207 | const char *property, |
208 | sd_bus_message *reply, |
209 | void *userdata, |
210 | sd_bus_error *error) { |
211 | |
212 | CGroupContext *c = userdata; |
213 | CGroupBlockIODeviceBandwidth *b; |
214 | int r; |
215 | |
216 | assert(bus)do { if ((__builtin_expect(!!(!(bus)),0))) log_assert_failed_realm (LOG_REALM_SYSTEMD, ("bus"), "../src/core/dbus-cgroup.c", 216 , __PRETTY_FUNCTION__); } while (0); |
217 | assert(reply)do { if ((__builtin_expect(!!(!(reply)),0))) log_assert_failed_realm (LOG_REALM_SYSTEMD, ("reply"), "../src/core/dbus-cgroup.c", 217 , __PRETTY_FUNCTION__); } while (0); |
218 | assert(c)do { if ((__builtin_expect(!!(!(c)),0))) log_assert_failed_realm (LOG_REALM_SYSTEMD, ("c"), "../src/core/dbus-cgroup.c", 218, __PRETTY_FUNCTION__ ); } while (0); |
219 | |
220 | r = sd_bus_message_open_container(reply, 'a', "(st)"); |
221 | if (r < 0) |
222 | return r; |
223 | |
224 | LIST_FOREACH(device_bandwidths, b, c->blockio_device_bandwidths)for ((b) = (c->blockio_device_bandwidths); (b); (b) = (b)-> device_bandwidths_next) { |
225 | uint64_t v; |
226 | |
227 | if (streq(property, "BlockIOReadBandwidth")(strcmp((property),("BlockIOReadBandwidth")) == 0)) |
228 | v = b->rbps; |
229 | else |
230 | v = b->wbps; |
231 | |
232 | if (v == CGROUP_LIMIT_MAX((uint64_t) -1)) |
233 | continue; |
234 | |
235 | r = sd_bus_message_append(reply, "(st)", b->path, v); |
236 | if (r < 0) |
237 | return r; |
238 | } |
239 | |
240 | return sd_bus_message_close_container(reply); |
241 | } |
242 | |
243 | static int property_get_device_allow( |
244 | sd_bus *bus, |
245 | const char *path, |
246 | const char *interface, |
247 | const char *property, |
248 | sd_bus_message *reply, |
249 | void *userdata, |
250 | sd_bus_error *error) { |
251 | |
252 | CGroupContext *c = userdata; |
253 | CGroupDeviceAllow *a; |
254 | int r; |
255 | |
256 | assert(bus)do { if ((__builtin_expect(!!(!(bus)),0))) log_assert_failed_realm (LOG_REALM_SYSTEMD, ("bus"), "../src/core/dbus-cgroup.c", 256 , __PRETTY_FUNCTION__); } while (0); |
257 | assert(reply)do { if ((__builtin_expect(!!(!(reply)),0))) log_assert_failed_realm (LOG_REALM_SYSTEMD, ("reply"), "../src/core/dbus-cgroup.c", 257 , __PRETTY_FUNCTION__); } while (0); |
258 | assert(c)do { if ((__builtin_expect(!!(!(c)),0))) log_assert_failed_realm (LOG_REALM_SYSTEMD, ("c"), "../src/core/dbus-cgroup.c", 258, __PRETTY_FUNCTION__ ); } while (0); |
259 | |
260 | r = sd_bus_message_open_container(reply, 'a', "(ss)"); |
261 | if (r < 0) |
262 | return r; |
263 | |
264 | LIST_FOREACH(device_allow, a, c->device_allow)for ((a) = (c->device_allow); (a); (a) = (a)->device_allow_next ) { |
265 | unsigned k = 0; |
266 | char rwm[4]; |
267 | |
268 | if (a->r) |
269 | rwm[k++] = 'r'; |
270 | if (a->w) |
271 | rwm[k++] = 'w'; |
272 | if (a->m) |
273 | rwm[k++] = 'm'; |
274 | |
275 | rwm[k] = 0; |
276 | |
277 | r = sd_bus_message_append(reply, "(ss)", a->path, rwm); |
278 | if (r < 0) |
279 | return r; |
280 | } |
281 | |
282 | return sd_bus_message_close_container(reply); |
283 | } |
284 | |
285 | static int property_get_ip_address_access( |
286 | sd_bus *bus, |
287 | const char *path, |
288 | const char *interface, |
289 | const char *property, |
290 | sd_bus_message *reply, |
291 | void *userdata, |
292 | sd_bus_error *error) { |
293 | |
294 | IPAddressAccessItem** items = userdata, *i; |
295 | int r; |
296 | |
297 | r = sd_bus_message_open_container(reply, 'a', "(iayu)"); |
298 | if (r < 0) |
299 | return r; |
300 | |
301 | LIST_FOREACH(items, i, *items)for ((i) = (*items); (i); (i) = (i)->items_next) { |
302 | |
303 | r = sd_bus_message_open_container(reply, 'r', "iayu"); |
304 | if (r < 0) |
305 | return r; |
306 | |
307 | r = sd_bus_message_append(reply, "i", i->family); |
308 | if (r < 0) |
309 | return r; |
310 | |
311 | r = sd_bus_message_append_array(reply, 'y', &i->address, FAMILY_ADDRESS_SIZE(i->family)); |
312 | if (r < 0) |
313 | return r; |
314 | |
315 | r = sd_bus_message_append(reply, "u", (uint32_t) i->prefixlen); |
316 | if (r < 0) |
317 | return r; |
318 | |
319 | r = sd_bus_message_close_container(reply); |
320 | if (r < 0) |
321 | return r; |
322 | } |
323 | |
324 | return sd_bus_message_close_container(reply); |
325 | } |
326 | |
327 | const sd_bus_vtable bus_cgroup_vtable[] = { |
328 | SD_BUS_VTABLE_START(0){ .type = _SD_BUS_VTABLE_START, .flags = 0, .x = { .start = { .element_size = sizeof(sd_bus_vtable) }, }, }, |
329 | SD_BUS_PROPERTY("Delegate", "b", bus_property_get_bool, offsetof(CGroupContext, delegate), 0){ .type = _SD_BUS_VTABLE_PROPERTY, .flags = 0, .x = { .property = { .member = "Delegate", .signature = "b", .get = bus_property_get_bool , .set = ((void*)0), .offset = __builtin_offsetof(CGroupContext , delegate), }, }, }, |
330 | SD_BUS_PROPERTY("DelegateControllers", "as", property_get_delegate_controllers, 0, 0){ .type = _SD_BUS_VTABLE_PROPERTY, .flags = 0, .x = { .property = { .member = "DelegateControllers", .signature = "as", .get = property_get_delegate_controllers, .set = ((void*)0), .offset = 0, }, }, }, |
331 | SD_BUS_PROPERTY("CPUAccounting", "b", bus_property_get_bool, offsetof(CGroupContext, cpu_accounting), 0){ .type = _SD_BUS_VTABLE_PROPERTY, .flags = 0, .x = { .property = { .member = "CPUAccounting", .signature = "b", .get = bus_property_get_bool , .set = ((void*)0), .offset = __builtin_offsetof(CGroupContext , cpu_accounting), }, }, }, |
332 | SD_BUS_PROPERTY("CPUWeight", "t", NULL, offsetof(CGroupContext, cpu_weight), 0){ .type = _SD_BUS_VTABLE_PROPERTY, .flags = 0, .x = { .property = { .member = "CPUWeight", .signature = "t", .get = ((void*) 0), .set = ((void*)0), .offset = __builtin_offsetof(CGroupContext , cpu_weight), }, }, }, |
333 | SD_BUS_PROPERTY("StartupCPUWeight", "t", NULL, offsetof(CGroupContext, startup_cpu_weight), 0){ .type = _SD_BUS_VTABLE_PROPERTY, .flags = 0, .x = { .property = { .member = "StartupCPUWeight", .signature = "t", .get = ( (void*)0), .set = ((void*)0), .offset = __builtin_offsetof(CGroupContext , startup_cpu_weight), }, }, }, |
334 | SD_BUS_PROPERTY("CPUShares", "t", NULL, offsetof(CGroupContext, cpu_shares), 0){ .type = _SD_BUS_VTABLE_PROPERTY, .flags = 0, .x = { .property = { .member = "CPUShares", .signature = "t", .get = ((void*) 0), .set = ((void*)0), .offset = __builtin_offsetof(CGroupContext , cpu_shares), }, }, }, |
335 | SD_BUS_PROPERTY("StartupCPUShares", "t", NULL, offsetof(CGroupContext, startup_cpu_shares), 0){ .type = _SD_BUS_VTABLE_PROPERTY, .flags = 0, .x = { .property = { .member = "StartupCPUShares", .signature = "t", .get = ( (void*)0), .set = ((void*)0), .offset = __builtin_offsetof(CGroupContext , startup_cpu_shares), }, }, }, |
336 | SD_BUS_PROPERTY("CPUQuotaPerSecUSec", "t", bus_property_get_usec, offsetof(CGroupContext, cpu_quota_per_sec_usec), 0){ .type = _SD_BUS_VTABLE_PROPERTY, .flags = 0, .x = { .property = { .member = "CPUQuotaPerSecUSec", .signature = "t", .get = ((sd_bus_property_get_t) ((void*)0)), .set = ((void*)0), .offset = __builtin_offsetof(CGroupContext, cpu_quota_per_sec_usec), }, }, }, |
337 | SD_BUS_PROPERTY("CPUQuotaPeriodUSec", "t", bus_property_get_usec, offsetof(CGroupContext, cpu_quota_period_usec), 0){ .type = _SD_BUS_VTABLE_PROPERTY, .flags = 0, .x = { .property = { .member = "CPUQuotaPeriodUSec", .signature = "t", .get = ((sd_bus_property_get_t) ((void*)0)), .set = ((void*)0), .offset = __builtin_offsetof(CGroupContext, cpu_quota_period_usec), } , }, }, |
338 | SD_BUS_PROPERTY("AllowedCPUs", "ay", property_get_cpuset, offsetof(CGroupContext, cpuset_cpus), 0){ .type = _SD_BUS_VTABLE_PROPERTY, .flags = 0, .x = { .property = { .member = "AllowedCPUs", .signature = "ay", .get = property_get_cpuset , .set = ((void*)0), .offset = __builtin_offsetof(CGroupContext , cpuset_cpus), }, }, }, |
339 | SD_BUS_PROPERTY("AllowedMemoryNodes", "ay", property_get_cpuset, offsetof(CGroupContext, cpuset_mems), 0){ .type = _SD_BUS_VTABLE_PROPERTY, .flags = 0, .x = { .property = { .member = "AllowedMemoryNodes", .signature = "ay", .get = property_get_cpuset, .set = ((void*)0), .offset = __builtin_offsetof (CGroupContext, cpuset_mems), }, }, }, |
340 | SD_BUS_PROPERTY("IOAccounting", "b", bus_property_get_bool, offsetof(CGroupContext, io_accounting), 0){ .type = _SD_BUS_VTABLE_PROPERTY, .flags = 0, .x = { .property = { .member = "IOAccounting", .signature = "b", .get = bus_property_get_bool , .set = ((void*)0), .offset = __builtin_offsetof(CGroupContext , io_accounting), }, }, }, |
341 | SD_BUS_PROPERTY("IOWeight", "t", NULL, offsetof(CGroupContext, io_weight), 0){ .type = _SD_BUS_VTABLE_PROPERTY, .flags = 0, .x = { .property = { .member = "IOWeight", .signature = "t", .get = ((void*)0 ), .set = ((void*)0), .offset = __builtin_offsetof(CGroupContext , io_weight), }, }, }, |
342 | SD_BUS_PROPERTY("StartupIOWeight", "t", NULL, offsetof(CGroupContext, startup_io_weight), 0){ .type = _SD_BUS_VTABLE_PROPERTY, .flags = 0, .x = { .property = { .member = "StartupIOWeight", .signature = "t", .get = (( void*)0), .set = ((void*)0), .offset = __builtin_offsetof(CGroupContext , startup_io_weight), }, }, }, |
343 | SD_BUS_PROPERTY("IODeviceWeight", "a(st)", property_get_io_device_weight, 0, 0){ .type = _SD_BUS_VTABLE_PROPERTY, .flags = 0, .x = { .property = { .member = "IODeviceWeight", .signature = "a(st)", .get = property_get_io_device_weight, .set = ((void*)0), .offset = 0 , }, }, }, |
344 | SD_BUS_PROPERTY("IOReadBandwidthMax", "a(st)", property_get_io_device_limits, 0, 0){ .type = _SD_BUS_VTABLE_PROPERTY, .flags = 0, .x = { .property = { .member = "IOReadBandwidthMax", .signature = "a(st)", .get = property_get_io_device_limits, .set = ((void*)0), .offset = 0, }, }, }, |
345 | SD_BUS_PROPERTY("IOWriteBandwidthMax", "a(st)", property_get_io_device_limits, 0, 0){ .type = _SD_BUS_VTABLE_PROPERTY, .flags = 0, .x = { .property = { .member = "IOWriteBandwidthMax", .signature = "a(st)", . get = property_get_io_device_limits, .set = ((void*)0), .offset = 0, }, }, }, |
346 | SD_BUS_PROPERTY("IOReadIOPSMax", "a(st)", property_get_io_device_limits, 0, 0){ .type = _SD_BUS_VTABLE_PROPERTY, .flags = 0, .x = { .property = { .member = "IOReadIOPSMax", .signature = "a(st)", .get = property_get_io_device_limits , .set = ((void*)0), .offset = 0, }, }, }, |
347 | SD_BUS_PROPERTY("IOWriteIOPSMax", "a(st)", property_get_io_device_limits, 0, 0){ .type = _SD_BUS_VTABLE_PROPERTY, .flags = 0, .x = { .property = { .member = "IOWriteIOPSMax", .signature = "a(st)", .get = property_get_io_device_limits, .set = ((void*)0), .offset = 0 , }, }, }, |
348 | SD_BUS_PROPERTY("IODeviceLatencyTargetUSec", "a(st)", property_get_io_device_latency, 0, 0){ .type = _SD_BUS_VTABLE_PROPERTY, .flags = 0, .x = { .property = { .member = "IODeviceLatencyTargetUSec", .signature = "a(st)" , .get = property_get_io_device_latency, .set = ((void*)0), . offset = 0, }, }, }, |
349 | SD_BUS_PROPERTY("BlockIOAccounting", "b", bus_property_get_bool, offsetof(CGroupContext, blockio_accounting), 0){ .type = _SD_BUS_VTABLE_PROPERTY, .flags = 0, .x = { .property = { .member = "BlockIOAccounting", .signature = "b", .get = bus_property_get_bool , .set = ((void*)0), .offset = __builtin_offsetof(CGroupContext , blockio_accounting), }, }, }, |
350 | SD_BUS_PROPERTY("BlockIOWeight", "t", NULL, offsetof(CGroupContext, blockio_weight), 0){ .type = _SD_BUS_VTABLE_PROPERTY, .flags = 0, .x = { .property = { .member = "BlockIOWeight", .signature = "t", .get = ((void *)0), .set = ((void*)0), .offset = __builtin_offsetof(CGroupContext , blockio_weight), }, }, }, |
351 | SD_BUS_PROPERTY("StartupBlockIOWeight", "t", NULL, offsetof(CGroupContext, startup_blockio_weight), 0){ .type = _SD_BUS_VTABLE_PROPERTY, .flags = 0, .x = { .property = { .member = "StartupBlockIOWeight", .signature = "t", .get = ((void*)0), .set = ((void*)0), .offset = __builtin_offsetof (CGroupContext, startup_blockio_weight), }, }, }, |
352 | SD_BUS_PROPERTY("BlockIODeviceWeight", "a(st)", property_get_blockio_device_weight, 0, 0){ .type = _SD_BUS_VTABLE_PROPERTY, .flags = 0, .x = { .property = { .member = "BlockIODeviceWeight", .signature = "a(st)", . get = property_get_blockio_device_weight, .set = ((void*)0), . offset = 0, }, }, }, |
353 | SD_BUS_PROPERTY("BlockIOReadBandwidth", "a(st)", property_get_blockio_device_bandwidths, 0, 0){ .type = _SD_BUS_VTABLE_PROPERTY, .flags = 0, .x = { .property = { .member = "BlockIOReadBandwidth", .signature = "a(st)", . get = property_get_blockio_device_bandwidths, .set = ((void*) 0), .offset = 0, }, }, }, |
354 | SD_BUS_PROPERTY("BlockIOWriteBandwidth", "a(st)", property_get_blockio_device_bandwidths, 0, 0){ .type = _SD_BUS_VTABLE_PROPERTY, .flags = 0, .x = { .property = { .member = "BlockIOWriteBandwidth", .signature = "a(st)", .get = property_get_blockio_device_bandwidths, .set = ((void *)0), .offset = 0, }, }, }, |
355 | SD_BUS_PROPERTY("MemoryAccounting", "b", bus_property_get_bool, offsetof(CGroupContext, memory_accounting), 0){ .type = _SD_BUS_VTABLE_PROPERTY, .flags = 0, .x = { .property = { .member = "MemoryAccounting", .signature = "b", .get = bus_property_get_bool , .set = ((void*)0), .offset = __builtin_offsetof(CGroupContext , memory_accounting), }, }, }, |
356 | SD_BUS_PROPERTY("DefaultMemoryLow", "t", NULL, offsetof(CGroupContext, default_memory_low), 0){ .type = _SD_BUS_VTABLE_PROPERTY, .flags = 0, .x = { .property = { .member = "DefaultMemoryLow", .signature = "t", .get = ( (void*)0), .set = ((void*)0), .offset = __builtin_offsetof(CGroupContext , default_memory_low), }, }, }, |
357 | SD_BUS_PROPERTY("DefaultMemoryMin", "t", NULL, offsetof(CGroupContext, default_memory_min), 0){ .type = _SD_BUS_VTABLE_PROPERTY, .flags = 0, .x = { .property = { .member = "DefaultMemoryMin", .signature = "t", .get = ( (void*)0), .set = ((void*)0), .offset = __builtin_offsetof(CGroupContext , default_memory_min), }, }, }, |
358 | SD_BUS_PROPERTY("MemoryMin", "t", NULL, offsetof(CGroupContext, memory_min), 0){ .type = _SD_BUS_VTABLE_PROPERTY, .flags = 0, .x = { .property = { .member = "MemoryMin", .signature = "t", .get = ((void*) 0), .set = ((void*)0), .offset = __builtin_offsetof(CGroupContext , memory_min), }, }, }, |
359 | SD_BUS_PROPERTY("MemoryLow", "t", NULL, offsetof(CGroupContext, memory_low), 0){ .type = _SD_BUS_VTABLE_PROPERTY, .flags = 0, .x = { .property = { .member = "MemoryLow", .signature = "t", .get = ((void*) 0), .set = ((void*)0), .offset = __builtin_offsetof(CGroupContext , memory_low), }, }, }, |
360 | SD_BUS_PROPERTY("MemoryHigh", "t", NULL, offsetof(CGroupContext, memory_high), 0){ .type = _SD_BUS_VTABLE_PROPERTY, .flags = 0, .x = { .property = { .member = "MemoryHigh", .signature = "t", .get = ((void* )0), .set = ((void*)0), .offset = __builtin_offsetof(CGroupContext , memory_high), }, }, }, |
361 | SD_BUS_PROPERTY("MemoryMax", "t", NULL, offsetof(CGroupContext, memory_max), 0){ .type = _SD_BUS_VTABLE_PROPERTY, .flags = 0, .x = { .property = { .member = "MemoryMax", .signature = "t", .get = ((void*) 0), .set = ((void*)0), .offset = __builtin_offsetof(CGroupContext , memory_max), }, }, }, |
362 | SD_BUS_PROPERTY("MemorySwapMax", "t", NULL, offsetof(CGroupContext, memory_swap_max), 0){ .type = _SD_BUS_VTABLE_PROPERTY, .flags = 0, .x = { .property = { .member = "MemorySwapMax", .signature = "t", .get = ((void *)0), .set = ((void*)0), .offset = __builtin_offsetof(CGroupContext , memory_swap_max), }, }, }, |
363 | SD_BUS_PROPERTY("MemoryLimit", "t", NULL, offsetof(CGroupContext, memory_limit), 0){ .type = _SD_BUS_VTABLE_PROPERTY, .flags = 0, .x = { .property = { .member = "MemoryLimit", .signature = "t", .get = ((void *)0), .set = ((void*)0), .offset = __builtin_offsetof(CGroupContext , memory_limit), }, }, }, |
364 | SD_BUS_PROPERTY("DevicePolicy", "s", property_get_cgroup_device_policy, offsetof(CGroupContext, device_policy), 0){ .type = _SD_BUS_VTABLE_PROPERTY, .flags = 0, .x = { .property = { .member = "DevicePolicy", .signature = "s", .get = property_get_cgroup_device_policy , .set = ((void*)0), .offset = __builtin_offsetof(CGroupContext , device_policy), }, }, }, |
365 | SD_BUS_PROPERTY("DeviceAllow", "a(ss)", property_get_device_allow, 0, 0){ .type = _SD_BUS_VTABLE_PROPERTY, .flags = 0, .x = { .property = { .member = "DeviceAllow", .signature = "a(ss)", .get = property_get_device_allow , .set = ((void*)0), .offset = 0, }, }, }, |
366 | SD_BUS_PROPERTY("TasksAccounting", "b", bus_property_get_bool, offsetof(CGroupContext, tasks_accounting), 0){ .type = _SD_BUS_VTABLE_PROPERTY, .flags = 0, .x = { .property = { .member = "TasksAccounting", .signature = "b", .get = bus_property_get_bool , .set = ((void*)0), .offset = __builtin_offsetof(CGroupContext , tasks_accounting), }, }, }, |
367 | SD_BUS_PROPERTY("TasksMax", "t", NULL, offsetof(CGroupContext, tasks_max), 0){ .type = _SD_BUS_VTABLE_PROPERTY, .flags = 0, .x = { .property = { .member = "TasksMax", .signature = "t", .get = ((void*)0 ), .set = ((void*)0), .offset = __builtin_offsetof(CGroupContext , tasks_max), }, }, }, |
368 | SD_BUS_PROPERTY("IPAccounting", "b", bus_property_get_bool, offsetof(CGroupContext, ip_accounting), 0){ .type = _SD_BUS_VTABLE_PROPERTY, .flags = 0, .x = { .property = { .member = "IPAccounting", .signature = "b", .get = bus_property_get_bool , .set = ((void*)0), .offset = __builtin_offsetof(CGroupContext , ip_accounting), }, }, }, |
369 | SD_BUS_PROPERTY("IPAddressAllow", "a(iayu)", property_get_ip_address_access, offsetof(CGroupContext, ip_address_allow), 0){ .type = _SD_BUS_VTABLE_PROPERTY, .flags = 0, .x = { .property = { .member = "IPAddressAllow", .signature = "a(iayu)", .get = property_get_ip_address_access, .set = ((void*)0), .offset = __builtin_offsetof(CGroupContext, ip_address_allow), }, }, }, |
370 | SD_BUS_PROPERTY("IPAddressDeny", "a(iayu)", property_get_ip_address_access, offsetof(CGroupContext, ip_address_deny), 0){ .type = _SD_BUS_VTABLE_PROPERTY, .flags = 0, .x = { .property = { .member = "IPAddressDeny", .signature = "a(iayu)", .get = property_get_ip_address_access, .set = ((void*)0), .offset = __builtin_offsetof(CGroupContext, ip_address_deny), }, }, }, |
371 | SD_BUS_VTABLE_END{ .type = _SD_BUS_VTABLE_END, .flags = 0, .x = { { 0 } }, } |
372 | }; |
373 | |
374 | static int bus_cgroup_set_transient_property( |
375 | Unit *u, |
376 | CGroupContext *c, |
377 | const char *name, |
378 | sd_bus_message *message, |
379 | UnitWriteFlags flags, |
380 | sd_bus_error *error) { |
381 | |
382 | int r; |
383 | |
384 | assert(u)do { if ((__builtin_expect(!!(!(u)),0))) log_assert_failed_realm (LOG_REALM_SYSTEMD, ("u"), "../src/core/dbus-cgroup.c", 384, __PRETTY_FUNCTION__ ); } while (0); |
385 | assert(c)do { if ((__builtin_expect(!!(!(c)),0))) log_assert_failed_realm (LOG_REALM_SYSTEMD, ("c"), "../src/core/dbus-cgroup.c", 385, __PRETTY_FUNCTION__ ); } while (0); |
386 | assert(name)do { if ((__builtin_expect(!!(!(name)),0))) log_assert_failed_realm (LOG_REALM_SYSTEMD, ("name"), "../src/core/dbus-cgroup.c", 386 , __PRETTY_FUNCTION__); } while (0); |
387 | assert(message)do { if ((__builtin_expect(!!(!(message)),0))) log_assert_failed_realm (LOG_REALM_SYSTEMD, ("message"), "../src/core/dbus-cgroup.c", 387, __PRETTY_FUNCTION__); } while (0); |
388 | |
389 | flags |= UNIT_PRIVATE; |
390 | |
391 | if (streq(name, "Delegate")(strcmp((name),("Delegate")) == 0)) { |
392 | int b; |
393 | |
394 | if (!UNIT_VTABLE(u)unit_vtable[(u)->type]->can_delegate) |
395 | return sd_bus_error_setf(error, SD_BUS_ERROR_INVALID_ARGS"org.freedesktop.DBus.Error.InvalidArgs", "Delegation not available for unit type"); |
396 | |
397 | r = sd_bus_message_read(message, "b", &b); |
398 | if (r < 0) |
399 | return r; |
400 | |
401 | if (!UNIT_WRITE_FLAGS_NOOP(flags)(((flags) & (UNIT_RUNTIME|UNIT_PERSISTENT)) == 0)) { |
402 | c->delegate = b; |
403 | c->delegate_controllers = b ? _CGROUP_MASK_ALL : 0; |
404 | |
405 | unit_write_settingf(u, flags, name, "Delegate=%s", yes_no(b)); |
406 | } |
407 | |
408 | return 1; |
409 | |
410 | } else if (streq(name, "DelegateControllers")(strcmp((name),("DelegateControllers")) == 0)) { |
411 | CGroupMask mask = 0; |
412 | |
413 | if (!UNIT_VTABLE(u)unit_vtable[(u)->type]->can_delegate) |
414 | return sd_bus_error_setf(error, SD_BUS_ERROR_INVALID_ARGS"org.freedesktop.DBus.Error.InvalidArgs", "Delegation not available for unit type"); |
415 | |
416 | r = sd_bus_message_enter_container(message, 'a', "s"); |
417 | if (r < 0) |
418 | return r; |
419 | |
420 | for (;;) { |
421 | CGroupController cc; |
422 | const char *t; |
423 | |
424 | r = sd_bus_message_read(message, "s", &t); |
425 | if (r < 0) |
426 | return r; |
427 | if (r == 0) |
428 | break; |
429 | |
430 | cc = cgroup_controller_from_string(t); |
431 | if (cc < 0) |
432 | return sd_bus_error_setf(error, SD_BUS_ERROR_INVALID_ARGS"org.freedesktop.DBus.Error.InvalidArgs", "Unknown cgroup controller '%s'", t); |
433 | |
434 | mask |= CGROUP_CONTROLLER_TO_MASK(cc)(1 << (cc)); |
435 | } |
436 | |
437 | r = sd_bus_message_exit_container(message); |
438 | if (r < 0) |
439 | return r; |
440 | |
441 | if (!UNIT_WRITE_FLAGS_NOOP(flags)(((flags) & (UNIT_RUNTIME|UNIT_PERSISTENT)) == 0)) { |
442 | _cleanup_free___attribute__((cleanup(freep))) char *t = NULL((void*)0); |
443 | |
444 | r = cg_mask_to_string(mask, &t); |
445 | if (r < 0) |
446 | return r; |
447 | |
448 | c->delegate = true1; |
449 | if (mask == 0) |
450 | c->delegate_controllers = 0; |
451 | else |
452 | c->delegate_controllers |= mask; |
453 | |
454 | unit_write_settingf(u, flags, name, "Delegate=%s", strempty(t)); |
455 | } |
456 | |
457 | return 1; |
458 | } |
459 | |
460 | return 0; |
461 | } |
462 | |
463 | static int bus_cgroup_set_boolean( |
464 | Unit *u, |
465 | const char *name, |
466 | bool_Bool *p, |
467 | CGroupMask mask, |
468 | sd_bus_message *message, |
469 | UnitWriteFlags flags, |
470 | sd_bus_error *error) { |
471 | |
472 | int b, r; |
473 | |
474 | assert(p)do { if ((__builtin_expect(!!(!(p)),0))) log_assert_failed_realm (LOG_REALM_SYSTEMD, ("p"), "../src/core/dbus-cgroup.c", 474, __PRETTY_FUNCTION__ ); } while (0); |
475 | |
476 | r = sd_bus_message_read(message, "b", &b); |
477 | if (r < 0) |
478 | return r; |
479 | |
480 | if (!UNIT_WRITE_FLAGS_NOOP(flags)(((flags) & (UNIT_RUNTIME|UNIT_PERSISTENT)) == 0)) { |
481 | *p = b; |
482 | unit_invalidate_cgroup(u, mask); |
483 | unit_write_settingf(u, flags, name, "%s=%s", name, yes_no(b)); |
484 | } |
485 | |
486 | return 1; |
487 | } |
488 | |
489 | #define BUS_DEFINE_SET_CGROUP_WEIGHT(function, mask, check, val)static int bus_cgroup_set_function( Unit *u, const char *name , uint64_t *p, sd_bus_message *message, UnitWriteFlags flags, sd_bus_error *error) { uint64_t v; int r; do { if ((__builtin_expect (!!(!(p)),0))) log_assert_failed_realm(LOG_REALM_SYSTEMD, ("p" ), "../src/core/dbus-cgroup.c", 489, __PRETTY_FUNCTION__); } while (0); r = sd_bus_message_read(message, "t", &v); if (r < 0) return r; if (!check(v)) return sd_bus_error_setf(error, "org.freedesktop.DBus.Error.InvalidArgs" , "Value specified in %s is out of range", name); if (!(((flags ) & (UNIT_RUNTIME|UNIT_PERSISTENT)) == 0)) { *p = v; unit_invalidate_cgroup (u, (mask)); if (v == (val)) unit_write_settingf(u, flags, name , "%s=", name); else unit_write_settingf(u, flags, name, "%s=%" "l" "u", name, v); } return 1; } \ |
490 | static int bus_cgroup_set_##function( \ |
491 | Unit *u, \ |
492 | const char *name, \ |
493 | uint64_t *p, \ |
494 | sd_bus_message *message, \ |
495 | UnitWriteFlags flags, \ |
496 | sd_bus_error *error) { \ |
497 | \ |
498 | uint64_t v; \ |
499 | int r; \ |
500 | \ |
501 | assert(p)do { if ((__builtin_expect(!!(!(p)),0))) log_assert_failed_realm (LOG_REALM_SYSTEMD, ("p"), "../src/core/dbus-cgroup.c", 501, __PRETTY_FUNCTION__ ); } while (0); \ |
502 | \ |
503 | r = sd_bus_message_read(message, "t", &v); \ |
504 | if (r < 0) \ |
505 | return r; \ |
506 | \ |
507 | if (!check(v)) \ |
508 | return sd_bus_error_setf(error, SD_BUS_ERROR_INVALID_ARGS"org.freedesktop.DBus.Error.InvalidArgs", \ |
509 | "Value specified in %s is out of range", name); \ |
510 | \ |
511 | if (!UNIT_WRITE_FLAGS_NOOP(flags)(((flags) & (UNIT_RUNTIME|UNIT_PERSISTENT)) == 0)) { \ |
512 | *p = v; \ |
513 | unit_invalidate_cgroup(u, (mask)); \ |
514 | \ |
515 | if (v == (val)) \ |
516 | unit_write_settingf(u, flags, name, \ |
517 | "%s=", name); \ |
518 | else \ |
519 | unit_write_settingf(u, flags, name, \ |
520 | "%s=%" PRIu64"l" "u", name, v); \ |
521 | } \ |
522 | \ |
523 | return 1; \ |
524 | } |
525 | |
526 | #define BUS_DEFINE_SET_CGROUP_LIMIT(function, mask, scale, minimum)static int bus_cgroup_set_function( Unit *u, const char *name , uint64_t *p, sd_bus_message *message, UnitWriteFlags flags, sd_bus_error *error) { uint64_t v; int r; do { if ((__builtin_expect (!!(!(p)),0))) log_assert_failed_realm(LOG_REALM_SYSTEMD, ("p" ), "../src/core/dbus-cgroup.c", 526, __PRETTY_FUNCTION__); } while (0); r = sd_bus_message_read(message, "t", &v); if (r < 0) return r; if (v < minimum) return sd_bus_error_setf(error , "org.freedesktop.DBus.Error.InvalidArgs", "Value specified in %s is out of range" , name); if (!(((flags) & (UNIT_RUNTIME|UNIT_PERSISTENT)) == 0)) { *p = v; unit_invalidate_cgroup(u, (mask)); if (v == ((uint64_t) -1)) unit_write_settingf(u, flags, name, "%s=infinity" , name); else unit_write_settingf(u, flags, name, "%s=%" "l" "u" , name, v); } return 1; } static int bus_cgroup_set_function_scale ( Unit *u, const char *name, uint64_t *p, sd_bus_message *message , UnitWriteFlags flags, sd_bus_error *error) { uint64_t v; uint32_t raw; int r; do { if ((__builtin_expect(!!(!(p)),0))) log_assert_failed_realm (LOG_REALM_SYSTEMD, ("p"), "../src/core/dbus-cgroup.c", 526, __PRETTY_FUNCTION__ ); } while (0); r = sd_bus_message_read(message, "u", &raw ); if (r < 0) return r; v = scale(raw, (4294967295U)); if ( v < minimum || v >= (18446744073709551615UL)) return sd_bus_error_setf (error, "org.freedesktop.DBus.Error.InvalidArgs", "Value specified in %s is out of range" , name); if (!(((flags) & (UNIT_RUNTIME|UNIT_PERSISTENT)) == 0)) { const char *e; *p = v; unit_invalidate_cgroup(u, (mask )); do { if ((__builtin_expect(!!(!(e = endswith(name, "Scale" ))),0))) log_assert_failed_realm(LOG_REALM_SYSTEMD, ("e = endswith(name, \"Scale\")" ), "../src/core/dbus-cgroup.c", 526, __PRETTY_FUNCTION__); } while (0); name = (__extension__ ({ const char *__old = (name); size_t __len = strnlen (__old, (e - name)); char *__new = (char *) __builtin_alloca (__len + 1); __new[__len] = '\0'; (char *) memcpy (__new, __old , __len); })); unit_write_settingf(u, flags, name, "%s=%" "u" "%%", name, (uint32_t) (({ const typeof(((uint64_t) raw * 100U )) __unique_prefix_X27 = (((uint64_t) raw * 100U)); const typeof (((uint64_t) (4294967295U))) __unique_prefix_Y28 = (((uint64_t ) (4294967295U))); (__unique_prefix_X27 / __unique_prefix_Y28 + !!(__unique_prefix_X27 % __unique_prefix_Y28)); }))); } return 1; } \ |
527 | static int bus_cgroup_set_##function( \ |
528 | Unit *u, \ |
529 | const char *name, \ |
530 | uint64_t *p, \ |
531 | sd_bus_message *message, \ |
532 | UnitWriteFlags flags, \ |
533 | sd_bus_error *error) { \ |
534 | \ |
535 | uint64_t v; \ |
536 | int r; \ |
537 | \ |
538 | assert(p)do { if ((__builtin_expect(!!(!(p)),0))) log_assert_failed_realm (LOG_REALM_SYSTEMD, ("p"), "../src/core/dbus-cgroup.c", 538, __PRETTY_FUNCTION__ ); } while (0); \ |
539 | \ |
540 | r = sd_bus_message_read(message, "t", &v); \ |
541 | if (r < 0) \ |
542 | return r; \ |
543 | \ |
544 | if (v < minimum) \ |
545 | return sd_bus_error_setf(error, SD_BUS_ERROR_INVALID_ARGS"org.freedesktop.DBus.Error.InvalidArgs", \ |
546 | "Value specified in %s is out of range", name); \ |
547 | \ |
548 | if (!UNIT_WRITE_FLAGS_NOOP(flags)(((flags) & (UNIT_RUNTIME|UNIT_PERSISTENT)) == 0)) { \ |
549 | *p = v; \ |
550 | unit_invalidate_cgroup(u, (mask)); \ |
551 | \ |
552 | if (v == CGROUP_LIMIT_MAX((uint64_t) -1)) \ |
553 | unit_write_settingf(u, flags, name, \ |
554 | "%s=infinity", name); \ |
555 | else \ |
556 | unit_write_settingf(u, flags, name, \ |
557 | "%s=%" PRIu64"l" "u", name, v); \ |
558 | } \ |
559 | \ |
560 | return 1; \ |
561 | } \ |
562 | static int bus_cgroup_set_##function##_scale( \ |
563 | Unit *u, \ |
564 | const char *name, \ |
565 | uint64_t *p, \ |
566 | sd_bus_message *message, \ |
567 | UnitWriteFlags flags, \ |
568 | sd_bus_error *error) { \ |
569 | \ |
570 | uint64_t v; \ |
571 | uint32_t raw; \ |
572 | int r; \ |
573 | \ |
574 | assert(p)do { if ((__builtin_expect(!!(!(p)),0))) log_assert_failed_realm (LOG_REALM_SYSTEMD, ("p"), "../src/core/dbus-cgroup.c", 574, __PRETTY_FUNCTION__ ); } while (0); \ |
575 | \ |
576 | r = sd_bus_message_read(message, "u", &raw); \ |
577 | if (r < 0) \ |
578 | return r; \ |
579 | \ |
580 | v = scale(raw, UINT32_MAX(4294967295U)); \ |
581 | if (v < minimum || v >= UINT64_MAX(18446744073709551615UL)) \ |
582 | return sd_bus_error_setf(error, SD_BUS_ERROR_INVALID_ARGS"org.freedesktop.DBus.Error.InvalidArgs", \ |
583 | "Value specified in %s is out of range", name); \ |
584 | \ |
585 | if (!UNIT_WRITE_FLAGS_NOOP(flags)(((flags) & (UNIT_RUNTIME|UNIT_PERSISTENT)) == 0)) { \ |
586 | const char *e; \ |
587 | \ |
588 | *p = v; \ |
589 | unit_invalidate_cgroup(u, (mask)); \ |
590 | \ |
591 | /* Chop off suffix */ \ |
592 | assert_se(e = endswith(name, "Scale"))do { if ((__builtin_expect(!!(!(e = endswith(name, "Scale"))) ,0))) log_assert_failed_realm(LOG_REALM_SYSTEMD, ("e = endswith(name, \"Scale\")" ), "../src/core/dbus-cgroup.c", 592, __PRETTY_FUNCTION__); } while (0); \ |
593 | name = strndupa(name, e - name)(__extension__ ({ const char *__old = (name); size_t __len = strnlen (__old, (e - name)); char *__new = (char *) __builtin_alloca (__len + 1); __new[__len] = '\0'; (char *) memcpy (__new, __old , __len); })); \ |
594 | \ |
595 | unit_write_settingf(u, flags, name, "%s=%" PRIu32"u" "%%", name, \ |
596 | (uint32_t) (DIV_ROUND_UP((uint64_t) raw * 100U, (uint64_t) UINT32_MAX)({ const typeof(((uint64_t) raw * 100U)) __unique_prefix_X29 = (((uint64_t) raw * 100U)); const typeof(((uint64_t) (4294967295U ))) __unique_prefix_Y30 = (((uint64_t) (4294967295U))); (__unique_prefix_X29 / __unique_prefix_Y30 + !!(__unique_prefix_X29 % __unique_prefix_Y30 )); }))); \ |
597 | } \ |
598 | \ |
599 | return 1; \ |
600 | } |
601 | |
602 | #pragma GCC diagnostic push |
603 | #pragma GCC diagnostic ignored "-Wtype-limits" |
604 | BUS_DEFINE_SET_CGROUP_WEIGHT(cpu_weight, CGROUP_MASK_CPU, CGROUP_WEIGHT_IS_OK, CGROUP_WEIGHT_INVALID)static int bus_cgroup_set_cpu_weight( Unit *u, const char *name , uint64_t *p, sd_bus_message *message, UnitWriteFlags flags, sd_bus_error *error) { uint64_t v; int r; do { if ((__builtin_expect (!!(!(p)),0))) log_assert_failed_realm(LOG_REALM_SYSTEMD, ("p" ), "../src/core/dbus-cgroup.c", 604, __PRETTY_FUNCTION__); } while (0); r = sd_bus_message_read(message, "t", &v); if (r < 0) return r; if (!CGROUP_WEIGHT_IS_OK(v)) return sd_bus_error_setf (error, "org.freedesktop.DBus.Error.InvalidArgs", "Value specified in %s is out of range" , name); if (!(((flags) & (UNIT_RUNTIME|UNIT_PERSISTENT)) == 0)) { *p = v; unit_invalidate_cgroup(u, (CGROUP_MASK_CPU) ); if (v == (((uint64_t) -1))) unit_write_settingf(u, flags, name , "%s=", name); else unit_write_settingf(u, flags, name, "%s=%" "l" "u", name, v); } return 1; }; |
605 | BUS_DEFINE_SET_CGROUP_WEIGHT(cpu_shares, CGROUP_MASK_CPU, CGROUP_CPU_SHARES_IS_OK, CGROUP_CPU_SHARES_INVALID)static int bus_cgroup_set_cpu_shares( Unit *u, const char *name , uint64_t *p, sd_bus_message *message, UnitWriteFlags flags, sd_bus_error *error) { uint64_t v; int r; do { if ((__builtin_expect (!!(!(p)),0))) log_assert_failed_realm(LOG_REALM_SYSTEMD, ("p" ), "../src/core/dbus-cgroup.c", 605, __PRETTY_FUNCTION__); } while (0); r = sd_bus_message_read(message, "t", &v); if (r < 0) return r; if (!CGROUP_CPU_SHARES_IS_OK(v)) return sd_bus_error_setf (error, "org.freedesktop.DBus.Error.InvalidArgs", "Value specified in %s is out of range" , name); if (!(((flags) & (UNIT_RUNTIME|UNIT_PERSISTENT)) == 0)) { *p = v; unit_invalidate_cgroup(u, (CGROUP_MASK_CPU) ); if (v == (((uint64_t) -1))) unit_write_settingf(u, flags, name , "%s=", name); else unit_write_settingf(u, flags, name, "%s=%" "l" "u", name, v); } return 1; }; |
606 | BUS_DEFINE_SET_CGROUP_WEIGHT(io_weight, CGROUP_MASK_IO, CGROUP_WEIGHT_IS_OK, CGROUP_WEIGHT_INVALID)static int bus_cgroup_set_io_weight( Unit *u, const char *name , uint64_t *p, sd_bus_message *message, UnitWriteFlags flags, sd_bus_error *error) { uint64_t v; int r; do { if ((__builtin_expect (!!(!(p)),0))) log_assert_failed_realm(LOG_REALM_SYSTEMD, ("p" ), "../src/core/dbus-cgroup.c", 606, __PRETTY_FUNCTION__); } while (0); r = sd_bus_message_read(message, "t", &v); if (r < 0) return r; if (!CGROUP_WEIGHT_IS_OK(v)) return sd_bus_error_setf (error, "org.freedesktop.DBus.Error.InvalidArgs", "Value specified in %s is out of range" , name); if (!(((flags) & (UNIT_RUNTIME|UNIT_PERSISTENT)) == 0)) { *p = v; unit_invalidate_cgroup(u, (CGROUP_MASK_IO)) ; if (v == (((uint64_t) -1))) unit_write_settingf(u, flags, name , "%s=", name); else unit_write_settingf(u, flags, name, "%s=%" "l" "u", name, v); } return 1; }; |
607 | BUS_DEFINE_SET_CGROUP_WEIGHT(blockio_weight, CGROUP_MASK_BLKIO, CGROUP_BLKIO_WEIGHT_IS_OK, CGROUP_BLKIO_WEIGHT_INVALID)static int bus_cgroup_set_blockio_weight( Unit *u, const char *name, uint64_t *p, sd_bus_message *message, UnitWriteFlags flags , sd_bus_error *error) { uint64_t v; int r; do { if ((__builtin_expect (!!(!(p)),0))) log_assert_failed_realm(LOG_REALM_SYSTEMD, ("p" ), "../src/core/dbus-cgroup.c", 607, __PRETTY_FUNCTION__); } while (0); r = sd_bus_message_read(message, "t", &v); if (r < 0) return r; if (!CGROUP_BLKIO_WEIGHT_IS_OK(v)) return sd_bus_error_setf (error, "org.freedesktop.DBus.Error.InvalidArgs", "Value specified in %s is out of range" , name); if (!(((flags) & (UNIT_RUNTIME|UNIT_PERSISTENT)) == 0)) { *p = v; unit_invalidate_cgroup(u, (CGROUP_MASK_BLKIO )); if (v == (((uint64_t) -1))) unit_write_settingf(u, flags, name, "%s=", name); else unit_write_settingf(u, flags, name, "%s=%" "l" "u", name, v); } return 1; }; |
608 | BUS_DEFINE_SET_CGROUP_LIMIT(memory, CGROUP_MASK_MEMORY, physical_memory_scale, 1)static int bus_cgroup_set_memory( Unit *u, const char *name, uint64_t *p, sd_bus_message *message, UnitWriteFlags flags, sd_bus_error *error) { uint64_t v; int r; do { if ((__builtin_expect(!!(! (p)),0))) log_assert_failed_realm(LOG_REALM_SYSTEMD, ("p"), "../src/core/dbus-cgroup.c" , 608, __PRETTY_FUNCTION__); } while (0); r = sd_bus_message_read (message, "t", &v); if (r < 0) return r; if (v < 1) return sd_bus_error_setf(error, "org.freedesktop.DBus.Error.InvalidArgs" , "Value specified in %s is out of range", name); if (!(((flags ) & (UNIT_RUNTIME|UNIT_PERSISTENT)) == 0)) { *p = v; unit_invalidate_cgroup (u, (CGROUP_MASK_MEMORY)); if (v == ((uint64_t) -1)) unit_write_settingf (u, flags, name, "%s=infinity", name); else unit_write_settingf (u, flags, name, "%s=%" "l" "u", name, v); } return 1; } static int bus_cgroup_set_memory_scale( Unit *u, const char *name, uint64_t *p, sd_bus_message *message, UnitWriteFlags flags, sd_bus_error *error) { uint64_t v; uint32_t raw; int r; do { if ((__builtin_expect (!!(!(p)),0))) log_assert_failed_realm(LOG_REALM_SYSTEMD, ("p" ), "../src/core/dbus-cgroup.c", 608, __PRETTY_FUNCTION__); } while (0); r = sd_bus_message_read(message, "u", &raw); if (r < 0) return r; v = physical_memory_scale(raw, (4294967295U)); if (v < 1 || v >= (18446744073709551615UL)) return sd_bus_error_setf (error, "org.freedesktop.DBus.Error.InvalidArgs", "Value specified in %s is out of range" , name); if (!(((flags) & (UNIT_RUNTIME|UNIT_PERSISTENT)) == 0)) { const char *e; *p = v; unit_invalidate_cgroup(u, (CGROUP_MASK_MEMORY )); do { if ((__builtin_expect(!!(!(e = endswith(name, "Scale" ))),0))) log_assert_failed_realm(LOG_REALM_SYSTEMD, ("e = endswith(name, \"Scale\")" ), "../src/core/dbus-cgroup.c", 608, __PRETTY_FUNCTION__); } while (0); name = (__extension__ ({ const char *__old = (name); size_t __len = strnlen (__old, (e - name)); char *__new = (char *) __builtin_alloca (__len + 1); __new[__len] = '\0'; (char *) memcpy (__new, __old , __len); })); unit_write_settingf(u, flags, name, "%s=%" "u" "%%", name, (uint32_t) (({ const typeof(((uint64_t) raw * 100U )) __unique_prefix_X31 = (((uint64_t) raw * 100U)); const typeof (((uint64_t) (4294967295U))) __unique_prefix_Y32 = (((uint64_t ) (4294967295U))); (__unique_prefix_X31 / __unique_prefix_Y32 + !!(__unique_prefix_X31 % __unique_prefix_Y32)); }))); } return 1; }; |
609 | BUS_DEFINE_SET_CGROUP_LIMIT(memory_protection, CGROUP_MASK_MEMORY, physical_memory_scale, 0)static int bus_cgroup_set_memory_protection( Unit *u, const char *name, uint64_t *p, sd_bus_message *message, UnitWriteFlags flags , sd_bus_error *error) { uint64_t v; int r; do { if ((__builtin_expect (!!(!(p)),0))) log_assert_failed_realm(LOG_REALM_SYSTEMD, ("p" ), "../src/core/dbus-cgroup.c", 609, __PRETTY_FUNCTION__); } while (0); r = sd_bus_message_read(message, "t", &v); if (r < 0) return r; if (v < 0) return sd_bus_error_setf(error, "org.freedesktop.DBus.Error.InvalidArgs" , "Value specified in %s is out of range", name); if (!(((flags ) & (UNIT_RUNTIME|UNIT_PERSISTENT)) == 0)) { *p = v; unit_invalidate_cgroup (u, (CGROUP_MASK_MEMORY)); if (v == ((uint64_t) -1)) unit_write_settingf (u, flags, name, "%s=infinity", name); else unit_write_settingf (u, flags, name, "%s=%" "l" "u", name, v); } return 1; } static int bus_cgroup_set_memory_protection_scale( Unit *u, const char *name, uint64_t *p, sd_bus_message *message, UnitWriteFlags flags , sd_bus_error *error) { uint64_t v; uint32_t raw; int r; do { if ((__builtin_expect(!!(!(p)),0))) log_assert_failed_realm( LOG_REALM_SYSTEMD, ("p"), "../src/core/dbus-cgroup.c", 609, __PRETTY_FUNCTION__ ); } while (0); r = sd_bus_message_read(message, "u", &raw ); if (r < 0) return r; v = physical_memory_scale(raw, (4294967295U )); if (v < 0 || v >= (18446744073709551615UL)) return sd_bus_error_setf (error, "org.freedesktop.DBus.Error.InvalidArgs", "Value specified in %s is out of range" , name); if (!(((flags) & (UNIT_RUNTIME|UNIT_PERSISTENT)) == 0)) { const char *e; *p = v; unit_invalidate_cgroup(u, (CGROUP_MASK_MEMORY )); do { if ((__builtin_expect(!!(!(e = endswith(name, "Scale" ))),0))) log_assert_failed_realm(LOG_REALM_SYSTEMD, ("e = endswith(name, \"Scale\")" ), "../src/core/dbus-cgroup.c", 609, __PRETTY_FUNCTION__); } while (0); name = (__extension__ ({ const char *__old = (name); size_t __len = strnlen (__old, (e - name)); char *__new = (char *) __builtin_alloca (__len + 1); __new[__len] = '\0'; (char *) memcpy (__new, __old , __len); })); unit_write_settingf(u, flags, name, "%s=%" "u" "%%", name, (uint32_t) (({ const typeof(((uint64_t) raw * 100U )) __unique_prefix_X33 = (((uint64_t) raw * 100U)); const typeof (((uint64_t) (4294967295U))) __unique_prefix_Y34 = (((uint64_t ) (4294967295U))); (__unique_prefix_X33 / __unique_prefix_Y34 + !!(__unique_prefix_X33 % __unique_prefix_Y34)); }))); } return 1; }; |
610 | BUS_DEFINE_SET_CGROUP_LIMIT(swap, CGROUP_MASK_MEMORY, physical_memory_scale, 0)static int bus_cgroup_set_swap( Unit *u, const char *name, uint64_t *p, sd_bus_message *message, UnitWriteFlags flags, sd_bus_error *error) { uint64_t v; int r; do { if ((__builtin_expect(!!(! (p)),0))) log_assert_failed_realm(LOG_REALM_SYSTEMD, ("p"), "../src/core/dbus-cgroup.c" , 610, __PRETTY_FUNCTION__); } while (0); r = sd_bus_message_read (message, "t", &v); if (r < 0) return r; if (v < 0) return sd_bus_error_setf(error, "org.freedesktop.DBus.Error.InvalidArgs" , "Value specified in %s is out of range", name); if (!(((flags ) & (UNIT_RUNTIME|UNIT_PERSISTENT)) == 0)) { *p = v; unit_invalidate_cgroup (u, (CGROUP_MASK_MEMORY)); if (v == ((uint64_t) -1)) unit_write_settingf (u, flags, name, "%s=infinity", name); else unit_write_settingf (u, flags, name, "%s=%" "l" "u", name, v); } return 1; } static int bus_cgroup_set_swap_scale( Unit *u, const char *name, uint64_t *p, sd_bus_message *message, UnitWriteFlags flags, sd_bus_error *error) { uint64_t v; uint32_t raw; int r; do { if ((__builtin_expect (!!(!(p)),0))) log_assert_failed_realm(LOG_REALM_SYSTEMD, ("p" ), "../src/core/dbus-cgroup.c", 610, __PRETTY_FUNCTION__); } while (0); r = sd_bus_message_read(message, "u", &raw); if (r < 0) return r; v = physical_memory_scale(raw, (4294967295U)); if (v < 0 || v >= (18446744073709551615UL)) return sd_bus_error_setf (error, "org.freedesktop.DBus.Error.InvalidArgs", "Value specified in %s is out of range" , name); if (!(((flags) & (UNIT_RUNTIME|UNIT_PERSISTENT)) == 0)) { const char *e; *p = v; unit_invalidate_cgroup(u, (CGROUP_MASK_MEMORY )); do { if ((__builtin_expect(!!(!(e = endswith(name, "Scale" ))),0))) log_assert_failed_realm(LOG_REALM_SYSTEMD, ("e = endswith(name, \"Scale\")" ), "../src/core/dbus-cgroup.c", 610, __PRETTY_FUNCTION__); } while (0); name = (__extension__ ({ const char *__old = (name); size_t __len = strnlen (__old, (e - name)); char *__new = (char *) __builtin_alloca (__len + 1); __new[__len] = '\0'; (char *) memcpy (__new, __old , __len); })); unit_write_settingf(u, flags, name, "%s=%" "u" "%%", name, (uint32_t) (({ const typeof(((uint64_t) raw * 100U )) __unique_prefix_X35 = (((uint64_t) raw * 100U)); const typeof (((uint64_t) (4294967295U))) __unique_prefix_Y36 = (((uint64_t ) (4294967295U))); (__unique_prefix_X35 / __unique_prefix_Y36 + !!(__unique_prefix_X35 % __unique_prefix_Y36)); }))); } return 1; }; |
611 | BUS_DEFINE_SET_CGROUP_LIMIT(tasks_max, CGROUP_MASK_PIDS, system_tasks_max_scale, 1)static int bus_cgroup_set_tasks_max( Unit *u, const char *name , uint64_t *p, sd_bus_message *message, UnitWriteFlags flags, sd_bus_error *error) { uint64_t v; int r; do { if ((__builtin_expect (!!(!(p)),0))) log_assert_failed_realm(LOG_REALM_SYSTEMD, ("p" ), "../src/core/dbus-cgroup.c", 611, __PRETTY_FUNCTION__); } while (0); r = sd_bus_message_read(message, "t", &v); if (r < 0) return r; if (v < 1) return sd_bus_error_setf(error, "org.freedesktop.DBus.Error.InvalidArgs" , "Value specified in %s is out of range", name); if (!(((flags ) & (UNIT_RUNTIME|UNIT_PERSISTENT)) == 0)) { *p = v; unit_invalidate_cgroup (u, (CGROUP_MASK_PIDS)); if (v == ((uint64_t) -1)) unit_write_settingf (u, flags, name, "%s=infinity", name); else unit_write_settingf (u, flags, name, "%s=%" "l" "u", name, v); } return 1; } static int bus_cgroup_set_tasks_max_scale( Unit *u, const char *name , uint64_t *p, sd_bus_message *message, UnitWriteFlags flags, sd_bus_error *error) { uint64_t v; uint32_t raw; int r; do { if ((__builtin_expect(!!(!(p)),0))) log_assert_failed_realm( LOG_REALM_SYSTEMD, ("p"), "../src/core/dbus-cgroup.c", 611, __PRETTY_FUNCTION__ ); } while (0); r = sd_bus_message_read(message, "u", &raw ); if (r < 0) return r; v = system_tasks_max_scale(raw, (4294967295U )); if (v < 1 || v >= (18446744073709551615UL)) return sd_bus_error_setf (error, "org.freedesktop.DBus.Error.InvalidArgs", "Value specified in %s is out of range" , name); if (!(((flags) & (UNIT_RUNTIME|UNIT_PERSISTENT)) == 0)) { const char *e; *p = v; unit_invalidate_cgroup(u, (CGROUP_MASK_PIDS )); do { if ((__builtin_expect(!!(!(e = endswith(name, "Scale" ))),0))) log_assert_failed_realm(LOG_REALM_SYSTEMD, ("e = endswith(name, \"Scale\")" ), "../src/core/dbus-cgroup.c", 611, __PRETTY_FUNCTION__); } while (0); name = (__extension__ ({ const char *__old = (name); size_t __len = strnlen (__old, (e - name)); char *__new = (char *) __builtin_alloca (__len + 1); __new[__len] = '\0'; (char *) memcpy (__new, __old , __len); })); unit_write_settingf(u, flags, name, "%s=%" "u" "%%", name, (uint32_t) (({ const typeof(((uint64_t) raw * 100U )) __unique_prefix_X37 = (((uint64_t) raw * 100U)); const typeof (((uint64_t) (4294967295U))) __unique_prefix_Y38 = (((uint64_t ) (4294967295U))); (__unique_prefix_X37 / __unique_prefix_Y38 + !!(__unique_prefix_X37 % __unique_prefix_Y38)); }))); } return 1; }; |
612 | #pragma GCC diagnostic pop |
613 | |
614 | int bus_cgroup_set_property( |
615 | Unit *u, |
616 | CGroupContext *c, |
617 | const char *name, |
618 | sd_bus_message *message, |
619 | UnitWriteFlags flags, |
620 | sd_bus_error *error) { |
621 | |
622 | CGroupIOLimitType iol_type; |
623 | int r; |
624 | |
625 | assert(u)do { if ((__builtin_expect(!!(!(u)),0))) log_assert_failed_realm (LOG_REALM_SYSTEMD, ("u"), "../src/core/dbus-cgroup.c", 625, __PRETTY_FUNCTION__ ); } while (0); |
626 | assert(c)do { if ((__builtin_expect(!!(!(c)),0))) log_assert_failed_realm (LOG_REALM_SYSTEMD, ("c"), "../src/core/dbus-cgroup.c", 626, __PRETTY_FUNCTION__ ); } while (0); |
627 | assert(name)do { if ((__builtin_expect(!!(!(name)),0))) log_assert_failed_realm (LOG_REALM_SYSTEMD, ("name"), "../src/core/dbus-cgroup.c", 627 , __PRETTY_FUNCTION__); } while (0); |
628 | assert(message)do { if ((__builtin_expect(!!(!(message)),0))) log_assert_failed_realm (LOG_REALM_SYSTEMD, ("message"), "../src/core/dbus-cgroup.c", 628, __PRETTY_FUNCTION__); } while (0); |
629 | |
630 | flags |= UNIT_PRIVATE; |
631 | |
632 | if (streq(name, "CPUAccounting")(strcmp((name),("CPUAccounting")) == 0)) |
633 | return bus_cgroup_set_boolean(u, name, &c->cpu_accounting, CGROUP_MASK_CPUACCT|CGROUP_MASK_CPU, message, flags, error); |
634 | |
635 | if (streq(name, "CPUWeight")(strcmp((name),("CPUWeight")) == 0)) |
636 | return bus_cgroup_set_cpu_weight(u, name, &c->cpu_weight, message, flags, error); |
637 | |
638 | if (streq(name, "StartupCPUWeight")(strcmp((name),("StartupCPUWeight")) == 0)) |
639 | return bus_cgroup_set_cpu_weight(u, name, &c->startup_cpu_weight, message, flags, error); |
640 | |
641 | if (streq(name, "CPUShares")(strcmp((name),("CPUShares")) == 0)) |
642 | return bus_cgroup_set_cpu_shares(u, name, &c->cpu_shares, message, flags, error); |
643 | |
644 | if (streq(name, "StartupCPUShares")(strcmp((name),("StartupCPUShares")) == 0)) |
645 | return bus_cgroup_set_cpu_shares(u, name, &c->startup_cpu_shares, message, flags, error); |
646 | |
647 | if (streq(name, "IOAccounting")(strcmp((name),("IOAccounting")) == 0)) |
648 | return bus_cgroup_set_boolean(u, name, &c->io_accounting, CGROUP_MASK_IO, message, flags, error); |
649 | |
650 | if (streq(name, "IOWeight")(strcmp((name),("IOWeight")) == 0)) |
651 | return bus_cgroup_set_io_weight(u, name, &c->io_weight, message, flags, error); |
652 | |
653 | if (streq(name, "StartupIOWeight")(strcmp((name),("StartupIOWeight")) == 0)) |
654 | return bus_cgroup_set_io_weight(u, name, &c->startup_io_weight, message, flags, error); |
655 | |
656 | if (streq(name, "BlockIOAccounting")(strcmp((name),("BlockIOAccounting")) == 0)) |
657 | return bus_cgroup_set_boolean(u, name, &c->blockio_accounting, CGROUP_MASK_BLKIO, message, flags, error); |
658 | |
659 | if (streq(name, "BlockIOWeight")(strcmp((name),("BlockIOWeight")) == 0)) |
660 | return bus_cgroup_set_blockio_weight(u, name, &c->blockio_weight, message, flags, error); |
661 | |
662 | if (streq(name, "StartupBlockIOWeight")(strcmp((name),("StartupBlockIOWeight")) == 0)) |
663 | return bus_cgroup_set_blockio_weight(u, name, &c->startup_blockio_weight, message, flags, error); |
664 | |
665 | if (streq(name, "MemoryAccounting")(strcmp((name),("MemoryAccounting")) == 0)) |
666 | return bus_cgroup_set_boolean(u, name, &c->memory_accounting, CGROUP_MASK_MEMORY, message, flags, error); |
667 | |
668 | if (streq(name, "MemoryMin")(strcmp((name),("MemoryMin")) == 0)) { |
669 | r = bus_cgroup_set_memory_protection(u, name, &c->memory_min, message, flags, error); |
670 | if (r > 0) |
671 | c->memory_min_set = true1; |
672 | return r; |
673 | } |
674 | |
675 | if (streq(name, "MemoryLow")(strcmp((name),("MemoryLow")) == 0)) { |
676 | r = bus_cgroup_set_memory_protection(u, name, &c->memory_low, message, flags, error); |
677 | if (r > 0) |
678 | c->memory_low_set = true1; |
679 | return r; |
680 | } |
681 | |
682 | if (streq(name, "DefaultMemoryMin")(strcmp((name),("DefaultMemoryMin")) == 0)) { |
683 | r = bus_cgroup_set_memory_protection(u, name, &c->default_memory_min, message, flags, error); |
684 | if (r > 0) |
685 | c->default_memory_min_set = true1; |
686 | return r; |
687 | } |
688 | |
689 | if (streq(name, "DefaultMemoryLow")(strcmp((name),("DefaultMemoryLow")) == 0)) { |
690 | r = bus_cgroup_set_memory_protection(u, name, &c->default_memory_low, message, flags, error); |
691 | if (r > 0) |
692 | c->default_memory_low_set = true1; |
693 | return r; |
694 | } |
695 | |
696 | if (streq(name, "MemoryHigh")(strcmp((name),("MemoryHigh")) == 0)) |
697 | return bus_cgroup_set_memory(u, name, &c->memory_high, message, flags, error); |
698 | |
699 | if (streq(name, "MemorySwapMax")(strcmp((name),("MemorySwapMax")) == 0)) |
700 | return bus_cgroup_set_swap(u, name, &c->memory_swap_max, message, flags, error); |
701 | |
702 | if (streq(name, "MemoryMax")(strcmp((name),("MemoryMax")) == 0)) |
703 | return bus_cgroup_set_memory(u, name, &c->memory_max, message, flags, error); |
704 | |
705 | if (streq(name, "MemoryLimit")(strcmp((name),("MemoryLimit")) == 0)) |
706 | return bus_cgroup_set_memory(u, name, &c->memory_limit, message, flags, error); |
707 | |
708 | if (streq(name, "MemoryMinScale")(strcmp((name),("MemoryMinScale")) == 0)) { |
709 | r = bus_cgroup_set_memory_protection_scale(u, name, &c->memory_min, message, flags, error); |
710 | if (r > 0) |
711 | c->memory_min_set = true1; |
712 | return r; |
713 | } |
714 | |
715 | if (streq(name, "MemoryLowScale")(strcmp((name),("MemoryLowScale")) == 0)) { |
716 | r = bus_cgroup_set_memory_protection_scale(u, name, &c->memory_low, message, flags, error); |
717 | if (r > 0) |
718 | c->memory_low_set = true1; |
719 | return r; |
720 | } |
721 | |
722 | if (streq(name, "DefaultMemoryMinScale")(strcmp((name),("DefaultMemoryMinScale")) == 0)) { |
723 | r = bus_cgroup_set_memory_protection_scale(u, name, &c->default_memory_min, message, flags, error); |
724 | if (r > 0) |
725 | c->default_memory_min_set = true1; |
726 | return r; |
727 | } |
728 | |
729 | if (streq(name, "DefaultMemoryLowScale")(strcmp((name),("DefaultMemoryLowScale")) == 0)) { |
730 | r = bus_cgroup_set_memory_protection_scale(u, name, &c->default_memory_low, message, flags, error); |
731 | if (r > 0) |
732 | c->default_memory_low_set = true1; |
733 | return r; |
734 | } |
735 | |
736 | if (streq(name, "MemoryHighScale")(strcmp((name),("MemoryHighScale")) == 0)) |
737 | return bus_cgroup_set_memory_scale(u, name, &c->memory_high, message, flags, error); |
738 | |
739 | if (streq(name, "MemorySwapMaxScale")(strcmp((name),("MemorySwapMaxScale")) == 0)) |
740 | return bus_cgroup_set_swap_scale(u, name, &c->memory_swap_max, message, flags, error); |
741 | |
742 | if (streq(name, "MemoryMaxScale")(strcmp((name),("MemoryMaxScale")) == 0)) |
743 | return bus_cgroup_set_memory_scale(u, name, &c->memory_max, message, flags, error); |
744 | |
745 | if (streq(name, "MemoryLimitScale")(strcmp((name),("MemoryLimitScale")) == 0)) |
746 | return bus_cgroup_set_memory_scale(u, name, &c->memory_limit, message, flags, error); |
747 | |
748 | if (streq(name, "TasksAccounting")(strcmp((name),("TasksAccounting")) == 0)) |
749 | return bus_cgroup_set_boolean(u, name, &c->tasks_accounting, CGROUP_MASK_PIDS, message, flags, error); |
750 | |
751 | if (streq(name, "TasksMax")(strcmp((name),("TasksMax")) == 0)) |
752 | return bus_cgroup_set_tasks_max(u, name, &c->tasks_max, message, flags, error); |
753 | |
754 | if (streq(name, "TasksMaxScale")(strcmp((name),("TasksMaxScale")) == 0)) |
755 | return bus_cgroup_set_tasks_max_scale(u, name, &c->tasks_max, message, flags, error); |
756 | |
757 | if (streq(name, "CPUQuotaPerSecUSec")(strcmp((name),("CPUQuotaPerSecUSec")) == 0)) { |
758 | uint64_t u64; |
759 | |
760 | r = sd_bus_message_read(message, "t", &u64); |
761 | if (r < 0) |
762 | return r; |
763 | |
764 | if (u64 <= 0) |
765 | return sd_bus_error_setf(error, SD_BUS_ERROR_INVALID_ARGS"org.freedesktop.DBus.Error.InvalidArgs", "CPUQuotaPerSecUSec= value out of range"); |
766 | |
767 | if (!UNIT_WRITE_FLAGS_NOOP(flags)(((flags) & (UNIT_RUNTIME|UNIT_PERSISTENT)) == 0)) { |
768 | c->cpu_quota_per_sec_usec = u64; |
769 | u->warned_clamping_cpu_quota_period = false0; |
770 | unit_invalidate_cgroup(u, CGROUP_MASK_CPU); |
771 | |
772 | if (c->cpu_quota_per_sec_usec == USEC_INFINITY((usec_t) -1)) |
773 | unit_write_setting(u, flags, "CPUQuota", "CPUQuota="); |
774 | else |
775 | /* config_parse_cpu_quota() requires an integer, so truncating division is used on |
776 | * purpose here. */ |
777 | unit_write_settingf(u, flags, "CPUQuota", |
778 | "CPUQuota=%0.f%%", |
779 | (double) (c->cpu_quota_per_sec_usec / 10000)); |
780 | } |
781 | |
782 | return 1; |
783 | |
784 | } else if (streq(name, "CPUQuotaPeriodUSec")(strcmp((name),("CPUQuotaPeriodUSec")) == 0)) { |
785 | uint64_t u64; |
786 | |
787 | r = sd_bus_message_read(message, "t", &u64); |
788 | if (r < 0) |
789 | return r; |
790 | |
791 | if (!UNIT_WRITE_FLAGS_NOOP(flags)(((flags) & (UNIT_RUNTIME|UNIT_PERSISTENT)) == 0)) { |
792 | c->cpu_quota_period_usec = u64; |
793 | u->warned_clamping_cpu_quota_period = false0; |
794 | unit_invalidate_cgroup(u, CGROUP_MASK_CPU); |
795 | if (c->cpu_quota_period_usec == USEC_INFINITY((usec_t) -1)) |
796 | unit_write_setting(u, flags, "CPUQuotaPeriodSec", "CPUQuotaPeriodSec="); |
797 | else { |
798 | char v[FORMAT_TIMESPAN_MAX64]; |
799 | unit_write_settingf(u, flags, "CPUQuotaPeriodSec", |
800 | "CPUQuotaPeriodSec=%s", |
801 | format_timespan(v, sizeof(v), c->cpu_quota_period_usec, 1)); |
802 | } |
803 | } |
804 | |
805 | return 1; |
806 | |
807 | } else if (STR_IN_SET(name, "AllowedCPUs", "AllowedMemoryNodes")(!!strv_find((((char**) ((const char*[]) { "AllowedCPUs", "AllowedMemoryNodes" , ((void*)0) }))), (name)))) { |
808 | const void *a; |
809 | size_t n; |
810 | _cleanup_(cpu_set_reset)__attribute__((cleanup(cpu_set_reset))) CPUSet new_set = {}; |
811 | |
812 | r = sd_bus_message_read_array(message, 'y', &a, &n); |
813 | if (r < 0) |
814 | return r; |
815 | |
816 | r = cpu_set_from_dbus(a, n, &new_set); |
817 | if (r < 0) |
818 | return r; |
819 | |
820 | if (!UNIT_WRITE_FLAGS_NOOP(flags)(((flags) & (UNIT_RUNTIME|UNIT_PERSISTENT)) == 0)) { |
821 | _cleanup_free___attribute__((cleanup(freep))) char *setstr = NULL((void*)0); |
822 | _cleanup_free___attribute__((cleanup(freep))) char *data = NULL((void*)0); |
823 | CPUSet *set; |
824 | |
825 | setstr = cpu_set_to_range_string(&new_set); |
826 | |
827 | if (streq(name, "AllowedCPUs")(strcmp((name),("AllowedCPUs")) == 0)) |
828 | set = &c->cpuset_cpus; |
829 | else |
830 | set = &c->cpuset_mems; |
831 | |
832 | if (asprintf(&data, "%s=%s", name, setstr) < 0) |
833 | return -ENOMEM12; |
834 | |
835 | cpu_set_reset(set); |
836 | cpu_set_add_all(set, &new_set); |
837 | unit_invalidate_cgroup(u, CGROUP_MASK_CPUSET); |
838 | unit_write_setting(u, flags, name, data); |
839 | } |
840 | |
841 | return 1; |
842 | |
843 | } else if ((iol_type = cgroup_io_limit_type_from_string(name)) >= 0) { |
844 | const char *path; |
845 | unsigned n = 0; |
846 | uint64_t u64; |
847 | |
848 | r = sd_bus_message_enter_container(message, 'a', "(st)"); |
849 | if (r < 0) |
850 | return r; |
851 | |
852 | while ((r = sd_bus_message_read(message, "(st)", &path, &u64)) > 0) { |
853 | |
854 | if (!path_is_normalized(path)) |
855 | return sd_bus_error_setf(error, SD_BUS_ERROR_INVALID_ARGS"org.freedesktop.DBus.Error.InvalidArgs", "Path '%s' specified in %s= is not normalized.", name, path); |
856 | |
857 | if (!UNIT_WRITE_FLAGS_NOOP(flags)(((flags) & (UNIT_RUNTIME|UNIT_PERSISTENT)) == 0)) { |
858 | CGroupIODeviceLimit *a = NULL((void*)0), *b; |
859 | |
860 | LIST_FOREACH(device_limits, b, c->io_device_limits)for ((b) = (c->io_device_limits); (b); (b) = (b)->device_limits_next ) { |
861 | if (path_equal(path, b->path)) { |
862 | a = b; |
863 | break; |
864 | } |
865 | } |
866 | |
867 | if (!a) { |
868 | CGroupIOLimitType type; |
869 | |
870 | a = new0(CGroupIODeviceLimit, 1)((CGroupIODeviceLimit*) calloc((1), sizeof(CGroupIODeviceLimit ))); |
871 | if (!a) |
872 | return -ENOMEM12; |
873 | |
874 | a->path = strdup(path); |
875 | if (!a->path) { |
876 | free(a); |
877 | return -ENOMEM12; |
878 | } |
879 | |
880 | for (type = 0; type < _CGROUP_IO_LIMIT_TYPE_MAX; type++) |
881 | a->limits[type] = cgroup_io_limit_defaults[type]; |
882 | |
883 | LIST_PREPEND(device_limits, c->io_device_limits, a)do { typeof(*(c->io_device_limits)) **_head = &(c-> io_device_limits), *_item = (a); do { if ((__builtin_expect(! !(!(_item)),0))) log_assert_failed_realm(LOG_REALM_SYSTEMD, ( "_item"), "../src/core/dbus-cgroup.c", 883, __PRETTY_FUNCTION__ ); } while (0); if ((_item->device_limits_next = *_head)) _item ->device_limits_next->device_limits_prev = _item; _item ->device_limits_prev = ((void*)0); *_head = _item; } while (0); |
884 | } |
885 | |
886 | a->limits[iol_type] = u64; |
887 | } |
888 | |
889 | n++; |
890 | } |
891 | if (r < 0) |
892 | return r; |
893 | |
894 | r = sd_bus_message_exit_container(message); |
895 | if (r < 0) |
896 | return r; |
897 | |
898 | if (!UNIT_WRITE_FLAGS_NOOP(flags)(((flags) & (UNIT_RUNTIME|UNIT_PERSISTENT)) == 0)) { |
899 | CGroupIODeviceLimit *a; |
900 | _cleanup_free___attribute__((cleanup(freep))) char *buf = NULL((void*)0); |
901 | _cleanup_fclose___attribute__((cleanup(fclosep))) FILE *f = NULL((void*)0); |
902 | size_t size = 0; |
903 | |
904 | if (n == 0) { |
905 | LIST_FOREACH(device_limits, a, c->io_device_limits)for ((a) = (c->io_device_limits); (a); (a) = (a)->device_limits_next ) |
906 | a->limits[iol_type] = cgroup_io_limit_defaults[iol_type]; |
907 | } |
908 | |
909 | unit_invalidate_cgroup(u, CGROUP_MASK_IO); |
910 | |
911 | f = open_memstream(&buf, &size); |
912 | if (!f) |
913 | return -ENOMEM12; |
914 | |
915 | (void) __fsetlocking(f, FSETLOCKING_BYCALLERFSETLOCKING_BYCALLER); |
916 | |
917 | fprintf(f, "%s=\n", name); |
918 | LIST_FOREACH(device_limits, a, c->io_device_limits)for ((a) = (c->io_device_limits); (a); (a) = (a)->device_limits_next ) |
919 | if (a->limits[iol_type] != cgroup_io_limit_defaults[iol_type]) |
920 | fprintf(f, "%s=%s %" PRIu64"l" "u" "\n", name, a->path, a->limits[iol_type]); |
921 | |
922 | r = fflush_and_check(f); |
923 | if (r < 0) |
924 | return r; |
925 | unit_write_setting(u, flags, name, buf); |
926 | } |
927 | |
928 | return 1; |
929 | |
930 | } else if (streq(name, "IODeviceWeight")(strcmp((name),("IODeviceWeight")) == 0)) { |
931 | const char *path; |
932 | uint64_t weight; |
933 | unsigned n = 0; |
934 | |
935 | r = sd_bus_message_enter_container(message, 'a', "(st)"); |
936 | if (r < 0) |
937 | return r; |
938 | |
939 | while ((r = sd_bus_message_read(message, "(st)", &path, &weight)) > 0) { |
940 | |
941 | if (!path_is_normalized(path)) |
942 | return sd_bus_error_setf(error, SD_BUS_ERROR_INVALID_ARGS"org.freedesktop.DBus.Error.InvalidArgs", "Path '%s' specified in %s= is not normalized.", name, path); |
943 | |
944 | if (!CGROUP_WEIGHT_IS_OK(weight) || weight == CGROUP_WEIGHT_INVALID((uint64_t) -1)) |
945 | return sd_bus_error_setf(error, SD_BUS_ERROR_INVALID_ARGS"org.freedesktop.DBus.Error.InvalidArgs", "IODeviceWeight= value out of range"); |
946 | |
947 | if (!UNIT_WRITE_FLAGS_NOOP(flags)(((flags) & (UNIT_RUNTIME|UNIT_PERSISTENT)) == 0)) { |
948 | CGroupIODeviceWeight *a = NULL((void*)0), *b; |
949 | |
950 | LIST_FOREACH(device_weights, b, c->io_device_weights)for ((b) = (c->io_device_weights); (b); (b) = (b)->device_weights_next ) { |
951 | if (path_equal(b->path, path)) { |
952 | a = b; |
953 | break; |
954 | } |
955 | } |
956 | |
957 | if (!a) { |
958 | a = new0(CGroupIODeviceWeight, 1)((CGroupIODeviceWeight*) calloc((1), sizeof(CGroupIODeviceWeight ))); |
959 | if (!a) |
960 | return -ENOMEM12; |
961 | |
962 | a->path = strdup(path); |
963 | if (!a->path) { |
964 | free(a); |
965 | return -ENOMEM12; |
966 | } |
967 | LIST_PREPEND(device_weights, c->io_device_weights, a)do { typeof(*(c->io_device_weights)) **_head = &(c-> io_device_weights), *_item = (a); do { if ((__builtin_expect( !!(!(_item)),0))) log_assert_failed_realm(LOG_REALM_SYSTEMD, ( "_item"), "../src/core/dbus-cgroup.c", 967, __PRETTY_FUNCTION__ ); } while (0); if ((_item->device_weights_next = *_head)) _item->device_weights_next->device_weights_prev = _item ; _item->device_weights_prev = ((void*)0); *_head = _item; } while (0); |
968 | } |
969 | |
970 | a->weight = weight; |
971 | } |
972 | |
973 | n++; |
974 | } |
975 | |
976 | r = sd_bus_message_exit_container(message); |
977 | if (r < 0) |
978 | return r; |
979 | |
980 | if (!UNIT_WRITE_FLAGS_NOOP(flags)(((flags) & (UNIT_RUNTIME|UNIT_PERSISTENT)) == 0)) { |
981 | _cleanup_free___attribute__((cleanup(freep))) char *buf = NULL((void*)0); |
982 | _cleanup_fclose___attribute__((cleanup(fclosep))) FILE *f = NULL((void*)0); |
983 | CGroupIODeviceWeight *a; |
984 | size_t size = 0; |
985 | |
986 | if (n == 0) { |
987 | while (c->io_device_weights) |
988 | cgroup_context_free_io_device_weight(c, c->io_device_weights); |
989 | } |
990 | |
991 | unit_invalidate_cgroup(u, CGROUP_MASK_IO); |
992 | |
993 | f = open_memstream(&buf, &size); |
994 | if (!f) |
995 | return -ENOMEM12; |
996 | |
997 | (void) __fsetlocking(f, FSETLOCKING_BYCALLERFSETLOCKING_BYCALLER); |
998 | |
999 | fputs("IODeviceWeight=\n", f); |
1000 | LIST_FOREACH(device_weights, a, c->io_device_weights)for ((a) = (c->io_device_weights); (a); (a) = (a)->device_weights_next ) |
1001 | fprintf(f, "IODeviceWeight=%s %" PRIu64"l" "u" "\n", a->path, a->weight); |
1002 | |
1003 | r = fflush_and_check(f); |
1004 | if (r < 0) |
1005 | return r; |
1006 | unit_write_setting(u, flags, name, buf); |
1007 | } |
1008 | |
1009 | return 1; |
1010 | |
1011 | } else if (streq(name, "IODeviceLatencyTargetUSec")(strcmp((name),("IODeviceLatencyTargetUSec")) == 0)) { |
1012 | const char *path; |
1013 | uint64_t target; |
1014 | unsigned n = 0; |
1015 | |
1016 | r = sd_bus_message_enter_container(message, 'a', "(st)"); |
1017 | if (r < 0) |
1018 | return r; |
1019 | |
1020 | while ((r = sd_bus_message_read(message, "(st)", &path, &target)) > 0) { |
Although the value stored to 'r' is used in the enclosing expression, the value is never actually read from 'r' | |
1021 | |
1022 | if (!path_is_normalized(path)) |
1023 | return sd_bus_error_setf(error, SD_BUS_ERROR_INVALID_ARGS"org.freedesktop.DBus.Error.InvalidArgs", "Path '%s' specified in %s= is not normalized.", name, path); |
1024 | |
1025 | if (!UNIT_WRITE_FLAGS_NOOP(flags)(((flags) & (UNIT_RUNTIME|UNIT_PERSISTENT)) == 0)) { |
1026 | CGroupIODeviceLatency *a = NULL((void*)0), *b; |
1027 | |
1028 | LIST_FOREACH(device_latencies, b, c->io_device_latencies)for ((b) = (c->io_device_latencies); (b); (b) = (b)->device_latencies_next ) { |
1029 | if (path_equal(b->path, path)) { |
1030 | a = b; |
1031 | break; |
1032 | } |
1033 | } |
1034 | |
1035 | if (!a) { |
1036 | a = new0(CGroupIODeviceLatency, 1)((CGroupIODeviceLatency*) calloc((1), sizeof(CGroupIODeviceLatency ))); |
1037 | if (!a) |
1038 | return -ENOMEM12; |
1039 | |
1040 | a->path = strdup(path); |
1041 | if (!a->path) { |
1042 | free(a); |
1043 | return -ENOMEM12; |
1044 | } |
1045 | LIST_PREPEND(device_latencies, c->io_device_latencies, a)do { typeof(*(c->io_device_latencies)) **_head = &(c-> io_device_latencies), *_item = (a); do { if ((__builtin_expect (!!(!(_item)),0))) log_assert_failed_realm(LOG_REALM_SYSTEMD, ("_item"), "../src/core/dbus-cgroup.c", 1045, __PRETTY_FUNCTION__ ); } while (0); if ((_item->device_latencies_next = *_head )) _item->device_latencies_next->device_latencies_prev = _item; _item->device_latencies_prev = ((void*)0); *_head = _item; } while (0); |
1046 | } |
1047 | |
1048 | a->target_usec = target; |
1049 | } |
1050 | |
1051 | n++; |
1052 | } |
1053 | |
1054 | r = sd_bus_message_exit_container(message); |
1055 | if (r < 0) |
1056 | return r; |
1057 | |
1058 | if (!UNIT_WRITE_FLAGS_NOOP(flags)(((flags) & (UNIT_RUNTIME|UNIT_PERSISTENT)) == 0)) { |
1059 | _cleanup_free___attribute__((cleanup(freep))) char *buf = NULL((void*)0); |
1060 | _cleanup_fclose___attribute__((cleanup(fclosep))) FILE *f = NULL((void*)0); |
1061 | char ts[FORMAT_TIMESPAN_MAX64]; |
1062 | CGroupIODeviceLatency *a; |
1063 | size_t size = 0; |
1064 | |
1065 | if (n == 0) { |
1066 | while (c->io_device_latencies) |
1067 | cgroup_context_free_io_device_latency(c, c->io_device_latencies); |
1068 | } |
1069 | |
1070 | unit_invalidate_cgroup(u, CGROUP_MASK_IO); |
1071 | |
1072 | f = open_memstream(&buf, &size); |
1073 | if (!f) |
1074 | return -ENOMEM12; |
1075 | |
1076 | (void) __fsetlocking(f, FSETLOCKING_BYCALLERFSETLOCKING_BYCALLER); |
1077 | |
1078 | fputs("IODeviceLatencyTargetSec=\n", f); |
1079 | LIST_FOREACH(device_latencies, a, c->io_device_latencies)for ((a) = (c->io_device_latencies); (a); (a) = (a)->device_latencies_next ) |
1080 | fprintf(f, "IODeviceLatencyTargetSec=%s %s\n", |
1081 | a->path, format_timespan(ts, sizeof(ts), a->target_usec, 1)); |
1082 | |
1083 | r = fflush_and_check(f); |
1084 | if (r < 0) |
1085 | return r; |
1086 | unit_write_setting(u, flags, name, buf); |
1087 | } |
1088 | |
1089 | return 1; |
1090 | |
1091 | } else if (STR_IN_SET(name, "BlockIOReadBandwidth", "BlockIOWriteBandwidth")(!!strv_find((((char**) ((const char*[]) { "BlockIOReadBandwidth" , "BlockIOWriteBandwidth", ((void*)0) }))), (name)))) { |
1092 | const char *path; |
1093 | bool_Bool read = true1; |
1094 | unsigned n = 0; |
1095 | uint64_t u64; |
1096 | |
1097 | if (streq(name, "BlockIOWriteBandwidth")(strcmp((name),("BlockIOWriteBandwidth")) == 0)) |
1098 | read = false0; |
1099 | |
1100 | r = sd_bus_message_enter_container(message, 'a', "(st)"); |
1101 | if (r < 0) |
1102 | return r; |
1103 | |
1104 | while ((r = sd_bus_message_read(message, "(st)", &path, &u64)) > 0) { |
1105 | |
1106 | if (!path_is_normalized(path)) |
1107 | return sd_bus_error_setf(error, SD_BUS_ERROR_INVALID_ARGS"org.freedesktop.DBus.Error.InvalidArgs", "Path '%s' specified in %s= is not normalized.", name, path); |
1108 | |
1109 | if (!UNIT_WRITE_FLAGS_NOOP(flags)(((flags) & (UNIT_RUNTIME|UNIT_PERSISTENT)) == 0)) { |
1110 | CGroupBlockIODeviceBandwidth *a = NULL((void*)0), *b; |
1111 | |
1112 | LIST_FOREACH(device_bandwidths, b, c->blockio_device_bandwidths)for ((b) = (c->blockio_device_bandwidths); (b); (b) = (b)-> device_bandwidths_next) { |
1113 | if (path_equal(path, b->path)) { |
1114 | a = b; |
1115 | break; |
1116 | } |
1117 | } |
1118 | |
1119 | if (!a) { |
1120 | a = new0(CGroupBlockIODeviceBandwidth, 1)((CGroupBlockIODeviceBandwidth*) calloc((1), sizeof(CGroupBlockIODeviceBandwidth ))); |
1121 | if (!a) |
1122 | return -ENOMEM12; |
1123 | |
1124 | a->rbps = CGROUP_LIMIT_MAX((uint64_t) -1); |
1125 | a->wbps = CGROUP_LIMIT_MAX((uint64_t) -1); |
1126 | a->path = strdup(path); |
1127 | if (!a->path) { |
1128 | free(a); |
1129 | return -ENOMEM12; |
1130 | } |
1131 | |
1132 | LIST_PREPEND(device_bandwidths, c->blockio_device_bandwidths, a)do { typeof(*(c->blockio_device_bandwidths)) **_head = & (c->blockio_device_bandwidths), *_item = (a); do { if ((__builtin_expect (!!(!(_item)),0))) log_assert_failed_realm(LOG_REALM_SYSTEMD, ("_item"), "../src/core/dbus-cgroup.c", 1132, __PRETTY_FUNCTION__ ); } while (0); if ((_item->device_bandwidths_next = *_head )) _item->device_bandwidths_next->device_bandwidths_prev = _item; _item->device_bandwidths_prev = ((void*)0); *_head = _item; } while (0); |
1133 | } |
1134 | |
1135 | if (read) |
1136 | a->rbps = u64; |
1137 | else |
1138 | a->wbps = u64; |
1139 | } |
1140 | |
1141 | n++; |
1142 | } |
1143 | if (r < 0) |
1144 | return r; |
1145 | |
1146 | r = sd_bus_message_exit_container(message); |
1147 | if (r < 0) |
1148 | return r; |
1149 | |
1150 | if (!UNIT_WRITE_FLAGS_NOOP(flags)(((flags) & (UNIT_RUNTIME|UNIT_PERSISTENT)) == 0)) { |
1151 | CGroupBlockIODeviceBandwidth *a; |
1152 | _cleanup_free___attribute__((cleanup(freep))) char *buf = NULL((void*)0); |
1153 | _cleanup_fclose___attribute__((cleanup(fclosep))) FILE *f = NULL((void*)0); |
1154 | size_t size = 0; |
1155 | |
1156 | if (n == 0) { |
1157 | LIST_FOREACH(device_bandwidths, a, c->blockio_device_bandwidths)for ((a) = (c->blockio_device_bandwidths); (a); (a) = (a)-> device_bandwidths_next) { |
1158 | if (read) |
1159 | a->rbps = CGROUP_LIMIT_MAX((uint64_t) -1); |
1160 | else |
1161 | a->wbps = CGROUP_LIMIT_MAX((uint64_t) -1); |
1162 | } |
1163 | } |
1164 | |
1165 | unit_invalidate_cgroup(u, CGROUP_MASK_BLKIO); |
1166 | |
1167 | f = open_memstream(&buf, &size); |
1168 | if (!f) |
1169 | return -ENOMEM12; |
1170 | |
1171 | (void) __fsetlocking(f, FSETLOCKING_BYCALLERFSETLOCKING_BYCALLER); |
1172 | |
1173 | if (read) { |
1174 | fputs("BlockIOReadBandwidth=\n", f); |
1175 | LIST_FOREACH(device_bandwidths, a, c->blockio_device_bandwidths)for ((a) = (c->blockio_device_bandwidths); (a); (a) = (a)-> device_bandwidths_next) |
1176 | if (a->rbps != CGROUP_LIMIT_MAX((uint64_t) -1)) |
1177 | fprintf(f, "BlockIOReadBandwidth=%s %" PRIu64"l" "u" "\n", a->path, a->rbps); |
1178 | } else { |
1179 | fputs("BlockIOWriteBandwidth=\n", f); |
1180 | LIST_FOREACH(device_bandwidths, a, c->blockio_device_bandwidths)for ((a) = (c->blockio_device_bandwidths); (a); (a) = (a)-> device_bandwidths_next) |
1181 | if (a->wbps != CGROUP_LIMIT_MAX((uint64_t) -1)) |
1182 | fprintf(f, "BlockIOWriteBandwidth=%s %" PRIu64"l" "u" "\n", a->path, a->wbps); |
1183 | } |
1184 | |
1185 | r = fflush_and_check(f); |
1186 | if (r < 0) |
1187 | return r; |
1188 | |
1189 | unit_write_setting(u, flags, name, buf); |
1190 | } |
1191 | |
1192 | return 1; |
1193 | |
1194 | } else if (streq(name, "BlockIODeviceWeight")(strcmp((name),("BlockIODeviceWeight")) == 0)) { |
1195 | const char *path; |
1196 | uint64_t weight; |
1197 | unsigned n = 0; |
1198 | |
1199 | r = sd_bus_message_enter_container(message, 'a', "(st)"); |
1200 | if (r < 0) |
1201 | return r; |
1202 | |
1203 | while ((r = sd_bus_message_read(message, "(st)", &path, &weight)) > 0) { |
1204 | |
1205 | if (!path_is_normalized(path)) |
1206 | return sd_bus_error_setf(error, SD_BUS_ERROR_INVALID_ARGS"org.freedesktop.DBus.Error.InvalidArgs", "Path '%s' specified in %s= is not normalized.", name, path); |
1207 | |
1208 | if (!CGROUP_BLKIO_WEIGHT_IS_OK(weight) || weight == CGROUP_BLKIO_WEIGHT_INVALID((uint64_t) -1)) |
1209 | return sd_bus_error_setf(error, SD_BUS_ERROR_INVALID_ARGS"org.freedesktop.DBus.Error.InvalidArgs", "BlockIODeviceWeight= out of range"); |
1210 | |
1211 | if (!UNIT_WRITE_FLAGS_NOOP(flags)(((flags) & (UNIT_RUNTIME|UNIT_PERSISTENT)) == 0)) { |
1212 | CGroupBlockIODeviceWeight *a = NULL((void*)0), *b; |
1213 | |
1214 | LIST_FOREACH(device_weights, b, c->blockio_device_weights)for ((b) = (c->blockio_device_weights); (b); (b) = (b)-> device_weights_next) { |
1215 | if (path_equal(b->path, path)) { |
1216 | a = b; |
1217 | break; |
1218 | } |
1219 | } |
1220 | |
1221 | if (!a) { |
1222 | a = new0(CGroupBlockIODeviceWeight, 1)((CGroupBlockIODeviceWeight*) calloc((1), sizeof(CGroupBlockIODeviceWeight ))); |
1223 | if (!a) |
1224 | return -ENOMEM12; |
1225 | |
1226 | a->path = strdup(path); |
1227 | if (!a->path) { |
1228 | free(a); |
1229 | return -ENOMEM12; |
1230 | } |
1231 | LIST_PREPEND(device_weights, c->blockio_device_weights, a)do { typeof(*(c->blockio_device_weights)) **_head = &( c->blockio_device_weights), *_item = (a); do { if ((__builtin_expect (!!(!(_item)),0))) log_assert_failed_realm(LOG_REALM_SYSTEMD, ("_item"), "../src/core/dbus-cgroup.c", 1231, __PRETTY_FUNCTION__ ); } while (0); if ((_item->device_weights_next = *_head)) _item->device_weights_next->device_weights_prev = _item ; _item->device_weights_prev = ((void*)0); *_head = _item; } while (0); |
1232 | } |
1233 | |
1234 | a->weight = weight; |
1235 | } |
1236 | |
1237 | n++; |
1238 | } |
1239 | |
1240 | r = sd_bus_message_exit_container(message); |
1241 | if (r < 0) |
1242 | return r; |
1243 | |
1244 | if (!UNIT_WRITE_FLAGS_NOOP(flags)(((flags) & (UNIT_RUNTIME|UNIT_PERSISTENT)) == 0)) { |
1245 | _cleanup_free___attribute__((cleanup(freep))) char *buf = NULL((void*)0); |
1246 | _cleanup_fclose___attribute__((cleanup(fclosep))) FILE *f = NULL((void*)0); |
1247 | CGroupBlockIODeviceWeight *a; |
1248 | size_t size = 0; |
1249 | |
1250 | if (n == 0) { |
1251 | while (c->blockio_device_weights) |
1252 | cgroup_context_free_blockio_device_weight(c, c->blockio_device_weights); |
1253 | } |
1254 | |
1255 | unit_invalidate_cgroup(u, CGROUP_MASK_BLKIO); |
1256 | |
1257 | f = open_memstream(&buf, &size); |
1258 | if (!f) |
1259 | return -ENOMEM12; |
1260 | |
1261 | (void) __fsetlocking(f, FSETLOCKING_BYCALLERFSETLOCKING_BYCALLER); |
1262 | |
1263 | fputs("BlockIODeviceWeight=\n", f); |
1264 | LIST_FOREACH(device_weights, a, c->blockio_device_weights)for ((a) = (c->blockio_device_weights); (a); (a) = (a)-> device_weights_next) |
1265 | fprintf(f, "BlockIODeviceWeight=%s %" PRIu64"l" "u" "\n", a->path, a->weight); |
1266 | |
1267 | r = fflush_and_check(f); |
1268 | if (r < 0) |
1269 | return r; |
1270 | |
1271 | unit_write_setting(u, flags, name, buf); |
1272 | } |
1273 | |
1274 | return 1; |
1275 | |
1276 | } else if (streq(name, "DevicePolicy")(strcmp((name),("DevicePolicy")) == 0)) { |
1277 | const char *policy; |
1278 | CGroupDevicePolicy p; |
1279 | |
1280 | r = sd_bus_message_read(message, "s", &policy); |
1281 | if (r < 0) |
1282 | return r; |
1283 | |
1284 | p = cgroup_device_policy_from_string(policy); |
1285 | if (p < 0) |
1286 | return -EINVAL22; |
1287 | |
1288 | if (!UNIT_WRITE_FLAGS_NOOP(flags)(((flags) & (UNIT_RUNTIME|UNIT_PERSISTENT)) == 0)) { |
1289 | c->device_policy = p; |
1290 | unit_invalidate_cgroup(u, CGROUP_MASK_DEVICES); |
1291 | unit_write_settingf(u, flags, name, "DevicePolicy=%s", policy); |
1292 | } |
1293 | |
1294 | return 1; |
1295 | |
1296 | } else if (streq(name, "DeviceAllow")(strcmp((name),("DeviceAllow")) == 0)) { |
1297 | const char *path, *rwm; |
1298 | unsigned n = 0; |
1299 | |
1300 | r = sd_bus_message_enter_container(message, 'a', "(ss)"); |
1301 | if (r < 0) |
1302 | return r; |
1303 | |
1304 | while ((r = sd_bus_message_read(message, "(ss)", &path, &rwm)) > 0) { |
1305 | |
1306 | if (!valid_device_allow_pattern(path) || strpbrk(path, WHITESPACE" \t\n\r")) |
1307 | return sd_bus_error_setf(error, SD_BUS_ERROR_INVALID_ARGS"org.freedesktop.DBus.Error.InvalidArgs", "DeviceAllow= requires device node or pattern"); |
1308 | |
1309 | if (isempty(rwm)) |
1310 | rwm = "rwm"; |
1311 | else if (!in_charset(rwm, "rwm")) |
1312 | return sd_bus_error_setf(error, SD_BUS_ERROR_INVALID_ARGS"org.freedesktop.DBus.Error.InvalidArgs", "DeviceAllow= requires combination of rwm flags"); |
1313 | |
1314 | if (!UNIT_WRITE_FLAGS_NOOP(flags)(((flags) & (UNIT_RUNTIME|UNIT_PERSISTENT)) == 0)) { |
1315 | CGroupDeviceAllow *a = NULL((void*)0), *b; |
1316 | |
1317 | LIST_FOREACH(device_allow, b, c->device_allow)for ((b) = (c->device_allow); (b); (b) = (b)->device_allow_next ) { |
1318 | if (path_equal(b->path, path)) { |
1319 | a = b; |
1320 | break; |
1321 | } |
1322 | } |
1323 | |
1324 | if (!a) { |
1325 | a = new0(CGroupDeviceAllow, 1)((CGroupDeviceAllow*) calloc((1), sizeof(CGroupDeviceAllow))); |
1326 | if (!a) |
1327 | return -ENOMEM12; |
1328 | |
1329 | a->path = strdup(path); |
1330 | if (!a->path) { |
1331 | free(a); |
1332 | return -ENOMEM12; |
1333 | } |
1334 | |
1335 | LIST_PREPEND(device_allow, c->device_allow, a)do { typeof(*(c->device_allow)) **_head = &(c->device_allow ), *_item = (a); do { if ((__builtin_expect(!!(!(_item)),0))) log_assert_failed_realm(LOG_REALM_SYSTEMD, ("_item"), "../src/core/dbus-cgroup.c" , 1335, __PRETTY_FUNCTION__); } while (0); if ((_item->device_allow_next = *_head)) _item->device_allow_next->device_allow_prev = _item; _item->device_allow_prev = ((void*)0); *_head = _item ; } while (0); |
1336 | } |
1337 | |
1338 | a->r = !!strchr(rwm, 'r'); |
1339 | a->w = !!strchr(rwm, 'w'); |
1340 | a->m = !!strchr(rwm, 'm'); |
1341 | } |
1342 | |
1343 | n++; |
1344 | } |
1345 | if (r < 0) |
1346 | return r; |
1347 | |
1348 | r = sd_bus_message_exit_container(message); |
1349 | if (r < 0) |
1350 | return r; |
1351 | |
1352 | if (!UNIT_WRITE_FLAGS_NOOP(flags)(((flags) & (UNIT_RUNTIME|UNIT_PERSISTENT)) == 0)) { |
1353 | _cleanup_free___attribute__((cleanup(freep))) char *buf = NULL((void*)0); |
1354 | _cleanup_fclose___attribute__((cleanup(fclosep))) FILE *f = NULL((void*)0); |
1355 | CGroupDeviceAllow *a; |
1356 | size_t size = 0; |
1357 | |
1358 | if (n == 0) { |
1359 | while (c->device_allow) |
1360 | cgroup_context_free_device_allow(c, c->device_allow); |
1361 | } |
1362 | |
1363 | unit_invalidate_cgroup(u, CGROUP_MASK_DEVICES); |
1364 | |
1365 | f = open_memstream(&buf, &size); |
1366 | if (!f) |
1367 | return -ENOMEM12; |
1368 | |
1369 | (void) __fsetlocking(f, FSETLOCKING_BYCALLERFSETLOCKING_BYCALLER); |
1370 | |
1371 | fputs("DeviceAllow=\n", f); |
1372 | LIST_FOREACH(device_allow, a, c->device_allow)for ((a) = (c->device_allow); (a); (a) = (a)->device_allow_next ) |
1373 | fprintf(f, "DeviceAllow=%s %s%s%s\n", a->path, a->r ? "r" : "", a->w ? "w" : "", a->m ? "m" : ""); |
1374 | |
1375 | r = fflush_and_check(f); |
1376 | if (r < 0) |
1377 | return r; |
1378 | unit_write_setting(u, flags, name, buf); |
1379 | } |
1380 | |
1381 | return 1; |
1382 | |
1383 | } else if (streq(name, "IPAccounting")(strcmp((name),("IPAccounting")) == 0)) { |
1384 | int b; |
1385 | |
1386 | r = sd_bus_message_read(message, "b", &b); |
1387 | if (r < 0) |
1388 | return r; |
1389 | |
1390 | if (!UNIT_WRITE_FLAGS_NOOP(flags)(((flags) & (UNIT_RUNTIME|UNIT_PERSISTENT)) == 0)) { |
1391 | c->ip_accounting = b; |
1392 | |
1393 | unit_invalidate_cgroup_bpf(u); |
1394 | unit_write_settingf(u, flags, name, "IPAccounting=%s", yes_no(b)); |
1395 | } |
1396 | |
1397 | return 1; |
1398 | |
1399 | } else if (STR_IN_SET(name, "IPAddressAllow", "IPAddressDeny")(!!strv_find((((char**) ((const char*[]) { "IPAddressAllow", "IPAddressDeny" , ((void*)0) }))), (name)))) { |
1400 | IPAddressAccessItem **list; |
1401 | size_t n = 0; |
1402 | |
1403 | list = streq(name, "IPAddressAllow")(strcmp((name),("IPAddressAllow")) == 0) ? &c->ip_address_allow : &c->ip_address_deny; |
1404 | |
1405 | r = sd_bus_message_enter_container(message, 'a', "(iayu)"); |
1406 | if (r < 0) |
1407 | return r; |
1408 | |
1409 | for (;;) { |
1410 | const void *ap; |
1411 | int32_t family; |
1412 | uint32_t prefixlen; |
1413 | size_t an; |
1414 | |
1415 | r = sd_bus_message_enter_container(message, 'r', "iayu"); |
1416 | if (r < 0) |
1417 | return r; |
1418 | if (r == 0) |
1419 | break; |
1420 | |
1421 | r = sd_bus_message_read(message, "i", &family); |
1422 | if (r < 0) |
1423 | return r; |
1424 | |
1425 | if (!IN_SET(family, AF_INET, AF_INET6)({ _Bool _found = 0; static __attribute__ ((unused)) char _static_assert__macros_need_to_be_extended [20 - sizeof((int[]){2, 10})/sizeof(int)]; switch(family) { case 2: case 10: _found = 1; break; default: break; } _found; })) |
1426 | return sd_bus_error_setf(error, SD_BUS_ERROR_INVALID_ARGS"org.freedesktop.DBus.Error.InvalidArgs", "%s= expects IPv4 or IPv6 addresses only.", name); |
1427 | |
1428 | r = sd_bus_message_read_array(message, 'y', &ap, &an); |
1429 | if (r < 0) |
1430 | return r; |
1431 | |
1432 | if (an != FAMILY_ADDRESS_SIZE(family)) |
1433 | return sd_bus_error_setf(error, SD_BUS_ERROR_INVALID_ARGS"org.freedesktop.DBus.Error.InvalidArgs", "IP address has wrong size for family (%s, expected %zu, got %zu)", |
1434 | af_to_name(family), FAMILY_ADDRESS_SIZE(family), an); |
1435 | |
1436 | r = sd_bus_message_read(message, "u", &prefixlen); |
1437 | if (r < 0) |
1438 | return r; |
1439 | |
1440 | if (prefixlen > FAMILY_ADDRESS_SIZE(family)*8) |
1441 | return sd_bus_error_setf(error, SD_BUS_ERROR_INVALID_ARGS"org.freedesktop.DBus.Error.InvalidArgs", "Prefix length %" PRIu32"u" " too large for address family %s.", prefixlen, af_to_name(family)); |
1442 | |
1443 | if (!UNIT_WRITE_FLAGS_NOOP(flags)(((flags) & (UNIT_RUNTIME|UNIT_PERSISTENT)) == 0)) { |
1444 | IPAddressAccessItem *item; |
1445 | |
1446 | item = new0(IPAddressAccessItem, 1)((IPAddressAccessItem*) calloc((1), sizeof(IPAddressAccessItem ))); |
1447 | if (!item) |
1448 | return -ENOMEM12; |
1449 | |
1450 | item->family = family; |
1451 | item->prefixlen = prefixlen; |
1452 | memcpy(&item->address, ap, an); |
1453 | |
1454 | LIST_PREPEND(items, *list, item)do { typeof(*(*list)) **_head = &(*list), *_item = (item) ; do { if ((__builtin_expect(!!(!(_item)),0))) log_assert_failed_realm (LOG_REALM_SYSTEMD, ("_item"), "../src/core/dbus-cgroup.c", 1454 , __PRETTY_FUNCTION__); } while (0); if ((_item->items_next = *_head)) _item->items_next->items_prev = _item; _item ->items_prev = ((void*)0); *_head = _item; } while (0); |
1455 | } |
1456 | |
1457 | r = sd_bus_message_exit_container(message); |
1458 | if (r < 0) |
1459 | return r; |
1460 | |
1461 | n++; |
1462 | } |
1463 | |
1464 | r = sd_bus_message_exit_container(message); |
1465 | if (r < 0) |
1466 | return r; |
1467 | |
1468 | *list = ip_address_access_reduce(*list); |
1469 | |
1470 | if (!UNIT_WRITE_FLAGS_NOOP(flags)(((flags) & (UNIT_RUNTIME|UNIT_PERSISTENT)) == 0)) { |
1471 | _cleanup_free___attribute__((cleanup(freep))) char *buf = NULL((void*)0); |
1472 | _cleanup_fclose___attribute__((cleanup(fclosep))) FILE *f = NULL((void*)0); |
1473 | IPAddressAccessItem *item; |
1474 | size_t size = 0; |
1475 | |
1476 | if (n == 0) |
1477 | *list = ip_address_access_free_all(*list); |
1478 | |
1479 | unit_invalidate_cgroup_bpf(u); |
1480 | f = open_memstream(&buf, &size); |
1481 | if (!f) |
1482 | return -ENOMEM12; |
1483 | |
1484 | (void) __fsetlocking(f, FSETLOCKING_BYCALLERFSETLOCKING_BYCALLER); |
1485 | |
1486 | fputs(name, f); |
1487 | fputs("=\n", f); |
1488 | |
1489 | LIST_FOREACH(items, item, *list)for ((item) = (*list); (item); (item) = (item)->items_next ) { |
1490 | char buffer[CONST_MAX(INET_ADDRSTRLEN, INET6_ADDRSTRLEN)__extension__ (__builtin_choose_expr( __builtin_constant_p(16 ) && __builtin_constant_p(46) && __builtin_types_compatible_p (typeof(16), typeof(46)), ((16) > (46)) ? (16) : (46), ((void )0)))]; |
1491 | |
1492 | errno(*__errno_location ()) = 0; |
1493 | if (!inet_ntop(item->family, &item->address, buffer, sizeof(buffer))) |
1494 | return errno(*__errno_location ()) > 0 ? -errno(*__errno_location ()) : -EINVAL22; |
1495 | |
1496 | fprintf(f, "%s=%s/%u\n", name, buffer, item->prefixlen); |
1497 | } |
1498 | |
1499 | r = fflush_and_check(f); |
1500 | if (r < 0) |
1501 | return r; |
1502 | |
1503 | unit_write_setting(u, flags, name, buf); |
1504 | |
1505 | if (*list) { |
1506 | r = bpf_firewall_supported(); |
1507 | if (r < 0) |
1508 | return r; |
1509 | if (r == BPF_FIREWALL_UNSUPPORTED) { |
1510 | static bool_Bool warned = false0; |
1511 | |
1512 | log_full(warned ? LOG_DEBUG : LOG_WARNING,({ int _level = (((warned ? 7 : 4))), _e = ((0)), _realm = (LOG_REALM_SYSTEMD ); (log_get_max_level_realm(_realm) >= ((_level) & 0x07 )) ? log_internal_realm(((_realm) << 10 | (_level)), _e , "../src/core/dbus-cgroup.c", 1514, __func__, "Transient unit %s configures an IP firewall, but the local system does not support BPF/cgroup firewalling.\n" "Proceeding WITHOUT firewalling in effect! (This warning is only shown for the first started transient unit using IP firewalling.)" , u->id) : -abs(_e); }) |
1513 | "Transient unit %s configures an IP firewall, but the local system does not support BPF/cgroup firewalling.\n"({ int _level = (((warned ? 7 : 4))), _e = ((0)), _realm = (LOG_REALM_SYSTEMD ); (log_get_max_level_realm(_realm) >= ((_level) & 0x07 )) ? log_internal_realm(((_realm) << 10 | (_level)), _e , "../src/core/dbus-cgroup.c", 1514, __func__, "Transient unit %s configures an IP firewall, but the local system does not support BPF/cgroup firewalling.\n" "Proceeding WITHOUT firewalling in effect! (This warning is only shown for the first started transient unit using IP firewalling.)" , u->id) : -abs(_e); }) |
1514 | "Proceeding WITHOUT firewalling in effect! (This warning is only shown for the first started transient unit using IP firewalling.)", u->id)({ int _level = (((warned ? 7 : 4))), _e = ((0)), _realm = (LOG_REALM_SYSTEMD ); (log_get_max_level_realm(_realm) >= ((_level) & 0x07 )) ? log_internal_realm(((_realm) << 10 | (_level)), _e , "../src/core/dbus-cgroup.c", 1514, __func__, "Transient unit %s configures an IP firewall, but the local system does not support BPF/cgroup firewalling.\n" "Proceeding WITHOUT firewalling in effect! (This warning is only shown for the first started transient unit using IP firewalling.)" , u->id) : -abs(_e); }); |
1515 | |
1516 | warned = true1; |
1517 | } |
1518 | } |
1519 | } |
1520 | |
1521 | return 1; |
1522 | } |
1523 | |
1524 | if (u->transient && u->load_state == UNIT_STUB) |
1525 | return bus_cgroup_set_transient_property(u, c, name, message, flags, error); |
1526 | |
1527 | return 0; |
1528 | } |