On Friday, March 21, 2008 at 11:09:09 +0100, Tobias Frost wrote:
> thecus:/home/tobi# hwclock --directisa
> Fri Mar 21 00:58:56 2008 -0.286869 seconds
I don't understand why adjtimex segfaults while hwclock works. That's
also expected to kick ports 70-71. Could you please retry with --debug:
| # hwclock --directisa --debug
In hwclock case, strace should be useless. But I'd appreciate if you
could give me as much infos as possible about your RTC: /proc/ioports,
/proc/cpuinfo, any boot hardware detection message, driver module loaded
behind /dev/rtc0, and whatever you can find.
>| /dev/rtc doesn't allow user access to update interrupts
>| - using busy wait instead
>| lseek(3, 112, SEEK_SET) = -1 ESPIPE (Illegal seek)
>| write(3, "\212", 1) = -1 EBADF (Bad file descriptor)
This is a known problem of the no-interrupt fallback. Problem solved,
but fix not yet released. See bug #460065 for the full story and
patches. You'd need both no-interrupt-fallback.patch and
no-interrupt-fallback-3.patch to make adjtimex work in your case.
On Tuesday, March 18, 2008 at 23:08:54 +0100, Tobias Frost wrote:
>| open("/dev/rtc", O_RDONLY) = -1 ENOENT (No such file or
>directory)
>| write(1, "cannot open /dev/rtc for reading"..., 33) = 33
I think that adjtimex should then automatically fallback to /dev/rtc0,
so it works even without symlink. Hwclock does that. The attached
rtc0_fallback.patch should do it. This patch must be applied after
no-interrupt-fallback.patch.
Alain.
fallback to /dev/rtc0 when /dev/rtc fails
Signed-off-by: Alain Guibert <[EMAIL PROTECTED]>
diff -prud adjtimex-1.23.orig/adjtimex.c adjtimex-1.23/adjtimex.c
--- adjtimex-1.23.orig/adjtimex.c Sat Mar 22 10:28:25 2008
+++ adjtimex-1.23/adjtimex.c Sat Mar 22 15:09:06 2008
@@ -61,6 +61,7 @@ static unsigned long epoch = 1900; /* ye
#ifndef USE_INLINE_ASM_IO
static int port_fd = -1; /* used to access the RTC via /dev/port I/O */
#endif
+static char *cmos_device; /* filename of the RTC device */
static int cmos_fd = -1;
static int using_dev_rtc = -1; /* 0 = not using /dev/rtc
1 = using /dev/rtc
@@ -541,7 +542,9 @@ inb (short port)
/*
* Main initialisation of CMOS clock access methods, for all modes.
- * Set the global variable cmos_fd to a file descriptor for /dev/rtc.
+ * Set the global variable cmos_device to the first available RTC device
+ * driver filename between /dev/rtc and /dev/rtc0, and set cmos_fd to
+ * a file descriptor for it.
* Failing that, select and initialize direct I/O ports mode.
*/
static
@@ -549,16 +552,30 @@ void cmos_init ()
{
if (using_dev_rtc < 0)
{
- cmos_fd = open ("/dev/rtc", O_RDONLY);
+ cmos_device = "/dev/rtc";
+ cmos_fd = open (cmos_device, O_RDONLY);
if (cmos_fd >= 0)
{
if(verbose)
- fprintf (stdout, "opened /dev/rtc for reading\n");
+ fprintf (stdout, "opened %s for reading\n", cmos_device);
using_dev_rtc = 1;
return;
}
if(verbose)
- fprintf (stdout, "cannot open /dev/rtc for reading\n");
+ fprintf (stdout, "cannot open %s for reading\n", cmos_device);
+
+ /* falback on /dev/rtc0 */
+ cmos_device = "/dev/rtc0";
+ cmos_fd = open (cmos_device, O_RDONLY);
+ if (cmos_fd >= 0)
+ {
+ if(verbose)
+ fprintf (stdout, "opened %s for reading\n", cmos_device);
+ using_dev_rtc = 1;
+ return;
+ }
+ if(verbose)
+ fprintf (stdout, "cannot open %s for reading\n", cmos_device);
using_dev_rtc = 0;
}
else if (using_dev_rtc > 0)
@@ -644,6 +661,6 @@ cmos_read_time (time_t *cmos_timep, doub
{
if (verbose)
fprintf(stdout,
- "/dev/rtc doesn't allow user access to update interrupts\n"
- " - using busy wait instead\n");
+ "%s doesn't allow user access to update interrupts\n"
+ " - using busy wait instead\n", cmos_device);
@@ -666,7 +683,10 @@ cmos_read_time (time_t *cmos_timep, doub
if (rc == -1)
{
- perror("read() from /dev/rtc to wait for clock tick failed");
+ char message[128];
+ snprintf(message, sizeof(message),
+ "read() from %s to wait for clock tick failed",
cmos_device);
+ perror(message);
exit(1);
}
type = (int)(interrupt_info & 0xff);