From: Yu Watanabe Date: Mon, 14 Apr 2025 19:34:40 +0000 (+0900) Subject: journal/kmsg: drop support old kernels (<3.5) without reading /dev/kmsg support X-Git-Tag: v258-rc1~816^2~3 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=da741d9fd9fe5897209b9f569a42acd00865ed68;p=thirdparty%2Fsystemd.git journal/kmsg: drop support old kernels (<3.5) without reading /dev/kmsg support /dev/kmsg is readable since kernel v3.5: https://github.com/torvalds/linux/commit/e11fea92e13fb91c50bacca799a6131c81929986 Now our baseline on the kernel is v5.4. Let's assume /dev/kmsg is always readable. --- diff --git a/src/journal/journald-kmsg.c b/src/journal/journald-kmsg.c index 86115ad70da..2f41c549255 100644 --- a/src/journal/journald-kmsg.c +++ b/src/journal/journald-kmsg.c @@ -325,14 +325,6 @@ static int server_read_dev_kmsg(Server *s) { if (l == 0) return 0; if (l < 0) { - /* Old kernels which don't allow reading from /dev/kmsg return EINVAL when we try. So handle - * this cleanly, but don't try to ever read from it again. */ - if (errno == EINVAL) { - s->dev_kmsg_event_source = sd_event_source_unref(s->dev_kmsg_event_source); - s->dev_kmsg_readable = false; - return 0; - } - if (ERRNO_IS_TRANSIENT(errno) || errno == EPIPE) return 0; @@ -403,11 +395,6 @@ int server_open_dev_kmsg(Server *s) { return 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) { /* This will fail with EPERM on older kernels where /dev/kmsg is not readable. */ - log_debug_errno(r, "Not reading from /dev/kmsg since that's not supported, apparently."); - r = 0; - goto finish; - } if (r < 0) { log_error_errno(r, "Failed to add /dev/kmsg fd to event loop: %m"); goto finish;