Browse Source

use vendor

tags/1.1.2^0
Vladimir Smagin 9 months ago
parent
commit
ee8b324b82
100 changed files with 3982 additions and 0 deletions
  1. +9
    -0
      go.mod
  2. +8
    -0
      go.sum
  3. +4
    -0
      vendor/github.com/creack/pty/.gitignore
  4. +14
    -0
      vendor/github.com/creack/pty/Dockerfile.riscv
  5. +23
    -0
      vendor/github.com/creack/pty/LICENSE
  6. +100
    -0
      vendor/github.com/creack/pty/README.md
  7. +16
    -0
      vendor/github.com/creack/pty/doc.go
  8. +13
    -0
      vendor/github.com/creack/pty/ioctl.go
  9. +39
    -0
      vendor/github.com/creack/pty/ioctl_bsd.go
  10. +30
    -0
      vendor/github.com/creack/pty/ioctl_solaris.go
  11. +19
    -0
      vendor/github.com/creack/pty/mktypes.bash
  12. +65
    -0
      vendor/github.com/creack/pty/pty_darwin.go
  13. +80
    -0
      vendor/github.com/creack/pty/pty_dragonfly.go
  14. +78
    -0
      vendor/github.com/creack/pty/pty_freebsd.go
  15. +51
    -0
      vendor/github.com/creack/pty/pty_linux.go
  16. +33
    -0
      vendor/github.com/creack/pty/pty_openbsd.go
  17. +139
    -0
      vendor/github.com/creack/pty/pty_solaris.go
  18. +11
    -0
      vendor/github.com/creack/pty/pty_unsupported.go
  19. +57
    -0
      vendor/github.com/creack/pty/run.go
  20. +50
    -0
      vendor/github.com/creack/pty/test_crosscompile.sh
  21. +64
    -0
      vendor/github.com/creack/pty/util.go
  22. +51
    -0
      vendor/github.com/creack/pty/util_solaris.go
  23. +9
    -0
      vendor/github.com/creack/pty/ztypes_386.go
  24. +9
    -0
      vendor/github.com/creack/pty/ztypes_amd64.go
  25. +9
    -0
      vendor/github.com/creack/pty/ztypes_arm.go
  26. +11
    -0
      vendor/github.com/creack/pty/ztypes_arm64.go
  27. +14
    -0
      vendor/github.com/creack/pty/ztypes_dragonfly_amd64.go
  28. +13
    -0
      vendor/github.com/creack/pty/ztypes_freebsd_386.go
  29. +14
    -0
      vendor/github.com/creack/pty/ztypes_freebsd_amd64.go
  30. +13
    -0
      vendor/github.com/creack/pty/ztypes_freebsd_arm.go
  31. +12
    -0
      vendor/github.com/creack/pty/ztypes_mipsx.go
  32. +13
    -0
      vendor/github.com/creack/pty/ztypes_openbsd_386.go
  33. +13
    -0
      vendor/github.com/creack/pty/ztypes_openbsd_amd64.go
  34. +11
    -0
      vendor/github.com/creack/pty/ztypes_ppc64.go
  35. +11
    -0
      vendor/github.com/creack/pty/ztypes_ppc64le.go
  36. +11
    -0
      vendor/github.com/creack/pty/ztypes_riscvx.go
  37. +11
    -0
      vendor/github.com/creack/pty/ztypes_s390x.go
  38. +4
    -0
      vendor/github.com/kr/pty/.gitignore
  39. +23
    -0
      vendor/github.com/kr/pty/LICENSE
  40. +9
    -0
      vendor/github.com/kr/pty/README.md
  41. +5
    -0
      vendor/github.com/kr/pty/go.mod
  42. +2
    -0
      vendor/github.com/kr/pty/go.sum
  43. +76
    -0
      vendor/github.com/kr/pty/shim.go
  44. +3
    -0
      vendor/golang.org/x/sys/AUTHORS
  45. +3
    -0
      vendor/golang.org/x/sys/CONTRIBUTORS
  46. +27
    -0
      vendor/golang.org/x/sys/LICENSE
  47. +22
    -0
      vendor/golang.org/x/sys/PATENTS
  48. +2
    -0
      vendor/golang.org/x/sys/unix/.gitignore
  49. +173
    -0
      vendor/golang.org/x/sys/unix/README.md
  50. +86
    -0
      vendor/golang.org/x/sys/unix/affinity_linux.go
  51. +14
    -0
      vendor/golang.org/x/sys/unix/aliases.go
  52. +17
    -0
      vendor/golang.org/x/sys/unix/asm_aix_ppc64.s
  53. +29
    -0
      vendor/golang.org/x/sys/unix/asm_darwin_386.s
  54. +29
    -0
      vendor/golang.org/x/sys/unix/asm_darwin_amd64.s
  55. +30
    -0
      vendor/golang.org/x/sys/unix/asm_darwin_arm.s
  56. +30
    -0
      vendor/golang.org/x/sys/unix/asm_darwin_arm64.s
  57. +29
    -0
      vendor/golang.org/x/sys/unix/asm_dragonfly_amd64.s
  58. +29
    -0
      vendor/golang.org/x/sys/unix/asm_freebsd_386.s
  59. +29
    -0
      vendor/golang.org/x/sys/unix/asm_freebsd_amd64.s
  60. +29
    -0
      vendor/golang.org/x/sys/unix/asm_freebsd_arm.s
  61. +29
    -0
      vendor/golang.org/x/sys/unix/asm_freebsd_arm64.s
  62. +65
    -0
      vendor/golang.org/x/sys/unix/asm_linux_386.s
  63. +57
    -0
      vendor/golang.org/x/sys/unix/asm_linux_amd64.s
  64. +56
    -0
      vendor/golang.org/x/sys/unix/asm_linux_arm.s
  65. +52
    -0
      vendor/golang.org/x/sys/unix/asm_linux_arm64.s
  66. +56
    -0
      vendor/golang.org/x/sys/unix/asm_linux_mips64x.s
  67. +54
    -0
      vendor/golang.org/x/sys/unix/asm_linux_mipsx.s
  68. +44
    -0
      vendor/golang.org/x/sys/unix/asm_linux_ppc64x.s
  69. +54
    -0
      vendor/golang.org/x/sys/unix/asm_linux_riscv64.s
  70. +56
    -0
      vendor/golang.org/x/sys/unix/asm_linux_s390x.s
  71. +29
    -0
      vendor/golang.org/x/sys/unix/asm_netbsd_386.s
  72. +29
    -0
      vendor/golang.org/x/sys/unix/asm_netbsd_amd64.s
  73. +29
    -0
      vendor/golang.org/x/sys/unix/asm_netbsd_arm.s
  74. +29
    -0
      vendor/golang.org/x/sys/unix/asm_netbsd_arm64.s
  75. +29
    -0
      vendor/golang.org/x/sys/unix/asm_openbsd_386.s
  76. +29
    -0
      vendor/golang.org/x/sys/unix/asm_openbsd_amd64.s
  77. +29
    -0
      vendor/golang.org/x/sys/unix/asm_openbsd_arm.s
  78. +29
    -0
      vendor/golang.org/x/sys/unix/asm_openbsd_arm64.s
  79. +17
    -0
      vendor/golang.org/x/sys/unix/asm_solaris_amd64.s
  80. +36
    -0
      vendor/golang.org/x/sys/unix/bluetooth_linux.go
  81. +195
    -0
      vendor/golang.org/x/sys/unix/cap_freebsd.go
  82. +13
    -0
      vendor/golang.org/x/sys/unix/constants.go
  83. +27
    -0
      vendor/golang.org/x/sys/unix/dev_aix_ppc.go
  84. +29
    -0
      vendor/golang.org/x/sys/unix/dev_aix_ppc64.go
  85. +24
    -0
      vendor/golang.org/x/sys/unix/dev_darwin.go
  86. +30
    -0
      vendor/golang.org/x/sys/unix/dev_dragonfly.go
  87. +30
    -0
      vendor/golang.org/x/sys/unix/dev_freebsd.go
  88. +42
    -0
      vendor/golang.org/x/sys/unix/dev_linux.go
  89. +29
    -0
      vendor/golang.org/x/sys/unix/dev_netbsd.go
  90. +29
    -0
      vendor/golang.org/x/sys/unix/dev_openbsd.go
  91. +102
    -0
      vendor/golang.org/x/sys/unix/dirent.go
  92. +9
    -0
      vendor/golang.org/x/sys/unix/endian_big.go
  93. +9
    -0
      vendor/golang.org/x/sys/unix/endian_little.go
  94. +31
    -0
      vendor/golang.org/x/sys/unix/env_unix.go
  95. +227
    -0
      vendor/golang.org/x/sys/unix/errors_freebsd_386.go
  96. +227
    -0
      vendor/golang.org/x/sys/unix/errors_freebsd_amd64.go
  97. +226
    -0
      vendor/golang.org/x/sys/unix/errors_freebsd_arm.go
  98. +36
    -0
      vendor/golang.org/x/sys/unix/fcntl.go
  99. +18
    -0
      vendor/golang.org/x/sys/unix/fcntl_darwin.go
  100. +13
    -0
      vendor/golang.org/x/sys/unix/fcntl_linux_32bit.go

