From mboxrd@z Thu Jan 1 00:00:00 1970 From: Samuel Thibault Subject: Re: Implementing poll(2) for Mini-OS? Date: Tue, 19 Feb 2013 01:06:08 +0100 Message-ID: <20130219000608.GO7019@type.youpi.perso.aquilenet.fr> References: <1361202056.3825.28.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: <1361202056.3825.28.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: Daniel De Graaf , xen-devel@lists.xen.org List-Id: xen-devel@lists.xenproject.org Wei Liu, le Mon 18 Feb 2013 15:40:56 +0000, a =E9crit : > + ret =3D select(&rfds, &wfds, NULL, &_timeo); > + > + for (i =3D 0; i < nfds; i++) { > + fd =3D pfd[i].fd; Here we have to set revents to 0 before adding some bits. The caller may not have cleared revents already. > + if (FD_ISSET(fd, &rfds)) > + pfd[i].revents |=3D POLLIN; > + if (FD_ISSET(fd, &wfds)) > + pfd[i].revents |=3D POLLOUT; > + } Samuel