From 4cf0001823d4f5cdcc98848c25fc6bcc89058a36 Mon Sep 17 00:00:00 2001 From: Steven Chamberlain Date: Wed, 13 Jul 2016 16:13:59 +0100 Subject: [PATCH 1/2] Use glibc headers on GNU/kFreeBSD On GNU/kFreeBSD, the glibc-provided alloca.h and signal.h can be used, instead of the ones the compat headers would try to include instead. --- include/compat/freebsd/alloca.h | 4 ++++ include/compat/freebsd/signal.h | 4 ++++ 2 files changed, 8 insertions(+) diff --git a/include/compat/freebsd/alloca.h b/include/compat/freebsd/alloca.h index c8b49f2..c1acc38 100644 --- a/include/compat/freebsd/alloca.h +++ b/include/compat/freebsd/alloca.h @@ -1 +1,5 @@ +#if BX_CRT_GLIBC +#include_next +#else #include +#endif diff --git a/include/compat/freebsd/signal.h b/include/compat/freebsd/signal.h index fd7d90f..deb07d2 100644 --- a/include/compat/freebsd/signal.h +++ b/include/compat/freebsd/signal.h @@ -1 +1,5 @@ +#ifdef BX_CRT_GLIBC +#include_next +#else #include +#endif From bdf3e9c8d360fc6324660ef1689196691d457ab7 Mon Sep 17 00:00:00 2001 From: Steven Chamberlain Date: Thu, 14 Jul 2016 09:30:34 +0100 Subject: [PATCH 2/2] Refactor around BX_CRT_GLIBC Also allow the glibc function to be used on BSD platforms (not only Linux). For example, GNU/kFreeBSD will have this. --- include/bx/thread.h | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/include/bx/thread.h b/include/bx/thread.h index 3f3abda..d7c951b 100644 --- a/include/bx/thread.h +++ b/include/bx/thread.h @@ -11,9 +11,9 @@ # if defined(__FreeBSD__) # include # endif -# if defined(__GLIBC__) && !( (__GLIBC__ > 2) || ( (__GLIBC__ == 2) && (__GLIBC_MINOR__ >= 12) ) ) +# if defined(__linux__) && (BX_CRT_GLIBC < 21200) # include -# endif // defined(__GLIBC__) ... +# endif #elif BX_PLATFORM_WINRT using namespace Platform; using namespace Windows::Foundation; @@ -157,12 +157,10 @@ namespace bx { #if BX_PLATFORM_OSX || BX_PLATFORM_IOS pthread_setname_np(_name); -#elif BX_PLATFORM_LINUX -# if defined(__GLIBC__) && (__GLIBC__ > 2) || ( (__GLIBC__ == 2) && (__GLIBC_MINOR__ >= 12) ) +#elif (BX_CRT_GLIBC >= 21200) pthread_setname_np(m_handle, _name); -# else +#elif BX_PLATFORM_LINUX prctl(PR_SET_NAME,_name, 0, 0, 0); -# endif // defined(__GLIBC__) ... #elif BX_PLATFORM_BSD #ifdef __NetBSD__ pthread_setname_np(m_handle, "%s", (void *)_name);