]> git.proxmox.com Git - systemd.git/blame - src/console/consoled.c
Imported Upstream version 221
[systemd.git] / src / console / consoled.c
CommitLineData
5eef597e
MP
1/*-*- Mode: C; c-basic-offset: 8; indent-tabs-mode: nil -*-*/
2
3/***
4 This file is part of systemd.
5
6 Copyright 2014 David Herrmann <dh.herrmann@gmail.com>
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 <errno.h>
23#include <stdlib.h>
5eef597e 24#include "sd-daemon.h"
86f210e9
MP
25#include "log.h"
26#include "signal-util.h"
27#include "consoled.h"
5eef597e
MP
28
29int main(int argc, char *argv[]) {
30 _cleanup_(manager_freep) Manager *m = NULL;
31 int r;
32
33 log_set_target(LOG_TARGET_AUTO);
34 log_parse_environment();
35 log_open();
36
37 umask(0022);
38
39 if (argc != 1) {
40 log_error("This program takes no arguments.");
41 r = -EINVAL;
42 goto out;
43 }
44
45 r = manager_new(&m);
46 if (r < 0) {
f47781d8 47 log_error_errno(r, "Could not create manager: %m");
5eef597e
MP
48 goto out;
49 }
50
51 sd_notify(false,
52 "READY=1\n"
53 "STATUS=Processing requests...");
54
55 r = manager_run(m);
56 if (r < 0) {
f47781d8 57 log_error_errno(r, "Cannot run manager: %m");
5eef597e
MP
58 goto out;
59 }
60
61out:
62 sd_notify(false,
63 "STATUS=Shutting down...");
64
65 return r < 0 ? EXIT_FAILURE : EXIT_SUCCESS;
66}