Debian Codegraph @

src/mountfsd/mountfsd.c

raw
1 /* SPDX-License-Identifier: LGPL-2.1-or-later */
2
3 #include <sys/stat.h>
4
5 #include "sd-event.h"
6
7 #include "daemon-util.h"
8 #include "log.h"
9 #include "main-func.h"
10 #include "mountfsd-manager.h"
11
12 static int run(int argc, char *argv[]) {
13 _unused_ _cleanup_(notify_on_cleanup) const char *notify_stop = NULL;
14 _cleanup_(manager_freep) Manager *m = NULL;
15 int r;
16
17 log_setup();
18
19 umask(0022);
20
21 if (argc != 1)
22 return log_error_errno(SYNTHETIC_ERRNO(EINVAL), "This program takes no arguments.");
23
24 r = manager_new(&m);
25 if (r < 0)
26 return log_error_errno(r, "Could not create manager: %m");
27
28 r = manager_startup(m);
29 if (r < 0)
30 return log_error_errno(r, "Failed to start up daemon: %m");
31
32 notify_stop = notify_start(NOTIFY_READY_MESSAGE, NOTIFY_STOPPING_MESSAGE);
33
34 r = sd_event_loop(m->event);
35 if (r < 0)
36 return log_error_errno(r, "Event loop failed: %m");
37
38 return 0;
39 }
40
41 DEFINE_MAIN_FUNCTION(run);