diff options
author | David Herrmann <dh.herrmann@gmail.com> | 2014-10-03 15:58:44 +0200 |
---|---|---|
committer | David Herrmann <dh.herrmann@gmail.com> | 2014-10-03 16:07:14 +0200 |
commit | ce7b9f50c3fadbad22feeb28e4429ad9bee02bcc (patch) | |
tree | b5f12ae9987b4f0ad0170fe9d2675f9c78d97c0b /src/console/consoled.c | |
parent | 48fed5c55b5183e6d44702dfdccd3b5325d8689c (diff) |
console: add user console daemon
This adds a first draft of systemd-consoled. This is still missing a lot
of features and does some rather primitive rendering. However, it shows
the direction this code is going and serves as basis for further testing.
The systemd-consoled binary should be run as `systemd --user' unit. It
automatically picks up any session marked as Desktop=SYSTEMD-CONSOLE.
Therefore, you can use any login-manager you want (ranging from /bin/login
to gdm) to create sessions for systemd-consoled. However, the sessions
managers must be prepared to set the Desktop= variable properly.
The user-session is called `systemd-console', only the daemon providing
the terminal environment is called `systemd-consoled' (mind the 'd').
So far, only a single terminal session is provided on each opened
user-session. However, we support multiple user-sessions (even across
multiple seats) just fine. In the future, the workspace logic will get
extended so you can have multiple terminal sessions in a single
user-session for easier access.
Note that this is still experimental! Instructions on how to run it will
follow shortly.
Diffstat (limited to 'src/console/consoled.c')
-rw-r--r-- | src/console/consoled.c | 67 |
1 files changed, 67 insertions, 0 deletions
diff --git a/src/console/consoled.c b/src/console/consoled.c new file mode 100644 index 0000000000..b0c9eda1ac --- /dev/null +++ b/src/console/consoled.c @@ -0,0 +1,67 @@ +/*-*- Mode: C; c-basic-offset: 8; indent-tabs-mode: nil -*-*/ + +/*** + This file is part of systemd. + + Copyright 2014 David Herrmann <dh.herrmann@gmail.com> + + systemd is free software; you can redistribute it and/or modify it + under the terms of the GNU Lesser General Public License as published by + the Free Software Foundation; either version 2.1 of the License, or + (at your option) any later version. + + systemd is distributed in the hope that it will be useful, but + WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public License + along with systemd; If not, see <http://www.gnu.org/licenses/>. +***/ + +#include <errno.h> +#include <stdlib.h> +#include <string.h> +#include "consoled.h" +#include "log.h" +#include "sd-daemon.h" +#include "util.h" + +int main(int argc, char *argv[]) { + _cleanup_(manager_freep) Manager *m = NULL; + int r; + + log_set_target(LOG_TARGET_AUTO); + log_parse_environment(); + log_open(); + + umask(0022); + + if (argc != 1) { + log_error("This program takes no arguments."); + r = -EINVAL; + goto out; + } + + r = manager_new(&m); + if (r < 0) { + log_error("Could not create manager: %s", strerror(-r)); + goto out; + } + + sd_notify(false, + "READY=1\n" + "STATUS=Processing requests..."); + + r = manager_run(m); + if (r < 0) { + log_error("Cannot run manager: %s", strerror(-r)); + goto out; + } + +out: + sd_notify(false, + "STATUS=Shutting down..."); + + return r < 0 ? EXIT_FAILURE : EXIT_SUCCESS; +} |