[glib/glib-2-28] Fix HAVE_FUTEX definition



commit 46e31d1b7a9b8622c734e25bddc42482fc888b57
Author: Matthias Clasen <mclasen redhat com>
Date:   Sun May 22 00:33:05 2011 -0400

    Fix HAVE_FUTEX definition
    
    The previous implementation was buggy and wrote junk into config.h.
    While we're at it, close bug #631231 by including syscall.h from the
    correct location and using __NR_futex instead of SYS_futex.

 configure.ac    |    9 ++++-----
 glib/gbitlock.c |    6 +++---
 2 files changed, 7 insertions(+), 8 deletions(-)
---
diff --git a/configure.ac b/configure.ac
index 99cb153..00848f4 100644
--- a/configure.ac
+++ b/configure.ac
@@ -2533,21 +2533,20 @@ dnl ************************
 AC_MSG_CHECKING([for futex(2) system call])
 AC_COMPILE_IFELSE([ 
 #include <linux/futex.h>
-#include <syscall.h>
+#include <sys/syscall.h>
 #include <unistd.h>
 
 int
 main (void)
 {
-  /* it's not like this actually runs or anything... */
-  syscall (SYS_futex, NULL, FUTEX_WAKE, FUTEX_WAIT);
+  /* it is not like this actually runs or anything... */
+  syscall (__NR_futex, NULL, FUTEX_WAKE, FUTEX_WAIT);
   return 0;
 }
 ],
 [
   AC_MSG_RESULT(yes)
-  AC_DEFINE(HAVE_FUTEX, [test "$have_futex" = "yes"],
-            [we have the futex(2) system call])
+  AC_DEFINE(HAVE_FUTEX, 1, [we have the futex(2) system call])
 ],
 [
   AC_MSG_RESULT(no)
diff --git a/glib/gbitlock.c b/glib/gbitlock.c
index 1b8c417..72e0d6e 100644
--- a/glib/gbitlock.c
+++ b/glib/gbitlock.c
@@ -56,7 +56,7 @@ _g_futex_thread_init (void) {
  * If anyone actually gets bit by this, please file a bug. :)
  */
 #include <linux/futex.h>
-#include <syscall.h>
+#include <sys/syscall.h>
 #include <unistd.h>
 
 /* < private >
@@ -80,7 +80,7 @@ static void
 g_futex_wait (const volatile gint *address,
               gint                 value)
 {
-  syscall (SYS_futex, address, (gsize) FUTEX_WAIT, (gsize) value, NULL);
+  syscall (__NR_futex, address, (gsize) FUTEX_WAIT, (gsize) value, NULL);
 }
 
 /* < private >
@@ -97,7 +97,7 @@ g_futex_wait (const volatile gint *address,
 static void
 g_futex_wake (const volatile gint *address)
 {
-  syscall (SYS_futex, address, (gsize) FUTEX_WAKE, (gsize) 1, NULL);
+  syscall (__NR_futex, address, (gsize) FUTEX_WAKE, (gsize) 1, NULL);
 }
 
 #else



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]