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>

authored by Calvin Owens and committed by Len Brown d34fe509 6ea0ec1b

+9 -1
+9 -1
tools/power/x86/turbostat/turbostat.c
··· 6574 6574 int ret = 0; 6575 6575 6576 6576 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 + 6578 6585 return 1; 6586 + } 6579 6587 6580 6588 if (cap_get_flag(caps, CAP_SYS_RAWIO, CAP_EFFECTIVE, &cap_flag_value)) { 6581 6589 ret = 1;