[ Date Index ][
Thread Index ]
[ <= Previous by date /
[ Next by date /
thread => ]
Re: [LUG] Kernel drivers - printk()
John Daragon wrote:
On Wednesday 11 August 2004 14:48, Andrew Rogers wrote:
I have a kernel module that must output a lot of info, a few megabytes.
Can you not buffer this data and make it available in /proc/ ?
As I can't write to a file from a kernel module I write the output to
/var/log/messages using printk().
Write it to relayfs - http://www.opersys.com/relayfs/ - or to the files
directly but then you will have to handle everything yourself. The rule
generally seems to be that this is a bad idea so nobody provides good
examples of doing it.
The problem is that after I have called printk() a few thousand
times it stops printting to /var/log/messages and restarts
printting some time later. It is verylikely that I am
calling printk too often in a short time interval.
Indeed. printk() is not designed for this kind of application although
the stopping effect observed is also affected by buffering in klogd.
How can I ensure that printk() has output to /var/log/messages before
calling printk() again?
I don't think you can.
You cannot do that.
I've just had a look at printk(). You'll be disappointed at the size of the
log buffer(s) :
printk() was not designed for this application though.
#define LOG_BUF_LEN (16384) /* This must be a power of two */
So - you can either :
1) write a new version of printk with sensible buffer handling :-),
It has sensible handling. printk() must never block and must be callable
in every possible context - try improving upon it.
(this is usually where someone comes along and offers a brilliantly simple
solution that I haven't thought of ...)
The Mailing List for the Devon & Cornwall LUG
Mail majordomo@xxxxxxxxxxxx with "unsubscribe list" in the
message body to unsubscribe.