]> git.ipfire.org Git - thirdparty/ntp.git/commitdiff
[Bug 1861] tickadj build failure using uClibc.
authorDave Hart <hart@ntp.org>
Sat, 26 Mar 2011 02:03:35 +0000 (02:03 +0000)
committerDave Hart <hart@ntp.org>
Sat, 26 Mar 2011 02:03:35 +0000 (02:03 +0000)
bk: 4d8d4977Ql1OY7MYiwW7D-X4TbqnOQ

ChangeLog
configure.ac
include/ntp_machine.h
include/ntp_syscall.h
util/tickadj.c

index c4c67c65b4a4d414fb6c07ed03d6f1a1064069d6..d6deca172500caa5ff0de46b463ca1978bfc6b99 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,4 +1,5 @@
 * [Bug 1732] ntpd ties up CPU on disconnected USB refclock.
+* [Bug 1861] tickadj build failure using uClibc.
 * Remove kernel line discipline driver code for clk and chu, deprecate
   related LDISC_ flags, and remove associated ntpd code to decode the
   timestamps, remove clktest line discipline test program.
index 7d5fa41274f776726cbbda3903d6bd05aade5f76..397b62e387e1599c9f8fd58dae1054e73ee81ab3 100644 (file)
@@ -320,14 +320,48 @@ case "$host" in
 esac
 
 case "$host" in
- *-*-*linux*)
-    AC_CHECK_FUNCS([__adjtimex __ntp_gettime])
-    ;;
-esac
-case "$ac_cv_func___adjtimex" in
- yes)
+ *-*-solaris2.6)
+    # Broken...
     ;;
  *)
+    AC_CHECK_FUNCS([ntp_adjtime ntp_gettime])
+    ;;
+esac
+
+case "$host" in
+ *-*-*linux*)
+    case "$ac_cv_func_ntp_gettime" in
+     yes)
+       ;;
+     *)
+       AC_CHECK_FUNCS([__ntp_gettime])
+       case "$ac_cv_func___ntp_gettime" in
+        yes)
+           AC_DEFINE([ntp_gettime], [__ntp_gettime], [deviant])
+                   AC_DEFINE([HAVE_NTP_GETTIME], [1], [via __ntp_gettime])
+       esac
+       ;;
+    esac
+    AC_CHECK_FUNCS([adjtimex])
+    case "$ac_cv_func_adjtimex" in
+     yes)
+       AC_DEFINE([ntp_adjtime], [adjtimex], [deviant])
+       AC_DEFINE([HAVE_NTP_ADJTIME], [1], [via adjtimex])
+       ;;
+     *)
+       AC_CHECK_FUNCS([__adjtimex])
+       case "$ac_cv_func___adjtimex" in
+        yes)
+           AC_DEFINE([ntp_adjtime], [__adjtimex], [deviant])
+           AC_DEFINE([HAVE_NTP_ADJTIME], [1], [via __adjtimex])
+           AC_DEFINE([adjtimex], [__adjtimex], [deviant])
+           AC_DEFINE([HAVE_ADJTIMEX], [1], [via __adjtimex])
+       esac
+       ;;
+    esac
+esac
+case "$HAVE_ADJTIMEX" in
+ '')
     AC_CHECK_LIB([elf], [nlist])       dnl Only needed for tickadj...
     dnl AC_CHECK_LIB(kvm, main, , , -lelf)
     AC_CHECK_LIB([kvm], [main])                dnl We already know about -lelf here...
@@ -337,30 +371,29 @@ case "$ac_cv_func___adjtimex" in
     case "$ac_cv_header_nlist_h" in
      yes)
        AC_DEFINE([NLIST_STRUCT], [1], [nlist stuff])