+ 9
- 0
go.mod View File

@@ -0,0 +1,9 @@
module gogocron

go 1.13

require (
github.com/kr/pty v1.1.8
golang.org/x/sys v0.0.0-20191224085550-c709ea063b76 // indirect
gopkg.in/yaml.v2 v2.2.7
)

+ 8
- 0
go.sum View File

@@ -0,0 +1,8 @@
github.com/creack/pty v1.1.7 h1:6pwm8kMQKCmgUg0ZHTm5+/YvRK0s3THD/28+T6/kk4A=
github.com/creack/pty v1.1.7/go.mod h1:lj5s0c3V2DBrqTV7llrYr5NG6My20zk30Fl46Y7DoTY=
github.com/kr/pty v1.1.8 h1:AkaSdXYQOWeaO3neb8EM634ahkXXe3jYbVh/F9lq+GI=
github.com/kr/pty v1.1.8/go.mod h1:O1sed60cT9XZ5uDucP5qwvh+TE3NnUj51EiZO/lmSfw=
golang.org/x/sys v0.0.0-20191224085550-c709ea063b76 h1:Dho5nD6R3PcW2SH1or8vS0dszDaXRxIw55lBX7XiE5g=
golang.org/x/sys v0.0.0-20191224085550-c709ea063b76/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
gopkg.in/yaml.v2 v2.2.7/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=

+ 4
- 0
vendor/github.com/creack/pty/.gitignore View File

@@ -0,0 +1,4 @@
[568].out
_go*
_test*
_obj

+ 14
- 0
vendor/github.com/creack/pty/Dockerfile.riscv View File

@@ -0,0 +1,14 @@
FROM golang:1.12

# Clone and complie a riscv compatible version of the go compiler.
RUN git clone https://review.gerrithub.io/riscv/riscv-go /riscv-go
# riscvdev branch HEAD as of 2019-06-29.
RUN cd /riscv-go && git checkout 04885fddd096d09d4450726064d06dd107e374bf
ENV PATH=/riscv-go/misc/riscv:/riscv-go/bin:$PATH
RUN cd /riscv-go/src && GOROOT_BOOTSTRAP=$(go env GOROOT) ./make.bash
ENV GOROOT=/riscv-go

# Make sure we compile.
WORKDIR pty
ADD . .
RUN GOOS=linux GOARCH=riscv go build

+ 23
- 0
vendor/github.com/creack/pty/LICENSE View File

@@ -0,0 +1,23 @@
Copyright (c) 2011 Keith Rarick

Permission is hereby granted, free of charge, to any person
obtaining a copy of this software and associated
documentation files (the "Software"), to deal in the
Software without restriction, including without limitation
the rights to use, copy, modify, merge, publish, distribute,
sublicense, and/or sell copies of the Software, and to
permit persons to whom the Software is furnished to do so,
subject to the following conditions:

The above copyright notice and this permission notice shall
be included in all copies or substantial portions of the
Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY
KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS
OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

+ 100
- 0
vendor/github.com/creack/pty/README.md View File

@@ -0,0 +1,100 @@
# pty

Pty is a Go package for using unix pseudo-terminals.

## Install

go get github.com/creack/pty

## Example

### Command

```go
package main

import (
"github.com/creack/pty"
"io"
"os"
"os/exec"
)

func main() {
c := exec.Command("grep", "--color=auto", "bar")
f, err := pty.Start(c)
if err != nil {
panic(err)
}

go func() {
f.Write([]byte("foo\n"))
f.Write([]byte("bar\n"))
f.Write([]byte("baz\n"))
f.Write([]byte{4}) // EOT
}()
io.Copy(os.Stdout, f)
}
```

### Shell

```go
package main

import (
"io"
"log"
"os"
"os/exec"
"os/signal"
"syscall"

"github.com/creack/pty"
"golang.org/x/crypto/ssh/terminal"
)

func test() error {
// Create arbitrary command.
c := exec.Command("bash")

// Start the command with a pty.
ptmx, err := pty.Start(c)
if err != nil {
return err
}
// Make sure to close the pty at the end.
defer func() { _ = ptmx.Close() }() // Best effort.

// Handle pty size.
ch := make(chan os.Signal, 1)
signal.Notify(ch, syscall.SIGWINCH)
go func() {
for range ch {
if err := pty.InheritSize(os.Stdin, ptmx); err != nil {
log.Printf("error resizing pty: %s", err)
}
}
}()
ch <- syscall.SIGWINCH // Initial resize.

// Set stdin in raw mode.
oldState, err := terminal.MakeRaw(int(os.Stdin.Fd()))
if err != nil {
panic(err)
}
defer func() { _ = terminal.Restore(int(os.Stdin.Fd()), oldState) }() // Best effort.

// Copy stdin to the pty and the pty to stdout.
go func() { _, _ = io.Copy(ptmx, os.Stdin) }()
_, _ = io.Copy(os.Stdout, ptmx)

return nil
}

func main() {
if err := test(); err != nil {
log.Fatal(err)
}
}
```

+ 16
- 0
vendor/github.com/creack/pty/doc.go View File

@@ -0,0 +1,16 @@
// Package pty provides functions for working with Unix terminals.
package pty

import (
"errors"
"os"
)

// ErrUnsupported is returned if a function is not
// available on the current platform.
var ErrUnsupported = errors.New("unsupported")

// Opens a pty and its corresponding tty.
func Open() (pty, tty *os.File, err error) {
return open()
}

+ 13
- 0
vendor/github.com/creack/pty/ioctl.go View File

@@ -0,0 +1,13 @@
// +build !windows,!solaris

package pty

import "syscall"

func ioctl(fd, cmd, ptr uintptr) error {
_, _, e := syscall.Syscall(syscall.SYS_IOCTL, fd, cmd, ptr)
if e != 0 {
return e
}
return nil
}

+ 39
- 0
vendor/github.com/creack/pty/ioctl_bsd.go View File

@@ -0,0 +1,39 @@
// +build darwin dragonfly freebsd netbsd openbsd

package pty

