github.com/geraldss/go/src@v0.0.0-20210511222824-ac7d0ebfc235/runtime/os_freebsd2.go (about)

     1  // Copyright 2011 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  // +build freebsd,!amd64
     6  
     7  package runtime
     8  
     9  //go:nosplit
    10  //go:nowritebarrierrec
    11  func setsig(i uint32, fn uintptr) {
    12  	var sa sigactiont
    13  	sa.sa_flags = _SA_SIGINFO | _SA_ONSTACK | _SA_RESTART
    14  	sa.sa_mask = sigset_all
    15  	if fn == funcPC(sighandler) {
    16  		fn = funcPC(sigtramp)
    17  	}
    18  	sa.sa_handler = fn
    19  	sigaction(i, &sa, nil)
    20  }