syscall: implement Pipe2 on Linux and use it in ForkExec

Fixes #2656.

R=golang-dev, bradfitz, iant, minux.ma
CC=golang-dev
https://golang.org/cl/7062057
This commit is contained in:
Georg Reinke 2013-01-10 17:04:55 -08:00 committed by Ian Lance Taylor
parent 6e981c181c
commit e32d1154ec
7 changed files with 74 additions and 7 deletions

View file

@ -183,13 +183,7 @@ func forkExec(argv0 string, argv []string, attr *ProcAttr) (pid int, err error)
ForkLock.Lock()
// Allocate child status pipe close on exec.
if err = Pipe(p[0:]); err != nil {
goto error
}
if _, err = fcntl(p[0], F_SETFD, FD_CLOEXEC); err != nil {
goto error
}
if _, err = fcntl(p[1], F_SETFD, FD_CLOEXEC); err != nil {
if err = forkExecPipe(p[:]); err != nil {
goto error
}