diff options
author | Bjoern B. Brandenburg <bbb@cs.unc.edu> | 2008-02-19 15:51:48 -0500 |
---|---|---|
committer | Bjoern B. Brandenburg <bbb@cs.unc.edu> | 2008-02-19 15:51:48 -0500 |
commit | 176c4d2bc48753bfa0b52dc5cf8cf7b9cfc8a106 (patch) | |
tree | 1b4ecdc15af659081eb44ce421d12c9a724716fe | |
parent | 70427f6589c75d2cff7983f93d58a9728d6eebf2 (diff) |
add wait option to rt_launch
-rw-r--r-- | bin/rt_launch.c | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/bin/rt_launch.c b/bin/rt_launch.c index 2a2b77e..daf91db 100644 --- a/bin/rt_launch.c +++ b/bin/rt_launch.c | |||
@@ -8,6 +8,7 @@ | |||
8 | #include "litmus.h" | 8 | #include "litmus.h" |
9 | 9 | ||
10 | typedef struct { | 10 | typedef struct { |
11 | int wait; | ||
11 | char * exec_path; | 12 | char * exec_path; |
12 | char ** argv; | 13 | char ** argv; |
13 | } startup_info_t; | 14 | } startup_info_t; |
@@ -16,6 +17,11 @@ typedef struct { | |||
16 | int launch(void *task_info_p) { | 17 | int launch(void *task_info_p) { |
17 | startup_info_t *info = (startup_info_t*) task_info_p; | 18 | startup_info_t *info = (startup_info_t*) task_info_p; |
18 | int ret; | 19 | int ret; |
20 | if (info->wait) { | ||
21 | ret = wait_for_ts_release(); | ||
22 | if (ret != 0) | ||
23 | perror("wait_for_ts_release()"); | ||
24 | } | ||
19 | ret = execvp(info->exec_path, info->argv); | 25 | ret = execvp(info->exec_path, info->argv); |
20 | perror("execv failed"); | 26 | perror("execv failed"); |
21 | return ret; | 27 | return ret; |
@@ -37,7 +43,7 @@ void usage(char *error) { | |||
37 | } | 43 | } |
38 | 44 | ||
39 | 45 | ||
40 | #define OPTSTR "p:c:v" | 46 | #define OPTSTR "p:c:vw" |
41 | 47 | ||
42 | int main(int argc, char** argv) | 48 | int main(int argc, char** argv) |
43 | { | 49 | { |
@@ -47,11 +53,15 @@ int main(int argc, char** argv) | |||
47 | int cpu = 0; | 53 | int cpu = 0; |
48 | int opt; | 54 | int opt; |
49 | int verbose = 0; | 55 | int verbose = 0; |
56 | int wait = 0; | ||
50 | startup_info_t info; | 57 | startup_info_t info; |
51 | task_class_t class = RT_CLASS_HARD; | 58 | task_class_t class = RT_CLASS_HARD; |
52 | 59 | ||
53 | while ((opt = getopt(argc, argv, OPTSTR)) != -1) { | 60 | while ((opt = getopt(argc, argv, OPTSTR)) != -1) { |
54 | switch (opt) { | 61 | switch (opt) { |
62 | case 'w': | ||
63 | wait = 1; | ||
64 | break; | ||
55 | case 'v': | 65 | case 'v': |
56 | verbose = 1; | 66 | verbose = 1; |
57 | break; | 67 | break; |
@@ -91,6 +101,7 @@ int main(int argc, char** argv) | |||
91 | } | 101 | } |
92 | info.exec_path = argv[optind + 2]; | 102 | info.exec_path = argv[optind + 2]; |
93 | info.argv = argv + optind + 2; | 103 | info.argv = argv + optind + 2; |
104 | info.wait = wait; | ||
94 | ret = __create_rt_task(launch, &info, cpu, wcet, period, class); | 105 | ret = __create_rt_task(launch, &info, cpu, wcet, period, class); |
95 | 106 | ||
96 | 107 | ||