Browse Source

mostly logging...

master
Marcell Mars 10 months ago
parent
commit
8a12fbcf83
100 changed files with 1348 additions and 531 deletions
  1. +0
    -10
      README.md
  2. +3
    -3
      giq/gogit.go
  3. +3
    -0
      go.mod
  4. +8
    -3
      go.sum
  5. +35
    -29
      main.go
  6. +8
    -4
      metahugo.go
  7. BIN
     
  8. +54
    -22
      vendor/golang.org/x/mod/module/module.go
  9. +1
    -0
      vendor/golang.org/x/sys/cpu/cpu_aix.go
  10. +1
    -0
      vendor/golang.org/x/sys/cpu/cpu_gc_arm64.go
  11. +1
    -0
      vendor/golang.org/x/sys/cpu/cpu_gc_s390x.go
  12. +1
    -0
      vendor/golang.org/x/sys/cpu/cpu_gc_x86.go
  13. +1
    -0
      vendor/golang.org/x/sys/cpu/cpu_gccgo_arm64.go
  14. +1
    -0
      vendor/golang.org/x/sys/cpu/cpu_gccgo_s390x.go
  15. +1
    -0
      vendor/golang.org/x/sys/cpu/cpu_gccgo_x86.go
  16. +1
    -0
      vendor/golang.org/x/sys/cpu/cpu_linux.go
  17. +1
    -0
      vendor/golang.org/x/sys/cpu/cpu_linux_mips64x.go
  18. +1
    -0
      vendor/golang.org/x/sys/cpu/cpu_linux_noinit.go
  19. +1
    -0
      vendor/golang.org/x/sys/cpu/cpu_linux_ppc64x.go
  20. +1
    -0
      vendor/golang.org/x/sys/cpu/cpu_mips64x.go
  21. +1
    -0
      vendor/golang.org/x/sys/cpu/cpu_mipsx.go
  22. +1
    -0
      vendor/golang.org/x/sys/cpu/cpu_other_arm.go
  23. +2
    -2
      vendor/golang.org/x/sys/cpu/cpu_other_arm64.go
  24. +1
    -0
      vendor/golang.org/x/sys/cpu/cpu_other_mips64x.go
  25. +1
    -0
      vendor/golang.org/x/sys/cpu/cpu_ppc64x.go
  26. +1
    -0
      vendor/golang.org/x/sys/cpu/cpu_riscv64.go
  27. +1
    -0
      vendor/golang.org/x/sys/cpu/cpu_wasm.go
  28. +1
    -0
      vendor/golang.org/x/sys/cpu/cpu_x86.go
  29. +2
    -2
      vendor/golang.org/x/sys/cpu/syscall_aix_gccgo.go
  30. +2
    -2
      vendor/golang.org/x/sys/cpu/syscall_aix_ppc64_gc.go
  31. +102
    -0
      vendor/golang.org/x/sys/execabs/execabs.go
  32. +2
    -1
      vendor/golang.org/x/sys/unix/aliases.go
  33. +5
    -5
      vendor/golang.org/x/sys/unix/asm_bsd_386.s
  34. +4
    -4
      vendor/golang.org/x/sys/unix/asm_bsd_amd64.s
  35. +4
    -4
      vendor/golang.org/x/sys/unix/asm_bsd_arm.s
  36. +4
    -4
      vendor/golang.org/x/sys/unix/asm_bsd_arm64.s
  37. +0
    -30
      vendor/golang.org/x/sys/unix/asm_darwin_arm.s
  38. +0
    -30
      vendor/golang.org/x/sys/unix/asm_darwin_arm64.s
  39. +0
    -29
      vendor/golang.org/x/sys/unix/asm_dragonfly_amd64.s
  40. +0
    -29
      vendor/golang.org/x/sys/unix/asm_freebsd_386.s
  41. +0
    -29
      vendor/golang.org/x/sys/unix/asm_freebsd_amd64.s
  42. +0
    -29
      vendor/golang.org/x/sys/unix/asm_freebsd_arm.s
  43. +0
    -29
      vendor/golang.org/x/sys/unix/asm_freebsd_arm64.s
  44. +0
    -29
      vendor/golang.org/x/sys/unix/asm_netbsd_386.s
  45. +0
    -29
      vendor/golang.org/x/sys/unix/asm_netbsd_arm64.s
  46. +0
    -29
      vendor/golang.org/x/sys/unix/asm_openbsd_386.s
  47. +0
    -29
      vendor/golang.org/x/sys/unix/asm_openbsd_amd64.s
  48. +0
    -29
      vendor/golang.org/x/sys/unix/asm_openbsd_arm.s
  49. +0
    -29
      vendor/golang.org/x/sys/unix/asm_openbsd_arm64.s
  50. +426
    -0
      vendor/golang.org/x/sys/unix/asm_zos_s390x.s
  51. +1
    -0
      vendor/golang.org/x/sys/unix/cap_freebsd.go
  52. +2
    -1
      vendor/golang.org/x/sys/unix/constants.go
  53. +2
    -2
      vendor/golang.org/x/sys/unix/dev_aix_ppc.go
  54. +2
    -2
      vendor/golang.org/x/sys/unix/dev_aix_ppc64.go
  55. +29
    -0
      vendor/golang.org/x/sys/unix/dev_zos.go
  56. +1
    -0
      vendor/golang.org/x/sys/unix/dirent.go
  57. +1
    -0
      vendor/golang.org/x/sys/unix/endian_big.go
  58. +1
    -0
      vendor/golang.org/x/sys/unix/endian_little.go
  59. +2
    -1
      vendor/golang.org/x/sys/unix/env_unix.go
  60. +221
    -0
      vendor/golang.org/x/sys/unix/epoll_zos.go
  61. +1
    -0
      vendor/golang.org/x/sys/unix/fcntl.go
  62. +1
    -0
      vendor/golang.org/x/sys/unix/fcntl_linux_32bit.go
  63. +1
    -0
      vendor/golang.org/x/sys/unix/fdset.go
  64. +164
    -0
      vendor/golang.org/x/sys/unix/fstatfs_zos.go
  65. +2
    -2
      vendor/golang.org/x/sys/unix/gccgo.go
  66. +1
    -0
      vendor/golang.org/x/sys/unix/gccgo_linux_amd64.go
  67. +1
    -0
      vendor/golang.org/x/sys/unix/ioctl.go
  68. +74
    -0
      vendor/golang.org/x/sys/unix/ioctl_zos.go
  69. +1
    -1
      vendor/golang.org/x/sys/unix/mkall.sh
  70. +26
    -2
      vendor/golang.org/x/sys/unix/mkerrors.sh
  71. +1
    -0
      vendor/golang.org/x/sys/unix/pagesize_unix.go
  72. +1
    -0
      vendor/golang.org/x/sys/unix/ptrace_darwin.go
  73. +1
    -0
      vendor/golang.org/x/sys/unix/ptrace_ios.go
  74. +1
    -0
      vendor/golang.org/x/sys/unix/race.go
  75. +2
    -1
      vendor/golang.org/x/sys/unix/race0.go
  76. +1
    -0
      vendor/golang.org/x/sys/unix/readdirent_getdents.go
  77. +1
    -0
      vendor/golang.org/x/sys/unix/readdirent_getdirentries.go
  78. +2
    -1
      vendor/golang.org/x/sys/unix/sockcmsg_unix.go
  79. +6
    -1
      vendor/golang.org/x/sys/unix/sockcmsg_unix_other.go
  80. +1
    -0
      vendor/golang.org/x/sys/unix/str.go
  81. +2
    -1
      vendor/golang.org/x/sys/unix/syscall.go
  82. +7
    -6
      vendor/golang.org/x/sys/unix/syscall_aix.go
  83. +2
    -2
      vendor/golang.org/x/sys/unix/syscall_aix_ppc.go
  84. +2
    -2
      vendor/golang.org/x/sys/unix/syscall_aix_ppc64.go
  85. +5
    -4
      vendor/golang.org/x/sys/unix/syscall_bsd.go
  86. +1
    -0
      vendor/golang.org/x/sys/unix/syscall_darwin.1_12.go
  87. +1
    -0
      vendor/golang.org/x/sys/unix/syscall_darwin.1_13.go
  88. +14
    -5
      vendor/golang.org/x/sys/unix/syscall_darwin.go
  89. +1
    -0
      vendor/golang.org/x/sys/unix/syscall_darwin_386.go
  90. +1
    -0
      vendor/golang.org/x/sys/unix/syscall_darwin_amd64.go
  91. +1
    -0
      vendor/golang.org/x/sys/unix/syscall_darwin_arm64.go
  92. +1
    -0
      vendor/golang.org/x/sys/unix/syscall_darwin_libSystem.go
  93. +9
    -9
      vendor/golang.org/x/sys/unix/syscall_dragonfly.go
  94. +1
    -0
      vendor/golang.org/x/sys/unix/syscall_dragonfly_amd64.go
  95. +13
    -4
      vendor/golang.org/x/sys/unix/syscall_freebsd.go
  96. +1
    -0
      vendor/golang.org/x/sys/unix/syscall_freebsd_386.go
  97. +1
    -0
      vendor/golang.org/x/sys/unix/syscall_freebsd_amd64.go
  98. +1
    -0
      vendor/golang.org/x/sys/unix/syscall_freebsd_arm.go
  99. +1
    -0
      vendor/golang.org/x/sys/unix/syscall_freebsd_arm64.go
  100. +49
    -10
      vendor/golang.org/x/sys/unix/syscall_illumos.go

