libxl: add pid path to libxl__spawner_starting
authorOlaf Hering <olaf@aepfle.de>
Thu, 27 Oct 2011 09:20:25 +0000 (11:20 +0200)
committerOlaf Hering <olaf@aepfle.de>
Thu, 27 Oct 2011 09:20:25 +0000 (11:20 +0200)
libxl_spawner_record_pid() should be able to write the pid to arbitrary paths.

v2:
 - use const char* for ->pid_path, and update comment

Signed-off-by: Olaf Hering <olaf@aepfle.de>
Acked-by: Ian Jackson <ian.jackson.citrix.com>
Committed-by: Ian Jackson <ian.jackson.citrix.com>
tools/libxl/libxl_dm.c
tools/libxl/libxl_exec.c
tools/libxl/libxl_internal.h

index d579056e71c0571fa0c3fbfeadd146cce8d5f115..c0118dc245366d31c680e6f5d367d3c3a70b9fbe 100644 (file)
@@ -848,6 +848,7 @@ int libxl__create_device_model(libxl__gc *gc,
 
     p->domid = info->domid;
     p->dom_path = libxl__xs_get_dompath(gc, info->domid);
+    p->pid_path = "image/device-model-pid";
     if (!p->dom_path) {
         rc = ERROR_FAIL;
         goto out_close;
index a91366ab2cc2cbcc3b1ff741c6315d38684de57d..5021d28c2782a94c719160958ef99c67ee5d8847 100644 (file)
@@ -151,7 +151,7 @@ void libxl_spawner_record_pid(void *for_spawn, pid_t innerchild)
     char *path = NULL, *pid = NULL;
     int len;
 
-    if (asprintf(&path, "%s/%s", starting->dom_path, "image/device-model-pid") < 0)
+    if (asprintf(&path, "%s/%s", starting->dom_path, starting->pid_path) < 0)
         goto out;
 
     len = asprintf(&pid, "%d", innerchild);
index e77ff23df9912cc5e039955887b2ee2738abf1e8..8f49d9a812b8f474d3e2b647235f516726a70c88 100644 (file)
@@ -268,6 +268,7 @@ typedef struct {
 
 typedef struct {
     char *dom_path; /* from libxl_malloc, only for libxl_spawner_record_pid */
+    const char *pid_path; /* only for libxl_spawner_record_pid */
     int domid;
     libxl__spawn_starting *for_spawn;
 } libxl__spawner_starting;