Skip to content

Commit 6bbbc5d

Browse files
ianlancetaylorgopherbot
authored andcommitted
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 <[email protected]> Reviewed-by: Ian Lance Taylor <[email protected]> Run-TryBot: Ian Lance Taylor <[email protected]> TryBot-Result: Gopher Robot <[email protected]> Reviewed-by: Cherry Mui <[email protected]> Auto-Submit: Ian Lance Taylor <[email protected]>
1 parent a5297f5 commit 6bbbc5d

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

src/runtime/os2_aix.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ var (
3131
//go:cgo_import_dynamic libc__Errno _Errno "libc.a/shr_64.o"
3232
//go:cgo_import_dynamic libc_clock_gettime clock_gettime "libc.a/shr_64.o"
3333
//go:cgo_import_dynamic libc_close close "libc.a/shr_64.o"
34-
//go:cgo_import_dynamic libc_exit exit "libc.a/shr_64.o"
34+
//go:cgo_import_dynamic libc_exit _exit "libc.a/shr_64.o"
3535
//go:cgo_import_dynamic libc_getpid getpid "libc.a/shr_64.o"
3636
//go:cgo_import_dynamic libc_getsystemcfg getsystemcfg "libc.a/shr_64.o"
3737
//go:cgo_import_dynamic libc_kill kill "libc.a/shr_64.o"

src/runtime/os3_solaris.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ import (
1717

1818
//go:cgo_import_dynamic libc____errno ___errno "libc.so"
1919
//go:cgo_import_dynamic libc_clock_gettime clock_gettime "libc.so"
20-
//go:cgo_import_dynamic libc_exit exit "libc.so"
20+
//go:cgo_import_dynamic libc_exit _exit "libc.so"
2121
//go:cgo_import_dynamic libc_getcontext getcontext "libc.so"
2222
//go:cgo_import_dynamic libc_kill kill "libc.so"
2323
//go:cgo_import_dynamic libc_madvise madvise "libc.so"

0 commit comments

Comments
 (0)