Re: proc question

Karim Yaghmour (karym@info.polymtl.ca)
Tue, 05 Oct 1999 12:39:48 -0400


Actually, /proc doesn't contain files per-se. That is, they seem to be
files but they aren't. The fact that you can read them like you read
files is simply because the kernel makes it look like they are files.

This doesn't mean that you can't write to /proc. Some entries in there,
I call them entries because they aren't files, can be written to. For
instance, you can type
echo "7" > /proc/parport/0/irq
indicating that the parallel port uses irq 7. This said, most entries can
only be read.

If you would like to use /proc to communicate with a driver, which is
my understanding of your question, then you might want to use the
corresponding entry in /dev. For instance, if you want to dirrectly
communicate with the hard disk's driver, you can use the normal open/read/
write/close on /dev/hdX (I STRONGLY discourage you from doing this with
your hard drive, though). Therefore, try using read/write on the /dev
entry corresponding to your device. This should do it.

Regards.

Henrik Stolpe wrote:
>
> Is there a way to automatically erase the contents of a /PROC entry when it
> has been read?
> As far as I understand the /proc files are written to by the kernel when
> they are read, but if I want to write an alternating value into the /proc
> entry
> when it has been read, is this possible?.
> Is there a way to get the driver to know when the entry has been read other
> than the automatic execution of the read function?
>
> Thankfull for any thoughts! :)
>
> Henrik
>
> -
> To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
> the body of a message to majordomo@vger.rutgers.edu
> Please read the FAQ at http://www.tux.org/lkml/

-- 
==============================================
              Karim Yaghmour
          karym@info.polymtl.ca
            Computer Engineer
      Ecole Polytechnique de Montreal
==============================================

- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.rutgers.edu Please read the FAQ at http://www.tux.org/lkml/