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
4171d5bf
Commit
4171d5bf
authored
Jul 05, 2013
by
Pavel Emelyanov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
posix-timers: Switch to use rst memory allocator
Signed-off-by:
Pavel Emelyanov
<
xemul@parallels.com
>
parent
df51773b
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
17 additions
and
46 deletions
+17
-46
cr-restore.c
cr-restore.c
+17
-42
restorer.h
include/restorer.h
+0
-1
restorer.c
pie/restorer.c
+0
-3
No files found.
cr-restore.c
View file @
4171d5bf
...
...
@@ -1641,12 +1641,13 @@ static int cmp_posix_timer_proc_id(const void *p1, const void *p2)
return
((
struct
restore_posix_timer
*
)
p1
)
->
spt
.
it_id
-
((
struct
restore_posix_timer
*
)
p2
)
->
spt
.
it_id
;
}
static
int
open_posix_timers_image
(
int
pid
,
struct
restore_posix_timer
**
rpt
,
unsigned
long
*
size
,
int
*
nr
)
static
int
open_posix_timers_image
(
int
pid
,
unsigned
long
*
rpt
,
int
*
nr
)
{
int
fd
;
int
ret
=
-
1
;
struct
restore_posix_timer
*
t
;
*
rpt
=
rst_mem_cpos
();
fd
=
open_image
(
CR_FD_POSIX_TIMERS
,
O_RSTR
,
pid
);
if
(
fd
<
0
)
return
fd
;
...
...
@@ -1659,24 +1660,11 @@ static int open_posix_timers_image(int pid, struct restore_posix_timer **rpt,
goto
out
;
}
if
((
*
nr
+
1
)
*
sizeof
(
struct
restore_posix_timer
)
>
*
size
)
{
unsigned
long
new_size
=
*
size
+
PAGE_SIZE
;
if
(
*
rpt
==
NULL
)
*
rpt
=
mmap
(
NULL
,
new_size
,
PROT_READ
|
PROT_WRITE
,
MAP_PRIVATE
|
MAP_ANON
,
0
,
0
);
else
*
rpt
=
mremap
(
*
rpt
,
*
size
,
new_size
,
MREMAP_MAYMOVE
);
if
(
*
rpt
==
MAP_FAILED
)
{
pr_perror
(
"Can't allocate memory for posix timers"
);
ret
=
-
1
;
goto
out
;
}
*
size
=
new_size
;
}
t
=
rst_mem_alloc
(
sizeof
(
struct
restore_posix_timer
));
if
(
!
t
)
goto
out
;
ret
=
posix_timer_restore_and_fix
(
pte
,
*
rpt
+
*
nr
);
ret
=
posix_timer_restore_and_fix
(
pte
,
t
);
if
(
ret
<
0
)
goto
out
;
...
...
@@ -1684,9 +1672,10 @@ static int open_posix_timers_image(int pid, struct restore_posix_timer **rpt,
(
*
nr
)
++
;
}
out:
if
(
*
nr
>
0
)
{
qsort
(
*
rpt
,
*
nr
,
sizeof
(
struct
restore_posix_timer
),
cmp_posix_timer_proc_id
);
}
if
(
*
nr
>
0
)
qsort
(
rst_mem_caddr
(
*
rpt
),
*
nr
,
sizeof
(
struct
restore_posix_timer
),
cmp_posix_timer_proc_id
);
close_safe
(
&
fd
);
return
ret
;
}
...
...
@@ -2032,9 +2021,8 @@ static int sigreturn_restore(pid_t pid, CoreEntry *core)
unsigned
long
vdso_rt_size
=
0
;
unsigned
long
vdso_rt_delta
=
0
;
struct
restore_posix_timer
*
posix_timers_info_chunk
=
NULL
;
unsigned
long
posix_timers_info_chunk
;
int
posix_timers_nr
=
0
;
unsigned
long
posix_timers_size
=
0
;
struct
vm_area_list
self_vmas
;
int
i
;
...
...
@@ -2091,8 +2079,7 @@ static int sigreturn_restore(pid_t pid, CoreEntry *core)
siginfo_priv_nr
[
i
]
=
ret
;
}
ret
=
open_posix_timers_image
(
pid
,
&
posix_timers_info_chunk
,
&
posix_timers_size
,
&
posix_timers_nr
);
ret
=
open_posix_timers_image
(
pid
,
&
posix_timers_info_chunk
,
&
posix_timers_nr
);
if
(
ret
<
0
)
{
if
(
errno
!=
ENOENT
)
/* backward compatibility */
goto
err
;
...
...
@@ -2106,7 +2093,6 @@ static int sigreturn_restore(pid_t pid, CoreEntry *core)
self_vmas_len
+
vmas_len
+
rst_tcp_socks_size
+
siginfo_size
+
posix_timers_size
+
rst_mem_len
;
/*
...
...
@@ -2183,20 +2169,6 @@ static int sigreturn_restore(pid_t pid, CoreEntry *core)
task_args
->
siginfo
=
siginfo_chunk
;
siginfo_chunk
+=
task_args
->
siginfo_nr
;
mem
+=
siginfo_size
;
if
(
posix_timers_info_chunk
)
{
posix_timers_info_chunk
=
mremap
(
posix_timers_info_chunk
,
posix_timers_size
,
posix_timers_size
,
MREMAP_FIXED
|
MREMAP_MAYMOVE
,
mem
);
if
(
posix_timers_info_chunk
==
MAP_FAILED
)
{
pr_perror
(
"mremap"
);
goto
err
;
}
}
task_args
->
timer_n
=
posix_timers_nr
;
task_args
->
posix_timers
=
posix_timers_info_chunk
;
task_args
->
timers_sz
=
posix_timers_size
;
/*
* Get a reference to shared memory area which is
* used to signal if shmem restoration complete
...
...
@@ -2208,7 +2180,7 @@ static int sigreturn_restore(pid_t pid, CoreEntry *core)
* address.
*/
mem
+=
posix_timers_size
;
mem
+=
restore_task_vma_len
+
restore_thread_vma_len
;
ret
=
shmem_remap
(
rst_shmems
,
mem
,
SHMEMS_SIZE
);
if
(
ret
<
0
)
goto
err
;
...
...
@@ -2239,6 +2211,9 @@ static int sigreturn_restore(pid_t pid, CoreEntry *core)
task_args
->
rst_tcp_socks
=
mem
;
task_args
->
rst_tcp_socks_size
=
rst_tcp_socks_size
;
task_args
->
timer_n
=
posix_timers_nr
;
task_args
->
posix_timers
=
rst_mem_raddr
(
posix_timers_info_chunk
);
mem
+=
rst_tcp_socks_size
;
if
(
rst_mem_remap
(
mem
))
goto
err
;
...
...
include/restorer.h
View file @
4171d5bf
...
...
@@ -131,7 +131,6 @@ struct task_restore_core_args {
int
timer_n
;
struct
restore_posix_timer
*
posix_timers
;
unsigned
long
timers_sz
;
CredsEntry
creds
;
uint32_t
cap_inh
[
CR_CAP_SIZE
];
...
...
pie/restorer.c
View file @
4171d5bf
...
...
@@ -519,9 +519,6 @@ static void restore_posix_timers(struct task_restore_core_args *args)
rt
=
&
args
->
posix_timers
[
i
];
sys_timer_settime
((
timer_t
)
rt
->
spt
.
it_id
,
0
,
&
rt
->
val
,
NULL
);
}
if
(
args
->
timer_n
)
sys_munmap
(
args
->
posix_timers
,
args
->
timers_sz
);
}
/*
...
...
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