Change-Id: I8ae403b276ed5f100e435c324932ea03d92eb69c
Reviewed-on: http://photon-jenkins.eng.vmware.com:8082/2915
Tested-by: gerrit-photon <photon-checkins@vmware.com>
Reviewed-by: Xiaolin Li <xiaolinl@vmware.com>
| ... | ... |
@@ -3,7 +3,7 @@ |
| 3 | 3 |
Summary: Utility tools for control groups of Linux |
| 4 | 4 |
Name: cgroup-utils |
| 5 | 5 |
Version: 0.6 |
| 6 |
-Release: 3%{?dist}
|
|
| 6 |
+Release: 4%{?dist}
|
|
| 7 | 7 |
License: GPLv2 |
| 8 | 8 |
Group: Development/Libraries |
| 9 | 9 |
URL: https://pypi.python.org/pypi/cgroup-utils/0.6 |
| ... | ... |
@@ -11,11 +11,13 @@ URL: https://pypi.python.org/pypi/cgroup-utils/0.6 |
| 11 | 11 |
Source0: https://github.com/peo3/cgroup-utils/archive/%{name}-%{version}.tar.gz
|
| 12 | 12 |
%define sha1 cgroup-utils=c0c9c6ddcd7e5ce2eb04394aa1ad46e1b05eb669 |
| 13 | 13 |
|
| 14 |
+Patch0: cgutil-support-space-in-procname.patch |
|
| 14 | 15 |
BuildRequires: python-setuptools |
| 15 | 16 |
BuildRequires: python2-devel |
| 16 | 17 |
|
| 17 | 18 |
Requires: python2 |
| 18 | 19 |
|
| 20 |
+ |
|
| 19 | 21 |
%description |
| 20 | 22 |
cgroup-utils provides utility tools and libraries for control groups of Linux. For example, |
| 21 | 23 |
cgutil top is a top-like tool which shows activities of running processes in control groups. |
| ... | ... |
@@ -28,6 +30,7 @@ BuildRequires: python3-libs |
| 28 | 28 |
%description -n python3-cgroup-utils |
| 29 | 29 |
%prep |
| 30 | 30 |
%setup -q |
| 31 |
+%patch0 -p1 |
|
| 31 | 32 |
rm -rf ../p3dir |
| 32 | 33 |
cp -a . ../p3dir |
| 33 | 34 |
|
| ... | ... |
@@ -64,6 +67,8 @@ popd |
| 64 | 64 |
%{python3_sitelib}/*
|
| 65 | 65 |
|
| 66 | 66 |
%changelog |
| 67 |
+* Fri Jun 09 2017 Xiaolin Li <xiaolinl@vmware.com> 0.6-4 |
|
| 68 |
+- Support space in proc name. |
|
| 67 | 69 |
* Tue May 23 2017 Xiaolin Li <xiaolinl@vmware.com> 0.6-3 |
| 68 | 70 |
- Added python3 subpackage. |
| 69 | 71 |
* Tue May 24 2016 Priyesh Padmavilasom <ppadmavilasom@vmware.com> 0.6-2 |
| 70 | 72 |
new file mode 100644 |
| ... | ... |
@@ -0,0 +1,24 @@ |
| 0 |
+diff --git a/process.py b/process2.py |
|
| 1 |
+index 66cf702..ae939c1 100644 |
|
| 2 |
+--- a/cgutils/process.py |
|
| 3 |
+@@ -27,12 +27,13 @@ class Process(object): |
|
| 4 |
+ def __init__(self, pid): |
|
| 5 |
+ self.pid = pid |
|
| 6 |
+ |
|
| 7 |
+- items = fileops.read('/proc/%d/stat' % pid).split(' ')
|
|
| 8 |
+- self.name = items[1].lstrip('(').rstrip(')')
|
|
| 9 |
+- self.state = items[2] |
|
| 10 |
+- self.ppid = int(items[3]) |
|
| 11 |
+- self.pgid = int(items[4]) |
|
| 12 |
+- self.sid = int(items[5]) |
|
| 13 |
++ items = fileops.read('/proc/%d/stat' % pid).rsplit(')', 1)
|
|
| 14 |
++ self.name = items[0].split('(')[1]
|
|
| 15 |
++ otherinfo = items[1].lstrip(' ').split(' ')
|
|
| 16 |
++ self.state = otherinfo[0] |
|
| 17 |
++ self.ppid = int(otherinfo[1]) |
|
| 18 |
++ self.pgid = int(otherinfo[2]) |
|
| 19 |
++ self.sid = int(otherinfo[3]) |
|
| 20 |
+ if not self.is_kthread(): |
|
| 21 |
+ self.name = self._get_fullname() |
|
| 22 |
+ cmdline = fileops.read('/proc/%d/cmdline' % self.pid)
|