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
7func cgoSigtramp()
8
9//go:nosplit
10//go:nowritebarrierrec
11func 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}
25