Change rlim_t to size_t in setStackSize in preparation of Windows impl

This commit is contained in:
PoweredByPie 2024-05-18 04:09:56 -07:00
parent beb3c2bc7a
commit e42d00c961
2 changed files with 4 additions and 4 deletions

View file

@ -60,14 +60,14 @@ unsigned int getMaxCPU()
#ifndef _WIN32 #ifndef _WIN32
rlim_t savedStackSize = 0; size_t savedStackSize = 0;
void setStackSize(rlim_t stackSize) void setStackSize(size_t stackSize)
{ {
struct rlimit limit; struct rlimit limit;
if (getrlimit(RLIMIT_STACK, &limit) == 0 && limit.rlim_cur < stackSize) { if (getrlimit(RLIMIT_STACK, &limit) == 0 && limit.rlim_cur < stackSize) {
savedStackSize = limit.rlim_cur; savedStackSize = limit.rlim_cur;
limit.rlim_cur = std::min(stackSize, limit.rlim_max); limit.rlim_cur = std::min(static_cast<rlim_t>(stackSize), limit.rlim_max);
if (setrlimit(RLIMIT_STACK, &limit) != 0) { if (setrlimit(RLIMIT_STACK, &limit) != 0) {
logger->log( logger->log(
lvlError, lvlError,

View file

@ -21,7 +21,7 @@ unsigned int getMaxCPU();
/** /**
* Change the stack size. * Change the stack size.
*/ */
void setStackSize(rlim_t stackSize); void setStackSize(size_t stackSize);
#endif #endif
/** /**