]>
Commit | Line | Data |
---|---|---|
1ee306e1 LP |
1 | #pragma once |
2 | ||
3 | /*** | |
4 | This file is part of systemd. | |
5 | ||
6 | Copyright 2013 Lennart Poettering | |
7 | ||
8 | systemd is free software; you can redistribute it and/or modify it | |
9 | under the terms of the GNU Lesser General Public License as published by | |
10 | the Free Software Foundation; either version 2.1 of the License, or | |
11 | (at your option) any later version. | |
12 | ||
13 | systemd is distributed in the hope that it will be useful, but | |
14 | WITHOUT ANY WARRANTY; without even the implied warranty of | |
15 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |
16 | Lesser General Public License for more details. | |
17 | ||
18 | You should have received a copy of the GNU Lesser General Public License | |
19 | along with systemd; If not, see <http://www.gnu.org/licenses/>. | |
20 | ***/ | |
21 | ||
22 | #include <stdbool.h> | |
1ee306e1 | 23 | |
c3350683 | 24 | #include "sd-bus.h" |
07630cea LP |
25 | #include "sd-event.h" |
26 | ||
27 | #include "hashmap.h" | |
28 | #include "list.h" | |
1ee306e1 LP |
29 | |
30 | typedef struct Manager Manager; | |
31 | ||
003dffde | 32 | #include "image-dbus.h" |
71d35b6b TA |
33 | #include "machine-dbus.h" |
34 | #include "machine.h" | |
1ee306e1 LP |
35 | |
36 | struct Manager { | |
c3350683 LP |
37 | sd_event *event; |
38 | sd_bus *bus; | |
1ee306e1 LP |
39 | |
40 | Hashmap *machines; | |
41 | Hashmap *machine_units; | |
d3e84ddb | 42 | Hashmap *machine_leaders; |
1ee306e1 | 43 | |
d04c1fb8 LP |
44 | Hashmap *polkit_registry; |
45 | ||
1ddb263d LP |
46 | Hashmap *image_cache; |
47 | sd_event_source *image_cache_defer_event; | |
48 | ||
1ee306e1 | 49 | LIST_HEAD(Machine, machine_gc_queue); |
fbe55073 LP |
50 | |
51 | Machine *host_machine; | |
1ee306e1 LP |
52 | }; |
53 | ||
1ee306e1 LP |
54 | Manager *manager_new(void); |
55 | void manager_free(Manager *m); | |
56 | ||
57 | int manager_add_machine(Manager *m, const char *name, Machine **_machine); | |
1ee306e1 LP |
58 | int manager_enumerate_machines(Manager *m); |
59 | ||
60 | int manager_startup(Manager *m); | |
61 | int manager_run(Manager *m); | |
62 | ||
63 | void manager_gc(Manager *m, bool drop_not_started); | |
64 | ||
65 | int manager_get_machine_by_pid(Manager *m, pid_t pid, Machine **machine); | |
66 | ||
c3350683 LP |
67 | extern const sd_bus_vtable manager_vtable[]; |
68 | ||
19070062 LP |
69 | int match_reloading(sd_bus_message *message, void *userdata, sd_bus_error *error); |
70 | int match_unit_removed(sd_bus_message *message, void *userdata, sd_bus_error *error); | |
71 | int match_properties_changed(sd_bus_message *message, void *userdata, sd_bus_error *error); | |
72 | int match_job_removed(sd_bus_message *message, void *userdata, sd_bus_error *error); | |
1ee306e1 | 73 | |
c3350683 LP |
74 | int manager_start_scope(Manager *manager, const char *scope, pid_t pid, const char *slice, const char *description, sd_bus_message *more_properties, sd_bus_error *error, char **job); |
75 | int manager_stop_unit(Manager *manager, const char *unit, sd_bus_error *error, char **job); | |
de58a50e | 76 | int manager_kill_unit(Manager *manager, const char *unit, int signo, sd_bus_error *error); |
1ee306e1 | 77 | int manager_unit_is_active(Manager *manager, const char *unit); |
c3350683 | 78 | int manager_job_is_active(Manager *manager, const char *path); |