From f47b69e1f0b0ef032114b133c9e08c674a183c20 Mon Sep 17 00:00:00 2001 From: Gregory Nutt Date: Sun, 10 Jul 2016 16:55:32 -0600 Subject: [PATCH] Add support for adjtime system call --- include/sys/syscall.h | 7 ++++++- include/sys/time.h | 2 +- sched/clock/clock_timekeeping.c | 2 +- syscall/syscall.csv | 1 + syscall/syscall_lookup.h | 3 +++ syscall/syscall_stublookup.c | 1 + 6 files changed, 13 insertions(+), 3 deletions(-) diff --git a/include/sys/syscall.h b/include/sys/syscall.h index 389c11bf08f..b36f45ebafe 100644 --- a/include/sys/syscall.h +++ b/include/sys/syscall.h @@ -215,7 +215,12 @@ #define SYS_clock_getres (__SYS_clock+1) #define SYS_clock_gettime (__SYS_clock+2) #define SYS_clock_settime (__SYS_clock+3) -#define __SYS_timers (__SYS_clock+4) +#ifdef CONFIG_SCHED_TIMEKEEPING +# define SYS_adjtime (__SYS_clock+4) +# define __SYS_timers (__SYS_clock+5) +#else +# define __SYS_timers (__SYS_clock+4) +#endif /* The following are defined only if POSIX timers are supported */ diff --git a/include/sys/time.h b/include/sys/time.h index 688b552320e..70eb1d65c0f 100644 --- a/include/sys/time.h +++ b/include/sys/time.h @@ -228,7 +228,7 @@ int settimeofday(FAR const struct timeval *tv, FAR struct timezone *tz); ****************************************************************************/ #ifdef CONFIG_SCHED_TIMEKEEPING -int adjtime(const struct timeval *delta, struct timeval *olddelta); +int adjtime(FAR const struct timeval *delta, FAR struct timeval *olddelta); #endif #undef EXTERN diff --git a/sched/clock/clock_timekeeping.c b/sched/clock/clock_timekeeping.c index f45440dba07..ceaa234aec0 100644 --- a/sched/clock/clock_timekeeping.c +++ b/sched/clock/clock_timekeeping.c @@ -199,7 +199,7 @@ errout_in_critical_section: * ****************************************************************************/ -int adjtime(const struct timeval *delta, struct timeval *olddelta) +int adjtime(FAR const struct timeval *delta, FAR struct timeval *olddelta) { irqstate_t flags; long adjust_usec; diff --git a/syscall/syscall.csv b/syscall/syscall.csv index 77b7ce750c4..624fe94b88a 100644 --- a/syscall/syscall.csv +++ b/syscall/syscall.csv @@ -1,4 +1,5 @@ "_exit","unistd.h","","void","int" +"adjtime","sys/time.h","defined(CONFIG_SCHED_TIMEKEEPING)","int","FAR const struct timeval *","FAR struct timeval *" "aio_cancel","aio.h","defined(CONFIG_FS_AIO)","int","int","FAR struct aiocb *" "aio_fsync","aio.h","defined(CONFIG_FS_AIO)","int","int","FAR struct aiocb *" "aio_read","aio.h","defined(CONFIG_FS_AIO)","int","FAR struct aiocb *" diff --git a/syscall/syscall_lookup.h b/syscall/syscall_lookup.h index 4cd1a3d6765..91ac53cc320 100644 --- a/syscall/syscall_lookup.h +++ b/syscall/syscall_lookup.h @@ -152,6 +152,9 @@ SYSCALL_LOOKUP(up_assert, 2, STUB_up_assert) SYSCALL_LOOKUP(clock_getres, 2, STUB_clock_getres) SYSCALL_LOOKUP(clock_gettime, 2, STUB_clock_gettime) SYSCALL_LOOKUP(clock_settime, 2, STUB_clock_settime) +#ifdef CONFIG_SCHED_TIMEKEEPING + SYSCALL_LOOKUP(adjtime, 2, STUB_adjtime) +#endif /* The following are defined only if POSIX timers are supported */ diff --git a/syscall/syscall_stublookup.c b/syscall/syscall_stublookup.c index 96862aa4062..4c1217ad74d 100644 --- a/syscall/syscall_stublookup.c +++ b/syscall/syscall_stublookup.c @@ -154,6 +154,7 @@ uintptr_t STUB_clock_systimer(int nbr); uintptr_t STUB_clock_getres(int nbr, uintptr_t parm1, uintptr_t parm2); uintptr_t STUB_clock_gettime(int nbr, uintptr_t parm1, uintptr_t parm2); uintptr_t STUB_clock_settime(int nbr, uintptr_t parm1, uintptr_t parm2); +uintptr_t STUB_adjtime(int nbr, uintptr_t parm1, uintptr_t parm2); /* The following are defined only if POSIX timers are supported */