diff options
| author | Bjoern Brandenburg <bbb@mpi-sws.org> | 2015-12-16 05:35:23 -0500 |
|---|---|---|
| committer | Bjoern Brandenburg <bbb@mpi-sws.org> | 2015-12-16 05:35:23 -0500 |
| commit | 54dfe4289fd1b9b41f05fca6371c320e6cea35b8 (patch) | |
| tree | aff4e024eac5279678cf7836a776a2bb7a0c9ba6 | |
| parent | 68849a8cd97718109dce1e548b099239376f3f2e (diff) | |
Implement get_job_no() via control page
| -rw-r--r-- | src/syscalls.c | 9 | ||||
| -rw-r--r-- | tests/core_api.c | 4 |
2 files changed, 8 insertions, 5 deletions
diff --git a/src/syscalls.c b/src/syscalls.c index 0ee1a80..0950ca6 100644 --- a/src/syscalls.c +++ b/src/syscalls.c | |||
| @@ -9,6 +9,7 @@ | |||
| 9 | #include <unistd.h> | 9 | #include <unistd.h> |
| 10 | 10 | ||
| 11 | #include "litmus.h" | 11 | #include "litmus.h" |
| 12 | #include "internal.h" | ||
| 12 | 13 | ||
| 13 | /* Syscall stub for setting RT mode and scheduling options */ | 14 | /* Syscall stub for setting RT mode and scheduling options */ |
| 14 | 15 | ||
| @@ -54,7 +55,13 @@ int litmus_unlock(int od) | |||
| 54 | 55 | ||
| 55 | int get_job_no(unsigned int *job_no) | 56 | int get_job_no(unsigned int *job_no) |
| 56 | { | 57 | { |
| 57 | return syscall(__NR_query_job_no, job_no); | 58 | struct control_page* cp = get_ctrl_page(); |
| 59 | if (likely(cp != NULL)) { | ||
| 60 | *job_no = cp->job_index; | ||
| 61 | return 0; | ||
| 62 | } else { | ||
| 63 | return -1; | ||
| 64 | } | ||
| 58 | } | 65 | } |
| 59 | 66 | ||
| 60 | int wait_for_job_release(unsigned int job_no) | 67 | int wait_for_job_release(unsigned int job_no) |
diff --git a/tests/core_api.c b/tests/core_api.c index 8cb5588..95ca69b 100644 --- a/tests/core_api.c +++ b/tests/core_api.c | |||
| @@ -105,13 +105,9 @@ TESTCASE(accept_valid_priorities, P_FP, | |||
| 105 | TESTCASE(job_control_non_rt, ALL, | 105 | TESTCASE(job_control_non_rt, ALL, |
| 106 | "reject job control for non-rt tasks") | 106 | "reject job control for non-rt tasks") |
| 107 | { | 107 | { |
| 108 | unsigned int job_no; | ||
| 109 | |||
| 110 | SYSCALL_FAILS( EINVAL, sleep_next_period() ); | 108 | SYSCALL_FAILS( EINVAL, sleep_next_period() ); |
| 111 | 109 | ||
| 112 | SYSCALL_FAILS( EINVAL, wait_for_job_release(0) ); | 110 | SYSCALL_FAILS( EINVAL, wait_for_job_release(0) ); |
| 113 | |||
| 114 | SYSCALL_FAILS( EPERM, get_job_no(&job_no) ); | ||
| 115 | } | 111 | } |
| 116 | 112 | ||
| 117 | 113 | ||
