machined.c revision d9e34bfda3d34dcde00a876cb052e7de0655e1cb
f579559b3a14c1f1ef96c372e7626c4733e6ef7dTom Gundersen/*-*- Mode: C; c-basic-offset: 8; indent-tabs-mode: nil -*-*/
f579559b3a14c1f1ef96c372e7626c4733e6ef7dTom Gundersen This file is part of systemd.
f579559b3a14c1f1ef96c372e7626c4733e6ef7dTom Gundersen Copyright 2013 Lennart Poettering
f579559b3a14c1f1ef96c372e7626c4733e6ef7dTom Gundersen systemd is free software; you can redistribute it and/or modify it
f579559b3a14c1f1ef96c372e7626c4733e6ef7dTom Gundersen under the terms of the GNU Lesser General Public License as published by
f579559b3a14c1f1ef96c372e7626c4733e6ef7dTom Gundersen the Free Software Foundation; either version 2.1 of the License, or
f579559b3a14c1f1ef96c372e7626c4733e6ef7dTom Gundersen (at your option) any later version.
f579559b3a14c1f1ef96c372e7626c4733e6ef7dTom Gundersen systemd is distributed in the hope that it will be useful, but
f579559b3a14c1f1ef96c372e7626c4733e6ef7dTom Gundersen WITHOUT ANY WARRANTY; without even the implied warranty of
f579559b3a14c1f1ef96c372e7626c4733e6ef7dTom Gundersen MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
f579559b3a14c1f1ef96c372e7626c4733e6ef7dTom Gundersen Lesser General Public License for more details.
f579559b3a14c1f1ef96c372e7626c4733e6ef7dTom Gundersen You should have received a copy of the GNU Lesser General Public License
f579559b3a14c1f1ef96c372e7626c4733e6ef7dTom Gundersen along with systemd; If not, see <http://www.gnu.org/licenses/>.
f579559b3a14c1f1ef96c372e7626c4733e6ef7dTom Gundersen m->machines = hashmap_new(string_hash_func, string_compare_func);
f579559b3a14c1f1ef96c372e7626c4733e6ef7dTom Gundersen m->machine_units = hashmap_new(string_hash_func, string_compare_func);
f579559b3a14c1f1ef96c372e7626c4733e6ef7dTom Gundersen m->machine_leaders = hashmap_new(trivial_hash_func, trivial_compare_func);
12e0f830f592ec4c6bb49ac7ae1e0e84f74105e3Tom Gundersen if (!m->machines || !m->machine_units || !m->machine_leaders) {
f579559b3a14c1f1ef96c372e7626c4733e6ef7dTom Gundersen while ((machine = hashmap_first(m->machines)))
free(m);
assert(m);
return -errno;
assert(m);
r = sd_bus_add_object_vtable(m->bus, "/org/freedesktop/machine1", "org.freedesktop.machine1.Manager", manager_vtable, m);
r = sd_bus_add_fallback_vtable(m->bus, "/org/freedesktop/machine1/machine", "org.freedesktop.machine1.Machine", machine_vtable, machine_object_find, m);
r = sd_bus_add_node_enumerator(m->bus, "/org/freedesktop/machine1/machine", machine_node_enumerator, m);
"sender='org.freedesktop.systemd1',"
"interface='org.freedesktop.systemd1.Manager',"
"path='/org/freedesktop/systemd1'",
"sender='org.freedesktop.systemd1',"
"interface='org.freedesktop.systemd1.Manager',"
"path='/org/freedesktop/systemd1'",
"sender='org.freedesktop.systemd1',"
"sender='org.freedesktop.systemd1',"
"interface='org.freedesktop.systemd1.Manager',"
"path='/org/freedesktop/systemd1'",
r = sd_bus_call_method(
m->bus,
"org.freedesktop.systemd1",
"/org/freedesktop/systemd1",
"org.freedesktop.systemd1.Manager",
&error,
assert(m);
Iterator i;
assert(m);
r = manager_connect_bus(m);
manager_gc(m, false);
manager_gc(m, true);
assert(m);
return bus_event_loop_with_idle(
m->event,
m->bus,
check_idle, m);
log_open();
r = -EINVAL;
goto finish;
m = manager_new();
r = log_oom();
goto finish;
r = manager_startup(m);
goto finish;
sd_notify(false,
r = manager_run(m);
sd_notify(false,
manager_free(m);