summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorart <>2002-01-04 13:02:57 +0000
committerart <>2002-01-04 13:02:57 +0000
commitade97ccb075fc58ae21a1877632b1a7f1d14c216 (patch)
tree129aa5298f3eccdcf699797e4bf134fcd9f16879 /src
parentd41fda10f86290cbfc595d63577abd326f4e031d (diff)
downloadopenbsd-ade97ccb075fc58ae21a1877632b1a7f1d14c216.tar.gz
openbsd-ade97ccb075fc58ae21a1877632b1a7f1d14c216.tar.bz2
openbsd-ade97ccb075fc58ae21a1877632b1a7f1d14c216.zip
test for what longjmp(.., 0) does
Diffstat (limited to 'src')
-rw-r--r--src/regress/lib/libc/longjmp/Makefile3
-rw-r--r--src/regress/lib/libc/longjmp/longjmp.c36
2 files changed, 39 insertions, 0 deletions
diff --git a/src/regress/lib/libc/longjmp/Makefile b/src/regress/lib/libc/longjmp/Makefile
new file mode 100644
index 0000000000..1444cd4374
--- /dev/null
+++ b/src/regress/lib/libc/longjmp/Makefile
@@ -0,0 +1,3 @@
1PROG= longjmp
2
3.include <bsd.regress.mk>
diff --git a/src/regress/lib/libc/longjmp/longjmp.c b/src/regress/lib/libc/longjmp/longjmp.c
new file mode 100644
index 0000000000..d8b9fe86bd
--- /dev/null
+++ b/src/regress/lib/libc/longjmp/longjmp.c
@@ -0,0 +1,36 @@
1/* $OpenBSD: longjmp.c,v 1.1 2002/01/04 13:02:57 art Exp $ */
2/*
3 * Artur Grabowski <art@openbsd.org> Public Domain.
4 */
5
6#include <setjmp.h>
7#include <err.h>
8#include <sys/types.h>
9#include <sys/time.h>
10#include <sys/resource.h>
11
12
13jmp_buf buf;
14
15/*
16 * When longjmp is passed the incorrect arg (0), it should translate it into
17 * something better.
18 *
19 * Test is simple. rlimit the cpu time and throw an incorrect longjmp. If 0
20 * is not translated we'll spin until we hit the cpu time limit.
21 */
22int
23main()
24{
25 struct rlimit rl;
26
27 rl.rlim_cur = 2;
28 rl.rlim_max = 2;
29 if (setrlimit(RLIMIT_CPU, &rl) < 0)
30 err(1, "setrlimit");
31
32 if (setjmp(buf) == 0)
33 longjmp(buf, 0);
34
35 return 0;
36}