[CRIU] [PATCH 1/3] shmem: Explicitly initialize rst_shmems
Pavel Emelyanov
xemul at parallels.com
Mon Aug 18 08:46:50 PDT 2014
This is a position in the RM_SHREMAP memory. Since shmems are currently
the only user of it, this is validly equals zero, but it will change soon.
Signed-off-by: Pavel Emelyanov <xemul at parallels.com>
---
cr-restore.c | 3 +++
include/shmem.h | 2 +-
shmem.c | 8 +++++++-
3 files changed, 11 insertions(+), 2 deletions(-)
diff --git a/cr-restore.c b/cr-restore.c
index bc7d999..b76dcad 100644
--- a/cr-restore.c
+++ b/cr-restore.c
@@ -174,6 +174,9 @@ static int root_prepare_shared(void)
if (prepare_shared_reg_files())
return -1;
+ if (prepare_shmem_restore())
+ return -1;
+
for (i = 0; i < ARRAY_SIZE(cinfos); i++) {
ret = collect_image(cinfos[i]);
if (ret)
diff --git a/include/shmem.h b/include/shmem.h
index 8eaed56..2526e3e 100644
--- a/include/shmem.h
+++ b/include/shmem.h
@@ -28,7 +28,7 @@ extern void show_saved_shmems(void);
extern int get_shmem_fd(int pid, VmaEntry *vi);
extern unsigned long nr_shmems;
-extern unsigned int rst_shmems;
+extern unsigned long rst_shmems;
extern int cr_dump_shmem(void);
extern int add_shmem_area(pid_t pid, VmaEntry *vma);
diff --git a/shmem.c b/shmem.c
index 6e14332..6f8a14a 100644
--- a/shmem.c
+++ b/shmem.c
@@ -16,7 +16,13 @@
#include "protobuf/pagemap.pb-c.h"
unsigned long nr_shmems;
-unsigned int rst_shmems;
+unsigned long rst_shmems;
+
+int prepare_shmem_restore(void)
+{
+ rst_shmems = rst_mem_cpos(RM_SHREMAP);
+ return 0;
+}
void show_saved_shmems(void)
{
--
1.8.4.2
More information about the CRIU
mailing list