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
6
7package syscall
8
9// forkExecPipe opens a pipe and non-atomically sets O_CLOEXEC on both file
10// descriptors.
11func 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
24func acquireForkLock() {
25	ForkLock.Lock()
26}
27
28func releaseForkLock() {
29	ForkLock.Unlock()
30}
31