[PATCH 1/3] Rewrite of the get_kthreads method to make it cross-distribution

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Signed-off-by: Raphaël Beamonte <raphael.beamonte@xxxxxxxxx>
---
 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:
-- 
1.7.10.4

--
To unsubscribe from this list: send the line "unsubscribe linux-rt-users" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [RT Stable]     [Kernel Newbies]     [IDE]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux ATA RAID]     [Samba]     [Video 4 Linux]     [Device Mapper]

  Powered by Linux