diff options
author | cl349@firebug.cl.cam.ac.uk <cl349@firebug.cl.cam.ac.uk> | 2005-08-10 09:46:51 +0000 |
---|---|---|
committer | cl349@firebug.cl.cam.ac.uk <cl349@firebug.cl.cam.ac.uk> | 2005-08-10 09:46:51 +0000 |
commit | c2bf763b7fdcb53ab63954975890aa786e8074cc (patch) | |
tree | 27b760f69c79a258b8f48e83112e8d8005048989 /tools/xenstore/utils.c | |
parent | 1b8d0b88241100f67f7cd4c7e07f881c9fd3844e (diff) | |
download | xen-c2bf763b7fdcb53ab63954975890aa786e8074cc.tar.gz xen-c2bf763b7fdcb53ab63954975890aa786e8074cc.tar.bz2 xen-c2bf763b7fdcb53ab63954975890aa786e8074cc.zip |
Make xen daemon startup more robust.
1) make xenconsoled exit gracefully if xcs dies
2) daemonize xenstored before binding to xenstored socket
3) wait to close stdio in xenstored until we're ready to accept
connections (so that PID=`xenstored --output-pid` doesn't return until
it's ready to accept connections)
4) updates tools/misc/xend for these changes
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
Signed-off-by: Rusty Russell <rusty@rustycorp.com.au>
Signed-off-by: Christian Limpach <Christian.Limpach@cl.cam.ac.uk>
Diffstat (limited to 'tools/xenstore/utils.c')
-rw-r--r-- | tools/xenstore/utils.c | 24 |
1 files changed, 0 insertions, 24 deletions
diff --git a/tools/xenstore/utils.c b/tools/xenstore/utils.c index 0b1ac8aedd..2bc40e009b 100644 --- a/tools/xenstore/utils.c +++ b/tools/xenstore/utils.c @@ -80,30 +80,6 @@ void *malloc_nofail(size_t size) barf("malloc of %zu failed", size); } -/* Stevens. */ -void daemonize(void) -{ - pid_t pid; - - /* Separate from our parent via fork, so init inherits us. */ - if ((pid = fork()) < 0) - barf_perror("Failed to fork daemon"); - if (pid != 0) - exit(0); - - close(STDIN_FILENO); - close(STDOUT_FILENO); - close(STDERR_FILENO); - - /* Session leader so ^C doesn't whack us. */ - setsid(); - /* Move off any mount points we might be in. */ - chdir("/"); - /* Discard our parent's old-fashioned umask prejudices. */ - umask(0); -} - - /* This version adds one byte (for nul term) */ void *grab_file(const char *filename, unsigned long *size) { |