WARNING - OLD ARCHIVES

This is an archived copy of the Xen.org mailing list, which we have preserved to ensure that existing links to archives are not broken. The live archive, which contains the latest emails, can be found at http://lists.xen.org/
   
 
 
Xen 
 
Home Products Support Community News
 
   
 

xen-devel

[Xen-devel] [PATCH] make stubdom-dm exit properly

To: xen-devel@xxxxxxxxxxxxxxxxxxx
Subject: [Xen-devel] [PATCH] make stubdom-dm exit properly
From: Stefano Stabellini <stefano.stabellini@xxxxxxxxxxxxx>
Date: Thu, 29 Oct 2009 13:41:40 +0000
Delivery-date: Thu, 29 Oct 2009 06:41:06 -0700
Envelope-to: www-data@xxxxxxxxxxxxxxxxxxx
List-help: <mailto:xen-devel-request@lists.xensource.com?subject=help>
List-id: Xen developer discussion <xen-devel.lists.xensource.com>
List-post: <mailto:xen-devel@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=unsubscribe>
Sender: xen-devel-bounces@xxxxxxxxxxxxxxxxxxx
User-agent: Alpine 2.00 (DEB 1167 2008-08-23)
The built-in bash command wait should be able to take a pid argument and
just wait for the specified process to die, but it currently has a bug
and what actually does is waiting for the death of all the children.
For this reason the stubdom-dm script doesn't exit properly after
stubdom destruction.
This patch solves the issue spawning only one child, removing the
sleep subprocess workaround that was used to create a usable stdin for
"xm console" and replacing it with a fifo.

Signed-off-by: Stefano Stabellini <stefano.stabellini@xxxxxxxxxxxxx>

---

diff -r 47136dbb972d stubdom/stubdom-dm
--- a/stubdom/stubdom-dm        Wed Oct 28 10:59:55 2009 +0000
+++ b/stubdom/stubdom-dm        Thu Oct 29 11:40:48 2009 +0000
@@ -80,8 +80,8 @@
 # Termination handler
 
 term() {
-    kill %1
     [ -n "$vncpid" ] && kill -9 $vncpid
+    rm -f /tmp/domname-dm
     rm ${stubdom_configdir}/$domname-dm
     exit 0
 }
@@ -154,11 +154,10 @@
     j=$(( $j + 1 ))
 done
 echo " ] " >> ${stubdom_configdir}/$domname-dm
-creation="xm create -c ${stubdom_configdir}/$domname-dm target=$domid 
memory=32 extra=\"$extra\""
 
-(while true ; do sleep 60 ; done) | /bin/sh -c "$creation" &
-#xterm -geometry +0+0 -e /bin/sh -c "$creation ; echo ; echo press ENTER to 
shut down ; read" &
-consolepid=$!
+mkfifo /tmp/$domname-dm
+xm create -c ${stubdom_configdir}/$domname-dm target=$domid memory=32 
extra="$extra" < /tmp/$domname-dm &
+exec 4>/tmp/$domname-dm
 
 
 ###########
@@ -178,6 +177,6 @@
 fi
 
 # wait for SIGHUP or stubdom termination
-wait $consolepid
+wait
 
 term

_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-devel

<Prev in Thread] Current Thread [Next in Thread>
  • [Xen-devel] [PATCH] make stubdom-dm exit properly, Stefano Stabellini <=