aboutsummaryrefslogtreecommitdiffstats
path: root/bin
diff options
context:
space:
mode:
authorBjoern B. Brandenburg <bbb@cs.unc.edu>2008-05-02 11:19:55 -0400
committerBjoern B. Brandenburg <bbb@cs.unc.edu>2008-05-02 11:19:55 -0400
commit19fdd6f62388ed4373d28ca55b1c63e2fd62bb2f (patch)
treec62267cc060716e796e930e08f8d6c485693edf9 /bin
parent9b85a6e707adff71ea3b329756f2b854fbdc6b0b (diff)
add be task migration support to rt_launch
Diffstat (limited to 'bin')
-rw-r--r--bin/common.c10
-rw-r--r--bin/rt_launch.c15
2 files changed, 21 insertions, 4 deletions
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
6void 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
10typedef struct { 11typedef 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;