GetUsernsForNamespace returns a file descriptor that refers to the owning user namespace for the namespace referred to by fd. REF: https://man7.org/linux/man-pages/man2/ioctl_ns.2.html
(fd uintptr)
| 29 | // |
| 30 | // REF: https://man7.org/linux/man-pages/man2/ioctl_ns.2.html |
| 31 | func GetUsernsForNamespace(fd uintptr) (*os.File, error) { |
| 32 | fd, _, errno := unix.Syscall(syscall.SYS_IOCTL, fd, uintptr(unix.NS_GET_USERNS), 0) |
| 33 | if errno != 0 { |
| 34 | return nil, fmt.Errorf("failed to get user namespace fd: %w", errno) |
| 35 | } |
| 36 | |
| 37 | return os.NewFile(fd, fmt.Sprintf("/proc/%d/fd/%d", os.Getpid(), fd)), nil |
| 38 | } |
no outgoing calls
searching dependent graphs…