From: =?UTF-8?q?Ji=C5=99=C3=AD=20=C5=BDupka?= Subject: [Autotest][PATCH 1/4] This add utils for get process name from his PID. Date: Wed, 13 Oct 2010 16:13:16 +0200 Message-ID: <1286979199-13109-2-git-send-email-jzupka@redhat.com> References: <1286979199-13109-1-git-send-email-jzupka@redhat.com> Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: QUOTED-PRINTABLE Cc: jzupka@redhat.com, akong@redhat.com, ldoktor@redhat.com To: kvm-autotest@redhat.com, kvm@vger.kernel.org Return-path: Received: from mx1.redhat.com ([209.132.183.28]:20512 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751936Ab0JMOMl (ORCPT ); Wed, 13 Oct 2010 10:12:41 -0400 Received: from int-mx03.intmail.prod.int.phx2.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.16]) by mx1.redhat.com (8.13.8/8.13.8) with ESMTP id o9DECfLk031420 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Wed, 13 Oct 2010 10:12:41 -0400 In-Reply-To: <1286979199-13109-1-git-send-email-jzupka@redhat.com> Sender: kvm-owner@vger.kernel.org List-ID: Signed-off-by: Ji=C5=99=C3=AD =C5=BDupka --- 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 =20 =20 +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. --=20 1.7.2.3