summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Carlier <devnexen@gmail.com>2022-06-07 21:43:08 +0100
committerQi Wang <interwq@gwu.edu>2022-07-19 13:20:11 -0700
commit58478412be842e140cc03dbb0c6ce84b2b8d096e (patch)
tree6966ae2378ee5d5fbe3d34f7ee93a23935dc2021
parenta1c7d9c046c2a90b978dc409d366b89303c96ab6 (diff)
downloadjemalloc-58478412be842e140cc03dbb0c6ce84b2b8d096e.tar.gz
OpenBSD build fix. still no cpu affinity.
- enabling pthread_get/pthread_set_name_np api. - disabling per thread cpu affinity handling, unsupported on this platform.
-rw-r--r--include/jemalloc/internal/jemalloc_internal_decls.h2
-rw-r--r--include/jemalloc/jemalloc_macros.h.in2
-rw-r--r--src/background_thread.c4
3 files changed, 6 insertions, 2 deletions
diff --git a/include/jemalloc/internal/jemalloc_internal_decls.h b/include/jemalloc/internal/jemalloc_internal_decls.h
index 983027c8..77ba1c9a 100644
--- a/include/jemalloc/internal/jemalloc_internal_decls.h
+++ b/include/jemalloc/internal/jemalloc_internal_decls.h
@@ -32,7 +32,7 @@
# include <sys/uio.h>
# endif
# include <pthread.h>
-# if defined(__FreeBSD__) || defined(__DragonFly__)
+# if defined(__FreeBSD__) || defined(__DragonFly__) || defined(__OpenBSD__)
# include <pthread_np.h>
# include <sched.h>
# if defined(__FreeBSD__)
diff --git a/include/jemalloc/jemalloc_macros.h.in b/include/jemalloc/jemalloc_macros.h.in
index ebb3137e..2de3f27d 100644
--- a/include/jemalloc/jemalloc_macros.h.in
+++ b/include/jemalloc/jemalloc_macros.h.in
@@ -142,7 +142,7 @@
# define JEMALLOC_COLD
#endif
-#if (defined(__APPLE__) || defined(__FreeBSD__)) && !defined(JEMALLOC_NO_RENAME)
+#if (defined(__APPLE__) || defined(__FreeBSD__) || defined(__OpenBSD__)) && !defined(JEMALLOC_NO_RENAME)
# define JEMALLOC_SYS_NOTHROW
#else
# define JEMALLOC_SYS_NOTHROW JEMALLOC_NOTHROW
diff --git a/src/background_thread.c b/src/background_thread.c
index 3bb8d26c..f22174d6 100644
--- a/src/background_thread.c
+++ b/src/background_thread.c
@@ -80,6 +80,9 @@ background_thread_info_init(tsdn_t *tsdn, background_thread_info_t *info) {
static inline bool
set_current_thread_affinity(int cpu) {
+#ifdef __OpenBSD__
+ return false;
+#else
#if defined(JEMALLOC_HAVE_SCHED_SETAFFINITY)
cpu_set_t cpuset;
#else
@@ -110,6 +113,7 @@ set_current_thread_affinity(int cpu) {
# endif
return ret != 0;
#endif
+#endif
}
#define BILLION UINT64_C(1000000000)