1 /*-*- Mode: C; c-basic-offset: 8; indent-tabs-mode: nil -*-*/
4 This file is part of systemd.
6 Copyright 2014 Sebastian Thorarensen
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/>.
22 #include "utmp-wtmp.h"
23 #include "journald-server.h"
24 #include "journald-wall.h"
26 void server_forward_wall(
29 const char *identifier,
31 const struct ucred *ucred) {
33 _cleanup_free_ char *ident_buf = NULL, *l_buf = NULL;
40 if (LOG_PRI(priority) > s->max_level_wall)
45 get_process_comm(ucred->pid, &ident_buf);
46 identifier = ident_buf;
49 if (asprintf(&l_buf, "%s["PID_FMT"]: %s", strempty(identifier), ucred->pid, message) < 0) {
56 } else if (identifier) {
58 l = l_buf = strjoin(identifier, ": ", message, NULL);
66 r = utmp_wall(l, "systemd-journald", NULL);
68 log_debug("Failed to send wall message: %s", strerror(-r));