From 565f66981b31f3f82d0c08a08b6f316de34d03fa Mon Sep 17 00:00:00 2001 From: Raphaël Beamonte Date: Tue, 23 Oct 2012 11:45:03 -0400 Subject: Rewrite of the get_kthreads method to make it cross-distribution MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Raphaël Beamonte --- rteval/rteval.py | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/rteval/rteval.py b/rteval/rteval.py index 5ecc20f..a432233 100644 --- a/rteval/rteval.py +++ b/rteval/rteval.py @@ -248,16 +248,15 @@ class RtEval(object): def get_kthreads(self): policies = {'FF':'fifo', 'RR':'rrobin', 'TS':'other', '?':'unknown' } ret_kthreads = {} - if not os.path.exists('/etc/rc.d/init.d/rtctl'): - return ret_kthreads self.debug("getting kthread status") - cmd = '/sbin/service rtctl status' + cmd = '/bin/ps -eocommand,pid,policy,rtprio,comm' self.debug("cmd: %s" % cmd) c = subprocess.Popen(cmd, shell=True, stdout=subprocess.PIPE) for p in c.stdout: v = p.strip().split() + kcmd = v.pop(0) try: - if int(v[0]) > 0: + if int(v[0]) > 0 and kcmd.startswith('[') and kcmd.endswith(']'): ret_kthreads[v[0]] = {'policy' : policies[v[1]], 'priority' : v[2], 'name' : v[3] } except ValueError: -- cgit