mirror of https://github.com/vishvananda/netns
commit
f0b8d0aad3
2
netns.go
2
netns.go
|
@ -61,7 +61,7 @@ func (ns *NsHandle) Close() error {
|
|||
return nil
|
||||
}
|
||||
|
||||
// Get an empty (closed) NsHandle
|
||||
// None gets an empty (closed) NsHandle.
|
||||
func None() NsHandle {
|
||||
return NsHandle(-1)
|
||||
}
|
||||
|
|
|
@ -7,14 +7,24 @@ import (
|
|||
"io/ioutil"
|
||||
"os"
|
||||
"path/filepath"
|
||||
"runtime"
|
||||
"strconv"
|
||||
"strings"
|
||||
"syscall"
|
||||
)
|
||||
|
||||
// SYS_SETNS syscall allows changing the namespace of the current process.
|
||||
var SYS_SETNS = map[string]uintptr{
|
||||
"386": 346,
|
||||
"amd64": 308,
|
||||
"arm64": 268,
|
||||
"arm": 375,
|
||||
"ppc64le": 350,
|
||||
"s390x": 339,
|
||||
}[runtime.GOARCH]
|
||||
|
||||
// Deprecated: use syscall pkg instead (go >= 1.5 needed).
|
||||
const (
|
||||
// These constants belong in the syscall library but have not been
|
||||
// added yet.
|
||||
CLONE_NEWUTS = 0x04000000 /* New utsname group? */
|
||||
CLONE_NEWIPC = 0x08000000 /* New ipcs */
|
||||
CLONE_NEWUSER = 0x10000000 /* New user namespace */
|
||||
|
|
|
@ -1,7 +0,0 @@
|
|||
// +build linux,386
|
||||
|
||||
package netns
|
||||
|
||||
const (
|
||||
SYS_SETNS = 346
|
||||
)
|
|
@ -1,7 +0,0 @@
|
|||
// +build linux,amd64
|
||||
|
||||
package netns
|
||||
|
||||
const (
|
||||
SYS_SETNS = 308
|
||||
)
|
|
@ -1,7 +0,0 @@
|
|||
// +build linux,arm
|
||||
|
||||
package netns
|
||||
|
||||
const (
|
||||
SYS_SETNS = 375
|
||||
)
|
|
@ -1,7 +0,0 @@
|
|||
// +build linux,arm64
|
||||
|
||||
package netns
|
||||
|
||||
const (
|
||||
SYS_SETNS = 268
|
||||
)
|
|
@ -1,7 +0,0 @@
|
|||
// +build linux,ppc64le
|
||||
|
||||
package netns
|
||||
|
||||
const (
|
||||
SYS_SETNS = 350
|
||||
)
|
|
@ -1,7 +0,0 @@
|
|||
// +build linux,s390x
|
||||
|
||||
package netns
|
||||
|
||||
const (
|
||||
SYS_SETNS = 339
|
||||
)
|
Loading…
Reference in New Issue