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:
Miroslav Lichvar
2010-08-12 14:30:05 +02:00
parent 2a64b75893
commit 6b0198c2d7
13 changed files with 105 additions and 195 deletions

View File

@@ -85,14 +85,14 @@ clock_initialise(void)
current_freq = 0.0;
if (gettimeofday(&T0, &tz) < 0) {
CROAK("gettimeofday() failed in clock_initialise()");
LOG_FATAL(LOGF_SysNetBSD, "gettimeofday() failed");
}
newadj.tv_sec = 0;
newadj.tv_usec = 0;
if (adjtime(&newadj, &oldadj) < 0) {
CROAK("adjtime() failed in clock_initialise");
LOG_FATAL(LOGF_SysNetBSD, "adjtime() failed");
}
}
@@ -123,7 +123,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_SysNetBSD, "gettimeofday() failed");
}
UTI_DiffTimevalsToDouble(&elapsed, &T1, &T0);
@@ -151,7 +151,7 @@ start_adjust(void)
UTI_DiffTimevalsToDouble(&rounding_error, &newadj, &exact_newadj);
if (adjtime(&newadj, &oldadj) < 0) {
CROAK("adjtime() failed in start_adjust");
LOG_FATAL(LOGF_SysNetBSD, "adjtime() failed");
}
UTI_TimevalToDouble(&oldadj, &old_adjust_remaining);
@@ -178,11 +178,11 @@ stop_adjust(void)
zeroadj.tv_usec = 0;
if (adjtime(&zeroadj, &remadj) < 0) {
CROAK("adjtime() failed in stop_adjust");
LOG_FATAL(LOGF_SysNetBSD, "adjtime() failed");
}
if (gettimeofday(&T1, &tz) < 0) {
CROAK("gettimeofday() failed in stop_adjust");
LOG_FATAL(LOGF_SysNetBSD, "gettimeofday() failed");
}
UTI_DiffTimevalsToDouble(&elapsed, &T1, &T0);
@@ -226,13 +226,13 @@ apply_step_offset(double offset)
stop_adjust();
if (gettimeofday(&old_time, &tz) < 0) {
CROAK("gettimeofday in apply_step_offset");
LOG_FATAL(LOGF_SysNetBSD, "gettimeofday() failed");
}
UTI_AddDoubleToTimeval(&old_time, -offset, &new_time);
if (settimeofday(&new_time, &tz) < 0) {
CROAK("settimeofday in apply_step_offset");
LOG_FATAL(LOGF_SysNetBSD, "settimeofday() failed");
}
UTI_AddDoubleToTimeval(&T0, offset, &T1);
@@ -291,15 +291,15 @@ SYS_NetBSD_Initialise(void)
kt = kvm_open(NULL, NULL, NULL, O_RDONLY, NULL);
if (!kt) {
CROAK("Cannot open kvm\n");
LOG_FATAL(LOGF_SysNetBSD, "Cannot open kvm");
}
if (kvm_nlist(kt, nl) < 0) {
CROAK("Cannot read kernel symbols\n");
LOG_FATAL(LOGF_SysNetBSD, "Cannot read kernel symbols");
}
if (kvm_read(kt, nl[0].n_value, (char *)(&kern_tickadj), sizeof(int)) < 0) {
CROAK("Cannot read from _tickadj\n");
LOG_FATAL(LOGF_SysNetBSD, "Cannot read from _tickadj");
}
if (kvm_read(kt, nl[1].n_value, (char *)(&kern_bigadj), sizeof(long)) < 0) {