diff options
| author | cvs2svn <admin@example.com> | 2025-08-02 06:16:35 +0000 |
|---|---|---|
| committer | cvs2svn <admin@example.com> | 2025-08-02 06:16:35 +0000 |
| commit | a397c95f8aea58533e72379d6e0de12683ecd0dc (patch) | |
| tree | 45ccaccd0ce2ea01650f0a9f5e9268a656e17e51 /src/regress/lib/libc/longjmp | |
| parent | a79e90e7342954ae2287db505811ca3c1cd336d7 (diff) | |
| download | openbsd-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/longjmp')
| -rw-r--r-- | src/regress/lib/libc/longjmp/Makefile | 13 | ||||
| -rw-r--r-- | src/regress/lib/libc/longjmp/longjmp.c | 71 |
2 files changed, 0 insertions, 84 deletions
diff --git a/src/regress/lib/libc/longjmp/Makefile b/src/regress/lib/libc/longjmp/Makefile deleted file mode 100644 index 825e0f86d9..0000000000 --- a/src/regress/lib/libc/longjmp/Makefile +++ /dev/null | |||
| @@ -1,13 +0,0 @@ | |||
| 1 | # $OpenBSD: Makefile,v 1.4 2002/09/02 20:01:43 avsm Exp $ | ||
| 2 | PROG= longjmp | ||
| 3 | |||
| 4 | do-longjmp: ${PROG} | ||
| 5 | ./longjmp | ||
| 6 | |||
| 7 | do-_longjmp: ${PROG} | ||
| 8 | ./longjmp -_ | ||
| 9 | |||
| 10 | REGRESS_TARGETS=do-longjmp do-_longjmp | ||
| 11 | .PHONY: ${REGRESS_TARGETS} | ||
| 12 | |||
| 13 | .include <bsd.regress.mk> | ||
diff --git a/src/regress/lib/libc/longjmp/longjmp.c b/src/regress/lib/libc/longjmp/longjmp.c deleted file mode 100644 index 7dea5bd97c..0000000000 --- a/src/regress/lib/libc/longjmp/longjmp.c +++ /dev/null | |||
| @@ -1,71 +0,0 @@ | |||
| 1 | /* $OpenBSD: longjmp.c,v 1.4 2002/02/18 11:27:45 art Exp $ */ | ||
| 2 | /* | ||
| 3 | * Artur Grabowski <art@openbsd.org>, 2002 Public Domain. | ||
| 4 | */ | ||
| 5 | |||
| 6 | #include <stdio.h> | ||
| 7 | #include <stdlib.h> | ||
| 8 | #include <unistd.h> | ||
| 9 | #include <setjmp.h> | ||
| 10 | #include <err.h> | ||
| 11 | #include <sys/types.h> | ||
| 12 | #include <sys/time.h> | ||
| 13 | #include <sys/resource.h> | ||
| 14 | |||
| 15 | |||
| 16 | jmp_buf buf; | ||
| 17 | |||
| 18 | /* | ||
| 19 | * When longjmp is passed the incorrect arg (0), it should translate it into | ||
| 20 | * something better. | ||
| 21 | * | ||
| 22 | * The rlimit is here in case we start spinning. | ||
| 23 | */ | ||
| 24 | int | ||
| 25 | main(int argc, char **argv) | ||
| 26 | { | ||
| 27 | struct rlimit rl; | ||
| 28 | volatile int i, expect; | ||
| 29 | int (*sj)(jmp_buf); | ||
| 30 | void (*lj)(jmp_buf, int); | ||
| 31 | int ch; | ||
| 32 | extern char *__progname; | ||
| 33 | |||
| 34 | sj = setjmp; | ||
| 35 | lj = longjmp; | ||
| 36 | |||
| 37 | while ((ch = getopt(argc, argv, "_")) != -1) { | ||
| 38 | switch (ch) { | ||
| 39 | case '_': | ||
| 40 | sj = _setjmp; | ||
| 41 | lj = _longjmp; | ||
| 42 | break; | ||
| 43 | default: | ||
| 44 | fprintf(stderr, "Usage: %s [-_]\n", __progname); | ||
| 45 | exit(1); | ||
| 46 | } | ||
| 47 | } | ||
| 48 | |||
| 49 | rl.rlim_cur = 2; | ||
| 50 | rl.rlim_max = 2; | ||
| 51 | if (setrlimit(RLIMIT_CPU, &rl) < 0) | ||
| 52 | err(1, "setrlimit"); | ||
| 53 | |||
| 54 | expect = 0; | ||
| 55 | i = (*sj)(buf); | ||
| 56 | if (i == 0 && expect != 0) | ||
| 57 | errx(1, "setjmp returns 0 on longjmp(.., 0)"); | ||
| 58 | if (expect == 0) { | ||
| 59 | expect = -1; | ||
| 60 | (*lj)(buf, 0); | ||
| 61 | } | ||
| 62 | |||
| 63 | expect = 0; | ||
| 64 | i = (*sj)(buf); | ||
| 65 | if (i != expect) | ||
| 66 | errx(1, "bad return from setjmp %d/%d", expect, i); | ||
| 67 | if (expect < 1000) | ||
| 68 | (*lj)(buf, expect += 2); | ||
| 69 | |||
| 70 | return 0; | ||
| 71 | } | ||
