From: Olaf Hering Subject: [PATCH 17 of 24] libxl: add libxl__spawn_confirm_offspring_startup Date: Mon, 03 Oct 2011 17:54:54 +0200 Message-ID: <018f63b6e4863faca16a.1317657294@probook.site> References: Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xensource.com Errors-To: xen-devel-bounces@lists.xensource.com To: xen-devel@lists.xensource.com List-Id: xen-devel@lists.xenproject.org # HG changeset patch # User Olaf Hering # Date 1317653616 -7200 # Node ID 018f63b6e4863faca16a832a5a34c6a6e7726cf7 # Parent 35ec0355b3283a87477c7377a2fd3da5e84d2bcd libxl: add libxl__spawn_confirm_offspring_startup libxl__spawn_confirm_offspring_startup() is a generic version of libxl__confirm_device_model_startup(). Signed-off-by: Olaf Hering diff -r 35ec0355b328 -r 018f63b6e486 tools/libxl/libxl_exec.c --- a/tools/libxl/libxl_exec.c +++ b/tools/libxl/libxl_exec.c @@ -262,6 +262,30 @@ err: return -1; } +static int detach_offspring(libxl__gc *gc, + libxl__spawner_starting *starting) +{ + int rc; + rc = libxl__spawn_detach(gc, starting->for_spawn); + if (starting->for_spawn) + free(starting->for_spawn); + free(starting); + return rc; +} + +int libxl__spawn_confirm_offspring_startup(libxl__gc *gc, + uint32_t timeout, char *what, + char *path, char *state, + libxl__spawner_starting *starting) +{ + int detach; + int problem = libxl__wait_for_offspring(gc, starting->domid, timeout, what, + path, state, + starting->for_spawn, NULL, NULL); + detach = detach_offspring(gc, starting); + return problem ? problem : detach; +} + static int libxl__set_fd_flag(libxl__gc *gc, int fd, int flag) { int flags; diff -r 35ec0355b328 -r 018f63b6e486 tools/libxl/libxl_internal.h --- a/tools/libxl/libxl_internal.h +++ b/tools/libxl/libxl_internal.h @@ -313,6 +313,12 @@ _hidden int libxl__wait_for_offspring(li const char *state, void *userdata), void *check_callback_userdata); + +_hidden int libxl__spawn_confirm_offspring_startup(libxl__gc *gc, + uint32_t timeout, char *what, + char *path, char *state, + libxl__spawner_starting *starting); + /* 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