-    esac
-    AC_CACHE_CHECK(
-       [for n_un in struct nlist],
-       [ntp_cv_struct_nlist_n_un],
-       [AC_COMPILE_IFELSE(
-           [AC_LANG_PROGRAM(
-               [[
-                   #include <nlist.h>
-               ]],
-               [[
-                   struct nlist n;
-                   n.n_un.n_name = 0;
-               ]]
+       AC_CACHE_CHECK(
+           [for n_un in struct nlist],
+           [ntp_cv_struct_nlist_n_un],
+           [AC_COMPILE_IFELSE(
+               [AC_LANG_PROGRAM(
+                   [[
+                       #include <nlist.h>
+                   ]],
+                   [[
+                       struct nlist n;
+                       n.n_un.n_name = 0;
+                   ]]
+               )]
+               [ntp_cv_struct_nlist_n_un=yes],
+               [ntp_cv_struct_nlist_n_un=no]
            )]
-           [ntp_cv_struct_nlist_n_un=yes],
-           [ntp_cv_struct_nlist_n_un=no]
-       )]
-    )
-    case "$ntp_cv_struct_nlist_n_un" in
-     yes)
-       AC_DEFINE([NLIST_NAME_UNION], [1],
-           [does struct nlist use a name union?])
+       )
+       case "$ntp_cv_struct_nlist_n_un" in
+        yes)
+           AC_DEFINE([NLIST_NAME_UNION], [1],
+               [does struct nlist use a name union?])
+       esac
     esac
-    ;;
 esac
 
 AC_CHECK_HEADERS([sys/proc.h], [], [], [
@@ -756,15 +789,7 @@ case "$host" in
  *) AC_CHECK_FUNCS([mlockall])
     ;;
 esac
-AC_CHECK_FUNCS([nice nlist])
-case "$host" in
- *-*-solaris2.6)
-    # Broken...
-    ;;
- *) AC_CHECK_FUNCS([ntp_adjtime ntp_gettime])
-    ;;
-esac
-AC_CHECK_FUNCS([plock pututline pututxline readlink recvmsg rtprio])
+AC_CHECK_FUNCS([nice nlist plock pututline pututxline readlink recvmsg rtprio])
 case "$host" in
  *-*-aix[[456]]*)
     # Just a stub in AIX 4.  Idiots.
index 3845e3e57e5f1764c7ad7780a52c73475f5b0198..72b0a71f267a54102404b8e82df147b362d8c455 100644 (file)
 
 /*
 
-INFO ON NEW KERNEL PLL SYS CALLS
-
-  NTP_SYSCALLS_STD     - use the "normal" ones
-  NTP_SYSCALL_GET      - SYS_ntp_gettime id
-  NTP_SYSCALL_ADJ      - SYS_ntp_adjtime id
-  NTP_SYSCALLS_LIBC - ntp_adjtime() and ntp_gettime() are in libc.
-
 HOW TO GET IP INTERFACE INFORMATION
 
   Some UNIX V.4 machines implement a sockets library on top of
@@ -72,10 +65,6 @@ MISC
   LOCK_PROCESS         - Have plock.
 */
 
-#if !defined(HAVE_NTP_ADJTIME) && defined(HAVE___ADJTIMEX)
-# define ntp_adjtime __adjtimex
-#endif
-
 int ntp_set_tod (struct timeval *tvp, void *tzp);
 
 #if defined (SYS_CYGWIN32)
index df2452caae9f4b682be0f6091ace9caa2360c7f2..d1ce03ea90a255edf8b0622d6ea197e8f6732e76 100644 (file)
 #endif
 
 #ifndef NTP_SYSCALLS_LIBC
-#ifdef NTP_SYSCALLS_STD
-# define ntp_adjtime(t)                syscall(SYS_ntp_adjtime, (t))
-# define ntp_gettime(t)                syscall(SYS_ntp_gettime, (t))
-#else /* !NTP_SYSCALLS_STD */
-# ifdef HAVE___ADJTIMEX
-extern int     __adjtimex      (struct timex *);
-
-#  define ntp_adjtime(t)       __adjtimex((t))
-
-#ifndef HAVE_STRUCT_NTPTIMEVAL
+# ifdef NTP_SYSCALLS_STD
+#  define ntp_adjtime(t)       syscall(SYS_ntp_adjtime, (t))
+#  define ntp_gettime(t)       syscall(SYS_ntp_gettime, (t))
+# else /* !NTP_SYSCALLS_STD */
+#  ifdef HAVE_NTP_ADJTIME
+extern int     ntp_adjtime     (struct timex *);
+
+#   ifndef HAVE_STRUCT_NTPTIMEVAL
 struct ntptimeval
 {
-  struct timeval time;  /* current time (ro) */
-  long int maxerror;    /* maximum error (us) (ro) */
-  long int esterror;    /* estimated error (us) (ro) */
+       struct timeval  time;           /* current time (ro) */
+       long int        maxerror;       /* maximum error (us) (ro) */
+       long int        esterror;       /* estimated error (us) (ro) */
 };
