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

[Xen-changelog] Try to create runtime xenstored's directories at startup time.



# HG changeset patch
# User vhanquez@xxxxxxxxxxxxxxxxxxxxxxx
# Node ID 08f5adb5058b6122e802aa243c4dd253c701c00c
# Parent  fdd64fd51edd2d12f5b004ead3787e1847049192
Try to create runtime xenstored's directories at startup time.

Signed-off-by: Vincent Hanquez <vincent@xxxxxxxxxxxxx>
---
 tools/xenstore/xenstored_core.c |   15 +++++++++++++++
 tools/xenstore/xs_lib.c         |    4 ++--
 tools/xenstore/xs_lib.h         |    2 ++
 3 files changed, 19 insertions(+), 2 deletions(-)

diff -r fdd64fd51edd -r 08f5adb5058b tools/xenstore/xenstored_core.c
--- a/tools/xenstore/xenstored_core.c   Thu May 11 13:49:20 2006 +0100
+++ b/tools/xenstore/xenstored_core.c   Thu May 11 15:01:54 2006 +0100
@@ -1811,6 +1811,21 @@ int main(int argc, char *argv[])
 
        reopen_log();
 
+       /* make sure xenstored directory exists */
+       if (mkdir(xs_daemon_rundir(), 0755)) {
+               if (errno != EEXIST) {
+                       perror("error: mkdir daemon rundir");
+                       exit(-1);
+               }
+       }
+
+       if (mkdir(xs_daemon_rootdir(), 0755)) {
+               if (errno != EEXIST) {
+                       perror("error: mkdir daemon rootdir");
+                       exit(-1);
+               }
+       }
+
        if (dofork) {
                openlog("xenstored", 0, LOG_DAEMON);
                daemonize();
diff -r fdd64fd51edd -r 08f5adb5058b tools/xenstore/xs_lib.c
--- a/tools/xenstore/xs_lib.c   Thu May 11 13:49:20 2006 +0100
+++ b/tools/xenstore/xs_lib.c   Thu May 11 15:01:54 2006 +0100
@@ -26,13 +26,13 @@
 
 /* Common routines for the Xen store daemon and client library. */
 
-static const char *xs_daemon_rootdir(void)
+const char *xs_daemon_rootdir(void)
 {
        char *s = getenv("XENSTORED_ROOTDIR");
        return (s ? s : "/var/lib/xenstored");
 }
 
-static const char *xs_daemon_rundir(void)
+const char *xs_daemon_rundir(void)
 {
        char *s = getenv("XENSTORED_RUNDIR");
        return (s ? s : "/var/run/xenstored");
diff -r fdd64fd51edd -r 08f5adb5058b tools/xenstore/xs_lib.h
--- a/tools/xenstore/xs_lib.h   Thu May 11 13:49:20 2006 +0100
+++ b/tools/xenstore/xs_lib.h   Thu May 11 15:01:54 2006 +0100
@@ -46,6 +46,8 @@ struct xs_permissions
 #define MAX_STRLEN(x) ((sizeof(x) * CHAR_BIT + CHAR_BIT-1) / 10 * 3 + 2)
 
 /* Path for various daemon things: env vars can override. */
+const char *xs_daemon_rootdir(void);
+const char *xs_daemon_rundir(void);
 const char *xs_daemon_socket(void);
 const char *xs_daemon_socket_ro(void);
 const char *xs_domain_dev(void);

_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-changelog


 


Rackspace

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