summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorAdeel <adeelbm@outlook.com>2019-05-10 06:41:47 +0000
committerAdeel <adeelbm@outlook.com>2019-05-11 05:26:53 +0000
commit67c83438bad8cd8f0ba20b370e4cace746ef57d1 (patch)
treef07c5c71bfcbec2496a63cc6f23a244fd5ff9e56 /src
parente0fd735a866861b35679ac503193809a305fac2b (diff)
downloadcoreclr-67c83438bad8cd8f0ba20b370e4cace746ef57d1.tar.gz
coreclr-67c83438bad8cd8f0ba20b370e4cace746ef57d1.tar.bz2
coreclr-67c83438bad8cd8f0ba20b370e4cace746ef57d1.zip
Fix CPUSET_T definition for FreeBSD
Diffstat (limited to 'src')
-rw-r--r--src/gc/unix/config.h.in2
-rw-r--r--src/gc/unix/configure.cmake11
-rw-r--r--src/gc/unix/gcenv.unix.cpp12
3 files changed, 21 insertions, 4 deletions
diff --git a/src/gc/unix/config.h.in b/src/gc/unix/config.h.in
index 7f4d8d766c..ae33c02796 100644
--- a/src/gc/unix/config.h.in
+++ b/src/gc/unix/config.h.in
@@ -18,5 +18,7 @@
#cmakedefine01 HAVE_MACH_ABSOLUTE_TIME
#cmakedefine01 HAVE_SCHED_GETAFFINITY
#cmakedefine01 HAVE_PTHREAD_GETAFFINITY_NP
+#cmakedefine01 HAVE_PTHREAD_NP_H
+#cmakedefine01 HAVE_CPUSET_T
#endif // __CONFIG_H__
diff --git a/src/gc/unix/configure.cmake b/src/gc/unix/configure.cmake
index 3e478c4e6b..859ffa4c48 100644
--- a/src/gc/unix/configure.cmake
+++ b/src/gc/unix/configure.cmake
@@ -1,7 +1,10 @@
check_include_files(sys/time.h HAVE_SYS_TIME_H)
check_include_files(sys/mman.h HAVE_SYS_MMAN_H)
check_include_files(numa.h HAVE_NUMA_H)
+check_include_files(pthread_np.h HAVE_PTHREAD_NP_H)
+
check_function_exists(vm_allocate HAVE_VM_ALLOCATE)
+
check_cxx_source_compiles("
#include <pthread.h>
#include <stdint.h>
@@ -42,6 +45,14 @@ check_cxx_source_compiles("
}
" HAVE_MAP_HUGETLB)
+check_cxx_source_compiles("
+#include <pthread_np.h>
+int main(int argc, char **argv) {
+ cpuset_t cpuSet;
+
+ return 0;
+}" HAVE_CPUSET_T)
+
check_cxx_source_runs("
#include <sched.h>
diff --git a/src/gc/unix/gcenv.unix.cpp b/src/gc/unix/gcenv.unix.cpp
index c248082c95..f08021706f 100644
--- a/src/gc/unix/gcenv.unix.cpp
+++ b/src/gc/unix/gcenv.unix.cpp
@@ -48,6 +48,14 @@
# endif
#endif
+#if HAVE_PTHREAD_NP_H
+#include <pthread_np.h>
+#endif
+
+#if HAVE_CPUSET_T
+typedef cpuset_t cpu_set_t;
+#endif
+
#include <time.h> // nanosleep
#include <sched.h> // sched_yield
#include <errno.h>
@@ -136,10 +144,6 @@ uint32_t g_pageSizeUnixInl = 0;
AffinitySet g_processAffinitySet;
-#if HAVE_CPUSET_T
-typedef cpuset_t cpu_set_t;
-#endif
-
// The highest NUMA node available
int g_highestNumaNode = 0;
// Is numa available