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

Re: [Xen-devel] [PATCH] mini-os: implement poll(2)



On Tue, 2013-02-19 at 17:22 +0000, Frediano Ziglio wrote:
> On Tue, 2013-02-19 at 17:39 +0100, Samuel Thibault wrote:
> > Also, checking for files[i].type should be done on entry to the
> > function, not after having waited for some time (and perhaps opened some
> > file descriptor, etc.). I.e.:
> > 
> > Wei Liu, le Tue 19 Feb 2013 15:54:13 +0000, a Ãcrit :
> > > +        /* ignore invalid fds */
> > > +        if (fd < 0 || fd >= NOFILE)
> > > +            continue;
> > 
> > record POLLNVAL as soon as here, and ignore that fd later on.
> > 
> 
> If you detect the handle is invalid you should not wait in select or set
> the timeout to 0. poll should return as soon at it receive an event. In
> this case getting POLLNVAL is an event. I don't know if you have to test
> all handles in this case or just return the number of fds that got set
> to POLLNVAL.
> 

In Linux's do_poll() implementation, the whole poll array is scanned,
even if some fds in the middle of the loop are not valid.

Wei.


_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxx
http://lists.xen.org/xen-devel

 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.