SIGCONT: don't terminate process

Change-Id: Ib959a9e5341fda37bd055724ecb9319a469b7420
Refs: #1410
This commit is contained in:
Tomoki Shirasawa
2019-11-14 11:35:01 +09:00
committed by Masamichi Takagi
parent adb6cce3ce
commit 4b252a990f
11 changed files with 1939 additions and 5 deletions

View File

@ -0,0 +1,64 @@
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <signal.h>
#include <sys/wait.h>
void
cont(int s)
{
printf("SIGCONT\n");
exit(1);
}
void
child()
{
int mask;
mask = sigmask(SIGCONT);
sigprocmask(SIG_BLOCK, (sigset_t *)&mask, NULL);
signal(SIGCONT, cont);
for (;;) {
printf(".\n");
sleep(1);
}
}
int
main(int argc, char **argv)
{
pid_t pid = fork();
int st;
if (!pid)
child();
printf("*** C1420T01: START\n");
sleep(3);
printf("send SIGSTOP\n");
kill(pid, SIGSTOP);
sleep(3);
printf("send SIGCONT\n");
kill(pid, SIGCONT);
sleep(3);
printf("send SIGINT\n");
kill(pid, SIGINT);
waitpid(pid, &st, 0);
printf("*** C1420T01 ");
if (WIFEXITED(st)) {
printf("FAIL: child exited st=%d\n", WEXITSTATUS(st));
}
else if (WIFSIGNALED(st)) {
if (WTERMSIG(st) == SIGINT) {
printf("PASS");
}
else {
printf("FAIL");
}
printf(": child terminated by signal %d\n", WTERMSIG(st));
}
else {
printf("FAIL: child status=%08x\n", st);
}
exit(0);
}