1 // Copyright 2015 The Go Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style
3 // license that can be found in the LICENSE file.
16 static void sigsegv() {
18 fprintf(stderr, "ERROR: C SIGSEGV not thrown on caught?.\n");
22 static void segvhandler(int signum) {
23 if (signum == SIGSEGV) {
24 fprintf(stdout, "ok\ttestsigfwd\n");
29 static void __attribute__ ((constructor)) sigsetup(void) {
32 memset(&act, 0, sizeof act);
33 act.sa_handler = segvhandler;
34 sigaction(SIGSEGV, &act, NULL);
44 fmt.Errorf("ERROR: couldn't raise SIGSEGV in Go.")
54 // Test that the signal originating in Go is handled (and recovered) by Go.
56 fmt.Errorf("couldn't recover from SIGSEGV in Go.")
60 // Test that the signal originating in C is handled by C.