forked from lix-project/lix
Artemis Tosini
742b6e4786
Previously, the garbage collector found runtime roots on Darwin by
shelling out to `lsof -n -w -F n` then parsing the result.
However, this requires an lsof binary and can be extremely slow.
The official Apple lsof returns in a reasonable amount of time,
about 250ms in my tests, but the lsof packaged in nixpkgs is quite slow,
taking about 40 seconds to run the command.
Using libproc directly is about the same speed as Apple lsof,
and allows us to reënable several tests that were disabled on Darwin.
Change-Id: Ifa0adda7984e13c15535693baba835aae79a3577
30 lines
589 B
Nix
30 lines
589 B
Nix
with import ./config.nix;
|
|
|
|
{
|
|
environ = mkDerivation {
|
|
name = "gc-runtime-environ";
|
|
buildCommand = "mkdir $out; echo environ > $out/environ";
|
|
};
|
|
|
|
open = mkDerivation {
|
|
name = "gc-runtime-open";
|
|
buildCommand = "mkdir $out; echo open > $out/open";
|
|
};
|
|
|
|
program = mkDerivation {
|
|
name = "gc-runtime-program";
|
|
builder =
|
|
# Test inline source file definitions.
|
|
builtins.toFile "builder.sh" ''
|
|
mkdir $out
|
|
|
|
cat > $out/program <<EOF
|
|
#! ${shell}
|
|
sleep 10000 < \$1
|
|
EOF
|
|
|
|
chmod +x $out/program
|
|
'';
|
|
};
|
|
}
|