// from <sys/ioccom.h>
const (
_IOC_VOID uintptr = 0x20000000
_IOC_OUT uintptr = 0x40000000
_IOC_IN uintptr = 0x80000000
_IOC_IN_OUT uintptr = _IOC_OUT | _IOC_IN
_IOC_DIRMASK = _IOC_VOID | _IOC_OUT | _IOC_IN

_IOC_PARAM_SHIFT = 13
_IOC_PARAM_MASK = (1 << _IOC_PARAM_SHIFT) - 1
)

func _IOC_PARM_LEN(ioctl uintptr) uintptr {
return (ioctl >> 16) & _IOC_PARAM_MASK
}

func _IOC(inout uintptr, group byte, ioctl_num uintptr, param_len uintptr) uintptr {
return inout | (param_len&_IOC_PARAM_MASK)<<16 | uintptr(group)<<8 | ioctl_num
}

func _IO(group byte, ioctl_num uintptr) uintptr {
return _IOC(_IOC_VOID, group, ioctl_num, 0)
}

func _IOR(group byte, ioctl_num uintptr, param_len uintptr) uintptr {
return _IOC(_IOC_OUT, group, ioctl_num, param_len)
}

func _IOW(group byte, ioctl_num uintptr, param_len uintptr) uintptr {
return _IOC(_IOC_IN, group, ioctl_num, param_len)
}

func _IOWR(group byte, ioctl_num uintptr, param_len uintptr) uintptr {
return _IOC(_IOC_IN_OUT, group, ioctl_num, param_len)
}

+ 30
- 0
vendor/github.com/creack/pty/ioctl_solaris.go View File

@@ -0,0 +1,30 @@
package pty

import (
"golang.org/x/sys/unix"
"unsafe"
)

const (
// see /usr/include/sys/stropts.h
I_PUSH = uintptr((int32('S')<<8 | 002))
I_STR = uintptr((int32('S')<<8 | 010))
I_FIND = uintptr((int32('S')<<8 | 013))
// see /usr/include/sys/ptms.h
ISPTM = (int32('P') << 8) | 1
UNLKPT = (int32('P') << 8) | 2
PTSSTTY = (int32('P') << 8) | 3
ZONEPT = (int32('P') << 8) | 4
OWNERPT = (int32('P') << 8) | 5
)

type strioctl struct {
ic_cmd int32
ic_timout int32
ic_len int32
ic_dp unsafe.Pointer
}

func ioctl(fd, cmd, ptr uintptr) error {
return unix.IoctlSetInt(int(fd), uint(cmd), int(ptr))
}

+ 19
- 0
vendor/github.com/creack/pty/mktypes.bash View File

@@ -0,0 +1,19 @@
#!/usr/bin/env bash

GOOSARCH="${GOOS}_${GOARCH}"
case "$GOOSARCH" in
_* | *_ | _)
echo 'undefined $GOOS_$GOARCH:' "$GOOSARCH" 1>&2
exit 1
;;
esac

GODEFS="go tool cgo -godefs"

$GODEFS types.go |gofmt > ztypes_$GOARCH.go

case $GOOS in
freebsd|dragonfly|openbsd)
$GODEFS types_$GOOS.go |gofmt > ztypes_$GOOSARCH.go
;;
esac

+ 65
- 0
vendor/github.com/creack/pty/pty_darwin.go View File

@@ -0,0 +1,65 @@
package pty

import (
"errors"
"os"
"syscall"
"unsafe"
)

func open() (pty, tty *os.File, err error) {
pFD, err := syscall.Open("/dev/ptmx", syscall.O_RDWR|syscall.O_CLOEXEC, 0)
if err != nil {
return nil, nil, err
}
p := os.NewFile(uintptr(pFD), "/dev/ptmx")
// In case of error after this point, make sure we close the ptmx fd.
defer func() {
if err != nil {
_ = p.Close() // Best effort.
}
}()

sname, err := ptsname(p)
if err != nil {
return nil, nil, err
}

if err := grantpt(p); err != nil {
return nil, nil, err
}

if err := unlockpt(p); err != nil {
return nil, nil, err
}

t, err := os.OpenFile(sname, os.O_RDWR, 0)
if err != nil {
return nil, nil, err
}
return p, t, nil
}

func ptsname(f *os.File) (string, error) {
n := make([]byte, _IOC_PARM_LEN(syscall.TIOCPTYGNAME))

err := ioctl(f.Fd(), syscall.TIOCPTYGNAME, uintptr(unsafe.Pointer(&n[0])))
if err != nil {
return "", err
}

for i, c := range n {
if c == 0 {
return string(n[:i]), nil
}
}
return "", errors.New("TIOCPTYGNAME string not NUL-terminated")
}

func grantpt(f *os.File) error {
return ioctl(f.Fd(), syscall.TIOCPTYGRANT, 0)
}

func unlockpt(f *os.File) error {
return ioctl(f.Fd(), syscall.TIOCPTYUNLK, 0)
}

+ 80
- 0
vendor/github.com/creack/pty/pty_dragonfly.go View File

@@ -0,0 +1,80 @@
package pty

import (
"errors"
"os"
"strings"
"syscall"
"unsafe"
)

// same code as pty_darwin.go
func open() (pty, tty *os.File, err error) {
p, err := os.OpenFile("/dev/ptmx", os.O_RDWR, 0)
if err != nil {
return nil, nil, err
}
// In case of error after this point, make sure we close the ptmx fd.
defer func() {
if err != nil {
_ = p.Close() // Best effort.
}
}()

sname, err := ptsname(p)
if err != nil {
return nil, nil, err
}

if err := grantpt(p); err != nil {
return nil, nil, err
}

if err := unlockpt(p); err != nil {
return nil, nil, err
}

t, err := os.OpenFile(sname, os.O_RDWR, 0)
if err != nil {
return nil, nil, err
}
return p, t, nil
}

func grantpt(f *os.File) error {
_, err := isptmaster(f.Fd())
return err
}

func unlockpt(f *os.File) error {
_, err := isptmaster(f.Fd())
return err
}

func isptmaster(fd uintptr) (bool, error) {
err := ioctl(fd, syscall.TIOCISPTMASTER, 0)
return err == nil, err
}

var (
emptyFiodgnameArg fiodgnameArg
ioctl_FIODNAME = _IOW('f', 120, unsafe.Sizeof(emptyFiodgnameArg))
)

func ptsname(f *os.File) (string, error) {
name := make([]byte, _C_SPECNAMELEN)
fa := fiodgnameArg{Name: (*byte)(unsafe.Pointer(&name[0])), Len: _C_SPECNAMELEN, Pad_cgo_0: [4]byte{0, 0, 0, 0}}

err := ioctl(f.Fd(), ioctl_FIODNAME, uintptr(unsafe.Pointer(&fa)))
if err != nil {
return "", err
}

for i, c := range name {
if c == 0 {
s := "/dev/" + string(name[:i])
return strings.Replace(s, "ptm", "pts", -1), nil
}
}
return "", errors.New("TIOCPTYGNAME string not NUL-terminated")
}

+ 78
- 0
vendor/github.com/creack/pty/pty_freebsd.go View File

@@ -0,0 +1,78 @@
package pty

import (
"errors"
"os"
"syscall"
"unsafe"
)

func posixOpenpt(oflag int) (fd int, err error) {
r0, _, e1 := syscall.Syscall(syscall.SYS_POSIX_OPENPT, uintptr(oflag), 0, 0)
fd = int(r0)
if e1 != 0 {
err = e1
}
return fd, err
}

