mirror of
https://github.com/FEX-Emu/FEX.git
synced 2026-10-10 14:00:18 +02:00
Turns out the Linux kernel's definition of `MINSIGSTKSZ` and glibc's definition of `MINSIGSTKSZ` don't match. The linux kernel has a massive comment about it in `arch/x86/kernel/signal.c`. Also adds a unittest for it. For #5206
21 lines
432 B
C++
21 lines
432 B
C++
#include <catch2/catch_test_macros.hpp>
|
|
|
|
#include <unistd.h>
|
|
#include <sys/wait.h>
|
|
#include <sys/syscall.h>
|
|
|
|
TEST_CASE("sysaltstack - minimum") {
|
|
char test[4096];
|
|
constexpr size_t EXPECTED_MIN = 2048;
|
|
|
|
stack_t stack {
|
|
.ss_sp = test,
|
|
.ss_flags = 0,
|
|
.ss_size = 0,
|
|
};
|
|
for (size_t i = 1; i < sizeof(test); ++i) {
|
|
stack.ss_size = i;
|
|
CHECK(sigaltstack(&stack, nullptr) == (i < EXPECTED_MIN ? -1 : 0));
|
|
}
|
|
}
|