From 2e31b8abd1f0129c55d150c39e7379cac8b59ff2 Mon Sep 17 00:00:00 2001 From: Tomoki Shirasawa Date: Wed, 13 Jan 2016 14:04:06 +0900 Subject: [PATCH] clock_gettime: clock_id != CLOCK_REALTIME -> offload to linux --- kernel/include/time.h | 4 ++++ kernel/syscall.c | 3 ++- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/kernel/include/time.h b/kernel/include/time.h index ce4b9a53..83e920f5 100644 --- a/kernel/include/time.h +++ b/kernel/include/time.h @@ -20,6 +20,10 @@ #define __TIME_H #define NS_PER_SEC 1000000000UL +#define CLOCK_REALTIME 0 +#define CLOCK_MONOTONIC 1 +#define CLOCK_PROCESS_CPUTIME_ID 2 +#define CLOCK_THREAD_CPUTIME_ID 3 typedef long int __time_t; diff --git a/kernel/syscall.c b/kernel/syscall.c index b3a926ef..a61ed68a 100644 --- a/kernel/syscall.c +++ b/kernel/syscall.c @@ -5083,6 +5083,7 @@ SYSCALL_DECLARE(clock_gettime) { /* TODO: handle clock_id */ struct timespec *ts = (struct timespec *)ihk_mc_syscall_arg1(ctx); + int clock_id = (int)ihk_mc_syscall_arg0(ctx); struct syscall_request request IHK_DMA_ALIGN; int error; struct timespec ats; @@ -5093,7 +5094,7 @@ SYSCALL_DECLARE(clock_gettime) } /* Do it locally if supported */ - if (gettime_local_support) { + if (gettime_local_support && clock_id == CLOCK_REALTIME) { calculate_time_from_tsc(&ats); error = copy_to_user(ts, &ats, sizeof(ats));