Skip to content

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

salaast added 2 commits August 5, 2022 15:27
…perf support based on file capabilities and linux version

Signed-off-by: Abena Laast <[email protected]>
…cluding checking the capabilities based on the linux version

Signed-off-by: Abena Laast <[email protected]>
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.

2 participants