From: John Darrington <john@darrington.wattle.id.au>
To: guix-devel@gnu.org
Subject: [PATCH] write the daemon's pid to a file.
Date: Sun, 8 Dec 2013 12:13:47 +0100 [thread overview]
Message-ID: <20131208111345.GA5130@intra> (raw)
[-- Attachment #1.1: Type: text/plain, Size: 370 bytes --]
I don't know what you will think of this patch. But I found that it makes
running guix under debian a whole lot easier. I suspect the same will be
true for many other OSes too.
J'
--
PGP Public key ID: 1024D/2DE827B3
fingerprint = 8797 A26D 0854 2EAB 0285 A290 8A67 719C 2DE8 27B3
See http://sks-keyservers.net or any PGP keyserver for public key.
[-- Attachment #1.2: 0001-guix-daemon-New-option-pid-file-FILE.patch --]
[-- Type: text/x-diff, Size: 2921 bytes --]
From 20f5f5c28b773bb4e6164cd4e8df35ef62e3dffd Mon Sep 17 00:00:00 2001
From: John Darrington <john@darrington.wattle.id.au>
Date: Sat, 30 Nov 2013 15:30:48 +0100
Subject: [PATCH] guix-daemon: New option --pid-file=FILE
* Added a new option to write the daemon's pid to a file. This is
necessary for the clean integration into sysV like systems such as
used by Debian and other vendors.
---
nix/nix-daemon/guix-daemon.cc | 9 +++++++++
nix/sync-with-upstream | 16 ++++++++++++++++
2 files changed, 25 insertions(+)
diff --git a/nix/nix-daemon/guix-daemon.cc b/nix/nix-daemon/guix-daemon.cc
index 4f9fa4c..d703324 100644
--- a/nix/nix-daemon/guix-daemon.cc
+++ b/nix/nix-daemon/guix-daemon.cc
@@ -67,6 +67,7 @@ builds derivations on behalf of its clients.";
#define GUIX_OPT_CHROOT_DIR 10
#define GUIX_OPT_LISTEN 11
#define GUIX_OPT_NO_SUBSTITUTES 12
+#define GUIX_OPT_PID_FILE 13
static const struct argp_option options[] =
{
@@ -94,6 +95,8 @@ static const struct argp_option options[] =
"Perform builds as a user of GROUP" },
{ "no-substitutes", GUIX_OPT_NO_SUBSTITUTES, 0, 0,
"Do not use substitutes" },
+ { "pid-file", GUIX_OPT_PID_FILE, "FILE", 0,
+ "Write the daemon's process ID to FILE" },
{ "cache-failures", GUIX_OPT_CACHE_FAILURES, 0, 0,
"Cache build failures" },
{ "lose-logs", GUIX_OPT_LOSE_LOGS, 0, 0,
@@ -171,6 +174,9 @@ parse_opt (int key, char *arg, struct argp_state *state)
case GUIX_OPT_SYSTEM:
settings.thisSystem = arg;
break;
+ case GUIX_OPT_PID_FILE:
+ settings.nixDaemonPidFile = arg;
+ break;
default:
return (error_t) ARGP_ERR_UNKNOWN;
}
@@ -247,6 +253,9 @@ main (int argc, char *argv[])
printMsg (lvlDebug,
format ("listening on `%1%'") % settings.nixDaemonSocketFile);
+ if (settings.nixDaemonPidFile != "")
+ writeFile (settings.nixDaemonPidFile, int2String(getpid()));
+
run (nothing);
}
catch (std::exception &e)
diff --git a/nix/sync-with-upstream b/nix/sync-with-upstream
index 535763d..d60406f 100755
--- a/nix/sync-with-upstream
+++ b/nix/sync-with-upstream
@@ -70,3 +70,19 @@ cp -v "$top_srcdir/nix-upstream/AUTHORS" "$top_srcdir/nix"
# Substitutions.
sed -i "$top_srcdir/nix/libstore/gc.cc" \
-e 's|/nix/find-runtime-roots\.pl|/guix/list-runtime-roots|g'
+
+
+patch -p 1 << EOF
+--- a/nix/libstore/globals.hh 2013-11-30 18:13:33.000000000 +0100
++++ b/nix/libstore/globals.hh 2013-11-30 18:15:32.000000000 +0100
+@@ -53,6 +53,9 @@
+ /* File name of the socket the daemon listens to. */
+ Path nixDaemonSocketFile;
+
++ /* File name of the to which the daemon PID will be written. */
++ Path nixDaemonPidFile;
++
+ /* Whether to keep temporary directories of failed builds. */
+ bool keepFailed;
+EOF
+
--
1.7.10.4
[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 198 bytes --]
next reply other threads:[~2013-12-08 11:14 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-12-08 11:13 John Darrington [this message]
2013-12-08 15:35 ` [PATCH] write the daemon's pid to a file Ludovic Courtès
2013-12-08 16:06 ` [PATCH] write the daemon's pid to a file.el John Darrington
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://guix.gnu.org/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20131208111345.GA5130@intra \
--to=john@darrington.wattle.id.au \
--cc=guix-devel@gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://git.savannah.gnu.org/cgit/guix.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).