diff options
author | Jose <pepone@users.noreply.github.com> | 2019-07-02 12:02:08 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-07-02 12:02:08 +0200 |
commit | d44f1fb14cbdae099fcf7dafd0d247a4555a02bc (patch) | |
tree | 29c7a1b86b6a5944097318ed2b8cd2ea9137b9dc | |
parent | Wait 60s for the process controller to start (needed for Android) (diff) | |
download | ice-d44f1fb14cbdae099fcf7dafd0d247a4555a02bc.tar.bz2 ice-d44f1fb14cbdae099fcf7dafd0d247a4555a02bc.tar.xz ice-d44f1fb14cbdae099fcf7dafd0d247a4555a02bc.zip |
Check sysconf errors Close #418 (#420)
-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]) |