From: Bamvor Jian Zhang Subject: [PATCH 1/2] expose child fd in order to handle child exit in libvirt Date: Tue, 5 Nov 2013 17:22:10 +0800 Message-ID: <1383643331-6703-2-git-send-email-bjzhang@suse.com> References: <1383643331-6703-1-git-send-email-bjzhang@suse.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: <1383643331-6703-1-git-send-email-bjzhang@suse.com> List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xen.org Errors-To: xen-devel-bounces@lists.xen.org To: xen-devel@lists.xen.org Cc: jfehlig@suse.com, Bamvor Jian Zhang , ian.jackson@eu.citrix.com, ian.campbell@citrix.com, stefano.stabellini@eu.citrix.com List-Id: xen-devel@lists.xenproject.org libvirt could handle fd and timeout event through libxl_osevent_hooks. either of these will not inform the child exit if libvirt set the libxl_sigchld_owner_libxl_always. add a function for returning the sigchld_selfpipe in order to handle the child exit in libvirt. meanwhile, there is only one pipe in ctx, it seems that it is not worth to add this to libxl_osevent_hooks. Signed-off-by: Bamvor Jian Zhang --- tools/libxl/libxl.h | 2 ++ tools/libxl/libxl_fork.c | 5 +++++ 2 files changed, 7 insertions(+) diff --git a/tools/libxl/libxl.h b/tools/libxl/libxl.h index 1c6675d..11e1bc3 100644 --- a/tools/libxl/libxl.h +++ b/tools/libxl/libxl.h @@ -1071,6 +1071,8 @@ int libxl_flask_loadpolicy(libxl_ctx *ctx, void *policy, uint32_t size); int libxl_fd_set_cloexec(libxl_ctx *ctx, int fd, int cloexec); int libxl_fd_set_nonblock(libxl_ctx *ctx, int fd, int nonblock); +int libxl_get_pipe_handle(libxl_ctx *ctx, int num); + #include #endif /* LIBXL_H */ diff --git a/tools/libxl/libxl_fork.c b/tools/libxl/libxl_fork.c index 044ddad..1989258 100644 --- a/tools/libxl/libxl_fork.c +++ b/tools/libxl/libxl_fork.c @@ -418,6 +418,11 @@ int libxl__ev_child_xenstore_reopen(libxl__gc *gc, const char *what) { return rc; } +int libxl_get_pipe_handle(libxl_ctx *ctx, int num) +{ + return ctx->sigchld_selfpipe[num]; +} + /* * Local variables: * mode: C -- 1.8.1.4