Fix #29: prevent repeating kernel messages when syslogd is restarted

This patch fixes the problem with kernel messages being repeated when
syslogd is restarted at runtime.  This is achieved by caching the last
seqno read from /dev/kmsg to /run/syslogd.cache.  The latter is usually
a ram disk these days so it should be a fairly quick op.

Excessive updates are prevented by only caching after handling all
callbacks in the socket_poll() loop, and only updating the cache
if there has been any new kernel messages since last update.

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
This commit is contained in:
Joachim Wiberg
2021-05-05 05:06:41 +02:00
parent a38daf0896
commit 92a4fb3318
3 changed files with 63 additions and 0 deletions

View File

@@ -14,6 +14,7 @@ Bug fix release.
the bundled logger, the `syslog()` API in the C library is used, which
may not necessarily set the timestamp. When sysklogd infers timestamp
it was offset by the number of years since 1969, i.e., `boot_time`
- Issue #29: kernel messages repeated if syslogd is restarted at runtime
- Issue #31: time calculation issue on 32-bit systems
- Issue #32: remote kernel messages being mapped to uucp instead of user