From cec08794ef325e84f141e1a7b4deca0bedaeab34 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Cl=C3=A9ment=20Chigot?= Date: Tue, 3 Mar 2020 16:24:32 +0100 Subject: [PATCH] misc/cgo/test: fix sigaltstack test on AIX Increase the size of the signal stack as the value given by SIGSTKSZ is too small for the Go signal handler. Fixes #37609 Change-Id: I56f1006bc69a2a9fb43f9e0da00061964290a690 Reviewed-on: https://go-review.googlesource.com/c/go/+/221804 Reviewed-by: Ian Lance Taylor Reviewed-by: Bryan C. Mills --- misc/cgo/test/sigaltstack.go | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/misc/cgo/test/sigaltstack.go b/misc/cgo/test/sigaltstack.go index 2c9b81ced7..7b3f4acbb7 100644 --- a/misc/cgo/test/sigaltstack.go +++ b/misc/cgo/test/sigaltstack.go @@ -14,15 +14,22 @@ package cgotest #include #include +#ifdef _AIX +// On AIX, SIGSTKSZ is too small to handle Go sighandler. +#define CSIGSTKSZ 0x4000 +#else +#define CSIGSTKSZ SIGSTKSZ +#endif + static stack_t oss; -static char signalStack[SIGSTKSZ]; +static char signalStack[CSIGSTKSZ]; static void changeSignalStack(void) { stack_t ss; memset(&ss, 0, sizeof ss); ss.ss_sp = signalStack; ss.ss_flags = 0; - ss.ss_size = SIGSTKSZ; + ss.ss_size = CSIGSTKSZ; if (sigaltstack(&ss, &oss) < 0) { perror("sigaltstack"); abort(); -- 2.51.0