]> git.ipfire.org Git - thirdparty/chrony.git/commitdiff
Convert disabled log messages to debug or remove them
authorMiroslav Lichvar <mlichvar@redhat.com>
Thu, 26 Jun 2014 16:28:13 +0000 (18:28 +0200)
committerMiroslav Lichvar <mlichvar@redhat.com>
Fri, 27 Jun 2014 08:17:35 +0000 (10:17 +0200)
12 files changed:
keys.c
ntp_io.c
ntp_sources.c
refclock.c
reference.c
regress.c
sources.c
sourcestats.c
sys_linux.c
sys_solaris.c
sys_sunos.c
util.c

diff --git a/keys.c b/keys.c
index d82b8d0f7d58bff30bd92c7ec1354a672f1ad93e..9025feadc73ef5a6c53002ab26ef53104a11e56f 100644 (file)
--- a/keys.c
+++ b/keys.c
@@ -162,12 +162,12 @@ determine_hash_delay(unsigned long key_id)
     }
   }
 
-#if 0
-  LOG(LOGS_INFO, LOGF_Keys, "authentication delay for key %lu: %d useconds", key_id, min_usecs);
-#endif
-
   /* Add on a bit extra to allow for copying, conversions etc */
-  return min_usecs + (min_usecs >> 4);
+  min_usecs += min_usecs >> 4;
+
+  DEBUG_LOG(LOGF_Keys, "authentication delay for key %lu: %ld useconds", key_id, min_usecs);
+
+  return min_usecs;
 }
 
 /* ================================================== */
index 749261c12692c09417fa2300b632323c793de831..312709d72a9d6a379c6521407bc7fa0feedd5723 100644 (file)
--- a/ntp_io.c
+++ b/ntp_io.c
@@ -220,10 +220,6 @@ prepare_socket(int family, int port_number, int client_only)
       assert(0);
   }
 
