Mailing List Archive

[PATCH 15/25] libxl: remove ctx->waitpid_instead
Remove this obsolete hook. Callers inside libxl which create and reap
children should use the mechanisms provided by the event system.

(This has no functional difference since there is no way for
ctx->waitpid_instead ever to become set.)

Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
---
tools/libxl/libxl_exec.c | 12 +++---------
tools/libxl/libxl_internal.h | 3 ---
2 files changed, 3 insertions(+), 12 deletions(-)

diff --git a/tools/libxl/libxl_exec.c b/tools/libxl/libxl_exec.c
index b10e79f..2ee2154 100644
--- a/tools/libxl/libxl_exec.c
+++ b/tools/libxl/libxl_exec.c
@@ -19,11 +19,6 @@

#include "libxl_internal.h"

-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, options) : waitpid(pid, status, options);
-}
-
static void check_open_fds(const char *what)
{
const char *env_debug;
@@ -344,7 +339,7 @@ int libxl__spawn_spawn(libxl__gc *gc,

if (!for_spawn) _exit(0); /* just detach then */

- got = call_waitpid(ctx->waitpid_instead, child, &status, 0);
+ got = waitpid(child, &status, 0);
assert(got == child);

rc = (WIFEXITED(status) ? WEXITSTATUS(status) :
@@ -404,7 +399,7 @@ int libxl__spawn_detach(libxl__gc *gc,
(unsigned long)for_spawn->intermediate);
abort(); /* things are very wrong */
}
- got = call_waitpid(ctx->waitpid_instead, for_spawn->intermediate, &status, 0);
+ got = waitpid(for_spawn->intermediate, &status, 0);
assert(got == for_spawn->intermediate);
if (!(WIFSIGNALED(status) && WTERMSIG(status) == SIGKILL)) {
report_spawn_intermediate_status(gc, for_spawn, status);
@@ -421,14 +416,13 @@ int libxl__spawn_detach(libxl__gc *gc,

int libxl__spawn_check(libxl__gc *gc, libxl__spawn_starting *for_spawn)
{
- libxl_ctx *ctx = libxl__gc_owner(gc);
pid_t got;
int status;

if (!for_spawn) return 0;

assert(for_spawn->intermediate);
- got = call_waitpid(ctx->waitpid_instead, for_spawn->intermediate, &status, WNOHANG);
+ got = waitpid(for_spawn->intermediate, &status, WNOHANG);
if (!got) return 0;

assert(got == for_spawn->intermediate);
diff --git a/tools/libxl/libxl_internal.h b/tools/libxl/libxl_internal.h
index a5b8681..0109f79 100644
--- a/tools/libxl/libxl_internal.h
+++ b/tools/libxl/libxl_internal.h
@@ -335,9 +335,6 @@ struct libxl__ctx {
int sigchld_selfpipe[2]; /* [0]==-1 means handler not installed */
LIBXL_LIST_HEAD(, libxl__ev_child) children;

- /* This is obsolete and must be removed: */
- int (*waitpid_instead)(pid_t pid, int *status, int flags);
-
libxl_version_info version_info;
};

--
1.7.2.5


_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
http://lists.xen.org/xen-devel