func open() (pty, tty *os.File, err error) {
fd, err := posixOpenpt(syscall.O_RDWR | syscall.O_CLOEXEC)
if err != nil {
return nil, nil, err
}
p := os.NewFile(uintptr(fd), "/dev/pts")
// In case of error after this point, make sure we close the pts fd.
defer func() {
if err != nil {
_ = p.Close() // Best effort.
}
}()

sname, err := ptsname(p)
if err != nil {
return nil, nil, err
}

t, err := os.OpenFile("/dev/"+sname, os.O_RDWR, 0)
if err != nil {
return nil, nil, err
}
return p, t, nil
}

func isptmaster(fd uintptr) (bool, error) {
err := ioctl(fd, syscall.TIOCPTMASTER, 0)
return err == nil, err
}

var (
emptyFiodgnameArg fiodgnameArg
ioctlFIODGNAME = _IOW('f', 120, unsafe.Sizeof(emptyFiodgnameArg))
)

func ptsname(f *os.File) (string, error) {
master, err := isptmaster(f.Fd())
if err != nil {
return "", err
}
if !master {
return "", syscall.EINVAL
}

const n = _C_SPECNAMELEN + 1
var (
buf = make([]byte, n)
arg = fiodgnameArg{Len: n, Buf: (*byte)(unsafe.Pointer(&buf[0]))}
)
if err := ioctl(f.Fd(), ioctlFIODGNAME, uintptr(unsafe.Pointer(&arg))); err != nil {
return "", err
}

for i, c := range buf {
if c == 0 {
return string(buf[:i]), nil
}
}
return "", errors.New("FIODGNAME string not NUL-terminated")
}

+ 51
- 0
vendor/github.com/creack/pty/pty_linux.go View File

@@ -0,0 +1,51 @@
package pty

import (
"os"
"strconv"
"syscall"
"unsafe"
)

func open() (pty, tty *os.File, err error) {
p, err := os.OpenFile("/dev/ptmx", os.O_RDWR, 0)
if err != nil {
return nil, nil, err
}
// In case of error after this point, make sure we close the ptmx fd.
defer func() {
if err != nil {
_ = p.Close() // Best effort.
}
}()

sname, err := ptsname(p)
if err != nil {
return nil, nil, err
}

if err := unlockpt(p); err != nil {
return nil, nil, err
}

t, err := os.OpenFile(sname, os.O_RDWR|syscall.O_NOCTTY, 0)
if err != nil {
return nil, nil, err
}
return p, t, nil
}

func ptsname(f *os.File) (string, error) {
var n _C_uint
err := ioctl(f.Fd(), syscall.TIOCGPTN, uintptr(unsafe.Pointer(&n)))
if err != nil {
return "", err
}
return "/dev/pts/" + strconv.Itoa(int(n)), nil
}

func unlockpt(f *os.File) error {
var u _C_int
// use TIOCSPTLCK with a pointer to zero to clear the lock
return ioctl(f.Fd(), syscall.TIOCSPTLCK, uintptr(unsafe.Pointer(&u)))
}

+ 33
- 0
vendor/github.com/creack/pty/pty_openbsd.go View File

@@ -0,0 +1,33 @@
package pty

import (
"os"
"syscall"
"unsafe"
)

func open() (pty, tty *os.File, err error) {
/*
* from ptm(4):
* The PTMGET command allocates a free pseudo terminal, changes its
* ownership to the caller, revokes the access privileges for all previous
* users, opens the file descriptors for the pty and tty devices and
* returns them to the caller in struct ptmget.
*/

p, err := os.OpenFile("/dev/ptm", os.O_RDWR|syscall.O_CLOEXEC, 0)
if err != nil {
return nil, nil, err
}
defer p.Close()

var ptm ptmget
if err := ioctl(p.Fd(), uintptr(ioctl_PTMGET), uintptr(unsafe.Pointer(&ptm))); err != nil {
return nil, nil, err
}

pty = os.NewFile(uintptr(ptm.Cfd), "/dev/ptm")
tty = os.NewFile(uintptr(ptm.Sfd), "/dev/ptm")

return pty, tty, nil
}

+ 139
- 0
vendor/github.com/creack/pty/pty_solaris.go View File

@@ -0,0 +1,139 @@
package pty

/* based on:
http://src.illumos.org/source/xref/illumos-gate/usr/src/lib/libc/port/gen/pt.c
*/

import (
"errors"
"golang.org/x/sys/unix"
"os"
"strconv"
"syscall"
"unsafe"
)

const NODEV = ^uint64(0)

func open() (pty, tty *os.File, err error) {
masterfd, err := syscall.Open("/dev/ptmx", syscall.O_RDWR|unix.O_NOCTTY, 0)
//masterfd, err := syscall.Open("/dev/ptmx", syscall.O_RDWR|syscall.O_CLOEXEC|unix.O_NOCTTY, 0)
if err != nil {
return nil, nil, err
}
p := os.NewFile(uintptr(masterfd), "/dev/ptmx")

sname, err := ptsname(p)
if err != nil {
return nil, nil, err
}

err = grantpt(p)
if err != nil {
return nil, nil, err
}

err = unlockpt(p)
if err != nil {
return nil, nil, err
}

slavefd, err := syscall.Open(sname, os.O_RDWR|unix.O_NOCTTY, 0)
if err != nil {
return nil, nil, err
}
t := os.NewFile(uintptr(slavefd), sname)

// pushing terminal driver STREAMS modules as per pts(7)
for _, mod := range([]string{"ptem", "ldterm", "ttcompat"}) {
err = streams_push(t, mod)
if err != nil {
return nil, nil, err
}
}
return p, t, nil
}

func minor(x uint64) uint64 {
return x & 0377
}

func ptsdev(fd uintptr) uint64 {
istr := strioctl{ISPTM, 0, 0, nil}
err := ioctl(fd, I_STR, uintptr(unsafe.Pointer(&istr)))
if err != nil {
return NODEV
}
var status unix.Stat_t
err = unix.Fstat(int(fd), &status)
if err != nil {
return NODEV
}
return uint64(minor(status.Rdev))
}

func ptsname(f *os.File) (string, error) {
dev := ptsdev(f.Fd())
if dev == NODEV {
return "", errors.New("not a master pty")
}
fn := "/dev/pts/" + strconv.FormatInt(int64(dev), 10)
// access(2) creates the slave device (if the pty exists)
// F_OK == 0 (unistd.h)
err := unix.Access(fn, 0)
if err != nil {
return "", err
}
return fn, nil
}

type pt_own struct {
pto_ruid int32
pto_rgid int32
}

func grantpt(f *os.File) error {
if ptsdev(f.Fd()) == NODEV {
return errors.New("not a master pty")
}
var pto pt_own
pto.pto_ruid = int32(os.Getuid())
// XXX should first attempt to get gid of DEFAULT_TTY_GROUP="tty"
pto.pto_rgid = int32(os.Getgid())
var istr strioctl
istr.ic_cmd = OWNERPT
istr.ic_timout = 0
istr.ic_len = int32(unsafe.Sizeof(istr))
istr.ic_dp = unsafe.Pointer(&pto)
err := ioctl(f.Fd(), I_STR, uintptr(unsafe.Pointer(&istr)))
if err != nil {
return errors.New("access denied")
}
return nil
}

func unlockpt(f *os.File) error {
istr := strioctl{UNLKPT, 0, 0, nil}
return ioctl(f.Fd(), I_STR, uintptr(unsafe.Pointer(&istr)))
}

// push STREAMS modules if not already done so
func streams_push(f *os.File, mod string) error {
var err error
buf := []byte(mod)
// XXX I_FIND is not returning an error when the module
// is already pushed even though truss reports a return
// value of 1. A bug in the Go Solaris syscall interface?
// XXX without this we are at risk of the issue
// https://www.illumos.org/issues/9042
// but since we are not using libc or XPG4.2, we should not be
// double-pushing modules
err = ioctl(f.Fd(), I_FIND, uintptr(unsafe.Pointer(&buf[0])))
if err != nil {
return nil
}
err = ioctl(f.Fd(), I_PUSH, uintptr(unsafe.Pointer(&buf[0])))
return err
}

