├── .gitignore ├── LICENSE ├── README.md ├── fastergoding.go ├── go.mod ├── go.sum └── vendor ├── github.com └── fsnotify │ └── fsnotify │ ├── .editorconfig │ ├── .gitignore │ ├── .travis.yml │ ├── AUTHORS │ ├── CHANGELOG.md │ ├── CONTRIBUTING.md │ ├── LICENSE │ ├── README.md │ ├── fen.go │ ├── fsnotify.go │ ├── inotify.go │ ├── inotify_poller.go │ ├── kqueue.go │ ├── open_mode_bsd.go │ ├── open_mode_darwin.go │ └── windows.go ├── golang.org └── x │ └── sys │ ├── AUTHORS │ ├── CONTRIBUTORS │ ├── LICENSE │ ├── PATENTS │ └── unix │ ├── .gitignore │ ├── README.md │ ├── affinity_linux.go │ ├── aliases.go │ ├── asm_aix_ppc64.s │ ├── asm_darwin_386.s │ ├── asm_darwin_amd64.s │ ├── asm_darwin_arm.s │ ├── asm_darwin_arm64.s │ ├── asm_dragonfly_amd64.s │ ├── asm_freebsd_386.s │ ├── asm_freebsd_amd64.s │ ├── asm_freebsd_arm.s │ ├── asm_freebsd_arm64.s │ ├── asm_linux_386.s │ ├── asm_linux_amd64.s │ ├── asm_linux_arm.s │ ├── asm_linux_arm64.s │ ├── asm_linux_mips64x.s │ ├── asm_linux_mipsx.s │ ├── asm_linux_ppc64x.s │ ├── asm_linux_riscv64.s │ ├── asm_linux_s390x.s │ ├── asm_netbsd_386.s │ ├── asm_netbsd_amd64.s │ ├── asm_netbsd_arm.s │ ├── asm_netbsd_arm64.s │ ├── asm_openbsd_386.s │ ├── asm_openbsd_amd64.s │ ├── asm_openbsd_arm.s │ ├── asm_openbsd_arm64.s │ ├── asm_solaris_amd64.s │ ├── bluetooth_linux.go │ ├── cap_freebsd.go │ ├── constants.go │ ├── dev_aix_ppc.go │ ├── dev_aix_ppc64.go │ ├── dev_darwin.go │ ├── dev_dragonfly.go │ ├── dev_freebsd.go │ ├── dev_linux.go │ ├── dev_netbsd.go │ ├── dev_openbsd.go │ ├── dirent.go │ ├── endian_big.go │ ├── endian_little.go │ ├── env_unix.go │ ├── errors_freebsd_386.go │ ├── errors_freebsd_amd64.go │ ├── errors_freebsd_arm.go │ ├── fcntl.go │ ├── fcntl_darwin.go │ ├── fcntl_linux_32bit.go │ ├── gccgo.go │ ├── gccgo_c.c │ ├── gccgo_linux_amd64.go │ ├── ioctl.go │ ├── mkall.sh │ ├── mkasm_darwin.go │ ├── mkerrors.sh │ ├── mkpost.go │ ├── mksyscall.go │ ├── mksyscall_aix_ppc.go │ ├── mksyscall_aix_ppc64.go │ ├── mksyscall_solaris.go │ ├── mksysctl_openbsd.go │ ├── mksysnum.go │ ├── pagesize_unix.go │ ├── pledge_openbsd.go │ ├── race.go │ ├── race0.go │ ├── readdirent_getdents.go │ ├── readdirent_getdirentries.go │ ├── sockcmsg_linux.go │ ├── sockcmsg_unix.go │ ├── str.go │ ├── syscall.go │ ├── syscall_aix.go │ ├── syscall_aix_ppc.go │ ├── syscall_aix_ppc64.go │ ├── syscall_bsd.go │ ├── syscall_darwin.go │ ├── syscall_darwin_386.go │ ├── syscall_darwin_amd64.go │ ├── syscall_darwin_arm.go │ ├── syscall_darwin_arm64.go │ ├── syscall_darwin_libSystem.go │ ├── syscall_dragonfly.go │ ├── syscall_dragonfly_amd64.go │ ├── syscall_freebsd.go │ ├── syscall_freebsd_386.go │ ├── syscall_freebsd_amd64.go │ ├── syscall_freebsd_arm.go │ ├── syscall_freebsd_arm64.go │ ├── syscall_linux.go │ ├── syscall_linux_386.go │ ├── syscall_linux_amd64.go │ ├── syscall_linux_amd64_gc.go │ ├── syscall_linux_arm.go │ ├── syscall_linux_arm64.go │ ├── syscall_linux_gc.go │ ├── syscall_linux_gc_386.go │ ├── syscall_linux_gccgo_386.go │ ├── syscall_linux_gccgo_arm.go │ ├── syscall_linux_mips64x.go │ ├── syscall_linux_mipsx.go │ ├── syscall_linux_ppc64x.go │ ├── syscall_linux_riscv64.go │ ├── syscall_linux_s390x.go │ ├── syscall_linux_sparc64.go │ ├── syscall_netbsd.go │ ├── syscall_netbsd_386.go │ ├── syscall_netbsd_amd64.go │ ├── syscall_netbsd_arm.go │ ├── syscall_netbsd_arm64.go │ ├── syscall_openbsd.go │ ├── syscall_openbsd_386.go │ ├── syscall_openbsd_amd64.go │ ├── syscall_openbsd_arm.go │ ├── syscall_openbsd_arm64.go │ ├── syscall_solaris.go │ ├── syscall_solaris_amd64.go │ ├── syscall_unix.go │ ├── syscall_unix_gc.go │ ├── syscall_unix_gc_ppc64x.go │ ├── timestruct.go │ ├── types_aix.go │ ├── types_darwin.go │ ├── types_dragonfly.go │ ├── types_freebsd.go │ ├── types_netbsd.go │ ├── types_openbsd.go │ ├── types_solaris.go │ ├── unveil_openbsd.go │ ├── xattr_bsd.go │ ├── zerrors_aix_ppc.go │ ├── zerrors_aix_ppc64.go │ ├── zerrors_darwin_386.go │ ├── zerrors_darwin_amd64.go │ ├── zerrors_darwin_arm.go │ ├── zerrors_darwin_arm64.go │ ├── zerrors_dragonfly_amd64.go │ ├── zerrors_freebsd_386.go │ ├── zerrors_freebsd_amd64.go │ ├── zerrors_freebsd_arm.go │ ├── zerrors_freebsd_arm64.go │ ├── zerrors_linux_386.go │ ├── zerrors_linux_amd64.go │ ├── zerrors_linux_arm.go │ ├── zerrors_linux_arm64.go │ ├── zerrors_linux_mips.go │ ├── zerrors_linux_mips64.go │ ├── zerrors_linux_mips64le.go │ ├── zerrors_linux_mipsle.go │ ├── zerrors_linux_ppc64.go │ ├── zerrors_linux_ppc64le.go │ ├── zerrors_linux_riscv64.go │ ├── zerrors_linux_s390x.go │ ├── zerrors_linux_sparc64.go │ ├── zerrors_netbsd_386.go │ ├── zerrors_netbsd_amd64.go │ ├── zerrors_netbsd_arm.go │ ├── zerrors_netbsd_arm64.go │ ├── zerrors_openbsd_386.go │ ├── zerrors_openbsd_amd64.go │ ├── zerrors_openbsd_arm.go │ ├── zerrors_openbsd_arm64.go │ ├── zerrors_solaris_amd64.go │ ├── zptrace386_linux.go │ ├── zptracearm_linux.go │ ├── zptracemips_linux.go │ ├── zptracemipsle_linux.go │ ├── zsyscall_aix_ppc.go │ ├── zsyscall_aix_ppc64.go │ ├── zsyscall_aix_ppc64_gc.go │ ├── zsyscall_aix_ppc64_gccgo.go │ ├── zsyscall_darwin_386.1_11.go │ ├── zsyscall_darwin_386.go │ ├── zsyscall_darwin_386.s │ ├── zsyscall_darwin_amd64.1_11.go │ ├── zsyscall_darwin_amd64.go │ ├── zsyscall_darwin_amd64.s │ ├── zsyscall_darwin_arm.1_11.go │ ├── zsyscall_darwin_arm.go │ ├── zsyscall_darwin_arm.s │ ├── zsyscall_darwin_arm64.1_11.go │ ├── zsyscall_darwin_arm64.go │ ├── zsyscall_darwin_arm64.s │ ├── zsyscall_dragonfly_amd64.go │ ├── zsyscall_freebsd_386.go │ ├── zsyscall_freebsd_amd64.go │ ├── zsyscall_freebsd_arm.go │ ├── zsyscall_freebsd_arm64.go │ ├── zsyscall_linux_386.go │ ├── zsyscall_linux_amd64.go │ ├── zsyscall_linux_arm.go │ ├── zsyscall_linux_arm64.go │ ├── zsyscall_linux_mips.go │ ├── zsyscall_linux_mips64.go │ ├── zsyscall_linux_mips64le.go │ ├── zsyscall_linux_mipsle.go │ ├── zsyscall_linux_ppc64.go │ ├── zsyscall_linux_ppc64le.go │ ├── zsyscall_linux_riscv64.go │ ├── zsyscall_linux_s390x.go │ ├── zsyscall_linux_sparc64.go │ ├── zsyscall_netbsd_386.go │ ├── zsyscall_netbsd_amd64.go │ ├── zsyscall_netbsd_arm.go │ ├── zsyscall_netbsd_arm64.go │ ├── zsyscall_openbsd_386.go │ ├── zsyscall_openbsd_amd64.go │ ├── zsyscall_openbsd_arm.go │ ├── zsyscall_openbsd_arm64.go │ ├── zsyscall_solaris_amd64.go │ ├── zsysctl_openbsd_386.go │ ├── zsysctl_openbsd_amd64.go │ ├── zsysctl_openbsd_arm.go │ ├── zsysctl_openbsd_arm64.go │ ├── zsysnum_darwin_386.go │ ├── zsysnum_darwin_amd64.go │ ├── zsysnum_darwin_arm.go │ ├── zsysnum_darwin_arm64.go │ ├── zsysnum_dragonfly_amd64.go │ ├── zsysnum_freebsd_386.go │ ├── zsysnum_freebsd_amd64.go │ ├── zsysnum_freebsd_arm.go │ ├── zsysnum_freebsd_arm64.go │ ├── zsysnum_linux_386.go │ ├── zsysnum_linux_amd64.go │ ├── zsysnum_linux_arm.go │ ├── zsysnum_linux_arm64.go │ ├── zsysnum_linux_mips.go │ ├── zsysnum_linux_mips64.go │ ├── zsysnum_linux_mips64le.go │ ├── zsysnum_linux_mipsle.go │ ├── zsysnum_linux_ppc64.go │ ├── zsysnum_linux_ppc64le.go │ ├── zsysnum_linux_riscv64.go │ ├── zsysnum_linux_s390x.go │ ├── zsysnum_linux_sparc64.go │ ├── zsysnum_netbsd_386.go │ ├── zsysnum_netbsd_amd64.go │ ├── zsysnum_netbsd_arm.go │ ├── zsysnum_netbsd_arm64.go │ ├── zsysnum_openbsd_386.go │ ├── zsysnum_openbsd_amd64.go │ ├── zsysnum_openbsd_arm.go │ ├── zsysnum_openbsd_arm64.go │ ├── ztypes_aix_ppc.go │ ├── ztypes_aix_ppc64.go │ ├── ztypes_darwin_386.go │ ├── ztypes_darwin_amd64.go │ ├── ztypes_darwin_arm.go │ ├── ztypes_darwin_arm64.go │ ├── ztypes_dragonfly_amd64.go │ ├── ztypes_freebsd_386.go │ ├── ztypes_freebsd_amd64.go │ ├── ztypes_freebsd_arm.go │ ├── ztypes_freebsd_arm64.go │ ├── ztypes_linux_386.go │ ├── ztypes_linux_amd64.go │ ├── ztypes_linux_arm.go │ ├── ztypes_linux_arm64.go │ ├── ztypes_linux_mips.go │ ├── ztypes_linux_mips64.go │ ├── ztypes_linux_mips64le.go │ ├── ztypes_linux_mipsle.go │ ├── ztypes_linux_ppc64.go │ ├── ztypes_linux_ppc64le.go │ ├── ztypes_linux_riscv64.go │ ├── ztypes_linux_s390x.go │ ├── ztypes_linux_sparc64.go │ ├── ztypes_netbsd_386.go │ ├── ztypes_netbsd_amd64.go │ ├── ztypes_netbsd_arm.go │ ├── ztypes_netbsd_arm64.go │ ├── ztypes_openbsd_386.go │ ├── ztypes_openbsd_amd64.go │ ├── ztypes_openbsd_arm.go │ ├── ztypes_openbsd_arm64.go │ └── ztypes_solaris_amd64.go └── modules.txt /.gitignore: -------------------------------------------------------------------------------- 1 | # Compiled Object files, Static and Dynamic libs (Shared Objects) 2 | *.o 3 | *.a 4 | *.so 5 | 6 | # Folders 7 | _obj 8 | _test 9 | 10 | # Architecture specific extensions/prefixes 11 | *.[568vq] 12 | [568vq].out 13 | 14 | *.cgo1.go 15 | *.cgo2.c 16 | _cgo_defun.c 17 | _cgo_gotypes.go 18 | _cgo_export.* 19 | 20 | _testmain.go 21 | 22 | *.exe 23 | *.test 24 | *.prof 25 | .vscode/ 26 | .idea/ 27 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Fastergoding 2 | 3 | A gopher tool for faster coding. It can automatically compile and rerun the main.main() function when the files is changed. 4 | 5 | ## Usage 6 | ```bash 7 | cd {your-project} 8 | go get -u github.com/qinains/fastergoding 9 | ``` 10 | then edit the `main.go` file 11 | ```go 12 | package main 13 | 14 | import ( 15 | "fmt" 16 | "log" 17 | "net/http" 18 | 19 | "github.com/qinains/fastergoding" // add this code 20 | ) 21 | 22 | func main() { 23 | fastergoding.Run("-mod", "vendor", "-o", "myServer") // add this code 24 | http.HandleFunc("/", func(w http.ResponseWriter, r *http.Request) { 25 | fmt.Fprintf(w, "Hello %s!", r.URL.Query().Get("name")) 26 | }) 27 | err := http.ListenAndServe(":8080", nil) 28 | if err != nil { 29 | log.Fatal("ListenAndServe: ", err) 30 | } 31 | } 32 | ``` 33 | 34 | ## Develop 35 | 36 | ```bash 37 | export GOPROXY=https://goproxy.cn #if you live in China 38 | go get -u github.com/qinains/fastergoding 39 | ``` 40 | 41 | ## Reference 42 | 43 | [https://github.com/beego/bee](https://github.com/beego/bee) 44 | -------------------------------------------------------------------------------- /fastergoding.go: -------------------------------------------------------------------------------- 1 | /* 2 | Package fastergoding provides a function to automatically compile and run go code. 3 | Example: 4 | 5 | package main 6 | 7 | import ( 8 | "fmt" 9 | "log" 10 | "net/http" 11 | 12 | "github.com/qinains/fastergoding" // add this code 13 | ) 14 | 15 | func main() { 16 | fastergoding.Run("-mod", "vendor", "-o", "myServer") // add this code 17 | 18 | http.HandleFunc("/", func(w http.ResponseWriter, r *http.Request) { 19 | fmt.Fprintf(w, "Hello %s!", r.URL.Query().Get("name")) 20 | }) 21 | err := http.ListenAndServe(":8080", nil) 22 | if err != nil { 23 | log.Fatal("ListenAndServe: ", err) 24 | } 25 | } 26 | 27 | */ 28 | package fastergoding 29 | 30 | import ( 31 | "log" 32 | "os" 33 | "os/exec" 34 | "path" 35 | "path/filepath" 36 | "runtime" 37 | "strings" 38 | "sync" 39 | 40 | "github.com/fsnotify/fsnotify" 41 | ) 42 | 43 | var ( 44 | mainCmd *exec.Cmd 45 | fileModTimes = make(map[string]int64) 46 | lock sync.Mutex 47 | ) 48 | 49 | const runMode = "__RUN_MOD_RELOAD__" 50 | 51 | func runCmd(name string, args ...string) { 52 | cmdStr := name 53 | for _, arg := range args { 54 | cmdStr += " " + arg 55 | } 56 | log.Printf("Run cmd: %s", cmdStr) 57 | cmd := exec.Command(name, args...) 58 | cmd.Stderr = os.Stderr 59 | cmd.Stdout = os.Stdout 60 | cmd.Env = append(os.Environ(), "GOGC=off") 61 | cmd.Run() 62 | } 63 | 64 | func restart(rootPath string, buildArgs ...string) { 65 | lock.Lock() 66 | defer lock.Unlock() 67 | 68 | appName := "./" + path.Base(rootPath) 69 | cmdArgs := append([]string{"build", "-o", appName}, buildArgs...) 70 | for index, buildArg := range buildArgs { 71 | if strings.Contains(buildArg, "-o") { 72 | appName = "./" + buildArgs[index+1] 73 | cmdArgs = append([]string{"build"}, buildArgs...) 74 | break 75 | } 76 | } 77 | runCmd("go", cmdArgs...) 78 | 79 | defer func() { 80 | if e := recover(); e != nil { 81 | log.Printf("Kill recover: %s", e) 82 | } 83 | }() 84 | if mainCmd != nil && mainCmd.Process != nil { 85 | err := mainCmd.Process.Kill() 86 | if err != nil { 87 | log.Printf("Process kill error: %s", err) 88 | } 89 | } 90 | go func() { 91 | appName := "./" + path.Base(rootPath) 92 | if runtime.GOOS == "windows" { 93 | appName += ".exe" 94 | } 95 | mainCmd = exec.Command(appName) 96 | mainCmd.Stdout = os.Stdout 97 | mainCmd.Stderr = os.Stderr 98 | mainCmd.Args = append([]string{appName}) 99 | mainCmd.Env = append(os.Environ(), runMode+"="+runMode) 100 | mainCmd.Run() 101 | }() 102 | } 103 | 104 | func watch(rootPath string, buildArgs ...string) { 105 | watcher, err := fsnotify.NewWatcher() 106 | if err != nil { 107 | log.Fatalf("New Watcher error: %s", err) 108 | } 109 | 110 | go func() { 111 | for { 112 | select { 113 | case event := <-watcher.Events: 114 | filePath := event.Name 115 | if !strings.HasSuffix(filePath, ".go") || strings.Contains(filePath, ".#") { 116 | continue 117 | } 118 | fi, _ := os.Stat(filePath) 119 | mt := fi.ModTime().Unix() 120 | mt2 := fileModTimes[filePath] 121 | fileModTimes[filePath] = mt 122 | if mt != mt2 { 123 | go func() { 124 | log.Printf("Fired by: %s", filePath) 125 | restart(rootPath, buildArgs...) 126 | }() 127 | } 128 | case err := <-watcher.Errors: 129 | log.Printf("Watcher errors: %#v", err) 130 | } 131 | } 132 | }() 133 | 134 | filepath.Walk(rootPath, func(path string, info os.FileInfo, err error) error { 135 | if info.IsDir() { 136 | err = watcher.Add(path) 137 | if err != nil { 138 | log.Fatalf("Watcher add error: %s", err) 139 | } 140 | return nil 141 | } 142 | return nil 143 | }) 144 | } 145 | 146 | /* 147 | Run automatically compile and run the main function when the files is changed. 148 | */ 149 | func Run(buildArgs ...string) { 150 | if os.Getenv(runMode) == runMode { 151 | return 152 | } 153 | rootPath, _ := os.Getwd() 154 | os.Chdir(rootPath) 155 | 156 | watch(rootPath, buildArgs...) 157 | restart(rootPath, buildArgs...) 158 | for { 159 | runtime.Goexit() 160 | } 161 | } 162 | -------------------------------------------------------------------------------- /go.mod: -------------------------------------------------------------------------------- 1 | module github.com/qinains/fastergoding 2 | 3 | require ( 4 | github.com/fsnotify/fsnotify v1.4.7 5 | golang.org/x/sys v0.0.0-20190621203818-d432491b9138 // indirect 6 | ) 7 | -------------------------------------------------------------------------------- /go.sum: -------------------------------------------------------------------------------- 1 | github.com/fsnotify/fsnotify v1.4.7 h1:IXs+QLmnXW2CcXuY+8Mzv/fWEsPGWxqefPtCP5CnV9I= 2 | github.com/fsnotify/fsnotify v1.4.7/go.mod h1:jwhsz4b93w/PPRr/qN1Yymfu8t87LnFCMoQvtojpjFo= 3 | golang.org/x/sys v0.0.0-20190621203818-d432491b9138 h1:t8BZD9RDjkm9/h7yYN6kE8oaeov5r9aztkB7zKA5Tkg= 4 | golang.org/x/sys v0.0.0-20190621203818-d432491b9138/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= 5 | -------------------------------------------------------------------------------- /vendor/github.com/fsnotify/fsnotify/.editorconfig: -------------------------------------------------------------------------------- 1 | root = true 2 | 3 | [*] 4 | indent_style = tab 5 | indent_size = 4 6 | -------------------------------------------------------------------------------- /vendor/github.com/fsnotify/fsnotify/.gitignore: -------------------------------------------------------------------------------- 1 | # Setup a Global .gitignore for OS and editor generated files: 2 | # https://help.github.com/articles/ignoring-files 3 | # git config --global core.excludesfile ~/.gitignore_global 4 | 5 | .vagrant 6 | *.sublime-project 7 | -------------------------------------------------------------------------------- /vendor/github.com/fsnotify/fsnotify/.travis.yml: -------------------------------------------------------------------------------- 1 | sudo: false 2 | language: go 3 | 4 | go: 5 | - 1.8.x 6 | - 1.9.x 7 | - tip 8 | 9 | matrix: 10 | allow_failures: 11 | - go: tip 12 | fast_finish: true 13 | 14 | before_script: 15 | - go get -u github.com/golang/lint/golint 16 | 17 | script: 18 | - go test -v --race ./... 19 | 20 | after_script: 21 | - test -z "$(gofmt -s -l -w . | tee /dev/stderr)" 22 | - test -z "$(golint ./... | tee /dev/stderr)" 23 | - go vet ./... 24 | 25 | os: 26 | - linux 27 | - osx 28 | 29 | notifications: 30 | email: false 31 | -------------------------------------------------------------------------------- /vendor/github.com/fsnotify/fsnotify/AUTHORS: -------------------------------------------------------------------------------- 1 | # Names should be added to this file as 2 | # Name or Organization 3 | # The email address is not required for organizations. 4 | 5 | # You can update this list using the following command: 6 | # 7 | # $ git shortlog -se | awk '{print $2 " " $3 " " $4}' 8 | 9 | # Please keep the list sorted. 10 | 11 | Aaron L 12 | Adrien Bustany 13 | Amit Krishnan 14 | Anmol Sethi 15 | Bjørn Erik Pedersen 16 | Bruno Bigras 17 | Caleb Spare 18 | Case Nelson 19 | Chris Howey 20 | Christoffer Buchholz 21 | Daniel Wagner-Hall 22 | Dave Cheney 23 | Evan Phoenix 24 | Francisco Souza 25 | Hari haran 26 | John C Barstow 27 | Kelvin Fo 28 | Ken-ichirou MATSUZAWA 29 | Matt Layher 30 | Nathan Youngman 31 | Nickolai Zeldovich 32 | Patrick 33 | Paul Hammond 34 | Pawel Knap 35 | Pieter Droogendijk 36 | Pursuit92 37 | Riku Voipio 38 | Rob Figueiredo 39 | Rodrigo Chiossi 40 | Slawek Ligus 41 | Soge Zhang 42 | Tiffany Jernigan 43 | Tilak Sharma 44 | Tom Payne 45 | Travis Cline 46 | Tudor Golubenco 47 | Vahe Khachikyan 48 | Yukang 49 | bronze1man 50 | debrando 51 | henrikedwards 52 | 铁哥 53 | -------------------------------------------------------------------------------- /vendor/github.com/fsnotify/fsnotify/CONTRIBUTING.md: -------------------------------------------------------------------------------- 1 | # Contributing 2 | 3 | ## Issues 4 | 5 | * Request features and report bugs using the [GitHub Issue Tracker](https://github.com/fsnotify/fsnotify/issues). 6 | * Please indicate the platform you are using fsnotify on. 7 | * A code example to reproduce the problem is appreciated. 8 | 9 | ## Pull Requests 10 | 11 | ### Contributor License Agreement 12 | 13 | fsnotify is derived from code in the [golang.org/x/exp](https://godoc.org/golang.org/x/exp) package and it may be included [in the standard library](https://github.com/fsnotify/fsnotify/issues/1) in the future. Therefore fsnotify carries the same [LICENSE](https://github.com/fsnotify/fsnotify/blob/master/LICENSE) as Go. Contributors retain their copyright, so you need to fill out a short form before we can accept your contribution: [Google Individual Contributor License Agreement](https://developers.google.com/open-source/cla/individual). 14 | 15 | Please indicate that you have signed the CLA in your pull request. 16 | 17 | ### How fsnotify is Developed 18 | 19 | * Development is done on feature branches. 20 | * Tests are run on BSD, Linux, macOS and Windows. 21 | * Pull requests are reviewed and [applied to master][am] using [hub][]. 22 | * Maintainers may modify or squash commits rather than asking contributors to. 23 | * To issue a new release, the maintainers will: 24 | * Update the CHANGELOG 25 | * Tag a version, which will become available through gopkg.in. 26 | 27 | ### How to Fork 28 | 29 | For smooth sailing, always use the original import path. Installing with `go get` makes this easy. 30 | 31 | 1. Install from GitHub (`go get -u github.com/fsnotify/fsnotify`) 32 | 2. Create your feature branch (`git checkout -b my-new-feature`) 33 | 3. Ensure everything works and the tests pass (see below) 34 | 4. Commit your changes (`git commit -am 'Add some feature'`) 35 | 36 | Contribute upstream: 37 | 38 | 1. Fork fsnotify on GitHub 39 | 2. Add your remote (`git remote add fork git@github.com:mycompany/repo.git`) 40 | 3. Push to the branch (`git push fork my-new-feature`) 41 | 4. Create a new Pull Request on GitHub 42 | 43 | This workflow is [thoroughly explained by Katrina Owen](https://splice.com/blog/contributing-open-source-git-repositories-go/). 44 | 45 | ### Testing 46 | 47 | fsnotify uses build tags to compile different code on Linux, BSD, macOS, and Windows. 48 | 49 | Before doing a pull request, please do your best to test your changes on multiple platforms, and list which platforms you were able/unable to test on. 50 | 51 | To aid in cross-platform testing there is a Vagrantfile for Linux and BSD. 52 | 53 | * Install [Vagrant](http://www.vagrantup.com/) and [VirtualBox](https://www.virtualbox.org/) 54 | * Setup [Vagrant Gopher](https://github.com/nathany/vagrant-gopher) in your `src` folder. 55 | * Run `vagrant up` from the project folder. You can also setup just one box with `vagrant up linux` or `vagrant up bsd` (note: the BSD box doesn't support Windows hosts at this time, and NFS may prompt for your host OS password) 56 | * Once setup, you can run the test suite on a given OS with a single command `vagrant ssh linux -c 'cd fsnotify/fsnotify; go test'`. 57 | * When you're done, you will want to halt or destroy the Vagrant boxes. 58 | 59 | Notice: fsnotify file system events won't trigger in shared folders. The tests get around this limitation by using the /tmp directory. 60 | 61 | Right now there is no equivalent solution for Windows and macOS, but there are Windows VMs [freely available from Microsoft](http://www.modern.ie/en-us/virtualization-tools#downloads). 62 | 63 | ### Maintainers 64 | 65 | Help maintaining fsnotify is welcome. To be a maintainer: 66 | 67 | * Submit a pull request and sign the CLA as above. 68 | * You must be able to run the test suite on Mac, Windows, Linux and BSD. 69 | 70 | To keep master clean, the fsnotify project uses the "apply mail" workflow outlined in Nathaniel Talbott's post ["Merge pull request" Considered Harmful][am]. This requires installing [hub][]. 71 | 72 | All code changes should be internal pull requests. 73 | 74 | Releases are tagged using [Semantic Versioning](http://semver.org/). 75 | 76 | [hub]: https://github.com/github/hub 77 | [am]: http://blog.spreedly.com/2014/06/24/merge-pull-request-considered-harmful/#.VGa5yZPF_Zs 78 | -------------------------------------------------------------------------------- /vendor/github.com/fsnotify/fsnotify/LICENSE: -------------------------------------------------------------------------------- 1 | Copyright (c) 2012 The Go Authors. All rights reserved. 2 | Copyright (c) 2012 fsnotify Authors. All rights reserved. 3 | 4 | Redistribution and use in source and binary forms, with or without 5 | modification, are permitted provided that the following conditions are 6 | met: 7 | 8 | * Redistributions of source code must retain the above copyright 9 | notice, this list of conditions and the following disclaimer. 10 | * Redistributions in binary form must reproduce the above 11 | copyright notice, this list of conditions and the following disclaimer 12 | in the documentation and/or other materials provided with the 13 | distribution. 14 | * Neither the name of Google Inc. nor the names of its 15 | contributors may be used to endorse or promote products derived from 16 | this software without specific prior written permission. 17 | 18 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 19 | "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 20 | LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 21 | A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 22 | OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 23 | SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 24 | LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 25 | DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 26 | THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 27 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 28 | OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 29 | -------------------------------------------------------------------------------- /vendor/github.com/fsnotify/fsnotify/README.md: -------------------------------------------------------------------------------- 1 | # File system notifications for Go 2 | 3 | [![GoDoc](https://godoc.org/github.com/fsnotify/fsnotify?status.svg)](https://godoc.org/github.com/fsnotify/fsnotify) [![Go Report Card](https://goreportcard.com/badge/github.com/fsnotify/fsnotify)](https://goreportcard.com/report/github.com/fsnotify/fsnotify) 4 | 5 | fsnotify utilizes [golang.org/x/sys](https://godoc.org/golang.org/x/sys) rather than `syscall` from the standard library. Ensure you have the latest version installed by running: 6 | 7 | ```console 8 | go get -u golang.org/x/sys/... 9 | ``` 10 | 11 | Cross platform: Windows, Linux, BSD and macOS. 12 | 13 | |Adapter |OS |Status | 14 | |----------|----------|----------| 15 | |inotify |Linux 2.6.27 or later, Android\*|Supported [![Build Status](https://travis-ci.org/fsnotify/fsnotify.svg?branch=master)](https://travis-ci.org/fsnotify/fsnotify)| 16 | |kqueue |BSD, macOS, iOS\*|Supported [![Build Status](https://travis-ci.org/fsnotify/fsnotify.svg?branch=master)](https://travis-ci.org/fsnotify/fsnotify)| 17 | |ReadDirectoryChangesW|Windows|Supported [![Build status](https://ci.appveyor.com/api/projects/status/ivwjubaih4r0udeh/branch/master?svg=true)](https://ci.appveyor.com/project/NathanYoungman/fsnotify/branch/master)| 18 | |FSEvents |macOS |[Planned](https://github.com/fsnotify/fsnotify/issues/11)| 19 | |FEN |Solaris 11 |[In Progress](https://github.com/fsnotify/fsnotify/issues/12)| 20 | |fanotify |Linux 2.6.37+ | | 21 | |USN Journals |Windows |[Maybe](https://github.com/fsnotify/fsnotify/issues/53)| 22 | |Polling |*All* |[Maybe](https://github.com/fsnotify/fsnotify/issues/9)| 23 | 24 | \* Android and iOS are untested. 25 | 26 | Please see [the documentation](https://godoc.org/github.com/fsnotify/fsnotify) and consult the [FAQ](#faq) for usage information. 27 | 28 | ## API stability 29 | 30 | fsnotify is a fork of [howeyc/fsnotify](https://godoc.org/github.com/howeyc/fsnotify) with a new API as of v1.0. The API is based on [this design document](http://goo.gl/MrYxyA). 31 | 32 | All [releases](https://github.com/fsnotify/fsnotify/releases) are tagged based on [Semantic Versioning](http://semver.org/). Further API changes are [planned](https://github.com/fsnotify/fsnotify/milestones), and will be tagged with a new major revision number. 33 | 34 | Go 1.6 supports dependencies located in the `vendor/` folder. Unless you are creating a library, it is recommended that you copy fsnotify into `vendor/github.com/fsnotify/fsnotify` within your project, and likewise for `golang.org/x/sys`. 35 | 36 | ## Contributing 37 | 38 | Please refer to [CONTRIBUTING][] before opening an issue or pull request. 39 | 40 | ## Example 41 | 42 | See [example_test.go](https://github.com/fsnotify/fsnotify/blob/master/example_test.go). 43 | 44 | ## FAQ 45 | 46 | **When a file is moved to another directory is it still being watched?** 47 | 48 | No (it shouldn't be, unless you are watching where it was moved to). 49 | 50 | **When I watch a directory, are all subdirectories watched as well?** 51 | 52 | No, you must add watches for any directory you want to watch (a recursive watcher is on the roadmap [#18][]). 53 | 54 | **Do I have to watch the Error and Event channels in a separate goroutine?** 55 | 56 | As of now, yes. Looking into making this single-thread friendly (see [howeyc #7][#7]) 57 | 58 | **Why am I receiving multiple events for the same file on OS X?** 59 | 60 | Spotlight indexing on OS X can result in multiple events (see [howeyc #62][#62]). A temporary workaround is to add your folder(s) to the *Spotlight Privacy settings* until we have a native FSEvents implementation (see [#11][]). 61 | 62 | **How many files can be watched at once?** 63 | 64 | There are OS-specific limits as to how many watches can be created: 65 | * Linux: /proc/sys/fs/inotify/max_user_watches contains the limit, reaching this limit results in a "no space left on device" error. 66 | * BSD / OSX: sysctl variables "kern.maxfiles" and "kern.maxfilesperproc", reaching these limits results in a "too many open files" error. 67 | 68 | [#62]: https://github.com/howeyc/fsnotify/issues/62 69 | [#18]: https://github.com/fsnotify/fsnotify/issues/18 70 | [#11]: https://github.com/fsnotify/fsnotify/issues/11 71 | [#7]: https://github.com/howeyc/fsnotify/issues/7 72 | 73 | [contributing]: https://github.com/fsnotify/fsnotify/blob/master/CONTRIBUTING.md 74 | 75 | ## Related Projects 76 | 77 | * [notify](https://github.com/rjeczalik/notify) 78 | * [fsevents](https://github.com/fsnotify/fsevents) 79 | 80 | -------------------------------------------------------------------------------- /vendor/github.com/fsnotify/fsnotify/fen.go: -------------------------------------------------------------------------------- 1 | // Copyright 2010 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build solaris 6 | 7 | package fsnotify 8 | 9 | import ( 10 | "errors" 11 | ) 12 | 13 | // Watcher watches a set of files, delivering events to a channel. 14 | type Watcher struct { 15 | Events chan Event 16 | Errors chan error 17 | } 18 | 19 | // NewWatcher establishes a new watcher with the underlying OS and begins waiting for events. 20 | func NewWatcher() (*Watcher, error) { 21 | return nil, errors.New("FEN based watcher not yet supported for fsnotify\n") 22 | } 23 | 24 | // Close removes all watches and closes the events channel. 25 | func (w *Watcher) Close() error { 26 | return nil 27 | } 28 | 29 | // Add starts watching the named file or directory (non-recursively). 30 | func (w *Watcher) Add(name string) error { 31 | return nil 32 | } 33 | 34 | // Remove stops watching the the named file or directory (non-recursively). 35 | func (w *Watcher) Remove(name string) error { 36 | return nil 37 | } 38 | -------------------------------------------------------------------------------- /vendor/github.com/fsnotify/fsnotify/fsnotify.go: -------------------------------------------------------------------------------- 1 | // Copyright 2012 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build !plan9 6 | 7 | // Package fsnotify provides a platform-independent interface for file system notifications. 8 | package fsnotify 9 | 10 | import ( 11 | "bytes" 12 | "errors" 13 | "fmt" 14 | ) 15 | 16 | // Event represents a single file system notification. 17 | type Event struct { 18 | Name string // Relative path to the file or directory. 19 | Op Op // File operation that triggered the event. 20 | } 21 | 22 | // Op describes a set of file operations. 23 | type Op uint32 24 | 25 | // These are the generalized file operations that can trigger a notification. 26 | const ( 27 | Create Op = 1 << iota 28 | Write 29 | Remove 30 | Rename 31 | Chmod 32 | ) 33 | 34 | func (op Op) String() string { 35 | // Use a buffer for efficient string concatenation 36 | var buffer bytes.Buffer 37 | 38 | if op&Create == Create { 39 | buffer.WriteString("|CREATE") 40 | } 41 | if op&Remove == Remove { 42 | buffer.WriteString("|REMOVE") 43 | } 44 | if op&Write == Write { 45 | buffer.WriteString("|WRITE") 46 | } 47 | if op&Rename == Rename { 48 | buffer.WriteString("|RENAME") 49 | } 50 | if op&Chmod == Chmod { 51 | buffer.WriteString("|CHMOD") 52 | } 53 | if buffer.Len() == 0 { 54 | return "" 55 | } 56 | return buffer.String()[1:] // Strip leading pipe 57 | } 58 | 59 | // String returns a string representation of the event in the form 60 | // "file: REMOVE|WRITE|..." 61 | func (e Event) String() string { 62 | return fmt.Sprintf("%q: %s", e.Name, e.Op.String()) 63 | } 64 | 65 | // Common errors that can be reported by a watcher 66 | var ErrEventOverflow = errors.New("fsnotify queue overflow") 67 | -------------------------------------------------------------------------------- /vendor/github.com/fsnotify/fsnotify/inotify_poller.go: -------------------------------------------------------------------------------- 1 | // Copyright 2015 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build linux 6 | 7 | package fsnotify 8 | 9 | import ( 10 | "errors" 11 | 12 | "golang.org/x/sys/unix" 13 | ) 14 | 15 | type fdPoller struct { 16 | fd int // File descriptor (as returned by the inotify_init() syscall) 17 | epfd int // Epoll file descriptor 18 | pipe [2]int // Pipe for waking up 19 | } 20 | 21 | func emptyPoller(fd int) *fdPoller { 22 | poller := new(fdPoller) 23 | poller.fd = fd 24 | poller.epfd = -1 25 | poller.pipe[0] = -1 26 | poller.pipe[1] = -1 27 | return poller 28 | } 29 | 30 | // Create a new inotify poller. 31 | // This creates an inotify handler, and an epoll handler. 32 | func newFdPoller(fd int) (*fdPoller, error) { 33 | var errno error 34 | poller := emptyPoller(fd) 35 | defer func() { 36 | if errno != nil { 37 | poller.close() 38 | } 39 | }() 40 | poller.fd = fd 41 | 42 | // Create epoll fd 43 | poller.epfd, errno = unix.EpollCreate1(0) 44 | if poller.epfd == -1 { 45 | return nil, errno 46 | } 47 | // Create pipe; pipe[0] is the read end, pipe[1] the write end. 48 | errno = unix.Pipe2(poller.pipe[:], unix.O_NONBLOCK) 49 | if errno != nil { 50 | return nil, errno 51 | } 52 | 53 | // Register inotify fd with epoll 54 | event := unix.EpollEvent{ 55 | Fd: int32(poller.fd), 56 | Events: unix.EPOLLIN, 57 | } 58 | errno = unix.EpollCtl(poller.epfd, unix.EPOLL_CTL_ADD, poller.fd, &event) 59 | if errno != nil { 60 | return nil, errno 61 | } 62 | 63 | // Register pipe fd with epoll 64 | event = unix.EpollEvent{ 65 | Fd: int32(poller.pipe[0]), 66 | Events: unix.EPOLLIN, 67 | } 68 | errno = unix.EpollCtl(poller.epfd, unix.EPOLL_CTL_ADD, poller.pipe[0], &event) 69 | if errno != nil { 70 | return nil, errno 71 | } 72 | 73 | return poller, nil 74 | } 75 | 76 | // Wait using epoll. 77 | // Returns true if something is ready to be read, 78 | // false if there is not. 79 | func (poller *fdPoller) wait() (bool, error) { 80 | // 3 possible events per fd, and 2 fds, makes a maximum of 6 events. 81 | // I don't know whether epoll_wait returns the number of events returned, 82 | // or the total number of events ready. 83 | // I decided to catch both by making the buffer one larger than the maximum. 84 | events := make([]unix.EpollEvent, 7) 85 | for { 86 | n, errno := unix.EpollWait(poller.epfd, events, -1) 87 | if n == -1 { 88 | if errno == unix.EINTR { 89 | continue 90 | } 91 | return false, errno 92 | } 93 | if n == 0 { 94 | // If there are no events, try again. 95 | continue 96 | } 97 | if n > 6 { 98 | // This should never happen. More events were returned than should be possible. 99 | return false, errors.New("epoll_wait returned more events than I know what to do with") 100 | } 101 | ready := events[:n] 102 | epollhup := false 103 | epollerr := false 104 | epollin := false 105 | for _, event := range ready { 106 | if event.Fd == int32(poller.fd) { 107 | if event.Events&unix.EPOLLHUP != 0 { 108 | // This should not happen, but if it does, treat it as a wakeup. 109 | epollhup = true 110 | } 111 | if event.Events&unix.EPOLLERR != 0 { 112 | // If an error is waiting on the file descriptor, we should pretend 113 | // something is ready to read, and let unix.Read pick up the error. 114 | epollerr = true 115 | } 116 | if event.Events&unix.EPOLLIN != 0 { 117 | // There is data to read. 118 | epollin = true 119 | } 120 | } 121 | if event.Fd == int32(poller.pipe[0]) { 122 | if event.Events&unix.EPOLLHUP != 0 { 123 | // Write pipe descriptor was closed, by us. This means we're closing down the 124 | // watcher, and we should wake up. 125 | } 126 | if event.Events&unix.EPOLLERR != 0 { 127 | // If an error is waiting on the pipe file descriptor. 128 | // This is an absolute mystery, and should never ever happen. 129 | return false, errors.New("Error on the pipe descriptor.") 130 | } 131 | if event.Events&unix.EPOLLIN != 0 { 132 | // This is a regular wakeup, so we have to clear the buffer. 133 | err := poller.clearWake() 134 | if err != nil { 135 | return false, err 136 | } 137 | } 138 | } 139 | } 140 | 141 | if epollhup || epollerr || epollin { 142 | return true, nil 143 | } 144 | return false, nil 145 | } 146 | } 147 | 148 | // Close the write end of the poller. 149 | func (poller *fdPoller) wake() error { 150 | buf := make([]byte, 1) 151 | n, errno := unix.Write(poller.pipe[1], buf) 152 | if n == -1 { 153 | if errno == unix.EAGAIN { 154 | // Buffer is full, poller will wake. 155 | return nil 156 | } 157 | return errno 158 | } 159 | return nil 160 | } 161 | 162 | func (poller *fdPoller) clearWake() error { 163 | // You have to be woken up a LOT in order to get to 100! 164 | buf := make([]byte, 100) 165 | n, errno := unix.Read(poller.pipe[0], buf) 166 | if n == -1 { 167 | if errno == unix.EAGAIN { 168 | // Buffer is empty, someone else cleared our wake. 169 | return nil 170 | } 171 | return errno 172 | } 173 | return nil 174 | } 175 | 176 | // Close all poller file descriptors, but not the one passed to it. 177 | func (poller *fdPoller) close() { 178 | if poller.pipe[1] != -1 { 179 | unix.Close(poller.pipe[1]) 180 | } 181 | if poller.pipe[0] != -1 { 182 | unix.Close(poller.pipe[0]) 183 | } 184 | if poller.epfd != -1 { 185 | unix.Close(poller.epfd) 186 | } 187 | } 188 | -------------------------------------------------------------------------------- /vendor/github.com/fsnotify/fsnotify/open_mode_bsd.go: -------------------------------------------------------------------------------- 1 | // Copyright 2013 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build freebsd openbsd netbsd dragonfly 6 | 7 | package fsnotify 8 | 9 | import "golang.org/x/sys/unix" 10 | 11 | const openMode = unix.O_NONBLOCK | unix.O_RDONLY 12 | -------------------------------------------------------------------------------- /vendor/github.com/fsnotify/fsnotify/open_mode_darwin.go: -------------------------------------------------------------------------------- 1 | // Copyright 2013 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build darwin 6 | 7 | package fsnotify 8 | 9 | import "golang.org/x/sys/unix" 10 | 11 | // note: this constant is not defined on BSD 12 | const openMode = unix.O_EVTONLY 13 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/AUTHORS: -------------------------------------------------------------------------------- 1 | # This source code refers to The Go Authors for copyright purposes. 2 | # The master list of authors is in the main Go distribution, 3 | # visible at http://tip.golang.org/AUTHORS. 4 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/CONTRIBUTORS: -------------------------------------------------------------------------------- 1 | # This source code was written by the Go contributors. 2 | # The master list of contributors is in the main Go distribution, 3 | # visible at http://tip.golang.org/CONTRIBUTORS. 4 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/LICENSE: -------------------------------------------------------------------------------- 1 | Copyright (c) 2009 The Go Authors. All rights reserved. 2 | 3 | Redistribution and use in source and binary forms, with or without 4 | modification, are permitted provided that the following conditions are 5 | met: 6 | 7 | * Redistributions of source code must retain the above copyright 8 | notice, this list of conditions and the following disclaimer. 9 | * Redistributions in binary form must reproduce the above 10 | copyright notice, this list of conditions and the following disclaimer 11 | in the documentation and/or other materials provided with the 12 | distribution. 13 | * Neither the name of Google Inc. nor the names of its 14 | contributors may be used to endorse or promote products derived from 15 | this software without specific prior written permission. 16 | 17 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 18 | "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 19 | LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 20 | A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 21 | OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 22 | SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 23 | LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 24 | DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 25 | THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 26 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 27 | OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 28 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/PATENTS: -------------------------------------------------------------------------------- 1 | Additional IP Rights Grant (Patents) 2 | 3 | "This implementation" means the copyrightable works distributed by 4 | Google as part of the Go project. 5 | 6 | Google hereby grants to You a perpetual, worldwide, non-exclusive, 7 | no-charge, royalty-free, irrevocable (except as stated in this section) 8 | patent license to make, have made, use, offer to sell, sell, import, 9 | transfer and otherwise run, modify and propagate the contents of this 10 | implementation of Go, where such license applies only to those patent 11 | claims, both currently owned or controlled by Google and acquired in 12 | the future, licensable by Google that are necessarily infringed by this 13 | implementation of Go. This grant does not include claims that would be 14 | infringed only as a consequence of further modification of this 15 | implementation. If you or your agent or exclusive licensee institute or 16 | order or agree to the institution of patent litigation against any 17 | entity (including a cross-claim or counterclaim in a lawsuit) alleging 18 | that this implementation of Go or any code incorporated within this 19 | implementation of Go constitutes direct or contributory patent 20 | infringement, or inducement of patent infringement, then any patent 21 | rights granted to you under this License for this implementation of Go 22 | shall terminate as of the date such litigation is filed. 23 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/.gitignore: -------------------------------------------------------------------------------- 1 | _obj/ 2 | unix.test 3 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/affinity_linux.go: -------------------------------------------------------------------------------- 1 | // Copyright 2018 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // CPU affinity functions 6 | 7 | package unix 8 | 9 | import ( 10 | "unsafe" 11 | ) 12 | 13 | const cpuSetSize = _CPU_SETSIZE / _NCPUBITS 14 | 15 | // CPUSet represents a CPU affinity mask. 16 | type CPUSet [cpuSetSize]cpuMask 17 | 18 | func schedAffinity(trap uintptr, pid int, set *CPUSet) error { 19 | _, _, e := RawSyscall(trap, uintptr(pid), uintptr(unsafe.Sizeof(*set)), uintptr(unsafe.Pointer(set))) 20 | if e != 0 { 21 | return errnoErr(e) 22 | } 23 | return nil 24 | } 25 | 26 | // SchedGetaffinity gets the CPU affinity mask of the thread specified by pid. 27 | // If pid is 0 the calling thread is used. 28 | func SchedGetaffinity(pid int, set *CPUSet) error { 29 | return schedAffinity(SYS_SCHED_GETAFFINITY, pid, set) 30 | } 31 | 32 | // SchedSetaffinity sets the CPU affinity mask of the thread specified by pid. 33 | // If pid is 0 the calling thread is used. 34 | func SchedSetaffinity(pid int, set *CPUSet) error { 35 | return schedAffinity(SYS_SCHED_SETAFFINITY, pid, set) 36 | } 37 | 38 | // Zero clears the set s, so that it contains no CPUs. 39 | func (s *CPUSet) Zero() { 40 | for i := range s { 41 | s[i] = 0 42 | } 43 | } 44 | 45 | func cpuBitsIndex(cpu int) int { 46 | return cpu / _NCPUBITS 47 | } 48 | 49 | func cpuBitsMask(cpu int) cpuMask { 50 | return cpuMask(1 << (uint(cpu) % _NCPUBITS)) 51 | } 52 | 53 | // Set adds cpu to the set s. 54 | func (s *CPUSet) Set(cpu int) { 55 | i := cpuBitsIndex(cpu) 56 | if i < len(s) { 57 | s[i] |= cpuBitsMask(cpu) 58 | } 59 | } 60 | 61 | // Clear removes cpu from the set s. 62 | func (s *CPUSet) Clear(cpu int) { 63 | i := cpuBitsIndex(cpu) 64 | if i < len(s) { 65 | s[i] &^= cpuBitsMask(cpu) 66 | } 67 | } 68 | 69 | // IsSet reports whether cpu is in the set s. 70 | func (s *CPUSet) IsSet(cpu int) bool { 71 | i := cpuBitsIndex(cpu) 72 | if i < len(s) { 73 | return s[i]&cpuBitsMask(cpu) != 0 74 | } 75 | return false 76 | } 77 | 78 | // Count returns the number of CPUs in the set s. 79 | func (s *CPUSet) Count() int { 80 | c := 0 81 | for _, b := range s { 82 | c += onesCount64(uint64(b)) 83 | } 84 | return c 85 | } 86 | 87 | // onesCount64 is a copy of Go 1.9's math/bits.OnesCount64. 88 | // Once this package can require Go 1.9, we can delete this 89 | // and update the caller to use bits.OnesCount64. 90 | func onesCount64(x uint64) int { 91 | const m0 = 0x5555555555555555 // 01010101 ... 92 | const m1 = 0x3333333333333333 // 00110011 ... 93 | const m2 = 0x0f0f0f0f0f0f0f0f // 00001111 ... 94 | const m3 = 0x00ff00ff00ff00ff // etc. 95 | const m4 = 0x0000ffff0000ffff 96 | 97 | // Implementation: Parallel summing of adjacent bits. 98 | // See "Hacker's Delight", Chap. 5: Counting Bits. 99 | // The following pattern shows the general approach: 100 | // 101 | // x = x>>1&(m0&m) + x&(m0&m) 102 | // x = x>>2&(m1&m) + x&(m1&m) 103 | // x = x>>4&(m2&m) + x&(m2&m) 104 | // x = x>>8&(m3&m) + x&(m3&m) 105 | // x = x>>16&(m4&m) + x&(m4&m) 106 | // x = x>>32&(m5&m) + x&(m5&m) 107 | // return int(x) 108 | // 109 | // Masking (& operations) can be left away when there's no 110 | // danger that a field's sum will carry over into the next 111 | // field: Since the result cannot be > 64, 8 bits is enough 112 | // and we can ignore the masks for the shifts by 8 and up. 113 | // Per "Hacker's Delight", the first line can be simplified 114 | // more, but it saves at best one instruction, so we leave 115 | // it alone for clarity. 116 | const m = 1<<64 - 1 117 | x = x>>1&(m0&m) + x&(m0&m) 118 | x = x>>2&(m1&m) + x&(m1&m) 119 | x = (x>>4 + x) & (m2 & m) 120 | x += x >> 8 121 | x += x >> 16 122 | x += x >> 32 123 | return int(x) & (1<<7 - 1) 124 | } 125 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/aliases.go: -------------------------------------------------------------------------------- 1 | // Copyright 2018 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build aix darwin dragonfly freebsd linux netbsd openbsd solaris 6 | // +build go1.9 7 | 8 | package unix 9 | 10 | import "syscall" 11 | 12 | type Signal = syscall.Signal 13 | type Errno = syscall.Errno 14 | type SysProcAttr = syscall.SysProcAttr 15 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/asm_aix_ppc64.s: -------------------------------------------------------------------------------- 1 | // Copyright 2018 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build !gccgo 6 | 7 | #include "textflag.h" 8 | 9 | // 10 | // System calls for ppc64, AIX are implemented in runtime/syscall_aix.go 11 | // 12 | 13 | TEXT ·syscall6(SB),NOSPLIT,$0-88 14 | JMP syscall·syscall6(SB) 15 | 16 | TEXT ·rawSyscall6(SB),NOSPLIT,$0-88 17 | JMP syscall·rawSyscall6(SB) 18 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/asm_darwin_386.s: -------------------------------------------------------------------------------- 1 | // Copyright 2009 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build !gccgo 6 | 7 | #include "textflag.h" 8 | 9 | // 10 | // System call support for 386, Darwin 11 | // 12 | 13 | // Just jump to package syscall's implementation for all these functions. 14 | // The runtime may know about them. 15 | 16 | TEXT ·Syscall(SB),NOSPLIT,$0-28 17 | JMP syscall·Syscall(SB) 18 | 19 | TEXT ·Syscall6(SB),NOSPLIT,$0-40 20 | JMP syscall·Syscall6(SB) 21 | 22 | TEXT ·Syscall9(SB),NOSPLIT,$0-52 23 | JMP syscall·Syscall9(SB) 24 | 25 | TEXT ·RawSyscall(SB),NOSPLIT,$0-28 26 | JMP syscall·RawSyscall(SB) 27 | 28 | TEXT ·RawSyscall6(SB),NOSPLIT,$0-40 29 | JMP syscall·RawSyscall6(SB) 30 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/asm_darwin_amd64.s: -------------------------------------------------------------------------------- 1 | // Copyright 2009 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build !gccgo 6 | 7 | #include "textflag.h" 8 | 9 | // 10 | // System call support for AMD64, Darwin 11 | // 12 | 13 | // Just jump to package syscall's implementation for all these functions. 14 | // The runtime may know about them. 15 | 16 | TEXT ·Syscall(SB),NOSPLIT,$0-56 17 | JMP syscall·Syscall(SB) 18 | 19 | TEXT ·Syscall6(SB),NOSPLIT,$0-80 20 | JMP syscall·Syscall6(SB) 21 | 22 | TEXT ·Syscall9(SB),NOSPLIT,$0-104 23 | JMP syscall·Syscall9(SB) 24 | 25 | TEXT ·RawSyscall(SB),NOSPLIT,$0-56 26 | JMP syscall·RawSyscall(SB) 27 | 28 | TEXT ·RawSyscall6(SB),NOSPLIT,$0-80 29 | JMP syscall·RawSyscall6(SB) 30 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/asm_darwin_arm.s: -------------------------------------------------------------------------------- 1 | // Copyright 2015 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build !gccgo 6 | // +build arm,darwin 7 | 8 | #include "textflag.h" 9 | 10 | // 11 | // System call support for ARM, Darwin 12 | // 13 | 14 | // Just jump to package syscall's implementation for all these functions. 15 | // The runtime may know about them. 16 | 17 | TEXT ·Syscall(SB),NOSPLIT,$0-28 18 | B syscall·Syscall(SB) 19 | 20 | TEXT ·Syscall6(SB),NOSPLIT,$0-40 21 | B syscall·Syscall6(SB) 22 | 23 | TEXT ·Syscall9(SB),NOSPLIT,$0-52 24 | B syscall·Syscall9(SB) 25 | 26 | TEXT ·RawSyscall(SB),NOSPLIT,$0-28 27 | B syscall·RawSyscall(SB) 28 | 29 | TEXT ·RawSyscall6(SB),NOSPLIT,$0-40 30 | B syscall·RawSyscall6(SB) 31 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/asm_darwin_arm64.s: -------------------------------------------------------------------------------- 1 | // Copyright 2015 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build !gccgo 6 | // +build arm64,darwin 7 | 8 | #include "textflag.h" 9 | 10 | // 11 | // System call support for AMD64, Darwin 12 | // 13 | 14 | // Just jump to package syscall's implementation for all these functions. 15 | // The runtime may know about them. 16 | 17 | TEXT ·Syscall(SB),NOSPLIT,$0-56 18 | B syscall·Syscall(SB) 19 | 20 | TEXT ·Syscall6(SB),NOSPLIT,$0-80 21 | B syscall·Syscall6(SB) 22 | 23 | TEXT ·Syscall9(SB),NOSPLIT,$0-104 24 | B syscall·Syscall9(SB) 25 | 26 | TEXT ·RawSyscall(SB),NOSPLIT,$0-56 27 | B syscall·RawSyscall(SB) 28 | 29 | TEXT ·RawSyscall6(SB),NOSPLIT,$0-80 30 | B syscall·RawSyscall6(SB) 31 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/asm_dragonfly_amd64.s: -------------------------------------------------------------------------------- 1 | // Copyright 2009 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build !gccgo 6 | 7 | #include "textflag.h" 8 | 9 | // 10 | // System call support for AMD64, DragonFly 11 | // 12 | 13 | // Just jump to package syscall's implementation for all these functions. 14 | // The runtime may know about them. 15 | 16 | TEXT ·Syscall(SB),NOSPLIT,$0-56 17 | JMP syscall·Syscall(SB) 18 | 19 | TEXT ·Syscall6(SB),NOSPLIT,$0-80 20 | JMP syscall·Syscall6(SB) 21 | 22 | TEXT ·Syscall9(SB),NOSPLIT,$0-104 23 | JMP syscall·Syscall9(SB) 24 | 25 | TEXT ·RawSyscall(SB),NOSPLIT,$0-56 26 | JMP syscall·RawSyscall(SB) 27 | 28 | TEXT ·RawSyscall6(SB),NOSPLIT,$0-80 29 | JMP syscall·RawSyscall6(SB) 30 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/asm_freebsd_386.s: -------------------------------------------------------------------------------- 1 | // Copyright 2009 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build !gccgo 6 | 7 | #include "textflag.h" 8 | 9 | // 10 | // System call support for 386, FreeBSD 11 | // 12 | 13 | // Just jump to package syscall's implementation for all these functions. 14 | // The runtime may know about them. 15 | 16 | TEXT ·Syscall(SB),NOSPLIT,$0-28 17 | JMP syscall·Syscall(SB) 18 | 19 | TEXT ·Syscall6(SB),NOSPLIT,$0-40 20 | JMP syscall·Syscall6(SB) 21 | 22 | TEXT ·Syscall9(SB),NOSPLIT,$0-52 23 | JMP syscall·Syscall9(SB) 24 | 25 | TEXT ·RawSyscall(SB),NOSPLIT,$0-28 26 | JMP syscall·RawSyscall(SB) 27 | 28 | TEXT ·RawSyscall6(SB),NOSPLIT,$0-40 29 | JMP syscall·RawSyscall6(SB) 30 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/asm_freebsd_amd64.s: -------------------------------------------------------------------------------- 1 | // Copyright 2009 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build !gccgo 6 | 7 | #include "textflag.h" 8 | 9 | // 10 | // System call support for AMD64, FreeBSD 11 | // 12 | 13 | // Just jump to package syscall's implementation for all these functions. 14 | // The runtime may know about them. 15 | 16 | TEXT ·Syscall(SB),NOSPLIT,$0-56 17 | JMP syscall·Syscall(SB) 18 | 19 | TEXT ·Syscall6(SB),NOSPLIT,$0-80 20 | JMP syscall·Syscall6(SB) 21 | 22 | TEXT ·Syscall9(SB),NOSPLIT,$0-104 23 | JMP syscall·Syscall9(SB) 24 | 25 | TEXT ·RawSyscall(SB),NOSPLIT,$0-56 26 | JMP syscall·RawSyscall(SB) 27 | 28 | TEXT ·RawSyscall6(SB),NOSPLIT,$0-80 29 | JMP syscall·RawSyscall6(SB) 30 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/asm_freebsd_arm.s: -------------------------------------------------------------------------------- 1 | // Copyright 2012 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build !gccgo 6 | 7 | #include "textflag.h" 8 | 9 | // 10 | // System call support for ARM, FreeBSD 11 | // 12 | 13 | // Just jump to package syscall's implementation for all these functions. 14 | // The runtime may know about them. 15 | 16 | TEXT ·Syscall(SB),NOSPLIT,$0-28 17 | B syscall·Syscall(SB) 18 | 19 | TEXT ·Syscall6(SB),NOSPLIT,$0-40 20 | B syscall·Syscall6(SB) 21 | 22 | TEXT ·Syscall9(SB),NOSPLIT,$0-52 23 | B syscall·Syscall9(SB) 24 | 25 | TEXT ·RawSyscall(SB),NOSPLIT,$0-28 26 | B syscall·RawSyscall(SB) 27 | 28 | TEXT ·RawSyscall6(SB),NOSPLIT,$0-40 29 | B syscall·RawSyscall6(SB) 30 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/asm_freebsd_arm64.s: -------------------------------------------------------------------------------- 1 | // Copyright 2018 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build !gccgo 6 | 7 | #include "textflag.h" 8 | 9 | // 10 | // System call support for ARM64, FreeBSD 11 | // 12 | 13 | // Just jump to package syscall's implementation for all these functions. 14 | // The runtime may know about them. 15 | 16 | TEXT ·Syscall(SB),NOSPLIT,$0-56 17 | JMP syscall·Syscall(SB) 18 | 19 | TEXT ·Syscall6(SB),NOSPLIT,$0-80 20 | JMP syscall·Syscall6(SB) 21 | 22 | TEXT ·Syscall9(SB),NOSPLIT,$0-104 23 | JMP syscall·Syscall9(SB) 24 | 25 | TEXT ·RawSyscall(SB),NOSPLIT,$0-56 26 | JMP syscall·RawSyscall(SB) 27 | 28 | TEXT ·RawSyscall6(SB),NOSPLIT,$0-80 29 | JMP syscall·RawSyscall6(SB) 30 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/asm_linux_386.s: -------------------------------------------------------------------------------- 1 | // Copyright 2009 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build !gccgo 6 | 7 | #include "textflag.h" 8 | 9 | // 10 | // System calls for 386, Linux 11 | // 12 | 13 | // See ../runtime/sys_linux_386.s for the reason why we always use int 0x80 14 | // instead of the glibc-specific "CALL 0x10(GS)". 15 | #define INVOKE_SYSCALL INT $0x80 16 | 17 | // Just jump to package syscall's implementation for all these functions. 18 | // The runtime may know about them. 19 | 20 | TEXT ·Syscall(SB),NOSPLIT,$0-28 21 | JMP syscall·Syscall(SB) 22 | 23 | TEXT ·Syscall6(SB),NOSPLIT,$0-40 24 | JMP syscall·Syscall6(SB) 25 | 26 | TEXT ·SyscallNoError(SB),NOSPLIT,$0-24 27 | CALL runtime·entersyscall(SB) 28 | MOVL trap+0(FP), AX // syscall entry 29 | MOVL a1+4(FP), BX 30 | MOVL a2+8(FP), CX 31 | MOVL a3+12(FP), DX 32 | MOVL $0, SI 33 | MOVL $0, DI 34 | INVOKE_SYSCALL 35 | MOVL AX, r1+16(FP) 36 | MOVL DX, r2+20(FP) 37 | CALL runtime·exitsyscall(SB) 38 | RET 39 | 40 | TEXT ·RawSyscall(SB),NOSPLIT,$0-28 41 | JMP syscall·RawSyscall(SB) 42 | 43 | TEXT ·RawSyscall6(SB),NOSPLIT,$0-40 44 | JMP syscall·RawSyscall6(SB) 45 | 46 | TEXT ·RawSyscallNoError(SB),NOSPLIT,$0-24 47 | MOVL trap+0(FP), AX // syscall entry 48 | MOVL a1+4(FP), BX 49 | MOVL a2+8(FP), CX 50 | MOVL a3+12(FP), DX 51 | MOVL $0, SI 52 | MOVL $0, DI 53 | INVOKE_SYSCALL 54 | MOVL AX, r1+16(FP) 55 | MOVL DX, r2+20(FP) 56 | RET 57 | 58 | TEXT ·socketcall(SB),NOSPLIT,$0-36 59 | JMP syscall·socketcall(SB) 60 | 61 | TEXT ·rawsocketcall(SB),NOSPLIT,$0-36 62 | JMP syscall·rawsocketcall(SB) 63 | 64 | TEXT ·seek(SB),NOSPLIT,$0-28 65 | JMP syscall·seek(SB) 66 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/asm_linux_amd64.s: -------------------------------------------------------------------------------- 1 | // Copyright 2009 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build !gccgo 6 | 7 | #include "textflag.h" 8 | 9 | // 10 | // System calls for AMD64, Linux 11 | // 12 | 13 | // Just jump to package syscall's implementation for all these functions. 14 | // The runtime may know about them. 15 | 16 | TEXT ·Syscall(SB),NOSPLIT,$0-56 17 | JMP syscall·Syscall(SB) 18 | 19 | TEXT ·Syscall6(SB),NOSPLIT,$0-80 20 | JMP syscall·Syscall6(SB) 21 | 22 | TEXT ·SyscallNoError(SB),NOSPLIT,$0-48 23 | CALL runtime·entersyscall(SB) 24 | MOVQ a1+8(FP), DI 25 | MOVQ a2+16(FP), SI 26 | MOVQ a3+24(FP), DX 27 | MOVQ $0, R10 28 | MOVQ $0, R8 29 | MOVQ $0, R9 30 | MOVQ trap+0(FP), AX // syscall entry 31 | SYSCALL 32 | MOVQ AX, r1+32(FP) 33 | MOVQ DX, r2+40(FP) 34 | CALL runtime·exitsyscall(SB) 35 | RET 36 | 37 | TEXT ·RawSyscall(SB),NOSPLIT,$0-56 38 | JMP syscall·RawSyscall(SB) 39 | 40 | TEXT ·RawSyscall6(SB),NOSPLIT,$0-80 41 | JMP syscall·RawSyscall6(SB) 42 | 43 | TEXT ·RawSyscallNoError(SB),NOSPLIT,$0-48 44 | MOVQ a1+8(FP), DI 45 | MOVQ a2+16(FP), SI 46 | MOVQ a3+24(FP), DX 47 | MOVQ $0, R10 48 | MOVQ $0, R8 49 | MOVQ $0, R9 50 | MOVQ trap+0(FP), AX // syscall entry 51 | SYSCALL 52 | MOVQ AX, r1+32(FP) 53 | MOVQ DX, r2+40(FP) 54 | RET 55 | 56 | TEXT ·gettimeofday(SB),NOSPLIT,$0-16 57 | JMP syscall·gettimeofday(SB) 58 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/asm_linux_arm.s: -------------------------------------------------------------------------------- 1 | // Copyright 2009 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build !gccgo 6 | 7 | #include "textflag.h" 8 | 9 | // 10 | // System calls for arm, Linux 11 | // 12 | 13 | // Just jump to package syscall's implementation for all these functions. 14 | // The runtime may know about them. 15 | 16 | TEXT ·Syscall(SB),NOSPLIT,$0-28 17 | B syscall·Syscall(SB) 18 | 19 | TEXT ·Syscall6(SB),NOSPLIT,$0-40 20 | B syscall·Syscall6(SB) 21 | 22 | TEXT ·SyscallNoError(SB),NOSPLIT,$0-24 23 | BL runtime·entersyscall(SB) 24 | MOVW trap+0(FP), R7 25 | MOVW a1+4(FP), R0 26 | MOVW a2+8(FP), R1 27 | MOVW a3+12(FP), R2 28 | MOVW $0, R3 29 | MOVW $0, R4 30 | MOVW $0, R5 31 | SWI $0 32 | MOVW R0, r1+16(FP) 33 | MOVW $0, R0 34 | MOVW R0, r2+20(FP) 35 | BL runtime·exitsyscall(SB) 36 | RET 37 | 38 | TEXT ·RawSyscall(SB),NOSPLIT,$0-28 39 | B syscall·RawSyscall(SB) 40 | 41 | TEXT ·RawSyscall6(SB),NOSPLIT,$0-40 42 | B syscall·RawSyscall6(SB) 43 | 44 | TEXT ·RawSyscallNoError(SB),NOSPLIT,$0-24 45 | MOVW trap+0(FP), R7 // syscall entry 46 | MOVW a1+4(FP), R0 47 | MOVW a2+8(FP), R1 48 | MOVW a3+12(FP), R2 49 | SWI $0 50 | MOVW R0, r1+16(FP) 51 | MOVW $0, R0 52 | MOVW R0, r2+20(FP) 53 | RET 54 | 55 | TEXT ·seek(SB),NOSPLIT,$0-28 56 | B syscall·seek(SB) 57 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/asm_linux_arm64.s: -------------------------------------------------------------------------------- 1 | // Copyright 2015 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build linux 6 | // +build arm64 7 | // +build !gccgo 8 | 9 | #include "textflag.h" 10 | 11 | // Just jump to package syscall's implementation for all these functions. 12 | // The runtime may know about them. 13 | 14 | TEXT ·Syscall(SB),NOSPLIT,$0-56 15 | B syscall·Syscall(SB) 16 | 17 | TEXT ·Syscall6(SB),NOSPLIT,$0-80 18 | B syscall·Syscall6(SB) 19 | 20 | TEXT ·SyscallNoError(SB),NOSPLIT,$0-48 21 | BL runtime·entersyscall(SB) 22 | MOVD a1+8(FP), R0 23 | MOVD a2+16(FP), R1 24 | MOVD a3+24(FP), R2 25 | MOVD $0, R3 26 | MOVD $0, R4 27 | MOVD $0, R5 28 | MOVD trap+0(FP), R8 // syscall entry 29 | SVC 30 | MOVD R0, r1+32(FP) // r1 31 | MOVD R1, r2+40(FP) // r2 32 | BL runtime·exitsyscall(SB) 33 | RET 34 | 35 | TEXT ·RawSyscall(SB),NOSPLIT,$0-56 36 | B syscall·RawSyscall(SB) 37 | 38 | TEXT ·RawSyscall6(SB),NOSPLIT,$0-80 39 | B syscall·RawSyscall6(SB) 40 | 41 | TEXT ·RawSyscallNoError(SB),NOSPLIT,$0-48 42 | MOVD a1+8(FP), R0 43 | MOVD a2+16(FP), R1 44 | MOVD a3+24(FP), R2 45 | MOVD $0, R3 46 | MOVD $0, R4 47 | MOVD $0, R5 48 | MOVD trap+0(FP), R8 // syscall entry 49 | SVC 50 | MOVD R0, r1+32(FP) 51 | MOVD R1, r2+40(FP) 52 | RET 53 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/asm_linux_mips64x.s: -------------------------------------------------------------------------------- 1 | // Copyright 2015 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build linux 6 | // +build mips64 mips64le 7 | // +build !gccgo 8 | 9 | #include "textflag.h" 10 | 11 | // 12 | // System calls for mips64, Linux 13 | // 14 | 15 | // Just jump to package syscall's implementation for all these functions. 16 | // The runtime may know about them. 17 | 18 | TEXT ·Syscall(SB),NOSPLIT,$0-56 19 | JMP syscall·Syscall(SB) 20 | 21 | TEXT ·Syscall6(SB),NOSPLIT,$0-80 22 | JMP syscall·Syscall6(SB) 23 | 24 | TEXT ·SyscallNoError(SB),NOSPLIT,$0-48 25 | JAL runtime·entersyscall(SB) 26 | MOVV a1+8(FP), R4 27 | MOVV a2+16(FP), R5 28 | MOVV a3+24(FP), R6 29 | MOVV R0, R7 30 | MOVV R0, R8 31 | MOVV R0, R9 32 | MOVV trap+0(FP), R2 // syscall entry 33 | SYSCALL 34 | MOVV R2, r1+32(FP) 35 | MOVV R3, r2+40(FP) 36 | JAL runtime·exitsyscall(SB) 37 | RET 38 | 39 | TEXT ·RawSyscall(SB),NOSPLIT,$0-56 40 | JMP syscall·RawSyscall(SB) 41 | 42 | TEXT ·RawSyscall6(SB),NOSPLIT,$0-80 43 | JMP syscall·RawSyscall6(SB) 44 | 45 | TEXT ·RawSyscallNoError(SB),NOSPLIT,$0-48 46 | MOVV a1+8(FP), R4 47 | MOVV a2+16(FP), R5 48 | MOVV a3+24(FP), R6 49 | MOVV R0, R7 50 | MOVV R0, R8 51 | MOVV R0, R9 52 | MOVV trap+0(FP), R2 // syscall entry 53 | SYSCALL 54 | MOVV R2, r1+32(FP) 55 | MOVV R3, r2+40(FP) 56 | RET 57 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/asm_linux_mipsx.s: -------------------------------------------------------------------------------- 1 | // Copyright 2016 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build linux 6 | // +build mips mipsle 7 | // +build !gccgo 8 | 9 | #include "textflag.h" 10 | 11 | // 12 | // System calls for mips, Linux 13 | // 14 | 15 | // Just jump to package syscall's implementation for all these functions. 16 | // The runtime may know about them. 17 | 18 | TEXT ·Syscall(SB),NOSPLIT,$0-28 19 | JMP syscall·Syscall(SB) 20 | 21 | TEXT ·Syscall6(SB),NOSPLIT,$0-40 22 | JMP syscall·Syscall6(SB) 23 | 24 | TEXT ·Syscall9(SB),NOSPLIT,$0-52 25 | JMP syscall·Syscall9(SB) 26 | 27 | TEXT ·SyscallNoError(SB),NOSPLIT,$0-24 28 | JAL runtime·entersyscall(SB) 29 | MOVW a1+4(FP), R4 30 | MOVW a2+8(FP), R5 31 | MOVW a3+12(FP), R6 32 | MOVW R0, R7 33 | MOVW trap+0(FP), R2 // syscall entry 34 | SYSCALL 35 | MOVW R2, r1+16(FP) // r1 36 | MOVW R3, r2+20(FP) // r2 37 | JAL runtime·exitsyscall(SB) 38 | RET 39 | 40 | TEXT ·RawSyscall(SB),NOSPLIT,$0-28 41 | JMP syscall·RawSyscall(SB) 42 | 43 | TEXT ·RawSyscall6(SB),NOSPLIT,$0-40 44 | JMP syscall·RawSyscall6(SB) 45 | 46 | TEXT ·RawSyscallNoError(SB),NOSPLIT,$0-24 47 | MOVW a1+4(FP), R4 48 | MOVW a2+8(FP), R5 49 | MOVW a3+12(FP), R6 50 | MOVW trap+0(FP), R2 // syscall entry 51 | SYSCALL 52 | MOVW R2, r1+16(FP) 53 | MOVW R3, r2+20(FP) 54 | RET 55 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/asm_linux_ppc64x.s: -------------------------------------------------------------------------------- 1 | // Copyright 2014 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build linux 6 | // +build ppc64 ppc64le 7 | // +build !gccgo 8 | 9 | #include "textflag.h" 10 | 11 | // 12 | // System calls for ppc64, Linux 13 | // 14 | 15 | // Just jump to package syscall's implementation for all these functions. 16 | // The runtime may know about them. 17 | 18 | TEXT ·SyscallNoError(SB),NOSPLIT,$0-48 19 | BL runtime·entersyscall(SB) 20 | MOVD a1+8(FP), R3 21 | MOVD a2+16(FP), R4 22 | MOVD a3+24(FP), R5 23 | MOVD R0, R6 24 | MOVD R0, R7 25 | MOVD R0, R8 26 | MOVD trap+0(FP), R9 // syscall entry 27 | SYSCALL R9 28 | MOVD R3, r1+32(FP) 29 | MOVD R4, r2+40(FP) 30 | BL runtime·exitsyscall(SB) 31 | RET 32 | 33 | TEXT ·RawSyscallNoError(SB),NOSPLIT,$0-48 34 | MOVD a1+8(FP), R3 35 | MOVD a2+16(FP), R4 36 | MOVD a3+24(FP), R5 37 | MOVD R0, R6 38 | MOVD R0, R7 39 | MOVD R0, R8 40 | MOVD trap+0(FP), R9 // syscall entry 41 | SYSCALL R9 42 | MOVD R3, r1+32(FP) 43 | MOVD R4, r2+40(FP) 44 | RET 45 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/asm_linux_riscv64.s: -------------------------------------------------------------------------------- 1 | // Copyright 2019 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build riscv64,!gccgo 6 | 7 | #include "textflag.h" 8 | 9 | // 10 | // System calls for linux/riscv64. 11 | // 12 | // Where available, just jump to package syscall's implementation of 13 | // these functions. 14 | 15 | TEXT ·Syscall(SB),NOSPLIT,$0-56 16 | JMP syscall·Syscall(SB) 17 | 18 | TEXT ·Syscall6(SB),NOSPLIT,$0-80 19 | JMP syscall·Syscall6(SB) 20 | 21 | TEXT ·SyscallNoError(SB),NOSPLIT,$0-48 22 | CALL runtime·entersyscall(SB) 23 | MOV a1+8(FP), A0 24 | MOV a2+16(FP), A1 25 | MOV a3+24(FP), A2 26 | MOV $0, A3 27 | MOV $0, A4 28 | MOV $0, A5 29 | MOV $0, A6 30 | MOV trap+0(FP), A7 // syscall entry 31 | ECALL 32 | MOV A0, r1+32(FP) // r1 33 | MOV A1, r2+40(FP) // r2 34 | CALL runtime·exitsyscall(SB) 35 | RET 36 | 37 | TEXT ·RawSyscall(SB),NOSPLIT,$0-56 38 | JMP syscall·RawSyscall(SB) 39 | 40 | TEXT ·RawSyscall6(SB),NOSPLIT,$0-80 41 | JMP syscall·RawSyscall6(SB) 42 | 43 | TEXT ·RawSyscallNoError(SB),NOSPLIT,$0-48 44 | MOV a1+8(FP), A0 45 | MOV a2+16(FP), A1 46 | MOV a3+24(FP), A2 47 | MOV ZERO, A3 48 | MOV ZERO, A4 49 | MOV ZERO, A5 50 | MOV trap+0(FP), A7 // syscall entry 51 | ECALL 52 | MOV A0, r1+32(FP) 53 | MOV A1, r2+40(FP) 54 | RET 55 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/asm_linux_s390x.s: -------------------------------------------------------------------------------- 1 | // Copyright 2016 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build s390x 6 | // +build linux 7 | // +build !gccgo 8 | 9 | #include "textflag.h" 10 | 11 | // 12 | // System calls for s390x, Linux 13 | // 14 | 15 | // Just jump to package syscall's implementation for all these functions. 16 | // The runtime may know about them. 17 | 18 | TEXT ·Syscall(SB),NOSPLIT,$0-56 19 | BR syscall·Syscall(SB) 20 | 21 | TEXT ·Syscall6(SB),NOSPLIT,$0-80 22 | BR syscall·Syscall6(SB) 23 | 24 | TEXT ·SyscallNoError(SB),NOSPLIT,$0-48 25 | BL runtime·entersyscall(SB) 26 | MOVD a1+8(FP), R2 27 | MOVD a2+16(FP), R3 28 | MOVD a3+24(FP), R4 29 | MOVD $0, R5 30 | MOVD $0, R6 31 | MOVD $0, R7 32 | MOVD trap+0(FP), R1 // syscall entry 33 | SYSCALL 34 | MOVD R2, r1+32(FP) 35 | MOVD R3, r2+40(FP) 36 | BL runtime·exitsyscall(SB) 37 | RET 38 | 39 | TEXT ·RawSyscall(SB),NOSPLIT,$0-56 40 | BR syscall·RawSyscall(SB) 41 | 42 | TEXT ·RawSyscall6(SB),NOSPLIT,$0-80 43 | BR syscall·RawSyscall6(SB) 44 | 45 | TEXT ·RawSyscallNoError(SB),NOSPLIT,$0-48 46 | MOVD a1+8(FP), R2 47 | MOVD a2+16(FP), R3 48 | MOVD a3+24(FP), R4 49 | MOVD $0, R5 50 | MOVD $0, R6 51 | MOVD $0, R7 52 | MOVD trap+0(FP), R1 // syscall entry 53 | SYSCALL 54 | MOVD R2, r1+32(FP) 55 | MOVD R3, r2+40(FP) 56 | RET 57 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/asm_netbsd_386.s: -------------------------------------------------------------------------------- 1 | // Copyright 2009 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build !gccgo 6 | 7 | #include "textflag.h" 8 | 9 | // 10 | // System call support for 386, NetBSD 11 | // 12 | 13 | // Just jump to package syscall's implementation for all these functions. 14 | // The runtime may know about them. 15 | 16 | TEXT ·Syscall(SB),NOSPLIT,$0-28 17 | JMP syscall·Syscall(SB) 18 | 19 | TEXT ·Syscall6(SB),NOSPLIT,$0-40 20 | JMP syscall·Syscall6(SB) 21 | 22 | TEXT ·Syscall9(SB),NOSPLIT,$0-52 23 | JMP syscall·Syscall9(SB) 24 | 25 | TEXT ·RawSyscall(SB),NOSPLIT,$0-28 26 | JMP syscall·RawSyscall(SB) 27 | 28 | TEXT ·RawSyscall6(SB),NOSPLIT,$0-40 29 | JMP syscall·RawSyscall6(SB) 30 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/asm_netbsd_amd64.s: -------------------------------------------------------------------------------- 1 | // Copyright 2009 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build !gccgo 6 | 7 | #include "textflag.h" 8 | 9 | // 10 | // System call support for AMD64, NetBSD 11 | // 12 | 13 | // Just jump to package syscall's implementation for all these functions. 14 | // The runtime may know about them. 15 | 16 | TEXT ·Syscall(SB),NOSPLIT,$0-56 17 | JMP syscall·Syscall(SB) 18 | 19 | TEXT ·Syscall6(SB),NOSPLIT,$0-80 20 | JMP syscall·Syscall6(SB) 21 | 22 | TEXT ·Syscall9(SB),NOSPLIT,$0-104 23 | JMP syscall·Syscall9(SB) 24 | 25 | TEXT ·RawSyscall(SB),NOSPLIT,$0-56 26 | JMP syscall·RawSyscall(SB) 27 | 28 | TEXT ·RawSyscall6(SB),NOSPLIT,$0-80 29 | JMP syscall·RawSyscall6(SB) 30 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/asm_netbsd_arm.s: -------------------------------------------------------------------------------- 1 | // Copyright 2013 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build !gccgo 6 | 7 | #include "textflag.h" 8 | 9 | // 10 | // System call support for ARM, NetBSD 11 | // 12 | 13 | // Just jump to package syscall's implementation for all these functions. 14 | // The runtime may know about them. 15 | 16 | TEXT ·Syscall(SB),NOSPLIT,$0-28 17 | B syscall·Syscall(SB) 18 | 19 | TEXT ·Syscall6(SB),NOSPLIT,$0-40 20 | B syscall·Syscall6(SB) 21 | 22 | TEXT ·Syscall9(SB),NOSPLIT,$0-52 23 | B syscall·Syscall9(SB) 24 | 25 | TEXT ·RawSyscall(SB),NOSPLIT,$0-28 26 | B syscall·RawSyscall(SB) 27 | 28 | TEXT ·RawSyscall6(SB),NOSPLIT,$0-40 29 | B syscall·RawSyscall6(SB) 30 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/asm_netbsd_arm64.s: -------------------------------------------------------------------------------- 1 | // Copyright 2019 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build !gccgo 6 | 7 | #include "textflag.h" 8 | 9 | // 10 | // System call support for ARM64, NetBSD 11 | // 12 | 13 | // Just jump to package syscall's implementation for all these functions. 14 | // The runtime may know about them. 15 | 16 | TEXT ·Syscall(SB),NOSPLIT,$0-56 17 | B syscall·Syscall(SB) 18 | 19 | TEXT ·Syscall6(SB),NOSPLIT,$0-80 20 | B syscall·Syscall6(SB) 21 | 22 | TEXT ·Syscall9(SB),NOSPLIT,$0-104 23 | B syscall·Syscall9(SB) 24 | 25 | TEXT ·RawSyscall(SB),NOSPLIT,$0-56 26 | B syscall·RawSyscall(SB) 27 | 28 | TEXT ·RawSyscall6(SB),NOSPLIT,$0-80 29 | B syscall·RawSyscall6(SB) 30 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/asm_openbsd_386.s: -------------------------------------------------------------------------------- 1 | // Copyright 2009 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build !gccgo 6 | 7 | #include "textflag.h" 8 | 9 | // 10 | // System call support for 386, OpenBSD 11 | // 12 | 13 | // Just jump to package syscall's implementation for all these functions. 14 | // The runtime may know about them. 15 | 16 | TEXT ·Syscall(SB),NOSPLIT,$0-28 17 | JMP syscall·Syscall(SB) 18 | 19 | TEXT ·Syscall6(SB),NOSPLIT,$0-40 20 | JMP syscall·Syscall6(SB) 21 | 22 | TEXT ·Syscall9(SB),NOSPLIT,$0-52 23 | JMP syscall·Syscall9(SB) 24 | 25 | TEXT ·RawSyscall(SB),NOSPLIT,$0-28 26 | JMP syscall·RawSyscall(SB) 27 | 28 | TEXT ·RawSyscall6(SB),NOSPLIT,$0-40 29 | JMP syscall·RawSyscall6(SB) 30 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/asm_openbsd_amd64.s: -------------------------------------------------------------------------------- 1 | // Copyright 2009 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build !gccgo 6 | 7 | #include "textflag.h" 8 | 9 | // 10 | // System call support for AMD64, OpenBSD 11 | // 12 | 13 | // Just jump to package syscall's implementation for all these functions. 14 | // The runtime may know about them. 15 | 16 | TEXT ·Syscall(SB),NOSPLIT,$0-56 17 | JMP syscall·Syscall(SB) 18 | 19 | TEXT ·Syscall6(SB),NOSPLIT,$0-80 20 | JMP syscall·Syscall6(SB) 21 | 22 | TEXT ·Syscall9(SB),NOSPLIT,$0-104 23 | JMP syscall·Syscall9(SB) 24 | 25 | TEXT ·RawSyscall(SB),NOSPLIT,$0-56 26 | JMP syscall·RawSyscall(SB) 27 | 28 | TEXT ·RawSyscall6(SB),NOSPLIT,$0-80 29 | JMP syscall·RawSyscall6(SB) 30 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/asm_openbsd_arm.s: -------------------------------------------------------------------------------- 1 | // Copyright 2017 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build !gccgo 6 | 7 | #include "textflag.h" 8 | 9 | // 10 | // System call support for ARM, OpenBSD 11 | // 12 | 13 | // Just jump to package syscall's implementation for all these functions. 14 | // The runtime may know about them. 15 | 16 | TEXT ·Syscall(SB),NOSPLIT,$0-28 17 | B syscall·Syscall(SB) 18 | 19 | TEXT ·Syscall6(SB),NOSPLIT,$0-40 20 | B syscall·Syscall6(SB) 21 | 22 | TEXT ·Syscall9(SB),NOSPLIT,$0-52 23 | B syscall·Syscall9(SB) 24 | 25 | TEXT ·RawSyscall(SB),NOSPLIT,$0-28 26 | B syscall·RawSyscall(SB) 27 | 28 | TEXT ·RawSyscall6(SB),NOSPLIT,$0-40 29 | B syscall·RawSyscall6(SB) 30 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/asm_openbsd_arm64.s: -------------------------------------------------------------------------------- 1 | // Copyright 2019 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build !gccgo 6 | 7 | #include "textflag.h" 8 | 9 | // 10 | // System call support for arm64, OpenBSD 11 | // 12 | 13 | // Just jump to package syscall's implementation for all these functions. 14 | // The runtime may know about them. 15 | 16 | TEXT ·Syscall(SB),NOSPLIT,$0-56 17 | JMP syscall·Syscall(SB) 18 | 19 | TEXT ·Syscall6(SB),NOSPLIT,$0-80 20 | JMP syscall·Syscall6(SB) 21 | 22 | TEXT ·Syscall9(SB),NOSPLIT,$0-104 23 | JMP syscall·Syscall9(SB) 24 | 25 | TEXT ·RawSyscall(SB),NOSPLIT,$0-56 26 | JMP syscall·RawSyscall(SB) 27 | 28 | TEXT ·RawSyscall6(SB),NOSPLIT,$0-80 29 | JMP syscall·RawSyscall6(SB) 30 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/asm_solaris_amd64.s: -------------------------------------------------------------------------------- 1 | // Copyright 2014 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build !gccgo 6 | 7 | #include "textflag.h" 8 | 9 | // 10 | // System calls for amd64, Solaris are implemented in runtime/syscall_solaris.go 11 | // 12 | 13 | TEXT ·sysvicall6(SB),NOSPLIT,$0-88 14 | JMP syscall·sysvicall6(SB) 15 | 16 | TEXT ·rawSysvicall6(SB),NOSPLIT,$0-88 17 | JMP syscall·rawSysvicall6(SB) 18 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/bluetooth_linux.go: -------------------------------------------------------------------------------- 1 | // Copyright 2016 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // Bluetooth sockets and messages 6 | 7 | package unix 8 | 9 | // Bluetooth Protocols 10 | const ( 11 | BTPROTO_L2CAP = 0 12 | BTPROTO_HCI = 1 13 | BTPROTO_SCO = 2 14 | BTPROTO_RFCOMM = 3 15 | BTPROTO_BNEP = 4 16 | BTPROTO_CMTP = 5 17 | BTPROTO_HIDP = 6 18 | BTPROTO_AVDTP = 7 19 | ) 20 | 21 | const ( 22 | HCI_CHANNEL_RAW = 0 23 | HCI_CHANNEL_USER = 1 24 | HCI_CHANNEL_MONITOR = 2 25 | HCI_CHANNEL_CONTROL = 3 26 | ) 27 | 28 | // Socketoption Level 29 | const ( 30 | SOL_BLUETOOTH = 0x112 31 | SOL_HCI = 0x0 32 | SOL_L2CAP = 0x6 33 | SOL_RFCOMM = 0x12 34 | SOL_SCO = 0x11 35 | ) 36 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/cap_freebsd.go: -------------------------------------------------------------------------------- 1 | // Copyright 2017 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build freebsd 6 | 7 | package unix 8 | 9 | import ( 10 | "errors" 11 | "fmt" 12 | ) 13 | 14 | // Go implementation of C mostly found in /usr/src/sys/kern/subr_capability.c 15 | 16 | const ( 17 | // This is the version of CapRights this package understands. See C implementation for parallels. 18 | capRightsGoVersion = CAP_RIGHTS_VERSION_00 19 | capArSizeMin = CAP_RIGHTS_VERSION_00 + 2 20 | capArSizeMax = capRightsGoVersion + 2 21 | ) 22 | 23 | var ( 24 | bit2idx = []int{ 25 | -1, 0, 1, -1, 2, -1, -1, -1, 3, -1, -1, -1, -1, -1, -1, -1, 26 | 4, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 27 | } 28 | ) 29 | 30 | func capidxbit(right uint64) int { 31 | return int((right >> 57) & 0x1f) 32 | } 33 | 34 | func rightToIndex(right uint64) (int, error) { 35 | idx := capidxbit(right) 36 | if idx < 0 || idx >= len(bit2idx) { 37 | return -2, fmt.Errorf("index for right 0x%x out of range", right) 38 | } 39 | return bit2idx[idx], nil 40 | } 41 | 42 | func caprver(right uint64) int { 43 | return int(right >> 62) 44 | } 45 | 46 | func capver(rights *CapRights) int { 47 | return caprver(rights.Rights[0]) 48 | } 49 | 50 | func caparsize(rights *CapRights) int { 51 | return capver(rights) + 2 52 | } 53 | 54 | // CapRightsSet sets the permissions in setrights in rights. 55 | func CapRightsSet(rights *CapRights, setrights []uint64) error { 56 | // This is essentially a copy of cap_rights_vset() 57 | if capver(rights) != CAP_RIGHTS_VERSION_00 { 58 | return fmt.Errorf("bad rights version %d", capver(rights)) 59 | } 60 | 61 | n := caparsize(rights) 62 | if n < capArSizeMin || n > capArSizeMax { 63 | return errors.New("bad rights size") 64 | } 65 | 66 | for _, right := range setrights { 67 | if caprver(right) != CAP_RIGHTS_VERSION_00 { 68 | return errors.New("bad right version") 69 | } 70 | i, err := rightToIndex(right) 71 | if err != nil { 72 | return err 73 | } 74 | if i >= n { 75 | return errors.New("index overflow") 76 | } 77 | if capidxbit(rights.Rights[i]) != capidxbit(right) { 78 | return errors.New("index mismatch") 79 | } 80 | rights.Rights[i] |= right 81 | if capidxbit(rights.Rights[i]) != capidxbit(right) { 82 | return errors.New("index mismatch (after assign)") 83 | } 84 | } 85 | 86 | return nil 87 | } 88 | 89 | // CapRightsClear clears the permissions in clearrights from rights. 90 | func CapRightsClear(rights *CapRights, clearrights []uint64) error { 91 | // This is essentially a copy of cap_rights_vclear() 92 | if capver(rights) != CAP_RIGHTS_VERSION_00 { 93 | return fmt.Errorf("bad rights version %d", capver(rights)) 94 | } 95 | 96 | n := caparsize(rights) 97 | if n < capArSizeMin || n > capArSizeMax { 98 | return errors.New("bad rights size") 99 | } 100 | 101 | for _, right := range clearrights { 102 | if caprver(right) != CAP_RIGHTS_VERSION_00 { 103 | return errors.New("bad right version") 104 | } 105 | i, err := rightToIndex(right) 106 | if err != nil { 107 | return err 108 | } 109 | if i >= n { 110 | return errors.New("index overflow") 111 | } 112 | if capidxbit(rights.Rights[i]) != capidxbit(right) { 113 | return errors.New("index mismatch") 114 | } 115 | rights.Rights[i] &= ^(right & 0x01FFFFFFFFFFFFFF) 116 | if capidxbit(rights.Rights[i]) != capidxbit(right) { 117 | return errors.New("index mismatch (after assign)") 118 | } 119 | } 120 | 121 | return nil 122 | } 123 | 124 | // CapRightsIsSet checks whether all the permissions in setrights are present in rights. 125 | func CapRightsIsSet(rights *CapRights, setrights []uint64) (bool, error) { 126 | // This is essentially a copy of cap_rights_is_vset() 127 | if capver(rights) != CAP_RIGHTS_VERSION_00 { 128 | return false, fmt.Errorf("bad rights version %d", capver(rights)) 129 | } 130 | 131 | n := caparsize(rights) 132 | if n < capArSizeMin || n > capArSizeMax { 133 | return false, errors.New("bad rights size") 134 | } 135 | 136 | for _, right := range setrights { 137 | if caprver(right) != CAP_RIGHTS_VERSION_00 { 138 | return false, errors.New("bad right version") 139 | } 140 | i, err := rightToIndex(right) 141 | if err != nil { 142 | return false, err 143 | } 144 | if i >= n { 145 | return false, errors.New("index overflow") 146 | } 147 | if capidxbit(rights.Rights[i]) != capidxbit(right) { 148 | return false, errors.New("index mismatch") 149 | } 150 | if (rights.Rights[i] & right) != right { 151 | return false, nil 152 | } 153 | } 154 | 155 | return true, nil 156 | } 157 | 158 | func capright(idx uint64, bit uint64) uint64 { 159 | return ((1 << (57 + idx)) | bit) 160 | } 161 | 162 | // CapRightsInit returns a pointer to an initialised CapRights structure filled with rights. 163 | // See man cap_rights_init(3) and rights(4). 164 | func CapRightsInit(rights []uint64) (*CapRights, error) { 165 | var r CapRights 166 | r.Rights[0] = (capRightsGoVersion << 62) | capright(0, 0) 167 | r.Rights[1] = capright(1, 0) 168 | 169 | err := CapRightsSet(&r, rights) 170 | if err != nil { 171 | return nil, err 172 | } 173 | return &r, nil 174 | } 175 | 176 | // CapRightsLimit reduces the operations permitted on fd to at most those contained in rights. 177 | // The capability rights on fd can never be increased by CapRightsLimit. 178 | // See man cap_rights_limit(2) and rights(4). 179 | func CapRightsLimit(fd uintptr, rights *CapRights) error { 180 | return capRightsLimit(int(fd), rights) 181 | } 182 | 183 | // CapRightsGet returns a CapRights structure containing the operations permitted on fd. 184 | // See man cap_rights_get(3) and rights(4). 185 | func CapRightsGet(fd uintptr) (*CapRights, error) { 186 | r, err := CapRightsInit(nil) 187 | if err != nil { 188 | return nil, err 189 | } 190 | err = capRightsGet(capRightsGoVersion, int(fd), r) 191 | if err != nil { 192 | return nil, err 193 | } 194 | return r, nil 195 | } 196 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/constants.go: -------------------------------------------------------------------------------- 1 | // Copyright 2015 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build aix darwin dragonfly freebsd linux netbsd openbsd solaris 6 | 7 | package unix 8 | 9 | const ( 10 | R_OK = 0x4 11 | W_OK = 0x2 12 | X_OK = 0x1 13 | ) 14 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/dev_aix_ppc.go: -------------------------------------------------------------------------------- 1 | // Copyright 2018 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build aix 6 | // +build ppc 7 | 8 | // Functions to access/create device major and minor numbers matching the 9 | // encoding used by AIX. 10 | 11 | package unix 12 | 13 | // Major returns the major component of a Linux device number. 14 | func Major(dev uint64) uint32 { 15 | return uint32((dev >> 16) & 0xffff) 16 | } 17 | 18 | // Minor returns the minor component of a Linux device number. 19 | func Minor(dev uint64) uint32 { 20 | return uint32(dev & 0xffff) 21 | } 22 | 23 | // Mkdev returns a Linux device number generated from the given major and minor 24 | // components. 25 | func Mkdev(major, minor uint32) uint64 { 26 | return uint64(((major) << 16) | (minor)) 27 | } 28 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/dev_aix_ppc64.go: -------------------------------------------------------------------------------- 1 | // Copyright 2018 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build aix 6 | // +build ppc64 7 | 8 | // Functions to access/create device major and minor numbers matching the 9 | // encoding used AIX. 10 | 11 | package unix 12 | 13 | // Major returns the major component of a Linux device number. 14 | func Major(dev uint64) uint32 { 15 | return uint32((dev & 0x3fffffff00000000) >> 32) 16 | } 17 | 18 | // Minor returns the minor component of a Linux device number. 19 | func Minor(dev uint64) uint32 { 20 | return uint32((dev & 0x00000000ffffffff) >> 0) 21 | } 22 | 23 | // Mkdev returns a Linux device number generated from the given major and minor 24 | // components. 25 | func Mkdev(major, minor uint32) uint64 { 26 | var DEVNO64 uint64 27 | DEVNO64 = 0x8000000000000000 28 | return ((uint64(major) << 32) | (uint64(minor) & 0x00000000FFFFFFFF) | DEVNO64) 29 | } 30 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/dev_darwin.go: -------------------------------------------------------------------------------- 1 | // Copyright 2017 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // Functions to access/create device major and minor numbers matching the 6 | // encoding used in Darwin's sys/types.h header. 7 | 8 | package unix 9 | 10 | // Major returns the major component of a Darwin device number. 11 | func Major(dev uint64) uint32 { 12 | return uint32((dev >> 24) & 0xff) 13 | } 14 | 15 | // Minor returns the minor component of a Darwin device number. 16 | func Minor(dev uint64) uint32 { 17 | return uint32(dev & 0xffffff) 18 | } 19 | 20 | // Mkdev returns a Darwin device number generated from the given major and minor 21 | // components. 22 | func Mkdev(major, minor uint32) uint64 { 23 | return (uint64(major) << 24) | uint64(minor) 24 | } 25 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/dev_dragonfly.go: -------------------------------------------------------------------------------- 1 | // Copyright 2017 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // Functions to access/create device major and minor numbers matching the 6 | // encoding used in Dragonfly's sys/types.h header. 7 | // 8 | // The information below is extracted and adapted from sys/types.h: 9 | // 10 | // Minor gives a cookie instead of an index since in order to avoid changing the 11 | // meanings of bits 0-15 or wasting time and space shifting bits 16-31 for 12 | // devices that don't use them. 13 | 14 | package unix 15 | 16 | // Major returns the major component of a DragonFlyBSD device number. 17 | func Major(dev uint64) uint32 { 18 | return uint32((dev >> 8) & 0xff) 19 | } 20 | 21 | // Minor returns the minor component of a DragonFlyBSD device number. 22 | func Minor(dev uint64) uint32 { 23 | return uint32(dev & 0xffff00ff) 24 | } 25 | 26 | // Mkdev returns a DragonFlyBSD device number generated from the given major and 27 | // minor components. 28 | func Mkdev(major, minor uint32) uint64 { 29 | return (uint64(major) << 8) | uint64(minor) 30 | } 31 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/dev_freebsd.go: -------------------------------------------------------------------------------- 1 | // Copyright 2017 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // Functions to access/create device major and minor numbers matching the 6 | // encoding used in FreeBSD's sys/types.h header. 7 | // 8 | // The information below is extracted and adapted from sys/types.h: 9 | // 10 | // Minor gives a cookie instead of an index since in order to avoid changing the 11 | // meanings of bits 0-15 or wasting time and space shifting bits 16-31 for 12 | // devices that don't use them. 13 | 14 | package unix 15 | 16 | // Major returns the major component of a FreeBSD device number. 17 | func Major(dev uint64) uint32 { 18 | return uint32((dev >> 8) & 0xff) 19 | } 20 | 21 | // Minor returns the minor component of a FreeBSD device number. 22 | func Minor(dev uint64) uint32 { 23 | return uint32(dev & 0xffff00ff) 24 | } 25 | 26 | // Mkdev returns a FreeBSD device number generated from the given major and 27 | // minor components. 28 | func Mkdev(major, minor uint32) uint64 { 29 | return (uint64(major) << 8) | uint64(minor) 30 | } 31 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/dev_linux.go: -------------------------------------------------------------------------------- 1 | // Copyright 2017 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // Functions to access/create device major and minor numbers matching the 6 | // encoding used by the Linux kernel and glibc. 7 | // 8 | // The information below is extracted and adapted from bits/sysmacros.h in the 9 | // glibc sources: 10 | // 11 | // dev_t in glibc is 64-bit, with 32-bit major and minor numbers. glibc's 12 | // default encoding is MMMM Mmmm mmmM MMmm, where M is a hex digit of the major 13 | // number and m is a hex digit of the minor number. This is backward compatible 14 | // with legacy systems where dev_t is 16 bits wide, encoded as MMmm. It is also 15 | // backward compatible with the Linux kernel, which for some architectures uses 16 | // 32-bit dev_t, encoded as mmmM MMmm. 17 | 18 | package unix 19 | 20 | // Major returns the major component of a Linux device number. 21 | func Major(dev uint64) uint32 { 22 | major := uint32((dev & 0x00000000000fff00) >> 8) 23 | major |= uint32((dev & 0xfffff00000000000) >> 32) 24 | return major 25 | } 26 | 27 | // Minor returns the minor component of a Linux device number. 28 | func Minor(dev uint64) uint32 { 29 | minor := uint32((dev & 0x00000000000000ff) >> 0) 30 | minor |= uint32((dev & 0x00000ffffff00000) >> 12) 31 | return minor 32 | } 33 | 34 | // Mkdev returns a Linux device number generated from the given major and minor 35 | // components. 36 | func Mkdev(major, minor uint32) uint64 { 37 | dev := (uint64(major) & 0x00000fff) << 8 38 | dev |= (uint64(major) & 0xfffff000) << 32 39 | dev |= (uint64(minor) & 0x000000ff) << 0 40 | dev |= (uint64(minor) & 0xffffff00) << 12 41 | return dev 42 | } 43 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/dev_netbsd.go: -------------------------------------------------------------------------------- 1 | // Copyright 2017 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // Functions to access/create device major and minor numbers matching the 6 | // encoding used in NetBSD's sys/types.h header. 7 | 8 | package unix 9 | 10 | // Major returns the major component of a NetBSD device number. 11 | func Major(dev uint64) uint32 { 12 | return uint32((dev & 0x000fff00) >> 8) 13 | } 14 | 15 | // Minor returns the minor component of a NetBSD device number. 16 | func Minor(dev uint64) uint32 { 17 | minor := uint32((dev & 0x000000ff) >> 0) 18 | minor |= uint32((dev & 0xfff00000) >> 12) 19 | return minor 20 | } 21 | 22 | // Mkdev returns a NetBSD device number generated from the given major and minor 23 | // components. 24 | func Mkdev(major, minor uint32) uint64 { 25 | dev := (uint64(major) << 8) & 0x000fff00 26 | dev |= (uint64(minor) << 12) & 0xfff00000 27 | dev |= (uint64(minor) << 0) & 0x000000ff 28 | return dev 29 | } 30 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/dev_openbsd.go: -------------------------------------------------------------------------------- 1 | // Copyright 2017 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // Functions to access/create device major and minor numbers matching the 6 | // encoding used in OpenBSD's sys/types.h header. 7 | 8 | package unix 9 | 10 | // Major returns the major component of an OpenBSD device number. 11 | func Major(dev uint64) uint32 { 12 | return uint32((dev & 0x0000ff00) >> 8) 13 | } 14 | 15 | // Minor returns the minor component of an OpenBSD device number. 16 | func Minor(dev uint64) uint32 { 17 | minor := uint32((dev & 0x000000ff) >> 0) 18 | minor |= uint32((dev & 0xffff0000) >> 8) 19 | return minor 20 | } 21 | 22 | // Mkdev returns an OpenBSD device number generated from the given major and minor 23 | // components. 24 | func Mkdev(major, minor uint32) uint64 { 25 | dev := (uint64(major) << 8) & 0x0000ff00 26 | dev |= (uint64(minor) << 8) & 0xffff0000 27 | dev |= (uint64(minor) << 0) & 0x000000ff 28 | return dev 29 | } 30 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/dirent.go: -------------------------------------------------------------------------------- 1 | // Copyright 2009 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build aix darwin dragonfly freebsd linux nacl netbsd openbsd solaris 6 | 7 | package unix 8 | 9 | import "syscall" 10 | 11 | // ParseDirent parses up to max directory entries in buf, 12 | // appending the names to names. It returns the number of 13 | // bytes consumed from buf, the number of entries added 14 | // to names, and the new names slice. 15 | func ParseDirent(buf []byte, max int, names []string) (consumed int, count int, newnames []string) { 16 | return syscall.ParseDirent(buf, max, names) 17 | } 18 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/endian_big.go: -------------------------------------------------------------------------------- 1 | // Copyright 2016 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | // 5 | // +build ppc64 s390x mips mips64 6 | 7 | package unix 8 | 9 | const isBigEndian = true 10 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/endian_little.go: -------------------------------------------------------------------------------- 1 | // Copyright 2016 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | // 5 | // +build 386 amd64 amd64p32 arm arm64 ppc64le mipsle mips64le 6 | 7 | package unix 8 | 9 | const isBigEndian = false 10 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/env_unix.go: -------------------------------------------------------------------------------- 1 | // Copyright 2010 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build aix darwin dragonfly freebsd linux netbsd openbsd solaris 6 | 7 | // Unix environment variables. 8 | 9 | package unix 10 | 11 | import "syscall" 12 | 13 | func Getenv(key string) (value string, found bool) { 14 | return syscall.Getenv(key) 15 | } 16 | 17 | func Setenv(key, value string) error { 18 | return syscall.Setenv(key, value) 19 | } 20 | 21 | func Clearenv() { 22 | syscall.Clearenv() 23 | } 24 | 25 | func Environ() []string { 26 | return syscall.Environ() 27 | } 28 | 29 | func Unsetenv(key string) error { 30 | return syscall.Unsetenv(key) 31 | } 32 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/fcntl.go: -------------------------------------------------------------------------------- 1 | // Copyright 2014 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build dragonfly freebsd linux netbsd openbsd 6 | 7 | package unix 8 | 9 | import "unsafe" 10 | 11 | // fcntl64Syscall is usually SYS_FCNTL, but is overridden on 32-bit Linux 12 | // systems by flock_linux_32bit.go to be SYS_FCNTL64. 13 | var fcntl64Syscall uintptr = SYS_FCNTL 14 | 15 | // FcntlInt performs a fcntl syscall on fd with the provided command and argument. 16 | func FcntlInt(fd uintptr, cmd, arg int) (int, error) { 17 | valptr, _, errno := Syscall(fcntl64Syscall, fd, uintptr(cmd), uintptr(arg)) 18 | var err error 19 | if errno != 0 { 20 | err = errno 21 | } 22 | return int(valptr), err 23 | } 24 | 25 | // FcntlFlock performs a fcntl syscall for the F_GETLK, F_SETLK or F_SETLKW command. 26 | func FcntlFlock(fd uintptr, cmd int, lk *Flock_t) error { 27 | _, _, errno := Syscall(fcntl64Syscall, fd, uintptr(cmd), uintptr(unsafe.Pointer(lk))) 28 | if errno == 0 { 29 | return nil 30 | } 31 | return errno 32 | } 33 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/fcntl_darwin.go: -------------------------------------------------------------------------------- 1 | // Copyright 2019 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | package unix 6 | 7 | import "unsafe" 8 | 9 | // FcntlInt performs a fcntl syscall on fd with the provided command and argument. 10 | func FcntlInt(fd uintptr, cmd, arg int) (int, error) { 11 | return fcntl(int(fd), cmd, arg) 12 | } 13 | 14 | // FcntlFlock performs a fcntl syscall for the F_GETLK, F_SETLK or F_SETLKW command. 15 | func FcntlFlock(fd uintptr, cmd int, lk *Flock_t) error { 16 | _, err := fcntl(int(fd), cmd, int(uintptr(unsafe.Pointer(lk)))) 17 | return err 18 | } 19 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/fcntl_linux_32bit.go: -------------------------------------------------------------------------------- 1 | // +build linux,386 linux,arm linux,mips linux,mipsle 2 | 3 | // Copyright 2014 The Go Authors. All rights reserved. 4 | // Use of this source code is governed by a BSD-style 5 | // license that can be found in the LICENSE file. 6 | 7 | package unix 8 | 9 | func init() { 10 | // On 32-bit Linux systems, the fcntl syscall that matches Go's 11 | // Flock_t type is SYS_FCNTL64, not SYS_FCNTL. 12 | fcntl64Syscall = SYS_FCNTL64 13 | } 14 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/gccgo.go: -------------------------------------------------------------------------------- 1 | // Copyright 2015 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build gccgo 6 | // +build !aix 7 | 8 | package unix 9 | 10 | import "syscall" 11 | 12 | // We can't use the gc-syntax .s files for gccgo. On the plus side 13 | // much of the functionality can be written directly in Go. 14 | 15 | //extern gccgoRealSyscallNoError 16 | func realSyscallNoError(trap, a1, a2, a3, a4, a5, a6, a7, a8, a9 uintptr) (r uintptr) 17 | 18 | //extern gccgoRealSyscall 19 | func realSyscall(trap, a1, a2, a3, a4, a5, a6, a7, a8, a9 uintptr) (r, errno uintptr) 20 | 21 | func SyscallNoError(trap, a1, a2, a3 uintptr) (r1, r2 uintptr) { 22 | syscall.Entersyscall() 23 | r := realSyscallNoError(trap, a1, a2, a3, 0, 0, 0, 0, 0, 0) 24 | syscall.Exitsyscall() 25 | return r, 0 26 | } 27 | 28 | func Syscall(trap, a1, a2, a3 uintptr) (r1, r2 uintptr, err syscall.Errno) { 29 | syscall.Entersyscall() 30 | r, errno := realSyscall(trap, a1, a2, a3, 0, 0, 0, 0, 0, 0) 31 | syscall.Exitsyscall() 32 | return r, 0, syscall.Errno(errno) 33 | } 34 | 35 | func Syscall6(trap, a1, a2, a3, a4, a5, a6 uintptr) (r1, r2 uintptr, err syscall.Errno) { 36 | syscall.Entersyscall() 37 | r, errno := realSyscall(trap, a1, a2, a3, a4, a5, a6, 0, 0, 0) 38 | syscall.Exitsyscall() 39 | return r, 0, syscall.Errno(errno) 40 | } 41 | 42 | func Syscall9(trap, a1, a2, a3, a4, a5, a6, a7, a8, a9 uintptr) (r1, r2 uintptr, err syscall.Errno) { 43 | syscall.Entersyscall() 44 | r, errno := realSyscall(trap, a1, a2, a3, a4, a5, a6, a7, a8, a9) 45 | syscall.Exitsyscall() 46 | return r, 0, syscall.Errno(errno) 47 | } 48 | 49 | func RawSyscallNoError(trap, a1, a2, a3 uintptr) (r1, r2 uintptr) { 50 | r := realSyscallNoError(trap, a1, a2, a3, 0, 0, 0, 0, 0, 0) 51 | return r, 0 52 | } 53 | 54 | func RawSyscall(trap, a1, a2, a3 uintptr) (r1, r2 uintptr, err syscall.Errno) { 55 | r, errno := realSyscall(trap, a1, a2, a3, 0, 0, 0, 0, 0, 0) 56 | return r, 0, syscall.Errno(errno) 57 | } 58 | 59 | func RawSyscall6(trap, a1, a2, a3, a4, a5, a6 uintptr) (r1, r2 uintptr, err syscall.Errno) { 60 | r, errno := realSyscall(trap, a1, a2, a3, a4, a5, a6, 0, 0, 0) 61 | return r, 0, syscall.Errno(errno) 62 | } 63 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/gccgo_c.c: -------------------------------------------------------------------------------- 1 | // Copyright 2015 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build gccgo 6 | // +build !aix 7 | 8 | #include 9 | #include 10 | #include 11 | 12 | #define _STRINGIFY2_(x) #x 13 | #define _STRINGIFY_(x) _STRINGIFY2_(x) 14 | #define GOSYM_PREFIX _STRINGIFY_(__USER_LABEL_PREFIX__) 15 | 16 | // Call syscall from C code because the gccgo support for calling from 17 | // Go to C does not support varargs functions. 18 | 19 | struct ret { 20 | uintptr_t r; 21 | uintptr_t err; 22 | }; 23 | 24 | struct ret 25 | gccgoRealSyscall(uintptr_t trap, uintptr_t a1, uintptr_t a2, uintptr_t a3, uintptr_t a4, uintptr_t a5, uintptr_t a6, uintptr_t a7, uintptr_t a8, uintptr_t a9) 26 | { 27 | struct ret r; 28 | 29 | errno = 0; 30 | r.r = syscall(trap, a1, a2, a3, a4, a5, a6, a7, a8, a9); 31 | r.err = errno; 32 | return r; 33 | } 34 | 35 | uintptr_t 36 | gccgoRealSyscallNoError(uintptr_t trap, uintptr_t a1, uintptr_t a2, uintptr_t a3, uintptr_t a4, uintptr_t a5, uintptr_t a6, uintptr_t a7, uintptr_t a8, uintptr_t a9) 37 | { 38 | return syscall(trap, a1, a2, a3, a4, a5, a6, a7, a8, a9); 39 | } 40 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/gccgo_linux_amd64.go: -------------------------------------------------------------------------------- 1 | // Copyright 2015 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build gccgo,linux,amd64 6 | 7 | package unix 8 | 9 | import "syscall" 10 | 11 | //extern gettimeofday 12 | func realGettimeofday(*Timeval, *byte) int32 13 | 14 | func gettimeofday(tv *Timeval) (err syscall.Errno) { 15 | r := realGettimeofday(tv, nil) 16 | if r < 0 { 17 | return syscall.GetErrno() 18 | } 19 | return 0 20 | } 21 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/ioctl.go: -------------------------------------------------------------------------------- 1 | // Copyright 2018 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build aix darwin dragonfly freebsd linux netbsd openbsd solaris 6 | 7 | package unix 8 | 9 | import "runtime" 10 | 11 | // IoctlSetWinsize performs an ioctl on fd with a *Winsize argument. 12 | // 13 | // To change fd's window size, the req argument should be TIOCSWINSZ. 14 | func IoctlSetWinsize(fd int, req uint, value *Winsize) error { 15 | // TODO: if we get the chance, remove the req parameter and 16 | // hardcode TIOCSWINSZ. 17 | err := ioctlSetWinsize(fd, req, value) 18 | runtime.KeepAlive(value) 19 | return err 20 | } 21 | 22 | // IoctlSetTermios performs an ioctl on fd with a *Termios. 23 | // 24 | // The req value will usually be TCSETA or TIOCSETA. 25 | func IoctlSetTermios(fd int, req uint, value *Termios) error { 26 | // TODO: if we get the chance, remove the req parameter. 27 | err := ioctlSetTermios(fd, req, value) 28 | runtime.KeepAlive(value) 29 | return err 30 | } 31 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/mkasm_darwin.go: -------------------------------------------------------------------------------- 1 | // Copyright 2018 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build ignore 6 | 7 | // mkasm_darwin.go generates assembly trampolines to call libSystem routines from Go. 8 | //This program must be run after mksyscall.go. 9 | package main 10 | 11 | import ( 12 | "bytes" 13 | "fmt" 14 | "io/ioutil" 15 | "log" 16 | "os" 17 | "strings" 18 | ) 19 | 20 | func main() { 21 | in1, err := ioutil.ReadFile("syscall_darwin.go") 22 | if err != nil { 23 | log.Fatalf("can't open syscall_darwin.go: %s", err) 24 | } 25 | arch := os.Args[1] 26 | in2, err := ioutil.ReadFile(fmt.Sprintf("syscall_darwin_%s.go", arch)) 27 | if err != nil { 28 | log.Fatalf("can't open syscall_darwin_%s.go: %s", arch, err) 29 | } 30 | in3, err := ioutil.ReadFile(fmt.Sprintf("zsyscall_darwin_%s.go", arch)) 31 | if err != nil { 32 | log.Fatalf("can't open zsyscall_darwin_%s.go: %s", arch, err) 33 | } 34 | in := string(in1) + string(in2) + string(in3) 35 | 36 | trampolines := map[string]bool{} 37 | 38 | var out bytes.Buffer 39 | 40 | fmt.Fprintf(&out, "// go run mkasm_darwin.go %s\n", strings.Join(os.Args[1:], " ")) 41 | fmt.Fprintf(&out, "// Code generated by the command above; DO NOT EDIT.\n") 42 | fmt.Fprintf(&out, "\n") 43 | fmt.Fprintf(&out, "// +build go1.12\n") 44 | fmt.Fprintf(&out, "\n") 45 | fmt.Fprintf(&out, "#include \"textflag.h\"\n") 46 | for _, line := range strings.Split(in, "\n") { 47 | if !strings.HasPrefix(line, "func ") || !strings.HasSuffix(line, "_trampoline()") { 48 | continue 49 | } 50 | fn := line[5 : len(line)-13] 51 | if !trampolines[fn] { 52 | trampolines[fn] = true 53 | fmt.Fprintf(&out, "TEXT ·%s_trampoline(SB),NOSPLIT,$0-0\n", fn) 54 | fmt.Fprintf(&out, "\tJMP\t%s(SB)\n", fn) 55 | } 56 | } 57 | err = ioutil.WriteFile(fmt.Sprintf("zsyscall_darwin_%s.s", arch), out.Bytes(), 0644) 58 | if err != nil { 59 | log.Fatalf("can't write zsyscall_darwin_%s.s: %s", arch, err) 60 | } 61 | } 62 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/mkpost.go: -------------------------------------------------------------------------------- 1 | // Copyright 2016 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build ignore 6 | 7 | // mkpost processes the output of cgo -godefs to 8 | // modify the generated types. It is used to clean up 9 | // the sys API in an architecture specific manner. 10 | // 11 | // mkpost is run after cgo -godefs; see README.md. 12 | package main 13 | 14 | import ( 15 | "bytes" 16 | "fmt" 17 | "go/format" 18 | "io/ioutil" 19 | "log" 20 | "os" 21 | "regexp" 22 | ) 23 | 24 | func main() { 25 | // Get the OS and architecture (using GOARCH_TARGET if it exists) 26 | goos := os.Getenv("GOOS") 27 | goarch := os.Getenv("GOARCH_TARGET") 28 | if goarch == "" { 29 | goarch = os.Getenv("GOARCH") 30 | } 31 | // Check that we are using the Docker-based build system if we should be. 32 | if goos == "linux" { 33 | if os.Getenv("GOLANG_SYS_BUILD") != "docker" { 34 | os.Stderr.WriteString("In the Docker-based build system, mkpost should not be called directly.\n") 35 | os.Stderr.WriteString("See README.md\n") 36 | os.Exit(1) 37 | } 38 | } 39 | 40 | b, err := ioutil.ReadAll(os.Stdin) 41 | if err != nil { 42 | log.Fatal(err) 43 | } 44 | 45 | if goos == "aix" { 46 | // Replace type of Atim, Mtim and Ctim by Timespec in Stat_t 47 | // to avoid having both StTimespec and Timespec. 48 | sttimespec := regexp.MustCompile(`_Ctype_struct_st_timespec`) 49 | b = sttimespec.ReplaceAll(b, []byte("Timespec")) 50 | } 51 | 52 | // Intentionally export __val fields in Fsid and Sigset_t 53 | valRegex := regexp.MustCompile(`type (Fsid|Sigset_t) struct {(\s+)X__(bits|val)(\s+\S+\s+)}`) 54 | b = valRegex.ReplaceAll(b, []byte("type $1 struct {${2}Val$4}")) 55 | 56 | // Intentionally export __fds_bits field in FdSet 57 | fdSetRegex := regexp.MustCompile(`type (FdSet) struct {(\s+)X__fds_bits(\s+\S+\s+)}`) 58 | b = fdSetRegex.ReplaceAll(b, []byte("type $1 struct {${2}Bits$3}")) 59 | 60 | // If we have empty Ptrace structs, we should delete them. Only s390x emits 61 | // nonempty Ptrace structs. 62 | ptraceRexexp := regexp.MustCompile(`type Ptrace((Psw|Fpregs|Per) struct {\s*})`) 63 | b = ptraceRexexp.ReplaceAll(b, nil) 64 | 65 | // Replace the control_regs union with a blank identifier for now. 66 | controlRegsRegex := regexp.MustCompile(`(Control_regs)\s+\[0\]uint64`) 67 | b = controlRegsRegex.ReplaceAll(b, []byte("_ [0]uint64")) 68 | 69 | // Remove fields that are added by glibc 70 | // Note that this is unstable as the identifers are private. 71 | removeFieldsRegex := regexp.MustCompile(`X__glibc\S*`) 72 | b = removeFieldsRegex.ReplaceAll(b, []byte("_")) 73 | 74 | // Convert [65]int8 to [65]byte in Utsname members to simplify 75 | // conversion to string; see golang.org/issue/20753 76 | convertUtsnameRegex := regexp.MustCompile(`((Sys|Node|Domain)name|Release|Version|Machine)(\s+)\[(\d+)\]u?int8`) 77 | b = convertUtsnameRegex.ReplaceAll(b, []byte("$1$3[$4]byte")) 78 | 79 | // Convert [1024]int8 to [1024]byte in Ptmget members 80 | convertPtmget := regexp.MustCompile(`([SC]n)(\s+)\[(\d+)\]u?int8`) 81 | b = convertPtmget.ReplaceAll(b, []byte("$1[$3]byte")) 82 | 83 | // Remove spare fields (e.g. in Statx_t) 84 | spareFieldsRegex := regexp.MustCompile(`X__spare\S*`) 85 | b = spareFieldsRegex.ReplaceAll(b, []byte("_")) 86 | 87 | // Remove cgo padding fields 88 | removePaddingFieldsRegex := regexp.MustCompile(`Pad_cgo_\d+`) 89 | b = removePaddingFieldsRegex.ReplaceAll(b, []byte("_")) 90 | 91 | // Remove padding, hidden, or unused fields 92 | removeFieldsRegex = regexp.MustCompile(`\b(X_\S+|Padding)`) 93 | b = removeFieldsRegex.ReplaceAll(b, []byte("_")) 94 | 95 | // Remove the first line of warning from cgo 96 | b = b[bytes.IndexByte(b, '\n')+1:] 97 | // Modify the command in the header to include: 98 | // mkpost, our own warning, and a build tag. 99 | replacement := fmt.Sprintf(`$1 | go run mkpost.go 100 | // Code generated by the command above; see README.md. DO NOT EDIT. 101 | 102 | // +build %s,%s`, goarch, goos) 103 | cgoCommandRegex := regexp.MustCompile(`(cgo -godefs .*)`) 104 | b = cgoCommandRegex.ReplaceAll(b, []byte(replacement)) 105 | 106 | // Rename Stat_t time fields 107 | if goos == "freebsd" && goarch == "386" { 108 | // Hide Stat_t.[AMCB]tim_ext fields 109 | renameStatTimeExtFieldsRegex := regexp.MustCompile(`[AMCB]tim_ext`) 110 | b = renameStatTimeExtFieldsRegex.ReplaceAll(b, []byte("_")) 111 | } 112 | renameStatTimeFieldsRegex := regexp.MustCompile(`([AMCB])(?:irth)?time?(?:spec)?\s+(Timespec|StTimespec)`) 113 | b = renameStatTimeFieldsRegex.ReplaceAll(b, []byte("${1}tim ${2}")) 114 | 115 | // gofmt 116 | b, err = format.Source(b) 117 | if err != nil { 118 | log.Fatal(err) 119 | } 120 | 121 | os.Stdout.Write(b) 122 | } 123 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/mksysnum.go: -------------------------------------------------------------------------------- 1 | // Copyright 2018 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build ignore 6 | 7 | // Generate system call table for DragonFly, NetBSD, 8 | // FreeBSD, OpenBSD or Darwin from master list 9 | // (for example, /usr/src/sys/kern/syscalls.master or 10 | // sys/syscall.h). 11 | package main 12 | 13 | import ( 14 | "bufio" 15 | "fmt" 16 | "io" 17 | "io/ioutil" 18 | "net/http" 19 | "os" 20 | "regexp" 21 | "strings" 22 | ) 23 | 24 | var ( 25 | goos, goarch string 26 | ) 27 | 28 | // cmdLine returns this programs's commandline arguments 29 | func cmdLine() string { 30 | return "go run mksysnum.go " + strings.Join(os.Args[1:], " ") 31 | } 32 | 33 | // buildTags returns build tags 34 | func buildTags() string { 35 | return fmt.Sprintf("%s,%s", goarch, goos) 36 | } 37 | 38 | func checkErr(err error) { 39 | if err != nil { 40 | fmt.Fprintf(os.Stderr, "%v\n", err) 41 | os.Exit(1) 42 | } 43 | } 44 | 45 | // source string and substring slice for regexp 46 | type re struct { 47 | str string // source string 48 | sub []string // matched sub-string 49 | } 50 | 51 | // Match performs regular expression match 52 | func (r *re) Match(exp string) bool { 53 | r.sub = regexp.MustCompile(exp).FindStringSubmatch(r.str) 54 | if r.sub != nil { 55 | return true 56 | } 57 | return false 58 | } 59 | 60 | // fetchFile fetches a text file from URL 61 | func fetchFile(URL string) io.Reader { 62 | resp, err := http.Get(URL) 63 | checkErr(err) 64 | defer resp.Body.Close() 65 | body, err := ioutil.ReadAll(resp.Body) 66 | checkErr(err) 67 | return strings.NewReader(string(body)) 68 | } 69 | 70 | // readFile reads a text file from path 71 | func readFile(path string) io.Reader { 72 | file, err := os.Open(os.Args[1]) 73 | checkErr(err) 74 | return file 75 | } 76 | 77 | func format(name, num, proto string) string { 78 | name = strings.ToUpper(name) 79 | // There are multiple entries for enosys and nosys, so comment them out. 80 | nm := re{str: name} 81 | if nm.Match(`^SYS_E?NOSYS$`) { 82 | name = fmt.Sprintf("// %s", name) 83 | } 84 | if name == `SYS_SYS_EXIT` { 85 | name = `SYS_EXIT` 86 | } 87 | return fmt.Sprintf(" %s = %s; // %s\n", name, num, proto) 88 | } 89 | 90 | func main() { 91 | // Get the OS (using GOOS_TARGET if it exist) 92 | goos = os.Getenv("GOOS_TARGET") 93 | if goos == "" { 94 | goos = os.Getenv("GOOS") 95 | } 96 | // Get the architecture (using GOARCH_TARGET if it exists) 97 | goarch = os.Getenv("GOARCH_TARGET") 98 | if goarch == "" { 99 | goarch = os.Getenv("GOARCH") 100 | } 101 | // Check if GOOS and GOARCH environment variables are defined 102 | if goarch == "" || goos == "" { 103 | fmt.Fprintf(os.Stderr, "GOARCH or GOOS not defined in environment\n") 104 | os.Exit(1) 105 | } 106 | 107 | file := strings.TrimSpace(os.Args[1]) 108 | var syscalls io.Reader 109 | if strings.HasPrefix(file, "https://") || strings.HasPrefix(file, "http://") { 110 | // Download syscalls.master file 111 | syscalls = fetchFile(file) 112 | } else { 113 | syscalls = readFile(file) 114 | } 115 | 116 | var text, line string 117 | s := bufio.NewScanner(syscalls) 118 | for s.Scan() { 119 | t := re{str: line} 120 | if t.Match(`^(.*)\\$`) { 121 | // Handle continuation 122 | line = t.sub[1] 123 | line += strings.TrimLeft(s.Text(), " \t") 124 | } else { 125 | // New line 126 | line = s.Text() 127 | } 128 | t = re{str: line} 129 | if t.Match(`\\$`) { 130 | continue 131 | } 132 | t = re{str: line} 133 | 134 | switch goos { 135 | case "dragonfly": 136 | if t.Match(`^([0-9]+)\s+STD\s+({ \S+\s+(\w+).*)$`) { 137 | num, proto := t.sub[1], t.sub[2] 138 | name := fmt.Sprintf("SYS_%s", t.sub[3]) 139 | text += format(name, num, proto) 140 | } 141 | case "freebsd": 142 | if t.Match(`^([0-9]+)\s+\S+\s+(?:(?:NO)?STD|COMPAT10)\s+({ \S+\s+(\w+).*)$`) { 143 | num, proto := t.sub[1], t.sub[2] 144 | name := fmt.Sprintf("SYS_%s", t.sub[3]) 145 | text += format(name, num, proto) 146 | } 147 | case "openbsd": 148 | if t.Match(`^([0-9]+)\s+STD\s+(NOLOCK\s+)?({ \S+\s+\*?(\w+).*)$`) { 149 | num, proto, name := t.sub[1], t.sub[3], t.sub[4] 150 | text += format(name, num, proto) 151 | } 152 | case "netbsd": 153 | if t.Match(`^([0-9]+)\s+((STD)|(NOERR))\s+(RUMP\s+)?({\s+\S+\s*\*?\s*\|(\S+)\|(\S*)\|(\w+).*\s+})(\s+(\S+))?$`) { 154 | num, proto, compat := t.sub[1], t.sub[6], t.sub[8] 155 | name := t.sub[7] + "_" + t.sub[9] 156 | if t.sub[11] != "" { 157 | name = t.sub[7] + "_" + t.sub[11] 158 | } 159 | name = strings.ToUpper(name) 160 | if compat == "" || compat == "13" || compat == "30" || compat == "50" { 161 | text += fmt.Sprintf(" %s = %s; // %s\n", name, num, proto) 162 | } 163 | } 164 | case "darwin": 165 | if t.Match(`^#define\s+SYS_(\w+)\s+([0-9]+)`) { 166 | name, num := t.sub[1], t.sub[2] 167 | name = strings.ToUpper(name) 168 | text += fmt.Sprintf(" SYS_%s = %s;\n", name, num) 169 | } 170 | default: 171 | fmt.Fprintf(os.Stderr, "unrecognized GOOS=%s\n", goos) 172 | os.Exit(1) 173 | 174 | } 175 | } 176 | err := s.Err() 177 | checkErr(err) 178 | 179 | fmt.Printf(template, cmdLine(), buildTags(), text) 180 | } 181 | 182 | const template = `// %s 183 | // Code generated by the command above; see README.md. DO NOT EDIT. 184 | 185 | // +build %s 186 | 187 | package unix 188 | 189 | const( 190 | %s)` 191 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/pagesize_unix.go: -------------------------------------------------------------------------------- 1 | // Copyright 2017 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build aix darwin dragonfly freebsd linux netbsd openbsd solaris 6 | 7 | // For Unix, get the pagesize from the runtime. 8 | 9 | package unix 10 | 11 | import "syscall" 12 | 13 | func Getpagesize() int { 14 | return syscall.Getpagesize() 15 | } 16 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/pledge_openbsd.go: -------------------------------------------------------------------------------- 1 | // Copyright 2016 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | package unix 6 | 7 | import ( 8 | "errors" 9 | "fmt" 10 | "strconv" 11 | "syscall" 12 | "unsafe" 13 | ) 14 | 15 | // Pledge implements the pledge syscall. 16 | // 17 | // The pledge syscall does not accept execpromises on OpenBSD releases 18 | // before 6.3. 19 | // 20 | // execpromises must be empty when Pledge is called on OpenBSD 21 | // releases predating 6.3, otherwise an error will be returned. 22 | // 23 | // For more information see pledge(2). 24 | func Pledge(promises, execpromises string) error { 25 | maj, min, err := majmin() 26 | if err != nil { 27 | return err 28 | } 29 | 30 | err = pledgeAvailable(maj, min, execpromises) 31 | if err != nil { 32 | return err 33 | } 34 | 35 | pptr, err := syscall.BytePtrFromString(promises) 36 | if err != nil { 37 | return err 38 | } 39 | 40 | // This variable will hold either a nil unsafe.Pointer or 41 | // an unsafe.Pointer to a string (execpromises). 42 | var expr unsafe.Pointer 43 | 44 | // If we're running on OpenBSD > 6.2, pass execpromises to the syscall. 45 | if maj > 6 || (maj == 6 && min > 2) { 46 | exptr, err := syscall.BytePtrFromString(execpromises) 47 | if err != nil { 48 | return err 49 | } 50 | expr = unsafe.Pointer(exptr) 51 | } 52 | 53 | _, _, e := syscall.Syscall(SYS_PLEDGE, uintptr(unsafe.Pointer(pptr)), uintptr(expr), 0) 54 | if e != 0 { 55 | return e 56 | } 57 | 58 | return nil 59 | } 60 | 61 | // PledgePromises implements the pledge syscall. 62 | // 63 | // This changes the promises and leaves the execpromises untouched. 64 | // 65 | // For more information see pledge(2). 66 | func PledgePromises(promises string) error { 67 | maj, min, err := majmin() 68 | if err != nil { 69 | return err 70 | } 71 | 72 | err = pledgeAvailable(maj, min, "") 73 | if err != nil { 74 | return err 75 | } 76 | 77 | // This variable holds the execpromises and is always nil. 78 | var expr unsafe.Pointer 79 | 80 | pptr, err := syscall.BytePtrFromString(promises) 81 | if err != nil { 82 | return err 83 | } 84 | 85 | _, _, e := syscall.Syscall(SYS_PLEDGE, uintptr(unsafe.Pointer(pptr)), uintptr(expr), 0) 86 | if e != 0 { 87 | return e 88 | } 89 | 90 | return nil 91 | } 92 | 93 | // PledgeExecpromises implements the pledge syscall. 94 | // 95 | // This changes the execpromises and leaves the promises untouched. 96 | // 97 | // For more information see pledge(2). 98 | func PledgeExecpromises(execpromises string) error { 99 | maj, min, err := majmin() 100 | if err != nil { 101 | return err 102 | } 103 | 104 | err = pledgeAvailable(maj, min, execpromises) 105 | if err != nil { 106 | return err 107 | } 108 | 109 | // This variable holds the promises and is always nil. 110 | var pptr unsafe.Pointer 111 | 112 | exptr, err := syscall.BytePtrFromString(execpromises) 113 | if err != nil { 114 | return err 115 | } 116 | 117 | _, _, e := syscall.Syscall(SYS_PLEDGE, uintptr(pptr), uintptr(unsafe.Pointer(exptr)), 0) 118 | if e != 0 { 119 | return e 120 | } 121 | 122 | return nil 123 | } 124 | 125 | // majmin returns major and minor version number for an OpenBSD system. 126 | func majmin() (major int, minor int, err error) { 127 | var v Utsname 128 | err = Uname(&v) 129 | if err != nil { 130 | return 131 | } 132 | 133 | major, err = strconv.Atoi(string(v.Release[0])) 134 | if err != nil { 135 | err = errors.New("cannot parse major version number returned by uname") 136 | return 137 | } 138 | 139 | minor, err = strconv.Atoi(string(v.Release[2])) 140 | if err != nil { 141 | err = errors.New("cannot parse minor version number returned by uname") 142 | return 143 | } 144 | 145 | return 146 | } 147 | 148 | // pledgeAvailable checks for availability of the pledge(2) syscall 149 | // based on the running OpenBSD version. 150 | func pledgeAvailable(maj, min int, execpromises string) error { 151 | // If OpenBSD <= 5.9, pledge is not available. 152 | if (maj == 5 && min != 9) || maj < 5 { 153 | return fmt.Errorf("pledge syscall is not available on OpenBSD %d.%d", maj, min) 154 | } 155 | 156 | // If OpenBSD <= 6.2 and execpromises is not empty, 157 | // return an error - execpromises is not available before 6.3 158 | if (maj < 6 || (maj == 6 && min <= 2)) && execpromises != "" { 159 | return fmt.Errorf("cannot use execpromises on OpenBSD %d.%d", maj, min) 160 | } 161 | 162 | return nil 163 | } 164 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/race.go: -------------------------------------------------------------------------------- 1 | // Copyright 2012 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build darwin,race linux,race freebsd,race 6 | 7 | package unix 8 | 9 | import ( 10 | "runtime" 11 | "unsafe" 12 | ) 13 | 14 | const raceenabled = true 15 | 16 | func raceAcquire(addr unsafe.Pointer) { 17 | runtime.RaceAcquire(addr) 18 | } 19 | 20 | func raceReleaseMerge(addr unsafe.Pointer) { 21 | runtime.RaceReleaseMerge(addr) 22 | } 23 | 24 | func raceReadRange(addr unsafe.Pointer, len int) { 25 | runtime.RaceReadRange(addr, len) 26 | } 27 | 28 | func raceWriteRange(addr unsafe.Pointer, len int) { 29 | runtime.RaceWriteRange(addr, len) 30 | } 31 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/race0.go: -------------------------------------------------------------------------------- 1 | // Copyright 2012 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build aix darwin,!race linux,!race freebsd,!race netbsd openbsd solaris dragonfly 6 | 7 | package unix 8 | 9 | import ( 10 | "unsafe" 11 | ) 12 | 13 | const raceenabled = false 14 | 15 | func raceAcquire(addr unsafe.Pointer) { 16 | } 17 | 18 | func raceReleaseMerge(addr unsafe.Pointer) { 19 | } 20 | 21 | func raceReadRange(addr unsafe.Pointer, len int) { 22 | } 23 | 24 | func raceWriteRange(addr unsafe.Pointer, len int) { 25 | } 26 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/readdirent_getdents.go: -------------------------------------------------------------------------------- 1 | // Copyright 2019 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build aix freebsd linux netbsd openbsd 6 | 7 | package unix 8 | 9 | // ReadDirent reads directory entries from fd and writes them into buf. 10 | func ReadDirent(fd int, buf []byte) (n int, err error) { 11 | return Getdents(fd, buf) 12 | } 13 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/readdirent_getdirentries.go: -------------------------------------------------------------------------------- 1 | // Copyright 2019 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build darwin dragonfly 6 | 7 | package unix 8 | 9 | import "unsafe" 10 | 11 | // ReadDirent reads directory entries from fd and writes them into buf. 12 | func ReadDirent(fd int, buf []byte) (n int, err error) { 13 | // Final argument is (basep *uintptr) and the syscall doesn't take nil. 14 | // 64 bits should be enough. (32 bits isn't even on 386). Since the 15 | // actual system call is getdirentries64, 64 is a good guess. 16 | // TODO(rsc): Can we use a single global basep for all calls? 17 | var base = (*uintptr)(unsafe.Pointer(new(uint64))) 18 | return Getdirentries(fd, buf, base) 19 | } 20 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/sockcmsg_linux.go: -------------------------------------------------------------------------------- 1 | // Copyright 2011 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // Socket control messages 6 | 7 | package unix 8 | 9 | import "unsafe" 10 | 11 | // UnixCredentials encodes credentials into a socket control message 12 | // for sending to another process. This can be used for 13 | // authentication. 14 | func UnixCredentials(ucred *Ucred) []byte { 15 | b := make([]byte, CmsgSpace(SizeofUcred)) 16 | h := (*Cmsghdr)(unsafe.Pointer(&b[0])) 17 | h.Level = SOL_SOCKET 18 | h.Type = SCM_CREDENTIALS 19 | h.SetLen(CmsgLen(SizeofUcred)) 20 | *((*Ucred)(cmsgData(h))) = *ucred 21 | return b 22 | } 23 | 24 | // ParseUnixCredentials decodes a socket control message that contains 25 | // credentials in a Ucred structure. To receive such a message, the 26 | // SO_PASSCRED option must be enabled on the socket. 27 | func ParseUnixCredentials(m *SocketControlMessage) (*Ucred, error) { 28 | if m.Header.Level != SOL_SOCKET { 29 | return nil, EINVAL 30 | } 31 | if m.Header.Type != SCM_CREDENTIALS { 32 | return nil, EINVAL 33 | } 34 | ucred := *(*Ucred)(unsafe.Pointer(&m.Data[0])) 35 | return &ucred, nil 36 | } 37 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/sockcmsg_unix.go: -------------------------------------------------------------------------------- 1 | // Copyright 2011 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build aix darwin dragonfly freebsd linux netbsd openbsd solaris 6 | 7 | // Socket control messages 8 | 9 | package unix 10 | 11 | import ( 12 | "runtime" 13 | "unsafe" 14 | ) 15 | 16 | // Round the length of a raw sockaddr up to align it properly. 17 | func cmsgAlignOf(salen int) int { 18 | salign := SizeofPtr 19 | 20 | switch runtime.GOOS { 21 | case "aix": 22 | // There is no alignment on AIX. 23 | salign = 1 24 | case "darwin", "dragonfly", "solaris", "illumos": 25 | // NOTE: It seems like 64-bit Darwin, DragonFly BSD, 26 | // illumos, and Solaris kernels still require 32-bit 27 | // aligned access to network subsystem. 28 | if SizeofPtr == 8 { 29 | salign = 4 30 | } 31 | case "netbsd", "openbsd": 32 | // NetBSD and OpenBSD armv7 require 64-bit alignment. 33 | if runtime.GOARCH == "arm" { 34 | salign = 8 35 | } 36 | } 37 | 38 | return (salen + salign - 1) & ^(salign - 1) 39 | } 40 | 41 | // CmsgLen returns the value to store in the Len field of the Cmsghdr 42 | // structure, taking into account any necessary alignment. 43 | func CmsgLen(datalen int) int { 44 | return cmsgAlignOf(SizeofCmsghdr) + datalen 45 | } 46 | 47 | // CmsgSpace returns the number of bytes an ancillary element with 48 | // payload of the passed data length occupies. 49 | func CmsgSpace(datalen int) int { 50 | return cmsgAlignOf(SizeofCmsghdr) + cmsgAlignOf(datalen) 51 | } 52 | 53 | func cmsgData(h *Cmsghdr) unsafe.Pointer { 54 | return unsafe.Pointer(uintptr(unsafe.Pointer(h)) + uintptr(cmsgAlignOf(SizeofCmsghdr))) 55 | } 56 | 57 | // SocketControlMessage represents a socket control message. 58 | type SocketControlMessage struct { 59 | Header Cmsghdr 60 | Data []byte 61 | } 62 | 63 | // ParseSocketControlMessage parses b as an array of socket control 64 | // messages. 65 | func ParseSocketControlMessage(b []byte) ([]SocketControlMessage, error) { 66 | var msgs []SocketControlMessage 67 | i := 0 68 | for i+CmsgLen(0) <= len(b) { 69 | h, dbuf, err := socketControlMessageHeaderAndData(b[i:]) 70 | if err != nil { 71 | return nil, err 72 | } 73 | m := SocketControlMessage{Header: *h, Data: dbuf} 74 | msgs = append(msgs, m) 75 | i += cmsgAlignOf(int(h.Len)) 76 | } 77 | return msgs, nil 78 | } 79 | 80 | func socketControlMessageHeaderAndData(b []byte) (*Cmsghdr, []byte, error) { 81 | h := (*Cmsghdr)(unsafe.Pointer(&b[0])) 82 | if h.Len < SizeofCmsghdr || uint64(h.Len) > uint64(len(b)) { 83 | return nil, nil, EINVAL 84 | } 85 | return h, b[cmsgAlignOf(SizeofCmsghdr):h.Len], nil 86 | } 87 | 88 | // UnixRights encodes a set of open file descriptors into a socket 89 | // control message for sending to another process. 90 | func UnixRights(fds ...int) []byte { 91 | datalen := len(fds) * 4 92 | b := make([]byte, CmsgSpace(datalen)) 93 | h := (*Cmsghdr)(unsafe.Pointer(&b[0])) 94 | h.Level = SOL_SOCKET 95 | h.Type = SCM_RIGHTS 96 | h.SetLen(CmsgLen(datalen)) 97 | data := cmsgData(h) 98 | for _, fd := range fds { 99 | *(*int32)(data) = int32(fd) 100 | data = unsafe.Pointer(uintptr(data) + 4) 101 | } 102 | return b 103 | } 104 | 105 | // ParseUnixRights decodes a socket control message that contains an 106 | // integer array of open file descriptors from another process. 107 | func ParseUnixRights(m *SocketControlMessage) ([]int, error) { 108 | if m.Header.Level != SOL_SOCKET { 109 | return nil, EINVAL 110 | } 111 | if m.Header.Type != SCM_RIGHTS { 112 | return nil, EINVAL 113 | } 114 | fds := make([]int, len(m.Data)>>2) 115 | for i, j := 0, 0; i < len(m.Data); i += 4 { 116 | fds[j] = int(*(*int32)(unsafe.Pointer(&m.Data[i]))) 117 | j++ 118 | } 119 | return fds, nil 120 | } 121 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/str.go: -------------------------------------------------------------------------------- 1 | // Copyright 2009 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build aix darwin dragonfly freebsd linux netbsd openbsd solaris 6 | 7 | package unix 8 | 9 | func itoa(val int) string { // do it here rather than with fmt to avoid dependency 10 | if val < 0 { 11 | return "-" + uitoa(uint(-val)) 12 | } 13 | return uitoa(uint(val)) 14 | } 15 | 16 | func uitoa(val uint) string { 17 | var buf [32]byte // big enough for int64 18 | i := len(buf) - 1 19 | for val >= 10 { 20 | buf[i] = byte(val%10 + '0') 21 | i-- 22 | val /= 10 23 | } 24 | buf[i] = byte(val + '0') 25 | return string(buf[i:]) 26 | } 27 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/syscall.go: -------------------------------------------------------------------------------- 1 | // Copyright 2009 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build aix darwin dragonfly freebsd linux netbsd openbsd solaris 6 | 7 | // Package unix contains an interface to the low-level operating system 8 | // primitives. OS details vary depending on the underlying system, and 9 | // by default, godoc will display OS-specific documentation for the current 10 | // system. If you want godoc to display OS documentation for another 11 | // system, set $GOOS and $GOARCH to the desired system. For example, if 12 | // you want to view documentation for freebsd/arm on linux/amd64, set $GOOS 13 | // to freebsd and $GOARCH to arm. 14 | // 15 | // The primary use of this package is inside other packages that provide a more 16 | // portable interface to the system, such as "os", "time" and "net". Use 17 | // those packages rather than this one if you can. 18 | // 19 | // For details of the functions and data types in this package consult 20 | // the manuals for the appropriate operating system. 21 | // 22 | // These calls return err == nil to indicate success; otherwise 23 | // err represents an operating system error describing the failure and 24 | // holds a value of type syscall.Errno. 25 | package unix // import "golang.org/x/sys/unix" 26 | 27 | import "strings" 28 | 29 | // ByteSliceFromString returns a NUL-terminated slice of bytes 30 | // containing the text of s. If s contains a NUL byte at any 31 | // location, it returns (nil, EINVAL). 32 | func ByteSliceFromString(s string) ([]byte, error) { 33 | if strings.IndexByte(s, 0) != -1 { 34 | return nil, EINVAL 35 | } 36 | a := make([]byte, len(s)+1) 37 | copy(a, s) 38 | return a, nil 39 | } 40 | 41 | // BytePtrFromString returns a pointer to a NUL-terminated array of 42 | // bytes containing the text of s. If s contains a NUL byte at any 43 | // location, it returns (nil, EINVAL). 44 | func BytePtrFromString(s string) (*byte, error) { 45 | a, err := ByteSliceFromString(s) 46 | if err != nil { 47 | return nil, err 48 | } 49 | return &a[0], nil 50 | } 51 | 52 | // Single-word zero for use when we need a valid pointer to 0 bytes. 53 | var _zero uintptr 54 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/syscall_aix_ppc.go: -------------------------------------------------------------------------------- 1 | // Copyright 2018 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build aix 6 | // +build ppc 7 | 8 | package unix 9 | 10 | //sysnb Getrlimit(resource int, rlim *Rlimit) (err error) = getrlimit64 11 | //sysnb Setrlimit(resource int, rlim *Rlimit) (err error) = setrlimit64 12 | //sys Seek(fd int, offset int64, whence int) (off int64, err error) = lseek64 13 | 14 | //sys mmap(addr uintptr, length uintptr, prot int, flags int, fd int, offset int64) (xaddr uintptr, err error) 15 | 16 | func setTimespec(sec, nsec int64) Timespec { 17 | return Timespec{Sec: int32(sec), Nsec: int32(nsec)} 18 | } 19 | 20 | func setTimeval(sec, usec int64) Timeval { 21 | return Timeval{Sec: int32(sec), Usec: int32(usec)} 22 | } 23 | 24 | func (iov *Iovec) SetLen(length int) { 25 | iov.Len = uint32(length) 26 | } 27 | 28 | func (msghdr *Msghdr) SetControllen(length int) { 29 | msghdr.Controllen = uint32(length) 30 | } 31 | 32 | func (cmsg *Cmsghdr) SetLen(length int) { 33 | cmsg.Len = uint32(length) 34 | } 35 | 36 | func Fstat(fd int, stat *Stat_t) error { 37 | return fstat(fd, stat) 38 | } 39 | 40 | func Fstatat(dirfd int, path string, stat *Stat_t, flags int) error { 41 | return fstatat(dirfd, path, stat, flags) 42 | } 43 | 44 | func Lstat(path string, stat *Stat_t) error { 45 | return lstat(path, stat) 46 | } 47 | 48 | func Stat(path string, statptr *Stat_t) error { 49 | return stat(path, statptr) 50 | } 51 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/syscall_aix_ppc64.go: -------------------------------------------------------------------------------- 1 | // Copyright 2018 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build aix 6 | // +build ppc64 7 | 8 | package unix 9 | 10 | //sysnb Getrlimit(resource int, rlim *Rlimit) (err error) 11 | //sysnb Setrlimit(resource int, rlim *Rlimit) (err error) 12 | //sys Seek(fd int, offset int64, whence int) (off int64, err error) = lseek 13 | 14 | //sys mmap(addr uintptr, length uintptr, prot int, flags int, fd int, offset int64) (xaddr uintptr, err error) = mmap64 15 | 16 | func setTimespec(sec, nsec int64) Timespec { 17 | return Timespec{Sec: sec, Nsec: nsec} 18 | } 19 | 20 | func setTimeval(sec, usec int64) Timeval { 21 | return Timeval{Sec: int64(sec), Usec: int32(usec)} 22 | } 23 | 24 | func (iov *Iovec) SetLen(length int) { 25 | iov.Len = uint64(length) 26 | } 27 | 28 | func (msghdr *Msghdr) SetControllen(length int) { 29 | msghdr.Controllen = uint32(length) 30 | } 31 | 32 | func (cmsg *Cmsghdr) SetLen(length int) { 33 | cmsg.Len = uint32(length) 34 | } 35 | 36 | // In order to only have Timespec structure, type of Stat_t's fields 37 | // Atim, Mtim and Ctim is changed from StTimespec to Timespec during 38 | // ztypes generation. 39 | // On ppc64, Timespec.Nsec is an int64 while StTimespec.Nsec is an 40 | // int32, so the fields' value must be modified. 41 | func fixStatTimFields(stat *Stat_t) { 42 | stat.Atim.Nsec >>= 32 43 | stat.Mtim.Nsec >>= 32 44 | stat.Ctim.Nsec >>= 32 45 | } 46 | 47 | func Fstat(fd int, stat *Stat_t) error { 48 | err := fstat(fd, stat) 49 | if err != nil { 50 | return err 51 | } 52 | fixStatTimFields(stat) 53 | return nil 54 | } 55 | 56 | func Fstatat(dirfd int, path string, stat *Stat_t, flags int) error { 57 | err := fstatat(dirfd, path, stat, flags) 58 | if err != nil { 59 | return err 60 | } 61 | fixStatTimFields(stat) 62 | return nil 63 | } 64 | 65 | func Lstat(path string, stat *Stat_t) error { 66 | err := lstat(path, stat) 67 | if err != nil { 68 | return err 69 | } 70 | fixStatTimFields(stat) 71 | return nil 72 | } 73 | 74 | func Stat(path string, statptr *Stat_t) error { 75 | err := stat(path, statptr) 76 | if err != nil { 77 | return err 78 | } 79 | fixStatTimFields(statptr) 80 | return nil 81 | } 82 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/syscall_darwin_386.go: -------------------------------------------------------------------------------- 1 | // Copyright 2009 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build 386,darwin 6 | 7 | package unix 8 | 9 | import ( 10 | "syscall" 11 | ) 12 | 13 | func setTimespec(sec, nsec int64) Timespec { 14 | return Timespec{Sec: int32(sec), Nsec: int32(nsec)} 15 | } 16 | 17 | func setTimeval(sec, usec int64) Timeval { 18 | return Timeval{Sec: int32(sec), Usec: int32(usec)} 19 | } 20 | 21 | //sysnb gettimeofday(tp *Timeval) (sec int32, usec int32, err error) 22 | func Gettimeofday(tv *Timeval) (err error) { 23 | // The tv passed to gettimeofday must be non-nil 24 | // but is otherwise unused. The answers come back 25 | // in the two registers. 26 | sec, usec, err := gettimeofday(tv) 27 | tv.Sec = int32(sec) 28 | tv.Usec = int32(usec) 29 | return err 30 | } 31 | 32 | func SetKevent(k *Kevent_t, fd, mode, flags int) { 33 | k.Ident = uint32(fd) 34 | k.Filter = int16(mode) 35 | k.Flags = uint16(flags) 36 | } 37 | 38 | func (iov *Iovec) SetLen(length int) { 39 | iov.Len = uint32(length) 40 | } 41 | 42 | func (msghdr *Msghdr) SetControllen(length int) { 43 | msghdr.Controllen = uint32(length) 44 | } 45 | 46 | func (cmsg *Cmsghdr) SetLen(length int) { 47 | cmsg.Len = uint32(length) 48 | } 49 | 50 | func Syscall9(num, a1, a2, a3, a4, a5, a6, a7, a8, a9 uintptr) (r1, r2 uintptr, err syscall.Errno) 51 | 52 | // SYS___SYSCTL is used by syscall_bsd.go for all BSDs, but in modern versions 53 | // of darwin/386 the syscall is called sysctl instead of __sysctl. 54 | const SYS___SYSCTL = SYS_SYSCTL 55 | 56 | //sys Fstat(fd int, stat *Stat_t) (err error) = SYS_FSTAT64 57 | //sys Fstatat(fd int, path string, stat *Stat_t, flags int) (err error) = SYS_FSTATAT64 58 | //sys Fstatfs(fd int, stat *Statfs_t) (err error) = SYS_FSTATFS64 59 | //sys Getdirentries(fd int, buf []byte, basep *uintptr) (n int, err error) = SYS_GETDIRENTRIES64 60 | //sys getfsstat(buf unsafe.Pointer, size uintptr, flags int) (n int, err error) = SYS_GETFSSTAT64 61 | //sys Lstat(path string, stat *Stat_t) (err error) = SYS_LSTAT64 62 | //sys Stat(path string, stat *Stat_t) (err error) = SYS_STAT64 63 | //sys Statfs(path string, stat *Statfs_t) (err error) = SYS_STATFS64 64 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/syscall_darwin_amd64.go: -------------------------------------------------------------------------------- 1 | // Copyright 2009 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build amd64,darwin 6 | 7 | package unix 8 | 9 | import ( 10 | "syscall" 11 | ) 12 | 13 | func setTimespec(sec, nsec int64) Timespec { 14 | return Timespec{Sec: sec, Nsec: nsec} 15 | } 16 | 17 | func setTimeval(sec, usec int64) Timeval { 18 | return Timeval{Sec: sec, Usec: int32(usec)} 19 | } 20 | 21 | //sysnb gettimeofday(tp *Timeval) (sec int64, usec int32, err error) 22 | func Gettimeofday(tv *Timeval) (err error) { 23 | // The tv passed to gettimeofday must be non-nil 24 | // but is otherwise unused. The answers come back 25 | // in the two registers. 26 | sec, usec, err := gettimeofday(tv) 27 | tv.Sec = sec 28 | tv.Usec = usec 29 | return err 30 | } 31 | 32 | func SetKevent(k *Kevent_t, fd, mode, flags int) { 33 | k.Ident = uint64(fd) 34 | k.Filter = int16(mode) 35 | k.Flags = uint16(flags) 36 | } 37 | 38 | func (iov *Iovec) SetLen(length int) { 39 | iov.Len = uint64(length) 40 | } 41 | 42 | func (msghdr *Msghdr) SetControllen(length int) { 43 | msghdr.Controllen = uint32(length) 44 | } 45 | 46 | func (cmsg *Cmsghdr) SetLen(length int) { 47 | cmsg.Len = uint32(length) 48 | } 49 | 50 | func Syscall9(num, a1, a2, a3, a4, a5, a6, a7, a8, a9 uintptr) (r1, r2 uintptr, err syscall.Errno) 51 | 52 | // SYS___SYSCTL is used by syscall_bsd.go for all BSDs, but in modern versions 53 | // of darwin/amd64 the syscall is called sysctl instead of __sysctl. 54 | const SYS___SYSCTL = SYS_SYSCTL 55 | 56 | //sys Fstat(fd int, stat *Stat_t) (err error) = SYS_FSTAT64 57 | //sys Fstatat(fd int, path string, stat *Stat_t, flags int) (err error) = SYS_FSTATAT64 58 | //sys Fstatfs(fd int, stat *Statfs_t) (err error) = SYS_FSTATFS64 59 | //sys Getdirentries(fd int, buf []byte, basep *uintptr) (n int, err error) = SYS_GETDIRENTRIES64 60 | //sys getfsstat(buf unsafe.Pointer, size uintptr, flags int) (n int, err error) = SYS_GETFSSTAT64 61 | //sys Lstat(path string, stat *Stat_t) (err error) = SYS_LSTAT64 62 | //sys Stat(path string, stat *Stat_t) (err error) = SYS_STAT64 63 | //sys Statfs(path string, stat *Statfs_t) (err error) = SYS_STATFS64 64 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/syscall_darwin_arm.go: -------------------------------------------------------------------------------- 1 | // Copyright 2015 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | package unix 6 | 7 | import ( 8 | "syscall" 9 | ) 10 | 11 | func setTimespec(sec, nsec int64) Timespec { 12 | return Timespec{Sec: int32(sec), Nsec: int32(nsec)} 13 | } 14 | 15 | func setTimeval(sec, usec int64) Timeval { 16 | return Timeval{Sec: int32(sec), Usec: int32(usec)} 17 | } 18 | 19 | //sysnb gettimeofday(tp *Timeval) (sec int32, usec int32, err error) 20 | func Gettimeofday(tv *Timeval) (err error) { 21 | // The tv passed to gettimeofday must be non-nil 22 | // but is otherwise unused. The answers come back 23 | // in the two registers. 24 | sec, usec, err := gettimeofday(tv) 25 | tv.Sec = int32(sec) 26 | tv.Usec = int32(usec) 27 | return err 28 | } 29 | 30 | func SetKevent(k *Kevent_t, fd, mode, flags int) { 31 | k.Ident = uint32(fd) 32 | k.Filter = int16(mode) 33 | k.Flags = uint16(flags) 34 | } 35 | 36 | func (iov *Iovec) SetLen(length int) { 37 | iov.Len = uint32(length) 38 | } 39 | 40 | func (msghdr *Msghdr) SetControllen(length int) { 41 | msghdr.Controllen = uint32(length) 42 | } 43 | 44 | func (cmsg *Cmsghdr) SetLen(length int) { 45 | cmsg.Len = uint32(length) 46 | } 47 | 48 | func Syscall9(num, a1, a2, a3, a4, a5, a6, a7, a8, a9 uintptr) (r1, r2 uintptr, err syscall.Errno) // sic 49 | 50 | // SYS___SYSCTL is used by syscall_bsd.go for all BSDs, but in modern versions 51 | // of darwin/arm the syscall is called sysctl instead of __sysctl. 52 | const SYS___SYSCTL = SYS_SYSCTL 53 | 54 | //sys Fstat(fd int, stat *Stat_t) (err error) 55 | //sys Fstatat(fd int, path string, stat *Stat_t, flags int) (err error) 56 | //sys Fstatfs(fd int, stat *Statfs_t) (err error) 57 | //sys getfsstat(buf unsafe.Pointer, size uintptr, flags int) (n int, err error) = SYS_GETFSSTAT 58 | //sys Lstat(path string, stat *Stat_t) (err error) 59 | //sys Stat(path string, stat *Stat_t) (err error) 60 | //sys Statfs(path string, stat *Statfs_t) (err error) 61 | 62 | func Getdirentries(fd int, buf []byte, basep *uintptr) (n int, err error) { 63 | return 0, ENOSYS 64 | } 65 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/syscall_darwin_arm64.go: -------------------------------------------------------------------------------- 1 | // Copyright 2015 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build arm64,darwin 6 | 7 | package unix 8 | 9 | import ( 10 | "syscall" 11 | ) 12 | 13 | func setTimespec(sec, nsec int64) Timespec { 14 | return Timespec{Sec: sec, Nsec: nsec} 15 | } 16 | 17 | func setTimeval(sec, usec int64) Timeval { 18 | return Timeval{Sec: sec, Usec: int32(usec)} 19 | } 20 | 21 | //sysnb gettimeofday(tp *Timeval) (sec int64, usec int32, err error) 22 | func Gettimeofday(tv *Timeval) (err error) { 23 | // The tv passed to gettimeofday must be non-nil 24 | // but is otherwise unused. The answers come back 25 | // in the two registers. 26 | sec, usec, err := gettimeofday(tv) 27 | tv.Sec = sec 28 | tv.Usec = usec 29 | return err 30 | } 31 | 32 | func SetKevent(k *Kevent_t, fd, mode, flags int) { 33 | k.Ident = uint64(fd) 34 | k.Filter = int16(mode) 35 | k.Flags = uint16(flags) 36 | } 37 | 38 | func (iov *Iovec) SetLen(length int) { 39 | iov.Len = uint64(length) 40 | } 41 | 42 | func (msghdr *Msghdr) SetControllen(length int) { 43 | msghdr.Controllen = uint32(length) 44 | } 45 | 46 | func (cmsg *Cmsghdr) SetLen(length int) { 47 | cmsg.Len = uint32(length) 48 | } 49 | 50 | func Syscall9(num, a1, a2, a3, a4, a5, a6, a7, a8, a9 uintptr) (r1, r2 uintptr, err syscall.Errno) // sic 51 | 52 | // SYS___SYSCTL is used by syscall_bsd.go for all BSDs, but in modern versions 53 | // of darwin/arm64 the syscall is called sysctl instead of __sysctl. 54 | const SYS___SYSCTL = SYS_SYSCTL 55 | 56 | //sys Fstat(fd int, stat *Stat_t) (err error) 57 | //sys Fstatat(fd int, path string, stat *Stat_t, flags int) (err error) 58 | //sys Fstatfs(fd int, stat *Statfs_t) (err error) 59 | //sys getfsstat(buf unsafe.Pointer, size uintptr, flags int) (n int, err error) = SYS_GETFSSTAT 60 | //sys Lstat(path string, stat *Stat_t) (err error) 61 | //sys Stat(path string, stat *Stat_t) (err error) 62 | //sys Statfs(path string, stat *Statfs_t) (err error) 63 | 64 | func Getdirentries(fd int, buf []byte, basep *uintptr) (n int, err error) { 65 | return 0, ENOSYS 66 | } 67 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/syscall_darwin_libSystem.go: -------------------------------------------------------------------------------- 1 | // Copyright 2018 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build darwin,go1.12 6 | 7 | package unix 8 | 9 | import "unsafe" 10 | 11 | // Implemented in the runtime package (runtime/sys_darwin.go) 12 | func syscall_syscall(fn, a1, a2, a3 uintptr) (r1, r2 uintptr, err Errno) 13 | func syscall_syscall6(fn, a1, a2, a3, a4, a5, a6 uintptr) (r1, r2 uintptr, err Errno) 14 | func syscall_syscall6X(fn, a1, a2, a3, a4, a5, a6 uintptr) (r1, r2 uintptr, err Errno) 15 | func syscall_syscall9(fn, a1, a2, a3, a4, a5, a6, a7, a8, a9 uintptr) (r1, r2 uintptr, err Errno) // 32-bit only 16 | func syscall_rawSyscall(fn, a1, a2, a3 uintptr) (r1, r2 uintptr, err Errno) 17 | func syscall_rawSyscall6(fn, a1, a2, a3, a4, a5, a6 uintptr) (r1, r2 uintptr, err Errno) 18 | 19 | //go:linkname syscall_syscall syscall.syscall 20 | //go:linkname syscall_syscall6 syscall.syscall6 21 | //go:linkname syscall_syscall6X syscall.syscall6X 22 | //go:linkname syscall_syscall9 syscall.syscall9 23 | //go:linkname syscall_rawSyscall syscall.rawSyscall 24 | //go:linkname syscall_rawSyscall6 syscall.rawSyscall6 25 | 26 | // Find the entry point for f. See comments in runtime/proc.go for the 27 | // function of the same name. 28 | //go:nosplit 29 | func funcPC(f func()) uintptr { 30 | return **(**uintptr)(unsafe.Pointer(&f)) 31 | } 32 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/syscall_dragonfly_amd64.go: -------------------------------------------------------------------------------- 1 | // Copyright 2009 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build amd64,dragonfly 6 | 7 | package unix 8 | 9 | import ( 10 | "syscall" 11 | "unsafe" 12 | ) 13 | 14 | func setTimespec(sec, nsec int64) Timespec { 15 | return Timespec{Sec: sec, Nsec: nsec} 16 | } 17 | 18 | func setTimeval(sec, usec int64) Timeval { 19 | return Timeval{Sec: sec, Usec: usec} 20 | } 21 | 22 | func SetKevent(k *Kevent_t, fd, mode, flags int) { 23 | k.Ident = uint64(fd) 24 | k.Filter = int16(mode) 25 | k.Flags = uint16(flags) 26 | } 27 | 28 | func (iov *Iovec) SetLen(length int) { 29 | iov.Len = uint64(length) 30 | } 31 | 32 | func (msghdr *Msghdr) SetControllen(length int) { 33 | msghdr.Controllen = uint32(length) 34 | } 35 | 36 | func (cmsg *Cmsghdr) SetLen(length int) { 37 | cmsg.Len = uint32(length) 38 | } 39 | 40 | func sendfile(outfd int, infd int, offset *int64, count int) (written int, err error) { 41 | var writtenOut uint64 = 0 42 | _, _, e1 := Syscall9(SYS_SENDFILE, uintptr(infd), uintptr(outfd), uintptr(*offset), uintptr(count), 0, uintptr(unsafe.Pointer(&writtenOut)), 0, 0, 0) 43 | 44 | written = int(writtenOut) 45 | 46 | if e1 != 0 { 47 | err = e1 48 | } 49 | return 50 | } 51 | 52 | func Syscall9(num, a1, a2, a3, a4, a5, a6, a7, a8, a9 uintptr) (r1, r2 uintptr, err syscall.Errno) 53 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/syscall_freebsd_386.go: -------------------------------------------------------------------------------- 1 | // Copyright 2009 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build 386,freebsd 6 | 7 | package unix 8 | 9 | import ( 10 | "syscall" 11 | "unsafe" 12 | ) 13 | 14 | func setTimespec(sec, nsec int64) Timespec { 15 | return Timespec{Sec: int32(sec), Nsec: int32(nsec)} 16 | } 17 | 18 | func setTimeval(sec, usec int64) Timeval { 19 | return Timeval{Sec: int32(sec), Usec: int32(usec)} 20 | } 21 | 22 | func SetKevent(k *Kevent_t, fd, mode, flags int) { 23 | k.Ident = uint32(fd) 24 | k.Filter = int16(mode) 25 | k.Flags = uint16(flags) 26 | } 27 | 28 | func (iov *Iovec) SetLen(length int) { 29 | iov.Len = uint32(length) 30 | } 31 | 32 | func (msghdr *Msghdr) SetControllen(length int) { 33 | msghdr.Controllen = uint32(length) 34 | } 35 | 36 | func (cmsg *Cmsghdr) SetLen(length int) { 37 | cmsg.Len = uint32(length) 38 | } 39 | 40 | func sendfile(outfd int, infd int, offset *int64, count int) (written int, err error) { 41 | var writtenOut uint64 = 0 42 | _, _, e1 := Syscall9(SYS_SENDFILE, uintptr(infd), uintptr(outfd), uintptr(*offset), uintptr((*offset)>>32), uintptr(count), 0, uintptr(unsafe.Pointer(&writtenOut)), 0, 0) 43 | 44 | written = int(writtenOut) 45 | 46 | if e1 != 0 { 47 | err = e1 48 | } 49 | return 50 | } 51 | 52 | func Syscall9(num, a1, a2, a3, a4, a5, a6, a7, a8, a9 uintptr) (r1, r2 uintptr, err syscall.Errno) 53 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/syscall_freebsd_amd64.go: -------------------------------------------------------------------------------- 1 | // Copyright 2009 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build amd64,freebsd 6 | 7 | package unix 8 | 9 | import ( 10 | "syscall" 11 | "unsafe" 12 | ) 13 | 14 | func setTimespec(sec, nsec int64) Timespec { 15 | return Timespec{Sec: sec, Nsec: nsec} 16 | } 17 | 18 | func setTimeval(sec, usec int64) Timeval { 19 | return Timeval{Sec: sec, Usec: usec} 20 | } 21 | 22 | func SetKevent(k *Kevent_t, fd, mode, flags int) { 23 | k.Ident = uint64(fd) 24 | k.Filter = int16(mode) 25 | k.Flags = uint16(flags) 26 | } 27 | 28 | func (iov *Iovec) SetLen(length int) { 29 | iov.Len = uint64(length) 30 | } 31 | 32 | func (msghdr *Msghdr) SetControllen(length int) { 33 | msghdr.Controllen = uint32(length) 34 | } 35 | 36 | func (cmsg *Cmsghdr) SetLen(length int) { 37 | cmsg.Len = uint32(length) 38 | } 39 | 40 | func sendfile(outfd int, infd int, offset *int64, count int) (written int, err error) { 41 | var writtenOut uint64 = 0 42 | _, _, e1 := Syscall9(SYS_SENDFILE, uintptr(infd), uintptr(outfd), uintptr(*offset), uintptr(count), 0, uintptr(unsafe.Pointer(&writtenOut)), 0, 0, 0) 43 | 44 | written = int(writtenOut) 45 | 46 | if e1 != 0 { 47 | err = e1 48 | } 49 | return 50 | } 51 | 52 | func Syscall9(num, a1, a2, a3, a4, a5, a6, a7, a8, a9 uintptr) (r1, r2 uintptr, err syscall.Errno) 53 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/syscall_freebsd_arm.go: -------------------------------------------------------------------------------- 1 | // Copyright 2012 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build arm,freebsd 6 | 7 | package unix 8 | 9 | import ( 10 | "syscall" 11 | "unsafe" 12 | ) 13 | 14 | func setTimespec(sec, nsec int64) Timespec { 15 | return Timespec{Sec: sec, Nsec: int32(nsec)} 16 | } 17 | 18 | func setTimeval(sec, usec int64) Timeval { 19 | return Timeval{Sec: sec, Usec: int32(usec)} 20 | } 21 | 22 | func SetKevent(k *Kevent_t, fd, mode, flags int) { 23 | k.Ident = uint32(fd) 24 | k.Filter = int16(mode) 25 | k.Flags = uint16(flags) 26 | } 27 | 28 | func (iov *Iovec) SetLen(length int) { 29 | iov.Len = uint32(length) 30 | } 31 | 32 | func (msghdr *Msghdr) SetControllen(length int) { 33 | msghdr.Controllen = uint32(length) 34 | } 35 | 36 | func (cmsg *Cmsghdr) SetLen(length int) { 37 | cmsg.Len = uint32(length) 38 | } 39 | 40 | func sendfile(outfd int, infd int, offset *int64, count int) (written int, err error) { 41 | var writtenOut uint64 = 0 42 | _, _, e1 := Syscall9(SYS_SENDFILE, uintptr(infd), uintptr(outfd), uintptr(*offset), uintptr((*offset)>>32), uintptr(count), 0, uintptr(unsafe.Pointer(&writtenOut)), 0, 0) 43 | 44 | written = int(writtenOut) 45 | 46 | if e1 != 0 { 47 | err = e1 48 | } 49 | return 50 | } 51 | 52 | func Syscall9(num, a1, a2, a3, a4, a5, a6, a7, a8, a9 uintptr) (r1, r2 uintptr, err syscall.Errno) 53 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/syscall_freebsd_arm64.go: -------------------------------------------------------------------------------- 1 | // Copyright 2018 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build arm64,freebsd 6 | 7 | package unix 8 | 9 | import ( 10 | "syscall" 11 | "unsafe" 12 | ) 13 | 14 | func setTimespec(sec, nsec int64) Timespec { 15 | return Timespec{Sec: sec, Nsec: nsec} 16 | } 17 | 18 | func setTimeval(sec, usec int64) Timeval { 19 | return Timeval{Sec: sec, Usec: usec} 20 | } 21 | 22 | func SetKevent(k *Kevent_t, fd, mode, flags int) { 23 | k.Ident = uint64(fd) 24 | k.Filter = int16(mode) 25 | k.Flags = uint16(flags) 26 | } 27 | 28 | func (iov *Iovec) SetLen(length int) { 29 | iov.Len = uint64(length) 30 | } 31 | 32 | func (msghdr *Msghdr) SetControllen(length int) { 33 | msghdr.Controllen = uint32(length) 34 | } 35 | 36 | func (cmsg *Cmsghdr) SetLen(length int) { 37 | cmsg.Len = uint32(length) 38 | } 39 | 40 | func sendfile(outfd int, infd int, offset *int64, count int) (written int, err error) { 41 | var writtenOut uint64 = 0 42 | _, _, e1 := Syscall9(SYS_SENDFILE, uintptr(infd), uintptr(outfd), uintptr(*offset), uintptr(count), 0, uintptr(unsafe.Pointer(&writtenOut)), 0, 0, 0) 43 | 44 | written = int(writtenOut) 45 | 46 | if e1 != 0 { 47 | err = e1 48 | } 49 | return 50 | } 51 | 52 | func Syscall9(num, a1, a2, a3, a4, a5, a6, a7, a8, a9 uintptr) (r1, r2 uintptr, err syscall.Errno) 53 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/syscall_linux_amd64_gc.go: -------------------------------------------------------------------------------- 1 | // Copyright 2016 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build amd64,linux 6 | // +build !gccgo 7 | 8 | package unix 9 | 10 | import "syscall" 11 | 12 | //go:noescape 13 | func gettimeofday(tv *Timeval) (err syscall.Errno) 14 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/syscall_linux_gc.go: -------------------------------------------------------------------------------- 1 | // Copyright 2018 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build linux,!gccgo 6 | 7 | package unix 8 | 9 | // SyscallNoError may be used instead of Syscall for syscalls that don't fail. 10 | func SyscallNoError(trap, a1, a2, a3 uintptr) (r1, r2 uintptr) 11 | 12 | // RawSyscallNoError may be used instead of RawSyscall for syscalls that don't 13 | // fail. 14 | func RawSyscallNoError(trap, a1, a2, a3 uintptr) (r1, r2 uintptr) 15 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/syscall_linux_gc_386.go: -------------------------------------------------------------------------------- 1 | // Copyright 2018 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build linux,!gccgo,386 6 | 7 | package unix 8 | 9 | import "syscall" 10 | 11 | // Underlying system call writes to newoffset via pointer. 12 | // Implemented in assembly to avoid allocation. 13 | func seek(fd int, offset int64, whence int) (newoffset int64, err syscall.Errno) 14 | 15 | func socketcall(call int, a0, a1, a2, a3, a4, a5 uintptr) (n int, err syscall.Errno) 16 | func rawsocketcall(call int, a0, a1, a2, a3, a4, a5 uintptr) (n int, err syscall.Errno) 17 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/syscall_linux_gccgo_386.go: -------------------------------------------------------------------------------- 1 | // Copyright 2018 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build linux,gccgo,386 6 | 7 | package unix 8 | 9 | import ( 10 | "syscall" 11 | "unsafe" 12 | ) 13 | 14 | func seek(fd int, offset int64, whence int) (int64, syscall.Errno) { 15 | var newoffset int64 16 | offsetLow := uint32(offset & 0xffffffff) 17 | offsetHigh := uint32((offset >> 32) & 0xffffffff) 18 | _, _, err := Syscall6(SYS__LLSEEK, uintptr(fd), uintptr(offsetHigh), uintptr(offsetLow), uintptr(unsafe.Pointer(&newoffset)), uintptr(whence), 0) 19 | return newoffset, err 20 | } 21 | 22 | func socketcall(call int, a0, a1, a2, a3, a4, a5 uintptr) (int, syscall.Errno) { 23 | fd, _, err := Syscall(SYS_SOCKETCALL, uintptr(call), uintptr(unsafe.Pointer(&a0)), 0) 24 | return int(fd), err 25 | } 26 | 27 | func rawsocketcall(call int, a0, a1, a2, a3, a4, a5 uintptr) (int, syscall.Errno) { 28 | fd, _, err := RawSyscall(SYS_SOCKETCALL, uintptr(call), uintptr(unsafe.Pointer(&a0)), 0) 29 | return int(fd), err 30 | } 31 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/syscall_linux_gccgo_arm.go: -------------------------------------------------------------------------------- 1 | // Copyright 2018 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build linux,gccgo,arm 6 | 7 | package unix 8 | 9 | import ( 10 | "syscall" 11 | "unsafe" 12 | ) 13 | 14 | func seek(fd int, offset int64, whence int) (int64, syscall.Errno) { 15 | var newoffset int64 16 | offsetLow := uint32(offset & 0xffffffff) 17 | offsetHigh := uint32((offset >> 32) & 0xffffffff) 18 | _, _, err := Syscall6(SYS__LLSEEK, uintptr(fd), uintptr(offsetHigh), uintptr(offsetLow), uintptr(unsafe.Pointer(&newoffset)), uintptr(whence), 0) 19 | return newoffset, err 20 | } 21 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/syscall_linux_ppc64x.go: -------------------------------------------------------------------------------- 1 | // Copyright 2009 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build linux 6 | // +build ppc64 ppc64le 7 | 8 | package unix 9 | 10 | //sys Dup2(oldfd int, newfd int) (err error) 11 | //sysnb EpollCreate(size int) (fd int, err error) 12 | //sys EpollWait(epfd int, events []EpollEvent, msec int) (n int, err error) 13 | //sys Fadvise(fd int, offset int64, length int64, advice int) (err error) = SYS_FADVISE64 14 | //sys Fchown(fd int, uid int, gid int) (err error) 15 | //sys Fstat(fd int, stat *Stat_t) (err error) 16 | //sys Fstatat(dirfd int, path string, stat *Stat_t, flags int) (err error) = SYS_NEWFSTATAT 17 | //sys Fstatfs(fd int, buf *Statfs_t) (err error) 18 | //sys Ftruncate(fd int, length int64) (err error) 19 | //sysnb Getegid() (egid int) 20 | //sysnb Geteuid() (euid int) 21 | //sysnb Getgid() (gid int) 22 | //sysnb Getrlimit(resource int, rlim *Rlimit) (err error) = SYS_UGETRLIMIT 23 | //sysnb Getuid() (uid int) 24 | //sysnb InotifyInit() (fd int, err error) 25 | //sys Ioperm(from int, num int, on int) (err error) 26 | //sys Iopl(level int) (err error) 27 | //sys Lchown(path string, uid int, gid int) (err error) 28 | //sys Listen(s int, n int) (err error) 29 | //sys Lstat(path string, stat *Stat_t) (err error) 30 | //sys Pause() (err error) 31 | //sys Pread(fd int, p []byte, offset int64) (n int, err error) = SYS_PREAD64 32 | //sys Pwrite(fd int, p []byte, offset int64) (n int, err error) = SYS_PWRITE64 33 | //sys Renameat(olddirfd int, oldpath string, newdirfd int, newpath string) (err error) 34 | //sys Seek(fd int, offset int64, whence int) (off int64, err error) = SYS_LSEEK 35 | //sys Select(nfd int, r *FdSet, w *FdSet, e *FdSet, timeout *Timeval) (n int, err error) = SYS__NEWSELECT 36 | //sys sendfile(outfd int, infd int, offset *int64, count int) (written int, err error) 37 | //sys Setfsgid(gid int) (err error) 38 | //sys Setfsuid(uid int) (err error) 39 | //sysnb Setregid(rgid int, egid int) (err error) 40 | //sysnb Setresgid(rgid int, egid int, sgid int) (err error) 41 | //sysnb Setresuid(ruid int, euid int, suid int) (err error) 42 | //sysnb Setrlimit(resource int, rlim *Rlimit) (err error) 43 | //sysnb Setreuid(ruid int, euid int) (err error) 44 | //sys Shutdown(fd int, how int) (err error) 45 | //sys Splice(rfd int, roff *int64, wfd int, woff *int64, len int, flags int) (n int64, err error) 46 | //sys Stat(path string, stat *Stat_t) (err error) 47 | //sys Statfs(path string, buf *Statfs_t) (err error) 48 | //sys Truncate(path string, length int64) (err error) 49 | //sys Ustat(dev int, ubuf *Ustat_t) (err error) 50 | //sys accept(s int, rsa *RawSockaddrAny, addrlen *_Socklen) (fd int, err error) 51 | //sys accept4(s int, rsa *RawSockaddrAny, addrlen *_Socklen, flags int) (fd int, err error) 52 | //sys bind(s int, addr unsafe.Pointer, addrlen _Socklen) (err error) 53 | //sys connect(s int, addr unsafe.Pointer, addrlen _Socklen) (err error) 54 | //sysnb getgroups(n int, list *_Gid_t) (nn int, err error) 55 | //sysnb setgroups(n int, list *_Gid_t) (err error) 56 | //sys getsockopt(s int, level int, name int, val unsafe.Pointer, vallen *_Socklen) (err error) 57 | //sys setsockopt(s int, level int, name int, val unsafe.Pointer, vallen uintptr) (err error) 58 | //sysnb socket(domain int, typ int, proto int) (fd int, err error) 59 | //sysnb socketpair(domain int, typ int, proto int, fd *[2]int32) (err error) 60 | //sysnb getpeername(fd int, rsa *RawSockaddrAny, addrlen *_Socklen) (err error) 61 | //sysnb getsockname(fd int, rsa *RawSockaddrAny, addrlen *_Socklen) (err error) 62 | //sys recvfrom(fd int, p []byte, flags int, from *RawSockaddrAny, fromlen *_Socklen) (n int, err error) 63 | //sys sendto(s int, buf []byte, flags int, to unsafe.Pointer, addrlen _Socklen) (err error) 64 | //sys recvmsg(s int, msg *Msghdr, flags int) (n int, err error) 65 | //sys sendmsg(s int, msg *Msghdr, flags int) (n int, err error) 66 | //sys mmap(addr uintptr, length uintptr, prot int, flags int, fd int, offset int64) (xaddr uintptr, err error) 67 | 68 | //sys futimesat(dirfd int, path string, times *[2]Timeval) (err error) 69 | //sysnb Gettimeofday(tv *Timeval) (err error) 70 | //sysnb Time(t *Time_t) (tt Time_t, err error) 71 | //sys Utime(path string, buf *Utimbuf) (err error) 72 | //sys utimes(path string, times *[2]Timeval) (err error) 73 | 74 | func setTimespec(sec, nsec int64) Timespec { 75 | return Timespec{Sec: sec, Nsec: nsec} 76 | } 77 | 78 | func setTimeval(sec, usec int64) Timeval { 79 | return Timeval{Sec: sec, Usec: usec} 80 | } 81 | 82 | func (r *PtraceRegs) PC() uint64 { return r.Nip } 83 | 84 | func (r *PtraceRegs) SetPC(pc uint64) { r.Nip = pc } 85 | 86 | func (iov *Iovec) SetLen(length int) { 87 | iov.Len = uint64(length) 88 | } 89 | 90 | func (msghdr *Msghdr) SetControllen(length int) { 91 | msghdr.Controllen = uint64(length) 92 | } 93 | 94 | func (cmsg *Cmsghdr) SetLen(length int) { 95 | cmsg.Len = uint64(length) 96 | } 97 | 98 | //sysnb pipe(p *[2]_C_int) (err error) 99 | 100 | func Pipe(p []int) (err error) { 101 | if len(p) != 2 { 102 | return EINVAL 103 | } 104 | var pp [2]_C_int 105 | err = pipe(&pp) 106 | p[0] = int(pp[0]) 107 | p[1] = int(pp[1]) 108 | return 109 | } 110 | 111 | //sysnb pipe2(p *[2]_C_int, flags int) (err error) 112 | 113 | func Pipe2(p []int, flags int) (err error) { 114 | if len(p) != 2 { 115 | return EINVAL 116 | } 117 | var pp [2]_C_int 118 | err = pipe2(&pp, flags) 119 | p[0] = int(pp[0]) 120 | p[1] = int(pp[1]) 121 | return 122 | } 123 | 124 | //sys poll(fds *PollFd, nfds int, timeout int) (n int, err error) 125 | 126 | func Poll(fds []PollFd, timeout int) (n int, err error) { 127 | if len(fds) == 0 { 128 | return poll(nil, 0, timeout) 129 | } 130 | return poll(&fds[0], len(fds), timeout) 131 | } 132 | 133 | //sys syncFileRange2(fd int, flags int, off int64, n int64) (err error) = SYS_SYNC_FILE_RANGE2 134 | 135 | func SyncFileRange(fd int, off int64, n int64, flags int) error { 136 | // The sync_file_range and sync_file_range2 syscalls differ only in the 137 | // order of their arguments. 138 | return syncFileRange2(fd, flags, off, n) 139 | } 140 | 141 | //sys kexecFileLoad(kernelFd int, initrdFd int, cmdlineLen int, cmdline string, flags int) (err error) 142 | 143 | func KexecFileLoad(kernelFd int, initrdFd int, cmdline string, flags int) error { 144 | cmdlineLen := len(cmdline) 145 | if cmdlineLen > 0 { 146 | // Account for the additional NULL byte added by 147 | // BytePtrFromString in kexecFileLoad. The kexec_file_load 148 | // syscall expects a NULL-terminated string. 149 | cmdlineLen++ 150 | } 151 | return kexecFileLoad(kernelFd, initrdFd, cmdlineLen, cmdline, flags) 152 | } 153 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/syscall_linux_sparc64.go: -------------------------------------------------------------------------------- 1 | // Copyright 2009 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build sparc64,linux 6 | 7 | package unix 8 | 9 | //sys EpollWait(epfd int, events []EpollEvent, msec int) (n int, err error) 10 | //sys Fadvise(fd int, offset int64, length int64, advice int) (err error) = SYS_FADVISE64 11 | //sys Dup2(oldfd int, newfd int) (err error) 12 | //sys Fchown(fd int, uid int, gid int) (err error) 13 | //sys Fstat(fd int, stat *Stat_t) (err error) 14 | //sys Fstatat(dirfd int, path string, stat *Stat_t, flags int) (err error) = SYS_FSTATAT64 15 | //sys Fstatfs(fd int, buf *Statfs_t) (err error) 16 | //sys Ftruncate(fd int, length int64) (err error) 17 | //sysnb Getegid() (egid int) 18 | //sysnb Geteuid() (euid int) 19 | //sysnb Getgid() (gid int) 20 | //sysnb Getrlimit(resource int, rlim *Rlimit) (err error) 21 | //sysnb Getuid() (uid int) 22 | //sysnb InotifyInit() (fd int, err error) 23 | //sys Lchown(path string, uid int, gid int) (err error) 24 | //sys Listen(s int, n int) (err error) 25 | //sys Lstat(path string, stat *Stat_t) (err error) 26 | //sys Pause() (err error) 27 | //sys Pread(fd int, p []byte, offset int64) (n int, err error) = SYS_PREAD64 28 | //sys Pwrite(fd int, p []byte, offset int64) (n int, err error) = SYS_PWRITE64 29 | //sys Renameat(olddirfd int, oldpath string, newdirfd int, newpath string) (err error) 30 | //sys Seek(fd int, offset int64, whence int) (off int64, err error) = SYS_LSEEK 31 | //sys Select(nfd int, r *FdSet, w *FdSet, e *FdSet, timeout *Timeval) (n int, err error) 32 | //sys sendfile(outfd int, infd int, offset *int64, count int) (written int, err error) 33 | //sys Setfsgid(gid int) (err error) 34 | //sys Setfsuid(uid int) (err error) 35 | //sysnb Setregid(rgid int, egid int) (err error) 36 | //sysnb Setresgid(rgid int, egid int, sgid int) (err error) 37 | //sysnb Setresuid(ruid int, euid int, suid int) (err error) 38 | //sysnb Setrlimit(resource int, rlim *Rlimit) (err error) 39 | //sysnb Setreuid(ruid int, euid int) (err error) 40 | //sys Shutdown(fd int, how int) (err error) 41 | //sys Splice(rfd int, roff *int64, wfd int, woff *int64, len int, flags int) (n int64, err error) 42 | //sys Stat(path string, stat *Stat_t) (err error) 43 | //sys Statfs(path string, buf *Statfs_t) (err error) 44 | //sys SyncFileRange(fd int, off int64, n int64, flags int) (err error) 45 | //sys Truncate(path string, length int64) (err error) 46 | //sys accept(s int, rsa *RawSockaddrAny, addrlen *_Socklen) (fd int, err error) 47 | //sys accept4(s int, rsa *RawSockaddrAny, addrlen *_Socklen, flags int) (fd int, err error) 48 | //sys bind(s int, addr unsafe.Pointer, addrlen _Socklen) (err error) 49 | //sys connect(s int, addr unsafe.Pointer, addrlen _Socklen) (err error) 50 | //sysnb getgroups(n int, list *_Gid_t) (nn int, err error) 51 | //sysnb setgroups(n int, list *_Gid_t) (err error) 52 | //sys getsockopt(s int, level int, name int, val unsafe.Pointer, vallen *_Socklen) (err error) 53 | //sys setsockopt(s int, level int, name int, val unsafe.Pointer, vallen uintptr) (err error) 54 | //sysnb socket(domain int, typ int, proto int) (fd int, err error) 55 | //sysnb socketpair(domain int, typ int, proto int, fd *[2]int32) (err error) 56 | //sysnb getpeername(fd int, rsa *RawSockaddrAny, addrlen *_Socklen) (err error) 57 | //sysnb getsockname(fd int, rsa *RawSockaddrAny, addrlen *_Socklen) (err error) 58 | //sys recvfrom(fd int, p []byte, flags int, from *RawSockaddrAny, fromlen *_Socklen) (n int, err error) 59 | //sys sendto(s int, buf []byte, flags int, to unsafe.Pointer, addrlen _Socklen) (err error) 60 | //sys recvmsg(s int, msg *Msghdr, flags int) (n int, err error) 61 | //sys sendmsg(s int, msg *Msghdr, flags int) (n int, err error) 62 | //sys mmap(addr uintptr, length uintptr, prot int, flags int, fd int, offset int64) (xaddr uintptr, err error) 63 | 64 | func Ioperm(from int, num int, on int) (err error) { 65 | return ENOSYS 66 | } 67 | 68 | func Iopl(level int) (err error) { 69 | return ENOSYS 70 | } 71 | 72 | //sys futimesat(dirfd int, path string, times *[2]Timeval) (err error) 73 | //sysnb Gettimeofday(tv *Timeval) (err error) 74 | 75 | func Time(t *Time_t) (tt Time_t, err error) { 76 | var tv Timeval 77 | err = Gettimeofday(&tv) 78 | if err != nil { 79 | return 0, err 80 | } 81 | if t != nil { 82 | *t = Time_t(tv.Sec) 83 | } 84 | return Time_t(tv.Sec), nil 85 | } 86 | 87 | //sys Utime(path string, buf *Utimbuf) (err error) 88 | //sys utimes(path string, times *[2]Timeval) (err error) 89 | 90 | func setTimespec(sec, nsec int64) Timespec { 91 | return Timespec{Sec: sec, Nsec: nsec} 92 | } 93 | 94 | func setTimeval(sec, usec int64) Timeval { 95 | return Timeval{Sec: sec, Usec: int32(usec)} 96 | } 97 | 98 | func (r *PtraceRegs) PC() uint64 { return r.Tpc } 99 | 100 | func (r *PtraceRegs) SetPC(pc uint64) { r.Tpc = pc } 101 | 102 | func (iov *Iovec) SetLen(length int) { 103 | iov.Len = uint64(length) 104 | } 105 | 106 | func (msghdr *Msghdr) SetControllen(length int) { 107 | msghdr.Controllen = uint64(length) 108 | } 109 | 110 | func (cmsg *Cmsghdr) SetLen(length int) { 111 | cmsg.Len = uint64(length) 112 | } 113 | 114 | //sysnb pipe(p *[2]_C_int) (err error) 115 | 116 | func Pipe(p []int) (err error) { 117 | if len(p) != 2 { 118 | return EINVAL 119 | } 120 | var pp [2]_C_int 121 | err = pipe(&pp) 122 | p[0] = int(pp[0]) 123 | p[1] = int(pp[1]) 124 | return 125 | } 126 | 127 | //sysnb pipe2(p *[2]_C_int, flags int) (err error) 128 | 129 | func Pipe2(p []int, flags int) (err error) { 130 | if len(p) != 2 { 131 | return EINVAL 132 | } 133 | var pp [2]_C_int 134 | err = pipe2(&pp, flags) 135 | p[0] = int(pp[0]) 136 | p[1] = int(pp[1]) 137 | return 138 | } 139 | 140 | //sys poll(fds *PollFd, nfds int, timeout int) (n int, err error) 141 | 142 | func Poll(fds []PollFd, timeout int) (n int, err error) { 143 | if len(fds) == 0 { 144 | return poll(nil, 0, timeout) 145 | } 146 | return poll(&fds[0], len(fds), timeout) 147 | } 148 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/syscall_netbsd_386.go: -------------------------------------------------------------------------------- 1 | // Copyright 2009 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build 386,netbsd 6 | 7 | package unix 8 | 9 | func setTimespec(sec, nsec int64) Timespec { 10 | return Timespec{Sec: sec, Nsec: int32(nsec)} 11 | } 12 | 13 | func setTimeval(sec, usec int64) Timeval { 14 | return Timeval{Sec: sec, Usec: int32(usec)} 15 | } 16 | 17 | func SetKevent(k *Kevent_t, fd, mode, flags int) { 18 | k.Ident = uint32(fd) 19 | k.Filter = uint32(mode) 20 | k.Flags = uint32(flags) 21 | } 22 | 23 | func (iov *Iovec) SetLen(length int) { 24 | iov.Len = uint32(length) 25 | } 26 | 27 | func (msghdr *Msghdr) SetControllen(length int) { 28 | msghdr.Controllen = uint32(length) 29 | } 30 | 31 | func (cmsg *Cmsghdr) SetLen(length int) { 32 | cmsg.Len = uint32(length) 33 | } 34 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/syscall_netbsd_amd64.go: -------------------------------------------------------------------------------- 1 | // Copyright 2009 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build amd64,netbsd 6 | 7 | package unix 8 | 9 | func setTimespec(sec, nsec int64) Timespec { 10 | return Timespec{Sec: sec, Nsec: nsec} 11 | } 12 | 13 | func setTimeval(sec, usec int64) Timeval { 14 | return Timeval{Sec: sec, Usec: int32(usec)} 15 | } 16 | 17 | func SetKevent(k *Kevent_t, fd, mode, flags int) { 18 | k.Ident = uint64(fd) 19 | k.Filter = uint32(mode) 20 | k.Flags = uint32(flags) 21 | } 22 | 23 | func (iov *Iovec) SetLen(length int) { 24 | iov.Len = uint64(length) 25 | } 26 | 27 | func (msghdr *Msghdr) SetControllen(length int) { 28 | msghdr.Controllen = uint32(length) 29 | } 30 | 31 | func (cmsg *Cmsghdr) SetLen(length int) { 32 | cmsg.Len = uint32(length) 33 | } 34 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/syscall_netbsd_arm.go: -------------------------------------------------------------------------------- 1 | // Copyright 2013 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build arm,netbsd 6 | 7 | package unix 8 | 9 | func setTimespec(sec, nsec int64) Timespec { 10 | return Timespec{Sec: sec, Nsec: int32(nsec)} 11 | } 12 | 13 | func setTimeval(sec, usec int64) Timeval { 14 | return Timeval{Sec: sec, Usec: int32(usec)} 15 | } 16 | 17 | func SetKevent(k *Kevent_t, fd, mode, flags int) { 18 | k.Ident = uint32(fd) 19 | k.Filter = uint32(mode) 20 | k.Flags = uint32(flags) 21 | } 22 | 23 | func (iov *Iovec) SetLen(length int) { 24 | iov.Len = uint32(length) 25 | } 26 | 27 | func (msghdr *Msghdr) SetControllen(length int) { 28 | msghdr.Controllen = uint32(length) 29 | } 30 | 31 | func (cmsg *Cmsghdr) SetLen(length int) { 32 | cmsg.Len = uint32(length) 33 | } 34 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/syscall_netbsd_arm64.go: -------------------------------------------------------------------------------- 1 | // Copyright 2019 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build arm64,netbsd 6 | 7 | package unix 8 | 9 | func setTimespec(sec, nsec int64) Timespec { 10 | return Timespec{Sec: sec, Nsec: nsec} 11 | } 12 | 13 | func setTimeval(sec, usec int64) Timeval { 14 | return Timeval{Sec: sec, Usec: int32(usec)} 15 | } 16 | 17 | func SetKevent(k *Kevent_t, fd, mode, flags int) { 18 | k.Ident = uint64(fd) 19 | k.Filter = uint32(mode) 20 | k.Flags = uint32(flags) 21 | } 22 | 23 | func (iov *Iovec) SetLen(length int) { 24 | iov.Len = uint64(length) 25 | } 26 | 27 | func (msghdr *Msghdr) SetControllen(length int) { 28 | msghdr.Controllen = uint32(length) 29 | } 30 | 31 | func (cmsg *Cmsghdr) SetLen(length int) { 32 | cmsg.Len = uint32(length) 33 | } 34 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/syscall_openbsd_386.go: -------------------------------------------------------------------------------- 1 | // Copyright 2009 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build 386,openbsd 6 | 7 | package unix 8 | 9 | func setTimespec(sec, nsec int64) Timespec { 10 | return Timespec{Sec: sec, Nsec: int32(nsec)} 11 | } 12 | 13 | func setTimeval(sec, usec int64) Timeval { 14 | return Timeval{Sec: sec, Usec: int32(usec)} 15 | } 16 | 17 | func SetKevent(k *Kevent_t, fd, mode, flags int) { 18 | k.Ident = uint32(fd) 19 | k.Filter = int16(mode) 20 | k.Flags = uint16(flags) 21 | } 22 | 23 | func (iov *Iovec) SetLen(length int) { 24 | iov.Len = uint32(length) 25 | } 26 | 27 | func (msghdr *Msghdr) SetControllen(length int) { 28 | msghdr.Controllen = uint32(length) 29 | } 30 | 31 | func (cmsg *Cmsghdr) SetLen(length int) { 32 | cmsg.Len = uint32(length) 33 | } 34 | 35 | // SYS___SYSCTL is used by syscall_bsd.go for all BSDs, but in modern versions 36 | // of openbsd/386 the syscall is called sysctl instead of __sysctl. 37 | const SYS___SYSCTL = SYS_SYSCTL 38 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/syscall_openbsd_amd64.go: -------------------------------------------------------------------------------- 1 | // Copyright 2009 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build amd64,openbsd 6 | 7 | package unix 8 | 9 | func setTimespec(sec, nsec int64) Timespec { 10 | return Timespec{Sec: sec, Nsec: nsec} 11 | } 12 | 13 | func setTimeval(sec, usec int64) Timeval { 14 | return Timeval{Sec: sec, Usec: usec} 15 | } 16 | 17 | func SetKevent(k *Kevent_t, fd, mode, flags int) { 18 | k.Ident = uint64(fd) 19 | k.Filter = int16(mode) 20 | k.Flags = uint16(flags) 21 | } 22 | 23 | func (iov *Iovec) SetLen(length int) { 24 | iov.Len = uint64(length) 25 | } 26 | 27 | func (msghdr *Msghdr) SetControllen(length int) { 28 | msghdr.Controllen = uint32(length) 29 | } 30 | 31 | func (cmsg *Cmsghdr) SetLen(length int) { 32 | cmsg.Len = uint32(length) 33 | } 34 | 35 | // SYS___SYSCTL is used by syscall_bsd.go for all BSDs, but in modern versions 36 | // of openbsd/amd64 the syscall is called sysctl instead of __sysctl. 37 | const SYS___SYSCTL = SYS_SYSCTL 38 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/syscall_openbsd_arm.go: -------------------------------------------------------------------------------- 1 | // Copyright 2017 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build arm,openbsd 6 | 7 | package unix 8 | 9 | func setTimespec(sec, nsec int64) Timespec { 10 | return Timespec{Sec: sec, Nsec: int32(nsec)} 11 | } 12 | 13 | func setTimeval(sec, usec int64) Timeval { 14 | return Timeval{Sec: sec, Usec: int32(usec)} 15 | } 16 | 17 | func SetKevent(k *Kevent_t, fd, mode, flags int) { 18 | k.Ident = uint32(fd) 19 | k.Filter = int16(mode) 20 | k.Flags = uint16(flags) 21 | } 22 | 23 | func (iov *Iovec) SetLen(length int) { 24 | iov.Len = uint32(length) 25 | } 26 | 27 | func (msghdr *Msghdr) SetControllen(length int) { 28 | msghdr.Controllen = uint32(length) 29 | } 30 | 31 | func (cmsg *Cmsghdr) SetLen(length int) { 32 | cmsg.Len = uint32(length) 33 | } 34 | 35 | // SYS___SYSCTL is used by syscall_bsd.go for all BSDs, but in modern versions 36 | // of openbsd/arm the syscall is called sysctl instead of __sysctl. 37 | const SYS___SYSCTL = SYS_SYSCTL 38 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/syscall_openbsd_arm64.go: -------------------------------------------------------------------------------- 1 | // Copyright 2019 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build arm64,openbsd 6 | 7 | package unix 8 | 9 | func setTimespec(sec, nsec int64) Timespec { 10 | return Timespec{Sec: sec, Nsec: nsec} 11 | } 12 | 13 | func setTimeval(sec, usec int64) Timeval { 14 | return Timeval{Sec: sec, Usec: usec} 15 | } 16 | 17 | func SetKevent(k *Kevent_t, fd, mode, flags int) { 18 | k.Ident = uint64(fd) 19 | k.Filter = int16(mode) 20 | k.Flags = uint16(flags) 21 | } 22 | 23 | func (iov *Iovec) SetLen(length int) { 24 | iov.Len = uint64(length) 25 | } 26 | 27 | func (msghdr *Msghdr) SetControllen(length int) { 28 | msghdr.Controllen = uint32(length) 29 | } 30 | 31 | func (cmsg *Cmsghdr) SetLen(length int) { 32 | cmsg.Len = uint32(length) 33 | } 34 | 35 | // SYS___SYSCTL is used by syscall_bsd.go for all BSDs, but in modern versions 36 | // of openbsd/amd64 the syscall is called sysctl instead of __sysctl. 37 | const SYS___SYSCTL = SYS_SYSCTL 38 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/syscall_solaris_amd64.go: -------------------------------------------------------------------------------- 1 | // Copyright 2009 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build amd64,solaris 6 | 7 | package unix 8 | 9 | func setTimespec(sec, nsec int64) Timespec { 10 | return Timespec{Sec: sec, Nsec: nsec} 11 | } 12 | 13 | func setTimeval(sec, usec int64) Timeval { 14 | return Timeval{Sec: sec, Usec: usec} 15 | } 16 | 17 | func (iov *Iovec) SetLen(length int) { 18 | iov.Len = uint64(length) 19 | } 20 | 21 | func (cmsg *Cmsghdr) SetLen(length int) { 22 | cmsg.Len = uint32(length) 23 | } 24 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/syscall_unix_gc.go: -------------------------------------------------------------------------------- 1 | // Copyright 2016 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build darwin dragonfly freebsd linux netbsd openbsd solaris 6 | // +build !gccgo,!ppc64le,!ppc64 7 | 8 | package unix 9 | 10 | import "syscall" 11 | 12 | func Syscall(trap, a1, a2, a3 uintptr) (r1, r2 uintptr, err syscall.Errno) 13 | func Syscall6(trap, a1, a2, a3, a4, a5, a6 uintptr) (r1, r2 uintptr, err syscall.Errno) 14 | func RawSyscall(trap, a1, a2, a3 uintptr) (r1, r2 uintptr, err syscall.Errno) 15 | func RawSyscall6(trap, a1, a2, a3, a4, a5, a6 uintptr) (r1, r2 uintptr, err syscall.Errno) 16 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/syscall_unix_gc_ppc64x.go: -------------------------------------------------------------------------------- 1 | // Copyright 2018 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build linux 6 | // +build ppc64le ppc64 7 | // +build !gccgo 8 | 9 | package unix 10 | 11 | import "syscall" 12 | 13 | func Syscall(trap, a1, a2, a3 uintptr) (r1, r2 uintptr, err syscall.Errno) { 14 | return syscall.Syscall(trap, a1, a2, a3) 15 | } 16 | func Syscall6(trap, a1, a2, a3, a4, a5, a6 uintptr) (r1, r2 uintptr, err syscall.Errno) { 17 | return syscall.Syscall6(trap, a1, a2, a3, a4, a5, a6) 18 | } 19 | func RawSyscall(trap, a1, a2, a3 uintptr) (r1, r2 uintptr, err syscall.Errno) { 20 | return syscall.RawSyscall(trap, a1, a2, a3) 21 | } 22 | func RawSyscall6(trap, a1, a2, a3, a4, a5, a6 uintptr) (r1, r2 uintptr, err syscall.Errno) { 23 | return syscall.RawSyscall6(trap, a1, a2, a3, a4, a5, a6) 24 | } 25 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/timestruct.go: -------------------------------------------------------------------------------- 1 | // Copyright 2017 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build aix darwin dragonfly freebsd linux netbsd openbsd solaris 6 | 7 | package unix 8 | 9 | import "time" 10 | 11 | // TimespecToNsec converts a Timespec value into a number of 12 | // nanoseconds since the Unix epoch. 13 | func TimespecToNsec(ts Timespec) int64 { return int64(ts.Sec)*1e9 + int64(ts.Nsec) } 14 | 15 | // NsecToTimespec takes a number of nanoseconds since the Unix epoch 16 | // and returns the corresponding Timespec value. 17 | func NsecToTimespec(nsec int64) Timespec { 18 | sec := nsec / 1e9 19 | nsec = nsec % 1e9 20 | if nsec < 0 { 21 | nsec += 1e9 22 | sec-- 23 | } 24 | return setTimespec(sec, nsec) 25 | } 26 | 27 | // TimeToTimespec converts t into a Timespec. 28 | // On some 32-bit systems the range of valid Timespec values are smaller 29 | // than that of time.Time values. So if t is out of the valid range of 30 | // Timespec, it returns a zero Timespec and ERANGE. 31 | func TimeToTimespec(t time.Time) (Timespec, error) { 32 | sec := t.Unix() 33 | nsec := int64(t.Nanosecond()) 34 | ts := setTimespec(sec, nsec) 35 | 36 | // Currently all targets have either int32 or int64 for Timespec.Sec. 37 | // If there were a new target with floating point type for it, we have 38 | // to consider the rounding error. 39 | if int64(ts.Sec) != sec { 40 | return Timespec{}, ERANGE 41 | } 42 | return ts, nil 43 | } 44 | 45 | // TimevalToNsec converts a Timeval value into a number of nanoseconds 46 | // since the Unix epoch. 47 | func TimevalToNsec(tv Timeval) int64 { return int64(tv.Sec)*1e9 + int64(tv.Usec)*1e3 } 48 | 49 | // NsecToTimeval takes a number of nanoseconds since the Unix epoch 50 | // and returns the corresponding Timeval value. 51 | func NsecToTimeval(nsec int64) Timeval { 52 | nsec += 999 // round up to microsecond 53 | usec := nsec % 1e9 / 1e3 54 | sec := nsec / 1e9 55 | if usec < 0 { 56 | usec += 1e6 57 | sec-- 58 | } 59 | return setTimeval(sec, usec) 60 | } 61 | 62 | // Unix returns ts as the number of seconds and nanoseconds elapsed since the 63 | // Unix epoch. 64 | func (ts *Timespec) Unix() (sec int64, nsec int64) { 65 | return int64(ts.Sec), int64(ts.Nsec) 66 | } 67 | 68 | // Unix returns tv as the number of seconds and nanoseconds elapsed since the 69 | // Unix epoch. 70 | func (tv *Timeval) Unix() (sec int64, nsec int64) { 71 | return int64(tv.Sec), int64(tv.Usec) * 1000 72 | } 73 | 74 | // Nano returns ts as the number of nanoseconds elapsed since the Unix epoch. 75 | func (ts *Timespec) Nano() int64 { 76 | return int64(ts.Sec)*1e9 + int64(ts.Nsec) 77 | } 78 | 79 | // Nano returns tv as the number of nanoseconds elapsed since the Unix epoch. 80 | func (tv *Timeval) Nano() int64 { 81 | return int64(tv.Sec)*1e9 + int64(tv.Usec)*1000 82 | } 83 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/types_aix.go: -------------------------------------------------------------------------------- 1 | // Copyright 2018 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build ignore 6 | // +build aix 7 | 8 | /* 9 | Input to cgo -godefs. See also mkerrors.sh and mkall.sh 10 | */ 11 | 12 | // +godefs map struct_in_addr [4]byte /* in_addr */ 13 | // +godefs map struct_in6_addr [16]byte /* in6_addr */ 14 | 15 | package unix 16 | 17 | /* 18 | #include 19 | #include 20 | #include 21 | #include 22 | #include 23 | #include 24 | #include 25 | #include 26 | #include 27 | #include 28 | #include 29 | #include 30 | 31 | #include 32 | 33 | #include 34 | #include 35 | #include 36 | #include 37 | 38 | 39 | #include 40 | #include 41 | 42 | enum { 43 | sizeofPtr = sizeof(void*), 44 | }; 45 | 46 | union sockaddr_all { 47 | struct sockaddr s1; // this one gets used for fields 48 | struct sockaddr_in s2; // these pad it out 49 | struct sockaddr_in6 s3; 50 | struct sockaddr_un s4; 51 | struct sockaddr_dl s5; 52 | }; 53 | 54 | struct sockaddr_any { 55 | struct sockaddr addr; 56 | char pad[sizeof(union sockaddr_all) - sizeof(struct sockaddr)]; 57 | }; 58 | 59 | */ 60 | import "C" 61 | 62 | // Machine characteristics 63 | 64 | const ( 65 | SizeofPtr = C.sizeofPtr 66 | SizeofShort = C.sizeof_short 67 | SizeofInt = C.sizeof_int 68 | SizeofLong = C.sizeof_long 69 | SizeofLongLong = C.sizeof_longlong 70 | PathMax = C.PATH_MAX 71 | ) 72 | 73 | // Basic types 74 | 75 | type ( 76 | _C_short C.short 77 | _C_int C.int 78 | _C_long C.long 79 | _C_long_long C.longlong 80 | ) 81 | 82 | type off64 C.off64_t 83 | type off C.off_t 84 | type Mode_t C.mode_t 85 | 86 | // Time 87 | 88 | type Timespec C.struct_timespec 89 | 90 | type Timeval C.struct_timeval 91 | 92 | type Timeval32 C.struct_timeval32 93 | 94 | type Timex C.struct_timex 95 | 96 | type Time_t C.time_t 97 | 98 | type Tms C.struct_tms 99 | 100 | type Utimbuf C.struct_utimbuf 101 | 102 | type Timezone C.struct_timezone 103 | 104 | // Processes 105 | 106 | type Rusage C.struct_rusage 107 | 108 | type Rlimit C.struct_rlimit64 109 | 110 | type Pid_t C.pid_t 111 | 112 | type _Gid_t C.gid_t 113 | 114 | type dev_t C.dev_t 115 | 116 | // Files 117 | 118 | type Stat_t C.struct_stat 119 | 120 | type StatxTimestamp C.struct_statx_timestamp 121 | 122 | type Statx_t C.struct_statx 123 | 124 | type Dirent C.struct_dirent 125 | 126 | // Sockets 127 | 128 | type RawSockaddrInet4 C.struct_sockaddr_in 129 | 130 | type RawSockaddrInet6 C.struct_sockaddr_in6 131 | 132 | type RawSockaddrUnix C.struct_sockaddr_un 133 | 134 | type RawSockaddrDatalink C.struct_sockaddr_dl 135 | 136 | type RawSockaddr C.struct_sockaddr 137 | 138 | type RawSockaddrAny C.struct_sockaddr_any 139 | 140 | type _Socklen C.socklen_t 141 | 142 | type Cmsghdr C.struct_cmsghdr 143 | 144 | type ICMPv6Filter C.struct_icmp6_filter 145 | 146 | type Iovec C.struct_iovec 147 | 148 | type IPMreq C.struct_ip_mreq 149 | 150 | type IPv6Mreq C.struct_ipv6_mreq 151 | 152 | type IPv6MTUInfo C.struct_ip6_mtuinfo 153 | 154 | type Linger C.struct_linger 155 | 156 | type Msghdr C.struct_msghdr 157 | 158 | const ( 159 | SizeofSockaddrInet4 = C.sizeof_struct_sockaddr_in 160 | SizeofSockaddrInet6 = C.sizeof_struct_sockaddr_in6 161 | SizeofSockaddrAny = C.sizeof_struct_sockaddr_any 162 | SizeofSockaddrUnix = C.sizeof_struct_sockaddr_un 163 | SizeofSockaddrDatalink = C.sizeof_struct_sockaddr_dl 164 | SizeofLinger = C.sizeof_struct_linger 165 | SizeofIPMreq = C.sizeof_struct_ip_mreq 166 | SizeofIPv6Mreq = C.sizeof_struct_ipv6_mreq 167 | SizeofIPv6MTUInfo = C.sizeof_struct_ip6_mtuinfo 168 | SizeofMsghdr = C.sizeof_struct_msghdr 169 | SizeofCmsghdr = C.sizeof_struct_cmsghdr 170 | SizeofICMPv6Filter = C.sizeof_struct_icmp6_filter 171 | ) 172 | 173 | // Routing and interface messages 174 | 175 | const ( 176 | SizeofIfMsghdr = C.sizeof_struct_if_msghdr 177 | ) 178 | 179 | type IfMsgHdr C.struct_if_msghdr 180 | 181 | // Misc 182 | 183 | type FdSet C.fd_set 184 | 185 | type Utsname C.struct_utsname 186 | 187 | type Ustat_t C.struct_ustat 188 | 189 | type Sigset_t C.sigset_t 190 | 191 | const ( 192 | AT_FDCWD = C.AT_FDCWD 193 | AT_REMOVEDIR = C.AT_REMOVEDIR 194 | AT_SYMLINK_NOFOLLOW = C.AT_SYMLINK_NOFOLLOW 195 | ) 196 | 197 | // Terminal handling 198 | 199 | type Termios C.struct_termios 200 | 201 | type Termio C.struct_termio 202 | 203 | type Winsize C.struct_winsize 204 | 205 | //poll 206 | 207 | type PollFd struct { 208 | Fd int32 209 | Events uint16 210 | Revents uint16 211 | } 212 | 213 | const ( 214 | POLLERR = C.POLLERR 215 | POLLHUP = C.POLLHUP 216 | POLLIN = C.POLLIN 217 | POLLNVAL = C.POLLNVAL 218 | POLLOUT = C.POLLOUT 219 | POLLPRI = C.POLLPRI 220 | POLLRDBAND = C.POLLRDBAND 221 | POLLRDNORM = C.POLLRDNORM 222 | POLLWRBAND = C.POLLWRBAND 223 | POLLWRNORM = C.POLLWRNORM 224 | ) 225 | 226 | //flock_t 227 | 228 | type Flock_t C.struct_flock64 229 | 230 | // Statfs 231 | 232 | type Fsid_t C.struct_fsid_t 233 | type Fsid64_t C.struct_fsid64_t 234 | 235 | type Statfs_t C.struct_statfs 236 | 237 | const RNDGETENTCNT = 0x80045200 238 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/types_dragonfly.go: -------------------------------------------------------------------------------- 1 | // Copyright 2009 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build ignore 6 | 7 | /* 8 | Input to cgo -godefs. See README.md 9 | */ 10 | 11 | // +godefs map struct_in_addr [4]byte /* in_addr */ 12 | // +godefs map struct_in6_addr [16]byte /* in6_addr */ 13 | 14 | package unix 15 | 16 | /* 17 | #define KERNEL 18 | #include 19 | #include 20 | #include 21 | #include 22 | #include 23 | #include 24 | #include 25 | #include 26 | #include 27 | #include 28 | #include 29 | #include 30 | #include 31 | #include 32 | #include 33 | #include 34 | #include 35 | #include 36 | #include 37 | #include 38 | #include 39 | #include 40 | #include 41 | #include 42 | #include 43 | #include 44 | #include 45 | #include 46 | #include 47 | 48 | enum { 49 | sizeofPtr = sizeof(void*), 50 | }; 51 | 52 | union sockaddr_all { 53 | struct sockaddr s1; // this one gets used for fields 54 | struct sockaddr_in s2; // these pad it out 55 | struct sockaddr_in6 s3; 56 | struct sockaddr_un s4; 57 | struct sockaddr_dl s5; 58 | }; 59 | 60 | struct sockaddr_any { 61 | struct sockaddr addr; 62 | char pad[sizeof(union sockaddr_all) - sizeof(struct sockaddr)]; 63 | }; 64 | 65 | */ 66 | import "C" 67 | 68 | // Machine characteristics 69 | 70 | const ( 71 | SizeofPtr = C.sizeofPtr 72 | SizeofShort = C.sizeof_short 73 | SizeofInt = C.sizeof_int 74 | SizeofLong = C.sizeof_long 75 | SizeofLongLong = C.sizeof_longlong 76 | ) 77 | 78 | // Basic types 79 | 80 | type ( 81 | _C_short C.short 82 | _C_int C.int 83 | _C_long C.long 84 | _C_long_long C.longlong 85 | ) 86 | 87 | // Time 88 | 89 | type Timespec C.struct_timespec 90 | 91 | type Timeval C.struct_timeval 92 | 93 | // Processes 94 | 95 | type Rusage C.struct_rusage 96 | 97 | type Rlimit C.struct_rlimit 98 | 99 | type _Gid_t C.gid_t 100 | 101 | // Files 102 | 103 | type Stat_t C.struct_stat 104 | 105 | type Statfs_t C.struct_statfs 106 | 107 | type Flock_t C.struct_flock 108 | 109 | type Dirent C.struct_dirent 110 | 111 | type Fsid C.struct_fsid 112 | 113 | // File system limits 114 | 115 | const ( 116 | PathMax = C.PATH_MAX 117 | ) 118 | 119 | // Sockets 120 | 121 | type RawSockaddrInet4 C.struct_sockaddr_in 122 | 123 | type RawSockaddrInet6 C.struct_sockaddr_in6 124 | 125 | type RawSockaddrUnix C.struct_sockaddr_un 126 | 127 | type RawSockaddrDatalink C.struct_sockaddr_dl 128 | 129 | type RawSockaddr C.struct_sockaddr 130 | 131 | type RawSockaddrAny C.struct_sockaddr_any 132 | 133 | type _Socklen C.socklen_t 134 | 135 | type Linger C.struct_linger 136 | 137 | type Iovec C.struct_iovec 138 | 139 | type IPMreq C.struct_ip_mreq 140 | 141 | type IPv6Mreq C.struct_ipv6_mreq 142 | 143 | type Msghdr C.struct_msghdr 144 | 145 | type Cmsghdr C.struct_cmsghdr 146 | 147 | type Inet6Pktinfo C.struct_in6_pktinfo 148 | 149 | type IPv6MTUInfo C.struct_ip6_mtuinfo 150 | 151 | type ICMPv6Filter C.struct_icmp6_filter 152 | 153 | const ( 154 | SizeofSockaddrInet4 = C.sizeof_struct_sockaddr_in 155 | SizeofSockaddrInet6 = C.sizeof_struct_sockaddr_in6 156 | SizeofSockaddrAny = C.sizeof_struct_sockaddr_any 157 | SizeofSockaddrUnix = C.sizeof_struct_sockaddr_un 158 | SizeofSockaddrDatalink = C.sizeof_struct_sockaddr_dl 159 | SizeofLinger = C.sizeof_struct_linger 160 | SizeofIPMreq = C.sizeof_struct_ip_mreq 161 | SizeofIPv6Mreq = C.sizeof_struct_ipv6_mreq 162 | SizeofMsghdr = C.sizeof_struct_msghdr 163 | SizeofCmsghdr = C.sizeof_struct_cmsghdr 164 | SizeofInet6Pktinfo = C.sizeof_struct_in6_pktinfo 165 | SizeofIPv6MTUInfo = C.sizeof_struct_ip6_mtuinfo 166 | SizeofICMPv6Filter = C.sizeof_struct_icmp6_filter 167 | ) 168 | 169 | // Ptrace requests 170 | 171 | const ( 172 | PTRACE_TRACEME = C.PT_TRACE_ME 173 | PTRACE_CONT = C.PT_CONTINUE 174 | PTRACE_KILL = C.PT_KILL 175 | ) 176 | 177 | // Events (kqueue, kevent) 178 | 179 | type Kevent_t C.struct_kevent 180 | 181 | // Select 182 | 183 | type FdSet C.fd_set 184 | 185 | // Routing and interface messages 186 | 187 | const ( 188 | SizeofIfMsghdr = C.sizeof_struct_if_msghdr 189 | SizeofIfData = C.sizeof_struct_if_data 190 | SizeofIfaMsghdr = C.sizeof_struct_ifa_msghdr 191 | SizeofIfmaMsghdr = C.sizeof_struct_ifma_msghdr 192 | SizeofIfAnnounceMsghdr = C.sizeof_struct_if_announcemsghdr 193 | SizeofRtMsghdr = C.sizeof_struct_rt_msghdr 194 | SizeofRtMetrics = C.sizeof_struct_rt_metrics 195 | ) 196 | 197 | type IfMsghdr C.struct_if_msghdr 198 | 199 | type IfData C.struct_if_data 200 | 201 | type IfaMsghdr C.struct_ifa_msghdr 202 | 203 | type IfmaMsghdr C.struct_ifma_msghdr 204 | 205 | type IfAnnounceMsghdr C.struct_if_announcemsghdr 206 | 207 | type RtMsghdr C.struct_rt_msghdr 208 | 209 | type RtMetrics C.struct_rt_metrics 210 | 211 | // Berkeley packet filter 212 | 213 | const ( 214 | SizeofBpfVersion = C.sizeof_struct_bpf_version 215 | SizeofBpfStat = C.sizeof_struct_bpf_stat 216 | SizeofBpfProgram = C.sizeof_struct_bpf_program 217 | SizeofBpfInsn = C.sizeof_struct_bpf_insn 218 | SizeofBpfHdr = C.sizeof_struct_bpf_hdr 219 | ) 220 | 221 | type BpfVersion C.struct_bpf_version 222 | 223 | type BpfStat C.struct_bpf_stat 224 | 225 | type BpfProgram C.struct_bpf_program 226 | 227 | type BpfInsn C.struct_bpf_insn 228 | 229 | type BpfHdr C.struct_bpf_hdr 230 | 231 | // Terminal handling 232 | 233 | type Termios C.struct_termios 234 | 235 | type Winsize C.struct_winsize 236 | 237 | // fchmodat-like syscalls. 238 | 239 | const ( 240 | AT_FDCWD = C.AT_FDCWD 241 | AT_SYMLINK_NOFOLLOW = C.AT_SYMLINK_NOFOLLOW 242 | ) 243 | 244 | // poll 245 | 246 | type PollFd C.struct_pollfd 247 | 248 | const ( 249 | POLLERR = C.POLLERR 250 | POLLHUP = C.POLLHUP 251 | POLLIN = C.POLLIN 252 | POLLNVAL = C.POLLNVAL 253 | POLLOUT = C.POLLOUT 254 | POLLPRI = C.POLLPRI 255 | POLLRDBAND = C.POLLRDBAND 256 | POLLRDNORM = C.POLLRDNORM 257 | POLLWRBAND = C.POLLWRBAND 258 | POLLWRNORM = C.POLLWRNORM 259 | ) 260 | 261 | // Uname 262 | 263 | type Utsname C.struct_utsname 264 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/types_solaris.go: -------------------------------------------------------------------------------- 1 | // Copyright 2009 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build ignore 6 | 7 | /* 8 | Input to cgo -godefs. See README.md 9 | */ 10 | 11 | // +godefs map struct_in_addr [4]byte /* in_addr */ 12 | // +godefs map struct_in6_addr [16]byte /* in6_addr */ 13 | 14 | package unix 15 | 16 | /* 17 | #define KERNEL 18 | // These defines ensure that builds done on newer versions of Solaris are 19 | // backwards-compatible with older versions of Solaris and 20 | // OpenSolaris-based derivatives. 21 | #define __USE_SUNOS_SOCKETS__ // msghdr 22 | #define __USE_LEGACY_PROTOTYPES__ // iovec 23 | #include 24 | #include 25 | #include 26 | #include 27 | #include 28 | #include 29 | #include 30 | #include 31 | #include 32 | #include 33 | #include 34 | #include 35 | #include 36 | #include 37 | #include 38 | #include 39 | #include 40 | #include 41 | #include 42 | #include 43 | #include 44 | #include 45 | #include 46 | #include 47 | #include 48 | #include 49 | #include 50 | #include 51 | #include 52 | #include 53 | #include 54 | #include 55 | #include 56 | #include 57 | 58 | enum { 59 | sizeofPtr = sizeof(void*), 60 | }; 61 | 62 | union sockaddr_all { 63 | struct sockaddr s1; // this one gets used for fields 64 | struct sockaddr_in s2; // these pad it out 65 | struct sockaddr_in6 s3; 66 | struct sockaddr_un s4; 67 | struct sockaddr_dl s5; 68 | }; 69 | 70 | struct sockaddr_any { 71 | struct sockaddr addr; 72 | char pad[sizeof(union sockaddr_all) - sizeof(struct sockaddr)]; 73 | }; 74 | 75 | */ 76 | import "C" 77 | 78 | // Machine characteristics 79 | 80 | const ( 81 | SizeofPtr = C.sizeofPtr 82 | SizeofShort = C.sizeof_short 83 | SizeofInt = C.sizeof_int 84 | SizeofLong = C.sizeof_long 85 | SizeofLongLong = C.sizeof_longlong 86 | PathMax = C.PATH_MAX 87 | MaxHostNameLen = C.MAXHOSTNAMELEN 88 | ) 89 | 90 | // Basic types 91 | 92 | type ( 93 | _C_short C.short 94 | _C_int C.int 95 | _C_long C.long 96 | _C_long_long C.longlong 97 | ) 98 | 99 | // Time 100 | 101 | type Timespec C.struct_timespec 102 | 103 | type Timeval C.struct_timeval 104 | 105 | type Timeval32 C.struct_timeval32 106 | 107 | type Tms C.struct_tms 108 | 109 | type Utimbuf C.struct_utimbuf 110 | 111 | // Processes 112 | 113 | type Rusage C.struct_rusage 114 | 115 | type Rlimit C.struct_rlimit 116 | 117 | type _Gid_t C.gid_t 118 | 119 | // Files 120 | 121 | type Stat_t C.struct_stat 122 | 123 | type Flock_t C.struct_flock 124 | 125 | type Dirent C.struct_dirent 126 | 127 | // Filesystems 128 | 129 | type _Fsblkcnt_t C.fsblkcnt_t 130 | 131 | type Statvfs_t C.struct_statvfs 132 | 133 | // Sockets 134 | 135 | type RawSockaddrInet4 C.struct_sockaddr_in 136 | 137 | type RawSockaddrInet6 C.struct_sockaddr_in6 138 | 139 | type RawSockaddrUnix C.struct_sockaddr_un 140 | 141 | type RawSockaddrDatalink C.struct_sockaddr_dl 142 | 143 | type RawSockaddr C.struct_sockaddr 144 | 145 | type RawSockaddrAny C.struct_sockaddr_any 146 | 147 | type _Socklen C.socklen_t 148 | 149 | type Linger C.struct_linger 150 | 151 | type Iovec C.struct_iovec 152 | 153 | type IPMreq C.struct_ip_mreq 154 | 155 | type IPv6Mreq C.struct_ipv6_mreq 156 | 157 | type Msghdr C.struct_msghdr 158 | 159 | type Cmsghdr C.struct_cmsghdr 160 | 161 | type Inet6Pktinfo C.struct_in6_pktinfo 162 | 163 | type IPv6MTUInfo C.struct_ip6_mtuinfo 164 | 165 | type ICMPv6Filter C.struct_icmp6_filter 166 | 167 | const ( 168 | SizeofSockaddrInet4 = C.sizeof_struct_sockaddr_in 169 | SizeofSockaddrInet6 = C.sizeof_struct_sockaddr_in6 170 | SizeofSockaddrAny = C.sizeof_struct_sockaddr_any 171 | SizeofSockaddrUnix = C.sizeof_struct_sockaddr_un 172 | SizeofSockaddrDatalink = C.sizeof_struct_sockaddr_dl 173 | SizeofLinger = C.sizeof_struct_linger 174 | SizeofIPMreq = C.sizeof_struct_ip_mreq 175 | SizeofIPv6Mreq = C.sizeof_struct_ipv6_mreq 176 | SizeofMsghdr = C.sizeof_struct_msghdr 177 | SizeofCmsghdr = C.sizeof_struct_cmsghdr 178 | SizeofInet6Pktinfo = C.sizeof_struct_in6_pktinfo 179 | SizeofIPv6MTUInfo = C.sizeof_struct_ip6_mtuinfo 180 | SizeofICMPv6Filter = C.sizeof_struct_icmp6_filter 181 | ) 182 | 183 | // Select 184 | 185 | type FdSet C.fd_set 186 | 187 | // Misc 188 | 189 | type Utsname C.struct_utsname 190 | 191 | type Ustat_t C.struct_ustat 192 | 193 | const ( 194 | AT_FDCWD = C.AT_FDCWD 195 | AT_SYMLINK_NOFOLLOW = C.AT_SYMLINK_NOFOLLOW 196 | AT_SYMLINK_FOLLOW = C.AT_SYMLINK_FOLLOW 197 | AT_REMOVEDIR = C.AT_REMOVEDIR 198 | AT_EACCESS = C.AT_EACCESS 199 | ) 200 | 201 | // Routing and interface messages 202 | 203 | const ( 204 | SizeofIfMsghdr = C.sizeof_struct_if_msghdr 205 | SizeofIfData = C.sizeof_struct_if_data 206 | SizeofIfaMsghdr = C.sizeof_struct_ifa_msghdr 207 | SizeofRtMsghdr = C.sizeof_struct_rt_msghdr 208 | SizeofRtMetrics = C.sizeof_struct_rt_metrics 209 | ) 210 | 211 | type IfMsghdr C.struct_if_msghdr 212 | 213 | type IfData C.struct_if_data 214 | 215 | type IfaMsghdr C.struct_ifa_msghdr 216 | 217 | type RtMsghdr C.struct_rt_msghdr 218 | 219 | type RtMetrics C.struct_rt_metrics 220 | 221 | // Berkeley packet filter 222 | 223 | const ( 224 | SizeofBpfVersion = C.sizeof_struct_bpf_version 225 | SizeofBpfStat = C.sizeof_struct_bpf_stat 226 | SizeofBpfProgram = C.sizeof_struct_bpf_program 227 | SizeofBpfInsn = C.sizeof_struct_bpf_insn 228 | SizeofBpfHdr = C.sizeof_struct_bpf_hdr 229 | ) 230 | 231 | type BpfVersion C.struct_bpf_version 232 | 233 | type BpfStat C.struct_bpf_stat 234 | 235 | type BpfProgram C.struct_bpf_program 236 | 237 | type BpfInsn C.struct_bpf_insn 238 | 239 | type BpfTimeval C.struct_bpf_timeval 240 | 241 | type BpfHdr C.struct_bpf_hdr 242 | 243 | // Terminal handling 244 | 245 | type Termios C.struct_termios 246 | 247 | type Termio C.struct_termio 248 | 249 | type Winsize C.struct_winsize 250 | 251 | // poll 252 | 253 | type PollFd C.struct_pollfd 254 | 255 | const ( 256 | POLLERR = C.POLLERR 257 | POLLHUP = C.POLLHUP 258 | POLLIN = C.POLLIN 259 | POLLNVAL = C.POLLNVAL 260 | POLLOUT = C.POLLOUT 261 | POLLPRI = C.POLLPRI 262 | POLLRDBAND = C.POLLRDBAND 263 | POLLRDNORM = C.POLLRDNORM 264 | POLLWRBAND = C.POLLWRBAND 265 | POLLWRNORM = C.POLLWRNORM 266 | ) 267 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/unveil_openbsd.go: -------------------------------------------------------------------------------- 1 | // Copyright 2018 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | package unix 6 | 7 | import ( 8 | "syscall" 9 | "unsafe" 10 | ) 11 | 12 | // Unveil implements the unveil syscall. 13 | // For more information see unveil(2). 14 | // Note that the special case of blocking further 15 | // unveil calls is handled by UnveilBlock. 16 | func Unveil(path string, flags string) error { 17 | pathPtr, err := syscall.BytePtrFromString(path) 18 | if err != nil { 19 | return err 20 | } 21 | flagsPtr, err := syscall.BytePtrFromString(flags) 22 | if err != nil { 23 | return err 24 | } 25 | _, _, e := syscall.Syscall(SYS_UNVEIL, uintptr(unsafe.Pointer(pathPtr)), uintptr(unsafe.Pointer(flagsPtr)), 0) 26 | if e != 0 { 27 | return e 28 | } 29 | return nil 30 | } 31 | 32 | // UnveilBlock blocks future unveil calls. 33 | // For more information see unveil(2). 34 | func UnveilBlock() error { 35 | // Both pointers must be nil. 36 | var pathUnsafe, flagsUnsafe unsafe.Pointer 37 | _, _, e := syscall.Syscall(SYS_UNVEIL, uintptr(pathUnsafe), uintptr(flagsUnsafe), 0) 38 | if e != 0 { 39 | return e 40 | } 41 | return nil 42 | } 43 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/xattr_bsd.go: -------------------------------------------------------------------------------- 1 | // Copyright 2018 The Go Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build freebsd netbsd 6 | 7 | package unix 8 | 9 | import ( 10 | "strings" 11 | "unsafe" 12 | ) 13 | 14 | // Derive extattr namespace and attribute name 15 | 16 | func xattrnamespace(fullattr string) (ns int, attr string, err error) { 17 | s := strings.IndexByte(fullattr, '.') 18 | if s == -1 { 19 | return -1, "", ENOATTR 20 | } 21 | 22 | namespace := fullattr[0:s] 23 | attr = fullattr[s+1:] 24 | 25 | switch namespace { 26 | case "user": 27 | return EXTATTR_NAMESPACE_USER, attr, nil 28 | case "system": 29 | return EXTATTR_NAMESPACE_SYSTEM, attr, nil 30 | default: 31 | return -1, "", ENOATTR 32 | } 33 | } 34 | 35 | func initxattrdest(dest []byte, idx int) (d unsafe.Pointer) { 36 | if len(dest) > idx { 37 | return unsafe.Pointer(&dest[idx]) 38 | } else { 39 | return unsafe.Pointer(_zero) 40 | } 41 | } 42 | 43 | // FreeBSD and NetBSD implement their own syscalls to handle extended attributes 44 | 45 | func Getxattr(file string, attr string, dest []byte) (sz int, err error) { 46 | d := initxattrdest(dest, 0) 47 | destsize := len(dest) 48 | 49 | nsid, a, err := xattrnamespace(attr) 50 | if err != nil { 51 | return -1, err 52 | } 53 | 54 | return ExtattrGetFile(file, nsid, a, uintptr(d), destsize) 55 | } 56 | 57 | func Fgetxattr(fd int, attr string, dest []byte) (sz int, err error) { 58 | d := initxattrdest(dest, 0) 59 | destsize := len(dest) 60 | 61 | nsid, a, err := xattrnamespace(attr) 62 | if err != nil { 63 | return -1, err 64 | } 65 | 66 | return ExtattrGetFd(fd, nsid, a, uintptr(d), destsize) 67 | } 68 | 69 | func Lgetxattr(link string, attr string, dest []byte) (sz int, err error) { 70 | d := initxattrdest(dest, 0) 71 | destsize := len(dest) 72 | 73 | nsid, a, err := xattrnamespace(attr) 74 | if err != nil { 75 | return -1, err 76 | } 77 | 78 | return ExtattrGetLink(link, nsid, a, uintptr(d), destsize) 79 | } 80 | 81 | // flags are unused on FreeBSD 82 | 83 | func Fsetxattr(fd int, attr string, data []byte, flags int) (err error) { 84 | var d unsafe.Pointer 85 | if len(data) > 0 { 86 | d = unsafe.Pointer(&data[0]) 87 | } 88 | datasiz := len(data) 89 | 90 | nsid, a, err := xattrnamespace(attr) 91 | if err != nil { 92 | return 93 | } 94 | 95 | _, err = ExtattrSetFd(fd, nsid, a, uintptr(d), datasiz) 96 | return 97 | } 98 | 99 | func Setxattr(file string, attr string, data []byte, flags int) (err error) { 100 | var d unsafe.Pointer 101 | if len(data) > 0 { 102 | d = unsafe.Pointer(&data[0]) 103 | } 104 | datasiz := len(data) 105 | 106 | nsid, a, err := xattrnamespace(attr) 107 | if err != nil { 108 | return 109 | } 110 | 111 | _, err = ExtattrSetFile(file, nsid, a, uintptr(d), datasiz) 112 | return 113 | } 114 | 115 | func Lsetxattr(link string, attr string, data []byte, flags int) (err error) { 116 | var d unsafe.Pointer 117 | if len(data) > 0 { 118 | d = unsafe.Pointer(&data[0]) 119 | } 120 | datasiz := len(data) 121 | 122 | nsid, a, err := xattrnamespace(attr) 123 | if err != nil { 124 | return 125 | } 126 | 127 | _, err = ExtattrSetLink(link, nsid, a, uintptr(d), datasiz) 128 | return 129 | } 130 | 131 | func Removexattr(file string, attr string) (err error) { 132 | nsid, a, err := xattrnamespace(attr) 133 | if err != nil { 134 | return 135 | } 136 | 137 | err = ExtattrDeleteFile(file, nsid, a) 138 | return 139 | } 140 | 141 | func Fremovexattr(fd int, attr string) (err error) { 142 | nsid, a, err := xattrnamespace(attr) 143 | if err != nil { 144 | return 145 | } 146 | 147 | err = ExtattrDeleteFd(fd, nsid, a) 148 | return 149 | } 150 | 151 | func Lremovexattr(link string, attr string) (err error) { 152 | nsid, a, err := xattrnamespace(attr) 153 | if err != nil { 154 | return 155 | } 156 | 157 | err = ExtattrDeleteLink(link, nsid, a) 158 | return 159 | } 160 | 161 | func Listxattr(file string, dest []byte) (sz int, err error) { 162 | d := initxattrdest(dest, 0) 163 | destsiz := len(dest) 164 | 165 | // FreeBSD won't allow you to list xattrs from multiple namespaces 166 | s := 0 167 | for _, nsid := range [...]int{EXTATTR_NAMESPACE_USER, EXTATTR_NAMESPACE_SYSTEM} { 168 | stmp, e := ExtattrListFile(file, nsid, uintptr(d), destsiz) 169 | 170 | /* Errors accessing system attrs are ignored so that 171 | * we can implement the Linux-like behavior of omitting errors that 172 | * we don't have read permissions on 173 | * 174 | * Linux will still error if we ask for user attributes on a file that 175 | * we don't have read permissions on, so don't ignore those errors 176 | */ 177 | if e != nil && e == EPERM && nsid != EXTATTR_NAMESPACE_USER { 178 | continue 179 | } else if e != nil { 180 | return s, e 181 | } 182 | 183 | s += stmp 184 | destsiz -= s 185 | if destsiz < 0 { 186 | destsiz = 0 187 | } 188 | d = initxattrdest(dest, s) 189 | } 190 | 191 | return s, nil 192 | } 193 | 194 | func Flistxattr(fd int, dest []byte) (sz int, err error) { 195 | d := initxattrdest(dest, 0) 196 | destsiz := len(dest) 197 | 198 | s := 0 199 | for _, nsid := range [...]int{EXTATTR_NAMESPACE_USER, EXTATTR_NAMESPACE_SYSTEM} { 200 | stmp, e := ExtattrListFd(fd, nsid, uintptr(d), destsiz) 201 | if e != nil && e == EPERM && nsid != EXTATTR_NAMESPACE_USER { 202 | continue 203 | } else if e != nil { 204 | return s, e 205 | } 206 | 207 | s += stmp 208 | destsiz -= s 209 | if destsiz < 0 { 210 | destsiz = 0 211 | } 212 | d = initxattrdest(dest, s) 213 | } 214 | 215 | return s, nil 216 | } 217 | 218 | func Llistxattr(link string, dest []byte) (sz int, err error) { 219 | d := initxattrdest(dest, 0) 220 | destsiz := len(dest) 221 | 222 | s := 0 223 | for _, nsid := range [...]int{EXTATTR_NAMESPACE_USER, EXTATTR_NAMESPACE_SYSTEM} { 224 | stmp, e := ExtattrListLink(link, nsid, uintptr(d), destsiz) 225 | if e != nil && e == EPERM && nsid != EXTATTR_NAMESPACE_USER { 226 | continue 227 | } else if e != nil { 228 | return s, e 229 | } 230 | 231 | s += stmp 232 | destsiz -= s 233 | if destsiz < 0 { 234 | destsiz = 0 235 | } 236 | d = initxattrdest(dest, s) 237 | } 238 | 239 | return s, nil 240 | } 241 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/zptrace386_linux.go: -------------------------------------------------------------------------------- 1 | // Code generated by linux/mkall.go generatePtracePair(386, amd64). DO NOT EDIT. 2 | 3 | // +build linux 4 | // +build 386 amd64 5 | 6 | package unix 7 | 8 | import "unsafe" 9 | 10 | // PtraceRegs386 is the registers used by 386 binaries. 11 | type PtraceRegs386 struct { 12 | Ebx int32 13 | Ecx int32 14 | Edx int32 15 | Esi int32 16 | Edi int32 17 | Ebp int32 18 | Eax int32 19 | Xds int32 20 | Xes int32 21 | Xfs int32 22 | Xgs int32 23 | Orig_eax int32 24 | Eip int32 25 | Xcs int32 26 | Eflags int32 27 | Esp int32 28 | Xss int32 29 | } 30 | 31 | // PtraceGetRegs386 fetches the registers used by 386 binaries. 32 | func PtraceGetRegs386(pid int, regsout *PtraceRegs386) error { 33 | return ptrace(PTRACE_GETREGS, pid, 0, uintptr(unsafe.Pointer(regsout))) 34 | } 35 | 36 | // PtraceSetRegs386 sets the registers used by 386 binaries. 37 | func PtraceSetRegs386(pid int, regs *PtraceRegs386) error { 38 | return ptrace(PTRACE_SETREGS, pid, 0, uintptr(unsafe.Pointer(regs))) 39 | } 40 | 41 | // PtraceRegsAmd64 is the registers used by amd64 binaries. 42 | type PtraceRegsAmd64 struct { 43 | R15 uint64 44 | R14 uint64 45 | R13 uint64 46 | R12 uint64 47 | Rbp uint64 48 | Rbx uint64 49 | R11 uint64 50 | R10 uint64 51 | R9 uint64 52 | R8 uint64 53 | Rax uint64 54 | Rcx uint64 55 | Rdx uint64 56 | Rsi uint64 57 | Rdi uint64 58 | Orig_rax uint64 59 | Rip uint64 60 | Cs uint64 61 | Eflags uint64 62 | Rsp uint64 63 | Ss uint64 64 | Fs_base uint64 65 | Gs_base uint64 66 | Ds uint64 67 | Es uint64 68 | Fs uint64 69 | Gs uint64 70 | } 71 | 72 | // PtraceGetRegsAmd64 fetches the registers used by amd64 binaries. 73 | func PtraceGetRegsAmd64(pid int, regsout *PtraceRegsAmd64) error { 74 | return ptrace(PTRACE_GETREGS, pid, 0, uintptr(unsafe.Pointer(regsout))) 75 | } 76 | 77 | // PtraceSetRegsAmd64 sets the registers used by amd64 binaries. 78 | func PtraceSetRegsAmd64(pid int, regs *PtraceRegsAmd64) error { 79 | return ptrace(PTRACE_SETREGS, pid, 0, uintptr(unsafe.Pointer(regs))) 80 | } 81 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/zptracearm_linux.go: -------------------------------------------------------------------------------- 1 | // Code generated by linux/mkall.go generatePtracePair(arm, arm64). DO NOT EDIT. 2 | 3 | // +build linux 4 | // +build arm arm64 5 | 6 | package unix 7 | 8 | import "unsafe" 9 | 10 | // PtraceRegsArm is the registers used by arm binaries. 11 | type PtraceRegsArm struct { 12 | Uregs [18]uint32 13 | } 14 | 15 | // PtraceGetRegsArm fetches the registers used by arm binaries. 16 | func PtraceGetRegsArm(pid int, regsout *PtraceRegsArm) error { 17 | return ptrace(PTRACE_GETREGS, pid, 0, uintptr(unsafe.Pointer(regsout))) 18 | } 19 | 20 | // PtraceSetRegsArm sets the registers used by arm binaries. 21 | func PtraceSetRegsArm(pid int, regs *PtraceRegsArm) error { 22 | return ptrace(PTRACE_SETREGS, pid, 0, uintptr(unsafe.Pointer(regs))) 23 | } 24 | 25 | // PtraceRegsArm64 is the registers used by arm64 binaries. 26 | type PtraceRegsArm64 struct { 27 | Regs [31]uint64 28 | Sp uint64 29 | Pc uint64 30 | Pstate uint64 31 | } 32 | 33 | // PtraceGetRegsArm64 fetches the registers used by arm64 binaries. 34 | func PtraceGetRegsArm64(pid int, regsout *PtraceRegsArm64) error { 35 | return ptrace(PTRACE_GETREGS, pid, 0, uintptr(unsafe.Pointer(regsout))) 36 | } 37 | 38 | // PtraceSetRegsArm64 sets the registers used by arm64 binaries. 39 | func PtraceSetRegsArm64(pid int, regs *PtraceRegsArm64) error { 40 | return ptrace(PTRACE_SETREGS, pid, 0, uintptr(unsafe.Pointer(regs))) 41 | } 42 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/zptracemips_linux.go: -------------------------------------------------------------------------------- 1 | // Code generated by linux/mkall.go generatePtracePair(mips, mips64). DO NOT EDIT. 2 | 3 | // +build linux 4 | // +build mips mips64 5 | 6 | package unix 7 | 8 | import "unsafe" 9 | 10 | // PtraceRegsMips is the registers used by mips binaries. 11 | type PtraceRegsMips struct { 12 | Regs [32]uint64 13 | Lo uint64 14 | Hi uint64 15 | Epc uint64 16 | Badvaddr uint64 17 | Status uint64 18 | Cause uint64 19 | } 20 | 21 | // PtraceGetRegsMips fetches the registers used by mips binaries. 22 | func PtraceGetRegsMips(pid int, regsout *PtraceRegsMips) error { 23 | return ptrace(PTRACE_GETREGS, pid, 0, uintptr(unsafe.Pointer(regsout))) 24 | } 25 | 26 | // PtraceSetRegsMips sets the registers used by mips binaries. 27 | func PtraceSetRegsMips(pid int, regs *PtraceRegsMips) error { 28 | return ptrace(PTRACE_SETREGS, pid, 0, uintptr(unsafe.Pointer(regs))) 29 | } 30 | 31 | // PtraceRegsMips64 is the registers used by mips64 binaries. 32 | type PtraceRegsMips64 struct { 33 | Regs [32]uint64 34 | Lo uint64 35 | Hi uint64 36 | Epc uint64 37 | Badvaddr uint64 38 | Status uint64 39 | Cause uint64 40 | } 41 | 42 | // PtraceGetRegsMips64 fetches the registers used by mips64 binaries. 43 | func PtraceGetRegsMips64(pid int, regsout *PtraceRegsMips64) error { 44 | return ptrace(PTRACE_GETREGS, pid, 0, uintptr(unsafe.Pointer(regsout))) 45 | } 46 | 47 | // PtraceSetRegsMips64 sets the registers used by mips64 binaries. 48 | func PtraceSetRegsMips64(pid int, regs *PtraceRegsMips64) error { 49 | return ptrace(PTRACE_SETREGS, pid, 0, uintptr(unsafe.Pointer(regs))) 50 | } 51 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/zptracemipsle_linux.go: -------------------------------------------------------------------------------- 1 | // Code generated by linux/mkall.go generatePtracePair(mipsle, mips64le). DO NOT EDIT. 2 | 3 | // +build linux 4 | // +build mipsle mips64le 5 | 6 | package unix 7 | 8 | import "unsafe" 9 | 10 | // PtraceRegsMipsle is the registers used by mipsle binaries. 11 | type PtraceRegsMipsle struct { 12 | Regs [32]uint64 13 | Lo uint64 14 | Hi uint64 15 | Epc uint64 16 | Badvaddr uint64 17 | Status uint64 18 | Cause uint64 19 | } 20 | 21 | // PtraceGetRegsMipsle fetches the registers used by mipsle binaries. 22 | func PtraceGetRegsMipsle(pid int, regsout *PtraceRegsMipsle) error { 23 | return ptrace(PTRACE_GETREGS, pid, 0, uintptr(unsafe.Pointer(regsout))) 24 | } 25 | 26 | // PtraceSetRegsMipsle sets the registers used by mipsle binaries. 27 | func PtraceSetRegsMipsle(pid int, regs *PtraceRegsMipsle) error { 28 | return ptrace(PTRACE_SETREGS, pid, 0, uintptr(unsafe.Pointer(regs))) 29 | } 30 | 31 | // PtraceRegsMips64le is the registers used by mips64le binaries. 32 | type PtraceRegsMips64le struct { 33 | Regs [32]uint64 34 | Lo uint64 35 | Hi uint64 36 | Epc uint64 37 | Badvaddr uint64 38 | Status uint64 39 | Cause uint64 40 | } 41 | 42 | // PtraceGetRegsMips64le fetches the registers used by mips64le binaries. 43 | func PtraceGetRegsMips64le(pid int, regsout *PtraceRegsMips64le) error { 44 | return ptrace(PTRACE_GETREGS, pid, 0, uintptr(unsafe.Pointer(regsout))) 45 | } 46 | 47 | // PtraceSetRegsMips64le sets the registers used by mips64le binaries. 48 | func PtraceSetRegsMips64le(pid int, regs *PtraceRegsMips64le) error { 49 | return ptrace(PTRACE_SETREGS, pid, 0, uintptr(unsafe.Pointer(regs))) 50 | } 51 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/ztypes_aix_ppc.go: -------------------------------------------------------------------------------- 1 | // cgo -godefs types_aix.go | go run mkpost.go 2 | // Code generated by the command above; see README.md. DO NOT EDIT. 3 | 4 | // +build ppc,aix 5 | 6 | package unix 7 | 8 | const ( 9 | SizeofPtr = 0x4 10 | SizeofShort = 0x2 11 | SizeofInt = 0x4 12 | SizeofLong = 0x4 13 | SizeofLongLong = 0x8 14 | PathMax = 0x3ff 15 | ) 16 | 17 | type ( 18 | _C_short int16 19 | _C_int int32 20 | _C_long int32 21 | _C_long_long int64 22 | ) 23 | 24 | type off64 int64 25 | type off int32 26 | type Mode_t uint32 27 | 28 | type Timespec struct { 29 | Sec int32 30 | Nsec int32 31 | } 32 | 33 | type Timeval struct { 34 | Sec int32 35 | Usec int32 36 | } 37 | 38 | type Timeval32 struct { 39 | Sec int32 40 | Usec int32 41 | } 42 | 43 | type Timex struct{} 44 | 45 | type Time_t int32 46 | 47 | type Tms struct{} 48 | 49 | type Utimbuf struct { 50 | Actime int32 51 | Modtime int32 52 | } 53 | 54 | type Timezone struct { 55 | Minuteswest int32 56 | Dsttime int32 57 | } 58 | 59 | type Rusage struct { 60 | Utime Timeval 61 | Stime Timeval 62 | Maxrss int32 63 | Ixrss int32 64 | Idrss int32 65 | Isrss int32 66 | Minflt int32 67 | Majflt int32 68 | Nswap int32 69 | Inblock int32 70 | Oublock int32 71 | Msgsnd int32 72 | Msgrcv int32 73 | Nsignals int32 74 | Nvcsw int32 75 | Nivcsw int32 76 | } 77 | 78 | type Rlimit struct { 79 | Cur uint64 80 | Max uint64 81 | } 82 | 83 | type Pid_t int32 84 | 85 | type _Gid_t uint32 86 | 87 | type dev_t uint32 88 | 89 | type Stat_t struct { 90 | Dev uint32 91 | Ino uint32 92 | Mode uint32 93 | Nlink int16 94 | Flag uint16 95 | Uid uint32 96 | Gid uint32 97 | Rdev uint32 98 | Size int32 99 | Atim Timespec 100 | Mtim Timespec 101 | Ctim Timespec 102 | Blksize int32 103 | Blocks int32 104 | Vfstype int32 105 | Vfs uint32 106 | Type uint32 107 | Gen uint32 108 | Reserved [9]uint32 109 | } 110 | 111 | type StatxTimestamp struct{} 112 | 113 | type Statx_t struct{} 114 | 115 | type Dirent struct { 116 | Offset uint32 117 | Ino uint32 118 | Reclen uint16 119 | Namlen uint16 120 | Name [256]uint8 121 | } 122 | 123 | type RawSockaddrInet4 struct { 124 | Len uint8 125 | Family uint8 126 | Port uint16 127 | Addr [4]byte /* in_addr */ 128 | Zero [8]uint8 129 | } 130 | 131 | type RawSockaddrInet6 struct { 132 | Len uint8 133 | Family uint8 134 | Port uint16 135 | Flowinfo uint32 136 | Addr [16]byte /* in6_addr */ 137 | Scope_id uint32 138 | } 139 | 140 | type RawSockaddrUnix struct { 141 | Len uint8 142 | Family uint8 143 | Path [1023]uint8 144 | } 145 | 146 | type RawSockaddrDatalink struct { 147 | Len uint8 148 | Family uint8 149 | Index uint16 150 | Type uint8 151 | Nlen uint8 152 | Alen uint8 153 | Slen uint8 154 | Data [120]uint8 155 | } 156 | 157 | type RawSockaddr struct { 158 | Len uint8 159 | Family uint8 160 | Data [14]uint8 161 | } 162 | 163 | type RawSockaddrAny struct { 164 | Addr RawSockaddr 165 | Pad [1012]uint8 166 | } 167 | 168 | type _Socklen uint32 169 | 170 | type Cmsghdr struct { 171 | Len uint32 172 | Level int32 173 | Type int32 174 | } 175 | 176 | type ICMPv6Filter struct { 177 | Filt [8]uint32 178 | } 179 | 180 | type Iovec struct { 181 | Base *byte 182 | Len uint32 183 | } 184 | 185 | type IPMreq struct { 186 | Multiaddr [4]byte /* in_addr */ 187 | Interface [4]byte /* in_addr */ 188 | } 189 | 190 | type IPv6Mreq struct { 191 | Multiaddr [16]byte /* in6_addr */ 192 | Interface uint32 193 | } 194 | 195 | type IPv6MTUInfo struct { 196 | Addr RawSockaddrInet6 197 | Mtu uint32 198 | } 199 | 200 | type Linger struct { 201 | Onoff int32 202 | Linger int32 203 | } 204 | 205 | type Msghdr struct { 206 | Name *byte 207 | Namelen uint32 208 | Iov *Iovec 209 | Iovlen int32 210 | Control *byte 211 | Controllen uint32 212 | Flags int32 213 | } 214 | 215 | const ( 216 | SizeofSockaddrInet4 = 0x10 217 | SizeofSockaddrInet6 = 0x1c 218 | SizeofSockaddrAny = 0x404 219 | SizeofSockaddrUnix = 0x401 220 | SizeofSockaddrDatalink = 0x80 221 | SizeofLinger = 0x8 222 | SizeofIPMreq = 0x8 223 | SizeofIPv6Mreq = 0x14 224 | SizeofIPv6MTUInfo = 0x20 225 | SizeofMsghdr = 0x1c 226 | SizeofCmsghdr = 0xc 227 | SizeofICMPv6Filter = 0x20 228 | ) 229 | 230 | const ( 231 | SizeofIfMsghdr = 0x10 232 | ) 233 | 234 | type IfMsgHdr struct { 235 | Msglen uint16 236 | Version uint8 237 | Type uint8 238 | Addrs int32 239 | Flags int32 240 | Index uint16 241 | Addrlen uint8 242 | _ [1]byte 243 | } 244 | 245 | type FdSet struct { 246 | Bits [2048]int32 247 | } 248 | 249 | type Utsname struct { 250 | Sysname [32]byte 251 | Nodename [32]byte 252 | Release [32]byte 253 | Version [32]byte 254 | Machine [32]byte 255 | } 256 | 257 | type Ustat_t struct{} 258 | 259 | type Sigset_t struct { 260 | Losigs uint32 261 | Hisigs uint32 262 | } 263 | 264 | const ( 265 | AT_FDCWD = -0x2 266 | AT_REMOVEDIR = 0x1 267 | AT_SYMLINK_NOFOLLOW = 0x1 268 | ) 269 | 270 | type Termios struct { 271 | Iflag uint32 272 | Oflag uint32 273 | Cflag uint32 274 | Lflag uint32 275 | Cc [16]uint8 276 | } 277 | 278 | type Termio struct { 279 | Iflag uint16 280 | Oflag uint16 281 | Cflag uint16 282 | Lflag uint16 283 | Line uint8 284 | Cc [8]uint8 285 | _ [1]byte 286 | } 287 | 288 | type Winsize struct { 289 | Row uint16 290 | Col uint16 291 | Xpixel uint16 292 | Ypixel uint16 293 | } 294 | 295 | type PollFd struct { 296 | Fd int32 297 | Events uint16 298 | Revents uint16 299 | } 300 | 301 | const ( 302 | POLLERR = 0x4000 303 | POLLHUP = 0x2000 304 | POLLIN = 0x1 305 | POLLNVAL = 0x8000 306 | POLLOUT = 0x2 307 | POLLPRI = 0x4 308 | POLLRDBAND = 0x20 309 | POLLRDNORM = 0x10 310 | POLLWRBAND = 0x40 311 | POLLWRNORM = 0x2 312 | ) 313 | 314 | type Flock_t struct { 315 | Type int16 316 | Whence int16 317 | Sysid uint32 318 | Pid int32 319 | Vfs int32 320 | Start int64 321 | Len int64 322 | } 323 | 324 | type Fsid_t struct { 325 | Val [2]uint32 326 | } 327 | type Fsid64_t struct { 328 | Val [2]uint64 329 | } 330 | 331 | type Statfs_t struct { 332 | Version int32 333 | Type int32 334 | Bsize uint32 335 | Blocks uint32 336 | Bfree uint32 337 | Bavail uint32 338 | Files uint32 339 | Ffree uint32 340 | Fsid Fsid_t 341 | Vfstype int32 342 | Fsize uint32 343 | Vfsnumber int32 344 | Vfsoff int32 345 | Vfslen int32 346 | Vfsvers int32 347 | Fname [32]uint8 348 | Fpack [32]uint8 349 | Name_max int32 350 | } 351 | 352 | const RNDGETENTCNT = 0x80045200 353 | -------------------------------------------------------------------------------- /vendor/golang.org/x/sys/unix/ztypes_aix_ppc64.go: -------------------------------------------------------------------------------- 1 | // cgo -godefs types_aix.go | go run mkpost.go 2 | // Code generated by the command above; see README.md. DO NOT EDIT. 3 | 4 | // +build ppc64,aix 5 | 6 | package unix 7 | 8 | const ( 9 | SizeofPtr = 0x8 10 | SizeofShort = 0x2 11 | SizeofInt = 0x4 12 | SizeofLong = 0x8 13 | SizeofLongLong = 0x8 14 | PathMax = 0x3ff 15 | ) 16 | 17 | type ( 18 | _C_short int16 19 | _C_int int32 20 | _C_long int64 21 | _C_long_long int64 22 | ) 23 | 24 | type off64 int64 25 | type off int64 26 | type Mode_t uint32 27 | 28 | type Timespec struct { 29 | Sec int64 30 | Nsec int64 31 | } 32 | 33 | type Timeval struct { 34 | Sec int64 35 | Usec int32 36 | _ [4]byte 37 | } 38 | 39 | type Timeval32 struct { 40 | Sec int32 41 | Usec int32 42 | } 43 | 44 | type Timex struct{} 45 | 46 | type Time_t int64 47 | 48 | type Tms struct{} 49 | 50 | type Utimbuf struct { 51 | Actime int64 52 | Modtime int64 53 | } 54 | 55 | type Timezone struct { 56 | Minuteswest int32 57 | Dsttime int32 58 | } 59 | 60 | type Rusage struct { 61 | Utime Timeval 62 | Stime Timeval 63 | Maxrss int64 64 | Ixrss int64 65 | Idrss int64 66 | Isrss int64 67 | Minflt int64 68 | Majflt int64 69 | Nswap int64 70 | Inblock int64 71 | Oublock int64 72 | Msgsnd int64 73 | Msgrcv int64 74 | Nsignals int64 75 | Nvcsw int64 76 | Nivcsw int64 77 | } 78 | 79 | type Rlimit struct { 80 | Cur uint64 81 | Max uint64 82 | } 83 | 84 | type Pid_t int32 85 | 86 | type _Gid_t uint32 87 | 88 | type dev_t uint64 89 | 90 | type Stat_t struct { 91 | Dev uint64 92 | Ino uint64 93 | Mode uint32 94 | Nlink int16 95 | Flag uint16 96 | Uid uint32 97 | Gid uint32 98 | Rdev uint64 99 | Ssize int32 100 | Atim Timespec 101 | Mtim Timespec 102 | Ctim Timespec 103 | Blksize int64 104 | Blocks int64 105 | Vfstype int32 106 | Vfs uint32 107 | Type uint32 108 | Gen uint32 109 | Reserved [9]uint32 110 | Padto_ll uint32 111 | Size int64 112 | } 113 | 114 | type StatxTimestamp struct{} 115 | 116 | type Statx_t struct{} 117 | 118 | type Dirent struct { 119 | Offset uint64 120 | Ino uint64 121 | Reclen uint16 122 | Namlen uint16 123 | Name [256]uint8 124 | _ [4]byte 125 | } 126 | 127 | type RawSockaddrInet4 struct { 128 | Len uint8 129 | Family uint8 130 | Port uint16 131 | Addr [4]byte /* in_addr */ 132 | Zero [8]uint8 133 | } 134 | 135 | type RawSockaddrInet6 struct { 136 | Len uint8 137 | Family uint8 138 | Port uint16 139 | Flowinfo uint32 140 | Addr [16]byte /* in6_addr */ 141 | Scope_id uint32 142 | } 143 | 144 | type RawSockaddrUnix struct { 145 | Len uint8 146 | Family uint8 147 | Path [1023]uint8 148 | } 149 | 150 | type RawSockaddrDatalink struct { 151 | Len uint8 152 | Family uint8 153 | Index uint16 154 | Type uint8 155 | Nlen uint8 156 | Alen uint8 157 | Slen uint8 158 | Data [120]uint8 159 | } 160 | 161 | type RawSockaddr struct { 162 | Len uint8 163 | Family uint8 164 | Data [14]uint8 165 | } 166 | 167 | type RawSockaddrAny struct { 168 | Addr RawSockaddr 169 | Pad [1012]uint8 170 | } 171 | 172 | type _Socklen uint32 173 | 174 | type Cmsghdr struct { 175 | Len uint32 176 | Level int32 177 | Type int32 178 | } 179 | 180 | type ICMPv6Filter struct { 181 | Filt [8]uint32 182 | } 183 | 184 | type Iovec struct { 185 | Base *byte 186 | Len uint64 187 | } 188 | 189 | type IPMreq struct { 190 | Multiaddr [4]byte /* in_addr */ 191 | Interface [4]byte /* in_addr */ 192 | } 193 | 194 | type IPv6Mreq struct { 195 | Multiaddr [16]byte /* in6_addr */ 196 | Interface uint32 197 | } 198 | 199 | type IPv6MTUInfo struct { 200 | Addr RawSockaddrInet6 201 | Mtu uint32 202 | } 203 | 204 | type Linger struct { 205 | Onoff int32 206 | Linger int32 207 | } 208 | 209 | type Msghdr struct { 210 | Name *byte 211 | Namelen uint32 212 | Iov *Iovec 213 | Iovlen int32 214 | Control *byte 215 | Controllen uint32 216 | Flags int32 217 | } 218 | 219 | const ( 220 | SizeofSockaddrInet4 = 0x10 221 | SizeofSockaddrInet6 = 0x1c 222 | SizeofSockaddrAny = 0x404 223 | SizeofSockaddrUnix = 0x401 224 | SizeofSockaddrDatalink = 0x80 225 | SizeofLinger = 0x8 226 | SizeofIPMreq = 0x8 227 | SizeofIPv6Mreq = 0x14 228 | SizeofIPv6MTUInfo = 0x20 229 | SizeofMsghdr = 0x30 230 | SizeofCmsghdr = 0xc 231 | SizeofICMPv6Filter = 0x20 232 | ) 233 | 234 | const ( 235 | SizeofIfMsghdr = 0x10 236 | ) 237 | 238 | type IfMsgHdr struct { 239 | Msglen uint16 240 | Version uint8 241 | Type uint8 242 | Addrs int32 243 | Flags int32 244 | Index uint16 245 | Addrlen uint8 246 | _ [1]byte 247 | } 248 | 249 | type FdSet struct { 250 | Bits [1024]int64 251 | } 252 | 253 | type Utsname struct { 254 | Sysname [32]byte 255 | Nodename [32]byte 256 | Release [32]byte 257 | Version [32]byte 258 | Machine [32]byte 259 | } 260 | 261 | type Ustat_t struct{} 262 | 263 | type Sigset_t struct { 264 | Set [4]uint64 265 | } 266 | 267 | const ( 268 | AT_FDCWD = -0x2 269 | AT_REMOVEDIR = 0x1 270 | AT_SYMLINK_NOFOLLOW = 0x1 271 | ) 272 | 273 | type Termios struct { 274 | Iflag uint32 275 | Oflag uint32 276 | Cflag uint32 277 | Lflag uint32 278 | Cc [16]uint8 279 | } 280 | 281 | type Termio struct { 282 | Iflag uint16 283 | Oflag uint16 284 | Cflag uint16 285 | Lflag uint16 286 | Line uint8 287 | Cc [8]uint8 288 | _ [1]byte 289 | } 290 | 291 | type Winsize struct { 292 | Row uint16 293 | Col uint16 294 | Xpixel uint16 295 | Ypixel uint16 296 | } 297 | 298 | type PollFd struct { 299 | Fd int32 300 | Events uint16 301 | Revents uint16 302 | } 303 | 304 | const ( 305 | POLLERR = 0x4000 306 | POLLHUP = 0x2000 307 | POLLIN = 0x1 308 | POLLNVAL = 0x8000 309 | POLLOUT = 0x2 310 | POLLPRI = 0x4 311 | POLLRDBAND = 0x20 312 | POLLRDNORM = 0x10 313 | POLLWRBAND = 0x40 314 | POLLWRNORM = 0x2 315 | ) 316 | 317 | type Flock_t struct { 318 | Type int16 319 | Whence int16 320 | Sysid uint32 321 | Pid int32 322 | Vfs int32 323 | Start int64 324 | Len int64 325 | } 326 | 327 | type Fsid_t struct { 328 | Val [2]uint32 329 | } 330 | type Fsid64_t struct { 331 | Val [2]uint64 332 | } 333 | 334 | type Statfs_t struct { 335 | Version int32 336 | Type int32 337 | Bsize uint64 338 | Blocks uint64 339 | Bfree uint64 340 | Bavail uint64 341 | Files uint64 342 | Ffree uint64 343 | Fsid Fsid64_t 344 | Vfstype int32 345 | Fsize uint64 346 | Vfsnumber int32 347 | Vfsoff int32 348 | Vfslen int32 349 | Vfsvers int32 350 | Fname [32]uint8 351 | Fpack [32]uint8 352 | Name_max int32 353 | _ [4]byte 354 | } 355 | 356 | const RNDGETENTCNT = 0x80045200 357 | -------------------------------------------------------------------------------- /vendor/modules.txt: -------------------------------------------------------------------------------- 1 | # github.com/fsnotify/fsnotify v1.4.7 2 | github.com/fsnotify/fsnotify 3 | # golang.org/x/sys v0.0.0-20190621203818-d432491b9138 4 | golang.org/x/sys/unix 5 | --------------------------------------------------------------------------------