linux-rt-users.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: John Kacur <jkacur@redhat.com>
To: Clark Williams <williams@redhat.com>,
	Carsten Emde <carsten.emde@osadl.org>
Cc: Carsten Emde <carsten.emde@osadl.org>,
	linux-rt-users@vger.kernel.org,
	Thomas Gleixner <tglx@linutronix.de>,
	John Kacur <jkacur@redhat.com>
Subject: [PATCH 3/7] Make use of the new library functions in signaltest.
Date: Mon, 14 Dec 2009 16:58:52 +0100	[thread overview]
Message-ID: <1260806336-4691-4-git-send-email-jkacur@redhat.com> (raw)
In-Reply-To: <1260806336-4691-3-git-send-email-jkacur@redhat.com>

From: Carsten Emde <carsten.emde@osadl.org>

Signed-off-by: Carsten Emde <carsten.emde@osadl.org>
Signed-off-by: John Kacur <jkacur@redhat.com>
---
 Makefile                    |    2 +-
 src/signaltest/signaltest.c |   27 ++-------------------------
 2 files changed, 3 insertions(+), 26 deletions(-)

diff --git a/Makefile b/Makefile
index 2bb0009..2507a1f 100644
--- a/Makefile
+++ b/Makefile
@@ -23,7 +23,7 @@ all: $(TARGETS)
 cyclictest: src/cyclictest/cyclictest.c $(UTILS)
 	$(CC) $(CFLAGS) -D VERSION_STRING=$(VERSION_STRING) $^ -o $@ $(LIBS)
 
-signaltest: src/signaltest/signaltest.c
+signaltest: src/signaltest/signaltest.c $(UTILS)
 	$(CC) $(CFLAGS) -D VERSION_STRING=$(VERSION_STRING) $^ -o $@ $(LIBS)
 
 classic_pi: src/pi_tests/classic_pi.c
diff --git a/src/signaltest/signaltest.c b/src/signaltest/signaltest.c
index b637aae..e6016c9 100644
--- a/src/signaltest/signaltest.c
+++ b/src/signaltest/signaltest.c
@@ -27,6 +27,8 @@
 #include <sys/time.h>
 #include <sys/mman.h>
 
+#include "rt-utils.h"
+
 #define ARRAY_SIZE(x) (sizeof(x) / sizeof((x)[0]))
 
 /* Ugly, but .... */
@@ -306,31 +308,6 @@ static void print_stat(struct thread_param *par, int index, int verbose)
 	}
 }
 
-static int
-check_privs(void)
-{
-	int policy = sched_getscheduler(0);
-	struct sched_param param;
-
-	/* if we're already running a realtime scheduler
-	 * then we *should* be able to change things later
-	 */
-	if (policy == SCHED_FIFO || policy == SCHED_RR)
-		return 0;
-
-	/* try to change to SCHED_FIFO */
-	param.sched_priority = 1;
-	if (sched_setscheduler(0, SCHED_FIFO, &param)) {
-		fprintf(stderr, "Unable to change scheduling policy!\n");
-		fprintf(stderr, "either run as root or join realtime group\n");
-		return 1;
-	}
-
-	/* we're good; change back and return success */
-	sched_setscheduler(0, policy, NULL);
-	return 0;
-}

  reply	other threads:[~2009-12-14 15:59 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-12-14 15:58 [PATCH 0/7] *** SUBJECT HERE *** John Kacur
2009-12-14 15:58 ` [PATCH 1/7] Start a separate library of functions for the rt-test suite. The first couple are taken from cyclictest John Kacur
2009-12-14 15:58   ` [PATCH 2/7] Make use of the library functions in cyclic test John Kacur
2009-12-14 15:58     ` John Kacur [this message]
2009-12-14 15:58       ` [PATCH 4/7] Add the following new tests - ptsematest - sigwaittest - svsematest - sendme John Kacur
2009-12-14 15:58         ` [PATCH 5/7] Use sched_getcpu - sched_getcpu is available since glibc 2.6 - the current tests were broken in anycase John Kacur
2009-12-14 15:58           ` [PATCH 6/7] Add the new tests to .gitignore John Kacur
2009-12-14 15:58             ` [PATCH 7/7] The version of check_privs that got added to the library must have come from signaltest - because it doesn't have the fix that check_privs in cyclictest has - to return the sched_priority to 0 John Kacur
2009-12-15  1:23         ` [PATCH 4/7] Add the following new tests - ptsematest - sigwaittest - svsematest - sendme Carsten Emde
2009-12-15 14:41           ` Clark Williams
2009-12-15 14:46           ` John Kacur

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=1260806336-4691-4-git-send-email-jkacur@redhat.com \
    --to=jkacur@redhat.com \
    --cc=carsten.emde@osadl.org \
    --cc=linux-rt-users@vger.kernel.org \
    --cc=tglx@linutronix.de \
    --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).