+ 11
- 0
vendor/github.com/creack/pty/pty_unsupported.go View File

@@ -0,0 +1,11 @@
// +build !linux,!darwin,!freebsd,!dragonfly,!openbsd,!solaris

package pty

import (
"os"
)

func open() (pty, tty *os.File, err error) {
return nil, nil, ErrUnsupported
}

+ 57
- 0
vendor/github.com/creack/pty/run.go View File

@@ -0,0 +1,57 @@
// +build !windows

package pty

import (
"os"
"os/exec"
"syscall"
)

// Start assigns a pseudo-terminal tty os.File to c.Stdin, c.Stdout,
// and c.Stderr, calls c.Start, and returns the File of the tty's
// corresponding pty.
func Start(c *exec.Cmd) (pty *os.File, err error) {
return StartWithSize(c, nil)
}

// StartWithSize assigns a pseudo-terminal tty os.File to c.Stdin, c.Stdout,
// and c.Stderr, calls c.Start, and returns the File of the tty's
// corresponding pty.
//
// This will resize the pty to the specified size before starting the command
func StartWithSize(c *exec.Cmd, sz *Winsize) (pty *os.File, err error) {
pty, tty, err := Open()
if err != nil {
return nil, err
}
defer tty.Close()
if sz != nil {
err = Setsize(pty, sz)
if err != nil {
pty.Close()
return nil, err
}
}
if c.Stdout == nil {
c.Stdout = tty
}
if c.Stderr == nil {
c.Stderr = tty
}
if c.Stdin == nil {
c.Stdin = tty
}
if c.SysProcAttr == nil {
c.SysProcAttr = &syscall.SysProcAttr{}
}
c.SysProcAttr.Setctty = true
c.SysProcAttr.Setsid = true
c.SysProcAttr.Ctty = int(tty.Fd())
err = c.Start()
if err != nil {
pty.Close()
return nil, err
}
return pty, err
}

+ 50
- 0
vendor/github.com/creack/pty/test_crosscompile.sh View File

@@ -0,0 +1,50 @@
#!/usr/bin/env sh

# Test script checking that all expected os/arch compile properly.
# Does not actually test the logic, just the compilation so we make sure we don't break code depending on the lib.

echo2() {
echo $@ >&2
}

trap end 0
end() {
[ "$?" = 0 ] && echo2 "Pass." || (echo2 "Fail."; exit 1)
}

cross() {
os=$1
shift
echo2 "Build for $os."
for arch in $@; do
echo2 " - $os/$arch"
GOOS=$os GOARCH=$arch go build
done
echo2
}

set -e

cross linux amd64 386 arm arm64 ppc64 ppc64le s390x mips mipsle mips64 mips64le
cross darwin amd64 386 arm arm64
cross freebsd amd64 386 arm
cross netbsd amd64 386 arm
cross openbsd amd64 386
cross dragonfly amd64
cross solaris amd64

# Not expected to work but should still compile.
cross windows amd64 386 arm

# TODO: Fix compilation error on openbsd/arm.
# TODO: Merge the solaris PR.

# Some os/arch require a different compiler. Run in docker.
if ! hash docker; then
# If docker is not present, stop here.
return
fi

echo2 "Build for linux."
echo2 " - linux/riscv"
docker build -t test -f Dockerfile.riscv .

+ 64
- 0
vendor/github.com/creack/pty/util.go View File

@@ -0,0 +1,64 @@
// +build !windows,!solaris

package pty

import (
"os"
"syscall"
"unsafe"
)

// InheritSize applies the terminal size of pty to tty. This should be run
// in a signal handler for syscall.SIGWINCH to automatically resize the tty when
// the pty receives a window size change notification.
func InheritSize(pty, tty *os.File) error {
size, err := GetsizeFull(pty)
if err != nil {
return err
}
err = Setsize(tty, size)
if err != nil {
return err
}
return nil
}

// Setsize resizes t to s.
func Setsize(t *os.File, ws *Winsize) error {
return windowRectCall(ws, t.Fd(), syscall.TIOCSWINSZ)
}

// GetsizeFull returns the full terminal size description.
func GetsizeFull(t *os.File) (size *Winsize, err error) {
var ws Winsize
err = windowRectCall(&ws, t.Fd(), syscall.TIOCGWINSZ)
return &ws, err
}

// Getsize returns the number of rows (lines) and cols (positions
// in each line) in terminal t.
func Getsize(t *os.File) (rows, cols int, err error) {
ws, err := GetsizeFull(t)
return int(ws.Rows), int(ws.Cols), err
}

// Winsize describes the terminal size.
type Winsize struct {
Rows uint16 // ws_row: Number of rows (in cells)
Cols uint16 // ws_col: Number of columns (in cells)
X uint16 // ws_xpixel: Width in pixels
Y uint16 // ws_ypixel: Height in pixels
}

func windowRectCall(ws *Winsize, fd, a2 uintptr) error {
_, _, errno := syscall.Syscall(
syscall.SYS_IOCTL,
fd,
a2,
uintptr(unsafe.Pointer(ws)),
)
if errno != 0 {
return syscall.Errno(errno)
}
return nil
}

+ 51
- 0
vendor/github.com/creack/pty/util_solaris.go View File

@@ -0,0 +1,51 @@
//

package pty

import (
"os"
"golang.org/x/sys/unix"
)

const (
TIOCGWINSZ = 21608 // 'T' << 8 | 104
TIOCSWINSZ = 21607 // 'T' << 8 | 103
)

// Winsize describes the terminal size.
type Winsize struct {
Rows uint16 // ws_row: Number of rows (in cells)
Cols uint16 // ws_col: Number of columns (in cells)
X uint16 // ws_xpixel: Width in pixels
Y uint16 // ws_ypixel: Height in pixels
}

// GetsizeFull returns the full terminal size description.
func GetsizeFull(t *os.File) (size *Winsize, err error) {
var wsz *unix.Winsize
wsz, err = unix.IoctlGetWinsize(int(t.Fd()), TIOCGWINSZ)

if err != nil {
return nil, err
} else {
return &Winsize{wsz.Row, wsz.Col, wsz.Xpixel, wsz.Ypixel}, nil
}
}

// Get Windows Size
func Getsize(t *os.File) (rows, cols int, err error) {
var wsz *unix.Winsize
wsz, err = unix.IoctlGetWinsize(int(t.Fd()), TIOCGWINSZ)

if err != nil {
return 80, 25, err
} else {
return int(wsz.Row), int(wsz.Col), nil
}
}

// Setsize resizes t to s.
func Setsize(t *os.File, ws *Winsize) error {
wsz := unix.Winsize{ws.Rows, ws.Cols, ws.X, ws.Y}
return unix.IoctlSetWinsize(int(t.Fd()), TIOCSWINSZ, &wsz)
}

+ 9
- 0
vendor/github.com/creack/pty/ztypes_386.go View File

@@ -0,0 +1,9 @@
// Created by cgo -godefs - DO NOT EDIT
// cgo -godefs types.go

package pty

type (
_C_int int32
_C_uint uint32
)

+ 9
- 0
vendor/github.com/creack/pty/ztypes_amd64.go View File

@@ -0,0 +1,9 @@
// Created by cgo -godefs - DO NOT EDIT
// cgo -godefs types.go

package pty

type (
_C_int int32
_C_uint uint32
)

+ 9
- 0
vendor/github.com/creack/pty/ztypes_arm.go View File

@@ -0,0 +1,9 @@
// Created by cgo -godefs - DO NOT EDIT
// cgo -godefs types.go

