Skip to content

Commit d34fe50

Browse files
jcalvinowenslenb
authored andcommitted
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 <[email protected]> Signed-off-by: Len Brown <[email protected]>
1 parent 6ea0ec1 commit d34fe50

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

tools/power/x86/turbostat/turbostat.c

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6574,8 +6574,16 @@ int check_for_cap_sys_rawio(void)
65746574
int ret = 0;
65756575

65766576
caps = cap_get_proc();
6577-
if (caps == NULL)
6577+
if (caps == NULL) {
6578+
/*
6579+
* CONFIG_MULTIUSER=n kernels have no cap_get_proc()
6580+
* Allow them to continue and attempt to access MSRs
6581+
*/
6582+
if (errno == ENOSYS)
6583+
return 0;
6584+
65786585
return 1;
6586+
}
65796587

65806588
if (cap_get_flag(caps, CAP_SYS_RAWIO, CAP_EFFECTIVE, &cap_flag_value)) {
65816589
ret = 1;

0 commit comments

Comments
 (0)