$OpenBSD: patch-thread-utils_c,v 1.1 2019/11/03 15:25:22 jca Exp $

Use sysconf(_SC_NPROCESSORS_ONLN) to properly omit disabled smt cores.

Index: thread-utils.c
--- thread-utils.c.orig
+++ thread-utils.c
@@ -25,9 +25,10 @@ int online_cpus(void)
 #else
 #ifdef _SC_NPROCESSORS_ONLN
 	long ncpus;
-#endif
 
-#ifdef GIT_WINDOWS_NATIVE
+	if ((ncpus = (long)sysconf(_SC_NPROCESSORS_ONLN)) > 0)
+		return (int)ncpus;
+#elif defined(GIT_WINDOWS_NATIVE)
 	SYSTEM_INFO info;
 	GetSystemInfo(&info);
 
@@ -55,11 +56,6 @@ int online_cpus(void)
 	if (!sysctl(mib, 2, &cpucount, &len, NULL, 0))
 		return cpucount;
 #endif /* defined(HAVE_BSD_SYSCTL) && defined(HW_NCPU) */
-
-#ifdef _SC_NPROCESSORS_ONLN
-	if ((ncpus = (long)sysconf(_SC_NPROCESSORS_ONLN)) > 0)
-		return (int)ncpus;
-#endif
 
 	return 1;
 #endif
