var p [2]int
e := syscall.Pipe2(p[0:], syscall.O_CLOEXEC)
- // pipe2 was added in 2.6.27 and our minimum requirement is 2.6.23, so it
- // might not be implemented.
- if e == syscall.ENOSYS {
- // See ../syscall/exec.go for description of lock.
- syscall.ForkLock.RLock()
- e = syscall.Pipe(p[0:])
- if e != nil {
- syscall.ForkLock.RUnlock()
- return nil, nil, NewSyscallError("pipe", e)
- }
- syscall.CloseOnExec(p[0])
- syscall.CloseOnExec(p[1])
- syscall.ForkLock.RUnlock()
- } else if e != nil {
+ if e != nil {
return nil, nil, NewSyscallError("pipe2", e)
}
// Try to open a pipe with O_CLOEXEC set on both file descriptors.
func forkExecPipe(p []int) (err error) {
- err = Pipe2(p, O_CLOEXEC)
- // pipe2 was added in 2.6.27 and our minimum requirement is 2.6.23, so it
- // might not be implemented.
- if err == ENOSYS {
- if err = Pipe(p); err != nil {
- return
- }
- if _, err = fcntl(p[0], F_SETFD, FD_CLOEXEC); err != nil {
- return
- }
- _, err = fcntl(p[1], F_SETFD, FD_CLOEXEC)
- }
- return
+ return Pipe2(p, O_CLOEXEC)
}
func formatIDMappings(idMap []SysProcIDMap) []byte {