]> Cypherpunks repositories - gostls13.git/commitdiff
misc/cgo/test: fix sigaltstack test on AIX
authorClément Chigot <chigot.c@gmail.com>
Tue, 3 Mar 2020 15:24:32 +0000 (16:24 +0100)
committerIan Lance Taylor <iant@golang.org>
Wed, 4 Mar 2020 17:33:06 +0000 (17:33 +0000)
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 <iant@golang.org>
Reviewed-by: Bryan C. Mills <bcmills@google.com>
misc/cgo/test/sigaltstack.go

index 2c9b81ced7a9b550eabf2ff3f545efb098de8689..7b3f4acbb7569b6da88392be4ddcbbb73f16debd 100644 (file)
@@ -14,15 +14,22 @@ package cgotest
 #include <stdlib.h>
 #include <string.h>
 
+#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();