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