bug-hurd
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [util-linux PATCH v2] Support hwclock for GNU Hurd


From: Zhaoming Luo
Subject: Re: [util-linux PATCH v2] Support hwclock for GNU Hurd
Date: Mon, 9 Dec 2024 07:51:38 +0800
User-agent: Mozilla Thunderbird

On 12/9/24 12:43 AM, Samuel Thibault wrote:
Hello,
Hi, thanks for the review.

Zhaoming Luo, le ven. 06 déc. 2024 11:03:26 +0800, a ecrit:
diff --git a/sys-utils/hwclock-cmos.c b/sys-utils/hwclock-cmos.c
index 7e5eecc..cc672cb 100644
--- a/sys-utils/hwclock-cmos.c
+++ b/sys-utils/hwclock-cmos.c
@@ -352,7 +352,9 @@ static int i386_iopl(const int level)
  # else
  static int i386_iopl(const int level __attribute__ ((__unused__)))
  {
+       #ifndef __gnu_hurd__
        extern int ioperm(unsigned long from, unsigned long num, int turn_on);
+       #endif
        return ioperm(clock_ctl_addr, 2, 1);
  }
  # endif

This seems unrelated, do you get an issue without it?

Got the following errors without it:
```
sys-utils/hwclock-cmos.c: In function 'i386_iopl':
sys-utils/hwclock-cmos.c:355:20: warning: nested extern declaration of 'ioperm' [-Wnested-externs] 355 | extern int ioperm(unsigned long from, unsigned long num, int turn_on);
      |                    ^~~~~~
sys-utils/hwclock-cmos.c:355:20: warning: redundant redeclaration of 'ioperm' [-Wredundant-decls]
In file included from sys-utils/hwclock-cmos.c:68:
/usr/include/i386-gnu/sys/io.h:29:12: note: previous declaration of 'ioperm' with type 'int(long unsigned int, long unsigned int, int)' 29 | extern int ioperm (unsigned long int __from, unsigned long int __num,
      |            ^~~~~~
  CCLD     hwclock
```

diff --git a/sys-utils/hwclock-rtc.c b/sys-utils/hwclock-rtc.c
index 2796f2e..c285c42 100644
--- a/sys-utils/hwclock-rtc.c
+++ b/sys-utils/hwclock-rtc.c
@@ -8,10 +8,15 @@
   *
   * rtc.c - Use /dev/rtc for clock access
   */
+#ifdef __gnu_hurd__

Rather use __GNU__ like in other places of the code.
OK.

+#include <sys/ioctl.h>
+#include <hurd/rtc.h>
+#else
  #include <asm/ioctl.h>
-#include <errno.h>
  #include <linux/rtc.h>
  #include <linux/types.h>
+#endif /* GNU_HURD */
+#include <errno.h>
  #include <fcntl.h>
  #include <stdio.h>
  #include <stdlib.h>

diff --git a/sys-utils/hwclock.c b/sys-utils/hwclock.c
index 2b33dfb..e1a105e 100644
--- a/sys-utils/hwclock.c
+++ b/sys-utils/hwclock.c
@@ -989,7 +989,7 @@ static void determine_clock_access_method(const struct 
hwclock_control *ctl)
        if (ctl->directisa)
                ur = probe_for_cmos_clock();
  #endif
-#ifdef __linux__
+#if defined(__linux__) || defined(__gnu_hurd__)
        if (!ur)
                ur = probe_for_rtc_clock(ctl);
  #endif
diff --git a/sys-utils/hwclock.h b/sys-utils/hwclock.h
index 2522d6c..485e904 100644
--- a/sys-utils/hwclock.h
+++ b/sys-utils/hwclock.h
@@ -39,6 +39,9 @@ struct hwclock_control {
  #ifdef __linux__
        char *rtc_dev_name;
        uint32_t param_idx;     /* --param-index <n> */
+#endif
+#ifdef __gnu_hurd__
+       char *rtc_dev_name;
  #endif

Better factorize:

#if defined(__linux__) || defined(__GNU__)
        char *rtc_dev_name;
#endif
#ifdef __linux__
        uint32_t param_idx;     /* --param-index <n> */
#endif
OK.

--
Zhaoming Luo




reply via email to

[Prev in Thread] Current Thread [Next in Thread]