diff options
author | Ludovic Courtès <ludo@gnu.org> | 2013-02-19 22:48:13 +0100 |
---|---|---|
committer | Ludovic Courtès <ludo@gnu.org> | 2013-02-27 20:55:41 +0100 |
commit | 353283bbe99fdb458b2e6bf03bb6c62344e29cfe (patch) | |
tree | 55cc81dee4c54605ded8264afcd0394e9e942390 | |
parent | 8faece2280dbad907fe57edd8c41732d87c35e76 (diff) | |
download | guix-353283bbe99fdb458b2e6bf03bb6c62344e29cfe.tar.gz |
daemon: Add `--listen'.
* nix/nix-daemon/guix-daemon.cc (GUIX_OPT_LISTEN): New macro. (options): Add `--listen'. (parse_opt): Handle it. * doc/guix.texi (Invoking guix-daemon): Mention it.
-rw-r--r-- | doc/guix.texi | 7 | ||||
-rw-r--r-- | nix/nix-daemon/guix-daemon.cc | 19 |
2 files changed, 25 insertions, 1 deletions
diff --git a/doc/guix.texi b/doc/guix.texi index f84b37686a..849ab06c4a 100644 --- a/doc/guix.texi +++ b/doc/guix.texi @@ -367,6 +367,13 @@ Do not keep build logs. By default they are kept under Assume @var{system} as the current system type. By default it is the architecture/kernel pair found at configure time, such as @code{x86_64-linux}. + +@item --listen=@var{socket} +Listen for connections on @var{socket}, the file name of a Unix-domain +socket. The default socket is +@file{@var{localstatedir}/daemon-socket/socket}. This option is only +useful in exceptional circumstances, such as if you need to run several +daemons on the same machine. @end table diff --git a/nix/nix-daemon/guix-daemon.cc b/nix/nix-daemon/guix-daemon.cc index 604a26f0b1..1611840bd4 100644 --- a/nix/nix-daemon/guix-daemon.cc +++ b/nix/nix-daemon/guix-daemon.cc @@ -1,5 +1,5 @@ /* GNU Guix --- Functional package management for GNU - Copyright (C) 2012 Ludovic Courtès <ludo@gnu.org> + Copyright (C) 2012, 2013 Ludovic Courtès <ludo@gnu.org> This file is part of GNU Guix. @@ -64,6 +64,7 @@ builds derivations on behalf of its clients."; #define GUIX_OPT_IMPERSONATE_LINUX_26 8 #define GUIX_OPT_DEBUG 9 #define GUIX_OPT_CHROOT_DIR 10 +#define GUIX_OPT_LISTEN 11 static const struct argp_option options[] = { @@ -103,6 +104,8 @@ static const struct argp_option options[] = " (this option has no effect in this configuration)" #endif }, + { "listen", GUIX_OPT_LISTEN, "SOCKET", 0, + "Listen for connections on SOCKET" }, { "debug", GUIX_OPT_DEBUG, 0, 0, "Produce debugging output" }, { 0, 0, 0, 0, 0 } @@ -138,6 +141,17 @@ parse_opt (int key, char *arg, struct argp_state *state) case GUIX_OPT_LOSE_LOGS: settings.keepLog = false; break; + case GUIX_OPT_LISTEN: + try + { + settings.nixDaemonSocketFile = canonPath (arg); + } + catch (std::exception &e) + { + fprintf (stderr, "error: %s\n", e.what ()); + exit (EXIT_FAILURE); + } + break; case GUIX_OPT_DEBUG: verbosity = lvlDebug; break; @@ -207,6 +221,9 @@ main (int argc, char *argv[]) } #endif + printMsg (lvlDebug, + format ("listening on `%1%'") % settings.nixDaemonSocketFile); + run (nothing); } catch (std::exception &e) |