mirror of
https://gitlab.gnome.org/GNOME/glib.git
synced 2024-12-24 14:36:13 +01:00
Fix futex(2) detection and use
Commit 22e7fc34c4
introduced a regression:
futexes were always disabled and the emulated codepath was always being
used. That commit was in response to an originally buggy
implementationt hat wrote junk into config.h (but happened to be working
properly).
Fix up the mess and while we're at it, close bug #631231 by including
syscall.h from the correct location and using __NR_futex instead of
SYS_futex.
Closes #631231.
This commit is contained in:
parent
8382135265
commit
858a328792
@ -2580,22 +2580,20 @@ dnl ************************
|
||||
AC_MSG_CHECKING([for futex(2) system call])
|
||||
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([
|
||||
#include <linux/futex.h>
|
||||
#include <syscall.h>
|
||||
#include <sys/syscall.h>
|
||||
#include <unistd.h>
|
||||
],[
|
||||
int
|
||||
main (void)
|
||||
{
|
||||
/* it is not like this actually runs or anything... */
|
||||
syscall (SYS_futex, NULL, FUTEX_WAKE, FUTEX_WAIT);
|
||||
syscall (__NR_futex, NULL, FUTEX_WAKE, FUTEX_WAIT);
|
||||
return 0;
|
||||
}
|
||||
])],
|
||||
[
|
||||
AC_MSG_RESULT(yes)
|
||||
if test "$have_futex" = "yes"; then
|
||||
AC_DEFINE(HAVE_FUTEX, 1, [we have the futex(2) system call])
|
||||
fi
|
||||
AC_DEFINE(HAVE_FUTEX, 1, [we have the futex(2) system call])
|
||||
],
|
||||
[
|
||||
AC_MSG_RESULT(no)
|
||||
|
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user