mirror of
https://github.com/golang/go.git
synced 2025-12-08 06:10:04 +00:00
runtime: consolidate some low-level error reporting
Use a single writeErrStr function. Avoid using global variables. Use a single version of some error messages rather than duplicating the messages in OS-specific files. Change-Id: If259fbe78faf797f0a21337d14472160ca03efa0 Reviewed-on: https://go-review.googlesource.com/c/go/+/447055 Run-TryBot: Ian Lance Taylor <iant@golang.org> Run-TryBot: Ian Lance Taylor <iant@google.com> TryBot-Result: Gopher Robot <gobot@golang.org> Reviewed-by: Ian Lance Taylor <iant@google.com> Auto-Submit: Ian Lance Taylor <iant@google.com> Reviewed-by: Michael Knyszek <mknyszek@google.com>
This commit is contained in:
parent
fbf763fd1d
commit
79d9b395ad
9 changed files with 40 additions and 53 deletions
|
|
@ -1039,8 +1039,6 @@ func signalDuringFork(sig uint32) {
|
|||
throw("signal received during fork")
|
||||
}
|
||||
|
||||
var badginsignalMsg = "fatal: bad g in signal handler\n"
|
||||
|
||||
// This runs on a foreign stack, without an m or a g. No stack split.
|
||||
//
|
||||
//go:nosplit
|
||||
|
|
@ -1051,8 +1049,7 @@ func badsignal(sig uintptr, c *sigctxt) {
|
|||
// There is no extra M. needm will not be able to grab
|
||||
// an M. Instead of hanging, just crash.
|
||||
// Cannot call split-stack function as there is no G.
|
||||
s := stringStructOf(&badginsignalMsg)
|
||||
write(2, s.str, int32(s.len))
|
||||
writeErrStr("fatal: bad g in signal handler\n")
|
||||
exit(2)
|
||||
*(*uintptr)(unsafe.Pointer(uintptr(123))) = 2
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue