diff options
author | Khem Raj <raj.khem@gmail.com> | 2016-11-06 23:25:27 -0800 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2016-11-15 15:19:54 +0000 |
commit | 1baf4a47ad2bb7365f969ca99d6eba41547e4b63 (patch) | |
tree | fe6670b930058a59afc2bfa26cc8830d1ed5cab5 /meta/recipes-core | |
parent | 9bf3f80e8862e9028a4f2115fbe2bc42a0b60a4f (diff) | |
download | poky-1baf4a47ad2bb7365f969ca99d6eba41547e4b63.tar.gz |
glibc-2.0: Detect pthread_getname_np() before use
Fixes build with musl
(From OE-Core rev: 572ae87d5fd7fbde87affd2fdc267ac33f3544ff)
Signed-off-by: Khem Raj <raj.khem@gmail.com>
Signed-off-by: Ross Burton <ross.burton@intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta/recipes-core')
-rw-r--r-- | meta/recipes-core/glib-2.0/glib-2.0/0001-Test-for-pthread_getname_np-before-using-it.patch | 70 | ||||
-rw-r--r-- | meta/recipes-core/glib-2.0/glib-2.0_2.50.1.bb | 1 |
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 @@ | |||
1 | From f627fe16099a2b08d8b4e9023ae6b4f352451967 Mon Sep 17 00:00:00 2001 | ||
2 | From: Khem Raj <raj.khem@gmail.com> | ||
3 | Date: Sun, 6 Nov 2016 08:59:08 -0800 | ||
4 | Subject: [PATCH] Test for pthread_getname_np before using it | ||
5 | |||
6 | Its a GNU extention and not all libc implement it | ||
7 | musl e.g. implements the setname API but not getname | ||
8 | in any case, it seems to be safer to check for the | ||
9 | function before using it. | ||
10 | |||
11 | Signed-off-by: Khem Raj <raj.khem@gmail.com> | ||
12 | --- | ||
13 | Upstream-Status: Submitted | ||
14 | |||
15 | config.h.in | 3 +++ | ||
16 | configure.ac | 10 ++++++++++ | ||
17 | glib/tests/thread.c | 2 +- | ||
18 | 3 files changed, 14 insertions(+), 1 deletion(-) | ||
19 | |||
20 | diff --git a/config.h.in b/config.h.in | ||
21 | index 2c35ff1..da7ac30 100644 | ||
22 | --- a/config.h.in | ||
23 | +++ b/config.h.in | ||
24 | @@ -326,6 +326,9 @@ | ||
25 | #undef HAVE_PTHREAD_COND_TIMEDWAIT_RELATIVE_NP | ||
26 | |||
27 | /* Have function pthread_setname_np(const char*) */ | ||
28 | +#undef HAVE_PTHREAD_GETNAME_NP | ||
29 | + | ||
30 | +/* Have function pthread_setname_np(const char*) */ | ||
31 | #undef HAVE_PTHREAD_SETNAME_NP_WITHOUT_TID | ||
32 | |||
33 | /* Have function pthread_setname_np(pthread_t, const char*) */ | ||
34 | diff --git a/configure.ac b/configure.ac | ||
35 | index 4309671..209770a 100644 | ||
36 | --- a/configure.ac | ||
37 | +++ b/configure.ac | ||
38 | @@ -2121,6 +2121,16 @@ AS_IF([ test x"$have_threads" = xposix], [ | ||
39 | AC_DEFINE(HAVE_PTHREAD_COND_TIMEDWAIT_RELATIVE_NP,1, | ||
40 | [Have function pthread_cond_timedwait_relative_np])], | ||
41 | [AC_MSG_RESULT(no)]) | ||
42 | + dnl gets thread names | ||
43 | + AC_MSG_CHECKING(for pthread_getname_np(pthread_t, char*, size_t)) | ||
44 | + AC_LINK_IFELSE( | ||
45 | + [AC_LANG_PROGRAM( | ||
46 | + [#include <pthread.h>], | ||
47 | + [pthread_getname_np(pthread_self(),"example",0)])], | ||
48 | + [AC_MSG_RESULT(yes) | ||
49 | + AC_DEFINE(HAVE_PTHREAD_GETNAME_NP,1, | ||
50 | + [Have function pthread_setname_np(const char*)])], | ||
51 | + [AC_MSG_RESULT(no)]) | ||
52 | dnl Sets thread names on OS X 10.6, iOS 3.2 (and higher) | ||
53 | AC_MSG_CHECKING(for pthread_setname_np(const char*)) | ||
54 | AC_LINK_IFELSE( | ||
55 | diff --git a/glib/tests/thread.c b/glib/tests/thread.c | ||
56 | index 5447836..2f248a6 100644 | ||
57 | --- a/glib/tests/thread.c | ||
58 | +++ b/glib/tests/thread.c | ||
59 | @@ -174,7 +174,7 @@ test_thread5 (void) | ||
60 | static gpointer | ||
61 | thread6_func (gpointer data) | ||
62 | { | ||
63 | -#ifdef HAVE_PTHREAD_SETNAME_NP_WITH_TID | ||
64 | +#if defined(HAVE_PTHREAD_SETNAME_NP_WITH_TID) && defined(HAVE_PTHREAD_GETNAME_NP) | ||
65 | char name[16]; | ||
66 | |||
67 | pthread_getname_np (pthread_self(), name, 16); | ||
68 | -- | ||
69 | 2.10.2 | ||
70 | |||
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 \ | |||
16 | file://gi-exclude.patch \ | 16 | file://gi-exclude.patch \ |
17 | file://0001-Install-gio-querymodules-as-libexec_PROGRAM.patch \ | 17 | file://0001-Install-gio-querymodules-as-libexec_PROGRAM.patch \ |
18 | file://0001-Do-not-ignore-return-value-of-write.patch \ | 18 | file://0001-Do-not-ignore-return-value-of-write.patch \ |
19 | file://0001-Test-for-pthread_getname_np-before-using-it.patch \ | ||
19 | " | 20 | " |
20 | 21 | ||
21 | SRC_URI_append_class-native = " file://glib-gettextize-dir.patch \ | 22 | SRC_URI_append_class-native = " file://glib-gettextize-dir.patch \ |