Black Lives Matter. Support the Equal Justice Initiative.

Source file src/syscall/forkpipe.go

Documentation: syscall

     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  //go:build aix || darwin || solaris
     6  // +build aix darwin solaris
     7  
     8  package syscall
     9  
    10  // Try to open a pipe with O_CLOEXEC set on both file descriptors.
    11  func forkExecPipe(p []int) error {
    12  	err := Pipe(p)
    13  	if err != nil {
    14  		return err
    15  	}
    16  	_, err = fcntl(p[0], F_SETFD, FD_CLOEXEC)
    17  	if err != nil {
    18  		return err
    19  	}
    20  	_, err = fcntl(p[1], F_SETFD, FD_CLOEXEC)
    21  	return err
    22  }
    23  

View as plain text