]> Cypherpunks repositories - gostls13.git/commitdiff
add os.Pipe
authorRuss Cox <rsc@golang.org>
Fri, 26 Sep 2008 21:31:17 +0000 (14:31 -0700)
committerRuss Cox <rsc@golang.org>
Fri, 26 Sep 2008 21:31:17 +0000 (14:31 -0700)
R=r
OCL=15989
CL=16001

src/lib/os/os_file.go

index c6c641bb55a5cdf2ddb2681020b2d516a5e74a95..0b1d2e0df51679b571ba3c9b47856f8c41cb6086 100644 (file)
@@ -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
+}