summaryrefslogtreecommitdiff
path: root/src/mongo/stdx
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-07 23:11:07 +0000
commitef08d0dbc99db8c4620512e92bfb3154282eb5d3 (patch)
tree99a71137a52795871cb631ba6e682546a288c2f1 /src/mongo/stdx
parent4635c1f58339cbe754ffd908a16e8d6ebe7aa5a0 (diff)
downloadmongo-ef08d0dbc99db8c4620512e92bfb3154282eb5d3.tar.gz
SERVER-59459 With glibc-2.34, MINSIGSTKSZ is no longer a constant
Diffstat (limited to 'src/mongo/stdx')
-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 7b15bb561bd..6f1e16cdeb3 100644
--- a/src/mongo/stdx/thread.h
+++ b/src/mongo/stdx/thread.h
@@ -76,11 +76,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();
}
@@ -107,9 +115,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 {