From: Ian Campbell Subject: Re: [PATCH 3/3] libxl: event system: properly register the SIGCHLD self-pipe Date: Wed, 6 Nov 2013 10:36:05 +0000 Message-ID: <1383734165.26213.54.camel@kazak.uk.xensource.com> References: <21113.5942.487235.634777@mariner.uk.xensource.com> <1383679153-3137-1-git-send-email-ian.jackson@eu.citrix.com> <1383679153-3137-4-git-send-email-ian.jackson@eu.citrix.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: <1383679153-3137-4-git-send-email-ian.jackson@eu.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: Ian Jackson Cc: Jim Fehlig , Bamvor Jian Zhang , xen-devel@lists.xen.org List-Id: xen-devel@lists.xenproject.org On Tue, 2013-11-05 at 19:19 +0000, Ian Jackson wrote: > An application which uses libxl_osevent_register_hooks, and doesn't > use libxl_sigchld_owner_mainloop, would never properly experience the > deaths of its (libxl) children. > > This is because the SIGCHLD self pipe would be handled using ad-hoc > code in beforepoll_internal and afterpoll_internal. However, this is > no good if application is using the fd registration system instead; in > that case these functions would not be called and nothing would deal > with readability of the self pipe. > > Fix this as follows: > > The SIGCHLD self pipe now is now dealt with by a standard libxl__ev_fd > handler, which is registered and deregistered along with the SIGCHLD > handler itself. The handler function subsumes the ad-hoc response > code removed from beforepoll_internal, and the functionality of > libxl__fork_selfpipe_woken. > > This is also tidier as the SIGCHLD self pipe is no longer touched > outside libxl_fork.c other than in ctx initialisation and teardown. > > (The ad-hoc arrangements for poller->wakeup_pipe in > beforepoll_internal and afterpoll_internal are OK because the > libxl__poller mechanism exists to wake up threads which are sitting > inside libxl's poll loop, so is not applicable to the application's > event loop.) > > Reported-by: Bamvor Jian Zhang > Signed-off-by: Ian Jackson > Cc: Bamvor Jian Zhang Acked-by: Ian Campbell