forked from pool/cpuset
ae928f1f52
- Merge new cpuset upstream. Update URL, and add post v1.5.6 fixes. - New patches: Fix-crash-with-SCHED_IDLE-policy.patch (bnc#959992) Handle-unknown-scheduler-policy-codes-gracefully.patch (bnc#959992) Parse-proc-pid-stat-properly.patch Docu-remove-mention-about-nonexistent-option.patch (bnc#957323) Docu-fix-asciidoc-build-error.patch Update-URLs-after-project-migration.patch Docu-fixed-a-typo.patch Fix-typo-in-setup-py.patch OBS-URL: https://build.opensuse.org/request/show/351159 OBS-URL: https://build.opensuse.org/package/show/hardware/cpuset?expand=0&rev=24
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':
|