98ef2d7f82
In order to properly read from /dev/kmsg, we need [*]: 1) open /dev/kmsg with O_NONBLOCK 2) handle the EAGAIN/WouldBlock error as end of records 3) treat '\n' (and not '\0') as record separator. 4) do lseek(fd, 0, SEEK_DATA) Because Windows doesn't support O_NONBLOCK and SEEK_DATA, we had protect these code with #[cfg(not(target_os = "windows"))]. Moreover because Windows doesn't have /dev/kmsg, it is mandatory to use the '-K' switch. [*] https://www.kernel.org/doc/Documentation/ABI/testing/dev-kmsg