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//go:build freebsd && !amd64
6
7package runtime
8
9import "internal/abi"
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		fn = abi.FuncPCABI0(sigtramp)
19	}
20	sa.sa_handler = fn
21	sigaction(i, &sa, nil)
22}
23