summaryrefslogtreecommitdiff
path: root/src/regress/lib/libc/malloc/malloc_threaderr/malloc_threaderr.c
diff options
context:
space:
mode:
authorcvs2svn <admin@example.com>2025-04-14 17:32:06 +0000
committercvs2svn <admin@example.com>2025-04-14 17:32:06 +0000
commiteb8dd9dca1228af0cd132f515509051ecfabf6f6 (patch)
treeedb6da6af7e865d488dc1a29309f1e1ec226e603 /src/regress/lib/libc/malloc/malloc_threaderr/malloc_threaderr.c
parent247f0352e0ed72a4f476db9dc91f4d982bc83eb2 (diff)
downloadopenbsd-tb_20250414.tar.gz
openbsd-tb_20250414.tar.bz2
openbsd-tb_20250414.zip
This commit was manufactured by cvs2git to create tag 'tb_20250414'.tb_20250414
Diffstat (limited to 'src/regress/lib/libc/malloc/malloc_threaderr/malloc_threaderr.c')
-rw-r--r--src/regress/lib/libc/malloc/malloc_threaderr/malloc_threaderr.c72
1 files changed, 0 insertions, 72 deletions
diff --git a/src/regress/lib/libc/malloc/malloc_threaderr/malloc_threaderr.c b/src/regress/lib/libc/malloc/malloc_threaderr/malloc_threaderr.c
deleted file mode 100644
index 3c38604ede..0000000000
--- a/src/regress/lib/libc/malloc/malloc_threaderr/malloc_threaderr.c
+++ /dev/null
@@ -1,72 +0,0 @@
1/*
2 * Copyright (c) 2018 Otto Moerbeek <otto@drijf.net>
3 *
4 * Permission to use, copy, modify, and distribute this software for any
5 * purpose with or without fee is hereby granted, provided that the above
6 * copyright notice and this permission notice appear in all copies.
7 *
8 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
9 * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
10 * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
11 * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
12 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
13 * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
14 * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
15 */
16
17#include <err.h>
18#include <pthread.h>
19#include <signal.h>
20#include <stdio.h>
21#include <stdlib.h>
22#include <unistd.h>
23#include <sys/resource.h>
24
25pthread_cond_t cond;
26pthread_mutex_t mutex;
27
28void *p;
29
30void *m(void *arg)
31{
32 p = malloc(100000);
33 if (p == NULL)
34 err(1, NULL);
35 return NULL;
36}
37
38void *f(void *arg)
39{
40 free(p);
41 free(p);
42 return NULL;
43}
44
45void
46catch(int x)
47{
48 _exit(0);
49}
50
51int
52main(void)
53{
54 const struct rlimit lim = {0, 0};
55 pthread_t t1, t2;
56
57 /* prevent coredumps */
58 setrlimit(RLIMIT_CORE, &lim);
59 printf("This test is supposed to print a malloc error\n");
60
61 signal(SIGABRT, catch);
62
63 if (pthread_create(&t1, NULL, m, NULL))
64 err(1, "pthread_create");
65 pthread_join(t1, NULL);
66
67 if (pthread_create(&t2, NULL, f, NULL))
68 err(1, "pthread_create");
69 pthread_join(t2, NULL);
70
71 return 1;
72}