summaryrefslogtreecommitdiffstats
path: root/vendor/golang.org/x/sys/unix
diff options
context:
space:
mode:
Diffstat (limited to 'vendor/golang.org/x/sys/unix')
-rw-r--r--vendor/golang.org/x/sys/unix/creds_test.go121
-rw-r--r--vendor/golang.org/x/sys/unix/export_test.go9
-rw-r--r--vendor/golang.org/x/sys/unix/linux/Dockerfile48
-rw-r--r--vendor/golang.org/x/sys/unix/linux/mkall.go379
-rwxr-xr-xvendor/golang.org/x/sys/unix/linux/mksysnum.pl85
-rw-r--r--vendor/golang.org/x/sys/unix/linux/types.go536
-rw-r--r--vendor/golang.org/x/sys/unix/mmap_unix_test.go23
-rw-r--r--vendor/golang.org/x/sys/unix/openbsd_test.go113
-rw-r--r--vendor/golang.org/x/sys/unix/syscall_bsd_test.go62
-rw-r--r--vendor/golang.org/x/sys/unix/syscall_freebsd_test.go20
-rw-r--r--vendor/golang.org/x/sys/unix/syscall_linux_test.go186
-rw-r--r--vendor/golang.org/x/sys/unix/syscall_test.go50
-rw-r--r--vendor/golang.org/x/sys/unix/syscall_unix_test.go353
13 files changed, 0 insertions, 1985 deletions
diff --git a/vendor/golang.org/x/sys/unix/creds_test.go b/vendor/golang.org/x/sys/unix/creds_test.go
deleted file mode 100644
index eaae7c3..0000000
--- a/vendor/golang.org/x/sys/unix/creds_test.go
+++ /dev/null
@@ -1,121 +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 linux
-
-package unix_test
-
-import (
- "bytes"
- "net"
- "os"
- "syscall"
- "testing"
-
- "golang.org/x/sys/unix"
-)
-
-// TestSCMCredentials tests the sending and receiving of credentials
-// (PID, UID, GID) in an ancillary message between two UNIX
-// sockets. The SO_PASSCRED socket option is enabled on the sending
-// socket for this to work.
-func TestSCMCredentials(t *testing.T) {
- fds, err := unix.Socketpair(unix.AF_LOCAL, unix.SOCK_STREAM, 0)
- if err != nil {
- t.Fatalf("Socketpair: %v", err)
- }
- defer unix.Close(fds[0])
- defer unix.Close(fds[1])
-
- err = unix.SetsockoptInt(fds[0], unix.SOL_SOCKET, unix.SO_PASSCRED, 1)
- if err != nil {
- t.Fatalf("SetsockoptInt: %v", err)
- }
-
- srvFile := os.NewFile(uintptr(fds[0]), "server")
- defer srvFile.Close()
- srv, err := net.FileConn(srvFile)
- if err != nil {
- t.Errorf("FileConn: %v", err)
- return
- }
- defer srv.Close()
-
- cliFile := os.NewFile(uintptr(fds[1]), "client")
- defer cliFile.Close()
- cli, err := net.FileConn(cliFile)
- if err != nil {
- t.Errorf("FileConn: %v", err)
- return
- }
- defer cli.Close()
-
- var ucred unix.Ucred
- if os.Getuid() != 0 {
- ucred.Pid = int32(os.Getpid())
- ucred.Uid = 0
- ucred.Gid = 0
- oob := unix.UnixCredentials(&ucred)
- _, _, err := cli.(*net.UnixConn).WriteMsgUnix(nil, oob, nil)
- if op, ok := err.(*net.OpError); ok {
- err = op.Err
- }
- if sys, ok := err.(*os.SyscallError); ok {
- err = sys.Err
- }
- if err != syscall.EPERM {
- t.Fatalf("WriteMsgUnix failed with %v, want EPERM", err)
- }
- }
-
- ucred.Pid = int32(os.Getpid())
- ucred.Uid = uint32(os.Getuid())
- ucred.Gid = uint32(os.Getgid())
- oob := unix.UnixCredentials(&ucred)
-
- // this is going to send a dummy byte
- n, oobn, err := cli.(*net.UnixConn).WriteMsgUnix(nil, oob, nil)
- if err != nil {
- t.Fatalf("WriteMsgUnix: %v", err)
- }
- if n != 0 {
- t.Fatalf("WriteMsgUnix n = %d, want 0", n)
- }
- if oobn != len(oob) {
- t.Fatalf("WriteMsgUnix oobn = %d, want %d", oobn, len(oob))
- }
-
- oob2 := make([]byte, 10*len(oob))
- n, oobn2, flags, _, err := srv.(*net.UnixConn).ReadMsgUnix(nil, oob2)
- if err != nil {
- t.Fatalf("ReadMsgUnix: %v", err)
- }
- if flags != 0 {
- t.Fatalf("ReadMsgUnix flags = 0x%x, want 0", flags)
- }
- if n != 1 {
- t.Fatalf("ReadMsgUnix n = %d, want 1 (dummy byte)", n)
- }
- if oobn2 != oobn {
- // without SO_PASSCRED set on the socket, ReadMsgUnix will
- // return zero oob bytes
- t.Fatalf("ReadMsgUnix oobn = %d, want %d", oobn2, oobn)
- }
- oob2 = oob2[:oobn2]
- if !bytes.Equal(oob, oob2) {
- t.Fatal("ReadMsgUnix oob bytes don't match")
- }
-
- scm, err := unix.ParseSocketControlMessage(oob2)
- if err != nil {
- t.Fatalf("ParseSocketControlMessage: %v", err)
- }
- newUcred, err := unix.ParseUnixCredentials(&scm[0])
- if err != nil {
- t.Fatalf("ParseUnixCredentials: %v", err)
- }
- if *newUcred != ucred {
- t.Fatalf("ParseUnixCredentials = %+v, want %+v", newUcred, ucred)
- }
-}
diff --git a/vendor/golang.org/x/sys/unix/export_test.go b/vendor/golang.org/x/sys/unix/export_test.go
deleted file mode 100644
index b4fdd97..0000000
--- a/vendor/golang.org/x/sys/unix/export_test.go
+++ /dev/null
@@ -1,9 +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 darwin dragonfly freebsd linux netbsd openbsd solaris
-
-package unix
-
-var Itoa = itoa
diff --git a/vendor/golang.org/x/sys/unix/linux/Dockerfile b/vendor/golang.org/x/sys/unix/linux/Dockerfile
deleted file mode 100644
index 4397143..0000000
--- a/vendor/golang.org/x/sys/unix/linux/Dockerfile
+++ /dev/null
@@ -1,48 +0,0 @@
-FROM ubuntu:16.04
-
-# Dependencies to get the git sources and go binaries
-RUN apt-get update && apt-get install -y \
- curl \
- git \
- && rm -rf /var/lib/apt/lists/*
-
-# Get the git sources. If not cached, this takes O(5 minutes).
-WORKDIR /git
-RUN git config --global advice.detachedHead false
-# Linux Kernel: Released 19 Feb 2017
-RUN git clone --branch v4.10 --depth 1 https://kernel.googlesource.com/pub/scm/linux/kernel/git/torvalds/linux
-# GNU C library: Released 05 Feb 2017 (we should try to get a secure way to clone this)
-RUN git clone --branch glibc-2.25 --depth 1 git://sourceware.org/git/glibc.git
-
-# Get Go 1.8 (https://github.com/docker-library/golang/blob/master/1.8/Dockerfile)
-ENV GOLANG_VERSION 1.8
-ENV GOLANG_DOWNLOAD_URL https://golang.org/dl/go$GOLANG_VERSION.linux-amd64.tar.gz
-ENV GOLANG_DOWNLOAD_SHA256 53ab94104ee3923e228a2cb2116e5e462ad3ebaeea06ff04463479d7f12d27ca
-
-RUN curl -fsSL "$GOLANG_DOWNLOAD_URL" -o golang.tar.gz \
- && echo "$GOLANG_DOWNLOAD_SHA256 golang.tar.gz" | sha256sum -c - \
- && tar -C /usr/local -xzf golang.tar.gz \
- && rm golang.tar.gz
-
-ENV PATH /usr/local/go/bin:$PATH
-
-# Linux and Glibc build dependencies
-RUN apt-get update && apt-get install -y \
- gawk make python \
- gcc gcc-multilib \
- gettext texinfo \
- && rm -rf /var/lib/apt/lists/*
-# Emulator and cross compilers
-RUN apt-get update && apt-get install -y \
- qemu \
- gcc-aarch64-linux-gnu gcc-arm-linux-gnueabi \
- gcc-mips-linux-gnu gcc-mips64-linux-gnuabi64 \
- gcc-mips64el-linux-gnuabi64 gcc-mipsel-linux-gnu \
- gcc-powerpc64-linux-gnu gcc-powerpc64le-linux-gnu \
- gcc-s390x-linux-gnu gcc-sparc64-linux-gnu \
- && rm -rf /var/lib/apt/lists/*
-
-# Let the scripts know they are in the docker environment
-ENV GOLANG_SYS_BUILD docker
-WORKDIR /build
-ENTRYPOINT ["go", "run", "linux/mkall.go", "/git/linux", "/git/glibc"]
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 429754f..0000000
--- a/vendor/golang.org/x/sys/unix/linux/mkall.go
+++ /dev/null
@@ -1,379 +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 (
- "fmt"
- "os"
- "os/exec"
- "path/filepath"
- "runtime"
- "strings"
-)
-
-// 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,
- // },
-}
-
-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)
- }
- }
-}
-
-// 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
-}
diff --git a/vendor/golang.org/x/sys/unix/linux/mksysnum.pl b/vendor/golang.org/x/sys/unix/linux/mksysnum.pl
deleted file mode 100755
index 63fd800..0000000
--- a/vendor/golang.org/x/sys/unix/linux/mksysnum.pl
+++ /dev/null
@@ -1,85 +0,0 @@
-#!/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.
-
-use strict;
-
-if($ENV{'GOARCH'} eq "" || $ENV{'GOOS'} eq "") {
- print STDERR "GOARCH or GOOS not defined in environment\n";
- exit 1;
-}
-
-# Check that we are using the new build system if we should
-if($ENV{'GOLANG_SYS_BUILD'} ne "docker") {
- print STDERR "In the new build system, mksysnum should not be called directly.\n";
- print STDERR "See README.md\n";
- exit 1;
-}
-
-my $command = "$0 ". 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 $offset = 0;
-
-sub fmt {
- my ($name, $num) = @_;
- if($num > 999){
- # ignore deprecated syscalls that are no longer implemented
- # https://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/tree/include/uapi/asm-generic/unistd.h?id=refs/heads/master#n716
- return;
- }
- $name =~ y/a-z/A-Z/;
- $num = $num + $offset;
- print " SYS_$name = $num;\n";
-}
-
-my $prev;
-open(CC, "$ENV{'CC'} -E -dD @ARGV |") || die "can't run $ENV{'CC'}";
-while(<CC>){
- if(/^#define __NR_Linux\s+([0-9]+)/){
- # mips/mips64: extract offset
- $offset = $1;
- }
- elsif(/^#define __NR(\w*)_SYSCALL_BASE\s+([0-9]+)/){
- # arm: extract offset
- $offset = $1;
- }
- elsif(/^#define __NR_syscalls\s+/) {
- # ignore redefinitions of __NR_syscalls
- }
- elsif(/^#define __NR_(\w*)Linux_syscalls\s+/) {
- # mips/mips64: ignore definitions about the number of syscalls
- }
- elsif(/^#define __NR_(\w+)\s+([0-9]+)/){
- $prev = $2;
- fmt($1, $2);
- }
- elsif(/^#define __NR3264_(\w+)\s+([0-9]+)/){
- $prev = $2;
- fmt($1, $2);
- }
- elsif(/^#define __NR_(\w+)\s+\(\w+\+\s*([0-9]+)\)/){
- fmt($1, $prev+$2)
- }
- elsif(/^#define __NR_(\w+)\s+\(__NR_Linux \+ ([0-9]+)/){
- fmt($1, $2);
- }
- elsif(/^#define __NR_(\w+)\s+\(__NR_SYSCALL_BASE \+ ([0-9]+)/){
- fmt($1, $2);
- }
-}
-
-print <<EOF;
-)
-EOF
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 d3bf24a..0000000
--- a/vendor/golang.org/x/sys/unix/linux/types.go
+++ /dev/null
@@ -1,536 +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/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/netlink.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>
-
-// 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
-
-// Certain constants and structs are missing from the fs/crypto UAPI
-#define FS_MAX_KEY_SIZE 64
-struct fscrypt_key {
- __u32 mode;
- __u8 raw[FS_MAX_KEY_SIZE];
- __u32 size;
-};
-
-#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(__powerpc64__)
-typedef struct pt_regs PtraceRegs;
-#elif defined(__mips__)
-typedef struct user 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
-
-// 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 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
- SizeofIPMreq = C.sizeof_struct_ip_mreq
- SizeofIPMreqn = C.sizeof_struct_ip_mreqn
- SizeofIPv6Mreq = C.sizeof_struct_ipv6_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_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
-
-// sysconf information
-
-const _SC_PAGESIZE = C._SC_PAGESIZE
-
-// Terminal handling
-
-type Termios C.termios_t
diff --git a/vendor/golang.org/x/sys/unix/mmap_unix_test.go b/vendor/golang.org/x/sys/unix/mmap_unix_test.go
deleted file mode 100644
index 18ccec0..0000000
--- a/vendor/golang.org/x/sys/unix/mmap_unix_test.go
+++ /dev/null
@@ -1,23 +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 darwin dragonfly freebsd linux netbsd openbsd solaris
-
-package unix_test
-
-import (
- "testing"
-
- "golang.org/x/sys/unix"
-)
-
-func TestMmap(t *testing.T) {
- b, err := unix.Mmap(-1, 0, unix.Getpagesize(), unix.PROT_NONE, unix.MAP_ANON|unix.MAP_PRIVATE)
- if err != nil {
- t.Fatalf("Mmap: %v", err)
- }
- if err := unix.Munmap(b); err != nil {
- t.Fatalf("Munmap: %v", err)
- }
-}
diff --git a/vendor/golang.org/x/sys/unix/openbsd_test.go b/vendor/golang.org/x/sys/unix/openbsd_test.go
deleted file mode 100644
index 734d765..0000000
--- a/vendor/golang.org/x/sys/unix/openbsd_test.go
+++ /dev/null
@@ -1,113 +0,0 @@
-// Copyright 2016 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 openbsd
-
-// This, on the face of it, bizarre testing mechanism is necessary because
-// the only reliable way to gauge whether or not a pledge(2) call has succeeded
-// is that the program has been killed as a result of breaking its pledge.
-
-package unix_test
-
-import (
- "flag"
- "fmt"
- "io/ioutil"
- "os"
- "os/exec"
- "path/filepath"
- "testing"
-
- "golang.org/x/sys/unix"
-)
-
-type testProc struct {
- fn func() // should always exit instead of returning
- cleanup func() error // for instance, delete coredumps from testing pledge
- success bool // whether zero-exit means success or failure
-}
-
-var (
- testProcs = map[string]testProc{}
- procName = ""
-)
-
-const (
- optName = "sys-unix-internal-procname"
-)
-
-func init() {
- flag.StringVar(&procName, optName, "", "internal use only")
-}
-
-// testCmd generates a proper command that, when executed, runs the test
-// corresponding to the given key.
-func testCmd(procName string) (*exec.Cmd, error) {
- exe, err := filepath.Abs(os.Args[0])
- if err != nil {
- return nil, err
- }
- cmd := exec.Command(exe, "-"+optName+"="+procName)
- cmd.Stdout, cmd.Stderr = os.Stdout, os.Stderr
- return cmd, nil
-}
-
-// ExitsCorrectly is a comprehensive, one-line-of-use wrapper for testing
-// a testProc with a key.
-func ExitsCorrectly(procName string, t *testing.T) {
- s := testProcs[procName]
- c, err := testCmd(procName)
- defer func() {
- if s.cleanup() != nil {
- t.Fatalf("Failed to run cleanup for %s", procName)
- }
- }()
- if err != nil {
- t.Fatalf("Failed to construct command for %s", procName)
- }
- if (c.Run() == nil) != s.success {
- result := "succeed"
- if !s.success {
- result = "fail"
- }
- t.Fatalf("Process did not %s when it was supposed to", result)
- }
-}
-
-func TestMain(m *testing.M) {
- flag.Parse()
- if procName != "" {
- testProcs[procName].fn()
- }
- os.Exit(m.Run())
-}
-
-// For example, add a test for pledge.
-func init() {
- testProcs["pledge"] = testProc{
- func() {
- fmt.Println(unix.Pledge("", nil))
- os.Exit(0)
- },
- func() error {
- files, err := ioutil.ReadDir(".")
- if err != nil {
- return err
- }
- for _, file := range files {
- if filepath.Ext(file.Name()) == ".core" {
- if err := os.Remove(file.Name()); err != nil {
- return err
- }
- }
- }
- return nil
- },
- false,
- }
-}
-
-func TestPledge(t *testing.T) {
- ExitsCorrectly("pledge", t)
-}
diff --git a/vendor/golang.org/x/sys/unix/syscall_bsd_test.go b/vendor/golang.org/x/sys/unix/syscall_bsd_test.go
deleted file mode 100644
index d8085a0..0000000
--- a/vendor/golang.org/x/sys/unix/syscall_bsd_test.go
+++ /dev/null
@@ -1,62 +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 darwin dragonfly freebsd openbsd
-
-package unix_test
-
-import (
- "os/exec"
- "runtime"
- "testing"
-
- "golang.org/x/sys/unix"
-)
-
-const MNT_WAIT = 1
-const MNT_NOWAIT = 2
-
-func TestGetfsstat(t *testing.T) {
- const flags = MNT_NOWAIT // see golang.org/issue/16937
- n, err := unix.Getfsstat(nil, flags)
- if err != nil {
- t.Fatal(err)
- }
-
- data := make([]unix.Statfs_t, n)
- n2, err := unix.Getfsstat(data, flags)
- if err != nil {
- t.Fatal(err)
- }
- if n != n2 {
- t.Errorf("Getfsstat(nil) = %d, but subsequent Getfsstat(slice) = %d", n, n2)
- }
- for i, stat := range data {
- if stat == (unix.Statfs_t{}) {
- t.Errorf("index %v is an empty Statfs_t struct", i)
- }
- }
- if t.Failed() {
- for i, stat := range data[:n2] {
- t.Logf("data[%v] = %+v", i, stat)
- }
- mount, err := exec.Command("mount").CombinedOutput()
- if err != nil {
- t.Logf("mount: %v\n%s", err, mount)
- } else {
- t.Logf("mount: %s", mount)
- }
- }
-}
-
-func TestSysctlRaw(t *testing.T) {
- if runtime.GOOS == "openbsd" {
- t.Skip("kern.proc.pid does not exist on OpenBSD")
- }
-
- _, err := unix.SysctlRaw("kern.proc.pid", unix.Getpid())
- if err != nil {
- t.Fatal(err)
- }
-}
diff --git a/vendor/golang.org/x/sys/unix/syscall_freebsd_test.go b/vendor/golang.org/x/sys/unix/syscall_freebsd_test.go
deleted file mode 100644
index 3c3d825..0000000
--- a/vendor/golang.org/x/sys/unix/syscall_freebsd_test.go
+++ /dev/null
@@ -1,20 +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 freebsd
-
-package unix_test
-
-import (
- "testing"
-
- "golang.org/x/sys/unix"
-)
-
-func TestSysctlUint64(t *testing.T) {
- _, err := unix.SysctlUint64("security.mac.labeled")
- if err != nil {
- t.Fatal(err)
- }
-}
diff --git a/vendor/golang.org/x/sys/unix/syscall_linux_test.go b/vendor/golang.org/x/sys/unix/syscall_linux_test.go
deleted file mode 100644
index 91184ca..0000000
--- a/vendor/golang.org/x/sys/unix/syscall_linux_test.go
+++ /dev/null
@@ -1,186 +0,0 @@
-// Copyright 2016 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 linux
-
-package unix_test
-
-import (
- "io/ioutil"
- "os"
- "testing"
- "time"
-
- "golang.org/x/sys/unix"
-)
-
-func TestPoll(t *testing.T) {
- f, cleanup := mktmpfifo(t)
- defer cleanup()
-
- const timeout = 100
-
- ok := make(chan bool, 1)
- go func() {
- select {
- case <-time.After(10 * timeout * time.Millisecond):
- t.Errorf("Poll: failed to timeout after %d milliseconds", 10*timeout)
- case <-ok:
- }
- }()
-
- fds := []unix.PollFd{{Fd: int32(f.Fd()), Events: unix.POLLIN}}
- n, err := unix.Poll(fds, timeout)
- ok <- true
- if err != nil {
- t.Errorf("Poll: unexpected error: %v", err)
- return
- }
- if n != 0 {
- t.Errorf("Poll: wrong number of events: got %v, expected %v", n, 0)
- return
- }
-}
-
-func TestPpoll(t *testing.T) {
- f, cleanup := mktmpfifo(t)
- defer cleanup()
-
- const timeout = 100 * time.Millisecond
-
- ok := make(chan bool, 1)
- go func() {
- select {
- case <-time.After(10 * timeout):
- t.Errorf("Ppoll: failed to timeout after %d", 10*timeout)
- case <-ok:
- }
- }()
-
- fds := []unix.PollFd{{Fd: int32(f.Fd()), Events: unix.POLLIN}}
- timeoutTs := unix.NsecToTimespec(int64(timeout))
- n, err := unix.Ppoll(fds, &timeoutTs, nil)
- ok <- true
- if err != nil {
- t.Errorf("Ppoll: unexpected error: %v", err)
- return
- }
- if n != 0 {
- t.Errorf("Ppoll: wrong number of events: got %v, expected %v", n, 0)
- return
- }
-}
-
-// mktmpfifo creates a temporary FIFO and provides a cleanup function.
-func mktmpfifo(t *testing.T) (*os.File, func()) {
- err := unix.Mkfifo("fifo", 0666)
- if err != nil {
- t.Fatalf("mktmpfifo: failed to create FIFO: %v", err)
- }
-
- f, err := os.OpenFile("fifo", os.O_RDWR, 0666)
- if err != nil {
- os.Remove("fifo")
- t.Fatalf("mktmpfifo: failed to open FIFO: %v", err)
- }
-
- return f, func() {
- f.Close()
- os.Remove("fifo")
- }
-}
-
-func TestTime(t *testing.T) {
- var ut unix.Time_t
- ut2, err := unix.Time(&ut)
- if err != nil {
- t.Fatalf("Time: %v", err)
- }
- if ut != ut2 {
- t.Errorf("Time: return value %v should be equal to argument %v", ut2, ut)
- }
-
- var now time.Time
-
- for i := 0; i < 10; i++ {
- ut, err = unix.Time(nil)
- if err != nil {
- t.Fatalf("Time: %v", err)
- }
-
- now = time.Now()
-
- if int64(ut) == now.Unix() {
- return
- }
- }
-
- t.Errorf("Time: return value %v should be nearly equal to time.Now().Unix() %v", ut, now.Unix())
-}
-
-func TestUtime(t *testing.T) {
- defer chtmpdir(t)()
-
- touch(t, "file1")
-
- buf := &unix.Utimbuf{
- Modtime: 12345,
- }
-
- err := unix.Utime("file1", buf)
- if err != nil {
- t.Fatalf("Utime: %v", err)
- }
-
- fi, err := os.Stat("file1")
- if err != nil {
- t.Fatal(err)
- }
-
- if fi.ModTime().Unix() != 12345 {
- t.Errorf("Utime: failed to change modtime: expected %v, got %v", 12345, fi.ModTime().Unix())
- }
-}
-
-func TestGetrlimit(t *testing.T) {
- var rlim unix.Rlimit
- err := unix.Getrlimit(unix.RLIMIT_AS, &rlim)
- if err != nil {
- t.Fatalf("Getrlimit: %v", err)
- }
-}
-
-// utilities taken from os/os_test.go
-
-func touch(t *testing.T, name string) {
- f, err := os.Create(name)
- if err != nil {
- t.Fatal(err)
- }
- if err := f.Close(); err != nil {
- t.Fatal(err)
- }
-}
-
-// chtmpdir changes the working directory to a new temporary directory and
-// provides a cleanup function. Used when PWD is read-only.
-func chtmpdir(t *testing.T) func() {
- oldwd, err := os.Getwd()
- if err != nil {
- t.Fatalf("chtmpdir: %v", err)
- }
- d, err := ioutil.TempDir("", "test")
- if err != nil {
- t.Fatalf("chtmpdir: %v", err)
- }
- if err := os.Chdir(d); err != nil {
- t.Fatalf("chtmpdir: %v", err)
- }
- return func() {
- if err := os.Chdir(oldwd); err != nil {
- t.Fatalf("chtmpdir: %v", err)
- }
- os.RemoveAll(d)
- }
-}
diff --git a/vendor/golang.org/x/sys/unix/syscall_test.go b/vendor/golang.org/x/sys/unix/syscall_test.go
deleted file mode 100644
index 95eac92..0000000
--- a/vendor/golang.org/x/sys/unix/syscall_test.go
+++ /dev/null
@@ -1,50 +0,0 @@
-// Copyright 2013 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 darwin dragonfly freebsd linux netbsd openbsd solaris
-
-package unix_test
-
-import (
- "fmt"
- "testing"
-
- "golang.org/x/sys/unix"
-)
-
-func testSetGetenv(t *testing.T, key, value string) {
- err := unix.Setenv(key, value)
- if err != nil {
- t.Fatalf("Setenv failed to set %q: %v", value, err)
- }
- newvalue, found := unix.Getenv(key)
- if !found {
- t.Fatalf("Getenv failed to find %v variable (want value %q)", key, value)
- }
- if newvalue != value {
- t.Fatalf("Getenv(%v) = %q; want %q", key, newvalue, value)
- }
-}
-
-func TestEnv(t *testing.T) {
- testSetGetenv(t, "TESTENV", "AVALUE")
- // make sure TESTENV gets set to "", not deleted
- testSetGetenv(t, "TESTENV", "")
-}
-
-func TestItoa(t *testing.T) {
- // Make most negative integer: 0x8000...
- i := 1
- for i<<1 != 0 {
- i <<= 1
- }
- if i >= 0 {
- t.Fatal("bad math")
- }
- s := unix.Itoa(i)
- f := fmt.Sprint(i)
- if s != f {
- t.Fatalf("itoa(%d) = %s, want %s", i, s, f)
- }
-}
diff --git a/vendor/golang.org/x/sys/unix/syscall_unix_test.go b/vendor/golang.org/x/sys/unix/syscall_unix_test.go
deleted file mode 100644
index 49208a0..0000000
--- a/vendor/golang.org/x/sys/unix/syscall_unix_test.go
+++ /dev/null
@@ -1,353 +0,0 @@
-// Copyright 2013 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 darwin dragonfly freebsd linux netbsd openbsd solaris
-
-package unix_test
-
-import (
- "flag"
- "fmt"
- "io/ioutil"
- "net"
- "os"
- "os/exec"
- "path/filepath"
- "runtime"
- "testing"
- "time"
-
- "golang.org/x/sys/unix"
-)
-
-// Tests that below functions, structures and constants are consistent
-// on all Unix-like systems.
-func _() {
- // program scheduling priority functions and constants
- var (
- _ func(int, int, int) error = unix.Setpriority
- _ func(int, int) (int, error) = unix.Getpriority
- )
- const (
- _ int = unix.PRIO_USER
- _ int = unix.PRIO_PROCESS
- _ int = unix.PRIO_PGRP
- )
-
- // termios constants
- const (
- _ int = unix.TCIFLUSH
- _ int = unix.TCIOFLUSH
- _ int = unix.TCOFLUSH
- )
-
- // fcntl file locking structure and constants
- var (
- _ = unix.Flock_t{
- Type: int16(0),
- Whence: int16(0),
- Start: int64(0),
- Len: int64(0),
- Pid: int32(0),
- }
- )
- const (
- _ = unix.F_GETLK
- _ = unix.F_SETLK
- _ = unix.F_SETLKW
- )
-}
-
-// TestFcntlFlock tests whether the file locking structure matches
-// the calling convention of each kernel.
-func TestFcntlFlock(t *testing.T) {
- name := filepath.Join(os.TempDir(), "TestFcntlFlock")
- fd, err := unix.Open(name, unix.O_CREAT|unix.O_RDWR|unix.O_CLOEXEC, 0)
- if err != nil {
- t.Fatalf("Open failed: %v", err)
- }
- defer unix.Unlink(name)
- defer unix.Close(fd)
- flock := unix.Flock_t{
- Type: unix.F_RDLCK,
- Start: 0, Len: 0, Whence: 1,
- }
- if err := unix.FcntlFlock(uintptr(fd), unix.F_GETLK, &flock); err != nil {
- t.Fatalf("FcntlFlock failed: %v", err)
- }
-}
-
-// TestPassFD tests passing a file descriptor over a Unix socket.
-//
-// This test involved both a parent and child process. The parent
-// process is invoked as a normal test, with "go test", which then
-// runs the child process by running the current test binary with args
-// "-test.run=^TestPassFD$" and an environment variable used to signal
-// that the test should become the child process instead.
-func TestPassFD(t *testing.T) {
- switch runtime.GOOS {
- case "dragonfly":
- // TODO(jsing): Figure out why sendmsg is returning EINVAL.
- t.Skip("skipping test on dragonfly")
- case "solaris":
- // TODO(aram): Figure out why ReadMsgUnix is returning empty message.
- t.Skip("skipping test on solaris, see issue 7402")
- }
- if os.Getenv("GO_WANT_HELPER_PROCESS") == "1" {
- passFDChild()
- return
- }
-
- tempDir, err := ioutil.TempDir("", "TestPassFD")
- if err != nil {
- t.Fatal(err)
- }
- defer os.RemoveAll(tempDir)
-
- fds, err := unix.Socketpair(unix.AF_LOCAL, unix.SOCK_STREAM, 0)
- if err != nil {
- t.Fatalf("Socketpair: %v", err)
- }
- defer unix.Close(fds[0])
- defer unix.Close(fds[1])
- writeFile := os.NewFile(uintptr(fds[0]), "child-writes")
- readFile := os.NewFile(uintptr(fds[1]), "parent-reads")
- defer writeFile.Close()
- defer readFile.Close()
-
- cmd := exec.Command(os.Args[0], "-test.run=^TestPassFD$", "--", tempDir)
- cmd.Env = []string{"GO_WANT_HELPER_PROCESS=1"}
- if lp := os.Getenv("LD_LIBRARY_PATH"); lp != "" {
- cmd.Env = append(cmd.Env, "LD_LIBRARY_PATH="+lp)
- }
- cmd.ExtraFiles = []*os.File{writeFile}
-
- out, err := cmd.CombinedOutput()
- if len(out) > 0 || err != nil {
- t.Fatalf("child process: %q, %v", out, err)
- }
-
- c, err := net.FileConn(readFile)
- if err != nil {
- t.Fatalf("FileConn: %v", err)
- }
- defer c.Close()
-
- uc, ok := c.(*net.UnixConn)
- if !ok {
- t.Fatalf("unexpected FileConn type; expected UnixConn, got %T", c)
- }
-
- buf := make([]byte, 32) // expect 1 byte
- oob := make([]byte, 32) // expect 24 bytes
- closeUnix := time.AfterFunc(5*time.Second, func() {
- t.Logf("timeout reading from unix socket")
- uc.Close()
- })
- _, oobn, _, _, err := uc.ReadMsgUnix(buf, oob)
- closeUnix.Stop()
-
- scms, err := unix.ParseSocketControlMessage(oob[:oobn])
- if err != nil {
- t.Fatalf("ParseSocketControlMessage: %v", err)
- }
- if len(scms) != 1 {
- t.Fatalf("expected 1 SocketControlMessage; got scms = %#v", scms)
- }
- scm := scms[0]
- gotFds, err := unix.ParseUnixRights(&scm)
- if err != nil {
- t.Fatalf("unix.ParseUnixRights: %v", err)
- }
- if len(gotFds) != 1 {
- t.Fatalf("wanted 1 fd; got %#v", gotFds)
- }
-
- f := os.NewFile(uintptr(gotFds[0]), "fd-from-child")
- defer f.Close()
-
- got, err := ioutil.ReadAll(f)
- want := "Hello from child process!\n"
- if string(got) != want {
- t.Errorf("child process ReadAll: %q, %v; want %q", got, err, want)
- }
-}
-
-// passFDChild is the child process used by TestPassFD.
-func passFDChild() {
- defer os.Exit(0)
-
- // Look for our fd. It should be fd 3, but we work around an fd leak
- // bug here (http://golang.org/issue/2603) to let it be elsewhere.
- var uc *net.UnixConn
- for fd := uintptr(3); fd <= 10; fd++ {
- f := os.NewFile(fd, "unix-conn")
- var ok bool
- netc, _ := net.FileConn(f)
- uc, ok = netc.(*net.UnixConn)
- if ok {
- break
- }
- }
- if uc == nil {
- fmt.Println("failed to find unix fd")
- return
- }
-
- // Make a file f to send to our parent process on uc.
- // We make it in tempDir, which our parent will clean up.
- flag.Parse()
- tempDir := flag.Arg(0)
- f, err := ioutil.TempFile(tempDir, "")
- if err != nil {
- fmt.Printf("TempFile: %v", err)
- return
- }
-
- f.Write([]byte("Hello from child process!\n"))
- f.Seek(0, 0)
-
- rights := unix.UnixRights(int(f.Fd()))
- dummyByte := []byte("x")
- n, oobn, err := uc.WriteMsgUnix(dummyByte, rights, nil)
- if err != nil {
- fmt.Printf("WriteMsgUnix: %v", err)
- return
- }
- if n != 1 || oobn != len(rights) {
- fmt.Printf("WriteMsgUnix = %d, %d; want 1, %d", n, oobn, len(rights))
- return
- }
-}
-
-// TestUnixRightsRoundtrip tests that UnixRights, ParseSocketControlMessage,
-// and ParseUnixRights are able to successfully round-trip lists of file descriptors.
-func TestUnixRightsRoundtrip(t *testing.T) {
- testCases := [...][][]int{
- {{42}},
- {{1, 2}},
- {{3, 4, 5}},
- {{}},
- {{1, 2}, {3, 4, 5}, {}, {7}},
- }
- for _, testCase := range testCases {
- b := []byte{}
- var n int
- for _, fds := range testCase {
- // Last assignment to n wins
- n = len(b) + unix.CmsgLen(4*len(fds))
- b = append(b, unix.UnixRights(fds...)...)
- }
- // Truncate b
- b = b[:n]
-
- scms, err := unix.ParseSocketControlMessage(b)
- if err != nil {
- t.Fatalf("ParseSocketControlMessage: %v", err)
- }
- if len(scms) != len(testCase) {
- t.Fatalf("expected %v SocketControlMessage; got scms = %#v", len(testCase), scms)
- }
- for i, scm := range scms {
- gotFds, err := unix.ParseUnixRights(&scm)
- if err != nil {
- t.Fatalf("ParseUnixRights: %v", err)
- }
- wantFds := testCase[i]
- if len(gotFds) != len(wantFds) {
- t.Fatalf("expected %v fds, got %#v", len(wantFds), gotFds)
- }
- for j, fd := range gotFds {
- if fd != wantFds[j] {
- t.Fatalf("expected fd %v, got %v", wantFds[j], fd)
- }
- }
- }
- }
-}
-
-func TestRlimit(t *testing.T) {
- var rlimit, zero unix.Rlimit
- err := unix.Getrlimit(unix.RLIMIT_NOFILE, &rlimit)
- if err != nil {
- t.Fatalf("Getrlimit: save failed: %v", err)
- }
- if zero == rlimit {
- t.Fatalf("Getrlimit: save failed: got zero value %#v", rlimit)
- }
- set := rlimit
- set.Cur = set.Max - 1
- err = unix.Setrlimit(unix.RLIMIT_NOFILE, &set)
- if err != nil {
- t.Fatalf("Setrlimit: set failed: %#v %v", set, err)
- }
- var get unix.Rlimit
- err = unix.Getrlimit(unix.RLIMIT_NOFILE, &get)
- if err != nil {
- t.Fatalf("Getrlimit: get failed: %v", err)
- }
- set = rlimit
- set.Cur = set.Max - 1
- if set != get {
- // Seems like Darwin requires some privilege to
- // increase the soft limit of rlimit sandbox, though
- // Setrlimit never reports an error.
- switch runtime.GOOS {
- case "darwin":
- default:
- t.Fatalf("Rlimit: change failed: wanted %#v got %#v", set, get)
- }
- }
- err = unix.Setrlimit(unix.RLIMIT_NOFILE, &rlimit)
- if err != nil {
- t.Fatalf("Setrlimit: restore failed: %#v %v", rlimit, err)
- }
-}
-
-func TestSeekFailure(t *testing.T) {
- _, err := unix.Seek(-1, 0, 0)
- if err == nil {
- t.Fatalf("Seek(-1, 0, 0) did not fail")
- }
- str := err.Error() // used to crash on Linux
- t.Logf("Seek: %v", str)
- if str == "" {
- t.Fatalf("Seek(-1, 0, 0) return error with empty message")
- }
-}
-
-func TestDup(t *testing.T) {
- file, err := ioutil.TempFile("", "TestDup")
- if err != nil {
- t.Fatalf("Tempfile failed: %v", err)
- }
- defer os.Remove(file.Name())
- defer file.Close()
- f := int(file.Fd())
-
- newFd, err := unix.Dup(f)
- if err != nil {
- t.Fatalf("Dup: %v", err)
- }
-
- err = unix.Dup2(newFd, newFd+1)
- if err != nil {
- t.Fatalf("Dup2: %v", err)
- }
-
- b1 := []byte("Test123")
- b2 := make([]byte, 7)
- _, err = unix.Write(newFd+1, b1)
- if err != nil {
- t.Fatalf("Write to dup2 fd failed: %v", err)
- }
- _, err = unix.Seek(f, 0, 0)
- _, err = unix.Read(f, b2)
- if err != nil {
- t.Fatalf("Read back failed: %v", err)
- }
- if string(b1) != string(b2) {
- t.Errorf("Dup: stdout write not in file, expected %v, got %v", string(b1), string(b2))
- }
-}