On Wed, 2016-03-02 at 14:25 +0100, Jan Pokorný wrote:
> On 02/03/16 11:21 +0100, Svante Signell wrote:
> > Attached is an updated patch, the previous one was wrong, since GNU/Hurd
> > does
> > not support abstract sockets.
> 
> Fix the whitespace error mentioned in-line below first, please.

Done, new patch attached.

> > 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:
> > 
> (gdb) help set follow-fork-mode

> Would the above help you?  You can should be able to break on fork and set
> that per your needs repeatedly, if needed.

Thanks, I'll try that. And thanks for your prompt response.
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