xen-devel.lists.xenproject.org archive mirror
 help / color / mirror / Atom feed
From: Wei Liu <wei.liu2@citrix.com>
To: Xen-devel <xen-devel@lists.xenproject.org>
Cc: Ian Jackson <ian.jackson@eu.citrix.com>, Wei Liu <wei.liu2@citrix.com>
Subject: [PATCH 2/7] tools/helper: honour XEN_RUN_DIR in init-xenstore-domain.c
Date: Wed, 15 Jun 2016 12:15:04 +0100	[thread overview]
Message-ID: <1465989309-12418-3-git-send-email-wei.liu2@citrix.com> (raw)
In-Reply-To: <1465989309-12418-1-git-send-email-wei.liu2@citrix.com>

Place the PID file under XEN_RUN_DIR. Note that this change the default
location from /var/run to /var/run/xen.

Generate a _paths.h as that is required to make this change work.

Signed-off-by: Wei Liu <wei.liu2@citrix.com>
---
Cc: Ian Jackson <ian.jackson@eu.citrix.com>
---
 .gitignore                           | 1 +
 tools/helpers/Makefile               | 7 +++++--
 tools/helpers/init-xenstore-domain.c | 8 +++++---
 3 files changed, 11 insertions(+), 5 deletions(-)

diff --git a/.gitignore b/.gitignore
index e019f2e..d4ffaa6 100644
--- a/.gitignore
+++ b/.gitignore
@@ -145,6 +145,7 @@ tools/flask/utils/flask-loadpolicy
 tools/flask/utils/flask-setenforce
 tools/flask/utils/flask-set-bool
 tools/flask/utils/flask-label-pci
+tools/helpers/_paths.h
 tools/helpers/init-xenstore-domain
 tools/helpers/xen-init-dom0
 tools/hotplug/common/hotplugpath.sh
diff --git a/tools/helpers/Makefile b/tools/helpers/Makefile
index a05a368..5d444aa 100644
--- a/tools/helpers/Makefile
+++ b/tools/helpers/Makefile
@@ -28,7 +28,7 @@ all: $(PROGS)
 xen-init-dom0: $(XEN_INIT_DOM0_OBJS)
 	$(CC) $(LDFLAGS) -o $@ $(XEN_INIT_DOM0_OBJS) $(LDLIBS_libxentoollog) $(LDLIBS_libxenstore) $(LDLIBS_libxenlight) $(APPEND_LDFLAGS)
 
-init-xenstore-domain: $(INIT_XENSTORE_DOMAIN_OBJS)
+init-xenstore-domain: $(INIT_XENSTORE_DOMAIN_OBJS) _paths.h
 	$(CC) $(LDFLAGS) -o $@ $(INIT_XENSTORE_DOMAIN_OBJS) $(LDLIBS_libxentoollog) $(LDLIBS_libxenstore) $(LDLIBS_libxenctrl) $(LDLIBS_libxenguest) $(LDLIBS_libxenlight) $(APPEND_LDFLAGS)
 
 .PHONY: install
@@ -41,6 +41,9 @@ endif
 
 .PHONY: clean
 clean:
-	$(RM) -f *.o $(PROGS) $(DEPS)
+	$(RM) -f *.o $(PROGS) $(DEPS) _paths.h
 
 distclean: clean
+
+genpath-target = $(call buildmakevars2header,_paths.h)
+$(eval $(genpath-target))
diff --git a/tools/helpers/init-xenstore-domain.c b/tools/helpers/init-xenstore-domain.c
index 909542b..53b4b01 100644
--- a/tools/helpers/init-xenstore-domain.c
+++ b/tools/helpers/init-xenstore-domain.c
@@ -14,6 +14,7 @@
 #include <xen-xsm/flask/flask.h>
 
 #include "init-dom-json.h"
+#include "_paths.h"
 
 static uint32_t domid = ~0;
 static char *kernel;
@@ -316,10 +317,10 @@ int main(int argc, char** argv)
     do_xs_write_dom(xsh, "memory/static-max", buf);
     xs_close(xsh);
 
-    fd = creat("/var/run/xenstored.pid", 0666);
+    fd = creat(XEN_RUN_DIR "/xenstored.pid", 0666);
     if ( fd < 0 )
     {
-        fprintf(stderr, "Creating /var/run/xenstored.pid failed\n");
+        fprintf(stderr, "Creating " XEN_RUN_DIR "/xenstored.pid failed\n");
         return 3;
     }
     rv = snprintf(buf, 16, "domid:%d\n", domid);
@@ -327,7 +328,8 @@ int main(int argc, char** argv)
     close(fd);
     if ( rv < 0 )
     {
-        fprintf(stderr, "Writing domid to /var/run/xenstored.pid failed\n");
+        fprintf(stderr,
+                "Writing domid to " XEN_RUN_DIR "/xenstored.pid failed\n");
         return 3;
     }
 
-- 
2.1.4


_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
http://lists.xen.org/xen-devel

  parent reply	other threads:[~2016-06-15 11:15 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-06-15 11:15 [PATCH 0/7] Honour more configure variables in various places (iteration 3) Wei Liu
2016-06-15 11:15 ` [PATCH 1/7] xenconsoled: honour XEN_RUN_DIR Wei Liu
2016-06-15 11:15 ` Wei Liu [this message]
2016-07-08 17:25   ` [PATCH 2/7] tools/helper: honour XEN_RUN_DIR in init-xenstore-domain.c Ian Jackson
2016-07-11 10:38     ` Wei Liu
2016-06-15 11:15 ` [PATCH 3/7] hotplug/FreeBSD: honour XEN_RUN_DIR Wei Liu
2016-06-15 16:18   ` Roger Pau Monné
2016-07-08 17:25   ` Ian Jackson
2016-06-15 11:15 ` [PATCH 4/7] hotplug/NetBSD: " Wei Liu
2016-06-15 16:16   ` Roger Pau Monné
2016-07-08 17:26   ` Ian Jackson
2016-06-15 11:15 ` [PATCH 5/7] hotplug/Linux: " Wei Liu
2016-06-15 16:17   ` Roger Pau Monné
2016-07-08 17:26   ` Ian Jackson
2016-06-15 11:15 ` [PATCH 6/7] libxenstat: " Wei Liu
2016-07-08 17:27   ` Ian Jackson
2016-07-11 10:38     ` Wei Liu
2016-06-15 11:15 ` [PATCH 7/7] oxenstored: " Wei Liu
2016-06-15 19:43   ` David Scott
2016-07-08 17:27   ` Ian Jackson
2016-07-08 17:28     ` Ian Jackson
2016-07-11 10:38       ` Wei Liu
2016-07-02 10:21 ` [PATCH 0/7] Honour more configure variables in various places (iteration 3) Wei Liu
2016-07-08 17:25   ` Ian Jackson

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

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1465989309-12418-3-git-send-email-wei.liu2@citrix.com \
    --to=wei.liu2@citrix.com \
    --cc=ian.jackson@eu.citrix.com \
    --cc=xen-devel@lists.xenproject.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.
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 NNTP newsgroup(s).