]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
tools/power turbostat: Handle cap_get_proc() ENOSYS
authorCalvin Owens <calvin@wbinvd.org>
Sat, 14 Jun 2025 02:20:28 +0000 (19:20 -0700)
committerLen Brown <len.brown@intel.com>
Fri, 8 Aug 2025 20:05:53 +0000 (16:05 -0400)
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>
tools/power/x86/turbostat/turbostat.c

index 778aee48c6e6b5b1d4cac4244a99fd3538fc3ee3..fa81e273d3a2a3907bb0c899f8da2d974802120b 100644 (file)
@@ -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;