# HG changeset patch
# User Keir Fraser <keir.fraser@xxxxxxxxxx>
# Date 1262177037 0
# Node ID bb828aacf968b763b3ed99c20a191be04e7a63b4
# Parent 411a5b79605017b88ce77dbc5f00220956b5597f
libxl: remove waitpid wrapper that's doesn't do anything
if the waitpid callback isn't defined just call normal waitpid
Signed-off-by: Vincent Hanquez <vincent.hanquez@xxxxxxxxxxxxx>
---
tools/libxl/libxl.c | 2 --
tools/libxl/libxl_exec.c | 16 ++++++++--------
tools/libxl/libxl_internal.h | 1 -
3 files changed, 8 insertions(+), 11 deletions(-)
diff -r 411a5b796050 -r bb828aacf968 tools/libxl/libxl.c
--- a/tools/libxl/libxl.c Wed Dec 30 12:43:19 2009 +0000
+++ b/tools/libxl/libxl.c Wed Dec 30 12:43:57 2009 +0000
@@ -44,8 +44,6 @@ int libxl_ctx_init(struct libxl_ctx *ctx
ctx->xch = xc_interface_open();
ctx->xsh = xs_daemon_open();
-
- ctx->waitpid_instead = libxl_waitpid_instead_default;
return 0;
}
diff -r 411a5b796050 -r bb828aacf968 tools/libxl/libxl_exec.c
--- a/tools/libxl/libxl_exec.c Wed Dec 30 12:43:19 2009 +0000
+++ b/tools/libxl/libxl_exec.c Wed Dec 30 12:43:57 2009 +0000
@@ -41,6 +41,11 @@ static pid_t libxl_fork(struct libxl_ctx
}
return pid;
+}
+
+static int call_waitpid(pid_t (*waitpid_cb)(pid_t, int *, int), pid_t pid, int
*status, int options)
+{
+ return (waitpid_cb) ? waitpid_cb(pid, status, 0) : waitpid(pid, status, 0);
}
void libxl_exec(struct libxl_ctx *ctx, int stdinfd, int stdoutfd, int stderrfd,
@@ -94,11 +99,6 @@ void libxl_report_child_exitstatus(struc
}
}
-pid_t libxl_waitpid_instead_default(pid_t pid, int *status, int flags)
-{
- return waitpid(pid,status,flags);
-}
-
int libxl_spawn_spawn(struct libxl_ctx *ctx,
libxl_device_model_starting *starting,
const char *what,
@@ -137,7 +137,7 @@ int libxl_spawn_spawn(struct libxl_ctx *
if (!for_spawn) _exit(0); /* just detach then */
- got = ctx->waitpid_instead(child, &status, 0);
+ got = call_waitpid(ctx->waitpid_instead, child, &status, 0);
assert(got == child);
libxl_report_child_exitstatus(ctx, what, child, status);
@@ -178,7 +178,7 @@ int libxl_spawn_detach(struct libxl_ctx
(unsigned long)for_spawn->intermediate);
abort(); /* things are very wrong */
}
- got = ctx->waitpid_instead(for_spawn->intermediate, &status, 0);
+ got = call_waitpid(ctx->waitpid_instead, for_spawn->intermediate,
&status, 0);
assert(got == for_spawn->intermediate);
if (!(WIFSIGNALED(status) && WTERMSIG(status) == SIGKILL)) {
report_spawn_intermediate_status(ctx, for_spawn, status);
@@ -202,7 +202,7 @@ int libxl_spawn_check(struct libxl_ctx *
if (!for_spawn) return 0;
assert(for_spawn->intermediate);
- got = ctx->waitpid_instead(for_spawn->intermediate, &status, WNOHANG);
+ got = call_waitpid(ctx->waitpid_instead, for_spawn->intermediate, &status,
0);
if (!got) return 0;
assert(got == for_spawn->intermediate);
diff -r 411a5b796050 -r bb828aacf968 tools/libxl/libxl_internal.h
--- a/tools/libxl/libxl_internal.h Wed Dec 30 12:43:19 2009 +0000
+++ b/tools/libxl/libxl_internal.h Wed Dec 30 12:43:57 2009 +0000
@@ -213,7 +213,6 @@ void libxl_exec(struct libxl_ctx *ctx, i
char *arg0, char **args); // logs errors, never returns
void libxl_log_child_exitstatus(struct libxl_ctx *ctx,
const char *what, pid_t pid, int status);
-pid_t libxl_waitpid_instead_default(pid_t pid, int *status, int flags);
#endif
_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-changelog
|