package pty

type (
_C_int int32
_C_uint uint32
)

+ 11
- 0
vendor/github.com/creack/pty/ztypes_arm64.go View File

@@ -0,0 +1,11 @@
// Created by cgo -godefs - DO NOT EDIT
// cgo -godefs types.go

// +build arm64

package pty

type (
_C_int int32
_C_uint uint32
)

+ 14
- 0
vendor/github.com/creack/pty/ztypes_dragonfly_amd64.go View File

@@ -0,0 +1,14 @@
// Created by cgo -godefs - DO NOT EDIT
// cgo -godefs types_dragonfly.go

package pty

const (
_C_SPECNAMELEN = 0x3f
)

type fiodgnameArg struct {
Name *byte
Len uint32
Pad_cgo_0 [4]byte
}

+ 13
- 0
vendor/github.com/creack/pty/ztypes_freebsd_386.go View File

@@ -0,0 +1,13 @@
// Created by cgo -godefs - DO NOT EDIT
// cgo -godefs types_freebsd.go

package pty

const (
_C_SPECNAMELEN = 0x3f
)

type fiodgnameArg struct {
Len int32
Buf *byte
}

+ 14
- 0
vendor/github.com/creack/pty/ztypes_freebsd_amd64.go View File

@@ -0,0 +1,14 @@
// Created by cgo -godefs - DO NOT EDIT
// cgo -godefs types_freebsd.go

package pty

const (
_C_SPECNAMELEN = 0x3f
)

type fiodgnameArg struct {
Len int32
Pad_cgo_0 [4]byte
Buf *byte
}

+ 13
- 0
vendor/github.com/creack/pty/ztypes_freebsd_arm.go View File

@@ -0,0 +1,13 @@
// Created by cgo -godefs - DO NOT EDIT
// cgo -godefs types_freebsd.go

package pty

const (
_C_SPECNAMELEN = 0x3f
)

type fiodgnameArg struct {
Len int32
Buf *byte
}

+ 12
- 0
vendor/github.com/creack/pty/ztypes_mipsx.go View File

@@ -0,0 +1,12 @@
// Created by cgo -godefs - DO NOT EDIT
// cgo -godefs types.go

// +build linux
// +build mips mipsle mips64 mips64le

package pty

type (
_C_int int32
_C_uint uint32
)

+ 13
- 0
vendor/github.com/creack/pty/ztypes_openbsd_386.go View File

@@ -0,0 +1,13 @@
// Created by cgo -godefs - DO NOT EDIT
// cgo -godefs types_openbsd.go

package pty

type ptmget struct {
Cfd int32
Sfd int32
Cn [16]int8
Sn [16]int8
}

var ioctl_PTMGET = 0x40287401

+ 13
- 0
vendor/github.com/creack/pty/ztypes_openbsd_amd64.go View File

@@ -0,0 +1,13 @@
// Created by cgo -godefs - DO NOT EDIT
// cgo -godefs types_openbsd.go

package pty

type ptmget struct {
Cfd int32
Sfd int32
Cn [16]int8
Sn [16]int8
}

var ioctl_PTMGET = 0x40287401

+ 11
- 0
vendor/github.com/creack/pty/ztypes_ppc64.go View File

@@ -0,0 +1,11 @@
// +build ppc64

// Created by cgo -godefs - DO NOT EDIT
// cgo -godefs types.go

package pty

type (
_C_int int32
_C_uint uint32
)

+ 11
- 0
vendor/github.com/creack/pty/ztypes_ppc64le.go View File

@@ -0,0 +1,11 @@
// +build ppc64le

// Created by cgo -godefs - DO NOT EDIT
// cgo -godefs types.go

package pty

type (
_C_int int32
_C_uint uint32
)

+ 11
- 0
vendor/github.com/creack/pty/ztypes_riscvx.go View File

@@ -0,0 +1,11 @@
// Code generated by cmd/cgo -godefs; DO NOT EDIT.
// cgo -godefs types.go

// +build riscv riscv64

package pty

type (
_C_int int32
_C_uint uint32
)

+ 11
- 0
vendor/github.com/creack/pty/ztypes_s390x.go View File

@@ -0,0 +1,11 @@
// +build s390x

// Created by cgo -godefs - DO NOT EDIT
// cgo -godefs types.go

package pty

type (
_C_int int32
_C_uint uint32
)

+ 4
- 0
vendor/github.com/kr/pty/.gitignore View File

@@ -0,0 +1,4 @@
[568].out
_go*
_test*
_obj

+ 23
- 0
vendor/github.com/kr/pty/LICENSE View File

@@ -0,0 +1,23 @@
Copyright (c) 2019 Keith Rarick

Permission is hereby granted, free of charge, to any person
obtaining a copy of this software and associated
documentation files (the "Software"), to deal in the
Software without restriction, including without limitation
the rights to use, copy, modify, merge, publish, distribute,
sublicense, and/or sell copies of the Software, and to
permit persons to whom the Software is furnished to do so,
subject to the following conditions:

The above copyright notice and this permission notice shall
be included in all copies or substantial portions of the
Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY
KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS
OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

+ 9
- 0
vendor/github.com/kr/pty/README.md View File

@@ -0,0 +1,9 @@
# pty

This Go module has moved to <https://github.com/creack/pty>.

Existing clients will continue to work.

New clients should use the new module import path
`github.com/creack/pty`.


+ 5
- 0
vendor/github.com/kr/pty/go.mod View File

@@ -0,0 +1,5 @@
module github.com/kr/pty

go 1.12

require github.com/creack/pty v1.1.7

+ 2
- 0
vendor/github.com/kr/pty/go.sum View File

@@ -0,0 +1,2 @@
github.com/creack/pty v1.1.7 h1:6pwm8kMQKCmgUg0ZHTm5+/YvRK0s3THD/28+T6/kk4A=
github.com/creack/pty v1.1.7/go.mod h1:lj5s0c3V2DBrqTV7llrYr5NG6My20zk30Fl46Y7DoTY=

+ 76
- 0
vendor/github.com/kr/pty/shim.go View File

@@ -0,0 +1,76 @@
// Package pty is a wrapper for github.com/creack/pty, which provides
// functions for working with Unix terminals.
//
// This package is deprecated. Existing clients will continue to work,
// but no further updates will happen here. New clients should use
// github.com/creack/pty directly.
package pty

import (
"os"
"os/exec"

"github.com/creack/pty"
newpty "github.com/creack/pty"
)

// ErrUnsupported is returned if a function is not available on the
// current platform.
//
// Deprecated; please use github.com/creack/pty instead.
var ErrUnsupported = pty.ErrUnsupported

// Winsize describes the terminal size.
//
// Deprecated; please use github.com/creack/pty instead.
type Winsize = pty.Winsize

// Getsize returns the number of rows (lines) and cols (positions in
// each line) in terminal t.
//
// Deprecated; please use github.com/creack/pty instead.
func Getsize(t *os.File) (rows, cols int, err error) { return pty.Getsize(t) }

// GetsizeFull returns the full terminal size description.
//
// Deprecated; please use github.com/creack/pty instead.
func GetsizeFull(t *os.File) (size *Winsize, err error) {
return pty.GetsizeFull(t)
}

// InheritSize applies the terminal size of pty to tty. This should be
// run in a signal handler for syscall.SIGWINCH to automatically
// resize the tty when the pty receives a window size change
// notification.
//
// Deprecated; please use github.com/creack/pty instead.
func InheritSize(pty, tty *os.File) error { return newpty.InheritSize(pty, tty) }

// Opens a pty and its corresponding tty.
//
// Deprecated; please use github.com/creack/pty instead.
func Open() (pty, tty *os.File, err error) { return newpty.Open() }

