linux-rt-users.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Raphaël Beamonte" <raphael.beamonte@gmail.com>
To: williams@redhat.com
Cc: linux-rt-users@vger.kernel.org,
	"Raphaël Beamonte" <raphael.beamonte@gmail.com>
Subject: [PATCH 1/3] Rewrite of the get_kthreads method to make it cross-distribution
Date: Tue, 23 Oct 2012 11:45:03 -0400	[thread overview]
Message-ID: <1351007105-7852-2-git-send-email-raphael.beamonte@gmail.com> (raw)
In-Reply-To: <1351007105-7852-1-git-send-email-raphael.beamonte@gmail.com>

Signed-off-by: Raphaël Beamonte <raphael.beamonte@gmail.com>
---
 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@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

  reply	other threads:[~2012-10-23 15:45 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-10-23 15:45 [PATCH 0/3] rteval cross-distribution patch Raphaël Beamonte
2012-10-23 15:45 ` Raphaël Beamonte [this message]
2012-10-23 15:45 ` [PATCH 2/3] Adds getcmdpath method to use which to locate the used commands Raphaël Beamonte
2012-10-23 15:45 ` [PATCH 3/3] Rewrite of the get_services method to make it cross-distribution Raphaël Beamonte
2012-10-23 17:26 ` [PATCH 0/3] rteval cross-distribution patch Clark Williams

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1351007105-7852-2-git-send-email-raphael.beamonte@gmail.com \
    --to=raphael.beamonte@gmail.com \
    --cc=linux-rt-users@vger.kernel.org \
    --cc=williams@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).