diff options
author | Bjoern B. Brandenburg <bbb@cs.unc.edu> | 2008-01-28 11:51:50 -0500 |
---|---|---|
committer | Bjoern B. Brandenburg <bbb@cs.unc.edu> | 2008-01-28 11:51:50 -0500 |
commit | dd7350fb8c1e845351f2d3c9ccb186ab8aee8603 (patch) | |
tree | 2f00e76104dbe41e84d39370180e1cf82b0c4f88 | |
parent | ea71ba9e1275495edf9b03b7109fe290d959a47a (diff) |
core: add gettid() system call
We need the system call to enable multi-threaded real-time applications,
and libc doesn't provide it.
-rw-r--r-- | include/litmus.h | 3 | ||||
-rw-r--r-- | src/syscalls.c | 5 |
2 files changed, 8 insertions, 0 deletions
diff --git a/include/litmus.h b/include/litmus.h index 6a1de21..c3cd51d 100644 --- a/include/litmus.h +++ b/include/litmus.h | |||
@@ -45,6 +45,9 @@ typedef struct rt_param { | |||
45 | 45 | ||
46 | typedef int pid_t; /* PID of a task */ | 46 | typedef int pid_t; /* PID of a task */ |
47 | 47 | ||
48 | /* obtain the PID of a thread */ | ||
49 | pid_t gettid(void); | ||
50 | |||
48 | /* scheduler modes */ | 51 | /* scheduler modes */ |
49 | #define MODE_NON_RT 0 | 52 | #define MODE_NON_RT 0 |
50 | #define MODE_RT_RUN 1 | 53 | #define MODE_RT_RUN 1 |
diff --git a/src/syscalls.c b/src/syscalls.c index a42fc62..3b2f76c 100644 --- a/src/syscalls.c +++ b/src/syscalls.c | |||
@@ -3,6 +3,8 @@ | |||
3 | */ | 3 | */ |
4 | #define _GNU_SOURCE | 4 | #define _GNU_SOURCE |
5 | #include <unistd.h> | 5 | #include <unistd.h> |
6 | #include <linux/unistd.h> | ||
7 | #include <sys/types.h> | ||
6 | 8 | ||
7 | #include "litmus.h" | 9 | #include "litmus.h" |
8 | 10 | ||
@@ -36,6 +38,9 @@ struct np_flag; | |||
36 | #define __NR_task_mode 343 | 38 | #define __NR_task_mode 343 |
37 | 39 | ||
38 | /* Syscall stub for setting RT mode and scheduling options */ | 40 | /* Syscall stub for setting RT mode and scheduling options */ |
41 | |||
42 | _syscall0(pid_t, gettid); | ||
43 | |||
39 | _syscall0(spolicy, sched_getpolicy); | 44 | _syscall0(spolicy, sched_getpolicy); |
40 | _syscall1(int, set_rt_mode, int, arg1); | 45 | _syscall1(int, set_rt_mode, int, arg1); |
41 | _syscall2(int, set_rt_task_param, pid_t, pid, rt_param_t*, arg1); | 46 | _syscall2(int, set_rt_task_param, pid_t, pid, rt_param_t*, arg1); |