diff options
author | John Kacur <jkacur@redhat.com> | 2009-12-23 16:41:12 +0100 |
---|---|---|
committer | John Kacur <jkacur@redhat.com> | 2009-12-23 16:41:12 +0100 |
commit | 20b8b253f3892ee04d5aae82f83c8e49acc1b75c (patch) | |
tree | 7fcf0353ff7b04499730a1eb2de7ea438eddef40 | |
parent | 3dec3c9e0421f7fd38ecb321faad1eacec740cc0 (diff) | |
download | rt-tests-20b8b253f3892ee04d5aae82f83c8e49acc1b75c.tar.gz |
rt-tests: pip - Use check_privs() from the rt-utils library.
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@redhat.com>
-rw-r--r-- | Makefile | 2 | ||||
-rw-r--r-- | src/include/pip.h | 1 | ||||
-rw-r--r-- | src/pi_tests/pip.c | 3 |
3 files changed, 5 insertions, 1 deletions
@@ -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 */ |