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
62838976
Commit
62838976
authored
May 23, 2016
by
Pavel Emelyanov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
restore: Factor out thread core opening
Signed-off-by:
Pavel Emelyanov
<
xemul@virtuozzo.com
>
parent
5c06eea2
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
20 additions
and
26 deletions
+20
-26
cr-restore.c
criu/cr-restore.c
+20
-26
No files found.
criu/cr-restore.c
View file @
62838976
...
@@ -399,6 +399,23 @@ static int collect_zombie_pids()
...
@@ -399,6 +399,23 @@ static int collect_zombie_pids()
return
collect_child_pids
(
TASK_DEAD
,
&
n_zombies
);
return
collect_child_pids
(
TASK_DEAD
,
&
n_zombies
);
}
}
static
int
open_core
(
int
pid
,
CoreEntry
**
pcore
)
{
int
ret
;
struct
cr_img
*
img
;
img
=
open_image
(
CR_FD_CORE
,
O_RSTR
,
pid
);
if
(
!
img
)
{
pr_err
(
"Can't open core data for %d"
,
pid
);
return
-
1
;
}
ret
=
pb_read_one
(
img
,
pcore
,
PB_CORE
);
close_image
(
img
);
return
ret
<=
0
?
-
1
:
0
;
}
static
int
open_cores
(
int
pid
,
CoreEntry
*
leader_core
)
static
int
open_cores
(
int
pid
,
CoreEntry
*
leader_core
)
{
{
int
i
,
tpid
;
int
i
,
tpid
;
...
@@ -413,22 +430,8 @@ static int open_cores(int pid, CoreEntry *leader_core)
...
@@ -413,22 +430,8 @@ static int open_cores(int pid, CoreEntry *leader_core)
if
(
tpid
==
pid
)
if
(
tpid
==
pid
)
cores
[
i
]
=
leader_core
;
cores
[
i
]
=
leader_core
;
else
{
else
if
(
open_core
(
tpid
,
&
cores
[
i
]))
struct
cr_img
*
img
;
goto
err
;
img
=
open_image
(
CR_FD_CORE
,
O_RSTR
,
tpid
);
if
(
!
img
)
{
pr_err
(
"Can't open core data for thread %d
\n
"
,
tpid
);
goto
err
;
}
if
(
pb_read_one
(
img
,
&
cores
[
i
],
PB_CORE
)
<=
0
)
{
close_image
(
img
);
goto
err
;
}
close_image
(
img
);
}
}
}
current
->
core
=
cores
;
current
->
core
=
cores
;
...
@@ -776,16 +779,7 @@ static inline int fork_with_pid(struct pstree_item *item)
...
@@ -776,16 +779,7 @@ static inline int fork_with_pid(struct pstree_item *item)
pid_t
pid
=
item
->
pid
.
virt
;
pid_t
pid
=
item
->
pid
.
virt
;
if
(
item
->
pid
.
state
!=
TASK_HELPER
)
{
if
(
item
->
pid
.
state
!=
TASK_HELPER
)
{
struct
cr_img
*
img
;
if
(
open_core
(
pid
,
&
ca
.
core
))
img
=
open_image
(
CR_FD_CORE
,
O_RSTR
,
pid
);
if
(
!
img
)
return
-
1
;
ret
=
pb_read_one
(
img
,
&
ca
.
core
,
PB_CORE
);
close_image
(
img
);
if
(
ret
<
0
)
return
-
1
;
return
-
1
;
if
(
check_core
(
ca
.
core
,
item
))
if
(
check_core
(
ca
.
core
,
item
))
...
...
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