[1/2] criu: remove FEATURE_TEST_MEMFD

Submitted by Andrei Vagin on June 29, 2016, 11:31 p.m.

Details

Message ID 1467243075-19919-1-git-send-email-avagin@openvz.org
State Rejected
Series "Series without cover letter"
Headers show

Commit Message

Andrei Vagin June 29, 2016, 11:31 p.m.
From: Andrew Vagin <avagin@virtuozzo.com>

It isn't required, __NR_memfd_create is defined in syscall-codes.h.

With this patch, we can run all tests in travis-ci, because there
a kernel has support of memfd, but __NR_memfd_create isn't defined
in installed headers

Signed-off-by: Andrew Vagin <avagin@virtuozzo.com>
---
 criu/kerndat.c            |  8 --------
 criu/parasite-syscall.c   |  8 +-------
 criu/shmem.c              |  2 --
 scripts/feature-tests.mak | 16 ----------------
 4 files changed, 1 insertion(+), 33 deletions(-)

Patch hide | download patch | download mbox

diff --git a/criu/kerndat.c b/criu/kerndat.c
index 5793de1..3a7462e 100644
--- a/criu/kerndat.c
+++ b/criu/kerndat.c
@@ -329,7 +329,6 @@  static int get_last_cap(void)
 	return sysctl_op(req, ARRAY_SIZE(req), CTL_READ, 0);
 }
 
-#ifdef CONFIG_HAS_MEMFD
 static bool kerndat_has_memfd_create(void)
 {
 	int ret;
@@ -347,13 +346,6 @@  static bool kerndat_has_memfd_create(void)
 
 	return 0;
 }
-#else
-static bool kerndat_has_memfd_create(void)
-{
-	kdat.has_memfd = false;
-	return 0;
-}
-#endif
 
 static int get_task_size(void)
 {
diff --git a/criu/parasite-syscall.c b/criu/parasite-syscall.c
index c2467dc..9e9c61f 100644
--- a/criu/parasite-syscall.c
+++ b/criu/parasite-syscall.c
@@ -29,6 +29,7 @@ 
 #include "proc_parse.h"
 #include "aio.h"
 #include "fault-injection.h"
+#include "syscall-codes.h"
 
 #include <string.h>
 #include <stdlib.h>
@@ -1205,7 +1206,6 @@  static int parasite_mmap_exchange(struct parasite_ctl *ctl, unsigned long size)
 	return 0;
 }
 
-#ifdef CONFIG_HAS_MEMFD
 static int parasite_memfd_exchange(struct parasite_ctl *ctl, unsigned long size)
 {
 	void *where = (void *)ctl->syscall_ip + BUILTIN_SYSCALL_SIZE;
@@ -1282,12 +1282,6 @@  err_cure:
 	syscall_seized(ctl, __NR_close, &sret, fd, 0, 0, 0, 0, 0);
 	return -1;
 }
-#else
-static int parasite_memfd_exchange(struct parasite_ctl *ctl, unsigned long size)
-{
-	return 1;
-}
-#endif
 
 int parasite_map_exchange(struct parasite_ctl *ctl, unsigned long size)
 {
diff --git a/criu/shmem.c b/criu/shmem.c
index f86a56a..b1f5339 100644
--- a/criu/shmem.c
+++ b/criu/shmem.c
@@ -422,7 +422,6 @@  static int open_shmem(int pid, struct vma_area *vma)
 	}
 
 	flags = MAP_SHARED;
-#ifdef CONFIG_HAS_MEMFD
 	if (kdat.has_memfd) {
 		f = syscall(SYS_memfd_create, "", 0);
 		if (f < 0) {
@@ -436,7 +435,6 @@  static int open_shmem(int pid, struct vma_area *vma)
 		}
 		flags |= MAP_FILE;
 	} else
-#endif
 		flags |= MAP_ANONYMOUS;
 
 	/*
diff --git a/scripts/feature-tests.mak b/scripts/feature-tests.mak
index c3dc85e..e009370 100644
--- a/scripts/feature-tests.mak
+++ b/scripts/feature-tests.mak
@@ -74,19 +74,3 @@  int main(int argc, char *argv[], char *envp[])
 }
 
 endef
-
-define FEATURE_TEST_MEMFD
-
-#include <unistd.h>
-#include <sys/syscall.h>
-
-int main(void)
-{
-#ifdef __NR_memfd_create
-	return 0;
-#else
-# error No memfd support
-#endif
-}
-
-endef

Comments

Pavel Emelianov July 4, 2016, 5:59 p.m.
Both applied