Browse Source

Merge pull request #120 from stevenc99/kfreebsd

GNU/kFreeBSD support
Branimir Karadžić 9 years ago
parent
commit
e446765462
3 changed files with 12 additions and 6 deletions
  1. 4 6
      include/bx/thread.h
  2. 4 0
      include/compat/freebsd/alloca.h
  3. 4 0
      include/compat/freebsd/signal.h

+ 4 - 6
include/bx/thread.h

@@ -11,9 +11,9 @@
 #	if defined(__FreeBSD__)
 #		include <pthread_np.h>
 #	endif
-#	if defined(__GLIBC__) && !( (__GLIBC__ > 2) || ( (__GLIBC__ == 2) && (__GLIBC_MINOR__ >= 12) ) )
+#	if defined(__linux__) && (BX_CRT_GLIBC < 21200)
 #		include <sys/prctl.h>
-#	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);

+ 4 - 0
include/compat/freebsd/alloca.h

@@ -1 +1,5 @@
+#if BX_CRT_GLIBC
+#include_next <alloca.h>
+#else
 #include <stdlib.h>
+#endif

+ 4 - 0
include/compat/freebsd/signal.h

@@ -1 +1,5 @@
+#ifdef BX_CRT_GLIBC
+#include_next <signal.h>
+#else
 #include <sys/signal.h>
+#endif