summaryrefslogtreecommitdiffstats
path: root/vendor/golang.org/x/sys
diff options
context:
space:
mode:
authorWim <wim@42.be>2018-08-06 21:47:05 +0200
committerWim <wim@42.be>2018-08-06 21:47:05 +0200
commit51062863a5c34d81e296cf15c61140911037cf3b (patch)
tree9b5e044672486326c7a0ca8fb26430f37bf4d83c /vendor/golang.org/x/sys
parent4fb4b7aa6c02a54db8ad8dd98e4d321396926c0d (diff)
downloadmatterbridge-msglm-51062863a5c34d81e296cf15c61140911037cf3b.tar.gz
matterbridge-msglm-51062863a5c34d81e296cf15c61140911037cf3b.tar.bz2
matterbridge-msglm-51062863a5c34d81e296cf15c61140911037cf3b.zip
Use mod vendor for vendored directory (backwards compatible)
Diffstat (limited to 'vendor/golang.org/x/sys')
-rw-r--r--vendor/golang.org/x/sys/AUTHORS3
-rw-r--r--vendor/golang.org/x/sys/CONTRIBUTORS3
-rw-r--r--vendor/golang.org/x/sys/LICENSE (renamed from vendor/golang.org/x/sys/unix/LICENSE)0
-rw-r--r--vendor/golang.org/x/sys/PATENTS22
-rw-r--r--vendor/golang.org/x/sys/unix/.gitignore1
-rw-r--r--vendor/golang.org/x/sys/unix/README.md173
-rw-r--r--vendor/golang.org/x/sys/unix/linux/mkall.go482
-rw-r--r--vendor/golang.org/x/sys/unix/linux/types.go596
-rw-r--r--vendor/golang.org/x/sys/unix/mkall.sh188
-rw-r--r--vendor/golang.org/x/sys/unix/mkerrors.sh577
-rw-r--r--vendor/golang.org/x/sys/unix/mksyscall.pl328
-rw-r--r--vendor/golang.org/x/sys/unix/mksyscall_solaris.pl289
-rw-r--r--vendor/golang.org/x/sys/unix/mksysctl_openbsd.pl264
-rw-r--r--vendor/golang.org/x/sys/unix/mksysnum_darwin.pl39
-rw-r--r--vendor/golang.org/x/sys/unix/mksysnum_dragonfly.pl50
-rw-r--r--vendor/golang.org/x/sys/unix/mksysnum_freebsd.pl50
-rw-r--r--vendor/golang.org/x/sys/unix/mksysnum_netbsd.pl58
-rw-r--r--vendor/golang.org/x/sys/unix/mksysnum_openbsd.pl50
-rw-r--r--vendor/golang.org/x/sys/windows/LICENSE27
-rw-r--r--vendor/golang.org/x/sys/windows/registry/key.go200
-rw-r--r--vendor/golang.org/x/sys/windows/registry/mksyscall.go7
-rw-r--r--vendor/golang.org/x/sys/windows/registry/syscall.go32
-rw-r--r--vendor/golang.org/x/sys/windows/registry/value.go384
-rw-r--r--vendor/golang.org/x/sys/windows/registry/zsyscall_windows.go120
-rw-r--r--vendor/golang.org/x/sys/windows/svc/debug/log.go56
-rw-r--r--vendor/golang.org/x/sys/windows/svc/debug/service.go45
-rw-r--r--vendor/golang.org/x/sys/windows/svc/event.go48
-rw-r--r--vendor/golang.org/x/sys/windows/svc/eventlog/install.go80
-rw-r--r--vendor/golang.org/x/sys/windows/svc/eventlog/log.go70
-rw-r--r--vendor/golang.org/x/sys/windows/svc/example/beep.go22
-rw-r--r--vendor/golang.org/x/sys/windows/svc/example/install.go92
-rw-r--r--vendor/golang.org/x/sys/windows/svc/example/main.go76
-rw-r--r--vendor/golang.org/x/sys/windows/svc/example/manage.go62
-rw-r--r--vendor/golang.org/x/sys/windows/svc/example/service.go82
-rw-r--r--vendor/golang.org/x/sys/windows/svc/go12.c24
-rw-r--r--vendor/golang.org/x/sys/windows/svc/go12.go11
-rw-r--r--vendor/golang.org/x/sys/windows/svc/go13.go31
-rw-r--r--vendor/golang.org/x/sys/windows/svc/mgr/config.go139
-rw-r--r--vendor/golang.org/x/sys/windows/svc/mgr/mgr.go162
-rw-r--r--vendor/golang.org/x/sys/windows/svc/mgr/service.go72
-rw-r--r--vendor/golang.org/x/sys/windows/svc/security.go62
-rw-r--r--vendor/golang.org/x/sys/windows/svc/service.go363
-rw-r--r--vendor/golang.org/x/sys/windows/svc/sys_386.s68
-rw-r--r--vendor/golang.org/x/sys/windows/svc/sys_amd64.s42
44 files changed, 2095 insertions, 3455 deletions
diff --git a/vendor/golang.org/x/sys/AUTHORS b/vendor/golang.org/x/sys/AUTHORS
new file mode 100644
index 00000000..15167cd7
--- /dev/null
+++ b/vendor/golang.org/x/sys/AUTHORS
@@ -0,0 +1,3 @@
+# This source code refers to The Go Authors for copyright purposes.
+# The master list of authors is in the main Go distribution,
+# visible at http://tip.golang.org/AUTHORS.
diff --git a/vendor/golang.org/x/sys/CONTRIBUTORS b/vendor/golang.org/x/sys/CONTRIBUTORS
new file mode 100644
index 00000000..1c4577e9
--- /dev/null
+++ b/vendor/golang.org/x/sys/CONTRIBUTORS
@@ -0,0 +1,3 @@
+# This source code was written by the Go contributors.
+# The master list of contributors is in the main Go distribution,
+# visible at http://tip.golang.org/CONTRIBUTORS.
diff --git a/vendor/golang.org/x/sys/unix/LICENSE b/vendor/golang.org/x/sys/LICENSE
index 6a66aea5..6a66aea5 100644
--- a/vendor/golang.org/x/sys/unix/LICENSE
+++ b/vendor/golang.org/x/sys/LICENSE
diff --git a/vendor/golang.org/x/sys/PATENTS b/vendor/golang.org/x/sys/PATENTS
new file mode 100644
index 00000000..73309904
--- /dev/null
+++ b/vendor/golang.org/x/sys/PATENTS
@@ -0,0 +1,22 @@
+Additional IP Rights Grant (Patents)
+
+"This implementation" means the copyrightable works distributed by
+Google as part of the Go project.
+
+Google 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,
+transfer and otherwise run, modify and propagate the contents of this
+implementation of Go, where such license applies only to those patent
+claims, both currently owned or controlled by Google and acquired in
+the future, licensable by Google that are necessarily infringed by this
+implementation of Go. This grant does not include claims that would be
+infringed only as a consequence of further modification of this
+implementation. If you or your agent or exclusive licensee institute or
+order or agree to the institution of patent litigation against any
+entity (including a cross-claim or counterclaim in a lawsuit) alleging
+that this implementation of Go or any code incorporated within this
+implementation of Go constitutes direct or contributory patent
+infringement, or inducement of patent infringement, then any patent
+rights granted to you under this License for this implementation of Go
+shall terminate as of the date such litigation is filed.
diff --git a/vendor/golang.org/x/sys/unix/.gitignore b/vendor/golang.org/x/sys/unix/.gitignore
new file mode 100644
index 00000000..e4827159
--- /dev/null
+++ b/vendor/golang.org/x/sys/unix/.gitignore
@@ -0,0 +1 @@
+_obj/
diff --git a/vendor/golang.org/x/sys/unix/README.md b/vendor/golang.org/x/sys/unix/README.md
new file mode 100644
index 00000000..bc6f6031
--- /dev/null
+++ b/vendor/golang.org/x/sys/unix/README.md
@@ -0,0 +1,173 @@
+# Building `sys/unix`
+
+The sys/unix package provides access to the raw system call interface of the
+underlying operating system. See: https://godoc.org/golang.org/x/sys/unix
+
+Porting Go to a new architecture/OS combination or adding syscalls, types, or
+constants to an existing architecture/OS pair requires some manual effort;
+however, there are tools that automate much of the process.
+
+## Build Systems
+
+There are currently two ways we generate the necessary files. We are currently
+migrating the build system to use containers so the builds are reproducible.
+This is being done on an OS-by-OS basis. Please update this documentation as
+components of the build system change.
+
+### Old Build System (currently for `GOOS != "Linux" || GOARCH == "sparc64"`)
+
+The old build system generates the Go files based on the C header files
+present on your system. This means that files
+for a given GOOS/GOARCH pair must be generated on a system with that OS and
+architecture. This also means that the generated code can differ from system
+to system, based on differences in the header files.
+
+To avoid this, if you are using the old build system, only generate the Go
+files on an installation with unmodified header files. It is also important to
+keep track of which version of the OS the files were generated from (ex.
+Darwin 14 vs Darwin 15). This makes it easier to track the progress of changes
+and have each OS upgrade correspond to a single change.
+
+To build the files for your current OS and architecture, make sure GOOS and
+GOARCH are set correctly and run `mkall.sh`. This will generate the files for
+your specific system. Running `mkall.sh -n` shows the commands that will be run.
+
+Requirements: bash, perl, go
+
+### New Build System (currently for `GOOS == "Linux" && GOARCH != "sparc64"`)
+
+The new build system uses a Docker container to generate the go files directly
+from source checkouts of the kernel and various system libraries. This means
+that on any platform that supports Docker, all the files using the new build
+system can be generated at once, and generated files will not change based on
+what the person running the scripts has installed on their computer.
+
+The OS specific files for the new build system are located in the `${GOOS}`
+directory, and the build is coordinated by the `${GOOS}/mkall.go` program. When
+the kernel or system library updates, modify the Dockerfile at
+`${GOOS}/Dockerfile` to checkout the new release of the source.
+
+To build all the files under the new build system, you must be on an amd64/Linux
+system and have your GOOS and GOARCH set accordingly. Running `mkall.sh` will
+then generate all of the files for all of the GOOS/GOARCH pairs in the new build
+system. Running `mkall.sh -n` shows the commands that will be run.
+
+Requirements: bash, perl, go, docker
+
+## Component files
+
+This section describes the various files used in the code generation process.
+It also contains instructions on how to modify these files to add a new
+architecture/OS or to add additional syscalls, types, or constants. Note that
+if you are using the new build system, the scripts cannot be called normally.
+They must be called from within the docker container.
+
+### asm files
+
+The hand-written assembly file at `asm_${GOOS}_${GOARCH}.s` implements system
+call dispatch. There are three entry points:
+```
+ func Syscall(trap, a1, a2, a3 uintptr) (r1, r2, err uintptr)
+ func Syscall6(trap, a1, a2, a3, a4, a5, a6 uintptr) (r1, r2, err uintptr)
+ func RawSyscall(trap, a1, a2, a3 uintptr) (r1, r2, err uintptr)
+```
+The first and second are the standard ones; they differ only in how many
+arguments can be passed to the kernel. The third is for low-level use by the
+ForkExec wrapper. Unlike the first two, it does not call into the scheduler to
+let it know that a system call is running.
+
+When porting Go to an new architecture/OS, this file must be implemented for
+each GOOS/GOARCH pair.
+
+### mksysnum
+
+Mksysnum is a script located at `${GOOS}/mksysnum.pl` (or `mksysnum_${GOOS}.pl`
+for the old system). This script takes in a list of header files containing the
+syscall number declarations and parses them to produce the corresponding list of
+Go numeric constants. See `zsysnum_${GOOS}_${GOARCH}.go` for the generated
+constants.
+
+Adding new syscall numbers is mostly done by running the build on a sufficiently
+new installation of the target OS (or updating the source checkouts for the
+new build system). However, depending on the OS, you make need to update the
+parsing in mksysnum.
+
+### mksyscall.pl
+
+The `syscall.go`, `syscall_${GOOS}.go`, `syscall_${GOOS}_${GOARCH}.go` are
+hand-written Go files which implement system calls (for unix, the specific OS,
+or the specific OS/Architecture pair respectively) that need special handling
+and list `//sys` comments giving prototypes for ones that can be generated.
+
+The mksyscall.pl script takes the `//sys` and `//sysnb` comments and converts
+them into syscalls. This requires the name of the prototype in the comment to
+match a syscall number in the `zsysnum_${GOOS}_${GOARCH}.go` file. The function
+prototype can be exported (capitalized) or not.
+
+Adding a new syscall often just requires adding a new `//sys` function prototype
+with the desired arguments and a capitalized name so it is exported. However, if
+you want the interface to the syscall to be different, often one will make an
+unexported `//sys` prototype, an then write a custom wrapper in
+`syscall_${GOOS}.go`.
+
+### types files
+
+For each OS, there is a hand-written Go file at `${GOOS}/types.go` (or
+`types_${GOOS}.go` on the old system). This file includes standard C headers and
+creates Go type aliases to the corresponding C types. The file is then fed
+through godef to get the Go compatible definitions. Finally, the generated code
+is fed though mkpost.go to format the code correctly and remove any hidden or
+private identifiers. This cleaned-up code is written to
+`ztypes_${GOOS}_${GOARCH}.go`.
+
+The hardest part about preparing this file is figuring out which headers to
+include and which symbols need to be `#define`d to get the actual data
+structures that pass through to the kernel system calls. Some C libraries
+preset alternate versions for binary compatibility and translate them on the
+way in and out of system calls, but there is almost always a `#define` that can
+get the real ones.
+See `types_darwin.go` and `linux/types.go` for examples.
+
+To add a new type, add in the necessary include statement at the top of the
+file (if it is not already there) and add in a type alias line. Note that if
+your type is significantly different on different architectures, you may need
+some `#if/#elif` macros in your include statements.
+
+### mkerrors.sh
+
+This script is used to generate the system's various constants. This doesn't
+just include the error numbers and error strings, but also the signal numbers
+an a wide variety of miscellaneous constants. The constants come from the list
+of include files in the `includes_${uname}` variable. A regex then picks out
+the desired `#define` statements, and generates the corresponding Go constants.
+The error numbers and strings are generated from `#include <errno.h>`, and the
+signal numbers and strings are generated from `#include <signal.h>`. All of
+these constants are written to `zerrors_${GOOS}_${GOARCH}.go` via a C program,
+`_errors.c`, which prints out all the constants.
+
+To add a constant, add the header that includes it to the appropriate variable.
+Then, edit the regex (if necessary) to match the desired constant. Avoid making
+the regex too broad to avoid matching unintended constants.
+
+
+## Generated files
+
+### `zerror_${GOOS}_${GOARCH}.go`
+
+A file containing all of the system's generated error numbers, error strings,
+signal numbers, and constants. Generated by `mkerrors.sh` (see above).
+
+### `zsyscall_${GOOS}_${GOARCH}.go`
+
+A file containing all the generated syscalls for a specific GOOS and GOARCH.
+Generated by `mksyscall.pl` (see above).
+
+### `zsysnum_${GOOS}_${GOARCH}.go`
+
+A list of numeric constants for all the syscall number of the specific GOOS
+and GOARCH. Generated by mksysnum (see above).
+
+### `ztypes_${GOOS}_${GOARCH}.go`
+
+A file containing Go types for passing into (or returning from) syscalls.
+Generated by godefs and the types file (see above).
diff --git a/vendor/golang.org/x/sys/unix/linux/mkall.go b/vendor/golang.org/x/sys/unix/linux/mkall.go
deleted file mode 100644
index 89b2fe88..00000000
--- a/vendor/golang.org/x/sys/unix/linux/mkall.go
+++ /dev/null
@@ -1,482 +0,0 @@
-// Copyright 2017 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-// linux/mkall.go - Generates all Linux zsysnum, zsyscall, zerror, and ztype
-// files for all 11 linux architectures supported by the go compiler. See
-// README.md for more information about the build system.
-
-// To run it you must have a git checkout of the Linux kernel and glibc. Once
-// the appropriate sources are ready, the program is run as:
-// go run linux/mkall.go <linux_dir> <glibc_dir>
-
-// +build ignore
-
-package main
-
-import (
- "bufio"
- "bytes"
- "fmt"
- "io"
- "io/ioutil"
- "os"
- "os/exec"
- "path/filepath"
- "runtime"
- "strings"
- "unicode"
-)
-
-// These will be paths to the appropriate source directories.
-var LinuxDir string
-var GlibcDir string
-
-const TempDir = "/tmp"
-const IncludeDir = TempDir + "/include" // To hold our C headers
-const BuildDir = TempDir + "/build" // To hold intermediate build files
-
-const GOOS = "linux" // Only for Linux targets
-const BuildArch = "amd64" // Must be built on this architecture
-const MinKernel = "2.6.23" // https://golang.org/doc/install#requirements
-
-type target struct {
- GoArch string // Architecture name according to Go
- LinuxArch string // Architecture name according to the Linux Kernel
- GNUArch string // Architecture name according to GNU tools (https://wiki.debian.org/Multiarch/Tuples)
- BigEndian bool // Default Little Endian
- SignedChar bool // Is -fsigned-char needed (default no)
- Bits int
-}
-
-// List of the 11 Linux targets supported by the go compiler. sparc64 is not
-// currently supported, though a port is in progress.
-var targets = []target{
- {
- GoArch: "386",
- LinuxArch: "x86",
- GNUArch: "i686-linux-gnu", // Note "i686" not "i386"
- Bits: 32,
- },
- {
- GoArch: "amd64",
- LinuxArch: "x86",
- GNUArch: "x86_64-linux-gnu",
- Bits: 64,
- },
- {
- GoArch: "arm64",
- LinuxArch: "arm64",
- GNUArch: "aarch64-linux-gnu",
- SignedChar: true,
- Bits: 64,
- },
- {
- GoArch: "arm",
- LinuxArch: "arm",
- GNUArch: "arm-linux-gnueabi",
- Bits: 32,
- },
- {
- GoArch: "mips",
- LinuxArch: "mips",
- GNUArch: "mips-linux-gnu",
- BigEndian: true,
- Bits: 32,
- },
- {
- GoArch: "mipsle",
- LinuxArch: "mips",
- GNUArch: "mipsel-linux-gnu",
- Bits: 32,
- },
- {
- GoArch: "mips64",
- LinuxArch: "mips",
- GNUArch: "mips64-linux-gnuabi64",
- BigEndian: true,
- Bits: 64,
- },
- {
- GoArch: "mips64le",
- LinuxArch: "mips",
- GNUArch: "mips64el-linux-gnuabi64",
- Bits: 64,
- },
- {
- GoArch: "ppc64",
- LinuxArch: "powerpc",
- GNUArch: "powerpc64-linux-gnu",
- BigEndian: true,
- Bits: 64,
- },
- {
- GoArch: "ppc64le",
- LinuxArch: "powerpc",
- GNUArch: "powerpc64le-linux-gnu",
- Bits: 64,
- },
- {
- GoArch: "s390x",
- LinuxArch: "s390",
- GNUArch: "s390x-linux-gnu",
- BigEndian: true,
- SignedChar: true,
- Bits: 64,
- },
- // {
- // GoArch: "sparc64",
- // LinuxArch: "sparc",
- // GNUArch: "sparc64-linux-gnu",
- // BigEndian: true,
- // Bits: 64,
- // },
-}
-
-// ptracePairs is a list of pairs of targets that can, in some cases,
-// run each other's binaries.
-var ptracePairs = []struct{ a1, a2 string }{
- {"386", "amd64"},
- {"arm", "arm64"},
- {"mips", "mips64"},
- {"mipsle", "mips64le"},
-}
-
-func main() {
- if runtime.GOOS != GOOS || runtime.GOARCH != BuildArch {
- fmt.Printf("Build system has GOOS_GOARCH = %s_%s, need %s_%s\n",
- runtime.GOOS, runtime.GOARCH, GOOS, BuildArch)
- return
- }
-
- // Check that we are using the new build system if we should
- if os.Getenv("GOLANG_SYS_BUILD") != "docker" {
- fmt.Println("In the new build system, mkall.go should not be called directly.")
- fmt.Println("See README.md")
- return
- }
-
- // Parse the command line options
- if len(os.Args) != 3 {
- fmt.Println("USAGE: go run linux/mkall.go <linux_dir> <glibc_dir>")
- return
- }
- LinuxDir = os.Args[1]
- GlibcDir = os.Args[2]
-
- for _, t := range targets {
- fmt.Printf("----- GENERATING: %s -----\n", t.GoArch)
- if err := t.generateFiles(); err != nil {
- fmt.Printf("%v\n***** FAILURE: %s *****\n\n", err, t.GoArch)
- } else {
- fmt.Printf("----- SUCCESS: %s -----\n\n", t.GoArch)
- }
- }
-
- fmt.Printf("----- GENERATING ptrace pairs -----\n")
- ok := true
- for _, p := range ptracePairs {
- if err := generatePtracePair(p.a1, p.a2); err != nil {
- fmt.Printf("%v\n***** FAILURE: %s/%s *****\n\n", err, p.a1, p.a2)
- ok = false
- }
- }
- if ok {
- fmt.Printf("----- SUCCESS ptrace pairs -----\n\n")
- }
-}
-
-// Makes an exec.Cmd with Stderr attached to os.Stderr
-func makeCommand(name string, args ...string) *exec.Cmd {
- cmd := exec.Command(name, args...)
- cmd.Stderr = os.Stderr
- return cmd
-}
-
-// Runs the command, pipes output to a formatter, pipes that to an output file.
-func (t *target) commandFormatOutput(formatter string, outputFile string,
- name string, args ...string) (err error) {
- mainCmd := makeCommand(name, args...)
-
- fmtCmd := makeCommand(formatter)
- if formatter == "mkpost" {
- fmtCmd = makeCommand("go", "run", "mkpost.go")
- // Set GOARCH_TARGET so mkpost knows what GOARCH is..
- fmtCmd.Env = append(os.Environ(), "GOARCH_TARGET="+t.GoArch)
- // Set GOARCH to host arch for mkpost, so it can run natively.
- for i, s := range fmtCmd.Env {
- if strings.HasPrefix(s, "GOARCH=") {
- fmtCmd.Env[i] = "GOARCH=" + BuildArch
- }
- }
- }
-
- // mainCmd | fmtCmd > outputFile
- if fmtCmd.Stdin, err = mainCmd.StdoutPipe(); err != nil {
- return
- }
- if fmtCmd.Stdout, err = os.Create(outputFile); err != nil {
- return
- }
-
- // Make sure the formatter eventually closes
- if err = fmtCmd.Start(); err != nil {
- return
- }
- defer func() {
- fmtErr := fmtCmd.Wait()
- if err == nil {
- err = fmtErr
- }
- }()
-
- return mainCmd.Run()
-}
-
-// Generates all the files for a Linux target
-func (t *target) generateFiles() error {
- // Setup environment variables
- os.Setenv("GOOS", GOOS)
- os.Setenv("GOARCH", t.GoArch)
-
- // Get appropriate compiler and emulator (unless on x86)
- if t.LinuxArch != "x86" {
- // Check/Setup cross compiler
- compiler := t.GNUArch + "-gcc"
- if _, err := exec.LookPath(compiler); err != nil {
- return err
- }
- os.Setenv("CC", compiler)
-
- // Check/Setup emulator (usually first component of GNUArch)
- qemuArchName := t.GNUArch[:strings.Index(t.GNUArch, "-")]
- if t.LinuxArch == "powerpc" {
- qemuArchName = t.GoArch
- }
- os.Setenv("GORUN", "qemu-"+qemuArchName)
- } else {
- os.Setenv("CC", "gcc")
- }
-
- // Make the include directory and fill it with headers
- if err := os.MkdirAll(IncludeDir, os.ModePerm); err != nil {
- return err
- }
- defer os.RemoveAll(IncludeDir)
- if err := t.makeHeaders(); err != nil {
- return fmt.Errorf("could not make header files: %v", err)
- }
- fmt.Println("header files generated")
-
- // Make each of the four files
- if err := t.makeZSysnumFile(); err != nil {
- return fmt.Errorf("could not make zsysnum file: %v", err)
- }
- fmt.Println("zsysnum file generated")
-
- if err := t.makeZSyscallFile(); err != nil {
- return fmt.Errorf("could not make zsyscall file: %v", err)
- }
- fmt.Println("zsyscall file generated")
-
- if err := t.makeZTypesFile(); err != nil {
- return fmt.Errorf("could not make ztypes file: %v", err)
- }
- fmt.Println("ztypes file generated")
-
- if err := t.makeZErrorsFile(); err != nil {
- return fmt.Errorf("could not make zerrors file: %v", err)
- }
- fmt.Println("zerrors file generated")
-
- return nil
-}
-
-// Create the Linux and glibc headers in the include directory.
-func (t *target) makeHeaders() error {
- // Make the Linux headers we need for this architecture
- linuxMake := makeCommand("make", "headers_install", "ARCH="+t.LinuxArch, "INSTALL_HDR_PATH="+TempDir)
- linuxMake.Dir = LinuxDir
- if err := linuxMake.Run(); err != nil {
- return err
- }
-
- // A Temporary build directory for glibc
- if err := os.MkdirAll(BuildDir, os.ModePerm); err != nil {
- return err
- }
- defer os.RemoveAll(BuildDir)
-
- // Make the glibc headers we need for this architecture
- confScript := filepath.Join(GlibcDir, "configure")
- glibcConf := makeCommand(confScript, "--prefix="+TempDir, "--host="+t.GNUArch, "--enable-kernel="+MinKernel)
- glibcConf.Dir = BuildDir
- if err := glibcConf.Run(); err != nil {
- return err
- }
- glibcMake := makeCommand("make", "install-headers")
- glibcMake.Dir = BuildDir
- if err := glibcMake.Run(); err != nil {
- return err
- }
- // We only need an empty stubs file
- stubsFile := filepath.Join(IncludeDir, "gnu/stubs.h")
- if file, err := os.Create(stubsFile); err != nil {
- return err
- } else {
- file.Close()
- }
-
- return nil
-}
-
-// makes the zsysnum_linux_$GOARCH.go file
-func (t *target) makeZSysnumFile() error {
- zsysnumFile := fmt.Sprintf("zsysnum_linux_%s.go", t.GoArch)
- unistdFile := filepath.Join(IncludeDir, "asm/unistd.h")
-
- args := append(t.cFlags(), unistdFile)
- return t.commandFormatOutput("gofmt", zsysnumFile, "linux/mksysnum.pl", args...)
-}
-
-// makes the zsyscall_linux_$GOARCH.go file
-func (t *target) makeZSyscallFile() error {
- zsyscallFile := fmt.Sprintf("zsyscall_linux_%s.go", t.GoArch)
- // Find the correct architecture syscall file (might end with x.go)
- archSyscallFile := fmt.Sprintf("syscall_linux_%s.go", t.GoArch)
- if _, err := os.Stat(archSyscallFile); os.IsNotExist(err) {
- shortArch := strings.TrimSuffix(t.GoArch, "le")
- archSyscallFile = fmt.Sprintf("syscall_linux_%sx.go", shortArch)
- }
-
- args := append(t.mksyscallFlags(), "-tags", "linux,"+t.GoArch,
- "syscall_linux.go", archSyscallFile)
- return t.commandFormatOutput("gofmt", zsyscallFile, "./mksyscall.pl", args...)
-}
-
-// makes the zerrors_linux_$GOARCH.go file
-func (t *target) makeZErrorsFile() error {
- zerrorsFile := fmt.Sprintf("zerrors_linux_%s.go", t.GoArch)
-
- return t.commandFormatOutput("gofmt", zerrorsFile, "./mkerrors.sh", t.cFlags()...)
-}
-
-// makes the ztypes_linux_$GOARCH.go file
-func (t *target) makeZTypesFile() error {
- ztypesFile := fmt.Sprintf("ztypes_linux_%s.go", t.GoArch)
-
- args := []string{"tool", "cgo", "-godefs", "--"}
- args = append(args, t.cFlags()...)
- args = append(args, "linux/types.go")
- return t.commandFormatOutput("mkpost", ztypesFile, "go", args...)
-}
-
-// Flags that should be given to gcc and cgo for this target
-func (t *target) cFlags() []string {
- // Compile statically to avoid cross-architecture dynamic linking.
- flags := []string{"-Wall", "-Werror", "-static", "-I" + IncludeDir}
-
- // Architecture-specific flags
- if t.SignedChar {
- flags = append(flags, "-fsigned-char")
- }
- if t.LinuxArch == "x86" {
- flags = append(flags, fmt.Sprintf("-m%d", t.Bits))
- }
-
- return flags
-}
-
-// Flags that should be given to mksyscall for this target
-func (t *target) mksyscallFlags() (flags []string) {
- if t.Bits == 32 {
- if t.BigEndian {
- flags = append(flags, "-b32")
- } else {
- flags = append(flags, "-l32")
- }
- }
-
- // This flag menas a 64-bit value should use (even, odd)-pair.
- if t.GoArch == "arm" || (t.LinuxArch == "mips" && t.Bits == 32) {
- flags = append(flags, "-arm")
- }
- return
-}
-
-// generatePtracePair takes a pair of GOARCH values that can run each
-// other's binaries, such as 386 and amd64. It extracts the PtraceRegs
-// type for each one. It writes a new file defining the types
-// PtraceRegsArch1 and PtraceRegsArch2 and the corresponding functions
-// Ptrace{Get,Set}Regs{arch1,arch2}. This permits debugging the other
-// binary on a native system.
-func generatePtracePair(arch1, arch2 string) error {
- def1, err := ptraceDef(arch1)
- if err != nil {
- return err
- }
- def2, err := ptraceDef(arch2)
- if err != nil {
- return err
- }
- f, err := os.Create(fmt.Sprintf("zptrace%s_linux.go", arch1))
- if err != nil {
- return err
- }
- buf := bufio.NewWriter(f)
- fmt.Fprintf(buf, "// Code generated by linux/mkall.go generatePtracePair(%s, %s). DO NOT EDIT.\n", arch1, arch2)
- fmt.Fprintf(buf, "\n")
- fmt.Fprintf(buf, "// +build linux\n")
- fmt.Fprintf(buf, "// +build %s %s\n", arch1, arch2)
- fmt.Fprintf(buf, "\n")
- fmt.Fprintf(buf, "package unix\n")
- fmt.Fprintf(buf, "\n")
- fmt.Fprintf(buf, "%s\n", `import "unsafe"`)
- fmt.Fprintf(buf, "\n")
- writeOnePtrace(buf, arch1, def1)
- fmt.Fprintf(buf, "\n")
- writeOnePtrace(buf, arch2, def2)
- if err := buf.Flush(); err != nil {
- return err
- }
- if err := f.Close(); err != nil {
- return err
- }
- return nil
-}
-
-// ptraceDef returns the definition of PtraceRegs for arch.
-func ptraceDef(arch string) (string, error) {
- filename := fmt.Sprintf("ztypes_linux_%s.go", arch)
- data, err := ioutil.ReadFile(filename)
- if err != nil {
- return "", fmt.Errorf("reading %s: %v", filename, err)
- }
- start := bytes.Index(data, []byte("type PtraceRegs struct"))
- if start < 0 {
- return "", fmt.Errorf("%s: no definition of PtraceRegs", filename)
- }
- data = data[start:]
- end := bytes.Index(data, []byte("\n}\n"))
- if end < 0 {
- return "", fmt.Errorf("%s: can't find end of PtraceRegs definition", filename)
- }
- return string(data[:end+2]), nil
-}
-
-// writeOnePtrace writes out the ptrace definitions for arch.
-func writeOnePtrace(w io.Writer, arch, def string) {
- uarch := string(unicode.ToUpper(rune(arch[0]))) + arch[1:]
- fmt.Fprintf(w, "// PtraceRegs%s is the registers used by %s binaries.\n", uarch, arch)
- fmt.Fprintf(w, "%s\n", strings.Replace(def, "PtraceRegs", "PtraceRegs"+uarch, 1))
- fmt.Fprintf(w, "\n")
- fmt.Fprintf(w, "// PtraceGetRegs%s fetches the registers used by %s binaries.\n", uarch, arch)
- fmt.Fprintf(w, "func PtraceGetRegs%s(pid int, regsout *PtraceRegs%s) error {\n", uarch, uarch)
- fmt.Fprintf(w, "\treturn ptrace(PTRACE_GETREGS, pid, 0, uintptr(unsafe.Pointer(regsout)))\n")
- fmt.Fprintf(w, "}\n")
- fmt.Fprintf(w, "\n")
- fmt.Fprintf(w, "// PtraceSetRegs%s sets the registers used by %s binaries.\n", uarch, arch)
- fmt.Fprintf(w, "func PtraceSetRegs%s(pid int, regs *PtraceRegs%s) error {\n", uarch, uarch)
- fmt.Fprintf(w, "\treturn ptrace(PTRACE_SETREGS, pid, 0, uintptr(unsafe.Pointer(regs)))\n")
- fmt.Fprintf(w, "}\n")
-}
diff --git a/vendor/golang.org/x/sys/unix/linux/types.go b/vendor/golang.org/x/sys/unix/linux/types.go
deleted file mode 100644
index b4350f8b..00000000
--- a/vendor/golang.org/x/sys/unix/linux/types.go
+++ /dev/null
@@ -1,596 +0,0 @@
-// Copyright 2009 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-// +build ignore
-
-/*
-Input to cgo -godefs. See README.md
-*/
-
-// +godefs map struct_in_addr [4]byte /* in_addr */
-// +godefs map struct_in6_addr [16]byte /* in6_addr */
-
-package unix
-
-/*
-#define _LARGEFILE_SOURCE
-#define _LARGEFILE64_SOURCE
-#define _FILE_OFFSET_BITS 64
-#define _GNU_SOURCE
-
-#include <dirent.h>
-#include <netinet/in.h>
-#include <netinet/tcp.h>
-#include <netpacket/packet.h>
-#include <poll.h>
-#include <signal.h>
-#include <stdio.h>
-#include <sys/epoll.h>
-#include <sys/inotify.h>
-#include <sys/ioctl.h>
-#include <sys/mman.h>
-#include <sys/mount.h>
-#include <sys/param.h>
-#include <sys/ptrace.h>
-#include <sys/resource.h>
-#include <sys/select.h>
-#include <sys/signal.h>
-#include <sys/statfs.h>
-#include <sys/sysinfo.h>
-#include <sys/time.h>
-#include <sys/times.h>
-#include <sys/timex.h>
-#include <sys/un.h>
-#include <sys/user.h>
-#include <sys/utsname.h>
-#include <sys/wait.h>
-#include <linux/filter.h>
-#include <linux/keyctl.h>
-#include <linux/netlink.h>
-#include <linux/perf_event.h>
-#include <linux/rtnetlink.h>
-#include <linux/icmpv6.h>
-#include <asm/termbits.h>
-#include <asm/ptrace.h>
-#include <time.h>
-#include <unistd.h>
-#include <ustat.h>
-#include <utime.h>
-#include <linux/can.h>
-#include <linux/if_alg.h>
-#include <linux/fs.h>
-#include <linux/vm_sockets.h>
-#include <linux/random.h>
-#include <linux/taskstats.h>
-#include <linux/genetlink.h>
-
-// On mips64, the glibc stat and kernel stat do not agree
-#if (defined(__mips__) && _MIPS_SIM == _MIPS_SIM_ABI64)
-
-// Use the stat defined by the kernel with a few modifications. These are:
-// * The time fields (like st_atime and st_atimensec) use the timespec
-// struct (like st_atim) for consitancy with the glibc fields.
-// * The padding fields get different names to not break compatibility.
-// * st_blocks is signed, again for compatibility.
-struct stat {
- unsigned int st_dev;
- unsigned int st_pad1[3]; // Reserved for st_dev expansion
-
- unsigned long st_ino;
-
- mode_t st_mode;
- __u32 st_nlink;
-
- uid_t st_uid;
- gid_t st_gid;
-
- unsigned int st_rdev;
- unsigned int st_pad2[3]; // Reserved for st_rdev expansion
-
- off_t st_size;
-
- // These are declared as speperate fields in the kernel. Here we use
- // the timespec struct for consistancy with the other stat structs.
- struct timespec st_atim;
- struct timespec st_mtim;
- struct timespec st_ctim;
-
- unsigned int st_blksize;
- unsigned int st_pad4;
-
- long st_blocks;
-};
-
-// These are needed because we do not include fcntl.h or sys/types.h
-#include <linux/fcntl.h>
-#include <linux/fadvise.h>
-
-#else
-
-// Use the stat defined by glibc
-#include <fcntl.h>
-#include <sys/types.h>
-
-#endif
-
-#ifdef TCSETS2
-// On systems that have "struct termios2" use this as type Termios.
-typedef struct termios2 termios_t;
-#else
-typedef struct termios termios_t;
-#endif
-
-enum {
- sizeofPtr = sizeof(void*),
-};
-
-union sockaddr_all {
- struct sockaddr s1; // this one gets used for fields
- struct sockaddr_in s2; // these pad it out
- struct sockaddr_in6 s3;
- struct sockaddr_un s4;
- struct sockaddr_ll s5;
- struct sockaddr_nl s6;
-};
-
-struct sockaddr_any {
- struct sockaddr addr;
- char pad[sizeof(union sockaddr_all) - sizeof(struct sockaddr)];
-};
-
-// copied from /usr/include/bluetooth/hci.h
-struct sockaddr_hci {
- sa_family_t hci_family;
- unsigned short hci_dev;
- unsigned short hci_channel;
-};;
-
-// copied from /usr/include/linux/un.h
-struct my_sockaddr_un {
- sa_family_t sun_family;
-#if defined(__ARM_EABI__) || defined(__powerpc64__)
- // on ARM char is by default unsigned
- signed char sun_path[108];
-#else
- char sun_path[108];
-#endif
-};
-
-#ifdef __ARM_EABI__
-typedef struct user_regs PtraceRegs;
-#elif defined(__aarch64__)
-typedef struct user_pt_regs PtraceRegs;
-#elif defined(__mips__) || defined(__powerpc64__)
-typedef struct pt_regs PtraceRegs;
-#elif defined(__s390x__)
-typedef struct _user_regs_struct PtraceRegs;
-#elif defined(__sparc__)
-#include <asm/ptrace.h>
-typedef struct pt_regs PtraceRegs;
-#else
-typedef struct user_regs_struct PtraceRegs;
-#endif
-
-#if defined(__s390x__)
-typedef struct _user_psw_struct ptracePsw;
-typedef struct _user_fpregs_struct ptraceFpregs;
-typedef struct _user_per_struct ptracePer;
-#else
-typedef struct {} ptracePsw;
-typedef struct {} ptraceFpregs;
-typedef struct {} ptracePer;
-#endif
-
-// The real epoll_event is a union, and godefs doesn't handle it well.
-struct my_epoll_event {
- uint32_t events;
-#if defined(__ARM_EABI__) || defined(__aarch64__) || (defined(__mips__) && _MIPS_SIM == _ABIO32)
- // padding is not specified in linux/eventpoll.h but added to conform to the
- // alignment requirements of EABI
- int32_t padFd;
-#elif defined(__powerpc64__) || defined(__s390x__) || defined(__sparc__)
- int32_t _padFd;
-#endif
- int32_t fd;
- int32_t pad;
-};
-
-*/
-import "C"
-
-// Machine characteristics; for internal use.
-
-const (
- sizeofPtr = C.sizeofPtr
- sizeofShort = C.sizeof_short
- sizeofInt = C.sizeof_int
- sizeofLong = C.sizeof_long
- sizeofLongLong = C.sizeof_longlong
- PathMax = C.PATH_MAX
-)
-
-// Basic types
-
-type (
- _C_short C.short
- _C_int C.int
- _C_long C.long
- _C_long_long C.longlong
-)
-
-// Time
-
-type Timespec C.struct_timespec
-
-type Timeval C.struct_timeval
-
-type Timex C.struct_timex
-
-type Time_t C.time_t
-
-type Tms C.struct_tms
-
-type Utimbuf C.struct_utimbuf
-
-// Processes
-
-type Rusage C.struct_rusage
-
-type Rlimit C.struct_rlimit
-
-type _Gid_t C.gid_t
-
-// Files
-
-type Stat_t C.struct_stat
-
-type Statfs_t C.struct_statfs
-
-type Dirent C.struct_dirent
-
-type Fsid C.fsid_t
-
-type Flock_t C.struct_flock
-
-// Filesystem Encryption
-
-type FscryptPolicy C.struct_fscrypt_policy
-
-type FscryptKey C.struct_fscrypt_key
-
-// Structure for Keyctl
-
-type KeyctlDHParams C.struct_keyctl_dh_params
-
-// Advice to Fadvise
-
-const (
- FADV_NORMAL = C.POSIX_FADV_NORMAL
- FADV_RANDOM = C.POSIX_FADV_RANDOM
- FADV_SEQUENTIAL = C.POSIX_FADV_SEQUENTIAL
- FADV_WILLNEED = C.POSIX_FADV_WILLNEED
- FADV_DONTNEED = C.POSIX_FADV_DONTNEED
- FADV_NOREUSE = C.POSIX_FADV_NOREUSE
-)
-
-// Sockets
-
-type RawSockaddrInet4 C.struct_sockaddr_in
-
-type RawSockaddrInet6 C.struct_sockaddr_in6
-
-type RawSockaddrUnix C.struct_my_sockaddr_un
-
-type RawSockaddrLinklayer C.struct_sockaddr_ll
-
-type RawSockaddrNetlink C.struct_sockaddr_nl
-
-type RawSockaddrHCI C.struct_sockaddr_hci
-
-type RawSockaddrCAN C.struct_sockaddr_can
-
-type RawSockaddrALG C.struct_sockaddr_alg
-
-type RawSockaddrVM C.struct_sockaddr_vm
-
-type RawSockaddr C.struct_sockaddr
-
-type RawSockaddrAny C.struct_sockaddr_any
-
-type _Socklen C.socklen_t
-
-type Linger C.struct_linger
-
-type Iovec C.struct_iovec
-
-type IPMreq C.struct_ip_mreq
-
-type IPMreqn C.struct_ip_mreqn
-
-type IPv6Mreq C.struct_ipv6_mreq
-
-type PacketMreq C.struct_packet_mreq
-
-type Msghdr C.struct_msghdr
-
-type Cmsghdr C.struct_cmsghdr
-
-type Inet4Pktinfo C.struct_in_pktinfo
-
-type Inet6Pktinfo C.struct_in6_pktinfo
-
-type IPv6MTUInfo C.struct_ip6_mtuinfo
-
-type ICMPv6Filter C.struct_icmp6_filter
-
-type Ucred C.struct_ucred
-
-type TCPInfo C.struct_tcp_info
-
-const (
- SizeofSockaddrInet4 = C.sizeof_struct_sockaddr_in
- SizeofSockaddrInet6 = C.sizeof_struct_sockaddr_in6
- SizeofSockaddrAny = C.sizeof_struct_sockaddr_any
- SizeofSockaddrUnix = C.sizeof_struct_sockaddr_un
- SizeofSockaddrLinklayer = C.sizeof_struct_sockaddr_ll
- SizeofSockaddrNetlink = C.sizeof_struct_sockaddr_nl
- SizeofSockaddrHCI = C.sizeof_struct_sockaddr_hci
- SizeofSockaddrCAN = C.sizeof_struct_sockaddr_can
- SizeofSockaddrALG = C.sizeof_struct_sockaddr_alg
- SizeofSockaddrVM = C.sizeof_struct_sockaddr_vm
- SizeofLinger = C.sizeof_struct_linger
- SizeofIovec = C.sizeof_struct_iovec
- SizeofIPMreq = C.sizeof_struct_ip_mreq
- SizeofIPMreqn = C.sizeof_struct_ip_mreqn
- SizeofIPv6Mreq = C.sizeof_struct_ipv6_mreq
- SizeofPacketMreq = C.sizeof_struct_packet_mreq
- SizeofMsghdr = C.sizeof_struct_msghdr
- SizeofCmsghdr = C.sizeof_struct_cmsghdr
- SizeofInet4Pktinfo = C.sizeof_struct_in_pktinfo
- SizeofInet6Pktinfo = C.sizeof_struct_in6_pktinfo
- SizeofIPv6MTUInfo = C.sizeof_struct_ip6_mtuinfo
- SizeofICMPv6Filter = C.sizeof_struct_icmp6_filter
- SizeofUcred = C.sizeof_struct_ucred
- SizeofTCPInfo = C.sizeof_struct_tcp_info
-)
-
-// Netlink routing and interface messages
-
-const (
- IFA_UNSPEC = C.IFA_UNSPEC
- IFA_ADDRESS = C.IFA_ADDRESS
- IFA_LOCAL = C.IFA_LOCAL
- IFA_LABEL = C.IFA_LABEL
- IFA_BROADCAST = C.IFA_BROADCAST
- IFA_ANYCAST = C.IFA_ANYCAST
- IFA_CACHEINFO = C.IFA_CACHEINFO
- IFA_MULTICAST = C.IFA_MULTICAST
- IFLA_UNSPEC = C.IFLA_UNSPEC
- IFLA_ADDRESS = C.IFLA_ADDRESS
- IFLA_BROADCAST = C.IFLA_BROADCAST
- IFLA_IFNAME = C.IFLA_IFNAME
- IFLA_MTU = C.IFLA_MTU
- IFLA_LINK = C.IFLA_LINK
- IFLA_QDISC = C.IFLA_QDISC
- IFLA_STATS = C.IFLA_STATS
- IFLA_COST = C.IFLA_COST
- IFLA_PRIORITY = C.IFLA_PRIORITY
- IFLA_MASTER = C.IFLA_MASTER
- IFLA_WIRELESS = C.IFLA_WIRELESS
- IFLA_PROTINFO = C.IFLA_PROTINFO
- IFLA_TXQLEN = C.IFLA_TXQLEN
- IFLA_MAP = C.IFLA_MAP
- IFLA_WEIGHT = C.IFLA_WEIGHT
- IFLA_OPERSTATE = C.IFLA_OPERSTATE
- IFLA_LINKMODE = C.IFLA_LINKMODE
- IFLA_LINKINFO = C.IFLA_LINKINFO
- IFLA_NET_NS_PID = C.IFLA_NET_NS_PID
- IFLA_IFALIAS = C.IFLA_IFALIAS
- IFLA_MAX = C.IFLA_MAX
- RT_SCOPE_UNIVERSE = C.RT_SCOPE_UNIVERSE
- RT_SCOPE_SITE = C.RT_SCOPE_SITE
- RT_SCOPE_LINK = C.RT_SCOPE_LINK
- RT_SCOPE_HOST = C.RT_SCOPE_HOST
- RT_SCOPE_NOWHERE = C.RT_SCOPE_NOWHERE
- RT_TABLE_UNSPEC = C.RT_TABLE_UNSPEC
- RT_TABLE_COMPAT = C.RT_TABLE_COMPAT
- RT_TABLE_DEFAULT = C.RT_TABLE_DEFAULT
- RT_TABLE_MAIN = C.RT_TABLE_MAIN
- RT_TABLE_LOCAL = C.RT_TABLE_LOCAL
- RT_TABLE_MAX = C.RT_TABLE_MAX
- RTA_UNSPEC = C.RTA_UNSPEC
- RTA_DST = C.RTA_DST
- RTA_SRC = C.RTA_SRC
- RTA_IIF = C.RTA_IIF
- RTA_OIF = C.RTA_OIF
- RTA_GATEWAY = C.RTA_GATEWAY
- RTA_PRIORITY = C.RTA_PRIORITY
- RTA_PREFSRC = C.RTA_PREFSRC
- RTA_METRICS = C.RTA_METRICS
- RTA_MULTIPATH = C.RTA_MULTIPATH
- RTA_FLOW = C.RTA_FLOW
- RTA_CACHEINFO = C.RTA_CACHEINFO
- RTA_TABLE = C.RTA_TABLE
- RTN_UNSPEC = C.RTN_UNSPEC
- RTN_UNICAST = C.RTN_UNICAST
- RTN_LOCAL = C.RTN_LOCAL
- RTN_BROADCAST = C.RTN_BROADCAST
- RTN_ANYCAST = C.RTN_ANYCAST
- RTN_MULTICAST = C.RTN_MULTICAST
- RTN_BLACKHOLE = C.RTN_BLACKHOLE
- RTN_UNREACHABLE = C.RTN_UNREACHABLE
- RTN_PROHIBIT = C.RTN_PROHIBIT
- RTN_THROW = C.RTN_THROW
- RTN_NAT = C.RTN_NAT
- RTN_XRESOLVE = C.RTN_XRESOLVE
- RTNLGRP_NONE = C.RTNLGRP_NONE
- RTNLGRP_LINK = C.RTNLGRP_LINK
- RTNLGRP_NOTIFY = C.RTNLGRP_NOTIFY
- RTNLGRP_NEIGH = C.RTNLGRP_NEIGH
- RTNLGRP_TC = C.RTNLGRP_TC
- RTNLGRP_IPV4_IFADDR = C.RTNLGRP_IPV4_IFADDR
- RTNLGRP_IPV4_MROUTE = C.RTNLGRP_IPV4_MROUTE
- RTNLGRP_IPV4_ROUTE = C.RTNLGRP_IPV4_ROUTE
- RTNLGRP_IPV4_RULE = C.RTNLGRP_IPV4_RULE
- RTNLGRP_IPV6_IFADDR = C.RTNLGRP_IPV6_IFADDR
- RTNLGRP_IPV6_MROUTE = C.RTNLGRP_IPV6_MROUTE
- RTNLGRP_IPV6_ROUTE = C.RTNLGRP_IPV6_ROUTE
- RTNLGRP_IPV6_IFINFO = C.RTNLGRP_IPV6_IFINFO
- RTNLGRP_IPV6_PREFIX = C.RTNLGRP_IPV6_PREFIX
- RTNLGRP_IPV6_RULE = C.RTNLGRP_IPV6_RULE
- RTNLGRP_ND_USEROPT = C.RTNLGRP_ND_USEROPT
- SizeofNlMsghdr = C.sizeof_struct_nlmsghdr
- SizeofNlMsgerr = C.sizeof_struct_nlmsgerr
- SizeofRtGenmsg = C.sizeof_struct_rtgenmsg
- SizeofNlAttr = C.sizeof_struct_nlattr
- SizeofRtAttr = C.sizeof_struct_rtattr
- SizeofIfInfomsg = C.sizeof_struct_ifinfomsg
- SizeofIfAddrmsg = C.sizeof_struct_ifaddrmsg
- SizeofRtMsg = C.sizeof_struct_rtmsg
- SizeofRtNexthop = C.sizeof_struct_rtnexthop
-)
-
-type NlMsghdr C.struct_nlmsghdr
-
-type NlMsgerr C.struct_nlmsgerr
-
-type RtGenmsg C.struct_rtgenmsg
-
-type NlAttr C.struct_nlattr
-
-type RtAttr C.struct_rtattr
-
-type IfInfomsg C.struct_ifinfomsg
-
-type IfAddrmsg C.struct_ifaddrmsg
-
-type RtMsg C.struct_rtmsg
-
-type RtNexthop C.struct_rtnexthop
-
-// Linux socket filter
-
-const (
- SizeofSockFilter = C.sizeof_struct_sock_filter
- SizeofSockFprog = C.sizeof_struct_sock_fprog
-)
-
-type SockFilter C.struct_sock_filter
-
-type SockFprog C.struct_sock_fprog
-
-// Inotify
-
-type InotifyEvent C.struct_inotify_event
-
-const SizeofInotifyEvent = C.sizeof_struct_inotify_event
-
-// Ptrace
-
-// Register structures
-type PtraceRegs C.PtraceRegs
-
-// Structures contained in PtraceRegs on s390x (exported by mkpost.go)
-type PtracePsw C.ptracePsw
-
-type PtraceFpregs C.ptraceFpregs
-
-type PtracePer C.ptracePer
-
-// Misc
-
-type FdSet C.fd_set
-
-type Sysinfo_t C.struct_sysinfo
-
-type Utsname C.struct_utsname
-
-type Ustat_t C.struct_ustat
-
-type EpollEvent C.struct_my_epoll_event
-
-const (
- AT_FDCWD = C.AT_FDCWD
- AT_NO_AUTOMOUNT = C.AT_NO_AUTOMOUNT
- AT_REMOVEDIR = C.AT_REMOVEDIR
- AT_SYMLINK_FOLLOW = C.AT_SYMLINK_FOLLOW
- AT_SYMLINK_NOFOLLOW = C.AT_SYMLINK_NOFOLLOW
-)
-
-type PollFd C.struct_pollfd
-
-const (
- POLLIN = C.POLLIN
- POLLPRI = C.POLLPRI
- POLLOUT = C.POLLOUT
- POLLRDHUP = C.POLLRDHUP
- POLLERR = C.POLLERR
- POLLHUP = C.POLLHUP
- POLLNVAL = C.POLLNVAL
-)
-
-type Sigset_t C.sigset_t
-
-const RNDGETENTCNT = C.RNDGETENTCNT
-
-const PERF_IOC_FLAG_GROUP = C.PERF_IOC_FLAG_GROUP
-
-// Terminal handling
-
-type Termios C.termios_t
-
-type Winsize C.struct_winsize
-
-// Taskstats
-
-type Taskstats C.struct_taskstats
-
-const (
- TASKSTATS_CMD_UNSPEC = C.TASKSTATS_CMD_UNSPEC
- TASKSTATS_CMD_GET = C.TASKSTATS_CMD_GET
- TASKSTATS_CMD_NEW = C.TASKSTATS_CMD_NEW
- TASKSTATS_TYPE_UNSPEC = C.TASKSTATS_TYPE_UNSPEC
- TASKSTATS_TYPE_PID = C.TASKSTATS_TYPE_PID
- TASKSTATS_TYPE_TGID = C.TASKSTATS_TYPE_TGID
- TASKSTATS_TYPE_STATS = C.TASKSTATS_TYPE_STATS
- TASKSTATS_TYPE_AGGR_PID = C.TASKSTATS_TYPE_AGGR_PID
- TASKSTATS_TYPE_AGGR_TGID = C.TASKSTATS_TYPE_AGGR_TGID
- TASKSTATS_TYPE_NULL = C.TASKSTATS_TYPE_NULL
- TASKSTATS_CMD_ATTR_UNSPEC = C.TASKSTATS_CMD_ATTR_UNSPEC
- TASKSTATS_CMD_ATTR_PID = C.TASKSTATS_CMD_ATTR_PID
- TASKSTATS_CMD_ATTR_TGID = C.TASKSTATS_CMD_ATTR_TGID
- TASKSTATS_CMD_ATTR_REGISTER_CPUMASK = C.TASKSTATS_CMD_ATTR_REGISTER_CPUMASK
- TASKSTATS_CMD_ATTR_DEREGISTER_CPUMASK = C.TASKSTATS_CMD_ATTR_DEREGISTER_CPUMASK
-)
-
-// Generic netlink
-
-type Genlmsghdr C.struct_genlmsghdr
-
-const (
- CTRL_CMD_UNSPEC = C.CTRL_CMD_UNSPEC
- CTRL_CMD_NEWFAMILY = C.CTRL_CMD_NEWFAMILY
- CTRL_CMD_DELFAMILY = C.CTRL_CMD_DELFAMILY
- CTRL_CMD_GETFAMILY = C.CTRL_CMD_GETFAMILY
- CTRL_CMD_NEWOPS = C.CTRL_CMD_NEWOPS
- CTRL_CMD_DELOPS = C.CTRL_CMD_DELOPS
- CTRL_CMD_GETOPS = C.CTRL_CMD_GETOPS
- CTRL_CMD_NEWMCAST_GRP = C.CTRL_CMD_NEWMCAST_GRP
- CTRL_CMD_DELMCAST_GRP = C.CTRL_CMD_DELMCAST_GRP
- CTRL_CMD_GETMCAST_GRP = C.CTRL_CMD_GETMCAST_GRP
- CTRL_ATTR_UNSPEC = C.CTRL_ATTR_UNSPEC
- CTRL_ATTR_FAMILY_ID = C.CTRL_ATTR_FAMILY_ID
- CTRL_ATTR_FAMILY_NAME = C.CTRL_ATTR_FAMILY_NAME
- CTRL_ATTR_VERSION = C.CTRL_ATTR_VERSION
- CTRL_ATTR_HDRSIZE = C.CTRL_ATTR_HDRSIZE
- CTRL_ATTR_MAXATTR = C.CTRL_ATTR_MAXATTR
- CTRL_ATTR_OPS = C.CTRL_ATTR_OPS
- CTRL_ATTR_MCAST_GROUPS = C.CTRL_ATTR_MCAST_GROUPS
- CTRL_ATTR_OP_UNSPEC = C.CTRL_ATTR_OP_UNSPEC
- CTRL_ATTR_OP_ID = C.CTRL_ATTR_OP_ID
- CTRL_ATTR_OP_FLAGS = C.CTRL_ATTR_OP_FLAGS
- CTRL_ATTR_MCAST_GRP_UNSPEC = C.CTRL_ATTR_MCAST_GRP_UNSPEC
- CTRL_ATTR_MCAST_GRP_NAME = C.CTRL_ATTR_MCAST_GRP_NAME
- CTRL_ATTR_MCAST_GRP_ID = C.CTRL_ATTR_MCAST_GRP_ID
-)
diff --git a/vendor/golang.org/x/sys/unix/mkall.sh b/vendor/golang.org/x/sys/unix/mkall.sh
new file mode 100644
index 00000000..1715122b
--- /dev/null
+++ b/vendor/golang.org/x/sys/unix/mkall.sh
@@ -0,0 +1,188 @@
+#!/usr/bin/env bash
+# Copyright 2009 The Go Authors. All rights reserved.
+# Use of this source code is governed by a BSD-style
+# license that can be found in the LICENSE file.
+
+# This script runs or (given -n) prints suggested commands to generate files for
+# the Architecture/OS specified by the GOARCH and GOOS environment variables.
+# See README.md for more information about how the build system works.
+
+GOOSARCH="${GOOS}_${GOARCH}"
+
+# defaults
+mksyscall="./mksyscall.pl"
+mkerrors="./mkerrors.sh"
+zerrors="zerrors_$GOOSARCH.go"
+mksysctl=""
+zsysctl="zsysctl_$GOOSARCH.go"
+mksysnum=
+mktypes=
+run="sh"
+cmd=""
+
+case "$1" in
+-syscalls)
+ for i in zsyscall*go
+ do
+ # Run the command line that appears in the first line
+ # of the generated file to regenerate it.
+ sed 1q $i | sed 's;^// ;;' | sh > _$i && gofmt < _$i > $i
+ rm _$i
+ done
+ exit 0
+ ;;
+-n)
+ run="cat"
+ cmd="echo"
+ shift
+esac
+
+case "$#" in
+0)
+ ;;
+*)
+ echo 'usage: mkall.sh [-n]' 1>&2
+ exit 2
+esac
+
+if [[ "$GOOS" = "linux" ]] && [[ "$GOARCH" != "sparc64" ]]; then
+ # Use then new build system
+ # Files generated through docker (use $cmd so you can Ctl-C the build or run)
+ $cmd docker build --tag generate:$GOOS $GOOS
+ $cmd docker run --interactive --tty --volume $(dirname "$(readlink -f "$0")"):/build generate:$GOOS
+ exit
+fi
+
+GOOSARCH_in=syscall_$GOOSARCH.go
+case "$GOOSARCH" in
+_* | *_ | _)
+ echo 'undefined $GOOS_$GOARCH:' "$GOOSARCH" 1>&2
+ exit 1
+ ;;
+darwin_386)
+ mkerrors="$mkerrors -m32"
+ mksyscall="./mksyscall.pl -l32"
+ mksysnum="./mksysnum_darwin.pl $(xcrun --show-sdk-path --sdk macosx)/usr/include/sys/syscall.h"
+ mktypes="GOARCH=$GOARCH go tool cgo -godefs"
+ ;;
+darwin_amd64)
+ mkerrors="$mkerrors -m64"
+ mksysnum="./mksysnum_darwin.pl $(xcrun --show-sdk-path --sdk macosx)/usr/include/sys/syscall.h"
+ mktypes="GOARCH=$GOARCH go tool cgo -godefs"
+ ;;
+darwin_arm)
+ mkerrors="$mkerrors"
+ mksysnum="./mksysnum_darwin.pl $(xcrun --show-sdk-path --sdk iphoneos)/usr/include/sys/syscall.h"
+ mktypes="GOARCH=$GOARCH go tool cgo -godefs"
+ ;;
+darwin_arm64)
+ mkerrors="$mkerrors -m64"
+ mksysnum="./mksysnum_darwin.pl $(xcrun --show-sdk-path --sdk iphoneos)/usr/include/sys/syscall.h"
+ mktypes="GOARCH=$GOARCH go tool cgo -godefs"
+ ;;
+dragonfly_amd64)
+ mkerrors="$mkerrors -m64"
+ mksyscall="./mksyscall.pl -dragonfly"
+ mksysnum="curl -s 'http://gitweb.dragonflybsd.org/dragonfly.git/blob_plain/HEAD:/sys/kern/syscalls.master' | ./mksysnum_dragonfly.pl"
+ mktypes="GOARCH=$GOARCH go tool cgo -godefs"
+ ;;
+freebsd_386)
+ mkerrors="$mkerrors -m32"
+ mksyscall="./mksyscall.pl -l32"
+ mksysnum="curl -s 'http://svn.freebsd.org/base/stable/10/sys/kern/syscalls.master' | ./mksysnum_freebsd.pl"
+ mktypes="GOARCH=$GOARCH go tool cgo -godefs"
+ ;;
+freebsd_amd64)
+ mkerrors="$mkerrors -m64"
+ mksysnum="curl -s 'http://svn.freebsd.org/base/stable/10/sys/kern/syscalls.master' | ./mksysnum_freebsd.pl"
+ mktypes="GOARCH=$GOARCH go tool cgo -godefs"
+ ;;
+freebsd_arm)
+ mkerrors="$mkerrors"
+ mksyscall="./mksyscall.pl -l32 -arm"
+ mksysnum="curl -s 'http://svn.freebsd.org/base/stable/10/sys/kern/syscalls.master' | ./mksysnum_freebsd.pl"
+ # Let the type of C char be signed for making the bare syscall
+ # API consistent across platforms.
+ mktypes="GOARCH=$GOARCH go tool cgo -godefs -- -fsigned-char"
+ ;;
+linux_sparc64)
+ GOOSARCH_in=syscall_linux_sparc64.go
+ unistd_h=/usr/include/sparc64-linux-gnu/asm/unistd.h
+ mkerrors="$mkerrors -m64"
+ mksysnum="./mksysnum_linux.pl $unistd_h"
+ mktypes="GOARCH=$GOARCH go tool cgo -godefs"
+ ;;
+netbsd_386)
+ mkerrors="$mkerrors -m32"
+ mksyscall="./mksyscall.pl -l32 -netbsd"
+ mksysnum="curl -s 'http://cvsweb.netbsd.org/bsdweb.cgi/~checkout~/src/sys/kern/syscalls.master' | ./mksysnum_netbsd.pl"
+ mktypes="GOARCH=$GOARCH go tool cgo -godefs"
+ ;;
+netbsd_amd64)
+ mkerrors="$mkerrors -m64"
+ mksyscall="./mksyscall.pl -netbsd"
+ mksysnum="curl -s 'http://cvsweb.netbsd.org/bsdweb.cgi/~checkout~/src/sys/kern/syscalls.master' | ./mksysnum_netbsd.pl"
+ mktypes="GOARCH=$GOARCH go tool cgo -godefs"
+ ;;
+netbsd_arm)
+ mkerrors="$mkerrors"
+ mksyscall="./mksyscall.pl -l32 -netbsd -arm"
+ mksysnum="curl -s 'http://cvsweb.netbsd.org/bsdweb.cgi/~checkout~/src/sys/kern/syscalls.master' | ./mksysnum_netbsd.pl"
+ # Let the type of C char be signed for making the bare syscall
+ # API consistent across platforms.
+ mktypes="GOARCH=$GOARCH go tool cgo -godefs -- -fsigned-char"
+ ;;
+openbsd_386)
+ mkerrors="$mkerrors -m32"
+ mksyscall="./mksyscall.pl -l32 -openbsd"
+ mksysctl="./mksysctl_openbsd.pl"
+ mksysnum="curl -s 'http://cvsweb.openbsd.org/cgi-bin/cvsweb/~checkout~/src/sys/kern/syscalls.master' | ./mksysnum_openbsd.pl"
+ mktypes="GOARCH=$GOARCH go tool cgo -godefs"
+ ;;
+openbsd_amd64)
+ mkerrors="$mkerrors -m64"
+ mksyscall="./mksyscall.pl -openbsd"
+ mksysctl="./mksysctl_openbsd.pl"
+ mksysnum="curl -s 'http://cvsweb.openbsd.org/cgi-bin/cvsweb/~checkout~/src/sys/kern/syscalls.master' | ./mksysnum_openbsd.pl"
+ mktypes="GOARCH=$GOARCH go tool cgo -godefs"
+ ;;
+openbsd_arm)
+ mkerrors="$mkerrors"
+ mksyscall="./mksyscall.pl -l32 -openbsd -arm"
+ mksysctl="./mksysctl_openbsd.pl"
+ mksysnum="curl -s 'http://cvsweb.openbsd.org/cgi-bin/cvsweb/~checkout~/src/sys/kern/syscalls.master' | ./mksysnum_openbsd.pl"
+ # Let the type of C char be signed for making the bare syscall
+ # API consistent across platforms.
+ mktypes="GOARCH=$GOARCH go tool cgo -godefs -- -fsigned-char"
+ ;;
+solaris_amd64)
+ mksyscall="./mksyscall_solaris.pl"
+ mkerrors="$mkerrors -m64"
+ mksysnum=
+ mktypes="GOARCH=$GOARCH go tool cgo -godefs"
+ ;;
+*)
+ echo 'unrecognized $GOOS_$GOARCH: ' "$GOOSARCH" 1>&2
+ exit 1
+ ;;
+esac
+
+(
+ if [ -n "$mkerrors" ]; then echo "$mkerrors |gofmt >$zerrors"; fi
+ case "$GOOS" in
+ *)
+ syscall_goos="syscall_$GOOS.go"
+ case "$GOOS" in
+ darwin | dragonfly | freebsd | netbsd | openbsd)
+ syscall_goos="syscall_bsd.go $syscall_goos"
+ ;;
+ esac
+ if [ -n "$mksyscall" ]; then echo "$mksyscall -tags $GOOS,$GOARCH $syscall_goos $GOOSARCH_in |gofmt >zsyscall_$GOOSARCH.go"; fi
+ ;;
+ esac
+ if [ -n "$mksysctl" ]; then echo "$mksysctl |gofmt >$zsysctl"; fi
+ if [ -n "$mksysnum" ]; then echo "$mksysnum |gofmt >zsysnum_$GOOSARCH.go"; fi
+ if [ -n "$mktypes" ]; then
+ echo "$mktypes types_$GOOS.go | go run mkpost.go > ztypes_$GOOSARCH.go";
+ fi
+) | $run
diff --git a/vendor/golang.org/x/sys/unix/mkerrors.sh b/vendor/golang.org/x/sys/unix/mkerrors.sh
new file mode 100644
index 00000000..2a44da57
--- /dev/null
+++ b/vendor/golang.org/x/sys/unix/mkerrors.sh
@@ -0,0 +1,577 @@
+#!/usr/bin/env bash
+# Copyright 2009 The Go Authors. All rights reserved.
+# Use of this source code is governed by a BSD-style
+# license that can be found in the LICENSE file.
+
+# Generate Go code listing errors and other #defined constant
+# values (ENAMETOOLONG etc.), by asking the preprocessor
+# about the definitions.
+
+unset LANG
+export LC_ALL=C
+export LC_CTYPE=C
+
+if test -z "$GOARCH" -o -z "$GOOS"; then
+ echo 1>&2 "GOARCH or GOOS not defined in environment"
+ exit 1
+fi
+
+# Check that we are using the new build system if we should
+if [[ "$GOOS" = "linux" ]] && [[ "$GOARCH" != "sparc64" ]]; then
+ if [[ "$GOLANG_SYS_BUILD" != "docker" ]]; then
+ echo 1>&2 "In the new build system, mkerrors should not be called directly."
+ echo 1>&2 "See README.md"
+ exit 1
+ fi
+fi
+
+CC=${CC:-cc}
+
+if [[ "$GOOS" = "solaris" ]]; then
+ # Assumes GNU versions of utilities in PATH.
+ export PATH=/usr/gnu/bin:$PATH
+fi
+
+uname=$(uname)
+
+includes_Darwin='
+#define _DARWIN_C_SOURCE
+#define KERNEL
+#define _DARWIN_USE_64_BIT_INODE
+#include <stdint.h>
+#include <sys/attr.h>
+#include <sys/types.h>
+#include <sys/event.h>
+#include <sys/ptrace.h>
+#include <sys/socket.h>
+#include <sys/sockio.h>
+#include <sys/sysctl.h>
+#include <sys/mman.h>
+#include <sys/mount.h>
+#include <sys/utsname.h>
+#include <sys/wait.h>
+#include <net/bpf.h>
+#include <net/if.h>
+#include <net/if_types.h>
+#include <net/route.h>
+#include <netinet/in.h>
+#include <netinet/ip.h>
+#include <termios.h>
+'
+
+includes_DragonFly='
+#include <sys/types.h>
+#include <sys/event.h>
+#include <sys/socket.h>
+#include <sys/sockio.h>
+#include <sys/sysctl.h>
+#include <sys/mman.h>
+#include <sys/wait.h>
+#include <sys/ioctl.h>
+#include <net/bpf.h>
+#include <net/if.h>
+#include <net/if_types.h>
+#include <net/route.h>
+#include <netinet/in.h>
+#include <termios.h>
+#include <netinet/ip.h>
+#include <net/ip_mroute/ip_mroute.h>
+'
+
+includes_FreeBSD='
+#include <sys/capability.h>
+#include <sys/param.h>
+#include <sys/types.h>
+#include <sys/event.h>
+#include <sys/socket.h>
+#include <sys/sockio.h>
+#include <sys/sysctl.h>
+#include <sys/mman.h>
+#include <sys/mount.h>
+#include <sys/wait.h>
+#include <sys/ioctl.h>
+#include <net/bpf.h>
+#include <net/if.h>
+#include <net/if_types.h>
+#include <net/route.h>
+#include <netinet/in.h>
+#include <termios.h>
+#include <netinet/ip.h>
+#include <netinet/ip_mroute.h>
+#include <sys/extattr.h>
+
+#if __FreeBSD__ >= 10
+#define IFT_CARP 0xf8 // IFT_CARP is deprecated in FreeBSD 10
+#undef SIOCAIFADDR
+#define SIOCAIFADDR _IOW(105, 26, struct oifaliasreq) // ifaliasreq contains if_data
+#undef SIOCSIFPHYADDR
+#define SIOCSIFPHYADDR _IOW(105, 70, struct oifaliasreq) // ifaliasreq contains if_data
+#endif
+'
+
+includes_Linux='
+#define _LARGEFILE_SOURCE
+#define _LARGEFILE64_SOURCE
+#ifndef __LP64__
+#define _FILE_OFFSET_BITS 64
+#endif
+#define _GNU_SOURCE
+
+// <sys/ioctl.h> is broken on powerpc64, as it fails to include definitions of
+// these structures. We just include them copied from <bits/termios.h>.
+#if defined(__powerpc__)
+struct sgttyb {
+ char sg_ispeed;
+ char sg_ospeed;
+ char sg_erase;
+ char sg_kill;
+ short sg_flags;
+};
+
+struct tchars {
+ char t_intrc;
+ char t_quitc;
+ char t_startc;
+ char t_stopc;
+ char t_eofc;
+ char t_brkc;
+};
+
+struct ltchars {
+ char t_suspc;
+ char t_dsuspc;
+ char t_rprntc;
+ char t_flushc;
+ char t_werasc;
+ char t_lnextc;
+};
+#endif
+
+#include <bits/sockaddr.h>
+#include <sys/epoll.h>
+#include <sys/eventfd.h>
+#include <sys/inotify.h>
+#include <sys/ioctl.h>
+#include <sys/mman.h>
+#include <sys/mount.h>
+#include <sys/prctl.h>
+#include <sys/stat.h>
+#include <sys/types.h>
+#include <sys/time.h>
+#include <sys/socket.h>
+#include <sys/xattr.h>
+#include <linux/if.h>
+#include <linux/if_alg.h>
+#include <linux/if_arp.h>
+#include <linux/if_ether.h>
+#include <linux/if_tun.h>
+#include <linux/if_packet.h>
+#include <linux/if_addr.h>
+#include <linux/falloc.h>
+#include <linux/filter.h>
+#include <linux/fs.h>
+#include <linux/keyctl.h>
+#include <linux/netlink.h>
+#include <linux/perf_event.h>
+#include <linux/random.h>
+#include <linux/reboot.h>
+#include <linux/rtnetlink.h>
+#include <linux/ptrace.h>
+#include <linux/sched.h>
+#include <linux/seccomp.h>
+#include <linux/sockios.h>
+#include <linux/wait.h>
+#include <linux/icmpv6.h>
+#include <linux/serial.h>
+#include <linux/can.h>
+#include <linux/vm_sockets.h>
+#include <linux/taskstats.h>
+#include <linux/genetlink.h>
+#include <linux/watchdog.h>
+#include <net/route.h>
+#include <asm/termbits.h>
+
+#ifndef MSG_FASTOPEN
+#define MSG_FASTOPEN 0x20000000
+#endif
+
+#ifndef PTRACE_GETREGS
+#define PTRACE_GETREGS 0xc
+#endif
+
+#ifndef PTRACE_SETREGS
+#define PTRACE_SETREGS 0xd
+#endif
+
+#ifndef SOL_NETLINK
+#define SOL_NETLINK 270
+#endif
+
+#ifdef SOL_BLUETOOTH
+// SPARC includes this in /usr/include/sparc64-linux-gnu/bits/socket.h
+// but it is already in bluetooth_linux.go
+#undef SOL_BLUETOOTH
+#endif
+
+// Certain constants are missing from the fs/crypto UAPI
+#define FS_KEY_DESC_PREFIX "fscrypt:"
+#define FS_KEY_DESC_PREFIX_SIZE 8
+#define FS_MAX_KEY_SIZE 64
+'
+
+includes_NetBSD='
+#include <sys/types.h>
+#include <sys/param.h>
+#include <sys/event.h>
+#include <sys/mman.h>
+#include <sys/socket.h>
+#include <sys/sockio.h>
+#include <sys/sysctl.h>
+#include <sys/termios.h>
+#include <sys/ttycom.h>
+#include <sys/wait.h>
+#include <net/bpf.h>
+#include <net/if.h>
+#include <net/if_types.h>
+#include <net/route.h>
+#include <netinet/in.h>
+#include <netinet/in_systm.h>
+#include <netinet/ip.h>
+#include <netinet/ip_mroute.h>
+#include <netinet/if_ether.h>
+
+// Needed since <sys/param.h> refers to it...
+#define schedppq 1
+'
+
+includes_OpenBSD='
+#include <sys/types.h>
+#include <sys/param.h>
+#include <sys/event.h>
+#include <sys/mman.h>
+#include <sys/socket.h>
+#include <sys/sockio.h>
+#include <sys/sysctl.h>
+#include <sys/termios.h>
+#include <sys/ttycom.h>
+#include <sys/wait.h>
+#include <net/bpf.h>
+#include <net/if.h>
+#include <net/if_types.h>
+#include <net/if_var.h>
+#include <net/route.h>
+#include <netinet/in.h>
+#include <netinet/in_systm.h>
+#include <netinet/ip.h>
+#include <netinet/ip_mroute.h>
+#include <netinet/if_ether.h>
+#include <net/if_bridge.h>
+
+// We keep some constants not supported in OpenBSD 5.5 and beyond for
+// the promise of compatibility.
+#define EMUL_ENABLED 0x1
+#define EMUL_NATIVE 0x2
+#define IPV6_FAITH 0x1d
+#define IPV6_OPTIONS 0x1
+#define IPV6_RTHDR_STRICT 0x1
+#define IPV6_SOCKOPT_RESERVED1 0x3
+#define SIOCGIFGENERIC 0xc020693a
+#define SIOCSIFGENERIC 0x80206939
+#define WALTSIG 0x4
+'
+
+includes_SunOS='
+#include <limits.h>
+#include <sys/types.h>
+#include <sys/socket.h>
+#include <sys/sockio.h>
+#include <sys/mman.h>
+#include <sys/wait.h>
+#include <sys/ioctl.h>
+#include <sys/mkdev.h>
+#include <net/bpf.h>
+#include <net/if.h>
+#include <net/if_arp.h>
+#include <net/if_types.h>
+#include <net/route.h>
+#include <netinet/in.h>
+#include <termios.h>
+#include <netinet/ip.h>
+#include <netinet/ip_mroute.h>
+'
+
+
+includes='
+#include <sys/types.h>
+#include <sys/file.h>
+#include <fcntl.h>
+#include <dirent.h>
+#include <sys/socket.h>
+#include <netinet/in.h>
+#include <netinet/ip.h>
+#include <netinet/ip6.h>
+#include <netinet/tcp.h>
+#include <errno.h>
+#include <sys/signal.h>
+#include <signal.h>
+#include <sys/resource.h>
+#include <time.h>
+'
+ccflags="$@"
+
+# Write go tool cgo -godefs input.
+(
+ echo package unix
+ echo
+ echo '/*'
+ indirect="includes_$(uname)"
+ echo "${!indirect} $includes"
+ echo '*/'
+ echo 'import "C"'
+ echo 'import "syscall"'
+ echo
+ echo 'const ('
+
+ # The gcc command line prints all the #defines
+ # it encounters while processing the input
+ echo "${!indirect} $includes" | $CC -x c - -E -dM $ccflags |
+ awk '
+ $1 != "#define" || $2 ~ /\(/ || $3 == "" {next}
+
+ $2 ~ /^E([ABCD]X|[BIS]P|[SD]I|S|FL)$/ {next} # 386 registers
+ $2 ~ /^(SIGEV_|SIGSTKSZ|SIGRT(MIN|MAX))/ {next}
+ $2 ~ /^(SCM_SRCRT)$/ {next}
+ $2 ~ /^(MAP_FAILED)$/ {next}
+ $2 ~ /^ELF_.*$/ {next}# <asm/elf.h> contains ELF_ARCH, etc.
+
+ $2 ~ /^EXTATTR_NAMESPACE_NAMES/ ||
+ $2 ~ /^EXTATTR_NAMESPACE_[A-Z]+_STRING/ {next}
+
+ $2 !~ /^ETH_/ &&
+ $2 !~ /^EPROC_/ &&
+ $2 !~ /^EQUIV_/ &&
+ $2 !~ /^EXPR_/ &&
+ $2 ~ /^E[A-Z0-9_]+$/ ||
+ $2 ~ /^B[0-9_]+$/ ||
+ $2 ~ /^(OLD|NEW)DEV$/ ||
+ $2 == "BOTHER" ||
+ $2 ~ /^CI?BAUD(EX)?$/ ||
+ $2 == "IBSHIFT" ||
+ $2 ~ /^V[A-Z0-9]+$/ ||
+ $2 ~ /^CS[A-Z0-9]/ ||
+ $2 ~ /^I(SIG|CANON|CRNL|UCLC|EXTEN|MAXBEL|STRIP|UTF8)$/ ||
+ $2 ~ /^IGN/ ||
+ $2 ~ /^IX(ON|ANY|OFF)$/ ||
+ $2 ~ /^IN(LCR|PCK)$/ ||
+ $2 ~ /(^FLU?SH)|(FLU?SH$)/ ||
+ $2 ~ /^C(LOCAL|READ|MSPAR|RTSCTS)$/ ||
+ $2 == "BRKINT" ||
+ $2 == "HUPCL" ||
+ $2 == "PENDIN" ||
+ $2 == "TOSTOP" ||
+ $2 == "XCASE" ||
+ $2 == "ALTWERASE" ||
+ $2 == "NOKERNINFO" ||
+ $2 ~ /^PAR/ ||
+ $2 ~ /^SIG[^_]/ ||
+ $2 ~ /^O[CNPFPL][A-Z]+[^_][A-Z]+$/ ||
+ $2 ~ /^(NL|CR|TAB|BS|VT|FF)DLY$/ ||
+ $2 ~ /^(NL|CR|TAB|BS|VT|FF)[0-9]$/ ||
+ $2 ~ /^O?XTABS$/ ||
+ $2 ~ /^TC[IO](ON|OFF)$/ ||
+ $2 ~ /^IN_/ ||
+ $2 ~ /^LOCK_(SH|EX|NB|UN)$/ ||
+ $2 ~ /^(AF|SOCK|SO|SOL|IPPROTO|IP|IPV6|ICMP6|TCP|EVFILT|NOTE|EV|SHUT|PROT|MAP|PACKET|MSG|SCM|MCL|DT|MADV|PR)_/ ||
+ $2 ~ /^FALLOC_/ ||
+ $2 == "ICMPV6_FILTER" ||
+ $2 == "SOMAXCONN" ||
+ $2 == "NAME_MAX" ||
+ $2 == "IFNAMSIZ" ||
+ $2 ~ /^CTL_(HW|KERN|MAXNAME|NET|QUERY)$/ ||
+ $2 ~ /^KERN_(HOSTNAME|OS(RELEASE|TYPE)|VERSION)$/ ||
+ $2 ~ /^HW_MACHINE$/ ||
+ $2 ~ /^SYSCTL_VERS/ ||
+ $2 ~ /^(MS|MNT|UMOUNT)_/ ||
+ $2 ~ /^TUN(SET|GET|ATTACH|DETACH)/ ||
+ $2 ~ /^(O|F|E?FD|NAME|S|PTRACE|PT)_/ ||
+ $2 ~ /^LINUX_REBOOT_CMD_/ ||
+ $2 ~ /^LINUX_REBOOT_MAGIC[12]$/ ||
+ $2 !~ "NLA_TYPE_MASK" &&
+ $2 ~ /^(NETLINK|NLM|NLMSG|NLA|IFA|IFAN|RT|RTCF|RTN|RTPROT|RTNH|ARPHRD|ETH_P)_/ ||
+ $2 ~ /^SIOC/ ||
+ $2 ~ /^TIOC/ ||
+ $2 ~ /^TCGET/ ||
+ $2 ~ /^TCSET/ ||
+ $2 ~ /^TC(FLSH|SBRKP?|XONC)$/ ||
+ $2 !~ "RTF_BITS" &&
+ $2 ~ /^(IFF|IFT|NET_RT|RTM|RTF|RTV|RTA|RTAX)_/ ||
+ $2 ~ /^BIOC/ ||
+ $2 ~ /^RUSAGE_(SELF|CHILDREN|THREAD)/ ||
+ $2 ~ /^RLIMIT_(AS|CORE|CPU|DATA|FSIZE|LOCKS|MEMLOCK|MSGQUEUE|NICE|NOFILE|NPROC|RSS|RTPRIO|RTTIME|SIGPENDING|STACK)|RLIM_INFINITY/ ||
+ $2 ~ /^PRIO_(PROCESS|PGRP|USER)/ ||
+ $2 ~ /^CLONE_[A-Z_]+/ ||
+ $2 !~ /^(BPF_TIMEVAL)$/ &&
+ $2 ~ /^(BPF|DLT)_/ ||
+ $2 ~ /^CLOCK_/ ||
+ $2 ~ /^CAN_/ ||
+ $2 ~ /^CAP_/ ||
+ $2 ~ /^ALG_/ ||
+ $2 ~ /^FS_(POLICY_FLAGS|KEY_DESC|ENCRYPTION_MODE|[A-Z0-9_]+_KEY_SIZE|IOC_(GET|SET)_ENCRYPTION)/ ||
+ $2 ~ /^GRND_/ ||
+ $2 ~ /^KEY_(SPEC|REQKEY_DEFL)_/ ||
+ $2 ~ /^KEYCTL_/ ||
+ $2 ~ /^PERF_EVENT_IOC_/ ||
+ $2 ~ /^SECCOMP_MODE_/ ||
+ $2 ~ /^SPLICE_/ ||
+ $2 ~ /^(VM|VMADDR)_/ ||
+ $2 ~ /^IOCTL_VM_SOCKETS_/ ||
+ $2 ~ /^(TASKSTATS|TS)_/ ||
+ $2 ~ /^GENL_/ ||
+ $2 ~ /^UTIME_/ ||
+ $2 ~ /^XATTR_(CREATE|REPLACE)/ ||
+ $2 ~ /^ATTR_(BIT_MAP_COUNT|(CMN|VOL|FILE)_)/ ||
+ $2 ~ /^FSOPT_/ ||
+ $2 ~ /^WDIOC_/ ||
+ $2 !~ "WMESGLEN" &&
+ $2 ~ /^W[A-Z0-9]+$/ ||
+ $2 ~ /^BLK[A-Z]*(GET$|SET$|BUF$|PART$|SIZE)/ {printf("\t%s = C.%s\n", $2, $2)}
+ $2 ~ /^__WCOREFLAG$/ {next}
+ $2 ~ /^__W[A-Z0-9]+$/ {printf("\t%s = C.%s\n", substr($2,3), $2)}
+
+ {next}
+ ' | sort
+
+ echo ')'
+) >_const.go
+
+# Pull out the error names for later.
+errors=$(
+ echo '#include <errno.h>' | $CC -x c - -E -dM $ccflags |
+ awk '$1=="#define" && $2 ~ /^E[A-Z0-9_]+$/ { print $2 }' |
+ sort
+)
+
+# Pull out the signal names for later.
+signals=$(
+ echo '#include <signal.h>' | $CC -x c - -E -dM $ccflags |
+ awk '$1=="#define" && $2 ~ /^SIG[A-Z0-9]+$/ { print $2 }' |
+ egrep -v '(SIGSTKSIZE|SIGSTKSZ|SIGRT)' |
+ sort
+)
+
+# Again, writing regexps to a file.
+echo '#include <errno.h>' | $CC -x c - -E -dM $ccflags |
+ awk '$1=="#define" && $2 ~ /^E[A-Z0-9_]+$/ { print "^\t" $2 "[ \t]*=" }' |
+ sort >_error.grep
+echo '#include <signal.h>' | $CC -x c - -E -dM $ccflags |
+ awk '$1=="#define" && $2 ~ /^SIG[A-Z0-9]+$/ { print "^\t" $2 "[ \t]*=" }' |
+ egrep -v '(SIGSTKSIZE|SIGSTKSZ|SIGRT)' |
+ sort >_signal.grep
+
+echo '// mkerrors.sh' "$@"
+echo '// Code generated by the command above; see README.md. DO NOT EDIT.'
+echo
+echo "// +build ${GOARCH},${GOOS}"
+echo
+go tool cgo -godefs -- "$@" _const.go >_error.out
+cat _error.out | grep -vf _error.grep | grep -vf _signal.grep
+echo
+echo '// Errors'
+echo 'const ('
+cat _error.out | grep -f _error.grep | sed 's/=\(.*\)/= syscall.Errno(\1)/'
+echo ')'
+
+echo
+echo '// Signals'
+echo 'const ('
+cat _error.out | grep -f _signal.grep | sed 's/=\(.*\)/= syscall.Signal(\1)/'
+echo ')'
+
+# Run C program to print error and syscall strings.
+(
+ echo -E "
+#include <stdio.h>
+#include <stdlib.h>
+#include <errno.h>
+#include <ctype.h>
+#include <string.h>
+#include <signal.h>
+
+#define nelem(x) (sizeof(x)/sizeof((x)[0]))
+
+enum { A = 'A', Z = 'Z', a = 'a', z = 'z' }; // avoid need for single quotes below
+
+int errors[] = {
+"
+ for i in $errors
+ do
+ echo -E ' '$i,
+ done
+
+ echo -E "
+};
+
+int signals[] = {
+"
+ for i in $signals
+ do
+ echo -E ' '$i,
+ done
+
+ # Use -E because on some systems bash builtin interprets \n itself.
+ echo -E '
+};
+
+static int
+intcmp(const void *a, const void *b)
+{
+ return *(int*)a - *(int*)b;
+}
+
+int
+main(void)
+{
+ int i, e;
+ char buf[1024], *p;
+
+ printf("\n\n// Error table\n");
+ printf("var errors = [...]string {\n");
+ qsort(errors, nelem(errors), sizeof errors[0], intcmp);
+ for(i=0; i<nelem(errors); i++) {
+ e = errors[i];
+ if(i > 0 && errors[i-1] == e)
+ continue;
+ strcpy(buf, strerror(e));
+ // lowercase first letter: Bad -> bad, but STREAM -> STREAM.
+ if(A <= buf[0] && buf[0] <= Z && a <= buf[1] && buf[1] <= z)
+ buf[0] += a - A;
+ printf("\t%d: \"%s\",\n", e, buf);
+ }
+ printf("}\n\n");
+
+ printf("\n\n// Signal table\n");
+ printf("var signals = [...]string {\n");
+ qsort(signals, nelem(signals), sizeof signals[0], intcmp);
+ for(i=0; i<nelem(signals); i++) {
+ e = signals[i];
+ if(i > 0 && signals[i-1] == e)
+ continue;
+ strcpy(buf, strsignal(e));
+ // lowercase first letter: Bad -> bad, but STREAM -> STREAM.
+ if(A <= buf[0] && buf[0] <= Z && a <= buf[1] && buf[1] <= z)
+ buf[0] += a - A;
+ // cut trailing : number.
+ p = strrchr(buf, ":"[0]);
+ if(p)
+ *p = '\0';
+ printf("\t%d: \"%s\",\n", e, buf);
+ }
+ printf("}\n\n");
+
+ return 0;
+}
+
+'
+) >_errors.c
+
+$CC $ccflags -o _errors _errors.c && $GORUN ./_errors && rm -f _errors.c _errors _const.go _error.grep _signal.grep _error.out
diff --git a/vendor/golang.org/x/sys/unix/mksyscall.pl b/vendor/golang.org/x/sys/unix/mksyscall.pl
new file mode 100644
index 00000000..fb929b4c
--- /dev/null
+++ b/vendor/golang.org/x/sys/unix/mksyscall.pl
@@ -0,0 +1,328 @@
+#!/usr/bin/env perl
+# Copyright 2009 The Go Authors. All rights reserved.
+# Use of this source code is governed by a BSD-style
+# license that can be found in the LICENSE file.
+
+# This program reads a file containing function prototypes
+# (like syscall_darwin.go) and generates system call bodies.
+# The prototypes are marked by lines beginning with "//sys"
+# and read like func declarations if //sys is replaced by func, but:
+# * The parameter lists must give a name for each argument.
+# This includes return parameters.
+# * The parameter lists must give a type for each argument:
+# the (x, y, z int) shorthand is not allowed.
+# * If the return parameter is an error number, it must be named errno.
+
+# A line beginning with //sysnb is like //sys, except that the
+# goroutine will not be suspended during the execution of the system
+# call. This must only be used for system calls which can never
+# block, as otherwise the system call could cause all goroutines to
+# hang.
+
+use strict;
+
+my $cmdline = "mksyscall.pl " . join(' ', @ARGV);
+my $errors = 0;
+my $_32bit = "";
+my $plan9 = 0;
+my $openbsd = 0;
+my $netbsd = 0;
+my $dragonfly = 0;
+my $arm = 0; # 64-bit value should use (even, odd)-pair
+my $tags = ""; # build tags
+
+if($ARGV[0] eq "-b32") {
+ $_32bit = "big-endian";
+ shift;
+} elsif($ARGV[0] eq "-l32") {
+ $_32bit = "little-endian";
+ shift;
+}
+if($ARGV[0] eq "-plan9") {
+ $plan9 = 1;
+ shift;
+}
+if($ARGV[0] eq "-openbsd") {
+ $openbsd = 1;
+ shift;
+}
+if($ARGV[0] eq "-netbsd") {
+ $netbsd = 1;
+ shift;
+}
+if($ARGV[0] eq "-dragonfly") {
+ $dragonfly = 1;
+ shift;
+}
+if($ARGV[0] eq "-arm") {
+ $arm = 1;
+ shift;
+}
+if($ARGV[0] eq "-tags") {
+ shift;
+ $tags = $ARGV[0];
+ shift;
+}
+
+if($ARGV[0] =~ /^-/) {
+ print STDERR "usage: mksyscall.pl [-b32 | -l32] [-tags x,y] [file ...]\n";
+ exit 1;
+}
+
+# Check that we are using the new build system if we should
+if($ENV{'GOOS'} eq "linux" && $ENV{'GOARCH'} ne "sparc64") {
+ if($ENV{'GOLANG_SYS_BUILD'} ne "docker") {
+ print STDERR "In the new build system, mksyscall should not be called directly.\n";
+ print STDERR "See README.md\n";
+ exit 1;
+ }
+}
+
+
+sub parseparamlist($) {
+ my ($list) = @_;
+ $list =~ s/^\s*//;
+ $list =~ s/\s*$//;
+ if($list eq "") {
+ return ();
+ }
+ return split(/\s*,\s*/, $list);
+}
+
+sub parseparam($) {
+ my ($p) = @_;
+ if($p !~ /^(\S*) (\S*)$/) {
+ print STDERR "$ARGV:$.: malformed parameter: $p\n";
+ $errors = 1;
+ return ("xx", "int");
+ }
+ return ($1, $2);
+}
+
+my $text = "";
+while(<>) {
+ chomp;
+ s/\s+/ /g;
+ s/^\s+//;
+ s/\s+$//;
+ my $nonblock = /^\/\/sysnb /;
+ next if !/^\/\/sys / && !$nonblock;
+
+ # Line must be of the form
+ # func Open(path string, mode int, perm int) (fd int, errno error)
+ # Split into name, in params, out params.
+ if(!/^\/\/sys(nb)? (\w+)\(([^()]*)\)\s*(?:\(([^()]+)\))?\s*(?:=\s*((?i)SYS_[A-Z0-9_]+))?$/) {
+ print STDERR "$ARGV:$.: malformed //sys declaration\n";
+ $errors = 1;
+ next;
+ }
+ my ($func, $in, $out, $sysname) = ($2, $3, $4, $5);
+
+ # Split argument lists on comma.
+ my @in = parseparamlist($in);
+ my @out = parseparamlist($out);
+
+ # Try in vain to keep people from editing this file.
+ # The theory is that they jump into the middle of the file
+ # without reading the header.
+ $text .= "// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT\n\n";
+
+ # Go function header.
+ my $out_decl = @out ? sprintf(" (%s)", join(', ', @out)) : "";
+ $text .= sprintf "func %s(%s)%s {\n", $func, join(', ', @in), $out_decl;
+
+ # Check if err return available
+ my $errvar = "";
+ foreach my $p (@out) {
+ my ($name, $type) = parseparam($p);
+ if($type eq "error") {
+ $errvar = $name;
+ last;
+ }
+ }
+
+ # Prepare arguments to Syscall.
+ my @args = ();
+ my $n = 0;
+ foreach my $p (@in) {
+ my ($name, $type) = parseparam($p);
+ if($type =~ /^\*/) {
+ push @args, "uintptr(unsafe.Pointer($name))";
+ } elsif($type eq "string" && $errvar ne "") {
+ $text .= "\tvar _p$n *byte\n";
+ $text .= "\t_p$n, $errvar = BytePtrFromString($name)\n";
+ $text .= "\tif $errvar != nil {\n\t\treturn\n\t}\n";
+ push @args, "uintptr(unsafe.Pointer(_p$n))";
+ $n++;
+ } elsif($type eq "string") {
+ print STDERR "$ARGV:$.: $func uses string arguments, but has no error return\n";
+ $text .= "\tvar _p$n *byte\n";
+ $text .= "\t_p$n, _ = BytePtrFromString($name)\n";
+ push @args, "uintptr(unsafe.Pointer(_p$n))";
+ $n++;
+ } elsif($type =~ /^\[\](.*)/) {
+ # Convert slice into pointer, length.
+ # Have to be careful not to take address of &a[0] if len == 0:
+ # pass dummy pointer in that case.
+ # Used to pass nil, but some OSes or simulators reject write(fd, nil, 0).
+ $text .= "\tvar _p$n unsafe.Pointer\n";
+ $text .= "\tif len($name) > 0 {\n\t\t_p$n = unsafe.Pointer(\&${name}[0])\n\t}";
+ $text .= " else {\n\t\t_p$n = unsafe.Pointer(&_zero)\n\t}";
+ $text .= "\n";
+ push @args, "uintptr(_p$n)", "uintptr(len($name))";
+ $n++;
+ } elsif($type eq "int64" && ($openbsd || $netbsd)) {
+ push @args, "0";
+ if($_32bit eq "big-endian") {
+ push @args, "uintptr($name>>32)", "uintptr($name)";
+ } elsif($_32bit eq "little-endian") {
+ push @args, "uintptr($name)", "uintptr($name>>32)";
+ } else {
+ push @args, "uintptr($name)";
+ }
+ } elsif($type eq "int64" && $dragonfly) {
+ if ($func !~ /^extp(read|write)/i) {
+ push @args, "0";
+ }
+ if($_32bit eq "big-endian") {
+ push @args, "uintptr($name>>32)", "uintptr($name)";
+ } elsif($_32bit eq "little-endian") {
+ push @args, "uintptr($name)", "uintptr($name>>32)";
+ } else {
+ push @args, "uintptr($name)";
+ }
+ } elsif($type eq "int64" && $_32bit ne "") {
+ if(@args % 2 && $arm) {
+ # arm abi specifies 64-bit argument uses
+ # (even, odd) pair
+ push @args, "0"
+ }
+ if($_32bit eq "big-endian") {
+ push @args, "uintptr($name>>32)", "uintptr($name)";
+ } else {
+ push @args, "uintptr($name)", "uintptr($name>>32)";
+ }
+ } else {
+ push @args, "uintptr($name)";
+ }
+ }
+
+ # Determine which form to use; pad args with zeros.
+ my $asm = "Syscall";
+ if ($nonblock) {
+ $asm = "RawSyscall";
+ }
+ if(@args <= 3) {
+ while(@args < 3) {
+ push @args, "0";
+ }
+ } elsif(@args <= 6) {
+ $asm .= "6";
+ while(@args < 6) {
+ push @args, "0";
+ }
+ } elsif(@args <= 9) {
+ $asm .= "9";
+ while(@args < 9) {
+ push @args, "0";
+ }
+ } else {
+ print STDERR "$ARGV:$.: too many arguments to system call\n";
+ }
+
+ # System call number.
+ if($sysname eq "") {
+ $sysname = "SYS_$func";
+ $sysname =~ s/([a-z])([A-Z])/${1}_$2/g; # turn FooBar into Foo_Bar
+ $sysname =~ y/a-z/A-Z/;
+ }
+
+ # Actual call.
+ my $args = join(', ', @args);
+ my $call = "$asm($sysname, $args)";
+
+ # Assign return values.
+ my $body = "";
+ my @ret = ("_", "_", "_");
+ my $do_errno = 0;
+ for(my $i=0; $i<@out; $i++) {
+ my $p = $out[$i];
+ my ($name, $type) = parseparam($p);
+ my $reg = "";
+ if($name eq "err" && !$plan9) {
+ $reg = "e1";
+ $ret[2] = $reg;
+ $do_errno = 1;
+ } elsif($name eq "err" && $plan9) {
+ $ret[0] = "r0";
+ $ret[2] = "e1";
+ next;
+ } else {
+ $reg = sprintf("r%d", $i);
+ $ret[$i] = $reg;
+ }
+ if($type eq "bool") {
+ $reg = "$reg != 0";
+ }
+ if($type eq "int64" && $_32bit ne "") {
+ # 64-bit number in r1:r0 or r0:r1.
+ if($i+2 > @out) {
+ print STDERR "$ARGV:$.: not enough registers for int64 return\n";
+ }
+ if($_32bit eq "big-endian") {
+ $reg = sprintf("int64(r%d)<<32 | int64(r%d)", $i, $i+1);
+ } else {
+ $reg = sprintf("int64(r%d)<<32 | int64(r%d)", $i+1, $i);
+ }
+ $ret[$i] = sprintf("r%d", $i);
+ $ret[$i+1] = sprintf("r%d", $i+1);
+ }
+ if($reg ne "e1" || $plan9) {
+ $body .= "\t$name = $type($reg)\n";
+ }
+ }
+ if ($ret[0] eq "_" && $ret[1] eq "_" && $ret[2] eq "_") {
+ $text .= "\t$call\n";
+ } else {
+ $text .= "\t$ret[0], $ret[1], $ret[2] := $call\n";
+ }
+ $text .= $body;
+
+ if ($plan9 && $ret[2] eq "e1") {
+ $text .= "\tif int32(r0) == -1 {\n";
+ $text .= "\t\terr = e1\n";
+ $text .= "\t}\n";
+ } elsif ($do_errno) {
+ $text .= "\tif e1 != 0 {\n";
+ $text .= "\t\terr = errnoErr(e1)\n";
+ $text .= "\t}\n";
+ }
+ $text .= "\treturn\n";
+ $text .= "}\n\n";
+}
+
+chomp $text;
+chomp $text;
+
+if($errors) {
+ exit 1;
+}
+
+print <<EOF;
+// $cmdline
+// Code generated by the command above; see README.md. DO NOT EDIT.
+
+// +build $tags
+
+package unix
+
+import (
+ "syscall"
+ "unsafe"
+)
+
+var _ syscall.Errno
+
+$text
+EOF
+exit 0;
diff --git a/vendor/golang.org/x/sys/unix/mksyscall_solaris.pl b/vendor/golang.org/x/sys/unix/mksyscall_solaris.pl
new file mode 100644
index 00000000..3e6ed9df
--- /dev/null
+++ b/vendor/golang.org/x/sys/unix/mksyscall_solaris.pl
@@ -0,0 +1,289 @@
+#!/usr/bin/env perl
+# Copyright 2009 The Go Authors. All rights reserved.
+# Use of this source code is governed by a BSD-style
+# license that can be found in the LICENSE file.
+
+# This program reads a file containing function prototypes
+# (like syscall_solaris.go) and generates system call bodies.
+# The prototypes are marked by lines beginning with "//sys"
+# and read like func declarations if //sys is replaced by func, but:
+# * The parameter lists must give a name for each argument.
+# This includes return parameters.
+# * The parameter lists must give a type for each argument:
+# the (x, y, z int) shorthand is not allowed.
+# * If the return parameter is an error number, it must be named err.
+# * If go func name needs to be different than its libc name,
+# * or the function is not in libc, name could be specified
+# * at the end, after "=" sign, like
+# //sys getsockopt(s int, level int, name int, val uintptr, vallen *_Socklen) (err error) = libsocket.getsockopt
+
+use strict;
+
+my $cmdline = "mksyscall_solaris.pl " . join(' ', @ARGV);
+my $errors = 0;
+my $_32bit = "";
+my $tags = ""; # build tags
+
+binmode STDOUT;
+
+if($ARGV[0] eq "-b32") {
+ $_32bit = "big-endian";
+ shift;
+} elsif($ARGV[0] eq "-l32") {
+ $_32bit = "little-endian";
+ shift;
+}
+if($ARGV[0] eq "-tags") {
+ shift;
+ $tags = $ARGV[0];
+ shift;
+}
+
+if($ARGV[0] =~ /^-/) {
+ print STDERR "usage: mksyscall_solaris.pl [-b32 | -l32] [-tags x,y] [file ...]\n";
+ exit 1;
+}
+
+sub parseparamlist($) {
+ my ($list) = @_;
+ $list =~ s/^\s*//;
+ $list =~ s/\s*$//;
+ if($list eq "") {
+ return ();
+ }
+ return split(/\s*,\s*/, $list);
+}
+
+sub parseparam($) {
+ my ($p) = @_;
+ if($p !~ /^(\S*) (\S*)$/) {
+ print STDERR "$ARGV:$.: malformed parameter: $p\n";
+ $errors = 1;
+ return ("xx", "int");
+ }
+ return ($1, $2);
+}
+
+my $package = "";
+my $text = "";
+my $dynimports = "";
+my $linknames = "";
+my @vars = ();
+while(<>) {
+ chomp;
+ s/\s+/ /g;
+ s/^\s+//;
+ s/\s+$//;
+ $package = $1 if !$package && /^package (\S+)$/;
+ my $nonblock = /^\/\/sysnb /;
+ next if !/^\/\/sys / && !$nonblock;
+
+ # Line must be of the form
+ # func Open(path string, mode int, perm int) (fd int, err error)
+ # Split into name, in params, out params.
+ if(!/^\/\/sys(nb)? (\w+)\(([^()]*)\)\s*(?:\(([^()]+)\))?\s*(?:=\s*(?:(\w*)\.)?(\w*))?$/) {
+ print STDERR "$ARGV:$.: malformed //sys declaration\n";
+ $errors = 1;
+ next;
+ }
+ my ($nb, $func, $in, $out, $modname, $sysname) = ($1, $2, $3, $4, $5, $6);
+
+ # Split argument lists on comma.
+ my @in = parseparamlist($in);
+ my @out = parseparamlist($out);
+
+ # So file name.
+ if($modname eq "") {
+ $modname = "libc";
+ }
+
+ # System call name.
+ if($sysname eq "") {
+ $sysname = "$func";
+ }
+
+ # System call pointer variable name.
+ my $sysvarname = "proc$sysname";
+
+ my $strconvfunc = "BytePtrFromString";
+ my $strconvtype = "*byte";
+
+ $sysname =~ y/A-Z/a-z/; # All libc functions are lowercase.
+
+ # Runtime import of function to allow cross-platform builds.
+ $dynimports .= "//go:cgo_import_dynamic libc_${sysname} ${sysname} \"$modname.so\"\n";
+ # Link symbol to proc address variable.
+ $linknames .= "//go:linkname ${sysvarname} libc_${sysname}\n";
+ # Library proc address variable.
+ push @vars, $sysvarname;
+
+ # Go function header.
+ $out = join(', ', @out);
+ if($out ne "") {
+ $out = " ($out)";
+ }
+ if($text ne "") {
+ $text .= "\n"
+ }
+ $text .= sprintf "func %s(%s)%s {\n", $func, join(', ', @in), $out;
+
+ # Check if err return available
+ my $errvar = "";
+ foreach my $p (@out) {
+ my ($name, $type) = parseparam($p);
+ if($type eq "error") {
+ $errvar = $name;
+ last;
+ }
+ }
+
+ # Prepare arguments to Syscall.
+ my @args = ();
+ my $n = 0;
+ foreach my $p (@in) {
+ my ($name, $type) = parseparam($p);
+ if($type =~ /^\*/) {
+ push @args, "uintptr(unsafe.Pointer($name))";
+ } elsif($type eq "string" && $errvar ne "") {
+ $text .= "\tvar _p$n $strconvtype\n";
+ $text .= "\t_p$n, $errvar = $strconvfunc($name)\n";
+ $text .= "\tif $errvar != nil {\n\t\treturn\n\t}\n";
+ push @args, "uintptr(unsafe.Pointer(_p$n))";
+ $n++;
+ } elsif($type eq "string") {
+ print STDERR "$ARGV:$.: $func uses string arguments, but has no error return\n";
+ $text .= "\tvar _p$n $strconvtype\n";
+ $text .= "\t_p$n, _ = $strconvfunc($name)\n";
+ push @args, "uintptr(unsafe.Pointer(_p$n))";
+ $n++;
+ } elsif($type =~ /^\[\](.*)/) {
+ # Convert slice into pointer, length.
+ # Have to be careful not to take address of &a[0] if len == 0:
+ # pass nil in that case.
+ $text .= "\tvar _p$n *$1\n";
+ $text .= "\tif len($name) > 0 {\n\t\t_p$n = \&$name\[0]\n\t}\n";
+ push @args, "uintptr(unsafe.Pointer(_p$n))", "uintptr(len($name))";
+ $n++;
+ } elsif($type eq "int64" && $_32bit ne "") {
+ if($_32bit eq "big-endian") {
+ push @args, "uintptr($name >> 32)", "uintptr($name)";
+ } else {
+ push @args, "uintptr($name)", "uintptr($name >> 32)";
+ }
+ } elsif($type eq "bool") {
+ $text .= "\tvar _p$n uint32\n";
+ $text .= "\tif $name {\n\t\t_p$n = 1\n\t} else {\n\t\t_p$n = 0\n\t}\n";
+ push @args, "uintptr(_p$n)";
+ $n++;
+ } else {
+ push @args, "uintptr($name)";
+ }
+ }
+ my $nargs = @args;
+
+ # Determine which form to use; pad args with zeros.
+ my $asm = "sysvicall6";
+ if ($nonblock) {
+ $asm = "rawSysvicall6";
+ }
+ if(@args <= 6) {
+ while(@args < 6) {
+ push @args, "0";
+ }
+ } else {
+ print STDERR "$ARGV:$.: too many arguments to system call\n";
+ }
+
+ # Actual call.
+ my $args = join(', ', @args);
+ my $call = "$asm(uintptr(unsafe.Pointer(&$sysvarname)), $nargs, $args)";
+
+ # Assign return values.
+ my $body = "";
+ my $failexpr = "";
+ my @ret = ("_", "_", "_");
+ my @pout= ();
+ my $do_errno = 0;
+ for(my $i=0; $i<@out; $i++) {
+ my $p = $out[$i];
+ my ($name, $type) = parseparam($p);
+ my $reg = "";
+ if($name eq "err") {
+ $reg = "e1";
+ $ret[2] = $reg;
+ $do_errno = 1;
+ } else {
+ $reg = sprintf("r%d", $i);
+ $ret[$i] = $reg;
+ }
+ if($type eq "bool") {
+ $reg = "$reg != 0";
+ }
+ if($type eq "int64" && $_32bit ne "") {
+ # 64-bit number in r1:r0 or r0:r1.
+ if($i+2 > @out) {
+ print STDERR "$ARGV:$.: not enough registers for int64 return\n";
+ }
+ if($_32bit eq "big-endian") {
+ $reg = sprintf("int64(r%d)<<32 | int64(r%d)", $i, $i+1);
+ } else {
+ $reg = sprintf("int64(r%d)<<32 | int64(r%d)", $i+1, $i);
+ }
+ $ret[$i] = sprintf("r%d", $i);
+ $ret[$i+1] = sprintf("r%d", $i+1);
+ }
+ if($reg ne "e1") {
+ $body .= "\t$name = $type($reg)\n";
+ }
+ }
+ if ($ret[0] eq "_" && $ret[1] eq "_" && $ret[2] eq "_") {
+ $text .= "\t$call\n";
+ } else {
+ $text .= "\t$ret[0], $ret[1], $ret[2] := $call\n";
+ }
+ $text .= $body;
+
+ if ($do_errno) {
+ $text .= "\tif e1 != 0 {\n";
+ $text .= "\t\terr = e1\n";
+ $text .= "\t}\n";
+ }
+ $text .= "\treturn\n";
+ $text .= "}\n";
+}
+
+if($errors) {
+ exit 1;
+}
+
+print <<EOF;
+// $cmdline
+// Code generated by the command above; see README.md. DO NOT EDIT.
+
+// +build $tags
+
+package $package
+
+import (
+ "syscall"
+ "unsafe"
+)
+EOF
+
+print "import \"golang.org/x/sys/unix\"\n" if $package ne "unix";
+
+my $vardecls = "\t" . join(",\n\t", @vars);
+$vardecls .= " syscallFunc";
+
+chomp($_=<<EOF);
+
+$dynimports
+$linknames
+var (
+$vardecls
+)
+
+$text
+EOF
+print $_;
+exit 0;
diff --git a/vendor/golang.org/x/sys/unix/mksysctl_openbsd.pl b/vendor/golang.org/x/sys/unix/mksysctl_openbsd.pl
new file mode 100644
index 00000000..be67afa4
--- /dev/null
+++ b/vendor/golang.org/x/sys/unix/mksysctl_openbsd.pl
@@ -0,0 +1,264 @@
+#!/usr/bin/env perl
+
+# Copyright 2011 The Go Authors. All rights reserved.
+# Use of this source code is governed by a BSD-style
+# license that can be found in the LICENSE file.
+
+#
+# Parse the header files for OpenBSD and generate a Go usable sysctl MIB.
+#
+# Build a MIB with each entry being an array containing the level, type and
+# a hash that will contain additional entries if the current entry is a node.
+# We then walk this MIB and create a flattened sysctl name to OID hash.
+#
+
+use strict;
+
+if($ENV{'GOARCH'} eq "" || $ENV{'GOOS'} eq "") {
+ print STDERR "GOARCH or GOOS not defined in environment\n";
+ exit 1;
+}
+
+my $debug = 0;
+my %ctls = ();
+
+my @headers = qw (
+ sys/sysctl.h
+ sys/socket.h
+ sys/tty.h
+ sys/malloc.h
+ sys/mount.h
+ sys/namei.h
+ sys/sem.h
+ sys/shm.h
+ sys/vmmeter.h
+ uvm/uvm_param.h
+ uvm/uvm_swap_encrypt.h
+ ddb/db_var.h
+ net/if.h
+ net/if_pfsync.h
+ net/pipex.h
+ netinet/in.h
+ netinet/icmp_var.h
+ netinet/igmp_var.h
+ netinet/ip_ah.h
+ netinet/ip_carp.h
+ netinet/ip_divert.h
+ netinet/ip_esp.h
+ netinet/ip_ether.h
+ netinet/ip_gre.h
+ netinet/ip_ipcomp.h
+ netinet/ip_ipip.h
+ netinet/pim_var.h
+ netinet/tcp_var.h
+ netinet/udp_var.h
+ netinet6/in6.h
+ netinet6/ip6_divert.h
+ netinet6/pim6_var.h
+ netinet/icmp6.h
+ netmpls/mpls.h
+);
+
+my @ctls = qw (
+ kern
+ vm
+ fs
+ net
+ #debug # Special handling required
+ hw
+ #machdep # Arch specific
+ user
+ ddb
+ #vfs # Special handling required
+ fs.posix
+ kern.forkstat
+ kern.intrcnt
+ kern.malloc
+ kern.nchstats
+ kern.seminfo
+ kern.shminfo
+ kern.timecounter
+ kern.tty
+ kern.watchdog
+ net.bpf
+ net.ifq
+ net.inet
+ net.inet.ah
+ net.inet.carp
+ net.inet.divert
+ net.inet.esp
+ net.inet.etherip
+ net.inet.gre
+ net.inet.icmp
+ net.inet.igmp
+ net.inet.ip
+ net.inet.ip.ifq
+ net.inet.ipcomp
+ net.inet.ipip
+ net.inet.mobileip
+ net.inet.pfsync
+ net.inet.pim
+ net.inet.tcp
+ net.inet.udp
+ net.inet6
+ net.inet6.divert
+ net.inet6.ip6
+ net.inet6.icmp6
+ net.inet6.pim6
+ net.inet6.tcp6
+ net.inet6.udp6
+ net.mpls
+ net.mpls.ifq
+ net.key
+ net.pflow
+ net.pfsync
+ net.pipex
+ net.rt
+ vm.swapencrypt
+ #vfsgenctl # Special handling required
+);
+
+# Node name "fixups"
+my %ctl_map = (
+ "ipproto" => "net.inet",
+ "net.inet.ipproto" => "net.inet",
+ "net.inet6.ipv6proto" => "net.inet6",
+ "net.inet6.ipv6" => "net.inet6.ip6",
+ "net.inet.icmpv6" => "net.inet6.icmp6",
+ "net.inet6.divert6" => "net.inet6.divert",
+ "net.inet6.tcp6" => "net.inet.tcp",
+ "net.inet6.udp6" => "net.inet.udp",
+ "mpls" => "net.mpls",
+ "swpenc" => "vm.swapencrypt"
+);
+
+# Node mappings
+my %node_map = (
+ "net.inet.ip.ifq" => "net.ifq",
+ "net.inet.pfsync" => "net.pfsync",
+ "net.mpls.ifq" => "net.ifq"
+);
+
+my $ctlname;
+my %mib = ();
+my %sysctl = ();
+my $node;
+
+sub debug() {
+ print STDERR "$_[0]\n" if $debug;
+}
+
+# Walk the MIB and build a sysctl name to OID mapping.
+sub build_sysctl() {
+ my ($node, $name, $oid) = @_;
+ my %node = %{$node};
+ my @oid = @{$oid};
+
+ foreach my $key (sort keys %node) {
+ my @node = @{$node{$key}};
+ my $nodename = $name.($name ne '' ? '.' : '').$key;
+ my @nodeoid = (@oid, $node[0]);
+ if ($node[1] eq 'CTLTYPE_NODE') {
+ if (exists $node_map{$nodename}) {
+ $node = \%mib;
+ $ctlname = $node_map{$nodename};
+ foreach my $part (split /\./, $ctlname) {
+ $node = \%{@{$$node{$part}}[2]};
+ }
+ } else {
+ $node = $node[2];
+ }
+ &build_sysctl($node, $nodename, \@nodeoid);
+ } elsif ($node[1] ne '') {
+ $sysctl{$nodename} = \@nodeoid;
+ }
+ }
+}
+
+foreach my $ctl (@ctls) {
+ $ctls{$ctl} = $ctl;
+}
+
+# Build MIB
+foreach my $header (@headers) {
+ &debug("Processing $header...");
+ open HEADER, "/usr/include/$header" ||
+ print STDERR "Failed to open $header\n";
+ while (<HEADER>) {
+ if ($_ =~ /^#define\s+(CTL_NAMES)\s+{/ ||
+ $_ =~ /^#define\s+(CTL_(.*)_NAMES)\s+{/ ||
+ $_ =~ /^#define\s+((.*)CTL_NAMES)\s+{/) {
+ if ($1 eq 'CTL_NAMES') {
+ # Top level.
+ $node = \%mib;
+ } else {
+ # Node.
+ my $nodename = lc($2);
+ if ($header =~ /^netinet\//) {
+ $ctlname = "net.inet.$nodename";
+ } elsif ($header =~ /^netinet6\//) {
+ $ctlname = "net.inet6.$nodename";
+ } elsif ($header =~ /^net\//) {
+ $ctlname = "net.$nodename";
+ } else {
+ $ctlname = "$nodename";
+ $ctlname =~ s/^(fs|net|kern)_/$1\./;
+ }
+ if (exists $ctl_map{$ctlname}) {
+ $ctlname = $ctl_map{$ctlname};
+ }
+ if (not exists $ctls{$ctlname}) {
+ &debug("Ignoring $ctlname...");
+ next;
+ }
+
+ # Walk down from the top of the MIB.
+ $node = \%mib;
+ foreach my $part (split /\./, $ctlname) {
+ if (not exists $$node{$part}) {
+ &debug("Missing node $part");
+ $$node{$part} = [ 0, '', {} ];
+ }
+ $node = \%{@{$$node{$part}}[2]};
+ }
+ }
+
+ # Populate current node with entries.
+ my $i = -1;
+ while (defined($_) && $_ !~ /^}/) {
+ $_ = <HEADER>;
+ $i++ if $_ =~ /{.*}/;
+ next if $_ !~ /{\s+"(\w+)",\s+(CTLTYPE_[A-Z]+)\s+}/;
+ $$node{$1} = [ $i, $2, {} ];
+ }
+ }
+ }
+ close HEADER;
+}
+
+&build_sysctl(\%mib, "", []);
+
+print <<EOF;
+// mksysctl_openbsd.pl
+// MACHINE GENERATED BY THE ABOVE COMMAND; DO NOT EDIT
+
+// +build $ENV{'GOARCH'},$ENV{'GOOS'}
+
+package unix;
+
+type mibentry struct {
+ ctlname string
+ ctloid []_C_int
+}
+
+var sysctlMib = []mibentry {
+EOF
+
+foreach my $name (sort keys %sysctl) {
+ my @oid = @{$sysctl{$name}};
+ print "\t{ \"$name\", []_C_int{ ", join(', ', @oid), " } }, \n";
+}
+
+print <<EOF;
+}
+EOF
diff --git a/vendor/golang.org/x/sys/unix/mksysnum_darwin.pl b/vendor/golang.org/x/sys/unix/mksysnum_darwin.pl
new file mode 100644
index 00000000..5453c53b
--- /dev/null
+++ b/vendor/golang.org/x/sys/unix/mksysnum_darwin.pl
@@ -0,0 +1,39 @@
+#!/usr/bin/env perl
+# Copyright 2009 The Go Authors. All rights reserved.
+# Use of this source code is governed by a BSD-style
+# license that can be found in the LICENSE file.
+#
+# Generate system call table for Darwin from sys/syscall.h
+
+use strict;
+
+if($ENV{'GOARCH'} eq "" || $ENV{'GOOS'} eq "") {
+ print STDERR "GOARCH or GOOS not defined in environment\n";
+ exit 1;
+}
+
+my $command = "mksysnum_darwin.pl " . join(' ', @ARGV);
+
+print <<EOF;
+// $command
+// Code generated by the command above; see README.md. DO NOT EDIT.
+
+// +build $ENV{'GOARCH'},$ENV{'GOOS'}
+
+package unix
+
+const (
+EOF
+
+while(<>){
+ if(/^#define\s+SYS_(\w+)\s+([0-9]+)/){
+ my $name = $1;
+ my $num = $2;
+ $name =~ y/a-z/A-Z/;
+ print " SYS_$name = $num;"
+ }
+}
+
+print <<EOF;
+)
+EOF
diff --git a/vendor/golang.org/x/sys/unix/mksysnum_dragonfly.pl b/vendor/golang.org/x/sys/unix/mksysnum_dragonfly.pl
new file mode 100644
index 00000000..6804f412
--- /dev/null
+++ b/vendor/golang.org/x/sys/unix/mksysnum_dragonfly.pl
@@ -0,0 +1,50 @@
+#!/usr/bin/env perl
+# Copyright 2009 The Go Authors. All rights reserved.
+# Use of this source code is governed by a BSD-style
+# license that can be found in the LICENSE file.
+#
+# Generate system call table for DragonFly from master list
+# (for example, /usr/src/sys/kern/syscalls.master).
+
+use strict;
+
+if($ENV{'GOARCH'} eq "" || $ENV{'GOOS'} eq "") {
+ print STDERR "GOARCH or GOOS not defined in environment\n";
+ exit 1;
+}
+
+my $command = "mksysnum_dragonfly.pl " . join(' ', @ARGV);
+
+print <<EOF;
+// $command
+// Code generated by the command above; see README.md. DO NOT EDIT.
+
+// +build $ENV{'GOARCH'},$ENV{'GOOS'}
+
+package unix
+
+const (
+EOF
+
+while(<>){
+ if(/^([0-9]+)\s+STD\s+({ \S+\s+(\w+).*)$/){
+ my $num = $1;
+ my $proto = $2;
+ my $name = "SYS_$3";
+ $name =~ y/a-z/A-Z/;
+
+ # There are multiple entries for enosys and nosys, so comment them out.
+ if($name =~ /^SYS_E?NOSYS$/){
+ $name = "// $name";
+ }
+ if($name eq 'SYS_SYS_EXIT'){
+ $name = 'SYS_EXIT';
+ }
+
+ print " $name = $num; // $proto\n";
+ }
+}
+
+print <<EOF;
+)
+EOF
diff --git a/vendor/golang.org/x/sys/unix/mksysnum_freebsd.pl b/vendor/golang.org/x/sys/unix/mksysnum_freebsd.pl
new file mode 100644
index 00000000..a0a22bf5
--- /dev/null
+++ b/vendor/golang.org/x/sys/unix/mksysnum_freebsd.pl
@@ -0,0 +1,50 @@
+#!/usr/bin/env perl
+# Copyright 2009 The Go Authors. All rights reserved.
+# Use of this source code is governed by a BSD-style
+# license that can be found in the LICENSE file.
+#
+# Generate system call table for FreeBSD from master list
+# (for example, /usr/src/sys/kern/syscalls.master).
+
+use strict;
+
+if($ENV{'GOARCH'} eq "" || $ENV{'GOOS'} eq "") {
+ print STDERR "GOARCH or GOOS not defined in environment\n";
+ exit 1;
+}
+
+my $command = "mksysnum_freebsd.pl " . join(' ', @ARGV);
+
+print <<EOF;
+// $command
+// Code generated by the command above; see README.md. DO NOT EDIT.
+
+// +build $ENV{'GOARCH'},$ENV{'GOOS'}
+
+package unix
+
+const (
+EOF
+
+while(<>){
+ if(/^([0-9]+)\s+\S+\s+STD\s+({ \S+\s+(\w+).*)$/){
+ my $num = $1;
+ my $proto = $2;
+ my $name = "SYS_$3";
+ $name =~ y/a-z/A-Z/;
+
+ # There are multiple entries for enosys and nosys, so comment them out.
+ if($name =~ /^SYS_E?NOSYS$/){
+ $name = "// $name";
+ }
+ if($name eq 'SYS_SYS_EXIT'){
+ $name = 'SYS_EXIT';
+ }
+
+ print " $name = $num; // $proto\n";
+ }
+}
+
+print <<EOF;
+)
+EOF
diff --git a/vendor/golang.org/x/sys/unix/mksysnum_netbsd.pl b/vendor/golang.org/x/sys/unix/mksysnum_netbsd.pl
new file mode 100644
index 00000000..85988b14
--- /dev/null
+++ b/vendor/golang.org/x/sys/unix/mksysnum_netbsd.pl
@@ -0,0 +1,58 @@
+#!/usr/bin/env perl
+# Copyright 2009 The Go Authors. All rights reserved.
+# Use of this source code is governed by a BSD-style
+# license that can be found in the LICENSE file.
+#
+# Generate system call table for OpenBSD from master list
+# (for example, /usr/src/sys/kern/syscalls.master).
+
+use strict;
+
+if($ENV{'GOARCH'} eq "" || $ENV{'GOOS'} eq "") {
+ print STDERR "GOARCH or GOOS not defined in environment\n";
+ exit 1;
+}
+
+my $command = "mksysnum_netbsd.pl " . join(' ', @ARGV);
+
+print <<EOF;
+// $command
+// Code generated by the command above; see README.md. DO NOT EDIT.
+
+// +build $ENV{'GOARCH'},$ENV{'GOOS'}
+
+package unix
+
+const (
+EOF
+
+my $line = '';
+while(<>){
+ if($line =~ /^(.*)\\$/) {
+ # Handle continuation
+ $line = $1;
+ $_ =~ s/^\s+//;
+ $line .= $_;
+ } else {
+ # New line
+ $line = $_;
+ }
+ next if $line =~ /\\$/;
+ if($line =~ /^([0-9]+)\s+((STD)|(NOERR))\s+(RUMP\s+)?({\s+\S+\s*\*?\s*\|(\S+)\|(\S*)\|(\w+).*\s+})(\s+(\S+))?$/) {
+ my $num = $1;
+ my $proto = $6;
+ my $compat = $8;
+ my $name = "$7_$9";
+
+ $name = "$7_$11" if $11 ne '';
+ $name =~ y/a-z/A-Z/;
+
+ if($compat eq '' || $compat eq '13' || $compat eq '30' || $compat eq '50') {
+ print " $name = $num; // $proto\n";
+ }
+ }
+}
+
+print <<EOF;
+)
+EOF
diff --git a/vendor/golang.org/x/sys/unix/mksysnum_openbsd.pl b/vendor/golang.org/x/sys/unix/mksysnum_openbsd.pl
new file mode 100644
index 00000000..84edf60c
--- /dev/null
+++ b/vendor/golang.org/x/sys/unix/mksysnum_openbsd.pl
@@ -0,0 +1,50 @@
+#!/usr/bin/env perl
+# Copyright 2009 The Go Authors. All rights reserved.
+# Use of this source code is governed by a BSD-style
+# license that can be found in the LICENSE file.
+#
+# Generate system call table for OpenBSD from master list
+# (for example, /usr/src/sys/kern/syscalls.master).
+
+use strict;
+
+if($ENV{'GOARCH'} eq "" || $ENV{'GOOS'} eq "") {
+ print STDERR "GOARCH or GOOS not defined in environment\n";
+ exit 1;
+}
+
+my $command = "mksysnum_openbsd.pl " . join(' ', @ARGV);
+
+print <<EOF;
+// $command
+// Code generated by the command above; see README.md. DO NOT EDIT.
+
+// +build $ENV{'GOARCH'},$ENV{'GOOS'}
+
+package unix
+
+const (
+EOF
+
+while(<>){
+ if(/^([0-9]+)\s+STD\s+(NOLOCK\s+)?({ \S+\s+\*?(\w+).*)$/){
+ my $num = $1;
+ my $proto = $3;
+ my $name = $4;
+ $name =~ y/a-z/A-Z/;
+
+ # There are multiple entries for enosys and nosys, so comment them out.
+ if($name =~ /^SYS_E?NOSYS$/){
+ $name = "// $name";
+ }
+ if($name eq 'SYS_SYS_EXIT'){
+ $name = 'SYS_EXIT';
+ }
+
+ print " $name = $num; // $proto\n";
+ }
+}
+
+print <<EOF;
+)
+EOF
diff --git a/vendor/golang.org/x/sys/windows/LICENSE b/vendor/golang.org/x/sys/windows/LICENSE
deleted file mode 100644
index 6a66aea5..00000000
--- a/vendor/golang.org/x/sys/windows/LICENSE
+++ /dev/null
@@ -1,27 +0,0 @@
-Copyright (c) 2009 The Go Authors. All rights reserved.
-
-Redistribution and use in source and binary forms, with or without
-modification, are permitted provided that the following conditions are
-met:
-
- * Redistributions of source code must retain the above copyright
-notice, this list of conditions and the following disclaimer.
- * Redistributions in binary form must reproduce the above
-copyright notice, this list of conditions and the following disclaimer
-in the documentation and/or other materials provided with the
-distribution.
- * Neither the name of Google Inc. nor the names of its
-contributors may be used to endorse or promote products derived from
-this software without specific prior written permission.
-
-THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
diff --git a/vendor/golang.org/x/sys/windows/registry/key.go b/vendor/golang.org/x/sys/windows/registry/key.go
deleted file mode 100644
index d0beb195..00000000
--- a/vendor/golang.org/x/sys/windows/registry/key.go
+++ /dev/null
@@ -1,200 +0,0 @@
-// Copyright 2015 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-// +build windows
-
-// Package registry provides access to the Windows registry.
-//
-// Here is a simple example, opening a registry key and reading a string value from it.
-//
-// k, err := registry.OpenKey(registry.LOCAL_MACHINE, `SOFTWARE\Microsoft\Windows NT\CurrentVersion`, registry.QUERY_VALUE)
-// if err != nil {
-// log.Fatal(err)
-// }
-// defer k.Close()
-//
-// s, _, err := k.GetStringValue("SystemRoot")
-// if err != nil {
-// log.Fatal(err)
-// }
-// fmt.Printf("Windows system root is %q\n", s)
-//
-package registry
-
-import (
- "io"
- "syscall"
- "time"
-)
-
-const (
- // Registry key security and access rights.
- // See https://msdn.microsoft.com/en-us/library/windows/desktop/ms724878.aspx
- // for details.
- ALL_ACCESS = 0xf003f
- CREATE_LINK = 0x00020
- CREATE_SUB_KEY = 0x00004
- ENUMERATE_SUB_KEYS = 0x00008
- EXECUTE = 0x20019
- NOTIFY = 0x00010
- QUERY_VALUE = 0x00001
- READ = 0x20019
- SET_VALUE = 0x00002
- WOW64_32KEY = 0x00200
- WOW64_64KEY = 0x00100
- WRITE = 0x20006
-)
-
-// Key is a handle to an open Windows registry key.
-// Keys can be obtained by calling OpenKey; there are
-// also some predefined root keys such as CURRENT_USER.
-// Keys can be used directly in the Windows API.
-type Key syscall.Handle
-
-const (
- // Windows defines some predefined root keys that are always open.
- // An application can use these keys as entry points to the registry.
- // Normally these keys are used in OpenKey to open new keys,
- // but they can also be used anywhere a Key is required.
- CLASSES_ROOT = Key(syscall.HKEY_CLASSES_ROOT)
- CURRENT_USER = Key(syscall.HKEY_CURRENT_USER)
- LOCAL_MACHINE = Key(syscall.HKEY_LOCAL_MACHINE)
- USERS = Key(syscall.HKEY_USERS)
- CURRENT_CONFIG = Key(syscall.HKEY_CURRENT_CONFIG)
- PERFORMANCE_DATA = Key(syscall.HKEY_PERFORMANCE_DATA)
-)
-
-// Close closes open key k.
-func (k Key) Close() error {
- return syscall.RegCloseKey(syscall.Handle(k))
-}
-
-// OpenKey opens a new key with path name relative to key k.
-// It accepts any open key, including CURRENT_USER and others,
-// and returns the new key and an error.
-// The access parameter specifies desired access rights to the
-// key to be opened.
-func OpenKey(k Key, path string, access uint32) (Key, error) {
- p, err := syscall.UTF16PtrFromString(path)
- if err != nil {
- return 0, err
- }
- var subkey syscall.Handle
- err = syscall.RegOpenKeyEx(syscall.Handle(k), p, 0, access, &subkey)
- if err != nil {
- return 0, err
- }
- return Key(subkey), nil
-}
-
-// OpenRemoteKey opens a predefined registry key on another
-// computer pcname. The key to be opened is specified by k, but
-// can only be one of LOCAL_MACHINE, PERFORMANCE_DATA or USERS.
-// If pcname is "", OpenRemoteKey returns local computer key.
-func OpenRemoteKey(pcname string, k Key) (Key, error) {
- var err error
- var p *uint16
- if pcname != "" {
- p, err = syscall.UTF16PtrFromString(`\\` + pcname)
- if err != nil {
- return 0, err
- }
- }
- var remoteKey syscall.Handle
- err = regConnectRegistry(p, syscall.Handle(k), &remoteKey)
- if err != nil {
- return 0, err
- }
- return Key(remoteKey), nil
-}
-
-// ReadSubKeyNames returns the names of subkeys of key k.
-// The parameter n controls the number of returned names,
-// analogous to the way os.File.Readdirnames works.
-func (k Key) ReadSubKeyNames(n int) ([]string, error) {
- ki, err := k.Stat()
- if err != nil {
- return nil, err
- }
- names := make([]string, 0, ki.SubKeyCount)
- buf := make([]uint16, ki.MaxSubKeyLen+1) // extra room for terminating zero byte
-loopItems:
- for i := uint32(0); ; i++ {
- if n > 0 {
- if len(names) == n {
- return names, nil
- }
- }
- l := uint32(len(buf))
- for {
- err := syscall.RegEnumKeyEx(syscall.Handle(k), i, &buf[0], &l, nil, nil, nil, nil)
- if err == nil {
- break
- }
- if err == syscall.ERROR_MORE_DATA {
- // Double buffer size and try again.
- l = uint32(2 * len(buf))
- buf = make([]uint16, l)
- continue
- }
- if err == _ERROR_NO_MORE_ITEMS {
- break loopItems
- }
- return names, err
- }
- names = append(names, syscall.UTF16ToString(buf[:l]))
- }
- if n > len(names) {
- return names, io.EOF
- }
- return names, nil
-}
-
-// CreateKey creates a key named path under open key k.
-// CreateKey returns the new key and a boolean flag that reports
-// whether the key already existed.
-// The access parameter specifies the access rights for the key
-// to be created.
-func CreateKey(k Key, path string, access uint32) (newk Key, openedExisting bool, err error) {
- var h syscall.Handle
- var d uint32
- err = regCreateKeyEx(syscall.Handle(k), syscall.StringToUTF16Ptr(path),
- 0, nil, _REG_OPTION_NON_VOLATILE, access, nil, &h, &d)
- if err != nil {
- return 0, false, err
- }
- return Key(h), d == _REG_OPENED_EXISTING_KEY, nil
-}
-
-// DeleteKey deletes the subkey path of key k and its values.
-func DeleteKey(k Key, path string) error {
- return regDeleteKey(syscall.Handle(k), syscall.StringToUTF16Ptr(path))
-}
-
-// A KeyInfo describes the statistics of a key. It is returned by Stat.
-type KeyInfo struct {
- SubKeyCount uint32
- MaxSubKeyLen uint32 // size of the key's subkey with the longest name, in Unicode characters, not including the terminating zero byte
- ValueCount uint32
- MaxValueNameLen uint32 // size of the key's longest value name, in Unicode characters, not including the terminating zero byte
- MaxValueLen uint32 // longest data component among the key's values, in bytes
- lastWriteTime syscall.Filetime
-}
-
-// ModTime returns the key's last write time.
-func (ki *KeyInfo) ModTime() time.Time {
- return time.Unix(0, ki.lastWriteTime.Nanoseconds())
-}
-
-// Stat retrieves information about the open key k.
-func (k Key) Stat() (*KeyInfo, error) {
- var ki KeyInfo
- err := syscall.RegQueryInfoKey(syscall.Handle(k), nil, nil, nil,
- &ki.SubKeyCount, &ki.MaxSubKeyLen, nil, &ki.ValueCount,
- &ki.MaxValueNameLen, &ki.MaxValueLen, nil, &ki.lastWriteTime)
- if err != nil {
- return nil, err
- }
- return &ki, nil
-}
diff --git a/vendor/golang.org/x/sys/windows/registry/mksyscall.go b/vendor/golang.org/x/sys/windows/registry/mksyscall.go
deleted file mode 100644
index 0ac95ffe..00000000
--- a/vendor/golang.org/x/sys/windows/registry/mksyscall.go
+++ /dev/null
@@ -1,7 +0,0 @@
-// Copyright 2015 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-package registry
-
-//go:generate go run $GOROOT/src/syscall/mksyscall_windows.go -output zsyscall_windows.go syscall.go
diff --git a/vendor/golang.org/x/sys/windows/registry/syscall.go b/vendor/golang.org/x/sys/windows/registry/syscall.go
deleted file mode 100644
index e66643cb..00000000
--- a/vendor/golang.org/x/sys/windows/registry/syscall.go
+++ /dev/null
@@ -1,32 +0,0 @@
-// Copyright 2015 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-// +build windows
-
-package registry
-
-import "syscall"
-
-const (
- _REG_OPTION_NON_VOLATILE = 0
-
- _REG_CREATED_NEW_KEY = 1
- _REG_OPENED_EXISTING_KEY = 2
-
- _ERROR_NO_MORE_ITEMS syscall.Errno = 259
-)
-
-func LoadRegLoadMUIString() error {
- return procRegLoadMUIStringW.Find()
-}
-
-//sys regCreateKeyEx(key syscall.Handle, subkey *uint16, reserved uint32, class *uint16, options uint32, desired uint32, sa *syscall.SecurityAttributes, result *syscall.Handle, disposition *uint32) (regerrno error) = advapi32.RegCreateKeyExW
-//sys regDeleteKey(key syscall.Handle, subkey *uint16) (regerrno error) = advapi32.RegDeleteKeyW
-//sys regSetValueEx(key syscall.Handle, valueName *uint16, reserved uint32, vtype uint32, buf *byte, bufsize uint32) (regerrno error) = advapi32.RegSetValueExW
-//sys regEnumValue(key syscall.Handle, index uint32, name *uint16, nameLen *uint32, reserved *uint32, valtype *uint32, buf *byte, buflen *uint32) (regerrno error) = advapi32.RegEnumValueW
-//sys regDeleteValue(key syscall.Handle, name *uint16) (regerrno error) = advapi32.RegDeleteValueW
-//sys regLoadMUIString(key syscall.Handle, name *uint16, buf *uint16, buflen uint32, buflenCopied *uint32, flags uint32, dir *uint16) (regerrno error) = advapi32.RegLoadMUIStringW
-//sys regConnectRegistry(machinename *uint16, key syscall.Handle, result *syscall.Handle) (regerrno error) = advapi32.RegConnectRegistryW
-
-//sys expandEnvironmentStrings(src *uint16, dst *uint16, size uint32) (n uint32, err error) = kernel32.ExpandEnvironmentStringsW
diff --git a/vendor/golang.org/x/sys/windows/registry/value.go b/vendor/golang.org/x/sys/windows/registry/value.go
deleted file mode 100644
index 71d4e15b..00000000
--- a/vendor/golang.org/x/sys/windows/registry/value.go
+++ /dev/null
@@ -1,384 +0,0 @@
-// Copyright 2015 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-// +build windows
-
-package registry
-
-import (
- "errors"
- "io"
- "syscall"
- "unicode/utf16"
- "unsafe"
-)
-
-const (
- // Registry value types.
- NONE = 0
- SZ = 1
- EXPAND_SZ = 2
- BINARY = 3
- DWORD = 4
- DWORD_BIG_ENDIAN = 5
- LINK = 6
- MULTI_SZ = 7
- RESOURCE_LIST = 8
- FULL_RESOURCE_DESCRIPTOR = 9
- RESOURCE_REQUIREMENTS_LIST = 10
- QWORD = 11
-)
-
-var (
- // ErrShortBuffer is returned when the buffer was too short for the operation.
- ErrShortBuffer = syscall.ERROR_MORE_DATA
-
- // ErrNotExist is returned when a registry key or value does not exist.
- ErrNotExist = syscall.ERROR_FILE_NOT_FOUND
-
- // ErrUnexpectedType is returned by Get*Value when the value's type was unexpected.
- ErrUnexpectedType = errors.New("unexpected key value type")
-)
-
-// GetValue retrieves the type and data for the specified value associated
-// with an open key k. It fills up buffer buf and returns the retrieved
-// byte count n. If buf is too small to fit the stored value it returns
-// ErrShortBuffer error along with the required buffer size n.
-// If no buffer is provided, it returns true and actual buffer size n.
-// If no buffer is provided, GetValue returns the value's type only.
-// If the value does not exist, the error returned is ErrNotExist.
-//
-// GetValue is a low level function. If value's type is known, use the appropriate
-// Get*Value function instead.
-func (k Key) GetValue(name string, buf []byte) (n int, valtype uint32, err error) {
- pname, err := syscall.UTF16PtrFromString(name)
- if err != nil {
- return 0, 0, err
- }
- var pbuf *byte
- if len(buf) > 0 {
- pbuf = (*byte)(unsafe.Pointer(&buf[0]))
- }
- l := uint32(len(buf))
- err = syscall.RegQueryValueEx(syscall.Handle(k), pname, nil, &valtype, pbuf, &l)
- if err != nil {
- return int(l), valtype, err
- }
- return int(l), valtype, nil
-}
-
-func (k Key) getValue(name string, buf []byte) (date []byte, valtype uint32, err error) {
- p, err := syscall.UTF16PtrFromString(name)
- if err != nil {
- return nil, 0, err
- }
- var t uint32
- n := uint32(len(buf))
- for {
- err = syscall.RegQueryValueEx(syscall.Handle(k), p, nil, &t, (*byte)(unsafe.Pointer(&buf[0])), &n)
- if err == nil {
- return buf[:n], t, nil
- }
- if err != syscall.ERROR_MORE_DATA {
- return nil, 0, err
- }
- if n <= uint32(len(buf)) {
- return nil, 0, err
- }
- buf = make([]byte, n)
- }
-}
-
-// GetStringValue retrieves the string value for the specified
-// value name associated with an open key k. It also returns the value's type.
-// If value does not exist, GetStringValue returns ErrNotExist.
-// If value is not SZ or EXPAND_SZ, it will return the correct value
-// type and ErrUnexpectedType.
-func (k Key) GetStringValue(name string) (val string, valtype uint32, err error) {
- data, typ, err2 := k.getValue(name, make([]byte, 64))
- if err2 != nil {
- return "", typ, err2
- }
- switch typ {
- case SZ, EXPAND_SZ:
- default:
- return "", typ, ErrUnexpectedType
- }
- if len(data) == 0 {
- return "", typ, nil
- }
- u := (*[1 << 29]uint16)(unsafe.Pointer(&data[0]))[:]
- return syscall.UTF16ToString(u), typ, nil
-}
-
-// GetMUIStringValue retrieves the localized string value for
-// the specified value name associated with an open key k.
-// If the value name doesn't exist or the localized string value
-// can't be resolved, GetMUIStringValue returns ErrNotExist.
-// GetMUIStringValue panics if the system doesn't support
-// regLoadMUIString; use LoadRegLoadMUIString to check if
-// regLoadMUIString is supported before calling this function.
-func (k Key) GetMUIStringValue(name string) (string, error) {
- pname, err := syscall.UTF16PtrFromString(name)
- if err != nil {
- return "", err
- }
-
- buf := make([]uint16, 1024)
- var buflen uint32
- var pdir *uint16
-
- err = regLoadMUIString(syscall.Handle(k), pname, &buf[0], uint32(len(buf)), &buflen, 0, pdir)
- if err == syscall.ERROR_FILE_NOT_FOUND { // Try fallback path
-
- // Try to resolve the string value using the system directory as
- // a DLL search path; this assumes the string value is of the form
- // @[path]\dllname,-strID but with no path given, e.g. @tzres.dll,-320.
-
- // This approach works with tzres.dll but may have to be revised
- // in the future to allow callers to provide custom search paths.
-
- var s string
- s, err = ExpandString("%SystemRoot%\\system32\\")
- if err != nil {
- return "", err
- }
- pdir, err = syscall.UTF16PtrFromString(s)
- if err != nil {
- return "", err
- }
-
- err = regLoadMUIString(syscall.Handle(k), pname, &buf[0], uint32(len(buf)), &buflen, 0, pdir)
- }
-
- for err == syscall.ERROR_MORE_DATA { // Grow buffer if needed
- if buflen <= uint32(len(buf)) {
- break // Buffer not growing, assume race; break
- }
- buf = make([]uint16, buflen)
- err = regLoadMUIString(syscall.Handle(k), pname, &buf[0], uint32(len(buf)), &buflen, 0, pdir)
- }
-
- if err != nil {
- return "", err
- }
-
- return syscall.UTF16ToString(buf), nil
-}
-
-// ExpandString expands environment-variable strings and replaces
-// them with the values defined for the current user.
-// Use ExpandString to expand EXPAND_SZ strings.
-func ExpandString(value string) (string, error) {
- if value == "" {
- return "", nil
- }
- p, err := syscall.UTF16PtrFromString(value)
- if err != nil {
- return "", err
- }
- r := make([]uint16, 100)
- for {
- n, err := expandEnvironmentStrings(p, &r[0], uint32(len(r)))
- if err != nil {
- return "", err
- }
- if n <= uint32(len(r)) {
- u := (*[1 << 29]uint16)(unsafe.Pointer(&r[0]))[:]
- return syscall.UTF16ToString(u), nil
- }
- r = make([]uint16, n)
- }
-}
-
-// GetStringsValue retrieves the []string value for the specified
-// value name associated with an open key k. It also returns the value's type.
-// If value does not exist, GetStringsValue returns ErrNotExist.
-// If value is not MULTI_SZ, it will return the correct value
-// type and ErrUnexpectedType.
-func (k Key) GetStringsValue(name string) (val []string, valtype uint32, err error) {
- data, typ, err2 := k.getValue(name, make([]byte, 64))
- if err2 != nil {
- return nil, typ, err2
- }
- if typ != MULTI_SZ {
- return nil, typ, ErrUnexpectedType
- }
- if len(data) == 0 {
- return nil, typ, nil
- }
- p := (*[1 << 29]uint16)(unsafe.Pointer(&data[0]))[:len(data)/2]
- if len(p) == 0 {
- return nil, typ, nil
- }
- if p[len(p)-1] == 0 {
- p = p[:len(p)-1] // remove terminating null
- }
- val = make([]string, 0, 5)
- from := 0
- for i, c := range p {
- if c == 0 {
- val = append(val, string(utf16.Decode(p[from:i])))
- from = i + 1
- }
- }
- return val, typ, nil
-}
-
-// GetIntegerValue retrieves the integer value for the specified
-// value name associated with an open key k. It also returns the value's type.
-// If value does not exist, GetIntegerValue returns ErrNotExist.
-// If value is not DWORD or QWORD, it will return the correct value
-// type and ErrUnexpectedType.
-func (k Key) GetIntegerValue(name string) (val uint64, valtype uint32, err error) {
- data, typ, err2 := k.getValue(name, make([]byte, 8))
- if err2 != nil {
- return 0, typ, err2
- }
- switch typ {
- case DWORD:
- if len(data) != 4 {
- return 0, typ, errors.New("DWORD value is not 4 bytes long")
- }
- return uint64(*(*uint32)(unsafe.Pointer(&data[0]))), DWORD, nil
- case QWORD:
- if len(data) != 8 {
- return 0, typ, errors.New("QWORD value is not 8 bytes long")
- }
- return uint64(*(*uint64)(unsafe.Pointer(&data[0]))), QWORD, nil
- default:
- return 0, typ, ErrUnexpectedType
- }
-}
-
-// GetBinaryValue retrieves the binary value for the specified
-// value name associated with an open key k. It also returns the value's type.
-// If value does not exist, GetBinaryValue returns ErrNotExist.
-// If value is not BINARY, it will return the correct value
-// type and ErrUnexpectedType.
-func (k Key) GetBinaryValue(name string) (val []byte, valtype uint32, err error) {
- data, typ, err2 := k.getValue(name, make([]byte, 64))
- if err2 != nil {
- return nil, typ, err2
- }
- if typ != BINARY {
- return nil, typ, ErrUnexpectedType
- }
- return data, typ, nil
-}
-
-func (k Key) setValue(name string, valtype uint32, data []byte) error {
- p, err := syscall.UTF16PtrFromString(name)
- if err != nil {
- return err
- }
- if len(data) == 0 {
- return regSetValueEx(syscall.Handle(k), p, 0, valtype, nil, 0)
- }
- return regSetValueEx(syscall.Handle(k), p, 0, valtype, &data[0], uint32(len(data)))
-}
-
-// SetDWordValue sets the data and type of a name value
-// under key k to value and DWORD.
-func (k Key) SetDWordValue(name string, value uint32) error {
- return k.setValue(name, DWORD, (*[4]byte)(unsafe.Pointer(&value))[:])
-}
-
-// SetQWordValue sets the data and type of a name value
-// under key k to value and QWORD.
-func (k Key) SetQWordValue(name string, value uint64) error {
- return k.setValue(name, QWORD, (*[8]byte)(unsafe.Pointer(&value))[:])
-}
-
-func (k Key) setStringValue(name string, valtype uint32, value string) error {
- v, err := syscall.UTF16FromString(value)
- if err != nil {
- return err
- }
- buf := (*[1 << 29]byte)(unsafe.Pointer(&v[0]))[:len(v)*2]
- return k.setValue(name, valtype, buf)
-}
-
-// SetStringValue sets the data and type of a name value
-// under key k to value and SZ. The value must not contain a zero byte.
-func (k Key) SetStringValue(name, value string) error {
- return k.setStringValue(name, SZ, value)
-}
-
-// SetExpandStringValue sets the data and type of a name value
-// under key k to value and EXPAND_SZ. The value must not contain a zero byte.
-func (k Key) SetExpandStringValue(name, value string) error {
- return k.setStringValue(name, EXPAND_SZ, value)
-}
-
-// SetStringsValue sets the data and type of a name value
-// under key k to value and MULTI_SZ. The value strings
-// must not contain a zero byte.
-func (k Key) SetStringsValue(name string, value []string) error {
- ss := ""
- for _, s := range value {
- for i := 0; i < len(s); i++ {
- if s[i] == 0 {
- return errors.New("string cannot have 0 inside")
- }
- }
- ss += s + "\x00"
- }
- v := utf16.Encode([]rune(ss + "\x00"))
- buf := (*[1 << 29]byte)(unsafe.Pointer(&v[0]))[:len(v)*2]
- return k.setValue(name, MULTI_SZ, buf)
-}
-
-// SetBinaryValue sets the data and type of a name value
-// under key k to value and BINARY.
-func (k Key) SetBinaryValue(name string, value []byte) error {
- return k.setValue(name, BINARY, value)
-}
-
-// DeleteValue removes a named value from the key k.
-func (k Key) DeleteValue(name string) error {
- return regDeleteValue(syscall.Handle(k), syscall.StringToUTF16Ptr(name))
-}
-
-// ReadValueNames returns the value names of key k.
-// The parameter n controls the number of returned names,
-// analogous to the way os.File.Readdirnames works.
-func (k Key) ReadValueNames(n int) ([]string, error) {
- ki, err := k.Stat()
- if err != nil {
- return nil, err
- }
- names := make([]string, 0, ki.ValueCount)
- buf := make([]uint16, ki.MaxValueNameLen+1) // extra room for terminating null character
-loopItems:
- for i := uint32(0); ; i++ {
- if n > 0 {
- if len(names) == n {
- return names, nil
- }
- }
- l := uint32(len(buf))
- for {
- err := regEnumValue(syscall.Handle(k), i, &buf[0], &l, nil, nil, nil, nil)
- if err == nil {
- break
- }
- if err == syscall.ERROR_MORE_DATA {
- // Double buffer size and try again.
- l = uint32(2 * len(buf))
- buf = make([]uint16, l)
- continue
- }
- if err == _ERROR_NO_MORE_ITEMS {
- break loopItems
- }
- return names, err
- }
- names = append(names, syscall.UTF16ToString(buf[:l]))
- }
- if n > len(names) {
- return names, io.EOF
- }
- return names, nil
-}
diff --git a/vendor/golang.org/x/sys/windows/registry/zsyscall_windows.go b/vendor/golang.org/x/sys/windows/registry/zsyscall_windows.go
deleted file mode 100644
index ceebdd77..00000000
--- a/vendor/golang.org/x/sys/windows/registry/zsyscall_windows.go
+++ /dev/null
@@ -1,120 +0,0 @@
-// MACHINE GENERATED BY 'go generate' COMMAND; DO NOT EDIT
-
-package registry
-
-import (
- "syscall"
- "unsafe"
-
- "golang.org/x/sys/windows"
-)
-
-var _ unsafe.Pointer
-
-// Do the interface allocations only once for common
-// Errno values.
-const (
- errnoERROR_IO_PENDING = 997
-)
-
-var (
- errERROR_IO_PENDING error = syscall.Errno(errnoERROR_IO_PENDING)
-)
-
-// errnoErr returns common boxed Errno values, to prevent
-// allocations at runtime.
-func errnoErr(e syscall.Errno) error {
- switch e {
- case 0:
- return nil
- case errnoERROR_IO_PENDING:
- return errERROR_IO_PENDING
- }
- // TODO: add more here, after collecting data on the common
- // error values see on Windows. (perhaps when running
- // all.bat?)
- return e
-}
-
-var (
- modadvapi32 = windows.NewLazySystemDLL("advapi32.dll")
- modkernel32 = windows.NewLazySystemDLL("kernel32.dll")
-
- procRegCreateKeyExW = modadvapi32.NewProc("RegCreateKeyExW")
- procRegDeleteKeyW = modadvapi32.NewProc("RegDeleteKeyW")
- procRegSetValueExW = modadvapi32.NewProc("RegSetValueExW")
- procRegEnumValueW = modadvapi32.NewProc("RegEnumValueW")
- procRegDeleteValueW = modadvapi32.NewProc("RegDeleteValueW")
- procRegLoadMUIStringW = modadvapi32.NewProc("RegLoadMUIStringW")
- procRegConnectRegistryW = modadvapi32.NewProc("RegConnectRegistryW")
- procExpandEnvironmentStringsW = modkernel32.NewProc("ExpandEnvironmentStringsW")
-)
-
-func regCreateKeyEx(key syscall.Handle, subkey *uint16, reserved uint32, class *uint16, options uint32, desired uint32, sa *syscall.SecurityAttributes, result *syscall.Handle, disposition *uint32) (regerrno error) {
- r0, _, _ := syscall.Syscall9(procRegCreateKeyExW.Addr(), 9, uintptr(key), uintptr(unsafe.Pointer(subkey)), uintptr(reserved), uintptr(unsafe.Pointer(class)), uintptr(options), uintptr(desired), uintptr(unsafe.Pointer(sa)), uintptr(unsafe.Pointer(result)), uintptr(unsafe.Pointer(disposition)))
- if r0 != 0 {
- regerrno = syscall.Errno(r0)
- }
- return
-}
-
-func regDeleteKey(key syscall.Handle, subkey *uint16) (regerrno error) {
- r0, _, _ := syscall.Syscall(procRegDeleteKeyW.Addr(), 2, uintptr(key), uintptr(unsafe.Pointer(subkey)), 0)
- if r0 != 0 {
- regerrno = syscall.Errno(r0)
- }
- return
-}
-
-func regSetValueEx(key syscall.Handle, valueName *uint16, reserved uint32, vtype uint32, buf *byte, bufsize uint32) (regerrno error) {
- r0, _, _ := syscall.Syscall6(procRegSetValueExW.Addr(), 6, uintptr(key), uintptr(unsafe.Pointer(valueName)), uintptr(reserved), uintptr(vtype), uintptr(unsafe.Pointer(buf)), uintptr(bufsize))
- if r0 != 0 {
- regerrno = syscall.Errno(r0)
- }
- return
-}
-
-func regEnumValue(key syscall.Handle, index uint32, name *uint16, nameLen *uint32, reserved *uint32, valtype *uint32, buf *byte, buflen *uint32) (regerrno error) {
- r0, _, _ := syscall.Syscall9(procRegEnumValueW.Addr(), 8, uintptr(key), uintptr(index), uintptr(unsafe.Pointer(name)), uintptr(unsafe.Pointer(nameLen)), uintptr(unsafe.Pointer(reserved)), uintptr(unsafe.Pointer(valtype)), uintptr(unsafe.Pointer(buf)), uintptr(unsafe.Pointer(buflen)), 0)
- if r0 != 0 {
- regerrno = syscall.Errno(r0)
- }
- return
-}
-
-func regDeleteValue(key syscall.Handle, name *uint16) (regerrno error) {
- r0, _, _ := syscall.Syscall(procRegDeleteValueW.Addr(), 2, uintptr(key), uintptr(unsafe.Pointer(name)), 0)
- if r0 != 0 {
- regerrno = syscall.Errno(r0)
- }
- return
-}
-
-func regLoadMUIString(key syscall.Handle, name *uint16, buf *uint16, buflen uint32, buflenCopied *uint32, flags uint32, dir *uint16) (regerrno error) {
- r0, _, _ := syscall.Syscall9(procRegLoadMUIStringW.Addr(), 7, uintptr(key), uintptr(unsafe.Pointer(name)), uintptr(unsafe.Pointer(buf)), uintptr(buflen), uintptr(unsafe.Pointer(buflenCopied)), uintptr(flags), uintptr(unsafe.Pointer(dir)), 0, 0)
- if r0 != 0 {
- regerrno = syscall.Errno(r0)
- }
- return
-}
-
-func regConnectRegistry(machinename *uint16, key syscall.Handle, result *syscall.Handle) (regerrno error) {
- r0, _, _ := syscall.Syscall(procRegConnectRegistryW.Addr(), 3, uintptr(unsafe.Pointer(machinename)), uintptr(key), uintptr(unsafe.Pointer(result)))
- if r0 != 0 {
- regerrno = syscall.Errno(r0)
- }
- return
-}
-
-func expandEnvironmentStrings(src *uint16, dst *uint16, size uint32) (n uint32, err error) {
- r0, _, e1 := syscall.Syscall(procExpandEnvironmentStringsW.Addr(), 3, uintptr(unsafe.Pointer(src)), uintptr(unsafe.Pointer(dst)), uintptr(size))
- n = uint32(r0)
- if n == 0 {
- if e1 != 0 {
- err = errnoErr(e1)
- } else {
- err = syscall.EINVAL
- }
- }
- return
-}
diff --git a/vendor/golang.org/x/sys/windows/svc/debug/log.go b/vendor/golang.org/x/sys/windows/svc/debug/log.go
deleted file mode 100644
index e51ab42a..00000000
--- a/vendor/golang.org/x/sys/windows/svc/debug/log.go
+++ /dev/null
@@ -1,56 +0,0 @@
-// Copyright 2012 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-// +build windows
-
-package debug
-
-import (
- "os"
- "strconv"
-)
-
-// Log interface allows different log implementations to be used.
-type Log interface {
- Close() error
- Info(eid uint32, msg string) error
- Warning(eid uint32, msg string) error
- Error(eid uint32, msg string) error
-}
-
-// ConsoleLog provides access to the console.
-type ConsoleLog struct {
- Name string
-}
-
-// New creates new ConsoleLog.
-func New(source string) *ConsoleLog {
- return &ConsoleLog{Name: source}
-}
-
-// Close closes console log l.
-func (l *ConsoleLog) Close() error {
- return nil
-}
-
-func (l *ConsoleLog) report(kind string, eid uint32, msg string) error {
- s := l.Name + "." + kind + "(" + strconv.Itoa(int(eid)) + "): " + msg + "\n"
- _, err := os.Stdout.Write([]byte(s))
- return err
-}
-
-// Info writes an information event msg with event id eid to the console l.
-func (l *ConsoleLog) Info(eid uint32, msg string) error {
- return l.report("info", eid, msg)
-}
-
-// Warning writes an warning event msg with event id eid to the console l.
-func (l *ConsoleLog) Warning(eid uint32, msg string) error {
- return l.report("warn", eid, msg)
-}
-
-// Error writes an error event msg with event id eid to the console l.
-func (l *ConsoleLog) Error(eid uint32, msg string) error {
- return l.report("error", eid, msg)
-}
diff --git a/vendor/golang.org/x/sys/windows/svc/debug/service.go b/vendor/golang.org/x/sys/windows/svc/debug/service.go
deleted file mode 100644
index 123df989..00000000
--- a/vendor/golang.org/x/sys/windows/svc/debug/service.go
+++ /dev/null
@@ -1,45 +0,0 @@
-// Copyright 2012 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-// +build windows
-
-// Package debug provides facilities to execute svc.Handler on console.
-//
-package debug
-
-import (
- "os"
- "os/signal"
- "syscall"
-
- "golang.org/x/sys/windows/svc"
-)
-
-// Run executes service name by calling appropriate handler function.
-// The process is running on console, unlike real service. Use Ctrl+C to
-// send "Stop" command to your service.
-func Run(name string, handler svc.Handler) error {
- cmds := make(chan svc.ChangeRequest)
- changes := make(chan svc.Status)
-
- sig := make(chan os.Signal)
- signal.Notify(sig)
-
- go func() {
- status := svc.Status{State: svc.Stopped}
- for {
- select {
- case <-sig:
- cmds <- svc.ChangeRequest{svc.Stop, 0, 0, status}
- case status = <-changes:
- }
- }
- }()
-
- _, errno := handler.Execute([]string{name}, cmds, changes)
- if errno != 0 {
- return syscall.Errno(errno)
- }
- return nil
-}
diff --git a/vendor/golang.org/x/sys/windows/svc/event.go b/vendor/golang.org/x/sys/windows/svc/event.go
deleted file mode 100644
index 0508e228..00000000
--- a/vendor/golang.org/x/sys/windows/svc/event.go
+++ /dev/null
@@ -1,48 +0,0 @@
-// Copyright 2012 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-// +build windows
-
-package svc
-
-import (
- "errors"
-
- "golang.org/x/sys/windows"
-)
-
-// event represents auto-reset, initially non-signaled Windows event.
-// It is used to communicate between go and asm parts of this package.
-type event struct {
- h windows.Handle
-}
-
-func newEvent() (*event, error) {
- h, err := windows.CreateEvent(nil, 0, 0, nil)
- if err != nil {
- return nil, err
- }
- return &event{h: h}, nil
-}
-
-func (e *event) Close() error {
- return windows.CloseHandle(e.h)
-}
-
-func (e *event) Set() error {
- return windows.SetEvent(e.h)
-}
-
-func (e *event) Wait() error {
- s, err := windows.WaitForSingleObject(e.h, windows.INFINITE)
- switch s {
- case windows.WAIT_OBJECT_0:
- break
- case windows.WAIT_FAILED:
- return err
- default:
- return errors.New("unexpected result from WaitForSingleObject")
- }
- return nil
-}
diff --git a/vendor/golang.org/x/sys/windows/svc/eventlog/install.go b/vendor/golang.org/x/sys/windows/svc/eventlog/install.go
deleted file mode 100644
index c76a3760..00000000
--- a/vendor/golang.org/x/sys/windows/svc/eventlog/install.go
+++ /dev/null
@@ -1,80 +0,0 @@
-// Copyright 2012 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-// +build windows
-
-package eventlog
-
-import (
- "errors"
-
- "golang.org/x/sys/windows"
- "golang.org/x/sys/windows/registry"
-)
-
-const (
- // Log levels.
- Info = windows.EVENTLOG_INFORMATION_TYPE
- Warning = windows.EVENTLOG_WARNING_TYPE
- Error = windows.EVENTLOG_ERROR_TYPE
-)
-
-const addKeyName = `SYSTEM\CurrentControlSet\Services\EventLog\Application`
-
-// Install modifies PC registry to allow logging with an event source src.
-// It adds all required keys and values to the event log registry key.
-// Install uses msgFile as the event message file. If useExpandKey is true,
-// the event message file is installed as REG_EXPAND_SZ value,
-// otherwise as REG_SZ. Use bitwise of log.Error, log.Warning and
-// log.Info to specify events supported by the new event source.
-func Install(src, msgFile string, useExpandKey bool, eventsSupported uint32) error {
- appkey, err := registry.OpenKey(registry.LOCAL_MACHINE, addKeyName, registry.CREATE_SUB_KEY)
- if err != nil {
- return err
- }
- defer appkey.Close()
-
- sk, alreadyExist, err := registry.CreateKey(appkey, src, registry.SET_VALUE)
- if err != nil {
- return err
- }
- defer sk.Close()
- if alreadyExist {
- return errors.New(addKeyName + `\` + src + " registry key already exists")
- }
-
- err = sk.SetDWordValue("CustomSource", 1)
- if err != nil {
- return err
- }
- if useExpandKey {
- err = sk.SetExpandStringValue("EventMessageFile", msgFile)
- } else {
- err = sk.SetStringValue("EventMessageFile", msgFile)
- }
- if err != nil {
- return err
- }
- err = sk.SetDWordValue("TypesSupported", eventsSupported)
- if err != nil {
- return err
- }
- return nil
-}
-
-// InstallAsEventCreate is the same as Install, but uses
-// %SystemRoot%\System32\EventCreate.exe as the event message file.
-func InstallAsEventCreate(src string, eventsSupported uint32) error {
- return Install(src, "%SystemRoot%\\System32\\EventCreate.exe", true, eventsSupported)
-}
-
-// Remove deletes all registry elements installed by the correspondent Install.
-func Remove(src string) error {
- appkey, err := registry.OpenKey(registry.LOCAL_MACHINE, addKeyName, registry.SET_VALUE)
- if err != nil {
- return err
- }
- defer appkey.Close()
- return registry.DeleteKey(appkey, src)
-}
diff --git a/vendor/golang.org/x/sys/windows/svc/eventlog/log.go b/vendor/golang.org/x/sys/windows/svc/eventlog/log.go
deleted file mode 100644
index 46e5153d..00000000
--- a/vendor/golang.org/x/sys/windows/svc/eventlog/log.go
+++ /dev/null
@@ -1,70 +0,0 @@
-// Copyright 2012 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-// +build windows
-
-// Package eventlog implements access to Windows event log.
-//
-package eventlog
-
-import (
- "errors"
- "syscall"
-
- "golang.org/x/sys/windows"
-)
-
-// Log provides access to the system log.
-type Log struct {
- Handle windows.Handle
-}
-
-// Open retrieves a handle to the specified event log.
-func Open(source string) (*Log, error) {
- return OpenRemote("", source)
-}
-
-// OpenRemote does the same as Open, but on different computer host.
-func OpenRemote(host, source string) (*Log, error) {
- if source == "" {
- return nil, errors.New("Specify event log source")
- }
- var s *uint16
- if host != "" {
- s = syscall.StringToUTF16Ptr(host)
- }
- h, err := windows.RegisterEventSource(s, syscall.StringToUTF16Ptr(source))
- if err != nil {
- return nil, err
- }
- return &Log{Handle: h}, nil
-}
-
-// Close closes event log l.
-func (l *Log) Close() error {
- return windows.DeregisterEventSource(l.Handle)
-}
-
-func (l *Log) report(etype uint16, eid uint32, msg string) error {
- ss := []*uint16{syscall.StringToUTF16Ptr(msg)}
- return windows.ReportEvent(l.Handle, etype, 0, eid, 0, 1, 0, &ss[0], nil)
-}
-
-// Info writes an information event msg with event id eid to the end of event log l.
-// When EventCreate.exe is used, eid must be between 1 and 1000.
-func (l *Log) Info(eid uint32, msg string) error {
- return l.report(windows.EVENTLOG_INFORMATION_TYPE, eid, msg)
-}
-
-// Warning writes an warning event msg with event id eid to the end of event log l.
-// When EventCreate.exe is used, eid must be between 1 and 1000.
-func (l *Log) Warning(eid uint32, msg string) error {
- return l.report(windows.EVENTLOG_WARNING_TYPE, eid, msg)
-}
-
-// Error writes an error event msg with event id eid to the end of event log l.
-// When EventCreate.exe is used, eid must be between 1 and 1000.
-func (l *Log) Error(eid uint32, msg string) error {
- return l.report(windows.EVENTLOG_ERROR_TYPE, eid, msg)
-}
diff --git a/vendor/golang.org/x/sys/windows/svc/example/beep.go b/vendor/golang.org/x/sys/windows/svc/example/beep.go
deleted file mode 100644
index dcf23408..00000000
--- a/vendor/golang.org/x/sys/windows/svc/example/beep.go
+++ /dev/null
@@ -1,22 +0,0 @@
-// Copyright 2012 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-// +build windows
-
-package main
-
-import (
- "syscall"
-)
-
-// BUG(brainman): MessageBeep Windows api is broken on Windows 7,
-// so this example does not beep when runs as service on Windows 7.
-
-var (
- beepFunc = syscall.MustLoadDLL("user32.dll").MustFindProc("MessageBeep")
-)
-
-func beep() {
- beepFunc.Call(0xffffffff)
-}
diff --git a/vendor/golang.org/x/sys/windows/svc/example/install.go b/vendor/golang.org/x/sys/windows/svc/example/install.go
deleted file mode 100644
index 39cb00d2..00000000
--- a/vendor/golang.org/x/sys/windows/svc/example/install.go
+++ /dev/null
@@ -1,92 +0,0 @@
-// Copyright 2012 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-// +build windows
-
-package main
-
-import (
- "fmt"
- "os"
- "path/filepath"
-
- "golang.org/x/sys/windows/svc/eventlog"
- "golang.org/x/sys/windows/svc/mgr"
-)
-
-func exePath() (string, error) {
- prog := os.Args[0]
- p, err := filepath.Abs(prog)
- if err != nil {
- return "", err
- }
- fi, err := os.Stat(p)
- if err == nil {
- if !fi.Mode().IsDir() {
- return p, nil
- }
- err = fmt.Errorf("%s is directory", p)
- }
- if filepath.Ext(p) == "" {
- p += ".exe"
- fi, err := os.Stat(p)
- if err == nil {
- if !fi.Mode().IsDir() {
- return p, nil
- }
- err = fmt.Errorf("%s is directory", p)
- }
- }
- return "", err
-}
-
-func installService(name, desc string) error {
- exepath, err := exePath()
- if err != nil {
- return err
- }
- m, err := mgr.Connect()
- if err != nil {
- return err
- }
- defer m.Disconnect()
- s, err := m.OpenService(name)
- if err == nil {
- s.Close()
- return fmt.Errorf("service %s already exists", name)
- }
- s, err = m.CreateService(name, exepath, mgr.Config{DisplayName: desc}, "is", "auto-started")
- if err != nil {
- return err
- }
- defer s.Close()
- err = eventlog.InstallAsEventCreate(name, eventlog.Error|eventlog.Warning|eventlog.Info)
- if err != nil {
- s.Delete()
- return fmt.Errorf("SetupEventLogSource() failed: %s", err)
- }
- return nil
-}
-
-func removeService(name string) error {
- m, err := mgr.Connect()
- if err != nil {
- return err
- }
- defer m.Disconnect()
- s, err := m.OpenService(name)
- if err != nil {
- return fmt.Errorf("service %s is not installed", name)
- }
- defer s.Close()
- err = s.Delete()
- if err != nil {
- return err
- }
- err = eventlog.Remove(name)
- if err != nil {
- return fmt.Errorf("RemoveEventLogSource() failed: %s", err)
- }
- return nil
-}
diff --git a/vendor/golang.org/x/sys/windows/svc/example/main.go b/vendor/golang.org/x/sys/windows/svc/example/main.go
deleted file mode 100644
index dc96c081..00000000
--- a/vendor/golang.org/x/sys/windows/svc/example/main.go
+++ /dev/null
@@ -1,76 +0,0 @@
-// Copyright 2012 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-// +build windows
-
-// Example service program that beeps.
-//
-// The program demonstrates how to create Windows service and
-// install / remove it on a computer. It also shows how to
-// stop / start / pause / continue any service, and how to
-// write to event log. It also shows how to use debug
-// facilities available in debug package.
-//
-package main
-
-import (
- "fmt"
- "log"
- "os"
- "strings"
-
- "golang.org/x/sys/windows/svc"
-)
-
-func usage(errmsg string) {
- fmt.Fprintf(os.Stderr,
- "%s\n\n"+
- "usage: %s <command>\n"+
- " where <command> is one of\n"+
- " install, remove, debug, start, stop, pause or continue.\n",
- errmsg, os.Args[0])
- os.Exit(2)
-}
-
-func main() {
- const svcName = "myservice"
-
- isIntSess, err := svc.IsAnInteractiveSession()
- if err != nil {
- log.Fatalf("failed to determine if we are running in an interactive session: %v", err)
- }
- if !isIntSess {
- runService(svcName, false)
- return
- }
-
- if len(os.Args) < 2 {
- usage("no command specified")
- }
-
- cmd := strings.ToLower(os.Args[1])
- switch cmd {
- case "debug":
- runService(svcName, true)
- return
- case "install":
- err = installService(svcName, "my service")
- case "remove":
- err = removeService(svcName)
- case "start":
- err = startService(svcName)
- case "stop":
- err = controlService(svcName, svc.Stop, svc.Stopped)
- case "pause":
- err = controlService(svcName, svc.Pause, svc.Paused)
- case "continue":
- err = controlService(svcName, svc.Continue, svc.Running)
- default:
- usage(fmt.Sprintf("invalid command %s", cmd))
- }
- if err != nil {
- log.Fatalf("failed to %s %s: %v", cmd, svcName, err)
- }
- return
-}
diff --git a/vendor/golang.org/x/sys/windows/svc/example/manage.go b/vendor/golang.org/x/sys/windows/svc/example/manage.go
deleted file mode 100644
index 782dbd96..00000000
--- a/vendor/golang.org/x/sys/windows/svc/example/manage.go
+++ /dev/null
@@ -1,62 +0,0 @@
-// Copyright 2012 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-// +build windows
-
-package main
-
-import (
- "fmt"
- "time"
-
- "golang.org/x/sys/windows/svc"
- "golang.org/x/sys/windows/svc/mgr"
-)
-
-func startService(name string) error {
- m, err := mgr.Connect()
- if err != nil {
- return err
- }
- defer m.Disconnect()
- s, err := m.OpenService(name)
- if err != nil {
- return fmt.Errorf("could not access service: %v", err)
- }
- defer s.Close()
- err = s.Start("is", "manual-started")
- if err != nil {
- return fmt.Errorf("could not start service: %v", err)
- }
- return nil
-}
-
-func controlService(name string, c svc.Cmd, to svc.State) error {
- m, err := mgr.Connect()
- if err != nil {
- return err
- }
- defer m.Disconnect()
- s, err := m.OpenService(name)
- if err != nil {
- return fmt.Errorf("could not access service: %v", err)
- }
- defer s.Close()
- status, err := s.Control(c)
- if err != nil {
- return fmt.Errorf("could not send control=%d: %v", c, err)
- }
- timeout := time.Now().Add(10 * time.Second)
- for status.State != to {
- if timeout.Before(time.Now()) {
- return fmt.Errorf("timeout waiting for service to go to state=%d", to)
- }
- time.Sleep(300 * time.Millisecond)
- status, err = s.Query()
- if err != nil {
- return fmt.Errorf("could not retrieve service status: %v", err)
- }
- }
- return nil
-}
diff --git a/vendor/golang.org/x/sys/windows/svc/example/service.go b/vendor/golang.org/x/sys/windows/svc/example/service.go
deleted file mode 100644
index 237e8098..00000000
--- a/vendor/golang.org/x/sys/windows/svc/example/service.go
+++ /dev/null
@@ -1,82 +0,0 @@
-// Copyright 2012 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-// +build windows
-
-package main
-
-import (
- "fmt"
- "time"
-
- "golang.org/x/sys/windows/svc"
- "golang.org/x/sys/windows/svc/debug"
- "golang.org/x/sys/windows/svc/eventlog"
-)
-
-var elog debug.Log
-
-type myservice struct{}
-
-func (m *myservice) Execute(args []string, r <-chan svc.ChangeRequest, changes chan<- svc.Status) (ssec bool, errno uint32) {
- const cmdsAccepted = svc.AcceptStop | svc.AcceptShutdown | svc.AcceptPauseAndContinue
- changes <- svc.Status{State: svc.StartPending}
- fasttick := time.Tick(500 * time.Millisecond)
- slowtick := time.Tick(2 * time.Second)
- tick := fasttick
- changes <- svc.Status{State: svc.Running, Accepts: cmdsAccepted}
-loop:
- for {
- select {
- case <-tick:
- beep()
- elog.Info(1, "beep")
- case c := <-r:
- switch c.Cmd {
- case svc.Interrogate:
- changes <- c.CurrentStatus
- // Testing deadlock from https://code.google.com/p/winsvc/issues/detail?id=4
- time.Sleep(100 * time.Millisecond)
- changes <- c.CurrentStatus
- case svc.Stop, svc.Shutdown:
- break loop
- case svc.Pause:
- changes <- svc.Status{State: svc.Paused, Accepts: cmdsAccepted}
- tick = slowtick
- case svc.Continue:
- changes <- svc.Status{State: svc.Running, Accepts: cmdsAccepted}
- tick = fasttick
- default:
- elog.Error(1, fmt.Sprintf("unexpected control request #%d", c))
- }
- }
- }
- changes <- svc.Status{State: svc.StopPending}
- return
-}
-
-func runService(name string, isDebug bool) {
- var err error
- if isDebug {
- elog = debug.New(name)
- } else {
- elog, err = eventlog.Open(name)
- if err != nil {
- return
- }
- }
- defer elog.Close()
-
- elog.Info(1, fmt.Sprintf("starting %s service", name))
- run := svc.Run
- if isDebug {
- run = debug.Run
- }
- err = run(name, &myservice{})
- if err != nil {
- elog.Error(1, fmt.Sprintf("%s service failed: %v", name, err))
- return
- }
- elog.Info(1, fmt.Sprintf("%s service stopped", name))
-}
diff --git a/vendor/golang.org/x/sys/windows/svc/go12.c b/vendor/golang.org/x/sys/windows/svc/go12.c
deleted file mode 100644
index 6f1be1fa..00000000
--- a/vendor/golang.org/x/sys/windows/svc/go12.c
+++ /dev/null
@@ -1,24 +0,0 @@
-// Copyright 2012 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-// +build windows
-// +build !go1.3
-
-// copied from pkg/runtime
-typedef unsigned int uint32;
-typedef unsigned long long int uint64;
-#ifdef _64BIT
-typedef uint64 uintptr;
-#else
-typedef uint32 uintptr;
-#endif
-
-// from sys_386.s or sys_amd64.s
-void ·servicemain(void);
-
-void
-·getServiceMain(uintptr *r)
-{
- *r = (uintptr)·servicemain;
-}
diff --git a/vendor/golang.org/x/sys/windows/svc/go12.go b/vendor/golang.org/x/sys/windows/svc/go12.go
deleted file mode 100644
index cd8b913c..00000000
--- a/vendor/golang.org/x/sys/windows/svc/go12.go
+++ /dev/null
@@ -1,11 +0,0 @@
-// Copyright 2014 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-// +build windows
-// +build !go1.3
-
-package svc
-
-// from go12.c
-func getServiceMain(r *uintptr)
diff --git a/vendor/golang.org/x/sys/windows/svc/go13.go b/vendor/golang.org/x/sys/windows/svc/go13.go
deleted file mode 100644
index 9d7f3cec..00000000
--- a/vendor/golang.org/x/sys/windows/svc/go13.go
+++ /dev/null
@@ -1,31 +0,0 @@
-// Copyright 2014 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-// +build windows
-// +build go1.3
-
-package svc
-
-import "unsafe"
-
-const ptrSize = 4 << (^uintptr(0) >> 63) // unsafe.Sizeof(uintptr(0)) but an ideal const
-
-// Should be a built-in for unsafe.Pointer?
-func add(p unsafe.Pointer, x uintptr) unsafe.Pointer {
- return unsafe.Pointer(uintptr(p) + x)
-}
-
-// funcPC returns the entry PC of the function f.
-// It assumes that f is a func value. Otherwise the behavior is undefined.
-func funcPC(f interface{}) uintptr {
- return **(**uintptr)(add(unsafe.Pointer(&f), ptrSize))
-}
-
-// from sys_386.s and sys_amd64.s
-func servicectlhandler(ctl uint32) uintptr
-func servicemain(argc uint32, argv **uint16)
-
-func getServiceMain(r *uintptr) {
- *r = funcPC(servicemain)
-}
diff --git a/vendor/golang.org/x/sys/windows/svc/mgr/config.go b/vendor/golang.org/x/sys/windows/svc/mgr/config.go
deleted file mode 100644
index 0a6edba4..00000000
--- a/vendor/golang.org/x/sys/windows/svc/mgr/config.go
+++ /dev/null
@@ -1,139 +0,0 @@
-// Copyright 2012 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-// +build windows
-
-package mgr
-
-import (
- "syscall"
- "unicode/utf16"
- "unsafe"
-
- "golang.org/x/sys/windows"
-)
-
-const (
- // Service start types.
- StartManual = windows.SERVICE_DEMAND_START // the service must be started manually
- StartAutomatic = windows.SERVICE_AUTO_START // the service will start by itself whenever the computer reboots
- StartDisabled = windows.SERVICE_DISABLED // the service cannot be started
-
- // The severity of the error, and action taken,
- // if this service fails to start.
- ErrorCritical = windows.SERVICE_ERROR_CRITICAL
- ErrorIgnore = windows.SERVICE_ERROR_IGNORE
- ErrorNormal = windows.SERVICE_ERROR_NORMAL
- ErrorSevere = windows.SERVICE_ERROR_SEVERE
-)
-
-// TODO(brainman): Password is not returned by windows.QueryServiceConfig, not sure how to get it.
-
-type Config struct {
- ServiceType uint32
- StartType uint32
- ErrorControl uint32
- BinaryPathName string // fully qualified path to the service binary file, can also include arguments for an auto-start service
- LoadOrderGroup string
- TagId uint32
- Dependencies []string
- ServiceStartName string // name of the account under which the service should run
- DisplayName string
- Password string
- Description string
-}
-
-func toString(p *uint16) string {
- if p == nil {
- return ""
- }
- return syscall.UTF16ToString((*[4096]uint16)(unsafe.Pointer(p))[:])
-}
-
-func toStringSlice(ps *uint16) []string {
- if ps == nil {
- return nil
- }
- r := make([]string, 0)
- for from, i, p := 0, 0, (*[1 << 24]uint16)(unsafe.Pointer(ps)); true; i++ {
- if p[i] == 0 {
- // empty string marks the end
- if i <= from {
- break
- }
- r = append(r, string(utf16.Decode(p[from:i])))
- from = i + 1
- }
- }
- return r
-}
-
-// Config retrieves service s configuration paramteres.
-func (s *Service) Config() (Config, error) {
- var p *windows.QUERY_SERVICE_CONFIG
- n := uint32(1024)
- for {
- b := make([]byte, n)
- p = (*windows.QUERY_SERVICE_CONFIG)(unsafe.Pointer(&b[0]))
- err := windows.QueryServiceConfig(s.Handle, p, n, &n)
- if err == nil {
- break
- }
- if err.(syscall.Errno) != syscall.ERROR_INSUFFICIENT_BUFFER {
- return Config{}, err
- }
- if n <= uint32(len(b)) {
- return Config{}, err
- }
- }
-
- var p2 *windows.SERVICE_DESCRIPTION
- n = uint32(1024)
- for {
- b := make([]byte, n)
- p2 = (*windows.SERVICE_DESCRIPTION)(unsafe.Pointer(&b[0]))
- err := windows.QueryServiceConfig2(s.Handle,
- windows.SERVICE_CONFIG_DESCRIPTION, &b[0], n, &n)
- if err == nil {
- break
- }
- if err.(syscall.Errno) != syscall.ERROR_INSUFFICIENT_BUFFER {
- return Config{}, err
- }
- if n <= uint32(len(b)) {
- return Config{}, err
- }
- }
-
- return Config{
- ServiceType: p.ServiceType,
- StartType: p.StartType,
- ErrorControl: p.ErrorControl,
- BinaryPathName: toString(p.BinaryPathName),
- LoadOrderGroup: toString(p.LoadOrderGroup),
- TagId: p.TagId,
- Dependencies: toStringSlice(p.Dependencies),
- ServiceStartName: toString(p.ServiceStartName),
- DisplayName: toString(p.DisplayName),
- Description: toString(p2.Description),
- }, nil
-}
-
-func updateDescription(handle windows.Handle, desc string) error {
- d := windows.SERVICE_DESCRIPTION{toPtr(desc)}
- return windows.ChangeServiceConfig2(handle,
- windows.SERVICE_CONFIG_DESCRIPTION, (*byte)(unsafe.Pointer(&d)))
-}
-
-// UpdateConfig updates service s configuration parameters.
-func (s *Service) UpdateConfig(c Config) error {
- err := windows.ChangeServiceConfig(s.Handle, c.ServiceType, c.StartType,
- c.ErrorControl, toPtr(c.BinaryPathName), toPtr(c.LoadOrderGroup),
- nil, toStringBlock(c.Dependencies), toPtr(c.ServiceStartName),
- toPtr(c.Password), toPtr(c.DisplayName))
- if err != nil {
- return err
- }
- return updateDescription(s.Handle, c.Description)
-}
diff --git a/vendor/golang.org/x/sys/windows/svc/mgr/mgr.go b/vendor/golang.org/x/sys/windows/svc/mgr/mgr.go
deleted file mode 100644
index 76965b56..00000000
--- a/vendor/golang.org/x/sys/windows/svc/mgr/mgr.go
+++ /dev/null
@@ -1,162 +0,0 @@
-// Copyright 2012 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-// +build windows
-
-// Package mgr can be used to manage Windows service programs.
-// It can be used to install and remove them. It can also start,
-// stop and pause them. The package can query / change current
-// service state and config parameters.
-//
-package mgr
-
-import (
- "syscall"
- "unicode/utf16"
- "unsafe"
-
- "golang.org/x/sys/windows"
-)
-
-// Mgr is used to manage Windows service.
-type Mgr struct {
- Handle windows.Handle
-}
-
-// Connect establishes a connection to the service control manager.
-func Connect() (*Mgr, error) {
- return ConnectRemote("")
-}
-
-// ConnectRemote establishes a connection to the
-// service control manager on computer named host.
-func ConnectRemote(host string) (*Mgr, error) {
- var s *uint16
- if host != "" {
- s = syscall.StringToUTF16Ptr(host)
- }
- h, err := windows.OpenSCManager(s, nil, windows.SC_MANAGER_ALL_ACCESS)
- if err != nil {
- return nil, err
- }
- return &Mgr{Handle: h}, nil
-}
-
-// Disconnect closes connection to the service control manager m.
-func (m *Mgr) Disconnect() error {
- return windows.CloseServiceHandle(m.Handle)
-}
-
-func toPtr(s string) *uint16 {
- if len(s) == 0 {
- return nil
- }
- return syscall.StringToUTF16Ptr(s)
-}
-
-// toStringBlock terminates strings in ss with 0, and then
-// concatenates them together. It also adds extra 0 at the end.
-func toStringBlock(ss []string) *uint16 {
- if len(ss) == 0 {
- return nil
- }
- t := ""
- for _, s := range ss {
- if s != "" {
- t += s + "\x00"
- }
- }
- if t == "" {
- return nil
- }
- t += "\x00"
- return &utf16.Encode([]rune(t))[0]
-}
-
-// CreateService installs new service name on the system.
-// The service will be executed by running exepath binary.
-// Use config c to specify service parameters.
-// Any args will be passed as command-line arguments when
-// the service is started; these arguments are distinct from
-// the arguments passed to Service.Start or via the "Start
-// parameters" field in the service's Properties dialog box.
-func (m *Mgr) CreateService(name, exepath string, c Config, args ...string) (*Service, error) {
- if c.StartType == 0 {
- c.StartType = StartManual
- }
- if c.ErrorControl == 0 {
- c.ErrorControl = ErrorNormal
- }
- if c.ServiceType == 0 {
- c.ServiceType = windows.SERVICE_WIN32_OWN_PROCESS
- }
- s := syscall.EscapeArg(exepath)
- for _, v := range args {
- s += " " + syscall.EscapeArg(v)
- }
- h, err := windows.CreateService(m.Handle, toPtr(name), toPtr(c.DisplayName),
- windows.SERVICE_ALL_ACCESS, c.ServiceType,
- c.StartType, c.ErrorControl, toPtr(s), toPtr(c.LoadOrderGroup),
- nil, toStringBlock(c.Dependencies), toPtr(c.ServiceStartName), toPtr(c.Password))
- if err != nil {
- return nil, err
- }
- if c.Description != "" {
- err = updateDescription(h, c.Description)
- if err != nil {
- return nil, err
- }
- }
- return &Service{Name: name, Handle: h}, nil
-}
-
-// OpenService retrieves access to service name, so it can
-// be interrogated and controlled.
-func (m *Mgr) OpenService(name string) (*Service, error) {
- h, err := windows.OpenService(m.Handle, syscall.StringToUTF16Ptr(name), windows.SERVICE_ALL_ACCESS)
- if err != nil {
- return nil, err
- }
- return &Service{Name: name, Handle: h}, nil
-}
-
-// ListServices enumerates services in the specified
-// service control manager database m.
-// If the caller does not have the SERVICE_QUERY_STATUS
-// access right to a service, the service is silently
-// omitted from the list of services returned.
-func (m *Mgr) ListServices() ([]string, error) {
- var err error
- var bytesNeeded, servicesReturned uint32
- var buf []byte
- for {
- var p *byte
- if len(buf) > 0 {
- p = &buf[0]
- }
- err = windows.EnumServicesStatusEx(m.Handle, windows.SC_ENUM_PROCESS_INFO,
- windows.SERVICE_WIN32, windows.SERVICE_STATE_ALL,
- p, uint32(len(buf)), &bytesNeeded, &servicesReturned, nil, nil)
- if err == nil {
- break
- }
- if err != syscall.ERROR_MORE_DATA {
- return nil, err
- }
- if bytesNeeded <= uint32(len(buf)) {
- return nil, err
- }
- buf = make([]byte, bytesNeeded)
- }
- if servicesReturned == 0 {
- return nil, nil
- }
- services := (*[1 << 20]windows.ENUM_SERVICE_STATUS_PROCESS)(unsafe.Pointer(&buf[0]))[:servicesReturned]
- var names []string
- for _, s := range services {
- name := syscall.UTF16ToString((*[1 << 20]uint16)(unsafe.Pointer(s.ServiceName))[:])
- names = append(names, name)
- }
- return names, nil
-}
diff --git a/vendor/golang.org/x/sys/windows/svc/mgr/service.go b/vendor/golang.org/x/sys/windows/svc/mgr/service.go
deleted file mode 100644
index fdc46af5..00000000
--- a/vendor/golang.org/x/sys/windows/svc/mgr/service.go
+++ /dev/null
@@ -1,72 +0,0 @@
-// Copyright 2012 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-// +build windows
-
-package mgr
-
-import (
- "syscall"
-
- "golang.org/x/sys/windows"
- "golang.org/x/sys/windows/svc"
-)
-
-// TODO(brainman): Use EnumDependentServices to enumerate dependent services.
-
-// Service is used to access Windows service.
-type Service struct {
- Name string
- Handle windows.Handle
-}
-
-// Delete marks service s for deletion from the service control manager database.
-func (s *Service) Delete() error {
- return windows.DeleteService(s.Handle)
-}
-
-// Close relinquish access to the service s.
-func (s *Service) Close() error {
- return windows.CloseServiceHandle(s.Handle)
-}
-
-// Start starts service s.
-// args will be passed to svc.Handler.Execute.
-func (s *Service) Start(args ...string) error {
- var p **uint16
- if len(args) > 0 {
- vs := make([]*uint16, len(args))
- for i := range vs {
- vs[i] = syscall.StringToUTF16Ptr(args[i])
- }
- p = &vs[0]
- }
- return windows.StartService(s.Handle, uint32(len(args)), p)
-}
-
-// Control sends state change request c to the servce s.
-func (s *Service) Control(c svc.Cmd) (svc.Status, error) {
- var t windows.SERVICE_STATUS
- err := windows.ControlService(s.Handle, uint32(c), &t)
- if err != nil {
- return svc.Status{}, err
- }
- return svc.Status{
- State: svc.State(t.CurrentState),
- Accepts: svc.Accepted(t.ControlsAccepted),
- }, nil
-}
-
-// Query returns current status of service s.
-func (s *Service) Query() (svc.Status, error) {
- var t windows.SERVICE_STATUS
- err := windows.QueryServiceStatus(s.Handle, &t)
- if err != nil {
- return svc.Status{}, err
- }
- return svc.Status{
- State: svc.State(t.CurrentState),
- Accepts: svc.Accepted(t.ControlsAccepted),
- }, nil
-}
diff --git a/vendor/golang.org/x/sys/windows/svc/security.go b/vendor/golang.org/x/sys/windows/svc/security.go
deleted file mode 100644
index 6fbc9236..00000000
--- a/vendor/golang.org/x/sys/windows/svc/security.go
+++ /dev/null
@@ -1,62 +0,0 @@
-// Copyright 2012 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-// +build windows
-
-package svc
-
-import (
- "unsafe"
-
- "golang.org/x/sys/windows"
-)
-
-func allocSid(subAuth0 uint32) (*windows.SID, error) {
- var sid *windows.SID
- err := windows.AllocateAndInitializeSid(&windows.SECURITY_NT_AUTHORITY,
- 1, subAuth0, 0, 0, 0, 0, 0, 0, 0, &sid)
- if err != nil {
- return nil, err
- }
- return sid, nil
-}
-
-// IsAnInteractiveSession determines if calling process is running interactively.
-// It queries the process token for membership in the Interactive group.
-// http://stackoverflow.com/questions/2668851/how-do-i-detect-that-my-application-is-running-as-service-or-in-an-interactive-s
-func IsAnInteractiveSession() (bool, error) {
- interSid, err := allocSid(windows.SECURITY_INTERACTIVE_RID)
- if err != nil {
- return false, err
- }
- defer windows.FreeSid(interSid)
-
- serviceSid, err := allocSid(windows.SECURITY_SERVICE_RID)
- if err != nil {
- return false, err
- }
- defer windows.FreeSid(serviceSid)
-
- t, err := windows.OpenCurrentProcessToken()
- if err != nil {
- return false, err
- }
- defer t.Close()
-
- gs, err := t.GetTokenGroups()
- if err != nil {
- return false, err
- }
- p := unsafe.Pointer(&gs.Groups[0])
- groups := (*[2 << 20]windows.SIDAndAttributes)(p)[:gs.GroupCount]
- for _, g := range groups {
- if windows.EqualSid(g.Sid, interSid) {
- return true, nil
- }
- if windows.EqualSid(g.Sid, serviceSid) {
- return false, nil
- }
- }
- return false, nil
-}
diff --git a/vendor/golang.org/x/sys/windows/svc/service.go b/vendor/golang.org/x/sys/windows/svc/service.go
deleted file mode 100644
index 903cba3f..00000000
--- a/vendor/golang.org/x/sys/windows/svc/service.go
+++ /dev/null
@@ -1,363 +0,0 @@
-// Copyright 2012 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-// +build windows
-
-// Package svc provides everything required to build Windows service.
-//
-package svc
-
-import (
- "errors"
- "runtime"
- "syscall"
- "unsafe"
-
- "golang.org/x/sys/windows"
-)
-
-// State describes service execution state (Stopped, Running and so on).
-type State uint32
-
-const (
- Stopped = State(windows.SERVICE_STOPPED)
- StartPending = State(windows.SERVICE_START_PENDING)
- StopPending = State(windows.SERVICE_STOP_PENDING)
- Running = State(windows.SERVICE_RUNNING)
- ContinuePending = State(windows.SERVICE_CONTINUE_PENDING)
- PausePending = State(windows.SERVICE_PAUSE_PENDING)
- Paused = State(windows.SERVICE_PAUSED)
-)
-
-// Cmd represents service state change request. It is sent to a service
-// by the service manager, and should be actioned upon by the service.
-type Cmd uint32
-
-const (
- Stop = Cmd(windows.SERVICE_CONTROL_STOP)
- Pause = Cmd(windows.SERVICE_CONTROL_PAUSE)
- Continue = Cmd(windows.SERVICE_CONTROL_CONTINUE)
- Interrogate = Cmd(windows.SERVICE_CONTROL_INTERROGATE)
- Shutdown = Cmd(windows.SERVICE_CONTROL_SHUTDOWN)
- ParamChange = Cmd(windows.SERVICE_CONTROL_PARAMCHANGE)
- NetBindAdd = Cmd(windows.SERVICE_CONTROL_NETBINDADD)
- NetBindRemove = Cmd(windows.SERVICE_CONTROL_NETBINDREMOVE)
- NetBindEnable = Cmd(windows.SERVICE_CONTROL_NETBINDENABLE)
- NetBindDisable = Cmd(windows.SERVICE_CONTROL_NETBINDDISABLE)
- DeviceEvent = Cmd(windows.SERVICE_CONTROL_DEVICEEVENT)
- HardwareProfileChange = Cmd(windows.SERVICE_CONTROL_HARDWAREPROFILECHANGE)
- PowerEvent = Cmd(windows.SERVICE_CONTROL_POWEREVENT)
- SessionChange = Cmd(windows.SERVICE_CONTROL_SESSIONCHANGE)
-)
-
-// Accepted is used to describe commands accepted by the service.
-// Note that Interrogate is always accepted.
-type Accepted uint32
-
-const (
- AcceptStop = Accepted(windows.SERVICE_ACCEPT_STOP)
- AcceptShutdown = Accepted(windows.SERVICE_ACCEPT_SHUTDOWN)
- AcceptPauseAndContinue = Accepted(windows.SERVICE_ACCEPT_PAUSE_CONTINUE)
- AcceptParamChange = Accepted(windows.SERVICE_ACCEPT_PARAMCHANGE)
- AcceptNetBindChange = Accepted(windows.SERVICE_ACCEPT_NETBINDCHANGE)
- AcceptHardwareProfileChange = Accepted(windows.SERVICE_ACCEPT_HARDWAREPROFILECHANGE)
- AcceptPowerEvent = Accepted(windows.SERVICE_ACCEPT_POWEREVENT)
- AcceptSessionChange = Accepted(windows.SERVICE_ACCEPT_SESSIONCHANGE)
-)
-
-// Status combines State and Accepted commands to fully describe running service.
-type Status struct {
- State State
- Accepts Accepted
- CheckPoint uint32 // used to report progress during a lengthy operation
- WaitHint uint32 // estimated time required for a pending operation, in milliseconds
-}
-
-// ChangeRequest is sent to the service Handler to request service status change.
-type ChangeRequest struct {
- Cmd Cmd
- EventType uint32
- EventData uintptr
- CurrentStatus Status
-}
-
-// Handler is the interface that must be implemented to build Windows service.
-type Handler interface {
-
- // Execute will be called by the package code at the start of
- // the service, and the service will exit once Execute completes.
- // Inside Execute you must read service change requests from r and
- // act accordingly. You must keep service control manager up to date
- // about state of your service by writing into s as required.
- // args contains service name followed by argument strings passed
- // to the service.
- // You can provide service exit code in exitCode return parameter,
- // with 0 being "no error". You can also indicate if exit code,
- // if any, is service specific or not by using svcSpecificEC
- // parameter.
- Execute(args []string, r <-chan ChangeRequest, s chan<- Status) (svcSpecificEC bool, exitCode uint32)
-}
-
-var (
- // These are used by asm code.
- goWaitsH uintptr
- cWaitsH uintptr
- ssHandle uintptr
- sName *uint16
- sArgc uintptr
- sArgv **uint16
- ctlHandlerExProc uintptr
- cSetEvent uintptr
- cWaitForSingleObject uintptr
- cRegisterServiceCtrlHandlerExW uintptr
-)
-
-func init() {
- k := syscall.MustLoadDLL("kernel32.dll")
- cSetEvent = k.MustFindProc("SetEvent").Addr()
- cWaitForSingleObject = k.MustFindProc("WaitForSingleObject").Addr()
- a := syscall.MustLoadDLL("advapi32.dll")
- cRegisterServiceCtrlHandlerExW = a.MustFindProc("RegisterServiceCtrlHandlerExW").Addr()
-}
-
-// The HandlerEx prototype also has a context pointer but since we don't use
-// it at start-up time we don't have to pass it over either.
-type ctlEvent struct {
- cmd Cmd
- eventType uint32
- eventData uintptr
- errno uint32
-}
-
-// service provides access to windows service api.
-type service struct {
- name string
- h windows.Handle
- cWaits *event
- goWaits *event
- c chan ctlEvent
- handler Handler
-}
-
-func newService(name string, handler Handler) (*service, error) {
- var s service
- var err error
- s.name = name
- s.c = make(chan ctlEvent)
- s.handler = handler
- s.cWaits, err = newEvent()
- if err != nil {
- return nil, err
- }
- s.goWaits, err = newEvent()
- if err != nil {
- s.cWaits.Close()
- return nil, err
- }
- return &s, nil
-}
-
-func (s *service) close() error {
- s.cWaits.Close()
- s.goWaits.Close()
- return nil
-}
-
-type exitCode struct {
- isSvcSpecific bool
- errno uint32
-}
-
-func (s *service) updateStatus(status *Status, ec *exitCode) error {
- if s.h == 0 {
- return errors.New("updateStatus with no service status handle")
- }
- var t windows.SERVICE_STATUS
- t.ServiceType = windows.SERVICE_WIN32_OWN_PROCESS
- t.CurrentState = uint32(status.State)
- if status.Accepts&AcceptStop != 0 {
- t.ControlsAccepted |= windows.SERVICE_ACCEPT_STOP
- }
- if status.Accepts&AcceptShutdown != 0 {
- t.ControlsAccepted |= windows.SERVICE_ACCEPT_SHUTDOWN
- }
- if status.Accepts&AcceptPauseAndContinue != 0 {
- t.ControlsAccepted |= windows.SERVICE_ACCEPT_PAUSE_CONTINUE
- }
- if status.Accepts&AcceptParamChange != 0 {
- t.ControlsAccepted |= windows.SERVICE_ACCEPT_PARAMCHANGE
- }
- if status.Accepts&AcceptNetBindChange != 0 {
- t.ControlsAccepted |= windows.SERVICE_ACCEPT_NETBINDCHANGE
- }
- if status.Accepts&AcceptHardwareProfileChange != 0 {
- t.ControlsAccepted |= windows.SERVICE_ACCEPT_HARDWAREPROFILECHANGE
- }
- if status.Accepts&AcceptPowerEvent != 0 {
- t.ControlsAccepted |= windows.SERVICE_ACCEPT_POWEREVENT
- }
- if status.Accepts&AcceptSessionChange != 0 {
- t.ControlsAccepted |= windows.SERVICE_ACCEPT_SESSIONCHANGE
- }
- if ec.errno == 0 {
- t.Win32ExitCode = windows.NO_ERROR
- t.ServiceSpecificExitCode = windows.NO_ERROR
- } else if ec.isSvcSpecific {
- t.Win32ExitCode = uint32(windows.ERROR_SERVICE_SPECIFIC_ERROR)
- t.ServiceSpecificExitCode = ec.errno
- } else {
- t.Win32ExitCode = ec.errno
- t.ServiceSpecificExitCode = windows.NO_ERROR
- }
- t.CheckPoint = status.CheckPoint
- t.WaitHint = status.WaitHint
- return windows.SetServiceStatus(s.h, &t)
-}
-
-const (
- sysErrSetServiceStatusFailed = uint32(syscall.APPLICATION_ERROR) + iota
- sysErrNewThreadInCallback
-)
-
-func (s *service) run() {
- s.goWaits.Wait()
- s.h = windows.Handle(ssHandle)
- argv := (*[100]*int16)(unsafe.Pointer(sArgv))[:sArgc]
- args := make([]string, len(argv))
- for i, a := range argv {
- args[i] = syscall.UTF16ToString((*[1 << 20]uint16)(unsafe.Pointer(a))[:])
- }
-
- cmdsToHandler := make(chan ChangeRequest)
- changesFromHandler := make(chan Status)
- exitFromHandler := make(chan exitCode)
-
- go func() {
- ss, errno := s.handler.Execute(args, cmdsToHandler, changesFromHandler)
- exitFromHandler <- exitCode{ss, errno}
- }()
-
- status := Status{State: Stopped}
- ec := exitCode{isSvcSpecific: true, errno: 0}
- var outch chan ChangeRequest
- inch := s.c
- var cmd Cmd
- var evtype uint32
- var evdata uintptr
-loop:
- for {
- select {
- case r := <-inch:
- if r.errno != 0 {
- ec.errno = r.errno
- break loop
- }
- inch = nil
- outch = cmdsToHandler
- cmd = r.cmd
- evtype = r.eventType
- evdata = r.eventData
- case outch <- ChangeRequest{cmd, evtype, evdata, status}:
- inch = s.c
- outch = nil
- case c := <-changesFromHandler:
- err := s.updateStatus(&c, &ec)
- if err != nil {
- // best suitable error number
- ec.errno = sysErrSetServiceStatusFailed
- if err2, ok := err.(syscall.Errno); ok {
- ec.errno = uint32(err2)
- }
- break loop
- }
- status = c
- case ec = <-exitFromHandler:
- break loop
- }
- }
-
- s.updateStatus(&Status{State: Stopped}, &ec)
- s.cWaits.Set()
-}
-
-func newCallback(fn interface{}) (cb uintptr, err error) {
- defer func() {
- r := recover()
- if r == nil {
- return
- }
- cb = 0
- switch v := r.(type) {
- case string:
- err = errors.New(v)
- case error:
- err = v
- default:
- err = errors.New("unexpected panic in syscall.NewCallback")
- }
- }()
- return syscall.NewCallback(fn), nil
-}
-
-// BUG(brainman): There is no mechanism to run multiple services
-// inside one single executable. Perhaps, it can be overcome by
-// using RegisterServiceCtrlHandlerEx Windows api.
-
-// Run executes service name by calling appropriate handler function.
-func Run(name string, handler Handler) error {
- runtime.LockOSThread()
-
- tid := windows.GetCurrentThreadId()
-
- s, err := newService(name, handler)
- if err != nil {
- return err
- }
-
- ctlHandler := func(ctl uint32, evtype uint32, evdata uintptr, context uintptr) uintptr {
- e := ctlEvent{cmd: Cmd(ctl), eventType: evtype, eventData: evdata}
- // We assume that this callback function is running on
- // the same thread as Run. Nowhere in MS documentation
- // I could find statement to guarantee that. So putting
- // check here to verify, otherwise things will go bad
- // quickly, if ignored.
- i := windows.GetCurrentThreadId()
- if i != tid {
- e.errno = sysErrNewThreadInCallback
- }
- s.c <- e
- // Always return NO_ERROR (0) for now.
- return 0
- }
-
- var svcmain uintptr
- getServiceMain(&svcmain)
- t := []windows.SERVICE_TABLE_ENTRY{
- {syscall.StringToUTF16Ptr(s.name), svcmain},
- {nil, 0},
- }
-
- goWaitsH = uintptr(s.goWaits.h)
- cWaitsH = uintptr(s.cWaits.h)
- sName = t[0].ServiceName
- ctlHandlerExProc, err = newCallback(ctlHandler)
- if err != nil {
- return err
- }
-
- go s.run()
-
- err = windows.StartServiceCtrlDispatcher(&t[0])
- if err != nil {
- return err
- }
- return nil
-}
-
-// StatusHandle returns service status handle. It is safe to call this function
-// from inside the Handler.Execute because then it is guaranteed to be set.
-// This code will have to change once multiple services are possible per process.
-func StatusHandle() windows.Handle {
- return windows.Handle(ssHandle)
-}
diff --git a/vendor/golang.org/x/sys/windows/svc/sys_386.s b/vendor/golang.org/x/sys/windows/svc/sys_386.s
deleted file mode 100644
index 2c82a9d9..00000000
--- a/vendor/golang.org/x/sys/windows/svc/sys_386.s
+++ /dev/null
@@ -1,68 +0,0 @@
-// Copyright 2012 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-// +build windows
-
-// func servicemain(argc uint32, argv **uint16)
-TEXT ·servicemain(SB),7,$0
- MOVL argc+0(FP), AX
- MOVL AX, ·sArgc(SB)
- MOVL argv+4(FP), AX
- MOVL AX, ·sArgv(SB)
-
- PUSHL BP
- PUSHL BX
- PUSHL SI
- PUSHL DI
-
- SUBL $12, SP
-
- MOVL ·sName(SB), AX
- MOVL AX, (SP)
- MOVL $·servicectlhandler(SB), AX
- MOVL AX, 4(SP)
- MOVL $0, 8(SP)
- MOVL ·cRegisterServiceCtrlHandlerExW(SB), AX
- MOVL SP, BP
- CALL AX
- MOVL BP, SP
- CMPL AX, $0
- JE exit
- MOVL AX, ·ssHandle(SB)
-
- MOVL ·goWaitsH(SB), AX
- MOVL AX, (SP)
- MOVL ·cSetEvent(SB), AX
- MOVL SP, BP
- CALL AX
- MOVL BP, SP
-
- MOVL ·cWaitsH(SB), AX
- MOVL AX, (SP)
- MOVL $-1, AX
- MOVL AX, 4(SP)
- MOVL ·cWaitForSingleObject(SB), AX
- MOVL SP, BP
- CALL AX
- MOVL BP, SP
-
-exit:
- ADDL $12, SP
-
- POPL DI
- POPL SI
- POPL BX
- POPL BP
-
- MOVL 0(SP), CX
- ADDL $12, SP
- JMP CX
-
-// I do not know why, but this seems to be the only way to call
-// ctlHandlerProc on Windows 7.
-
-// func servicectlhandler(ctl uint32, evtype uint32, evdata uintptr, context uintptr) uintptr {
-TEXT ·servicectlhandler(SB),7,$0
- MOVL ·ctlHandlerExProc(SB), CX
- JMP CX
diff --git a/vendor/golang.org/x/sys/windows/svc/sys_amd64.s b/vendor/golang.org/x/sys/windows/svc/sys_amd64.s
deleted file mode 100644
index 06b42590..00000000
--- a/vendor/golang.org/x/sys/windows/svc/sys_amd64.s
+++ /dev/null
@@ -1,42 +0,0 @@
-// Copyright 2012 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-// +build windows
-
-// func servicemain(argc uint32, argv **uint16)
-TEXT ·servicemain(SB),7,$0
- MOVL CX, ·sArgc(SB)
- MOVL DX, ·sArgv(SB)
-
- SUBQ $32, SP // stack for the first 4 syscall params
-
- MOVQ ·sName(SB), CX
- MOVQ $·servicectlhandler(SB), DX
- // BUG(pastarmovj): Figure out a way to pass in context in R8.
- MOVQ ·cRegisterServiceCtrlHandlerExW(SB), AX
- CALL AX
- CMPQ AX, $0
- JE exit
- MOVQ AX, ·ssHandle(SB)
-
- MOVQ ·goWaitsH(SB), CX
- MOVQ ·cSetEvent(SB), AX
- CALL AX
-
- MOVQ ·cWaitsH(SB), CX
- MOVQ $4294967295, DX
- MOVQ ·cWaitForSingleObject(SB), AX
- CALL AX
-
-exit:
- ADDQ $32, SP
- RET
-
-// I do not know why, but this seems to be the only way to call
-// ctlHandlerProc on Windows 7.
-
-// func ·servicectlhandler(ctl uint32, evtype uint32, evdata uintptr, context uintptr) uintptr {
-TEXT ·servicectlhandler(SB),7,$0
- MOVQ ·ctlHandlerExProc(SB), AX
- JMP AX