#include #include extern "C" { int sigsetjmp(sigjmp_buf env, int savesigs) { if (savesigs) env->saved = 1, sigprocmask(0, nullptr, &env->set); return setjmp(env->buf); } __noreturn void siglongjmp(sigjmp_buf env, int val) { if (env->saved) sigprocmask(SIG_SETMASK, &env->set, nullptr); longjmp(env->buf, val); } }