github.com/zebozhuang/go@v0.0.0-20200207033046-f8a98f6f5c5d/src/syscall/forkpipe_bsd.go (about)

     1  // Copyright 2011 The Go Authors. All rights reserved.
     2  // Use of this source code is governed by a BSD-style
     3  // license that can be found in the LICENSE file.
     4  
     5  // +build darwin dragonfly netbsd openbsd
     6  
     7  package syscall
     8  
     9  func forkExecPipe(p []int) error {
    10  	err := Pipe(p)
    11  	if err != nil {
    12  		return err
    13  	}
    14  	_, err = fcntl(p[0], F_SETFD, FD_CLOEXEC)
    15  	if err != nil {
    16  		return err
    17  	}
    18  	_, err = fcntl(p[1], F_SETFD, FD_CLOEXEC)
    19  	return err
    20  }