/external/linux-kselftest/tools/testing/selftests/vm/ |
D | mlock2-tests.c | 226 unsigned long page_size = getpagesize(); in lock_check() local 230 page2_flags = get_pageflags((unsigned long)map + page_size); in lock_check() 254 if (!is_vmflag_set((unsigned long)map + page_size, LOCKED)) { in lock_check() 264 unsigned long page_size = getpagesize(); in unlock_lock_check() local 268 page2_flags = get_pageflags((unsigned long)map + page_size); in unlock_lock_check() 282 if (is_vmflag_set((unsigned long)map + page_size, LOCKED)) { in unlock_lock_check() 294 unsigned long page_size = getpagesize(); in test_mlock_lock() local 296 map = mmap(NULL, 2 * page_size, PROT_READ | PROT_WRITE, in test_mlock_lock() 303 if (mlock2_(map, 2 * page_size, 0)) { in test_mlock_lock() 316 if (munlock(map, 2 * page_size)) { in test_mlock_lock() [all …]
|
D | userfaultfd.c | 74 static unsigned long nr_cpus, nr_pages, nr_pages_per_cpu, page_size; variable 103 ((pthread_mutex_t *) ((___area) + (___nr)*page_size)) 110 ((___area) + (___nr)*page_size + \ 120 if (madvise(rel_area, nr_pages * page_size, MADV_DONTNEED)) { in anon_release_pages() 130 if (posix_memalign(alloc_area, page_size, nr_pages * page_size)) { in anon_allocate_area() 147 nr_pages * page_size, in hugetlb_release_pages() 148 nr_pages * page_size)) { in hugetlb_release_pages() 161 *alloc_area = mmap(NULL, nr_pages * page_size, PROT_READ | PROT_WRITE, in hugetlb_allocate_area() 165 nr_pages * page_size); in hugetlb_allocate_area() 172 area_alias = mmap(NULL, nr_pages * page_size, PROT_READ | PROT_WRITE, in hugetlb_allocate_area() [all …]
|
/external/compiler-rt/lib/sanitizer_common/tests/ |
D | sanitizer_posix_test.cc | 63 const int page_size = GetPageSize(); in TEST() local 64 uptr mem = (uptr)mmap(0, 3 * page_size, PROT_READ | PROT_WRITE, in TEST() 67 mprotect((void *)(mem + page_size), page_size, PROT_NONE); in TEST() 68 EXPECT_TRUE(IsAccessibleMemoryRange(mem, page_size - 1)); in TEST() 69 EXPECT_TRUE(IsAccessibleMemoryRange(mem, page_size)); in TEST() 70 EXPECT_FALSE(IsAccessibleMemoryRange(mem, page_size + 1)); in TEST() 71 EXPECT_TRUE(IsAccessibleMemoryRange(mem + page_size - 1, 1)); in TEST() 72 EXPECT_FALSE(IsAccessibleMemoryRange(mem + page_size - 1, 2)); in TEST() 73 EXPECT_FALSE(IsAccessibleMemoryRange(mem + 2 * page_size - 1, 1)); in TEST() 74 EXPECT_TRUE(IsAccessibleMemoryRange(mem + 2 * page_size, page_size)); in TEST() [all …]
|
/external/strace/tests-mx32/ |
D | tail_alloc.c | 35 const size_t page_size = get_page_size(); in tail_alloc() local 36 const size_t len = (size + page_size - 1) & -page_size; in tail_alloc() 37 const size_t alloc_size = len + 6 * page_size; in tail_alloc() 44 void *start_work = p + 3 * page_size; in tail_alloc() 47 if (munmap(p, page_size) || in tail_alloc() 48 munmap(p + 2 * page_size, page_size) || in tail_alloc() 49 munmap(tail_guard, page_size) || in tail_alloc() 50 munmap(tail_guard + 2 * page_size, page_size)) in tail_alloc()
|
D | bpf.c | 54 static unsigned int page_size; variable 147 memmove((void *) end_of_page - page_size + 1, \ 149 addr = end_of_page - page_size + 1; \ 151 page_size - offset - 1); \ 152 sys_bpf(cmd_, addr, page_size); \ 154 cmd_str_, addr, page_size, errstr); \ 157 memmove((void *) end_of_page - page_size, \ 159 addr = end_of_page - page_size; \ 160 memset((void *) addr + offset, 0, page_size - offset); \ 161 sys_bpf(cmd_, addr, page_size); \ [all …]
|
D | sendfile64.c | 54 const unsigned int page_size = get_page_size(); in main() local 55 assert(syscall(__NR_sendfile64, 0, 1, NULL, page_size) == -1); in main() 58 printf("sendfile64(0, 1, NULL, %u) = -1 EBADF (%m)\n", page_size); in main() 68 if (file_size / 16 > page_size) in main() 69 file_size = page_size * 16; in main() 86 assert(syscall(__NR_sendfile64, 0, 1, p, page_size) == -1); in main() 87 printf("sendfile64(0, 1, %p, %u) = -1 EFAULT (%m)\n", p, page_size); in main()
|
D | ioctl_kvm_run.c | 60 static size_t page_size; variable 110 .rip = page_size, in run_kvm() 191 page_size = get_page_size(); in main() 192 void *const mem = mmap(NULL, page_size, PROT_READ | PROT_WRITE, in main() 200 .guest_phys_addr = page_size, in main() 201 .memory_size = page_size, in main() 208 (unsigned long) page_size, (unsigned long) page_size, mem); in main() 223 const size_t mmap_size = (ret + page_size - 1) & -page_size; in main()
|
/external/strace/tests/ |
D | tail_alloc.c | 35 const size_t page_size = get_page_size(); in tail_alloc() local 36 const size_t len = (size + page_size - 1) & -page_size; in tail_alloc() 37 const size_t alloc_size = len + 6 * page_size; in tail_alloc() 44 void *start_work = p + 3 * page_size; in tail_alloc() 47 if (munmap(p, page_size) || in tail_alloc() 48 munmap(p + 2 * page_size, page_size) || in tail_alloc() 49 munmap(tail_guard, page_size) || in tail_alloc() 50 munmap(tail_guard + 2 * page_size, page_size)) in tail_alloc()
|
D | bpf.c | 54 static unsigned int page_size; variable 147 memmove((void *) end_of_page - page_size + 1, \ 149 addr = end_of_page - page_size + 1; \ 151 page_size - offset - 1); \ 152 sys_bpf(cmd_, addr, page_size); \ 154 cmd_str_, addr, page_size, errstr); \ 157 memmove((void *) end_of_page - page_size, \ 159 addr = end_of_page - page_size; \ 160 memset((void *) addr + offset, 0, page_size - offset); \ 161 sys_bpf(cmd_, addr, page_size); \ [all …]
|
D | sendfile64.c | 54 const unsigned int page_size = get_page_size(); in main() local 55 assert(syscall(__NR_sendfile64, 0, 1, NULL, page_size) == -1); in main() 58 printf("sendfile64(0, 1, NULL, %u) = -1 EBADF (%m)\n", page_size); in main() 68 if (file_size / 16 > page_size) in main() 69 file_size = page_size * 16; in main() 86 assert(syscall(__NR_sendfile64, 0, 1, p, page_size) == -1); in main() 87 printf("sendfile64(0, 1, %p, %u) = -1 EFAULT (%m)\n", p, page_size); in main()
|
D | ioctl_kvm_run.c | 60 static size_t page_size; variable 110 .rip = page_size, in run_kvm() 191 page_size = get_page_size(); in main() 192 void *const mem = mmap(NULL, page_size, PROT_READ | PROT_WRITE, in main() 200 .guest_phys_addr = page_size, in main() 201 .memory_size = page_size, in main() 208 (unsigned long) page_size, (unsigned long) page_size, mem); in main() 223 const size_t mmap_size = (ret + page_size - 1) & -page_size; in main()
|
/external/strace/tests-m32/ |
D | tail_alloc.c | 35 const size_t page_size = get_page_size(); in tail_alloc() local 36 const size_t len = (size + page_size - 1) & -page_size; in tail_alloc() 37 const size_t alloc_size = len + 6 * page_size; in tail_alloc() 44 void *start_work = p + 3 * page_size; in tail_alloc() 47 if (munmap(p, page_size) || in tail_alloc() 48 munmap(p + 2 * page_size, page_size) || in tail_alloc() 49 munmap(tail_guard, page_size) || in tail_alloc() 50 munmap(tail_guard + 2 * page_size, page_size)) in tail_alloc()
|
D | bpf.c | 54 static unsigned int page_size; variable 147 memmove((void *) end_of_page - page_size + 1, \ 149 addr = end_of_page - page_size + 1; \ 151 page_size - offset - 1); \ 152 sys_bpf(cmd_, addr, page_size); \ 154 cmd_str_, addr, page_size, errstr); \ 157 memmove((void *) end_of_page - page_size, \ 159 addr = end_of_page - page_size; \ 160 memset((void *) addr + offset, 0, page_size - offset); \ 161 sys_bpf(cmd_, addr, page_size); \ [all …]
|
D | sendfile64.c | 54 const unsigned int page_size = get_page_size(); in main() local 55 assert(syscall(__NR_sendfile64, 0, 1, NULL, page_size) == -1); in main() 58 printf("sendfile64(0, 1, NULL, %u) = -1 EBADF (%m)\n", page_size); in main() 68 if (file_size / 16 > page_size) in main() 69 file_size = page_size * 16; in main() 86 assert(syscall(__NR_sendfile64, 0, 1, p, page_size) == -1); in main() 87 printf("sendfile64(0, 1, %p, %u) = -1 EFAULT (%m)\n", p, page_size); in main()
|
D | ioctl_kvm_run.c | 60 static size_t page_size; variable 110 .rip = page_size, in run_kvm() 191 page_size = get_page_size(); in main() 192 void *const mem = mmap(NULL, page_size, PROT_READ | PROT_WRITE, in main() 200 .guest_phys_addr = page_size, in main() 201 .memory_size = page_size, in main() 208 (unsigned long) page_size, (unsigned long) page_size, mem); in main() 223 const size_t mmap_size = (ret + page_size - 1) & -page_size; in main()
|
/external/valgrind/none/tests/linux/ |
D | clonev.c | 19 long page_size = sysconf(_SC_PAGE_SIZE); in main() local 20 assert(page_size != -1); in main() 23 long stack_size = sysconf(_SC_THREAD_STACK_MIN) + page_size; in main() 26 size_t stack_and_guard_size = page_size + stack_size + page_size; in main() 36 if (-1 == mprotect((char *)child_stack, page_size, PROT_NONE)) { in main() 41 if (-1 == mprotect((char *)child_stack + page_size + stack_size, in main() 42 page_size, PROT_NONE)) { in main() 47 void *stack_start = (char *)child_stack + page_size + stack_size; in main() 50 stack_start, (int)page_size, (int)stack_size); in main()
|
/external/ltp/testcases/kernel/mem/mmapstress/ |
D | mmapstress04.c | 32 static int page_size; variable 37 page_size = getpagesize(); in setup() 43 mmap_area = SAFE_MMAP(NULL, page_size * NUM_PAGES, PROT_NONE, in setup() 64 if (tst_fill_file(TEST_FILE, 'b', page_size, 1)) in mmapstress04() 86 mapoff = page_size * (off_t)(6 * i + j); in mmapstress04() 87 SAFE_MMAP(mmap_area + page_size * mapped_pages++, in mmapstress04() 88 page_size, PROT_READ, in mmapstress04() 97 buf = SAFE_MALLOC(page_size); in mmapstress04() 98 memset(buf, 'a', page_size); in mmapstress04() 100 write_fully(rwfd, buf, page_size); in mmapstress04() [all …]
|
/external/ltp/testcases/kernel/syscalls/madvise/ |
D | madvise09.c | 67 static size_t page_size; variable 78 size_t i, page_size = getpagesize(); in memory_pressure_child() local 82 ptr = mmap(NULL, 500 * page_size, PROT_READ | PROT_WRITE, in memory_pressure_child() 86 ptr[i * page_size] = i % 100; in memory_pressure_child() 121 if (!ptr[i * page_size]) in count_freed() 138 for (i = 1; i < page_size; i++) { in check_page_baaa() 155 for (i = 0; i < page_size; i++) { in check_page() 178 ptr = SAFE_MMAP(NULL, PAGES * page_size, PROT_READ | PROT_WRITE, in child() 181 for (i = 0; i < PAGES * page_size; i++) in child() 184 if (madvise(ptr, PAGES * page_size, MADV_FREE)) { in child() [all …]
|
/external/valgrind/none/tests/solaris/ |
D | coredump_many_segments.c | 59 range_t **ranges_tail, size_t page_size) in process_map() argument 77 head->start = (uintptr_t) page_size; // do not start at address '0' in process_map() 85 (map->pr_vaddr - tail->start < 3 * page_size)) { in process_map() 88 tail->start = map->pr_vaddr + map->pr_size + page_size; in process_map() 92 tail->end = map->pr_vaddr - page_size; in process_map() 101 new_one->start = map->pr_vaddr + map->pr_size + page_size; in process_map() 108 static range_t *read_proc_map(size_t page_size) in read_proc_map() argument 125 page_size) != 0) { in read_proc_map() 181 long page_size = sysconf(_SC_PAGESIZE); in main() local 182 if (page_size == -1) { in main() [all …]
|
/external/linux-kselftest/tools/testing/selftests/powerpc/primitives/ |
D | load_unaligned_zeropad.c | 42 static int page_size; variable 47 if (mprotect(mem_region + page_size, page_size, PROT_NONE)) { in protect_region() 57 if (mprotect(mem_region + page_size, page_size, PROT_READ|PROT_WRITE)) { in unprotect_region() 137 page_size = getpagesize(); in test_body() 138 mem_region = mmap(NULL, page_size * 2, PROT_READ|PROT_WRITE, in test_body() 143 for (i = 0; i < page_size; i++) in test_body() 146 memset(mem_region+page_size, 0, page_size); in test_body() 150 for (i = 0; i < page_size; i++) in test_body()
|
/external/ltp/testcases/kernel/syscalls/mincore/ |
D | mincore02.c | 46 static int page_size; variable 53 munlock(addr, page_size * num_pages); in cleanup() 54 munmap(addr, page_size * num_pages); in cleanup() 66 page_size = getpagesize(); in setup() 67 if (page_size == -1) in setup() 70 size = page_size * num_pages; in setup() 74 vec = malloc((size + page_size - 1) / page_size); in setup() 111 if (mincore(addr, num_pages * page_size, vec) == -1) { in main()
|
/external/ltp/testcases/kernel/syscalls/writev/ |
D | writev06.c | 57 int page_size; variable 174 page_size = getpagesize(); in setup() 178 bad_addr[0] = mmap(NULL, page_size * 3, PROT_NONE, in setup() 183 good_addr[0] = mmap(NULL, page_size, PROT_READ | PROT_WRITE, in setup() 188 bad_addr[1] = mmap(NULL, page_size * 3, PROT_NONE, in setup() 193 good_addr[1] = mmap(NULL, page_size, PROT_READ | PROT_WRITE, in setup() 199 memset(good_addr[0], 'a', page_size); in setup() 200 memset(good_addr[1], 'b', page_size); in setup() 202 wr_iovec[0].iov_base = good_addr[0] + page_size - 1; in setup() 203 wr_iovec[1].iov_base = good_addr[1] + page_size - 1; in setup()
|
/external/compiler-rt/test/sanitizer_common/TestCases/Linux/ |
D | signal_segv_handler.cc | 23 unsigned long page_size; variable 27 mprotect(guard, page_size, PROT_READ | PROT_WRITE); in handler() 31 page_size = sysconf(_SC_PAGESIZE); in main() 38 guard = mmap(0, 3 * page_size, PROT_NONE, MAP_ANON | MAP_PRIVATE, -1, 0); in main() 39 guard = (char*)guard + page_size; // work around a kernel bug in main() 41 mprotect(guard, page_size, PROT_NONE); in main()
|
/external/ltp/testcases/open_posix_testsuite/conformance/interfaces/mmap/ |
D | 24-2.c | 45 unsigned long page_size = sysconf(_SC_PAGE_SIZE); in main() local 47 shm_size = 2 * page_size; in main() 83 if ((unsigned long)addr % page_size) { in main() 85 addr += page_size; in main() 86 addr = (void *)((unsigned long)addr & ~(page_size - 1)); in main() 88 if (len % page_size) { in main() 90 len &= ~(page_size - 1); in main()
|
/external/v8/src/base/ |
D | sys-info.cc | 65 int pages, page_size; in AmountOfPhysicalMemory() 68 sysctlbyname("vm.stats.vm.v_page_size", &page_size, &size, NULL, 0); in AmountOfPhysicalMemory() 69 if (pages == -1 || page_size == -1) { in AmountOfPhysicalMemory() 72 return static_cast<int64_t>(pages) * page_size; in AmountOfPhysicalMemory() 93 long page_size = sysconf(_SC_PAGESIZE); // NOLINT(runtime/int) in AmountOfPhysicalMemory() 94 if (pages == -1 || page_size == -1) { in AmountOfPhysicalMemory() 97 return static_cast<int64_t>(pages) * page_size; in AmountOfPhysicalMemory()
|