ia64/xen-unstable

changeset 12737:b22274d1311c

[TOOLS][PVFB] Avoid zombie framebuffer backends.

Signed-off-by: Steven Smith <sos22@cam.ac.uk>
author Steven Smith <ssmith@xensource.com>
date Fri Dec 01 12:20:12 2006 +0000 (2006-12-01)
parents fb0a586854c1
children 2a6a793a2f68
files tools/python/xen/xend/server/vfbif.py
line diff
     1.1 --- a/tools/python/xen/xend/server/vfbif.py	Fri Dec 01 12:09:10 2006 +0000
     1.2 +++ b/tools/python/xen/xend/server/vfbif.py	Fri Dec 01 12:20:12 2006 +0000
     1.3 @@ -4,6 +4,14 @@ from xen.xend.XendError import VmError
     1.4  import xen.xend
     1.5  import os
     1.6  
     1.7 +def spawn_detached(path, args, env):
     1.8 +    p = os.fork()
     1.9 +    if p == 0:
    1.10 +        os.spawnve(os.P_NOWAIT, path, args, env)
    1.11 +        os._exit(0)
    1.12 +    else:
    1.13 +        os.waitpid(p, 0)
    1.14 +        
    1.15  class VfbifController(DevController):
    1.16      """Virtual frame buffer controller. Handles all vfb devices for a domain.
    1.17      """
    1.18 @@ -33,7 +41,7 @@ class VfbifController(DevController):
    1.19              vnclisten = config.get("vnclisten",
    1.20                                     xen.xend.XendRoot.instance().get_vnclisten_address())
    1.21              args += [ "--listen", vnclisten ]
    1.22 -            os.spawnve(os.P_NOWAIT, args[0], args + std_args, os.environ)
    1.23 +            spawn_detached(args[0], args + std_args, os.environ)
    1.24          elif t == "sdl":
    1.25              args = [xen.util.auxbin.pathTo("xen-sdlfb")]
    1.26              env = dict(os.environ)
    1.27 @@ -41,7 +49,7 @@ class VfbifController(DevController):
    1.28                  env['DISPLAY'] = config["display"]
    1.29              if config.has_key("xauthority"):
    1.30                  env['XAUTHORITY'] = config["xauthority"]
    1.31 -            os.spawnve(os.P_NOWAIT, args[0], args + std_args, env)
    1.32 +            spawn_detached(args[0], args + std_args, env)
    1.33          else:
    1.34              raise VmError('Unknown vfb type %s (%s)' % (t, repr(config)))
    1.35