summaryrefslogtreecommitdiff
path: root/src/signal/siglongjmp.c
blob: 600d560c875c48d5b070d06a2e3f188765ddea67 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
#include <setjmp.h>
#include <signal.h>
#include <stdlib.h>

void siglongjmp(sigjmp_buf buf, int ret)
{
	unsigned long *flag = buf + sizeof(jmp_buf)/sizeof(long) - 1;
	sigset_t *mask = (void *)(flag + 1);
	if (*flag)
		sigprocmask (SIG_SETMASK, mask, NULL);
	longjmp((void *)buf, ret);
}