From 54dfe4289fd1b9b41f05fca6371c320e6cea35b8 Mon Sep 17 00:00:00 2001 From: Bjoern Brandenburg Date: Wed, 16 Dec 2015 11:35:23 +0100 Subject: Implement get_job_no() via control page --- src/syscalls.c | 9 ++++++++- 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 @@ #include #include "litmus.h" +#include "internal.h" /* Syscall stub for setting RT mode and scheduling options */ @@ -54,7 +55,13 @@ int litmus_unlock(int od) int get_job_no(unsigned int *job_no) { - return syscall(__NR_query_job_no, job_no); + struct control_page* cp = get_ctrl_page(); + if (likely(cp != NULL)) { + *job_no = cp->job_index; + return 0; + } else { + return -1; + } } 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, TESTCASE(job_control_non_rt, ALL, "reject job control for non-rt tasks") { - unsigned int job_no; - SYSCALL_FAILS( EINVAL, sleep_next_period() ); SYSCALL_FAILS( EINVAL, wait_for_job_release(0) ); - - SYSCALL_FAILS( EPERM, get_job_no(&job_no) ); } -- cgit v1.2.2