gnunet-fuse: Fix compile with glibc
Always use pthread_mutexattr_settype() the pthread_mutexattr_setkind_np() function is not available in the glibc and musl version used by OpenWrt. This fixes the following compile error: arc-openwrt-linux-gnu/bin/ld: gnunet_fuse-mutex.o: in function `GNUNET_mutex_create': mutex.c:(.text+0x14): undefined reference to `pthread_mutexattr_setkind_np' arc-openwrt-linux-gnu/bin/ld: mutex.c:(.text+0x14): undefined reference to `pthread_mutexattr_setkind_np' arc-openwrt-linux-gnu/bin/ld: mutex.c:(.text+0x76): undefined reference to `pthread_mutexattr_setkind_np' arc-openwrt-linux-gnu/bin/ld: mutex.c:(.text+0x76): undefined reference to `pthread_mutexattr_setkind_np' collect2: error: ld returned 1 exit status This patch was taken from: https://aur.archlinux.org/cgit/aur.git/plain/pthread_mutexattr_settype.patch?h=gnunet-fuse Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
This commit is contained in:
parent
f3a3184d32
commit
1d795f2c1e
2 changed files with 50 additions and 33 deletions
|
@ -1,33 +0,0 @@
|
||||||
--- a/src/fuse/mutex.c
|
|
||||||
+++ b/src/fuse/mutex.c
|
|
||||||
@@ -68,8 +68,13 @@ GNUNET_mutex_create (int isRecursive)
|
|
||||||
if (isRecursive)
|
|
||||||
{
|
|
||||||
#ifdef __linux__
|
|
||||||
+#if defined(__UCLIBC__) || defined(__GLIBC__)
|
|
||||||
GNUNET_assert (0 == pthread_mutexattr_setkind_np
|
|
||||||
(&attr, PTHREAD_MUTEX_RECURSIVE_NP));
|
|
||||||
+#else
|
|
||||||
+ GNUNET_assert (0 == pthread_mutexattr_settype
|
|
||||||
+ (&attr, PTHREAD_MUTEX_RECURSIVE));
|
|
||||||
+#endif
|
|
||||||
#elif BSD || SOLARIS || OSX || WINDOWS
|
|
||||||
GNUNET_assert (0 == pthread_mutexattr_settype
|
|
||||||
(&attr, PTHREAD_MUTEX_RECURSIVE));
|
|
||||||
@@ -78,11 +83,16 @@ GNUNET_mutex_create (int isRecursive)
|
|
||||||
else
|
|
||||||
{
|
|
||||||
#ifdef __linux__
|
|
||||||
+#if defined(__UCLIBC__) || defined(__GLIBC__)
|
|
||||||
GNUNET_assert (0 == pthread_mutexattr_setkind_np
|
|
||||||
(&attr, PTHREAD_MUTEX_ERRORCHECK_NP));
|
|
||||||
#else
|
|
||||||
GNUNET_assert (0 == pthread_mutexattr_settype
|
|
||||||
(&attr, PTHREAD_MUTEX_ERRORCHECK));
|
|
||||||
+#endif
|
|
||||||
+#else
|
|
||||||
+ GNUNET_assert (0 == pthread_mutexattr_settype
|
|
||||||
+ (&attr, PTHREAD_MUTEX_ERRORCHECK));
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
mut = GNUNET_new (struct GNUNET_Mutex);
|
|
50
net/gnunet-fuse/patches/001-pthread_mutexattr_settype.patch
Normal file
50
net/gnunet-fuse/patches/001-pthread_mutexattr_settype.patch
Normal file
|
@ -0,0 +1,50 @@
|
||||||
|
Always use pthread_mutexattr_settype() the
|
||||||
|
pthread_mutexattr_setkind_np() is not available in the glibc and musl
|
||||||
|
version used by OpenWrt.
|
||||||
|
|
||||||
|
This patch was taken from:
|
||||||
|
https://aur.archlinux.org/cgit/aur.git/plain/pthread_mutexattr_settype.patch?h=gnunet-fuse
|
||||||
|
|
||||||
|
--- a/src/fuse/mutex.c
|
||||||
|
+++ b/src/fuse/mutex.c
|
||||||
|
@@ -35,16 +35,6 @@
|
||||||
|
#endif
|
||||||
|
#endif
|
||||||
|
|
||||||
|
-/**
|
||||||
|
- * This prototype is somehow missing in various Linux pthread
|
||||||
|
- * include files. But we need it and it seems to be available
|
||||||
|
- * on all pthread-systems so far. Odd.
|
||||||
|
- */
|
||||||
|
-#ifndef _MSC_VER
|
||||||
|
-extern int pthread_mutexattr_setkind_np (pthread_mutexattr_t * attr,
|
||||||
|
- int kind);
|
||||||
|
-#endif
|
||||||
|
-
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Structure for MUTual EXclusion (Mutex).
|
||||||
|
@@ -67,23 +57,13 @@ GNUNET_mutex_create (int isRecursive)
|
||||||
|
pthread_mutexattr_init (&attr);
|
||||||
|
if (isRecursive)
|
||||||
|
{
|
||||||
|
-#ifdef __linux__
|
||||||
|
- GNUNET_assert (0 == pthread_mutexattr_setkind_np
|
||||||
|
- (&attr, PTHREAD_MUTEX_RECURSIVE_NP));
|
||||||
|
-#elif BSD || SOLARIS || OSX || WINDOWS
|
||||||
|
GNUNET_assert (0 == pthread_mutexattr_settype
|
||||||
|
(&attr, PTHREAD_MUTEX_RECURSIVE));
|
||||||
|
-#endif
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
-#ifdef __linux__
|
||||||
|
- GNUNET_assert (0 == pthread_mutexattr_setkind_np
|
||||||
|
- (&attr, PTHREAD_MUTEX_ERRORCHECK_NP));
|
||||||
|
-#else
|
||||||
|
GNUNET_assert (0 == pthread_mutexattr_settype
|
||||||
|
(&attr, PTHREAD_MUTEX_ERRORCHECK));
|
||||||
|
-#endif
|
||||||
|
}
|
||||||
|
mut = GNUNET_new (struct GNUNET_Mutex);
|
||||||
|
GNUNET_assert (0 == pthread_mutex_init (&mut->pt, &attr));
|
Loading…
Reference in a new issue