E243 minix/minix/tests/test37.c at master · rcitach/minix · GitHub
[go: up one dir, main page]

Skip to content

Latest commit

 

History

History
1055 lines (907 loc) · 26.8 KB

test37.c

File metadata and controls

1055 lines (907 loc) · 26.8 KB
/*--------------------------------------------------------------------------*/
/* Test for setjmp/longjmp.
*
* Catch a signal. While in signal handler do setjmp/longjmp.
*/
void catch14(signo, code, scp)
int signo;
int code;
struct sigcontext *scp;
{
jmp_buf jb;
if (setjmp(jb)) {
x++;
sigreturn(scp);
e(1);
}
y++;
longjmp(jb, 1);
e(2);
}
void test37n()
{
struct sigaction act;
typedef void(*sighandler_t) (int sig);
subtest = 14;
clearsigstate();
x = 0;
y = 0;
act.sa_flags = 0;
sigemptyset(&act.sa_mask);
act.sa_handler = (sighandler_t) catch14; /* fudge */
if (sigaction(SIGSEGV, &act, (struct sigaction *) NULL) == -1) e(3);
if (kill(getpid(), SIGSEGV) == -1) e(4);
if (x != 1) e(5);
if (y != 1) e(6);
}
/*---------------------------------------------------------------------------*/
/* Test for setjmp/longjmp.
*
* Catch a signal. Longjmp out of signal handler.
*/
jmp_buf glo_jb;
void catch15(signo)
int signo;
{
z++;
longjmp(glo_jb, 7);
e(1);
}
void test37o()
{
struct sigaction act;
int k;
0