Source file
src/os/pipe_bsd.go
Documentation: os
1
2
3
4
5
6
7
8 package os
9
10 import "syscall"
11
12
13
14 func Pipe() (r *File, w *File, err error) {
15 var p [2]int
16
17
18 syscall.ForkLock.RLock()
19 e := syscall.Pipe(p[0:])
20 if e != nil {
21 syscall.ForkLock.RUnlock()
22 return nil, nil, NewSyscallError("pipe", e)
23 }
24 syscall.CloseOnExec(p[0])
25 syscall.CloseOnExec(p[1])
26 syscall.ForkLock.RUnlock()
27
28 return newFile(uintptr(p[0]), "|0", kindPipe), newFile(uintptr(p[1]), "|1", kindPipe), nil
29 }
30
View as plain text