diff --git a/netns_linux.go b/netns_linux.go index 1003607..935dfab 100644 --- a/netns_linux.go +++ b/netns_linux.go @@ -7,11 +7,21 @@ import ( "io/ioutil" "os" "path/filepath" + "runtime" "strconv" "strings" "syscall" ) +var SYS_SETNS = map[string]uintptr{ + "386": 346, + "amd64": 308, + "arm64": 268, + "arm": 375, + "ppc64le": 350, + "s390x": 339, +}[runtime.GOARCH] + const ( // Deprecated: use syscall pkg instead (go >= 1.5 needed). CLONE_NEWUTS = 0x04000000 /* New utsname group? */ diff --git a/netns_linux_386.go b/netns_linux_386.go deleted file mode 100644 index 1d769bb..0000000 --- a/netns_linux_386.go +++ /dev/null @@ -1,7 +0,0 @@ -// +build linux,386 - -package netns - -const ( - SYS_SETNS = 346 -) diff --git a/netns_linux_amd64.go b/netns_linux_amd64.go deleted file mode 100644 index b124666..0000000 --- a/netns_linux_amd64.go +++ /dev/null @@ -1,7 +0,0 @@ -// +build linux,amd64 - -package netns - -const ( - SYS_SETNS = 308 -) diff --git a/netns_linux_arm.go b/netns_linux_arm.go deleted file mode 100644 index 9c74eb5..0000000 --- a/netns_linux_arm.go +++ /dev/null @@ -1,7 +0,0 @@ -// +build linux,arm - -package netns - -const ( - SYS_SETNS = 375 -) diff --git a/netns_linux_arm64.go b/netns_linux_arm64.go deleted file mode 100644 index 741a302..0000000 --- a/netns_linux_arm64.go +++ /dev/null @@ -1,7 +0,0 @@ -// +build linux,arm64 - -package netns - -const ( - SYS_SETNS = 268 -) diff --git a/netns_linux_ppc64le.go b/netns_linux_ppc64le.go deleted file mode 100644 index c49eba5..0000000 --- a/netns_linux_ppc64le.go +++ /dev/null @@ -1,7 +0,0 @@ -// +build linux,ppc64le - -package netns - -const ( - SYS_SETNS = 350 -) diff --git a/netns_linux_s390x.go b/netns_linux_s390x.go deleted file mode 100644 index cc13e62..0000000 --- a/netns_linux_s390x.go +++ /dev/null @@ -1,7 +0,0 @@ -// +build linux,s390x - -package netns - -const ( - SYS_SETNS = 339 -)