summaryrefslogtreecommitdiff
path: root/src/regress/lib/libc/malloc/malloc_ulimit1/malloc_ulimit1.c
diff options
context:
space:
mode:
authorcvs2svn <admin@example.com>2025-08-02 06:16:35 +0000
committercvs2svn <admin@example.com>2025-08-02 06:16:35 +0000
commita397c95f8aea58533e72379d6e0de12683ecd0dc (patch)
tree45ccaccd0ce2ea01650f0a9f5e9268a656e17e51 /src/regress/lib/libc/malloc/malloc_ulimit1/malloc_ulimit1.c
parenta79e90e7342954ae2287db505811ca3c1cd336d7 (diff)
downloadopenbsd-tb_20250802.tar.gz
openbsd-tb_20250802.tar.bz2
openbsd-tb_20250802.zip
This commit was manufactured by cvs2git to create tag 'tb_20250802'.tb_20250802
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.c48
1 files changed, 0 insertions, 48 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 7e53c32dbc..0000000000
--- a/src/regress/lib/libc/malloc/malloc_ulimit1/malloc_ulimit1.c
+++ /dev/null
@@ -1,48 +0,0 @@
1/* $OpenBSD: malloc_ulimit1.c,v 1.6 2025/05/24 06:47:27 otto 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/* This test takes forever with junking turned on. */
26const char * const malloc_options = "jj";
27
28int
29main()
30{
31 struct rlimit lim;
32 size_t sz;
33 int i;
34 void *p;
35
36 if (getrlimit(RLIMIT_DATA, &lim) == -1)
37 err(1, "getrlimit");
38
39 sz = lim.rlim_cur / FACTOR;
40
41 for (i = STARTI; i >= 0; i--) {
42 size_t len = (sz-i) * FACTOR;
43 p = malloc(len);
44 free(p);
45 free(malloc(4096));
46 }
47 return (0);
48}