// Setsize resizes t to s.
//
// Deprecated; please use github.com/creack/pty instead.
func Setsize(t *os.File, ws *Winsize) error { return pty.Setsize(t, ws) }

// Start assigns a pseudo-terminal tty os.File to c.Stdin, c.Stdout,
// and c.Stderr, calls c.Start, and returns the File of the tty's
// corresponding pty.
//
// Deprecated; please use github.com/creack/pty instead.
func Start(c *exec.Cmd) (pty *os.File, err error) { return newpty.Start(c) }

// StartWithSize assigns a pseudo-terminal tty os.File to c.Stdin,
// c.Stdout, and c.Stderr, calls c.Start, and returns the File of the
// tty's corresponding pty.
//
// This will resize the pty to the specified size before starting the
// command.
//
// Deprecated; please use github.com/creack/pty instead.
func StartWithSize(c *exec.Cmd, sz *Winsize) (pty *os.File, err error) {
return newpty.StartWithSize(c, sz)
}

+ 3
- 0
vendor/golang.org/x/sys/AUTHORS View File

@@ -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.

+ 3
- 0
vendor/golang.org/x/sys/CONTRIBUTORS View File

@@ -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.

+ 27
- 0
vendor/golang.org/x/sys/LICENSE View File

@@ -0,0 +1,27 @@
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.

+ 22
- 0
vendor/golang.org/x/sys/PATENTS View File

@@ -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.

+ 2
- 0
vendor/golang.org/x/sys/unix/.gitignore View File

@@ -0,0 +1,2 @@
_obj/
unix.test

+ 173
- 0
vendor/golang.org/x/sys/unix/README.md View File

@@ -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"`)

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, go

