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.
This commit is contained in:
Yu Watanabe
2025-04-15 05:22:28 +09:00
parent d127423ce6
commit da741d9fd9
-13
View File
@@ -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;