mirror of
https://github.com/checkpoint-restore/criu
synced 2025-09-01 14:55:39 +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:
committed by
Pavel Emelyanov
parent
c60661051d
commit
a5dff04d6a
@@ -28,6 +28,8 @@ int init_server();
|
|||||||
|
|
||||||
#define BUF_SIZE 1024
|
#define BUF_SIZE 1024
|
||||||
|
|
||||||
|
static void sig_hand(int signo) {}
|
||||||
|
|
||||||
int main(int argc, char **argv)
|
int main(int argc, char **argv)
|
||||||
{
|
{
|
||||||
unsigned char buf[BUF_SIZE];
|
unsigned char buf[BUF_SIZE];
|
||||||
@@ -36,6 +38,10 @@ int main(int argc, char **argv)
|
|||||||
pid_t pid;
|
pid_t pid;
|
||||||
int res;
|
int res;
|
||||||
uint32_t crc;
|
uint32_t crc;
|
||||||
|
struct sigaction sa = {
|
||||||
|
.sa_handler = sig_hand,
|
||||||
|
/* don't set SA_RESTART */
|
||||||
|
};
|
||||||
|
|
||||||
test_init(argc, argv);
|
test_init(argc, argv);
|
||||||
|
|
||||||
@@ -47,6 +53,10 @@ int main(int argc, char **argv)
|
|||||||
test_daemon();
|
test_daemon();
|
||||||
test_waitsig();
|
test_waitsig();
|
||||||
|
|
||||||
|
sigemptyset(&sa.sa_mask);
|
||||||
|
if (sigaction(SIGCHLD, &sa, NULL))
|
||||||
|
fprintf(stderr, "Can't set SIGTERM handler: %m\n");
|
||||||
|
|
||||||
pid = test_fork();
|
pid = test_fork();
|
||||||
if (pid < 0) {
|
if (pid < 0) {
|
||||||
err("fork failed. Return %d %m", pid);
|
err("fork failed. Return %d %m", pid);
|
||||||
|
Reference in New Issue
Block a user