direct-io.hg

changeset 14370:35c9a1939ae4

[XEND] Mark save record fd close-on-exec after calling xc_restore
so that qemu doesn't end up with an open fd on it
Signed-off-by: Tim Deegan <Tim.Deegan@xensource.com>
author Tim Deegan <Tim.Deegan@xensource.com>
date Wed Mar 14 12:49:40 2007 +0000 (2007-03-14)
parents 4d7327502ba6
children fa3d25355aa2
files tools/python/xen/xend/XendCheckpoint.py
line diff
     1.1 --- a/tools/python/xen/xend/XendCheckpoint.py	Wed Mar 14 11:38:26 2007 +0000
     1.2 +++ b/tools/python/xen/xend/XendCheckpoint.py	Wed Mar 14 12:49:40 2007 +0000
     1.3 @@ -9,6 +9,7 @@ import os
     1.4  import re
     1.5  import string
     1.6  import threading
     1.7 +import fcntl
     1.8  from struct import pack, unpack, calcsize
     1.9  
    1.10  from xen.util.xpopen import xPopen3
    1.11 @@ -230,6 +231,15 @@ def restore(xd, fd, dominfo = None, paus
    1.12  
    1.13          forkHelper(cmd, fd, handler.handler, True)
    1.14  
    1.15 +        # We don't want to pass this fd to any other children -- we 
    1.16 +        # might need to recover ths disk space that backs it.
    1.17 +        try:
    1.18 +            flags = fcntl.fcntl(fd, fcntl.F_GETFD)
    1.19 +            flags |= fcntl.FD_CLOEXEC
    1.20 +            fcntl.fcntl(fd, fcntl.F_SETFD, flags)
    1.21 +        except:
    1.22 +            pass
    1.23 +
    1.24          if handler.store_mfn is None:
    1.25              raise XendError('Could not read store MFN')
    1.26