/third_party/ltp/testcases/kernel/syscalls/mprotect/ |
D | mprotect04.c | 58 static unsigned int page_sz; variable 91 page_sz = getpagesize(); in setup() 102 addr = SAFE_MMAP(cleanup, 0, page_sz, PROT_READ | PROT_WRITE, in testfunc_protnone() 106 TEST(mprotect(addr, page_sz, PROT_NONE)); in testfunc_protnone() 128 SAFE_MUNMAP(cleanup, addr, page_sz); in testfunc_protnone() 185 uintptr_t page_sz = getpagesize(); in get_func() local 186 uintptr_t page_mask = ~(page_sz - 1); in get_func() 192 *func_page_offset = (uintptr_t)opd->entry & (page_sz - 1); in get_func() 196 *func_page_offset = (uintptr_t)&exec_func & (page_sz - 1); in get_func() 208 TEST(mprotect(page_to_copy, page_sz, PROT_READ | PROT_EXEC)); in get_func() [all …]
|
/third_party/ltp/testcases/kernel/syscalls/remap_file_pages/ |
D | remap_file_pages01.c | 94 static int page_sz; variable 144 char *page = cache_contents + i * page_sz; in test_nonlinear() 168 char *page = data + i * page_sz; in test_nonlinear() 170 if (remap_file_pages(page, page_sz * 2, 0, in test_nonlinear() 175 page, (page_sz * 2), (window_pages - i - 2)); in test_nonlinear() 185 if (data[i * page_sz] != ((int)window_pages) - i) { in test_nonlinear() 189 (i * page_sz), data[i * page_sz], i, in test_nonlinear() 194 if (data[i * page_sz] != ((int)window_pages) - i - 2) { in test_nonlinear() 198 (i * page_sz), data[i * page_sz], i, in test_nonlinear() 222 page_sz = getpagesize(); in setup() [all …]
|
D | remap_file_pages02.c | 48 static unsigned int page_sz; variable 98 tcases[test].size = page_sz; in setup01() 103 tcases[test].start = data + page_sz; in setup02() 104 tcases[test].size = page_sz; in setup02() 110 tcases[test].size = 2 * page_sz; in setup03() 116 tcases[test].size = page_sz; in setup04() 124 page_sz = getpagesize(); in setup() 127 SAFE_FTRUNCATE(fd, page_sz); in setup() 129 data = SAFE_MMAP((void *)WINDOW_START, page_sz, PROT_READ | PROT_WRITE, in setup() 132 data01 = SAFE_MMAP(NULL, page_sz, PROT_READ | PROT_WRITE, MAP_PRIVATE, in setup() [all …]
|
/third_party/ltp/testcases/kernel/syscalls/mmap/ |
D | mmap04.c | 57 static size_t page_sz; variable 82 addr = mmap(0, page_sz, PROT_READ | PROT_EXEC, in main() 95 if (read(fildes, dummy, page_sz) < 0) { in main() 104 if (memcmp(dummy, addr, page_sz)) { in main() 115 if (munmap(addr, page_sz) != 0) { in main() 132 page_sz = getpagesize(); in setup() 134 if ((tst_buff = calloc(page_sz, sizeof(char))) == NULL) { in setup() 139 memset(tst_buff, 'A', page_sz); in setup() 150 if (write(fildes, tst_buff, page_sz) < (ssize_t)page_sz) { in setup() 169 if ((dummy = calloc(page_sz, sizeof(char))) == NULL) { in setup()
|
D | mmap03.c | 60 static size_t page_sz; variable 88 addr = mmap(0, page_sz, PROT_EXEC, in main() 102 if (read(fildes, dummy, page_sz) < 0) { in main() 117 if (memcmp(dummy, addr, page_sz)) { in main() 138 if (munmap(addr, page_sz) != 0) { in main() 158 page_sz = getpagesize(); in setup() 161 if ((tst_buff = calloc(page_sz, sizeof(char))) == NULL) { in setup() 166 memset(tst_buff, 'A', page_sz); in setup() 178 if (write(fildes, tst_buff, page_sz) < (long)page_sz) { in setup() 199 if ((dummy = calloc(page_sz, sizeof(char))) == NULL) { in setup()
|
D | mmap02.c | 20 static ssize_t page_sz; variable 27 page_sz = getpagesize(); in setup() 28 buf = SAFE_MALLOC(page_sz); in setup() 29 memset(buf, 'A', page_sz); in setup() 32 SAFE_WRITE(SAFE_WRITE_ALL, fd, buf, page_sz); in setup() 41 addr = SAFE_MMAP(NULL, page_sz, PROT_READ, MAP_FILE | MAP_SHARED, fd, 0); in run() 43 if (memcmp(buf, addr, page_sz) == 0) in run() 48 SAFE_MUNMAP(addr, page_sz); in run()
|
D | mmap07.c | 53 static size_t page_sz; variable 77 addr = mmap(0, page_sz, PROT_WRITE, in main() 87 if (munmap(addr, page_sz) != 0) { in main() 114 page_sz = getpagesize(); in setup() 117 if ((tst_buff = calloc(page_sz, sizeof(char))) == NULL) { in setup() 123 memset(tst_buff, 'A', page_sz); in setup() 134 if (write(fildes, tst_buff, page_sz) < (int)page_sz) { in setup()
|
D | mmap05.c | 22 static size_t page_sz; variable 42 page_sz = getpagesize(); in setup() 43 buf = SAFE_MALLOC(page_sz); in setup() 44 memset(buf, 'A', page_sz); in setup() 47 SAFE_WRITE(SAFE_WRITE_ALL, fd, buf, page_sz); in setup() 53 addr = mmap(NULL, page_sz, PROT_NONE, MAP_FILE | MAP_SHARED, fd, 0); in run() 67 SAFE_MUNMAP((char *)addr, page_sz); in run()
|
D | mmap01.c | 58 static size_t page_sz; variable 83 addr = mmap(NULL, page_sz, PROT_READ | PROT_WRITE, in main() 97 if (memcmp(&addr[file_sz], dummy, page_sz - file_sz)) { in main() 114 if (msync(addr, page_sz, MS_SYNC) != 0) { in main() 134 if (munmap(addr, page_sz) != 0) { in main() 178 page_sz = getpagesize(); in setup() 181 if ((dummy = calloc(page_sz, sizeof(char))) == NULL) { in setup()
|
D | mmap13.c | 49 static size_t page_sz; variable 71 addr = mmap(NULL, page_sz * 2, PROT_READ | PROT_WRITE, in main() 81 ch = addr + page_sz + 1; in main() 92 if (munmap(addr, page_sz * 2) != 0) in main() 109 page_sz = getpagesize(); in setup() 118 if (ftruncate(fildes, page_sz / 2) == -1) in setup()
|
D | mmap06.c | 23 static size_t page_sz; variable 46 page_sz = getpagesize(); in setup() 47 buf = SAFE_MALLOC(page_sz); in setup() 48 memset(buf, 'A', page_sz); in setup() 51 SAFE_WRITE(SAFE_WRITE_ALL, fd, buf, page_sz); in setup()
|
D | mmap12.c | 47 size_t page_sz; in page_check() local 52 page_sz = getpagesize(); in page_check() 54 num_pages = MMAPSIZE / page_sz; in page_check() 55 index = (vmstart / page_sz) * sizeof(uint64_t); in page_check() 80 "present", i, vmstart + i * page_sz); in page_check()
|
D | mmap08.c | 19 static size_t page_sz; variable 30 TESTPTR(mmap(NULL, page_sz, PROT_WRITE, MAP_FILE | MAP_SHARED, fd, 0)); in run() 34 SAFE_MUNMAP(TST_RET_PTR, page_sz); in run()
|
/third_party/ltp/testcases/kernel/syscalls/munmap/ |
D | munmap02.c | 86 static size_t page_sz; variable 169 page_sz = getpagesize(); in setup() 175 map_len = 3 * page_sz; in setup() 223 addr = (char *)((long)addr + page_sz); in setup() 224 map_len = map_len - page_sz; in setup() 260 addr = (char *)((long)addr - page_sz); in cleanup() 261 map_len = map_len - page_sz; in cleanup()
|
D | munmap03.c | 48 static size_t page_sz; variable 86 page_sz = (size_t)sysconf(_SC_PAGESIZE); in setup() 88 global_maplen = page_sz * 2; in setup() 118 map_len = page_sz * 2; in test_einval1() 138 size_t map_len = page_sz; in test_einval3()
|
D | munmap01.c | 153 size_t page_sz; in setup() local 165 page_sz = getpagesize(); in setup() 171 map_len = 3 * page_sz; in setup()
|
/third_party/ltp/testcases/kernel/syscalls/msync/ |
D | msync03.c | 62 static size_t page_sz; variable 113 page_sz = (size_t)sysconf(_SC_PAGESIZE); in setup() 118 while (nwrite < page_sz) { in setup() 123 addr1 = SAFE_MMAP(cleanup, 0, page_sz, PROT_READ | PROT_WRITE, in setup() 134 addr4 = sbrk(0) + (4 * page_sz); in setup() 139 TEST(msync(*(tc->addr), page_sz, tc->flags)); in msync_verify() 157 if (addr1 && munmap(addr1, page_sz) < 0) in cleanup()
|
D | msync02.c | 81 size_t page_sz; /* system page size */ variable 94 TEST(msync(addr, page_sz, MS_INVALIDATE)); in main() 116 page_sz = (size_t)getpagesize(); in setup() 124 while (c_total < page_sz) { in setup() 131 addr = mmap(0, page_sz, PROT_READ | PROT_WRITE, MAP_FILE | MAP_SHARED, in setup() 148 if (munmap(addr, page_sz) == -1) in cleanup()
|
D | msync01.c | 82 size_t page_sz; /* system page size */ variable 103 TEST(msync(addr, page_sz, MS_ASYNC)); in main() 162 page_sz = (size_t)getpagesize(); in setup() 169 while (c_total < page_sz) { in setup() 181 addr = mmap(0, page_sz, PROT_READ | PROT_WRITE, MAP_FILE | MAP_SHARED, in setup() 194 if (munmap(addr, page_sz) == -1) in cleanup()
|
/third_party/ltp/testcases/kernel/mem/hugetlb/hugemmap/ |
D | hugemmap01.c | 40 long page_sz = 0; in test_hugemmap() local 46 page_sz = SAFE_READ_MEMINFO("Hugepagesize:") * 1024; in test_hugemmap() 48 addr = mmap(NULL, page_sz, PROT_READ | PROT_WRITE, in test_hugemmap() 66 munmap(addr, page_sz); in test_hugemmap()
|
D | hugemmap02.c | 50 long page_sz, map_sz; in test_hugemmap() local 52 page_sz = getpagesize(); in test_hugemmap() 72 addr = mmap((void *)low_addr, page_sz, PROT_READ, in test_hugemmap() 112 if (munmap(addr, page_sz) == -1) in test_hugemmap()
|
/third_party/ltp/testcases/kernel/syscalls/mremap/ |
D | mremap03.c | 153 int page_sz; /* system page size */ in setup() local 160 if ((page_sz = getpagesize()) < 0) { in setup() 166 memsize = (1000 * page_sz); in setup()
|
/third_party/ltp/testcases/kernel/mem/mtest06/ |
D | mmap1.c | 49 static unsigned long page_sz; variable 189 page_sz = getpagesize(); in setup()
|
/third_party/libbpf/src/ |
D | libbpf.c | 1600 const long page_sz = sysconf(_SC_PAGE_SIZE); local 1604 map_sz = roundup(map_sz, page_sz); 2519 __u32 page_sz = sysconf(_SC_PAGE_SIZE); local 2529 if ((sz % page_sz) == 0 && is_pow_of_2(sz / page_sz)) 2536 for (mul = 1; mul <= UINT_MAX / page_sz; mul <<= 1) { 2537 if (mul * page_sz > sz) 2538 return mul * page_sz;
|