+ 0
- 10
README.md View File

@@ -30,16 +30,6 @@ hook.PublicHTMLPath = filepath.Join("/var", "www", "html", "sandpoints")

change it there and rebuild it.

## Two scenarios: post-commit (local) & post-receive (gitea)

`sphook` should work as it is for two scenarios:

- _bare_ git repository and in our case we run it against the `gitea` instances (git web frontend).
- Gitea keeps its `post-receive` hooks inside the `hooks/post-receive.d/` directory relative to particular _bare_ git repository. `sphook` should land there as it is, no need to change the name, and it will run after every remote `git push` into the repo.
- _working_ git repository
- that's usually a contributor running the local instance of a git repository. In order for `sphinx` to work as `post-commit` hook it should be placed inside `.git/hooks/` directory, renamed to `post-commit` and made executable (`chmod +x post-commit`). Hugo, via that hook, will render its output into:
`/var/www/html/sandpoints/{hugo_project_name}-{`\`crc32.ChecksumIEEE(git_repo_path)\`}`.

## Install `sphook` in Gitea via its web ui

`install_sphook.sh` bash script can be used to install `sphook` to Gitea via its web user interface. If `install_sphook.sh` is made into `post-received` Gitea's hook it will first check if `sphook` is already in `hooks/post-received.d/` directory and if it is not it would install it there. If `sphook` is already there it would delete itself because it is not needed anymore.

+ 3
- 3
giq/gogit.go View File

