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

Function capset

src/thread/libcap.rs:170–189  ·  view source on GitHub ↗
(pid: Option<Pid>, sets: CapabilitySets)

Source from the content-addressed store, hash-verified

168
169#[inline]
170fn capset(pid: Option<Pid>, sets: CapabilitySets) -> io::Result<()> {
171 let mut header = linux_raw_sys::general::__user_cap_header_struct {
172 version: linux_raw_sys::general::_LINUX_CAPABILITY_VERSION_3,
173 pid: Pid::as_raw(pid) as backend::c::c_int,
174 };
175 let data = [
176 linux_raw_sys::general::__user_cap_data_struct {
177 effective: sets.effective.bits() as u32,
178 permitted: sets.permitted.bits() as u32,
179 inheritable: sets.inheritable.bits() as u32,
180 },
181 linux_raw_sys::general::__user_cap_data_struct {
182 effective: (sets.effective.bits() >> u32::BITS) as u32,
183 permitted: (sets.permitted.bits() >> u32::BITS) as u32,
184 inheritable: (sets.inheritable.bits() >> u32::BITS) as u32,
185 },
186 ];
187
188 backend::thread::syscalls::capset(&mut header, &data)
189}

Callers 1

set_capabilitiesFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected