diff options
author | Keir Fraser <keir.fraser@citrix.com> | 2009-12-30 12:43:57 +0000 |
---|---|---|
committer | Keir Fraser <keir.fraser@citrix.com> | 2009-12-30 12:43:57 +0000 |
commit | cae7e66baeb3fc3e3c9c3cff905e85ae2100d961 (patch) | |
tree | 394b104a87e48d087233e81fdeba693e18fff240 /tools/libxl/libxl_exec.c | |
parent | 3cf230cbffc8fa5de64980840fe8f1c2e1e306e3 (diff) | |
download | xen-cae7e66baeb3fc3e3c9c3cff905e85ae2100d961.tar.gz xen-cae7e66baeb3fc3e3c9c3cff905e85ae2100d961.tar.bz2 xen-cae7e66baeb3fc3e3c9c3cff905e85ae2100d961.zip |
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@eu.citrix.com>
Diffstat (limited to 'tools/libxl/libxl_exec.c')
-rw-r--r-- | tools/libxl/libxl_exec.c | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/tools/libxl/libxl_exec.c b/tools/libxl/libxl_exec.c index 4b085b3025..ba92019e4b 100644 --- a/tools/libxl/libxl_exec.c +++ b/tools/libxl/libxl_exec.c @@ -43,6 +43,11 @@ static pid_t libxl_fork(struct libxl_ctx *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, char *arg0, char **args) /* call this in the child */ @@ -94,11 +99,6 @@ void libxl_report_child_exitstatus(struct libxl_ctx *ctx, } } -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 *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 *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 *ctx, void *for_spawn_void) 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); |