forked from pool/cpuset
28 lines
1000 B
Diff
28 lines
1000 B
Diff
|
From 0dab14e927137f4cb8d311b6cbae77343fa95ee0 Mon Sep 17 00:00:00 2001
|
||
|
From: Libor Pechacek <lpechacek@suse.com>
|
||
|
Date: Tue, 22 Dec 2015 12:50:55 +0100
|
||
|
Subject: [PATCH] Handle unknown scheduler policy codes gracefully
|
||
|
References: bnc#959992
|
||
|
|
||
|
Prevent unhandled exception upon reading unknown scheduler policy code from
|
||
|
/proc/<pid>/stat.
|
||
|
|
||
|
Signed-off-by: Libor Pechacek <lpechacek@suse.com>
|
||
|
Signed-off-by: Mike Galbraith <mgalbraith@suse.de>
|
||
|
---
|
||
|
cpuset/commands/proc.py | 3 ++-
|
||
|
1 file changed, 2 insertions(+), 1 deletion(-)
|
||
|
|
||
|
--- a/cpuset/commands/proc.py
|
||
|
+++ b/cpuset/commands/proc.py
|
||
|
@@ -727,7 +727,8 @@ options = [make_option('-l', '--list',
|
||
|
|
||
|
out2 = []
|
||
|
out2.append(stdict['State'].split()[0])
|
||
|
- out2.append(policy[int(stat[statdef['rtpolicy']])])
|
||
|
+ policy_code=int(stat[statdef['rtpolicy']])
|
||
|
+ out2.append(policy[policy_code] if policy_code<len(policy) else '?')
|
||
|
if stat[statdef['rtpolicy']] == '0':
|
||
|
out2.append('th')
|
||
|
elif stat[statdef['rtpolicy']] == '3':
|