mirror of
https://github.com/checkpoint-restore/criu.git
synced 2026-07-24 02:29:23 +00:00
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>
87 lines
1.5 KiB
C
87 lines
1.5 KiB
C
#include <errno.h>
|
|
#include <unistd.h>
|
|
#include <signal.h>
|
|
#include <unistd.h>
|
|
#include <syscall.h>
|
|
#include <sys/wait.h>
|
|
|
|
#include "zdtmtst.h"
|
|
|
|
const char *test_doc = "Check, that stopped tasts are restored correctly";
|
|
const char *test_author = "Andrew Vagin <avagin@parallels.com>";
|
|
|
|
int main(int argc, char **argv)
|
|
{
|
|
pid_t pid;
|
|
siginfo_t infop;
|
|
int p[2], ret, status;
|
|
|
|
test_init(argc, argv);
|
|
|
|
if (pipe(p)) {
|
|
pr_perror("Unable to create pipe");
|
|
return 1;
|
|
}
|
|
|
|
pid = test_fork();
|
|
if (pid < 0)
|
|
return -1;
|
|
else if (pid == 0) {
|
|
char c;
|
|
|
|
close(p[1]);
|
|
ret = read(p[0], &c, 1);
|
|
if (ret != 1) {
|
|
pr_perror("Unable to read: %d", ret);
|
|
return 1;
|
|
}
|
|
|
|
return 0;
|
|
}
|
|
close(p[0]);
|
|
|
|
kill(pid, SIGSTOP);
|
|
if (waitid(P_PID, pid, &infop, WNOWAIT | WSTOPPED) < 0) {
|
|
pr_perror("waitid");
|
|
return 1;
|
|
}
|
|
#ifdef ZDTM_STOPPED_TKILL
|
|
syscall(__NR_tkill, pid, SIGSTOP);
|
|
#endif
|
|
#ifdef ZDTM_STOPPED_KILL
|
|
kill(pid, SIGSTOP);
|
|
#endif
|
|
|
|
write(p[1], "0", 1);
|
|
close(p[1]);
|
|
|
|
test_daemon();
|
|
test_waitsig();
|
|
|
|
// Return immediately if child run or stopped(by SIGSTOP)
|
|
if (waitpid(pid, &status, WUNTRACED | WCONTINUED) == -1) {
|
|
pr_perror("Unable to wait child");
|
|
goto out;
|
|
}
|
|
|
|
if (WIFSTOPPED(status))
|
|
test_msg("The procces stopped\n");
|
|
else{
|
|
fail("The process doesn't stopped");
|
|
goto out;
|
|
}
|
|
|
|
kill(pid, SIGCONT);
|
|
|
|
if (waitpid(pid, &status, 0) == -1) {
|
|
pr_perror("Unable to wait child");
|
|
goto out;
|
|
}
|
|
|
|
if (WIFEXITED(status))
|
|
pass();
|
|
else
|
|
fail("The process doesn't continue");
|
|
out:
|
|
return 0;
|
|
}
|