2
0
mirror of https://github.com/checkpoint-restore/criu synced 2025-08-30 13:58:34 +00:00

socket_listen: interrupt a parent if a child exited

When a child exited, SIGCHLD is sent to parent,
if SIGCHLD has handler without SA_RESTART, the current
syscall will be interrupted.

Signed-off-by: Andrey Vagin <avagin@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
This commit is contained in:
Andrey Vagin
2012-08-06 18:30:45 +04:00
committed by Pavel Emelyanov
parent c60661051d
commit a5dff04d6a

View File

@@ -28,6 +28,8 @@ int init_server();
#define BUF_SIZE 1024
static void sig_hand(int signo) {}
int main(int argc, char **argv)
{
unsigned char buf[BUF_SIZE];
@@ -36,6 +38,10 @@ int main(int argc, char **argv)
pid_t pid;
int res;
uint32_t crc;
struct sigaction sa = {
.sa_handler = sig_hand,
/* don't set SA_RESTART */
};
test_init(argc, argv);
@@ -47,6 +53,10 @@ int main(int argc, char **argv)
test_daemon();
test_waitsig();
sigemptyset(&sa.sa_mask);
if (sigaction(SIGCHLD, &sa, NULL))
fprintf(stderr, "Can't set SIGTERM handler: %m\n");
pid = test_fork();
if (pid < 0) {
err("fork failed. Return %d %m", pid);