* Allow unprivileged users to run the garbage collector and to do
`nix-store --delete'. But unprivileged users are not allowed to ignore liveness. * `nix-store --delete --ignore-liveness': ignore the runtime roots as well.
This commit is contained in:
parent
29cf434a35
commit
a9c4f66cfb
16 changed files with 106 additions and 56 deletions
|
|
@ -281,6 +281,28 @@ static void performOp(Source & from, Sink & to, unsigned int op)
|
|||
break;
|
||||
}
|
||||
|
||||
case wopCollectGarbage: {
|
||||
GCAction action = (GCAction) readInt(from);
|
||||
PathSet pathsToDelete = readStorePaths(from);
|
||||
bool ignoreLiveness = readInt(from);
|
||||
|
||||
PathSet result;
|
||||
unsigned long long bytesFreed;
|
||||
|
||||
startWork();
|
||||
if (ignoreLiveness)
|
||||
throw Error("you are not allowed to ignore liveness");
|
||||
store->collectGarbage(action, pathsToDelete, ignoreLiveness,
|
||||
result, bytesFreed);
|
||||
stopWork();
|
||||
|
||||
writeStringSet(result, to);
|
||||
writeInt(bytesFreed & 0xffffffff, to);
|
||||
writeInt(bytesFreed >> 32, to);
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
default:
|
||||
throw Error(format("invalid operation %1%") % op);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue