pkg/ns, pkg/types: refactored non linux build fix code to

Make GetCurrentNS platform specific instead of getCurrentThreadNetNSPath
This commit is contained in:
Aithal
2017-02-23 09:50:48 -08:00
parent dff808c98e
commit 46deb7b708
4 changed files with 19 additions and 16 deletions

View File

@ -25,6 +25,11 @@ import (
"golang.org/x/sys/unix"
)
// Returns an object representing the current OS thread's network namespace
func GetCurrentNS() (NetNS, error) {
return GetNS(getCurrentThreadNetNSPath())
}
func getCurrentThreadNetNSPath() string {
// /proc/self/ns/net returns the namespace of the main thread, not
// of whatever thread this goroutine is running on. Make sure we