From patchwork Wed Oct 13 14:13:16 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jiri Zupka X-Patchwork-Id: 250701 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by demeter1.kernel.org (8.14.4/8.14.3) with ESMTP id o9DEChoX002556 for ; Wed, 13 Oct 2010 14:12:44 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752277Ab0JMOMm (ORCPT ); Wed, 13 Oct 2010 10:12:42 -0400 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 Received: from jzupka.local.com (dhcp-27-161.brq.redhat.com [10.34.27.161]) by int-mx03.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id o9DECb2G009027; Wed, 13 Oct 2010 10:12:39 -0400 From: =?UTF-8?q?Ji=C5=99=C3=AD=20=C5=BDupka?= To: kvm-autotest@redhat.com, kvm@vger.kernel.org Cc: jzupka@redhat.com, akong@redhat.com, ldoktor@redhat.com 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> In-Reply-To: <1286979199-13109-1-git-send-email-jzupka@redhat.com> References: <1286979199-13109-1-git-send-email-jzupka@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.67 on 10.5.11.16 Sender: kvm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org X-Greylist: IP, sender and recipient auto-whitelisted, not delayed by milter-greylist-4.2.3 (demeter1.kernel.org [140.211.167.41]); Wed, 13 Oct 2010 14:12:44 +0000 (UTC) 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.