Re: read/write a file in kernel

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

 



> > 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. 
> 
> Such as? please give specific examples. 

one example will be the fist project for stackable file systems.
in this model, file operations on the upper file system are propagated to 
the lower one.
another is khttpd (although X15 yields similar statistics).

anyway, when im coming to think about it, there is actually one place in 
the stock kernel where i remember reading files takes place: the binformat 
handlers. furthermore, the elf handler (and probably the a.out, but i 
haven't looked at the code...) must read the program header table from the 
file. so, there ARE places where it is allowed, and actually is strictly 
necessary (and there is even an interface for it: kernel_read).

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