-#endif
+#   endif
 
+#   ifndef HAVE_NTP_GETTIME
 static inline int
 ntp_gettime(
        struct ntptimeval *ntv
@@ -37,24 +36,21 @@ ntp_gettime(
        struct timex tntx;
        int result;
 
-       tntx.modes = 0;
-       result = __adjtimex (&tntx);
+       ZERO(tntx);
+       result = ntp_adjtime(&tntx);
        ntv->time = tntx.time;
        ntv->maxerror = tntx.maxerror;
        ntv->esterror = tntx.esterror;
-#ifdef NTP_API
-# if NTP_API > 3
+#    ifdef NTP_API
+#     if NTP_API > 3
        ntv->tai = tntx.tai;
-# endif
-#endif
-       return(result);
+#     endif
+#    endif
+       return result;
 }
-# else /* !HAVE__ADJTIMEX */
-#  ifdef HAVE___NTP_GETTIME
-#   define ntp_gettime(t)      __ntp_gettime((t))
-#  endif
-# endif /* !HAVE_ADJTIMEX */
-#endif /* !NTP_SYSCALLS_STD */
-#endif /* !NTP_SYSCALLS_LIBC */
+#   endif      /* !HAVE_NTP_GETTIME */
+#  endif       /* !HAVE_NTP_ADJTIME */
+# endif        /* !NTP_SYSCALLS_STD */
+#endif /* !NTP_SYSCALLS_LIBC */
 
-#endif /* NTP_SYSCALL_H */
+#endif /* NTP_SYSCALL_H */
index 80fc535a00fba8b3b813593096319eecf47edcc2..d54e9e6844ab0ee4b7204bd48cc7cd0d6f6cd3a4 100644 (file)
 # include <unistd.h>
 #endif /* HAVE_UNISTD_H */
 
-#ifdef HAVE___ADJTIMEX         /* Linux */
+#ifdef HAVE_SYS_TIMEX_H
+# include <sys/timex.h>
+#endif
+
+#ifdef HAVE_ADJTIMEX   /* Linux */
 
-#include <sys/timex.h>
 struct timex txc;
 
 #if 0
@@ -57,9 +60,9 @@ main(
                                txc.tickadj = i;
                                txc.modes |= ADJ_TICKADJ;
                        } else {
-                               (void) fprintf(stderr,
-                                      "%s: unlikely value for tickadj: %s\n",
-                                      progname, ntp_optarg);
+                               fprintf(stderr,
+                                       "%s: unlikely value for tickadj: %s\n",
+                                       progname, ntp_optarg);
                                errflg++;
                        }
                        break;
@@ -91,7 +94,7 @@ main(
        }
 
        if (!errflg) {
-               if (__adjtimex(&txc) < 0)
+               if (adjtimex(&txc) < 0)
                        perror("adjtimex");
                else if (!quiet)
                        printf("tick     = %ld\ntick_adj = %d\n",
@@ -145,8 +148,8 @@ main(
 #endif
 #endif
        }
-    
-       if (__adjtimex(&txc) < 0)
+
+       if (adjtimex(&txc) < 0)
        {
                perror("adjtimex");
        }
@@ -163,7 +166,7 @@ main(
 }
 #endif
 
-#else /* not Linux... kmem tweaking: */
+#else  /* not Linux... kmem tweaking: */
 
 #ifdef HAVE_SYS_FILE_H
 # include <sys/file.h>