clock_gettime: clock_id != CLOCK_REALTIME -> offload to linux

This commit is contained in:
Tomoki Shirasawa
2016-01-13 14:04:06 +09:00
parent a42ee00101
commit 2e31b8abd1
2 changed files with 6 additions and 1 deletions

View File

@ -20,6 +20,10 @@
#define __TIME_H #define __TIME_H
#define NS_PER_SEC 1000000000UL #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; typedef long int __time_t;

View File

@ -5083,6 +5083,7 @@ SYSCALL_DECLARE(clock_gettime)
{ {
/* TODO: handle clock_id */ /* TODO: handle clock_id */
struct timespec *ts = (struct timespec *)ihk_mc_syscall_arg1(ctx); 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; struct syscall_request request IHK_DMA_ALIGN;
int error; int error;
struct timespec ats; struct timespec ats;
@ -5093,7 +5094,7 @@ SYSCALL_DECLARE(clock_gettime)
} }
/* Do it locally if supported */ /* Do it locally if supported */
if (gettime_local_support) { if (gettime_local_support && clock_id == CLOCK_REALTIME) {
calculate_time_from_tsc(&ats); calculate_time_from_tsc(&ats);
error = copy_to_user(ts, &ats, sizeof(ats)); error = copy_to_user(ts, &ats, sizeof(ats));