mirror of
https://gitlab.com/chrony/chrony.git
synced 2025-12-03 22:25:07 -05:00
Replace all CROAK calls with assert or LOG_FATAL
Remove croak() and use assert() or LOG_FATAL() everywhere. Hopefully the problems with debugging mentioned in the croak() comment are long gone.
This commit is contained in:
@@ -101,17 +101,17 @@ clock_initialise(void)
|
||||
current_freq = 0.0;
|
||||
|
||||
if (gettimeofday(&T0, &tz) < 0) {
|
||||
CROAK("gettimeofday() failed in clock_initialise()");
|
||||
LOG_FATAL(LOGF_SysSolaris, "gettimeofday() failed");
|
||||
}
|
||||
|
||||
newadj = GET_ZERO;
|
||||
|
||||
if (adjtime(&newadj, &oldadj) < 0) {
|
||||
CROAK("adjtime() failed in clock_initialise");
|
||||
LOG_FATAL(LOGF_SysSolaris, "adjtime() failed");
|
||||
}
|
||||
|
||||
if (adjtime(&newadj, &oldadj) < 0) {
|
||||
CROAK("adjtime() failed in clock_initialise");
|
||||
LOG_FATAL(LOGF_SysSolaris, "adjtime() failed");
|
||||
}
|
||||
|
||||
return;
|
||||
@@ -144,7 +144,7 @@ start_adjust(void)
|
||||
|
||||
/* Determine the amount of error built up since the last adjustment */
|
||||
if (gettimeofday(&T1, &tz) < 0) {
|
||||
CROAK("gettimeofday() failed in start_adjust");
|
||||
LOG_FATAL(LOGF_SysSolaris, "gettimeofday() failed");
|
||||
}
|
||||
|
||||
UTI_DiffTimevalsToDouble(&elapsed, &T1, &T0);
|
||||
@@ -164,7 +164,7 @@ start_adjust(void)
|
||||
UTI_DiffTimevalsToDouble(&rounding_error, &exact_newadj, &newadj);
|
||||
|
||||
if (adjtime(&newadj, &oldadj) < 0) {
|
||||
CROAK("adjtime() failed in start_adjust");
|
||||
LOG_FATAL(LOGF_SysSolaris, "adjtime() failed");
|
||||
}
|
||||
|
||||
UTI_TimevalToDouble(&oldadj, &old_adjust_remaining);
|
||||
@@ -191,11 +191,11 @@ stop_adjust(void)
|
||||
zeroadj = GET_ZERO;
|
||||
|
||||
if (adjtime(&zeroadj, &remadj) < 0) {
|
||||
CROAK("adjtime() failed in stop_adjust");
|
||||
LOG_FATAL(LOGF_SysSolaris, "adjtime() failed");
|
||||
}
|
||||
|
||||
if (gettimeofday(&T1, &tz) < 0) {
|
||||
CROAK("gettimeofday() failed in stop_adjust");
|
||||
LOG_FATAL(LOGF_SysSolaris, "gettimeofday() failed");
|
||||
}
|
||||
|
||||
UTI_DiffTimevalsToDouble(&elapsed, &T1, &T0);
|
||||
@@ -239,7 +239,7 @@ apply_step_offset(double offset)
|
||||
|
||||
stop_adjust();
|
||||
if (gettimeofday(&old_time, &tz) < 0) {
|
||||
CROAK("gettimeofday in apply_step_offset");
|
||||
LOG_FATAL(LOGF_SysSolaris, "gettimeofday() failed");
|
||||
}
|
||||
|
||||
UTI_AddDoubleToTimeval(&old_time, -offset, &new_time);
|
||||
@@ -260,7 +260,7 @@ apply_step_offset(double offset)
|
||||
UTI_DiffTimevalsToDouble(&rounding_error, &rounded_new_time, &new_time);
|
||||
|
||||
if (settimeofday(&new_time, &tz) < 0) {
|
||||
CROAK("settimeofday in apply_step_offset");
|
||||
LOG_FATAL(LOGF_SysSolaris, "settimeofday() failed");
|
||||
}
|
||||
|
||||
UTI_AddDoubleToTimeval(&T0, offset, &T1);
|
||||
@@ -394,9 +394,7 @@ set_dosynctodr(unsigned long on_off)
|
||||
kvm_t *kt;
|
||||
unsigned long read_back;
|
||||
|
||||
if (on_off!=1 && on_off!=0) {
|
||||
CROAK("on_off should be 0 or 1");
|
||||
}
|
||||
assert(on_off == 1 || on_off == 0);
|
||||
|
||||
kt = kvm_open(NULL, NULL, NULL, O_RDWR, NULL);
|
||||
if (!kt) {
|
||||
@@ -424,9 +422,7 @@ set_dosynctodr(unsigned long on_off)
|
||||
|
||||
kvm_close(kt);
|
||||
|
||||
if (read_back != on_off) {
|
||||
CROAK("read_back should equal on_off");
|
||||
}
|
||||
assert(read_back == on_off);
|
||||
|
||||
#if 0
|
||||
LOG(LOGS_INFO, LOGF_SysSolaris, "Set value of dosynctodr to %d", on_off);
|
||||
|
||||
Reference in New Issue
Block a user