[libvirt] [PATCH] Fix virProcessKillPainfully on Win32

From: "Daniel P. Berrange" <berrange@redhat.com> Win32 platforms don't have SIGKILL defined, but they do have SIGABRT. Since our virProcess wrapper treats anything which isn't SIGTERM/SIGINT as equivalent to SIGKILL, just use SIGABRT on Win32. Pushed as a Win32 build break fix Signed-off-by: Daniel P. Berrange <berrange@redhat.com> --- src/util/virprocess.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/util/virprocess.c b/src/util/virprocess.c index c70aa58..fee333f 100644 --- a/src/util/virprocess.c +++ b/src/util/virprocess.c @@ -267,8 +267,15 @@ virProcessKillPainfully(pid_t pid, bool force) } else if ((i == 50) & force) { VIR_DEBUG("Timed out waiting after SIGTERM to process %d, " "sending SIGKILL", pid); + /* No SIGKILL kill on Win32 ! Use SIGABRT instead which our + * virProcessKill proc will handle more or less lik SIGKILL */ +#ifdef WIN32 + signum = SIGABRT; /* kill it after a grace period */ + signame = "ABRT"; +#else signum = SIGKILL; /* kill it after a grace period */ signame = "KILL"; +#endif } else { signum = 0; /* Just check for existence */ } -- 1.7.11.2

On 10/16/2012 08:47 AM, Daniel P. Berrange wrote:
From: "Daniel P. Berrange" <berrange@redhat.com>
Win32 platforms don't have SIGKILL defined, but they do have SIGABRT. Since our virProcess wrapper treats anything which isn't SIGTERM/SIGINT as equivalent to SIGKILL, just use SIGABRT on Win32.
Pushed as a Win32 build break fix
Signed-off-by: Daniel P. Berrange <berrange@redhat.com> --- src/util/virprocess.c | 7 +++++++ 1 file changed, 7 insertions(+)
diff --git a/src/util/virprocess.c b/src/util/virprocess.c index c70aa58..fee333f 100644 --- a/src/util/virprocess.c +++ b/src/util/virprocess.c @@ -267,8 +267,15 @@ virProcessKillPainfully(pid_t pid, bool force) } else if ((i == 50) & force) { VIR_DEBUG("Timed out waiting after SIGTERM to process %d, " "sending SIGKILL", pid); + /* No SIGKILL kill on Win32 ! Use SIGABRT instead which our + * virProcessKill proc will handle more or less lik SIGKILL */
s/lik/like/
+#ifdef WIN32 + signum = SIGABRT; /* kill it after a grace period */ + signame = "ABRT"; +#else signum = SIGKILL; /* kill it after a grace period */ signame = "KILL"; +#endif } else { signum = 0; /* Just check for existence */ }
-- Eric Blake eblake@redhat.com +1-919-301-3266 Libvirt virtualization library http://libvirt.org
participants (2)
-
Daniel P. Berrange
-
Eric Blake