aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorztong <ztong@cs.unc.edu>2021-03-10 02:04:29 -0500
committerztong <ztong@cs.unc.edu>2021-03-10 02:04:29 -0500
commitcd4c9a86e447690fe1b66545b9c141432f017237 (patch)
tree60139e0d9eb8022fbfcc094083ca3188a4598200
parent25ac2658a464052c0ba8ff5454e6c8b131de0025 (diff)
Support exit_fz to cancel_watchdog in kernel, suppor signal handling in rtspin
-rw-r--r--bin/rtspin.c10
-rw-r--r--src/syscalls.c2
2 files changed, 11 insertions, 1 deletions
diff --git a/bin/rtspin.c b/bin/rtspin.c
index 881d155..a47e3e7 100644
--- a/bin/rtspin.c
+++ b/bin/rtspin.c
@@ -11,6 +11,7 @@
11#include <inttypes.h> 11#include <inttypes.h>
12#include <sys/mman.h> 12#include <sys/mman.h>
13#include <errno.h> 13#include <errno.h>
14#include <signal.h>
14 15
15#include "litmus.h" 16#include "litmus.h"
16#include "common.h" 17#include "common.h"
@@ -104,6 +105,11 @@ static void usage(char *error) {
104 exit(error ? EXIT_FAILURE : EXIT_SUCCESS); 105 exit(error ? EXIT_FAILURE : EXIT_SUCCESS);
105} 106}
106 107
108void default_sig_handler(int sig) {
109 if (sig == SIGSYS)
110 return;
111}
112
107#define NUMS 4096 113#define NUMS 4096
108static int num[NUMS]; 114static int num[NUMS];
109static char* progname; 115static char* progname;
@@ -304,6 +310,10 @@ static void job(double exec_time, double program_end, int lock_od, double cs_len
304{ 310{
305 double chunk1, chunk2; 311 double chunk1, chunk2;
306 int lock_res; 312 int lock_res;
313 struct sigaction handler;
314 memset(&handler, 0, sizeof(handler));
315 handler.sa_handler = default_sig_handler;
316 sigaction(SIGSYS, &handler, NULL);
307 317
308 if (lock_od >= 0) { 318 if (lock_od >= 0) {
309 /* simulate critical section somewhere in the middle */ 319 /* simulate critical section somewhere in the middle */
diff --git a/src/syscalls.c b/src/syscalls.c
index cb90908..ec5cbe9 100644
--- a/src/syscalls.c
+++ b/src/syscalls.c
@@ -101,7 +101,7 @@ int litmus_access_forbidden_zone_check(int od, lt_t fz_len, lt_t panic_len)
101int litmus_set_fz_launch_done(int od) 101int litmus_set_fz_launch_done(int od)
102{ 102{
103 // Call the exit_forbidden_zone litmus call to cancel the timer 103 // Call the exit_forbidden_zone litmus call to cancel the timer
104 return litmus_syscall(LRT_exit_forbidden_zone, od); 104 return litmus_syscall(LRT_cancel_watchdog, od);
105} 105}
106 106
107int litmus_exit_forbidden_zone(int od) 107int litmus_exit_forbidden_zone(int od)