### New Build System (currently for `GOOS == "linux"`)

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, 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/programs 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 Go program located at `${GOOS}/mksysnum.go` (or `mksysnum_${GOOS}.go`
for the old system). This program 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.go

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.go program 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.go` (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).

+ 86
- 0
vendor/golang.org/x/sys/unix/affinity_linux.go View File

@@ -0,0 +1,86 @@
// Copyright 2018 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.

// CPU affinity functions

package unix

import (
"math/bits"
"unsafe"
)

const cpuSetSize = _CPU_SETSIZE / _NCPUBITS

// CPUSet represents a CPU affinity mask.
type CPUSet [cpuSetSize]cpuMask

func schedAffinity(trap uintptr, pid int, set *CPUSet) error {
_, _, e := RawSyscall(trap, uintptr(pid), uintptr(unsafe.Sizeof(*set)), uintptr(unsafe.Pointer(set)))
if e != 0 {
return errnoErr(e)
}
return nil
}

// SchedGetaffinity gets the CPU affinity mask of the thread specified by pid.
// If pid is 0 the calling thread is used.
func SchedGetaffinity(pid int, set *CPUSet) error {
return schedAffinity(SYS_SCHED_GETAFFINITY, pid, set)
}

// SchedSetaffinity sets the CPU affinity mask of the thread specified by pid.
// If pid is 0 the calling thread is used.
func SchedSetaffinity(pid int, set *CPUSet) error {
return schedAffinity(SYS_SCHED_SETAFFINITY, pid, set)
}

// Zero clears the set s, so that it contains no CPUs.
func (s *CPUSet) Zero() {
for i := range s {
s[i] = 0
}
}

func cpuBitsIndex(cpu int) int {
return cpu / _NCPUBITS
}

func cpuBitsMask(cpu int) cpuMask {
return cpuMask(1 << (uint(cpu) % _NCPUBITS))
}

// Set adds cpu to the set s.
func (s *CPUSet) Set(cpu int) {
i := cpuBitsIndex(cpu)
if i < len(s) {
s[i] |= cpuBitsMask(cpu)
}
}

// Clear removes cpu from the set s.
func (s *CPUSet) Clear(cpu int) {
i := cpuBitsIndex(cpu)
if i < len(s) {
s[i] &^= cpuBitsMask(cpu)
}
}

// IsSet reports whether cpu is in the set s.
func (s *CPUSet) IsSet(cpu int) bool {
i := cpuBitsIndex(cpu)
if i < len(s) {
return s[i]&cpuBitsMask(cpu) != 0
}
return false
}

// Count returns the number of CPUs in the set s.
func (s *CPUSet) Count() int {
c := 0
for _, b := range s {
c += bits.OnesCount64(uint64(b))
}
return c
}

+ 14
- 0
vendor/golang.org/x/sys/unix/aliases.go View File

@@ -0,0 +1,14 @@
// Copyright 2018 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 aix darwin dragonfly freebsd linux netbsd openbsd solaris
// +build go1.9

package unix

import "syscall"

type Signal = syscall.Signal
type Errno = syscall.Errno
type SysProcAttr = syscall.SysProcAttr

+ 17
- 0
vendor/golang.org/x/sys/unix/asm_aix_ppc64.s View File

@@ -0,0 +1,17 @@
// Copyright 2018 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 !gccgo

#include "textflag.h"

//
// System calls for ppc64, AIX are implemented in runtime/syscall_aix.go
//

TEXT ·syscall6(SB),NOSPLIT,$0-88
JMP syscall·syscall6(SB)

TEXT ·rawSyscall6(SB),NOSPLIT,$0-88
JMP syscall·rawSyscall6(SB)

+ 29
- 0
vendor/golang.org/x/sys/unix/asm_darwin_386.s View File

@@ -0,0 +1,29 @@
// 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 !gccgo

#include "textflag.h"

//
// System call support for 386, Darwin
//

// Just jump to package syscall's implementation for all these functions.
// The runtime may know about them.

TEXT ·Syscall(SB),NOSPLIT,$0-28
JMP syscall·Syscall(SB)

TEXT ·Syscall6(SB),NOSPLIT,$0-40
JMP syscall·Syscall6(SB)

TEXT ·Syscall9(SB),NOSPLIT,$0-52
JMP syscall·Syscall9(SB)

TEXT ·RawSyscall(SB),NOSPLIT,$0-28
JMP syscall·RawSyscall(SB)

TEXT ·RawSyscall6(SB),NOSPLIT,$0-40
JMP syscall·RawSyscall6(SB)

+ 29
- 0
vendor/golang.org/x/sys/unix/asm_darwin_amd64.s View File

@@ -0,0 +1,29 @@
// 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 !gccgo

#include "textflag.h"

//
// System call support for AMD64, Darwin
//

// Just jump to package syscall's implementation for all these functions.
// The runtime may know about them.

TEXT ·Syscall(SB),NOSPLIT,$0-56
JMP syscall·Syscall(SB)

TEXT ·Syscall6(SB),NOSPLIT,$0-80
JMP syscall·Syscall6(SB)

TEXT ·Syscall9(SB),NOSPLIT,$0-104
JMP syscall·Syscall9(SB)

TEXT ·RawSyscall(SB),NOSPLIT,$0-56
JMP syscall·RawSyscall(SB)

TEXT ·RawSyscall6(SB),NOSPLIT,$0-80
JMP syscall·RawSyscall6(SB)

+ 30
- 0
vendor/golang.org/x/sys/unix/asm_darwin_arm.s View File

@@ -0,0 +1,30 @@
// 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 !gccgo
// +build arm,darwin

#include "textflag.h"

//
// System call support for ARM, Darwin
//

// Just jump to package syscall's implementation for all these functions.
// The runtime may know about them.

TEXT ·Syscall(SB),NOSPLIT,$0-28
B syscall·Syscall(SB)

TEXT ·Syscall6(SB),NOSPLIT,$0-40
B syscall·Syscall6(SB)

TEXT ·Syscall9(SB),NOSPLIT,$0-52
B syscall·Syscall9(SB)

TEXT ·RawSyscall(SB),NOSPLIT,$0-28
B syscall·RawSyscall(SB)

TEXT ·RawSyscall6(SB),NOSPLIT,$0-40
B syscall·RawSyscall6(SB)

+ 30
- 0
vendor/golang.org/x/sys/unix/asm_darwin_arm64.s View File

@@ -0,0 +1,30 @@
// 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 !gccgo
// +build arm64,darwin

#include "textflag.h"

//
// System call support for AMD64, Darwin
//

// Just jump to package syscall's implementation for all these functions.
// The runtime may know about them.

TEXT ·Syscall(SB),NOSPLIT,$0-56
B syscall·Syscall(SB)

TEXT ·Syscall6(SB),NOSPLIT,$0-80
B syscall·Syscall6(SB)

TEXT ·Syscall9(SB),NOSPLIT,$0-104
B syscall·Syscall9(SB)

TEXT ·RawSyscall(SB),NOSPLIT,$0-56
B syscall·RawSyscall(SB)

TEXT ·RawSyscall6(SB),NOSPLIT,$0-80
B syscall·RawSyscall6(SB)

+ 29
- 0
vendor/golang.org/x/sys/unix/asm_dragonfly_amd64.s View File

@@ -0,0 +1,29 @@
// 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 !gccgo

#include "textflag.h"

//
// System call support for AMD64, DragonFly
//

// Just jump to package syscall's implementation for all these functions.
// The runtime may know about them.

TEXT ·Syscall(SB),NOSPLIT,$0-56
JMP syscall·Syscall(SB)

TEXT ·Syscall6(SB),NOSPLIT,$0-80
JMP syscall·Syscall6(SB)

TEXT ·Syscall9(SB),NOSPLIT,$0-104
JMP syscall·Syscall9(SB)

TEXT ·RawSyscall(SB),NOSPLIT,$0-56
JMP syscall·RawSyscall(SB)

TEXT ·RawSyscall6(SB),NOSPLIT,$0-80
JMP syscall·RawSyscall6(SB)

+ 29
- 0
vendor/golang.org/x/sys/unix/asm_freebsd_386.s View File

@@ -0,0 +1,29 @@
// 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 !gccgo

#include "textflag.h"

//
// System call support for 386, FreeBSD
//

// Just jump to package syscall's implementation for all these functions.
// The runtime may know about them.

TEXT ·Syscall(SB),NOSPLIT,$0-28
JMP syscall·Syscall(SB)

TEXT ·Syscall6(SB),NOSPLIT,$0-40
JMP syscall·Syscall6(SB)

TEXT ·Syscall9(SB),NOSPLIT,$0-52
JMP syscall·Syscall9(SB)

TEXT ·RawSyscall(SB),NOSPLIT,$0-28
JMP syscall·RawSyscall(SB)

TEXT ·RawSyscall6(SB),NOSPLIT,$0-40
JMP syscall·RawSyscall6(SB)

+ 29
- 0
vendor/golang.org/x/sys/unix/asm_freebsd_amd64.s View File

@@ -0,0 +1,29 @@
// 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 !gccgo

#include "textflag.h"

//
// System call support for AMD64, FreeBSD
//

// Just jump to package syscall's implementation for all these functions.
// The runtime may know about them.

TEXT ·Syscall(SB),NOSPLIT,$0-56
JMP syscall·Syscall(SB)

TEXT ·Syscall6(SB),NOSPLIT,$0-80
JMP syscall·Syscall6(SB)

TEXT ·Syscall9(SB),NOSPLIT,$0-104
JMP syscall·Syscall9(SB)

TEXT ·RawSyscall(SB),NOSPLIT,$0-56
JMP syscall·RawSyscall(SB)

TEXT ·RawSyscall6(SB),NOSPLIT,$0-80
JMP syscall·RawSyscall6(SB)

+ 29
- 0
vendor/golang.org/x/sys/unix/asm_freebsd_arm.s View File

@@ -0,0 +1,29 @@
// 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 !gccgo

#include "textflag.h"

//
// System call support for ARM, FreeBSD
//

// Just jump to package syscall's implementation for all these functions.
// The runtime may know about them.

TEXT ·Syscall(SB),NOSPLIT,$0-28
B syscall·Syscall(SB)

TEXT ·Syscall6(SB),NOSPLIT,$0-40
B syscall·Syscall6(SB)

TEXT ·Syscall9(SB),NOSPLIT,$0-52
B syscall·Syscall9(SB)

TEXT ·RawSyscall(SB),NOSPLIT,$0-28
B syscall·RawSyscall(SB)

TEXT ·RawSyscall6(SB),NOSPLIT,$0-40
B syscall·RawSyscall6(SB)

+ 29
- 0
vendor/golang.org/x/sys/unix/asm_freebsd_arm64.s View File

@@ -0,0 +1,29 @@
// Copyright 2018 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 !gccgo

#include "textflag.h"

//
// System call support for ARM64, FreeBSD
//

// Just jump to package syscall's implementation for all these functions.
// The runtime may know about them.

TEXT ·Syscall(SB),NOSPLIT,$0-56
JMP syscall·Syscall(SB)

TEXT ·Syscall6(SB),NOSPLIT,$0-80
JMP syscall·Syscall6(SB)

TEXT ·Syscall9(SB),NOSPLIT,$0-104
JMP syscall·Syscall9(SB)

TEXT ·RawSyscall(SB),NOSPLIT,$0-56
JMP syscall·RawSyscall(SB)

TEXT ·RawSyscall6(SB),NOSPLIT,$0-80
JMP syscall·RawSyscall6(SB)

+ 65
- 0
vendor/golang.org/x/sys/unix/asm_linux_386.s View File

@@ -0,0 +1,65 @@
// 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 !gccgo

#include "textflag.h"

//
// System calls for 386, Linux
//

// See ../runtime/sys_linux_386.s for the reason why we always use int 0x80
// instead of the glibc-specific "CALL 0x10(GS)".
#define INVOKE_SYSCALL INT $0x80

// Just jump to package syscall's implementation for all these functions.
// The runtime may know about them.

TEXT ·Syscall(SB),NOSPLIT,$0-28
JMP syscall·Syscall(SB)

TEXT ·Syscall6(SB),NOSPLIT,$0-40
JMP syscall·Syscall6(SB)

TEXT ·SyscallNoError(SB),NOSPLIT,$0-24
CALL runtime·entersyscall(SB)
MOVL trap+0(FP), AX // syscall entry
MOVL a1+4(FP), BX
MOVL a2+8(FP), CX
MOVL a3+12(FP), DX
MOVL $0, SI
MOVL $0, DI
INVOKE_SYSCALL
MOVL AX, r1+16(FP)
MOVL DX, r2+20(FP)
CALL runtime·exitsyscall(SB)
RET

TEXT ·RawSyscall(SB),NOSPLIT,$0-28
JMP syscall·RawSyscall(SB)

TEXT ·RawSyscall6(SB),NOSPLIT,$0-40
JMP syscall·RawSyscall6(SB)

TEXT ·RawSyscallNoError(SB),NOSPLIT,$0-24
MOVL trap+0(FP), AX // syscall entry
MOVL a1+4(FP), BX
MOVL a2+8(FP), CX
MOVL a3+12(FP), DX
MOVL $0, SI
MOVL $0, DI
INVOKE_SYSCALL
MOVL AX, r1+16(FP)
MOVL DX, r2+20(FP)
RET

TEXT ·socketcall(SB),NOSPLIT,$0-36
JMP syscall·socketcall(SB)

TEXT ·rawsocketcall(SB),NOSPLIT,$0-36
JMP syscall·rawsocketcall(SB)