]> Cypherpunks repositories - gostls13.git/commitdiff
syscall: implement pipe() on linux/mips
authorDavid Wimmer <davidlwimmer@gmail.com>
Wed, 25 Jul 2018 19:16:07 +0000 (19:16 +0000)
committerIan Lance Taylor <iant@golang.org>
Thu, 26 Jul 2018 17:13:12 +0000 (17:13 +0000)
Change the Pipe() function to use the pipe() syscall (which has a unique
calling convention on linux/mips) instead of using pipe2(). This allows
it work on kernels <2.6.27 when pipe2() was introduced.

Change-Id: I65dfbd2a02b64e777a8eb13013d718e356521be6
GitHub-Last-Rev: c483a06168387c2cf151b6419e4e16576fab640a
GitHub-Pull-Request: golang/go#26608
Reviewed-on: https://go-review.googlesource.com/125915
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Vladimir Stefanovic <vladimir.stefanovic@mips.com>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
src/syscall/syscall_linux_mipsx.go
src/syscall/zsyscall_linux_mips.go
src/syscall/zsyscall_linux_mipsle.go

index d5325325fc97050f527a99eeec811d13d4792d13..e5ca30db54a99b91ac8d514f07dafda38080c309 100644 (file)
@@ -119,14 +119,13 @@ func Pipe2(p []int, flags int) (err error) {
        return
 }
 
+//sysnb pipe() (p1 int, p2 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 72eabac8ecd4359f2d445d61d32b2be89ff98ea6..db0f3bb65d177e346501bacd819c8ac465357e98 100644 (file)
@@ -1685,6 +1685,18 @@ func pipe2(p *[2]_C_int, flags int) (err error) {
 
 // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
 
+func pipe() (p1 int, p2 int, err error) {
+       r0, r1, e1 := RawSyscall(SYS_PIPE, 0, 0, 0)
+       p1 = int(r0)
+       p2 = int(r1)
+       if e1 != 0 {
+               err = errnoErr(e1)
+       }
+       return
+}
+
+// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
+
 func mmap2(addr uintptr, length uintptr, prot int, flags int, fd int, pageOffset uintptr) (xaddr uintptr, err error) {
        r0, _, e1 := Syscall6(SYS_MMAP2, uintptr(addr), uintptr(length), uintptr(prot), uintptr(flags), uintptr(fd), uintptr(pageOffset))
        xaddr = uintptr(r0)
index 7114093a11535dada4de7f383c5e3e7eb7904e40..7f045b77c58d20419cff5935b654118c1047d897 100644 (file)
@@ -1685,6 +1685,18 @@ func pipe2(p *[2]_C_int, flags int) (err error) {
 
 // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
 
+func pipe() (p1 int, p2 int, err error) {
+       r0, r1, e1 := RawSyscall(SYS_PIPE, 0, 0, 0)
+       p1 = int(r0)
+       p2 = int(r1)
+       if e1 != 0 {
+               err = errnoErr(e1)
+       }
+       return
+}
+
+// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
+
 func mmap2(addr uintptr, length uintptr, prot int, flags int, fd int, pageOffset uintptr) (xaddr uintptr, err error) {
        r0, _, e1 := Syscall6(SYS_MMAP2, uintptr(addr), uintptr(length), uintptr(prot), uintptr(flags), uintptr(fd), uintptr(pageOffset))
        xaddr = uintptr(r0)