]> xenbits.xensource.com Git - libvirt.git/commitdiff
libxl: Move setup of child processing code to driver initialization
authorJim Fehlig <jfehlig@suse.com>
Mon, 2 Feb 2015 23:19:34 +0000 (16:19 -0700)
committerJim Fehlig <jfehlig@suse.com>
Tue, 24 Mar 2015 21:03:54 +0000 (15:03 -0600)
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@suse.com>
src/libxl/libxl_domain.c
src/libxl/libxl_driver.c

index c1d507f60483a5f9fe1f81f447826a8ef3b5b84d..a78c19193c8f5c02f62fd3186f81f8312d9dd45b 100644 (file)
@@ -536,14 +536,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)
 {
@@ -580,8 +572,6 @@ libxlDomainObjPrivateInitCtx(virDomainObjPtr vm)
         goto cleanup;
     }
 
-    libxl_childproc_setmode(priv->ctx, &libxl_child_hooks, priv);
-
     ret = 0;
 
  cleanup:
index 0f40836d44ef9679ce6075db9eacb56fa7c939da..dd0f253fb871c91b46357786ea583b20586e2d44 100644 (file)
@@ -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,