Fix cross compile for make cross

Docker-DCO-1.1-Signed-off-by: Michael Crosby <michael@crosbymichael.com> (github: crosbymichael)
This commit is contained in:
Michael Crosby 2014-02-25 15:19:13 -08:00
parent 2acaf7ca82
commit f85823b53d
11 changed files with 107 additions and 52 deletions

View file

@ -136,3 +136,10 @@ func Mkfifo(name string, mode uint32) error {
func Umask(mask int) int {
return syscall.Umask(mask)
}
func SetCloneFlags(cmd *exec.Cmd, flag uintptr) {
if cmd.SysProcAttr == nil {
cmd.SysProcAttr = &syscall.SysProcAttr{}
}
cmd.SysProcAttr.Cloneflags = flag
}

9
system/errors.go Normal file
View file

@ -0,0 +1,9 @@
package system
import (
"errors"
)
var (
ErrNotSupportedPlatform = errors.New("platform and architecture is not supported")
)

View file

@ -1,16 +1,11 @@
package system
import (
"errors"
"fmt"
"runtime"
"syscall"
)
var (
ErrNotSupportedPlatform = errors.New("platform and architecture is not supported")
)
// Via http://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/commit/?id=7b21fddd087678a70ad64afc0f632e0f1071b092
//
// We need different setns values for the different platforms and arch

15
system/unsupported.go Normal file
View file

@ -0,0 +1,15 @@
// +build !linux
package system
import (
"os/exec"
)
func SetCloneFlags(cmd *exec.Cmd, flag uintptr) {
}
func UsetCloseOnExec(fd uintptr) error {
return ErrNotSupportedPlatform
}