summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: aa6e321)
raw | patch | inline | side by side (parent: aa6e321)
author | Vincent Brillault <git@lerya.net> | |
Wed, 11 Feb 2015 22:00:05 +0000 (23:00 +0100) | ||
committer | Vincent Brillault <git@lerya.net> | |
Sat, 28 Feb 2015 06:35:42 +0000 (07:35 +0100) |
Calling 'stat' on /dev/cpu/0/msr does not need any specific permission
and needs to be checked before probe_cpu.
and needs to be checked before probe_cpu.
src/turbostat.c | patch | blob | history |
diff --git a/src/turbostat.c b/src/turbostat.c
index 2d124fdc972df969b30ca5c313e6f3f102c7e572..34c11b889f619450c73e8ac97cca96743eec3256 100644 (file)
--- a/src/turbostat.c
+++ b/src/turbostat.c
struct stat sb;
int ret;
+ if (stat("/dev/cpu/0/msr", &sb)) {
+ ERROR("Turbostat plugin: Initialization failed: /dev/cpu/0/msr"
+ " does not exist while the CPU supports MSR. You may be "
+ "missing the corresponding kernel module, please try '# "
+ "modprobe msr'");
+ return -1;
+ }
+
if (getuid() != 0) {
ERROR("Turbostat plugin: Initialization failed: this plugin "
"requires collectd to run as root in order to read "
DO_OR_GOTO_ERR(probe_cpu());
- if (stat("/dev/cpu/0/msr", &sb)) {
- ERROR("Turbostat plugin: Initialization failed: /dev/cpu/0/msr"
- " does not exist while the CPU supports MSR. You may be "
- "missing the corresponding kernel module, please try '# "
- "modprobe msr'");
- return -1;
- }
-
DO_OR_GOTO_ERR(setup_all_buffers());
plugin_register_read(PLUGIN_NAME, turbostat_read);