Russ Cox | e785e3a | 2014-11-11 17:08:54 -0500 | [diff] [blame] | 1 | // 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 Stefanovic | 272032d | 2016-10-18 23:51:01 +0200 | [diff] [blame] | 5 | // +build !mips |
| 6 | // +build !mipsle |
Yao Zhang | 624f845 | 2015-09-24 08:50:13 -0400 | [diff] [blame] | 7 | // +build !mips64 |
| 8 | // +build !mips64le |
Michael Munday | 0f08dd2 | 2016-03-18 19:02:52 -0400 | [diff] [blame] | 9 | // +build !s390x |
Ian Lance Taylor | 15937cc | 2016-10-06 15:14:58 -0700 | [diff] [blame] | 10 | // +build !ppc64 |
Yao Zhang | 624f845 | 2015-09-24 08:50:13 -0400 | [diff] [blame] | 11 | // +build linux |
| 12 | |
Russ Cox | e785e3a | 2014-11-11 17:08:54 -0500 | [diff] [blame] | 13 | package runtime |
| 14 | |
| 15 | const ( |
| 16 | _SS_DISABLE = 2 |
| 17 | _NSIG = 65 |
| 18 | _SI_USER = 0 |
Ian Lance Taylor | 872b168 | 2015-07-21 22:34:48 -0700 | [diff] [blame] | 19 | _SIG_BLOCK = 0 |
| 20 | _SIG_UNBLOCK = 1 |
Russ Cox | e785e3a | 2014-11-11 17:08:54 -0500 | [diff] [blame] | 21 | _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. |
| 28 | type sigset [2]uint32 |
| 29 | |
| 30 | type rlimit struct { |
| 31 | rlim_cur uintptr |
| 32 | rlim_max uintptr |
| 33 | } |
Brad Fitzpatrick | 8455f3a | 2016-04-06 04:38:00 +0000 | [diff] [blame] | 34 | |
| 35 | var sigset_all = sigset{^uint32(0), ^uint32(0)} |
| 36 | |
Ian Lance Taylor | fdc1671 | 2016-09-27 13:42:28 -0700 | [diff] [blame] | 37 | //go:nosplit |
| 38 | //go:nowritebarrierrec |
Brad Fitzpatrick | 8455f3a | 2016-04-06 04:38:00 +0000 | [diff] [blame] | 39 | func sigaddset(mask *sigset, i int) { |
| 40 | (*mask)[(i-1)/32] |= 1 << ((uint32(i) - 1) & 31) |
| 41 | } |
| 42 | |
| 43 | func sigdelset(mask *sigset, i int) { |
| 44 | (*mask)[(i-1)/32] &^= 1 << ((uint32(i) - 1) & 31) |
| 45 | } |
| 46 | |
| 47 | func sigfillset(mask *uint64) { |
| 48 | *mask = ^uint64(0) |
| 49 | } |