mirror of
https://github.com/checkpoint-restore/criu
synced 2025-08-30 13:58:34 +00:00
criu: remove FEATURE_TEST_MEMFD
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> Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
This commit is contained in:
committed by
Pavel Emelyanov
parent
ff0de098c8
commit
5ee1ac1f28
@@ -329,7 +329,6 @@ static int get_last_cap(void)
|
|||||||
return sysctl_op(req, ARRAY_SIZE(req), CTL_READ, 0);
|
return sysctl_op(req, ARRAY_SIZE(req), CTL_READ, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef CONFIG_HAS_MEMFD
|
|
||||||
static bool kerndat_has_memfd_create(void)
|
static bool kerndat_has_memfd_create(void)
|
||||||
{
|
{
|
||||||
int ret;
|
int ret;
|
||||||
@@ -347,13 +346,6 @@ static bool kerndat_has_memfd_create(void)
|
|||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
#else
|
|
||||||
static bool kerndat_has_memfd_create(void)
|
|
||||||
{
|
|
||||||
kdat.has_memfd = false;
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
static int get_task_size(void)
|
static int get_task_size(void)
|
||||||
{
|
{
|
||||||
|
@@ -1202,7 +1202,6 @@ static int parasite_mmap_exchange(struct parasite_ctl *ctl, unsigned long size)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef CONFIG_HAS_MEMFD
|
|
||||||
static int parasite_memfd_exchange(struct parasite_ctl *ctl, unsigned long size)
|
static int parasite_memfd_exchange(struct parasite_ctl *ctl, unsigned long size)
|
||||||
{
|
{
|
||||||
void *where = (void *)ctl->syscall_ip + BUILTIN_SYSCALL_SIZE;
|
void *where = (void *)ctl->syscall_ip + BUILTIN_SYSCALL_SIZE;
|
||||||
@@ -1279,12 +1278,6 @@ err_cure:
|
|||||||
syscall_seized(ctl, __NR_close, &sret, fd, 0, 0, 0, 0, 0);
|
syscall_seized(ctl, __NR_close, &sret, fd, 0, 0, 0, 0, 0);
|
||||||
return -1;
|
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)
|
int parasite_map_exchange(struct parasite_ctl *ctl, unsigned long size)
|
||||||
{
|
{
|
||||||
|
@@ -422,7 +422,6 @@ static int open_shmem(int pid, struct vma_area *vma)
|
|||||||
}
|
}
|
||||||
|
|
||||||
flags = MAP_SHARED;
|
flags = MAP_SHARED;
|
||||||
#ifdef CONFIG_HAS_MEMFD
|
|
||||||
if (kdat.has_memfd) {
|
if (kdat.has_memfd) {
|
||||||
f = syscall(SYS_memfd_create, "", 0);
|
f = syscall(SYS_memfd_create, "", 0);
|
||||||
if (f < 0) {
|
if (f < 0) {
|
||||||
@@ -436,7 +435,6 @@ static int open_shmem(int pid, struct vma_area *vma)
|
|||||||
}
|
}
|
||||||
flags |= MAP_FILE;
|
flags |= MAP_FILE;
|
||||||
} else
|
} else
|
||||||
#endif
|
|
||||||
flags |= MAP_ANONYMOUS;
|
flags |= MAP_ANONYMOUS;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@@ -74,19 +74,3 @@ int main(int argc, char *argv[], char *envp[])
|
|||||||
}
|
}
|
||||||
|
|
||||||
endef
|
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
|
|
||||||
|
Reference in New Issue
Block a user