diff options
author | Glenn Elliott <gelliott@cs.unc.edu> | 2012-09-07 23:22:38 -0400 |
---|---|---|
committer | Glenn Elliott <gelliott@cs.unc.edu> | 2012-09-07 23:24:15 -0400 |
commit | 4829f4175482e0a4ad8f282dd0441904c33e2f97 (patch) | |
tree | 1ea66f39beaa1f1fcad08763eebc90537a403b5f /bin | |
parent | 12587122ff78adffa2e8bcb571962d8f19365fb9 (diff) |
Added signal-related comments. Made g++ friendly.prop/litmus-signals
Diffstat (limited to 'bin')
-rw-r--r-- | bin/rt_launch.c | 8 | ||||
-rw-r--r-- | bin/rtspin.c | 19 |
2 files changed, 15 insertions, 12 deletions
diff --git a/bin/rt_launch.c b/bin/rt_launch.c index 3863031..84a5e6c 100644 --- a/bin/rt_launch.c +++ b/bin/rt_launch.c | |||
@@ -54,7 +54,7 @@ int main(int argc, char** argv) | |||
54 | int verbose = 0; | 54 | int verbose = 0; |
55 | int wait = 0; | 55 | int wait = 0; |
56 | startup_info_t info; | 56 | startup_info_t info; |
57 | task_class_t class = RT_CLASS_HARD; | 57 | task_class_t rt_class = RT_CLASS_HARD; |
58 | 58 | ||
59 | while ((opt = getopt(argc, argv, OPTSTR)) != -1) { | 59 | while ((opt = getopt(argc, argv, OPTSTR)) != -1) { |
60 | switch (opt) { | 60 | switch (opt) { |
@@ -69,8 +69,8 @@ int main(int argc, char** argv) | |||
69 | migrate = 1; | 69 | migrate = 1; |
70 | break; | 70 | break; |
71 | case 'c': | 71 | case 'c': |
72 | class = str2class(optarg); | 72 | rt_class = str2class(optarg); |
73 | if (class == -1) | 73 | if (rt_class == -1) |
74 | usage("Unknown task class."); | 74 | usage("Unknown task class."); |
75 | break; | 75 | break; |
76 | 76 | ||
@@ -107,7 +107,7 @@ int main(int argc, char** argv) | |||
107 | if (ret < 0) | 107 | if (ret < 0) |
108 | bail_out("could not migrate to target partition"); | 108 | bail_out("could not migrate to target partition"); |
109 | } | 109 | } |
110 | ret = __create_rt_task(launch, &info, cpu, wcet, period, class); | 110 | ret = __create_rt_task(launch, &info, cpu, wcet, period, rt_class); |
111 | 111 | ||
112 | 112 | ||
113 | if (ret < 0) | 113 | if (ret < 0) |
diff --git a/bin/rtspin.c b/bin/rtspin.c index 1daed82..8ee26d5 100644 --- a/bin/rtspin.c +++ b/bin/rtspin.c | |||
@@ -67,7 +67,7 @@ static void get_exec_times(const char *file, const int column, | |||
67 | bail_out("rewinding file failed"); | 67 | bail_out("rewinding file failed"); |
68 | 68 | ||
69 | /* allocate space for exec times */ | 69 | /* allocate space for exec times */ |
70 | *exec_times = calloc(*num_jobs, sizeof(*exec_times)); | 70 | *exec_times = (double*)calloc(*num_jobs, sizeof(*exec_times)); |
71 | if (!*exec_times) | 71 | if (!*exec_times) |
72 | bail_out("couldn't allocate memory"); | 72 | bail_out("couldn't allocate memory"); |
73 | 73 | ||
@@ -161,7 +161,7 @@ static int job(double exec_time, double program_end) | |||
161 | loop_for(exec_time, program_end + 1); | 161 | loop_for(exec_time, program_end + 1); |
162 | } | 162 | } |
163 | LITMUS_CATCH(SIG_BUDGET) { | 163 | LITMUS_CATCH(SIG_BUDGET) { |
164 | printf("Exhausted budget! Finishing job NOW!\n"); | 164 | fprintf(stdout, "Exhausted budget! Finishing job NOW!\n"); |
165 | } | 165 | } |
166 | END_LITMUS_TRY; | 166 | END_LITMUS_TRY; |
167 | } | 167 | } |
@@ -193,7 +193,7 @@ int main(int argc, char** argv) | |||
193 | double duration = 0, start; | 193 | double duration = 0, start; |
194 | double *exec_times = NULL; | 194 | double *exec_times = NULL; |
195 | double scale = 1.0; | 195 | double scale = 1.0; |
196 | task_class_t class = RT_CLASS_HARD; | 196 | task_class_t rt_class = RT_CLASS_HARD; |
197 | int cur_job, num_jobs; | 197 | int cur_job, num_jobs; |
198 | 198 | ||
199 | progname = argv[0]; | 199 | progname = argv[0]; |
@@ -208,8 +208,8 @@ int main(int argc, char** argv) | |||
208 | migrate = 1; | 208 | migrate = 1; |
209 | break; | 209 | break; |
210 | case 'c': | 210 | case 'c': |
211 | class = str2class(optarg); | 211 | rt_class = str2class(optarg); |
212 | if (class == -1) | 212 | if (rt_class == -1) |
213 | usage("Unknown task class."); | 213 | usage("Unknown task class."); |
214 | break; | 214 | break; |
215 | case 'e': | 215 | case 'e': |
@@ -290,7 +290,7 @@ int main(int argc, char** argv) | |||
290 | bail_out("could not migrate to target partition"); | 290 | bail_out("could not migrate to target partition"); |
291 | } | 291 | } |
292 | 292 | ||
293 | ret = sporadic_task_ns(wcet, period, 0, cpu, class, | 293 | ret = sporadic_task_ns(wcet, period, 0, cpu, rt_class, |
294 | want_enforcement ? PRECISE_ENFORCEMENT | 294 | want_enforcement ? PRECISE_ENFORCEMENT |
295 | : NO_ENFORCEMENT, | 295 | : NO_ENFORCEMENT, |
296 | want_signals ? PRECISE_SIGNALS | 296 | want_signals ? PRECISE_SIGNALS |
@@ -303,7 +303,7 @@ int main(int argc, char** argv) | |||
303 | 303 | ||
304 | if (want_signals) { | 304 | if (want_signals) { |
305 | /* bind default longjmp signal handler to SIG_BUDGET. */ | 305 | /* bind default longjmp signal handler to SIG_BUDGET. */ |
306 | activate_litmus_signals(SIG_BUDGET_MASK, longjmp_on_litmus_signal); | 306 | activate_litmus_signals(SIG_BUDGET_MASK, longjmp_on_litmus_signal); |
307 | } | 307 | } |
308 | 308 | ||
309 | ret = task_mode(LITMUS_RT_TASK); | 309 | ret = task_mode(LITMUS_RT_TASK); |
@@ -327,7 +327,10 @@ int main(int argc, char** argv) | |||
327 | } | 327 | } |
328 | } else { | 328 | } else { |
329 | /* conver to seconds and scale */ | 329 | /* conver to seconds and scale */ |
330 | while (job(wcet_ms * 0.001 * scale, start + duration)); | 330 | int run = 1; |
331 | while (run) { | ||
332 | run = job(wcet_ms * 0.001 * scale, start + duration); | ||
333 | } | ||
331 | } | 334 | } |
332 | 335 | ||
333 | ret = task_mode(BACKGROUND_TASK); | 336 | ret = task_mode(BACKGROUND_TASK); |