1
0
Fork 0
mirror of https://github.com/NixOS/nix synced 2025-06-27 12:41:15 +02:00

Build a minimized Nix with MinGW

At this point many features are stripped out, but this works:

- Can run libnix{util,store,expr} unit tests
- Can run some Nix commands

Co-Authored-By volth <volth@volth.com>
Co-Authored-By Brian McKenna <brian@brianmckenna.org>
This commit is contained in:
John Ericson 2023-09-02 17:35:16 -04:00
parent 2248a3f545
commit 8433027e35
111 changed files with 1162 additions and 140 deletions

View file

@ -19,7 +19,9 @@
# include "namespaces.hh"
#endif
#include <sys/mount.h>
#ifndef _WIN32
# include <sys/mount.h>
#endif
namespace nix {
@ -57,6 +59,7 @@ unsigned int getMaxCPU()
//////////////////////////////////////////////////////////////////////
#ifndef _WIN32
rlim_t savedStackSize = 0;
void setStackSize(rlim_t stackSize)
@ -79,16 +82,20 @@ void setStackSize(rlim_t stackSize)
}
}
}
#endif
void restoreProcessContext(bool restoreMounts)
{
#ifndef _WIN32
unix::restoreSignals();
#endif
if (restoreMounts) {
#if __linux__
restoreMountNamespace();
#endif
}
#ifndef _WIN32
if (savedStackSize) {
struct rlimit limit;
if (getrlimit(RLIMIT_STACK, &limit) == 0) {
@ -96,6 +103,7 @@ void restoreProcessContext(bool restoreMounts)
setrlimit(RLIMIT_STACK, &limit);
}
}
#endif
}