0ec3fb9326f5b9f8b0558203ffa92a6295d549f4
[thirdparty/systemd.git] / src / machine / machined.h
1 /* SPDX-License-Identifier: LGPL-2.1+ */
2 #pragma once
3
4 #include <stdbool.h>
5
6 #include "sd-bus.h"
7 #include "sd-event.h"
8
9 #include "hashmap.h"
10 #include "list.h"
11
12 typedef struct Manager Manager;
13
14 #include "image-dbus.h"
15 #include "machine-dbus.h"
16 #include "machine.h"
17 #include "operation.h"
18
19 struct Manager {
20 sd_event *event;
21 sd_bus *bus;
22
23 Hashmap *machines;
24 Hashmap *machine_units;
25 Hashmap *machine_leaders;
26
27 Hashmap *polkit_registry;
28
29 Hashmap *image_cache;
30 sd_event_source *image_cache_defer_event;
31
32 LIST_HEAD(Machine, machine_gc_queue);
33
34 Machine *host_machine;
35
36 LIST_HEAD(Operation, operations);
37 unsigned n_operations;
38
39 sd_event_source *nscd_cache_flush_event;
40 };
41
42 int manager_add_machine(Manager *m, const char *name, Machine **_machine);
43 int manager_get_machine_by_pid(Manager *m, pid_t pid, Machine **machine);
44
45 extern const BusObjectImplementation manager_object;
46
47 int match_reloading(sd_bus_message *message, void *userdata, sd_bus_error *error);
48 int match_unit_removed(sd_bus_message *message, void *userdata, sd_bus_error *error);
49 int match_properties_changed(sd_bus_message *message, void *userdata, sd_bus_error *error);
50 int match_job_removed(sd_bus_message *message, void *userdata, sd_bus_error *error);
51
52 int manager_stop_unit(Manager *manager, const char *unit, sd_bus_error *error, char **job);
53 int manager_kill_unit(Manager *manager, const char *unit, int signo, sd_bus_error *error);
54 int manager_unref_unit(Manager *m, const char *unit, sd_bus_error *error);
55 int manager_unit_is_active(Manager *manager, const char *unit);
56 int manager_job_is_active(Manager *manager, const char *path);
57
58 int manager_enqueue_nscd_cache_flush(Manager *m);