Merge tag 'qemu-macppc-20230206' of https://github.com/mcayland/qemu into staging
[qemu.git] / tests / tcg / multiarch / test-vma.c
blob2893d60334b959fcfa71db0e967d21c2e3afef61
1 /*
2 * Test very large vma allocations.
3 * The qemu out-of-memory condition was within the mmap syscall itself.
4 * If the syscall actually returns with MAP_FAILED, the test succeeded.
5 */
6 #include <sys/mman.h>
8 int main()
10 int n = sizeof(size_t) == 4 ? 32 : 45;
12 for (int i = 28; i < n; i++) {
13 size_t l = (size_t)1 << i;
14 void *p = mmap(0, l, PROT_NONE,
15 MAP_PRIVATE | MAP_ANONYMOUS | MAP_NORESERVE, -1, 0);
16 if (p == MAP_FAILED) {
17 break;
19 munmap(p, l);
21 return 0;