]>
git.ipfire.org Git - thirdparty/systemd.git/blob - src/journal/journald-wall.c
1 /* SPDX-License-Identifier: LGPL-2.1+ */
3 Copyright © 2014 Sebastian Thorarensen
6 #include "alloc-util.h"
7 #include "format-util.h"
8 #include "journald-server.h"
9 #include "journald-wall.h"
10 #include "process-util.h"
11 #include "string-util.h"
12 #include "utmp-wtmp.h"
14 void server_forward_wall(
17 const char *identifier
,
19 const struct ucred
*ucred
) {
21 _cleanup_free_
char *ident_buf
= NULL
, *l_buf
= NULL
;
28 if (LOG_PRI(priority
) > s
->max_level_wall
)
33 get_process_comm(ucred
->pid
, &ident_buf
);
34 identifier
= ident_buf
;
37 if (asprintf(&l_buf
, "%s["PID_FMT
"]: %s", strempty(identifier
), ucred
->pid
, message
) < 0) {
44 } else if (identifier
) {
46 l
= l_buf
= strjoin(identifier
, ": ", message
);
54 r
= utmp_wall(l
, "systemd-journald", NULL
, NULL
, NULL
);
56 log_debug_errno(r
, "Failed to send wall message: %m");