Skip to content

Commit 7c8c71f

Browse files
committed
Totally exclude nix::setStackSize on Windows
1 parent b644e57 commit 7c8c71f

File tree

3 files changed

+7
-2
lines changed

3 files changed

+7
-2
lines changed

src/libutil/current-process.cc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -51,11 +51,11 @@ unsigned int getMaxCPU()
5151
//////////////////////////////////////////////////////////////////////
5252

5353

54+
#ifndef _WIN32
5455
size_t savedStackSize = 0;
5556

5657
void setStackSize(size_t stackSize)
5758
{
58-
#ifndef _WIN32
5959
struct rlimit limit;
6060
if (getrlimit(RLIMIT_STACK, &limit) == 0 && limit.rlim_cur < stackSize) {
6161
savedStackSize = limit.rlim_cur;
@@ -73,8 +73,8 @@ void setStackSize(size_t stackSize)
7373
);
7474
}
7575
}
76-
#endif
7776
}
77+
#endif
7878

7979
void restoreProcessContext(bool restoreMounts)
8080
{

src/libutil/current-process.hh

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,10 +17,13 @@ namespace nix {
1717
*/
1818
unsigned int getMaxCPU();
1919

20+
// It does not seem possible to dynamically change stack size on Windows.
21+
#ifndef _WIN32
2022
/**
2123
* Change the stack size.
2224
*/
2325
void setStackSize(size_t stackSize);
26+
#endif
2427

2528
/**
2629
* Restore the original inherited Unix process context (such as signal

src/nix/main.cc

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -557,9 +557,11 @@ void mainWrapped(int argc, char * * argv)
557557

558558
int main(int argc, char * * argv)
559559
{
560+
#ifndef _WIN32
560561
// Increase the default stack size for the evaluator and for
561562
// libstdc++'s std::regex.
562563
nix::setStackSize(64 * 1024 * 1024);
564+
#endif
563565

564566
return nix::handleExceptions(argv[0], [&]() {
565567
nix::mainWrapped(argc, argv);

0 commit comments

Comments
 (0)