[libvirt PATCH 4/6] util: virPidFileForceCleanupPath: add group argument

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Add a version of virPidFileForceCleanupPath that takes
a 'group' bool argument and propagate it all the way
down to virProcessKillPainfullyDelay.

Signed-off-by: Ján Tomko <jtomko@xxxxxxxxxx>
---
 src/libvirt_private.syms | 1 +
 src/qemu/qemu_process.c  | 3 ++-
 src/util/virpidfile.c    | 8 +++++++-
 src/util/virpidfile.h    | 2 ++
 src/util/virprocess.c    | 8 ++++----
 src/util/virprocess.h    | 3 ++-
 6 files changed, 18 insertions(+), 7 deletions(-)

diff --git a/src/libvirt_private.syms b/src/libvirt_private.syms
index 6961cdb137..e2e4c9482d 100644
--- a/src/libvirt_private.syms
+++ b/src/libvirt_private.syms
@@ -3038,6 +3038,7 @@ virPidFileConstructPath;
 virPidFileDelete;
 virPidFileDeletePath;
 virPidFileForceCleanupPath;
+virPidFileForceCleanupPathFull;
 virPidFileRead;
 virPidFileReadIfAlive;
 virPidFileReadPath;
diff --git a/src/qemu/qemu_process.c b/src/qemu/qemu_process.c
index 521fda57da..6ef8ebd83e 100644
--- a/src/qemu/qemu_process.c
+++ b/src/qemu/qemu_process.c
@@ -7700,7 +7700,8 @@ qemuProcessKill(virDomainObj *vm, unsigned int flags)
      * to be safe against stalls by the kernel freeing up the resources */
     return virProcessKillPainfullyDelay(vm->pid,
                                         !!(flags & VIR_QEMU_PROCESS_KILL_FORCE),
-                                        vm->def->nhostdevs * 2);
+                                        vm->def->nhostdevs * 2,
+                                        false);
 }
 
 
diff --git a/src/util/virpidfile.c b/src/util/virpidfile.c
index c6389c1869..b75f441008 100644
--- a/src/util/virpidfile.c
+++ b/src/util/virpidfile.c
@@ -514,7 +514,7 @@ virPidFileConstructPath(bool privileged,
  * Returns 0 if the pidfile was successfully cleaned up, -1 otherwise.
  */
 int
-virPidFileForceCleanupPath(const char *path)
+virPidFileForceCleanupPathFull(const char *path, bool group)
 {
     pid_t pid = 0;
     int fd = -1;
@@ -544,3 +544,9 @@ virPidFileForceCleanupPath(const char *path)
 
     return 0;
 }
+
+int
+virPidFileForceCleanupPath(const char *path)
+{
+    return virPidFileForceCleanupPathFull(path, false);
+}
diff --git a/src/util/virpidfile.h b/src/util/virpidfile.h
index 370a59892e..fd8013c41e 100644
--- a/src/util/virpidfile.h
+++ b/src/util/virpidfile.h
@@ -73,4 +73,6 @@ int virPidFileConstructPath(bool privileged,
                             const char *progname,
                             char **pidfile);
 
+int virPidFileForceCleanupPathFull(const char *path,
+                                   bool group) ATTRIBUTE_NONNULL(1);
 int virPidFileForceCleanupPath(const char *path) ATTRIBUTE_NONNULL(1);
diff --git a/src/util/virprocess.c b/src/util/virprocess.c
index bbfa4dbdf0..a92aa8aac9 100644
--- a/src/util/virprocess.c
+++ b/src/util/virprocess.c
@@ -406,15 +406,15 @@ pid_t virProcessGroupGet(pid_t pid)
  * wait longer than the default.
  */
 int
-virProcessKillPainfullyDelay(pid_t pid, bool force, unsigned int extradelay)
+virProcessKillPainfullyDelay(pid_t pid, bool force, unsigned int extradelay, bool group)
 {
     size_t i;
     /* This is in 1/5th seconds since polling is on a 0.2s interval */
     unsigned int polldelay = (force ? 200 : 75) + (extradelay*5);
     const char *signame = "TERM";
 
-    VIR_DEBUG("vpid=%lld force=%d extradelay=%u",
-              (long long)pid, force, extradelay);
+    VIR_DEBUG("vpid=%lld force=%d extradelay=%u group=%d",
+              (long long)pid, force, extradelay, group);
 
     /* This loop sends SIGTERM, then waits a few iterations (10 seconds)
      * to see if it dies. If the process still hasn't exited, and
@@ -474,7 +474,7 @@ virProcessKillPainfullyDelay(pid_t pid, bool force, unsigned int extradelay)
 
 int virProcessKillPainfully(pid_t pid, bool force)
 {
-    return virProcessKillPainfullyDelay(pid, force, 0);
+    return virProcessKillPainfullyDelay(pid, force, 0, false);
 }
 
 #if WITH_SCHED_GETAFFINITY
diff --git a/src/util/virprocess.h b/src/util/virprocess.h
index 9d7c0f479a..9910331a0c 100644
--- a/src/util/virprocess.h
+++ b/src/util/virprocess.h
@@ -58,7 +58,8 @@ pid_t virProcessGroupGet(pid_t pid);
 int virProcessKillPainfully(pid_t pid, bool force);
 int virProcessKillPainfullyDelay(pid_t pid,
                                  bool force,
-                                 unsigned int extradelay);
+                                 unsigned int extradelay,
+                                 bool group);
 
 int virProcessSetAffinity(pid_t pid, virBitmap *map, bool quiet);
 
-- 
2.31.1




[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]

  Powered by Linux