Fix cross compile with syscall
Docker-DCO-1.1-Signed-off-by: Michael Crosby <michael@docker.com> (github: crosbymichael)
This commit is contained in:
parent
e7916505a3
commit
73ff1addf9
|
@ -17,20 +17,6 @@ type SyncPipe struct {
|
||||||
parent, child *os.File
|
parent, child *os.File
|
||||||
}
|
}
|
||||||
|
|
||||||
func NewSyncPipe() (s *SyncPipe, err error) {
|
|
||||||
s = &SyncPipe{}
|
|
||||||
|
|
||||||
fds, err := syscall.Socketpair(syscall.AF_LOCAL, syscall.SOCK_STREAM|syscall.SOCK_CLOEXEC, 0)
|
|
||||||
if err != nil {
|
|
||||||
return nil, err
|
|
||||||
}
|
|
||||||
|
|
||||||
s.child = os.NewFile(uintptr(fds[0]), "child syncpipe")
|
|
||||||
s.parent = os.NewFile(uintptr(fds[1]), "parent syncpipe")
|
|
||||||
|
|
||||||
return s, nil
|
|
||||||
}
|
|
||||||
|
|
||||||
func NewSyncPipeFromFd(parendFd, childFd uintptr) (*SyncPipe, error) {
|
func NewSyncPipeFromFd(parendFd, childFd uintptr) (*SyncPipe, error) {
|
||||||
s := &SyncPipe{}
|
s := &SyncPipe{}
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,20 @@
|
||||||
|
package namespaces
|
||||||
|
|
||||||
|
import (
|
||||||
|
"os"
|
||||||
|
"syscall"
|
||||||
|
)
|
||||||
|
|
||||||
|
func NewSyncPipe() (s *SyncPipe, err error) {
|
||||||
|
s = &SyncPipe{}
|
||||||
|
|
||||||
|
fds, err := syscall.Socketpair(syscall.AF_LOCAL, syscall.SOCK_STREAM|syscall.SOCK_CLOEXEC, 0)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
|
||||||
|
s.child = os.NewFile(uintptr(fds[0]), "child syncpipe")
|
||||||
|
s.parent = os.NewFile(uintptr(fds[1]), "parent syncpipe")
|
||||||
|
|
||||||
|
return s, nil
|
||||||
|
}
|
Loading…
Reference in New Issue