From mboxrd@z Thu Jan 1 00:00:00 1970 From: John Darrington Subject: [PATCH] write the daemon's pid to a file. Date: Sun, 8 Dec 2013 12:13:47 +0100 Message-ID: <20131208111345.GA5130@intra> Mime-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="f2QGlHpHGjS2mn6Y" Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:33784) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VpcJB-0001Yi-UG for guix-devel@gnu.org; Sun, 08 Dec 2013 06:14:02 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1VpcJ6-0007vH-8j for guix-devel@gnu.org; Sun, 08 Dec 2013 06:13:57 -0500 Received: from de.cellform.com ([88.217.224.109]:45449 helo=jocasta.intra) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VpcJ5-0007vC-Qx for guix-devel@gnu.org; Sun, 08 Dec 2013 06:13:52 -0500 Received: from muse.intra (muse.intra [192.168.0.6]) by jocasta.intra (8.14.4/8.14.4/Debian-4) with ESMTP id rB8BDl7P001147 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES128-SHA bits=128 verify=NOT) for ; Sun, 8 Dec 2013 12:13:48 +0100 Received: from john by muse.intra with local (Exim 4.80) (envelope-from ) id 1VpcJ1-0001Kx-3p for guix-devel@gnu.org; Sun, 08 Dec 2013 12:13:47 +0100 Content-Disposition: inline List-Id: "Development of GNU Guix and the GNU System distribution." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guix-devel-bounces+gcggd-guix-devel=m.gmane.org@gnu.org Sender: guix-devel-bounces+gcggd-guix-devel=m.gmane.org@gnu.org To: guix-devel@gnu.org --f2QGlHpHGjS2mn6Y Content-Type: multipart/mixed; boundary="pWyiEgJYm5f9v55/" Content-Disposition: inline --pWyiEgJYm5f9v55/ Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable I don't know what you will think of this patch. But I found that it makes= =20 running guix under debian a whole lot easier. I suspect the same will be true for many other OSes too. J' --=20 PGP Public key ID: 1024D/2DE827B3=20 fingerprint =3D 8797 A26D 0854 2EAB 0285 A290 8A67 719C 2DE8 27B3 See http://sks-keyservers.net or any PGP keyserver for public key. --pWyiEgJYm5f9v55/ Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="0001-guix-daemon-New-option-pid-file-FILE.patch" Content-Transfer-Encoding: quoted-printable =46rom 20f5f5c28b773bb4e6164cd4e8df35ef62e3dffd Mon Sep 17 00:00:00 2001 =46rom: John Darrington Date: Sat, 30 Nov 2013 15:30:48 +0100 Subject: [PATCH] guix-daemon: New option --pid-file=3DFILE * 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 =20 static const struct argp_option options[] =3D { @@ -94,6 +95,8 @@ static const struct argp_option options[] =3D "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 =3D arg; break; + case GUIX_OPT_PID_FILE: + settings.nixDaemonPidFile =3D 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); =20 + if (settings.nixDaemonPidFile !=3D "") + 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/ni= x" # 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; +=20 ++ /* 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 +=20 --=20 1.7.10.4 --pWyiEgJYm5f9v55/-- --f2QGlHpHGjS2mn6Y Content-Type: application/pgp-signature; name="signature.asc" Content-Description: Digital signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.12 (GNU/Linux) iEYEARECAAYFAlKkVGkACgkQimdxnC3oJ7PjOwCgiT6es54wpcNw7G4yq40oMAKx wL4An1LyUk8bbG+0+4lpEYiM1jmY3OBG =c9X9 -----END PGP SIGNATURE----- --f2QGlHpHGjS2mn6Y--