From: Ian Campbell Subject: Re: [PATCH V4] Switch from select() to poll() in xenconsoled's IO loop Date: Mon, 7 Jan 2013 14:39:47 +0000 Message-ID: <1357569587.7989.102.camel@zakaz.uk.xensource.com> References: <1357233257-13918-1-git-send-email-wei.liu2@citrix.com> <1357568895.11865.1.camel@iceland> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: <1357568895.11865.1.camel@iceland> 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: Ian Jackson , "xen-devel@lists.xen.org" List-Id: xen-devel@lists.xenproject.org On Mon, 2013-01-07 at 14:28 +0000, Wei Liu wrote > @@ -69,6 +69,7 @@ static int log_hv_fd = -1; > static evtchn_port_or_error_t log_hv_evtchn = -1; > static xc_interface *xch; /* why does xenconsoled have two xc handles ? */ > static xc_evtchn *xce_handle = NULL; > +static struct pollfd *xce_pollfd = NULL; > > struct buffer { > char *data; [...] > @@ -32,6 +33,7 @@ void daemonize(const char *pidfile); > bool xen_setup(void); > > extern struct xs_handle *xs; > +extern struct pollfd *xs_pollfd; > extern xc_interface *xc; xs_pollfd and the xce_pollfd can both be local to the handle_io function, I think. > > - if (d->master_fd != -1 && FD_ISSET(d->master_fd, > - &readfds)) > + if (d->master_fd != -1 && > + d->master_pollfd && > + d->master_pollfd->revents & POLLIN) > handle_tty_read(d); > > - if (d->master_fd != -1 && FD_ISSET(d->master_fd, > - &writefds)) > + if (d->master_fd != -1 && > + d->master_pollfd && > + d->master_pollfd->revents & POLLOUT) > handle_tty_write(d); > > if (d->last_seen != enum_pass) This is probably one for Ian J but I wonder if you need to handle POLLERR or POLLHUP here. ISTR some of oddness WRT these when Ian implemented the libxl event subsystem. Ian.