journald-console.c revision 288a74cce597f81d3ba01d8a5ca7d2ba5b654b7e
/*-*- Mode: C; c-basic-offset: 8; indent-tabs-mode: nil -*-*/
/***
This file is part of systemd.
Copyright 2011 Lennart Poettering
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 <time.h>
#include <fcntl.h>
#include "fileio.h"
#include "journald-server.h"
#include "journald-console.h"
#include "formats-util.h"
#include "process-util.h"
#include "terminal-util.h"
static bool prefix_timestamp(void) {
static int cached_printk_time = -1;
if (_unlikely_(cached_printk_time < 0)) {
_cleanup_free_ char *p = NULL;
read_one_line_file("/sys/module/printk/parameters/time", &p) >= 0
&& parse_boolean(p) > 0;
}
return cached_printk_time;
}
void server_forward_console(
Server *s,
int priority,
const char *identifier,
const char *message,
int n = 0, fd;
const char *tty;
assert(s);
return;
/* First: timestamp */
if (prefix_timestamp()) {
}
/* Second: identifier and PID */
if (ucred) {
if (!identifier) {
}
if (identifier)
} else if (identifier) {
}
/* Fourth: message */
if (fd < 0) {
return;
}
safe_close(fd);
}