Commit 8cae4bdc authored by Dmitry Safonov's avatar Dmitry Safonov Committed by Pavel Emelyanov

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: 's avatarDmitry Safonov <dsafonov@virtuozzo.com>
Acked-by: 's avatarTycho Andersen <tycho.andersen@canonical.com>
Signed-off-by: 's avatarPavel Emelyanov <xemul@virtuozzo.com>
parent ae48b5d6
...@@ -16,6 +16,7 @@ const char *test_author = "Tycho Andersen <tycho.andersen@canonical.com>"; ...@@ -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) ...@@ -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);
} }
......
...@@ -170,6 +170,7 @@ int main(int argc, char ** argv) ...@@ -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) ...@@ -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;
} }
......
...@@ -13,6 +13,7 @@ const char *test_author = "Andrew Vagin <avagin@parallels.com>"; ...@@ -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) ...@@ -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;
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment