On Tue, Apr 21, 2009 at 02:00:13PM +0530, Bharata B Rao wrote:
> On Tue, Apr 21, 2009 at 01:22:37PM +0530, Dhaval Giani wrote:
> > On Tue, Apr 21, 2009 at 01:08:41PM +0530, Bharata B Rao wrote:
> > > On Mon, Apr 20, 2009 at 07:27:36PM +0530, Dhaval Giani wrote:
> > > > +
> > > > +int cgroup_get_task_next(void **handle, pid_t *pid)
> > > > +{
> > > > + FILE *tasks;
> > > > + int ret;
> > > > +
> > > > + if (!cgroup_initialized)
> > > > + return ECGROUPNOTINITIALIZED;
> > > > +
> > > > + if (!handle)
> > > > + return ECGINVAL;
> > > > +
> > > > + tasks = (FILE *) *handle;
> > > > +
> > > > + if (feof(tasks))
> > > > + return ECGEOF;
> > > > +
> > >
> > > Is it necessary to use feof() here ? Isn't fscanf() capable of handling
> > > eof condition ?
> > >
> >
> > But how do you know that is is the end of file? I could not find the
> > appropriate error code for that. We need to know that we have reached
> > EOF.
>
> fscanf() returns EOF on reaching the end of input, you can check for that.
it returns -1. Which might be the same as EOF :). I will need to check
again.
--
regards,
Dhaval
------------------------------------------------------------------------------
Stay on top of everything new and different, both inside and
around Java (TM) technology - register by April 22, and save
$200 on the JavaOne (SM) conference, June 2-5, 2009, San Francisco.
300 plus technical and hands-on sessions. Register today.
Use priority code J9JMT32. http://p.sf.net/sfu/p
_______________________________________________
Libcg-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/libcg-devel