about summary refs log tree commit diff
path: root/sysdeps/unix/sysv/linux
diff options
context:
space:
mode:
authorUlrich Drepper <drepper@redhat.com>2009-11-22 11:07:04 -0800
committerUlrich Drepper <drepper@redhat.com>2009-11-22 11:07:04 -0800
commiteb4157390cac6212921ef198353635e138dc0a00 (patch)
treee0f2fd59ab88aa6e36db17432e705c8b3c6a3a51 /sysdeps/unix/sysv/linux
parent89b432d7a5befb85048c97e881b2106e8df58e43 (diff)
downloadglibc-eb4157390cac6212921ef198353635e138dc0a00.tar.gz
glibc-eb4157390cac6212921ef198353635e138dc0a00.tar.xz
glibc-eb4157390cac6212921ef198353635e138dc0a00.zip
Update ntp_gettime for Linux.
The ntp_gettime implementation of NTP exports the tai field the kernel
now produces.  This requires an ABI change since the ntptimeval structure
changed.  Upstream kept the same name, there is nothing to do.  This
patch changes the ntptimeval structure but keeps the old ntp_gettime
definition.  A new ntp_gettimex function which is transparently invoked
through the old name is introduced.  This has the advantage that even
object files can remain compatible.  This wouldn't be the case if
symbol versioning would be used to overload the name ntp_gettime.
Diffstat (limited to 'sysdeps/unix/sysv/linux')
-rw-r--r--sysdeps/unix/sysv/linux/Makefile6
-rw-r--r--sysdeps/unix/sysv/linux/Versions2
-rw-r--r--sysdeps/unix/sysv/linux/ntp_gettime.c9
-rw-r--r--sysdeps/unix/sysv/linux/ntp_gettimex.c46
-rw-r--r--sysdeps/unix/sysv/linux/sys/timex.h16
5 files changed, 72 insertions, 7 deletions
diff --git a/sysdeps/unix/sysv/linux/Makefile b/sysdeps/unix/sysv/linux/Makefile
index cee5d29255..91c123b2b3 100644
--- a/sysdeps/unix/sysv/linux/Makefile
+++ b/sysdeps/unix/sysv/linux/Makefile
@@ -84,8 +84,8 @@ endif
 $(inst_includedir)/bits/syscall.h: $(objpfx)syscall-list.h $(+force)
 	$(make-target-directory)
 	if test -r $@ && cmp -s $< $@; \
-        then echo 'bits/syscall.h unchanged'; \
-        else $(INSTALL_DATA) $< $@; fi
+	then echo 'bits/syscall.h unchanged'; \
+	else $(INSTALL_DATA) $< $@; fi
 
 ifndef no_deps
 # Get the generated list of dependencies (probably /usr/include/asm/unistd.h).
@@ -97,7 +97,7 @@ endif
 ifeq ($(subdir),time)
 sysdep_headers += sys/timex.h
 
-sysdep_routines += ntp_gettime
+sysdep_routines += ntp_gettime ntp_gettimex
 endif
 
 ifeq ($(subdir),socket)
diff --git a/sysdeps/unix/sysv/linux/Versions b/sysdeps/unix/sysv/linux/Versions
index 4c9129bed3..50c70513ff 100644
--- a/sysdeps/unix/sysv/linux/Versions
+++ b/sysdeps/unix/sysv/linux/Versions
@@ -144,6 +144,8 @@ libc {
   GLIBC_2.12 {
     #errlist-compat	134
     _sys_errlist; sys_errlist; _sys_nerr; sys_nerr;
+
+    ntp_gettimex;
   }
   GLIBC_PRIVATE {
     # functions used in other libraries
diff --git a/sysdeps/unix/sysv/linux/ntp_gettime.c b/sysdeps/unix/sysv/linux/ntp_gettime.c
index f78f1682fa..8bae0d9f6f 100644
--- a/sysdeps/unix/sysv/linux/ntp_gettime.c
+++ b/sysdeps/unix/sysv/linux/ntp_gettime.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1999, 2002 Free Software Foundation, Inc.
+/* Copyright (C) 1999, 2002, 2009 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
 
    The GNU C Library is free software; you can redistribute it and/or
@@ -16,8 +16,12 @@
    Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
    02111-1307 USA.  */
 
+#define ntp_gettime ntp_gettime_redirect
+
 #include <sys/timex.h>
 
+#undef ntp_gettime
+
 #ifndef MOD_OFFSET
 # define modes mode
 #endif
@@ -27,8 +31,7 @@ extern int INTUSE(__adjtimex) (struct timex *__ntx);
 
 
 int
-ntp_gettime (ntv)
-     struct ntptimeval *ntv;
+ntp_gettime (struct ntptimeval *ntv)
 {
   struct timex tntx;
   int result;
diff --git a/sysdeps/unix/sysv/linux/ntp_gettimex.c b/sysdeps/unix/sysv/linux/ntp_gettimex.c
new file mode 100644
index 0000000000..ed7851b6fd
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/ntp_gettimex.c
@@ -0,0 +1,46 @@
+/* Copyright (C) 1999, 2002, 2009 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 of the License, or (at your option) any later version.
+
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library; if not, write to the Free
+   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+   02111-1307 USA.  */
+
+#include <sys/timex.h>
+
+#ifndef MOD_OFFSET
+# define modes mode
+#endif
+
+
+extern int INTUSE(__adjtimex) (struct timex *__ntx);
+
+
+int
+ntp_gettimex (struct ntptimeval *ntv)
+{
+  struct timex tntx;
+  int result;
+
+  tntx.modes = 0;
+  result = INTUSE(__adjtimex) (&tntx);
+  ntv->time = tntx.time;
+  ntv->maxerror = tntx.maxerror;
+  ntv->esterror = tntx.esterror;
+  ntv->tai = tntx.tai;
+  ntv->__unused1 = 0;
+  ntv->__unused2 = 0;
+  ntv->__unused3 = 0;
+  ntv->__unused4 = 0;
+  return result;
+}
diff --git a/sysdeps/unix/sysv/linux/sys/timex.h b/sysdeps/unix/sysv/linux/sys/timex.h
index 88b87f1089..e10311f70f 100644
--- a/sysdeps/unix/sysv/linux/sys/timex.h
+++ b/sysdeps/unix/sysv/linux/sys/timex.h
@@ -24,11 +24,19 @@
 
 /* These definitions from linux/timex.h as of 2.6.30.  */
 
+#define NTP_API	4	/* NTP API version */
+
 struct ntptimeval
 {
   struct timeval time;	/* current time (ro) */
   long int maxerror;	/* maximum error (us) (ro) */
   long int esterror;	/* estimated error (us) (ro) */
+  long int tai;		/* TAI offset (ro) */
+
+  long int __unused1;
+  long int __unused2;
+  long int __unused3;
+  long int __unused4;
 };
 
 struct timex
@@ -132,7 +140,13 @@ __BEGIN_DECLS
 extern int __adjtimex (struct timex *__ntx) __THROW;
 extern int adjtimex (struct timex *__ntx) __THROW;
 
-extern int ntp_gettime (struct ntptimeval *__ntv) __THROW;
+#if defined __GNUC__ && __GNUC__ >= 2
+extern int ntp_gettime (struct ntptimeval *__ntv)
+     __asm__ ("ntp_gettimex") __THROW;
+#else
+extern int ntp_gettimex (struct ntptimeval *__ntv) __THROW;
+# define ntp_gettime ntp_gettimex
+#endif
 extern int ntp_adjtime (struct timex *__tntx) __THROW;
 
 __END_DECLS