diff options
| -rw-r--r-- | Makefile | 4 | ||||
| -rw-r--r-- | bin/common.c | 10 | ||||
| -rw-r--r-- | bin/rt_launch.c | 15 | ||||
| -rw-r--r-- | include/common.h | 7 |
4 files changed, 30 insertions, 6 deletions
| @@ -46,8 +46,8 @@ np_test: np_test.o litmus.h liblitmus.a | |||
| 46 | run: run.o ${LIBS} | 46 | run: run.o ${LIBS} |
| 47 | cc -o run run.o ${LIBS} | 47 | cc -o run run.o ${LIBS} |
| 48 | 48 | ||
| 49 | rt_launch: liblitmus.a litmus.h rt_launch.o | 49 | rt_launch: liblitmus.a litmus.h rt_launch.o common.o |
| 50 | cc -static -o rt_launch rt_launch.o ${LIBS} | 50 | cc -static -o rt_launch rt_launch.o common.o ${LIBS} |
| 51 | 51 | ||
| 52 | release_ts: liblitmus.a litmus.h release_ts.o | 52 | release_ts: liblitmus.a litmus.h release_ts.o |
| 53 | cc -static -o release_ts release_ts.o ${LIBS} | 53 | cc -static -o release_ts release_ts.o ${LIBS} |
diff --git a/bin/common.c b/bin/common.c new file mode 100644 index 0000000..0a5f5c5 --- /dev/null +++ b/bin/common.c | |||
| @@ -0,0 +1,10 @@ | |||
| 1 | #include <stdio.h> | ||
| 2 | #include <errno.h> | ||
| 3 | |||
| 4 | #include "common.h" | ||
| 5 | |||
| 6 | void bail_out(const char* msg) | ||
| 7 | { | ||
| 8 | perror(msg); | ||
| 9 | exit(-1 * errno); | ||
| 10 | } | ||
diff --git a/bin/rt_launch.c b/bin/rt_launch.c index daf91db..66cb21f 100644 --- a/bin/rt_launch.c +++ b/bin/rt_launch.c | |||
| @@ -6,6 +6,7 @@ | |||
| 6 | #include <signal.h> | 6 | #include <signal.h> |
| 7 | 7 | ||
| 8 | #include "litmus.h" | 8 | #include "litmus.h" |
| 9 | #include "common.h" | ||
| 9 | 10 | ||
| 10 | typedef struct { | 11 | typedef struct { |
| 11 | int wait; | 12 | int wait; |
| @@ -50,6 +51,7 @@ int main(int argc, char** argv) | |||
| 50 | int ret; | 51 | int ret; |
| 51 | lt_t wcet; | 52 | lt_t wcet; |
| 52 | lt_t period; | 53 | lt_t period; |
| 54 | int migrate = 0; | ||
| 53 | int cpu = 0; | 55 | int cpu = 0; |
| 54 | int opt; | 56 | int opt; |
| 55 | int verbose = 0; | 57 | int verbose = 0; |
| @@ -67,6 +69,7 @@ int main(int argc, char** argv) | |||
| 67 | break; | 69 | break; |
| 68 | case 'p': | 70 | case 'p': |
| 69 | cpu = atoi(optarg); | 71 | cpu = atoi(optarg); |
| 72 | migrate = 1; | ||
| 70 | break; | 73 | break; |
| 71 | case 'c': | 74 | case 'c': |
| 72 | class = str2class(optarg); | 75 | class = str2class(optarg); |
| @@ -102,13 +105,17 @@ int main(int argc, char** argv) | |||
| 102 | info.exec_path = argv[optind + 2]; | 105 | info.exec_path = argv[optind + 2]; |
| 103 | info.argv = argv + optind + 2; | 106 | info.argv = argv + optind + 2; |
| 104 | info.wait = wait; | 107 | info.wait = wait; |
| 108 | if (migrate) { | ||
| 109 | ret = be_migrate_to(cpu); | ||
| 110 | if (ret < 0) | ||
| 111 | bail_out("could not migrate to target partition"); | ||
| 112 | } | ||
| 105 | ret = __create_rt_task(launch, &info, cpu, wcet, period, class); | 113 | ret = __create_rt_task(launch, &info, cpu, wcet, period, class); |
| 106 | 114 | ||
| 107 | 115 | ||
| 108 | if (ret < 0) { | 116 | if (ret < 0) |
| 109 | perror("Could not create rt child process"); | 117 | bail_out("could not create rt child process"); |
| 110 | return 2; | 118 | else if (verbose) |
| 111 | } else if (verbose) | ||
| 112 | printf("%d\n", ret); | 119 | printf("%d\n", ret); |
| 113 | 120 | ||
| 114 | return 0; | 121 | return 0; |
diff --git a/include/common.h b/include/common.h new file mode 100644 index 0000000..d1234ba --- /dev/null +++ b/include/common.h | |||
| @@ -0,0 +1,7 @@ | |||
| 1 | #ifndef COMMON_H | ||
| 2 | #define COMMON_H | ||
| 3 | |||
| 4 | |||
| 5 | void bail_out(const char* msg); | ||
| 6 | |||
| 7 | #endif | ||
