Refactor adjtimex based on clock_adjtime
diff mbox series

Message ID 20191030202517.4805-1-adhemerval.zanella@linaro.org
State New
Headers show
Series
  • Refactor adjtimex based on clock_adjtime
Related show

Commit Message

Adhemerval Zanella Oct. 30, 2019, 8:25 p.m. UTC
Checked on x86_64-linux-gnu.
---
 include/time.h                        | 5 +++++
 sysdeps/unix/sysv/linux/adjtimex.c    | 2 +-
 sysdeps/unix/sysv/linux/syscalls.list | 2 +-
 3 files changed, 7 insertions(+), 2 deletions(-)

Comments

Florian Weimer Oct. 31, 2019, 8:48 a.m. UTC | #1
* Adhemerval Zanella:

> diff --git a/sysdeps/unix/sysv/linux/adjtimex.c b/sysdeps/unix/sysv/linux/adjtimex.c
> index 6d62c72a17..95be503109 100644
> --- a/sysdeps/unix/sysv/linux/adjtimex.c
> +++ b/sysdeps/unix/sysv/linux/adjtimex.c
> @@ -22,7 +22,7 @@
>  int
>  ___adjtimex (struct timex *buf)
>  {
> -  return INLINE_SYSCALL_CALL (adjtimex, buf);
> +  return __clock_adjtime (CLOCK_REALTIME, buf);
>  }

Based on my investigation of the kernel sources, both the old and new
system call eventually call do_adjtimex, so this should be okay.

Thanks,
Florian

Patch
diff mbox series

diff --git a/include/time.h b/include/time.h
index caf562a380..000672e3bc 100644
--- a/include/time.h
+++ b/include/time.h
@@ -25,6 +25,11 @@  libc_hidden_proto (__clock_gettime)
 extern __typeof (clock_settime) __clock_settime;
 libc_hidden_proto (__clock_settime)
 
+#ifdef __linux__
+extern __typeof (clock_adjtime) __clock_adjtime;
+libc_hidden_proto (__clock_adjtime);
+#endif
+
 /* Now define the internal interfaces.  */
 struct tm;
 
diff --git a/sysdeps/unix/sysv/linux/adjtimex.c b/sysdeps/unix/sysv/linux/adjtimex.c
index 6d62c72a17..95be503109 100644
--- a/sysdeps/unix/sysv/linux/adjtimex.c
+++ b/sysdeps/unix/sysv/linux/adjtimex.c
@@ -22,7 +22,7 @@ 
 int
 ___adjtimex (struct timex *buf)
 {
-  return INLINE_SYSCALL_CALL (adjtimex, buf);
+  return __clock_adjtime (CLOCK_REALTIME, buf);
 }
 
 #ifdef VERSION_adjtimex
diff --git a/sysdeps/unix/sysv/linux/syscalls.list b/sysdeps/unix/sysv/linux/syscalls.list
index 70b110979b..603e517ca6 100644
--- a/sysdeps/unix/sysv/linux/syscalls.list
+++ b/sysdeps/unix/sysv/linux/syscalls.list
@@ -4,7 +4,7 @@  alarm		-	alarm		i:i	alarm
 bdflush		EXTRA	bdflush		i:ii	__compat_bdflush	bdflush@GLIBC_2.0:GLIBC_2.23
 capget		EXTRA	capget		i:pp	capget
 capset		EXTRA	capset		i:pp	capset
-clock_adjtime	EXTRA	clock_adjtime	i:ip	clock_adjtime
+clock_adjtime	EXTRA	clock_adjtime	i:ip	__clock_adjtime		clock_adjtime
 create_module	EXTRA	create_module	3	__compat_create_module	create_module@GLIBC_2.0:GLIBC_2.23
 delete_module	EXTRA	delete_module	3	delete_module
 epoll_create	EXTRA	epoll_create	i:i	epoll_create