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-11-02 13:16:17 +0000
commit8ddc9941280e8bf4a07082e9cc6889d944de4ae9 (patch)
tree079b074f36440f0aadde2c329e9e7a35a8cdd7d7
parent68747c621e2d432235e301d38422dd03600ceadd (diff)
downloadmongo-8ddc9941280e8bf4a07082e9cc6889d944de4ae9.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) (cherry picked from commit ddee85735f38dc77f233dc16840658c8764e65cb)
-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 bbb5a4c244f..74d60b3009b 100644
--- a/src/mongo/stdx/thread.h
+++ b/src/mongo/stdx/thread.h
@@ -73,11 +73,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();
}
@@ -104,9 +112,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 {