Text file src/runtime/cgo/gcc_netbsd.c

     1  // Copyright 2009 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.
     4  
     5  //go:build netbsd
     6  
     7  #include <string.h>
     8  #include <signal.h>
     9  
    10  static void
    11  threadentry_platform(void)
    12  {
    13  	// On NetBSD, a new thread inherits the signal stack of the
    14  	// creating thread. That confuses minit, so we remove that
    15  	// signal stack here before calling the regular mstart. It's
    16  	// a bit baroque to remove a signal stack here only to add one
    17  	// in minit, but it's a simple change that keeps NetBSD
    18  	// working like other OS's. At this point all signals are
    19  	// blocked, so there is no race.
    20  	stack_t ss;
    21  	memset(&ss, 0, sizeof ss);
    22  	ss.ss_flags = SS_DISABLE;
    23  	sigaltstack(&ss, NULL);
    24  }
    25  
    26  void (*x_cgo_threadentry_platform)(void) = threadentry_platform;
    27  

View as plain text