[Autotest][PATCH 1/4] This add utils for get process name from his PID.

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

 



Signed-off-by: JiÅÃ Åupka <jzupka@xxxxxxxxxx>
---
 client/common_lib/utils.py |    8 ++++++++
 1 files changed, 8 insertions(+), 0 deletions(-)

diff --git a/client/common_lib/utils.py b/client/common_lib/utils.py
index 2cbc740..8d6c1f7 100644
--- a/client/common_lib/utils.py
+++ b/client/common_lib/utils.py
@@ -1105,6 +1105,14 @@ def get_pid_from_file(program_name):
     return pid
 
 
+def get_process_name(pid):
+    """
+    Get process name from PID.
+    @param pid: PID of process.
+    """
+    return get_field(read_file("/proc/%d/stat" % pid), 1)[1:-1]
+
+
 def program_is_alive(program_name):
     """
     Checks if the process is alive and not in Zombie state.
-- 
1.7.2.3

--
To unsubscribe from this list: send the line "unsubscribe kvm" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [KVM ARM]     [KVM ia64]     [KVM ppc]     [Virtualization Tools]     [Spice Development]     [Libvirt]     [Libvirt Users]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite Questions]     [Linux Kernel]     [Linux SCSI]     [XFree86]
  Powered by Linux