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