diff --git a/netns_linux.go b/netns_linux.go index 8c9b177..a18b89b 100644 --- a/netns_linux.go +++ b/netns_linux.go @@ -122,6 +122,18 @@ func GetFromThread(pid, tid int) (NsHandle, error) { return GetFromPath(fmt.Sprintf("/proc/%d/task/%d/ns/net", pid, tid)) } +// GetFromPidWithAltProcfs gets a handle to the network namespace of a given +// pid using the specified procfs path. +func GetFromPidWithAltProcfs(pid int, procfs string) (NsHandle, error) { + return GetFromPath(fmt.Sprintf("%s/%d/ns/net", procfs, pid)) +} + +// GetFromThreadWithAltProcfs gets a handle to the network namespace of a given +// pid and tid using the specified procfs path. +func GetFromThreadWithAltProcfs(pid, tid int, procfs string) (NsHandle, error) { + return GetFromPath(fmt.Sprintf("%s/%d/task/%d/ns/net", procfs, pid, tid)) +} + // GetFromDocker gets a handle to the network namespace of a docker container. // Id is prefixed matched against the running docker containers, so a short // identifier can be used as long as it isn't ambiguous. diff --git a/netns_others.go b/netns_others.go index f444f6e..00c205e 100644 --- a/netns_others.go +++ b/netns_others.go @@ -51,6 +51,14 @@ func GetFromThread(pid int, tid int) (NsHandle, error) { return -1, ErrNotImplemented } +func GetFromPidWithAltProcfs(pid int, procfs string) (NsHandle, error) { + return -1, ErrNotImplemented +} + +func GetFromThreadWithAltProcfs(pid, tid int, procfs string) (NsHandle, error) { + return -1, ErrNotImplemented +} + func GetFromDocker(id string) (NsHandle, error) { return -1, ErrNotImplemented }