From: Ian Jackson Subject: Re: [PATCH v2 2/5] libxl: react correctly to POLLHUP Date: Tue, 31 Jul 2012 15:42:59 +0100 Message-ID: <20503.61171.926442.20203@mariner.uk.xensource.com> References: <1343332476-33765-1-git-send-email-roger.pau@citrix.com> <1343332476-33765-3-git-send-email-roger.pau@citrix.com> <20498.42252.837536.931815@mariner.uk.xensource.com> <20498.51576.487073.103153@mariner.uk.xensource.com> <1343740684.25782.10.camel@zakaz.uk.xensource.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: <1343740684.25782.10.camel@zakaz.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: Ian Campbell Cc: "xen-devel@lists.xen.org" , Roger Pau Monne List-Id: xen-devel@lists.xenproject.org Ian Campbell writes ("Re: [Xen-devel] [PATCH v2 2/5] libxl: react correctly to POLLHUP"): > On Fri, 2012-07-27 at 18:01 +0100, Ian Jackson wrote: > > +static int datacopier_pollhup_handled(libxl__egc *egc, > > + libxl__datacopier_state *dc, > > + short revents, int onwrite) > > +{ > > + STATE_AO_GC(dc->ao); > > + > > + if (dc->callback_pollhup && (revents & POLLHUP)) { > > + LOG(DEBUG, "received POLLHUP on %s during copy of %s", > > + onwrite ? dc->writewhat : dc->readwhat, > > + dc->copywhat); > > + libxl__datacopier_kill(dc); > > + dc->callback(egc, dc, onwrite, -1); > > Shouldn't this be dc->callback_poolhup? Yes. I did say I hadn't executed it :-). > > @@ -508,7 +508,10 @@ static void bootloader_gotptys(libxl__egc *egc, libxl__openpty_state *op) > > bl->keystrokes.maxsz = BOOTLOADER_BUF_OUT; > > bl->keystrokes.copywhat = > > GCSPRINTF("bootloader input for domain %"PRIu32, bl->domid); > > - bl->keystrokes.callback = bootloader_keystrokes_copyfail; > > + bl->keystrokes.callback = bootloader_keystrokes_copyfail; > > + bl->keystrokes.callback_pollhup = bootloader_keystrokes_copyfail; > > + /* pollhup gets called with errnoval==-1 which is not otherwise > > + * possible since errnos are nonnegative, so it's unambiguous */ > > So the split into two callbacks is just for convenience of some future > user, rather than something needed in this patch? Or have I missed > somewhere which sets callback but not callback_pollhup? Yes, you have. datacopier is used for the qemu state file during save/restore, and naturally wants to treat pollhup as fatal. Ian.