summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCalvin Owens <calvin@wbinvd.org>2025-06-13 19:20:28 -0700
committerLen Brown <len.brown@intel.com>2025-08-08 16:05:53 -0400
commitd34fe509f5f76d9dc36291242d67c6528027ebbd (patch)
tree8f44c323aa12f3bff2806813ea629e980d1a525c
parent6ea0ec1b958a84aff9f03fb0ae4613a4d5bed3ea (diff)
tools/power turbostat: Handle cap_get_proc() ENOSYS
Kernels configured with CONFIG_MULTIUSER=n have no cap_get_proc(). Check for ENOSYS to recognize this case, and continue on to attempt to access the requested MSRs (such as temperature). Signed-off-by: Calvin Owens <calvin@wbinvd.org> Signed-off-by: Len Brown <len.brown@intel.com>
-rw-r--r--tools/power/x86/turbostat/turbostat.c10
1 files changed, 9 insertions, 1 deletions
diff --git a/tools/power/x86/turbostat/turbostat.c b/tools/power/x86/turbostat/turbostat.c
index 778aee48c6e6..fa81e273d3a2 100644
--- a/tools/power/x86/turbostat/turbostat.c
+++ b/tools/power/x86/turbostat/turbostat.c
@@ -6574,8 +6574,16 @@ int check_for_cap_sys_rawio(void)
int ret = 0;
caps = cap_get_proc();
- if (caps == NULL)
+ if (caps == NULL) {
+ /*
+ * CONFIG_MULTIUSER=n kernels have no cap_get_proc()
+ * Allow them to continue and attempt to access MSRs
+ */
+ if (errno == ENOSYS)
+ return 0;
+
return 1;
+ }
if (cap_get_flag(caps, CAP_SYS_RAWIO, CAP_EFFECTIVE, &cap_flag_value)) {
ret = 1;