mirror of
https://github.com/opencontainers/runc.git
synced 2026-07-11 06:03:57 +08:00
422824c9d8
This moves the sync pipe into a separate package to help the changes when moving the API around. Docker-DCO-1.1-Signed-off-by: Michael Crosby <michael@docker.com> (github: crosbymichael)
21 lines
379 B
Go
21 lines
379 B
Go
package syncpipe
|
|
|
|
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
|
|
}
|