Proc files are dynamic files, their data
is not stored on HDD, there contents are generated by kernel when they are open
or read, actually they are the medium for processes to communicate with kernel
(to read the kernel specific data or set the kernel specific parameters) ……..
you should not use them as normal files.
Can you tell me what exactly you want to
do, if you want normal file behavior, what’s the problem in using a
normal file which is maintained by file system.
Regards,
Gaurav
From:
kernelnewbies-bounce@xxxxxxxxxxxx [mailto:kernelnewbies-bounce@xxxxxxxxxxxx] On Behalf Of linux lover
Sent: Tuesday, September 14, 2004
12:23 PM
To: Shakthi Kannan
Cc: kernelnewbies
Subject: Re: Re: Device driver
query
Hello Shakthi,
But does it
allow me to add or delete contents in file like as usual normal file(I KNOW U
SAID PROC FILE). What i want to update contents of file periodically from user
programs? Does /proc allows to do that thing to me???
On Mon, 13 Sep 2004 Shakthi Kannan wrote :
>Hi!
>
> > > You said that you want to create a file at loading
> > > time and want to
> > > remove that file forom file system at unloading
> > > time
>
>Why not use the /proc filesystem for this? It is quite simple.
>
>Example:
>
>int scull_read_procmem (char *buf, char **start, off_t offset, int
>count, int *eof, void *data) {
> int len = 0;
> len += sprintf (buf+len, "\nFrom scull_read_procmem");
> return len;
>}
>
>static void scull_create_proc() {
> create_proc_read_entry ("scullmem",
> 0,
> NULL,
> scull_read_procmem,
> NULL);
>}
>
>Regards,
>
>Shaks
>
>--
>Kernelnewbies: Help each other learn about the Linux kernel.
>Archive: http://mail.nl.linux.org/kernelnewbies/
>FAQ: http://kernelnewbies.org/faq/
>
__________________________________________________
Do You Yahoo!?
Tired of spam? Yahoo! Mail has the best spam protection around
http://mail.yahoo.com