[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Xen-devel] [PATCH 2 of 7] libxl: rename dm_xenstore_record_pid to libxl_spawner_record_pid
# HG changeset patch # User Olaf Hering <olaf@xxxxxxxxx> # Date 1319707162 -7200 # Node ID 57af937278c5c00944bcaf245dd173e9345cdecc # Parent b709d7fefde93765b386204d9d56e2fe4e7a654f libxl: rename dm_xenstore_record_pid to libxl_spawner_record_pid Signed-off-by: Olaf Hering <olaf@xxxxxxxxx> diff -r b709d7fefde9 -r 57af937278c5 tools/libxl/libxl_dm.c --- a/tools/libxl/libxl_dm.c +++ b/tools/libxl/libxl_dm.c @@ -516,31 +516,6 @@ static char ** libxl__build_device_model } } -static void dm_xenstore_record_pid(void *for_spawn, pid_t innerchild) -{ - libxl__spawner_starting *starting = for_spawn; - struct xs_handle *xsh; - char *path = NULL, *pid = NULL; - int len; - - if (asprintf(&path, "%s/%s", starting->dom_path, "image/device-model-pid") < 0) - goto out; - - len = asprintf(&pid, "%d", innerchild); - if (len < 0) - goto out; - - /* we mustn't use the parent's handle in the child */ - xsh = xs_daemon_open(); - - xs_write(xsh, XBT_NULL, path, pid, len); - - xs_daemon_close(xsh); -out: - free(path); - free(pid); -} - static int libxl__vfb_and_vkb_from_device_model_info(libxl__gc *gc, libxl_device_model_info *info, libxl_device_vfb *vfb, @@ -896,7 +871,7 @@ retry_transaction: } rc = libxl__spawn_spawn(gc, p->for_spawn, "device model", - dm_xenstore_record_pid, p); + libxl_spawner_record_pid, p); if (rc < 0) goto out_close; if (!rc) { /* inner child */ diff -r b709d7fefde9 -r 57af937278c5 tools/libxl/libxl_exec.c --- a/tools/libxl/libxl_exec.c +++ b/tools/libxl/libxl_exec.c @@ -144,6 +144,31 @@ void libxl_report_child_exitstatus(libxl } } +void libxl_spawner_record_pid(void *for_spawn, pid_t innerchild) +{ + libxl__spawner_starting *starting = for_spawn; + struct xs_handle *xsh; + char *path = NULL, *pid = NULL; + int len; + + if (asprintf(&path, "%s/%s", starting->dom_path, "image/device-model-pid") < 0) + goto out; + + len = asprintf(&pid, "%d", innerchild); + if (len < 0) + goto out; + + /* we mustn't use the parent's handle in the child */ + xsh = xs_daemon_open(); + + xs_write(xsh, XBT_NULL, path, pid, len); + + xs_daemon_close(xsh); +out: + free(path); + free(pid); +} + static int libxl__set_fd_flag(libxl__gc *gc, int fd, int flag) { int flags; diff -r b709d7fefde9 -r 57af937278c5 tools/libxl/libxl_internal.h --- a/tools/libxl/libxl_internal.h +++ b/tools/libxl/libxl_internal.h @@ -276,7 +276,7 @@ typedef struct { } libxl__spawn_starting; typedef struct { - char *dom_path; /* from libxl_malloc, only for dm_xenstore_record_pid */ + char *dom_path; /* from libxl_malloc, only for libxl_spawner_record_pid */ int domid; libxl__spawn_starting *for_spawn; } libxl__spawner_starting; @@ -327,6 +327,8 @@ _hidden int libxl__spawn_spawn(libxl__gc void *hook_data); _hidden int libxl__destroy_device_model(libxl__gc *gc, uint32_t domid); +_hidden void libxl_spawner_record_pid(void *for_spawn, pid_t innerchild); + /* Logs errors. A copy of "what" is taken. Return values: * < 0 error, for_spawn need not be detached * +1 caller is the parent, must call detach on *for_spawn eventually _______________________________________________ Xen-devel mailing list Xen-devel@xxxxxxxxxxxxxxxxxxx http://lists.xensource.com/xen-devel
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |