aboutsummaryrefslogtreecommitdiff
path: root/src/libstore/gc.cc
AgeCommit message (Collapse)Author
2021-10-13Use a thread per connectionEelco Dolstra
2021-10-13Fix auto-gcEelco Dolstra
2021-10-13Non-blocking garbage collectorEelco Dolstra
The garbage collector no longer blocks other processes from adding/building store paths or adding GC roots. To prevent the collector from deleting store paths just added by another process, processes need to connect to the garbage collector via a Unix domain socket to register new temporary roots.
2021-10-13Remove syncWithGC()Eelco Dolstra
2021-10-13Remove trash directoryEelco Dolstra
2021-06-18UDSRemoteStore: Support the 'root' store parameterEelco Dolstra
Useful when we're using a daemon with a chroot store, e.g. $ NIX_DAEMON_SOCKET_PATH=/tmp/chroot/nix/var/nix/daemon-socket/socket nix-daemon --store /tmp/chroot Then the client can now connect with $ nix build --store unix:///tmp/chroot/nix/var/nix/daemon-socket/socket?root=/tmp/chroot nixpkgs#hello
2020-10-12Handle amount of disk space saved by hard linking being negativevolth
Fixes bogus messages like "currently hard linking saves 17592186044416.00 MiB".
2020-10-09Split out `local-fs-store.hh`John Ericson
This matches the already-existing `local-fs-store.cc`.
2020-09-23lstat() cleanupEelco Dolstra
2020-09-17Fix garbage collection of CA derivationsregnat
Fix #4026
2020-09-03Remove gc-check-reachabilityEelco Dolstra
2020-09-03addPermRoot(): Remove indirect flagEelco Dolstra
2020-07-30unsigned long long -> uint64_tEelco Dolstra
2020-07-13toStorePath(): Return a StorePath and the suffixEelco Dolstra
2020-06-16Remove StorePath::clone() and related functionsEelco Dolstra
2020-06-15Get rid of explicit ErrorInfo constructorsEelco Dolstra
2020-05-13formatting and a few minor changesBen Burdette
2020-05-13consistent capitalizationBen Burdette
2020-05-13change status messages to info levelBen Burdette
2020-05-11Merge branch 'master' into errors-phase-2Ben Burdette
2020-05-06todo removalBen Burdette
2020-05-06Merge pull request #3546 from guibou/nix_readfile_on_0_sized_filesEelco Dolstra
builtins.readFile: do not truncate content
2020-05-04nix auto-gc: use fragment sizeJude Taylor
2020-05-01convert some errorsBen Burdette
2020-04-29Remove the `drain` argument from `readFile`Guillaume Bouchard
Now it is always `drain` (see previous commit).
2020-04-21remove 'format' from Error constructor callsBen Burdette
2020-04-09gc.cc: Ignore hidden files in temprootsPhilipp Middendorf
2020-02-28Fix GC failures on bad store path namesEelco Dolstra
It failed on names like '/nix/store/9ip48nkc9rfy0a4yaw98lp6gipqlib1a-'.
2020-01-05build: fix sandboxing on darwinDaiderd Jordan
Starting ba87b08f8529e4d9f8c58d8c625152058ceadb75 getEnv now returns an std::optional which means these getEnv() != "" conditions no longer happen if the variables are not defined.
2019-12-10Make the Store API more type-safeEelco Dolstra
Most functions now take a StorePath argument rather than a Path (which is just an alias for std::string). The StorePath constructor ensures that the path is syntactically correct (i.e. it looks like <store-dir>/<base32-hash>-<name>). Similarly, functions like buildPaths() now take a StorePathWithOutputs, rather than abusing Path by adding a '!<outputs>' suffix. Note that the StorePath type is implemented in Rust. This involves some hackery to allow Rust values to be used directly in C++, via a helper type whose destructor calls the Rust type's drop() function. The main issue is the dynamic nature of C++ move semantics: after we have moved a Rust value, we should not call the drop function on the original value. So when we move a value, we set the original value to bitwise zero, and the destructor only calls drop() if the value is not bitwise zero. This should be sufficient for most types. Also lots of minor cleanups to the C++ API to make it more modern (e.g. using std::optional and std::string_view in some places).
2019-11-22getEnv(): Return std::optionalEelco Dolstra
This allows distinguishing between an empty value and no value.
2019-09-30Merge pull request #2338 from bobvanderlinden/pr-cannot-delete-alive-whyDomen Kožar
mention `nix-store --query --roots` when a path cannot be deleted
2019-08-29Don't rely on st_blocksEelco Dolstra
It doesn't seem very reliable on ZFS.
2019-08-29CleanupEelco Dolstra
2019-08-02SimplifyEelco Dolstra
With BSD locks we don't have to guard against reading our own temproots.
2019-08-02Use BSD instead of POSIX file locksEelco Dolstra
POSIX file locks are essentially incompatible with multithreading. BSD locks have much saner semantics. We need this now that there can be multiple concurrent LocalStore::buildPaths() invocations.
2019-08-02Add a test for auto-GCEelco Dolstra
This currently fails because we're using POSIX file locks. So when the garbage collector opens and closes its own temproots file, it causes the lock to be released and then deleted by another GC instance.
2019-07-30Disable findRuntimeRoots on darwin when running tests because lsof is slowBas van Dijk
See: https://github.com/NixOS/nix/issues/3011
2019-04-30findRootsNoTemp: fixes comment about findRuntimeRootsSamuel Dionne-Riel
The NIX_ROOT_FINDER environment variable was removed in 3c46fe62b833a4e66845665edc99555022d3d98c when porting from perl to C.
2019-03-14findRoots(): Add 'censor' parameterEelco Dolstra
This is less brittle than filtering paths after the fact in nix-daemon.
2019-03-14findRuntimeRoots: Simplify/fix handling of /proc filesEelco Dolstra
Scanning of /proc/<pid>/{exe,cwd} was broken because '{memory:' was prepended twice. Also, get rid of the whole '{memory:...}' thing because it's unnecessary, we can just list the file in /proc directly.
2019-03-10Unify internal findRootsXxx() apiGuillaume Maudoux
2019-03-10Make roots a map of store paths to pinning linksGuillaume Maudoux
This new structure makes more sense as there may be many sources rooting the same store path. Many profiles can reference the same path but this is even more true with /proc/<pid>/maps where distinct pids can and often do map the same store path. This implementation is also more efficient as the `Roots` map contains only one entry per rooted store path.
2019-03-10Obfuscate memory roots for non-root usersGuillaume Maudoux
2019-03-10detail memory rootsGuillaume Maudoux
2018-08-08mention nix-store --query --roots when a path cannot be deletedBob van der Linden
2018-06-18Merge pull request #2234 from symphorien/esrch2Eelco Dolstra
libstore/gc.cc: ignore ESRCH when reading symlinks in /proc
2018-06-16libstore/gc.cc: ignore ESRCH when reading symlinks in /procSymphorien Gibol
readlink is also affected by the problem fixed for regular files in c567afe355df
2018-06-13std::random_shuffle -> std::shuffleEelco Dolstra
The former is removed in C++17.
2018-06-11libstore/gc.cc: ignore ESRCH when reading /procSymphorien Gibol
If a process disappears between the time /proc/[pid]/maps is opened and the time it is read, the read() syscall will return ESRCH. This should be ignored.