github.com/dannin/go@v0.0.0-20161031215817-d35dfd405eaa/src/runtime/os_linux_generic.go (about)

     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  
     5  // +build !mips64
     6  // +build !mips64le
     7  // +build !s390x
     8  // +build !ppc64
     9  // +build linux
    10  
    11  package runtime
    12  
    13  const (
    14  	_SS_DISABLE  = 2
    15  	_NSIG        = 65
    16  	_SI_USER     = 0
    17  	_SIG_BLOCK   = 0
    18  	_SIG_UNBLOCK = 1
    19  	_SIG_SETMASK = 2
    20  	_RLIMIT_AS   = 9
    21  )
    22  
    23  // It's hard to tease out exactly how big a Sigset is, but
    24  // rt_sigprocmask crashes if we get it wrong, so if binaries
    25  // are running, this is right.
    26  type sigset [2]uint32
    27  
    28  type rlimit struct {
    29  	rlim_cur uintptr
    30  	rlim_max uintptr
    31  }
    32  
    33  var sigset_all = sigset{^uint32(0), ^uint32(0)}
    34  
    35  //go:nosplit
    36  //go:nowritebarrierrec
    37  func sigaddset(mask *sigset, i int) {
    38  	(*mask)[(i-1)/32] |= 1 << ((uint32(i) - 1) & 31)
    39  }
    40  
    41  func sigdelset(mask *sigset, i int) {
    42  	(*mask)[(i-1)/32] &^= 1 << ((uint32(i) - 1) & 31)
    43  }
    44  
    45  func sigfillset(mask *uint64) {
    46  	*mask = ^uint64(0)
    47  }