mirror of
https://github.com/golang/go
synced 2024-11-23 00:00:07 -07:00
runtime: call _exit, not exit, on AIX and Solaris
This is the AIX and Solaris equivalent of CL 269378. On AIX and Solaris, where we use libc for syscalls, when the runtime exits, it calls the libc exit function, which may call back into user code, such as invoking functions registered with atexit. In particular, it may call back into Go. But at this point, the Go runtime is already exiting, so this wouldn't work. On non-libc platforms we use exit syscall directly, which doesn't invoke any callbacks. Use _exit on AIX and Solaris to achieve the same behavior. Test is TestDestructorCallback. For #59711 Change-Id: I666f75538d3e3d8cf3b697b4c32f3ecde8332890 Reviewed-on: https://go-review.googlesource.com/c/go/+/487635 Run-TryBot: Ian Lance Taylor <iant@golang.org> Reviewed-by: Ian Lance Taylor <iant@google.com> Run-TryBot: Ian Lance Taylor <iant@google.com> TryBot-Result: Gopher Robot <gobot@golang.org> Reviewed-by: Cherry Mui <cherryyz@google.com> Auto-Submit: Ian Lance Taylor <iant@google.com>
This commit is contained in:
parent
a5297f59a7
commit
6bbbc5dc70
@ -31,7 +31,7 @@ var (
|
||||
//go:cgo_import_dynamic libc__Errno _Errno "libc.a/shr_64.o"
|
||||
//go:cgo_import_dynamic libc_clock_gettime clock_gettime "libc.a/shr_64.o"
|
||||
//go:cgo_import_dynamic libc_close close "libc.a/shr_64.o"
|
||||
//go:cgo_import_dynamic libc_exit exit "libc.a/shr_64.o"
|
||||
//go:cgo_import_dynamic libc_exit _exit "libc.a/shr_64.o"
|
||||
//go:cgo_import_dynamic libc_getpid getpid "libc.a/shr_64.o"
|
||||
//go:cgo_import_dynamic libc_getsystemcfg getsystemcfg "libc.a/shr_64.o"
|
||||
//go:cgo_import_dynamic libc_kill kill "libc.a/shr_64.o"
|
||||
|
@ -17,7 +17,7 @@ import (
|
||||
|
||||
//go:cgo_import_dynamic libc____errno ___errno "libc.so"
|
||||
//go:cgo_import_dynamic libc_clock_gettime clock_gettime "libc.so"
|
||||
//go:cgo_import_dynamic libc_exit exit "libc.so"
|
||||
//go:cgo_import_dynamic libc_exit _exit "libc.so"
|
||||
//go:cgo_import_dynamic libc_getcontext getcontext "libc.so"
|
||||
//go:cgo_import_dynamic libc_kill kill "libc.so"
|
||||
//go:cgo_import_dynamic libc_madvise madvise "libc.so"
|
||||
|
Loading…
Reference in New Issue
Block a user