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.
This commit is contained in:
David Carlier 2022-06-07 21:43:08 +01:00 committed by Qi Wang
parent a1c7d9c046
commit 58478412be
3 changed files with 6 additions and 2 deletions

View File

@ -32,7 +32,7 @@
# include <sys/uio.h> # include <sys/uio.h>
# endif # endif
# include <pthread.h> # include <pthread.h>
# if defined(__FreeBSD__) || defined(__DragonFly__) # if defined(__FreeBSD__) || defined(__DragonFly__) || defined(__OpenBSD__)
# include <pthread_np.h> # include <pthread_np.h>
# include <sched.h> # include <sched.h>
# if defined(__FreeBSD__) # if defined(__FreeBSD__)

View File

@ -142,7 +142,7 @@
# define JEMALLOC_COLD # define JEMALLOC_COLD
#endif #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 # define JEMALLOC_SYS_NOTHROW
#else #else
# define JEMALLOC_SYS_NOTHROW JEMALLOC_NOTHROW # define JEMALLOC_SYS_NOTHROW JEMALLOC_NOTHROW

View File

@ -80,6 +80,9 @@ background_thread_info_init(tsdn_t *tsdn, background_thread_info_t *info) {
static inline bool static inline bool
set_current_thread_affinity(int cpu) { set_current_thread_affinity(int cpu) {
#ifdef __OpenBSD__
return false;
#else
#if defined(JEMALLOC_HAVE_SCHED_SETAFFINITY) #if defined(JEMALLOC_HAVE_SCHED_SETAFFINITY)
cpu_set_t cpuset; cpu_set_t cpuset;
#else #else
@ -110,6 +113,7 @@ set_current_thread_affinity(int cpu) {
# endif # endif
return ret != 0; return ret != 0;
#endif #endif
#endif
} }
#define BILLION UINT64_C(1000000000) #define BILLION UINT64_C(1000000000)