From: Ian Campbell Subject: Re: [PATCH v2 2/5] libxl: react correctly to POLLHUP Date: Fri, 27 Jul 2012 09:53:23 +0100 Message-ID: <1343379203.6812.89.camel@zakaz.uk.xensource.com> References: <1343332476-33765-1-git-send-email-roger.pau@citrix.com> <1343332476-33765-3-git-send-email-roger.pau@citrix.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: <1343332476-33765-3-git-send-email-roger.pau@citrix.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: Roger Pau Monne Cc: Ian Jackson , "xen-devel@lists.xen.org" List-Id: xen-devel@lists.xenproject.org On Thu, 2012-07-26 at 20:54 +0100, Roger Pau Monne wrote: > When received POLLHUP on datacopier_readable/writable, kill the > datacopier and call the callback with onwrite=-2. On the bootloader > callback kill the bootloader process and wait for the callback, but > without setting the bl->rc error code. > > This is because NetBSD returns POLLHUP when the process on the other > end of the pty exits (even when exiting normally). > > Cc: Ian Jackson > Signed-off-by: Roger Pau Monne > --- > tools/libxl/libxl_aoutils.c | 16 ++++++++++++++++ > tools/libxl/libxl_bootloader.c | 9 ++++++--- > tools/libxl/libxl_internal.h | 1 + > 3 files changed, 23 insertions(+), 3 deletions(-) > > diff --git a/tools/libxl/libxl_aoutils.c b/tools/libxl/libxl_aoutils.c > index 99972a2..2ea9b2c 100644 > --- a/tools/libxl/libxl_aoutils.c > +++ b/tools/libxl/libxl_aoutils.c > @@ -102,6 +102,14 @@ static void datacopier_readable(libxl__egc *egc, libxl__ev_fd *ev, > libxl__datacopier_state *dc = CONTAINER_OF(ev, *dc, toread); > STATE_AO_GC(dc->ao); > > + if (revents & POLLHUP) { > + LOG(DEBUG, "received POLLHUP on %s during copy of %s, " > + "killing the bootloader process", The datacopier module is completely independent from the bootloader one, so mentioning bootloader in this message is inappropriate. Especially since nothing in the immediate vicinity of this code is actually killing anything. I'll leave commenting on the semantics of treating POLLHUP this way for Ian to think about.