[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: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. > > + /* don't care about the return value, but we do need errno */ > > + select(max_fd+1, &rfds, &wfds, &efds, timeo); > > Mmm. I don't think we don't care about the return value: if select > returns -1 with EINTR, poll has to do the same. That's however probably > the only case we have to take care of. > if you get an error you can't consider valid the sets, from Linux man page (select(2)): "On error, -1 is returned, and errno is set appropriately; the sets and timeout become undefined, so do not rely on their contents after an error." > Samuel Frediano _______________________________________________ Xen-devel mailing list Xen-devel@xxxxxxxxxxxxx http://lists.xen.org/xen-devel
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |