]> Cypherpunks repositories - gostls13.git/commitdiff
syscall: use pipe instead of pipe2 on NetBSD
authorBenny Siegert <bsiegert@gmail.com>
Mon, 4 Jun 2012 15:29:34 +0000 (01:29 +1000)
committerJoel Sing <jsing@google.com>
Mon, 4 Jun 2012 15:29:34 +0000 (01:29 +1000)
pipe2 is equivalent to pipe with flags set to 0.
However, pipe2 was only added recently. Using pipe
instead improves compatibility with NetBSD 5.

R=jsing
CC=golang-dev
https://golang.org/cl/6268045

src/pkg/syscall/syscall_netbsd.go
src/pkg/syscall/zsyscall_netbsd_386.go
src/pkg/syscall/zsyscall_netbsd_amd64.go

index 3534c0277be2f4c024dd70b5a0b896a9655c894d..f45801a92ae486269e40b7229579e266b13a9bdc 100644 (file)
@@ -118,15 +118,12 @@ func ParseDirent(buf []byte, max int, names []string) (consumed int, count int,
        return origlen - len(buf), count, names
 }
 
-//sysnb pipe2(p *[2]_C_int, flags _C_int) (err error)
+//sysnb pipe() (fd1 int, fd2 int, err error)
 func Pipe(p []int) (err error) {
        if len(p) != 2 {
                return EINVAL
        }
-       var pp [2]_C_int
-       err = pipe2(&pp, 0)
-       p[0] = int(pp[0])
-       p[1] = int(pp[1])
+       p[0], p[1], err = pipe()
        return
 }
 
index 60fbe3cd535af2629566ad84fd319c64e0192bd4..8b00f440aff8c6d94429747d391d827ba10a0257 100644 (file)
@@ -253,8 +253,10 @@ func fcntl(fd int, cmd int, arg int) (val int, err error) {
 
 // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
 
-func pipe2(p *[2]_C_int, flags _C_int) (err error) {
-       _, _, e1 := RawSyscall(SYS_PIPE2, uintptr(unsafe.Pointer(p)), uintptr(flags), 0)
+func pipe() (fd1 int, fd2 int, err error) {
+       r0, r1, e1 := RawSyscall(SYS_PIPE, 0, 0, 0)
+       fd1 = int(r0)
+       fd2 = int(r1)
        if e1 != 0 {
                err = e1
        }
index 5bf5df88cab859506585ba6bb00ac8e305932293..9501c15f9dc8ad1a2558e06169123d7eacc74fa6 100644 (file)
@@ -253,8 +253,10 @@ func fcntl(fd int, cmd int, arg int) (val int, err error) {
 
 // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
 
-func pipe2(p *[2]_C_int, flags _C_int) (err error) {
-       _, _, e1 := RawSyscall(SYS_PIPE2, uintptr(unsafe.Pointer(p)), uintptr(flags), 0)
+func pipe() (fd1 int, fd2 int, err error) {
+       r0, r1, e1 := RawSyscall(SYS_PIPE, 0, 0, 0)
+       fd1 = int(r0)
+       fd2 = int(r1)
        if e1 != 0 {
                err = e1
        }