mirror of
https://github.com/NixOS/nix.git
synced 2025-11-14 06:22:42 +01:00
Also check the NixOS specific files
This commit is contained in:
parent
61c35a810b
commit
3839eb15d6
1 changed files with 13 additions and 0 deletions
|
|
@ -197,6 +197,9 @@ TraceResult followPathsToStore(GlobalOpts opts, set<fs::path> roots)
|
||||||
*/
|
*/
|
||||||
void scanFileContent(const GlobalOpts & opts, const fs::path & fileToScan, Roots & res)
|
void scanFileContent(const GlobalOpts & opts, const fs::path & fileToScan, Roots & res)
|
||||||
{
|
{
|
||||||
|
if (!fs::exists(fileToScan))
|
||||||
|
return;
|
||||||
|
|
||||||
std::ostringstream contentStream;
|
std::ostringstream contentStream;
|
||||||
{
|
{
|
||||||
std::ifstream fs;
|
std::ifstream fs;
|
||||||
|
|
@ -218,6 +221,9 @@ void scanFileContent(const GlobalOpts & opts, const fs::path & fileToScan, Roots
|
||||||
*/
|
*/
|
||||||
void scanMapsFile(const GlobalOpts & opts, const fs::path & mapsFile, Roots & res)
|
void scanMapsFile(const GlobalOpts & opts, const fs::path & mapsFile, Roots & res)
|
||||||
{
|
{
|
||||||
|
if (!fs::exists(mapsFile))
|
||||||
|
return;
|
||||||
|
|
||||||
static auto mapRegex = std::regex(R"(^\s*\S+\s+\S+\s+\S+\s+\S+\s+\S+\s+(/\S+)\s*$)");
|
static auto mapRegex = std::regex(R"(^\s*\S+\s+\S+\s+\S+\s+\S+\s+\S+\s+(/\S+)\s*$)");
|
||||||
std::stringstream mappedFile;
|
std::stringstream mappedFile;
|
||||||
{
|
{
|
||||||
|
|
@ -275,6 +281,13 @@ Roots getRuntimeRoots(GlobalOpts opts)
|
||||||
scanFileContent(opts, procEntry.path()/"environ", res);
|
scanFileContent(opts, procEntry.path()/"environ", res);
|
||||||
scanMapsFile(opts, procEntry.path()/"maps", res);
|
scanMapsFile(opts, procEntry.path()/"maps", res);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Mostly useful for NixOS, but doesn’t hurt to check on other systems
|
||||||
|
// anyways
|
||||||
|
scanFileContent(opts, "/proc/sys/kernel/modprobe", res);
|
||||||
|
scanFileContent(opts, "/proc/sys/kernel/fbsplash", res);
|
||||||
|
scanFileContent(opts, "/proc/sys/kernel/poweroff_cmd", res);
|
||||||
|
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue