mirror of
https://github.com/golang/go
synced 2024-11-23 17:50:06 -07:00
runtime: remove fallback to pipe on platforms with pipe2
On Linux, the minimum required kernel version for Go 1.18 was be changed to 2.6.32, see #45964. The pipe2 syscall was added in 2.6.27. All other platforms already provide the pipe2 syscall in the minimum supported version: - DragonFly BSD added it in version 4.2, see https://www.dragonflybsd.org/release42/ - FreeBSD added it in version 10.0, see https://www.freebsd.org/cgi/man.cgi?pipe(2)#end - NetBSD added it in version 6.0, see https://man.netbsd.org/pipe2.2#HISTORY - OpenBSD added it in version 5.7, see https://man.openbsd.org/pipe.2#HISTORY - Illumos supports it since 2013, see https://www.illumos.org/issues/3714 - Solaris supports it since 11.4 This also allows to remove setNonblock which was only used in the pipe fallback path on these platforms. Change-Id: I1f40d32fd3065d74e22af77b9ff2292b9cf66706 Reviewed-on: https://go-review.googlesource.com/c/go/+/389354 Trust: Tobias Klauser <tobias.klauser@gmail.com> Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com> TryBot-Result: Gopher Robot <gobot@golang.org> Reviewed-by: Ian Lance Taylor <iant@golang.org>
This commit is contained in:
parent
58804ea67a
commit
9d34fc5108
@ -7,7 +7,6 @@ const (
|
||||
_EINTR = 0x4
|
||||
_EFAULT = 0xe
|
||||
_EAGAIN = 0x23
|
||||
_ENOSYS = 0x4e
|
||||
|
||||
_O_NONBLOCK = 0x4
|
||||
_O_CLOEXEC = 0x400000
|
||||
|
@ -7,7 +7,6 @@ const (
|
||||
_EINTR = 0x4
|
||||
_EFAULT = 0xe
|
||||
_EAGAIN = 0x23
|
||||
_ENOSYS = 0x4e
|
||||
|
||||
_O_NONBLOCK = 0x4
|
||||
_O_CLOEXEC = 0x400000
|
||||
|
@ -7,7 +7,6 @@ const (
|
||||
_EINTR = 0x4
|
||||
_EFAULT = 0xe
|
||||
_EAGAIN = 0x23
|
||||
_ENOSYS = 0x4e
|
||||
|
||||
_O_NONBLOCK = 0x4
|
||||
_O_CLOEXEC = 0x400000
|
||||
|
@ -7,7 +7,6 @@ const (
|
||||
_EINTR = 0x4
|
||||
_EFAULT = 0xe
|
||||
_EAGAIN = 0x23
|
||||
_ENOSYS = 0x4e
|
||||
|
||||
_O_NONBLOCK = 0x4
|
||||
_O_CLOEXEC = 0x400000
|
||||
|
@ -13,7 +13,6 @@ const (
|
||||
_ETIMEDOUT = 0x91
|
||||
_EWOULDBLOCK = 0xb
|
||||
_EINPROGRESS = 0x96
|
||||
_ENOSYS = 0x59
|
||||
|
||||
_PROT_NONE = 0x0
|
||||
_PROT_READ = 0x1
|
||||
|
@ -31,7 +31,6 @@ const (
|
||||
EFAULT = C.EFAULT
|
||||
EBUSY = C.EBUSY
|
||||
EAGAIN = C.EAGAIN
|
||||
ENOSYS = C.ENOSYS
|
||||
|
||||
O_NONBLOCK = C.O_NONBLOCK
|
||||
O_CLOEXEC = C.O_CLOEXEC
|
||||
|
@ -10,7 +10,6 @@ const (
|
||||
_EFAULT = 0xe
|
||||
_EBUSY = 0x10
|
||||
_EAGAIN = 0x23
|
||||
_ENOSYS = 0x4e
|
||||
|
||||
_O_NONBLOCK = 0x4
|
||||
_O_CLOEXEC = 0x20000
|
||||
|
@ -48,7 +48,6 @@ const (
|
||||
EINTR = C.EINTR
|
||||
EFAULT = C.EFAULT
|
||||
EAGAIN = C.EAGAIN
|
||||
ENOSYS = C.ENOSYS
|
||||
|
||||
O_NONBLOCK = C.O_NONBLOCK
|
||||
O_CLOEXEC = C.O_CLOEXEC
|
||||
|
@ -16,7 +16,6 @@ const (
|
||||
_EINTR = 0x4
|
||||
_EFAULT = 0xe
|
||||
_EAGAIN = 0x23
|
||||
_ENOSYS = 0x4e
|
||||
_ETIMEDOUT = 0x3c
|
||||
|
||||
_O_NONBLOCK = 0x4
|
||||
|
@ -16,7 +16,6 @@ const (
|
||||
_EINTR = 0x4
|
||||
_EFAULT = 0xe
|
||||
_EAGAIN = 0x23
|
||||
_ENOSYS = 0x4e
|
||||
_ETIMEDOUT = 0x3c
|
||||
|
||||
_O_NONBLOCK = 0x4
|
||||
|
@ -16,7 +16,6 @@ const (
|
||||
_EINTR = 0x4
|
||||
_EFAULT = 0xe
|
||||
_EAGAIN = 0x23
|
||||
_ENOSYS = 0x4e
|
||||
_ETIMEDOUT = 0x3c
|
||||
|
||||
_O_NONBLOCK = 0x4
|
||||
|
@ -16,7 +16,6 @@ const (
|
||||
_EINTR = 0x4
|
||||
_EFAULT = 0xe
|
||||
_EAGAIN = 0x23
|
||||
_ENOSYS = 0x4e
|
||||
_ETIMEDOUT = 0x3c
|
||||
|
||||
_O_NONBLOCK = 0x4
|
||||
|
@ -37,7 +37,6 @@ const (
|
||||
EINTR = C.EINTR
|
||||
EAGAIN = C.EAGAIN
|
||||
ENOMEM = C.ENOMEM
|
||||
ENOSYS = C.ENOSYS
|
||||
|
||||
PROT_NONE = C.PROT_NONE
|
||||
PROT_READ = C.PROT_READ
|
||||
@ -91,7 +90,7 @@ const (
|
||||
SIGPWR = C.SIGPWR
|
||||
SIGSYS = C.SIGSYS
|
||||
|
||||
SIGRTMIN = C.SIGRTMIN
|
||||
SIGRTMIN = C.SIGRTMIN
|
||||
|
||||
FPE_INTDIV = C.FPE_INTDIV
|
||||
FPE_INTOVF = C.FPE_INTOVF
|
||||
|
@ -9,7 +9,6 @@ const (
|
||||
_EINTR = 0x4
|
||||
_EAGAIN = 0xb
|
||||
_ENOMEM = 0xc
|
||||
_ENOSYS = 0x26
|
||||
|
||||
_PROT_NONE = 0x0
|
||||
_PROT_READ = 0x1
|
||||
|
@ -9,7 +9,6 @@ const (
|
||||
_EINTR = 0x4
|
||||
_EAGAIN = 0xb
|
||||
_ENOMEM = 0xc
|
||||
_ENOSYS = 0x26
|
||||
|
||||
_PROT_NONE = 0x0
|
||||
_PROT_READ = 0x1
|
||||
|
@ -11,7 +11,6 @@ const (
|
||||
_EINTR = 0x4
|
||||
_ENOMEM = 0xc
|
||||
_EAGAIN = 0xb
|
||||
_ENOSYS = 0x26
|
||||
|
||||
_PROT_NONE = 0
|
||||
_PROT_READ = 0x1
|
||||
|
@ -9,7 +9,6 @@ const (
|
||||
_EINTR = 0x4
|
||||
_EAGAIN = 0xb
|
||||
_ENOMEM = 0xc
|
||||
_ENOSYS = 0x26
|
||||
|
||||
_PROT_NONE = 0x0
|
||||
_PROT_READ = 0x1
|
||||
|
@ -12,7 +12,6 @@ const (
|
||||
_EINTR = 0x4
|
||||
_EAGAIN = 0xb
|
||||
_ENOMEM = 0xc
|
||||
_ENOSYS = 0x59
|
||||
|
||||
_PROT_NONE = 0x0
|
||||
_PROT_READ = 0x1
|
||||
|
@ -12,7 +12,6 @@ const (
|
||||
_EINTR = 0x4
|
||||
_EAGAIN = 0xb
|
||||
_ENOMEM = 0xc
|
||||
_ENOSYS = 0x59
|
||||
|
||||
_PROT_NONE = 0x0
|
||||
_PROT_READ = 0x1
|
||||
|
@ -9,7 +9,6 @@ const (
|
||||
_EINTR = 0x4
|
||||
_EAGAIN = 0xb
|
||||
_ENOMEM = 0xc
|
||||
_ENOSYS = 0x26
|
||||
|
||||
_PROT_NONE = 0x0
|
||||
_PROT_READ = 0x1
|
||||
|
@ -9,7 +9,6 @@ const (
|
||||
_EINTR = 0x4
|
||||
_EAGAIN = 0xb
|
||||
_ENOMEM = 0xc
|
||||
_ENOSYS = 0x26
|
||||
|
||||
_PROT_NONE = 0x0
|
||||
_PROT_READ = 0x1
|
||||
|
@ -10,7 +10,6 @@ const (
|
||||
_EINTR = 0x4
|
||||
_EAGAIN = 0xb
|
||||
_ENOMEM = 0xc
|
||||
_ENOSYS = 0x26
|
||||
|
||||
_PROT_NONE = 0x0
|
||||
_PROT_READ = 0x1
|
||||
|
@ -10,7 +10,6 @@ const (
|
||||
_EINTR = 0x4
|
||||
_EAGAIN = 0xb
|
||||
_ENOMEM = 0xc
|
||||
_ENOSYS = 0x26
|
||||
|
||||
_PROT_NONE = 0x0
|
||||
_PROT_READ = 0x1
|
||||
|
@ -33,7 +33,6 @@ const (
|
||||
EINTR = C.EINTR
|
||||
EFAULT = C.EFAULT
|
||||
EAGAIN = C.EAGAIN
|
||||
ENOSYS = C.ENOSYS
|
||||
|
||||
O_NONBLOCK = C.O_NONBLOCK
|
||||
O_CLOEXEC = C.O_CLOEXEC
|
||||
|
@ -34,7 +34,6 @@ const (
|
||||
EINTR = C.EINTR
|
||||
EFAULT = C.EFAULT
|
||||
EAGAIN = C.EAGAIN
|
||||
ENOSYS = C.ENOSYS
|
||||
|
||||
O_NONBLOCK = C.O_NONBLOCK
|
||||
O_CLOEXEC = C.O_CLOEXEC
|
||||
|
@ -9,7 +9,6 @@ const (
|
||||
_EINTR = 0x4
|
||||
_EFAULT = 0xe
|
||||
_EAGAIN = 0x23
|
||||
_ENOSYS = 0x4e
|
||||
|
||||
_O_NONBLOCK = 0x4
|
||||
_O_CLOEXEC = 0x10000
|
||||
|
@ -9,7 +9,6 @@ const (
|
||||
_EINTR = 0x4
|
||||
_EFAULT = 0xe
|
||||
_EAGAIN = 0x23
|
||||
_ENOSYS = 0x4e
|
||||
|
||||
_O_NONBLOCK = 0x4
|
||||
_O_CLOEXEC = 0x10000
|
||||
|
@ -9,7 +9,6 @@ const (
|
||||
_EINTR = 0x4
|
||||
_EFAULT = 0xe
|
||||
_EAGAIN = 0x23
|
||||
_ENOSYS = 0x4e
|
||||
|
||||
_O_NONBLOCK = 0x4
|
||||
_O_CLOEXEC = 0x10000
|
||||
|
@ -10,7 +10,6 @@ const (
|
||||
_EINTR = 0x4
|
||||
_EFAULT = 0xe
|
||||
_EAGAIN = 0x23
|
||||
_ENOSYS = 0x4e
|
||||
|
||||
_O_NONBLOCK = 0x4
|
||||
_O_CLOEXEC = 0x10000
|
||||
|
@ -16,7 +16,6 @@ const (
|
||||
_EINTR = 0x4
|
||||
_EFAULT = 0xe
|
||||
_EAGAIN = 0x23
|
||||
_ENOSYS = 0x4e
|
||||
|
||||
_O_NONBLOCK = 0x4
|
||||
_O_CLOEXEC = 0x10000
|
||||
|
@ -43,7 +43,6 @@ const (
|
||||
ETIMEDOUT = C.ETIMEDOUT
|
||||
EWOULDBLOCK = C.EWOULDBLOCK
|
||||
EINPROGRESS = C.EINPROGRESS
|
||||
ENOSYS = C.ENOSYS
|
||||
|
||||
PROT_NONE = C.PROT_NONE
|
||||
PROT_READ = C.PROT_READ
|
||||
|
@ -5,3 +5,4 @@
|
||||
package runtime
|
||||
|
||||
var Fcntl = syscall_fcntl1
|
||||
var SetNonblock = setNonblock
|
||||
|
@ -11,3 +11,5 @@ func Fcntl(fd, cmd, arg uintptr) (uintptr, uintptr) {
|
||||
}
|
||||
return uintptr(r), 0
|
||||
}
|
||||
|
||||
var SetNonblock = setNonblock
|
||||
|
@ -7,9 +7,5 @@
|
||||
package runtime
|
||||
|
||||
func Pipe() (r, w int32, errno int32) {
|
||||
r, w, errno = pipe2(0)
|
||||
if errno == _ENOSYS {
|
||||
return pipe()
|
||||
}
|
||||
return r, w, errno
|
||||
return pipe2(0)
|
||||
}
|
||||
|
@ -9,7 +9,6 @@ package runtime
|
||||
import "unsafe"
|
||||
|
||||
var NonblockingPipe = nonblockingPipe
|
||||
var SetNonblock = setNonblock
|
||||
var Closeonexec = closeonexec
|
||||
|
||||
func sigismember(mask *sigset, i int) bool {
|
||||
|
@ -7,16 +7,5 @@
|
||||
package runtime
|
||||
|
||||
func nonblockingPipe() (r, w int32, errno int32) {
|
||||
r, w, errno = pipe2(_O_NONBLOCK | _O_CLOEXEC)
|
||||
if errno == -_ENOSYS {
|
||||
r, w, errno = pipe()
|
||||
if errno != 0 {
|
||||
return -1, -1, errno
|
||||
}
|
||||
closeonexec(r)
|
||||
setNonblock(r)
|
||||
closeonexec(w)
|
||||
setNonblock(w)
|
||||
}
|
||||
return r, w, errno
|
||||
return pipe2(_O_NONBLOCK | _O_CLOEXEC)
|
||||
}
|
||||
|
38
src/runtime/nbpipe_pipe_test.go
Normal file
38
src/runtime/nbpipe_pipe_test.go
Normal file
@ -0,0 +1,38 @@
|
||||
// Copyright 2022 The Go Authors. All rights reserved.
|
||||
// Use of this source code is governed by a BSD-style
|
||||
// license that can be found in the LICENSE file.
|
||||
|
||||
//go:build aix || darwin
|
||||
|
||||
package runtime_test
|
||||
|
||||
import (
|
||||
"runtime"
|
||||
"syscall"
|
||||
"testing"
|
||||
)
|
||||
|
||||
func TestSetNonblock(t *testing.T) {
|
||||
t.Parallel()
|
||||
|
||||
r, w, errno := runtime.Pipe()
|
||||
if errno != 0 {
|
||||
t.Fatal(syscall.Errno(errno))
|
||||
}
|
||||
defer func() {
|
||||
runtime.Close(r)
|
||||
runtime.Close(w)
|
||||
}()
|
||||
|
||||
checkIsPipe(t, r, w)
|
||||
|
||||
runtime.SetNonblock(r)
|
||||
runtime.SetNonblock(w)
|
||||
checkNonblocking(t, r, "reader")
|
||||
checkNonblocking(t, w, "writer")
|
||||
|
||||
runtime.Closeonexec(r)
|
||||
runtime.Closeonexec(w)
|
||||
checkCloseonexec(t, r, "reader")
|
||||
checkCloseonexec(t, w, "writer")
|
||||
}
|
@ -66,28 +66,3 @@ func checkCloseonexec(t *testing.T, fd int32, name string) {
|
||||
t.Errorf("FD_CLOEXEC not set in %s flags %#x", name, flags)
|
||||
}
|
||||
}
|
||||
|
||||
func TestSetNonblock(t *testing.T) {
|
||||
t.Parallel()
|
||||
|
||||
r, w, errno := runtime.Pipe()
|
||||
if errno != 0 {
|
||||
t.Fatal(syscall.Errno(errno))
|
||||
}
|
||||
defer func() {
|
||||
runtime.Close(r)
|
||||
runtime.Close(w)
|
||||
}()
|
||||
|
||||
checkIsPipe(t, r, w)
|
||||
|
||||
runtime.SetNonblock(r)
|
||||
runtime.SetNonblock(w)
|
||||
checkNonblocking(t, r, "reader")
|
||||
checkNonblocking(t, w, "writer")
|
||||
|
||||
runtime.Closeonexec(r)
|
||||
runtime.Closeonexec(w)
|
||||
checkCloseonexec(t, r, "reader")
|
||||
checkCloseonexec(t, w, "writer")
|
||||
}
|
||||
|
@ -561,13 +561,6 @@ func write1(fd uintptr, buf unsafe.Pointer, nbyte int32) int32 {
|
||||
return -int32(err)
|
||||
}
|
||||
|
||||
//go:nosplit
|
||||
func pipe() (r, w int32, errno int32) {
|
||||
var p [2]int32
|
||||
_, e := sysvicall1Err(&libc_pipe, uintptr(noescape(unsafe.Pointer(&p))))
|
||||
return p[0], p[1], int32(e)
|
||||
}
|
||||
|
||||
//go:nosplit
|
||||
func pipe2(flags int32) (r, w int32, errno int32) {
|
||||
var p [2]int32
|
||||
@ -580,12 +573,6 @@ func closeonexec(fd int32) {
|
||||
fcntl(fd, _F_SETFD, _FD_CLOEXEC)
|
||||
}
|
||||
|
||||
//go:nosplit
|
||||
func setNonblock(fd int32) {
|
||||
flags := fcntl(fd, _F_GETFL, 0)
|
||||
fcntl(fd, _F_SETFL, flags|_O_NONBLOCK)
|
||||
}
|
||||
|
||||
func osyield1()
|
||||
|
||||
//go:nosplit
|
||||
|
@ -62,10 +62,8 @@ func kqueue() int32
|
||||
//go:noescape
|
||||
func kevent(kq int32, ch *keventt, nch int32, ev *keventt, nev int32, ts *timespec) int32
|
||||
|
||||
func pipe() (r, w int32, errno int32)
|
||||
func pipe2(flags int32) (r, w int32, errno int32)
|
||||
func closeonexec(fd int32)
|
||||
func setNonblock(fd int32)
|
||||
|
||||
// From DragonFly's <sys/sysctl.h>
|
||||
const (
|
||||
|
@ -47,10 +47,8 @@ func kqueue() int32
|
||||
//go:noescape
|
||||
func kevent(kq int32, ch *keventt, nch int32, ev *keventt, nev int32, ts *timespec) int32
|
||||
|
||||
func pipe() (r, w int32, errno int32)
|
||||
func pipe2(flags int32) (r, w int32, errno int32)
|
||||
func closeonexec(fd int32)
|
||||
func setNonblock(fd int32)
|
||||
|
||||
// From FreeBSD's <sys/sysctl.h>
|
||||
const (
|
||||
|
@ -446,9 +446,7 @@ func osyield_no_g() {
|
||||
osyield()
|
||||
}
|
||||
|
||||
func pipe() (r, w int32, errno int32)
|
||||
func pipe2(flags int32) (r, w int32, errno int32)
|
||||
func setNonblock(fd int32)
|
||||
|
||||
const (
|
||||
_si_max_size = 128
|
||||
|
@ -78,10 +78,8 @@ func kqueue() int32
|
||||
//go:noescape
|
||||
func kevent(kq int32, ch *keventt, nch int32, ev *keventt, nev int32, ts *timespec) int32
|
||||
|
||||
func pipe() (r, w int32, errno int32)
|
||||
func pipe2(flags int32) (r, w int32, errno int32)
|
||||
func closeonexec(fd int32)
|
||||
func setNonblock(fd int32)
|
||||
|
||||
const (
|
||||
_ESRCH = 3
|
||||
|
@ -70,7 +70,6 @@ func sigprocmask(how int32, new, old *sigset) {
|
||||
}
|
||||
}
|
||||
|
||||
func pipe() (r, w int32, errno int32)
|
||||
func pipe2(flags int32) (r, w int32, errno int32)
|
||||
|
||||
//go:noescape
|
||||
@ -95,6 +94,5 @@ func nanotime1() int64
|
||||
func sigaltstack(new, old *stackt)
|
||||
|
||||
func closeonexec(fd int32)
|
||||
func setNonblock(fd int32)
|
||||
|
||||
func walltime() (sec int64, nsec int32)
|
||||
|
@ -109,21 +109,6 @@ TEXT runtime·read(SB),NOSPLIT,$-8
|
||||
MOVL AX, ret+24(FP)
|
||||
RET
|
||||
|
||||
// func pipe() (r, w int32, errno int32)
|
||||
TEXT runtime·pipe(SB),NOSPLIT,$0-12
|
||||
MOVL $42, AX
|
||||
SYSCALL
|
||||
JCC pipeok
|
||||
MOVL $-1,r+0(FP)
|
||||
MOVL $-1,w+4(FP)
|
||||
MOVL AX, errno+8(FP)
|
||||
RET
|
||||
pipeok:
|
||||
MOVL AX, r+0(FP)
|
||||
MOVL DX, w+4(FP)
|
||||
MOVL $0, errno+8(FP)
|
||||
RET
|
||||
|
||||
// func pipe2(flags int32) (r, w int32, errno int32)
|
||||
TEXT runtime·pipe2(SB),NOSPLIT,$0-20
|
||||
MOVL $0, DI
|
||||
@ -402,18 +387,3 @@ TEXT runtime·closeonexec(SB),NOSPLIT,$0
|
||||
MOVL $92, AX // fcntl
|
||||
SYSCALL
|
||||
RET
|
||||
|
||||
// func runtime·setNonblock(int32 fd)
|
||||
TEXT runtime·setNonblock(SB),NOSPLIT,$0-4
|
||||
MOVL fd+0(FP), DI // fd
|
||||
MOVQ $3, SI // F_GETFL
|
||||
MOVQ $0, DX
|
||||
MOVL $92, AX // fcntl
|
||||
SYSCALL
|
||||
MOVL fd+0(FP), DI // fd
|
||||
MOVQ $4, SI // F_SETFL
|
||||
MOVQ $4, DX // O_NONBLOCK
|
||||
ORL AX, DX
|
||||
MOVL $92, AX // fcntl
|
||||
SYSCALL
|
||||
RET
|
||||
|
@ -101,21 +101,6 @@ TEXT runtime·read(SB),NOSPLIT,$-4
|
||||
MOVL AX, ret+12(FP)
|
||||
RET
|
||||
|
||||
// func pipe() (r, w int32, errno int32)
|
||||
TEXT runtime·pipe(SB),NOSPLIT,$8-12
|
||||
MOVL $42, AX
|
||||
INT $0x80
|
||||
JAE ok
|
||||
MOVL $0, r+0(FP)
|
||||
MOVL $0, w+4(FP)
|
||||
MOVL AX, errno+8(FP)
|
||||
RET
|
||||
ok:
|
||||
MOVL AX, r+0(FP)
|
||||
MOVL DX, w+4(FP)
|
||||
MOVL $0, errno+8(FP)
|
||||
RET
|
||||
|
||||
// func pipe2(flags int32) (r, w int32, errno int32)
|
||||
TEXT runtime·pipe2(SB),NOSPLIT,$12-16
|
||||
MOVL $542, AX
|
||||
@ -443,23 +428,6 @@ TEXT runtime·closeonexec(SB),NOSPLIT,$32
|
||||
NEGL AX
|
||||
RET
|
||||
|
||||
// func runtime·setNonblock(fd int32)
|
||||
TEXT runtime·setNonblock(SB),NOSPLIT,$16-4
|
||||
MOVL $92, AX // fcntl
|
||||
MOVL fd+0(FP), BX // fd
|
||||
MOVL BX, 4(SP)
|
||||
MOVL $3, 8(SP) // F_GETFL
|
||||
MOVL $0, 12(SP)
|
||||
INT $0x80
|
||||
MOVL fd+0(FP), BX // fd
|
||||
MOVL BX, 4(SP)
|
||||
MOVL $4, 8(SP) // F_SETFL
|
||||
ORL $4, AX // O_NONBLOCK
|
||||
MOVL AX, 12(SP)
|
||||
MOVL $92, AX // fcntl
|
||||
INT $0x80
|
||||
RET
|
||||
|
||||
// func cpuset_getaffinity(level int, which int, id int64, size int, mask *byte) int32
|
||||
TEXT runtime·cpuset_getaffinity(SB), NOSPLIT, $0-28
|
||||
MOVL $487, AX
|
||||
|
@ -102,21 +102,6 @@ TEXT runtime·read(SB),NOSPLIT,$-8
|
||||
MOVL AX, ret+24(FP)
|
||||
RET
|
||||
|
||||
// func pipe() (r, w int32, errno int32)
|
||||
TEXT runtime·pipe(SB),NOSPLIT,$0-12
|
||||
MOVL $42, AX
|
||||
SYSCALL
|
||||
JCC ok
|
||||
MOVL $0, r+0(FP)
|
||||
MOVL $0, w+4(FP)
|
||||
MOVL AX, errno+8(FP)
|
||||
RET
|
||||
ok:
|
||||
MOVL AX, r+0(FP)
|
||||
MOVL DX, w+4(FP)
|
||||
MOVL $0, errno+8(FP)
|
||||
RET
|
||||
|
||||
// func pipe2(flags int32) (r, w int32, errno int32)
|
||||
TEXT runtime·pipe2(SB),NOSPLIT,$0-20
|
||||
LEAQ r+8(FP), DI
|
||||
@ -491,21 +476,6 @@ TEXT runtime·closeonexec(SB),NOSPLIT,$0
|
||||
SYSCALL
|
||||
RET
|
||||
|
||||
// func runtime·setNonblock(int32 fd)
|
||||
TEXT runtime·setNonblock(SB),NOSPLIT,$0-4
|
||||
MOVL fd+0(FP), DI // fd
|
||||
MOVQ $3, SI // F_GETFL
|
||||
MOVQ $0, DX
|
||||
MOVL $92, AX // fcntl
|
||||
SYSCALL
|
||||
MOVL fd+0(FP), DI // fd
|
||||
MOVQ $4, SI // F_SETFL
|
||||
MOVQ $4, DX // O_NONBLOCK
|
||||
ORL AX, DX
|
||||
MOVL $92, AX // fcntl
|
||||
SYSCALL
|
||||
RET
|
||||
|
||||
// func cpuset_getaffinity(level int, which int, id int64, size int, mask *byte) int32
|
||||
TEXT runtime·cpuset_getaffinity(SB), NOSPLIT, $0-44
|
||||
MOVQ level+0(FP), DI
|
||||
|
@ -20,7 +20,6 @@
|
||||
#define SYS_close (SYS_BASE + 6)
|
||||
#define SYS_getpid (SYS_BASE + 20)
|
||||
#define SYS_kill (SYS_BASE + 37)
|
||||
#define SYS_pipe (SYS_BASE + 42)
|
||||
#define SYS_sigaltstack (SYS_BASE + 53)
|
||||
#define SYS_munmap (SYS_BASE + 73)
|
||||
#define SYS_madvise (SYS_BASE + 75)
|
||||
@ -123,23 +122,6 @@ TEXT runtime·read(SB),NOSPLIT|NOFRAME,$0
|
||||
MOVW R0, ret+12(FP)
|
||||
RET
|
||||
|
||||
// func pipe() (r, w int32, errno int32)
|
||||
TEXT runtime·pipe(SB),NOSPLIT,$0-12
|
||||
MOVW $SYS_pipe, R7
|
||||
SWI $0
|
||||
BCC ok
|
||||
MOVW $0, R1
|
||||
MOVW R1, r+0(FP)
|
||||
MOVW R1, w+4(FP)
|
||||
MOVW R0, errno+8(FP)
|
||||
RET
|
||||
ok:
|
||||
MOVW R0, r+0(FP)
|
||||
MOVW R1, w+4(FP)
|
||||
MOVW $0, R1
|
||||
MOVW R1, errno+8(FP)
|
||||
RET
|
||||
|
||||
// func pipe2(flags int32) (r, w int32, errno int32)
|
||||
TEXT runtime·pipe2(SB),NOSPLIT,$0-16
|
||||
MOVW $r+4(FP), R0
|
||||
@ -414,20 +396,6 @@ TEXT runtime·closeonexec(SB),NOSPLIT,$0
|
||||
SWI $0
|
||||
RET
|
||||
|
||||
// func runtime·setNonblock(fd int32)
|
||||
TEXT runtime·setNonblock(SB),NOSPLIT,$0-4
|
||||
MOVW fd+0(FP), R0 // fd
|
||||
MOVW $3, R1 // F_GETFL
|
||||
MOVW $0, R2
|
||||
MOVW $SYS_fcntl, R7
|
||||
SWI $0
|
||||
ORR $0x4, R0, R2 // O_NONBLOCK
|
||||
MOVW fd+0(FP), R0 // fd
|
||||
MOVW $4, R1 // F_SETFL
|
||||
MOVW $SYS_fcntl, R7
|
||||
SWI $0
|
||||
RET
|
||||
|
||||
// TODO: this is only valid for ARMv7+
|
||||
TEXT ·publicationBarrier(SB),NOSPLIT|NOFRAME,$0-0
|
||||
B runtime·armPublicationBarrier(SB)
|
||||
|
@ -133,18 +133,6 @@ ok:
|
||||
MOVW R0, ret+8(FP)
|
||||
RET
|
||||
|
||||
// func pipe() (r, w int32, errno int32)
|
||||
TEXT runtime·pipe(SB),NOSPLIT|NOFRAME,$0-12
|
||||
MOVD $r+0(FP), R0
|
||||
MOVW $0, R1
|
||||
MOVD $SYS_pipe2, R8
|
||||
SVC
|
||||
BCC ok
|
||||
NEG R0, R0
|
||||
ok:
|
||||
MOVW R0, errno+8(FP)
|
||||
RET
|
||||
|
||||
// func pipe2(flags int32) (r, w int32, errno int32)
|
||||
TEXT runtime·pipe2(SB),NOSPLIT|NOFRAME,$0-20
|
||||
MOVD $r+8(FP), R0
|
||||
@ -492,20 +480,6 @@ TEXT runtime·closeonexec(SB),NOSPLIT|NOFRAME,$0
|
||||
SVC
|
||||
RET
|
||||
|
||||
// func runtime·setNonblock(fd int32)
|
||||
TEXT runtime·setNonblock(SB),NOSPLIT,$0-4
|
||||
MOVW fd+0(FP), R0
|
||||
MOVD $F_GETFL, R1
|
||||
MOVD $0, R2
|
||||
MOVD $SYS_fcntl, R8
|
||||
SVC
|
||||
ORR $O_NONBLOCK, R0, R2
|
||||
MOVW fd+0(FP), R0
|
||||
MOVW $F_SETFL, R1
|
||||
MOVW $SYS_fcntl, R7
|
||||
SVC
|
||||
RET
|
||||
|
||||
// func getCntxct(physical bool) uint32
|
||||
TEXT runtime·getCntxct(SB),NOSPLIT,$0
|
||||
MOVB physical+0(FP), R0
|
||||
|
@ -32,7 +32,6 @@
|
||||
#define SYS_getpid 20
|
||||
#define SYS_access 33
|
||||
#define SYS_kill 37
|
||||
#define SYS_pipe 42
|
||||
#define SYS_brk 45
|
||||
#define SYS_fcntl 55
|
||||
#define SYS_munmap 91
|
||||
@ -130,14 +129,6 @@ TEXT runtime·read(SB),NOSPLIT,$0
|
||||
MOVL AX, ret+12(FP)
|
||||
RET
|
||||
|
||||
// func pipe() (r, w int32, errno int32)
|
||||
TEXT runtime·pipe(SB),NOSPLIT,$0-12
|
||||
MOVL $SYS_pipe, AX
|
||||
LEAL r+0(FP), BX
|
||||
INVOKE_SYSCALL
|
||||
MOVL AX, errno+8(FP)
|
||||
RET
|
||||
|
||||
// func pipe2(flags int32) (r, w int32, errno int32)
|
||||
TEXT runtime·pipe2(SB),NOSPLIT,$0-16
|
||||
MOVL $SYS_pipe2, AX
|
||||
@ -782,21 +773,6 @@ TEXT runtime·closeonexec(SB),NOSPLIT,$0
|
||||
INVOKE_SYSCALL
|
||||
RET
|
||||
|
||||
// func runtime·setNonblock(fd int32)
|
||||
TEXT runtime·setNonblock(SB),NOSPLIT,$0-4
|
||||
MOVL $SYS_fcntl, AX
|
||||
MOVL fd+0(FP), BX // fd
|
||||
MOVL $3, CX // F_GETFL
|
||||
MOVL $0, DX
|
||||
INVOKE_SYSCALL
|
||||
MOVL fd+0(FP), BX // fd
|
||||
MOVL $4, CX // F_SETFL
|
||||
MOVL $0x800, DX // O_NONBLOCK
|
||||
ORL AX, DX
|
||||
MOVL $SYS_fcntl, AX
|
||||
INVOKE_SYSCALL
|
||||
RET
|
||||
|
||||
// int access(const char *name, int mode)
|
||||
TEXT runtime·access(SB),NOSPLIT,$0
|
||||
MOVL $SYS_access, AX
|
||||
|
@ -22,7 +22,6 @@
|
||||
#define SYS_rt_sigaction 13
|
||||
#define SYS_rt_sigprocmask 14
|
||||
#define SYS_rt_sigreturn 15
|
||||
#define SYS_pipe 22
|
||||
#define SYS_sched_yield 24
|
||||
#define SYS_mincore 27
|
||||
#define SYS_madvise 28
|
||||
@ -114,14 +113,6 @@ TEXT runtime·read(SB),NOSPLIT,$0-28
|
||||
MOVL AX, ret+24(FP)
|
||||
RET
|
||||
|
||||
// func pipe() (r, w int32, errno int32)
|
||||
TEXT runtime·pipe(SB),NOSPLIT,$0-12
|
||||
LEAQ r+0(FP), DI
|
||||
MOVL $SYS_pipe, AX
|
||||
SYSCALL
|
||||
MOVL AX, errno+8(FP)
|
||||
RET
|
||||
|
||||
// func pipe2(flags int32) (r, w int32, errno int32)
|
||||
TEXT runtime·pipe2(SB),NOSPLIT,$0-20
|
||||
LEAQ r+8(FP), DI
|
||||
@ -708,21 +699,6 @@ TEXT runtime·closeonexec(SB),NOSPLIT,$0
|
||||
SYSCALL
|
||||
RET
|
||||
|
||||
// func runtime·setNonblock(int32 fd)
|
||||
TEXT runtime·setNonblock(SB),NOSPLIT,$0-4
|
||||
MOVL fd+0(FP), DI // fd
|
||||
MOVQ $3, SI // F_GETFL
|
||||
MOVQ $0, DX
|
||||
MOVL $SYS_fcntl, AX
|
||||
SYSCALL
|
||||
MOVL fd+0(FP), DI // fd
|
||||
MOVQ $4, SI // F_SETFL
|
||||
MOVQ $0x800, DX // O_NONBLOCK
|
||||
ORL AX, DX
|
||||
MOVL $SYS_fcntl, AX
|
||||
SYSCALL
|
||||
RET
|
||||
|
||||
// int access(const char *name, int mode)
|
||||
TEXT runtime·access(SB),NOSPLIT,$0
|
||||
// This uses faccessat instead of access, because Android O blocks access.
|
||||
|
@ -23,7 +23,6 @@
|
||||
#define SYS_close (SYS_BASE + 6)
|
||||
#define SYS_getpid (SYS_BASE + 20)
|
||||
#define SYS_kill (SYS_BASE + 37)
|
||||
#define SYS_pipe (SYS_BASE + 42)
|
||||
#define SYS_clone (SYS_BASE + 120)
|
||||
#define SYS_rt_sigreturn (SYS_BASE + 173)
|
||||
#define SYS_rt_sigaction (SYS_BASE + 174)
|
||||
@ -98,14 +97,6 @@ TEXT runtime·read(SB),NOSPLIT,$0
|
||||
MOVW R0, ret+12(FP)
|
||||
RET
|
||||
|
||||
// func pipe() (r, w int32, errno int32)
|
||||
TEXT runtime·pipe(SB),NOSPLIT,$0-12
|
||||
MOVW $r+0(FP), R0
|
||||
MOVW $SYS_pipe, R7
|
||||
SWI $0
|
||||
MOVW R0, errno+8(FP)
|
||||
RET
|
||||
|
||||
// func pipe2(flags int32) (r, w int32, errno int32)
|
||||
TEXT runtime·pipe2(SB),NOSPLIT,$0-16
|
||||
MOVW $r+4(FP), R0
|
||||
@ -717,20 +708,6 @@ TEXT runtime·closeonexec(SB),NOSPLIT,$0
|
||||
SWI $0
|
||||
RET
|
||||
|
||||
// func runtime·setNonblock(fd int32)
|
||||
TEXT runtime·setNonblock(SB),NOSPLIT,$0-4
|
||||
MOVW fd+0(FP), R0 // fd
|
||||
MOVW $3, R1 // F_GETFL
|
||||
MOVW $0, R2
|
||||
MOVW $SYS_fcntl, R7
|
||||
SWI $0
|
||||
ORR $0x800, R0, R2 // O_NONBLOCK
|
||||
MOVW fd+0(FP), R0 // fd
|
||||
MOVW $4, R1 // F_SETFL
|
||||
MOVW $SYS_fcntl, R7
|
||||
SWI $0
|
||||
RET
|
||||
|
||||
// b __kuser_get_tls @ 0xffff0fe0
|
||||
TEXT runtime·read_tls_fallback(SB),NOSPLIT|NOFRAME,$0
|
||||
MOVW $0xffff0fe0, R0
|
||||
|
@ -113,15 +113,6 @@ TEXT runtime·read(SB),NOSPLIT|NOFRAME,$0-28
|
||||
MOVW R0, ret+24(FP)
|
||||
RET
|
||||
|
||||
// func pipe() (r, w int32, errno int32)
|
||||
TEXT runtime·pipe(SB),NOSPLIT|NOFRAME,$0-12
|
||||
MOVD $r+0(FP), R0
|
||||
MOVW $0, R1
|
||||
MOVW $SYS_pipe2, R8
|
||||
SVC
|
||||
MOVW R0, errno+8(FP)
|
||||
RET
|
||||
|
||||
// func pipe2(flags int32) (r, w int32, errno int32)
|
||||
TEXT runtime·pipe2(SB),NOSPLIT|NOFRAME,$0-20
|
||||
MOVD $r+8(FP), R0
|
||||
@ -740,21 +731,6 @@ TEXT runtime·closeonexec(SB),NOSPLIT|NOFRAME,$0
|
||||
SVC
|
||||
RET
|
||||
|
||||
// func runtime·setNonblock(int32 fd)
|
||||
TEXT runtime·setNonblock(SB),NOSPLIT|NOFRAME,$0-4
|
||||
MOVW fd+0(FP), R0 // fd
|
||||
MOVD $3, R1 // F_GETFL
|
||||
MOVD $0, R2
|
||||
MOVD $SYS_fcntl, R8
|
||||
SVC
|
||||
MOVD $0x800, R2 // O_NONBLOCK
|
||||
ORR R0, R2
|
||||
MOVW fd+0(FP), R0 // fd
|
||||
MOVD $4, R1 // F_SETFL
|
||||
MOVD $SYS_fcntl, R8
|
||||
SVC
|
||||
RET
|
||||
|
||||
// int access(const char *name, int mode)
|
||||
TEXT runtime·access(SB),NOSPLIT,$0-20
|
||||
MOVD $AT_FDCWD, R0
|
||||
|
@ -113,17 +113,6 @@ TEXT runtime·read(SB),NOSPLIT|NOFRAME,$0-28
|
||||
MOVW R2, ret+24(FP)
|
||||
RET
|
||||
|
||||
// func pipe() (r, w int32, errno int32)
|
||||
TEXT runtime·pipe(SB),NOSPLIT|NOFRAME,$0-12
|
||||
MOVV $r+0(FP), R4
|
||||
MOVV R0, R5
|
||||
MOVV $SYS_pipe2, R2
|
||||
SYSCALL
|
||||
BEQ R7, 2(PC)
|
||||
SUBVU R2, R0, R2 // caller expects negative errno
|
||||
MOVW R2, errno+8(FP)
|
||||
RET
|
||||
|
||||
// func pipe2(flags int32) (r, w int32, errno int32)
|
||||
TEXT runtime·pipe2(SB),NOSPLIT|NOFRAME,$0-20
|
||||
MOVV $r+8(FP), R4
|
||||
@ -635,21 +624,6 @@ TEXT runtime·closeonexec(SB),NOSPLIT|NOFRAME,$0
|
||||
SYSCALL
|
||||
RET
|
||||
|
||||
// func runtime·setNonblock(int32 fd)
|
||||
TEXT runtime·setNonblock(SB),NOSPLIT|NOFRAME,$0-4
|
||||
MOVW fd+0(FP), R4 // fd
|
||||
MOVV $3, R5 // F_GETFL
|
||||
MOVV $0, R6
|
||||
MOVV $SYS_fcntl, R2
|
||||
SYSCALL
|
||||
MOVW $0x80, R6 // O_NONBLOCK
|
||||
OR R2, R6
|
||||
MOVW fd+0(FP), R4 // fd
|
||||
MOVV $4, R5 // F_SETFL
|
||||
MOVV $SYS_fcntl, R2
|
||||
SYSCALL
|
||||
RET
|
||||
|
||||
// func sbrk0() uintptr
|
||||
TEXT runtime·sbrk0(SB),NOSPLIT|NOFRAME,$0-8
|
||||
// Implemented as brk(NULL).
|
||||
|
@ -19,7 +19,6 @@
|
||||
#define SYS_close 4006
|
||||
#define SYS_getpid 4020
|
||||
#define SYS_kill 4037
|
||||
#define SYS_pipe 4042
|
||||
#define SYS_brk 4045
|
||||
#define SYS_fcntl 4055
|
||||
#define SYS_mmap 4090
|
||||
@ -112,23 +111,6 @@ TEXT runtime·read(SB),NOSPLIT,$0-16
|
||||
MOVW R2, ret+12(FP)
|
||||
RET
|
||||
|
||||
// func pipe() (r, w int32, errno int32)
|
||||
TEXT runtime·pipe(SB),NOSPLIT,$0-12
|
||||
MOVW $SYS_pipe, R2
|
||||
SYSCALL
|
||||
BEQ R7, pipeok
|
||||
MOVW $-1, R1
|
||||
MOVW R1, r+0(FP)
|
||||
MOVW R1, w+4(FP)
|
||||
SUBU R2, R0, R2 // caller expects negative errno
|
||||
MOVW R2, errno+8(FP)
|
||||
RET
|
||||
pipeok:
|
||||
MOVW R2, r+0(FP)
|
||||
MOVW R3, w+4(FP)
|
||||
MOVW R0, errno+8(FP)
|
||||
RET
|
||||
|
||||
// func pipe2(flags int32) (r, w int32, errno int32)
|
||||
TEXT runtime·pipe2(SB),NOSPLIT,$0-16
|
||||
MOVW $r+4(FP), R4
|
||||
@ -559,21 +541,6 @@ TEXT runtime·closeonexec(SB),NOSPLIT,$0-4
|
||||
SYSCALL
|
||||
RET
|
||||
|
||||
// func runtime·setNonblock(int32 fd)
|
||||
TEXT runtime·setNonblock(SB),NOSPLIT,$0-4
|
||||
MOVW fd+0(FP), R4 // fd
|
||||
MOVW $3, R5 // F_GETFL
|
||||
MOVW $0, R6
|
||||
MOVW $SYS_fcntl, R2
|
||||
SYSCALL
|
||||
MOVW $0x80, R6 // O_NONBLOCK
|
||||
OR R2, R6
|
||||
MOVW fd+0(FP), R4 // fd
|
||||
MOVW $4, R5 // F_SETFL
|
||||
MOVW $SYS_fcntl, R2
|
||||
SYSCALL
|
||||
RET
|
||||
|
||||
// func sbrk0() uintptr
|
||||
TEXT runtime·sbrk0(SB),NOSPLIT,$0-4
|
||||
// Implemented as brk(NULL).
|
||||
|
@ -20,7 +20,6 @@
|
||||
#define SYS_close 6
|
||||
#define SYS_getpid 20
|
||||
#define SYS_kill 37
|
||||
#define SYS_pipe 42
|
||||
#define SYS_brk 45
|
||||
#define SYS_fcntl 55
|
||||
#define SYS_mmap 90
|
||||
@ -104,13 +103,6 @@ TEXT runtime·read(SB),NOSPLIT|NOFRAME,$0-28
|
||||
MOVW R3, ret+24(FP)
|
||||
RET
|
||||
|
||||
// func pipe() (r, w int32, errno int32)
|
||||
TEXT runtime·pipe(SB),NOSPLIT|NOFRAME,$0-12
|
||||
ADD $FIXED_FRAME, R1, R3
|
||||
SYSCALL $SYS_pipe
|
||||
MOVW R3, errno+8(FP)
|
||||
RET
|
||||
|
||||
// func pipe2(flags int32) (r, w int32, errno int32)
|
||||
TEXT runtime·pipe2(SB),NOSPLIT|NOFRAME,$0-20
|
||||
ADD $FIXED_FRAME+8, R1, R3
|
||||
@ -933,18 +925,6 @@ TEXT runtime·closeonexec(SB),NOSPLIT|NOFRAME,$0
|
||||
SYSCALL $SYS_fcntl
|
||||
RET
|
||||
|
||||
// func runtime·setNonblock(int32 fd)
|
||||
TEXT runtime·setNonblock(SB),NOSPLIT|NOFRAME,$0-4
|
||||
MOVW fd+0(FP), R3 // fd
|
||||
MOVD $3, R4 // F_GETFL
|
||||
MOVD $0, R5
|
||||
SYSCALL $SYS_fcntl
|
||||
OR $0x800, R3, R5 // O_NONBLOCK
|
||||
MOVW fd+0(FP), R3 // fd
|
||||
MOVD $4, R4 // F_SETFL
|
||||
SYSCALL $SYS_fcntl
|
||||
RET
|
||||
|
||||
// func sbrk0() uintptr
|
||||
TEXT runtime·sbrk0(SB),NOSPLIT|NOFRAME,$0
|
||||
// Implemented as brk(NULL).
|
||||
|
@ -118,15 +118,6 @@ TEXT runtime·read(SB),NOSPLIT|NOFRAME,$0-28
|
||||
MOVW A0, ret+24(FP)
|
||||
RET
|
||||
|
||||
// func pipe() (r, w int32, errno int32)
|
||||
TEXT runtime·pipe(SB),NOSPLIT|NOFRAME,$0-12
|
||||
MOV $r+0(FP), A0
|
||||
MOV ZERO, A1
|
||||
MOV $SYS_pipe2, A7
|
||||
ECALL
|
||||
MOVW A0, errno+8(FP)
|
||||
RET
|
||||
|
||||
// func pipe2(flags int32) (r, w int32, errno int32)
|
||||
TEXT runtime·pipe2(SB),NOSPLIT|NOFRAME,$0-20
|
||||
MOV $r+8(FP), A0
|
||||
@ -635,21 +626,6 @@ TEXT runtime·closeonexec(SB),NOSPLIT|NOFRAME,$0
|
||||
ECALL
|
||||
RET
|
||||
|
||||
// func runtime·setNonblock(int32 fd)
|
||||
TEXT runtime·setNonblock(SB),NOSPLIT|NOFRAME,$0-4
|
||||
MOVW fd+0(FP), A0 // fd
|
||||
MOV $3, A1 // F_GETFL
|
||||
MOV $0, A2
|
||||
MOV $SYS_fcntl, A7
|
||||
ECALL
|
||||
MOV $0x800, A2 // O_NONBLOCK
|
||||
OR A0, A2
|
||||
MOVW fd+0(FP), A0 // fd
|
||||
MOV $4, A1 // F_SETFL
|
||||
MOV $SYS_fcntl, A7
|
||||
ECALL
|
||||
RET
|
||||
|
||||
// func sbrk0() uintptr
|
||||
TEXT runtime·sbrk0(SB),NOSPLIT,$0-8
|
||||
// Implemented as brk(NULL).
|
||||
|
@ -16,7 +16,6 @@
|
||||
#define SYS_close 6
|
||||
#define SYS_getpid 20
|
||||
#define SYS_kill 37
|
||||
#define SYS_pipe 42
|
||||
#define SYS_brk 45
|
||||
#define SYS_fcntl 55
|
||||
#define SYS_mmap 90
|
||||
@ -103,14 +102,6 @@ TEXT runtime·read(SB),NOSPLIT|NOFRAME,$0-28
|
||||
MOVW R2, ret+24(FP)
|
||||
RET
|
||||
|
||||
// func pipe() (r, w int32, errno int32)
|
||||
TEXT runtime·pipe(SB),NOSPLIT|NOFRAME,$0-12
|
||||
MOVD $r+0(FP), R2
|
||||
MOVW $SYS_pipe, R1
|
||||
SYSCALL
|
||||
MOVW R2, errno+8(FP)
|
||||
RET
|
||||
|
||||
// func pipe2() (r, w int32, errno int32)
|
||||
TEXT runtime·pipe2(SB),NOSPLIT|NOFRAME,$0-20
|
||||
MOVD $r+8(FP), R2
|
||||
@ -497,21 +488,6 @@ TEXT runtime·closeonexec(SB),NOSPLIT|NOFRAME,$0
|
||||
SYSCALL
|
||||
RET
|
||||
|
||||
// func runtime·setNonblock(int32 fd)
|
||||
TEXT runtime·setNonblock(SB),NOSPLIT|NOFRAME,$0-4
|
||||
MOVW fd+0(FP), R2 // fd
|
||||
MOVD $3, R3 // F_GETFL
|
||||
XOR R4, R4
|
||||
MOVW $SYS_fcntl, R1
|
||||
SYSCALL
|
||||
MOVD $0x800, R4 // O_NONBLOCK
|
||||
OR R2, R4
|
||||
MOVW fd+0(FP), R2 // fd
|
||||
MOVD $4, R3 // F_SETFL
|
||||
MOVW $SYS_fcntl, R1
|
||||
SYSCALL
|
||||
RET
|
||||
|
||||
// func sbrk0() uintptr
|
||||
TEXT runtime·sbrk0(SB),NOSPLIT|NOFRAME,$0-8
|
||||
// Implemented as brk(NULL).
|
||||
|
@ -87,21 +87,6 @@ TEXT runtime·read(SB),NOSPLIT,$-4
|
||||
MOVL AX, ret+12(FP)
|
||||
RET
|
||||
|
||||
// func pipe() (r, w int32, errno int32)
|
||||
TEXT runtime·pipe(SB),NOSPLIT,$0-12
|
||||
MOVL $42, AX
|
||||
INT $0x80
|
||||
JCC pipeok
|
||||
MOVL $-1, r+0(FP)
|
||||
MOVL $-1, w+4(FP)
|
||||
MOVL AX, errno+8(FP)
|
||||
RET
|
||||
pipeok:
|
||||
MOVL AX, r+0(FP)
|
||||
MOVL DX, w+4(FP)
|
||||
MOVL $0, errno+8(FP)
|
||||
RET
|
||||
|
||||
// func pipe2(flags int32) (r, w int32, errno int32)
|
||||
TEXT runtime·pipe2(SB),NOSPLIT,$12-16
|
||||
MOVL $453, AX
|
||||
@ -484,20 +469,3 @@ TEXT runtime·closeonexec(SB),NOSPLIT,$32
|
||||
JAE 2(PC)
|
||||
NEGL AX
|
||||
RET
|
||||
|
||||
// func runtime·setNonblock(fd int32)
|
||||
TEXT runtime·setNonblock(SB),NOSPLIT,$16-4
|
||||
MOVL $92, AX // fcntl
|
||||
MOVL fd+0(FP), BX // fd
|
||||
MOVL BX, 4(SP)
|
||||
MOVL $3, 8(SP) // F_GETFL
|
||||
MOVL $0, 12(SP)
|
||||
INT $0x80
|
||||
MOVL fd+0(FP), BX // fd
|
||||
MOVL BX, 4(SP)
|
||||
MOVL $4, 8(SP) // F_SETFL
|
||||
ORL $4, AX // O_NONBLOCK
|
||||
MOVL AX, 12(SP)
|
||||
MOVL $92, AX // fcntl
|
||||
INT $0x80
|
||||
RET
|
||||
|
@ -163,21 +163,6 @@ TEXT runtime·read(SB),NOSPLIT,$-8
|
||||
MOVL AX, ret+24(FP)
|
||||
RET
|
||||
|
||||
// func pipe() (r, w int32, errno int32)
|
||||
TEXT runtime·pipe(SB),NOSPLIT,$0-12
|
||||
MOVL $42, AX
|
||||
SYSCALL
|
||||
JCC pipeok
|
||||
MOVL $-1, r+0(FP)
|
||||
MOVL $-1, w+4(FP)
|
||||
MOVL AX, errno+8(FP)
|
||||
RET
|
||||
pipeok:
|
||||
MOVL AX, r+0(FP)
|
||||
MOVL DX, w+4(FP)
|
||||
MOVL $0, errno+8(FP)
|
||||
RET
|
||||
|
||||
// func pipe2(flags int32) (r, w int32, errno int32)
|
||||
TEXT runtime·pipe2(SB),NOSPLIT,$0-20
|
||||
LEAQ r+8(FP), DI
|
||||
@ -449,18 +434,3 @@ TEXT runtime·closeonexec(SB),NOSPLIT,$0
|
||||
MOVL $SYS_fcntl, AX
|
||||
SYSCALL
|
||||
RET
|
||||
|
||||
// func runtime·setNonblock(int32 fd)
|
||||
TEXT runtime·setNonblock(SB),NOSPLIT,$0-4
|
||||
MOVL fd+0(FP), DI // fd
|
||||
MOVQ $3, SI // F_GETFL
|
||||
MOVQ $0, DX
|
||||
MOVL $92, AX // fcntl
|
||||
SYSCALL
|
||||
MOVL fd+0(FP), DI // fd
|
||||
MOVQ $4, SI // F_SETFL
|
||||
MOVQ $4, DX // O_NONBLOCK
|
||||
ORL AX, DX
|
||||
MOVL $92, AX // fcntl
|
||||
SYSCALL
|
||||
RET
|
||||
|
@ -96,22 +96,6 @@ TEXT runtime·read(SB),NOSPLIT|NOFRAME,$0
|
||||
MOVW R0, ret+12(FP)
|
||||
RET
|
||||
|
||||
// func pipe() (r, w int32, errno int32)
|
||||
TEXT runtime·pipe(SB),NOSPLIT,$0-12
|
||||
SWI $0xa0002a
|
||||
BCC pipeok
|
||||
MOVW $-1,R2
|
||||
MOVW R2, r+0(FP)
|
||||
MOVW R2, w+4(FP)
|
||||
MOVW R0, errno+8(FP)
|
||||
RET
|
||||
pipeok:
|
||||
MOVW $0, R2
|
||||
MOVW R0, r+0(FP)
|
||||
MOVW R1, w+4(FP)
|
||||
MOVW R2, errno+8(FP)
|
||||
RET
|
||||
|
||||
// func pipe2(flags int32) (r, w int32, errno int32)
|
||||
TEXT runtime·pipe2(SB),NOSPLIT,$0-16
|
||||
MOVW $r+4(FP), R0
|
||||
@ -422,18 +406,6 @@ TEXT runtime·closeonexec(SB),NOSPLIT,$0
|
||||
SWI $SYS_fcntl
|
||||
RET
|
||||
|
||||
// func runtime·setNonblock(fd int32)
|
||||
TEXT runtime·setNonblock(SB),NOSPLIT,$0-4
|
||||
MOVW fd+0(FP), R0 // fd
|
||||
MOVW $3, R1 // F_GETFL
|
||||
MOVW $0, R2
|
||||
SWI $0xa0005c // sys_fcntl
|
||||
ORR $0x4, R0, R2 // O_NONBLOCK
|
||||
MOVW fd+0(FP), R0 // fd
|
||||
MOVW $4, R1 // F_SETFL
|
||||
SWI $0xa0005c // sys_fcntl
|
||||
RET
|
||||
|
||||
// TODO: this is only valid for ARMv7+
|
||||
TEXT ·publicationBarrier(SB),NOSPLIT|NOFRAME,$0-0
|
||||
B runtime·armPublicationBarrier(SB)
|
||||
|
@ -154,17 +154,6 @@ ok:
|
||||
MOVW R0, ret+24(FP)
|
||||
RET
|
||||
|
||||
// func pipe() (r, w int32, errno int32)
|
||||
TEXT runtime·pipe(SB),NOSPLIT|NOFRAME,$0-12
|
||||
ADD $8, RSP, R0
|
||||
MOVW $0, R1
|
||||
SVC $SYS_pipe2
|
||||
BCC pipeok
|
||||
NEG R0, R0
|
||||
pipeok:
|
||||
MOVW R0, errno+8(FP)
|
||||
RET
|
||||
|
||||
// func pipe2(flags int32) (r, w int32, errno int32)
|
||||
TEXT runtime·pipe2(SB),NOSPLIT|NOFRAME,$0-20
|
||||
ADD $16, RSP, R0
|
||||
@ -466,16 +455,3 @@ TEXT runtime·closeonexec(SB),NOSPLIT,$0
|
||||
MOVW $FD_CLOEXEC, R2
|
||||
SVC $SYS_fcntl
|
||||
RET
|
||||
|
||||
// func runtime·setNonblock(int32 fd)
|
||||
TEXT runtime·setNonblock(SB),NOSPLIT|NOFRAME,$0-4
|
||||
MOVW fd+0(FP), R0 // arg 1 - fd
|
||||
MOVD $F_GETFL, R1 // arg 2 - cmd
|
||||
MOVD $0, R2 // arg 3
|
||||
SVC $SYS_fcntl
|
||||
MOVD $O_NONBLOCK, R2
|
||||
EOR R0, R2 // arg 3 - flags
|
||||
MOVW fd+0(FP), R0 // arg 1 - fd
|
||||
MOVD $F_SETFL, R1 // arg 2 - cmd
|
||||
SVC $SYS_fcntl
|
||||
RET
|
||||
|
@ -111,10 +111,6 @@ func write1(fd uintptr, p unsafe.Pointer, n int32) int32 {
|
||||
}
|
||||
func write_trampoline()
|
||||
|
||||
func pipe() (r, w int32, errno int32) {
|
||||
return pipe2(0)
|
||||
}
|
||||
|
||||
func pipe2(flags int32) (r, w int32, errno int32) {
|
||||
var p [2]int32
|
||||
args := struct {
|
||||
@ -258,12 +254,6 @@ func closeonexec(fd int32) {
|
||||
fcntl(fd, _F_SETFD, _FD_CLOEXEC)
|
||||
}
|
||||
|
||||
//go:nosplit
|
||||
func setNonblock(fd int32) {
|
||||
flags := fcntl(fd, _F_GETFL, 0)
|
||||
fcntl(fd, _F_SETFL, flags|_O_NONBLOCK)
|
||||
}
|
||||
|
||||
// Tell the linker that the libc_* functions are to be found
|
||||
// in a system library, with the libc_ prefix missing.
|
||||
|
||||
|
@ -64,17 +64,6 @@ TEXT runtime·read(SB),NOSPLIT|NOFRAME,$0
|
||||
MOVW R2, ret+24(FP)
|
||||
RET
|
||||
|
||||
// func pipe() (r, w int32, errno int32)
|
||||
TEXT runtime·pipe(SB),NOSPLIT|NOFRAME,$0-12
|
||||
MOVV $r+0(FP), R4
|
||||
MOVW $0, R5
|
||||
MOVV $101, R2 // sys_pipe2
|
||||
SYSCALL
|
||||
BEQ R7, 2(PC)
|
||||
SUBVU R2, R0, R2 // caller expects negative errno
|
||||
MOVW R2, errno+8(FP)
|
||||
RET
|
||||
|
||||
// func pipe2(flags int32) (r, w int32, errno int32)
|
||||
TEXT runtime·pipe2(SB),NOSPLIT|NOFRAME,$0-20
|
||||
MOVV $r+8(FP), R4
|
||||
@ -383,18 +372,3 @@ TEXT runtime·closeonexec(SB),NOSPLIT,$0
|
||||
MOVV $92, R2 // sys_fcntl
|
||||
SYSCALL
|
||||
RET
|
||||
|
||||
// func runtime·setNonblock(int32 fd)
|
||||
TEXT runtime·setNonblock(SB),NOSPLIT|NOFRAME,$0-4
|
||||
MOVW fd+0(FP), R4 // arg 1 - fd
|
||||
MOVV $3, R5 // arg 2 - cmd (F_GETFL)
|
||||
MOVV $0, R6 // arg 3
|
||||
MOVV $92, R2 // sys_fcntl
|
||||
SYSCALL
|
||||
MOVV $4, R6 // O_NONBLOCK
|
||||
OR R2, R6 // arg 3 - flags
|
||||
MOVW fd+0(FP), R4 // arg 1 - fd
|
||||
MOVV $4, R5 // arg 2 - cmd (F_SETFL)
|
||||
MOVV $92, R2 // sys_fcntl
|
||||
SYSCALL
|
||||
RET
|
||||
|
Loading…
Reference in New Issue
Block a user