Merge pull request #29820 from azat/MINSIGSTKSZ-fix

Fix compilation with glibc 2.34 (MINSIGSTKSZ defined as sysconf(_SC_SIGSTKSZ))
This commit is contained in:
Dmitry Novik 2021-10-11 17:06:29 +03:00 committed by GitHub
commit a651c1bb67
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -44,7 +44,7 @@ namespace
struct ThreadStack
{
ThreadStack()
: data(aligned_alloc(getPageSize(), size))
: data(aligned_alloc(getPageSize(), getSize()))
{
/// Add a guard page
/// (and since the stack grows downward, we need to protect the first page).
@ -56,12 +56,11 @@ struct ThreadStack
free(data);
}
static size_t getSize() { return size; }
static size_t getSize() { return std::max<size_t>(16 << 10, MINSIGSTKSZ); }
void * getData() const { return data; }
private:
/// 16 KiB - not too big but enough to handle error.
static constexpr size_t size = std::max<size_t>(16 << 10, MINSIGSTKSZ);
void * data;
};