diff options
Diffstat (limited to 'src/regress/lib/libc/malloc/malloc_errno')
| -rw-r--r-- | src/regress/lib/libc/malloc/malloc_errno/Makefile | 5 | ||||
| -rw-r--r-- | src/regress/lib/libc/malloc/malloc_errno/malloc_errno.c | 49 |
2 files changed, 0 insertions, 54 deletions
diff --git a/src/regress/lib/libc/malloc/malloc_errno/Makefile b/src/regress/lib/libc/malloc/malloc_errno/Makefile deleted file mode 100644 index 73ebe37491..0000000000 --- a/src/regress/lib/libc/malloc/malloc_errno/Makefile +++ /dev/null | |||
| @@ -1,5 +0,0 @@ | |||
| 1 | # $OpenBSD: Makefile,v 1.1 2003/07/15 10:06:31 otto Exp $ | ||
| 2 | |||
| 3 | PROG= malloc_errno | ||
| 4 | |||
| 5 | .include <bsd.regress.mk> | ||
diff --git a/src/regress/lib/libc/malloc/malloc_errno/malloc_errno.c b/src/regress/lib/libc/malloc/malloc_errno/malloc_errno.c deleted file mode 100644 index 1759291f38..0000000000 --- a/src/regress/lib/libc/malloc/malloc_errno/malloc_errno.c +++ /dev/null | |||
| @@ -1,49 +0,0 @@ | |||
| 1 | /* $OpenBSD: malloc_errno.c,v 1.5 2019/06/11 22:16:13 bluhm Exp $ */ | ||
| 2 | /* | ||
| 3 | * Public domain. 2003, Otto Moerbeek | ||
| 4 | */ | ||
| 5 | #include <err.h> | ||
| 6 | #include <errno.h> | ||
| 7 | #include <stdio.h> | ||
| 8 | #include <stdlib.h> | ||
| 9 | |||
| 10 | /* On arm64 with 2G of memory this test hangs while junking. */ | ||
| 11 | char *malloc_options = "jj"; | ||
| 12 | |||
| 13 | static void | ||
| 14 | testerrno(size_t sz) | ||
| 15 | { | ||
| 16 | void *p; | ||
| 17 | |||
| 18 | errno = -1; | ||
| 19 | p = malloc(sz); | ||
| 20 | |||
| 21 | if (p == NULL && errno != ENOMEM) | ||
| 22 | errx(1, "fail: %lx %p %d", (unsigned long)sz, p, errno); | ||
| 23 | |||
| 24 | /* if alloc succeeded, test if errno did not change */ | ||
| 25 | if (p != NULL && errno != -1) | ||
| 26 | errx(1, "fail: %lx %p %d", (unsigned long)sz, p, errno); | ||
| 27 | |||
| 28 | free(p); | ||
| 29 | } | ||
| 30 | |||
| 31 | /* | ||
| 32 | * Provide some (silly) arguments to malloc(), and check if ERRNO is set | ||
| 33 | * correctly. | ||
| 34 | */ | ||
| 35 | int | ||
| 36 | main(int argc, char *argv[]) | ||
| 37 | { | ||
| 38 | size_t i; | ||
| 39 | |||
| 40 | testerrno(1); | ||
| 41 | testerrno(100000); | ||
| 42 | testerrno(-1); | ||
| 43 | testerrno(-1000); | ||
| 44 | testerrno(-10000); | ||
| 45 | testerrno(-10000000); | ||
| 46 | for (i = 0; i < 0x10; i++) | ||
| 47 | testerrno(i * 0x10000000); | ||
| 48 | return 0; | ||
| 49 | } | ||
