From: Richard Curnow Date: Tue, 19 Jul 2005 21:22:52 +0000 (+0000) Subject: RTC usage bails out cleanly if accessing it goes wrong (e.g. HPET without generic... X-Git-Tag: 1.21~3 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=77da5b6144566b3a4a78fa41a114fa62630f682b;p=thirdparty%2Fchrony.git RTC usage bails out cleanly if accessing it goes wrong (e.g. HPET without generic RTC emulation) --- diff --git a/NEWS b/NEWS index 41318591..f3cc5f21 100644 --- a/NEWS +++ b/NEWS @@ -1,3 +1,11 @@ +New in version 1.21 +=================== + +* Don't include Linux kernel header files any longer : allows chrony to compile + on recent distros. +* Stop trying to use RTC if continuous streams of error messages would occur + (Linux with HPET). + New in version 1.20 =================== diff --git a/chrony.texi b/chrony.texi index 4642bb71..909a0cc3 100644 --- a/chrony.texi +++ b/chrony.texi @@ -836,7 +836,11 @@ compiled into the kernel). An estimate is made of the RTC error at a particular RTC second, and the rate at which the RTC gains or loses time relative to true time. -The RTC is fully supported in 2.2 and 2.4 kernels. +The RTC is fully supported in 2.2, 2.4 and 2.6 kernels. + +On 2.6 kernels, if your motherboard has a HPET, you need to enable the +@samp{HPET_EMULATE_RTC} option in your kernel configuration. Otherwise, chrony +will not be able to interact with the RTC device and will give up using it. For kernels in the 2.0 series prior to 2.0.32, the kernel was set up to trim the RTC every 11 minutes. This would be disasterous for diff --git a/rtc_linux.c b/rtc_linux.c index 4b4ca188..8765a129 100644 --- a/rtc_linux.c +++ b/rtc_linux.c @@ -867,9 +867,19 @@ read_from_device(void *any) status = read(fd, &data, sizeof(data)); if (status < 0) { + /* This looks like a bad error : the file descriptor was indicating it was + * ready to read but we couldn't read anything. Give up. */ LOG(LOGS_ERR, LOGF_RtcLinux, "Could not read flags %s : %s", CNF_GetRtcDevice(), strerror(errno)); error = 1; - goto turn_off_interrupt; + SCH_RemoveInputFileHandler(fd); + switch_interrupts(0); /* Likely to raise error too, but just to be sure... */ + close(fd); + fd = -1; + if (logfile) { + fclose(logfile); + logfile = NULL; + } + return; } if ((data & RTC_UIE) == RTC_UIE) {