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
ede980c0
Commit
ede980c0
authored
Aug 11, 2013
by
Pavel Emelyanov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
restore: Move kids (and session) restore into a helper
Signed-off-by:
Pavel Emelyanov
<
xemul@parallels.com
>
parent
26aa61a3
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
40 additions
and
23 deletions
+40
-23
cr-restore.c
cr-restore.c
+40
-23
No files found.
cr-restore.c
View file @
ede980c0
...
@@ -1078,10 +1078,47 @@ static int mount_proc(void)
...
@@ -1078,10 +1078,47 @@ static int mount_proc(void)
return
ret
;
return
ret
;
}
}
/*
* Tasks cannot change sid (session id) arbitrary, but can either
* inherit one from ancestor, or create a new one with id equal to
* their pid. Thus sid-s restore is tied with children creation.
*/
static
int
create_children_and_session
(
void
)
{
int
ret
;
struct
pstree_item
*
child
;
pr_info
(
"Restoring children in alien sessions:
\n
"
);
list_for_each_entry
(
child
,
&
current
->
children
,
sibling
)
{
if
(
!
restore_before_setsid
(
child
))
continue
;
BUG_ON
(
child
->
born_sid
!=
-
1
&&
getsid
(
getpid
())
!=
child
->
born_sid
);
ret
=
fork_with_pid
(
child
);
if
(
ret
<
0
)
return
ret
;
}
restore_sid
();
pr_info
(
"Restoring children in our session:
\n
"
);
list_for_each_entry
(
child
,
&
current
->
children
,
sibling
)
{
if
(
restore_before_setsid
(
child
))
continue
;
ret
=
fork_with_pid
(
child
);
if
(
ret
<
0
)
return
ret
;
}
return
0
;
}
static
int
restore_task_with_children
(
void
*
_arg
)
static
int
restore_task_with_children
(
void
*
_arg
)
{
{
struct
cr_clone_arg
*
ca
=
_arg
;
struct
cr_clone_arg
*
ca
=
_arg
;
struct
pstree_item
*
child
;
pid_t
pid
;
pid_t
pid
;
int
ret
;
int
ret
;
sigset_t
blockmask
;
sigset_t
blockmask
;
...
@@ -1151,28 +1188,8 @@ static int restore_task_with_children(void *_arg)
...
@@ -1151,28 +1188,8 @@ static int restore_task_with_children(void *_arg)
exit
(
1
);
exit
(
1
);
}
}
pr_info
(
"Restoring children:
\n
"
);
if
(
create_children_and_session
())
list_for_each_entry
(
child
,
&
current
->
children
,
sibling
)
{
exit
(
1
);
if
(
!
restore_before_setsid
(
child
))
continue
;
BUG_ON
(
child
->
born_sid
!=
-
1
&&
getsid
(
getpid
())
!=
child
->
born_sid
);
ret
=
fork_with_pid
(
child
);
if
(
ret
<
0
)
exit
(
1
);
}
restore_sid
();
pr_info
(
"Restoring children:
\n
"
);
list_for_each_entry
(
child
,
&
current
->
children
,
sibling
)
{
if
(
restore_before_setsid
(
child
))
continue
;
ret
=
fork_with_pid
(
child
);
if
(
ret
<
0
)
exit
(
1
);
}
if
(
current
->
pgid
==
current
->
pid
.
virt
)
if
(
current
->
pgid
==
current
->
pid
.
virt
)
restore_pgid
();
restore_pgid
();
...
...
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