]> git.ipfire.org Git - thirdparty/ntp.git/commitdiff
[Bug 2810] refclock_shm.c memory barrier code needs tweaks for QNX
authorHarlan Stenn <stenn@ntp.org>
Mon, 20 Apr 2015 10:00:46 +0000 (10:00 +0000)
committerHarlan Stenn <stenn@ntp.org>
Mon, 20 Apr 2015 10:00:46 +0000 (10:00 +0000)
bk: 5534ce4e6qpFDmpfHSUn8ebOn546KQ

ChangeLog
configure.ac
ntpd/refclock_shm.c

index 7c6163295173ab74c6586a3c2e072615f092e74f..bc37f5da296ab725c0abbe35e610667a29b70d8d 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -4,6 +4,7 @@
 * [Bug 2808] GPSD_JSON driver enhancements, step 1.
   Various improvements, see http://bugs.ntp.org/2808 for details.
   Changed libjsmn to a more recent version.
+* [Bug 2810] refclock_shm.c memory barrier code needs tweaks for QNX.
 ---
 (4.2.8p2) 2015/04/07 Released by Harlan Stenn <stenn@ntp.org>
 (4.2.8p2-RC3) 2015/04/03 Released by Harlan Stenn <stenn@ntp.org>
index dc88d2e93a539d7c112547bc56fed99d1309985b..980ea98317a3d69aa4fefc6581c78013552ebe34 100644 (file)
@@ -375,11 +375,27 @@ case "$host" in
     ;;
 esac
 
-dnl case "$ac_cv_header_stdatomic_h" in
-dnl  yes)
-dnl     AC_CHECK_FUNCS([atomic_thread_fence])
-dnl     ;;
-dnl esac
+case "$ac_cv_header_stdatomic_h" in
+ yes)
+       AC_CHECK_FUNCS([atomic_thread_fence])
+       AC_CACHE_CHECK(
+           [for atomic_thread_fence()],
+           [ntp_cv_func_atomic_thread_fence],
+           [AC_COMPILE_IFELSE(
+               [AC_LANG_PROGRAM(
+                   [[
+                       #include <stdatomic.h>
+                   ]],
+                   [[
+                       atomic_thread_fence(memory_order_seq_cst);
+                   ]]
+               )]
+               [ntp_cv_func_atomic_thread_fence=yes],
+               [ntp_cv_func_atomic_thread_fence=no]
+           )]
+       )
+    ;;
+esac
 
 case "$host" in
  *-*-solaris2.6)
index 270b6cfd6052e740410d28bbc6a575a5ff4ef12b..0b3b29f868abef460c858f9e97cb2b244aa22fb5 100644 (file)
@@ -367,9 +367,9 @@ struct shm_stat_t {
 
 static inline void memory_barrier(void)
 {
-#ifdef HAVE_STDATOMIC_H
+#ifdef HAVE_ATOMIC_THREAD_FENCE
     atomic_thread_fence(memory_order_seq_cst);
-#endif /* HAVE_STDATOMIC_H */
+#endif /* HAVE_ATOMIC_THREAD_FENCE */
 }
 
 static enum segstat_t shm_query(volatile struct shmTime *shm_in, struct shm_stat_t *shm_stat)