]> git.ipfire.org Git - thirdparty/systemd.git/blob - src/machine/machined.h
Merge pull request #16398 from poettering/machined-varlink
[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 typedef struct Manager Manager;
10
11 #include "hashmap.h"
12 #include "image-dbus.h"
13 #include "list.h"
14 #include "machine-dbus.h"
15 #include "machine.h"
16 #include "operation.h"
17 #include "varlink.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 VarlinkServer *varlink_server;
42 };
43
44 int manager_add_machine(Manager *m, const char *name, Machine **_machine);
45 int manager_get_machine_by_pid(Manager *m, pid_t pid, Machine **machine);
46
47 extern const BusObjectImplementation manager_object;
48
49 int match_reloading(sd_bus_message *message, void *userdata, sd_bus_error *error);
50 int match_unit_removed(sd_bus_message *message, void *userdata, sd_bus_error *error);
51 int match_properties_changed(sd_bus_message *message, void *userdata, sd_bus_error *error);
52 int match_job_removed(sd_bus_message *message, void *userdata, sd_bus_error *error);
53
54 int manager_stop_unit(Manager *manager, const char *unit, sd_bus_error *error, char **job);
55 int manager_kill_unit(Manager *manager, const char *unit, int signo, sd_bus_error *error);
56 int manager_unref_unit(Manager *m, const char *unit, sd_bus_error *error);
57 int manager_unit_is_active(Manager *manager, const char *unit);
58 int manager_job_is_active(Manager *manager, const char *path);
59
60 int manager_enqueue_nscd_cache_flush(Manager *m);
61
62 int manager_find_machine_for_uid(Manager *m, uid_t host_uid, Machine **ret_machine, uid_t *ret_internal_uid);
63 int manager_find_machine_for_gid(Manager *m, gid_t host_gid, Machine **ret_machine, gid_t *ret_internal_gid);