Browse Source

Use Goodbye to handle DB close on exit

master
Trevor Slocum 5 years ago
parent
commit
657bed599c
  1. 14
      Gopkg.lock
  2. 24
      sage.go
  3. 6
      vendor/github.com/dustin/go-humanize/.gitignore
  4. 17
      vendor/github.com/thecodeteam/goodbye/.gitignore
  5. 16
      vendor/github.com/thecodeteam/goodbye/.travis.yml
  6. 201
      vendor/github.com/thecodeteam/goodbye/LICENSE
  7. 113
      vendor/github.com/thecodeteam/goodbye/README.md
  8. 1
      vendor/github.com/thecodeteam/goodbye/VERSION
  9. 70
      vendor/github.com/thecodeteam/goodbye/example/example.go
  10. 217
      vendor/github.com/thecodeteam/goodbye/goodbye.go
  11. 5
      vendor/github.com/thecodeteam/goodbye/goodbye_doc.go
  12. 18
      vendor/github.com/thecodeteam/goodbye/goodbye_unix.go
  13. 18
      vendor/github.com/thecodeteam/goodbye/goodbye_windows.go
  14. 6
      vendor/golang.org/x/net/internal/socket/iovec_32bit.go
  15. 6
      vendor/golang.org/x/net/internal/socket/iovec_64bit.go
  16. 6
      vendor/golang.org/x/net/internal/socket/iovec_solaris_64bit.go
  17. 6
      vendor/golang.org/x/net/internal/socket/msghdr_bsdvar.go
  18. 6
      vendor/golang.org/x/net/internal/socket/msghdr_linux_32bit.go
  19. 6
      vendor/golang.org/x/net/internal/socket/msghdr_linux_64bit.go
  20. 6
      vendor/golang.org/x/net/internal/socket/msghdr_openbsd.go
  21. 6
      vendor/golang.org/x/net/internal/socket/msghdr_solaris_64bit.go
  22. 129
      vendor/golang.org/x/net/internal/socket/socket_go1_9_test.go
  23. 6
      vendor/golang.org/x/net/internal/socket/sys_posix.go
  24. 43
      vendor/golang.org/x/sys/unix/zerrors_freebsd_386.go
  25. 43
      vendor/golang.org/x/sys/unix/zerrors_freebsd_amd64.go
  26. 43
      vendor/golang.org/x/sys/unix/zerrors_freebsd_arm.go
  27. 0
      vendor/golang.org/x/sys/unix/zsysctl_openbsd_386.go
  28. 270
      vendor/golang.org/x/sys/unix/zsysctl_openbsd_amd64.go
  29. 270
      vendor/golang.org/x/sys/unix/zsysctl_openbsd_arm.go

14
Gopkg.lock generated

@ -17,7 +17,7 @@ @@ -17,7 +17,7 @@
branch = "master"
name = "github.com/dustin/go-humanize"
packages = ["."]
revision = "79e699ccd02f240a1f1fbbdcee7e64c1c12e41aa"
revision = "77ed807830b4df581417e7f89eb81d4872832b72"
[[projects]]
branch = "master"
@ -49,21 +49,27 @@ @@ -49,21 +49,27 @@
packages = ["."]
revision = "0362cd091b6b627bf9552d87ba15956d5e8bde32"
[[projects]]
branch = "master"
name = "github.com/thecodeteam/goodbye"
packages = ["."]
revision = "a83968bda2d37294a3541b7d2207fb6f5a3559a3"
[[projects]]
branch = "master"
name = "golang.org/x/net"
packages = ["proxy"]
revision = "0a9397675ba34b2845f758fe3cd68828369c6517"
revision = "a04bdaca5b32abe1c069418fb7088ae607de5bd0"
[[projects]]
branch = "master"
name = "golang.org/x/sys"
packages = ["unix"]
revision = "314a259e304ff91bd6985da2a7149bbf91237993"
revision = "43eea11bc92608addb41b8a406b0407495c106f6"
[solve-meta]
analyzer-name = "dep"
analyzer-version = 1
inputs-digest = "3ede8cd77942973b25c138dff8b4cf67d09b480442ffe164b6ede377d0f28d06"
inputs-digest = "9c816225227b0ce468b9f2438dc8e60932e6b037ead9708c5f8c980ae33cf8c3"
solver-name = "gps-cdcl"
solver-version = 1

24
sage.go

