Add Build Flags

This commit adds build flags for the various architectures to prevent
failures when cross compiling. It also fixes errors in
netns_unspecified.go by replacing the undefined type Namespace with
NsHandle

Signed-off-by: Dave Tucker <dt@docker.com>
This commit is contained in:
Dave Tucker 2015-05-20 19:19:57 +01:00
parent 008d17ae00
commit 16c2d46118
6 changed files with 15 additions and 6 deletions

View File

@ -12,6 +12,7 @@ import (
"fmt"
"syscall"
)
// NsHandle is a handle to a network namespace. It can be cast directly
// to an int and used as a file descriptor.
type NsHandle int

View File

@ -1,3 +1,5 @@
// +build linux
package netns
import (

View File

@ -1,3 +1,5 @@
// +build linux,386
package netns
const (

View File

@ -1,3 +1,5 @@
// +build linux,amd64
package netns
const (

View File

@ -1,3 +1,5 @@
// +build linux,arm
package netns
const (

View File

@ -10,26 +10,26 @@ var (
ErrNotImplemented = errors.New("not implemented")
)
func Set(ns Namespace) (err error) {
func Set(ns NsHandle) (err error) {
return ErrNotImplemented
}
func New() (ns Namespace, err error) {
func New() (ns NsHandle, err error) {
return -1, ErrNotImplemented
}
func Get() (Namespace, error) {
func Get() (NsHandle, error) {
return -1, ErrNotImplemented
}
func GetFromName(name string) (Namespace, error) {
func GetFromName(name string) (NsHandle, error) {
return -1, ErrNotImplemented
}
func GetFromPid(pid int) (Namespace, error) {
func GetFromPid(pid int) (NsHandle, error) {
return -1, ErrNotImplemented
}
func GetFromDocker(id string) (Namespace, error) {
func GetFromDocker(id string) (NsHandle, error) {
return -1, ErrNotImplemented
}