Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Perf capability check #254

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

salaast
Copy link

@salaast salaast commented Aug 5, 2022

Use capability parser to parse the output of getcap command on the perf file path; determine permission to trace kernel based on the linux version and the existence of cap_sys_admin/cap_perfmon in effective capabilities

…perf support based on file capabilities and linux version

Signed-off-by: Abena Laast <salaast@gmail.com>
…cluding checking the capabilities based on the linux version

Signed-off-by: Abena Laast <salaast@gmail.com>
if contains_cap t cap_string then has_eff t cap_string else true
;;

let check_perf_support getcap linux_version =
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this function should probably live in perf_capabilities.ml, within supports_tracing_kernel.

else Capability.empty
;;

let has_eff t cap_string = get_cap_sets t cap_string |> Capability.effective
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
let has_eff t cap_string = get_cap_sets t cap_string |> Capability.effective
let has_effective t cap_string = get_cap_sets t cap_string |> Capability.effective

Nit: avoid shortened function/variable names for readability.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants