[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: How to read file in kernel module?



>> See i think we are talking about kernel programming . What i mean to
>> say is
>> that there is only two ways to  communiacte to user space . One through
>> a
>> registerd read or write functions

Well, for what it's worth - I have tried to write to a file from the
kernel this way, and succeeded:

--- <snip> ---

fd = sys_open(filename, O_SYNC|O_APPEND, 0);
sys_write(fd, msg, msglen);
sys_close(fd);

--- <snip> ---

From all the discussions about writing to / reading from files
directly from the kernel, I'm sure this is a dirty thing to do. Could
someone please shed some light on *why* it is bad to write to files
directly from the kernel?

Thanks,
K.

-- 
There are things known and things unknown, in between lie the Doors

--
Kernelnewbies: Help each other learn about the Linux kernel.
Archive:       http://mail.nl.linux.org/kernelnewbies/
FAQ:           http://kernelnewbies.org/faq/