Re: read/write a file in kernel

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

 



> It is always a bad idea to read/write to a file in kernel mode ;)
> Please search on knewbies or google for further information on it.

over the years, there have been A LOT of objection to this notion.
i agree that setting a kernel thread to read/write a file (or smth 
similar) is flawed, but there are other cases where i think it should 
be considered safe.
for example, lets say a user process performs an ioctl on a device, and in 
the code path of the ioctl we can write smth to a file . 
although this kind of behavior breaks the syscall notion of communicating 
with the file system, there can be some advantages to it.

as a general rule of thumb, i always program in user space if i can avoid 
adding code to the kernel. however, sometimes adding kernel code which 
does some _crazy_ stuff (like writing to files) is actually the only sane 
way. 

comments??
-- 
========================================================================
nir.

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