summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrew Morrow <acm@mongodb.com>2021-09-15 15:23:42 -0400
committerEvergreen Agent <no-reply@evergreen.mongodb.com>2021-10-20 01:10:38 +0000
commitddee85735f38dc77f233dc16840658c8764e65cb (patch)
treebdbb0199753c6ee9514eef0e8abc76d6c740b111
parent0aa523559cd68b32f025a8127272ddfbf8a1a30f (diff)
downloadmongo-ddee85735f38dc77f233dc16840658c8764e65cb.tar.gz
SERVER-59459 With glibc-2.34, MINSIGSTKSZ is no longer a constant
(cherry picked from commit ef08d0dbc99db8c4620512e92bfb3154282eb5d3) (cherry picked from commit 959d10ecad8f59dbbb755b2eebab2bffed6bab32) (cherry picked from commit 167a957f8d4d71db7a3a720052ec72e5d68724f7)
-rw-r--r--src/mongo/stdx/thread.h14
1 files changed, 10 insertions, 4 deletions
diff --git a/src/mongo/stdx/thread.h b/src/mongo/stdx/thread.h
index f8058279e34..a4142323752 100644
--- a/src/mongo/stdx/thread.h
+++ b/src/mongo/stdx/thread.h
@@ -75,11 +75,19 @@ public:
}
private:
+ static size_t _getStackSize() {
+ // It would be nice for this to be a constexpr, but
+ // MINSIGSTKSZ became a macro that invoked `sysconf` in glibc
+ // 2.34.
+ static const std::size_t kMinSigStkSz = MINSIGSTKSZ;
+ return std::max(kMongoMinSignalStackSize, kMinSigStkSz);
+ }
+
void _install() const {
stack_t ss = {};
ss.ss_sp = _stackStorage.get();
ss.ss_flags = 0;
- ss.ss_size = kStackSize;
+ ss.ss_size = _getStackSize();
if (sigaltstack(&ss, nullptr)) {
abort();
}
@@ -106,9 +114,7 @@ private:
// ( https://jira.mongodb.org/secure/attachment/233569/233569_stacktrace-writeup.txt )
static constexpr std::size_t kMongoMinSignalStackSize = std::size_t{64} << 10;
- static constexpr std::size_t kStackSize =
- std::max(kMongoMinSignalStackSize, std::size_t{MINSIGSTKSZ});
- std::unique_ptr<std::byte[]> _stackStorage = std::make_unique<std::byte[]>(kStackSize);
+ std::unique_ptr<std::byte[]> _stackStorage = std::make_unique<std::byte[]>(_getStackSize());
#else // !MONGO_HAS_SIGALTSTACK
auto makeInstallGuard() const {