]> Cypherpunks repositories - gostls13.git/commitdiff
runtime, syscall: implement syscall.Pipe using syscall.Pipe2 on solaris
authorTobias Klauser <tklauser@distanz.ch>
Tue, 8 Mar 2022 13:55:26 +0000 (14:55 +0100)
committerTobias Klauser <tobias.klauser@gmail.com>
Tue, 8 Mar 2022 21:16:53 +0000 (21:16 +0000)
All other platforms providing the pipe2 syscall already implement it
that way. Do so as well on solaris, which allows to drop
runtime.syscall_pipe and its dependencies as well.

Change-Id: Icf04777f21d1804da74325d173fefdc87caa42eb
Reviewed-on: https://go-review.googlesource.com/c/go/+/390716
Trust: Tobias Klauser <tobias.klauser@gmail.com>
Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com>
Trust: Matt Layher <mdlayher@gmail.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
src/runtime/os3_solaris.go
src/runtime/sys_solaris_amd64.s
src/runtime/syscall_solaris.go
src/syscall/asm_solaris_amd64.s
src/syscall/syscall_solaris.go

index 5aee04d5a8d518fa57262bec2f779d02925a85ae..f465a3aa3f51df59378d8542eb85371dd3e1af07 100644 (file)
@@ -47,7 +47,6 @@ import (
 //go:cgo_import_dynamic libc_sysconf sysconf "libc.so"
 //go:cgo_import_dynamic libc_usleep usleep "libc.so"
 //go:cgo_import_dynamic libc_write write "libc.so"
-//go:cgo_import_dynamic libc_pipe pipe "libc.so"
 //go:cgo_import_dynamic libc_pipe2 pipe2 "libc.so"
 
 //go:linkname libc____errno libc____errno
@@ -83,7 +82,6 @@ import (
 //go:linkname libc_sysconf libc_sysconf
 //go:linkname libc_usleep libc_usleep
 //go:linkname libc_write libc_write
-//go:linkname libc_pipe libc_pipe
 //go:linkname libc_pipe2 libc_pipe2
 
 var (
@@ -120,7 +118,6 @@ var (
        libc_sysconf,
        libc_usleep,
        libc_write,
-       libc_pipe,
        libc_pipe2 libcFunc
 )
 
index 05fd187517ee19144109f41df1116704c592f01d..24d2d61df0804f85a860516652729483d6f31a67 100644 (file)
@@ -29,18 +29,6 @@ TEXT runtime·miniterrno(SB),NOSPLIT,$0
        MOVQ    AX,     (m_mOS+mOS_perrno)(BX)
        RET
 
-// pipe(3c) wrapper that returns fds in AX, DX.
-// NOT USING GO CALLING CONVENTION.
-TEXT runtime·pipe1(SB),NOSPLIT,$0
-       SUBQ    $16, SP // 8 bytes will do, but stack has to be 16-byte aligned
-       MOVQ    SP, DI
-       LEAQ    libc_pipe(SB), AX
-       CALL    AX
-       MOVL    0(SP), AX
-       MOVL    4(SP), DX
-       ADDQ    $16, SP
-       RET
-
 // Call a library function with SysV calling conventions.
 // The called function can take a maximum of 6 INTEGER class arguments,
 // see
index e270e271c0ac3d47257eba3d2b95d8d9aff34e07..79775711aeaea4c21261b54cd9f8055328dc15ff 100644 (file)
@@ -25,11 +25,6 @@ var (
        libc_wait4 libcFunc
 )
 
-//go:linkname pipe1x runtime.pipe1
-var pipe1x libcFunc // name to take addr of pipe1
-
-func pipe1() // declared for vet; do NOT call
-
 // Many of these are exported via linkname to assembly in the syscall
 // package.
 
@@ -196,19 +191,6 @@ func syscall_ioctl(fd, req, arg uintptr) (err uintptr) {
        return call.err
 }
 
-//go:linkname syscall_pipe
-func syscall_pipe() (r, w, err uintptr) {
-       call := libcall{
-               fn:   uintptr(unsafe.Pointer(&pipe1x)),
-               n:    0,
-               args: uintptr(unsafe.Pointer(&pipe1x)), // it's unused but must be non-nil, otherwise crashes
-       }
-       entersyscallblock()
-       asmcgocall(unsafe.Pointer(&asmsysvicall6x), unsafe.Pointer(&call))
-       exitsyscall()
-       return call.r1, call.r2, call.err
-}
-
 // This is syscall.RawSyscall, it exists to satisfy some build dependency,
 // but it doesn't work.
 //
index c61e04a42fab4ccda6c35156f205baad4fec7829..3672d3667fa126c290692cef0e20669437edea54 100644 (file)
@@ -48,9 +48,6 @@ TEXT ·getpid(SB),NOSPLIT,$0
 TEXT ·ioctl(SB),NOSPLIT,$0
        JMP     runtime·syscall_ioctl(SB)
 
-TEXT ·pipe(SB),NOSPLIT,$0
-       JMP     runtime·syscall_pipe(SB)
-
 TEXT ·RawSyscall(SB),NOSPLIT,$0
        JMP     runtime·syscall_rawsyscall(SB)
 
index 3c50343d845b6b1ae71a1eec1da5a63e2007af12..d01070b2ec53869abc67da19d218dc5de17623d7 100644 (file)
@@ -47,20 +47,8 @@ func direntNamlen(buf []byte) (uint64, bool) {
        return reclen - uint64(unsafe.Offsetof(Dirent{}.Name)), true
 }
 
-func pipe() (r uintptr, w uintptr, err uintptr)
-
 func Pipe(p []int) (err error) {
-       if len(p) != 2 {
-               return EINVAL
-       }
-       r0, w0, e1 := pipe()
-       if e1 != 0 {
-               err = Errno(e1)
-       }
-       if err == nil {
-               p[0], p[1] = int(r0), int(w0)
-       }
-       return
+       return Pipe2(p, 0)
 }
 
 //sysnb        pipe2(p *[2]_C_int, flags int) (err error)