[PATCH 3/7] Make use of the new library functions in signaltest.

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

 



From: Carsten Emde <carsten.emde@xxxxxxxxx>

Signed-off-by: Carsten Emde <carsten.emde@xxxxxxxxx>
Signed-off-by: John Kacur <jkacur@xxxxxxxxxx>
---
 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;
-}
-
 int main(int argc, char **argv)
 {
 	sigset_t sigset;
-- 
1.6.5.2

--
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