All of lore.kernel.org
 help / color / mirror / Atom feed
From: Samuel Thibault <samuel.thibault@eu.citrix.com>
To: xen-devel@lists.xensource.com
Subject: [PATCH] nicely terminate the device model script
Date: Fri, 18 Jan 2008 12:45:38 +0000	[thread overview]
Message-ID: <20080118124538.GA24773@implementation.uk.xensource.com> (raw)

Nicely terminate the device model script, to let it properly clean
resources.

Signed-off-by: Samuel Thibault <samuel.thibault@eu.citrix.com>

diff -u b/tools/python/xen/xend/image.py b/tools/python/xen/xend/image.py
--- b/tools/python/xen/xend/image.py	Fri Jan 18 11:53:23 2008 +0000
+++ b/tools/python/xen/xend/image.py	Fri Jan 18 12:42:11 2008 +0000
@@ -325,7 +325,7 @@
             return
         if self.pid:
             try:
-                os.kill(self.pid, signal.SIGKILL)
+                os.kill(self.pid, signal.SIGTERM)
             except OSError, exn:
                 log.exception(exn)
             try:
only in patch2:
unchanged:
--- a/tools/ioemu/target-i386-dm/helper2.c	Thu Jan 17 16:22:30 2008 +0000
+++ b/tools/ioemu/target-i386-dm/helper2.c	Fri Jan 18 12:42:10 2008 +0000
@@ -637,6 +637,7 @@ int main_loop(void)
     int evtchn_fd = xce_handle == -1 ? -1 : xc_evtchn_fd(xce_handle);
     char qemu_file[PATH_MAX];
     fd_set fds;
+    int ret = 0;
 
     buffered_io_timer = qemu_new_timer(rt_clock, handle_buffered_io,
 				       cpu_single_env);
@@ -647,9 +648,14 @@ int main_loop(void)
 
     xenstore_record_dm_state("running");
     while (1) {
-        while (!(vm_running && suspend_requested))
+        while (!((vm_running && suspend_requested) || shutdown_requested))
             /* Wait up to 10 msec. */
             main_loop_wait(10);
+
+        if (shutdown_requested) {
+            ret = EXCP_INTERRUPT;
+            break;
+        }
 
         fprintf(logfile, "device model saving state\n");
 
@@ -676,7 +682,7 @@ int main_loop(void)
         xenstore_record_dm_state("running");
     }
 
-    return 0;
+    return ret;
 }
 
 void destroy_hvm_domain(void)

                 reply	other threads:[~2008-01-18 12:45 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20080118124538.GA24773@implementation.uk.xensource.com \
    --to=samuel.thibault@eu.citrix.com \
    --cc=xen-devel@lists.xensource.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.