iotop: backport some bugfix patches
iotop: backport some bugfix patches Signed-off-by: Zhiqiang Liu <liuzhiqiang26@huawei.com>
This commit is contained in:
parent
b2eb46ee0f
commit
b6b1c2b0f4
@ -1,9 +0,0 @@
|
|||||||
diff -ru iotop-0.6.orign/sbin/iotop iotop-0.6/sbin/iotop
|
|
||||||
--- iotop-0.6.orign/sbin/iotop 2013-05-27 00:44:18.000000000 +0200
|
|
||||||
+++ iotop-0.6/sbin/iotop 2015-11-15 22:47:24.468058681 +0100
|
|
||||||
@@ -1,4 +1,4 @@
|
|
||||||
-#!/usr/bin/python
|
|
||||||
+#!/usr/bin/python3
|
|
||||||
# iotop: Display I/O usage of processes in a top like UI
|
|
||||||
# Copyright (c) 2007, 2008 Guillaume Chazarain <guichaz@gmail.com>, GPLv2
|
|
||||||
# See iotop --help for some help
|
|
||||||
47
0001-Switch-from-python-to-python3.patch
Normal file
47
0001-Switch-from-python-to-python3.patch
Normal file
@ -0,0 +1,47 @@
|
|||||||
|
From 7d6b10b118a8164ef8a924a0c131b2a062349fd3 Mon Sep 17 00:00:00 2001
|
||||||
|
From: Paul Wise <pabs3@bonedaddy.net>
|
||||||
|
Date: Sun, 29 Apr 2018 11:40:58 +0800
|
||||||
|
Subject: [PATCH 01/11] Switch from python to python3
|
||||||
|
|
||||||
|
Python 2 will be EOL in 2020 so Python 3 is preferrable.
|
||||||
|
|
||||||
|
See-also: https://pythonclock.org/
|
||||||
|
---
|
||||||
|
iotop.py | 2 +-
|
||||||
|
sbin/iotop | 2 +-
|
||||||
|
setup.py | 2 +-
|
||||||
|
3 files changed, 3 insertions(+), 3 deletions(-)
|
||||||
|
|
||||||
|
diff --git a/iotop.py b/iotop.py
|
||||||
|
index 13ed873..666c6b4 100755
|
||||||
|
--- a/iotop.py
|
||||||
|
+++ b/iotop.py
|
||||||
|
@@ -1,4 +1,4 @@
|
||||||
|
-#!/usr/bin/python
|
||||||
|
+#!/usr/bin/python3
|
||||||
|
# iotop: Display I/O usage of processes in a top like UI
|
||||||
|
# Copyright (c) 2007, 2008 Guillaume Chazarain <guichaz@gmail.com>
|
||||||
|
# GPL version 2 or later
|
||||||
|
diff --git a/sbin/iotop b/sbin/iotop
|
||||||
|
index c5202d3..bb23a6e 100755
|
||||||
|
--- a/sbin/iotop
|
||||||
|
+++ b/sbin/iotop
|
||||||
|
@@ -1,4 +1,4 @@
|
||||||
|
-#!/usr/bin/python
|
||||||
|
+#!/usr/bin/python3
|
||||||
|
# iotop: Display I/O usage of processes in a top like UI
|
||||||
|
# Copyright (c) 2007, 2008 Guillaume Chazarain <guichaz@gmail.com>, GPLv2
|
||||||
|
# See iotop --help for some help
|
||||||
|
diff --git a/setup.py b/setup.py
|
||||||
|
index cd639ca..c63a36e 100755
|
||||||
|
--- a/setup.py
|
||||||
|
+++ b/setup.py
|
||||||
|
@@ -1,4 +1,4 @@
|
||||||
|
-#!/usr/bin/env python
|
||||||
|
+#!/usr/bin/env python3
|
||||||
|
|
||||||
|
from distutils.core import setup
|
||||||
|
from distutils.command import install as distutils_install
|
||||||
|
--
|
||||||
|
1.8.3.1
|
||||||
|
|
||||||
@ -1,7 +1,7 @@
|
|||||||
From 99c8d7cedce81f17b851954d94bfa73787300599 Mon Sep 17 00:00:00 2001
|
From 435bbde65bd10aa2ecbd352f46bb7f0abddc2189 Mon Sep 17 00:00:00 2001
|
||||||
From: Christophe Vu-Brugier <cvubrugier@fastmail.fm>
|
From: Christophe Vu-Brugier <cvubrugier@fastmail.fm>
|
||||||
Date: Fri, 17 Oct 2014 13:49:31 +0200
|
Date: Fri, 17 Oct 2014 13:49:31 +0200
|
||||||
Subject: [PATCH] Fix build error with Python 3 caused by itervalues() in
|
Subject: [PATCH 02/11] Fix build error with Python 3 caused by itervalues() in
|
||||||
setup.py
|
setup.py
|
||||||
|
|
||||||
The itervalues() method is not available in Python 3. As a
|
The itervalues() method is not available in Python 3. As a
|
||||||
@ -15,7 +15,7 @@ Signed-off-by: Paul Wise <pabs3@bonedaddy.net>
|
|||||||
1 file changed, 1 insertion(+), 1 deletion(-)
|
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||||
|
|
||||||
diff --git a/setup.py b/setup.py
|
diff --git a/setup.py b/setup.py
|
||||||
index 7150102..9de6068 100755
|
index c63a36e..a73423d 100755
|
||||||
--- a/setup.py
|
--- a/setup.py
|
||||||
+++ b/setup.py
|
+++ b/setup.py
|
||||||
@@ -7,7 +7,7 @@ from iotop.version import VERSION
|
@@ -7,7 +7,7 @@ from iotop.version import VERSION
|
||||||
@ -26,7 +26,7 @@ index 7150102..9de6068 100755
|
|||||||
+ for d in distutils_install.INSTALL_SCHEMES.values():
|
+ for d in distutils_install.INSTALL_SCHEMES.values():
|
||||||
if d.get('scripts', '').endswith('/bin'):
|
if d.get('scripts', '').endswith('/bin'):
|
||||||
d['scripts'] = d['scripts'][:-len('/bin')] + '/sbin'
|
d['scripts'] = d['scripts'][:-len('/bin')] + '/sbin'
|
||||||
|
|
||||||
--
|
--
|
||||||
2.4.10.GIT
|
1.8.3.1
|
||||||
|
|
||||||
@ -1,18 +0,0 @@
|
|||||||
diff -up iotop-0.6/iotop/data.py.splitline iotop-0.6/iotop/data.py
|
|
||||||
--- iotop-0.6/iotop/data.py.splitline 2013-05-27 00:44:18.000000000 +0200
|
|
||||||
+++ iotop-0.6/iotop/data.py 2018-07-09 16:08:04.135771959 +0200
|
|
||||||
@@ -193,7 +193,13 @@ def parse_proc_pid_status(pid):
|
|
||||||
result_dict = {}
|
|
||||||
try:
|
|
||||||
for line in open('/proc/%d/status' % pid):
|
|
||||||
- key, value = line.split(':\t', 1)
|
|
||||||
+ try:
|
|
||||||
+ key, value = line.split(':', 1)
|
|
||||||
+ except ValueError:
|
|
||||||
+ # Ignore lines that are not formatted correctly as
|
|
||||||
+ # some downstream kernels may have weird lines and
|
|
||||||
+ # the needed fields are probably formatted correctly.
|
|
||||||
+ continue
|
|
||||||
result_dict[key] = value.strip()
|
|
||||||
except IOError:
|
|
||||||
pass # No such process
|
|
||||||
31
0003-Only-split-proc-status-lines-on-the-character.patch
Normal file
31
0003-Only-split-proc-status-lines-on-the-character.patch
Normal file
@ -0,0 +1,31 @@
|
|||||||
|
From 961bd1671afbf501251119cdd7c02ce8cdaa7446 Mon Sep 17 00:00:00 2001
|
||||||
|
From: Paul Wise <pabs3@bonedaddy.net>
|
||||||
|
Date: Thu, 28 Jul 2016 13:25:54 +0800
|
||||||
|
Subject: [PATCH 03/11] Only split /proc/*/status lines on the : character.
|
||||||
|
|
||||||
|
Apparently vserver kernels have some lines that don't
|
||||||
|
appear to have the tab character so iotop crashes.
|
||||||
|
|
||||||
|
The tab character will be stripped by the next code line.
|
||||||
|
|
||||||
|
Closes: https://bugs.gentoo.org/show_bug.cgi?id=458556
|
||||||
|
---
|
||||||
|
iotop/data.py | 2 +-
|
||||||
|
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||||
|
|
||||||
|
diff --git a/iotop/data.py b/iotop/data.py
|
||||||
|
index 25b659e..bf2e7b5 100644
|
||||||
|
--- a/iotop/data.py
|
||||||
|
+++ b/iotop/data.py
|
||||||
|
@@ -193,7 +193,7 @@ def parse_proc_pid_status(pid):
|
||||||
|
result_dict = {}
|
||||||
|
try:
|
||||||
|
for line in open('/proc/%d/status' % pid):
|
||||||
|
- key, value = line.split(':\t', 1)
|
||||||
|
+ key, value = line.split(':', 1)
|
||||||
|
result_dict[key] = value.strip()
|
||||||
|
except IOError:
|
||||||
|
pass # No such process
|
||||||
|
--
|
||||||
|
1.8.3.1
|
||||||
|
|
||||||
64
0004-Ignore-invalid-lines-in-proc-status-files.patch
Normal file
64
0004-Ignore-invalid-lines-in-proc-status-files.patch
Normal file
@ -0,0 +1,64 @@
|
|||||||
|
From bd9396b2003a57077d2e7ca0b4b510537a24075c Mon Sep 17 00:00:00 2001
|
||||||
|
From: Paul Wise <pabs3@bonedaddy.net>
|
||||||
|
Date: Fri, 25 May 2018 15:13:26 +0800
|
||||||
|
Subject: [PATCH 04/11] Ignore invalid lines in /proc/*/status files
|
||||||
|
|
||||||
|
One Ubuntu Linux kernel security fix introduced a blank line.
|
||||||
|
Some other Linux kernels may have invalid lines in the future.
|
||||||
|
|
||||||
|
See-also: https://bugs.launchpad.net/ubuntu/+source/linux/+bug/1772671
|
||||||
|
Fixes: https://bugs.launchpad.net/ubuntu/+source/iotop/+bug/1772856
|
||||||
|
Reported-by: Paul Jaros <jaros.paul@gmail.com>
|
||||||
|
Reported-in: <CAEh_nc0_DXTmfu16PxmVyrCi6QQeSrpnGGhtfNu60wJYfa_6Zw@mail.gmail.com>
|
||||||
|
Traceback (most recent call last):
|
||||||
|
File "/usr/sbin/iotop", line 17, in <module>
|
||||||
|
main()
|
||||||
|
File "/usr/lib/python2.7/dist-packages/iotop/ui.py", line 620, in main
|
||||||
|
main_loop()
|
||||||
|
File "/usr/lib/python2.7/dist-packages/iotop/ui.py", line 610, in <lambda>
|
||||||
|
main_loop = lambda: run_iotop(options)
|
||||||
|
File "/usr/lib/python2.7/dist-packages/iotop/ui.py", line 508, in run_iotop
|
||||||
|
return curses.wrapper(run_iotop_window, options)
|
||||||
|
File "/usr/lib/python2.7/curses/wrapper.py", line 43, in wrapper
|
||||||
|
return func(stdscr, *args, **kwds)
|
||||||
|
File "/usr/lib/python2.7/dist-packages/iotop/ui.py", line 501, in run_iotop_window
|
||||||
|
ui.run()
|
||||||
|
File "/usr/lib/python2.7/dist-packages/iotop/ui.py", line 155, in run
|
||||||
|
self.process_list.duration)
|
||||||
|
File "/usr/lib/python2.7/dist-packages/iotop/ui.py", line 434, in refresh_display
|
||||||
|
lines = self.get_data()
|
||||||
|
File "/usr/lib/python2.7/dist-packages/iotop/ui.py", line 415, in get_data
|
||||||
|
return list(map(format, processes))
|
||||||
|
File "/usr/lib/python2.7/dist-packages/iotop/ui.py", line 388, in format
|
||||||
|
cmdline = p.get_cmdline()
|
||||||
|
File "/usr/lib/python2.7/dist-packages/iotop/data.py", line 292, in get_cmdline
|
||||||
|
proc_status = parse_proc_pid_status(self.pid)
|
||||||
|
File "/usr/lib/python2.7/dist-packages/iotop/data.py", line 196, in parse_proc_pid_status
|
||||||
|
key, value = line.split(':\t', 1)
|
||||||
|
ValueError: need more than 1 value to unpack
|
||||||
|
---
|
||||||
|
iotop/data.py | 8 +++++++-
|
||||||
|
1 file changed, 7 insertions(+), 1 deletion(-)
|
||||||
|
|
||||||
|
diff --git a/iotop/data.py b/iotop/data.py
|
||||||
|
index bf2e7b5..62626c3 100644
|
||||||
|
--- a/iotop/data.py
|
||||||
|
+++ b/iotop/data.py
|
||||||
|
@@ -193,7 +193,13 @@ def parse_proc_pid_status(pid):
|
||||||
|
result_dict = {}
|
||||||
|
try:
|
||||||
|
for line in open('/proc/%d/status' % pid):
|
||||||
|
- key, value = line.split(':', 1)
|
||||||
|
+ try:
|
||||||
|
+ key, value = line.split(':', 1)
|
||||||
|
+ except ValueError:
|
||||||
|
+ # Ignore lines that are not formatted correctly as
|
||||||
|
+ # some downstream kernels may have weird lines and
|
||||||
|
+ # the needed fields are probably formatted correctly.
|
||||||
|
+ pass
|
||||||
|
result_dict[key] = value.strip()
|
||||||
|
except IOError:
|
||||||
|
pass # No such process
|
||||||
|
--
|
||||||
|
1.8.3.1
|
||||||
|
|
||||||
@ -1,19 +0,0 @@
|
|||||||
diff -urN iotop-0.6.orig/iotop/ioprio.py iotop-0.6/iotop/ioprio.py
|
|
||||||
--- iotop-0.6.orig/iotop/ioprio.py 2013-05-27 00:44:18.000000003 +0200
|
|
||||||
+++ iotop-0.6/iotop/ioprio.py 2018-08-01 15:12:59.460788725 +0200
|
|
||||||
@@ -27,6 +27,7 @@
|
|
||||||
# 'x86_64' but it will use the i386 syscall number, that's why we consider both
|
|
||||||
# the architecture name and the word size.
|
|
||||||
IOPRIO_GET_ARCH_SYSCALL = [
|
|
||||||
+ ('aarch64', '*', 31),
|
|
||||||
('alpha', '*', 443),
|
|
||||||
('arm*', '*', 315),
|
|
||||||
('i*86', '*', 290),
|
|
||||||
@@ -41,6 +42,7 @@
|
|
||||||
]
|
|
||||||
|
|
||||||
IOPRIO_SET_ARCH_SYSCALL = [
|
|
||||||
+ ('aarch64', '*', 30),
|
|
||||||
('alpha', '*', 442),
|
|
||||||
('arm*', '*', 314),
|
|
||||||
('i*86', '*', 289),
|
|
||||||
28
0005-Actually-skip-invalid-lines-in-proc-status.patch
Normal file
28
0005-Actually-skip-invalid-lines-in-proc-status.patch
Normal file
@ -0,0 +1,28 @@
|
|||||||
|
From a196e5a7f4c0cb694597a5c354ec12e6b262e570 Mon Sep 17 00:00:00 2001
|
||||||
|
From: Paul Wise <pabs3@bonedaddy.net>
|
||||||
|
Date: Fri, 25 May 2018 15:20:44 +0800
|
||||||
|
Subject: [PATCH 05/11] Actually skip invalid lines in /proc/*/status
|
||||||
|
|
||||||
|
Actually skip invalid lines in /proc/*/status
|
||||||
|
|
||||||
|
Fixes: commit 0392b205b5c3973a326721c2e9f97f0fa2eefa82
|
||||||
|
---
|
||||||
|
iotop/data.py | 2 +-
|
||||||
|
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||||
|
|
||||||
|
diff --git a/iotop/data.py b/iotop/data.py
|
||||||
|
index 62626c3..8378e51 100644
|
||||||
|
--- a/iotop/data.py
|
||||||
|
+++ b/iotop/data.py
|
||||||
|
@@ -199,7 +199,7 @@ def parse_proc_pid_status(pid):
|
||||||
|
# Ignore lines that are not formatted correctly as
|
||||||
|
# some downstream kernels may have weird lines and
|
||||||
|
# the needed fields are probably formatted correctly.
|
||||||
|
- pass
|
||||||
|
+ continue
|
||||||
|
result_dict[key] = value.strip()
|
||||||
|
except IOError:
|
||||||
|
pass # No such process
|
||||||
|
--
|
||||||
|
1.8.3.1
|
||||||
|
|
||||||
@ -1,6 +1,19 @@
|
|||||||
diff -up iotop-0.6/iotop/ioprio.py.ppcprio iotop-0.6/iotop/ioprio.py
|
From 745505381aec4bef1b71201c3ea702efd3851320 Mon Sep 17 00:00:00 2001
|
||||||
--- iotop-0.6/iotop/ioprio.py.ppcprio 2018-08-02 15:17:46.523099123 +0200
|
From: Wangjia <wangjia55@huawei.com>
|
||||||
+++ iotop-0.6/iotop/ioprio.py 2018-08-02 15:19:45.671660952 +0200
|
Date: Sun, 12 Jul 2020 14:31:46 +0800
|
||||||
|
Subject: [PATCH 06/11] replace powerpc with ppc in ioprio.py
|
||||||
|
|
||||||
|
replace powerpc with ppc in ioprio.py
|
||||||
|
|
||||||
|
Signed-off-by: Wangjia <wangjia55@huawei.com>
|
||||||
|
---
|
||||||
|
iotop/ioprio.py | 4 ++--
|
||||||
|
1 file changed, 2 insertions(+), 2 deletions(-)
|
||||||
|
|
||||||
|
diff --git a/iotop/ioprio.py b/iotop/ioprio.py
|
||||||
|
index 85957fd..a624795 100644
|
||||||
|
--- a/iotop/ioprio.py
|
||||||
|
+++ b/iotop/ioprio.py
|
||||||
@@ -32,7 +32,7 @@ IOPRIO_GET_ARCH_SYSCALL = [
|
@@ -32,7 +32,7 @@ IOPRIO_GET_ARCH_SYSCALL = [
|
||||||
('i*86', '*', 290),
|
('i*86', '*', 290),
|
||||||
('ia64*', '*', 1275),
|
('ia64*', '*', 1275),
|
||||||
@ -19,3 +32,6 @@ diff -up iotop-0.6/iotop/ioprio.py.ppcprio iotop-0.6/iotop/ioprio.py
|
|||||||
('s390*', '*', 282),
|
('s390*', '*', 282),
|
||||||
('sparc*', '*', 196),
|
('sparc*', '*', 196),
|
||||||
('sh*', '*', 288),
|
('sh*', '*', 288),
|
||||||
|
--
|
||||||
|
1.8.3.1
|
||||||
|
|
||||||
35
0007-add-aarch64-prio-in-ioprio.py.patch
Normal file
35
0007-add-aarch64-prio-in-ioprio.py.patch
Normal file
@ -0,0 +1,35 @@
|
|||||||
|
From 15285f0c2ed214fc5ae75edc6389d864e6b2e615 Mon Sep 17 00:00:00 2001
|
||||||
|
From: wangjia <wangjia55@huawei.com>
|
||||||
|
Date: Sun, 12 Jul 2020 14:34:13 +0800
|
||||||
|
Subject: [PATCH 07/11] add aarch64 prio in ioprio.py
|
||||||
|
|
||||||
|
add aarch64 prio in ioprio.py
|
||||||
|
|
||||||
|
Signed-off-by: wangjia <wangjia55@huawei.com>
|
||||||
|
---
|
||||||
|
iotop/ioprio.py | 2 ++
|
||||||
|
1 file changed, 2 insertions(+)
|
||||||
|
|
||||||
|
diff --git a/iotop/ioprio.py b/iotop/ioprio.py
|
||||||
|
index a624795..d292add 100644
|
||||||
|
--- a/iotop/ioprio.py
|
||||||
|
+++ b/iotop/ioprio.py
|
||||||
|
@@ -27,6 +27,7 @@ import platform
|
||||||
|
# 'x86_64' but it will use the i386 syscall number, that's why we consider both
|
||||||
|
# the architecture name and the word size.
|
||||||
|
IOPRIO_GET_ARCH_SYSCALL = [
|
||||||
|
+ ('aarch64', '*', 31),
|
||||||
|
('alpha', '*', 443),
|
||||||
|
('arm*', '*', 315),
|
||||||
|
('i*86', '*', 290),
|
||||||
|
@@ -41,6 +42,7 @@ IOPRIO_GET_ARCH_SYSCALL = [
|
||||||
|
]
|
||||||
|
|
||||||
|
IOPRIO_SET_ARCH_SYSCALL = [
|
||||||
|
+ ('aarch64', '*', 30),
|
||||||
|
('alpha', '*', 442),
|
||||||
|
('arm*', '*', 314),
|
||||||
|
('i*86', '*', 289),
|
||||||
|
--
|
||||||
|
1.8.3.1
|
||||||
|
|
||||||
54
0008-Print-the-titles-at-specific-locations.patch
Normal file
54
0008-Print-the-titles-at-specific-locations.patch
Normal file
@ -0,0 +1,54 @@
|
|||||||
|
From 8b0d74472fccdff449bf83d7624df0867df83344 Mon Sep 17 00:00:00 2001
|
||||||
|
From: Paul Wise <pabs3@bonedaddy.net>
|
||||||
|
Date: Thu, 4 Aug 2016 17:28:57 +0800
|
||||||
|
Subject: [PATCH 08/11] Print the titles at specific locations
|
||||||
|
|
||||||
|
Prevents a crash in a 3-line terminal:
|
||||||
|
|
||||||
|
Traceback (most recent call last):
|
||||||
|
File "./iotop.py", line 12, in <module>
|
||||||
|
main()
|
||||||
|
File "./iotop/ui.py", line 652, in main
|
||||||
|
main_loop()
|
||||||
|
File "./iotop/ui.py", line 642, in <lambda>
|
||||||
|
main_loop = lambda: run_iotop(options)
|
||||||
|
File "./iotop/ui.py", line 537, in run_iotop
|
||||||
|
return curses.wrapper(run_iotop_window, options)
|
||||||
|
File "/usr/lib/python2.7/curses/wrapper.py", line 43, in wrapper
|
||||||
|
return func(stdscr, *args, **kwds)
|
||||||
|
File "./iotop/ui.py", line 529, in run_iotop_window
|
||||||
|
ui.run()
|
||||||
|
File "./iotop/ui.py", line 176, in run
|
||||||
|
self.process_list.duration)
|
||||||
|
File "./iotop/ui.py", line 492, in refresh_display
|
||||||
|
self.win.addstr(title, attr)
|
||||||
|
_curses.error: addstr() returned ERR
|
||||||
|
---
|
||||||
|
iotop/ui.py | 4 +++-
|
||||||
|
1 file changed, 3 insertions(+), 1 deletion(-)
|
||||||
|
|
||||||
|
diff --git a/iotop/ui.py b/iotop/ui.py
|
||||||
|
index e033c92..848c42b 100644
|
||||||
|
--- a/iotop/ui.py
|
||||||
|
+++ b/iotop/ui.py
|
||||||
|
@@ -452,6 +452,7 @@ class IOTopUI(object):
|
||||||
|
self.win.addstr(i, 0, s[:self.width])
|
||||||
|
self.win.hline(len(summary), 0, ord(' ') | curses.A_REVERSE,
|
||||||
|
self.width)
|
||||||
|
+ pos = 0
|
||||||
|
remaining_cols = self.width
|
||||||
|
for i in range(len(titles)):
|
||||||
|
attr = curses.A_REVERSE
|
||||||
|
@@ -463,7 +464,8 @@ class IOTopUI(object):
|
||||||
|
title += self.sorting_reverse and '>' or '<'
|
||||||
|
title = title[:remaining_cols]
|
||||||
|
remaining_cols -= len(title)
|
||||||
|
- self.win.addstr(title, attr)
|
||||||
|
+ self.win.addstr(len(summary), pos, title, attr)
|
||||||
|
+ pos += len(title)
|
||||||
|
if Stats.has_blkio_delay_total:
|
||||||
|
status_msg = None
|
||||||
|
else:
|
||||||
|
--
|
||||||
|
1.8.3.1
|
||||||
|
|
||||||
@ -0,0 +1,62 @@
|
|||||||
|
From f079550490496eb1008fe73620ab5db3bd4a99a8 Mon Sep 17 00:00:00 2001
|
||||||
|
From: Paul Wise <pabs3@bonedaddy.net>
|
||||||
|
Date: Thu, 3 May 2018 11:06:09 +0800
|
||||||
|
Subject: [PATCH 09/11] Improve the message that is printed when Linux
|
||||||
|
taskstats are not found
|
||||||
|
|
||||||
|
Usually this means that iotop is being run in a container.
|
||||||
|
The Linux kernel doesn't support taskstats outside the host net namespace.
|
||||||
|
There was a patch that looks like it may fix this but it never got merged.
|
||||||
|
|
||||||
|
Traceback (most recent call last):
|
||||||
|
File "/usr/sbin/iotop", line 17, in <module>
|
||||||
|
main()
|
||||||
|
File "/usr/lib/python3/dist-packages/iotop/ui.py", line 737, in main
|
||||||
|
main_loop()
|
||||||
|
File "/usr/lib/python3/dist-packages/iotop/ui.py", line 727, in <lambda>
|
||||||
|
main_loop = lambda: run_iotop(options)
|
||||||
|
File "/usr/lib/python3/dist-packages/iotop/ui.py", line 618, in run_iotop
|
||||||
|
return run_iotop_window(None, options)
|
||||||
|
File "/usr/lib/python3/dist-packages/iotop/ui.py", line 609, in run_iotop_window
|
||||||
|
taskstats_connection = TaskStatsNetlink(options)
|
||||||
|
File "/usr/lib/python3/dist-packages/iotop/data.py", line 151, in __init__
|
||||||
|
self.family_id = controller.get_family_id('TASKSTATS')
|
||||||
|
File "/usr/lib/python3/dist-packages/iotop/genetlink.py", line 76, in get_family_id
|
||||||
|
m = GeNlMessage.recv(self.conn)
|
||||||
|
File "/usr/lib/python3/dist-packages/iotop/genetlink.py", line 56, in recv
|
||||||
|
msg = conn.recv()
|
||||||
|
File "/usr/lib/python3/dist-packages/iotop/netlink.py", line 255, in recv
|
||||||
|
raise err
|
||||||
|
OSError: Netlink error: No such file or directory (2)
|
||||||
|
|
||||||
|
See-also: https://blog.outlyer.com/using-netlink-to-calculate-load-averages
|
||||||
|
See-also: https://www.mail-archive.com/linux-kernel@vger.kernel.org/msg924689.html
|
||||||
|
See-also: https://bugzilla.redhat.com/show_bug.cgi?id=1290691
|
||||||
|
See-also: https://bugs.openvz.org/browse/OVZ-5655
|
||||||
|
---
|
||||||
|
iotop/ui.py | 9 +++++++++
|
||||||
|
1 file changed, 9 insertions(+)
|
||||||
|
|
||||||
|
diff --git a/iotop/ui.py b/iotop/ui.py
|
||||||
|
index 848c42b..328dafe 100644
|
||||||
|
--- a/iotop/ui.py
|
||||||
|
+++ b/iotop/ui.py
|
||||||
|
@@ -520,6 +520,15 @@ configure sudo to allow you to run iotop as root.
|
||||||
|
|
||||||
|
Please do not file bugs on iotop about this.''', file=sys.stderr)
|
||||||
|
sys.exit(1)
|
||||||
|
+ if e.errno == errno.ENOENT:
|
||||||
|
+ print(e, file=sys.stderr)
|
||||||
|
+ print('''
|
||||||
|
+The Linux kernel interfaces that iotop relies on for process I/O statistics
|
||||||
|
+were not found. Please enable CONFIG_TASKSTATS in your Linux kernel build
|
||||||
|
+configuration, use iotop outside a container and or share the host's
|
||||||
|
+network namespace with the container.
|
||||||
|
+
|
||||||
|
+Please do not file bugs on iotop about this.''', file=sys.stderr
|
||||||
|
else:
|
||||||
|
raise
|
||||||
|
|
||||||
|
--
|
||||||
|
1.8.3.1
|
||||||
|
|
||||||
34
0010-Fix-crash-due-to-syntax-error.patch
Normal file
34
0010-Fix-crash-due-to-syntax-error.patch
Normal file
@ -0,0 +1,34 @@
|
|||||||
|
From cfdcabc05f75fbc5680608ef9c27069aa75077f6 Mon Sep 17 00:00:00 2001
|
||||||
|
From: Paul Jaros <jaros.paul@gmail.com>
|
||||||
|
Date: Thu, 24 May 2018 18:47:00 +0800
|
||||||
|
Subject: [PATCH 10/11] Fix crash due to syntax error
|
||||||
|
|
||||||
|
Traceback (most recent call last):
|
||||||
|
File "./iotop.py", line 9, in <module>
|
||||||
|
from iotop.ui import main
|
||||||
|
File "./iotop/ui.py", line 642
|
||||||
|
else:
|
||||||
|
^
|
||||||
|
SyntaxError: invalid syntax
|
||||||
|
|
||||||
|
Reported-in: <CAEh_nc0_DXTmfu16PxmVyrCi6QQeSrpnGGhtfNu60wJYfa_6Zw@mail.gmail.com>
|
||||||
|
---
|
||||||
|
iotop/ui.py | 2 +-
|
||||||
|
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||||
|
|
||||||
|
diff --git a/iotop/ui.py b/iotop/ui.py
|
||||||
|
index 328dafe..40e9a40 100644
|
||||||
|
--- a/iotop/ui.py
|
||||||
|
+++ b/iotop/ui.py
|
||||||
|
@@ -528,7 +528,7 @@ were not found. Please enable CONFIG_TASKSTATS in your Linux kernel build
|
||||||
|
configuration, use iotop outside a container and or share the host's
|
||||||
|
network namespace with the container.
|
||||||
|
|
||||||
|
-Please do not file bugs on iotop about this.''', file=sys.stderr
|
||||||
|
+Please do not file bugs on iotop about this.''', file=sys.stderr)
|
||||||
|
else:
|
||||||
|
raise
|
||||||
|
|
||||||
|
--
|
||||||
|
1.8.3.1
|
||||||
|
|
||||||
61
0011-Use-monotonic-time-to-calculate-durations.patch
Normal file
61
0011-Use-monotonic-time-to-calculate-durations.patch
Normal file
@ -0,0 +1,61 @@
|
|||||||
|
From a535dc4f25f65379bf81f947307d92eee1618e54 Mon Sep 17 00:00:00 2001
|
||||||
|
From: Paul Wise <pabs3@bonedaddy.net>
|
||||||
|
Date: Thu, 4 May 2017 21:23:22 +0800
|
||||||
|
Subject: [PATCH 11/11] Use monotonic time to calculate durations
|
||||||
|
|
||||||
|
Prevents incorrect calculations when the system time is set backwards.
|
||||||
|
|
||||||
|
Reported-by: Andrei Costin <zveriu@gmail.com>
|
||||||
|
Fixes: https://bugs.launchpad.net/bugs/1685512
|
||||||
|
---
|
||||||
|
iotop/data.py | 6 +++---
|
||||||
|
iotop/ui.py | 2 +-
|
||||||
|
2 files changed, 4 insertions(+), 4 deletions(-)
|
||||||
|
|
||||||
|
diff --git a/iotop/data.py b/iotop/data.py
|
||||||
|
index 8378e51..befa9c7 100644
|
||||||
|
--- a/iotop/data.py
|
||||||
|
+++ b/iotop/data.py
|
||||||
|
@@ -248,7 +248,7 @@ class ProcessInfo(DumpableObject):
|
||||||
|
self.threads = {} # {tid: ThreadInfo}
|
||||||
|
self.stats_delta = Stats.build_all_zero()
|
||||||
|
self.stats_accum = Stats.build_all_zero()
|
||||||
|
- self.stats_accum_timestamp = time.time()
|
||||||
|
+ self.stats_accum_timestamp = time.monotonic()
|
||||||
|
|
||||||
|
def is_monitored(self, options):
|
||||||
|
if (options.pids and not options.processes and
|
||||||
|
@@ -373,7 +373,7 @@ class ProcessList(DumpableObject):
|
||||||
|
self.processes = {}
|
||||||
|
self.taskstats_connection = taskstats_connection
|
||||||
|
self.options = options
|
||||||
|
- self.timestamp = time.time()
|
||||||
|
+ self.timestamp = time.monotonic()
|
||||||
|
self.vmstat = vmstat.VmStat()
|
||||||
|
|
||||||
|
# A first time as we are interested in the delta
|
||||||
|
@@ -423,7 +423,7 @@ class ProcessList(DumpableObject):
|
||||||
|
return tids
|
||||||
|
|
||||||
|
def update_process_counts(self):
|
||||||
|
- new_timestamp = time.time()
|
||||||
|
+ new_timestamp = time.monotonic()
|
||||||
|
self.duration = new_timestamp - self.timestamp
|
||||||
|
self.timestamp = new_timestamp
|
||||||
|
|
||||||
|
diff --git a/iotop/ui.py b/iotop/ui.py
|
||||||
|
index 40e9a40..abd6b79 100644
|
||||||
|
--- a/iotop/ui.py
|
||||||
|
+++ b/iotop/ui.py
|
||||||
|
@@ -70,7 +70,7 @@ def format_stats(options, process, duration):
|
||||||
|
if options.accumulated:
|
||||||
|
stats = process.stats_accum
|
||||||
|
display_format = lambda size, duration: format_size(options, size)
|
||||||
|
- duration = time.time() - process.stats_accum_timestamp
|
||||||
|
+ duration = time.monotonic() - process.stats_accum_timestamp
|
||||||
|
else:
|
||||||
|
stats = process.stats_delta
|
||||||
|
display_format = lambda size, duration: format_bandwidth(
|
||||||
|
--
|
||||||
|
1.8.3.1
|
||||||
|
|
||||||
21
iotop.spec
21
iotop.spec
@ -1,6 +1,6 @@
|
|||||||
Name: iotop
|
Name: iotop
|
||||||
Version: 0.6
|
Version: 0.6
|
||||||
Release: 21
|
Release: 22
|
||||||
Summary: Simple top-like I/O monitor
|
Summary: Simple top-like I/O monitor
|
||||||
License: GPLv2+
|
License: GPLv2+
|
||||||
URL: http://guichaz.free.fr/iotop/
|
URL: http://guichaz.free.fr/iotop/
|
||||||
@ -10,11 +10,17 @@ Source0: http://guichaz.free.fr/iotop/files/%{name}-%{version}.tar.bz2
|
|||||||
BuildArch: noarch
|
BuildArch: noarch
|
||||||
BuildRequires: python3-devel git
|
BuildRequires: python3-devel git
|
||||||
|
|
||||||
Patch0: 0000-iotop-0.6-python3.patch
|
Patch1: 0001-Switch-from-python-to-python3.patch
|
||||||
Patch1: 0001-iotop-python3build.patch
|
Patch2: 0002-Fix-build-error-with-Python-3-caused-by-itervalues-i.patch
|
||||||
Patch2: 0002-iotop-0.6-splitline.patch
|
Patch3: 0003-Only-split-proc-status-lines-on-the-character.patch
|
||||||
Patch3: 0003-iotop-0.3.2-ppcprio.patch
|
Patch4: 0004-Ignore-invalid-lines-in-proc-status-files.patch
|
||||||
Patch4: 0004-iotop-0.6-aarch64prio.patch
|
Patch5: 0005-Actually-skip-invalid-lines-in-proc-status.patch
|
||||||
|
Patch6: 0006-replace-powerpc-with-ppc-in-ioprio.py.patch
|
||||||
|
Patch7: 0007-add-aarch64-prio-in-ioprio.py.patch
|
||||||
|
Patch8: 0008-Print-the-titles-at-specific-locations.patch
|
||||||
|
Patch9: 0009-Improve-the-message-that-is-printed-when-Linux-tasks.patch
|
||||||
|
Patch10: 0010-Fix-crash-due-to-syntax-error.patch
|
||||||
|
Patch11: 0011-Use-monotonic-time-to-calculate-durations.patch
|
||||||
|
|
||||||
%description
|
%description
|
||||||
iotop watches I/O usage information output by the Linux kernel (requires 2.6.20 or later) and
|
iotop watches I/O usage information output by the Linux kernel (requires 2.6.20 or later) and
|
||||||
@ -52,6 +58,9 @@ This contains man files for the using of iotop
|
|||||||
%{_mandir}/man8/iotop.*
|
%{_mandir}/man8/iotop.*
|
||||||
|
|
||||||
%changelog
|
%changelog
|
||||||
|
* Sun Jul 12 2020 Zhiqiang Liu <liuzhiqiang26@huawei.com> - 0.6-22
|
||||||
|
- backport some bugfix patches
|
||||||
|
|
||||||
* Wed Jul 1 2020 Wu Bo <wubo009@163.com> - 0.6-21
|
* Wed Jul 1 2020 Wu Bo <wubo009@163.com> - 0.6-21
|
||||||
- rebuild package
|
- rebuild package
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user