[ale] Programming /proc
Bao C. Ha
baoha at sensoria.com
Thu Nov 15 13:26:09 EST 2001
Just returns an empty string in *buffer and set len to zero.
It will tell the reader, which is most likely a blocked read,
that there is nothing left.
Bao
> -----Original Message-----
> From: Benjamin Dixon [mailto:beatle at arches.uga.edu]
> Sent: Thursday, November 15, 2001 10:11 AM
> To: Bao C. Ha
> Cc: ale at ale.org
> Subject: RE: [ale] Programming /proc
>
>
>
> Yeah I finally found it last night with a little grep action.
> Thanks for
> the reply though. Anyway, I've got my module printing out the data I
> wanted but I don't know how to specify EOF under the new system! So it
> prints the data forever. In the old system you could set the
> eof pointer
> passed in to the function to 1 and it would work (if I
> remember right) but
> I don't see how to do that in this scenario since there is no
> eof pointer
> being passed in.
>
> Ben
>
> On Thu, 15 Nov 2001, Bao C. Ha wrote:
>
> >
> > Since /proc is a pseudo-filesystem, I look for it in
> > <linux/fs.h>.
> >
> > struct file {
> > struct list_head f_list;
> > struct dentry *f_dentry;
> > struct vfsmount *f_vfsmnt;
> > struct file_operations *f_op;
> > atomic_t f_count;
> > unsigned int f_flags;
> > mode_t f_mode;
> > loff_t f_pos;
> > unsigned long f_reada, f_ramax, f_raend,
> f_ralen, f_rawin;
> > struct fown_struct f_owner;
> > unsigned int f_uid, f_gid;
> > int f_error;
> >
> > unsigned long f_version;
> >
> > /* needed for tty driver, and maybe others */
> > void *private_data;
> >
> > /* preallocated helper kiobuf to speedup O_DIRECT */
> > struct kiobuf *f_iobuf;
> > long f_iobuf_lock;
> > };
> >
> > Bao
> >
> > > -----Original Message-----
> > > From: Benjamin Dixon [mailto:beatle at arches.uga.edu]
> > > Sent: Wednesday, November 14, 2001 10:58 PM
> > > To: ale at ale.org
> > > Subject: [ale] Programming /proc
> > >
> > >
> > >
> > > Hi all,
> > >
> > > I'm trying to write a kernel module that has proc support
> but I don't
> > > fully understand the new calling procedures under 2.4. I have
> > > successfully
> > > set up my module code (easy enough) and now I want to let the
> > > user access
> > > some information using my output function which I register
> > > for "read" in a
> > > file_operations structure. So my function prototype looks
> like this:
> > >
> > > static ssize_t output(struct file *file, char *buffer, size_t len,
> > > loff_t *offset);
> > >
> > > My only problem is, I'm not entirely sure how to handle the
> > > *file. Does
> > > anyone know where that structure is defined? I've
> searched through the
> > > kernel, specifically includes, but can't find it. And more
> > > generally, does
> > > anyone know of a good resource for *2.4 kernel* /proc
> > > programming, its a
> > > bit different from 2.2 and previous kernels and I can't find
> > > any updated
> > > information. (BTW, I did find a procfs_example.c file in the
> > > Documentation
> > > directory but it doesn't tell me what I want to know, which
> > > is what those
> > > structures look like).
> > >
> > > Ben
> > >
> > >
> > > ---
> > > This message has been sent through the ALE general
> discussion list.
> > > See http://www.ale.org/mailing-lists.shtml for more info.
> > > Problems should be
> > > sent to listmaster at ale dot org.
> > >
> >
>
> Today's Random Quote--------------------------------------
>
> Most people don't need a great deal of love nearly so much as
> they need a steady supply.
>
> -----------------------------------------------------------
>
---
This message has been sent through the ALE general discussion list.
See http://www.ale.org/mailing-lists.shtml for more info. Problems should be
sent to listmaster at ale dot org.
More information about the Ale
mailing list