blob: f672162eaeb4505f3b3cfafbeb871644bc3c3608 [file] [log] [blame]
Russ Coxe785e3a2014-11-11 17:08:54 -05001// Copyright 2009 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
Vladimir Stefanovic272032d2016-10-18 23:51:01 +02005// +build !mips
6// +build !mipsle
Yao Zhang624f8452015-09-24 08:50:13 -04007// +build !mips64
8// +build !mips64le
Michael Munday0f08dd22016-03-18 19:02:52 -04009// +build !s390x
Ian Lance Taylor15937cc2016-10-06 15:14:58 -070010// +build !ppc64
Yao Zhang624f8452015-09-24 08:50:13 -040011// +build linux
12
Russ Coxe785e3a2014-11-11 17:08:54 -050013package runtime
14
15const (
16 _SS_DISABLE = 2
17 _NSIG = 65
18 _SI_USER = 0
Ian Lance Taylor872b1682015-07-21 22:34:48 -070019 _SIG_BLOCK = 0
20 _SIG_UNBLOCK = 1
Russ Coxe785e3a2014-11-11 17:08:54 -050021 _SIG_SETMASK = 2
22 _RLIMIT_AS = 9
23)
24
25// It's hard to tease out exactly how big a Sigset is, but
26// rt_sigprocmask crashes if we get it wrong, so if binaries
27// are running, this is right.
28type sigset [2]uint32
29
30type rlimit struct {
31 rlim_cur uintptr
32 rlim_max uintptr
33}
Brad Fitzpatrick8455f3a2016-04-06 04:38:00 +000034
35var sigset_all = sigset{^uint32(0), ^uint32(0)}
36
Ian Lance Taylorfdc16712016-09-27 13:42:28 -070037//go:nosplit
38//go:nowritebarrierrec
Brad Fitzpatrick8455f3a2016-04-06 04:38:00 +000039func sigaddset(mask *sigset, i int) {
40 (*mask)[(i-1)/32] |= 1 << ((uint32(i) - 1) & 31)
41}
42
43func sigdelset(mask *sigset, i int) {
44 (*mask)[(i-1)/32] &^= 1 << ((uint32(i) - 1) & 31)
45}
46
47func sigfillset(mask *uint64) {
48 *mask = ^uint64(0)
49}