[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Xen-devel] [PATCH 04/10] libxl: Move setup of child processing code to driver initialization



Informing libxl how to handle its child proceses should be done once
during driver initialization, not once for each domain-specific
libxl_ctx object.  The related libxl documentation in
$xen-src/tools/libxl/libxl_event.h even mentions that "it is best to
call this at initialisation".

Signed-off-by: Jim Fehlig <jfehlig@xxxxxxxx>
---
 src/libxl/libxl_domain.c | 10 ----------
 src/libxl/libxl_driver.c | 11 +++++++++++
 2 files changed, 11 insertions(+), 10 deletions(-)

diff --git a/src/libxl/libxl_domain.c b/src/libxl/libxl_domain.c
index 4872abe..0fc03f7 100644
--- a/src/libxl/libxl_domain.c
+++ b/src/libxl/libxl_domain.c
@@ -529,14 +529,6 @@ const struct libxl_event_hooks ev_hooks = {
     .disaster = NULL,
 };
 
-static const libxl_childproc_hooks libxl_child_hooks = {
-#ifdef LIBXL_HAVE_SIGCHLD_OWNER_SELECTIVE_REAP
-    .chldowner = libxl_sigchld_owner_libxl_always_selective_reap,
-#else
-    .chldowner = libxl_sigchld_owner_libxl,
-#endif
-};
-
 int
 libxlDomainObjPrivateInitCtx(virDomainObjPtr vm)
 {
@@ -573,8 +565,6 @@ libxlDomainObjPrivateInitCtx(virDomainObjPtr vm)
         goto cleanup;
     }
 
-    libxl_childproc_setmode(priv->ctx, &libxl_child_hooks, priv);
-
     ret = 0;
 
  cleanup:
diff --git a/src/libxl/libxl_driver.c b/src/libxl/libxl_driver.c
index 4b459eb..5503c07 100644
--- a/src/libxl/libxl_driver.c
+++ b/src/libxl/libxl_driver.c
@@ -473,6 +473,14 @@ static const libxl_osevent_hooks libxl_osevent_callbacks = 
{
     .timeout_deregister = libxlTimeoutDeregisterEventHook,
 };
 
+static const libxl_childproc_hooks libxl_child_hooks = {
+#ifdef LIBXL_HAVE_SIGCHLD_OWNER_SELECTIVE_REAP
+    .chldowner = libxl_sigchld_owner_libxl_always_selective_reap,
+#else
+    .chldowner = libxl_sigchld_owner_libxl,
+#endif
+};
+
 static int
 libxlStateInitialize(bool privileged,
                      virStateInhibitCallback callback ATTRIBUTE_UNUSED,
@@ -521,6 +529,9 @@ libxlStateInitialize(bool privileged,
     /* Register the callbacks providing access to libvirt's event loop */
     libxl_osevent_register_hooks(cfg->ctx, &libxl_osevent_callbacks, cfg->ctx);
 
+    /* Setup child process handling.  See $xen-src/tools/libxl/libxl_event.h */
+    libxl_childproc_setmode(cfg->ctx, &libxl_child_hooks, cfg->ctx);
+
     libxl_driver->config = cfg;
     if (virFileMakePath(cfg->stateDir) < 0) {
         virReportError(VIR_ERR_INTERNAL_ERROR,
-- 
1.8.4.5


_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxx
http://lists.xen.org/xen-devel


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.