From 6f82d0e8f9756938f04071892206a5af85e676f0 Mon Sep 17 00:00:00 2001 From: cvs2svn Date: Fri, 13 Jul 2012 17:49:56 +0000 Subject: This commit was manufactured by cvs2git to create tag 'eric_g2k12'. --- src/regress/lib/libc/malloc/Makefile | 7 -- src/regress/lib/libc/malloc/malloc0test/Makefile | 5 - .../lib/libc/malloc/malloc0test/malloc0test.c | 120 --------------------- src/regress/lib/libc/malloc/malloc_errno/Makefile | 5 - .../lib/libc/malloc/malloc_errno/malloc_errno.c | 46 -------- .../lib/libc/malloc/malloc_ulimit1/Makefile | 5 - .../libc/malloc/malloc_ulimit1/malloc_ulimit1.c | 44 -------- .../lib/libc/malloc/malloc_ulimit2/Makefile | 5 - .../libc/malloc/malloc_ulimit2/malloc_ulimit2.c | 42 -------- 9 files changed, 279 deletions(-) delete mode 100644 src/regress/lib/libc/malloc/Makefile delete mode 100644 src/regress/lib/libc/malloc/malloc0test/Makefile delete mode 100644 src/regress/lib/libc/malloc/malloc0test/malloc0test.c delete mode 100644 src/regress/lib/libc/malloc/malloc_errno/Makefile delete mode 100644 src/regress/lib/libc/malloc/malloc_errno/malloc_errno.c delete mode 100644 src/regress/lib/libc/malloc/malloc_ulimit1/Makefile delete mode 100644 src/regress/lib/libc/malloc/malloc_ulimit1/malloc_ulimit1.c delete mode 100644 src/regress/lib/libc/malloc/malloc_ulimit2/Makefile delete mode 100644 src/regress/lib/libc/malloc/malloc_ulimit2/malloc_ulimit2.c (limited to 'src/regress/lib/libc/malloc') diff --git a/src/regress/lib/libc/malloc/Makefile b/src/regress/lib/libc/malloc/Makefile deleted file mode 100644 index 7c919d1bc2..0000000000 --- a/src/regress/lib/libc/malloc/Makefile +++ /dev/null @@ -1,7 +0,0 @@ -# $OpenBSD: Makefile,v 1.5 2006/04/18 19:04:39 otto Exp $ - -SUBDIR+= malloc0test malloc_errno malloc_ulimit1 malloc_ulimit2 - -install: - -.include diff --git a/src/regress/lib/libc/malloc/malloc0test/Makefile b/src/regress/lib/libc/malloc/malloc0test/Makefile deleted file mode 100644 index 8ed8163a79..0000000000 --- a/src/regress/lib/libc/malloc/malloc0test/Makefile +++ /dev/null @@ -1,5 +0,0 @@ -# $OpenBSD: Makefile,v 1.1 2003/07/15 10:09:37 otto Exp $ - -PROG= malloc0test - -.include diff --git a/src/regress/lib/libc/malloc/malloc0test/malloc0test.c b/src/regress/lib/libc/malloc/malloc0test/malloc0test.c deleted file mode 100644 index 06ff0996ee..0000000000 --- a/src/regress/lib/libc/malloc/malloc0test/malloc0test.c +++ /dev/null @@ -1,120 +0,0 @@ -/* $OpenBSD: malloc0test.c,v 1.5 2008/04/13 00:22:17 djm Exp $ */ -/* - * Public domain. 2001, Theo de Raadt - */ -#include -#include -#include -#include -#include -#include -#include -#include - -volatile sig_atomic_t got; -jmp_buf jmp; - -static void -catch(int signo) -{ - got++; - longjmp(jmp, 1); -} - -static int -test(char *p, int size) -{ - signal(SIGSEGV, catch); - got = 0; - if (setjmp(jmp) == 0) - *p = 0; - if (setjmp(jmp) == 0) - *(p+size-1) = 0; - return (got); -} - -char *prot_table[] = { - "unprotected", - "fuckup", - "protected" -}; - -#define SIZE 10 - -/* - * Do random memory allocations. - * - * For each one, ensure that it is at least 16 bytes in size (that - * being what our current malloc returns for the minsize of an - * object, alignment wise); - * - * For zero-byte allocations, check that they are still aligned. - * - * For each object, ensure that they are correctly protected or not - * protected. - * - * Does not regress test malloc + free combinations ... it should. - */ -int -main(int argc, char *argv[]) -{ - caddr_t blob; - int size, tsize; - int prot; - int rval = 0, fuckup = 0; - long limit = 200000, count; - int ch, silent = 0; - char *ep; - extern char *__progname; - - while ((ch = getopt(argc, argv, "sn:")) != -1) { - switch (ch) { - case 's': - silent = 1; - break; - case 'n': - errno = 0; - limit = strtol(optarg, &ep, 10); - if (optarg[0] == '\0' || *ep != '\0' || - (errno == ERANGE && - (limit == LONG_MAX || limit == LONG_MIN))) - goto usage; - break; - default: -usage: - fprintf(stderr, "Usage: %s [-s][-n ]\n", - __progname); - exit(1); - } - } - - if (limit == 0) - limit = LONG_MAX; - - for (count = 0; count < limit; count++) { - size = arc4random_uniform(SIZE); - blob = malloc(size); - if (blob == NULL) { - fprintf(stderr, "success: out of memory\n"); - exit(rval); - } - - tsize = size == 0 ? 16 : size; - fuckup = 0; - prot = test(blob, tsize); - - if (size == 0 && prot < 2) - fuckup = 1; - - if (fuckup) { - printf("%8p %6d %20s %10s\n", blob, size, - prot_table[prot], fuckup ? "fuckup" : ""); - rval = 1; - } - - if (!silent && count % 100000 == 0 && count != 0) - fprintf(stderr, "count = %ld\n", count); - } - - return rval; -} 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 @@ -# $OpenBSD: Makefile,v 1.1 2003/07/15 10:06:31 otto Exp $ - -PROG= malloc_errno - -.include 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 896ea3c900..0000000000 --- a/src/regress/lib/libc/malloc/malloc_errno/malloc_errno.c +++ /dev/null @@ -1,46 +0,0 @@ -/* $OpenBSD: malloc_errno.c,v 1.4 2003/12/25 18:49:57 miod Exp $ */ -/* - * Public domain. 2003, Otto Moerbeek - */ -#include -#include -#include -#include - -static void -testerrno(size_t sz) -{ - void *p; - - errno = -1; - p = malloc(sz); - - if (p == NULL && errno != ENOMEM) - errx(1, "fail: %lx %p %d", (unsigned long)sz, p, errno); - - /* if alloc succeeded, test if errno did not change */ - if (p != NULL && errno != -1) - errx(1, "fail: %lx %p %d", (unsigned long)sz, p, errno); - - free(p); -} - -/* - * Provide some (silly) arguments to malloc(), and check if ERRNO is set - * correctly. - */ -int -main(int argc, char *argv[]) -{ - size_t i; - - testerrno(1); - testerrno(100000); - testerrno(-1); - testerrno(-1000); - testerrno(-10000); - testerrno(-10000000); - for (i = 0; i < 0x10; i++) - testerrno(i * 0x10000000); - return 0; -} diff --git a/src/regress/lib/libc/malloc/malloc_ulimit1/Makefile b/src/regress/lib/libc/malloc/malloc_ulimit1/Makefile deleted file mode 100644 index 46ced27a98..0000000000 --- a/src/regress/lib/libc/malloc/malloc_ulimit1/Makefile +++ /dev/null @@ -1,5 +0,0 @@ -# $OpenBSD: Makefile,v 1.1 2006/04/18 19:03:30 otto Exp $ - -PROG= malloc_ulimit1 - -.include 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 99e805e8e1..0000000000 --- a/src/regress/lib/libc/malloc/malloc_ulimit1/malloc_ulimit1.c +++ /dev/null @@ -1,44 +0,0 @@ -/* $OpenBSD: malloc_ulimit1.c,v 1.2 2006/05/16 05:47:13 otto Exp $ */ - -/* Public Domain, 2006, Otto Moerbeek */ - -#include -#include -#include -#include -#include -#include - -/* - * This code tries to trigger the case present in -current as of April - * 2006) where the allocation of the region itself succeeds, but the - * page dir entry pages fails. - * This in turn trips a "hole in directories" error. - * Having a large (512M) ulimit -m helps a lot in triggering the - * problem. Note that you may need to run this test multiple times to - * see the error. -*/ - -#define STARTI 1300 -#define FACTOR 1024 - -main() -{ - struct rlimit lim; - size_t sz; - int i; - void *p; - - if (getrlimit(RLIMIT_DATA, &lim) == -1) - err(1, "getrlimit"); - - sz = lim.rlim_cur / FACTOR; - - for (i = STARTI; i >= 0; i--) { - size_t len = (sz-i) * FACTOR; - p = malloc(len); - free(p); - free(malloc(4096)); - } - return (0); -} diff --git a/src/regress/lib/libc/malloc/malloc_ulimit2/Makefile b/src/regress/lib/libc/malloc/malloc_ulimit2/Makefile deleted file mode 100644 index bc83666415..0000000000 --- a/src/regress/lib/libc/malloc/malloc_ulimit2/Makefile +++ /dev/null @@ -1,5 +0,0 @@ -# $OpenBSD: Makefile,v 1.1 2006/04/18 19:04:03 otto Exp $ - -PROG= malloc_ulimit2 - -.include diff --git a/src/regress/lib/libc/malloc/malloc_ulimit2/malloc_ulimit2.c b/src/regress/lib/libc/malloc/malloc_ulimit2/malloc_ulimit2.c deleted file mode 100644 index ca8e8f438a..0000000000 --- a/src/regress/lib/libc/malloc/malloc_ulimit2/malloc_ulimit2.c +++ /dev/null @@ -1,42 +0,0 @@ -/* $OpenBSD: malloc_ulimit2.c,v 1.2 2006/05/16 05:47:13 otto Exp $ */ - -/* Public Domain, 2006, Otto Moerbeek */ - -#include -#include -#include -#include -#include -#include - -#define FACTOR 1024 - -main() -{ - struct rlimit lim; - size_t sz; - int i; - void *p; - - if (getrlimit(RLIMIT_DATA, &lim) == -1) - err(1, "getrlimit"); - - sz = lim.rlim_cur / FACTOR; - - for (i = 0; ; i++) { - size_t len = (sz-i) * FACTOR; - p = malloc(len); - if (p != NULL) { - free(p); - break; - } - } - i += 10; - for (; i >= 0; i--) { - size_t len = (sz-i) * FACTOR; - p = malloc(len); - free(p); - free(malloc(4096)); - } - return (0); -} -- cgit v1.2.3-55-g6feb