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>
This commit is contained in:
parent
3dec3c9e04
commit
20b8b253f3
2
Makefile
2
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
|
sendme: sendme.o rt-utils.o rt-get_cpu.o
|
||||||
$(CC) $(CFLAGS) -o $@ $^ $(LIBS) $(EXTRA_LIBS)
|
$(CC) $(CFLAGS) -o $@ $^ $(LIBS) $(EXTRA_LIBS)
|
||||||
|
|
||||||
pip: pip.o error.o
|
pip: pip.o error.o rt-utils.o
|
||||||
$(CC) $(CFLAGS) -o $@ $^ $(LIBS)
|
$(CC) $(CFLAGS) -o $@ $^ $(LIBS)
|
||||||
|
|
||||||
CLEANUP = $(TARGETS) *.o .depend *.*~ *.orig *.rej rt-tests.spec
|
CLEANUP = $(TARGETS) *.o .depend *.*~ *.orig *.rej rt-tests.spec
|
||||||
|
|
|
@ -13,6 +13,7 @@
|
||||||
#include <sys/wait.h>
|
#include <sys/wait.h>
|
||||||
#include <signal.h>
|
#include <signal.h>
|
||||||
#include <sched.h>
|
#include <sched.h>
|
||||||
|
#include <rt-utils.h>
|
||||||
#include "error.h"
|
#include "error.h"
|
||||||
|
|
||||||
void low(pid_t pid); /* low priority process */
|
void low(pid_t pid); /* low priority process */
|
||||||
|
|
|
@ -83,6 +83,9 @@ int main(void)
|
||||||
|
|
||||||
*minimum_priority = sched_get_priority_min(policy);
|
*minimum_priority = sched_get_priority_min(policy);
|
||||||
|
|
||||||
|
if (check_privs())
|
||||||
|
exit(-1);
|
||||||
|
|
||||||
mptr = mmap_page(); /* Get a page of shared memory */
|
mptr = mmap_page(); /* Get a page of shared memory */
|
||||||
resource = (pthread_mutex_t*)mptr; /* point our lock to it */
|
resource = (pthread_mutex_t*)mptr; /* point our lock to it */
|
||||||
mptr += sizeof(pthread_mutex_t); /* advance the memory pointer */
|
mptr += sizeof(pthread_mutex_t); /* advance the memory pointer */
|
||||||
|
|
Loading…
Reference in New Issue