Index: runtime/src/kmp.h =================================================================== --- runtime/src/kmp.h +++ runtime/src/kmp.h @@ -1033,6 +1033,10 @@ /* TODO: tune for KMP_OS_NETBSD */ #define KMP_INIT_WAIT 1024U /* initial number of spin-tests */ #define KMP_NEXT_WAIT 512U /* susequent number of spin-tests */ +#elif KMP_OS_OPENBSD +/* TODO: tune for KMP_OS_OPENBSD */ +#define KMP_INIT_WAIT 1024U /* initial number of spin-tests */ +#define KMP_NEXT_WAIT 512U /* susequent number of spin-tests */ #endif #if KMP_ARCH_X86 || KMP_ARCH_X86_64 Index: runtime/src/kmp_ftn_entry.h =================================================================== --- runtime/src/kmp_ftn_entry.h +++ runtime/src/kmp_ftn_entry.h @@ -370,7 +370,7 @@ #else int gtid; -#if KMP_OS_DARWIN || KMP_OS_FREEBSD || KMP_OS_NETBSD +#if KMP_OS_DARWIN || KMP_OS_FREEBSD || KMP_OS_NETBSD || KMP_OS_OPENBSD gtid = __kmp_entry_gtid(); #elif KMP_OS_WINDOWS if (!__kmp_init_parallel || Index: runtime/src/kmp_platform.h =================================================================== --- runtime/src/kmp_platform.h +++ runtime/src/kmp_platform.h @@ -19,6 +19,7 @@ #define KMP_OS_LINUX 0 #define KMP_OS_FREEBSD 0 #define KMP_OS_NETBSD 0 +#define KMP_OS_OPENBSD 0 #define KMP_OS_DARWIN 0 #define KMP_OS_WINDOWS 0 #define KMP_OS_CNK 0 @@ -54,18 +55,24 @@ #define KMP_OS_NETBSD 1 #endif +#if (defined __OpenBSD__) +#undef KMP_OS_OPENBSD +#define KMP_OS_OPENBSD 1 +#endif + #if (defined __bgq__) #undef KMP_OS_CNK #define KMP_OS_CNK 1 #endif #if (1 != \ - KMP_OS_LINUX + KMP_OS_FREEBSD + KMP_OS_NETBSD + KMP_OS_DARWIN + \ - KMP_OS_WINDOWS) + KMP_OS_LINUX + KMP_OS_FREEBSD + KMP_OS_NETBSD + KMP_OS_OPENBSD + \ + KMP_OS_DARWIN + KMP_OS_WINDOWS) #error Unknown OS #endif -#if KMP_OS_LINUX || KMP_OS_FREEBSD || KMP_OS_NETBSD || KMP_OS_DARWIN +#if KMP_OS_LINUX || KMP_OS_FREEBSD || KMP_OS_NETBSD || KMP_OS_OPENBSD || \ + KMP_OS_DARWIN #undef KMP_OS_UNIX #define KMP_OS_UNIX 1 #endif Index: runtime/src/kmp_runtime.cpp =================================================================== --- runtime/src/kmp_runtime.cpp +++ runtime/src/kmp_runtime.cpp @@ -7656,8 +7656,8 @@ #if KMP_ARCH_X86_64 || KMP_ARCH_PPC64 || KMP_ARCH_AARCH64 || KMP_ARCH_MIPS64 -#if KMP_OS_LINUX || KMP_OS_FREEBSD || KMP_OS_NETBSD || KMP_OS_WINDOWS || \ - KMP_OS_DARWIN +#if KMP_OS_LINUX || KMP_OS_FREEBSD || KMP_OS_NETBSD || KMP_OS_OPENBSD || \ + KMP_OS_WINDOWS || KMP_OS_DARWIN int teamsize_cutoff = 4; @@ -7679,8 +7679,8 @@ } #else #error "Unknown or unsupported OS" -#endif // KMP_OS_LINUX || KMP_OS_FREEBSD || KMP_OS_NETBSD || KMP_OS_WINDOWS || -// KMP_OS_DARWIN +#endif // KMP_OS_LINUX || KMP_OS_FREEBSD || KMP_OS_NETBSD || KMP_OS_OPENBSD || +// KMP_OS_WINDOWS || KMP_OS_DARWIN #elif KMP_ARCH_X86 || KMP_ARCH_ARM || KMP_ARCH_AARCH || KMP_ARCH_MIPS Index: runtime/src/kmp_wrapper_malloc.h =================================================================== --- runtime/src/kmp_wrapper_malloc.h +++ runtime/src/kmp_wrapper_malloc.h @@ -94,7 +94,7 @@ #if KMP_OS_WINDOWS #include // Windows* OS: _alloca() declared in "malloc.h". #define alloca _alloca // Allow to use alloca() with no underscore. -#elif KMP_OS_FREEBSD || KMP_OS_NETBSD +#elif KMP_OS_FREEBSD || KMP_OS_NETBSD || KMP_OS_OPENBSD // Declared in "stdlib.h". #elif KMP_OS_UNIX #include // Linux* OS and OS X*: alloc() declared in "alloca". Index: runtime/src/z_Linux_util.cpp =================================================================== --- runtime/src/z_Linux_util.cpp +++ runtime/src/z_Linux_util.cpp @@ -22,7 +22,7 @@ #include "kmp_wait_release.h" #include "kmp_wrapper_getpid.h" -#if !KMP_OS_FREEBSD && !KMP_OS_NETBSD +#if !KMP_OS_FREEBSD && !KMP_OS_NETBSD && !KMP_OS_OPENBSD #include #endif #include // HUGE_VAL. @@ -497,7 +497,7 @@ sigset_t new_set, old_set; #endif /* KMP_BLOCK_SIGNALS */ void *exit_val; -#if KMP_OS_LINUX || KMP_OS_FREEBSD || KMP_OS_NETBSD +#if KMP_OS_LINUX || KMP_OS_FREEBSD || KMP_OS_NETBSD || KMP_OS_OPENBSD void *volatile padding = 0; #endif int gtid; @@ -545,7 +545,7 @@ KMP_CHECK_SYSFAIL("pthread_sigmask", status); #endif /* KMP_BLOCK_SIGNALS */ -#if KMP_OS_LINUX || KMP_OS_FREEBSD || KMP_OS_NETBSD +#if KMP_OS_LINUX || KMP_OS_FREEBSD || KMP_OS_NETBSD || KMP_OS_OPENBSD if (__kmp_stkoffset > 0 && gtid > 0) { padding = KMP_ALLOCA(gtid * __kmp_stkoffset); } @@ -1751,7 +1751,7 @@ int r = 0; -#if KMP_OS_LINUX || KMP_OS_FREEBSD || KMP_OS_NETBSD +#if KMP_OS_LINUX || KMP_OS_FREEBSD || KMP_OS_NETBSD || KMP_OS_OPENBSD r = sysconf(_SC_NPROCESSORS_ONLN); @@ -1997,9 +1997,9 @@ found = 1; } -#elif KMP_OS_FREEBSD || KMP_OS_NETBSD +#elif KMP_OS_FREEBSD || KMP_OS_NETBSD || KMP_OS_OPENBSD - // FIXME(FreeBSD, NetBSD): Implement this + // FIXME(FreeBSD, NetBSD, OpenBSD): Implement this found = 1; #else