Skip to content

Commit

Permalink
Add page size system features
Browse files Browse the repository at this point in the history
  • Loading branch information
RossComputerGuy committed Feb 11, 2025
1 parent 2d9b213 commit 4a4a76c
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions src/libstore/globals.cc
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,10 @@
#include <sys/sysctl.h>
#endif

#ifdef __linux__
#include <sys/auxv.h>
#endif

#include "strings.hh"

namespace nix {
Expand Down Expand Up @@ -196,6 +200,16 @@ StringSet Settings::getDefaultSystemFeatures()
features.insert("apple-virt");
#endif

#if __linux__
unsigned long pgsize = getauxval(AT_PAGESZ);
#else
unsigned long pgsize = getpagesize();
#endif

for (; pgsize <= (64 * 1024); pgsize *= 2) {
features.insert(fmt("pages-%1%k", pgsize / 1024));
}

return features;
}

Expand Down

0 comments on commit 4a4a76c

Please sign in to comment.