Changeset View
Changeset View
Standalone View
Standalone View
tests/sys/kern/ptrace_test.c
Show First 20 Lines • Show All 3,959 Lines • ▼ Show 20 Lines | ATF_TC_BODY(ptrace__syscall_args, tc) | ||||
pid_t fpid, wpid; | pid_t fpid, wpid; | ||||
register_t args[2]; | register_t args[2]; | ||||
int events, status; | int events, status; | ||||
ATF_REQUIRE((fpid = fork()) != -1); | ATF_REQUIRE((fpid = fork()) != -1); | ||||
if (fpid == 0) { | if (fpid == 0) { | ||||
trace_me(); | trace_me(); | ||||
kill(getpid(), 0); | kill(getpid(), 0); | ||||
close(3); | close(12345); /* Any fd number that should not exist */ | ||||
jhb: The rest of this file doesn't use comments on the side. I'd probably just drop it, or move it… | |||||
emasteUnsubmitted Done Inline ActionsI would keep the comment, this seems surprising otherwise. It could go on the line above if desired for consistency. emaste: I would keep the comment, this seems surprising otherwise. It could go on the line above if… | |||||
exit(1); | exit(1); | ||||
} | } | ||||
/* The first wait() should report the stop from SIGSTOP. */ | /* The first wait() should report the stop from SIGSTOP. */ | ||||
wpid = waitpid(fpid, &status, 0); | wpid = waitpid(fpid, &status, 0); | ||||
REQUIRE_EQ_INT(wpid, fpid); | REQUIRE_EQ_INT(wpid, fpid); | ||||
ATF_REQUIRE(WIFSTOPPED(status)); | ATF_REQUIRE(WIFSTOPPED(status)); | ||||
REQUIRE_EQ_INT(WSTOPSIG(status), SIGSTOP); | REQUIRE_EQ_INT(WSTOPSIG(status), SIGSTOP); | ||||
▲ Show 20 Lines • Show All 85 Lines • ▼ Show 20 Lines | ATF_TC_BODY(ptrace__syscall_args, tc) | ||||
ATF_REQUIRE(ptrace(PT_LWPINFO, wpid, (caddr_t)&pl, sizeof(pl)) != -1); | ATF_REQUIRE(ptrace(PT_LWPINFO, wpid, (caddr_t)&pl, sizeof(pl)) != -1); | ||||
ATF_REQUIRE(pl.pl_flags & PL_FLAG_SCE); | ATF_REQUIRE(pl.pl_flags & PL_FLAG_SCE); | ||||
REQUIRE_EQ_INT(pl.pl_syscall_code, SYS_close); | REQUIRE_EQ_INT(pl.pl_syscall_code, SYS_close); | ||||
REQUIRE_EQ_INT(pl.pl_syscall_narg, 1); | REQUIRE_EQ_INT(pl.pl_syscall_narg, 1); | ||||
ATF_REQUIRE(ptrace(PT_GET_SC_ARGS, wpid, (caddr_t)args, | ATF_REQUIRE(ptrace(PT_GET_SC_ARGS, wpid, (caddr_t)args, | ||||
sizeof(args)) != -1); | sizeof(args)) != -1); | ||||
REQUIRE_EQ_INT(args[0], 3); | REQUIRE_EQ_INT(args[0], 12345); | ||||
lwhsuUnsubmitted Not Done Inline ActionsShould we put the same comment as the above? lwhsu: Should we put the same comment as the above? | |||||
REQUIRE_EQ_INT(ptrace(PT_CONTINUE, fpid, (caddr_t)1, 0), 0); | REQUIRE_EQ_INT(ptrace(PT_CONTINUE, fpid, (caddr_t)1, 0), 0); | ||||
/* | /* | ||||
* The next stop should be the syscall exit from close(). | * The next stop should be the syscall exit from close(). | ||||
*/ | */ | ||||
wpid = waitpid(fpid, &status, 0); | wpid = waitpid(fpid, &status, 0); | ||||
REQUIRE_EQ_INT(wpid, fpid); | REQUIRE_EQ_INT(wpid, fpid); | ||||
▲ Show 20 Lines • Show All 250 Lines • Show Last 20 Lines |
The rest of this file doesn't use comments on the side. I'd probably just drop it, or move it up as a single line comment above with the blank line before.