From 5267db394c36c8d2e2f4110fc4d979a832b72860 Mon Sep 17 00:00:00 2001 From: Russ Cox Date: Fri, 26 Sep 2008 14:31:17 -0700 Subject: [PATCH] add os.Pipe R=r OCL=15989 CL=16001 --- src/lib/os/os_file.go | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/lib/os/os_file.go b/src/lib/os/os_file.go index c6c641bb55a..0b1d2e0df51 100644 --- a/src/lib/os/os_file.go +++ b/src/lib/os/os_file.go @@ -82,3 +82,12 @@ func (fd *FD) WriteString(s string) (ret int, err *Error) { r, e := syscall.write(fd.fd, &b[0], int64(len(s))); return int(r), ErrnoToError(e) } + +export func Pipe() (fd1 *FD, fd2 *FD, err *Error) { + var p [2]int64 + r, e := syscall.pipe(&p); + if e != 0 { + return nil, nil, ErrnoToError(e) + } + return NewFD(p[0]), NewFD(p[1]), nil +}