diff --git a/src/libxl/libxl_domain.c b/src/libxl/libxl_domain.c index c1d507f604..a78c19193c 100644 --- a/src/libxl/libxl_domain.c +++ b/src/libxl/libxl_domain.c @@ -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: diff --git a/src/libxl/libxl_driver.c b/src/libxl/libxl_driver.c index 0f40836d44..dd0f253fb8 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,