File: | build-scan/../src/core/dbus-manager.c |
Warning: | line 816, column 21 2nd function call argument is an uninitialized value |
Press '?' to see keyboard shortcuts
Keyboard shortcuts:
1 | /* SPDX-License-Identifier: LGPL-2.1+ */ | |||
2 | ||||
3 | #include <errno(*__errno_location ()).h> | |||
4 | #include <sys/prctl.h> | |||
5 | #include <sys/statvfs.h> | |||
6 | #include <unistd.h> | |||
7 | ||||
8 | #include "alloc-util.h" | |||
9 | #include "architecture.h" | |||
10 | #include "build.h" | |||
11 | #include "bus-common-errors.h" | |||
12 | #include "dbus-execute.h" | |||
13 | #include "dbus-job.h" | |||
14 | #include "dbus-manager.h" | |||
15 | #include "dbus-unit.h" | |||
16 | #include "dbus.h" | |||
17 | #include "env-util.h" | |||
18 | #include "fd-util.h" | |||
19 | #include "fileio.h" | |||
20 | #include "format-util.h" | |||
21 | #include "fs-util.h" | |||
22 | #include "install.h" | |||
23 | #include "log.h" | |||
24 | #include "os-util.h" | |||
25 | #include "parse-util.h" | |||
26 | #include "path-util.h" | |||
27 | #include "selinux-access.h" | |||
28 | #include "stat-util.h" | |||
29 | #include "string-util.h" | |||
30 | #include "strv.h" | |||
31 | #include "syslog-util.h" | |||
32 | #include "user-util.h" | |||
33 | #include "virt.h" | |||
34 | #include "watchdog.h" | |||
35 | ||||
36 | /* Require 16MiB free in /run/systemd for reloading/reexecing. After all we need to serialize our state there, and if | |||
37 | * we can't we'll fail badly. */ | |||
38 | #define RELOAD_DISK_SPACE_MIN(16UL * 1024UL * 1024UL) (UINT64_C(16)16UL * UINT64_C(1024)1024UL * UINT64_C(1024)1024UL) | |||
39 | ||||
40 | static UnitFileFlags unit_file_bools_to_flags(bool_Bool runtime, bool_Bool force) { | |||
41 | return (runtime ? UNIT_FILE_RUNTIME : 0) | | |||
42 | (force ? UNIT_FILE_FORCE : 0); | |||
43 | } | |||
44 | ||||
45 | static BUS_DEFINE_PROPERTY_GET_GLOBAL(property_get_version, "s", PACKAGE_VERSION)int property_get_version(sd_bus *bus, const char *path, const char *interface, const char *property, sd_bus_message *reply , void *userdata, sd_bus_error *error) { do { if ((__builtin_expect (!!(!(bus)),0))) log_assert_failed_realm(LOG_REALM_SYSTEMD, ( "bus"), "../src/core/dbus-manager.c", 45, __PRETTY_FUNCTION__ ); } while (0); do { if ((__builtin_expect(!!(!(reply)),0))) log_assert_failed_realm (LOG_REALM_SYSTEMD, ("reply"), "../src/core/dbus-manager.c", 45 , __PRETTY_FUNCTION__); } while (0); return sd_bus_message_append (reply, "s", "239"); }; | |||
46 | static BUS_DEFINE_PROPERTY_GET_GLOBAL(property_get_features, "s", SYSTEMD_FEATURES)int property_get_features(sd_bus *bus, const char *path, const char *interface, const char *property, sd_bus_message *reply , void *userdata, sd_bus_error *error) { do { if ((__builtin_expect (!!(!(bus)),0))) log_assert_failed_realm(LOG_REALM_SYSTEMD, ( "bus"), "../src/core/dbus-manager.c", 46, __PRETTY_FUNCTION__ ); } while (0); do { if ((__builtin_expect(!!(!(reply)),0))) log_assert_failed_realm (LOG_REALM_SYSTEMD, ("reply"), "../src/core/dbus-manager.c", 46 , __PRETTY_FUNCTION__); } while (0); return sd_bus_message_append (reply, "s", "+PAM" " " "+AUDIT" " " "+SELINUX" " " "+IMA" " " "-APPARMOR" " " "+SMACK" " " "+SYSVINIT" " " "+UTMP" " " "+LIBCRYPTSETUP" " " "+GCRYPT" " " "+GNUTLS" " " "+ACL" " " "+XZ" " " "+LZ4" " " "+SECCOMP" " " "+BLKID" " " "+ELFUTILS" " " "+KMOD" " " "+IDN2" " " "-IDN" " " "+PCRE2" " " "default-hierarchy=" "hybrid"); }; | |||
47 | static BUS_DEFINE_PROPERTY_GET_GLOBAL(property_get_architecture, "s", architecture_to_string(uname_architecture()))int property_get_architecture(sd_bus *bus, const char *path, const char *interface, const char *property, sd_bus_message *reply , void *userdata, sd_bus_error *error) { do { if ((__builtin_expect (!!(!(bus)),0))) log_assert_failed_realm(LOG_REALM_SYSTEMD, ( "bus"), "../src/core/dbus-manager.c", 47, __PRETTY_FUNCTION__ ); } while (0); do { if ((__builtin_expect(!!(!(reply)),0))) log_assert_failed_realm (LOG_REALM_SYSTEMD, ("reply"), "../src/core/dbus-manager.c", 47 , __PRETTY_FUNCTION__); } while (0); return sd_bus_message_append (reply, "s", architecture_to_string(uname_architecture())); }; | |||
48 | static BUS_DEFINE_PROPERTY_GET_GLOBAL(property_get_log_target, "s", log_target_to_string(log_get_target()))int property_get_log_target(sd_bus *bus, const char *path, const char *interface, const char *property, sd_bus_message *reply , void *userdata, sd_bus_error *error) { do { if ((__builtin_expect (!!(!(bus)),0))) log_assert_failed_realm(LOG_REALM_SYSTEMD, ( "bus"), "../src/core/dbus-manager.c", 48, __PRETTY_FUNCTION__ ); } while (0); do { if ((__builtin_expect(!!(!(reply)),0))) log_assert_failed_realm (LOG_REALM_SYSTEMD, ("reply"), "../src/core/dbus-manager.c", 48 , __PRETTY_FUNCTION__); } while (0); return sd_bus_message_append (reply, "s", log_target_to_string(log_get_target())); }; | |||
49 | static BUS_DEFINE_PROPERTY_GET2(property_get_system_state, "s", Manager, manager_state, manager_state_to_string)int property_get_system_state(sd_bus *bus, const char *path, const char *interface, const char *property, sd_bus_message *reply , void *userdata, sd_bus_error *error) { Manager *data = userdata ; do { if ((__builtin_expect(!!(!(bus)),0))) log_assert_failed_realm (LOG_REALM_SYSTEMD, ("bus"), "../src/core/dbus-manager.c", 49 , __PRETTY_FUNCTION__); } while (0); do { if ((__builtin_expect (!!(!(reply)),0))) log_assert_failed_realm(LOG_REALM_SYSTEMD, ("reply"), "../src/core/dbus-manager.c", 49, __PRETTY_FUNCTION__ ); } while (0); do { if ((__builtin_expect(!!(!(data)),0))) log_assert_failed_realm (LOG_REALM_SYSTEMD, ("data"), "../src/core/dbus-manager.c", 49 , __PRETTY_FUNCTION__); } while (0); return sd_bus_message_append (reply, "s", manager_state_to_string(manager_state(data))); }; | |||
50 | static BUS_DEFINE_PROPERTY_GET_GLOBAL(property_get_timer_slack_nsec, "t", (uint64_t) prctl(PR_GET_TIMERSLACK))int property_get_timer_slack_nsec(sd_bus *bus, const char *path , const char *interface, const char *property, sd_bus_message *reply, void *userdata, sd_bus_error *error) { do { if ((__builtin_expect (!!(!(bus)),0))) log_assert_failed_realm(LOG_REALM_SYSTEMD, ( "bus"), "../src/core/dbus-manager.c", 50, __PRETTY_FUNCTION__ ); } while (0); do { if ((__builtin_expect(!!(!(reply)),0))) log_assert_failed_realm (LOG_REALM_SYSTEMD, ("reply"), "../src/core/dbus-manager.c", 50 , __PRETTY_FUNCTION__); } while (0); return sd_bus_message_append (reply, "t", (uint64_t) prctl(30)); }; | |||
51 | static BUS_DEFINE_PROPERTY_GET_REF(property_get_hashmap_size, "u", Hashmap *, hashmap_size)int property_get_hashmap_size(sd_bus *bus, const char *path, const char *interface, const char *property, sd_bus_message *reply , void *userdata, sd_bus_error *error) { Hashmap * *data = userdata ; do { if ((__builtin_expect(!!(!(bus)),0))) log_assert_failed_realm (LOG_REALM_SYSTEMD, ("bus"), "../src/core/dbus-manager.c", 51 , __PRETTY_FUNCTION__); } while (0); do { if ((__builtin_expect (!!(!(reply)),0))) log_assert_failed_realm(LOG_REALM_SYSTEMD, ("reply"), "../src/core/dbus-manager.c", 51, __PRETTY_FUNCTION__ ); } while (0); do { if ((__builtin_expect(!!(!(data)),0))) log_assert_failed_realm (LOG_REALM_SYSTEMD, ("data"), "../src/core/dbus-manager.c", 51 , __PRETTY_FUNCTION__); } while (0); return sd_bus_message_append (reply, "u", hashmap_size((*(data)))); }; | |||
52 | static BUS_DEFINE_PROPERTY_GET_REF(property_get_set_size, "u", Set *, set_size)int property_get_set_size(sd_bus *bus, const char *path, const char *interface, const char *property, sd_bus_message *reply , void *userdata, sd_bus_error *error) { Set * *data = userdata ; do { if ((__builtin_expect(!!(!(bus)),0))) log_assert_failed_realm (LOG_REALM_SYSTEMD, ("bus"), "../src/core/dbus-manager.c", 52 , __PRETTY_FUNCTION__); } while (0); do { if ((__builtin_expect (!!(!(reply)),0))) log_assert_failed_realm(LOG_REALM_SYSTEMD, ("reply"), "../src/core/dbus-manager.c", 52, __PRETTY_FUNCTION__ ); } while (0); do { if ((__builtin_expect(!!(!(data)),0))) log_assert_failed_realm (LOG_REALM_SYSTEMD, ("data"), "../src/core/dbus-manager.c", 52 , __PRETTY_FUNCTION__); } while (0); return sd_bus_message_append (reply, "u", set_size((*(data)))); }; | |||
53 | ||||
54 | static int property_get_virtualization( | |||
55 | sd_bus *bus, | |||
56 | const char *path, | |||
57 | const char *interface, | |||
58 | const char *property, | |||
59 | sd_bus_message *reply, | |||
60 | void *userdata, | |||
61 | sd_bus_error *error) { | |||
62 | ||||
63 | int v; | |||
64 | ||||
65 | assert(bus)do { if ((__builtin_expect(!!(!(bus)),0))) log_assert_failed_realm (LOG_REALM_SYSTEMD, ("bus"), "../src/core/dbus-manager.c", 65 , __PRETTY_FUNCTION__); } while (0); | |||
66 | assert(reply)do { if ((__builtin_expect(!!(!(reply)),0))) log_assert_failed_realm (LOG_REALM_SYSTEMD, ("reply"), "../src/core/dbus-manager.c", 66 , __PRETTY_FUNCTION__); } while (0); | |||
67 | ||||
68 | v = detect_virtualization(); | |||
69 | ||||
70 | /* Make sure to return the empty string when we detect no virtualization, as that is the API. | |||
71 | * | |||
72 | * https://github.com/systemd/systemd/issues/1423 | |||
73 | */ | |||
74 | ||||
75 | return sd_bus_message_append( | |||
76 | reply, "s", | |||
77 | v == VIRTUALIZATION_NONE ? NULL((void*)0) : virtualization_to_string(v)); | |||
78 | } | |||
79 | ||||
80 | static int property_get_tainted( | |||
81 | sd_bus *bus, | |||
82 | const char *path, | |||
83 | const char *interface, | |||
84 | const char *property, | |||
85 | sd_bus_message *reply, | |||
86 | void *userdata, | |||
87 | sd_bus_error *error) { | |||
88 | ||||
89 | _cleanup_free___attribute__((cleanup(freep))) char *s = NULL((void*)0); | |||
90 | Manager *m = userdata; | |||
91 | ||||
92 | assert(bus)do { if ((__builtin_expect(!!(!(bus)),0))) log_assert_failed_realm (LOG_REALM_SYSTEMD, ("bus"), "../src/core/dbus-manager.c", 92 , __PRETTY_FUNCTION__); } while (0); | |||
93 | assert(reply)do { if ((__builtin_expect(!!(!(reply)),0))) log_assert_failed_realm (LOG_REALM_SYSTEMD, ("reply"), "../src/core/dbus-manager.c", 93 , __PRETTY_FUNCTION__); } while (0); | |||
94 | assert(m)do { if ((__builtin_expect(!!(!(m)),0))) log_assert_failed_realm (LOG_REALM_SYSTEMD, ("m"), "../src/core/dbus-manager.c", 94, __PRETTY_FUNCTION__ ); } while (0); | |||
95 | ||||
96 | s = manager_taint_string(m); | |||
97 | if (!s) | |||
98 | return log_oom()log_oom_internal(LOG_REALM_SYSTEMD, "../src/core/dbus-manager.c" , 98, __func__); | |||
99 | ||||
100 | return sd_bus_message_append(reply, "s", s); | |||
101 | } | |||
102 | ||||
103 | static int property_set_log_target( | |||
104 | sd_bus *bus, | |||
105 | const char *path, | |||
106 | const char *interface, | |||
107 | const char *property, | |||
108 | sd_bus_message *value, | |||
109 | void *userdata, | |||
110 | sd_bus_error *error) { | |||
111 | ||||
112 | Manager *m = userdata; | |||
113 | const char *t; | |||
114 | int r; | |||
115 | ||||
116 | assert(bus)do { if ((__builtin_expect(!!(!(bus)),0))) log_assert_failed_realm (LOG_REALM_SYSTEMD, ("bus"), "../src/core/dbus-manager.c", 116 , __PRETTY_FUNCTION__); } while (0); | |||
117 | assert(value)do { if ((__builtin_expect(!!(!(value)),0))) log_assert_failed_realm (LOG_REALM_SYSTEMD, ("value"), "../src/core/dbus-manager.c", 117 , __PRETTY_FUNCTION__); } while (0); | |||
118 | ||||
119 | r = sd_bus_message_read(value, "s", &t); | |||
120 | if (r < 0) | |||
121 | return r; | |||
122 | ||||
123 | if (isempty(t)) | |||
124 | manager_restore_original_log_target(m); | |||
125 | else { | |||
126 | LogTarget target; | |||
127 | ||||
128 | target = log_target_from_string(t); | |||
129 | if (target < 0) | |||
130 | return sd_bus_error_setf(error, SD_BUS_ERROR_INVALID_ARGS"org.freedesktop.DBus.Error.InvalidArgs", "Invalid log target '%s'", t); | |||
131 | ||||
132 | manager_override_log_target(m, target); | |||
133 | } | |||
134 | ||||
135 | return 0; | |||
136 | } | |||
137 | ||||
138 | static int property_get_log_level( | |||
139 | sd_bus *bus, | |||
140 | const char *path, | |||
141 | const char *interface, | |||
142 | const char *property, | |||
143 | sd_bus_message *reply, | |||
144 | void *userdata, | |||
145 | sd_bus_error *error) { | |||
146 | ||||
147 | _cleanup_free___attribute__((cleanup(freep))) char *t = NULL((void*)0); | |||
148 | int r; | |||
149 | ||||
150 | assert(bus)do { if ((__builtin_expect(!!(!(bus)),0))) log_assert_failed_realm (LOG_REALM_SYSTEMD, ("bus"), "../src/core/dbus-manager.c", 150 , __PRETTY_FUNCTION__); } while (0); | |||
151 | assert(reply)do { if ((__builtin_expect(!!(!(reply)),0))) log_assert_failed_realm (LOG_REALM_SYSTEMD, ("reply"), "../src/core/dbus-manager.c", 151 , __PRETTY_FUNCTION__); } while (0); | |||
152 | ||||
153 | r = log_level_to_string_alloc(log_get_max_level()log_get_max_level_realm(LOG_REALM_SYSTEMD), &t); | |||
154 | if (r < 0) | |||
155 | return r; | |||
156 | ||||
157 | return sd_bus_message_append(reply, "s", t); | |||
158 | } | |||
159 | ||||
160 | static int property_set_log_level( | |||
161 | sd_bus *bus, | |||
162 | const char *path, | |||
163 | const char *interface, | |||
164 | const char *property, | |||
165 | sd_bus_message *value, | |||
166 | void *userdata, | |||
167 | sd_bus_error *error) { | |||
168 | ||||
169 | Manager *m = userdata; | |||
170 | const char *t; | |||
171 | int r; | |||
172 | ||||
173 | assert(bus)do { if ((__builtin_expect(!!(!(bus)),0))) log_assert_failed_realm (LOG_REALM_SYSTEMD, ("bus"), "../src/core/dbus-manager.c", 173 , __PRETTY_FUNCTION__); } while (0); | |||
174 | assert(value)do { if ((__builtin_expect(!!(!(value)),0))) log_assert_failed_realm (LOG_REALM_SYSTEMD, ("value"), "../src/core/dbus-manager.c", 174 , __PRETTY_FUNCTION__); } while (0); | |||
175 | ||||
176 | r = sd_bus_message_read(value, "s", &t); | |||
177 | if (r < 0) | |||
178 | return r; | |||
179 | ||||
180 | if (isempty(t)) | |||
181 | manager_restore_original_log_level(m); | |||
182 | else { | |||
183 | int level; | |||
184 | ||||
185 | level = log_level_from_string(t); | |||
186 | if (level < 0) | |||
187 | return sd_bus_error_setf(error, SD_BUS_ERROR_INVALID_ARGS"org.freedesktop.DBus.Error.InvalidArgs", "Invalid log level '%s'", t); | |||
188 | ||||
189 | manager_override_log_level(m, level); | |||
190 | } | |||
191 | ||||
192 | return 0; | |||
193 | } | |||
194 | ||||
195 | static int property_get_progress( | |||
196 | sd_bus *bus, | |||
197 | const char *path, | |||
198 | const char *interface, | |||
199 | const char *property, | |||
200 | sd_bus_message *reply, | |||
201 | void *userdata, | |||
202 | sd_bus_error *error) { | |||
203 | ||||
204 | Manager *m = userdata; | |||
205 | double d; | |||
206 | ||||
207 | assert(bus)do { if ((__builtin_expect(!!(!(bus)),0))) log_assert_failed_realm (LOG_REALM_SYSTEMD, ("bus"), "../src/core/dbus-manager.c", 207 , __PRETTY_FUNCTION__); } while (0); | |||
208 | assert(reply)do { if ((__builtin_expect(!!(!(reply)),0))) log_assert_failed_realm (LOG_REALM_SYSTEMD, ("reply"), "../src/core/dbus-manager.c", 208 , __PRETTY_FUNCTION__); } while (0); | |||
209 | assert(m)do { if ((__builtin_expect(!!(!(m)),0))) log_assert_failed_realm (LOG_REALM_SYSTEMD, ("m"), "../src/core/dbus-manager.c", 209, __PRETTY_FUNCTION__); } while (0); | |||
210 | ||||
211 | if (MANAGER_IS_FINISHED(m)(dual_timestamp_is_set((m)->timestamps + MANAGER_TIMESTAMP_FINISH ))) | |||
212 | d = 1.0; | |||
213 | else | |||
214 | d = 1.0 - ((double) hashmap_size(m->jobs) / (double) m->n_installed_jobs); | |||
215 | ||||
216 | return sd_bus_message_append(reply, "d", d); | |||
217 | } | |||
218 | ||||
219 | static int property_get_show_status( | |||
220 | sd_bus *bus, | |||
221 | const char *path, | |||
222 | const char *interface, | |||
223 | const char *property, | |||
224 | sd_bus_message *reply, | |||
225 | void *userdata, | |||
226 | sd_bus_error *error) { | |||
227 | ||||
228 | Manager *m = userdata; | |||
229 | int b; | |||
230 | ||||
231 | assert(bus)do { if ((__builtin_expect(!!(!(bus)),0))) log_assert_failed_realm (LOG_REALM_SYSTEMD, ("bus"), "../src/core/dbus-manager.c", 231 , __PRETTY_FUNCTION__); } while (0); | |||
232 | assert(reply)do { if ((__builtin_expect(!!(!(reply)),0))) log_assert_failed_realm (LOG_REALM_SYSTEMD, ("reply"), "../src/core/dbus-manager.c", 232 , __PRETTY_FUNCTION__); } while (0); | |||
233 | assert(m)do { if ((__builtin_expect(!!(!(m)),0))) log_assert_failed_realm (LOG_REALM_SYSTEMD, ("m"), "../src/core/dbus-manager.c", 233, __PRETTY_FUNCTION__); } while (0); | |||
234 | ||||
235 | b = m->show_status > 0; | |||
236 | return sd_bus_message_append_basic(reply, 'b', &b); | |||
237 | } | |||
238 | ||||
239 | static int property_set_runtime_watchdog( | |||
240 | sd_bus *bus, | |||
241 | const char *path, | |||
242 | const char *interface, | |||
243 | const char *property, | |||
244 | sd_bus_message *value, | |||
245 | void *userdata, | |||
246 | sd_bus_error *error) { | |||
247 | ||||
248 | usec_t *t = userdata; | |||
249 | int r; | |||
250 | ||||
251 | assert(bus)do { if ((__builtin_expect(!!(!(bus)),0))) log_assert_failed_realm (LOG_REALM_SYSTEMD, ("bus"), "../src/core/dbus-manager.c", 251 , __PRETTY_FUNCTION__); } while (0); | |||
252 | assert(value)do { if ((__builtin_expect(!!(!(value)),0))) log_assert_failed_realm (LOG_REALM_SYSTEMD, ("value"), "../src/core/dbus-manager.c", 252 , __PRETTY_FUNCTION__); } while (0); | |||
253 | ||||
254 | assert_cc(sizeof(usec_t) == sizeof(uint64_t))GCC diagnostic push
; GCC diagnostic ignored "-Wdeclaration-after-statement" ; struct _assert_struct_21 { char x[(sizeof(usec_t) == sizeof (uint64_t)) ? 0 : -1]; }; GCC diagnostic pop ; | |||
255 | ||||
256 | r = sd_bus_message_read(value, "t", t); | |||
257 | if (r < 0) | |||
258 | return r; | |||
259 | ||||
260 | return watchdog_set_timeout(t); | |||
261 | } | |||
262 | ||||
263 | static int bus_get_unit_by_name(Manager *m, sd_bus_message *message, const char *name, Unit **ret_unit, sd_bus_error *error) { | |||
264 | Unit *u; | |||
265 | int r; | |||
266 | ||||
267 | assert(m)do { if ((__builtin_expect(!!(!(m)),0))) log_assert_failed_realm (LOG_REALM_SYSTEMD, ("m"), "../src/core/dbus-manager.c", 267, __PRETTY_FUNCTION__); } while (0); | |||
268 | assert(message)do { if ((__builtin_expect(!!(!(message)),0))) log_assert_failed_realm (LOG_REALM_SYSTEMD, ("message"), "../src/core/dbus-manager.c" , 268, __PRETTY_FUNCTION__); } while (0); | |||
269 | assert(ret_unit)do { if ((__builtin_expect(!!(!(ret_unit)),0))) log_assert_failed_realm (LOG_REALM_SYSTEMD, ("ret_unit"), "../src/core/dbus-manager.c" , 269, __PRETTY_FUNCTION__); } while (0); | |||
270 | ||||
271 | /* More or less a wrapper around manager_get_unit() that generates nice errors and has one trick up its sleeve: | |||
272 | * if the name is specified empty we use the client's unit. */ | |||
273 | ||||
274 | if (isempty(name)) { | |||
275 | _cleanup_(sd_bus_creds_unrefp)__attribute__((cleanup(sd_bus_creds_unrefp))) sd_bus_creds *creds = NULL((void*)0); | |||
276 | pid_t pid; | |||
277 | ||||
278 | r = sd_bus_query_sender_creds(message, SD_BUS_CREDS_PID, &creds); | |||
279 | if (r < 0) | |||
280 | return r; | |||
281 | ||||
282 | r = sd_bus_creds_get_pid(creds, &pid); | |||
283 | if (r < 0) | |||
284 | return r; | |||
285 | ||||
286 | u = manager_get_unit_by_pid(m, pid); | |||
287 | if (!u) | |||
288 | return sd_bus_error_setf(error, BUS_ERROR_NO_SUCH_UNIT"org.freedesktop.systemd1.NoSuchUnit", "Client not member of any unit."); | |||
289 | } else { | |||
290 | u = manager_get_unit(m, name); | |||
291 | if (!u) | |||
292 | return sd_bus_error_setf(error, BUS_ERROR_NO_SUCH_UNIT"org.freedesktop.systemd1.NoSuchUnit", "Unit %s not loaded.", name); | |||
293 | } | |||
294 | ||||
295 | *ret_unit = u; | |||
296 | return 0; | |||
297 | } | |||
298 | ||||
299 | static int bus_load_unit_by_name(Manager *m, sd_bus_message *message, const char *name, Unit **ret_unit, sd_bus_error *error) { | |||
300 | assert(m)do { if ((__builtin_expect(!!(!(m)),0))) log_assert_failed_realm (LOG_REALM_SYSTEMD, ("m"), "../src/core/dbus-manager.c", 300, __PRETTY_FUNCTION__); } while (0); | |||
301 | assert(message)do { if ((__builtin_expect(!!(!(message)),0))) log_assert_failed_realm (LOG_REALM_SYSTEMD, ("message"), "../src/core/dbus-manager.c" , 301, __PRETTY_FUNCTION__); } while (0); | |||
302 | assert(ret_unit)do { if ((__builtin_expect(!!(!(ret_unit)),0))) log_assert_failed_realm (LOG_REALM_SYSTEMD, ("ret_unit"), "../src/core/dbus-manager.c" , 302, __PRETTY_FUNCTION__); } while (0); | |||
303 | ||||
304 | /* Pretty much the same as bus_get_unit_by_name(), but we also load the unit if necessary. */ | |||
305 | ||||
306 | if (isempty(name)) | |||
307 | return bus_get_unit_by_name(m, message, name, ret_unit, error); | |||
308 | ||||
309 | return manager_load_unit(m, name, NULL((void*)0), error, ret_unit); | |||
310 | } | |||
311 | ||||
312 | static int method_get_unit(sd_bus_message *message, void *userdata, sd_bus_error *error) { | |||
313 | _cleanup_free___attribute__((cleanup(freep))) char *path = NULL((void*)0); | |||
314 | Manager *m = userdata; | |||
315 | const char *name; | |||
316 | Unit *u; | |||
317 | int r; | |||
318 | ||||
319 | assert(message)do { if ((__builtin_expect(!!(!(message)),0))) log_assert_failed_realm (LOG_REALM_SYSTEMD, ("message"), "../src/core/dbus-manager.c" , 319, __PRETTY_FUNCTION__); } while (0); | |||
320 | assert(m)do { if ((__builtin_expect(!!(!(m)),0))) log_assert_failed_realm (LOG_REALM_SYSTEMD, ("m"), "../src/core/dbus-manager.c", 320, __PRETTY_FUNCTION__); } while (0); | |||
321 | ||||
322 | /* Anyone can call this method */ | |||
323 | ||||
324 | r = sd_bus_message_read(message, "s", &name); | |||
325 | if (r < 0) | |||
326 | return r; | |||
327 | ||||
328 | r = bus_get_unit_by_name(m, message, name, &u, error); | |||
329 | if (r < 0) | |||
330 | return r; | |||
331 | ||||
332 | r = mac_selinux_unit_access_check(u, message, "status", error)mac_selinux_generic_access_check((message), unit_label_path(u ), ("status"), (error)); | |||
333 | if (r < 0) | |||
334 | return r; | |||
335 | ||||
336 | path = unit_dbus_path(u); | |||
337 | if (!path) | |||
338 | return -ENOMEM12; | |||
339 | ||||
340 | return sd_bus_reply_method_return(message, "o", path); | |||
341 | } | |||
342 | ||||
343 | static int method_get_unit_by_pid(sd_bus_message *message, void *userdata, sd_bus_error *error) { | |||
344 | _cleanup_free___attribute__((cleanup(freep))) char *path = NULL((void*)0); | |||
345 | Manager *m = userdata; | |||
346 | pid_t pid; | |||
347 | Unit *u; | |||
348 | int r; | |||
349 | ||||
350 | assert(message)do { if ((__builtin_expect(!!(!(message)),0))) log_assert_failed_realm (LOG_REALM_SYSTEMD, ("message"), "../src/core/dbus-manager.c" , 350, __PRETTY_FUNCTION__); } while (0); | |||
351 | assert(m)do { if ((__builtin_expect(!!(!(m)),0))) log_assert_failed_realm (LOG_REALM_SYSTEMD, ("m"), "../src/core/dbus-manager.c", 351, __PRETTY_FUNCTION__); } while (0); | |||
352 | ||||
353 | assert_cc(sizeof(pid_t) == sizeof(uint32_t))GCC diagnostic push
; GCC diagnostic ignored "-Wdeclaration-after-statement" ; struct _assert_struct_22 { char x[(sizeof(pid_t) == sizeof (uint32_t)) ? 0 : -1]; }; GCC diagnostic pop ; | |||
354 | ||||
355 | /* Anyone can call this method */ | |||
356 | ||||
357 | r = sd_bus_message_read(message, "u", &pid); | |||
358 | if (r < 0) | |||
359 | return r; | |||
360 | if (pid < 0) | |||
361 | return sd_bus_error_setf(error, SD_BUS_ERROR_INVALID_ARGS"org.freedesktop.DBus.Error.InvalidArgs", "Invalid PID " PID_FMT"%" "i", pid); | |||
362 | ||||
363 | if (pid == 0) { | |||
364 | _cleanup_(sd_bus_creds_unrefp)__attribute__((cleanup(sd_bus_creds_unrefp))) sd_bus_creds *creds = NULL((void*)0); | |||
365 | ||||
366 | r = sd_bus_query_sender_creds(message, SD_BUS_CREDS_PID, &creds); | |||
367 | if (r < 0) | |||
368 | return r; | |||
369 | ||||
370 | r = sd_bus_creds_get_pid(creds, &pid); | |||
371 | if (r < 0) | |||
372 | return r; | |||
373 | } | |||
374 | ||||
375 | u = manager_get_unit_by_pid(m, pid); | |||
376 | if (!u) | |||
377 | return sd_bus_error_setf(error, BUS_ERROR_NO_UNIT_FOR_PID"org.freedesktop.systemd1.NoUnitForPID", "PID "PID_FMT"%" "i"" does not belong to any loaded unit.", pid); | |||
378 | ||||
379 | r = mac_selinux_unit_access_check(u, message, "status", error)mac_selinux_generic_access_check((message), unit_label_path(u ), ("status"), (error)); | |||
380 | if (r < 0) | |||
381 | return r; | |||
382 | ||||
383 | path = unit_dbus_path(u); | |||
384 | if (!path) | |||
385 | return -ENOMEM12; | |||
386 | ||||
387 | return sd_bus_reply_method_return(message, "o", path); | |||
388 | } | |||
389 | ||||
390 | static int method_get_unit_by_invocation_id(sd_bus_message *message, void *userdata, sd_bus_error *error) { | |||
391 | _cleanup_free___attribute__((cleanup(freep))) char *path = NULL((void*)0); | |||
392 | Manager *m = userdata; | |||
393 | sd_id128_t id; | |||
394 | const void *a; | |||
395 | Unit *u; | |||
396 | size_t sz; | |||
397 | int r; | |||
398 | ||||
399 | assert(message)do { if ((__builtin_expect(!!(!(message)),0))) log_assert_failed_realm (LOG_REALM_SYSTEMD, ("message"), "../src/core/dbus-manager.c" , 399, __PRETTY_FUNCTION__); } while (0); | |||
400 | assert(m)do { if ((__builtin_expect(!!(!(m)),0))) log_assert_failed_realm (LOG_REALM_SYSTEMD, ("m"), "../src/core/dbus-manager.c", 400, __PRETTY_FUNCTION__); } while (0); | |||
401 | ||||
402 | /* Anyone can call this method */ | |||
403 | ||||
404 | r = sd_bus_message_read_array(message, 'y', &a, &sz); | |||
405 | if (r < 0) | |||
406 | return r; | |||
407 | if (sz == 0) | |||
408 | id = SD_ID128_NULL((const sd_id128_t) { .qwords = { 0, 0 }}); | |||
409 | else if (sz == 16) | |||
410 | memcpy(&id, a, sz); | |||
411 | else | |||
412 | return sd_bus_error_setf(error, SD_BUS_ERROR_INVALID_ARGS"org.freedesktop.DBus.Error.InvalidArgs", "Invalid invocation ID"); | |||
413 | ||||
414 | if (sd_id128_is_null(id)) { | |||
415 | _cleanup_(sd_bus_creds_unrefp)__attribute__((cleanup(sd_bus_creds_unrefp))) sd_bus_creds *creds = NULL((void*)0); | |||
416 | pid_t pid; | |||
417 | ||||
418 | r = sd_bus_query_sender_creds(message, SD_BUS_CREDS_PID, &creds); | |||
419 | if (r < 0) | |||
420 | return r; | |||
421 | ||||
422 | r = sd_bus_creds_get_pid(creds, &pid); | |||
423 | if (r < 0) | |||
424 | return r; | |||
425 | ||||
426 | u = manager_get_unit_by_pid(m, pid); | |||
427 | if (!u) | |||
428 | return sd_bus_error_setf(error, BUS_ERROR_NO_SUCH_UNIT"org.freedesktop.systemd1.NoSuchUnit", "Client " PID_FMT"%" "i" " not member of any unit.", pid); | |||
429 | } else { | |||
430 | u = hashmap_get(m->units_by_invocation_id, &id); | |||
431 | if (!u) | |||
432 | return sd_bus_error_setf(error, BUS_ERROR_NO_UNIT_FOR_INVOCATION_ID"org.freedesktop.systemd1.NoUnitForInvocationID", "No unit with the specified invocation ID " SD_ID128_FORMAT_STR"%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x" " known.", SD_ID128_FORMAT_VAL(id)(id).bytes[0], (id).bytes[1], (id).bytes[2], (id).bytes[3], ( id).bytes[4], (id).bytes[5], (id).bytes[6], (id).bytes[7], (id ).bytes[8], (id).bytes[9], (id).bytes[10], (id).bytes[11], (id ).bytes[12], (id).bytes[13], (id).bytes[14], (id).bytes[15]); | |||
433 | } | |||
434 | ||||
435 | r = mac_selinux_unit_access_check(u, message, "status", error)mac_selinux_generic_access_check((message), unit_label_path(u ), ("status"), (error)); | |||
436 | if (r < 0) | |||
437 | return r; | |||
438 | ||||
439 | /* So here's a special trick: the bus path we return actually references the unit by its invocation ID instead | |||
440 | * of the unit name. This means it stays valid only as long as the invocation ID stays the same. */ | |||
441 | path = unit_dbus_path_invocation_id(u); | |||
442 | if (!path) | |||
443 | return -ENOMEM12; | |||
444 | ||||
445 | return sd_bus_reply_method_return(message, "o", path); | |||
446 | } | |||
447 | ||||
448 | static int method_get_unit_by_control_group(sd_bus_message *message, void *userdata, sd_bus_error *error) { | |||
449 | _cleanup_free___attribute__((cleanup(freep))) char *path = NULL((void*)0); | |||
450 | Manager *m = userdata; | |||
451 | const char *cgroup; | |||
452 | Unit *u; | |||
453 | int r; | |||
454 | ||||
455 | r = sd_bus_message_read(message, "s", &cgroup); | |||
456 | if (r < 0) | |||
457 | return r; | |||
458 | ||||
459 | u = manager_get_unit_by_cgroup(m, cgroup); | |||
460 | if (!u) | |||
461 | return sd_bus_error_setf(error, BUS_ERROR_NO_SUCH_UNIT"org.freedesktop.systemd1.NoSuchUnit", "Control group '%s' is not valid or not managed by this instance", cgroup); | |||
462 | ||||
463 | r = mac_selinux_unit_access_check(u, message, "status", error)mac_selinux_generic_access_check((message), unit_label_path(u ), ("status"), (error)); | |||
464 | if (r < 0) | |||
465 | return r; | |||
466 | ||||
467 | path = unit_dbus_path(u); | |||
468 | if (!path) | |||
469 | return -ENOMEM12; | |||
470 | ||||
471 | return sd_bus_reply_method_return(message, "o", path); | |||
472 | } | |||
473 | ||||
474 | static int method_load_unit(sd_bus_message *message, void *userdata, sd_bus_error *error) { | |||
475 | _cleanup_free___attribute__((cleanup(freep))) char *path = NULL((void*)0); | |||
476 | Manager *m = userdata; | |||
477 | const char *name; | |||
478 | Unit *u; | |||
479 | int r; | |||
480 | ||||
481 | assert(message)do { if ((__builtin_expect(!!(!(message)),0))) log_assert_failed_realm (LOG_REALM_SYSTEMD, ("message"), "../src/core/dbus-manager.c" , 481, __PRETTY_FUNCTION__); } while (0); | |||
482 | assert(m)do { if ((__builtin_expect(!!(!(m)),0))) log_assert_failed_realm (LOG_REALM_SYSTEMD, ("m"), "../src/core/dbus-manager.c", 482, __PRETTY_FUNCTION__); } while (0); | |||
483 | ||||
484 | /* Anyone can call this method */ | |||
485 | ||||
486 | r = sd_bus_message_read(message, "s", &name); | |||
487 | if (r < 0) | |||
488 | return r; | |||
489 | ||||
490 | r = bus_load_unit_by_name(m, message, name, &u, error); | |||
491 | if (r < 0) | |||
492 | return r; | |||
493 | ||||
494 | r = mac_selinux_unit_access_check(u, message, "status", error)mac_selinux_generic_access_check((message), unit_label_path(u ), ("status"), (error)); | |||
495 | if (r < 0) | |||
496 | return r; | |||
497 | ||||
498 | path = unit_dbus_path(u); | |||
499 | if (!path) | |||
500 | return -ENOMEM12; | |||
501 | ||||
502 | return sd_bus_reply_method_return(message, "o", path); | |||
503 | } | |||
504 | ||||
505 | static int method_start_unit_generic(sd_bus_message *message, Manager *m, JobType job_type, bool_Bool reload_if_possible, sd_bus_error *error) { | |||
506 | const char *name; | |||
507 | Unit *u; | |||
508 | int r; | |||
509 | ||||
510 | assert(message)do { if ((__builtin_expect(!!(!(message)),0))) log_assert_failed_realm (LOG_REALM_SYSTEMD, ("message"), "../src/core/dbus-manager.c" , 510, __PRETTY_FUNCTION__); } while (0); | |||
511 | assert(m)do { if ((__builtin_expect(!!(!(m)),0))) log_assert_failed_realm (LOG_REALM_SYSTEMD, ("m"), "../src/core/dbus-manager.c", 511, __PRETTY_FUNCTION__); } while (0); | |||
512 | ||||
513 | r = sd_bus_message_read(message, "s", &name); | |||
514 | if (r < 0) | |||
515 | return r; | |||
516 | ||||
517 | r = manager_load_unit(m, name, NULL((void*)0), error, &u); | |||
518 | if (r < 0) | |||
519 | return r; | |||
520 | ||||
521 | return bus_unit_method_start_generic(message, u, job_type, reload_if_possible, error); | |||
522 | } | |||
523 | ||||
524 | static int method_start_unit(sd_bus_message *message, void *userdata, sd_bus_error *error) { | |||
525 | return method_start_unit_generic(message, userdata, JOB_START, false0, error); | |||
526 | } | |||
527 | ||||
528 | static int method_stop_unit(sd_bus_message *message, void *userdata, sd_bus_error *error) { | |||
529 | return method_start_unit_generic(message, userdata, JOB_STOP, false0, error); | |||
530 | } | |||
531 | ||||
532 | static int method_reload_unit(sd_bus_message *message, void *userdata, sd_bus_error *error) { | |||
533 | return method_start_unit_generic(message, userdata, JOB_RELOAD, false0, error); | |||
534 | } | |||
535 | ||||
536 | static int method_restart_unit(sd_bus_message *message, void *userdata, sd_bus_error *error) { | |||
537 | return method_start_unit_generic(message, userdata, JOB_RESTART, false0, error); | |||
538 | } | |||
539 | ||||
540 | static int method_try_restart_unit(sd_bus_message *message, void *userdata, sd_bus_error *error) { | |||
541 | return method_start_unit_generic(message, userdata, JOB_TRY_RESTART, false0, error); | |||
542 | } | |||
543 | ||||
544 | static int method_reload_or_restart_unit(sd_bus_message *message, void *userdata, sd_bus_error *error) { | |||
545 | return method_start_unit_generic(message, userdata, JOB_RESTART, true1, error); | |||
546 | } | |||
547 | ||||
548 | static int method_reload_or_try_restart_unit(sd_bus_message *message, void *userdata, sd_bus_error *error) { | |||
549 | return method_start_unit_generic(message, userdata, JOB_TRY_RESTART, true1, error); | |||
550 | } | |||
551 | ||||
552 | static int method_enqueue_unit_job(sd_bus_message *message, void *userdata, sd_bus_error *error) { | |||
553 | Manager *m = userdata; | |||
554 | const char *name; | |||
555 | Unit *u; | |||
556 | int r; | |||
557 | ||||
558 | assert(message)do { if ((__builtin_expect(!!(!(message)),0))) log_assert_failed_realm (LOG_REALM_SYSTEMD, ("message"), "../src/core/dbus-manager.c" , 558, __PRETTY_FUNCTION__); } while (0); | |||
559 | assert(m)do { if ((__builtin_expect(!!(!(m)),0))) log_assert_failed_realm (LOG_REALM_SYSTEMD, ("m"), "../src/core/dbus-manager.c", 559, __PRETTY_FUNCTION__); } while (0); | |||
560 | ||||
561 | r = sd_bus_message_read(message, "s", &name); | |||
562 | if (r < 0) | |||
563 | return r; | |||
564 | ||||
565 | r = manager_load_unit(m, name, NULL((void*)0), error, &u); | |||
566 | if (r < 0) | |||
567 | return r; | |||
568 | ||||
569 | return bus_unit_method_enqueue_job(message, u, error); | |||
570 | } | |||
571 | ||||
572 | static int method_start_unit_replace(sd_bus_message *message, void *userdata, sd_bus_error *error) { | |||
573 | Manager *m = userdata; | |||
574 | const char *old_name; | |||
575 | Unit *u; | |||
576 | int r; | |||
577 | ||||
578 | assert(message)do { if ((__builtin_expect(!!(!(message)),0))) log_assert_failed_realm (LOG_REALM_SYSTEMD, ("message"), "../src/core/dbus-manager.c" , 578, __PRETTY_FUNCTION__); } while (0); | |||
579 | assert(m)do { if ((__builtin_expect(!!(!(m)),0))) log_assert_failed_realm (LOG_REALM_SYSTEMD, ("m"), "../src/core/dbus-manager.c", 579, __PRETTY_FUNCTION__); } while (0); | |||
580 | ||||
581 | r = sd_bus_message_read(message, "s", &old_name); | |||
582 | if (r < 0) | |||
583 | return r; | |||
584 | ||||
585 | r = bus_get_unit_by_name(m, message, old_name, &u, error); | |||
586 | if (r < 0) | |||
587 | return r; | |||
588 | if (!u->job || u->job->type != JOB_START) | |||
589 | return sd_bus_error_setf(error, BUS_ERROR_NO_SUCH_JOB"org.freedesktop.systemd1.NoSuchJob", "No job queued for unit %s", old_name); | |||
590 | ||||
591 | return method_start_unit_generic(message, m, JOB_START, false0, error); | |||
592 | } | |||
593 | ||||
594 | static int method_kill_unit(sd_bus_message *message, void *userdata, sd_bus_error *error) { | |||
595 | Manager *m = userdata; | |||
596 | const char *name; | |||
597 | Unit *u; | |||
598 | int r; | |||
599 | ||||
600 | assert(message)do { if ((__builtin_expect(!!(!(message)),0))) log_assert_failed_realm (LOG_REALM_SYSTEMD, ("message"), "../src/core/dbus-manager.c" , 600, __PRETTY_FUNCTION__); } while (0); | |||
601 | assert(m)do { if ((__builtin_expect(!!(!(m)),0))) log_assert_failed_realm (LOG_REALM_SYSTEMD, ("m"), "../src/core/dbus-manager.c", 601, __PRETTY_FUNCTION__); } while (0); | |||
602 | ||||
603 | r = sd_bus_message_read(message, "s", &name); | |||
604 | if (r < 0) | |||
605 | return r; | |||
606 | ||||
607 | r = bus_get_unit_by_name(m, message, name, &u, error); | |||
608 | if (r < 0) | |||
609 | return r; | |||
610 | ||||
611 | return bus_unit_method_kill(message, u, error); | |||
612 | } | |||
613 | ||||
614 | static int method_reset_failed_unit(sd_bus_message *message, void *userdata, sd_bus_error *error) { | |||
615 | Manager *m = userdata; | |||
616 | const char *name; | |||
617 | Unit *u; | |||
618 | int r; | |||
619 | ||||
620 | assert(message)do { if ((__builtin_expect(!!(!(message)),0))) log_assert_failed_realm (LOG_REALM_SYSTEMD, ("message"), "../src/core/dbus-manager.c" , 620, __PRETTY_FUNCTION__); } while (0); | |||
621 | assert(m)do { if ((__builtin_expect(!!(!(m)),0))) log_assert_failed_realm (LOG_REALM_SYSTEMD, ("m"), "../src/core/dbus-manager.c", 621, __PRETTY_FUNCTION__); } while (0); | |||
622 | ||||
623 | r = sd_bus_message_read(message, "s", &name); | |||
624 | if (r < 0) | |||
625 | return r; | |||
626 | ||||
627 | r = bus_get_unit_by_name(m, message, name, &u, error); | |||
628 | if (r < 0) | |||
629 | return r; | |||
630 | ||||
631 | return bus_unit_method_reset_failed(message, u, error); | |||
632 | } | |||
633 | ||||
634 | static int method_set_unit_properties(sd_bus_message *message, void *userdata, sd_bus_error *error) { | |||
635 | Manager *m = userdata; | |||
636 | const char *name; | |||
637 | Unit *u; | |||
638 | int r; | |||
639 | ||||
640 | assert(message)do { if ((__builtin_expect(!!(!(message)),0))) log_assert_failed_realm (LOG_REALM_SYSTEMD, ("message"), "../src/core/dbus-manager.c" , 640, __PRETTY_FUNCTION__); } while (0); | |||
641 | assert(m)do { if ((__builtin_expect(!!(!(m)),0))) log_assert_failed_realm (LOG_REALM_SYSTEMD, ("m"), "../src/core/dbus-manager.c", 641, __PRETTY_FUNCTION__); } while (0); | |||
642 | ||||
643 | r = sd_bus_message_read(message, "s", &name); | |||
644 | if (r < 0) | |||
645 | return r; | |||
646 | ||||
647 | r = bus_load_unit_by_name(m, message, name, &u, error); | |||
648 | if (r < 0) | |||
649 | return r; | |||
650 | ||||
651 | r = bus_unit_validate_load_state(u, error); | |||
652 | if (r < 0) | |||
653 | return r; | |||
654 | ||||
655 | return bus_unit_method_set_properties(message, u, error); | |||
656 | } | |||
657 | ||||
658 | static int method_ref_unit(sd_bus_message *message, void *userdata, sd_bus_error *error) { | |||
659 | Manager *m = userdata; | |||
660 | const char *name; | |||
661 | Unit *u; | |||
662 | int r; | |||
663 | ||||
664 | assert(message)do { if ((__builtin_expect(!!(!(message)),0))) log_assert_failed_realm (LOG_REALM_SYSTEMD, ("message"), "../src/core/dbus-manager.c" , 664, __PRETTY_FUNCTION__); } while (0); | |||
665 | assert(m)do { if ((__builtin_expect(!!(!(m)),0))) log_assert_failed_realm (LOG_REALM_SYSTEMD, ("m"), "../src/core/dbus-manager.c", 665, __PRETTY_FUNCTION__); } while (0); | |||
666 | ||||
667 | r = sd_bus_message_read(message, "s", &name); | |||
668 | if (r < 0) | |||
669 | return r; | |||
670 | ||||
671 | r = bus_load_unit_by_name(m, message, name, &u, error); | |||
672 | if (r < 0) | |||
673 | return r; | |||
674 | ||||
675 | r = bus_unit_validate_load_state(u, error); | |||
676 | if (r < 0) | |||
677 | return r; | |||
678 | ||||
679 | return bus_unit_method_ref(message, u, error); | |||
680 | } | |||
681 | ||||
682 | static int method_unref_unit(sd_bus_message *message, void *userdata, sd_bus_error *error) { | |||
683 | Manager *m = userdata; | |||
684 | const char *name; | |||
685 | Unit *u; | |||
686 | int r; | |||
687 | ||||
688 | assert(message)do { if ((__builtin_expect(!!(!(message)),0))) log_assert_failed_realm (LOG_REALM_SYSTEMD, ("message"), "../src/core/dbus-manager.c" , 688, __PRETTY_FUNCTION__); } while (0); | |||
689 | assert(m)do { if ((__builtin_expect(!!(!(m)),0))) log_assert_failed_realm (LOG_REALM_SYSTEMD, ("m"), "../src/core/dbus-manager.c", 689, __PRETTY_FUNCTION__); } while (0); | |||
690 | ||||
691 | r = sd_bus_message_read(message, "s", &name); | |||
692 | if (r < 0) | |||
693 | return r; | |||
694 | ||||
695 | r = bus_load_unit_by_name(m, message, name, &u, error); | |||
696 | if (r < 0) | |||
697 | return r; | |||
698 | ||||
699 | r = bus_unit_validate_load_state(u, error); | |||
700 | if (r < 0) | |||
701 | return r; | |||
702 | ||||
703 | return bus_unit_method_unref(message, u, error); | |||
704 | } | |||
705 | ||||
706 | static int method_freeze_unit(sd_bus_message *message, void *userdata, sd_bus_error *error) { | |||
707 | Manager *m = userdata; | |||
708 | const char *name; | |||
709 | Unit *u; | |||
710 | int r; | |||
711 | ||||
712 | assert(message)do { if ((__builtin_expect(!!(!(message)),0))) log_assert_failed_realm (LOG_REALM_SYSTEMD, ("message"), "../src/core/dbus-manager.c" , 712, __PRETTY_FUNCTION__); } while (0); | |||
713 | assert(m)do { if ((__builtin_expect(!!(!(m)),0))) log_assert_failed_realm (LOG_REALM_SYSTEMD, ("m"), "../src/core/dbus-manager.c", 713, __PRETTY_FUNCTION__); } while (0); | |||
714 | ||||
715 | r = sd_bus_message_read(message, "s", &name); | |||
716 | if (r < 0) | |||
717 | return r; | |||
718 | ||||
719 | r = bus_load_unit_by_name(m, message, name, &u, error); | |||
720 | if (r < 0) | |||
721 | return r; | |||
722 | ||||
723 | r = bus_unit_validate_load_state(u, error); | |||
724 | if (r < 0) | |||
725 | return r; | |||
726 | ||||
727 | return bus_unit_method_freeze(message, u, error); | |||
728 | } | |||
729 | ||||
730 | static int method_thaw_unit(sd_bus_message *message, void *userdata, sd_bus_error *error) { | |||
731 | Manager *m = userdata; | |||
732 | const char *name; | |||
733 | Unit *u; | |||
734 | int r; | |||
735 | ||||
736 | assert(message)do { if ((__builtin_expect(!!(!(message)),0))) log_assert_failed_realm (LOG_REALM_SYSTEMD, ("message"), "../src/core/dbus-manager.c" , 736, __PRETTY_FUNCTION__); } while (0); | |||
737 | assert(m)do { if ((__builtin_expect(!!(!(m)),0))) log_assert_failed_realm (LOG_REALM_SYSTEMD, ("m"), "../src/core/dbus-manager.c", 737, __PRETTY_FUNCTION__); } while (0); | |||
738 | ||||
739 | r = sd_bus_message_read(message, "s", &name); | |||
740 | if (r < 0) | |||
741 | return r; | |||
742 | ||||
743 | r = bus_load_unit_by_name(m, message, name, &u, error); | |||
744 | if (r < 0) | |||
745 | return r; | |||
746 | ||||
747 | r = bus_unit_validate_load_state(u, error); | |||
748 | if (r < 0) | |||
749 | return r; | |||
750 | ||||
751 | return bus_unit_method_thaw(message, u, error); | |||
752 | } | |||
753 | ||||
754 | static int reply_unit_info(sd_bus_message *reply, Unit *u) { | |||
755 | _cleanup_free___attribute__((cleanup(freep))) char *unit_path = NULL((void*)0), *job_path = NULL((void*)0); | |||
756 | Unit *following; | |||
757 | ||||
758 | following = unit_following(u); | |||
759 | ||||
760 | unit_path = unit_dbus_path(u); | |||
761 | if (!unit_path) | |||
762 | return -ENOMEM12; | |||
763 | ||||
764 | if (u->job) { | |||
765 | job_path = job_dbus_path(u->job); | |||
766 | if (!job_path) | |||
767 | return -ENOMEM12; | |||
768 | } | |||
769 | ||||
770 | return sd_bus_message_append( | |||
771 | reply, "(ssssssouso)", | |||
772 | u->id, | |||
773 | unit_description(u), | |||
774 | unit_load_state_to_string(u->load_state), | |||
775 | unit_active_state_to_string(unit_active_state(u)), | |||
776 | unit_sub_state_to_string(u), | |||
777 | following ? following->id : "", | |||
778 | unit_path, | |||
779 | u->job ? u->job->id : 0, | |||
780 | u->job ? job_type_to_string(u->job->type) : "", | |||
781 | job_path ? job_path : "/"); | |||
782 | } | |||
783 | ||||
784 | static int method_list_units_by_names(sd_bus_message *message, void *userdata, sd_bus_error *error) { | |||
785 | _cleanup_(sd_bus_message_unrefp)__attribute__((cleanup(sd_bus_message_unrefp))) sd_bus_message *reply = NULL((void*)0); | |||
786 | Manager *m = userdata; | |||
787 | int r; | |||
788 | char **unit; | |||
789 | _cleanup_strv_free___attribute__((cleanup(strv_freep))) char **units = NULL((void*)0); | |||
790 | ||||
791 | assert(message)do { if ((__builtin_expect(!!(!(message)),0))) log_assert_failed_realm (LOG_REALM_SYSTEMD, ("message"), "../src/core/dbus-manager.c" , 791, __PRETTY_FUNCTION__); } while (0); | |||
| ||||
792 | assert(m)do { if ((__builtin_expect(!!(!(m)),0))) log_assert_failed_realm (LOG_REALM_SYSTEMD, ("m"), "../src/core/dbus-manager.c", 792, __PRETTY_FUNCTION__); } while (0); | |||
793 | ||||
794 | r = sd_bus_message_read_strv(message, &units); | |||
795 | if (r < 0) | |||
796 | return r; | |||
797 | ||||
798 | r = sd_bus_message_new_method_return(message, &reply); | |||
799 | if (r < 0) | |||
800 | return r; | |||
801 | ||||
802 | r = sd_bus_message_open_container(reply, 'a', "(ssssssouso)"); | |||
803 | if (r < 0) | |||
804 | return r; | |||
805 | ||||
806 | STRV_FOREACH(unit, units)for ((unit) = (units); (unit) && *(unit); (unit)++) { | |||
807 | Unit *u; | |||
808 | ||||
809 | if (!unit_name_is_valid(*unit, UNIT_NAME_ANY)) | |||
810 | continue; | |||
811 | ||||
812 | r = bus_load_unit_by_name(m, message, *unit, &u, error); | |||
813 | if (r < 0) | |||
814 | return r; | |||
815 | ||||
816 | r = reply_unit_info(reply, u); | |||
| ||||
817 | if (r < 0) | |||
818 | return r; | |||
819 | } | |||
820 | ||||
821 | r = sd_bus_message_close_container(reply); | |||
822 | if (r < 0) | |||
823 | return r; | |||
824 | ||||
825 | return sd_bus_send(NULL((void*)0), reply, NULL((void*)0)); | |||
826 | } | |||
827 | ||||
828 | static int method_get_unit_processes(sd_bus_message *message, void *userdata, sd_bus_error *error) { | |||
829 | Manager *m = userdata; | |||
830 | const char *name; | |||
831 | Unit *u; | |||
832 | int r; | |||
833 | ||||
834 | assert(message)do { if ((__builtin_expect(!!(!(message)),0))) log_assert_failed_realm (LOG_REALM_SYSTEMD, ("message"), "../src/core/dbus-manager.c" , 834, __PRETTY_FUNCTION__); } while (0); | |||
835 | assert(m)do { if ((__builtin_expect(!!(!(m)),0))) log_assert_failed_realm (LOG_REALM_SYSTEMD, ("m"), "../src/core/dbus-manager.c", 835, __PRETTY_FUNCTION__); } while (0); | |||
836 | ||||
837 | r = sd_bus_message_read(message, "s", &name); | |||
838 | if (r < 0) | |||
839 | return r; | |||
840 | ||||
841 | r = bus_get_unit_by_name(m, message, name, &u, error); | |||
842 | if (r < 0) | |||
843 | return r; | |||
844 | ||||
845 | return bus_unit_method_get_processes(message, u, error); | |||
846 | } | |||
847 | ||||
848 | static int method_attach_processes_to_unit(sd_bus_message *message, void *userdata, sd_bus_error *error) { | |||
849 | Manager *m = userdata; | |||
850 | const char *name; | |||
851 | Unit *u; | |||
852 | int r; | |||
853 | ||||
854 | assert(message)do { if ((__builtin_expect(!!(!(message)),0))) log_assert_failed_realm (LOG_REALM_SYSTEMD, ("message"), "../src/core/dbus-manager.c" , 854, __PRETTY_FUNCTION__); } while (0); | |||
855 | assert(m)do { if ((__builtin_expect(!!(!(m)),0))) log_assert_failed_realm (LOG_REALM_SYSTEMD, ("m"), "../src/core/dbus-manager.c", 855, __PRETTY_FUNCTION__); } while (0); | |||
856 | ||||
857 | r = sd_bus_message_read(message, "s", &name); | |||
858 | if (r < 0) | |||
859 | return r; | |||
860 | ||||
861 | r = bus_get_unit_by_name(m, message, name, &u, error); | |||
862 | if (r < 0) | |||
863 | return r; | |||
864 | ||||
865 | return bus_unit_method_attach_processes(message, u, error); | |||
866 | } | |||
867 | ||||
868 | static int transient_unit_from_message( | |||
869 | Manager *m, | |||
870 | sd_bus_message *message, | |||
871 | const char *name, | |||
872 | Unit **unit, | |||
873 | sd_bus_error *error) { | |||
874 | ||||
875 | UnitType t; | |||
876 | Unit *u; | |||
877 | int r; | |||
878 | ||||
879 | assert(m)do { if ((__builtin_expect(!!(!(m)),0))) log_assert_failed_realm (LOG_REALM_SYSTEMD, ("m"), "../src/core/dbus-manager.c", 879, __PRETTY_FUNCTION__); } while (0); | |||
880 | assert(message)do { if ((__builtin_expect(!!(!(message)),0))) log_assert_failed_realm (LOG_REALM_SYSTEMD, ("message"), "../src/core/dbus-manager.c" , 880, __PRETTY_FUNCTION__); } while (0); | |||
881 | assert(name)do { if ((__builtin_expect(!!(!(name)),0))) log_assert_failed_realm (LOG_REALM_SYSTEMD, ("name"), "../src/core/dbus-manager.c", 881 , __PRETTY_FUNCTION__); } while (0); | |||
882 | ||||
883 | t = unit_name_to_type(name); | |||
884 | if (t < 0) | |||
885 | return sd_bus_error_setf(error, SD_BUS_ERROR_INVALID_ARGS"org.freedesktop.DBus.Error.InvalidArgs", "Invalid unit name or type."); | |||
886 | ||||
887 | if (!unit_vtable[t]->can_transient) | |||
888 | return sd_bus_error_setf(error, SD_BUS_ERROR_INVALID_ARGS"org.freedesktop.DBus.Error.InvalidArgs", "Unit type %s does not support transient units.", unit_type_to_string(t)); | |||
889 | ||||
890 | r = manager_load_unit(m, name, NULL((void*)0), error, &u); | |||
891 | if (r < 0) | |||
892 | return r; | |||
893 | ||||
894 | if (!unit_is_pristine(u)) | |||
895 | return sd_bus_error_setf(error, BUS_ERROR_UNIT_EXISTS"org.freedesktop.systemd1.UnitExists", "Unit %s already exists.", name); | |||
896 | ||||
897 | /* OK, the unit failed to load and is unreferenced, now let's | |||
898 | * fill in the transient data instead */ | |||
899 | r = unit_make_transient(u); | |||
900 | if (r < 0) | |||
901 | return r; | |||
902 | ||||
903 | /* Set our properties */ | |||
904 | r = bus_unit_set_properties(u, message, UNIT_RUNTIME, false0, error); | |||
905 | if (r < 0) | |||
906 | return r; | |||
907 | ||||
908 | /* If the client asked for it, automatically add a reference to this unit. */ | |||
909 | if (u->bus_track_add) { | |||
910 | r = bus_unit_track_add_sender(u, message); | |||
911 | if (r < 0) | |||
912 | return log_error_errno(r, "Failed to watch sender: %m")({ int _level = ((3)), _e = ((r)), _realm = (LOG_REALM_SYSTEMD ); (log_get_max_level_realm(_realm) >= ((_level) & 0x07 )) ? log_internal_realm(((_realm) << 10 | (_level)), _e , "../src/core/dbus-manager.c", 912, __func__, "Failed to watch sender: %m" ) : -abs(_e); }); | |||
913 | } | |||
914 | ||||
915 | /* Now load the missing bits of the unit we just created */ | |||
916 | unit_add_to_load_queue(u); | |||
917 | manager_dispatch_load_queue(m); | |||
918 | ||||
919 | *unit = u; | |||
920 | ||||
921 | return 0; | |||
922 | } | |||
923 | ||||
924 | static int transient_aux_units_from_message( | |||
925 | Manager *m, | |||
926 | sd_bus_message *message, | |||
927 | sd_bus_error *error) { | |||
928 | ||||
929 | int r; | |||
930 | ||||
931 | assert(m)do { if ((__builtin_expect(!!(!(m)),0))) log_assert_failed_realm (LOG_REALM_SYSTEMD, ("m"), "../src/core/dbus-manager.c", 931, __PRETTY_FUNCTION__); } while (0); | |||
932 | assert(message)do { if ((__builtin_expect(!!(!(message)),0))) log_assert_failed_realm (LOG_REALM_SYSTEMD, ("message"), "../src/core/dbus-manager.c" , 932, __PRETTY_FUNCTION__); } while (0); | |||
933 | ||||
934 | r = sd_bus_message_enter_container(message, 'a', "(sa(sv))"); | |||
935 | if (r < 0) | |||
936 | return r; | |||
937 | ||||
938 | while ((r = sd_bus_message_enter_container(message, 'r', "sa(sv)")) > 0) { | |||
939 | const char *name = NULL((void*)0); | |||
940 | Unit *u; | |||
941 | ||||
942 | r = sd_bus_message_read(message, "s", &name); | |||
943 | if (r < 0) | |||
944 | return r; | |||
945 | ||||
946 | r = transient_unit_from_message(m, message, name, &u, error); | |||
947 | if (r < 0) | |||
948 | return r; | |||
949 | ||||
950 | r = sd_bus_message_exit_container(message); | |||
951 | if (r < 0) | |||
952 | return r; | |||
953 | } | |||
954 | if (r < 0) | |||
955 | return r; | |||
956 | ||||
957 | r = sd_bus_message_exit_container(message); | |||
958 | if (r < 0) | |||
959 | return r; | |||
960 | ||||
961 | return 0; | |||
962 | } | |||
963 | ||||
964 | static int method_start_transient_unit(sd_bus_message *message, void *userdata, sd_bus_error *error) { | |||
965 | const char *name, *smode; | |||
966 | Manager *m = userdata; | |||
967 | JobMode mode; | |||
968 | Unit *u; | |||
969 | int r; | |||
970 | ||||
971 | assert(message)do { if ((__builtin_expect(!!(!(message)),0))) log_assert_failed_realm (LOG_REALM_SYSTEMD, ("message"), "../src/core/dbus-manager.c" , 971, __PRETTY_FUNCTION__); } while (0); | |||
972 | assert(m)do { if ((__builtin_expect(!!(!(m)),0))) log_assert_failed_realm (LOG_REALM_SYSTEMD, ("m"), "../src/core/dbus-manager.c", 972, __PRETTY_FUNCTION__); } while (0); | |||
973 | ||||
974 | r = mac_selinux_access_check(message, "start", error)mac_selinux_generic_access_check((message), ((void*)0), ("start" ), (error)); | |||
975 | if (r < 0) | |||
976 | return r; | |||
977 | ||||
978 | r = sd_bus_message_read(message, "ss", &name, &smode); | |||
979 | if (r < 0) | |||
980 | return r; | |||
981 | ||||
982 | mode = job_mode_from_string(smode); | |||
983 | if (mode < 0) | |||
984 | return sd_bus_error_setf(error, SD_BUS_ERROR_INVALID_ARGS"org.freedesktop.DBus.Error.InvalidArgs", "Job mode %s is invalid.", smode); | |||
985 | ||||
986 | r = bus_verify_manage_units_async(m, message, error); | |||
987 | if (r < 0) | |||
988 | return r; | |||
989 | if (r == 0) | |||
990 | return 1; /* No authorization for now, but the async polkit stuff will call us again when it has it */ | |||
991 | ||||
992 | r = transient_unit_from_message(m, message, name, &u, error); | |||
993 | if (r < 0) | |||
994 | return r; | |||
995 | ||||
996 | r = transient_aux_units_from_message(m, message, error); | |||
997 | if (r < 0) | |||
998 | return r; | |||
999 | ||||
1000 | /* Finally, start it */ | |||
1001 | return bus_unit_queue_job(message, u, JOB_START, mode, 0, error); | |||
1002 | } | |||
1003 | ||||
1004 | static int method_get_job(sd_bus_message *message, void *userdata, sd_bus_error *error) { | |||
1005 | _cleanup_free___attribute__((cleanup(freep))) char *path = NULL((void*)0); | |||
1006 | Manager *m = userdata; | |||
1007 | uint32_t id; | |||
1008 | Job *j; | |||
1009 | int r; | |||
1010 | ||||
1011 | assert(message)do { if ((__builtin_expect(!!(!(message)),0))) log_assert_failed_realm (LOG_REALM_SYSTEMD, ("message"), "../src/core/dbus-manager.c" , 1011, __PRETTY_FUNCTION__); } while (0); | |||
1012 | assert(m)do { if ((__builtin_expect(!!(!(m)),0))) log_assert_failed_realm (LOG_REALM_SYSTEMD, ("m"), "../src/core/dbus-manager.c", 1012 , __PRETTY_FUNCTION__); } while (0); | |||
1013 | ||||
1014 | /* Anyone can call this method */ | |||
1015 | ||||
1016 | r = sd_bus_message_read(message, "u", &id); | |||
1017 | if (r < 0) | |||
1018 | return r; | |||
1019 | ||||
1020 | j = manager_get_job(m, id); | |||
1021 | if (!j) | |||
1022 | return sd_bus_error_setf(error, BUS_ERROR_NO_SUCH_JOB"org.freedesktop.systemd1.NoSuchJob", "Job %u does not exist.", (unsigned) id); | |||
1023 | ||||
1024 | r = mac_selinux_unit_access_check(j->unit, message, "status", error)mac_selinux_generic_access_check((message), unit_label_path(j ->unit), ("status"), (error)); | |||
1025 | if (r < 0) | |||
1026 | return r; | |||
1027 | ||||
1028 | path = job_dbus_path(j); | |||
1029 | if (!path) | |||
1030 | return -ENOMEM12; | |||
1031 | ||||
1032 | return sd_bus_reply_method_return(message, "o", path); | |||
1033 | } | |||
1034 | ||||
1035 | static int method_cancel_job(sd_bus_message *message, void *userdata, sd_bus_error *error) { | |||
1036 | Manager *m = userdata; | |||
1037 | uint32_t id; | |||
1038 | Job *j; | |||
1039 | int r; | |||
1040 | ||||
1041 | assert(message)do { if ((__builtin_expect(!!(!(message)),0))) log_assert_failed_realm (LOG_REALM_SYSTEMD, ("message"), "../src/core/dbus-manager.c" , 1041, __PRETTY_FUNCTION__); } while (0); | |||
1042 | assert(m)do { if ((__builtin_expect(!!(!(m)),0))) log_assert_failed_realm (LOG_REALM_SYSTEMD, ("m"), "../src/core/dbus-manager.c", 1042 , __PRETTY_FUNCTION__); } while (0); | |||
1043 | ||||
1044 | r = sd_bus_message_read(message, "u", &id); | |||
1045 | if (r < 0) | |||
1046 | return r; | |||
1047 | ||||
1048 | j = manager_get_job(m, id); | |||
1049 | if (!j) | |||
1050 | return sd_bus_error_setf(error, BUS_ERROR_NO_SUCH_JOB"org.freedesktop.systemd1.NoSuchJob", "Job %u does not exist.", (unsigned) id); | |||
1051 | ||||
1052 | return bus_job_method_cancel(message, j, error); | |||
1053 | } | |||
1054 | ||||
1055 | static int method_clear_jobs(sd_bus_message *message, void *userdata, sd_bus_error *error) { | |||
1056 | Manager *m = userdata; | |||
1057 | int r; | |||
1058 | ||||
1059 | assert(message)do { if ((__builtin_expect(!!(!(message)),0))) log_assert_failed_realm (LOG_REALM_SYSTEMD, ("message"), "../src/core/dbus-manager.c" , 1059, __PRETTY_FUNCTION__); } while (0); | |||
1060 | assert(m)do { if ((__builtin_expect(!!(!(m)),0))) log_assert_failed_realm (LOG_REALM_SYSTEMD, ("m"), "../src/core/dbus-manager.c", 1060 , __PRETTY_FUNCTION__); } while (0); | |||
1061 | ||||
1062 | r = mac_selinux_access_check(message, "reload", error)mac_selinux_generic_access_check((message), ((void*)0), ("reload" ), (error)); | |||
1063 | if (r < 0) | |||
1064 | return r; | |||
1065 | ||||
1066 | r = bus_verify_manage_units_async(m, message, error); | |||
1067 | if (r < 0) | |||
1068 | return r; | |||
1069 | if (r == 0) | |||
1070 | return 1; /* No authorization for now, but the async polkit stuff will call us again when it has it */ | |||
1071 | ||||
1072 | manager_clear_jobs(m); | |||
1073 | ||||
1074 | return sd_bus_reply_method_return(message, NULL((void*)0)); | |||
1075 | } | |||
1076 | ||||
1077 | static int method_reset_failed(sd_bus_message *message, void *userdata, sd_bus_error *error) { | |||
1078 | Manager *m = userdata; | |||
1079 | int r; | |||
1080 | ||||
1081 | assert(message)do { if ((__builtin_expect(!!(!(message)),0))) log_assert_failed_realm (LOG_REALM_SYSTEMD, ("message"), "../src/core/dbus-manager.c" , 1081, __PRETTY_FUNCTION__); } while (0); | |||
1082 | assert(m)do { if ((__builtin_expect(!!(!(m)),0))) log_assert_failed_realm (LOG_REALM_SYSTEMD, ("m"), "../src/core/dbus-manager.c", 1082 , __PRETTY_FUNCTION__); } while (0); | |||
1083 | ||||
1084 | r = mac_selinux_access_check(message, "reload", error)mac_selinux_generic_access_check((message), ((void*)0), ("reload" ), (error)); | |||
1085 | if (r < 0) | |||
1086 | return r; | |||
1087 | ||||
1088 | r = bus_verify_manage_units_async(m, message, error); | |||
1089 | if (r < 0) | |||
1090 | return r; | |||
1091 | if (r == 0) | |||
1092 | return 1; /* No authorization for now, but the async polkit stuff will call us again when it has it */ | |||
1093 | ||||
1094 | manager_reset_failed(m); | |||
1095 | ||||
1096 | return sd_bus_reply_method_return(message, NULL((void*)0)); | |||
1097 | } | |||
1098 | ||||
1099 | static int list_units_filtered(sd_bus_message *message, void *userdata, sd_bus_error *error, char **states, char **patterns) { | |||
1100 | _cleanup_(sd_bus_message_unrefp)__attribute__((cleanup(sd_bus_message_unrefp))) sd_bus_message *reply = NULL((void*)0); | |||
1101 | Manager *m = userdata; | |||
1102 | const char *k; | |||
1103 | Iterator i; | |||
1104 | Unit *u; | |||
1105 | int r; | |||
1106 | ||||
1107 | assert(message)do { if ((__builtin_expect(!!(!(message)),0))) log_assert_failed_realm (LOG_REALM_SYSTEMD, ("message"), "../src/core/dbus-manager.c" , 1107, __PRETTY_FUNCTION__); } while (0); | |||
1108 | assert(m)do { if ((__builtin_expect(!!(!(m)),0))) log_assert_failed_realm (LOG_REALM_SYSTEMD, ("m"), "../src/core/dbus-manager.c", 1108 , __PRETTY_FUNCTION__); } while (0); | |||
1109 | ||||
1110 | /* Anyone can call this method */ | |||
1111 | ||||
1112 | r = mac_selinux_access_check(message, "status", error)mac_selinux_generic_access_check((message), ((void*)0), ("status" ), (error)); | |||
1113 | if (r < 0) | |||
1114 | return r; | |||
1115 | ||||
1116 | r = sd_bus_message_new_method_return(message, &reply); | |||
1117 | if (r < 0) | |||
1118 | return r; | |||
1119 | ||||
1120 | r = sd_bus_message_open_container(reply, 'a', "(ssssssouso)"); | |||
1121 | if (r < 0) | |||
1122 | return r; | |||
1123 | ||||
1124 | HASHMAP_FOREACH_KEY(u, k, m->units, i)for ((i) = ((Iterator) { .idx = ((2147483647 *2U +1U) - 1), . next_key = ((void*)0) }); hashmap_iterate((m->units), & (i), (void**)&(u), (const void**) &(k)); ) { | |||
1125 | if (k != u->id) | |||
1126 | continue; | |||
1127 | ||||
1128 | if (!strv_isempty(states) && | |||
1129 | !strv_contains(states, unit_load_state_to_string(u->load_state))(!!strv_find((states), (unit_load_state_to_string(u->load_state )))) && | |||
1130 | !strv_contains(states, unit_active_state_to_string(unit_active_state(u)))(!!strv_find((states), (unit_active_state_to_string(unit_active_state (u))))) && | |||
1131 | !strv_contains(states, unit_sub_state_to_string(u))(!!strv_find((states), (unit_sub_state_to_string(u))))) | |||
1132 | continue; | |||
1133 | ||||
1134 | if (!strv_isempty(patterns) && | |||
1135 | !strv_fnmatch_or_empty(patterns, u->id, FNM_NOESCAPE(1 << 1))) | |||
1136 | continue; | |||
1137 | ||||
1138 | r = reply_unit_info(reply, u); | |||
1139 | if (r < 0) | |||
1140 | return r; | |||
1141 | } | |||
1142 | ||||
1143 | r = sd_bus_message_close_container(reply); | |||
1144 | if (r < 0) | |||
1145 | return r; | |||
1146 | ||||
1147 | return sd_bus_send(NULL((void*)0), reply, NULL((void*)0)); | |||
1148 | } | |||
1149 | ||||
1150 | static int method_list_units(sd_bus_message *message, void *userdata, sd_bus_error *error) { | |||
1151 | return list_units_filtered(message, userdata, error, NULL((void*)0), NULL((void*)0)); | |||
1152 | } | |||
1153 | ||||
1154 | static int method_list_units_filtered(sd_bus_message *message, void *userdata, sd_bus_error *error) { | |||
1155 | _cleanup_strv_free___attribute__((cleanup(strv_freep))) char **states = NULL((void*)0); | |||
1156 | int r; | |||
1157 | ||||
1158 | r = sd_bus_message_read_strv(message, &states); | |||
1159 | if (r < 0) | |||
1160 | return r; | |||
1161 | ||||
1162 | return list_units_filtered(message, userdata, error, states, NULL((void*)0)); | |||
1163 | } | |||
1164 | ||||
1165 | static int method_list_units_by_patterns(sd_bus_message *message, void *userdata, sd_bus_error *error) { | |||
1166 | _cleanup_strv_free___attribute__((cleanup(strv_freep))) char **states = NULL((void*)0); | |||
1167 | _cleanup_strv_free___attribute__((cleanup(strv_freep))) char **patterns = NULL((void*)0); | |||
1168 | int r; | |||
1169 | ||||
1170 | r = sd_bus_message_read_strv(message, &states); | |||
1171 | if (r < 0) | |||
1172 | return r; | |||
1173 | ||||
1174 | r = sd_bus_message_read_strv(message, &patterns); | |||
1175 | if (r < 0) | |||
1176 | return r; | |||
1177 | ||||
1178 | return list_units_filtered(message, userdata, error, states, patterns); | |||
1179 | } | |||
1180 | ||||
1181 | static int method_list_jobs(sd_bus_message *message, void *userdata, sd_bus_error *error) { | |||
1182 | _cleanup_(sd_bus_message_unrefp)__attribute__((cleanup(sd_bus_message_unrefp))) sd_bus_message *reply = NULL((void*)0); | |||
1183 | Manager *m = userdata; | |||
1184 | Iterator i; | |||
1185 | Job *j; | |||
1186 | int r; | |||
1187 | ||||
1188 | assert(message)do { if ((__builtin_expect(!!(!(message)),0))) log_assert_failed_realm (LOG_REALM_SYSTEMD, ("message"), "../src/core/dbus-manager.c" , 1188, __PRETTY_FUNCTION__); } while (0); | |||
1189 | assert(m)do { if ((__builtin_expect(!!(!(m)),0))) log_assert_failed_realm (LOG_REALM_SYSTEMD, ("m"), "../src/core/dbus-manager.c", 1189 , __PRETTY_FUNCTION__); } while (0); | |||
1190 | ||||
1191 | /* Anyone can call this method */ | |||
1192 | ||||
1193 | r = mac_selinux_access_check(message, "status", error)mac_selinux_generic_access_check((message), ((void*)0), ("status" ), (error)); | |||
1194 | if (r < 0) | |||
1195 | return r; | |||
1196 | ||||
1197 | r = sd_bus_message_new_method_return(message, &reply); | |||
1198 | if (r < 0) | |||
1199 | return r; | |||
1200 | ||||
1201 | r = sd_bus_message_open_container(reply, 'a', "(usssoo)"); | |||
1202 | if (r < 0) | |||
1203 | return r; | |||
1204 | ||||
1205 | HASHMAP_FOREACH(j, m->jobs, i)for ((i) = ((Iterator) { .idx = ((2147483647 *2U +1U) - 1), . next_key = ((void*)0) }); hashmap_iterate((m->jobs), & (i), (void**)&(j), ((void*)0)); ) { | |||
1206 | _cleanup_free___attribute__((cleanup(freep))) char *unit_path = NULL((void*)0), *job_path = NULL((void*)0); | |||
1207 | ||||
1208 | job_path = job_dbus_path(j); | |||
1209 | if (!job_path) | |||
1210 | return -ENOMEM12; | |||
1211 | ||||
1212 | unit_path = unit_dbus_path(j->unit); | |||
1213 | if (!unit_path) | |||
1214 | return -ENOMEM12; | |||
1215 | ||||
1216 | r = sd_bus_message_append( | |||
1217 | reply, "(usssoo)", | |||
1218 | j->id, | |||
1219 | j->unit->id, | |||
1220 | job_type_to_string(j->type), | |||
1221 | job_state_to_string(j->state), | |||
1222 | job_path, | |||
1223 | unit_path); | |||
1224 | if (r < 0) | |||
1225 | return r; | |||
1226 | } | |||
1227 | ||||
1228 | r = sd_bus_message_close_container(reply); | |||
1229 | if (r < 0) | |||
1230 | return r; | |||
1231 | ||||
1232 | return sd_bus_send(NULL((void*)0), reply, NULL((void*)0)); | |||
1233 | } | |||
1234 | ||||
1235 | static int method_subscribe(sd_bus_message *message, void *userdata, sd_bus_error *error) { | |||
1236 | Manager *m = userdata; | |||
1237 | int r; | |||
1238 | ||||
1239 | assert(message)do { if ((__builtin_expect(!!(!(message)),0))) log_assert_failed_realm (LOG_REALM_SYSTEMD, ("message"), "../src/core/dbus-manager.c" , 1239, __PRETTY_FUNCTION__); } while (0); | |||
1240 | assert(m)do { if ((__builtin_expect(!!(!(m)),0))) log_assert_failed_realm (LOG_REALM_SYSTEMD, ("m"), "../src/core/dbus-manager.c", 1240 , __PRETTY_FUNCTION__); } while (0); | |||
1241 | ||||
1242 | /* Anyone can call this method */ | |||
1243 | ||||
1244 | r = mac_selinux_access_check(message, "status", error)mac_selinux_generic_access_check((message), ((void*)0), ("status" ), (error)); | |||
1245 | if (r < 0) | |||
1246 | return r; | |||
1247 | ||||
1248 | if (sd_bus_message_get_bus(message) == m->api_bus) { | |||
1249 | ||||
1250 | /* Note that direct bus connection subscribe by | |||
1251 | * default, we only track peers on the API bus here */ | |||
1252 | ||||
1253 | if (!m->subscribed) { | |||
1254 | r = sd_bus_track_new(sd_bus_message_get_bus(message), &m->subscribed, NULL((void*)0), NULL((void*)0)); | |||
1255 | if (r < 0) | |||
1256 | return r; | |||
1257 | } | |||
1258 | ||||
1259 | r = sd_bus_track_add_sender(m->subscribed, message); | |||
1260 | if (r < 0) | |||
1261 | return r; | |||
1262 | if (r == 0) | |||
1263 | return sd_bus_error_setf(error, BUS_ERROR_ALREADY_SUBSCRIBED"org.freedesktop.systemd1.AlreadySubscribed", "Client is already subscribed."); | |||
1264 | } | |||
1265 | ||||
1266 | return sd_bus_reply_method_return(message, NULL((void*)0)); | |||
1267 | } | |||
1268 | ||||
1269 | static int method_unsubscribe(sd_bus_message *message, void *userdata, sd_bus_error *error) { | |||
1270 | Manager *m = userdata; | |||
1271 | int r; | |||
1272 | ||||
1273 | assert(message)do { if ((__builtin_expect(!!(!(message)),0))) log_assert_failed_realm (LOG_REALM_SYSTEMD, ("message"), "../src/core/dbus-manager.c" , 1273, __PRETTY_FUNCTION__); } while (0); | |||
1274 | assert(m)do { if ((__builtin_expect(!!(!(m)),0))) log_assert_failed_realm (LOG_REALM_SYSTEMD, ("m"), "../src/core/dbus-manager.c", 1274 , __PRETTY_FUNCTION__); } while (0); | |||
1275 | ||||
1276 | /* Anyone can call this method */ | |||
1277 | ||||
1278 | r = mac_selinux_access_check(message, "status", error)mac_selinux_generic_access_check((message), ((void*)0), ("status" ), (error)); | |||
1279 | if (r < 0) | |||
1280 | return r; | |||
1281 | ||||
1282 | if (sd_bus_message_get_bus(message) == m->api_bus) { | |||
1283 | r = sd_bus_track_remove_sender(m->subscribed, message); | |||
1284 | if (r < 0) | |||
1285 | return r; | |||
1286 | if (r == 0) | |||
1287 | return sd_bus_error_setf(error, BUS_ERROR_NOT_SUBSCRIBED"org.freedesktop.systemd1.NotSubscribed", "Client is not subscribed."); | |||
1288 | } | |||
1289 | ||||
1290 | return sd_bus_reply_method_return(message, NULL((void*)0)); | |||
1291 | } | |||
1292 | ||||
1293 | static int dump_impl(sd_bus_message *message, void *userdata, sd_bus_error *error, int (*reply)(sd_bus_message *, char *)) { | |||
1294 | _cleanup_free___attribute__((cleanup(freep))) char *dump = NULL((void*)0); | |||
1295 | Manager *m = userdata; | |||
1296 | int r; | |||
1297 | ||||
1298 | assert(message)do { if ((__builtin_expect(!!(!(message)),0))) log_assert_failed_realm (LOG_REALM_SYSTEMD, ("message"), "../src/core/dbus-manager.c" , 1298, __PRETTY_FUNCTION__); } while (0); | |||
1299 | assert(m)do { if ((__builtin_expect(!!(!(m)),0))) log_assert_failed_realm (LOG_REALM_SYSTEMD, ("m"), "../src/core/dbus-manager.c", 1299 , __PRETTY_FUNCTION__); } while (0); | |||
1300 | ||||
1301 | /* Anyone can call this method */ | |||
1302 | ||||
1303 | r = mac_selinux_access_check(message, "status", error)mac_selinux_generic_access_check((message), ((void*)0), ("status" ), (error)); | |||
1304 | if (r < 0) | |||
1305 | return r; | |||
1306 | ||||
1307 | r = manager_get_dump_string(m, &dump); | |||
1308 | if (r < 0) | |||
1309 | return r; | |||
1310 | ||||
1311 | return reply(message, dump); | |||
1312 | } | |||
1313 | ||||
1314 | static int reply_dump(sd_bus_message *message, char *dump) { | |||
1315 | return sd_bus_reply_method_return(message, "s", dump); | |||
1316 | } | |||
1317 | ||||
1318 | static int method_dump(sd_bus_message *message, void *userdata, sd_bus_error *error) { | |||
1319 | return dump_impl(message, userdata, error, reply_dump); | |||
1320 | } | |||
1321 | ||||
1322 | static int reply_dump_by_fd(sd_bus_message *message, char *dump) { | |||
1323 | _cleanup_close___attribute__((cleanup(closep))) int fd = -1; | |||
1324 | ||||
1325 | fd = acquire_data_fd(dump, strlen(dump), 0); | |||
1326 | if (fd < 0) | |||
1327 | return fd; | |||
1328 | ||||
1329 | return sd_bus_reply_method_return(message, "h", fd); | |||
1330 | } | |||
1331 | ||||
1332 | static int method_dump_by_fd(sd_bus_message *message, void *userdata, sd_bus_error *error) { | |||
1333 | return dump_impl(message, userdata, error, reply_dump_by_fd); | |||
1334 | } | |||
1335 | ||||
1336 | static int method_refuse_snapshot(sd_bus_message *message, void *userdata, sd_bus_error *error) { | |||
1337 | return sd_bus_error_setf(error, SD_BUS_ERROR_NOT_SUPPORTED"org.freedesktop.DBus.Error.NotSupported", "Support for snapshots has been removed."); | |||
1338 | } | |||
1339 | ||||
1340 | static int verify_run_space(const char *message, sd_bus_error *error) { | |||
1341 | struct statvfs svfs; | |||
1342 | uint64_t available; | |||
1343 | ||||
1344 | if (statvfs("/run/systemd", &svfs) < 0) | |||
1345 | return sd_bus_error_set_errnof(error, errno(*__errno_location ()), "Failed to statvfs(/run/systemd): %m"); | |||
1346 | ||||
1347 | available = (uint64_t) svfs.f_bfree * (uint64_t) svfs.f_bsize; | |||
1348 | ||||
1349 | if (available < RELOAD_DISK_SPACE_MIN(16UL * 1024UL * 1024UL)) { | |||
1350 | char fb_available[FORMAT_BYTES_MAX8], fb_need[FORMAT_BYTES_MAX8]; | |||
1351 | return sd_bus_error_setf(error, | |||
1352 | BUS_ERROR_DISK_FULL"org.freedesktop.systemd1.DiskFull", | |||
1353 | "%s, not enough space available on /run/systemd. " | |||
1354 | "Currently, %s are free, but a safety buffer of %s is enforced.", | |||
1355 | message, | |||
1356 | format_bytes(fb_available, sizeof(fb_available), available), | |||
1357 | format_bytes(fb_need, sizeof(fb_need), RELOAD_DISK_SPACE_MIN(16UL * 1024UL * 1024UL))); | |||
1358 | } | |||
1359 | ||||
1360 | return 0; | |||
1361 | } | |||
1362 | ||||
1363 | int verify_run_space_and_log(const char *message) { | |||
1364 | _cleanup_(sd_bus_error_free)__attribute__((cleanup(sd_bus_error_free))) sd_bus_error error = SD_BUS_ERROR_NULL((const sd_bus_error) {(((void*)0)), (((void*)0)), 0}); | |||
1365 | int r; | |||
1366 | ||||
1367 | r = verify_run_space(message, &error); | |||
1368 | if (r < 0) | |||
1369 | return log_error_errno(r, "%s", bus_error_message(&error, r))({ int _level = ((3)), _e = ((r)), _realm = (LOG_REALM_SYSTEMD ); (log_get_max_level_realm(_realm) >= ((_level) & 0x07 )) ? log_internal_realm(((_realm) << 10 | (_level)), _e , "../src/core/dbus-manager.c", 1369, __func__, "%s", bus_error_message (&error, r)) : -abs(_e); }); | |||
1370 | ||||
1371 | return 0; | |||
1372 | } | |||
1373 | ||||
1374 | static int method_reload(sd_bus_message *message, void *userdata, sd_bus_error *error) { | |||
1375 | Manager *m = userdata; | |||
1376 | int r; | |||
1377 | ||||
1378 | assert(message)do { if ((__builtin_expect(!!(!(message)),0))) log_assert_failed_realm (LOG_REALM_SYSTEMD, ("message"), "../src/core/dbus-manager.c" , 1378, __PRETTY_FUNCTION__); } while (0); | |||
1379 | assert(m)do { if ((__builtin_expect(!!(!(m)),0))) log_assert_failed_realm (LOG_REALM_SYSTEMD, ("m"), "../src/core/dbus-manager.c", 1379 , __PRETTY_FUNCTION__); } while (0); | |||
1380 | ||||
1381 | r = verify_run_space("Refusing to reload", error); | |||
1382 | if (r < 0) | |||
1383 | return r; | |||
1384 | ||||
1385 | r = mac_selinux_access_check(message, "reload", error)mac_selinux_generic_access_check((message), ((void*)0), ("reload" ), (error)); | |||
1386 | if (r < 0) | |||
1387 | return r; | |||
1388 | ||||
1389 | r = bus_verify_reload_daemon_async(m, message, error); | |||
1390 | if (r < 0) | |||
1391 | return r; | |||
1392 | if (r == 0) | |||
1393 | return 1; /* No authorization for now, but the async polkit stuff will call us again when it has it */ | |||
1394 | ||||
1395 | /* Instead of sending the reply back right away, we just | |||
1396 | * remember that we need to and then send it after the reload | |||
1397 | * is finished. That way the caller knows when the reload | |||
1398 | * finished. */ | |||
1399 | ||||
1400 | assert(!m->pending_reload_message)do { if ((__builtin_expect(!!(!(!m->pending_reload_message )),0))) log_assert_failed_realm(LOG_REALM_SYSTEMD, ("!m->pending_reload_message" ), "../src/core/dbus-manager.c", 1400, __PRETTY_FUNCTION__); } while (0); | |||
1401 | r = sd_bus_message_new_method_return(message, &m->pending_reload_message); | |||
1402 | if (r < 0) | |||
1403 | return r; | |||
1404 | ||||
1405 | m->exit_code = MANAGER_RELOAD; | |||
1406 | ||||
1407 | return 1; | |||
1408 | } | |||
1409 | ||||
1410 | static int method_reexecute(sd_bus_message *message, void *userdata, sd_bus_error *error) { | |||
1411 | Manager *m = userdata; | |||
1412 | int r; | |||
1413 | ||||
1414 | assert(message)do { if ((__builtin_expect(!!(!(message)),0))) log_assert_failed_realm (LOG_REALM_SYSTEMD, ("message"), "../src/core/dbus-manager.c" , 1414, __PRETTY_FUNCTION__); } while (0); | |||
1415 | assert(m)do { if ((__builtin_expect(!!(!(m)),0))) log_assert_failed_realm (LOG_REALM_SYSTEMD, ("m"), "../src/core/dbus-manager.c", 1415 , __PRETTY_FUNCTION__); } while (0); | |||
1416 | ||||
1417 | r = verify_run_space("Refusing to reexecute", error); | |||
1418 | if (r < 0) | |||
1419 | return r; | |||
1420 | ||||
1421 | r = mac_selinux_access_check(message, "reload", error)mac_selinux_generic_access_check((message), ((void*)0), ("reload" ), (error)); | |||
1422 | if (r < 0) | |||
1423 | return r; | |||
1424 | ||||
1425 | r = bus_verify_reload_daemon_async(m, message, error); | |||
1426 | if (r < 0) | |||
1427 | return r; | |||
1428 | if (r == 0) | |||
1429 | return 1; /* No authorization for now, but the async polkit stuff will call us again when it has it */ | |||
1430 | ||||
1431 | /* We don't send a reply back here, the client should | |||
1432 | * just wait for us disconnecting. */ | |||
1433 | ||||
1434 | m->exit_code = MANAGER_REEXECUTE; | |||
1435 | return 1; | |||
1436 | } | |||
1437 | ||||
1438 | static int method_exit(sd_bus_message *message, void *userdata, sd_bus_error *error) { | |||
1439 | Manager *m = userdata; | |||
1440 | int r; | |||
1441 | ||||
1442 | assert(message)do { if ((__builtin_expect(!!(!(message)),0))) log_assert_failed_realm (LOG_REALM_SYSTEMD, ("message"), "../src/core/dbus-manager.c" , 1442, __PRETTY_FUNCTION__); } while (0); | |||
1443 | assert(m)do { if ((__builtin_expect(!!(!(m)),0))) log_assert_failed_realm (LOG_REALM_SYSTEMD, ("m"), "../src/core/dbus-manager.c", 1443 , __PRETTY_FUNCTION__); } while (0); | |||
1444 | ||||
1445 | r = mac_selinux_access_check(message, "halt", error)mac_selinux_generic_access_check((message), ((void*)0), ("halt" ), (error)); | |||
1446 | if (r < 0) | |||
1447 | return r; | |||
1448 | ||||
1449 | /* Exit() (in contrast to SetExitCode()) is actually allowed even if | |||
1450 | * we are running on the host. It will fall back on reboot() in | |||
1451 | * systemd-shutdown if it cannot do the exit() because it isn't a | |||
1452 | * container. */ | |||
1453 | ||||
1454 | m->exit_code = MANAGER_EXIT; | |||
1455 | ||||
1456 | return sd_bus_reply_method_return(message, NULL((void*)0)); | |||
1457 | } | |||
1458 | ||||
1459 | static int method_reboot(sd_bus_message *message, void *userdata, sd_bus_error *error) { | |||
1460 | Manager *m = userdata; | |||
1461 | int r; | |||
1462 | ||||
1463 | assert(message)do { if ((__builtin_expect(!!(!(message)),0))) log_assert_failed_realm (LOG_REALM_SYSTEMD, ("message"), "../src/core/dbus-manager.c" , 1463, __PRETTY_FUNCTION__); } while (0); | |||
1464 | assert(m)do { if ((__builtin_expect(!!(!(m)),0))) log_assert_failed_realm (LOG_REALM_SYSTEMD, ("m"), "../src/core/dbus-manager.c", 1464 , __PRETTY_FUNCTION__); } while (0); | |||
1465 | ||||
1466 | r = mac_selinux_access_check(message, "reboot", error)mac_selinux_generic_access_check((message), ((void*)0), ("reboot" ), (error)); | |||
1467 | if (r < 0) | |||
1468 | return r; | |||
1469 | ||||
1470 | if (!MANAGER_IS_SYSTEM(m)((m)->unit_file_scope == UNIT_FILE_SYSTEM)) | |||
1471 | return sd_bus_error_setf(error, SD_BUS_ERROR_NOT_SUPPORTED"org.freedesktop.DBus.Error.NotSupported", "Reboot is only supported for system managers."); | |||
1472 | ||||
1473 | m->exit_code = MANAGER_REBOOT; | |||
1474 | ||||
1475 | return sd_bus_reply_method_return(message, NULL((void*)0)); | |||
1476 | } | |||
1477 | ||||
1478 | static int method_poweroff(sd_bus_message *message, void *userdata, sd_bus_error *error) { | |||
1479 | Manager *m = userdata; | |||
1480 | int r; | |||
1481 | ||||
1482 | assert(message)do { if ((__builtin_expect(!!(!(message)),0))) log_assert_failed_realm (LOG_REALM_SYSTEMD, ("message"), "../src/core/dbus-manager.c" , 1482, __PRETTY_FUNCTION__); } while (0); | |||
1483 | assert(m)do { if ((__builtin_expect(!!(!(m)),0))) log_assert_failed_realm (LOG_REALM_SYSTEMD, ("m"), "../src/core/dbus-manager.c", 1483 , __PRETTY_FUNCTION__); } while (0); | |||
1484 | ||||
1485 | r = mac_selinux_access_check(message, "halt", error)mac_selinux_generic_access_check((message), ((void*)0), ("halt" ), (error)); | |||
1486 | if (r < 0) | |||
1487 | return r; | |||
1488 | ||||
1489 | if (!MANAGER_IS_SYSTEM(m)((m)->unit_file_scope == UNIT_FILE_SYSTEM)) | |||
1490 | return sd_bus_error_setf(error, SD_BUS_ERROR_NOT_SUPPORTED"org.freedesktop.DBus.Error.NotSupported", "Powering off is only supported for system managers."); | |||
1491 | ||||
1492 | m->exit_code = MANAGER_POWEROFF; | |||
1493 | ||||
1494 | return sd_bus_reply_method_return(message, NULL((void*)0)); | |||
1495 | } | |||
1496 | ||||
1497 | static int method_halt(sd_bus_message *message, void *userdata, sd_bus_error *error) { | |||
1498 | Manager *m = userdata; | |||
1499 | int r; | |||
1500 | ||||
1501 | assert(message)do { if ((__builtin_expect(!!(!(message)),0))) log_assert_failed_realm (LOG_REALM_SYSTEMD, ("message"), "../src/core/dbus-manager.c" , 1501, __PRETTY_FUNCTION__); } while (0); | |||
1502 | assert(m)do { if ((__builtin_expect(!!(!(m)),0))) log_assert_failed_realm (LOG_REALM_SYSTEMD, ("m"), "../src/core/dbus-manager.c", 1502 , __PRETTY_FUNCTION__); } while (0); | |||
1503 | ||||
1504 | r = mac_selinux_access_check(message, "halt", error)mac_selinux_generic_access_check((message), ((void*)0), ("halt" ), (error)); | |||
1505 | if (r < 0) | |||
1506 | return r; | |||
1507 | ||||
1508 | if (!MANAGER_IS_SYSTEM(m)((m)->unit_file_scope == UNIT_FILE_SYSTEM)) | |||
1509 | return sd_bus_error_setf(error, SD_BUS_ERROR_NOT_SUPPORTED"org.freedesktop.DBus.Error.NotSupported", "Halt is only supported for system managers."); | |||
1510 | ||||
1511 | m->exit_code = MANAGER_HALT; | |||
1512 | ||||
1513 | return sd_bus_reply_method_return(message, NULL((void*)0)); | |||
1514 | } | |||
1515 | ||||
1516 | static int method_kexec(sd_bus_message *message, void *userdata, sd_bus_error *error) { | |||
1517 | Manager *m = userdata; | |||
1518 | int r; | |||
1519 | ||||
1520 | assert(message)do { if ((__builtin_expect(!!(!(message)),0))) log_assert_failed_realm (LOG_REALM_SYSTEMD, ("message"), "../src/core/dbus-manager.c" , 1520, __PRETTY_FUNCTION__); } while (0); | |||
1521 | assert(m)do { if ((__builtin_expect(!!(!(m)),0))) log_assert_failed_realm (LOG_REALM_SYSTEMD, ("m"), "../src/core/dbus-manager.c", 1521 , __PRETTY_FUNCTION__); } while (0); | |||
1522 | ||||
1523 | r = mac_selinux_access_check(message, "reboot", error)mac_selinux_generic_access_check((message), ((void*)0), ("reboot" ), (error)); | |||
1524 | if (r < 0) | |||
1525 | return r; | |||
1526 | ||||
1527 | if (!MANAGER_IS_SYSTEM(m)((m)->unit_file_scope == UNIT_FILE_SYSTEM)) | |||
1528 | return sd_bus_error_setf(error, SD_BUS_ERROR_NOT_SUPPORTED"org.freedesktop.DBus.Error.NotSupported", "KExec is only supported for system managers."); | |||
1529 | ||||
1530 | m->exit_code = MANAGER_KEXEC; | |||
1531 | ||||
1532 | return sd_bus_reply_method_return(message, NULL((void*)0)); | |||
1533 | } | |||
1534 | ||||
1535 | static int method_switch_root(sd_bus_message *message, void *userdata, sd_bus_error *error) { | |||
1536 | char *ri = NULL((void*)0), *rt = NULL((void*)0); | |||
1537 | const char *root, *init; | |||
1538 | Manager *m = userdata; | |||
1539 | struct statvfs svfs; | |||
1540 | uint64_t available; | |||
1541 | int r; | |||
1542 | ||||
1543 | assert(message)do { if ((__builtin_expect(!!(!(message)),0))) log_assert_failed_realm (LOG_REALM_SYSTEMD, ("message"), "../src/core/dbus-manager.c" , 1543, __PRETTY_FUNCTION__); } while (0); | |||
1544 | assert(m)do { if ((__builtin_expect(!!(!(m)),0))) log_assert_failed_realm (LOG_REALM_SYSTEMD, ("m"), "../src/core/dbus-manager.c", 1544 , __PRETTY_FUNCTION__); } while (0); | |||
1545 | ||||
1546 | if (statvfs("/run/systemd", &svfs) < 0) | |||
1547 | return sd_bus_error_set_errnof(error, errno(*__errno_location ()), "Failed to statvfs(/run/systemd): %m"); | |||
1548 | ||||
1549 | available = (uint64_t) svfs.f_bfree * (uint64_t) svfs.f_bsize; | |||
1550 | ||||
1551 | if (available < RELOAD_DISK_SPACE_MIN(16UL * 1024UL * 1024UL)) { | |||
1552 | char fb_available[FORMAT_BYTES_MAX8], fb_need[FORMAT_BYTES_MAX8]; | |||
1553 | log_warning("Dangerously low amount of free space on /run/systemd, root switching operation might not complete successfully. "({ int _level = (((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-manager.c", 1556, __func__, "Dangerously low amount of free space on /run/systemd, root switching operation might not complete successfully. " "Currently, %s are free, but %s are suggested. Proceeding anyway." , format_bytes(fb_available, sizeof(fb_available), available) , format_bytes(fb_need, sizeof(fb_need), (16UL * 1024UL * 1024UL ))) : -abs(_e); }) | |||
1554 | "Currently, %s are free, but %s are suggested. Proceeding anyway.",({ int _level = (((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-manager.c", 1556, __func__, "Dangerously low amount of free space on /run/systemd, root switching operation might not complete successfully. " "Currently, %s are free, but %s are suggested. Proceeding anyway." , format_bytes(fb_available, sizeof(fb_available), available) , format_bytes(fb_need, sizeof(fb_need), (16UL * 1024UL * 1024UL ))) : -abs(_e); }) | |||
1555 | format_bytes(fb_available, sizeof(fb_available), available),({ int _level = (((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-manager.c", 1556, __func__, "Dangerously low amount of free space on /run/systemd, root switching operation might not complete successfully. " "Currently, %s are free, but %s are suggested. Proceeding anyway." , format_bytes(fb_available, sizeof(fb_available), available) , format_bytes(fb_need, sizeof(fb_need), (16UL * 1024UL * 1024UL ))) : -abs(_e); }) | |||
1556 | format_bytes(fb_need, sizeof(fb_need), RELOAD_DISK_SPACE_MIN))({ int _level = (((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-manager.c", 1556, __func__, "Dangerously low amount of free space on /run/systemd, root switching operation might not complete successfully. " "Currently, %s are free, but %s are suggested. Proceeding anyway." , format_bytes(fb_available, sizeof(fb_available), available) , format_bytes(fb_need, sizeof(fb_need), (16UL * 1024UL * 1024UL ))) : -abs(_e); }); | |||
1557 | } | |||
1558 | ||||
1559 | r = mac_selinux_access_check(message, "reboot", error)mac_selinux_generic_access_check((message), ((void*)0), ("reboot" ), (error)); | |||
1560 | if (r < 0) | |||
1561 | return r; | |||
1562 | ||||
1563 | if (!MANAGER_IS_SYSTEM(m)((m)->unit_file_scope == UNIT_FILE_SYSTEM)) | |||
1564 | return sd_bus_error_setf(error, SD_BUS_ERROR_NOT_SUPPORTED"org.freedesktop.DBus.Error.NotSupported", "Root switching is only supported by system manager."); | |||
1565 | ||||
1566 | r = sd_bus_message_read(message, "ss", &root, &init); | |||
1567 | if (r < 0) | |||
1568 | return r; | |||
1569 | ||||
1570 | if (isempty(root)) | |||
1571 | return sd_bus_error_setf(error, SD_BUS_ERROR_INVALID_ARGS"org.freedesktop.DBus.Error.InvalidArgs", "New root directory may not be the empty string."); | |||
1572 | if (!path_is_absolute(root)) | |||
1573 | return sd_bus_error_setf(error, SD_BUS_ERROR_INVALID_ARGS"org.freedesktop.DBus.Error.InvalidArgs", "New root path '%s' is not absolute.", root); | |||
1574 | if (path_equal(root, "/")) | |||
1575 | return sd_bus_error_setf(error, SD_BUS_ERROR_INVALID_ARGS"org.freedesktop.DBus.Error.InvalidArgs", "New root directory cannot be the old root directory."); | |||
1576 | ||||
1577 | /* Safety check */ | |||
1578 | if (isempty(init)) { | |||
1579 | r = path_is_os_tree(root); | |||
1580 | if (r < 0) | |||
1581 | return sd_bus_error_set_errnof(error, r, "Failed to determine whether root path '%s' contains an OS tree: %m", root); | |||
1582 | if (r == 0) | |||
1583 | return sd_bus_error_setf(error, SD_BUS_ERROR_INVALID_ARGS"org.freedesktop.DBus.Error.InvalidArgs", "Specified switch root path '%s' does not seem to be an OS tree. os-release file is missing.", root); | |||
1584 | } else { | |||
1585 | _cleanup_free___attribute__((cleanup(freep))) char *chased = NULL((void*)0); | |||
1586 | ||||
1587 | if (!path_is_absolute(init)) | |||
1588 | return sd_bus_error_setf(error, SD_BUS_ERROR_INVALID_ARGS"org.freedesktop.DBus.Error.InvalidArgs", "Path to init binary '%s' not absolute.", init); | |||
1589 | ||||
1590 | r = chase_symlinks(init, root, CHASE_PREFIX_ROOT|CHASE_TRAIL_SLASH, &chased); | |||
1591 | if (r < 0) | |||
1592 | return sd_bus_error_set_errnof(error, r, "Could not resolve init executable %s: %m", init); | |||
1593 | ||||
1594 | if (laccess(chased, X_OK)faccessat(-100, (chased), (1), 0x100) < 0) { | |||
1595 | if (errno(*__errno_location ()) == EACCES13) | |||
1596 | return sd_bus_error_setf(error, SD_BUS_ERROR_INVALID_ARGS"org.freedesktop.DBus.Error.InvalidArgs", "Init binary %s is not executable.", init); | |||
1597 | ||||
1598 | return sd_bus_error_set_errnof(error, r, "Could not check whether init binary %s is executable: %m", init); | |||
1599 | } | |||
1600 | } | |||
1601 | ||||
1602 | rt = strdup(root); | |||
1603 | if (!rt) | |||
1604 | return -ENOMEM12; | |||
1605 | ||||
1606 | if (!isempty(init)) { | |||
1607 | ri = strdup(init); | |||
1608 | if (!ri) { | |||
1609 | free(rt); | |||
1610 | return -ENOMEM12; | |||
1611 | } | |||
1612 | } | |||
1613 | ||||
1614 | free(m->switch_root); | |||
1615 | m->switch_root = rt; | |||
1616 | ||||
1617 | free(m->switch_root_init); | |||
1618 | m->switch_root_init = ri; | |||
1619 | ||||
1620 | m->exit_code = MANAGER_SWITCH_ROOT; | |||
1621 | ||||
1622 | return sd_bus_reply_method_return(message, NULL((void*)0)); | |||
1623 | } | |||
1624 | ||||
1625 | static int method_set_environment(sd_bus_message *message, void *userdata, sd_bus_error *error) { | |||
1626 | _cleanup_strv_free___attribute__((cleanup(strv_freep))) char **plus = NULL((void*)0); | |||
1627 | Manager *m = userdata; | |||
1628 | int r; | |||
1629 | ||||
1630 | assert(message)do { if ((__builtin_expect(!!(!(message)),0))) log_assert_failed_realm (LOG_REALM_SYSTEMD, ("message"), "../src/core/dbus-manager.c" , 1630, __PRETTY_FUNCTION__); } while (0); | |||
1631 | assert(m)do { if ((__builtin_expect(!!(!(m)),0))) log_assert_failed_realm (LOG_REALM_SYSTEMD, ("m"), "../src/core/dbus-manager.c", 1631 , __PRETTY_FUNCTION__); } while (0); | |||
1632 | ||||
1633 | r = mac_selinux_access_check(message, "reload", error)mac_selinux_generic_access_check((message), ((void*)0), ("reload" ), (error)); | |||
1634 | if (r < 0) | |||
1635 | return r; | |||
1636 | ||||
1637 | r = sd_bus_message_read_strv(message, &plus); | |||
1638 | if (r < 0) | |||
1639 | return r; | |||
1640 | if (!strv_env_is_valid(plus)) | |||
1641 | return sd_bus_error_setf(error, SD_BUS_ERROR_INVALID_ARGS"org.freedesktop.DBus.Error.InvalidArgs", "Invalid environment assignments"); | |||
1642 | ||||
1643 | r = bus_verify_set_environment_async(m, message, error); | |||
1644 | if (r < 0) | |||
1645 | return r; | |||
1646 | if (r == 0) | |||
1647 | return 1; /* No authorization for now, but the async polkit stuff will call us again when it has it */ | |||
1648 | ||||
1649 | r = manager_environment_add(m, NULL((void*)0), plus); | |||
1650 | if (r < 0) | |||
1651 | return r; | |||
1652 | ||||
1653 | return sd_bus_reply_method_return(message, NULL((void*)0)); | |||
1654 | } | |||
1655 | ||||
1656 | static int method_unset_environment(sd_bus_message *message, void *userdata, sd_bus_error *error) { | |||
1657 | _cleanup_strv_free___attribute__((cleanup(strv_freep))) char **minus = NULL((void*)0); | |||
1658 | Manager *m = userdata; | |||
1659 | int r; | |||
1660 | ||||
1661 | assert(message)do { if ((__builtin_expect(!!(!(message)),0))) log_assert_failed_realm (LOG_REALM_SYSTEMD, ("message"), "../src/core/dbus-manager.c" , 1661, __PRETTY_FUNCTION__); } while (0); | |||
1662 | assert(m)do { if ((__builtin_expect(!!(!(m)),0))) log_assert_failed_realm (LOG_REALM_SYSTEMD, ("m"), "../src/core/dbus-manager.c", 1662 , __PRETTY_FUNCTION__); } while (0); | |||
1663 | ||||
1664 | r = mac_selinux_access_check(message, "reload", error)mac_selinux_generic_access_check((message), ((void*)0), ("reload" ), (error)); | |||
1665 | if (r < 0) | |||
1666 | return r; | |||
1667 | ||||
1668 | r = sd_bus_message_read_strv(message, &minus); | |||
1669 | if (r < 0) | |||
1670 | return r; | |||
1671 | ||||
1672 | if (!strv_env_name_or_assignment_is_valid(minus)) | |||
1673 | return sd_bus_error_setf(error, SD_BUS_ERROR_INVALID_ARGS"org.freedesktop.DBus.Error.InvalidArgs", "Invalid environment variable names or assignments"); | |||
1674 | ||||
1675 | r = bus_verify_set_environment_async(m, message, error); | |||
1676 | if (r < 0) | |||
1677 | return r; | |||
1678 | if (r == 0) | |||
1679 | return 1; /* No authorization for now, but the async polkit stuff will call us again when it has it */ | |||
1680 | ||||
1681 | r = manager_environment_add(m, minus, NULL((void*)0)); | |||
1682 | if (r < 0) | |||
1683 | return r; | |||
1684 | ||||
1685 | return sd_bus_reply_method_return(message, NULL((void*)0)); | |||
1686 | } | |||
1687 | ||||
1688 | static int method_unset_and_set_environment(sd_bus_message *message, void *userdata, sd_bus_error *error) { | |||
1689 | _cleanup_strv_free___attribute__((cleanup(strv_freep))) char **minus = NULL((void*)0), **plus = NULL((void*)0); | |||
1690 | Manager *m = userdata; | |||
1691 | int r; | |||
1692 | ||||
1693 | assert(message)do { if ((__builtin_expect(!!(!(message)),0))) log_assert_failed_realm (LOG_REALM_SYSTEMD, ("message"), "../src/core/dbus-manager.c" , 1693, __PRETTY_FUNCTION__); } while (0); | |||
1694 | assert(m)do { if ((__builtin_expect(!!(!(m)),0))) log_assert_failed_realm (LOG_REALM_SYSTEMD, ("m"), "../src/core/dbus-manager.c", 1694 , __PRETTY_FUNCTION__); } while (0); | |||
1695 | ||||
1696 | r = mac_selinux_access_check(message, "reload", error)mac_selinux_generic_access_check((message), ((void*)0), ("reload" ), (error)); | |||
1697 | if (r < 0) | |||
1698 | return r; | |||
1699 | ||||
1700 | r = sd_bus_message_read_strv(message, &minus); | |||
1701 | if (r < 0) | |||
1702 | return r; | |||
1703 | ||||
1704 | r = sd_bus_message_read_strv(message, &plus); | |||
1705 | if (r < 0) | |||
1706 | return r; | |||
1707 | ||||
1708 | if (!strv_env_name_or_assignment_is_valid(minus)) | |||
1709 | return sd_bus_error_setf(error, SD_BUS_ERROR_INVALID_ARGS"org.freedesktop.DBus.Error.InvalidArgs", "Invalid environment variable names or assignments"); | |||
1710 | if (!strv_env_is_valid(plus)) | |||
1711 | return sd_bus_error_setf(error, SD_BUS_ERROR_INVALID_ARGS"org.freedesktop.DBus.Error.InvalidArgs", "Invalid environment assignments"); | |||
1712 | ||||
1713 | r = bus_verify_set_environment_async(m, message, error); | |||
1714 | if (r < 0) | |||
1715 | return r; | |||
1716 | if (r == 0) | |||
1717 | return 1; /* No authorization for now, but the async polkit stuff will call us again when it has it */ | |||
1718 | ||||
1719 | r = manager_environment_add(m, minus, plus); | |||
1720 | if (r < 0) | |||
1721 | return r; | |||
1722 | ||||
1723 | return sd_bus_reply_method_return(message, NULL((void*)0)); | |||
1724 | } | |||
1725 | ||||
1726 | static int method_set_exit_code(sd_bus_message *message, void *userdata, sd_bus_error *error) { | |||
1727 | Manager *m = userdata; | |||
1728 | uint8_t code; | |||
1729 | int r; | |||
1730 | ||||
1731 | assert(message)do { if ((__builtin_expect(!!(!(message)),0))) log_assert_failed_realm (LOG_REALM_SYSTEMD, ("message"), "../src/core/dbus-manager.c" , 1731, __PRETTY_FUNCTION__); } while (0); | |||
1732 | assert(m)do { if ((__builtin_expect(!!(!(m)),0))) log_assert_failed_realm (LOG_REALM_SYSTEMD, ("m"), "../src/core/dbus-manager.c", 1732 , __PRETTY_FUNCTION__); } while (0); | |||
1733 | ||||
1734 | r = mac_selinux_access_check(message, "exit", error)mac_selinux_generic_access_check((message), ((void*)0), ("exit" ), (error)); | |||
1735 | if (r < 0) | |||
1736 | return r; | |||
1737 | ||||
1738 | r = sd_bus_message_read_basic(message, 'y', &code); | |||
1739 | if (r < 0) | |||
1740 | return r; | |||
1741 | ||||
1742 | if (MANAGER_IS_SYSTEM(m)((m)->unit_file_scope == UNIT_FILE_SYSTEM) && detect_container() <= 0) | |||
1743 | return sd_bus_error_setf(error, SD_BUS_ERROR_NOT_SUPPORTED"org.freedesktop.DBus.Error.NotSupported", "ExitCode can only be set for user service managers or in containers."); | |||
1744 | ||||
1745 | m->return_value = code; | |||
1746 | ||||
1747 | return sd_bus_reply_method_return(message, NULL((void*)0)); | |||
1748 | } | |||
1749 | ||||
1750 | static int method_lookup_dynamic_user_by_name(sd_bus_message *message, void *userdata, sd_bus_error *error) { | |||
1751 | Manager *m = userdata; | |||
1752 | const char *name; | |||
1753 | uid_t uid; | |||
1754 | int r; | |||
1755 | ||||
1756 | assert(message)do { if ((__builtin_expect(!!(!(message)),0))) log_assert_failed_realm (LOG_REALM_SYSTEMD, ("message"), "../src/core/dbus-manager.c" , 1756, __PRETTY_FUNCTION__); } while (0); | |||
1757 | assert(m)do { if ((__builtin_expect(!!(!(m)),0))) log_assert_failed_realm (LOG_REALM_SYSTEMD, ("m"), "../src/core/dbus-manager.c", 1757 , __PRETTY_FUNCTION__); } while (0); | |||
1758 | ||||
1759 | r = sd_bus_message_read_basic(message, 's', &name); | |||
1760 | if (r < 0) | |||
1761 | return r; | |||
1762 | ||||
1763 | if (!MANAGER_IS_SYSTEM(m)((m)->unit_file_scope == UNIT_FILE_SYSTEM)) | |||
1764 | return sd_bus_error_setf(error, SD_BUS_ERROR_NOT_SUPPORTED"org.freedesktop.DBus.Error.NotSupported", "Dynamic users are only supported in the system instance."); | |||
1765 | if (!valid_user_group_name(name, VALID_USER_RELAX)) | |||
1766 | return sd_bus_error_setf(error, SD_BUS_ERROR_INVALID_ARGS"org.freedesktop.DBus.Error.InvalidArgs", "User name invalid: %s", name); | |||
1767 | ||||
1768 | r = dynamic_user_lookup_name(m, name, &uid); | |||
1769 | if (r == -ESRCH3) | |||
1770 | return sd_bus_error_setf(error, BUS_ERROR_NO_SUCH_DYNAMIC_USER"org.freedesktop.systemd1.NoSuchDynamicUser", "Dynamic user %s does not exist.", name); | |||
1771 | if (r < 0) | |||
1772 | return r; | |||
1773 | ||||
1774 | return sd_bus_reply_method_return(message, "u", (uint32_t) uid); | |||
1775 | } | |||
1776 | ||||
1777 | static int method_lookup_dynamic_user_by_uid(sd_bus_message *message, void *userdata, sd_bus_error *error) { | |||
1778 | _cleanup_free___attribute__((cleanup(freep))) char *name = NULL((void*)0); | |||
1779 | Manager *m = userdata; | |||
1780 | uid_t uid; | |||
1781 | int r; | |||
1782 | ||||
1783 | assert(message)do { if ((__builtin_expect(!!(!(message)),0))) log_assert_failed_realm (LOG_REALM_SYSTEMD, ("message"), "../src/core/dbus-manager.c" , 1783, __PRETTY_FUNCTION__); } while (0); | |||
1784 | assert(m)do { if ((__builtin_expect(!!(!(m)),0))) log_assert_failed_realm (LOG_REALM_SYSTEMD, ("m"), "../src/core/dbus-manager.c", 1784 , __PRETTY_FUNCTION__); } while (0); | |||
1785 | ||||
1786 | assert_cc(sizeof(uid) == sizeof(uint32_t))GCC diagnostic push
; GCC diagnostic ignored "-Wdeclaration-after-statement" ; struct _assert_struct_23 { char x[(sizeof(uid) == sizeof(uint32_t )) ? 0 : -1]; }; GCC diagnostic pop ; | |||
1787 | r = sd_bus_message_read_basic(message, 'u', &uid); | |||
1788 | if (r < 0) | |||
1789 | return r; | |||
1790 | ||||
1791 | if (!MANAGER_IS_SYSTEM(m)((m)->unit_file_scope == UNIT_FILE_SYSTEM)) | |||
1792 | return sd_bus_error_setf(error, SD_BUS_ERROR_NOT_SUPPORTED"org.freedesktop.DBus.Error.NotSupported", "Dynamic users are only supported in the system instance."); | |||
1793 | if (!uid_is_valid(uid)) | |||
1794 | return sd_bus_error_setf(error, SD_BUS_ERROR_INVALID_ARGS"org.freedesktop.DBus.Error.InvalidArgs", "User ID invalid: " UID_FMT"%" "u", uid); | |||
1795 | ||||
1796 | r = dynamic_user_lookup_uid(m, uid, &name); | |||
1797 | if (r == -ESRCH3) | |||
1798 | return sd_bus_error_setf(error, BUS_ERROR_NO_SUCH_DYNAMIC_USER"org.freedesktop.systemd1.NoSuchDynamicUser", "Dynamic user ID " UID_FMT"%" "u" " does not exist.", uid); | |||
1799 | if (r < 0) | |||
1800 | return r; | |||
1801 | ||||
1802 | return sd_bus_reply_method_return(message, "s", name); | |||
1803 | } | |||
1804 | ||||
1805 | static int method_get_dynamic_users(sd_bus_message *message, void *userdata, sd_bus_error *error) { | |||
1806 | _cleanup_(sd_bus_message_unrefp)__attribute__((cleanup(sd_bus_message_unrefp))) sd_bus_message *reply = NULL((void*)0); | |||
1807 | Manager *m = userdata; | |||
1808 | DynamicUser *d; | |||
1809 | Iterator i; | |||
1810 | int r; | |||
1811 | ||||
1812 | assert(message)do { if ((__builtin_expect(!!(!(message)),0))) log_assert_failed_realm (LOG_REALM_SYSTEMD, ("message"), "../src/core/dbus-manager.c" , 1812, __PRETTY_FUNCTION__); } while (0); | |||
1813 | assert(m)do { if ((__builtin_expect(!!(!(m)),0))) log_assert_failed_realm (LOG_REALM_SYSTEMD, ("m"), "../src/core/dbus-manager.c", 1813 , __PRETTY_FUNCTION__); } while (0); | |||
1814 | ||||
1815 | assert_cc(sizeof(uid_t) == sizeof(uint32_t))GCC diagnostic push
; GCC diagnostic ignored "-Wdeclaration-after-statement" ; struct _assert_struct_24 { char x[(sizeof(uid_t) == sizeof (uint32_t)) ? 0 : -1]; }; GCC diagnostic pop ; | |||
1816 | ||||
1817 | if (!MANAGER_IS_SYSTEM(m)((m)->unit_file_scope == UNIT_FILE_SYSTEM)) | |||
1818 | return sd_bus_error_setf(error, SD_BUS_ERROR_NOT_SUPPORTED"org.freedesktop.DBus.Error.NotSupported", "Dynamic users are only supported in the system instance."); | |||
1819 | ||||
1820 | r = sd_bus_message_new_method_return(message, &reply); | |||
1821 | if (r < 0) | |||
1822 | return r; | |||
1823 | ||||
1824 | r = sd_bus_message_open_container(reply, 'a', "(us)"); | |||
1825 | if (r < 0) | |||
1826 | return r; | |||
1827 | ||||
1828 | HASHMAP_FOREACH(d, m->dynamic_users, i)for ((i) = ((Iterator) { .idx = ((2147483647 *2U +1U) - 1), . next_key = ((void*)0) }); hashmap_iterate((m->dynamic_users ), &(i), (void**)&(d), ((void*)0)); ) { | |||
1829 | uid_t uid; | |||
1830 | ||||
1831 | r = dynamic_user_current(d, &uid); | |||
1832 | if (r == -EAGAIN11) /* not realized yet? */ | |||
1833 | continue; | |||
1834 | if (r < 0) | |||
1835 | return sd_bus_error_setf(error, SD_BUS_ERROR_FAILED"org.freedesktop.DBus.Error.Failed", "Failed to lookup a dynamic user."); | |||
1836 | ||||
1837 | r = sd_bus_message_append(reply, "(us)", uid, d->name); | |||
1838 | if (r < 0) | |||
1839 | return r; | |||
1840 | } | |||
1841 | ||||
1842 | r = sd_bus_message_close_container(reply); | |||
1843 | if (r < 0) | |||
1844 | return r; | |||
1845 | ||||
1846 | return sd_bus_send(NULL((void*)0), reply, NULL((void*)0)); | |||
1847 | } | |||
1848 | ||||
1849 | static int list_unit_files_by_patterns(sd_bus_message *message, void *userdata, sd_bus_error *error, char **states, char **patterns) { | |||
1850 | _cleanup_(sd_bus_message_unrefp)__attribute__((cleanup(sd_bus_message_unrefp))) sd_bus_message *reply = NULL((void*)0); | |||
1851 | Manager *m = userdata; | |||
1852 | UnitFileList *item; | |||
1853 | Hashmap *h; | |||
1854 | Iterator i; | |||
1855 | int r; | |||
1856 | ||||
1857 | assert(message)do { if ((__builtin_expect(!!(!(message)),0))) log_assert_failed_realm (LOG_REALM_SYSTEMD, ("message"), "../src/core/dbus-manager.c" , 1857, __PRETTY_FUNCTION__); } while (0); | |||
1858 | assert(m)do { if ((__builtin_expect(!!(!(m)),0))) log_assert_failed_realm (LOG_REALM_SYSTEMD, ("m"), "../src/core/dbus-manager.c", 1858 , __PRETTY_FUNCTION__); } while (0); | |||
1859 | ||||
1860 | /* Anyone can call this method */ | |||
1861 | ||||
1862 | r = mac_selinux_access_check(message, "status", error)mac_selinux_generic_access_check((message), ((void*)0), ("status" ), (error)); | |||
1863 | if (r < 0) | |||
1864 | return r; | |||
1865 | ||||
1866 | r = sd_bus_message_new_method_return(message, &reply); | |||
1867 | if (r < 0) | |||
1868 | return r; | |||
1869 | ||||
1870 | h = hashmap_new(&string_hash_ops)internal_hashmap_new(&string_hash_ops ); | |||
1871 | if (!h) | |||
1872 | return -ENOMEM12; | |||
1873 | ||||
1874 | r = unit_file_get_list(m->unit_file_scope, NULL((void*)0), h, states, patterns); | |||
1875 | if (r < 0) | |||
1876 | goto fail; | |||
1877 | ||||
1878 | r = sd_bus_message_open_container(reply, 'a', "(ss)"); | |||
1879 | if (r < 0) | |||
1880 | goto fail; | |||
1881 | ||||
1882 | HASHMAP_FOREACH(item, h, i)for ((i) = ((Iterator) { .idx = ((2147483647 *2U +1U) - 1), . next_key = ((void*)0) }); hashmap_iterate((h), &(i), (void **)&(item), ((void*)0)); ) { | |||
1883 | ||||
1884 | r = sd_bus_message_append(reply, "(ss)", item->path, unit_file_state_to_string(item->state)); | |||
1885 | if (r < 0) | |||
1886 | goto fail; | |||
1887 | } | |||
1888 | ||||
1889 | unit_file_list_free(h); | |||
1890 | ||||
1891 | r = sd_bus_message_close_container(reply); | |||
1892 | if (r < 0) | |||
1893 | return r; | |||
1894 | ||||
1895 | return sd_bus_send(NULL((void*)0), reply, NULL((void*)0)); | |||
1896 | ||||
1897 | fail: | |||
1898 | unit_file_list_free(h); | |||
1899 | return r; | |||
1900 | } | |||
1901 | ||||
1902 | static int method_list_unit_files(sd_bus_message *message, void *userdata, sd_bus_error *error) { | |||
1903 | return list_unit_files_by_patterns(message, userdata, error, NULL((void*)0), NULL((void*)0)); | |||
1904 | } | |||
1905 | ||||
1906 | static int method_list_unit_files_by_patterns(sd_bus_message *message, void *userdata, sd_bus_error *error) { | |||
1907 | _cleanup_strv_free___attribute__((cleanup(strv_freep))) char **states = NULL((void*)0); | |||
1908 | _cleanup_strv_free___attribute__((cleanup(strv_freep))) char **patterns = NULL((void*)0); | |||
1909 | int r; | |||
1910 | ||||
1911 | r = sd_bus_message_read_strv(message, &states); | |||
1912 | if (r < 0) | |||
1913 | return r; | |||
1914 | ||||
1915 | r = sd_bus_message_read_strv(message, &patterns); | |||
1916 | if (r < 0) | |||
1917 | return r; | |||
1918 | ||||
1919 | return list_unit_files_by_patterns(message, userdata, error, states, patterns); | |||
1920 | } | |||
1921 | ||||
1922 | static int method_get_unit_file_state(sd_bus_message *message, void *userdata, sd_bus_error *error) { | |||
1923 | Manager *m = userdata; | |||
1924 | const char *name; | |||
1925 | UnitFileState state; | |||
1926 | int r; | |||
1927 | ||||
1928 | assert(message)do { if ((__builtin_expect(!!(!(message)),0))) log_assert_failed_realm (LOG_REALM_SYSTEMD, ("message"), "../src/core/dbus-manager.c" , 1928, __PRETTY_FUNCTION__); } while (0); | |||
1929 | assert(m)do { if ((__builtin_expect(!!(!(m)),0))) log_assert_failed_realm (LOG_REALM_SYSTEMD, ("m"), "../src/core/dbus-manager.c", 1929 , __PRETTY_FUNCTION__); } while (0); | |||
1930 | ||||
1931 | /* Anyone can call this method */ | |||
1932 | ||||
1933 | r = mac_selinux_access_check(message, "status", error)mac_selinux_generic_access_check((message), ((void*)0), ("status" ), (error)); | |||
1934 | if (r < 0) | |||
1935 | return r; | |||
1936 | ||||
1937 | r = sd_bus_message_read(message, "s", &name); | |||
1938 | if (r < 0) | |||
1939 | return r; | |||
1940 | ||||
1941 | r = unit_file_get_state(m->unit_file_scope, NULL((void*)0), name, &state); | |||
1942 | if (r < 0) | |||
1943 | return r; | |||
1944 | ||||
1945 | return sd_bus_reply_method_return(message, "s", unit_file_state_to_string(state)); | |||
1946 | } | |||
1947 | ||||
1948 | static int method_get_default_target(sd_bus_message *message, void *userdata, sd_bus_error *error) { | |||
1949 | _cleanup_free___attribute__((cleanup(freep))) char *default_target = NULL((void*)0); | |||
1950 | Manager *m = userdata; | |||
1951 | int r; | |||
1952 | ||||
1953 | assert(message)do { if ((__builtin_expect(!!(!(message)),0))) log_assert_failed_realm (LOG_REALM_SYSTEMD, ("message"), "../src/core/dbus-manager.c" , 1953, __PRETTY_FUNCTION__); } while (0); | |||
1954 | assert(m)do { if ((__builtin_expect(!!(!(m)),0))) log_assert_failed_realm (LOG_REALM_SYSTEMD, ("m"), "../src/core/dbus-manager.c", 1954 , __PRETTY_FUNCTION__); } while (0); | |||
1955 | ||||
1956 | /* Anyone can call this method */ | |||
1957 | ||||
1958 | r = mac_selinux_access_check(message, "status", error)mac_selinux_generic_access_check((message), ((void*)0), ("status" ), (error)); | |||
1959 | if (r < 0) | |||
1960 | return r; | |||
1961 | ||||
1962 | r = unit_file_get_default(m->unit_file_scope, NULL((void*)0), &default_target); | |||
1963 | if (r < 0) | |||
1964 | return r; | |||
1965 | ||||
1966 | return sd_bus_reply_method_return(message, "s", default_target); | |||
1967 | } | |||
1968 | ||||
1969 | static int send_unit_files_changed(sd_bus *bus, void *userdata) { | |||
1970 | _cleanup_(sd_bus_message_unrefp)__attribute__((cleanup(sd_bus_message_unrefp))) sd_bus_message *message = NULL((void*)0); | |||
1971 | int r; | |||
1972 | ||||
1973 | assert(bus)do { if ((__builtin_expect(!!(!(bus)),0))) log_assert_failed_realm (LOG_REALM_SYSTEMD, ("bus"), "../src/core/dbus-manager.c", 1973 , __PRETTY_FUNCTION__); } while (0); | |||
1974 | ||||
1975 | r = sd_bus_message_new_signal(bus, &message, "/org/freedesktop/systemd1", "org.freedesktop.systemd1.Manager", "UnitFilesChanged"); | |||
1976 | if (r < 0) | |||
1977 | return r; | |||
1978 | ||||
1979 | return sd_bus_send(bus, message, NULL((void*)0)); | |||
1980 | } | |||
1981 | ||||
1982 | /* Create an error reply, using the error information from changes[] | |||
1983 | * if possible, and fall back to generating an error from error code c. | |||
1984 | * The error message only describes the first error. | |||
1985 | * | |||
1986 | * Coordinate with unit_file_dump_changes() in install.c. | |||
1987 | */ | |||
1988 | static int install_error( | |||
1989 | sd_bus_error *error, | |||
1990 | int c, | |||
1991 | UnitFileChange *changes, | |||
1992 | size_t n_changes) { | |||
1993 | ||||
1994 | size_t i; | |||
1995 | int r; | |||
1996 | ||||
1997 | for (i = 0; i < n_changes; i++) | |||
1998 | ||||
1999 | switch(changes[i].type) { | |||
2000 | ||||
2001 | case 0 ... INT_MAX2147483647: | |||
2002 | continue; | |||
2003 | ||||
2004 | case -EEXIST17: | |||
2005 | if (changes[i].source) | |||
2006 | r = sd_bus_error_setf(error, BUS_ERROR_UNIT_EXISTS"org.freedesktop.systemd1.UnitExists", | |||
2007 | "File %s already exists and is a symlink to %s.", | |||
2008 | changes[i].path, changes[i].source); | |||
2009 | else | |||
2010 | r = sd_bus_error_setf(error, BUS_ERROR_UNIT_EXISTS"org.freedesktop.systemd1.UnitExists", | |||
2011 | "File %s already exists.", | |||
2012 | changes[i].path); | |||
2013 | goto found; | |||
2014 | ||||
2015 | case -ERFKILL132: | |||
2016 | r = sd_bus_error_setf(error, BUS_ERROR_UNIT_MASKED"org.freedesktop.systemd1.UnitMasked", | |||
2017 | "Unit file %s is masked.", changes[i].path); | |||
2018 | goto found; | |||
2019 | ||||
2020 | case -EADDRNOTAVAIL99: | |||
2021 | r = sd_bus_error_setf(error, BUS_ERROR_UNIT_GENERATED"org.freedesktop.systemd1.UnitGenerated", | |||
2022 | "Unit %s is transient or generated.", changes[i].path); | |||
2023 | goto found; | |||
2024 | ||||
2025 | case -ELOOP40: | |||
2026 | r = sd_bus_error_setf(error, BUS_ERROR_UNIT_LINKED"org.freedesktop.systemd1.UnitLinked", | |||
2027 | "Refusing to operate on linked unit file %s", changes[i].path); | |||
2028 | goto found; | |||
2029 | ||||
2030 | case -ENOENT2: | |||
2031 | r = sd_bus_error_setf(error, BUS_ERROR_NO_SUCH_UNIT"org.freedesktop.systemd1.NoSuchUnit", "Unit file %s does not exist.", changes[i].path); | |||
2032 | goto found; | |||
2033 | ||||
2034 | default: | |||
2035 | r = sd_bus_error_set_errnof(error, changes[i].type, "File %s: %m", changes[i].path); | |||
2036 | goto found; | |||
2037 | } | |||
2038 | ||||
2039 | r = c < 0 ? c : -EINVAL22; | |||
2040 | ||||
2041 | found: | |||
2042 | unit_file_changes_free(changes, n_changes); | |||
2043 | return r; | |||
2044 | } | |||
2045 | ||||
2046 | static int reply_unit_file_changes_and_free( | |||
2047 | Manager *m, | |||
2048 | sd_bus_message *message, | |||
2049 | int carries_install_info, | |||
2050 | UnitFileChange *changes, | |||
2051 | size_t n_changes, | |||
2052 | sd_bus_error *error) { | |||
2053 | ||||
2054 | _cleanup_(sd_bus_message_unrefp)__attribute__((cleanup(sd_bus_message_unrefp))) sd_bus_message *reply = NULL((void*)0); | |||
2055 | bool_Bool bad = false0, good = false0; | |||
2056 | size_t i; | |||
2057 | int r; | |||
2058 | ||||
2059 | if (unit_file_changes_have_modification(changes, n_changes)) { | |||
2060 | r = bus_foreach_bus(m, NULL((void*)0), send_unit_files_changed, NULL((void*)0)); | |||
2061 | if (r < 0) | |||
2062 | log_debug_errno(r, "Failed to send UnitFilesChanged signal: %m")({ int _level = ((7)), _e = ((r)), _realm = (LOG_REALM_SYSTEMD ); (log_get_max_level_realm(_realm) >= ((_level) & 0x07 )) ? log_internal_realm(((_realm) << 10 | (_level)), _e , "../src/core/dbus-manager.c", 2062, __func__, "Failed to send UnitFilesChanged signal: %m" ) : -abs(_e); }); | |||
2063 | } | |||
2064 | ||||
2065 | r = sd_bus_message_new_method_return(message, &reply); | |||
2066 | if (r < 0) | |||
2067 | goto fail; | |||
2068 | ||||
2069 | if (carries_install_info >= 0) { | |||
2070 | r = sd_bus_message_append(reply, "b", carries_install_info); | |||
2071 | if (r < 0) | |||
2072 | goto fail; | |||
2073 | } | |||
2074 | ||||
2075 | r = sd_bus_message_open_container(reply, 'a', "(sss)"); | |||
2076 | if (r < 0) | |||
2077 | goto fail; | |||
2078 | ||||
2079 | for (i = 0; i < n_changes; i++) { | |||
2080 | ||||
2081 | if (changes[i].type < 0) { | |||
2082 | bad = true1; | |||
2083 | continue; | |||
2084 | } | |||
2085 | ||||
2086 | r = sd_bus_message_append( | |||
2087 | reply, "(sss)", | |||
2088 | unit_file_change_type_to_string(changes[i].type), | |||
2089 | changes[i].path, | |||
2090 | changes[i].source); | |||
2091 | if (r < 0) | |||
2092 | goto fail; | |||
2093 | ||||
2094 | good = true1; | |||
2095 | } | |||
2096 | ||||
2097 | /* If there was a failed change, and no successful change, then return the first failure as proper method call | |||
2098 | * error. */ | |||
2099 | if (bad && !good) | |||
2100 | return install_error(error, 0, changes, n_changes); | |||
2101 | ||||
2102 | r = sd_bus_message_close_container(reply); | |||
2103 | if (r < 0) | |||
2104 | goto fail; | |||
2105 | ||||
2106 | unit_file_changes_free(changes, n_changes); | |||
2107 | return sd_bus_send(NULL((void*)0), reply, NULL((void*)0)); | |||
2108 | ||||
2109 | fail: | |||
2110 | unit_file_changes_free(changes, n_changes); | |||
2111 | return r; | |||
2112 | } | |||
2113 | ||||
2114 | static int method_enable_unit_files_generic( | |||
2115 | sd_bus_message *message, | |||
2116 | Manager *m, | |||
2117 | int (*call)(UnitFileScope scope, UnitFileFlags flags, const char *root_dir, char *files[], UnitFileChange **changes, size_t *n_changes), | |||
2118 | bool_Bool carries_install_info, | |||
2119 | sd_bus_error *error) { | |||
2120 | ||||
2121 | _cleanup_strv_free___attribute__((cleanup(strv_freep))) char **l = NULL((void*)0); | |||
2122 | UnitFileChange *changes = NULL((void*)0); | |||
2123 | size_t n_changes = 0; | |||
2124 | UnitFileFlags flags; | |||
2125 | int runtime, force, r; | |||
2126 | ||||
2127 | assert(message)do { if ((__builtin_expect(!!(!(message)),0))) log_assert_failed_realm (LOG_REALM_SYSTEMD, ("message"), "../src/core/dbus-manager.c" , 2127, __PRETTY_FUNCTION__); } while (0); | |||
2128 | assert(m)do { if ((__builtin_expect(!!(!(m)),0))) log_assert_failed_realm (LOG_REALM_SYSTEMD, ("m"), "../src/core/dbus-manager.c", 2128 , __PRETTY_FUNCTION__); } while (0); | |||
2129 | ||||
2130 | r = sd_bus_message_read_strv(message, &l); | |||
2131 | if (r < 0) | |||
2132 | return r; | |||
2133 | ||||
2134 | r = sd_bus_message_read(message, "bb", &runtime, &force); | |||
2135 | if (r < 0) | |||
2136 | return r; | |||
2137 | ||||
2138 | flags = unit_file_bools_to_flags(runtime, force); | |||
2139 | ||||
2140 | r = bus_verify_manage_unit_files_async(m, message, error); | |||
2141 | if (r < 0) | |||
2142 | return r; | |||
2143 | if (r == 0) | |||
2144 | return 1; /* No authorization for now, but the async polkit stuff will call us again when it has it */ | |||
2145 | ||||
2146 | r = call(m->unit_file_scope, flags, NULL((void*)0), l, &changes, &n_changes); | |||
2147 | if (r < 0) | |||
2148 | return install_error(error, r, changes, n_changes); | |||
2149 | ||||
2150 | return reply_unit_file_changes_and_free(m, message, carries_install_info ? r : -1, changes, n_changes, error); | |||
2151 | } | |||
2152 | ||||
2153 | static int method_enable_unit_files(sd_bus_message *message, void *userdata, sd_bus_error *error) { | |||
2154 | return method_enable_unit_files_generic(message, userdata, unit_file_enable, true1, error); | |||
2155 | } | |||
2156 | ||||
2157 | static int method_reenable_unit_files(sd_bus_message *message, void *userdata, sd_bus_error *error) { | |||
2158 | return method_enable_unit_files_generic(message, userdata, unit_file_reenable, true1, error); | |||
2159 | } | |||
2160 | ||||
2161 | static int method_link_unit_files(sd_bus_message *message, void *userdata, sd_bus_error *error) { | |||
2162 | return method_enable_unit_files_generic(message, userdata, unit_file_link, false0, error); | |||
2163 | } | |||
2164 | ||||
2165 | static int unit_file_preset_without_mode(UnitFileScope scope, UnitFileFlags flags, const char *root_dir, char **files, UnitFileChange **changes, size_t *n_changes) { | |||
2166 | return unit_file_preset(scope, flags, root_dir, files, UNIT_FILE_PRESET_FULL, changes, n_changes); | |||
2167 | } | |||
2168 | ||||
2169 | static int method_preset_unit_files(sd_bus_message *message, void *userdata, sd_bus_error *error) { | |||
2170 | return method_enable_unit_files_generic(message, userdata, unit_file_preset_without_mode, true1, error); | |||
2171 | } | |||
2172 | ||||
2173 | static int method_mask_unit_files(sd_bus_message *message, void *userdata, sd_bus_error *error) { | |||
2174 | return method_enable_unit_files_generic(message, userdata, unit_file_mask, false0, error); | |||
2175 | } | |||
2176 | ||||
2177 | static int method_preset_unit_files_with_mode(sd_bus_message *message, void *userdata, sd_bus_error *error) { | |||
2178 | ||||
2179 | _cleanup_strv_free___attribute__((cleanup(strv_freep))) char **l = NULL((void*)0); | |||
2180 | UnitFileChange *changes = NULL((void*)0); | |||
2181 | size_t n_changes = 0; | |||
2182 | Manager *m = userdata; | |||
2183 | UnitFilePresetMode mm; | |||
2184 | int runtime, force, r; | |||
2185 | UnitFileFlags flags; | |||
2186 | const char *mode; | |||
2187 | ||||
2188 | assert(message)do { if ((__builtin_expect(!!(!(message)),0))) log_assert_failed_realm (LOG_REALM_SYSTEMD, ("message"), "../src/core/dbus-manager.c" , 2188, __PRETTY_FUNCTION__); } while (0); | |||
2189 | assert(m)do { if ((__builtin_expect(!!(!(m)),0))) log_assert_failed_realm (LOG_REALM_SYSTEMD, ("m"), "../src/core/dbus-manager.c", 2189 , __PRETTY_FUNCTION__); } while (0); | |||
2190 | ||||
2191 | r = sd_bus_message_read_strv(message, &l); | |||
2192 | if (r < 0) | |||
2193 | return r; | |||
2194 | ||||
2195 | r = sd_bus_message_read(message, "sbb", &mode, &runtime, &force); | |||
2196 | if (r < 0) | |||
2197 | return r; | |||
2198 | ||||
2199 | flags = unit_file_bools_to_flags(runtime, force); | |||
2200 | ||||
2201 | if (isempty(mode)) | |||
2202 | mm = UNIT_FILE_PRESET_FULL; | |||
2203 | else { | |||
2204 | mm = unit_file_preset_mode_from_string(mode); | |||
2205 | if (mm < 0) | |||
2206 | return -EINVAL22; | |||
2207 | } | |||
2208 | ||||
2209 | r = bus_verify_manage_unit_files_async(m, message, error); | |||
2210 | if (r < 0) | |||
2211 | return r; | |||
2212 | if (r == 0) | |||
2213 | return 1; /* No authorization for now, but the async polkit stuff will call us again when it has it */ | |||
2214 | ||||
2215 | r = unit_file_preset(m->unit_file_scope, flags, NULL((void*)0), l, mm, &changes, &n_changes); | |||
2216 | if (r < 0) | |||
2217 | return install_error(error, r, changes, n_changes); | |||
2218 | ||||
2219 | return reply_unit_file_changes_and_free(m, message, r, changes, n_changes, error); | |||
2220 | } | |||
2221 | ||||
2222 | static int method_disable_unit_files_generic( | |||
2223 | sd_bus_message *message, | |||
2224 | Manager *m, | |||
2225 | int (*call)(UnitFileScope scope, UnitFileFlags flags, const char *root_dir, char *files[], UnitFileChange **changes, size_t *n_changes), | |||
2226 | sd_bus_error *error) { | |||
2227 | ||||
2228 | _cleanup_strv_free___attribute__((cleanup(strv_freep))) char **l = NULL((void*)0); | |||
2229 | UnitFileChange *changes = NULL((void*)0); | |||
2230 | size_t n_changes = 0; | |||
2231 | int r, runtime; | |||
2232 | ||||
2233 | assert(message)do { if ((__builtin_expect(!!(!(message)),0))) log_assert_failed_realm (LOG_REALM_SYSTEMD, ("message"), "../src/core/dbus-manager.c" , 2233, __PRETTY_FUNCTION__); } while (0); | |||
2234 | assert(m)do { if ((__builtin_expect(!!(!(m)),0))) log_assert_failed_realm (LOG_REALM_SYSTEMD, ("m"), "../src/core/dbus-manager.c", 2234 , __PRETTY_FUNCTION__); } while (0); | |||
2235 | ||||
2236 | r = sd_bus_message_read_strv(message, &l); | |||
2237 | if (r < 0) | |||
2238 | return r; | |||
2239 | ||||
2240 | r = sd_bus_message_read(message, "b", &runtime); | |||
2241 | if (r < 0) | |||
2242 | return r; | |||
2243 | ||||
2244 | r = bus_verify_manage_unit_files_async(m, message, error); | |||
2245 | if (r < 0) | |||
2246 | return r; | |||
2247 | if (r == 0) | |||
2248 | return 1; /* No authorization for now, but the async polkit stuff will call us again when it has it */ | |||
2249 | ||||
2250 | r = call(m->unit_file_scope, runtime ? UNIT_FILE_RUNTIME : 0, NULL((void*)0), l, &changes, &n_changes); | |||
2251 | if (r < 0) | |||
2252 | return install_error(error, r, changes, n_changes); | |||
2253 | ||||
2254 | return reply_unit_file_changes_and_free(m, message, -1, changes, n_changes, error); | |||
2255 | } | |||
2256 | ||||
2257 | static int method_disable_unit_files(sd_bus_message *message, void *userdata, sd_bus_error *error) { | |||
2258 | return method_disable_unit_files_generic(message, userdata, unit_file_disable, error); | |||
2259 | } | |||
2260 | ||||
2261 | static int method_unmask_unit_files(sd_bus_message *message, void *userdata, sd_bus_error *error) { | |||
2262 | return method_disable_unit_files_generic(message, userdata, unit_file_unmask, error); | |||
2263 | } | |||
2264 | ||||
2265 | static int method_revert_unit_files(sd_bus_message *message, void *userdata, sd_bus_error *error) { | |||
2266 | _cleanup_strv_free___attribute__((cleanup(strv_freep))) char **l = NULL((void*)0); | |||
2267 | UnitFileChange *changes = NULL((void*)0); | |||
2268 | size_t n_changes = 0; | |||
2269 | Manager *m = userdata; | |||
2270 | int r; | |||
2271 | ||||
2272 | assert(message)do { if ((__builtin_expect(!!(!(message)),0))) log_assert_failed_realm (LOG_REALM_SYSTEMD, ("message"), "../src/core/dbus-manager.c" , 2272, __PRETTY_FUNCTION__); } while (0); | |||
2273 | assert(m)do { if ((__builtin_expect(!!(!(m)),0))) log_assert_failed_realm (LOG_REALM_SYSTEMD, ("m"), "../src/core/dbus-manager.c", 2273 , __PRETTY_FUNCTION__); } while (0); | |||
2274 | ||||
2275 | r = sd_bus_message_read_strv(message, &l); | |||
2276 | if (r < 0) | |||
2277 | return r; | |||
2278 | ||||
2279 | r = bus_verify_manage_unit_files_async(m, message, error); | |||
2280 | if (r < 0) | |||
2281 | return r; | |||
2282 | if (r == 0) | |||
2283 | return 1; /* No authorization for now, but the async polkit stuff will call us again when it has it */ | |||
2284 | ||||
2285 | r = unit_file_revert(m->unit_file_scope, NULL((void*)0), l, &changes, &n_changes); | |||
2286 | if (r < 0) | |||
2287 | return install_error(error, r, changes, n_changes); | |||
2288 | ||||
2289 | return reply_unit_file_changes_and_free(m, message, -1, changes, n_changes, error); | |||
2290 | } | |||
2291 | ||||
2292 | static int method_set_default_target(sd_bus_message *message, void *userdata, sd_bus_error *error) { | |||
2293 | UnitFileChange *changes = NULL((void*)0); | |||
2294 | size_t n_changes = 0; | |||
2295 | Manager *m = userdata; | |||
2296 | const char *name; | |||
2297 | int force, r; | |||
2298 | ||||
2299 | assert(message)do { if ((__builtin_expect(!!(!(message)),0))) log_assert_failed_realm (LOG_REALM_SYSTEMD, ("message"), "../src/core/dbus-manager.c" , 2299, __PRETTY_FUNCTION__); } while (0); | |||
2300 | assert(m)do { if ((__builtin_expect(!!(!(m)),0))) log_assert_failed_realm (LOG_REALM_SYSTEMD, ("m"), "../src/core/dbus-manager.c", 2300 , __PRETTY_FUNCTION__); } while (0); | |||
2301 | ||||
2302 | r = mac_selinux_access_check(message, "enable", error)mac_selinux_generic_access_check((message), ((void*)0), ("enable" ), (error)); | |||
2303 | if (r < 0) | |||
2304 | return r; | |||
2305 | ||||
2306 | r = sd_bus_message_read(message, "sb", &name, &force); | |||
2307 | if (r < 0) | |||
2308 | return r; | |||
2309 | ||||
2310 | r = bus_verify_manage_unit_files_async(m, message, error); | |||
2311 | if (r < 0) | |||
2312 | return r; | |||
2313 | if (r == 0) | |||
2314 | return 1; /* No authorization for now, but the async polkit stuff will call us again when it has it */ | |||
2315 | ||||
2316 | r = unit_file_set_default(m->unit_file_scope, force ? UNIT_FILE_FORCE : 0, NULL((void*)0), name, &changes, &n_changes); | |||
2317 | if (r < 0) | |||
2318 | return install_error(error, r, changes, n_changes); | |||
2319 | ||||
2320 | return reply_unit_file_changes_and_free(m, message, -1, changes, n_changes, error); | |||
2321 | } | |||
2322 | ||||
2323 | static int method_preset_all_unit_files(sd_bus_message *message, void *userdata, sd_bus_error *error) { | |||
2324 | UnitFileChange *changes = NULL((void*)0); | |||
2325 | size_t n_changes = 0; | |||
2326 | Manager *m = userdata; | |||
2327 | UnitFilePresetMode mm; | |||
2328 | const char *mode; | |||
2329 | UnitFileFlags flags; | |||
2330 | int force, runtime, r; | |||
2331 | ||||
2332 | assert(message)do { if ((__builtin_expect(!!(!(message)),0))) log_assert_failed_realm (LOG_REALM_SYSTEMD, ("message"), "../src/core/dbus-manager.c" , 2332, __PRETTY_FUNCTION__); } while (0); | |||
2333 | assert(m)do { if ((__builtin_expect(!!(!(m)),0))) log_assert_failed_realm (LOG_REALM_SYSTEMD, ("m"), "../src/core/dbus-manager.c", 2333 , __PRETTY_FUNCTION__); } while (0); | |||
2334 | ||||
2335 | r = mac_selinux_access_check(message, "enable", error)mac_selinux_generic_access_check((message), ((void*)0), ("enable" ), (error)); | |||
2336 | if (r < 0) | |||
2337 | return r; | |||
2338 | ||||
2339 | r = sd_bus_message_read(message, "sbb", &mode, &runtime, &force); | |||
2340 | if (r < 0) | |||
2341 | return r; | |||
2342 | ||||
2343 | flags = unit_file_bools_to_flags(runtime, force); | |||
2344 | ||||
2345 | if (isempty(mode)) | |||
2346 | mm = UNIT_FILE_PRESET_FULL; | |||
2347 | else { | |||
2348 | mm = unit_file_preset_mode_from_string(mode); | |||
2349 | if (mm < 0) | |||
2350 | return -EINVAL22; | |||
2351 | } | |||
2352 | ||||
2353 | r = bus_verify_manage_unit_files_async(m, message, error); | |||
2354 | if (r < 0) | |||
2355 | return r; | |||
2356 | if (r == 0) | |||
2357 | return 1; /* No authorization for now, but the async polkit stuff will call us again when it has it */ | |||
2358 | ||||
2359 | r = unit_file_preset_all(m->unit_file_scope, flags, NULL((void*)0), mm, &changes, &n_changes); | |||
2360 | if (r < 0) | |||
2361 | return install_error(error, r, changes, n_changes); | |||
2362 | ||||
2363 | return reply_unit_file_changes_and_free(m, message, -1, changes, n_changes, error); | |||
2364 | } | |||
2365 | ||||
2366 | static int method_add_dependency_unit_files(sd_bus_message *message, void *userdata, sd_bus_error *error) { | |||
2367 | _cleanup_strv_free___attribute__((cleanup(strv_freep))) char **l = NULL((void*)0); | |||
2368 | Manager *m = userdata; | |||
2369 | UnitFileChange *changes = NULL((void*)0); | |||
2370 | size_t n_changes = 0; | |||
2371 | int runtime, force, r; | |||
2372 | char *target, *type; | |||
2373 | UnitDependency dep; | |||
2374 | UnitFileFlags flags; | |||
2375 | ||||
2376 | assert(message)do { if ((__builtin_expect(!!(!(message)),0))) log_assert_failed_realm (LOG_REALM_SYSTEMD, ("message"), "../src/core/dbus-manager.c" , 2376, __PRETTY_FUNCTION__); } while (0); | |||
2377 | assert(m)do { if ((__builtin_expect(!!(!(m)),0))) log_assert_failed_realm (LOG_REALM_SYSTEMD, ("m"), "../src/core/dbus-manager.c", 2377 , __PRETTY_FUNCTION__); } while (0); | |||
2378 | ||||
2379 | r = bus_verify_manage_unit_files_async(m, message, error); | |||
2380 | if (r < 0) | |||
2381 | return r; | |||
2382 | if (r == 0) | |||
2383 | return 1; /* No authorization for now, but the async polkit stuff will call us again when it has it */ | |||
2384 | ||||
2385 | r = sd_bus_message_read_strv(message, &l); | |||
2386 | if (r < 0) | |||
2387 | return r; | |||
2388 | ||||
2389 | r = sd_bus_message_read(message, "ssbb", &target, &type, &runtime, &force); | |||
2390 | if (r < 0) | |||
2391 | return r; | |||
2392 | ||||
2393 | flags = unit_file_bools_to_flags(runtime, force); | |||
2394 | ||||
2395 | dep = unit_dependency_from_string(type); | |||
2396 | if (dep < 0) | |||
2397 | return -EINVAL22; | |||
2398 | ||||
2399 | r = unit_file_add_dependency(m->unit_file_scope, flags, NULL((void*)0), l, target, dep, &changes, &n_changes); | |||
2400 | if (r < 0) | |||
2401 | return install_error(error, r, changes, n_changes); | |||
2402 | ||||
2403 | return reply_unit_file_changes_and_free(m, message, -1, changes, n_changes, error); | |||
2404 | } | |||
2405 | ||||
2406 | static int method_get_unit_file_links(sd_bus_message *message, void *userdata, sd_bus_error *error) { | |||
2407 | _cleanup_(sd_bus_message_unrefp)__attribute__((cleanup(sd_bus_message_unrefp))) sd_bus_message *reply = NULL((void*)0); | |||
2408 | UnitFileChange *changes = NULL((void*)0); | |||
2409 | size_t n_changes = 0, i; | |||
2410 | UnitFileFlags flags; | |||
2411 | const char *name; | |||
2412 | char **p; | |||
2413 | int runtime, r; | |||
2414 | ||||
2415 | r = sd_bus_message_read(message, "sb", &name, &runtime); | |||
2416 | if (r < 0) | |||
2417 | return r; | |||
2418 | ||||
2419 | r = sd_bus_message_new_method_return(message, &reply); | |||
2420 | if (r < 0) | |||
2421 | return r; | |||
2422 | ||||
2423 | r = sd_bus_message_open_container(reply, SD_BUS_TYPE_ARRAY, "s"); | |||
2424 | if (r < 0) | |||
2425 | return r; | |||
2426 | ||||
2427 | p = STRV_MAKE(name)((char**) ((const char*[]) { name, ((void*)0) })); | |||
2428 | flags = UNIT_FILE_DRY_RUN | | |||
2429 | (runtime ? UNIT_FILE_RUNTIME : 0); | |||
2430 | ||||
2431 | r = unit_file_disable(UNIT_FILE_SYSTEM, flags, NULL((void*)0), p, &changes, &n_changes); | |||
2432 | if (r < 0) | |||
2433 | return log_error_errno(r, "Failed to get file links for %s: %m", name)({ int _level = ((3)), _e = ((r)), _realm = (LOG_REALM_SYSTEMD ); (log_get_max_level_realm(_realm) >= ((_level) & 0x07 )) ? log_internal_realm(((_realm) << 10 | (_level)), _e , "../src/core/dbus-manager.c", 2433, __func__, "Failed to get file links for %s: %m" , name) : -abs(_e); }); | |||
2434 | ||||
2435 | for (i = 0; i < n_changes; i++) | |||
2436 | if (changes[i].type == UNIT_FILE_UNLINK) { | |||
2437 | r = sd_bus_message_append(reply, "s", changes[i].path); | |||
2438 | if (r < 0) | |||
2439 | return r; | |||
2440 | } | |||
2441 | ||||
2442 | r = sd_bus_message_close_container(reply); | |||
2443 | if (r < 0) | |||
2444 | return r; | |||
2445 | ||||
2446 | return sd_bus_send(NULL((void*)0), reply, NULL((void*)0)); | |||
2447 | } | |||
2448 | ||||
2449 | static int method_get_job_waiting(sd_bus_message *message, void *userdata, sd_bus_error *error) { | |||
2450 | Manager *m = userdata; | |||
2451 | uint32_t id; | |||
2452 | Job *j; | |||
2453 | int r; | |||
2454 | ||||
2455 | assert(message)do { if ((__builtin_expect(!!(!(message)),0))) log_assert_failed_realm (LOG_REALM_SYSTEMD, ("message"), "../src/core/dbus-manager.c" , 2455, __PRETTY_FUNCTION__); } while (0); | |||
2456 | assert(m)do { if ((__builtin_expect(!!(!(m)),0))) log_assert_failed_realm (LOG_REALM_SYSTEMD, ("m"), "../src/core/dbus-manager.c", 2456 , __PRETTY_FUNCTION__); } while (0); | |||
2457 | ||||
2458 | r = sd_bus_message_read(message, "u", &id); | |||
2459 | if (r < 0) | |||
2460 | return r; | |||
2461 | ||||
2462 | j = manager_get_job(m, id); | |||
2463 | if (!j) | |||
2464 | return sd_bus_error_setf(error, BUS_ERROR_NO_SUCH_JOB"org.freedesktop.systemd1.NoSuchJob", "Job %u does not exist.", (unsigned) id); | |||
2465 | ||||
2466 | return bus_job_method_get_waiting_jobs(message, j, error); | |||
2467 | } | |||
2468 | ||||
2469 | const sd_bus_vtable bus_manager_vtable[] = { | |||
2470 | SD_BUS_VTABLE_START(0){ .type = _SD_BUS_VTABLE_START, .flags = 0, .x = { .start = { .element_size = sizeof(sd_bus_vtable) }, }, }, | |||
2471 | ||||
2472 | SD_BUS_PROPERTY("Version", "s", property_get_version, 0, SD_BUS_VTABLE_PROPERTY_CONST){ .type = _SD_BUS_VTABLE_PROPERTY, .flags = SD_BUS_VTABLE_PROPERTY_CONST , .x = { .property = { .member = "Version", .signature = "s", .get = property_get_version, .set = ((void*)0), .offset = 0, }, }, }, | |||
2473 | SD_BUS_PROPERTY("Features", "s", property_get_features, 0, SD_BUS_VTABLE_PROPERTY_CONST){ .type = _SD_BUS_VTABLE_PROPERTY, .flags = SD_BUS_VTABLE_PROPERTY_CONST , .x = { .property = { .member = "Features", .signature = "s" , .get = property_get_features, .set = ((void*)0), .offset = 0 , }, }, }, | |||
2474 | SD_BUS_PROPERTY("Virtualization", "s", property_get_virtualization, 0, SD_BUS_VTABLE_PROPERTY_CONST){ .type = _SD_BUS_VTABLE_PROPERTY, .flags = SD_BUS_VTABLE_PROPERTY_CONST , .x = { .property = { .member = "Virtualization", .signature = "s", .get = property_get_virtualization, .set = ((void*)0) , .offset = 0, }, }, }, | |||
2475 | SD_BUS_PROPERTY("Architecture", "s", property_get_architecture, 0, SD_BUS_VTABLE_PROPERTY_CONST){ .type = _SD_BUS_VTABLE_PROPERTY, .flags = SD_BUS_VTABLE_PROPERTY_CONST , .x = { .property = { .member = "Architecture", .signature = "s", .get = property_get_architecture, .set = ((void*)0), .offset = 0, }, }, }, | |||
2476 | SD_BUS_PROPERTY("Tainted", "s", property_get_tainted, 0, SD_BUS_VTABLE_PROPERTY_CONST){ .type = _SD_BUS_VTABLE_PROPERTY, .flags = SD_BUS_VTABLE_PROPERTY_CONST , .x = { .property = { .member = "Tainted", .signature = "s", .get = property_get_tainted, .set = ((void*)0), .offset = 0, }, }, }, | |||
2477 | BUS_PROPERTY_DUAL_TIMESTAMP("FirmwareTimestamp", offsetof(Manager, timestamps[MANAGER_TIMESTAMP_FIRMWARE]), SD_BUS_VTABLE_PROPERTY_CONST){ .type = _SD_BUS_VTABLE_PROPERTY, .flags = (SD_BUS_VTABLE_PROPERTY_CONST ), .x = { .property = { .member = "FirmwareTimestamp", .signature = "t", .get = ((sd_bus_property_get_t) ((void*)0)), .set = ( (void*)0), .offset = (__builtin_offsetof(Manager, timestamps[ MANAGER_TIMESTAMP_FIRMWARE])) + __builtin_offsetof(struct dual_timestamp , realtime), }, }, }, { .type = _SD_BUS_VTABLE_PROPERTY, .flags = (SD_BUS_VTABLE_PROPERTY_CONST), .x = { .property = { .member = "FirmwareTimestamp" "Monotonic", .signature = "t", .get = ( (sd_bus_property_get_t) ((void*)0)), .set = ((void*)0), .offset = (__builtin_offsetof(Manager, timestamps[MANAGER_TIMESTAMP_FIRMWARE ])) + __builtin_offsetof(struct dual_timestamp, monotonic), } , }, }, | |||
2478 | BUS_PROPERTY_DUAL_TIMESTAMP("LoaderTimestamp", offsetof(Manager, timestamps[MANAGER_TIMESTAMP_LOADER]), SD_BUS_VTABLE_PROPERTY_CONST){ .type = _SD_BUS_VTABLE_PROPERTY, .flags = (SD_BUS_VTABLE_PROPERTY_CONST ), .x = { .property = { .member = "LoaderTimestamp", .signature = "t", .get = ((sd_bus_property_get_t) ((void*)0)), .set = ( (void*)0), .offset = (__builtin_offsetof(Manager, timestamps[ MANAGER_TIMESTAMP_LOADER])) + __builtin_offsetof(struct dual_timestamp , realtime), }, }, }, { .type = _SD_BUS_VTABLE_PROPERTY, .flags = (SD_BUS_VTABLE_PROPERTY_CONST), .x = { .property = { .member = "LoaderTimestamp" "Monotonic", .signature = "t", .get = (( sd_bus_property_get_t) ((void*)0)), .set = ((void*)0), .offset = (__builtin_offsetof(Manager, timestamps[MANAGER_TIMESTAMP_LOADER ])) + __builtin_offsetof(struct dual_timestamp, monotonic), } , }, }, | |||
2479 | BUS_PROPERTY_DUAL_TIMESTAMP("KernelTimestamp", offsetof(Manager, timestamps[MANAGER_TIMESTAMP_KERNEL]), SD_BUS_VTABLE_PROPERTY_CONST){ .type = _SD_BUS_VTABLE_PROPERTY, .flags = (SD_BUS_VTABLE_PROPERTY_CONST ), .x = { .property = { .member = "KernelTimestamp", .signature = "t", .get = ((sd_bus_property_get_t) ((void*)0)), .set = ( (void*)0), .offset = (__builtin_offsetof(Manager, timestamps[ MANAGER_TIMESTAMP_KERNEL])) + __builtin_offsetof(struct dual_timestamp , realtime), }, }, }, { .type = _SD_BUS_VTABLE_PROPERTY, .flags = (SD_BUS_VTABLE_PROPERTY_CONST), .x = { .property = { .member = "KernelTimestamp" "Monotonic", .signature = "t", .get = (( sd_bus_property_get_t) ((void*)0)), .set = ((void*)0), .offset = (__builtin_offsetof(Manager, timestamps[MANAGER_TIMESTAMP_KERNEL ])) + __builtin_offsetof(struct dual_timestamp, monotonic), } , }, }, | |||
2480 | BUS_PROPERTY_DUAL_TIMESTAMP("InitRDTimestamp", offsetof(Manager, timestamps[MANAGER_TIMESTAMP_INITRD]), SD_BUS_VTABLE_PROPERTY_CONST){ .type = _SD_BUS_VTABLE_PROPERTY, .flags = (SD_BUS_VTABLE_PROPERTY_CONST ), .x = { .property = { .member = "InitRDTimestamp", .signature = "t", .get = ((sd_bus_property_get_t) ((void*)0)), .set = ( (void*)0), .offset = (__builtin_offsetof(Manager, timestamps[ MANAGER_TIMESTAMP_INITRD])) + __builtin_offsetof(struct dual_timestamp , realtime), }, }, }, { .type = _SD_BUS_VTABLE_PROPERTY, .flags = (SD_BUS_VTABLE_PROPERTY_CONST), .x = { .property = { .member = "InitRDTimestamp" "Monotonic", .signature = "t", .get = (( sd_bus_property_get_t) ((void*)0)), .set = ((void*)0), .offset = (__builtin_offsetof(Manager, timestamps[MANAGER_TIMESTAMP_INITRD ])) + __builtin_offsetof(struct dual_timestamp, monotonic), } , }, }, | |||
2481 | BUS_PROPERTY_DUAL_TIMESTAMP("UserspaceTimestamp", offsetof(Manager, timestamps[MANAGER_TIMESTAMP_USERSPACE]), SD_BUS_VTABLE_PROPERTY_CONST){ .type = _SD_BUS_VTABLE_PROPERTY, .flags = (SD_BUS_VTABLE_PROPERTY_CONST ), .x = { .property = { .member = "UserspaceTimestamp", .signature = "t", .get = ((sd_bus_property_get_t) ((void*)0)), .set = ( (void*)0), .offset = (__builtin_offsetof(Manager, timestamps[ MANAGER_TIMESTAMP_USERSPACE])) + __builtin_offsetof(struct dual_timestamp , realtime), }, }, }, { .type = _SD_BUS_VTABLE_PROPERTY, .flags = (SD_BUS_VTABLE_PROPERTY_CONST), .x = { .property = { .member = "UserspaceTimestamp" "Monotonic", .signature = "t", .get = ((sd_bus_property_get_t) ((void*)0)), .set = ((void*)0), .offset = (__builtin_offsetof(Manager, timestamps[MANAGER_TIMESTAMP_USERSPACE ])) + __builtin_offsetof(struct dual_timestamp, monotonic), } , }, }, | |||
2482 | BUS_PROPERTY_DUAL_TIMESTAMP("FinishTimestamp", offsetof(Manager, timestamps[MANAGER_TIMESTAMP_FINISH]), SD_BUS_VTABLE_PROPERTY_CONST){ .type = _SD_BUS_VTABLE_PROPERTY, .flags = (SD_BUS_VTABLE_PROPERTY_CONST ), .x = { .property = { .member = "FinishTimestamp", .signature = "t", .get = ((sd_bus_property_get_t) ((void*)0)), .set = ( (void*)0), .offset = (__builtin_offsetof(Manager, timestamps[ MANAGER_TIMESTAMP_FINISH])) + __builtin_offsetof(struct dual_timestamp , realtime), }, }, }, { .type = _SD_BUS_VTABLE_PROPERTY, .flags = (SD_BUS_VTABLE_PROPERTY_CONST), .x = { .property = { .member = "FinishTimestamp" "Monotonic", .signature = "t", .get = (( sd_bus_property_get_t) ((void*)0)), .set = ((void*)0), .offset = (__builtin_offsetof(Manager, timestamps[MANAGER_TIMESTAMP_FINISH ])) + __builtin_offsetof(struct dual_timestamp, monotonic), } , }, }, | |||
2483 | BUS_PROPERTY_DUAL_TIMESTAMP("SecurityStartTimestamp", offsetof(Manager, timestamps[MANAGER_TIMESTAMP_SECURITY_START]), SD_BUS_VTABLE_PROPERTY_CONST){ .type = _SD_BUS_VTABLE_PROPERTY, .flags = (SD_BUS_VTABLE_PROPERTY_CONST ), .x = { .property = { .member = "SecurityStartTimestamp", . signature = "t", .get = ((sd_bus_property_get_t) ((void*)0)), .set = ((void*)0), .offset = (__builtin_offsetof(Manager, timestamps [MANAGER_TIMESTAMP_SECURITY_START])) + __builtin_offsetof(struct dual_timestamp, realtime), }, }, }, { .type = _SD_BUS_VTABLE_PROPERTY , .flags = (SD_BUS_VTABLE_PROPERTY_CONST), .x = { .property = { .member = "SecurityStartTimestamp" "Monotonic", .signature = "t", .get = ((sd_bus_property_get_t) ((void*)0)), .set = ( (void*)0), .offset = (__builtin_offsetof(Manager, timestamps[ MANAGER_TIMESTAMP_SECURITY_START])) + __builtin_offsetof(struct dual_timestamp, monotonic), }, }, }, | |||
2484 | BUS_PROPERTY_DUAL_TIMESTAMP("SecurityFinishTimestamp", offsetof(Manager, timestamps[MANAGER_TIMESTAMP_SECURITY_FINISH]), SD_BUS_VTABLE_PROPERTY_CONST){ .type = _SD_BUS_VTABLE_PROPERTY, .flags = (SD_BUS_VTABLE_PROPERTY_CONST ), .x = { .property = { .member = "SecurityFinishTimestamp", . signature = "t", .get = ((sd_bus_property_get_t) ((void*)0)), .set = ((void*)0), .offset = (__builtin_offsetof(Manager, timestamps [MANAGER_TIMESTAMP_SECURITY_FINISH])) + __builtin_offsetof(struct dual_timestamp, realtime), }, }, }, { .type = _SD_BUS_VTABLE_PROPERTY , .flags = (SD_BUS_VTABLE_PROPERTY_CONST), .x = { .property = { .member = "SecurityFinishTimestamp" "Monotonic", .signature = "t", .get = ((sd_bus_property_get_t) ((void*)0)), .set = ( (void*)0), .offset = (__builtin_offsetof(Manager, timestamps[ MANAGER_TIMESTAMP_SECURITY_FINISH])) + __builtin_offsetof(struct dual_timestamp, monotonic), }, }, }, | |||
2485 | BUS_PROPERTY_DUAL_TIMESTAMP("GeneratorsStartTimestamp", offsetof(Manager, timestamps[MANAGER_TIMESTAMP_GENERATORS_START]), SD_BUS_VTABLE_PROPERTY_CONST){ .type = _SD_BUS_VTABLE_PROPERTY, .flags = (SD_BUS_VTABLE_PROPERTY_CONST ), .x = { .property = { .member = "GeneratorsStartTimestamp", .signature = "t", .get = ((sd_bus_property_get_t) ((void*)0) ), .set = ((void*)0), .offset = (__builtin_offsetof(Manager, timestamps [MANAGER_TIMESTAMP_GENERATORS_START])) + __builtin_offsetof(struct dual_timestamp, realtime), }, }, }, { .type = _SD_BUS_VTABLE_PROPERTY , .flags = (SD_BUS_VTABLE_PROPERTY_CONST), .x = { .property = { .member = "GeneratorsStartTimestamp" "Monotonic", .signature = "t", .get = ((sd_bus_property_get_t) ((void*)0)), .set = ( (void*)0), .offset = (__builtin_offsetof(Manager, timestamps[ MANAGER_TIMESTAMP_GENERATORS_START])) + __builtin_offsetof(struct dual_timestamp, monotonic), }, }, }, | |||
2486 | BUS_PROPERTY_DUAL_TIMESTAMP("GeneratorsFinishTimestamp", offsetof(Manager, timestamps[MANAGER_TIMESTAMP_GENERATORS_FINISH]), SD_BUS_VTABLE_PROPERTY_CONST){ .type = _SD_BUS_VTABLE_PROPERTY, .flags = (SD_BUS_VTABLE_PROPERTY_CONST ), .x = { .property = { .member = "GeneratorsFinishTimestamp" , .signature = "t", .get = ((sd_bus_property_get_t) ((void*)0 )), .set = ((void*)0), .offset = (__builtin_offsetof(Manager, timestamps[MANAGER_TIMESTAMP_GENERATORS_FINISH])) + __builtin_offsetof (struct dual_timestamp, realtime), }, }, }, { .type = _SD_BUS_VTABLE_PROPERTY , .flags = (SD_BUS_VTABLE_PROPERTY_CONST), .x = { .property = { .member = "GeneratorsFinishTimestamp" "Monotonic", .signature = "t", .get = ((sd_bus_property_get_t) ((void*)0)), .set = ( (void*)0), .offset = (__builtin_offsetof(Manager, timestamps[ MANAGER_TIMESTAMP_GENERATORS_FINISH])) + __builtin_offsetof(struct dual_timestamp, monotonic), }, }, }, | |||
2487 | BUS_PROPERTY_DUAL_TIMESTAMP("UnitsLoadStartTimestamp", offsetof(Manager, timestamps[MANAGER_TIMESTAMP_UNITS_LOAD_START]), SD_BUS_VTABLE_PROPERTY_CONST){ .type = _SD_BUS_VTABLE_PROPERTY, .flags = (SD_BUS_VTABLE_PROPERTY_CONST ), .x = { .property = { .member = "UnitsLoadStartTimestamp", . signature = "t", .get = ((sd_bus_property_get_t) ((void*)0)), .set = ((void*)0), .offset = (__builtin_offsetof(Manager, timestamps [MANAGER_TIMESTAMP_UNITS_LOAD_START])) + __builtin_offsetof(struct dual_timestamp, realtime), }, }, }, { .type = _SD_BUS_VTABLE_PROPERTY , .flags = (SD_BUS_VTABLE_PROPERTY_CONST), .x = { .property = { .member = "UnitsLoadStartTimestamp" "Monotonic", .signature = "t", .get = ((sd_bus_property_get_t) ((void*)0)), .set = ( (void*)0), .offset = (__builtin_offsetof(Manager, timestamps[ MANAGER_TIMESTAMP_UNITS_LOAD_START])) + __builtin_offsetof(struct dual_timestamp, monotonic), }, }, }, | |||
2488 | BUS_PROPERTY_DUAL_TIMESTAMP("UnitsLoadFinishTimestamp", offsetof(Manager, timestamps[MANAGER_TIMESTAMP_UNITS_LOAD_FINISH]), SD_BUS_VTABLE_PROPERTY_CONST){ .type = _SD_BUS_VTABLE_PROPERTY, .flags = (SD_BUS_VTABLE_PROPERTY_CONST ), .x = { .property = { .member = "UnitsLoadFinishTimestamp", .signature = "t", .get = ((sd_bus_property_get_t) ((void*)0) ), .set = ((void*)0), .offset = (__builtin_offsetof(Manager, timestamps [MANAGER_TIMESTAMP_UNITS_LOAD_FINISH])) + __builtin_offsetof( struct dual_timestamp, realtime), }, }, }, { .type = _SD_BUS_VTABLE_PROPERTY , .flags = (SD_BUS_VTABLE_PROPERTY_CONST), .x = { .property = { .member = "UnitsLoadFinishTimestamp" "Monotonic", .signature = "t", .get = ((sd_bus_property_get_t) ((void*)0)), .set = ( (void*)0), .offset = (__builtin_offsetof(Manager, timestamps[ MANAGER_TIMESTAMP_UNITS_LOAD_FINISH])) + __builtin_offsetof(struct dual_timestamp, monotonic), }, }, }, | |||
2489 | SD_BUS_WRITABLE_PROPERTY("LogLevel", "s", property_get_log_level, property_set_log_level, 0, 0){ .type = _SD_BUS_VTABLE_WRITABLE_PROPERTY, .flags = 0, .x = { .property = { .member = "LogLevel", .signature = "s", .get = property_get_log_level, .set = property_set_log_level, .offset = 0, }, }, }, | |||
2490 | SD_BUS_WRITABLE_PROPERTY("LogTarget", "s", property_get_log_target, property_set_log_target, 0, 0){ .type = _SD_BUS_VTABLE_WRITABLE_PROPERTY, .flags = 0, .x = { .property = { .member = "LogTarget", .signature = "s", .get = property_get_log_target, .set = property_set_log_target, .offset = 0, }, }, }, | |||
2491 | SD_BUS_PROPERTY("NNames", "u", property_get_hashmap_size, offsetof(Manager, units), 0){ .type = _SD_BUS_VTABLE_PROPERTY, .flags = 0, .x = { .property = { .member = "NNames", .signature = "u", .get = property_get_hashmap_size , .set = ((void*)0), .offset = __builtin_offsetof(Manager, units ), }, }, }, | |||
2492 | SD_BUS_PROPERTY("NFailedUnits", "u", property_get_set_size, offsetof(Manager, failed_units), SD_BUS_VTABLE_PROPERTY_EMITS_CHANGE){ .type = _SD_BUS_VTABLE_PROPERTY, .flags = SD_BUS_VTABLE_PROPERTY_EMITS_CHANGE , .x = { .property = { .member = "NFailedUnits", .signature = "u", .get = property_get_set_size, .set = ((void*)0), .offset = __builtin_offsetof(Manager, failed_units), }, }, }, | |||
2493 | SD_BUS_PROPERTY("NJobs", "u", property_get_hashmap_size, offsetof(Manager, jobs), 0){ .type = _SD_BUS_VTABLE_PROPERTY, .flags = 0, .x = { .property = { .member = "NJobs", .signature = "u", .get = property_get_hashmap_size , .set = ((void*)0), .offset = __builtin_offsetof(Manager, jobs ), }, }, }, | |||
2494 | SD_BUS_PROPERTY("NInstalledJobs", "u", bus_property_get_unsigned, offsetof(Manager, n_installed_jobs), 0){ .type = _SD_BUS_VTABLE_PROPERTY, .flags = 0, .x = { .property = { .member = "NInstalledJobs", .signature = "u", .get = ((sd_bus_property_get_t ) ((void*)0)), .set = ((void*)0), .offset = __builtin_offsetof (Manager, n_installed_jobs), }, }, }, | |||
2495 | SD_BUS_PROPERTY("NFailedJobs", "u", bus_property_get_unsigned, offsetof(Manager, n_failed_jobs), 0){ .type = _SD_BUS_VTABLE_PROPERTY, .flags = 0, .x = { .property = { .member = "NFailedJobs", .signature = "u", .get = ((sd_bus_property_get_t ) ((void*)0)), .set = ((void*)0), .offset = __builtin_offsetof (Manager, n_failed_jobs), }, }, }, | |||
2496 | SD_BUS_PROPERTY("Progress", "d", property_get_progress, 0, 0){ .type = _SD_BUS_VTABLE_PROPERTY, .flags = 0, .x = { .property = { .member = "Progress", .signature = "d", .get = property_get_progress , .set = ((void*)0), .offset = 0, }, }, }, | |||
2497 | SD_BUS_PROPERTY("Environment", "as", NULL, offsetof(Manager, environment), 0){ .type = _SD_BUS_VTABLE_PROPERTY, .flags = 0, .x = { .property = { .member = "Environment", .signature = "as", .get = ((void *)0), .set = ((void*)0), .offset = __builtin_offsetof(Manager , environment), }, }, }, | |||
2498 | SD_BUS_PROPERTY("ConfirmSpawn", "b", bus_property_get_bool, offsetof(Manager, confirm_spawn), SD_BUS_VTABLE_PROPERTY_CONST){ .type = _SD_BUS_VTABLE_PROPERTY, .flags = SD_BUS_VTABLE_PROPERTY_CONST , .x = { .property = { .member = "ConfirmSpawn", .signature = "b", .get = bus_property_get_bool, .set = ((void*)0), .offset = __builtin_offsetof(Manager, confirm_spawn), }, }, }, | |||
2499 | SD_BUS_PROPERTY("ShowStatus", "b", property_get_show_status, 0, 0){ .type = _SD_BUS_VTABLE_PROPERTY, .flags = 0, .x = { .property = { .member = "ShowStatus", .signature = "b", .get = property_get_show_status , .set = ((void*)0), .offset = 0, }, }, }, | |||
2500 | SD_BUS_PROPERTY("UnitPath", "as", NULL, offsetof(Manager, lookup_paths.search_path), SD_BUS_VTABLE_PROPERTY_CONST){ .type = _SD_BUS_VTABLE_PROPERTY, .flags = SD_BUS_VTABLE_PROPERTY_CONST , .x = { .property = { .member = "UnitPath", .signature = "as" , .get = ((void*)0), .set = ((void*)0), .offset = __builtin_offsetof (Manager, lookup_paths.search_path), }, }, }, | |||
2501 | SD_BUS_PROPERTY("DefaultStandardOutput", "s", bus_property_get_exec_output, offsetof(Manager, default_std_output), SD_BUS_VTABLE_PROPERTY_CONST){ .type = _SD_BUS_VTABLE_PROPERTY, .flags = SD_BUS_VTABLE_PROPERTY_CONST , .x = { .property = { .member = "DefaultStandardOutput", .signature = "s", .get = bus_property_get_exec_output, .set = ((void*)0 ), .offset = __builtin_offsetof(Manager, default_std_output), }, }, }, | |||
2502 | SD_BUS_PROPERTY("DefaultStandardError", "s", bus_property_get_exec_output, offsetof(Manager, default_std_output), SD_BUS_VTABLE_PROPERTY_CONST){ .type = _SD_BUS_VTABLE_PROPERTY, .flags = SD_BUS_VTABLE_PROPERTY_CONST , .x = { .property = { .member = "DefaultStandardError", .signature = "s", .get = bus_property_get_exec_output, .set = ((void*)0 ), .offset = __builtin_offsetof(Manager, default_std_output), }, }, }, | |||
2503 | SD_BUS_WRITABLE_PROPERTY("RuntimeWatchdogUSec", "t", bus_property_get_usec, property_set_runtime_watchdog, offsetof(Manager, runtime_watchdog), 0){ .type = _SD_BUS_VTABLE_WRITABLE_PROPERTY, .flags = 0, .x = { .property = { .member = "RuntimeWatchdogUSec", .signature = "t" , .get = ((sd_bus_property_get_t) ((void*)0)), .set = property_set_runtime_watchdog , .offset = __builtin_offsetof(Manager, runtime_watchdog), }, }, }, | |||
2504 | SD_BUS_WRITABLE_PROPERTY("ShutdownWatchdogUSec", "t", bus_property_get_usec, bus_property_set_usec, offsetof(Manager, shutdown_watchdog), 0){ .type = _SD_BUS_VTABLE_WRITABLE_PROPERTY, .flags = 0, .x = { .property = { .member = "ShutdownWatchdogUSec", .signature = "t", .get = ((sd_bus_property_get_t) ((void*)0)), .set = ((sd_bus_property_set_t ) ((void*)0)), .offset = __builtin_offsetof(Manager, shutdown_watchdog ), }, }, }, | |||
2505 | SD_BUS_WRITABLE_PROPERTY("ServiceWatchdogs", "b", bus_property_get_bool, bus_property_set_bool, offsetof(Manager, service_watchdogs), 0){ .type = _SD_BUS_VTABLE_WRITABLE_PROPERTY, .flags = 0, .x = { .property = { .member = "ServiceWatchdogs", .signature = "b" , .get = bus_property_get_bool, .set = bus_property_set_bool, .offset = __builtin_offsetof(Manager, service_watchdogs), }, }, }, | |||
2506 | SD_BUS_PROPERTY("ControlGroup", "s", NULL, offsetof(Manager, cgroup_root), 0){ .type = _SD_BUS_VTABLE_PROPERTY, .flags = 0, .x = { .property = { .member = "ControlGroup", .signature = "s", .get = ((void *)0), .set = ((void*)0), .offset = __builtin_offsetof(Manager , cgroup_root), }, }, }, | |||
2507 | SD_BUS_PROPERTY("SystemState", "s", property_get_system_state, 0, 0){ .type = _SD_BUS_VTABLE_PROPERTY, .flags = 0, .x = { .property = { .member = "SystemState", .signature = "s", .get = property_get_system_state , .set = ((void*)0), .offset = 0, }, }, }, | |||
2508 | SD_BUS_PROPERTY("ExitCode", "y", bus_property_get_unsigned, offsetof(Manager, return_value), 0){ .type = _SD_BUS_VTABLE_PROPERTY, .flags = 0, .x = { .property = { .member = "ExitCode", .signature = "y", .get = ((sd_bus_property_get_t ) ((void*)0)), .set = ((void*)0), .offset = __builtin_offsetof (Manager, return_value), }, }, }, | |||
2509 | SD_BUS_PROPERTY("DefaultTimerAccuracyUSec", "t", bus_property_get_usec, offsetof(Manager, default_timer_accuracy_usec), SD_BUS_VTABLE_PROPERTY_CONST){ .type = _SD_BUS_VTABLE_PROPERTY, .flags = SD_BUS_VTABLE_PROPERTY_CONST , .x = { .property = { .member = "DefaultTimerAccuracyUSec", . signature = "t", .get = ((sd_bus_property_get_t) ((void*)0)), .set = ((void*)0), .offset = __builtin_offsetof(Manager, default_timer_accuracy_usec ), }, }, }, | |||
2510 | SD_BUS_PROPERTY("DefaultTimeoutStartUSec", "t", bus_property_get_usec, offsetof(Manager, default_timeout_start_usec), SD_BUS_VTABLE_PROPERTY_CONST){ .type = _SD_BUS_VTABLE_PROPERTY, .flags = SD_BUS_VTABLE_PROPERTY_CONST , .x = { .property = { .member = "DefaultTimeoutStartUSec", . signature = "t", .get = ((sd_bus_property_get_t) ((void*)0)), .set = ((void*)0), .offset = __builtin_offsetof(Manager, default_timeout_start_usec ), }, }, }, | |||
2511 | SD_BUS_PROPERTY("DefaultTimeoutStopUSec", "t", bus_property_get_usec, offsetof(Manager, default_timeout_stop_usec), SD_BUS_VTABLE_PROPERTY_CONST){ .type = _SD_BUS_VTABLE_PROPERTY, .flags = SD_BUS_VTABLE_PROPERTY_CONST , .x = { .property = { .member = "DefaultTimeoutStopUSec", .signature = "t", .get = ((sd_bus_property_get_t) ((void*)0)), .set = ( (void*)0), .offset = __builtin_offsetof(Manager, default_timeout_stop_usec ), }, }, }, | |||
2512 | SD_BUS_PROPERTY("DefaultRestartUSec", "t", bus_property_get_usec, offsetof(Manager, default_restart_usec), SD_BUS_VTABLE_PROPERTY_CONST){ .type = _SD_BUS_VTABLE_PROPERTY, .flags = SD_BUS_VTABLE_PROPERTY_CONST , .x = { .property = { .member = "DefaultRestartUSec", .signature = "t", .get = ((sd_bus_property_get_t) ((void*)0)), .set = ( (void*)0), .offset = __builtin_offsetof(Manager, default_restart_usec ), }, }, }, | |||
2513 | SD_BUS_PROPERTY("DefaultStartLimitIntervalUSec", "t", bus_property_get_usec, offsetof(Manager, default_start_limit_interval), SD_BUS_VTABLE_PROPERTY_CONST){ .type = _SD_BUS_VTABLE_PROPERTY, .flags = SD_BUS_VTABLE_PROPERTY_CONST , .x = { .property = { .member = "DefaultStartLimitIntervalUSec" , .signature = "t", .get = ((sd_bus_property_get_t) ((void*)0 )), .set = ((void*)0), .offset = __builtin_offsetof(Manager, default_start_limit_interval ), }, }, }, | |||
2514 | /* The following two items are obsolete alias */ | |||
2515 | SD_BUS_PROPERTY("DefaultStartLimitIntervalSec", "t", bus_property_get_usec, offsetof(Manager, default_start_limit_interval), SD_BUS_VTABLE_PROPERTY_CONST|SD_BUS_VTABLE_HIDDEN){ .type = _SD_BUS_VTABLE_PROPERTY, .flags = SD_BUS_VTABLE_PROPERTY_CONST |SD_BUS_VTABLE_HIDDEN, .x = { .property = { .member = "DefaultStartLimitIntervalSec" , .signature = "t", .get = ((sd_bus_property_get_t) ((void*)0 )), .set = ((void*)0), .offset = __builtin_offsetof(Manager, default_start_limit_interval ), }, }, }, | |||
2516 | SD_BUS_PROPERTY("DefaultStartLimitInterval", "t", bus_property_get_usec, offsetof(Manager, default_start_limit_interval), SD_BUS_VTABLE_PROPERTY_CONST|SD_BUS_VTABLE_HIDDEN){ .type = _SD_BUS_VTABLE_PROPERTY, .flags = SD_BUS_VTABLE_PROPERTY_CONST |SD_BUS_VTABLE_HIDDEN, .x = { .property = { .member = "DefaultStartLimitInterval" , .signature = "t", .get = ((sd_bus_property_get_t) ((void*)0 )), .set = ((void*)0), .offset = __builtin_offsetof(Manager, default_start_limit_interval ), }, }, }, | |||
2517 | SD_BUS_PROPERTY("DefaultStartLimitBurst", "u", bus_property_get_unsigned, offsetof(Manager, default_start_limit_burst), SD_BUS_VTABLE_PROPERTY_CONST){ .type = _SD_BUS_VTABLE_PROPERTY, .flags = SD_BUS_VTABLE_PROPERTY_CONST , .x = { .property = { .member = "DefaultStartLimitBurst", .signature = "u", .get = ((sd_bus_property_get_t) ((void*)0)), .set = ( (void*)0), .offset = __builtin_offsetof(Manager, default_start_limit_burst ), }, }, }, | |||
2518 | SD_BUS_PROPERTY("DefaultCPUAccounting", "b", bus_property_get_bool, offsetof(Manager, default_cpu_accounting), SD_BUS_VTABLE_PROPERTY_CONST){ .type = _SD_BUS_VTABLE_PROPERTY, .flags = SD_BUS_VTABLE_PROPERTY_CONST , .x = { .property = { .member = "DefaultCPUAccounting", .signature = "b", .get = bus_property_get_bool, .set = ((void*)0), .offset = __builtin_offsetof(Manager, default_cpu_accounting), }, }, }, | |||
2519 | SD_BUS_PROPERTY("DefaultBlockIOAccounting", "b", bus_property_get_bool, offsetof(Manager, default_blockio_accounting), SD_BUS_VTABLE_PROPERTY_CONST){ .type = _SD_BUS_VTABLE_PROPERTY, .flags = SD_BUS_VTABLE_PROPERTY_CONST , .x = { .property = { .member = "DefaultBlockIOAccounting", . signature = "b", .get = bus_property_get_bool, .set = ((void* )0), .offset = __builtin_offsetof(Manager, default_blockio_accounting ), }, }, }, | |||
2520 | SD_BUS_PROPERTY("DefaultMemoryAccounting", "b", bus_property_get_bool, offsetof(Manager, default_memory_accounting), SD_BUS_VTABLE_PROPERTY_CONST){ .type = _SD_BUS_VTABLE_PROPERTY, .flags = SD_BUS_VTABLE_PROPERTY_CONST , .x = { .property = { .member = "DefaultMemoryAccounting", . signature = "b", .get = bus_property_get_bool, .set = ((void* )0), .offset = __builtin_offsetof(Manager, default_memory_accounting ), }, }, }, | |||
2521 | SD_BUS_PROPERTY("DefaultTasksAccounting", "b", bus_property_get_bool, offsetof(Manager, default_tasks_accounting), SD_BUS_VTABLE_PROPERTY_CONST){ .type = _SD_BUS_VTABLE_PROPERTY, .flags = SD_BUS_VTABLE_PROPERTY_CONST , .x = { .property = { .member = "DefaultTasksAccounting", .signature = "b", .get = bus_property_get_bool, .set = ((void*)0), .offset = __builtin_offsetof(Manager, default_tasks_accounting), }, } , }, | |||
2522 | SD_BUS_PROPERTY("DefaultLimitCPU", "t", bus_property_get_rlimit, offsetof(Manager, rlimit[RLIMIT_CPU]), SD_BUS_VTABLE_PROPERTY_CONST){ .type = _SD_BUS_VTABLE_PROPERTY, .flags = SD_BUS_VTABLE_PROPERTY_CONST , .x = { .property = { .member = "DefaultLimitCPU", .signature = "t", .get = bus_property_get_rlimit, .set = ((void*)0), .offset = __builtin_offsetof(Manager, rlimit[RLIMIT_CPU]), }, }, }, | |||
2523 | SD_BUS_PROPERTY("DefaultLimitCPUSoft", "t", bus_property_get_rlimit, offsetof(Manager, rlimit[RLIMIT_CPU]), SD_BUS_VTABLE_PROPERTY_CONST){ .type = _SD_BUS_VTABLE_PROPERTY, .flags = SD_BUS_VTABLE_PROPERTY_CONST , .x = { .property = { .member = "DefaultLimitCPUSoft", .signature = "t", .get = bus_property_get_rlimit, .set = ((void*)0), .offset = __builtin_offsetof(Manager, rlimit[RLIMIT_CPU]), }, }, }, | |||
2524 | SD_BUS_PROPERTY("DefaultLimitFSIZE", "t", bus_property_get_rlimit, offsetof(Manager, rlimit[RLIMIT_FSIZE]), SD_BUS_VTABLE_PROPERTY_CONST){ .type = _SD_BUS_VTABLE_PROPERTY, .flags = SD_BUS_VTABLE_PROPERTY_CONST , .x = { .property = { .member = "DefaultLimitFSIZE", .signature = "t", .get = bus_property_get_rlimit, .set = ((void*)0), .offset = __builtin_offsetof(Manager, rlimit[RLIMIT_FSIZE]), }, }, }, | |||
2525 | SD_BUS_PROPERTY("DefaultLimitFSIZESoft", "t", bus_property_get_rlimit, offsetof(Manager, rlimit[RLIMIT_FSIZE]), SD_BUS_VTABLE_PROPERTY_CONST){ .type = _SD_BUS_VTABLE_PROPERTY, .flags = SD_BUS_VTABLE_PROPERTY_CONST , .x = { .property = { .member = "DefaultLimitFSIZESoft", .signature = "t", .get = bus_property_get_rlimit, .set = ((void*)0), .offset = __builtin_offsetof(Manager, rlimit[RLIMIT_FSIZE]), }, }, }, | |||
2526 | SD_BUS_PROPERTY("DefaultLimitDATA", "t", bus_property_get_rlimit, offsetof(Manager, rlimit[RLIMIT_DATA]), SD_BUS_VTABLE_PROPERTY_CONST){ .type = _SD_BUS_VTABLE_PROPERTY, .flags = SD_BUS_VTABLE_PROPERTY_CONST , .x = { .property = { .member = "DefaultLimitDATA", .signature = "t", .get = bus_property_get_rlimit, .set = ((void*)0), .offset = __builtin_offsetof(Manager, rlimit[RLIMIT_DATA]), }, }, }, | |||
2527 | SD_BUS_PROPERTY("DefaultLimitDATASoft", "t", bus_property_get_rlimit, offsetof(Manager, rlimit[RLIMIT_DATA]), SD_BUS_VTABLE_PROPERTY_CONST){ .type = _SD_BUS_VTABLE_PROPERTY, .flags = SD_BUS_VTABLE_PROPERTY_CONST , .x = { .property = { .member = "DefaultLimitDATASoft", .signature = "t", .get = bus_property_get_rlimit, .set = ((void*)0), .offset = __builtin_offsetof(Manager, rlimit[RLIMIT_DATA]), }, }, }, | |||
2528 | SD_BUS_PROPERTY("DefaultLimitSTACK", "t", bus_property_get_rlimit, offsetof(Manager, rlimit[RLIMIT_STACK]), SD_BUS_VTABLE_PROPERTY_CONST){ .type = _SD_BUS_VTABLE_PROPERTY, .flags = SD_BUS_VTABLE_PROPERTY_CONST , .x = { .property = { .member = "DefaultLimitSTACK", .signature = "t", .get = bus_property_get_rlimit, .set = ((void*)0), .offset = __builtin_offsetof(Manager, rlimit[RLIMIT_STACK]), }, }, }, | |||
2529 | SD_BUS_PROPERTY("DefaultLimitSTACKSoft", "t", bus_property_get_rlimit, offsetof(Manager, rlimit[RLIMIT_STACK]), SD_BUS_VTABLE_PROPERTY_CONST){ .type = _SD_BUS_VTABLE_PROPERTY, .flags = SD_BUS_VTABLE_PROPERTY_CONST , .x = { .property = { .member = "DefaultLimitSTACKSoft", .signature = "t", .get = bus_property_get_rlimit, .set = ((void*)0), .offset = __builtin_offsetof(Manager, rlimit[RLIMIT_STACK]), }, }, }, | |||
2530 | SD_BUS_PROPERTY("DefaultLimitCORE", "t", bus_property_get_rlimit, offsetof(Manager, rlimit[RLIMIT_CORE]), SD_BUS_VTABLE_PROPERTY_CONST){ .type = _SD_BUS_VTABLE_PROPERTY, .flags = SD_BUS_VTABLE_PROPERTY_CONST , .x = { .property = { .member = "DefaultLimitCORE", .signature = "t", .get = bus_property_get_rlimit, .set = ((void*)0), .offset = __builtin_offsetof(Manager, rlimit[RLIMIT_CORE]), }, }, }, | |||
2531 | SD_BUS_PROPERTY("DefaultLimitCORESoft", "t", bus_property_get_rlimit, offsetof(Manager, rlimit[RLIMIT_CORE]), SD_BUS_VTABLE_PROPERTY_CONST){ .type = _SD_BUS_VTABLE_PROPERTY, .flags = SD_BUS_VTABLE_PROPERTY_CONST , .x = { .property = { .member = "DefaultLimitCORESoft", .signature = "t", .get = bus_property_get_rlimit, .set = ((void*)0), .offset = __builtin_offsetof(Manager, rlimit[RLIMIT_CORE]), }, }, }, | |||
2532 | SD_BUS_PROPERTY("DefaultLimitRSS", "t", bus_property_get_rlimit, offsetof(Manager, rlimit[RLIMIT_RSS]), SD_BUS_VTABLE_PROPERTY_CONST){ .type = _SD_BUS_VTABLE_PROPERTY, .flags = SD_BUS_VTABLE_PROPERTY_CONST , .x = { .property = { .member = "DefaultLimitRSS", .signature = "t", .get = bus_property_get_rlimit, .set = ((void*)0), .offset = __builtin_offsetof(Manager, rlimit[__RLIMIT_RSS]), }, }, }, | |||
2533 | SD_BUS_PROPERTY("DefaultLimitRSSSoft", "t", bus_property_get_rlimit, offsetof(Manager, rlimit[RLIMIT_RSS]), SD_BUS_VTABLE_PROPERTY_CONST){ .type = _SD_BUS_VTABLE_PROPERTY, .flags = SD_BUS_VTABLE_PROPERTY_CONST , .x = { .property = { .member = "DefaultLimitRSSSoft", .signature = "t", .get = bus_property_get_rlimit, .set = ((void*)0), .offset = __builtin_offsetof(Manager, rlimit[__RLIMIT_RSS]), }, }, }, | |||
2534 | SD_BUS_PROPERTY("DefaultLimitNOFILE", "t", bus_property_get_rlimit, offsetof(Manager, rlimit[RLIMIT_NOFILE]), SD_BUS_VTABLE_PROPERTY_CONST){ .type = _SD_BUS_VTABLE_PROPERTY, .flags = SD_BUS_VTABLE_PROPERTY_CONST , .x = { .property = { .member = "DefaultLimitNOFILE", .signature = "t", .get = bus_property_get_rlimit, .set = ((void*)0), .offset = __builtin_offsetof(Manager, rlimit[RLIMIT_NOFILE]), }, }, }, | |||
2535 | SD_BUS_PROPERTY("DefaultLimitNOFILESoft", "t", bus_property_get_rlimit, offsetof(Manager, rlimit[RLIMIT_NOFILE]), SD_BUS_VTABLE_PROPERTY_CONST){ .type = _SD_BUS_VTABLE_PROPERTY, .flags = SD_BUS_VTABLE_PROPERTY_CONST , .x = { .property = { .member = "DefaultLimitNOFILESoft", .signature = "t", .get = bus_property_get_rlimit, .set = ((void*)0), .offset = __builtin_offsetof(Manager, rlimit[RLIMIT_NOFILE]), }, }, }, | |||
2536 | SD_BUS_PROPERTY("DefaultLimitAS", "t", bus_property_get_rlimit, offsetof(Manager, rlimit[RLIMIT_AS]), SD_BUS_VTABLE_PROPERTY_CONST){ .type = _SD_BUS_VTABLE_PROPERTY, .flags = SD_BUS_VTABLE_PROPERTY_CONST , .x = { .property = { .member = "DefaultLimitAS", .signature = "t", .get = bus_property_get_rlimit, .set = ((void*)0), .offset = __builtin_offsetof(Manager, rlimit[RLIMIT_AS]), }, }, }, | |||
2537 | SD_BUS_PROPERTY("DefaultLimitASSoft", "t", bus_property_get_rlimit, offsetof(Manager, rlimit[RLIMIT_AS]), SD_BUS_VTABLE_PROPERTY_CONST){ .type = _SD_BUS_VTABLE_PROPERTY, .flags = SD_BUS_VTABLE_PROPERTY_CONST , .x = { .property = { .member = "DefaultLimitASSoft", .signature = "t", .get = bus_property_get_rlimit, .set = ((void*)0), .offset = __builtin_offsetof(Manager, rlimit[RLIMIT_AS]), }, }, }, | |||
2538 | SD_BUS_PROPERTY("DefaultLimitNPROC", "t", bus_property_get_rlimit, offsetof(Manager, rlimit[RLIMIT_NPROC]), SD_BUS_VTABLE_PROPERTY_CONST){ .type = _SD_BUS_VTABLE_PROPERTY, .flags = SD_BUS_VTABLE_PROPERTY_CONST , .x = { .property = { .member = "DefaultLimitNPROC", .signature = "t", .get = bus_property_get_rlimit, .set = ((void*)0), .offset = __builtin_offsetof(Manager, rlimit[__RLIMIT_NPROC]), }, }, }, | |||
2539 | SD_BUS_PROPERTY("DefaultLimitNPROCSoft", "t", bus_property_get_rlimit, offsetof(Manager, rlimit[RLIMIT_NPROC]), SD_BUS_VTABLE_PROPERTY_CONST){ .type = _SD_BUS_VTABLE_PROPERTY, .flags = SD_BUS_VTABLE_PROPERTY_CONST , .x = { .property = { .member = "DefaultLimitNPROCSoft", .signature = "t", .get = bus_property_get_rlimit, .set = ((void*)0), .offset = __builtin_offsetof(Manager, rlimit[__RLIMIT_NPROC]), }, }, }, | |||
2540 | SD_BUS_PROPERTY("DefaultLimitMEMLOCK", "t", bus_property_get_rlimit, offsetof(Manager, rlimit[RLIMIT_MEMLOCK]), SD_BUS_VTABLE_PROPERTY_CONST){ .type = _SD_BUS_VTABLE_PROPERTY, .flags = SD_BUS_VTABLE_PROPERTY_CONST , .x = { .property = { .member = "DefaultLimitMEMLOCK", .signature = "t", .get = bus_property_get_rlimit, .set = ((void*)0), .offset = __builtin_offsetof(Manager, rlimit[__RLIMIT_MEMLOCK]), }, } , }, | |||
2541 | SD_BUS_PROPERTY("DefaultLimitMEMLOCKSoft", "t", bus_property_get_rlimit, offsetof(Manager, rlimit[RLIMIT_MEMLOCK]), SD_BUS_VTABLE_PROPERTY_CONST){ .type = _SD_BUS_VTABLE_PROPERTY, .flags = SD_BUS_VTABLE_PROPERTY_CONST , .x = { .property = { .member = "DefaultLimitMEMLOCKSoft", . signature = "t", .get = bus_property_get_rlimit, .set = ((void *)0), .offset = __builtin_offsetof(Manager, rlimit[__RLIMIT_MEMLOCK ]), }, }, }, | |||
2542 | SD_BUS_PROPERTY("DefaultLimitLOCKS", "t", bus_property_get_rlimit, offsetof(Manager, rlimit[RLIMIT_LOCKS]), SD_BUS_VTABLE_PROPERTY_CONST){ .type = _SD_BUS_VTABLE_PROPERTY, .flags = SD_BUS_VTABLE_PROPERTY_CONST , .x = { .property = { .member = "DefaultLimitLOCKS", .signature = "t", .get = bus_property_get_rlimit, .set = ((void*)0), .offset = __builtin_offsetof(Manager, rlimit[__RLIMIT_LOCKS]), }, }, }, | |||
2543 | SD_BUS_PROPERTY("DefaultLimitLOCKSSoft", "t", bus_property_get_rlimit, offsetof(Manager, rlimit[RLIMIT_LOCKS]), SD_BUS_VTABLE_PROPERTY_CONST){ .type = _SD_BUS_VTABLE_PROPERTY, .flags = SD_BUS_VTABLE_PROPERTY_CONST , .x = { .property = { .member = "DefaultLimitLOCKSSoft", .signature = "t", .get = bus_property_get_rlimit, .set = ((void*)0), .offset = __builtin_offsetof(Manager, rlimit[__RLIMIT_LOCKS]), }, }, }, | |||
2544 | SD_BUS_PROPERTY("DefaultLimitSIGPENDING", "t", bus_property_get_rlimit, offsetof(Manager, rlimit[RLIMIT_SIGPENDING]), SD_BUS_VTABLE_PROPERTY_CONST){ .type = _SD_BUS_VTABLE_PROPERTY, .flags = SD_BUS_VTABLE_PROPERTY_CONST , .x = { .property = { .member = "DefaultLimitSIGPENDING", .signature = "t", .get = bus_property_get_rlimit, .set = ((void*)0), .offset = __builtin_offsetof(Manager, rlimit[__RLIMIT_SIGPENDING]), } , }, }, | |||
2545 | SD_BUS_PROPERTY("DefaultLimitSIGPENDINGSoft", "t", bus_property_get_rlimit, offsetof(Manager, rlimit[RLIMIT_SIGPENDING]), SD_BUS_VTABLE_PROPERTY_CONST){ .type = _SD_BUS_VTABLE_PROPERTY, .flags = SD_BUS_VTABLE_PROPERTY_CONST , .x = { .property = { .member = "DefaultLimitSIGPENDINGSoft" , .signature = "t", .get = bus_property_get_rlimit, .set = (( void*)0), .offset = __builtin_offsetof(Manager, rlimit[__RLIMIT_SIGPENDING ]), }, }, }, | |||
2546 | SD_BUS_PROPERTY("DefaultLimitMSGQUEUE", "t", bus_property_get_rlimit, offsetof(Manager, rlimit[RLIMIT_MSGQUEUE]), SD_BUS_VTABLE_PROPERTY_CONST){ .type = _SD_BUS_VTABLE_PROPERTY, .flags = SD_BUS_VTABLE_PROPERTY_CONST , .x = { .property = { .member = "DefaultLimitMSGQUEUE", .signature = "t", .get = bus_property_get_rlimit, .set = ((void*)0), .offset = __builtin_offsetof(Manager, rlimit[__RLIMIT_MSGQUEUE]), }, }, }, | |||
2547 | SD_BUS_PROPERTY("DefaultLimitMSGQUEUESoft", "t", bus_property_get_rlimit, offsetof(Manager, rlimit[RLIMIT_MSGQUEUE]), SD_BUS_VTABLE_PROPERTY_CONST){ .type = _SD_BUS_VTABLE_PROPERTY, .flags = SD_BUS_VTABLE_PROPERTY_CONST , .x = { .property = { .member = "DefaultLimitMSGQUEUESoft", . signature = "t", .get = bus_property_get_rlimit, .set = ((void *)0), .offset = __builtin_offsetof(Manager, rlimit[__RLIMIT_MSGQUEUE ]), }, }, }, | |||
2548 | SD_BUS_PROPERTY("DefaultLimitNICE", "t", bus_property_get_rlimit, offsetof(Manager, rlimit[RLIMIT_NICE]), SD_BUS_VTABLE_PROPERTY_CONST){ .type = _SD_BUS_VTABLE_PROPERTY, .flags = SD_BUS_VTABLE_PROPERTY_CONST , .x = { .property = { .member = "DefaultLimitNICE", .signature = "t", .get = bus_property_get_rlimit, .set = ((void*)0), .offset = __builtin_offsetof(Manager, rlimit[__RLIMIT_NICE]), }, }, }, | |||
2549 | SD_BUS_PROPERTY("DefaultLimitNICESoft", "t", bus_property_get_rlimit, offsetof(Manager, rlimit[RLIMIT_NICE]), SD_BUS_VTABLE_PROPERTY_CONST){ .type = _SD_BUS_VTABLE_PROPERTY, .flags = SD_BUS_VTABLE_PROPERTY_CONST , .x = { .property = { .member = "DefaultLimitNICESoft", .signature = "t", .get = bus_property_get_rlimit, .set = ((void*)0), .offset = __builtin_offsetof(Manager, rlimit[__RLIMIT_NICE]), }, }, }, | |||
2550 | SD_BUS_PROPERTY("DefaultLimitRTPRIO", "t", bus_property_get_rlimit, offsetof(Manager, rlimit[RLIMIT_RTPRIO]), SD_BUS_VTABLE_PROPERTY_CONST){ .type = _SD_BUS_VTABLE_PROPERTY, .flags = SD_BUS_VTABLE_PROPERTY_CONST , .x = { .property = { .member = "DefaultLimitRTPRIO", .signature = "t", .get = bus_property_get_rlimit, .set = ((void*)0), .offset = __builtin_offsetof(Manager, rlimit[__RLIMIT_RTPRIO]), }, } , }, | |||
2551 | SD_BUS_PROPERTY("DefaultLimitRTPRIOSoft", "t", bus_property_get_rlimit, offsetof(Manager, rlimit[RLIMIT_RTPRIO]), SD_BUS_VTABLE_PROPERTY_CONST){ .type = _SD_BUS_VTABLE_PROPERTY, .flags = SD_BUS_VTABLE_PROPERTY_CONST , .x = { .property = { .member = "DefaultLimitRTPRIOSoft", .signature = "t", .get = bus_property_get_rlimit, .set = ((void*)0), .offset = __builtin_offsetof(Manager, rlimit[__RLIMIT_RTPRIO]), }, } , }, | |||
2552 | SD_BUS_PROPERTY("DefaultLimitRTTIME", "t", bus_property_get_rlimit, offsetof(Manager, rlimit[RLIMIT_RTTIME]), SD_BUS_VTABLE_PROPERTY_CONST){ .type = _SD_BUS_VTABLE_PROPERTY, .flags = SD_BUS_VTABLE_PROPERTY_CONST , .x = { .property = { .member = "DefaultLimitRTTIME", .signature = "t", .get = bus_property_get_rlimit, .set = ((void*)0), .offset = __builtin_offsetof(Manager, rlimit[__RLIMIT_RTTIME]), }, } , }, | |||
2553 | SD_BUS_PROPERTY("DefaultLimitRTTIMESoft", "t", bus_property_get_rlimit, offsetof(Manager, rlimit[RLIMIT_RTTIME]), SD_BUS_VTABLE_PROPERTY_CONST){ .type = _SD_BUS_VTABLE_PROPERTY, .flags = SD_BUS_VTABLE_PROPERTY_CONST , .x = { .property = { .member = "DefaultLimitRTTIMESoft", .signature = "t", .get = bus_property_get_rlimit, .set = ((void*)0), .offset = __builtin_offsetof(Manager, rlimit[__RLIMIT_RTTIME]), }, } , }, | |||
2554 | SD_BUS_PROPERTY("DefaultTasksMax", "t", NULL, offsetof(Manager, default_tasks_max), SD_BUS_VTABLE_PROPERTY_CONST){ .type = _SD_BUS_VTABLE_PROPERTY, .flags = SD_BUS_VTABLE_PROPERTY_CONST , .x = { .property = { .member = "DefaultTasksMax", .signature = "t", .get = ((void*)0), .set = ((void*)0), .offset = __builtin_offsetof (Manager, default_tasks_max), }, }, }, | |||
2555 | SD_BUS_PROPERTY("TimerSlackNSec", "t", property_get_timer_slack_nsec, 0, SD_BUS_VTABLE_PROPERTY_CONST){ .type = _SD_BUS_VTABLE_PROPERTY, .flags = SD_BUS_VTABLE_PROPERTY_CONST , .x = { .property = { .member = "TimerSlackNSec", .signature = "t", .get = property_get_timer_slack_nsec, .set = ((void*) 0), .offset = 0, }, }, }, | |||
2556 | ||||
2557 | SD_BUS_METHOD("GetUnit", "s", "o", method_get_unit, SD_BUS_VTABLE_UNPRIVILEGED){ .type = _SD_BUS_VTABLE_METHOD, .flags = SD_BUS_VTABLE_UNPRIVILEGED , .x = { .method = { .member = "GetUnit", .signature = "s", . result = "o", .handler = method_get_unit, .offset = 0, }, }, }, | |||
2558 | SD_BUS_METHOD("GetUnitByPID", "u", "o", method_get_unit_by_pid, SD_BUS_VTABLE_UNPRIVILEGED){ .type = _SD_BUS_VTABLE_METHOD, .flags = SD_BUS_VTABLE_UNPRIVILEGED , .x = { .method = { .member = "GetUnitByPID", .signature = "u" , .result = "o", .handler = method_get_unit_by_pid, .offset = 0, }, }, }, | |||
2559 | SD_BUS_METHOD("GetUnitByInvocationID", "ay", "o", method_get_unit_by_invocation_id, SD_BUS_VTABLE_UNPRIVILEGED){ .type = _SD_BUS_VTABLE_METHOD, .flags = SD_BUS_VTABLE_UNPRIVILEGED , .x = { .method = { .member = "GetUnitByInvocationID", .signature = "ay", .result = "o", .handler = method_get_unit_by_invocation_id , .offset = 0, }, }, }, | |||
2560 | SD_BUS_METHOD("GetUnitByControlGroup", "s", "o", method_get_unit_by_control_group, SD_BUS_VTABLE_UNPRIVILEGED){ .type = _SD_BUS_VTABLE_METHOD, .flags = SD_BUS_VTABLE_UNPRIVILEGED , .x = { .method = { .member = "GetUnitByControlGroup", .signature = "s", .result = "o", .handler = method_get_unit_by_control_group , .offset = 0, }, }, }, | |||
2561 | SD_BUS_METHOD("LoadUnit", "s", "o", method_load_unit, SD_BUS_VTABLE_UNPRIVILEGED){ .type = _SD_BUS_VTABLE_METHOD, .flags = SD_BUS_VTABLE_UNPRIVILEGED , .x = { .method = { .member = "LoadUnit", .signature = "s", . result = "o", .handler = method_load_unit, .offset = 0, }, }, }, | |||
2562 | SD_BUS_METHOD("StartUnit", "ss", "o", method_start_unit, SD_BUS_VTABLE_UNPRIVILEGED){ .type = _SD_BUS_VTABLE_METHOD, .flags = SD_BUS_VTABLE_UNPRIVILEGED , .x = { .method = { .member = "StartUnit", .signature = "ss" , .result = "o", .handler = method_start_unit, .offset = 0, } , }, }, | |||
2563 | SD_BUS_METHOD("StartUnitReplace", "sss", "o", method_start_unit_replace, SD_BUS_VTABLE_UNPRIVILEGED){ .type = _SD_BUS_VTABLE_METHOD, .flags = SD_BUS_VTABLE_UNPRIVILEGED , .x = { .method = { .member = "StartUnitReplace", .signature = "sss", .result = "o", .handler = method_start_unit_replace , .offset = 0, }, }, }, | |||
2564 | SD_BUS_METHOD("StopUnit", "ss", "o", method_stop_unit, SD_BUS_VTABLE_UNPRIVILEGED){ .type = _SD_BUS_VTABLE_METHOD, .flags = SD_BUS_VTABLE_UNPRIVILEGED , .x = { .method = { .member = "StopUnit", .signature = "ss", .result = "o", .handler = method_stop_unit, .offset = 0, }, } , }, | |||
2565 | SD_BUS_METHOD("ReloadUnit", "ss", "o", method_reload_unit, SD_BUS_VTABLE_UNPRIVILEGED){ .type = _SD_BUS_VTABLE_METHOD, .flags = SD_BUS_VTABLE_UNPRIVILEGED , .x = { .method = { .member = "ReloadUnit", .signature = "ss" , .result = "o", .handler = method_reload_unit, .offset = 0, } , }, }, | |||
2566 | SD_BUS_METHOD("RestartUnit", "ss", "o", method_restart_unit, SD_BUS_VTABLE_UNPRIVILEGED){ .type = _SD_BUS_VTABLE_METHOD, .flags = SD_BUS_VTABLE_UNPRIVILEGED , .x = { .method = { .member = "RestartUnit", .signature = "ss" , .result = "o", .handler = method_restart_unit, .offset = 0, }, }, }, | |||
2567 | SD_BUS_METHOD("TryRestartUnit", "ss", "o", method_try_restart_unit, SD_BUS_VTABLE_UNPRIVILEGED){ .type = _SD_BUS_VTABLE_METHOD, .flags = SD_BUS_VTABLE_UNPRIVILEGED , .x = { .method = { .member = "TryRestartUnit", .signature = "ss", .result = "o", .handler = method_try_restart_unit, .offset = 0, }, }, }, | |||
2568 | SD_BUS_METHOD("ReloadOrRestartUnit", "ss", "o", method_reload_or_restart_unit, SD_BUS_VTABLE_UNPRIVILEGED){ .type = _SD_BUS_VTABLE_METHOD, .flags = SD_BUS_VTABLE_UNPRIVILEGED , .x = { .method = { .member = "ReloadOrRestartUnit", .signature = "ss", .result = "o", .handler = method_reload_or_restart_unit , .offset = 0, }, }, }, | |||
2569 | SD_BUS_METHOD("ReloadOrTryRestartUnit", "ss", "o", method_reload_or_try_restart_unit, SD_BUS_VTABLE_UNPRIVILEGED){ .type = _SD_BUS_VTABLE_METHOD, .flags = SD_BUS_VTABLE_UNPRIVILEGED , .x = { .method = { .member = "ReloadOrTryRestartUnit", .signature = "ss", .result = "o", .handler = method_reload_or_try_restart_unit , .offset = 0, }, }, }, | |||
2570 | SD_BUS_METHOD("EnqueueUnitJob", "sss", "uososa(uosos)", method_enqueue_unit_job, SD_BUS_VTABLE_UNPRIVILEGED){ .type = _SD_BUS_VTABLE_METHOD, .flags = SD_BUS_VTABLE_UNPRIVILEGED , .x = { .method = { .member = "EnqueueUnitJob", .signature = "sss", .result = "uososa(uosos)", .handler = method_enqueue_unit_job , .offset = 0, }, }, }, | |||
2571 | SD_BUS_METHOD("KillUnit", "ssi", NULL, method_kill_unit, SD_BUS_VTABLE_UNPRIVILEGED){ .type = _SD_BUS_VTABLE_METHOD, .flags = SD_BUS_VTABLE_UNPRIVILEGED , .x = { .method = { .member = "KillUnit", .signature = "ssi" , .result = ((void*)0), .handler = method_kill_unit, .offset = 0, }, }, }, | |||
2572 | SD_BUS_METHOD("FreezeUnit", "s", NULL, method_freeze_unit, SD_BUS_VTABLE_UNPRIVILEGED){ .type = _SD_BUS_VTABLE_METHOD, .flags = SD_BUS_VTABLE_UNPRIVILEGED , .x = { .method = { .member = "FreezeUnit", .signature = "s" , .result = ((void*)0), .handler = method_freeze_unit, .offset = 0, }, }, }, | |||
2573 | SD_BUS_METHOD("ThawUnit", "s", NULL, method_thaw_unit, SD_BUS_VTABLE_UNPRIVILEGED){ .type = _SD_BUS_VTABLE_METHOD, .flags = SD_BUS_VTABLE_UNPRIVILEGED , .x = { .method = { .member = "ThawUnit", .signature = "s", . result = ((void*)0), .handler = method_thaw_unit, .offset = 0 , }, }, }, | |||
2574 | SD_BUS_METHOD("ResetFailedUnit", "s", NULL, method_reset_failed_unit, SD_BUS_VTABLE_UNPRIVILEGED){ .type = _SD_BUS_VTABLE_METHOD, .flags = SD_BUS_VTABLE_UNPRIVILEGED , .x = { .method = { .member = "ResetFailedUnit", .signature = "s", .result = ((void*)0), .handler = method_reset_failed_unit , .offset = 0, }, }, }, | |||
2575 | SD_BUS_METHOD("SetUnitProperties", "sba(sv)", NULL, method_set_unit_properties, SD_BUS_VTABLE_UNPRIVILEGED){ .type = _SD_BUS_VTABLE_METHOD, .flags = SD_BUS_VTABLE_UNPRIVILEGED , .x = { .method = { .member = "SetUnitProperties", .signature = "sba(sv)", .result = ((void*)0), .handler = method_set_unit_properties , .offset = 0, }, }, }, | |||
2576 | SD_BUS_METHOD("RefUnit", "s", NULL, method_ref_unit, SD_BUS_VTABLE_UNPRIVILEGED){ .type = _SD_BUS_VTABLE_METHOD, .flags = SD_BUS_VTABLE_UNPRIVILEGED , .x = { .method = { .member = "RefUnit", .signature = "s", . result = ((void*)0), .handler = method_ref_unit, .offset = 0, }, }, }, | |||
2577 | SD_BUS_METHOD("UnrefUnit", "s", NULL, method_unref_unit, SD_BUS_VTABLE_UNPRIVILEGED){ .type = _SD_BUS_VTABLE_METHOD, .flags = SD_BUS_VTABLE_UNPRIVILEGED , .x = { .method = { .member = "UnrefUnit", .signature = "s", .result = ((void*)0), .handler = method_unref_unit, .offset = 0, }, }, }, | |||
2578 | SD_BUS_METHOD("StartTransientUnit", "ssa(sv)a(sa(sv))", "o", method_start_transient_unit, SD_BUS_VTABLE_UNPRIVILEGED){ .type = _SD_BUS_VTABLE_METHOD, .flags = SD_BUS_VTABLE_UNPRIVILEGED , .x = { .method = { .member = "StartTransientUnit", .signature = "ssa(sv)a(sa(sv))", .result = "o", .handler = method_start_transient_unit , .offset = 0, }, }, }, | |||
2579 | SD_BUS_METHOD("GetUnitProcesses", "s", "a(sus)", method_get_unit_processes, SD_BUS_VTABLE_UNPRIVILEGED){ .type = _SD_BUS_VTABLE_METHOD, .flags = SD_BUS_VTABLE_UNPRIVILEGED , .x = { .method = { .member = "GetUnitProcesses", .signature = "s", .result = "a(sus)", .handler = method_get_unit_processes , .offset = 0, }, }, }, | |||
2580 | SD_BUS_METHOD("AttachProcessesToUnit", "ssau", NULL, method_attach_processes_to_unit, SD_BUS_VTABLE_UNPRIVILEGED){ .type = _SD_BUS_VTABLE_METHOD, .flags = SD_BUS_VTABLE_UNPRIVILEGED , .x = { .method = { .member = "AttachProcessesToUnit", .signature = "ssau", .result = ((void*)0), .handler = method_attach_processes_to_unit , .offset = 0, }, }, }, | |||
2581 | SD_BUS_METHOD("GetJob", "u", "o", method_get_job, SD_BUS_VTABLE_UNPRIVILEGED){ .type = _SD_BUS_VTABLE_METHOD, .flags = SD_BUS_VTABLE_UNPRIVILEGED , .x = { .method = { .member = "GetJob", .signature = "u", .result = "o", .handler = method_get_job, .offset = 0, }, }, }, | |||
2582 | SD_BUS_METHOD("GetJobAfter", "u", "a(usssoo)", method_get_job_waiting, SD_BUS_VTABLE_UNPRIVILEGED){ .type = _SD_BUS_VTABLE_METHOD, .flags = SD_BUS_VTABLE_UNPRIVILEGED , .x = { .method = { .member = "GetJobAfter", .signature = "u" , .result = "a(usssoo)", .handler = method_get_job_waiting, . offset = 0, }, }, }, | |||
2583 | SD_BUS_METHOD("GetJobBefore", "u", "a(usssoo)", method_get_job_waiting, SD_BUS_VTABLE_UNPRIVILEGED){ .type = _SD_BUS_VTABLE_METHOD, .flags = SD_BUS_VTABLE_UNPRIVILEGED , .x = { .method = { .member = "GetJobBefore", .signature = "u" , .result = "a(usssoo)", .handler = method_get_job_waiting, . offset = 0, }, }, }, | |||
2584 | SD_BUS_METHOD("CancelJob", "u", NULL, method_cancel_job, SD_BUS_VTABLE_UNPRIVILEGED){ .type = _SD_BUS_VTABLE_METHOD, .flags = SD_BUS_VTABLE_UNPRIVILEGED , .x = { .method = { .member = "CancelJob", .signature = "u", .result = ((void*)0), .handler = method_cancel_job, .offset = 0, }, }, }, | |||
2585 | SD_BUS_METHOD("ClearJobs", NULL, NULL, method_clear_jobs, SD_BUS_VTABLE_UNPRIVILEGED){ .type = _SD_BUS_VTABLE_METHOD, .flags = SD_BUS_VTABLE_UNPRIVILEGED , .x = { .method = { .member = "ClearJobs", .signature = ((void *)0), .result = ((void*)0), .handler = method_clear_jobs, .offset = 0, }, }, }, | |||
2586 | SD_BUS_METHOD("ResetFailed", NULL, NULL, method_reset_failed, SD_BUS_VTABLE_UNPRIVILEGED){ .type = _SD_BUS_VTABLE_METHOD, .flags = SD_BUS_VTABLE_UNPRIVILEGED , .x = { .method = { .member = "ResetFailed", .signature = (( void*)0), .result = ((void*)0), .handler = method_reset_failed , .offset = 0, }, }, }, | |||
2587 | SD_BUS_METHOD("ListUnits", NULL, "a(ssssssouso)", method_list_units, SD_BUS_VTABLE_UNPRIVILEGED){ .type = _SD_BUS_VTABLE_METHOD, .flags = SD_BUS_VTABLE_UNPRIVILEGED , .x = { .method = { .member = "ListUnits", .signature = ((void *)0), .result = "a(ssssssouso)", .handler = method_list_units , .offset = 0, }, }, }, | |||
2588 | SD_BUS_METHOD("ListUnitsFiltered", "as", "a(ssssssouso)", method_list_units_filtered, SD_BUS_VTABLE_UNPRIVILEGED){ .type = _SD_BUS_VTABLE_METHOD, .flags = SD_BUS_VTABLE_UNPRIVILEGED , .x = { .method = { .member = "ListUnitsFiltered", .signature = "as", .result = "a(ssssssouso)", .handler = method_list_units_filtered , .offset = 0, }, }, }, | |||
2589 | SD_BUS_METHOD("ListUnitsByPatterns", "asas", "a(ssssssouso)", method_list_units_by_patterns, SD_BUS_VTABLE_UNPRIVILEGED){ .type = _SD_BUS_VTABLE_METHOD, .flags = SD_BUS_VTABLE_UNPRIVILEGED , .x = { .method = { .member = "ListUnitsByPatterns", .signature = "asas", .result = "a(ssssssouso)", .handler = method_list_units_by_patterns , .offset = 0, }, }, }, | |||
2590 | SD_BUS_METHOD("ListUnitsByNames", "as", "a(ssssssouso)", method_list_units_by_names, SD_BUS_VTABLE_UNPRIVILEGED){ .type = _SD_BUS_VTABLE_METHOD, .flags = SD_BUS_VTABLE_UNPRIVILEGED , .x = { .method = { .member = "ListUnitsByNames", .signature = "as", .result = "a(ssssssouso)", .handler = method_list_units_by_names , .offset = 0, }, }, }, | |||
2591 | SD_BUS_METHOD("ListJobs", NULL, "a(usssoo)", method_list_jobs, SD_BUS_VTABLE_UNPRIVILEGED){ .type = _SD_BUS_VTABLE_METHOD, .flags = SD_BUS_VTABLE_UNPRIVILEGED , .x = { .method = { .member = "ListJobs", .signature = ((void *)0), .result = "a(usssoo)", .handler = method_list_jobs, .offset = 0, }, }, }, | |||
2592 | SD_BUS_METHOD("Subscribe", NULL, NULL, method_subscribe, SD_BUS_VTABLE_UNPRIVILEGED){ .type = _SD_BUS_VTABLE_METHOD, .flags = SD_BUS_VTABLE_UNPRIVILEGED , .x = { .method = { .member = "Subscribe", .signature = ((void *)0), .result = ((void*)0), .handler = method_subscribe, .offset = 0, }, }, }, | |||
2593 | SD_BUS_METHOD("Unsubscribe", NULL, NULL, method_unsubscribe, SD_BUS_VTABLE_UNPRIVILEGED){ .type = _SD_BUS_VTABLE_METHOD, .flags = SD_BUS_VTABLE_UNPRIVILEGED , .x = { .method = { .member = "Unsubscribe", .signature = (( void*)0), .result = ((void*)0), .handler = method_unsubscribe , .offset = 0, }, }, }, | |||
2594 | SD_BUS_METHOD("Dump", NULL, "s", method_dump, SD_BUS_VTABLE_UNPRIVILEGED){ .type = _SD_BUS_VTABLE_METHOD, .flags = SD_BUS_VTABLE_UNPRIVILEGED , .x = { .method = { .member = "Dump", .signature = ((void*)0 ), .result = "s", .handler = method_dump, .offset = 0, }, }, }, | |||
2595 | SD_BUS_METHOD("DumpByFileDescriptor", NULL, "h", method_dump_by_fd, SD_BUS_VTABLE_UNPRIVILEGED){ .type = _SD_BUS_VTABLE_METHOD, .flags = SD_BUS_VTABLE_UNPRIVILEGED , .x = { .method = { .member = "DumpByFileDescriptor", .signature = ((void*)0), .result = "h", .handler = method_dump_by_fd, . offset = 0, }, }, }, | |||
2596 | SD_BUS_METHOD("CreateSnapshot", "sb", "o", method_refuse_snapshot, SD_BUS_VTABLE_UNPRIVILEGED|SD_BUS_VTABLE_HIDDEN){ .type = _SD_BUS_VTABLE_METHOD, .flags = SD_BUS_VTABLE_UNPRIVILEGED |SD_BUS_VTABLE_HIDDEN, .x = { .method = { .member = "CreateSnapshot" , .signature = "sb", .result = "o", .handler = method_refuse_snapshot , .offset = 0, }, }, }, | |||
2597 | SD_BUS_METHOD("RemoveSnapshot", "s", NULL, method_refuse_snapshot, SD_BUS_VTABLE_UNPRIVILEGED|SD_BUS_VTABLE_HIDDEN){ .type = _SD_BUS_VTABLE_METHOD, .flags = SD_BUS_VTABLE_UNPRIVILEGED |SD_BUS_VTABLE_HIDDEN, .x = { .method = { .member = "RemoveSnapshot" , .signature = "s", .result = ((void*)0), .handler = method_refuse_snapshot , .offset = 0, }, }, }, | |||
2598 | SD_BUS_METHOD("Reload", NULL, NULL, method_reload, SD_BUS_VTABLE_UNPRIVILEGED){ .type = _SD_BUS_VTABLE_METHOD, .flags = SD_BUS_VTABLE_UNPRIVILEGED , .x = { .method = { .member = "Reload", .signature = ((void* )0), .result = ((void*)0), .handler = method_reload, .offset = 0, }, }, }, | |||
2599 | SD_BUS_METHOD("Reexecute", NULL, NULL, method_reexecute, SD_BUS_VTABLE_UNPRIVILEGED){ .type = _SD_BUS_VTABLE_METHOD, .flags = SD_BUS_VTABLE_UNPRIVILEGED , .x = { .method = { .member = "Reexecute", .signature = ((void *)0), .result = ((void*)0), .handler = method_reexecute, .offset = 0, }, }, }, | |||
2600 | SD_BUS_METHOD("Exit", NULL, NULL, method_exit, 0){ .type = _SD_BUS_VTABLE_METHOD, .flags = 0, .x = { .method = { .member = "Exit", .signature = ((void*)0), .result = ((void *)0), .handler = method_exit, .offset = 0, }, }, }, | |||
2601 | SD_BUS_METHOD("Reboot", NULL, NULL, method_reboot, SD_BUS_VTABLE_CAPABILITY(CAP_SYS_BOOT)){ .type = _SD_BUS_VTABLE_METHOD, .flags = ((uint64_t) (((22)+ 1) & 0xFFFF) << 40), .x = { .method = { .member = "Reboot" , .signature = ((void*)0), .result = ((void*)0), .handler = method_reboot , .offset = 0, }, }, }, | |||
2602 | SD_BUS_METHOD("PowerOff", NULL, NULL, method_poweroff, SD_BUS_VTABLE_CAPABILITY(CAP_SYS_BOOT)){ .type = _SD_BUS_VTABLE_METHOD, .flags = ((uint64_t) (((22)+ 1) & 0xFFFF) << 40), .x = { .method = { .member = "PowerOff" , .signature = ((void*)0), .result = ((void*)0), .handler = method_poweroff , .offset = 0, }, }, }, | |||
2603 | SD_BUS_METHOD("Halt", NULL, NULL, method_halt, SD_BUS_VTABLE_CAPABILITY(CAP_SYS_BOOT)){ .type = _SD_BUS_VTABLE_METHOD, .flags = ((uint64_t) (((22)+ 1) & 0xFFFF) << 40), .x = { .method = { .member = "Halt" , .signature = ((void*)0), .result = ((void*)0), .handler = method_halt , .offset = 0, }, }, }, | |||
2604 | SD_BUS_METHOD("KExec", NULL, NULL, method_kexec, SD_BUS_VTABLE_CAPABILITY(CAP_SYS_BOOT)){ .type = _SD_BUS_VTABLE_METHOD, .flags = ((uint64_t) (((22)+ 1) & 0xFFFF) << 40), .x = { .method = { .member = "KExec" , .signature = ((void*)0), .result = ((void*)0), .handler = method_kexec , .offset = 0, }, }, }, | |||
2605 | SD_BUS_METHOD("SwitchRoot", "ss", NULL, method_switch_root, SD_BUS_VTABLE_CAPABILITY(CAP_SYS_BOOT)){ .type = _SD_BUS_VTABLE_METHOD, .flags = ((uint64_t) (((22)+ 1) & 0xFFFF) << 40), .x = { .method = { .member = "SwitchRoot" , .signature = "ss", .result = ((void*)0), .handler = method_switch_root , .offset = 0, }, }, }, | |||
2606 | SD_BUS_METHOD("SetEnvironment", "as", NULL, method_set_environment, SD_BUS_VTABLE_UNPRIVILEGED){ .type = _SD_BUS_VTABLE_METHOD, .flags = SD_BUS_VTABLE_UNPRIVILEGED , .x = { .method = { .member = "SetEnvironment", .signature = "as", .result = ((void*)0), .handler = method_set_environment , .offset = 0, }, }, }, | |||
2607 | SD_BUS_METHOD("UnsetEnvironment", "as", NULL, method_unset_environment, SD_BUS_VTABLE_UNPRIVILEGED){ .type = _SD_BUS_VTABLE_METHOD, .flags = SD_BUS_VTABLE_UNPRIVILEGED , .x = { .method = { .member = "UnsetEnvironment", .signature = "as", .result = ((void*)0), .handler = method_unset_environment , .offset = 0, }, }, }, | |||
2608 | SD_BUS_METHOD("UnsetAndSetEnvironment", "asas", NULL, method_unset_and_set_environment, SD_BUS_VTABLE_UNPRIVILEGED){ .type = _SD_BUS_VTABLE_METHOD, .flags = SD_BUS_VTABLE_UNPRIVILEGED , .x = { .method = { .member = "UnsetAndSetEnvironment", .signature = "asas", .result = ((void*)0), .handler = method_unset_and_set_environment , .offset = 0, }, }, }, | |||
2609 | SD_BUS_METHOD("ListUnitFiles", NULL, "a(ss)", method_list_unit_files, SD_BUS_VTABLE_UNPRIVILEGED){ .type = _SD_BUS_VTABLE_METHOD, .flags = SD_BUS_VTABLE_UNPRIVILEGED , .x = { .method = { .member = "ListUnitFiles", .signature = ( (void*)0), .result = "a(ss)", .handler = method_list_unit_files , .offset = 0, }, }, }, | |||
2610 | SD_BUS_METHOD("ListUnitFilesByPatterns", "asas", "a(ss)", method_list_unit_files_by_patterns, SD_BUS_VTABLE_UNPRIVILEGED){ .type = _SD_BUS_VTABLE_METHOD, .flags = SD_BUS_VTABLE_UNPRIVILEGED , .x = { .method = { .member = "ListUnitFilesByPatterns", .signature = "asas", .result = "a(ss)", .handler = method_list_unit_files_by_patterns , .offset = 0, }, }, }, | |||
2611 | SD_BUS_METHOD("GetUnitFileState", "s", "s", method_get_unit_file_state, SD_BUS_VTABLE_UNPRIVILEGED){ .type = _SD_BUS_VTABLE_METHOD, .flags = SD_BUS_VTABLE_UNPRIVILEGED , .x = { .method = { .member = "GetUnitFileState", .signature = "s", .result = "s", .handler = method_get_unit_file_state, .offset = 0, }, }, }, | |||
2612 | SD_BUS_METHOD("EnableUnitFiles", "asbb", "ba(sss)", method_enable_unit_files, SD_BUS_VTABLE_UNPRIVILEGED){ .type = _SD_BUS_VTABLE_METHOD, .flags = SD_BUS_VTABLE_UNPRIVILEGED , .x = { .method = { .member = "EnableUnitFiles", .signature = "asbb", .result = "ba(sss)", .handler = method_enable_unit_files , .offset = 0, }, }, }, | |||
2613 | SD_BUS_METHOD("DisableUnitFiles", "asb", "a(sss)", method_disable_unit_files, SD_BUS_VTABLE_UNPRIVILEGED){ .type = _SD_BUS_VTABLE_METHOD, .flags = SD_BUS_VTABLE_UNPRIVILEGED , .x = { .method = { .member = "DisableUnitFiles", .signature = "asb", .result = "a(sss)", .handler = method_disable_unit_files , .offset = 0, }, }, }, | |||
2614 | SD_BUS_METHOD("ReenableUnitFiles", "asbb", "ba(sss)", method_reenable_unit_files, SD_BUS_VTABLE_UNPRIVILEGED){ .type = _SD_BUS_VTABLE_METHOD, .flags = SD_BUS_VTABLE_UNPRIVILEGED , .x = { .method = { .member = "ReenableUnitFiles", .signature = "asbb", .result = "ba(sss)", .handler = method_reenable_unit_files , .offset = 0, }, }, }, | |||
2615 | SD_BUS_METHOD("LinkUnitFiles", "asbb", "a(sss)", method_link_unit_files, SD_BUS_VTABLE_UNPRIVILEGED){ .type = _SD_BUS_VTABLE_METHOD, .flags = SD_BUS_VTABLE_UNPRIVILEGED , .x = { .method = { .member = "LinkUnitFiles", .signature = "asbb" , .result = "a(sss)", .handler = method_link_unit_files, .offset = 0, }, }, }, | |||
2616 | SD_BUS_METHOD("PresetUnitFiles", "asbb", "ba(sss)", method_preset_unit_files, SD_BUS_VTABLE_UNPRIVILEGED){ .type = _SD_BUS_VTABLE_METHOD, .flags = SD_BUS_VTABLE_UNPRIVILEGED , .x = { .method = { .member = "PresetUnitFiles", .signature = "asbb", .result = "ba(sss)", .handler = method_preset_unit_files , .offset = 0, }, }, }, | |||
2617 | SD_BUS_METHOD("PresetUnitFilesWithMode", "assbb", "ba(sss)", method_preset_unit_files_with_mode, SD_BUS_VTABLE_UNPRIVILEGED){ .type = _SD_BUS_VTABLE_METHOD, .flags = SD_BUS_VTABLE_UNPRIVILEGED , .x = { .method = { .member = "PresetUnitFilesWithMode", .signature = "assbb", .result = "ba(sss)", .handler = method_preset_unit_files_with_mode , .offset = 0, }, }, }, | |||
2618 | SD_BUS_METHOD("MaskUnitFiles", "asbb", "a(sss)", method_mask_unit_files, SD_BUS_VTABLE_UNPRIVILEGED){ .type = _SD_BUS_VTABLE_METHOD, .flags = SD_BUS_VTABLE_UNPRIVILEGED , .x = { .method = { .member = "MaskUnitFiles", .signature = "asbb" , .result = "a(sss)", .handler = method_mask_unit_files, .offset = 0, }, }, }, | |||
2619 | SD_BUS_METHOD("UnmaskUnitFiles", "asb", "a(sss)", method_unmask_unit_files, SD_BUS_VTABLE_UNPRIVILEGED){ .type = _SD_BUS_VTABLE_METHOD, .flags = SD_BUS_VTABLE_UNPRIVILEGED , .x = { .method = { .member = "UnmaskUnitFiles", .signature = "asb", .result = "a(sss)", .handler = method_unmask_unit_files , .offset = 0, }, }, }, | |||
2620 | SD_BUS_METHOD("RevertUnitFiles", "as", "a(sss)", method_revert_unit_files, SD_BUS_VTABLE_UNPRIVILEGED){ .type = _SD_BUS_VTABLE_METHOD, .flags = SD_BUS_VTABLE_UNPRIVILEGED , .x = { .method = { .member = "RevertUnitFiles", .signature = "as", .result = "a(sss)", .handler = method_revert_unit_files , .offset = 0, }, }, }, | |||
2621 | SD_BUS_METHOD("SetDefaultTarget", "sb", "a(sss)", method_set_default_target, SD_BUS_VTABLE_UNPRIVILEGED){ .type = _SD_BUS_VTABLE_METHOD, .flags = SD_BUS_VTABLE_UNPRIVILEGED , .x = { .method = { .member = "SetDefaultTarget", .signature = "sb", .result = "a(sss)", .handler = method_set_default_target , .offset = 0, }, }, }, | |||
2622 | SD_BUS_METHOD("GetDefaultTarget", NULL, "s", method_get_default_target, SD_BUS_VTABLE_UNPRIVILEGED){ .type = _SD_BUS_VTABLE_METHOD, .flags = SD_BUS_VTABLE_UNPRIVILEGED , .x = { .method = { .member = "GetDefaultTarget", .signature = ((void*)0), .result = "s", .handler = method_get_default_target , .offset = 0, }, }, }, | |||
2623 | SD_BUS_METHOD("PresetAllUnitFiles", "sbb", "a(sss)", method_preset_all_unit_files, SD_BUS_VTABLE_UNPRIVILEGED){ .type = _SD_BUS_VTABLE_METHOD, .flags = SD_BUS_VTABLE_UNPRIVILEGED , .x = { .method = { .member = "PresetAllUnitFiles", .signature = "sbb", .result = "a(sss)", .handler = method_preset_all_unit_files , .offset = 0, }, }, }, | |||
2624 | SD_BUS_METHOD("AddDependencyUnitFiles", "asssbb", "a(sss)", method_add_dependency_unit_files, SD_BUS_VTABLE_UNPRIVILEGED){ .type = _SD_BUS_VTABLE_METHOD, .flags = SD_BUS_VTABLE_UNPRIVILEGED , .x = { .method = { .member = "AddDependencyUnitFiles", .signature = "asssbb", .result = "a(sss)", .handler = method_add_dependency_unit_files , .offset = 0, }, }, }, | |||
2625 | SD_BUS_METHOD("GetUnitFileLinks", "sb", "as", method_get_unit_file_links, SD_BUS_VTABLE_UNPRIVILEGED){ .type = _SD_BUS_VTABLE_METHOD, .flags = SD_BUS_VTABLE_UNPRIVILEGED , .x = { .method = { .member = "GetUnitFileLinks", .signature = "sb", .result = "as", .handler = method_get_unit_file_links , .offset = 0, }, }, }, | |||
2626 | SD_BUS_METHOD("SetExitCode", "y", NULL, method_set_exit_code, SD_BUS_VTABLE_UNPRIVILEGED){ .type = _SD_BUS_VTABLE_METHOD, .flags = SD_BUS_VTABLE_UNPRIVILEGED , .x = { .method = { .member = "SetExitCode", .signature = "y" , .result = ((void*)0), .handler = method_set_exit_code, .offset = 0, }, }, }, | |||
2627 | SD_BUS_METHOD("LookupDynamicUserByName", "s", "u", method_lookup_dynamic_user_by_name, SD_BUS_VTABLE_UNPRIVILEGED){ .type = _SD_BUS_VTABLE_METHOD, .flags = SD_BUS_VTABLE_UNPRIVILEGED , .x = { .method = { .member = "LookupDynamicUserByName", .signature = "s", .result = "u", .handler = method_lookup_dynamic_user_by_name , .offset = 0, }, }, }, | |||
2628 | SD_BUS_METHOD("LookupDynamicUserByUID", "u", "s", method_lookup_dynamic_user_by_uid, SD_BUS_VTABLE_UNPRIVILEGED){ .type = _SD_BUS_VTABLE_METHOD, .flags = SD_BUS_VTABLE_UNPRIVILEGED , .x = { .method = { .member = "LookupDynamicUserByUID", .signature = "u", .result = "s", .handler = method_lookup_dynamic_user_by_uid , .offset = 0, }, }, }, | |||
2629 | SD_BUS_METHOD("GetDynamicUsers", NULL, "a(us)", method_get_dynamic_users, SD_BUS_VTABLE_UNPRIVILEGED){ .type = _SD_BUS_VTABLE_METHOD, .flags = SD_BUS_VTABLE_UNPRIVILEGED , .x = { .method = { .member = "GetDynamicUsers", .signature = ((void*)0), .result = "a(us)", .handler = method_get_dynamic_users , .offset = 0, }, }, }, | |||
2630 | ||||
2631 | SD_BUS_SIGNAL("UnitNew", "so", 0){ .type = _SD_BUS_VTABLE_SIGNAL, .flags = 0, .x = { .signal = { .member = "UnitNew", .signature = "so", }, }, }, | |||
2632 | SD_BUS_SIGNAL("UnitRemoved", "so", 0){ .type = _SD_BUS_VTABLE_SIGNAL, .flags = 0, .x = { .signal = { .member = "UnitRemoved", .signature = "so", }, }, }, | |||
2633 | SD_BUS_SIGNAL("JobNew", "uos", 0){ .type = _SD_BUS_VTABLE_SIGNAL, .flags = 0, .x = { .signal = { .member = "JobNew", .signature = "uos", }, }, }, | |||
2634 | SD_BUS_SIGNAL("JobRemoved", "uoss", 0){ .type = _SD_BUS_VTABLE_SIGNAL, .flags = 0, .x = { .signal = { .member = "JobRemoved", .signature = "uoss", }, }, }, | |||
2635 | SD_BUS_SIGNAL("StartupFinished", "tttttt", 0){ .type = _SD_BUS_VTABLE_SIGNAL, .flags = 0, .x = { .signal = { .member = "StartupFinished", .signature = "tttttt", }, }, }, | |||
2636 | SD_BUS_SIGNAL("UnitFilesChanged", NULL, 0){ .type = _SD_BUS_VTABLE_SIGNAL, .flags = 0, .x = { .signal = { .member = "UnitFilesChanged", .signature = ((void*)0), }, } , }, | |||
2637 | SD_BUS_SIGNAL("Reloading", "b", 0){ .type = _SD_BUS_VTABLE_SIGNAL, .flags = 0, .x = { .signal = { .member = "Reloading", .signature = "b", }, }, }, | |||
2638 | ||||
2639 | SD_BUS_VTABLE_END{ .type = _SD_BUS_VTABLE_END, .flags = 0, .x = { { 0 } }, } | |||
2640 | }; | |||
2641 | ||||
2642 | static int send_finished(sd_bus *bus, void *userdata) { | |||
2643 | _cleanup_(sd_bus_message_unrefp)__attribute__((cleanup(sd_bus_message_unrefp))) sd_bus_message *message = NULL((void*)0); | |||
2644 | usec_t *times = userdata; | |||
2645 | int r; | |||
2646 | ||||
2647 | assert(bus)do { if ((__builtin_expect(!!(!(bus)),0))) log_assert_failed_realm (LOG_REALM_SYSTEMD, ("bus"), "../src/core/dbus-manager.c", 2647 , __PRETTY_FUNCTION__); } while (0); | |||
2648 | assert(times)do { if ((__builtin_expect(!!(!(times)),0))) log_assert_failed_realm (LOG_REALM_SYSTEMD, ("times"), "../src/core/dbus-manager.c", 2648 , __PRETTY_FUNCTION__); } while (0); | |||
2649 | ||||
2650 | r = sd_bus_message_new_signal(bus, &message, "/org/freedesktop/systemd1", "org.freedesktop.systemd1.Manager", "StartupFinished"); | |||
2651 | if (r < 0) | |||
2652 | return r; | |||
2653 | ||||
2654 | r = sd_bus_message_append(message, "tttttt", times[0], times[1], times[2], times[3], times[4], times[5]); | |||
2655 | if (r < 0) | |||
2656 | return r; | |||
2657 | ||||
2658 | return sd_bus_send(bus, message, NULL((void*)0)); | |||
2659 | } | |||
2660 | ||||
2661 | void bus_manager_send_finished( | |||
2662 | Manager *m, | |||
2663 | usec_t firmware_usec, | |||
2664 | usec_t loader_usec, | |||
2665 | usec_t kernel_usec, | |||
2666 | usec_t initrd_usec, | |||
2667 | usec_t userspace_usec, | |||
2668 | usec_t total_usec) { | |||
2669 | ||||
2670 | int r; | |||
2671 | ||||
2672 | assert(m)do { if ((__builtin_expect(!!(!(m)),0))) log_assert_failed_realm (LOG_REALM_SYSTEMD, ("m"), "../src/core/dbus-manager.c", 2672 , __PRETTY_FUNCTION__); } while (0); | |||
2673 | ||||
2674 | r = bus_foreach_bus( | |||
2675 | m, | |||
2676 | NULL((void*)0), | |||
2677 | send_finished, | |||
2678 | (usec_t[6]) { | |||
2679 | firmware_usec, | |||
2680 | loader_usec, | |||
2681 | kernel_usec, | |||
2682 | initrd_usec, | |||
2683 | userspace_usec, | |||
2684 | total_usec | |||
2685 | }); | |||
2686 | if (r < 0) | |||
2687 | log_debug_errno(r, "Failed to send finished signal: %m")({ int _level = ((7)), _e = ((r)), _realm = (LOG_REALM_SYSTEMD ); (log_get_max_level_realm(_realm) >= ((_level) & 0x07 )) ? log_internal_realm(((_realm) << 10 | (_level)), _e , "../src/core/dbus-manager.c", 2687, __func__, "Failed to send finished signal: %m" ) : -abs(_e); }); | |||
2688 | } | |||
2689 | ||||
2690 | static int send_reloading(sd_bus *bus, void *userdata) { | |||
2691 | _cleanup_(sd_bus_message_unrefp)__attribute__((cleanup(sd_bus_message_unrefp))) sd_bus_message *message = NULL((void*)0); | |||
2692 | int r; | |||
2693 | ||||
2694 | assert(bus)do { if ((__builtin_expect(!!(!(bus)),0))) log_assert_failed_realm (LOG_REALM_SYSTEMD, ("bus"), "../src/core/dbus-manager.c", 2694 , __PRETTY_FUNCTION__); } while (0); | |||
2695 | ||||
2696 | r = sd_bus_message_new_signal(bus, &message, "/org/freedesktop/systemd1", "org.freedesktop.systemd1.Manager", "Reloading"); | |||
2697 | if (r < 0) | |||
2698 | return r; | |||
2699 | ||||
2700 | r = sd_bus_message_append(message, "b", PTR_TO_INT(userdata)((int) ((intptr_t) (userdata)))); | |||
2701 | if (r < 0) | |||
2702 | return r; | |||
2703 | ||||
2704 | return sd_bus_send(bus, message, NULL((void*)0)); | |||
2705 | } | |||
2706 | ||||
2707 | void bus_manager_send_reloading(Manager *m, bool_Bool active) { | |||
2708 | int r; | |||
2709 | ||||
2710 | assert(m)do { if ((__builtin_expect(!!(!(m)),0))) log_assert_failed_realm (LOG_REALM_SYSTEMD, ("m"), "../src/core/dbus-manager.c", 2710 , __PRETTY_FUNCTION__); } while (0); | |||
2711 | ||||
2712 | r = bus_foreach_bus(m, NULL((void*)0), send_reloading, INT_TO_PTR(active)((void *) ((intptr_t) (active)))); | |||
2713 | if (r < 0) | |||
2714 | log_debug_errno(r, "Failed to send reloading signal: %m")({ int _level = ((7)), _e = ((r)), _realm = (LOG_REALM_SYSTEMD ); (log_get_max_level_realm(_realm) >= ((_level) & 0x07 )) ? log_internal_realm(((_realm) << 10 | (_level)), _e , "../src/core/dbus-manager.c", 2714, __func__, "Failed to send reloading signal: %m" ) : -abs(_e); }); | |||
2715 | } | |||
2716 | ||||
2717 | static int send_changed_signal(sd_bus *bus, void *userdata) { | |||
2718 | assert(bus)do { if ((__builtin_expect(!!(!(bus)),0))) log_assert_failed_realm (LOG_REALM_SYSTEMD, ("bus"), "../src/core/dbus-manager.c", 2718 , __PRETTY_FUNCTION__); } while (0); | |||
2719 | ||||
2720 | return sd_bus_emit_properties_changed_strv(bus, | |||
2721 | "/org/freedesktop/systemd1", | |||
2722 | "org.freedesktop.systemd1.Manager", | |||
2723 | NULL((void*)0)); | |||
2724 | } | |||
2725 | ||||
2726 | void bus_manager_send_change_signal(Manager *m) { | |||
2727 | int r; | |||
2728 | ||||
2729 | assert(m)do { if ((__builtin_expect(!!(!(m)),0))) log_assert_failed_realm (LOG_REALM_SYSTEMD, ("m"), "../src/core/dbus-manager.c", 2729 , __PRETTY_FUNCTION__); } while (0); | |||
2730 | ||||
2731 | r = bus_foreach_bus(m, NULL((void*)0), send_changed_signal, NULL((void*)0)); | |||
2732 | if (r < 0) | |||
2733 | log_debug_errno(r, "Failed to send manager change signal: %m")({ int _level = ((7)), _e = ((r)), _realm = (LOG_REALM_SYSTEMD ); (log_get_max_level_realm(_realm) >= ((_level) & 0x07 )) ? log_internal_realm(((_realm) << 10 | (_level)), _e , "../src/core/dbus-manager.c", 2733, __func__, "Failed to send manager change signal: %m" ) : -abs(_e); }); | |||
2734 | } |