]> git.ipfire.org Git - thirdparty/systemd.git/blob - src/network/networkd.c
networkd: make all calls async
[thirdparty/systemd.git] / src / network / networkd.c
1 /*-*- Mode: C; c-basic-offset: 8; indent-tabs-mode: nil -*-*/
2
3 /***
4 This file is part of systemd.
5
6 Copyright 2013 Tom Gundersen <teg@jklm.no>
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 "sd-event.h"
23
24 #include "networkd.h"
25
26 int main(int argc, char *argv[]) {
27 _cleanup_manager_free_ Manager *m;
28 int r;
29
30 log_set_target(LOG_TARGET_AUTO);
31 log_parse_environment();
32 log_open();
33
34 umask(0022);
35
36 if (argc != 1) {
37 log_error("This program takes no arguments.");
38 return EXIT_FAILURE;
39 }
40
41 r = manager_new(&m);
42 if (r < 0)
43 return EXIT_FAILURE;
44
45 r = manager_udev_listen(m);
46 if (r < 0)
47 return EXIT_FAILURE;
48
49 r = manager_udev_enumerate_links(m);
50 if (r < 0)
51 return EXIT_FAILURE;
52
53 r = manager_rtnl_listen(m);
54 if (r < 0)
55 return EXIT_FAILURE;
56
57 r = sd_event_loop(m->event);
58 if (r < 0)
59 return EXIT_FAILURE;
60
61 return EXIT_SUCCESS;
62 }