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
0133a23a
Commit
0133a23a
authored
Oct 25, 2011
by
Cyrill Gorcunov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
restore: Add opening core file
Signed-off-by:
Cyrill Gorcunov
<
gorcunov@gmail.com
>
parent
f8c46a5d
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
37 additions
and
4 deletions
+37
-4
cr-restore.c
cr-restore.c
+9
-4
restorer.c
restorer.c
+28
-0
No files found.
cr-restore.c
View file @
0133a23a
...
...
@@ -1218,11 +1218,13 @@ static int restore_all_tasks(pid_t pid)
return
restore_root_task
(
path
,
pstree_fd
);
}
static
void
restorer_test
(
vo
id
)
static
void
restorer_test
(
pid_t
p
id
)
{
restorer_fcall_t
restorer_fcall
;
char
path
[
64
];
void
*
args_rip
;
void
*
exec_mem
;
long
ret
;
exec_mem
=
mmap
(
0
,
RESTORER_SIZE
,
PROT_READ
|
PROT_WRITE
|
PROT_EXEC
,
MAP_PRIVATE
|
MAP_ANON
,
0
,
0
);
if
(
exec_mem
==
MAP_FAILED
)
{
...
...
@@ -1236,8 +1238,11 @@ static void restorer_test(void)
args_rip
=
(
void
*
)
restorer_fcall
(
RESTORER_CMD__GET_ARG_OFFSET
);
strcpy
(
args_rip
,
"Hello from restorer!
\n
"
);
restorer_fcall
(
RESTORER_CMD__PR_ARG_STRING
);
snprintf
(
path
,
sizeof
(
path
),
"core-%d.img"
,
pid
);
strcpy
(
args_rip
,
path
);
ret
=
restorer_fcall
(
RESTORER_CMD__RESTORE_CORE
);
pr_info
(
"RESTORER_CMD__RESTORE_CORE: %lx
\n
"
,
ret
);
exit
(
0
);
...
...
@@ -1245,7 +1250,7 @@ static void restorer_test(void)
int
cr_restore_tasks
(
pid_t
pid
,
struct
cr_options
*
opts
)
{
restorer_test
();
restorer_test
(
pid
);
if
(
opts
->
leader_only
)
return
restore_one_task
(
pid
);
...
...
restorer.c
View file @
0133a23a
...
...
@@ -13,8 +13,12 @@
#include "util.h"
#include "image.h"
#include "crtools.h"
#include "restorer.h"
#define get_rt_sigframe_addr(stack) \
(struct rt_sigframe *)(stack - sizeof(long))
#define lea_args_off(p) \
do { \
asm volatile( \
...
...
@@ -25,6 +29,16 @@
: "memory"); \
} while (0)
static
void
always_inline
write_string
(
char
*
str
)
{
int
len
=
0
;
while
(
str
[
len
])
len
++
;
sys_write
(
1
,
str
,
len
);
}
long
restorer
(
long
cmd
)
{
long
ret
;
...
...
@@ -64,6 +78,20 @@ long restorer(long cmd)
*/
case
RESTORER_CMD__RESTORE_CORE
:
{
char
*
core_path
;
int
fd_core
;
struct
core_entry
core_entry
;
struct
rt_sigframe
*
frame
;
lea_args_off
(
core_path
);
write_string
(
core_path
);
write_string
(
"
\n
"
);
fd_core
=
sys_open
(
core_path
,
O_RDONLY
,
CR_FD_PERM
);
return
fd_core
;
/*
* Unmap all but self, note that we reply on
* caller that it has placed this execution
...
...
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