[CRIU] [PATCH 3/6] Replace references to MAP_ANON with MAP_ANONYMOUS
Radostin Stoyanov
rstoyanov1 at gmail.com
Sat Nov 10 00:51:23 MSK 2018
MAP_ANON has been deprecated, use MAP_ANONYMOUS instead.
https://lkml.org/lkml/2007/2/3/55
Signed-off-by: Radostin Stoyanov <rstoyanov1 at gmail.com>
---
compel/plugins/shmem/shmem.c | 2 +-
criu/arch/x86/kerndat.c | 4 ++--
criu/bfd.c | 2 +-
criu/cr-check.c | 2 +-
criu/cr-restore.c | 6 +++---
criu/pipes.c | 2 +-
criu/vdso.c | 4 ++--
test/zdtm/static/mem-touch.c | 2 +-
test/zdtm/static/mprotect00.c | 2 +-
test/zdtm/transition/file_read.c | 2 +-
test/zdtm/transition/ptrace.c | 2 +-
11 files changed, 15 insertions(+), 15 deletions(-)
diff --git a/compel/plugins/shmem/shmem.c b/compel/plugins/shmem/shmem.c
index c2d56c27..695d1931 100644
--- a/compel/plugins/shmem/shmem.c
+++ b/compel/plugins/shmem/shmem.c
@@ -13,7 +13,7 @@ void *shmem_create(unsigned long size)
struct shmem_plugin_msg spi;
mem = (void *)sys_mmap(NULL, size, PROT_READ | PROT_WRITE,
- MAP_SHARED | MAP_ANON, 0, 0);
+ MAP_SHARED | MAP_ANONYMOUS, 0, 0);
if (mem == MAP_FAILED)
return NULL;
diff --git a/criu/arch/x86/kerndat.c b/criu/arch/x86/kerndat.c
index 00619682..f7593251 100644
--- a/criu/arch/x86/kerndat.c
+++ b/criu/arch/x86/kerndat.c
@@ -103,7 +103,7 @@ static void mmap_bug_test(void)
void *map1, *map2;
int err;
- map1 = mmap_ia32(0, PAGE_SIZE, PROT_NONE, MAP_ANON|MAP_PRIVATE, -1, 0);
+ map1 = mmap_ia32(0, PAGE_SIZE, PROT_NONE, MAP_ANONYMOUS|MAP_PRIVATE, -1, 0);
/* 32-bit error, not sign-extended - can't use IS_ERR_VALUE() here */
err = (uintptr_t)map1 % PAGE_SIZE;
if (err) {
@@ -116,7 +116,7 @@ static void mmap_bug_test(void)
exit(1);
}
- map2 = mmap_ia32(0, PAGE_SIZE, PROT_NONE, MAP_ANON|MAP_PRIVATE, -1, 0);
+ map2 = mmap_ia32(0, PAGE_SIZE, PROT_NONE, MAP_ANONYMOUS|MAP_PRIVATE, -1, 0);
err = (uintptr_t)map2 % PAGE_SIZE;
if (err) {
pr_err("ia32 mmap() failed: %d\n", err);
diff --git a/criu/bfd.c b/criu/bfd.c
index 1a185078..05824551 100644
--- a/criu/bfd.c
+++ b/criu/bfd.c
@@ -43,7 +43,7 @@ static int buf_get(struct xbuf *xb)
int i;
mem = mmap(NULL, BUFBATCH * BUFSIZE, PROT_READ | PROT_WRITE,
- MAP_PRIVATE | MAP_ANON, 0, 0);
+ MAP_PRIVATE | MAP_ANONYMOUS, 0, 0);
if (mem == MAP_FAILED) {
pr_perror("No buf");
return -1;
diff --git a/criu/cr-check.c b/criu/cr-check.c
index 4bbe9e09..49ad6582 100644
--- a/criu/cr-check.c
+++ b/criu/cr-check.c
@@ -746,7 +746,7 @@ static int check_aio_remap(void)
if (!len)
return -1;
- naddr = mmap(NULL, len, PROT_READ | PROT_WRITE, MAP_ANON | MAP_PRIVATE, 0, 0);
+ naddr = mmap(NULL, len, PROT_READ | PROT_WRITE, MAP_ANONYMOUS | MAP_PRIVATE, 0, 0);
if (naddr == MAP_FAILED) {
pr_perror("Can't find place for new AIO ring");
return -1;
diff --git a/criu/cr-restore.c b/criu/cr-restore.c
index c3414e08..cb80f47b 100644
--- a/criu/cr-restore.c
+++ b/criu/cr-restore.c
@@ -844,7 +844,7 @@ static int restore_one_alive_task(int pid, CoreEntry *core)
args_len = round_up(sizeof(*ta) + sizeof(struct thread_restore_args) *
current->nr_threads, page_size());
- ta = mmap(NULL, args_len, PROT_READ | PROT_WRITE, MAP_ANON | MAP_PRIVATE, 0, 0);
+ ta = mmap(NULL, args_len, PROT_READ | PROT_WRITE, MAP_ANONYMOUS | MAP_PRIVATE, 0, 0);
if (!ta)
return -1;
@@ -2767,7 +2767,7 @@ static int prepare_restorer_blob(void)
restorer_len = pie_size(restorer);
restorer = mmap(NULL, restorer_len,
PROT_READ | PROT_WRITE | PROT_EXEC,
- MAP_PRIVATE | MAP_ANON, 0, 0);
+ MAP_PRIVATE | MAP_ANONYMOUS, 0, 0);
if (restorer == MAP_FAILED) {
pr_perror("Can't map restorer code");
return -1;
@@ -3333,7 +3333,7 @@ static int sigreturn_restore(pid_t pid, struct task_restore_args *task_args, uns
/* VMA we need for stacks and sigframes for threads */
if (mmap(mem, memzone_size, PROT_READ | PROT_WRITE,
- MAP_PRIVATE | MAP_ANON | MAP_FIXED, 0, 0) != mem) {
+ MAP_PRIVATE | MAP_ANONYMOUS | MAP_FIXED, 0, 0) != mem) {
pr_err("Can't mmap section for restore code\n");
goto err;
}
diff --git a/criu/pipes.c b/criu/pipes.c
index 8e781c99..fd1a7e6b 100644
--- a/criu/pipes.c
+++ b/criu/pipes.c
@@ -47,7 +47,7 @@ static int pipe_data_read(struct cr_img *img, struct pipe_data_rst *r)
*/
r->data = mmap(NULL, bytes, PROT_READ | PROT_WRITE,
- MAP_SHARED | MAP_ANON, 0, 0);
+ MAP_SHARED | MAP_ANONYMOUS, 0, 0);
if (r->data == MAP_FAILED) {
pr_perror("Can't map mem for pipe buffers");
return -1;
diff --git a/criu/vdso.c b/criu/vdso.c
index ea142ea8..257cbcd9 100644
--- a/criu/vdso.c
+++ b/criu/vdso.c
@@ -505,7 +505,7 @@ static int vdso_fill_compat_symtable(struct vdso_maps *native,
return 0;
vdso_mmap = mmap(NULL, COMPAT_VDSO_BUF_SZ, PROT_READ | PROT_WRITE,
- MAP_SHARED | MAP_ANON, -1, 0);
+ MAP_SHARED | MAP_ANONYMOUS, -1, 0);
if (vdso_mmap == MAP_FAILED) {
pr_perror("Failed to mmap buf for compat vdso");
return -1;
@@ -656,7 +656,7 @@ int kerndat_vdso_preserves_hint(void)
void *new_addr;
new_addr = mmap(0, vdso_size, PROT_NONE,
- MAP_ANON | MAP_PRIVATE, -1, 0);
+ MAP_ANONYMOUS | MAP_PRIVATE, -1, 0);
if (new_addr == MAP_FAILED)
exit(1);
diff --git a/test/zdtm/static/mem-touch.c b/test/zdtm/static/mem-touch.c
index c14b4805..5c8c3399 100644
--- a/test/zdtm/static/mem-touch.c
+++ b/test/zdtm/static/mem-touch.c
@@ -23,7 +23,7 @@ int main(int argc, char **argv)
test_init(argc, argv);
- mem = mmap(NULL, MEM_PAGES * PAGE_SIZE, PROT_READ | PROT_WRITE, MAP_PRIVATE | MAP_ANON, 0, 0);
+ mem = mmap(NULL, MEM_PAGES * PAGE_SIZE, PROT_READ | PROT_WRITE, MAP_PRIVATE | MAP_ANONYMOUS, 0, 0);
if (mem == MAP_FAILED)
return 1;
diff --git a/test/zdtm/static/mprotect00.c b/test/zdtm/static/mprotect00.c
index be70135d..463091a6 100644
--- a/test/zdtm/static/mprotect00.c
+++ b/test/zdtm/static/mprotect00.c
@@ -87,7 +87,7 @@ int main(int argc, char ** argv)
exit(1);
}
- ptr = mmap(NULL, pagesize * (NUM_MPROTS + 1), PROT_NONE, MAP_PRIVATE | MAP_ANON, 0, 0);
+ ptr = mmap(NULL, pagesize * (NUM_MPROTS + 1), PROT_NONE, MAP_PRIVATE | MAP_ANONYMOUS, 0, 0);
if (ptr == MAP_FAILED) {
pr_perror("calloc failed");
return -1;
diff --git a/test/zdtm/transition/file_read.c b/test/zdtm/transition/file_read.c
index 63926c06..50dffd8c 100644
--- a/test/zdtm/transition/file_read.c
+++ b/test/zdtm/transition/file_read.c
@@ -121,7 +121,7 @@ static void chew_some_file(int num)
char chew_file[PATH_MAX];
buf = mmap(NULL, FILE_SIZE, PROT_READ | PROT_WRITE,
- MAP_PRIVATE | MAP_ANON, 0, 0);
+ MAP_PRIVATE | MAP_ANONYMOUS, 0, 0);
rv = MMAP_FAILED;
if (buf == MAP_FAILED)
goto out_exit;
diff --git a/test/zdtm/transition/ptrace.c b/test/zdtm/transition/ptrace.c
index dc6eca24..29e2e01d 100644
--- a/test/zdtm/transition/ptrace.c
+++ b/test/zdtm/transition/ptrace.c
@@ -40,7 +40,7 @@ int main(int argc, char **argv)
pids = (int *)mmap(NULL, sizeof(int) * nr_threads,
PROT_READ | PROT_WRITE,
- MAP_SHARED | MAP_ANON, 0, 0);
+ MAP_SHARED | MAP_ANONYMOUS, 0, 0);
if (pids == MAP_FAILED) {
pr_perror("Can't map");
exit(1);
--
2.17.2
More information about the CRIU
mailing list