From patchwork Thu Jan 9 12:12:26 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: George Dunlap X-Patchwork-Id: 11325533 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id C0F7C109A for ; Thu, 9 Jan 2020 12:13:39 +0000 (UTC) Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 9CADA2067D for ; Thu, 9 Jan 2020 12:13:39 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (1024-bit key) header.d=citrix.com header.i=@citrix.com header.b="QtGFOUIF" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 9CADA2067D Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=citrix.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=xen-devel-bounces@lists.xenproject.org Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.89) (envelope-from ) id 1ipWfy-0003dW-39; Thu, 09 Jan 2020 12:12:34 +0000 Received: from all-amaz-eas1.inumbo.com ([34.197.232.57] helo=us1-amaz-eas2.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.89) (envelope-from ) id 1ipWfw-0003dR-S7 for xen-devel@lists.xenproject.org; Thu, 09 Jan 2020 12:12:32 +0000 X-Inumbo-ID: 4f538531-32d9-11ea-b9b0-12813bfff9fa Received: from esa5.hc3370-68.iphmx.com (unknown [216.71.155.168]) by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS id 4f538531-32d9-11ea-b9b0-12813bfff9fa; Thu, 09 Jan 2020 12:12:31 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=citrix.com; s=securemail; t=1578571951; h=from:to:cc:subject:date:message-id:mime-version: content-transfer-encoding; bh=FZer+qNX9l/NTOJcb1lDQAGDaVppJ9mNHWRxPWYX1jw=; b=QtGFOUIFBYQ/mRzpwF8uFPmQ5Wal+czEcL3juU7VYb/7N40ACxh3SU9r 3CSFTCt8Upzc46umEFVZwKNoU6w3/sQKOTSA/EMOBhnAMA6cyQjn49WdV 5H8CmlmJ+k/uoojQAkTAwwNHwgdH/VIvwgkUZKq5cKxZEeXKxFrDhMVtW M=; Authentication-Results: esa5.hc3370-68.iphmx.com; dkim=none (message not signed) header.i=none; spf=None smtp.pra=george.dunlap@citrix.com; spf=Pass smtp.mailfrom=George.Dunlap@citrix.com; spf=None smtp.helo=postmaster@mail.citrix.com Received-SPF: None (esa5.hc3370-68.iphmx.com: no sender authenticity information available from domain of george.dunlap@citrix.com) identity=pra; client-ip=162.221.158.21; receiver=esa5.hc3370-68.iphmx.com; envelope-from="George.Dunlap@citrix.com"; x-sender="george.dunlap@citrix.com"; x-conformance=sidf_compatible Received-SPF: Pass (esa5.hc3370-68.iphmx.com: domain of George.Dunlap@citrix.com designates 162.221.158.21 as permitted sender) identity=mailfrom; client-ip=162.221.158.21; receiver=esa5.hc3370-68.iphmx.com; envelope-from="George.Dunlap@citrix.com"; x-sender="George.Dunlap@citrix.com"; x-conformance=sidf_compatible; x-record-type="v=spf1"; x-record-text="v=spf1 ip4:209.167.231.154 ip4:178.63.86.133 ip4:195.66.111.40/30 ip4:85.115.9.32/28 ip4:199.102.83.4 ip4:192.28.146.160 ip4:192.28.146.107 ip4:216.52.6.88 ip4:216.52.6.188 ip4:162.221.158.21 ip4:162.221.156.83 ip4:168.245.78.127 ~all" Received-SPF: None (esa5.hc3370-68.iphmx.com: no sender authenticity information available from domain of postmaster@mail.citrix.com) identity=helo; client-ip=162.221.158.21; receiver=esa5.hc3370-68.iphmx.com; envelope-from="George.Dunlap@citrix.com"; x-sender="postmaster@mail.citrix.com"; x-conformance=sidf_compatible IronPort-SDR: e6jq1qv5tGN7MIrKfD2jIwPmuiGIWyGewYg3p9hfYUL+UNeHrLRulPenTH77JPJtup4XtEOdDc H2mpvNaquX8L8T1NVbzDOaKyGWlR0VWHGMDHFWDs4yH1nPaglHgNCHscxWeS0luh6o++ZGm4h3 t6giJvCwZS6/00xftyV7tSE19YXcWx82IlBYeWS068vO0KJFMTeK67oRcZ4DjCbtkMKcQRTb1L YaFE7WqmRvS0i0xHqkkBnFITJS0YJ2x62oMnX2FbmLkCt9+qHDaJZgZSLQwzpbyJXNgxzItbqp Evc= X-SBRS: 2.7 X-MesageID: 11049364 X-Ironport-Server: esa5.hc3370-68.iphmx.com X-Remote-IP: 162.221.158.21 X-Policy: $RELAYED X-IronPort-AV: E=Sophos;i="5.69,413,1571716800"; d="scan'208";a="11049364" From: George Dunlap To: Date: Thu, 9 Jan 2020 12:12:26 +0000 Message-ID: <20200109121227.949665-1-george.dunlap@citrix.com> X-Mailer: git-send-email 2.24.1 MIME-Version: 1.0 Subject: [Xen-devel] [PATCH v2 1/2] libxl: Get rid of some trailing whitespace X-BeenThere: xen-devel@lists.xenproject.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Cc: Anthony Perard , Ian Jackson , George Dunlap , Wei Liu Errors-To: xen-devel-bounces@lists.xenproject.org Sender: "Xen-devel" No functional changes. Signed-off-by: George Dunlap Acked-by: Ian Jackson --- CC: Ian Jackson CC: Wei Liu CC: Anthony Perard --- tools/libxl/libxl_event.h | 2 +- tools/libxl/libxl_fork.c | 4 ++-- tools/libxl/libxl_internal.h | 4 ++-- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/tools/libxl/libxl_event.h b/tools/libxl/libxl_event.h index d1517f7456..41082ef2f4 100644 --- a/tools/libxl/libxl_event.h +++ b/tools/libxl/libxl_event.h @@ -441,7 +441,7 @@ void libxl_osevent_occurred_timeout(libxl_ctx *ctx, void *for_libxl) * * A program which does this must call libxl_childproc_setmode. * There are three options: - * + * * libxl_sigchld_owner_libxl: * * While any libxl operation which might use child processes diff --git a/tools/libxl/libxl_fork.c b/tools/libxl/libxl_fork.c index 0f1b6b518c..c5b378c554 100644 --- a/tools/libxl/libxl_fork.c +++ b/tools/libxl/libxl_fork.c @@ -78,7 +78,7 @@ static void atfork_unlock(void) int libxl__atfork_init(libxl_ctx *ctx) { int r, rc; - + atfork_lock(); if (atfork_registered) { rc = 0; goto out; } @@ -326,7 +326,7 @@ static void sigchld_removehandler_core(void) /* idempotent */ { struct sigaction was; int r; - + if (!sigchld_installed) return; diff --git a/tools/libxl/libxl_internal.h b/tools/libxl/libxl_internal.h index b5adbfe4b7..bfbee9451e 100644 --- a/tools/libxl/libxl_internal.h +++ b/tools/libxl/libxl_internal.h @@ -161,7 +161,7 @@ #endif /* all of these macros preserve errno (saving and restoring) */ -/* +/* * A macro to help retain the first failure in "do as much as you can" * situations. Note the hard-coded use of the variable name `rc`. */ @@ -1367,7 +1367,7 @@ typedef struct { const char *shim_cmdline; const char *pv_cmdline; - /* + /* * dm_runas: If set, pass qemu the `-runas` parameter with this * string as an argument * dm_kill_uid: If set, the devicemodel should be killed by From patchwork Thu Jan 9 12:12:27 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: George Dunlap X-Patchwork-Id: 11325535 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 17601930 for ; Thu, 9 Jan 2020 12:13:48 +0000 (UTC) Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id D95712067D for ; Thu, 9 Jan 2020 12:13:47 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (1024-bit key) header.d=citrix.com header.i=@citrix.com header.b="Toh9Ytrm" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org D95712067D Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=citrix.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=xen-devel-bounces@lists.xenproject.org Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.89) (envelope-from ) id 1ipWg6-0003ea-Bz; Thu, 09 Jan 2020 12:12:42 +0000 Received: from us1-rack-iad1.inumbo.com ([172.99.69.81]) by lists.xenproject.org with esmtp (Exim 4.89) (envelope-from ) id 1ipWg4-0003eJ-KC for xen-devel@lists.xenproject.org; Thu, 09 Jan 2020 12:12:40 +0000 X-Inumbo-ID: 4f897ac8-32d9-11ea-a985-bc764e2007e4 Received: from esa4.hc3370-68.iphmx.com (unknown [216.71.155.144]) by us1-rack-iad1.inumbo.com (Halon) with ESMTPS id 4f897ac8-32d9-11ea-a985-bc764e2007e4; Thu, 09 Jan 2020 12:12:31 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=citrix.com; s=securemail; t=1578571951; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=O4AAb3GzvYGnqw/JYWpi6+vsrM4QHfshra58P1HItrU=; b=Toh9YtrmiLpsjoItUjT9Bv6dBm3cQsB5tFMT72YdbwN+zUeWtDp1DprQ Pvn3QwMP7/whZ1e0Ag2MGHyknEoBM1Ca4xfdZM6oWHCFfpkBtJZQ5IaCn +28AFBzTOilvt12c5WEjpAtMAZ1GO6qje3r9khT2D7pBpnR76NF1nmp84 c=; Authentication-Results: esa4.hc3370-68.iphmx.com; dkim=none (message not signed) header.i=none; spf=None smtp.pra=george.dunlap@citrix.com; spf=Pass smtp.mailfrom=George.Dunlap@citrix.com; spf=None smtp.helo=postmaster@mail.citrix.com Received-SPF: None (esa4.hc3370-68.iphmx.com: no sender authenticity information available from domain of george.dunlap@citrix.com) identity=pra; client-ip=162.221.158.21; receiver=esa4.hc3370-68.iphmx.com; envelope-from="George.Dunlap@citrix.com"; x-sender="george.dunlap@citrix.com"; x-conformance=sidf_compatible Received-SPF: Pass (esa4.hc3370-68.iphmx.com: domain of George.Dunlap@citrix.com designates 162.221.158.21 as permitted sender) identity=mailfrom; client-ip=162.221.158.21; receiver=esa4.hc3370-68.iphmx.com; envelope-from="George.Dunlap@citrix.com"; x-sender="George.Dunlap@citrix.com"; x-conformance=sidf_compatible; x-record-type="v=spf1"; x-record-text="v=spf1 ip4:209.167.231.154 ip4:178.63.86.133 ip4:195.66.111.40/30 ip4:85.115.9.32/28 ip4:199.102.83.4 ip4:192.28.146.160 ip4:192.28.146.107 ip4:216.52.6.88 ip4:216.52.6.188 ip4:162.221.158.21 ip4:162.221.156.83 ip4:168.245.78.127 ~all" Received-SPF: None (esa4.hc3370-68.iphmx.com: no sender authenticity information available from domain of postmaster@mail.citrix.com) identity=helo; client-ip=162.221.158.21; receiver=esa4.hc3370-68.iphmx.com; envelope-from="George.Dunlap@citrix.com"; x-sender="postmaster@mail.citrix.com"; x-conformance=sidf_compatible IronPort-SDR: uAr1CVLSSEj10uJ4Jj+h4ewEFxeyvA9ZS3ELM6jXtFiw9uqv6idlcbqC4RezZ7TVeeVlW6WOa7 gSTfnjB7l+aboDaBm1/5zhFfqbzwqA/NdMlZw4JaFDghqZ3YpZ9KK5HEE5jwnPVPEBPwLcFpyR k4KHrbiiJpdAirWdiP/3h8JvxrKPgvF0WhRB8aAymmd2Qsw6bTpJQ5YxGR66uUVQYv+oPe6EBC 2nkdwQNPK25lFYFpZCZkLLa7BbF5xMT0jZmN4a5FPvt9JJQnG9v8YIF0tETVoGDKuugAf5dJtO OvU= X-SBRS: 2.7 X-MesageID: 11263367 X-Ironport-Server: esa4.hc3370-68.iphmx.com X-Remote-IP: 162.221.158.21 X-Policy: $RELAYED X-IronPort-AV: E=Sophos;i="5.69,413,1571716800"; d="scan'208";a="11263367" From: George Dunlap To: Date: Thu, 9 Jan 2020 12:12:27 +0000 Message-ID: <20200109121227.949665-2-george.dunlap@citrix.com> X-Mailer: git-send-email 2.24.1 In-Reply-To: <20200109121227.949665-1-george.dunlap@citrix.com> References: <20200109121227.949665-1-george.dunlap@citrix.com> MIME-Version: 1.0 Subject: [Xen-devel] [PATCH v2 2/2] libxl: Add new "notify-only" childproc mode X-BeenThere: xen-devel@lists.xenproject.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Cc: Anthony Perard , Ian Jackson , George Dunlap , Wei Liu , Nick Rosbrook Errors-To: xen-devel-bounces@lists.xenproject.org Sender: "Xen-devel" libxl needs to be able to know when processes it forks have completed. At the moment, libxl has two basic mode (with some variations). In one mode -- libxl_sigchld_owner_libxl* -- libxl sets up its own SIGCHLD signal handler, and also handles the event loop that allows libxl to safely block until the child in question is finished (using a self-pipe for the SIGCHLD handler to notify the waiters that it's time to look for reaped children). In the other mode, libxl does not set up the SIGCHLD handler, nor does it do anything with processing the event loop; it expects the library caller to handle the event loop itself. The golang runtime manages its own processes, and thus must use SIGCHLD itself; and it has an easy way for other users to get SIGCHLD notifications. However, because its event loop is hidden away behind abstractions, it's not easy to hook into; and there's no need -- the golang runtime assumes that C function calls may block, and handles everything behind the scenes. Introduce a new mode, libxl_sigchld_owner_notify, in which libxl sets up the SIGCHLD event handling machinery, but relies on the caller to tell it when a SIGCHLD happens. Call these two actions "notify" (for the self-pipe notification machinery) and "handler" (for the actual SIGCHLD handler). Provide a new external function, libxl_childproc_sigchld_notify(), for library users to call when a SIGCHLD happens. Have this call sigchld_handler(). Rename chldmode_ours() to chldmode_notify(), and use it to determine whether to set up the notification chain. When setting up the notification chain, do everything except setting up the signal handler in "notify-only" mode. defer_sigchld() and release_sigchld() do two things: they modify the signal handler, and grab and release locks. Refactor these so that they grab and release the locks correctly in "notify-only" mode, but don't tweak the signal handler unless it's been set up. With the golang bindings ported to use this change, domain creation works. NB an alternate approach would be to make libxl_sigchld_owner_mainloop *always* set up and tear down the self-pipe notification mechanisms, and then simply expose libxl_childproc_sigchld_notify(). However, this would entail grabbing a libxl-wide global lock (across all libxl ctx's) twice on every fork. This should be avoided for callers which don't need it. Signed-off-by: George Dunlap --- v2: - Make libxl_childproc_sigchld_notify() reentrant by simply calling sigchld_handler directly. Mention this in the documentation to prompt people to think about saving and restoring errno themselves. - Move whitespace fixes to another patch - Make braces snuggly in line with libxl coding style. - Remove XXX comment. CC: Ian Jackson CC: Wei Liu CC: Anthony Perard CC: Nick Rosbrook --- tools/libxl/libxl_event.h | 31 +++++++++++++++++++++++++++++ tools/libxl/libxl_fork.c | 42 +++++++++++++++++++++++++++------------ 2 files changed, 60 insertions(+), 13 deletions(-) diff --git a/tools/libxl/libxl_event.h b/tools/libxl/libxl_event.h index 41082ef2f4..d6857d452e 100644 --- a/tools/libxl/libxl_event.h +++ b/tools/libxl/libxl_event.h @@ -466,6 +466,14 @@ void libxl_osevent_occurred_timeout(libxl_ctx *ctx, void *for_libxl) * has multiple libxl ctx's, it must call libxl_childproc_exited * on each ctx.) * + * libxl_sigchld_owner_mainloop_notify: + * + * The application must install a SIGCHLD handler, but will + * notify libxl when a sigchld happened by calling + * libxl_childproc_sigchld_notify. libxl will arrange to reap + * only its own children. This needs to be called only once, + * even for applications which have multiple libxl ctx's. + * * libxl_sigchld_owner_libxl_always: * * The application expects this libxl ctx to reap all of the @@ -494,6 +502,12 @@ typedef enum { * arrange to (un)block or catch SIGCHLD. */ libxl_sigchld_owner_mainloop, + /* Application promises to discover when SIGCHLD occurs and call + * libxl_childproc_sigchld_notify (perhaps from within a signal + * handler). libxl will not itself arrange to (un)block or catch + * SIGCHLD. */ + libxl_sigchld_owner_mainloop_notify, + /* libxl owns SIGCHLD all the time, and the application is * relying on libxl's event loop for reaping its children too. */ libxl_sigchld_owner_libxl_always, @@ -590,6 +604,23 @@ int libxl_childproc_reaped(libxl_ctx *ctx, pid_t, int status) void libxl_childproc_sigchld_occurred(libxl_ctx *ctx) LIBXL_EXTERNAL_CALLERS_ONLY; +/* + * This function is for an application which owns SIGCHLD but still + * expects libxl to handle its own event loops. + * + * Such an the application must notify libxl, by calling this + * function, that a SIGCHLD occurred. libxl will then notify all + * appropriate event loops to check for reaped children.. + * + * May be called only by an application which has called setmode with + * chldowner == libxl_sigchld_owner_mainloop_notify. + * + * MAY be called from within a signal handler. This function is + * reentrang: it will save and restore errno. + */ +void libxl_childproc_sigchld_notify(void) + LIBXL_EXTERNAL_CALLERS_ONLY; + /* * An application which initialises a libxl_ctx in a parent process diff --git a/tools/libxl/libxl_fork.c b/tools/libxl/libxl_fork.c index c5b378c554..7f21bc9bb2 100644 --- a/tools/libxl/libxl_fork.c +++ b/tools/libxl/libxl_fork.c @@ -248,6 +248,11 @@ static void sigchld_handler(int signo) errno = esave; } +void libxl_childproc_sigchld_notify(void) +{ + sigchld_handler(SIGCHLD); +} + static void sigchld_sethandler_raw(void (*handler)(int), struct sigaction *old) { struct sigaction ours; @@ -288,9 +293,8 @@ static void sigchld_handler_when_deferred(int signo) static void defer_sigchld(void) { - assert(sigchld_installed); - - sigchld_sethandler_raw(sigchld_handler_when_deferred, 0); + if (sigchld_installed) + sigchld_sethandler_raw(sigchld_handler_when_deferred, 0); /* Now _this thread_ cannot any longer be interrupted by the * signal, so we can take the mutex without risk of deadlock. If @@ -303,12 +307,12 @@ static void defer_sigchld(void) static void release_sigchld(void) { - assert(sigchld_installed); - int r = pthread_mutex_unlock(&sigchld_defer_mutex); assert(!r); - sigchld_sethandler_raw(sigchld_handler, 0); + if (sigchld_installed) + sigchld_sethandler_raw(sigchld_handler, 0); + if (sigchld_occurred_while_deferred) { sigchld_occurred_while_deferred = 0; /* We might get another SIGCHLD here, in which case @@ -375,6 +379,11 @@ static void sigchld_user_remove(libxl_ctx *ctx) /* idempotent */ void libxl__sigchld_notneeded(libxl__gc *gc) /* non-reentrant, idempotent */ { + /* + * NB that we don't need to special-case + * libxl_sigchld_owner_mainloop_notify; sigchld_removehandler_core + * will DTRT if no signal handler has been set up. + */ sigchld_user_remove(CTX); libxl__ev_fd_deregister(gc, &CTX->sigchld_selfpipe_efd); } @@ -399,7 +408,9 @@ int libxl__sigchld_needed(libxl__gc *gc) /* non-reentrant, idempotent */ if (!CTX->sigchld_user_registered) { atfork_lock(); - sigchld_installhandler_core(); + if (CTX->childproc_hooks->chldowner != libxl_sigchld_owner_mainloop_notify) { + sigchld_installhandler_core(); + } defer_sigchld(); @@ -416,13 +427,15 @@ int libxl__sigchld_needed(libxl__gc *gc) /* non-reentrant, idempotent */ return rc; } -static bool chldmode_ours(libxl_ctx *ctx, bool creating) +/* Do we need the sigchld notification machinery? */ +static bool chldmode_notify(libxl_ctx *ctx, bool creating) { switch (ctx->childproc_hooks->chldowner) { case libxl_sigchld_owner_libxl: return creating || !LIBXL_LIST_EMPTY(&ctx->children); case libxl_sigchld_owner_mainloop: return 0; + case libxl_sigchld_owner_mainloop_notify: case libxl_sigchld_owner_libxl_always: case libxl_sigchld_owner_libxl_always_selective_reap: return 1; @@ -432,7 +445,7 @@ static bool chldmode_ours(libxl_ctx *ctx, bool creating) static void perhaps_sigchld_notneeded(libxl__gc *gc) { - if (!chldmode_ours(CTX, 0)) + if (!chldmode_notify(CTX, 0)) libxl__sigchld_notneeded(gc); } @@ -440,7 +453,7 @@ static int perhaps_sigchld_needed(libxl__gc *gc, bool creating) { int rc; - if (chldmode_ours(CTX, creating)) { + if (chldmode_notify(CTX, creating)) { rc = libxl__sigchld_needed(gc); if (rc) return rc; } @@ -556,13 +569,16 @@ static void sigchld_selfpipe_handler(libxl__egc *egc, libxl__ev_fd *ev, int e = libxl__self_pipe_eatall(selfpipe); if (e) LIBXL__EVENT_DISASTER(egc, "read sigchld pipe", e, 0); - if (CTX->childproc_hooks->chldowner - == libxl_sigchld_owner_libxl_always_selective_reap) { + switch (CTX->childproc_hooks->chldowner) { + case libxl_sigchld_owner_libxl_always_selective_reap: + case libxl_sigchld_owner_mainloop_notify: childproc_checkall(egc); return; + default: + ; } - while (chldmode_ours(CTX, 0) /* in case the app changes the mode */) { + while (chldmode_notify(CTX, 0) /* in case the app changes the mode */) { int status; pid_t pid = checked_waitpid(egc, -1, &status);