ia64/xen-unstable

changeset 7943:3a544c04cc61

Added method so that SrvDaemon can be run in the foreground without all the
forking implied by the start method. This makes it easier to run valgrind
against Xend, or run it with a pydebug-compiled Python.

Signed-off-by: Ewan Mellor <ewan@xensource.com>
author emellor@leeni.uk.xensource.com
date Mon Nov 21 12:44:43 2005 +0100 (2005-11-21)
parents d7b91e64bd4c
children 508bc376c1dd
files tools/python/xen/xend/server/SrvDaemon.py
line diff
     1.1 --- a/tools/python/xen/xend/server/SrvDaemon.py	Mon Nov 21 12:42:47 2005 +0100
     1.2 +++ b/tools/python/xen/xend/server/SrvDaemon.py	Mon Nov 21 12:44:43 2005 +0100
     1.3 @@ -300,3 +300,25 @@ def instance():
     1.4      except:
     1.5          inst = Daemon()
     1.6      return inst
     1.7 +
     1.8 +
     1.9 +def main(argv = None):
    1.10 +    global XEND_DAEMONIZE
    1.11 +    
    1.12 +    XEND_DAEMONIZE = 0
    1.13 +    if argv is None:
    1.14 +        argv = sys.argv
    1.15 +
    1.16 +    try:
    1.17 +        daemon = instance()
    1.18 +    
    1.19 +        r,w = os.pipe()
    1.20 +        daemon.run(os.fdopen(w, 'w'))
    1.21 +        return 0
    1.22 +    except Exception, exn:
    1.23 +        log.fatal(exn)
    1.24 +        return 1
    1.25 +
    1.26 +
    1.27 +if __name__ == "__main__":
    1.28 +    sys.exit(main())