MCPcopy Create free account
hub / github.com/bytecodealliance/rustix / remove_capability_from_bounding_set

Function remove_capability_from_bounding_set

src/thread/prctl.rs:489–498  ·  view source on GitHub ↗
(capability: impl CompatCapability)

Source from the content-addressed store, hash-verified

487/// [`prctl(PR_CAPBSET_DROP,…)`]: https://man7.org/linux/man-pages/man2/prctl.2.html
488#[inline]
489pub fn remove_capability_from_bounding_set(capability: impl CompatCapability) -> io::Result<()> {
490 let capset = capability.as_capability_set(private::Token).bits();
491 if capset.count_ones() != 1 {
492 return Err(Errno::INVAL);
493 }
494 let cap = capset.trailing_zeros();
495
496 // as *mut _ should be ptr::without_provenance_mut but our MSRV does not allow it.
497 unsafe { prctl_2args(PR_CAPBSET_DROP, cap as usize as *mut _) }.map(|_r| ())
498}
499
500//
501// PR_GET_SECUREBITS/PR_SET_SECUREBITS

Callers

nothing calls this directly

Calls 2

prctl_2argsFunction · 0.85
as_capability_setMethod · 0.80

Tested by

no test coverage detected