Re: How to read file in kernel module?

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

 



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


[Index of Archives]     [Newbies FAQ]     [Linux Kernel Mentors]     [Linux Kernel Development]     [IETF Annouce]     [Git]     [Networking]     [Security]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux SCSI]     [Linux ACPI]
  Powered by Linux