assert(time_inuse == child_inuse);
return child_inuse;
}
+
+void libxl__kill(libxl__gc *gc, pid_t pid, int sig, const char *what)
+{
+ int r = kill(pid, sig);
+ if (r) LOGE(WARN, "failed to kill() %s [%lu] (signal %d)",
+ what, (unsigned long)pid, sig);
+}
+
+/*
+ * Local variables:
+ * mode: C
+ * c-basic-offset: 4
+ * indent-tabs-mode: nil
+ * End:
+ */
int libxl__async_exec_start(libxl__async_exec_state *aes);
bool libxl__async_exec_inuse(const libxl__async_exec_state *aes);
+_hidden void libxl__kill(libxl__gc *gc, pid_t pid, int sig, const char *what);
+
/*----- device addition/removal -----*/
typedef struct libxl__ao_device libxl__ao_device;
libxl__carefd_close(childs_pipes[1]);
helper_failed(egc, shs, rc);;
}
-static void sendsig(libxl__gc *gc, libxl__save_helper_state *shs, int sig)
-{
- int r = kill(shs->child.pid, sig);
- if (r) LOGE(WARN, "failed to kill save/restore helper [%lu] (signal %d)",
- (unsigned long)shs->child.pid, sig);
-}
static void helper_failed(libxl__egc *egc, libxl__save_helper_state *shs,
int rc)
return;
}
- sendsig(gc, shs, SIGKILL);
+ libxl__kill(gc, shs->child.pid, SIGKILL, "save/restore helper");
}
static void helper_stop(libxl__egc *egc, libxl__ao_abortable *abrt, int rc)
if (!shs->rc)
shs->rc = rc;
- sendsig(gc, shs, SIGTERM);
+ libxl__kill(gc, shs->child.pid, SIGTERM, "save/restore helper");
}
static void helper_stdout_readable(libxl__egc *egc, libxl__ev_fd *ev,