Re: query related to /proc and read_write.c file

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

 



"bunty " <bunty123_4@rediffmail.com> writes:

> hello,

>   1) how kernel write to /proc entry? while studying kernel source i
> found that there is no open/read/write/close file functions.  what i
> found is that sprintf function that writes to /proc entry. can
> anyone please explain it?

Hi.  Have you seen the Linux Kernel Procfs Guide or the example
procfs C code in the Documentation directory of the Linux kernel? 

There was some good online info that I used ... some online journal
in the .net domain.  I even subscribed, but I can't remember the name
of the site.

One conceptual thing: with regard to /proc, the kernel performs
services on behalf of userspace.  Inside the kernel, you register
your code as a handler for something the user can request by doing
I/O on a virtual file inside /proc.  

>    2)what is the use of read_write.c file in fs directory of kernel source?
> the file contains sys_read, sys_write. why there is no function that
> will read a user space file and write to it.  i found few questions
> asked on linux-kernel as well as kernelnewbies but there is no one
> able to answer it?

It seems like most of the time when people are looking for user-level
stuff inside the kernel it is based on some misunderstandings about
what the role of the kernel is.  That's why in the archives you'll
find people saying, "That's a bad idea, but here's how you can do it
if you really must."

-- 
--Ed L Cashin            |   PGP public key:
  ecashin@uga.edu        |   http://noserose.net/e/pgp/


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