|
|
@ -25,7 +25,6 @@
|
|
|
|
* Process Globals *
|
|
|
|
* Process Globals *
|
|
|
|
******************/
|
|
|
|
******************/
|
|
|
|
|
|
|
|
|
|
|
|
static const int software_interrupt_supported_signals[] = { SIGALRM, SIGUSR1 };
|
|
|
|
|
|
|
|
static uint64_t software_interrupt_interval_duration_in_cycles;
|
|
|
|
static uint64_t software_interrupt_interval_duration_in_cycles;
|
|
|
|
|
|
|
|
|
|
|
|
/******************
|
|
|
|
/******************
|
|
|
@ -284,18 +283,18 @@ software_interrupt_initialize(void)
|
|
|
|
signal_action.sa_flags = SA_SIGINFO | SA_RESTART;
|
|
|
|
signal_action.sa_flags = SA_SIGINFO | SA_RESTART;
|
|
|
|
|
|
|
|
|
|
|
|
/* all threads created by the calling thread will have signal blocked */
|
|
|
|
/* all threads created by the calling thread will have signal blocked */
|
|
|
|
|
|
|
|
/* TODO: What does sa_mask do? I have to call software_interrupt_mask_signal below */
|
|
|
|
// TODO: Unclear about this...
|
|
|
|
|
|
|
|
sigemptyset(&signal_action.sa_mask);
|
|
|
|
sigemptyset(&signal_action.sa_mask);
|
|
|
|
// sigaddset(&signal_action.sa_mask, SIGALRM);
|
|
|
|
sigaddset(&signal_action.sa_mask, SIGALRM);
|
|
|
|
// sigaddset(&signal_action.sa_mask, SIGUSR1);
|
|
|
|
sigaddset(&signal_action.sa_mask, SIGUSR1);
|
|
|
|
|
|
|
|
|
|
|
|
for (int i = 0;
|
|
|
|
const int supported_signals[] = { SIGALRM, SIGUSR1 };
|
|
|
|
i < (sizeof(software_interrupt_supported_signals) / sizeof(software_interrupt_supported_signals[0]));
|
|
|
|
const size_t supported_signals_len = 2;
|
|
|
|
i++) {
|
|
|
|
|
|
|
|
// TODO: Setup masks
|
|
|
|
for (int i = 0; i < supported_signals_len; i++) {
|
|
|
|
int return_code = sigaction(software_interrupt_supported_signals[i], &signal_action, NULL);
|
|
|
|
int signal = supported_signals[i];
|
|
|
|
if (return_code) {
|
|
|
|
software_interrupt_mask_signal(signal);
|
|
|
|
|
|
|
|
if (sigaction(signal, &signal_action, NULL)) {
|
|
|
|
perror("sigaction");
|
|
|
|
perror("sigaction");
|
|
|
|
exit(1);
|
|
|
|
exit(1);
|
|
|
|
}
|
|
|
|
}
|
|
|
|