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
198c9365
Commit
198c9365
authored
Oct 09, 2014
by
Pavel Emelyanov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
pstree: Add helper for adding helpers to pstree
Signed-off-by:
Pavel Emelyanov
<
xemul@parallels.com
>
parent
87d68fca
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
18 additions
and
11 deletions
+18
-11
files-reg.c
files-reg.c
+1
-3
pstree.h
include/pstree.h
+1
-0
pstree.c
pstree.c
+16
-8
No files found.
files-reg.c
View file @
198c9365
...
...
@@ -240,17 +240,15 @@ static int open_remap_dead_process(struct reg_file_info *rfi,
}
}
helper
=
alloc_pstree_
item_with_rst
();
helper
=
alloc_pstree_
helper
();
if
(
!
helper
)
return
-
1
;
helper
->
sid
=
root_item
->
sid
;
helper
->
pgid
=
root_item
->
pgid
;
helper
->
pid
.
virt
=
rfe
->
remap_id
;
helper
->
state
=
TASK_HELPER
;
helper
->
parent
=
root_item
;
list_add_tail
(
&
helper
->
sibling
,
&
root_item
->
children
);
task_entries
->
nr_helpers
++
;
pr_info
(
"Added a helper for restoring /proc/%d
\n
"
,
helper
->
pid
.
virt
);
...
...
include/pstree.h
View file @
198c9365
...
...
@@ -62,6 +62,7 @@ extern void free_pstree(struct pstree_item *root_item);
extern
struct
pstree_item
*
__alloc_pstree_item
(
bool
rst
);
#define alloc_pstree_item() __alloc_pstree_item(false)
#define alloc_pstree_item_with_rst() __alloc_pstree_item(true)
extern
struct
pstree_item
*
alloc_pstree_helper
(
void
);
extern
struct
pstree_item
*
root_item
;
extern
struct
pstree_item
*
pstree_item_next
(
struct
pstree_item
*
item
);
...
...
pstree.c
View file @
198c9365
...
...
@@ -189,6 +189,20 @@ struct pstree_item *__alloc_pstree_item(bool rst)
return
item
;
}
struct
pstree_item
*
alloc_pstree_helper
(
void
)
{
struct
pstree_item
*
ret
;
ret
=
alloc_pstree_item_with_rst
();
if
(
ret
)
{
ret
->
state
=
TASK_HELPER
;
rsti
(
ret
)
->
clone_flags
=
CLONE_FILES
|
CLONE_FS
;
task_entries
->
nr_helpers
++
;
}
return
ret
;
}
/* Deep first search on children */
struct
pstree_item
*
pstree_item_next
(
struct
pstree_item
*
item
)
{
...
...
@@ -457,17 +471,14 @@ static int prepare_pstree_ids(void)
if
(
item
->
sid
==
root_item
->
sid
||
item
->
sid
==
item
->
pid
.
virt
)
continue
;
helper
=
alloc_pstree_
item_with_rst
();
helper
=
alloc_pstree_
helper
();
if
(
helper
==
NULL
)
return
-
1
;
helper
->
sid
=
item
->
sid
;
helper
->
pgid
=
item
->
sid
;
helper
->
pid
.
virt
=
item
->
sid
;
helper
->
state
=
TASK_HELPER
;
helper
->
parent
=
root_item
;
rsti
(
helper
)
->
clone_flags
=
CLONE_FILES
|
CLONE_FS
;
list_add_tail
(
&
helper
->
sibling
,
&
helpers
);
task_entries
->
nr_helpers
++
;
pr_info
(
"Add a helper %d for restoring SID %d
\n
"
,
helper
->
pid
.
virt
,
helper
->
sid
);
...
...
@@ -578,17 +589,14 @@ static int prepare_pstree_ids(void)
if
(
current_pgid
==
item
->
pgid
)
continue
;
helper
=
alloc_pstree_
item_with_rst
();
helper
=
alloc_pstree_
helper
();
if
(
helper
==
NULL
)
return
-
1
;
helper
->
sid
=
item
->
sid
;
helper
->
pgid
=
item
->
pgid
;
helper
->
pid
.
virt
=
item
->
pgid
;
helper
->
state
=
TASK_HELPER
;
helper
->
parent
=
item
;
rsti
(
helper
)
->
clone_flags
=
CLONE_FILES
|
CLONE_FS
;
list_add
(
&
helper
->
sibling
,
&
item
->
children
);
task_entries
->
nr_helpers
++
;
rsti
(
item
)
->
pgrp_leader
=
helper
;
pr_info
(
"Add a helper %d for restoring PGID %d
\n
"
,
...
...
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