File tree Expand file tree Collapse file tree 1 file changed +10
-4
lines changed
Expand file tree Collapse file tree 1 file changed +10
-4
lines changed Original file line number Diff line number Diff line change @@ -76,11 +76,19 @@ class SigAltStackController {
7676 }
7777
7878private:
79+ static size_t _getStackSize () {
80+ // It would be nice for this to be a constexpr, but
81+ // MINSIGSTKSZ became a macro that invoked `sysconf` in glibc
82+ // 2.34.
83+ static const std::size_t kMinSigStkSz = MINSIGSTKSZ;
84+ return std::max (kMongoMinSignalStackSize , kMinSigStkSz );
85+ }
86+
7987 void _install () const {
8088 stack_t ss = {};
8189 ss.ss_sp = _stackStorage.get ();
8290 ss.ss_flags = 0 ;
83- ss.ss_size = kStackSize ;
91+ ss.ss_size = _getStackSize () ;
8492 if (sigaltstack (&ss, nullptr )) {
8593 abort ();
8694 }
@@ -107,9 +115,7 @@ class SigAltStackController {
107115 // ( https://jira.mongodb.org/secure/attachment/233569/233569_stacktrace-writeup.txt )
108116 static constexpr std::size_t kMongoMinSignalStackSize = std::size_t {64 } << 10 ;
109117
110- static constexpr std::size_t kStackSize =
111- std::max (kMongoMinSignalStackSize , std::size_t {MINSIGSTKSZ});
112- std::unique_ptr<std::byte[]> _stackStorage = std::make_unique<std::byte[]>(kStackSize );
118+ std::unique_ptr<std::byte[]> _stackStorage = std::make_unique<std::byte[]>(_getStackSize());
113119
114120#else // !MONGO_HAS_SIGALTSTACK
115121 auto makeInstallGuard () const {
You can’t perform that action at this time.
0 commit comments