[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Bug-sysutils] RFC dmesgd
From: |
Barry deFreese |
Subject: |
Re: [Bug-sysutils] RFC dmesgd |
Date: |
Wed, 26 Jan 2005 18:16:56 -0800 |
User-agent: |
Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.7.5) Gecko/20050105 Debian/1.7.5-1 |
Alfred M. Szmidt wrote:
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.
In essence that is what I am trying to do but how do I differentiate
between a reboot and a restart of dmesgd?
/* 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.
Yes, I should fix this.
#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
Why? I know I can't read it unless root or root equivalent??
/* Make / the current directory */
if ((chdir("/")) < 0) {
perror("chdir");
exit(EXIT_FAILURE);
}
Why?
/* Reset the file mode */
umask (0);
Why?
Honestly it has been so long since I touched this code that I don't
remember why I did this?
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().
I'm not sure what you mean here??
Alfred,
Thanks, I'm glad someone is reading it.. :-)
--
Barry deFreese
Debian 3.0r1 "Woody"
GNU/Hurd
Registered Linux "Newbie" #302256 - Hurd H4XX0r wannabe
"Programming today is a race between software engineers striving
to build bigger and better idiot-proof programs, and the Universe
trying to produce bigger and better idiots. So far, the Universe is
winning." Rich Cook.