Module Name: src
Committed By: kamil
Date: Thu Nov 3 18:54:16 UTC 2016
Modified Files:
src/tests/kernel: t_ptrace.c
Log Message:
Simplify code, prefer strerror(3) over sys_errlist(3)
No functional change intended.
strerror(3) change requested by <kre>.
Sponsored by <The NetBSD Foundation>.
To generate a diff of this commit:
cvs rdiff -u -r1.5 -r1.6 src/tests/kernel/t_ptrace.c
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
Modified files:
Index: src/tests/kernel/t_ptrace.c
diff -u src/tests/kernel/t_ptrace.c:1.5 src/tests/kernel/t_ptrace.c:1.6
--- src/tests/kernel/t_ptrace.c:1.5 Thu Nov 3 18:25:54 2016
+++ src/tests/kernel/t_ptrace.c Thu Nov 3 18:54:16 2016
@@ -1,4 +1,4 @@
-/* $NetBSD: t_ptrace.c,v 1.5 2016/11/03 18:25:54 kamil Exp $ */
+/* $NetBSD: t_ptrace.c,v 1.6 2016/11/03 18:54:16 kamil Exp $ */
/*-
* Copyright (c) 2016 The NetBSD Foundation, Inc.
@@ -27,7 +27,7 @@
*/
#include <sys/cdefs.h>
-__RCSID("$NetBSD: t_ptrace.c,v 1.5 2016/11/03 18:25:54 kamil Exp $");
+__RCSID("$NetBSD: t_ptrace.c,v 1.6 2016/11/03 18:54:16 kamil Exp $");
#include <sys/param.h>
#include <sys/types.h>
@@ -67,8 +67,7 @@ ATF_TC_BODY(traceme1, tc)
/* "2: Before calling ptrace(PT_TRACE_ME, ...)\n" */
if (ptrace(PT_TRACE_ME, 0, NULL, 0) == -1) {
/* XXX: Is it safe to use ATF functions in a child? */
- err(EXIT_FAILURE, "2: ptrace(2) call failed with "
- "status %s", sys_errlist[errno]);
+ err(EXIT_FAILURE, "2: ptrace(2) call failed");
}
/* "2: Before raising SIGSTOP\n" */
@@ -76,72 +75,70 @@ ATF_TC_BODY(traceme1, tc)
/* "2: Before calling _exit(%d)\n", exitval */
_exit(exitval);
- } else {
- printf("1: Parent process PID=%d, child's PID=%d\n", getpid(),
- child);
+ }
+ printf("1: Parent process PID=%d, child's PID=%d\n", getpid(), child);
- printf("1: Before calling waitpid() for the child\n");
- wpid = waitpid(child, &status, 0);
+ printf("1: Before calling waitpid() for the child\n");
+ wpid = waitpid(child, &status, 0);
- printf("1: Validating child's PID (expected %d, got %d)\n",
- child, wpid);
- ATF_REQUIRE(child == wpid);
+ printf("1: Validating child's PID (expected %d, got %d)\n", child,
+ wpid);
+ ATF_REQUIRE(child == wpid);
- printf("1: Ensuring that the child has not been exited\n");
- ATF_REQUIRE(!WIFEXITED(status));
+ printf("1: Ensuring that the child has not been exited\n");
+ ATF_REQUIRE(!WIFEXITED(status));
- printf("1: Ensuring that the child has not been continued\n");
- ATF_REQUIRE(!WIFCONTINUED(status));
+ printf("1: Ensuring that the child has not been continued\n");
+ ATF_REQUIRE(!WIFCONTINUED(status));
- printf("1: Ensuring that the child has not been terminated "
- "with a signal\n");
- ATF_REQUIRE(!WIFSIGNALED(status));
+ printf("1: Ensuring that the child has not been terminated with a "
+ "signal\n");
+ ATF_REQUIRE(!WIFSIGNALED(status));
- printf("1: Ensuring that the child has been stopped\n");
- ATF_REQUIRE(WIFSTOPPED(status));
+ printf("1: Ensuring that the child has been stopped\n");
+ ATF_REQUIRE(WIFSTOPPED(status));
- printf("1: Verifying that he child has been stopped with the"
- " %s signal (received %s)\n", sys_signame[sigval],
- sys_signame[WSTOPSIG(status)]);
- ATF_REQUIRE(WSTOPSIG(status) == sigval);
+ printf("1: Verifying that he child has been stopped with the %s "
+ "signal (received %s)\n", sys_signame[sigval],
+ sys_signame[WSTOPSIG(status)]);
+ ATF_REQUIRE(WSTOPSIG(status) == sigval);
- printf("1: Before resuming the child process where it left "
- "off and without signal to be sent\n");
- ATF_REQUIRE(ptrace(PT_CONTINUE, child, (void *)1, 0) != -1);
+ printf("1: Before resuming the child process where it left off and "
+ "without signal to be sent\n");
+ ATF_REQUIRE(ptrace(PT_CONTINUE, child, (void *)1, 0) != -1);
- printf("1: Before calling waitpid() for the child\n");
- wpid = waitpid(child, &status, 0);
+ printf("1: Before calling waitpid() for the child\n");
+ wpid = waitpid(child, &status, 0);
- printf("1: Validating that child's PID is still there\n");
- ATF_REQUIRE(wpid == child);
+ printf("1: Validating that child's PID is still there\n");
+ ATF_REQUIRE(wpid == child);
- printf("1: Ensuring that the child has been exited\n");
- ATF_REQUIRE(WIFEXITED(status));
+ printf("1: Ensuring that the child has been exited\n");
+ ATF_REQUIRE(WIFEXITED(status));
- printf("1: Ensuring that the child has not been continued\n");
- ATF_REQUIRE(!WIFCONTINUED(status));
+ printf("1: Ensuring that the child has not been continued\n");
+ ATF_REQUIRE(!WIFCONTINUED(status));
- printf("1: Ensuring that the child has not been terminated "
- "with a signal\n");
- ATF_REQUIRE(!WIFSIGNALED(status));
+ printf("1: Ensuring that the child has not been terminated with a "
+ "signal\n");
+ ATF_REQUIRE(!WIFSIGNALED(status));
- printf("1: Ensuring that the child has not been stopped\n");
- ATF_REQUIRE(!WIFSTOPPED(status));
+ printf("1: Ensuring that the child has not been stopped\n");
+ ATF_REQUIRE(!WIFSTOPPED(status));
- printf("1: Verifying that he child has exited with the "
- "%d status (received %d)\n", exitval, WEXITSTATUS(status));
- ATF_REQUIRE(WEXITSTATUS(status) == exitval);
+ printf("1: Verifying that he child has exited with the %d status "
+ "(received %d)\n", exitval, WEXITSTATUS(status));
+ ATF_REQUIRE(WEXITSTATUS(status) == exitval);
- printf("1: Before calling waitpid() for the exited child\n");
- wpid = waitpid(child, &status, 0);
+ printf("1: Before calling waitpid() for the exited child\n");
+ wpid = waitpid(child, &status, 0);
- printf("1: Validating that child's PID no longer exists\n");
- ATF_REQUIRE(wpid == -1);
+ printf("1: Validating that child's PID no longer exists\n");
+ ATF_REQUIRE(wpid == -1);
- printf("1: Validating that errno is set to %s (got %s)\n",
- sys_errlist[ECHILD], sys_errlist[errno]);
- ATF_REQUIRE(errno == ECHILD);
- }
+ printf("1: Validating that errno is set to %s (got %s)\n",
+ strerror(ECHILD), strerror(errno));
+ ATF_REQUIRE(errno == ECHILD);
}
ATF_TC(traceme2);
@@ -180,8 +177,7 @@ ATF_TC_BODY(traceme2, tc)
/* "2: Before calling ptrace(PT_TRACE_ME, ...)\n" */
if (ptrace(PT_TRACE_ME, 0, NULL, 0) == -1) {
/* XXX: Is it safe to use ATF functions in a child? */
- err(EXIT_FAILURE, "2: ptrace(2) call failed with "
- "status %s", sys_errlist[errno]);
+ err(EXIT_FAILURE, "2: ptrace(2) call failed");
}
/* "2: Setup sigaction(2) in the child" */
@@ -190,8 +186,7 @@ ATF_TC_BODY(traceme2, tc)
sigemptyset(&sa.sa_mask);
if (sigaction(sigsent, &sa, NULL) == -1)
- err(EXIT_FAILURE, "2: sigaction(2) call failed with "
- "status %s", sys_errlist[errno]);
+ err(EXIT_FAILURE, "2: sigaction(2) call failed");
/* "2: Before raising SIGSTOP\n" */
raise(sigval);
@@ -203,74 +198,70 @@ ATF_TC_BODY(traceme2, tc)
/* "2: Before calling _exit(%d)\n", exitval */
_exit(exitval);
- } else {
- printf("1: Parent process PID=%d, child's PID=%d\n", getpid(),
- child);
+ }
+ printf("1: Parent process PID=%d, child's PID=%d\n", getpid(), child);
- printf("1: Before calling waitpid() for the child\n");
- wpid = waitpid(child, &status, 0);
+ printf("1: Before calling waitpid() for the child\n");
+ wpid = waitpid(child, &status, 0);
- printf("1: Validating child's PID (expected %d, got %d)\n",
- child, wpid);
- ATF_REQUIRE(child == wpid);
+ printf("1: Validating child's PID (expected %d, got %d)\n", child,
+ wpid);
+ ATF_REQUIRE(child == wpid);
- printf("1: Ensuring that the child has not been exited\n");
- ATF_REQUIRE(!WIFEXITED(status));
+ printf("1: Ensuring that the child has not been exited\n");
+ ATF_REQUIRE(!WIFEXITED(status));
- printf("1: Ensuring that the child has not been continued\n");
- ATF_REQUIRE(!WIFCONTINUED(status));
+ printf("1: Ensuring that the child has not been continued\n");
+ ATF_REQUIRE(!WIFCONTINUED(status));
- printf("1: Ensuring that the child has not been terminated "
- "with a signal\n");
- ATF_REQUIRE(!WIFSIGNALED(status));
+ printf("1: Ensuring that the child has not been terminated with a "
+ "signal\n");
+ ATF_REQUIRE(!WIFSIGNALED(status));
- printf("1: Ensuring that the child has been stopped\n");
- ATF_REQUIRE(WIFSTOPPED(status));
+ printf("1: Ensuring that the child has been stopped\n");
+ ATF_REQUIRE(WIFSTOPPED(status));
- printf("1: Verifying that he child has been stopped with the"
- " %s signal (received %s)\n", sys_signame[sigval],
- sys_signame[WSTOPSIG(status)]);
- ATF_REQUIRE(WSTOPSIG(status) == sigval);
+ printf("1: Verifying that he child has been stopped with the %s "
+ "signal (received %s)\n", sys_signame[sigval],
+ sys_signame[WSTOPSIG(status)]);
+ ATF_REQUIRE(WSTOPSIG(status) == sigval);
- printf("1: Before resuming the child process where it left "
- "off and with signal %s to be sent\n",
- sys_signame[sigsent]);
- ATF_REQUIRE(ptrace(PT_CONTINUE, child, (void *)1, sigsent)
- != -1);
+ printf("1: Before resuming the child process where it left off and "
+ "with signal %s to be sent\n", sys_signame[sigsent]);
+ ATF_REQUIRE(ptrace(PT_CONTINUE, child, (void *)1, sigsent) != -1);
- printf("1: Before calling waitpid() for the child\n");
- wpid = waitpid(child, &status, 0);
+ printf("1: Before calling waitpid() for the child\n");
+ wpid = waitpid(child, &status, 0);
- printf("1: Validating that child's PID is still there\n");
- ATF_REQUIRE(wpid == child);
+ printf("1: Validating that child's PID is still there\n");
+ ATF_REQUIRE(wpid == child);
- printf("1: Ensuring that the child has been exited\n");
- ATF_REQUIRE(WIFEXITED(status));
+ printf("1: Ensuring that the child has been exited\n");
+ ATF_REQUIRE(WIFEXITED(status));
- printf("1: Ensuring that the child has not been continued\n");
- ATF_REQUIRE(!WIFCONTINUED(status));
+ printf("1: Ensuring that the child has not been continued\n");
+ ATF_REQUIRE(!WIFCONTINUED(status));
- printf("1: Ensuring that the child has not been terminated "
- "with a signal\n");
- ATF_REQUIRE(!WIFSIGNALED(status));
+ printf("1: Ensuring that the child has not been terminated with a "
+ "signal\n");
+ ATF_REQUIRE(!WIFSIGNALED(status));
- printf("1: Ensuring that the child has not been stopped\n");
- ATF_REQUIRE(!WIFSTOPPED(status));
+ printf("1: Ensuring that the child has not been stopped\n");
+ ATF_REQUIRE(!WIFSTOPPED(status));
- printf("1: Verifying that he child has exited with the "
- "%d status (received %d)\n", exitval, WEXITSTATUS(status));
- ATF_REQUIRE(WEXITSTATUS(status) == exitval);
+ printf("1: Verifying that he child has exited with the %d status "
+ "(received %d)\n", exitval, WEXITSTATUS(status));
+ ATF_REQUIRE(WEXITSTATUS(status) == exitval);
- printf("1: Before calling waitpid() for the exited child\n");
- wpid = waitpid(child, &status, 0);
+ printf("1: Before calling waitpid() for the exited child\n");
+ wpid = waitpid(child, &status, 0);
- printf("1: Validating that child's PID no longer exists\n");
- ATF_REQUIRE(wpid == -1);
+ printf("1: Validating that child's PID no longer exists\n");
+ ATF_REQUIRE(wpid == -1);
- printf("1: Validating that errno is set to %s (got %s)\n",
- sys_errlist[ECHILD], sys_errlist[errno]);
- ATF_REQUIRE(errno == ECHILD);
- }
+ printf("1: Validating that errno is set to %s (got %s)\n",
+ strerror(ECHILD), strerror(errno));
+ ATF_REQUIRE(errno == ECHILD);
}
ATF_TC(traceme3);
@@ -295,8 +286,7 @@ ATF_TC_BODY(traceme3, tc)
/* "2: Before calling ptrace(PT_TRACE_ME, ...)\n" */
if (ptrace(PT_TRACE_ME, 0, NULL, 0) == -1) {
/* XXX: Is it safe to use ATF functions in a child? */
- err(EXIT_FAILURE, "2: ptrace(2) call failed with "
- "status %s", sys_errlist[errno]);
+ err(EXIT_FAILURE, "2: ptrace(2) call failed");
}
/* "2: Before raising SIGSTOP\n" */
@@ -305,80 +295,76 @@ ATF_TC_BODY(traceme3, tc)
/* NOTREACHED */
errx(EXIT_FAILURE, "2: Child should be terminated here by a "
"signal from parent");
- } else {
- printf("1: Parent process PID=%d, child's PID=%d\n", getpid(),
- child);
+ }
+ printf("1: Parent process PID=%d, child's PID=%d\n", getpid(), child);
- printf("1: Before calling waitpid() for the child\n");
- wpid = waitpid(child, &status, 0);
+ printf("1: Before calling waitpid() for the child\n");
+ wpid = waitpid(child, &status, 0);
- printf("1: Validating child's PID (expected %d, got %d)\n",
- child, wpid);
- ATF_REQUIRE(child == wpid);
+ printf("1: Validating child's PID (expected %d, got %d)\n", child,
+ wpid);
+ ATF_REQUIRE(child == wpid);
- printf("1: Ensuring that the child has not been exited\n");
- ATF_REQUIRE(!WIFEXITED(status));
+ printf("1: Ensuring that the child has not been exited\n");
+ ATF_REQUIRE(!WIFEXITED(status));
- printf("1: Ensuring that the child has not been continued\n");
- ATF_REQUIRE(!WIFCONTINUED(status));
+ printf("1: Ensuring that the child has not been continued\n");
+ ATF_REQUIRE(!WIFCONTINUED(status));
- printf("1: Ensuring that the child has not been terminated "
- "with a signal\n");
- ATF_REQUIRE(!WIFSIGNALED(status));
+ printf("1: Ensuring that the child has not been terminated with a "
+ "signal\n");
+ ATF_REQUIRE(!WIFSIGNALED(status));
- printf("1: Ensuring that the child has been stopped\n");
- ATF_REQUIRE(WIFSTOPPED(status));
+ printf("1: Ensuring that the child has been stopped\n");
+ ATF_REQUIRE(WIFSTOPPED(status));
- printf("1: Verifying that he child has been stopped with the"
- " %s signal (received %s)\n", sys_signame[sigval],
- sys_signame[WSTOPSIG(status)]);
- ATF_REQUIRE(WSTOPSIG(status) == sigval);
+ printf("1: Verifying that he child has been stopped with the %s "
+ "signal (received %s)\n", sys_signame[sigval],
+ sys_signame[WSTOPSIG(status)]);
+ ATF_REQUIRE(WSTOPSIG(status) == sigval);
- printf("1: Before resuming the child process where it left "
- "off and with signal %s to be sent\n",
- sys_signame[sigsent]);
- ATF_REQUIRE(ptrace(PT_CONTINUE, child, (void *)1, sigsent)
- != -1);
+ printf("1: Before resuming the child process where it left off and "
+ "with signal %s to be sent\n", sys_signame[sigsent]);
+ ATF_REQUIRE(ptrace(PT_CONTINUE, child, (void *)1, sigsent) != -1);
- printf("1: Before calling waitpid() for the child\n");
- wpid = waitpid(child, &status, 0);
+ printf("1: Before calling waitpid() for the child\n");
+ wpid = waitpid(child, &status, 0);
- printf("1: Validating that child's PID is still there\n");
- ATF_REQUIRE(wpid == child);
+ printf("1: Validating that child's PID is still there\n");
+ ATF_REQUIRE(wpid == child);
- printf("1: Ensuring that the child has not been exited\n");
- ATF_REQUIRE(!WIFEXITED(status));
+ printf("1: Ensuring that the child has not been exited\n");
+ ATF_REQUIRE(!WIFEXITED(status));
- printf("1: Ensuring that the child has not been continued\n");
- ATF_REQUIRE(!WIFCONTINUED(status));
+ printf("1: Ensuring that the child has not been continued\n");
+ ATF_REQUIRE(!WIFCONTINUED(status));
- printf("1: Ensuring that the child hast been terminated with "
- "a signal\n");
- ATF_REQUIRE(WIFSIGNALED(status));
+ printf("1: Ensuring that the child hast been terminated with a "
+ "signal\n");
+ ATF_REQUIRE(WIFSIGNALED(status));
- printf("1: Ensuring that the child has not been stopped\n");
- ATF_REQUIRE(!WIFSTOPPED(status));
+ printf("1: Ensuring that the child has not been stopped\n");
+ ATF_REQUIRE(!WIFSTOPPED(status));
- printf("1: Verifying that he child has not core dumped "
- "for the %s signal (it is the default behavior)\n",
- sys_signame[sigsent]);
- ATF_REQUIRE(!WCOREDUMP(status));
+ printf("1: Verifying that he child has not core dumped for the %s "
+ "signal (it is the default behavior)\n",
+ sys_signame[sigsent]);
+ ATF_REQUIRE(!WCOREDUMP(status));
- printf("1: Verifying that he child has been stopped with the"
- " %s signal (received %s)\n", sys_signame[sigsent],
- sys_signame[WTERMSIG(status)]);
- ATF_REQUIRE(WTERMSIG(status) == sigsent);
+ printf("1: Verifying that he child has been stopped with the %s "
+ "signal (received %s)\n", sys_signame[sigsent],
+ sys_signame[WTERMSIG(status)]);
+ ATF_REQUIRE(WTERMSIG(status) == sigsent);
- printf("1: Before calling waitpid() for the exited child\n");
- wpid = waitpid(child, &status, 0);
+ printf("1: Before calling waitpid() for the exited child\n");
+ wpid = waitpid(child, &status, 0);
- printf("1: Validating that child's PID no longer exists\n");
- ATF_REQUIRE(wpid == -1);
+ printf("1: Validating that child's PID no longer exists\n");
+ ATF_REQUIRE(wpid == -1);
- printf("1: Validating that errno is set to %s (got %s)\n",
- sys_errlist[ECHILD], sys_errlist[errno]);
- ATF_REQUIRE(errno == ECHILD);
- }
+ printf("1: Validating that errno is set to %s (got %s)\n",
+ strerror(ECHILD), strerror(errno));
+ ATF_REQUIRE(errno == ECHILD);
}
ATF_TC(traceme4);
@@ -410,8 +396,7 @@ ATF_TC_BODY(traceme4, tc)
/* "2: Before calling ptrace(PT_TRACE_ME, ...)\n" */
if (ptrace(PT_TRACE_ME, 0, NULL, 0) == -1) {
/* XXX: Is it safe to use ATF functions in a child? */
- err(EXIT_FAILURE, "2: ptrace(2) call failed with "
- "status %s", sys_errlist[errno]);
+ err(EXIT_FAILURE, "2: ptrace(2) call failed");
}
/* "2: Before raising SIGSTOP\n" */
@@ -422,96 +407,93 @@ ATF_TC_BODY(traceme4, tc)
/* "2: Before calling _exit(%d)\n", exitval */
_exit(exitval);
- } else {
- printf("1: Parent process PID=%d, child's PID=%d\n", getpid(),
- child);
+ }
+ printf("1: Parent process PID=%d, child's PID=%d\n", getpid(),child);
- printf("1: Before calling waitpid() for the child\n");
- wpid = waitpid(child, &status, 0);
+ printf("1: Before calling waitpid() for the child\n");
+ wpid = waitpid(child, &status, 0);
- printf("1: Validating child's PID (expected %d, got %d)\n",
- child, wpid);
- ATF_REQUIRE(child == wpid);
+ printf("1: Validating child's PID (expected %d, got %d)\n", child,
+ wpid);
+ ATF_REQUIRE(child == wpid);
- printf("1: Ensuring that the child has not been exited\n");
- ATF_REQUIRE(!WIFEXITED(status));
+ printf("1: Ensuring that the child has not been exited\n");
+ ATF_REQUIRE(!WIFEXITED(status));
- printf("1: Ensuring that the child has not been continued\n");
- ATF_REQUIRE(!WIFCONTINUED(status));
+ printf("1: Ensuring that the child has not been continued\n");
+ ATF_REQUIRE(!WIFCONTINUED(status));
- printf("1: Ensuring that the child has not been terminated "
- "with a signal\n");
- ATF_REQUIRE(!WIFSIGNALED(status));
+ printf("1: Ensuring that the child has not been terminated with a "
+ "signal\n");
+ ATF_REQUIRE(!WIFSIGNALED(status));
- printf("1: Ensuring that the child has been stopped\n");
- ATF_REQUIRE(WIFSTOPPED(status));
+ printf("1: Ensuring that the child has been stopped\n");
+ ATF_REQUIRE(WIFSTOPPED(status));
- printf("1: Verifying that he child has been stopped with the"
- " %s signal (received %s)\n", sys_signame[sigval],
- sys_signame[WSTOPSIG(status)]);
- ATF_REQUIRE(WSTOPSIG(status) == sigval);
+ printf("1: Verifying that he child has been stopped with the %s "
+ "signal (received %s)\n", sys_signame[sigval],
+ sys_signame[WSTOPSIG(status)]);
+ ATF_REQUIRE(WSTOPSIG(status) == sigval);
- printf("1: Before resuming the child process where it left "
- "off and without signal to be sent\n");
- ATF_REQUIRE(ptrace(PT_CONTINUE, child, (void *)1, 0)
- != -1);
+ printf("1: Before resuming the child process where it left off and "
+ "without signal to be sent\n");
+ ATF_REQUIRE(ptrace(PT_CONTINUE, child, (void *)1, 0) != -1);
- printf("1: Before calling waitpid() for the child\n");
- wpid = waitpid(child, &status, WALLSIG);
+ printf("1: Before calling waitpid() for the child\n");
+ wpid = waitpid(child, &status, WALLSIG);
- printf("1: Validating that child's PID is still there\n");
- ATF_REQUIRE(wpid == child);
+ printf("1: Validating that child's PID is still there\n");
+ ATF_REQUIRE(wpid == child);
- printf("1: Ensuring that the child has not been exited\n");
- ATF_REQUIRE(!WIFEXITED(status));
+ printf("1: Ensuring that the child has not been exited\n");
+ ATF_REQUIRE(!WIFEXITED(status));
- printf("1: Ensuring that the child has not been continued\n");
- ATF_REQUIRE(!WIFCONTINUED(status));
+ printf("1: Ensuring that the child has not been continued\n");
+ ATF_REQUIRE(!WIFCONTINUED(status));
- printf("1: Ensuring that the child has not been terminated "
- "with a signal\n");
- ATF_REQUIRE(!WIFSIGNALED(status));
+ printf("1: Ensuring that the child has not been terminated with a "
+ "signal\n");
+ ATF_REQUIRE(!WIFSIGNALED(status));
- printf("1: Ensuring that the child has not been stopped\n");
- ATF_REQUIRE(WIFSTOPPED(status));
+ printf("1: Ensuring that the child has not been stopped\n");
+ ATF_REQUIRE(WIFSTOPPED(status));
- printf("1: Before resuming the child process where it left "
- "off and without signal to be sent\n");
- ATF_REQUIRE(ptrace(PT_CONTINUE, child, (void *)1, 0) != -1);
+ printf("1: Before resuming the child process where it left off and "
+ "without signal to be sent\n");
+ ATF_REQUIRE(ptrace(PT_CONTINUE, child, (void *)1, 0) != -1);
- printf("1: Before calling waitpid() for the child\n");
- wpid = waitpid(child, &status, 0);
+ printf("1: Before calling waitpid() for the child\n");
+ wpid = waitpid(child, &status, 0);
- printf("1: Validating that child's PID is still there\n");
- ATF_REQUIRE(wpid == child);
+ printf("1: Validating that child's PID is still there\n");
+ ATF_REQUIRE(wpid == child);
- printf("1: Ensuring that the child has been exited\n");
- ATF_REQUIRE(WIFEXITED(status));
+ printf("1: Ensuring that the child has been exited\n");
+ ATF_REQUIRE(WIFEXITED(status));
- printf("1: Ensuring that the child has not been continued\n");
- ATF_REQUIRE(!WIFCONTINUED(status));
+ printf("1: Ensuring that the child has not been continued\n");
+ ATF_REQUIRE(!WIFCONTINUED(status));
- printf("1: Ensuring that the child has not been terminated "
- "with a signal\n");
- ATF_REQUIRE(!WIFSIGNALED(status));
+ printf("1: Ensuring that the child has not been terminated with a "
+ "signal\n");
+ ATF_REQUIRE(!WIFSIGNALED(status));
- printf("1: Ensuring that the child has not been stopped\n");
- ATF_REQUIRE(!WIFSTOPPED(status));
+ printf("1: Ensuring that the child has not been stopped\n");
+ ATF_REQUIRE(!WIFSTOPPED(status));
- printf("1: Verifying that he child has exited with the "
- "%d status (received %d)\n", exitval, WEXITSTATUS(status));
- ATF_REQUIRE(WEXITSTATUS(status) == exitval);
+ printf("1: Verifying that he child has exited with the %d status "
+ "(received %d)\n", exitval, WEXITSTATUS(status));
+ ATF_REQUIRE(WEXITSTATUS(status) == exitval);
- printf("1: Before calling waitpid() for the exited child\n");
- wpid = waitpid(child, &status, 0);
+ printf("1: Before calling waitpid() for the exited child\n");
+ wpid = waitpid(child, &status, 0);
- printf("1: Validating that child's PID no longer exists\n");
- ATF_REQUIRE(wpid == -1);
+ printf("1: Validating that child's PID no longer exists\n");
+ ATF_REQUIRE(wpid == -1);
- printf("1: Validating that errno is set to %s (got %s)\n",
- sys_errlist[ECHILD], sys_errlist[errno]);
- ATF_REQUIRE(errno == ECHILD);
- }
+ printf("1: Validating that errno is set to %s (got %s)\n",
+ strerror(ECHILD), strerror(errno));
+ ATF_REQUIRE(errno == ECHILD);
}
ATF_TP_ADD_TCS(tp)