diff --git a/criu/cr-dedup.c b/criu/cr-dedup.c index 538f6507c..f1ad9729c 100644 --- a/criu/cr-dedup.c +++ b/criu/cr-dedup.c @@ -7,12 +7,12 @@ #include "pagemap.h" #include "restorer.h" -static int cr_dedup_one_pagemap(int pid); +static int cr_dedup_one_pagemap(int id, int flags); int cr_dedup(void) { int close_ret, ret = 0; - int pid; + int id; DIR * dirp; struct dirent *ent; @@ -35,10 +35,18 @@ int cr_dedup(void) break; } - ret = sscanf(ent->d_name, "pagemap-%d.img", &pid); + ret = sscanf(ent->d_name, "pagemap-%d.img", &id); if (ret == 1) { - pr_info("pid=%d\n", pid); - ret = cr_dedup_one_pagemap(pid); + pr_info("pid=%d\n", id); + ret = cr_dedup_one_pagemap(id, PR_TASK); + if (ret < 0) + break; + } + + ret = sscanf(ent->d_name, "pagemap-shmem-%d.img", &id); + if (ret == 1) { + pr_info("shmid=%d\n", id); + ret = cr_dedup_one_pagemap(id, PR_SHMEM); if (ret < 0) break; } @@ -58,14 +66,15 @@ err: return 0; } -static int cr_dedup_one_pagemap(int pid) +static int cr_dedup_one_pagemap(int id, int flags) { int ret; struct page_read pr; struct page_read * prp; struct iovec iov; - ret = open_page_read(pid, &pr, PR_TASK | PR_MOD); + flags |= PR_MOD; + ret = open_page_read(id, &pr, flags); if (ret <= 0) { ret = -1; goto exit;