lkml.org 
[lkml]   [2005]   [Apr]   [28]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: dumb question: How to create your own log files in a kernel module?
Hi Xin,

>I know printk can do this job. But what I really want is to print logs
>to a file specified by me instead of /var/log/messages. And, the
>messages irrelevant to my module should not be written into that file.
> Now my log mixed with other logs in /var/log/message, which bother me
>much. :(
>
You seem to make a confusion here...

Don't forget that files are only an abstraction for userspace. They are
only meant to be read and written from userspace. Kernel code can never
read or write files. In the case of /var/log/messages, this file is
created by the syslogd program from the kernel buffer, not by the kernel
itself.

You could just echo something specific to your driver in your printk
strings, and grep this specific thing in /var/log/messages. You have
your file!

Cheers,

Michael.

--
Michael Opdenacker
http://free-electrons.com
+33 621 604 642

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/

\
 
 \ /
  Last update: 2005-04-29 00:05    [from the cache]
©2003-2011 Jasper Spaans. Advertise on this site