Skip to main content

current_mount_namespace

Function current_mount_namespace 

Source
pub fn current_mount_namespace() -> Result<MountNamespaceIdentity, Error>
Expand description

The calling thread’s mount namespace (DetConfig::mountinfo_mount_namespace): the kernel’s namespace ID from ioctl(NS_GET_MNTNS_ID) on /proc/thread-self/ns/mnt, and the descriptor’s device and inode numbers. The calling thread’s, not the thread group leader’s: a library caller’s thread can have a mount namespace of its own, and every capture here (/proc/thread-self/mountinfo and fdinfo) reads that same thread’s. A kernel without the ioctl (ENOTTY or EINVAL) yields no ID; any other failure is an error.