test code:
```
package main

import (
"fmt"
"os"
"runtime"

"golang.org/x/sys/unix"
)

func main() {
targetPid := "2356795"

runtime.LockOSThread()
defer runtime.UnlockOSThread()

userNsPath := fmt.Sprintf("/proc/%s/ns/user", targetPid)
fd, err := os.Open(userNsPath)
if err != nil {
fmt.Printf("Failed to open user namespace: %v\n", err)
return
}
defer fd.Close()

if err := unix.Setns(int(fd.Fd()), unix.CLONE_NEWUSER); err != nil {
fmt.Printf("Failed to setns: %v\n", err)
return
}

fmt.Println("Successfully entered user namespace")

ns, err := os.Readlink("/proc/self/ns/user")
if err != nil {
fmt.Printf("Failed to read /proc/self/ns/user: %v\n", err)
return
}
fmt.Println("Current /proc/self/ns/user:", ns)
}
```
run error:
Failed to setns: invalid argument

what's wrong with me?

thanks in advantage

-- 
You received this message because you are subscribed to the Google Groups 
"golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion visit 
https://groups.google.com/d/msgid/golang-nuts/0f8cea1f-8d2f-4cd4-b522-b16b1eb04530n%40googlegroups.com.

Reply via email to