From 635b5838e95ed85767434207e463173fd91b6040 Mon Sep 17 00:00:00 2001 From: Guillaume Chazarain Date: Sat, 15 Oct 2011 18:39:32 +0200 Subject: [PATCH] Explain that iotop now requires root. https://lkml.org/lkml/2011/10/1/170 http://git.kernel.org/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commitdiff;h=1a51410abe7d0ee4b1d112780f46df87d3621043 --- iotop/ui.py | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/iotop/ui.py b/iotop/ui.py index ef2b3a6..e8da128 100644 --- a/iotop/ui.py +++ b/iotop/ui.py @@ -458,10 +458,19 @@ def run_iotop_window(win, options): ui.run() def run_iotop(options): - if options.batch: - return run_iotop_window(None, options) - else: - return curses.wrapper(run_iotop_window, options) + try: + if options.batch: + return run_iotop_window(None, options) + else: + return curses.wrapper(run_iotop_window, options) + except OSError, e: + if e.errno == errno.EPERM: + print >> sys.stderr, e + print >> sys.stderr, ('iotop requires root or the NET_ADMIN ' + 'capability.') + sys.exit(1) + else: + raise # # Profiling -- 2.11.4.GIT