(
capability: impl CompatCapability,
enable: bool,
)
| 737 | /// [`prctl(PR_CAP_AMBIENT,…)`]: https://man7.org/linux/man-pages/man2/prctl.2.html |
| 738 | #[inline] |
| 739 | pub fn configure_capability_in_ambient_set( |
| 740 | capability: impl CompatCapability, |
| 741 | enable: bool, |
| 742 | ) -> io::Result<()> { |
| 743 | let sub_operation = if enable { |
| 744 | PR_CAP_AMBIENT_RAISE |
| 745 | } else { |
| 746 | PR_CAP_AMBIENT_LOWER |
| 747 | }; |
| 748 | let capset = capability.as_capability_set(private::Token).bits(); |
| 749 | if capset.count_ones() != 1 { |
| 750 | return Err(Errno::INVAL); |
| 751 | } |
| 752 | let cap = capset.trailing_zeros(); |
| 753 | |
| 754 | unsafe { |
| 755 | prctl_3args( |
| 756 | PR_CAP_AMBIENT, |
| 757 | sub_operation as *mut _, |
| 758 | // as *mut _ should be ptr::without_provenance_mut but our MSRV does not allow it. |
| 759 | cap as usize as *mut _, |
| 760 | ) |
| 761 | } |
| 762 | .map(|_r| ()) |
| 763 | } |
| 764 | |
| 765 | // |
| 766 | // PR_SVE_GET_VL/PR_SVE_SET_VL |
nothing calls this directly
no test coverage detected