chiark / gitweb /
journalctl: use _COMM= match for scripts
[elogind.git] / src / machine / machined.h
1 /*-*- Mode: C; c-basic-offset: 8; indent-tabs-mode: nil -*-*/
2
3 #pragma once
4
5 /***
6   This file is part of systemd.
7
8   Copyright 2013 Lennart Poettering
9
10   systemd is free software; you can redistribute it and/or modify it
11   under the terms of the GNU Lesser General Public License as published by
12   the Free Software Foundation; either version 2.1 of the License, or
13   (at your option) any later version.
14
15   systemd is distributed in the hope that it will be useful, but
16   WITHOUT ANY WARRANTY; without even the implied warranty of
17   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
18   Lesser General Public License for more details.
19
20   You should have received a copy of the GNU Lesser General Public License
21   along with systemd; If not, see <http://www.gnu.org/licenses/>.
22 ***/
23
24 #include <stdbool.h>
25 #include <inttypes.h>
26 #include <dbus/dbus.h>
27
28 #include "util.h"
29 #include "list.h"
30 #include "hashmap.h"
31
32 typedef struct Manager Manager;
33
34 #include "machine.h"
35
36 struct Manager {
37         DBusConnection *bus;
38
39         int bus_fd;
40         int epoll_fd;
41
42         Hashmap *machines;
43         Hashmap *machine_units;
44
45         LIST_HEAD(Machine, machine_gc_queue);
46 };
47
48 enum {
49         FD_BUS
50 };
51
52 Manager *manager_new(void);
53 void manager_free(Manager *m);
54
55 int manager_add_machine(Manager *m, const char *name, Machine **_machine);
56
57 int manager_enumerate_machines(Manager *m);
58
59 int manager_startup(Manager *m);
60 int manager_run(Manager *m);
61
62 void manager_gc(Manager *m, bool drop_not_started);
63
64 int manager_get_machine_by_pid(Manager *m, pid_t pid, Machine **machine);
65
66 extern const DBusObjectPathVTable bus_manager_vtable;
67
68 DBusHandlerResult bus_message_filter(DBusConnection *c, DBusMessage *message, void *userdata);
69
70 int manager_start_scope(Manager *manager, const char *scope, pid_t pid, const char *slice, const char *description, DBusMessageIter *more_properties, DBusError *error, char **job);
71 int manager_stop_unit(Manager *manager, const char *unit, DBusError *error, char **job);
72 int manager_kill_unit(Manager *manager, const char *unit, KillWho who, int signo, DBusError *error);
73 int manager_unit_is_active(Manager *manager, const char *unit);