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

[Xen-changelog] [xen-unstable] Revert 17296:21d9575c669e.



# HG changeset patch
# User Keir Fraser <keir.fraser@xxxxxxxxxx>
# Date 1206609129 0
# Node ID ed67f68ae2a7f204b6a2d146e6f4037bd2893438
# Parent  2e84414ea14a384c3b3d4da0125d30dea9f62de5
Revert 17296:21d9575c669e.
Signed-off-by: Keir Fraser <keir.fraser@xxxxxxxxxx>
---
 tools/misc/xend                 |   16 +++++-----------
 tools/xenstore/xenstored_core.c |   25 ++++++++++++-------------
 2 files changed, 17 insertions(+), 24 deletions(-)

diff -r 2e84414ea14a -r ed67f68ae2a7 tools/misc/xend
--- a/tools/misc/xend   Wed Mar 26 19:00:57 2008 +0000
+++ b/tools/misc/xend   Thu Mar 27 09:12:09 2008 +0000
@@ -95,17 +95,11 @@ def start_xenstored():
         f.close()
     except:
         pass
-    args = ['xenstored', "--pid-file", pidfname]
-    if os.getenv("XENSTORED_TRACE"):
-        args.extend(["-T", "/var/log/xen/xenstored-trace.log"])
-    pid = os.fork()
-    if pid == 0:
-        os.execvp('xenstored', args)
-    p, status = os.waitpid(pid, 0)
-    if os.WIFEXITED(status):
-        status = os.WEXITSTATUS(status)
-        if status:
-            raise RuntimeError("Failed to start xenstored: %d" % status)
+    XENSTORED_TRACE = os.getenv("XENSTORED_TRACE")
+    cmd = "xenstored --pid-file /var/run/xenstore.pid"
+    if XENSTORED_TRACE:
+        cmd += " -T /var/log/xen/xenstored-trace.log"
+    s,o = commands.getstatusoutput(cmd)
 
 def start_consoled():
     if os.fork() == 0:
diff -r 2e84414ea14a -r ed67f68ae2a7 tools/xenstore/xenstored_core.c
--- a/tools/xenstore/xenstored_core.c   Wed Mar 26 19:00:57 2008 +0000
+++ b/tools/xenstore/xenstored_core.c   Thu Mar 27 09:12:09 2008 +0000
@@ -1839,6 +1839,13 @@ int main(int argc, char *argv[])
                }
        }
 
+       if (dofork) {
+               openlog("xenstored", 0, LOG_DAEMON);
+               daemonize();
+       }
+       if (pidfile)
+               write_pidfile(pidfile);
+
        /* Talloc leak reports go to stderr, which is closed if we fork. */
        if (!dofork)
                talloc_enable_leak_report_full();
@@ -1892,30 +1899,22 @@ int main(int argc, char *argv[])
        /* Restore existing connections. */
        restore_existing_connections();
 
+       if (outputpid) {
+               printf("%ld\n", (long)getpid());
+               fflush(stdout);
+       }
+
        /* redirect to /dev/null now we're ready to accept connections */
        if (dofork) {
                int devnull = open("/dev/null", O_RDWR);
                if (devnull == -1)
                        barf_perror("Could not open /dev/null\n");
-
-               openlog("xenstored", 0, LOG_DAEMON);
-
-               daemonize();
-
-               if (outputpid) {
-                       printf("%ld\n", (long)getpid());
-                       fflush(stdout);
-               }
-
                dup2(devnull, STDIN_FILENO);
                dup2(devnull, STDOUT_FILENO);
                dup2(devnull, STDERR_FILENO);
                close(devnull);
                xprintf = trace;
        }
-
-       if (pidfile)
-               write_pidfile(pidfile);
 
        signal(SIGHUP, trigger_reopen_log);
 

_______________________________________________
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®.