Verify the kernel log fifo is a proper character device

Issue #48 describes a problem with 100% CPU load in a container
use-case.  Turns out one of the issues was that /dev/kmsg was
not a proper character device.  This patch adds a very basic
check to ensure /dev/kmsg is usable.

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
This commit is contained in:
Joachim Wiberg 2022-02-13 23:03:30 +01:00
parent e61e5abb88
commit 49b99584a4

View File

@ -584,14 +584,11 @@ static void kernel_cb(int fd, void *arg)
static int opensys(const char *file) static int opensys(const char *file)
{ {
// struct stat st; struct stat st;
int fd; int fd;
// sleep(300); if (stat(file, &st) || !S_ISCHR(st.st_mode))
// return 1; return 1;
// if (stat(file, &st) || !S_ISCHR(st.st_mode))
// return 1;
fd = open(file, O_RDONLY | O_NONBLOCK | O_CLOEXEC, 0); fd = open(file, O_RDONLY | O_NONBLOCK | O_CLOEXEC, 0);
if (fd < 0) if (fd < 0)