diff options
author | Eelco Dolstra <e.dolstra@tudelft.nl> | 2009-03-26T11·02+0000 |
---|---|---|
committer | Eelco Dolstra <e.dolstra@tudelft.nl> | 2009-03-26T11·02+0000 |
commit | 5dd8fb20691c375778fd73bf613d4988df72fb50 (patch) | |
tree | 942d57bc30560be4675190ba0507b813a95a5b10 | |
parent | 92f525ecf4ea8a9bd356acd1d3845074b1e5b918 (diff) |
* Don't use ULLONG_MAX in maxFreed - use 0 to mean "no limit".
18446744073709551615ULL breaks on GCC 3.3.6 (`integer constant is too large for "long" type').
-rw-r--r-- | src/libstore/gc.cc | 2 | ||||
-rw-r--r-- | src/libstore/store-api.cc | 8 | ||||
-rw-r--r-- | src/libstore/store-api.hh | 3 | ||||
-rw-r--r-- | src/nix-store/nix-store.cc | 5 |
4 files changed, 8 insertions, 10 deletions
diff --git a/src/libstore/gc.cc b/src/libstore/gc.cc index 552016584af1..b5cc21de44ac 100644 --- a/src/libstore/gc.cc +++ b/src/libstore/gc.cc @@ -482,7 +482,7 @@ void LocalStore::gcPath(const GCOptions & options, GCResults & results, results.bytesFreed += bytesFreed; results.blocksFreed += blocksFreed; - if (results.bytesFreed > options.maxFreed) { + if (options.maxFreed && results.bytesFreed > options.maxFreed) { printMsg(lvlInfo, format("deleted more than %1% bytes; stopping") % options.maxFreed); throw GCLimitReached(); } diff --git a/src/libstore/store-api.cc b/src/libstore/store-api.cc index e80be1e68c5a..eb75d3ada1f4 100644 --- a/src/libstore/store-api.cc +++ b/src/libstore/store-api.cc @@ -5,12 +5,6 @@ #include <limits.h> -/* Needed for some ancient environments. */ -#ifndef ULLONG_MAX -#define ULLONG_MAX 18446744073709551615ULL -#endif - - namespace nix { @@ -18,7 +12,7 @@ GCOptions::GCOptions() { action = gcDeleteDead; ignoreLiveness = false; - maxFreed = ULLONG_MAX; + maxFreed = 0; maxLinks = 0; useAtime = false; maxAtime = (time_t) -1; diff --git a/src/libstore/store-api.hh b/src/libstore/store-api.hh index 1c6f737285d6..bac2f6b9a26c 100644 --- a/src/libstore/store-api.hh +++ b/src/libstore/store-api.hh @@ -56,7 +56,8 @@ struct GCOptions /* For `gcDeleteSpecific', the paths to delete. */ PathSet pathsToDelete; - /* Stop after at least `maxFreed' bytes have been freed. */ + /* Stop after at least `maxFreed' bytes have been freed. 0 means + no limit. */ unsigned long long maxFreed; /* Stop after the number of hard links to the Nix store directory diff --git a/src/nix-store/nix-store.cc b/src/nix-store/nix-store.cc index 28cd1adf4027..e84288137990 100644 --- a/src/nix-store/nix-store.cc +++ b/src/nix-store/nix-store.cc @@ -531,7 +531,10 @@ static void opGC(Strings opFlags, Strings opArgs) else if (*i == "--print-live") options.action = GCOptions::gcReturnLive; else if (*i == "--print-dead") options.action = GCOptions::gcReturnDead; else if (*i == "--delete") options.action = GCOptions::gcDeleteDead; - else if (*i == "--max-freed") options.maxFreed = getIntArg(*i, i, opFlags.end()); + else if (*i == "--max-freed") { + options.maxFreed = getIntArg(*i, i, opFlags.end()); + if (options.maxFreed == 0) options.maxFreed = 1; + } else if (*i == "--max-links") options.maxLinks = getIntArg(*i, i, opFlags.end()); else if (*i == "--use-atime") options.useAtime = true; else if (*i == "--max-atime") { |