ca6ddd823f
POCO C++ libraries for network based applications C++ class libraries for network-centric, portable applications, integrated perfectly with the C++ Standard Library. Includes network protocols (Sockets, HTTP, FTP, SMTP, POP3, etc.) and an XML parser. With a lot of feedback from landry@ Finally OK from dcoppa@
34 lines
1.0 KiB
Plaintext
34 lines
1.0 KiB
Plaintext
$OpenBSD: patch-Foundation_src_Environment_UNIX_cpp,v 1.1.1.1 2010/07/28 18:13:01 sebastia Exp $
|
|
|
|
fix use of unavailable sysctlbyname
|
|
|
|
--- Foundation/src/Environment_UNIX.cpp.orig Mon Jul 19 12:13:06 2010
|
|
+++ Foundation/src/Environment_UNIX.cpp Mon Jul 19 12:22:52 2010
|
|
@@ -128,12 +128,26 @@ std::string EnvironmentImpl::nodeNameImpl()
|
|
unsigned EnvironmentImpl::processorCountImpl()
|
|
{
|
|
#if defined(POCO_OS_FAMILY_BSD)
|
|
+# if defined(__OpenBSD__)
|
|
+ int mib[2];
|
|
+ int ncpus = 0;
|
|
+ size_t len = 0;
|
|
+ mib[0] = CTL_HW;
|
|
+ mib[1] = HW_NCPU; /* Get the number of CPU's present */
|
|
+ len = sizeof(ncpus);
|
|
+ if (sysctl(mib, 2, &ncpus, &len, NULL, 0) != 0) {
|
|
+ printf("Couldn't determine hw.ncpu.\n");
|
|
+ return 1; /* we have at least 1 cpu... */
|
|
+ }
|
|
+ return ncpus;
|
|
+# else
|
|
unsigned count;
|
|
std::size_t size = sizeof(count);
|
|
if (sysctlbyname("hw.ncpu", &count, &size, 0, 0))
|
|
return 1;
|
|
else
|
|
return count;
|
|
+# endif
|
|
#elif POCO_OS == POCO_OS_HPUX
|
|
return pthread_num_processors_np();
|
|
#elif defined(_SC_NPROCESSORS_ONLN)
|