MCPcopy Create free account
hub / github.com/CodSpeedHQ/codspeed / ensure_privileges

Method ensure_privileges

src/executor/memory/executor.rs:79–94  ·  view source on GitHub ↗

Ensure memtrack can load its eBPF programs: either run as root or hold the required file capabilities. Tries a one-time capability grant if neither holds, and bails if that fails.

()

Source from the content-addressed store, hash-verified

77 /// required file capabilities. Tries a one-time capability grant if neither
78 /// holds, and bails if that fails.
79 fn ensure_privileges() -> Result<()> {
80 if is_root_user() || has_memtrack_capabilities() {
81 return Ok(());
82 }
83
84 ensure_memtrack_capabilities()?;
85
86 if has_memtrack_capabilities() {
87 return Ok(());
88 }
89
90 bail!(
91 "{MEMTRACK_COMMAND} needs elevated privileges to load its eBPF programs, but the \
92 required capabilities could not be granted."
93 );
94 }
95}
96
97#[async_trait(?Send)]

Callers

nothing calls this directly

Calls 3

is_root_userFunction · 0.85

Tested by

no test coverage detected