Home
last modified time | relevance | path

Searched refs:mem_fd (Results 1 – 5 of 5) sorted by relevance

/linux/tools/testing/selftests/mm/
H A Duffd-common.c36 int mem_fd; in uffd_mem_fd_create() local
40 mem_fd = memfd_create("uffd-test", memfd_flags); in uffd_mem_fd_create()
41 if (mem_fd < 0) in uffd_mem_fd_create()
43 if (ftruncate(mem_fd, mem_size)) in uffd_mem_fd_create()
45 if (fallocate(mem_fd, in uffd_mem_fd_create()
50 return mem_fd; in uffd_mem_fd_create()
92 int mem_fd = uffd_mem_fd_create(size * 2, true); in hugetlb_allocate_area() local
97 mem_fd, offset); in hugetlb_allocate_area()
105 MAP_SHARED, mem_fd, offset); in hugetlb_allocate_area()
118 close(mem_fd); in hugetlb_allocate_area()
[all …]
H A Dmkdirty.c30 static int mem_fd; variable
110 lseek(mem_fd, (uintptr_t) mem, SEEK_SET); in test_ptrace_write()
111 ret = write(mem_fd, &data, 1); in test_ptrace_write()
140 lseek(mem_fd, (uintptr_t) mem, SEEK_SET); in test_ptrace_write_thp()
141 ret = write(mem_fd, &data, 1); in test_ptrace_write_thp()
346 mem_fd = open("/proc/self/mem", O_RDWR); in main()
347 if (mem_fd < 0) in main()
H A Dmremap_dontunmap.c133 int mem_fd = memfd_create("memfd", MFD_CLOEXEC); in mremap_dontunmap_simple_shmem() local
134 BUG_ON(mem_fd < 0, "memfd_create"); in mremap_dontunmap_simple_shmem()
136 BUG_ON(ftruncate(mem_fd, num_pages * page_size) < 0, in mremap_dontunmap_simple_shmem()
141 MAP_FILE | MAP_SHARED, mem_fd, 0); in mremap_dontunmap_simple_shmem()
144 BUG_ON(close(mem_fd) < 0, "close"); in mremap_dontunmap_simple_shmem()
H A Dksm_functional_tests.c40 static int mem_fd; variable
635 lseek(mem_fd, (uintptr_t) map + i, SEEK_SET); in test_prot_none()
636 if (write(mem_fd, &i, sizeof(i)) != sizeof(i)) { in test_prot_none()
697 mem_fd = open("/proc/self/mem", O_RDWR); in init_global_file_handles()
698 if (mem_fd < 0) in init_global_file_handles()
/linux/tools/testing/selftests/liveupdate/
H A Dliveupdate.c180 int session_fd, mem_fd; in TEST_F() local
190 mem_fd = memfd_create("test-memfd", 0); in TEST_F()
191 ASSERT_GE(mem_fd, 0); in TEST_F()
193 ASSERT_EQ(write(mem_fd, test_str, strlen(test_str)), strlen(test_str)); in TEST_F()
194 ASSERT_EQ(preserve_fd(session_fd, mem_fd, 0x1234), 0); in TEST_F()
197 ASSERT_EQ(lseek(mem_fd, 0, SEEK_SET), 0); in TEST_F()
198 ASSERT_EQ(read(mem_fd, read_buf, sizeof(read_buf)), strlen(test_str)); in TEST_F()
200 ASSERT_EQ(close(mem_fd), 0); in TEST_F()