aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorThomas Renninger <trenn@suse.de>2010-04-30 09:51:01 +0200
committerDominik Brodowski <linux@dominikbrodowski.net>2010-05-03 15:22:43 +0200
commit4d023a7913a52cd94b56876ec35cdc01d5dfcc31 (patch)
tree8522fb1719e4e51c0182e6f53b65968bc173ad2a
parent20ae04f824d968d439c0bf6403e50b9b0d79e505 (diff)
downloadcpufrequtils-4d023a7913a52cd94b56876ec35cdc01d5dfcc31.tar.gz
cpufrequtils aperf: MSR not readable differentiation
Tell the user whether he has to load the msr driver or whether he has to be root to be able to read things. Remove exclamation mark in output. Signed-off-by: Thomas Renninger <trenn@suse.de> Acked-by: Borislav Petkov <borislav.petkov@amd.com> Signed-off-by: Dominik Brodowski <linux@dominikbrodowski.net>
-rw-r--r--utils/aperf.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/utils/aperf.c b/utils/aperf.c
index c5ceb4b..627fb17 100644
--- a/utils/aperf.c
+++ b/utils/aperf.c
@@ -46,6 +46,7 @@
#include <unistd.h>
#include <getopt.h>
#include <sys/time.h>
+#include <sys/types.h>
#include <stdint.h>
#include <errno.h>
#include <fcntl.h>
@@ -396,8 +397,13 @@ int main(int argc, char *argv[])
}
}
+ if (getuid() != 0) {
+ fprintf(stderr, "You must be root\n");
+ return EXIT_FAILURE;
+ }
+
if (!cpu_has_effective_freq()) {
- fprintf(stderr, "CPU doesn't support APERF/MPERF!\n");
+ fprintf(stderr, "CPU doesn't support APERF/MPERF\n");
return EXIT_FAILURE;
}