github.com/geraldss/go/src@v0.0.0-20210511222824-ac7d0ebfc235/runtime/os_freebsd_amd64.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 package runtime 6 7 func cgoSigtramp() 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 if iscgo { 17 fn = funcPC(cgoSigtramp) 18 } else { 19 fn = funcPC(sigtramp) 20 } 21 } 22 sa.sa_handler = fn 23 sigaction(i, &sa, nil) 24 }