-#if 0
-  LOG(LOGS_INFO, LOGF_NtpIO, "Initialising, socket fd=%d", sock_fd);
-#endif
-
   if (bind(sock_fd, &my_addr.u, my_addr_len) < 0) {
     LOG(LOGS_ERR, LOGF_NtpIO, "Could not bind %s NTP socket : %s",
         family == AF_INET ? "IPv4" : "IPv6", strerror(errno));
@@ -675,10 +671,9 @@ send_packet(void *packet, int packetlen, NTP_Remote_Address *remote_addr, NTP_Lo
   }
 #endif
 
-#if 0
-    LOG(LOGS_INFO, LOGF_NtpIO, "sending to %s:%d from %s",
-        UTI_IPToString(&remote_addr->ip_addr), remote_addr->port, UTI_IPToString(&remote_addr->local_ip_addr));
-#endif
+  DEBUG_LOG(LOGF_NtpIO, "Sending to %s:%d from %s fd %d",
+      UTI_IPToString(&remote_addr->ip_addr), remote_addr->port,
+      UTI_IPToString(&local_addr->ip_addr), local_addr->sock_fd);
 
   msg.msg_controllen = cmsglen;
   /* This is apparently required on some systems */
index bcba9f0679ffe9d8dbf593ca4d7802f40d5a3134..c98053c121935233437f2b4e56d632e175051d30 100644 (file)
@@ -200,10 +200,6 @@ NSR_AddSource(NTP_Remote_Address *remote_addr, NTP_Source_Type type, SourceParam
 
   assert(initialised);
 
-#if 0
-  LOG(LOGS_INFO, LOGF_NtpSources, "IP=%s port=%d", UTI_IPToString(&remote_addr->ip_addr), remote_addr->port);
-#endif
-
   /* Find empty bin & check that we don't have the address already */
   find_slot(remote_addr, &slot, &found);
   if (found) {
@@ -457,12 +453,6 @@ NSR_ProcessReceive(NTP_Packet *message, struct timeval *now, double now_err, NTP
 
   assert(initialised);
 
-#if 0
-  LOG(LOGS_INFO, LOGF_NtpSources, "from (%s,%d) at %s",
-      UTI_IPToString(&remote_addr->ip_addr),
-      remote_addr->port, UTI_TimevalToString(now));
-#endif
-  
   find_slot(remote_addr, &slot, &found);
   if (found == 2) { /* Must match IP address AND port number */
     NCR_ProcessKnown(message, now, now_err, records[slot].data,
@@ -486,11 +476,6 @@ slew_sources(struct timeval *raw,
 
   for (i=0; i<N_RECORDS; i++) {
     if (records[i].remote_addr) {
-#if 0
-      LOG(LOGS_INFO, LOGF_Sources, "IP=%s dfreq=%f doff=%f",
-          UTI_IPToString(&records[i].remote_addr->ip_addr), dfreq, doffset);
-#endif
-
       if (change_type == LCL_ChangeUnknownStep) {
         NCR_ResetInstance(records[i].data);
       } else {
@@ -498,7 +483,6 @@ slew_sources(struct timeval *raw,
       }
     }
   }
-
 }
 
 /* ================================================== */
index e5a4b07ad184dc437995e796a0030bd9e9db9f42..5c21f125312fb7ded115b13a1a5ba55565c40b5d 100644 (file)
@@ -908,20 +908,13 @@ static void
 filter_slew_samples(struct MedianFilter *filter, struct timeval *when, double dfreq, double doffset)
 {
   int i;
-  double delta_time, prev_offset;
+  double delta_time;
   struct timeval *sample;
 
   for (i = 0; i < filter->used; i++) {
     sample = &filter->samples[i].sample_time;
     UTI_AdjustTimeval(sample, when, sample, &delta_time, dfreq, doffset);
-    prev_offset = filter->samples[i].offset;
     filter->samples[i].offset -= delta_time;
-#if 0
-    LOG(LOGS_INFO, LOGF_Refclock, "i=%d old_off=%.9f new_off=%.9f",
-        i, prev_offset, filter->samples[i].offset);
-#else
-    (void)prev_offset;
-#endif
   }
 }
 
index 288e10b9d45504e630c64f56e95204a0c750fc0a..f4e20770908904ee3214b709ce2b347295e47014 100644 (file)
@@ -426,10 +426,8 @@ update_fb_drifts(double freq_ppm, double update_interval)
         (freq_ppm - fb_drifts[i].freq);
     }
 
-#if 0
-    LOG(LOGS_INFO, LOGF_Reference, "Fallback drift %d updated: %f ppm %f seconds",
+    DEBUG_LOG(LOGF_Reference, "Fallback drift %d updated: %f ppm %f seconds",
         i + fb_drift_min, fb_drifts[i].freq, fb_drifts[i].secs);
-#endif
   }
 }
 
@@ -476,18 +474,14 @@ schedule_fb_drift(struct timeval *now)
   if (c > next_fb_drift) {
     LCL_SetAbsoluteFrequency(fb_drifts[c - fb_drift_min].freq);
     next_fb_drift = c;
-#if 0
-    LOG(LOGS_INFO, LOGF_Reference, "Fallback drift %d set", c);
-#endif
+    DEBUG_LOG(LOGF_Reference, "Fallback drift %d set", c);
   }
 
   if (i <= fb_drift_max) {
     next_fb_drift = i;
     UTI_AddDoubleToTimeval(now, secs - unsynchronised, &when);
     fb_drift_timeout_id = SCH_AddTimeout(&when, fb_drift_timeout, NULL);
-#if 0
-    LOG(LOGS_INFO, LOGF_Reference, "Fallback drift %d scheduled", i);
-#endif
+    DEBUG_LOG(LOGF_Reference, "Fallback drift %d scheduled", i);
   }
 }
 
@@ -1127,9 +1121,6 @@ void
 REF_ModifyMaxupdateskew(double new_max_update_skew)
 {
   max_update_skew = new_max_update_skew * 1.0e-6;
-#if 0
-  LOG(LOGS_INFO, LOGF_Reference, "New max update skew = %.3fppm", new_max_update_skew);
-#endif
 }
 
 /* ================================================== */
index 6847a1cd254b24fa8f0bfab50b0597517abba125..71845d514cb24c9e75db2d3d5dd53818f6ef26d2 100644 (file)
--- a/regress.c
+++ b/regress.c
@@ -570,11 +570,6 @@ RGR_FindBestRobustRegression
     b = X / V;
     a = my - b*mx;
 
-
-#if 0
-    printf("my=%20.12f mx=%20.12f a=%20.12f b=%20.12f\n", my, mx, a, b);
-#endif
-
     s2 = 0.0;
     for (i=start; i<n; i++) {
       resid = y[i] - a - b * x[i];
index f7cdd60f559a949b3539fa0d406fed43250666e3..b9e095d76241542f6a8bfa646194fab3269bcf70 100644 (file)
--- a/sources.c
+++ b/sources.c
@@ -610,13 +610,6 @@ SRC_SelectSource(SRC_Instance updated_inst)
                            &(si->variance),
                            &(si->select_ok));
 
-#if 0
-      LOG(LOGS_INFO, LOGF_Sources, "%s dist=%f lo=%f hi=%f",
-          source_to_string(sources[i]),
-          si->root_distance,
-          si->lo_limit, si->hi_limit);
-#endif
-      
       if (si->select_ok) {
         ++n_sel_sources;
 
@@ -655,10 +648,8 @@ SRC_SelectSource(SRC_Instance updated_inst)
     }
   }
 
-#if 0
-  LOG(LOGS_INFO, LOGF_Sources, "badstat_sources=%d sel_sources=%d badstat_reach=%x sel_reach=%x",
+  DEBUG_LOG(LOGF_Sources, "badstat_sources=%d sel_sources=%d badstat_reach=%x sel_reach=%x",
       n_badstats_sources, n_sel_sources, max_badstat_reach, max_sel_reach);
-#endif
 
   /* Wait for the next call if we have no source selected and there is
      a source with bad stats (has less than 3 samples) with reachability
@@ -672,10 +663,6 @@ SRC_SelectSource(SRC_Instance updated_inst)
     return;
   }
 
-#if 0
-  LOG(LOGS_INFO, LOGF_Sources, "n_endpoints=%d", n_endpoints);
-#endif
-
   /* Now sort the endpoint list */
   if (n_endpoints > 0) {
 
@@ -709,10 +696,6 @@ SRC_SelectSource(SRC_Instance updated_inst)
     best_lo = best_hi = 0.0;
 
     for (i=0; i<n_endpoints; i++) {
-#if 0
-      LOG(LOGS_INFO, LOGF_Sources, "i=%d t=%f tag=%d addr=%s", i, sort_list[i].offset, sort_list[i].tag,
-          source_to_string(sources[sort_list[i].index]));
-#endif
       switch(sort_list[i].tag) {
         case LOW:
           depth++;
@@ -736,11 +719,6 @@ SRC_SelectSource(SRC_Instance updated_inst)
       }
     }
 
-#if 0
-    LOG(LOGS_INFO, LOGF_Sources, "best_depth=%d best_lo=%f best_hi=%f",
-        best_depth, best_lo, best_hi);
-#endif
-
     if (best_depth <= n_sel_sources/2) {
       /* Could not even get half the reachable sources to agree -
          clearly we can't synchronise.
@@ -783,14 +761,8 @@ SRC_SelectSource(SRC_Instance updated_inst)
                (sources[i]->sel_info.hi_limit <= best_hi))) {
 
             sel_sources[n_sel_sources++] = i;
-#if 0
-            LOG(LOGS_INFO, LOGF_Sources, "i=%d addr=%s is valid", i, source_to_string(sources[i]));
-#endif
           } else {
             sources[i]->status = SRC_FALSETICKER;
-#if 0
-            LOG(LOGS_INFO, LOGF_Sources, "i=%d addr=%s is a falseticker", i, source_to_string(sources[i]));
-#endif
           }
         }
       }
@@ -811,10 +783,6 @@ SRC_SelectSource(SRC_Instance updated_inst)
         }
       }
 
-#if 0
-      LOG(LOGS_INFO, LOGF_Sources, "min_distance=%f", min_distance);
-#endif
-
       /* Now go through and prune any NTP sources that have excessive
          variance */
       for (i=0; i<n_sel_sources; i++) {
@@ -823,9 +791,6 @@ SRC_SelectSource(SRC_Instance updated_inst)
             sqrt(sources[index]->sel_info.variance) > min_distance) {
           sel_sources[i] = INVALID_SOURCE;
           sources[index]->status = SRC_JITTERY;
-#if 0
-          LOG(LOGS_INFO, LOGF_Sources, "i=%d addr=%s has too much variance", i, source_to_string(sources[i]));
-#endif
         }
       }
 #endif
@@ -884,10 +849,6 @@ SRC_SelectSource(SRC_Instance updated_inst)
           if (stratum < min_stratum) min_stratum = stratum;
         }
 
-#if 0
-        LOG(LOGS_INFO, LOGF_Sources, "min_stratum=%d", min_stratum);
-#endif
-
         /* Update scores and find source with maximum score */
 
         max_score_index = INVALID_SOURCE;
@@ -936,11 +897,9 @@ SRC_SelectSource(SRC_Instance updated_inst)
             sources[i]->sel_score = 1.0 / distance; 
           }
 
-#if 0
-          LOG(LOGS_INFO, LOGF_Sources, "select score=%f refid=%x match_refid=%x status=%d dist=%f",
+          DEBUG_LOG(LOGF_Sources, "select score=%f refid=%x match_refid=%x status=%d dist=%f",
               sources[i]->sel_score, sources[i]->ref_id, updated_inst ? updated_inst->ref_id : 0,
               sources[i]->status, distance);
-#endif
         
           if (max_score < sources[i]->sel_score) {
             max_score = sources[i]->sel_score;
@@ -963,10 +922,6 @@ SRC_SelectSource(SRC_Instance updated_inst)
           log_selection_message("Selected source %s",
                 source_to_string(sources[selected_source_index]));
                                  
-#if 0
-          LOG(LOGS_INFO, LOGF_Sources, "new_sel_index=%d", selected_source_index);
-#endif
-
           /* New source has been selected, reset all scores */
           for (i=0; i < n_sources; i++) {
             sources[i]->sel_score = 1.0;
index a0e235a6c2bb219c195fe2d7388053146886797f..7259bdeae2b62a931d85c705d0dd68f387f4c7f8 100644 (file)
@@ -363,10 +363,6 @@ find_best_sample_index(SST_Stats inst, double *times_back)
 
   assert(best_index >= 0);
   inst->best_single_sample = best_index;
-
-#if 0
-  LOG(LOGS_INFO, LOGF_SourceStats, "n=%d best_index=%d", n, best_index);
-#endif
 }
 
 /* ================================================== */
@@ -500,9 +496,6 @@ SST_DoNewRegression(SST_Stats inst)
     times_back_start = inst->runs_samples + best_start;
     prune_register(inst, best_start);
   } else {
-#if 0
-    LOG(LOGS_INFO, LOGF_SourceStats, "too few points (%d) for regression", inst->n_samples);
-#endif
     inst->estimated_frequency = 0.0;
     inst->skew = WORST_CASE_FREQ_BOUND;
     times_back_start = 0;
@@ -734,9 +727,8 @@ SST_IsGoodSample(SST_Stats inst, double offset, double delay,
   if (fabs(offset) - delay_increase > allowed_increase)
     return 1;
 
-#if 0
-  LOG(LOGS_INFO, LOGF_SourceStats, "bad sample: offset=%f delay=%f incr_delay=%f allowed=%f", offset, delay, allowed_increase, delay_increase);
-#endif
+  DEBUG_LOG(LOGF_SourceStats, "Bad sample: offset=%f delay=%f incr_delay=%f allowed=%f",
+      offset, delay, allowed_increase, delay_increase);
 
   return 0;
 }
index e2261ed87e0795dd37fa42ae67608039a60ab8b5..b8229ddcc05d804fffb13d34f62572074afd1cac 100644 (file)
@@ -271,11 +271,6 @@ get_version_specific_details(void)
     if (!shift_hz) {
       LOG_FATAL(LOGF_SysLinux, "Can't determine hz (txc.tick=%ld txc.freq=%ld (%.8f) txc.offset=%ld)",
           tmx_params.tick, tmx_params.freq, tmx_params.dfreq, tmx_params.offset);
-    } else {
-#if 0
-      LOG(LOGS_INFO, LOGF_SysLinux, "Initial txc.tick=%ld txc.freq=%ld (%.8f) txc.offset=%ld => hz=%d shift_hz=%d",
-          tmx_params.tick, tmx_params.freq, tmx_params.dfreq, tmx_params.offset, hz, shift_hz);
-#endif
     }
   }
 
@@ -397,9 +392,7 @@ SYS_Linux_DropRoot(char *user)
 
   cap_free(cap);
 
-#if 0
-  LOG(LOGS_INFO, LOGF_SysLinux, "Privileges dropped to user %s", user);
-#endif
+  DEBUG_LOG(LOGF_SysLinux, "Privileges dropped to user %s", user);
 }
 #endif
 
@@ -428,9 +421,8 @@ void SYS_Linux_SetScheduler(int SchedPriority)
       LOG(LOGS_ERR, LOGF_SysLinux, "sched_setscheduler() failed");
     }
     else {
-#if 0
-      LOG(LOGS_INFO, LOGF_SysLinux, "Enabled SCHED_FIFO with priority %d", sched.sched_priority);
-#endif
+      DEBUG_LOG(LOGF_SysLinux, "Enabled SCHED_FIFO with priority %d",
+          sched.sched_priority);
     }
   }
 }
