diff options
Diffstat (limited to 'cpp/src')
-rw-r--r-- | cpp/src/Ice/ThreadPool.cpp | 12 | ||||
-rw-r--r-- | cpp/src/IceGrid/Activator.cpp | 5 |
2 files changed, 17 insertions, 0 deletions
diff --git a/cpp/src/Ice/ThreadPool.cpp b/cpp/src/Ice/ThreadPool.cpp index b836137170a..7d95c48b2b5 100644 --- a/cpp/src/Ice/ThreadPool.cpp +++ b/cpp/src/Ice/ThreadPool.cpp @@ -273,8 +273,20 @@ IceInternal::ThreadPool::ThreadPool(const InstancePtr& instance, const string& p SYSTEM_INFO sysInfo; GetSystemInfo(&sysInfo); int nProcessors = sysInfo.dwNumberOfProcessors; +# elif defined(__FreeBSD__) || defined(__FreeBSD_kernel__) + static int ncpu[2] = { CTL_HW, HW_NCPU }; + size_t sz = sizeof(nProcessors); + int nProcessors; + if(sysctl(ncpu, 2, &nProcessors, &sz, 0, 0) == -1) + { + nProcessors = 1; + } # else int nProcessors = static_cast<int>(sysconf(_SC_NPROCESSORS_ONLN)); + if(nProcessors == -1) + { + nProcessors = 1; + } # endif #endif diff --git a/cpp/src/IceGrid/Activator.cpp b/cpp/src/IceGrid/Activator.cpp index 46832e71757..9c568f75ef5 100644 --- a/cpp/src/IceGrid/Activator.cpp +++ b/cpp/src/IceGrid/Activator.cpp @@ -743,6 +743,11 @@ Activator::activate(const string& name, // of the newly created pipe. // int maxFd = static_cast<int>(sysconf(_SC_OPEN_MAX)); + if(maxFd <= 0) + { + maxFd = INT_MAX; + } + for(int fd = 3; fd < maxFd; ++fd) { if(fd != fds[1] && fd != errorFds[1]) |