@@ -85,7 +85,7 @@ func isPublish(r gogit.Repository, prevCommit, lastCommit string) bool {
check(err)
hashCommitMap := make(map[string]bool)
err = hashCommitRange.ForEach(func(c *object.Commit) error {
fmt.Println(c.Hash.String(), c.Message)
// fmt.Println(c.Hash.String(), c.Message)
hashCommitMap[c.Hash.String()] = true
ok := strings.Contains(c.Message, "!publish!")
if ok {
@@ -117,7 +117,7 @@ func isPublish(r gogit.Repository, prevCommit, lastCommit string) bool {
return nil
})

fmt.Println(hashCommitMap)
// fmt.Println(hashCommitMap)
if ret {
return true
}
@@ -134,7 +134,7 @@ func (g *Gogit) AddBareWorktree(gitRepoPath, gitIndexPath, gitWorktree, gexe str
// NoCheckout: true,
})
check(err)
fmt.Println("WORKTREE:", tmpRepoPath)
// fmt.Println("WORKTREE:", tmpRepoPath)
}
func (g *Gogit) RemoveBareWorktree(gitRepoPath, gitIndexPath, gitWorktree, gexe string) {
tmpRepoPath := filepath.Join(os.TempDir(), gitWorktree)


+ 3
- 0
go.mod View File

@@ -7,4 +7,7 @@ require (
github.com/go-git/go-git/v5 v5.2.0
github.com/gohugoio/hugo v0.81.0
github.com/spf13/viper v1.7.1
golang.org/x/mod v0.4.2 // indirect
golang.org/x/sys v0.0.0-20210320140829-1e4c9ba3b0c4 // indirect
golang.org/x/tools v0.1.1-0.20210319172145-bda8f5cee399 // indirect
)

+ 8
- 3
go.sum View File

@@ -610,8 +610,10 @@ golang.org/x/mod v0.1.1-0.20191105210325-c90efee705ee/go.mod h1:QqPTAvyqsEbceGzB
golang.org/x/mod v0.1.1-0.20191107180719-034126e5016b/go.mod h1:QqPTAvyqsEbceGzBzNggFXnrqF1CaUcvgkdR5Ot7KZg=
golang.org/x/mod v0.2.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA=
golang.org/x/mod v0.3.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA=
golang.org/x/mod v0.4.0 h1:8pl+sMODzuvGJkmj2W4kZihvVb5mKm8pB/X44PIQHv8=
golang.org/x/mod v0.4.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA=
golang.org/x/mod v0.4.1/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA=
golang.org/x/mod v0.4.2 h1:Gz96sIWK3OalVv/I/qNygP42zyoKp3xptRVCWRFEBvo=
golang.org/x/mod v0.4.2/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA=
golang.org/x/net v0.0.0-20180724234803-3673e40ba225/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
golang.org/x/net v0.0.0-20180826012351-8a410e7b638d/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
golang.org/x/net v0.0.0-20181023162649-9b4f9f5ad519/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
@@ -717,8 +719,10 @@ golang.org/x/sys v0.0.0-20200905004654-be1d3432aa8f/go.mod h1:h1NjWce9XRLGQEsW7w
golang.org/x/sys v0.0.0-20200930185726-fdedc70b468f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20201201145000-ef89a241ccb3/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20210104204734-6f8348627aad h1:MCsdmFSdEd4UEa5TKS5JztCRHK/WtvNei1edOj5RSRo=
golang.org/x/sys v0.0.0-20210104204734-6f8348627aad/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20210124154548-22da62e12c0c/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20210320140829-1e4c9ba3b0c4 h1:EZ2mChiOa8udjfp6rRmswTbtZN/QzUQp4ptM4rnjHvc=
golang.org/x/sys v0.0.0-20210320140829-1e4c9ba3b0c4/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo=
golang.org/x/text v0.0.0-20170915032832-14c0d48ead0c/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
@@ -783,8 +787,9 @@ golang.org/x/tools v0.0.0-20200904185747-39188db58858/go.mod h1:Cj7w3i3Rnn0Xh82u
golang.org/x/tools v0.0.0-20201110124207-079ba7bd75cd/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA=
golang.org/x/tools v0.0.0-20201201161351-ac6f37ff4c2a/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA=
golang.org/x/tools v0.0.0-20201208233053-a543418bbed2/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA=
golang.org/x/tools v0.0.0-20210105154028-b0ab187a4818 h1:u2ssHESKr0HP2d1wlnjMKH+V/22Vg1lGCVuXmOYU1qA=
golang.org/x/tools v0.0.0-20210105154028-b0ab187a4818/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA=
golang.org/x/tools v0.1.1-0.20210319172145-bda8f5cee399 h1:O5bm8buX/OaamnfcBrkjn0SPUIU30jFmaS8lP+ikkxs=
golang.org/x/tools v0.1.1-0.20210319172145-bda8f5cee399/go.mod h1:9bzcO0MWcOuT0tm1iBGzDVPshzfwoVvREIui8C+MHqU=
golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=


+ 35
- 29
main.go View File

@@ -9,17 +9,19 @@ import (
"path/filepath"
"runtime"
"strings"
"time"

"git.sandpoints.org/Drawwell/SandpointsGitHook/giq"
)

var (
version = "21.03.02"
version = "21.03.04"
logLines = ""
)

func check(e error) {
if e != nil {
fmt.Printf("\nGit hook version: %s\n~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~\n", version)
logLines += fmt.Sprintf("\nGit hook version: %s\n~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~\n", version)
log.Fatal(e)
panic(e)
}
@@ -85,17 +87,10 @@ func hookContext(hook *Hook) {
}
}

func hugoLogs(logLines string, lines []string) string {
logLines = logLines + "~~~~~~~~~~ Hugo's logs ~~~~~~~~~~\n"
for _, d := range lines {
logLines = logLines + d + "\n"

}
logLines = logLines + "~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\n"
return logLines
}

func main() {
startTime := time.Now()
logLines := "~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~\n" + startTime.Format(time.RFC822) + "\n"

// init global struct/variables
var hook *Hook
var hugo *Hugo
@@ -109,24 +104,22 @@ func main() {
hook.Gogit = true
hook.PublicHTMLPath = filepath.Join("/var", "www", "html", "sandpoints")

logLines := ""
// hookExe, err := os.Executable()
// check(err)
// hook.ExecutablePath = filepath.Dir(hookExe)
hook.ExecutablePath = "/home/m/Downloads/SimpleSandpoints/.git/hooks"
// hook.ExecutablePath = "/home/m/Downloads/SimpleSandpoints/.git/hooks"
// hook.ExecutablePath = "/home/m/gitea-repositories/sandpoints/dev.git/hooks/post-receive.d"
hook.ExecutablePath = "/home/m/gitea-repositories/sandpoints/simplesandpoints.git/hooks/post-receive.d"
hookContext(hook)
gitPath := gitExePath(hook)
giqi = &giq.Gogit{}
// enforce go-git if mocking hook.ExecutablePath
if hook.Gogit {
// DEFAULT but enforce sysgit if mocking hook.ExecutablePath
// if !hook.Gogit {
// if hook.Gogit {
// DEFAULT but enforce sysgit if mocking hook.ExecutablePath
if !hook.Gogit {
giqi = &giq.Sysgit{}
}
fmt.Println(giqi.Whoami())
git = giqi.GitStruct(hook.ExecutablePath, hook.Context, hook.Stdinput, gitPath)
fmt.Printf("%#v\n", git)
hook.Publish = git.Publish
hugo.SourceDir = git.RepoPath
// hugo.DestinationDir =
@@ -136,18 +129,31 @@ func main() {
defer giqi.RemoveBareWorktree(git.RepoPath, git.IndexPath, git.Worktree, gitPath)
hugo.SourceDir = git.TmpRepoPath

tree, err := exec.Command("/usr/bin/tree", git.TmpRepoPath).Output()
check(err)
fmt.Println(string(tree))
// tree, err := exec.Command("/usr/bin/tree", git.TmpRepoPath).Output()
// check(err)
// fmt.Println(string(tree))
}

hugoContext(hugo, git.RepoPath)
fmt.Printf("%#v\n", hugo)

hugoRender(hugo, hook.Offline)
cleanUpPublicHTML(hugo, hook)
copyToPublicHTML(hugo, hook)

_ = hugo
_ = logLines
logs := hugoRender(hugo, hook.Offline)
// fmt.Println(logs)
logLines += fmt.Sprintf(logs)
if git.IsBare {
cleanUpPublicHTML(hugo, hook)
copyToPublicHTML(hugo, hook)
if hook.Publish {
// fmt.Println("Web site:", filepath.Join(hook.PublicHTMLPath, hugo.PublicHTMLName))
logLines += fmt.Sprintf("Web site: %s\n", filepath.Join(hook.PublicHTMLPath, hugo.PublicHTMLName))
} else {
// fmt.Println("Web site:", filepath.Join(hook.PublicHTMLPath, hugo.PublicHTMLName, "_preview"))
logLines += fmt.Sprintf("Web site: %s\n", filepath.Join(hook.PublicHTMLPath, hugo.PublicHTMLName, "_preview"))
}
} else {
// fmt.Println("Web site:", hugo.DestinationDir)
logLines += fmt.Sprintf("Web site: %s\n", hugo.DestinationDir)
}
durationMillseconds := int64(time.Since(startTime) / time.Millisecond)
logLines = logLines + fmt.Sprintf("Total processing time: %d ms\n\nGit hook version: %s\n~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~\n", durationMillseconds, version)
fmt.Println(logLines)
}

+ 8
- 4
metahugo.go View File

@@ -1,7 +1,6 @@
package main

import (
"fmt"
"hash/crc32"
"path/filepath"
"regexp"
@@ -30,8 +29,8 @@ func hugoContext(hugo *Hugo, gitRepoPath string) {
hugo.DestinationDir = filepath.Join(hugo.SourceDir, "public")
}

func hugoRender(hugo *Hugo, hookOffline bool) {
fmt.Println("hugo", "-s", hugo.SourceDir, "-d", hugo.DestinationDir, "--templateMetrics")
func hugoRender(hugo *Hugo, hookOffline bool) string {
// fmt.Println("hugo", "-s", hugo.SourceDir, "-d", hugo.DestinationDir, "--templateMetrics")
logs := cage.Start()
hugoCommand := []string{"-s", hugo.SourceDir, "-d", hugo.DestinationDir, "--templateMetrics"}
if hookOffline {
@@ -40,7 +39,12 @@ func hugoRender(hugo *Hugo, hookOffline bool) {
goHugo := commands.Execute(hugoCommand)
cage.Stop(logs)
if goHugo.Err != nil {
fmt.Sprintf("Hugo's attempt to render the web site ended up with an Error! Check out the last commit to capture possible errors.\n\n%s\n~~~~~~~~~~\n\n%s", goHugo.Err)
check(goHugo.Err)
runtime.Goexit()
}
lgs := "~~~~~~~ Hugo's logs ~~~~~~~\n"
for _, l := range logs.Data {
lgs = lgs + l + "\n"
}
return lgs
}

BIN
View File


+ 54
- 22
vendor/golang.org/x/mod/module/module.go View File

@@ -224,12 +224,16 @@ func firstPathOK(r rune) bool {
'a' <= r && r <= 'z'
}

// pathOK reports whether r can appear in an import path element.
// modPathOK reports whether r can appear in a module path element.
// Paths can be ASCII letters, ASCII digits, and limited ASCII punctuation: - . _ and ~.
// This matches what "go get" has historically recognized in import paths.
//
// This matches what "go get" has historically recognized in import paths,
// and avoids confusing sequences like '%20' or '+' that would change meaning
// if used in a URL.
//
// TODO(rsc): We would like to allow Unicode letters, but that requires additional
// care in the safe encoding (see "escaped paths" above).
func pathOK(r rune) bool {
func modPathOK(r rune) bool {
if r < utf8.RuneSelf {
return r == '-' || r == '.' || r == '_' || r == '~' ||
'0' <= r && r <= '9' ||
@@ -239,6 +243,17 @@ func pathOK(r rune) bool {
return false
}

// modPathOK reports whether r can appear in a package import path element.
//
// Import paths are intermediate between module paths and file paths: we allow
// disallow characters that would be confusing or ambiguous as arguments to
// 'go get' (such as '@' and ' ' ), but allow certain characters that are
// otherwise-unambiguous on the command line and historically used for some
// binary names (such as '++' as a suffix for compiler binaries and wrappers).
func importPathOK(r rune) bool {
return modPathOK(r) || r == '+'
}

// fileNameOK reports whether r can appear in a file name.
// For now we allow all Unicode letters but otherwise limit to pathOK plus a few more punctuation characters.
// If we expand the set of allowed characters here, we have to
@@ -270,7 +285,7 @@ func fileNameOK(r rune) bool {

// CheckPath checks that a module path is valid.
// A valid module path is a valid import path, as checked by CheckImportPath,
// with two additional constraints.
// with three additional constraints.
// First, the leading path element (up to the first slash, if any),
// by convention a domain name, must contain only lower-case ASCII letters,
// ASCII digits, dots (U+002E), and dashes (U+002D);
@@ -280,8 +295,9 @@ func fileNameOK(r rune) bool {
// and must not contain any dots. For paths beginning with "gopkg.in/",
// this second requirement is replaced by a requirement that the path
// follow the gopkg.in server's conventions.
// Third, no path element may begin with a dot.
func CheckPath(path string) error {
if err := checkPath(path, false); err != nil {
if err := checkPath(path, modulePath); err != nil {
return fmt.Errorf("malformed module path %q: %v", path, err)
}
i := strings.Index(path, "/")
@@ -315,7 +331,7 @@ func CheckPath(path string) error {
//
// A valid path element is a non-empty string made up of
// ASCII letters, ASCII digits, and limited ASCII punctuation: - . _ and ~.
// It must not begin or end with a dot (U+002E), nor contain two dots in a row.
// It must not end with a dot (U+002E), nor contain two dots in a row.
//
// The element prefix up to the first dot must not be a reserved file name
// on Windows, regardless of case (CON, com1, NuL, and so on). The element
@@ -326,19 +342,29 @@ func CheckPath(path string) error {
// top-level package documentation for additional information about
// subtleties of Unicode.
func CheckImportPath(path string) error {
if err := checkPath(path, false); err != nil {
if err := checkPath(path, importPath); err != nil {
return fmt.Errorf("malformed import path %q: %v", path, err)
}
return nil
}

// pathKind indicates what kind of path we're checking. Module paths,
// import paths, and file paths have different restrictions.
type pathKind int

const (
modulePath pathKind = iota
importPath
filePath
)

// checkPath checks that a general path is valid.
// It returns an error describing why but not mentioning path.
// Because these checks apply to both module paths and import paths,
// the caller is expected to add the "malformed ___ path %q: " prefix.
// fileName indicates whether the final element of the path is a file name
// (as opposed to a directory name).
func checkPath(path string, fileName bool) error {
func checkPath(path string, kind pathKind) error {
if !utf8.ValidString(path) {
return fmt.Errorf("invalid UTF-8")
}
@@ -357,39 +383,45 @@ func checkPath(path string, fileName bool) error {
elemStart := 0
for i, r := range path {
if r == '/' {
if err := checkElem(path[elemStart:i], fileName); err != nil {
if err := checkElem(path[elemStart:i], kind); err != nil {
return err
}
elemStart = i + 1
}
}
if err := checkElem(path[elemStart:], fileName); err != nil {
if err := checkElem(path[elemStart:], kind); err != nil {
return err
}
return nil
}

// checkElem checks whether an individual path element is valid.
// fileName indicates whether the element is a file name (not a directory name).
func checkElem(elem string, fileName bool) error {
func checkElem(elem string, kind pathKind) error {
if elem == "" {
return fmt.Errorf("empty path element")
}
if strings.Count(elem, ".") == len(elem) {
return fmt.Errorf("invalid path element %q", elem)
}
if elem[0] == '.' && !fileName {
if elem[0] == '.' && kind == modulePath {
return fmt.Errorf("leading dot in path element")
}
if elem[len(elem)-1] == '.' {
return fmt.Errorf("trailing dot in path element")
}
charOK := pathOK
if fileName {
charOK = fileNameOK
}
for _, r := range elem {
if !charOK(r) {
ok := false
switch kind {
case modulePath:
ok = modPathOK(r)
case importPath:
ok = importPathOK(r)
case filePath:
ok = fileNameOK(r)
default:
panic(fmt.Sprintf("internal error: invalid kind %v", kind))
}
if !ok {
return fmt.Errorf("invalid char %q", r)
}
}
@@ -406,7 +438,7 @@ func checkElem(elem string, fileName bool) error {
}
}

if fileName {
if kind == filePath {
// don't check for Windows short-names in file names. They're
// only an issue for import paths.
return nil
@@ -444,7 +476,7 @@ func checkElem(elem string, fileName bool) error {
// top-level package documentation for additional information about
// subtleties of Unicode.
func CheckFilePath(path string) error {
if err := checkPath(path, true); err != nil {
if err := checkPath(path, filePath); err != nil {
return fmt.Errorf("malformed file path %q: %v", path, err)
}
return nil
@@ -647,7 +679,7 @@ func EscapePath(path string) (escaped string, err error) {
// Versions are allowed to be in non-semver form but must be valid file names
// and not contain exclamation marks.
func EscapeVersion(v string) (escaped string, err error) {
if err := checkElem(v, true); err != nil || strings.Contains(v, "!") {
if err := checkElem(v, filePath); err != nil || strings.Contains(v, "!") {
return "", &InvalidVersionError{
Version: v,
Err: fmt.Errorf("disallowed version string"),
@@ -706,7 +738,7 @@ func UnescapeVersion(escaped string) (v string, err error) {
if !ok {
return "", fmt.Errorf("invalid escaped version %q", escaped)
}
if err := checkElem(v, true); err != nil {
if err := checkElem(v, filePath); err != nil {
return "", fmt.Errorf("invalid escaped version %q: %v", v, err)
}
return v, nil


+ 1
- 0
vendor/golang.org/x/sys/cpu/cpu_aix.go View File

@@ -2,6 +2,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.

//go:build aix
// +build aix

package cpu


+ 1
- 0
vendor/golang.org/x/sys/cpu/cpu_gc_arm64.go View File

@@ -2,6 +2,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.

//go:build gc
// +build gc

package cpu


+ 1
- 0
vendor/golang.org/x/sys/cpu/cpu_gc_s390x.go View File

@@ -2,6 +2,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.

//go:build gc
// +build gc

package cpu


+ 1
- 0
vendor/golang.org/x/sys/cpu/cpu_gc_x86.go View File

@@ -2,6 +2,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.

//go:build (386 || amd64 || amd64p32) && gc
// +build 386 amd64 amd64p32
// +build gc



+ 1
- 0
vendor/golang.org/x/sys/cpu/cpu_gccgo_arm64.go View File

@@ -2,6 +2,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.

//go:build gccgo
// +build gccgo

package cpu


+ 1
- 0
vendor/golang.org/x/sys/cpu/cpu_gccgo_s390x.go View File

@@ -2,6 +2,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.

//go:build gccgo
// +build gccgo

package cpu


+ 1
- 0
vendor/golang.org/x/sys/cpu/cpu_gccgo_x86.go View File

@@ -2,6 +2,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.

//go:build (386 || amd64 || amd64p32) && gccgo
// +build 386 amd64 amd64p32
// +build gccgo



+ 1
- 0
vendor/golang.org/x/sys/cpu/cpu_linux.go View File

@@ -2,6 +2,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.

//go:build !386 && !amd64 && !amd64p32 && !arm64
// +build !386,!amd64,!amd64p32,!arm64

package cpu


+ 1
- 0
vendor/golang.org/x/sys/cpu/cpu_linux_mips64x.go View File

@@ -2,6 +2,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.

//go:build linux && (mips64 || mips64le)
// +build linux
// +build mips64 mips64le



+ 1
- 0
vendor/golang.org/x/sys/cpu/cpu_linux_noinit.go View File

@@ -2,6 +2,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.

//go:build linux && !arm && !arm64 && !mips64 && !mips64le && !ppc64 && !ppc64le && !s390x
// +build linux,!arm,!arm64,!mips64,!mips64le,!ppc64,!ppc64le,!s390x

package cpu


+ 1
- 0
vendor/golang.org/x/sys/cpu/cpu_linux_ppc64x.go View File

@@ -2,6 +2,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.

//go:build linux && (ppc64 || ppc64le)
// +build linux
// +build ppc64 ppc64le



+ 1
- 0
vendor/golang.org/x/sys/cpu/cpu_mips64x.go View File

@@ -2,6 +2,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.

//go:build mips64 || mips64le
// +build mips64 mips64le

package cpu


+ 1
- 0
vendor/golang.org/x/sys/cpu/cpu_mipsx.go View File

@@ -2,6 +2,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.

//go:build mips || mipsle
// +build mips mipsle

package cpu


+ 1
- 0
vendor/golang.org/x/sys/cpu/cpu_other_arm.go View File

@@ -2,6 +2,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.

//go:build !linux && arm
// +build !linux,arm

package cpu


+ 2
- 2
vendor/golang.org/x/sys/cpu/cpu_other_arm64.go View File

@@ -2,8 +2,8 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.

// +build !linux,!netbsd
// +build arm64
//go:build !linux && !netbsd && arm64
// +build !linux,!netbsd,arm64

package cpu



+ 1
- 0
vendor/golang.org/x/sys/cpu/cpu_other_mips64x.go View File

@@ -2,6 +2,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.

//go:build !linux && (mips64 || mips64le)
// +build !linux
// +build mips64 mips64le



+ 1
- 0
vendor/golang.org/x/sys/cpu/cpu_ppc64x.go View File

@@ -2,6 +2,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.

//go:build ppc64 || ppc64le
// +build ppc64 ppc64le

package cpu


+ 1
- 0
vendor/golang.org/x/sys/cpu/cpu_riscv64.go View File

@@ -2,6 +2,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.

//go:build riscv64
// +build riscv64

package cpu


+ 1
- 0
vendor/golang.org/x/sys/cpu/cpu_wasm.go View File

@@ -2,6 +2,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.

//go:build wasm
// +build wasm

package cpu


+ 1
- 0
vendor/golang.org/x/sys/cpu/cpu_x86.go View File

@@ -2,6 +2,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.

//go:build 386 || amd64 || amd64p32
// +build 386 amd64 amd64p32

package cpu


+ 2
- 2
vendor/golang.org/x/sys/cpu/syscall_aix_gccgo.go View File

@@ -8,8 +8,8 @@
// Morever, this file will be used during the building of
// gccgo's libgo and thus must not used a CGo method.

// +build aix
// +build gccgo
//go:build aix && gccgo
// +build aix,gccgo

package cpu



+ 2
- 2
vendor/golang.org/x/sys/cpu/syscall_aix_ppc64_gc.go View File

@@ -6,8 +6,8 @@
// system call on AIX without depending on x/sys/unix.
// (See golang.org/issue/32102)

// +build aix,ppc64
// +build gc
//go:build aix && ppc64 && gc
// +build aix,ppc64,gc

package cpu



+ 102
- 0
vendor/golang.org/x/sys/execabs/execabs.go View File

@@ -0,0 +1,102 @@
// Copyright 2020 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.

// Package execabs is a drop-in replacement for os/exec
// that requires PATH lookups to find absolute paths.
// That is, execabs.Command("cmd") runs the same PATH lookup
// as exec.Command("cmd"), but if the result is a path
// which is relative, the Run and Start methods will report
// an error instead of running the executable.
//
// See https://blog.golang.org/path-security for more information
// about when it may be necessary or appropriate to use this package.
package execabs

import (
"context"
"fmt"
"os/exec"
"path/filepath"
"reflect"
"unsafe"
)

// ErrNotFound is the error resulting if a path search failed to find an executable file.
// It is an alias for exec.ErrNotFound.
var ErrNotFound = exec.ErrNotFound

// Cmd represents an external command being prepared or run.
// It is an alias for exec.Cmd.
type Cmd = exec.Cmd

// Error is returned by LookPath when it fails to classify a file as an executable.
// It is an alias for exec.Error.
type Error = exec.Error

// An ExitError reports an unsuccessful exit by a command.
// It is an alias for exec.ExitError.
type ExitError = exec.ExitError

func relError(file, path string) error {
return fmt.Errorf("%s resolves to executable in current directory (.%c%s)", file, filepath.Separator, path)
}

// LookPath searches for an executable named file in the directories
// named by the PATH environment variable. If file contains a slash,
// it is tried directly and the PATH is not consulted. The result will be
// an absolute path.
//
// LookPath differs from exec.LookPath in its handling of PATH lookups,
// which are used for file names without slashes. If exec.LookPath's
// PATH lookup would have returned an executable from the current directory,
// LookPath instead returns an error.
func LookPath(file string) (string, error) {
path, err := exec.LookPath(file)
if err != nil {
return "", err
}
if filepath.Base(file) == file && !filepath.IsAbs(path) {
return "", relError(file, path)
}
return path, nil
}

func fixCmd(name string, cmd *exec.Cmd) {
if filepath.Base(name) == name && !filepath.IsAbs(cmd.Path) {
// exec.Command was called with a bare binary name and
// exec.LookPath returned a path which is not absolute.
// Set cmd.lookPathErr and clear cmd.Path so that it
// cannot be run.
lookPathErr := (*error)(unsafe.Pointer(reflect.ValueOf(cmd).Elem().FieldByName("lookPathErr").Addr().Pointer()))
if *lookPathErr == nil {
*lookPathErr = relError(name, cmd.Path)
}
cmd.Path = ""
}
}

// CommandContext is like Command but includes a context.
//
// The provided context is used to kill the process (by calling os.Process.Kill)
// if the context becomes done before the command completes on its own.
func CommandContext(ctx context.Context, name string, arg ...string) *exec.Cmd {
cmd := exec.CommandContext(ctx, name, arg...)
fixCmd(name, cmd)
return cmd

}

// Command returns the Cmd struct to execute the named program with the given arguments.
// See exec.Command for most details.
//
// Command differs from exec.Command in its handling of PATH lookups,
// which are used when the program name contains no slashes.
// If exec.Command would have returned an exec.Cmd configured to run an
// executable from the current directory, Command instead
// returns an exec.Cmd that will return an error from Start or Run.
func Command(name string, arg ...string) *exec.Cmd {
cmd := exec.Command(name, arg...)
fixCmd(name, cmd)
return cmd
}

+ 2
- 1
vendor/golang.org/x/sys/unix/aliases.go View File

@@ -2,7 +2,8 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.

// +build aix darwin dragonfly freebsd linux netbsd openbsd solaris
//go:build (aix || darwin || dragonfly || freebsd || linux || netbsd || openbsd || solaris || zos) && go1.9
// +build aix darwin dragonfly freebsd linux netbsd openbsd solaris zos
// +build go1.9

package unix


vendor/golang.org/x/sys/unix/asm_darwin_386.s → vendor/golang.org/x/sys/unix/asm_bsd_386.s View File

@@ -1,14 +1,14 @@
// Copyright 2009 The Go Authors. All rights reserved.
// Copyright 2021 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.

//go:build (darwin || freebsd || netbsd || openbsd) && gc
// +build darwin freebsd netbsd openbsd
// +build gc

#include "textflag.h"

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

// Just jump to package syscall's implementation for all these functions.
// The runtime may know about them.
@@ -22,7 +22,7 @@ TEXT ·Syscall6(SB),NOSPLIT,$0-40
TEXT ·Syscall9(SB),NOSPLIT,$0-52
JMP syscall·Syscall9(SB)

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

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

vendor/golang.org/x/sys/unix/asm_darwin_amd64.s → vendor/golang.org/x/sys/unix/asm_bsd_amd64.s View File

@@ -1,14 +1,14 @@
// Copyright 2009 The Go Authors. All rights reserved.
// Copyright 2021 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.

//go:build (darwin || dragonfly || freebsd || netbsd || openbsd) && gc
// +build darwin dragonfly freebsd netbsd openbsd
// +build gc

#include "textflag.h"

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

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

vendor/golang.org/x/sys/unix/asm_netbsd_arm.s → vendor/golang.org/x/sys/unix/asm_bsd_arm.s View File

@@ -1,14 +1,14 @@
// Copyright 2013 The Go Authors. All rights reserved.
// Copyright 2021 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.

//go:build (darwin || freebsd || netbsd || openbsd) && gc
// +build darwin freebsd netbsd openbsd
// +build gc

#include "textflag.h"

//
// System call support for ARM, NetBSD
//
// System call support for ARM BSD

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

vendor/golang.org/x/sys/unix/asm_netbsd_amd64.s → vendor/golang.org/x/sys/unix/asm_bsd_arm64.s View File

@@ -1,14 +1,14 @@
// Copyright 2009 The Go Authors. All rights reserved.
// Copyright 2021 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.

//go:build (darwin || freebsd || netbsd || openbsd) && gc
// +build darwin freebsd netbsd openbsd
// +build gc

#include "textflag.h"

//
// System call support for AMD64, NetBSD
//
// System call support for ARM64 BSD

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

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

@@ -1,30 +0,0 @@
// Copyright 2015 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.

// +build gc
// +build arm,darwin

#include "textflag.h"

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

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

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

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

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

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

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

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

@@ -1,30 +0,0 @@
// Copyright 2015 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.

// +build gc
// +build arm64,darwin

#include "textflag.h"

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

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

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

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

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

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

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

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

@@ -1,29 +0,0 @@
// Copyright 2009 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.

// +build gc

#include "textflag.h"

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

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

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

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

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

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

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

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

@@ -1,29 +0,0 @@
// Copyright 2009 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.

// +build gc

#include "textflag.h"

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

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

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

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

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

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

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

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

@@ -1,29 +0,0 @@
// Copyright 2009 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.

// +build gc

#include "textflag.h"

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

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

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

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

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

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

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

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

@@ -1,29 +0,0 @@
// Copyright 2012 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.

// +build gc

#include "textflag.h"

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

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

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

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

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

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

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

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

@@ -1,29 +0,0 @@
// Copyright 2018 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.

// +build gc

#include "textflag.h"

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

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

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

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

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

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

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

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

@@ -1,29 +0,0 @@
// Copyright 2009 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.

// +build gc

#include "textflag.h"

//
// System call support for 386, NetBSD
//

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

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

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

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

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

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

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

@@ -1,29 +0,0 @@
// Copyright 2019 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.

// +build gc

#include "textflag.h"

//
// System call support for ARM64, NetBSD
//

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

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

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

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

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

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

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

@@ -1,29 +0,0 @@
// Copyright 2009 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.

// +build gc

#include "textflag.h"

//
// System call support for 386, OpenBSD
//

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

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

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

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

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

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

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

@@ -1,29 +0,0 @@
// Copyright 2009 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.

// +build gc

#include "textflag.h"

//
// System call support for AMD64, OpenBSD
//

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

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

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

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

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

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

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

@@ -1,29 +0,0 @@
// Copyright 2017 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.

// +build gc

#include "textflag.h"

//
// System call support for ARM, OpenBSD
//

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

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

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

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

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

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

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

@@ -1,29 +0,0 @@
// Copyright 2019 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.

// +build gc

#include "textflag.h"

//
// System call support for arm64, OpenBSD
//

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

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

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

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

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

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

+ 426
- 0
vendor/golang.org/x/sys/unix/asm_zos_s390x.s View File

@@ -0,0 +1,426 @@
// Copyright 2020 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.

//go:build zos && s390x && gc
// +build zos
// +build s390x
// +build gc

#include "textflag.h"

#define PSALAA 1208(R0)
#define GTAB64(x) 80(x)
#define LCA64(x) 88(x)
#define CAA(x) 8(x)
#define EDCHPXV(x) 1016(x) // in the CAA
#define SAVSTACK_ASYNC(x) 336(x) // in the LCA

// SS_*, where x=SAVSTACK_ASYNC
#define SS_LE(x) 0(x)
#define SS_GO(x) 8(x)
#define SS_ERRNO(x) 16(x)
#define SS_ERRNOJR(x) 20(x)

#define LE_CALL BYTE $0x0D; BYTE $0x76; // BL R7, R6

TEXT ·clearErrno(SB),NOSPLIT,$0-0
BL addrerrno<>(SB)
MOVD $0, 0(R3)
RET

// Returns the address of errno in R3.
TEXT addrerrno<>(SB),NOSPLIT|NOFRAME,$0-0
// Get library control area (LCA).
MOVW PSALAA, R8
MOVD LCA64(R8), R8

// Get __errno FuncDesc.
MOVD CAA(R8), R9
MOVD EDCHPXV(R9), R9
ADD $(0x156*16), R9
LMG 0(R9), R5, R6

// Switch to saved LE stack.
MOVD SAVSTACK_ASYNC(R8), R9
MOVD 0(R9), R4
MOVD $0, 0(R9)

// Call __errno function.
LE_CALL
NOPH

// Switch back to Go stack.
XOR R0, R0 // Restore R0 to $0.
MOVD R4, 0(R9) // Save stack pointer.
RET

TEXT ·syscall_syscall(SB),NOSPLIT,$0-56
BL runtime·entersyscall(SB)
MOVD a1+8(FP), R1
MOVD a2+16(FP), R2
MOVD a3+24(FP), R3

// Get library control area (LCA).
MOVW PSALAA, R8
MOVD LCA64(R8), R8

// Get function.
MOVD CAA(R8), R9
MOVD EDCHPXV(R9), R9
MOVD trap+0(FP), R5
SLD $4, R5
ADD R5, R9
LMG 0(R9), R5, R6

// Restore LE stack.
MOVD SAVSTACK_ASYNC(R8), R9
MOVD 0(R9), R4
MOVD $0, 0(R9)

// Call function.
LE_CALL
NOPH
XOR R0, R0 // Restore R0 to $0.
MOVD R4, 0(R9) // Save stack pointer.

MOVD R3, r1+32(FP)
MOVD R0, r2+40(FP)
MOVD R0, err+48(FP)
MOVW R3, R4
CMP R4, $-1
BNE done
BL addrerrno<>(SB)
MOVWZ 0(R3), R3
MOVD R3, err+48(FP)
done:
BL runtime·exitsyscall(SB)
RET

TEXT ·syscall_rawsyscall(SB),NOSPLIT,$0-56
MOVD a1+8(FP), R1
MOVD a2+16(FP), R2
MOVD a3+24(FP), R3

// Get library control area (LCA).
MOVW PSALAA, R8
MOVD LCA64(R8), R8

// Get function.
MOVD CAA(R8), R9
MOVD EDCHPXV(R9), R9
MOVD trap+0(FP), R5
SLD $4, R5
ADD R5, R9
LMG 0(R9), R5, R6

// Restore LE stack.
MOVD SAVSTACK_ASYNC(R8), R9
MOVD 0(R9), R4
MOVD $0, 0(R9)

// Call function.
LE_CALL
NOPH
XOR R0, R0 // Restore R0 to $0.
MOVD R4, 0(R9) // Save stack pointer.

MOVD R3, r1+32(FP)
MOVD R0, r2+40(FP)
MOVD R0, err+48(FP)
MOVW R3, R4
CMP R4, $-1
BNE done
BL addrerrno<>(SB)
MOVWZ 0(R3), R3
MOVD R3, err+48(FP)
done:
RET

TEXT ·syscall_syscall6(SB),NOSPLIT,$0-80
BL runtime·entersyscall(SB)
MOVD a1+8(FP), R1
MOVD a2+16(FP), R2
MOVD a3+24(FP), R3

// Get library control area (LCA).
MOVW PSALAA, R8
MOVD LCA64(R8), R8

// Get function.
MOVD CAA(R8), R9
MOVD EDCHPXV(R9), R9
MOVD trap+0(FP), R5
SLD $4, R5
ADD R5, R9
LMG 0(R9), R5, R6

// Restore LE stack.
MOVD SAVSTACK_ASYNC(R8), R9
MOVD 0(R9), R4
MOVD $0, 0(R9)

// Fill in parameter list.
MOVD a4+32(FP), R12
MOVD R12, (2176+24)(R4)
MOVD a5+40(FP), R12
MOVD R12, (2176+32)(R4)
MOVD a6+48(FP), R12
MOVD R12, (2176+40)(R4)

// Call function.
LE_CALL
NOPH
XOR R0, R0 // Restore R0 to $0.
MOVD R4, 0(R9) // Save stack pointer.

MOVD R3, r1+56(FP)
MOVD R0, r2+64(FP)
MOVD R0, err+72(FP)
MOVW R3, R4
CMP R4, $-1
BNE done
BL addrerrno<>(SB)
MOVWZ 0(R3), R3
MOVD R3, err+72(FP)
done:
BL runtime·exitsyscall(SB)
RET

TEXT ·syscall_rawsyscall6(SB),NOSPLIT,$0-80
MOVD a1+8(FP), R1
MOVD a2+16(FP), R2
MOVD a3+24(FP), R3

// Get library control area (LCA).
MOVW PSALAA, R8
MOVD LCA64(R8), R8

// Get function.
MOVD CAA(R8), R9
MOVD EDCHPXV(R9), R9
MOVD trap+0(FP), R5
SLD $4, R5
ADD R5, R9
LMG 0(R9), R5, R6

// Restore LE stack.
MOVD SAVSTACK_ASYNC(R8), R9
MOVD 0(R9), R4
MOVD $0, 0(R9)

// Fill in parameter list.
MOVD a4+32(FP), R12
MOVD R12, (2176+24)(R4)
MOVD a5+40(FP), R12
MOVD R12, (2176+32)(R4)
MOVD a6+48(FP), R12
MOVD R12, (2176+40)(R4)

// Call function.
LE_CALL
NOPH
XOR R0, R0 // Restore R0 to $0.
MOVD R4, 0(R9) // Save stack pointer.

MOVD R3, r1+56(FP)
MOVD R0, r2+64(FP)
MOVD R0, err+72(FP)
MOVW R3, R4
CMP R4, $-1
BNE done
BL ·rrno<>(SB)
MOVWZ 0(R3), R3
MOVD R3, err+72(FP)
done:
RET

TEXT ·syscall_syscall9(SB),NOSPLIT,$0
BL runtime·entersyscall(SB)
MOVD a1+8(FP), R1
MOVD a2+16(FP), R2
MOVD a3+24(FP), R3

// Get library control area (LCA).
MOVW PSALAA, R8
MOVD LCA64(R8), R8

// Get function.
MOVD CAA(R8), R9
MOVD EDCHPXV(R9), R9
MOVD trap+0(FP), R5
SLD $4, R5
ADD R5, R9
LMG 0(R9), R5, R6

// Restore LE stack.
MOVD SAVSTACK_ASYNC(R8), R9
MOVD 0(R9), R4
MOVD $0, 0(R9)

// Fill in parameter list.
MOVD a4+32(FP), R12
MOVD R12, (2176+24)(R4)
MOVD a5+40(FP), R12
MOVD R12, (2176+32)(R4)
MOVD a6+48(FP), R12
MOVD R12, (2176+40)(R4)
MOVD a7+56(FP), R12
MOVD R12, (2176+48)(R4)
MOVD a8+64(FP), R12
MOVD R12, (2176+56)(R4)
MOVD a9+72(FP), R12
MOVD R12, (2176+64)(R4)

// Call function.
LE_CALL
NOPH
XOR R0, R0 // Restore R0 to $0.
MOVD R4, 0(R9) // Save stack pointer.

MOVD R3, r1+80(FP)
MOVD R0, r2+88(FP)
MOVD R0, err+96(FP)
MOVW R3, R4
CMP R4, $-1
BNE done
BL addrerrno<>(SB)
MOVWZ 0(R3), R3
MOVD R3, err+96(FP)
done:
BL runtime·exitsyscall(SB)
RET

TEXT ·syscall_rawsyscall9(SB),NOSPLIT,$0
MOVD a1+8(FP), R1
MOVD a2+16(FP), R2
MOVD a3+24(FP), R3

// Get library control area (LCA).
MOVW PSALAA, R8
MOVD LCA64(R8), R8

// Get function.
MOVD CAA(R8), R9
MOVD EDCHPXV(R9), R9
MOVD trap+0(FP), R5
SLD $4, R5
ADD R5, R9
LMG 0(R9), R5, R6

// Restore LE stack.
MOVD SAVSTACK_ASYNC(R8), R9
MOVD 0(R9), R4
MOVD $0, 0(R9)

// Fill in parameter list.
MOVD a4+32(FP), R12
MOVD R12, (2176+24)(R4)
MOVD a5+40(FP), R12
MOVD R12, (2176+32)(R4)
MOVD a6+48(FP), R12
MOVD R12, (2176+40)(R4)
MOVD a7+56(FP), R12
MOVD R12, (2176+48)(R4)
MOVD a8+64(FP), R12
MOVD R12, (2176+56)(R4)
MOVD a9+72(FP), R12
MOVD R12, (2176+64)(R4)

// Call function.
LE_CALL
NOPH
XOR R0, R0 // Restore R0 to $0.
MOVD R4, 0(R9) // Save stack pointer.

MOVD R3, r1+80(FP)
MOVD R0, r2+88(FP)
MOVD R0, err+96(FP)
MOVW R3, R4
CMP R4, $-1
BNE done
BL addrerrno<>(SB)
MOVWZ 0(R3), R3
MOVD R3, err+96(FP)
done:
RET

// func svcCall(fnptr unsafe.Pointer, argv *unsafe.Pointer, dsa *uint64)
TEXT ·svcCall(SB),NOSPLIT,$0
BL runtime·save_g(SB) // Save g and stack pointer
MOVW PSALAA, R8
MOVD LCA64(R8), R8
MOVD SAVSTACK_ASYNC(R8), R9
MOVD R15, 0(R9)

MOVD argv+8(FP), R1 // Move function arguments into registers
MOVD dsa+16(FP), g
MOVD fnptr+0(FP), R15

BYTE $0x0D // Branch to function
BYTE $0xEF

BL runtime·load_g(SB) // Restore g and stack pointer
MOVW PSALAA, R8
MOVD LCA64(R8), R8
MOVD SAVSTACK_ASYNC(R8), R9
MOVD 0(R9), R15

RET

// func svcLoad(name *byte) unsafe.Pointer
TEXT ·svcLoad(SB),NOSPLIT,$0
MOVD R15, R2 // Save go stack pointer
MOVD name+0(FP), R0 // Move SVC args into registers
MOVD $0x80000000, R1
MOVD $0, R15
BYTE $0x0A // SVC 08 LOAD
BYTE $0x08
MOVW R15, R3 // Save return code from SVC
MOVD R2, R15 // Restore go stack pointer
CMP R3, $0 // Check SVC return code
BNE error

MOVD $-2, R3 // Reset last bit of entry point to zero
AND R0, R3
MOVD R3, addr+8(FP) // Return entry point returned by SVC
CMP R0, R3 // Check if last bit of entry point was set
BNE done

MOVD R15, R2 // Save go stack pointer
MOVD $0, R15 // Move SVC args into registers (entry point still in r0 from SVC 08)
BYTE $0x0A // SVC 09 DELETE
BYTE $0x09
MOVD R2, R15 // Restore go stack pointer

error:
MOVD $0, addr+8(FP) // Return 0 on failure
done:
XOR R0, R0 // Reset r0 to 0
RET

// func svcUnload(name *byte, fnptr unsafe.Pointer) int64
TEXT ·svcUnload(SB),NOSPLIT,$0
MOVD R15, R2 // Save go stack pointer
MOVD name+0(FP), R0 // Move SVC args into registers
MOVD addr+8(FP), R15
BYTE $0x0A // SVC 09
BYTE $0x09
XOR R0, R0 // Reset r0 to 0
MOVD R15, R1 // Save SVC return code
MOVD R2, R15 // Restore go stack pointer
MOVD R1, rc+0(FP) // Return SVC return code
RET

// func gettid() uint64
TEXT ·gettid(SB), NOSPLIT, $0
// Get library control area (LCA).
MOVW PSALAA, R8
MOVD LCA64(R8), R8

// Get CEECAATHDID
MOVD CAA(R8), R9
MOVD 0x3D0(R9), R9
MOVD R9, ret+0(FP)

RET

+ 1
- 0
vendor/golang.org/x/sys/unix/cap_freebsd.go View File

@@ -2,6 +2,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.

//go:build freebsd
// +build freebsd

package unix


+ 2
- 1
vendor/golang.org/x/sys/unix/constants.go View File

@@ -2,7 +2,8 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.

// +build aix darwin dragonfly freebsd linux netbsd openbsd solaris
//go:build aix || darwin || dragonfly || freebsd || linux || netbsd || openbsd || solaris || zos
// +build aix darwin dragonfly freebsd linux netbsd openbsd solaris zos

package unix



+ 2
- 2
vendor/golang.org/x/sys/unix/dev_aix_ppc.go View File

@@ -2,8 +2,8 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.

// +build aix
// +build ppc
//go:build aix && ppc
// +build aix,ppc

// Functions to access/create device major and minor numbers matching the
// encoding used by AIX.


+ 2
- 2
vendor/golang.org/x/sys/unix/dev_aix_ppc64.go View File

@@ -2,8 +2,8 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.

// +build aix
// +build ppc64
//go:build aix && ppc64
// +build aix,ppc64

// Functions to access/create device major and minor numbers matching the
// encoding used AIX.


+ 29
- 0
vendor/golang.org/x/sys/unix/dev_zos.go View File

@@ -0,0 +1,29 @@
// Copyright 2020 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.

//go:build zos && s390x
// +build zos,s390x

// Functions to access/create device major and minor numbers matching the
// encoding used by z/OS.
//
// The information below is extracted and adapted from <sys/stat.h> macros.

package unix

// Major returns the major component of a z/OS device number.
func Major(dev uint64) uint32 {
return uint32((dev >> 16) & 0x0000FFFF)
}

// Minor returns the minor component of a z/OS device number.
func Minor(dev uint64) uint32 {
return uint32(dev & 0x0000FFFF)
}

// Mkdev returns a z/OS device number generated from the given major and minor
// components.
func Mkdev(major, minor uint32) uint64 {
return (uint64(major) << 16) | uint64(minor)
}

+ 1
- 0
vendor/golang.org/x/sys/unix/dirent.go View File

@@ -2,6 +2,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.

//go:build aix || darwin || dragonfly || freebsd || linux || netbsd || openbsd || solaris
// +build aix darwin dragonfly freebsd linux netbsd openbsd solaris

package unix


+ 1
- 0
vendor/golang.org/x/sys/unix/endian_big.go View File

@@ -2,6 +2,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
//
//go:build armbe || arm64be || m68k || mips || mips64 || mips64p32 || ppc || ppc64 || s390 || s390x || shbe || sparc || sparc64
// +build armbe arm64be m68k mips mips64 mips64p32 ppc ppc64 s390 s390x shbe sparc sparc64

package unix


+ 1
- 0
vendor/golang.org/x/sys/unix/endian_little.go View File

@@ -2,6 +2,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
//
//go:build 386 || amd64 || amd64p32 || alpha || arm || arm64 || mipsle || mips64le || mips64p32le || nios2 || ppc64le || riscv || riscv64 || sh
// +build 386 amd64 amd64p32 alpha arm arm64 mipsle mips64le mips64p32le nios2 ppc64le riscv riscv64 sh

package unix


+ 2
- 1
vendor/golang.org/x/sys/unix/env_unix.go View File

@@ -2,7 +2,8 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.

// +build aix darwin dragonfly freebsd linux netbsd openbsd solaris
//go:build aix || darwin || dragonfly || freebsd || linux || netbsd || openbsd || solaris || zos
// +build aix darwin dragonfly freebsd linux netbsd openbsd solaris zos

// Unix environment variables.



+ 221
- 0
vendor/golang.org/x/sys/unix/epoll_zos.go View File

@@ -0,0 +1,221 @@
// Copyright 2020 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.

//go:build zos && s390x
// +build zos,s390x

package unix

import (
"sync"
)

// This file simulates epoll on z/OS using poll.

// Analogous to epoll_event on Linux.
// TODO(neeilan): Pad is because the Linux kernel expects a 96-bit struct. We never pass this to the kernel; remove?
type EpollEvent struct {
Events uint32
Fd int32
Pad int32
}

const (
EPOLLERR = 0x8
EPOLLHUP = 0x10
EPOLLIN = 0x1
EPOLLMSG = 0x400
EPOLLOUT = 0x4
EPOLLPRI = 0x2
EPOLLRDBAND = 0x80
EPOLLRDNORM = 0x40
EPOLLWRBAND = 0x200
EPOLLWRNORM = 0x100
EPOLL_CTL_ADD = 0x1
EPOLL_CTL_DEL = 0x2
EPOLL_CTL_MOD = 0x3
// The following constants are part of the epoll API, but represent
// currently unsupported functionality on z/OS.
// EPOLL_CLOEXEC = 0x80000
// EPOLLET = 0x80000000
// EPOLLONESHOT = 0x40000000
// EPOLLRDHUP = 0x2000 // Typically used with edge-triggered notis
// EPOLLEXCLUSIVE = 0x10000000 // Exclusive wake-up mode
// EPOLLWAKEUP = 0x20000000 // Relies on Linux's BLOCK_SUSPEND capability
)

// TODO(neeilan): We can eliminate these epToPoll / pToEpoll calls by using identical mask values for POLL/EPOLL
// constants where possible The lower 16 bits of epoll events (uint32) can fit any system poll event (int16).

// epToPollEvt converts epoll event field to poll equivalent.
// In epoll, Events is a 32-bit field, while poll uses 16 bits.
func epToPollEvt(events uint32) int16 {
var ep2p = map[uint32]int16{
EPOLLIN: POLLIN,
EPOLLOUT: POLLOUT,
EPOLLHUP: POLLHUP,
EPOLLPRI: POLLPRI,
EPOLLERR: POLLERR,
}

var pollEvts int16 = 0
for epEvt, pEvt := range ep2p {
if (events & epEvt) != 0 {
pollEvts |= pEvt
}
}

return pollEvts
}

// pToEpollEvt converts 16 bit poll event bitfields to 32-bit epoll event fields.