From: Samuel Thibault Subject: Re: [PATCH] mini-os: implement poll(2) Date: Tue, 19 Feb 2013 17:39:55 +0100 Message-ID: <20130219163955.GS6098@type.bordeaux.inria.fr> References: <1361281277-5637-1-git-send-email-wei.liu2@citrix.com> <7CE799CC0E4DE04B88D5FDF226E18AC201058D458396@LONPMAILBOX01.citrite.net> <1361283772.2937.3.camel@zion.uk.xensource.com> <7CE799CC0E4DE04B88D5FDF226E18AC201058D458397@LONPMAILBOX01.citrite.net> <1361287529.2937.13.camel@zion.uk.xensource.com> <1361289253.2937.17.camel@zion.uk.xensource.com> Mime-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable Return-path: Content-Disposition: inline In-Reply-To: <1361289253.2937.17.camel@zion.uk.xensource.com> List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xen.org Errors-To: xen-devel-bounces@lists.xen.org To: Wei Liu Cc: Frediano Ziglio , "xen-devel@lists.xen.org" List-Id: xen-devel@lists.xenproject.org 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 =E9crit : > + /* ignore invalid fds */ > + if (fd < 0 || fd >=3D NOFILE) > + continue; record POLLNVAL as soon as here, and ignore that fd later on. > + /* 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. Samuel