On Fri, 2016-02-19 at 11:40 +0100, Svante Signell wrote:
> Hello,
> 
> The attached patch, hurd_support.patch, against git master adds support for
> the GNU/Hurd OS. Please consider including this patch to upstream git. It has
> already been reported in Debian as bug #803777 against version 0.17.2.real-4,
> see https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=803777

Attached is an updated patch, the previous one was wrong, since GNU/Hurd does
not support abstract sockets. With this patch 7 of 8 tests PASS: The failing
test ipc.test needs some more time to debug.

I have one question about the testsuite:
Is it possible to remove the check package overrides in the tests, especially
for ipc.test? Since check use fork(2) to create a separate address space it is
very difficult to trace execution with gdb. Any ideas would be appreciated.

From 1190966924f671cfd0cc54ff3805a74b845c74f1 Mon Sep 17 00:00:00 2001
From: Svante Signell <[email protected]>
Date: Wed, 2 Mar 2016 10:46:02 +0100
Subject: [PATCH] Add Hurd support

  * configure.ac: Define QB_GNU

  * lib/log_thread.c: Replace second argument of
  qb_log_thread_priority_set(): logt_sched_param.sched_priority by 0
  when not supported by the OS.

  * lib/util.c: Fall back to CLOCK_REALTIME in clock_getres() if
    CLOCK_MONOTONIC fails.

---
 configure.ac     | 5 +++++
 lib/log_thread.c | 4 ++++
 lib/util.c       | 8 ++++++--
 3 files changed, 15 insertions(+), 2 deletions(-)

diff --git a/configure.ac b/configure.ac
index 7cfde10..10dd0df 100644
--- a/configure.ac
+++ b/configure.ac
@@ -335,6 +335,11 @@ case "$host_os" in
 		CP=rsync
 		AC_MSG_RESULT([Solaris])
 	;;
+	*gnu*)
+		AC_DEFINE_UNQUOTED([QB_GNU], [1],
+ 				   [Compiling for GNU/Hurd platform])
+		AC_MSG_RESULT([GNU])
+	;;
 	*)
 		AC_MSG_ERROR([Unsupported OS? hmmmm])
 	;;
diff --git a/lib/log_thread.c b/lib/log_thread.c
index 56008f8..930fb33 100644
--- a/lib/log_thread.c
+++ b/lib/log_thread.c
@@ -164,7 +164,11 @@ qb_log_thread_start(void)
 
 	if (logt_sched_param_queued) {
 		res = qb_log_thread_priority_set(logt_sched_policy,
+#if defined(HAVE_PTHREAD_SETSCHEDPARAM) && defined(HAVE_SCHED_GET_PRIORITY_MAX)
 		                                 logt_sched_param.sched_priority);
+#else
+		                                 0);
+#endif
 		if (res != 0) {
 			goto cleanup_pthread;
 		}
diff --git a/lib/util.c b/lib/util.c
index ef5ba25..99f2fb5 100644
--- a/lib/util.c
+++ b/lib/util.c
@@ -169,8 +169,12 @@ qb_util_nano_monotonic_hz(void)
 	uint64_t nano_monotonic_hz;
 	struct timespec ts;
 
-	clock_getres(CLOCK_MONOTONIC, &ts);
-
+	if (clock_getres(CLOCK_MONOTONIC, &ts) != 0)
+	  {
+	    /* If CLOCK_MONOTONIC fails, fall back to CLOCK_REALTIME */
+	    if (clock_getres(CLOCK_REALTIME, &ts) != 0)
+	      qb_util_perror(LOG_ERR,"CLOCK_REALTIME");
+	  }
 	nano_monotonic_hz =
 	    QB_TIME_NS_IN_SEC / ((ts.tv_sec * QB_TIME_NS_IN_SEC) + ts.tv_nsec);
 
-- 
2.6.4

_______________________________________________
Developers mailing list
[email protected]
http://clusterlabs.org/mailman/listinfo/developers

Reply via email to