]> Cypherpunks repositories - gostls13.git/commit
runtime: call _exit, not exit, on AIX and Solaris
authorIan Lance Taylor <iant@golang.org>
Sat, 22 Apr 2023 01:48:38 +0000 (18:48 -0700)
committerGopher Robot <gobot@golang.org>
Mon, 24 Apr 2023 05:12:17 +0000 (05:12 +0000)
commit6bbbc5dc70e9e5698818d5c47b6536e72619884b
tree24a1d5c2224828e4549e2a604553da673c0c2e11
parenta5297f59a73aef5e965cd29b3e666836d6863243
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>
src/runtime/os2_aix.go
src/runtime/os3_solaris.go