Results 1 to 6 of 6
Hello, Can a kernel module write to a file? If so how can you do this... Thanks Gerard4143...
Enjoy an ad free experience by logging in. Not a member yet? Register.
- 12-24-2007 #1
Writing to a file from a kernel module???
Can a kernel module write to a file? If so how can you do this...
- 12-24-2007 #2
I don't think that's possible. AFAIK the kernel doesn't use the C library, so there are no I/O functions available except for the built-in printk to print kernel messages for klogd."I'm just a little old lady; don't try to dazzle me with jargon!"
- 12-24-2007 #3
AFAIK...not sure what this means...Gerard4143
- 12-24-2007 #4
Printk also prints to a file /var/log/messages. So the kernel does write to a file in some capacity....Gerard4143
- 12-25-2007 #5
Sorry for jargon, Gerard. AFAIK means "as far as I know".
Actually the kernel does not write to /var/log/messages. That is done by a separate program called klogd which runs in the background of your system (you will sometimes find programs of this sort referred to as daemons).
klogd and its twin brother syslogd are responsible for routing all system messages: klogd handles messages from the kernel and syslogd messages from other programs. The file /etc/syslog.conf specifies where these messages will go; on most Linux systems they go to /var/log/messages but some may be copied elsewhere. Read the man page on syslog.conf for further details."I'm just a little old lady; don't try to dazzle me with jargon!"
- 01-03-2008 #6
At least, kernel modules, i.e. drivers, write to the /proc file system. klogd is a kernel module, too, or isn't it?
There is also a file /etc/mtab or the like where many kernels writes on at start-up what makes it difficult to run those kernels from read-only file systems.
There are maybe more examples but those have come to my mind.Bus Error: Passengers dumped. Hech gap yo'q.