@@ -454,9 +446,7 @@ void SYS_Linux_MemLockAll(int LockAll)
        LOG(LOGS_ERR, LOGF_SysLinux, "mlockall() failed");
       }
       else {
-#if 0
-       LOG(LOGS_INFO, LOGF_SysLinux, "Successfully locked into RAM");
-#endif
+       DEBUG_LOG(LOGF_SysLinux, "Successfully locked into RAM");
       }
     }
   }
index 065bacda00f1d2da318ff562b4f395343d849e68..0c8dedbd4c2c2f78ea4819f97c174d3537601843 100644 (file)
@@ -409,11 +409,6 @@ set_dosynctodr(unsigned long on_off)
   kvm_close(kt);
 
   assert(read_back == on_off);
-
-#if 0
-  LOG(LOGS_INFO, LOGF_SysSolaris, "Set value of dosynctodr to %d", on_off);
-#endif
-
 }
 
 /* ================================================== */
index 7c323b3bcbd8717aef3a0a0bca0e5ffe6063c614..d45f58f324f0e817a85b949a4be7fd62a9cfefca 100644 (file)
@@ -364,11 +364,6 @@ setup_kernel(unsigned long on_off)
   }
 
   kvm_close(kt);
-
-#if 0
-  LOG(LOGS_INFO, LOGF_SysSunOS, "Set value of _dosynctodr to %d", on_off);
-#endif
-
 }
 
 /* ================================================== */
diff --git a/util.c b/util.c
index 077456c0f9f1d8de09ddea395337f14467cd3392..b9d6bccba21d7642ca10d151c072e8757c4afabb 100644 (file)
--- a/util.c
+++ b/util.c
@@ -164,13 +164,6 @@ UTI_AverageDiffTimevals (struct timeval *earlier,
        be backwards, or something wierd has happened.  Maybe when we
        change the frequency on Linux? */
 
-    /* This seems to be fairly benign, so don't bother logging it */
-
-#if 0
-    LOG(LOGS_INFO, LOGF_Util, "Earlier=[%s] Later=[%s]",
-        UTI_TimevalToString(earlier), UTI_TimevalToString(later));
-#endif
-
     /* Assume the required behaviour is to treat it as zero */
     *diff = 0.0;
   }