diff options
Diffstat (limited to 'src/regress/lib/libc/malloc/malloc_ulimit1/malloc_ulimit1.c')
| -rw-r--r-- | src/regress/lib/libc/malloc/malloc_ulimit1/malloc_ulimit1.c | 45 |
1 files changed, 0 insertions, 45 deletions
diff --git a/src/regress/lib/libc/malloc/malloc_ulimit1/malloc_ulimit1.c b/src/regress/lib/libc/malloc/malloc_ulimit1/malloc_ulimit1.c deleted file mode 100644 index 94f7eb16b5..0000000000 --- a/src/regress/lib/libc/malloc/malloc_ulimit1/malloc_ulimit1.c +++ /dev/null | |||
| @@ -1,45 +0,0 @@ | |||
| 1 | /* $OpenBSD: malloc_ulimit1.c,v 1.3 2017/07/27 15:08:37 bluhm Exp $ */ | ||
| 2 | |||
| 3 | /* Public Domain, 2006, Otto Moerbeek <otto@drijf.net> */ | ||
| 4 | |||
| 5 | #include <sys/types.h> | ||
| 6 | #include <sys/time.h> | ||
| 7 | #include <sys/resource.h> | ||
| 8 | #include <err.h> | ||
| 9 | #include <stdlib.h> | ||
| 10 | #include <stdio.h> | ||
| 11 | |||
| 12 | /* | ||
| 13 | * This code tries to trigger the case present in -current as of April | ||
| 14 | * 2006) where the allocation of the region itself succeeds, but the | ||
| 15 | * page dir entry pages fails. | ||
| 16 | * This in turn trips a "hole in directories" error. | ||
| 17 | * Having a large (512M) ulimit -m helps a lot in triggering the | ||
| 18 | * problem. Note that you may need to run this test multiple times to | ||
| 19 | * see the error. | ||
| 20 | */ | ||
| 21 | |||
| 22 | #define STARTI 1300 | ||
| 23 | #define FACTOR 1024 | ||
| 24 | |||
| 25 | int | ||
| 26 | main() | ||
| 27 | { | ||
| 28 | struct rlimit lim; | ||
| 29 | size_t sz; | ||
| 30 | int i; | ||
| 31 | void *p; | ||
| 32 | |||
| 33 | if (getrlimit(RLIMIT_DATA, &lim) == -1) | ||
| 34 | err(1, "getrlimit"); | ||
| 35 | |||
| 36 | sz = lim.rlim_cur / FACTOR; | ||
| 37 | |||
| 38 | for (i = STARTI; i >= 0; i--) { | ||
| 39 | size_t len = (sz-i) * FACTOR; | ||
| 40 | p = malloc(len); | ||
| 41 | free(p); | ||
| 42 | free(malloc(4096)); | ||
| 43 | } | ||
| 44 | return (0); | ||
| 45 | } | ||
