mirror of
https://github.com/torvalds/linux.git
synced 2025-08-15 22:21:42 +02:00
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>
This commit is contained in:
parent
6ea0ec1b95
commit
d34fe509f5
1 changed files with 9 additions and 1 deletions
|
@ -6574,8 +6574,16 @@ int check_for_cap_sys_rawio(void)
|
||||||
int ret = 0;
|
int ret = 0;
|
||||||
|
|
||||||
caps = cap_get_proc();
|
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;
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
if (cap_get_flag(caps, CAP_SYS_RAWIO, CAP_EFFECTIVE, &cap_flag_value)) {
|
if (cap_get_flag(caps, CAP_SYS_RAWIO, CAP_EFFECTIVE, &cap_flag_value)) {
|
||||||
ret = 1;
|
ret = 1;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue