Skip to content

Commit

Permalink
misc/cgo/test: fix sigaltstack test on AIX
Browse files Browse the repository at this point in the history
Increase the size of the signal stack as the value given by SIGSTKSZ
is too small for the Go signal handler.

Fixes golang#37609

Change-Id: I56f1006bc69a2a9fb43f9e0da00061964290a690
Reviewed-on: https://go-review.googlesource.com/c/go/+/221804
Reviewed-by: Ian Lance Taylor <[email protected]>
Reviewed-by: Bryan C. Mills <[email protected]>
  • Loading branch information
Helflym authored and ianlancetaylor committed Mar 4, 2020
1 parent cd9fd64 commit cec0879
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions misc/cgo/test/sigaltstack.go
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down

0 comments on commit cec0879

Please sign in to comment.