about summary refs log tree commit diff
path: root/scripts/nix-collect-garbage.in
diff options
context:
space:
mode:
authorEelco Dolstra <e.dolstra@tudelft.nl>2005-01-31T10·27+0000
committerEelco Dolstra <e.dolstra@tudelft.nl>2005-01-31T10·27+0000
commit1328aa33077fd1cf84869e366c82b8ea1d1abb5d (patch)
tree8f079aabcfb9d1d5b485170e0edb583c052039ee /scripts/nix-collect-garbage.in
parenta7668411a10c79ad40c9c18caf2570d5c9f52182 (diff)
* Start of concurrent garbage collection. Processes write temporary
  roots to a per-process temporary file in /nix/var/nix/temproots
  while holding a write lock on that file.  The garbage collector
  acquires read locks on all those files, thus blocking further
  progress in other Nix processes, and reads the sets of temporary
  roots.

Diffstat (limited to 'scripts/nix-collect-garbage.in')
-rw-r--r--scripts/nix-collect-garbage.in6
1 files changed, 5 insertions, 1 deletions
diff --git a/scripts/nix-collect-garbage.in b/scripts/nix-collect-garbage.in
index f11ed2cb696a..c92737f25c13 100644
--- a/scripts/nix-collect-garbage.in
+++ b/scripts/nix-collect-garbage.in
@@ -9,6 +9,7 @@ my $storeDir = "@storedir@";
 my %alive;
 
 my $gcOper = "--delete";
+my $extraArgs = "";
 
 my @roots = ();
 
@@ -19,6 +20,9 @@ for (my $i = 0; $i < scalar @ARGV; $i++) {
     if ($arg eq "--delete" || $arg eq "--print-live" || $arg eq "--print-dead") {
         $gcOper = $arg;
     }
+    elsif ($arg =~ /^-v+$/) {
+        $extraArgs = "$extraArgs $arg";
+    }
     else { die "unknown argument `$arg'" };
 }
 
@@ -66,7 +70,7 @@ findRoots 1, $rootsDir;
 
 
 # Run the collector with the roots we found.
-my $pid = open2(">&1", \*WRITE, "@bindir@/nix-store --gc $gcOper")
+my $pid = open2(">&1", \*WRITE, "@bindir@/nix-store --gc $gcOper $extraArgs")
     or die "cannot run `nix-store --gc'";
 
 foreach my $root (@roots) {