aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKhem Raj <raj.khem@gmail.com>2016-11-06 23:25:27 -0800
committerRichard Purdie <richard.purdie@linuxfoundation.org>2016-11-15 15:18:49 +0000
commit572ae87d5fd7fbde87affd2fdc267ac33f3544ff (patch)
treefd7bfeeb441a6e49ac202dddc647fd49363e7bc1
parent757224640bbf4ebf17aea22fa1419c9c3bcd89ce (diff)
downloadopenembedded-core-contrib-572ae87d5fd7fbde87affd2fdc267ac33f3544ff.tar.gz
glibc-2.0: Detect pthread_getname_np() before use
Fixes build with musl Signed-off-by: Khem Raj <raj.khem@gmail.com> Signed-off-by: Ross Burton <ross.burton@intel.com>
-rw-r--r--meta/recipes-core/glib-2.0/glib-2.0/0001-Test-for-pthread_getname_np-before-using-it.patch70
-rw-r--r--meta/recipes-core/glib-2.0/glib-2.0_2.50.1.bb1
2 files changed, 71 insertions, 0 deletions
diff --git a/meta/recipes-core/glib-2.0/glib-2.0/0001-Test-for-pthread_getname_np-before-using-it.patch b/meta/recipes-core/glib-2.0/glib-2.0/0001-Test-for-pthread_getname_np-before-using-it.patch
new file mode 100644
index 0000000000..c6e4966bb8
--- /dev/null
+++ b/meta/recipes-core/glib-2.0/glib-2.0/0001-Test-for-pthread_getname_np-before-using-it.patch
@@ -0,0 +1,70 @@
+From f627fe16099a2b08d8b4e9023ae6b4f352451967 Mon Sep 17 00:00:00 2001
+From: Khem Raj <raj.khem@gmail.com>
+Date: Sun, 6 Nov 2016 08:59:08 -0800
+Subject: [PATCH] Test for pthread_getname_np before using it
+
+Its a GNU extention and not all libc implement it
+musl e.g. implements the setname API but not getname
+in any case, it seems to be safer to check for the
+function before using it.
+
+Signed-off-by: Khem Raj <raj.khem@gmail.com>
+---
+Upstream-Status: Submitted
+
+ config.h.in | 3 +++
+ configure.ac | 10 ++++++++++
+ glib/tests/thread.c | 2 +-
+ 3 files changed, 14 insertions(+), 1 deletion(-)
+
+diff --git a/config.h.in b/config.h.in
+index 2c35ff1..da7ac30 100644
+--- a/config.h.in
++++ b/config.h.in
+@@ -326,6 +326,9 @@
+ #undef HAVE_PTHREAD_COND_TIMEDWAIT_RELATIVE_NP
+
+ /* Have function pthread_setname_np(const char*) */
++#undef HAVE_PTHREAD_GETNAME_NP
++
++/* Have function pthread_setname_np(const char*) */
+ #undef HAVE_PTHREAD_SETNAME_NP_WITHOUT_TID
+
+ /* Have function pthread_setname_np(pthread_t, const char*) */
+diff --git a/configure.ac b/configure.ac
+index 4309671..209770a 100644
+--- a/configure.ac
++++ b/configure.ac
+@@ -2121,6 +2121,16 @@ AS_IF([ test x"$have_threads" = xposix], [
+ AC_DEFINE(HAVE_PTHREAD_COND_TIMEDWAIT_RELATIVE_NP,1,
+ [Have function pthread_cond_timedwait_relative_np])],
+ [AC_MSG_RESULT(no)])
++ dnl gets thread names
++ AC_MSG_CHECKING(for pthread_getname_np(pthread_t, char*, size_t))
++ AC_LINK_IFELSE(
++ [AC_LANG_PROGRAM(
++ [#include <pthread.h>],
++ [pthread_getname_np(pthread_self(),"example",0)])],
++ [AC_MSG_RESULT(yes)
++ AC_DEFINE(HAVE_PTHREAD_GETNAME_NP,1,
++ [Have function pthread_setname_np(const char*)])],
++ [AC_MSG_RESULT(no)])
+ dnl Sets thread names on OS X 10.6, iOS 3.2 (and higher)
+ AC_MSG_CHECKING(for pthread_setname_np(const char*))
+ AC_LINK_IFELSE(
+diff --git a/glib/tests/thread.c b/glib/tests/thread.c
+index 5447836..2f248a6 100644
+--- a/glib/tests/thread.c
++++ b/glib/tests/thread.c
+@@ -174,7 +174,7 @@ test_thread5 (void)
+ static gpointer
+ thread6_func (gpointer data)
+ {
+-#ifdef HAVE_PTHREAD_SETNAME_NP_WITH_TID
++#if defined(HAVE_PTHREAD_SETNAME_NP_WITH_TID) && defined(HAVE_PTHREAD_GETNAME_NP)
+ char name[16];
+
+ pthread_getname_np (pthread_self(), name, 16);
+--
+2.10.2
+
diff --git a/meta/recipes-core/glib-2.0/glib-2.0_2.50.1.bb b/meta/recipes-core/glib-2.0/glib-2.0_2.50.1.bb
index 00ae7ef22e..17016c80c0 100644
--- a/meta/recipes-core/glib-2.0/glib-2.0_2.50.1.bb
+++ b/meta/recipes-core/glib-2.0/glib-2.0_2.50.1.bb
@@ -16,6 +16,7 @@ SRC_URI = "${GNOME_MIRROR}/glib/${SHRT_VER}/glib-${PV}.tar.xz \
file://gi-exclude.patch \
file://0001-Install-gio-querymodules-as-libexec_PROGRAM.patch \
file://0001-Do-not-ignore-return-value-of-write.patch \
+ file://0001-Test-for-pthread_getname_np-before-using-it.patch \
"
SRC_URI_append_class-native = " file://glib-gettextize-dir.patch \