/third_party/python/Lib/test/ |
H A D | test_mmap.py | 16 # Skip test if we can't import mmap. 17 mmap = import_module('mmap') variable 19 PAGESIZE = mmap.PAGESIZE 26 # Python's mmap module dup()s the file descriptor. Emscripten's FS layer 27 # does not materialize file changes through a dupped fd to a new mmap. 29 raise unittest.SkipTest("incompatible with Emscripten's mmap emulation.") 45 # Test mmap module on Unix systems and Windows 47 # Create a file to be mmap'ed. 55 m = mmap [all...] |
/kernel/linux/linux-6.6/tools/testing/selftests/riscv/mm/ |
H A D | mmap_test.h | 26 * Place all of the hint addresses on the boundaries of mmap in do_mmaps() 41 mmap(NULL, 5 * sizeof(int), prot, flags, 0, 0); in do_mmaps() 43 mmap(on_37_bits, 5 * sizeof(int), prot, flags, 0, 0); in do_mmaps() 45 mmap(on_38_bits, 5 * sizeof(int), prot, flags, 0, 0); in do_mmaps() 47 mmap(on_46_bits, 5 * sizeof(int), prot, flags, 0, 0); in do_mmaps() 49 mmap(on_47_bits, 5 * sizeof(int), prot, flags, 0, 0); in do_mmaps() 51 mmap(on_55_bits, 5 * sizeof(int), prot, flags, 0, 0); in do_mmaps() 53 mmap(on_56_bits, 5 * sizeof(int), prot, flags, 0, 0); in do_mmaps() 62 void *value1 = mmap(NULL, sizeof(int), prot, flags, 0, 0); in memory_layout() 63 void *value2 = mmap(NUL in memory_layout() [all...] |
/kernel/linux/linux-5.10/tools/perf/util/ |
H A D | mmap.c | 16 #include <perf/mmap.h> 23 #include "mmap.h" 39 size_t mmap__mmap_len(struct mmap *map) in mmap__mmap_len() 71 static int perf_mmap__aio_enabled(struct mmap *map) in perf_mmap__aio_enabled() 77 static int perf_mmap__aio_alloc(struct mmap *map, int idx) in perf_mmap__aio_alloc() 79 map->aio.data[idx] = mmap(NULL, mmap__mmap_len(map), PROT_READ|PROT_WRITE, in perf_mmap__aio_alloc() 89 static void perf_mmap__aio_free(struct mmap *map, int idx) in perf_mmap__aio_free() 97 static int perf_mmap__aio_bind(struct mmap *map, int idx, int cpu, int affinity) in perf_mmap__aio_bind() 126 static int perf_mmap__aio_alloc(struct mmap *map, int idx) in perf_mmap__aio_alloc() 135 static void perf_mmap__aio_free(struct mmap *ma [all...] |
H A D | mmap.h | 4 #include <internal/mmap.h> 28 * struct mmap - perf's ring buffer mmap details 32 struct mmap { struct 54 int mmap__mmap(struct mmap *map, struct mmap_params *mp, int fd, int cpu); 55 void mmap__munmap(struct mmap *map); 57 union perf_event *perf_mmap__read_forward(struct mmap *map); 59 int perf_mmap__push(struct mmap *md, void *to, 60 int push(struct mmap *map, void *to, void *buf, size_t size)); 62 size_t mmap__mmap_len(struct mmap *ma [all...] |
/kernel/linux/linux-5.10/tools/perf/arch/x86/util/ |
H A D | event.c | 22 union perf_event *event = zalloc(sizeof(event->mmap) + in perf_event__synthesize_extra_kmaps() 26 pr_debug("Not enough memory synthesizing mmap event " in perf_event__synthesize_extra_kmaps() 40 size = sizeof(event->mmap) - sizeof(event->mmap.filename) + in perf_event__synthesize_extra_kmaps() 46 event->mmap.header.type = PERF_RECORD_MMAP; in perf_event__synthesize_extra_kmaps() 57 event->mmap.header.size = size; in perf_event__synthesize_extra_kmaps() 59 event->mmap.start = pos->start; in perf_event__synthesize_extra_kmaps() 60 event->mmap.len = pos->end - pos->start; in perf_event__synthesize_extra_kmaps() 61 event->mmap.pgoff = pos->pgoff; in perf_event__synthesize_extra_kmaps() 62 event->mmap in perf_event__synthesize_extra_kmaps() [all...] |
/kernel/linux/linux-6.6/tools/perf/util/ |
H A D | mmap.h | 4 #include <internal/mmap.h> 25 * struct mmap - perf's ring buffer mmap details 29 struct mmap { struct 53 int mmap__mmap(struct mmap *map, struct mmap_params *mp, int fd, struct perf_cpu cpu); 54 void mmap__munmap(struct mmap *map); 56 union perf_event *perf_mmap__read_forward(struct mmap *map); 58 int perf_mmap__push(struct mmap *md, void *to, 59 int push(struct mmap *map, void *to, void *buf, size_t size)); 61 size_t mmap__mmap_len(struct mmap *ma [all...] |
H A D | mmap.c | 16 #include <perf/mmap.h> 23 #include "mmap.h" 39 size_t mmap__mmap_len(struct mmap *map) in mmap__mmap_len() 71 static int perf_mmap__aio_enabled(struct mmap *map) in perf_mmap__aio_enabled() 77 static int perf_mmap__aio_alloc(struct mmap *map, int idx) in perf_mmap__aio_alloc() 79 map->aio.data[idx] = mmap(NULL, mmap__mmap_len(map), PROT_READ|PROT_WRITE, in perf_mmap__aio_alloc() 89 static void perf_mmap__aio_free(struct mmap *map, int idx) in perf_mmap__aio_free() 97 static int perf_mmap__aio_bind(struct mmap *map, int idx, struct perf_cpu cpu, int affinity) in perf_mmap__aio_bind() 126 static int perf_mmap__aio_alloc(struct mmap *map, int idx) in perf_mmap__aio_alloc() 135 static void perf_mmap__aio_free(struct mmap *ma [all...] |
/kernel/linux/linux-6.6/drivers/leds/blink/ |
H A D | leds-lgm-sso.c | 133 struct regmap *mmap; member 222 regmap_update_bits(priv->mmap, reg, GENMASK(high, low), val); in sso_led_freq_set() 229 regmap_update_bits(priv->mmap, reg, GENMASK(high, low), val); in sso_led_freq_set() 245 regmap_write(priv->mmap, DUTY_CYCLE(desc->pin), brightness); in sso_led_brightness_set() 255 regmap_update_bits(priv->mmap, SSO_CON2, BIT(desc->pin), 0); in sso_led_brightness_set() 258 regmap_update_bits(priv->mmap, SSO_CON2, BIT(desc->pin), in sso_led_brightness_set() 316 regmap_update_bits(priv->mmap, SSO_CON2, BIT(led->desc.pin), in sso_led_blink_set() 332 regmap_update_bits(priv->mmap, SSO_CON2, BIT(desc->pin), in sso_led_hw_cfg() 337 regmap_update_bits(priv->mmap, SSO_CON3, BIT(desc->pin), in sso_led_hw_cfg() 341 regmap_write(priv->mmap, DUTY_CYCL in sso_led_hw_cfg() [all...] |
/kernel/linux/linux-6.6/tools/perf/arch/x86/util/ |
H A D | event.c | 24 union perf_event *event = zalloc(sizeof(event->mmap) + in perf_event__synthesize_extra_kmaps() 28 pr_debug("Not enough memory synthesizing mmap event " in perf_event__synthesize_extra_kmaps() 43 size = sizeof(event->mmap) - sizeof(event->mmap.filename) + in perf_event__synthesize_extra_kmaps() 49 event->mmap.header.type = PERF_RECORD_MMAP; in perf_event__synthesize_extra_kmaps() 60 event->mmap.header.size = size; in perf_event__synthesize_extra_kmaps() 62 event->mmap.start = map__start(map); in perf_event__synthesize_extra_kmaps() 63 event->mmap.len = map__size(map); in perf_event__synthesize_extra_kmaps() 64 event->mmap.pgoff = map__pgoff(map); in perf_event__synthesize_extra_kmaps() 65 event->mmap in perf_event__synthesize_extra_kmaps() [all...] |
/third_party/ltp/testcases/kernel/device-drivers/agp/kernel_space/ |
H A D | str_agp.h | 153 #define OUTREG64(mmap, addr, val) __raw_writeq((val), (mmap)+(addr)) 154 #define OUTREG32(mmap, addr, val) __raw_writel((val), (mmap)+(addr)) 155 #define OUTREG16(mmap, addr, val) __raw_writew((val), (mmap)+(addr)) 156 #define OUTREG8(mmap, addr, val) __raw_writeb((val), (mmap)+(addr)) 158 #define INREG64(mmap, addr) __raw_readq((mmap) [all...] |
/kernel/linux/linux-5.10/tools/testing/selftests/vm/ |
H A D | map_fixed_noreplace.c | 34 addr = mmap(NULL, size, PROT_NONE, flags, -1, 0); in find_base_addr() 69 p = mmap((void *)addr, size, PROT_NONE, flags, -1, 0); in main() 71 printf("mmap() @ 0x%lx-0x%lx p=%p result=%m\n", addr, addr + size, p); in main() 90 p = mmap((void *)addr, size, PROT_NONE, flags, -1, 0); in main() 91 printf("mmap() @ 0x%lx-0x%lx p=%p result=%m\n", addr, addr + size, p); in main() 95 printf("Error: first mmap() failed unexpectedly\n"); in main() 110 p = mmap((void *)addr, size, PROT_NONE, flags, -1, 0); in main() 111 printf("mmap() @ 0x%lx-0x%lx p=%p result=%m\n", addr, addr + size, p); in main() 115 printf("Error:1: mmap() succeeded when it shouldn't have\n"); in main() 131 p = mmap((voi in main() [all...] |
H A D | mremap_dontunmap.c | 49 void *source_mapping = mmap(NULL, num_pages * page_size, PROT_NONE, in kernel_support_for_mremap_dontunmap() 51 BUG_ON(source_mapping == MAP_FAILED, "mmap"); in kernel_support_for_mremap_dontunmap() 103 mmap(NULL, num_pages * page_size, PROT_READ | PROT_WRITE, in mremap_dontunmap_simple() 105 BUG_ON(source_mapping == MAP_FAILED, "mmap"); in mremap_dontunmap_simple() 140 mmap(NULL, num_pages * page_size, PROT_READ | PROT_WRITE, in mremap_dontunmap_simple_fixed() 142 BUG_ON(dest_mapping == MAP_FAILED, "mmap"); in mremap_dontunmap_simple_fixed() 146 mmap(NULL, num_pages * page_size, PROT_READ | PROT_WRITE, in mremap_dontunmap_simple_fixed() 148 BUG_ON(source_mapping == MAP_FAILED, "mmap"); in mremap_dontunmap_simple_fixed() 196 mmap(NULL, num_pages * page_size, PROT_READ | PROT_WRITE, in mremap_dontunmap_partial_mapping() 198 BUG_ON(source_mapping == MAP_FAILED, "mmap"); in mremap_dontunmap_partial_mapping() [all...] |
/kernel/linux/linux-6.6/tools/testing/selftests/mm/ |
H A D | map_fixed_noreplace.c | 30 addr = mmap(NULL, size, PROT_NONE, flags, -1, 0); in find_base_addr() 65 p = mmap((void *)addr, size, PROT_NONE, flags, -1, 0); in main() 67 printf("mmap() @ 0x%lx-0x%lx p=%p result=%m\n", addr, addr + size, p); in main() 86 p = mmap((void *)addr, size, PROT_NONE, flags, -1, 0); in main() 87 printf("mmap() @ 0x%lx-0x%lx p=%p result=%m\n", addr, addr + size, p); in main() 91 printf("Error: first mmap() failed unexpectedly\n"); in main() 106 p = mmap((void *)addr, size, PROT_NONE, flags, -1, 0); in main() 107 printf("mmap() @ 0x%lx-0x%lx p=%p result=%m\n", addr, addr + size, p); in main() 111 printf("Error:1: mmap() succeeded when it shouldn't have\n"); in main() 127 p = mmap((voi in main() [all...] |
H A D | mremap_dontunmap.c | 46 void *source_mapping = mmap(NULL, num_pages * page_size, PROT_NONE, in kernel_support_for_mremap_dontunmap() 48 BUG_ON(source_mapping == MAP_FAILED, "mmap"); in kernel_support_for_mremap_dontunmap() 100 mmap(NULL, num_pages * page_size, PROT_READ | PROT_WRITE, in mremap_dontunmap_simple() 102 BUG_ON(source_mapping == MAP_FAILED, "mmap"); in mremap_dontunmap_simple() 139 mmap(NULL, num_pages * page_size, PROT_READ | PROT_WRITE, in mremap_dontunmap_simple_shmem() 141 BUG_ON(source_mapping == MAP_FAILED, "mmap"); in mremap_dontunmap_simple_shmem() 188 mmap(NULL, num_pages * page_size, PROT_READ | PROT_WRITE, in mremap_dontunmap_simple_fixed() 190 BUG_ON(dest_mapping == MAP_FAILED, "mmap"); in mremap_dontunmap_simple_fixed() 194 mmap(NULL, num_pages * page_size, PROT_READ | PROT_WRITE, in mremap_dontunmap_simple_fixed() 196 BUG_ON(source_mapping == MAP_FAILED, "mmap"); in mremap_dontunmap_simple_fixed() [all...] |
/third_party/rust/crates/rustix/src/mm/ |
H A D | mod.rs | 5 mod mmap; modules 12 pub use mmap::{ 13 mlock, mmap, mmap_anonymous, mprotect, munlock, munmap, MapFlags, MprotectFlags, ProtFlags, 16 pub use mmap::{mlock_with, MlockFlags}; 18 pub use mmap::{mremap, mremap_fixed, MremapFlags};
|
/kernel/linux/linux-5.10/tools/testing/selftests/bpf/prog_tests/ |
H A D | mmap.c | 41 tmp1 = mmap(NULL, 4096, PROT_READ | PROT_WRITE, MAP_SHARED, rdmap_fd, 0); in test_mmap() 46 /* now double-check if it's mmap()'able at all */ in test_mmap() 47 tmp1 = mmap(NULL, 4096, PROT_READ, MAP_SHARED, rdmap_fd, 0); in test_mmap() 58 /* mmap BSS map */ in test_mmap() 59 bss_mmaped = mmap(NULL, bss_sz, PROT_READ | PROT_WRITE, MAP_SHARED, in test_mmap() 62 ".bss mmap failed: %d\n", errno)) { in test_mmap() 67 map_mmaped = mmap(NULL, map_sz, PROT_READ | PROT_WRITE, MAP_SHARED, in test_mmap() 70 "data_map mmap failed: %d\n", errno)) { in test_mmap() 115 /* data_map freeze should fail due to R/W mmap() */ in test_mmap() 132 map_mmaped = mmap(NUL in test_mmap() [all...] |
/kernel/linux/linux-6.6/tools/testing/selftests/bpf/prog_tests/ |
H A D | mmap.c | 55 tmp1 = mmap(NULL, page_size, PROT_READ | PROT_WRITE, MAP_SHARED, rdmap_fd, 0); in test_mmap() 60 /* now double-check if it's mmap()'able at all */ in test_mmap() 61 tmp1 = mmap(NULL, page_size, PROT_READ, MAP_SHARED, rdmap_fd, 0); in test_mmap() 72 /* mmap BSS map */ in test_mmap() 73 bss_mmaped = mmap(NULL, bss_sz, PROT_READ | PROT_WRITE, MAP_SHARED, in test_mmap() 76 ".bss mmap failed: %d\n", errno)) { in test_mmap() 81 map_mmaped = mmap(NULL, map_sz, PROT_READ | PROT_WRITE, MAP_SHARED, in test_mmap() 84 "data_map mmap failed: %d\n", errno)) { in test_mmap() 129 /* data_map freeze should fail due to R/W mmap() */ in test_mmap() 146 map_mmaped = mmap(NUL in test_mmap() [all...] |
/kernel/liteos_a/testsuites/unittest/basic/mem/vm/smoke/ |
H A D | mmap_test_008.cpp | 50 mem = mmap((void *)fixAddr, len, PROT_READ | PROT_WRITE, flags | MAP_FIXED, -1, 0); in Testcase() 53 memFix = mmap((void *)fixAddr, len, PROT_READ | PROT_WRITE, flags | MAP_FIXED, -1, 0); in Testcase() 57 memNoFix = mmap((void *)fixAddr, len, PROT_READ | PROT_WRITE, flags | MAP_FIXED_NOREPLACE, -1, 0); in Testcase() 60 memNoFix = mmap((void *)(fixAddr - MAP_OFFSET), len, PROT_READ | PROT_WRITE, flags | MAP_FIXED_NOREPLACE, -1, 0); in Testcase() 63 memNoFix = mmap((void *)(fixAddr + MAP_OFFSET), len, PROT_READ | PROT_WRITE, flags | MAP_FIXED_NOREPLACE, -1, 0); in Testcase() 66 memNoFix = mmap((void *)(fixAddr - MAP_OFFSET), len + MAP_OFFSET, PROT_READ | PROT_WRITE, in Testcase()
|
H A D | mmap_test_006.cpp | 53 mem = mmap(invalueAddr, len, PROT_READ | PROT_WRITE, MAP_SHARED | MAP_FIXED, fd, 0); in Testcase() 57 mem = mmap((void *)INVALID_VADDR, len, PROT_READ | PROT_WRITE, MAP_SHARED | MAP_FIXED, fd, 0); in Testcase() 61 mem = mmap((void *)INVALID_VADDR, len, PROT_READ | PROT_WRITE, MAP_ANON | MAP_SHARED, -1, 0); in Testcase() 67 mem = mmap(NULL, len, PROT_READ | PROT_WRITE, MAP_SHARED, fd, 0); in Testcase() 72 mem = mmap(NULL, len, PROT_READ | PROT_WRITE, MAP_SHARED, fd, INVALID_FD); in Testcase() 77 mem = mmap(NULL, len, PROT_READ | PROT_WRITE, MAP_SHARED, fd, 0); in Testcase() 83 mem = mmap(NULL, len, PROT_READ | PROT_WRITE, flags[i], fd, 0); in Testcase()
|
/kernel/liteos_a/testsuites/unittest/extended/liteipc/smoke/ |
H A D | liteipc_test_001.cpp | 63 /* testing mmap liteipc mem pool with different size and flag */ in LiteIpcTest() 64 retptr = mmap(nullptr, 1024 * 4096, PROT_READ, MAP_PRIVATE, fd, 0); in LiteIpcTest() 66 retptr = mmap(nullptr, -1, PROT_READ, MAP_PRIVATE, fd, 0); in LiteIpcTest() 68 retptr = mmap(nullptr, 4096, PROT_READ | PROT_WRITE, MAP_PRIVATE, fd, 0); in LiteIpcTest() 70 retptr = mmap(nullptr, 4096, PROT_READ, MAP_SHARED, fd, 0); // 4096: length of mapped memory in LiteIpcTest() 73 retptr = mmap(nullptr, 1, PROT_READ, MAP_PRIVATE, fd, 0); in LiteIpcTest() 75 retptr = mmap(nullptr, 4095, PROT_READ, MAP_PRIVATE, fd, 0); in LiteIpcTest() 121 retptr = mmap(nullptr, 16 * 4096, PROT_READ, MAP_PRIVATE, fd, 0); in TestCase()
|
/third_party/ltp/testcases/kernel/mem/hugetlb/hugemmap/ |
H A D | hugemmap18.c | 10 * Just as normal mmap()s can't have an address, length or offset which 11 * is not page aligned, so hugepage mmap()s can't have an address, length 14 * However, from time to time when the various mmap() / 20 * However starting with 3.10-rc1, length passed in mmap() doesn't need 46 p = mmap(NULL, hpage_size, PROT_READ|PROT_WRITE, MAP_PRIVATE, fd, 0); in run_test() 48 tst_res(TFAIL|TERRNO, "mmap() without hint failed"); in run_test() 52 tst_res(TFAIL, "mmap() without hint at misaligned address"); in run_test() 61 q = mmap(p + page_size, hpage_size, PROT_READ|PROT_WRITE, in run_test() 65 tst_res(TFAIL|TERRNO, "mmap() with hint failed"); in run_test() 69 tst_res(TFAIL, "mmap() wit in run_test() [all...] |
/kernel/linux/linux-5.10/arch/um/kernel/ |
H A D | tlb.c | 27 } mmap; member 73 ret = map(&hvc->mm->context.id, op->u.mmap.addr, in do_ops() 74 op->u.mmap.len, op->u.mmap.prot, in do_ops() 75 op->u.mmap.fd, in do_ops() 76 op->u.mmap.offset, finished, in do_ops() 79 map_memory(op->u.mmap.addr, op->u.mmap.offset, in do_ops() 80 op->u.mmap.len, 1, 1, 1); in do_ops() 138 (last->u.mmap in add_mmap() [all...] |
/third_party/ltp/testcases/kernel/controllers/cpuset/cpuset_memory_test/ |
H A D | cpuset_memory_testset.sh | 73 cpuset_memory_test --mmap-anon >"$MEMORY_RESULT" & 90 cpuset_memory_test --mmap-file >"$MEMORY_RESULT" & 124 cpuset_memory_test --mmap-lock1 >"$MEMORY_RESULT" & 141 cpuset_memory_test --mmap-lock2 >"$MEMORY_RESULT" & 184 cpuset_memory_test --mmap-file --hugepage -s $HUGEPAGESIZE >"$MEMORY_RESULT" & 250 cpuset_memory_test --mmap-anon >"$MEMORY_RESULT" & 267 cpuset_memory_test --mmap-anon >"$MEMORY_RESULT" & 310 cpuset_memory_test --mmap-anon --check >"$MEMORY_RESULT" & 355 cpuset_memory_test --mmap-anon --check >"$MEMORY_RESULT" & 407 cpuset_memory_test --mmap [all...] |
/third_party/musl/libc-test/src/functionalext/supplement/mman/mman_gtest/ |
H A D | mman_mmap_test.cpp | 22 g_path = "mmap.txt"; in CreateFileAndWrite() 41 * @tc.desc: This test verifies whether anonymous mapping can be successfully created using the mmap function and checks 48 void* mapping = mmap(nullptr, SIZE, PROT_READ | PROT_WRITE, MAP_ANON | MAP_PRIVATE, -1, 0); in HWTEST_F() 56 * @tc.desc: This test verifies that when using the mmap function, when the file size is 0, the returned mapping address 63 int fd = open("mmap.txt", O_RDWR | O_CREAT, 0777); in HWTEST_F() 64 void* mmapping = mmap(nullptr, 0, PROT_READ | PROT_WRITE, MAP_SHARED, fd, 0); in HWTEST_F() 72 * mmap function will return MAP_FAILED. 78 int fd = open("mmap.txt", O_RDWR | O_CREAT, 0777); in HWTEST_F() 79 void* mmapping = mmap(nullptr, static_cast<size_t>(PTRDIFF_MAX) + 1, PROT_READ | PROT_WRITE, MAP_SHARED, fd, 0); in HWTEST_F() 87 * using the mmap functio [all...] |
/kernel/linux/linux-6.6/arch/um/kernel/ |
H A D | tlb.c | 27 } mmap; member 73 ret = map(&hvc->mm->context.id, op->u.mmap.addr, in do_ops() 74 op->u.mmap.len, op->u.mmap.prot, in do_ops() 75 op->u.mmap.fd, in do_ops() 76 op->u.mmap.offset, finished, in do_ops() 79 map_memory(op->u.mmap.addr, op->u.mmap.offset, in do_ops() 80 op->u.mmap.len, 1, 1, 1); in do_ops() 135 (last->u.mmap in add_mmap() [all...] |