linux_os=no
bsd_os=no
+gnu_os=no
AS_CASE([${host_os}],
[*linux*],
[linux_os=yes],
[*darwin*],
[darwin_os=yes],
[*bsd*],
- [bsd_os=yes])
+ [bsd_os=yes],
+ [gnu*],
+ [gnu_os=yes])
AM_CONDITIONAL([LINUX], [test "x$linux_os" = xyes])
AM_CONDITIONAL([DARWIN], [test "x$darwin_os" = xyes])
AM_CONDITIONAL([BSD], [test "x$bsd_os" = xyes])
+AM_CONDITIONAL([HURD], [test "x$gnu_os" = xyes])
AS_IF([test "x$darwin_os" = xyes], [
AC_DEFINE([_DARWIN_C_SOURCE], [1], [Enable MAP_ANON in sys/mman.h on Mac OS X])
lib/monotonic.c
hwclock_LDADD += $(REALTIME_LIBS)
endif
+if HURD
+hwclock_SOURCES += \
+ sys-utils/hwclock-rtc.c \
+ lib/monotonic.c
+endif
if HAVE_AUDIT
hwclock_LDADD += -laudit
endif
*
* rtc.c - Use /dev/rtc for clock access
*/
+#ifdef __GNU__
+#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__ */
+#include <errno.h>
#include <fcntl.h>
#include <stdio.h>
#include <stdlib.h>
#include "hwclock.h"
+#ifndef __GNU__
#ifndef RTC_PARAM_GET
struct rtc_param {
__u64 param;
{
return hwclock_params;
}
+#endif /* __GNU__ */
/*
* /dev/rtc is conventionally chardev 10/135
/* --rtc option has been given */
if (ctl->rtc_dev_name) {
rtc_dev_name = ctl->rtc_dev_name;
+#ifdef __GNU__
+ rtc_dev_fd = open(rtc_dev_name, O_RDWR);
+#else
rtc_dev_fd = open(rtc_dev_name, O_RDONLY);
+#endif
} else {
for (i = 0; i < ARRAY_SIZE(fls); i++) {
if (ctl->verbose)
printf(_("Trying to open: %s\n"), fls[i]);
+#ifdef __GNU__
+ rtc_dev_fd = open(fls[i], O_RDWR);
+#else
rtc_dev_fd = open(fls[i], O_RDONLY);
+#endif
if (rtc_dev_fd < 0) {
if (errno == ENOENT || errno == ENODEV)
+#ifndef __GNU__
static int resolve_rtc_param_alias(const char *alias, __u64 *value)
{
const struct hwclock_param *param = &hwclock_params[0];
return 0;
}
+#endif /* __GNU__ */
if (ctl->directisa)
ur = probe_for_cmos_clock();
#endif
-#ifdef __linux__
+#if defined(__linux__) || defined(__GNU__)
if (!ur)
ur = probe_for_rtc_clock(ctl);
#endif
#if defined(__linux__) && defined(__alpha__)
char *epoch_option;
#endif
-#ifdef __linux__
+#if defined(__linux__) || defined(__GNU__)
char *rtc_dev_name;
+#endif
+#ifdef __linux__
uint32_t param_idx; /* --param-index <n> */
#endif
char *param_get_option;