diff options
author | Eelco Dolstra <e.dolstra@tudelft.nl> | 2006-12-02 14:27:24 +0000 |
---|---|---|
committer | Eelco Dolstra <e.dolstra@tudelft.nl> | 2006-12-02 14:27:24 +0000 |
commit | 8ba5d32769560d32cb5e1e83fd30fb6da0b145f4 (patch) | |
tree | 5387182858fe66bba87f0f0891507fc248ccbaef /src/nix-worker | |
parent | fcd9900d74b0eb3d57402c448ede2a411133fa46 (diff) | |
download | guix-8ba5d32769560d32cb5e1e83fd30fb6da0b145f4.tar.gz |
* Remove queryPathHash().
* Help for nix-worker.
Diffstat (limited to 'src/nix-worker')
-rw-r--r-- | src/nix-worker/Makefile.am | 5 | ||||
-rw-r--r-- | src/nix-worker/help.txt | 10 | ||||
-rw-r--r-- | src/nix-worker/main.cc | 14 |
3 files changed, 28 insertions, 1 deletions
diff --git a/src/nix-worker/Makefile.am b/src/nix-worker/Makefile.am index 6f10efff5d..46568e9e1b 100644 --- a/src/nix-worker/Makefile.am +++ b/src/nix-worker/Makefile.am @@ -4,6 +4,11 @@ nix_worker_SOURCES = main.cc nix_worker_LDADD = ../libmain/libmain.la ../libstore/libstore.la ../libutil/libutil.la \ ../boost/format/libformat.la ${bdb_lib} ${aterm_lib} +main.o: help.txt.hh + +%.txt.hh: %.txt + ../bin2c/bin2c helpText < $< > $@ || (rm $@ && exit 1) + AM_CXXFLAGS = \ -I$(srcdir)/.. ${bdb_include} $(aterm_include) -I$(srcdir)/../libutil \ -I$(srcdir)/../libstore -I$(srcdir)/../libmain diff --git a/src/nix-worker/help.txt b/src/nix-worker/help.txt new file mode 100644 index 0000000000..b4583cb7e4 --- /dev/null +++ b/src/nix-worker/help.txt @@ -0,0 +1,10 @@ +Usage: nix-worker [OPTIONS...] [--daemon | --slave] + +`nix-worker' is a helper program used to implement secure, multi-user +Nix stores. In `--daemon' mode, it goes into the background and waits +for incoming connections on a Unix domain socket, and forks a process +for each connection to perform the Nix store operations requested by +the caller. In `--slave' mode, `nix-worker' is called directly, and +the caller and the worker communicate with each other over +stdin/stdout. In this mode, the `nix-worker' program should have +appropriate setuid privileges. diff --git a/src/nix-worker/main.cc b/src/nix-worker/main.cc index 6d6571536b..95077e6531 100644 --- a/src/nix-worker/main.cc +++ b/src/nix-worker/main.cc @@ -5,6 +5,8 @@ #include "worker-protocol.hh" #include "archive.hh" +#include <iostream> + using namespace nix; @@ -48,12 +50,13 @@ void processConnection(Source & from, Sink & to) switch (op) { - case wopQuit: + case wopQuit: { /* Close the database. */ store.reset((StoreAPI *) 0); writeInt(1, to); quit = true; break; + } case wopIsValidPath: { Path path = readStorePath(from); @@ -67,6 +70,12 @@ void processConnection(Source & from, Sink & to) break; } + case wopQueryPathHash: { + Path path = readStorePath(from); + writeString(printHash(store->queryPathHash(path)), to); + break; + } + case wopQueryReferences: case wopQueryReferrers: { Path path = readStorePath(from); @@ -153,8 +162,11 @@ void run(Strings args) } +#include "help.txt.hh" + void printHelp() { + std::cout << string((char *) helpText, sizeof helpText); } |