chiark / gitweb /
journald: properly update message size after stripping the identifier
[elogind.git] / src / journal / journald-kmsg.c
index cc0080da19e5663dbf0be9a0b81c1ae4a52f9e1f..548f65311ce0e502f149adb86824f94613df5114 100644 (file)
 #include <sys/epoll.h>
 #include <fcntl.h>
 #include <sys/mman.h>
+#include <sys/socket.h>
 
 #include <systemd/sd-messages.h>
 #include <libudev.h>
 
 #include "journald.h"
 #include "journald-kmsg.h"
+#include "journald-syslog.h"
 
 void server_forward_kmsg(
         Server *s,
@@ -273,7 +275,7 @@ static void dev_kmsg_record(Server *s, char *p, size_t l) {
         if ((priority & LOG_FACMASK) == LOG_KERN)
                 IOVEC_SET_STRING(iovec[n++], "SYSLOG_IDENTIFIER=kernel");
         else {
-                syslog_read_identifier((const char**) &p, &identifier, &pid);
+                pl -= syslog_parse_identifier((const char**) &p, &identifier, &pid);
 
                 /* Avoid any messages we generated ourselves via
                  * log_info() and friends. */
@@ -357,7 +359,7 @@ int server_flush_dev_kmsg(Server *s) {
         if (!s->dev_kmsg_readable)
                 return 0;
 
-        log_info("Flushing /dev/kmsg...");
+        log_debug("Flushing /dev/kmsg...");
 
         for (;;) {
                 r = server_read_dev_kmsg(s);
@@ -409,7 +411,7 @@ int server_open_kernel_seqnum(Server *s) {
 
         /* We store the seqnum we last read in an mmaped file. That
          * way we can just use it like a variable, but it is
-         * persistant and automatically flushed at reboot. */
+         * persistent and automatically flushed at reboot. */
 
         fd = open("/run/systemd/journal/kernel-seqnum", O_RDWR|O_CREAT|O_CLOEXEC|O_NOCTTY|O_NOFOLLOW, 0644);
         if (fd < 0) {