2
0
mirror of https://github.com/checkpoint-restore/criu synced 2025-08-29 13:28:27 +00:00

zdtm/test: add infop to waitid()

The man page says, it's not optional argument:
  The application shall ensure that the infop argument
  points to a siginfo_t structure.

Fixes:
Test output: ================================
17:40:26.128:     5: FAIL: helper_zombie_child.c:33: waitid (errno = 14 (Bad address))
17:40:26.128:     4: FAIL: helper_zombie_child.c:78: read (errno = 2 (No such file or directory))
17:40:26.129:     3: ERR: test.c:229: Test exited unexpectedly with code 1

Test output: ================================
15:30:49.021:    30: ERR: sigpending.c:213: waitid (errno = 14 (Bad address))
15:30:49.021:    29: ERR: test.c:229: Test exited unexpectedly with code 1

and etc.

travis-ci: success for 32-bit tests fixes
Signed-off-by: Dmitry Safonov <dsafonov@virtuozzo.com>
Acked-by: Tycho Andersen <tycho.andersen@canonical.com>
Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
This commit is contained in:
Dmitry Safonov 2017-01-09 20:19:10 +03:00 committed by Pavel Emelyanov
parent ae48b5d676
commit 8cae4bdcfa
3 changed files with 6 additions and 3 deletions

View File

@ -16,6 +16,7 @@ const char *test_author = "Tycho Andersen <tycho.andersen@canonical.com>";
void setsid_and_fork(int sk) void setsid_and_fork(int sk)
{ {
siginfo_t infop;
pid_t zombie; pid_t zombie;
setsid(); setsid();
@ -29,7 +30,7 @@ void setsid_and_fork(int sk)
if (zombie == 0) if (zombie == 0)
exit(0); exit(0);
if (waitid(P_PID, zombie, NULL, WNOWAIT | WEXITED) < 0) { if (waitid(P_PID, zombie, &infop, WNOWAIT | WEXITED) < 0) {
fail("waitid"); fail("waitid");
exit(1); exit(1);
} }

View File

@ -170,6 +170,7 @@ int main(int argc, char ** argv)
sigset_t blockmask, oldset, newset; sigset_t blockmask, oldset, newset;
struct sigaction act; struct sigaction act;
pthread_t pthrd; pthread_t pthrd;
siginfo_t infop;
int i; int i;
memset(&oldset, 0, sizeof(oldset)); memset(&oldset, 0, sizeof(oldset));
@ -209,7 +210,7 @@ int main(int argc, char ** argv)
if(child == 0) if(child == 0)
return 5; /* SIGCHLD */ return 5; /* SIGCHLD */
if (waitid(P_PID, child, NULL, WNOWAIT | WEXITED)) { if (waitid(P_PID, child, &infop, WNOWAIT | WEXITED)) {
pr_perror("waitid"); pr_perror("waitid");
return 1; return 1;
} }

View File

@ -13,6 +13,7 @@ const char *test_author = "Andrew Vagin <avagin@parallels.com>";
int main(int argc, char **argv) int main(int argc, char **argv)
{ {
pid_t pid; pid_t pid;
siginfo_t infop;
int p[2], ret, status; int p[2], ret, status;
test_init(argc, argv); test_init(argc, argv);
@ -40,7 +41,7 @@ int main(int argc, char **argv)
close(p[0]); close(p[0]);
kill(pid, SIGSTOP); kill(pid, SIGSTOP);
if (waitid(P_PID, pid, NULL, WNOWAIT | WSTOPPED) < 0) { if (waitid(P_PID, pid, &infop, WNOWAIT | WSTOPPED) < 0) {
pr_perror("waitid"); pr_perror("waitid");
return 1; return 1;
} }