From 98b4508a0de3f6d45ab55279c11ef9b965f9fd82 Mon Sep 17 00:00:00 2001 From: "Tate, Hongliang Tian" Date: Sun, 6 Jan 2019 19:42:36 +0800 Subject: [PATCH] Use posix_spawn and wait4 in libc --- test/spawn/main.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/test/spawn/main.c b/test/spawn/main.c index 60f1b18b..8157d67c 100644 --- a/test/spawn/main.c +++ b/test/spawn/main.c @@ -1,19 +1,21 @@ #include +#include #include #include +#include int main(void) { int ret, child_pid, status; printf("Run a parent process has pid = %d and ppid = %d\n", getpid(), getppid()); - ret = syscall(__NR_spawn, &child_pid, "getpid/bin.encrypted", NULL, NULL); + ret = posix_spawn(&child_pid, "getpid/bin.encrypted", NULL, NULL, NULL, NULL); if (ret < 0) { printf("ERROR: failed to spawn a child process\n"); return -1; } printf("Spawn a new proces successfully (pid = %d)\n", child_pid); - ret = syscall(__NR_wait4, -1, &status, 0); + ret = wait4(-1, &status, 0, NULL); if (ret < 0) { printf("ERROR: failed to wait4 the child process\n"); return -1;