[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [util-linux PATCH v2] Support hwclock for GNU Hurd
From: |
Samuel Thibault |
Subject: |
Re: [util-linux PATCH v2] Support hwclock for GNU Hurd |
Date: |
Sun, 8 Dec 2024 17:43:39 +0100 |
Hello,
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?
> 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.
> +#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
Samuel