journald-kmsg.c revision 36dd072cdf03dcac0fcd2d6b42f261444dc7ac88
84e51726a38e133ca42d2f30f0668d3921b210cbLennart Poettering/*-*- Mode: C; c-basic-offset: 8; indent-tabs-mode: nil -*-*/
84e51726a38e133ca42d2f30f0668d3921b210cbLennart Poettering This file is part of systemd.
84e51726a38e133ca42d2f30f0668d3921b210cbLennart Poettering Copyright 2011 Lennart Poettering
84e51726a38e133ca42d2f30f0668d3921b210cbLennart Poettering systemd is free software; you can redistribute it and/or modify it
84e51726a38e133ca42d2f30f0668d3921b210cbLennart Poettering under the terms of the GNU Lesser General Public License as published by
84e51726a38e133ca42d2f30f0668d3921b210cbLennart Poettering the Free Software Foundation; either version 2.1 of the License, or
84e51726a38e133ca42d2f30f0668d3921b210cbLennart Poettering (at your option) any later version.
84e51726a38e133ca42d2f30f0668d3921b210cbLennart Poettering systemd is distributed in the hope that it will be useful, but
84e51726a38e133ca42d2f30f0668d3921b210cbLennart Poettering WITHOUT ANY WARRANTY; without even the implied warranty of
84e51726a38e133ca42d2f30f0668d3921b210cbLennart Poettering MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
84e51726a38e133ca42d2f30f0668d3921b210cbLennart Poettering Lesser General Public License for more details.
84e51726a38e133ca42d2f30f0668d3921b210cbLennart Poettering You should have received a copy of the GNU Lesser General Public License
84e51726a38e133ca42d2f30f0668d3921b210cbLennart Poettering along with systemd; If not, see <http://www.gnu.org/licenses/>.
assert(s);
if (ucred) {
if (!identifier) {
if (identifier)
} else if (identifier) {
pid_t t;
return t == getpid();
char *message = NULL, *syslog_priority = NULL, *syslog_pid = NULL, *syslog_facility = NULL, *syslog_identifier = NULL, *source_time = NULL;
int priority, r;
unsigned long long usec;
assert(s);
assert(p);
if (s->kernel_seqnum) {
pl = e - p;
for (j = 0; l > 0 && j < N_IOVEC_KERNEL_FIELDS; j++) {
if (kernel_device) {
if (ud) {
if (j > N_IOVEC_UDEV_FIELDS)
goto finish;
if (identifier) {
if (syslog_identifier)
if (pid) {
if (syslog_pid)
if (message)
ssize_t l;
assert(s);
return -errno;
assert(s);
if (s->dev_kmsg_fd < 0)
if (!s->dev_kmsg_readable)
r = server_read_dev_kmsg(s);
assert(s);
return server_read_dev_kmsg(s);
assert(s);
if (s->dev_kmsg_fd < 0) {
r = sd_event_add_io(s->event, &s->dev_kmsg_event_source, s->dev_kmsg_fd, EPOLLIN, dispatch_dev_kmsg, s);
if (r == -EPERM) {
goto fail;
goto fail;
goto fail;
s->dev_kmsg_readable = true;
fail:
uint64_t *p;
assert(s);
fd = open("/run/systemd/journal/kernel-seqnum", O_RDWR|O_CREAT|O_CLOEXEC|O_NOCTTY|O_NOFOLLOW, 0644);
if (fd < 0) {
if (p == MAP_FAILED) {
s->kernel_seqnum = p;