[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Xen-changelog] [xen master] tools/helper: honour XEN_RUN_DIR in init-xenstore-domain.c



commit 6f35915ec08bf7fc469e4e65d7933ad407e518e1
Author:     Wei Liu <wei.liu2@xxxxxxxxxx>
AuthorDate: Mon Jul 11 18:28:04 2016 +0100
Commit:     Wei Liu <wei.liu2@xxxxxxxxxx>
CommitDate: Wed Jul 20 16:07:24 2016 +0100

    tools/helper: honour XEN_RUN_DIR in init-xenstore-domain.c
    
    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@xxxxxxxxxx>
    Acked-by: Ian Jackson <ian.jackson@xxxxxxxxxxxxx>
---
 .gitignore                           | 1 +
 tools/helpers/Makefile               | 7 ++++++-
 tools/helpers/init-xenstore-domain.c | 8 +++++---
 3 files changed, 12 insertions(+), 4 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..5017350 100644
--- a/tools/helpers/Makefile
+++ b/tools/helpers/Makefile
@@ -28,6 +28,8 @@ 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_OBJS): _paths.h
+
 init-xenstore-domain: $(INIT_XENSTORE_DOMAIN_OBJS)
        $(CC) $(LDFLAGS) -o $@ $(INIT_XENSTORE_DOMAIN_OBJS) 
$(LDLIBS_libxentoollog) $(LDLIBS_libxenstore) $(LDLIBS_libxenctrl) 
$(LDLIBS_libxenguest) $(LDLIBS_libxenlight) $(APPEND_LDFLAGS)
 
@@ -41,6 +43,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;
     }
 
--
generated by git-patchbot for /home/xen/git/xen.git#master

_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxx
https://lists.xenproject.org/xen-changelog

 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.