]> git.ipfire.org Git - thirdparty/chrony.git/commitdiff
Drop support for old readonly adjtime
authorMiroslav Lichvar <mlichvar@redhat.com>
Mon, 6 Jun 2011 14:13:12 +0000 (16:13 +0200)
committerMiroslav Lichvar <mlichvar@redhat.com>
Mon, 6 Jun 2011 15:12:31 +0000 (17:12 +0200)
sys_linux.c
wrap_adjtimex.c
wrap_adjtimex.h

index 7c3458e43064b7162bf11a3e50cc56f007665797..a33a725b6ffedd992fd75c3529d1ed35407c6a05 100644 (file)
@@ -106,8 +106,7 @@ static int version_patchlevel;
 /* Flag indicating whether adjtimex() returns the remaining time adjustment
 or not.  If not we have to read the outstanding adjustment by setting it to
 zero, examining the return value and setting the outstanding adjustment back
-again.  If 1, txc.modes equal to zero is used to read the time.  If 2,
-txc.modes is set to ADJ_OFFSET_SS_READ. */
+again. */
 
 static int have_readonly_adjtime;
 
@@ -766,29 +765,19 @@ get_offset_correction(struct timeval *raw,
   if (!slow_slewing) {
     offset = 0;
   } else {
-    switch (have_readonly_adjtime) {
-      case 2:
-        if (TMX_GetOffsetLeft(&offset) < 0) {
-          LOG_FATAL(LOGF_SysLinux, "adjtimex() failed");
-        }
-        break;
-      case 0:
-        toffset = 0;
-        if (TMX_ApplyOffset(&toffset) < 0) {
-          LOG_FATAL(LOGF_SysLinux, "adjtimex() failed");
-        }
-        offset = toffset;
-        if (TMX_ApplyOffset(&toffset) < 0) {
-          LOG_FATAL(LOGF_SysLinux, "adjtimex() failed");
-        }
-        break;
-      case 1:
-        if (TMX_GetOffsetLeftOld(&offset) < 0) {
-          LOG_FATAL(LOGF_SysLinux, "adjtimex() failed");
-        }
-        break;
-      default:
-        assert(0);
+    if (have_readonly_adjtime) {
+      if (TMX_GetOffsetLeft(&offset) < 0) {
+        LOG_FATAL(LOGF_SysLinux, "adjtimex() failed");
+      }
+    } else {
+      toffset = 0;
+      if (TMX_ApplyOffset(&toffset) < 0) {
+        LOG_FATAL(LOGF_SysLinux, "adjtimex() failed");
+      }
+      offset = toffset;
+      if (TMX_ApplyOffset(&toffset) < 0) {
+        LOG_FATAL(LOGF_SysLinux, "adjtimex() failed");
+      }
     }
 
     if (offset == 0) {
@@ -1006,7 +995,7 @@ get_version_specific_details(void)
   if (kernelvercmp(major, minor, patch, 2, 6, 27) < 0) {
     have_readonly_adjtime = 0;
   } else {
-    have_readonly_adjtime = 2;
+    have_readonly_adjtime = 1;
   }
 
   /* ADJ_NANO support */
@@ -1051,7 +1040,7 @@ SYS_Linux_Initialise(void)
     LOG_FATAL(LOGF_SysLinux, "adjtimex() failed");
   }
 
-  if (have_readonly_adjtime == 2 && (TMX_GetOffsetLeft(&offset) < 0 || offset)) {
+  if (have_readonly_adjtime && (TMX_GetOffsetLeft(&offset) < 0 || offset)) {
     LOG(LOGS_INFO, LOGF_SysLinux, "adjtimex() doesn't support ADJ_OFFSET_SS_READ");
     have_readonly_adjtime = 0;
   }
index 34e82513e64402a6e985de32fba1d54b15fbf147..bcb98704220d060bb6da2e13de1136b35d20b283 100644 (file)
@@ -96,17 +96,6 @@ TMX_GetFrequency(double *freq)
   return result;
 }
 
-int
-TMX_GetOffsetLeftOld(long *offset)
-{
-  struct timex txc;
-  int result;
-  txc.modes = 0; /* pure read */
-  result = adjtimex(&txc);
-  *offset = txc.offset;
-  return result;
-}
-
 int
 TMX_GetOffsetLeft(long *offset)
 {
index 166315ef3afed1ccfb96313a39131a442252237d..6438799aacf3df769553cb40c1051208f707150d 100644 (file)
@@ -68,7 +68,6 @@ int TMX_SetTick(long tick);
 int TMX_ApplyOffset(long *offset);
 int TMX_SetFrequency(double *freq, long tick);
 int TMX_GetFrequency(double *freq);
-int TMX_GetOffsetLeftOld(long *offset);
 int TMX_GetOffsetLeft(long *offset);
 int TMX_ReadCurrentParams(struct tmx_params *params);
 int TMX_SetLeap(int leap);