MCPcopy Create free account
hub / github.com/NVIDIA/OpenShell / mount_empty_tmpfs

Function mount_empty_tmpfs

crates/openshell-supervisor-process/src/process.rs:404–424  ·  view source on GitHub ↗
(target: &CString)

Source from the content-addressed store, hash-verified

402
403#[cfg(target_os = "linux")]
404fn mount_empty_tmpfs(target: &CString) -> std::io::Result<()> {
405 #[allow(unsafe_code)]
406 let rc = unsafe {
407 let flags: libc::c_ulong =
408 libc::MS_NOSUID | libc::MS_NODEV | libc::MS_NOEXEC | libc::MS_RDONLY;
409 libc::mount(
410 c"tmpfs".as_ptr(),
411 target.as_ptr(),
412 c"tmpfs".as_ptr(),
413 flags,
414 c"mode=0555,size=4k".as_ptr().cast(),
415 )
416 };
417 if rc != 0 {
418 return Err(std::io::Error::other(format!(
419 "failed to hide supervisor identity mount from child process: {}",
420 std::io::Error::last_os_error()
421 )));
422 }
423 Ok(())
424}
425
426/// Handle to a running process.
427pub struct ProcessHandle {

Calls

no outgoing calls

Tested by

no test coverage detected