[PATCH 4/5] rt-tests: pip - Use check_privs() from the rt-utils library.

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

 



Use check_privs() from the rt-utils library to make sure that the user is
running with real-time privileges for the pip test program.

Signed-off-by: John Kacur <jkacur@xxxxxxxxxx>
---
 Makefile           |    2 +-
 src/include/pip.h  |    1 +
 src/pi_tests/pip.c |    3 +++
 3 files changed, 5 insertions(+), 1 deletions(-)

diff --git a/Makefile b/Makefile
index b30a139..3339556 100644
--- a/Makefile
+++ b/Makefile
@@ -63,7 +63,7 @@ svsematest: svsematest.o rt-utils.o rt-get_cpu.o
 sendme: sendme.o rt-utils.o rt-get_cpu.o
 	$(CC) $(CFLAGS) -o $@ $^ $(LIBS) $(EXTRA_LIBS)
 
-pip: pip.o error.o
+pip: pip.o error.o rt-utils.o
 	$(CC) $(CFLAGS) -o $@ $^ $(LIBS)
 
 CLEANUP  = $(TARGETS) *.o .depend *.*~ *.orig *.rej rt-tests.spec
diff --git a/src/include/pip.h b/src/include/pip.h
index 01a31c3..b2068be 100644
--- a/src/include/pip.h
+++ b/src/include/pip.h
@@ -13,6 +13,7 @@
 #include <sys/wait.h>
 #include <signal.h>
 #include <sched.h>
+#include <rt-utils.h>
 #include "error.h"
 
 void low(pid_t pid);	/* low priority process */
diff --git a/src/pi_tests/pip.c b/src/pi_tests/pip.c
index ce3f5d9..085908b 100644
--- a/src/pi_tests/pip.c
+++ b/src/pi_tests/pip.c
@@ -83,6 +83,9 @@ int main(void)
 
 	*minimum_priority = sched_get_priority_min(policy);
 
+	if (check_privs())
+		exit(-1);
+
 	mptr = mmap_page();	/* Get a page of shared memory */
 	resource = (pthread_mutex_t*)mptr;	/* point our lock to it */
 	mptr += sizeof(pthread_mutex_t);	/* advance the memory pointer */
-- 
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