--- util-linux-2.7/sys-utils/kbdrate.c.orig Sun Jul 6 23:11:52 1997 +++ util-linux-2.7/sys-utils/kbdrate.c Fri Sep 5 14:07:33 1997 @@ -59,6 +59,7 @@ */ +#include #include #include #include @@ -192,7 +193,7 @@ valid_rates[value & 0x1f] / 10.0, valid_delays[ (value & 0x60) >> 5 ] ); -#ifdef KDKBREP +#ifdef KDKBDREP } #endif --- util-linux-2.7.1.orig/sys-utils/hwclock.c +++ util-linux-2.7.1/sys-utils/hwclock.c @@ -140,7 +140,7 @@ via the rtc device driver, using device special file /dev/rtc. KD: - via the console driver, using device special file /dev/console. + via the console driver, using device special file /dev/tty1. This is the m64k ioctl interface. NO_CLOCK: @@ -453,8 +453,8 @@ case RTC_IOCTL: synchronize_to_clock_tick_RTC(&retcode); break; case KD: if (debug) - printf("Can't wait for clock tick because we're using the Alpha " - "/dev/console clock! Assuming a clock tick.\n"); + printf("Can't wait for clock tick because we're using the m68k " + "KDGHWCLK clock! Assuming a clock tick.\n"); retcode = 1; break; default: @@ -523,16 +523,16 @@ read_hardware_clock_kd(struct tm *tm) { /*---------------------------------------------------------------------------- Read the hardware clock and return the current time via - argument. Use ioctls to /dev/console on what we assume is an Alpha + argument. Use ioctls to /dev/tty1 on what we assume is an m68k machine. -----------------------------------------------------------------------------*/ #ifdef KDGHWCLK int con_fd; struct hwclk_time t; - con_fd = open("/dev/console", O_RDONLY); + con_fd = open("/dev/tty1", O_RDONLY); if (con_fd < 0) { - fprintf(stderr, "open() failed to open /dev/console, errno = %s (%d).\n", + fprintf(stderr, "open() failed to open /dev/tty1, errno = %s (%d).\n", strerror(errno), errno); exit(5); } else { @@ -540,7 +540,7 @@ rc = ioctl(con_fd, kdghwclk_ioctl, &t); if (rc == -1) { - fprintf(stderr, "ioctl() failed to read time from /dev/console, " + fprintf(stderr, "ioctl() failed to read time from /dev/tty1, " "errno = %s (%d).\n", strerror(errno), errno); exit(5); @@ -679,34 +679,34 @@ const bool testing) { /*---------------------------------------------------------------------------- Set the Hardware Clock to the time . Use ioctls to - /dev/console on what we assume is an Alpha machine. + /dev/tty1 on what we assume is an m68k machine. ----------------------------------------------------------------------------*/ #ifdef KDGHWCLK - int con_fd; /* File descriptor of /dev/console */ + int con_fd; /* File descriptor of /dev/tty1 */ struct hwclk_time t; - con_fd = open("/dev/console", O_RDONLY); + con_fd = open("/dev/tty1", O_RDONLY); if (con_fd < 0) { - fprintf(stderr, "Error opening /dev/console. Errno: %s (%d)\n", + fprintf(stderr, "Error opening /dev/tty1. Errno: %s (%d)\n", strerror(errno), errno); exit(1); } else { int rc; /* locally used return code */ - t.sec = new_broken_time->tm_sec; - t.min = new_broken_time->tm_min; - t.hour = new_broken_time->tm_hour; - t.day = new_broken_time->tm_mday; - t.mon = new_broken_time->tm_mon; - t.year = new_broken_time->tm_year; - t.wday = new_broken_time->tm_wday; + t.sec = new_broken_time.tm_sec; + t.min = new_broken_time.tm_min; + t.hour = new_broken_time.tm_hour; + t.day = new_broken_time.tm_mday; + t.mon = new_broken_time.tm_mon; + t.year = new_broken_time.tm_year; + t.wday = new_broken_time.tm_wday; if (testing) printf("Not setting Hardware Clock because running in test mode.\n"); else { rc = ioctl(con_fd, kdshwclk_ioctl, &t ); if (rc < 0) { - fprintf(stderr, "ioctl() to open /dev/console failed. " + fprintf(stderr, "ioctl() to open /dev/tty1 failed. " "Errno: %s (%d)\n", strerror(errno), errno); exit(1); @@ -1269,7 +1269,7 @@ int con_fd; struct hwclk_time t; - con_fd = open("/dev/console", O_RDONLY); + con_fd = open("/dev/tty1", O_RDONLY); if (con_fd >= 0) { if (ioctl( con_fd, kdghwclk_ioctl, &t ) >= 0) *clock_access_p = KD; @@ -1287,7 +1287,7 @@ } else { *clock_access_p = KD; fprintf(stderr, - "Can't open /dev/console. open() errno = %s (%d).\n", + "Can't open /dev/tty1. open() errno = %s (%d).\n", strerror(errno), errno); } close(con_fd); @@ -1297,7 +1297,7 @@ if (debug) { switch (*clock_access_p) { case ISA: printf("Using direct I/O instructions to ISA clock.\n"); break; - case KD: printf("Using /dev/console interface to Alpha clock.\n"); break; + case KD: printf("Using /dev/tty1 interface to m68k clock.\n"); break; case RTC_IOCTL: printf("Using /dev/rtc interface to clock.\n"); break; default: printf("determine_clock_access_method() returned invalid value: %d.\n", @@ -1338,7 +1338,13 @@ bool no_auth; /* User lacks necessary authorization to access the clock */ if (clock_access == ISA) { +#ifdef __i386__ + /* This syscall exists only on i386; other arch's libs don't even + * implement it */ rc = iopl(3); +#else + rc = -1; +#endif if (rc != 0) { fprintf(stderr, MYNAME " is unable to get I/O port access. " "I.e. iopl(3) returned nonzero return code %d.\n"