[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Bug-sysutils] RFC dmesgd
From: |
Alfred M. Szmidt |
Subject: |
Re: [Bug-sysutils] RFC dmesgd |
Date: |
Wed, 26 Jan 2005 23:08:21 +0100 |
Here is the dmesgd that I was working on. If any of you have time
I would appreciate some comments/suggestions.
Since everyone is so quite, I'll shoot.
One of the problems I am not sure what to do with is if dmesgd is
restarted without rebooting. Obviosly klog is empty at that point
so what should I do, somehow keep the same log file?
What about storing the content of /dev/klog and then reusing that if
klog is killed? And on boot, you could clear that temporary file.
/* dmesgd.c -- daemon to capture the kernel ring buffer
*
* Copyright (C) 2004 Barry deFreese
* Copyright (C) 2004 Free Software Foundation, Inc.
Don't you have papers for sysutils? If you do, then you should just
list the FSF. You can add a line like "Written by Barry deFreese" in
the header if you want.
#define KBUFSIZE 16384
int main(void)
{
char kbuf[KBUFSIZE];
if (getuid() == 0) {
It is better if you just check if you can open/read /dev/klog instead
/* Make / the current directory */
if ((chdir("/")) < 0) {
perror("chdir");
exit(EXIT_FAILURE);
}
Why?
/* Reset the file mode */
umask (0);
Why?
unlink(_PATH_DMLOG);
Is this really wise? What if I want to read the content of _PATH_DMLOG
after dmesgd has been shutdown cleanly? If you need to have a clean
_PATH_DMLOG when starting, do it at the begining of main().