1 /*-*- Mode: C; c-basic-offset: 8; indent-tabs-mode: nil -*-*/
4 This file is part of systemd.
6 Copyright 2014 Tom Gundersen <teg@jklm.no>
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.
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.
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/>.
23 #include "sd-daemon.h"
29 int main(int argc, char *argv[]) {
30 _cleanup_manager_free_ Manager *m = NULL;
33 log_set_target(LOG_TARGET_AUTO);
34 log_parse_environment();
40 log_error("This program takes no arguments.");
45 /* Always create the directory where resolv.conf will live */
46 r = mkdir_label("/run/systemd/network", 0755);
48 log_error("Could not create runtime directory: %s",
53 log_error("Could not create manager: %s", strerror(-r));
57 r = manager_network_monitor_listen(m);
59 log_error("Could not listen for network events: %s", strerror(-r));
63 /* write out default resolv.conf to avoid a
65 r = manager_update_resolv_conf(m);
67 log_error("Could not create resolv.conf: %s", strerror(-r));
73 "STATUS=Processing requests...");
75 r = sd_event_loop(m->event);
77 log_error("Event loop failed: %s", strerror(-r));
83 "STATUS=Shutting down...");
85 return r < 0 ? EXIT_FAILURE : EXIT_SUCCESS;