Skip to content

Commit c3c7477

Browse files
committed
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 <[email protected]> Run-TryBot: Tobias Klauser <[email protected]> Trust: Matt Layher <[email protected]> TryBot-Result: Gopher Robot <[email protected]> Reviewed-by: Ian Lance Taylor <[email protected]>
1 parent 085ef53 commit c3c7477

File tree

5 files changed

+1
-49
lines changed

5 files changed

+1
-49
lines changed

src/runtime/os3_solaris.go

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,6 @@ import (
4747
//go:cgo_import_dynamic libc_sysconf sysconf "libc.so"
4848
//go:cgo_import_dynamic libc_usleep usleep "libc.so"
4949
//go:cgo_import_dynamic libc_write write "libc.so"
50-
//go:cgo_import_dynamic libc_pipe pipe "libc.so"
5150
//go:cgo_import_dynamic libc_pipe2 pipe2 "libc.so"
5251

5352
//go:linkname libc____errno libc____errno
@@ -83,7 +82,6 @@ import (
8382
//go:linkname libc_sysconf libc_sysconf
8483
//go:linkname libc_usleep libc_usleep
8584
//go:linkname libc_write libc_write
86-
//go:linkname libc_pipe libc_pipe
8785
//go:linkname libc_pipe2 libc_pipe2
8886

8987
var (
@@ -120,7 +118,6 @@ var (
120118
libc_sysconf,
121119
libc_usleep,
122120
libc_write,
123-
libc_pipe,
124121
libc_pipe2 libcFunc
125122
)
126123

src/runtime/sys_solaris_amd64.s

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -29,18 +29,6 @@ TEXT runtime·miniterrno(SB),NOSPLIT,$0
2929
MOVQ AX, (m_mOS+mOS_perrno)(BX)
3030
RET
3131

32-
// pipe(3c) wrapper that returns fds in AX, DX.
33-
// NOT USING GO CALLING CONVENTION.
34-
TEXT runtime·pipe1(SB),NOSPLIT,$0
35-
SUBQ $16, SP // 8 bytes will do, but stack has to be 16-byte aligned
36-
MOVQ SP, DI
37-
LEAQ libc_pipe(SB), AX
38-
CALL AX
39-
MOVL 0(SP), AX
40-
MOVL 4(SP), DX
41-
ADDQ $16, SP
42-
RET
43-
4432
// Call a library function with SysV calling conventions.
4533
// The called function can take a maximum of 6 INTEGER class arguments,
4634
// see

src/runtime/syscall_solaris.go

Lines changed: 0 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -25,11 +25,6 @@ var (
2525
libc_wait4 libcFunc
2626
)
2727

28-
//go:linkname pipe1x runtime.pipe1
29-
var pipe1x libcFunc // name to take addr of pipe1
30-
31-
func pipe1() // declared for vet; do NOT call
32-
3328
// Many of these are exported via linkname to assembly in the syscall
3429
// package.
3530

@@ -196,19 +191,6 @@ func syscall_ioctl(fd, req, arg uintptr) (err uintptr) {
196191
return call.err
197192
}
198193

199-
//go:linkname syscall_pipe
200-
func syscall_pipe() (r, w, err uintptr) {
201-
call := libcall{
202-
fn: uintptr(unsafe.Pointer(&pipe1x)),
203-
n: 0,
204-
args: uintptr(unsafe.Pointer(&pipe1x)), // it's unused but must be non-nil, otherwise crashes
205-
}
206-
entersyscallblock()
207-
asmcgocall(unsafe.Pointer(&asmsysvicall6x), unsafe.Pointer(&call))
208-
exitsyscall()
209-
return call.r1, call.r2, call.err
210-
}
211-
212194
// This is syscall.RawSyscall, it exists to satisfy some build dependency,
213195
// but it doesn't work.
214196
//

src/syscall/asm_solaris_amd64.s

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -48,9 +48,6 @@ TEXT ·getpid(SB),NOSPLIT,$0
4848
TEXT ·ioctl(SB),NOSPLIT,$0
4949
JMP runtime·syscall_ioctl(SB)
5050

51-
TEXT ·pipe(SB),NOSPLIT,$0
52-
JMP runtime·syscall_pipe(SB)
53-
5451
TEXT ·RawSyscall(SB),NOSPLIT,$0
5552
JMP runtime·syscall_rawsyscall(SB)
5653

src/syscall/syscall_solaris.go

Lines changed: 1 addition & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -47,20 +47,8 @@ func direntNamlen(buf []byte) (uint64, bool) {
4747
return reclen - uint64(unsafe.Offsetof(Dirent{}.Name)), true
4848
}
4949

50-
func pipe() (r uintptr, w uintptr, err uintptr)
51-
5250
func Pipe(p []int) (err error) {
53-
if len(p) != 2 {
54-
return EINVAL
55-
}
56-
r0, w0, e1 := pipe()
57-
if e1 != 0 {
58-
err = Errno(e1)
59-
}
60-
if err == nil {
61-
p[0], p[1] = int(r0), int(w0)
62-
}
63-
return
51+
return Pipe2(p, 0)
6452
}
6553

6654
//sysnb pipe2(p *[2]_C_int, flags int) (err error)

0 commit comments

Comments
 (0)