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 5package runtime 6 7import "internal/abi" 8 9func cgoSigtramp() 10 11//go:nosplit 12//go:nowritebarrierrec 13func setsig(i uint32, fn uintptr) { 14 var sa sigactiont 15 sa.sa_flags = _SA_SIGINFO | _SA_ONSTACK | _SA_RESTART 16 sa.sa_mask = sigset_all 17 if fn == abi.FuncPCABIInternal(sighandler) { // abi.FuncPCABIInternal(sighandler) matches the callers in signal_unix.go 18 if iscgo { 19 fn = abi.FuncPCABI0(cgoSigtramp) 20 } else { 21 fn = abi.FuncPCABI0(sigtramp) 22 } 23 } 24 sa.sa_handler = fn 25 sigaction(i, &sa, nil) 26} 27