From: John Kacur <jkacur@redhat.com>
To: Clark Williams <williams@redhat.com>,
Carsten Emde <carsten.emde@osadl.org>
Cc: John Kacur <jkacur@redhat.com>,
rt-users <linux-rt-users@vger.kernel.org>,
Thomas Gleixner <tglx@linutronix.de>
Subject: [PATCH 4/5] rt-tests: pip - Use check_privs() from the rt-utils library.
Date: Wed, 23 Dec 2009 17:02:59 +0100 [thread overview]
Message-ID: <1261584180-13922-5-git-send-email-jkacur@redhat.com> (raw)
In-Reply-To: <1261584180-13922-4-git-send-email-jkacur@redhat.com>
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>
---
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
next prev parent reply other threads:[~2009-12-23 16:03 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-12-23 16:02 [PATCH 0/5] *** Add new priority inversion test, plus lib changes *** John Kacur
2009-12-23 16:02 ` [PATCH 1/5] rt-tests: Add error routines to the library John Kacur
2009-12-23 16:02 ` [PATCH 2/5] rt-tests: Add a new test pip - priority inheritance with processes John Kacur
2009-12-23 16:02 ` [PATCH 3/5] rt-tests: Move header files from src/lib to src/include John Kacur
2009-12-23 16:02 ` John Kacur [this message]
2009-12-23 16:03 ` [PATCH 5/5] rt-tests: Add a "make tags" option John Kacur
2009-12-23 22:52 ` [PATCH 2/5] rt-tests: Add a new test pip - priority inheritance with processes Carsten Emde
2009-12-23 23:25 ` 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=1261584180-13922-5-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).