diff options
author | Mark Benvenuto <mark.benvenuto@mongodb.com> | 2015-11-13 15:50:56 -0500 |
---|---|---|
committer | Mark Benvenuto <mark.benvenuto@mongodb.com> | 2015-11-17 18:15:07 -0500 |
commit | 2508a0f3deb4d62b53d76734ca70ca294443629f (patch) | |
tree | 53abfa9faa1d493bd1665c4166c99babf617171f /src/mongo/platform/stack_locator_openbsd.cpp | |
parent | 2695170d3f4ea843103cc901597ff26cee0c3326 (diff) | |
download | mongo-2508a0f3deb4d62b53d76734ca70ca294443629f.tar.gz |
SERVER-21216 Fix FreeBSD & OpenBSD compilation, add stack_locator
Diffstat (limited to 'src/mongo/platform/stack_locator_openbsd.cpp')
-rw-r--r-- | src/mongo/platform/stack_locator_openbsd.cpp | 27 |
1 files changed, 26 insertions, 1 deletions
diff --git a/src/mongo/platform/stack_locator_openbsd.cpp b/src/mongo/platform/stack_locator_openbsd.cpp index af46f763783..014edeaa247 100644 --- a/src/mongo/platform/stack_locator_openbsd.cpp +++ b/src/mongo/platform/stack_locator_openbsd.cpp @@ -26,4 +26,29 @@ * it in the license file. */ -#include "stack_locator_unknown.cpp" +#include "mongo/platform/basic.h" + +#include "mongo/platform/stack_locator.h" + +#include <pthread_np.h> +#include <sys/signal.h> + +#include "mongo/util/assert_util.h" +#include "mongo/util/scopeguard.h" + +namespace mongo { + +StackLocator::StackLocator() { + stack_t stack_info; + + pthread_t self = pthread_self(); + + invariant(pthread_stackseg_np(self, &stack_info) == 0); + + _begin = stack_info.ss_sp; + + // TODO: Assumes stack grows downward on OpenBSD + _end = static_cast<char*>(_begin) - stack_info.ss_size; +} + +} // namespace mongo |