1
0
mirror of https://github.com/golang/go synced 2024-11-23 19:00:04 -07:00

runtime, syscall: implement syscall.Pipe using syscall.Pipe2 on solaris

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>
This commit is contained in:
Tobias Klauser 2022-03-08 14:55:26 +01:00 committed by Tobias Klauser
parent 085ef537c4
commit c3c74777bc
5 changed files with 1 additions and 49 deletions

View 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
)

View 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

View 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.
//

View 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)

View 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)