mirror of
https://github.com/privatevoid-net/nix-super.git
synced 2025-02-16 23:27:17 +02:00
Change rlim_t
to size_t
in setStackSize
in preparation of Windows impl
This commit is contained in:
parent
beb3c2bc7a
commit
e42d00c961
2 changed files with 4 additions and 4 deletions
|
@ -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,
|
||||||
|
|
|
@ -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
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
Loading…
Add table
Reference in a new issue