mirror of
https://github.com/moby/moby.git
synced 2022-11-09 12:21:53 -05:00
Merge pull request #335 from glevand/for-merge-netns
netns: Update to latest for arm64
This commit is contained in:
commit
f621be2b30
3 changed files with 20 additions and 16 deletions
2
libnetwork/Godeps/Godeps.json
generated
2
libnetwork/Godeps/Godeps.json
generated
|
@ -131,7 +131,7 @@
|
|||
},
|
||||
{
|
||||
"ImportPath": "github.com/vishvananda/netns",
|
||||
"Rev": "5478c060110032f972e86a1f844fdb9a2f008f2c"
|
||||
"Rev": "b7a04d6db3dce92b370e6d5b6ab9e2361a3c53e1"
|
||||
}
|
||||
]
|
||||
}
|
||||
|
|
27
libnetwork/Godeps/_workspace/src/github.com/vishvananda/netns/netns_linux.go
generated
vendored
27
libnetwork/Godeps/_workspace/src/github.com/vishvananda/netns/netns_linux.go
generated
vendored
|
@ -52,33 +52,30 @@ func Get() (NsHandle, error) {
|
|||
return GetFromThread(os.Getpid(), syscall.Gettid())
|
||||
}
|
||||
|
||||
// GetFromName gets a handle to a named network namespace such as one
|
||||
// created by `ip netns add`.
|
||||
func GetFromName(name string) (NsHandle, error) {
|
||||
fd, err := syscall.Open(fmt.Sprintf("/var/run/netns/%s", name), syscall.O_RDONLY, 0)
|
||||
// GetFromPath gets a handle to a network namespace
|
||||
// identified by the path
|
||||
func GetFromPath(path string) (NsHandle, error) {
|
||||
fd, err := syscall.Open(path, syscall.O_RDONLY, 0)
|
||||
if err != nil {
|
||||
return -1, err
|
||||
}
|
||||
return NsHandle(fd), nil
|
||||
}
|
||||
|
||||
// GetFromName gets a handle to a named network namespace such as one
|
||||
// created by `ip netns add`.
|
||||
func GetFromName(name string) (NsHandle, error) {
|
||||
return GetFromPath(fmt.Sprintf("/var/run/netns/%s", name))
|
||||
}
|
||||
|
||||
// GetFromPid gets a handle to the network namespace of a given pid.
|
||||
func GetFromPid(pid int) (NsHandle, error) {
|
||||
fd, err := syscall.Open(fmt.Sprintf("/proc/%d/ns/net", pid), syscall.O_RDONLY, 0)
|
||||
if err != nil {
|
||||
return -1, err
|
||||
}
|
||||
return NsHandle(fd), nil
|
||||
return GetFromPath(fmt.Sprintf("/proc/%d/ns/net", pid))
|
||||
}
|
||||
|
||||
// GetFromThread gets a handle to the network namespace of a given pid and tid.
|
||||
func GetFromThread(pid, tid int) (NsHandle, error) {
|
||||
name := fmt.Sprintf("/proc/%d/task/%d/ns/net", pid, tid)
|
||||
fd, err := syscall.Open(name, syscall.O_RDONLY, 0)
|
||||
if err != nil {
|
||||
return -1, err
|
||||
}
|
||||
return NsHandle(fd), nil
|
||||
return GetFromPath(fmt.Sprintf("/proc/%d/task/%d/ns/net", pid, tid))
|
||||
}
|
||||
|
||||
// GetFromDocker gets a handle to the network namespace of a docker container.
|
||||
|
|
7
libnetwork/Godeps/_workspace/src/github.com/vishvananda/netns/netns_linux_arm64.go
generated
vendored
Normal file
7
libnetwork/Godeps/_workspace/src/github.com/vishvananda/netns/netns_linux_arm64.go
generated
vendored
Normal file
|
@ -0,0 +1,7 @@
|
|||
// +build linux,arm64
|
||||
|
||||
package netns
|
||||
|
||||
const (
|
||||
SYS_SETNS = 268
|
||||
)
|
Loading…
Reference in a new issue