if (context == NULL)
return FOSA_EINVAL;
- sigsetjmp(*context, 1);
+ context->setjmp_retvalue = sigsetjmp(context->setjmp_context, 1);
return 0;
}
int fosa_long_jump_was_performed(const fosa_long_jump_context_t *context,
int *jumped)
{
- return EINVAL;
+ if (context == NULL)
+ return FOSA_EINVAL;
+
+ *jumped = context->setjmp_retvalue != 0;
+
+ return 0;
}
/**
fosa_long_jump_context_t *context =
(fosa_long_jump_context_t*) info->si_ptr;
- siglongjmp(*context, 1);
+ siglongjmp(context->setjmp_context, -1);
}
/**
int fosa_long_jump_install_handler(fosa_signal_t *signal,
fosa_thread_id_t *handler)
{
+ int ret;
struct sigaction sa_long_jump;
+ *signal = FOSA_LONG_JUMP_SIGNAL;
+ *handler = fosa_thread_self();
+
sa_long_jump.sa_handler = NULL;
sa_long_jump.sa_sigaction = __long_jump_handler;
sigemptyset(&sa_long_jump.sa_mask);
sa_long_jump.sa_flags = SA_SIGINFO;
- handler = NULL;
+ ret = sigaction(*signal, &sa_long_jump, NULL);
- return sigaction(*signal, &sa_long_jump, NULL);
+ return ret ? errno : 0;
}