aboutsummaryrefslogtreecommitdiff
path: root/src/runtime/os_linux.go
diff options
context:
space:
mode:
authorIan Lance Taylor <iant@golang.org>2022-11-01 12:33:59 -0700
committerGopher Robot <gobot@golang.org>2022-11-10 18:51:20 +0000
commit79d9b395adf90f186617ee37800a18af0a7095ef (patch)
tree457be28ddf6ac4a92402a0fef146313bdebd83c8 /src/runtime/os_linux.go
parentfbf763fd1d6be3c162ea5ff3c8843171ef937c3a (diff)
downloadgo-79d9b395adf90f186617ee37800a18af0a7095ef.tar.xz
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>
Diffstat (limited to 'src/runtime/os_linux.go')
-rw-r--r--src/runtime/os_linux.go7
1 files changed, 2 insertions, 5 deletions
diff --git a/src/runtime/os_linux.go b/src/runtime/os_linux.go
index 9f1d405fa8..8e30ee338e 100644
--- a/src/runtime/os_linux.go
+++ b/src/runtime/os_linux.go
@@ -194,19 +194,16 @@ func newosproc(mp *m) {
func newosproc0(stacksize uintptr, fn unsafe.Pointer) {
stack := sysAlloc(stacksize, &memstats.stacks_sys)
if stack == nil {
- write(2, unsafe.Pointer(&failallocatestack[0]), int32(len(failallocatestack)))
+ writeErrStr(failallocatestack)
exit(1)
}
ret := clone(cloneFlags, unsafe.Pointer(uintptr(stack)+stacksize), nil, nil, fn)
if ret < 0 {
- write(2, unsafe.Pointer(&failthreadcreate[0]), int32(len(failthreadcreate)))
+ writeErrStr(failthreadcreate)
exit(1)
}
}
-var failallocatestack = []byte("runtime: failed to allocate stack for the new OS thread\n")
-var failthreadcreate = []byte("runtime: failed to create new OS thread\n")
-
const (
_AT_NULL = 0 // End of vector
_AT_PAGESZ = 6 // System physical page size