diff options
author | ADAM David Alan Martin <adam.martin@10gen.com> | 2017-06-06 13:59:03 -0400 |
---|---|---|
committer | ADAM David Alan Martin <adam.martin@10gen.com> | 2017-06-06 13:59:03 -0400 |
commit | f692588b64a5d89d12d3c3438bd068193bb5ed9d (patch) | |
tree | ae5a0baef429090470b8a720f1cda3d16c8b8ff7 /src/mongo/util/processinfo_freebsd.cpp | |
parent | 39cd3e84fc60f67112f2c1182207dcf9b13be967 (diff) | |
download | mongo-f692588b64a5d89d12d3c3438bd068193bb5ed9d.tar.gz |
SERVER-29458 Fix building on FreeBSD
`ProcessInfo::getNumAvailableCores` has no implementation on
FreeBSD. After the change made in `153c4a036ac` (SERVER-29238),
the codebase is no longer able to build on FreeBSD. This is due
to a missing implementation of `ProcessInfo::getNumAvailableCores`
on FreeBSD. The implementation was always missing, but as it
is finally used after the referenced change, the final binaries
will not link.
Diffstat (limited to 'src/mongo/util/processinfo_freebsd.cpp')
-rw-r--r-- | src/mongo/util/processinfo_freebsd.cpp | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/src/mongo/util/processinfo_freebsd.cpp b/src/mongo/util/processinfo_freebsd.cpp index 461405aad90..d9bf1aa72fd 100644 --- a/src/mongo/util/processinfo_freebsd.cpp +++ b/src/mongo/util/processinfo_freebsd.cpp @@ -189,4 +189,12 @@ bool ProcessInfo::pagesInMemory(const void* start, size_t numPages, vector<char> } return true; } + +// get the number of CPUs available to the scheduler +boost::optional<unsigned long> ProcessInfo::getNumAvailableCores() { + long nprocs = sysconf(_SC_NPROCESSORS_ONLN); + if (nprocs) + return nprocs; + return boost::none; } +} // namespace mongo |