diff options
author | Bjoern B. Brandenburg <bbb@cs.unc.edu> | 2008-01-23 11:16:40 -0500 |
---|---|---|
committer | Bjoern B. Brandenburg <bbb@cs.unc.edu> | 2008-01-23 11:16:40 -0500 |
commit | d56b86e42b72abb68ba74bf540ddc259f6b20f84 (patch) | |
tree | a9d78e760bcf4254d883c6242d384f9d1261098f /include | |
parent | 23701920e39a903883f19c2749383bba2a746405 (diff) |
reorganize liblitmus to be more modular
Diffstat (limited to 'include')
-rw-r--r-- | include/internal.h | 21 | ||||
-rw-r--r-- | include/litmus.h | 16 | ||||
-rw-r--r-- | include/syscalls.h | 38 |
3 files changed, 61 insertions, 14 deletions
diff --git a/include/internal.h b/include/internal.h new file mode 100644 index 0000000..25e1573 --- /dev/null +++ b/include/internal.h | |||
@@ -0,0 +1,21 @@ | |||
1 | #ifndef INTERNAL_H | ||
2 | #define INTERNAL_H | ||
3 | |||
4 | /* low level operations, not intended for API use */ | ||
5 | |||
6 | /* prepare a real-time task */ | ||
7 | typedef int (*rt_setup_fn_t)(int pid, void* arg); | ||
8 | int __launch_rt_task(rt_fn_t rt_prog, void *rt_arg, | ||
9 | rt_setup_fn_t setup, void* setup_arg); | ||
10 | |||
11 | #define check(str) \ | ||
12 | if (ret == -1) { \ | ||
13 | perror(str); \ | ||
14 | fprintf(stderr, \ | ||
15 | "Warning: Could not initialize LITMUS^RT, " \ | ||
16 | "%s failed.\n", str \ | ||
17 | ); \ | ||
18 | } | ||
19 | |||
20 | |||
21 | #endif | ||
diff --git a/include/litmus.h b/include/litmus.h index 925cb44..ff21963 100644 --- a/include/litmus.h +++ b/include/litmus.h | |||
@@ -126,12 +126,8 @@ int reg_ics_cb(struct ics_cb* ics_cb); | |||
126 | int start_wcs(int od); | 126 | int start_wcs(int od); |
127 | 127 | ||
128 | /* library functions */ | 128 | /* library functions */ |
129 | void init_litmus(void); | 129 | int init_litmus(void); |
130 | /* exit is currently unused, but was needed for syscall | 130 | void exit_litmus(void); |
131 | * tracing and may be needed in the future. Leave it in | ||
132 | * for the purpose of source code compatability. | ||
133 | */ | ||
134 | #define exit_litmus() {} | ||
135 | 131 | ||
136 | int create_rt_task(rt_fn_t rt_prog, void *arg, int cpu, int wcet, int period); | 132 | int create_rt_task(rt_fn_t rt_prog, void *arg, int cpu, int wcet, int period); |
137 | int __create_rt_task(rt_fn_t rt_prog, void *arg, int cpu, int wcet, | 133 | int __create_rt_task(rt_fn_t rt_prog, void *arg, int cpu, int wcet, |
@@ -157,12 +153,4 @@ void exit_np(void); | |||
157 | */ | 153 | */ |
158 | int litmus_task_active(); | 154 | int litmus_task_active(); |
159 | 155 | ||
160 | |||
161 | /* low level operations, not intended for API use */ | ||
162 | |||
163 | /* prepare a real-time task */ | ||
164 | typedef int (*rt_setup_fn_t)(int pid, void* arg); | ||
165 | int __launch_rt_task(rt_fn_t rt_prog, void *rt_arg, | ||
166 | rt_setup_fn_t setup, void* setup_arg); | ||
167 | |||
168 | #endif | 156 | #endif |
diff --git a/include/syscalls.h b/include/syscalls.h new file mode 100644 index 0000000..28f1a39 --- /dev/null +++ b/include/syscalls.h | |||
@@ -0,0 +1,38 @@ | |||
1 | #ifndef SYSCALLS_H | ||
2 | #define SYSCALLS_H | ||
3 | |||
4 | /* this is missing in newer linux/unistd.h versions */ | ||
5 | |||
6 | #define _syscall0(type,name) \ | ||
7 | type name(void) \ | ||
8 | {\ | ||
9 | return syscall(__NR_##name);\ | ||
10 | } | ||
11 | |||
12 | #define _syscall1(type,name,type1,arg1) \ | ||
13 | type name(type1 arg1) \ | ||
14 | {\ | ||
15 | return syscall(__NR_##name, arg1);\ | ||
16 | } | ||
17 | |||
18 | |||
19 | #define _syscall2(type,name,type1,arg1,type2,arg2) \ | ||
20 | type name(type1 arg1,type2 arg2) \ | ||
21 | {\ | ||
22 | return syscall(__NR_##name, arg1, arg2);\ | ||
23 | } | ||
24 | |||
25 | #define _syscall3(type,name,type1,arg1,type2,arg2,type3,arg3) \ | ||
26 | type name(type1 arg1,type2 arg2, type3 arg3) \ | ||
27 | {\ | ||
28 | return syscall(__NR_##name, arg1, arg2, arg3); \ | ||
29 | } | ||
30 | |||
31 | #define _syscall4(type,name,type1,arg1,type2,arg2,type3,arg3,type4,arg4)\ | ||
32 | type name(type1 arg1,type2 arg2, type3 arg3, type4 arg4) \ | ||
33 | {\ | ||
34 | return syscall(__NR_##name, arg1, arg2, arg3, arg4); \ | ||
35 | } | ||
36 | |||
37 | |||
38 | #endif | ||