Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
C
criu
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
zhul
criu
Commits
8c133309
Commit
8c133309
authored
Aug 06, 2014
by
Pavel Emelyanov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
sig: Setup CHLD handler in dedicated helper
Signed-off-by:
Pavel Emelyanov
<
xemul@parallels.com
>
parent
e50d0e7c
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
40 additions
and
30 deletions
+40
-30
cr-restore.c
cr-restore.c
+40
-30
No files found.
cr-restore.c
View file @
8c133309
...
...
@@ -1068,6 +1068,43 @@ err:
futex_abort_and_wake
(
&
task_entries
->
nr_in_progress
);
}
static
int
criu_signals_setup
(
void
)
{
int
ret
;
struct
sigaction
act
;
ret
=
sigaction
(
SIGCHLD
,
NULL
,
&
act
);
if
(
ret
<
0
)
{
pr_perror
(
"sigaction() failed"
);
return
-
1
;
}
act
.
sa_flags
|=
SA_NOCLDSTOP
|
SA_SIGINFO
|
SA_RESTART
;
if
(
opts
.
swrk_restore
)
/*
* Root task will be our sibling. This means, that
* we will not notice when (if) it dies in SIGCHLD
* handler, but we should. To do this -- attach to
* the guy with ptrace (below) and (!) make the kernel
* deliver us the signal when it will get stopped.
* It will in case of e.g. segfault before handling
* the signal.
*/
act
.
sa_flags
&=
~
SA_NOCLDSTOP
;
act
.
sa_sigaction
=
sigchld_handler
;
sigemptyset
(
&
act
.
sa_mask
);
sigaddset
(
&
act
.
sa_mask
,
SIGCHLD
);
ret
=
sigaction
(
SIGCHLD
,
&
act
,
NULL
);
if
(
ret
<
0
)
{
pr_perror
(
"sigaction() failed"
);
return
-
1
;
}
return
0
;
}
static
void
restore_sid
(
void
)
{
pid_t
sid
;
...
...
@@ -1491,7 +1528,6 @@ static void ignore_kids(void)
static
int
restore_root_task
(
struct
pstree_item
*
init
)
{
int
ret
,
fd
;
struct
sigaction
act
;
fd
=
open
(
"/proc"
,
O_DIRECTORY
|
O_RDONLY
);
if
(
fd
<
0
)
{
...
...
@@ -1504,35 +1540,6 @@ static int restore_root_task(struct pstree_item *init)
if
(
ret
<
0
)
return
-
1
;
ret
=
sigaction
(
SIGCHLD
,
NULL
,
&
act
);
if
(
ret
<
0
)
{
pr_perror
(
"sigaction() failed"
);
return
-
1
;
}
act
.
sa_flags
|=
SA_NOCLDSTOP
|
SA_SIGINFO
|
SA_RESTART
;
if
(
opts
.
swrk_restore
)
/*
* Root task will be our sibling. This means, that
* we will not notice when (if) it dies in SIGCHLD
* handler, but we should. To do this -- attach to
* the guy with ptrace (below) and (!) make the kernel
* deliver us the signal when it will get stopped.
* It will in case of e.g. segfault before handling
* the signal.
*/
act
.
sa_flags
&=
~
SA_NOCLDSTOP
;
act
.
sa_sigaction
=
sigchld_handler
;
sigemptyset
(
&
act
.
sa_mask
);
sigaddset
(
&
act
.
sa_mask
,
SIGCHLD
);
ret
=
sigaction
(
SIGCHLD
,
&
act
,
NULL
);
if
(
ret
<
0
)
{
pr_perror
(
"sigaction() failed"
);
return
-
1
;
}
/*
* FIXME -- currently we assume that all the tasks live
* in the same set of namespaces. This is done to debug
...
...
@@ -1721,6 +1728,9 @@ int cr_restore_tasks(void)
if
(
crtools_prepare_shared
()
<
0
)
goto
err
;
if
(
criu_signals_setup
()
<
0
)
goto
err
;
ret
=
restore_root_task
(
root_item
);
fini_cgroup
();
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment