bug-sysutils
[Top][All Lists]
Advanced

[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: Thu, 27 Jan 2005 05:31:44 +0100

   >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?

On reboot (done by shutdown/bootup scripts) you either have no
/var/log/dmesg.log or a empty one, so that is how you differemtoate.

   >       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??

You can read it if you can read it, nothing to do with being root or
not.  I could plausible setup /dev/klog in such a way, that anyone is
able to read it.

   Honestly it has been so long since I touched this code that I don't
   remember why I did this?

So figure it out :-)

   >       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??

You remove the file _PATH_DMLOG each time dmesgd exits.  So if dmesgd
exits, /var/log/dmesgd.log gets removed (obviously).  And since it
gets removed, you loose its content to read/backup/whatever.  So
instead of doing it on each exit, you could unlink the file on each
start.

Cheers!




reply via email to

[Prev in Thread] Current Thread [Next in Thread]