@ -19,6 +19,7 @@ package main @@ -19,6 +19,7 @@ package main
import (
"bufio"
"context"
"flag"
"fmt"
"log"
@ -26,18 +27,17 @@ import ( @@ -26,18 +27,17 @@ import (
"net/http"
_ "net/http/pprof"
"os"
"os/signal"
"path"
"regexp"
"strconv"
"strings"
"syscall"
"time"
"github.com/BurntSushi/toml"
"github.com/dustin/go-humanize"
irc "github.com/fluffle/goirc/client"
"github.com/mandykoh/markov"
"github.com/thecodeteam/goodbye"
)
type Config struct {
@ -281,11 +281,6 @@ func saveMemories() { @@ -281,11 +281,6 @@ func saveMemories() {
}
}
func terminate() {
self.Close()
os.Exit(0)
}
func main() {
flag.Parse()
rand.Seed(time.Now().UTC().UnixNano())
@ -354,12 +349,13 @@ func main() { @@ -354,12 +349,13 @@ func main() {
quit <- true
})
termc := make(chan os.Signal, 2)
signal.Notify(termc, os.Interrupt, syscall.SIGTERM)
go func() {
<-termc
terminate()
}()
ctx := context.Background()
defer goodbye.Exit(ctx, -1)
goodbye.Notify(ctx)
goodbye.Register(func(ctx context.Context, sig os.Signal) {
self.Close()
})
for {
log.Printf("Connecting to %s as %s...", config.Server, config.Nick)
@ -371,6 +367,4 @@ func main() { @@ -371,6 +367,4 @@ func main() {
log.Println("Disconnected...")
time.Sleep(30 * time.Second)
}
terminate()
}

6
vendor/github.com/dustin/go-humanize/.gitignore generated vendored

@ -1,6 +0,0 @@ @@ -1,6 +0,0 @@
#*
*.[568]
*.a
*~
[568].out
_*

17
vendor/github.com/thecodeteam/goodbye/.gitignore generated vendored

@ -0,0 +1,17 @@ @@ -0,0 +1,17 @@
/example/example
/example/example.exe
# Binaries for programs and plugins
*.exe
*.dll
*.so
*.dylib
# Test binary, build with `go test -c`
*.test
# Output of the go coverage tool, specifically when used with LiteIDE
*.out
# Project-local glide cache, RE: https://github.com/Masterminds/glide/issues/736
.glide/

16
vendor/github.com/thecodeteam/goodbye/.travis.yml generated vendored

@ -0,0 +1,16 @@ @@ -0,0 +1,16 @@
# Setting "sudo" to false forces Travis-CI to use its
# container-based build infrastructure, which has shorter
# queue times.
sudo: false
# Use the newer Travis-CI build templates based on the
# Debian Linux distribution "Trusty" release.
dist: trusty
# Select Go as the language used to run the buid.
language: go
go: 1.8.3
go_import_path: github.com/thecodeteam/goodbye
install: true
script: go test -v .

201
vendor/github.com/thecodeteam/goodbye/LICENSE generated vendored

@ -0,0 +1,201 @@ @@ -0,0 +1,201 @@
Apache License
Version 2.0, January 2004
http://www.apache.org/licenses/
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
1. Definitions.
"License" shall mean the terms and conditions for use, reproduction,
and distribution as defined by Sections 1 through 9 of this document.
"Licensor" shall mean the copyright owner or entity authorized by
the copyright owner that is granting the License.
"Legal Entity" shall mean the union of the acting entity and all
other entities that control, are controlled by, or are under common
control with that entity. For the purposes of this definition,
"control" means (i) the power, direct or indirect, to cause the
direction or management of such entity, whether by contract or
otherwise, or (ii) ownership of fifty percent (50%) or more of the
outstanding shares, or (iii) beneficial ownership of such entity.
"You" (or "Your") shall mean an individual or Legal Entity
exercising permissions granted by this License.
"Source" form shall mean the preferred form for making modifications,
including but not limited to software source code, documentation
source, and configuration files.
"Object" form shall mean any form resulting from mechanical
transformation or translation of a Source form, including but
not limited to compiled object code, generated documentation,
and conversions to other media types.
"Work" shall mean the work of authorship, whether in Source or
Object form, made available under the License, as indicated by a
copyright notice that is included in or attached to the work
(an example is provided in the Appendix below).
"Derivative Works" shall mean any work, whether in Source or Object
form, that is based on (or derived from) the Work and for which the
editorial revisions, annotations, elaborations, or other modifications
represent, as a whole, an original work of authorship. For the purposes
of this License, Derivative Works shall not include works that remain
separable from, or merely link (or bind by name) to the interfaces of,
the Work and Derivative Works thereof.
"Contribution" shall mean any work of authorship, including
the original version of the Work and any modifications or additions
to that Work or Derivative Works thereof, that is intentionally
submitted to Licensor for inclusion in the Work by the copyright owner
or by an individual or Legal Entity authorized to submit on behalf of
the copyright owner. For the purposes of this definition, "submitted"
means any form of electronic, verbal, or written communication sent
to the Licensor or its representatives, including but not limited to
communication on electronic mailing lists, source code control systems,
and issue tracking systems that are managed by, or on behalf of, the
Licensor for the purpose of discussing and improving the Work, but
excluding communication that is conspicuously marked or otherwise
designated in writing by the copyright owner as "Not a Contribution."
"Contributor" shall mean Licensor and any individual or Legal Entity
on behalf of whom a Contribution has been received by Licensor and
subsequently incorporated within the Work.
2. Grant of Copyright License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
copyright license to reproduce, prepare Derivative Works of,
publicly display, publicly perform, sublicense, and distribute the
Work and such Derivative Works in Source or Object form.
3. Grant of Patent License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
(except as stated in this section) patent license to make, have made,
use, offer to sell, sell, import, and otherwise transfer the Work,
where such license applies only to those patent claims licensable
by such Contributor that are necessarily infringed by their
Contribution(s) alone or by combination of their Contribution(s)
with the Work to which such Contribution(s) was submitted. If You
institute patent litigation against any entity (including a
cross-claim or counterclaim in a lawsuit) alleging that the Work
or a Contribution incorporated within the Work constitutes direct
or contributory patent infringement, then any patent licenses
granted to You under this License for that Work shall terminate
as of the date such litigation is filed.
4. Redistribution. You may reproduce and distribute copies of the
Work or Derivative Works thereof in any medium, with or without
modifications, and in Source or Object form, provided that You
meet the following conditions:
(a) You must give any other recipients of the Work or
Derivative Works a copy of this License; and
(b) You must cause any modified files to carry prominent notices
stating that You changed the files; and
(c) You must retain, in the Source form of any Derivative Works
that You distribute, all copyright, patent, trademark, and
attribution notices from the Source form of the Work,
excluding those notices that do not pertain to any part of
the Derivative Works; and
(d) If the Work includes a "NOTICE" text file as part of its
distribution, then any Derivative Works that You distribute must
include a readable copy of the attribution notices contained
within such NOTICE file, excluding those notices that do not
pertain to any part of the Derivative Works, in at least one
of the following places: within a NOTICE text file distributed
as part of the Derivative Works; within the Source form or
documentation, if provided along with the Derivative Works; or,
within a display generated by the Derivative Works, if and
wherever such third-party notices normally appear. The contents
of the NOTICE file are for informational purposes only and
do not modify the License. You may add Your own attribution
notices within Derivative Works that You distribute, alongside
or as an addendum to the NOTICE text from the Work, provided
that such additional attribution notices cannot be construed
as modifying the License.
You may add Your own copyright statement to Your modifications and
may provide additional or different license terms and conditions
for use, reproduction, or distribution of Your modifications, or
for any such Derivative Works as a whole, provided Your use,
reproduction, and distribution of the Work otherwise complies with
the conditions stated in this License.
5. Submission of Contributions. Unless You explicitly state otherwise,
any Contribution intentionally submitted for inclusion in the Work
by You to the Licensor shall be under the terms and conditions of
this License, without any additional terms or conditions.
Notwithstanding the above, nothing herein shall supersede or modify
the terms of any separate license agreement you may have executed
with Licensor regarding such Contributions.
6. Trademarks. This License does not grant permission to use the trade
names, trademarks, service marks, or product names of the Licensor,
except as required for reasonable and customary use in describing the
origin of the Work and reproducing the content of the NOTICE file.
7. Disclaimer of Warranty. Unless required by applicable law or
agreed to in writing, Licensor provides the Work (and each
Contributor provides its Contributions) on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
implied, including, without limitation, any warranties or conditions
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
PARTICULAR PURPOSE. You are solely responsible for determining the
appropriateness of using or redistributing the Work and assume any
risks associated with Your exercise of permissions under this License.
8. Limitation of Liability. In no event and under no legal theory,
whether in tort (including negligence), contract, or otherwise,
unless required by applicable law (such as deliberate and grossly
negligent acts) or agreed to in writing, shall any Contributor be
liable to You for damages, including any direct, indirect, special,
incidental, or consequential damages of any character arising as a
result of this License or out of the use or inability to use the
Work (including but not limited to damages for loss of goodwill,
work stoppage, computer failure or malfunction, or any and all
other commercial damages or losses), even if such Contributor
has been advised of the possibility of such damages.
9. Accepting Warranty or Additional Liability. While redistributing
the Work or Derivative Works thereof, You may choose to offer,
and charge a fee for, acceptance of support, warranty, indemnity,
or other liability obligations and/or rights consistent with this
License. However, in accepting such obligations, You may act only
on Your own behalf and on Your sole responsibility, not on behalf
of any other Contributor, and only if You agree to indemnify,
defend, and hold each Contributor harmless for any liability
incurred by, or claims asserted against, such Contributor by reason
of your accepting any such warranty or additional liability.
END OF TERMS AND CONDITIONS
APPENDIX: How to apply the Apache License to your work.
To apply the Apache License to your work, attach the following
boilerplate notice, with the fields enclosed by brackets "{}"
replaced with your own identifying information. (Don't include
the brackets!) The text should be enclosed in the appropriate
comment syntax for the file format. We also recommend that a
file or class name and description of purpose be included on the
same "printed page" as the copyright notice for easier
identification within third-party archives.
Copyright {yyyy} {name of copyright owner}
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.

113
vendor/github.com/thecodeteam/goodbye/README.md generated vendored

@ -0,0 +1,113 @@ @@ -0,0 +1,113 @@
# Goodbye
Goodbye is a Golang library that provides a standard way to execute code
when a process exits normally or due to a signal.
## Overview
The Goodbye library uses a `sync.Once` to ensure that the registered exit
handlers are executed only once -- whether as a result of the process exiting
normally or as a result of a received signal.
## Install
Say hello to goodbye with `go get github.com/thecodeteam/goodbye`.
## Example
There is an [`example`](./example/example.go) program that illustrates
how to use the Goodbye library:
```golang
package main
import (
"context"
"fmt"
"os"
"strings"
"github.com/thecodeteam/goodbye"
)
func main() {
// Create a context to use with the Goodbye library's functions.
ctx := context.Background()
// Always defer `goodbye.Exit` as early as possible since it is
// safe to execute no matter what.
defer goodbye.Exit(ctx, -1)
// Invoke `goodbye.Notify` to begin trapping signals this process
// might receive. The Notify function can specify which signals are
// trapped, but if none are specified then a default list is used.
// The default set is platform dependent. See the files
// "goodbye_GOOS.go" for more information.
goodbye.Notify(ctx)
// Register two functions that will be executed when this process
// exits.
goodbye.Register(func(ctx context.Context, sig os.Signal) {
fmt.Printf("1: %[1]d: %[1]s\n", sig)
})
goodbye.Register(func(ctx context.Context, sig os.Signal) {
fmt.Printf("2: %[1]d: %[1]s\n", sig)
})
// Register a function with a priority that is higher than the two
// handlers above. Since the default priority is 0, a priority of -1
// will ensure this function, registered last, is executed first.
goodbye.RegisterWithPriority(func(ctx context.Context, sig os.Signal) {
// Use the `goodbye.IsNormalExit` function in conjunction with
// the signal to determine if this is a signal-based exit. If it
// is then emit a leading newline character to place the desired
// text on a line after the `CTRL-C` if that was used to send
// SIGINT to the process.
//
// Note that the extra text is being printed inside the second,
// registered handler. This is because handlers are executed in
// reverse order -- the earlier a handler is registered, the later
// it is executed.
if !goodbye.IsNormalExit(sig) {
fmt.Println()
}
fmt.Printf("0: %[1]d: %[1]s\n", sig)
}, -1)
if len(os.Args) < 2 {
return
}
// If the program's first argument is "wait" then block until the
// program is killed with a signal -- either from the "kill" command
// or a CTRL-C.
if strings.EqualFold("wait", os.Args[1]) {
c := make(chan int)
<-c
}
}
```
### Example 1
This example shows how the exit handlers are invoked when the program
exits normally.
```bash
$ go run example/example.go
0: 0: nosig
1: 0: nosig
2: 0: nosig
```
Please note that the first registered exit handler was executed last.
### Example 2
This example shows how the exit handlers are executed when a signal is
received:
```bash
$ go run example/example.go wait
^C
0: 2: interrupt
1: 2: interrupt
2: 2: interrupt
```

1
vendor/github.com/thecodeteam/goodbye/VERSION generated vendored

@ -0,0 +1 @@ @@ -0,0 +1 @@
0.1.0

70
vendor/github.com/thecodeteam/goodbye/example/example.go generated vendored

@ -0,0 +1,70 @@ @@ -0,0 +1,70 @@
package main
import (
"context"
"fmt"
"os"
"strings"
"github.com/thecodeteam/goodbye"
)
func main() {
// Create a context to use with the Goodbye library's functions.
ctx := context.Background()
// Always defer `goodbye.Exit` as early as possible since it is
// safe to execute no matter what.
defer goodbye.Exit(ctx, -1)
// Invoke `goodbye.Notify` to begin trapping signals this process
// might receive. The Notify function can specify which signals are
// trapped, but if none are specified then a default list is used.
// The default set is platform dependent. See the files
// "goodbye_GOOS.go" for more information.
goodbye.Notify(ctx)
// Register two functions that will be executed when this process
// exits.
goodbye.Register(func(ctx context.Context, sig os.Signal) {
fmt.Printf("1: %[1]d: %[1]s\n", sig)
})
goodbye.Register(func(ctx context.Context, sig os.Signal) {
fmt.Printf("2: %[1]d: %[1]s\n", sig)
})
// Register a function with a priority that is higher than the two
// handlers above. Since the default priority is 0, a priority of -1
// will ensure this function, registered last, is executed first.
goodbye.RegisterWithPriority(func(ctx context.Context, sig os.Signal) {
// Use the `goodbye.IsNormalExit` function in conjunction with
// the signal to determine if this is a signal-based exit. If it
// is then emit a leading newline character to place the desired
// text on a line after the `CTRL-C` if that was used to send
// SIGINT to the process.
//
// Note that the extra text is being printed inside the second,
// registered handler. This is because handlers are executed in
// reverse order -- the earlier a handler is registered, the later
// it is executed.
if !goodbye.IsNormalExit(sig) {
fmt.Println()
}
fmt.Printf("0: %[1]d: %[1]s\n", sig)
}, -1)
if len(os.Args) < 2 {
return
}
// If the program's first argument is "wait" then block until the
// program is killed with a signal -- either from the "kill" command
// or a CTRL-C.
if strings.EqualFold("wait", os.Args[1]) {
c := make(chan int)
<-c
}
}

217
vendor/github.com/thecodeteam/goodbye/goodbye.go generated vendored

@ -0,0 +1,217 @@ @@ -0,0 +1,217 @@
// +build go1.8
package goodbye
import (
"context"
"fmt"
"os"
"os/signal"
"sort"
"sync"
)
// ExitHandler is a function that is registerd with the "Register" function
// and is invoked when this process exits, either normally or due to a process
// signal.
type ExitHandler func(ctx context.Context, s os.Signal)
type noSig struct {
}
func (s noSig) String() string {
return "nosig"
}
func (s noSig) Signal() {
}
func (s noSig) Format(f fmt.State, c rune) {
val := s.String()
if c == 'd' {
val = "0"
}
f.Write([]byte(val))
}
var (
// ExitCode is the exit code used by the Exit function if it is called
// with an exit code value of -1.
ExitCode int
// handlers is a list of exit handlers to invoke when the process exits
// or receives a signal that causes an exit behavior
handlers = map[int][]ExitHandler{}
handlersRWL sync.RWMutex
// noSigVal is provided to the handleOnce function when Exit is invoked
// so that exit handlers can use the IsNormalExit function to determine
// if the process is exiting normally or due to a process signal.
noSigVal noSig
// defaultSignals is the default list of signals and exit codes to use
// if the Notify function is invoked with an empty signals argument value
defaultSignals map[os.Signal]int
// notified is the list of signals that are trapped as a result of the
// Notify function. This list is what the Reset function uses when undoing
// the effects of the Notify function.
notified []os.Signal
// once is used by the handleOnce function to execute the exit handlers
// and os.Exit exactly once, regardless of how many times Exit is invoked
// or if a signal is received at the same time that Exit is invoked
once sync.Once
// lock is used to prevent the Exit, Notify, and Reset functions
// from being called concurrently.
lock sync.Mutex
)
// Register registers a function to be invoked when this process exits
// normally or due to a process signal.
//
// Handlers registered with this function are given a priority of 0.
func Register(f ExitHandler) {
RegisterWithPriority(f, 0)
}
// RegisterWithPriority registers a function to be invoked when
// this process exits normally or due to a process signal.
//
// The priority determines when an exit handler is executed. Handlers
// with a lower integer value execute first and higher integer values
// execute later. If multiple handlers share the same priority level
// then the handlers are invoked in the order in which they were
// registered.
func RegisterWithPriority(f ExitHandler, priority int) {
handlersRWL.Lock()
defer handlersRWL.Unlock()
if a, ok := handlers[priority]; !ok {
handlers[priority] = []ExitHandler{f}
} else {
handlers[priority] = append(a, f)
}
}
// IsNormalExit returns true if the program is exiting as a result of
// the Exit function being invoked versus a process signal.
func IsNormalExit(sig os.Signal) bool {
return sig == noSigVal
}
// Exit executes all of the registered exit handlers.
//
// The handlers may use the IsNormalExit function and the signal provided
// to the handler to check if the program is exiting normally or due to
// a process signal.
func Exit(ctx context.Context, exitCode int) {
lock.Lock()
defer lock.Unlock()
if exitCode < 0 {
exitCode = ExitCode
}
handleOnce(ctx, noSigVal, exitCode)
}
// Notify begins trapping the specified signals. This function should be
// invoked as early as possible by the executing program.
//
// The signals argument accepts a series of os.Signal values. Any os.Signal
// value in the list may be succeeded with an integer to be used as the
// process's exit code when the associated signal is received. By default
// the process will exit with an exit code of zero, indicating a graceful
// shutdown.
//
// The default value for the signals variadic depends on the operating
// system (OS):
//
// UNIX
// SIGKILL, 1, SIGHUP, 0, SIGINT, 0, SIGQUIT, 0, SIGTERM, 0
//
// Windows
// SIGKILL, 1, SIGHUP, 0, os.Interrupt, 0, SIGQUIT, 0, SIGTERM, 0
func Notify(ctx context.Context, signals ...interface{}) {
lock.Lock()
defer lock.Unlock()
var sigs map[os.Signal]int
if len(signals) == 0 {
sigs = defaultSignals
} else {
sigs = map[os.Signal]int{}
var s os.Signal
for _, v := range signals {
switch tv := v.(type) {
case os.Signal:
s = tv
sigs[s] = 0
case int:
sigs[s] = tv
}
}
}
var (
i = 0
sigc = make(chan os.Signal, 1)
notified = make([]os.Signal, len(sigs))
)
for s := range sigs {
notified[i] = s
i++
}
signal.Notify(sigc, notified...)
go func() {
for s := range sigc {
// Get the exit code associated with the signal. If no
// exit code exists then the signal was not trapped and
// should not be handled.
x, ok := sigs[s]
if !ok {
continue
}
// Execute the signal handlers and exit the program.
handleOnce(ctx, s, x)
}
}()
}
// Reset clears the list of registered exit handlers and stops trapping
// the signals that were trapped as a result of the Notify function.
func Reset() {
lock.Lock()
defer lock.Unlock()
signal.Reset(notified...)
handlersRWL.Lock()
defer handlersRWL.Unlock()
handlers = nil
}
func handleOnce(ctx context.Context, s os.Signal, x int) {
once.Do(func() {
handle(ctx, s)
os.Exit(x)
})
}
func handle(ctx context.Context, s os.Signal) {
handlersRWL.RLock()
defer handlersRWL.RUnlock()
keys := []int{}
for k := range handlers {
keys = append(keys, k)
}
sort.Ints(keys)
for _, k := range keys {
for _, h := range handlers[k] {
h(ctx, s)
}
}
}

5
vendor/github.com/thecodeteam/goodbye/goodbye_doc.go generated vendored

@ -0,0 +1,5 @@ @@ -0,0 +1,5 @@
/*
Package goodbye provides a standard way to execute code when a process
exits normally or due to a signal.
*/
package goodbye

18
vendor/github.com/thecodeteam/goodbye/goodbye_unix.go generated vendored

@ -0,0 +1,18 @@ @@ -0,0 +1,18 @@
// +build !windows
package goodbye
import (
"os"
"syscall"
)
func init() {
defaultSignals = map[os.Signal]int{
syscall.SIGKILL: 1,
syscall.SIGHUP: 0,
syscall.SIGINT: 0,
syscall.SIGQUIT: 0,
syscall.SIGTERM: 0,
}
}

18
vendor/github.com/thecodeteam/goodbye/goodbye_windows.go generated vendored

@ -0,0 +1,18 @@ @@ -0,0 +1,18 @@
// +build windows
package goodbye
import (
"os"
"syscall"
)
func init() {
defaultSignals = map[os.Signal]int{
syscall.SIGKILL: 1,
syscall.SIGHUP: 0,
os.Interrupt: 0,
syscall.SIGQUIT: 0,
syscall.SIGTERM: 0,
}
}

6
vendor/golang.org/x/net/internal/socket/iovec_32bit.go generated vendored

@ -10,6 +10,10 @@ package socket @@ -10,6 +10,10 @@ package socket
import "unsafe"
func (v *iovec) set(b []byte) {
l := len(b)
if l == 0 {
return
}
v.Base = (*byte)(unsafe.Pointer(&b[0]))
v.Len = uint32(len(b))
v.Len = uint32(l)
}

6
vendor/golang.org/x/net/internal/socket/iovec_64bit.go generated vendored

@ -10,6 +10,10 @@ package socket @@ -10,6 +10,10 @@ package socket
import "unsafe"
func (v *iovec) set(b []byte) {
l := len(b)
if l == 0 {
return
}
v.Base = (*byte)(unsafe.Pointer(&b[0]))
v.Len = uint64(len(b))
v.Len = uint64(l)
}

6
vendor/golang.org/x/net/internal/socket/iovec_solaris_64bit.go generated vendored

@ -10,6 +10,10 @@ package socket @@ -10,6 +10,10 @@ package socket
import "unsafe"
func (v *iovec) set(b []byte) {
l := len(b)
if l == 0 {
return
}
v.Base = (*int8)(unsafe.Pointer(&b[0]))
v.Len = uint64(len(b))
v.Len = uint64(l)
}

6
vendor/golang.org/x/net/internal/socket/msghdr_bsdvar.go generated vendored

@ -7,6 +7,10 @@ @@ -7,6 +7,10 @@
package socket
func (h *msghdr) setIov(vs []iovec) {
l := len(vs)
if l == 0 {
return
}
h.Iov = &vs[0]
h.Iovlen = int32(len(vs))
h.Iovlen = int32(l)
}

6
vendor/golang.org/x/net/internal/socket/msghdr_linux_32bit.go generated vendored

@ -10,8 +10,12 @@ package socket @@ -10,8 +10,12 @@ package socket
import "unsafe"
func (h *msghdr) setIov(vs []iovec) {
l := len(vs)
if l == 0 {
return
}
h.Iov = &vs[0]
h.Iovlen = uint32(len(vs))
h.Iovlen = uint32(l)
}
func (h *msghdr) setControl(b []byte) {

6
vendor/golang.org/x/net/internal/socket/msghdr_linux_64bit.go generated vendored

@ -10,8 +10,12 @@ package socket @@ -10,8 +10,12 @@ package socket
import "unsafe"
func (h *msghdr) setIov(vs []iovec) {
l := len(vs)
if l == 0 {
return
}
h.Iov = &vs[0]
h.Iovlen = uint64(len(vs))
h.Iovlen = uint64(l)
}
func (h *msghdr) setControl(b []byte) {

6
vendor/golang.org/x/net/internal/socket/msghdr_openbsd.go generated vendored

@ -5,6 +5,10 @@ @@ -5,6 +5,10 @@
package socket
func (h *msghdr) setIov(vs []iovec) {
l := len(vs)
if l == 0 {
return
}
h.Iov = &vs[0]
h.Iovlen = uint32(len(vs))
h.Iovlen = uint32(l)
}

6
vendor/golang.org/x/net/internal/socket/msghdr_solaris_64bit.go generated vendored

@ -13,8 +13,10 @@ func (h *msghdr) pack(vs []iovec, bs [][]byte, oob []byte, sa []byte) { @@ -13,8 +13,10 @@ func (h *msghdr) pack(vs []iovec, bs [][]byte, oob []byte, sa []byte) {
for i := range vs {
vs[i].set(bs[i])
}
h.Iov = &vs[0]
h.Iovlen = int32(len(vs))
if len(vs) > 0 {
h.Iov = &vs[0]
h.Iovlen = int32(len(vs))
}
if len(oob) > 0 {
h.Accrights = (*int8)(unsafe.Pointer(&oob[0]))
h.Accrightslen = int32(len(oob))

129
vendor/golang.org/x/net/internal/socket/socket_go1_9_test.go generated vendored

@ -119,81 +119,84 @@ func TestUDP(t *testing.T) { @@ -119,81 +119,84 @@ func TestUDP(t *testing.T) {
t.Skipf("not supported on %s/%s: %v", runtime.GOOS, runtime.GOARCH, err)
}
defer c.Close()
cc, err := socket.NewConn(c.(net.Conn))
if err != nil {
t.Fatal(err)
}
t.Run("Message", func(t *testing.T) {
testUDPMessage(t, c.(net.Conn))
data := []byte("HELLO-R-U-THERE")
wm := socket.Message{
Buffers: bytes.SplitAfter(data, []byte("-")),
Addr: c.LocalAddr(),
}
if err := cc.SendMsg(&wm, 0); err != nil {
t.Fatal(err)
}
b := make([]byte, 32)
rm := socket.Message{
Buffers: [][]byte{b[:1], b[1:3], b[3:7], b[7:11], b[11:]},
}
if err := cc.RecvMsg(&rm, 0); err != nil {
t.Fatal(err)
}
if !bytes.Equal(b[:rm.N], data) {
t.Fatalf("got %#v; want %#v", b[:rm.N], data)
}
})
switch runtime.GOOS {
case "linux":
case "android", "linux":
t.Run("Messages", func(t *testing.T) {
testUDPMessages(t, c.(net.Conn))
data := []byte("HELLO-R-U-THERE")
wmbs := bytes.SplitAfter(data, []byte("-"))
wms := []socket.Message{
{Buffers: wmbs[:1], Addr: c.LocalAddr()},
{Buffers: wmbs[1:], Addr: c.LocalAddr()},
}
n, err := cc.SendMsgs(wms, 0)
if err != nil {
t.Fatal(err)
}
if n != len(wms) {
t.Fatalf("got %d; want %d", n, len(wms))
}
b := make([]byte, 32)
rmbs := [][][]byte{{b[:len(wmbs[0])]}, {b[len(wmbs[0]):]}}
rms := []socket.Message{
{Buffers: rmbs[0]},
{Buffers: rmbs[1]},
}
n, err = cc.RecvMsgs(rms, 0)
if err != nil {
t.Fatal(err)
}
if n != len(rms) {
t.Fatalf("got %d; want %d", n, len(rms))
}
nn := 0
for i := 0; i < n; i++ {
nn += rms[i].N
}
if !bytes.Equal(b[:nn], data) {
t.Fatalf("got %#v; want %#v", b[:nn], data)
}
})
}
}
func testUDPMessage(t *testing.T, c net.Conn) {
cc, err := socket.NewConn(c)
if err != nil {
t.Fatal(err)
}
data := []byte("HELLO-R-U-THERE")
// The behavior of transmission for zero byte paylaod depends
// on each platform implementation. Some may transmit only
// protocol header and options, other may transmit nothing.
// We test only that SendMsg and SendMsgs will not crash with
// empty buffers.
wm := socket.Message{
Buffers: bytes.SplitAfter(data, []byte("-")),
Buffers: [][]byte{{}},
Addr: c.LocalAddr(),
}
if err := cc.SendMsg(&wm, 0); err != nil {
t.Fatal(err)
}
b := make([]byte, 32)
rm := socket.Message{
Buffers: [][]byte{b[:1], b[1:3], b[3:7], b[7:11], b[11:]},
}
if err := cc.RecvMsg(&rm, 0); err != nil {
t.Fatal(err)
}
if !bytes.Equal(b[:rm.N], data) {
t.Fatalf("got %#v; want %#v", b[:rm.N], data)
}
}
func testUDPMessages(t *testing.T, c net.Conn) {
cc, err := socket.NewConn(c)
if err != nil {
t.Fatal(err)
}
data := []byte("HELLO-R-U-THERE")
wmbs := bytes.SplitAfter(data, []byte("-"))
cc.SendMsg(&wm, 0)
wms := []socket.Message{
{Buffers: wmbs[:1], Addr: c.LocalAddr()},
{Buffers: wmbs[1:], Addr: c.LocalAddr()},
}
n, err := cc.SendMsgs(wms, 0)
if err != nil {
t.Fatal(err)
}
if n != len(wms) {
t.Fatalf("got %d; want %d", n, len(wms))
}
b := make([]byte, 32)
rmbs := [][][]byte{{b[:len(wmbs[0])]}, {b[len(wmbs[0]):]}}
rms := []socket.Message{
{Buffers: rmbs[0]},
{Buffers: rmbs[1]},
}
n, err = cc.RecvMsgs(rms, 0)
if err != nil {
t.Fatal(err)
}
if n != len(rms) {
t.Fatalf("got %d; want %d", n, len(rms))
}
nn := 0
for i := 0; i < n; i++ {
nn += rms[i].N
}
if !bytes.Equal(b[:nn], data) {
t.Fatalf("got %#v; want %#v", b[:nn], data)
{Buffers: [][]byte{{}}, Addr: c.LocalAddr()},
}
cc.SendMsgs(wms, 0)
}
func BenchmarkUDP(b *testing.B) {
@ -230,7 +233,7 @@ func BenchmarkUDP(b *testing.B) { @@ -230,7 +233,7 @@ func BenchmarkUDP(b *testing.B) {
}
})
switch runtime.GOOS {
case "linux":
case "android", "linux":
wms := make([]socket.Message, M)
for i := range wms {
wms[i].Buffers = [][]byte{data}

6
vendor/golang.org/x/net/internal/socket/sys_posix.go generated vendored

@ -34,7 +34,7 @@ func marshalSockaddr(ip net.IP, port int, zone string) []byte { @@ -34,7 +34,7 @@ func marshalSockaddr(ip net.IP, port int, zone string) []byte {
if ip4 := ip.To4(); ip4 != nil {
b := make([]byte, sizeofSockaddrInet)
switch runtime.GOOS {
case "linux", "solaris", "windows":
case "android", "linux", "solaris", "windows":
NativeEndian.PutUint16(b[:2], uint16(sysAF_INET))
default:
b[0] = sizeofSockaddrInet
@ -47,7 +47,7 @@ func marshalSockaddr(ip net.IP, port int, zone string) []byte { @@ -47,7 +47,7 @@ func marshalSockaddr(ip net.IP, port int, zone string) []byte {
if ip6 := ip.To16(); ip6 != nil && ip.To4() == nil {
b := make([]byte, sizeofSockaddrInet6)
switch runtime.GOOS {
case "linux", "solaris", "windows":
case "android", "linux", "solaris", "windows":
NativeEndian.PutUint16(b[:2], uint16(sysAF_INET6))
default:
b[0] = sizeofSockaddrInet6
@ -69,7 +69,7 @@ func parseInetAddr(b []byte, network string) (net.Addr, error) { @@ -69,7 +69,7 @@ func parseInetAddr(b []byte, network string) (net.Addr, error) {
}
var af int
switch runtime.GOOS {
case "linux", "solaris", "windows":
case "android", "linux", "solaris", "windows":
af = int(NativeEndian.Uint16(b[:2]))
default:
af = int(b[1])

43
vendor/golang.org/x/sys/unix/zerrors_freebsd_386.go generated vendored

@ -981,6 +981,49 @@ const ( @@ -981,6 +981,49 @@ const (
MAP_STACK = 0x400
MCL_CURRENT = 0x1
MCL_FUTURE = 0x2
MNT_ACLS = 0x8000000
MNT_ASYNC = 0x40
MNT_AUTOMOUNTED = 0x200000000
MNT_BYFSID = 0x8000000
MNT_CMDFLAGS = 0xd0f0000
MNT_DEFEXPORTED = 0x200
MNT_DELEXPORT = 0x20000
MNT_EXKERB = 0x800
MNT_EXPORTANON = 0x400
MNT_EXPORTED = 0x100
MNT_EXPUBLIC = 0x20000000
MNT_EXRDONLY = 0x80
MNT_FORCE = 0x80000
MNT_GJOURNAL = 0x2000000
MNT_IGNORE = 0x800000
MNT_LAZY = 0x3
MNT_LOCAL = 0x1000
MNT_MULTILABEL = 0x4000000
MNT_NFS4ACLS = 0x10
MNT_NOATIME = 0x10000000
MNT_NOCLUSTERR = 0x40000000
MNT_NOCLUSTERW = 0x80000000
MNT_NOEXEC = 0x4
MNT_NONBUSY = 0x4000000
MNT_NOSUID = 0x8
MNT_NOSYMFOLLOW = 0x400000
MNT_NOWAIT = 0x2
MNT_QUOTA = 0x2000
MNT_RDONLY = 0x1
MNT_RELOAD = 0x40000
MNT_ROOTFS = 0x4000
MNT_SNAPSHOT = 0x1000000
MNT_SOFTDEP = 0x200000
MNT_SUIDDIR = 0x100000
MNT_SUJ = 0x100000000
MNT_SUSPEND = 0x4
MNT_SYNCHRONOUS = 0x2
MNT_UNION = 0x20
MNT_UPDATE = 0x10000
MNT_UPDATEMASK = 0x2d8d0807e
MNT_USER = 0x8000
MNT_VISFLAGMASK = 0x3fef0ffff
MNT_WAIT = 0x1
MSG_CMSG_CLOEXEC = 0x40000
MSG_COMPAT = 0x8000
MSG_CTRUNC = 0x20

43
vendor/golang.org/x/sys/unix/zerrors_freebsd_amd64.go generated vendored

@ -982,6 +982,49 @@ const ( @@ -982,6 +982,49 @@ const (
MAP_STACK = 0x400
MCL_CURRENT = 0x1
MCL_FUTURE = 0x2
MNT_ACLS = 0x8000000
MNT_ASYNC = 0x40
MNT_AUTOMOUNTED = 0x200000000
MNT_BYFSID = 0x8000000
MNT_CMDFLAGS = 0xd0f0000
MNT_DEFEXPORTED = 0x200
MNT_DELEXPORT = 0x20000
MNT_EXKERB = 0x800
MNT_EXPORTANON = 0x400
MNT_EXPORTED = 0x100
MNT_EXPUBLIC = 0x20000000
MNT_EXRDONLY = 0x80
MNT_FORCE = 0x80000
MNT_GJOURNAL = 0x2000000
MNT_IGNORE = 0x800000
MNT_LAZY = 0x3
MNT_LOCAL = 0x1000
MNT_MULTILABEL = 0x4000000
MNT_NFS4ACLS = 0x10
MNT_NOATIME = 0x10000000
MNT_NOCLUSTERR = 0x40000000
MNT_NOCLUSTERW = 0x80000000
MNT_NOEXEC = 0x4
MNT_NONBUSY = 0x4000000
MNT_NOSUID = 0x8
MNT_NOSYMFOLLOW = 0x400000
MNT_NOWAIT = 0x2
MNT_QUOTA = 0x2000
MNT_RDONLY = 0x1
MNT_RELOAD = 0x40000
MNT_ROOTFS = 0x4000
MNT_SNAPSHOT = 0x1000000
MNT_SOFTDEP = 0x200000
MNT_SUIDDIR = 0x100000
MNT_SUJ = 0x100000000
MNT_SUSPEND = 0x4
MNT_SYNCHRONOUS = 0x2
MNT_UNION = 0x20
MNT_UPDATE = 0x10000
MNT_UPDATEMASK = 0x2d8d0807e
MNT_USER = 0x8000
MNT_VISFLAGMASK = 0x3fef0ffff
MNT_WAIT = 0x1
MSG_CMSG_CLOEXEC = 0x40000
MSG_COMPAT = 0x8000
MSG_CTRUNC = 0x20

43
vendor/golang.org/x/sys/unix/zerrors_freebsd_arm.go generated vendored

@ -989,6 +989,49 @@ const ( @@ -989,6 +989,49 @@ const (
MAP_STACK = 0x400
MCL_CURRENT = 0x1
MCL_FUTURE = 0x2
MNT_ACLS = 0x8000000
MNT_ASYNC = 0x40
MNT_AUTOMOUNTED = 0x200000000
MNT_BYFSID = 0x8000000
MNT_CMDFLAGS = 0xd0f0000
MNT_DEFEXPORTED = 0x200
MNT_DELEXPORT = 0x20000
MNT_EXKERB = 0x800
MNT_EXPORTANON = 0x400
MNT_EXPORTED = 0x100
MNT_EXPUBLIC = 0x20000000
MNT_EXRDONLY = 0x80
MNT_FORCE = 0x80000
MNT_GJOURNAL = 0x2000000
MNT_IGNORE = 0x800000
MNT_LAZY = 0x3
MNT_LOCAL = 0x1000
MNT_MULTILABEL = 0x4000000
MNT_NFS4ACLS = 0x10
MNT_NOATIME = 0x10000000
MNT_NOCLUSTERR = 0x40000000
MNT_NOCLUSTERW = 0x80000000
MNT_NOEXEC = 0x4
MNT_NONBUSY = 0x4000000
MNT_NOSUID = 0x8
MNT_NOSYMFOLLOW = 0x400000
MNT_NOWAIT = 0x2
MNT_QUOTA = 0x2000
MNT_RDONLY = 0x1
MNT_RELOAD = 0x40000
MNT_ROOTFS = 0x4000
MNT_SNAPSHOT = 0x1000000
MNT_SOFTDEP = 0x200000
MNT_SUIDDIR = 0x100000
MNT_SUJ = 0x100000000
MNT_SUSPEND = 0x4
MNT_SYNCHRONOUS = 0x2
MNT_UNION = 0x20
MNT_UPDATE = 0x10000
MNT_UPDATEMASK = 0x2d8d0807e
MNT_USER = 0x8000
MNT_VISFLAGMASK = 0x3fef0ffff
MNT_WAIT = 0x1
MSG_CMSG_CLOEXEC = 0x40000
MSG_COMPAT = 0x8000
MSG_CTRUNC = 0x20

0
vendor/golang.org/x/sys/unix/zsysctl_openbsd.go → vendor/golang.org/x/sys/unix/zsysctl_openbsd_386.go generated vendored

270
vendor/golang.org/x/sys/unix/zsysctl_openbsd_amd64.go generated vendored

@ -0,0 +1,270 @@ @@ -0,0 +1,270 @@
// mksysctl_openbsd.pl
// MACHINE GENERATED BY THE ABOVE COMMAND; DO NOT EDIT
package unix
type mibentry struct {
ctlname string
ctloid []_C_int
}
var sysctlMib = []mibentry{
{"ddb.console", []_C_int{9, 6}},
{"ddb.log", []_C_int{9, 7}},
{"ddb.max_line", []_C_int{9, 3}},
{"ddb.max_width", []_C_int{9, 2}},
{"ddb.panic", []_C_int{9, 5}},
{"ddb.radix", []_C_int{9, 1}},
{"ddb.tab_stop_width", []_C_int{9, 4}},
{"ddb.trigger", []_C_int{9, 8}},
{"fs.posix.setuid", []_C_int{3, 1, 1}},
{"hw.allowpowerdown", []_C_int{6, 22}},
{"hw.byteorder", []_C_int{6, 4}},
{"hw.cpuspeed", []_C_int{6, 12}},
{"hw.diskcount", []_C_int{6, 10}},
{"hw.disknames", []_C_int{6, 8}},
{"hw.diskstats", []_C_int{6, 9}},
{"hw.machine", []_C_int{6, 1}},
{"hw.model", []_C_int{6, 2}},
{"hw.ncpu", []_C_int{6, 3}},
{"hw.ncpufound", []_C_int{6, 21}},
{"hw.pagesize", []_C_int{6, 7}},
{"hw.physmem", []_C_int{6, 19}},
{"hw.product", []_C_int{6, 15}},
{"hw.serialno", []_C_int{6, 17}},
{"hw.setperf", []_C_int{6, 13}},
{"hw.usermem", []_C_int{6, 20}},
{"hw.uuid", []_C_int{6, 18}},
{"hw.vendor", []_C_int{6, 14}},
{"hw.version", []_C_int{6, 16}},
{"kern.arandom", []_C_int{1, 37}},
{"kern.argmax", []_C_int{1, 8}},
{"kern.boottime", []_C_int{1, 21}},
{"kern.bufcachepercent", []_C_int{1, 72}},
{"kern.ccpu", []_C_int{1, 45}},
{"kern.clockrate", []_C_int{1, 12}},
{"kern.consdev", []_C_int{1, 75}},
{"kern.cp_time", []_C_int{1, 40}},
{"kern.cp_time2", []_C_int{1, 71}},
{"kern.cryptodevallowsoft", []_C_int{1, 53}},
{"kern.domainname", []_C_int{1, 22}},
{"kern.file", []_C_int{1, 73}},
{"kern.forkstat", []_C_int{1, 42}},
{"kern.fscale", []_C_int{1, 46}},
{"kern.fsync", []_C_int{1, 33}},
{"kern.hostid", []_C_int{1, 11}},
{"kern.hostname", []_C_int{1, 10}},
{"kern.intrcnt.nintrcnt", []_C_int{1, 63, 1}},
{"kern.job_control", []_C_int{1, 19}},
{"kern.malloc.buckets", []_C_int{1, 39, 1}},
{"kern.malloc.kmemnames", []_C_int{1, 39, 3}},
{"kern.maxclusters", []_C_int{1, 67}},
{"kern.maxfiles", []_C_int{1, 7}},
{"kern.maxlocksperuid", []_C_int{1, 70}},
{"kern.maxpartitions", []_C_int{1, 23}},
{"kern.maxproc", []_C_int{1, 6}},
{"kern.maxthread", []_C_int{1, 25}},
{"kern.maxvnodes", []_C_int{1, 5}},
{"kern.mbstat", []_C_int{1, 59}},
{"kern.msgbuf", []_C_int{1, 48}},
{"kern.msgbufsize", []_C_int{1, 38}},
{"kern.nchstats", []_C_int{1, 41}},
{"kern.netlivelocks", []_C_int{1, 76}},
{"kern.nfiles", []_C_int{1, 56}},
{"kern.ngroups", []_C_int{1, 18}},
{"kern.nosuidcoredump", []_C_int{1, 32}},
{"kern.nprocs", []_C_int{1, 47}},
{"kern.nselcoll", []_C_int{1, 43}},
{"kern.nthreads", []_C_int{1, 26}},
{"kern.numvnodes", []_C_int{1, 58}},
{"kern.osrelease", []_C_int{1, 2}},
{"kern.osrevision", []_C_int{1, 3}},
{"kern.ostype", []_C_int{1, 1}},
{"kern.osversion", []_C_int{1, 27}},
{"kern.pool_debug", []_C_int{1, 77}},
{"kern.posix1version", []_C_int{1, 17}},
{"kern.proc", []_C_int{1, 66}},
{"kern.random", []_C_int{1, 31}},
{"kern.rawpartition", []_C_int{1, 24}},
{"kern.saved_ids", []_C_int{1, 20}},
{"kern.securelevel", []_C_int{1, 9}},
{"kern.seminfo", []_C_int{1, 61}},
{"kern.shminfo", []_C_int{1, 62}},
{"kern.somaxconn", []_C_int{1, 28}},
{"kern.sominconn", []_C_int{1, 29}},
{"kern.splassert", []_C_int{1, 54}},
{"kern.stackgap_random", []_C_int{1, 50}},
{"kern.sysvipc_info", []_C_int{1, 51}},
{"kern.sysvmsg", []_C_int{1, 34}},
{"kern.sysvsem", []_C_int{1, 35}},
{"kern.sysvshm", []_C_int{1, 36}},
{"kern.timecounter.choice", []_C_int{1, 69, 4}},