1
0
mirror of https://github.com/golang/go synced 2024-11-18 15:44:41 -07:00

runtime: adjust netpoll panic messages

Change-Id: I34547b057605bb9e1e2227c41867589348560244
Reviewed-on: https://go-review.googlesource.com/41513
Run-TryBot: Mikio Hara <mikioh.mikioh@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
This commit is contained in:
Mikio Hara 2017-04-24 18:37:48 +09:00
parent 5d306dcdac
commit 91c9b0d568
5 changed files with 36 additions and 35 deletions

View File

@ -105,10 +105,10 @@ func poll_runtime_pollOpen(fd uintptr) (*pollDesc, int) {
pd := pollcache.alloc()
lock(&pd.lock)
if pd.wg != 0 && pd.wg != pdReady {
throw("netpollOpen: blocked write on free descriptor")
throw("runtime: blocked write on free polldesc")
}
if pd.rg != 0 && pd.rg != pdReady {
throw("netpollOpen: blocked read on free descriptor")
throw("runtime: blocked read on free polldesc")
}
pd.fd = fd
pd.closing = false
@ -127,13 +127,13 @@ func poll_runtime_pollOpen(fd uintptr) (*pollDesc, int) {
//go:linkname poll_runtime_pollClose internal/poll.runtime_pollClose
func poll_runtime_pollClose(pd *pollDesc) {
if !pd.closing {
throw("netpollClose: close w/o unblock")
throw("runtime: close polldesc w/o unblock")
}
if pd.wg != 0 && pd.wg != pdReady {
throw("netpollClose: blocked write on closing descriptor")
throw("runtime: blocked write on closing polldesc")
}
if pd.rg != 0 && pd.rg != pdReady {
throw("netpollClose: blocked read on closing descriptor")
throw("runtime: blocked read on closing polldesc")
}
netpollclose(pd.fd)
pollcache.free(pd)
@ -264,7 +264,7 @@ func poll_runtime_pollSetDeadline(pd *pollDesc, d int64, mode int) {
func poll_runtime_pollUnblock(pd *pollDesc) {
lock(&pd.lock)
if pd.closing {
throw("netpollUnblock: already closing")
throw("runtime: unblock on closing polldesc")
}
pd.closing = true
pd.seq++
@ -352,7 +352,7 @@ func netpollblock(pd *pollDesc, mode int32, waitio bool) bool {
return true
}
if old != 0 {
throw("netpollblock: double wait")
throw("runtime: double wait")
}
if atomic.Casuintptr(gpp, 0, pdWait) {
break
@ -368,7 +368,7 @@ func netpollblock(pd *pollDesc, mode int32, waitio bool) bool {
// be careful to not lose concurrent READY notification
old := atomic.Xchguintptr(gpp, 0)
if old > pdWait {
throw("netpollblock: corrupted state")
throw("runtime: corrupted polldesc")
}
return old == pdReady
}
@ -414,7 +414,7 @@ func netpolldeadlineimpl(pd *pollDesc, seq uintptr, read, write bool) {
var rg *g
if read {
if pd.rd <= 0 || pd.rt.f == nil {
throw("netpolldeadlineimpl: inconsistent read deadline")
throw("runtime: inconsistent read deadline")
}
pd.rd = -1
atomicstorep(unsafe.Pointer(&pd.rt.f), nil) // full memory barrier between store to rd and load of rg in netpollunblock
@ -423,7 +423,7 @@ func netpolldeadlineimpl(pd *pollDesc, seq uintptr, read, write bool) {
var wg *g
if write {
if pd.wd <= 0 || pd.wt.f == nil && !read {
throw("netpolldeadlineimpl: inconsistent write deadline")
throw("runtime: inconsistent write deadline")
}
pd.wd = -1
atomicstorep(unsafe.Pointer(&pd.wt.f), nil) // full memory barrier between store to wd and load of wg in netpollunblock

View File

@ -32,8 +32,8 @@ func netpollinit() {
closeonexec(epfd)
return
}
println("netpollinit: failed to create epoll descriptor", -epfd)
throw("netpollinit: failed to create descriptor")
println("runtime: epollcreate failed with", -epfd)
throw("runtime: netpollinit failed")
}
func netpolldescriptor() uintptr {
@ -53,7 +53,7 @@ func netpollclose(fd uintptr) int32 {
}
func netpollarm(pd *pollDesc, mode int) {
throw("unused")
throw("runtime: unused")
}
// polls for ready network connections
@ -72,7 +72,7 @@ retry:
if n < 0 {
if n != -_EINTR {
println("runtime: epollwait on fd", epfd, "failed with", -n)
throw("epollwait failed")
throw("runtime: netpoll failed")
}
goto retry
}

View File

@ -23,8 +23,8 @@ var (
func netpollinit() {
kq = kqueue()
if kq < 0 {
println("netpollinit: kqueue failed with", -kq)
throw("netpollinit: kqueue failed")
println("runtime: kqueue failed with", -kq)
throw("runtime: netpollinit failed")
}
closeonexec(kq)
}
@ -60,7 +60,7 @@ func netpollclose(fd uintptr) int32 {
}
func netpollarm(pd *pollDesc, mode int) {
throw("unused")
throw("runtime: unused")
}
// Polls for ready network connections.
@ -80,7 +80,7 @@ retry:
if n < 0 {
if n != -_EINTR {
println("runtime: kevent on fd", kq, "failed with", -n)
throw("kevent failed")
throw("runtime: netpoll failed")
}
goto retry
}

View File

@ -117,8 +117,8 @@ func netpollinit() {
return
}
print("netpollinit: failed to create port (", errno(), ")\n")
throw("netpollinit: failed to create port")
print("runtime: port_create failed (errno=", errno(), ")\n")
throw("runtime: netpollinit failed")
}
func netpolldescriptor() uintptr {
@ -158,8 +158,8 @@ func netpollupdate(pd *pollDesc, set, clear uint32) {
}
if events != 0 && port_associate(portfd, _PORT_SOURCE_FD, pd.fd, events, uintptr(unsafe.Pointer(pd))) != 0 {
print("netpollupdate: failed to associate (", errno(), ")\n")
throw("netpollupdate: failed to associate")
print("runtime: port_associate failed (errno=", errno(), ")\n")
throw("runtime: netpollupdate failed")
}
pd.user = events
}
@ -173,7 +173,7 @@ func netpollarm(pd *pollDesc, mode int) {
case 'w':
netpollupdate(pd, _POLLOUT, 0)
default:
throw("netpollarm: bad mode")
throw("runtime: bad mode")
}
unlock(&pd.lock)
}
@ -196,8 +196,8 @@ retry:
var n uint32 = 1
if port_getn(portfd, &events[0], uint32(len(events)), &n, wait) < 0 {
if e := errno(); e != _EINTR {
print("runtime: port_getn on fd ", portfd, " failed with ", e, "\n")
throw("port_getn failed")
print("runtime: port_getn on fd ", portfd, " failed (errno=", e, ")\n")
throw("runtime: netpoll failed")
}
goto retry
}

View File

@ -36,8 +36,8 @@ var iocphandle uintptr = _INVALID_HANDLE_VALUE // completion port io handle
func netpollinit() {
iocphandle = stdcall4(_CreateIoCompletionPort, _INVALID_HANDLE_VALUE, 0, 0, _DWORD_MAX)
if iocphandle == 0 {
println("netpoll: failed to create iocp handle (errno=", getlasterror(), ")")
throw("netpoll: failed to create iocp handle")
println("runtime: CreateIoCompletionPort failed (errno=", getlasterror(), ")")
throw("runtime: netpollinit failed")
}
}
@ -58,7 +58,7 @@ func netpollclose(fd uintptr) int32 {
}
func netpollarm(pd *pollDesc, mode int) {
throw("unused")
throw("runtime: unused")
}
// Polls for completed network IO.
@ -94,8 +94,8 @@ retry:
if !block && errno == _WAIT_TIMEOUT {
return nil
}
println("netpoll: GetQueuedCompletionStatusEx failed (errno=", errno, ")")
throw("netpoll: GetQueuedCompletionStatusEx failed")
println("runtime: GetQueuedCompletionStatusEx failed (errno=", errno, ")")
throw("runtime: netpoll failed")
}
mp.blocked = false
for i = 0; i < n; i++ {
@ -121,8 +121,8 @@ retry:
return nil
}
if op == nil {
println("netpoll: GetQueuedCompletionStatus failed (errno=", errno, ")")
throw("netpoll: GetQueuedCompletionStatus failed")
println("runtime: GetQueuedCompletionStatus failed (errno=", errno, ")")
throw("runtime: netpoll failed")
}
// dequeued failed IO packet, so report that
}
@ -137,12 +137,13 @@ retry:
func handlecompletion(gpp *guintptr, op *net_op, errno int32, qty uint32) {
if op == nil {
throw("netpoll: GetQueuedCompletionStatus returned op == nil")
println("runtime: GetQueuedCompletionStatus returned op == nil")
throw("runtime: netpoll failed")
}
mode := op.mode
if mode != 'r' && mode != 'w' {
println("netpoll: GetQueuedCompletionStatus returned invalid mode=", mode)
throw("netpoll: GetQueuedCompletionStatus returned invalid mode")
println("runtime: GetQueuedCompletionStatus returned invalid mode=", mode)
throw("runtime: netpoll failed")
}
op.errno = errno
op.qty = qty