diff --git a/api/except.txt b/api/except.txt index 637be18135..a608d5783e 100644 --- a/api/except.txt +++ b/api/except.txt @@ -457,3 +457,4 @@ pkg syscall (freebsd-arm-cgo), type Stat_t struct, Nlink uint16 pkg syscall (freebsd-arm-cgo), type Stat_t struct, Rdev uint32 pkg syscall (freebsd-arm-cgo), type Statfs_t struct, Mntfromname [88]int8 pkg syscall (freebsd-arm-cgo), type Statfs_t struct, Mntonname [88]int8 +pkg text/scanner, const GoTokens = 1012 \ No newline at end of file diff --git a/api/next.txt b/api/next.txt index e69de29bb2..aaea62d70b 100644 --- a/api/next.txt +++ b/api/next.txt @@ -0,0 +1,3 @@ +pkg text/scanner, const AllowNumberbars = 1024 +pkg text/scanner, const AllowNumberbars ideal-int +pkg text/scanner, const GoTokens = 2036 diff --git a/doc/cmd.html b/doc/cmd.html index c590f4d3ec..e30684793a 100644 --- a/doc/cmd.html +++ b/doc/cmd.html @@ -18,10 +18,8 @@ underlying binary with arguments appropriate to package-level processing.
The programs can also be run as stand-alone binaries, with unmodified arguments,
-using the go tool subcommand, such as go tool vet.
-This style of invocation allows, for instance, checking a single source file
-rather than an entire package: go tool vet myprogram.go as
-compared to go vet mypackage.
+using the go tool subcommand, such as go tool cgo.
+For most commands this is mainly useful for debugging.
Some of the commands, such as pprof, are accessible only through
the go tool subcommand.
A summary of the changes between Go releases. Notes for the major releases:
"l" or "list" command to inspect source code.
-List a specific part of the source parametrizing "list" with a
+List a specific part of the source parameterizing "list" with a
function name (it must be qualified with its package name).
+Go 1.12 is a major release of Go. +Read the Go 1.12 Release Notes for more information. +
+diff --git a/doc/go1.12.html b/doc/go1.12.html index 3b086e7001..30d1960177 100644 --- a/doc/go1.12.html +++ b/doc/go1.12.html @@ -15,14 +15,7 @@ Do not send CLs removing the interior tags from such phrases. ul li { margin: 0.5em 0; } -
- - Go 1.12 is not yet released. These are work-in-progress - release notes. Go 1.12 is expected to be released in February 2019. - -
+
The latest Go release, version 1.12, arrives six months after Go 1.11.
@@ -109,7 +102,7 @@ Do not send CLs removing the interior tags from such phrases.
is no longer available with go vet. Checking for
variable shadowing may now be done using
-go install golang.org/x/tools/go/analysis/passes/shadow/cmd/shadow +go get -u golang.org/x/tools/go/analysis/passes/shadow/cmd/shadow go vet -vettool=$(which shadow)@@ -121,7 +114,7 @@ The Go tour is no longer included in the main binary distribution. To run the tour locally, instead of running
go tool tour,
manually install it:
-go install golang.org/x/tour +go get -u golang.org/x/tour tour@@ -303,7 +296,9 @@ for {
In Go 1.12, godoc no longer has a command-line interface and
is only a web server. Users should use go doc
- for command-line help output instead.
+ for command-line help output instead. Go 1.12 is the last release that will
+ include the godoc webserver; in Go 1.13 it will be available
+ via go get.
@@ -493,8 +488,11 @@ for {
- This release removes the optimized assembly implementations. RC4 is insecure - and should only be used for compatibility with legacy systems. + This release removes the assembly implementations, leaving only + the pure Go version. The Go compiler generates code that is + either slightly better or slightly worse, depending on the exact + CPU. RC4 is insecure and should only be used for compatibility + with legacy systems.
+ Parse,
+ ParseRequestURI,
+ and
+ URL.Parse
+ now return an
+ error for URLs containing ASCII control characters, which includes NULL,
+ tab, and newlines.
+
diff --git a/doc/go1.3.html b/doc/go1.3.html
index 18c638a1b5..feed6480c7 100644
--- a/doc/go1.3.html
+++ b/doc/go1.3.html
@@ -525,7 +525,7 @@ client.
The net/http package's
Request.ParseMultipartForm
method will now return an error if the body's Content-Type
-is not mutipart/form-data.
+is not multipart/form-data.
Prior to Go 1.3 it would silently fail and return nil.
Code that relies on the previous behavior should be updated.
diff --git a/doc/go_spec.html b/doc/go_spec.html
index dcc81ed628..f3d2320d86 100644
--- a/doc/go_spec.html
+++ b/doc/go_spec.html
@@ -1,6 +1,6 @@
@@ -3439,7 +3439,7 @@ to the type of the other operand.
-The right operand in a shift expression must have unsigned integer type
+The right operand in a shift expression must have integer type
or be an untyped constant representable by a
value of type uint.
If the left operand of a non-constant shift expression is an untyped constant,
@@ -3586,7 +3586,9 @@ be replaced by a bitwise AND operation:
The shift operators shift the left operand by the shift count specified by the
-right operand. They implement arithmetic shifts if the left operand is a signed
+right operand, which must be positive. If the shift count is negative at run time,
+a run-time panic occurs.
+The shift operators implement arithmetic shifts if the left operand is a signed
integer and logical shifts if it is an unsigned integer.
There is no upper limit on the shift count. Shifts behave
as if the left operand is shifted n times by 1 for a shift
@@ -5921,7 +5923,7 @@ var a = complex(2, -2) // complex128
const b = complex(1.0, -1.4) // untyped complex constant 1 - 1.4i
x := float32(math.Cos(math.Pi/2)) // float32
var c64 = complex(5, -x) // complex64
-var s uint = complex(1, 0) // untyped complex constant 1 + 0i can be converted to uint
+var s int = complex(1, 0) // untyped complex constant 1 + 0i can be converted to int
_ = complex(1, 2<<s) // illegal: 2 assumes floating-point type, cannot shift
var rl = real(c64) // float32
var im = imag(a) // float64
diff --git a/doc/install-source.html b/doc/install-source.html
index 2d12a28869..bbe7cdfd00 100644
--- a/doc/install-source.html
+++ b/doc/install-source.html
@@ -349,15 +349,7 @@ provides essential setup instructions for using the Go tools.
The source code for several Go tools (including godoc)
is kept in the go.tools repository.
-To install all of them, run the go get command:
-
-$ go get golang.org/x/tools/cmd/... -- -
-Or if you just want to install a specific command (godoc in this case):
+To install one of the tools (godoc in this case):
@@ -374,16 +366,6 @@ You must also have a workspace (GOPATH) set up; see How to Write Go Code for the details. --Note: The
-gocommand will install thegodoc-binary to$GOROOT/bin(or$GOBIN) and the -coverandvetbinaries to -$GOROOT/pkg/tool/$GOOS_$GOARCH. -You can access the latter commands with -"gotoolcover" and -"gotoolvet". -Community resources
@@ -666,7 +648,6 @@ something like this:
-export GOROOT=$HOME/go1.X export GOARCH=amd64 export GOOS=linuxdiff --git a/doc/install.html b/doc/install.html index ab192031c4..a41c60ba6c 100644 --- a/doc/install.html +++ b/doc/install.html @@ -171,11 +171,6 @@ command prompts for the change to take effect. Download the zip file and extract it into the directory of your choice (we suggestc:\Go). --If you chose a directory other than
-c:\Go, -you must set theGOROOTenvironment variable to your chosen path. -Add the
diff --git a/lib/time/update.bash b/lib/time/update.bash index 8d6785b9af..5dc74f9f0b 100755 --- a/lib/time/update.bash +++ b/lib/time/update.bash @@ -21,21 +21,8 @@ curl -L -O https://www.iana.org/time-zones/repository/releases/tzdata$DATA.tar.g tar xzf tzcode$CODE.tar.gz tar xzf tzdata$DATA.tar.gz -# Turn off 64-bit output in time zone files. -# We don't need those until 2037. -perl -p -i -e 's/pass <= 2/pass <= 1/' zic.c - make CFLAGS=-DSTD_INSPIRED AWK=awk TZDIR=zoneinfo posix_only -# America/Los_Angeles should not be bigger than 1100 bytes. -# If it is, we probably failed to disable the 64-bit output, which -# triples the size of the files. -size=$(ls -l zoneinfo/America/Los_Angeles | awk '{print $5}') -if [ $size -gt 1200 ]; then - echo 'zone file too large; 64-bit edit failed?' >&2 - exit 2 -fi - cd zoneinfo rm -f ../../zoneinfo.zip zip -0 -r ../../zoneinfo.zip * diff --git a/lib/time/zoneinfo.zip b/lib/time/zoneinfo.zip index bacb724322..a79e5d98fd 100644 Binary files a/lib/time/zoneinfo.zip and b/lib/time/zoneinfo.zip differ diff --git a/misc/android/README b/misc/android/README index f01ca2cc2b..38e7cf41e3 100644 --- a/misc/android/README +++ b/misc/android/README @@ -6,18 +6,18 @@ mobile subrepository: https://github.com/golang/mobile -To run the standard library tests, see androidtest.bash. Run it as +To run the standard library tests, enable Cgo and use an appropriate +C compiler from the Android NDK. For example, - CC_FOR_TARGET=$STANDALONE_NDK_PATH/bin/clang GOARCH=arm64 ./androidtest.bash - -To create a standalone android NDK tool chain, follow the instructions on - - https://developer.android.com/ndk/guides/standalone_toolchain + CGO_ENABLED=1 \ + GOOS=android \ + GOARCH=arm64 \ + CC=$NDK/toolchains/llvm/prebuilt/linux-x86_64/bin/aarch64-linux-android21-clang \ + ./all.bash To run tests on the Android device, add the bin directory to PATH so the go tool can find the go_android_$GOARCH_exec wrapper generated by -androidtest.bash. Then, use the same GOARCH as when androidtest.bash ran -and set GOOS to android. For example, to run the go1 benchmarks +make.bash. For example, to run the go1 benchmarks export PATH=$GOROOT/bin:$PATH cd $GOROOT/test/bench/go1/ diff --git a/misc/android/cleaner.go b/misc/android/cleaner.go deleted file mode 100644 index dafb162697..0000000000 --- a/misc/android/cleaner.go +++ /dev/null @@ -1,39 +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. - -// Cleaner removes anything from /data/local/tmp/goroot not on a builtin list. -// Used by androidtest.bash. -package main - -import ( - "log" - "os" - "path/filepath" - "strings" -) - -func main() { - const goroot = "/data/local/tmp/goroot" - expect := make(map[string]bool) - for _, f := range strings.Split(files, "\n") { - expect[filepath.Join(goroot, f)] = true - } - - err := filepath.Walk(goroot, func(path string, info os.FileInfo, err error) error { - if expect[path] { - return nil - } - log.Printf("removing %s", path) - if err := os.RemoveAll(path); err != nil { - return err - } - if info.IsDir() { - return filepath.SkipDir - } - return nil - }) - if err != nil { - log.Fatal(err) - } -} diff --git a/misc/android/go_android_exec.go b/misc/android/go_android_exec.go index c6270872c7..fa84f00f67 100644 --- a/misc/android/go_android_exec.go +++ b/misc/android/go_android_exec.go @@ -2,6 +2,8 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. +// +build ignore + // This program can be used as go_android_GOARCH_exec by the Go tool. // It executes binaries on an android device using adb. package main @@ -11,6 +13,7 @@ import ( "fmt" "go/build" "io" + "io/ioutil" "log" "os" "os/exec" @@ -57,6 +60,24 @@ func main() { log.SetFlags(0) log.SetPrefix("go_android_exec: ") + // Concurrent use of adb is flaky, so serialize adb commands. + // See https://github.com/golang/go/issues/23795 or + // https://issuetracker.google.com/issues/73230216. + lockPath := filepath.Join(os.TempDir(), "go_android_exec-adb-lock") + lock, err := os.OpenFile(lockPath, os.O_CREATE|os.O_RDWR, 0666) + if err != nil { + log.Fatal(err) + } + defer lock.Close() + if err := syscall.Flock(int(lock.Fd()), syscall.LOCK_EX); err != nil { + log.Fatal(err) + } + + // In case we're booting a device or emulator alongside androidtest.bash + // wait for it to be ready. adb wait-for-device is not enough, we have to + // wait for sys.boot_completed. + run("wait-for-device", "shell", "while [[ -z $(getprop sys.boot_completed) ]]; do sleep 1; done;") + // Prepare a temporary directory that will be cleaned up at the end. deviceGotmp := fmt.Sprintf("/data/local/tmp/%s-%d", filepath.Base(os.Args[1]), os.Getpid()) @@ -71,21 +92,20 @@ func main() { deviceCwd := filepath.Join(deviceGoroot, subdir) if !inGoRoot { deviceCwd = filepath.Join(deviceGopath, subdir) + } else { + adbSyncGoroot() } + run("shell", "mkdir", "-p", deviceCwd) // Binary names can conflict. // E.g. template.test from the {html,text}/template packages. binName := fmt.Sprintf("%s-%d", filepath.Base(os.Args[1]), os.Getpid()) deviceBin := fmt.Sprintf("%s/%s", deviceGotmp, binName) + run("push", os.Args[1], deviceBin) - // The push of the binary happens in parallel with other tests. - // Unfortunately, a simultaneous call to adb shell hold open - // file descriptors, so it is necessary to push then move to - // avoid a "text file busy" error on execution. - // https://code.google.com/p/android/issues/detail?id=65857 - run("push", os.Args[1], deviceBin+"-tmp") - run("shell", "cp '"+deviceBin+"-tmp' '"+deviceBin+"'") - run("shell", "rm '"+deviceBin+"-tmp'") + if _, err := os.Stat("testdata"); err == nil { + run("push", "testdata", deviceCwd) + } // Forward SIGQUIT from the go command to show backtraces from // the binary instead of from this wrapper. @@ -157,3 +177,46 @@ func subdir() (pkgpath string, underGoRoot bool) { cwd, runtime.GOROOT(), build.Default.GOPATH) return "", false } + +// adbSyncGoroot ensures that files necessary for testing the Go standard +// packages are present on the attached device. +func adbSyncGoroot() { + // Also known by cmd/dist. The bootstrap command deletes the file. + statPath := filepath.Join(os.TempDir(), "go_android_exec-adb-sync-status") + stat, err := os.OpenFile(statPath, os.O_CREATE|os.O_RDWR, 0666) + if err != nil { + log.Fatal(err) + } + defer stat.Close() + // Serialize check and syncing. + if err := syscall.Flock(int(stat.Fd()), syscall.LOCK_EX); err != nil { + log.Fatal(err) + } + s, err := ioutil.ReadAll(stat) + if err != nil { + log.Fatal(err) + } + if string(s) == "done" { + return + } + devRoot := "/data/local/tmp/goroot" + run("shell", "rm", "-rf", devRoot) + run("shell", "mkdir", "-p", devRoot+"/pkg") + goroot := runtime.GOROOT() + goCmd := filepath.Join(goroot, "bin", "go") + runtimea, err := exec.Command(goCmd, "list", "-f", "{{.Target}}", "runtime").Output() + if err != nil { + log.Fatal(err) + } + pkgdir := filepath.Dir(string(runtimea)) + if pkgdir == "" { + log.Fatal("could not find android pkg dir") + } + for _, dir := range []string{"src", "test", "lib"} { + run("push", filepath.Join(goroot, dir), filepath.Join(devRoot)) + } + run("push", filepath.Join(pkgdir), filepath.Join(devRoot, "pkg/")) + if _, err := stat.Write([]byte("done")); err != nil { + log.Fatal(err) + } +} diff --git a/misc/cgo/errors/errors_test.go b/misc/cgo/errors/errors_test.go index 59054f4703..f727158c48 100644 --- a/misc/cgo/errors/errors_test.go +++ b/misc/cgo/errors/errors_test.go @@ -18,7 +18,7 @@ import ( ) func path(file string) string { - return filepath.Join("src", file) + return filepath.Join("testdata", file) } func check(t *testing.T, file string) { diff --git a/misc/cgo/errors/ptr_test.go b/misc/cgo/errors/ptr_test.go index 254671f179..629f4c9226 100644 --- a/misc/cgo/errors/ptr_test.go +++ b/misc/cgo/errors/ptr_test.go @@ -444,8 +444,8 @@ func testOne(t *testing.T, pt ptrTest) { } defer os.RemoveAll(gopath) - src := filepath.Join(gopath, "src") - if err := os.Mkdir(src, 0777); err != nil { + src := filepath.Join(gopath, "src", "ptrtest") + if err := os.MkdirAll(src, 0777); err != nil { t.Fatal(err) } @@ -490,6 +490,11 @@ func testOne(t *testing.T, pt ptrTest) { } } + gomod := fmt.Sprintf("module %s\n", filepath.Base(src)) + if err := ioutil.WriteFile(filepath.Join(src, "go.mod"), []byte(gomod), 0666); err != nil { + t.Fatalf("writing go.mod: %v", err) + } + args := func(cmd *exec.Cmd) string { return strings.Join(cmd.Args, " ") } diff --git a/misc/cgo/errors/src/err1.go b/misc/cgo/errors/testdata/err1.go similarity index 100% rename from misc/cgo/errors/src/err1.go rename to misc/cgo/errors/testdata/err1.go diff --git a/misc/cgo/errors/src/err2.go b/misc/cgo/errors/testdata/err2.go similarity index 100% rename from misc/cgo/errors/src/err2.go rename to misc/cgo/errors/testdata/err2.go diff --git a/misc/cgo/errors/src/err3.go b/misc/cgo/errors/testdata/err3.go similarity index 100% rename from misc/cgo/errors/src/err3.go rename to misc/cgo/errors/testdata/err3.go diff --git a/misc/cgo/errors/src/err4.go b/misc/cgo/errors/testdata/err4.go similarity index 100% rename from misc/cgo/errors/src/err4.go rename to misc/cgo/errors/testdata/err4.go diff --git a/misc/cgo/errors/src/issue11097a.go b/misc/cgo/errors/testdata/issue11097a.go similarity index 100% rename from misc/cgo/errors/src/issue11097a.go rename to misc/cgo/errors/testdata/issue11097a.go diff --git a/misc/cgo/errors/src/issue11097b.go b/misc/cgo/errors/testdata/issue11097b.go similarity index 100% rename from misc/cgo/errors/src/issue11097b.go rename to misc/cgo/errors/testdata/issue11097b.go diff --git a/misc/cgo/errors/src/issue13129.go b/misc/cgo/errors/testdata/issue13129.go similarity index 100% rename from misc/cgo/errors/src/issue13129.go rename to misc/cgo/errors/testdata/issue13129.go diff --git a/misc/cgo/errors/src/issue13423.go b/misc/cgo/errors/testdata/issue13423.go similarity index 100% rename from misc/cgo/errors/src/issue13423.go rename to misc/cgo/errors/testdata/issue13423.go diff --git a/misc/cgo/errors/src/issue13467.go b/misc/cgo/errors/testdata/issue13467.go similarity index 100% rename from misc/cgo/errors/src/issue13467.go rename to misc/cgo/errors/testdata/issue13467.go diff --git a/misc/cgo/errors/src/issue13635.go b/misc/cgo/errors/testdata/issue13635.go similarity index 100% rename from misc/cgo/errors/src/issue13635.go rename to misc/cgo/errors/testdata/issue13635.go diff --git a/misc/cgo/errors/src/issue13830.go b/misc/cgo/errors/testdata/issue13830.go similarity index 100% rename from misc/cgo/errors/src/issue13830.go rename to misc/cgo/errors/testdata/issue13830.go diff --git a/misc/cgo/errors/src/issue14669.go b/misc/cgo/errors/testdata/issue14669.go similarity index 100% rename from misc/cgo/errors/src/issue14669.go rename to misc/cgo/errors/testdata/issue14669.go diff --git a/misc/cgo/errors/src/issue16116.go b/misc/cgo/errors/testdata/issue16116.go similarity index 100% rename from misc/cgo/errors/src/issue16116.go rename to misc/cgo/errors/testdata/issue16116.go diff --git a/misc/cgo/errors/src/issue16591.go b/misc/cgo/errors/testdata/issue16591.go similarity index 100% rename from misc/cgo/errors/src/issue16591.go rename to misc/cgo/errors/testdata/issue16591.go diff --git a/misc/cgo/errors/src/issue18452.go b/misc/cgo/errors/testdata/issue18452.go similarity index 100% rename from misc/cgo/errors/src/issue18452.go rename to misc/cgo/errors/testdata/issue18452.go diff --git a/misc/cgo/errors/src/issue18889.go b/misc/cgo/errors/testdata/issue18889.go similarity index 100% rename from misc/cgo/errors/src/issue18889.go rename to misc/cgo/errors/testdata/issue18889.go diff --git a/misc/cgo/errors/src/issue26745.go b/misc/cgo/errors/testdata/issue26745.go similarity index 100% rename from misc/cgo/errors/src/issue26745.go rename to misc/cgo/errors/testdata/issue26745.go diff --git a/misc/cgo/errors/src/issue28069.go b/misc/cgo/errors/testdata/issue28069.go similarity index 100% rename from misc/cgo/errors/src/issue28069.go rename to misc/cgo/errors/testdata/issue28069.go diff --git a/misc/cgo/errors/src/issue28721.go b/misc/cgo/errors/testdata/issue28721.go similarity index 100% rename from misc/cgo/errors/src/issue28721.go rename to misc/cgo/errors/testdata/issue28721.go diff --git a/misc/cgo/errors/src/issue7757.go b/misc/cgo/errors/testdata/issue7757.go similarity index 100% rename from misc/cgo/errors/src/issue7757.go rename to misc/cgo/errors/testdata/issue7757.go diff --git a/misc/cgo/errors/src/issue8442.go b/misc/cgo/errors/testdata/issue8442.go similarity index 100% rename from misc/cgo/errors/src/issue8442.go rename to misc/cgo/errors/testdata/issue8442.go diff --git a/misc/cgo/errors/src/long_double_size.go b/misc/cgo/errors/testdata/long_double_size.go similarity index 100% rename from misc/cgo/errors/src/long_double_size.go rename to misc/cgo/errors/testdata/long_double_size.go diff --git a/misc/cgo/errors/src/malloc.go b/misc/cgo/errors/testdata/malloc.go similarity index 100% rename from misc/cgo/errors/src/malloc.go rename to misc/cgo/errors/testdata/malloc.go diff --git a/misc/cgo/life/life_test.go b/misc/cgo/life/life_test.go new file mode 100644 index 0000000000..0f024c9d1d --- /dev/null +++ b/misc/cgo/life/life_test.go @@ -0,0 +1,61 @@ +// 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. + +package life_test + +import ( + "bytes" + "io/ioutil" + "log" + "os" + "os/exec" + "path/filepath" + "strings" + "testing" +) + +func TestMain(m *testing.M) { + log.SetFlags(log.Lshortfile) + os.Exit(testMain(m)) +} + +func testMain(m *testing.M) int { + GOPATH, err := ioutil.TempDir("", "cgolife") + if err != nil { + log.Panic(err) + } + defer os.RemoveAll(GOPATH) + os.Setenv("GOPATH", GOPATH) + + // Copy testdata into GOPATH/src/cgolife, along with a go.mod file + // declaring the same path. + modRoot := filepath.Join(GOPATH, "src", "cgolife") + if err := overlayDir(modRoot, "testdata"); err != nil { + log.Panic(err) + } + if err := os.Chdir(modRoot); err != nil { + log.Panic(err) + } + os.Setenv("PWD", modRoot) + if err := ioutil.WriteFile("go.mod", []byte("module cgolife\n"), 0666); err != nil { + log.Panic(err) + } + + return m.Run() +} + +func TestTestRun(t *testing.T) { + out, err := exec.Command("go", "env", "GOROOT").Output() + if err != nil { + t.Fatal(err) + } + GOROOT := string(bytes.TrimSpace(out)) + + cmd := exec.Command("go", "run", filepath.Join(GOROOT, "test", "run.go"), "-", ".") + out, err = cmd.CombinedOutput() + if err != nil { + t.Fatalf("%s: %s\n%s", strings.Join(cmd.Args, " "), err, out) + } + t.Logf("%s:\n%s", strings.Join(cmd.Args, " "), out) +} diff --git a/misc/cgo/life/overlaydir_test.go b/misc/cgo/life/overlaydir_test.go new file mode 100644 index 0000000000..f381ea62f3 --- /dev/null +++ b/misc/cgo/life/overlaydir_test.go @@ -0,0 +1,81 @@ +// 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. + +package life_test + +import ( + "io" + "os" + "path/filepath" + "strings" +) + +// overlayDir makes a minimal-overhead copy of srcRoot in which new files may be added. +// +// TODO: Once we no longer need to support the misc module in GOPATH mode, +// factor this function out into a package to reduce duplication. +func overlayDir(dstRoot, srcRoot string) error { + dstRoot = filepath.Clean(dstRoot) + if err := os.MkdirAll(dstRoot, 0777); err != nil { + return err + } + + symBase, err := filepath.Rel(srcRoot, dstRoot) + if err != nil { + symBase, err = filepath.Abs(srcRoot) + if err != nil { + return err + } + } + + return filepath.Walk(srcRoot, func(srcPath string, info os.FileInfo, err error) error { + if err != nil || srcPath == srcRoot { + return err + } + + suffix := strings.TrimPrefix(srcPath, srcRoot) + for len(suffix) > 0 && suffix[0] == filepath.Separator { + suffix = suffix[1:] + } + dstPath := filepath.Join(dstRoot, suffix) + + perm := info.Mode() & os.ModePerm + if info.Mode()&os.ModeSymlink != 0 { + info, err = os.Stat(srcPath) + if err != nil { + return err + } + perm = info.Mode() & os.ModePerm + } + + // Always copy directories (don't symlink them). + // If we add a file in the overlay, we don't want to add it in the original. + if info.IsDir() { + return os.Mkdir(dstPath, perm) + } + + // If the OS supports symlinks, use them instead of copying bytes. + if err := os.Symlink(filepath.Join(symBase, suffix), dstPath); err == nil { + return nil + } + + // Otherwise, copy the bytes. + src, err := os.Open(srcPath) + if err != nil { + return err + } + defer src.Close() + + dst, err := os.OpenFile(dstPath, os.O_WRONLY|os.O_CREATE|os.O_EXCL, perm) + if err != nil { + return err + } + + _, err = io.Copy(dst, src) + if closeErr := dst.Close(); err == nil { + err = closeErr + } + return err + }) +} diff --git a/misc/cgo/life/c-life.c b/misc/cgo/life/testdata/c-life.c similarity index 100% rename from misc/cgo/life/c-life.c rename to misc/cgo/life/testdata/c-life.c diff --git a/misc/cgo/life/life.go b/misc/cgo/life/testdata/life.go similarity index 98% rename from misc/cgo/life/life.go rename to misc/cgo/life/testdata/life.go index 170a620c87..2e0af81d05 100644 --- a/misc/cgo/life/life.go +++ b/misc/cgo/life/testdata/life.go @@ -4,7 +4,7 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. -package life +package cgolife // #include "life.h" import "C" diff --git a/misc/cgo/life/life.h b/misc/cgo/life/testdata/life.h similarity index 100% rename from misc/cgo/life/life.h rename to misc/cgo/life/testdata/life.h diff --git a/misc/cgo/life/main.go b/misc/cgo/life/testdata/main.go similarity index 94% rename from misc/cgo/life/main.go rename to misc/cgo/life/testdata/main.go index 145a273bdd..cc2ca7c742 100644 --- a/misc/cgo/life/main.go +++ b/misc/cgo/life/testdata/main.go @@ -14,7 +14,7 @@ import ( "flag" "fmt" - "." + "cgolife" ) const MAXDIM = 100 @@ -34,7 +34,7 @@ func main() { } } - life.Run(*gen, *dim, *dim, a[:]) + cgolife.Run(*gen, *dim, *dim, a[:]) for i := 0; i < *dim; i++ { for j := 0; j < *dim; j++ { diff --git a/misc/cgo/life/main.out b/misc/cgo/life/testdata/main.out similarity index 100% rename from misc/cgo/life/main.out rename to misc/cgo/life/testdata/main.out diff --git a/misc/cgo/stdio/overlaydir_test.go b/misc/cgo/stdio/overlaydir_test.go new file mode 100644 index 0000000000..8a8dcdb3a5 --- /dev/null +++ b/misc/cgo/stdio/overlaydir_test.go @@ -0,0 +1,81 @@ +// 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. + +package stdio_test + +import ( + "io" + "os" + "path/filepath" + "strings" +) + +// overlayDir makes a minimal-overhead copy of srcRoot in which new files may be added. +// +// TODO: Once we no longer need to support the misc module in GOPATH mode, +// factor this function out into a package to reduce duplication. +func overlayDir(dstRoot, srcRoot string) error { + dstRoot = filepath.Clean(dstRoot) + if err := os.MkdirAll(dstRoot, 0777); err != nil { + return err + } + + symBase, err := filepath.Rel(srcRoot, dstRoot) + if err != nil { + symBase, err = filepath.Abs(srcRoot) + if err != nil { + return err + } + } + + return filepath.Walk(srcRoot, func(srcPath string, info os.FileInfo, err error) error { + if err != nil || srcPath == srcRoot { + return err + } + + suffix := strings.TrimPrefix(srcPath, srcRoot) + for len(suffix) > 0 && suffix[0] == filepath.Separator { + suffix = suffix[1:] + } + dstPath := filepath.Join(dstRoot, suffix) + + perm := info.Mode() & os.ModePerm + if info.Mode()&os.ModeSymlink != 0 { + info, err = os.Stat(srcPath) + if err != nil { + return err + } + perm = info.Mode() & os.ModePerm + } + + // Always copy directories (don't symlink them). + // If we add a file in the overlay, we don't want to add it in the original. + if info.IsDir() { + return os.Mkdir(dstPath, perm) + } + + // If the OS supports symlinks, use them instead of copying bytes. + if err := os.Symlink(filepath.Join(symBase, suffix), dstPath); err == nil { + return nil + } + + // Otherwise, copy the bytes. + src, err := os.Open(srcPath) + if err != nil { + return err + } + defer src.Close() + + dst, err := os.OpenFile(dstPath, os.O_WRONLY|os.O_CREATE|os.O_EXCL, perm) + if err != nil { + return err + } + + _, err = io.Copy(dst, src) + if closeErr := dst.Close(); err == nil { + err = closeErr + } + return err + }) +} diff --git a/misc/cgo/stdio/stdio_test.go b/misc/cgo/stdio/stdio_test.go new file mode 100644 index 0000000000..85ab6ae3e5 --- /dev/null +++ b/misc/cgo/stdio/stdio_test.go @@ -0,0 +1,61 @@ +// 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. + +package stdio_test + +import ( + "bytes" + "io/ioutil" + "log" + "os" + "os/exec" + "path/filepath" + "strings" + "testing" +) + +func TestMain(m *testing.M) { + log.SetFlags(log.Lshortfile) + os.Exit(testMain(m)) +} + +func testMain(m *testing.M) int { + GOPATH, err := ioutil.TempDir("", "cgostdio") + if err != nil { + log.Panic(err) + } + defer os.RemoveAll(GOPATH) + os.Setenv("GOPATH", GOPATH) + + // Copy testdata into GOPATH/src/cgostdio, along with a go.mod file + // declaring the same path. + modRoot := filepath.Join(GOPATH, "src", "cgostdio") + if err := overlayDir(modRoot, "testdata"); err != nil { + log.Panic(err) + } + if err := os.Chdir(modRoot); err != nil { + log.Panic(err) + } + os.Setenv("PWD", modRoot) + if err := ioutil.WriteFile("go.mod", []byte("module cgostdio\n"), 0666); err != nil { + log.Panic(err) + } + + return m.Run() +} + +func TestTestRun(t *testing.T) { + out, err := exec.Command("go", "env", "GOROOT").Output() + if err != nil { + t.Fatal(err) + } + GOROOT := string(bytes.TrimSpace(out)) + + cmd := exec.Command("go", "run", filepath.Join(GOROOT, "test", "run.go"), "-", ".") + out, err = cmd.CombinedOutput() + if err != nil { + t.Fatalf("%s: %s\n%s", strings.Join(cmd.Args, " "), err, out) + } + t.Logf("%s:\n%s", strings.Join(cmd.Args, " "), out) +} diff --git a/misc/cgo/stdio/chain.go b/misc/cgo/stdio/testdata/chain.go similarity index 98% rename from misc/cgo/stdio/chain.go rename to misc/cgo/stdio/testdata/chain.go index cdc385208c..6c3f406a0d 100644 --- a/misc/cgo/stdio/chain.go +++ b/misc/cgo/stdio/testdata/chain.go @@ -14,7 +14,7 @@ import ( "runtime" "strconv" - "../stdio" + "cgostdio/stdio" ) const N = 10 diff --git a/misc/cgo/stdio/chain.out b/misc/cgo/stdio/testdata/chain.out similarity index 100% rename from misc/cgo/stdio/chain.out rename to misc/cgo/stdio/testdata/chain.out diff --git a/misc/cgo/stdio/fib.go b/misc/cgo/stdio/testdata/fib.go similarity index 98% rename from misc/cgo/stdio/fib.go rename to misc/cgo/stdio/testdata/fib.go index 58f185c90f..49cb0ea06f 100644 --- a/misc/cgo/stdio/fib.go +++ b/misc/cgo/stdio/testdata/fib.go @@ -17,7 +17,7 @@ import ( "runtime" "strconv" - "../stdio" + "cgostdio/stdio" ) func fibber(c, out chan int64, i int64) { diff --git a/misc/cgo/stdio/fib.out b/misc/cgo/stdio/testdata/fib.out similarity index 100% rename from misc/cgo/stdio/fib.out rename to misc/cgo/stdio/testdata/fib.out diff --git a/misc/cgo/stdio/hello.go b/misc/cgo/stdio/testdata/hello.go similarity index 92% rename from misc/cgo/stdio/hello.go rename to misc/cgo/stdio/testdata/hello.go index 56220d34be..046bfee7a7 100644 --- a/misc/cgo/stdio/hello.go +++ b/misc/cgo/stdio/testdata/hello.go @@ -8,7 +8,7 @@ package main -import "../stdio" +import "cgostdio/stdio" func main() { stdio.Stdout.WriteString(stdio.Greeting + "\n") diff --git a/misc/cgo/stdio/hello.out b/misc/cgo/stdio/testdata/hello.out similarity index 100% rename from misc/cgo/stdio/hello.out rename to misc/cgo/stdio/testdata/hello.out diff --git a/misc/cgo/stdio/run.out b/misc/cgo/stdio/testdata/run.out similarity index 100% rename from misc/cgo/stdio/run.out rename to misc/cgo/stdio/testdata/run.out diff --git a/misc/cgo/stdio/file.go b/misc/cgo/stdio/testdata/stdio/file.go similarity index 100% rename from misc/cgo/stdio/file.go rename to misc/cgo/stdio/testdata/stdio/file.go diff --git a/misc/cgo/stdio/stdio.go b/misc/cgo/stdio/testdata/stdio/stdio.go similarity index 100% rename from misc/cgo/stdio/stdio.go rename to misc/cgo/stdio/testdata/stdio/stdio.go diff --git a/misc/cgo/test/callback.go b/misc/cgo/test/callback.go index 4fc6b39ffa..d48aeaabd9 100644 --- a/misc/cgo/test/callback.go +++ b/misc/cgo/test/callback.go @@ -209,6 +209,10 @@ func testCallbackCallers(t *testing.T) { if strings.HasPrefix(fname, "_") { fname = path.Base(f.Name()[1:]) } + // In module mode, this package has a fully-qualified import path. + // Remove it if present. + fname = strings.TrimPrefix(fname, "misc/cgo/") + namei := "" if i < len(name) { namei = name[i] diff --git a/misc/cgo/test/cgo_linux_test.go b/misc/cgo/test/cgo_linux_test.go index 9c15f69e40..c2e96b5387 100644 --- a/misc/cgo/test/cgo_linux_test.go +++ b/misc/cgo/test/cgo_linux_test.go @@ -9,4 +9,3 @@ import "testing" func TestSetgid(t *testing.T) { testSetgid(t) } func Test6997(t *testing.T) { test6997(t) } func TestBuildID(t *testing.T) { testBuildID(t) } -func Test9400(t *testing.T) { test9400(t) } diff --git a/misc/cgo/test/cgo_test.go b/misc/cgo/test/cgo_test.go index 2cb93d9c2e..2d6d269608 100644 --- a/misc/cgo/test/cgo_test.go +++ b/misc/cgo/test/cgo_test.go @@ -10,91 +10,85 @@ import "testing" // so that they can use cgo (import "C"). // These wrappers are here for gotest to find. -func TestAlign(t *testing.T) { testAlign(t) } -func TestConst(t *testing.T) { testConst(t) } -func TestEnum(t *testing.T) { testEnum(t) } -func TestAtol(t *testing.T) { testAtol(t) } -func TestErrno(t *testing.T) { testErrno(t) } -func TestMultipleAssign(t *testing.T) { testMultipleAssign(t) } -func TestUnsignedInt(t *testing.T) { testUnsignedInt(t) } -func TestCallback(t *testing.T) { testCallback(t) } -func TestCallbackGC(t *testing.T) { testCallbackGC(t) } -func TestCallbackPanic(t *testing.T) { testCallbackPanic(t) } -func TestCallbackPanicLoop(t *testing.T) { testCallbackPanicLoop(t) } -func TestCallbackPanicLocked(t *testing.T) { testCallbackPanicLocked(t) } -func TestPanicFromC(t *testing.T) { testPanicFromC(t) } -func TestZeroArgCallback(t *testing.T) { testZeroArgCallback(t) } -func TestBlocking(t *testing.T) { testBlocking(t) } func Test1328(t *testing.T) { test1328(t) } -func TestParallelSleep(t *testing.T) { testParallelSleep(t) } -func TestSetEnv(t *testing.T) { testSetEnv(t) } -func TestHelpers(t *testing.T) { testHelpers(t) } -func TestLibgcc(t *testing.T) { testLibgcc(t) } func Test1635(t *testing.T) { test1635(t) } -func TestPrintf(t *testing.T) { testPrintf(t) } -func Test4029(t *testing.T) { test4029(t) } -func TestBoolAlign(t *testing.T) { testBoolAlign(t) } +func Test3250(t *testing.T) { test3250(t) } func Test3729(t *testing.T) { test3729(t) } func Test3775(t *testing.T) { test3775(t) } -func TestCthread(t *testing.T) { testCthread(t) } -func TestCallbackCallers(t *testing.T) { testCallbackCallers(t) } +func Test4029(t *testing.T) { test4029(t) } +func Test4339(t *testing.T) { test4339(t) } func Test5227(t *testing.T) { test5227(t) } -func TestCflags(t *testing.T) { testCflags(t) } +func Test5242(t *testing.T) { test5242(t) } func Test5337(t *testing.T) { test5337(t) } func Test5548(t *testing.T) { test5548(t) } func Test5603(t *testing.T) { test5603(t) } -func Test6833(t *testing.T) { test6833(t) } -func Test3250(t *testing.T) { test3250(t) } -func TestCallbackStack(t *testing.T) { testCallbackStack(t) } -func TestFpVar(t *testing.T) { testFpVar(t) } -func Test4339(t *testing.T) { test4339(t) } -func Test6390(t *testing.T) { test6390(t) } func Test5986(t *testing.T) { test5986(t) } -func Test7665(t *testing.T) { test7665(t) } -func TestNaming(t *testing.T) { testNaming(t) } +func Test6390(t *testing.T) { test6390(t) } +func Test6833(t *testing.T) { test6833(t) } +func Test6907(t *testing.T) { test6907(t) } +func Test6907Go(t *testing.T) { test6907Go(t) } func Test7560(t *testing.T) { test7560(t) } -func Test5242(t *testing.T) { test5242(t) } -func Test8092(t *testing.T) { test8092(t) } +func Test7665(t *testing.T) { test7665(t) } func Test7978(t *testing.T) { test7978(t) } -func Test8694(t *testing.T) { test8694(t) } +func Test8092(t *testing.T) { test8092(t) } func Test8517(t *testing.T) { test8517(t) } +func Test8694(t *testing.T) { test8694(t) } func Test8811(t *testing.T) { test8811(t) } -func TestReturnAfterGrow(t *testing.T) { testReturnAfterGrow(t) } -func TestReturnAfterGrowFromGo(t *testing.T) { testReturnAfterGrowFromGo(t) } -func Test9026(t *testing.T) { test9026(t) } -func Test9510(t *testing.T) { test9510(t) } func Test9557(t *testing.T) { test9557(t) } func Test10303(t *testing.T) { test10303(t, 10) } func Test11925(t *testing.T) { test11925(t) } func Test12030(t *testing.T) { test12030(t) } -func TestGCC68255(t *testing.T) { testGCC68255(t) } -func TestCallGoWithString(t *testing.T) { testCallGoWithString(t) } func Test14838(t *testing.T) { test14838(t) } -func Test8756(t *testing.T) { test8756(t) } func Test17065(t *testing.T) { test17065(t) } -func TestThreadLock(t *testing.T) { testThreadLockFunc(t) } -func TestCheckConst(t *testing.T) { testCheckConst(t) } func Test17537(t *testing.T) { test17537(t) } func Test18126(t *testing.T) { test18126(t) } -func Test20369(t *testing.T) { test20369(t) } func Test18720(t *testing.T) { test18720(t) } -func Test20266(t *testing.T) { test20266(t) } func Test20129(t *testing.T) { test20129(t) } +func Test20369(t *testing.T) { test20369(t) } func Test20910(t *testing.T) { test20910(t) } func Test21708(t *testing.T) { test21708(t) } func Test21809(t *testing.T) { test21809(t) } -func Test6907(t *testing.T) { test6907(t) } -func Test6907Go(t *testing.T) { test6907Go(t) } func Test21897(t *testing.T) { test21897(t) } func Test22906(t *testing.T) { test22906(t) } +func Test23356(t *testing.T) { test23356(t) } func Test24206(t *testing.T) { test24206(t) } func Test25143(t *testing.T) { test25143(t) } -func Test23356(t *testing.T) { test23356(t) } func Test26066(t *testing.T) { test26066(t) } -func Test26213(t *testing.T) { test26213(t) } func Test27660(t *testing.T) { test27660(t) } func Test28896(t *testing.T) { test28896(t) } func Test30065(t *testing.T) { test30065(t) } +func TestAlign(t *testing.T) { testAlign(t) } +func TestAtol(t *testing.T) { testAtol(t) } +func TestBlocking(t *testing.T) { testBlocking(t) } +func TestBoolAlign(t *testing.T) { testBoolAlign(t) } +func TestCallGoWithString(t *testing.T) { testCallGoWithString(t) } +func TestCallback(t *testing.T) { testCallback(t) } +func TestCallbackCallers(t *testing.T) { testCallbackCallers(t) } +func TestCallbackGC(t *testing.T) { testCallbackGC(t) } +func TestCallbackPanic(t *testing.T) { testCallbackPanic(t) } +func TestCallbackPanicLocked(t *testing.T) { testCallbackPanicLocked(t) } +func TestCallbackPanicLoop(t *testing.T) { testCallbackPanicLoop(t) } +func TestCallbackStack(t *testing.T) { testCallbackStack(t) } +func TestCflags(t *testing.T) { testCflags(t) } +func TestCheckConst(t *testing.T) { testCheckConst(t) } +func TestConst(t *testing.T) { testConst(t) } +func TestCthread(t *testing.T) { testCthread(t) } +func TestEnum(t *testing.T) { testEnum(t) } +func TestErrno(t *testing.T) { testErrno(t) } +func TestFpVar(t *testing.T) { testFpVar(t) } +func TestHelpers(t *testing.T) { testHelpers(t) } +func TestLibgcc(t *testing.T) { testLibgcc(t) } +func TestMultipleAssign(t *testing.T) { testMultipleAssign(t) } +func TestNaming(t *testing.T) { testNaming(t) } +func TestPanicFromC(t *testing.T) { testPanicFromC(t) } +func TestParallelSleep(t *testing.T) { testParallelSleep(t) } +func TestPrintf(t *testing.T) { testPrintf(t) } +func TestReturnAfterGrow(t *testing.T) { testReturnAfterGrow(t) } +func TestReturnAfterGrowFromGo(t *testing.T) { testReturnAfterGrowFromGo(t) } +func TestSetEnv(t *testing.T) { testSetEnv(t) } +func TestThreadLock(t *testing.T) { testThreadLockFunc(t) } +func TestUnsignedInt(t *testing.T) { testUnsignedInt(t) } +func TestZeroArgCallback(t *testing.T) { testZeroArgCallback(t) } func BenchmarkCgoCall(b *testing.B) { benchCgoCall(b) } func BenchmarkGoString(b *testing.B) { benchGoString(b) } diff --git a/misc/cgo/test/overlaydir_test.go b/misc/cgo/test/overlaydir_test.go new file mode 100644 index 0000000000..1b5c67de70 --- /dev/null +++ b/misc/cgo/test/overlaydir_test.go @@ -0,0 +1,81 @@ +// 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. + +package cgotest + +import ( + "io" + "os" + "path/filepath" + "strings" +) + +// overlayDir makes a minimal-overhead copy of srcRoot in which new files may be added. +// +// TODO: Once we no longer need to support the misc module in GOPATH mode, +// factor this function out into a package to reduce duplication. +func overlayDir(dstRoot, srcRoot string) error { + dstRoot = filepath.Clean(dstRoot) + if err := os.MkdirAll(dstRoot, 0777); err != nil { + return err + } + + symBase, err := filepath.Rel(srcRoot, dstRoot) + if err != nil { + symBase, err = filepath.Abs(srcRoot) + if err != nil { + return err + } + } + + return filepath.Walk(srcRoot, func(srcPath string, info os.FileInfo, err error) error { + if err != nil || srcPath == srcRoot { + return err + } + + suffix := strings.TrimPrefix(srcPath, srcRoot) + for len(suffix) > 0 && suffix[0] == filepath.Separator { + suffix = suffix[1:] + } + dstPath := filepath.Join(dstRoot, suffix) + + perm := info.Mode() & os.ModePerm + if info.Mode()&os.ModeSymlink != 0 { + info, err = os.Stat(srcPath) + if err != nil { + return err + } + perm = info.Mode() & os.ModePerm + } + + // Always copy directories (don't symlink them). + // If we add a file in the overlay, we don't want to add it in the original. + if info.IsDir() { + return os.Mkdir(dstPath, perm) + } + + // If the OS supports symlinks, use them instead of copying bytes. + if err := os.Symlink(filepath.Join(symBase, suffix), dstPath); err == nil { + return nil + } + + // Otherwise, copy the bytes. + src, err := os.Open(srcPath) + if err != nil { + return err + } + defer src.Close() + + dst, err := os.OpenFile(dstPath, os.O_WRONLY|os.O_CREATE|os.O_EXCL, perm) + if err != nil { + return err + } + + _, err = io.Copy(dst, src) + if closeErr := dst.Close(); err == nil { + err = closeErr + } + return err + }) +} diff --git a/misc/cgo/test/pkg_test.go b/misc/cgo/test/pkg_test.go new file mode 100644 index 0000000000..6857609a10 --- /dev/null +++ b/misc/cgo/test/pkg_test.go @@ -0,0 +1,66 @@ +// 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. + +package cgotest + +import ( + "io/ioutil" + "os" + "os/exec" + "path/filepath" + "runtime" + "strings" + "testing" +) + +// TestCrossPackageTests compiles and runs tests that depend on imports of other +// local packages, using source code stored in the testdata directory. +// +// The tests in the misc directory tree do not have a valid import path in +// GOPATH mode, so they previously used relative imports. However, relative +// imports do not work in module mode. In order to make the test work in both +// modes, we synthesize a GOPATH in which the module paths are equivalent, and +// run the tests as a subprocess. +// +// If and when we no longer support these tests in GOPATH mode, we can remove +// this shim and move the tests currently located in testdata back into the +// parent directory. +func TestCrossPackageTests(t *testing.T) { + if runtime.GOOS == "darwin" { + switch runtime.GOARCH { + case "arm", "arm64": + t.Skip("Can't exec cmd/go subprocess on iOS.") + } + } + + GOPATH, err := ioutil.TempDir("", "cgotest") + if err != nil { + t.Fatal(err) + } + defer os.RemoveAll(GOPATH) + + modRoot := filepath.Join(GOPATH, "src", "cgotest") + if err := overlayDir(modRoot, "testdata"); err != nil { + t.Fatal(err) + } + if err := ioutil.WriteFile(filepath.Join(modRoot, "go.mod"), []byte("module cgotest\n"), 0666); err != nil { + t.Fatal(err) + } + + cmd := exec.Command("go", "test") + if testing.Verbose() { + cmd.Args = append(cmd.Args, "-v") + } + if testing.Short() { + cmd.Args = append(cmd.Args, "-short") + } + cmd.Dir = modRoot + cmd.Env = append(os.Environ(), "GOPATH="+GOPATH) + out, err := cmd.CombinedOutput() + if err == nil { + t.Logf("%s:\n%s", strings.Join(cmd.Args, " "), out) + } else { + t.Fatalf("%s: %s\n%s", strings.Join(cmd.Args, " "), err, out) + } +} diff --git a/misc/cgo/test/testdata/cgo_linux_test.go b/misc/cgo/test/testdata/cgo_linux_test.go new file mode 100644 index 0000000000..5cef09fbe7 --- /dev/null +++ b/misc/cgo/test/testdata/cgo_linux_test.go @@ -0,0 +1,9 @@ +// 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. + +package cgotest + +import "testing" + +func Test9400(t *testing.T) { test9400(t) } diff --git a/misc/cgo/test/testdata/cgo_test.go b/misc/cgo/test/testdata/cgo_test.go new file mode 100644 index 0000000000..ffa076f4ee --- /dev/null +++ b/misc/cgo/test/testdata/cgo_test.go @@ -0,0 +1,18 @@ +// Copyright 2011 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +package cgotest + +import "testing" + +// The actual test functions are in non-_test.go files +// so that they can use cgo (import "C"). +// These wrappers are here for gotest to find. + +func Test8756(t *testing.T) { test8756(t) } +func Test9026(t *testing.T) { test9026(t) } +func Test9510(t *testing.T) { test9510(t) } +func Test20266(t *testing.T) { test20266(t) } +func Test26213(t *testing.T) { test26213(t) } +func TestGCC68255(t *testing.T) { testGCC68255(t) } diff --git a/misc/cgo/test/gcc68255.go b/misc/cgo/test/testdata/gcc68255.go similarity index 93% rename from misc/cgo/test/gcc68255.go rename to misc/cgo/test/testdata/gcc68255.go index 23e103dc10..b431462349 100644 --- a/misc/cgo/test/gcc68255.go +++ b/misc/cgo/test/testdata/gcc68255.go @@ -7,7 +7,7 @@ package cgotest import ( "testing" - "./gcc68255" + "cgotest/gcc68255" ) func testGCC68255(t *testing.T) { diff --git a/misc/cgo/test/gcc68255/a.go b/misc/cgo/test/testdata/gcc68255/a.go similarity index 100% rename from misc/cgo/test/gcc68255/a.go rename to misc/cgo/test/testdata/gcc68255/a.go diff --git a/misc/cgo/test/gcc68255/c.c b/misc/cgo/test/testdata/gcc68255/c.c similarity index 100% rename from misc/cgo/test/gcc68255/c.c rename to misc/cgo/test/testdata/gcc68255/c.c diff --git a/misc/cgo/test/gcc68255/c.h b/misc/cgo/test/testdata/gcc68255/c.h similarity index 100% rename from misc/cgo/test/gcc68255/c.h rename to misc/cgo/test/testdata/gcc68255/c.h diff --git a/misc/cgo/test/issue20266.go b/misc/cgo/test/testdata/issue20266.go similarity index 100% rename from misc/cgo/test/issue20266.go rename to misc/cgo/test/testdata/issue20266.go diff --git a/misc/cgo/test/issue20266/issue20266.h b/misc/cgo/test/testdata/issue20266/issue20266.h similarity index 100% rename from misc/cgo/test/issue20266/issue20266.h rename to misc/cgo/test/testdata/issue20266/issue20266.h diff --git a/misc/cgo/test/issue23555.go b/misc/cgo/test/testdata/issue23555.go similarity index 82% rename from misc/cgo/test/issue23555.go rename to misc/cgo/test/testdata/issue23555.go index 5fa44e6355..4e944b5acd 100644 --- a/misc/cgo/test/issue23555.go +++ b/misc/cgo/test/testdata/issue23555.go @@ -7,5 +7,5 @@ package cgotest -import _ "./issue23555a" -import _ "./issue23555b" +import _ "cgotest/issue23555a" +import _ "cgotest/issue23555b" diff --git a/misc/cgo/test/issue23555a/a.go b/misc/cgo/test/testdata/issue23555a/a.go similarity index 100% rename from misc/cgo/test/issue23555a/a.go rename to misc/cgo/test/testdata/issue23555a/a.go diff --git a/misc/cgo/test/issue23555b/a.go b/misc/cgo/test/testdata/issue23555b/a.go similarity index 100% rename from misc/cgo/test/issue23555b/a.go rename to misc/cgo/test/testdata/issue23555b/a.go diff --git a/misc/cgo/test/issue24161_darwin_test.go b/misc/cgo/test/testdata/issue24161_darwin_test.go similarity index 85% rename from misc/cgo/test/issue24161_darwin_test.go rename to misc/cgo/test/testdata/issue24161_darwin_test.go index 48072ff121..64f4442856 100644 --- a/misc/cgo/test/issue24161_darwin_test.go +++ b/misc/cgo/test/testdata/issue24161_darwin_test.go @@ -15,11 +15,11 @@ package cgotest import ( "testing" - "./issue24161arg" - "./issue24161e0" - "./issue24161e1" - "./issue24161e2" - "./issue24161res" + "cgotest/issue24161arg" + "cgotest/issue24161e0" + "cgotest/issue24161e1" + "cgotest/issue24161e2" + "cgotest/issue24161res" ) func Test24161Arg(t *testing.T) { diff --git a/misc/cgo/test/issue24161arg/def.go b/misc/cgo/test/testdata/issue24161arg/def.go similarity index 100% rename from misc/cgo/test/issue24161arg/def.go rename to misc/cgo/test/testdata/issue24161arg/def.go diff --git a/misc/cgo/test/issue24161arg/use.go b/misc/cgo/test/testdata/issue24161arg/use.go similarity index 100% rename from misc/cgo/test/issue24161arg/use.go rename to misc/cgo/test/testdata/issue24161arg/use.go diff --git a/misc/cgo/test/issue24161e0/main.go b/misc/cgo/test/testdata/issue24161e0/main.go similarity index 100% rename from misc/cgo/test/issue24161e0/main.go rename to misc/cgo/test/testdata/issue24161e0/main.go diff --git a/misc/cgo/test/issue24161e1/main.go b/misc/cgo/test/testdata/issue24161e1/main.go similarity index 100% rename from misc/cgo/test/issue24161e1/main.go rename to misc/cgo/test/testdata/issue24161e1/main.go diff --git a/misc/cgo/test/issue24161e2/main.go b/misc/cgo/test/testdata/issue24161e2/main.go similarity index 100% rename from misc/cgo/test/issue24161e2/main.go rename to misc/cgo/test/testdata/issue24161e2/main.go diff --git a/misc/cgo/test/issue24161res/restype.go b/misc/cgo/test/testdata/issue24161res/restype.go similarity index 100% rename from misc/cgo/test/issue24161res/restype.go rename to misc/cgo/test/testdata/issue24161res/restype.go diff --git a/misc/cgo/test/issue26213/jni.h b/misc/cgo/test/testdata/issue26213/jni.h similarity index 100% rename from misc/cgo/test/issue26213/jni.h rename to misc/cgo/test/testdata/issue26213/jni.h diff --git a/misc/cgo/test/issue26213/test26213.go b/misc/cgo/test/testdata/issue26213/test26213.go similarity index 100% rename from misc/cgo/test/issue26213/test26213.go rename to misc/cgo/test/testdata/issue26213/test26213.go diff --git a/misc/cgo/test/issue26430.go b/misc/cgo/test/testdata/issue26430.go similarity index 90% rename from misc/cgo/test/issue26430.go rename to misc/cgo/test/testdata/issue26430.go index 3ad5420989..14c7a7c307 100644 --- a/misc/cgo/test/issue26430.go +++ b/misc/cgo/test/testdata/issue26430.go @@ -7,4 +7,4 @@ package cgotest -import _ "./issue26430" +import _ "cgotest/issue26430" diff --git a/misc/cgo/test/issue26430/a.go b/misc/cgo/test/testdata/issue26430/a.go similarity index 100% rename from misc/cgo/test/issue26430/a.go rename to misc/cgo/test/testdata/issue26430/a.go diff --git a/misc/cgo/test/issue26430/b.go b/misc/cgo/test/testdata/issue26430/b.go similarity index 100% rename from misc/cgo/test/issue26430/b.go rename to misc/cgo/test/testdata/issue26430/b.go diff --git a/misc/cgo/test/issue26743.go b/misc/cgo/test/testdata/issue26743.go similarity index 90% rename from misc/cgo/test/issue26743.go rename to misc/cgo/test/testdata/issue26743.go index 35c8473a61..000fb2bfdf 100644 --- a/misc/cgo/test/issue26743.go +++ b/misc/cgo/test/testdata/issue26743.go @@ -7,4 +7,4 @@ package cgotest -import _ "./issue26743" +import _ "cgotest/issue26743" diff --git a/misc/cgo/test/issue26743/a.go b/misc/cgo/test/testdata/issue26743/a.go similarity index 100% rename from misc/cgo/test/issue26743/a.go rename to misc/cgo/test/testdata/issue26743/a.go diff --git a/misc/cgo/test/issue26743/b.go b/misc/cgo/test/testdata/issue26743/b.go similarity index 100% rename from misc/cgo/test/issue26743/b.go rename to misc/cgo/test/testdata/issue26743/b.go diff --git a/misc/cgo/test/issue27054/egl.h b/misc/cgo/test/testdata/issue27054/egl.h similarity index 100% rename from misc/cgo/test/issue27054/egl.h rename to misc/cgo/test/testdata/issue27054/egl.h diff --git a/misc/cgo/test/issue27054/test27054.go b/misc/cgo/test/testdata/issue27054/test27054.go similarity index 100% rename from misc/cgo/test/issue27054/test27054.go rename to misc/cgo/test/testdata/issue27054/test27054.go diff --git a/misc/cgo/test/issue27340.go b/misc/cgo/test/testdata/issue27340.go similarity index 91% rename from misc/cgo/test/issue27340.go rename to misc/cgo/test/testdata/issue27340.go index f8c8a87f20..337550f608 100644 --- a/misc/cgo/test/issue27340.go +++ b/misc/cgo/test/testdata/issue27340.go @@ -7,6 +7,6 @@ package cgotest -import "./issue27340" +import "cgotest/issue27340" var issue27340Var = issue27340.Issue27340GoFunc diff --git a/misc/cgo/test/issue27340/a.go b/misc/cgo/test/testdata/issue27340/a.go similarity index 100% rename from misc/cgo/test/issue27340/a.go rename to misc/cgo/test/testdata/issue27340/a.go diff --git a/misc/cgo/test/issue8756.go b/misc/cgo/test/testdata/issue8756.go similarity index 88% rename from misc/cgo/test/issue8756.go rename to misc/cgo/test/testdata/issue8756.go index d8ee3b8213..406c64c0f3 100644 --- a/misc/cgo/test/issue8756.go +++ b/misc/cgo/test/testdata/issue8756.go @@ -8,7 +8,7 @@ import "C" import ( "testing" - "./issue8756" + "cgotest/issue8756" ) func test8756(t *testing.T) { diff --git a/misc/cgo/test/issue8756/issue8756.go b/misc/cgo/test/testdata/issue8756/issue8756.go similarity index 100% rename from misc/cgo/test/issue8756/issue8756.go rename to misc/cgo/test/testdata/issue8756/issue8756.go diff --git a/misc/cgo/test/issue8828.go b/misc/cgo/test/testdata/issue8828.go similarity index 92% rename from misc/cgo/test/issue8828.go rename to misc/cgo/test/testdata/issue8828.go index 304797c929..0bca0f25cf 100644 --- a/misc/cgo/test/issue8828.go +++ b/misc/cgo/test/testdata/issue8828.go @@ -9,7 +9,7 @@ package cgotest -import "./issue8828" +import "cgotest/issue8828" func p() { issue8828.Bar() diff --git a/misc/cgo/test/issue8828/issue8828.c b/misc/cgo/test/testdata/issue8828/issue8828.c similarity index 100% rename from misc/cgo/test/issue8828/issue8828.c rename to misc/cgo/test/testdata/issue8828/issue8828.c diff --git a/misc/cgo/test/issue8828/trivial.go b/misc/cgo/test/testdata/issue8828/trivial.go similarity index 100% rename from misc/cgo/test/issue8828/trivial.go rename to misc/cgo/test/testdata/issue8828/trivial.go diff --git a/misc/cgo/test/issue9026.go b/misc/cgo/test/testdata/issue9026.go similarity index 81% rename from misc/cgo/test/issue9026.go rename to misc/cgo/test/testdata/issue9026.go index 8848d0e811..3f48881655 100644 --- a/misc/cgo/test/issue9026.go +++ b/misc/cgo/test/testdata/issue9026.go @@ -3,7 +3,7 @@ package cgotest import ( "testing" - "./issue9026" + "cgotest/issue9026" ) func test9026(t *testing.T) { issue9026.Test(t) } diff --git a/misc/cgo/test/issue9026/issue9026.go b/misc/cgo/test/testdata/issue9026/issue9026.go similarity index 100% rename from misc/cgo/test/issue9026/issue9026.go rename to misc/cgo/test/testdata/issue9026/issue9026.go diff --git a/misc/cgo/test/issue9400/asm_386.s b/misc/cgo/test/testdata/issue9400/asm_386.s similarity index 100% rename from misc/cgo/test/issue9400/asm_386.s rename to misc/cgo/test/testdata/issue9400/asm_386.s diff --git a/misc/cgo/test/issue9400/asm_amd64x.s b/misc/cgo/test/testdata/issue9400/asm_amd64x.s similarity index 100% rename from misc/cgo/test/issue9400/asm_amd64x.s rename to misc/cgo/test/testdata/issue9400/asm_amd64x.s diff --git a/misc/cgo/test/issue9400/asm_arm.s b/misc/cgo/test/testdata/issue9400/asm_arm.s similarity index 100% rename from misc/cgo/test/issue9400/asm_arm.s rename to misc/cgo/test/testdata/issue9400/asm_arm.s diff --git a/misc/cgo/test/issue9400/asm_arm64.s b/misc/cgo/test/testdata/issue9400/asm_arm64.s similarity index 100% rename from misc/cgo/test/issue9400/asm_arm64.s rename to misc/cgo/test/testdata/issue9400/asm_arm64.s diff --git a/misc/cgo/test/issue9400/asm_mips64x.s b/misc/cgo/test/testdata/issue9400/asm_mips64x.s similarity index 100% rename from misc/cgo/test/issue9400/asm_mips64x.s rename to misc/cgo/test/testdata/issue9400/asm_mips64x.s diff --git a/misc/cgo/test/issue9400/asm_mipsx.s b/misc/cgo/test/testdata/issue9400/asm_mipsx.s similarity index 100% rename from misc/cgo/test/issue9400/asm_mipsx.s rename to misc/cgo/test/testdata/issue9400/asm_mipsx.s diff --git a/misc/cgo/test/issue9400/asm_ppc64x.s b/misc/cgo/test/testdata/issue9400/asm_ppc64x.s similarity index 100% rename from misc/cgo/test/issue9400/asm_ppc64x.s rename to misc/cgo/test/testdata/issue9400/asm_ppc64x.s diff --git a/misc/cgo/test/issue9400/asm_s390x.s b/misc/cgo/test/testdata/issue9400/asm_s390x.s similarity index 100% rename from misc/cgo/test/issue9400/asm_s390x.s rename to misc/cgo/test/testdata/issue9400/asm_s390x.s diff --git a/misc/cgo/test/issue9400/gccgo.go b/misc/cgo/test/testdata/issue9400/gccgo.go similarity index 100% rename from misc/cgo/test/issue9400/gccgo.go rename to misc/cgo/test/testdata/issue9400/gccgo.go diff --git a/misc/cgo/test/issue9400/stubs.go b/misc/cgo/test/testdata/issue9400/stubs.go similarity index 100% rename from misc/cgo/test/issue9400/stubs.go rename to misc/cgo/test/testdata/issue9400/stubs.go diff --git a/misc/cgo/test/issue9400_linux.go b/misc/cgo/test/testdata/issue9400_linux.go similarity index 98% rename from misc/cgo/test/issue9400_linux.go rename to misc/cgo/test/testdata/issue9400_linux.go index 7719535d25..e94a9bb45f 100644 --- a/misc/cgo/test/issue9400_linux.go +++ b/misc/cgo/test/testdata/issue9400_linux.go @@ -18,7 +18,7 @@ import ( "sync/atomic" "testing" - "./issue9400" + "cgotest/issue9400" ) func test9400(t *testing.T) { diff --git a/misc/cgo/test/issue9510.go b/misc/cgo/test/testdata/issue9510.go similarity index 91% rename from misc/cgo/test/issue9510.go rename to misc/cgo/test/testdata/issue9510.go index efd3f770b6..2c79fab97f 100644 --- a/misc/cgo/test/issue9510.go +++ b/misc/cgo/test/testdata/issue9510.go @@ -11,8 +11,8 @@ import ( "runtime" "testing" - "./issue9510a" - "./issue9510b" + "cgotest/issue9510a" + "cgotest/issue9510b" ) func test9510(t *testing.T) { diff --git a/misc/cgo/test/issue9510a/a.go b/misc/cgo/test/testdata/issue9510a/a.go similarity index 100% rename from misc/cgo/test/issue9510a/a.go rename to misc/cgo/test/testdata/issue9510a/a.go diff --git a/misc/cgo/test/issue9510b/b.go b/misc/cgo/test/testdata/issue9510b/b.go similarity index 100% rename from misc/cgo/test/issue9510b/b.go rename to misc/cgo/test/testdata/issue9510b/b.go diff --git a/misc/cgo/test/test26213.go b/misc/cgo/test/testdata/test26213.go similarity index 92% rename from misc/cgo/test/test26213.go rename to misc/cgo/test/testdata/test26213.go index 176a7ece9c..c80032cb3b 100644 --- a/misc/cgo/test/test26213.go +++ b/misc/cgo/test/testdata/test26213.go @@ -7,7 +7,7 @@ package cgotest import ( "testing" - "./issue26213" + "cgotest/issue26213" ) func test26213(t *testing.T) { diff --git a/misc/cgo/testcarchive/carchive_test.go b/misc/cgo/testcarchive/carchive_test.go index 457ac0db09..611a770245 100644 --- a/misc/cgo/testcarchive/carchive_test.go +++ b/misc/cgo/testcarchive/carchive_test.go @@ -10,6 +10,7 @@ import ( "debug/elf" "fmt" "io/ioutil" + "log" "os" "os/exec" "path/filepath" @@ -28,16 +29,42 @@ var bin []string // C compiler with args (from $(go env CC) $(go env GOGCCFLAGS)). var cc []string -// An environment with GOPATH=$(pwd). -var gopathEnv []string - // ".exe" on Windows. var exeSuffix string -var GOOS, GOARCH string +var GOOS, GOARCH, GOPATH string var libgodir string -func init() { +func TestMain(m *testing.M) { + log.SetFlags(log.Lshortfile) + os.Exit(testMain(m)) +} + +func testMain(m *testing.M) int { + // We need a writable GOPATH in which to run the tests. + // Construct one in a temporary directory. + var err error + GOPATH, err = ioutil.TempDir("", "carchive_test") + if err != nil { + log.Panic(err) + } + defer os.RemoveAll(GOPATH) + os.Setenv("GOPATH", GOPATH) + + // Copy testdata into GOPATH/src/testarchive, along with a go.mod file + // declaring the same path. + modRoot := filepath.Join(GOPATH, "src", "testcarchive") + if err := overlayDir(modRoot, "testdata"); err != nil { + log.Panic(err) + } + if err := os.Chdir(modRoot); err != nil { + log.Panic(err) + } + os.Setenv("PWD", modRoot) + if err := ioutil.WriteFile("go.mod", []byte("module testcarchive\n"), 0666); err != nil { + log.Panic(err) + } + GOOS = goEnv("GOOS") GOARCH = goEnv("GOARCH") bin = cmdToRun("./testp") @@ -83,50 +110,36 @@ func init() { // TODO(crawshaw): can we do better? cc = append(cc, []string{"-framework", "CoreFoundation", "-framework", "Foundation"}...) } - libgodir = GOOS + "_" + GOARCH + libbase := GOOS + "_" + GOARCH if runtime.Compiler == "gccgo" { - libgodir = "gccgo_" + libgodir + "_fPIC" + libbase = "gccgo_" + libgodir + "_fPIC" } else { switch GOOS { case "darwin": if GOARCH == "arm" || GOARCH == "arm64" { - libgodir += "_shared" + libbase += "_shared" } case "dragonfly", "freebsd", "linux", "netbsd", "openbsd", "solaris": - libgodir += "_shared" + libbase += "_shared" } } - cc = append(cc, "-I", filepath.Join("pkg", libgodir)) - - // Build an environment with GOPATH=$(pwd) - env := os.Environ() - var n []string - for _, e := range env { - if !strings.HasPrefix(e, "GOPATH=") { - n = append(n, e) - } - } - dir, err := os.Getwd() - if err != nil { - fmt.Fprintln(os.Stderr, err) - os.Exit(2) - } - n = append(n, "GOPATH="+dir) - gopathEnv = n + libgodir = filepath.Join(GOPATH, "pkg", libbase, "testcarchive") + cc = append(cc, "-I", libgodir) if GOOS == "windows" { exeSuffix = ".exe" } + + return m.Run() } func goEnv(key string) string { out, err := exec.Command("go", "env", key).Output() if err != nil { - fmt.Fprintf(os.Stderr, "go env %s failed:\n%s\n", key, err) if ee, ok := err.(*exec.ExitError); ok { fmt.Fprintf(os.Stderr, "%s", ee.Stderr) } - os.Exit(2) + log.Panicf("go env %s failed:\n%s\n", key, err) } return strings.TrimSpace(string(out)) } @@ -143,7 +156,6 @@ func cmdToRun(name string) []string { func testInstall(t *testing.T, exe, libgoa, libgoh string, buildcmd ...string) { t.Helper() cmd := exec.Command(buildcmd[0], buildcmd[1:]...) - cmd.Env = gopathEnv t.Log(buildcmd) if out, err := cmd.CombinedOutput(); err != nil { t.Logf("%s", out) @@ -204,7 +216,7 @@ func checkLineComments(t *testing.T, hdrname string) { } func TestInstall(t *testing.T) { - defer os.RemoveAll("pkg") + defer os.RemoveAll(filepath.Join(GOPATH, "pkg")) libgoa := "libgo.a" if runtime.Compiler == "gccgo" { @@ -212,17 +224,17 @@ func TestInstall(t *testing.T) { } testInstall(t, "./testp1"+exeSuffix, - filepath.Join("pkg", libgodir, libgoa), - filepath.Join("pkg", libgodir, "libgo.h"), - "go", "install", "-i", "-buildmode=c-archive", "libgo") + filepath.Join(libgodir, libgoa), + filepath.Join(libgodir, "libgo.h"), + "go", "install", "-i", "-buildmode=c-archive", "./libgo") // Test building libgo other than installing it. // Header files are now present. testInstall(t, "./testp2"+exeSuffix, "libgo.a", "libgo.h", - "go", "build", "-buildmode=c-archive", filepath.Join("src", "libgo", "libgo.go")) + "go", "build", "-buildmode=c-archive", filepath.Join(".", "libgo", "libgo.go")) testInstall(t, "./testp3"+exeSuffix, "libgo.a", "libgo.h", - "go", "build", "-buildmode=c-archive", "-o", "libgo.a", "libgo") + "go", "build", "-buildmode=c-archive", "-o", "libgo.a", "./libgo") } func TestEarlySignalHandler(t *testing.T) { @@ -240,11 +252,10 @@ func TestEarlySignalHandler(t *testing.T) { os.Remove("libgo2.a") os.Remove("libgo2.h") os.Remove("testp") - os.RemoveAll("pkg") + os.RemoveAll(filepath.Join(GOPATH, "pkg")) }() - cmd := exec.Command("go", "build", "-buildmode=c-archive", "-o", "libgo2.a", "libgo2") - cmd.Env = gopathEnv + cmd := exec.Command("go", "build", "-buildmode=c-archive", "-o", "libgo2.a", "./libgo2") if out, err := cmd.CombinedOutput(); err != nil { t.Logf("%s", out) t.Fatal(err) @@ -273,11 +284,10 @@ func TestSignalForwarding(t *testing.T) { os.Remove("libgo2.a") os.Remove("libgo2.h") os.Remove("testp") - os.RemoveAll("pkg") + os.RemoveAll(filepath.Join(GOPATH, "pkg")) }() - cmd := exec.Command("go", "build", "-buildmode=c-archive", "-o", "libgo2.a", "libgo2") - cmd.Env = gopathEnv + cmd := exec.Command("go", "build", "-buildmode=c-archive", "-o", "libgo2.a", "./libgo2") if out, err := cmd.CombinedOutput(); err != nil { t.Logf("%s", out) t.Fatal(err) @@ -317,11 +327,10 @@ func TestSignalForwardingExternal(t *testing.T) { os.Remove("libgo2.a") os.Remove("libgo2.h") os.Remove("testp") - os.RemoveAll("pkg") + os.RemoveAll(filepath.Join(GOPATH, "pkg")) }() - cmd := exec.Command("go", "build", "-buildmode=c-archive", "-o", "libgo2.a", "libgo2") - cmd.Env = gopathEnv + cmd := exec.Command("go", "build", "-buildmode=c-archive", "-o", "libgo2.a", "./libgo2") if out, err := cmd.CombinedOutput(); err != nil { t.Logf("%s", out) t.Fatal(err) @@ -433,11 +442,10 @@ func TestOsSignal(t *testing.T) { os.Remove("libgo3.a") os.Remove("libgo3.h") os.Remove("testp") - os.RemoveAll("pkg") + os.RemoveAll(filepath.Join(GOPATH, "pkg")) }() - cmd := exec.Command("go", "build", "-buildmode=c-archive", "-o", "libgo3.a", "libgo3") - cmd.Env = gopathEnv + cmd := exec.Command("go", "build", "-buildmode=c-archive", "-o", "libgo3.a", "./libgo3") if out, err := cmd.CombinedOutput(); err != nil { t.Logf("%s", out) t.Fatal(err) @@ -469,11 +477,10 @@ func TestSigaltstack(t *testing.T) { os.Remove("libgo4.a") os.Remove("libgo4.h") os.Remove("testp") - os.RemoveAll("pkg") + os.RemoveAll(filepath.Join(GOPATH, "pkg")) }() - cmd := exec.Command("go", "build", "-buildmode=c-archive", "-o", "libgo4.a", "libgo4") - cmd.Env = gopathEnv + cmd := exec.Command("go", "build", "-buildmode=c-archive", "-o", "libgo4.a", "./libgo4") if out, err := cmd.CombinedOutput(); err != nil { t.Logf("%s", out) t.Fatal(err) @@ -517,7 +524,7 @@ func TestExtar(t *testing.T) { os.Remove("libgo4.h") os.Remove("testar") os.Remove("testar.ran") - os.RemoveAll("pkg") + os.RemoveAll(filepath.Join(GOPATH, "pkg")) }() os.Remove("testar") @@ -530,8 +537,7 @@ func TestExtar(t *testing.T) { t.Fatal(err) } - cmd := exec.Command("go", "build", "-buildmode=c-archive", "-ldflags=-extar="+filepath.Join(dir, "testar"), "-o", "libgo4.a", "libgo4") - cmd.Env = gopathEnv + cmd := exec.Command("go", "build", "-buildmode=c-archive", "-ldflags=-extar="+filepath.Join(dir, "testar"), "-o", "libgo4.a", "./libgo4") if out, err := cmd.CombinedOutput(); err != nil { t.Logf("%s", out) t.Fatal(err) @@ -555,11 +561,10 @@ func TestPIE(t *testing.T) { defer func() { os.Remove("testp" + exeSuffix) - os.RemoveAll("pkg") + os.RemoveAll(filepath.Join(GOPATH, "pkg")) }() - cmd := exec.Command("go", "install", "-i", "-buildmode=c-archive", "libgo") - cmd.Env = gopathEnv + cmd := exec.Command("go", "install", "-i", "-buildmode=c-archive", "./libgo") if out, err := cmd.CombinedOutput(); err != nil { t.Logf("%s", out) t.Fatal(err) @@ -570,7 +575,7 @@ func TestPIE(t *testing.T) { libgoa = "liblibgo.a" } - ccArgs := append(cc, "-fPIE", "-pie", "-o", "testp"+exeSuffix, "main.c", "main_unix.c", filepath.Join("pkg", libgodir, libgoa)) + ccArgs := append(cc, "-fPIE", "-pie", "-o", "testp"+exeSuffix, "main.c", "main_unix.c", filepath.Join(libgodir, libgoa)) if runtime.Compiler == "gccgo" { ccArgs = append(ccArgs, "-lgo") } @@ -643,8 +648,7 @@ func TestSIGPROF(t *testing.T) { os.Remove("libgo6.h") }() - cmd := exec.Command("go", "build", "-buildmode=c-archive", "-o", "libgo6.a", "libgo6") - cmd.Env = gopathEnv + cmd := exec.Command("go", "build", "-buildmode=c-archive", "-o", "libgo6.a", "./libgo6") if out, err := cmd.CombinedOutput(); err != nil { t.Logf("%s", out) t.Fatal(err) @@ -683,8 +687,7 @@ func TestCompileWithoutShared(t *testing.T) { os.Remove("libgo2.h") }() - cmd := exec.Command("go", "build", "-buildmode=c-archive", "-gcflags=-shared=false", "-o", "libgo2.a", "libgo2") - cmd.Env = gopathEnv + cmd := exec.Command("go", "build", "-buildmode=c-archive", "-gcflags=-shared=false", "-o", "libgo2.a", "./libgo2") t.Log(cmd.Args) out, err := cmd.CombinedOutput() t.Logf("%s", out) @@ -732,15 +735,14 @@ func TestCompileWithoutShared(t *testing.T) { // Test that installing a second time recreates the header files. func TestCachedInstall(t *testing.T) { - defer os.RemoveAll("pkg") + defer os.RemoveAll(filepath.Join(GOPATH, "pkg")) - h1 := filepath.Join("pkg", libgodir, "libgo.h") - h2 := filepath.Join("pkg", libgodir, "p.h") + h1 := filepath.Join(libgodir, "libgo.h") + h2 := filepath.Join(libgodir, "p.h") - buildcmd := []string{"go", "install", "-i", "-buildmode=c-archive", "libgo"} + buildcmd := []string{"go", "install", "-i", "-buildmode=c-archive", "./libgo"} cmd := exec.Command(buildcmd[0], buildcmd[1:]...) - cmd.Env = gopathEnv t.Log(buildcmd) if out, err := cmd.CombinedOutput(); err != nil { t.Logf("%s", out) @@ -762,7 +764,6 @@ func TestCachedInstall(t *testing.T) { } cmd = exec.Command(buildcmd[0], buildcmd[1:]...) - cmd.Env = gopathEnv t.Log(buildcmd) if out, err := cmd.CombinedOutput(); err != nil { t.Logf("%s", out) diff --git a/misc/cgo/testcarchive/overlaydir_test.go b/misc/cgo/testcarchive/overlaydir_test.go new file mode 100644 index 0000000000..68878e4c66 --- /dev/null +++ b/misc/cgo/testcarchive/overlaydir_test.go @@ -0,0 +1,81 @@ +// 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. + +package carchive_test + +import ( + "io" + "os" + "path/filepath" + "strings" +) + +// overlayDir makes a minimal-overhead copy of srcRoot in which new files may be added. +// +// TODO: Once we no longer need to support the misc module in GOPATH mode, +// factor this function out into a package to reduce duplication. +func overlayDir(dstRoot, srcRoot string) error { + dstRoot = filepath.Clean(dstRoot) + if err := os.MkdirAll(dstRoot, 0777); err != nil { + return err + } + + symBase, err := filepath.Rel(srcRoot, dstRoot) + if err != nil { + symBase, err = filepath.Abs(srcRoot) + if err != nil { + return err + } + } + + return filepath.Walk(srcRoot, func(srcPath string, info os.FileInfo, err error) error { + if err != nil || srcPath == srcRoot { + return err + } + + suffix := strings.TrimPrefix(srcPath, srcRoot) + for len(suffix) > 0 && suffix[0] == filepath.Separator { + suffix = suffix[1:] + } + dstPath := filepath.Join(dstRoot, suffix) + + perm := info.Mode() & os.ModePerm + if info.Mode()&os.ModeSymlink != 0 { + info, err = os.Stat(srcPath) + if err != nil { + return err + } + perm = info.Mode() & os.ModePerm + } + + // Always copy directories (don't symlink them). + // If we add a file in the overlay, we don't want to add it in the original. + if info.IsDir() { + return os.Mkdir(dstPath, perm) + } + + // If the OS supports symlinks, use them instead of copying bytes. + if err := os.Symlink(filepath.Join(symBase, suffix), dstPath); err == nil { + return nil + } + + // Otherwise, copy the bytes. + src, err := os.Open(srcPath) + if err != nil { + return err + } + defer src.Close() + + dst, err := os.OpenFile(dstPath, os.O_WRONLY|os.O_CREATE|os.O_EXCL, perm) + if err != nil { + return err + } + + _, err = io.Copy(dst, src) + if closeErr := dst.Close(); err == nil { + err = closeErr + } + return err + }) +} diff --git a/misc/cgo/testcarchive/src/libgo/libgo.go b/misc/cgo/testcarchive/testdata/libgo/libgo.go similarity index 97% rename from misc/cgo/testcarchive/src/libgo/libgo.go rename to misc/cgo/testcarchive/testdata/libgo/libgo.go index 45958a546c..37b30c1463 100644 --- a/misc/cgo/testcarchive/src/libgo/libgo.go +++ b/misc/cgo/testcarchive/testdata/libgo/libgo.go @@ -10,7 +10,7 @@ import ( "syscall" "time" - _ "p" + _ "testcarchive/p" ) import "C" diff --git a/misc/cgo/testcarchive/src/libgo2/libgo2.go b/misc/cgo/testcarchive/testdata/libgo2/libgo2.go similarity index 100% rename from misc/cgo/testcarchive/src/libgo2/libgo2.go rename to misc/cgo/testcarchive/testdata/libgo2/libgo2.go diff --git a/misc/cgo/testcarchive/src/libgo3/libgo3.go b/misc/cgo/testcarchive/testdata/libgo3/libgo3.go similarity index 100% rename from misc/cgo/testcarchive/src/libgo3/libgo3.go rename to misc/cgo/testcarchive/testdata/libgo3/libgo3.go diff --git a/misc/cgo/testcarchive/src/libgo4/libgo4.go b/misc/cgo/testcarchive/testdata/libgo4/libgo4.go similarity index 100% rename from misc/cgo/testcarchive/src/libgo4/libgo4.go rename to misc/cgo/testcarchive/testdata/libgo4/libgo4.go diff --git a/misc/cgo/testcarchive/src/libgo6/sigprof.go b/misc/cgo/testcarchive/testdata/libgo6/sigprof.go similarity index 100% rename from misc/cgo/testcarchive/src/libgo6/sigprof.go rename to misc/cgo/testcarchive/testdata/libgo6/sigprof.go diff --git a/misc/cgo/testcarchive/main.c b/misc/cgo/testcarchive/testdata/main.c similarity index 100% rename from misc/cgo/testcarchive/main.c rename to misc/cgo/testcarchive/testdata/main.c diff --git a/misc/cgo/testcarchive/main2.c b/misc/cgo/testcarchive/testdata/main2.c similarity index 100% rename from misc/cgo/testcarchive/main2.c rename to misc/cgo/testcarchive/testdata/main2.c diff --git a/misc/cgo/testcarchive/main3.c b/misc/cgo/testcarchive/testdata/main3.c similarity index 100% rename from misc/cgo/testcarchive/main3.c rename to misc/cgo/testcarchive/testdata/main3.c diff --git a/misc/cgo/testcarchive/main4.c b/misc/cgo/testcarchive/testdata/main4.c similarity index 100% rename from misc/cgo/testcarchive/main4.c rename to misc/cgo/testcarchive/testdata/main4.c diff --git a/misc/cgo/testcarchive/main5.c b/misc/cgo/testcarchive/testdata/main5.c similarity index 100% rename from misc/cgo/testcarchive/main5.c rename to misc/cgo/testcarchive/testdata/main5.c diff --git a/misc/cgo/testcarchive/main6.c b/misc/cgo/testcarchive/testdata/main6.c similarity index 100% rename from misc/cgo/testcarchive/main6.c rename to misc/cgo/testcarchive/testdata/main6.c diff --git a/misc/cgo/testcarchive/main_unix.c b/misc/cgo/testcarchive/testdata/main_unix.c similarity index 100% rename from misc/cgo/testcarchive/main_unix.c rename to misc/cgo/testcarchive/testdata/main_unix.c diff --git a/misc/cgo/testcarchive/main_windows.c b/misc/cgo/testcarchive/testdata/main_windows.c similarity index 100% rename from misc/cgo/testcarchive/main_windows.c rename to misc/cgo/testcarchive/testdata/main_windows.c diff --git a/misc/cgo/testcarchive/src/p/p.go b/misc/cgo/testcarchive/testdata/p/p.go similarity index 100% rename from misc/cgo/testcarchive/src/p/p.go rename to misc/cgo/testcarchive/testdata/p/p.go diff --git a/misc/cgo/testcshared/cshared_test.go b/misc/cgo/testcshared/cshared_test.go index e5b90ff194..833650e5e6 100644 --- a/misc/cgo/testcshared/cshared_test.go +++ b/misc/cgo/testcshared/cshared_test.go @@ -5,13 +5,13 @@ package cshared_test import ( + "bytes" "debug/elf" "fmt" "io/ioutil" "log" "os" "os/exec" - "path" "path/filepath" "strings" "sync" @@ -22,9 +22,6 @@ import ( // C compiler with args (from $(go env CC) $(go env GOGCCFLAGS)). var cc []string -// An environment with GOPATH=$(pwd). -var gopathEnv []string - // ".exe" on Windows. var exeSuffix string @@ -33,6 +30,12 @@ var installdir, androiddir string var libSuffix, libgoname string func TestMain(m *testing.M) { + os.Exit(testMain(m)) +} + +func testMain(m *testing.M) int { + log.SetFlags(log.Lshortfile) + GOOS = goEnv("GOOS") GOARCH = goEnv("GOARCH") GOROOT = goEnv("GOROOT") @@ -41,19 +44,6 @@ func TestMain(m *testing.M) { log.Fatalf("Unable able to find GOROOT at '%s'", GOROOT) } - // Directory where cgo headers and outputs will be installed. - // The installation directory format varies depending on the platform. - installdir = path.Join("pkg", fmt.Sprintf("%s_%s_testcshared", GOOS, GOARCH)) - switch GOOS { - case "darwin": - libSuffix = "dylib" - case "windows": - libSuffix = "dll" - default: - libSuffix = "so" - installdir = path.Join("pkg", fmt.Sprintf("%s_%s_testcshared_shared", GOOS, GOARCH)) - } - androiddir = fmt.Sprintf("/data/local/tmp/testcshared-%d", os.Getpid()) if GOOS == "android" { args := append(adbCmd(), "shell", "mkdir", "-p", androiddir) @@ -62,10 +52,9 @@ func TestMain(m *testing.M) { if err != nil { log.Fatalf("setupAndroid failed: %v\n%s\n", err, out) } + defer cleanupAndroid() } - libgoname = "libgo." + libSuffix - cc = []string{goEnv("CC")} out := goEnv("GOGCCFLAGS") @@ -120,34 +109,57 @@ func TestMain(m *testing.M) { } cc = append(cc, "-I", filepath.Join("pkg", libgodir)) - // Build an environment with GOPATH=$(pwd) - dir, err := os.Getwd() - if err != nil { - fmt.Fprintln(os.Stderr, err) - os.Exit(2) - } - gopathEnv = append(os.Environ(), "GOPATH="+dir) - if GOOS == "windows" { exeSuffix = ".exe" } - st := m.Run() + // Copy testdata into GOPATH/src/testcshared, along with a go.mod file + // declaring the same path. - os.Remove(libgoname) - os.RemoveAll("pkg") - cleanupHeaders() - cleanupAndroid() + GOPATH, err := ioutil.TempDir("", "cshared_test") + if err != nil { + log.Panic(err) + } + defer os.RemoveAll(GOPATH) + os.Setenv("GOPATH", GOPATH) - os.Exit(st) + // Copy testdata into GOPATH/src/testarchive, along with a go.mod file + // declaring the same path. + modRoot := filepath.Join(GOPATH, "src", "testcshared") + if err := overlayDir(modRoot, "testdata"); err != nil { + log.Panic(err) + } + if err := os.Chdir(modRoot); err != nil { + log.Panic(err) + } + os.Setenv("PWD", modRoot) + if err := ioutil.WriteFile("go.mod", []byte("module testcshared\n"), 0666); err != nil { + log.Panic(err) + } + + // Directory where cgo headers and outputs will be installed. + // The installation directory format varies depending on the platform. + output, err := exec.Command("go", "list", + "-buildmode=c-shared", + "-installsuffix", "testcshared", + "-f", "{{.Target}}", + "./libgo").CombinedOutput() + if err != nil { + log.Panicf("go list failed: %v\n%s", err, output) + } + target := string(bytes.TrimSpace(output)) + libgoname = filepath.Base(target) + installdir = filepath.Dir(target) + libSuffix = strings.TrimPrefix(filepath.Ext(target), ".") + + return m.Run() } func goEnv(key string) string { out, err := exec.Command("go", "env", key).Output() if err != nil { - fmt.Fprintf(os.Stderr, "go env %s failed:\n%s", key, err) - fmt.Fprintf(os.Stderr, "%s", err.(*exec.ExitError).Stderr) - os.Exit(2) + log.Printf("go env %s failed:\n%s", key, err) + log.Panicf("%s", err.(*exec.ExitError).Stderr) } return strings.TrimSpace(string(out)) } @@ -197,10 +209,12 @@ func adbRun(t *testing.T, env []string, adbargs ...string) string { return strings.Replace(string(out), "\r", "", -1) } -func run(t *testing.T, env []string, args ...string) string { +func run(t *testing.T, extraEnv []string, args ...string) string { t.Helper() cmd := exec.Command(args[0], args[1:]...) - cmd.Env = env + if len(extraEnv) > 0 { + cmd.Env = append(os.Environ(), extraEnv...) + } if GOOS != "windows" { // TestUnexportedSymbols relies on file descriptor 30 @@ -220,12 +234,12 @@ func run(t *testing.T, env []string, args ...string) string { return string(out) } -func runExe(t *testing.T, env []string, args ...string) string { +func runExe(t *testing.T, extraEnv []string, args ...string) string { t.Helper() if GOOS == "android" { - return adbRun(t, env, args...) + return adbRun(t, append(os.Environ(), extraEnv...), args...) } - return run(t, env, args...) + return run(t, extraEnv, args...) } func runCC(t *testing.T, args ...string) string { @@ -237,9 +251,8 @@ func runCC(t *testing.T, args ...string) string { func createHeaders() error { args := []string{"go", "install", "-i", "-buildmode=c-shared", - "-installsuffix", "testcshared", "libgo"} + "-installsuffix", "testcshared", "./libgo"} cmd := exec.Command(args[0], args[1:]...) - cmd.Env = gopathEnv out, err := cmd.CombinedOutput() if err != nil { return fmt.Errorf("command failed: %v\n%v\n%s\n", args, err, out) @@ -248,9 +261,8 @@ func createHeaders() error { args = []string{"go", "build", "-buildmode=c-shared", "-installsuffix", "testcshared", "-o", libgoname, - filepath.Join("src", "libgo", "libgo.go")} + filepath.Join(".", "libgo", "libgo.go")} cmd = exec.Command(args[0], args[1:]...) - cmd.Env = gopathEnv out, err = cmd.CombinedOutput() if err != nil { return fmt.Errorf("command failed: %v\n%v\n%s\n", args, err, out) @@ -282,10 +294,6 @@ func createHeadersOnce(t *testing.T) { } } -func cleanupHeaders() { - os.Remove("libgo.h") -} - func cleanupAndroid() { if GOOS != "android" { return @@ -294,7 +302,7 @@ func cleanupAndroid() { cmd := exec.Command(args[0], args[1:]...) out, err := cmd.CombinedOutput() if err != nil { - log.Fatalf("cleanupAndroid failed: %v\n%s\n", err, out) + log.Panicf("cleanupAndroid failed: %v\n%s\n", err, out) } } @@ -312,7 +320,7 @@ func TestExportedSymbols(t *testing.T) { defer os.Remove(bin) - out := runExe(t, append(gopathEnv, "LD_LIBRARY_PATH=."), bin) + out := runExe(t, []string{"LD_LIBRARY_PATH=."}, bin) if strings.TrimSpace(out) != "PASS" { t.Error(out) } @@ -361,11 +369,11 @@ func TestUnexportedSymbols(t *testing.T) { libname := "libgo2." + libSuffix run(t, - gopathEnv, + nil, "go", "build", "-buildmode=c-shared", "-installsuffix", "testcshared", - "-o", libname, "libgo2", + "-o", libname, "./libgo2", ) adbPush(t, libname) @@ -380,7 +388,7 @@ func TestUnexportedSymbols(t *testing.T) { defer os.Remove(libname) defer os.Remove(bin) - out := runExe(t, append(gopathEnv, "LD_LIBRARY_PATH=."), bin) + out := runExe(t, []string{"LD_LIBRARY_PATH=."}, bin) if strings.TrimSpace(out) != "PASS" { t.Error(out) @@ -418,7 +426,7 @@ func TestMainExportedOnAndroid(t *testing.T) { func testSignalHandlers(t *testing.T, pkgname, cfile, cmd string) { libname := pkgname + "." + libSuffix run(t, - gopathEnv, + nil, "go", "build", "-buildmode=c-shared", "-installsuffix", "testcshared", @@ -451,7 +459,7 @@ func TestSignalHandlers(t *testing.T) { t.Logf("Skipping on %s", GOOS) return } - testSignalHandlers(t, "libgo4", "main4.c", "testp4") + testSignalHandlers(t, "./libgo4", "main4.c", "testp4") } // test5: test signal handlers with os/signal.Notify @@ -461,7 +469,7 @@ func TestSignalHandlersWithNotify(t *testing.T) { t.Logf("Skipping on %s", GOOS) return } - testSignalHandlers(t, "libgo5", "main5.c", "testp5") + testSignalHandlers(t, "./libgo5", "main5.c", "testp5") } func TestPIE(t *testing.T) { @@ -515,14 +523,16 @@ func TestCachedInstall(t *testing.T) { } // defer os.RemoveAll(tmpdir) - copyFile(t, filepath.Join(tmpdir, "src", "libgo", "libgo.go"), filepath.Join("src", "libgo", "libgo.go")) - copyFile(t, filepath.Join(tmpdir, "src", "p", "p.go"), filepath.Join("src", "p", "p.go")) + copyFile(t, filepath.Join(tmpdir, "src", "testcshared", "go.mod"), "go.mod") + copyFile(t, filepath.Join(tmpdir, "src", "testcshared", "libgo", "libgo.go"), filepath.Join("libgo", "libgo.go")) + copyFile(t, filepath.Join(tmpdir, "src", "testcshared", "p", "p.go"), filepath.Join("p", "p.go")) - env := append(os.Environ(), "GOPATH="+tmpdir) + env := append(os.Environ(), "GOPATH="+tmpdir, "GOBIN="+filepath.Join(tmpdir, "bin")) - buildcmd := []string{"go", "install", "-x", "-i", "-buildmode=c-shared", "-installsuffix", "testcshared", "libgo"} + buildcmd := []string{"go", "install", "-x", "-i", "-buildmode=c-shared", "-installsuffix", "testcshared", "./libgo"} cmd := exec.Command(buildcmd[0], buildcmd[1:]...) + cmd.Dir = filepath.Join(tmpdir, "src", "testcshared") cmd.Env = env t.Log(buildcmd) out, err := cmd.CombinedOutput() @@ -572,6 +582,7 @@ func TestCachedInstall(t *testing.T) { } cmd = exec.Command(buildcmd[0], buildcmd[1:]...) + cmd.Dir = filepath.Join(tmpdir, "src", "testcshared") cmd.Env = env t.Log(buildcmd) out, err = cmd.CombinedOutput() @@ -621,8 +632,8 @@ func TestGo2C2Go(t *testing.T) { } defer os.RemoveAll(tmpdir) - shlib := filepath.Join(tmpdir, "libtestgo2c2go."+libSuffix) - run(t, gopathEnv, "go", "build", "-buildmode=c-shared", "-o", shlib, "go2c2go/go") + lib := filepath.Join(tmpdir, "libtestgo2c2go."+libSuffix) + run(t, nil, "go", "build", "-buildmode=c-shared", "-o", lib, "./go2c2go/go") cgoCflags := os.Getenv("CGO_CFLAGS") if cgoCflags != "" { @@ -636,7 +647,7 @@ func TestGo2C2Go(t *testing.T) { } cgoLdflags += "-L" + tmpdir + " -ltestgo2c2go" - goenv := append(gopathEnv[:len(gopathEnv):len(gopathEnv)], "CGO_CFLAGS="+cgoCflags, "CGO_LDFLAGS="+cgoLdflags) + goenv := []string{"CGO_CFLAGS=" + cgoCflags, "CGO_LDFLAGS=" + cgoLdflags} ldLibPath := os.Getenv("LD_LIBRARY_PATH") if ldLibPath != "" { @@ -644,13 +655,13 @@ func TestGo2C2Go(t *testing.T) { } ldLibPath += tmpdir - runenv := append(gopathEnv[:len(gopathEnv):len(gopathEnv)], "LD_LIBRARY_PATH="+ldLibPath) + runenv := []string{"LD_LIBRARY_PATH=" + ldLibPath} bin := filepath.Join(tmpdir, "m1") + exeSuffix - run(t, goenv, "go", "build", "-o", bin, "go2c2go/m1") + run(t, goenv, "go", "build", "-o", bin, "./go2c2go/m1") runExe(t, runenv, bin) bin = filepath.Join(tmpdir, "m2") + exeSuffix - run(t, goenv, "go", "build", "-o", bin, "go2c2go/m2") + run(t, goenv, "go", "build", "-o", bin, "./go2c2go/m2") runExe(t, runenv, bin) } diff --git a/misc/cgo/testcshared/overlaydir_test.go b/misc/cgo/testcshared/overlaydir_test.go new file mode 100644 index 0000000000..1eaabf6fe2 --- /dev/null +++ b/misc/cgo/testcshared/overlaydir_test.go @@ -0,0 +1,81 @@ +// 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. + +package cshared_test + +import ( + "io" + "os" + "path/filepath" + "strings" +) + +// overlayDir makes a minimal-overhead copy of srcRoot in which new files may be added. +// +// TODO: Once we no longer need to support the misc module in GOPATH mode, +// factor this function out into a package to reduce duplication. +func overlayDir(dstRoot, srcRoot string) error { + dstRoot = filepath.Clean(dstRoot) + if err := os.MkdirAll(dstRoot, 0777); err != nil { + return err + } + + symBase, err := filepath.Rel(srcRoot, dstRoot) + if err != nil { + symBase, err = filepath.Abs(srcRoot) + if err != nil { + return err + } + } + + return filepath.Walk(srcRoot, func(srcPath string, info os.FileInfo, err error) error { + if err != nil || srcPath == srcRoot { + return err + } + + suffix := strings.TrimPrefix(srcPath, srcRoot) + for len(suffix) > 0 && suffix[0] == filepath.Separator { + suffix = suffix[1:] + } + dstPath := filepath.Join(dstRoot, suffix) + + perm := info.Mode() & os.ModePerm + if info.Mode()&os.ModeSymlink != 0 { + info, err = os.Stat(srcPath) + if err != nil { + return err + } + perm = info.Mode() & os.ModePerm + } + + // Always copy directories (don't symlink them). + // If we add a file in the overlay, we don't want to add it in the original. + if info.IsDir() { + return os.Mkdir(dstPath, perm) + } + + // If the OS supports symlinks, use them instead of copying bytes. + if err := os.Symlink(filepath.Join(symBase, suffix), dstPath); err == nil { + return nil + } + + // Otherwise, copy the bytes. + src, err := os.Open(srcPath) + if err != nil { + return err + } + defer src.Close() + + dst, err := os.OpenFile(dstPath, os.O_WRONLY|os.O_CREATE|os.O_EXCL, perm) + if err != nil { + return err + } + + _, err = io.Copy(dst, src) + if closeErr := dst.Close(); err == nil { + err = closeErr + } + return err + }) +} diff --git a/misc/cgo/testcshared/src/go2c2go/go/shlib.go b/misc/cgo/testcshared/testdata/go2c2go/go/shlib.go similarity index 100% rename from misc/cgo/testcshared/src/go2c2go/go/shlib.go rename to misc/cgo/testcshared/testdata/go2c2go/go/shlib.go diff --git a/misc/cgo/testcshared/src/go2c2go/m1/c.c b/misc/cgo/testcshared/testdata/go2c2go/m1/c.c similarity index 100% rename from misc/cgo/testcshared/src/go2c2go/m1/c.c rename to misc/cgo/testcshared/testdata/go2c2go/m1/c.c diff --git a/misc/cgo/testcshared/src/go2c2go/m1/main.go b/misc/cgo/testcshared/testdata/go2c2go/m1/main.go similarity index 100% rename from misc/cgo/testcshared/src/go2c2go/m1/main.go rename to misc/cgo/testcshared/testdata/go2c2go/m1/main.go diff --git a/misc/cgo/testcshared/src/go2c2go/m2/main.go b/misc/cgo/testcshared/testdata/go2c2go/m2/main.go similarity index 100% rename from misc/cgo/testcshared/src/go2c2go/m2/main.go rename to misc/cgo/testcshared/testdata/go2c2go/m2/main.go diff --git a/misc/cgo/testcshared/src/libgo/libgo.go b/misc/cgo/testcshared/testdata/libgo/libgo.go similarity index 97% rename from misc/cgo/testcshared/src/libgo/libgo.go rename to misc/cgo/testcshared/testdata/libgo/libgo.go index 8a4bf795e9..063441766a 100644 --- a/misc/cgo/testcshared/src/libgo/libgo.go +++ b/misc/cgo/testcshared/testdata/libgo/libgo.go @@ -5,8 +5,8 @@ package main import ( - _ "p" "syscall" + _ "testcshared/p" "time" ) diff --git a/misc/cgo/testcshared/src/libgo2/dup2.go b/misc/cgo/testcshared/testdata/libgo2/dup2.go similarity index 100% rename from misc/cgo/testcshared/src/libgo2/dup2.go rename to misc/cgo/testcshared/testdata/libgo2/dup2.go diff --git a/misc/cgo/testcshared/src/libgo2/dup3.go b/misc/cgo/testcshared/testdata/libgo2/dup3.go similarity index 100% rename from misc/cgo/testcshared/src/libgo2/dup3.go rename to misc/cgo/testcshared/testdata/libgo2/dup3.go diff --git a/misc/cgo/testcshared/src/libgo2/libgo2.go b/misc/cgo/testcshared/testdata/libgo2/libgo2.go similarity index 100% rename from misc/cgo/testcshared/src/libgo2/libgo2.go rename to misc/cgo/testcshared/testdata/libgo2/libgo2.go diff --git a/misc/cgo/testcshared/src/libgo4/libgo4.go b/misc/cgo/testcshared/testdata/libgo4/libgo4.go similarity index 100% rename from misc/cgo/testcshared/src/libgo4/libgo4.go rename to misc/cgo/testcshared/testdata/libgo4/libgo4.go diff --git a/misc/cgo/testcshared/src/libgo5/libgo5.go b/misc/cgo/testcshared/testdata/libgo5/libgo5.go similarity index 100% rename from misc/cgo/testcshared/src/libgo5/libgo5.go rename to misc/cgo/testcshared/testdata/libgo5/libgo5.go diff --git a/misc/cgo/testcshared/main0.c b/misc/cgo/testcshared/testdata/main0.c similarity index 100% rename from misc/cgo/testcshared/main0.c rename to misc/cgo/testcshared/testdata/main0.c diff --git a/misc/cgo/testcshared/main1.c b/misc/cgo/testcshared/testdata/main1.c similarity index 100% rename from misc/cgo/testcshared/main1.c rename to misc/cgo/testcshared/testdata/main1.c diff --git a/misc/cgo/testcshared/main2.c b/misc/cgo/testcshared/testdata/main2.c similarity index 100% rename from misc/cgo/testcshared/main2.c rename to misc/cgo/testcshared/testdata/main2.c diff --git a/misc/cgo/testcshared/main3.c b/misc/cgo/testcshared/testdata/main3.c similarity index 100% rename from misc/cgo/testcshared/main3.c rename to misc/cgo/testcshared/testdata/main3.c diff --git a/misc/cgo/testcshared/main4.c b/misc/cgo/testcshared/testdata/main4.c similarity index 100% rename from misc/cgo/testcshared/main4.c rename to misc/cgo/testcshared/testdata/main4.c diff --git a/misc/cgo/testcshared/main5.c b/misc/cgo/testcshared/testdata/main5.c similarity index 100% rename from misc/cgo/testcshared/main5.c rename to misc/cgo/testcshared/testdata/main5.c diff --git a/misc/cgo/testcshared/src/p/p.go b/misc/cgo/testcshared/testdata/p/p.go similarity index 100% rename from misc/cgo/testcshared/src/p/p.go rename to misc/cgo/testcshared/testdata/p/p.go diff --git a/misc/cgo/testgodefs/test.bash b/misc/cgo/testgodefs/test.bash index 012d007fc3..e4ce2ee7a8 100755 --- a/misc/cgo/testgodefs/test.bash +++ b/misc/cgo/testgodefs/test.bash @@ -9,6 +9,8 @@ # import "C" block. Add more tests here. FILE_PREFIXES="anonunion issue8478 fieldtypedef" +cd testdata + RM= for FP in $FILE_PREFIXES do @@ -16,7 +18,7 @@ do RM="${RM} ${FP}_defs.go" done -go build . && ./testgodefs +go build -o testgodefs . && ./testgodefs EXIT=$? rm -rf _obj testgodefs ${RM} exit $EXIT diff --git a/misc/cgo/testgodefs/anonunion.go b/misc/cgo/testgodefs/testdata/anonunion.go similarity index 100% rename from misc/cgo/testgodefs/anonunion.go rename to misc/cgo/testgodefs/testdata/anonunion.go diff --git a/misc/cgo/testgodefs/fieldtypedef.go b/misc/cgo/testgodefs/testdata/fieldtypedef.go similarity index 100% rename from misc/cgo/testgodefs/fieldtypedef.go rename to misc/cgo/testgodefs/testdata/fieldtypedef.go diff --git a/misc/cgo/testgodefs/issue8478.go b/misc/cgo/testgodefs/testdata/issue8478.go similarity index 100% rename from misc/cgo/testgodefs/issue8478.go rename to misc/cgo/testgodefs/testdata/issue8478.go diff --git a/misc/cgo/testgodefs/main.go b/misc/cgo/testgodefs/testdata/main.go similarity index 100% rename from misc/cgo/testgodefs/main.go rename to misc/cgo/testgodefs/testdata/main.go diff --git a/misc/cgo/testplugin/altpath/src/common/common.go b/misc/cgo/testplugin/altpath/testdata/common/common.go similarity index 100% rename from misc/cgo/testplugin/altpath/src/common/common.go rename to misc/cgo/testplugin/altpath/testdata/common/common.go diff --git a/misc/cgo/testplugin/altpath/src/plugin-mismatch/main.go b/misc/cgo/testplugin/altpath/testdata/plugin-mismatch/main.go similarity index 94% rename from misc/cgo/testplugin/altpath/src/plugin-mismatch/main.go rename to misc/cgo/testplugin/altpath/testdata/plugin-mismatch/main.go index 8aacafc453..bfb4ba45aa 100644 --- a/misc/cgo/testplugin/altpath/src/plugin-mismatch/main.go +++ b/misc/cgo/testplugin/altpath/testdata/plugin-mismatch/main.go @@ -10,7 +10,7 @@ import "C" // The common package imported here does not match the common package // imported by plugin1. A program that attempts to load plugin1 and // plugin-mismatch should produce an error. -import "common" +import "testplugin/common" func ReadCommonX() int { return common.X diff --git a/misc/cgo/testplugin/overlaydir_test.go b/misc/cgo/testplugin/overlaydir_test.go new file mode 100644 index 0000000000..b68436ac03 --- /dev/null +++ b/misc/cgo/testplugin/overlaydir_test.go @@ -0,0 +1,81 @@ +// 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. + +package plugin_test + +import ( + "io" + "os" + "path/filepath" + "strings" +) + +// overlayDir makes a minimal-overhead copy of srcRoot in which new files may be added. +// +// TODO: Once we no longer need to support the misc module in GOPATH mode, +// factor this function out into a package to reduce duplication. +func overlayDir(dstRoot, srcRoot string) error { + dstRoot = filepath.Clean(dstRoot) + if err := os.MkdirAll(dstRoot, 0777); err != nil { + return err + } + + symBase, err := filepath.Rel(srcRoot, dstRoot) + if err != nil { + symBase, err = filepath.Abs(srcRoot) + if err != nil { + return err + } + } + + return filepath.Walk(srcRoot, func(srcPath string, info os.FileInfo, err error) error { + if err != nil || srcPath == srcRoot { + return err + } + + suffix := strings.TrimPrefix(srcPath, srcRoot) + for len(suffix) > 0 && suffix[0] == filepath.Separator { + suffix = suffix[1:] + } + dstPath := filepath.Join(dstRoot, suffix) + + perm := info.Mode() & os.ModePerm + if info.Mode()&os.ModeSymlink != 0 { + info, err = os.Stat(srcPath) + if err != nil { + return err + } + perm = info.Mode() & os.ModePerm + } + + // Always copy directories (don't symlink them). + // If we add a file in the overlay, we don't want to add it in the original. + if info.IsDir() { + return os.Mkdir(dstPath, perm) + } + + // If the OS supports symlinks, use them instead of copying bytes. + if err := os.Symlink(filepath.Join(symBase, suffix), dstPath); err == nil { + return nil + } + + // Otherwise, copy the bytes. + src, err := os.Open(srcPath) + if err != nil { + return err + } + defer src.Close() + + dst, err := os.OpenFile(dstPath, os.O_WRONLY|os.O_CREATE|os.O_EXCL, perm) + if err != nil { + return err + } + + _, err = io.Copy(dst, src) + if closeErr := dst.Close(); err == nil { + err = closeErr + } + return err + }) +} diff --git a/misc/cgo/testplugin/plugin_test.go b/misc/cgo/testplugin/plugin_test.go new file mode 100644 index 0000000000..2c110494d0 --- /dev/null +++ b/misc/cgo/testplugin/plugin_test.go @@ -0,0 +1,194 @@ +// 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. + +package plugin_test + +import ( + "bytes" + "context" + "fmt" + "io/ioutil" + "log" + "os" + "os/exec" + "path/filepath" + "runtime" + "strings" + "testing" + "time" +) + +var gcflags string = os.Getenv("GO_GCFLAGS") + +func TestMain(m *testing.M) { + log.SetFlags(log.Lshortfile) + + // Copy testdata into GOPATH/src/testarchive, along with a go.mod file + // declaring the same path. + + GOPATH, err := ioutil.TempDir("", "plugin_test") + if err != nil { + log.Panic(err) + } + defer os.RemoveAll(GOPATH) + + modRoot := filepath.Join(GOPATH, "src", "testplugin") + altRoot := filepath.Join(GOPATH, "alt", "src", "testplugin") + for srcRoot, dstRoot := range map[string]string{ + "testdata": modRoot, + filepath.Join("altpath", "testdata"): altRoot, + } { + if err := overlayDir(dstRoot, srcRoot); err != nil { + log.Panic(err) + } + if err := ioutil.WriteFile(filepath.Join(dstRoot, "go.mod"), []byte("module testplugin\n"), 0666); err != nil { + log.Panic(err) + } + } + + os.Setenv("GOPATH", filepath.Join(GOPATH, "alt")) + if err := os.Chdir(altRoot); err != nil { + log.Panic(err) + } + os.Setenv("PWD", altRoot) + goCmd(nil, "build", "-buildmode=plugin", "-o", filepath.Join(modRoot, "plugin-mismatch.so"), "./plugin-mismatch") + + os.Setenv("GOPATH", GOPATH) + if err := os.Chdir(modRoot); err != nil { + log.Panic(err) + } + os.Setenv("PWD", modRoot) + + os.Setenv("LD_LIBRARY_PATH", modRoot) + + goCmd(nil, "build", "-i", "-buildmode=plugin", "./plugin1") + goCmd(nil, "build", "-buildmode=plugin", "./plugin2") + so, err := ioutil.ReadFile("plugin2.so") + if err != nil { + log.Panic(err) + } + if err := ioutil.WriteFile("plugin2-dup.so", so, 0444); err != nil { + log.Panic(err) + } + + goCmd(nil, "build", "-buildmode=plugin", "-o=sub/plugin1.so", "./sub/plugin1") + goCmd(nil, "build", "-buildmode=plugin", "-o=unnamed1.so", "./unnamed1/main.go") + goCmd(nil, "build", "-buildmode=plugin", "-o=unnamed2.so", "./unnamed2/main.go") + goCmd(nil, "build", "-o", "host.exe", "./host") + + os.Exit(m.Run()) +} + +func goCmd(t *testing.T, op string, args ...string) { + if t != nil { + t.Helper() + } + run(t, "go", append([]string{op, "-gcflags", gcflags}, args...)...) +} + +func run(t *testing.T, bin string, args ...string) string { + cmd := exec.Command(bin, args...) + cmd.Stderr = new(strings.Builder) + out, err := cmd.Output() + if err != nil { + if t == nil { + log.Panicf("%s: %v\n%s", strings.Join(cmd.Args, " "), err, cmd.Stderr) + } else { + t.Helper() + t.Fatalf("%s: %v\n%s", strings.Join(cmd.Args, " "), err, cmd.Stderr) + } + } + + return string(bytes.TrimSpace(out)) +} + +func TestDWARFSections(t *testing.T) { + // test that DWARF sections are emitted for plugins and programs importing "plugin" + if runtime.GOOS != "darwin" { + // On macOS, for some reason, the linker doesn't add debug sections to .so, + // see issue #27502. + goCmd(t, "run", "./checkdwarf/main.go", "plugin2.so", "plugin2.UnexportedNameReuse") + } + goCmd(t, "run", "./checkdwarf/main.go", "./host.exe", "main.main") +} + +func TestRunHost(t *testing.T) { + run(t, "./host.exe") +} + +func TestUniqueTypesAndItabs(t *testing.T) { + goCmd(t, "build", "-buildmode=plugin", "./iface_a") + goCmd(t, "build", "-buildmode=plugin", "./iface_b") + goCmd(t, "build", "-o", "iface.exe", "./iface") + run(t, "./iface.exe") +} + +func TestIssue18676(t *testing.T) { + // make sure we don't add the same itab twice. + // The buggy code hangs forever, so use a timeout to check for that. + goCmd(t, "build", "-buildmode=plugin", "-o", "plugin.so", "./issue18676/plugin.go") + goCmd(t, "build", "-o", "issue18676.exe", "./issue18676/main.go") + + ctx, cancel := context.WithTimeout(context.Background(), 10*time.Second) + defer cancel() + cmd := exec.CommandContext(ctx, "./issue18676.exe") + out, err := cmd.CombinedOutput() + if err != nil { + t.Fatalf("%s: %v\n%s", strings.Join(cmd.Args, " "), err, out) + } +} + +func TestIssue19534(t *testing.T) { + // Test that we can load a plugin built in a path with non-alpha characters. + goCmd(t, "build", "-buildmode=plugin", "-ldflags='-pluginpath=issue.19534'", "-o", "plugin.so", "./issue19534/plugin.go") + goCmd(t, "build", "-o", "issue19534.exe", "./issue19534/main.go") + run(t, "./issue19534.exe") +} + +func TestIssue18584(t *testing.T) { + goCmd(t, "build", "-buildmode=plugin", "-o", "plugin.so", "./issue18584/plugin.go") + goCmd(t, "build", "-o", "issue18584.exe", "./issue18584/main.go") + run(t, "./issue18584.exe") +} + +func TestIssue19418(t *testing.T) { + goCmd(t, "build", "-buildmode=plugin", "-ldflags=-X main.Val=linkstr", "-o", "plugin.so", "./issue19418/plugin.go") + goCmd(t, "build", "-o", "issue19418.exe", "./issue19418/main.go") + run(t, "./issue19418.exe") +} + +func TestIssue19529(t *testing.T) { + goCmd(t, "build", "-buildmode=plugin", "-o", "plugin.so", "./issue19529/plugin.go") +} + +func TestIssue22175(t *testing.T) { + goCmd(t, "build", "-buildmode=plugin", "-o", "issue22175_plugin1.so", "./issue22175/plugin1.go") + goCmd(t, "build", "-buildmode=plugin", "-o", "issue22175_plugin2.so", "./issue22175/plugin2.go") + goCmd(t, "build", "-o", "issue22175.exe", "./issue22175/main.go") + run(t, "./issue22175.exe") +} + +func TestIssue22295(t *testing.T) { + goCmd(t, "build", "-buildmode=plugin", "-o", "issue.22295.so", "./issue22295.pkg") + goCmd(t, "build", "-o", "issue22295.exe", "./issue22295.pkg/main.go") + run(t, "./issue22295.exe") +} + +func TestIssue24351(t *testing.T) { + goCmd(t, "build", "-buildmode=plugin", "-o", "issue24351.so", "./issue24351/plugin.go") + goCmd(t, "build", "-o", "issue24351.exe", "./issue24351/main.go") + run(t, "./issue24351.exe") +} + +func TestIssue25756(t *testing.T) { + goCmd(t, "build", "-buildmode=plugin", "-o", "life.so", "./issue25756/plugin") + goCmd(t, "build", "-o", "issue25756.exe", "./issue25756/main.go") + // Fails intermittently, but 20 runs should cause the failure + for n := 20; n > 0; n-- { + t.Run(fmt.Sprint(n), func(t *testing.T) { + t.Parallel() + run(t, "./issue25756.exe") + }) + } +} diff --git a/misc/cgo/testplugin/test.bash b/misc/cgo/testplugin/test.bash deleted file mode 100755 index 1b94bc4bad..0000000000 --- a/misc/cgo/testplugin/test.bash +++ /dev/null @@ -1,109 +0,0 @@ -#!/usr/bin/env bash -# Copyright 2016 The Go Authors. All rights reserved. -# Use of this source code is governed by a BSD-style -# license that can be found in the LICENSE file. - -set -e - -if [ ! -f src/host/host.go ]; then - cwd=$(pwd) - echo "misc/cgo/testplugin/test.bash is running in $cwd" 1>&2 - exit 1 -fi - -goos=$(go env GOOS) -goarch=$(go env GOARCH) - -function cleanup() { - rm -f plugin*.so unnamed*.so iface*.so life.so issue* - rm -rf host pkg sub iface -} -trap cleanup EXIT - -rm -rf pkg sub -mkdir sub - -GOPATH=$(pwd) go build -i -gcflags "$GO_GCFLAGS" -buildmode=plugin plugin1 -GOPATH=$(pwd) go build -gcflags "$GO_GCFLAGS" -buildmode=plugin plugin2 -cp plugin2.so plugin2-dup.so -GOPATH=$(pwd)/altpath go build -gcflags "$GO_GCFLAGS" -buildmode=plugin plugin-mismatch -GOPATH=$(pwd) go build -gcflags "$GO_GCFLAGS" -buildmode=plugin -o=sub/plugin1.so sub/plugin1 -GOPATH=$(pwd) go build -gcflags "$GO_GCFLAGS" -buildmode=plugin -o=unnamed1.so unnamed1/main.go -GOPATH=$(pwd) go build -gcflags "$GO_GCFLAGS" -buildmode=plugin -o=unnamed2.so unnamed2/main.go -GOPATH=$(pwd) go build -gcflags "$GO_GCFLAGS" host - -# test that DWARF sections are emitted for plugins and programs importing "plugin" -if [ $GOOS != "darwin" ]; then - # On macOS, for some reason, the linker doesn't add debug sections to .so, - # see issue #27502. - go run src/checkdwarf/main.go plugin2.so plugin2.UnexportedNameReuse -fi -go run src/checkdwarf/main.go host main.main - -LD_LIBRARY_PATH=$(pwd) ./host - -# Test that types and itabs get properly uniqified. -GOPATH=$(pwd) go build -gcflags "$GO_GCFLAGS" -buildmode=plugin iface_a -GOPATH=$(pwd) go build -gcflags "$GO_GCFLAGS" -buildmode=plugin iface_b -GOPATH=$(pwd) go build -gcflags "$GO_GCFLAGS" iface -LD_LIBRARY_PATH=$(pwd) ./iface - -function _timeout() ( - set -e - $2 & - p=$! - (sleep $1; kill $p 2>/dev/null) & - p2=$! - wait $p 2>/dev/null - kill -0 $p2 2>/dev/null -) - -# Test for issue 18676 - make sure we don't add the same itab twice. -# The buggy code hangs forever, so use a timeout to check for that. -GOPATH=$(pwd) go build -gcflags "$GO_GCFLAGS" -buildmode=plugin -o plugin.so src/issue18676/plugin.go -GOPATH=$(pwd) go build -gcflags "$GO_GCFLAGS" -o issue18676 src/issue18676/main.go -_timeout 10s ./issue18676 - -# Test for issue 19534 - that we can load a plugin built in a path with non-alpha -# characters -GOPATH=$(pwd) go build -gcflags "$GO_GCFLAGS" -buildmode=plugin -ldflags='-pluginpath=issue.19534' -o plugin.so src/issue19534/plugin.go -GOPATH=$(pwd) go build -gcflags "$GO_GCFLAGS" -o issue19534 src/issue19534/main.go -./issue19534 - -# Test for issue 18584 -GOPATH=$(pwd) go build -gcflags "$GO_GCFLAGS" -buildmode=plugin -o plugin.so src/issue18584/plugin.go -GOPATH=$(pwd) go build -gcflags "$GO_GCFLAGS" -o issue18584 src/issue18584/main.go -./issue18584 - -# Test for issue 19418 -GOPATH=$(pwd) go build -gcflags "$GO_GCFLAGS" -buildmode=plugin "-ldflags=-X main.Val=linkstr" -o plugin.so src/issue19418/plugin.go -GOPATH=$(pwd) go build -gcflags "$GO_GCFLAGS" -o issue19418 src/issue19418/main.go -./issue19418 - -# Test for issue 19529 -GOPATH=$(pwd) go build -gcflags "$GO_GCFLAGS" -buildmode=plugin -o plugin.so src/issue19529/plugin.go - -# Test for issue 22175 -GOPATH=$(pwd) go build -gcflags "$GO_GCFLAGS" -buildmode=plugin -o issue22175_plugin1.so src/issue22175/plugin1.go -GOPATH=$(pwd) go build -gcflags "$GO_GCFLAGS" -buildmode=plugin -o issue22175_plugin2.so src/issue22175/plugin2.go -GOPATH=$(pwd) go build -gcflags "$GO_GCFLAGS" -o issue22175 src/issue22175/main.go -./issue22175 - -# Test for issue 22295 -GOPATH=$(pwd) go build -gcflags "$GO_GCFLAGS" -buildmode=plugin -o issue.22295.so issue22295.pkg -GOPATH=$(pwd) go build -gcflags "$GO_GCFLAGS" -o issue22295 src/issue22295.pkg/main.go -./issue22295 - -# Test for issue 24351 -GOPATH=$(pwd) go build -gcflags "$GO_GCFLAGS" -buildmode=plugin -o issue24351.so src/issue24351/plugin.go -GOPATH=$(pwd) go build -gcflags "$GO_GCFLAGS" -o issue24351 src/issue24351/main.go -./issue24351 - -# Test for issue 25756 -GOPATH=$(pwd) go build -gcflags "$GO_GCFLAGS" -buildmode=plugin -o life.so issue25756/plugin -GOPATH=$(pwd) go build -gcflags "$GO_GCFLAGS" -o issue25756 src/issue25756/main.go -# Fails intermittently, but 20 runs should cause the failure -for i in `seq 1 20`; -do - ./issue25756 > /dev/null -done diff --git a/misc/cgo/testplugin/src/checkdwarf/main.go b/misc/cgo/testplugin/testdata/checkdwarf/main.go similarity index 100% rename from misc/cgo/testplugin/src/checkdwarf/main.go rename to misc/cgo/testplugin/testdata/checkdwarf/main.go diff --git a/misc/cgo/testplugin/src/common/common.go b/misc/cgo/testplugin/testdata/common/common.go similarity index 100% rename from misc/cgo/testplugin/src/common/common.go rename to misc/cgo/testplugin/testdata/common/common.go diff --git a/misc/cgo/testplugin/src/host/host.go b/misc/cgo/testplugin/testdata/host/host.go similarity index 99% rename from misc/cgo/testplugin/src/host/host.go rename to misc/cgo/testplugin/testdata/host/host.go index 0ca17da3de..a3799328cd 100644 --- a/misc/cgo/testplugin/src/host/host.go +++ b/misc/cgo/testplugin/testdata/host/host.go @@ -11,7 +11,7 @@ import ( "plugin" "strings" - "common" + "testplugin/common" ) func init() { diff --git a/misc/cgo/testplugin/src/iface/main.go b/misc/cgo/testplugin/testdata/iface/main.go similarity index 97% rename from misc/cgo/testplugin/src/iface/main.go rename to misc/cgo/testplugin/testdata/iface/main.go index 5e7e4d8b48..7b4ea97442 100644 --- a/misc/cgo/testplugin/src/iface/main.go +++ b/misc/cgo/testplugin/testdata/iface/main.go @@ -5,7 +5,7 @@ package main import ( - "iface_i" + "testplugin/iface_i" "log" "plugin" ) diff --git a/misc/cgo/testplugin/src/iface_a/a.go b/misc/cgo/testplugin/testdata/iface_a/a.go similarity index 91% rename from misc/cgo/testplugin/src/iface_a/a.go rename to misc/cgo/testplugin/testdata/iface_a/a.go index 29d2e27764..357f7e827e 100644 --- a/misc/cgo/testplugin/src/iface_a/a.go +++ b/misc/cgo/testplugin/testdata/iface_a/a.go @@ -4,7 +4,7 @@ package main -import "iface_i" +import "testplugin/iface_i" //go:noinline func F() interface{} { diff --git a/misc/cgo/testplugin/src/iface_b/b.go b/misc/cgo/testplugin/testdata/iface_b/b.go similarity index 91% rename from misc/cgo/testplugin/src/iface_b/b.go rename to misc/cgo/testplugin/testdata/iface_b/b.go index 29d2e27764..357f7e827e 100644 --- a/misc/cgo/testplugin/src/iface_b/b.go +++ b/misc/cgo/testplugin/testdata/iface_b/b.go @@ -4,7 +4,7 @@ package main -import "iface_i" +import "testplugin/iface_i" //go:noinline func F() interface{} { diff --git a/misc/cgo/testplugin/src/iface_i/i.go b/misc/cgo/testplugin/testdata/iface_i/i.go similarity index 100% rename from misc/cgo/testplugin/src/iface_i/i.go rename to misc/cgo/testplugin/testdata/iface_i/i.go diff --git a/misc/cgo/testplugin/src/issue18584/main.go b/misc/cgo/testplugin/testdata/issue18584/main.go similarity index 100% rename from misc/cgo/testplugin/src/issue18584/main.go rename to misc/cgo/testplugin/testdata/issue18584/main.go diff --git a/misc/cgo/testplugin/src/issue18584/plugin.go b/misc/cgo/testplugin/testdata/issue18584/plugin.go similarity index 100% rename from misc/cgo/testplugin/src/issue18584/plugin.go rename to misc/cgo/testplugin/testdata/issue18584/plugin.go diff --git a/misc/cgo/testplugin/src/issue18676/dynamodbstreamsevt/definition.go b/misc/cgo/testplugin/testdata/issue18676/dynamodbstreamsevt/definition.go similarity index 100% rename from misc/cgo/testplugin/src/issue18676/dynamodbstreamsevt/definition.go rename to misc/cgo/testplugin/testdata/issue18676/dynamodbstreamsevt/definition.go diff --git a/misc/cgo/testplugin/src/issue18676/main.go b/misc/cgo/testplugin/testdata/issue18676/main.go similarity index 96% rename from misc/cgo/testplugin/src/issue18676/main.go rename to misc/cgo/testplugin/testdata/issue18676/main.go index c75409dafe..b1dadbedf2 100644 --- a/misc/cgo/testplugin/src/issue18676/main.go +++ b/misc/cgo/testplugin/testdata/issue18676/main.go @@ -17,8 +17,8 @@ package main import ( "encoding/json" - "issue18676/dynamodbstreamsevt" "plugin" + "testplugin/issue18676/dynamodbstreamsevt" ) func main() { diff --git a/misc/cgo/testplugin/src/issue18676/plugin.go b/misc/cgo/testplugin/testdata/issue18676/plugin.go similarity index 82% rename from misc/cgo/testplugin/src/issue18676/plugin.go rename to misc/cgo/testplugin/testdata/issue18676/plugin.go index 8a3b85a75c..e7fc74f777 100644 --- a/misc/cgo/testplugin/src/issue18676/plugin.go +++ b/misc/cgo/testplugin/testdata/issue18676/plugin.go @@ -6,6 +6,6 @@ package main import "C" -import "issue18676/dynamodbstreamsevt" +import "testplugin/issue18676/dynamodbstreamsevt" func F(evt *dynamodbstreamsevt.Event) {} diff --git a/misc/cgo/testplugin/src/issue19418/main.go b/misc/cgo/testplugin/testdata/issue19418/main.go similarity index 100% rename from misc/cgo/testplugin/src/issue19418/main.go rename to misc/cgo/testplugin/testdata/issue19418/main.go diff --git a/misc/cgo/testplugin/src/issue19418/plugin.go b/misc/cgo/testplugin/testdata/issue19418/plugin.go similarity index 100% rename from misc/cgo/testplugin/src/issue19418/plugin.go rename to misc/cgo/testplugin/testdata/issue19418/plugin.go diff --git a/misc/cgo/testplugin/src/issue19529/plugin.go b/misc/cgo/testplugin/testdata/issue19529/plugin.go similarity index 100% rename from misc/cgo/testplugin/src/issue19529/plugin.go rename to misc/cgo/testplugin/testdata/issue19529/plugin.go diff --git a/misc/cgo/testplugin/src/issue19534/main.go b/misc/cgo/testplugin/testdata/issue19534/main.go similarity index 100% rename from misc/cgo/testplugin/src/issue19534/main.go rename to misc/cgo/testplugin/testdata/issue19534/main.go diff --git a/misc/cgo/testplugin/src/issue19534/plugin.go b/misc/cgo/testplugin/testdata/issue19534/plugin.go similarity index 100% rename from misc/cgo/testplugin/src/issue19534/plugin.go rename to misc/cgo/testplugin/testdata/issue19534/plugin.go diff --git a/misc/cgo/testplugin/src/issue22175/main.go b/misc/cgo/testplugin/testdata/issue22175/main.go similarity index 100% rename from misc/cgo/testplugin/src/issue22175/main.go rename to misc/cgo/testplugin/testdata/issue22175/main.go diff --git a/misc/cgo/testplugin/src/issue22175/plugin1.go b/misc/cgo/testplugin/testdata/issue22175/plugin1.go similarity index 100% rename from misc/cgo/testplugin/src/issue22175/plugin1.go rename to misc/cgo/testplugin/testdata/issue22175/plugin1.go diff --git a/misc/cgo/testplugin/src/issue22175/plugin2.go b/misc/cgo/testplugin/testdata/issue22175/plugin2.go similarity index 100% rename from misc/cgo/testplugin/src/issue22175/plugin2.go rename to misc/cgo/testplugin/testdata/issue22175/plugin2.go diff --git a/misc/cgo/testplugin/src/issue22295.pkg/main.go b/misc/cgo/testplugin/testdata/issue22295.pkg/main.go similarity index 100% rename from misc/cgo/testplugin/src/issue22295.pkg/main.go rename to misc/cgo/testplugin/testdata/issue22295.pkg/main.go diff --git a/misc/cgo/testplugin/src/issue22295.pkg/plugin.go b/misc/cgo/testplugin/testdata/issue22295.pkg/plugin.go similarity index 100% rename from misc/cgo/testplugin/src/issue22295.pkg/plugin.go rename to misc/cgo/testplugin/testdata/issue22295.pkg/plugin.go diff --git a/misc/cgo/testplugin/src/issue24351/main.go b/misc/cgo/testplugin/testdata/issue24351/main.go similarity index 100% rename from misc/cgo/testplugin/src/issue24351/main.go rename to misc/cgo/testplugin/testdata/issue24351/main.go diff --git a/misc/cgo/testplugin/src/issue24351/plugin.go b/misc/cgo/testplugin/testdata/issue24351/plugin.go similarity index 100% rename from misc/cgo/testplugin/src/issue24351/plugin.go rename to misc/cgo/testplugin/testdata/issue24351/plugin.go diff --git a/misc/cgo/testplugin/src/issue25756/main.go b/misc/cgo/testplugin/testdata/issue25756/main.go similarity index 100% rename from misc/cgo/testplugin/src/issue25756/main.go rename to misc/cgo/testplugin/testdata/issue25756/main.go diff --git a/misc/cgo/testplugin/src/issue25756/plugin/c-life.c b/misc/cgo/testplugin/testdata/issue25756/plugin/c-life.c similarity index 100% rename from misc/cgo/testplugin/src/issue25756/plugin/c-life.c rename to misc/cgo/testplugin/testdata/issue25756/plugin/c-life.c diff --git a/misc/cgo/testplugin/src/issue25756/plugin/life.go b/misc/cgo/testplugin/testdata/issue25756/plugin/life.go similarity index 100% rename from misc/cgo/testplugin/src/issue25756/plugin/life.go rename to misc/cgo/testplugin/testdata/issue25756/plugin/life.go diff --git a/misc/cgo/testplugin/src/issue25756/plugin/life.h b/misc/cgo/testplugin/testdata/issue25756/plugin/life.h similarity index 100% rename from misc/cgo/testplugin/src/issue25756/plugin/life.h rename to misc/cgo/testplugin/testdata/issue25756/plugin/life.h diff --git a/misc/cgo/testplugin/src/plugin1/plugin1.go b/misc/cgo/testplugin/testdata/plugin1/plugin1.go similarity index 97% rename from misc/cgo/testplugin/src/plugin1/plugin1.go rename to misc/cgo/testplugin/testdata/plugin1/plugin1.go index 0a9fa2f2c1..136c179b65 100644 --- a/misc/cgo/testplugin/src/plugin1/plugin1.go +++ b/misc/cgo/testplugin/testdata/plugin1/plugin1.go @@ -8,7 +8,7 @@ package main import "C" import ( - "common" + "testplugin/common" "reflect" ) diff --git a/misc/cgo/testplugin/src/plugin2/plugin2.go b/misc/cgo/testplugin/testdata/plugin2/plugin2.go similarity index 97% rename from misc/cgo/testplugin/src/plugin2/plugin2.go rename to misc/cgo/testplugin/testdata/plugin2/plugin2.go index a67f2de27a..37168a13e1 100644 --- a/misc/cgo/testplugin/src/plugin2/plugin2.go +++ b/misc/cgo/testplugin/testdata/plugin2/plugin2.go @@ -12,7 +12,7 @@ import "C" // void cfunc() {} // uses cgo_topofstack import ( - "common" + "testplugin/common" "reflect" "strings" ) diff --git a/misc/cgo/testplugin/src/sub/plugin1/plugin1.go b/misc/cgo/testplugin/testdata/sub/plugin1/plugin1.go similarity index 93% rename from misc/cgo/testplugin/src/sub/plugin1/plugin1.go rename to misc/cgo/testplugin/testdata/sub/plugin1/plugin1.go index cf9000c4a4..5f891b09a3 100644 --- a/misc/cgo/testplugin/src/sub/plugin1/plugin1.go +++ b/misc/cgo/testplugin/testdata/sub/plugin1/plugin1.go @@ -7,7 +7,7 @@ package main // // No C code required. import "C" -import "common" +import "testplugin/common" func F() int { return 17 } diff --git a/misc/cgo/testplugin/unnamed1/main.go b/misc/cgo/testplugin/testdata/unnamed1/main.go similarity index 96% rename from misc/cgo/testplugin/unnamed1/main.go rename to misc/cgo/testplugin/testdata/unnamed1/main.go index caf09c9e89..dd1777b418 100644 --- a/misc/cgo/testplugin/unnamed1/main.go +++ b/misc/cgo/testplugin/testdata/unnamed1/main.go @@ -2,6 +2,8 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. +// +build ignore + package main // // No C code required. diff --git a/misc/cgo/testplugin/unnamed2/main.go b/misc/cgo/testplugin/testdata/unnamed2/main.go similarity index 95% rename from misc/cgo/testplugin/unnamed2/main.go rename to misc/cgo/testplugin/testdata/unnamed2/main.go index 7ef66109c5..757436f250 100644 --- a/misc/cgo/testplugin/unnamed2/main.go +++ b/misc/cgo/testplugin/testdata/unnamed2/main.go @@ -2,6 +2,8 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. +// +build ignore + package main // // No C code required. diff --git a/misc/cgo/testsanitizers/cc_test.go b/misc/cgo/testsanitizers/cc_test.go index 218e225429..0192a663dd 100644 --- a/misc/cgo/testsanitizers/cc_test.go +++ b/misc/cgo/testsanitizers/cc_test.go @@ -394,7 +394,7 @@ func (c *config) checkRuntime() (skip bool, err error) { // srcPath returns the path to the given file relative to this test's source tree. func srcPath(path string) string { - return filepath.Join("src", path) + return filepath.Join("testdata", path) } // A tempDir manages a temporary directory within a test. diff --git a/misc/cgo/testsanitizers/src/msan.go b/misc/cgo/testsanitizers/testdata/msan.go similarity index 100% rename from misc/cgo/testsanitizers/src/msan.go rename to misc/cgo/testsanitizers/testdata/msan.go diff --git a/misc/cgo/testsanitizers/src/msan2.go b/misc/cgo/testsanitizers/testdata/msan2.go similarity index 100% rename from misc/cgo/testsanitizers/src/msan2.go rename to misc/cgo/testsanitizers/testdata/msan2.go diff --git a/misc/cgo/testsanitizers/src/msan2_cmsan.go b/misc/cgo/testsanitizers/testdata/msan2_cmsan.go similarity index 100% rename from misc/cgo/testsanitizers/src/msan2_cmsan.go rename to misc/cgo/testsanitizers/testdata/msan2_cmsan.go diff --git a/misc/cgo/testsanitizers/src/msan3.go b/misc/cgo/testsanitizers/testdata/msan3.go similarity index 100% rename from misc/cgo/testsanitizers/src/msan3.go rename to misc/cgo/testsanitizers/testdata/msan3.go diff --git a/misc/cgo/testsanitizers/src/msan4.go b/misc/cgo/testsanitizers/testdata/msan4.go similarity index 100% rename from misc/cgo/testsanitizers/src/msan4.go rename to misc/cgo/testsanitizers/testdata/msan4.go diff --git a/misc/cgo/testsanitizers/src/msan5.go b/misc/cgo/testsanitizers/testdata/msan5.go similarity index 100% rename from misc/cgo/testsanitizers/src/msan5.go rename to misc/cgo/testsanitizers/testdata/msan5.go diff --git a/misc/cgo/testsanitizers/src/msan6.go b/misc/cgo/testsanitizers/testdata/msan6.go similarity index 100% rename from misc/cgo/testsanitizers/src/msan6.go rename to misc/cgo/testsanitizers/testdata/msan6.go diff --git a/misc/cgo/testsanitizers/src/msan_fail.go b/misc/cgo/testsanitizers/testdata/msan_fail.go similarity index 100% rename from misc/cgo/testsanitizers/src/msan_fail.go rename to misc/cgo/testsanitizers/testdata/msan_fail.go diff --git a/misc/cgo/testsanitizers/src/msan_shared.go b/misc/cgo/testsanitizers/testdata/msan_shared.go similarity index 100% rename from misc/cgo/testsanitizers/src/msan_shared.go rename to misc/cgo/testsanitizers/testdata/msan_shared.go diff --git a/misc/cgo/testsanitizers/src/tsan.go b/misc/cgo/testsanitizers/testdata/tsan.go similarity index 100% rename from misc/cgo/testsanitizers/src/tsan.go rename to misc/cgo/testsanitizers/testdata/tsan.go diff --git a/misc/cgo/testsanitizers/src/tsan10.go b/misc/cgo/testsanitizers/testdata/tsan10.go similarity index 100% rename from misc/cgo/testsanitizers/src/tsan10.go rename to misc/cgo/testsanitizers/testdata/tsan10.go diff --git a/misc/cgo/testsanitizers/src/tsan11.go b/misc/cgo/testsanitizers/testdata/tsan11.go similarity index 100% rename from misc/cgo/testsanitizers/src/tsan11.go rename to misc/cgo/testsanitizers/testdata/tsan11.go diff --git a/misc/cgo/testsanitizers/src/tsan12.go b/misc/cgo/testsanitizers/testdata/tsan12.go similarity index 100% rename from misc/cgo/testsanitizers/src/tsan12.go rename to misc/cgo/testsanitizers/testdata/tsan12.go diff --git a/misc/cgo/testsanitizers/src/tsan2.go b/misc/cgo/testsanitizers/testdata/tsan2.go similarity index 100% rename from misc/cgo/testsanitizers/src/tsan2.go rename to misc/cgo/testsanitizers/testdata/tsan2.go diff --git a/misc/cgo/testsanitizers/src/tsan3.go b/misc/cgo/testsanitizers/testdata/tsan3.go similarity index 100% rename from misc/cgo/testsanitizers/src/tsan3.go rename to misc/cgo/testsanitizers/testdata/tsan3.go diff --git a/misc/cgo/testsanitizers/src/tsan4.go b/misc/cgo/testsanitizers/testdata/tsan4.go similarity index 100% rename from misc/cgo/testsanitizers/src/tsan4.go rename to misc/cgo/testsanitizers/testdata/tsan4.go diff --git a/misc/cgo/testsanitizers/src/tsan5.go b/misc/cgo/testsanitizers/testdata/tsan5.go similarity index 100% rename from misc/cgo/testsanitizers/src/tsan5.go rename to misc/cgo/testsanitizers/testdata/tsan5.go diff --git a/misc/cgo/testsanitizers/src/tsan6.go b/misc/cgo/testsanitizers/testdata/tsan6.go similarity index 100% rename from misc/cgo/testsanitizers/src/tsan6.go rename to misc/cgo/testsanitizers/testdata/tsan6.go diff --git a/misc/cgo/testsanitizers/src/tsan7.go b/misc/cgo/testsanitizers/testdata/tsan7.go similarity index 100% rename from misc/cgo/testsanitizers/src/tsan7.go rename to misc/cgo/testsanitizers/testdata/tsan7.go diff --git a/misc/cgo/testsanitizers/src/tsan8.go b/misc/cgo/testsanitizers/testdata/tsan8.go similarity index 100% rename from misc/cgo/testsanitizers/src/tsan8.go rename to misc/cgo/testsanitizers/testdata/tsan8.go diff --git a/misc/cgo/testsanitizers/src/tsan9.go b/misc/cgo/testsanitizers/testdata/tsan9.go similarity index 100% rename from misc/cgo/testsanitizers/src/tsan9.go rename to misc/cgo/testsanitizers/testdata/tsan9.go diff --git a/misc/cgo/testsanitizers/src/tsan_shared.go b/misc/cgo/testsanitizers/testdata/tsan_shared.go similarity index 100% rename from misc/cgo/testsanitizers/src/tsan_shared.go rename to misc/cgo/testsanitizers/testdata/tsan_shared.go diff --git a/misc/cgo/testshared/overlaydir_test.go b/misc/cgo/testshared/overlaydir_test.go new file mode 100644 index 0000000000..68be056256 --- /dev/null +++ b/misc/cgo/testshared/overlaydir_test.go @@ -0,0 +1,81 @@ +// 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. + +package shared_test + +import ( + "io" + "os" + "path/filepath" + "strings" +) + +// overlayDir makes a minimal-overhead copy of srcRoot in which new files may be added. +// +// TODO: Once we no longer need to support the misc module in GOPATH mode, +// factor this function out into a package to reduce duplication. +func overlayDir(dstRoot, srcRoot string) error { + dstRoot = filepath.Clean(dstRoot) + if err := os.MkdirAll(dstRoot, 0777); err != nil { + return err + } + + symBase, err := filepath.Rel(srcRoot, dstRoot) + if err != nil { + symBase, err = filepath.Abs(srcRoot) + if err != nil { + return err + } + } + + return filepath.Walk(srcRoot, func(srcPath string, info os.FileInfo, err error) error { + if err != nil || srcPath == srcRoot { + return err + } + + suffix := strings.TrimPrefix(srcPath, srcRoot) + for len(suffix) > 0 && suffix[0] == filepath.Separator { + suffix = suffix[1:] + } + dstPath := filepath.Join(dstRoot, suffix) + + perm := info.Mode() & os.ModePerm + if info.Mode()&os.ModeSymlink != 0 { + info, err = os.Stat(srcPath) + if err != nil { + return err + } + perm = info.Mode() & os.ModePerm + } + + // Always copy directories (don't symlink them). + // If we add a file in the overlay, we don't want to add it in the original. + if info.IsDir() { + return os.Mkdir(dstPath, perm) + } + + // If the OS supports symlinks, use them instead of copying bytes. + if err := os.Symlink(filepath.Join(symBase, suffix), dstPath); err == nil { + return nil + } + + // Otherwise, copy the bytes. + src, err := os.Open(srcPath) + if err != nil { + return err + } + defer src.Close() + + dst, err := os.OpenFile(dstPath, os.O_WRONLY|os.O_CREATE|os.O_EXCL, perm) + if err != nil { + return err + } + + _, err = io.Copy(dst, src) + if closeErr := dst.Close(); err == nil { + err = closeErr + } + return err + }) +} diff --git a/misc/cgo/testshared/shared_test.go b/misc/cgo/testshared/shared_test.go index 41a24efe22..ac1a1c7f1a 100644 --- a/misc/cgo/testshared/shared_test.go +++ b/misc/cgo/testshared/shared_test.go @@ -44,31 +44,35 @@ func run(t *testing.T, msg string, args ...string) { // goCmd invokes the go tool with the installsuffix set up by TestMain. It calls // t.Fatalf if the command fails. -func goCmd(t *testing.T, args ...string) { +func goCmd(t *testing.T, args ...string) string { newargs := []string{args[0], "-installsuffix=" + suffix} if testing.Verbose() { newargs = append(newargs, "-x") } newargs = append(newargs, args[1:]...) c := exec.Command("go", newargs...) + + stderr := new(strings.Builder) var output []byte var err error if testing.Verbose() { - fmt.Printf("+ go %s\n", strings.Join(newargs, " ")) - c.Stdout = os.Stdout + fmt.Printf("+ go %s\n", strings.Join(args, " ")) c.Stderr = os.Stderr - err = c.Run() - output = []byte("(output above)") + stderr.WriteString("(output above)") } else { - output, err = c.CombinedOutput() + c.Stderr = stderr } + output, err = c.Output() + if err != nil { if t != nil { - t.Fatalf("executing %s failed %v:\n%s", strings.Join(c.Args, " "), err, output) + t.Helper() + t.Fatalf("executing %s failed %v:\n%s", strings.Join(c.Args, " "), err, stderr) } else { - log.Fatalf("executing %s failed %v:\n%s", strings.Join(c.Args, " "), err, output) + log.Fatalf("executing %s failed %v:\n%s", strings.Join(c.Args, " "), err, stderr) } } + return string(bytes.TrimSpace(output)) } // TestMain calls testMain so that the latter can use defer (TestMain exits with os.Exit). @@ -105,47 +109,33 @@ func testMain(m *testing.M) (int, error) { // Some tests need to edit the source in GOPATH, so copy this directory to a // temporary directory and chdir to that. - scratchDir, err := ioutil.TempDir("", "testshared") + gopath, err := ioutil.TempDir("", "testshared") if err != nil { return 0, fmt.Errorf("TempDir failed: %v", err) } if testing.Verbose() { - fmt.Printf("+ mkdir -p %s\n", scratchDir) + fmt.Printf("+ mkdir -p %s\n", gopath) } - defer os.RemoveAll(scratchDir) - err = filepath.Walk(".", func(path string, info os.FileInfo, err error) error { - scratchPath := filepath.Join(scratchDir, path) - if info.IsDir() { - if path == "." { - return nil - } - if testing.Verbose() { - fmt.Printf("+ mkdir -p %s\n", scratchPath) - } - return os.Mkdir(scratchPath, info.Mode()) - } else { - fromBytes, err := ioutil.ReadFile(path) - if err != nil { - return err - } - if testing.Verbose() { - fmt.Printf("+ cp %s %s\n", path, scratchPath) - } - return ioutil.WriteFile(scratchPath, fromBytes, info.Mode()) - } - }) - if err != nil { - return 0, fmt.Errorf("walk failed: %v", err) + defer os.RemoveAll(gopath) + + modRoot := filepath.Join(gopath, "src", "testshared") + if err := overlayDir(modRoot, "testdata"); err != nil { + return 0, err } - os.Setenv("GOPATH", scratchDir) if testing.Verbose() { - fmt.Printf("+ export GOPATH=%s\n", scratchDir) + fmt.Printf("+ cd %s\n", modRoot) } - myContext.GOPATH = scratchDir + os.Chdir(modRoot) + os.Setenv("PWD", modRoot) + if err := ioutil.WriteFile("go.mod", []byte("module testshared\n"), 0666); err != nil { + return 0, err + } + + os.Setenv("GOPATH", gopath) if testing.Verbose() { - fmt.Printf("+ cd %s\n", scratchDir) + fmt.Printf("+ export GOPATH=%s\n", gopath) } - os.Chdir(scratchDir) + myContext.GOPATH = gopath // All tests depend on runtime being built into a shared library. Because // that takes a few seconds, do it here and have all tests use the version @@ -154,15 +144,20 @@ func testMain(m *testing.M) (int, error) { goCmd(nil, append([]string{"install", "-buildmode=shared"}, minpkgs...)...) myContext.InstallSuffix = suffix + "_dynlink" - depP, err := myContext.Import("depBase", ".", build.ImportComment) + depP, err := myContext.Import("./depBase", ".", build.ImportComment) if err != nil { return 0, fmt.Errorf("import failed: %v", err) } - gopathInstallDir = depP.PkgTargetRoot + if depP.PkgTargetRoot == "" { + gopathInstallDir = filepath.Dir(goCmd(nil, "list", "-buildmode=shared", "-f", "{{.Target}}", "./depBase")) + } else { + gopathInstallDir = filepath.Join(depP.PkgTargetRoot, "testshared") + } return m.Run(), nil } func TestMain(m *testing.M) { + log.SetFlags(log.Lshortfile) flag.Parse() // Some of the tests install binaries into a custom GOPATH. @@ -350,6 +345,7 @@ func readNotes(f *elf.File) ([]*note, error) { } func dynStrings(t *testing.T, path string, flag elf.DynTag) []string { + t.Helper() f, err := elf.Open(path) if err != nil { t.Fatalf("elf.Open(%q) failed: %v", path, err) @@ -363,6 +359,7 @@ func dynStrings(t *testing.T, path string, flag elf.DynTag) []string { } func AssertIsLinkedToRegexp(t *testing.T, path string, re *regexp.Regexp) { + t.Helper() for _, dynstring := range dynStrings(t, path, elf.DT_NEEDED) { if re.MatchString(dynstring) { return @@ -372,10 +369,12 @@ func AssertIsLinkedToRegexp(t *testing.T, path string, re *regexp.Regexp) { } func AssertIsLinkedTo(t *testing.T, path, lib string) { + t.Helper() AssertIsLinkedToRegexp(t, path, regexp.MustCompile(regexp.QuoteMeta(lib))) } func AssertHasRPath(t *testing.T, path, dir string) { + t.Helper() for _, tag := range []elf.DynTag{elf.DT_RPATH, elf.DT_RUNPATH} { for _, dynstring := range dynStrings(t, path, tag) { for _, rpath := range strings.Split(dynstring, ":") { @@ -390,15 +389,15 @@ func AssertHasRPath(t *testing.T, path, dir string) { // Build a trivial program that links against the shared runtime and check it runs. func TestTrivialExecutable(t *testing.T) { - goCmd(t, "install", "-linkshared", "trivial") - run(t, "trivial executable", "./bin/trivial") - AssertIsLinkedTo(t, "./bin/trivial", soname) - AssertHasRPath(t, "./bin/trivial", gorootInstallDir) + goCmd(t, "install", "-linkshared", "./trivial") + run(t, "trivial executable", "../../bin/trivial") + AssertIsLinkedTo(t, "../../bin/trivial", soname) + AssertHasRPath(t, "../../bin/trivial", gorootInstallDir) } // Build a trivial program in PIE mode that links against the shared runtime and check it runs. func TestTrivialExecutablePIE(t *testing.T) { - goCmd(t, "build", "-buildmode=pie", "-o", "trivial.pie", "-linkshared", "trivial") + goCmd(t, "build", "-buildmode=pie", "-o", "trivial.pie", "-linkshared", "./trivial") run(t, "trivial executable", "./trivial.pie") AssertIsLinkedTo(t, "./trivial.pie", soname) AssertHasRPath(t, "./trivial.pie", gorootInstallDir) @@ -406,15 +405,15 @@ func TestTrivialExecutablePIE(t *testing.T) { // Build a division test program and check it runs. func TestDivisionExecutable(t *testing.T) { - goCmd(t, "install", "-linkshared", "division") - run(t, "division executable", "./bin/division") + goCmd(t, "install", "-linkshared", "./division") + run(t, "division executable", "../../bin/division") } // Build an executable that uses cgo linked against the shared runtime and check it // runs. func TestCgoExecutable(t *testing.T) { - goCmd(t, "install", "-linkshared", "execgo") - run(t, "cgo executable", "./bin/execgo") + goCmd(t, "install", "-linkshared", "./execgo") + run(t, "cgo executable", "../../bin/execgo") } func checkPIE(t *testing.T, name string) { @@ -433,7 +432,7 @@ func checkPIE(t *testing.T, name string) { func TestTrivialPIE(t *testing.T) { name := "trivial_pie" - goCmd(t, "build", "-buildmode=pie", "-o="+name, "trivial") + goCmd(t, "build", "-buildmode=pie", "-o="+name, "./trivial") defer os.Remove(name) run(t, name, "./"+name) checkPIE(t, name) @@ -441,7 +440,7 @@ func TestTrivialPIE(t *testing.T) { func TestCgoPIE(t *testing.T) { name := "cgo_pie" - goCmd(t, "build", "-buildmode=pie", "-o="+name, "execgo") + goCmd(t, "build", "-buildmode=pie", "-o="+name, "./execgo") defer os.Remove(name) run(t, name, "./"+name) checkPIE(t, name) @@ -450,15 +449,16 @@ func TestCgoPIE(t *testing.T) { // Build a GOPATH package into a shared library that links against the goroot runtime // and an executable that links against both. func TestGopathShlib(t *testing.T) { - goCmd(t, "install", "-buildmode=shared", "-linkshared", "depBase") - AssertIsLinkedTo(t, filepath.Join(gopathInstallDir, "libdepBase.so"), soname) - goCmd(t, "install", "-linkshared", "exe") - AssertIsLinkedTo(t, "./bin/exe", soname) - AssertIsLinkedTo(t, "./bin/exe", "libdepBase.so") - AssertHasRPath(t, "./bin/exe", gorootInstallDir) - AssertHasRPath(t, "./bin/exe", gopathInstallDir) + goCmd(t, "install", "-buildmode=shared", "-linkshared", "./depBase") + shlib := goCmd(t, "list", "-f", "{{.Shlib}}", "-buildmode=shared", "-linkshared", "./depBase") + AssertIsLinkedTo(t, shlib, soname) + goCmd(t, "install", "-linkshared", "./exe") + AssertIsLinkedTo(t, "../../bin/exe", soname) + AssertIsLinkedTo(t, "../../bin/exe", filepath.Base(shlib)) + AssertHasRPath(t, "../../bin/exe", gorootInstallDir) + AssertHasRPath(t, "../../bin/exe", filepath.Dir(gopathInstallDir)) // And check it runs. - run(t, "executable linked to GOPATH library", "./bin/exe") + run(t, "executable linked to GOPATH library", "../../bin/exe") } // The shared library contains a note listing the packages it contains in a section @@ -470,8 +470,8 @@ func testPkgListNote(t *testing.T, f *elf.File, note *note) { if isOffsetLoaded(f, note.section.Offset) { t.Errorf("package list section contained in PT_LOAD segment") } - if note.desc != "depBase\n" { - t.Errorf("incorrect package list %q, want %q", note.desc, "depBase\n") + if note.desc != "testshared/depBase\n" { + t.Errorf("incorrect package list %q, want %q", note.desc, "testshared/depBase\n") } } @@ -528,8 +528,9 @@ func testDepsNote(t *testing.T, f *elf.File, note *note) { // The shared library contains notes with defined contents; see above. func TestNotes(t *testing.T) { - goCmd(t, "install", "-buildmode=shared", "-linkshared", "depBase") - f, err := elf.Open(filepath.Join(gopathInstallDir, "libdepBase.so")) + goCmd(t, "install", "-buildmode=shared", "-linkshared", "./depBase") + shlib := goCmd(t, "list", "-f", "{{.Shlib}}", "-buildmode=shared", "-linkshared", "./depBase") + f, err := elf.Open(shlib) if err != nil { t.Fatal(err) } @@ -581,23 +582,24 @@ func TestNotes(t *testing.T) { // runtime, another package (dep2) that links against the first, and an // executable that links against dep2. func TestTwoGopathShlibs(t *testing.T) { - goCmd(t, "install", "-buildmode=shared", "-linkshared", "depBase") - goCmd(t, "install", "-buildmode=shared", "-linkshared", "dep2") - goCmd(t, "install", "-linkshared", "exe2") - run(t, "executable linked to GOPATH library", "./bin/exe2") + goCmd(t, "install", "-buildmode=shared", "-linkshared", "./depBase") + goCmd(t, "install", "-buildmode=shared", "-linkshared", "./dep2") + goCmd(t, "install", "-linkshared", "./exe2") + run(t, "executable linked to GOPATH library", "../../bin/exe2") } func TestThreeGopathShlibs(t *testing.T) { - goCmd(t, "install", "-buildmode=shared", "-linkshared", "depBase") - goCmd(t, "install", "-buildmode=shared", "-linkshared", "dep2") - goCmd(t, "install", "-buildmode=shared", "-linkshared", "dep3") - goCmd(t, "install", "-linkshared", "exe3") - run(t, "executable linked to GOPATH library", "./bin/exe3") + goCmd(t, "install", "-buildmode=shared", "-linkshared", "./depBase") + goCmd(t, "install", "-buildmode=shared", "-linkshared", "./dep2") + goCmd(t, "install", "-buildmode=shared", "-linkshared", "./dep3") + goCmd(t, "install", "-linkshared", "./exe3") + run(t, "executable linked to GOPATH library", "../../bin/exe3") } -// If gccgo is not available or not new enough call t.Skip. Otherwise, -// return a build.Context that is set up for gccgo. -func prepGccgo(t *testing.T) build.Context { +// If gccgo is not available or not new enough, call t.Skip. +func requireGccgo(t *testing.T) { + t.Helper() + gccgoName := os.Getenv("GCCGO") if gccgoName == "" { gccgoName = "gccgo" @@ -614,61 +616,64 @@ func prepGccgo(t *testing.T) build.Context { if string(output) < "5" { t.Skipf("gccgo too old (%s)", strings.TrimSpace(string(output))) } - gccgoContext := build.Default - gccgoContext.InstallSuffix = suffix + "_fPIC" - gccgoContext.Compiler = "gccgo" - gccgoContext.GOPATH = os.Getenv("GOPATH") - return gccgoContext + + gomod, err := exec.Command("go", "env", "GOMOD").Output() + if err != nil { + t.Fatalf("go env GOMOD: %v", err) + } + if len(bytes.TrimSpace(gomod)) > 0 { + t.Skipf("gccgo not supported in module mode; see golang.org/issue/30344") + } } // Build a GOPATH package into a shared library with gccgo and an executable that // links against it. func TestGoPathShlibGccgo(t *testing.T) { - gccgoContext := prepGccgo(t) + requireGccgo(t) libgoRE := regexp.MustCompile("libgo.so.[0-9]+") - depP, err := gccgoContext.Import("depBase", ".", build.ImportComment) - if err != nil { - t.Fatalf("import failed: %v", err) - } - gccgoInstallDir := filepath.Join(depP.PkgTargetRoot, "shlibs") - goCmd(t, "install", "-compiler=gccgo", "-buildmode=shared", "-linkshared", "depBase") - AssertIsLinkedToRegexp(t, filepath.Join(gccgoInstallDir, "libdepBase.so"), libgoRE) - goCmd(t, "install", "-compiler=gccgo", "-linkshared", "exe") - AssertIsLinkedToRegexp(t, "./bin/exe", libgoRE) - AssertIsLinkedTo(t, "./bin/exe", "libdepBase.so") - AssertHasRPath(t, "./bin/exe", gccgoInstallDir) + goCmd(t, "install", "-compiler=gccgo", "-buildmode=shared", "-linkshared", "./depBase") + + // Run 'go list' after 'go install': with gccgo, we apparently don't know the + // shlib location until after we've installed it. + shlib := goCmd(t, "list", "-compiler=gccgo", "-buildmode=shared", "-linkshared", "-f", "{{.Shlib}}", "./depBase") + + AssertIsLinkedToRegexp(t, shlib, libgoRE) + goCmd(t, "install", "-compiler=gccgo", "-linkshared", "./exe") + AssertIsLinkedToRegexp(t, "../../bin/exe", libgoRE) + AssertIsLinkedTo(t, "../../bin/exe", filepath.Base(shlib)) + AssertHasRPath(t, "../../bin/exe", filepath.Dir(shlib)) // And check it runs. - run(t, "gccgo-built", "./bin/exe") + run(t, "gccgo-built", "../../bin/exe") } // The gccgo version of TestTwoGopathShlibs: build a GOPATH package into a shared // library with gccgo, another GOPATH package that depends on the first and an // executable that links the second library. func TestTwoGopathShlibsGccgo(t *testing.T) { - gccgoContext := prepGccgo(t) + requireGccgo(t) libgoRE := regexp.MustCompile("libgo.so.[0-9]+") - depP, err := gccgoContext.Import("depBase", ".", build.ImportComment) - if err != nil { - t.Fatalf("import failed: %v", err) - } - gccgoInstallDir := filepath.Join(depP.PkgTargetRoot, "shlibs") - goCmd(t, "install", "-compiler=gccgo", "-buildmode=shared", "-linkshared", "depBase") - goCmd(t, "install", "-compiler=gccgo", "-buildmode=shared", "-linkshared", "dep2") - goCmd(t, "install", "-compiler=gccgo", "-linkshared", "exe2") + goCmd(t, "install", "-compiler=gccgo", "-buildmode=shared", "-linkshared", "./depBase") + goCmd(t, "install", "-compiler=gccgo", "-buildmode=shared", "-linkshared", "./dep2") + goCmd(t, "install", "-compiler=gccgo", "-linkshared", "./exe2") - AssertIsLinkedToRegexp(t, filepath.Join(gccgoInstallDir, "libdepBase.so"), libgoRE) - AssertIsLinkedToRegexp(t, filepath.Join(gccgoInstallDir, "libdep2.so"), libgoRE) - AssertIsLinkedTo(t, filepath.Join(gccgoInstallDir, "libdep2.so"), "libdepBase.so") - AssertIsLinkedToRegexp(t, "./bin/exe2", libgoRE) - AssertIsLinkedTo(t, "./bin/exe2", "libdep2") - AssertIsLinkedTo(t, "./bin/exe2", "libdepBase.so") + // Run 'go list' after 'go install': with gccgo, we apparently don't know the + // shlib location until after we've installed it. + dep2 := goCmd(t, "list", "-compiler=gccgo", "-buildmode=shared", "-linkshared", "-f", "{{.Shlib}}", "./dep2") + depBase := goCmd(t, "list", "-compiler=gccgo", "-buildmode=shared", "-linkshared", "-f", "{{.Shlib}}", "./depBase") + + AssertIsLinkedToRegexp(t, depBase, libgoRE) + AssertIsLinkedToRegexp(t, dep2, libgoRE) + AssertIsLinkedTo(t, dep2, filepath.Base(depBase)) + AssertIsLinkedToRegexp(t, "../../bin/exe2", libgoRE) + AssertIsLinkedTo(t, "../../bin/exe2", filepath.Base(dep2)) + AssertIsLinkedTo(t, "../../bin/exe2", filepath.Base(depBase)) // And check it runs. - run(t, "gccgo-built", "./bin/exe2") + run(t, "gccgo-built", "../../bin/exe2") } // Testing rebuilding of shared libraries when they are stale is a bit more @@ -694,9 +699,9 @@ func resetFileStamps() { } } - reset("bin") - reset("pkg") - reset("src") + reset("../../bin") + reset("../../pkg") + reset("../../src") reset(gorootInstallDir) } @@ -746,6 +751,7 @@ func touch(t *testing.T, path string) (cleanup func()) { // isNew returns if the path is newer than the time stamp used by touch. func isNew(t *testing.T, path string) bool { + t.Helper() fi, err := os.Stat(path) if err != nil { t.Fatal(err) @@ -771,40 +777,47 @@ func AssertNotRebuilt(t *testing.T, msg, path string) { } func TestRebuilding(t *testing.T) { - goCmd(t, "install", "-buildmode=shared", "-linkshared", "depBase") - goCmd(t, "install", "-linkshared", "exe") + goCmd(t, "install", "-buildmode=shared", "-linkshared", "./depBase") + goCmd(t, "install", "-linkshared", "./exe") + info := strings.Fields(goCmd(t, "list", "-buildmode=shared", "-linkshared", "-f", "{{.Target}} {{.Shlib}}", "./depBase")) + if len(info) != 2 { + t.Fatalf("go list failed to report Target and/or Shlib") + } + target := info[0] + shlib := info[1] // If the source is newer than both the .a file and the .so, both are rebuilt. t.Run("newsource", func(t *testing.T) { resetFileStamps() - cleanup := touch(t, "src/depBase/dep.go") + cleanup := touch(t, "./depBase/dep.go") defer func() { cleanup() - goCmd(t, "install", "-linkshared", "exe") + goCmd(t, "install", "-linkshared", "./exe") }() - goCmd(t, "install", "-linkshared", "exe") - AssertRebuilt(t, "new source", filepath.Join(gopathInstallDir, "depBase.a")) - AssertRebuilt(t, "new source", filepath.Join(gopathInstallDir, "libdepBase.so")) + goCmd(t, "install", "-linkshared", "./exe") + AssertRebuilt(t, "new source", target) + AssertRebuilt(t, "new source", shlib) }) // If the .a file is newer than the .so, the .so is rebuilt (but not the .a) t.Run("newarchive", func(t *testing.T) { resetFileStamps() - AssertNotRebuilt(t, "new .a file before build", filepath.Join(gopathInstallDir, "depBase.a")) - goCmd(t, "list", "-linkshared", "-f={{.ImportPath}} {{.Stale}} {{.StaleReason}} {{.Target}}", "depBase") - AssertNotRebuilt(t, "new .a file before build", filepath.Join(gopathInstallDir, "depBase.a")) - cleanup := touch(t, filepath.Join(gopathInstallDir, "depBase.a")) + AssertNotRebuilt(t, "new .a file before build", target) + goCmd(t, "list", "-linkshared", "-f={{.ImportPath}} {{.Stale}} {{.StaleReason}} {{.Target}}", "./depBase") + AssertNotRebuilt(t, "new .a file before build", target) + cleanup := touch(t, target) defer func() { cleanup() - goCmd(t, "install", "-v", "-linkshared", "exe") + goCmd(t, "install", "-v", "-linkshared", "./exe") }() - goCmd(t, "install", "-v", "-linkshared", "exe") - AssertNotRebuilt(t, "new .a file", filepath.Join(gopathInstallDir, "depBase.a")) - AssertRebuilt(t, "new .a file", filepath.Join(gopathInstallDir, "libdepBase.so")) + goCmd(t, "install", "-v", "-linkshared", "./exe") + AssertNotRebuilt(t, "new .a file", target) + AssertRebuilt(t, "new .a file", shlib) }) } func appendFile(t *testing.T, path, content string) { + t.Helper() f, err := os.OpenFile(path, os.O_WRONLY|os.O_APPEND, 0660) if err != nil { t.Fatalf("os.OpenFile failed: %v", err) @@ -821,16 +834,24 @@ func appendFile(t *testing.T, path, content string) { } } -func writeFile(t *testing.T, path, content string) { - err := ioutil.WriteFile(path, []byte(content), 0644) +func createFile(t *testing.T, path, content string) { + t.Helper() + f, err := os.OpenFile(path, os.O_WRONLY|os.O_CREATE|os.O_EXCL, 0644) if err != nil { - t.Fatalf("ioutil.WriteFile failed: %v", err) + t.Fatalf("os.OpenFile failed: %v", err) + } + _, err = f.WriteString(content) + if closeErr := f.Close(); err == nil { + err = closeErr + } + if err != nil { + t.Fatalf("WriteString failed: %v", err) } } func TestABIChecking(t *testing.T) { - goCmd(t, "install", "-buildmode=shared", "-linkshared", "depBase") - goCmd(t, "install", "-linkshared", "exe") + goCmd(t, "install", "-buildmode=shared", "-linkshared", "./depBase") + goCmd(t, "install", "-linkshared", "./exe") // If we make an ABI-breaking change to depBase and rebuild libp.so but not exe, // exe will abort with a complaint on startup. @@ -838,18 +859,21 @@ func TestABIChecking(t *testing.T) { // some senses but suffices for the narrow definition of ABI compatibility the // toolchain uses today. resetFileStamps() - appendFile(t, "src/depBase/dep.go", "func ABIBreak() {}\n") - goCmd(t, "install", "-buildmode=shared", "-linkshared", "depBase") - c := exec.Command("./bin/exe") + + createFile(t, "./depBase/break.go", "package depBase\nfunc ABIBreak() {}\n") + defer os.Remove("./depBase/break.go") + + goCmd(t, "install", "-buildmode=shared", "-linkshared", "./depBase") + c := exec.Command("../../bin/exe") output, err := c.CombinedOutput() if err == nil { t.Fatal("executing exe did not fail after ABI break") } scanner := bufio.NewScanner(bytes.NewReader(output)) foundMsg := false - const wantLine = "abi mismatch detected between the executable and libdepBase.so" + const wantPrefix = "abi mismatch detected between the executable and lib" for scanner.Scan() { - if scanner.Text() == wantLine { + if strings.HasPrefix(scanner.Text(), wantPrefix) { foundMsg = true break } @@ -858,20 +882,20 @@ func TestABIChecking(t *testing.T) { t.Errorf("scanner encountered error: %v", err) } if !foundMsg { - t.Fatalf("exe failed, but without line %q; got output:\n%s", wantLine, output) + t.Fatalf("exe failed, but without line %q; got output:\n%s", wantPrefix, output) } // Rebuilding exe makes it work again. - goCmd(t, "install", "-linkshared", "exe") - run(t, "rebuilt exe", "./bin/exe") + goCmd(t, "install", "-linkshared", "./exe") + run(t, "rebuilt exe", "../../bin/exe") // If we make a change which does not break ABI (such as adding an unexported // function) and rebuild libdepBase.so, exe still works, even if new function // is in a file by itself. resetFileStamps() - writeFile(t, "src/depBase/dep2.go", "package depBase\nfunc noABIBreak() {}\n") - goCmd(t, "install", "-buildmode=shared", "-linkshared", "depBase") - run(t, "after non-ABI breaking change", "./bin/exe") + createFile(t, "./depBase/dep2.go", "package depBase\nfunc noABIBreak() {}\n") + goCmd(t, "install", "-buildmode=shared", "-linkshared", "./depBase") + run(t, "after non-ABI breaking change", "../../bin/exe") } // If a package 'explicit' imports a package 'implicit', building @@ -881,29 +905,29 @@ func TestABIChecking(t *testing.T) { // executable rather than fetching it from the shared library. The // link still succeeds and the executable still runs though. func TestImplicitInclusion(t *testing.T) { - goCmd(t, "install", "-buildmode=shared", "-linkshared", "explicit") - goCmd(t, "install", "-linkshared", "implicitcmd") - run(t, "running executable linked against library that contains same package as it", "./bin/implicitcmd") + goCmd(t, "install", "-buildmode=shared", "-linkshared", "./explicit") + goCmd(t, "install", "-linkshared", "./implicitcmd") + run(t, "running executable linked against library that contains same package as it", "../../bin/implicitcmd") } // Tests to make sure that the type fields of empty interfaces and itab // fields of nonempty interfaces are unique even across modules, // so that interface equality works correctly. func TestInterface(t *testing.T) { - goCmd(t, "install", "-buildmode=shared", "-linkshared", "iface_a") + goCmd(t, "install", "-buildmode=shared", "-linkshared", "./iface_a") // Note: iface_i gets installed implicitly as a dependency of iface_a. - goCmd(t, "install", "-buildmode=shared", "-linkshared", "iface_b") - goCmd(t, "install", "-linkshared", "iface") - run(t, "running type/itab uniqueness tester", "./bin/iface") + goCmd(t, "install", "-buildmode=shared", "-linkshared", "./iface_b") + goCmd(t, "install", "-linkshared", "./iface") + run(t, "running type/itab uniqueness tester", "../../bin/iface") } // Access a global variable from a library. func TestGlobal(t *testing.T) { - goCmd(t, "install", "-buildmode=shared", "-linkshared", "globallib") - goCmd(t, "install", "-linkshared", "global") - run(t, "global executable", "./bin/global") - AssertIsLinkedTo(t, "./bin/global", soname) - AssertHasRPath(t, "./bin/global", gorootInstallDir) + goCmd(t, "install", "-buildmode=shared", "-linkshared", "./globallib") + goCmd(t, "install", "-linkshared", "./global") + run(t, "global executable", "../../bin/global") + AssertIsLinkedTo(t, "../../bin/global", soname) + AssertHasRPath(t, "../../bin/global", gorootInstallDir) } // Run a test using -linkshared of an installed shared package. @@ -915,5 +939,5 @@ func TestTestInstalledShared(t *testing.T) { // Test generated pointer method with -linkshared. // Issue 25065. func TestGeneratedMethod(t *testing.T) { - goCmd(t, "install", "-buildmode=shared", "-linkshared", "issue25065") + goCmd(t, "install", "-buildmode=shared", "-linkshared", "./issue25065") } diff --git a/misc/cgo/testshared/src/dep2/dep2.go b/misc/cgo/testshared/testdata/dep2/dep2.go similarity index 82% rename from misc/cgo/testshared/src/dep2/dep2.go rename to misc/cgo/testshared/testdata/dep2/dep2.go index c2c812adb9..94f38cf507 100644 --- a/misc/cgo/testshared/src/dep2/dep2.go +++ b/misc/cgo/testshared/testdata/dep2/dep2.go @@ -1,6 +1,6 @@ package dep2 -import "depBase" +import "testshared/depBase" var W int = 1 diff --git a/misc/cgo/testshared/src/dep3/dep3.go b/misc/cgo/testshared/testdata/dep3/dep3.go similarity index 91% rename from misc/cgo/testshared/src/dep3/dep3.go rename to misc/cgo/testshared/testdata/dep3/dep3.go index 7b7c9dac1f..6b02ad2ee5 100644 --- a/misc/cgo/testshared/src/dep3/dep3.go +++ b/misc/cgo/testshared/testdata/dep3/dep3.go @@ -7,8 +7,8 @@ package dep3 // the type data in this case and later crash. import ( - "dep2" - "depBase" + "testshared/dep2" + "testshared/depBase" ) type Dep3 struct { diff --git a/misc/cgo/testshared/src/depBase/asm.s b/misc/cgo/testshared/testdata/depBase/asm.s similarity index 100% rename from misc/cgo/testshared/src/depBase/asm.s rename to misc/cgo/testshared/testdata/depBase/asm.s diff --git a/misc/cgo/testshared/src/depBase/dep.go b/misc/cgo/testshared/testdata/depBase/dep.go similarity index 100% rename from misc/cgo/testshared/src/depBase/dep.go rename to misc/cgo/testshared/testdata/depBase/dep.go diff --git a/misc/cgo/testshared/src/depBase/gccgo.go b/misc/cgo/testshared/testdata/depBase/gccgo.go similarity index 100% rename from misc/cgo/testshared/src/depBase/gccgo.go rename to misc/cgo/testshared/testdata/depBase/gccgo.go diff --git a/misc/cgo/testshared/src/depBase/stubs.go b/misc/cgo/testshared/testdata/depBase/stubs.go similarity index 100% rename from misc/cgo/testshared/src/depBase/stubs.go rename to misc/cgo/testshared/testdata/depBase/stubs.go diff --git a/misc/cgo/testshared/src/division/division.go b/misc/cgo/testshared/testdata/division/division.go similarity index 100% rename from misc/cgo/testshared/src/division/division.go rename to misc/cgo/testshared/testdata/division/division.go diff --git a/misc/cgo/testshared/src/exe/exe.go b/misc/cgo/testshared/testdata/exe/exe.go similarity index 97% rename from misc/cgo/testshared/src/exe/exe.go rename to misc/cgo/testshared/testdata/exe/exe.go index bd864d88ad..86582581a6 100644 --- a/misc/cgo/testshared/src/exe/exe.go +++ b/misc/cgo/testshared/testdata/exe/exe.go @@ -1,7 +1,7 @@ package main import ( - "depBase" + "testshared/depBase" "os" "reflect" "runtime" diff --git a/misc/cgo/testshared/src/exe2/exe2.go b/misc/cgo/testshared/testdata/exe2/exe2.go similarity index 77% rename from misc/cgo/testshared/src/exe2/exe2.go rename to misc/cgo/testshared/testdata/exe2/exe2.go index 675fd1f365..433f331e36 100644 --- a/misc/cgo/testshared/src/exe2/exe2.go +++ b/misc/cgo/testshared/testdata/exe2/exe2.go @@ -1,6 +1,6 @@ package main -import "dep2" +import "testshared/dep2" func main() { d := &dep2.Dep2{} diff --git a/misc/cgo/testshared/src/exe3/exe3.go b/misc/cgo/testshared/testdata/exe3/exe3.go similarity index 62% rename from misc/cgo/testshared/src/exe3/exe3.go rename to misc/cgo/testshared/testdata/exe3/exe3.go index 643f2605f6..533e3a9e3d 100644 --- a/misc/cgo/testshared/src/exe3/exe3.go +++ b/misc/cgo/testshared/testdata/exe3/exe3.go @@ -1,6 +1,6 @@ package main -import "dep3" +import "testshared/dep3" func main() { dep3.D3() diff --git a/misc/cgo/testshared/src/execgo/exe.go b/misc/cgo/testshared/testdata/execgo/exe.go similarity index 100% rename from misc/cgo/testshared/src/execgo/exe.go rename to misc/cgo/testshared/testdata/execgo/exe.go diff --git a/misc/cgo/testshared/src/explicit/explicit.go b/misc/cgo/testshared/testdata/explicit/explicit.go similarity index 74% rename from misc/cgo/testshared/src/explicit/explicit.go rename to misc/cgo/testshared/testdata/explicit/explicit.go index 6a4453f775..af969fcb23 100644 --- a/misc/cgo/testshared/src/explicit/explicit.go +++ b/misc/cgo/testshared/testdata/explicit/explicit.go @@ -1,7 +1,7 @@ package explicit import ( - "implicit" + "testshared/implicit" ) func E() int { diff --git a/misc/cgo/testshared/src/global/main.go b/misc/cgo/testshared/testdata/global/main.go similarity index 98% rename from misc/cgo/testshared/src/global/main.go rename to misc/cgo/testshared/testdata/global/main.go index 94e7f247de..f43e7c3fb3 100644 --- a/misc/cgo/testshared/src/global/main.go +++ b/misc/cgo/testshared/testdata/global/main.go @@ -5,7 +5,7 @@ package main import ( - "globallib" + "testshared/globallib" ) //go:noinline diff --git a/misc/cgo/testshared/src/globallib/global.go b/misc/cgo/testshared/testdata/globallib/global.go similarity index 100% rename from misc/cgo/testshared/src/globallib/global.go rename to misc/cgo/testshared/testdata/globallib/global.go diff --git a/misc/cgo/testshared/src/iface/main.go b/misc/cgo/testshared/testdata/iface/main.go similarity index 85% rename from misc/cgo/testshared/src/iface/main.go rename to misc/cgo/testshared/testdata/iface/main.go index 3d5b54e73b..d26ebbcc9c 100644 --- a/misc/cgo/testshared/src/iface/main.go +++ b/misc/cgo/testshared/testdata/iface/main.go @@ -4,8 +4,8 @@ package main -import "iface_a" -import "iface_b" +import "testshared/iface_a" +import "testshared/iface_b" func main() { if iface_a.F() != iface_b.F() { diff --git a/misc/cgo/testshared/src/iface_a/a.go b/misc/cgo/testshared/testdata/iface_a/a.go similarity index 91% rename from misc/cgo/testshared/src/iface_a/a.go rename to misc/cgo/testshared/testdata/iface_a/a.go index e11047c166..e2cef1ecda 100644 --- a/misc/cgo/testshared/src/iface_a/a.go +++ b/misc/cgo/testshared/testdata/iface_a/a.go @@ -4,7 +4,7 @@ package iface_a -import "iface_i" +import "testshared/iface_i" //go:noinline func F() interface{} { diff --git a/misc/cgo/testshared/src/iface_b/b.go b/misc/cgo/testshared/testdata/iface_b/b.go similarity index 91% rename from misc/cgo/testshared/src/iface_b/b.go rename to misc/cgo/testshared/testdata/iface_b/b.go index 47aee2e77e..dd3e027b37 100644 --- a/misc/cgo/testshared/src/iface_b/b.go +++ b/misc/cgo/testshared/testdata/iface_b/b.go @@ -4,7 +4,7 @@ package iface_b -import "iface_i" +import "testshared/iface_i" //go:noinline func F() interface{} { diff --git a/misc/cgo/testshared/src/iface_i/i.go b/misc/cgo/testshared/testdata/iface_i/i.go similarity index 100% rename from misc/cgo/testshared/src/iface_i/i.go rename to misc/cgo/testshared/testdata/iface_i/i.go diff --git a/misc/cgo/testshared/src/implicit/implicit.go b/misc/cgo/testshared/testdata/implicit/implicit.go similarity index 100% rename from misc/cgo/testshared/src/implicit/implicit.go rename to misc/cgo/testshared/testdata/implicit/implicit.go diff --git a/misc/cgo/testshared/src/implicitcmd/implicitcmd.go b/misc/cgo/testshared/testdata/implicitcmd/implicitcmd.go similarity index 63% rename from misc/cgo/testshared/src/implicitcmd/implicitcmd.go rename to misc/cgo/testshared/testdata/implicitcmd/implicitcmd.go index f6112933e5..4d4296738e 100644 --- a/misc/cgo/testshared/src/implicitcmd/implicitcmd.go +++ b/misc/cgo/testshared/testdata/implicitcmd/implicitcmd.go @@ -1,8 +1,8 @@ package main import ( - "explicit" - "implicit" + "testshared/explicit" + "testshared/implicit" ) func main() { diff --git a/misc/cgo/testshared/src/issue25065/a.go b/misc/cgo/testshared/testdata/issue25065/a.go similarity index 100% rename from misc/cgo/testshared/src/issue25065/a.go rename to misc/cgo/testshared/testdata/issue25065/a.go diff --git a/misc/cgo/testshared/src/trivial/trivial.go b/misc/cgo/testshared/testdata/trivial/trivial.go similarity index 100% rename from misc/cgo/testshared/src/trivial/trivial.go rename to misc/cgo/testshared/testdata/trivial/trivial.go diff --git a/misc/cgo/testso/noso_test.go b/misc/cgo/testso/noso_test.go new file mode 100644 index 0000000000..c88aebfb02 --- /dev/null +++ b/misc/cgo/testso/noso_test.go @@ -0,0 +1,9 @@ +// 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 !cgo + +package so_test + +// Nothing to test. diff --git a/misc/cgo/testso/overlaydir_test.go b/misc/cgo/testso/overlaydir_test.go new file mode 100644 index 0000000000..10c874d925 --- /dev/null +++ b/misc/cgo/testso/overlaydir_test.go @@ -0,0 +1,81 @@ +// 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. + +package so_test + +import ( + "io" + "os" + "path/filepath" + "strings" +) + +// overlayDir makes a minimal-overhead copy of srcRoot in which new files may be added. +// +// TODO: Once we no longer need to support the misc module in GOPATH mode, +// factor this function out into a package to reduce duplication. +func overlayDir(dstRoot, srcRoot string) error { + dstRoot = filepath.Clean(dstRoot) + if err := os.MkdirAll(dstRoot, 0777); err != nil { + return err + } + + symBase, err := filepath.Rel(srcRoot, dstRoot) + if err != nil { + symBase, err = filepath.Abs(srcRoot) + if err != nil { + return err + } + } + + return filepath.Walk(srcRoot, func(srcPath string, info os.FileInfo, err error) error { + if err != nil || srcPath == srcRoot { + return err + } + + suffix := strings.TrimPrefix(srcPath, srcRoot) + for len(suffix) > 0 && suffix[0] == filepath.Separator { + suffix = suffix[1:] + } + dstPath := filepath.Join(dstRoot, suffix) + + perm := info.Mode() & os.ModePerm + if info.Mode()&os.ModeSymlink != 0 { + info, err = os.Stat(srcPath) + if err != nil { + return err + } + perm = info.Mode() & os.ModePerm + } + + // Always copy directories (don't symlink them). + // If we add a file in the overlay, we don't want to add it in the original. + if info.IsDir() { + return os.Mkdir(dstPath, perm) + } + + // If the OS supports symlinks, use them instead of copying bytes. + if err := os.Symlink(filepath.Join(symBase, suffix), dstPath); err == nil { + return nil + } + + // Otherwise, copy the bytes. + src, err := os.Open(srcPath) + if err != nil { + return err + } + defer src.Close() + + dst, err := os.OpenFile(dstPath, os.O_WRONLY|os.O_CREATE|os.O_EXCL, perm) + if err != nil { + return err + } + + _, err = io.Copy(dst, src) + if closeErr := dst.Close(); err == nil { + err = closeErr + } + return err + }) +} diff --git a/misc/cgo/testso/so_test.go b/misc/cgo/testso/so_test.go new file mode 100644 index 0000000000..500b08fae8 --- /dev/null +++ b/misc/cgo/testso/so_test.go @@ -0,0 +1,126 @@ +// 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 cgo + +package so_test + +import ( + "io/ioutil" + "log" + "os" + "os/exec" + "path/filepath" + "runtime" + "strings" + "testing" +) + +func requireTestSOSupported(t *testing.T) { + t.Helper() + switch runtime.GOARCH { + case "arm", "arm64": + if runtime.GOOS == "darwin" { + t.Skip("No exec facility on iOS.") + } + case "ppc64": + t.Skip("External linking not implemented on ppc64 (issue #8912).") + case "mips64le", "mips64": + t.Skip("External linking not implemented on mips64.") + } + if runtime.GOOS == "android" { + t.Skip("No exec facility on Android.") + } +} + +func TestSO(t *testing.T) { + requireTestSOSupported(t) + + GOPATH, err := ioutil.TempDir("", "cgosotest") + if err != nil { + log.Fatal(err) + } + defer os.RemoveAll(GOPATH) + + modRoot := filepath.Join(GOPATH, "src", "cgosotest") + if err := overlayDir(modRoot, "testdata"); err != nil { + log.Panic(err) + } + if err := ioutil.WriteFile(filepath.Join(modRoot, "go.mod"), []byte("module cgosotest\n"), 0666); err != nil { + log.Panic(err) + } + + cmd := exec.Command("go", "env", "CC", "GOGCCFLAGS") + cmd.Dir = modRoot + cmd.Stderr = new(strings.Builder) + cmd.Env = append(os.Environ(), "GOPATH="+GOPATH) + out, err := cmd.Output() + if err != nil { + t.Fatalf("%s: %v\n%s", strings.Join(cmd.Args, " "), err, cmd.Stderr) + } + lines := strings.Split(string(out), "\n") + if len(lines) != 3 || lines[2] != "" { + t.Fatalf("Unexpected output from %s:\n%s", strings.Join(cmd.Args, " "), lines) + } + + cc := lines[0] + if cc == "" { + t.Fatal("CC environment variable (go env CC) cannot be empty") + } + gogccflags := strings.Split(lines[1], " ") + + // build shared object + ext := "so" + args := append(gogccflags, "-shared") + switch runtime.GOOS { + case "darwin": + ext = "dylib" + args = append(args, "-undefined", "suppress", "-flat_namespace") + case "windows": + ext = "dll" + args = append(args, "-DEXPORT_DLL") + } + sofname := "libcgosotest." + ext + args = append(args, "-o", sofname, "cgoso_c.c") + + cmd = exec.Command(cc, args...) + cmd.Dir = modRoot + cmd.Env = append(os.Environ(), "GOPATH="+GOPATH) + out, err = cmd.CombinedOutput() + if err != nil { + t.Fatalf("%s: %s\n%s", strings.Join(cmd.Args, " "), err, out) + } + t.Logf("%s:\n%s", strings.Join(cmd.Args, " "), out) + + cmd = exec.Command("go", "build", "-o", "main.exe", "main.go") + cmd.Dir = modRoot + cmd.Env = append(os.Environ(), "GOPATH="+GOPATH) + out, err = cmd.CombinedOutput() + if err != nil { + t.Fatalf("%s: %s\n%s", strings.Join(cmd.Args, " "), err, out) + } + t.Logf("%s:\n%s", strings.Join(cmd.Args, " "), out) + + cmd = exec.Command("./main.exe") + cmd.Dir = modRoot + cmd.Env = append(os.Environ(), "GOPATH="+GOPATH) + if runtime.GOOS != "windows" { + s := "LD_LIBRARY_PATH" + if runtime.GOOS == "darwin" { + s = "DYLD_LIBRARY_PATH" + } + cmd.Env = append(os.Environ(), s+"=.") + + // On FreeBSD 64-bit architectures, the 32-bit linker looks for + // different environment variables. + if runtime.GOOS == "freebsd" && runtime.GOARCH == "386" { + cmd.Env = append(cmd.Env, "LD_32_LIBRARY_PATH=.") + } + } + out, err = cmd.CombinedOutput() + if err != nil { + t.Fatalf("%s: %s\n%s", strings.Join(cmd.Args, " "), err, out) + } + t.Logf("%s:\n%s", strings.Join(cmd.Args, " "), out) +} diff --git a/misc/cgo/testso/cgoso.c b/misc/cgo/testso/testdata/cgoso.c similarity index 100% rename from misc/cgo/testso/cgoso.c rename to misc/cgo/testso/testdata/cgoso.c diff --git a/misc/cgo/testso/cgoso.go b/misc/cgo/testso/testdata/cgoso.go similarity index 100% rename from misc/cgo/testso/cgoso.go rename to misc/cgo/testso/testdata/cgoso.go diff --git a/misc/cgo/testso/cgoso_c.c b/misc/cgo/testso/testdata/cgoso_c.c similarity index 100% rename from misc/cgo/testso/cgoso_c.c rename to misc/cgo/testso/testdata/cgoso_c.c diff --git a/misc/cgo/testso/cgoso_unix.go b/misc/cgo/testso/testdata/cgoso_unix.go similarity index 100% rename from misc/cgo/testso/cgoso_unix.go rename to misc/cgo/testso/testdata/cgoso_unix.go diff --git a/misc/cgo/testso/main.go b/misc/cgo/testso/testdata/main.go similarity index 92% rename from misc/cgo/testso/main.go rename to misc/cgo/testso/testdata/main.go index 88aa4322d2..963d45121e 100644 --- a/misc/cgo/testso/main.go +++ b/misc/cgo/testso/testdata/main.go @@ -6,7 +6,7 @@ package main -import "." +import "cgosotest" func main() { cgosotest.Test() diff --git a/misc/cgo/testsovar/noso_test.go b/misc/cgo/testsovar/noso_test.go new file mode 100644 index 0000000000..c88aebfb02 --- /dev/null +++ b/misc/cgo/testsovar/noso_test.go @@ -0,0 +1,9 @@ +// 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 !cgo + +package so_test + +// Nothing to test. diff --git a/misc/cgo/testsovar/overlaydir_test.go b/misc/cgo/testsovar/overlaydir_test.go new file mode 100644 index 0000000000..10c874d925 --- /dev/null +++ b/misc/cgo/testsovar/overlaydir_test.go @@ -0,0 +1,81 @@ +// 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. + +package so_test + +import ( + "io" + "os" + "path/filepath" + "strings" +) + +// overlayDir makes a minimal-overhead copy of srcRoot in which new files may be added. +// +// TODO: Once we no longer need to support the misc module in GOPATH mode, +// factor this function out into a package to reduce duplication. +func overlayDir(dstRoot, srcRoot string) error { + dstRoot = filepath.Clean(dstRoot) + if err := os.MkdirAll(dstRoot, 0777); err != nil { + return err + } + + symBase, err := filepath.Rel(srcRoot, dstRoot) + if err != nil { + symBase, err = filepath.Abs(srcRoot) + if err != nil { + return err + } + } + + return filepath.Walk(srcRoot, func(srcPath string, info os.FileInfo, err error) error { + if err != nil || srcPath == srcRoot { + return err + } + + suffix := strings.TrimPrefix(srcPath, srcRoot) + for len(suffix) > 0 && suffix[0] == filepath.Separator { + suffix = suffix[1:] + } + dstPath := filepath.Join(dstRoot, suffix) + + perm := info.Mode() & os.ModePerm + if info.Mode()&os.ModeSymlink != 0 { + info, err = os.Stat(srcPath) + if err != nil { + return err + } + perm = info.Mode() & os.ModePerm + } + + // Always copy directories (don't symlink them). + // If we add a file in the overlay, we don't want to add it in the original. + if info.IsDir() { + return os.Mkdir(dstPath, perm) + } + + // If the OS supports symlinks, use them instead of copying bytes. + if err := os.Symlink(filepath.Join(symBase, suffix), dstPath); err == nil { + return nil + } + + // Otherwise, copy the bytes. + src, err := os.Open(srcPath) + if err != nil { + return err + } + defer src.Close() + + dst, err := os.OpenFile(dstPath, os.O_WRONLY|os.O_CREATE|os.O_EXCL, perm) + if err != nil { + return err + } + + _, err = io.Copy(dst, src) + if closeErr := dst.Close(); err == nil { + err = closeErr + } + return err + }) +} diff --git a/misc/cgo/testsovar/so_test.go b/misc/cgo/testsovar/so_test.go new file mode 100644 index 0000000000..500b08fae8 --- /dev/null +++ b/misc/cgo/testsovar/so_test.go @@ -0,0 +1,126 @@ +// 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 cgo + +package so_test + +import ( + "io/ioutil" + "log" + "os" + "os/exec" + "path/filepath" + "runtime" + "strings" + "testing" +) + +func requireTestSOSupported(t *testing.T) { + t.Helper() + switch runtime.GOARCH { + case "arm", "arm64": + if runtime.GOOS == "darwin" { + t.Skip("No exec facility on iOS.") + } + case "ppc64": + t.Skip("External linking not implemented on ppc64 (issue #8912).") + case "mips64le", "mips64": + t.Skip("External linking not implemented on mips64.") + } + if runtime.GOOS == "android" { + t.Skip("No exec facility on Android.") + } +} + +func TestSO(t *testing.T) { + requireTestSOSupported(t) + + GOPATH, err := ioutil.TempDir("", "cgosotest") + if err != nil { + log.Fatal(err) + } + defer os.RemoveAll(GOPATH) + + modRoot := filepath.Join(GOPATH, "src", "cgosotest") + if err := overlayDir(modRoot, "testdata"); err != nil { + log.Panic(err) + } + if err := ioutil.WriteFile(filepath.Join(modRoot, "go.mod"), []byte("module cgosotest\n"), 0666); err != nil { + log.Panic(err) + } + + cmd := exec.Command("go", "env", "CC", "GOGCCFLAGS") + cmd.Dir = modRoot + cmd.Stderr = new(strings.Builder) + cmd.Env = append(os.Environ(), "GOPATH="+GOPATH) + out, err := cmd.Output() + if err != nil { + t.Fatalf("%s: %v\n%s", strings.Join(cmd.Args, " "), err, cmd.Stderr) + } + lines := strings.Split(string(out), "\n") + if len(lines) != 3 || lines[2] != "" { + t.Fatalf("Unexpected output from %s:\n%s", strings.Join(cmd.Args, " "), lines) + } + + cc := lines[0] + if cc == "" { + t.Fatal("CC environment variable (go env CC) cannot be empty") + } + gogccflags := strings.Split(lines[1], " ") + + // build shared object + ext := "so" + args := append(gogccflags, "-shared") + switch runtime.GOOS { + case "darwin": + ext = "dylib" + args = append(args, "-undefined", "suppress", "-flat_namespace") + case "windows": + ext = "dll" + args = append(args, "-DEXPORT_DLL") + } + sofname := "libcgosotest." + ext + args = append(args, "-o", sofname, "cgoso_c.c") + + cmd = exec.Command(cc, args...) + cmd.Dir = modRoot + cmd.Env = append(os.Environ(), "GOPATH="+GOPATH) + out, err = cmd.CombinedOutput() + if err != nil { + t.Fatalf("%s: %s\n%s", strings.Join(cmd.Args, " "), err, out) + } + t.Logf("%s:\n%s", strings.Join(cmd.Args, " "), out) + + cmd = exec.Command("go", "build", "-o", "main.exe", "main.go") + cmd.Dir = modRoot + cmd.Env = append(os.Environ(), "GOPATH="+GOPATH) + out, err = cmd.CombinedOutput() + if err != nil { + t.Fatalf("%s: %s\n%s", strings.Join(cmd.Args, " "), err, out) + } + t.Logf("%s:\n%s", strings.Join(cmd.Args, " "), out) + + cmd = exec.Command("./main.exe") + cmd.Dir = modRoot + cmd.Env = append(os.Environ(), "GOPATH="+GOPATH) + if runtime.GOOS != "windows" { + s := "LD_LIBRARY_PATH" + if runtime.GOOS == "darwin" { + s = "DYLD_LIBRARY_PATH" + } + cmd.Env = append(os.Environ(), s+"=.") + + // On FreeBSD 64-bit architectures, the 32-bit linker looks for + // different environment variables. + if runtime.GOOS == "freebsd" && runtime.GOARCH == "386" { + cmd.Env = append(cmd.Env, "LD_32_LIBRARY_PATH=.") + } + } + out, err = cmd.CombinedOutput() + if err != nil { + t.Fatalf("%s: %s\n%s", strings.Join(cmd.Args, " "), err, out) + } + t.Logf("%s:\n%s", strings.Join(cmd.Args, " "), out) +} diff --git a/misc/cgo/testsovar/cgoso.go b/misc/cgo/testsovar/testdata/cgoso.go similarity index 100% rename from misc/cgo/testsovar/cgoso.go rename to misc/cgo/testsovar/testdata/cgoso.go diff --git a/misc/cgo/testsovar/cgoso_c.c b/misc/cgo/testsovar/testdata/cgoso_c.c similarity index 100% rename from misc/cgo/testsovar/cgoso_c.c rename to misc/cgo/testsovar/testdata/cgoso_c.c diff --git a/misc/cgo/testsovar/cgoso_c.h b/misc/cgo/testsovar/testdata/cgoso_c.h similarity index 100% rename from misc/cgo/testsovar/cgoso_c.h rename to misc/cgo/testsovar/testdata/cgoso_c.h diff --git a/misc/cgo/testsovar/main.go b/misc/cgo/testsovar/testdata/main.go similarity index 92% rename from misc/cgo/testsovar/main.go rename to misc/cgo/testsovar/testdata/main.go index 9c8a1c4e66..87b52cef60 100644 --- a/misc/cgo/testsovar/main.go +++ b/misc/cgo/testsovar/testdata/main.go @@ -6,7 +6,7 @@ package main -import "." +import "cgosotest" func main() { cgosotest.Test() diff --git a/src/androidtest.bash b/src/androidtest.bash index e43b89c0dc..ba776d2278 100755 --- a/src/androidtest.bash +++ b/src/androidtest.bash @@ -4,8 +4,6 @@ # license that can be found in the LICENSE file. # For testing Android. -# The compiler runs locally, then a copy of the GOROOT is pushed to a -# target device using adb, and the tests are run there. set -e ulimit -c 0 # no core files @@ -31,58 +29,9 @@ fi export CGO_ENABLED=1 unset GOBIN -# Do the build first, so we can build go_android_exec and cleaner. -# Also lets us fail early before the (slow) adb push if the build is broken. -. ./make.bash --no-banner export GOROOT=$(dirname $(pwd)) +# Put the exec wrapper into PATH export PATH=$GOROOT/bin:$PATH -GOOS=$GOHOSTOS GOARCH=$GOHOSTARCH go build \ - -o ../bin/go_android_${GOARCH}_exec \ - ../misc/android/go_android_exec.go - -export pkgdir=$(dirname $(go list -f '{{.Target}}' runtime)) -if [ "$pkgdir" = "" ]; then - echo "could not find android pkg dir" 1>&2 - exit 1 -fi - -export ANDROID_TEST_DIR=/tmp/androidtest-$$ - -function cleanup() { - rm -rf ${ANDROID_TEST_DIR} -} -trap cleanup EXIT - -# Push GOROOT to target device. -# -# The adb sync command will sync either the /system or /data -# directories of an android device from a similar directory -# on the host. We copy the files required for running tests under -# /data/local/tmp/goroot. The adb sync command does not follow -# symlinks so we have to copy. -export ANDROID_PRODUCT_OUT="${ANDROID_TEST_DIR}/out" -FAKE_GOROOT=$ANDROID_PRODUCT_OUT/data/local/tmp/goroot -mkdir -p $FAKE_GOROOT -mkdir -p $FAKE_GOROOT/pkg -cp -a "${GOROOT}/src" "${FAKE_GOROOT}/" -cp -a "${GOROOT}/test" "${FAKE_GOROOT}/" -cp -a "${GOROOT}/lib" "${FAKE_GOROOT}/" -cp -a "${pkgdir}" "${FAKE_GOROOT}/pkg/" - -echo '# Syncing test files to android device' -adb $GOANDROID_ADB_FLAGS shell mkdir -p /data/local/tmp/goroot -time adb $GOANDROID_ADB_FLAGS sync data &> /dev/null - -export CLEANER=${ANDROID_TEST_DIR}/androidcleaner-$$ -cp ../misc/android/cleaner.go $CLEANER.go -echo 'var files = `' >> $CLEANER.go -(cd $ANDROID_PRODUCT_OUT/data/local/tmp/goroot; find . >> $CLEANER.go) -echo '`' >> $CLEANER.go -go build -o $CLEANER $CLEANER.go -adb $GOANDROID_ADB_FLAGS push $CLEANER /data/local/tmp/cleaner -adb $GOANDROID_ADB_FLAGS shell /data/local/tmp/cleaner - -echo '' # Run standard tests. -bash run.bash --no-rebuild +bash all.bash diff --git a/src/archive/tar/strconv.go b/src/archive/tar/strconv.go index d144485a49..0a910f33b9 100644 --- a/src/archive/tar/strconv.go +++ b/src/archive/tar/strconv.go @@ -244,7 +244,7 @@ func formatPAXTime(ts time.Time) (s string) { if secs < 0 { sign = "-" // Remember sign secs = -(secs + 1) // Add a second to secs - nsecs = -(nsecs - 1E9) // Take that second away from nsecs + nsecs = -(nsecs - 1e9) // Take that second away from nsecs } return strings.TrimRight(fmt.Sprintf("%s%d.%09d", sign, secs, nsecs), "0") } diff --git a/src/archive/tar/strconv_test.go b/src/archive/tar/strconv_test.go index 4cc388cb0f..dd3505a758 100644 --- a/src/archive/tar/strconv_test.go +++ b/src/archive/tar/strconv_test.go @@ -303,27 +303,27 @@ func TestFormatPAXTime(t *testing.T) { {1350244992, 300000000, "1350244992.3"}, {1350244992, 23960100, "1350244992.0239601"}, {1350244992, 23960108, "1350244992.023960108"}, - {+1, +1E9 - 1E0, "1.999999999"}, - {+1, +1E9 - 1E3, "1.999999"}, - {+1, +1E9 - 1E6, "1.999"}, - {+1, +0E0 - 0E0, "1"}, - {+1, +1E6 - 0E0, "1.001"}, - {+1, +1E3 - 0E0, "1.000001"}, - {+1, +1E0 - 0E0, "1.000000001"}, - {0, 1E9 - 1E0, "0.999999999"}, - {0, 1E9 - 1E3, "0.999999"}, - {0, 1E9 - 1E6, "0.999"}, - {0, 0E0, "0"}, - {0, 1E6 + 0E0, "0.001"}, - {0, 1E3 + 0E0, "0.000001"}, - {0, 1E0 + 0E0, "0.000000001"}, - {-1, -1E9 + 1E0, "-1.999999999"}, - {-1, -1E9 + 1E3, "-1.999999"}, - {-1, -1E9 + 1E6, "-1.999"}, - {-1, -0E0 + 0E0, "-1"}, - {-1, -1E6 + 0E0, "-1.001"}, - {-1, -1E3 + 0E0, "-1.000001"}, - {-1, -1E0 + 0E0, "-1.000000001"}, + {+1, +1e9 - 1e0, "1.999999999"}, + {+1, +1e9 - 1e3, "1.999999"}, + {+1, +1e9 - 1e6, "1.999"}, + {+1, +0e0 - 0e0, "1"}, + {+1, +1e6 - 0e0, "1.001"}, + {+1, +1e3 - 0e0, "1.000001"}, + {+1, +1e0 - 0e0, "1.000000001"}, + {0, 1e9 - 1e0, "0.999999999"}, + {0, 1e9 - 1e3, "0.999999"}, + {0, 1e9 - 1e6, "0.999"}, + {0, 0e0, "0"}, + {0, 1e6 + 0e0, "0.001"}, + {0, 1e3 + 0e0, "0.000001"}, + {0, 1e0 + 0e0, "0.000000001"}, + {-1, -1e9 + 1e0, "-1.999999999"}, + {-1, -1e9 + 1e3, "-1.999999"}, + {-1, -1e9 + 1e6, "-1.999"}, + {-1, -0e0 + 0e0, "-1"}, + {-1, -1e6 + 0e0, "-1.001"}, + {-1, -1e3 + 0e0, "-1.000001"}, + {-1, -1e0 + 0e0, "-1.000000001"}, {-1350244992, 0, "-1350244992"}, {-1350244992, -300000000, "-1350244992.3"}, {-1350244992, -23960100, "-1350244992.0239601"}, diff --git a/src/bytes/buffer.go b/src/bytes/buffer.go index aff2db5084..190c468162 100644 --- a/src/bytes/buffer.go +++ b/src/bytes/buffer.go @@ -385,13 +385,15 @@ func (b *Buffer) UnreadRune() error { return nil } +var errUnreadByte = errors.New("bytes.Buffer: UnreadByte: previous operation was not a successful read") + // UnreadByte unreads the last byte returned by the most recent successful // read operation that read at least one byte. If a write has happened since // the last read, if the last read returned an error, or if the read read zero // bytes, UnreadByte returns an error. func (b *Buffer) UnreadByte() error { if b.lastRead == opInvalid { - return errors.New("bytes.Buffer: UnreadByte: previous operation was not a successful read") + return errUnreadByte } b.lastRead = opInvalid if b.off > 0 { diff --git a/src/bytes/buffer_test.go b/src/bytes/buffer_test.go index 6e9d6952a5..7626d277d4 100644 --- a/src/bytes/buffer_test.go +++ b/src/bytes/buffer_test.go @@ -131,11 +131,8 @@ func TestBasicOperations(t *testing.T) { check(t, "TestBasicOperations (3)", &buf, "") n, err := buf.Write(testBytes[0:1]) - if n != 1 { - t.Errorf("wrote 1 byte, but n == %d", n) - } - if err != nil { - t.Errorf("err should always be nil, but err == %s", err) + if want := 1; err != nil || n != want { + t.Errorf("Write: got (%d, %v), want (%d, %v)", n, err, want, nil) } check(t, "TestBasicOperations (4)", &buf, "a") @@ -143,8 +140,8 @@ func TestBasicOperations(t *testing.T) { check(t, "TestBasicOperations (5)", &buf, "ab") n, err = buf.Write(testBytes[2:26]) - if n != 24 { - t.Errorf("wrote 24 bytes, but n == %d", n) + if want := 24; err != nil || n != want { + t.Errorf("Write: got (%d, %v), want (%d, %v)", n, err, want, nil) } check(t, "TestBasicOperations (6)", &buf, testString[0:26]) @@ -159,15 +156,12 @@ func TestBasicOperations(t *testing.T) { buf.WriteByte(testString[1]) c, err := buf.ReadByte() - if err != nil { - t.Error("ReadByte unexpected eof") - } - if c != testString[1] { - t.Errorf("ReadByte wrong value c=%v", c) + if want := testString[1]; err != nil || c != want { + t.Errorf("ReadByte: got (%q, %v), want (%q, %v)", c, err, want, nil) } c, err = buf.ReadByte() - if err == nil { - t.Error("ReadByte unexpected not eof") + if err != io.EOF { + t.Errorf("ReadByte: got (%q, %v), want (%q, %v)", c, err, byte(0), io.EOF) } } } diff --git a/src/cmd/asm/internal/asm/asm.go b/src/cmd/asm/internal/asm/asm.go index 5da64f135a..3d99af6889 100644 --- a/src/cmd/asm/internal/asm/asm.go +++ b/src/cmd/asm/internal/asm/asm.go @@ -7,6 +7,7 @@ package asm import ( "bytes" "fmt" + "strconv" "text/scanner" "cmd/asm/internal/arch" @@ -200,7 +201,11 @@ func (p *Parser) asmData(operands [][]lex.Token) { p.errorf("expect /size for DATA argument") return } - scale := p.parseScale(op[n-1].String()) + szop := op[n-1].String() + sz, err := strconv.Atoi(szop) + if err != nil { + p.errorf("bad size for DATA argument: %q", szop) + } op = op[:n-2] nameAddr := p.address(op) if !p.validSymbol("DATA", &nameAddr, true) { @@ -223,24 +228,33 @@ func (p *Parser) asmData(operands [][]lex.Token) { p.errorf("overlapping DATA entry for %s", name) return } - p.dataAddr[name] = nameAddr.Offset + int64(scale) + p.dataAddr[name] = nameAddr.Offset + int64(sz) switch valueAddr.Type { case obj.TYPE_CONST: - nameAddr.Sym.WriteInt(p.ctxt, nameAddr.Offset, int(scale), valueAddr.Offset) + switch sz { + case 1, 2, 4, 8: + nameAddr.Sym.WriteInt(p.ctxt, nameAddr.Offset, int(sz), valueAddr.Offset) + default: + p.errorf("bad int size for DATA argument: %d", sz) + } case obj.TYPE_FCONST: - switch scale { + switch sz { case 4: nameAddr.Sym.WriteFloat32(p.ctxt, nameAddr.Offset, float32(valueAddr.Val.(float64))) case 8: nameAddr.Sym.WriteFloat64(p.ctxt, nameAddr.Offset, valueAddr.Val.(float64)) default: - panic("bad float scale") + p.errorf("bad float size for DATA argument: %d", sz) } case obj.TYPE_SCONST: - nameAddr.Sym.WriteString(p.ctxt, nameAddr.Offset, int(scale), valueAddr.Val.(string)) + nameAddr.Sym.WriteString(p.ctxt, nameAddr.Offset, int(sz), valueAddr.Val.(string)) case obj.TYPE_ADDR: - nameAddr.Sym.WriteAddr(p.ctxt, nameAddr.Offset, int(scale), valueAddr.Sym, valueAddr.Offset) + if sz == p.arch.PtrSize { + nameAddr.Sym.WriteAddr(p.ctxt, nameAddr.Offset, int(sz), valueAddr.Sym, valueAddr.Offset) + } else { + p.errorf("bad addr size for DATA argument: %d", sz) + } } } diff --git a/src/cmd/asm/internal/asm/pseudo_test.go b/src/cmd/asm/internal/asm/pseudo_test.go index 52c98b4056..100bef91cf 100644 --- a/src/cmd/asm/internal/asm/pseudo_test.go +++ b/src/cmd/asm/internal/asm/pseudo_test.go @@ -43,6 +43,13 @@ func TestErroneous(t *testing.T) { {"DATA", "0", "expect two operands for DATA"}, {"DATA", "(0), 1", "expect /size for DATA argument"}, {"DATA", "@B(SB)/4,0", "expected '(', found B"}, // Issue 23580. + {"DATA", "·A(SB)/4,0", "DATA value must be an immediate constant or address"}, + {"DATA", "·B(SB)/4,$0", ""}, + {"DATA", "·C(SB)/5,$0", "bad int size for DATA argument: 5"}, + {"DATA", "·D(SB)/5,$0.0", "bad float size for DATA argument: 5"}, + {"DATA", "·E(SB)/4,$·A(SB)", "bad addr size for DATA argument: 4"}, + {"DATA", "·F(SB)/8,$·A(SB)", ""}, + {"DATA", "·G(SB)/5,$\"abcde\"", ""}, {"GLOBL", "", "expect two or three operands for GLOBL"}, {"GLOBL", "0,1", "GLOBL symbol \"binsubdirectory of your Go root (for example,c:\Go\bin) to yourPATHenvironment variable.\" must be a symbol(SB)"}, {"GLOBL", "@B(SB), 0", "expected '(', found B"}, // Issue 23580. diff --git a/src/cmd/asm/internal/asm/testdata/arm64.s b/src/cmd/asm/internal/asm/testdata/arm64.s index d025543e6d..b54fd86045 100644 --- a/src/cmd/asm/internal/asm/testdata/arm64.s +++ b/src/cmd/asm/internal/asm/testdata/arm64.s @@ -261,6 +261,18 @@ TEXT foo(SB), DUPOK|NOSPLIT, $-8 ORRW $0x1b000, R2, R3 // ORRW $110592, R2, R3 // 1b0096523b00a07243001b2a TSTW $0x500000, R1 // TSTW $5242880, R1 // 1b0aa0523f001b6a TSTW $0xff00ff, R1 // TSTW $16711935, R1 // 3f9c0072 + TSTW $0x60060, R5 // TSTW $393312, R5 // 1b0c8052db00a072bf001b6a + TSTW $0x6006000060060, R5 // TSTW $1689262177517664, R5 // 1b0c8052db00a072bf001b6a + ANDW $0x6006000060060, R5 // ANDW $1689262177517664, R5 // 1b0c8052db00a072a5001b0a + ANDSW $0x6006000060060, R5 // ANDSW $1689262177517664, R5 // 1b0c8052db00a072a5001b6a + EORW $0x6006000060060, R5 // EORW $1689262177517664, R5 // 1b0c8052db00a072a5001b4a + ORRW $0x6006000060060, R5 // ORRW $1689262177517664, R5 // 1b0c8052db00a072a5001b2a + BICW $0x6006000060060, R5 // BICW $1689262177517664, R5 // 1b0c8052db00a072a5003b0a + EONW $0x6006000060060, R5 // EONW $1689262177517664, R5 // 1b0c8052db00a072a5003b4a + ORNW $0x6006000060060, R5 // ORNW $1689262177517664, R5 // 1b0c8052db00a072a5003b2a + BICSW $0x6006000060060, R5 // BICSW $1689262177517664, R5 // 1b0c8052db00a072a5003b6a + ADDW $0x60060, R2 // ADDW $393312, R2 // 4280011142804111 + CMPW $0x60060, R2 // CMPW $393312, R2 // 1b0c8052db00a0725f001b6b AND $8, R0, RSP // 1f007d92 ORR $8, R0, RSP // 1f007db2 diff --git a/src/cmd/compile/fmtmap_test.go b/src/cmd/compile/fmtmap_test.go index 81ba20ff0f..018447efa1 100644 --- a/src/cmd/compile/fmtmap_test.go +++ b/src/cmd/compile/fmtmap_test.go @@ -81,6 +81,7 @@ var knownFormats = map[string]string{ "bool %v": "", "byte %08b": "", "byte %c": "", + "byte %q": "", "byte %v": "", "cmd/compile/internal/arm.shift %d": "", "cmd/compile/internal/gc.Class %d": "", @@ -124,6 +125,7 @@ var knownFormats = map[string]string{ "cmd/compile/internal/ssa.relation %s": "", "cmd/compile/internal/syntax.Error %q": "", "cmd/compile/internal/syntax.Expr %#v": "", + "cmd/compile/internal/syntax.LitKind %d": "", "cmd/compile/internal/syntax.Node %T": "", "cmd/compile/internal/syntax.Operator %s": "", "cmd/compile/internal/syntax.Pos %s": "", @@ -175,6 +177,7 @@ var knownFormats = map[string]string{ "reflect.Type %s": "", "rune %#U": "", "rune %c": "", + "rune %q": "", "string %-*s": "", "string %-16s": "", "string %-6s": "", diff --git a/src/cmd/compile/internal/amd64/galign.go b/src/cmd/compile/internal/amd64/galign.go index 58c469995f..f6bb961c29 100644 --- a/src/cmd/compile/internal/amd64/galign.go +++ b/src/cmd/compile/internal/amd64/galign.go @@ -24,6 +24,7 @@ func Init(arch *gc.Arch) { arch.ZeroRange = zerorange arch.ZeroAuto = zeroAuto arch.Ginsnop = ginsnop + arch.Ginsnopdefer = ginsnop arch.SSAMarkMoves = ssaMarkMoves arch.SSAGenValue = ssaGenValue diff --git a/src/cmd/compile/internal/amd64/ggen.go b/src/cmd/compile/internal/amd64/ggen.go index ee4f872bd8..bd2c6720d3 100644 --- a/src/cmd/compile/internal/amd64/ggen.go +++ b/src/cmd/compile/internal/amd64/ggen.go @@ -142,9 +142,12 @@ func zeroAuto(pp *gc.Progs, n *gc.Node) { } func ginsnop(pp *gc.Progs) *obj.Prog { - // This is actually not the x86 NOP anymore, - // but at the point where it gets used, AX is dead - // so it's okay if we lose the high bits. + // This is a hardware nop (1-byte 0x90) instruction, + // even though we describe it as an explicit XCHGL here. + // Particularly, this does not zero the high 32 bits + // like typical *L opcodes. + // (gas assembles "xchg %eax,%eax" to 0x87 0xc0, which + // does zero the high 32 bits.) p := pp.Prog(x86.AXCHGL) p.From.Type = obj.TYPE_REG p.From.Reg = x86.REG_AX diff --git a/src/cmd/compile/internal/arm/galign.go b/src/cmd/compile/internal/arm/galign.go index 241edaf3a0..8469dbdd73 100644 --- a/src/cmd/compile/internal/arm/galign.go +++ b/src/cmd/compile/internal/arm/galign.go @@ -19,6 +19,7 @@ func Init(arch *gc.Arch) { arch.ZeroRange = zerorange arch.ZeroAuto = zeroAuto arch.Ginsnop = ginsnop + arch.Ginsnopdefer = ginsnop arch.SSAMarkMoves = func(s *gc.SSAGenState, b *ssa.Block) {} arch.SSAGenValue = ssaGenValue diff --git a/src/cmd/compile/internal/arm64/galign.go b/src/cmd/compile/internal/arm64/galign.go index a64be8e7a6..f01fe8a571 100644 --- a/src/cmd/compile/internal/arm64/galign.go +++ b/src/cmd/compile/internal/arm64/galign.go @@ -19,6 +19,7 @@ func Init(arch *gc.Arch) { arch.ZeroRange = zerorange arch.ZeroAuto = zeroAuto arch.Ginsnop = ginsnop + arch.Ginsnopdefer = ginsnop arch.SSAMarkMoves = func(s *gc.SSAGenState, b *ssa.Block) {} arch.SSAGenValue = ssaGenValue diff --git a/src/cmd/compile/internal/gc/builtin.go b/src/cmd/compile/internal/gc/builtin.go index 04f4cbfd58..f32fcd675d 100644 --- a/src/cmd/compile/internal/gc/builtin.go +++ b/src/cmd/compile/internal/gc/builtin.go @@ -13,6 +13,7 @@ var runtimeDecls = [...]struct { {"panicindex", funcTag, 5}, {"panicslice", funcTag, 5}, {"panicdivide", funcTag, 5}, + {"panicshift", funcTag, 5}, {"panicmakeslicelen", funcTag, 5}, {"throwinit", funcTag, 5}, {"panicwrap", funcTag, 5}, diff --git a/src/cmd/compile/internal/gc/builtin/runtime.go b/src/cmd/compile/internal/gc/builtin/runtime.go index fc879badb2..210881a6e9 100644 --- a/src/cmd/compile/internal/gc/builtin/runtime.go +++ b/src/cmd/compile/internal/gc/builtin/runtime.go @@ -18,6 +18,7 @@ func newobject(typ *byte) *any func panicindex() func panicslice() func panicdivide() +func panicshift() func panicmakeslicelen() func throwinit() func panicwrap() diff --git a/src/cmd/compile/internal/gc/closure.go b/src/cmd/compile/internal/gc/closure.go index 284ecdf457..6db0f02001 100644 --- a/src/cmd/compile/internal/gc/closure.go +++ b/src/cmd/compile/internal/gc/closure.go @@ -523,8 +523,14 @@ func walkpartialcall(n *Node, init *Nodes) *Node { // Trigger panic for method on nil interface now. // Otherwise it happens in the wrapper and is confusing. n.Left = cheapexpr(n.Left, init) + n.Left = walkexpr(n.Left, nil) - checknil(n.Left, init) + tab := nod(OITAB, n.Left, nil) + tab = typecheck(tab, ctxExpr) + + c := nod(OCHECKNIL, tab, nil) + c.SetTypecheck(1) + init.Append(c) } typ := partialCallType(n) diff --git a/src/cmd/compile/internal/gc/const.go b/src/cmd/compile/internal/gc/const.go index 3a9080e67d..de7df645e6 100644 --- a/src/cmd/compile/internal/gc/const.go +++ b/src/cmd/compile/internal/gc/const.go @@ -427,13 +427,13 @@ bad: func tocplx(v Val) Val { switch u := v.U.(type) { case *Mpint: - c := new(Mpcplx) + c := newMpcmplx() c.Real.SetInt(u) c.Imag.SetFloat64(0.0) v.U = c case *Mpflt: - c := new(Mpcplx) + c := newMpcmplx() c.Real.Set(u) c.Imag.SetFloat64(0.0) v.U = c @@ -845,7 +845,7 @@ Outer: case CTCPLX: x, y := x.U.(*Mpcplx), y.U.(*Mpcplx) - u := new(Mpcplx) + u := newMpcmplx() u.Real.Set(&x.Real) u.Imag.Set(&x.Imag) switch op { @@ -900,7 +900,7 @@ func unaryOp(op Op, x Val, t *types.Type) Val { case CTCPLX: x := x.U.(*Mpcplx) - u := new(Mpcplx) + u := newMpcmplx() u.Real.Set(&x.Real) u.Imag.Set(&x.Imag) u.Real.Neg() @@ -1422,3 +1422,66 @@ func hascallchan(n *Node) bool { return false } + +// A constSet represents a set of Go constant expressions. +type constSet struct { + m map[constSetKey]*Node +} + +type constSetKey struct { + typ *types.Type + val interface{} +} + +// add adds constant expressions to s. If a constant expression of +// equal value and identical type has already been added, then that +// type expression is returned. Otherwise, add returns nil. +// +// add also returns nil if n is not a Go constant expression. +// +// n must not be an untyped constant. +func (s *constSet) add(n *Node) *Node { + if n.Op == OCONVIFACE && n.Implicit() { + n = n.Left + } + + if !n.isGoConst() { + return nil + } + if n.Type.IsUntyped() { + Fatalf("%v is untyped", n) + } + + // Consts are only duplicates if they have the same value and + // identical types. + // + // In general, we have to use types.Identical to test type + // identity, because == gives false negatives for anonymous + // types and the byte/uint8 and rune/int32 builtin type + // aliases. However, this is not a problem here, because + // constant expressions are always untyped or have a named + // type, and we explicitly handle the builtin type aliases + // below. + // + // This approach may need to be revisited though if we fix + // #21866 by treating all type aliases like byte/uint8 and + // rune/int32. + + typ := n.Type + switch typ { + case types.Bytetype: + typ = types.Types[TUINT8] + case types.Runetype: + typ = types.Types[TINT32] + } + k := constSetKey{typ, n.Val().Interface()} + + if s.m == nil { + s.m = make(map[constSetKey]*Node) + } + old, dup := s.m[k] + if !dup { + s.m[k] = n + } + return old +} diff --git a/src/cmd/compile/internal/gc/esc.go b/src/cmd/compile/internal/gc/esc.go index 322b2dcd0b..bd0fb82554 100644 --- a/src/cmd/compile/internal/gc/esc.go +++ b/src/cmd/compile/internal/gc/esc.go @@ -2105,6 +2105,16 @@ func (e *EscState) escwalkBody(level Level, dst *Node, src *Node, step *EscStep, step.describe(src) } extraloopdepth = modSrcLoopdepth + if src.Op == OCONVIFACE { + lt := src.Left.Type + if !lt.IsInterface() && !isdirectiface(lt) && types.Haspointers(lt) { + // We're converting from a non-direct interface type. + // The interface will hold a heap copy of the data + // (by calling convT2I or friend). Flow the data to heap. + // See issue 29353. + e.escwalk(level, &e.theSink, src.Left, e.stepWalk(dst, src.Left, "interface-converted", step)) + } + } } case ODOT, diff --git a/src/cmd/compile/internal/gc/export.go b/src/cmd/compile/internal/gc/export.go index 791fc063b7..31e6ab5b6d 100644 --- a/src/cmd/compile/internal/gc/export.go +++ b/src/cmd/compile/internal/gc/export.go @@ -209,6 +209,10 @@ func dumpasmhdr() { } switch n.Op { case OLITERAL: + t := n.Val().Ctype() + if t == CTFLT || t == CTCPLX { + break + } fmt.Fprintf(b, "#define const_%s %#v\n", n.Sym.Name, n.Val()) case OTYPE: diff --git a/src/cmd/compile/internal/gc/go.go b/src/cmd/compile/internal/gc/go.go index 376637ba9a..007585ef10 100644 --- a/src/cmd/compile/internal/gc/go.go +++ b/src/cmd/compile/internal/gc/go.go @@ -255,9 +255,10 @@ type Arch struct { Use387 bool // should 386 backend use 387 FP instructions instead of sse2. SoftFloat bool - PadFrame func(int64) int64 - ZeroRange func(*Progs, *obj.Prog, int64, int64, *uint32) *obj.Prog - Ginsnop func(*Progs) *obj.Prog + PadFrame func(int64) int64 + ZeroRange func(*Progs, *obj.Prog, int64, int64, *uint32) *obj.Prog + Ginsnop func(*Progs) *obj.Prog + Ginsnopdefer func(*Progs) *obj.Prog // special ginsnop for deferreturn // SSAMarkMoves marks any MOVXconst ops that need to avoid clobbering flags. SSAMarkMoves func(*SSAGenState, *ssa.Block) @@ -296,6 +297,7 @@ var ( msanwrite, newproc, panicdivide, + panicshift, panicdottypeE, panicdottypeI, panicindex, diff --git a/src/cmd/compile/internal/gc/gsubr.go b/src/cmd/compile/internal/gc/gsubr.go index 5ad7b9a1b6..6e9f80a89d 100644 --- a/src/cmd/compile/internal/gc/gsubr.go +++ b/src/cmd/compile/internal/gc/gsubr.go @@ -176,11 +176,6 @@ func (pp *Progs) settext(fn *Node) { ptxt := pp.Prog(obj.ATEXT) pp.Text = ptxt - if fn.Func.lsym == nil { - // func _() { } - return - } - fn.Func.lsym.Func.Text = ptxt ptxt.From.Type = obj.TYPE_MEM ptxt.From.Name = obj.NAME_EXTERN diff --git a/src/cmd/compile/internal/gc/inl_test.go b/src/cmd/compile/internal/gc/inl_test.go index 58d13f2dcf..c29c1755f3 100644 --- a/src/cmd/compile/internal/gc/inl_test.go +++ b/src/cmd/compile/internal/gc/inl_test.go @@ -26,7 +26,7 @@ func TestIntendedInlining(t *testing.T) { t.Parallel() // want is the list of function names (by package) that should - // be inlinable. If they have no callers in thier packages, they + // be inlinable. If they have no callers in their packages, they // might not actually be inlined anywhere. want := map[string][]string{ "runtime": { @@ -218,7 +218,7 @@ func TestIntendedInlining(t *testing.T) { if m := canInline.FindStringSubmatch(line); m != nil { fname := m[1] fullname := curPkg + "." + fname - // If function must be inlined somewhere, beeing inlinable is not enough + // If function must be inlined somewhere, being inlinable is not enough if _, ok := must[fullname]; !ok { delete(notInlinedReason, fullname) continue diff --git a/src/cmd/compile/internal/gc/mpfloat.go b/src/cmd/compile/internal/gc/mpfloat.go index d1f5cb1200..c1bbd3c1b4 100644 --- a/src/cmd/compile/internal/gc/mpfloat.go +++ b/src/cmd/compile/internal/gc/mpfloat.go @@ -8,6 +8,7 @@ import ( "fmt" "math" "math/big" + "strings" ) // implements float arithmetic @@ -31,12 +32,14 @@ type Mpcplx struct { Imag Mpflt } +// Use newMpflt (not new(Mpflt)!) to get the correct default precision. func newMpflt() *Mpflt { var a Mpflt a.Val.SetPrec(Mpprec) return &a } +// Use newMpcmplx (not new(Mpcplx)!) to get the correct default precision. func newMpcmplx() *Mpcplx { var a Mpcplx a.Real = *newMpflt() @@ -177,15 +180,36 @@ func (a *Mpflt) Neg() { } func (a *Mpflt) SetString(as string) { + // TODO(gri) remove this code once math/big.Float.Parse can handle separators + as = strings.Replace(as, "_", "", -1) // strip separators + + // TODO(gri) why is this needed? for len(as) > 0 && (as[0] == ' ' || as[0] == '\t') { as = as[1:] } - f, _, err := a.Val.Parse(as, 10) - if err != nil { - yyerror("malformed constant: %s (%v)", as, err) - a.Val.SetFloat64(0) - return + // Currently, Val.Parse below (== math/big.Float.Parse) does not + // handle the 0o-octal prefix which can appear with octal integers + // with 'i' suffix, which end up here as imaginary components of + // complex numbers. Handle explicitly for now. + // TODO(gri) remove once Float.Parse can handle octals (it handles 0b/0B) + var f *big.Float + if strings.HasPrefix(as, "0o") || strings.HasPrefix(as, "0O") { + x, ok := new(big.Int).SetString(as[2:], 8) + if !ok { + yyerror("malformed constant: %s", as) + a.Val.SetFloat64(0) + return + } + f = a.Val.SetInt(x) + } else { + var err error + f, _, err = a.Val.Parse(as, 0) + if err != nil { + yyerror("malformed constant: %s (%v)", as, err) + a.Val.SetFloat64(0) + return + } } if f.IsInf() { diff --git a/src/cmd/compile/internal/gc/mpint.go b/src/cmd/compile/internal/gc/mpint.go index e4dd22d0a0..e06f39f8d9 100644 --- a/src/cmd/compile/internal/gc/mpint.go +++ b/src/cmd/compile/internal/gc/mpint.go @@ -7,6 +7,7 @@ package gc import ( "fmt" "math/big" + "strings" ) // implements integer arithmetic @@ -281,6 +282,12 @@ func (a *Mpint) SetInt64(c int64) { } func (a *Mpint) SetString(as string) { + // TODO(gri) remove this code once math/big.Int.SetString can handle 0o-octals and separators + as = strings.Replace(as, "_", "", -1) // strip separators + if len(as) >= 2 && as[0] == '0' && (as[1] == 'o' || as[1] == 'O') { + as = "0" + as[2:] + } + _, ok := a.Val.SetString(as, 0) if !ok { // required syntax is [+-][0[x]]d* diff --git a/src/cmd/compile/internal/gc/noder.go b/src/cmd/compile/internal/gc/noder.go index 3aa303c0c1..3fab95b917 100644 --- a/src/cmd/compile/internal/gc/noder.go +++ b/src/cmd/compile/internal/gc/noder.go @@ -1327,7 +1327,7 @@ func (p *noder) basicLit(lit *syntax.BasicLit) Val { return Val{U: x} case syntax.ImagLit: - x := new(Mpcplx) + x := newMpcmplx() x.Imag.SetString(strings.TrimSuffix(s, "i")) return Val{U: x} diff --git a/src/cmd/compile/internal/gc/pgen.go b/src/cmd/compile/internal/gc/pgen.go index 1dc4b53427..6914e3c5f8 100644 --- a/src/cmd/compile/internal/gc/pgen.go +++ b/src/cmd/compile/internal/gc/pgen.go @@ -258,17 +258,15 @@ func compile(fn *Node) { // be types of stack objects. We need to do this here // because symbols must be allocated before the parallel // phase of the compiler. - if fn.Func.lsym != nil { // not func _(){} - for _, n := range fn.Func.Dcl { - switch n.Class() { - case PPARAM, PPARAMOUT, PAUTO: - if livenessShouldTrack(n) && n.Addrtaken() { - dtypesym(n.Type) - // Also make sure we allocate a linker symbol - // for the stack object data, for the same reason. - if fn.Func.lsym.Func.StackObjects == nil { - fn.Func.lsym.Func.StackObjects = lookup(fmt.Sprintf("%s.stkobj", fn.funcname())).Linksym() - } + for _, n := range fn.Func.Dcl { + switch n.Class() { + case PPARAM, PPARAMOUT, PAUTO: + if livenessShouldTrack(n) && n.Addrtaken() { + dtypesym(n.Type) + // Also make sure we allocate a linker symbol + // for the stack object data, for the same reason. + if fn.Func.lsym.Func.StackObjects == nil { + fn.Func.lsym.Func.StackObjects = lookup(fmt.Sprintf("%s.stkobj", fn.funcname())).Linksym() } } } diff --git a/src/cmd/compile/internal/gc/plive.go b/src/cmd/compile/internal/gc/plive.go index b48a9ea87e..a9a01e5c12 100644 --- a/src/cmd/compile/internal/gc/plive.go +++ b/src/cmd/compile/internal/gc/plive.go @@ -1426,26 +1426,26 @@ func liveness(e *ssafn, f *ssa.Func, pp *Progs) LivenessMap { } // Emit the live pointer map data structures - if ls := e.curfn.Func.lsym; ls != nil { - ls.Func.GCArgs, ls.Func.GCLocals, ls.Func.GCRegs = lv.emit() + ls := e.curfn.Func.lsym + ls.Func.GCArgs, ls.Func.GCLocals, ls.Func.GCRegs = lv.emit() - p := pp.Prog(obj.AFUNCDATA) - Addrconst(&p.From, objabi.FUNCDATA_ArgsPointerMaps) - p.To.Type = obj.TYPE_MEM - p.To.Name = obj.NAME_EXTERN - p.To.Sym = ls.Func.GCArgs + p := pp.Prog(obj.AFUNCDATA) + Addrconst(&p.From, objabi.FUNCDATA_ArgsPointerMaps) + p.To.Type = obj.TYPE_MEM + p.To.Name = obj.NAME_EXTERN + p.To.Sym = ls.Func.GCArgs - p = pp.Prog(obj.AFUNCDATA) - Addrconst(&p.From, objabi.FUNCDATA_LocalsPointerMaps) - p.To.Type = obj.TYPE_MEM - p.To.Name = obj.NAME_EXTERN - p.To.Sym = ls.Func.GCLocals + p = pp.Prog(obj.AFUNCDATA) + Addrconst(&p.From, objabi.FUNCDATA_LocalsPointerMaps) + p.To.Type = obj.TYPE_MEM + p.To.Name = obj.NAME_EXTERN + p.To.Sym = ls.Func.GCLocals + + p = pp.Prog(obj.AFUNCDATA) + Addrconst(&p.From, objabi.FUNCDATA_RegPointerMaps) + p.To.Type = obj.TYPE_MEM + p.To.Name = obj.NAME_EXTERN + p.To.Sym = ls.Func.GCRegs - p = pp.Prog(obj.AFUNCDATA) - Addrconst(&p.From, objabi.FUNCDATA_RegPointerMaps) - p.To.Type = obj.TYPE_MEM - p.To.Name = obj.NAME_EXTERN - p.To.Sym = ls.Func.GCRegs - } return lv.livenessMap } diff --git a/src/cmd/compile/internal/gc/reflect.go b/src/cmd/compile/internal/gc/reflect.go index d492f17f89..3c6879c978 100644 --- a/src/cmd/compile/internal/gc/reflect.go +++ b/src/cmd/compile/internal/gc/reflect.go @@ -375,7 +375,7 @@ func methods(t *types.Type) []*Sig { // generating code if necessary. var ms []*Sig for _, f := range mt.AllMethods().Slice() { - if f.Type.Etype != TFUNC || f.Type.Recv() == nil { + if !f.IsMethod() { Fatalf("non-method on %v method %v %v\n", mt, f.Sym, f) } if f.Type.Recv() == nil { diff --git a/src/cmd/compile/internal/gc/sinit.go b/src/cmd/compile/internal/gc/sinit.go index de0298b746..efdaf1c3c5 100644 --- a/src/cmd/compile/internal/gc/sinit.go +++ b/src/cmd/compile/internal/gc/sinit.go @@ -568,7 +568,7 @@ var statuniqgen int // name generator for static temps // returned node for readonly nodes. func staticname(t *types.Type) *Node { // Don't use lookupN; it interns the resulting string, but these are all unique. - n := newname(lookup(fmt.Sprintf("statictmp_%d", statuniqgen))) + n := newname(lookup(fmt.Sprintf(".stmp_%d", statuniqgen))) statuniqgen++ addvar(n, t, PEXTERN) return n diff --git a/src/cmd/compile/internal/gc/ssa.go b/src/cmd/compile/internal/gc/ssa.go index e20137669a..c8befa40cd 100644 --- a/src/cmd/compile/internal/gc/ssa.go +++ b/src/cmd/compile/internal/gc/ssa.go @@ -84,6 +84,7 @@ func initssaconfig() { panicnildottype = sysfunc("panicnildottype") panicoverflow = sysfunc("panicoverflow") panicslice = sysfunc("panicslice") + panicshift = sysfunc("panicshift") raceread = sysfunc("raceread") racereadrange = sysfunc("racereadrange") racewrite = sysfunc("racewrite") @@ -2128,7 +2129,13 @@ func (s *state) expr(n *Node) *ssa.Value { case OLSH, ORSH: a := s.expr(n.Left) b := s.expr(n.Right) - return s.newValue2(s.ssaShiftOp(n.Op, n.Type, n.Right.Type), a.Type, a, b) + bt := b.Type + if bt.IsSigned() { + cmp := s.newValue2(s.ssaOp(OGE, bt), types.Types[TBOOL], b, s.zeroVal(bt)) + s.check(cmp, panicshift) + bt = bt.ToUnsigned() + } + return s.newValue2(s.ssaShiftOp(n.Op, n.Type, bt), a.Type, a, b) case OANDAND, OOROR: // To implement OANDAND (and OOROR), we introduce a // new temporary variable to hold the result. The @@ -5168,10 +5175,7 @@ func genssa(f *ssa.Func, pp *Progs) { } case ssa.OpInlMark: p := thearch.Ginsnop(s.pp) - if pp.curfn.Func.lsym != nil { - // lsym is nil if the function name is "_". - pp.curfn.Func.lsym.Func.AddInlMark(p, v.AuxInt32()) - } + pp.curfn.Func.lsym.Func.AddInlMark(p, v.AuxInt32()) // TODO: if matching line number, merge somehow with previous instruction? default: @@ -5597,7 +5601,7 @@ func (s *SSAGenState) PrepareCall(v *ssa.Value) { // insert an actual hardware NOP that will have the right line number. // This is different from obj.ANOP, which is a virtual no-op // that doesn't make it into the instruction stream. - thearch.Ginsnop(s.pp) + thearch.Ginsnopdefer(s.pp) } if sym, ok := v.Aux.(*obj.LSym); ok { diff --git a/src/cmd/compile/internal/gc/subr.go b/src/cmd/compile/internal/gc/subr.go index 2a976dc4f0..775147bff7 100644 --- a/src/cmd/compile/internal/gc/subr.go +++ b/src/cmd/compile/internal/gc/subr.go @@ -537,26 +537,6 @@ func methtype(t *types.Type) *types.Type { return nil } -// Are t1 and t2 equal struct types when field names are ignored? -// For deciding whether the result struct from g can be copied -// directly when compiling f(g()). -func eqtypenoname(t1 *types.Type, t2 *types.Type) bool { - if t1 == nil || t2 == nil || !t1.IsStruct() || !t2.IsStruct() { - return false - } - - if t1.NumFields() != t2.NumFields() { - return false - } - for i, f1 := range t1.FieldSlice() { - f2 := t2.Field(i) - if !types.Identical(f1.Type, f2.Type) { - return false - } - } - return true -} - // Is type src assignment compatible to type dst? // If so, return op code to use in conversion. // If not, return 0. @@ -1200,7 +1180,7 @@ func lookdot0(s *types.Sym, t *types.Type, save **types.Field, ignorecase bool) c := 0 if u.IsStruct() || u.IsInterface() { for _, f := range u.Fields().Slice() { - if f.Sym == s || (ignorecase && f.Type.Etype == TFUNC && f.Type.Recv() != nil && strings.EqualFold(f.Sym.Name, s.Name)) { + if f.Sym == s || (ignorecase && f.IsMethod() && strings.EqualFold(f.Sym.Name, s.Name)) { if save != nil { *save = f } @@ -1440,7 +1420,7 @@ func expandmeth(t *types.Type) { } // dotpath may have dug out arbitrary fields, we only want methods. - if f.Type.Etype != TFUNC || f.Type.Recv() == nil { + if !f.IsMethod() { continue } @@ -1651,7 +1631,7 @@ func ifacelookdot(s *types.Sym, t *types.Type, ignorecase bool) (m *types.Field, } } - if m.Type.Etype != TFUNC || m.Type.Recv() == nil { + if !m.IsMethod() { yyerror("%v.%v is a field, not a method", t, s) return nil, followptr } @@ -1849,18 +1829,6 @@ func isbadimport(path string, allowSpace bool) bool { return false } -func checknil(x *Node, init *Nodes) { - x = walkexpr(x, nil) // caller has not done this yet - if x.Type.IsInterface() { - x = nod(OITAB, x, nil) - x = typecheck(x, ctxExpr) - } - - n := nod(OCHECKNIL, x, nil) - n.SetTypecheck(1) - init.Append(n) -} - // Can this type be stored directly in an interface word? // Yes, if the representation is a single pointer. func isdirectiface(t *types.Type) bool { diff --git a/src/cmd/compile/internal/gc/swt.go b/src/cmd/compile/internal/gc/swt.go index cc9a8f8b2c..70fc66bf57 100644 --- a/src/cmd/compile/internal/gc/swt.go +++ b/src/cmd/compile/internal/gc/swt.go @@ -627,79 +627,25 @@ func checkDupExprCases(exprname *Node, clauses []*Node) { if exprname == nil { return } - // The common case is that s's expression is not an interface. - // In that case, all constant clauses have the same type, - // so checking for duplicates can be done solely by value. - if !exprname.Type.IsInterface() { - seen := make(map[interface{}]*Node) - for _, ncase := range clauses { - for _, n := range ncase.List.Slice() { - // Can't check for duplicates that aren't constants, per the spec. Issue 15896. - // Don't check for duplicate bools. Although the spec allows it, - // (1) the compiler hasn't checked it in the past, so compatibility mandates it, and - // (2) it would disallow useful things like - // case GOARCH == "arm" && GOARM == "5": - // case GOARCH == "arm": - // which would both evaluate to false for non-ARM compiles. - if ct := consttype(n); ct == 0 || ct == CTBOOL { - continue - } - val := n.Val().Interface() - prev, dup := seen[val] - if !dup { - seen[val] = n - continue - } + var cs constSet + for _, ncase := range clauses { + for _, n := range ncase.List.Slice() { + // Don't check for duplicate bools. Although the spec allows it, + // (1) the compiler hasn't checked it in the past, so compatibility mandates it, and + // (2) it would disallow useful things like + // case GOARCH == "arm" && GOARM == "5": + // case GOARCH == "arm": + // which would both evaluate to false for non-ARM compiles. + if n.Type.IsBoolean() { + continue + } + + if prev := cs.add(n); prev != nil { yyerrorl(ncase.Pos, "duplicate case %s in switch\n\tprevious case at %v", nodeAndVal(n), prev.Line()) } } - return - } - - // s's expression is an interface. This is fairly rare, so - // keep this simple. Case expressions are only duplicates if - // they have the same value and identical types. - // - // In general, we have to use eqtype to test type identity, - // because == gives false negatives for anonymous types and - // the byte/uint8 and rune/int32 builtin type aliases. - // However, this is not a problem here, because constant - // expressions are always untyped or have a named type, and we - // explicitly handle the builtin type aliases below. - // - // This approach may need to be revisited though if we fix - // #21866 by treating all type aliases like byte/uint8 and - // rune/int32. - type typeVal struct { - typ *types.Type - val interface{} - } - seen := make(map[typeVal]*Node) - for _, ncase := range clauses { - for _, n := range ncase.List.Slice() { - if ct := consttype(n); ct == 0 || ct == CTBOOL || ct == CTNIL { - continue - } - tv := typeVal{ - typ: n.Type, - val: n.Val().Interface(), - } - switch tv.typ { - case types.Bytetype: - tv.typ = types.Types[TUINT8] - case types.Runetype: - tv.typ = types.Types[TINT32] - } - prev, dup := seen[tv] - if !dup { - seen[tv] = n - continue - } - yyerrorl(ncase.Pos, "duplicate case %s in switch\n\tprevious case at %v", - nodeAndVal(n), prev.Line()) - } } } diff --git a/src/cmd/compile/internal/gc/swt_test.go b/src/cmd/compile/internal/gc/swt_test.go index 74419596d2..2f73ef7b99 100644 --- a/src/cmd/compile/internal/gc/swt_test.go +++ b/src/cmd/compile/internal/gc/swt_test.go @@ -16,7 +16,7 @@ func nodrune(r rune) *Node { } func nodflt(f float64) *Node { - v := new(Mpflt) + v := newMpflt() v.SetFloat64(f) return nodlit(Val{v}) } diff --git a/src/cmd/compile/internal/gc/testdata/fp_test.go b/src/cmd/compile/internal/gc/testdata/fp_test.go index daed2b417a..7d61a8063e 100644 --- a/src/cmd/compile/internal/gc/testdata/fp_test.go +++ b/src/cmd/compile/internal/gc/testdata/fp_test.go @@ -179,7 +179,7 @@ func integer2floatConversions(t *testing.T) { } { // Check maximum values - a, b, c, d, e, f, g, h, i := conv2Float64_ssa(127, 255, 32767, 65535, 0x7fffffff, 0xffffffff, 0x7fffFFFFffffFFFF, 0xffffFFFFffffFFFF, 3.402823E38) + a, b, c, d, e, f, g, h, i := conv2Float64_ssa(127, 255, 32767, 65535, 0x7fffffff, 0xffffffff, 0x7fffFFFFffffFFFF, 0xffffFFFFffffFFFF, 3.402823e38) expect64(t, "a", a, 127) expect64(t, "b", b, 255) expect64(t, "c", c, 32767) @@ -188,11 +188,11 @@ func integer2floatConversions(t *testing.T) { expect64(t, "f", f, float64(uint32(0xffffffff))) expect64(t, "g", g, float64(int64(0x7fffffffffffffff))) expect64(t, "h", h, float64(uint64(0xffffffffffffffff))) - expect64(t, "i", i, float64(float32(3.402823E38))) + expect64(t, "i", i, float64(float32(3.402823e38))) } { // Check minimum values (and tweaks for unsigned) - a, b, c, d, e, f, g, h, i := conv2Float64_ssa(-128, 254, -32768, 65534, ^0x7fffffff, 0xfffffffe, ^0x7fffFFFFffffFFFF, 0xffffFFFFffffF401, 1.5E-45) + a, b, c, d, e, f, g, h, i := conv2Float64_ssa(-128, 254, -32768, 65534, ^0x7fffffff, 0xfffffffe, ^0x7fffFFFFffffFFFF, 0xffffFFFFffffF401, 1.5e-45) expect64(t, "a", a, -128) expect64(t, "b", b, 254) expect64(t, "c", c, -32768) @@ -201,11 +201,11 @@ func integer2floatConversions(t *testing.T) { expect64(t, "f", f, float64(uint32(0xfffffffe))) expect64(t, "g", g, float64(^int64(0x7fffffffffffffff))) expect64(t, "h", h, float64(uint64(0xfffffffffffff401))) - expect64(t, "i", i, float64(float32(1.5E-45))) + expect64(t, "i", i, float64(float32(1.5e-45))) } { // Check maximum values - a, b, c, d, e, f, g, h, i := conv2Float32_ssa(127, 255, 32767, 65535, 0x7fffffff, 0xffffffff, 0x7fffFFFFffffFFFF, 0xffffFFFFffffFFFF, 3.402823E38) + a, b, c, d, e, f, g, h, i := conv2Float32_ssa(127, 255, 32767, 65535, 0x7fffffff, 0xffffffff, 0x7fffFFFFffffFFFF, 0xffffFFFFffffFFFF, 3.402823e38) expect32(t, "a", a, 127) expect32(t, "b", b, 255) expect32(t, "c", c, 32767) @@ -214,11 +214,11 @@ func integer2floatConversions(t *testing.T) { expect32(t, "f", f, float32(uint32(0xffffffff))) expect32(t, "g", g, float32(int64(0x7fffffffffffffff))) expect32(t, "h", h, float32(uint64(0xffffffffffffffff))) - expect32(t, "i", i, float32(float64(3.402823E38))) + expect32(t, "i", i, float32(float64(3.402823e38))) } { // Check minimum values (and tweaks for unsigned) - a, b, c, d, e, f, g, h, i := conv2Float32_ssa(-128, 254, -32768, 65534, ^0x7fffffff, 0xfffffffe, ^0x7fffFFFFffffFFFF, 0xffffFFFFffffF401, 1.5E-45) + a, b, c, d, e, f, g, h, i := conv2Float32_ssa(-128, 254, -32768, 65534, ^0x7fffffff, 0xfffffffe, ^0x7fffFFFFffffFFFF, 0xffffFFFFffffF401, 1.5e-45) expect32(t, "a", a, -128) expect32(t, "b", b, 254) expect32(t, "c", c, -32768) @@ -227,7 +227,7 @@ func integer2floatConversions(t *testing.T) { expect32(t, "f", f, float32(uint32(0xfffffffe))) expect32(t, "g", g, float32(^int64(0x7fffffffffffffff))) expect32(t, "h", h, float32(uint64(0xfffffffffffff401))) - expect32(t, "i", i, float32(float64(1.5E-45))) + expect32(t, "i", i, float32(float64(1.5e-45))) } } @@ -1685,7 +1685,7 @@ func TestFP(t *testing.T) { c := float32(3.0) d := float32(4.0) - tiny := float32(1.5E-45) // smallest f32 denorm = 2**(-149) + tiny := float32(1.5e-45) // smallest f32 denorm = 2**(-149) dtiny := float64(tiny) // well within range of f64 fail64("+", add64_ssa, a, b, 7.0) diff --git a/src/cmd/compile/internal/gc/typecheck.go b/src/cmd/compile/internal/gc/typecheck.go index 4fc1c5c73c..69ba9ef52a 100644 --- a/src/cmd/compile/internal/gc/typecheck.go +++ b/src/cmd/compile/internal/gc/typecheck.go @@ -8,7 +8,6 @@ import ( "cmd/compile/internal/types" "cmd/internal/objabi" "fmt" - "math" "strings" ) @@ -660,8 +659,8 @@ func typecheck1(n *Node, top int) (res *Node) { r = defaultlit(r, types.Types[TUINT]) n.Right = r t := r.Type - if !t.IsInteger() || t.IsSigned() { - yyerror("invalid operation: %v (shift count type %v, must be unsigned integer)", n, r.Type) + if !t.IsInteger() { + yyerror("invalid operation: %v (shift count type %v, must be integer)", n, r.Type) n.Type = nil return n } @@ -1589,7 +1588,7 @@ func typecheck1(n *Node, top int) (res *Node) { if l.Op == OLITERAL && r.Op == OLITERAL { // make it a complex literal - c := new(Mpcplx) + c := newMpcmplx() c.Real.Set(toflt(l.Val()).U.(*Mpflt)) c.Imag.Set(toflt(r.Val()).U.(*Mpflt)) setconst(n, Val{c}) @@ -2913,64 +2912,6 @@ func fielddup(name string, hash map[string]bool) { hash[name] = true } -func keydup(n *Node, hash map[uint32][]*Node) { - orign := n - if n.Op == OCONVIFACE { - n = n.Left - } - evconst(n) - if n.Op != OLITERAL { - return // we don't check variables - } - - const PRIME1 = 3 - - var h uint32 - switch v := n.Val().U.(type) { - default: // unknown, bool, nil - h = 23 - - case *Mpint: - h = uint32(v.Int64()) - - case *Mpflt: - x := math.Float64bits(v.Float64()) - for i := 0; i < 8; i++ { - h = h*PRIME1 + uint32(x&0xFF) - x >>= 8 - } - - case string: - for i := 0; i < len(v); i++ { - h = h*PRIME1 + uint32(v[i]) - } - } - - var cmp Node - for _, a := range hash[h] { - cmp.Op = OEQ - cmp.Left = n - if a.Op == OCONVIFACE && orign.Op == OCONVIFACE { - a = a.Left - } - if !types.Identical(a.Type, n.Type) { - continue - } - cmp.Right = a - evconst(&cmp) - if cmp.Op != OLITERAL { - // Sometimes evconst fails. See issue 12536. - continue - } - if cmp.Val().U.(bool) { - yyerror("duplicate key %v in map literal", n) - return - } - } - - hash[h] = append(hash[h], orign) -} - // iscomptype reports whether type t is a composite literal type // or a pointer to one. func iscomptype(t *types.Type) bool { @@ -3131,7 +3072,7 @@ func typecheckcomplit(n *Node) (res *Node) { } case TMAP: - hash := make(map[uint32][]*Node) + var cs constSet for i3, l := range n.List.Slice() { setlineno(l) if l.Op != OKEY { @@ -3145,8 +3086,8 @@ func typecheckcomplit(n *Node) (res *Node) { r = typecheck(r, ctxExpr) r = defaultlit(r, t.Key()) l.Left = assignconv(r, t.Key(), "map key") - if l.Left.Op != OCONV { - keydup(l.Left, hash) + if cs.add(l.Left) != nil { + yyerror("duplicate key %v in map literal", l.Left) } r = l.Right @@ -3250,8 +3191,9 @@ func typecheckcomplit(n *Node) (res *Node) { } continue } - p, _ := dotpath(l.Sym, t, nil, true) - if p == nil { + var f *types.Field + p, _ := dotpath(l.Sym, t, &f, true) + if p == nil || f.IsMethod() { yyerror("unknown field '%v' in struct literal of type %v", l.Sym, t) continue } @@ -3602,7 +3544,7 @@ func typecheckas2(n *Node) { mismatch: switch r.Op { default: - yyerror("assignment mismatch: %d variable but %d values", cl, cr) + yyerror("assignment mismatch: %d variables but %d values", cl, cr) case OCALLFUNC, OCALLMETH, OCALLINTER: yyerror("assignment mismatch: %d variables but %v returns %d values", cl, r.Left, cr) } diff --git a/src/cmd/compile/internal/gc/walk.go b/src/cmd/compile/internal/gc/walk.go index 509579d21f..1d6321212e 100644 --- a/src/cmd/compile/internal/gc/walk.go +++ b/src/cmd/compile/internal/gc/walk.go @@ -493,7 +493,7 @@ opswitch: n.Left = walkexpr(n.Left, init) n.Right = walkexpr(n.Right, init) - case ODOT: + case ODOT, ODOTPTR: usefield(n) n.Left = walkexpr(n.Left, init) @@ -508,17 +508,6 @@ opswitch: n.List.Set1(itabname(n.Type, n.Left.Type)) } - case ODOTPTR: - usefield(n) - if n.Op == ODOTPTR && n.Left.Type.Elem().Width == 0 { - // No actual copy will be generated, so emit an explicit nil check. - n.Left = cheapexpr(n.Left, init) - - checknil(n.Left, init) - } - - n.Left = walkexpr(n.Left, init) - case OLEN, OCAP: if isRuneCount(n) { // Replace len([]rune(string)) with runtime.countrunes(string). @@ -1951,6 +1940,16 @@ func callnew(t *types.Type) *Node { yyerror("%v is go:notinheap; heap allocation disallowed", t) } dowidth(t) + + if t.Size() == 0 { + // Return &runtime.zerobase if we know that the requested size is 0. + // This is what runtime.mallocgc would return. + z := newname(Runtimepkg.Lookup("zerobase")) + z.SetClass(PEXTERN) + z.Type = t + return typecheck(nod(OADDR, z, nil), ctxExpr) + } + fn := syslook("newobject") fn = substArgTypes(fn, t) v := mkcall1(fn, types.NewPtr(t), nil, typename(t)) @@ -3353,12 +3352,6 @@ func walkcompareInterface(n *Node, init *Nodes) *Node { } func walkcompareString(n *Node, init *Nodes) *Node { - // s + "badgerbadgerbadger" == "badgerbadgerbadger" - if (n.Op == OEQ || n.Op == ONE) && Isconst(n.Right, CTSTR) && n.Left.Op == OADDSTR && n.Left.List.Len() == 2 && Isconst(n.Left.List.Second(), CTSTR) && strlit(n.Right) == strlit(n.Left.List.Second()) { - r := nod(n.Op, nod(OLEN, n.Left.List.First(), nil), nodintconst(0)) - return finishcompare(n, r, init) - } - // Rewrite comparisons to short constant strings as length+byte-wise comparisons. var cs, ncs *Node // const string, non-const string switch { diff --git a/src/cmd/compile/internal/mips/galign.go b/src/cmd/compile/internal/mips/galign.go index f207a17bbf..596dbd7fa0 100644 --- a/src/cmd/compile/internal/mips/galign.go +++ b/src/cmd/compile/internal/mips/galign.go @@ -22,6 +22,7 @@ func Init(arch *gc.Arch) { arch.ZeroRange = zerorange arch.ZeroAuto = zeroAuto arch.Ginsnop = ginsnop + arch.Ginsnopdefer = ginsnop arch.SSAMarkMoves = func(s *gc.SSAGenState, b *ssa.Block) {} arch.SSAGenValue = ssaGenValue arch.SSAGenBlock = ssaGenBlock diff --git a/src/cmd/compile/internal/mips64/galign.go b/src/cmd/compile/internal/mips64/galign.go index 5252719e8e..07e9f98be5 100644 --- a/src/cmd/compile/internal/mips64/galign.go +++ b/src/cmd/compile/internal/mips64/galign.go @@ -22,6 +22,7 @@ func Init(arch *gc.Arch) { arch.ZeroRange = zerorange arch.ZeroAuto = zeroAuto arch.Ginsnop = ginsnop + arch.Ginsnopdefer = ginsnop arch.SSAMarkMoves = func(s *gc.SSAGenState, b *ssa.Block) {} arch.SSAGenValue = ssaGenValue diff --git a/src/cmd/compile/internal/ppc64/galign.go b/src/cmd/compile/internal/ppc64/galign.go index da971d864d..8ad3084410 100644 --- a/src/cmd/compile/internal/ppc64/galign.go +++ b/src/cmd/compile/internal/ppc64/galign.go @@ -20,7 +20,8 @@ func Init(arch *gc.Arch) { arch.ZeroRange = zerorange arch.ZeroAuto = zeroAuto - arch.Ginsnop = ginsnop2 + arch.Ginsnop = ginsnop + arch.Ginsnopdefer = ginsnop2 arch.SSAMarkMoves = ssaMarkMoves arch.SSAGenValue = ssaGenValue diff --git a/src/cmd/compile/internal/s390x/galign.go b/src/cmd/compile/internal/s390x/galign.go index 3f624692bb..26359abe66 100644 --- a/src/cmd/compile/internal/s390x/galign.go +++ b/src/cmd/compile/internal/s390x/galign.go @@ -17,6 +17,7 @@ func Init(arch *gc.Arch) { arch.ZeroRange = zerorange arch.ZeroAuto = zeroAuto arch.Ginsnop = ginsnop + arch.Ginsnopdefer = ginsnop arch.SSAMarkMoves = ssaMarkMoves arch.SSAGenValue = ssaGenValue diff --git a/src/cmd/compile/internal/ssa/compile.go b/src/cmd/compile/internal/ssa/compile.go index 29618e29c3..38f12abf18 100644 --- a/src/cmd/compile/internal/ssa/compile.go +++ b/src/cmd/compile/internal/ssa/compile.go @@ -212,7 +212,8 @@ var BuildDump string // name of function to dump after initial build of ssa // BOOT_GO_GCFLAGS=-d='ssa/~^.*scc$/off' GO_GCFLAGS='-d=ssa/~^.*scc$/off' ./make.bash // func PhaseOption(phase, flag string, val int, valString string) string { - if phase == "help" { + switch phase { + case "", "help": lastcr := 0 phasenames := " check, all, build, intrinsics" for _, p := range passes { diff --git a/src/cmd/compile/internal/ssa/html.go b/src/cmd/compile/internal/ssa/html.go index 1202987acc..a1b718096d 100644 --- a/src/cmd/compile/internal/ssa/html.go +++ b/src/cmd/compile/internal/ssa/html.go @@ -1080,7 +1080,7 @@ type dotWriter struct { } // newDotWriter returns non-nil value when mask is valid. -// dotWriter will generate SVGs only for the phases specifed in the mask. +// dotWriter will generate SVGs only for the phases specified in the mask. // mask can contain following patterns and combinations of them: // * - all of them; // x-y - x through y, inclusive; diff --git a/src/cmd/compile/internal/ssa/nilcheck.go b/src/cmd/compile/internal/ssa/nilcheck.go index 5f58e2d7ec..5369a51023 100644 --- a/src/cmd/compile/internal/ssa/nilcheck.go +++ b/src/cmd/compile/internal/ssa/nilcheck.go @@ -49,7 +49,9 @@ func nilcheckelim(f *Func) { // value, or a value constructed from an offset of a // non-nil ptr (OpAddPtr) implies it is non-nil // We also assume unsafe pointer arithmetic generates non-nil pointers. See #27180. - if v.Op == OpAddr || v.Op == OpLocalAddr || v.Op == OpAddPtr || v.Op == OpOffPtr || v.Op == OpAdd32 || v.Op == OpAdd64 || v.Op == OpSub32 || v.Op == OpSub64 { + // We assume that SlicePtr is non-nil because we do a bounds check + // before the slice access (and all cap>0 slices have a non-nil ptr). See #30366. + if v.Op == OpAddr || v.Op == OpLocalAddr || v.Op == OpAddPtr || v.Op == OpOffPtr || v.Op == OpAdd32 || v.Op == OpAdd64 || v.Op == OpSub32 || v.Op == OpSub64 || v.Op == OpSlicePtr { nonNilValues[v.ID] = true } } diff --git a/src/cmd/compile/internal/ssa/rewrite.go b/src/cmd/compile/internal/ssa/rewrite.go index a154249371..9c9de750b2 100644 --- a/src/cmd/compile/internal/ssa/rewrite.go +++ b/src/cmd/compile/internal/ssa/rewrite.go @@ -1115,7 +1115,8 @@ func needRaceCleanup(sym interface{}, v *Value) bool { case OpStaticCall: switch v.Aux.(fmt.Stringer).String() { case "runtime.racefuncenter", "runtime.racefuncexit", "runtime.panicindex", - "runtime.panicslice", "runtime.panicdivide", "runtime.panicwrap": + "runtime.panicslice", "runtime.panicdivide", "runtime.panicwrap", + "runtime.panicshift": // Check for racefuncenter will encounter racefuncexit and vice versa. // Allow calls to panic* default: @@ -1141,7 +1142,7 @@ func symIsRO(sym interface{}) bool { // read8 reads one byte from the read-only global sym at offset off. func read8(sym interface{}, off int64) uint8 { lsym := sym.(*obj.LSym) - if off >= int64(len(lsym.P)) { + if off >= int64(len(lsym.P)) || off < 0 { // Invalid index into the global sym. // This can happen in dead code, so we don't want to panic. // Just return any value, it will eventually get ignored. @@ -1154,7 +1155,7 @@ func read8(sym interface{}, off int64) uint8 { // read16 reads two bytes from the read-only global sym at offset off. func read16(sym interface{}, off int64, bigEndian bool) uint16 { lsym := sym.(*obj.LSym) - if off >= int64(len(lsym.P))-1 { + if off >= int64(len(lsym.P))-1 || off < 0 { return 0 } if bigEndian { @@ -1167,7 +1168,7 @@ func read16(sym interface{}, off int64, bigEndian bool) uint16 { // read32 reads four bytes from the read-only global sym at offset off. func read32(sym interface{}, off int64, bigEndian bool) uint32 { lsym := sym.(*obj.LSym) - if off >= int64(len(lsym.P))-3 { + if off >= int64(len(lsym.P))-3 || off < 0 { return 0 } if bigEndian { @@ -1180,7 +1181,7 @@ func read32(sym interface{}, off int64, bigEndian bool) uint32 { // read64 reads eight bytes from the read-only global sym at offset off. func read64(sym interface{}, off int64, bigEndian bool) uint64 { lsym := sym.(*obj.LSym) - if off >= int64(len(lsym.P))-7 { + if off >= int64(len(lsym.P))-7 || off < 0 { return 0 } if bigEndian { diff --git a/src/cmd/compile/internal/ssa/writebarrier.go b/src/cmd/compile/internal/ssa/writebarrier.go index 1024ab25ab..49770018f8 100644 --- a/src/cmd/compile/internal/ssa/writebarrier.go +++ b/src/cmd/compile/internal/ssa/writebarrier.go @@ -384,7 +384,7 @@ func IsReadOnlyGlobalAddr(v *Value) bool { return false } // See TODO in OpAddr case in IsSanitizerSafeAddr below. - return strings.HasPrefix(v.Aux.(*obj.LSym).Name, `"".statictmp_`) + return strings.HasPrefix(v.Aux.(*obj.LSym).Name, `""..stmp_`) } // IsNewObject reports whether v is a pointer to a freshly allocated & zeroed object at memory state mem. @@ -439,7 +439,7 @@ func IsSanitizerSafeAddr(v *Value) bool { // test sym.Type==objabi.SRODATA, but we don't // initialize sym.Type until after function // compilation. - if strings.HasPrefix(sym.Name, `"".statictmp_`) { + if strings.HasPrefix(sym.Name, `""..stmp_`) { return true } } diff --git a/src/cmd/compile/internal/syntax/scanner.go b/src/cmd/compile/internal/syntax/scanner.go index 7db33fb6b9..fbb3e1a40e 100644 --- a/src/cmd/compile/internal/syntax/scanner.go +++ b/src/cmd/compile/internal/syntax/scanner.go @@ -47,6 +47,10 @@ func (s *scanner) init(src io.Reader, errh func(line, col uint, msg string), mod s.nlsemi = false } +func (s *scanner) errorf(format string, args ...interface{}) { + s.error(fmt.Sprintf(format, args...)) +} + // next advances the scanner by reading the next token. // // If a read, source encoding, or lexical error occurs, next calls @@ -149,8 +153,9 @@ redo: case '.': c = s.getr() - if isDigit(c) { - s.ungetr2() + if isDecimal(c) { + s.ungetr() + s.unread(1) // correct position of '.' (needed by startLit in number) s.number('.') break } @@ -160,7 +165,7 @@ redo: s.tok = _DotDotDot break } - s.ungetr2() + s.unread(1) } s.ungetr() s.tok = _Dot @@ -304,7 +309,7 @@ redo: default: s.tok = 0 - s.error(fmt.Sprintf("invalid character %#U", c)) + s.errorf("invalid character %#U", c) goto redo } @@ -320,11 +325,7 @@ assignop: } func isLetter(c rune) bool { - return 'a' <= c && c <= 'z' || 'A' <= c && c <= 'Z' || c == '_' -} - -func isDigit(c rune) bool { - return '0' <= c && c <= '9' + return 'a' <= lower(c) && lower(c) <= 'z' || c == '_' } func (s *scanner) ident() { @@ -332,7 +333,7 @@ func (s *scanner) ident() { // accelerate common case (7bit ASCII) c := s.getr() - for isLetter(c) || isDigit(c) { + for isLetter(c) || isDecimal(c) { c = s.getr() } @@ -372,10 +373,10 @@ func (s *scanner) isIdentRune(c rune, first bool) bool { // ok case unicode.IsDigit(c): if first { - s.error(fmt.Sprintf("identifier cannot begin with digit %#U", c)) + s.errorf("identifier cannot begin with digit %#U", c) } case c >= utf8.RuneSelf: - s.error(fmt.Sprintf("invalid identifier character %#U", c)) + s.errorf("invalid identifier character %#U", c) default: return false } @@ -401,86 +402,185 @@ func init() { } } +func lower(c rune) rune { return ('a' - 'A') | c } // returns lower-case c iff c is ASCII letter +func isDecimal(c rune) bool { return '0' <= c && c <= '9' } +func isHex(c rune) bool { return '0' <= c && c <= '9' || 'a' <= lower(c) && lower(c) <= 'f' } + +// digits accepts the sequence { digit | '_' } starting with c0. +// If base <= 10, digits accepts any decimal digit but records +// the index (relative to the literal start) of a digit >= base +// in *invalid, if *invalid < 0. +// digits returns the first rune that is not part of the sequence +// anymore, and a bitset describing whether the sequence contained +// digits (bit 0 is set), or separators '_' (bit 1 is set). +func (s *scanner) digits(c0 rune, base int, invalid *int) (c rune, digsep int) { + c = c0 + if base <= 10 { + max := rune('0' + base) + for isDecimal(c) || c == '_' { + ds := 1 + if c == '_' { + ds = 2 + } else if c >= max && *invalid < 0 { + *invalid = int(s.col0 - s.col) // record invalid rune index + } + digsep |= ds + c = s.getr() + } + } else { + for isHex(c) || c == '_' { + ds := 1 + if c == '_' { + ds = 2 + } + digsep |= ds + c = s.getr() + } + } + return +} + func (s *scanner) number(c rune) { s.startLit() + base := 10 // number base + prefix := rune(0) // one of 0 (decimal), '0' (0-octal), 'x', 'o', or 'b' + digsep := 0 // bit 0: digit present, bit 1: '_' present + invalid := -1 // index of invalid digit in literal, or < 0 + + // integer part + var ds int if c != '.' { - s.kind = IntLit // until proven otherwise + s.kind = IntLit if c == '0' { c = s.getr() - if c == 'x' || c == 'X' { - // hex + switch lower(c) { + case 'x': c = s.getr() - hasDigit := false - for isDigit(c) || 'a' <= c && c <= 'f' || 'A' <= c && c <= 'F' { - c = s.getr() - hasDigit = true - } - if !hasDigit { - s.error("malformed hex constant") - } - goto done - } - - // decimal 0, octal, or float - has8or9 := false - for isDigit(c) { - if c > '7' { - has8or9 = true - } + base, prefix = 16, 'x' + case 'o': c = s.getr() - } - if c != '.' && c != 'e' && c != 'E' && c != 'i' { - // octal - if has8or9 { - s.error("malformed octal constant") - } - goto done - } - - } else { - // decimal or float - for isDigit(c) { + base, prefix = 8, 'o' + case 'b': c = s.getr() + base, prefix = 2, 'b' + default: + base, prefix = 8, '0' + digsep = 1 // leading 0 } } + c, ds = s.digits(c, base, &invalid) + digsep |= ds } - // float + // fractional part if c == '.' { s.kind = FloatLit - c = s.getr() - for isDigit(c) { - c = s.getr() + if prefix == 'o' || prefix == 'b' { + s.error("invalid radix point in " + litname(prefix)) } + c, ds = s.digits(s.getr(), base, &invalid) + digsep |= ds + } + + if digsep&1 == 0 { + s.error(litname(prefix) + " has no digits") } // exponent - if c == 'e' || c == 'E' { - s.kind = FloatLit + if e := lower(c); e == 'e' || e == 'p' { + switch { + case e == 'e' && prefix != 0 && prefix != '0': + s.errorf("%q exponent requires decimal mantissa", c) + case e == 'p' && prefix != 'x': + s.errorf("%q exponent requires hexadecimal mantissa", c) + } c = s.getr() - if c == '-' || c == '+' { + s.kind = FloatLit + if c == '+' || c == '-' { c = s.getr() } - if !isDigit(c) { - s.error("malformed floating-point constant exponent") - } - for isDigit(c) { - c = s.getr() + c, ds = s.digits(c, 10, nil) + digsep |= ds + if ds&1 == 0 { + s.error("exponent has no digits") } + } else if prefix == 'x' && s.kind == FloatLit { + s.error("hexadecimal mantissa requires a 'p' exponent") } - // complex + // suffix 'i' if c == 'i' { s.kind = ImagLit - s.getr() + c = s.getr() } - -done: s.ungetr() + s.nlsemi = true s.lit = string(s.stopLit()) s.tok = _Literal + + if s.kind == IntLit && invalid >= 0 { + s.errh(s.line, s.col+uint(invalid), fmt.Sprintf("invalid digit %q in %s", s.lit[invalid], litname(prefix))) + } + + if digsep&2 != 0 { + if i := invalidSep(s.lit); i >= 0 { + s.errh(s.line, s.col+uint(i), "'_' must separate successive digits") + } + } +} + +func litname(prefix rune) string { + switch prefix { + case 'x': + return "hexadecimal literal" + case 'o', '0': + return "octal literal" + case 'b': + return "binary literal" + } + return "decimal literal" +} + +// invalidSep returns the index of the first invalid separator in x, or -1. +func invalidSep(x string) int { + x1 := ' ' // prefix char, we only care if it's 'x' + d := '.' // digit, one of '_', '0' (a digit), or '.' (anything else) + i := 0 + + // a prefix counts as a digit + if len(x) >= 2 && x[0] == '0' { + x1 = lower(rune(x[1])) + if x1 == 'x' || x1 == 'o' || x1 == 'b' { + d = '0' + i = 2 + } + } + + // mantissa and exponent + for ; i < len(x); i++ { + p := d // previous digit + d = rune(x[i]) + switch { + case d == '_': + if p != '0' { + return i + } + case isDecimal(d) || x1 == 'x' && isHex(d): + d = '0' + default: + if p == '_' { + return i - 1 + } + d = '.' + } + } + if d == '_' { + return len(x) - 1 + } + + return -1 } func (s *scanner) rune() { @@ -713,12 +813,10 @@ func (s *scanner) escape(quote rune) bool { for i := n; i > 0; i-- { d := base switch { - case isDigit(c): + case isDecimal(c): d = uint32(c) - '0' - case 'a' <= c && c <= 'f': - d = uint32(c) - ('a' - 10) - case 'A' <= c && c <= 'F': - d = uint32(c) - ('A' - 10) + case 'a' <= lower(c) && lower(c) <= 'f': + d = uint32(lower(c)) - ('a' - 10) } if d >= base { if c < 0 { @@ -728,7 +826,7 @@ func (s *scanner) escape(quote rune) bool { if base == 8 { kind = "octal" } - s.error(fmt.Sprintf("non-%s character in escape sequence: %c", kind, c)) + s.errorf("non-%s character in escape sequence: %c", kind, c) s.ungetr() return false } @@ -739,7 +837,7 @@ func (s *scanner) escape(quote rune) bool { s.ungetr() if x > max && base == 8 { - s.error(fmt.Sprintf("octal escape value > 255: %d", x)) + s.errorf("octal escape value > 255: %d", x) return false } diff --git a/src/cmd/compile/internal/syntax/scanner_test.go b/src/cmd/compile/internal/syntax/scanner_test.go index 0b7c2cfe43..bfc44950be 100644 --- a/src/cmd/compile/internal/syntax/scanner_test.go +++ b/src/cmd/compile/internal/syntax/scanner_test.go @@ -45,15 +45,17 @@ func TestTokens(t *testing.T) { // make source var buf bytes.Buffer for i, s := range sampleTokens { - buf.WriteString("\t\t\t\t"[:i&3]) // leading indentation - buf.WriteString(s.src) // token - buf.WriteString(" "[:i&7]) // trailing spaces - buf.WriteString("/*line foo:1 */ // bar\n") // comments (don't crash w/o directive handler) + buf.WriteString("\t\t\t\t"[:i&3]) // leading indentation + buf.WriteString(s.src) // token + buf.WriteString(" "[:i&7]) // trailing spaces + fmt.Fprintf(&buf, "/*line foo:%d */ // bar\n", i+linebase) // comments (don't crash w/o directive handler) } // scan source var got scanner - got.init(&buf, nil, 0) + got.init(&buf, func(line, col uint, msg string) { + t.Fatalf("%d:%d: %s", line, col, msg) + }, 0) got.next() for i, want := range sampleTokens { nlsemi := false @@ -140,8 +142,16 @@ var sampleTokens = [...]struct { {_Literal, "12345", 0, 0}, {_Literal, "123456789012345678890123456789012345678890", 0, 0}, {_Literal, "01234567", 0, 0}, - {_Literal, "0x0", 0, 0}, + {_Literal, "0_1_234_567", 0, 0}, + {_Literal, "0X0", 0, 0}, {_Literal, "0xcafebabe", 0, 0}, + {_Literal, "0x_cafe_babe", 0, 0}, + {_Literal, "0O0", 0, 0}, + {_Literal, "0o000", 0, 0}, + {_Literal, "0o_000", 0, 0}, + {_Literal, "0B1", 0, 0}, + {_Literal, "0b01100110", 0, 0}, + {_Literal, "0b_0110_0110", 0, 0}, {_Literal, "0.", 0, 0}, {_Literal, "0.e0", 0, 0}, {_Literal, "0.e-1", 0, 0}, @@ -323,6 +333,206 @@ func TestComments(t *testing.T) { } } +func TestNumbers(t *testing.T) { + for _, test := range []struct { + kind LitKind + src, tokens, err string + }{ + // binaries + {IntLit, "0b0", "0b0", ""}, + {IntLit, "0b1010", "0b1010", ""}, + {IntLit, "0B1110", "0B1110", ""}, + + {IntLit, "0b", "0b", "binary literal has no digits"}, + {IntLit, "0b0190", "0b0190", "invalid digit '9' in binary literal"}, + {IntLit, "0b01a0", "0b01 a0", ""}, // only accept 0-9 + + {FloatLit, "0b.", "0b.", "invalid radix point in binary literal"}, + {FloatLit, "0b.1", "0b.1", "invalid radix point in binary literal"}, + {FloatLit, "0b1.0", "0b1.0", "invalid radix point in binary literal"}, + {FloatLit, "0b1e10", "0b1e10", "'e' exponent requires decimal mantissa"}, + {FloatLit, "0b1P-1", "0b1P-1", "'P' exponent requires hexadecimal mantissa"}, + + {ImagLit, "0b10i", "0b10i", ""}, + {ImagLit, "0b10.0i", "0b10.0i", "invalid radix point in binary literal"}, + + // octals + {IntLit, "0o0", "0o0", ""}, + {IntLit, "0o1234", "0o1234", ""}, + {IntLit, "0O1234", "0O1234", ""}, + + {IntLit, "0o", "0o", "octal literal has no digits"}, + {IntLit, "0o8123", "0o8123", "invalid digit '8' in octal literal"}, + {IntLit, "0o1293", "0o1293", "invalid digit '9' in octal literal"}, + {IntLit, "0o12a3", "0o12 a3", ""}, // only accept 0-9 + + {FloatLit, "0o.", "0o.", "invalid radix point in octal literal"}, + {FloatLit, "0o.2", "0o.2", "invalid radix point in octal literal"}, + {FloatLit, "0o1.2", "0o1.2", "invalid radix point in octal literal"}, + {FloatLit, "0o1E+2", "0o1E+2", "'E' exponent requires decimal mantissa"}, + {FloatLit, "0o1p10", "0o1p10", "'p' exponent requires hexadecimal mantissa"}, + + {ImagLit, "0o10i", "0o10i", ""}, + {ImagLit, "0o10e0i", "0o10e0i", "'e' exponent requires decimal mantissa"}, + + // 0-octals + {IntLit, "0", "0", ""}, + {IntLit, "0123", "0123", ""}, + + {IntLit, "08123", "08123", "invalid digit '8' in octal literal"}, + {IntLit, "01293", "01293", "invalid digit '9' in octal literal"}, + {IntLit, "0F.", "0 F .", ""}, // only accept 0-9 + {IntLit, "0123F.", "0123 F .", ""}, + {IntLit, "0123456x", "0123456 x", ""}, + + // decimals + {IntLit, "1", "1", ""}, + {IntLit, "1234", "1234", ""}, + + {IntLit, "1f", "1 f", ""}, // only accept 0-9 + + {ImagLit, "0i", "0i", ""}, + {ImagLit, "0678i", "0678i", ""}, + + // decimal floats + {FloatLit, "0.", "0.", ""}, + {FloatLit, "123.", "123.", ""}, + {FloatLit, "0123.", "0123.", ""}, + + {FloatLit, ".0", ".0", ""}, + {FloatLit, ".123", ".123", ""}, + {FloatLit, ".0123", ".0123", ""}, + + {FloatLit, "0.0", "0.0", ""}, + {FloatLit, "123.123", "123.123", ""}, + {FloatLit, "0123.0123", "0123.0123", ""}, + + {FloatLit, "0e0", "0e0", ""}, + {FloatLit, "123e+0", "123e+0", ""}, + {FloatLit, "0123E-1", "0123E-1", ""}, + + {FloatLit, "0.e+1", "0.e+1", ""}, + {FloatLit, "123.E-10", "123.E-10", ""}, + {FloatLit, "0123.e123", "0123.e123", ""}, + + {FloatLit, ".0e-1", ".0e-1", ""}, + {FloatLit, ".123E+10", ".123E+10", ""}, + {FloatLit, ".0123E123", ".0123E123", ""}, + + {FloatLit, "0.0e1", "0.0e1", ""}, + {FloatLit, "123.123E-10", "123.123E-10", ""}, + {FloatLit, "0123.0123e+456", "0123.0123e+456", ""}, + + {FloatLit, "0e", "0e", "exponent has no digits"}, + {FloatLit, "0E+", "0E+", "exponent has no digits"}, + {FloatLit, "1e+f", "1e+ f", "exponent has no digits"}, + {FloatLit, "0p0", "0p0", "'p' exponent requires hexadecimal mantissa"}, + {FloatLit, "1.0P-1", "1.0P-1", "'P' exponent requires hexadecimal mantissa"}, + + {ImagLit, "0.i", "0.i", ""}, + {ImagLit, ".123i", ".123i", ""}, + {ImagLit, "123.123i", "123.123i", ""}, + {ImagLit, "123e+0i", "123e+0i", ""}, + {ImagLit, "123.E-10i", "123.E-10i", ""}, + {ImagLit, ".123E+10i", ".123E+10i", ""}, + + // hexadecimals + {IntLit, "0x0", "0x0", ""}, + {IntLit, "0x1234", "0x1234", ""}, + {IntLit, "0xcafef00d", "0xcafef00d", ""}, + {IntLit, "0XCAFEF00D", "0XCAFEF00D", ""}, + + {IntLit, "0x", "0x", "hexadecimal literal has no digits"}, + {IntLit, "0x1g", "0x1 g", ""}, + + {ImagLit, "0xf00i", "0xf00i", ""}, + + // hexadecimal floats + {FloatLit, "0x0p0", "0x0p0", ""}, + {FloatLit, "0x12efp-123", "0x12efp-123", ""}, + {FloatLit, "0xABCD.p+0", "0xABCD.p+0", ""}, + {FloatLit, "0x.0189P-0", "0x.0189P-0", ""}, + {FloatLit, "0x1.ffffp+1023", "0x1.ffffp+1023", ""}, + + {FloatLit, "0x.", "0x.", "hexadecimal literal has no digits"}, + {FloatLit, "0x0.", "0x0.", "hexadecimal mantissa requires a 'p' exponent"}, + {FloatLit, "0x.0", "0x.0", "hexadecimal mantissa requires a 'p' exponent"}, + {FloatLit, "0x1.1", "0x1.1", "hexadecimal mantissa requires a 'p' exponent"}, + {FloatLit, "0x1.1e0", "0x1.1e0", "hexadecimal mantissa requires a 'p' exponent"}, + {FloatLit, "0x1.2gp1a", "0x1.2 gp1a", "hexadecimal mantissa requires a 'p' exponent"}, + {FloatLit, "0x0p", "0x0p", "exponent has no digits"}, + {FloatLit, "0xeP-", "0xeP-", "exponent has no digits"}, + {FloatLit, "0x1234PAB", "0x1234P AB", "exponent has no digits"}, + {FloatLit, "0x1.2p1a", "0x1.2p1 a", ""}, + + {ImagLit, "0xf00.bap+12i", "0xf00.bap+12i", ""}, + + // separators + {IntLit, "0b_1000_0001", "0b_1000_0001", ""}, + {IntLit, "0o_600", "0o_600", ""}, + {IntLit, "0_466", "0_466", ""}, + {IntLit, "1_000", "1_000", ""}, + {FloatLit, "1_000.000_1", "1_000.000_1", ""}, + {ImagLit, "10e+1_2_3i", "10e+1_2_3i", ""}, + {IntLit, "0x_f00d", "0x_f00d", ""}, + {FloatLit, "0x_f00d.0p1_2", "0x_f00d.0p1_2", ""}, + + {IntLit, "0b__1000", "0b__1000", "'_' must separate successive digits"}, + {IntLit, "0o60___0", "0o60___0", "'_' must separate successive digits"}, + {IntLit, "0466_", "0466_", "'_' must separate successive digits"}, + {FloatLit, "1_.", "1_.", "'_' must separate successive digits"}, + {FloatLit, "0._1", "0._1", "'_' must separate successive digits"}, + {FloatLit, "2.7_e0", "2.7_e0", "'_' must separate successive digits"}, + {ImagLit, "10e+12_i", "10e+12_i", "'_' must separate successive digits"}, + {IntLit, "0x___0", "0x___0", "'_' must separate successive digits"}, + {FloatLit, "0x1.0_p0", "0x1.0_p0", "'_' must separate successive digits"}, + } { + var s scanner + var err string + s.init(strings.NewReader(test.src), func(_, _ uint, msg string) { + if err == "" { + err = msg + } + }, 0) + + for i, want := range strings.Split(test.tokens, " ") { + err = "" + s.next() + + // compute lit where where s.lit is not defined + var lit string + switch s.tok { + case _Name, _Literal: + lit = s.lit + case _Dot: + lit = "." + } + + if i == 0 { + if s.tok != _Literal || s.kind != test.kind { + t.Errorf("%q: got token %s (kind = %d); want literal (kind = %d)", test.src, s.tok, s.kind, test.kind) + } + if err != test.err { + t.Errorf("%q: got error %q; want %q", test.src, err, test.err) + } + } + + if lit != want { + t.Errorf("%q: got literal %q (%s); want %s", test.src, lit, s.tok, want) + } + } + + // make sure we read all + s.next() + if s.tok == _Semi { + s.next() + } + if s.tok != _EOF { + t.Errorf("%q: got %s; want EOF", test.src, s.tok) + } + } +} + func TestScanErrors(t *testing.T) { for _, test := range []struct { src, msg string @@ -345,12 +555,10 @@ func TestScanErrors(t *testing.T) { {"x + ~y", "invalid character U+007E '~'", 0, 4}, {"foo$bar = 0", "invalid character U+0024 '$'", 0, 3}, - {"const x = 0xyz", "malformed hex constant", 0, 12}, - {"0123456789", "malformed octal constant", 0, 10}, + {"0123456789", "invalid digit '8' in octal literal", 0, 8}, {"0123456789. /* foobar", "comment not terminated", 0, 12}, // valid float constant {"0123456789e0 /*\nfoobar", "comment not terminated", 0, 13}, // valid float constant - {"var a, b = 08, 07\n", "malformed octal constant", 0, 13}, - {"(x + 1.0e+x)", "malformed floating-point constant exponent", 0, 10}, + {"var a, b = 09, 07\n", "invalid digit '9' in octal literal", 0, 12}, {`''`, "empty character literal or unescaped ' in character literal", 0, 1}, {"'\n", "newline in character literal", 0, 1}, diff --git a/src/cmd/compile/internal/syntax/source.go b/src/cmd/compile/internal/syntax/source.go index c6168b8594..c671e3c11e 100644 --- a/src/cmd/compile/internal/syntax/source.go +++ b/src/cmd/compile/internal/syntax/source.go @@ -22,6 +22,9 @@ import ( const linebase = 1 const colbase = 1 +// max. number of bytes to unread +const maxunread = 10 + // buf [...read...|...|...unread...|s|...free...] // ^ ^ ^ ^ // | | | | @@ -59,20 +62,21 @@ func (s *source) init(src io.Reader, errh func(line, pos uint, msg string)) { s.suf = -1 } -// ungetr ungets the most recently read rune. +// ungetr sets the reading position to a previous reading +// position, usually the one of the most recently read +// rune, but possibly earlier (see unread below). func (s *source) ungetr() { s.r, s.line, s.col = s.r0, s.line0, s.col0 } -// ungetr2 is like ungetr but enables a 2nd ungetr. -// It must not be called if one of the runes seen -// was a newline or had a UTF-8 encoding longer than -// 1 byte. -func (s *source) ungetr2() { - s.ungetr() - // line must not have changed - s.r0-- - s.col0-- +// unread moves the previous reading position to a position +// that is n bytes earlier in the source. The next ungetr +// call will set the reading position to that moved position. +// The "unread" runes must be single byte and not contain any +// newlines; and 0 <= n <= maxunread must hold. +func (s *source) unread(n int) { + s.r0 -= n + s.col0 -= uint(n) } func (s *source) error(msg string) { @@ -142,7 +146,7 @@ redo: // BOM's are only allowed as the first character in a file const BOM = 0xfeff if r == BOM { - if s.r0 > 0 { // s.r0 is always > 0 after 1st character (fill will set it to 1) + if s.r0 > 0 { // s.r0 is always > 0 after 1st character (fill will set it to maxunread) s.error("invalid BOM in the middle of the file") } goto redo @@ -153,20 +157,25 @@ redo: func (s *source) fill() { // Slide unread bytes to beginning but preserve last read char - // (for one ungetr call) plus one extra byte (for a 2nd ungetr - // call, only for ".." character sequence and float literals - // starting with "."). - if s.r0 > 1 { + // (for one ungetr call) plus maxunread extra bytes (for one + // unread call). + if s.r0 > maxunread { + n := s.r0 - maxunread // number of bytes to slide down // save literal prefix, if any - // (We see at most one ungetr call while reading - // a literal, so make sure s.r0 remains in buf.) + // (make sure we keep maxunread bytes and the last + // read char in the buffer) if s.suf >= 0 { - s.lit = append(s.lit, s.buf[s.suf:s.r0]...) - s.suf = 1 // == s.r0 after slide below + // we have a literal + if s.suf < n { + // save literal prefix + s.lit = append(s.lit, s.buf[s.suf:n]...) + s.suf = 0 + } else { + s.suf -= n + } } - n := s.r0 - 1 copy(s.buf[:], s.buf[n:s.w]) - s.r0 = 1 // eqv: s.r0 -= n + s.r0 = maxunread // eqv: s.r0 -= n s.r -= n s.w -= n } diff --git a/src/cmd/compile/internal/syntax/tokens.go b/src/cmd/compile/internal/syntax/tokens.go index e00255a45e..9b26c9f12f 100644 --- a/src/cmd/compile/internal/syntax/tokens.go +++ b/src/cmd/compile/internal/syntax/tokens.go @@ -92,6 +92,9 @@ func contains(tokset uint64, tok token) bool { type LitKind uint +// TODO(gri) With the 'i' (imaginary) suffix now permitted on integer +// and floating-point numbers, having a single ImagLit does +// not represent the literal kind well anymore. Remove it? const ( IntLit LitKind = iota FloatLit diff --git a/src/cmd/compile/internal/types/type.go b/src/cmd/compile/internal/types/type.go index 3e5f5cbf49..7d123e4610 100644 --- a/src/cmd/compile/internal/types/type.go +++ b/src/cmd/compile/internal/types/type.go @@ -392,6 +392,11 @@ func (f *Field) End() int64 { return f.Offset + f.Type.Width } +// IsMethod reports whether f represents a method rather than a struct field. +func (f *Field) IsMethod() bool { + return f.Type.Etype == TFUNC && f.Type.Recv() != nil +} + // Fields is a pointer to a slice of *Field. // This saves space in Types that do not have fields or methods // compared to a simple slice of *Field. diff --git a/src/cmd/compile/internal/wasm/ssa.go b/src/cmd/compile/internal/wasm/ssa.go index 6e6dc557b4..897d6146c5 100644 --- a/src/cmd/compile/internal/wasm/ssa.go +++ b/src/cmd/compile/internal/wasm/ssa.go @@ -20,6 +20,7 @@ func Init(arch *gc.Arch) { arch.ZeroRange = zeroRange arch.ZeroAuto = zeroAuto arch.Ginsnop = ginsnop + arch.Ginsnopdefer = ginsnop arch.SSAMarkMoves = ssaMarkMoves arch.SSAGenValue = ssaGenValue diff --git a/src/cmd/compile/internal/x86/galign.go b/src/cmd/compile/internal/x86/galign.go index 56cc6c637d..7f53ee3731 100644 --- a/src/cmd/compile/internal/x86/galign.go +++ b/src/cmd/compile/internal/x86/galign.go @@ -32,6 +32,7 @@ func Init(arch *gc.Arch) { arch.ZeroRange = zerorange arch.ZeroAuto = zeroAuto arch.Ginsnop = ginsnop + arch.Ginsnopdefer = ginsnop arch.SSAMarkMoves = ssaMarkMoves } diff --git a/src/cmd/compile/internal/x86/ggen.go b/src/cmd/compile/internal/x86/ggen.go index 1851af57c4..86bb782aab 100644 --- a/src/cmd/compile/internal/x86/ggen.go +++ b/src/cmd/compile/internal/x86/ggen.go @@ -54,6 +54,7 @@ func zeroAuto(pp *gc.Progs, n *gc.Node) { } func ginsnop(pp *gc.Progs) *obj.Prog { + // See comment in ../amd64/ggen.go. p := pp.Prog(x86.AXCHGL) p.From.Type = obj.TYPE_REG p.From.Reg = x86.REG_AX diff --git a/src/cmd/cover/cover_test.go b/src/cmd/cover/cover_test.go index 3de9b0c12d..f002442b63 100644 --- a/src/cmd/cover/cover_test.go +++ b/src/cmd/cover/cover_test.go @@ -448,6 +448,10 @@ func TestHtmlUnformatted(t *testing.T) { t.Fatal(err) } + if err := ioutil.WriteFile(filepath.Join(htmlUDir, "go.mod"), []byte("module htmlunformatted\n"), 0444); err != nil { + t.Fatal(err) + } + const htmlUContents = ` package htmlunformatted @@ -475,6 +479,7 @@ lab: // testcover -html TMPDIR/htmlunformatted.cov -o unformatted.html cmd = exec.Command(testcover, "-html", htmlUProfile, "-o", htmlUHTML) + cmd.Dir = htmlUDir run(cmd, t) } diff --git a/src/cmd/dist/build.go b/src/cmd/dist/build.go index ad2c96436a..43e1fe66f3 100644 --- a/src/cmd/dist/build.go +++ b/src/cmd/dist/build.go @@ -1366,14 +1366,46 @@ func cmdbootstrap() { // Remove go_bootstrap now that we're done. xremove(pathf("%s/go_bootstrap", tooldir)) + if goos == "android" { + // Make sure the exec wrapper will sync a fresh $GOROOT to the device. + xremove(pathf("%s/go_android_exec-adb-sync-status", os.TempDir())) + } + + if wrapperPath := wrapperPathFor(goos, goarch); wrapperPath != "" { + oldcc := os.Getenv("CC") + os.Setenv("GOOS", gohostos) + os.Setenv("GOARCH", gohostarch) + os.Setenv("CC", compilerEnvLookup(defaultcc, gohostos, gohostarch)) + goCmd(cmdGo, "build", "-o", pathf("%s/go_%s_%s_exec%s", gobin, goos, goarch, exe), wrapperPath) + // Restore environment. + // TODO(elias.naur): support environment variables in goCmd? + os.Setenv("GOOS", goos) + os.Setenv("GOARCH", goarch) + os.Setenv("CC", oldcc) + } + // Print trailing banner unless instructed otherwise. if !noBanner { banner() } } +func wrapperPathFor(goos, goarch string) string { + switch { + case goos == "android": + return pathf("%s/misc/android/go_android_exec.go", goroot) + case goos == "darwin" && (goarch == "arm" || goarch == "arm64"): + return pathf("%s/misc/ios/go_darwin_arm_exec.go", goroot) + } + return "" +} + func goInstall(goBinary string, args ...string) { - installCmd := []string{goBinary, "install", "-gcflags=all=" + gogcflags, "-ldflags=all=" + goldflags} + goCmd(goBinary, "install", args...) +} + +func goCmd(goBinary string, cmd string, args ...string) { + installCmd := []string{goBinary, cmd, "-gcflags=all=" + gogcflags, "-ldflags=all=" + goldflags} if vflag > 0 { installCmd = append(installCmd, "-v") } diff --git a/src/cmd/dist/test.go b/src/cmd/dist/test.go index 74cee8f421..6f2eee19df 100644 --- a/src/cmd/dist/test.go +++ b/src/cmd/dist/test.go @@ -6,7 +6,6 @@ package main import ( "bytes" - "errors" "flag" "fmt" "io/ioutil" @@ -611,7 +610,7 @@ func (t *tester) registerTests() { name: "cgo_stdio", heading: "../misc/cgo/stdio", fn: func(dt *distTest) error { - t.addCmd(dt, "misc/cgo/stdio", "go", "run", filepath.Join(os.Getenv("GOROOT"), "test/run.go"), "-", ".") + t.addCmd(dt, "misc/cgo/stdio", t.goTest(), t.timeout(120)) return nil }, }) @@ -619,7 +618,7 @@ func (t *tester) registerTests() { name: "cgo_life", heading: "../misc/cgo/life", fn: func(dt *distTest) error { - t.addCmd(dt, "misc/cgo/life", "go", "run", filepath.Join(os.Getenv("GOROOT"), "test/run.go"), "-", ".") + t.addCmd(dt, "misc/cgo/life", t.goTest(), t.timeout(120)) return nil }, }) @@ -627,7 +626,7 @@ func (t *tester) registerTests() { if fortran == "" { fortran, _ = exec.LookPath("gfortran") } - if t.hasBash() && fortran != "" { + if t.hasBash() && goos != "android" && fortran != "" { t.tests = append(t.tests, distTest{ name: "cgo_fortran", heading: "../misc/cgo/fortran", @@ -675,33 +674,19 @@ func (t *tester) registerTests() { // recompile the entire standard library. If make.bash ran with // special -gcflags, that's not true. if t.cgoEnabled && gogcflags == "" { - if t.cgoTestSOSupported() { - t.tests = append(t.tests, distTest{ - name: "testso", - heading: "../misc/cgo/testso", - fn: func(dt *distTest) error { - return t.cgoTestSO(dt, "misc/cgo/testso") - }, - }) - t.tests = append(t.tests, distTest{ - name: "testsovar", - heading: "../misc/cgo/testsovar", - fn: func(dt *distTest) error { - return t.cgoTestSO(dt, "misc/cgo/testsovar") - }, - }) - } + t.registerHostTest("testso", "../misc/cgo/testso", "misc/cgo/testso", ".") + t.registerHostTest("testsovar", "../misc/cgo/testsovar", "misc/cgo/testsovar", ".") if t.supportedBuildmode("c-archive") { - t.registerHostTest("testcarchive", "../misc/cgo/testcarchive", "misc/cgo/testcarchive", "carchive_test.go") + t.registerHostTest("testcarchive", "../misc/cgo/testcarchive", "misc/cgo/testcarchive", ".") } if t.supportedBuildmode("c-shared") { - t.registerHostTest("testcshared", "../misc/cgo/testcshared", "misc/cgo/testcshared", "cshared_test.go") + t.registerHostTest("testcshared", "../misc/cgo/testcshared", "misc/cgo/testcshared", ".") } if t.supportedBuildmode("shared") { t.registerTest("testshared", "../misc/cgo/testshared", t.goTest(), t.timeout(600)) } if t.supportedBuildmode("plugin") { - t.registerTest("testplugin", "../misc/cgo/testplugin", "./test.bash") + t.registerTest("testplugin", "../misc/cgo/testplugin", t.goTest(), t.timeout(600)) } if gohostos == "linux" && goarch == "amd64" { t.registerTest("testasan", "../misc/cgo/testasan", "go", "run", "main.go") @@ -1166,85 +1151,6 @@ func (t *tester) runPending(nextTest *distTest) { } } -func (t *tester) cgoTestSOSupported() bool { - if goos == "android" || t.iOS() { - // No exec facility on Android or iOS. - return false - } - if goarch == "ppc64" { - // External linking not implemented on ppc64 (issue #8912). - return false - } - if goarch == "mips64le" || goarch == "mips64" { - // External linking not implemented on mips64. - return false - } - return true -} - -func (t *tester) cgoTestSO(dt *distTest, testpath string) error { - t.runPending(dt) - - timelog("start", dt.name) - defer timelog("end", dt.name) - - dir := filepath.Join(goroot, testpath) - - // build shared object - output, err := exec.Command("go", "env", "CC").Output() - if err != nil { - return fmt.Errorf("Error running go env CC: %v", err) - } - cc := strings.TrimSuffix(string(output), "\n") - if cc == "" { - return errors.New("CC environment variable (go env CC) cannot be empty") - } - output, err = exec.Command("go", "env", "GOGCCFLAGS").Output() - if err != nil { - return fmt.Errorf("Error running go env GOGCCFLAGS: %v", err) - } - gogccflags := strings.Split(strings.TrimSuffix(string(output), "\n"), " ") - - ext := "so" - args := append(gogccflags, "-shared") - switch goos { - case "darwin": - ext = "dylib" - args = append(args, "-undefined", "suppress", "-flat_namespace") - case "windows": - ext = "dll" - args = append(args, "-DEXPORT_DLL") - } - sofname := "libcgosotest." + ext - args = append(args, "-o", sofname, "cgoso_c.c") - - if err := t.dirCmd(dir, cc, args).Run(); err != nil { - return err - } - defer os.Remove(filepath.Join(dir, sofname)) - - if err := t.dirCmd(dir, "go", "build", "-o", "main.exe", "main.go").Run(); err != nil { - return err - } - defer os.Remove(filepath.Join(dir, "main.exe")) - - cmd := t.dirCmd(dir, "./main.exe") - if goos != "windows" { - s := "LD_LIBRARY_PATH" - if goos == "darwin" { - s = "DYLD_LIBRARY_PATH" - } - cmd.Env = append(os.Environ(), s+"=.") - - // On FreeBSD 64-bit architectures, the 32-bit linker looks for - // different environment variables. - if goos == "freebsd" && gohostarch == "386" { - cmd.Env = append(cmd.Env, "LD_32_LIBRARY_PATH=.") - } - } - return cmd.Run() -} - func (t *tester) hasBash() bool { switch gohostos { case "windows", "plan9": diff --git a/src/cmd/go/go_test.go b/src/cmd/go/go_test.go index 5e18629859..e85d3d2507 100644 --- a/src/cmd/go/go_test.go +++ b/src/cmd/go/go_test.go @@ -394,6 +394,7 @@ func (tg *testgoData) setenv(name, val string) { func (tg *testgoData) unsetenv(name string) { if tg.env == nil { tg.env = append([]string(nil), os.Environ()...) + tg.env = append(tg.env, "GO111MODULE=off") } for i, v := range tg.env { if strings.HasPrefix(v, name+"=") { diff --git a/src/cmd/go/internal/imports/scan.go b/src/cmd/go/internal/imports/scan.go index 966a38cfef..3d9b6132b1 100644 --- a/src/cmd/go/internal/imports/scan.go +++ b/src/cmd/go/internal/imports/scan.go @@ -26,7 +26,7 @@ func ScanDir(dir string, tags map[string]bool) ([]string, []string, error) { // If the directory entry is a symlink, stat it to obtain the info for the // link target instead of the link itself. if info.Mode()&os.ModeSymlink != 0 { - info, err = os.Stat(name) + info, err = os.Stat(filepath.Join(dir, name)) if err != nil { continue // Ignore broken symlinks. } diff --git a/src/cmd/go/internal/modcmd/tidy.go b/src/cmd/go/internal/modcmd/tidy.go index 839c92a0a0..789e936608 100644 --- a/src/cmd/go/internal/modcmd/tidy.go +++ b/src/cmd/go/internal/modcmd/tidy.go @@ -75,6 +75,7 @@ func modTidyGoSum() { // we only have to tell modfetch what needs keeping. reqs := modload.Reqs() keep := make(map[module.Version]bool) + replaced := make(map[module.Version]bool) var walk func(module.Version) walk = func(m module.Version) { // If we build using a replacement module, keep the sum for the replacement, @@ -87,10 +88,11 @@ func modTidyGoSum() { keep[m] = true } else { keep[r] = true + replaced[m] = true } list, _ := reqs.Required(m) for _, r := range list { - if !keep[r] { + if !keep[r] && !replaced[r] { walk(r) } } diff --git a/src/cmd/go/internal/modload/init.go b/src/cmd/go/internal/modload/init.go index 22d14ccce7..a0514d425e 100644 --- a/src/cmd/go/internal/modload/init.go +++ b/src/cmd/go/internal/modload/init.go @@ -154,7 +154,7 @@ func Init() { die() // Don't init a module that we're just going to ignore. } // No automatic enabling in GOPATH. - if root, _ := FindModuleRoot(cwd, "", false); root != "" { + if root := findModuleRoot(cwd); root != "" { cfg.GoModInGOPATH = filepath.Join(root, "go.mod") } return @@ -164,7 +164,7 @@ func Init() { // Running 'go mod init': go.mod will be created in current directory. modRoot = cwd } else { - modRoot, _ = FindModuleRoot(cwd, "", MustUseModules) + modRoot = findModuleRoot(cwd) if modRoot == "" { if !MustUseModules { // GO111MODULE is 'auto' (or unset), and we can't find a module root. @@ -302,6 +302,19 @@ func die() { if inGOPATH && !MustUseModules { base.Fatalf("go: modules disabled inside GOPATH/src by GO111MODULE=auto; see 'go help modules'") } + if cwd != "" { + if dir, name := findAltConfig(cwd); dir != "" { + rel, err := filepath.Rel(cwd, dir) + if err != nil { + rel = dir + } + cdCmd := "" + if rel != "." { + cdCmd = fmt.Sprintf("cd %s && ", rel) + } + base.Fatalf("go: cannot find main module, but found %s in %s\n\tto create a module there, run:\n\t%sgo mod init", name, dir, cdCmd) + } + } base.Fatalf("go: cannot find main module; see 'go help modules'") } @@ -330,12 +343,6 @@ func InitMod() { gomod := filepath.Join(modRoot, "go.mod") data, err := ioutil.ReadFile(gomod) if err != nil { - if os.IsNotExist(err) { - legacyModInit() - modFileToBuildList() - WriteGoMod() - return - } base.Fatalf("go: %v", err) } @@ -349,7 +356,7 @@ func InitMod() { if len(f.Syntax.Stmt) == 0 || f.Module == nil { // Empty mod file. Must add module path. - path, err := FindModulePath(modRoot) + path, err := findModulePath(modRoot) if err != nil { base.Fatalf("go: %v", err) } @@ -387,7 +394,7 @@ func Allowed(m module.Version) bool { func legacyModInit() { if modFile == nil { - path, err := FindModulePath(modRoot) + path, err := findModulePath(modRoot) if err != nil { base.Fatalf("go: %v", err) } @@ -454,19 +461,13 @@ var altConfigs = []string{ ".git/config", } -// Exported only for testing. -func FindModuleRoot(dir, limit string, legacyConfigOK bool) (root, file string) { +func findModuleRoot(dir string) (root string) { dir = filepath.Clean(dir) - dir1 := dir - limit = filepath.Clean(limit) // Look for enclosing go.mod. for { if fi, err := os.Stat(filepath.Join(dir, "go.mod")); err == nil && !fi.IsDir() { - return dir, "go.mod" - } - if dir == limit { - break + return dir } d := filepath.Dir(dir) if d == dir { @@ -474,37 +475,41 @@ func FindModuleRoot(dir, limit string, legacyConfigOK bool) (root, file string) } dir = d } + return "" +} - // Failing that, look for enclosing alternate version config. - if legacyConfigOK { - dir = dir1 - for { - for _, name := range altConfigs { - if fi, err := os.Stat(filepath.Join(dir, name)); err == nil && !fi.IsDir() { - return dir, name +func findAltConfig(dir string) (root, name string) { + dir = filepath.Clean(dir) + for { + for _, name := range altConfigs { + if fi, err := os.Stat(filepath.Join(dir, name)); err == nil && !fi.IsDir() { + if rel := search.InDir(dir, cfg.BuildContext.GOROOT); rel == "." { + // Don't suggest creating a module from $GOROOT/.git/config. + return "", "" } + return dir, name } - if dir == limit { - break - } - d := filepath.Dir(dir) - if d == dir { - break - } - dir = d } + d := filepath.Dir(dir) + if d == dir { + break + } + dir = d } - return "", "" } -// Exported only for testing. -func FindModulePath(dir string) (string, error) { +func findModulePath(dir string) (string, error) { if CmdModModule != "" { // Running go mod init x/y/z; return x/y/z. return CmdModModule, nil } + // TODO(bcmills): once we have located a plausible module path, we should + // query version control (if available) to verify that it matches the major + // version of the most recent tag. + // See https://golang.org/issue/29433 and https://golang.org/issue/27009. + // Cast about for import comments, // first in top-level directory, then in subdirectories. list, _ := ioutil.ReadDir(dir) diff --git a/src/cmd/go/internal/modload/init_test.go b/src/cmd/go/internal/modload/init_test.go deleted file mode 100644 index 2df9d8af7d..0000000000 --- a/src/cmd/go/internal/modload/init_test.go +++ /dev/null @@ -1,42 +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. - -package modload - -import ( - "io/ioutil" - "os" - "path/filepath" - "testing" -) - -func TestFindModuleRootIgnoreDir(t *testing.T) { - // In Plan 9, directories are automatically created in /n. - // For example, /n/go.mod always exist, but it's a directory. - // Test that we ignore directories when trying to find go.mod and other config files. - - dir, err := ioutil.TempDir("", "gotest") - if err != nil { - t.Fatalf("failed to create temporary directory: %v", err) - } - defer os.RemoveAll(dir) - if err := os.Mkdir(filepath.Join(dir, "go.mod"), os.ModeDir|0755); err != nil { - t.Fatalf("Mkdir failed: %v", err) - } - for _, name := range altConfigs { - if err := os.MkdirAll(filepath.Join(dir, name), os.ModeDir|0755); err != nil { - t.Fatalf("MkdirAll failed: %v", err) - } - } - p := filepath.Join(dir, "example") - if err := os.Mkdir(p, os.ModeDir|0755); err != nil { - t.Fatalf("Mkdir failed: %v", err) - } - if root, _ := FindModuleRoot(p, "", false); root != "" { - t.Errorf("FindModuleRoot(%q, \"\", false): %q, want empty string", p, root) - } - if root, _ := FindModuleRoot(p, "", true); root != "" { - t.Errorf("FindModuleRoot(%q, \"\", true): %q, want empty string", p, root) - } -} diff --git a/src/cmd/go/internal/modload/load.go b/src/cmd/go/internal/modload/load.go index 5bb943dd6d..6d6c037af2 100644 --- a/src/cmd/go/internal/modload/load.go +++ b/src/cmd/go/internal/modload/load.go @@ -111,7 +111,7 @@ func ImportPaths(patterns []string) []*search.Match { } else { pkg = Target.Path + suffix } - } else if sub := search.InDir(dir, cfg.GOROOTsrc); sub != "" && !strings.Contains(sub, "@") { + } else if sub := search.InDir(dir, cfg.GOROOTsrc); sub != "" && sub != "." && !strings.Contains(sub, "@") { pkg = filepath.ToSlash(sub) } else if path := pathInModuleCache(dir); path != "" { pkg = path diff --git a/src/cmd/go/internal/work/exec.go b/src/cmd/go/internal/work/exec.go index baa5872687..bbcbdd7568 100644 --- a/src/cmd/go/internal/work/exec.go +++ b/src/cmd/go/internal/work/exec.go @@ -655,7 +655,7 @@ func (b *Builder) build(a *Action) (err error) { if len(out) > 0 { output := b.processOutput(out) if p.Module != nil && !allowedVersion(p.Module.GoVersion) { - output += "note: module requires Go " + p.Module.GoVersion + output += "note: module requires Go " + p.Module.GoVersion + "\n" } b.showOutput(a, a.Package.Dir, a.Package.Desc(), output) if err != nil { diff --git a/src/cmd/go/script_test.go b/src/cmd/go/script_test.go index c56c1fd3e4..c5e0064036 100644 --- a/src/cmd/go/script_test.go +++ b/src/cmd/go/script_test.go @@ -83,7 +83,12 @@ type backgroundCmd struct { } var extraEnvKeys = []string{ - "SYSTEMROOT", // must be preserved on Windows to find DLLs; golang.org/issue/25210 + "SYSTEMROOT", // must be preserved on Windows to find DLLs; golang.org/issue/25210 + "LD_LIBRARY_PATH", // must be preserved on Unix systems to find shared libraries + "CC", // don't lose user settings when invoking cgo + "GO_TESTING_GOTOOLS", // for gccgo testing + "GCCGO", // for gccgo testing + "GCCGOTOOLDIR", // for gccgo testing } // setup sets up the test execution temporary directory and environment. @@ -509,16 +514,33 @@ func (ts *testScript) cmdCp(neg bool, args []string) { } for _, arg := range args[:len(args)-1] { - src := ts.mkabs(arg) - info, err := os.Stat(src) - ts.check(err) - data, err := ioutil.ReadFile(src) - ts.check(err) + var ( + src string + data []byte + mode os.FileMode + ) + switch arg { + case "stdout": + src = arg + data = []byte(ts.stdout) + mode = 0666 + case "stderr": + src = arg + data = []byte(ts.stderr) + mode = 0666 + default: + src = ts.mkabs(arg) + info, err := os.Stat(src) + ts.check(err) + mode = info.Mode() & 0777 + data, err = ioutil.ReadFile(src) + ts.check(err) + } targ := dst if dstDir { targ = filepath.Join(dst, filepath.Base(src)) } - ts.check(ioutil.WriteFile(targ, data, info.Mode()&0777)) + ts.check(ioutil.WriteFile(targ, data, mode)) } } diff --git a/src/cmd/go/testdata/script/README b/src/cmd/go/testdata/script/README index a7b50fff16..0c34333823 100644 --- a/src/cmd/go/testdata/script/README +++ b/src/cmd/go/testdata/script/README @@ -108,6 +108,8 @@ The commands are: - cp src... dst Copy the listed files to the target file or existing directory. + src can include "stdout" or "stderr" to use the standard output or standard error + from the most recent exec or go command. - env [key=value...] With no arguments, print the environment (useful for debugging). diff --git a/src/cmd/go/testdata/script/binary_only.txt b/src/cmd/go/testdata/script/binary_only.txt index 397904efaa..1842d8cea3 100644 --- a/src/cmd/go/testdata/script/binary_only.txt +++ b/src/cmd/go/testdata/script/binary_only.txt @@ -1,3 +1,5 @@ +env GO111MODULE=off + # check that error for missing binary-only says where it should be ! go build b stderr pkg[\\/].*a\.a diff --git a/src/cmd/go/testdata/script/build_GOTMPDIR.txt b/src/cmd/go/testdata/script/build_GOTMPDIR.txt index ea06dcc472..da54ced524 100644 --- a/src/cmd/go/testdata/script/build_GOTMPDIR.txt +++ b/src/cmd/go/testdata/script/build_GOTMPDIR.txt @@ -1,3 +1,5 @@ +env GO111MODULE=off + # Set GOCACHE to a clean directory to ensure that 'go build' has work to report. env GOCACHE=$WORK/gocache diff --git a/src/cmd/go/testdata/script/build_cache_compile.txt b/src/cmd/go/testdata/script/build_cache_compile.txt index 7db881a268..04a6f9af1d 100644 --- a/src/cmd/go/testdata/script/build_cache_compile.txt +++ b/src/cmd/go/testdata/script/build_cache_compile.txt @@ -1,3 +1,5 @@ +env GO111MODULE=off + # Set up fresh GOCACHE. env GOCACHE=$WORK/gocache mkdir $GOCACHE diff --git a/src/cmd/go/testdata/script/build_cache_gomips.txt b/src/cmd/go/testdata/script/build_cache_gomips.txt index c77acc3f2f..3218354929 100644 --- a/src/cmd/go/testdata/script/build_cache_gomips.txt +++ b/src/cmd/go/testdata/script/build_cache_gomips.txt @@ -1,3 +1,5 @@ +env GO111MODULE=off + # Set up fresh GOCACHE. env GOCACHE=$WORK/gocache mkdir $GOCACHE diff --git a/src/cmd/go/testdata/script/build_cache_link.txt b/src/cmd/go/testdata/script/build_cache_link.txt index 61e7ee46d3..658bb88496 100644 --- a/src/cmd/go/testdata/script/build_cache_link.txt +++ b/src/cmd/go/testdata/script/build_cache_link.txt @@ -1,3 +1,5 @@ +env GO111MODULE=off + # Set up fresh GOCACHE. env GOCACHE=$WORK/gocache mkdir $GOCACHE diff --git a/src/cmd/go/testdata/script/build_cache_output.txt b/src/cmd/go/testdata/script/build_cache_output.txt index ee4099e5f3..41c84ace7a 100644 --- a/src/cmd/go/testdata/script/build_cache_output.txt +++ b/src/cmd/go/testdata/script/build_cache_output.txt @@ -1,3 +1,5 @@ +env GO111MODULE=off + [!gc] skip # Set up fresh GOCACHE. diff --git a/src/cmd/go/testdata/script/build_nocache.txt b/src/cmd/go/testdata/script/build_nocache.txt index 5aa46e0b77..46e95fa89d 100644 --- a/src/cmd/go/testdata/script/build_nocache.txt +++ b/src/cmd/go/testdata/script/build_nocache.txt @@ -1,3 +1,5 @@ +env GO111MODULE=off + # As of Go 1.12, the module cache is required. # If none of the variables we use to locate GOCACHE are set, the cache is off diff --git a/src/cmd/go/testdata/script/build_relative_pkgdir.txt b/src/cmd/go/testdata/script/build_relative_pkgdir.txt index 76098a0662..0716bcd56a 100644 --- a/src/cmd/go/testdata/script/build_relative_pkgdir.txt +++ b/src/cmd/go/testdata/script/build_relative_pkgdir.txt @@ -1,3 +1,5 @@ +env GO111MODULE=off + # Regression test for golang.org/issue/21309: accept relative -pkgdir argument. [short] skip diff --git a/src/cmd/go/testdata/script/build_relative_tmpdir.txt b/src/cmd/go/testdata/script/build_relative_tmpdir.txt index 9490a285d3..3e98a67b81 100644 --- a/src/cmd/go/testdata/script/build_relative_tmpdir.txt +++ b/src/cmd/go/testdata/script/build_relative_tmpdir.txt @@ -1,3 +1,5 @@ +env GO111MODULE=off + # If GOTMPDIR is relative, 'go build' should derive an absolute $WORK directory. cd $WORK mkdir tmp diff --git a/src/cmd/go/testdata/script/build_runtime_gcflags.txt b/src/cmd/go/testdata/script/build_runtime_gcflags.txt index 767b768b82..5354a73935 100644 --- a/src/cmd/go/testdata/script/build_runtime_gcflags.txt +++ b/src/cmd/go/testdata/script/build_runtime_gcflags.txt @@ -1,3 +1,5 @@ +env GO111MODULE=off + # Set up fresh GOCACHE. env GOCACHE=$WORK/gocache mkdir $GOCACHE diff --git a/src/cmd/go/testdata/script/cache_unix.txt b/src/cmd/go/testdata/script/cache_unix.txt index f700ebe3ed..0e07ba6382 100644 --- a/src/cmd/go/testdata/script/cache_unix.txt +++ b/src/cmd/go/testdata/script/cache_unix.txt @@ -1,3 +1,5 @@ +env GO111MODULE=off + # Integration test for cache directory calculation (cmd/go/internal/cache). [windows] skip diff --git a/src/cmd/go/testdata/script/cgo_syso_issue29253.txt b/src/cmd/go/testdata/script/cgo_syso_issue29253.txt index 0d18fa91d6..9825d1e3e9 100644 --- a/src/cmd/go/testdata/script/cgo_syso_issue29253.txt +++ b/src/cmd/go/testdata/script/cgo_syso_issue29253.txt @@ -1,3 +1,5 @@ +env GO111MODULE=off + # This test tests that we can link in-package syso files that provides symbols # for cgo. See issue 29253. [!cgo] stop diff --git a/src/cmd/go/testdata/script/clean_testcache.txt b/src/cmd/go/testdata/script/clean_testcache.txt index a2d592deff..5ac968b7d0 100644 --- a/src/cmd/go/testdata/script/clean_testcache.txt +++ b/src/cmd/go/testdata/script/clean_testcache.txt @@ -1,3 +1,5 @@ +env GO111MODULE=off + # go clean -testcache # should work (see golang.org/issue/29757). cd x diff --git a/src/cmd/go/testdata/script/cover_atomic_pkgall.txt b/src/cmd/go/testdata/script/cover_atomic_pkgall.txt index c122c05cb6..c3bc67df53 100644 --- a/src/cmd/go/testdata/script/cover_atomic_pkgall.txt +++ b/src/cmd/go/testdata/script/cover_atomic_pkgall.txt @@ -1,3 +1,5 @@ +env GO111MODULE=off + [short] skip go test -coverpkg=all -covermode=atomic x diff --git a/src/cmd/go/testdata/script/cover_pkgall_runtime.txt b/src/cmd/go/testdata/script/cover_pkgall_runtime.txt index 5d169d6312..9927c30690 100644 --- a/src/cmd/go/testdata/script/cover_pkgall_runtime.txt +++ b/src/cmd/go/testdata/script/cover_pkgall_runtime.txt @@ -1,3 +1,5 @@ +env GO111MODULE=off + # Issue 23882 [short] skip diff --git a/src/cmd/go/testdata/script/cpu_profile_twice.txt b/src/cmd/go/testdata/script/cpu_profile_twice.txt index 142d5ee718..38d6439fb1 100644 --- a/src/cmd/go/testdata/script/cpu_profile_twice.txt +++ b/src/cmd/go/testdata/script/cpu_profile_twice.txt @@ -1,3 +1,5 @@ +env GO111MODULE=off + # Issue 23150 [short] skip diff --git a/src/cmd/go/testdata/script/fileline.txt b/src/cmd/go/testdata/script/fileline.txt index cdc3be2df8..5cb35f0dac 100644 --- a/src/cmd/go/testdata/script/fileline.txt +++ b/src/cmd/go/testdata/script/fileline.txt @@ -1,3 +1,5 @@ +env GO111MODULE=off + # look for short, relative file:line in error message ! go run ../../gopath/x/y/z/err.go stderr ^..[\\/]x[\\/]y[\\/]z[\\/]err.go: diff --git a/src/cmd/go/testdata/script/gcflags_patterns.txt b/src/cmd/go/testdata/script/gcflags_patterns.txt index 40f80b7d6e..c790ddda0a 100644 --- a/src/cmd/go/testdata/script/gcflags_patterns.txt +++ b/src/cmd/go/testdata/script/gcflags_patterns.txt @@ -1,3 +1,5 @@ +env GO111MODULE=off + [!gc] skip 'using -gcflags and -ldflags' # -gcflags=-e applies to named packages, not dependencies @@ -25,6 +27,10 @@ stderr 'compile.* -e.* -p z1' go test -c -n -gcflags='all=-e' z1 stderr 'compile.* -e.* -p z3 ' +# this particular -gcflags argument made the compiler crash +! go build -gcflags=-d=ssa/ z1 +stderr 'PhaseOptions usage' + # -ldflags for implicit test package applies to test binary go test -c -n -gcflags=-N -ldflags=-X=x.y=z z1 stderr 'compile.* -N .*z_test.go' diff --git a/src/cmd/go/testdata/script/get_brace.txt b/src/cmd/go/testdata/script/get_brace.txt index be81d8f487..3449a0c2c8 100644 --- a/src/cmd/go/testdata/script/get_brace.txt +++ b/src/cmd/go/testdata/script/get_brace.txt @@ -1,3 +1,5 @@ +env GO111MODULE=off + [!exec:git] skip # Set up some empty repositories. diff --git a/src/cmd/go/testdata/script/get_dotfiles.txt b/src/cmd/go/testdata/script/get_dotfiles.txt index 1876114362..38a3fac612 100644 --- a/src/cmd/go/testdata/script/get_dotfiles.txt +++ b/src/cmd/go/testdata/script/get_dotfiles.txt @@ -1,3 +1,5 @@ +env GO111MODULE=off + [!exec:git] skip # Set up a benign repository and a repository with a dotfile name. diff --git a/src/cmd/go/testdata/script/get_tilde.txt b/src/cmd/go/testdata/script/get_tilde.txt index 08289ca405..6d18174acc 100644 --- a/src/cmd/go/testdata/script/get_tilde.txt +++ b/src/cmd/go/testdata/script/get_tilde.txt @@ -1,3 +1,5 @@ +env GO111MODULE=off + # Paths containing windows short names should be rejected before attempting to fetch. ! go get example.com/longna~1.dir/thing stderr 'trailing tilde and digits' diff --git a/src/cmd/go/testdata/script/get_unicode.txt b/src/cmd/go/testdata/script/get_unicode.txt index 31edcdb9f6..ab1b914f50 100644 --- a/src/cmd/go/testdata/script/get_unicode.txt +++ b/src/cmd/go/testdata/script/get_unicode.txt @@ -1,3 +1,5 @@ +env GO111MODULE=off + [!exec:git] skip # Construct a repository that imports a non-ASCII path. diff --git a/src/cmd/go/testdata/script/get_with_git_trace.txt b/src/cmd/go/testdata/script/get_with_git_trace.txt index 93341a302c..98854c72ad 100644 --- a/src/cmd/go/testdata/script/get_with_git_trace.txt +++ b/src/cmd/go/testdata/script/get_with_git_trace.txt @@ -1,3 +1,5 @@ +env GO111MODULE=off + env GIT_TRACE=1 [!net] skip diff --git a/src/cmd/go/testdata/script/goflags.txt b/src/cmd/go/testdata/script/goflags.txt index 20de325ac2..fac6d80720 100644 --- a/src/cmd/go/testdata/script/goflags.txt +++ b/src/cmd/go/testdata/script/goflags.txt @@ -1,3 +1,5 @@ +env GO111MODULE=off + # GOFLAGS sets flags for commands env GOFLAGS='-e -f={{.Dir}} --test.benchtime=1s -count=10' diff --git a/src/cmd/go/testdata/script/help.txt b/src/cmd/go/testdata/script/help.txt index 9f455256f7..e6cbc82928 100644 --- a/src/cmd/go/testdata/script/help.txt +++ b/src/cmd/go/testdata/script/help.txt @@ -1,3 +1,5 @@ +env GO111MODULE=off + # go help shows overview. go help stdout 'Go is a tool' diff --git a/src/cmd/go/testdata/script/install_cleans_build.txt b/src/cmd/go/testdata/script/install_cleans_build.txt index b8d322de62..7f1b917439 100644 --- a/src/cmd/go/testdata/script/install_cleans_build.txt +++ b/src/cmd/go/testdata/script/install_cleans_build.txt @@ -1,3 +1,5 @@ +env GO111MODULE=off + # 'go install' with no arguments should clean up after go build cd mycmd go build diff --git a/src/cmd/go/testdata/script/install_cross_gobin.txt b/src/cmd/go/testdata/script/install_cross_gobin.txt index 587081f135..d9ab35c2e1 100644 --- a/src/cmd/go/testdata/script/install_cross_gobin.txt +++ b/src/cmd/go/testdata/script/install_cross_gobin.txt @@ -1,3 +1,5 @@ +env GO111MODULE=off + cd mycmd go build mycmd diff --git a/src/cmd/go/testdata/script/install_rebuild_gopath.txt b/src/cmd/go/testdata/script/install_rebuild_gopath.txt index d42b07004b..14a6c8611e 100644 --- a/src/cmd/go/testdata/script/install_rebuild_gopath.txt +++ b/src/cmd/go/testdata/script/install_rebuild_gopath.txt @@ -1,3 +1,5 @@ +env GO111MODULE=off + # GOPATH with p1 in d1, p2 in d2 env GOPATH=$WORK/d1${:}$WORK/d2 diff --git a/src/cmd/go/testdata/script/install_rebuild_removed.txt b/src/cmd/go/testdata/script/install_rebuild_removed.txt index e7620a08ca..5db3778d8e 100644 --- a/src/cmd/go/testdata/script/install_rebuild_removed.txt +++ b/src/cmd/go/testdata/script/install_rebuild_removed.txt @@ -1,3 +1,5 @@ +env GO111MODULE=off + # go command should detect package staleness as source file set changes go install mypkg ! stale mypkg diff --git a/src/cmd/go/testdata/script/linkname.txt b/src/cmd/go/testdata/script/linkname.txt index e2ec00c6ed..11336594d3 100644 --- a/src/cmd/go/testdata/script/linkname.txt +++ b/src/cmd/go/testdata/script/linkname.txt @@ -1,3 +1,5 @@ +env GO111MODULE=off + # check for linker name in error message about linker crash [!gc] skip ! go build -ldflags=-crash_for_testing x.go diff --git a/src/cmd/go/testdata/script/list_bad_import.txt b/src/cmd/go/testdata/script/list_bad_import.txt index 3d9cac0d5f..958c576c53 100644 --- a/src/cmd/go/testdata/script/list_bad_import.txt +++ b/src/cmd/go/testdata/script/list_bad_import.txt @@ -1,3 +1,5 @@ +env GO111MODULE=off + # This test matches mod_list_bad_import, but in GOPATH mode. # Please keep them in sync. diff --git a/src/cmd/go/testdata/script/list_compiled_imports.txt b/src/cmd/go/testdata/script/list_compiled_imports.txt index e6f5abb6af..7780b074c1 100644 --- a/src/cmd/go/testdata/script/list_compiled_imports.txt +++ b/src/cmd/go/testdata/script/list_compiled_imports.txt @@ -1,3 +1,5 @@ +env GO111MODULE=off + [!cgo] skip # go list should report import "C" diff --git a/src/cmd/go/testdata/script/list_find.txt b/src/cmd/go/testdata/script/list_find.txt index 63c6896e50..aaac6585dd 100644 --- a/src/cmd/go/testdata/script/list_find.txt +++ b/src/cmd/go/testdata/script/list_find.txt @@ -1,3 +1,5 @@ +env GO111MODULE=off + # go list -find should not report imports go list -f {{.Incomplete}} x/y/z... # should probably exit non-zero but never has diff --git a/src/cmd/go/testdata/script/list_importmap.txt b/src/cmd/go/testdata/script/list_importmap.txt index a42dc47f24..52ee6028f5 100644 --- a/src/cmd/go/testdata/script/list_importmap.txt +++ b/src/cmd/go/testdata/script/list_importmap.txt @@ -1,3 +1,5 @@ +env GO111MODULE=off + # gccgo does not have standard packages. [gccgo] skip diff --git a/src/cmd/go/testdata/script/list_std.txt b/src/cmd/go/testdata/script/list_std.txt index 046bec6ac5..88a659f743 100644 --- a/src/cmd/go/testdata/script/list_std.txt +++ b/src/cmd/go/testdata/script/list_std.txt @@ -1,3 +1,5 @@ +env GO111MODULE=off + [!gc] skip # listing GOROOT should only find standard packages diff --git a/src/cmd/go/testdata/script/list_tags.txt b/src/cmd/go/testdata/script/list_tags.txt index c5dc99e9fb..49069bd213 100644 --- a/src/cmd/go/testdata/script/list_tags.txt +++ b/src/cmd/go/testdata/script/list_tags.txt @@ -1,3 +1,5 @@ +env GO111MODULE=off + # go list supports -tags go list -tags=thetag ./my... stdout mypkg diff --git a/src/cmd/go/testdata/script/list_test_e.txt b/src/cmd/go/testdata/script/list_test_e.txt index f1473322c6..4e36b88e85 100644 --- a/src/cmd/go/testdata/script/list_test_e.txt +++ b/src/cmd/go/testdata/script/list_test_e.txt @@ -1,3 +1,5 @@ +env GO111MODULE=off + # issue 25980: crash in go list -e -test go list -e -test -f '{{.Error}}' p stdout '^p[/\\]d_test.go:2:8: cannot find package "d" in any of:' diff --git a/src/cmd/go/testdata/script/list_test_imports.txt b/src/cmd/go/testdata/script/list_test_imports.txt index 51d1ce9a69..b2a6bc45f9 100644 --- a/src/cmd/go/testdata/script/list_test_imports.txt +++ b/src/cmd/go/testdata/script/list_test_imports.txt @@ -1,3 +1,5 @@ +env GO111MODULE=off + # issue 26880: list with tests has wrong variant in imports go list -test -f '{{.ImportPath}}:{{with .Imports}} {{join . ", "}}{{end}}' a b cmp stdout imports.txt diff --git a/src/cmd/go/testdata/script/mod_convert_dep.txt b/src/cmd/go/testdata/script/mod_convert_dep.txt index cc1083bcba..267c90eb3c 100644 --- a/src/cmd/go/testdata/script/mod_convert_dep.txt +++ b/src/cmd/go/testdata/script/mod_convert_dep.txt @@ -1,9 +1,31 @@ env GO111MODULE=on +# We should not create a go.mod file unless the user ran 'go mod init' explicitly. +# However, we should suggest 'go mod init' if we can find an alternate config file. cd $WORK/test/x +! go list . +stderr 'found Gopkg.lock in .*[/\\]test' +stderr '\s*cd \.\. && go mod init' + +# The command we suggested should succeed. +cd .. +go mod init go list -m all stdout '^m$' +# In Plan 9, directories are automatically created in /n. +# For example, /n/Gopkg.lock always exists, but it's a directory. +# Test that we ignore directories when trying to find alternate config files. +cd $WORK/gopkgdir/x +! go list . +stderr 'cannot find main module' +! stderr 'Gopkg.lock' +! stderr 'go mod init' + -- $WORK/test/Gopkg.lock -- -- $WORK/test/x/x.go -- package x // import "m/x" +-- $WORK/gopkgdir/Gopkg.lock/README.txt -- +../Gopkg.lock is a directory, not a file. +-- $WORK/gopkgdir/x/x.go -- +package x // import "m/x" diff --git a/src/cmd/go/testdata/script/mod_convert_git.txt b/src/cmd/go/testdata/script/mod_convert_git.txt index 5ef534a8f8..ece505a7ba 100644 --- a/src/cmd/go/testdata/script/mod_convert_git.txt +++ b/src/cmd/go/testdata/script/mod_convert_git.txt @@ -1,10 +1,23 @@ env GO111MODULE=on -# detect root of module tree as root of enclosing git repo +# We should not create a go.mod file unless the user ran 'go mod init' explicitly. +# However, we should suggest 'go mod init' if we can find an alternate config file. cd $WORK/test/x +! go list . +stderr 'found .git/config in .*[/\\]test' +stderr '\s*cd \.\. && go mod init' + +# The command we suggested should succeed. +cd .. +go mod init go list -m all stdout '^m$' +# We should not suggest creating a go.mod file in $GOROOT, even though there may be a .git/config there. +cd $GOROOT +! go list . +! stderr 'go mod init' + -- $WORK/test/.git/config -- -- $WORK/test/x/x.go -- package x // import "m/x" diff --git a/src/cmd/go/testdata/script/mod_convert_glide.txt b/src/cmd/go/testdata/script/mod_convert_glide.txt index 50460bbf36..9f1fff51bf 100644 --- a/src/cmd/go/testdata/script/mod_convert_glide.txt +++ b/src/cmd/go/testdata/script/mod_convert_glide.txt @@ -1,6 +1,15 @@ env GO111MODULE=on +# We should not create a go.mod file unless the user ran 'go mod init' explicitly. +# However, we should suggest 'go mod init' if we can find an alternate config file. cd $WORK/test/x +! go list . +stderr 'found glide.lock in .*[/\\]test' +stderr '\s*cd \.\. && go mod init' + +# The command we suggested should succeed. +cd .. +go mod init go list -m all stdout '^m$' diff --git a/src/cmd/go/testdata/script/mod_convert_glockfile.txt b/src/cmd/go/testdata/script/mod_convert_glockfile.txt index 4d9aaffab5..6aa0794888 100644 --- a/src/cmd/go/testdata/script/mod_convert_glockfile.txt +++ b/src/cmd/go/testdata/script/mod_convert_glockfile.txt @@ -1,6 +1,15 @@ env GO111MODULE=on +# We should not create a go.mod file unless the user ran 'go mod init' explicitly. +# However, we should suggest 'go mod init' if we can find an alternate config file. cd $WORK/test/x +! go list . +stderr 'found GLOCKFILE in .*[/\\]test' +stderr '\s*cd \.\. && go mod init' + +# The command we suggested should succeed. +cd .. +go mod init go list -m all stdout '^m$' diff --git a/src/cmd/go/testdata/script/mod_convert_godeps.txt b/src/cmd/go/testdata/script/mod_convert_godeps.txt index 61fbab1124..da7b6c1059 100644 --- a/src/cmd/go/testdata/script/mod_convert_godeps.txt +++ b/src/cmd/go/testdata/script/mod_convert_godeps.txt @@ -1,6 +1,15 @@ env GO111MODULE=on +# We should not create a go.mod file unless the user ran 'go mod init' explicitly. +# However, we should suggest 'go mod init' if we can find an alternate config file. cd $WORK/test/x +! go list . +stderr 'found Godeps/Godeps.json in .*[/\\]test' +stderr '\s*cd \.\. && go mod init' + +# The command we suggested should succeed. +cd .. +go mod init go list -m all stdout '^m$' diff --git a/src/cmd/go/testdata/script/mod_convert_tsv.txt b/src/cmd/go/testdata/script/mod_convert_tsv.txt index 5b82d85d65..6015ac8754 100644 --- a/src/cmd/go/testdata/script/mod_convert_tsv.txt +++ b/src/cmd/go/testdata/script/mod_convert_tsv.txt @@ -1,6 +1,15 @@ env GO111MODULE=on +# We should not create a go.mod file unless the user ran 'go mod init' explicitly. +# However, we should suggest 'go mod init' if we can find an alternate config file. cd $WORK/test/x +! go list . +stderr 'found dependencies.tsv in .*[/\\]test' +stderr '\s*cd \.\. && go mod init' + +# The command we suggested should succeed. +cd .. +go mod init go list -m all stdout '^m$' diff --git a/src/cmd/go/testdata/script/mod_convert_vendor_conf.txt b/src/cmd/go/testdata/script/mod_convert_vendor_conf.txt index b45d3b69fe..57ec4191a4 100644 --- a/src/cmd/go/testdata/script/mod_convert_vendor_conf.txt +++ b/src/cmd/go/testdata/script/mod_convert_vendor_conf.txt @@ -1,6 +1,15 @@ env GO111MODULE=on +# We should not create a go.mod file unless the user ran 'go mod init' explicitly. +# However, we should suggest 'go mod init' if we can find an alternate config file. cd $WORK/test/x +! go list . +stderr 'found vendor.conf in .*[/\\]test' +stderr '\s*cd \.\. && go mod init' + +# The command we suggested should succeed. +cd .. +go mod init go list -m all stdout '^m$' diff --git a/src/cmd/go/testdata/script/mod_convert_vendor_json.txt b/src/cmd/go/testdata/script/mod_convert_vendor_json.txt index cb6e5fee15..47d111d4c1 100644 --- a/src/cmd/go/testdata/script/mod_convert_vendor_json.txt +++ b/src/cmd/go/testdata/script/mod_convert_vendor_json.txt @@ -1,6 +1,15 @@ env GO111MODULE=on +# We should not create a go.mod file unless the user ran 'go mod init' explicitly. +# However, we should suggest 'go mod init' if we can find an alternate config file. cd $WORK/test/x +! go list . +stderr 'found vendor/vendor.json in .*[/\\]test' +stderr '\s*cd \.\. && go mod init' + +# The command we suggested should succeed. +cd .. +go mod init go list -m all stdout '^m$' diff --git a/src/cmd/go/testdata/script/mod_convert_vendor_manifest.txt b/src/cmd/go/testdata/script/mod_convert_vendor_manifest.txt index bcf185136b..68edb9dc29 100644 --- a/src/cmd/go/testdata/script/mod_convert_vendor_manifest.txt +++ b/src/cmd/go/testdata/script/mod_convert_vendor_manifest.txt @@ -1,6 +1,15 @@ env GO111MODULE=on +# We should not create a go.mod file unless the user ran 'go mod init' explicitly. +# However, we should suggest 'go mod init' if we can find an alternate config file. cd $WORK/test/x +! go list . +stderr 'found vendor/manifest in .*[/\\]test' +stderr '\s*cd \.\. && go mod init' + +# The command we suggested should succeed. +cd .. +go mod init go list -m all stdout '^m$' diff --git a/src/cmd/go/testdata/script/mod_convert_vendor_yml.txt b/src/cmd/go/testdata/script/mod_convert_vendor_yml.txt index 0cd245bace..4ed140a25a 100644 --- a/src/cmd/go/testdata/script/mod_convert_vendor_yml.txt +++ b/src/cmd/go/testdata/script/mod_convert_vendor_yml.txt @@ -1,6 +1,15 @@ env GO111MODULE=on +# We should not create a go.mod file unless the user ran 'go mod init' explicitly. +# However, we should suggest 'go mod init' if we can find an alternate config file. cd $WORK/test/x +! go list . +stderr 'found vendor.yml in .*[/\\]test' +stderr '\s*cd \.\. && go mod init' + +# The command we suggested should succeed. +cd .. +go mod init go list -m all stdout '^m$' diff --git a/src/cmd/go/testdata/script/mod_find.txt b/src/cmd/go/testdata/script/mod_find.txt index f4ac8d01f5..703a88e99c 100644 --- a/src/cmd/go/testdata/script/mod_find.txt +++ b/src/cmd/go/testdata/script/mod_find.txt @@ -1,3 +1,5 @@ +env GO111MODULE=auto + # Derive module path from import comment. cd $WORK/x exists x.go @@ -43,6 +45,13 @@ go mod init stderr 'empty' rm go.mod +# In Plan 9, directories are automatically created in /n. +# For example, /n/go.mod always exist, but it's a directory. +# Test that we ignore directories when trying to find go.mod. +cd $WORK/gomoddir +! go list . +stderr 'cannot find main module' + [!symlink] stop # gplink1/src/empty where gopathlink -> GOPATH @@ -89,3 +98,8 @@ package y package z -- $GOPATH/src/example.com/x/y/z/Godeps/Godeps.json -- {"ImportPath": "unexpected.com/z"} + +-- $WORK/gomoddir/go.mod/README.txt -- +../go.mod is a directory, not a file. +-- $WORK/gomoddir/p.go -- +package p diff --git a/src/cmd/go/testdata/script/mod_gobuild_import.txt b/src/cmd/go/testdata/script/mod_gobuild_import.txt index 932b8b66f9..d2d1645b83 100644 --- a/src/cmd/go/testdata/script/mod_gobuild_import.txt +++ b/src/cmd/go/testdata/script/mod_gobuild_import.txt @@ -7,14 +7,12 @@ env GO111MODULE=off ! exec $WORK/testimport.exe x/y/z/w . # GO111MODULE=auto in GOPATH/src -env GO111MODULE= -! exec $WORK/testimport.exe x/y/z/w . env GO111MODULE=auto ! exec $WORK/testimport.exe x/y/z/w . # GO111MODULE=auto outside GOPATH/src cd $GOPATH/other -env GO111MODULE= +env GO111MODULE=auto exec $WORK/testimport.exe other/x/y/z/w . stdout w2.go @@ -22,7 +20,6 @@ stdout w2.go stderr 'cannot find module providing package x/y/z/w' cd z -env GO111MODULE=auto exec $WORK/testimport.exe other/x/y/z/w . stdout w2.go @@ -33,6 +30,7 @@ stdout w2.go # GO111MODULE=on in GOPATH/src cd $GOPATH/src +env GO111MODULE=on exec $WORK/testimport.exe x/y/z/w . stdout w1.go cd w diff --git a/src/cmd/go/testdata/script/mod_symlink.txt b/src/cmd/go/testdata/script/mod_symlink.txt index 61da3cc355..49bece2b84 100644 --- a/src/cmd/go/testdata/script/mod_symlink.txt +++ b/src/cmd/go/testdata/script/mod_symlink.txt @@ -2,16 +2,31 @@ env GO111MODULE=on [!symlink] skip # 'go list' should resolve modules of imported packages. -go list -deps -f '{{.Module}}' +go list -deps -f '{{.Module}}' . stdout golang.org/x/text -# They should continue to resolve if the importing file is a symlink. -mkdir links -cd links -symlink go.mod -> ../go.mod -symlink issue.go -> ../issue.go +go list -deps -f '{{.Module}}' ./subpkg +stdout golang.org/x/text -go list -deps -f '{{.Module}}' +# Create a copy of the module using symlinks in src/links. +mkdir links +symlink links/go.mod -> $GOPATH/src/go.mod +symlink links/issue.go -> $GOPATH/src/issue.go +mkdir links/subpkg +symlink links/subpkg/issue.go -> $GOPATH/src/subpkg/issue.go + +# We should see the copy as a valid module root. +cd links +go env GOMOD +stdout links[/\\]go.mod +go list -m +stdout golang.org/issue/28107 + +# The symlink-based copy should contain the same packages +# and have the same dependencies as the original. +go list -deps -f '{{.Module}}' . +stdout golang.org/x/text +go list -deps -f '{{.Module}}' ./subpkg stdout golang.org/x/text -- go.mod -- @@ -21,3 +36,7 @@ module golang.org/issue/28107 package issue import _ "golang.org/x/text/language" +-- subpkg/issue.go -- +package issue + +import _ "golang.org/x/text/language" diff --git a/src/cmd/go/testdata/script/mod_tidy_replace.txt b/src/cmd/go/testdata/script/mod_tidy_replace.txt index 70c789afaa..86467a6545 100644 --- a/src/cmd/go/testdata/script/mod_tidy_replace.txt +++ b/src/cmd/go/testdata/script/mod_tidy_replace.txt @@ -1,5 +1,12 @@ env GO111MODULE=on +# golang.org/issue/30166: 'go mod tidy' should not crash if a replaced module is +# involved in a cycle. +cd cycle +env GOTRACEBACK=off +go mod tidy +cd .. + # From inside the module, 'go list -m all' should NOT include transitive # requirements of modules that have been replaced. go list -m all @@ -69,3 +76,35 @@ import ( _ "rsc.io/sampler" _ "golang.org/x/text/language" ) + +-- cycle/go.mod -- +module golang.org/issue/30166 + +require ( + golang.org/issue/30166/a v0.0.0 + golang.org/issue/30166/b v0.0.0 +) + +replace ( + golang.org/issue/30166/a => ./a + golang.org/issue/30166/b => ./b +) +-- cycle/cycle.go -- +package cycle + +import ( + _ "golang.org/issue/30166/a" + _ "golang.org/issue/30166/b" +) +-- cycle/a/a.go -- +package a +-- cycle/a/go.mod -- +module golang.org/issue/30166/a + +require golang.org/issue/30166/b v0.0.0 +-- cycle/b/b.go -- +package b +-- cycle/b/go.mod -- +module golang.org/issue/30166/b + +require golang.org/issue/30166/a v0.0.0 diff --git a/src/cmd/go/testdata/script/pattern_syntax_error.txt b/src/cmd/go/testdata/script/pattern_syntax_error.txt index 8e6549b5c5..9a1f5e52f0 100644 --- a/src/cmd/go/testdata/script/pattern_syntax_error.txt +++ b/src/cmd/go/testdata/script/pattern_syntax_error.txt @@ -1,3 +1,5 @@ +env GO111MODULE=off + # patterns match directories with syntax errors ! go list ./... ! go build ./... diff --git a/src/cmd/go/testdata/script/run_hello.txt b/src/cmd/go/testdata/script/run_hello.txt index 8c4c1c1683..939b661e58 100644 --- a/src/cmd/go/testdata/script/run_hello.txt +++ b/src/cmd/go/testdata/script/run_hello.txt @@ -1,3 +1,5 @@ +env GO111MODULE=off + # hello world go run hello.go stderr 'hello world' diff --git a/src/cmd/go/testdata/script/run_wildcard.txt b/src/cmd/go/testdata/script/run_wildcard.txt index cd401e00e6..72036d1d8d 100644 --- a/src/cmd/go/testdata/script/run_wildcard.txt +++ b/src/cmd/go/testdata/script/run_wildcard.txt @@ -1,3 +1,5 @@ +env GO111MODULE=off + # Fix for https://github.com/golang/go/issues/28696: # go run x/... should not panic when directory x doesn't exist. diff --git a/src/cmd/go/testdata/script/script_wait.txt b/src/cmd/go/testdata/script/script_wait.txt index 0770b39523..3cd4ded9dd 100644 --- a/src/cmd/go/testdata/script/script_wait.txt +++ b/src/cmd/go/testdata/script/script_wait.txt @@ -1,3 +1,5 @@ +env GO111MODULE=off + [!exec:echo] skip [!exec:false] skip diff --git a/src/cmd/go/testdata/script/test_badtest.txt b/src/cmd/go/testdata/script/test_badtest.txt index 42fcfed2fc..f5db6941a0 100644 --- a/src/cmd/go/testdata/script/test_badtest.txt +++ b/src/cmd/go/testdata/script/test_badtest.txt @@ -1,3 +1,5 @@ +env GO111MODULE=off + ! go test badtest/... ! stdout ^ok stdout ^FAIL\tbadtest/badexec diff --git a/src/cmd/go/testdata/script/test_compile_binary.txt b/src/cmd/go/testdata/script/test_compile_binary.txt index 6c01bc5729..6562f2453f 100644 --- a/src/cmd/go/testdata/script/test_compile_binary.txt +++ b/src/cmd/go/testdata/script/test_compile_binary.txt @@ -1,3 +1,5 @@ +env GO111MODULE=off + ! go test -c compile_binary/... stderr 'build comment' diff --git a/src/cmd/go/testdata/script/test_devnull.txt b/src/cmd/go/testdata/script/test_devnull.txt index c414e59ba3..e7ebda33ee 100644 --- a/src/cmd/go/testdata/script/test_devnull.txt +++ b/src/cmd/go/testdata/script/test_devnull.txt @@ -1,3 +1,5 @@ +env GO111MODULE=off + # go test -c -o NUL # should work (see golang.org/issue/28035). cd x diff --git a/src/cmd/go/testdata/script/vendor_complex.txt b/src/cmd/go/testdata/script/vendor_complex.txt index 6513451df8..9ca94e72c5 100644 --- a/src/cmd/go/testdata/script/vendor_complex.txt +++ b/src/cmd/go/testdata/script/vendor_complex.txt @@ -1,3 +1,5 @@ +env GO111MODULE=off + # smoke test for complex build configuration go build -o complex.exe complex [exec:gccgo] go build -compiler=gccgo -o complex.exe complex diff --git a/src/cmd/go/testdata/script/vet_asm.txt b/src/cmd/go/testdata/script/vet_asm.txt index 807e2b76f5..ea920ea866 100644 --- a/src/cmd/go/testdata/script/vet_asm.txt +++ b/src/cmd/go/testdata/script/vet_asm.txt @@ -1,3 +1,5 @@ +env GO111MODULE=off + # Issue 27665. Verify that "go vet" analyzes non-Go files. env GOOS=linux diff --git a/src/cmd/gofmt/gofmt.go b/src/cmd/gofmt/gofmt.go index ac6852f2e4..4bba44489d 100644 --- a/src/cmd/gofmt/gofmt.go +++ b/src/cmd/gofmt/gofmt.go @@ -112,6 +112,8 @@ func processFile(filename string, in io.Reader, out io.Writer, stdin bool) error simplify(file) } + ast.Inspect(file, normalizeNumbers) + res, err := format(fileSet, file, sourceAdj, indentAdj, src, printer.Config{Mode: printerMode, Tabwidth: tabWidth}) if err != nil { return err @@ -326,3 +328,73 @@ func backupFile(filename string, data []byte, perm os.FileMode) (string, error) return bakname, err } + +// normalizeNumbers rewrites base prefixes and exponents to +// use lower-case letters, and removes leading 0's from +// integer imaginary literals. It leaves hexadecimal digits +// alone. +func normalizeNumbers(n ast.Node) bool { + lit, _ := n.(*ast.BasicLit) + if lit == nil { + return true + } + if len(lit.Value) < 2 { + return false // only one digit - nothing to do + } + // len(lit.Value) >= 2 + + x := lit.Value + switch lit.Kind { + case token.INT: + switch x[:2] { + case "0X": + lit.Value = "0x" + x[2:] + case "0O": + lit.Value = "0o" + x[2:] + case "0B": + lit.Value = "0b" + x[2:] + } + + case token.FLOAT: + switch lit.Value[:2] { + default: + if i := strings.LastIndexByte(x, 'E'); i >= 0 { + lit.Value = x[:i] + "e" + x[i+1:] + } + case "0x": + if i := strings.LastIndexByte(x, 'P'); i >= 0 { + lit.Value = x[:i] + "p" + x[i+1:] + } + case "0X": + if i := strings.LastIndexByte(x, 'P'); i >= 0 { + lit.Value = "0x" + x[2:i] + "p" + x[i+1:] + } else { + lit.Value = "0x" + x[2:] + } + } + + case token.IMAG: + // Note that integer imaginary literals may contain + // any decimal digit even if they start with zero. + // Imaginary literals should always end in 'i' but be + // conservative and check anyway before proceeding. + if x[0] == '0' && x[len(x)-1] == 'i' && isDecimals(x[1:len(x)-1]) { + x = strings.TrimLeft(x, "0_") + if x == "i" { + x = "0i" + } + lit.Value = x + } + } + + return false +} + +// isDecimals reports whether x consists entirely of decimal digits and underscores. +func isDecimals(x string) bool { + i := 0 + for i < len(x) && ('0' <= x[i] && x[i] <= '9' || x[i] == '_') { + i++ + } + return i == len(x) +} diff --git a/src/cmd/gofmt/testdata/go2numbers.golden b/src/cmd/gofmt/testdata/go2numbers.golden new file mode 100644 index 0000000000..abefcb6c58 --- /dev/null +++ b/src/cmd/gofmt/testdata/go2numbers.golden @@ -0,0 +1,170 @@ +package p + +const ( + // 0-octals + _ = 0 + _ = 0123 + _ = 0123456 + + _ = 0_123 + _ = 0123_456 + + // decimals + _ = 1 + _ = 1234 + _ = 1234567 + + _ = 1_234 + _ = 1_234_567 + + // hexadecimals + _ = 0x0 + _ = 0x1234 + _ = 0xcafef00d + + _ = 0x0 + _ = 0x1234 + _ = 0xCAFEf00d + + _ = 0x_0 + _ = 0x_1234 + _ = 0x_CAFE_f00d + + // octals + _ = 0o0 + _ = 0o1234 + _ = 0o01234567 + + _ = 0o0 + _ = 0o1234 + _ = 0o01234567 + + _ = 0o_0 + _ = 0o_1234 + _ = 0o0123_4567 + + _ = 0o_0 + _ = 0o_1234 + _ = 0o0123_4567 + + // binaries + _ = 0b0 + _ = 0b1011 + _ = 0b00101101 + + _ = 0b0 + _ = 0b1011 + _ = 0b00101101 + + _ = 0b_0 + _ = 0b10_11 + _ = 0b_0010_1101 + + // decimal floats + _ = 0. + _ = 123. + _ = 0123. + + _ = .0 + _ = .123 + _ = .0123 + + _ = 0e0 + _ = 123e+0 + _ = 0123e-1 + + _ = 0e-0 + _ = 123e+0 + _ = 0123e123 + + _ = 0.e+1 + _ = 123.e-10 + _ = 0123.e123 + + _ = .0e-1 + _ = .123e+10 + _ = .0123e123 + + _ = 0.0 + _ = 123.123 + _ = 0123.0123 + + _ = 0.0e1 + _ = 123.123e-10 + _ = 0123.0123e+456 + + _ = 1_2_3. + _ = 0_123. + + _ = 0_0e0 + _ = 1_2_3e0 + _ = 0_123e0 + + _ = 0e-0_0 + _ = 1_2_3e+0 + _ = 0123e1_2_3 + + _ = 0.e+1 + _ = 123.e-1_0 + _ = 01_23.e123 + + _ = .0e-1 + _ = .123e+10 + _ = .0123e123 + + _ = 1_2_3.123 + _ = 0123.01_23 + + // hexadecimal floats + _ = 0x0.p+0 + _ = 0xdeadcafe.p-10 + _ = 0x1234.p123 + + _ = 0x.1p-0 + _ = 0x.deadcafep2 + _ = 0x.1234p+10 + + _ = 0x0p0 + _ = 0xdeadcafep+1 + _ = 0x1234p-10 + + _ = 0x0.0p0 + _ = 0xdead.cafep+1 + _ = 0x12.34p-10 + + _ = 0xdead_cafep+1 + _ = 0x_1234p-10 + + _ = 0x_dead_cafe.p-10 + _ = 0x12_34.p1_2_3 + _ = 0x1_2_3_4.p-1_2_3 + + // imaginaries + _ = 0i + _ = 0i + _ = 8i + _ = 0i + _ = 123i + _ = 123i + _ = 56789i + _ = 1234i + _ = 1234567i + + _ = 0i + _ = 0i + _ = 8i + _ = 0i + _ = 123i + _ = 123i + _ = 56_789i + _ = 1_234i + _ = 1_234_567i + + _ = 0.i + _ = 123.i + _ = 0123.i + + _ = 0.e+1i + _ = 123.E-1_0i + _ = 01_23.e123i +) diff --git a/src/cmd/gofmt/testdata/go2numbers.input b/src/cmd/gofmt/testdata/go2numbers.input new file mode 100644 index 0000000000..51a9f8eaf6 --- /dev/null +++ b/src/cmd/gofmt/testdata/go2numbers.input @@ -0,0 +1,170 @@ +package p + +const ( + // 0-octals + _ = 0 + _ = 0123 + _ = 0123456 + + _ = 0_123 + _ = 0123_456 + + // decimals + _ = 1 + _ = 1234 + _ = 1234567 + + _ = 1_234 + _ = 1_234_567 + + // hexadecimals + _ = 0x0 + _ = 0x1234 + _ = 0xcafef00d + + _ = 0X0 + _ = 0X1234 + _ = 0XCAFEf00d + + _ = 0X_0 + _ = 0X_1234 + _ = 0X_CAFE_f00d + + // octals + _ = 0o0 + _ = 0o1234 + _ = 0o01234567 + + _ = 0O0 + _ = 0O1234 + _ = 0O01234567 + + _ = 0o_0 + _ = 0o_1234 + _ = 0o0123_4567 + + _ = 0O_0 + _ = 0O_1234 + _ = 0O0123_4567 + + // binaries + _ = 0b0 + _ = 0b1011 + _ = 0b00101101 + + _ = 0B0 + _ = 0B1011 + _ = 0B00101101 + + _ = 0b_0 + _ = 0b10_11 + _ = 0b_0010_1101 + + // decimal floats + _ = 0. + _ = 123. + _ = 0123. + + _ = .0 + _ = .123 + _ = .0123 + + _ = 0e0 + _ = 123e+0 + _ = 0123E-1 + + _ = 0e-0 + _ = 123E+0 + _ = 0123E123 + + _ = 0.e+1 + _ = 123.E-10 + _ = 0123.e123 + + _ = .0e-1 + _ = .123E+10 + _ = .0123E123 + + _ = 0.0 + _ = 123.123 + _ = 0123.0123 + + _ = 0.0e1 + _ = 123.123E-10 + _ = 0123.0123e+456 + + _ = 1_2_3. + _ = 0_123. + + _ = 0_0e0 + _ = 1_2_3e0 + _ = 0_123e0 + + _ = 0e-0_0 + _ = 1_2_3E+0 + _ = 0123E1_2_3 + + _ = 0.e+1 + _ = 123.E-1_0 + _ = 01_23.e123 + + _ = .0e-1 + _ = .123E+10 + _ = .0123E123 + + _ = 1_2_3.123 + _ = 0123.01_23 + + // hexadecimal floats + _ = 0x0.p+0 + _ = 0Xdeadcafe.p-10 + _ = 0x1234.P123 + + _ = 0x.1p-0 + _ = 0X.deadcafep2 + _ = 0x.1234P+10 + + _ = 0x0p0 + _ = 0Xdeadcafep+1 + _ = 0x1234P-10 + + _ = 0x0.0p0 + _ = 0Xdead.cafep+1 + _ = 0x12.34P-10 + + _ = 0Xdead_cafep+1 + _ = 0x_1234P-10 + + _ = 0X_dead_cafe.p-10 + _ = 0x12_34.P1_2_3 + _ = 0X1_2_3_4.P-1_2_3 + + // imaginaries + _ = 0i + _ = 00i + _ = 08i + _ = 0000000000i + _ = 0123i + _ = 0000000123i + _ = 0000056789i + _ = 1234i + _ = 1234567i + + _ = 0i + _ = 0_0i + _ = 0_8i + _ = 0_000_000_000i + _ = 0_123i + _ = 0_000_000_123i + _ = 0_000_056_789i + _ = 1_234i + _ = 1_234_567i + + _ = 0.i + _ = 123.i + _ = 0123.i + + _ = 0.e+1i + _ = 123.E-1_0i + _ = 01_23.e123i +) diff --git a/src/cmd/internal/goobj/goobj_test.go b/src/cmd/internal/goobj/goobj_test.go index 3b41589bbf..840b45c908 100644 --- a/src/cmd/internal/goobj/goobj_test.go +++ b/src/cmd/internal/goobj/goobj_test.go @@ -122,10 +122,14 @@ func buildGoobj() error { if testenv.HasCGO() { gopath := filepath.Join(buildDir, "gopath") err = copyDir(filepath.Join(gopath, "src", "mycgo"), filepath.Join("testdata", "mycgo")) + if err == nil { + err = ioutil.WriteFile(filepath.Join(gopath, "src", "mycgo", "go.mod"), []byte("module mycgo\n"), 0666) + } if err != nil { return err } cmd := exec.Command(gotool, "install", "-gcflags=all="+os.Getenv("GO_GCFLAGS"), "mycgo") + cmd.Dir = filepath.Join(gopath, "src", "mycgo") cmd.Env = append(os.Environ(), "GOPATH="+gopath) out, err = cmd.CombinedOutput() if err != nil { diff --git a/src/cmd/internal/obj/arm64/asm7.go b/src/cmd/internal/obj/arm64/asm7.go index 093b222898..cbe5796234 100644 --- a/src/cmd/internal/obj/arm64/asm7.go +++ b/src/cmd/internal/obj/arm64/asm7.go @@ -2986,7 +2986,7 @@ func (c *ctxt7) asmout(p *obj.Prog, o *Optab, out []uint32) { num := uint8(0) cls := oclass(&p.From) if isADDWop(p.As) { - if (cls != C_LCON) && (cls != C_ADDCON2) { + if !cmp(C_LCON, cls) { c.ctxt.Diag("illegal combination: %v", p) } num = c.omovlconst(AMOVW, p, &p.From, REGTMP, os[:]) @@ -3271,7 +3271,7 @@ func (c *ctxt7) asmout(p *obj.Prog, o *Optab, out []uint32) { num := uint8(0) cls := oclass(&p.From) if isANDWop(p.As) { - if (cls != C_LCON) && (cls != C_ADDCON) { + if !cmp(C_LCON, cls) { c.ctxt.Diag("illegal combination: %v", p) } num = c.omovlconst(AMOVW, p, &p.From, REGTMP, os[:]) diff --git a/src/cmd/internal/obj/x86/issue19518_test.go b/src/cmd/internal/obj/x86/issue19518_test.go index fa2beb8aad..4a29285ff1 100644 --- a/src/cmd/internal/obj/x86/issue19518_test.go +++ b/src/cmd/internal/obj/x86/issue19518_test.go @@ -41,6 +41,10 @@ func objdumpOutput(t *testing.T) []byte { t.Fatal(err) } defer os.RemoveAll(tmpdir) + err = ioutil.WriteFile(filepath.Join(tmpdir, "go.mod"), []byte("module issue19518\n"), 0666) + if err != nil { + t.Fatal(err) + } tmpfile, err := os.Create(filepath.Join(tmpdir, "input.s")) if err != nil { t.Fatal(err) diff --git a/src/cmd/internal/obj/x86/obj6.go b/src/cmd/internal/obj/x86/obj6.go index babfd38ad2..a6931e8441 100644 --- a/src/cmd/internal/obj/x86/obj6.go +++ b/src/cmd/internal/obj/x86/obj6.go @@ -968,7 +968,7 @@ func isZeroArgRuntimeCall(s *obj.LSym) bool { return false } switch s.Name { - case "runtime.panicindex", "runtime.panicslice", "runtime.panicdivide", "runtime.panicwrap": + case "runtime.panicindex", "runtime.panicslice", "runtime.panicdivide", "runtime.panicwrap", "runtime.panicshift": return true } return false diff --git a/src/cmd/internal/src/pos.go b/src/cmd/internal/src/pos.go index 110a57b98d..5063b133f3 100644 --- a/src/cmd/internal/src/pos.go +++ b/src/cmd/internal/src/pos.go @@ -343,7 +343,7 @@ const ( // positions. // PosDefaultStmt uint = iota // Default; position is not a statement boundary, but might be if optimization removes the designated statement boundary - PosIsStmt // Position is a statement bounday; if optimization removes the corresponding instruction, it should attempt to find a new instruction to be the boundary. + PosIsStmt // Position is a statement boundary; if optimization removes the corresponding instruction, it should attempt to find a new instruction to be the boundary. PosNotStmt // Position should not be a statement boundary, but line should be preserved for profiling and low-level debugging purposes. ) diff --git a/src/cmd/link/dwarf_test.go b/src/cmd/link/dwarf_test.go index 2c01456f6b..710457aeb9 100644 --- a/src/cmd/link/dwarf_test.go +++ b/src/cmd/link/dwarf_test.go @@ -8,7 +8,6 @@ import ( "cmd/internal/objfile" "debug/dwarf" "internal/testenv" - "io" "io/ioutil" "os" "os/exec" @@ -46,6 +45,8 @@ func testDWARF(t *testing.T, buildmode string, expectDWARF bool, env ...string) for _, prog := range []string{"testprog", "testprogcgo"} { t.Run(prog, func(t *testing.T) { + t.Parallel() + exe := filepath.Join(tmpDir, prog+".exe") dir := "../../runtime/testdata/" + prog cmd := exec.Command(testenv.GoToolPath(t), "build", "-o", exe) @@ -109,43 +110,23 @@ func testDWARF(t *testing.T, buildmode string, expectDWARF bool, env ...string) wantFile := path.Join(prog, "main.go") wantLine := 24 r := d.Reader() - var line dwarf.LineEntry - for { - cu, err := r.Next() - if err != nil { - t.Fatal(err) - } - if cu == nil { - break - } - if cu.Tag != dwarf.TagCompileUnit { - r.SkipChildren() - continue - } - if cu.Val(dwarf.AttrStmtList) == nil { - continue - } - lr, err := d.LineReader(cu) - if err != nil { - t.Fatal(err) - } - for { - err := lr.Next(&line) - if err == io.EOF { - break - } - if err != nil { - t.Fatal(err) - } - if line.Address == addr { - if !strings.HasSuffix(line.File.Name, wantFile) || line.Line != wantLine { - t.Errorf("%#x is %s:%d, want %s:%d", addr, line.File.Name, line.Line, filepath.Join("...", wantFile), wantLine) - } - return - } - } + entry, err := r.SeekPC(addr) + if err != nil { + t.Fatal(err) + } + lr, err := d.LineReader(entry) + if err != nil { + t.Fatal(err) + } + var line dwarf.LineEntry + if err := lr.SeekPC(addr, &line); err == dwarf.ErrUnknownPC { + t.Fatalf("did not find file:line for %#x (main.main)", addr) + } else if err != nil { + t.Fatal(err) + } + if !strings.HasSuffix(line.File.Name, wantFile) || line.Line != wantLine { + t.Errorf("%#x is %s:%d, want %s:%d", addr, line.File.Name, line.Line, filepath.Join("...", wantFile), wantLine) } - t.Fatalf("did not find file:line for %#x (main.main)", addr) }) } } diff --git a/src/cmd/link/internal/ld/deadcode.go b/src/cmd/link/internal/ld/deadcode.go index 8f582174c5..627ce05d7a 100644 --- a/src/cmd/link/internal/ld/deadcode.go +++ b/src/cmd/link/internal/ld/deadcode.go @@ -209,11 +209,6 @@ func (d *deadcodepass) markMethod(m methodref) { func (d *deadcodepass) init() { var names []string - if d.ctxt.Arch.Family == sys.ARM { - // mark some functions that are only referenced after linker code editing - names = append(names, "runtime.read_tls_fallback") - } - if d.ctxt.BuildMode == BuildModeShared { // Mark all symbols defined in this library as reachable when // building a shared library. diff --git a/src/cmd/link/internal/ld/dwarf_test.go b/src/cmd/link/internal/ld/dwarf_test.go index 7bbe2b710c..287ad5c99d 100644 --- a/src/cmd/link/internal/ld/dwarf_test.go +++ b/src/cmd/link/internal/ld/dwarf_test.go @@ -114,26 +114,14 @@ func gobuild(t *testing.T, dir string, testfile string, gcflags string) *builtFi return &builtFile{f, dst} } -func envWithGoPathSet(gp string) []string { - env := os.Environ() - for i := 0; i < len(env); i++ { - if strings.HasPrefix(env[i], "GOPATH=") { - env[i] = "GOPATH=" + gp - return env - } - } - env = append(env, "GOPATH="+gp) - return env -} +// Similar to gobuild() above, but uses a main package instead of a test.go file. -// Similar to gobuild() above, but runs off a separate GOPATH environment - -func gobuildTestdata(t *testing.T, tdir string, gopathdir string, packtobuild string, gcflags string) *builtFile { +func gobuildTestdata(t *testing.T, tdir string, pkgDir string, gcflags string) *builtFile { dst := filepath.Join(tdir, "out.exe") // Run a build with an updated GOPATH - cmd := exec.Command(testenv.GoToolPath(t), "build", gcflags, "-o", dst, packtobuild) - cmd.Env = envWithGoPathSet(gopathdir) + cmd := exec.Command(testenv.GoToolPath(t), "build", gcflags, "-o", dst) + cmd.Dir = pkgDir if b, err := cmd.CombinedOutput(); err != nil { t.Logf("build: %s\n", b) t.Fatalf("build error: %v", err) @@ -727,7 +715,7 @@ func main() { } } -func abstractOriginSanity(t *testing.T, gopathdir string, flags string) { +func abstractOriginSanity(t *testing.T, pkgDir string, flags string) { t.Parallel() dir, err := ioutil.TempDir("", "TestAbstractOriginSanity") @@ -737,7 +725,7 @@ func abstractOriginSanity(t *testing.T, gopathdir string, flags string) { defer os.RemoveAll(dir) // Build with inlining, to exercise DWARF inlining support. - f := gobuildTestdata(t, dir, gopathdir, "main", flags) + f := gobuildTestdata(t, dir, filepath.Join(pkgDir, "main"), flags) d, err := f.DWARF() if err != nil { diff --git a/src/cmd/link/internal/ld/testdata/httptest/src/main/main.go b/src/cmd/link/internal/ld/testdata/httptest/main/main.go similarity index 100% rename from src/cmd/link/internal/ld/testdata/httptest/src/main/main.go rename to src/cmd/link/internal/ld/testdata/httptest/main/main.go diff --git a/src/cmd/link/internal/ld/testdata/issue25459/src/a/a.go b/src/cmd/link/internal/ld/testdata/issue25459/a/a.go similarity index 100% rename from src/cmd/link/internal/ld/testdata/issue25459/src/a/a.go rename to src/cmd/link/internal/ld/testdata/issue25459/a/a.go diff --git a/src/cmd/link/internal/ld/testdata/issue25459/src/main/main.go b/src/cmd/link/internal/ld/testdata/issue25459/main/main.go similarity index 65% rename from src/cmd/link/internal/ld/testdata/issue25459/src/main/main.go rename to src/cmd/link/internal/ld/testdata/issue25459/main/main.go index be05f59dac..7b5796d714 100644 --- a/src/cmd/link/internal/ld/testdata/issue25459/src/main/main.go +++ b/src/cmd/link/internal/ld/testdata/issue25459/main/main.go @@ -1,6 +1,6 @@ package main -import "a" +import "cmd/link/internal/ld/testdata/issue25459/a" var Glob int diff --git a/src/cmd/link/internal/ld/testdata/issue26237/src/b.dir/b.go b/src/cmd/link/internal/ld/testdata/issue26237/b.dir/b.go similarity index 100% rename from src/cmd/link/internal/ld/testdata/issue26237/src/b.dir/b.go rename to src/cmd/link/internal/ld/testdata/issue26237/b.dir/b.go diff --git a/src/cmd/link/internal/ld/testdata/issue26237/src/main/main.go b/src/cmd/link/internal/ld/testdata/issue26237/main/main.go similarity index 75% rename from src/cmd/link/internal/ld/testdata/issue26237/src/main/main.go rename to src/cmd/link/internal/ld/testdata/issue26237/main/main.go index 6fdaa0bfa1..fdb1223d86 100644 --- a/src/cmd/link/internal/ld/testdata/issue26237/src/main/main.go +++ b/src/cmd/link/internal/ld/testdata/issue26237/main/main.go @@ -3,7 +3,7 @@ package main import ( "fmt" - b "b.dir" + b "cmd/link/internal/ld/testdata/issue26237/b.dir" ) var skyx int diff --git a/src/cmd/link/link_test.go b/src/cmd/link/link_test.go index e0aae02884..5200c3a6f0 100644 --- a/src/cmd/link/link_test.go +++ b/src/cmd/link/link_test.go @@ -39,6 +39,8 @@ func TestLargeSymName(t *testing.T) { } func TestIssue21703(t *testing.T) { + t.Parallel() + testenv.MustHaveGoBuild(t) const source = ` @@ -78,6 +80,8 @@ func main() {} // to, for example, save facts produced by a modular static analysis // such as golang.org/x/tools/go/analysis. func TestIssue28429(t *testing.T) { + t.Parallel() + testenv.MustHaveGoBuild(t) tmpdir, err := ioutil.TempDir("", "issue28429-") @@ -139,6 +143,7 @@ func TestUnresolved(t *testing.T) { // linker would find an undefined reference to "zero" created // by the runtime package. + write("go.mod", "module testunresolved\n") write("main.go", `package main func main() { diff --git a/src/cmd/nm/nm_test.go b/src/cmd/nm/nm_test.go index 1b5bd21ad5..8176ddd7f4 100644 --- a/src/cmd/nm/nm_test.go +++ b/src/cmd/nm/nm_test.go @@ -222,12 +222,16 @@ func testGoLib(t *testing.T, iscgo bool) { if e := file.Close(); err == nil { err = e } + if err == nil { + err = ioutil.WriteFile(filepath.Join(libpath, "go.mod"), []byte("module mylib\n"), 0666) + } if err != nil { t.Fatal(err) } args := []string{"install", "mylib"} cmd := exec.Command(testenv.GoToolPath(t), args...) + cmd.Dir = libpath cmd.Env = append(os.Environ(), "GOPATH="+gopath) out, err := cmd.CombinedOutput() if err != nil { diff --git a/src/cmd/trace/annotations.go b/src/cmd/trace/annotations.go index 2498415681..d991588a72 100644 --- a/src/cmd/trace/annotations.go +++ b/src/cmd/trace/annotations.go @@ -1159,17 +1159,17 @@ var templUserRegionType = template.Must(template.New("").Funcs(template.FuncMap{ d := time.Duration(nsec) * time.Nanosecond return template.HTML(niceDuration(d)) }, - "percent": func(dividened, divisor int64) template.HTML { + "percent": func(dividend, divisor int64) template.HTML { if divisor == 0 { return "" } - return template.HTML(fmt.Sprintf("(%.1f%%)", float64(dividened)/float64(divisor)*100)) + return template.HTML(fmt.Sprintf("(%.1f%%)", float64(dividend)/float64(divisor)*100)) }, - "barLen": func(dividened, divisor int64) template.HTML { + "barLen": func(dividend, divisor int64) template.HTML { if divisor == 0 { return "0" } - return template.HTML(fmt.Sprintf("%.2f%%", float64(dividened)/float64(divisor)*100)) + return template.HTML(fmt.Sprintf("%.2f%%", float64(dividend)/float64(divisor)*100)) }, "unknownTime": func(desc regionDesc) int64 { sum := desc.ExecTime + desc.IOTime + desc.BlockTime + desc.SyscallTime + desc.SchedWaitTime diff --git a/src/cmd/trace/goroutines.go b/src/cmd/trace/goroutines.go index 548871a82c..100891d64e 100644 --- a/src/cmd/trace/goroutines.go +++ b/src/cmd/trace/goroutines.go @@ -166,17 +166,17 @@ var templGoroutine = template.Must(template.New("").Funcs(template.FuncMap{ d := time.Duration(nsec) * time.Nanosecond return template.HTML(niceDuration(d)) }, - "percent": func(dividened, divisor int64) template.HTML { + "percent": func(dividend, divisor int64) template.HTML { if divisor == 0 { return "" } - return template.HTML(fmt.Sprintf("(%.1f%%)", float64(dividened)/float64(divisor)*100)) + return template.HTML(fmt.Sprintf("(%.1f%%)", float64(dividend)/float64(divisor)*100)) }, - "barLen": func(dividened, divisor int64) template.HTML { + "barLen": func(dividend, divisor int64) template.HTML { if divisor == 0 { return "0" } - return template.HTML(fmt.Sprintf("%.2f%%", float64(dividened)/float64(divisor)*100)) + return template.HTML(fmt.Sprintf("%.2f%%", float64(dividend)/float64(divisor)*100)) }, "unknownTime": func(desc *trace.GDesc) int64 { sum := desc.ExecTime + desc.IOTime + desc.BlockTime + desc.SyscallTime + desc.SchedWaitTime diff --git a/src/cmd/vendor/golang.org/x/sys/unix/README.md b/src/cmd/vendor/golang.org/x/sys/unix/README.md index 2bf415fb1c..eb2f78ae29 100644 --- a/src/cmd/vendor/golang.org/x/sys/unix/README.md +++ b/src/cmd/vendor/golang.org/x/sys/unix/README.md @@ -32,7 +32,7 @@ To build the files for your current OS and architecture, make sure GOOS and GOARCH are set correctly and run `mkall.sh`. This will generate the files for your specific system. Running `mkall.sh -n` shows the commands that will be run. -Requirements: bash, perl, go +Requirements: bash, go ### New Build System (currently for `GOOS == "linux"`) @@ -52,14 +52,14 @@ system and have your GOOS and GOARCH set accordingly. Running `mkall.sh` will then generate all of the files for all of the GOOS/GOARCH pairs in the new build system. Running `mkall.sh -n` shows the commands that will be run. -Requirements: bash, perl, go, docker +Requirements: bash, go, docker ## Component files This section describes the various files used in the code generation process. It also contains instructions on how to modify these files to add a new architecture/OS or to add additional syscalls, types, or constants. Note that -if you are using the new build system, the scripts cannot be called normally. +if you are using the new build system, the scripts/programs cannot be called normally. They must be called from within the docker container. ### asm files @@ -81,8 +81,8 @@ each GOOS/GOARCH pair. ### mksysnum -Mksysnum is a script located at `${GOOS}/mksysnum.pl` (or `mksysnum_${GOOS}.pl` -for the old system). This script takes in a list of header files containing the +Mksysnum is a Go program located at `${GOOS}/mksysnum.go` (or `mksysnum_${GOOS}.go` +for the old system). This program takes in a list of header files containing the syscall number declarations and parses them to produce the corresponding list of Go numeric constants. See `zsysnum_${GOOS}_${GOARCH}.go` for the generated constants. @@ -92,14 +92,14 @@ new installation of the target OS (or updating the source checkouts for the new build system). However, depending on the OS, you make need to update the parsing in mksysnum. -### mksyscall.pl +### mksyscall.go The `syscall.go`, `syscall_${GOOS}.go`, `syscall_${GOOS}_${GOARCH}.go` are hand-written Go files which implement system calls (for unix, the specific OS, or the specific OS/Architecture pair respectively) that need special handling and list `//sys` comments giving prototypes for ones that can be generated. -The mksyscall.pl script takes the `//sys` and `//sysnb` comments and converts +The mksyscall.go program takes the `//sys` and `//sysnb` comments and converts them into syscalls. This requires the name of the prototype in the comment to match a syscall number in the `zsysnum_${GOOS}_${GOARCH}.go` file. The function prototype can be exported (capitalized) or not. @@ -160,7 +160,7 @@ signal numbers, and constants. Generated by `mkerrors.sh` (see above). ### `zsyscall_${GOOS}_${GOARCH}.go` A file containing all the generated syscalls for a specific GOOS and GOARCH. -Generated by `mksyscall.pl` (see above). +Generated by `mksyscall.go` (see above). ### `zsysnum_${GOOS}_${GOARCH}.go` diff --git a/src/cmd/vendor/golang.org/x/sys/unix/asm_netbsd_arm64.s b/src/cmd/vendor/golang.org/x/sys/unix/asm_netbsd_arm64.s new file mode 100644 index 0000000000..6f98ba5a37 --- /dev/null +++ b/src/cmd/vendor/golang.org/x/sys/unix/asm_netbsd_arm64.s @@ -0,0 +1,29 @@ +// 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 !gccgo + +#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) diff --git a/src/cmd/vendor/golang.org/x/sys/unix/mkall.sh b/src/cmd/vendor/golang.org/x/sys/unix/mkall.sh index b9804c0ca6..75152f99b2 100755 --- a/src/cmd/vendor/golang.org/x/sys/unix/mkall.sh +++ b/src/cmd/vendor/golang.org/x/sys/unix/mkall.sh @@ -62,12 +62,12 @@ _* | *_ | _) ;; aix_ppc) mkerrors="$mkerrors -maix32" - mksyscall="./mksyscall_aix_ppc.pl -aix" + mksyscall="go run mksyscall_aix_ppc.go -aix" mktypes="GOARCH=$GOARCH go tool cgo -godefs" ;; aix_ppc64) mkerrors="$mkerrors -maix64" - mksyscall="./mksyscall_aix_ppc64.pl -aix" + mksyscall="go run mksyscall_aix_ppc64.go -aix" mktypes="GOARCH=$GOARCH go tool cgo -godefs" ;; darwin_386) @@ -99,31 +99,31 @@ darwin_arm64) dragonfly_amd64) mkerrors="$mkerrors -m64" mksyscall="go run mksyscall.go -dragonfly" - mksysnum="go run mksysnum.go 'http://gitweb.dragonflybsd.org/dragonfly.git/blob_plain/HEAD:/sys/kern/syscalls.master'" + mksysnum="go run mksysnum.go 'https://gitweb.dragonflybsd.org/dragonfly.git/blob_plain/HEAD:/sys/kern/syscalls.master'" mktypes="GOARCH=$GOARCH go tool cgo -godefs" ;; freebsd_386) mkerrors="$mkerrors -m32" mksyscall="go run mksyscall.go -l32" - mksysnum="go run mksysnum.go 'http://svn.freebsd.org/base/stable/10/sys/kern/syscalls.master'" + mksysnum="go run mksysnum.go 'https://svn.freebsd.org/base/stable/10/sys/kern/syscalls.master'" mktypes="GOARCH=$GOARCH go tool cgo -godefs" ;; freebsd_amd64) mkerrors="$mkerrors -m64" - mksysnum="go run mksysnum.go 'http://svn.freebsd.org/base/stable/10/sys/kern/syscalls.master'" + mksysnum="go run mksysnum.go 'https://svn.freebsd.org/base/stable/10/sys/kern/syscalls.master'" mktypes="GOARCH=$GOARCH go tool cgo -godefs" ;; freebsd_arm) mkerrors="$mkerrors" mksyscall="go run mksyscall.go -l32 -arm" - mksysnum="go run mksysnum.go 'http://svn.freebsd.org/base/stable/10/sys/kern/syscalls.master'" + mksysnum="go run mksysnum.go 'https://svn.freebsd.org/base/stable/10/sys/kern/syscalls.master'" # Let the type of C char be signed for making the bare syscall # API consistent across platforms. mktypes="GOARCH=$GOARCH go tool cgo -godefs -- -fsigned-char" ;; freebsd_arm64) mkerrors="$mkerrors -m64" - mksysnum="go run mksysnum.go 'http://svn.freebsd.org/base/stable/10/sys/kern/syscalls.master'" + mksysnum="go run mksysnum.go 'https://svn.freebsd.org/base/stable/10/sys/kern/syscalls.master'" mktypes="GOARCH=$GOARCH go tool cgo -godefs" ;; netbsd_386) @@ -150,27 +150,27 @@ openbsd_386) mkerrors="$mkerrors -m32" mksyscall="go run mksyscall.go -l32 -openbsd" mksysctl="./mksysctl_openbsd.pl" - mksysnum="go run mksysnum.go 'http://cvsweb.openbsd.org/cgi-bin/cvsweb/~checkout~/src/sys/kern/syscalls.master'" + mksysnum="go run mksysnum.go 'https://cvsweb.openbsd.org/cgi-bin/cvsweb/~checkout~/src/sys/kern/syscalls.master'" mktypes="GOARCH=$GOARCH go tool cgo -godefs" ;; openbsd_amd64) mkerrors="$mkerrors -m64" mksyscall="go run mksyscall.go -openbsd" mksysctl="./mksysctl_openbsd.pl" - mksysnum="go run mksysnum.go 'http://cvsweb.openbsd.org/cgi-bin/cvsweb/~checkout~/src/sys/kern/syscalls.master'" + mksysnum="go run mksysnum.go 'https://cvsweb.openbsd.org/cgi-bin/cvsweb/~checkout~/src/sys/kern/syscalls.master'" mktypes="GOARCH=$GOARCH go tool cgo -godefs" ;; openbsd_arm) mkerrors="$mkerrors" mksyscall="go run mksyscall.go -l32 -openbsd -arm" mksysctl="./mksysctl_openbsd.pl" - mksysnum="go run mksysnum.go 'http://cvsweb.openbsd.org/cgi-bin/cvsweb/~checkout~/src/sys/kern/syscalls.master'" + mksysnum="go run mksysnum.go 'https://cvsweb.openbsd.org/cgi-bin/cvsweb/~checkout~/src/sys/kern/syscalls.master'" # Let the type of C char be signed for making the bare syscall # API consistent across platforms. mktypes="GOARCH=$GOARCH go tool cgo -godefs -- -fsigned-char" ;; solaris_amd64) - mksyscall="./mksyscall_solaris.pl" + mksyscall="go run mksyscall_solaris.go" mkerrors="$mkerrors -m64" mksysnum= mktypes="GOARCH=$GOARCH go tool cgo -godefs" diff --git a/src/cmd/vendor/golang.org/x/sys/unix/mkerrors.sh b/src/cmd/vendor/golang.org/x/sys/unix/mkerrors.sh index 178077f47b..6a23484e5b 100755 --- a/src/cmd/vendor/golang.org/x/sys/unix/mkerrors.sh +++ b/src/cmd/vendor/golang.org/x/sys/unix/mkerrors.sh @@ -179,8 +179,10 @@ struct ltchars { #include #include #include +#include #include #include +#include #include #include #include @@ -257,16 +259,6 @@ struct ltchars { #define FS_KEY_DESC_PREFIX "fscrypt:" #define FS_KEY_DESC_PREFIX_SIZE 8 #define FS_MAX_KEY_SIZE 64 - -// XDP socket constants do not appear to be picked up otherwise. -// Copied from samples/bpf/xdpsock_user.c. -#ifndef SOL_XDP -#define SOL_XDP 283 -#endif - -#ifndef AF_XDP -#define AF_XDP 44 -#endif ' includes_NetBSD=' @@ -453,7 +445,7 @@ ccflags="$@" $2 !~ "MNT_BITS" && $2 ~ /^(MS|MNT|UMOUNT)_/ || $2 ~ /^TUN(SET|GET|ATTACH|DETACH)/ || - $2 ~ /^(O|F|E?FD|NAME|S|PTRACE|PT)_/ || + $2 ~ /^(O|F|[ES]?FD|NAME|S|PTRACE|PT)_/ || $2 ~ /^KEXEC_/ || $2 ~ /^LINUX_REBOOT_CMD_/ || $2 ~ /^LINUX_REBOOT_MAGIC[12]$/ || @@ -474,12 +466,13 @@ ccflags="$@" $2 ~ /^CLONE_[A-Z_]+/ || $2 !~ /^(BPF_TIMEVAL)$/ && $2 ~ /^(BPF|DLT)_/ || - $2 ~ /^CLOCK_/ || + $2 ~ /^(CLOCK|TIMER)_/ || $2 ~ /^CAN_/ || $2 ~ /^CAP_/ || $2 ~ /^ALG_/ || $2 ~ /^FS_(POLICY_FLAGS|KEY_DESC|ENCRYPTION_MODE|[A-Z0-9_]+_KEY_SIZE|IOC_(GET|SET)_ENCRYPTION)/ || $2 ~ /^GRND_/ || + $2 ~ /^RND/ || $2 ~ /^KEY_(SPEC|REQKEY_DEFL)_/ || $2 ~ /^KEYCTL_/ || $2 ~ /^PERF_EVENT_IOC_/ || diff --git a/src/cmd/vendor/golang.org/x/sys/unix/mksyscall_aix_ppc.pl b/src/cmd/vendor/golang.org/x/sys/unix/mksyscall_aix_ppc.pl deleted file mode 100755 index c44de8d310..0000000000 --- a/src/cmd/vendor/golang.org/x/sys/unix/mksyscall_aix_ppc.pl +++ /dev/null @@ -1,384 +0,0 @@ -#!/usr/bin/env perl -# 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. - -# This program reads a file containing function prototypes -# (like syscall_aix.go) and generates system call bodies. -# The prototypes are marked by lines beginning with "//sys" -# and read like func declarations if //sys is replaced by func, but: -# * The parameter lists must give a name for each argument. -# This includes return parameters. -# * The parameter lists must give a type for each argument: -# the (x, y, z int) shorthand is not allowed. -# * If the return parameter is an error number, it must be named err. -# * If go func name needs to be different than its libc name, -# * or the function is not in libc, name could be specified -# * at the end, after "=" sign, like -# //sys getsockopt(s int, level int, name int, val uintptr, vallen *_Socklen) (err error) = libsocket.getsockopt - -use strict; - -my $cmdline = "mksyscall_aix_ppc.pl " . join(' ', @ARGV); -my $errors = 0; -my $_32bit = ""; -my $tags = ""; # build tags -my $aix = 0; -my $solaris = 0; - -binmode STDOUT; - -if($ARGV[0] eq "-b32") { - $_32bit = "big-endian"; - shift; -} elsif($ARGV[0] eq "-l32") { - $_32bit = "little-endian"; - shift; -} -if($ARGV[0] eq "-aix") { - $aix = 1; - shift; -} -if($ARGV[0] eq "-tags") { - shift; - $tags = $ARGV[0]; - shift; -} - -if($ARGV[0] =~ /^-/) { - print STDERR "usage: mksyscall_aix.pl [-b32 | -l32] [-tags x,y] [file ...]\n"; - exit 1; -} - -sub parseparamlist($) { - my ($list) = @_; - $list =~ s/^\s*//; - $list =~ s/\s*$//; - if($list eq "") { - return (); - } - return split(/\s*,\s*/, $list); -} - -sub parseparam($) { - my ($p) = @_; - if($p !~ /^(\S*) (\S*)$/) { - print STDERR "$ARGV:$.: malformed parameter: $p\n"; - $errors = 1; - return ("xx", "int"); - } - return ($1, $2); -} - -my $package = ""; -my $text = ""; -my $c_extern = "/*\n#include \n#include \n"; -my @vars = (); -while(<>) { - chomp; - s/\s+/ /g; - s/^\s+//; - s/\s+$//; - $package = $1 if !$package && /^package (\S+)$/; - my $nonblock = /^\/\/sysnb /; - next if !/^\/\/sys / && !$nonblock; - - # Line must be of the form - # func Open(path string, mode int, perm int) (fd int, err error) - # Split into name, in params, out params. - if(!/^\/\/sys(nb)? (\w+)\(([^()]*)\)\s*(?:\(([^()]+)\))?\s*(?:=\s*(?:(\w*)\.)?(\w*))?$/) { - print STDERR "$ARGV:$.: malformed //sys declaration\n"; - $errors = 1; - next; - } - my ($nb, $func, $in, $out, $modname, $sysname) = ($1, $2, $3, $4, $5, $6); - - # Split argument lists on comma. - my @in = parseparamlist($in); - my @out = parseparamlist($out); - - $in = join(', ', @in); - $out = join(', ', @out); - - # Try in vain to keep people from editing this file. - # The theory is that they jump into the middle of the file - # without reading the header. - $text .= "// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT\n\n"; - - # Check if value return, err return available - my $errvar = ""; - my $retvar = ""; - my $rettype = ""; - foreach my $p (@out) { - my ($name, $type) = parseparam($p); - if($type eq "error") { - $errvar = $name; - } else { - $retvar = $name; - $rettype = $type; - } - } - - # System call name. - #if($func ne "fcntl") { - - if($sysname eq "") { - $sysname = "$func"; - } - - $sysname =~ s/([a-z])([A-Z])/${1}_$2/g; - $sysname =~ y/A-Z/a-z/; # All libc functions are lowercase. - - my $C_rettype = ""; - if($rettype eq "unsafe.Pointer") { - $C_rettype = "uintptr_t"; - } elsif($rettype eq "uintptr") { - $C_rettype = "uintptr_t"; - } elsif($rettype =~ /^_/) { - $C_rettype = "uintptr_t"; - } elsif($rettype eq "int") { - $C_rettype = "int"; - } elsif($rettype eq "int32") { - $C_rettype = "int"; - } elsif($rettype eq "int64") { - $C_rettype = "long long"; - } elsif($rettype eq "uint32") { - $C_rettype = "unsigned int"; - } elsif($rettype eq "uint64") { - $C_rettype = "unsigned long long"; - } else { - $C_rettype = "int"; - } - if($sysname eq "exit") { - $C_rettype = "void"; - } - - # Change types to c - my @c_in = (); - foreach my $p (@in) { - my ($name, $type) = parseparam($p); - if($type =~ /^\*/) { - push @c_in, "uintptr_t"; - } elsif($type eq "string") { - push @c_in, "uintptr_t"; - } elsif($type =~ /^\[\](.*)/) { - push @c_in, "uintptr_t", "size_t"; - } elsif($type eq "unsafe.Pointer") { - push @c_in, "uintptr_t"; - } elsif($type eq "uintptr") { - push @c_in, "uintptr_t"; - } elsif($type =~ /^_/) { - push @c_in, "uintptr_t"; - } elsif($type eq "int") { - push @c_in, "int"; - } elsif($type eq "int32") { - push @c_in, "int"; - } elsif($type eq "int64") { - push @c_in, "long long"; - } elsif($type eq "uint32") { - push @c_in, "unsigned int"; - } elsif($type eq "uint64") { - push @c_in, "unsigned long long"; - } else { - push @c_in, "int"; - } - } - - if ($func ne "fcntl" && $func ne "FcntlInt" && $func ne "readlen" && $func ne "writelen") { - # Imports of system calls from libc - $c_extern .= "$C_rettype $sysname"; - my $c_in = join(', ', @c_in); - $c_extern .= "($c_in);\n"; - } - - # So file name. - if($aix) { - if($modname eq "") { - $modname = "libc.a/shr_64.o"; - } else { - print STDERR "$func: only syscall using libc are available\n"; - $errors = 1; - next; - } - } - - my $strconvfunc = "C.CString"; - my $strconvtype = "*byte"; - - # Go function header. - if($out ne "") { - $out = " ($out)"; - } - if($text ne "") { - $text .= "\n" - } - - $text .= sprintf "func %s(%s)%s {\n", $func, join(', ', @in), $out ; - - # Prepare arguments to call. - my @args = (); - my $n = 0; - my $arg_n = 0; - foreach my $p (@in) { - my ($name, $type) = parseparam($p); - if($type =~ /^\*/) { - push @args, "C.uintptr_t(uintptr(unsafe.Pointer($name)))"; - } elsif($type eq "string" && $errvar ne "") { - $text .= "\t_p$n := uintptr(unsafe.Pointer($strconvfunc($name)))\n"; - push @args, "C.uintptr_t(_p$n)"; - $n++; - } elsif($type eq "string") { - print STDERR "$ARGV:$.: $func uses string arguments, but has no error return\n"; - $text .= "\t_p$n := uintptr(unsafe.Pointer($strconvfunc($name)))\n"; - push @args, "C.uintptr_t(_p$n)"; - $n++; - } elsif($type =~ /^\[\](.*)/) { - # Convert slice into pointer, length. - # Have to be careful not to take address of &a[0] if len == 0: - # pass nil in that case. - $text .= "\tvar _p$n *$1\n"; - $text .= "\tif len($name) > 0 {\n\t\t_p$n = \&$name\[0]\n\t}\n"; - push @args, "C.uintptr_t(uintptr(unsafe.Pointer(_p$n)))"; - $n++; - $text .= "\tvar _p$n int\n"; - $text .= "\t_p$n = len($name)\n"; - push @args, "C.size_t(_p$n)"; - $n++; - } elsif($type eq "int64" && $_32bit ne "") { - if($_32bit eq "big-endian") { - push @args, "uintptr($name >> 32)", "uintptr($name)"; - } else { - push @args, "uintptr($name)", "uintptr($name >> 32)"; - } - $n++; - } elsif($type eq "bool") { - $text .= "\tvar _p$n uint32\n"; - $text .= "\tif $name {\n\t\t_p$n = 1\n\t} else {\n\t\t_p$n = 0\n\t}\n"; - push @args, "_p$n"; - $n++; - } elsif($type =~ /^_/) { - push @args, "C.uintptr_t(uintptr($name))"; - } elsif($type eq "unsafe.Pointer") { - push @args, "C.uintptr_t(uintptr($name))"; - } elsif($type eq "int") { - if (($arg_n == 2) && (($func eq "readlen") || ($func eq "writelen"))) { - push @args, "C.size_t($name)"; - } elsif ($arg_n == 0 && $func eq "fcntl") { - push @args, "C.uintptr_t($name)"; - } elsif (($arg_n == 2) && (($func eq "fcntl") || ($func eq "FcntlInt"))) { - push @args, "C.uintptr_t($name)"; - } else { - push @args, "C.int($name)"; - } - } elsif($type eq "int32") { - push @args, "C.int($name)"; - } elsif($type eq "int64") { - push @args, "C.longlong($name)"; - } elsif($type eq "uint32") { - push @args, "C.uint($name)"; - } elsif($type eq "uint64") { - push @args, "C.ulonglong($name)"; - } elsif($type eq "uintptr") { - push @args, "C.uintptr_t($name)"; - } else { - push @args, "C.int($name)"; - } - $arg_n++; - } - my $nargs = @args; - - - # Determine which form to use; pad args with zeros. - if ($nonblock) { - } - - my $args = join(', ', @args); - my $call = ""; - if ($sysname eq "exit") { - if ($errvar ne "") { - $call .= "er :="; - } else { - $call .= ""; - } - } elsif ($errvar ne "") { - $call .= "r0,er :="; - } elsif ($retvar ne "") { - $call .= "r0,_ :="; - } else { - $call .= "" - } - $call .= "C.$sysname($args)"; - - # Assign return values. - my $body = ""; - my $failexpr = ""; - - for(my $i=0; $i<@out; $i++) { - my $p = $out[$i]; - my ($name, $type) = parseparam($p); - my $reg = ""; - if($name eq "err") { - $reg = "e1"; - } else { - $reg = "r0"; - } - if($reg ne "e1" ) { - $body .= "\t$name = $type($reg)\n"; - } - } - - # verify return - if ($sysname ne "exit" && $errvar ne "") { - if ($C_rettype =~ /^uintptr/) { - $body .= "\tif \(uintptr\(r0\) ==\^uintptr\(0\) && er != nil\) {\n"; - $body .= "\t\t$errvar = er\n"; - $body .= "\t}\n"; - } else { - $body .= "\tif \(r0 ==-1 && er != nil\) {\n"; - $body .= "\t\t$errvar = er\n"; - $body .= "\t}\n"; - } - } elsif ($errvar ne "") { - $body .= "\tif \(er != nil\) {\n"; - $body .= "\t\t$errvar = er\n"; - $body .= "\t}\n"; - } - - $text .= "\t$call\n"; - $text .= $body; - - $text .= "\treturn\n"; - $text .= "}\n"; -} - -if($errors) { - exit 1; -} - -print < \n"; -# GC -my $textgc = ""; -my $dynimports = ""; -my $linknames = ""; -my @vars = (); -# COMMUN -my $textcommon = ""; - -while(<>) { - chomp; - s/\s+/ /g; - s/^\s+//; - s/\s+$//; - $package = $1 if !$package && /^package (\S+)$/; - my $nonblock = /^\/\/sysnb /; - next if !/^\/\/sys / && !$nonblock; - - # Line must be of the form - # func Open(path string, mode int, perm int) (fd int, err error) - # Split into name, in params, out params. - if(!/^\/\/sys(nb)? (\w+)\(([^()]*)\)\s*(?:\(([^()]+)\))?\s*(?:=\s*(?:(\w*)\.)?(\w*))?$/) { - print STDERR "$ARGV:$.: malformed //sys declaration\n"; - $errors = 1; - next; - } - my ($nb, $func, $in, $out, $modname, $sysname) = ($1, $2, $3, $4, $5, $6); - - # Split argument lists on comma. - my @in = parseparamlist($in); - my @out = parseparamlist($out); - - $in = join(', ', @in); - $out = join(', ', @out); - - if($sysname eq "") { - $sysname = "$func"; - } - - my $onlyCommon = 0; - if ($func eq "readlen" || $func eq "writelen" || $func eq "FcntlInt" || $func eq "FcntlFlock") { - # This function call another syscall which is already implemented. - # Therefore, the gc and gccgo part must not be generated. - $onlyCommon = 1 - } - - # Try in vain to keep people from editing this file. - # The theory is that they jump into the middle of the file - # without reading the header. - - $textcommon .= "// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT\n\n"; - if (!$onlyCommon) { - $textgccgo .= "// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT\n\n"; - $textgc .= "// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT\n\n"; - } - - - # Check if value return, err return available - my $errvar = ""; - my $retvar = ""; - my $rettype = ""; - foreach my $p (@out) { - my ($name, $type) = parseparam($p); - if($type eq "error") { - $errvar = $name; - } else { - $retvar = $name; - $rettype = $type; - } - } - - - $sysname =~ s/([a-z])([A-Z])/${1}_$2/g; - $sysname =~ y/A-Z/a-z/; # All libc functions are lowercase. - - # GCCGO Prototype return type - my $C_rettype = ""; - if($rettype eq "unsafe.Pointer") { - $C_rettype = "uintptr_t"; - } elsif($rettype eq "uintptr") { - $C_rettype = "uintptr_t"; - } elsif($rettype =~ /^_/) { - $C_rettype = "uintptr_t"; - } elsif($rettype eq "int") { - $C_rettype = "int"; - } elsif($rettype eq "int32") { - $C_rettype = "int"; - } elsif($rettype eq "int64") { - $C_rettype = "long long"; - } elsif($rettype eq "uint32") { - $C_rettype = "unsigned int"; - } elsif($rettype eq "uint64") { - $C_rettype = "unsigned long long"; - } else { - $C_rettype = "int"; - } - if($sysname eq "exit") { - $C_rettype = "void"; - } - - # GCCGO Prototype arguments type - my @c_in = (); - foreach my $i (0 .. $#in) { - my ($name, $type) = parseparam($in[$i]); - if($type =~ /^\*/) { - push @c_in, "uintptr_t"; - } elsif($type eq "string") { - push @c_in, "uintptr_t"; - } elsif($type =~ /^\[\](.*)/) { - push @c_in, "uintptr_t", "size_t"; - } elsif($type eq "unsafe.Pointer") { - push @c_in, "uintptr_t"; - } elsif($type eq "uintptr") { - push @c_in, "uintptr_t"; - } elsif($type =~ /^_/) { - push @c_in, "uintptr_t"; - } elsif($type eq "int") { - if (($i == 0 || $i == 2) && $func eq "fcntl"){ - # These fcntl arguments needs to be uintptr to be able to call FcntlInt and FcntlFlock - push @c_in, "uintptr_t"; - } else { - push @c_in, "int"; - } - } elsif($type eq "int32") { - push @c_in, "int"; - } elsif($type eq "int64") { - push @c_in, "long long"; - } elsif($type eq "uint32") { - push @c_in, "unsigned int"; - } elsif($type eq "uint64") { - push @c_in, "unsigned long long"; - } else { - push @c_in, "int"; - } - } - - if (!$onlyCommon){ - # GCCGO Prototype Generation - # Imports of system calls from libc - $c_extern .= "$C_rettype $sysname"; - my $c_in = join(', ', @c_in); - $c_extern .= "($c_in);\n"; - } - - # GC Library name - if($modname eq "") { - $modname = "libc.a/shr_64.o"; - } else { - print STDERR "$func: only syscall using libc are available\n"; - $errors = 1; - next; - } - my $sysvarname = "libc_${sysname}"; - - if (!$onlyCommon){ - # GC Runtime import of function to allow cross-platform builds. - $dynimports .= "//go:cgo_import_dynamic ${sysvarname} ${sysname} \"$modname\"\n"; - # GC Link symbol to proc address variable. - $linknames .= "//go:linkname ${sysvarname} ${sysvarname}\n"; - # GC Library proc address variable. - push @vars, $sysvarname; - } - - my $strconvfunc ="BytePtrFromString"; - my $strconvtype = "*byte"; - - # Go function header. - if($out ne "") { - $out = " ($out)"; - } - if($textcommon ne "") { - $textcommon .= "\n" - } - - $textcommon .= sprintf "func %s(%s)%s {\n", $func, join(', ', @in), $out ; - - # Prepare arguments to call. - my @argscommun = (); # Arguments in the commun part - my @argscall = (); # Arguments for call prototype - my @argsgc = (); # Arguments for gc call (with syscall6) - my @argsgccgo = (); # Arguments for gccgo call (with C.name_of_syscall) - my $n = 0; - my $arg_n = 0; - foreach my $p (@in) { - my ($name, $type) = parseparam($p); - if($type =~ /^\*/) { - push @argscommun, "uintptr(unsafe.Pointer($name))"; - push @argscall, "$name uintptr"; - push @argsgc, "$name"; - push @argsgccgo, "C.uintptr_t($name)"; - } elsif($type eq "string" && $errvar ne "") { - $textcommon .= "\tvar _p$n $strconvtype\n"; - $textcommon .= "\t_p$n, $errvar = $strconvfunc($name)\n"; - $textcommon .= "\tif $errvar != nil {\n\t\treturn\n\t}\n"; - - push @argscommun, "uintptr(unsafe.Pointer(_p$n))"; - push @argscall, "_p$n uintptr "; - push @argsgc, "_p$n"; - push @argsgccgo, "C.uintptr_t(_p$n)"; - $n++; - } elsif($type eq "string") { - print STDERR "$ARGV:$.: $func uses string arguments, but has no error return\n"; - $textcommon .= "\tvar _p$n $strconvtype\n"; - $textcommon .= "\t_p$n, $errvar = $strconvfunc($name)\n"; - $textcommon .= "\tif $errvar != nil {\n\t\treturn\n\t}\n"; - - push @argscommun, "uintptr(unsafe.Pointer(_p$n))"; - push @argscall, "_p$n uintptr"; - push @argsgc, "_p$n"; - push @argsgccgo, "C.uintptr_t(_p$n)"; - $n++; - } elsif($type =~ /^\[\](.*)/) { - # Convert slice into pointer, length. - # Have to be careful not to take address of &a[0] if len == 0: - # pass nil in that case. - $textcommon .= "\tvar _p$n *$1\n"; - $textcommon .= "\tif len($name) > 0 {\n\t\t_p$n = \&$name\[0]\n\t}\n"; - push @argscommun, "uintptr(unsafe.Pointer(_p$n))", "len($name)"; - push @argscall, "_p$n uintptr", "_lenp$n int"; - push @argsgc, "_p$n", "uintptr(_lenp$n)"; - push @argsgccgo, "C.uintptr_t(_p$n)", "C.size_t(_lenp$n)"; - $n++; - } elsif($type eq "int64" && $_32bit ne "") { - print STDERR "$ARGV:$.: $func uses int64 with 32 bits mode. Case not yet implemented\n"; - # if($_32bit eq "big-endian") { - # push @args, "uintptr($name >> 32)", "uintptr($name)"; - # } else { - # push @args, "uintptr($name)", "uintptr($name >> 32)"; - # } - # $n++; - } elsif($type eq "bool") { - print STDERR "$ARGV:$.: $func uses bool. Case not yet implemented\n"; - # $text .= "\tvar _p$n uint32\n"; - # $text .= "\tif $name {\n\t\t_p$n = 1\n\t} else {\n\t\t_p$n = 0\n\t}\n"; - # push @args, "_p$n"; - # $n++; - } elsif($type =~ /^_/ ||$type eq "unsafe.Pointer") { - push @argscommun, "uintptr($name)"; - push @argscall, "$name uintptr"; - push @argsgc, "$name"; - push @argsgccgo, "C.uintptr_t($name)"; - } elsif($type eq "int") { - if (($arg_n == 0 || $arg_n == 2) && ($func eq "fcntl" || $func eq "FcntlInt" || $func eq "FcntlFlock")) { - # These fcntl arguments need to be uintptr to be able to call FcntlInt and FcntlFlock - push @argscommun, "uintptr($name)"; - push @argscall, "$name uintptr"; - push @argsgc, "$name"; - push @argsgccgo, "C.uintptr_t($name)"; - } else { - push @argscommun, "$name"; - push @argscall, "$name int"; - push @argsgc, "uintptr($name)"; - push @argsgccgo, "C.int($name)"; - } - } elsif($type eq "int32") { - push @argscommun, "$name"; - push @argscall, "$name int32"; - push @argsgc, "uintptr($name)"; - push @argsgccgo, "C.int($name)"; - } elsif($type eq "int64") { - push @argscommun, "$name"; - push @argscall, "$name int64"; - push @argsgc, "uintptr($name)"; - push @argsgccgo, "C.longlong($name)"; - } elsif($type eq "uint32") { - push @argscommun, "$name"; - push @argscall, "$name uint32"; - push @argsgc, "uintptr($name)"; - push @argsgccgo, "C.uint($name)"; - } elsif($type eq "uint64") { - push @argscommun, "$name"; - push @argscall, "$name uint64"; - push @argsgc, "uintptr($name)"; - push @argsgccgo, "C.ulonglong($name)"; - } elsif($type eq "uintptr") { - push @argscommun, "$name"; - push @argscall, "$name uintptr"; - push @argsgc, "$name"; - push @argsgccgo, "C.uintptr_t($name)"; - } else { - push @argscommun, "int($name)"; - push @argscall, "$name int"; - push @argsgc, "uintptr($name)"; - push @argsgccgo, "C.int($name)"; - } - $arg_n++; - } - my $nargs = @argsgc; - - # COMMUN function generation - my $argscommun = join(', ', @argscommun); - my $callcommun = "call$sysname($argscommun)"; - my @ret = ("_", "_"); - my $body = ""; - my $do_errno = 0; - for(my $i=0; $i<@out; $i++) { - my $p = $out[$i]; - my ($name, $type) = parseparam($p); - my $reg = ""; - if($name eq "err") { - $reg = "e1"; - $ret[1] = $reg; - $do_errno = 1; - } else { - $reg = "r0"; - $ret[0] = $reg; - } - if($type eq "bool") { - $reg = "$reg != 0"; - } - if($reg ne "e1") { - $body .= "\t$name = $type($reg)\n"; - } - } - if ($ret[0] eq "_" && $ret[1] eq "_") { - $textcommon .= "\t$callcommun\n"; - } else { - $textcommon .= "\t$ret[0], $ret[1] := $callcommun\n"; - } - $textcommon .= $body; - - if ($do_errno) { - $textcommon .= "\tif e1 != 0 {\n"; - $textcommon .= "\t\terr = errnoErr(e1)\n"; - $textcommon .= "\t}\n"; - } - $textcommon .= "\treturn\n"; - $textcommon .= "}\n"; - - if ($onlyCommon){ - next - } - # CALL Prototype - my $callProto = sprintf "func call%s(%s) (r1 uintptr, e1 Errno) {\n", $sysname, join(', ', @argscall); - - # GC function generation - my $asm = "syscall6"; - if ($nonblock) { - $asm = "rawSyscall6"; - } - - if(@argsgc <= 6) { - while(@argsgc < 6) { - push @argsgc, "0"; - } - } else { - print STDERR "$ARGV:$.: too many arguments to system call\n"; - } - my $argsgc = join(', ', @argsgc); - my $callgc = "$asm(uintptr(unsafe.Pointer(&$sysvarname)), $nargs, $argsgc)"; - - $textgc .= $callProto; - $textgc .= "\tr1, _, e1 = $callgc\n"; - $textgc .= "\treturn\n}\n"; - - # GCCGO function generation - my $argsgccgo = join(', ', @argsgccgo); - my $callgccgo = "C.$sysname($argsgccgo)"; - $textgccgo .= $callProto; - $textgccgo .= "\tr1 = uintptr($callgccgo)\n"; - $textgccgo .= "\te1 = syscall.GetErrno()\n"; - $textgccgo .= "\treturn\n}\n"; -} - -if($errors) { - exit 1; -} - -# Print zsyscall_aix_ppc64.go -open(my $fcommun, '>', 'zsyscall_aix_ppc64.go'); -my $tofcommun = < ', 'zsyscall_aix_ppc64_gc.go'); -my $tofgc = < ', 'zsyscall_aix_ppc64_gccgo.go'); -my $tofgccgo = < ) { - chomp; - s/\s+/ /g; - s/^\s+//; - s/\s+$//; - $package = $1 if !$package && /^package (\S+)$/; - my $nonblock = /^\/\/sysnb /; - next if !/^\/\/sys / && !$nonblock; - - # Line must be of the form - # func Open(path string, mode int, perm int) (fd int, err error) - # Split into name, in params, out params. - if(!/^\/\/sys(nb)? (\w+)\(([^()]*)\)\s*(?:\(([^()]+)\))?\s*(?:=\s*(?:(\w*)\.)?(\w*))?$/) { - print STDERR "$ARGV:$.: malformed //sys declaration\n"; - $errors = 1; - next; - } - my ($nb, $func, $in, $out, $modname, $sysname) = ($1, $2, $3, $4, $5, $6); - - # Split argument lists on comma. - my @in = parseparamlist($in); - my @out = parseparamlist($out); - - # Try in vain to keep people from editing this file. - # The theory is that they jump into the middle of the file - # without reading the header. - $text .= "// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT\n\n"; - - # So file name. - if($modname eq "") { - $modname = "libc"; - } - - # System call name. - if($sysname eq "") { - $sysname = "$func"; - } - - # System call pointer variable name. - my $sysvarname = "proc$sysname"; - - my $strconvfunc = "BytePtrFromString"; - my $strconvtype = "*byte"; - - $sysname =~ y/A-Z/a-z/; # All libc functions are lowercase. - - # Runtime import of function to allow cross-platform builds. - $dynimports .= "//go:cgo_import_dynamic libc_${sysname} ${sysname} \"$modname.so\"\n"; - # Link symbol to proc address variable. - $linknames .= "//go:linkname ${sysvarname} libc_${sysname}\n"; - # Library proc address variable. - push @vars, $sysvarname; - - # Go function header. - $out = join(', ', @out); - if($out ne "") { - $out = " ($out)"; - } - if($text ne "") { - $text .= "\n" - } - $text .= sprintf "func %s(%s)%s {\n", $func, join(', ', @in), $out; - - # Check if err return available - my $errvar = ""; - foreach my $p (@out) { - my ($name, $type) = parseparam($p); - if($type eq "error") { - $errvar = $name; - last; - } - } - - # Prepare arguments to Syscall. - my @args = (); - my $n = 0; - foreach my $p (@in) { - my ($name, $type) = parseparam($p); - if($type =~ /^\*/) { - push @args, "uintptr(unsafe.Pointer($name))"; - } elsif($type eq "string" && $errvar ne "") { - $text .= "\tvar _p$n $strconvtype\n"; - $text .= "\t_p$n, $errvar = $strconvfunc($name)\n"; - $text .= "\tif $errvar != nil {\n\t\treturn\n\t}\n"; - push @args, "uintptr(unsafe.Pointer(_p$n))"; - $n++; - } elsif($type eq "string") { - print STDERR "$ARGV:$.: $func uses string arguments, but has no error return\n"; - $text .= "\tvar _p$n $strconvtype\n"; - $text .= "\t_p$n, _ = $strconvfunc($name)\n"; - push @args, "uintptr(unsafe.Pointer(_p$n))"; - $n++; - } elsif($type =~ /^\[\](.*)/) { - # Convert slice into pointer, length. - # Have to be careful not to take address of &a[0] if len == 0: - # pass nil in that case. - $text .= "\tvar _p$n *$1\n"; - $text .= "\tif len($name) > 0 {\n\t\t_p$n = \&$name\[0]\n\t}\n"; - push @args, "uintptr(unsafe.Pointer(_p$n))", "uintptr(len($name))"; - $n++; - } elsif($type eq "int64" && $_32bit ne "") { - if($_32bit eq "big-endian") { - push @args, "uintptr($name >> 32)", "uintptr($name)"; - } else { - push @args, "uintptr($name)", "uintptr($name >> 32)"; - } - } elsif($type eq "bool") { - $text .= "\tvar _p$n uint32\n"; - $text .= "\tif $name {\n\t\t_p$n = 1\n\t} else {\n\t\t_p$n = 0\n\t}\n"; - push @args, "uintptr(_p$n)"; - $n++; - } else { - push @args, "uintptr($name)"; - } - } - my $nargs = @args; - - # Determine which form to use; pad args with zeros. - my $asm = "sysvicall6"; - if ($nonblock) { - $asm = "rawSysvicall6"; - } - if(@args <= 6) { - while(@args < 6) { - push @args, "0"; - } - } else { - print STDERR "$ARGV:$.: too many arguments to system call\n"; - } - - # Actual call. - my $args = join(', ', @args); - my $call = "$asm(uintptr(unsafe.Pointer(&$sysvarname)), $nargs, $args)"; - - # Assign return values. - my $body = ""; - my $failexpr = ""; - my @ret = ("_", "_", "_"); - my @pout= (); - my $do_errno = 0; - for(my $i=0; $i<@out; $i++) { - my $p = $out[$i]; - my ($name, $type) = parseparam($p); - my $reg = ""; - if($name eq "err") { - $reg = "e1"; - $ret[2] = $reg; - $do_errno = 1; - } else { - $reg = sprintf("r%d", $i); - $ret[$i] = $reg; - } - if($type eq "bool") { - $reg = "$reg != 0"; - } - if($type eq "int64" && $_32bit ne "") { - # 64-bit number in r1:r0 or r0:r1. - if($i+2 > @out) { - print STDERR "$ARGV:$.: not enough registers for int64 return\n"; - } - if($_32bit eq "big-endian") { - $reg = sprintf("int64(r%d)<<32 | int64(r%d)", $i, $i+1); - } else { - $reg = sprintf("int64(r%d)<<32 | int64(r%d)", $i+1, $i); - } - $ret[$i] = sprintf("r%d", $i); - $ret[$i+1] = sprintf("r%d", $i+1); - } - if($reg ne "e1") { - $body .= "\t$name = $type($reg)\n"; - } - } - if ($ret[0] eq "_" && $ret[1] eq "_" && $ret[2] eq "_") { - $text .= "\t$call\n"; - } else { - $text .= "\t$ret[0], $ret[1], $ret[2] := $call\n"; - } - $text .= $body; - - if ($do_errno) { - $text .= "\tif e1 != 0 {\n"; - $text .= "\t\terr = e1\n"; - $text .= "\t}\n"; - } - $text .= "\treturn\n"; - $text .= "}\n"; -} - -if($errors) { - exit 1; -} - -print < 0 { + p = unsafe.Pointer(&filter[0]) + } + return setsockopt(fd, level, opt, p, uintptr(len(filter)*SizeofCanFilter)) +} + // Keyctl Commands (http://man7.org/linux/man-pages/man2/keyctl.2.html) // KeyctlInt calls keyctl commands in which each argument is an int. @@ -1381,6 +1408,7 @@ func Sendfile(outfd int, infd int, offset *int64, count int) (written int, err e //sys Chroot(path string) (err error) //sys ClockGetres(clockid int32, res *Timespec) (err error) //sys ClockGettime(clockid int32, time *Timespec) (err error) +//sys ClockNanosleep(clockid int32, flags int, request *Timespec, remain *Timespec) (err error) //sys Close(fd int) (err error) //sys CopyFileRange(rfd int, roff *int64, wfd int, woff *int64, len int, flags int) (n int, err error) //sys DeleteModule(name string, flags int) (err error) @@ -1441,7 +1469,6 @@ func Getpgrp() (pid int) { //sys Pselect(nfd int, r *FdSet, w *FdSet, e *FdSet, timeout *Timespec, sigmask *Sigset_t) (n int, err error) = SYS_PSELECT6 //sys read(fd int, p []byte) (n int, err error) //sys Removexattr(path string, attr string) (err error) -//sys Renameat(olddirfd int, oldpath string, newdirfd int, newpath string) (err error) //sys Renameat2(olddirfd int, oldpath string, newdirfd int, newpath string, flags uint) (err error) //sys RequestKey(keyType string, description string, callback string, destRingid int) (id int, err error) //sys Setdomainname(p []byte) (err error) @@ -1466,6 +1493,7 @@ func Setgid(uid int) (err error) { //sys Setpriority(which int, who int, prio int) (err error) //sys Setxattr(path string, attr string, data []byte, flags int) (err error) +//sys Signalfd(fd int, mask *Sigset_t, flags int) = SYS_SIGNALFD4 //sys Statx(dirfd int, path string, flags int, mask int, stat *Statx_t) (err error) //sys Sync() //sys Syncfs(fd int) (err error) @@ -1682,7 +1710,6 @@ func Faccessat(dirfd int, path string, mode uint32, flags int) (err error) { // Shmdt // Shmget // Sigaltstack -// Signalfd // Swapoff // Swapon // Sysfs diff --git a/src/cmd/vendor/golang.org/x/sys/unix/syscall_linux_386.go b/src/cmd/vendor/golang.org/x/sys/unix/syscall_linux_386.go index 74bc098ce1..e2f8cf6e5a 100644 --- a/src/cmd/vendor/golang.org/x/sys/unix/syscall_linux_386.go +++ b/src/cmd/vendor/golang.org/x/sys/unix/syscall_linux_386.go @@ -68,6 +68,7 @@ func Pipe2(p []int, flags int) (err error) { //sys Lstat(path string, stat *Stat_t) (err error) = SYS_LSTAT64 //sys Pread(fd int, p []byte, offset int64) (n int, err error) = SYS_PREAD64 //sys Pwrite(fd int, p []byte, offset int64) (n int, err error) = SYS_PWRITE64 +//sys Renameat(olddirfd int, oldpath string, newdirfd int, newpath string) (err error) //sys sendfile(outfd int, infd int, offset *int64, count int) (written int, err error) = SYS_SENDFILE64 //sys Setfsgid(gid int) (err error) = SYS_SETFSGID32 //sys Setfsuid(uid int) (err error) = SYS_SETFSUID32 diff --git a/src/cmd/vendor/golang.org/x/sys/unix/syscall_linux_amd64.go b/src/cmd/vendor/golang.org/x/sys/unix/syscall_linux_amd64.go index 615f2918ad..87a30744d6 100644 --- a/src/cmd/vendor/golang.org/x/sys/unix/syscall_linux_amd64.go +++ b/src/cmd/vendor/golang.org/x/sys/unix/syscall_linux_amd64.go @@ -43,6 +43,7 @@ func Lstat(path string, stat *Stat_t) (err error) { //sys Pause() (err error) //sys Pread(fd int, p []byte, offset int64) (n int, err error) = SYS_PREAD64 //sys Pwrite(fd int, p []byte, offset int64) (n int, err error) = SYS_PWRITE64 +//sys Renameat(olddirfd int, oldpath string, newdirfd int, newpath string) (err error) //sys Seek(fd int, offset int64, whence int) (off int64, err error) = SYS_LSEEK func Select(nfd int, r *FdSet, w *FdSet, e *FdSet, timeout *Timeval) (n int, err error) { diff --git a/src/cmd/vendor/golang.org/x/sys/unix/syscall_linux_arm.go b/src/cmd/vendor/golang.org/x/sys/unix/syscall_linux_arm.go index ad2bd2582f..cda3559419 100644 --- a/src/cmd/vendor/golang.org/x/sys/unix/syscall_linux_arm.go +++ b/src/cmd/vendor/golang.org/x/sys/unix/syscall_linux_arm.go @@ -89,6 +89,7 @@ func Seek(fd int, offset int64, whence int) (newoffset int64, err error) { //sys Listen(s int, n int) (err error) //sys Lstat(path string, stat *Stat_t) (err error) = SYS_LSTAT64 //sys Pause() (err error) +//sys Renameat(olddirfd int, oldpath string, newdirfd int, newpath string) (err error) //sys sendfile(outfd int, infd int, offset *int64, count int) (written int, err error) = SYS_SENDFILE64 //sys Select(nfd int, r *FdSet, w *FdSet, e *FdSet, timeout *Timeval) (n int, err error) = SYS__NEWSELECT //sys Setfsgid(gid int) (err error) = SYS_SETFSGID32 diff --git a/src/cmd/vendor/golang.org/x/sys/unix/syscall_linux_arm64.go b/src/cmd/vendor/golang.org/x/sys/unix/syscall_linux_arm64.go index fa5a9a6f64..6d56722401 100644 --- a/src/cmd/vendor/golang.org/x/sys/unix/syscall_linux_arm64.go +++ b/src/cmd/vendor/golang.org/x/sys/unix/syscall_linux_arm64.go @@ -30,6 +30,7 @@ func EpollCreate(size int) (fd int, err error) { //sys Listen(s int, n int) (err error) //sys Pread(fd int, p []byte, offset int64) (n int, err error) = SYS_PREAD64 //sys Pwrite(fd int, p []byte, offset int64) (n int, err error) = SYS_PWRITE64 +//sys Renameat(olddirfd int, oldpath string, newdirfd int, newpath string) (err error) //sys Seek(fd int, offset int64, whence int) (off int64, err error) = SYS_LSEEK func Select(nfd int, r *FdSet, w *FdSet, e *FdSet, timeout *Timeval) (n int, err error) { diff --git a/src/cmd/vendor/golang.org/x/sys/unix/syscall_linux_mips64x.go b/src/cmd/vendor/golang.org/x/sys/unix/syscall_linux_mips64x.go index 18541dc573..b3b21ec1e2 100644 --- a/src/cmd/vendor/golang.org/x/sys/unix/syscall_linux_mips64x.go +++ b/src/cmd/vendor/golang.org/x/sys/unix/syscall_linux_mips64x.go @@ -24,6 +24,7 @@ package unix //sys Pause() (err error) //sys Pread(fd int, p []byte, offset int64) (n int, err error) = SYS_PREAD64 //sys Pwrite(fd int, p []byte, offset int64) (n int, err error) = SYS_PWRITE64 +//sys Renameat(olddirfd int, oldpath string, newdirfd int, newpath string) (err error) //sys Seek(fd int, offset int64, whence int) (off int64, err error) = SYS_LSEEK func Select(nfd int, r *FdSet, w *FdSet, e *FdSet, timeout *Timeval) (n int, err error) { diff --git a/src/cmd/vendor/golang.org/x/sys/unix/syscall_linux_mipsx.go b/src/cmd/vendor/golang.org/x/sys/unix/syscall_linux_mipsx.go index 99e0e999a1..5144d4e133 100644 --- a/src/cmd/vendor/golang.org/x/sys/unix/syscall_linux_mipsx.go +++ b/src/cmd/vendor/golang.org/x/sys/unix/syscall_linux_mipsx.go @@ -28,6 +28,7 @@ func Syscall9(trap, a1, a2, a3, a4, a5, a6, a7, a8, a9 uintptr) (r1, r2 uintptr, //sys Listen(s int, n int) (err error) //sys Pread(fd int, p []byte, offset int64) (n int, err error) = SYS_PREAD64 //sys Pwrite(fd int, p []byte, offset int64) (n int, err error) = SYS_PWRITE64 +//sys Renameat(olddirfd int, oldpath string, newdirfd int, newpath string) (err error) //sys Select(nfd int, r *FdSet, w *FdSet, e *FdSet, timeout *Timeval) (n int, err error) = SYS__NEWSELECT //sys sendfile(outfd int, infd int, offset *int64, count int) (written int, err error) = SYS_SENDFILE64 //sys Setfsgid(gid int) (err error) diff --git a/src/cmd/vendor/golang.org/x/sys/unix/syscall_linux_ppc64x.go b/src/cmd/vendor/golang.org/x/sys/unix/syscall_linux_ppc64x.go index 41451854bc..0a100b66a3 100644 --- a/src/cmd/vendor/golang.org/x/sys/unix/syscall_linux_ppc64x.go +++ b/src/cmd/vendor/golang.org/x/sys/unix/syscall_linux_ppc64x.go @@ -30,6 +30,7 @@ package unix //sys Pause() (err error) //sys Pread(fd int, p []byte, offset int64) (n int, err error) = SYS_PREAD64 //sys Pwrite(fd int, p []byte, offset int64) (n int, err error) = SYS_PWRITE64 +//sys Renameat(olddirfd int, oldpath string, newdirfd int, newpath string) (err error) //sys Seek(fd int, offset int64, whence int) (off int64, err error) = SYS_LSEEK //sys Select(nfd int, r *FdSet, w *FdSet, e *FdSet, timeout *Timeval) (n int, err error) = SYS__NEWSELECT //sys sendfile(outfd int, infd int, offset *int64, count int) (written int, err error) diff --git a/src/cmd/vendor/golang.org/x/sys/unix/syscall_linux_riscv64.go b/src/cmd/vendor/golang.org/x/sys/unix/syscall_linux_riscv64.go index 44aa1227a6..f23ca451c7 100644 --- a/src/cmd/vendor/golang.org/x/sys/unix/syscall_linux_riscv64.go +++ b/src/cmd/vendor/golang.org/x/sys/unix/syscall_linux_riscv64.go @@ -207,3 +207,7 @@ func Poll(fds []PollFd, timeout int) (n int, err error) { } return ppoll(&fds[0], len(fds), ts, nil) } + +func Renameat(olddirfd int, oldpath string, newdirfd int, newpath string) (err error) { + return Renameat2(olddirfd, oldpath, newdirfd, newpath, 0) +} diff --git a/src/cmd/vendor/golang.org/x/sys/unix/syscall_linux_s390x.go b/src/cmd/vendor/golang.org/x/sys/unix/syscall_linux_s390x.go index f52f148f9f..f81dbdc9c8 100644 --- a/src/cmd/vendor/golang.org/x/sys/unix/syscall_linux_s390x.go +++ b/src/cmd/vendor/golang.org/x/sys/unix/syscall_linux_s390x.go @@ -30,6 +30,7 @@ import ( //sys Pause() (err error) //sys Pread(fd int, p []byte, offset int64) (n int, err error) = SYS_PREAD64 //sys Pwrite(fd int, p []byte, offset int64) (n int, err error) = SYS_PWRITE64 +//sys Renameat(olddirfd int, oldpath string, newdirfd int, newpath string) (err error) //sys Seek(fd int, offset int64, whence int) (off int64, err error) = SYS_LSEEK //sys Select(nfd int, r *FdSet, w *FdSet, e *FdSet, timeout *Timeval) (n int, err error) //sys sendfile(outfd int, infd int, offset *int64, count int) (written int, err error) diff --git a/src/cmd/vendor/golang.org/x/sys/unix/syscall_linux_sparc64.go b/src/cmd/vendor/golang.org/x/sys/unix/syscall_linux_sparc64.go index 72e64187de..b69565616f 100644 --- a/src/cmd/vendor/golang.org/x/sys/unix/syscall_linux_sparc64.go +++ b/src/cmd/vendor/golang.org/x/sys/unix/syscall_linux_sparc64.go @@ -26,6 +26,7 @@ package unix //sys Pause() (err error) //sys Pread(fd int, p []byte, offset int64) (n int, err error) = SYS_PREAD64 //sys Pwrite(fd int, p []byte, offset int64) (n int, err error) = SYS_PWRITE64 +//sys Renameat(olddirfd int, oldpath string, newdirfd int, newpath string) (err error) //sys Seek(fd int, offset int64, whence int) (off int64, err error) = SYS_LSEEK //sys Select(nfd int, r *FdSet, w *FdSet, e *FdSet, timeout *Timeval) (n int, err error) //sys sendfile(outfd int, infd int, offset *int64, count int) (written int, err error) diff --git a/src/cmd/vendor/golang.org/x/sys/unix/syscall_linux_test.go b/src/cmd/vendor/golang.org/x/sys/unix/syscall_linux_test.go index 758efa66e5..3c3bd816fd 100644 --- a/src/cmd/vendor/golang.org/x/sys/unix/syscall_linux_test.go +++ b/src/cmd/vendor/golang.org/x/sys/unix/syscall_linux_test.go @@ -32,11 +32,27 @@ func TestIoctlGetInt(t *testing.T) { t.Logf("%d bits of entropy available", v) } +func TestIoctlGetRTCTime(t *testing.T) { + f, err := os.Open("/dev/rtc0") + if err != nil { + t.Skipf("skipping test, %v", err) + } + defer f.Close() + + v, err := unix.IoctlGetRTCTime(int(f.Fd())) + if err != nil { + t.Fatalf("failed to perform ioctl: %v", err) + } + + t.Logf("RTC time: %04d-%02d-%02d %02d:%02d:%02d", v.Year+1900, v.Mon+1, v.Mday, v.Hour, v.Min, v.Sec) +} + func TestPpoll(t *testing.T) { if runtime.GOOS == "android" { t.Skip("mkfifo syscall is not available on android, skipping test") } + defer chtmpdir(t)() f, cleanup := mktmpfifo(t) defer cleanup() @@ -482,3 +498,36 @@ func TestSyncFileRange(t *testing.T) { t.Fatalf("SyncFileRange: unexpected error: %v, want EINVAL", err) } } + +func TestClockNanosleep(t *testing.T) { + delay := 100 * time.Millisecond + + // Relative timespec. + start := time.Now() + rel := unix.NsecToTimespec(delay.Nanoseconds()) + err := unix.ClockNanosleep(unix.CLOCK_MONOTONIC, 0, &rel, nil) + if err == unix.ENOSYS || err == unix.EPERM { + t.Skip("clock_nanosleep syscall is not available, skipping test") + } else if err != nil { + t.Errorf("ClockNanosleep(CLOCK_MONOTONIC, 0, %#v, nil) = %v", &rel, err) + } else if slept := time.Now().Sub(start); slept < delay { + t.Errorf("ClockNanosleep(CLOCK_MONOTONIC, 0, %#v, nil) slept only %v", &rel, slept) + } + + // Absolute timespec. + start = time.Now() + until := start.Add(delay) + abs := unix.NsecToTimespec(until.UnixNano()) + err = unix.ClockNanosleep(unix.CLOCK_REALTIME, unix.TIMER_ABSTIME, &abs, nil) + if err != nil { + t.Errorf("ClockNanosleep(CLOCK_REALTIME, TIMER_ABSTIME, %#v (=%v), nil) = %v", &abs, until, err) + } else if slept := time.Now().Sub(start); slept < delay { + t.Errorf("ClockNanosleep(CLOCK_REALTIME, TIMER_ABSTIME, %#v (=%v), nil) slept only %v", &abs, until, slept) + } + + // Invalid clock. clock_nanosleep(2) says EINVAL, but it’s actually EOPNOTSUPP. + err = unix.ClockNanosleep(unix.CLOCK_THREAD_CPUTIME_ID, 0, &rel, nil) + if err != unix.EINVAL && err != unix.EOPNOTSUPP { + t.Errorf("ClockNanosleep(CLOCK_THREAD_CPUTIME_ID, 0, %#v, nil) = %v, want EINVAL or EOPNOTSUPP", &rel, err) + } +} diff --git a/src/cmd/vendor/golang.org/x/sys/unix/syscall_netbsd_arm64.go b/src/cmd/vendor/golang.org/x/sys/unix/syscall_netbsd_arm64.go new file mode 100644 index 0000000000..f3434465a1 --- /dev/null +++ b/src/cmd/vendor/golang.org/x/sys/unix/syscall_netbsd_arm64.go @@ -0,0 +1,33 @@ +// 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 arm64,netbsd + +package unix + +func setTimespec(sec, nsec int64) Timespec { + return Timespec{Sec: sec, Nsec: nsec} +} + +func setTimeval(sec, usec int64) Timeval { + return Timeval{Sec: sec, Usec: int32(usec)} +} + +func SetKevent(k *Kevent_t, fd, mode, flags int) { + k.Ident = uint64(fd) + k.Filter = uint32(mode) + k.Flags = uint32(flags) +} + +func (iov *Iovec) SetLen(length int) { + iov.Len = uint64(length) +} + +func (msghdr *Msghdr) SetControllen(length int) { + msghdr.Controllen = uint32(length) +} + +func (cmsg *Cmsghdr) SetLen(length int) { + cmsg.Len = uint32(length) +} diff --git a/src/cmd/vendor/golang.org/x/sys/unix/syscall_unix_test.go b/src/cmd/vendor/golang.org/x/sys/unix/syscall_unix_test.go index c1b1ea59a0..f6abe8c0d6 100644 --- a/src/cmd/vendor/golang.org/x/sys/unix/syscall_unix_test.go +++ b/src/cmd/vendor/golang.org/x/sys/unix/syscall_unix_test.go @@ -396,14 +396,24 @@ func TestDup(t *testing.T) { t.Fatalf("Dup: %v", err) } - err = unix.Dup2(newFd, newFd+1) + // Create and reserve a file descriptor. + // Dup2 automatically closes it before reusing it. + nullFile, err := os.Open("/dev/null") + if err != nil { + t.Fatal(err) + } + dupFd := int(file.Fd()) + err = unix.Dup2(newFd, dupFd) if err != nil { t.Fatalf("Dup2: %v", err) } + // Keep the dummy file open long enough to not be closed in + // its finalizer. + runtime.KeepAlive(nullFile) b1 := []byte("Test123") b2 := make([]byte, 7) - _, err = unix.Write(newFd+1, b1) + _, err = unix.Write(dupFd, b1) if err != nil { t.Fatalf("Write to dup2 fd failed: %v", err) } @@ -426,6 +436,7 @@ func TestPoll(t *testing.T) { t.Skip("mkfifo syscall is not available on android and iOS, skipping test") } + defer chtmpdir(t)() f, cleanup := mktmpfifo(t) defer cleanup() @@ -623,6 +634,29 @@ func TestMkdev(t *testing.T) { } } +func TestRenameat(t *testing.T) { + defer chtmpdir(t)() + + from, to := "renamefrom", "renameto" + + touch(t, from) + + err := unix.Renameat(unix.AT_FDCWD, from, unix.AT_FDCWD, to) + if err != nil { + t.Fatalf("Renameat: unexpected error: %v", err) + } + + _, err = os.Stat(to) + if err != nil { + t.Error(err) + } + + _, err = os.Stat(from) + if err == nil { + t.Errorf("Renameat: stat of renamed file %q unexpectedly succeeded", from) + } +} + // mktmpfifo creates a temporary FIFO and provides a cleanup function. func mktmpfifo(t *testing.T) (*os.File, func()) { err := unix.Mkfifo("fifo", 0666) diff --git a/src/cmd/vendor/golang.org/x/sys/unix/zerrors_linux_386.go b/src/cmd/vendor/golang.org/x/sys/unix/zerrors_linux_386.go index c62bb94902..cb89df8f54 100644 --- a/src/cmd/vendor/golang.org/x/sys/unix/zerrors_linux_386.go +++ b/src/cmd/vendor/golang.org/x/sys/unix/zerrors_linux_386.go @@ -41,7 +41,7 @@ const ( AF_KEY = 0xf AF_LLC = 0x1a AF_LOCAL = 0x1 - AF_MAX = 0x2c + AF_MAX = 0x2d AF_MPLS = 0x1c AF_NETBEUI = 0xd AF_NETLINK = 0x10 @@ -707,6 +707,7 @@ const ( IN_ISDIR = 0x40000000 IN_LOOPBACKNET = 0x7f IN_MASK_ADD = 0x20000000 + IN_MASK_CREATE = 0x10000000 IN_MODIFY = 0x2 IN_MOVE = 0xc0 IN_MOVED_FROM = 0x40 @@ -778,6 +779,7 @@ const ( IPV6_MINHOPCOUNT = 0x49 IPV6_MTU = 0x18 IPV6_MTU_DISCOVER = 0x17 + IPV6_MULTICAST_ALL = 0x1d IPV6_MULTICAST_HOPS = 0x12 IPV6_MULTICAST_IF = 0x11 IPV6_MULTICAST_LOOP = 0x13 @@ -1537,6 +1539,13 @@ const ( RLIMIT_SIGPENDING = 0xb RLIMIT_STACK = 0x3 RLIM_INFINITY = 0xffffffffffffffff + RNDADDENTROPY = 0x40085203 + RNDADDTOENTCNT = 0x40045201 + RNDCLEARPOOL = 0x5206 + RNDGETENTCNT = 0x80045200 + RNDGETPOOL = 0x80085202 + RNDRESEEDCRNG = 0x5207 + RNDZAPENTCNT = 0x5204 RTAX_ADVMSS = 0x8 RTAX_CC_ALGO = 0x10 RTAX_CWND = 0x7 @@ -1744,6 +1753,8 @@ const ( SECCOMP_MODE_STRICT = 0x1 SECURITYFS_MAGIC = 0x73636673 SELINUX_MAGIC = 0xf97cff8c + SFD_CLOEXEC = 0x80000 + SFD_NONBLOCK = 0x800 SHUT_RD = 0x0 SHUT_RDWR = 0x2 SHUT_WR = 0x1 @@ -1905,6 +1916,17 @@ const ( SO_DETACH_FILTER = 0x1b SO_DOMAIN = 0x27 SO_DONTROUTE = 0x5 + SO_EE_CODE_TXTIME_INVALID_PARAM = 0x1 + SO_EE_CODE_TXTIME_MISSED = 0x2 + SO_EE_CODE_ZEROCOPY_COPIED = 0x1 + SO_EE_ORIGIN_ICMP = 0x2 + SO_EE_ORIGIN_ICMP6 = 0x3 + SO_EE_ORIGIN_LOCAL = 0x1 + SO_EE_ORIGIN_NONE = 0x0 + SO_EE_ORIGIN_TIMESTAMPING = 0x4 + SO_EE_ORIGIN_TXSTATUS = 0x4 + SO_EE_ORIGIN_TXTIME = 0x6 + SO_EE_ORIGIN_ZEROCOPY = 0x5 SO_ERROR = 0x4 SO_GET_FILTER = 0x1a SO_INCOMING_CPU = 0x31 @@ -2038,6 +2060,7 @@ const ( TCOOFF = 0x0 TCOON = 0x1 TCP_CC_INFO = 0x1a + TCP_CM_INQ = 0x24 TCP_CONGESTION = 0xd TCP_COOKIE_IN_ALWAYS = 0x1 TCP_COOKIE_MAX = 0x10 @@ -2052,6 +2075,7 @@ const ( TCP_FASTOPEN_KEY = 0x21 TCP_FASTOPEN_NO_COOKIE = 0x22 TCP_INFO = 0xb + TCP_INQ = 0x24 TCP_KEEPCNT = 0x6 TCP_KEEPIDLE = 0x4 TCP_KEEPINTVL = 0x5 @@ -2071,6 +2095,9 @@ const ( TCP_QUEUE_SEQ = 0x15 TCP_QUICKACK = 0xc TCP_REPAIR = 0x13 + TCP_REPAIR_OFF = 0x0 + TCP_REPAIR_OFF_NO_WP = -0x1 + TCP_REPAIR_ON = 0x1 TCP_REPAIR_OPTIONS = 0x16 TCP_REPAIR_QUEUE = 0x14 TCP_REPAIR_WINDOW = 0x1d @@ -2085,6 +2112,7 @@ const ( TCP_ULP = 0x1f TCP_USER_TIMEOUT = 0x12 TCP_WINDOW_CLAMP = 0xa + TCP_ZEROCOPY_RECEIVE = 0x23 TCSAFLUSH = 0x2 TCSBRK = 0x5409 TCSBRKP = 0x5425 @@ -2101,6 +2129,7 @@ const ( TCSETXF = 0x5434 TCSETXW = 0x5435 TCXONC = 0x540a + TIMER_ABSTIME = 0x1 TIOCCBRK = 0x5428 TIOCCONS = 0x541d TIOCEXCL = 0x540c diff --git a/src/cmd/vendor/golang.org/x/sys/unix/zerrors_linux_amd64.go b/src/cmd/vendor/golang.org/x/sys/unix/zerrors_linux_amd64.go index 93f65d7d1a..73c9b88ca7 100644 --- a/src/cmd/vendor/golang.org/x/sys/unix/zerrors_linux_amd64.go +++ b/src/cmd/vendor/golang.org/x/sys/unix/zerrors_linux_amd64.go @@ -41,7 +41,7 @@ const ( AF_KEY = 0xf AF_LLC = 0x1a AF_LOCAL = 0x1 - AF_MAX = 0x2c + AF_MAX = 0x2d AF_MPLS = 0x1c AF_NETBEUI = 0xd AF_NETLINK = 0x10 @@ -707,6 +707,7 @@ const ( IN_ISDIR = 0x40000000 IN_LOOPBACKNET = 0x7f IN_MASK_ADD = 0x20000000 + IN_MASK_CREATE = 0x10000000 IN_MODIFY = 0x2 IN_MOVE = 0xc0 IN_MOVED_FROM = 0x40 @@ -778,6 +779,7 @@ const ( IPV6_MINHOPCOUNT = 0x49 IPV6_MTU = 0x18 IPV6_MTU_DISCOVER = 0x17 + IPV6_MULTICAST_ALL = 0x1d IPV6_MULTICAST_HOPS = 0x12 IPV6_MULTICAST_IF = 0x11 IPV6_MULTICAST_LOOP = 0x13 @@ -1538,6 +1540,13 @@ const ( RLIMIT_SIGPENDING = 0xb RLIMIT_STACK = 0x3 RLIM_INFINITY = 0xffffffffffffffff + RNDADDENTROPY = 0x40085203 + RNDADDTOENTCNT = 0x40045201 + RNDCLEARPOOL = 0x5206 + RNDGETENTCNT = 0x80045200 + RNDGETPOOL = 0x80085202 + RNDRESEEDCRNG = 0x5207 + RNDZAPENTCNT = 0x5204 RTAX_ADVMSS = 0x8 RTAX_CC_ALGO = 0x10 RTAX_CWND = 0x7 @@ -1745,6 +1754,8 @@ const ( SECCOMP_MODE_STRICT = 0x1 SECURITYFS_MAGIC = 0x73636673 SELINUX_MAGIC = 0xf97cff8c + SFD_CLOEXEC = 0x80000 + SFD_NONBLOCK = 0x800 SHUT_RD = 0x0 SHUT_RDWR = 0x2 SHUT_WR = 0x1 @@ -1906,6 +1917,17 @@ const ( SO_DETACH_FILTER = 0x1b SO_DOMAIN = 0x27 SO_DONTROUTE = 0x5 + SO_EE_CODE_TXTIME_INVALID_PARAM = 0x1 + SO_EE_CODE_TXTIME_MISSED = 0x2 + SO_EE_CODE_ZEROCOPY_COPIED = 0x1 + SO_EE_ORIGIN_ICMP = 0x2 + SO_EE_ORIGIN_ICMP6 = 0x3 + SO_EE_ORIGIN_LOCAL = 0x1 + SO_EE_ORIGIN_NONE = 0x0 + SO_EE_ORIGIN_TIMESTAMPING = 0x4 + SO_EE_ORIGIN_TXSTATUS = 0x4 + SO_EE_ORIGIN_TXTIME = 0x6 + SO_EE_ORIGIN_ZEROCOPY = 0x5 SO_ERROR = 0x4 SO_GET_FILTER = 0x1a SO_INCOMING_CPU = 0x31 @@ -2039,6 +2061,7 @@ const ( TCOOFF = 0x0 TCOON = 0x1 TCP_CC_INFO = 0x1a + TCP_CM_INQ = 0x24 TCP_CONGESTION = 0xd TCP_COOKIE_IN_ALWAYS = 0x1 TCP_COOKIE_MAX = 0x10 @@ -2053,6 +2076,7 @@ const ( TCP_FASTOPEN_KEY = 0x21 TCP_FASTOPEN_NO_COOKIE = 0x22 TCP_INFO = 0xb + TCP_INQ = 0x24 TCP_KEEPCNT = 0x6 TCP_KEEPIDLE = 0x4 TCP_KEEPINTVL = 0x5 @@ -2072,6 +2096,9 @@ const ( TCP_QUEUE_SEQ = 0x15 TCP_QUICKACK = 0xc TCP_REPAIR = 0x13 + TCP_REPAIR_OFF = 0x0 + TCP_REPAIR_OFF_NO_WP = -0x1 + TCP_REPAIR_ON = 0x1 TCP_REPAIR_OPTIONS = 0x16 TCP_REPAIR_QUEUE = 0x14 TCP_REPAIR_WINDOW = 0x1d @@ -2086,6 +2113,7 @@ const ( TCP_ULP = 0x1f TCP_USER_TIMEOUT = 0x12 TCP_WINDOW_CLAMP = 0xa + TCP_ZEROCOPY_RECEIVE = 0x23 TCSAFLUSH = 0x2 TCSBRK = 0x5409 TCSBRKP = 0x5425 @@ -2102,6 +2130,7 @@ const ( TCSETXF = 0x5434 TCSETXW = 0x5435 TCXONC = 0x540a + TIMER_ABSTIME = 0x1 TIOCCBRK = 0x5428 TIOCCONS = 0x541d TIOCEXCL = 0x540c diff --git a/src/cmd/vendor/golang.org/x/sys/unix/zerrors_linux_arm.go b/src/cmd/vendor/golang.org/x/sys/unix/zerrors_linux_arm.go index ccc57676fd..f1ef82f57e 100644 --- a/src/cmd/vendor/golang.org/x/sys/unix/zerrors_linux_arm.go +++ b/src/cmd/vendor/golang.org/x/sys/unix/zerrors_linux_arm.go @@ -41,7 +41,7 @@ const ( AF_KEY = 0xf AF_LLC = 0x1a AF_LOCAL = 0x1 - AF_MAX = 0x2c + AF_MAX = 0x2d AF_MPLS = 0x1c AF_NETBEUI = 0xd AF_NETLINK = 0x10 @@ -706,6 +706,7 @@ const ( IN_ISDIR = 0x40000000 IN_LOOPBACKNET = 0x7f IN_MASK_ADD = 0x20000000 + IN_MASK_CREATE = 0x10000000 IN_MODIFY = 0x2 IN_MOVE = 0xc0 IN_MOVED_FROM = 0x40 @@ -777,6 +778,7 @@ const ( IPV6_MINHOPCOUNT = 0x49 IPV6_MTU = 0x18 IPV6_MTU_DISCOVER = 0x17 + IPV6_MULTICAST_ALL = 0x1d IPV6_MULTICAST_HOPS = 0x12 IPV6_MULTICAST_IF = 0x11 IPV6_MULTICAST_LOOP = 0x13 @@ -1544,6 +1546,13 @@ const ( RLIMIT_SIGPENDING = 0xb RLIMIT_STACK = 0x3 RLIM_INFINITY = 0xffffffffffffffff + RNDADDENTROPY = 0x40085203 + RNDADDTOENTCNT = 0x40045201 + RNDCLEARPOOL = 0x5206 + RNDGETENTCNT = 0x80045200 + RNDGETPOOL = 0x80085202 + RNDRESEEDCRNG = 0x5207 + RNDZAPENTCNT = 0x5204 RTAX_ADVMSS = 0x8 RTAX_CC_ALGO = 0x10 RTAX_CWND = 0x7 @@ -1751,6 +1760,8 @@ const ( SECCOMP_MODE_STRICT = 0x1 SECURITYFS_MAGIC = 0x73636673 SELINUX_MAGIC = 0xf97cff8c + SFD_CLOEXEC = 0x80000 + SFD_NONBLOCK = 0x800 SHUT_RD = 0x0 SHUT_RDWR = 0x2 SHUT_WR = 0x1 @@ -1912,6 +1923,17 @@ const ( SO_DETACH_FILTER = 0x1b SO_DOMAIN = 0x27 SO_DONTROUTE = 0x5 + SO_EE_CODE_TXTIME_INVALID_PARAM = 0x1 + SO_EE_CODE_TXTIME_MISSED = 0x2 + SO_EE_CODE_ZEROCOPY_COPIED = 0x1 + SO_EE_ORIGIN_ICMP = 0x2 + SO_EE_ORIGIN_ICMP6 = 0x3 + SO_EE_ORIGIN_LOCAL = 0x1 + SO_EE_ORIGIN_NONE = 0x0 + SO_EE_ORIGIN_TIMESTAMPING = 0x4 + SO_EE_ORIGIN_TXSTATUS = 0x4 + SO_EE_ORIGIN_TXTIME = 0x6 + SO_EE_ORIGIN_ZEROCOPY = 0x5 SO_ERROR = 0x4 SO_GET_FILTER = 0x1a SO_INCOMING_CPU = 0x31 @@ -2045,6 +2067,7 @@ const ( TCOOFF = 0x0 TCOON = 0x1 TCP_CC_INFO = 0x1a + TCP_CM_INQ = 0x24 TCP_CONGESTION = 0xd TCP_COOKIE_IN_ALWAYS = 0x1 TCP_COOKIE_MAX = 0x10 @@ -2059,6 +2082,7 @@ const ( TCP_FASTOPEN_KEY = 0x21 TCP_FASTOPEN_NO_COOKIE = 0x22 TCP_INFO = 0xb + TCP_INQ = 0x24 TCP_KEEPCNT = 0x6 TCP_KEEPIDLE = 0x4 TCP_KEEPINTVL = 0x5 @@ -2078,6 +2102,9 @@ const ( TCP_QUEUE_SEQ = 0x15 TCP_QUICKACK = 0xc TCP_REPAIR = 0x13 + TCP_REPAIR_OFF = 0x0 + TCP_REPAIR_OFF_NO_WP = -0x1 + TCP_REPAIR_ON = 0x1 TCP_REPAIR_OPTIONS = 0x16 TCP_REPAIR_QUEUE = 0x14 TCP_REPAIR_WINDOW = 0x1d @@ -2092,6 +2119,7 @@ const ( TCP_ULP = 0x1f TCP_USER_TIMEOUT = 0x12 TCP_WINDOW_CLAMP = 0xa + TCP_ZEROCOPY_RECEIVE = 0x23 TCSAFLUSH = 0x2 TCSBRK = 0x5409 TCSBRKP = 0x5425 @@ -2108,6 +2136,7 @@ const ( TCSETXF = 0x5434 TCSETXW = 0x5435 TCXONC = 0x540a + TIMER_ABSTIME = 0x1 TIOCCBRK = 0x5428 TIOCCONS = 0x541d TIOCEXCL = 0x540c diff --git a/src/cmd/vendor/golang.org/x/sys/unix/zerrors_linux_arm64.go b/src/cmd/vendor/golang.org/x/sys/unix/zerrors_linux_arm64.go index 9c57337c62..cf17c99069 100644 --- a/src/cmd/vendor/golang.org/x/sys/unix/zerrors_linux_arm64.go +++ b/src/cmd/vendor/golang.org/x/sys/unix/zerrors_linux_arm64.go @@ -41,7 +41,7 @@ const ( AF_KEY = 0xf AF_LLC = 0x1a AF_LOCAL = 0x1 - AF_MAX = 0x2c + AF_MAX = 0x2d AF_MPLS = 0x1c AF_NETBEUI = 0xd AF_NETLINK = 0x10 @@ -709,6 +709,7 @@ const ( IN_ISDIR = 0x40000000 IN_LOOPBACKNET = 0x7f IN_MASK_ADD = 0x20000000 + IN_MASK_CREATE = 0x10000000 IN_MODIFY = 0x2 IN_MOVE = 0xc0 IN_MOVED_FROM = 0x40 @@ -780,6 +781,7 @@ const ( IPV6_MINHOPCOUNT = 0x49 IPV6_MTU = 0x18 IPV6_MTU_DISCOVER = 0x17 + IPV6_MULTICAST_ALL = 0x1d IPV6_MULTICAST_HOPS = 0x12 IPV6_MULTICAST_IF = 0x11 IPV6_MULTICAST_LOOP = 0x13 @@ -1528,6 +1530,13 @@ const ( RLIMIT_SIGPENDING = 0xb RLIMIT_STACK = 0x3 RLIM_INFINITY = 0xffffffffffffffff + RNDADDENTROPY = 0x40085203 + RNDADDTOENTCNT = 0x40045201 + RNDCLEARPOOL = 0x5206 + RNDGETENTCNT = 0x80045200 + RNDGETPOOL = 0x80085202 + RNDRESEEDCRNG = 0x5207 + RNDZAPENTCNT = 0x5204 RTAX_ADVMSS = 0x8 RTAX_CC_ALGO = 0x10 RTAX_CWND = 0x7 @@ -1735,6 +1744,8 @@ const ( SECCOMP_MODE_STRICT = 0x1 SECURITYFS_MAGIC = 0x73636673 SELINUX_MAGIC = 0xf97cff8c + SFD_CLOEXEC = 0x80000 + SFD_NONBLOCK = 0x800 SHUT_RD = 0x0 SHUT_RDWR = 0x2 SHUT_WR = 0x1 @@ -1896,6 +1907,17 @@ const ( SO_DETACH_FILTER = 0x1b SO_DOMAIN = 0x27 SO_DONTROUTE = 0x5 + SO_EE_CODE_TXTIME_INVALID_PARAM = 0x1 + SO_EE_CODE_TXTIME_MISSED = 0x2 + SO_EE_CODE_ZEROCOPY_COPIED = 0x1 + SO_EE_ORIGIN_ICMP = 0x2 + SO_EE_ORIGIN_ICMP6 = 0x3 + SO_EE_ORIGIN_LOCAL = 0x1 + SO_EE_ORIGIN_NONE = 0x0 + SO_EE_ORIGIN_TIMESTAMPING = 0x4 + SO_EE_ORIGIN_TXSTATUS = 0x4 + SO_EE_ORIGIN_TXTIME = 0x6 + SO_EE_ORIGIN_ZEROCOPY = 0x5 SO_ERROR = 0x4 SO_GET_FILTER = 0x1a SO_INCOMING_CPU = 0x31 @@ -2030,6 +2052,7 @@ const ( TCOOFF = 0x0 TCOON = 0x1 TCP_CC_INFO = 0x1a + TCP_CM_INQ = 0x24 TCP_CONGESTION = 0xd TCP_COOKIE_IN_ALWAYS = 0x1 TCP_COOKIE_MAX = 0x10 @@ -2044,6 +2067,7 @@ const ( TCP_FASTOPEN_KEY = 0x21 TCP_FASTOPEN_NO_COOKIE = 0x22 TCP_INFO = 0xb + TCP_INQ = 0x24 TCP_KEEPCNT = 0x6 TCP_KEEPIDLE = 0x4 TCP_KEEPINTVL = 0x5 @@ -2063,6 +2087,9 @@ const ( TCP_QUEUE_SEQ = 0x15 TCP_QUICKACK = 0xc TCP_REPAIR = 0x13 + TCP_REPAIR_OFF = 0x0 + TCP_REPAIR_OFF_NO_WP = -0x1 + TCP_REPAIR_ON = 0x1 TCP_REPAIR_OPTIONS = 0x16 TCP_REPAIR_QUEUE = 0x14 TCP_REPAIR_WINDOW = 0x1d @@ -2077,6 +2104,7 @@ const ( TCP_ULP = 0x1f TCP_USER_TIMEOUT = 0x12 TCP_WINDOW_CLAMP = 0xa + TCP_ZEROCOPY_RECEIVE = 0x23 TCSAFLUSH = 0x2 TCSBRK = 0x5409 TCSBRKP = 0x5425 @@ -2093,6 +2121,7 @@ const ( TCSETXF = 0x5434 TCSETXW = 0x5435 TCXONC = 0x540a + TIMER_ABSTIME = 0x1 TIOCCBRK = 0x5428 TIOCCONS = 0x541d TIOCEXCL = 0x540c diff --git a/src/cmd/vendor/golang.org/x/sys/unix/zerrors_linux_mips.go b/src/cmd/vendor/golang.org/x/sys/unix/zerrors_linux_mips.go index 66cdbfd586..380913c4fc 100644 --- a/src/cmd/vendor/golang.org/x/sys/unix/zerrors_linux_mips.go +++ b/src/cmd/vendor/golang.org/x/sys/unix/zerrors_linux_mips.go @@ -41,7 +41,7 @@ const ( AF_KEY = 0xf AF_LLC = 0x1a AF_LOCAL = 0x1 - AF_MAX = 0x2c + AF_MAX = 0x2d AF_MPLS = 0x1c AF_NETBEUI = 0xd AF_NETLINK = 0x10 @@ -706,6 +706,7 @@ const ( IN_ISDIR = 0x40000000 IN_LOOPBACKNET = 0x7f IN_MASK_ADD = 0x20000000 + IN_MASK_CREATE = 0x10000000 IN_MODIFY = 0x2 IN_MOVE = 0xc0 IN_MOVED_FROM = 0x40 @@ -777,6 +778,7 @@ const ( IPV6_MINHOPCOUNT = 0x49 IPV6_MTU = 0x18 IPV6_MTU_DISCOVER = 0x17 + IPV6_MULTICAST_ALL = 0x1d IPV6_MULTICAST_HOPS = 0x12 IPV6_MULTICAST_IF = 0x11 IPV6_MULTICAST_LOOP = 0x13 @@ -1537,6 +1539,13 @@ const ( RLIMIT_SIGPENDING = 0xb RLIMIT_STACK = 0x3 RLIM_INFINITY = 0xffffffffffffffff + RNDADDENTROPY = 0x80085203 + RNDADDTOENTCNT = 0x80045201 + RNDCLEARPOOL = 0x20005206 + RNDGETENTCNT = 0x40045200 + RNDGETPOOL = 0x40085202 + RNDRESEEDCRNG = 0x20005207 + RNDZAPENTCNT = 0x20005204 RTAX_ADVMSS = 0x8 RTAX_CC_ALGO = 0x10 RTAX_CWND = 0x7 @@ -1744,6 +1753,8 @@ const ( SECCOMP_MODE_STRICT = 0x1 SECURITYFS_MAGIC = 0x73636673 SELINUX_MAGIC = 0xf97cff8c + SFD_CLOEXEC = 0x80000 + SFD_NONBLOCK = 0x80 SHUT_RD = 0x0 SHUT_RDWR = 0x2 SHUT_WR = 0x1 @@ -1905,6 +1916,17 @@ const ( SO_DETACH_FILTER = 0x1b SO_DOMAIN = 0x1029 SO_DONTROUTE = 0x10 + SO_EE_CODE_TXTIME_INVALID_PARAM = 0x1 + SO_EE_CODE_TXTIME_MISSED = 0x2 + SO_EE_CODE_ZEROCOPY_COPIED = 0x1 + SO_EE_ORIGIN_ICMP = 0x2 + SO_EE_ORIGIN_ICMP6 = 0x3 + SO_EE_ORIGIN_LOCAL = 0x1 + SO_EE_ORIGIN_NONE = 0x0 + SO_EE_ORIGIN_TIMESTAMPING = 0x4 + SO_EE_ORIGIN_TXSTATUS = 0x4 + SO_EE_ORIGIN_TXTIME = 0x6 + SO_EE_ORIGIN_ZEROCOPY = 0x5 SO_ERROR = 0x1007 SO_GET_FILTER = 0x1a SO_INCOMING_CPU = 0x31 @@ -2038,6 +2060,7 @@ const ( TCOOFF = 0x0 TCOON = 0x1 TCP_CC_INFO = 0x1a + TCP_CM_INQ = 0x24 TCP_CONGESTION = 0xd TCP_COOKIE_IN_ALWAYS = 0x1 TCP_COOKIE_MAX = 0x10 @@ -2052,6 +2075,7 @@ const ( TCP_FASTOPEN_KEY = 0x21 TCP_FASTOPEN_NO_COOKIE = 0x22 TCP_INFO = 0xb + TCP_INQ = 0x24 TCP_KEEPCNT = 0x6 TCP_KEEPIDLE = 0x4 TCP_KEEPINTVL = 0x5 @@ -2071,6 +2095,9 @@ const ( TCP_QUEUE_SEQ = 0x15 TCP_QUICKACK = 0xc TCP_REPAIR = 0x13 + TCP_REPAIR_OFF = 0x0 + TCP_REPAIR_OFF_NO_WP = -0x1 + TCP_REPAIR_ON = 0x1 TCP_REPAIR_OPTIONS = 0x16 TCP_REPAIR_QUEUE = 0x14 TCP_REPAIR_WINDOW = 0x1d @@ -2085,6 +2112,7 @@ const ( TCP_ULP = 0x1f TCP_USER_TIMEOUT = 0x12 TCP_WINDOW_CLAMP = 0xa + TCP_ZEROCOPY_RECEIVE = 0x23 TCSAFLUSH = 0x5410 TCSBRK = 0x5405 TCSBRKP = 0x5486 @@ -2098,6 +2126,7 @@ const ( TCSETSW = 0x540f TCSETSW2 = 0x8030542c TCXONC = 0x5406 + TIMER_ABSTIME = 0x1 TIOCCBRK = 0x5428 TIOCCONS = 0x80047478 TIOCEXCL = 0x740d diff --git a/src/cmd/vendor/golang.org/x/sys/unix/zerrors_linux_mips64.go b/src/cmd/vendor/golang.org/x/sys/unix/zerrors_linux_mips64.go index 038cfeb7db..fb82529ac9 100644 --- a/src/cmd/vendor/golang.org/x/sys/unix/zerrors_linux_mips64.go +++ b/src/cmd/vendor/golang.org/x/sys/unix/zerrors_linux_mips64.go @@ -41,7 +41,7 @@ const ( AF_KEY = 0xf AF_LLC = 0x1a AF_LOCAL = 0x1 - AF_MAX = 0x2c + AF_MAX = 0x2d AF_MPLS = 0x1c AF_NETBEUI = 0xd AF_NETLINK = 0x10 @@ -706,6 +706,7 @@ const ( IN_ISDIR = 0x40000000 IN_LOOPBACKNET = 0x7f IN_MASK_ADD = 0x20000000 + IN_MASK_CREATE = 0x10000000 IN_MODIFY = 0x2 IN_MOVE = 0xc0 IN_MOVED_FROM = 0x40 @@ -777,6 +778,7 @@ const ( IPV6_MINHOPCOUNT = 0x49 IPV6_MTU = 0x18 IPV6_MTU_DISCOVER = 0x17 + IPV6_MULTICAST_ALL = 0x1d IPV6_MULTICAST_HOPS = 0x12 IPV6_MULTICAST_IF = 0x11 IPV6_MULTICAST_LOOP = 0x13 @@ -1537,6 +1539,13 @@ const ( RLIMIT_SIGPENDING = 0xb RLIMIT_STACK = 0x3 RLIM_INFINITY = 0xffffffffffffffff + RNDADDENTROPY = 0x80085203 + RNDADDTOENTCNT = 0x80045201 + RNDCLEARPOOL = 0x20005206 + RNDGETENTCNT = 0x40045200 + RNDGETPOOL = 0x40085202 + RNDRESEEDCRNG = 0x20005207 + RNDZAPENTCNT = 0x20005204 RTAX_ADVMSS = 0x8 RTAX_CC_ALGO = 0x10 RTAX_CWND = 0x7 @@ -1744,6 +1753,8 @@ const ( SECCOMP_MODE_STRICT = 0x1 SECURITYFS_MAGIC = 0x73636673 SELINUX_MAGIC = 0xf97cff8c + SFD_CLOEXEC = 0x80000 + SFD_NONBLOCK = 0x80 SHUT_RD = 0x0 SHUT_RDWR = 0x2 SHUT_WR = 0x1 @@ -1905,6 +1916,17 @@ const ( SO_DETACH_FILTER = 0x1b SO_DOMAIN = 0x1029 SO_DONTROUTE = 0x10 + SO_EE_CODE_TXTIME_INVALID_PARAM = 0x1 + SO_EE_CODE_TXTIME_MISSED = 0x2 + SO_EE_CODE_ZEROCOPY_COPIED = 0x1 + SO_EE_ORIGIN_ICMP = 0x2 + SO_EE_ORIGIN_ICMP6 = 0x3 + SO_EE_ORIGIN_LOCAL = 0x1 + SO_EE_ORIGIN_NONE = 0x0 + SO_EE_ORIGIN_TIMESTAMPING = 0x4 + SO_EE_ORIGIN_TXSTATUS = 0x4 + SO_EE_ORIGIN_TXTIME = 0x6 + SO_EE_ORIGIN_ZEROCOPY = 0x5 SO_ERROR = 0x1007 SO_GET_FILTER = 0x1a SO_INCOMING_CPU = 0x31 @@ -2038,6 +2060,7 @@ const ( TCOOFF = 0x0 TCOON = 0x1 TCP_CC_INFO = 0x1a + TCP_CM_INQ = 0x24 TCP_CONGESTION = 0xd TCP_COOKIE_IN_ALWAYS = 0x1 TCP_COOKIE_MAX = 0x10 @@ -2052,6 +2075,7 @@ const ( TCP_FASTOPEN_KEY = 0x21 TCP_FASTOPEN_NO_COOKIE = 0x22 TCP_INFO = 0xb + TCP_INQ = 0x24 TCP_KEEPCNT = 0x6 TCP_KEEPIDLE = 0x4 TCP_KEEPINTVL = 0x5 @@ -2071,6 +2095,9 @@ const ( TCP_QUEUE_SEQ = 0x15 TCP_QUICKACK = 0xc TCP_REPAIR = 0x13 + TCP_REPAIR_OFF = 0x0 + TCP_REPAIR_OFF_NO_WP = -0x1 + TCP_REPAIR_ON = 0x1 TCP_REPAIR_OPTIONS = 0x16 TCP_REPAIR_QUEUE = 0x14 TCP_REPAIR_WINDOW = 0x1d @@ -2085,6 +2112,7 @@ const ( TCP_ULP = 0x1f TCP_USER_TIMEOUT = 0x12 TCP_WINDOW_CLAMP = 0xa + TCP_ZEROCOPY_RECEIVE = 0x23 TCSAFLUSH = 0x5410 TCSBRK = 0x5405 TCSBRKP = 0x5486 @@ -2098,6 +2126,7 @@ const ( TCSETSW = 0x540f TCSETSW2 = 0x8030542c TCXONC = 0x5406 + TIMER_ABSTIME = 0x1 TIOCCBRK = 0x5428 TIOCCONS = 0x80047478 TIOCEXCL = 0x740d diff --git a/src/cmd/vendor/golang.org/x/sys/unix/zerrors_linux_mips64le.go b/src/cmd/vendor/golang.org/x/sys/unix/zerrors_linux_mips64le.go index 2b9af2f5ef..677d904562 100644 --- a/src/cmd/vendor/golang.org/x/sys/unix/zerrors_linux_mips64le.go +++ b/src/cmd/vendor/golang.org/x/sys/unix/zerrors_linux_mips64le.go @@ -41,7 +41,7 @@ const ( AF_KEY = 0xf AF_LLC = 0x1a AF_LOCAL = 0x1 - AF_MAX = 0x2c + AF_MAX = 0x2d AF_MPLS = 0x1c AF_NETBEUI = 0xd AF_NETLINK = 0x10 @@ -706,6 +706,7 @@ const ( IN_ISDIR = 0x40000000 IN_LOOPBACKNET = 0x7f IN_MASK_ADD = 0x20000000 + IN_MASK_CREATE = 0x10000000 IN_MODIFY = 0x2 IN_MOVE = 0xc0 IN_MOVED_FROM = 0x40 @@ -777,6 +778,7 @@ const ( IPV6_MINHOPCOUNT = 0x49 IPV6_MTU = 0x18 IPV6_MTU_DISCOVER = 0x17 + IPV6_MULTICAST_ALL = 0x1d IPV6_MULTICAST_HOPS = 0x12 IPV6_MULTICAST_IF = 0x11 IPV6_MULTICAST_LOOP = 0x13 @@ -1537,6 +1539,13 @@ const ( RLIMIT_SIGPENDING = 0xb RLIMIT_STACK = 0x3 RLIM_INFINITY = 0xffffffffffffffff + RNDADDENTROPY = 0x80085203 + RNDADDTOENTCNT = 0x80045201 + RNDCLEARPOOL = 0x20005206 + RNDGETENTCNT = 0x40045200 + RNDGETPOOL = 0x40085202 + RNDRESEEDCRNG = 0x20005207 + RNDZAPENTCNT = 0x20005204 RTAX_ADVMSS = 0x8 RTAX_CC_ALGO = 0x10 RTAX_CWND = 0x7 @@ -1744,6 +1753,8 @@ const ( SECCOMP_MODE_STRICT = 0x1 SECURITYFS_MAGIC = 0x73636673 SELINUX_MAGIC = 0xf97cff8c + SFD_CLOEXEC = 0x80000 + SFD_NONBLOCK = 0x80 SHUT_RD = 0x0 SHUT_RDWR = 0x2 SHUT_WR = 0x1 @@ -1905,6 +1916,17 @@ const ( SO_DETACH_FILTER = 0x1b SO_DOMAIN = 0x1029 SO_DONTROUTE = 0x10 + SO_EE_CODE_TXTIME_INVALID_PARAM = 0x1 + SO_EE_CODE_TXTIME_MISSED = 0x2 + SO_EE_CODE_ZEROCOPY_COPIED = 0x1 + SO_EE_ORIGIN_ICMP = 0x2 + SO_EE_ORIGIN_ICMP6 = 0x3 + SO_EE_ORIGIN_LOCAL = 0x1 + SO_EE_ORIGIN_NONE = 0x0 + SO_EE_ORIGIN_TIMESTAMPING = 0x4 + SO_EE_ORIGIN_TXSTATUS = 0x4 + SO_EE_ORIGIN_TXTIME = 0x6 + SO_EE_ORIGIN_ZEROCOPY = 0x5 SO_ERROR = 0x1007 SO_GET_FILTER = 0x1a SO_INCOMING_CPU = 0x31 @@ -2038,6 +2060,7 @@ const ( TCOOFF = 0x0 TCOON = 0x1 TCP_CC_INFO = 0x1a + TCP_CM_INQ = 0x24 TCP_CONGESTION = 0xd TCP_COOKIE_IN_ALWAYS = 0x1 TCP_COOKIE_MAX = 0x10 @@ -2052,6 +2075,7 @@ const ( TCP_FASTOPEN_KEY = 0x21 TCP_FASTOPEN_NO_COOKIE = 0x22 TCP_INFO = 0xb + TCP_INQ = 0x24 TCP_KEEPCNT = 0x6 TCP_KEEPIDLE = 0x4 TCP_KEEPINTVL = 0x5 @@ -2071,6 +2095,9 @@ const ( TCP_QUEUE_SEQ = 0x15 TCP_QUICKACK = 0xc TCP_REPAIR = 0x13 + TCP_REPAIR_OFF = 0x0 + TCP_REPAIR_OFF_NO_WP = -0x1 + TCP_REPAIR_ON = 0x1 TCP_REPAIR_OPTIONS = 0x16 TCP_REPAIR_QUEUE = 0x14 TCP_REPAIR_WINDOW = 0x1d @@ -2085,6 +2112,7 @@ const ( TCP_ULP = 0x1f TCP_USER_TIMEOUT = 0x12 TCP_WINDOW_CLAMP = 0xa + TCP_ZEROCOPY_RECEIVE = 0x23 TCSAFLUSH = 0x5410 TCSBRK = 0x5405 TCSBRKP = 0x5486 @@ -2098,6 +2126,7 @@ const ( TCSETSW = 0x540f TCSETSW2 = 0x8030542c TCXONC = 0x5406 + TIMER_ABSTIME = 0x1 TIOCCBRK = 0x5428 TIOCCONS = 0x80047478 TIOCEXCL = 0x740d diff --git a/src/cmd/vendor/golang.org/x/sys/unix/zerrors_linux_mipsle.go b/src/cmd/vendor/golang.org/x/sys/unix/zerrors_linux_mipsle.go index d117b63672..7ddd09d782 100644 --- a/src/cmd/vendor/golang.org/x/sys/unix/zerrors_linux_mipsle.go +++ b/src/cmd/vendor/golang.org/x/sys/unix/zerrors_linux_mipsle.go @@ -41,7 +41,7 @@ const ( AF_KEY = 0xf AF_LLC = 0x1a AF_LOCAL = 0x1 - AF_MAX = 0x2c + AF_MAX = 0x2d AF_MPLS = 0x1c AF_NETBEUI = 0xd AF_NETLINK = 0x10 @@ -706,6 +706,7 @@ const ( IN_ISDIR = 0x40000000 IN_LOOPBACKNET = 0x7f IN_MASK_ADD = 0x20000000 + IN_MASK_CREATE = 0x10000000 IN_MODIFY = 0x2 IN_MOVE = 0xc0 IN_MOVED_FROM = 0x40 @@ -777,6 +778,7 @@ const ( IPV6_MINHOPCOUNT = 0x49 IPV6_MTU = 0x18 IPV6_MTU_DISCOVER = 0x17 + IPV6_MULTICAST_ALL = 0x1d IPV6_MULTICAST_HOPS = 0x12 IPV6_MULTICAST_IF = 0x11 IPV6_MULTICAST_LOOP = 0x13 @@ -1537,6 +1539,13 @@ const ( RLIMIT_SIGPENDING = 0xb RLIMIT_STACK = 0x3 RLIM_INFINITY = 0xffffffffffffffff + RNDADDENTROPY = 0x80085203 + RNDADDTOENTCNT = 0x80045201 + RNDCLEARPOOL = 0x20005206 + RNDGETENTCNT = 0x40045200 + RNDGETPOOL = 0x40085202 + RNDRESEEDCRNG = 0x20005207 + RNDZAPENTCNT = 0x20005204 RTAX_ADVMSS = 0x8 RTAX_CC_ALGO = 0x10 RTAX_CWND = 0x7 @@ -1744,6 +1753,8 @@ const ( SECCOMP_MODE_STRICT = 0x1 SECURITYFS_MAGIC = 0x73636673 SELINUX_MAGIC = 0xf97cff8c + SFD_CLOEXEC = 0x80000 + SFD_NONBLOCK = 0x80 SHUT_RD = 0x0 SHUT_RDWR = 0x2 SHUT_WR = 0x1 @@ -1905,6 +1916,17 @@ const ( SO_DETACH_FILTER = 0x1b SO_DOMAIN = 0x1029 SO_DONTROUTE = 0x10 + SO_EE_CODE_TXTIME_INVALID_PARAM = 0x1 + SO_EE_CODE_TXTIME_MISSED = 0x2 + SO_EE_CODE_ZEROCOPY_COPIED = 0x1 + SO_EE_ORIGIN_ICMP = 0x2 + SO_EE_ORIGIN_ICMP6 = 0x3 + SO_EE_ORIGIN_LOCAL = 0x1 + SO_EE_ORIGIN_NONE = 0x0 + SO_EE_ORIGIN_TIMESTAMPING = 0x4 + SO_EE_ORIGIN_TXSTATUS = 0x4 + SO_EE_ORIGIN_TXTIME = 0x6 + SO_EE_ORIGIN_ZEROCOPY = 0x5 SO_ERROR = 0x1007 SO_GET_FILTER = 0x1a SO_INCOMING_CPU = 0x31 @@ -2038,6 +2060,7 @@ const ( TCOOFF = 0x0 TCOON = 0x1 TCP_CC_INFO = 0x1a + TCP_CM_INQ = 0x24 TCP_CONGESTION = 0xd TCP_COOKIE_IN_ALWAYS = 0x1 TCP_COOKIE_MAX = 0x10 @@ -2052,6 +2075,7 @@ const ( TCP_FASTOPEN_KEY = 0x21 TCP_FASTOPEN_NO_COOKIE = 0x22 TCP_INFO = 0xb + TCP_INQ = 0x24 TCP_KEEPCNT = 0x6 TCP_KEEPIDLE = 0x4 TCP_KEEPINTVL = 0x5 @@ -2071,6 +2095,9 @@ const ( TCP_QUEUE_SEQ = 0x15 TCP_QUICKACK = 0xc TCP_REPAIR = 0x13 + TCP_REPAIR_OFF = 0x0 + TCP_REPAIR_OFF_NO_WP = -0x1 + TCP_REPAIR_ON = 0x1 TCP_REPAIR_OPTIONS = 0x16 TCP_REPAIR_QUEUE = 0x14 TCP_REPAIR_WINDOW = 0x1d @@ -2085,6 +2112,7 @@ const ( TCP_ULP = 0x1f TCP_USER_TIMEOUT = 0x12 TCP_WINDOW_CLAMP = 0xa + TCP_ZEROCOPY_RECEIVE = 0x23 TCSAFLUSH = 0x5410 TCSBRK = 0x5405 TCSBRKP = 0x5486 @@ -2098,6 +2126,7 @@ const ( TCSETSW = 0x540f TCSETSW2 = 0x8030542c TCXONC = 0x5406 + TIMER_ABSTIME = 0x1 TIOCCBRK = 0x5428 TIOCCONS = 0x80047478 TIOCEXCL = 0x740d diff --git a/src/cmd/vendor/golang.org/x/sys/unix/zerrors_linux_ppc64.go b/src/cmd/vendor/golang.org/x/sys/unix/zerrors_linux_ppc64.go index ed12556bf4..ebaca417b4 100644 --- a/src/cmd/vendor/golang.org/x/sys/unix/zerrors_linux_ppc64.go +++ b/src/cmd/vendor/golang.org/x/sys/unix/zerrors_linux_ppc64.go @@ -41,7 +41,7 @@ const ( AF_KEY = 0xf AF_LLC = 0x1a AF_LOCAL = 0x1 - AF_MAX = 0x2c + AF_MAX = 0x2d AF_MPLS = 0x1c AF_NETBEUI = 0xd AF_NETLINK = 0x10 @@ -706,6 +706,7 @@ const ( IN_ISDIR = 0x40000000 IN_LOOPBACKNET = 0x7f IN_MASK_ADD = 0x20000000 + IN_MASK_CREATE = 0x10000000 IN_MODIFY = 0x2 IN_MOVE = 0xc0 IN_MOVED_FROM = 0x40 @@ -777,6 +778,7 @@ const ( IPV6_MINHOPCOUNT = 0x49 IPV6_MTU = 0x18 IPV6_MTU_DISCOVER = 0x17 + IPV6_MULTICAST_ALL = 0x1d IPV6_MULTICAST_HOPS = 0x12 IPV6_MULTICAST_IF = 0x11 IPV6_MULTICAST_LOOP = 0x13 @@ -1595,6 +1597,13 @@ const ( RLIMIT_SIGPENDING = 0xb RLIMIT_STACK = 0x3 RLIM_INFINITY = 0xffffffffffffffff + RNDADDENTROPY = 0x80085203 + RNDADDTOENTCNT = 0x80045201 + RNDCLEARPOOL = 0x20005206 + RNDGETENTCNT = 0x40045200 + RNDGETPOOL = 0x40085202 + RNDRESEEDCRNG = 0x20005207 + RNDZAPENTCNT = 0x20005204 RTAX_ADVMSS = 0x8 RTAX_CC_ALGO = 0x10 RTAX_CWND = 0x7 @@ -1802,6 +1811,8 @@ const ( SECCOMP_MODE_STRICT = 0x1 SECURITYFS_MAGIC = 0x73636673 SELINUX_MAGIC = 0xf97cff8c + SFD_CLOEXEC = 0x80000 + SFD_NONBLOCK = 0x800 SHUT_RD = 0x0 SHUT_RDWR = 0x2 SHUT_WR = 0x1 @@ -1963,6 +1974,17 @@ const ( SO_DETACH_FILTER = 0x1b SO_DOMAIN = 0x27 SO_DONTROUTE = 0x5 + SO_EE_CODE_TXTIME_INVALID_PARAM = 0x1 + SO_EE_CODE_TXTIME_MISSED = 0x2 + SO_EE_CODE_ZEROCOPY_COPIED = 0x1 + SO_EE_ORIGIN_ICMP = 0x2 + SO_EE_ORIGIN_ICMP6 = 0x3 + SO_EE_ORIGIN_LOCAL = 0x1 + SO_EE_ORIGIN_NONE = 0x0 + SO_EE_ORIGIN_TIMESTAMPING = 0x4 + SO_EE_ORIGIN_TXSTATUS = 0x4 + SO_EE_ORIGIN_TXTIME = 0x6 + SO_EE_ORIGIN_ZEROCOPY = 0x5 SO_ERROR = 0x4 SO_GET_FILTER = 0x1a SO_INCOMING_CPU = 0x31 @@ -2094,6 +2116,7 @@ const ( TCOOFF = 0x0 TCOON = 0x1 TCP_CC_INFO = 0x1a + TCP_CM_INQ = 0x24 TCP_CONGESTION = 0xd TCP_COOKIE_IN_ALWAYS = 0x1 TCP_COOKIE_MAX = 0x10 @@ -2108,6 +2131,7 @@ const ( TCP_FASTOPEN_KEY = 0x21 TCP_FASTOPEN_NO_COOKIE = 0x22 TCP_INFO = 0xb + TCP_INQ = 0x24 TCP_KEEPCNT = 0x6 TCP_KEEPIDLE = 0x4 TCP_KEEPINTVL = 0x5 @@ -2127,6 +2151,9 @@ const ( TCP_QUEUE_SEQ = 0x15 TCP_QUICKACK = 0xc TCP_REPAIR = 0x13 + TCP_REPAIR_OFF = 0x0 + TCP_REPAIR_OFF_NO_WP = -0x1 + TCP_REPAIR_ON = 0x1 TCP_REPAIR_OPTIONS = 0x16 TCP_REPAIR_QUEUE = 0x14 TCP_REPAIR_WINDOW = 0x1d @@ -2141,6 +2168,7 @@ const ( TCP_ULP = 0x1f TCP_USER_TIMEOUT = 0x12 TCP_WINDOW_CLAMP = 0xa + TCP_ZEROCOPY_RECEIVE = 0x23 TCSAFLUSH = 0x2 TCSBRK = 0x2000741d TCSBRKP = 0x5425 @@ -2151,6 +2179,7 @@ const ( TCSETSF = 0x802c7416 TCSETSW = 0x802c7415 TCXONC = 0x2000741e + TIMER_ABSTIME = 0x1 TIOCCBRK = 0x5428 TIOCCONS = 0x541d TIOCEXCL = 0x540c diff --git a/src/cmd/vendor/golang.org/x/sys/unix/zerrors_linux_ppc64le.go b/src/cmd/vendor/golang.org/x/sys/unix/zerrors_linux_ppc64le.go index 4aa4fa9c99..02938cb6ed 100644 --- a/src/cmd/vendor/golang.org/x/sys/unix/zerrors_linux_ppc64le.go +++ b/src/cmd/vendor/golang.org/x/sys/unix/zerrors_linux_ppc64le.go @@ -41,7 +41,7 @@ const ( AF_KEY = 0xf AF_LLC = 0x1a AF_LOCAL = 0x1 - AF_MAX = 0x2c + AF_MAX = 0x2d AF_MPLS = 0x1c AF_NETBEUI = 0xd AF_NETLINK = 0x10 @@ -706,6 +706,7 @@ const ( IN_ISDIR = 0x40000000 IN_LOOPBACKNET = 0x7f IN_MASK_ADD = 0x20000000 + IN_MASK_CREATE = 0x10000000 IN_MODIFY = 0x2 IN_MOVE = 0xc0 IN_MOVED_FROM = 0x40 @@ -777,6 +778,7 @@ const ( IPV6_MINHOPCOUNT = 0x49 IPV6_MTU = 0x18 IPV6_MTU_DISCOVER = 0x17 + IPV6_MULTICAST_ALL = 0x1d IPV6_MULTICAST_HOPS = 0x12 IPV6_MULTICAST_IF = 0x11 IPV6_MULTICAST_LOOP = 0x13 @@ -1595,6 +1597,13 @@ const ( RLIMIT_SIGPENDING = 0xb RLIMIT_STACK = 0x3 RLIM_INFINITY = 0xffffffffffffffff + RNDADDENTROPY = 0x80085203 + RNDADDTOENTCNT = 0x80045201 + RNDCLEARPOOL = 0x20005206 + RNDGETENTCNT = 0x40045200 + RNDGETPOOL = 0x40085202 + RNDRESEEDCRNG = 0x20005207 + RNDZAPENTCNT = 0x20005204 RTAX_ADVMSS = 0x8 RTAX_CC_ALGO = 0x10 RTAX_CWND = 0x7 @@ -1802,6 +1811,8 @@ const ( SECCOMP_MODE_STRICT = 0x1 SECURITYFS_MAGIC = 0x73636673 SELINUX_MAGIC = 0xf97cff8c + SFD_CLOEXEC = 0x80000 + SFD_NONBLOCK = 0x800 SHUT_RD = 0x0 SHUT_RDWR = 0x2 SHUT_WR = 0x1 @@ -1963,6 +1974,17 @@ const ( SO_DETACH_FILTER = 0x1b SO_DOMAIN = 0x27 SO_DONTROUTE = 0x5 + SO_EE_CODE_TXTIME_INVALID_PARAM = 0x1 + SO_EE_CODE_TXTIME_MISSED = 0x2 + SO_EE_CODE_ZEROCOPY_COPIED = 0x1 + SO_EE_ORIGIN_ICMP = 0x2 + SO_EE_ORIGIN_ICMP6 = 0x3 + SO_EE_ORIGIN_LOCAL = 0x1 + SO_EE_ORIGIN_NONE = 0x0 + SO_EE_ORIGIN_TIMESTAMPING = 0x4 + SO_EE_ORIGIN_TXSTATUS = 0x4 + SO_EE_ORIGIN_TXTIME = 0x6 + SO_EE_ORIGIN_ZEROCOPY = 0x5 SO_ERROR = 0x4 SO_GET_FILTER = 0x1a SO_INCOMING_CPU = 0x31 @@ -2094,6 +2116,7 @@ const ( TCOOFF = 0x0 TCOON = 0x1 TCP_CC_INFO = 0x1a + TCP_CM_INQ = 0x24 TCP_CONGESTION = 0xd TCP_COOKIE_IN_ALWAYS = 0x1 TCP_COOKIE_MAX = 0x10 @@ -2108,6 +2131,7 @@ const ( TCP_FASTOPEN_KEY = 0x21 TCP_FASTOPEN_NO_COOKIE = 0x22 TCP_INFO = 0xb + TCP_INQ = 0x24 TCP_KEEPCNT = 0x6 TCP_KEEPIDLE = 0x4 TCP_KEEPINTVL = 0x5 @@ -2127,6 +2151,9 @@ const ( TCP_QUEUE_SEQ = 0x15 TCP_QUICKACK = 0xc TCP_REPAIR = 0x13 + TCP_REPAIR_OFF = 0x0 + TCP_REPAIR_OFF_NO_WP = -0x1 + TCP_REPAIR_ON = 0x1 TCP_REPAIR_OPTIONS = 0x16 TCP_REPAIR_QUEUE = 0x14 TCP_REPAIR_WINDOW = 0x1d @@ -2141,6 +2168,7 @@ const ( TCP_ULP = 0x1f TCP_USER_TIMEOUT = 0x12 TCP_WINDOW_CLAMP = 0xa + TCP_ZEROCOPY_RECEIVE = 0x23 TCSAFLUSH = 0x2 TCSBRK = 0x2000741d TCSBRKP = 0x5425 @@ -2151,6 +2179,7 @@ const ( TCSETSF = 0x802c7416 TCSETSW = 0x802c7415 TCXONC = 0x2000741e + TIMER_ABSTIME = 0x1 TIOCCBRK = 0x5428 TIOCCONS = 0x541d TIOCEXCL = 0x540c diff --git a/src/cmd/vendor/golang.org/x/sys/unix/zerrors_linux_riscv64.go b/src/cmd/vendor/golang.org/x/sys/unix/zerrors_linux_riscv64.go index cfe9ef8b1b..5aea4b9093 100644 --- a/src/cmd/vendor/golang.org/x/sys/unix/zerrors_linux_riscv64.go +++ b/src/cmd/vendor/golang.org/x/sys/unix/zerrors_linux_riscv64.go @@ -41,7 +41,7 @@ const ( AF_KEY = 0xf AF_LLC = 0x1a AF_LOCAL = 0x1 - AF_MAX = 0x2c + AF_MAX = 0x2d AF_MPLS = 0x1c AF_NETBEUI = 0xd AF_NETLINK = 0x10 @@ -706,6 +706,7 @@ const ( IN_ISDIR = 0x40000000 IN_LOOPBACKNET = 0x7f IN_MASK_ADD = 0x20000000 + IN_MASK_CREATE = 0x10000000 IN_MODIFY = 0x2 IN_MOVE = 0xc0 IN_MOVED_FROM = 0x40 @@ -777,6 +778,7 @@ const ( IPV6_MINHOPCOUNT = 0x49 IPV6_MTU = 0x18 IPV6_MTU_DISCOVER = 0x17 + IPV6_MULTICAST_ALL = 0x1d IPV6_MULTICAST_HOPS = 0x12 IPV6_MULTICAST_IF = 0x11 IPV6_MULTICAST_LOOP = 0x13 @@ -1525,6 +1527,13 @@ const ( RLIMIT_SIGPENDING = 0xb RLIMIT_STACK = 0x3 RLIM_INFINITY = 0xffffffffffffffff + RNDADDENTROPY = 0x40085203 + RNDADDTOENTCNT = 0x40045201 + RNDCLEARPOOL = 0x5206 + RNDGETENTCNT = 0x80045200 + RNDGETPOOL = 0x80085202 + RNDRESEEDCRNG = 0x5207 + RNDZAPENTCNT = 0x5204 RTAX_ADVMSS = 0x8 RTAX_CC_ALGO = 0x10 RTAX_CWND = 0x7 @@ -1732,6 +1741,8 @@ const ( SECCOMP_MODE_STRICT = 0x1 SECURITYFS_MAGIC = 0x73636673 SELINUX_MAGIC = 0xf97cff8c + SFD_CLOEXEC = 0x80000 + SFD_NONBLOCK = 0x800 SHUT_RD = 0x0 SHUT_RDWR = 0x2 SHUT_WR = 0x1 @@ -1893,6 +1904,17 @@ const ( SO_DETACH_FILTER = 0x1b SO_DOMAIN = 0x27 SO_DONTROUTE = 0x5 + SO_EE_CODE_TXTIME_INVALID_PARAM = 0x1 + SO_EE_CODE_TXTIME_MISSED = 0x2 + SO_EE_CODE_ZEROCOPY_COPIED = 0x1 + SO_EE_ORIGIN_ICMP = 0x2 + SO_EE_ORIGIN_ICMP6 = 0x3 + SO_EE_ORIGIN_LOCAL = 0x1 + SO_EE_ORIGIN_NONE = 0x0 + SO_EE_ORIGIN_TIMESTAMPING = 0x4 + SO_EE_ORIGIN_TXSTATUS = 0x4 + SO_EE_ORIGIN_TXTIME = 0x6 + SO_EE_ORIGIN_ZEROCOPY = 0x5 SO_ERROR = 0x4 SO_GET_FILTER = 0x1a SO_INCOMING_CPU = 0x31 @@ -2026,6 +2048,7 @@ const ( TCOOFF = 0x0 TCOON = 0x1 TCP_CC_INFO = 0x1a + TCP_CM_INQ = 0x24 TCP_CONGESTION = 0xd TCP_COOKIE_IN_ALWAYS = 0x1 TCP_COOKIE_MAX = 0x10 @@ -2040,6 +2063,7 @@ const ( TCP_FASTOPEN_KEY = 0x21 TCP_FASTOPEN_NO_COOKIE = 0x22 TCP_INFO = 0xb + TCP_INQ = 0x24 TCP_KEEPCNT = 0x6 TCP_KEEPIDLE = 0x4 TCP_KEEPINTVL = 0x5 @@ -2059,6 +2083,9 @@ const ( TCP_QUEUE_SEQ = 0x15 TCP_QUICKACK = 0xc TCP_REPAIR = 0x13 + TCP_REPAIR_OFF = 0x0 + TCP_REPAIR_OFF_NO_WP = -0x1 + TCP_REPAIR_ON = 0x1 TCP_REPAIR_OPTIONS = 0x16 TCP_REPAIR_QUEUE = 0x14 TCP_REPAIR_WINDOW = 0x1d @@ -2073,6 +2100,7 @@ const ( TCP_ULP = 0x1f TCP_USER_TIMEOUT = 0x12 TCP_WINDOW_CLAMP = 0xa + TCP_ZEROCOPY_RECEIVE = 0x23 TCSAFLUSH = 0x2 TCSBRK = 0x5409 TCSBRKP = 0x5425 @@ -2089,6 +2117,7 @@ const ( TCSETXF = 0x5434 TCSETXW = 0x5435 TCXONC = 0x540a + TIMER_ABSTIME = 0x1 TIOCCBRK = 0x5428 TIOCCONS = 0x541d TIOCEXCL = 0x540c diff --git a/src/cmd/vendor/golang.org/x/sys/unix/zerrors_linux_s390x.go b/src/cmd/vendor/golang.org/x/sys/unix/zerrors_linux_s390x.go index 1149661109..7f7c2e3e2f 100644 --- a/src/cmd/vendor/golang.org/x/sys/unix/zerrors_linux_s390x.go +++ b/src/cmd/vendor/golang.org/x/sys/unix/zerrors_linux_s390x.go @@ -41,7 +41,7 @@ const ( AF_KEY = 0xf AF_LLC = 0x1a AF_LOCAL = 0x1 - AF_MAX = 0x2c + AF_MAX = 0x2d AF_MPLS = 0x1c AF_NETBEUI = 0xd AF_NETLINK = 0x10 @@ -706,6 +706,7 @@ const ( IN_ISDIR = 0x40000000 IN_LOOPBACKNET = 0x7f IN_MASK_ADD = 0x20000000 + IN_MASK_CREATE = 0x10000000 IN_MODIFY = 0x2 IN_MOVE = 0xc0 IN_MOVED_FROM = 0x40 @@ -777,6 +778,7 @@ const ( IPV6_MINHOPCOUNT = 0x49 IPV6_MTU = 0x18 IPV6_MTU_DISCOVER = 0x17 + IPV6_MULTICAST_ALL = 0x1d IPV6_MULTICAST_HOPS = 0x12 IPV6_MULTICAST_IF = 0x11 IPV6_MULTICAST_LOOP = 0x13 @@ -1598,6 +1600,13 @@ const ( RLIMIT_SIGPENDING = 0xb RLIMIT_STACK = 0x3 RLIM_INFINITY = 0xffffffffffffffff + RNDADDENTROPY = 0x40085203 + RNDADDTOENTCNT = 0x40045201 + RNDCLEARPOOL = 0x5206 + RNDGETENTCNT = 0x80045200 + RNDGETPOOL = 0x80085202 + RNDRESEEDCRNG = 0x5207 + RNDZAPENTCNT = 0x5204 RTAX_ADVMSS = 0x8 RTAX_CC_ALGO = 0x10 RTAX_CWND = 0x7 @@ -1805,6 +1814,8 @@ const ( SECCOMP_MODE_STRICT = 0x1 SECURITYFS_MAGIC = 0x73636673 SELINUX_MAGIC = 0xf97cff8c + SFD_CLOEXEC = 0x80000 + SFD_NONBLOCK = 0x800 SHUT_RD = 0x0 SHUT_RDWR = 0x2 SHUT_WR = 0x1 @@ -1966,6 +1977,17 @@ const ( SO_DETACH_FILTER = 0x1b SO_DOMAIN = 0x27 SO_DONTROUTE = 0x5 + SO_EE_CODE_TXTIME_INVALID_PARAM = 0x1 + SO_EE_CODE_TXTIME_MISSED = 0x2 + SO_EE_CODE_ZEROCOPY_COPIED = 0x1 + SO_EE_ORIGIN_ICMP = 0x2 + SO_EE_ORIGIN_ICMP6 = 0x3 + SO_EE_ORIGIN_LOCAL = 0x1 + SO_EE_ORIGIN_NONE = 0x0 + SO_EE_ORIGIN_TIMESTAMPING = 0x4 + SO_EE_ORIGIN_TXSTATUS = 0x4 + SO_EE_ORIGIN_TXTIME = 0x6 + SO_EE_ORIGIN_ZEROCOPY = 0x5 SO_ERROR = 0x4 SO_GET_FILTER = 0x1a SO_INCOMING_CPU = 0x31 @@ -2099,6 +2121,7 @@ const ( TCOOFF = 0x0 TCOON = 0x1 TCP_CC_INFO = 0x1a + TCP_CM_INQ = 0x24 TCP_CONGESTION = 0xd TCP_COOKIE_IN_ALWAYS = 0x1 TCP_COOKIE_MAX = 0x10 @@ -2113,6 +2136,7 @@ const ( TCP_FASTOPEN_KEY = 0x21 TCP_FASTOPEN_NO_COOKIE = 0x22 TCP_INFO = 0xb + TCP_INQ = 0x24 TCP_KEEPCNT = 0x6 TCP_KEEPIDLE = 0x4 TCP_KEEPINTVL = 0x5 @@ -2132,6 +2156,9 @@ const ( TCP_QUEUE_SEQ = 0x15 TCP_QUICKACK = 0xc TCP_REPAIR = 0x13 + TCP_REPAIR_OFF = 0x0 + TCP_REPAIR_OFF_NO_WP = -0x1 + TCP_REPAIR_ON = 0x1 TCP_REPAIR_OPTIONS = 0x16 TCP_REPAIR_QUEUE = 0x14 TCP_REPAIR_WINDOW = 0x1d @@ -2146,6 +2173,7 @@ const ( TCP_ULP = 0x1f TCP_USER_TIMEOUT = 0x12 TCP_WINDOW_CLAMP = 0xa + TCP_ZEROCOPY_RECEIVE = 0x23 TCSAFLUSH = 0x2 TCSBRK = 0x5409 TCSBRKP = 0x5425 @@ -2162,6 +2190,7 @@ const ( TCSETXF = 0x5434 TCSETXW = 0x5435 TCXONC = 0x540a + TIMER_ABSTIME = 0x1 TIOCCBRK = 0x5428 TIOCCONS = 0x541d TIOCEXCL = 0x540c diff --git a/src/cmd/vendor/golang.org/x/sys/unix/zerrors_linux_sparc64.go b/src/cmd/vendor/golang.org/x/sys/unix/zerrors_linux_sparc64.go index 036f3247c7..968e21fd68 100644 --- a/src/cmd/vendor/golang.org/x/sys/unix/zerrors_linux_sparc64.go +++ b/src/cmd/vendor/golang.org/x/sys/unix/zerrors_linux_sparc64.go @@ -41,7 +41,7 @@ const ( AF_KEY = 0xf AF_LLC = 0x1a AF_LOCAL = 0x1 - AF_MAX = 0x2c + AF_MAX = 0x2d AF_MPLS = 0x1c AF_NETBEUI = 0xd AF_NETLINK = 0x10 @@ -710,6 +710,7 @@ const ( IN_ISDIR = 0x40000000 IN_LOOPBACKNET = 0x7f IN_MASK_ADD = 0x20000000 + IN_MASK_CREATE = 0x10000000 IN_MODIFY = 0x2 IN_MOVE = 0xc0 IN_MOVED_FROM = 0x40 @@ -781,6 +782,7 @@ const ( IPV6_MINHOPCOUNT = 0x49 IPV6_MTU = 0x18 IPV6_MTU_DISCOVER = 0x17 + IPV6_MULTICAST_ALL = 0x1d IPV6_MULTICAST_HOPS = 0x12 IPV6_MULTICAST_IF = 0x11 IPV6_MULTICAST_LOOP = 0x13 @@ -1590,6 +1592,13 @@ const ( RLIMIT_SIGPENDING = 0xb RLIMIT_STACK = 0x3 RLIM_INFINITY = 0xffffffffffffffff + RNDADDENTROPY = 0x80085203 + RNDADDTOENTCNT = 0x80045201 + RNDCLEARPOOL = 0x20005206 + RNDGETENTCNT = 0x40045200 + RNDGETPOOL = 0x40085202 + RNDRESEEDCRNG = 0x20005207 + RNDZAPENTCNT = 0x20005204 RTAX_ADVMSS = 0x8 RTAX_CC_ALGO = 0x10 RTAX_CWND = 0x7 @@ -1797,6 +1806,8 @@ const ( SECCOMP_MODE_STRICT = 0x1 SECURITYFS_MAGIC = 0x73636673 SELINUX_MAGIC = 0xf97cff8c + SFD_CLOEXEC = 0x400000 + SFD_NONBLOCK = 0x4000 SHUT_RD = 0x0 SHUT_RDWR = 0x2 SHUT_WR = 0x1 @@ -1958,6 +1969,17 @@ const ( SO_DETACH_FILTER = 0x1b SO_DOMAIN = 0x1029 SO_DONTROUTE = 0x10 + SO_EE_CODE_TXTIME_INVALID_PARAM = 0x1 + SO_EE_CODE_TXTIME_MISSED = 0x2 + SO_EE_CODE_ZEROCOPY_COPIED = 0x1 + SO_EE_ORIGIN_ICMP = 0x2 + SO_EE_ORIGIN_ICMP6 = 0x3 + SO_EE_ORIGIN_LOCAL = 0x1 + SO_EE_ORIGIN_NONE = 0x0 + SO_EE_ORIGIN_TIMESTAMPING = 0x4 + SO_EE_ORIGIN_TXSTATUS = 0x4 + SO_EE_ORIGIN_TXTIME = 0x6 + SO_EE_ORIGIN_ZEROCOPY = 0x5 SO_ERROR = 0x1007 SO_GET_FILTER = 0x1a SO_INCOMING_CPU = 0x33 @@ -2090,6 +2112,7 @@ const ( TCOOFF = 0x0 TCOON = 0x1 TCP_CC_INFO = 0x1a + TCP_CM_INQ = 0x24 TCP_CONGESTION = 0xd TCP_COOKIE_IN_ALWAYS = 0x1 TCP_COOKIE_MAX = 0x10 @@ -2104,6 +2127,7 @@ const ( TCP_FASTOPEN_KEY = 0x21 TCP_FASTOPEN_NO_COOKIE = 0x22 TCP_INFO = 0xb + TCP_INQ = 0x24 TCP_KEEPCNT = 0x6 TCP_KEEPIDLE = 0x4 TCP_KEEPINTVL = 0x5 @@ -2123,6 +2147,9 @@ const ( TCP_QUEUE_SEQ = 0x15 TCP_QUICKACK = 0xc TCP_REPAIR = 0x13 + TCP_REPAIR_OFF = 0x0 + TCP_REPAIR_OFF_NO_WP = -0x1 + TCP_REPAIR_ON = 0x1 TCP_REPAIR_OPTIONS = 0x16 TCP_REPAIR_QUEUE = 0x14 TCP_REPAIR_WINDOW = 0x1d @@ -2137,6 +2164,7 @@ const ( TCP_ULP = 0x1f TCP_USER_TIMEOUT = 0x12 TCP_WINDOW_CLAMP = 0xa + TCP_ZEROCOPY_RECEIVE = 0x23 TCSAFLUSH = 0x2 TCSBRK = 0x20005405 TCSBRKP = 0x5425 @@ -2150,6 +2178,7 @@ const ( TCSETSW = 0x8024540a TCSETSW2 = 0x802c540e TCXONC = 0x20005406 + TIMER_ABSTIME = 0x1 TIOCCBRK = 0x2000747a TIOCCONS = 0x20007424 TIOCEXCL = 0x2000740d diff --git a/src/cmd/vendor/golang.org/x/sys/unix/zerrors_netbsd_arm64.go b/src/cmd/vendor/golang.org/x/sys/unix/zerrors_netbsd_arm64.go new file mode 100644 index 0000000000..fb6c60441d --- /dev/null +++ b/src/cmd/vendor/golang.org/x/sys/unix/zerrors_netbsd_arm64.go @@ -0,0 +1,1762 @@ +// mkerrors.sh -m64 +// Code generated by the command above; see README.md. DO NOT EDIT. + +// +build arm64,netbsd + +// Created by cgo -godefs - DO NOT EDIT +// cgo -godefs -- -m64 _const.go + +package unix + +import "syscall" + +const ( + AF_APPLETALK = 0x10 + AF_ARP = 0x1c + AF_BLUETOOTH = 0x1f + AF_CCITT = 0xa + AF_CHAOS = 0x5 + AF_CNT = 0x15 + AF_COIP = 0x14 + AF_DATAKIT = 0x9 + AF_DECnet = 0xc + AF_DLI = 0xd + AF_E164 = 0x1a + AF_ECMA = 0x8 + AF_HYLINK = 0xf + AF_IEEE80211 = 0x20 + AF_IMPLINK = 0x3 + AF_INET = 0x2 + AF_INET6 = 0x18 + AF_IPX = 0x17 + AF_ISDN = 0x1a + AF_ISO = 0x7 + AF_LAT = 0xe + AF_LINK = 0x12 + AF_LOCAL = 0x1 + AF_MAX = 0x23 + AF_MPLS = 0x21 + AF_NATM = 0x1b + AF_NS = 0x6 + AF_OROUTE = 0x11 + AF_OSI = 0x7 + AF_PUP = 0x4 + AF_ROUTE = 0x22 + AF_SNA = 0xb + AF_UNIX = 0x1 + AF_UNSPEC = 0x0 + ARPHRD_ARCNET = 0x7 + ARPHRD_ETHER = 0x1 + ARPHRD_FRELAY = 0xf + ARPHRD_IEEE1394 = 0x18 + ARPHRD_IEEE802 = 0x6 + ARPHRD_STRIP = 0x17 + B0 = 0x0 + B110 = 0x6e + B115200 = 0x1c200 + B1200 = 0x4b0 + B134 = 0x86 + B14400 = 0x3840 + B150 = 0x96 + B1800 = 0x708 + B19200 = 0x4b00 + B200 = 0xc8 + B230400 = 0x38400 + B2400 = 0x960 + B28800 = 0x7080 + B300 = 0x12c + B38400 = 0x9600 + B460800 = 0x70800 + B4800 = 0x12c0 + B50 = 0x32 + B57600 = 0xe100 + B600 = 0x258 + B7200 = 0x1c20 + B75 = 0x4b + B76800 = 0x12c00 + B921600 = 0xe1000 + B9600 = 0x2580 + BIOCFEEDBACK = 0x8004427d + BIOCFLUSH = 0x20004268 + BIOCGBLEN = 0x40044266 + BIOCGDLT = 0x4004426a + BIOCGDLTLIST = 0xc0104277 + BIOCGETIF = 0x4090426b + BIOCGFEEDBACK = 0x4004427c + BIOCGHDRCMPLT = 0x40044274 + BIOCGRTIMEOUT = 0x4010427b + BIOCGSEESENT = 0x40044278 + BIOCGSTATS = 0x4080426f + BIOCGSTATSOLD = 0x4008426f + BIOCIMMEDIATE = 0x80044270 + BIOCPROMISC = 0x20004269 + BIOCSBLEN = 0xc0044266 + BIOCSDLT = 0x80044276 + BIOCSETF = 0x80104267 + BIOCSETIF = 0x8090426c + BIOCSFEEDBACK = 0x8004427d + BIOCSHDRCMPLT = 0x80044275 + BIOCSRTIMEOUT = 0x8010427a + BIOCSSEESENT = 0x80044279 + BIOCSTCPF = 0x80104272 + BIOCSUDPF = 0x80104273 + BIOCVERSION = 0x40044271 + BPF_A = 0x10 + BPF_ABS = 0x20 + BPF_ADD = 0x0 + BPF_ALIGNMENT = 0x8 + BPF_ALIGNMENT32 = 0x4 + BPF_ALU = 0x4 + BPF_AND = 0x50 + BPF_B = 0x10 + BPF_DFLTBUFSIZE = 0x100000 + BPF_DIV = 0x30 + BPF_H = 0x8 + BPF_IMM = 0x0 + BPF_IND = 0x40 + BPF_JA = 0x0 + BPF_JEQ = 0x10 + BPF_JGE = 0x30 + BPF_JGT = 0x20 + BPF_JMP = 0x5 + BPF_JSET = 0x40 + BPF_K = 0x0 + BPF_LD = 0x0 + BPF_LDX = 0x1 + BPF_LEN = 0x80 + BPF_LSH = 0x60 + BPF_MAJOR_VERSION = 0x1 + BPF_MAXBUFSIZE = 0x1000000 + BPF_MAXINSNS = 0x200 + BPF_MEM = 0x60 + BPF_MEMWORDS = 0x10 + BPF_MINBUFSIZE = 0x20 + BPF_MINOR_VERSION = 0x1 + BPF_MISC = 0x7 + BPF_MSH = 0xa0 + BPF_MUL = 0x20 + BPF_NEG = 0x80 + BPF_OR = 0x40 + BPF_RELEASE = 0x30bb6 + BPF_RET = 0x6 + BPF_RSH = 0x70 + BPF_ST = 0x2 + BPF_STX = 0x3 + BPF_SUB = 0x10 + BPF_TAX = 0x0 + BPF_TXA = 0x80 + BPF_W = 0x0 + BPF_X = 0x8 + BRKINT = 0x2 + CFLUSH = 0xf + CLOCAL = 0x8000 + CLONE_CSIGNAL = 0xff + CLONE_FILES = 0x400 + CLONE_FS = 0x200 + CLONE_PID = 0x1000 + CLONE_PTRACE = 0x2000 + CLONE_SIGHAND = 0x800 + CLONE_VFORK = 0x4000 + CLONE_VM = 0x100 + CREAD = 0x800 + CRTSCTS = 0x10000 + CS5 = 0x0 + CS6 = 0x100 + CS7 = 0x200 + CS8 = 0x300 + CSIZE = 0x300 + CSTART = 0x11 + CSTATUS = 0x14 + CSTOP = 0x13 + CSTOPB = 0x400 + CSUSP = 0x1a + CTL_HW = 0x6 + CTL_KERN = 0x1 + CTL_MAXNAME = 0xc + CTL_NET = 0x4 + CTL_QUERY = -0x2 + DIOCBSFLUSH = 0x20006478 + DLT_A429 = 0xb8 + DLT_A653_ICM = 0xb9 + DLT_AIRONET_HEADER = 0x78 + DLT_AOS = 0xde + DLT_APPLE_IP_OVER_IEEE1394 = 0x8a + DLT_ARCNET = 0x7 + DLT_ARCNET_LINUX = 0x81 + DLT_ATM_CLIP = 0x13 + DLT_ATM_RFC1483 = 0xb + DLT_AURORA = 0x7e + DLT_AX25 = 0x3 + DLT_AX25_KISS = 0xca + DLT_BACNET_MS_TP = 0xa5 + DLT_BLUETOOTH_HCI_H4 = 0xbb + DLT_BLUETOOTH_HCI_H4_WITH_PHDR = 0xc9 + DLT_CAN20B = 0xbe + DLT_CAN_SOCKETCAN = 0xe3 + DLT_CHAOS = 0x5 + DLT_CISCO_IOS = 0x76 + DLT_C_HDLC = 0x68 + DLT_C_HDLC_WITH_DIR = 0xcd + DLT_DECT = 0xdd + DLT_DOCSIS = 0x8f + DLT_ECONET = 0x73 + DLT_EN10MB = 0x1 + DLT_EN3MB = 0x2 + DLT_ENC = 0x6d + DLT_ERF = 0xc5 + DLT_ERF_ETH = 0xaf + DLT_ERF_POS = 0xb0 + DLT_FC_2 = 0xe0 + DLT_FC_2_WITH_FRAME_DELIMS = 0xe1 + DLT_FDDI = 0xa + DLT_FLEXRAY = 0xd2 + DLT_FRELAY = 0x6b + DLT_FRELAY_WITH_DIR = 0xce + DLT_GCOM_SERIAL = 0xad + DLT_GCOM_T1E1 = 0xac + DLT_GPF_F = 0xab + DLT_GPF_T = 0xaa + DLT_GPRS_LLC = 0xa9 + DLT_GSMTAP_ABIS = 0xda + DLT_GSMTAP_UM = 0xd9 + DLT_HDLC = 0x10 + DLT_HHDLC = 0x79 + DLT_HIPPI = 0xf + DLT_IBM_SN = 0x92 + DLT_IBM_SP = 0x91 + DLT_IEEE802 = 0x6 + DLT_IEEE802_11 = 0x69 + DLT_IEEE802_11_RADIO = 0x7f + DLT_IEEE802_11_RADIO_AVS = 0xa3 + DLT_IEEE802_15_4 = 0xc3 + DLT_IEEE802_15_4_LINUX = 0xbf + DLT_IEEE802_15_4_NONASK_PHY = 0xd7 + DLT_IEEE802_16_MAC_CPS = 0xbc + DLT_IEEE802_16_MAC_CPS_RADIO = 0xc1 + DLT_IPMB = 0xc7 + DLT_IPMB_LINUX = 0xd1 + DLT_IPNET = 0xe2 + DLT_IPV4 = 0xe4 + DLT_IPV6 = 0xe5 + DLT_IP_OVER_FC = 0x7a + DLT_JUNIPER_ATM1 = 0x89 + DLT_JUNIPER_ATM2 = 0x87 + DLT_JUNIPER_CHDLC = 0xb5 + DLT_JUNIPER_ES = 0x84 + DLT_JUNIPER_ETHER = 0xb2 + DLT_JUNIPER_FRELAY = 0xb4 + DLT_JUNIPER_GGSN = 0x85 + DLT_JUNIPER_ISM = 0xc2 + DLT_JUNIPER_MFR = 0x86 + DLT_JUNIPER_MLFR = 0x83 + DLT_JUNIPER_MLPPP = 0x82 + DLT_JUNIPER_MONITOR = 0xa4 + DLT_JUNIPER_PIC_PEER = 0xae + DLT_JUNIPER_PPP = 0xb3 + DLT_JUNIPER_PPPOE = 0xa7 + DLT_JUNIPER_PPPOE_ATM = 0xa8 + DLT_JUNIPER_SERVICES = 0x88 + DLT_JUNIPER_ST = 0xc8 + DLT_JUNIPER_VP = 0xb7 + DLT_LAPB_WITH_DIR = 0xcf + DLT_LAPD = 0xcb + DLT_LIN = 0xd4 + DLT_LINUX_EVDEV = 0xd8 + DLT_LINUX_IRDA = 0x90 + DLT_LINUX_LAPD = 0xb1 + DLT_LINUX_SLL = 0x71 + DLT_LOOP = 0x6c + DLT_LTALK = 0x72 + DLT_MFR = 0xb6 + DLT_MOST = 0xd3 + DLT_MPLS = 0xdb + DLT_MTP2 = 0x8c + DLT_MTP2_WITH_PHDR = 0x8b + DLT_MTP3 = 0x8d + DLT_NULL = 0x0 + DLT_PCI_EXP = 0x7d + DLT_PFLOG = 0x75 + DLT_PFSYNC = 0x12 + DLT_PPI = 0xc0 + DLT_PPP = 0x9 + DLT_PPP_BSDOS = 0xe + DLT_PPP_ETHER = 0x33 + DLT_PPP_PPPD = 0xa6 + DLT_PPP_SERIAL = 0x32 + DLT_PPP_WITH_DIR = 0xcc + DLT_PRISM_HEADER = 0x77 + DLT_PRONET = 0x4 + DLT_RAIF1 = 0xc6 + DLT_RAW = 0xc + DLT_RAWAF_MASK = 0x2240000 + DLT_RIO = 0x7c + DLT_SCCP = 0x8e + DLT_SITA = 0xc4 + DLT_SLIP = 0x8 + DLT_SLIP_BSDOS = 0xd + DLT_SUNATM = 0x7b + DLT_SYMANTEC_FIREWALL = 0x63 + DLT_TZSP = 0x80 + DLT_USB = 0xba + DLT_USB_LINUX = 0xbd + DLT_USB_LINUX_MMAPPED = 0xdc + DLT_WIHART = 0xdf + DLT_X2E_SERIAL = 0xd5 + DLT_X2E_XORAYA = 0xd6 + DT_BLK = 0x6 + DT_CHR = 0x2 + DT_DIR = 0x4 + DT_FIFO = 0x1 + DT_LNK = 0xa + DT_REG = 0x8 + DT_SOCK = 0xc + DT_UNKNOWN = 0x0 + DT_WHT = 0xe + ECHO = 0x8 + ECHOCTL = 0x40 + ECHOE = 0x2 + ECHOK = 0x4 + ECHOKE = 0x1 + ECHONL = 0x10 + ECHOPRT = 0x20 + EMUL_LINUX = 0x1 + EMUL_LINUX32 = 0x5 + EMUL_MAXID = 0x6 + ETHERCAP_JUMBO_MTU = 0x4 + ETHERCAP_VLAN_HWTAGGING = 0x2 + ETHERCAP_VLAN_MTU = 0x1 + ETHERMIN = 0x2e + ETHERMTU = 0x5dc + ETHERMTU_JUMBO = 0x2328 + ETHERTYPE_8023 = 0x4 + ETHERTYPE_AARP = 0x80f3 + ETHERTYPE_ACCTON = 0x8390 + ETHERTYPE_AEONIC = 0x8036 + ETHERTYPE_ALPHA = 0x814a + ETHERTYPE_AMBER = 0x6008 + ETHERTYPE_AMOEBA = 0x8145 + ETHERTYPE_APOLLO = 0x80f7 + ETHERTYPE_APOLLODOMAIN = 0x8019 + ETHERTYPE_APPLETALK = 0x809b + ETHERTYPE_APPLITEK = 0x80c7 + ETHERTYPE_ARGONAUT = 0x803a + ETHERTYPE_ARP = 0x806 + ETHERTYPE_AT = 0x809b + ETHERTYPE_ATALK = 0x809b + ETHERTYPE_ATOMIC = 0x86df + ETHERTYPE_ATT = 0x8069 + ETHERTYPE_ATTSTANFORD = 0x8008 + ETHERTYPE_AUTOPHON = 0x806a + ETHERTYPE_AXIS = 0x8856 + ETHERTYPE_BCLOOP = 0x9003 + ETHERTYPE_BOFL = 0x8102 + ETHERTYPE_CABLETRON = 0x7034 + ETHERTYPE_CHAOS = 0x804 + ETHERTYPE_COMDESIGN = 0x806c + ETHERTYPE_COMPUGRAPHIC = 0x806d + ETHERTYPE_COUNTERPOINT = 0x8062 + ETHERTYPE_CRONUS = 0x8004 + ETHERTYPE_CRONUSVLN = 0x8003 + ETHERTYPE_DCA = 0x1234 + ETHERTYPE_DDE = 0x807b + ETHERTYPE_DEBNI = 0xaaaa + ETHERTYPE_DECAM = 0x8048 + ETHERTYPE_DECCUST = 0x6006 + ETHERTYPE_DECDIAG = 0x6005 + ETHERTYPE_DECDNS = 0x803c + ETHERTYPE_DECDTS = 0x803e + ETHERTYPE_DECEXPER = 0x6000 + ETHERTYPE_DECLAST = 0x8041 + ETHERTYPE_DECLTM = 0x803f + ETHERTYPE_DECMUMPS = 0x6009 + ETHERTYPE_DECNETBIOS = 0x8040 + ETHERTYPE_DELTACON = 0x86de + ETHERTYPE_DIDDLE = 0x4321 + ETHERTYPE_DLOG1 = 0x660 + ETHERTYPE_DLOG2 = 0x661 + ETHERTYPE_DN = 0x6003 + ETHERTYPE_DOGFIGHT = 0x1989 + ETHERTYPE_DSMD = 0x8039 + ETHERTYPE_ECMA = 0x803 + ETHERTYPE_ENCRYPT = 0x803d + ETHERTYPE_ES = 0x805d + ETHERTYPE_EXCELAN = 0x8010 + ETHERTYPE_EXPERDATA = 0x8049 + ETHERTYPE_FLIP = 0x8146 + ETHERTYPE_FLOWCONTROL = 0x8808 + ETHERTYPE_FRARP = 0x808 + ETHERTYPE_GENDYN = 0x8068 + ETHERTYPE_HAYES = 0x8130 + ETHERTYPE_HIPPI_FP = 0x8180 + ETHERTYPE_HITACHI = 0x8820 + ETHERTYPE_HP = 0x8005 + ETHERTYPE_IEEEPUP = 0xa00 + ETHERTYPE_IEEEPUPAT = 0xa01 + ETHERTYPE_IMLBL = 0x4c42 + ETHERTYPE_IMLBLDIAG = 0x424c + ETHERTYPE_IP = 0x800 + ETHERTYPE_IPAS = 0x876c + ETHERTYPE_IPV6 = 0x86dd + ETHERTYPE_IPX = 0x8137 + ETHERTYPE_IPXNEW = 0x8037 + ETHERTYPE_KALPANA = 0x8582 + ETHERTYPE_LANBRIDGE = 0x8038 + ETHERTYPE_LANPROBE = 0x8888 + ETHERTYPE_LAT = 0x6004 + ETHERTYPE_LBACK = 0x9000 + ETHERTYPE_LITTLE = 0x8060 + ETHERTYPE_LOGICRAFT = 0x8148 + ETHERTYPE_LOOPBACK = 0x9000 + ETHERTYPE_MATRA = 0x807a + ETHERTYPE_MAX = 0xffff + ETHERTYPE_MERIT = 0x807c + ETHERTYPE_MICP = 0x873a + ETHERTYPE_MOPDL = 0x6001 + ETHERTYPE_MOPRC = 0x6002 + ETHERTYPE_MOTOROLA = 0x818d + ETHERTYPE_MPLS = 0x8847 + ETHERTYPE_MPLS_MCAST = 0x8848 + ETHERTYPE_MUMPS = 0x813f + ETHERTYPE_NBPCC = 0x3c04 + ETHERTYPE_NBPCLAIM = 0x3c09 + ETHERTYPE_NBPCLREQ = 0x3c05 + ETHERTYPE_NBPCLRSP = 0x3c06 + ETHERTYPE_NBPCREQ = 0x3c02 + ETHERTYPE_NBPCRSP = 0x3c03 + ETHERTYPE_NBPDG = 0x3c07 + ETHERTYPE_NBPDGB = 0x3c08 + ETHERTYPE_NBPDLTE = 0x3c0a + ETHERTYPE_NBPRAR = 0x3c0c + ETHERTYPE_NBPRAS = 0x3c0b + ETHERTYPE_NBPRST = 0x3c0d + ETHERTYPE_NBPSCD = 0x3c01 + ETHERTYPE_NBPVCD = 0x3c00 + ETHERTYPE_NBS = 0x802 + ETHERTYPE_NCD = 0x8149 + ETHERTYPE_NESTAR = 0x8006 + ETHERTYPE_NETBEUI = 0x8191 + ETHERTYPE_NOVELL = 0x8138 + ETHERTYPE_NS = 0x600 + ETHERTYPE_NSAT = 0x601 + ETHERTYPE_NSCOMPAT = 0x807 + ETHERTYPE_NTRAILER = 0x10 + ETHERTYPE_OS9 = 0x7007 + ETHERTYPE_OS9NET = 0x7009 + ETHERTYPE_PACER = 0x80c6 + ETHERTYPE_PAE = 0x888e + ETHERTYPE_PCS = 0x4242 + ETHERTYPE_PLANNING = 0x8044 + ETHERTYPE_PPP = 0x880b + ETHERTYPE_PPPOE = 0x8864 + ETHERTYPE_PPPOEDISC = 0x8863 + ETHERTYPE_PRIMENTS = 0x7031 + ETHERTYPE_PUP = 0x200 + ETHERTYPE_PUPAT = 0x200 + ETHERTYPE_RACAL = 0x7030 + ETHERTYPE_RATIONAL = 0x8150 + ETHERTYPE_RAWFR = 0x6559 + ETHERTYPE_RCL = 0x1995 + ETHERTYPE_RDP = 0x8739 + ETHERTYPE_RETIX = 0x80f2 + ETHERTYPE_REVARP = 0x8035 + ETHERTYPE_SCA = 0x6007 + ETHERTYPE_SECTRA = 0x86db + ETHERTYPE_SECUREDATA = 0x876d + ETHERTYPE_SGITW = 0x817e + ETHERTYPE_SG_BOUNCE = 0x8016 + ETHERTYPE_SG_DIAG = 0x8013 + ETHERTYPE_SG_NETGAMES = 0x8014 + ETHERTYPE_SG_RESV = 0x8015 + ETHERTYPE_SIMNET = 0x5208 + ETHERTYPE_SLOWPROTOCOLS = 0x8809 + ETHERTYPE_SNA = 0x80d5 + ETHERTYPE_SNMP = 0x814c + ETHERTYPE_SONIX = 0xfaf5 + ETHERTYPE_SPIDER = 0x809f + ETHERTYPE_SPRITE = 0x500 + ETHERTYPE_STP = 0x8181 + ETHERTYPE_TALARIS = 0x812b + ETHERTYPE_TALARISMC = 0x852b + ETHERTYPE_TCPCOMP = 0x876b + ETHERTYPE_TCPSM = 0x9002 + ETHERTYPE_TEC = 0x814f + ETHERTYPE_TIGAN = 0x802f + ETHERTYPE_TRAIL = 0x1000 + ETHERTYPE_TRANSETHER = 0x6558 + ETHERTYPE_TYMSHARE = 0x802e + ETHERTYPE_UBBST = 0x7005 + ETHERTYPE_UBDEBUG = 0x900 + ETHERTYPE_UBDIAGLOOP = 0x7002 + ETHERTYPE_UBDL = 0x7000 + ETHERTYPE_UBNIU = 0x7001 + ETHERTYPE_UBNMC = 0x7003 + ETHERTYPE_VALID = 0x1600 + ETHERTYPE_VARIAN = 0x80dd + ETHERTYPE_VAXELN = 0x803b + ETHERTYPE_VEECO = 0x8067 + ETHERTYPE_VEXP = 0x805b + ETHERTYPE_VGLAB = 0x8131 + ETHERTYPE_VINES = 0xbad + ETHERTYPE_VINESECHO = 0xbaf + ETHERTYPE_VINESLOOP = 0xbae + ETHERTYPE_VITAL = 0xff00 + ETHERTYPE_VLAN = 0x8100 + ETHERTYPE_VLTLMAN = 0x8080 + ETHERTYPE_VPROD = 0x805c + ETHERTYPE_VURESERVED = 0x8147 + ETHERTYPE_WATERLOO = 0x8130 + ETHERTYPE_WELLFLEET = 0x8103 + ETHERTYPE_X25 = 0x805 + ETHERTYPE_X75 = 0x801 + ETHERTYPE_XNSSM = 0x9001 + ETHERTYPE_XTP = 0x817d + ETHER_ADDR_LEN = 0x6 + ETHER_CRC_LEN = 0x4 + ETHER_CRC_POLY_BE = 0x4c11db6 + ETHER_CRC_POLY_LE = 0xedb88320 + ETHER_HDR_LEN = 0xe + ETHER_MAX_LEN = 0x5ee + ETHER_MAX_LEN_JUMBO = 0x233a + ETHER_MIN_LEN = 0x40 + ETHER_PPPOE_ENCAP_LEN = 0x8 + ETHER_TYPE_LEN = 0x2 + ETHER_VLAN_ENCAP_LEN = 0x4 + EVFILT_AIO = 0x2 + EVFILT_PROC = 0x4 + EVFILT_READ = 0x0 + EVFILT_SIGNAL = 0x5 + EVFILT_SYSCOUNT = 0x7 + EVFILT_TIMER = 0x6 + EVFILT_VNODE = 0x3 + EVFILT_WRITE = 0x1 + EV_ADD = 0x1 + EV_CLEAR = 0x20 + EV_DELETE = 0x2 + EV_DISABLE = 0x8 + EV_ENABLE = 0x4 + EV_EOF = 0x8000 + EV_ERROR = 0x4000 + EV_FLAG1 = 0x2000 + EV_ONESHOT = 0x10 + EV_SYSFLAGS = 0xf000 + EXTA = 0x4b00 + EXTATTR_CMD_START = 0x1 + EXTATTR_CMD_STOP = 0x2 + EXTATTR_NAMESPACE_SYSTEM = 0x2 + EXTATTR_NAMESPACE_USER = 0x1 + EXTB = 0x9600 + EXTPROC = 0x800 + FD_CLOEXEC = 0x1 + FD_SETSIZE = 0x100 + FLUSHO = 0x800000 + F_CLOSEM = 0xa + F_DUPFD = 0x0 + F_DUPFD_CLOEXEC = 0xc + F_FSCTL = -0x80000000 + F_FSDIRMASK = 0x70000000 + F_FSIN = 0x10000000 + F_FSINOUT = 0x30000000 + F_FSOUT = 0x20000000 + F_FSPRIV = 0x8000 + F_FSVOID = 0x40000000 + F_GETFD = 0x1 + F_GETFL = 0x3 + F_GETLK = 0x7 + F_GETNOSIGPIPE = 0xd + F_GETOWN = 0x5 + F_MAXFD = 0xb + F_OK = 0x0 + F_PARAM_MASK = 0xfff + F_PARAM_MAX = 0xfff + F_RDLCK = 0x1 + F_SETFD = 0x2 + F_SETFL = 0x4 + F_SETLK = 0x8 + F_SETLKW = 0x9 + F_SETNOSIGPIPE = 0xe + F_SETOWN = 0x6 + F_UNLCK = 0x2 + F_WRLCK = 0x3 + HUPCL = 0x4000 + HW_MACHINE = 0x1 + ICANON = 0x100 + ICMP6_FILTER = 0x12 + ICRNL = 0x100 + IEXTEN = 0x400 + IFAN_ARRIVAL = 0x0 + IFAN_DEPARTURE = 0x1 + IFA_ROUTE = 0x1 + IFF_ALLMULTI = 0x200 + IFF_BROADCAST = 0x2 + IFF_CANTCHANGE = 0x8f52 + IFF_DEBUG = 0x4 + IFF_LINK0 = 0x1000 + IFF_LINK1 = 0x2000 + IFF_LINK2 = 0x4000 + IFF_LOOPBACK = 0x8 + IFF_MULTICAST = 0x8000 + IFF_NOARP = 0x80 + IFF_NOTRAILERS = 0x20 + IFF_OACTIVE = 0x400 + IFF_POINTOPOINT = 0x10 + IFF_PROMISC = 0x100 + IFF_RUNNING = 0x40 + IFF_SIMPLEX = 0x800 + IFF_UP = 0x1 + IFNAMSIZ = 0x10 + IFT_1822 = 0x2 + IFT_A12MPPSWITCH = 0x82 + IFT_AAL2 = 0xbb + IFT_AAL5 = 0x31 + IFT_ADSL = 0x5e + IFT_AFLANE8023 = 0x3b + IFT_AFLANE8025 = 0x3c + IFT_ARAP = 0x58 + IFT_ARCNET = 0x23 + IFT_ARCNETPLUS = 0x24 + IFT_ASYNC = 0x54 + IFT_ATM = 0x25 + IFT_ATMDXI = 0x69 + IFT_ATMFUNI = 0x6a + IFT_ATMIMA = 0x6b + IFT_ATMLOGICAL = 0x50 + IFT_ATMRADIO = 0xbd + IFT_ATMSUBINTERFACE = 0x86 + IFT_ATMVCIENDPT = 0xc2 + IFT_ATMVIRTUAL = 0x95 + IFT_BGPPOLICYACCOUNTING = 0xa2 + IFT_BRIDGE = 0xd1 + IFT_BSC = 0x53 + IFT_CARP = 0xf8 + IFT_CCTEMUL = 0x3d + IFT_CEPT = 0x13 + IFT_CES = 0x85 + IFT_CHANNEL = 0x46 + IFT_CNR = 0x55 + IFT_COFFEE = 0x84 + IFT_COMPOSITELINK = 0x9b + IFT_DCN = 0x8d + IFT_DIGITALPOWERLINE = 0x8a + IFT_DIGITALWRAPPEROVERHEADCHANNEL = 0xba + IFT_DLSW = 0x4a + IFT_DOCSCABLEDOWNSTREAM = 0x80 + IFT_DOCSCABLEMACLAYER = 0x7f + IFT_DOCSCABLEUPSTREAM = 0x81 + IFT_DOCSCABLEUPSTREAMCHANNEL = 0xcd + IFT_DS0 = 0x51 + IFT_DS0BUNDLE = 0x52 + IFT_DS1FDL = 0xaa + IFT_DS3 = 0x1e + IFT_DTM = 0x8c + IFT_DVBASILN = 0xac + IFT_DVBASIOUT = 0xad + IFT_DVBRCCDOWNSTREAM = 0x93 + IFT_DVBRCCMACLAYER = 0x92 + IFT_DVBRCCUPSTREAM = 0x94 + IFT_ECONET = 0xce + IFT_EON = 0x19 + IFT_EPLRS = 0x57 + IFT_ESCON = 0x49 + IFT_ETHER = 0x6 + IFT_FAITH = 0xf2 + IFT_FAST = 0x7d + IFT_FASTETHER = 0x3e + IFT_FASTETHERFX = 0x45 + IFT_FDDI = 0xf + IFT_FIBRECHANNEL = 0x38 + IFT_FRAMERELAYINTERCONNECT = 0x3a + IFT_FRAMERELAYMPI = 0x5c + IFT_FRDLCIENDPT = 0xc1 + IFT_FRELAY = 0x20 + IFT_FRELAYDCE = 0x2c + IFT_FRF16MFRBUNDLE = 0xa3 + IFT_FRFORWARD = 0x9e + IFT_G703AT2MB = 0x43 + IFT_G703AT64K = 0x42 + IFT_GIF = 0xf0 + IFT_GIGABITETHERNET = 0x75 + IFT_GR303IDT = 0xb2 + IFT_GR303RDT = 0xb1 + IFT_H323GATEKEEPER = 0xa4 + IFT_H323PROXY = 0xa5 + IFT_HDH1822 = 0x3 + IFT_HDLC = 0x76 + IFT_HDSL2 = 0xa8 + IFT_HIPERLAN2 = 0xb7 + IFT_HIPPI = 0x2f + IFT_HIPPIINTERFACE = 0x39 + IFT_HOSTPAD = 0x5a + IFT_HSSI = 0x2e + IFT_HY = 0xe + IFT_IBM370PARCHAN = 0x48 + IFT_IDSL = 0x9a + IFT_IEEE1394 = 0x90 + IFT_IEEE80211 = 0x47 + IFT_IEEE80212 = 0x37 + IFT_IEEE8023ADLAG = 0xa1 + IFT_IFGSN = 0x91 + IFT_IMT = 0xbe + IFT_INFINIBAND = 0xc7 + IFT_INTERLEAVE = 0x7c + IFT_IP = 0x7e + IFT_IPFORWARD = 0x8e + IFT_IPOVERATM = 0x72 + IFT_IPOVERCDLC = 0x6d + IFT_IPOVERCLAW = 0x6e + IFT_IPSWITCH = 0x4e + IFT_ISDN = 0x3f + IFT_ISDNBASIC = 0x14 + IFT_ISDNPRIMARY = 0x15 + IFT_ISDNS = 0x4b + IFT_ISDNU = 0x4c + IFT_ISO88022LLC = 0x29 + IFT_ISO88023 = 0x7 + IFT_ISO88024 = 0x8 + IFT_ISO88025 = 0x9 + IFT_ISO88025CRFPINT = 0x62 + IFT_ISO88025DTR = 0x56 + IFT_ISO88025FIBER = 0x73 + IFT_ISO88026 = 0xa + IFT_ISUP = 0xb3 + IFT_L2VLAN = 0x87 + IFT_L3IPVLAN = 0x88 + IFT_L3IPXVLAN = 0x89 + IFT_LAPB = 0x10 + IFT_LAPD = 0x4d + IFT_LAPF = 0x77 + IFT_LINEGROUP = 0xd2 + IFT_LOCALTALK = 0x2a + IFT_LOOP = 0x18 + IFT_MEDIAMAILOVERIP = 0x8b + IFT_MFSIGLINK = 0xa7 + IFT_MIOX25 = 0x26 + IFT_MODEM = 0x30 + IFT_MPC = 0x71 + IFT_MPLS = 0xa6 + IFT_MPLSTUNNEL = 0x96 + IFT_MSDSL = 0x8f + IFT_MVL = 0xbf + IFT_MYRINET = 0x63 + IFT_NFAS = 0xaf + IFT_NSIP = 0x1b + IFT_OPTICALCHANNEL = 0xc3 + IFT_OPTICALTRANSPORT = 0xc4 + IFT_OTHER = 0x1 + IFT_P10 = 0xc + IFT_P80 = 0xd + IFT_PARA = 0x22 + IFT_PFLOG = 0xf5 + IFT_PFSYNC = 0xf6 + IFT_PLC = 0xae + IFT_PON155 = 0xcf + IFT_PON622 = 0xd0 + IFT_POS = 0xab + IFT_PPP = 0x17 + IFT_PPPMULTILINKBUNDLE = 0x6c + IFT_PROPATM = 0xc5 + IFT_PROPBWAP2MP = 0xb8 + IFT_PROPCNLS = 0x59 + IFT_PROPDOCSWIRELESSDOWNSTREAM = 0xb5 + IFT_PROPDOCSWIRELESSMACLAYER = 0xb4 + IFT_PROPDOCSWIRELESSUPSTREAM = 0xb6 + IFT_PROPMUX = 0x36 + IFT_PROPVIRTUAL = 0x35 + IFT_PROPWIRELESSP2P = 0x9d + IFT_PTPSERIAL = 0x16 + IFT_PVC = 0xf1 + IFT_Q2931 = 0xc9 + IFT_QLLC = 0x44 + IFT_RADIOMAC = 0xbc + IFT_RADSL = 0x5f + IFT_REACHDSL = 0xc0 + IFT_RFC1483 = 0x9f + IFT_RS232 = 0x21 + IFT_RSRB = 0x4f + IFT_SDLC = 0x11 + IFT_SDSL = 0x60 + IFT_SHDSL = 0xa9 + IFT_SIP = 0x1f + IFT_SIPSIG = 0xcc + IFT_SIPTG = 0xcb + IFT_SLIP = 0x1c + IFT_SMDSDXI = 0x2b + IFT_SMDSICIP = 0x34 + IFT_SONET = 0x27 + IFT_SONETOVERHEADCHANNEL = 0xb9 + IFT_SONETPATH = 0x32 + IFT_SONETVT = 0x33 + IFT_SRP = 0x97 + IFT_SS7SIGLINK = 0x9c + IFT_STACKTOSTACK = 0x6f + IFT_STARLAN = 0xb + IFT_STF = 0xd7 + IFT_T1 = 0x12 + IFT_TDLC = 0x74 + IFT_TELINK = 0xc8 + IFT_TERMPAD = 0x5b + IFT_TR008 = 0xb0 + IFT_TRANSPHDLC = 0x7b + IFT_TUNNEL = 0x83 + IFT_ULTRA = 0x1d + IFT_USB = 0xa0 + IFT_V11 = 0x40 + IFT_V35 = 0x2d + IFT_V36 = 0x41 + IFT_V37 = 0x78 + IFT_VDSL = 0x61 + IFT_VIRTUALIPADDRESS = 0x70 + IFT_VIRTUALTG = 0xca + IFT_VOICEDID = 0xd5 + IFT_VOICEEM = 0x64 + IFT_VOICEEMFGD = 0xd3 + IFT_VOICEENCAP = 0x67 + IFT_VOICEFGDEANA = 0xd4 + IFT_VOICEFXO = 0x65 + IFT_VOICEFXS = 0x66 + IFT_VOICEOVERATM = 0x98 + IFT_VOICEOVERCABLE = 0xc6 + IFT_VOICEOVERFRAMERELAY = 0x99 + IFT_VOICEOVERIP = 0x68 + IFT_X213 = 0x5d + IFT_X25 = 0x5 + IFT_X25DDN = 0x4 + IFT_X25HUNTGROUP = 0x7a + IFT_X25MLP = 0x79 + IFT_X25PLE = 0x28 + IFT_XETHER = 0x1a + IGNBRK = 0x1 + IGNCR = 0x80 + IGNPAR = 0x4 + IMAXBEL = 0x2000 + INLCR = 0x40 + INPCK = 0x10 + IN_CLASSA_HOST = 0xffffff + IN_CLASSA_MAX = 0x80 + IN_CLASSA_NET = 0xff000000 + IN_CLASSA_NSHIFT = 0x18 + IN_CLASSB_HOST = 0xffff + IN_CLASSB_MAX = 0x10000 + IN_CLASSB_NET = 0xffff0000 + IN_CLASSB_NSHIFT = 0x10 + IN_CLASSC_HOST = 0xff + IN_CLASSC_NET = 0xffffff00 + IN_CLASSC_NSHIFT = 0x8 + IN_CLASSD_HOST = 0xfffffff + IN_CLASSD_NET = 0xf0000000 + IN_CLASSD_NSHIFT = 0x1c + IN_LOOPBACKNET = 0x7f + IPPROTO_AH = 0x33 + IPPROTO_CARP = 0x70 + IPPROTO_DONE = 0x101 + IPPROTO_DSTOPTS = 0x3c + IPPROTO_EGP = 0x8 + IPPROTO_ENCAP = 0x62 + IPPROTO_EON = 0x50 + IPPROTO_ESP = 0x32 + IPPROTO_ETHERIP = 0x61 + IPPROTO_FRAGMENT = 0x2c + IPPROTO_GGP = 0x3 + IPPROTO_GRE = 0x2f + IPPROTO_HOPOPTS = 0x0 + IPPROTO_ICMP = 0x1 + IPPROTO_ICMPV6 = 0x3a + IPPROTO_IDP = 0x16 + IPPROTO_IGMP = 0x2 + IPPROTO_IP = 0x0 + IPPROTO_IPCOMP = 0x6c + IPPROTO_IPIP = 0x4 + IPPROTO_IPV4 = 0x4 + IPPROTO_IPV6 = 0x29 + IPPROTO_IPV6_ICMP = 0x3a + IPPROTO_MAX = 0x100 + IPPROTO_MAXID = 0x34 + IPPROTO_MOBILE = 0x37 + IPPROTO_NONE = 0x3b + IPPROTO_PFSYNC = 0xf0 + IPPROTO_PIM = 0x67 + IPPROTO_PUP = 0xc + IPPROTO_RAW = 0xff + IPPROTO_ROUTING = 0x2b + IPPROTO_RSVP = 0x2e + IPPROTO_TCP = 0x6 + IPPROTO_TP = 0x1d + IPPROTO_UDP = 0x11 + IPPROTO_VRRP = 0x70 + IPV6_CHECKSUM = 0x1a + IPV6_DEFAULT_MULTICAST_HOPS = 0x1 + IPV6_DEFAULT_MULTICAST_LOOP = 0x1 + IPV6_DEFHLIM = 0x40 + IPV6_DONTFRAG = 0x3e + IPV6_DSTOPTS = 0x32 + IPV6_FAITH = 0x1d + IPV6_FLOWINFO_MASK = 0xffffff0f + IPV6_FLOWLABEL_MASK = 0xffff0f00 + IPV6_FRAGTTL = 0x78 + IPV6_HLIMDEC = 0x1 + IPV6_HOPLIMIT = 0x2f + IPV6_HOPOPTS = 0x31 + IPV6_IPSEC_POLICY = 0x1c + IPV6_JOIN_GROUP = 0xc + IPV6_LEAVE_GROUP = 0xd + IPV6_MAXHLIM = 0xff + IPV6_MAXPACKET = 0xffff + IPV6_MMTU = 0x500 + IPV6_MULTICAST_HOPS = 0xa + IPV6_MULTICAST_IF = 0x9 + IPV6_MULTICAST_LOOP = 0xb + IPV6_NEXTHOP = 0x30 + IPV6_PATHMTU = 0x2c + IPV6_PKTINFO = 0x2e + IPV6_PORTRANGE = 0xe + IPV6_PORTRANGE_DEFAULT = 0x0 + IPV6_PORTRANGE_HIGH = 0x1 + IPV6_PORTRANGE_LOW = 0x2 + IPV6_RECVDSTOPTS = 0x28 + IPV6_RECVHOPLIMIT = 0x25 + IPV6_RECVHOPOPTS = 0x27 + IPV6_RECVPATHMTU = 0x2b + IPV6_RECVPKTINFO = 0x24 + IPV6_RECVRTHDR = 0x26 + IPV6_RECVTCLASS = 0x39 + IPV6_RTHDR = 0x33 + IPV6_RTHDRDSTOPTS = 0x23 + IPV6_RTHDR_LOOSE = 0x0 + IPV6_RTHDR_STRICT = 0x1 + IPV6_RTHDR_TYPE_0 = 0x0 + IPV6_SOCKOPT_RESERVED1 = 0x3 + IPV6_TCLASS = 0x3d + IPV6_UNICAST_HOPS = 0x4 + IPV6_USE_MIN_MTU = 0x2a + IPV6_V6ONLY = 0x1b + IPV6_VERSION = 0x60 + IPV6_VERSION_MASK = 0xf0 + IP_ADD_MEMBERSHIP = 0xc + IP_DEFAULT_MULTICAST_LOOP = 0x1 + IP_DEFAULT_MULTICAST_TTL = 0x1 + IP_DF = 0x4000 + IP_DROP_MEMBERSHIP = 0xd + IP_EF = 0x8000 + IP_ERRORMTU = 0x15 + IP_HDRINCL = 0x2 + IP_IPSEC_POLICY = 0x16 + IP_MAXPACKET = 0xffff + IP_MAX_MEMBERSHIPS = 0x14 + IP_MF = 0x2000 + IP_MINFRAGSIZE = 0x45 + IP_MINTTL = 0x18 + IP_MSS = 0x240 + IP_MULTICAST_IF = 0x9 + IP_MULTICAST_LOOP = 0xb + IP_MULTICAST_TTL = 0xa + IP_OFFMASK = 0x1fff + IP_OPTIONS = 0x1 + IP_PORTRANGE = 0x13 + IP_PORTRANGE_DEFAULT = 0x0 + IP_PORTRANGE_HIGH = 0x1 + IP_PORTRANGE_LOW = 0x2 + IP_RECVDSTADDR = 0x7 + IP_RECVIF = 0x14 + IP_RECVOPTS = 0x5 + IP_RECVRETOPTS = 0x6 + IP_RECVTTL = 0x17 + IP_RETOPTS = 0x8 + IP_RF = 0x8000 + IP_TOS = 0x3 + IP_TTL = 0x4 + ISIG = 0x80 + ISTRIP = 0x20 + IXANY = 0x800 + IXOFF = 0x400 + IXON = 0x200 + KERN_HOSTNAME = 0xa + KERN_OSRELEASE = 0x2 + KERN_OSTYPE = 0x1 + KERN_VERSION = 0x4 + LOCK_EX = 0x2 + LOCK_NB = 0x4 + LOCK_SH = 0x1 + LOCK_UN = 0x8 + MADV_DONTNEED = 0x4 + MADV_FREE = 0x6 + MADV_NORMAL = 0x0 + MADV_RANDOM = 0x1 + MADV_SEQUENTIAL = 0x2 + MADV_SPACEAVAIL = 0x5 + MADV_WILLNEED = 0x3 + MAP_ALIGNMENT_16MB = 0x18000000 + MAP_ALIGNMENT_1TB = 0x28000000 + MAP_ALIGNMENT_256TB = 0x30000000 + MAP_ALIGNMENT_4GB = 0x20000000 + MAP_ALIGNMENT_64KB = 0x10000000 + MAP_ALIGNMENT_64PB = 0x38000000 + MAP_ALIGNMENT_MASK = -0x1000000 + MAP_ALIGNMENT_SHIFT = 0x18 + MAP_ANON = 0x1000 + MAP_FILE = 0x0 + MAP_FIXED = 0x10 + MAP_HASSEMAPHORE = 0x200 + MAP_INHERIT = 0x80 + MAP_INHERIT_COPY = 0x1 + MAP_INHERIT_DEFAULT = 0x1 + MAP_INHERIT_DONATE_COPY = 0x3 + MAP_INHERIT_NONE = 0x2 + MAP_INHERIT_SHARE = 0x0 + MAP_NORESERVE = 0x40 + MAP_PRIVATE = 0x2 + MAP_RENAME = 0x20 + MAP_SHARED = 0x1 + MAP_STACK = 0x2000 + MAP_TRYFIXED = 0x400 + MAP_WIRED = 0x800 + MCL_CURRENT = 0x1 + MCL_FUTURE = 0x2 + MNT_ASYNC = 0x40 + MNT_BASIC_FLAGS = 0xe782807f + MNT_DEFEXPORTED = 0x200 + MNT_DISCARD = 0x800000 + MNT_EXKERB = 0x800 + MNT_EXNORESPORT = 0x8000000 + MNT_EXPORTANON = 0x400 + MNT_EXPORTED = 0x100 + MNT_EXPUBLIC = 0x10000000 + MNT_EXRDONLY = 0x80 + MNT_EXTATTR = 0x1000000 + MNT_FORCE = 0x80000 + MNT_GETARGS = 0x400000 + MNT_IGNORE = 0x100000 + MNT_LAZY = 0x3 + MNT_LOCAL = 0x1000 + MNT_LOG = 0x2000000 + MNT_NOATIME = 0x4000000 + MNT_NOCOREDUMP = 0x8000 + MNT_NODEV = 0x10 + MNT_NODEVMTIME = 0x40000000 + MNT_NOEXEC = 0x4 + MNT_NOSUID = 0x8 + MNT_NOWAIT = 0x2 + MNT_OP_FLAGS = 0x4d0000 + MNT_QUOTA = 0x2000 + MNT_RDONLY = 0x1 + MNT_RELATIME = 0x20000 + MNT_RELOAD = 0x40000 + MNT_ROOTFS = 0x4000 + MNT_SOFTDEP = 0x80000000 + MNT_SYMPERM = 0x20000000 + MNT_SYNCHRONOUS = 0x2 + MNT_UNION = 0x20 + MNT_UPDATE = 0x10000 + MNT_VISFLAGMASK = 0xff90ffff + MNT_WAIT = 0x1 + MSG_BCAST = 0x100 + MSG_CMSG_CLOEXEC = 0x800 + MSG_CONTROLMBUF = 0x2000000 + MSG_CTRUNC = 0x20 + MSG_DONTROUTE = 0x4 + MSG_DONTWAIT = 0x80 + MSG_EOR = 0x8 + MSG_IOVUSRSPACE = 0x4000000 + MSG_LENUSRSPACE = 0x8000000 + MSG_MCAST = 0x200 + MSG_NAMEMBUF = 0x1000000 + MSG_NBIO = 0x1000 + MSG_NOSIGNAL = 0x400 + MSG_OOB = 0x1 + MSG_PEEK = 0x2 + MSG_TRUNC = 0x10 + MSG_USERFLAGS = 0xffffff + MSG_WAITALL = 0x40 + MS_ASYNC = 0x1 + MS_INVALIDATE = 0x2 + MS_SYNC = 0x4 + NAME_MAX = 0x1ff + NET_RT_DUMP = 0x1 + NET_RT_FLAGS = 0x2 + NET_RT_IFLIST = 0x5 + NET_RT_MAXID = 0x6 + NET_RT_OIFLIST = 0x4 + NET_RT_OOIFLIST = 0x3 + NOFLSH = 0x80000000 + NOTE_ATTRIB = 0x8 + NOTE_CHILD = 0x4 + NOTE_DELETE = 0x1 + NOTE_EXEC = 0x20000000 + NOTE_EXIT = 0x80000000 + NOTE_EXTEND = 0x4 + NOTE_FORK = 0x40000000 + NOTE_LINK = 0x10 + NOTE_LOWAT = 0x1 + NOTE_PCTRLMASK = 0xf0000000 + NOTE_PDATAMASK = 0xfffff + NOTE_RENAME = 0x20 + NOTE_REVOKE = 0x40 + NOTE_TRACK = 0x1 + NOTE_TRACKERR = 0x2 + NOTE_WRITE = 0x2 + OCRNL = 0x10 + OFIOGETBMAP = 0xc004667a + ONLCR = 0x2 + ONLRET = 0x40 + ONOCR = 0x20 + ONOEOT = 0x8 + OPOST = 0x1 + O_ACCMODE = 0x3 + O_ALT_IO = 0x40000 + O_APPEND = 0x8 + O_ASYNC = 0x40 + O_CLOEXEC = 0x400000 + O_CREAT = 0x200 + O_DIRECT = 0x80000 + O_DIRECTORY = 0x200000 + O_DSYNC = 0x10000 + O_EXCL = 0x800 + O_EXLOCK = 0x20 + O_FSYNC = 0x80 + O_NDELAY = 0x4 + O_NOCTTY = 0x8000 + O_NOFOLLOW = 0x100 + O_NONBLOCK = 0x4 + O_NOSIGPIPE = 0x1000000 + O_RDONLY = 0x0 + O_RDWR = 0x2 + O_RSYNC = 0x20000 + O_SHLOCK = 0x10 + O_SYNC = 0x80 + O_TRUNC = 0x400 + O_WRONLY = 0x1 + PARENB = 0x1000 + PARMRK = 0x8 + PARODD = 0x2000 + PENDIN = 0x20000000 + PRIO_PGRP = 0x1 + PRIO_PROCESS = 0x0 + PRIO_USER = 0x2 + PRI_IOFLUSH = 0x7c + PROT_EXEC = 0x4 + PROT_NONE = 0x0 + PROT_READ = 0x1 + PROT_WRITE = 0x2 + RLIMIT_AS = 0xa + RLIMIT_CORE = 0x4 + RLIMIT_CPU = 0x0 + RLIMIT_DATA = 0x2 + RLIMIT_FSIZE = 0x1 + RLIMIT_MEMLOCK = 0x6 + RLIMIT_NOFILE = 0x8 + RLIMIT_NPROC = 0x7 + RLIMIT_RSS = 0x5 + RLIMIT_STACK = 0x3 + RLIM_INFINITY = 0x7fffffffffffffff + RTAX_AUTHOR = 0x6 + RTAX_BRD = 0x7 + RTAX_DST = 0x0 + RTAX_GATEWAY = 0x1 + RTAX_GENMASK = 0x3 + RTAX_IFA = 0x5 + RTAX_IFP = 0x4 + RTAX_MAX = 0x9 + RTAX_NETMASK = 0x2 + RTAX_TAG = 0x8 + RTA_AUTHOR = 0x40 + RTA_BRD = 0x80 + RTA_DST = 0x1 + RTA_GATEWAY = 0x2 + RTA_GENMASK = 0x8 + RTA_IFA = 0x20 + RTA_IFP = 0x10 + RTA_NETMASK = 0x4 + RTA_TAG = 0x100 + RTF_ANNOUNCE = 0x20000 + RTF_BLACKHOLE = 0x1000 + RTF_CLONED = 0x2000 + RTF_CLONING = 0x100 + RTF_DONE = 0x40 + RTF_DYNAMIC = 0x10 + RTF_GATEWAY = 0x2 + RTF_HOST = 0x4 + RTF_LLINFO = 0x400 + RTF_MASK = 0x80 + RTF_MODIFIED = 0x20 + RTF_PROTO1 = 0x8000 + RTF_PROTO2 = 0x4000 + RTF_REJECT = 0x8 + RTF_SRC = 0x10000 + RTF_STATIC = 0x800 + RTF_UP = 0x1 + RTF_XRESOLVE = 0x200 + RTM_ADD = 0x1 + RTM_CHANGE = 0x3 + RTM_CHGADDR = 0x15 + RTM_DELADDR = 0xd + RTM_DELETE = 0x2 + RTM_GET = 0x4 + RTM_IEEE80211 = 0x11 + RTM_IFANNOUNCE = 0x10 + RTM_IFINFO = 0x14 + RTM_LLINFO_UPD = 0x13 + RTM_LOCK = 0x8 + RTM_LOSING = 0x5 + RTM_MISS = 0x7 + RTM_NEWADDR = 0xc + RTM_OIFINFO = 0xf + RTM_OLDADD = 0x9 + RTM_OLDDEL = 0xa + RTM_OOIFINFO = 0xe + RTM_REDIRECT = 0x6 + RTM_RESOLVE = 0xb + RTM_RTTUNIT = 0xf4240 + RTM_SETGATE = 0x12 + RTM_VERSION = 0x4 + RTV_EXPIRE = 0x4 + RTV_HOPCOUNT = 0x2 + RTV_MTU = 0x1 + RTV_RPIPE = 0x8 + RTV_RTT = 0x40 + RTV_RTTVAR = 0x80 + RTV_SPIPE = 0x10 + RTV_SSTHRESH = 0x20 + RUSAGE_CHILDREN = -0x1 + RUSAGE_SELF = 0x0 + SCM_CREDS = 0x4 + SCM_RIGHTS = 0x1 + SCM_TIMESTAMP = 0x8 + SHUT_RD = 0x0 + SHUT_RDWR = 0x2 + SHUT_WR = 0x1 + SIOCADDMULTI = 0x80906931 + SIOCADDRT = 0x8038720a + SIOCAIFADDR = 0x8040691a + SIOCALIFADDR = 0x8118691c + SIOCATMARK = 0x40047307 + SIOCDELMULTI = 0x80906932 + SIOCDELRT = 0x8038720b + SIOCDIFADDR = 0x80906919 + SIOCDIFPHYADDR = 0x80906949 + SIOCDLIFADDR = 0x8118691e + SIOCGDRVSPEC = 0xc028697b + SIOCGETPFSYNC = 0xc09069f8 + SIOCGETSGCNT = 0xc0207534 + SIOCGETVIFCNT = 0xc0287533 + SIOCGHIWAT = 0x40047301 + SIOCGIFADDR = 0xc0906921 + SIOCGIFADDRPREF = 0xc0986920 + SIOCGIFALIAS = 0xc040691b + SIOCGIFBRDADDR = 0xc0906923 + SIOCGIFCAP = 0xc0206976 + SIOCGIFCONF = 0xc0106926 + SIOCGIFDATA = 0xc0986985 + SIOCGIFDLT = 0xc0906977 + SIOCGIFDSTADDR = 0xc0906922 + SIOCGIFFLAGS = 0xc0906911 + SIOCGIFGENERIC = 0xc090693a + SIOCGIFMEDIA = 0xc0306936 + SIOCGIFMETRIC = 0xc0906917 + SIOCGIFMTU = 0xc090697e + SIOCGIFNETMASK = 0xc0906925 + SIOCGIFPDSTADDR = 0xc0906948 + SIOCGIFPSRCADDR = 0xc0906947 + SIOCGLIFADDR = 0xc118691d + SIOCGLIFPHYADDR = 0xc118694b + SIOCGLINKSTR = 0xc0286987 + SIOCGLOWAT = 0x40047303 + SIOCGPGRP = 0x40047309 + SIOCGVH = 0xc0906983 + SIOCIFCREATE = 0x8090697a + SIOCIFDESTROY = 0x80906979 + SIOCIFGCLONERS = 0xc0106978 + SIOCINITIFADDR = 0xc0706984 + SIOCSDRVSPEC = 0x8028697b + SIOCSETPFSYNC = 0x809069f7 + SIOCSHIWAT = 0x80047300 + SIOCSIFADDR = 0x8090690c + SIOCSIFADDRPREF = 0x8098691f + SIOCSIFBRDADDR = 0x80906913 + SIOCSIFCAP = 0x80206975 + SIOCSIFDSTADDR = 0x8090690e + SIOCSIFFLAGS = 0x80906910 + SIOCSIFGENERIC = 0x80906939 + SIOCSIFMEDIA = 0xc0906935 + SIOCSIFMETRIC = 0x80906918 + SIOCSIFMTU = 0x8090697f + SIOCSIFNETMASK = 0x80906916 + SIOCSIFPHYADDR = 0x80406946 + SIOCSLIFPHYADDR = 0x8118694a + SIOCSLINKSTR = 0x80286988 + SIOCSLOWAT = 0x80047302 + SIOCSPGRP = 0x80047308 + SIOCSVH = 0xc0906982 + SIOCZIFDATA = 0xc0986986 + SOCK_CLOEXEC = 0x10000000 + SOCK_DGRAM = 0x2 + SOCK_FLAGS_MASK = 0xf0000000 + SOCK_NONBLOCK = 0x20000000 + SOCK_NOSIGPIPE = 0x40000000 + SOCK_RAW = 0x3 + SOCK_RDM = 0x4 + SOCK_SEQPACKET = 0x5 + SOCK_STREAM = 0x1 + SOL_SOCKET = 0xffff + SOMAXCONN = 0x80 + SO_ACCEPTCONN = 0x2 + SO_ACCEPTFILTER = 0x1000 + SO_BROADCAST = 0x20 + SO_DEBUG = 0x1 + SO_DONTROUTE = 0x10 + SO_ERROR = 0x1007 + SO_KEEPALIVE = 0x8 + SO_LINGER = 0x80 + SO_NOHEADER = 0x100a + SO_NOSIGPIPE = 0x800 + SO_OOBINLINE = 0x100 + SO_OVERFLOWED = 0x1009 + SO_RCVBUF = 0x1002 + SO_RCVLOWAT = 0x1004 + SO_RCVTIMEO = 0x100c + SO_REUSEADDR = 0x4 + SO_REUSEPORT = 0x200 + SO_SNDBUF = 0x1001 + SO_SNDLOWAT = 0x1003 + SO_SNDTIMEO = 0x100b + SO_TIMESTAMP = 0x2000 + SO_TYPE = 0x1008 + SO_USELOOPBACK = 0x40 + SYSCTL_VERSION = 0x1000000 + SYSCTL_VERS_0 = 0x0 + SYSCTL_VERS_1 = 0x1000000 + SYSCTL_VERS_MASK = 0xff000000 + S_ARCH1 = 0x10000 + S_ARCH2 = 0x20000 + S_BLKSIZE = 0x200 + S_IEXEC = 0x40 + S_IFBLK = 0x6000 + S_IFCHR = 0x2000 + S_IFDIR = 0x4000 + S_IFIFO = 0x1000 + S_IFLNK = 0xa000 + S_IFMT = 0xf000 + S_IFREG = 0x8000 + S_IFSOCK = 0xc000 + S_IFWHT = 0xe000 + S_IREAD = 0x100 + S_IRGRP = 0x20 + S_IROTH = 0x4 + S_IRUSR = 0x100 + S_IRWXG = 0x38 + S_IRWXO = 0x7 + S_IRWXU = 0x1c0 + S_ISGID = 0x400 + S_ISTXT = 0x200 + S_ISUID = 0x800 + S_ISVTX = 0x200 + S_IWGRP = 0x10 + S_IWOTH = 0x2 + S_IWRITE = 0x80 + S_IWUSR = 0x80 + S_IXGRP = 0x8 + S_IXOTH = 0x1 + S_IXUSR = 0x40 + S_LOGIN_SET = 0x1 + TCIFLUSH = 0x1 + TCIOFLUSH = 0x3 + TCOFLUSH = 0x2 + TCP_CONGCTL = 0x20 + TCP_KEEPCNT = 0x6 + TCP_KEEPIDLE = 0x3 + TCP_KEEPINIT = 0x7 + TCP_KEEPINTVL = 0x5 + TCP_MAXBURST = 0x4 + TCP_MAXSEG = 0x2 + TCP_MAXWIN = 0xffff + TCP_MAX_WINSHIFT = 0xe + TCP_MD5SIG = 0x10 + TCP_MINMSS = 0xd8 + TCP_MSS = 0x218 + TCP_NODELAY = 0x1 + TCSAFLUSH = 0x2 + TIOCCBRK = 0x2000747a + TIOCCDTR = 0x20007478 + TIOCCONS = 0x80047462 + TIOCDCDTIMESTAMP = 0x40107458 + TIOCDRAIN = 0x2000745e + TIOCEXCL = 0x2000740d + TIOCEXT = 0x80047460 + TIOCFLAG_CDTRCTS = 0x10 + TIOCFLAG_CLOCAL = 0x2 + TIOCFLAG_CRTSCTS = 0x4 + TIOCFLAG_MDMBUF = 0x8 + TIOCFLAG_SOFTCAR = 0x1 + TIOCFLUSH = 0x80047410 + TIOCGETA = 0x402c7413 + TIOCGETD = 0x4004741a + TIOCGFLAGS = 0x4004745d + TIOCGLINED = 0x40207442 + TIOCGPGRP = 0x40047477 + TIOCGQSIZE = 0x40047481 + TIOCGRANTPT = 0x20007447 + TIOCGSID = 0x40047463 + TIOCGSIZE = 0x40087468 + TIOCGWINSZ = 0x40087468 + TIOCMBIC = 0x8004746b + TIOCMBIS = 0x8004746c + TIOCMGET = 0x4004746a + TIOCMSET = 0x8004746d + TIOCM_CAR = 0x40 + TIOCM_CD = 0x40 + TIOCM_CTS = 0x20 + TIOCM_DSR = 0x100 + TIOCM_DTR = 0x2 + TIOCM_LE = 0x1 + TIOCM_RI = 0x80 + TIOCM_RNG = 0x80 + TIOCM_RTS = 0x4 + TIOCM_SR = 0x10 + TIOCM_ST = 0x8 + TIOCNOTTY = 0x20007471 + TIOCNXCL = 0x2000740e + TIOCOUTQ = 0x40047473 + TIOCPKT = 0x80047470 + TIOCPKT_DATA = 0x0 + TIOCPKT_DOSTOP = 0x20 + TIOCPKT_FLUSHREAD = 0x1 + TIOCPKT_FLUSHWRITE = 0x2 + TIOCPKT_IOCTL = 0x40 + TIOCPKT_NOSTOP = 0x10 + TIOCPKT_START = 0x8 + TIOCPKT_STOP = 0x4 + TIOCPTMGET = 0x40287446 + TIOCPTSNAME = 0x40287448 + TIOCRCVFRAME = 0x80087445 + TIOCREMOTE = 0x80047469 + TIOCSBRK = 0x2000747b + TIOCSCTTY = 0x20007461 + TIOCSDTR = 0x20007479 + TIOCSETA = 0x802c7414 + TIOCSETAF = 0x802c7416 + TIOCSETAW = 0x802c7415 + TIOCSETD = 0x8004741b + TIOCSFLAGS = 0x8004745c + TIOCSIG = 0x2000745f + TIOCSLINED = 0x80207443 + TIOCSPGRP = 0x80047476 + TIOCSQSIZE = 0x80047480 + TIOCSSIZE = 0x80087467 + TIOCSTART = 0x2000746e + TIOCSTAT = 0x80047465 + TIOCSTI = 0x80017472 + TIOCSTOP = 0x2000746f + TIOCSWINSZ = 0x80087467 + TIOCUCNTL = 0x80047466 + TIOCXMTFRAME = 0x80087444 + TOSTOP = 0x400000 + VDISCARD = 0xf + VDSUSP = 0xb + VEOF = 0x0 + VEOL = 0x1 + VEOL2 = 0x2 + VERASE = 0x3 + VINTR = 0x8 + VKILL = 0x5 + VLNEXT = 0xe + VMIN = 0x10 + VQUIT = 0x9 + VREPRINT = 0x6 + VSTART = 0xc + VSTATUS = 0x12 + VSTOP = 0xd + VSUSP = 0xa + VTIME = 0x11 + VWERASE = 0x4 + WALL = 0x8 + WALLSIG = 0x8 + WALTSIG = 0x4 + WCLONE = 0x4 + WCOREFLAG = 0x80 + WNOHANG = 0x1 + WNOWAIT = 0x10000 + WNOZOMBIE = 0x20000 + WOPTSCHECKED = 0x40000 + WSTOPPED = 0x7f + WUNTRACED = 0x2 +) + +// Errors +const ( + E2BIG = syscall.Errno(0x7) + EACCES = syscall.Errno(0xd) + EADDRINUSE = syscall.Errno(0x30) + EADDRNOTAVAIL = syscall.Errno(0x31) + EAFNOSUPPORT = syscall.Errno(0x2f) + EAGAIN = syscall.Errno(0x23) + EALREADY = syscall.Errno(0x25) + EAUTH = syscall.Errno(0x50) + EBADF = syscall.Errno(0x9) + EBADMSG = syscall.Errno(0x58) + EBADRPC = syscall.Errno(0x48) + EBUSY = syscall.Errno(0x10) + ECANCELED = syscall.Errno(0x57) + ECHILD = syscall.Errno(0xa) + ECONNABORTED = syscall.Errno(0x35) + ECONNREFUSED = syscall.Errno(0x3d) + ECONNRESET = syscall.Errno(0x36) + EDEADLK = syscall.Errno(0xb) + EDESTADDRREQ = syscall.Errno(0x27) + EDOM = syscall.Errno(0x21) + EDQUOT = syscall.Errno(0x45) + EEXIST = syscall.Errno(0x11) + EFAULT = syscall.Errno(0xe) + EFBIG = syscall.Errno(0x1b) + EFTYPE = syscall.Errno(0x4f) + EHOSTDOWN = syscall.Errno(0x40) + EHOSTUNREACH = syscall.Errno(0x41) + EIDRM = syscall.Errno(0x52) + EILSEQ = syscall.Errno(0x55) + EINPROGRESS = syscall.Errno(0x24) + EINTR = syscall.Errno(0x4) + EINVAL = syscall.Errno(0x16) + EIO = syscall.Errno(0x5) + EISCONN = syscall.Errno(0x38) + EISDIR = syscall.Errno(0x15) + ELAST = syscall.Errno(0x60) + ELOOP = syscall.Errno(0x3e) + EMFILE = syscall.Errno(0x18) + EMLINK = syscall.Errno(0x1f) + EMSGSIZE = syscall.Errno(0x28) + EMULTIHOP = syscall.Errno(0x5e) + ENAMETOOLONG = syscall.Errno(0x3f) + ENEEDAUTH = syscall.Errno(0x51) + ENETDOWN = syscall.Errno(0x32) + ENETRESET = syscall.Errno(0x34) + ENETUNREACH = syscall.Errno(0x33) + ENFILE = syscall.Errno(0x17) + ENOATTR = syscall.Errno(0x5d) + ENOBUFS = syscall.Errno(0x37) + ENODATA = syscall.Errno(0x59) + ENODEV = syscall.Errno(0x13) + ENOENT = syscall.Errno(0x2) + ENOEXEC = syscall.Errno(0x8) + ENOLCK = syscall.Errno(0x4d) + ENOLINK = syscall.Errno(0x5f) + ENOMEM = syscall.Errno(0xc) + ENOMSG = syscall.Errno(0x53) + ENOPROTOOPT = syscall.Errno(0x2a) + ENOSPC = syscall.Errno(0x1c) + ENOSR = syscall.Errno(0x5a) + ENOSTR = syscall.Errno(0x5b) + ENOSYS = syscall.Errno(0x4e) + ENOTBLK = syscall.Errno(0xf) + ENOTCONN = syscall.Errno(0x39) + ENOTDIR = syscall.Errno(0x14) + ENOTEMPTY = syscall.Errno(0x42) + ENOTSOCK = syscall.Errno(0x26) + ENOTSUP = syscall.Errno(0x56) + ENOTTY = syscall.Errno(0x19) + ENXIO = syscall.Errno(0x6) + EOPNOTSUPP = syscall.Errno(0x2d) + EOVERFLOW = syscall.Errno(0x54) + EPERM = syscall.Errno(0x1) + EPFNOSUPPORT = syscall.Errno(0x2e) + EPIPE = syscall.Errno(0x20) + EPROCLIM = syscall.Errno(0x43) + EPROCUNAVAIL = syscall.Errno(0x4c) + EPROGMISMATCH = syscall.Errno(0x4b) + EPROGUNAVAIL = syscall.Errno(0x4a) + EPROTO = syscall.Errno(0x60) + EPROTONOSUPPORT = syscall.Errno(0x2b) + EPROTOTYPE = syscall.Errno(0x29) + ERANGE = syscall.Errno(0x22) + EREMOTE = syscall.Errno(0x47) + EROFS = syscall.Errno(0x1e) + ERPCMISMATCH = syscall.Errno(0x49) + ESHUTDOWN = syscall.Errno(0x3a) + ESOCKTNOSUPPORT = syscall.Errno(0x2c) + ESPIPE = syscall.Errno(0x1d) + ESRCH = syscall.Errno(0x3) + ESTALE = syscall.Errno(0x46) + ETIME = syscall.Errno(0x5c) + ETIMEDOUT = syscall.Errno(0x3c) + ETOOMANYREFS = syscall.Errno(0x3b) + ETXTBSY = syscall.Errno(0x1a) + EUSERS = syscall.Errno(0x44) + EWOULDBLOCK = syscall.Errno(0x23) + EXDEV = syscall.Errno(0x12) +) + +// Signals +const ( + SIGABRT = syscall.Signal(0x6) + SIGALRM = syscall.Signal(0xe) + SIGBUS = syscall.Signal(0xa) + SIGCHLD = syscall.Signal(0x14) + SIGCONT = syscall.Signal(0x13) + SIGEMT = syscall.Signal(0x7) + SIGFPE = syscall.Signal(0x8) + SIGHUP = syscall.Signal(0x1) + SIGILL = syscall.Signal(0x4) + SIGINFO = syscall.Signal(0x1d) + SIGINT = syscall.Signal(0x2) + SIGIO = syscall.Signal(0x17) + SIGIOT = syscall.Signal(0x6) + SIGKILL = syscall.Signal(0x9) + SIGPIPE = syscall.Signal(0xd) + SIGPROF = syscall.Signal(0x1b) + SIGPWR = syscall.Signal(0x20) + SIGQUIT = syscall.Signal(0x3) + SIGSEGV = syscall.Signal(0xb) + SIGSTOP = syscall.Signal(0x11) + SIGSYS = syscall.Signal(0xc) + SIGTERM = syscall.Signal(0xf) + SIGTRAP = syscall.Signal(0x5) + SIGTSTP = syscall.Signal(0x12) + SIGTTIN = syscall.Signal(0x15) + SIGTTOU = syscall.Signal(0x16) + SIGURG = syscall.Signal(0x10) + SIGUSR1 = syscall.Signal(0x1e) + SIGUSR2 = syscall.Signal(0x1f) + SIGVTALRM = syscall.Signal(0x1a) + SIGWINCH = syscall.Signal(0x1c) + SIGXCPU = syscall.Signal(0x18) + SIGXFSZ = syscall.Signal(0x19) +) + +// Error table +var errorList = [...]struct { + num syscall.Errno + name string + desc string +}{ + {1, "EPERM", "operation not permitted"}, + {2, "ENOENT", "no such file or directory"}, + {3, "ESRCH", "no such process"}, + {4, "EINTR", "interrupted system call"}, + {5, "EIO", "input/output error"}, + {6, "ENXIO", "device not configured"}, + {7, "E2BIG", "argument list too long"}, + {8, "ENOEXEC", "exec format error"}, + {9, "EBADF", "bad file descriptor"}, + {10, "ECHILD", "no child processes"}, + {11, "EDEADLK", "resource deadlock avoided"}, + {12, "ENOMEM", "cannot allocate memory"}, + {13, "EACCES", "permission denied"}, + {14, "EFAULT", "bad address"}, + {15, "ENOTBLK", "block device required"}, + {16, "EBUSY", "device busy"}, + {17, "EEXIST", "file exists"}, + {18, "EXDEV", "cross-device link"}, + {19, "ENODEV", "operation not supported by device"}, + {20, "ENOTDIR", "not a directory"}, + {21, "EISDIR", "is a directory"}, + {22, "EINVAL", "invalid argument"}, + {23, "ENFILE", "too many open files in system"}, + {24, "EMFILE", "too many open files"}, + {25, "ENOTTY", "inappropriate ioctl for device"}, + {26, "ETXTBSY", "text file busy"}, + {27, "EFBIG", "file too large"}, + {28, "ENOSPC", "no space left on device"}, + {29, "ESPIPE", "illegal seek"}, + {30, "EROFS", "read-only file system"}, + {31, "EMLINK", "too many links"}, + {32, "EPIPE", "broken pipe"}, + {33, "EDOM", "numerical argument out of domain"}, + {34, "ERANGE", "result too large or too small"}, + {35, "EAGAIN", "resource temporarily unavailable"}, + {36, "EINPROGRESS", "operation now in progress"}, + {37, "EALREADY", "operation already in progress"}, + {38, "ENOTSOCK", "socket operation on non-socket"}, + {39, "EDESTADDRREQ", "destination address required"}, + {40, "EMSGSIZE", "message too long"}, + {41, "EPROTOTYPE", "protocol wrong type for socket"}, + {42, "ENOPROTOOPT", "protocol option not available"}, + {43, "EPROTONOSUPPORT", "protocol not supported"}, + {44, "ESOCKTNOSUPPORT", "socket type not supported"}, + {45, "EOPNOTSUPP", "operation not supported"}, + {46, "EPFNOSUPPORT", "protocol family not supported"}, + {47, "EAFNOSUPPORT", "address family not supported by protocol family"}, + {48, "EADDRINUSE", "address already in use"}, + {49, "EADDRNOTAVAIL", "can't assign requested address"}, + {50, "ENETDOWN", "network is down"}, + {51, "ENETUNREACH", "network is unreachable"}, + {52, "ENETRESET", "network dropped connection on reset"}, + {53, "ECONNABORTED", "software caused connection abort"}, + {54, "ECONNRESET", "connection reset by peer"}, + {55, "ENOBUFS", "no buffer space available"}, + {56, "EISCONN", "socket is already connected"}, + {57, "ENOTCONN", "socket is not connected"}, + {58, "ESHUTDOWN", "can't send after socket shutdown"}, + {59, "ETOOMANYREFS", "too many references: can't splice"}, + {60, "ETIMEDOUT", "connection timed out"}, + {61, "ECONNREFUSED", "connection refused"}, + {62, "ELOOP", "too many levels of symbolic links"}, + {63, "ENAMETOOLONG", "file name too long"}, + {64, "EHOSTDOWN", "host is down"}, + {65, "EHOSTUNREACH", "no route to host"}, + {66, "ENOTEMPTY", "directory not empty"}, + {67, "EPROCLIM", "too many processes"}, + {68, "EUSERS", "too many users"}, + {69, "EDQUOT", "disc quota exceeded"}, + {70, "ESTALE", "stale NFS file handle"}, + {71, "EREMOTE", "too many levels of remote in path"}, + {72, "EBADRPC", "RPC struct is bad"}, + {73, "ERPCMISMATCH", "RPC version wrong"}, + {74, "EPROGUNAVAIL", "RPC prog. not avail"}, + {75, "EPROGMISMATCH", "program version wrong"}, + {76, "EPROCUNAVAIL", "bad procedure for program"}, + {77, "ENOLCK", "no locks available"}, + {78, "ENOSYS", "function not implemented"}, + {79, "EFTYPE", "inappropriate file type or format"}, + {80, "EAUTH", "authentication error"}, + {81, "ENEEDAUTH", "need authenticator"}, + {82, "EIDRM", "identifier removed"}, + {83, "ENOMSG", "no message of desired type"}, + {84, "EOVERFLOW", "value too large to be stored in data type"}, + {85, "EILSEQ", "illegal byte sequence"}, + {86, "ENOTSUP", "not supported"}, + {87, "ECANCELED", "operation Canceled"}, + {88, "EBADMSG", "bad or Corrupt message"}, + {89, "ENODATA", "no message available"}, + {90, "ENOSR", "no STREAM resources"}, + {91, "ENOSTR", "not a STREAM"}, + {92, "ETIME", "STREAM ioctl timeout"}, + {93, "ENOATTR", "attribute not found"}, + {94, "EMULTIHOP", "multihop attempted"}, + {95, "ENOLINK", "link has been severed"}, + {96, "ELAST", "protocol error"}, +} + +// Signal table +var signalList = [...]struct { + num syscall.Signal + name string + desc string +}{ + {1, "SIGHUP", "hangup"}, + {2, "SIGINT", "interrupt"}, + {3, "SIGQUIT", "quit"}, + {4, "SIGILL", "illegal instruction"}, + {5, "SIGTRAP", "trace/BPT trap"}, + {6, "SIGIOT", "abort trap"}, + {7, "SIGEMT", "EMT trap"}, + {8, "SIGFPE", "floating point exception"}, + {9, "SIGKILL", "killed"}, + {10, "SIGBUS", "bus error"}, + {11, "SIGSEGV", "segmentation fault"}, + {12, "SIGSYS", "bad system call"}, + {13, "SIGPIPE", "broken pipe"}, + {14, "SIGALRM", "alarm clock"}, + {15, "SIGTERM", "terminated"}, + {16, "SIGURG", "urgent I/O condition"}, + {17, "SIGSTOP", "stopped (signal)"}, + {18, "SIGTSTP", "stopped"}, + {19, "SIGCONT", "continued"}, + {20, "SIGCHLD", "child exited"}, + {21, "SIGTTIN", "stopped (tty input)"}, + {22, "SIGTTOU", "stopped (tty output)"}, + {23, "SIGIO", "I/O possible"}, + {24, "SIGXCPU", "cputime limit exceeded"}, + {25, "SIGXFSZ", "filesize limit exceeded"}, + {26, "SIGVTALRM", "virtual timer expired"}, + {27, "SIGPROF", "profiling timer expired"}, + {28, "SIGWINCH", "window size changes"}, + {29, "SIGINFO", "information request"}, + {30, "SIGUSR1", "user defined signal 1"}, + {31, "SIGUSR2", "user defined signal 2"}, + {32, "SIGPWR", "power fail/restart"}, +} diff --git a/src/cmd/vendor/golang.org/x/sys/unix/zsyscall_aix_ppc.go b/src/cmd/vendor/golang.org/x/sys/unix/zsyscall_aix_ppc.go index 6bae21e5d8..79f6e0566e 100644 --- a/src/cmd/vendor/golang.org/x/sys/unix/zsyscall_aix_ppc.go +++ b/src/cmd/vendor/golang.org/x/sys/unix/zsyscall_aix_ppc.go @@ -1,4 +1,4 @@ -// mksyscall_aix_ppc.pl -aix -tags aix,ppc syscall_aix.go syscall_aix_ppc.go +// go run mksyscall_aix_ppc.go -aix -tags aix,ppc syscall_aix.go syscall_aix_ppc.go // Code generated by the command above; see README.md. DO NOT EDIT. // +build aix,ppc diff --git a/src/cmd/vendor/golang.org/x/sys/unix/zsyscall_aix_ppc64.go b/src/cmd/vendor/golang.org/x/sys/unix/zsyscall_aix_ppc64.go index 3e929e520e..e645a05cbe 100644 --- a/src/cmd/vendor/golang.org/x/sys/unix/zsyscall_aix_ppc64.go +++ b/src/cmd/vendor/golang.org/x/sys/unix/zsyscall_aix_ppc64.go @@ -1,4 +1,4 @@ -// mksyscall_aix_ppc64.pl -aix -tags aix,ppc64 syscall_aix.go syscall_aix_ppc64.go +// go run mksyscall_aix_ppc64.go -aix -tags aix,ppc64 syscall_aix.go syscall_aix_ppc64.go // Code generated by the command above; see README.md. DO NOT EDIT. // +build aix,ppc64 diff --git a/src/cmd/vendor/golang.org/x/sys/unix/zsyscall_aix_ppc64_gc.go b/src/cmd/vendor/golang.org/x/sys/unix/zsyscall_aix_ppc64_gc.go index a185ee8424..0b8eb72102 100644 --- a/src/cmd/vendor/golang.org/x/sys/unix/zsyscall_aix_ppc64_gc.go +++ b/src/cmd/vendor/golang.org/x/sys/unix/zsyscall_aix_ppc64_gc.go @@ -1,4 +1,4 @@ -// mksyscall_aix_ppc64.pl -aix -tags aix,ppc64 syscall_aix.go syscall_aix_ppc64.go +// go run mksyscall_aix_ppc64.go -aix -tags aix,ppc64 syscall_aix.go syscall_aix_ppc64.go // Code generated by the command above; see README.md. DO NOT EDIT. // +build aix,ppc64 diff --git a/src/cmd/vendor/golang.org/x/sys/unix/zsyscall_aix_ppc64_gccgo.go b/src/cmd/vendor/golang.org/x/sys/unix/zsyscall_aix_ppc64_gccgo.go index aef7c0e784..e88a442787 100644 --- a/src/cmd/vendor/golang.org/x/sys/unix/zsyscall_aix_ppc64_gccgo.go +++ b/src/cmd/vendor/golang.org/x/sys/unix/zsyscall_aix_ppc64_gccgo.go @@ -1,4 +1,4 @@ -// mksyscall_aix_ppc64.pl -aix -tags aix,ppc64 syscall_aix.go syscall_aix_ppc64.go +// go run mksyscall_aix_ppc64.go -aix -tags aix,ppc64 syscall_aix.go syscall_aix_ppc64.go // Code generated by the command above; see README.md. DO NOT EDIT. // +build aix,ppc64 diff --git a/src/cmd/vendor/golang.org/x/sys/unix/zsyscall_darwin_amd64.go b/src/cmd/vendor/golang.org/x/sys/unix/zsyscall_darwin_amd64.go index b50178d679..c142e33e92 100644 --- a/src/cmd/vendor/golang.org/x/sys/unix/zsyscall_darwin_amd64.go +++ b/src/cmd/vendor/golang.org/x/sys/unix/zsyscall_darwin_amd64.go @@ -943,6 +943,21 @@ func libc_chroot_trampoline() // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT +func ClockGettime(clockid int32, time *Timespec) (err error) { + _, _, e1 := syscall_syscall(funcPC(libc_clock_gettime_trampoline), uintptr(clockid), uintptr(unsafe.Pointer(time)), 0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +func libc_clock_gettime_trampoline() + +//go:linkname libc_clock_gettime libc_clock_gettime +//go:cgo_import_dynamic libc_clock_gettime clock_gettime "/usr/lib/libSystem.B.dylib" + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + func Close(fd int) (err error) { _, _, e1 := syscall_syscall(funcPC(libc_close_trampoline), uintptr(fd), 0, 0) if e1 != 0 { diff --git a/src/cmd/vendor/golang.org/x/sys/unix/zsyscall_darwin_amd64.s b/src/cmd/vendor/golang.org/x/sys/unix/zsyscall_darwin_amd64.s index da9b900a8c..1a3915197d 100644 --- a/src/cmd/vendor/golang.org/x/sys/unix/zsyscall_darwin_amd64.s +++ b/src/cmd/vendor/golang.org/x/sys/unix/zsyscall_darwin_amd64.s @@ -108,6 +108,8 @@ TEXT ·libc_chown_trampoline(SB),NOSPLIT,$0-0 JMP libc_chown(SB) TEXT ·libc_chroot_trampoline(SB),NOSPLIT,$0-0 JMP libc_chroot(SB) +TEXT ·libc_clock_gettime_trampoline(SB),NOSPLIT,$0-0 + JMP libc_clock_gettime(SB) TEXT ·libc_close_trampoline(SB),NOSPLIT,$0-0 JMP libc_close(SB) TEXT ·libc_dup_trampoline(SB),NOSPLIT,$0-0 diff --git a/src/cmd/vendor/golang.org/x/sys/unix/zsyscall_dragonfly_amd64.go b/src/cmd/vendor/golang.org/x/sys/unix/zsyscall_dragonfly_amd64.go index da9986dd21..ae9f1a21e6 100644 --- a/src/cmd/vendor/golang.org/x/sys/unix/zsyscall_dragonfly_amd64.go +++ b/src/cmd/vendor/golang.org/x/sys/unix/zsyscall_dragonfly_amd64.go @@ -1194,6 +1194,26 @@ func Rename(from string, to string) (err error) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT +func Renameat(fromfd int, from string, tofd int, to string) (err error) { + var _p0 *byte + _p0, err = BytePtrFromString(from) + if err != nil { + return + } + var _p1 *byte + _p1, err = BytePtrFromString(to) + if err != nil { + return + } + _, _, e1 := Syscall6(SYS_RENAMEAT, uintptr(fromfd), uintptr(unsafe.Pointer(_p0)), uintptr(tofd), uintptr(unsafe.Pointer(_p1)), 0, 0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + func Revoke(path string) (err error) { var _p0 *byte _p0, err = BytePtrFromString(path) diff --git a/src/cmd/vendor/golang.org/x/sys/unix/zsyscall_linux_386.go b/src/cmd/vendor/golang.org/x/sys/unix/zsyscall_linux_386.go index 5356a51759..c8b451000b 100644 --- a/src/cmd/vendor/golang.org/x/sys/unix/zsyscall_linux_386.go +++ b/src/cmd/vendor/golang.org/x/sys/unix/zsyscall_linux_386.go @@ -437,6 +437,16 @@ func ClockGettime(clockid int32, time *Timespec) (err error) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT +func ClockNanosleep(clockid int32, flags int, request *Timespec, remain *Timespec) (err error) { + _, _, e1 := Syscall6(SYS_CLOCK_NANOSLEEP, uintptr(clockid), uintptr(flags), uintptr(unsafe.Pointer(request)), uintptr(unsafe.Pointer(remain)), 0, 0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + func Close(fd int) (err error) { _, _, e1 := Syscall(SYS_CLOSE, uintptr(fd), 0, 0) if e1 != 0 { @@ -1195,26 +1205,6 @@ func Removexattr(path string, attr string) (err error) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT -func Renameat(olddirfd int, oldpath string, newdirfd int, newpath string) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(oldpath) - if err != nil { - return - } - var _p1 *byte - _p1, err = BytePtrFromString(newpath) - if err != nil { - return - } - _, _, e1 := Syscall6(SYS_RENAMEAT, uintptr(olddirfd), uintptr(unsafe.Pointer(_p0)), uintptr(newdirfd), uintptr(unsafe.Pointer(_p1)), 0, 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - func Renameat2(olddirfd int, oldpath string, newdirfd int, newpath string, flags uint) (err error) { var _p0 *byte _p0, err = BytePtrFromString(oldpath) @@ -1370,6 +1360,13 @@ func Setxattr(path string, attr string, data []byte, flags int) (err error) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT +func Signalfd(fd int, mask *Sigset_t, flags int) { + SyscallNoError(SYS_SIGNALFD4, uintptr(fd), uintptr(unsafe.Pointer(mask)), uintptr(flags)) + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + func Statx(dirfd int, path string, flags int, mask int, stat *Statx_t) (err error) { var _p0 *byte _p0, err = BytePtrFromString(path) @@ -1901,6 +1898,26 @@ func Pwrite(fd int, p []byte, offset int64) (n int, err error) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT +func Renameat(olddirfd int, oldpath string, newdirfd int, newpath string) (err error) { + var _p0 *byte + _p0, err = BytePtrFromString(oldpath) + if err != nil { + return + } + var _p1 *byte + _p1, err = BytePtrFromString(newpath) + if err != nil { + return + } + _, _, e1 := Syscall6(SYS_RENAMEAT, uintptr(olddirfd), uintptr(unsafe.Pointer(_p0)), uintptr(newdirfd), uintptr(unsafe.Pointer(_p1)), 0, 0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + func sendfile(outfd int, infd int, offset *int64, count int) (written int, err error) { r0, _, e1 := Syscall6(SYS_SENDFILE64, uintptr(outfd), uintptr(infd), uintptr(unsafe.Pointer(offset)), uintptr(count), 0, 0) written = int(r0) diff --git a/src/cmd/vendor/golang.org/x/sys/unix/zsyscall_linux_amd64.go b/src/cmd/vendor/golang.org/x/sys/unix/zsyscall_linux_amd64.go index 0f6d265d8b..2aac3184bc 100644 --- a/src/cmd/vendor/golang.org/x/sys/unix/zsyscall_linux_amd64.go +++ b/src/cmd/vendor/golang.org/x/sys/unix/zsyscall_linux_amd64.go @@ -437,6 +437,16 @@ func ClockGettime(clockid int32, time *Timespec) (err error) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT +func ClockNanosleep(clockid int32, flags int, request *Timespec, remain *Timespec) (err error) { + _, _, e1 := Syscall6(SYS_CLOCK_NANOSLEEP, uintptr(clockid), uintptr(flags), uintptr(unsafe.Pointer(request)), uintptr(unsafe.Pointer(remain)), 0, 0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + func Close(fd int) (err error) { _, _, e1 := Syscall(SYS_CLOSE, uintptr(fd), 0, 0) if e1 != 0 { @@ -1195,26 +1205,6 @@ func Removexattr(path string, attr string) (err error) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT -func Renameat(olddirfd int, oldpath string, newdirfd int, newpath string) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(oldpath) - if err != nil { - return - } - var _p1 *byte - _p1, err = BytePtrFromString(newpath) - if err != nil { - return - } - _, _, e1 := Syscall6(SYS_RENAMEAT, uintptr(olddirfd), uintptr(unsafe.Pointer(_p0)), uintptr(newdirfd), uintptr(unsafe.Pointer(_p1)), 0, 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - func Renameat2(olddirfd int, oldpath string, newdirfd int, newpath string, flags uint) (err error) { var _p0 *byte _p0, err = BytePtrFromString(oldpath) @@ -1370,6 +1360,13 @@ func Setxattr(path string, attr string, data []byte, flags int) (err error) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT +func Signalfd(fd int, mask *Sigset_t, flags int) { + SyscallNoError(SYS_SIGNALFD4, uintptr(fd), uintptr(unsafe.Pointer(mask)), uintptr(flags)) + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + func Statx(dirfd int, path string, flags int, mask int, stat *Statx_t) (err error) { var _p0 *byte _p0, err = BytePtrFromString(path) @@ -1906,6 +1903,26 @@ func Pwrite(fd int, p []byte, offset int64) (n int, err error) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT +func Renameat(olddirfd int, oldpath string, newdirfd int, newpath string) (err error) { + var _p0 *byte + _p0, err = BytePtrFromString(oldpath) + if err != nil { + return + } + var _p1 *byte + _p1, err = BytePtrFromString(newpath) + if err != nil { + return + } + _, _, e1 := Syscall6(SYS_RENAMEAT, uintptr(olddirfd), uintptr(unsafe.Pointer(_p0)), uintptr(newdirfd), uintptr(unsafe.Pointer(_p1)), 0, 0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + func Seek(fd int, offset int64, whence int) (off int64, err error) { r0, _, e1 := Syscall(SYS_LSEEK, uintptr(fd), uintptr(offset), uintptr(whence)) off = int64(r0) diff --git a/src/cmd/vendor/golang.org/x/sys/unix/zsyscall_linux_arm.go b/src/cmd/vendor/golang.org/x/sys/unix/zsyscall_linux_arm.go index 012261ad54..13c06c2815 100644 --- a/src/cmd/vendor/golang.org/x/sys/unix/zsyscall_linux_arm.go +++ b/src/cmd/vendor/golang.org/x/sys/unix/zsyscall_linux_arm.go @@ -437,6 +437,16 @@ func ClockGettime(clockid int32, time *Timespec) (err error) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT +func ClockNanosleep(clockid int32, flags int, request *Timespec, remain *Timespec) (err error) { + _, _, e1 := Syscall6(SYS_CLOCK_NANOSLEEP, uintptr(clockid), uintptr(flags), uintptr(unsafe.Pointer(request)), uintptr(unsafe.Pointer(remain)), 0, 0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + func Close(fd int) (err error) { _, _, e1 := Syscall(SYS_CLOSE, uintptr(fd), 0, 0) if e1 != 0 { @@ -1195,26 +1205,6 @@ func Removexattr(path string, attr string) (err error) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT -func Renameat(olddirfd int, oldpath string, newdirfd int, newpath string) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(oldpath) - if err != nil { - return - } - var _p1 *byte - _p1, err = BytePtrFromString(newpath) - if err != nil { - return - } - _, _, e1 := Syscall6(SYS_RENAMEAT, uintptr(olddirfd), uintptr(unsafe.Pointer(_p0)), uintptr(newdirfd), uintptr(unsafe.Pointer(_p1)), 0, 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - func Renameat2(olddirfd int, oldpath string, newdirfd int, newpath string, flags uint) (err error) { var _p0 *byte _p0, err = BytePtrFromString(oldpath) @@ -1370,6 +1360,13 @@ func Setxattr(path string, attr string, data []byte, flags int) (err error) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT +func Signalfd(fd int, mask *Sigset_t, flags int) { + SyscallNoError(SYS_SIGNALFD4, uintptr(fd), uintptr(unsafe.Pointer(mask)), uintptr(flags)) + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + func Statx(dirfd int, path string, flags int, mask int, stat *Statx_t) (err error) { var _p0 *byte _p0, err = BytePtrFromString(path) @@ -2016,6 +2013,26 @@ func Pause() (err error) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT +func Renameat(olddirfd int, oldpath string, newdirfd int, newpath string) (err error) { + var _p0 *byte + _p0, err = BytePtrFromString(oldpath) + if err != nil { + return + } + var _p1 *byte + _p1, err = BytePtrFromString(newpath) + if err != nil { + return + } + _, _, e1 := Syscall6(SYS_RENAMEAT, uintptr(olddirfd), uintptr(unsafe.Pointer(_p0)), uintptr(newdirfd), uintptr(unsafe.Pointer(_p1)), 0, 0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + func sendfile(outfd int, infd int, offset *int64, count int) (written int, err error) { r0, _, e1 := Syscall6(SYS_SENDFILE64, uintptr(outfd), uintptr(infd), uintptr(unsafe.Pointer(offset)), uintptr(count), 0, 0) written = int(r0) diff --git a/src/cmd/vendor/golang.org/x/sys/unix/zsyscall_linux_arm64.go b/src/cmd/vendor/golang.org/x/sys/unix/zsyscall_linux_arm64.go index b890cb03c6..737fa8d181 100644 --- a/src/cmd/vendor/golang.org/x/sys/unix/zsyscall_linux_arm64.go +++ b/src/cmd/vendor/golang.org/x/sys/unix/zsyscall_linux_arm64.go @@ -437,6 +437,16 @@ func ClockGettime(clockid int32, time *Timespec) (err error) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT +func ClockNanosleep(clockid int32, flags int, request *Timespec, remain *Timespec) (err error) { + _, _, e1 := Syscall6(SYS_CLOCK_NANOSLEEP, uintptr(clockid), uintptr(flags), uintptr(unsafe.Pointer(request)), uintptr(unsafe.Pointer(remain)), 0, 0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + func Close(fd int) (err error) { _, _, e1 := Syscall(SYS_CLOSE, uintptr(fd), 0, 0) if e1 != 0 { @@ -1195,26 +1205,6 @@ func Removexattr(path string, attr string) (err error) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT -func Renameat(olddirfd int, oldpath string, newdirfd int, newpath string) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(oldpath) - if err != nil { - return - } - var _p1 *byte - _p1, err = BytePtrFromString(newpath) - if err != nil { - return - } - _, _, e1 := Syscall6(SYS_RENAMEAT, uintptr(olddirfd), uintptr(unsafe.Pointer(_p0)), uintptr(newdirfd), uintptr(unsafe.Pointer(_p1)), 0, 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - func Renameat2(olddirfd int, oldpath string, newdirfd int, newpath string, flags uint) (err error) { var _p0 *byte _p0, err = BytePtrFromString(oldpath) @@ -1370,6 +1360,13 @@ func Setxattr(path string, attr string, data []byte, flags int) (err error) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT +func Signalfd(fd int, mask *Sigset_t, flags int) { + SyscallNoError(SYS_SIGNALFD4, uintptr(fd), uintptr(unsafe.Pointer(mask)), uintptr(flags)) + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + func Statx(dirfd int, path string, flags int, mask int, stat *Statx_t) (err error) { var _p0 *byte _p0, err = BytePtrFromString(path) @@ -1829,6 +1826,26 @@ func Pwrite(fd int, p []byte, offset int64) (n int, err error) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT +func Renameat(olddirfd int, oldpath string, newdirfd int, newpath string) (err error) { + var _p0 *byte + _p0, err = BytePtrFromString(oldpath) + if err != nil { + return + } + var _p1 *byte + _p1, err = BytePtrFromString(newpath) + if err != nil { + return + } + _, _, e1 := Syscall6(SYS_RENAMEAT, uintptr(olddirfd), uintptr(unsafe.Pointer(_p0)), uintptr(newdirfd), uintptr(unsafe.Pointer(_p1)), 0, 0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + func Seek(fd int, offset int64, whence int) (off int64, err error) { r0, _, e1 := Syscall(SYS_LSEEK, uintptr(fd), uintptr(offset), uintptr(whence)) off = int64(r0) diff --git a/src/cmd/vendor/golang.org/x/sys/unix/zsyscall_linux_mips.go b/src/cmd/vendor/golang.org/x/sys/unix/zsyscall_linux_mips.go index cc17b43d35..0a85f3f8db 100644 --- a/src/cmd/vendor/golang.org/x/sys/unix/zsyscall_linux_mips.go +++ b/src/cmd/vendor/golang.org/x/sys/unix/zsyscall_linux_mips.go @@ -437,6 +437,16 @@ func ClockGettime(clockid int32, time *Timespec) (err error) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT +func ClockNanosleep(clockid int32, flags int, request *Timespec, remain *Timespec) (err error) { + _, _, e1 := Syscall6(SYS_CLOCK_NANOSLEEP, uintptr(clockid), uintptr(flags), uintptr(unsafe.Pointer(request)), uintptr(unsafe.Pointer(remain)), 0, 0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + func Close(fd int) (err error) { _, _, e1 := Syscall(SYS_CLOSE, uintptr(fd), 0, 0) if e1 != 0 { @@ -1195,26 +1205,6 @@ func Removexattr(path string, attr string) (err error) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT -func Renameat(olddirfd int, oldpath string, newdirfd int, newpath string) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(oldpath) - if err != nil { - return - } - var _p1 *byte - _p1, err = BytePtrFromString(newpath) - if err != nil { - return - } - _, _, e1 := Syscall6(SYS_RENAMEAT, uintptr(olddirfd), uintptr(unsafe.Pointer(_p0)), uintptr(newdirfd), uintptr(unsafe.Pointer(_p1)), 0, 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - func Renameat2(olddirfd int, oldpath string, newdirfd int, newpath string, flags uint) (err error) { var _p0 *byte _p0, err = BytePtrFromString(oldpath) @@ -1370,6 +1360,13 @@ func Setxattr(path string, attr string, data []byte, flags int) (err error) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT +func Signalfd(fd int, mask *Sigset_t, flags int) { + SyscallNoError(SYS_SIGNALFD4, uintptr(fd), uintptr(unsafe.Pointer(mask)), uintptr(flags)) + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + func Statx(dirfd int, path string, flags int, mask int, stat *Statx_t) (err error) { var _p0 *byte _p0, err = BytePtrFromString(path) @@ -1820,6 +1817,26 @@ func Pwrite(fd int, p []byte, offset int64) (n int, err error) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT +func Renameat(olddirfd int, oldpath string, newdirfd int, newpath string) (err error) { + var _p0 *byte + _p0, err = BytePtrFromString(oldpath) + if err != nil { + return + } + var _p1 *byte + _p1, err = BytePtrFromString(newpath) + if err != nil { + return + } + _, _, e1 := Syscall6(SYS_RENAMEAT, uintptr(olddirfd), uintptr(unsafe.Pointer(_p0)), uintptr(newdirfd), uintptr(unsafe.Pointer(_p1)), 0, 0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + func Select(nfd int, r *FdSet, w *FdSet, e *FdSet, timeout *Timeval) (n int, err error) { r0, _, e1 := Syscall6(SYS__NEWSELECT, uintptr(nfd), uintptr(unsafe.Pointer(r)), uintptr(unsafe.Pointer(w)), uintptr(unsafe.Pointer(e)), uintptr(unsafe.Pointer(timeout)), 0) n = int(r0) diff --git a/src/cmd/vendor/golang.org/x/sys/unix/zsyscall_linux_mips64.go b/src/cmd/vendor/golang.org/x/sys/unix/zsyscall_linux_mips64.go index 25026415dd..ec7007e781 100644 --- a/src/cmd/vendor/golang.org/x/sys/unix/zsyscall_linux_mips64.go +++ b/src/cmd/vendor/golang.org/x/sys/unix/zsyscall_linux_mips64.go @@ -437,6 +437,16 @@ func ClockGettime(clockid int32, time *Timespec) (err error) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT +func ClockNanosleep(clockid int32, flags int, request *Timespec, remain *Timespec) (err error) { + _, _, e1 := Syscall6(SYS_CLOCK_NANOSLEEP, uintptr(clockid), uintptr(flags), uintptr(unsafe.Pointer(request)), uintptr(unsafe.Pointer(remain)), 0, 0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + func Close(fd int) (err error) { _, _, e1 := Syscall(SYS_CLOSE, uintptr(fd), 0, 0) if e1 != 0 { @@ -1195,26 +1205,6 @@ func Removexattr(path string, attr string) (err error) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT -func Renameat(olddirfd int, oldpath string, newdirfd int, newpath string) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(oldpath) - if err != nil { - return - } - var _p1 *byte - _p1, err = BytePtrFromString(newpath) - if err != nil { - return - } - _, _, e1 := Syscall6(SYS_RENAMEAT, uintptr(olddirfd), uintptr(unsafe.Pointer(_p0)), uintptr(newdirfd), uintptr(unsafe.Pointer(_p1)), 0, 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - func Renameat2(olddirfd int, oldpath string, newdirfd int, newpath string, flags uint) (err error) { var _p0 *byte _p0, err = BytePtrFromString(oldpath) @@ -1370,6 +1360,13 @@ func Setxattr(path string, attr string, data []byte, flags int) (err error) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT +func Signalfd(fd int, mask *Sigset_t, flags int) { + SyscallNoError(SYS_SIGNALFD4, uintptr(fd), uintptr(unsafe.Pointer(mask)), uintptr(flags)) + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + func Statx(dirfd int, path string, flags int, mask int, stat *Statx_t) (err error) { var _p0 *byte _p0, err = BytePtrFromString(path) @@ -1850,6 +1847,26 @@ func Pwrite(fd int, p []byte, offset int64) (n int, err error) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT +func Renameat(olddirfd int, oldpath string, newdirfd int, newpath string) (err error) { + var _p0 *byte + _p0, err = BytePtrFromString(oldpath) + if err != nil { + return + } + var _p1 *byte + _p1, err = BytePtrFromString(newpath) + if err != nil { + return + } + _, _, e1 := Syscall6(SYS_RENAMEAT, uintptr(olddirfd), uintptr(unsafe.Pointer(_p0)), uintptr(newdirfd), uintptr(unsafe.Pointer(_p1)), 0, 0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + func Seek(fd int, offset int64, whence int) (off int64, err error) { r0, _, e1 := Syscall(SYS_LSEEK, uintptr(fd), uintptr(offset), uintptr(whence)) off = int64(r0) diff --git a/src/cmd/vendor/golang.org/x/sys/unix/zsyscall_linux_mips64le.go b/src/cmd/vendor/golang.org/x/sys/unix/zsyscall_linux_mips64le.go index 83d8bb8af8..c5bb25d964 100644 --- a/src/cmd/vendor/golang.org/x/sys/unix/zsyscall_linux_mips64le.go +++ b/src/cmd/vendor/golang.org/x/sys/unix/zsyscall_linux_mips64le.go @@ -437,6 +437,16 @@ func ClockGettime(clockid int32, time *Timespec) (err error) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT +func ClockNanosleep(clockid int32, flags int, request *Timespec, remain *Timespec) (err error) { + _, _, e1 := Syscall6(SYS_CLOCK_NANOSLEEP, uintptr(clockid), uintptr(flags), uintptr(unsafe.Pointer(request)), uintptr(unsafe.Pointer(remain)), 0, 0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + func Close(fd int) (err error) { _, _, e1 := Syscall(SYS_CLOSE, uintptr(fd), 0, 0) if e1 != 0 { @@ -1195,26 +1205,6 @@ func Removexattr(path string, attr string) (err error) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT -func Renameat(olddirfd int, oldpath string, newdirfd int, newpath string) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(oldpath) - if err != nil { - return - } - var _p1 *byte - _p1, err = BytePtrFromString(newpath) - if err != nil { - return - } - _, _, e1 := Syscall6(SYS_RENAMEAT, uintptr(olddirfd), uintptr(unsafe.Pointer(_p0)), uintptr(newdirfd), uintptr(unsafe.Pointer(_p1)), 0, 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - func Renameat2(olddirfd int, oldpath string, newdirfd int, newpath string, flags uint) (err error) { var _p0 *byte _p0, err = BytePtrFromString(oldpath) @@ -1370,6 +1360,13 @@ func Setxattr(path string, attr string, data []byte, flags int) (err error) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT +func Signalfd(fd int, mask *Sigset_t, flags int) { + SyscallNoError(SYS_SIGNALFD4, uintptr(fd), uintptr(unsafe.Pointer(mask)), uintptr(flags)) + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + func Statx(dirfd int, path string, flags int, mask int, stat *Statx_t) (err error) { var _p0 *byte _p0, err = BytePtrFromString(path) @@ -1850,6 +1847,26 @@ func Pwrite(fd int, p []byte, offset int64) (n int, err error) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT +func Renameat(olddirfd int, oldpath string, newdirfd int, newpath string) (err error) { + var _p0 *byte + _p0, err = BytePtrFromString(oldpath) + if err != nil { + return + } + var _p1 *byte + _p1, err = BytePtrFromString(newpath) + if err != nil { + return + } + _, _, e1 := Syscall6(SYS_RENAMEAT, uintptr(olddirfd), uintptr(unsafe.Pointer(_p0)), uintptr(newdirfd), uintptr(unsafe.Pointer(_p1)), 0, 0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + func Seek(fd int, offset int64, whence int) (off int64, err error) { r0, _, e1 := Syscall(SYS_LSEEK, uintptr(fd), uintptr(offset), uintptr(whence)) off = int64(r0) diff --git a/src/cmd/vendor/golang.org/x/sys/unix/zsyscall_linux_mipsle.go b/src/cmd/vendor/golang.org/x/sys/unix/zsyscall_linux_mipsle.go index b16b3e1029..26ada0478f 100644 --- a/src/cmd/vendor/golang.org/x/sys/unix/zsyscall_linux_mipsle.go +++ b/src/cmd/vendor/golang.org/x/sys/unix/zsyscall_linux_mipsle.go @@ -437,6 +437,16 @@ func ClockGettime(clockid int32, time *Timespec) (err error) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT +func ClockNanosleep(clockid int32, flags int, request *Timespec, remain *Timespec) (err error) { + _, _, e1 := Syscall6(SYS_CLOCK_NANOSLEEP, uintptr(clockid), uintptr(flags), uintptr(unsafe.Pointer(request)), uintptr(unsafe.Pointer(remain)), 0, 0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + func Close(fd int) (err error) { _, _, e1 := Syscall(SYS_CLOSE, uintptr(fd), 0, 0) if e1 != 0 { @@ -1195,26 +1205,6 @@ func Removexattr(path string, attr string) (err error) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT -func Renameat(olddirfd int, oldpath string, newdirfd int, newpath string) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(oldpath) - if err != nil { - return - } - var _p1 *byte - _p1, err = BytePtrFromString(newpath) - if err != nil { - return - } - _, _, e1 := Syscall6(SYS_RENAMEAT, uintptr(olddirfd), uintptr(unsafe.Pointer(_p0)), uintptr(newdirfd), uintptr(unsafe.Pointer(_p1)), 0, 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - func Renameat2(olddirfd int, oldpath string, newdirfd int, newpath string, flags uint) (err error) { var _p0 *byte _p0, err = BytePtrFromString(oldpath) @@ -1370,6 +1360,13 @@ func Setxattr(path string, attr string, data []byte, flags int) (err error) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT +func Signalfd(fd int, mask *Sigset_t, flags int) { + SyscallNoError(SYS_SIGNALFD4, uintptr(fd), uintptr(unsafe.Pointer(mask)), uintptr(flags)) + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + func Statx(dirfd int, path string, flags int, mask int, stat *Statx_t) (err error) { var _p0 *byte _p0, err = BytePtrFromString(path) @@ -1820,6 +1817,26 @@ func Pwrite(fd int, p []byte, offset int64) (n int, err error) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT +func Renameat(olddirfd int, oldpath string, newdirfd int, newpath string) (err error) { + var _p0 *byte + _p0, err = BytePtrFromString(oldpath) + if err != nil { + return + } + var _p1 *byte + _p1, err = BytePtrFromString(newpath) + if err != nil { + return + } + _, _, e1 := Syscall6(SYS_RENAMEAT, uintptr(olddirfd), uintptr(unsafe.Pointer(_p0)), uintptr(newdirfd), uintptr(unsafe.Pointer(_p1)), 0, 0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + func Select(nfd int, r *FdSet, w *FdSet, e *FdSet, timeout *Timeval) (n int, err error) { r0, _, e1 := Syscall6(SYS__NEWSELECT, uintptr(nfd), uintptr(unsafe.Pointer(r)), uintptr(unsafe.Pointer(w)), uintptr(unsafe.Pointer(e)), uintptr(unsafe.Pointer(timeout)), 0) n = int(r0) diff --git a/src/cmd/vendor/golang.org/x/sys/unix/zsyscall_linux_ppc64.go b/src/cmd/vendor/golang.org/x/sys/unix/zsyscall_linux_ppc64.go index 27b6a6bf0e..2da9cb700a 100644 --- a/src/cmd/vendor/golang.org/x/sys/unix/zsyscall_linux_ppc64.go +++ b/src/cmd/vendor/golang.org/x/sys/unix/zsyscall_linux_ppc64.go @@ -437,6 +437,16 @@ func ClockGettime(clockid int32, time *Timespec) (err error) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT +func ClockNanosleep(clockid int32, flags int, request *Timespec, remain *Timespec) (err error) { + _, _, e1 := Syscall6(SYS_CLOCK_NANOSLEEP, uintptr(clockid), uintptr(flags), uintptr(unsafe.Pointer(request)), uintptr(unsafe.Pointer(remain)), 0, 0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + func Close(fd int) (err error) { _, _, e1 := Syscall(SYS_CLOSE, uintptr(fd), 0, 0) if e1 != 0 { @@ -1195,26 +1205,6 @@ func Removexattr(path string, attr string) (err error) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT -func Renameat(olddirfd int, oldpath string, newdirfd int, newpath string) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(oldpath) - if err != nil { - return - } - var _p1 *byte - _p1, err = BytePtrFromString(newpath) - if err != nil { - return - } - _, _, e1 := Syscall6(SYS_RENAMEAT, uintptr(olddirfd), uintptr(unsafe.Pointer(_p0)), uintptr(newdirfd), uintptr(unsafe.Pointer(_p1)), 0, 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - func Renameat2(olddirfd int, oldpath string, newdirfd int, newpath string, flags uint) (err error) { var _p0 *byte _p0, err = BytePtrFromString(oldpath) @@ -1370,6 +1360,13 @@ func Setxattr(path string, attr string, data []byte, flags int) (err error) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT +func Signalfd(fd int, mask *Sigset_t, flags int) { + SyscallNoError(SYS_SIGNALFD4, uintptr(fd), uintptr(unsafe.Pointer(mask)), uintptr(flags)) + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + func Statx(dirfd int, path string, flags int, mask int, stat *Statx_t) (err error) { var _p0 *byte _p0, err = BytePtrFromString(path) @@ -1921,6 +1918,26 @@ func Pwrite(fd int, p []byte, offset int64) (n int, err error) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT +func Renameat(olddirfd int, oldpath string, newdirfd int, newpath string) (err error) { + var _p0 *byte + _p0, err = BytePtrFromString(oldpath) + if err != nil { + return + } + var _p1 *byte + _p1, err = BytePtrFromString(newpath) + if err != nil { + return + } + _, _, e1 := Syscall6(SYS_RENAMEAT, uintptr(olddirfd), uintptr(unsafe.Pointer(_p0)), uintptr(newdirfd), uintptr(unsafe.Pointer(_p1)), 0, 0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + func Seek(fd int, offset int64, whence int) (off int64, err error) { r0, _, e1 := Syscall(SYS_LSEEK, uintptr(fd), uintptr(offset), uintptr(whence)) off = int64(r0) diff --git a/src/cmd/vendor/golang.org/x/sys/unix/zsyscall_linux_ppc64le.go b/src/cmd/vendor/golang.org/x/sys/unix/zsyscall_linux_ppc64le.go index f7ecc9afda..772733d83f 100644 --- a/src/cmd/vendor/golang.org/x/sys/unix/zsyscall_linux_ppc64le.go +++ b/src/cmd/vendor/golang.org/x/sys/unix/zsyscall_linux_ppc64le.go @@ -437,6 +437,16 @@ func ClockGettime(clockid int32, time *Timespec) (err error) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT +func ClockNanosleep(clockid int32, flags int, request *Timespec, remain *Timespec) (err error) { + _, _, e1 := Syscall6(SYS_CLOCK_NANOSLEEP, uintptr(clockid), uintptr(flags), uintptr(unsafe.Pointer(request)), uintptr(unsafe.Pointer(remain)), 0, 0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + func Close(fd int) (err error) { _, _, e1 := Syscall(SYS_CLOSE, uintptr(fd), 0, 0) if e1 != 0 { @@ -1195,26 +1205,6 @@ func Removexattr(path string, attr string) (err error) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT -func Renameat(olddirfd int, oldpath string, newdirfd int, newpath string) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(oldpath) - if err != nil { - return - } - var _p1 *byte - _p1, err = BytePtrFromString(newpath) - if err != nil { - return - } - _, _, e1 := Syscall6(SYS_RENAMEAT, uintptr(olddirfd), uintptr(unsafe.Pointer(_p0)), uintptr(newdirfd), uintptr(unsafe.Pointer(_p1)), 0, 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - func Renameat2(olddirfd int, oldpath string, newdirfd int, newpath string, flags uint) (err error) { var _p0 *byte _p0, err = BytePtrFromString(oldpath) @@ -1370,6 +1360,13 @@ func Setxattr(path string, attr string, data []byte, flags int) (err error) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT +func Signalfd(fd int, mask *Sigset_t, flags int) { + SyscallNoError(SYS_SIGNALFD4, uintptr(fd), uintptr(unsafe.Pointer(mask)), uintptr(flags)) + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + func Statx(dirfd int, path string, flags int, mask int, stat *Statx_t) (err error) { var _p0 *byte _p0, err = BytePtrFromString(path) @@ -1921,6 +1918,26 @@ func Pwrite(fd int, p []byte, offset int64) (n int, err error) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT +func Renameat(olddirfd int, oldpath string, newdirfd int, newpath string) (err error) { + var _p0 *byte + _p0, err = BytePtrFromString(oldpath) + if err != nil { + return + } + var _p1 *byte + _p1, err = BytePtrFromString(newpath) + if err != nil { + return + } + _, _, e1 := Syscall6(SYS_RENAMEAT, uintptr(olddirfd), uintptr(unsafe.Pointer(_p0)), uintptr(newdirfd), uintptr(unsafe.Pointer(_p1)), 0, 0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + func Seek(fd int, offset int64, whence int) (off int64, err error) { r0, _, e1 := Syscall(SYS_LSEEK, uintptr(fd), uintptr(offset), uintptr(whence)) off = int64(r0) diff --git a/src/cmd/vendor/golang.org/x/sys/unix/zsyscall_linux_riscv64.go b/src/cmd/vendor/golang.org/x/sys/unix/zsyscall_linux_riscv64.go index e3cd4e53f9..996eba517a 100644 --- a/src/cmd/vendor/golang.org/x/sys/unix/zsyscall_linux_riscv64.go +++ b/src/cmd/vendor/golang.org/x/sys/unix/zsyscall_linux_riscv64.go @@ -437,6 +437,16 @@ func ClockGettime(clockid int32, time *Timespec) (err error) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT +func ClockNanosleep(clockid int32, flags int, request *Timespec, remain *Timespec) (err error) { + _, _, e1 := Syscall6(SYS_CLOCK_NANOSLEEP, uintptr(clockid), uintptr(flags), uintptr(unsafe.Pointer(request)), uintptr(unsafe.Pointer(remain)), 0, 0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + func Close(fd int) (err error) { _, _, e1 := Syscall(SYS_CLOSE, uintptr(fd), 0, 0) if e1 != 0 { @@ -1195,26 +1205,6 @@ func Removexattr(path string, attr string) (err error) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT -func Renameat(olddirfd int, oldpath string, newdirfd int, newpath string) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(oldpath) - if err != nil { - return - } - var _p1 *byte - _p1, err = BytePtrFromString(newpath) - if err != nil { - return - } - _, _, e1 := Syscall6(SYS_RENAMEAT, uintptr(olddirfd), uintptr(unsafe.Pointer(_p0)), uintptr(newdirfd), uintptr(unsafe.Pointer(_p1)), 0, 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - func Renameat2(olddirfd int, oldpath string, newdirfd int, newpath string, flags uint) (err error) { var _p0 *byte _p0, err = BytePtrFromString(oldpath) @@ -1370,6 +1360,13 @@ func Setxattr(path string, attr string, data []byte, flags int) (err error) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT +func Signalfd(fd int, mask *Sigset_t, flags int) { + SyscallNoError(SYS_SIGNALFD4, uintptr(fd), uintptr(unsafe.Pointer(mask)), uintptr(flags)) + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + func Statx(dirfd int, path string, flags int, mask int, stat *Statx_t) (err error) { var _p0 *byte _p0, err = BytePtrFromString(path) diff --git a/src/cmd/vendor/golang.org/x/sys/unix/zsyscall_linux_s390x.go b/src/cmd/vendor/golang.org/x/sys/unix/zsyscall_linux_s390x.go index 3001d37981..cb9072a33a 100644 --- a/src/cmd/vendor/golang.org/x/sys/unix/zsyscall_linux_s390x.go +++ b/src/cmd/vendor/golang.org/x/sys/unix/zsyscall_linux_s390x.go @@ -437,6 +437,16 @@ func ClockGettime(clockid int32, time *Timespec) (err error) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT +func ClockNanosleep(clockid int32, flags int, request *Timespec, remain *Timespec) (err error) { + _, _, e1 := Syscall6(SYS_CLOCK_NANOSLEEP, uintptr(clockid), uintptr(flags), uintptr(unsafe.Pointer(request)), uintptr(unsafe.Pointer(remain)), 0, 0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + func Close(fd int) (err error) { _, _, e1 := Syscall(SYS_CLOSE, uintptr(fd), 0, 0) if e1 != 0 { @@ -1195,26 +1205,6 @@ func Removexattr(path string, attr string) (err error) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT -func Renameat(olddirfd int, oldpath string, newdirfd int, newpath string) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(oldpath) - if err != nil { - return - } - var _p1 *byte - _p1, err = BytePtrFromString(newpath) - if err != nil { - return - } - _, _, e1 := Syscall6(SYS_RENAMEAT, uintptr(olddirfd), uintptr(unsafe.Pointer(_p0)), uintptr(newdirfd), uintptr(unsafe.Pointer(_p1)), 0, 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - func Renameat2(olddirfd int, oldpath string, newdirfd int, newpath string, flags uint) (err error) { var _p0 *byte _p0, err = BytePtrFromString(oldpath) @@ -1370,6 +1360,13 @@ func Setxattr(path string, attr string, data []byte, flags int) (err error) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT +func Signalfd(fd int, mask *Sigset_t, flags int) { + SyscallNoError(SYS_SIGNALFD4, uintptr(fd), uintptr(unsafe.Pointer(mask)), uintptr(flags)) + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + func Statx(dirfd int, path string, flags int, mask int, stat *Statx_t) (err error) { var _p0 *byte _p0, err = BytePtrFromString(path) @@ -1891,6 +1888,26 @@ func Pwrite(fd int, p []byte, offset int64) (n int, err error) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT +func Renameat(olddirfd int, oldpath string, newdirfd int, newpath string) (err error) { + var _p0 *byte + _p0, err = BytePtrFromString(oldpath) + if err != nil { + return + } + var _p1 *byte + _p1, err = BytePtrFromString(newpath) + if err != nil { + return + } + _, _, e1 := Syscall6(SYS_RENAMEAT, uintptr(olddirfd), uintptr(unsafe.Pointer(_p0)), uintptr(newdirfd), uintptr(unsafe.Pointer(_p1)), 0, 0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + func Seek(fd int, offset int64, whence int) (off int64, err error) { r0, _, e1 := Syscall(SYS_LSEEK, uintptr(fd), uintptr(offset), uintptr(whence)) off = int64(r0) diff --git a/src/cmd/vendor/golang.org/x/sys/unix/zsyscall_linux_sparc64.go b/src/cmd/vendor/golang.org/x/sys/unix/zsyscall_linux_sparc64.go index aafe3660fa..5e48a1001b 100644 --- a/src/cmd/vendor/golang.org/x/sys/unix/zsyscall_linux_sparc64.go +++ b/src/cmd/vendor/golang.org/x/sys/unix/zsyscall_linux_sparc64.go @@ -437,6 +437,16 @@ func ClockGettime(clockid int32, time *Timespec) (err error) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT +func ClockNanosleep(clockid int32, flags int, request *Timespec, remain *Timespec) (err error) { + _, _, e1 := Syscall6(SYS_CLOCK_NANOSLEEP, uintptr(clockid), uintptr(flags), uintptr(unsafe.Pointer(request)), uintptr(unsafe.Pointer(remain)), 0, 0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + func Close(fd int) (err error) { _, _, e1 := Syscall(SYS_CLOSE, uintptr(fd), 0, 0) if e1 != 0 { @@ -1195,26 +1205,6 @@ func Removexattr(path string, attr string) (err error) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT -func Renameat(olddirfd int, oldpath string, newdirfd int, newpath string) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(oldpath) - if err != nil { - return - } - var _p1 *byte - _p1, err = BytePtrFromString(newpath) - if err != nil { - return - } - _, _, e1 := Syscall6(SYS_RENAMEAT, uintptr(olddirfd), uintptr(unsafe.Pointer(_p0)), uintptr(newdirfd), uintptr(unsafe.Pointer(_p1)), 0, 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - func Renameat2(olddirfd int, oldpath string, newdirfd int, newpath string, flags uint) (err error) { var _p0 *byte _p0, err = BytePtrFromString(oldpath) @@ -1370,6 +1360,13 @@ func Setxattr(path string, attr string, data []byte, flags int) (err error) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT +func Signalfd(fd int, mask *Sigset_t, flags int) { + SyscallNoError(SYS_SIGNALFD4, uintptr(fd), uintptr(unsafe.Pointer(mask)), uintptr(flags)) + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + func Statx(dirfd int, path string, flags int, mask int, stat *Statx_t) (err error) { var _p0 *byte _p0, err = BytePtrFromString(path) @@ -1890,6 +1887,26 @@ func Pwrite(fd int, p []byte, offset int64) (n int, err error) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT +func Renameat(olddirfd int, oldpath string, newdirfd int, newpath string) (err error) { + var _p0 *byte + _p0, err = BytePtrFromString(oldpath) + if err != nil { + return + } + var _p1 *byte + _p1, err = BytePtrFromString(newpath) + if err != nil { + return + } + _, _, e1 := Syscall6(SYS_RENAMEAT, uintptr(olddirfd), uintptr(unsafe.Pointer(_p0)), uintptr(newdirfd), uintptr(unsafe.Pointer(_p1)), 0, 0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + func Seek(fd int, offset int64, whence int) (off int64, err error) { r0, _, e1 := Syscall(SYS_LSEEK, uintptr(fd), uintptr(offset), uintptr(whence)) off = int64(r0) diff --git a/src/cmd/vendor/golang.org/x/sys/unix/zsyscall_netbsd_arm64.go b/src/cmd/vendor/golang.org/x/sys/unix/zsyscall_netbsd_arm64.go new file mode 100644 index 0000000000..603d144334 --- /dev/null +++ b/src/cmd/vendor/golang.org/x/sys/unix/zsyscall_netbsd_arm64.go @@ -0,0 +1,1826 @@ +// go run mksyscall.go -netbsd -tags netbsd,arm64 syscall_bsd.go syscall_netbsd.go syscall_netbsd_arm64.go +// Code generated by the command above; see README.md. DO NOT EDIT. + +// +build netbsd,arm64 + +package unix + +import ( + "syscall" + "unsafe" +) + +var _ syscall.Errno + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func getgroups(ngid int, gid *_Gid_t) (n int, err error) { + r0, _, e1 := RawSyscall(SYS_GETGROUPS, uintptr(ngid), uintptr(unsafe.Pointer(gid)), 0) + n = int(r0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func setgroups(ngid int, gid *_Gid_t) (err error) { + _, _, e1 := RawSyscall(SYS_SETGROUPS, uintptr(ngid), uintptr(unsafe.Pointer(gid)), 0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func wait4(pid int, wstatus *_C_int, options int, rusage *Rusage) (wpid int, err error) { + r0, _, e1 := Syscall6(SYS_WAIT4, uintptr(pid), uintptr(unsafe.Pointer(wstatus)), uintptr(options), uintptr(unsafe.Pointer(rusage)), 0, 0) + wpid = int(r0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func accept(s int, rsa *RawSockaddrAny, addrlen *_Socklen) (fd int, err error) { + r0, _, e1 := Syscall(SYS_ACCEPT, uintptr(s), uintptr(unsafe.Pointer(rsa)), uintptr(unsafe.Pointer(addrlen))) + fd = int(r0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func bind(s int, addr unsafe.Pointer, addrlen _Socklen) (err error) { + _, _, e1 := Syscall(SYS_BIND, uintptr(s), uintptr(addr), uintptr(addrlen)) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func connect(s int, addr unsafe.Pointer, addrlen _Socklen) (err error) { + _, _, e1 := Syscall(SYS_CONNECT, uintptr(s), uintptr(addr), uintptr(addrlen)) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func socket(domain int, typ int, proto int) (fd int, err error) { + r0, _, e1 := RawSyscall(SYS_SOCKET, uintptr(domain), uintptr(typ), uintptr(proto)) + fd = int(r0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func getsockopt(s int, level int, name int, val unsafe.Pointer, vallen *_Socklen) (err error) { + _, _, e1 := Syscall6(SYS_GETSOCKOPT, uintptr(s), uintptr(level), uintptr(name), uintptr(val), uintptr(unsafe.Pointer(vallen)), 0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func setsockopt(s int, level int, name int, val unsafe.Pointer, vallen uintptr) (err error) { + _, _, e1 := Syscall6(SYS_SETSOCKOPT, uintptr(s), uintptr(level), uintptr(name), uintptr(val), uintptr(vallen), 0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func getpeername(fd int, rsa *RawSockaddrAny, addrlen *_Socklen) (err error) { + _, _, e1 := RawSyscall(SYS_GETPEERNAME, uintptr(fd), uintptr(unsafe.Pointer(rsa)), uintptr(unsafe.Pointer(addrlen))) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func getsockname(fd int, rsa *RawSockaddrAny, addrlen *_Socklen) (err error) { + _, _, e1 := RawSyscall(SYS_GETSOCKNAME, uintptr(fd), uintptr(unsafe.Pointer(rsa)), uintptr(unsafe.Pointer(addrlen))) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func Shutdown(s int, how int) (err error) { + _, _, e1 := Syscall(SYS_SHUTDOWN, uintptr(s), uintptr(how), 0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func socketpair(domain int, typ int, proto int, fd *[2]int32) (err error) { + _, _, e1 := RawSyscall6(SYS_SOCKETPAIR, uintptr(domain), uintptr(typ), uintptr(proto), uintptr(unsafe.Pointer(fd)), 0, 0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func recvfrom(fd int, p []byte, flags int, from *RawSockaddrAny, fromlen *_Socklen) (n int, err error) { + var _p0 unsafe.Pointer + if len(p) > 0 { + _p0 = unsafe.Pointer(&p[0]) + } else { + _p0 = unsafe.Pointer(&_zero) + } + r0, _, e1 := Syscall6(SYS_RECVFROM, uintptr(fd), uintptr(_p0), uintptr(len(p)), uintptr(flags), uintptr(unsafe.Pointer(from)), uintptr(unsafe.Pointer(fromlen))) + n = int(r0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func sendto(s int, buf []byte, flags int, to unsafe.Pointer, addrlen _Socklen) (err error) { + var _p0 unsafe.Pointer + if len(buf) > 0 { + _p0 = unsafe.Pointer(&buf[0]) + } else { + _p0 = unsafe.Pointer(&_zero) + } + _, _, e1 := Syscall6(SYS_SENDTO, uintptr(s), uintptr(_p0), uintptr(len(buf)), uintptr(flags), uintptr(to), uintptr(addrlen)) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func recvmsg(s int, msg *Msghdr, flags int) (n int, err error) { + r0, _, e1 := Syscall(SYS_RECVMSG, uintptr(s), uintptr(unsafe.Pointer(msg)), uintptr(flags)) + n = int(r0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func sendmsg(s int, msg *Msghdr, flags int) (n int, err error) { + r0, _, e1 := Syscall(SYS_SENDMSG, uintptr(s), uintptr(unsafe.Pointer(msg)), uintptr(flags)) + n = int(r0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func kevent(kq int, change unsafe.Pointer, nchange int, event unsafe.Pointer, nevent int, timeout *Timespec) (n int, err error) { + r0, _, e1 := Syscall6(SYS_KEVENT, uintptr(kq), uintptr(change), uintptr(nchange), uintptr(event), uintptr(nevent), uintptr(unsafe.Pointer(timeout))) + n = int(r0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func sysctl(mib []_C_int, old *byte, oldlen *uintptr, new *byte, newlen uintptr) (err error) { + var _p0 unsafe.Pointer + if len(mib) > 0 { + _p0 = unsafe.Pointer(&mib[0]) + } else { + _p0 = unsafe.Pointer(&_zero) + } + _, _, e1 := Syscall6(SYS___SYSCTL, uintptr(_p0), uintptr(len(mib)), uintptr(unsafe.Pointer(old)), uintptr(unsafe.Pointer(oldlen)), uintptr(unsafe.Pointer(new)), uintptr(newlen)) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func utimes(path string, timeval *[2]Timeval) (err error) { + var _p0 *byte + _p0, err = BytePtrFromString(path) + if err != nil { + return + } + _, _, e1 := Syscall(SYS_UTIMES, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(timeval)), 0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func futimes(fd int, timeval *[2]Timeval) (err error) { + _, _, e1 := Syscall(SYS_FUTIMES, uintptr(fd), uintptr(unsafe.Pointer(timeval)), 0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func fcntl(fd int, cmd int, arg int) (val int, err error) { + r0, _, e1 := Syscall(SYS_FCNTL, uintptr(fd), uintptr(cmd), uintptr(arg)) + val = int(r0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func poll(fds *PollFd, nfds int, timeout int) (n int, err error) { + r0, _, e1 := Syscall(SYS_POLL, uintptr(unsafe.Pointer(fds)), uintptr(nfds), uintptr(timeout)) + n = int(r0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func Madvise(b []byte, behav int) (err error) { + var _p0 unsafe.Pointer + if len(b) > 0 { + _p0 = unsafe.Pointer(&b[0]) + } else { + _p0 = unsafe.Pointer(&_zero) + } + _, _, e1 := Syscall(SYS_MADVISE, uintptr(_p0), uintptr(len(b)), uintptr(behav)) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func Mlock(b []byte) (err error) { + var _p0 unsafe.Pointer + if len(b) > 0 { + _p0 = unsafe.Pointer(&b[0]) + } else { + _p0 = unsafe.Pointer(&_zero) + } + _, _, e1 := Syscall(SYS_MLOCK, uintptr(_p0), uintptr(len(b)), 0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func Mlockall(flags int) (err error) { + _, _, e1 := Syscall(SYS_MLOCKALL, uintptr(flags), 0, 0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func Mprotect(b []byte, prot int) (err error) { + var _p0 unsafe.Pointer + if len(b) > 0 { + _p0 = unsafe.Pointer(&b[0]) + } else { + _p0 = unsafe.Pointer(&_zero) + } + _, _, e1 := Syscall(SYS_MPROTECT, uintptr(_p0), uintptr(len(b)), uintptr(prot)) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func Msync(b []byte, flags int) (err error) { + var _p0 unsafe.Pointer + if len(b) > 0 { + _p0 = unsafe.Pointer(&b[0]) + } else { + _p0 = unsafe.Pointer(&_zero) + } + _, _, e1 := Syscall(SYS_MSYNC, uintptr(_p0), uintptr(len(b)), uintptr(flags)) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func Munlock(b []byte) (err error) { + var _p0 unsafe.Pointer + if len(b) > 0 { + _p0 = unsafe.Pointer(&b[0]) + } else { + _p0 = unsafe.Pointer(&_zero) + } + _, _, e1 := Syscall(SYS_MUNLOCK, uintptr(_p0), uintptr(len(b)), 0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func Munlockall() (err error) { + _, _, e1 := Syscall(SYS_MUNLOCKALL, 0, 0, 0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func pipe() (fd1 int, fd2 int, err error) { + r0, r1, e1 := RawSyscall(SYS_PIPE, 0, 0, 0) + fd1 = int(r0) + fd2 = int(r1) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func getdents(fd int, buf []byte) (n int, err error) { + var _p0 unsafe.Pointer + if len(buf) > 0 { + _p0 = unsafe.Pointer(&buf[0]) + } else { + _p0 = unsafe.Pointer(&_zero) + } + r0, _, e1 := Syscall(SYS_GETDENTS, uintptr(fd), uintptr(_p0), uintptr(len(buf))) + n = int(r0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func Getcwd(buf []byte) (n int, err error) { + var _p0 unsafe.Pointer + if len(buf) > 0 { + _p0 = unsafe.Pointer(&buf[0]) + } else { + _p0 = unsafe.Pointer(&_zero) + } + r0, _, e1 := Syscall(SYS___GETCWD, uintptr(_p0), uintptr(len(buf)), 0) + n = int(r0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func ioctl(fd int, req uint, arg uintptr) (err error) { + _, _, e1 := Syscall(SYS_IOCTL, uintptr(fd), uintptr(req), uintptr(arg)) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func Access(path string, mode uint32) (err error) { + var _p0 *byte + _p0, err = BytePtrFromString(path) + if err != nil { + return + } + _, _, e1 := Syscall(SYS_ACCESS, uintptr(unsafe.Pointer(_p0)), uintptr(mode), 0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func Adjtime(delta *Timeval, olddelta *Timeval) (err error) { + _, _, e1 := Syscall(SYS_ADJTIME, uintptr(unsafe.Pointer(delta)), uintptr(unsafe.Pointer(olddelta)), 0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func Chdir(path string) (err error) { + var _p0 *byte + _p0, err = BytePtrFromString(path) + if err != nil { + return + } + _, _, e1 := Syscall(SYS_CHDIR, uintptr(unsafe.Pointer(_p0)), 0, 0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func Chflags(path string, flags int) (err error) { + var _p0 *byte + _p0, err = BytePtrFromString(path) + if err != nil { + return + } + _, _, e1 := Syscall(SYS_CHFLAGS, uintptr(unsafe.Pointer(_p0)), uintptr(flags), 0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func Chmod(path string, mode uint32) (err error) { + var _p0 *byte + _p0, err = BytePtrFromString(path) + if err != nil { + return + } + _, _, e1 := Syscall(SYS_CHMOD, uintptr(unsafe.Pointer(_p0)), uintptr(mode), 0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func Chown(path string, uid int, gid int) (err error) { + var _p0 *byte + _p0, err = BytePtrFromString(path) + if err != nil { + return + } + _, _, e1 := Syscall(SYS_CHOWN, uintptr(unsafe.Pointer(_p0)), uintptr(uid), uintptr(gid)) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func Chroot(path string) (err error) { + var _p0 *byte + _p0, err = BytePtrFromString(path) + if err != nil { + return + } + _, _, e1 := Syscall(SYS_CHROOT, uintptr(unsafe.Pointer(_p0)), 0, 0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func Close(fd int) (err error) { + _, _, e1 := Syscall(SYS_CLOSE, uintptr(fd), 0, 0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func Dup(fd int) (nfd int, err error) { + r0, _, e1 := Syscall(SYS_DUP, uintptr(fd), 0, 0) + nfd = int(r0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func Dup2(from int, to int) (err error) { + _, _, e1 := Syscall(SYS_DUP2, uintptr(from), uintptr(to), 0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func Exit(code int) { + Syscall(SYS_EXIT, uintptr(code), 0, 0) + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func ExtattrGetFd(fd int, attrnamespace int, attrname string, data uintptr, nbytes int) (ret int, err error) { + var _p0 *byte + _p0, err = BytePtrFromString(attrname) + if err != nil { + return + } + r0, _, e1 := Syscall6(SYS_EXTATTR_GET_FD, uintptr(fd), uintptr(attrnamespace), uintptr(unsafe.Pointer(_p0)), uintptr(data), uintptr(nbytes), 0) + ret = int(r0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func ExtattrSetFd(fd int, attrnamespace int, attrname string, data uintptr, nbytes int) (ret int, err error) { + var _p0 *byte + _p0, err = BytePtrFromString(attrname) + if err != nil { + return + } + r0, _, e1 := Syscall6(SYS_EXTATTR_SET_FD, uintptr(fd), uintptr(attrnamespace), uintptr(unsafe.Pointer(_p0)), uintptr(data), uintptr(nbytes), 0) + ret = int(r0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func ExtattrDeleteFd(fd int, attrnamespace int, attrname string) (err error) { + var _p0 *byte + _p0, err = BytePtrFromString(attrname) + if err != nil { + return + } + _, _, e1 := Syscall(SYS_EXTATTR_DELETE_FD, uintptr(fd), uintptr(attrnamespace), uintptr(unsafe.Pointer(_p0))) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func ExtattrListFd(fd int, attrnamespace int, data uintptr, nbytes int) (ret int, err error) { + r0, _, e1 := Syscall6(SYS_EXTATTR_LIST_FD, uintptr(fd), uintptr(attrnamespace), uintptr(data), uintptr(nbytes), 0, 0) + ret = int(r0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func ExtattrGetFile(file string, attrnamespace int, attrname string, data uintptr, nbytes int) (ret int, err error) { + var _p0 *byte + _p0, err = BytePtrFromString(file) + if err != nil { + return + } + var _p1 *byte + _p1, err = BytePtrFromString(attrname) + if err != nil { + return + } + r0, _, e1 := Syscall6(SYS_EXTATTR_GET_FILE, uintptr(unsafe.Pointer(_p0)), uintptr(attrnamespace), uintptr(unsafe.Pointer(_p1)), uintptr(data), uintptr(nbytes), 0) + ret = int(r0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func ExtattrSetFile(file string, attrnamespace int, attrname string, data uintptr, nbytes int) (ret int, err error) { + var _p0 *byte + _p0, err = BytePtrFromString(file) + if err != nil { + return + } + var _p1 *byte + _p1, err = BytePtrFromString(attrname) + if err != nil { + return + } + r0, _, e1 := Syscall6(SYS_EXTATTR_SET_FILE, uintptr(unsafe.Pointer(_p0)), uintptr(attrnamespace), uintptr(unsafe.Pointer(_p1)), uintptr(data), uintptr(nbytes), 0) + ret = int(r0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func ExtattrDeleteFile(file string, attrnamespace int, attrname string) (err error) { + var _p0 *byte + _p0, err = BytePtrFromString(file) + if err != nil { + return + } + var _p1 *byte + _p1, err = BytePtrFromString(attrname) + if err != nil { + return + } + _, _, e1 := Syscall(SYS_EXTATTR_DELETE_FILE, uintptr(unsafe.Pointer(_p0)), uintptr(attrnamespace), uintptr(unsafe.Pointer(_p1))) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func ExtattrListFile(file string, attrnamespace int, data uintptr, nbytes int) (ret int, err error) { + var _p0 *byte + _p0, err = BytePtrFromString(file) + if err != nil { + return + } + r0, _, e1 := Syscall6(SYS_EXTATTR_LIST_FILE, uintptr(unsafe.Pointer(_p0)), uintptr(attrnamespace), uintptr(data), uintptr(nbytes), 0, 0) + ret = int(r0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func ExtattrGetLink(link string, attrnamespace int, attrname string, data uintptr, nbytes int) (ret int, err error) { + var _p0 *byte + _p0, err = BytePtrFromString(link) + if err != nil { + return + } + var _p1 *byte + _p1, err = BytePtrFromString(attrname) + if err != nil { + return + } + r0, _, e1 := Syscall6(SYS_EXTATTR_GET_LINK, uintptr(unsafe.Pointer(_p0)), uintptr(attrnamespace), uintptr(unsafe.Pointer(_p1)), uintptr(data), uintptr(nbytes), 0) + ret = int(r0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func ExtattrSetLink(link string, attrnamespace int, attrname string, data uintptr, nbytes int) (ret int, err error) { + var _p0 *byte + _p0, err = BytePtrFromString(link) + if err != nil { + return + } + var _p1 *byte + _p1, err = BytePtrFromString(attrname) + if err != nil { + return + } + r0, _, e1 := Syscall6(SYS_EXTATTR_SET_LINK, uintptr(unsafe.Pointer(_p0)), uintptr(attrnamespace), uintptr(unsafe.Pointer(_p1)), uintptr(data), uintptr(nbytes), 0) + ret = int(r0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func ExtattrDeleteLink(link string, attrnamespace int, attrname string) (err error) { + var _p0 *byte + _p0, err = BytePtrFromString(link) + if err != nil { + return + } + var _p1 *byte + _p1, err = BytePtrFromString(attrname) + if err != nil { + return + } + _, _, e1 := Syscall(SYS_EXTATTR_DELETE_LINK, uintptr(unsafe.Pointer(_p0)), uintptr(attrnamespace), uintptr(unsafe.Pointer(_p1))) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func ExtattrListLink(link string, attrnamespace int, data uintptr, nbytes int) (ret int, err error) { + var _p0 *byte + _p0, err = BytePtrFromString(link) + if err != nil { + return + } + r0, _, e1 := Syscall6(SYS_EXTATTR_LIST_LINK, uintptr(unsafe.Pointer(_p0)), uintptr(attrnamespace), uintptr(data), uintptr(nbytes), 0, 0) + ret = int(r0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func Faccessat(dirfd int, path string, mode uint32, flags int) (err error) { + var _p0 *byte + _p0, err = BytePtrFromString(path) + if err != nil { + return + } + _, _, e1 := Syscall6(SYS_FACCESSAT, uintptr(dirfd), uintptr(unsafe.Pointer(_p0)), uintptr(mode), uintptr(flags), 0, 0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func Fadvise(fd int, offset int64, length int64, advice int) (err error) { + _, _, e1 := Syscall6(SYS_POSIX_FADVISE, uintptr(fd), 0, uintptr(offset), 0, uintptr(length), uintptr(advice)) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func Fchdir(fd int) (err error) { + _, _, e1 := Syscall(SYS_FCHDIR, uintptr(fd), 0, 0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func Fchflags(fd int, flags int) (err error) { + _, _, e1 := Syscall(SYS_FCHFLAGS, uintptr(fd), uintptr(flags), 0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func Fchmod(fd int, mode uint32) (err error) { + _, _, e1 := Syscall(SYS_FCHMOD, uintptr(fd), uintptr(mode), 0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func Fchmodat(dirfd int, path string, mode uint32, flags int) (err error) { + var _p0 *byte + _p0, err = BytePtrFromString(path) + if err != nil { + return + } + _, _, e1 := Syscall6(SYS_FCHMODAT, uintptr(dirfd), uintptr(unsafe.Pointer(_p0)), uintptr(mode), uintptr(flags), 0, 0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func Fchown(fd int, uid int, gid int) (err error) { + _, _, e1 := Syscall(SYS_FCHOWN, uintptr(fd), uintptr(uid), uintptr(gid)) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func Fchownat(dirfd int, path string, uid int, gid int, flags int) (err error) { + var _p0 *byte + _p0, err = BytePtrFromString(path) + if err != nil { + return + } + _, _, e1 := Syscall6(SYS_FCHOWNAT, uintptr(dirfd), uintptr(unsafe.Pointer(_p0)), uintptr(uid), uintptr(gid), uintptr(flags), 0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func Flock(fd int, how int) (err error) { + _, _, e1 := Syscall(SYS_FLOCK, uintptr(fd), uintptr(how), 0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func Fpathconf(fd int, name int) (val int, err error) { + r0, _, e1 := Syscall(SYS_FPATHCONF, uintptr(fd), uintptr(name), 0) + val = int(r0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func Fstat(fd int, stat *Stat_t) (err error) { + _, _, e1 := Syscall(SYS_FSTAT, uintptr(fd), uintptr(unsafe.Pointer(stat)), 0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func Fstatat(fd int, path string, stat *Stat_t, flags int) (err error) { + var _p0 *byte + _p0, err = BytePtrFromString(path) + if err != nil { + return + } + _, _, e1 := Syscall6(SYS_FSTATAT, uintptr(fd), uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(stat)), uintptr(flags), 0, 0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func Fsync(fd int) (err error) { + _, _, e1 := Syscall(SYS_FSYNC, uintptr(fd), 0, 0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func Ftruncate(fd int, length int64) (err error) { + _, _, e1 := Syscall(SYS_FTRUNCATE, uintptr(fd), 0, uintptr(length)) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func Getegid() (egid int) { + r0, _, _ := RawSyscall(SYS_GETEGID, 0, 0, 0) + egid = int(r0) + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func Geteuid() (uid int) { + r0, _, _ := RawSyscall(SYS_GETEUID, 0, 0, 0) + uid = int(r0) + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func Getgid() (gid int) { + r0, _, _ := RawSyscall(SYS_GETGID, 0, 0, 0) + gid = int(r0) + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func Getpgid(pid int) (pgid int, err error) { + r0, _, e1 := RawSyscall(SYS_GETPGID, uintptr(pid), 0, 0) + pgid = int(r0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func Getpgrp() (pgrp int) { + r0, _, _ := RawSyscall(SYS_GETPGRP, 0, 0, 0) + pgrp = int(r0) + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func Getpid() (pid int) { + r0, _, _ := RawSyscall(SYS_GETPID, 0, 0, 0) + pid = int(r0) + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func Getppid() (ppid int) { + r0, _, _ := RawSyscall(SYS_GETPPID, 0, 0, 0) + ppid = int(r0) + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func Getpriority(which int, who int) (prio int, err error) { + r0, _, e1 := Syscall(SYS_GETPRIORITY, uintptr(which), uintptr(who), 0) + prio = int(r0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func Getrlimit(which int, lim *Rlimit) (err error) { + _, _, e1 := RawSyscall(SYS_GETRLIMIT, uintptr(which), uintptr(unsafe.Pointer(lim)), 0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func Getrusage(who int, rusage *Rusage) (err error) { + _, _, e1 := RawSyscall(SYS_GETRUSAGE, uintptr(who), uintptr(unsafe.Pointer(rusage)), 0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func Getsid(pid int) (sid int, err error) { + r0, _, e1 := RawSyscall(SYS_GETSID, uintptr(pid), 0, 0) + sid = int(r0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func Gettimeofday(tv *Timeval) (err error) { + _, _, e1 := RawSyscall(SYS_GETTIMEOFDAY, uintptr(unsafe.Pointer(tv)), 0, 0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func Getuid() (uid int) { + r0, _, _ := RawSyscall(SYS_GETUID, 0, 0, 0) + uid = int(r0) + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func Issetugid() (tainted bool) { + r0, _, _ := Syscall(SYS_ISSETUGID, 0, 0, 0) + tainted = bool(r0 != 0) + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func Kill(pid int, signum syscall.Signal) (err error) { + _, _, e1 := Syscall(SYS_KILL, uintptr(pid), uintptr(signum), 0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func Kqueue() (fd int, err error) { + r0, _, e1 := Syscall(SYS_KQUEUE, 0, 0, 0) + fd = int(r0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func Lchown(path string, uid int, gid int) (err error) { + var _p0 *byte + _p0, err = BytePtrFromString(path) + if err != nil { + return + } + _, _, e1 := Syscall(SYS_LCHOWN, uintptr(unsafe.Pointer(_p0)), uintptr(uid), uintptr(gid)) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func Link(path string, link string) (err error) { + var _p0 *byte + _p0, err = BytePtrFromString(path) + if err != nil { + return + } + var _p1 *byte + _p1, err = BytePtrFromString(link) + if err != nil { + return + } + _, _, e1 := Syscall(SYS_LINK, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(_p1)), 0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func Linkat(pathfd int, path string, linkfd int, link string, flags int) (err error) { + var _p0 *byte + _p0, err = BytePtrFromString(path) + if err != nil { + return + } + var _p1 *byte + _p1, err = BytePtrFromString(link) + if err != nil { + return + } + _, _, e1 := Syscall6(SYS_LINKAT, uintptr(pathfd), uintptr(unsafe.Pointer(_p0)), uintptr(linkfd), uintptr(unsafe.Pointer(_p1)), uintptr(flags), 0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func Listen(s int, backlog int) (err error) { + _, _, e1 := Syscall(SYS_LISTEN, uintptr(s), uintptr(backlog), 0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func Lstat(path string, stat *Stat_t) (err error) { + var _p0 *byte + _p0, err = BytePtrFromString(path) + if err != nil { + return + } + _, _, e1 := Syscall(SYS_LSTAT, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(stat)), 0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func Mkdir(path string, mode uint32) (err error) { + var _p0 *byte + _p0, err = BytePtrFromString(path) + if err != nil { + return + } + _, _, e1 := Syscall(SYS_MKDIR, uintptr(unsafe.Pointer(_p0)), uintptr(mode), 0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func Mkdirat(dirfd int, path string, mode uint32) (err error) { + var _p0 *byte + _p0, err = BytePtrFromString(path) + if err != nil { + return + } + _, _, e1 := Syscall(SYS_MKDIRAT, uintptr(dirfd), uintptr(unsafe.Pointer(_p0)), uintptr(mode)) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func Mkfifo(path string, mode uint32) (err error) { + var _p0 *byte + _p0, err = BytePtrFromString(path) + if err != nil { + return + } + _, _, e1 := Syscall(SYS_MKFIFO, uintptr(unsafe.Pointer(_p0)), uintptr(mode), 0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func Mkfifoat(dirfd int, path string, mode uint32) (err error) { + var _p0 *byte + _p0, err = BytePtrFromString(path) + if err != nil { + return + } + _, _, e1 := Syscall(SYS_MKFIFOAT, uintptr(dirfd), uintptr(unsafe.Pointer(_p0)), uintptr(mode)) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func Mknod(path string, mode uint32, dev int) (err error) { + var _p0 *byte + _p0, err = BytePtrFromString(path) + if err != nil { + return + } + _, _, e1 := Syscall(SYS_MKNOD, uintptr(unsafe.Pointer(_p0)), uintptr(mode), uintptr(dev)) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func Mknodat(dirfd int, path string, mode uint32, dev int) (err error) { + var _p0 *byte + _p0, err = BytePtrFromString(path) + if err != nil { + return + } + _, _, e1 := Syscall6(SYS_MKNODAT, uintptr(dirfd), uintptr(unsafe.Pointer(_p0)), uintptr(mode), uintptr(dev), 0, 0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func Nanosleep(time *Timespec, leftover *Timespec) (err error) { + _, _, e1 := Syscall(SYS_NANOSLEEP, uintptr(unsafe.Pointer(time)), uintptr(unsafe.Pointer(leftover)), 0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func Open(path string, mode int, perm uint32) (fd int, err error) { + var _p0 *byte + _p0, err = BytePtrFromString(path) + if err != nil { + return + } + r0, _, e1 := Syscall(SYS_OPEN, uintptr(unsafe.Pointer(_p0)), uintptr(mode), uintptr(perm)) + fd = int(r0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func Openat(dirfd int, path string, mode int, perm uint32) (fd int, err error) { + var _p0 *byte + _p0, err = BytePtrFromString(path) + if err != nil { + return + } + r0, _, e1 := Syscall6(SYS_OPENAT, uintptr(dirfd), uintptr(unsafe.Pointer(_p0)), uintptr(mode), uintptr(perm), 0, 0) + fd = int(r0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func Pathconf(path string, name int) (val int, err error) { + var _p0 *byte + _p0, err = BytePtrFromString(path) + if err != nil { + return + } + r0, _, e1 := Syscall(SYS_PATHCONF, uintptr(unsafe.Pointer(_p0)), uintptr(name), 0) + val = int(r0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func Pread(fd int, p []byte, offset int64) (n int, err error) { + var _p0 unsafe.Pointer + if len(p) > 0 { + _p0 = unsafe.Pointer(&p[0]) + } else { + _p0 = unsafe.Pointer(&_zero) + } + r0, _, e1 := Syscall6(SYS_PREAD, uintptr(fd), uintptr(_p0), uintptr(len(p)), 0, uintptr(offset), 0) + n = int(r0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func Pwrite(fd int, p []byte, offset int64) (n int, err error) { + var _p0 unsafe.Pointer + if len(p) > 0 { + _p0 = unsafe.Pointer(&p[0]) + } else { + _p0 = unsafe.Pointer(&_zero) + } + r0, _, e1 := Syscall6(SYS_PWRITE, uintptr(fd), uintptr(_p0), uintptr(len(p)), 0, uintptr(offset), 0) + n = int(r0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func read(fd int, p []byte) (n int, err error) { + var _p0 unsafe.Pointer + if len(p) > 0 { + _p0 = unsafe.Pointer(&p[0]) + } else { + _p0 = unsafe.Pointer(&_zero) + } + r0, _, e1 := Syscall(SYS_READ, uintptr(fd), uintptr(_p0), uintptr(len(p))) + n = int(r0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func Readlink(path string, buf []byte) (n int, err error) { + var _p0 *byte + _p0, err = BytePtrFromString(path) + if err != nil { + return + } + var _p1 unsafe.Pointer + if len(buf) > 0 { + _p1 = unsafe.Pointer(&buf[0]) + } else { + _p1 = unsafe.Pointer(&_zero) + } + r0, _, e1 := Syscall(SYS_READLINK, uintptr(unsafe.Pointer(_p0)), uintptr(_p1), uintptr(len(buf))) + n = int(r0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func Readlinkat(dirfd int, path string, buf []byte) (n int, err error) { + var _p0 *byte + _p0, err = BytePtrFromString(path) + if err != nil { + return + } + var _p1 unsafe.Pointer + if len(buf) > 0 { + _p1 = unsafe.Pointer(&buf[0]) + } else { + _p1 = unsafe.Pointer(&_zero) + } + r0, _, e1 := Syscall6(SYS_READLINKAT, uintptr(dirfd), uintptr(unsafe.Pointer(_p0)), uintptr(_p1), uintptr(len(buf)), 0, 0) + n = int(r0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func Rename(from string, to string) (err error) { + var _p0 *byte + _p0, err = BytePtrFromString(from) + if err != nil { + return + } + var _p1 *byte + _p1, err = BytePtrFromString(to) + if err != nil { + return + } + _, _, e1 := Syscall(SYS_RENAME, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(_p1)), 0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func Renameat(fromfd int, from string, tofd int, to string) (err error) { + var _p0 *byte + _p0, err = BytePtrFromString(from) + if err != nil { + return + } + var _p1 *byte + _p1, err = BytePtrFromString(to) + if err != nil { + return + } + _, _, e1 := Syscall6(SYS_RENAMEAT, uintptr(fromfd), uintptr(unsafe.Pointer(_p0)), uintptr(tofd), uintptr(unsafe.Pointer(_p1)), 0, 0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func Revoke(path string) (err error) { + var _p0 *byte + _p0, err = BytePtrFromString(path) + if err != nil { + return + } + _, _, e1 := Syscall(SYS_REVOKE, uintptr(unsafe.Pointer(_p0)), 0, 0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func Rmdir(path string) (err error) { + var _p0 *byte + _p0, err = BytePtrFromString(path) + if err != nil { + return + } + _, _, e1 := Syscall(SYS_RMDIR, uintptr(unsafe.Pointer(_p0)), 0, 0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func Seek(fd int, offset int64, whence int) (newoffset int64, err error) { + r0, _, e1 := Syscall6(SYS_LSEEK, uintptr(fd), 0, uintptr(offset), uintptr(whence), 0, 0) + newoffset = int64(r0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func Select(n int, r *FdSet, w *FdSet, e *FdSet, timeout *Timeval) (err error) { + _, _, e1 := Syscall6(SYS_SELECT, uintptr(n), uintptr(unsafe.Pointer(r)), uintptr(unsafe.Pointer(w)), uintptr(unsafe.Pointer(e)), uintptr(unsafe.Pointer(timeout)), 0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func Setegid(egid int) (err error) { + _, _, e1 := RawSyscall(SYS_SETEGID, uintptr(egid), 0, 0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func Seteuid(euid int) (err error) { + _, _, e1 := RawSyscall(SYS_SETEUID, uintptr(euid), 0, 0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func Setgid(gid int) (err error) { + _, _, e1 := RawSyscall(SYS_SETGID, uintptr(gid), 0, 0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func Setpgid(pid int, pgid int) (err error) { + _, _, e1 := RawSyscall(SYS_SETPGID, uintptr(pid), uintptr(pgid), 0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func Setpriority(which int, who int, prio int) (err error) { + _, _, e1 := Syscall(SYS_SETPRIORITY, uintptr(which), uintptr(who), uintptr(prio)) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func Setregid(rgid int, egid int) (err error) { + _, _, e1 := RawSyscall(SYS_SETREGID, uintptr(rgid), uintptr(egid), 0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func Setreuid(ruid int, euid int) (err error) { + _, _, e1 := RawSyscall(SYS_SETREUID, uintptr(ruid), uintptr(euid), 0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func Setrlimit(which int, lim *Rlimit) (err error) { + _, _, e1 := RawSyscall(SYS_SETRLIMIT, uintptr(which), uintptr(unsafe.Pointer(lim)), 0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func Setsid() (pid int, err error) { + r0, _, e1 := RawSyscall(SYS_SETSID, 0, 0, 0) + pid = int(r0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func Settimeofday(tp *Timeval) (err error) { + _, _, e1 := RawSyscall(SYS_SETTIMEOFDAY, uintptr(unsafe.Pointer(tp)), 0, 0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func Setuid(uid int) (err error) { + _, _, e1 := RawSyscall(SYS_SETUID, uintptr(uid), 0, 0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func Stat(path string, stat *Stat_t) (err error) { + var _p0 *byte + _p0, err = BytePtrFromString(path) + if err != nil { + return + } + _, _, e1 := Syscall(SYS_STAT, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(stat)), 0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func Symlink(path string, link string) (err error) { + var _p0 *byte + _p0, err = BytePtrFromString(path) + if err != nil { + return + } + var _p1 *byte + _p1, err = BytePtrFromString(link) + if err != nil { + return + } + _, _, e1 := Syscall(SYS_SYMLINK, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(_p1)), 0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func Symlinkat(oldpath string, newdirfd int, newpath string) (err error) { + var _p0 *byte + _p0, err = BytePtrFromString(oldpath) + if err != nil { + return + } + var _p1 *byte + _p1, err = BytePtrFromString(newpath) + if err != nil { + return + } + _, _, e1 := Syscall(SYS_SYMLINKAT, uintptr(unsafe.Pointer(_p0)), uintptr(newdirfd), uintptr(unsafe.Pointer(_p1))) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func Sync() (err error) { + _, _, e1 := Syscall(SYS_SYNC, 0, 0, 0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func Truncate(path string, length int64) (err error) { + var _p0 *byte + _p0, err = BytePtrFromString(path) + if err != nil { + return + } + _, _, e1 := Syscall(SYS_TRUNCATE, uintptr(unsafe.Pointer(_p0)), 0, uintptr(length)) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func Umask(newmask int) (oldmask int) { + r0, _, _ := Syscall(SYS_UMASK, uintptr(newmask), 0, 0) + oldmask = int(r0) + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func Unlink(path string) (err error) { + var _p0 *byte + _p0, err = BytePtrFromString(path) + if err != nil { + return + } + _, _, e1 := Syscall(SYS_UNLINK, uintptr(unsafe.Pointer(_p0)), 0, 0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func Unlinkat(dirfd int, path string, flags int) (err error) { + var _p0 *byte + _p0, err = BytePtrFromString(path) + if err != nil { + return + } + _, _, e1 := Syscall(SYS_UNLINKAT, uintptr(dirfd), uintptr(unsafe.Pointer(_p0)), uintptr(flags)) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func Unmount(path string, flags int) (err error) { + var _p0 *byte + _p0, err = BytePtrFromString(path) + if err != nil { + return + } + _, _, e1 := Syscall(SYS_UNMOUNT, uintptr(unsafe.Pointer(_p0)), uintptr(flags), 0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func write(fd int, p []byte) (n int, err error) { + var _p0 unsafe.Pointer + if len(p) > 0 { + _p0 = unsafe.Pointer(&p[0]) + } else { + _p0 = unsafe.Pointer(&_zero) + } + r0, _, e1 := Syscall(SYS_WRITE, uintptr(fd), uintptr(_p0), uintptr(len(p))) + n = int(r0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func mmap(addr uintptr, length uintptr, prot int, flag int, fd int, pos int64) (ret uintptr, err error) { + r0, _, e1 := Syscall9(SYS_MMAP, uintptr(addr), uintptr(length), uintptr(prot), uintptr(flag), uintptr(fd), 0, uintptr(pos), 0, 0) + ret = uintptr(r0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func munmap(addr uintptr, length uintptr) (err error) { + _, _, e1 := Syscall(SYS_MUNMAP, uintptr(addr), uintptr(length), 0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func readlen(fd int, buf *byte, nbuf int) (n int, err error) { + r0, _, e1 := Syscall(SYS_READ, uintptr(fd), uintptr(unsafe.Pointer(buf)), uintptr(nbuf)) + n = int(r0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func writelen(fd int, buf *byte, nbuf int) (n int, err error) { + r0, _, e1 := Syscall(SYS_WRITE, uintptr(fd), uintptr(unsafe.Pointer(buf)), uintptr(nbuf)) + n = int(r0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func utimensat(dirfd int, path string, times *[2]Timespec, flags int) (err error) { + var _p0 *byte + _p0, err = BytePtrFromString(path) + if err != nil { + return + } + _, _, e1 := Syscall6(SYS_UTIMENSAT, uintptr(dirfd), uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(times)), uintptr(flags), 0, 0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} diff --git a/src/cmd/vendor/golang.org/x/sys/unix/zsyscall_solaris_amd64.go b/src/cmd/vendor/golang.org/x/sys/unix/zsyscall_solaris_amd64.go index 97b22a499e..5f614760c6 100644 --- a/src/cmd/vendor/golang.org/x/sys/unix/zsyscall_solaris_amd64.go +++ b/src/cmd/vendor/golang.org/x/sys/unix/zsyscall_solaris_amd64.go @@ -1,4 +1,4 @@ -// mksyscall_solaris.pl -tags solaris,amd64 syscall_solaris.go syscall_solaris_amd64.go +// go run mksyscall_solaris.go -tags solaris,amd64 syscall_solaris.go syscall_solaris_amd64.go // Code generated by the command above; see README.md. DO NOT EDIT. // +build solaris,amd64 diff --git a/src/cmd/vendor/golang.org/x/sys/unix/zsysnum_darwin_amd64.go b/src/cmd/vendor/golang.org/x/sys/unix/zsysnum_darwin_amd64.go index 9e2837e0e3..654dd3da3b 100644 --- a/src/cmd/vendor/golang.org/x/sys/unix/zsysnum_darwin_amd64.go +++ b/src/cmd/vendor/golang.org/x/sys/unix/zsysnum_darwin_amd64.go @@ -1,4 +1,4 @@ -// go run mksysnum.go /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.13.sdk/usr/include/sys/syscall.h +// go run mksysnum.go /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk/usr/include/sys/syscall.h // Code generated by the command above; see README.md. DO NOT EDIT. // +build amd64,darwin @@ -431,6 +431,8 @@ const ( SYS_NTP_ADJTIME = 527 SYS_NTP_GETTIME = 528 SYS_OS_FAULT_WITH_PAYLOAD = 529 - SYS_MAXSYSCALL = 530 + SYS_KQUEUE_WORKLOOP_CTL = 530 + SYS___MACH_BRIDGE_REMOTE_TIME = 531 + SYS_MAXSYSCALL = 532 SYS_INVALID = 63 ) diff --git a/src/cmd/vendor/golang.org/x/sys/unix/zsysnum_dragonfly_amd64.go b/src/cmd/vendor/golang.org/x/sys/unix/zsysnum_dragonfly_amd64.go index ff3976edbb..464c9a9832 100644 --- a/src/cmd/vendor/golang.org/x/sys/unix/zsysnum_dragonfly_amd64.go +++ b/src/cmd/vendor/golang.org/x/sys/unix/zsysnum_dragonfly_amd64.go @@ -1,4 +1,4 @@ -// go run mksysnum.go http://gitweb.dragonflybsd.org/dragonfly.git/blob_plain/HEAD:/sys/kern/syscalls.master +// go run mksysnum.go https://gitweb.dragonflybsd.org/dragonfly.git/blob_plain/HEAD:/sys/kern/syscalls.master // Code generated by the command above; see README.md. DO NOT EDIT. // +build amd64,dragonfly diff --git a/src/cmd/vendor/golang.org/x/sys/unix/zsysnum_freebsd_386.go b/src/cmd/vendor/golang.org/x/sys/unix/zsysnum_freebsd_386.go index b1e81b7172..55c3a32945 100644 --- a/src/cmd/vendor/golang.org/x/sys/unix/zsysnum_freebsd_386.go +++ b/src/cmd/vendor/golang.org/x/sys/unix/zsysnum_freebsd_386.go @@ -1,4 +1,4 @@ -// go run mksysnum.go http://svn.freebsd.org/base/stable/10/sys/kern/syscalls.master +// go run mksysnum.go https://svn.freebsd.org/base/stable/10/sys/kern/syscalls.master // Code generated by the command above; see README.md. DO NOT EDIT. // +build 386,freebsd diff --git a/src/cmd/vendor/golang.org/x/sys/unix/zsysnum_freebsd_amd64.go b/src/cmd/vendor/golang.org/x/sys/unix/zsysnum_freebsd_amd64.go index 73e277fe7a..b39be6cb8f 100644 --- a/src/cmd/vendor/golang.org/x/sys/unix/zsysnum_freebsd_amd64.go +++ b/src/cmd/vendor/golang.org/x/sys/unix/zsysnum_freebsd_amd64.go @@ -1,4 +1,4 @@ -// go run mksysnum.go http://svn.freebsd.org/base/stable/10/sys/kern/syscalls.master +// go run mksysnum.go https://svn.freebsd.org/base/stable/10/sys/kern/syscalls.master // Code generated by the command above; see README.md. DO NOT EDIT. // +build amd64,freebsd diff --git a/src/cmd/vendor/golang.org/x/sys/unix/zsysnum_freebsd_arm.go b/src/cmd/vendor/golang.org/x/sys/unix/zsysnum_freebsd_arm.go index e12b469196..44ffd4ce5e 100644 --- a/src/cmd/vendor/golang.org/x/sys/unix/zsysnum_freebsd_arm.go +++ b/src/cmd/vendor/golang.org/x/sys/unix/zsysnum_freebsd_arm.go @@ -1,4 +1,4 @@ -// go run mksysnum.go http://svn.freebsd.org/base/stable/10/sys/kern/syscalls.master +// go run mksysnum.go https://svn.freebsd.org/base/stable/10/sys/kern/syscalls.master // Code generated by the command above; see README.md. DO NOT EDIT. // +build arm,freebsd diff --git a/src/cmd/vendor/golang.org/x/sys/unix/zsysnum_freebsd_arm64.go b/src/cmd/vendor/golang.org/x/sys/unix/zsysnum_freebsd_arm64.go index 8c1e16ca51..9f21e9550e 100644 --- a/src/cmd/vendor/golang.org/x/sys/unix/zsysnum_freebsd_arm64.go +++ b/src/cmd/vendor/golang.org/x/sys/unix/zsysnum_freebsd_arm64.go @@ -1,4 +1,4 @@ -// mksysnum_freebsd.pl +// go run mksysnum.go https://svn.freebsd.org/base/stable/10/sys/kern/syscalls.master // Code generated by the command above; see README.md. DO NOT EDIT. // +build arm64,freebsd diff --git a/src/cmd/vendor/golang.org/x/sys/unix/zsysnum_netbsd_arm64.go b/src/cmd/vendor/golang.org/x/sys/unix/zsysnum_netbsd_arm64.go new file mode 100644 index 0000000000..0291c0931b --- /dev/null +++ b/src/cmd/vendor/golang.org/x/sys/unix/zsysnum_netbsd_arm64.go @@ -0,0 +1,274 @@ +// go run mksysnum.go http://cvsweb.netbsd.org/bsdweb.cgi/~checkout~/src/sys/kern/syscalls.master +// Code generated by the command above; DO NOT EDIT. + +// +build arm64,netbsd + +package unix + +const ( + SYS_EXIT = 1 // { void|sys||exit(int rval); } + SYS_FORK = 2 // { int|sys||fork(void); } + SYS_READ = 3 // { ssize_t|sys||read(int fd, void *buf, size_t nbyte); } + SYS_WRITE = 4 // { ssize_t|sys||write(int fd, const void *buf, size_t nbyte); } + SYS_OPEN = 5 // { int|sys||open(const char *path, int flags, ... mode_t mode); } + SYS_CLOSE = 6 // { int|sys||close(int fd); } + SYS_LINK = 9 // { int|sys||link(const char *path, const char *link); } + SYS_UNLINK = 10 // { int|sys||unlink(const char *path); } + SYS_CHDIR = 12 // { int|sys||chdir(const char *path); } + SYS_FCHDIR = 13 // { int|sys||fchdir(int fd); } + SYS_CHMOD = 15 // { int|sys||chmod(const char *path, mode_t mode); } + SYS_CHOWN = 16 // { int|sys||chown(const char *path, uid_t uid, gid_t gid); } + SYS_BREAK = 17 // { int|sys||obreak(char *nsize); } + SYS_GETPID = 20 // { pid_t|sys||getpid_with_ppid(void); } + SYS_UNMOUNT = 22 // { int|sys||unmount(const char *path, int flags); } + SYS_SETUID = 23 // { int|sys||setuid(uid_t uid); } + SYS_GETUID = 24 // { uid_t|sys||getuid_with_euid(void); } + SYS_GETEUID = 25 // { uid_t|sys||geteuid(void); } + SYS_PTRACE = 26 // { int|sys||ptrace(int req, pid_t pid, void *addr, int data); } + SYS_RECVMSG = 27 // { ssize_t|sys||recvmsg(int s, struct msghdr *msg, int flags); } + SYS_SENDMSG = 28 // { ssize_t|sys||sendmsg(int s, const struct msghdr *msg, int flags); } + SYS_RECVFROM = 29 // { ssize_t|sys||recvfrom(int s, void *buf, size_t len, int flags, struct sockaddr *from, socklen_t *fromlenaddr); } + SYS_ACCEPT = 30 // { int|sys||accept(int s, struct sockaddr *name, socklen_t *anamelen); } + SYS_GETPEERNAME = 31 // { int|sys||getpeername(int fdes, struct sockaddr *asa, socklen_t *alen); } + SYS_GETSOCKNAME = 32 // { int|sys||getsockname(int fdes, struct sockaddr *asa, socklen_t *alen); } + SYS_ACCESS = 33 // { int|sys||access(const char *path, int flags); } + SYS_CHFLAGS = 34 // { int|sys||chflags(const char *path, u_long flags); } + SYS_FCHFLAGS = 35 // { int|sys||fchflags(int fd, u_long flags); } + SYS_SYNC = 36 // { void|sys||sync(void); } + SYS_KILL = 37 // { int|sys||kill(pid_t pid, int signum); } + SYS_GETPPID = 39 // { pid_t|sys||getppid(void); } + SYS_DUP = 41 // { int|sys||dup(int fd); } + SYS_PIPE = 42 // { int|sys||pipe(void); } + SYS_GETEGID = 43 // { gid_t|sys||getegid(void); } + SYS_PROFIL = 44 // { int|sys||profil(char *samples, size_t size, u_long offset, u_int scale); } + SYS_KTRACE = 45 // { int|sys||ktrace(const char *fname, int ops, int facs, pid_t pid); } + SYS_GETGID = 47 // { gid_t|sys||getgid_with_egid(void); } + SYS___GETLOGIN = 49 // { int|sys||__getlogin(char *namebuf, size_t namelen); } + SYS___SETLOGIN = 50 // { int|sys||__setlogin(const char *namebuf); } + SYS_ACCT = 51 // { int|sys||acct(const char *path); } + SYS_IOCTL = 54 // { int|sys||ioctl(int fd, u_long com, ... void *data); } + SYS_REVOKE = 56 // { int|sys||revoke(const char *path); } + SYS_SYMLINK = 57 // { int|sys||symlink(const char *path, const char *link); } + SYS_READLINK = 58 // { ssize_t|sys||readlink(const char *path, char *buf, size_t count); } + SYS_EXECVE = 59 // { int|sys||execve(const char *path, char * const *argp, char * const *envp); } + SYS_UMASK = 60 // { mode_t|sys||umask(mode_t newmask); } + SYS_CHROOT = 61 // { int|sys||chroot(const char *path); } + SYS_VFORK = 66 // { int|sys||vfork(void); } + SYS_SBRK = 69 // { int|sys||sbrk(intptr_t incr); } + SYS_SSTK = 70 // { int|sys||sstk(int incr); } + SYS_VADVISE = 72 // { int|sys||ovadvise(int anom); } + SYS_MUNMAP = 73 // { int|sys||munmap(void *addr, size_t len); } + SYS_MPROTECT = 74 // { int|sys||mprotect(void *addr, size_t len, int prot); } + SYS_MADVISE = 75 // { int|sys||madvise(void *addr, size_t len, int behav); } + SYS_MINCORE = 78 // { int|sys||mincore(void *addr, size_t len, char *vec); } + SYS_GETGROUPS = 79 // { int|sys||getgroups(int gidsetsize, gid_t *gidset); } + SYS_SETGROUPS = 80 // { int|sys||setgroups(int gidsetsize, const gid_t *gidset); } + SYS_GETPGRP = 81 // { int|sys||getpgrp(void); } + SYS_SETPGID = 82 // { int|sys||setpgid(pid_t pid, pid_t pgid); } + SYS_DUP2 = 90 // { int|sys||dup2(int from, int to); } + SYS_FCNTL = 92 // { int|sys||fcntl(int fd, int cmd, ... void *arg); } + SYS_FSYNC = 95 // { int|sys||fsync(int fd); } + SYS_SETPRIORITY = 96 // { int|sys||setpriority(int which, id_t who, int prio); } + SYS_CONNECT = 98 // { int|sys||connect(int s, const struct sockaddr *name, socklen_t namelen); } + SYS_GETPRIORITY = 100 // { int|sys||getpriority(int which, id_t who); } + SYS_BIND = 104 // { int|sys||bind(int s, const struct sockaddr *name, socklen_t namelen); } + SYS_SETSOCKOPT = 105 // { int|sys||setsockopt(int s, int level, int name, const void *val, socklen_t valsize); } + SYS_LISTEN = 106 // { int|sys||listen(int s, int backlog); } + SYS_GETSOCKOPT = 118 // { int|sys||getsockopt(int s, int level, int name, void *val, socklen_t *avalsize); } + SYS_READV = 120 // { ssize_t|sys||readv(int fd, const struct iovec *iovp, int iovcnt); } + SYS_WRITEV = 121 // { ssize_t|sys||writev(int fd, const struct iovec *iovp, int iovcnt); } + SYS_FCHOWN = 123 // { int|sys||fchown(int fd, uid_t uid, gid_t gid); } + SYS_FCHMOD = 124 // { int|sys||fchmod(int fd, mode_t mode); } + SYS_SETREUID = 126 // { int|sys||setreuid(uid_t ruid, uid_t euid); } + SYS_SETREGID = 127 // { int|sys||setregid(gid_t rgid, gid_t egid); } + SYS_RENAME = 128 // { int|sys||rename(const char *from, const char *to); } + SYS_FLOCK = 131 // { int|sys||flock(int fd, int how); } + SYS_MKFIFO = 132 // { int|sys||mkfifo(const char *path, mode_t mode); } + SYS_SENDTO = 133 // { ssize_t|sys||sendto(int s, const void *buf, size_t len, int flags, const struct sockaddr *to, socklen_t tolen); } + SYS_SHUTDOWN = 134 // { int|sys||shutdown(int s, int how); } + SYS_SOCKETPAIR = 135 // { int|sys||socketpair(int domain, int type, int protocol, int *rsv); } + SYS_MKDIR = 136 // { int|sys||mkdir(const char *path, mode_t mode); } + SYS_RMDIR = 137 // { int|sys||rmdir(const char *path); } + SYS_SETSID = 147 // { int|sys||setsid(void); } + SYS_SYSARCH = 165 // { int|sys||sysarch(int op, void *parms); } + SYS_PREAD = 173 // { ssize_t|sys||pread(int fd, void *buf, size_t nbyte, int PAD, off_t offset); } + SYS_PWRITE = 174 // { ssize_t|sys||pwrite(int fd, const void *buf, size_t nbyte, int PAD, off_t offset); } + SYS_NTP_ADJTIME = 176 // { int|sys||ntp_adjtime(struct timex *tp); } + SYS_SETGID = 181 // { int|sys||setgid(gid_t gid); } + SYS_SETEGID = 182 // { int|sys||setegid(gid_t egid); } + SYS_SETEUID = 183 // { int|sys||seteuid(uid_t euid); } + SYS_PATHCONF = 191 // { long|sys||pathconf(const char *path, int name); } + SYS_FPATHCONF = 192 // { long|sys||fpathconf(int fd, int name); } + SYS_GETRLIMIT = 194 // { int|sys||getrlimit(int which, struct rlimit *rlp); } + SYS_SETRLIMIT = 195 // { int|sys||setrlimit(int which, const struct rlimit *rlp); } + SYS_MMAP = 197 // { void *|sys||mmap(void *addr, size_t len, int prot, int flags, int fd, long PAD, off_t pos); } + SYS_LSEEK = 199 // { off_t|sys||lseek(int fd, int PAD, off_t offset, int whence); } + SYS_TRUNCATE = 200 // { int|sys||truncate(const char *path, int PAD, off_t length); } + SYS_FTRUNCATE = 201 // { int|sys||ftruncate(int fd, int PAD, off_t length); } + SYS___SYSCTL = 202 // { int|sys||__sysctl(const int *name, u_int namelen, void *old, size_t *oldlenp, const void *new, size_t newlen); } + SYS_MLOCK = 203 // { int|sys||mlock(const void *addr, size_t len); } + SYS_MUNLOCK = 204 // { int|sys||munlock(const void *addr, size_t len); } + SYS_UNDELETE = 205 // { int|sys||undelete(const char *path); } + SYS_GETPGID = 207 // { pid_t|sys||getpgid(pid_t pid); } + SYS_REBOOT = 208 // { int|sys||reboot(int opt, char *bootstr); } + SYS_POLL = 209 // { int|sys||poll(struct pollfd *fds, u_int nfds, int timeout); } + SYS_SEMGET = 221 // { int|sys||semget(key_t key, int nsems, int semflg); } + SYS_SEMOP = 222 // { int|sys||semop(int semid, struct sembuf *sops, size_t nsops); } + SYS_SEMCONFIG = 223 // { int|sys||semconfig(int flag); } + SYS_MSGGET = 225 // { int|sys||msgget(key_t key, int msgflg); } + SYS_MSGSND = 226 // { int|sys||msgsnd(int msqid, const void *msgp, size_t msgsz, int msgflg); } + SYS_MSGRCV = 227 // { ssize_t|sys||msgrcv(int msqid, void *msgp, size_t msgsz, long msgtyp, int msgflg); } + SYS_SHMAT = 228 // { void *|sys||shmat(int shmid, const void *shmaddr, int shmflg); } + SYS_SHMDT = 230 // { int|sys||shmdt(const void *shmaddr); } + SYS_SHMGET = 231 // { int|sys||shmget(key_t key, size_t size, int shmflg); } + SYS_TIMER_CREATE = 235 // { int|sys||timer_create(clockid_t clock_id, struct sigevent *evp, timer_t *timerid); } + SYS_TIMER_DELETE = 236 // { int|sys||timer_delete(timer_t timerid); } + SYS_TIMER_GETOVERRUN = 239 // { int|sys||timer_getoverrun(timer_t timerid); } + SYS_FDATASYNC = 241 // { int|sys||fdatasync(int fd); } + SYS_MLOCKALL = 242 // { int|sys||mlockall(int flags); } + SYS_MUNLOCKALL = 243 // { int|sys||munlockall(void); } + SYS_SIGQUEUEINFO = 245 // { int|sys||sigqueueinfo(pid_t pid, const siginfo_t *info); } + SYS_MODCTL = 246 // { int|sys||modctl(int cmd, void *arg); } + SYS___POSIX_RENAME = 270 // { int|sys||__posix_rename(const char *from, const char *to); } + SYS_SWAPCTL = 271 // { int|sys||swapctl(int cmd, void *arg, int misc); } + SYS_MINHERIT = 273 // { int|sys||minherit(void *addr, size_t len, int inherit); } + SYS_LCHMOD = 274 // { int|sys||lchmod(const char *path, mode_t mode); } + SYS_LCHOWN = 275 // { int|sys||lchown(const char *path, uid_t uid, gid_t gid); } + SYS_MSYNC = 277 // { int|sys|13|msync(void *addr, size_t len, int flags); } + SYS___POSIX_CHOWN = 283 // { int|sys||__posix_chown(const char *path, uid_t uid, gid_t gid); } + SYS___POSIX_FCHOWN = 284 // { int|sys||__posix_fchown(int fd, uid_t uid, gid_t gid); } + SYS___POSIX_LCHOWN = 285 // { int|sys||__posix_lchown(const char *path, uid_t uid, gid_t gid); } + SYS_GETSID = 286 // { pid_t|sys||getsid(pid_t pid); } + SYS___CLONE = 287 // { pid_t|sys||__clone(int flags, void *stack); } + SYS_FKTRACE = 288 // { int|sys||fktrace(int fd, int ops, int facs, pid_t pid); } + SYS_PREADV = 289 // { ssize_t|sys||preadv(int fd, const struct iovec *iovp, int iovcnt, int PAD, off_t offset); } + SYS_PWRITEV = 290 // { ssize_t|sys||pwritev(int fd, const struct iovec *iovp, int iovcnt, int PAD, off_t offset); } + SYS___GETCWD = 296 // { int|sys||__getcwd(char *bufp, size_t length); } + SYS_FCHROOT = 297 // { int|sys||fchroot(int fd); } + SYS_LCHFLAGS = 304 // { int|sys||lchflags(const char *path, u_long flags); } + SYS_ISSETUGID = 305 // { int|sys||issetugid(void); } + SYS_UTRACE = 306 // { int|sys||utrace(const char *label, void *addr, size_t len); } + SYS_GETCONTEXT = 307 // { int|sys||getcontext(struct __ucontext *ucp); } + SYS_SETCONTEXT = 308 // { int|sys||setcontext(const struct __ucontext *ucp); } + SYS__LWP_CREATE = 309 // { int|sys||_lwp_create(const struct __ucontext *ucp, u_long flags, lwpid_t *new_lwp); } + SYS__LWP_EXIT = 310 // { int|sys||_lwp_exit(void); } + SYS__LWP_SELF = 311 // { lwpid_t|sys||_lwp_self(void); } + SYS__LWP_WAIT = 312 // { int|sys||_lwp_wait(lwpid_t wait_for, lwpid_t *departed); } + SYS__LWP_SUSPEND = 313 // { int|sys||_lwp_suspend(lwpid_t target); } + SYS__LWP_CONTINUE = 314 // { int|sys||_lwp_continue(lwpid_t target); } + SYS__LWP_WAKEUP = 315 // { int|sys||_lwp_wakeup(lwpid_t target); } + SYS__LWP_GETPRIVATE = 316 // { void *|sys||_lwp_getprivate(void); } + SYS__LWP_SETPRIVATE = 317 // { void|sys||_lwp_setprivate(void *ptr); } + SYS__LWP_KILL = 318 // { int|sys||_lwp_kill(lwpid_t target, int signo); } + SYS__LWP_DETACH = 319 // { int|sys||_lwp_detach(lwpid_t target); } + SYS__LWP_UNPARK = 321 // { int|sys||_lwp_unpark(lwpid_t target, const void *hint); } + SYS__LWP_UNPARK_ALL = 322 // { ssize_t|sys||_lwp_unpark_all(const lwpid_t *targets, size_t ntargets, const void *hint); } + SYS__LWP_SETNAME = 323 // { int|sys||_lwp_setname(lwpid_t target, const char *name); } + SYS__LWP_GETNAME = 324 // { int|sys||_lwp_getname(lwpid_t target, char *name, size_t len); } + SYS__LWP_CTL = 325 // { int|sys||_lwp_ctl(int features, struct lwpctl **address); } + SYS___SIGACTION_SIGTRAMP = 340 // { int|sys||__sigaction_sigtramp(int signum, const struct sigaction *nsa, struct sigaction *osa, const void *tramp, int vers); } + SYS_PMC_GET_INFO = 341 // { int|sys||pmc_get_info(int ctr, int op, void *args); } + SYS_PMC_CONTROL = 342 // { int|sys||pmc_control(int ctr, int op, void *args); } + SYS_RASCTL = 343 // { int|sys||rasctl(void *addr, size_t len, int op); } + SYS_KQUEUE = 344 // { int|sys||kqueue(void); } + SYS__SCHED_SETPARAM = 346 // { int|sys||_sched_setparam(pid_t pid, lwpid_t lid, int policy, const struct sched_param *params); } + SYS__SCHED_GETPARAM = 347 // { int|sys||_sched_getparam(pid_t pid, lwpid_t lid, int *policy, struct sched_param *params); } + SYS__SCHED_SETAFFINITY = 348 // { int|sys||_sched_setaffinity(pid_t pid, lwpid_t lid, size_t size, const cpuset_t *cpuset); } + SYS__SCHED_GETAFFINITY = 349 // { int|sys||_sched_getaffinity(pid_t pid, lwpid_t lid, size_t size, cpuset_t *cpuset); } + SYS_SCHED_YIELD = 350 // { int|sys||sched_yield(void); } + SYS_FSYNC_RANGE = 354 // { int|sys||fsync_range(int fd, int flags, off_t start, off_t length); } + SYS_UUIDGEN = 355 // { int|sys||uuidgen(struct uuid *store, int count); } + SYS_GETVFSSTAT = 356 // { int|sys||getvfsstat(struct statvfs *buf, size_t bufsize, int flags); } + SYS_STATVFS1 = 357 // { int|sys||statvfs1(const char *path, struct statvfs *buf, int flags); } + SYS_FSTATVFS1 = 358 // { int|sys||fstatvfs1(int fd, struct statvfs *buf, int flags); } + SYS_EXTATTRCTL = 360 // { int|sys||extattrctl(const char *path, int cmd, const char *filename, int attrnamespace, const char *attrname); } + SYS_EXTATTR_SET_FILE = 361 // { int|sys||extattr_set_file(const char *path, int attrnamespace, const char *attrname, const void *data, size_t nbytes); } + SYS_EXTATTR_GET_FILE = 362 // { ssize_t|sys||extattr_get_file(const char *path, int attrnamespace, const char *attrname, void *data, size_t nbytes); } + SYS_EXTATTR_DELETE_FILE = 363 // { int|sys||extattr_delete_file(const char *path, int attrnamespace, const char *attrname); } + SYS_EXTATTR_SET_FD = 364 // { int|sys||extattr_set_fd(int fd, int attrnamespace, const char *attrname, const void *data, size_t nbytes); } + SYS_EXTATTR_GET_FD = 365 // { ssize_t|sys||extattr_get_fd(int fd, int attrnamespace, const char *attrname, void *data, size_t nbytes); } + SYS_EXTATTR_DELETE_FD = 366 // { int|sys||extattr_delete_fd(int fd, int attrnamespace, const char *attrname); } + SYS_EXTATTR_SET_LINK = 367 // { int|sys||extattr_set_link(const char *path, int attrnamespace, const char *attrname, const void *data, size_t nbytes); } + SYS_EXTATTR_GET_LINK = 368 // { ssize_t|sys||extattr_get_link(const char *path, int attrnamespace, const char *attrname, void *data, size_t nbytes); } + SYS_EXTATTR_DELETE_LINK = 369 // { int|sys||extattr_delete_link(const char *path, int attrnamespace, const char *attrname); } + SYS_EXTATTR_LIST_FD = 370 // { ssize_t|sys||extattr_list_fd(int fd, int attrnamespace, void *data, size_t nbytes); } + SYS_EXTATTR_LIST_FILE = 371 // { ssize_t|sys||extattr_list_file(const char *path, int attrnamespace, void *data, size_t nbytes); } + SYS_EXTATTR_LIST_LINK = 372 // { ssize_t|sys||extattr_list_link(const char *path, int attrnamespace, void *data, size_t nbytes); } + SYS_SETXATTR = 375 // { int|sys||setxattr(const char *path, const char *name, const void *value, size_t size, int flags); } + SYS_LSETXATTR = 376 // { int|sys||lsetxattr(const char *path, const char *name, const void *value, size_t size, int flags); } + SYS_FSETXATTR = 377 // { int|sys||fsetxattr(int fd, const char *name, const void *value, size_t size, int flags); } + SYS_GETXATTR = 378 // { int|sys||getxattr(const char *path, const char *name, void *value, size_t size); } + SYS_LGETXATTR = 379 // { int|sys||lgetxattr(const char *path, const char *name, void *value, size_t size); } + SYS_FGETXATTR = 380 // { int|sys||fgetxattr(int fd, const char *name, void *value, size_t size); } + SYS_LISTXATTR = 381 // { int|sys||listxattr(const char *path, char *list, size_t size); } + SYS_LLISTXATTR = 382 // { int|sys||llistxattr(const char *path, char *list, size_t size); } + SYS_FLISTXATTR = 383 // { int|sys||flistxattr(int fd, char *list, size_t size); } + SYS_REMOVEXATTR = 384 // { int|sys||removexattr(const char *path, const char *name); } + SYS_LREMOVEXATTR = 385 // { int|sys||lremovexattr(const char *path, const char *name); } + SYS_FREMOVEXATTR = 386 // { int|sys||fremovexattr(int fd, const char *name); } + SYS_GETDENTS = 390 // { int|sys|30|getdents(int fd, char *buf, size_t count); } + SYS_SOCKET = 394 // { int|sys|30|socket(int domain, int type, int protocol); } + SYS_GETFH = 395 // { int|sys|30|getfh(const char *fname, void *fhp, size_t *fh_size); } + SYS_MOUNT = 410 // { int|sys|50|mount(const char *type, const char *path, int flags, void *data, size_t data_len); } + SYS_MREMAP = 411 // { void *|sys||mremap(void *old_address, size_t old_size, void *new_address, size_t new_size, int flags); } + SYS_PSET_CREATE = 412 // { int|sys||pset_create(psetid_t *psid); } + SYS_PSET_DESTROY = 413 // { int|sys||pset_destroy(psetid_t psid); } + SYS_PSET_ASSIGN = 414 // { int|sys||pset_assign(psetid_t psid, cpuid_t cpuid, psetid_t *opsid); } + SYS__PSET_BIND = 415 // { int|sys||_pset_bind(idtype_t idtype, id_t first_id, id_t second_id, psetid_t psid, psetid_t *opsid); } + SYS_POSIX_FADVISE = 416 // { int|sys|50|posix_fadvise(int fd, int PAD, off_t offset, off_t len, int advice); } + SYS_SELECT = 417 // { int|sys|50|select(int nd, fd_set *in, fd_set *ou, fd_set *ex, struct timeval *tv); } + SYS_GETTIMEOFDAY = 418 // { int|sys|50|gettimeofday(struct timeval *tp, void *tzp); } + SYS_SETTIMEOFDAY = 419 // { int|sys|50|settimeofday(const struct timeval *tv, const void *tzp); } + SYS_UTIMES = 420 // { int|sys|50|utimes(const char *path, const struct timeval *tptr); } + SYS_ADJTIME = 421 // { int|sys|50|adjtime(const struct timeval *delta, struct timeval *olddelta); } + SYS_FUTIMES = 423 // { int|sys|50|futimes(int fd, const struct timeval *tptr); } + SYS_LUTIMES = 424 // { int|sys|50|lutimes(const char *path, const struct timeval *tptr); } + SYS_SETITIMER = 425 // { int|sys|50|setitimer(int which, const struct itimerval *itv, struct itimerval *oitv); } + SYS_GETITIMER = 426 // { int|sys|50|getitimer(int which, struct itimerval *itv); } + SYS_CLOCK_GETTIME = 427 // { int|sys|50|clock_gettime(clockid_t clock_id, struct timespec *tp); } + SYS_CLOCK_SETTIME = 428 // { int|sys|50|clock_settime(clockid_t clock_id, const struct timespec *tp); } + SYS_CLOCK_GETRES = 429 // { int|sys|50|clock_getres(clockid_t clock_id, struct timespec *tp); } + SYS_NANOSLEEP = 430 // { int|sys|50|nanosleep(const struct timespec *rqtp, struct timespec *rmtp); } + SYS___SIGTIMEDWAIT = 431 // { int|sys|50|__sigtimedwait(const sigset_t *set, siginfo_t *info, struct timespec *timeout); } + SYS__LWP_PARK = 434 // { int|sys|50|_lwp_park(const struct timespec *ts, lwpid_t unpark, const void *hint, const void *unparkhint); } + SYS_KEVENT = 435 // { int|sys|50|kevent(int fd, const struct kevent *changelist, size_t nchanges, struct kevent *eventlist, size_t nevents, const struct timespec *timeout); } + SYS_PSELECT = 436 // { int|sys|50|pselect(int nd, fd_set *in, fd_set *ou, fd_set *ex, const struct timespec *ts, const sigset_t *mask); } + SYS_POLLTS = 437 // { int|sys|50|pollts(struct pollfd *fds, u_int nfds, const struct timespec *ts, const sigset_t *mask); } + SYS_STAT = 439 // { int|sys|50|stat(const char *path, struct stat *ub); } + SYS_FSTAT = 440 // { int|sys|50|fstat(int fd, struct stat *sb); } + SYS_LSTAT = 441 // { int|sys|50|lstat(const char *path, struct stat *ub); } + SYS___SEMCTL = 442 // { int|sys|50|__semctl(int semid, int semnum, int cmd, ... union __semun *arg); } + SYS_SHMCTL = 443 // { int|sys|50|shmctl(int shmid, int cmd, struct shmid_ds *buf); } + SYS_MSGCTL = 444 // { int|sys|50|msgctl(int msqid, int cmd, struct msqid_ds *buf); } + SYS_GETRUSAGE = 445 // { int|sys|50|getrusage(int who, struct rusage *rusage); } + SYS_TIMER_SETTIME = 446 // { int|sys|50|timer_settime(timer_t timerid, int flags, const struct itimerspec *value, struct itimerspec *ovalue); } + SYS_TIMER_GETTIME = 447 // { int|sys|50|timer_gettime(timer_t timerid, struct itimerspec *value); } + SYS_NTP_GETTIME = 448 // { int|sys|50|ntp_gettime(struct ntptimeval *ntvp); } + SYS_WAIT4 = 449 // { int|sys|50|wait4(pid_t pid, int *status, int options, struct rusage *rusage); } + SYS_MKNOD = 450 // { int|sys|50|mknod(const char *path, mode_t mode, dev_t dev); } + SYS_FHSTAT = 451 // { int|sys|50|fhstat(const void *fhp, size_t fh_size, struct stat *sb); } + SYS_PIPE2 = 453 // { int|sys||pipe2(int *fildes, int flags); } + SYS_DUP3 = 454 // { int|sys||dup3(int from, int to, int flags); } + SYS_KQUEUE1 = 455 // { int|sys||kqueue1(int flags); } + SYS_PACCEPT = 456 // { int|sys||paccept(int s, struct sockaddr *name, socklen_t *anamelen, const sigset_t *mask, int flags); } + SYS_LINKAT = 457 // { int|sys||linkat(int fd1, const char *name1, int fd2, const char *name2, int flags); } + SYS_RENAMEAT = 458 // { int|sys||renameat(int fromfd, const char *from, int tofd, const char *to); } + SYS_MKFIFOAT = 459 // { int|sys||mkfifoat(int fd, const char *path, mode_t mode); } + SYS_MKNODAT = 460 // { int|sys||mknodat(int fd, const char *path, mode_t mode, uint32_t dev); } + SYS_MKDIRAT = 461 // { int|sys||mkdirat(int fd, const char *path, mode_t mode); } + SYS_FACCESSAT = 462 // { int|sys||faccessat(int fd, const char *path, int amode, int flag); } + SYS_FCHMODAT = 463 // { int|sys||fchmodat(int fd, const char *path, mode_t mode, int flag); } + SYS_FCHOWNAT = 464 // { int|sys||fchownat(int fd, const char *path, uid_t owner, gid_t group, int flag); } + SYS_FEXECVE = 465 // { int|sys||fexecve(int fd, char * const *argp, char * const *envp); } + SYS_FSTATAT = 466 // { int|sys||fstatat(int fd, const char *path, struct stat *buf, int flag); } + SYS_UTIMENSAT = 467 // { int|sys||utimensat(int fd, const char *path, const struct timespec *tptr, int flag); } + SYS_OPENAT = 468 // { int|sys||openat(int fd, const char *path, int oflags, ... mode_t mode); } + SYS_READLINKAT = 469 // { int|sys||readlinkat(int fd, const char *path, char *buf, size_t bufsize); } + SYS_SYMLINKAT = 470 // { int|sys||symlinkat(const char *path1, int fd, const char *path2); } + SYS_UNLINKAT = 471 // { int|sys||unlinkat(int fd, const char *path, int flag); } + SYS_FUTIMENS = 472 // { int|sys||futimens(int fd, const struct timespec *tptr); } + SYS___QUOTACTL = 473 // { int|sys||__quotactl(const char *path, struct quotactl_args *args); } + SYS_POSIX_SPAWN = 474 // { int|sys||posix_spawn(pid_t *pid, const char *path, const struct posix_spawn_file_actions *file_actions, const struct posix_spawnattr *attrp, char *const *argv, char *const *envp); } + SYS_RECVMMSG = 475 // { int|sys||recvmmsg(int s, struct mmsghdr *mmsg, unsigned int vlen, unsigned int flags, struct timespec *timeout); } + SYS_SENDMMSG = 476 // { int|sys||sendmmsg(int s, struct mmsghdr *mmsg, unsigned int vlen, unsigned int flags); } +) diff --git a/src/cmd/vendor/golang.org/x/sys/unix/zsysnum_openbsd_386.go b/src/cmd/vendor/golang.org/x/sys/unix/zsysnum_openbsd_386.go index d5bf3c4499..b0207d1c9b 100644 --- a/src/cmd/vendor/golang.org/x/sys/unix/zsysnum_openbsd_386.go +++ b/src/cmd/vendor/golang.org/x/sys/unix/zsysnum_openbsd_386.go @@ -1,4 +1,4 @@ -// go run mksysnum.go http://cvsweb.openbsd.org/cgi-bin/cvsweb/~checkout~/src/sys/kern/syscalls.master +// go run mksysnum.go https://cvsweb.openbsd.org/cgi-bin/cvsweb/~checkout~/src/sys/kern/syscalls.master // Code generated by the command above; see README.md. DO NOT EDIT. // +build 386,openbsd diff --git a/src/cmd/vendor/golang.org/x/sys/unix/zsysnum_openbsd_amd64.go b/src/cmd/vendor/golang.org/x/sys/unix/zsysnum_openbsd_amd64.go index cbcfdfb336..f0dec6f0b4 100644 --- a/src/cmd/vendor/golang.org/x/sys/unix/zsysnum_openbsd_amd64.go +++ b/src/cmd/vendor/golang.org/x/sys/unix/zsysnum_openbsd_amd64.go @@ -1,4 +1,4 @@ -// go run mksysnum.go http://cvsweb.openbsd.org/cgi-bin/cvsweb/~checkout~/src/sys/kern/syscalls.master +// go run mksysnum.go https://cvsweb.openbsd.org/cgi-bin/cvsweb/~checkout~/src/sys/kern/syscalls.master // Code generated by the command above; see README.md. DO NOT EDIT. // +build amd64,openbsd diff --git a/src/cmd/vendor/golang.org/x/sys/unix/zsysnum_openbsd_arm.go b/src/cmd/vendor/golang.org/x/sys/unix/zsysnum_openbsd_arm.go index a84cead963..33d1dc5404 100644 --- a/src/cmd/vendor/golang.org/x/sys/unix/zsysnum_openbsd_arm.go +++ b/src/cmd/vendor/golang.org/x/sys/unix/zsysnum_openbsd_arm.go @@ -1,4 +1,4 @@ -// go run mksysnum.go http://cvsweb.openbsd.org/cgi-bin/cvsweb/~checkout~/src/sys/kern/syscalls.master +// go run mksysnum.go https://cvsweb.openbsd.org/cgi-bin/cvsweb/~checkout~/src/sys/kern/syscalls.master // Code generated by the command above; see README.md. DO NOT EDIT. // +build arm,openbsd diff --git a/src/cmd/vendor/golang.org/x/sys/unix/ztypes_linux_386.go b/src/cmd/vendor/golang.org/x/sys/unix/ztypes_linux_386.go index ebf10d48d3..18724670a8 100644 --- a/src/cmd/vendor/golang.org/x/sys/unix/ztypes_linux_386.go +++ b/src/cmd/vendor/golang.org/x/sys/unix/ztypes_linux_386.go @@ -405,6 +405,11 @@ type TCPInfo struct { Total_retrans uint32 } +type CanFilter struct { + Id uint32 + Mask uint32 +} + const ( SizeofSockaddrInet4 = 0x10 SizeofSockaddrInet6 = 0x1c @@ -434,6 +439,7 @@ const ( SizeofICMPv6Filter = 0x20 SizeofUcred = 0xc SizeofTCPInfo = 0x68 + SizeofCanFilter = 0x8 ) const ( @@ -569,6 +575,7 @@ const ( SizeofIfAddrmsg = 0x8 SizeofRtMsg = 0xc SizeofRtNexthop = 0x8 + SizeofNdUseroptmsg = 0x10 ) type NlMsghdr struct { @@ -634,6 +641,17 @@ type RtNexthop struct { Ifindex int32 } +type NdUseroptmsg struct { + Family uint8 + Pad1 uint8 + Opts_len uint16 + Ifindex int32 + Icmp_type uint8 + Icmp_code uint8 + Pad2 uint16 + Pad3 uint32 +} + const ( SizeofSockFilter = 0x8 SizeofSockFprog = 0x8 @@ -759,7 +777,30 @@ type Sigset_t struct { Val [32]uint32 } -const RNDGETENTCNT = 0x80045200 +type SignalfdSiginfo struct { + Signo uint32 + Errno int32 + Code int32 + Pid uint32 + Uid uint32 + Fd int32 + Tid uint32 + Band uint32 + Overrun uint32 + Trapno uint32 + Status int32 + Int int32 + Ptr uint64 + Utime uint64 + Stime uint64 + Addr uint64 + Addr_lsb uint16 + _ uint16 + Syscall int32 + Call_addr uint64 + Arch uint32 + _ [28]uint8 +} const PERF_IOC_FLAG_GROUP = 0x1 @@ -1964,6 +2005,10 @@ const ( NCSI_CHANNEL_ATTR_VLAN_ID = 0xa ) +type ScmTimestamping struct { + Ts [3]Timespec +} + const ( SOF_TIMESTAMPING_TX_HARDWARE = 0x1 SOF_TIMESTAMPING_TX_SOFTWARE = 0x2 @@ -1983,4 +2028,18 @@ const ( SOF_TIMESTAMPING_LAST = 0x4000 SOF_TIMESTAMPING_MASK = 0x7fff + + SCM_TSTAMP_SND = 0x0 + SCM_TSTAMP_SCHED = 0x1 + SCM_TSTAMP_ACK = 0x2 ) + +type SockExtendedErr struct { + Errno uint32 + Origin uint8 + Type uint8 + Code uint8 + Pad uint8 + Info uint32 + Data uint32 +} diff --git a/src/cmd/vendor/golang.org/x/sys/unix/ztypes_linux_amd64.go b/src/cmd/vendor/golang.org/x/sys/unix/ztypes_linux_amd64.go index 99a6900d21..6ddbf0665c 100644 --- a/src/cmd/vendor/golang.org/x/sys/unix/ztypes_linux_amd64.go +++ b/src/cmd/vendor/golang.org/x/sys/unix/ztypes_linux_amd64.go @@ -406,6 +406,11 @@ type TCPInfo struct { Total_retrans uint32 } +type CanFilter struct { + Id uint32 + Mask uint32 +} + const ( SizeofSockaddrInet4 = 0x10 SizeofSockaddrInet6 = 0x1c @@ -435,6 +440,7 @@ const ( SizeofICMPv6Filter = 0x20 SizeofUcred = 0xc SizeofTCPInfo = 0x68 + SizeofCanFilter = 0x8 ) const ( @@ -570,6 +576,7 @@ const ( SizeofIfAddrmsg = 0x8 SizeofRtMsg = 0xc SizeofRtNexthop = 0x8 + SizeofNdUseroptmsg = 0x10 ) type NlMsghdr struct { @@ -635,6 +642,17 @@ type RtNexthop struct { Ifindex int32 } +type NdUseroptmsg struct { + Family uint8 + Pad1 uint8 + Opts_len uint16 + Ifindex int32 + Icmp_type uint8 + Icmp_code uint8 + Pad2 uint16 + Pad3 uint32 +} + const ( SizeofSockFilter = 0x8 SizeofSockFprog = 0x10 @@ -772,7 +790,30 @@ type Sigset_t struct { Val [16]uint64 } -const RNDGETENTCNT = 0x80045200 +type SignalfdSiginfo struct { + Signo uint32 + Errno int32 + Code int32 + Pid uint32 + Uid uint32 + Fd int32 + Tid uint32 + Band uint32 + Overrun uint32 + Trapno uint32 + Status int32 + Int int32 + Ptr uint64 + Utime uint64 + Stime uint64 + Addr uint64 + Addr_lsb uint16 + _ uint16 + Syscall int32 + Call_addr uint64 + Arch uint32 + _ [28]uint8 +} const PERF_IOC_FLAG_GROUP = 0x1 @@ -1977,6 +2018,10 @@ const ( NCSI_CHANNEL_ATTR_VLAN_ID = 0xa ) +type ScmTimestamping struct { + Ts [3]Timespec +} + const ( SOF_TIMESTAMPING_TX_HARDWARE = 0x1 SOF_TIMESTAMPING_TX_SOFTWARE = 0x2 @@ -1996,4 +2041,18 @@ const ( SOF_TIMESTAMPING_LAST = 0x4000 SOF_TIMESTAMPING_MASK = 0x7fff + + SCM_TSTAMP_SND = 0x0 + SCM_TSTAMP_SCHED = 0x1 + SCM_TSTAMP_ACK = 0x2 ) + +type SockExtendedErr struct { + Errno uint32 + Origin uint8 + Type uint8 + Code uint8 + Pad uint8 + Info uint32 + Data uint32 +} diff --git a/src/cmd/vendor/golang.org/x/sys/unix/ztypes_linux_arm.go b/src/cmd/vendor/golang.org/x/sys/unix/ztypes_linux_arm.go index 5ccc4b5414..b8e3ec1384 100644 --- a/src/cmd/vendor/golang.org/x/sys/unix/ztypes_linux_arm.go +++ b/src/cmd/vendor/golang.org/x/sys/unix/ztypes_linux_arm.go @@ -409,6 +409,11 @@ type TCPInfo struct { Total_retrans uint32 } +type CanFilter struct { + Id uint32 + Mask uint32 +} + const ( SizeofSockaddrInet4 = 0x10 SizeofSockaddrInet6 = 0x1c @@ -438,6 +443,7 @@ const ( SizeofICMPv6Filter = 0x20 SizeofUcred = 0xc SizeofTCPInfo = 0x68 + SizeofCanFilter = 0x8 ) const ( @@ -573,6 +579,7 @@ const ( SizeofIfAddrmsg = 0x8 SizeofRtMsg = 0xc SizeofRtNexthop = 0x8 + SizeofNdUseroptmsg = 0x10 ) type NlMsghdr struct { @@ -638,6 +645,17 @@ type RtNexthop struct { Ifindex int32 } +type NdUseroptmsg struct { + Family uint8 + Pad1 uint8 + Opts_len uint16 + Ifindex int32 + Icmp_type uint8 + Icmp_code uint8 + Pad2 uint16 + Pad3 uint32 +} + const ( SizeofSockFilter = 0x8 SizeofSockFprog = 0x8 @@ -748,7 +766,30 @@ type Sigset_t struct { Val [32]uint32 } -const RNDGETENTCNT = 0x80045200 +type SignalfdSiginfo struct { + Signo uint32 + Errno int32 + Code int32 + Pid uint32 + Uid uint32 + Fd int32 + Tid uint32 + Band uint32 + Overrun uint32 + Trapno uint32 + Status int32 + Int int32 + Ptr uint64 + Utime uint64 + Stime uint64 + Addr uint64 + Addr_lsb uint16 + _ uint16 + Syscall int32 + Call_addr uint64 + Arch uint32 + _ [28]uint8 +} const PERF_IOC_FLAG_GROUP = 0x1 @@ -1955,6 +1996,10 @@ const ( NCSI_CHANNEL_ATTR_VLAN_ID = 0xa ) +type ScmTimestamping struct { + Ts [3]Timespec +} + const ( SOF_TIMESTAMPING_TX_HARDWARE = 0x1 SOF_TIMESTAMPING_TX_SOFTWARE = 0x2 @@ -1974,4 +2019,18 @@ const ( SOF_TIMESTAMPING_LAST = 0x4000 SOF_TIMESTAMPING_MASK = 0x7fff + + SCM_TSTAMP_SND = 0x0 + SCM_TSTAMP_SCHED = 0x1 + SCM_TSTAMP_ACK = 0x2 ) + +type SockExtendedErr struct { + Errno uint32 + Origin uint8 + Type uint8 + Code uint8 + Pad uint8 + Info uint32 + Data uint32 +} diff --git a/src/cmd/vendor/golang.org/x/sys/unix/ztypes_linux_arm64.go b/src/cmd/vendor/golang.org/x/sys/unix/ztypes_linux_arm64.go index be375d9bb2..2f73f0086d 100644 --- a/src/cmd/vendor/golang.org/x/sys/unix/ztypes_linux_arm64.go +++ b/src/cmd/vendor/golang.org/x/sys/unix/ztypes_linux_arm64.go @@ -407,6 +407,11 @@ type TCPInfo struct { Total_retrans uint32 } +type CanFilter struct { + Id uint32 + Mask uint32 +} + const ( SizeofSockaddrInet4 = 0x10 SizeofSockaddrInet6 = 0x1c @@ -436,6 +441,7 @@ const ( SizeofICMPv6Filter = 0x20 SizeofUcred = 0xc SizeofTCPInfo = 0x68 + SizeofCanFilter = 0x8 ) const ( @@ -571,6 +577,7 @@ const ( SizeofIfAddrmsg = 0x8 SizeofRtMsg = 0xc SizeofRtNexthop = 0x8 + SizeofNdUseroptmsg = 0x10 ) type NlMsghdr struct { @@ -636,6 +643,17 @@ type RtNexthop struct { Ifindex int32 } +type NdUseroptmsg struct { + Family uint8 + Pad1 uint8 + Opts_len uint16 + Ifindex int32 + Icmp_type uint8 + Icmp_code uint8 + Pad2 uint16 + Pad3 uint32 +} + const ( SizeofSockFilter = 0x8 SizeofSockFprog = 0x10 @@ -751,7 +769,30 @@ type Sigset_t struct { Val [16]uint64 } -const RNDGETENTCNT = 0x80045200 +type SignalfdSiginfo struct { + Signo uint32 + Errno int32 + Code int32 + Pid uint32 + Uid uint32 + Fd int32 + Tid uint32 + Band uint32 + Overrun uint32 + Trapno uint32 + Status int32 + Int int32 + Ptr uint64 + Utime uint64 + Stime uint64 + Addr uint64 + Addr_lsb uint16 + _ uint16 + Syscall int32 + Call_addr uint64 + Arch uint32 + _ [28]uint8 +} const PERF_IOC_FLAG_GROUP = 0x1 @@ -1956,6 +1997,10 @@ const ( NCSI_CHANNEL_ATTR_VLAN_ID = 0xa ) +type ScmTimestamping struct { + Ts [3]Timespec +} + const ( SOF_TIMESTAMPING_TX_HARDWARE = 0x1 SOF_TIMESTAMPING_TX_SOFTWARE = 0x2 @@ -1975,4 +2020,18 @@ const ( SOF_TIMESTAMPING_LAST = 0x4000 SOF_TIMESTAMPING_MASK = 0x7fff + + SCM_TSTAMP_SND = 0x0 + SCM_TSTAMP_SCHED = 0x1 + SCM_TSTAMP_ACK = 0x2 ) + +type SockExtendedErr struct { + Errno uint32 + Origin uint8 + Type uint8 + Code uint8 + Pad uint8 + Info uint32 + Data uint32 +} diff --git a/src/cmd/vendor/golang.org/x/sys/unix/ztypes_linux_mips.go b/src/cmd/vendor/golang.org/x/sys/unix/ztypes_linux_mips.go index 195f7e1f85..4a2a18bcb0 100644 --- a/src/cmd/vendor/golang.org/x/sys/unix/ztypes_linux_mips.go +++ b/src/cmd/vendor/golang.org/x/sys/unix/ztypes_linux_mips.go @@ -408,6 +408,11 @@ type TCPInfo struct { Total_retrans uint32 } +type CanFilter struct { + Id uint32 + Mask uint32 +} + const ( SizeofSockaddrInet4 = 0x10 SizeofSockaddrInet6 = 0x1c @@ -437,6 +442,7 @@ const ( SizeofICMPv6Filter = 0x20 SizeofUcred = 0xc SizeofTCPInfo = 0x68 + SizeofCanFilter = 0x8 ) const ( @@ -572,6 +578,7 @@ const ( SizeofIfAddrmsg = 0x8 SizeofRtMsg = 0xc SizeofRtNexthop = 0x8 + SizeofNdUseroptmsg = 0x10 ) type NlMsghdr struct { @@ -637,6 +644,17 @@ type RtNexthop struct { Ifindex int32 } +type NdUseroptmsg struct { + Family uint8 + Pad1 uint8 + Opts_len uint16 + Ifindex int32 + Icmp_type uint8 + Icmp_code uint8 + Pad2 uint16 + Pad3 uint32 +} + const ( SizeofSockFilter = 0x8 SizeofSockFprog = 0x8 @@ -753,7 +771,30 @@ type Sigset_t struct { Val [32]uint32 } -const RNDGETENTCNT = 0x40045200 +type SignalfdSiginfo struct { + Signo uint32 + Errno int32 + Code int32 + Pid uint32 + Uid uint32 + Fd int32 + Tid uint32 + Band uint32 + Overrun uint32 + Trapno uint32 + Status int32 + Int int32 + Ptr uint64 + Utime uint64 + Stime uint64 + Addr uint64 + Addr_lsb uint16 + _ uint16 + Syscall int32 + Call_addr uint64 + Arch uint32 + _ [28]uint8 +} const PERF_IOC_FLAG_GROUP = 0x1 @@ -1961,6 +2002,10 @@ const ( NCSI_CHANNEL_ATTR_VLAN_ID = 0xa ) +type ScmTimestamping struct { + Ts [3]Timespec +} + const ( SOF_TIMESTAMPING_TX_HARDWARE = 0x1 SOF_TIMESTAMPING_TX_SOFTWARE = 0x2 @@ -1980,4 +2025,18 @@ const ( SOF_TIMESTAMPING_LAST = 0x4000 SOF_TIMESTAMPING_MASK = 0x7fff + + SCM_TSTAMP_SND = 0x0 + SCM_TSTAMP_SCHED = 0x1 + SCM_TSTAMP_ACK = 0x2 ) + +type SockExtendedErr struct { + Errno uint32 + Origin uint8 + Type uint8 + Code uint8 + Pad uint8 + Info uint32 + Data uint32 +} diff --git a/src/cmd/vendor/golang.org/x/sys/unix/ztypes_linux_mips64.go b/src/cmd/vendor/golang.org/x/sys/unix/ztypes_linux_mips64.go index 77acf56985..41e4513de1 100644 --- a/src/cmd/vendor/golang.org/x/sys/unix/ztypes_linux_mips64.go +++ b/src/cmd/vendor/golang.org/x/sys/unix/ztypes_linux_mips64.go @@ -407,6 +407,11 @@ type TCPInfo struct { Total_retrans uint32 } +type CanFilter struct { + Id uint32 + Mask uint32 +} + const ( SizeofSockaddrInet4 = 0x10 SizeofSockaddrInet6 = 0x1c @@ -436,6 +441,7 @@ const ( SizeofICMPv6Filter = 0x20 SizeofUcred = 0xc SizeofTCPInfo = 0x68 + SizeofCanFilter = 0x8 ) const ( @@ -571,6 +577,7 @@ const ( SizeofIfAddrmsg = 0x8 SizeofRtMsg = 0xc SizeofRtNexthop = 0x8 + SizeofNdUseroptmsg = 0x10 ) type NlMsghdr struct { @@ -636,6 +643,17 @@ type RtNexthop struct { Ifindex int32 } +type NdUseroptmsg struct { + Family uint8 + Pad1 uint8 + Opts_len uint16 + Ifindex int32 + Icmp_type uint8 + Icmp_code uint8 + Pad2 uint16 + Pad3 uint32 +} + const ( SizeofSockFilter = 0x8 SizeofSockFprog = 0x10 @@ -753,7 +771,30 @@ type Sigset_t struct { Val [16]uint64 } -const RNDGETENTCNT = 0x40045200 +type SignalfdSiginfo struct { + Signo uint32 + Errno int32 + Code int32 + Pid uint32 + Uid uint32 + Fd int32 + Tid uint32 + Band uint32 + Overrun uint32 + Trapno uint32 + Status int32 + Int int32 + Ptr uint64 + Utime uint64 + Stime uint64 + Addr uint64 + Addr_lsb uint16 + _ uint16 + Syscall int32 + Call_addr uint64 + Arch uint32 + _ [28]uint8 +} const PERF_IOC_FLAG_GROUP = 0x1 @@ -1958,6 +1999,10 @@ const ( NCSI_CHANNEL_ATTR_VLAN_ID = 0xa ) +type ScmTimestamping struct { + Ts [3]Timespec +} + const ( SOF_TIMESTAMPING_TX_HARDWARE = 0x1 SOF_TIMESTAMPING_TX_SOFTWARE = 0x2 @@ -1977,4 +2022,18 @@ const ( SOF_TIMESTAMPING_LAST = 0x4000 SOF_TIMESTAMPING_MASK = 0x7fff + + SCM_TSTAMP_SND = 0x0 + SCM_TSTAMP_SCHED = 0x1 + SCM_TSTAMP_ACK = 0x2 ) + +type SockExtendedErr struct { + Errno uint32 + Origin uint8 + Type uint8 + Code uint8 + Pad uint8 + Info uint32 + Data uint32 +} diff --git a/src/cmd/vendor/golang.org/x/sys/unix/ztypes_linux_mips64le.go b/src/cmd/vendor/golang.org/x/sys/unix/ztypes_linux_mips64le.go index 2fb7498da6..4a3d74b76e 100644 --- a/src/cmd/vendor/golang.org/x/sys/unix/ztypes_linux_mips64le.go +++ b/src/cmd/vendor/golang.org/x/sys/unix/ztypes_linux_mips64le.go @@ -407,6 +407,11 @@ type TCPInfo struct { Total_retrans uint32 } +type CanFilter struct { + Id uint32 + Mask uint32 +} + const ( SizeofSockaddrInet4 = 0x10 SizeofSockaddrInet6 = 0x1c @@ -436,6 +441,7 @@ const ( SizeofICMPv6Filter = 0x20 SizeofUcred = 0xc SizeofTCPInfo = 0x68 + SizeofCanFilter = 0x8 ) const ( @@ -571,6 +577,7 @@ const ( SizeofIfAddrmsg = 0x8 SizeofRtMsg = 0xc SizeofRtNexthop = 0x8 + SizeofNdUseroptmsg = 0x10 ) type NlMsghdr struct { @@ -636,6 +643,17 @@ type RtNexthop struct { Ifindex int32 } +type NdUseroptmsg struct { + Family uint8 + Pad1 uint8 + Opts_len uint16 + Ifindex int32 + Icmp_type uint8 + Icmp_code uint8 + Pad2 uint16 + Pad3 uint32 +} + const ( SizeofSockFilter = 0x8 SizeofSockFprog = 0x10 @@ -753,7 +771,30 @@ type Sigset_t struct { Val [16]uint64 } -const RNDGETENTCNT = 0x40045200 +type SignalfdSiginfo struct { + Signo uint32 + Errno int32 + Code int32 + Pid uint32 + Uid uint32 + Fd int32 + Tid uint32 + Band uint32 + Overrun uint32 + Trapno uint32 + Status int32 + Int int32 + Ptr uint64 + Utime uint64 + Stime uint64 + Addr uint64 + Addr_lsb uint16 + _ uint16 + Syscall int32 + Call_addr uint64 + Arch uint32 + _ [28]uint8 +} const PERF_IOC_FLAG_GROUP = 0x1 @@ -1958,6 +1999,10 @@ const ( NCSI_CHANNEL_ATTR_VLAN_ID = 0xa ) +type ScmTimestamping struct { + Ts [3]Timespec +} + const ( SOF_TIMESTAMPING_TX_HARDWARE = 0x1 SOF_TIMESTAMPING_TX_SOFTWARE = 0x2 @@ -1977,4 +2022,18 @@ const ( SOF_TIMESTAMPING_LAST = 0x4000 SOF_TIMESTAMPING_MASK = 0x7fff + + SCM_TSTAMP_SND = 0x0 + SCM_TSTAMP_SCHED = 0x1 + SCM_TSTAMP_ACK = 0x2 ) + +type SockExtendedErr struct { + Errno uint32 + Origin uint8 + Type uint8 + Code uint8 + Pad uint8 + Info uint32 + Data uint32 +} diff --git a/src/cmd/vendor/golang.org/x/sys/unix/ztypes_linux_mipsle.go b/src/cmd/vendor/golang.org/x/sys/unix/ztypes_linux_mipsle.go index 41cb14863c..8ae3ca4e4e 100644 --- a/src/cmd/vendor/golang.org/x/sys/unix/ztypes_linux_mipsle.go +++ b/src/cmd/vendor/golang.org/x/sys/unix/ztypes_linux_mipsle.go @@ -408,6 +408,11 @@ type TCPInfo struct { Total_retrans uint32 } +type CanFilter struct { + Id uint32 + Mask uint32 +} + const ( SizeofSockaddrInet4 = 0x10 SizeofSockaddrInet6 = 0x1c @@ -437,6 +442,7 @@ const ( SizeofICMPv6Filter = 0x20 SizeofUcred = 0xc SizeofTCPInfo = 0x68 + SizeofCanFilter = 0x8 ) const ( @@ -572,6 +578,7 @@ const ( SizeofIfAddrmsg = 0x8 SizeofRtMsg = 0xc SizeofRtNexthop = 0x8 + SizeofNdUseroptmsg = 0x10 ) type NlMsghdr struct { @@ -637,6 +644,17 @@ type RtNexthop struct { Ifindex int32 } +type NdUseroptmsg struct { + Family uint8 + Pad1 uint8 + Opts_len uint16 + Ifindex int32 + Icmp_type uint8 + Icmp_code uint8 + Pad2 uint16 + Pad3 uint32 +} + const ( SizeofSockFilter = 0x8 SizeofSockFprog = 0x8 @@ -753,7 +771,30 @@ type Sigset_t struct { Val [32]uint32 } -const RNDGETENTCNT = 0x40045200 +type SignalfdSiginfo struct { + Signo uint32 + Errno int32 + Code int32 + Pid uint32 + Uid uint32 + Fd int32 + Tid uint32 + Band uint32 + Overrun uint32 + Trapno uint32 + Status int32 + Int int32 + Ptr uint64 + Utime uint64 + Stime uint64 + Addr uint64 + Addr_lsb uint16 + _ uint16 + Syscall int32 + Call_addr uint64 + Arch uint32 + _ [28]uint8 +} const PERF_IOC_FLAG_GROUP = 0x1 @@ -1961,6 +2002,10 @@ const ( NCSI_CHANNEL_ATTR_VLAN_ID = 0xa ) +type ScmTimestamping struct { + Ts [3]Timespec +} + const ( SOF_TIMESTAMPING_TX_HARDWARE = 0x1 SOF_TIMESTAMPING_TX_SOFTWARE = 0x2 @@ -1980,4 +2025,18 @@ const ( SOF_TIMESTAMPING_LAST = 0x4000 SOF_TIMESTAMPING_MASK = 0x7fff + + SCM_TSTAMP_SND = 0x0 + SCM_TSTAMP_SCHED = 0x1 + SCM_TSTAMP_ACK = 0x2 ) + +type SockExtendedErr struct { + Errno uint32 + Origin uint8 + Type uint8 + Code uint8 + Pad uint8 + Info uint32 + Data uint32 +} diff --git a/src/cmd/vendor/golang.org/x/sys/unix/ztypes_linux_ppc64.go b/src/cmd/vendor/golang.org/x/sys/unix/ztypes_linux_ppc64.go index 8e6b5fa68e..50294c94c0 100644 --- a/src/cmd/vendor/golang.org/x/sys/unix/ztypes_linux_ppc64.go +++ b/src/cmd/vendor/golang.org/x/sys/unix/ztypes_linux_ppc64.go @@ -408,6 +408,11 @@ type TCPInfo struct { Total_retrans uint32 } +type CanFilter struct { + Id uint32 + Mask uint32 +} + const ( SizeofSockaddrInet4 = 0x10 SizeofSockaddrInet6 = 0x1c @@ -437,6 +442,7 @@ const ( SizeofICMPv6Filter = 0x20 SizeofUcred = 0xc SizeofTCPInfo = 0x68 + SizeofCanFilter = 0x8 ) const ( @@ -572,6 +578,7 @@ const ( SizeofIfAddrmsg = 0x8 SizeofRtMsg = 0xc SizeofRtNexthop = 0x8 + SizeofNdUseroptmsg = 0x10 ) type NlMsghdr struct { @@ -637,6 +644,17 @@ type RtNexthop struct { Ifindex int32 } +type NdUseroptmsg struct { + Family uint8 + Pad1 uint8 + Opts_len uint16 + Ifindex int32 + Icmp_type uint8 + Icmp_code uint8 + Pad2 uint16 + Pad3 uint32 +} + const ( SizeofSockFilter = 0x8 SizeofSockFprog = 0x10 @@ -761,7 +779,30 @@ type Sigset_t struct { Val [16]uint64 } -const RNDGETENTCNT = 0x40045200 +type SignalfdSiginfo struct { + Signo uint32 + Errno int32 + Code int32 + Pid uint32 + Uid uint32 + Fd int32 + Tid uint32 + Band uint32 + Overrun uint32 + Trapno uint32 + Status int32 + Int int32 + Ptr uint64 + Utime uint64 + Stime uint64 + Addr uint64 + Addr_lsb uint16 + _ uint16 + Syscall int32 + Call_addr uint64 + Arch uint32 + _ [28]uint8 +} const PERF_IOC_FLAG_GROUP = 0x1 @@ -1966,6 +2007,10 @@ const ( NCSI_CHANNEL_ATTR_VLAN_ID = 0xa ) +type ScmTimestamping struct { + Ts [3]Timespec +} + const ( SOF_TIMESTAMPING_TX_HARDWARE = 0x1 SOF_TIMESTAMPING_TX_SOFTWARE = 0x2 @@ -1985,4 +2030,18 @@ const ( SOF_TIMESTAMPING_LAST = 0x4000 SOF_TIMESTAMPING_MASK = 0x7fff + + SCM_TSTAMP_SND = 0x0 + SCM_TSTAMP_SCHED = 0x1 + SCM_TSTAMP_ACK = 0x2 ) + +type SockExtendedErr struct { + Errno uint32 + Origin uint8 + Type uint8 + Code uint8 + Pad uint8 + Info uint32 + Data uint32 +} diff --git a/src/cmd/vendor/golang.org/x/sys/unix/ztypes_linux_ppc64le.go b/src/cmd/vendor/golang.org/x/sys/unix/ztypes_linux_ppc64le.go index 019d2d6a9d..d2acf3a734 100644 --- a/src/cmd/vendor/golang.org/x/sys/unix/ztypes_linux_ppc64le.go +++ b/src/cmd/vendor/golang.org/x/sys/unix/ztypes_linux_ppc64le.go @@ -408,6 +408,11 @@ type TCPInfo struct { Total_retrans uint32 } +type CanFilter struct { + Id uint32 + Mask uint32 +} + const ( SizeofSockaddrInet4 = 0x10 SizeofSockaddrInet6 = 0x1c @@ -437,6 +442,7 @@ const ( SizeofICMPv6Filter = 0x20 SizeofUcred = 0xc SizeofTCPInfo = 0x68 + SizeofCanFilter = 0x8 ) const ( @@ -572,6 +578,7 @@ const ( SizeofIfAddrmsg = 0x8 SizeofRtMsg = 0xc SizeofRtNexthop = 0x8 + SizeofNdUseroptmsg = 0x10 ) type NlMsghdr struct { @@ -637,6 +644,17 @@ type RtNexthop struct { Ifindex int32 } +type NdUseroptmsg struct { + Family uint8 + Pad1 uint8 + Opts_len uint16 + Ifindex int32 + Icmp_type uint8 + Icmp_code uint8 + Pad2 uint16 + Pad3 uint32 +} + const ( SizeofSockFilter = 0x8 SizeofSockFprog = 0x10 @@ -761,7 +779,30 @@ type Sigset_t struct { Val [16]uint64 } -const RNDGETENTCNT = 0x40045200 +type SignalfdSiginfo struct { + Signo uint32 + Errno int32 + Code int32 + Pid uint32 + Uid uint32 + Fd int32 + Tid uint32 + Band uint32 + Overrun uint32 + Trapno uint32 + Status int32 + Int int32 + Ptr uint64 + Utime uint64 + Stime uint64 + Addr uint64 + Addr_lsb uint16 + _ uint16 + Syscall int32 + Call_addr uint64 + Arch uint32 + _ [28]uint8 +} const PERF_IOC_FLAG_GROUP = 0x1 @@ -1966,6 +2007,10 @@ const ( NCSI_CHANNEL_ATTR_VLAN_ID = 0xa ) +type ScmTimestamping struct { + Ts [3]Timespec +} + const ( SOF_TIMESTAMPING_TX_HARDWARE = 0x1 SOF_TIMESTAMPING_TX_SOFTWARE = 0x2 @@ -1985,4 +2030,18 @@ const ( SOF_TIMESTAMPING_LAST = 0x4000 SOF_TIMESTAMPING_MASK = 0x7fff + + SCM_TSTAMP_SND = 0x0 + SCM_TSTAMP_SCHED = 0x1 + SCM_TSTAMP_ACK = 0x2 ) + +type SockExtendedErr struct { + Errno uint32 + Origin uint8 + Type uint8 + Code uint8 + Pad uint8 + Info uint32 + Data uint32 +} diff --git a/src/cmd/vendor/golang.org/x/sys/unix/ztypes_linux_riscv64.go b/src/cmd/vendor/golang.org/x/sys/unix/ztypes_linux_riscv64.go index cf110ce2b3..675c596880 100644 --- a/src/cmd/vendor/golang.org/x/sys/unix/ztypes_linux_riscv64.go +++ b/src/cmd/vendor/golang.org/x/sys/unix/ztypes_linux_riscv64.go @@ -212,7 +212,7 @@ type RawSockaddrInet6 struct { type RawSockaddrUnix struct { Family uint16 - Path [108]uint8 + Path [108]int8 } type RawSockaddrLinklayer struct { @@ -407,6 +407,11 @@ type TCPInfo struct { Total_retrans uint32 } +type CanFilter struct { + Id uint32 + Mask uint32 +} + const ( SizeofSockaddrInet4 = 0x10 SizeofSockaddrInet6 = 0x1c @@ -436,6 +441,7 @@ const ( SizeofICMPv6Filter = 0x20 SizeofUcred = 0xc SizeofTCPInfo = 0x68 + SizeofCanFilter = 0x8 ) const ( @@ -571,6 +577,7 @@ const ( SizeofIfAddrmsg = 0x8 SizeofRtMsg = 0xc SizeofRtNexthop = 0x8 + SizeofNdUseroptmsg = 0x10 ) type NlMsghdr struct { @@ -636,6 +643,17 @@ type RtNexthop struct { Ifindex int32 } +type NdUseroptmsg struct { + Family uint8 + Pad1 uint8 + Opts_len uint16 + Ifindex int32 + Icmp_type uint8 + Icmp_code uint8 + Pad2 uint16 + Pad3 uint32 +} + const ( SizeofSockFilter = 0x8 SizeofSockFprog = 0x10 @@ -778,7 +796,30 @@ type Sigset_t struct { Val [16]uint64 } -const RNDGETENTCNT = 0x80045200 +type SignalfdSiginfo struct { + Signo uint32 + Errno int32 + Code int32 + Pid uint32 + Uid uint32 + Fd int32 + Tid uint32 + Band uint32 + Overrun uint32 + Trapno uint32 + Status int32 + Int int32 + Ptr uint64 + Utime uint64 + Stime uint64 + Addr uint64 + Addr_lsb uint16 + _ uint16 + Syscall int32 + Call_addr uint64 + Arch uint32 + _ [28]uint8 +} const PERF_IOC_FLAG_GROUP = 0x1 @@ -1983,6 +2024,10 @@ const ( NCSI_CHANNEL_ATTR_VLAN_ID = 0xa ) +type ScmTimestamping struct { + Ts [3]Timespec +} + const ( SOF_TIMESTAMPING_TX_HARDWARE = 0x1 SOF_TIMESTAMPING_TX_SOFTWARE = 0x2 @@ -2002,4 +2047,18 @@ const ( SOF_TIMESTAMPING_LAST = 0x4000 SOF_TIMESTAMPING_MASK = 0x7fff + + SCM_TSTAMP_SND = 0x0 + SCM_TSTAMP_SCHED = 0x1 + SCM_TSTAMP_ACK = 0x2 ) + +type SockExtendedErr struct { + Errno uint32 + Origin uint8 + Type uint8 + Code uint8 + Pad uint8 + Info uint32 + Data uint32 +} diff --git a/src/cmd/vendor/golang.org/x/sys/unix/ztypes_linux_s390x.go b/src/cmd/vendor/golang.org/x/sys/unix/ztypes_linux_s390x.go index abdc0863df..9f2cf0dfd7 100644 --- a/src/cmd/vendor/golang.org/x/sys/unix/ztypes_linux_s390x.go +++ b/src/cmd/vendor/golang.org/x/sys/unix/ztypes_linux_s390x.go @@ -406,6 +406,11 @@ type TCPInfo struct { Total_retrans uint32 } +type CanFilter struct { + Id uint32 + Mask uint32 +} + const ( SizeofSockaddrInet4 = 0x10 SizeofSockaddrInet6 = 0x1c @@ -435,6 +440,7 @@ const ( SizeofICMPv6Filter = 0x20 SizeofUcred = 0xc SizeofTCPInfo = 0x68 + SizeofCanFilter = 0x8 ) const ( @@ -570,6 +576,7 @@ const ( SizeofIfAddrmsg = 0x8 SizeofRtMsg = 0xc SizeofRtNexthop = 0x8 + SizeofNdUseroptmsg = 0x10 ) type NlMsghdr struct { @@ -635,6 +642,17 @@ type RtNexthop struct { Ifindex int32 } +type NdUseroptmsg struct { + Family uint8 + Pad1 uint8 + Opts_len uint16 + Ifindex int32 + Icmp_type uint8 + Icmp_code uint8 + Pad2 uint16 + Pad3 uint32 +} + const ( SizeofSockFilter = 0x8 SizeofSockFprog = 0x10 @@ -774,7 +792,30 @@ type Sigset_t struct { Val [16]uint64 } -const RNDGETENTCNT = 0x80045200 +type SignalfdSiginfo struct { + Signo uint32 + Errno int32 + Code int32 + Pid uint32 + Uid uint32 + Fd int32 + Tid uint32 + Band uint32 + Overrun uint32 + Trapno uint32 + Status int32 + Int int32 + Ptr uint64 + Utime uint64 + Stime uint64 + Addr uint64 + Addr_lsb uint16 + _ uint16 + Syscall int32 + Call_addr uint64 + Arch uint32 + _ [28]uint8 +} const PERF_IOC_FLAG_GROUP = 0x1 @@ -1980,6 +2021,10 @@ const ( NCSI_CHANNEL_ATTR_VLAN_ID = 0xa ) +type ScmTimestamping struct { + Ts [3]Timespec +} + const ( SOF_TIMESTAMPING_TX_HARDWARE = 0x1 SOF_TIMESTAMPING_TX_SOFTWARE = 0x2 @@ -1999,4 +2044,18 @@ const ( SOF_TIMESTAMPING_LAST = 0x4000 SOF_TIMESTAMPING_MASK = 0x7fff + + SCM_TSTAMP_SND = 0x0 + SCM_TSTAMP_SCHED = 0x1 + SCM_TSTAMP_ACK = 0x2 ) + +type SockExtendedErr struct { + Errno uint32 + Origin uint8 + Type uint8 + Code uint8 + Pad uint8 + Info uint32 + Data uint32 +} diff --git a/src/cmd/vendor/golang.org/x/sys/unix/ztypes_linux_sparc64.go b/src/cmd/vendor/golang.org/x/sys/unix/ztypes_linux_sparc64.go index b0c9798d75..68643903c9 100644 --- a/src/cmd/vendor/golang.org/x/sys/unix/ztypes_linux_sparc64.go +++ b/src/cmd/vendor/golang.org/x/sys/unix/ztypes_linux_sparc64.go @@ -410,6 +410,11 @@ type TCPInfo struct { Total_retrans uint32 } +type CanFilter struct { + Id uint32 + Mask uint32 +} + const ( SizeofSockaddrInet4 = 0x10 SizeofSockaddrInet6 = 0x1c @@ -439,6 +444,7 @@ const ( SizeofICMPv6Filter = 0x20 SizeofUcred = 0xc SizeofTCPInfo = 0x68 + SizeofCanFilter = 0x8 ) const ( @@ -574,6 +580,7 @@ const ( SizeofIfAddrmsg = 0x8 SizeofRtMsg = 0xc SizeofRtNexthop = 0x8 + SizeofNdUseroptmsg = 0x10 ) type NlMsghdr struct { @@ -639,6 +646,17 @@ type RtNexthop struct { Ifindex int32 } +type NdUseroptmsg struct { + Family uint8 + Pad1 uint8 + Opts_len uint16 + Ifindex int32 + Icmp_type uint8 + Icmp_code uint8 + Pad2 uint16 + Pad3 uint32 +} + const ( SizeofSockFilter = 0x8 SizeofSockFprog = 0x10 @@ -756,7 +774,30 @@ type Sigset_t struct { Val [16]uint64 } -const RNDGETENTCNT = 0x40045200 +type SignalfdSiginfo struct { + Signo uint32 + Errno int32 + Code int32 + Pid uint32 + Uid uint32 + Fd int32 + Tid uint32 + Band uint32 + Overrun uint32 + Trapno uint32 + Status int32 + Int int32 + Ptr uint64 + Utime uint64 + Stime uint64 + Addr uint64 + Addr_lsb uint16 + _ uint16 + Syscall int32 + Call_addr uint64 + Arch uint32 + _ [28]uint8 +} const PERF_IOC_FLAG_GROUP = 0x1 @@ -1961,6 +2002,10 @@ const ( NCSI_CHANNEL_ATTR_VLAN_ID = 0xa ) +type ScmTimestamping struct { + Ts [3]Timespec +} + const ( SOF_TIMESTAMPING_TX_HARDWARE = 0x1 SOF_TIMESTAMPING_TX_SOFTWARE = 0x2 @@ -1980,4 +2025,18 @@ const ( SOF_TIMESTAMPING_LAST = 0x4000 SOF_TIMESTAMPING_MASK = 0x7fff + + SCM_TSTAMP_SND = 0x0 + SCM_TSTAMP_SCHED = 0x1 + SCM_TSTAMP_ACK = 0x2 ) + +type SockExtendedErr struct { + Errno uint32 + Origin uint8 + Type uint8 + Code uint8 + Pad uint8 + Info uint32 + Data uint32 +} diff --git a/src/cmd/vendor/golang.org/x/sys/unix/ztypes_netbsd_arm64.go b/src/cmd/vendor/golang.org/x/sys/unix/ztypes_netbsd_arm64.go new file mode 100644 index 0000000000..43da2c41c5 --- /dev/null +++ b/src/cmd/vendor/golang.org/x/sys/unix/ztypes_netbsd_arm64.go @@ -0,0 +1,472 @@ +// cgo -godefs types_netbsd.go | go run mkpost.go +// Code generated by the command above; see README.md. DO NOT EDIT. + +// +build arm64,netbsd + +package unix + +const ( + SizeofPtr = 0x8 + SizeofShort = 0x2 + SizeofInt = 0x4 + SizeofLong = 0x8 + SizeofLongLong = 0x8 +) + +type ( + _C_short int16 + _C_int int32 + _C_long int64 + _C_long_long int64 +) + +type Timespec struct { + Sec int64 + Nsec int64 +} + +type Timeval struct { + Sec int64 + Usec int32 + Pad_cgo_0 [4]byte +} + +type Rusage struct { + Utime Timeval + Stime Timeval + Maxrss int64 + Ixrss int64 + Idrss int64 + Isrss int64 + Minflt int64 + Majflt int64 + Nswap int64 + Inblock int64 + Oublock int64 + Msgsnd int64 + Msgrcv int64 + Nsignals int64 + Nvcsw int64 + Nivcsw int64 +} + +type Rlimit struct { + Cur uint64 + Max uint64 +} + +type _Gid_t uint32 + +type Stat_t struct { + Dev uint64 + Mode uint32 + Pad_cgo_0 [4]byte + Ino uint64 + Nlink uint32 + Uid uint32 + Gid uint32 + Pad_cgo_1 [4]byte + Rdev uint64 + Atimespec Timespec + Mtimespec Timespec + Ctimespec Timespec + Birthtimespec Timespec + Size int64 + Blocks int64 + Blksize uint32 + Flags uint32 + Gen uint32 + Spare [2]uint32 + Pad_cgo_2 [4]byte +} + +type Statfs_t [0]byte + +type Flock_t struct { + Start int64 + Len int64 + Pid int32 + Type int16 + Whence int16 +} + +type Dirent struct { + Fileno uint64 + Reclen uint16 + Namlen uint16 + Type uint8 + Name [512]int8 + Pad_cgo_0 [3]byte +} + +type Fsid struct { + X__fsid_val [2]int32 +} + +const ( + PathMax = 0x400 +) + +const ( + FADV_NORMAL = 0x0 + FADV_RANDOM = 0x1 + FADV_SEQUENTIAL = 0x2 + FADV_WILLNEED = 0x3 + FADV_DONTNEED = 0x4 + FADV_NOREUSE = 0x5 +) + +type RawSockaddrInet4 struct { + Len uint8 + Family uint8 + Port uint16 + Addr [4]byte /* in_addr */ + Zero [8]int8 +} + +type RawSockaddrInet6 struct { + Len uint8 + Family uint8 + Port uint16 + Flowinfo uint32 + Addr [16]byte /* in6_addr */ + Scope_id uint32 +} + +type RawSockaddrUnix struct { + Len uint8 + Family uint8 + Path [104]int8 +} + +type RawSockaddrDatalink struct { + Len uint8 + Family uint8 + Index uint16 + Type uint8 + Nlen uint8 + Alen uint8 + Slen uint8 + Data [12]int8 +} + +type RawSockaddr struct { + Len uint8 + Family uint8 + Data [14]int8 +} + +type RawSockaddrAny struct { + Addr RawSockaddr + Pad [92]int8 +} + +type _Socklen uint32 + +type Linger struct { + Onoff int32 + Linger int32 +} + +type Iovec struct { + Base *byte + Len uint64 +} + +type IPMreq struct { + Multiaddr [4]byte /* in_addr */ + Interface [4]byte /* in_addr */ +} + +type IPv6Mreq struct { + Multiaddr [16]byte /* in6_addr */ + Interface uint32 +} + +type Msghdr struct { + Name *byte + Namelen uint32 + Pad_cgo_0 [4]byte + Iov *Iovec + Iovlen int32 + Pad_cgo_1 [4]byte + Control *byte + Controllen uint32 + Flags int32 +} + +type Cmsghdr struct { + Len uint32 + Level int32 + Type int32 +} + +type Inet6Pktinfo struct { + Addr [16]byte /* in6_addr */ + Ifindex uint32 +} + +type IPv6MTUInfo struct { + Addr RawSockaddrInet6 + Mtu uint32 +} + +type ICMPv6Filter struct { + Filt [8]uint32 +} + +const ( + SizeofSockaddrInet4 = 0x10 + SizeofSockaddrInet6 = 0x1c + SizeofSockaddrAny = 0x6c + SizeofSockaddrUnix = 0x6a + SizeofSockaddrDatalink = 0x14 + SizeofLinger = 0x8 + SizeofIPMreq = 0x8 + SizeofIPv6Mreq = 0x14 + SizeofMsghdr = 0x30 + SizeofCmsghdr = 0xc + SizeofInet6Pktinfo = 0x14 + SizeofIPv6MTUInfo = 0x20 + SizeofICMPv6Filter = 0x20 +) + +const ( + PTRACE_TRACEME = 0x0 + PTRACE_CONT = 0x7 + PTRACE_KILL = 0x8 +) + +type Kevent_t struct { + Ident uint64 + Filter uint32 + Flags uint32 + Fflags uint32 + Pad_cgo_0 [4]byte + Data int64 + Udata int64 +} + +type FdSet struct { + Bits [8]uint32 +} + +const ( + SizeofIfMsghdr = 0x98 + SizeofIfData = 0x88 + SizeofIfaMsghdr = 0x18 + SizeofIfAnnounceMsghdr = 0x18 + SizeofRtMsghdr = 0x78 + SizeofRtMetrics = 0x50 +) + +type IfMsghdr struct { + Msglen uint16 + Version uint8 + Type uint8 + Addrs int32 + Flags int32 + Index uint16 + Pad_cgo_0 [2]byte + Data IfData +} + +type IfData struct { + Type uint8 + Addrlen uint8 + Hdrlen uint8 + Pad_cgo_0 [1]byte + Link_state int32 + Mtu uint64 + Metric uint64 + Baudrate uint64 + Ipackets uint64 + Ierrors uint64 + Opackets uint64 + Oerrors uint64 + Collisions uint64 + Ibytes uint64 + Obytes uint64 + Imcasts uint64 + Omcasts uint64 + Iqdrops uint64 + Noproto uint64 + Lastchange Timespec +} + +type IfaMsghdr struct { + Msglen uint16 + Version uint8 + Type uint8 + Addrs int32 + Flags int32 + Metric int32 + Index uint16 + Pad_cgo_0 [6]byte +} + +type IfAnnounceMsghdr struct { + Msglen uint16 + Version uint8 + Type uint8 + Index uint16 + Name [16]int8 + What uint16 +} + +type RtMsghdr struct { + Msglen uint16 + Version uint8 + Type uint8 + Index uint16 + Pad_cgo_0 [2]byte + Flags int32 + Addrs int32 + Pid int32 + Seq int32 + Errno int32 + Use int32 + Inits int32 + Pad_cgo_1 [4]byte + Rmx RtMetrics +} + +type RtMetrics struct { + Locks uint64 + Mtu uint64 + Hopcount uint64 + Recvpipe uint64 + Sendpipe uint64 + Ssthresh uint64 + Rtt uint64 + Rttvar uint64 + Expire int64 + Pksent int64 +} + +type Mclpool [0]byte + +const ( + SizeofBpfVersion = 0x4 + SizeofBpfStat = 0x80 + SizeofBpfProgram = 0x10 + SizeofBpfInsn = 0x8 + SizeofBpfHdr = 0x20 +) + +type BpfVersion struct { + Major uint16 + Minor uint16 +} + +type BpfStat struct { + Recv uint64 + Drop uint64 + Capt uint64 + Padding [13]uint64 +} + +type BpfProgram struct { + Len uint32 + Pad_cgo_0 [4]byte + Insns *BpfInsn +} + +type BpfInsn struct { + Code uint16 + Jt uint8 + Jf uint8 + K uint32 +} + +type BpfHdr struct { + Tstamp BpfTimeval + Caplen uint32 + Datalen uint32 + Hdrlen uint16 + Pad_cgo_0 [6]byte +} + +type BpfTimeval struct { + Sec int64 + Usec int64 +} + +type Termios struct { + Iflag uint32 + Oflag uint32 + Cflag uint32 + Lflag uint32 + Cc [20]uint8 + Ispeed int32 + Ospeed int32 +} + +type Winsize struct { + Row uint16 + Col uint16 + Xpixel uint16 + Ypixel uint16 +} + +type Ptmget struct { + Cfd int32 + Sfd int32 + Cn [1024]byte + Sn [1024]byte +} + +const ( + AT_FDCWD = -0x64 + AT_SYMLINK_NOFOLLOW = 0x200 +) + +type PollFd struct { + Fd int32 + Events int16 + Revents int16 +} + +const ( + POLLERR = 0x8 + POLLHUP = 0x10 + POLLIN = 0x1 + POLLNVAL = 0x20 + POLLOUT = 0x4 + POLLPRI = 0x2 + POLLRDBAND = 0x80 + POLLRDNORM = 0x40 + POLLWRBAND = 0x100 + POLLWRNORM = 0x4 +) + +type Sysctlnode struct { + Flags uint32 + Num int32 + Name [32]int8 + Ver uint32 + X__rsvd uint32 + Un [16]byte + X_sysctl_size [8]byte + X_sysctl_func [8]byte + X_sysctl_parent [8]byte + X_sysctl_desc [8]byte +} + +type Utsname struct { + Sysname [256]byte + Nodename [256]byte + Release [256]byte + Version [256]byte + Machine [256]byte +} + +const SizeofClockinfo = 0x14 + +type Clockinfo struct { + Hz int32 + Tick int32 + Tickadj int32 + Stathz int32 + Profhz int32 +} diff --git a/src/cmd/vendor/golang.org/x/sys/windows/security_windows.go b/src/cmd/vendor/golang.org/x/sys/windows/security_windows.go index 4f17a3331f..9f946da6fe 100644 --- a/src/cmd/vendor/golang.org/x/sys/windows/security_windows.go +++ b/src/cmd/vendor/golang.org/x/sys/windows/security_windows.go @@ -149,7 +149,7 @@ const ( DOMAIN_ALIAS_RID_REMOTE_DESKTOP_USERS = 0x22b DOMAIN_ALIAS_RID_NETWORK_CONFIGURATION_OPS = 0x22c DOMAIN_ALIAS_RID_INCOMING_FOREST_TRUST_BUILDERS = 0x22d - DOMAIN_ALIAS_RID_MONITORING_USERS = 0X22e + DOMAIN_ALIAS_RID_MONITORING_USERS = 0x22e DOMAIN_ALIAS_RID_LOGGING_USERS = 0x22f DOMAIN_ALIAS_RID_AUTHORIZATIONACCESS = 0x230 DOMAIN_ALIAS_RID_TS_LICENSE_SERVERS = 0x231 diff --git a/src/cmd/vendor/golang.org/x/sys/windows/syscall_windows.go b/src/cmd/vendor/golang.org/x/sys/windows/syscall_windows.go index 8a00b71f1d..f72fa55f3e 100644 --- a/src/cmd/vendor/golang.org/x/sys/windows/syscall_windows.go +++ b/src/cmd/vendor/golang.org/x/sys/windows/syscall_windows.go @@ -172,6 +172,7 @@ func NewCallbackCDecl(fn interface{}) uintptr { //sys GetProcessTimes(handle Handle, creationTime *Filetime, exitTime *Filetime, kernelTime *Filetime, userTime *Filetime) (err error) //sys DuplicateHandle(hSourceProcessHandle Handle, hSourceHandle Handle, hTargetProcessHandle Handle, lpTargetHandle *Handle, dwDesiredAccess uint32, bInheritHandle bool, dwOptions uint32) (err error) //sys WaitForSingleObject(handle Handle, waitMilliseconds uint32) (event uint32, err error) [failretval==0xffffffff] +//sys waitForMultipleObjects(count uint32, handles uintptr, waitAll bool, waitMilliseconds uint32) (event uint32, err error) [failretval==0xffffffff] = WaitForMultipleObjects //sys GetTempPath(buflen uint32, buf *uint16) (n uint32, err error) = GetTempPathW //sys CreatePipe(readhandle *Handle, writehandle *Handle, sa *SecurityAttributes, size uint32) (err error) //sys GetFileType(filehandle Handle) (n uint32, err error) @@ -589,6 +590,18 @@ func LoadSetFileCompletionNotificationModes() error { return procSetFileCompletionNotificationModes.Find() } +func WaitForMultipleObjects(handles []Handle, waitAll bool, waitMilliseconds uint32) (event uint32, err error) { + // Every other win32 array API takes arguments as "pointer, count", except for this function. So we + // can't declare it as a usual [] type, because mksyscall will use the opposite order. We therefore + // trivially stub this ourselves. + + var handlePtr *Handle + if len(handles) > 0 { + handlePtr = &handles[0] + } + return waitForMultipleObjects(uint32(len(handles)), uintptr(unsafe.Pointer(handlePtr)), waitAll, waitMilliseconds) +} + // net api calls const socket_error = uintptr(^uint32(0)) diff --git a/src/cmd/vendor/golang.org/x/sys/windows/zsyscall_windows.go b/src/cmd/vendor/golang.org/x/sys/windows/zsyscall_windows.go index fc56aec035..e4b54e2d92 100644 --- a/src/cmd/vendor/golang.org/x/sys/windows/zsyscall_windows.go +++ b/src/cmd/vendor/golang.org/x/sys/windows/zsyscall_windows.go @@ -112,6 +112,7 @@ var ( procGetProcessTimes = modkernel32.NewProc("GetProcessTimes") procDuplicateHandle = modkernel32.NewProc("DuplicateHandle") procWaitForSingleObject = modkernel32.NewProc("WaitForSingleObject") + procWaitForMultipleObjects = modkernel32.NewProc("WaitForMultipleObjects") procGetTempPathW = modkernel32.NewProc("GetTempPathW") procCreatePipe = modkernel32.NewProc("CreatePipe") procGetFileType = modkernel32.NewProc("GetFileType") @@ -1084,6 +1085,25 @@ func WaitForSingleObject(handle Handle, waitMilliseconds uint32) (event uint32, return } +func waitForMultipleObjects(count uint32, handles uintptr, waitAll bool, waitMilliseconds uint32) (event uint32, err error) { + var _p0 uint32 + if waitAll { + _p0 = 1 + } else { + _p0 = 0 + } + r0, _, e1 := syscall.Syscall6(procWaitForMultipleObjects.Addr(), 4, uintptr(count), uintptr(handles), uintptr(_p0), uintptr(waitMilliseconds), 0, 0) + event = uint32(r0) + if event == 0xffffffff { + if e1 != 0 { + err = errnoErr(e1) + } else { + err = syscall.EINVAL + } + } + return +} + func GetTempPath(buflen uint32, buf *uint16) (n uint32, err error) { r0, _, e1 := syscall.Syscall(procGetTempPathW.Addr(), 2, uintptr(buflen), uintptr(unsafe.Pointer(buf)), 0) n = uint32(r0) diff --git a/src/cmd/vendor/vendor.json b/src/cmd/vendor/vendor.json index ef7255acd1..053e2afc4f 100644 --- a/src/cmd/vendor/vendor.json +++ b/src/cmd/vendor/vendor.json @@ -135,46 +135,46 @@ "revisionTime": "2018-05-24T11:38:20Z" }, { - "checksumSHA1": "VmY64lAjYXrfzg4lPNIXh9HqIg0=", + "checksumSHA1": "v0kuTLSywKZmIwuyR3JyT18CgZk=", "path": "golang.org/x/sys/unix", - "revision": "1775db3f06b568179d273425900dd09125831dd5", - "revisionTime": "2019-01-06T17:38:07Z" + "revision": "cc5685c2db1239775905f3911f0067c0fa74762f", + "revisionTime": "2019-02-24T20:24:49Z" }, { - "checksumSHA1": "WoSat9PbqZFXREek5bkUBr256/Q=", + "checksumSHA1": "/G/UvW6DnpLWoplv0wkB3JunvXk=", "path": "golang.org/x/sys/windows", - "revision": "074acd46bca67915925527c07849494d115e7c43", - "revisionTime": "2018-12-18T18:24:21Z" + "revision": "cc5685c2db1239775905f3911f0067c0fa74762f", + "revisionTime": "2019-02-24T20:24:49Z" }, { "checksumSHA1": "yEg3f1MGwuyDh5NrNEGkWKlTyqY=", "path": "golang.org/x/sys/windows/registry", - "revision": "90868a75fefd03942536221d7c0e2f84ec62a668", - "revisionTime": "2018-08-01T20:46:00Z" + "revision": "cc5685c2db1239775905f3911f0067c0fa74762f", + "revisionTime": "2019-02-24T20:24:49Z" }, { "checksumSHA1": "sL1Y17u+ri3uepsUZOZ4uopiPEg=", "path": "golang.org/x/sys/windows/svc", - "revision": "074acd46bca67915925527c07849494d115e7c43", - "revisionTime": "2018-12-18T18:24:21Z" + "revision": "cc5685c2db1239775905f3911f0067c0fa74762f", + "revisionTime": "2019-02-24T20:24:49Z" }, { "checksumSHA1": "e9KJPWrdqg5PMkbE2w60Io8rY4M=", "path": "golang.org/x/sys/windows/svc/debug", - "revision": "90868a75fefd03942536221d7c0e2f84ec62a668", - "revisionTime": "2018-08-01T20:46:00Z" + "revision": "cc5685c2db1239775905f3911f0067c0fa74762f", + "revisionTime": "2019-02-24T20:24:49Z" }, { "checksumSHA1": "dz53pQfqAnXG8HdJj+nazXN9YRw=", "path": "golang.org/x/sys/windows/svc/eventlog", - "revision": "90868a75fefd03942536221d7c0e2f84ec62a668", - "revisionTime": "2018-08-01T20:46:00Z" + "revision": "cc5685c2db1239775905f3911f0067c0fa74762f", + "revisionTime": "2019-02-24T20:24:49Z" }, { "checksumSHA1": "vV6Mr/b+1GaHiHLnq2zEejQJVec=", "path": "golang.org/x/sys/windows/svc/mgr", - "revision": "90868a75fefd03942536221d7c0e2f84ec62a668", - "revisionTime": "2018-08-01T20:46:00Z" + "revision": "cc5685c2db1239775905f3911f0067c0fa74762f", + "revisionTime": "2019-02-24T20:24:49Z" }, { "checksumSHA1": "witNkDO7koGO7+oxpBMZBvoxz3c=", diff --git a/src/cmd/vet/testdata/src/asm/asm.go b/src/cmd/vet/testdata/asm/asm.go similarity index 100% rename from src/cmd/vet/testdata/src/asm/asm.go rename to src/cmd/vet/testdata/asm/asm.go diff --git a/src/cmd/vet/testdata/src/asm/asm1.s b/src/cmd/vet/testdata/asm/asm1.s similarity index 100% rename from src/cmd/vet/testdata/src/asm/asm1.s rename to src/cmd/vet/testdata/asm/asm1.s diff --git a/src/cmd/vet/testdata/src/assign/assign.go b/src/cmd/vet/testdata/assign/assign.go similarity index 100% rename from src/cmd/vet/testdata/src/assign/assign.go rename to src/cmd/vet/testdata/assign/assign.go diff --git a/src/cmd/vet/testdata/src/atomic/atomic.go b/src/cmd/vet/testdata/atomic/atomic.go similarity index 100% rename from src/cmd/vet/testdata/src/atomic/atomic.go rename to src/cmd/vet/testdata/atomic/atomic.go diff --git a/src/cmd/vet/testdata/src/bool/bool.go b/src/cmd/vet/testdata/bool/bool.go similarity index 100% rename from src/cmd/vet/testdata/src/bool/bool.go rename to src/cmd/vet/testdata/bool/bool.go diff --git a/src/cmd/vet/testdata/src/buildtag/buildtag.go b/src/cmd/vet/testdata/buildtag/buildtag.go similarity index 100% rename from src/cmd/vet/testdata/src/buildtag/buildtag.go rename to src/cmd/vet/testdata/buildtag/buildtag.go diff --git a/src/cmd/vet/testdata/src/cgo/cgo.go b/src/cmd/vet/testdata/cgo/cgo.go similarity index 100% rename from src/cmd/vet/testdata/src/cgo/cgo.go rename to src/cmd/vet/testdata/cgo/cgo.go diff --git a/src/cmd/vet/testdata/src/composite/composite.go b/src/cmd/vet/testdata/composite/composite.go similarity index 100% rename from src/cmd/vet/testdata/src/composite/composite.go rename to src/cmd/vet/testdata/composite/composite.go diff --git a/src/cmd/vet/testdata/src/copylock/copylock.go b/src/cmd/vet/testdata/copylock/copylock.go similarity index 100% rename from src/cmd/vet/testdata/src/copylock/copylock.go rename to src/cmd/vet/testdata/copylock/copylock.go diff --git a/src/cmd/vet/testdata/src/deadcode/deadcode.go b/src/cmd/vet/testdata/deadcode/deadcode.go similarity index 100% rename from src/cmd/vet/testdata/src/deadcode/deadcode.go rename to src/cmd/vet/testdata/deadcode/deadcode.go diff --git a/src/cmd/vet/testdata/src/httpresponse/httpresponse.go b/src/cmd/vet/testdata/httpresponse/httpresponse.go similarity index 100% rename from src/cmd/vet/testdata/src/httpresponse/httpresponse.go rename to src/cmd/vet/testdata/httpresponse/httpresponse.go diff --git a/src/cmd/vet/testdata/src/lostcancel/lostcancel.go b/src/cmd/vet/testdata/lostcancel/lostcancel.go similarity index 100% rename from src/cmd/vet/testdata/src/lostcancel/lostcancel.go rename to src/cmd/vet/testdata/lostcancel/lostcancel.go diff --git a/src/cmd/vet/testdata/src/method/method.go b/src/cmd/vet/testdata/method/method.go similarity index 100% rename from src/cmd/vet/testdata/src/method/method.go rename to src/cmd/vet/testdata/method/method.go diff --git a/src/cmd/vet/testdata/src/nilfunc/nilfunc.go b/src/cmd/vet/testdata/nilfunc/nilfunc.go similarity index 100% rename from src/cmd/vet/testdata/src/nilfunc/nilfunc.go rename to src/cmd/vet/testdata/nilfunc/nilfunc.go diff --git a/src/cmd/vet/testdata/src/print/print.go b/src/cmd/vet/testdata/print/print.go similarity index 94% rename from src/cmd/vet/testdata/src/print/print.go rename to src/cmd/vet/testdata/print/print.go index 6bacd0fd74..7a4783aee4 100644 --- a/src/cmd/vet/testdata/src/print/print.go +++ b/src/cmd/vet/testdata/print/print.go @@ -126,16 +126,16 @@ func PrintfTests() { fmt.Printf("%U", x) // ERROR "Printf format %U has arg x of wrong type float64" fmt.Printf("%x", nil) // ERROR "Printf format %x has arg nil of wrong type untyped nil" fmt.Printf("%X", 2.3) // ERROR "Printf format %X has arg 2.3 of wrong type float64" - fmt.Printf("%s", stringerv) // ERROR "Printf format %s has arg stringerv of wrong type print.ptrStringer" - fmt.Printf("%t", stringerv) // ERROR "Printf format %t has arg stringerv of wrong type print.ptrStringer" - fmt.Printf("%s", embeddedStringerv) // ERROR "Printf format %s has arg embeddedStringerv of wrong type print.embeddedStringer" - fmt.Printf("%t", embeddedStringerv) // ERROR "Printf format %t has arg embeddedStringerv of wrong type print.embeddedStringer" - fmt.Printf("%q", notstringerv) // ERROR "Printf format %q has arg notstringerv of wrong type print.notstringer" - fmt.Printf("%t", notstringerv) // ERROR "Printf format %t has arg notstringerv of wrong type print.notstringer" - fmt.Printf("%t", stringerarrayv) // ERROR "Printf format %t has arg stringerarrayv of wrong type print.stringerarray" - fmt.Printf("%t", notstringerarrayv) // ERROR "Printf format %t has arg notstringerarrayv of wrong type print.notstringerarray" - fmt.Printf("%q", notstringerarrayv) // ERROR "Printf format %q has arg notstringerarrayv of wrong type print.notstringerarray" - fmt.Printf("%d", BoolFormatter(true)) // ERROR "Printf format %d has arg BoolFormatter\(true\) of wrong type print.BoolFormatter" + fmt.Printf("%s", stringerv) // ERROR "Printf format %s has arg stringerv of wrong type .*print.ptrStringer" + fmt.Printf("%t", stringerv) // ERROR "Printf format %t has arg stringerv of wrong type .*print.ptrStringer" + fmt.Printf("%s", embeddedStringerv) // ERROR "Printf format %s has arg embeddedStringerv of wrong type .*print.embeddedStringer" + fmt.Printf("%t", embeddedStringerv) // ERROR "Printf format %t has arg embeddedStringerv of wrong type .*print.embeddedStringer" + fmt.Printf("%q", notstringerv) // ERROR "Printf format %q has arg notstringerv of wrong type .*print.notstringer" + fmt.Printf("%t", notstringerv) // ERROR "Printf format %t has arg notstringerv of wrong type .*print.notstringer" + fmt.Printf("%t", stringerarrayv) // ERROR "Printf format %t has arg stringerarrayv of wrong type .*print.stringerarray" + fmt.Printf("%t", notstringerarrayv) // ERROR "Printf format %t has arg notstringerarrayv of wrong type .*print.notstringerarray" + fmt.Printf("%q", notstringerarrayv) // ERROR "Printf format %q has arg notstringerarrayv of wrong type .*print.notstringerarray" + fmt.Printf("%d", BoolFormatter(true)) // ERROR "Printf format %d has arg BoolFormatter\(true\) of wrong type .*print.BoolFormatter" fmt.Printf("%z", FormatterVal(true)) // correct (the type is responsible for formatting) fmt.Printf("%d", FormatterVal(true)) // correct (the type is responsible for formatting) fmt.Printf("%s", nonemptyinterface) // correct (the type is responsible for formatting) @@ -186,10 +186,10 @@ func PrintfTests() { Printf("d%", 2) // ERROR "Printf format % is missing verb at end of string" Printf("%d", percentDV) Printf("%d", &percentDV) - Printf("%d", notPercentDV) // ERROR "Printf format %d has arg notPercentDV of wrong type print.notPercentDStruct" - Printf("%d", ¬PercentDV) // ERROR "Printf format %d has arg ¬PercentDV of wrong type \*print.notPercentDStruct" + Printf("%d", notPercentDV) // ERROR "Printf format %d has arg notPercentDV of wrong type .*print.notPercentDStruct" + Printf("%d", ¬PercentDV) // ERROR "Printf format %d has arg ¬PercentDV of wrong type \*.*print.notPercentDStruct" Printf("%p", ¬PercentDV) // Works regardless: we print it as a pointer. - Printf("%q", &percentDV) // ERROR "Printf format %q has arg &percentDV of wrong type \*print.percentDStruct" + Printf("%q", &percentDV) // ERROR "Printf format %q has arg &percentDV of wrong type \*.*print.percentDStruct" Printf("%s", percentSV) Printf("%s", &percentSV) // Good argument reorderings. @@ -234,7 +234,7 @@ func PrintfTests() { Printf("%T", someFunction) // ok: maybe someone wants to see the type // Bug: used to recur forever. Printf("%p %x", recursiveStructV, recursiveStructV.next) - Printf("%p %x", recursiveStruct1V, recursiveStruct1V.next) // ERROR "Printf format %x has arg recursiveStruct1V\.next of wrong type \*print\.RecursiveStruct2" + Printf("%p %x", recursiveStruct1V, recursiveStruct1V.next) // ERROR "Printf format %x has arg recursiveStruct1V\.next of wrong type \*.*print\.RecursiveStruct2" Printf("%p %x", recursiveSliceV, recursiveSliceV) Printf("%p %x", recursiveMapV, recursiveMapV) // Special handling for Log. @@ -587,37 +587,37 @@ func UnexportedStringerOrError() { fmt.Printf("%s", unexportedInterface{3}) // ok; we can't see the problem us := unexportedStringer{} - fmt.Printf("%s", us) // ERROR "Printf format %s has arg us of wrong type print.unexportedStringer" - fmt.Printf("%s", &us) // ERROR "Printf format %s has arg &us of wrong type [*]print.unexportedStringer" + fmt.Printf("%s", us) // ERROR "Printf format %s has arg us of wrong type .*print.unexportedStringer" + fmt.Printf("%s", &us) // ERROR "Printf format %s has arg &us of wrong type [*].*print.unexportedStringer" usf := unexportedStringerOtherFields{ s: "foo", S: "bar", } - fmt.Printf("%s", usf) // ERROR "Printf format %s has arg usf of wrong type print.unexportedStringerOtherFields" - fmt.Printf("%s", &usf) // ERROR "Printf format %s has arg &usf of wrong type [*]print.unexportedStringerOtherFields" + fmt.Printf("%s", usf) // ERROR "Printf format %s has arg usf of wrong type .*print.unexportedStringerOtherFields" + fmt.Printf("%s", &usf) // ERROR "Printf format %s has arg &usf of wrong type [*].*print.unexportedStringerOtherFields" ue := unexportedError{ e: &errorer{}, } - fmt.Printf("%s", ue) // ERROR "Printf format %s has arg ue of wrong type print.unexportedError" - fmt.Printf("%s", &ue) // ERROR "Printf format %s has arg &ue of wrong type [*]print.unexportedError" + fmt.Printf("%s", ue) // ERROR "Printf format %s has arg ue of wrong type .*print.unexportedError" + fmt.Printf("%s", &ue) // ERROR "Printf format %s has arg &ue of wrong type [*].*print.unexportedError" uef := unexportedErrorOtherFields{ s: "foo", e: &errorer{}, S: "bar", } - fmt.Printf("%s", uef) // ERROR "Printf format %s has arg uef of wrong type print.unexportedErrorOtherFields" - fmt.Printf("%s", &uef) // ERROR "Printf format %s has arg &uef of wrong type [*]print.unexportedErrorOtherFields" + fmt.Printf("%s", uef) // ERROR "Printf format %s has arg uef of wrong type .*print.unexportedErrorOtherFields" + fmt.Printf("%s", &uef) // ERROR "Printf format %s has arg &uef of wrong type [*].*print.unexportedErrorOtherFields" uce := unexportedCustomError{ e: errorer{}, } - fmt.Printf("%s", uce) // ERROR "Printf format %s has arg uce of wrong type print.unexportedCustomError" + fmt.Printf("%s", uce) // ERROR "Printf format %s has arg uce of wrong type .*print.unexportedCustomError" uei := unexportedErrorInterface{} - fmt.Printf("%s", uei) // ERROR "Printf format %s has arg uei of wrong type print.unexportedErrorInterface" + fmt.Printf("%s", uei) // ERROR "Printf format %s has arg uei of wrong type .*print.unexportedErrorInterface" fmt.Println("foo\n", "bar") // not an error fmt.Println("foo\n") // ERROR "Println arg list ends with redundant newline" @@ -627,7 +627,7 @@ func UnexportedStringerOrError() { intSlice := []int{3, 4} fmt.Printf("%s", intSlice) // ERROR "Printf format %s has arg intSlice of wrong type \[\]int" nonStringerArray := [1]unexportedStringer{{}} - fmt.Printf("%s", nonStringerArray) // ERROR "Printf format %s has arg nonStringerArray of wrong type \[1\]print.unexportedStringer" + fmt.Printf("%s", nonStringerArray) // ERROR "Printf format %s has arg nonStringerArray of wrong type \[1\].*print.unexportedStringer" fmt.Printf("%s", []stringer{3, 4}) // not an error fmt.Printf("%s", [2]stringer{3, 4}) // not an error } @@ -677,5 +677,5 @@ func PointersToCompoundTypes() { type T1 struct { X *T2 } - fmt.Printf("%s\n", T1{&T2{"x"}}) // ERROR "Printf format %s has arg T1{&T2{.x.}} of wrong type print\.T1" + fmt.Printf("%s\n", T1{&T2{"x"}}) // ERROR "Printf format %s has arg T1{&T2{.x.}} of wrong type .*print\.T1" } diff --git a/src/cmd/vet/testdata/src/rangeloop/rangeloop.go b/src/cmd/vet/testdata/rangeloop/rangeloop.go similarity index 100% rename from src/cmd/vet/testdata/src/rangeloop/rangeloop.go rename to src/cmd/vet/testdata/rangeloop/rangeloop.go diff --git a/src/cmd/vet/testdata/src/shift/shift.go b/src/cmd/vet/testdata/shift/shift.go similarity index 100% rename from src/cmd/vet/testdata/src/shift/shift.go rename to src/cmd/vet/testdata/shift/shift.go diff --git a/src/cmd/vet/testdata/src/structtag/structtag.go b/src/cmd/vet/testdata/structtag/structtag.go similarity index 100% rename from src/cmd/vet/testdata/src/structtag/structtag.go rename to src/cmd/vet/testdata/structtag/structtag.go diff --git a/src/cmd/vet/testdata/src/tagtest/file1.go b/src/cmd/vet/testdata/tagtest/file1.go similarity index 100% rename from src/cmd/vet/testdata/src/tagtest/file1.go rename to src/cmd/vet/testdata/tagtest/file1.go diff --git a/src/cmd/vet/testdata/src/tagtest/file2.go b/src/cmd/vet/testdata/tagtest/file2.go similarity index 100% rename from src/cmd/vet/testdata/src/tagtest/file2.go rename to src/cmd/vet/testdata/tagtest/file2.go diff --git a/src/cmd/vet/testdata/src/testingpkg/tests.go b/src/cmd/vet/testdata/testingpkg/tests.go similarity index 100% rename from src/cmd/vet/testdata/src/testingpkg/tests.go rename to src/cmd/vet/testdata/testingpkg/tests.go diff --git a/src/cmd/vet/testdata/src/testingpkg/tests_test.go b/src/cmd/vet/testdata/testingpkg/tests_test.go similarity index 100% rename from src/cmd/vet/testdata/src/testingpkg/tests_test.go rename to src/cmd/vet/testdata/testingpkg/tests_test.go diff --git a/src/cmd/vet/testdata/src/unmarshal/unmarshal.go b/src/cmd/vet/testdata/unmarshal/unmarshal.go similarity index 100% rename from src/cmd/vet/testdata/src/unmarshal/unmarshal.go rename to src/cmd/vet/testdata/unmarshal/unmarshal.go diff --git a/src/cmd/vet/testdata/src/unsafeptr/unsafeptr.go b/src/cmd/vet/testdata/unsafeptr/unsafeptr.go similarity index 100% rename from src/cmd/vet/testdata/src/unsafeptr/unsafeptr.go rename to src/cmd/vet/testdata/unsafeptr/unsafeptr.go diff --git a/src/cmd/vet/testdata/src/unused/unused.go b/src/cmd/vet/testdata/unused/unused.go similarity index 100% rename from src/cmd/vet/testdata/src/unused/unused.go rename to src/cmd/vet/testdata/unused/unused.go diff --git a/src/cmd/vet/vet_test.go b/src/cmd/vet/vet_test.go index d106c5c29c..e9b8c69d53 100644 --- a/src/cmd/vet/vet_test.go +++ b/src/cmd/vet/vet_test.go @@ -13,6 +13,7 @@ import ( "log" "os" "os/exec" + "path" "path/filepath" "regexp" "strconv" @@ -21,15 +22,21 @@ import ( "testing" ) -const ( - dataDir = "testdata" - binary = "./testvet.exe" -) +const dataDir = "testdata" + +var binary string // We implement TestMain so remove the test binary when all is done. func TestMain(m *testing.M) { + dir, err := ioutil.TempDir("", "vet_test") + if err != nil { + fmt.Fprintln(os.Stderr, err) + os.Exit(1) + } + defer os.RemoveAll(dir) + binary = filepath.Join(dir, "testvet.exe") + result := m.Run() - os.Remove(binary) os.Exit(result) } @@ -59,14 +66,9 @@ func Build(t *testing.T) { built = true } -func vetCmd(t *testing.T, args ...string) *exec.Cmd { - cmd := exec.Command(testenv.GoToolPath(t), "vet", "-vettool="+binary) - cmd.Args = append(cmd.Args, args...) - testdata, err := filepath.Abs("testdata") - if err != nil { - t.Fatal(err) - } - cmd.Env = append(os.Environ(), "GOPATH="+testdata) +func vetCmd(t *testing.T, arg, pkg string) *exec.Cmd { + cmd := exec.Command(testenv.GoToolPath(t), "vet", "-vettool="+binary, arg, path.Join("cmd/vet/testdata", pkg)) + cmd.Env = os.Environ() return cmd } @@ -113,7 +115,7 @@ func TestVet(t *testing.T) { cmd.Env = append(cmd.Env, "GOOS=linux", "GOARCH=amd64") } - dir := filepath.Join("testdata/src", pkg) + dir := filepath.Join("testdata", pkg) gos, err := filepath.Glob(filepath.Join(dir, "*.go")) if err != nil { t.Fatal(err) diff --git a/src/compress/flate/deflate_test.go b/src/compress/flate/deflate_test.go index 831be2198c..079c03c283 100644 --- a/src/compress/flate/deflate_test.go +++ b/src/compress/flate/deflate_test.go @@ -161,7 +161,7 @@ func TestVeryLongSparseChunk(t *testing.T) { t.Errorf("NewWriter: %v", err) return } - if _, err = io.Copy(w, &sparseReader{l: 23E8}); err != nil { + if _, err = io.Copy(w, &sparseReader{l: 23e8}); err != nil { t.Errorf("Compress failed: %v", err) return } diff --git a/src/compress/gzip/gunzip.go b/src/compress/gzip/gunzip.go index 85d52e8500..924bce10b7 100644 --- a/src/compress/gzip/gunzip.go +++ b/src/compress/gzip/gunzip.go @@ -126,8 +126,8 @@ func (z *Reader) Reset(r io.Reader) error { // can be useful when reading file formats that distinguish individual gzip // data streams or mix gzip data streams with other data streams. // In this mode, when the Reader reaches the end of the data stream, -// Read returns io.EOF. If the underlying reader implements io.ByteReader, -// it will be left positioned just after the gzip stream. +// Read returns io.EOF. The underlying reader must implement io.ByteReader +// in order to be left positioned just after the gzip stream. // To start the next stream, call z.Reset(r) followed by z.Multistream(false). // If there is no next stream, z.Reset(r) will return io.EOF. func (z *Reader) Multistream(ok bool) { diff --git a/src/container/heap/example_pq_test.go b/src/container/heap/example_pq_test.go index 7017095cb8..da1a233b70 100644 --- a/src/container/heap/example_pq_test.go +++ b/src/container/heap/example_pq_test.go @@ -45,6 +45,7 @@ func (pq *PriorityQueue) Pop() interface{} { old := *pq n := len(old) item := old[n-1] + old[n-1] = nil // avoid memory leak item.index = -1 // for safety *pq = old[0 : n-1] return item diff --git a/src/crypto/rc4/rc4.go b/src/crypto/rc4/rc4.go index d5e6ebcd71..c2df0db2dc 100644 --- a/src/crypto/rc4/rc4.go +++ b/src/crypto/rc4/rc4.go @@ -45,8 +45,10 @@ func NewCipher(key []byte) (*Cipher, error) { return &c, nil } -// Reset zeros the key data so that it will no longer appear in the -// process's memory. +// Reset zeros the key data and makes the Cipher unusable. +// +// Deprecated: Reset can't guarantee that the key will be entirely removed from +// the process's memory. func (c *Cipher) Reset() { for i := range c.s { c.s[i] = 0 diff --git a/src/crypto/tls/boring.go b/src/crypto/tls/boring.go index cd74495aa6..f6d922c673 100644 --- a/src/crypto/tls/boring.go +++ b/src/crypto/tls/boring.go @@ -106,11 +106,8 @@ func isBoringCertificate(c *x509.Certificate) bool { // supportedSignatureAlgorithms returns the supported signature algorithms. // It knows that the FIPS-allowed ones are all at the beginning of // defaultSupportedSignatureAlgorithms. -func supportedSignatureAlgorithms(version uint16) []SignatureScheme { +func supportedSignatureAlgorithms() []SignatureScheme { all := defaultSupportedSignatureAlgorithms - if version < VersionTLS13 { - all = defaultSupportedSignatureAlgorithmsTLS12 - } if !needFIPS() { return all } diff --git a/src/crypto/tls/common.go b/src/crypto/tls/common.go index 515d9124c1..6e3a8416f8 100644 --- a/src/crypto/tls/common.go +++ b/src/crypto/tls/common.go @@ -179,9 +179,6 @@ var defaultSupportedSignatureAlgorithms = []SignatureScheme{ ECDSAWithSHA1, } -// RSA-PSS is disabled in TLS 1.2 for Go 1.12. See Issue 30055. -var defaultSupportedSignatureAlgorithmsTLS12 = defaultSupportedSignatureAlgorithms[3:] - // helloRetryRequestRandom is set as the Random value of a ServerHello // to signal that the message is actually a HelloRetryRequest. var helloRetryRequestRandom = []byte{ // See RFC 8446, Section 4.1.3. diff --git a/src/crypto/tls/handshake_client.go b/src/crypto/tls/handshake_client.go index 44acdbaf2d..b8d6e93264 100644 --- a/src/crypto/tls/handshake_client.go +++ b/src/crypto/tls/handshake_client.go @@ -85,7 +85,6 @@ func (c *Conn) makeClientHello() (*clientHelloMsg, ecdheParameters, error) { possibleCipherSuites := config.cipherSuites() hello.cipherSuites = make([]uint16, 0, len(possibleCipherSuites)) -NextCipherSuite: for _, suiteId := range possibleCipherSuites { for _, suite := range cipherSuites { if suite.id != suiteId { @@ -94,10 +93,10 @@ NextCipherSuite: // Don't advertise TLS 1.2-only cipher suites unless // we're attempting TLS 1.2. if hello.vers < VersionTLS12 && suite.flags&suiteTLS12 != 0 { - continue + break } hello.cipherSuites = append(hello.cipherSuites, suiteId) - continue NextCipherSuite + break } } @@ -114,13 +113,7 @@ NextCipherSuite: } if hello.vers >= VersionTLS12 { - // The non-BoringCrypto behavior here is to use the full set of - // signature algorithms, even if TLS 1.3 is not being negotiated. It's - // debatable if this is correct or not, because on one hand it allows - // RSA-PSS as a client with TLS 1.2, but on the other hand we can't - // predict what the server will pick when we do advertise TLS 1.3, so we - // might end up with TLS 1.2 + RSA-PSS anyway. Anyway, it will go away soon. - hello.supportedSignatureAlgorithms = supportedSignatureAlgorithms(VersionTLS13) + hello.supportedSignatureAlgorithms = supportedSignatureAlgorithms() } if testingOnlyForceClientHelloSignatureAlgorithms != nil { hello.supportedSignatureAlgorithms = testingOnlyForceClientHelloSignatureAlgorithms diff --git a/src/crypto/tls/handshake_client_test.go b/src/crypto/tls/handshake_client_test.go index 2314501a3b..d961cab4bc 100644 --- a/src/crypto/tls/handshake_client_test.go +++ b/src/crypto/tls/handshake_client_test.go @@ -28,7 +28,7 @@ import ( func init() { // TLS 1.3 cipher suites preferences are not configurable and change based - // on the architecture. Force them to the version with AES accelleration for + // on the architecture. Force them to the version with AES acceleration for // test consistency. once.Do(initDefaultCipherSuites) varDefaultCipherSuitesTLS13 = []uint16{ @@ -855,30 +855,6 @@ func TestHandshakeClientCertRSAPKCS1v15(t *testing.T) { runClientTestTLS12(t, test) } -func TestHandshakeClientCertPSSDisabled(t *testing.T) { - config := testConfig.Clone() - cert, _ := X509KeyPair([]byte(clientCertificatePEM), []byte(clientKeyPEM)) - config.Certificates = []Certificate{cert} - - test := &clientTest{ - name: "ClientCert-RSA-PSS-Disabled", - args: []string{"-cipher", "AES128", "-Verify", "1"}, - config: config, - } - - // Restore the default signature algorithms, disabling RSA-PSS in TLS 1.2, - // and check that handshakes still work. - testSupportedSignatureAlgorithmsTLS12 := defaultSupportedSignatureAlgorithmsTLS12 - defer func() { defaultSupportedSignatureAlgorithmsTLS12 = testSupportedSignatureAlgorithmsTLS12 }() - defaultSupportedSignatureAlgorithmsTLS12 = savedSupportedSignatureAlgorithmsTLS12 - - // Use t.Run to ensure the defer runs after all parallel tests end. - t.Run("", func(t *testing.T) { - runClientTestTLS12(t, test) - runClientTestTLS13(t, test) - }) -} - func TestClientKeyUpdate(t *testing.T) { test := &clientTest{ name: "KeyUpdate", diff --git a/src/crypto/tls/handshake_client_tls13.go b/src/crypto/tls/handshake_client_tls13.go index 0ffa7d6edf..186275b12e 100644 --- a/src/crypto/tls/handshake_client_tls13.go +++ b/src/crypto/tls/handshake_client_tls13.go @@ -452,7 +452,7 @@ func (hs *clientHandshakeStateTLS13) readServerCertificate() error { } // See RFC 8446, Section 4.4.3. - if !isSupportedSignatureAlgorithm(certVerify.signatureAlgorithm, supportedSignatureAlgorithms(VersionTLS13)) { + if !isSupportedSignatureAlgorithm(certVerify.signatureAlgorithm, supportedSignatureAlgorithms()) { c.sendAlert(alertIllegalParameter) return errors.New("tls: invalid certificate signature algorithm") } diff --git a/src/crypto/tls/handshake_messages_test.go b/src/crypto/tls/handshake_messages_test.go index ec8dea43fe..1f08f6ac0e 100644 --- a/src/crypto/tls/handshake_messages_test.go +++ b/src/crypto/tls/handshake_messages_test.go @@ -151,10 +151,10 @@ func (*clientHelloMsg) Generate(rand *rand.Rand, size int) reflect.Value { } } if rand.Intn(10) > 5 { - m.supportedSignatureAlgorithms = supportedSignatureAlgorithms(VersionTLS13) + m.supportedSignatureAlgorithms = supportedSignatureAlgorithms() } if rand.Intn(10) > 5 { - m.supportedSignatureAlgorithmsCert = supportedSignatureAlgorithms(VersionTLS13) + m.supportedSignatureAlgorithmsCert = supportedSignatureAlgorithms() } for i := 0; i < rand.Intn(5); i++ { m.alpnProtocols = append(m.alpnProtocols, randomString(rand.Intn(20)+1, rand)) @@ -386,10 +386,10 @@ func (*certificateRequestMsgTLS13) Generate(rand *rand.Rand, size int) reflect.V m.scts = true } if rand.Intn(10) > 5 { - m.supportedSignatureAlgorithms = supportedSignatureAlgorithms(VersionTLS13) + m.supportedSignatureAlgorithms = supportedSignatureAlgorithms() } if rand.Intn(10) > 5 { - m.supportedSignatureAlgorithmsCert = supportedSignatureAlgorithms(VersionTLS13) + m.supportedSignatureAlgorithmsCert = supportedSignatureAlgorithms() } if rand.Intn(10) > 5 { m.certificateAuthorities = make([][]byte, 3) diff --git a/src/crypto/tls/handshake_server.go b/src/crypto/tls/handshake_server.go index f82d5392c1..909430facb 100644 --- a/src/crypto/tls/handshake_server.go +++ b/src/crypto/tls/handshake_server.go @@ -463,7 +463,7 @@ func (hs *serverHandshakeState) doFullHandshake() error { } if c.vers >= VersionTLS12 { certReq.hasSignatureAlgorithm = true - certReq.supportedSignatureAlgorithms = supportedSignatureAlgorithms(c.vers) + certReq.supportedSignatureAlgorithms = supportedSignatureAlgorithms() } // An empty list of certificateAuthorities signals to @@ -559,7 +559,7 @@ func (hs *serverHandshakeState) doFullHandshake() error { } // Determine the signature type. - _, sigType, hashFunc, err := pickSignatureAlgorithm(pub, []SignatureScheme{certVerify.signatureAlgorithm}, supportedSignatureAlgorithms(c.vers), c.vers) + _, sigType, hashFunc, err := pickSignatureAlgorithm(pub, []SignatureScheme{certVerify.signatureAlgorithm}, supportedSignatureAlgorithms(), c.vers) if err != nil { c.sendAlert(alertIllegalParameter) return err diff --git a/src/crypto/tls/handshake_server_test.go b/src/crypto/tls/handshake_server_test.go index 8fa83fec75..411648ef68 100644 --- a/src/crypto/tls/handshake_server_test.go +++ b/src/crypto/tls/handshake_server_test.go @@ -1211,33 +1211,6 @@ func TestHandshakeServerRSAPSS(t *testing.T) { runServerTestTLS13(t, test) } -func TestHandshakeServerPSSDisabled(t *testing.T) { - test := &serverTest{ - name: "RSA-PSS-Disabled", - command: []string{"openssl", "s_client", "-no_ticket"}, - wait: true, - } - - // Restore the default signature algorithms, disabling RSA-PSS in TLS 1.2, - // and check that handshakes still work. - testSupportedSignatureAlgorithmsTLS12 := defaultSupportedSignatureAlgorithmsTLS12 - defer func() { defaultSupportedSignatureAlgorithmsTLS12 = testSupportedSignatureAlgorithmsTLS12 }() - defaultSupportedSignatureAlgorithmsTLS12 = savedSupportedSignatureAlgorithmsTLS12 - - runServerTestTLS12(t, test) - runServerTestTLS13(t, test) - - test = &serverTest{ - name: "RSA-PSS-Disabled-Required", - command: []string{"openssl", "s_client", "-no_ticket", "-sigalgs", "rsa_pss_rsae_sha256"}, - wait: true, - - expectHandshakeErrorIncluding: "peer doesn't support any common signature algorithms", - } - - runServerTestTLS12(t, test) -} - func benchmarkHandshakeServer(b *testing.B, version uint16, cipherSuite uint16, curve CurveID, cert []byte, key crypto.PrivateKey) { config := testConfig.Clone() config.CipherSuites = []uint16{cipherSuite} @@ -1417,82 +1390,49 @@ func TestClientAuth(t *testing.T) { defer os.Remove(ecdsaCertPath) ecdsaKeyPath = tempFile(clientECDSAKeyPEM) defer os.Remove(ecdsaKeyPath) + } else { + t.Parallel() } - t.Run("Normal", func(t *testing.T) { - config := testConfig.Clone() - config.ClientAuth = RequestClientCert + config := testConfig.Clone() + config.ClientAuth = RequestClientCert - test := &serverTest{ - name: "ClientAuthRequestedNotGiven", - command: []string{"openssl", "s_client", "-no_ticket", "-cipher", "AES128-SHA"}, - config: config, - } - runServerTestTLS12(t, test) - runServerTestTLS13(t, test) + test := &serverTest{ + name: "ClientAuthRequestedNotGiven", + command: []string{"openssl", "s_client", "-no_ticket", "-cipher", "AES128-SHA"}, + config: config, + } + runServerTestTLS12(t, test) + runServerTestTLS13(t, test) - config.ClientAuth = RequireAnyClientCert + test = &serverTest{ + name: "ClientAuthRequestedAndGiven", + command: []string{"openssl", "s_client", "-no_ticket", "-cipher", "AES128-SHA", + "-cert", certPath, "-key", keyPath, "-sigalgs", "rsa_pss_rsae_sha256"}, + config: config, + expectedPeerCerts: []string{clientCertificatePEM}, + } + runServerTestTLS12(t, test) + runServerTestTLS13(t, test) - test = &serverTest{ - name: "ClientAuthRequestedAndGiven", - command: []string{"openssl", "s_client", "-no_ticket", "-cipher", "AES128-SHA", - "-cert", certPath, "-key", keyPath, "-sigalgs", "rsa_pss_rsae_sha256"}, - config: config, - expectedPeerCerts: []string{clientCertificatePEM}, - } - runServerTestTLS12(t, test) - runServerTestTLS13(t, test) + test = &serverTest{ + name: "ClientAuthRequestedAndECDSAGiven", + command: []string{"openssl", "s_client", "-no_ticket", "-cipher", "AES128-SHA", + "-cert", ecdsaCertPath, "-key", ecdsaKeyPath}, + config: config, + expectedPeerCerts: []string{clientECDSACertificatePEM}, + } + runServerTestTLS12(t, test) + runServerTestTLS13(t, test) - test = &serverTest{ - name: "ClientAuthRequestedAndECDSAGiven", - command: []string{"openssl", "s_client", "-no_ticket", "-cipher", "AES128-SHA", - "-cert", ecdsaCertPath, "-key", ecdsaKeyPath}, - config: config, - expectedPeerCerts: []string{clientECDSACertificatePEM}, - } - runServerTestTLS12(t, test) - runServerTestTLS13(t, test) - - test = &serverTest{ - name: "ClientAuthRequestedAndPKCS1v15Given", - command: []string{"openssl", "s_client", "-no_ticket", "-cipher", "AES128-SHA", - "-cert", certPath, "-key", keyPath, "-sigalgs", "rsa_pkcs1_sha256"}, - config: config, - expectedPeerCerts: []string{clientCertificatePEM}, - } - runServerTestTLS12(t, test) - }) - - // Restore the default signature algorithms, disabling RSA-PSS in TLS 1.2, - // and check that handshakes still work. - testSupportedSignatureAlgorithmsTLS12 := defaultSupportedSignatureAlgorithmsTLS12 - defer func() { defaultSupportedSignatureAlgorithmsTLS12 = testSupportedSignatureAlgorithmsTLS12 }() - defaultSupportedSignatureAlgorithmsTLS12 = savedSupportedSignatureAlgorithmsTLS12 - - t.Run("PSSDisabled", func(t *testing.T) { - config := testConfig.Clone() - config.ClientAuth = RequireAnyClientCert - - test := &serverTest{ - name: "ClientAuthRequestedAndGiven-PSS-Disabled", - command: []string{"openssl", "s_client", "-no_ticket", "-cipher", "AES128-SHA", - "-cert", certPath, "-key", keyPath}, - config: config, - expectedPeerCerts: []string{clientCertificatePEM}, - } - runServerTestTLS12(t, test) - runServerTestTLS13(t, test) - - test = &serverTest{ - name: "ClientAuthRequestedAndGiven-PSS-Disabled-Required", - command: []string{"openssl", "s_client", "-no_ticket", "-cipher", "AES128-SHA", - "-cert", certPath, "-key", keyPath, "-client_sigalgs", "rsa_pss_rsae_sha256"}, - config: config, - - expectHandshakeErrorIncluding: "client didn't provide a certificate", - } - runServerTestTLS12(t, test) - }) + test = &serverTest{ + name: "ClientAuthRequestedAndPKCS1v15Given", + command: []string{"openssl", "s_client", "-no_ticket", "-cipher", "AES128-SHA", + "-cert", certPath, "-key", keyPath, "-sigalgs", "rsa_pkcs1_sha256"}, + config: config, + expectedPeerCerts: []string{clientCertificatePEM}, + } + runServerTestTLS12(t, test) } func TestSNIGivenOnFailure(t *testing.T) { @@ -1782,7 +1722,6 @@ T+E0J8wlH24pgwQHzy7Ko2qLwn1b5PW8ecrlvP1g if err != nil { t.Fatal(err) } - done := make(chan struct{}) go func() { config := testConfig.Clone() @@ -1800,15 +1739,4 @@ T+E0J8wlH24pgwQHzy7Ko2qLwn1b5PW8ecrlvP1g t.Errorf(`expected "handshake failure", got %q`, err) } <-done - - // With RSA-PSS disabled and TLS 1.2, this should work. - - testSupportedSignatureAlgorithmsTLS12 := defaultSupportedSignatureAlgorithmsTLS12 - defer func() { defaultSupportedSignatureAlgorithmsTLS12 = testSupportedSignatureAlgorithmsTLS12 }() - defaultSupportedSignatureAlgorithmsTLS12 = savedSupportedSignatureAlgorithmsTLS12 - - serverConfig := testConfig.Clone() - serverConfig.Certificates = []Certificate{cert} - serverConfig.MaxVersion = VersionTLS12 - testHandshake(t, testConfig, serverConfig) } diff --git a/src/crypto/tls/handshake_server_tls13.go b/src/crypto/tls/handshake_server_tls13.go index 99d335e1ee..4dfb365f8d 100644 --- a/src/crypto/tls/handshake_server_tls13.go +++ b/src/crypto/tls/handshake_server_tls13.go @@ -599,7 +599,7 @@ func (hs *serverHandshakeStateTLS13) sendServerCertificate() error { certReq := new(certificateRequestMsgTLS13) certReq.ocspStapling = true certReq.scts = true - certReq.supportedSignatureAlgorithms = supportedSignatureAlgorithms(VersionTLS13) + certReq.supportedSignatureAlgorithms = supportedSignatureAlgorithms() if c.config.ClientCAs != nil { certReq.certificateAuthorities = c.config.ClientCAs.Subjects() } @@ -805,7 +805,7 @@ func (hs *serverHandshakeStateTLS13) readClientCertificate() error { } // See RFC 8446, Section 4.4.3. - if !isSupportedSignatureAlgorithm(certVerify.signatureAlgorithm, supportedSignatureAlgorithms(VersionTLS13)) { + if !isSupportedSignatureAlgorithm(certVerify.signatureAlgorithm, supportedSignatureAlgorithms()) { c.sendAlert(alertIllegalParameter) return errors.New("tls: invalid certificate signature algorithm") } diff --git a/src/crypto/tls/key_agreement.go b/src/crypto/tls/key_agreement.go index 91f5cde5c3..681ba83c06 100644 --- a/src/crypto/tls/key_agreement.go +++ b/src/crypto/tls/key_agreement.go @@ -177,7 +177,7 @@ NextCandidate: return nil, errors.New("tls: certificate private key does not implement crypto.Signer") } - signatureAlgorithm, sigType, hashFunc, err := pickSignatureAlgorithm(priv.Public(), clientHello.supportedSignatureAlgorithms, supportedSignatureAlgorithms(ka.version), ka.version) + signatureAlgorithm, sigType, hashFunc, err := pickSignatureAlgorithm(priv.Public(), clientHello.supportedSignatureAlgorithms, supportedSignatureAlgorithms(), ka.version) if err != nil { return nil, err } diff --git a/src/crypto/tls/testdata/Client-TLSv12-ClientCert-RSA-PSS-Disabled b/src/crypto/tls/testdata/Client-TLSv12-ClientCert-RSA-PSS-Disabled deleted file mode 100644 index 9d59cb125d..0000000000 --- a/src/crypto/tls/testdata/Client-TLSv12-ClientCert-RSA-PSS-Disabled +++ /dev/null @@ -1,137 +0,0 @@ ->>> Flow 1 (client to server) -00000000 16 03 01 00 f8 01 00 00 f4 03 03 00 00 00 00 00 |................| -00000010 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................| -00000020 00 00 00 00 00 00 00 00 00 00 00 20 00 00 00 00 |........... ....| -00000030 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................| -00000040 00 00 00 00 00 00 00 00 00 00 00 00 00 32 cc a8 |.............2..| -00000050 cc a9 c0 2f c0 2b c0 30 c0 2c c0 27 c0 13 c0 23 |.../.+.0.,.'...#| -00000060 c0 09 c0 14 c0 0a 00 9c 00 9d 00 3c 00 2f 00 35 |...........<./.5| -00000070 c0 12 00 0a 00 05 c0 11 c0 07 13 01 13 03 13 02 |................| -00000080 01 00 00 79 00 05 00 05 01 00 00 00 00 00 0a 00 |...y............| -00000090 0a 00 08 00 1d 00 17 00 18 00 19 00 0b 00 02 01 |................| -000000a0 00 00 0d 00 18 00 16 08 04 08 05 08 06 04 01 04 |................| -000000b0 03 05 01 05 03 06 01 06 03 02 01 02 03 ff 01 00 |................| -000000c0 01 00 00 12 00 00 00 2b 00 09 08 03 04 03 03 03 |.......+........| -000000d0 02 03 01 00 33 00 26 00 24 00 1d 00 20 2f e5 7d |....3.&.$... /.}| -000000e0 a3 47 cd 62 43 15 28 da ac 5f bb 29 07 30 ff f6 |.G.bC.(.._.).0..| -000000f0 84 af c4 cf c2 ed 90 99 5f 58 cb 3b 74 |........_X.;t| ->>> Flow 2 (server to client) -00000000 16 03 03 00 59 02 00 00 55 03 03 33 ad 8d f8 90 |....Y...U..3....| -00000010 d1 72 5d ef e8 94 0f d7 58 15 59 9f 0b f9 ec 73 |.r].....X.Y....s| -00000020 99 53 f7 03 81 53 1a aa 05 f0 17 20 55 a1 9e 4e |.S...S..... U..N| -00000030 98 26 6b b8 d5 bc 2c 3e ca f6 a0 d9 bb f2 3b dd |.&k...,>......;.| -00000040 be 99 f1 35 de 1c f6 51 5b 19 4f 55 c0 2f 00 00 |...5...Q[.OU./..| -00000050 0d ff 01 00 01 00 00 0b 00 04 03 00 01 02 16 03 |................| -00000060 03 02 59 0b 00 02 55 00 02 52 00 02 4f 30 82 02 |..Y...U..R..O0..| -00000070 4b 30 82 01 b4 a0 03 02 01 02 02 09 00 e8 f0 9d |K0..............| -00000080 3f e2 5b ea a6 30 0d 06 09 2a 86 48 86 f7 0d 01 |?.[..0...*.H....| -00000090 01 0b 05 00 30 1f 31 0b 30 09 06 03 55 04 0a 13 |....0.1.0...U...| -000000a0 02 47 6f 31 10 30 0e 06 03 55 04 03 13 07 47 6f |.Go1.0...U....Go| -000000b0 20 52 6f 6f 74 30 1e 17 0d 31 36 30 31 30 31 30 | Root0...1601010| -000000c0 30 30 30 30 30 5a 17 0d 32 35 30 31 30 31 30 30 |00000Z..25010100| -000000d0 30 30 30 30 5a 30 1a 31 0b 30 09 06 03 55 04 0a |0000Z0.1.0...U..| -000000e0 13 02 47 6f 31 0b 30 09 06 03 55 04 03 13 02 47 |..Go1.0...U....G| -000000f0 6f 30 81 9f 30 0d 06 09 2a 86 48 86 f7 0d 01 01 |o0..0...*.H.....| -00000100 01 05 00 03 81 8d 00 30 81 89 02 81 81 00 db 46 |.......0.......F| -00000110 7d 93 2e 12 27 06 48 bc 06 28 21 ab 7e c4 b6 a2 |}...'.H..(!.~...| -00000120 5d fe 1e 52 45 88 7a 36 47 a5 08 0d 92 42 5b c2 |]..RE.z6G....B[.| -00000130 81 c0 be 97 79 98 40 fb 4f 6d 14 fd 2b 13 8b c2 |....y.@.Om..+...| -00000140 a5 2e 67 d8 d4 09 9e d6 22 38 b7 4a 0b 74 73 2b |..g....."8.J.ts+| -00000150 c2 34 f1 d1 93 e5 96 d9 74 7b f3 58 9f 6c 61 3c |.4......t{.X.la<| -00000160 c0 b0 41 d4 d9 2b 2b 24 23 77 5b 1c 3b bd 75 5d |..A..++$#w[.;.u]| -00000170 ce 20 54 cf a1 63 87 1d 1e 24 c4 f3 1d 1a 50 8b |. T..c...$....P.| -00000180 aa b6 14 43 ed 97 a7 75 62 f4 14 c8 52 d7 02 03 |...C...ub...R...| -00000190 01 00 01 a3 81 93 30 81 90 30 0e 06 03 55 1d 0f |......0..0...U..| -000001a0 01 01 ff 04 04 03 02 05 a0 30 1d 06 03 55 1d 25 |.........0...U.%| -000001b0 04 16 30 14 06 08 2b 06 01 05 05 07 03 01 06 08 |..0...+.........| -000001c0 2b 06 01 05 05 07 03 02 30 0c 06 03 55 1d 13 01 |+.......0...U...| -000001d0 01 ff 04 02 30 00 30 19 06 03 55 1d 0e 04 12 04 |....0.0...U.....| -000001e0 10 9f 91 16 1f 43 43 3e 49 a6 de 6d b6 80 d7 9f |.....CC>I..m....| -000001f0 60 30 1b 06 03 55 1d 23 04 14 30 12 80 10 48 13 |`0...U.#..0...H.| -00000200 49 4d 13 7e 16 31 bb a3 01 d5 ac ab 6e 7b 30 19 |IM.~.1......n{0.| -00000210 06 03 55 1d 11 04 12 30 10 82 0e 65 78 61 6d 70 |..U....0...examp| -00000220 6c 65 2e 67 6f 6c 61 6e 67 30 0d 06 09 2a 86 48 |le.golang0...*.H| -00000230 86 f7 0d 01 01 0b 05 00 03 81 81 00 9d 30 cc 40 |.............0.@| -00000240 2b 5b 50 a0 61 cb ba e5 53 58 e1 ed 83 28 a9 58 |+[P.a...SX...(.X| -00000250 1a a9 38 a4 95 a1 ac 31 5a 1a 84 66 3d 43 d3 2d |..8....1Z..f=C.-| -00000260 d9 0b f2 97 df d3 20 64 38 92 24 3a 00 bc cf 9c |...... d8.$:....| -00000270 7d b7 40 20 01 5f aa d3 16 61 09 a2 76 fd 13 c3 |}.@ ._...a..v...| -00000280 cc e1 0c 5c ee b1 87 82 f1 6c 04 ed 73 bb b3 43 |...\.....l..s..C| -00000290 77 8d 0c 1c f1 0f a1 d8 40 83 61 c9 4c 72 2b 9d |w.......@.a.Lr+.| -000002a0 ae db 46 06 06 4d f4 c1 b3 3e c0 d1 bd 42 d4 db |..F..M...>...B..| -000002b0 fe 3d 13 60 84 5c 21 d3 3b e9 fa e7 16 03 03 00 |.=.`.\!.;.......| -000002c0 ac 0c 00 00 a8 03 00 1d 20 2d c8 0c d2 27 fc f9 |........ -...'..| -000002d0 79 71 c4 17 ea 45 ec 0b dd 66 ce af ec 49 96 7d |yq...E...f...I.}| -000002e0 43 ff 88 68 b1 a8 bb e1 38 08 04 00 80 5a ab 5b |C..h....8....Z.[| -000002f0 e6 b3 32 e2 98 ae c3 ed 7c f9 90 c4 a4 ea dd 70 |..2.....|......p| -00000300 fc a4 f8 ef d1 15 0d b7 ad b8 e3 1f 3e c0 e4 40 |............>..@| -00000310 0d 7b 50 36 8f 88 cb 88 59 7c 20 63 d1 7f 36 9e |.{P6....Y| c..6.| -00000320 de a7 cb 6a 49 fd 65 32 36 0b 10 6a df 58 ef fd |...jI.e26..j.X..| -00000330 f6 fc e6 65 e7 81 0e 73 25 87 c7 89 dc ec ae 7c |...e...s%......|| -00000340 e4 81 79 79 a2 b9 12 28 ab 3b d0 2e 5e 81 47 2a |..yy...(.;..^.G*| -00000350 79 1e 16 21 fa 64 78 24 33 24 f7 ac f1 11 a7 15 |y..!.dx$3$......| -00000360 98 f6 24 52 14 7c 1f 28 0c 24 b1 a9 8a 16 03 03 |..$R.|.(.$......| -00000370 00 3a 0d 00 00 36 03 01 02 40 00 2e 04 03 05 03 |.:...6...@......| -00000380 06 03 08 07 08 08 08 09 08 0a 08 0b 08 04 08 05 |................| -00000390 08 06 04 01 05 01 06 01 03 03 02 03 03 01 02 01 |................| -000003a0 03 02 02 02 04 02 05 02 06 02 00 00 16 03 03 00 |................| -000003b0 04 0e 00 00 00 |.....| ->>> Flow 3 (client to server) -00000000 16 03 03 01 fd 0b 00 01 f9 00 01 f6 00 01 f3 30 |...............0| -00000010 82 01 ef 30 82 01 58 a0 03 02 01 02 02 10 5c 19 |...0..X.......\.| -00000020 c1 89 65 83 55 6f dc 0b c9 b9 93 9f e9 bc 30 0d |..e.Uo........0.| -00000030 06 09 2a 86 48 86 f7 0d 01 01 0b 05 00 30 12 31 |..*.H........0.1| -00000040 10 30 0e 06 03 55 04 0a 13 07 41 63 6d 65 20 43 |.0...U....Acme C| -00000050 6f 30 1e 17 0d 31 36 30 38 31 37 32 31 35 32 33 |o0...16081721523| -00000060 31 5a 17 0d 31 37 30 38 31 37 32 31 35 32 33 31 |1Z..170817215231| -00000070 5a 30 12 31 10 30 0e 06 03 55 04 0a 13 07 41 63 |Z0.1.0...U....Ac| -00000080 6d 65 20 43 6f 30 81 9f 30 0d 06 09 2a 86 48 86 |me Co0..0...*.H.| -00000090 f7 0d 01 01 01 05 00 03 81 8d 00 30 81 89 02 81 |...........0....| -000000a0 81 00 ba 6f aa 86 bd cf bf 9f f2 ef 5c 94 60 78 |...o........\.`x| -000000b0 6f e8 13 f2 d1 96 6f cd d9 32 6e 22 37 ce 41 f9 |o.....o..2n"7.A.| -000000c0 ca 5d 29 ac e1 27 da 61 a2 ee 81 cb 10 c7 df 34 |.])..'.a.......4| -000000d0 58 95 86 e9 3d 19 e6 5c 27 73 60 c8 8d 78 02 f4 |X...=..\'s`..x..| -000000e0 1d a4 98 09 a3 19 70 69 3c 25 62 66 2a ab 22 23 |......pi<%bf*."#| -000000f0 c5 7b 85 38 4f 2e 09 73 32 a7 bd 3e 9b ad ca 84 |.{.8O..s2..>....| -00000100 07 e6 0f 3a ff 77 c5 9d 41 85 00 8a b6 9b ee b0 |...:.w..A.......| -00000110 a4 3f 2d 4c 4c e6 42 3e bb 51 c8 dd 48 54 f4 0c |.?-LL.B>.Q..HT..| -00000120 8e 47 02 03 01 00 01 a3 46 30 44 30 0e 06 03 55 |.G......F0D0...U| -00000130 1d 0f 01 01 ff 04 04 03 02 05 a0 30 13 06 03 55 |...........0...U| -00000140 1d 25 04 0c 30 0a 06 08 2b 06 01 05 05 07 03 01 |.%..0...+.......| -00000150 30 0c 06 03 55 1d 13 01 01 ff 04 02 30 00 30 0f |0...U.......0.0.| -00000160 06 03 55 1d 11 04 08 30 06 87 04 7f 00 00 01 30 |..U....0.......0| -00000170 0d 06 09 2a 86 48 86 f7 0d 01 01 0b 05 00 03 81 |...*.H..........| -00000180 81 00 46 ab 44 a2 fb 28 54 f8 5a 67 f8 62 94 f1 |..F.D..(T.Zg.b..| -00000190 9a b2 18 9e f2 b1 de 1d 7e 6f 76 95 a9 ba e7 5d |........~ov....]| -000001a0 a8 16 6c 9c f7 09 d3 37 e4 4b 2b 36 7c 01 ad 41 |..l....7.K+6|..A| -000001b0 d2 32 d8 c3 d2 93 f9 10 6b 8e 95 b9 2c 17 8a a3 |.2......k...,...| -000001c0 44 48 bc 59 13 83 16 04 88 a4 81 5c 25 0d 98 0c |DH.Y.......\%...| -000001d0 ac 11 b1 28 56 be 1d cd 61 62 84 09 bf d6 80 c6 |...(V...ab......| -000001e0 45 8d 82 2c b4 d8 83 9b db c9 22 b7 2a 12 11 7b |E..,......".*..{| -000001f0 fa 02 3b c1 c9 ff ea c9 9d a8 49 d3 95 d7 d5 0e |..;.......I.....| -00000200 e5 35 16 03 03 00 25 10 00 00 21 20 2f e5 7d a3 |.5....%...! /.}.| -00000210 47 cd 62 43 15 28 da ac 5f bb 29 07 30 ff f6 84 |G.bC.(.._.).0...| -00000220 af c4 cf c2 ed 90 99 5f 58 cb 3b 74 16 03 03 00 |......._X.;t....| -00000230 88 0f 00 00 84 08 04 00 80 8b ad 4b 9a 7a 53 b8 |...........K.zS.| -00000240 6a 0a e7 71 6a 9b 8b 89 7d 3a 49 c9 af ce 3f e2 |j..qj...}:I...?.| -00000250 3e cc 0b da 57 9b 8c 2f 58 0f a9 05 4d e9 de 83 |>...W../X...M...| -00000260 60 e8 1c 77 ef 23 e4 aa 6b c3 15 64 98 f8 b1 72 |`..w.#..k..d...r| -00000270 b2 8a 9e a3 19 3d 73 84 05 53 59 e1 bb e1 db 51 |.....=s..SY....Q| -00000280 49 38 cf 8b ee 3c b6 05 0d ba 62 02 b3 36 dc c1 |I8...<....b..6..| -00000290 e1 52 4d bd 6a c1 3e 55 ff 82 5f e3 7c 84 1c 65 |.RM.j.>U.._.|..e| -000002a0 45 53 b9 c0 56 99 ac 56 d7 4a fa 72 3e 63 36 06 |ES..V..V.J.r>c6.| -000002b0 d3 60 ef 34 05 3f 57 20 79 14 03 03 00 01 01 16 |.`.4.?W y.......| -000002c0 03 03 00 28 00 00 00 00 00 00 00 00 00 26 b7 73 |...(.........&.s| -000002d0 b5 e9 b3 8a 63 00 9b 36 a0 cf 2a 60 0f 8a 59 75 |....c..6..*`..Yu| -000002e0 08 71 97 dc 66 73 15 04 08 b4 d3 91 |.q..fs......| ->>> Flow 4 (server to client) -00000000 14 03 03 00 01 01 16 03 03 00 28 d2 b2 3f a8 43 |..........(..?.C| -00000010 41 1a 85 20 9f ee 21 6a c5 96 cf 7c 01 8e f6 3a |A.. ..!j...|...:| -00000020 e3 29 14 68 ea 74 a3 ef 85 04 78 33 db c7 d4 c9 |.).h.t....x3....| -00000030 a2 fd 6a |..j| ->>> Flow 5 (client to server) -00000000 17 03 03 00 1e 00 00 00 00 00 00 00 01 c3 3b 68 |..............;h| -00000010 b5 e9 4d 75 22 92 fb 19 85 88 38 97 12 3f ce ca |..Mu".....8..?..| -00000020 36 c0 d6 15 03 03 00 1a 00 00 00 00 00 00 00 02 |6...............| -00000030 c1 a9 03 81 61 04 7c 86 24 e9 90 22 59 6f c7 bc |....a.|.$.."Yo..| -00000040 c2 a1 |..| diff --git a/src/crypto/tls/testdata/Client-TLSv13-ClientCert-RSA-PSS-Disabled b/src/crypto/tls/testdata/Client-TLSv13-ClientCert-RSA-PSS-Disabled deleted file mode 100644 index 98d718bab2..0000000000 --- a/src/crypto/tls/testdata/Client-TLSv13-ClientCert-RSA-PSS-Disabled +++ /dev/null @@ -1,138 +0,0 @@ ->>> Flow 1 (client to server) -00000000 16 03 01 00 f8 01 00 00 f4 03 03 00 00 00 00 00 |................| -00000010 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................| -00000020 00 00 00 00 00 00 00 00 00 00 00 20 00 00 00 00 |........... ....| -00000030 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................| -00000040 00 00 00 00 00 00 00 00 00 00 00 00 00 32 cc a8 |.............2..| -00000050 cc a9 c0 2f c0 2b c0 30 c0 2c c0 27 c0 13 c0 23 |.../.+.0.,.'...#| -00000060 c0 09 c0 14 c0 0a 00 9c 00 9d 00 3c 00 2f 00 35 |...........<./.5| -00000070 c0 12 00 0a 00 05 c0 11 c0 07 13 01 13 03 13 02 |................| -00000080 01 00 00 79 00 05 00 05 01 00 00 00 00 00 0a 00 |...y............| -00000090 0a 00 08 00 1d 00 17 00 18 00 19 00 0b 00 02 01 |................| -000000a0 00 00 0d 00 18 00 16 08 04 08 05 08 06 04 01 04 |................| -000000b0 03 05 01 05 03 06 01 06 03 02 01 02 03 ff 01 00 |................| -000000c0 01 00 00 12 00 00 00 2b 00 09 08 03 04 03 03 03 |.......+........| -000000d0 02 03 01 00 33 00 26 00 24 00 1d 00 20 2f e5 7d |....3.&.$... /.}| -000000e0 a3 47 cd 62 43 15 28 da ac 5f bb 29 07 30 ff f6 |.G.bC.(.._.).0..| -000000f0 84 af c4 cf c2 ed 90 99 5f 58 cb 3b 74 |........_X.;t| ->>> Flow 2 (server to client) -00000000 16 03 03 00 7a 02 00 00 76 03 03 e5 55 1c 7e bc |....z...v...U.~.| -00000010 05 a3 af 8b 02 03 6a 08 34 35 43 9f 35 c1 39 36 |......j.45C.5.96| -00000020 97 ab d9 4f 77 26 88 31 f8 1c a4 20 00 00 00 00 |...Ow&.1... ....| -00000030 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................| -00000040 00 00 00 00 00 00 00 00 00 00 00 00 13 01 00 00 |................| -00000050 2e 00 2b 00 02 03 04 00 33 00 24 00 1d 00 20 63 |..+.....3.$... c| -00000060 74 2f 45 26 f4 7c cd d6 cb 8d 9f b5 6b 88 41 ef |t/E&.|......k.A.| -00000070 f4 cd 00 54 91 29 98 e4 a0 6b 6d b5 2f 39 01 14 |...T.)...km./9..| -00000080 03 03 00 01 01 17 03 03 00 17 e6 81 13 75 85 fe |.............u..| -00000090 7d c6 09 24 01 bf 44 78 65 4e 5f d0 37 b9 89 15 |}..$..DxeN_.7...| -000000a0 98 17 03 03 00 42 88 5c b3 19 ee 62 c0 2d 95 51 |.....B.\...b.-.Q| -000000b0 fd 88 e0 13 aa 53 e5 5a 45 be 0f 07 6f 46 c8 1b |.....S.ZE...oF..| -000000c0 a2 b5 2a 7c 46 5f b5 90 46 95 b9 a4 ce 44 a8 a7 |..*|F_..F....D..| -000000d0 3d 8e ce d2 76 57 44 e0 0e 83 af f3 2f 00 55 cb |=...vWD...../.U.| -000000e0 1f e7 d2 42 22 6f 78 0c 17 03 03 02 6d 45 f7 95 |...B"ox.....mE..| -000000f0 68 b9 ad 32 13 34 84 c2 dd 62 a7 f5 18 0f 0b a6 |h..2.4...b......| -00000100 b8 5c dd 06 69 0d 07 ea 6b ec ad ad a7 13 ea f3 |.\..i...k.......| -00000110 87 9b 74 a9 53 49 b3 a9 ff f3 eb 71 1b 25 63 8b |..t.SI.....q.%c.| -00000120 c6 0f 6a 21 bc f1 fb 4b 8e d4 07 6e c6 8e 9f bf |..j!...K...n....| -00000130 73 eb 1e a5 d7 e4 a1 cd 6e 7e de 45 a2 b4 6f 25 |s.......n~.E..o%| -00000140 fe c2 a1 84 b8 09 d1 65 90 6d ef 07 ea d0 25 01 |.......e.m....%.| -00000150 54 f2 8e f8 53 38 1e 35 a9 af be 2a 8d 81 9b 77 |T...S8.5...*...w| -00000160 38 22 42 b8 56 ea 72 ab c3 ac 9b 17 1a 0b 65 94 |8"B.V.r.......e.| -00000170 8a 81 6d 83 c6 f4 76 32 ed f7 84 4d ec 17 0e 45 |..m...v2...M...E| -00000180 74 e8 ba b0 46 92 62 8c 73 07 a8 1f d5 d3 44 d1 |t...F.b.s.....D.| -00000190 53 21 62 8b 02 c6 20 40 1d f1 75 2b 8a 6a 60 2a |S!b... @..u+.j`*| -000001a0 ee 04 5f c0 46 6d 74 7a 18 4a e0 ca d4 a6 6a a2 |.._.Fmtz.J....j.| -000001b0 11 21 20 4a 3e 57 3c 67 ff 61 3d 15 32 14 f2 01 |.! J>W .$..@.| -00000250 10 59 17 11 6f 3c 11 8b eb b2 42 e7 d5 b7 ee d2 |.Y..o<....B.....| -00000260 ae 95 9c 21 48 34 d9 5a 20 95 7c 72 35 05 5e 6c |...!H4.Z .|r5.^l| -00000270 a2 05 46 30 e6 33 d3 91 ac c8 17 4b b1 15 cc f0 |..F0.3.....K....| -00000280 af bb 7c 56 e0 5b 25 8e 35 e0 2e 35 91 0d e0 bc |..|V.[%.5..5....| -00000290 f6 9c 3b 15 f8 96 dc 4e 6c aa 57 c9 f0 1f 55 e2 |..;....Nl.W...U.| -000002a0 d9 5d 09 71 f9 af 17 69 29 d5 94 8a 5f fa b2 ad |.].q...i)..._...| -000002b0 1b b9 ce 90 e7 bd 02 1b ad 9d 91 19 7e f3 8f 2d |............~..-| -000002c0 70 d5 af 2c e7 29 b1 f9 3c 5a 7f 04 6f 73 88 da |p..,.).. .'B.| -00000320 6f 13 da a1 b2 b1 43 76 69 eb f1 c6 e2 b5 6c 57 |o.....Cvi.....lW| -00000330 e0 88 c9 0d 7d 37 1b 0b a0 b7 cd 6b ba 3a 52 55 |....}7.....k.:RU| -00000340 61 c6 5c 71 ce 1e 69 b9 ea b4 c6 a5 78 c5 b8 b6 |a.\q..i.....x...| -00000350 4e b1 94 84 a3 d4 31 d9 3b 15 17 03 03 00 99 6c |N.....1.;......l| -00000360 5d dd 43 24 9d 6e 5d 64 d3 54 30 aa 98 c3 7e 21 |].C$.n]d.T0...~!| -00000370 05 06 fc 3b eb 52 12 36 6b 2e e1 32 5a 59 30 a7 |...;.R.6k..2ZY0.| -00000380 b0 bb 52 1a 36 e6 78 20 84 8c cf 0d 90 da c7 88 |..R.6.x ........| -00000390 c4 2f bc b4 b6 03 1b 34 9b c8 12 db bc 87 95 d3 |./.....4........| -000003a0 84 4e 41 c1 de 2f 4c 66 d9 13 fc 78 31 05 6c 67 |.NA../Lf...x1.lg| -000003b0 e3 3d 28 36 0f fe 5f 45 29 d2 1b 4d a5 60 dc f7 |.=(6.._E)..M.`..| -000003c0 20 74 cf f5 7b 3f f7 58 53 0c 64 7d 3f c6 f1 ac | t..{?.XS.d}?...| -000003d0 a9 1b 60 d8 ea a5 32 11 23 6d 66 19 70 2b fa ce |..`...2.#mf.p+..| -000003e0 c8 f6 9d cc 12 83 a1 e1 4b be 98 d3 c2 56 65 34 |........K....Ve4| -000003f0 73 3a b3 6e d8 2c db 3b 17 03 03 00 35 e6 ce 17 |s:.n.,.;....5...| -00000400 e5 92 38 9e 00 2d 66 bf a9 e2 13 66 01 af 64 15 |..8..-f....f..d.| -00000410 8d da 6b f3 a7 f6 5c 76 e1 f4 c4 2f dc 93 c4 3c |..k...\v.../...<| -00000420 69 5a 30 e5 db 5a b5 0b 98 4e 43 a3 51 ba 41 9d |iZ0..Z...NC.Q.A.| -00000430 18 c0 |..| ->>> Flow 3 (client to server) -00000000 14 03 03 00 01 01 17 03 03 02 11 24 0f 0c cc 6a |...........$...j| -00000010 8e 07 9c d7 f9 84 55 cc 79 a7 c1 c5 fb 6e 29 5e |......U.y....n)^| -00000020 31 e1 b1 00 c0 c9 a8 94 59 75 f4 b5 86 7c a4 8c |1.......Yu...|..| -00000030 8d 79 dd 42 45 67 69 f5 fb f0 02 54 f5 8f 1a 86 |.y.BEgi....T....| -00000040 2f a0 4e 9b 68 e2 69 36 48 cb 8e cc 26 fa 1b 60 |/.N.h.i6H...&..`| -00000050 c8 f3 b7 7c 36 dd 59 71 a3 f8 9a 7a bc 8a e1 10 |...|6.Yq...z....| -00000060 8f 6d 69 60 07 b6 62 6d d3 2b fa a4 81 eb ae 3f |.mi`..bm.+.....?| -00000070 9d 7e 1d d7 d1 89 24 4e 7e 65 4b d2 37 58 b2 56 |.~....$N~eK.7X.V| -00000080 a1 8e 10 73 44 9c f1 c7 60 97 49 99 e2 82 74 58 |...sD...`.I...tX| -00000090 e3 1f 41 ec 1d 13 85 f1 95 98 39 cb d1 51 f7 0e |..A.......9..Q..| -000000a0 fe e4 fa 04 20 1a f2 c5 ae 64 9d eb f8 ff 03 ce |.... ....d......| -000000b0 ca 12 7c dd a6 b4 2c a3 eb 8e 83 2c cf 77 6b 82 |..|...,....,.wk.| -000000c0 68 77 58 5d 3e ef 01 0b 78 e9 37 b0 36 9c 62 44 |hwX]>...x.7.6.bD| -000000d0 88 ae f1 5a d7 93 81 0a 84 cf 4f 3b db 05 41 92 |...Z......O;..A.| -000000e0 4d 31 3d 06 9e 73 11 43 de 3e ec b8 b0 48 99 84 |M1=..s.C.>...H..| -000000f0 bc 0c 7c 86 93 03 d5 5f c5 21 34 a5 cc c7 d5 42 |..|...._.!4....B| -00000100 1d 69 94 53 39 d9 56 07 40 46 44 89 e6 95 8d e9 |.i.S9.V.@FD.....| -00000110 ca 6d f0 e0 2a 22 70 bc e7 7f 8e 15 0c 56 51 e3 |.m..*"p......VQ.| -00000120 46 5c b9 66 c5 8b 07 d3 f0 bb 84 fe 71 d6 a2 90 |F\.f........q...| -00000130 d9 ec 46 00 82 10 38 9c 8f 35 e5 48 d8 82 7f 65 |..F...8..5.H...e| -00000140 68 f5 42 48 74 6b 29 79 f3 32 b6 a1 aa 42 73 e3 |h.BHtk)y.2...Bs.| -00000150 c3 f6 fc 76 9e 32 59 26 a6 75 4a dc 65 23 73 10 |...v.2Y&.uJ.e#s.| -00000160 35 79 a5 41 7b 72 d5 cd 33 1f 7d 98 b3 39 4b f6 |5y.A{r..3.}..9K.| -00000170 e8 09 ed d6 62 a0 48 b5 76 47 2e 7e 1a 5d 75 6d |....b.H.vG.~.]um| -00000180 c2 98 22 17 b1 8f 2e a5 a2 b3 b3 5e d9 89 c5 a0 |.."........^....| -00000190 46 2a ac af 20 66 e9 f3 02 84 26 51 c0 0a 2e 0c |F*.. f....&Q....| -000001a0 d3 90 3c 9f 19 3f 25 3e 7d 3a 38 6f f3 ce 2f c4 |..<..?%>}:8o../.| -000001b0 7b 84 e4 d5 c2 c8 90 54 6d 2c 59 70 34 44 53 25 |{......Tm,Yp4DS%| -000001c0 ee ee d6 7e 13 30 1e 09 ff f2 79 bd 7c a1 af a9 |...~.0....y.|...| -000001d0 a9 7b 51 6a d8 17 41 22 f5 d0 5d 84 00 a7 5f 1a |.{Qj..A"..]..._.| -000001e0 b6 15 98 de f4 bd cd fe 70 38 5c 0f 44 60 5a 7d |........p8\.D`Z}| -000001f0 be df 6e 56 bb 83 0b 10 fa 5d 3a 2c 9e 4a 00 7f |..nV.....]:,.J..| -00000200 ec f4 42 52 52 95 5e e1 bd cc cf a0 45 c2 79 2c |..BRR.^.....E.y,| -00000210 10 4d 14 35 ad bd 18 d4 b1 aa 09 65 17 03 03 00 |.M.5.......e....| -00000220 99 a4 2c 7a c2 25 ba 3b a2 84 1f e8 a0 d1 5c c4 |..,z.%.;......\.| -00000230 bb c6 f8 fc eb 19 3e f5 e6 53 9f c3 35 d3 7a 00 |......>..S..5.z.| -00000240 68 e1 e0 2f 73 75 d7 2d df 44 aa 34 43 bf 66 c1 |h../su.-.D.4C.f.| -00000250 31 0d e6 86 f8 71 6b 71 ac 89 c5 26 cf d9 1e 43 |1....qkq...&...C| -00000260 33 c3 48 68 e0 4d f5 d5 69 ff fc 02 47 cc 91 41 |3.Hh.M..i...G..A| -00000270 83 41 58 04 2a 02 53 3c 3b 0a 4c 18 16 00 fd e8 |.AX.*.S<;.L.....| -00000280 64 54 0d 34 a1 3d a5 4b bd c2 54 17 c3 5a 82 7a |dT.4.=.K..T..Z.z| -00000290 55 5d a9 57 63 62 ef 8b 3a 75 f2 cd 34 ef d6 30 |U].Wcb..:u..4..0| -000002a0 08 7f 03 0b c3 eb 29 94 88 11 38 42 40 6f bf cc |......)...8B@o..| -000002b0 d4 01 3f 8a 90 11 f9 da fd 9e 17 03 03 00 35 7d |..?...........5}| -000002c0 2d 12 d7 58 d0 76 43 25 d1 8d 5c 5c b1 7f fa 48 |-..X.vC%..\\...H| -000002d0 a9 21 48 02 64 76 91 6c 79 7e b9 22 33 f7 32 cb |.!H.dv.ly~."3.2.| -000002e0 50 22 78 02 96 4e 2d f6 09 68 06 8e 44 e6 fd 7f |P"x..N-..h..D...| -000002f0 cf 0a 7e a3 17 03 03 00 17 84 cd d8 f2 e2 38 2e |..~...........8.| -00000300 57 e5 47 76 48 50 34 9e 65 d4 c6 1d 7d b3 4e 91 |W.GvHP4.e...}.N.| -00000310 17 03 03 00 13 e5 05 98 5b 87 5d db ae 89 38 2c |........[.]...8,| -00000320 35 89 31 14 73 cd 16 54 |5.1.s..T| diff --git a/src/crypto/tls/testdata/Server-TLSv12-ClientAuthRequestedAndGiven-PSS-Disabled b/src/crypto/tls/testdata/Server-TLSv12-ClientAuthRequestedAndGiven-PSS-Disabled deleted file mode 100644 index cb626a1104..0000000000 --- a/src/crypto/tls/testdata/Server-TLSv12-ClientAuthRequestedAndGiven-PSS-Disabled +++ /dev/null @@ -1,126 +0,0 @@ ->>> Flow 1 (client to server) -00000000 16 03 01 00 97 01 00 00 93 03 03 9e b1 2a 26 04 |.............*&.| -00000010 8d 66 df 43 cb 0a 85 80 4f f2 99 7d 80 20 64 7e |.f.C....O..}. d~| -00000020 30 a0 bb 60 ac 0e d4 ce f0 ae 98 00 00 04 00 2f |0..`.........../| -00000030 00 ff 01 00 00 66 00 00 00 0e 00 0c 00 00 09 31 |.....f.........1| -00000040 32 37 2e 30 2e 30 2e 31 00 0b 00 04 03 00 01 02 |27.0.0.1........| -00000050 00 0a 00 0c 00 0a 00 1d 00 17 00 1e 00 19 00 18 |................| -00000060 00 16 00 00 00 17 00 00 00 0d 00 30 00 2e 04 03 |...........0....| -00000070 05 03 06 03 08 07 08 08 08 09 08 0a 08 0b 08 04 |................| -00000080 08 05 08 06 04 01 05 01 06 01 03 03 02 03 03 01 |................| -00000090 02 01 03 02 02 02 04 02 05 02 06 02 |............| ->>> Flow 2 (server to client) -00000000 16 03 03 00 31 02 00 00 2d 03 03 00 00 00 00 00 |....1...-.......| -00000010 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................| -00000020 00 00 00 44 4f 57 4e 47 52 44 01 00 00 2f 00 00 |...DOWNGRD.../..| -00000030 05 ff 01 00 01 00 16 03 03 02 59 0b 00 02 55 00 |..........Y...U.| -00000040 02 52 00 02 4f 30 82 02 4b 30 82 01 b4 a0 03 02 |.R..O0..K0......| -00000050 01 02 02 09 00 e8 f0 9d 3f e2 5b ea a6 30 0d 06 |........?.[..0..| -00000060 09 2a 86 48 86 f7 0d 01 01 0b 05 00 30 1f 31 0b |.*.H........0.1.| -00000070 30 09 06 03 55 04 0a 13 02 47 6f 31 10 30 0e 06 |0...U....Go1.0..| -00000080 03 55 04 03 13 07 47 6f 20 52 6f 6f 74 30 1e 17 |.U....Go Root0..| -00000090 0d 31 36 30 31 30 31 30 30 30 30 30 30 5a 17 0d |.160101000000Z..| -000000a0 32 35 30 31 30 31 30 30 30 30 30 30 5a 30 1a 31 |250101000000Z0.1| -000000b0 0b 30 09 06 03 55 04 0a 13 02 47 6f 31 0b 30 09 |.0...U....Go1.0.| -000000c0 06 03 55 04 03 13 02 47 6f 30 81 9f 30 0d 06 09 |..U....Go0..0...| -000000d0 2a 86 48 86 f7 0d 01 01 01 05 00 03 81 8d 00 30 |*.H............0| -000000e0 81 89 02 81 81 00 db 46 7d 93 2e 12 27 06 48 bc |.......F}...'.H.| -000000f0 06 28 21 ab 7e c4 b6 a2 5d fe 1e 52 45 88 7a 36 |.(!.~...]..RE.z6| -00000100 47 a5 08 0d 92 42 5b c2 81 c0 be 97 79 98 40 fb |G....B[.....y.@.| -00000110 4f 6d 14 fd 2b 13 8b c2 a5 2e 67 d8 d4 09 9e d6 |Om..+.....g.....| -00000120 22 38 b7 4a 0b 74 73 2b c2 34 f1 d1 93 e5 96 d9 |"8.J.ts+.4......| -00000130 74 7b f3 58 9f 6c 61 3c c0 b0 41 d4 d9 2b 2b 24 |t{.X.la<..A..++$| -00000140 23 77 5b 1c 3b bd 75 5d ce 20 54 cf a1 63 87 1d |#w[.;.u]. T..c..| -00000150 1e 24 c4 f3 1d 1a 50 8b aa b6 14 43 ed 97 a7 75 |.$....P....C...u| -00000160 62 f4 14 c8 52 d7 02 03 01 00 01 a3 81 93 30 81 |b...R.........0.| -00000170 90 30 0e 06 03 55 1d 0f 01 01 ff 04 04 03 02 05 |.0...U..........| -00000180 a0 30 1d 06 03 55 1d 25 04 16 30 14 06 08 2b 06 |.0...U.%..0...+.| -00000190 01 05 05 07 03 01 06 08 2b 06 01 05 05 07 03 02 |........+.......| -000001a0 30 0c 06 03 55 1d 13 01 01 ff 04 02 30 00 30 19 |0...U.......0.0.| -000001b0 06 03 55 1d 0e 04 12 04 10 9f 91 16 1f 43 43 3e |..U..........CC>| -000001c0 49 a6 de 6d b6 80 d7 9f 60 30 1b 06 03 55 1d 23 |I..m....`0...U.#| -000001d0 04 14 30 12 80 10 48 13 49 4d 13 7e 16 31 bb a3 |..0...H.IM.~.1..| -000001e0 01 d5 ac ab 6e 7b 30 19 06 03 55 1d 11 04 12 30 |....n{0...U....0| -000001f0 10 82 0e 65 78 61 6d 70 6c 65 2e 67 6f 6c 61 6e |...example.golan| -00000200 67 30 0d 06 09 2a 86 48 86 f7 0d 01 01 0b 05 00 |g0...*.H........| -00000210 03 81 81 00 9d 30 cc 40 2b 5b 50 a0 61 cb ba e5 |.....0.@+[P.a...| -00000220 53 58 e1 ed 83 28 a9 58 1a a9 38 a4 95 a1 ac 31 |SX...(.X..8....1| -00000230 5a 1a 84 66 3d 43 d3 2d d9 0b f2 97 df d3 20 64 |Z..f=C.-...... d| -00000240 38 92 24 3a 00 bc cf 9c 7d b7 40 20 01 5f aa d3 |8.$:....}.@ ._..| -00000250 16 61 09 a2 76 fd 13 c3 cc e1 0c 5c ee b1 87 82 |.a..v......\....| -00000260 f1 6c 04 ed 73 bb b3 43 77 8d 0c 1c f1 0f a1 d8 |.l..s..Cw.......| -00000270 40 83 61 c9 4c 72 2b 9d ae db 46 06 06 4d f4 c1 |@.a.Lr+...F..M..| -00000280 b3 3e c0 d1 bd 42 d4 db fe 3d 13 60 84 5c 21 d3 |.>...B...=.`.\!.| -00000290 3b e9 fa e7 16 03 03 00 1b 0d 00 00 17 02 01 40 |;..............@| -000002a0 00 10 04 01 04 03 05 01 05 03 06 01 06 03 02 01 |................| -000002b0 02 03 00 00 16 03 03 00 04 0e 00 00 00 |.............| ->>> Flow 3 (client to server) -00000000 16 03 03 01 fd 0b 00 01 f9 00 01 f6 00 01 f3 30 |...............0| -00000010 82 01 ef 30 82 01 58 a0 03 02 01 02 02 10 5c 19 |...0..X.......\.| -00000020 c1 89 65 83 55 6f dc 0b c9 b9 93 9f e9 bc 30 0d |..e.Uo........0.| -00000030 06 09 2a 86 48 86 f7 0d 01 01 0b 05 00 30 12 31 |..*.H........0.1| -00000040 10 30 0e 06 03 55 04 0a 13 07 41 63 6d 65 20 43 |.0...U....Acme C| -00000050 6f 30 1e 17 0d 31 36 30 38 31 37 32 31 35 32 33 |o0...16081721523| -00000060 31 5a 17 0d 31 37 30 38 31 37 32 31 35 32 33 31 |1Z..170817215231| -00000070 5a 30 12 31 10 30 0e 06 03 55 04 0a 13 07 41 63 |Z0.1.0...U....Ac| -00000080 6d 65 20 43 6f 30 81 9f 30 0d 06 09 2a 86 48 86 |me Co0..0...*.H.| -00000090 f7 0d 01 01 01 05 00 03 81 8d 00 30 81 89 02 81 |...........0....| -000000a0 81 00 ba 6f aa 86 bd cf bf 9f f2 ef 5c 94 60 78 |...o........\.`x| -000000b0 6f e8 13 f2 d1 96 6f cd d9 32 6e 22 37 ce 41 f9 |o.....o..2n"7.A.| -000000c0 ca 5d 29 ac e1 27 da 61 a2 ee 81 cb 10 c7 df 34 |.])..'.a.......4| -000000d0 58 95 86 e9 3d 19 e6 5c 27 73 60 c8 8d 78 02 f4 |X...=..\'s`..x..| -000000e0 1d a4 98 09 a3 19 70 69 3c 25 62 66 2a ab 22 23 |......pi<%bf*."#| -000000f0 c5 7b 85 38 4f 2e 09 73 32 a7 bd 3e 9b ad ca 84 |.{.8O..s2..>....| -00000100 07 e6 0f 3a ff 77 c5 9d 41 85 00 8a b6 9b ee b0 |...:.w..A.......| -00000110 a4 3f 2d 4c 4c e6 42 3e bb 51 c8 dd 48 54 f4 0c |.?-LL.B>.Q..HT..| -00000120 8e 47 02 03 01 00 01 a3 46 30 44 30 0e 06 03 55 |.G......F0D0...U| -00000130 1d 0f 01 01 ff 04 04 03 02 05 a0 30 13 06 03 55 |...........0...U| -00000140 1d 25 04 0c 30 0a 06 08 2b 06 01 05 05 07 03 01 |.%..0...+.......| -00000150 30 0c 06 03 55 1d 13 01 01 ff 04 02 30 00 30 0f |0...U.......0.0.| -00000160 06 03 55 1d 11 04 08 30 06 87 04 7f 00 00 01 30 |..U....0.......0| -00000170 0d 06 09 2a 86 48 86 f7 0d 01 01 0b 05 00 03 81 |...*.H..........| -00000180 81 00 46 ab 44 a2 fb 28 54 f8 5a 67 f8 62 94 f1 |..F.D..(T.Zg.b..| -00000190 9a b2 18 9e f2 b1 de 1d 7e 6f 76 95 a9 ba e7 5d |........~ov....]| -000001a0 a8 16 6c 9c f7 09 d3 37 e4 4b 2b 36 7c 01 ad 41 |..l....7.K+6|..A| -000001b0 d2 32 d8 c3 d2 93 f9 10 6b 8e 95 b9 2c 17 8a a3 |.2......k...,...| -000001c0 44 48 bc 59 13 83 16 04 88 a4 81 5c 25 0d 98 0c |DH.Y.......\%...| -000001d0 ac 11 b1 28 56 be 1d cd 61 62 84 09 bf d6 80 c6 |...(V...ab......| -000001e0 45 8d 82 2c b4 d8 83 9b db c9 22 b7 2a 12 11 7b |E..,......".*..{| -000001f0 fa 02 3b c1 c9 ff ea c9 9d a8 49 d3 95 d7 d5 0e |..;.......I.....| -00000200 e5 35 16 03 03 00 86 10 00 00 82 00 80 3f 1b ee |.5...........?..| -00000210 02 ec a5 9f 6e 38 69 2c b7 03 89 65 b4 92 79 a0 |....n8i,...e..y.| -00000220 b2 0b ab 9b 44 9c 68 d1 8e 5c 40 9c b5 1c a5 70 |....D.h..\@....p| -00000230 00 a2 2e fb 98 b7 45 7b 9c 63 46 68 1d 55 9e 01 |......E{.cFh.U..| -00000240 7f 84 31 62 07 c4 2f 20 5f 1a 94 8c 1f f4 3a 6d |..1b../ _.....:m| -00000250 a8 2b b8 08 5b ec 27 e3 49 9e 51 b3 66 98 09 ba |.+..[.'.I.Q.f...| -00000260 64 65 c8 3c 11 fb 14 4a c9 ea 3c 5e 52 10 a0 0b |de.<...J..<^R...| -00000270 a9 fc 10 13 c9 99 0c a0 8b b4 40 66 0e 11 5e 1d |..........@f..^.| -00000280 8b 45 5c 4d 0d 39 39 f6 0c 59 8f 06 99 16 03 03 |.E\M.99..Y......| -00000290 00 88 0f 00 00 84 04 01 00 80 71 1c 9c fd b2 c9 |..........q.....| -000002a0 b9 7f f3 51 e2 63 96 08 56 d2 bd 19 61 9f 3f be |...Q.c..V...a.?.| -000002b0 e5 4c 22 a8 3f 81 98 2d 67 56 4e 2d 61 6e 51 e5 |.L".?..-gVN-anQ.| -000002c0 11 24 bd 1b 38 ba dc 8c 76 51 1d 3c 6e 81 50 9a |.$..8...vQ. | -00000330 8d 82 6c f3 04 55 2c 13 d9 5b 0a 73 88 4f 8b 3c |..l..U,..[.s.O.<| -00000340 cd ef 1a a7 15 7c 33 bb ff fa 01 c4 87 d7 df 47 |.....|3........G| -00000350 37 b6 fe 1d e6 82 c2 8a 33 b1 c9 ae 85 45 c8 0d |7.......3....E..| -00000360 38 47 69 2d 54 |8Gi-T| ->>> Flow 4 (server to client) -00000000 14 03 03 00 01 01 16 03 03 00 40 00 00 00 00 00 |..........@.....| -00000010 00 00 00 00 00 00 00 00 00 00 00 20 98 12 44 63 |........... ..Dc| -00000020 e7 77 e6 e8 c0 c7 d7 b6 f7 c4 4e 13 e3 79 af 33 |.w........N..y.3| -00000030 3b 6c 86 22 c5 9e dd 25 74 e5 7b 37 fb 24 c6 48 |;l."...%t.{7.$.H| -00000040 c9 74 a7 9b 9b 32 a7 c1 b9 bb e0 17 03 03 00 40 |.t...2.........@| -00000050 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................| -00000060 80 d7 ec 51 cf ae d4 1a af 11 59 d1 0c 62 a6 67 |...Q......Y..b.g| -00000070 2e 6f 18 23 29 75 92 07 b1 16 09 8f 2d f8 04 fe |.o.#)u......-...| -00000080 ce 71 2c b6 00 fd 7b 53 cb 6d 97 06 06 e6 af f4 |.q,...{S.m......| -00000090 15 03 03 00 30 00 00 00 00 00 00 00 00 00 00 00 |....0...........| -000000a0 00 00 00 00 00 73 14 3a 87 3b ca 3a 2b b2 52 30 |.....s.:.;.:+.R0| -000000b0 98 62 88 1b a7 58 66 47 66 72 fd bb b6 b7 6b 99 |.b...XfGfr....k.| -000000c0 20 ab e9 22 62 | .."b| diff --git a/src/crypto/tls/testdata/Server-TLSv12-ClientAuthRequestedAndGiven-PSS-Disabled-Required b/src/crypto/tls/testdata/Server-TLSv12-ClientAuthRequestedAndGiven-PSS-Disabled-Required deleted file mode 100644 index 86d5415cc8..0000000000 --- a/src/crypto/tls/testdata/Server-TLSv12-ClientAuthRequestedAndGiven-PSS-Disabled-Required +++ /dev/null @@ -1,74 +0,0 @@ ->>> Flow 1 (client to server) -00000000 16 03 01 00 97 01 00 00 93 03 03 d7 9c de f8 62 |...............b| -00000010 7e 32 5b bc d5 12 35 89 42 37 be ca 55 74 24 61 |~2[...5.B7..Ut$a| -00000020 c0 50 91 0f 1b 42 29 9f c1 6a cb 00 00 04 00 2f |.P...B)..j...../| -00000030 00 ff 01 00 00 66 00 00 00 0e 00 0c 00 00 09 31 |.....f.........1| -00000040 32 37 2e 30 2e 30 2e 31 00 0b 00 04 03 00 01 02 |27.0.0.1........| -00000050 00 0a 00 0c 00 0a 00 1d 00 17 00 1e 00 19 00 18 |................| -00000060 00 16 00 00 00 17 00 00 00 0d 00 30 00 2e 04 03 |...........0....| -00000070 05 03 06 03 08 07 08 08 08 09 08 0a 08 0b 08 04 |................| -00000080 08 05 08 06 04 01 05 01 06 01 03 03 02 03 03 01 |................| -00000090 02 01 03 02 02 02 04 02 05 02 06 02 |............| ->>> Flow 2 (server to client) -00000000 16 03 03 00 31 02 00 00 2d 03 03 00 00 00 00 00 |....1...-.......| -00000010 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................| -00000020 00 00 00 44 4f 57 4e 47 52 44 01 00 00 2f 00 00 |...DOWNGRD.../..| -00000030 05 ff 01 00 01 00 16 03 03 02 59 0b 00 02 55 00 |..........Y...U.| -00000040 02 52 00 02 4f 30 82 02 4b 30 82 01 b4 a0 03 02 |.R..O0..K0......| -00000050 01 02 02 09 00 e8 f0 9d 3f e2 5b ea a6 30 0d 06 |........?.[..0..| -00000060 09 2a 86 48 86 f7 0d 01 01 0b 05 00 30 1f 31 0b |.*.H........0.1.| -00000070 30 09 06 03 55 04 0a 13 02 47 6f 31 10 30 0e 06 |0...U....Go1.0..| -00000080 03 55 04 03 13 07 47 6f 20 52 6f 6f 74 30 1e 17 |.U....Go Root0..| -00000090 0d 31 36 30 31 30 31 30 30 30 30 30 30 5a 17 0d |.160101000000Z..| -000000a0 32 35 30 31 30 31 30 30 30 30 30 30 5a 30 1a 31 |250101000000Z0.1| -000000b0 0b 30 09 06 03 55 04 0a 13 02 47 6f 31 0b 30 09 |.0...U....Go1.0.| -000000c0 06 03 55 04 03 13 02 47 6f 30 81 9f 30 0d 06 09 |..U....Go0..0...| -000000d0 2a 86 48 86 f7 0d 01 01 01 05 00 03 81 8d 00 30 |*.H............0| -000000e0 81 89 02 81 81 00 db 46 7d 93 2e 12 27 06 48 bc |.......F}...'.H.| -000000f0 06 28 21 ab 7e c4 b6 a2 5d fe 1e 52 45 88 7a 36 |.(!.~...]..RE.z6| -00000100 47 a5 08 0d 92 42 5b c2 81 c0 be 97 79 98 40 fb |G....B[.....y.@.| -00000110 4f 6d 14 fd 2b 13 8b c2 a5 2e 67 d8 d4 09 9e d6 |Om..+.....g.....| -00000120 22 38 b7 4a 0b 74 73 2b c2 34 f1 d1 93 e5 96 d9 |"8.J.ts+.4......| -00000130 74 7b f3 58 9f 6c 61 3c c0 b0 41 d4 d9 2b 2b 24 |t{.X.la<..A..++$| -00000140 23 77 5b 1c 3b bd 75 5d ce 20 54 cf a1 63 87 1d |#w[.;.u]. T..c..| -00000150 1e 24 c4 f3 1d 1a 50 8b aa b6 14 43 ed 97 a7 75 |.$....P....C...u| -00000160 62 f4 14 c8 52 d7 02 03 01 00 01 a3 81 93 30 81 |b...R.........0.| -00000170 90 30 0e 06 03 55 1d 0f 01 01 ff 04 04 03 02 05 |.0...U..........| -00000180 a0 30 1d 06 03 55 1d 25 04 16 30 14 06 08 2b 06 |.0...U.%..0...+.| -00000190 01 05 05 07 03 01 06 08 2b 06 01 05 05 07 03 02 |........+.......| -000001a0 30 0c 06 03 55 1d 13 01 01 ff 04 02 30 00 30 19 |0...U.......0.0.| -000001b0 06 03 55 1d 0e 04 12 04 10 9f 91 16 1f 43 43 3e |..U..........CC>| -000001c0 49 a6 de 6d b6 80 d7 9f 60 30 1b 06 03 55 1d 23 |I..m....`0...U.#| -000001d0 04 14 30 12 80 10 48 13 49 4d 13 7e 16 31 bb a3 |..0...H.IM.~.1..| -000001e0 01 d5 ac ab 6e 7b 30 19 06 03 55 1d 11 04 12 30 |....n{0...U....0| -000001f0 10 82 0e 65 78 61 6d 70 6c 65 2e 67 6f 6c 61 6e |...example.golan| -00000200 67 30 0d 06 09 2a 86 48 86 f7 0d 01 01 0b 05 00 |g0...*.H........| -00000210 03 81 81 00 9d 30 cc 40 2b 5b 50 a0 61 cb ba e5 |.....0.@+[P.a...| -00000220 53 58 e1 ed 83 28 a9 58 1a a9 38 a4 95 a1 ac 31 |SX...(.X..8....1| -00000230 5a 1a 84 66 3d 43 d3 2d d9 0b f2 97 df d3 20 64 |Z..f=C.-...... d| -00000240 38 92 24 3a 00 bc cf 9c 7d b7 40 20 01 5f aa d3 |8.$:....}.@ ._..| -00000250 16 61 09 a2 76 fd 13 c3 cc e1 0c 5c ee b1 87 82 |.a..v......\....| -00000260 f1 6c 04 ed 73 bb b3 43 77 8d 0c 1c f1 0f a1 d8 |.l..s..Cw.......| -00000270 40 83 61 c9 4c 72 2b 9d ae db 46 06 06 4d f4 c1 |@.a.Lr+...F..M..| -00000280 b3 3e c0 d1 bd 42 d4 db fe 3d 13 60 84 5c 21 d3 |.>...B...=.`.\!.| -00000290 3b e9 fa e7 16 03 03 00 1b 0d 00 00 17 02 01 40 |;..............@| -000002a0 00 10 04 01 04 03 05 01 05 03 06 01 06 03 02 01 |................| -000002b0 02 03 00 00 16 03 03 00 04 0e 00 00 00 |.............| ->>> Flow 3 (client to server) -00000000 16 03 03 00 07 0b 00 00 03 00 00 00 16 03 03 00 |................| -00000010 86 10 00 00 82 00 80 1d c6 6c b0 b9 b3 41 06 80 |.........l...A..| -00000020 e0 f5 df 06 ae 0f 2f 5f 72 14 44 47 16 c4 f0 a6 |....../_r.DG....| -00000030 68 be fa ee ec 9b 38 b0 e4 bd a3 e9 ca 18 5b 25 |h.....8.......[%| -00000040 33 31 57 86 63 59 0e ce 10 77 f8 42 a6 5c ad 3f |31W.cY...w.B.\.?| -00000050 80 85 a5 c1 06 4c 36 aa f3 ee 62 39 66 69 76 51 |.....L6...b9fivQ| -00000060 57 cc a0 b1 35 81 d5 38 01 2d 83 0e 2e 6b a9 84 |W...5..8.-...k..| -00000070 0d 8b 29 93 90 78 2d 0d 33 5f 85 0d 00 0c e2 5f |..)..x-.3_....._| -00000080 83 21 28 27 83 ad 9d 19 2d 01 35 6d 85 2e 8d 6b |.!('....-.5m...k| -00000090 eb 7a cd 8a 3f 42 e2 14 03 03 00 01 01 16 03 03 |.z..?B..........| -000000a0 00 40 5e 19 0f d0 4c 17 e0 25 e6 6b a1 d9 ea 59 |.@^...L..%.k...Y| -000000b0 f4 3a 55 84 2c 50 1e 53 47 78 45 b8 97 f7 7f 3d |.:U.,P.SGxE....=| -000000c0 af d9 7a ad 30 30 77 1a 93 05 19 5b 9b 13 70 e0 |..z.00w....[..p.| -000000d0 e0 f8 ba 6a bd 74 c5 71 0d 5a 2c 3f 2d 98 1a 3c |...j.t.q.Z,?-..<| -000000e0 5a 7d |Z}| ->>> Flow 4 (server to client) -00000000 15 03 03 00 02 02 2a |......*| diff --git a/src/crypto/tls/testdata/Server-TLSv12-RSA-PSS-Disabled b/src/crypto/tls/testdata/Server-TLSv12-RSA-PSS-Disabled deleted file mode 100644 index 302e64e60f..0000000000 --- a/src/crypto/tls/testdata/Server-TLSv12-RSA-PSS-Disabled +++ /dev/null @@ -1,84 +0,0 @@ ->>> Flow 1 (client to server) -00000000 16 03 01 00 cb 01 00 00 c7 03 03 ed 3d 3e 10 95 |............=>..| -00000010 8b 6f 6c be 5c b7 77 c0 79 91 f8 b3 6f 52 27 18 |.ol.\.w.y...oR'.| -00000020 0a b7 88 52 df 3c 6c 87 b4 5a 4c 00 00 38 c0 2c |...R. >> Flow 2 (server to client) -00000000 16 03 03 00 31 02 00 00 2d 03 03 00 00 00 00 00 |....1...-.......| -00000010 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................| -00000020 00 00 00 44 4f 57 4e 47 52 44 01 00 c0 30 00 00 |...DOWNGRD...0..| -00000030 05 ff 01 00 01 00 16 03 03 02 59 0b 00 02 55 00 |..........Y...U.| -00000040 02 52 00 02 4f 30 82 02 4b 30 82 01 b4 a0 03 02 |.R..O0..K0......| -00000050 01 02 02 09 00 e8 f0 9d 3f e2 5b ea a6 30 0d 06 |........?.[..0..| -00000060 09 2a 86 48 86 f7 0d 01 01 0b 05 00 30 1f 31 0b |.*.H........0.1.| -00000070 30 09 06 03 55 04 0a 13 02 47 6f 31 10 30 0e 06 |0...U....Go1.0..| -00000080 03 55 04 03 13 07 47 6f 20 52 6f 6f 74 30 1e 17 |.U....Go Root0..| -00000090 0d 31 36 30 31 30 31 30 30 30 30 30 30 5a 17 0d |.160101000000Z..| -000000a0 32 35 30 31 30 31 30 30 30 30 30 30 5a 30 1a 31 |250101000000Z0.1| -000000b0 0b 30 09 06 03 55 04 0a 13 02 47 6f 31 0b 30 09 |.0...U....Go1.0.| -000000c0 06 03 55 04 03 13 02 47 6f 30 81 9f 30 0d 06 09 |..U....Go0..0...| -000000d0 2a 86 48 86 f7 0d 01 01 01 05 00 03 81 8d 00 30 |*.H............0| -000000e0 81 89 02 81 81 00 db 46 7d 93 2e 12 27 06 48 bc |.......F}...'.H.| -000000f0 06 28 21 ab 7e c4 b6 a2 5d fe 1e 52 45 88 7a 36 |.(!.~...]..RE.z6| -00000100 47 a5 08 0d 92 42 5b c2 81 c0 be 97 79 98 40 fb |G....B[.....y.@.| -00000110 4f 6d 14 fd 2b 13 8b c2 a5 2e 67 d8 d4 09 9e d6 |Om..+.....g.....| -00000120 22 38 b7 4a 0b 74 73 2b c2 34 f1 d1 93 e5 96 d9 |"8.J.ts+.4......| -00000130 74 7b f3 58 9f 6c 61 3c c0 b0 41 d4 d9 2b 2b 24 |t{.X.la<..A..++$| -00000140 23 77 5b 1c 3b bd 75 5d ce 20 54 cf a1 63 87 1d |#w[.;.u]. T..c..| -00000150 1e 24 c4 f3 1d 1a 50 8b aa b6 14 43 ed 97 a7 75 |.$....P....C...u| -00000160 62 f4 14 c8 52 d7 02 03 01 00 01 a3 81 93 30 81 |b...R.........0.| -00000170 90 30 0e 06 03 55 1d 0f 01 01 ff 04 04 03 02 05 |.0...U..........| -00000180 a0 30 1d 06 03 55 1d 25 04 16 30 14 06 08 2b 06 |.0...U.%..0...+.| -00000190 01 05 05 07 03 01 06 08 2b 06 01 05 05 07 03 02 |........+.......| -000001a0 30 0c 06 03 55 1d 13 01 01 ff 04 02 30 00 30 19 |0...U.......0.0.| -000001b0 06 03 55 1d 0e 04 12 04 10 9f 91 16 1f 43 43 3e |..U..........CC>| -000001c0 49 a6 de 6d b6 80 d7 9f 60 30 1b 06 03 55 1d 23 |I..m....`0...U.#| -000001d0 04 14 30 12 80 10 48 13 49 4d 13 7e 16 31 bb a3 |..0...H.IM.~.1..| -000001e0 01 d5 ac ab 6e 7b 30 19 06 03 55 1d 11 04 12 30 |....n{0...U....0| -000001f0 10 82 0e 65 78 61 6d 70 6c 65 2e 67 6f 6c 61 6e |...example.golan| -00000200 67 30 0d 06 09 2a 86 48 86 f7 0d 01 01 0b 05 00 |g0...*.H........| -00000210 03 81 81 00 9d 30 cc 40 2b 5b 50 a0 61 cb ba e5 |.....0.@+[P.a...| -00000220 53 58 e1 ed 83 28 a9 58 1a a9 38 a4 95 a1 ac 31 |SX...(.X..8....1| -00000230 5a 1a 84 66 3d 43 d3 2d d9 0b f2 97 df d3 20 64 |Z..f=C.-...... d| -00000240 38 92 24 3a 00 bc cf 9c 7d b7 40 20 01 5f aa d3 |8.$:....}.@ ._..| -00000250 16 61 09 a2 76 fd 13 c3 cc e1 0c 5c ee b1 87 82 |.a..v......\....| -00000260 f1 6c 04 ed 73 bb b3 43 77 8d 0c 1c f1 0f a1 d8 |.l..s..Cw.......| -00000270 40 83 61 c9 4c 72 2b 9d ae db 46 06 06 4d f4 c1 |@.a.Lr+...F..M..| -00000280 b3 3e c0 d1 bd 42 d4 db fe 3d 13 60 84 5c 21 d3 |.>...B...=.`.\!.| -00000290 3b e9 fa e7 16 03 03 00 ac 0c 00 00 a8 03 00 1d |;...............| -000002a0 20 2f e5 7d a3 47 cd 62 43 15 28 da ac 5f bb 29 | /.}.G.bC.(.._.)| -000002b0 07 30 ff f6 84 af c4 cf c2 ed 90 99 5f 58 cb 3b |.0.........._X.;| -000002c0 74 04 01 00 80 a5 a9 75 be 51 ff dc b3 bb 77 79 |t......u.Q....wy| -000002d0 ef 5b 9f d9 27 6c 76 ea ce 5c 66 20 03 2e 94 fd |.[..'lv..\f ....| -000002e0 28 94 69 ff 06 ab bd 34 43 51 72 fb 15 42 e6 38 |(.i....4CQr..B.8| -000002f0 c5 7a 5d 7f 35 a7 3c 85 ec df 95 23 0f 28 c7 dc |.z].5.<....#.(..| -00000300 0e a6 ec fe 5e 77 3f 95 1d a7 73 1d d8 7b 68 92 |....^w?...s..{h.| -00000310 5b a5 b8 ba f5 7c a5 60 2e 43 d6 60 64 3e 33 c7 |[....|.`.C.`d>3.| -00000320 8b c2 56 68 e3 28 2b 2e 8b 9a 85 29 77 73 24 3e |..Vh.(+....)ws$>| -00000330 2b 95 b8 40 a7 f1 60 b5 9e 85 3e 1d ae ab 7f 85 |+..@..`...>.....| -00000340 63 63 d1 cf 62 16 03 03 00 04 0e 00 00 00 |cc..b.........| ->>> Flow 3 (client to server) -00000000 16 03 03 00 25 10 00 00 21 20 43 dd 3e 28 34 9f |....%...! C.>(4.| -00000010 a9 0c 8e 14 66 01 a1 dd 15 8e 71 b4 05 83 d9 a3 |....f.....q.....| -00000020 5f 5c a3 31 ad 5c d5 5a ad 56 14 03 03 00 01 01 |_\.1.\.Z.V......| -00000030 16 03 03 00 28 f3 ad d2 ec 9e 1e 85 2d 96 5f bc |....(.......-._.| -00000040 70 cc 0a c2 22 ef 0a fe fb b0 77 f1 59 59 08 a6 |p...".....w.YY..| -00000050 57 39 16 00 82 0b 60 1e 9a 74 75 3a 8a |W9....`..tu:.| ->>> Flow 4 (server to client) -00000000 14 03 03 00 01 01 16 03 03 00 28 00 00 00 00 00 |..........(.....| -00000010 00 00 00 cf 63 14 29 73 c7 7b 6c 98 50 db 5f 8e |....c.)s.{l.P._.| -00000020 f4 de 68 bc c0 60 2c db 9e 1f d9 48 55 51 05 47 |..h..`,....HUQ.G| -00000030 7e 43 37 17 03 03 00 25 00 00 00 00 00 00 00 01 |~C7....%........| -00000040 67 0a e7 77 dd 1a 30 87 27 90 b0 42 31 42 09 53 |g..w..0.'..B1B.S| -00000050 03 bf 0c 10 3a c3 a7 95 e9 6e 63 57 ad 15 03 03 |....:....ncW....| -00000060 00 1a 00 00 00 00 00 00 00 02 d5 1a ac 66 50 93 |.............fP.| -00000070 46 0a da 98 1f cc 30 40 c1 47 c7 88 |F.....0@.G..| diff --git a/src/crypto/tls/testdata/Server-TLSv12-RSA-PSS-Disabled-Required b/src/crypto/tls/testdata/Server-TLSv12-RSA-PSS-Disabled-Required deleted file mode 100644 index 9e9570fed0..0000000000 --- a/src/crypto/tls/testdata/Server-TLSv12-RSA-PSS-Disabled-Required +++ /dev/null @@ -1,54 +0,0 @@ ->>> Flow 1 (client to server) -00000000 16 03 01 00 91 01 00 00 8d 03 03 5a 8a 66 22 31 |...........Z.f"1| -00000010 69 92 30 d5 7b 7c 17 a7 7c 14 d6 3c a9 9e ba dd |i.0.{|..|..<....| -00000020 7c 73 fe b4 b4 dd d8 28 39 32 0d 00 00 2a c0 30 ||s.....(92...*.0| -00000030 00 9f cc a8 cc aa c0 2f 00 9e c0 28 00 6b c0 27 |......./...(.k.'| -00000040 00 67 c0 14 00 39 c0 13 00 33 00 9d 00 9c 00 3d |.g...9...3.....=| -00000050 00 3c 00 35 00 2f 00 ff 01 00 00 3a 00 00 00 0e |.<.5./.....:....| -00000060 00 0c 00 00 09 31 32 37 2e 30 2e 30 2e 31 00 0b |.....127.0.0.1..| -00000070 00 04 03 00 01 02 00 0a 00 0c 00 0a 00 1d 00 17 |................| -00000080 00 1e 00 19 00 18 00 16 00 00 00 17 00 00 00 0d |................| -00000090 00 04 00 02 08 04 |......| ->>> Flow 2 (server to client) -00000000 16 03 03 00 31 02 00 00 2d 03 03 00 00 00 00 00 |....1...-.......| -00000010 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................| -00000020 00 00 00 44 4f 57 4e 47 52 44 01 00 c0 30 00 00 |...DOWNGRD...0..| -00000030 05 ff 01 00 01 00 16 03 03 02 59 0b 00 02 55 00 |..........Y...U.| -00000040 02 52 00 02 4f 30 82 02 4b 30 82 01 b4 a0 03 02 |.R..O0..K0......| -00000050 01 02 02 09 00 e8 f0 9d 3f e2 5b ea a6 30 0d 06 |........?.[..0..| -00000060 09 2a 86 48 86 f7 0d 01 01 0b 05 00 30 1f 31 0b |.*.H........0.1.| -00000070 30 09 06 03 55 04 0a 13 02 47 6f 31 10 30 0e 06 |0...U....Go1.0..| -00000080 03 55 04 03 13 07 47 6f 20 52 6f 6f 74 30 1e 17 |.U....Go Root0..| -00000090 0d 31 36 30 31 30 31 30 30 30 30 30 30 5a 17 0d |.160101000000Z..| -000000a0 32 35 30 31 30 31 30 30 30 30 30 30 5a 30 1a 31 |250101000000Z0.1| -000000b0 0b 30 09 06 03 55 04 0a 13 02 47 6f 31 0b 30 09 |.0...U....Go1.0.| -000000c0 06 03 55 04 03 13 02 47 6f 30 81 9f 30 0d 06 09 |..U....Go0..0...| -000000d0 2a 86 48 86 f7 0d 01 01 01 05 00 03 81 8d 00 30 |*.H............0| -000000e0 81 89 02 81 81 00 db 46 7d 93 2e 12 27 06 48 bc |.......F}...'.H.| -000000f0 06 28 21 ab 7e c4 b6 a2 5d fe 1e 52 45 88 7a 36 |.(!.~...]..RE.z6| -00000100 47 a5 08 0d 92 42 5b c2 81 c0 be 97 79 98 40 fb |G....B[.....y.@.| -00000110 4f 6d 14 fd 2b 13 8b c2 a5 2e 67 d8 d4 09 9e d6 |Om..+.....g.....| -00000120 22 38 b7 4a 0b 74 73 2b c2 34 f1 d1 93 e5 96 d9 |"8.J.ts+.4......| -00000130 74 7b f3 58 9f 6c 61 3c c0 b0 41 d4 d9 2b 2b 24 |t{.X.la<..A..++$| -00000140 23 77 5b 1c 3b bd 75 5d ce 20 54 cf a1 63 87 1d |#w[.;.u]. T..c..| -00000150 1e 24 c4 f3 1d 1a 50 8b aa b6 14 43 ed 97 a7 75 |.$....P....C...u| -00000160 62 f4 14 c8 52 d7 02 03 01 00 01 a3 81 93 30 81 |b...R.........0.| -00000170 90 30 0e 06 03 55 1d 0f 01 01 ff 04 04 03 02 05 |.0...U..........| -00000180 a0 30 1d 06 03 55 1d 25 04 16 30 14 06 08 2b 06 |.0...U.%..0...+.| -00000190 01 05 05 07 03 01 06 08 2b 06 01 05 05 07 03 02 |........+.......| -000001a0 30 0c 06 03 55 1d 13 01 01 ff 04 02 30 00 30 19 |0...U.......0.0.| -000001b0 06 03 55 1d 0e 04 12 04 10 9f 91 16 1f 43 43 3e |..U..........CC>| -000001c0 49 a6 de 6d b6 80 d7 9f 60 30 1b 06 03 55 1d 23 |I..m....`0...U.#| -000001d0 04 14 30 12 80 10 48 13 49 4d 13 7e 16 31 bb a3 |..0...H.IM.~.1..| -000001e0 01 d5 ac ab 6e 7b 30 19 06 03 55 1d 11 04 12 30 |....n{0...U....0| -000001f0 10 82 0e 65 78 61 6d 70 6c 65 2e 67 6f 6c 61 6e |...example.golan| -00000200 67 30 0d 06 09 2a 86 48 86 f7 0d 01 01 0b 05 00 |g0...*.H........| -00000210 03 81 81 00 9d 30 cc 40 2b 5b 50 a0 61 cb ba e5 |.....0.@+[P.a...| -00000220 53 58 e1 ed 83 28 a9 58 1a a9 38 a4 95 a1 ac 31 |SX...(.X..8....1| -00000230 5a 1a 84 66 3d 43 d3 2d d9 0b f2 97 df d3 20 64 |Z..f=C.-...... d| -00000240 38 92 24 3a 00 bc cf 9c 7d b7 40 20 01 5f aa d3 |8.$:....}.@ ._..| -00000250 16 61 09 a2 76 fd 13 c3 cc e1 0c 5c ee b1 87 82 |.a..v......\....| -00000260 f1 6c 04 ed 73 bb b3 43 77 8d 0c 1c f1 0f a1 d8 |.l..s..Cw.......| -00000270 40 83 61 c9 4c 72 2b 9d ae db 46 06 06 4d f4 c1 |@.a.Lr+...F..M..| -00000280 b3 3e c0 d1 bd 42 d4 db fe 3d 13 60 84 5c 21 d3 |.>...B...=.`.\!.| -00000290 3b e9 fa e7 15 03 03 00 02 02 28 |;.........(| diff --git a/src/crypto/tls/testdata/Server-TLSv13-ClientAuthRequestedAndGiven-PSS-Disabled b/src/crypto/tls/testdata/Server-TLSv13-ClientAuthRequestedAndGiven-PSS-Disabled deleted file mode 100644 index 89361f1557..0000000000 --- a/src/crypto/tls/testdata/Server-TLSv13-ClientAuthRequestedAndGiven-PSS-Disabled +++ /dev/null @@ -1,182 +0,0 @@ ->>> Flow 1 (client to server) -00000000 16 03 01 00 e0 01 00 00 dc 03 03 32 03 2a b3 ed |...........2.*..| -00000010 c2 1a 71 f2 ff ea 0b 1c fa f9 c6 88 03 7c 84 89 |..q..........|..| -00000020 4e 45 60 81 d9 58 dc 9f 0a 60 d1 20 ce 4d 59 a5 |NE`..X...`. .MY.| -00000030 10 b1 76 53 f5 77 26 fd 17 08 f9 e5 14 03 c4 0a |..vS.w&.........| -00000040 65 fd 83 bb a9 3b 24 05 24 1b ef 00 00 08 13 02 |e....;$.$.......| -00000050 13 03 13 01 00 ff 01 00 00 8b 00 00 00 0e 00 0c |................| -00000060 00 00 09 31 32 37 2e 30 2e 30 2e 31 00 0b 00 04 |...127.0.0.1....| -00000070 03 00 01 02 00 0a 00 0c 00 0a 00 1d 00 17 00 1e |................| -00000080 00 19 00 18 00 16 00 00 00 17 00 00 00 0d 00 1e |................| -00000090 00 1c 04 03 05 03 06 03 08 07 08 08 08 09 08 0a |................| -000000a0 08 0b 08 04 08 05 08 06 04 01 05 01 06 01 00 2b |...............+| -000000b0 00 03 02 03 04 00 2d 00 02 01 01 00 33 00 26 00 |......-.....3.&.| -000000c0 24 00 1d 00 20 06 b0 03 80 81 d6 e7 f4 31 85 4c |$... ........1.L| -000000d0 e3 50 35 c1 df 6e 28 9f 38 ce c0 7b fc 71 00 8c |.P5..n(.8..{.q..| -000000e0 9a 25 07 95 57 |.%..W| ->>> Flow 2 (server to client) -00000000 16 03 03 00 7a 02 00 00 76 03 03 00 00 00 00 00 |....z...v.......| -00000010 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................| -00000020 00 00 00 00 00 00 00 00 00 00 00 20 ce 4d 59 a5 |........... .MY.| -00000030 10 b1 76 53 f5 77 26 fd 17 08 f9 e5 14 03 c4 0a |..vS.w&.........| -00000040 65 fd 83 bb a9 3b 24 05 24 1b ef 00 13 02 00 00 |e....;$.$.......| -00000050 2e 00 2b 00 02 03 04 00 33 00 24 00 1d 00 20 2f |..+.....3.$... /| -00000060 e5 7d a3 47 cd 62 43 15 28 da ac 5f bb 29 07 30 |.}.G.bC.(.._.).0| -00000070 ff f6 84 af c4 cf c2 ed 90 99 5f 58 cb 3b 74 14 |.........._X.;t.| -00000080 03 03 00 01 01 17 03 03 00 17 ad ce ff 21 b8 39 |.............!.9| -00000090 16 f6 10 6e 8d 6c 0f 46 2f 58 55 b3 e4 4f 2d 5c |...n.l.F/XU..O-\| -000000a0 26 17 03 03 00 3c fd 24 07 75 28 2b f2 ec d9 74 |&....<.$.u(+...t| -000000b0 f0 76 e4 02 e6 02 bd 47 58 0f 68 60 ac 6c 59 a8 |.v.....GX.h`.lY.| -000000c0 87 94 b9 cb c3 fa 41 15 4c 95 b8 58 da 8c d9 ea |......A.L..X....| -000000d0 3a ab 0c 06 83 a5 2b d1 39 6f 32 92 bf e1 c0 f4 |:.....+.9o2.....| -000000e0 49 51 17 03 03 02 6d 22 dc 8c fc ae 21 96 41 17 |IQ....m"....!.A.| -000000f0 45 93 6e 08 61 6b 46 b9 9a cf 2e 79 a8 1a 46 30 |E.n.akF....y..F0| -00000100 a4 de 3d 53 87 bf 57 3a 44 4f 5b 3f c9 b2 f0 0e |..=S..W:DO[?....| -00000110 56 5f 5a ee 5a 1f df cc fe f3 54 ab 87 d7 bb 00 |V_Z.Z.....T.....| -00000120 2c 61 de ad 31 9c d4 cf 43 bf e7 84 d1 1d 3c cb |,a..1...C.....<.| -00000130 82 d1 81 9d 13 90 6b c8 fd 01 53 4f 13 a5 91 a4 |......k...SO....| -00000140 fe 20 ce 2c 34 96 62 b7 6f f0 f0 65 f0 01 18 99 |. .,4.b.o..e....| -00000150 31 3d cb c6 72 6f 54 d6 ec fa a3 dd 94 67 6b b9 |1=..roT......gk.| -00000160 ff 2c 41 ba 00 d5 25 ba b1 7a e5 d2 1c 0b 37 ad |.,A...%..z....7.| -00000170 df 0b 62 be b3 69 5b 84 39 2d 72 c2 b9 ec 68 87 |..b..i[.9-r...h.| -00000180 32 23 92 4b a8 f0 17 25 0f d7 86 97 45 65 73 e1 |2#.K...%....Ees.| -00000190 49 c4 3c 8d 26 43 34 06 4c be 50 76 ae 63 6f 1d |I.<.&C4.L.Pv.co.| -000001a0 ed 57 93 5a 7f 98 e2 1e 5f 94 74 a2 54 59 63 12 |.W.Z...._.t.TYc.| -000001b0 bb 8b df 77 20 3a 9c ea c7 40 b0 cf 8e 7f f8 98 |...w :...@......| -000001c0 06 92 38 be 77 11 17 03 c2 ac af fc 8d 7d d5 6b |..8.w........}.k| -000001d0 f7 2b 7a f3 b8 dc b0 cf 3e f7 c5 f4 b3 34 4b 06 |.+z.....>....4K.| -000001e0 c6 ed b5 dc 0c 2d 4e bc 03 94 cc 03 f2 9f 5d c6 |.....-N.......].| -000001f0 57 36 5a 01 81 65 27 75 1d 4f 22 9f b5 da 7f e2 |W6Z..e'u.O".....| -00000200 7d 36 f3 4b 05 3f 40 47 c6 1b af e6 99 c0 ca 35 |}6.K.?@G.......5| -00000210 98 c8 30 60 7b 42 4e e7 5c 90 28 d7 4e db f3 78 |..0`{BN.\.(.N..x| -00000220 22 e2 a3 86 0c 9e 19 43 0e 89 d4 f6 78 38 21 16 |"......C....x8!.| -00000230 84 38 36 6a 2d a5 94 2c 52 2b 00 de 67 16 e8 89 |.86j-..,R+..g...| -00000240 32 21 0e fd b0 23 91 06 8b fa 82 70 21 bc 1f 29 |2!...#.....p!..)| -00000250 32 af f4 b9 15 7f aa 22 c1 e8 e3 2c 92 b4 d8 2a |2......"...,...*| -00000260 64 58 f4 f1 85 85 14 92 f3 16 8e 2d 5b a6 7e ef |dX.........-[.~.| -00000270 22 5a 58 bb 4c f1 36 70 2f ca 03 df fb 0a d0 03 |"ZX.L.6p/.......| -00000280 55 5d d9 6b 63 48 d2 75 82 d4 56 af 17 5a 60 4f |U].kcH.u..V..Z`O| -00000290 af 8b 17 d6 fd 96 be 3d 82 25 0e 73 2e 58 0e 0a |.......=.%.s.X..| -000002a0 5c 2d c8 f5 17 b0 ae 7d 39 90 cb 75 bb 4b 33 22 |\-.....}9..u.K3"| -000002b0 bd a2 02 00 70 43 a8 54 ee 7c 25 d5 d7 88 08 f6 |....pC.T.|%.....| -000002c0 3f 34 61 55 f5 d3 53 0c 8c b1 9b fd 4e d9 65 7a |?4aU..S.....N.ez| -000002d0 2b 6e b4 d5 37 34 18 f3 14 00 9f 56 40 d9 15 ea |+n..74.....V@...| -000002e0 59 5a 4b 4a bb f7 19 72 60 4a 08 8f 75 d6 7b a4 |YZKJ...r`J..u.{.| -000002f0 de 79 c5 21 1a cb 82 97 b3 88 d8 ae 65 30 cc 56 |.y.!........e0.V| -00000300 da a3 04 5c 63 f4 44 a5 eb 05 55 ad 78 46 44 ac |...\c.D...U.xFD.| -00000310 56 2e f6 f7 eb 47 f6 f1 62 8d df 27 7d 86 5e 58 |V....G..b..'}.^X| -00000320 5f 4c 34 6e f6 c0 fd 56 7d 46 82 5d 53 db 2a 84 |_L4n...V}F.]S.*.| -00000330 45 db e7 9c b9 23 32 59 cf 85 f7 12 c5 e8 9e 3c |E....#2Y.......<| -00000340 2d 3f 81 a5 24 cf 36 ad d6 65 02 35 84 de 43 f8 |-?..$.6..e.5..C.| -00000350 04 e2 8b ae 17 03 03 00 99 ce e8 48 a3 34 5e fb |...........H.4^.| -00000360 76 f1 e4 3b da 94 0a 25 ee 78 f6 31 24 10 05 25 |v..;...%.x.1$..%| -00000370 9c e5 ca fc ef c5 66 86 08 15 d8 69 75 d8 49 e9 |......f....iu.I.| -00000380 9b 86 71 3f 1f 41 ee f0 bc 8d 4e aa bc 30 f0 8f |..q?.A....N..0..| -00000390 7b b1 94 7e aa 74 3f eb 23 c5 c9 aa 9a c3 f7 12 |{..~.t?.#.......| -000003a0 23 30 95 2e e1 1b 9c fe 8b 50 b1 d9 17 cf af a1 |#0.......P......| -000003b0 ff ce 8d fa 7e bd 23 59 d0 7a fb 30 12 f4 8d 86 |....~.#Y.z.0....| -000003c0 0c 3c fd 03 50 d4 7f bb f6 fa ba 1d fc 32 cc 7e |.<..P........2.~| -000003d0 12 3a 33 90 c6 82 5d 6a 90 23 6d b8 e6 60 7d d3 |.:3...]j.#m..`}.| -000003e0 a8 f0 0c 75 bc b5 67 68 ed 58 ef 4d ac 91 47 c9 |...u..gh.X.M..G.| -000003f0 c4 bc 17 03 03 00 45 ae 0d 8d 76 8d 28 34 1b 09 |......E...v.(4..| -00000400 4d d5 df 2e aa f8 ff 71 b2 0e 60 a1 ce 8a 58 9c |M......q..`...X.| -00000410 45 64 31 6c 9b 46 66 64 27 98 e6 f3 93 e8 92 81 |Ed1l.Ffd'.......| -00000420 3d 4f db da 98 72 0d b7 71 27 ac 2b 61 81 97 0b |=O...r..q'.+a...| -00000430 e7 ae 32 d7 e2 66 4d 5d f7 01 d0 77 |..2..fM]...w| ->>> Flow 3 (client to server) -00000000 14 03 03 00 01 01 17 03 03 02 11 f6 03 90 9e bc |................| -00000010 dc 00 9b f9 dd 7b 65 dd b0 69 b4 b5 42 fc 25 f2 |.....{e..i..B.%.| -00000020 2b 7e be 52 1a 4b f1 e4 21 94 0d 88 4a 58 07 37 |+~.R.K..!...JX.7| -00000030 67 c7 e3 c4 62 eb 17 57 5d 52 d4 a9 03 39 0e 7d |g...b..W]R...9.}| -00000040 d0 c3 1a 8d ef ec b7 a8 9b 93 50 0d 7f fd a1 10 |..........P.....| -00000050 b6 82 99 21 3f e3 3d 3d 47 04 c3 cd a7 b3 ab e0 |...!?.==G.......| -00000060 f6 33 47 0e 1c 30 36 45 21 32 34 c2 2c 72 20 72 |.3G..06E!24.,r r| -00000070 b6 c7 5b 95 8a 97 84 54 2e d0 5f d5 80 e7 8f 7a |..[....T.._....z| -00000080 6f 50 96 8a 33 13 c6 97 85 25 47 6b 8a b2 a0 29 |oP..3....%Gk...)| -00000090 cd 7f 0e 38 94 53 08 8b c3 2f 89 a2 10 c2 22 5a |...8.S.../...."Z| -000000a0 95 42 a3 45 73 a8 d0 ac 6d ba 95 a4 51 63 b9 b4 |.B.Es...m...Qc..| -000000b0 79 61 be dd c6 ab 97 72 38 30 63 55 a7 7d 9a eb |ya.....r80cU.}..| -000000c0 bb 5a f6 d0 3d 05 81 5d 0e e5 7a 8b ae fe d2 3b |.Z..=..]..z....;| -000000d0 db 85 3a 13 81 ee 36 b3 ff 41 47 d1 67 bf 17 5e |..:...6..AG.g..^| -000000e0 9d a3 4c 92 51 a9 1b 4b ca 13 f6 ee 8a e5 b3 01 |..L.Q..K........| -000000f0 e7 87 ee 1e 2a 9e 56 3d 01 7e 0f cb e5 d6 ea 13 |....*.V=.~......| -00000100 05 3e 8c 5a 24 d0 36 6b 54 9f 8e 3f 07 73 a0 bf |.>.Z$.6kT..?.s..| -00000110 84 c2 90 72 ce 48 50 49 47 27 b3 14 56 5c c7 63 |...r.HPIG'..V\.c| -00000120 7e 7e b5 8f 9d 6d 70 32 6f 3f 4d 53 80 ae f6 2b |~~...mp2o?MS...+| -00000130 fb c9 7a de 76 aa 68 a3 9b a9 a7 47 55 d0 cb f8 |..z.v.h....GU...| -00000140 e8 c4 1c f5 0f 54 82 5b c5 45 18 41 05 da 72 ce |.....T.[.E.A..r.| -00000150 84 d1 8b 00 40 e9 f9 cf b5 d5 3e 71 ee 25 dc 7d |....@.....>q.%.}| -00000160 3b 00 67 68 9d 78 d2 c0 7b cb 5d 9e 79 2c b5 f4 |;.gh.x..{.].y,..| -00000170 1b ea b8 d8 de bd 36 71 2a 26 49 44 1b 5b 92 ad |......6q*&ID.[..| -00000180 1c 2d 2f ab 8e 15 d7 b3 96 89 da 58 77 75 42 32 |.-/........XwuB2| -00000190 c3 6b f1 5e 0b da 91 71 1e d5 f1 dd 32 d8 b6 a5 |.k.^...q....2...| -000001a0 21 a1 1d 5e b1 df 01 37 33 ac 93 11 94 6d b8 e6 |!..^...73....m..| -000001b0 3b be 86 31 da cf b6 ab cd f5 12 4f 85 45 24 06 |;..1.......O.E$.| -000001c0 34 40 7b c5 f8 5f c3 f9 3b cf 9d 2a b3 2e 65 e4 |4@{.._..;..*..e.| -000001d0 0e ed fc 7c b4 2b 32 bf 0e 8f b3 85 93 74 8b e8 |...|.+2......t..| -000001e0 25 e0 47 c0 d8 52 8e c9 ed 7f 16 41 3f b3 79 d8 |%.G..R.....A?.y.| -000001f0 d1 47 19 ae fb ab 97 a5 b2 42 7c a0 73 ad 4f 62 |.G.......B|.s.Ob| -00000200 cf 35 52 7c d6 47 b8 1f e9 65 b0 99 f7 67 e7 64 |.5R|.G...e...g.d| -00000210 14 83 46 c7 90 6e 4d 01 3a c2 e6 19 17 03 03 00 |..F..nM.:.......| -00000220 99 a5 e0 38 3a 91 4a 1d 87 9a eb a6 95 87 35 fc |...8:.J.......5.| -00000230 ae 42 8d 3a fe f6 39 f3 c2 c2 f0 9a f5 8f b5 75 |.B.:..9........u| -00000240 18 6b 84 c0 5b 96 6a 9c 0c aa 81 fc 9a 2e 01 f7 |.k..[.j.........| -00000250 d8 b1 5d 4a 54 cf 79 90 fb 79 57 ff d9 d1 46 59 |..]JT.y..yW...FY| -00000260 02 84 3d ee cc 68 ea 05 1d a2 79 fb 1d 1e d6 ad |..=..h....y.....| -00000270 5b 95 3b 6b 9a c9 07 e5 e4 20 07 6a a0 74 c8 1a |[.;k..... .j.t..| -00000280 31 53 a4 e6 bb bb 28 61 47 41 d5 f3 45 38 71 86 |1S....(aGA..E8q.| -00000290 35 12 f4 8a f2 e4 e9 ae 96 a9 14 ce 8a 1c 5d 59 |5.............]Y| -000002a0 3c d7 3a e7 93 35 c2 53 9f d8 4d cb 98 bd e1 72 |<.:..5.S..M....r| -000002b0 a8 80 55 a6 cd 9c 50 41 ec 50 17 03 03 00 45 2d |..U...PA.P....E-| -000002c0 90 3b 73 cc 24 52 ad 22 90 0e 7d bf 2a a2 44 09 |.;s.$R."..}.*.D.| -000002d0 e2 43 61 f2 48 9b 73 85 00 05 8b 0a 51 ad a0 c0 |.Ca.H.s.....Q...| -000002e0 64 ef 5e 11 86 37 b0 32 af 11 f7 98 7b 74 39 90 |d.^..7.2....{t9.| -000002f0 fa d0 32 f3 fe 4d 01 6b 78 75 31 7e 67 4f 61 0f |..2..M.kxu1~gOa.| -00000300 bb c6 3e c0 |..>.| ->>> Flow 4 (server to client) -00000000 17 03 03 02 9b f5 b2 d6 62 fe e0 c8 8d cc 7a cd |........b.....z.| -00000010 29 51 b2 77 0d 9a 54 fb 43 6d f6 9c e1 ff 28 be |)Q.w..T.Cm....(.| -00000020 fc 50 68 80 2f 1c 4f 50 44 95 64 49 0a 66 fe 79 |.Ph./.OPD.dI.f.y| -00000030 46 ba 88 e9 03 be 5c 91 60 84 78 03 a8 c6 21 90 |F.....\.`.x...!.| -00000040 cd 79 de 2d 2f 81 dd 08 1f 52 1a 0e d8 69 16 22 |.y.-/....R...i."| -00000050 a6 59 5b 2b 85 08 00 16 e7 85 bd 43 9a cc ce e6 |.Y[+.......C....| -00000060 3a ee 70 25 0b 95 90 4b c0 42 4a 48 25 d3 50 92 |:.p%...K.BJH%.P.| -00000070 19 e1 3e b8 72 c5 a1 e8 dd 9f a4 57 2d b0 a6 24 |..>.r......W-..$| -00000080 8b 8c 55 41 f3 26 45 dd dd 2b d3 15 8d d9 ca e4 |..UA.&E..+......| -00000090 15 6e b5 6d 99 79 ba 46 00 e6 5e 75 52 fd f9 26 |.n.m.y.F..^uR..&| -000000a0 cf cd 69 cf be 29 a7 b9 7d 1b 1d 6b ab 17 ee 4e |..i..)..}..k...N| -000000b0 f5 24 b0 89 0f b5 c7 41 4e ea cd 32 98 47 23 bc |.$.....AN..2.G#.| -000000c0 91 03 b1 23 e0 5c 5e 37 40 95 da 90 ef eb 95 81 |...#.\^7@.......| -000000d0 7b 2d c7 15 8f f8 2d ba 69 41 0e a9 eb 19 6c 6c |{-....-.iA....ll| -000000e0 73 b0 05 fc b9 f4 76 91 2b 6a 72 fa d6 e5 87 a9 |s.....v.+jr.....| -000000f0 90 49 81 8c d5 fa 78 a2 a1 8f 77 c7 35 78 1b ba |.I....x...w.5x..| -00000100 ac 3c 41 51 ce 4e 99 c9 74 a0 bc 51 12 b5 15 2c |. .G| -00000280 71 63 2f 0c 94 c9 42 ac bc 4c 0a 16 fe 9a 90 eb |qc/...B..L......| -00000290 02 75 16 1a 10 23 b2 75 67 c7 c5 17 55 9b cf 69 |.u...#.ug...U..i| -000002a0 17 03 03 00 1e 45 8c ed 99 0f 8a 83 d8 89 70 49 |.....E........pI| -000002b0 17 a8 fd 2b 6e ef ff 53 fa 99 52 89 ee 8b 19 f1 |...+n..S..R.....| -000002c0 41 09 30 17 03 03 00 13 14 f0 f6 ef c5 f9 52 15 |A.0...........R.| -000002d0 77 de 5e 46 63 8d 3b 2f 07 84 aa |w.^Fc.;/...| diff --git a/src/crypto/tls/testdata/Server-TLSv13-RSA-PSS-Disabled b/src/crypto/tls/testdata/Server-TLSv13-RSA-PSS-Disabled deleted file mode 100644 index c13db8d68a..0000000000 --- a/src/crypto/tls/testdata/Server-TLSv13-RSA-PSS-Disabled +++ /dev/null @@ -1,103 +0,0 @@ ->>> Flow 1 (client to server) -00000000 16 03 01 00 e0 01 00 00 dc 03 03 1e 9f 50 05 56 |.............P.V| -00000010 a7 21 c8 df 56 a8 f3 bb e4 15 3b b0 04 e5 f5 10 |.!..V.....;.....| -00000020 d8 5b 0e 68 d3 b4 39 64 b5 89 9c 20 5a 6b 29 6d |.[.h..9d... Zk)m| -00000030 22 a0 e0 fb 7f 2d 87 48 e7 b4 c9 b3 5a d0 2b c7 |"....-.H....Z.+.| -00000040 ad d8 e4 ad d5 eb 81 b3 1f 61 0e 65 00 08 13 02 |.........a.e....| -00000050 13 03 13 01 00 ff 01 00 00 8b 00 00 00 0e 00 0c |................| -00000060 00 00 09 31 32 37 2e 30 2e 30 2e 31 00 0b 00 04 |...127.0.0.1....| -00000070 03 00 01 02 00 0a 00 0c 00 0a 00 1d 00 17 00 1e |................| -00000080 00 19 00 18 00 16 00 00 00 17 00 00 00 0d 00 1e |................| -00000090 00 1c 04 03 05 03 06 03 08 07 08 08 08 09 08 0a |................| -000000a0 08 0b 08 04 08 05 08 06 04 01 05 01 06 01 00 2b |...............+| -000000b0 00 03 02 03 04 00 2d 00 02 01 01 00 33 00 26 00 |......-.....3.&.| -000000c0 24 00 1d 00 20 ba 67 99 b3 60 71 ed 6c bb 8d 7e |$... .g..`q.l..~| -000000d0 4c c3 ea 37 6d 90 b6 f8 91 67 71 2c 84 a7 32 3a |L..7m....gq,..2:| -000000e0 23 2a 90 13 35 |#*..5| ->>> Flow 2 (server to client) -00000000 16 03 03 00 7a 02 00 00 76 03 03 00 00 00 00 00 |....z...v.......| -00000010 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................| -00000020 00 00 00 00 00 00 00 00 00 00 00 20 5a 6b 29 6d |........... Zk)m| -00000030 22 a0 e0 fb 7f 2d 87 48 e7 b4 c9 b3 5a d0 2b c7 |"....-.H....Z.+.| -00000040 ad d8 e4 ad d5 eb 81 b3 1f 61 0e 65 13 02 00 00 |.........a.e....| -00000050 2e 00 2b 00 02 03 04 00 33 00 24 00 1d 00 20 2f |..+.....3.$... /| -00000060 e5 7d a3 47 cd 62 43 15 28 da ac 5f bb 29 07 30 |.}.G.bC.(.._.).0| -00000070 ff f6 84 af c4 cf c2 ed 90 99 5f 58 cb 3b 74 14 |.........._X.;t.| -00000080 03 03 00 01 01 17 03 03 00 17 d9 74 68 ee e6 54 |...........th..T| -00000090 e3 7a 0e ee 86 c7 a8 bb c7 65 fc e4 c4 6c 58 7a |.z.......e...lXz| -000000a0 1e 17 03 03 02 6d 98 c3 0c cc 80 fe ea 70 13 4e |.....m.......p.N| -000000b0 2f f6 49 99 5f 27 0a f9 4d cf e5 1a 9a 37 fb e7 |/.I._'..M....7..| -000000c0 3b a4 60 82 43 df fb fa 47 15 6f d8 db d2 3e c3 |;.`.C...G.o...>.| -000000d0 dd a0 37 ca b2 b4 c9 1b 5c 86 4a e0 7e 06 1e 27 |..7.....\.J.~..'| -000000e0 73 c6 cd 54 37 df 95 b1 c6 d5 44 85 2c 67 7d a7 |s..T7.....D.,g}.| -000000f0 2a 7d 87 86 5e f3 e5 60 f8 7c de bf 78 89 35 9b |*}..^..`.|..x.5.| -00000100 d1 0b 8a dd 6f 40 d8 5a 55 10 e2 71 b0 7a 5e 4b |....o@.ZU..q.z^K| -00000110 86 18 be 18 a7 f8 8e c6 ae 8c 1e df bf 84 77 c5 |..............w.| -00000120 dc b1 17 26 72 ea bb 9b 28 6c bf 19 8d 1a 22 90 |...&r...(l....".| -00000130 0f 19 92 5b ff db 07 84 48 61 68 f0 50 20 76 a3 |...[....Hah.P v.| -00000140 d3 f2 4a 3b 60 f5 73 cb 61 f7 11 63 f2 a7 0e 18 |..J;`.s.a..c....| -00000150 30 96 d0 17 f1 2f 58 09 49 33 15 3e 31 e4 17 e8 |0..../X.I3.>1...| -00000160 07 48 b5 43 06 40 60 4f a0 78 0d 51 0c 3f 0f 1a |.H.C.@`O.x.Q.?..| -00000170 8c 95 7a 3e 36 66 36 22 dc 58 4e b7 3e 19 ad de |..z>6f6".XN.>...| -00000180 c9 f9 b0 76 e4 e2 8c 04 27 6f 67 8f fe 86 b9 41 |...v....'og....A| -00000190 53 7d 9f d1 e0 a6 0b ec fc c0 82 bf 00 36 28 4d |S}...........6(M| -000001a0 20 3a e3 42 67 87 16 64 6c 4f e2 54 23 d1 0f 32 | :.Bg..dlO.T#..2| -000001b0 e9 16 9a da 46 a6 39 18 d5 6e a6 93 25 de a1 77 |....F.9..n..%..w| -000001c0 d9 26 b5 7c b4 85 8a 69 48 90 11 a9 8c 42 ca b8 |.&.|...iH....B..| -000001d0 88 63 df ec 6c e3 9f 2c 29 75 9b 57 79 8b 69 66 |.c..l..,)u.Wy.if| -000001e0 16 9e 93 48 04 8a 41 e0 8b 0e fb a5 9c fd 68 f6 |...H..A.......h.| -000001f0 5f ab 89 11 e4 aa 4c 6c 92 df b3 a3 39 f0 38 d9 |_.....Ll....9.8.| -00000200 7d 1b 42 13 ee d1 83 e2 20 3f 60 81 96 d9 63 2c |}.B..... ?`...c,| -00000210 e8 54 a5 08 41 9b 1d 02 41 37 a2 ce 0c 9b 34 bf |.T..A...A7....4.| -00000220 43 c5 ac 90 67 cd 6b b6 55 31 36 b1 2b 0e ed 8c |C...g.k.U16.+...| -00000230 23 ae 71 b2 ab f3 94 68 f2 f6 87 d3 87 61 ca aa |#.q....h.....a..| -00000240 0b 65 63 a1 11 dc 6d 74 33 c8 24 a6 ae 40 27 c7 |.ec...mt3.$..@'.| -00000250 d4 06 51 89 15 35 66 21 b0 82 15 87 70 c5 b8 8d |..Q..5f!....p...| -00000260 34 48 ff 41 e0 1a b0 46 f7 38 47 53 64 f7 a3 a2 |4H.A...F.8GSd...| -00000270 61 96 72 ea 90 de 86 18 64 49 91 ed 97 05 e3 27 |a.r.....dI.....'| -00000280 47 df ea 06 c6 28 f9 79 51 5e 64 b6 de 52 75 8a |G....(.yQ^d..Ru.| -00000290 79 8d 8e a6 d5 b0 f1 a6 ab 76 44 25 4b 80 5e e4 |y........vD%K.^.| -000002a0 d4 aa c6 2d 77 1a 49 52 16 d6 73 6b 18 2d d1 a6 |...-w.IR..sk.-..| -000002b0 4c e1 be 4d f8 79 34 a1 4c 81 88 9c 4b 85 f3 28 |L..M.y4.L...K..(| -000002c0 97 fc 3a 7e cf d4 81 2c d3 57 df 09 f5 49 f5 cf |..:~...,.W...I..| -000002d0 c7 7c 22 b3 8e 95 0f 97 6d d1 56 e3 43 7e 52 0f |.|".....m.V.C~R.| -000002e0 d4 da 3f e0 4e 06 b9 84 18 7d 7c 56 49 e0 d7 4a |..?.N....}|VI..J| -000002f0 d6 df c4 70 0c 74 5b 1f 4d 76 28 cd 3b b0 9e 27 |...p.t[.Mv(.;..'| -00000300 cc 6b 1a 13 41 1a 6b bf 0d 2d 93 b2 d5 7e 7e 25 |.k..A.k..-...~~%| -00000310 0e 8a 9c 17 03 03 00 99 df 4b 8e 3e d0 14 be 76 |.........K.>...v| -00000320 f1 d3 ca b1 39 c0 7e 6c 4f 8c d9 0d b8 83 07 39 |....9.~lO......9| -00000330 08 55 13 1e 3d 68 0f 99 9f 9a 68 1f 57 6a aa 41 |.U..=h....h.Wj.A| -00000340 a4 40 2b 12 f2 4b 6c db 3c 59 fa 99 5c e2 c7 2d |.@+..Kl. >> Flow 3 (client to server) -00000000 14 03 03 00 01 01 17 03 03 00 45 4b 7c c5 9e c6 |..........EK|...| -00000010 47 4a 90 d8 c2 c0 49 f7 3b c4 26 eb 15 18 9c bc |GJ....I.;.&.....| -00000020 c8 44 f0 53 94 2f 0f c8 d7 c1 86 42 ed b7 8f 63 |.D.S./.....B...c| -00000030 a0 97 5d 5b 15 01 3a 3d ca a6 d0 1a a4 77 cc 7e |..][..:=.....w.~| -00000040 88 fd 0b c9 a0 46 b7 40 25 8a 03 6e 99 66 bb 84 |.....F.@%..n.f..| ->>> Flow 4 (server to client) -00000000 17 03 03 00 1e 6a 41 80 ca 72 5f c3 ee e1 88 49 |.....jA..r_....I| -00000010 6d be a4 d9 26 07 5c 2b 2c a7 83 b5 c4 eb 4e 4b |m...&.\+,.....NK| -00000020 a1 29 98 17 03 03 00 13 2a f9 33 6c 46 f7 9a 51 |.)......*.3lF..Q| -00000030 1b 36 cd bc d8 5d 94 0d 9e 4b 72 |.6...]...Kr| diff --git a/src/crypto/tls/tls.go b/src/crypto/tls/tls.go index f8e32ab495..578035cf73 100644 --- a/src/crypto/tls/tls.go +++ b/src/crypto/tls/tls.go @@ -4,6 +4,15 @@ // Package tls partially implements TLS 1.2, as specified in RFC 5246, // and TLS 1.3, as specified in RFC 8446. +// +// TLS 1.3 is available only on an opt-in basis in Go 1.12. To enable +// it, set the GODEBUG environment variable (comma-separated key=value +// options) such that it includes "tls13=1". To enable it from within +// the process, set the environment variable before any use of TLS: +// +// func init() { +// os.Setenv("GODEBUG", os.Getenv("GODEBUG")+",tls13=1") +// } package tls // BUG(agl): The crypto/tls package only implements some countermeasures diff --git a/src/crypto/tls/tls_test.go b/src/crypto/tls/tls_test.go index 61f4eaf1ae..9c26769b09 100644 --- a/src/crypto/tls/tls_test.go +++ b/src/crypto/tls/tls_test.go @@ -23,15 +23,11 @@ import ( "time" ) -var savedSupportedSignatureAlgorithmsTLS12 = defaultSupportedSignatureAlgorithmsTLS12 - func init() { - // TLS 1.3 is opt-in for Go 1.12, and RSA-PSS is disabled in TLS 1.2, but we - // want to run most tests with both enabled. TestTLS13Switch below and the - // "PSS-Disabled" recordings test the disabled behavior. See Issue 30055. + // TLS 1.3 is opt-in for Go 1.12, but we want to run most tests with it enabled. + // TestTLS13Switch below tests the disabled behavior. See Issue 30055. tls13Support.Do(func() {}) // defuse the sync.Once tls13Support.cached = true - defaultSupportedSignatureAlgorithmsTLS12 = defaultSupportedSignatureAlgorithms } var rsaCertPEM = `-----BEGIN CERTIFICATE----- diff --git a/src/crypto/x509/name_constraints_test.go b/src/crypto/x509/name_constraints_test.go index 4c9bc1b87a..735534da95 100644 --- a/src/crypto/x509/name_constraints_test.go +++ b/src/crypto/x509/name_constraints_test.go @@ -2220,10 +2220,8 @@ func TestBadNamesInSANs(t *testing.T) { continue } - if err != nil { - if str := err.Error(); !strings.Contains(str, "cannot parse ") { - t.Errorf("bad name %q triggered unrecognised error: %s", badName, str) - } + if str := err.Error(); !strings.Contains(str, "cannot parse ") { + t.Errorf("bad name %q triggered unrecognised error: %s", badName, str) } } } diff --git a/src/database/sql/driver/driver.go b/src/database/sql/driver/driver.go index 5ff2bc9735..ecc6547bf3 100644 --- a/src/database/sql/driver/driver.go +++ b/src/database/sql/driver/driver.go @@ -137,7 +137,7 @@ type Pinger interface { // Execer is an optional interface that may be implemented by a Conn. // -// If a Conn implements neither ExecerContext nor Execer Execer, +// If a Conn implements neither ExecerContext nor Execer, // the sql package's DB.Exec will first prepare a query, execute the statement, // and then close the statement. // diff --git a/src/database/sql/sql.go b/src/database/sql/sql.go index 38a173adba..8cdc903c68 100644 --- a/src/database/sql/sql.go +++ b/src/database/sql/sql.go @@ -2256,6 +2256,13 @@ var ( // Stmt is a prepared statement. // A Stmt is safe for concurrent use by multiple goroutines. +// +// If a Stmt is prepared on a Tx or Conn, it will be bound to a single +// underlying connection forever. If the Tx or Conn closes, the Stmt will +// become unusable and all operations will return an error. +// If a Stmt is prepared on a DB, it will remain usable for the lifetime of the +// DB. When the Stmt needs to execute on a new underlying connection, it will +// prepare itself on the new connection automatically. type Stmt struct { // Immutable: db *DB // where we came from diff --git a/src/encoding/base32/base32.go b/src/encoding/base32/base32.go index 3fb6caceab..e14d2d4987 100644 --- a/src/encoding/base32/base32.go +++ b/src/encoding/base32/base32.go @@ -284,7 +284,12 @@ func (e CorruptInputError) Error() string { // additional data is an error. This method assumes that src has been // stripped of all supported whitespace ('\r' and '\n'). func (enc *Encoding) decode(dst, src []byte) (n int, end bool, err error) { + // Lift the nil check outside of the loop. + _ = enc.decodeMap + + dsti := 0 olen := len(src) + for len(src) > 0 && !end { // Decode quantum using the base32 alphabet var dbuf [8]byte @@ -292,17 +297,15 @@ func (enc *Encoding) decode(dst, src []byte) (n int, end bool, err error) { for j := 0; j < 8; { - // We have reached the end and are missing padding - if len(src) == 0 && enc.padChar != NoPadding { - return n, false, CorruptInputError(olen - len(src) - j) - } - - // We have reached the end and are not expecing any padding - if len(src) == 0 && enc.padChar == NoPadding { + if len(src) == 0 { + if enc.padChar != NoPadding { + // We have reached the end and are missing padding + return n, false, CorruptInputError(olen - len(src) - j) + } + // We have reached the end and are not expecing any padding dlen, end = j, true break } - in := src[0] src = src[1:] if in == byte(enc.padChar) && j >= 2 && len(src) < 8 { @@ -339,37 +342,26 @@ func (enc *Encoding) decode(dst, src []byte) (n int, end bool, err error) { // quantum switch dlen { case 8: - dst[4] = dbuf[6]<<5 | dbuf[7] + dst[dsti+4] = dbuf[6]<<5 | dbuf[7] + n++ fallthrough case 7: - dst[3] = dbuf[4]<<7 | dbuf[5]<<2 | dbuf[6]>>3 + dst[dsti+3] = dbuf[4]<<7 | dbuf[5]<<2 | dbuf[6]>>3 + n++ fallthrough case 5: - dst[2] = dbuf[3]<<4 | dbuf[4]>>1 + dst[dsti+2] = dbuf[3]<<4 | dbuf[4]>>1 + n++ fallthrough case 4: - dst[1] = dbuf[1]<<6 | dbuf[2]<<1 | dbuf[3]>>4 + dst[dsti+1] = dbuf[1]<<6 | dbuf[2]<<1 | dbuf[3]>>4 + n++ fallthrough case 2: - dst[0] = dbuf[0]<<3 | dbuf[1]>>2 - } - - if !end { - dst = dst[5:] - } - - switch dlen { - case 2: - n += 1 - case 4: - n += 2 - case 5: - n += 3 - case 7: - n += 4 - case 8: - n += 5 + dst[dsti+0] = dbuf[0]<<3 | dbuf[1]>>2 + n++ } + dsti += 5 } return n, end, nil } diff --git a/src/encoding/json/example_test.go b/src/encoding/json/example_test.go index 2031cba793..4c075ddaa6 100644 --- a/src/encoding/json/example_test.go +++ b/src/encoding/json/example_test.go @@ -301,3 +301,11 @@ func ExampleValid() { // Output: // true false } + +func ExampleHTMLEscape() { + var out bytes.Buffer + json.HTMLEscape(&out, []byte(`{"Name":"HTML content"}`)) + out.WriteTo(os.Stdout) + // Output: + //{"Name":"\u003cb\u003eHTML content\u003c/b\u003e"} +} diff --git a/src/fmt/doc.go b/src/fmt/doc.go index 3b657f3681..a7115809d3 100644 --- a/src/fmt/doc.go +++ b/src/fmt/doc.go @@ -26,6 +26,7 @@ %c the character represented by the corresponding Unicode code point %d base 10 %o base 8 + %O base 8 with 0o prefix %q a single-quoted character literal safely escaped with Go syntax. %x base 16, with lower-case letters for a-f %X base 16, with upper-case letters for A-F @@ -40,6 +41,8 @@ %F synonym for %f %g %e for large exponents, %f otherwise. Precision is discussed below. %G %E for large exponents, %F otherwise + %x hexadecimal notation (with decimal power of two exponent), e.g. -0x1.23abcp+20 + %X upper-case hexadecimal notation, e.g. -0X1.23ABCP+20 String and slice of bytes (treated equivalently with these verbs): %s the uninterpreted bytes of the string or slice %q a double-quoted string safely escaped with Go syntax @@ -111,8 +114,8 @@ + always print a sign for numeric values; guarantee ASCII-only output for %q (%+q) - pad with spaces on the right rather than the left (left-justify the field) - # alternate format: add leading 0 for octal (%#o), 0x for hex (%#x); - 0X for hex (%#X); suppress 0x for %p (%#p); + # alternate format: add leading 0b for binary (%#b), 0 for octal (%#o), + 0x or 0X for hex (%#x or %#X); suppress 0x for %p (%#p); for %q, print a raw (backquoted) string if strconv.CanBackquote returns true; always print a decimal point for %e, %E, %f, %F, %g and %G; @@ -214,7 +217,7 @@ description of the problem, as in these examples: Wrong type or unknown verb: %!verb(type=value) - Printf("%d", hi): %!d(string=hi) + Printf("%d", "hi"): %!d(string=hi) Too many arguments: %!(EXTRA type=value) Printf("hi", "guys"): hi%!(EXTRA string=guys) Too few arguments: %!verb(MISSING) @@ -283,10 +286,10 @@ For example, %x will scan an integer as a hexadecimal number, and %v will scan the default representation format for the value. The Printf verbs %p and %T and the flags # and + are not implemented. - The verbs %e %E %f %F %g and %G are all equivalent and scan any - floating-point or complex value. For float and complex literals in - scientific notation, both the decimal (e) and binary (p) exponent - formats are supported (for example: "2.3e+7" and "4.5p-8"). + For floating-point and complex values, all valid formatting verbs + (%b %e %E %f %F %g %G %x %X and %v) are equivalent and accept + both decimal and hexadecimal notation (for example: "2.3e+7", "0x4.5p-8") + and digit-separating underscores (for example: "3.14159_26535_89793"). Input processed by verbs is implicitly space-delimited: the implementation of every verb except %c starts by discarding @@ -294,9 +297,10 @@ (and %v reading into a string) stops consuming input at the first space or newline character. - The familiar base-setting prefixes 0 (octal) and 0x - (hexadecimal) are accepted when scanning integers without - a format or with the %v verb. + The familiar base-setting prefixes 0b (binary), 0o and 0 (octal), + and 0x (hexadecimal) are accepted when scanning integers + without a format or with the %v verb, as are digit-separating + underscores. Width is interpreted in the input text but there is no syntax for scanning with a precision (no %5.2f, just %5f). diff --git a/src/fmt/fmt_test.go b/src/fmt/fmt_test.go index 068c2620a8..bbaf40a619 100644 --- a/src/fmt/fmt_test.go +++ b/src/fmt/fmt_test.go @@ -354,11 +354,17 @@ var fmtTests = []struct { {"%+d", -12345, "-12345"}, {"%b", 7, "111"}, {"%b", -6, "-110"}, + {"%#b", 7, "0b111"}, + {"%#b", -6, "-0b110"}, {"%b", ^uint32(0), "11111111111111111111111111111111"}, {"%b", ^uint64(0), "1111111111111111111111111111111111111111111111111111111111111111"}, {"%b", int64(-1 << 63), zeroFill("-1", 63, "")}, {"%o", 01234, "1234"}, + {"%o", -01234, "-1234"}, {"%#o", 01234, "01234"}, + {"%#o", -01234, "-01234"}, + {"%O", 01234, "0o1234"}, + {"%O", -01234, "-0o1234"}, {"%o", ^uint32(0), "37777777777"}, {"%o", ^uint64(0), "1777777777777777777777"}, {"%#X", 0, "0X0"}, @@ -413,6 +419,8 @@ var fmtTests = []struct { // floats {"%+.3e", 0.0, "+0.000e+00"}, {"%+.3e", 1.0, "+1.000e+00"}, + {"%+.3x", 0.0, "+0x0.000p+00"}, + {"%+.3x", 1.0, "+0x1.000p+00"}, {"%+.3f", -1.0, "-1.000"}, {"%+.3F", -1.0, "-1.000"}, {"%+.3F", float32(-1.0), "-1.000"}, @@ -428,6 +436,8 @@ var fmtTests = []struct { {"%+10.2f", -1.0, " -1.00"}, {"% .3E", -1.0, "-1.000E+00"}, {"% .3e", 1.0, " 1.000e+00"}, + {"% .3X", -1.0, "-0X1.000P+00"}, + {"% .3x", 1.0, " 0x1.000p+00"}, {"%+.3g", 0.0, "+0"}, {"%+.3g", 1.0, "+1"}, {"%+.3g", -1.0, "-1"}, @@ -445,17 +455,21 @@ var fmtTests = []struct { {"%#g", 1000000.0, "1.00000e+06"}, {"%#.0f", 1.0, "1."}, {"%#.0e", 1.0, "1.e+00"}, + {"%#.0x", 1.0, "0x1.p+00"}, {"%#.0g", 1.0, "1."}, {"%#.0g", 1100000.0, "1.e+06"}, {"%#.4f", 1.0, "1.0000"}, {"%#.4e", 1.0, "1.0000e+00"}, + {"%#.4x", 1.0, "0x1.0000p+00"}, {"%#.4g", 1.0, "1.000"}, {"%#.4g", 100000.0, "1.000e+05"}, {"%#.0f", 123.0, "123."}, {"%#.0e", 123.0, "1.e+02"}, + {"%#.0x", 123.0, "0x1.p+07"}, {"%#.0g", 123.0, "1.e+02"}, {"%#.4f", 123.0, "123.0000"}, {"%#.4e", 123.0, "1.2300e+02"}, + {"%#.4x", 123.0, "0x1.ec00p+06"}, {"%#.4g", 123.0, "123.0"}, {"%#.4g", 123000.0, "1.230e+05"}, {"%#9.4g", 1.0, " 1.000"}, @@ -474,17 +488,23 @@ var fmtTests = []struct { {"%20f", posInf, " +Inf"}, {"% 20F", posInf, " Inf"}, {"% 20e", negInf, " -Inf"}, + {"% 20x", negInf, " -Inf"}, {"%+20E", negInf, " -Inf"}, + {"%+20X", negInf, " -Inf"}, {"% +20g", negInf, " -Inf"}, {"%+-20G", posInf, "+Inf "}, {"%20e", NaN, " NaN"}, + {"%20x", NaN, " NaN"}, {"% +20E", NaN, " +NaN"}, + {"% +20X", NaN, " +NaN"}, {"% -20g", NaN, " NaN "}, {"%+-20G", NaN, "+NaN "}, // Zero padding does not apply to infinities and NaN. {"%+020e", posInf, " +Inf"}, + {"%+020x", posInf, " +Inf"}, {"%-020f", negInf, "-Inf "}, {"%-020E", NaN, "NaN "}, + {"%-020X", NaN, "NaN "}, // complex values {"%.f", 0i, "(0+0i)"}, @@ -492,23 +512,29 @@ var fmtTests = []struct { {"%+.f", 0i, "(+0+0i)"}, {"% +.f", 0i, "(+0+0i)"}, {"%+.3e", 0i, "(+0.000e+00+0.000e+00i)"}, + {"%+.3x", 0i, "(+0x0.000p+00+0x0.000p+00i)"}, {"%+.3f", 0i, "(+0.000+0.000i)"}, {"%+.3g", 0i, "(+0+0i)"}, {"%+.3e", 1 + 2i, "(+1.000e+00+2.000e+00i)"}, + {"%+.3x", 1 + 2i, "(+0x1.000p+00+0x1.000p+01i)"}, {"%+.3f", 1 + 2i, "(+1.000+2.000i)"}, {"%+.3g", 1 + 2i, "(+1+2i)"}, {"%.3e", 0i, "(0.000e+00+0.000e+00i)"}, + {"%.3x", 0i, "(0x0.000p+00+0x0.000p+00i)"}, {"%.3f", 0i, "(0.000+0.000i)"}, {"%.3F", 0i, "(0.000+0.000i)"}, {"%.3F", complex64(0i), "(0.000+0.000i)"}, {"%.3g", 0i, "(0+0i)"}, {"%.3e", 1 + 2i, "(1.000e+00+2.000e+00i)"}, + {"%.3x", 1 + 2i, "(0x1.000p+00+0x1.000p+01i)"}, {"%.3f", 1 + 2i, "(1.000+2.000i)"}, {"%.3g", 1 + 2i, "(1+2i)"}, {"%.3e", -1 - 2i, "(-1.000e+00-2.000e+00i)"}, + {"%.3x", -1 - 2i, "(-0x1.000p+00-0x1.000p+01i)"}, {"%.3f", -1 - 2i, "(-1.000-2.000i)"}, {"%.3g", -1 - 2i, "(-1-2i)"}, {"% .3E", -1 - 2i, "(-1.000E+00-2.000E+00i)"}, + {"% .3X", -1 - 2i, "(-0X1.000P+00-0X1.000P+01i)"}, {"%+.3g", 1 + 2i, "(+1+2i)"}, {"%+.3g", complex64(1 + 2i), "(+1+2i)"}, {"%#g", 1 + 2i, "(1.00000+2.00000i)"}, @@ -517,11 +543,13 @@ var fmtTests = []struct { {"%#g", -1e10 - 1.11e100i, "(-1.00000e+10-1.11000e+100i)"}, {"%#.0f", 1.23 + 1.0i, "(1.+1.i)"}, {"%#.0e", 1.23 + 1.0i, "(1.e+00+1.e+00i)"}, + {"%#.0x", 1.23 + 1.0i, "(0x1.p+00+0x1.p+00i)"}, {"%#.0g", 1.23 + 1.0i, "(1.+1.i)"}, {"%#.0g", 0 + 100000i, "(0.+1.e+05i)"}, {"%#.0g", 1230000 + 0i, "(1.e+06+0.i)"}, {"%#.4f", 1 + 1.23i, "(1.0000+1.2300i)"}, {"%#.4e", 123 + 1i, "(1.2300e+02+1.0000e+00i)"}, + {"%#.4x", 123 + 1i, "(0x1.ec00p+06+0x1.0000p+00i)"}, {"%#.4g", 123 + 1.23i, "(123.0+1.230i)"}, {"%#12.5g", 0 + 100000i, "( 0.0000 +1.0000e+05i)"}, {"%#12.5g", 1230000 - 0i, "( 1.2300e+06 +0.0000i)"}, @@ -541,7 +569,9 @@ var fmtTests = []struct { {"% f", complex(negInf, negInf), "(-Inf-Infi)"}, {"% f", complex(NaN, NaN), "( NaN+NaNi)"}, {"%8e", complex(posInf, posInf), "( +Inf +Infi)"}, + {"%8x", complex(posInf, posInf), "( +Inf +Infi)"}, {"% 8E", complex(posInf, posInf), "( Inf +Infi)"}, + {"% 8X", complex(posInf, posInf), "( Inf +Infi)"}, {"%+8f", complex(negInf, negInf), "( -Inf -Infi)"}, {"% +8g", complex(negInf, negInf), "( -Inf -Infi)"}, {"% -8G", complex(NaN, NaN), "( NaN +NaN i)"}, diff --git a/src/fmt/format.go b/src/fmt/format.go index d6da8aed1e..24e7e9551a 100644 --- a/src/fmt/format.go +++ b/src/fmt/format.go @@ -191,7 +191,7 @@ func (f *fmt) fmtUnicode(u uint64) { } // fmtInteger formats signed and unsigned integers. -func (f *fmt) fmtInteger(u uint64, base int, isSigned bool, digits string) { +func (f *fmt) fmtInteger(u uint64, base int, isSigned bool, verb rune, digits string) { negative := isSigned && int64(u) < 0 if negative { u = -u @@ -275,6 +275,12 @@ func (f *fmt) fmtInteger(u uint64, base int, isSigned bool, digits string) { // Various prefixes: 0x, -, etc. if f.sharp { switch base { + case 2: + // Add a leading 0b. + i-- + buf[i] = 'b' + i-- + buf[i] = '0' case 8: if buf[i] != '0' { i-- @@ -288,6 +294,12 @@ func (f *fmt) fmtInteger(u uint64, base int, isSigned bool, digits string) { buf[i] = '0' } } + if verb == 'O' { + i-- + buf[i] = 'o' + i-- + buf[i] = '0' + } if negative { i-- @@ -510,7 +522,7 @@ func (f *fmt) fmtFloat(v float64, size int, verb rune, prec int) { if f.sharp && verb != 'b' { digits := 0 switch verb { - case 'v', 'g', 'G': + case 'v', 'g', 'G', 'x': digits = prec // If no precision is set explicitly use a precision of 6. if digits == -1 { @@ -519,8 +531,8 @@ func (f *fmt) fmtFloat(v float64, size int, verb rune, prec int) { } // Buffer pre-allocated with enough room for - // exponent notations of the form "e+123". - var tailBuf [5]byte + // exponent notations of the form "e+123" or "p-1023". + var tailBuf [6]byte tail := tailBuf[:0] hasDecimalPoint := false @@ -529,9 +541,16 @@ func (f *fmt) fmtFloat(v float64, size int, verb rune, prec int) { switch num[i] { case '.': hasDecimalPoint = true - case 'e', 'E': + case 'p', 'P': tail = append(tail, num[i:]...) num = num[:i] + case 'e', 'E': + if verb != 'x' && verb != 'X' { + tail = append(tail, num[i:]...) + num = num[:i] + break + } + fallthrough default: digits-- } diff --git a/src/fmt/print.go b/src/fmt/print.go index 42fcd8b979..121c7c59e4 100644 --- a/src/fmt/print.go +++ b/src/fmt/print.go @@ -363,7 +363,7 @@ func (p *pp) fmtBool(v bool, verb rune) { func (p *pp) fmt0x64(v uint64, leading0x bool) { sharp := p.fmt.sharp p.fmt.sharp = leading0x - p.fmt.fmtInteger(v, 16, unsigned, ldigits) + p.fmt.fmtInteger(v, 16, unsigned, 'v', ldigits) p.fmt.sharp = sharp } @@ -374,18 +374,18 @@ func (p *pp) fmtInteger(v uint64, isSigned bool, verb rune) { if p.fmt.sharpV && !isSigned { p.fmt0x64(v, true) } else { - p.fmt.fmtInteger(v, 10, isSigned, ldigits) + p.fmt.fmtInteger(v, 10, isSigned, verb, ldigits) } case 'd': - p.fmt.fmtInteger(v, 10, isSigned, ldigits) + p.fmt.fmtInteger(v, 10, isSigned, verb, ldigits) case 'b': - p.fmt.fmtInteger(v, 2, isSigned, ldigits) - case 'o': - p.fmt.fmtInteger(v, 8, isSigned, ldigits) + p.fmt.fmtInteger(v, 2, isSigned, verb, ldigits) + case 'o', 'O': + p.fmt.fmtInteger(v, 8, isSigned, verb, ldigits) case 'x': - p.fmt.fmtInteger(v, 16, isSigned, ldigits) + p.fmt.fmtInteger(v, 16, isSigned, verb, ldigits) case 'X': - p.fmt.fmtInteger(v, 16, isSigned, udigits) + p.fmt.fmtInteger(v, 16, isSigned, verb, udigits) case 'c': p.fmt.fmtC(v) case 'q': @@ -407,7 +407,7 @@ func (p *pp) fmtFloat(v float64, size int, verb rune) { switch verb { case 'v': p.fmt.fmtFloat(v, size, 'g', -1) - case 'b', 'g', 'G': + case 'b', 'g', 'G', 'x', 'X': p.fmt.fmtFloat(v, size, verb, -1) case 'f', 'e', 'E': p.fmt.fmtFloat(v, size, verb, 6) @@ -425,7 +425,7 @@ func (p *pp) fmtComplex(v complex128, size int, verb rune) { // Make sure any unsupported verbs are found before the // calls to fmtFloat to not generate an incorrect error string. switch verb { - case 'v', 'b', 'g', 'G', 'f', 'F', 'e', 'E': + case 'v', 'b', 'g', 'G', 'x', 'X', 'f', 'F', 'e', 'E': oldPlus := p.fmt.plus p.buf.WriteByte('(') p.fmtFloat(real(v), size/2, verb) @@ -483,7 +483,7 @@ func (p *pp) fmtBytes(v []byte, verb rune, typeString string) { if i > 0 { p.buf.WriteByte(' ') } - p.fmt.fmtInteger(uint64(c), 10, unsigned, ldigits) + p.fmt.fmtInteger(uint64(c), 10, unsigned, verb, ldigits) } p.buf.WriteByte(']') } diff --git a/src/fmt/scan.go b/src/fmt/scan.go index ae79e39dee..d42703cb71 100644 --- a/src/fmt/scan.go +++ b/src/fmt/scan.go @@ -562,7 +562,7 @@ const ( hexadecimalDigits = "0123456789aAbBcCdDeEfF" sign = "+-" period = "." - exponent = "eEp" + exponent = "eEpP" ) // getBase returns the numeric base represented by the verb and its digit string. @@ -609,20 +609,26 @@ func (s *ss) scanRune(bitSize int) int64 { return r } -// scanBasePrefix reports whether the integer begins with a 0 or 0x, +// scanBasePrefix reports whether the integer begins with a bas prefix // and returns the base, digit string, and whether a zero was found. // It is called only if the verb is %v. func (s *ss) scanBasePrefix() (base int, digits string, found bool) { if !s.peek("0") { - return 10, decimalDigits, false + return 0, decimalDigits + "_", false } s.accept("0") found = true // We've put a digit into the token buffer. - // Special cases for '0' && '0x' - base, digits = 8, octalDigits - if s.peek("xX") { - s.consume("xX", false) - base, digits = 16, hexadecimalDigits + // Special cases for 0, 0b, 0o, 0x. + base, digits = 0, octalDigits+"_" + if s.peek("bB") { + s.consume("bB", true) + base, digits = 0, binaryDigits+"_" + } else if s.peek("oO") { + s.consume("oO", true) + base, digits = 0, octalDigits+"_" + } else if s.peek("xX") { + s.consume("xX", true) + base, digits = 0, hexadecimalDigits+"_" } return } @@ -705,21 +711,27 @@ func (s *ss) floatToken() string { if s.accept("iI") && s.accept("nN") && s.accept("fF") { return string(s.buf) } + digits := decimalDigits + "_" + exp := exponent + if s.accept("0") && s.accept("xX") { + digits = hexadecimalDigits + "_" + exp = "pP" + } // digits? - for s.accept(decimalDigits) { + for s.accept(digits) { } // decimal point? if s.accept(period) { // fraction? - for s.accept(decimalDigits) { + for s.accept(digits) { } } // exponent? - if s.accept(exponent) { + if s.accept(exp) { // leading sign? s.accept(sign) // digits? - for s.accept(decimalDigits) { + for s.accept(decimalDigits + "_") { } } return string(s.buf) @@ -749,9 +761,21 @@ func (s *ss) complexTokens() (real, imag string) { return real, imagSign + imag } +func hasX(s string) bool { + for i := 0; i < len(s); i++ { + if s[i] == 'x' || s[i] == 'X' { + return true + } + } + return false +} + // convertFloat converts the string to a float64value. func (s *ss) convertFloat(str string, n int) float64 { - if p := indexRune(str, 'p'); p >= 0 { + // strconv.ParseFloat will handle "+0x1.fp+2", + // but we have to implement our non-standard + // decimal+binary exponent mix (1.2p4) ourselves. + if p := indexRune(str, 'p'); p >= 0 && !hasX(str) { // Atof doesn't handle power-of-2 exponents, // but they're easy to evaluate. f, err := strconv.ParseFloat(str[:p], n) diff --git a/src/fmt/scan_test.go b/src/fmt/scan_test.go index d7019d9439..b14a6f5deb 100644 --- a/src/fmt/scan_test.go +++ b/src/fmt/scan_test.go @@ -124,12 +124,18 @@ var scanTests = []ScanTest{ {"T\n", &boolVal, true}, // boolean test vals toggle to be sure they are written {"F\n", &boolVal, false}, // restored to zero value {"21\n", &intVal, 21}, + {"2_1\n", &intVal, 21}, {"0\n", &intVal, 0}, {"000\n", &intVal, 0}, {"0x10\n", &intVal, 0x10}, + {"0x_1_0\n", &intVal, 0x10}, {"-0x10\n", &intVal, -0x10}, {"0377\n", &intVal, 0377}, + {"0_3_7_7\n", &intVal, 0377}, + {"0o377\n", &intVal, 0377}, + {"0o_3_7_7\n", &intVal, 0377}, {"-0377\n", &intVal, -0377}, + {"-0o377\n", &intVal, -0377}, {"0\n", &uintVal, uint(0)}, {"000\n", &uintVal, uint(0)}, {"0x10\n", &uintVal, uint(0x10)}, @@ -163,13 +169,20 @@ var scanTests = []ScanTest{ {"2.3e2\n", &float64Val, 2.3e2}, {"2.3p2\n", &float64Val, 2.3 * 4}, {"2.3p+2\n", &float64Val, 2.3 * 4}, - {"2.3p+66\n", &float64Val, 2.3 * (1 << 32) * (1 << 32) * 4}, - {"2.3p-66\n", &float64Val, 2.3 / ((1 << 32) * (1 << 32) * 4)}, + {"2.3p+66\n", &float64Val, 2.3 * (1 << 66)}, + {"2.3p-66\n", &float64Val, 2.3 / (1 << 66)}, + {"0x2.3p-66\n", &float64Val, float64(0x23) / (1 << 70)}, + {"2_3.4_5\n", &float64Val, 23.45}, {"2.35\n", &stringVal, "2.35"}, {"2345678\n", &bytesVal, []byte("2345678")}, {"(3.4e1-2i)\n", &complex128Val, 3.4e1 - 2i}, {"-3.45e1-3i\n", &complex64Val, complex64(-3.45e1 - 3i)}, {"-.45e1-1e2i\n", &complex128Val, complex128(-.45e1 - 100i)}, + {"-.4_5e1-1E2i\n", &complex128Val, complex128(-.45e1 - 100i)}, + {"0x1.0p1+0x1.0P2i\n", &complex128Val, complex128(2 + 4i)}, + {"-0x1p1-0x1p2i\n", &complex128Val, complex128(-2 - 4i)}, + {"-0x1ep-1-0x1p2i\n", &complex128Val, complex128(-15 - 4i)}, + {"-0x1_Ep-1-0x1p0_2i\n", &complex128Val, complex128(-15 - 4i)}, {"hello\n", &stringVal, "hello"}, // Carriage-return followed by newline. (We treat \r\n as \n always.) @@ -207,8 +220,15 @@ var scanfTests = []ScanfTest{ {"%v", "TRUE\n", &boolVal, true}, {"%t", "false\n", &boolVal, false}, {"%v", "-71\n", &intVal, -71}, + {"%v", "-7_1\n", &intVal, -71}, + {"%v", "0b111\n", &intVal, 7}, + {"%v", "0b_1_1_1\n", &intVal, 7}, {"%v", "0377\n", &intVal, 0377}, + {"%v", "0_3_7_7\n", &intVal, 0377}, + {"%v", "0o377\n", &intVal, 0377}, + {"%v", "0o_3_7_7\n", &intVal, 0377}, {"%v", "0x44\n", &intVal, 0x44}, + {"%v", "0x_4_4\n", &intVal, 0x44}, {"%d", "72\n", &intVal, 72}, {"%c", "a\n", &runeVal, 'a'}, {"%c", "\u5072\n", &runeVal, '\u5072'}, @@ -222,17 +242,31 @@ var scanfTests = []ScanfTest{ {"%x", "a75\n", &intVal, 0xa75}, {"%v", "71\n", &uintVal, uint(71)}, {"%d", "72\n", &uintVal, uint(72)}, + {"%d", "7_2\n", &uintVal, uint(7)}, // only %v takes underscores {"%d", "73\n", &uint8Val, uint8(73)}, {"%d", "74\n", &uint16Val, uint16(74)}, {"%d", "75\n", &uint32Val, uint32(75)}, {"%d", "76\n", &uint64Val, uint64(76)}, {"%b", "1001001\n", &uintVal, uint(73)}, + {"%b", "100_1001\n", &uintVal, uint(4)}, {"%o", "075\n", &uintVal, uint(075)}, + {"%o", "07_5\n", &uintVal, uint(07)}, // only %v takes underscores {"%x", "a75\n", &uintVal, uint(0xa75)}, {"%x", "A75\n", &uintVal, uint(0xa75)}, + {"%x", "A7_5\n", &uintVal, uint(0xa7)}, // only %v takes underscores {"%U", "U+1234\n", &intVal, int(0x1234)}, {"%U", "U+4567\n", &uintVal, uint(0x4567)}, + {"%e", "2.3\n", &float64Val, 2.3}, + {"%E", "2.3e1\n", &float32Val, float32(2.3e1)}, + {"%f", "2.3e2\n", &float64Val, 2.3e2}, + {"%g", "2.3p2\n", &float64Val, 2.3 * 4}, + {"%G", "2.3p+2\n", &float64Val, 2.3 * 4}, + {"%v", "2.3p+66\n", &float64Val, 2.3 * (1 << 66)}, + {"%f", "2.3p-66\n", &float64Val, 2.3 / (1 << 66)}, + {"%G", "0x2.3p-66\n", &float64Val, float64(0x23) / (1 << 70)}, + {"%E", "2_3.4_5\n", &float64Val, 23.45}, + // Strings {"%s", "using-%s\n", &stringVal, "using-%s"}, {"%x", "7573696e672d2578\n", &stringVal, "using-%x"}, diff --git a/src/go/ast/example_test.go b/src/go/ast/example_test.go index 52a77981b8..e3013f64be 100644 --- a/src/go/ast/example_test.go +++ b/src/go/ast/example_test.go @@ -151,7 +151,7 @@ package main const hello = "Hello, World!" // line comment 1 // This comment is associated with the foo variable. -var foo = hello // line comment 2 +var foo = hello // line comment 2 // This comment is associated with the main function. func main() { @@ -176,6 +176,7 @@ func main() { if gen, ok := decl.(*ast.GenDecl); ok && gen.Tok == token.VAR { copy(f.Decls[i:], f.Decls[i+1:]) f.Decls = f.Decls[:len(f.Decls)-1] + break } } diff --git a/src/go/build/build.go b/src/go/build/build.go index 0fa67201f8..94db198764 100644 --- a/src/go/build/build.go +++ b/src/go/build/build.go @@ -299,7 +299,7 @@ func defaultContext() Context { // (perhaps it is the stub to use in that case) should say "+build !go1.x". // NOTE: If you add to this list, also update the doc comment in doc.go. // NOTE: The last element in ReleaseTags should be the current release. - const version = 12 // go1.12 + const version = 13 // go1.13 for i := 1; i <= version; i++ { c.ReleaseTags = append(c.ReleaseTags, "go1."+strconv.Itoa(i)) } diff --git a/src/go/build/doc.go b/src/go/build/doc.go index 8e3858feea..f6444c7e05 100644 --- a/src/go/build/doc.go +++ b/src/go/build/doc.go @@ -109,6 +109,7 @@ // - "go1.10", from Go version 1.10 onward // - "go1.11", from Go version 1.11 onward // - "go1.12", from Go version 1.12 onward +// - "go1.13", from Go version 1.13 onward // - any additional words listed in ctxt.BuildTags // // There are no build tags for beta or minor releases. diff --git a/src/go/constant/value.go b/src/go/constant/value.go index 0982243edb..f7efa95404 100644 --- a/src/go/constant/value.go +++ b/src/go/constant/value.go @@ -315,8 +315,9 @@ func makeFloatFromLiteral(lit string) Value { // but it'll take forever to parse as a Rat. lit = "0" } - r, _ := newRat().SetString(lit) - return ratVal{r} + if r, ok := newRat().SetString(lit); ok { + return ratVal{r} + } } // otherwise use floats return makeFloat(f) @@ -380,8 +381,17 @@ func MakeFromLiteral(lit string, tok token.Token, zero uint) Value { panic("MakeFromLiteral called with non-zero last argument") } + // TODO(gri) Remove stripSep and, for token.INT, 0o-octal handling + // below once strconv and math/big can handle separators + // and 0o-octals. + switch tok { case token.INT: + // TODO(gri) remove 0o-special case once strconv and math/big can handle 0o-octals + lit = stripSep(lit) + if len(lit) >= 2 && lit[0] == '0' && (lit[1] == 'o' || lit[1] == 'O') { + lit = "0" + lit[2:] + } if x, err := strconv.ParseInt(lit, 0, 64); err == nil { return int64Val(x) } @@ -390,11 +400,13 @@ func MakeFromLiteral(lit string, tok token.Token, zero uint) Value { } case token.FLOAT: + lit = stripSep(lit) if x := makeFloatFromLiteral(lit); x != nil { return x } case token.IMAG: + lit = stripSep(lit) if n := len(lit); n > 0 && lit[n-1] == 'i' { if im := makeFloatFromLiteral(lit[:n-1]); im != nil { return makeComplex(int64Val(0), im) @@ -420,6 +432,26 @@ func MakeFromLiteral(lit string, tok token.Token, zero uint) Value { return unknownVal{} } +func stripSep(s string) string { + // avoid making a copy if there are no separators (common case) + i := 0 + for i < len(s) && s[i] != '_' { + i++ + } + if i == len(s) { + return s + } + + // make a copy of s without separators + var buf []byte + for i := 0; i < len(s); i++ { + if c := s[i]; c != '_' { + buf = append(buf, c) + } + } + return string(buf) +} + // ---------------------------------------------------------------------------- // Accessors // diff --git a/src/go/constant/value_test.go b/src/go/constant/value_test.go index 68b87eaa55..560712a8f5 100644 --- a/src/go/constant/value_test.go +++ b/src/go/constant/value_test.go @@ -11,7 +11,151 @@ import ( "testing" ) -// TODO(gri) expand this test framework +var intTests = []string{ + // 0-octals + `0_123 = 0123`, + `0123_456 = 0123456`, + + // decimals + `1_234 = 1234`, + `1_234_567 = 1234567`, + + // hexadecimals + `0X_0 = 0`, + `0X_1234 = 0x1234`, + `0X_CAFE_f00d = 0xcafef00d`, + + // octals + `0o0 = 0`, + `0o1234 = 01234`, + `0o01234567 = 01234567`, + + `0O0 = 0`, + `0O1234 = 01234`, + `0O01234567 = 01234567`, + + `0o_0 = 0`, + `0o_1234 = 01234`, + `0o0123_4567 = 01234567`, + + `0O_0 = 0`, + `0O_1234 = 01234`, + `0O0123_4567 = 01234567`, + + // binaries + `0b0 = 0`, + `0b1011 = 0xb`, + `0b00101101 = 0x2d`, + + `0B0 = 0`, + `0B1011 = 0xb`, + `0B00101101 = 0x2d`, + + `0b_0 = 0`, + `0b10_11 = 0xb`, + `0b_0010_1101 = 0x2d`, +} + +// The RHS operand may be a floating-point quotient n/d of two integer values n and d. +var floatTests = []string{ + // decimal floats + `1_2_3. = 123.`, + `0_123. = 123.`, + + `0_0e0 = 0.`, + `1_2_3e0 = 123.`, + `0_123e0 = 123.`, + + `0e-0_0 = 0.`, + `1_2_3E+0 = 123.`, + `0123E1_2_3 = 123e123`, + + `0.e+1 = 0.`, + `123.E-1_0 = 123e-10`, + `01_23.e123 = 123e123`, + + `.0e-1 = .0`, + `.123E+10 = .123e10`, + `.0123E123 = .0123e123`, + + `1_2_3.123 = 123.123`, + `0123.01_23 = 123.0123`, + + // hexadecimal floats + `0x0.p+0 = 0.`, + `0Xdeadcafe.p-10 = 0xdeadcafe/1024`, + `0x1234.P84 = 0x1234000000000000000000000`, + + `0x.1p-0 = 1/16`, + `0X.deadcafep4 = 0xdeadcafe/0x10000000`, + `0x.1234P+12 = 0x1234/0x10`, + + `0x0p0 = 0.`, + `0Xdeadcafep+1 = 0x1bd5b95fc`, + `0x1234P-10 = 0x1234/1024`, + + `0x0.0p0 = 0.`, + `0Xdead.cafep+1 = 0x1bd5b95fc/0x10000`, + `0x12.34P-10 = 0x1234/0x40000`, + + `0Xdead_cafep+1 = 0xdeadcafep+1`, + `0x_1234P-10 = 0x1234p-10`, + + `0X_dead_cafe.p-10 = 0xdeadcafe.p-10`, + `0x12_34.P1_2_3 = 0x1234.p123`, +} + +var imagTests = []string{ + `1_234i = 1234i`, + `1_234_567i = 1234567i`, + + `0.i = 0i`, + `123.i = 123i`, + `0123.i = 123i`, + + `0.e+1i = 0i`, + `123.E-1_0i = 123e-10i`, + `01_23.e123i = 123e123i`, +} + +func testNumbers(t *testing.T, kind token.Token, tests []string) { + for _, test := range tests { + a := strings.Split(test, " = ") + if len(a) != 2 { + t.Errorf("invalid test case: %s", test) + continue + } + + x := MakeFromLiteral(a[0], kind, 0) + var y Value + if i := strings.Index(a[1], "/"); i >= 0 && kind == token.FLOAT { + n := MakeFromLiteral(a[1][:i], token.INT, 0) + d := MakeFromLiteral(a[1][i+1:], token.INT, 0) + y = BinaryOp(n, token.QUO, d) + } else { + y = MakeFromLiteral(a[1], kind, 0) + } + + xk := x.Kind() + yk := y.Kind() + if xk != yk || xk == Unknown { + t.Errorf("%s: got kind %d != %d", test, xk, yk) + continue + } + + if !Compare(x, token.EQL, y) { + t.Errorf("%s: %s != %s", test, x, y) + } + } +} + +// TestNumbers verifies that differently written literals +// representing the same number do have the same value. +func TestNumbers(t *testing.T) { + testNumbers(t, token.INT, intTests) + testNumbers(t, token.FLOAT, floatTests) + testNumbers(t, token.IMAG, imagTests) +} var opTests = []string{ // unary operations diff --git a/src/go/doc/comment.go b/src/go/doc/comment.go index 0ec42643fd..73857330fa 100644 --- a/src/go/doc/comment.go +++ b/src/go/doc/comment.go @@ -445,7 +445,6 @@ func ToText(w io.Writer, text string, indent, preIndent string, width int) { w.Write([]byte("\n")) } else { w.Write([]byte(preIndent)) - line = convertQuotes(line) w.Write([]byte(line)) } } diff --git a/src/go/doc/comment_test.go b/src/go/doc/comment_test.go index e0adeb2f5c..0687f3a62b 100644 --- a/src/go/doc/comment_test.go +++ b/src/go/doc/comment_test.go @@ -126,6 +126,14 @@ $ pre $ pre2 `, }, + { + in: "Para.\n\tshould not be ``escaped''", + out: []block{ + {opPara, []string{"Para.\n"}}, + {opPre, []string{"should not be ``escaped''"}}, + }, + text: ". Para.\n\n$ should not be ``escaped''", + }, } func TestBlocks(t *testing.T) { diff --git a/src/go/internal/gcimporter/testdata/exports.go b/src/go/internal/gcimporter/testdata/exports.go index 9a0273ba20..8ba3242102 100644 --- a/src/go/internal/gcimporter/testdata/exports.go +++ b/src/go/internal/gcimporter/testdata/exports.go @@ -19,7 +19,7 @@ const ( C1 = 3.14159265 C2 = 2.718281828i C3 = -123.456e-789 - C4 = +123.456E+789 + C4 = +123.456e+789 C5 = 1234i C6 = "foo\n" C7 = `bar\n` diff --git a/src/go/scanner/scanner.go b/src/go/scanner/scanner.go index e78abf12a2..00fe2dc0b1 100644 --- a/src/go/scanner/scanner.go +++ b/src/go/scanner/scanner.go @@ -150,6 +150,10 @@ func (s *Scanner) error(offs int, msg string) { s.ErrorCount++ } +func (s *Scanner) errorf(offs int, format string, args ...interface{}) { + s.error(offs, fmt.Sprintf(format, args...)) +} + func (s *Scanner) scanComment() string { // initial '/' already consumed; s.ch == '/' || s.ch == '*' offs := s.offset - 1 // position of initial '/' @@ -336,11 +340,11 @@ func (s *Scanner) findLineEnd() bool { } func isLetter(ch rune) bool { - return 'a' <= ch && ch <= 'z' || 'A' <= ch && ch <= 'Z' || ch == '_' || ch >= utf8.RuneSelf && unicode.IsLetter(ch) + return 'a' <= lower(ch) && lower(ch) <= 'z' || ch == '_' || ch >= utf8.RuneSelf && unicode.IsLetter(ch) } func isDigit(ch rune) bool { - return '0' <= ch && ch <= '9' || ch >= utf8.RuneSelf && unicode.IsDigit(ch) + return isDecimal(ch) || ch >= utf8.RuneSelf && unicode.IsDigit(ch) } func (s *Scanner) scanIdentifier() string { @@ -355,95 +359,185 @@ func digitVal(ch rune) int { switch { case '0' <= ch && ch <= '9': return int(ch - '0') - case 'a' <= ch && ch <= 'f': - return int(ch - 'a' + 10) - case 'A' <= ch && ch <= 'F': - return int(ch - 'A' + 10) + case 'a' <= lower(ch) && lower(ch) <= 'f': + return int(lower(ch) - 'a' + 10) } return 16 // larger than any legal digit val } -func (s *Scanner) scanMantissa(base int) { - for digitVal(s.ch) < base { - s.next() +func lower(ch rune) rune { return ('a' - 'A') | ch } // returns lower-case ch iff ch is ASCII letter +func isDecimal(ch rune) bool { return '0' <= ch && ch <= '9' } +func isHex(ch rune) bool { return '0' <= ch && ch <= '9' || 'a' <= lower(ch) && lower(ch) <= 'f' } + +// digits accepts the sequence { digit | '_' }. +// If base <= 10, digits accepts any decimal digit but records +// the offset (relative to the source start) of a digit >= base +// in *invalid, if *invalid < 0. +// digits returns a bitset describing whether the sequence contained +// digits (bit 0 is set), or separators '_' (bit 1 is set). +func (s *Scanner) digits(base int, invalid *int) (digsep int) { + if base <= 10 { + max := rune('0' + base) + for isDecimal(s.ch) || s.ch == '_' { + ds := 1 + if s.ch == '_' { + ds = 2 + } else if s.ch >= max && *invalid < 0 { + *invalid = int(s.offset) // record invalid rune offset + } + digsep |= ds + s.next() + } + } else { + for isHex(s.ch) || s.ch == '_' { + ds := 1 + if s.ch == '_' { + ds = 2 + } + digsep |= ds + s.next() + } } + return } -func (s *Scanner) scanNumber(seenDecimalPoint bool) (token.Token, string) { - // digitVal(s.ch) < 10 +func (s *Scanner) scanNumber() (token.Token, string) { offs := s.offset - tok := token.INT + tok := token.ILLEGAL - if seenDecimalPoint { - offs-- - tok = token.FLOAT - s.scanMantissa(10) - goto exponent - } + base := 10 // number base + prefix := rune(0) // one of 0 (decimal), '0' (0-octal), 'x', 'o', or 'b' + digsep := 0 // bit 0: digit present, bit 1: '_' present + invalid := -1 // index of invalid digit in literal, or < 0 - if s.ch == '0' { - // int or float - offs := s.offset - s.next() - if s.ch == 'x' || s.ch == 'X' { - // hexadecimal int + // integer part + if s.ch != '.' { + tok = token.INT + if s.ch == '0' { s.next() - s.scanMantissa(16) - if s.offset-offs <= 2 { - // only scanned "0x" or "0X" - s.error(offs, "illegal hexadecimal number") - } - } else { - // octal int or float - seenDecimalDigit := false - s.scanMantissa(8) - if s.ch == '8' || s.ch == '9' { - // illegal octal int or float - seenDecimalDigit = true - s.scanMantissa(10) - } - if s.ch == '.' || s.ch == 'e' || s.ch == 'E' || s.ch == 'i' { - goto fraction - } - // octal int - if seenDecimalDigit { - s.error(offs, "illegal octal number") + switch lower(s.ch) { + case 'x': + s.next() + base, prefix = 16, 'x' + case 'o': + s.next() + base, prefix = 8, 'o' + case 'b': + s.next() + base, prefix = 2, 'b' + default: + base, prefix = 8, '0' + digsep = 1 // leading 0 } } - goto exit + digsep |= s.digits(base, &invalid) } - // decimal int or float - s.scanMantissa(10) - -fraction: + // fractional part if s.ch == '.' { tok = token.FLOAT + if prefix == 'o' || prefix == 'b' { + s.error(s.offset, "invalid radix point in "+litname(prefix)) + } s.next() - s.scanMantissa(10) + digsep |= s.digits(base, &invalid) } -exponent: - if s.ch == 'e' || s.ch == 'E' { - tok = token.FLOAT + if digsep&1 == 0 { + s.error(s.offset, litname(prefix)+" has no digits") + } + + // exponent + if e := lower(s.ch); e == 'e' || e == 'p' { + switch { + case e == 'e' && prefix != 0 && prefix != '0': + s.errorf(s.offset, "%q exponent requires decimal mantissa", s.ch) + case e == 'p' && prefix != 'x': + s.errorf(s.offset, "%q exponent requires hexadecimal mantissa", s.ch) + } s.next() - if s.ch == '-' || s.ch == '+' { + tok = token.FLOAT + if s.ch == '+' || s.ch == '-' { s.next() } - if digitVal(s.ch) < 10 { - s.scanMantissa(10) - } else { - s.error(offs, "illegal floating-point exponent") + ds := s.digits(10, nil) + digsep |= ds + if ds&1 == 0 { + s.error(s.offset, "exponent has no digits") } + } else if prefix == 'x' && tok == token.FLOAT { + s.error(s.offset, "hexadecimal mantissa requires a 'p' exponent") } + // suffix 'i' if s.ch == 'i' { tok = token.IMAG s.next() } -exit: - return tok, string(s.src[offs:s.offset]) + lit := string(s.src[offs:s.offset]) + if tok == token.INT && invalid >= 0 { + s.errorf(invalid, "invalid digit %q in %s", lit[invalid-offs], litname(prefix)) + } + if digsep&2 != 0 { + if i := invalidSep(lit); i >= 0 { + s.error(offs+i, "'_' must separate successive digits") + } + } + + return tok, lit +} + +func litname(prefix rune) string { + switch prefix { + case 'x': + return "hexadecimal literal" + case 'o', '0': + return "octal literal" + case 'b': + return "binary literal" + } + return "decimal literal" +} + +// invalidSep returns the index of the first invalid separator in x, or -1. +func invalidSep(x string) int { + x1 := ' ' // prefix char, we only care if it's 'x' + d := '.' // digit, one of '_', '0' (a digit), or '.' (anything else) + i := 0 + + // a prefix counts as a digit + if len(x) >= 2 && x[0] == '0' { + x1 = lower(rune(x[1])) + if x1 == 'x' || x1 == 'o' || x1 == 'b' { + d = '0' + i = 2 + } + } + + // mantissa and exponent + for ; i < len(x); i++ { + p := d // previous digit + d = rune(x[i]) + switch { + case d == '_': + if p != '0' { + return i + } + case isDecimal(d) || x1 == 'x' && isHex(d): + d = '0' + default: + if p == '_' { + return i - 1 + } + d = '.' + } + } + if d == '_' { + return len(x) - 1 + } + + return -1 } // scanEscape parses an escape sequence where rune is the accepted @@ -708,9 +802,9 @@ scanAgain: insertSemi = true tok = token.IDENT } - case '0' <= ch && ch <= '9': + case isDecimal(ch) || ch == '.' && isDecimal(rune(s.peek())): insertSemi = true - tok, lit = s.scanNumber(false) + tok, lit = s.scanNumber() default: s.next() // always make progress switch ch { @@ -741,16 +835,12 @@ scanAgain: case ':': tok = s.switch2(token.COLON, token.DEFINE) case '.': - if '0' <= s.ch && s.ch <= '9' { - insertSemi = true - tok, lit = s.scanNumber(true) - } else { - tok = token.PERIOD - if s.ch == '.' && s.peek() == '.' { - s.next() - s.next() // consume last '.' - tok = token.ELLIPSIS - } + // fractions starting with a '.' are handled by outer switch + tok = token.PERIOD + if s.ch == '.' && s.peek() == '.' { + s.next() + s.next() // consume last '.' + tok = token.ELLIPSIS } case ',': tok = token.COMMA @@ -835,7 +925,7 @@ scanAgain: default: // next reports unexpected BOMs - don't repeat if ch != bom { - s.error(s.file.Offset(pos), fmt.Sprintf("illegal character %#U", ch)) + s.errorf(s.file.Offset(pos), "illegal character %#U", ch) } insertSemi = s.insertSemi // preserve insertSemi info tok = token.ILLEGAL diff --git a/src/go/scanner/scanner_test.go b/src/go/scanner/scanner_test.go index 36c962209c..9d3bbbbb24 100644 --- a/src/go/scanner/scanner_test.go +++ b/src/go/scanner/scanner_test.go @@ -10,6 +10,7 @@ import ( "os" "path/filepath" "runtime" + "strings" "testing" ) @@ -802,11 +803,10 @@ var errors = []struct { {"078.", token.FLOAT, 0, "078.", ""}, {"07801234567.", token.FLOAT, 0, "07801234567.", ""}, {"078e0", token.FLOAT, 0, "078e0", ""}, - {"0E", token.FLOAT, 0, "0E", "illegal floating-point exponent"}, // issue 17621 - {"078", token.INT, 0, "078", "illegal octal number"}, - {"07800000009", token.INT, 0, "07800000009", "illegal octal number"}, - {"0x", token.INT, 0, "0x", "illegal hexadecimal number"}, - {"0X", token.INT, 0, "0X", "illegal hexadecimal number"}, + {"0E", token.FLOAT, 2, "0E", "exponent has no digits"}, // issue 17621 + {"078", token.INT, 2, "078", "invalid digit '8' in octal literal"}, + {"07090000008", token.INT, 3, "07090000008", "invalid digit '9' in octal literal"}, + {"0x", token.INT, 2, "0x", "hexadecimal literal has no digits"}, {"\"abc\x00def\"", token.STRING, 4, "\"abc\x00def\"", "illegal character NUL"}, {"\"abc\x80def\"", token.STRING, 4, "\"abc\x80def\"", "illegal UTF-8 encoding"}, {"\ufeff\ufeff", token.ILLEGAL, 3, "\ufeff\ufeff", "illegal byte order mark"}, // only first BOM is ignored @@ -912,3 +912,203 @@ func BenchmarkScanFile(b *testing.B) { } } } + +func TestNumbers(t *testing.T) { + for _, test := range []struct { + tok token.Token + src, tokens, err string + }{ + // binaries + {token.INT, "0b0", "0b0", ""}, + {token.INT, "0b1010", "0b1010", ""}, + {token.INT, "0B1110", "0B1110", ""}, + + {token.INT, "0b", "0b", "binary literal has no digits"}, + {token.INT, "0b0190", "0b0190", "invalid digit '9' in binary literal"}, + {token.INT, "0b01a0", "0b01 a0", ""}, // only accept 0-9 + + {token.FLOAT, "0b.", "0b.", "invalid radix point in binary literal"}, + {token.FLOAT, "0b.1", "0b.1", "invalid radix point in binary literal"}, + {token.FLOAT, "0b1.0", "0b1.0", "invalid radix point in binary literal"}, + {token.FLOAT, "0b1e10", "0b1e10", "'e' exponent requires decimal mantissa"}, + {token.FLOAT, "0b1P-1", "0b1P-1", "'P' exponent requires hexadecimal mantissa"}, + + {token.IMAG, "0b10i", "0b10i", ""}, + {token.IMAG, "0b10.0i", "0b10.0i", "invalid radix point in binary literal"}, + + // octals + {token.INT, "0o0", "0o0", ""}, + {token.INT, "0o1234", "0o1234", ""}, + {token.INT, "0O1234", "0O1234", ""}, + + {token.INT, "0o", "0o", "octal literal has no digits"}, + {token.INT, "0o8123", "0o8123", "invalid digit '8' in octal literal"}, + {token.INT, "0o1293", "0o1293", "invalid digit '9' in octal literal"}, + {token.INT, "0o12a3", "0o12 a3", ""}, // only accept 0-9 + + {token.FLOAT, "0o.", "0o.", "invalid radix point in octal literal"}, + {token.FLOAT, "0o.2", "0o.2", "invalid radix point in octal literal"}, + {token.FLOAT, "0o1.2", "0o1.2", "invalid radix point in octal literal"}, + {token.FLOAT, "0o1E+2", "0o1E+2", "'E' exponent requires decimal mantissa"}, + {token.FLOAT, "0o1p10", "0o1p10", "'p' exponent requires hexadecimal mantissa"}, + + {token.IMAG, "0o10i", "0o10i", ""}, + {token.IMAG, "0o10e0i", "0o10e0i", "'e' exponent requires decimal mantissa"}, + + // 0-octals + {token.INT, "0", "0", ""}, + {token.INT, "0123", "0123", ""}, + + {token.INT, "08123", "08123", "invalid digit '8' in octal literal"}, + {token.INT, "01293", "01293", "invalid digit '9' in octal literal"}, + {token.INT, "0F.", "0 F .", ""}, // only accept 0-9 + {token.INT, "0123F.", "0123 F .", ""}, + {token.INT, "0123456x", "0123456 x", ""}, + + // decimals + {token.INT, "1", "1", ""}, + {token.INT, "1234", "1234", ""}, + + {token.INT, "1f", "1 f", ""}, // only accept 0-9 + + {token.IMAG, "0i", "0i", ""}, + {token.IMAG, "0678i", "0678i", ""}, + + // decimal floats + {token.FLOAT, "0.", "0.", ""}, + {token.FLOAT, "123.", "123.", ""}, + {token.FLOAT, "0123.", "0123.", ""}, + + {token.FLOAT, ".0", ".0", ""}, + {token.FLOAT, ".123", ".123", ""}, + {token.FLOAT, ".0123", ".0123", ""}, + + {token.FLOAT, "0.0", "0.0", ""}, + {token.FLOAT, "123.123", "123.123", ""}, + {token.FLOAT, "0123.0123", "0123.0123", ""}, + + {token.FLOAT, "0e0", "0e0", ""}, + {token.FLOAT, "123e+0", "123e+0", ""}, + {token.FLOAT, "0123E-1", "0123E-1", ""}, + + {token.FLOAT, "0.e+1", "0.e+1", ""}, + {token.FLOAT, "123.E-10", "123.E-10", ""}, + {token.FLOAT, "0123.e123", "0123.e123", ""}, + + {token.FLOAT, ".0e-1", ".0e-1", ""}, + {token.FLOAT, ".123E+10", ".123E+10", ""}, + {token.FLOAT, ".0123E123", ".0123E123", ""}, + + {token.FLOAT, "0.0e1", "0.0e1", ""}, + {token.FLOAT, "123.123E-10", "123.123E-10", ""}, + {token.FLOAT, "0123.0123e+456", "0123.0123e+456", ""}, + + {token.FLOAT, "0e", "0e", "exponent has no digits"}, + {token.FLOAT, "0E+", "0E+", "exponent has no digits"}, + {token.FLOAT, "1e+f", "1e+ f", "exponent has no digits"}, + {token.FLOAT, "0p0", "0p0", "'p' exponent requires hexadecimal mantissa"}, + {token.FLOAT, "1.0P-1", "1.0P-1", "'P' exponent requires hexadecimal mantissa"}, + + {token.IMAG, "0.i", "0.i", ""}, + {token.IMAG, ".123i", ".123i", ""}, + {token.IMAG, "123.123i", "123.123i", ""}, + {token.IMAG, "123e+0i", "123e+0i", ""}, + {token.IMAG, "123.E-10i", "123.E-10i", ""}, + {token.IMAG, ".123E+10i", ".123E+10i", ""}, + + // hexadecimals + {token.INT, "0x0", "0x0", ""}, + {token.INT, "0x1234", "0x1234", ""}, + {token.INT, "0xcafef00d", "0xcafef00d", ""}, + {token.INT, "0XCAFEF00D", "0XCAFEF00D", ""}, + + {token.INT, "0x", "0x", "hexadecimal literal has no digits"}, + {token.INT, "0x1g", "0x1 g", ""}, + + {token.IMAG, "0xf00i", "0xf00i", ""}, + + // hexadecimal floats + {token.FLOAT, "0x0p0", "0x0p0", ""}, + {token.FLOAT, "0x12efp-123", "0x12efp-123", ""}, + {token.FLOAT, "0xABCD.p+0", "0xABCD.p+0", ""}, + {token.FLOAT, "0x.0189P-0", "0x.0189P-0", ""}, + {token.FLOAT, "0x1.ffffp+1023", "0x1.ffffp+1023", ""}, + + {token.FLOAT, "0x.", "0x.", "hexadecimal literal has no digits"}, + {token.FLOAT, "0x0.", "0x0.", "hexadecimal mantissa requires a 'p' exponent"}, + {token.FLOAT, "0x.0", "0x.0", "hexadecimal mantissa requires a 'p' exponent"}, + {token.FLOAT, "0x1.1", "0x1.1", "hexadecimal mantissa requires a 'p' exponent"}, + {token.FLOAT, "0x1.1e0", "0x1.1e0", "hexadecimal mantissa requires a 'p' exponent"}, + {token.FLOAT, "0x1.2gp1a", "0x1.2 gp1a", "hexadecimal mantissa requires a 'p' exponent"}, + {token.FLOAT, "0x0p", "0x0p", "exponent has no digits"}, + {token.FLOAT, "0xeP-", "0xeP-", "exponent has no digits"}, + {token.FLOAT, "0x1234PAB", "0x1234P AB", "exponent has no digits"}, + {token.FLOAT, "0x1.2p1a", "0x1.2p1 a", ""}, + + {token.IMAG, "0xf00.bap+12i", "0xf00.bap+12i", ""}, + + // separators + {token.INT, "0b_1000_0001", "0b_1000_0001", ""}, + {token.INT, "0o_600", "0o_600", ""}, + {token.INT, "0_466", "0_466", ""}, + {token.INT, "1_000", "1_000", ""}, + {token.FLOAT, "1_000.000_1", "1_000.000_1", ""}, + {token.IMAG, "10e+1_2_3i", "10e+1_2_3i", ""}, + {token.INT, "0x_f00d", "0x_f00d", ""}, + {token.FLOAT, "0x_f00d.0p1_2", "0x_f00d.0p1_2", ""}, + + {token.INT, "0b__1000", "0b__1000", "'_' must separate successive digits"}, + {token.INT, "0o60___0", "0o60___0", "'_' must separate successive digits"}, + {token.INT, "0466_", "0466_", "'_' must separate successive digits"}, + {token.FLOAT, "1_.", "1_.", "'_' must separate successive digits"}, + {token.FLOAT, "0._1", "0._1", "'_' must separate successive digits"}, + {token.FLOAT, "2.7_e0", "2.7_e0", "'_' must separate successive digits"}, + {token.IMAG, "10e+12_i", "10e+12_i", "'_' must separate successive digits"}, + {token.INT, "0x___0", "0x___0", "'_' must separate successive digits"}, + {token.FLOAT, "0x1.0_p0", "0x1.0_p0", "'_' must separate successive digits"}, + } { + var s Scanner + var err string + s.Init(fset.AddFile("", fset.Base(), len(test.src)), []byte(test.src), func(_ token.Position, msg string) { + if err == "" { + err = msg + } + }, 0) + for i, want := range strings.Split(test.tokens, " ") { + err = "" + _, tok, lit := s.Scan() + + // compute lit where for tokens where lit is not defined + switch tok { + case token.PERIOD: + lit = "." + case token.ADD: + lit = "+" + case token.SUB: + lit = "-" + } + + if i == 0 { + if tok != test.tok { + t.Errorf("%q: got token %s; want %s", test.src, tok, test.tok) + } + if err != test.err { + t.Errorf("%q: got error %q; want %q", test.src, err, test.err) + } + } + + if lit != want { + t.Errorf("%q: got literal %q (%s); want %s", test.src, lit, tok, want) + } + } + + // make sure we read all + _, tok, _ := s.Scan() + if tok == token.SEMICOLON { + _, tok, _ = s.Scan() + } + if tok != token.EOF { + t.Errorf("%q: got %s; want EOF", test.src, tok) + } + } +} diff --git a/src/go/types/check_test.go b/src/go/types/check_test.go index 45e1fcb605..358e7c5cc8 100644 --- a/src/go/types/check_test.go +++ b/src/go/types/check_test.go @@ -88,6 +88,7 @@ var tests = [][]string{ {"testdata/stmt1.src"}, {"testdata/gotos.src"}, {"testdata/labels.src"}, + {"testdata/literals.src"}, {"testdata/issues.src"}, {"testdata/blank.src"}, {"testdata/issue25008b.src", "testdata/issue25008a.src"}, // order (b before a) is crucial! diff --git a/src/go/types/expr.go b/src/go/types/expr.go index 0dc007069f..66d62d6885 100644 --- a/src/go/types/expr.go +++ b/src/go/types/expr.go @@ -655,11 +655,10 @@ func (check *Checker) shift(x, y *operand, e *ast.BinaryExpr, op token.Token) { return } - // spec: "The right operand in a shift expression must have unsigned - // integer type or be an untyped constant representable by a value of - // type uint." + // spec: "The right operand in a shift expression must have integer type + // or be an untyped constant representable by a value of type uint." switch { - case isUnsigned(y.typ): + case isInteger(y.typ): // nothing to do case isUntyped(y.typ): check.convertUntyped(y, Typ[Uint]) @@ -668,21 +667,28 @@ func (check *Checker) shift(x, y *operand, e *ast.BinaryExpr, op token.Token) { return } default: - check.invalidOp(y.pos(), "shift count %s must be unsigned integer", y) + check.invalidOp(y.pos(), "shift count %s must be integer", y) x.mode = invalid return } + var yval constant.Value + if y.mode == constant_ { + // rhs must be an integer value + // (Either it was of an integer type already, or it was + // untyped and successfully converted to a uint above.) + yval = constant.ToInt(y.val) + assert(yval.Kind() == constant.Int) + if constant.Sign(yval) < 0 { + check.invalidOp(y.pos(), "negative shift count %s", y) + x.mode = invalid + return + } + } + if x.mode == constant_ { if y.mode == constant_ { - // rhs must be an integer value - yval := constant.ToInt(y.val) - if yval.Kind() != constant.Int { - check.invalidOp(y.pos(), "shift count %s must be unsigned integer", y) - x.mode = invalid - return - } - // rhs must be within reasonable bounds + // rhs must be within reasonable bounds in constant shifts const shiftBound = 1023 - 1 + 52 // so we can express smallestFloat64 s, ok := constant.Uint64Val(yval) if !ok || s > shiftBound { @@ -741,11 +747,6 @@ func (check *Checker) shift(x, y *operand, e *ast.BinaryExpr, op token.Token) { } } - // constant rhs must be >= 0 - if y.mode == constant_ && constant.Sign(y.val) < 0 { - check.invalidOp(y.pos(), "shift count %s must not be negative", y) - } - // non-constant shift - lhs must be an integer if !isInteger(x.typ) { check.invalidOp(x.pos(), "shifted operand %s must be integer", x) diff --git a/src/go/types/gccgosizes.go b/src/go/types/gccgosizes.go new file mode 100644 index 0000000000..d5c92c6d1d --- /dev/null +++ b/src/go/types/gccgosizes.go @@ -0,0 +1,40 @@ +// 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. + +// This is a copy of the file generated during the gccgo build process. +// Last update 2019-01-22. + +package types + +var gccgoArchSizes = map[string]*StdSizes{ + "386": {4, 4}, + "alpha": {8, 8}, + "amd64": {8, 8}, + "amd64p32": {4, 8}, + "arm": {4, 8}, + "armbe": {4, 8}, + "arm64": {8, 8}, + "arm64be": {8, 8}, + "ia64": {8, 8}, + "m68k": {4, 2}, + "mips": {4, 8}, + "mipsle": {4, 8}, + "mips64": {8, 8}, + "mips64le": {8, 8}, + "mips64p32": {4, 8}, + "mips64p32le": {4, 8}, + "nios2": {4, 8}, + "ppc": {4, 8}, + "ppc64": {8, 8}, + "ppc64le": {8, 8}, + "riscv": {4, 8}, + "riscv64": {8, 8}, + "s390": {4, 8}, + "s390x": {8, 8}, + "sh": {4, 8}, + "shbe": {4, 8}, + "sparc": {4, 8}, + "sparc64": {8, 8}, + "wasm": {8, 8}, +} diff --git a/src/go/types/sizes.go b/src/go/types/sizes.go index f890c30377..6ab6157b82 100644 --- a/src/go/types/sizes.go +++ b/src/go/types/sizes.go @@ -182,10 +182,16 @@ var gcArchSizes = map[string]*StdSizes{ // "386", "arm", "arm64", "amd64", "amd64p32", "mips", "mipsle", // "mips64", "mips64le", "ppc64", "ppc64le", "riscv64", "s390x", "sparc64", "wasm". func SizesFor(compiler, arch string) Sizes { - if compiler != "gc" { + var m map[string]*StdSizes + switch compiler { + case "gc": + m = gcArchSizes + case "gccgo": + m = gccgoArchSizes + default: return nil } - s, ok := gcArchSizes[arch] + s, ok := m[arch] if !ok { return nil } diff --git a/src/go/types/testdata/decls1.src b/src/go/types/testdata/decls1.src index 07405469a4..e6beb78358 100644 --- a/src/go/types/testdata/decls1.src +++ b/src/go/types/testdata/decls1.src @@ -43,7 +43,7 @@ var ( s11 = &v s12 = -(u + *t11) / *&v s13 = a /* ERROR "shifted operand" */ << d - s14 = i << j /* ERROR "must be unsigned" */ + s14 = i << j s18 = math.Pi * 10.0 s19 = s1 /* ERROR "cannot call" */ () s20 = f0 /* ERROR "no value" */ () @@ -62,7 +62,7 @@ var ( t11 *complex64 = &v t12 complex64 = -(u + *t11) / *&v t13 int = a /* ERROR "shifted operand" */ << d - t14 int = i << j /* ERROR "must be unsigned" */ + t14 int = i << j t15 math /* ERROR "not in selector" */ t16 math.xxx /* ERROR "not declared" */ t17 math /* ERROR "not a type" */ .Pi diff --git a/src/go/types/testdata/expr1.src b/src/go/types/testdata/expr1.src index eaaf610b03..4ead815158 100644 --- a/src/go/types/testdata/expr1.src +++ b/src/go/types/testdata/expr1.src @@ -35,8 +35,8 @@ func _(x, y int, z myint) { x = x * y x = x / y x = x % y - x = x << y // ERROR must be unsigned integer - x = x >> y // ERROR must be unsigned integer + x = x << y + x = x >> y z = z + 1 z = z + 1.0 @@ -46,8 +46,8 @@ func _(x, y int, z myint) { z = z /* ERROR mismatched types */ * y z = z /* ERROR mismatched types */ / y z = z /* ERROR mismatched types */ % y - z = z << y // ERROR must be unsigned integer - z = z >> y // ERROR must be unsigned integer + z = z << y + z = z >> y } type myuint uint diff --git a/src/go/types/testdata/literals.src b/src/go/types/testdata/literals.src new file mode 100644 index 0000000000..494a465f48 --- /dev/null +++ b/src/go/types/testdata/literals.src @@ -0,0 +1,111 @@ +// 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. + +// This file tests various representations of literals +// and compares them with literals or constant expressions +// of equal values. + +package literals + +func _() { + // 0-octals + assert(0_123 == 0123) + assert(0123_456 == 0123456) + + // decimals + assert(1_234 == 1234) + assert(1_234_567 == 1234567) + + // hexadecimals + assert(0X_0 == 0) + assert(0X_1234 == 0x1234) + assert(0X_CAFE_f00d == 0xcafef00d) + + // octals + assert(0o0 == 0) + assert(0o1234 == 01234) + assert(0o01234567 == 01234567) + + assert(0O0 == 0) + assert(0O1234 == 01234) + assert(0O01234567 == 01234567) + + assert(0o_0 == 0) + assert(0o_1234 == 01234) + assert(0o0123_4567 == 01234567) + + assert(0O_0 == 0) + assert(0O_1234 == 01234) + assert(0O0123_4567 == 01234567) + + // binaries + assert(0b0 == 0) + assert(0b1011 == 0xb) + assert(0b00101101 == 0x2d) + + assert(0B0 == 0) + assert(0B1011 == 0xb) + assert(0B00101101 == 0x2d) + + assert(0b_0 == 0) + assert(0b10_11 == 0xb) + assert(0b_0010_1101 == 0x2d) + + // decimal floats + assert(1_2_3. == 123.) + assert(0_123. == 123.) + + assert(0_0e0 == 0.) + assert(1_2_3e0 == 123.) + assert(0_123e0 == 123.) + + assert(0e-0_0 == 0.) + assert(1_2_3E+0 == 123.) + assert(0123E1_2_3 == 123e123) + + assert(0.e+1 == 0.) + assert(123.E-1_0 == 123e-10) + assert(01_23.e123 == 123e123) + + assert(.0e-1 == .0) + assert(.123E+10 == .123e10) + assert(.0123E123 == .0123e123) + + assert(1_2_3.123 == 123.123) + assert(0123.01_23 == 123.0123) + + // hexadecimal floats + assert(0x0.p+0 == 0.) + assert(0Xdeadcafe.p-10 == 0xdeadcafe/1024.0) + assert(0x1234.P84 == 0x1234000000000000000000000) + + assert(0x.1p-0 == 1./16) + assert(0X.deadcafep4 == 1.0*0xdeadcafe/0x10000000) + assert(0x.1234P+12 == 1.0*0x1234/0x10) + + assert(0x0p0 == 0.) + assert(0Xdeadcafep+1 == 0x1bd5b95fc) + assert(0x1234P-10 == 0x1234/1024.0) + + assert(0x0.0p0 == 0.) + assert(0Xdead.cafep+1 == 1.0*0x1bd5b95fc/0x10000) + assert(0x12.34P-10 == 1.0*0x1234/0x40000) + + assert(0Xdead_cafep+1 == 0xdeadcafep+1) + assert(0x_1234P-10 == 0x1234p-10) + + assert(0X_dead_cafe.p-10 == 0xdeadcafe.p-10) + assert(0x12_34.P1_2_3 == 0x1234.p123) + + assert(1_234i == 1234i) + assert(1_234_567i == 1234567i) + + assert(0.i == 0i) + assert(123.i == 123i) + assert(0123.i == 123i) + + assert(0.e+1i == 0i) + assert(123.E-1_0i == 123e-10i) + assert(01_23.e123i == 123e123i) +} diff --git a/src/go/types/testdata/shifts.src b/src/go/types/testdata/shifts.src index 52e340ec65..ebc95ba4d7 100644 --- a/src/go/types/testdata/shifts.src +++ b/src/go/types/testdata/shifts.src @@ -10,9 +10,21 @@ func shifts0() { s = 10 _ = 0<<0 _ = 1< + escapes. func cssEscaper(args ...interface{}) string { s, _ := stringify(args...) - var b bytes.Buffer + var b strings.Builder r, w, written := rune(0), 0, 0 for i := 0; i < len(s); i += w { // See comment in htmlEscaper. @@ -168,6 +169,9 @@ func cssEscaper(args ...interface{}) string { default: continue } + if written == 0 { + b.Grow(len(s)) + } b.WriteString(s[written:i]) b.WriteString(repl) written = i + w diff --git a/src/html/template/html.go b/src/html/template/html.go index 2ea5a7d4bc..13a0cd0436 100644 --- a/src/html/template/html.go +++ b/src/html/template/html.go @@ -137,7 +137,7 @@ var htmlNospaceNormReplacementTable = []string{ // htmlReplacer returns s with runes replaced according to replacementTable // and when badRunes is true, certain bad runes are allowed through unescaped. func htmlReplacer(s string, replacementTable []string, badRunes bool) string { - written, b := 0, new(bytes.Buffer) + written, b := 0, new(strings.Builder) r, w := rune(0), 0 for i := 0; i < len(s); i += w { // Cannot use 'for range s' because we need to preserve the width @@ -146,6 +146,9 @@ func htmlReplacer(s string, replacementTable []string, badRunes bool) string { r, w = utf8.DecodeRuneInString(s[i:]) if int(r) < len(replacementTable) { if repl := replacementTable[r]; len(repl) != 0 { + if written == 0 { + b.Grow(len(s)) + } b.WriteString(s[written:i]) b.WriteString(repl) written = i + w @@ -154,6 +157,9 @@ func htmlReplacer(s string, replacementTable []string, badRunes bool) string { // No-op. // IE does not allow these ranges in unquoted attrs. } else if 0xfdd0 <= r && r <= 0xfdef || 0xfff0 <= r && r <= 0xffff { + if written == 0 { + b.Grow(len(s)) + } fmt.Fprintf(b, "%s%x;", s[written:i], r) written = i + w } diff --git a/src/html/template/js.go b/src/html/template/js.go index 872f6786b3..04c7c325db 100644 --- a/src/html/template/js.go +++ b/src/html/template/js.go @@ -187,7 +187,7 @@ func jsValEscaper(args ...interface{}) string { } first, _ := utf8.DecodeRune(b) last, _ := utf8.DecodeLastRune(b) - var buf bytes.Buffer + var buf strings.Builder // Prevent IdentifierNames and NumericLiterals from running into // keywords: in, instanceof, typeof, void pad := isJSIdentPart(first) || isJSIdentPart(last) @@ -217,7 +217,7 @@ func jsValEscaper(args ...interface{}) string { if pad { buf.WriteByte(' ') } - b = buf.Bytes() + return buf.String() } return string(b) } @@ -253,7 +253,7 @@ func jsRegexpEscaper(args ...interface{}) string { // It also replaces runes U+2028 and U+2029 with the raw strings `\u2028` and // `\u2029`. func replace(s string, replacementTable []string) string { - var b bytes.Buffer + var b strings.Builder r, w, written := rune(0), 0, 0 for i := 0; i < len(s); i += w { // See comment in htmlEscaper. @@ -269,6 +269,9 @@ func replace(s string, replacementTable []string) string { default: continue } + if written == 0 { + b.Grow(len(s)) + } b.WriteString(s[written:i]) b.WriteString(repl) written = i + w diff --git a/src/html/template/template_test.go b/src/html/template/template_test.go index 90c5a73ba7..13e6ba406e 100644 --- a/src/html/template/template_test.go +++ b/src/html/template/template_test.go @@ -115,6 +115,12 @@ func TestRedefineOtherParsers(t *testing.T) { } } +func TestNumbers(t *testing.T) { + c := newTestCase(t) + c.mustParse(c.root, `{{print 1_2.3_4}} {{print 0x0_1.e_0p+02}}`) + c.mustExecute(c.root, nil, "12.34 7.5") +} + type testCase struct { t *testing.T root *Template diff --git a/src/internal/xcoff/file.go b/src/internal/xcoff/file.go index 0923b9fcf3..66b5391d58 100644 --- a/src/internal/xcoff/file.go +++ b/src/internal/xcoff/file.go @@ -334,8 +334,8 @@ func NewFile(r io.ReaderAt) (*File, error) { // If this symbol is a function, it must retrieve its size from // its AUX_FCN entry. - // It can happend that a function symbol doesn't have any AUX_FCN. - // In this case, needAuxFcn is false and their size will be set to 0 + // It can happen that a function symbol doesn't have any AUX_FCN. + // In this case, needAuxFcn is false and their size will be set to 0. if needAuxFcn { switch f.TargetMachine { case U802TOCMAGIC: diff --git a/src/io/multi_test.go b/src/io/multi_test.go index 9cbab4d211..d34794a367 100644 --- a/src/io/multi_test.go +++ b/src/io/multi_test.go @@ -77,7 +77,7 @@ func TestMultiWriter_String(t *testing.T) { testMultiWriter(t, new(bytes.Buffer)) } -// test that a multiWriter.WriteString calls results in at most 1 allocation, +// Test that a multiWriter.WriteString calls results in at most 1 allocation, // even if multiple targets don't support WriteString. func TestMultiWriter_WriteStringSingleAlloc(t *testing.T) { var sink1, sink2 bytes.Buffer @@ -149,7 +149,7 @@ func (f writerFunc) Write(p []byte) (int, error) { return f(p) } -// Test that MultiWriter properly flattens chained multiWriters, +// Test that MultiWriter properly flattens chained multiWriters. func TestMultiWriterSingleChainFlatten(t *testing.T) { pc := make([]uintptr, 1000) // 1000 should fit the full stack n := runtime.Callers(0, pc) diff --git a/src/iostest.bash b/src/iostest.bash index b402ff0792..1fc1666bae 100755 --- a/src/iostest.bash +++ b/src/iostest.bash @@ -56,14 +56,10 @@ export PATH=$GOROOT/bin:$PATH export CGO_ENABLED=1 export CC_FOR_TARGET=$GOROOT/misc/ios/clangwrap.sh -# Run the build for the host bootstrap, so we can build go_darwin_arm_exec. +# Run the build for the host bootstrap, so we can build detect.go. # Also lets us fail early before the (slow) ios-deploy if the build is broken. ./make.bash -GOOS=$GOHOSTOS GOARCH=$GOHOSTARCH go build \ - -o ../bin/go_darwin_${GOARCH}_exec \ - ../misc/ios/go_darwin_arm_exec.go - if [ "$GOIOS_DEV_ID" = "" ]; then echo "detecting iOS development identity" eval $(GOOS=$GOHOSTOS GOARCH=$GOHOSTARCH go run ../misc/ios/detect.go) diff --git a/src/math/big/floatconv.go b/src/math/big/floatconv.go index 95d1bf84e2..5cc9e24f4c 100644 --- a/src/math/big/floatconv.go +++ b/src/math/big/floatconv.go @@ -224,7 +224,7 @@ func (z *Float) pow5(n uint64) *Float { // sign = "+" | "-" . // prefix = "0" ( "x" | "X" | "b" | "B" ) . // mantissa = digits | digits "." [ digits ] | "." digits . -// exponent = ( "E" | "e" | "p" ) [ sign ] digits . +// exponent = ( "e" | "E" | "p" | "P" ) [ sign ] digits . // digits = digit { digit } . // digit = "0" ... "9" | "a" ... "z" | "A" ... "Z" . // infinity = [ sign ] ( "inf" | "Inf" ) . @@ -238,7 +238,7 @@ func (z *Float) pow5(n uint64) *Float { // The octal prefix "0" is not supported (a leading "0" is simply // considered a "0"). // -// A "p" exponent indicates a binary (rather then decimal) exponent; +// A "p" or "P" exponent indicates a binary (rather then decimal) exponent; // for instance "0x1.fffffffffffffp1023" (using base 0) represents the // maximum float64 value. For hexadecimal mantissae, the exponent must // be binary, if present (an "e" or "E" exponent indicator cannot be diff --git a/src/math/big/floatconv_test.go b/src/math/big/floatconv_test.go index 269e2652e8..768943b902 100644 --- a/src/math/big/floatconv_test.go +++ b/src/math/big/floatconv_test.go @@ -108,6 +108,7 @@ func TestFloatSetFloat64String(t *testing.T) { {"0b001p-3", 0.125}, {"0b.001p3", 1}, {"0b0.01p2", 1}, + {"0b0.01P+2", 1}, // hexadecimal mantissa and exponent {"0x0", 0}, @@ -117,6 +118,7 @@ func TestFloatSetFloat64String(t *testing.T) { {"0xff", 255}, {"0X.8p1", 1}, {"-0X0.00008p16", -0.5}, + {"-0X0.00008P+16", -0.5}, {"0x0.0000000000001p-1022", math.SmallestNonzeroFloat64}, {"0x1.fffffffffffffp1023", math.MaxFloat64}, } { @@ -266,7 +268,7 @@ func TestFloat64Text(t *testing.T) { {32, 'g', -1, "32"}, {32, 'g', 0, "3e+01"}, - {100, 'x', -1, "%x"}, + {100, 'x', -1, "0x1.9p+06"}, // {math.NaN(), 'g', -1, "NaN"}, // Float doesn't support NaNs // {-math.NaN(), 'g', -1, "NaN"}, // Float doesn't support NaNs @@ -337,115 +339,166 @@ func actualPrec(x float64) uint { } func TestFloatText(t *testing.T) { + const defaultRound = ^RoundingMode(0) + for _, test := range []struct { x string + round RoundingMode prec uint format byte digits int want string }{ - {"0", 10, 'f', 0, "0"}, - {"-0", 10, 'f', 0, "-0"}, - {"1", 10, 'f', 0, "1"}, - {"-1", 10, 'f', 0, "-1"}, + {"0", defaultRound, 10, 'f', 0, "0"}, + {"-0", defaultRound, 10, 'f', 0, "-0"}, + {"1", defaultRound, 10, 'f', 0, "1"}, + {"-1", defaultRound, 10, 'f', 0, "-1"}, - {"1.459", 100, 'e', 0, "1e+00"}, - {"2.459", 100, 'e', 1, "2.5e+00"}, - {"3.459", 100, 'e', 2, "3.46e+00"}, - {"4.459", 100, 'e', 3, "4.459e+00"}, - {"5.459", 100, 'e', 4, "5.4590e+00"}, + {"1.459", defaultRound, 100, 'e', 0, "1e+00"}, + {"2.459", defaultRound, 100, 'e', 1, "2.5e+00"}, + {"3.459", defaultRound, 100, 'e', 2, "3.46e+00"}, + {"4.459", defaultRound, 100, 'e', 3, "4.459e+00"}, + {"5.459", defaultRound, 100, 'e', 4, "5.4590e+00"}, - {"1.459", 100, 'E', 0, "1E+00"}, - {"2.459", 100, 'E', 1, "2.5E+00"}, - {"3.459", 100, 'E', 2, "3.46E+00"}, - {"4.459", 100, 'E', 3, "4.459E+00"}, - {"5.459", 100, 'E', 4, "5.4590E+00"}, + {"1.459", defaultRound, 100, 'E', 0, "1E+00"}, + {"2.459", defaultRound, 100, 'E', 1, "2.5E+00"}, + {"3.459", defaultRound, 100, 'E', 2, "3.46E+00"}, + {"4.459", defaultRound, 100, 'E', 3, "4.459E+00"}, + {"5.459", defaultRound, 100, 'E', 4, "5.4590E+00"}, - {"1.459", 100, 'f', 0, "1"}, - {"2.459", 100, 'f', 1, "2.5"}, - {"3.459", 100, 'f', 2, "3.46"}, - {"4.459", 100, 'f', 3, "4.459"}, - {"5.459", 100, 'f', 4, "5.4590"}, + {"1.459", defaultRound, 100, 'f', 0, "1"}, + {"2.459", defaultRound, 100, 'f', 1, "2.5"}, + {"3.459", defaultRound, 100, 'f', 2, "3.46"}, + {"4.459", defaultRound, 100, 'f', 3, "4.459"}, + {"5.459", defaultRound, 100, 'f', 4, "5.4590"}, - {"1.459", 100, 'g', 0, "1"}, - {"2.459", 100, 'g', 1, "2"}, - {"3.459", 100, 'g', 2, "3.5"}, - {"4.459", 100, 'g', 3, "4.46"}, - {"5.459", 100, 'g', 4, "5.459"}, + {"1.459", defaultRound, 100, 'g', 0, "1"}, + {"2.459", defaultRound, 100, 'g', 1, "2"}, + {"3.459", defaultRound, 100, 'g', 2, "3.5"}, + {"4.459", defaultRound, 100, 'g', 3, "4.46"}, + {"5.459", defaultRound, 100, 'g', 4, "5.459"}, - {"1459", 53, 'g', 0, "1e+03"}, - {"2459", 53, 'g', 1, "2e+03"}, - {"3459", 53, 'g', 2, "3.5e+03"}, - {"4459", 53, 'g', 3, "4.46e+03"}, - {"5459", 53, 'g', 4, "5459"}, + {"1459", defaultRound, 53, 'g', 0, "1e+03"}, + {"2459", defaultRound, 53, 'g', 1, "2e+03"}, + {"3459", defaultRound, 53, 'g', 2, "3.5e+03"}, + {"4459", defaultRound, 53, 'g', 3, "4.46e+03"}, + {"5459", defaultRound, 53, 'g', 4, "5459"}, - {"1459", 53, 'G', 0, "1E+03"}, - {"2459", 53, 'G', 1, "2E+03"}, - {"3459", 53, 'G', 2, "3.5E+03"}, - {"4459", 53, 'G', 3, "4.46E+03"}, - {"5459", 53, 'G', 4, "5459"}, + {"1459", defaultRound, 53, 'G', 0, "1E+03"}, + {"2459", defaultRound, 53, 'G', 1, "2E+03"}, + {"3459", defaultRound, 53, 'G', 2, "3.5E+03"}, + {"4459", defaultRound, 53, 'G', 3, "4.46E+03"}, + {"5459", defaultRound, 53, 'G', 4, "5459"}, - {"3", 10, 'e', 40, "3.0000000000000000000000000000000000000000e+00"}, - {"3", 10, 'f', 40, "3.0000000000000000000000000000000000000000"}, - {"3", 10, 'g', 40, "3"}, + {"3", defaultRound, 10, 'e', 40, "3.0000000000000000000000000000000000000000e+00"}, + {"3", defaultRound, 10, 'f', 40, "3.0000000000000000000000000000000000000000"}, + {"3", defaultRound, 10, 'g', 40, "3"}, - {"3e40", 100, 'e', 40, "3.0000000000000000000000000000000000000000e+40"}, - {"3e40", 100, 'f', 4, "30000000000000000000000000000000000000000.0000"}, - {"3e40", 100, 'g', 40, "3e+40"}, + {"3e40", defaultRound, 100, 'e', 40, "3.0000000000000000000000000000000000000000e+40"}, + {"3e40", defaultRound, 100, 'f', 4, "30000000000000000000000000000000000000000.0000"}, + {"3e40", defaultRound, 100, 'g', 40, "3e+40"}, // make sure "stupid" exponents don't stall the machine - {"1e1000000", 64, 'p', 0, "0x.88b3a28a05eade3ap+3321929"}, - {"1e646456992", 64, 'p', 0, "0x.e883a0c5c8c7c42ap+2147483644"}, - {"1e646456993", 64, 'p', 0, "+Inf"}, - {"1e1000000000", 64, 'p', 0, "+Inf"}, - {"1e-1000000", 64, 'p', 0, "0x.efb4542cc8ca418ap-3321928"}, - {"1e-646456993", 64, 'p', 0, "0x.e17c8956983d9d59p-2147483647"}, - {"1e-646456994", 64, 'p', 0, "0"}, - {"1e-1000000000", 64, 'p', 0, "0"}, + {"1e1000000", defaultRound, 64, 'p', 0, "0x.88b3a28a05eade3ap+3321929"}, + {"1e646456992", defaultRound, 64, 'p', 0, "0x.e883a0c5c8c7c42ap+2147483644"}, + {"1e646456993", defaultRound, 64, 'p', 0, "+Inf"}, + {"1e1000000000", defaultRound, 64, 'p', 0, "+Inf"}, + {"1e-1000000", defaultRound, 64, 'p', 0, "0x.efb4542cc8ca418ap-3321928"}, + {"1e-646456993", defaultRound, 64, 'p', 0, "0x.e17c8956983d9d59p-2147483647"}, + {"1e-646456994", defaultRound, 64, 'p', 0, "0"}, + {"1e-1000000000", defaultRound, 64, 'p', 0, "0"}, // minimum and maximum values - {"1p2147483646", 64, 'p', 0, "0x.8p+2147483647"}, - {"0x.8p2147483647", 64, 'p', 0, "0x.8p+2147483647"}, - {"0x.8p-2147483647", 64, 'p', 0, "0x.8p-2147483647"}, - {"1p-2147483649", 64, 'p', 0, "0x.8p-2147483648"}, + {"1p2147483646", defaultRound, 64, 'p', 0, "0x.8p+2147483647"}, + {"0x.8p2147483647", defaultRound, 64, 'p', 0, "0x.8p+2147483647"}, + {"0x.8p-2147483647", defaultRound, 64, 'p', 0, "0x.8p-2147483647"}, + {"1p-2147483649", defaultRound, 64, 'p', 0, "0x.8p-2147483648"}, // TODO(gri) need tests for actual large Floats - {"0", 53, 'b', 0, "0"}, - {"-0", 53, 'b', 0, "-0"}, - {"1.0", 53, 'b', 0, "4503599627370496p-52"}, - {"-1.0", 53, 'b', 0, "-4503599627370496p-52"}, - {"4503599627370496", 53, 'b', 0, "4503599627370496p+0"}, + {"0", defaultRound, 53, 'b', 0, "0"}, + {"-0", defaultRound, 53, 'b', 0, "-0"}, + {"1.0", defaultRound, 53, 'b', 0, "4503599627370496p-52"}, + {"-1.0", defaultRound, 53, 'b', 0, "-4503599627370496p-52"}, + {"4503599627370496", defaultRound, 53, 'b', 0, "4503599627370496p+0"}, // issue 9939 - {"3", 350, 'b', 0, "1720123961992553633708115671476565205597423741876210842803191629540192157066363606052513914832594264915968p-348"}, - {"03", 350, 'b', 0, "1720123961992553633708115671476565205597423741876210842803191629540192157066363606052513914832594264915968p-348"}, - {"3.", 350, 'b', 0, "1720123961992553633708115671476565205597423741876210842803191629540192157066363606052513914832594264915968p-348"}, - {"3.0", 350, 'b', 0, "1720123961992553633708115671476565205597423741876210842803191629540192157066363606052513914832594264915968p-348"}, - {"3.00", 350, 'b', 0, "1720123961992553633708115671476565205597423741876210842803191629540192157066363606052513914832594264915968p-348"}, - {"3.000", 350, 'b', 0, "1720123961992553633708115671476565205597423741876210842803191629540192157066363606052513914832594264915968p-348"}, + {"3", defaultRound, 350, 'b', 0, "1720123961992553633708115671476565205597423741876210842803191629540192157066363606052513914832594264915968p-348"}, + {"03", defaultRound, 350, 'b', 0, "1720123961992553633708115671476565205597423741876210842803191629540192157066363606052513914832594264915968p-348"}, + {"3.", defaultRound, 350, 'b', 0, "1720123961992553633708115671476565205597423741876210842803191629540192157066363606052513914832594264915968p-348"}, + {"3.0", defaultRound, 350, 'b', 0, "1720123961992553633708115671476565205597423741876210842803191629540192157066363606052513914832594264915968p-348"}, + {"3.00", defaultRound, 350, 'b', 0, "1720123961992553633708115671476565205597423741876210842803191629540192157066363606052513914832594264915968p-348"}, + {"3.000", defaultRound, 350, 'b', 0, "1720123961992553633708115671476565205597423741876210842803191629540192157066363606052513914832594264915968p-348"}, - {"3", 350, 'p', 0, "0x.cp+2"}, - {"03", 350, 'p', 0, "0x.cp+2"}, - {"3.", 350, 'p', 0, "0x.cp+2"}, - {"3.0", 350, 'p', 0, "0x.cp+2"}, - {"3.00", 350, 'p', 0, "0x.cp+2"}, - {"3.000", 350, 'p', 0, "0x.cp+2"}, + {"3", defaultRound, 350, 'p', 0, "0x.cp+2"}, + {"03", defaultRound, 350, 'p', 0, "0x.cp+2"}, + {"3.", defaultRound, 350, 'p', 0, "0x.cp+2"}, + {"3.0", defaultRound, 350, 'p', 0, "0x.cp+2"}, + {"3.00", defaultRound, 350, 'p', 0, "0x.cp+2"}, + {"3.000", defaultRound, 350, 'p', 0, "0x.cp+2"}, - {"0", 64, 'p', 0, "0"}, - {"-0", 64, 'p', 0, "-0"}, - {"1024.0", 64, 'p', 0, "0x.8p+11"}, - {"-1024.0", 64, 'p', 0, "-0x.8p+11"}, + {"0", defaultRound, 64, 'p', 0, "0"}, + {"-0", defaultRound, 64, 'p', 0, "-0"}, + {"1024.0", defaultRound, 64, 'p', 0, "0x.8p+11"}, + {"-1024.0", defaultRound, 64, 'p', 0, "-0x.8p+11"}, - // unsupported format - {"3.14", 64, 'x', 0, "%x"}, - {"-3.14", 64, 'x', 0, "%x"}, + {"0", defaultRound, 64, 'x', -1, "0x0p+00"}, + {"0", defaultRound, 64, 'x', 0, "0x0p+00"}, + {"0", defaultRound, 64, 'x', 1, "0x0.0p+00"}, + {"0", defaultRound, 64, 'x', 5, "0x0.00000p+00"}, + {"3.25", defaultRound, 64, 'x', 0, "0x1p+02"}, + {"-3.25", defaultRound, 64, 'x', 0, "-0x1p+02"}, + {"3.25", defaultRound, 64, 'x', 1, "0x1.ap+01"}, + {"-3.25", defaultRound, 64, 'x', 1, "-0x1.ap+01"}, + {"3.25", defaultRound, 64, 'x', -1, "0x1.ap+01"}, + {"-3.25", defaultRound, 64, 'x', -1, "-0x1.ap+01"}, + {"1024.0", defaultRound, 64, 'x', 0, "0x1p+10"}, + {"-1024.0", defaultRound, 64, 'x', 0, "-0x1p+10"}, + {"1024.0", defaultRound, 64, 'x', 5, "0x1.00000p+10"}, + {"8191.0", defaultRound, 53, 'x', -1, "0x1.fffp+12"}, + {"8191.5", defaultRound, 53, 'x', -1, "0x1.fff8p+12"}, + {"8191.53125", defaultRound, 53, 'x', -1, "0x1.fff88p+12"}, + {"8191.53125", defaultRound, 53, 'x', 4, "0x1.fff8p+12"}, + {"8191.53125", defaultRound, 53, 'x', 3, "0x1.000p+13"}, + {"8191.53125", defaultRound, 53, 'x', 0, "0x1p+13"}, + {"8191.533203125", defaultRound, 53, 'x', -1, "0x1.fff888p+12"}, + {"8191.533203125", defaultRound, 53, 'x', 5, "0x1.fff88p+12"}, + {"8191.533203125", defaultRound, 53, 'x', 4, "0x1.fff9p+12"}, + + {"8191.53125", defaultRound, 53, 'x', -1, "0x1.fff88p+12"}, + {"8191.53125", ToNearestEven, 53, 'x', 5, "0x1.fff88p+12"}, + {"8191.53125", ToNearestAway, 53, 'x', 5, "0x1.fff88p+12"}, + {"8191.53125", ToZero, 53, 'x', 5, "0x1.fff88p+12"}, + {"8191.53125", AwayFromZero, 53, 'x', 5, "0x1.fff88p+12"}, + {"8191.53125", ToNegativeInf, 53, 'x', 5, "0x1.fff88p+12"}, + {"8191.53125", ToPositiveInf, 53, 'x', 5, "0x1.fff88p+12"}, + + {"8191.53125", defaultRound, 53, 'x', 4, "0x1.fff8p+12"}, + {"8191.53125", defaultRound, 53, 'x', 3, "0x1.000p+13"}, + {"8191.53125", defaultRound, 53, 'x', 0, "0x1p+13"}, + {"8191.533203125", defaultRound, 53, 'x', -1, "0x1.fff888p+12"}, + {"8191.533203125", defaultRound, 53, 'x', 6, "0x1.fff888p+12"}, + {"8191.533203125", defaultRound, 53, 'x', 5, "0x1.fff88p+12"}, + {"8191.533203125", defaultRound, 53, 'x', 4, "0x1.fff9p+12"}, + + {"8191.53125", ToNearestEven, 53, 'x', 4, "0x1.fff8p+12"}, + {"8191.53125", ToNearestAway, 53, 'x', 4, "0x1.fff9p+12"}, + {"8191.53125", ToZero, 53, 'x', 4, "0x1.fff8p+12"}, + {"8191.53125", ToZero, 53, 'x', 2, "0x1.ffp+12"}, + {"8191.53125", AwayFromZero, 53, 'x', 4, "0x1.fff9p+12"}, + {"8191.53125", ToNegativeInf, 53, 'x', 4, "0x1.fff8p+12"}, + {"-8191.53125", ToNegativeInf, 53, 'x', 4, "-0x1.fff9p+12"}, + {"8191.53125", ToPositiveInf, 53, 'x', 4, "0x1.fff9p+12"}, + {"-8191.53125", ToPositiveInf, 53, 'x', 4, "-0x1.fff8p+12"}, } { f, _, err := ParseFloat(test.x, 0, test.prec, ToNearestEven) if err != nil { t.Errorf("%v: %s", test, err) continue } + if test.round != defaultRound { + f.SetMode(test.round) + } got := f.Text(test.format, test.digits) if got != test.want { @@ -456,7 +509,7 @@ func TestFloatText(t *testing.T) { // ('p' format is not supported by strconv.FormatFloat, // and its output for 0.0 prints a biased exponent value // as in 0p-1074 which makes no sense to emulate here) - if test.prec == 53 && test.format != 'p' && f.Sign() != 0 { + if test.prec == 53 && test.format != 'p' && f.Sign() != 0 && (test.round == ToNearestEven || test.round == defaultRound) { f64, acc := f.Float64() if acc != Exact { t.Errorf("%v: expected exact conversion to float64", test) diff --git a/src/math/big/ftoa.go b/src/math/big/ftoa.go index d2a85886c7..6cae63ed09 100644 --- a/src/math/big/ftoa.go +++ b/src/math/big/ftoa.go @@ -22,24 +22,28 @@ import ( // 'f' -ddddd.dddd, no exponent // 'g' like 'e' for large exponents, like 'f' otherwise // 'G' like 'E' for large exponents, like 'f' otherwise -// 'b' -ddddddp±dd, binary exponent -// 'p' -0x.dddp±dd, binary exponent, hexadecimal mantissa +// 'x' -0xd.dddddp±dd, hexadecimal mantissa, decimal power of two exponent +// 'p' -0x.dddp±dd, hexadecimal mantissa, decimal power of two exponent (non-standard) +// 'b' -ddddddp±dd, decimal mantissa, decimal power of two exponent (non-standard) // -// For the binary exponent formats, the mantissa is printed in normalized form: +// For the power-of-two exponent formats, the mantissa is printed in normalized form: // -// 'b' decimal integer mantissa using x.Prec() bits, or -0 -// 'p' hexadecimal fraction with 0.5 <= 0.mantissa < 1.0, or -0 +// 'x' hexadecimal mantissa in [1, 2), or 0 +// 'p' hexadecimal mantissa in [½, 1), or 0 +// 'b' decimal integer mantissa using x.Prec() bits, or 0 +// +// Note that the 'x' form is the one used by most other languages and libraries. // // If format is a different character, Text returns a "%" followed by the // unrecognized format character. // // The precision prec controls the number of digits (excluding the exponent) -// printed by the 'e', 'E', 'f', 'g', and 'G' formats. For 'e', 'E', and 'f' -// it is the number of digits after the decimal point. For 'g' and 'G' it is -// the total number of digits. A negative precision selects the smallest -// number of decimal digits necessary to identify the value x uniquely using -// x.Prec() mantissa bits. -// The prec value is ignored for the 'b' or 'p' format. +// printed by the 'e', 'E', 'f', 'g', 'G', and 'x' formats. +// For 'e', 'E', 'f', and 'x', it is the number of digits after the decimal point. +// For 'g' and 'G' it is the total number of digits. A negative precision selects +// the smallest number of decimal digits necessary to identify the value x uniquely +// using x.Prec() mantissa bits. +// The prec value is ignored for the 'b' and 'p' formats. func (x *Float) Text(format byte, prec int) string { cap := 10 // TODO(gri) determine a good/better value here if prec > 0 { @@ -76,6 +80,8 @@ func (x *Float) Append(buf []byte, fmt byte, prec int) []byte { return x.fmtB(buf) case 'p': return x.fmtP(buf) + case 'x': + return x.fmtX(buf, prec) } // Algorithm: @@ -308,6 +314,7 @@ func fmtF(buf []byte, prec int, d decimal) []byte { // The mantissa is normalized such that is uses x.Prec() bits in binary // representation. // The sign of x is ignored, and x must not be an Inf. +// (The caller handles Inf before invoking fmtB.) func (x *Float) fmtB(buf []byte) []byte { if x.form == zero { return append(buf, '0') @@ -336,11 +343,80 @@ func (x *Float) fmtB(buf []byte) []byte { return strconv.AppendInt(buf, e, 10) } +// fmtX appends the string of x in the format "0x1." mantissa "p" exponent +// with a hexadecimal mantissa and a binary exponent, or "0x0p0" if x is zero, +// and returns the extended buffer. +// A non-zero mantissa is normalized such that 1.0 <= mantissa < 2.0. +// The sign of x is ignored, and x must not be an Inf. +// (The caller handles Inf before invoking fmtX.) +func (x *Float) fmtX(buf []byte, prec int) []byte { + if x.form == zero { + buf = append(buf, "0x0"...) + if prec > 0 { + buf = append(buf, '.') + for i := 0; i < prec; i++ { + buf = append(buf, '0') + } + } + buf = append(buf, "p+00"...) + return buf + } + + if debugFloat && x.form != finite { + panic("non-finite float") + } + + // round mantissa to n bits + var n uint + if prec < 0 { + n = 1 + (x.MinPrec()-1+3)/4*4 // round MinPrec up to 1 mod 4 + } else { + n = 1 + 4*uint(prec) + } + // n%4 == 1 + x = new(Float).SetPrec(n).SetMode(x.mode).Set(x) + + // adjust mantissa to use exactly n bits + m := x.mant + switch w := uint(len(x.mant)) * _W; { + case w < n: + m = nat(nil).shl(m, n-w) + case w > n: + m = nat(nil).shr(m, w-n) + } + exp := x.exp - 1 + + hm := m.utoa(16) + if debugFloat && hm[0] != '1' { + panic("incorrect mantissa: " + string(hm)) + } + buf = append(buf, "0x1"...) + if len(hm) > 1 { + buf = append(buf, '.') + buf = append(buf, hm[1:]...) + } + + buf = append(buf, 'p') + exp64 := int64(exp) + if exp64 >= 0 { + buf = append(buf, '+') + } else { + exp64 = -exp64 + buf = append(buf, '-') + } + // Force at least two exponent digits, to match fmt. + if exp64 < 10 { + buf = append(buf, '0') + } + return strconv.AppendInt(buf, exp64, 10) +} + // fmtP appends the string of x in the format "0x." mantissa "p" exponent // with a hexadecimal mantissa and a binary exponent, or "0" if x is zero, // and returns the extended buffer. // The mantissa is normalized such that 0.5 <= 0.mantissa < 1.0. // The sign of x is ignored, and x must not be an Inf. +// (The caller handles Inf before invoking fmtP.) func (x *Float) fmtP(buf []byte) []byte { if x.form == zero { return append(buf, '0') @@ -380,7 +456,7 @@ var _ fmt.Formatter = &floatZero // *Float must implement fmt.Formatter // Format implements fmt.Formatter. It accepts all the regular // formats for floating-point numbers ('b', 'e', 'E', 'f', 'F', -// 'g', 'G') as well as 'p' and 'v'. See (*Float).Text for the +// 'g', 'G', 'x') as well as 'p' and 'v'. See (*Float).Text for the // interpretation of 'p'. The 'v' format is handled like 'g'. // Format also supports specification of the minimum precision // in digits, the output field width, as well as the format flags @@ -394,7 +470,7 @@ func (x *Float) Format(s fmt.State, format rune) { } switch format { - case 'e', 'E', 'f', 'b', 'p': + case 'e', 'E', 'f', 'b', 'p', 'x': // nothing to do case 'F': // (*Float).Text doesn't support 'F'; handle like 'f' diff --git a/src/math/big/int.go b/src/math/big/int.go index dab9a5cc0f..8c1a54a9c6 100644 --- a/src/math/big/int.go +++ b/src/math/big/int.go @@ -700,15 +700,21 @@ func (z *Int) lehmerGCD(x, y, a, b *Int) *Int { } } - if x != nil { - *x = *Ua + if y != nil { + // avoid aliasing b needed in the division below + if y == b { + B.Set(b) + } else { + B = b + } + // y = (z - a*x)/b + y.Mul(a, Ua) // y can safely alias a + y.Sub(A, y) + y.Div(y, B) } - if y != nil { - // y = (z - a*x)/b - y.Mul(a, Ua) - y.Sub(A, y) - y.Div(y, b) + if x != nil { + *x = *Ua } *z = *A diff --git a/src/math/big/int_test.go b/src/math/big/int_test.go index 7ef2b3907f..48d08d0e7e 100644 --- a/src/math/big/int_test.go +++ b/src/math/big/int_test.go @@ -760,9 +760,6 @@ var gcdTests = []struct { {"935", "-3", "8", "64515", "24310"}, {"935000000000000000", "-3", "8", "64515000000000000000", "24310000000000000000"}, {"1", "-221", "22059940471369027483332068679400581064239780177629666810348940098015901108344", "98920366548084643601728869055592650835572950932266967461790948584315647051443", "991"}, - - // test early exit (after one Euclidean iteration) in binaryGCD - {"1", "", "", "1", "98920366548084643601728869055592650835572950932266967461790948584315647051443"}, } func testGcd(t *testing.T, d, x, y, a, b *Int) { @@ -793,6 +790,12 @@ func testGcd(t *testing.T, d, x, y, a, b *Int) { if a2.Cmp(d) != 0 { t.Errorf("aliased z = a GCD(%s, %s, %s, %s): got d = %s, want %s", x, y, a, b, a2, d) } + if x != nil && X.Cmp(x) != 0 { + t.Errorf("aliased z = a GCD(%s, %s, %s, %s): got x = %s, want %s", x, y, a, b, X, x) + } + if y != nil && Y.Cmp(y) != 0 { + t.Errorf("aliased z = a GCD(%s, %s, %s, %s): got y = %s, want %s", x, y, a, b, Y, y) + } a2 = new(Int).Set(a) b2 = new(Int).Set(b) @@ -800,6 +803,38 @@ func testGcd(t *testing.T, d, x, y, a, b *Int) { if b2.Cmp(d) != 0 { t.Errorf("aliased z = b GCD(%s, %s, %s, %s): got d = %s, want %s", x, y, a, b, b2, d) } + if x != nil && X.Cmp(x) != 0 { + t.Errorf("aliased z = b GCD(%s, %s, %s, %s): got x = %s, want %s", x, y, a, b, X, x) + } + if y != nil && Y.Cmp(y) != 0 { + t.Errorf("aliased z = b GCD(%s, %s, %s, %s): got y = %s, want %s", x, y, a, b, Y, y) + } + + a2 = new(Int).Set(a) + b2 = new(Int).Set(b) + D = new(Int).GCD(a2, b2, a2, b2) // x = a, y = b + if D.Cmp(d) != 0 { + t.Errorf("aliased x = a, y = b GCD(%s, %s, %s, %s): got d = %s, want %s", x, y, a, b, D, d) + } + if x != nil && a2.Cmp(x) != 0 { + t.Errorf("aliased x = a, y = b GCD(%s, %s, %s, %s): got x = %s, want %s", x, y, a, b, a2, x) + } + if y != nil && b2.Cmp(y) != 0 { + t.Errorf("aliased x = a, y = b GCD(%s, %s, %s, %s): got y = %s, want %s", x, y, a, b, b2, y) + } + + a2 = new(Int).Set(a) + b2 = new(Int).Set(b) + D = new(Int).GCD(b2, a2, a2, b2) // x = b, y = a + if D.Cmp(d) != 0 { + t.Errorf("aliased x = b, y = a GCD(%s, %s, %s, %s): got d = %s, want %s", x, y, a, b, D, d) + } + if x != nil && b2.Cmp(x) != 0 { + t.Errorf("aliased x = b, y = a GCD(%s, %s, %s, %s): got x = %s, want %s", x, y, a, b, b2, x) + } + if y != nil && a2.Cmp(y) != 0 { + t.Errorf("aliased x = b, y = a GCD(%s, %s, %s, %s): got y = %s, want %s", x, y, a, b, a2, y) + } } func TestGcd(t *testing.T) { diff --git a/src/math/big/intconv.go b/src/math/big/intconv.go index 6cca827c8e..65174c5018 100644 --- a/src/math/big/intconv.go +++ b/src/math/big/intconv.go @@ -50,8 +50,9 @@ func writeMultiple(s fmt.State, text string, count int) { var _ fmt.Formatter = intOne // *Int must implement fmt.Formatter // Format implements fmt.Formatter. It accepts the formats -// 'b' (binary), 'o' (octal), 'd' (decimal), 'x' (lowercase -// hexadecimal), and 'X' (uppercase hexadecimal). +// 'b' (binary), 'o' (octal with 0 prefix), 'O' (octal with 0o prefix), +// 'd' (decimal), 'x' (lowercase hexadecimal), and +// 'X' (uppercase hexadecimal). // Also supported are the full suite of package fmt's format // flags for integral types, including '+' and ' ' for sign // control, '#' for leading zero in octal and for hexadecimal, @@ -66,7 +67,7 @@ func (x *Int) Format(s fmt.State, ch rune) { switch ch { case 'b': base = 2 - case 'o': + case 'o', 'O': base = 8 case 'd', 's', 'v': base = 10 @@ -98,6 +99,8 @@ func (x *Int) Format(s fmt.State, ch rune) { prefix := "" if s.Flag('#') { switch ch { + case 'b': // binary + prefix = "0b" case 'o': // octal prefix = "0" case 'x': // hexadecimal @@ -106,6 +109,9 @@ func (x *Int) Format(s fmt.State, ch rune) { prefix = "0X" } } + if ch == 'O' { + prefix = "0o" + } digits := x.abs.utoa(base) if ch == 'X' { diff --git a/src/math/big/intconv_test.go b/src/math/big/intconv_test.go index 2e01ee327d..d23a3e2beb 100644 --- a/src/math/big/intconv_test.go +++ b/src/math/big/intconv_test.go @@ -214,8 +214,12 @@ var formatTests = []struct { {"10", "%y", "%!y(big.Int=10)"}, {"-10", "%y", "%!y(big.Int=-10)"}, - {"10", "%#b", "1010"}, + {"10", "%#b", "0b1010"}, {"10", "%#o", "012"}, + {"10", "%O", "0o12"}, + {"-10", "%#b", "-0b1010"}, + {"-10", "%#o", "-012"}, + {"-10", "%O", "-0o12"}, {"10", "%#d", "10"}, {"10", "%#v", "10"}, {"10", "%#x", "0xa"}, diff --git a/src/math/big/ratconv.go b/src/math/big/ratconv.go index 5656280e84..bd2509f168 100644 --- a/src/math/big/ratconv.go +++ b/src/math/big/ratconv.go @@ -130,10 +130,10 @@ func (z *Rat) SetString(s string) (*Rat, bool) { } // scanExponent scans the longest possible prefix of r representing a decimal -// ('e', 'E') or binary ('p') exponent, if any. It returns the exponent, the -// exponent base (10 or 2), or a read or syntax error, if any. +// ('e', 'E') or binary ('p', 'P') exponent, if any. It returns the exponent, +// the exponent base (10 or 2), or a read or syntax error, if any. // -// exponent = ( "E" | "e" | "p" ) [ sign ] digits . +// exponent = ( "e" | "E" | "p" | "P" ) [ sign ] digits . // sign = "+" | "-" . // digits = digit { digit } . // digit = "0" ... "9" . @@ -153,7 +153,7 @@ func scanExponent(r io.ByteScanner, binExpOk bool) (exp int64, base int, err err switch ch { case 'e', 'E': // ok - case 'p': + case 'p', 'P': if binExpOk { base = 2 break // ok diff --git a/src/math/bits/bits.go b/src/math/bits/bits.go index b06c363348..6f367dcc93 100644 --- a/src/math/bits/bits.go +++ b/src/math/bits/bits.go @@ -232,8 +232,7 @@ func Reverse32(x uint32) uint32 { x = x>>1&(m0&m) | x&(m0&m)<<1 x = x>>2&(m1&m) | x&(m1&m)<<2 x = x>>4&(m2&m) | x&(m2&m)<<4 - x = x>>8&(m3&m) | x&(m3&m)<<8 - return x>>16 | x<<16 + return ReverseBytes32(x) } // Reverse64 returns the value of x with its bits in reversed order. @@ -242,9 +241,7 @@ func Reverse64(x uint64) uint64 { x = x>>1&(m0&m) | x&(m0&m)<<1 x = x>>2&(m1&m) | x&(m1&m)<<2 x = x>>4&(m2&m) | x&(m2&m)<<4 - x = x>>8&(m3&m) | x&(m3&m)<<8 - x = x>>16&(m4&m) | x&(m4&m)<<16 - return x>>32 | x<<32 + return ReverseBytes64(x) } // --- ReverseBytes --- diff --git a/src/math/cmplx/tan.go b/src/math/cmplx/tan.go index 2990552155..0243ea0417 100644 --- a/src/math/cmplx/tan.go +++ b/src/math/cmplx/tan.go @@ -92,9 +92,9 @@ func Tanh(x complex128) complex128 { func reducePi(x float64) float64 { const ( // extended precision value of PI: - DP1 = 3.14159265160560607910E0 // ?? 0x400921fb54000000 - DP2 = 1.98418714791870343106E-9 // ?? 0x3e210b4610000000 - DP3 = 1.14423774522196636802E-17 // ?? 0x3c6a62633145c06e + DP1 = 3.14159265160560607910e0 // ?? 0x400921fb54000000 + DP2 = 1.98418714791870343106e-9 // ?? 0x3e210b4610000000 + DP3 = 1.14423774522196636802e-17 // ?? 0x3c6a62633145c06e ) t := x / math.Pi if t >= 0 { diff --git a/src/math/sin.go b/src/math/sin.go index cc8b1366ad..3b6dbe3397 100644 --- a/src/math/sin.go +++ b/src/math/sin.go @@ -91,22 +91,22 @@ package math // sin coefficients var _sin = [...]float64{ - 1.58962301576546568060E-10, // 0x3de5d8fd1fd19ccd - -2.50507477628578072866E-8, // 0xbe5ae5e5a9291f5d - 2.75573136213857245213E-6, // 0x3ec71de3567d48a1 - -1.98412698295895385996E-4, // 0xbf2a01a019bfdf03 - 8.33333333332211858878E-3, // 0x3f8111111110f7d0 - -1.66666666666666307295E-1, // 0xbfc5555555555548 + 1.58962301576546568060e-10, // 0x3de5d8fd1fd19ccd + -2.50507477628578072866e-8, // 0xbe5ae5e5a9291f5d + 2.75573136213857245213e-6, // 0x3ec71de3567d48a1 + -1.98412698295895385996e-4, // 0xbf2a01a019bfdf03 + 8.33333333332211858878e-3, // 0x3f8111111110f7d0 + -1.66666666666666307295e-1, // 0xbfc5555555555548 } // cos coefficients var _cos = [...]float64{ - -1.13585365213876817300E-11, // 0xbda8fa49a0861a9b - 2.08757008419747316778E-9, // 0x3e21ee9d7b4e3f05 - -2.75573141792967388112E-7, // 0xbe927e4f7eac4bc6 - 2.48015872888517045348E-5, // 0x3efa01a019c844f5 - -1.38888888888730564116E-3, // 0xbf56c16c16c14f91 - 4.16666666666665929218E-2, // 0x3fa555555555554b + -1.13585365213876817300e-11, // 0xbda8fa49a0861a9b + 2.08757008419747316778e-9, // 0x3e21ee9d7b4e3f05 + -2.75573141792967388112e-7, // 0xbe927e4f7eac4bc6 + 2.48015872888517045348e-5, // 0x3efa01a019c844f5 + -1.38888888888730564116e-3, // 0xbf56c16c16c14f91 + 4.16666666666665929218e-2, // 0x3fa555555555554b } // Cos returns the cosine of the radian argument x. @@ -118,9 +118,9 @@ func Cos(x float64) float64 func cos(x float64) float64 { const ( - PI4A = 7.85398125648498535156E-1 // 0x3fe921fb40000000, Pi/4 split into three parts - PI4B = 3.77489470793079817668E-8 // 0x3e64442d00000000, - PI4C = 2.69515142907905952645E-15 // 0x3ce8469898cc5170, + PI4A = 7.85398125648498535156e-1 // 0x3fe921fb40000000, Pi/4 split into three parts + PI4B = 3.77489470793079817668e-8 // 0x3e64442d00000000, + PI4C = 2.69515142907905952645e-15 // 0x3ce8469898cc5170, ) // special cases switch { @@ -179,9 +179,9 @@ func Sin(x float64) float64 func sin(x float64) float64 { const ( - PI4A = 7.85398125648498535156E-1 // 0x3fe921fb40000000, Pi/4 split into three parts - PI4B = 3.77489470793079817668E-8 // 0x3e64442d00000000, - PI4C = 2.69515142907905952645E-15 // 0x3ce8469898cc5170, + PI4A = 7.85398125648498535156e-1 // 0x3fe921fb40000000, Pi/4 split into three parts + PI4B = 3.77489470793079817668e-8 // 0x3e64442d00000000, + PI4C = 2.69515142907905952645e-15 // 0x3ce8469898cc5170, ) // special cases switch { diff --git a/src/math/sincos.go b/src/math/sincos.go index c002db6b3c..5c5726f689 100644 --- a/src/math/sincos.go +++ b/src/math/sincos.go @@ -14,9 +14,9 @@ package math // Sincos(NaN) = NaN, NaN func Sincos(x float64) (sin, cos float64) { const ( - PI4A = 7.85398125648498535156E-1 // 0x3fe921fb40000000, Pi/4 split into three parts - PI4B = 3.77489470793079817668E-8 // 0x3e64442d00000000, - PI4C = 2.69515142907905952645E-15 // 0x3ce8469898cc5170, + PI4A = 7.85398125648498535156e-1 // 0x3fe921fb40000000, Pi/4 split into three parts + PI4B = 3.77489470793079817668e-8 // 0x3e64442d00000000, + PI4C = 2.69515142907905952645e-15 // 0x3ce8469898cc5170, ) // special cases switch { diff --git a/src/math/tan.go b/src/math/tan.go index 0d5394cf26..49b1239208 100644 --- a/src/math/tan.go +++ b/src/math/tan.go @@ -61,16 +61,16 @@ package math // tan coefficients var _tanP = [...]float64{ - -1.30936939181383777646E4, // 0xc0c992d8d24f3f38 - 1.15351664838587416140E6, // 0x413199eca5fc9ddd - -1.79565251976484877988E7, // 0xc1711fead3299176 + -1.30936939181383777646e4, // 0xc0c992d8d24f3f38 + 1.15351664838587416140e6, // 0x413199eca5fc9ddd + -1.79565251976484877988e7, // 0xc1711fead3299176 } var _tanQ = [...]float64{ - 1.00000000000000000000E0, - 1.36812963470692954678E4, //0x40cab8a5eeb36572 - -1.32089234440210967447E6, //0xc13427bc582abc96 - 2.50083801823357915839E7, //0x4177d98fc2ead8ef - -5.38695755929454629881E7, //0xc189afe03cbe5a31 + 1.00000000000000000000e0, + 1.36812963470692954678e4, //0x40cab8a5eeb36572 + -1.32089234440210967447e6, //0xc13427bc582abc96 + 2.50083801823357915839e7, //0x4177d98fc2ead8ef + -5.38695755929454629881e7, //0xc189afe03cbe5a31 } // Tan returns the tangent of the radian argument x. @@ -83,9 +83,9 @@ func Tan(x float64) float64 func tan(x float64) float64 { const ( - PI4A = 7.85398125648498535156E-1 // 0x3fe921fb40000000, Pi/4 split into three parts - PI4B = 3.77489470793079817668E-8 // 0x3e64442d00000000, - PI4C = 2.69515142907905952645E-15 // 0x3ce8469898cc5170, + PI4A = 7.85398125648498535156e-1 // 0x3fe921fb40000000, Pi/4 split into three parts + PI4B = 3.77489470793079817668e-8 // 0x3e64442d00000000, + PI4C = 2.69515142907905952645e-15 // 0x3ce8469898cc5170, ) // special cases switch { diff --git a/src/math/tanh.go b/src/math/tanh.go index eaa0e4cc52..0b7fb7f854 100644 --- a/src/math/tanh.go +++ b/src/math/tanh.go @@ -55,14 +55,14 @@ package math // var tanhP = [...]float64{ - -9.64399179425052238628E-1, - -9.92877231001918586564E1, - -1.61468768441708447952E3, + -9.64399179425052238628e-1, + -9.92877231001918586564e1, + -1.61468768441708447952e3, } var tanhQ = [...]float64{ - 1.12811678491632931402E2, - 2.23548839060100448583E3, - 4.84406305325125486048E3, + 1.12811678491632931402e2, + 2.23548839060100448583e3, + 4.84406305325125486048e3, } // Tanh returns the hyperbolic tangent of x. diff --git a/src/net/dial_test.go b/src/net/dial_test.go index 3a2c59a2d1..07d2bb22aa 100644 --- a/src/net/dial_test.go +++ b/src/net/dial_test.go @@ -338,6 +338,11 @@ func TestDialParallel(t *testing.T) { if c != nil { c.Close() } + if tt.expectOk && err != nil { + t.Errorf("#%d (cancel): got %v; want nil", i, err) + } else if !tt.expectOk && err == nil { + t.Errorf("#%d (cancel): got nil; want non-nil", i) + } elapsed = time.Now().Sub(startTime) if elapsed > 100*time.Millisecond { t.Errorf("#%d (cancel): got %v; want <= 100ms", i, elapsed) diff --git a/src/net/http/fs.go b/src/net/http/fs.go index db44d6b029..41d46dced2 100644 --- a/src/net/http/fs.go +++ b/src/net/http/fs.go @@ -63,6 +63,8 @@ func mapDirOpenError(originalErr error, name string) error { return originalErr } +// Open implements FileSystem using os.Open, opening files for reading rooted +// and relative to the directory d. func (d Dir) Open(name string) (File, error) { if filepath.Separator != '/' && strings.ContainsRune(name, filepath.Separator) { return nil, errors.New("http: invalid character in file path") diff --git a/src/net/http/httptrace/trace.go b/src/net/http/httptrace/trace.go index 3a627412b3..8b377edee5 100644 --- a/src/net/http/httptrace/trace.go +++ b/src/net/http/httptrace/trace.go @@ -152,7 +152,7 @@ type ClientTrace struct { WroteHeaders func() // Wait100Continue is called if the Request specified - // "Expected: 100-continue" and the Transport has written the + // "Expect: 100-continue" and the Transport has written the // request headers but is waiting for "100 Continue" from the // server before writing the request body. Wait100Continue func() diff --git a/src/net/http/httputil/dump_test.go b/src/net/http/httputil/dump_test.go index 63312dd885..97954ca88d 100644 --- a/src/net/http/httputil/dump_test.go +++ b/src/net/http/httputil/dump_test.go @@ -18,7 +18,10 @@ import ( ) type dumpTest struct { - Req http.Request + // Either Req or GetReq can be set/nil but not both. + Req *http.Request + GetReq func() *http.Request + Body interface{} // optional []byte or func() io.ReadCloser to populate Req.Body WantDump string @@ -29,7 +32,7 @@ type dumpTest struct { var dumpTests = []dumpTest{ // HTTP/1.1 => chunked coding; body; empty trailer { - Req: http.Request{ + Req: &http.Request{ Method: "GET", URL: &url.URL{ Scheme: "http", @@ -52,7 +55,7 @@ var dumpTests = []dumpTest{ // Verify that DumpRequest preserves the HTTP version number, doesn't add a Host, // and doesn't add a User-Agent. { - Req: http.Request{ + Req: &http.Request{ Method: "GET", URL: mustParseURL("/foo"), ProtoMajor: 1, @@ -67,7 +70,7 @@ var dumpTests = []dumpTest{ }, { - Req: *mustNewRequest("GET", "http://example.com/foo", nil), + Req: mustNewRequest("GET", "http://example.com/foo", nil), WantDumpOut: "GET /foo HTTP/1.1\r\n" + "Host: example.com\r\n" + @@ -79,8 +82,7 @@ var dumpTests = []dumpTest{ // with a bytes.Buffer and hang with all goroutines not // runnable. { - Req: *mustNewRequest("GET", "https://example.com/foo", nil), - + Req: mustNewRequest("GET", "https://example.com/foo", nil), WantDumpOut: "GET /foo HTTP/1.1\r\n" + "Host: example.com\r\n" + "User-Agent: Go-http-client/1.1\r\n" + @@ -89,7 +91,7 @@ var dumpTests = []dumpTest{ // Request with Body, but Dump requested without it. { - Req: http.Request{ + Req: &http.Request{ Method: "POST", URL: &url.URL{ Scheme: "http", @@ -114,7 +116,7 @@ var dumpTests = []dumpTest{ // Request with Body > 8196 (default buffer size) { - Req: http.Request{ + Req: &http.Request{ Method: "POST", URL: &url.URL{ Scheme: "http", @@ -145,8 +147,10 @@ var dumpTests = []dumpTest{ }, { - Req: *mustReadRequest("GET http://foo.com/ HTTP/1.1\r\n" + - "User-Agent: blah\r\n\r\n"), + GetReq: func() *http.Request { + return mustReadRequest("GET http://foo.com/ HTTP/1.1\r\n" + + "User-Agent: blah\r\n\r\n") + }, NoBody: true, WantDump: "GET http://foo.com/ HTTP/1.1\r\n" + "User-Agent: blah\r\n\r\n", @@ -154,22 +158,25 @@ var dumpTests = []dumpTest{ // Issue #7215. DumpRequest should return the "Content-Length" when set { - Req: *mustReadRequest("POST /v2/api/?login HTTP/1.1\r\n" + - "Host: passport.myhost.com\r\n" + - "Content-Length: 3\r\n" + - "\r\nkey1=name1&key2=name2"), + GetReq: func() *http.Request { + return mustReadRequest("POST /v2/api/?login HTTP/1.1\r\n" + + "Host: passport.myhost.com\r\n" + + "Content-Length: 3\r\n" + + "\r\nkey1=name1&key2=name2") + }, WantDump: "POST /v2/api/?login HTTP/1.1\r\n" + "Host: passport.myhost.com\r\n" + "Content-Length: 3\r\n" + "\r\nkey", }, - // Issue #7215. DumpRequest should return the "Content-Length" in ReadRequest { - Req: *mustReadRequest("POST /v2/api/?login HTTP/1.1\r\n" + - "Host: passport.myhost.com\r\n" + - "Content-Length: 0\r\n" + - "\r\nkey1=name1&key2=name2"), + GetReq: func() *http.Request { + return mustReadRequest("POST /v2/api/?login HTTP/1.1\r\n" + + "Host: passport.myhost.com\r\n" + + "Content-Length: 0\r\n" + + "\r\nkey1=name1&key2=name2") + }, WantDump: "POST /v2/api/?login HTTP/1.1\r\n" + "Host: passport.myhost.com\r\n" + "Content-Length: 0\r\n\r\n", @@ -177,9 +184,11 @@ var dumpTests = []dumpTest{ // Issue #7215. DumpRequest should not return the "Content-Length" if unset { - Req: *mustReadRequest("POST /v2/api/?login HTTP/1.1\r\n" + - "Host: passport.myhost.com\r\n" + - "\r\nkey1=name1&key2=name2"), + GetReq: func() *http.Request { + return mustReadRequest("POST /v2/api/?login HTTP/1.1\r\n" + + "Host: passport.myhost.com\r\n" + + "\r\nkey1=name1&key2=name2") + }, WantDump: "POST /v2/api/?login HTTP/1.1\r\n" + "Host: passport.myhost.com\r\n\r\n", }, @@ -187,8 +196,7 @@ var dumpTests = []dumpTest{ // Issue 18506: make drainBody recognize NoBody. Otherwise // this was turning into a chunked request. { - Req: *mustNewRequest("POST", "http://example.com/foo", http.NoBody), - + Req: mustNewRequest("POST", "http://example.com/foo", http.NoBody), WantDumpOut: "POST /foo HTTP/1.1\r\n" + "Host: example.com\r\n" + "User-Agent: Go-http-client/1.1\r\n" + @@ -200,28 +208,40 @@ var dumpTests = []dumpTest{ func TestDumpRequest(t *testing.T) { numg0 := runtime.NumGoroutine() for i, tt := range dumpTests { - setBody := func() { - if tt.Body == nil { - return - } - switch b := tt.Body.(type) { - case []byte: - tt.Req.Body = ioutil.NopCloser(bytes.NewReader(b)) - case func() io.ReadCloser: - tt.Req.Body = b() - default: - t.Fatalf("Test %d: unsupported Body of %T", i, tt.Body) - } + if tt.Req != nil && tt.GetReq != nil || tt.Req == nil && tt.GetReq == nil { + t.Errorf("#%d: either .Req(%p) or .GetReq(%p) can be set/nil but not both", i, tt.Req, tt.GetReq) + continue } - if tt.Req.Header == nil { - tt.Req.Header = make(http.Header) + + freshReq := func(ti dumpTest) *http.Request { + req := ti.Req + if req == nil { + req = ti.GetReq() + } + + if req.Header == nil { + req.Header = make(http.Header) + } + + if ti.Body == nil { + return req + } + switch b := ti.Body.(type) { + case []byte: + req.Body = ioutil.NopCloser(bytes.NewReader(b)) + case func() io.ReadCloser: + req.Body = b() + default: + t.Fatalf("Test %d: unsupported Body of %T", i, ti.Body) + } + return req } if tt.WantDump != "" { - setBody() - dump, err := DumpRequest(&tt.Req, !tt.NoBody) + req := freshReq(tt) + dump, err := DumpRequest(req, !tt.NoBody) if err != nil { - t.Errorf("DumpRequest #%d: %s", i, err) + t.Errorf("DumpRequest #%d: %s\nWantDump:\n%s", i, err, tt.WantDump) continue } if string(dump) != tt.WantDump { @@ -231,8 +251,8 @@ func TestDumpRequest(t *testing.T) { } if tt.WantDumpOut != "" { - setBody() - dump, err := DumpRequestOut(&tt.Req, !tt.NoBody) + req := freshReq(tt) + dump, err := DumpRequestOut(req, !tt.NoBody) if err != nil { t.Errorf("DumpRequestOut #%d: %s", i, err) continue diff --git a/src/net/http/serve_test.go b/src/net/http/serve_test.go index 6eb0088a96..86cdb34ebb 100644 --- a/src/net/http/serve_test.go +++ b/src/net/http/serve_test.go @@ -2900,6 +2900,15 @@ func TestStripPrefix(t *testing.T) { t.Errorf("test 2: got status %v, want %v", g, e) } res.Body.Close() + + res, err = c.Get(ts.URL + "/foo") + if err != nil { + t.Fatal(err) + } + if g, e := res.Header.Get("X-Path"), "/"; g != e { + t.Errorf("test 3: got %s, want %s", g, e) + } + res.Body.Close() } // https://golang.org/issue/18952. diff --git a/src/net/http/server.go b/src/net/http/server.go index aa9c3f5d2e..e68ec2f01e 100644 --- a/src/net/http/server.go +++ b/src/net/http/server.go @@ -2030,7 +2030,7 @@ func StripPrefix(prefix string, h Handler) Handler { *r2 = *r r2.URL = new(url.URL) *r2.URL = *r.URL - r2.URL.Path = p + r2.URL.Path = cleanPath(p) h.ServeHTTP(w, r2) } else { NotFound(w, r) diff --git a/src/net/interface_plan9.go b/src/net/interface_plan9.go index e5d77390f8..8fe9138406 100644 --- a/src/net/interface_plan9.go +++ b/src/net/interface_plan9.go @@ -152,10 +152,14 @@ func interfaceAddrTable(ifi *Interface) ([]Addr, error) { } defer statusf.close() + // Read but ignore first line as it only contains the table header. + // See https://9p.io/magic/man2html/3/ip + if _, ok := statusf.readLine(); !ok { + return nil, errors.New("cannot read header line for interface: " + status) + } line, ok := statusf.readLine() - line, ok = statusf.readLine() if !ok { - return nil, errors.New("cannot parse IP address for interface: " + status) + return nil, errors.New("cannot read IP address for interface: " + status) } // This assumes only a single address for the interface. diff --git a/src/net/listen_test.go b/src/net/listen_test.go index 6c3f70cc7b..6c9b92a9fc 100644 --- a/src/net/listen_test.go +++ b/src/net/listen_test.go @@ -780,6 +780,9 @@ func TestListenConfigControl(t *testing.T) { continue } c.Close() + if network == "unixgram" { + os.Remove(address) + } } }) } diff --git a/src/net/mac.go b/src/net/mac.go index f3b1694735..373ac3d7e2 100644 --- a/src/net/mac.go +++ b/src/net/mac.go @@ -26,15 +26,15 @@ func (a HardwareAddr) String() string { // ParseMAC parses s as an IEEE 802 MAC-48, EUI-48, EUI-64, or a 20-octet // IP over InfiniBand link-layer address using one of the following formats: -// 01:23:45:67:89:ab -// 01:23:45:67:89:ab:cd:ef -// 01:23:45:67:89:ab:cd:ef:00:00:01:23:45:67:89:ab:cd:ef:00:00 -// 01-23-45-67-89-ab -// 01-23-45-67-89-ab-cd-ef -// 01-23-45-67-89-ab-cd-ef-00-00-01-23-45-67-89-ab-cd-ef-00-00 -// 0123.4567.89ab -// 0123.4567.89ab.cdef -// 0123.4567.89ab.cdef.0000.0123.4567.89ab.cdef.0000 +// 00:00:5e:00:53:01 +// 02:00:5e:10:00:00:00:01 +// 00:00:00:00:fe:80:00:00:00:00:00:00:02:00:5e:10:00:00:00:01 +// 00-00-5e-00-53-01 +// 02-00-5e-10-00-00-00-01 +// 00-00-00-00-fe-80-00-00-00-00-00-00-02-00-5e-10-00-00-00-01 +// 0000.5e00.5301 +// 0200.5e10.0000.0001 +// 0000.0000.fe80.0000.0000.0000.0200.5e10.0000.0001 func ParseMAC(s string) (hw HardwareAddr, err error) { if len(s) < 14 { goto error diff --git a/src/net/mac_test.go b/src/net/mac_test.go index 2630d19047..cad884fcf5 100644 --- a/src/net/mac_test.go +++ b/src/net/mac_test.go @@ -15,10 +15,57 @@ var parseMACTests = []struct { out HardwareAddr err string }{ - {"01:23:45:67:89:AB", HardwareAddr{1, 0x23, 0x45, 0x67, 0x89, 0xab}, ""}, - {"01-23-45-67-89-AB", HardwareAddr{1, 0x23, 0x45, 0x67, 0x89, 0xab}, ""}, - {"0123.4567.89AB", HardwareAddr{1, 0x23, 0x45, 0x67, 0x89, 0xab}, ""}, + // See RFC 7042, Section 2.1.1. + {"00:00:5e:00:53:01", HardwareAddr{0x00, 0x00, 0x5e, 0x00, 0x53, 0x01}, ""}, + {"00-00-5e-00-53-01", HardwareAddr{0x00, 0x00, 0x5e, 0x00, 0x53, 0x01}, ""}, + {"0000.5e00.5301", HardwareAddr{0x00, 0x00, 0x5e, 0x00, 0x53, 0x01}, ""}, + + // See RFC 7042, Section 2.2.2. + {"02:00:5e:10:00:00:00:01", HardwareAddr{0x02, 0x00, 0x5e, 0x10, 0x00, 0x00, 0x00, 0x01}, ""}, + {"02-00-5e-10-00-00-00-01", HardwareAddr{0x02, 0x00, 0x5e, 0x10, 0x00, 0x00, 0x00, 0x01}, ""}, + {"0200.5e10.0000.0001", HardwareAddr{0x02, 0x00, 0x5e, 0x10, 0x00, 0x00, 0x00, 0x01}, ""}, + + // See RFC 4391, Section 9.1.1. + { + "00:00:00:00:fe:80:00:00:00:00:00:00:02:00:5e:10:00:00:00:01", + HardwareAddr{ + 0x00, 0x00, 0x00, 0x00, + 0xfe, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x02, 0x00, 0x5e, 0x10, 0x00, 0x00, 0x00, 0x01, + }, + "", + }, + { + "00-00-00-00-fe-80-00-00-00-00-00-00-02-00-5e-10-00-00-00-01", + HardwareAddr{ + 0x00, 0x00, 0x00, 0x00, + 0xfe, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x02, 0x00, 0x5e, 0x10, 0x00, 0x00, 0x00, 0x01, + }, + "", + }, + { + "0000.0000.fe80.0000.0000.0000.0200.5e10.0000.0001", + HardwareAddr{ + 0x00, 0x00, 0x00, 0x00, + 0xfe, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x02, 0x00, 0x5e, 0x10, 0x00, 0x00, 0x00, 0x01, + }, + "", + }, + {"ab:cd:ef:AB:CD:EF", HardwareAddr{0xab, 0xcd, 0xef, 0xab, 0xcd, 0xef}, ""}, + {"ab:cd:ef:AB:CD:EF:ab:cd", HardwareAddr{0xab, 0xcd, 0xef, 0xab, 0xcd, 0xef, 0xab, 0xcd}, ""}, + { + "ab:cd:ef:AB:CD:EF:ab:cd:ef:AB:CD:EF:ab:cd:ef:AB:CD:EF:ab:cd", + HardwareAddr{ + 0xab, 0xcd, 0xef, 0xab, + 0xcd, 0xef, 0xab, 0xcd, 0xef, 0xab, 0xcd, 0xef, + 0xab, 0xcd, 0xef, 0xab, 0xcd, 0xef, 0xab, 0xcd, + }, + "", + }, + {"01.02.03.04.05.06", nil, "invalid MAC address"}, {"01:02:03:04:05:06:", nil, "invalid MAC address"}, {"x1:02:03:04:05:06", nil, "invalid MAC address"}, @@ -31,33 +78,6 @@ var parseMACTests = []struct { {"01:02-03-04-05-06", nil, "invalid MAC address"}, {"0123:4567:89AF", nil, "invalid MAC address"}, {"0123-4567-89AF", nil, "invalid MAC address"}, - {"01:23:45:67:89:AB:CD:EF", HardwareAddr{1, 0x23, 0x45, 0x67, 0x89, 0xab, 0xcd, 0xef}, ""}, - {"01-23-45-67-89-AB-CD-EF", HardwareAddr{1, 0x23, 0x45, 0x67, 0x89, 0xab, 0xcd, 0xef}, ""}, - {"0123.4567.89AB.CDEF", HardwareAddr{1, 0x23, 0x45, 0x67, 0x89, 0xab, 0xcd, 0xef}, ""}, - { - "01:23:45:67:89:ab:cd:ef:00:00:01:23:45:67:89:ab:cd:ef:00:00", - HardwareAddr{ - 0x01, 0x23, 0x45, 0x67, 0x89, 0xab, 0xcd, 0xef, 0x00, 0x00, - 0x01, 0x23, 0x45, 0x67, 0x89, 0xab, 0xcd, 0xef, 0x00, 0x00, - }, - "", - }, - { - "01-23-45-67-89-ab-cd-ef-00-00-01-23-45-67-89-ab-cd-ef-00-00", - HardwareAddr{ - 0x01, 0x23, 0x45, 0x67, 0x89, 0xab, 0xcd, 0xef, 0x00, 0x00, - 0x01, 0x23, 0x45, 0x67, 0x89, 0xab, 0xcd, 0xef, 0x00, 0x00, - }, - "", - }, - { - "0123.4567.89ab.cdef.0000.0123.4567.89ab.cdef.0000", - HardwareAddr{ - 0x01, 0x23, 0x45, 0x67, 0x89, 0xab, 0xcd, 0xef, 0x00, 0x00, - 0x01, 0x23, 0x45, 0x67, 0x89, 0xab, 0xcd, 0xef, 0x00, 0x00, - }, - "", - }, } func TestParseMAC(t *testing.T) { diff --git a/src/net/mockserver_test.go b/src/net/mockserver_test.go index 530293578a..e085f4440b 100644 --- a/src/net/mockserver_test.go +++ b/src/net/mockserver_test.go @@ -17,8 +17,6 @@ import ( ) // testUnixAddr uses ioutil.TempFile to get a name that is unique. -// It also uses /tmp directory in case it is prohibited to create UNIX -// sockets in TMPDIR. func testUnixAddr() string { f, err := ioutil.TempFile("", "go-nettest") if err != nil { diff --git a/src/net/rpc/client_test.go b/src/net/rpc/client_test.go index d116d2acc9..03225e3d01 100644 --- a/src/net/rpc/client_test.go +++ b/src/net/rpc/client_test.go @@ -57,7 +57,7 @@ func TestGobError(t *testing.T) { if err == nil { t.Fatal("no error") } - if !strings.Contains("reading body EOF", err.(error).Error()) { + if !strings.Contains(err.(error).Error(), "reading body EOF") { t.Fatal("expected `reading body EOF', got", err) } }() diff --git a/src/net/splice_test.go b/src/net/splice_test.go index 4c300172c5..e2a6638e8f 100644 --- a/src/net/splice_test.go +++ b/src/net/splice_test.go @@ -242,6 +242,7 @@ func testSpliceNoUnixgram(t *testing.T) { if err != nil { t.Fatal(err) } + defer os.Remove(addr.Name) up, err := ListenUnixgram("unixgram", addr) if err != nil { t.Fatal(err) diff --git a/src/net/textproto/reader_test.go b/src/net/textproto/reader_test.go index f85fbdc36d..6d9bcd841b 100644 --- a/src/net/textproto/reader_test.go +++ b/src/net/textproto/reader_test.go @@ -332,7 +332,7 @@ func TestReadMultiLineError(t *testing.T) { if msg != wantMsg { t.Errorf("ReadResponse: msg=%q, want %q", msg, wantMsg) } - if err.Error() != "550 "+wantMsg { + if err != nil && err.Error() != "550 "+wantMsg { t.Errorf("ReadResponse: error=%q, want %q", err.Error(), "550 "+wantMsg) } } diff --git a/src/os/file.go b/src/os/file.go index fdead63bfc..8c25cc0a3b 100644 --- a/src/os/file.go +++ b/src/os/file.go @@ -265,10 +265,10 @@ func Open(name string) (*File, error) { return OpenFile(name, O_RDONLY, 0) } -// Create creates the named file with mode 0666 (before umask), truncating -// it if it already exists. If successful, methods on the returned -// File can be used for I/O; the associated file descriptor has mode -// O_RDWR. +// Create creates or truncates the named file. If the file already exists, +// it is truncated. If the file does not exist, it is created with mode 0666 +// (before umask). If successful, methods on the returned File can +// be used for I/O; the associated file descriptor has mode O_RDWR. // If there is an error, it will be of type *PathError. func Create(name string) (*File, error) { return OpenFile(name, O_RDWR|O_CREATE|O_TRUNC, 0666) @@ -276,7 +276,8 @@ func Create(name string) (*File, error) { // OpenFile is the generalized open call; most users will use Open // or Create instead. It opens the named file with specified flag -// (O_RDONLY etc.) and perm (before umask), if applicable. If successful, +// (O_RDONLY etc.). If the file does not exist, and the O_CREATE flag +// is passed, it is created with mode perm (before umask). If successful, // methods on the returned File can be used for I/O. // If there is an error, it will be of type *PathError. func OpenFile(name string, flag int, perm FileMode) (*File, error) { diff --git a/src/os/os_windows_test.go b/src/os/os_windows_test.go index 285e1eb35e..dc9e629b01 100644 --- a/src/os/os_windows_test.go +++ b/src/os/os_windows_test.go @@ -1013,7 +1013,7 @@ func TestStatOfInvalidName(t *testing.T) { // It returns path to the found drive root directory (like Z:\) or error. func findUnusedDriveLetter() (string, error) { // Do not use A: and B:, because they are reserved for floppy drive. - // Do not use C:, becasue it is normally used for main drive. + // Do not use C:, because it is normally used for main drive. for l := 'Z'; l >= 'D'; l-- { p := string(l) + `:\` _, err := os.Stat(p) diff --git a/src/os/removeall_at.go b/src/os/removeall_at.go index 7f2d5922ae..0b7d5efb7a 100644 --- a/src/os/removeall_at.go +++ b/src/os/removeall_at.go @@ -71,6 +71,9 @@ func removeAllFrom(parent *File, path string) error { var statInfo syscall.Stat_t statErr := unix.Fstatat(parentFd, path, &statInfo, unix.AT_SYMLINK_NOFOLLOW) if statErr != nil { + if IsNotExist(statErr) { + return nil + } return statErr } if statInfo.Mode&syscall.S_IFMT != syscall.S_IFDIR { diff --git a/src/path/filepath/path.go b/src/path/filepath/path.go index bbb90306a7..aba1717e7d 100644 --- a/src/path/filepath/path.go +++ b/src/path/filepath/path.go @@ -96,19 +96,14 @@ func Clean(path string) string { } return originalPath + "." } - - n := len(path) - if volLen > 2 && n == 1 && os.IsPathSeparator(path[0]) { - // UNC volume name with trailing slash. - return FromSlash(originalPath[:volLen]) - } rooted := os.IsPathSeparator(path[0]) // Invariants: // reading from path; r is index of next byte to process. - // writing to out; w is index of next byte to write. - // dotdot is index in out where .. must stop, either because + // writing to buf; w is index of next byte to write. + // dotdot is index in buf where .. must stop, either because // it is the leading slash or it is a leading ../../.. prefix. + n := len(path) out := lazybuf{path: path, volAndPath: originalPath, volLen: volLen} r, dotdot := 0, 0 if rooted { diff --git a/src/path/filepath/path_test.go b/src/path/filepath/path_test.go index 9c4c7ebedc..7a434a4292 100644 --- a/src/path/filepath/path_test.go +++ b/src/path/filepath/path_test.go @@ -93,9 +93,6 @@ var wincleantests = []PathTest{ {`//host/share/foo/../baz`, `\\host\share\baz`}, {`\\a\b\..\c`, `\\a\b\c`}, {`\\a\b`, `\\a\b`}, - {`\\a\b\`, `\\a\b`}, - {`\\folder\share\foo`, `\\folder\share\foo`}, - {`\\folder\share\foo\`, `\\folder\share\foo`}, } func TestClean(t *testing.T) { diff --git a/src/regexp/find_test.go b/src/regexp/find_test.go index e07eb7d5c0..87c49b074f 100644 --- a/src/regexp/find_test.go +++ b/src/regexp/find_test.go @@ -161,6 +161,9 @@ func TestFind(t *testing.T) { t.Errorf("expected match; got none: %s", test) case test.matches != nil && result != nil: expect := test.text[test.matches[0][0]:test.matches[0][1]] + if len(result) != cap(result) { + t.Errorf("expected capacity %d got %d: %s", len(result), cap(result), test) + } if expect != string(result) { t.Errorf("expected %q got %q: %s", expect, result, test) } @@ -242,9 +245,13 @@ func TestFindAll(t *testing.T) { continue } for k, e := range test.matches { + got := result[k] + if len(got) != cap(got) { + t.Errorf("match %d: expected capacity %d got %d: %s", k, len(got), cap(got), test) + } expect := test.text[e[0]:e[1]] - if expect != string(result[k]) { - t.Errorf("match %d: expected %q got %q: %s", k, expect, result[k], test) + if expect != string(got) { + t.Errorf("match %d: expected %q got %q: %s", k, expect, got, test) } } } @@ -323,9 +330,14 @@ func testSubmatchBytes(test *FindTest, n int, submatches []int, result [][]byte, } continue } + got := result[k/2] + if len(got) != cap(got) { + t.Errorf("match %d: expected capacity %d got %d: %s", n, len(got), cap(got), test) + return + } expect := test.text[submatches[k]:submatches[k+1]] - if expect != string(result[k/2]) { - t.Errorf("match %d: expected %q got %q: %s", n, expect, result, test) + if expect != string(got) { + t.Errorf("match %d: expected %q got %q: %s", n, expect, got, test) return } } diff --git a/src/regexp/regexp.go b/src/regexp/regexp.go index 38b3c86d9f..88122d4250 100644 --- a/src/regexp/regexp.go +++ b/src/regexp/regexp.go @@ -761,7 +761,7 @@ func (re *Regexp) Find(b []byte) []byte { if a == nil { return nil } - return b[a[0]:a[1]] + return b[a[0]:a[1]:a[1]] } // FindIndex returns a two-element slice of integers defining the location of @@ -829,7 +829,7 @@ func (re *Regexp) FindSubmatch(b []byte) [][]byte { ret := make([][]byte, 1+re.numSubexp) for i := range ret { if 2*i < len(a) && a[2*i] >= 0 { - ret[i] = b[a[2*i]:a[2*i+1]] + ret[i] = b[a[2*i]:a[2*i+1]:a[2*i+1]] } } return ret @@ -1025,7 +1025,7 @@ func (re *Regexp) FindAll(b []byte, n int) [][]byte { if result == nil { result = make([][]byte, 0, startSize) } - result = append(result, b[match[0]:match[1]]) + result = append(result, b[match[0]:match[1]:match[1]]) }) return result } @@ -1100,7 +1100,7 @@ func (re *Regexp) FindAllSubmatch(b []byte, n int) [][][]byte { slice := make([][]byte, len(match)/2) for j := range slice { if match[2*j] >= 0 { - slice[j] = b[match[2*j]:match[2*j+1]] + slice[j] = b[match[2*j]:match[2*j+1]:match[2*j+1]] } } result = append(result, slice) diff --git a/src/runtime/crash_test.go b/src/runtime/crash_test.go index 6fba4dd91a..03ebf022a6 100644 --- a/src/runtime/crash_test.go +++ b/src/runtime/crash_test.go @@ -728,3 +728,15 @@ func TestG0StackOverflow(t *testing.T) { runtime.G0StackOverflow() } + +// Test that panic message is not clobbered. +// See issue 30150. +func TestDoublePanic(t *testing.T) { + output := runTestProg(t, "testprog", "DoublePanic", "GODEBUG=clobberfree=1") + wants := []string{"panic: XXX", "panic: YYY"} + for _, want := range wants { + if !strings.Contains(output, want) { + t.Errorf("output:\n%s\n\nwant output containing: %s", output, want) + } + } +} diff --git a/src/runtime/crash_unix_test.go b/src/runtime/crash_unix_test.go index 1384e00210..987c7095a0 100644 --- a/src/runtime/crash_unix_test.go +++ b/src/runtime/crash_unix_test.go @@ -63,7 +63,7 @@ func TestCrashDumpsAllThreads(t *testing.T) { t.Fatalf("failed to create Go file: %v", err) } - cmd := exec.Command(testenv.GoToolPath(t), "build", "-o", "a.exe") + cmd := exec.Command(testenv.GoToolPath(t), "build", "-o", "a.exe", "main.go") cmd.Dir = dir out, err := testenv.CleanCmdEnv(cmd).CombinedOutput() if err != nil { diff --git a/src/runtime/extern.go b/src/runtime/extern.go index af858a331f..e308dd38b1 100644 --- a/src/runtime/extern.go +++ b/src/runtime/extern.go @@ -27,6 +27,10 @@ It is a comma-separated list of name=val pairs setting these named variables: allocfreetrace: setting allocfreetrace=1 causes every allocation to be profiled and a stack trace printed on each object's allocation and free. + clobberfree: setting clobberfree=1 causes the garbage collector to + clobber the memory content of an object with bad content when it frees + the object. + cgocheck: setting cgocheck=0 disables all checks for packages using cgo to incorrectly pass Go pointers to non-Go code. Setting cgocheck=1 (the default) enables relatively cheap @@ -123,7 +127,7 @@ It is a comma-separated list of name=val pairs setting these named variables: IDs will refer to the ID of the goroutine at the time of creation; it's possible for this ID to be reused for another goroutine. Setting N to 0 will report no ancestry information. -The net and net/http packages also refer to debugging variables in GODEBUG. +The net, net/http, and crypto/tls packages also refer to debugging variables in GODEBUG. See the documentation for those packages for details. The GOMAXPROCS variable limits the number of operating system threads that diff --git a/src/runtime/mem_bsd.go b/src/runtime/mem_bsd.go index 84238d7279..796bb44223 100644 --- a/src/runtime/mem_bsd.go +++ b/src/runtime/mem_bsd.go @@ -45,7 +45,7 @@ func sysReserve(v unsafe.Pointer, n uintptr) unsafe.Pointer { flags := int32(_MAP_ANON | _MAP_PRIVATE) if raceenabled && GOOS == "darwin" { // Currently the race detector expects memory to live within a certain - // range, and on Darwin 10.10 mmap is prone to ignoring hints, moreso + // range, and on Darwin 10.10 mmap is prone to ignoring hints, more so // than later versions and other BSDs (#26475). So, even though it's // potentially dangerous to MAP_FIXED, we do it in the race detection // case because it'll help maintain the race detector's invariants. diff --git a/src/runtime/mgcmark.go b/src/runtime/mgcmark.go index 86416caab5..022cc8d7d7 100644 --- a/src/runtime/mgcmark.go +++ b/src/runtime/mgcmark.go @@ -709,7 +709,13 @@ func scanstack(gp *g, gcw *gcWork) { return true } gentraceback(^uintptr(0), ^uintptr(0), 0, gp, 0, nil, 0x7fffffff, scanframe, nil, 0) + + // Find additional pointers that point into the stack from the heap. + // Currently this includes defers and panics. See also function copystack. tracebackdefers(gp, scanframe, nil) + if gp._panic != nil { + state.putPtr(uintptr(unsafe.Pointer(gp._panic))) + } // Find and scan all reachable stack objects. state.buildIndex() diff --git a/src/runtime/mgcstack.go b/src/runtime/mgcstack.go index 86e60d4381..baeaa4fd55 100644 --- a/src/runtime/mgcstack.go +++ b/src/runtime/mgcstack.go @@ -274,7 +274,7 @@ func (s *stackScanState) addObject(addr uintptr, typ *_type) { obj.off = uint32(addr - s.stack.lo) obj.size = uint32(typ.size) obj.setType(typ) - // obj.left and obj.right will be initalized by buildIndex before use. + // obj.left and obj.right will be initialized by buildIndex before use. s.nobjs++ } diff --git a/src/runtime/mgcsweep.go b/src/runtime/mgcsweep.go index edb9fcac09..6ac3b03176 100644 --- a/src/runtime/mgcsweep.go +++ b/src/runtime/mgcsweep.go @@ -291,7 +291,7 @@ func (s *mspan) sweep(preserve bool) bool { } } - if debug.allocfreetrace != 0 || raceenabled || msanenabled { + if debug.allocfreetrace != 0 || debug.clobberfree != 0 || raceenabled || msanenabled { // Find all newly freed objects. This doesn't have to // efficient; allocfreetrace has massive overhead. mbits := s.markBitsForBase() @@ -302,6 +302,9 @@ func (s *mspan) sweep(preserve bool) bool { if debug.allocfreetrace != 0 { tracefree(unsafe.Pointer(x), size) } + if debug.clobberfree != 0 { + clobberfree(unsafe.Pointer(x), size) + } if raceenabled { racefree(unsafe.Pointer(x), size) } @@ -446,3 +449,12 @@ retry: traceGCSweepDone() } } + +// clobberfree sets the memory content at x to bad content, for debugging +// purposes. +func clobberfree(x unsafe.Pointer, size uintptr) { + // size (span.elemsize) is always a multiple of 4. + for i := uintptr(0); i < size; i += 4 { + *(*uint32)(add(x, i)) = 0xdeadbeef + } +} diff --git a/src/runtime/os_openbsd.go b/src/runtime/os_openbsd.go index 96112cb25b..353a5d94ba 100644 --- a/src/runtime/os_openbsd.go +++ b/src/runtime/os_openbsd.go @@ -84,9 +84,10 @@ const ( _CTL_KERN = 1 _KERN_OSREV = 3 - _CTL_HW = 6 - _HW_NCPU = 3 - _HW_PAGESIZE = 7 + _CTL_HW = 6 + _HW_NCPU = 3 + _HW_PAGESIZE = 7 + _HW_NCPUONLINE = 25 ) func sysctlInt(mib []uint32) (int32, bool) { @@ -100,9 +101,14 @@ func sysctlInt(mib []uint32) (int32, bool) { } func getncpu() int32 { - // Fetch hw.ncpu via sysctl. - if ncpu, ok := sysctlInt([]uint32{_CTL_HW, _HW_NCPU}); ok { - return int32(ncpu) + // Try hw.ncpuonline first because hw.ncpu would report a number twice as + // high as the actual CPUs running on OpenBSD 6.4 with hyperthreading + // disabled (hw.smt=0). See https://golang.org/issue/30127 + if n, ok := sysctlInt([]uint32{_CTL_HW, _HW_NCPUONLINE}); ok { + return int32(n) + } + if n, ok := sysctlInt([]uint32{_CTL_HW, _HW_NCPU}); ok { + return int32(n) } return 1 } diff --git a/src/runtime/panic.go b/src/runtime/panic.go index bb83be4715..59916dd5e5 100644 --- a/src/runtime/panic.go +++ b/src/runtime/panic.go @@ -23,16 +23,16 @@ func panicCheckMalloc(err error) { var indexError = error(errorString("index out of range")) -// The panicindex, panicslice, and panicdivide functions are called by +// The panic{index,slice,divide,shift} functions are called by // code generated by the compiler for out of bounds index expressions, -// out of bounds slice expressions, and division by zero. The -// panicdivide (again), panicoverflow, panicfloat, and panicmem +// out of bounds slice expressions, division by zero, and shift by negative. +// The panicdivide (again), panicoverflow, panicfloat, and panicmem // functions are called by the signal handler when a signal occurs // indicating the respective problem. // -// Since panicindex and panicslice are never called directly, and +// Since panic{index,slice,shift} are never called directly, and // since the runtime package should never have an out of bounds slice -// or array reference, if we see those functions called from the +// or array reference or negative shift, if we see those functions called from the // runtime package we turn the panic into a throw. That will dump the // entire runtime stack for easier debugging. @@ -68,6 +68,16 @@ func panicoverflow() { panic(overflowError) } +var shiftError = error(errorString("negative shift amount")) + +func panicshift() { + if hasPrefix(funcname(findfunc(getcallerpc())), "runtime.") { + throw(string(shiftError.(errorString))) + } + panicCheckMalloc(shiftError) + panic(shiftError) +} + var floatError = error(errorString("floating point error")) func panicfloat() { diff --git a/src/runtime/runtime-gdb_test.go b/src/runtime/runtime-gdb_test.go index a988d1d702..d0f905e4d7 100644 --- a/src/runtime/runtime-gdb_test.go +++ b/src/runtime/runtime-gdb_test.go @@ -156,7 +156,7 @@ func testGdbPython(t *testing.T, cgo bool) { } nLines := lastLine(src) - cmd := exec.Command(testenv.GoToolPath(t), "build", "-o", "a.exe") + cmd := exec.Command(testenv.GoToolPath(t), "build", "-o", "a.exe", "main.go") cmd.Dir = dir out, err := testenv.CleanCmdEnv(cmd).CombinedOutput() if err != nil { @@ -337,7 +337,7 @@ func TestGdbBacktrace(t *testing.T) { if err != nil { t.Fatalf("failed to create file: %v", err) } - cmd := exec.Command(testenv.GoToolPath(t), "build", "-o", "a.exe") + cmd := exec.Command(testenv.GoToolPath(t), "build", "-o", "a.exe", "main.go") cmd.Dir = dir out, err := testenv.CleanCmdEnv(cmd).CombinedOutput() if err != nil { @@ -408,7 +408,7 @@ func TestGdbAutotmpTypes(t *testing.T) { if err != nil { t.Fatalf("failed to create file: %v", err) } - cmd := exec.Command(testenv.GoToolPath(t), "build", "-gcflags=all=-N -l", "-o", "a.exe") + cmd := exec.Command(testenv.GoToolPath(t), "build", "-gcflags=all=-N -l", "-o", "a.exe", "main.go") cmd.Dir = dir out, err := testenv.CleanCmdEnv(cmd).CombinedOutput() if err != nil { @@ -474,7 +474,7 @@ func TestGdbConst(t *testing.T) { if err != nil { t.Fatalf("failed to create file: %v", err) } - cmd := exec.Command(testenv.GoToolPath(t), "build", "-gcflags=all=-N -l", "-o", "a.exe") + cmd := exec.Command(testenv.GoToolPath(t), "build", "-gcflags=all=-N -l", "-o", "a.exe", "main.go") cmd.Dir = dir out, err := testenv.CleanCmdEnv(cmd).CombinedOutput() if err != nil { @@ -539,7 +539,7 @@ func TestGdbPanic(t *testing.T) { if err != nil { t.Fatalf("failed to create file: %v", err) } - cmd := exec.Command(testenv.GoToolPath(t), "build", "-o", "a.exe") + cmd := exec.Command(testenv.GoToolPath(t), "build", "-o", "a.exe", "main.go") cmd.Dir = dir out, err := testenv.CleanCmdEnv(cmd).CombinedOutput() if err != nil { diff --git a/src/runtime/runtime1.go b/src/runtime/runtime1.go index c5667e73ad..0c0a31ee6a 100644 --- a/src/runtime/runtime1.go +++ b/src/runtime/runtime1.go @@ -301,6 +301,7 @@ type dbgVar struct { var debug struct { allocfreetrace int32 cgocheck int32 + clobberfree int32 efence int32 gccheckmark int32 gcpacertrace int32 @@ -318,6 +319,7 @@ var debug struct { var dbgvars = []dbgVar{ {"allocfreetrace", &debug.allocfreetrace}, + {"clobberfree", &debug.clobberfree}, {"cgocheck", &debug.cgocheck}, {"efence", &debug.efence}, {"gccheckmark", &debug.gccheckmark}, diff --git a/src/runtime/symtab.go b/src/runtime/symtab.go index 17e342ef69..a7538482dc 100644 --- a/src/runtime/symtab.go +++ b/src/runtime/symtab.go @@ -475,7 +475,7 @@ func FuncForPC(pc uintptr) *Func { } if inldata := funcdata(f, _FUNCDATA_InlTree); inldata != nil { // Note: strict=false so bad PCs (those between functions) don't crash the runtime. - // We just report the preceeding function in that situation. See issue 29735. + // We just report the preceding function in that situation. See issue 29735. // TODO: Perhaps we should report no function at all in that case. // The runtime currently doesn't have function end info, alas. if ix := pcdatavalue1(f, _PCDATA_InlTreeIndex, pc, nil, false); ix >= 0 { diff --git a/src/runtime/sys_windows_amd64.s b/src/runtime/sys_windows_amd64.s index 612f0a474d..43a26497ad 100644 --- a/src/runtime/sys_windows_amd64.s +++ b/src/runtime/sys_windows_amd64.s @@ -351,7 +351,7 @@ TEXT runtime·callbackasm1(SB),NOSPLIT,$0 ADDQ $64, SP POPFQ - MOVL -8(CX)(DX*1), AX // return value + MOVQ -8(CX)(DX*1), AX // return value POPQ -8(CX)(DX*1) // restore bytes just after the args RET diff --git a/src/runtime/syscall_windows_test.go b/src/runtime/syscall_windows_test.go index 3ad6512976..5335c12f0f 100644 --- a/src/runtime/syscall_windows_test.go +++ b/src/runtime/syscall_windows_test.go @@ -655,12 +655,16 @@ uintptr_t cfunc(callback f, uintptr_t n) { r uintptr err syscall.Errno } + want := result{ + // Make it large enough to test issue #29331. + r: (^uintptr(0)) >> 24, + err: 333, + } c := make(chan result) go func() { - r, _, err := proc.Call(cb, 100) + r, _, err := proc.Call(cb, want.r) c <- result{r, err.(syscall.Errno)} }() - want := result{r: 100, err: 333} if got := <-c; got != want { t.Errorf("got %d want %d", got, want) } diff --git a/src/runtime/testdata/testprog/crash.go b/src/runtime/testdata/testprog/crash.go index 4d83132198..c4990cdda9 100644 --- a/src/runtime/testdata/testprog/crash.go +++ b/src/runtime/testdata/testprog/crash.go @@ -11,6 +11,7 @@ import ( func init() { register("Crash", Crash) + register("DoublePanic", DoublePanic) } func test(name string) { @@ -43,3 +44,23 @@ func Crash() { testInNewThread("second-new-thread") test("main-again") } + +type P string + +func (p P) String() string { + // Try to free the "YYY" string header when the "XXX" + // panic is stringified. + runtime.GC() + runtime.GC() + runtime.GC() + return string(p) +} + +// Test that panic message is not clobbered. +// See issue 30150. +func DoublePanic() { + defer func() { + panic(P("YYY")) + }() + panic(P("XXX")) +} diff --git a/src/strconv/atof.go b/src/strconv/atof.go index ada85e9fed..504b9613fb 100644 --- a/src/strconv/atof.go +++ b/src/strconv/atof.go @@ -12,7 +12,7 @@ package strconv import "math" -var optimize = true // can change for testing +var optimize = true // set to false to force slow-path conversions for testing func equalIgnoreCase(s1, s2 string) bool { if len(s1) != len(s2) { @@ -83,6 +83,9 @@ func (b *decimal) set(s string) (ok bool) { sawdigits := false for ; i < len(s); i++ { switch { + case s[i] == '_': + // underscoreOK already called + continue case s[i] == '.': if sawdot { return @@ -119,7 +122,7 @@ func (b *decimal) set(s string) (ok bool) { // just be sure to move the decimal point by // a lot (say, 100000). it doesn't matter if it's // not the exact number. - if i < len(s) && (s[i] == 'e' || s[i] == 'E') { + if i < len(s) && lower(s[i]) == 'e' { i++ if i >= len(s) { return @@ -135,7 +138,11 @@ func (b *decimal) set(s string) (ok bool) { return } e := 0 - for ; i < len(s) && '0' <= s[i] && s[i] <= '9'; i++ { + for ; i < len(s) && ('0' <= s[i] && s[i] <= '9' || s[i] == '_'); i++ { + if s[i] == '_' { + // underscoreOK already called + continue + } if e < 10000 { e = e*10 + int(s[i]) - '0' } @@ -152,10 +159,9 @@ func (b *decimal) set(s string) (ok bool) { } // readFloat reads a decimal mantissa and exponent from a float -// string representation. It sets ok to false if the number could +// string representation. It returns ok==false if the number could // not fit return types or is invalid. -func readFloat(s string) (mantissa uint64, exp int, neg, trunc, ok bool) { - const uint64digits = 19 +func readFloat(s string) (mantissa uint64, exp int, neg, trunc, hex, ok bool) { i := 0 // optional sign @@ -171,6 +177,16 @@ func readFloat(s string) (mantissa uint64, exp int, neg, trunc, ok bool) { } // digits + base := uint64(10) + maxMantDigits := 19 // 10^19 fits in uint64 + expChar := byte('e') + if i+2 < len(s) && s[i] == '0' && lower(s[i+1]) == 'x' { + base = 16 + maxMantDigits = 16 // 16^16 fits in uint64 + i += 2 + expChar = 'p' + hex = true + } sawdot := false sawdigits := false nd := 0 @@ -178,6 +194,10 @@ func readFloat(s string) (mantissa uint64, exp int, neg, trunc, ok bool) { dp := 0 for ; i < len(s); i++ { switch c := s[i]; true { + case c == '_': + // underscoreOK already called + continue + case c == '.': if sawdot { return @@ -193,11 +213,23 @@ func readFloat(s string) (mantissa uint64, exp int, neg, trunc, ok bool) { continue } nd++ - if ndMant < uint64digits { - mantissa *= 10 + if ndMant < maxMantDigits { + mantissa *= base mantissa += uint64(c - '0') ndMant++ - } else if s[i] != '0' { + } else if c != '0' { + trunc = true + } + continue + + case base == 16 && 'a' <= lower(c) && lower(c) <= 'f': + sawdigits = true + nd++ + if ndMant < maxMantDigits { + mantissa *= 16 + mantissa += uint64(lower(c) - 'a' + 10) + ndMant++ + } else { trunc = true } continue @@ -211,12 +243,17 @@ func readFloat(s string) (mantissa uint64, exp int, neg, trunc, ok bool) { dp = nd } + if base == 16 { + dp *= 4 + ndMant *= 4 + } + // optional exponent moves decimal point. // if we read a very large, very long number, // just be sure to move the decimal point by // a lot (say, 100000). it doesn't matter if it's // not the exact number. - if i < len(s) && (s[i] == 'e' || s[i] == 'E') { + if i < len(s) && lower(s[i]) == expChar { i++ if i >= len(s) { return @@ -232,12 +269,19 @@ func readFloat(s string) (mantissa uint64, exp int, neg, trunc, ok bool) { return } e := 0 - for ; i < len(s) && '0' <= s[i] && s[i] <= '9'; i++ { + for ; i < len(s) && ('0' <= s[i] && s[i] <= '9' || s[i] == '_'); i++ { + if s[i] == '_' { + // underscoreOK already called + continue + } if e < 10000 { e = e*10 + int(s[i]) - '0' } } dp += e * esign + } else if base == 16 { + // Must have exponent. + return } if i != len(s) { @@ -249,7 +293,6 @@ func readFloat(s string) (mantissa uint64, exp int, neg, trunc, ok bool) { } ok = true return - } // decimal power of ten to binary power of two. @@ -433,6 +476,76 @@ func atof32exact(mantissa uint64, exp int, neg bool) (f float32, ok bool) { return } +// atofHex converts the hex floating-point string s +// to a rounded float32 or float64 value (depending on flt==&float32info or flt==&float64info) +// and returns it as a float64. +// The string s has already been parsed into a mantissa, exponent, and sign (neg==true for negative). +// If trunc is true, trailing non-zero bits have been omitted from the mantissa. +func atofHex(s string, flt *floatInfo, mantissa uint64, exp int, neg, trunc bool) (float64, error) { + maxExp := 1<>(flt.mantbits+2) == 0 { + mantissa <<= 1 + exp-- + } + if trunc { + mantissa |= 1 + } + for mantissa>>(1+flt.mantbits+2) != 0 { + mantissa = mantissa>>1 | mantissa&1 + exp++ + } + + // If exponent is too negative, + // denormalize in hopes of making it representable. + // (The -2 is for the rounding bits.) + for mantissa > 1 && exp < minExp-2 { + mantissa = mantissa>>1 | mantissa&1 + exp++ + } + + // Round using two bottom bits. + round := mantissa & 3 + mantissa >>= 2 + round |= mantissa & 1 // round to even (round up if mantissa is odd) + exp += 2 + if round == 3 { + mantissa++ + if mantissa == 1<<(1+flt.mantbits) { + mantissa >>= 1 + exp++ + } + } + + if mantissa>>flt.mantbits == 0 { // Denormal or zero. + exp = flt.bias + } + var err error + if exp > maxExp { // infinity and range error + mantissa = 1 << flt.mantbits + exp = maxExp + 1 + err = rangeError(fnParseFloat, s) + } + + bits := mantissa & (1< 1 && (s[1] == 'x' || s[1] == 'X'): - if len(s) < 3 { - return 0, syntaxError(fnParseUint, s0) + base = 10 + if s[0] == '0' { + switch { + case len(s) >= 3 && lower(s[1]) == 'b': + base = 2 + s = s[2:] + case len(s) >= 3 && lower(s[1]) == 'o': + base = 8 + s = s[2:] + case len(s) >= 3 && lower(s[1]) == 'x': + base = 16 + s = s[2:] + default: + base = 8 + s = s[1:] } - base = 16 - s = s[2:] - case s[0] == '0': - base = 8 - s = s[1:] - default: - base = 10 } default: @@ -103,12 +117,13 @@ func ParseUint(s string, base int, bitSize int) (uint64, error) { for _, c := range []byte(s) { var d byte switch { + case c == '_' && base0: + // underscoreOK already called + continue case '0' <= c && c <= '9': d = c - '0' - case 'a' <= c && c <= 'z': - d = c - 'a' + 10 - case 'A' <= c && c <= 'Z': - d = c - 'A' + 10 + case 'a' <= lower(c) && lower(c) <= 'z': + d = lower(c) - 'a' + 10 default: return 0, syntaxError(fnParseUint, s0) } @@ -138,13 +153,14 @@ func ParseUint(s string, base int, bitSize int) (uint64, error) { // bit size (0 to 64) and returns the corresponding value i. // // If base == 0, the base is implied by the string's prefix: -// base 16 for "0x", base 8 for "0", and base 10 otherwise. -// For bases 1, below 0 or above 36 an error is returned. +// base 2 for "0b", base 8 for "0" or "0o", base 16 for "0x", +// and base 10 otherwise. +// If base is below 0, is 1, or is above 36, an error is returned. // // The bitSize argument specifies the integer type // that the result must fit into. Bit sizes 0, 8, 16, 32, and 64 // correspond to int, int8, int16, int32, and int64. -// For a bitSize below 0 or above 64 an error is returned. +// If bitSize is below 0 or above 64, an error is returned. // // The errors that ParseInt returns have concrete type *NumError // and include err.Num = s. If s is empty or contains invalid @@ -156,8 +172,7 @@ func ParseUint(s string, base int, bitSize int) (uint64, error) { func ParseInt(s string, base int, bitSize int) (i int64, err error) { const fnParseInt = "ParseInt" - // Empty string bad. - if len(s) == 0 { + if s == "" { return 0, syntaxError(fnParseInt, s) } @@ -228,10 +243,60 @@ func Atoi(s string) (int, error) { return n, nil } - // Slow path for invalid or big integers. + // Slow path for invalid, big, or underscored integers. i64, err := ParseInt(s, 10, 0) if nerr, ok := err.(*NumError); ok { nerr.Func = fnAtoi } return int(i64), err } + +// underscoreOK reports whether the underscores in s are allowed. +// Checking them in this one function lets all the parsers skip over them simply. +// Underscore must appear only between digits or between a base prefix and a digit. +func underscoreOK(s string) bool { + // saw tracks the last character (class) we saw: + // ^ for beginning of number, + // 0 for a digit or base prefix, + // _ for an underscore, + // ! for none of the above. + saw := '^' + i := 0 + + // Optional sign. + if len(s) >= 1 && (s[0] == '-' || s[0] == '+') { + s = s[1:] + } + + // Optional base prefix. + hex := false + if len(s) >= 2 && s[0] == '0' && (lower(s[1]) == 'b' || lower(s[1]) == 'o' || lower(s[1]) == 'x') { + i = 2 + saw = '0' // base prefix counts as a digit for "underscore as digit separator" + hex = lower(s[1]) == 'x' + } + + // Number proper. + for ; i < len(s); i++ { + // Digits are always okay. + if '0' <= s[i] && s[i] <= '9' || hex && 'a' <= lower(s[i]) && lower(s[i]) <= 'f' { + saw = '0' + continue + } + // Underscore must follow digit. + if s[i] == '_' { + if saw != '0' { + return false + } + saw = '_' + continue + } + // Underscore must also be followed by digit. + if saw == '_' { + return false + } + // Saw non-digit, non-underscore. + saw = '!' + } + return saw != '_' +} diff --git a/src/strconv/atoi_test.go b/src/strconv/atoi_test.go index e2f505a665..8b0576b659 100644 --- a/src/strconv/atoi_test.go +++ b/src/strconv/atoi_test.go @@ -29,6 +29,10 @@ var parseUint64Tests = []parseUint64Test{ {"18446744073709551615", 1<<64 - 1, nil}, {"18446744073709551616", 1<<64 - 1, ErrRange}, {"18446744073709551620", 1<<64 - 1, ErrRange}, + {"1_2_3_4_5", 0, ErrSyntax}, // base=10 so no underscores allowed + {"_12345", 0, ErrSyntax}, + {"1__2345", 0, ErrSyntax}, + {"12345_", 0, ErrSyntax}, } type parseUint64BaseTest struct { @@ -61,6 +65,69 @@ var parseUint64BaseTests = []parseUint64BaseTest{ {"01777777777777777777778", 0, 0, ErrSyntax}, {"02000000000000000000000", 0, 1<<64 - 1, ErrRange}, {"0200000000000000000000", 0, 1 << 61, nil}, + {"0b", 0, 0, ErrSyntax}, + {"0B", 0, 0, ErrSyntax}, + {"0b101", 0, 5, nil}, + {"0B101", 0, 5, nil}, + {"0o", 0, 0, ErrSyntax}, + {"0O", 0, 0, ErrSyntax}, + {"0o377", 0, 255, nil}, + {"0O377", 0, 255, nil}, + + // underscores allowed with base == 0 only + {"1_2_3_4_5", 0, 12345, nil}, // base 0 => 10 + {"_12345", 0, 0, ErrSyntax}, + {"1__2345", 0, 0, ErrSyntax}, + {"12345_", 0, 0, ErrSyntax}, + + {"1_2_3_4_5", 10, 0, ErrSyntax}, // base 10 + {"_12345", 10, 0, ErrSyntax}, + {"1__2345", 10, 0, ErrSyntax}, + {"12345_", 10, 0, ErrSyntax}, + + {"0x_1_2_3_4_5", 0, 0x12345, nil}, // base 0 => 16 + {"_0x12345", 0, 0, ErrSyntax}, + {"0x__12345", 0, 0, ErrSyntax}, + {"0x1__2345", 0, 0, ErrSyntax}, + {"0x1234__5", 0, 0, ErrSyntax}, + {"0x12345_", 0, 0, ErrSyntax}, + + {"1_2_3_4_5", 16, 0, ErrSyntax}, // base 16 + {"_12345", 16, 0, ErrSyntax}, + {"1__2345", 16, 0, ErrSyntax}, + {"1234__5", 16, 0, ErrSyntax}, + {"12345_", 16, 0, ErrSyntax}, + + {"0_1_2_3_4_5", 0, 012345, nil}, // base 0 => 8 (0377) + {"_012345", 0, 0, ErrSyntax}, + {"0__12345", 0, 0, ErrSyntax}, + {"01234__5", 0, 0, ErrSyntax}, + {"012345_", 0, 0, ErrSyntax}, + + {"0o_1_2_3_4_5", 0, 012345, nil}, // base 0 => 8 (0o377) + {"_0o12345", 0, 0, ErrSyntax}, + {"0o__12345", 0, 0, ErrSyntax}, + {"0o1234__5", 0, 0, ErrSyntax}, + {"0o12345_", 0, 0, ErrSyntax}, + + {"0_1_2_3_4_5", 8, 0, ErrSyntax}, // base 8 + {"_012345", 8, 0, ErrSyntax}, + {"0__12345", 8, 0, ErrSyntax}, + {"01234__5", 8, 0, ErrSyntax}, + {"012345_", 8, 0, ErrSyntax}, + + {"0b_1_0_1", 0, 5, nil}, // base 0 => 2 (0b101) + {"_0b101", 0, 0, ErrSyntax}, + {"0b__101", 0, 0, ErrSyntax}, + {"0b1__01", 0, 0, ErrSyntax}, + {"0b10__1", 0, 0, ErrSyntax}, + {"0b101_", 0, 0, ErrSyntax}, + + {"1_0_1", 2, 0, ErrSyntax}, // base 2 + {"_101", 2, 0, ErrSyntax}, + {"1_01", 2, 0, ErrSyntax}, + {"10_1", 2, 0, ErrSyntax}, + {"101_", 2, 0, ErrSyntax}, } type parseInt64Test struct { @@ -87,6 +154,11 @@ var parseInt64Tests = []parseInt64Test{ {"-9223372036854775808", -1 << 63, nil}, {"9223372036854775809", 1<<63 - 1, ErrRange}, {"-9223372036854775809", -1 << 63, ErrRange}, + {"-1_2_3_4_5", 0, ErrSyntax}, // base=10 so no underscores allowed + {"-_12345", 0, ErrSyntax}, + {"_12345", 0, ErrSyntax}, + {"1__2345", 0, ErrSyntax}, + {"12345_", 0, ErrSyntax}, } type parseInt64BaseTest struct { @@ -144,6 +216,26 @@ var parseInt64BaseTests = []parseInt64BaseTest{ {"10", 16, 16, nil}, {"-123456789abcdef", 16, -0x123456789abcdef, nil}, {"7fffffffffffffff", 16, 1<<63 - 1, nil}, + + // underscores + {"-0x_1_2_3_4_5", 0, -0x12345, nil}, + {"0x_1_2_3_4_5", 0, 0x12345, nil}, + {"-_0x12345", 0, 0, ErrSyntax}, + {"_-0x12345", 0, 0, ErrSyntax}, + {"_0x12345", 0, 0, ErrSyntax}, + {"0x__12345", 0, 0, ErrSyntax}, + {"0x1__2345", 0, 0, ErrSyntax}, + {"0x1234__5", 0, 0, ErrSyntax}, + {"0x12345_", 0, 0, ErrSyntax}, + + {"-0_1_2_3_4_5", 0, -012345, nil}, // octal + {"0_1_2_3_4_5", 0, 012345, nil}, // octal + {"-_012345", 0, 0, ErrSyntax}, + {"_-012345", 0, 0, ErrSyntax}, + {"_012345", 0, 0, ErrSyntax}, + {"0__12345", 0, 0, ErrSyntax}, + {"01234__5", 0, 0, ErrSyntax}, + {"012345_", 0, 0, ErrSyntax}, } type parseUint32Test struct { @@ -162,6 +254,11 @@ var parseUint32Tests = []parseUint32Test{ {"987654321", 987654321, nil}, {"4294967295", 1<<32 - 1, nil}, {"4294967296", 1<<32 - 1, ErrRange}, + {"1_2_3_4_5", 0, ErrSyntax}, // base=10 so no underscores allowed + {"_12345", 0, ErrSyntax}, + {"_12345", 0, ErrSyntax}, + {"1__2345", 0, ErrSyntax}, + {"12345_", 0, ErrSyntax}, } type parseInt32Test struct { @@ -190,6 +287,11 @@ var parseInt32Tests = []parseInt32Test{ {"-2147483648", -1 << 31, nil}, {"2147483649", 1<<31 - 1, ErrRange}, {"-2147483649", -1 << 31, ErrRange}, + {"-1_2_3_4_5", 0, ErrSyntax}, // base=10 so no underscores allowed + {"-_12345", 0, ErrSyntax}, + {"_12345", 0, ErrSyntax}, + {"1__2345", 0, ErrSyntax}, + {"12345_", 0, ErrSyntax}, } type numErrorTest struct { diff --git a/src/strconv/ftoa.go b/src/strconv/ftoa.go index a7ccbe6727..432521b24f 100644 --- a/src/strconv/ftoa.go +++ b/src/strconv/ftoa.go @@ -32,12 +32,14 @@ var float64info = floatInfo{52, 11, -1023} // 'e' (-d.dddde±dd, a decimal exponent), // 'E' (-d.ddddE±dd, a decimal exponent), // 'f' (-ddd.dddd, no exponent), -// 'g' ('e' for large exponents, 'f' otherwise), or -// 'G' ('E' for large exponents, 'f' otherwise). +// 'g' ('e' for large exponents, 'f' otherwise), +// 'G' ('E' for large exponents, 'f' otherwise), +// 'x' (-0xd.ddddp±ddd, a hexadecimal fraction and binary exponent), or +// 'X' (-0Xd.ddddP±ddd, a hexadecimal fraction and binary exponent). // // The precision prec controls the number of digits (excluding the exponent) -// printed by the 'e', 'E', 'f', 'g', and 'G' formats. -// For 'e', 'E', and 'f' it is the number of digits after the decimal point. +// printed by the 'e', 'E', 'f', 'g', 'G', 'x', and 'X' formats. +// For 'e', 'E', 'f', 'x', and 'X', it is the number of digits after the decimal point. // For 'g' and 'G' it is the maximum number of significant digits (trailing // zeros are removed). // The special precision -1 uses the smallest number of digits @@ -94,10 +96,13 @@ func genericFtoa(dst []byte, val float64, fmt byte, prec, bitSize int) []byte { } exp += flt.bias - // Pick off easy binary format. + // Pick off easy binary, hex formats. if fmt == 'b' { return fmtB(dst, neg, mant, exp, flt) } + if fmt == 'x' || fmt == 'X' { + return fmtX(dst, prec, fmt, neg, mant, exp, flt) + } if !optimize { return bigFtoa(dst, prec, fmt, neg, mant, exp, flt) @@ -439,6 +444,89 @@ func fmtB(dst []byte, neg bool, mant uint64, exp int, flt *floatInfo) []byte { return dst } +// %x: -0x1.yyyyyyyyp±ddd or -0x0p+0. (y is hex digit, d is decimal digit) +func fmtX(dst []byte, prec int, fmt byte, neg bool, mant uint64, exp int, flt *floatInfo) []byte { + if mant == 0 { + exp = 0 + } + + // Shift digits so leading 1 (if any) is at bit 1<<60. + mant <<= 60 - flt.mantbits + for mant != 0 && mant&(1<<60) == 0 { + mant <<= 1 + exp-- + } + + // Round if requested. + if prec >= 0 && prec < 15 { + shift := uint(prec * 4) + extra := (mant << shift) & (1<<60 - 1) + mant >>= 60 - shift + if extra|(mant&1) > 1<<59 { + mant++ + } + mant <<= 60 - shift + if mant&(1<<61) != 0 { + // Wrapped around. + mant >>= 1 + exp++ + } + } + + hex := lowerhex + if fmt == 'X' { + hex = upperhex + } + + // sign, 0x, leading digit + if neg { + dst = append(dst, '-') + } + dst = append(dst, '0', fmt, '0'+byte((mant>>60)&1)) + + // .fraction + mant <<= 4 // remove leading 0 or 1 + if prec < 0 && mant != 0 { + dst = append(dst, '.') + for mant != 0 { + dst = append(dst, hex[(mant>>60)&15]) + mant <<= 4 + } + } else if prec > 0 { + dst = append(dst, '.') + for i := 0; i < prec; i++ { + dst = append(dst, hex[(mant>>60)&15]) + mant <<= 4 + } + } + + // p± + ch := byte('P') + if fmt == lower(fmt) { + ch = 'p' + } + dst = append(dst, ch) + if exp < 0 { + ch = '-' + exp = -exp + } else { + ch = '+' + } + dst = append(dst, ch) + + // dd or ddd or dddd + switch { + case exp < 100: + dst = append(dst, byte(exp/10)+'0', byte(exp%10)+'0') + case exp < 1000: + dst = append(dst, byte(exp/100)+'0', byte((exp/10)%10)+'0', byte(exp%10)+'0') + default: + dst = append(dst, byte(exp/1000)+'0', byte(exp/100)%10+'0', byte((exp/10)%10)+'0', byte(exp%10)+'0') + } + + return dst +} + func min(a, b int) int { if a < b { return a diff --git a/src/strconv/ftoa_test.go b/src/strconv/ftoa_test.go index 1d3030be81..055fef99aa 100644 --- a/src/strconv/ftoa_test.go +++ b/src/strconv/ftoa_test.go @@ -30,9 +30,15 @@ var ftoatests = []ftoaTest{ {1, 'f', 5, "1.00000"}, {1, 'g', 5, "1"}, {1, 'g', -1, "1"}, + {1, 'x', -1, "0x1p+00"}, + {1, 'x', 5, "0x1.00000p+00"}, {20, 'g', -1, "20"}, + {20, 'x', -1, "0x1.4p+04"}, {1234567.8, 'g', -1, "1.2345678e+06"}, + {1234567.8, 'x', -1, "0x1.2d687cccccccdp+20"}, {200000, 'g', -1, "200000"}, + {200000, 'x', -1, "0x1.86ap+17"}, + {200000, 'X', -1, "0X1.86AP+17"}, {2000000, 'g', -1, "2e+06"}, // g conversion and zero suppression @@ -50,6 +56,7 @@ var ftoatests = []ftoaTest{ {0, 'f', 5, "0.00000"}, {0, 'g', 5, "0"}, {0, 'g', -1, "0"}, + {0, 'x', 5, "0x0.00000p+00"}, {-1, 'e', 5, "-1.00000e+00"}, {-1, 'f', 5, "-1.00000"}, @@ -100,7 +107,8 @@ var ftoatests = []ftoaTest{ {32, 'g', -1, "32"}, {32, 'g', 0, "3e+01"}, - {100, 'x', -1, "%x"}, + {100, 'x', -1, "0x1.9p+06"}, + {100, 'y', -1, "%y"}, {math.NaN(), 'g', -1, "NaN"}, {-math.NaN(), 'g', -1, "NaN"}, @@ -128,6 +136,23 @@ var ftoatests = []ftoaTest{ // Issue 2625. {383260575764816448, 'f', 0, "383260575764816448"}, {383260575764816448, 'g', -1, "3.8326057576481645e+17"}, + + // rounding + {2.275555555555555, 'x', -1, "0x1.23456789abcdep+01"}, + {2.275555555555555, 'x', 0, "0x1p+01"}, + {2.275555555555555, 'x', 2, "0x1.23p+01"}, + {2.275555555555555, 'x', 16, "0x1.23456789abcde000p+01"}, + {2.275555555555555, 'x', 21, "0x1.23456789abcde00000000p+01"}, + {2.2755555510520935, 'x', -1, "0x1.2345678p+01"}, + {2.2755555510520935, 'x', 6, "0x1.234568p+01"}, + {2.275555431842804, 'x', -1, "0x1.2345668p+01"}, + {2.275555431842804, 'x', 6, "0x1.234566p+01"}, + {3.999969482421875, 'x', -1, "0x1.ffffp+01"}, + {3.999969482421875, 'x', 4, "0x1.ffffp+01"}, + {3.999969482421875, 'x', 3, "0x1.000p+02"}, + {3.999969482421875, 'x', 2, "0x1.00p+02"}, + {3.999969482421875, 'x', 1, "0x1.0p+02"}, + {3.999969482421875, 'x', 0, "0x1p+02"}, } func TestFtoa(t *testing.T) { diff --git a/src/strconv/quote.go b/src/strconv/quote.go index 6cd2f93068..d8a1ed9ecc 100644 --- a/src/strconv/quote.go +++ b/src/strconv/quote.go @@ -11,7 +11,10 @@ import ( "unicode/utf8" ) -const lowerhex = "0123456789abcdef" +const ( + lowerhex = "0123456789abcdef" + upperhex = "0123456789ABCDEF" +) func quoteWith(s string, quote byte, ASCIIonly, graphicOnly bool) string { return string(appendQuotedWith(make([]byte, 0, 3*len(s)/2), s, quote, ASCIIonly, graphicOnly)) diff --git a/src/sync/atomic/doc.go b/src/sync/atomic/doc.go index 7c007d7a15..108b76b804 100644 --- a/src/sync/atomic/doc.go +++ b/src/sync/atomic/doc.go @@ -47,7 +47,8 @@ import ( // // On non-Linux ARM, the 64-bit functions use instructions unavailable before the ARMv6k core. // -// On both ARM and x86-32, it is the caller's responsibility to arrange for 64-bit +// On ARM, x86-32, and 32-bit MIPS, +// it is the caller's responsibility to arrange for 64-bit // alignment of 64-bit words accessed atomically. The first word in a // variable or in an allocated struct, array, or slice can be relied upon to be // 64-bit aligned. diff --git a/src/syscall/mksyscall.pl b/src/syscall/mksyscall.pl index 079b08dcb9..667ca54c02 100755 --- a/src/syscall/mksyscall.pl +++ b/src/syscall/mksyscall.pl @@ -350,7 +350,7 @@ while(<>) { $text .= "//go:linkname $funcname $funcname\n"; # Tell the linker that funcname can be found in libSystem using varname without the libc_ prefix. my $basename = substr $funcname, 5; - $text .= "//go:cgo_import_dynamic $funcname $basename \"/usr/lib/libSystem.B.dylib\"\n"; + $text .= "//go:cgo_import_dynamic $funcname $basename \"/usr/lib/libSystem.B.dylib\"\n\n"; } } } diff --git a/src/syscall/syscall_aix.go b/src/syscall/syscall_aix.go index 6512761c33..ea88c666be 100644 --- a/src/syscall/syscall_aix.go +++ b/src/syscall/syscall_aix.go @@ -388,7 +388,7 @@ func SendmsgN(fd int, p, oob []byte, to Sockaddr, flags int) (n int, err error) func (sa *RawSockaddrUnix) getLen() (int, error) { // Some versions of AIX have a bug in getsockname (see IV78655). // We can't rely on sa.Len being set correctly. - n := SizeofSockaddrUnix - 3 // substract leading Family, Len, terminating NUL. + n := SizeofSockaddrUnix - 3 // subtract leading Family, Len, terminating NUL. for i := 0; i < n; i++ { if sa.Path[i] == 0 { n = i diff --git a/src/syscall/syscall_linux_test.go b/src/syscall/syscall_linux_test.go index 293549a841..8a578639bd 100644 --- a/src/syscall/syscall_linux_test.go +++ b/src/syscall/syscall_linux_test.go @@ -360,10 +360,23 @@ func TestSyscallNoError(t *testing.T) { strconv.FormatUint(uint64(-uid), 10) + " / " + strconv.FormatUint(uint64(uid), 10) if got != want { + if filesystemIsNoSUID(tmpBinary) { + t.Skip("skipping test when temp dir is mounted nosuid") + } t.Errorf("expected %s, got %s", want, got) } } +// filesystemIsNoSUID reports whether the filesystem for the given +// path is mounted nosuid. +func filesystemIsNoSUID(path string) bool { + var st syscall.Statfs_t + if syscall.Statfs(path, &st) != nil { + return false + } + return st.Flags&syscall.MS_NOSUID != 0 +} + func syscallNoError() { // Test that the return value from SYS_GETEUID32 (which cannot fail) // doesn't get treated as an error (see https://golang.org/issue/22924) diff --git a/src/syscall/zsyscall_darwin_386.go b/src/syscall/zsyscall_darwin_386.go index 758ff7b129..7f783eb40d 100644 --- a/src/syscall/zsyscall_darwin_386.go +++ b/src/syscall/zsyscall_darwin_386.go @@ -22,6 +22,7 @@ func libc_getgroups_trampoline() //go:linkname libc_getgroups libc_getgroups //go:cgo_import_dynamic libc_getgroups getgroups "/usr/lib/libSystem.B.dylib" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func setgroups(ngid int, gid *_Gid_t) (err error) { @@ -36,6 +37,7 @@ func libc_setgroups_trampoline() //go:linkname libc_setgroups libc_setgroups //go:cgo_import_dynamic libc_setgroups setgroups "/usr/lib/libSystem.B.dylib" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func wait4(pid int, wstatus *_C_int, options int, rusage *Rusage) (wpid int, err error) { @@ -51,6 +53,7 @@ func libc_wait4_trampoline() //go:linkname libc_wait4 libc_wait4 //go:cgo_import_dynamic libc_wait4 wait4 "/usr/lib/libSystem.B.dylib" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func accept(s int, rsa *RawSockaddrAny, addrlen *_Socklen) (fd int, err error) { @@ -66,6 +69,7 @@ func libc_accept_trampoline() //go:linkname libc_accept libc_accept //go:cgo_import_dynamic libc_accept accept "/usr/lib/libSystem.B.dylib" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func bind(s int, addr unsafe.Pointer, addrlen _Socklen) (err error) { @@ -80,6 +84,7 @@ func libc_bind_trampoline() //go:linkname libc_bind libc_bind //go:cgo_import_dynamic libc_bind bind "/usr/lib/libSystem.B.dylib" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func connect(s int, addr unsafe.Pointer, addrlen _Socklen) (err error) { @@ -94,6 +99,7 @@ func libc_connect_trampoline() //go:linkname libc_connect libc_connect //go:cgo_import_dynamic libc_connect connect "/usr/lib/libSystem.B.dylib" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func socket(domain int, typ int, proto int) (fd int, err error) { @@ -109,6 +115,7 @@ func libc_socket_trampoline() //go:linkname libc_socket libc_socket //go:cgo_import_dynamic libc_socket socket "/usr/lib/libSystem.B.dylib" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func getsockopt(s int, level int, name int, val unsafe.Pointer, vallen *_Socklen) (err error) { @@ -123,6 +130,7 @@ func libc_getsockopt_trampoline() //go:linkname libc_getsockopt libc_getsockopt //go:cgo_import_dynamic libc_getsockopt getsockopt "/usr/lib/libSystem.B.dylib" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func setsockopt(s int, level int, name int, val unsafe.Pointer, vallen uintptr) (err error) { @@ -137,6 +145,7 @@ func libc_setsockopt_trampoline() //go:linkname libc_setsockopt libc_setsockopt //go:cgo_import_dynamic libc_setsockopt setsockopt "/usr/lib/libSystem.B.dylib" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func getpeername(fd int, rsa *RawSockaddrAny, addrlen *_Socklen) (err error) { @@ -151,6 +160,7 @@ func libc_getpeername_trampoline() //go:linkname libc_getpeername libc_getpeername //go:cgo_import_dynamic libc_getpeername getpeername "/usr/lib/libSystem.B.dylib" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func getsockname(fd int, rsa *RawSockaddrAny, addrlen *_Socklen) (err error) { @@ -165,6 +175,7 @@ func libc_getsockname_trampoline() //go:linkname libc_getsockname libc_getsockname //go:cgo_import_dynamic libc_getsockname getsockname "/usr/lib/libSystem.B.dylib" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Shutdown(s int, how int) (err error) { @@ -179,6 +190,7 @@ func libc_shutdown_trampoline() //go:linkname libc_shutdown libc_shutdown //go:cgo_import_dynamic libc_shutdown shutdown "/usr/lib/libSystem.B.dylib" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func socketpair(domain int, typ int, proto int, fd *[2]int32) (err error) { @@ -193,6 +205,7 @@ func libc_socketpair_trampoline() //go:linkname libc_socketpair libc_socketpair //go:cgo_import_dynamic libc_socketpair socketpair "/usr/lib/libSystem.B.dylib" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func recvfrom(fd int, p []byte, flags int, from *RawSockaddrAny, fromlen *_Socklen) (n int, err error) { @@ -214,6 +227,7 @@ func libc_recvfrom_trampoline() //go:linkname libc_recvfrom libc_recvfrom //go:cgo_import_dynamic libc_recvfrom recvfrom "/usr/lib/libSystem.B.dylib" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func sendto(s int, buf []byte, flags int, to unsafe.Pointer, addrlen _Socklen) (err error) { @@ -234,6 +248,7 @@ func libc_sendto_trampoline() //go:linkname libc_sendto libc_sendto //go:cgo_import_dynamic libc_sendto sendto "/usr/lib/libSystem.B.dylib" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func recvmsg(s int, msg *Msghdr, flags int) (n int, err error) { @@ -249,6 +264,7 @@ func libc_recvmsg_trampoline() //go:linkname libc_recvmsg libc_recvmsg //go:cgo_import_dynamic libc_recvmsg recvmsg "/usr/lib/libSystem.B.dylib" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func sendmsg(s int, msg *Msghdr, flags int) (n int, err error) { @@ -264,6 +280,7 @@ func libc_sendmsg_trampoline() //go:linkname libc_sendmsg libc_sendmsg //go:cgo_import_dynamic libc_sendmsg sendmsg "/usr/lib/libSystem.B.dylib" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func kevent(kq int, change unsafe.Pointer, nchange int, event unsafe.Pointer, nevent int, timeout *Timespec) (n int, err error) { @@ -279,6 +296,7 @@ func libc_kevent_trampoline() //go:linkname libc_kevent libc_kevent //go:cgo_import_dynamic libc_kevent kevent "/usr/lib/libSystem.B.dylib" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func utimes(path string, timeval *[2]Timeval) (err error) { @@ -298,6 +316,7 @@ func libc_utimes_trampoline() //go:linkname libc_utimes libc_utimes //go:cgo_import_dynamic libc_utimes utimes "/usr/lib/libSystem.B.dylib" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func futimes(fd int, timeval *[2]Timeval) (err error) { @@ -312,6 +331,7 @@ func libc_futimes_trampoline() //go:linkname libc_futimes libc_futimes //go:cgo_import_dynamic libc_futimes futimes "/usr/lib/libSystem.B.dylib" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func fcntl(fd int, cmd int, arg int) (val int, err error) { @@ -327,6 +347,7 @@ func libc_fcntl_trampoline() //go:linkname libc_fcntl libc_fcntl //go:cgo_import_dynamic libc_fcntl fcntl "/usr/lib/libSystem.B.dylib" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func ptrace(request int, pid int, addr uintptr, data uintptr) (err error) { @@ -341,6 +362,7 @@ func libc_ptrace_trampoline() //go:linkname libc_ptrace libc_ptrace //go:cgo_import_dynamic libc_ptrace ptrace "/usr/lib/libSystem.B.dylib" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func pipe(p *[2]int32) (err error) { @@ -355,6 +377,7 @@ func libc_pipe_trampoline() //go:linkname libc_pipe libc_pipe //go:cgo_import_dynamic libc_pipe pipe "/usr/lib/libSystem.B.dylib" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func kill(pid int, signum int, posix int) (err error) { @@ -369,6 +392,7 @@ func libc_kill_trampoline() //go:linkname libc_kill libc_kill //go:cgo_import_dynamic libc_kill kill "/usr/lib/libSystem.B.dylib" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Access(path string, mode uint32) (err error) { @@ -388,6 +412,7 @@ func libc_access_trampoline() //go:linkname libc_access libc_access //go:cgo_import_dynamic libc_access access "/usr/lib/libSystem.B.dylib" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Adjtime(delta *Timeval, olddelta *Timeval) (err error) { @@ -402,6 +427,7 @@ func libc_adjtime_trampoline() //go:linkname libc_adjtime libc_adjtime //go:cgo_import_dynamic libc_adjtime adjtime "/usr/lib/libSystem.B.dylib" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Chdir(path string) (err error) { @@ -421,6 +447,7 @@ func libc_chdir_trampoline() //go:linkname libc_chdir libc_chdir //go:cgo_import_dynamic libc_chdir chdir "/usr/lib/libSystem.B.dylib" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Chflags(path string, flags int) (err error) { @@ -440,6 +467,7 @@ func libc_chflags_trampoline() //go:linkname libc_chflags libc_chflags //go:cgo_import_dynamic libc_chflags chflags "/usr/lib/libSystem.B.dylib" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Chmod(path string, mode uint32) (err error) { @@ -459,6 +487,7 @@ func libc_chmod_trampoline() //go:linkname libc_chmod libc_chmod //go:cgo_import_dynamic libc_chmod chmod "/usr/lib/libSystem.B.dylib" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Chown(path string, uid int, gid int) (err error) { @@ -478,6 +507,7 @@ func libc_chown_trampoline() //go:linkname libc_chown libc_chown //go:cgo_import_dynamic libc_chown chown "/usr/lib/libSystem.B.dylib" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Chroot(path string) (err error) { @@ -497,6 +527,7 @@ func libc_chroot_trampoline() //go:linkname libc_chroot libc_chroot //go:cgo_import_dynamic libc_chroot chroot "/usr/lib/libSystem.B.dylib" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Close(fd int) (err error) { @@ -511,6 +542,7 @@ func libc_close_trampoline() //go:linkname libc_close libc_close //go:cgo_import_dynamic libc_close close "/usr/lib/libSystem.B.dylib" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Dup(fd int) (nfd int, err error) { @@ -526,6 +558,7 @@ func libc_dup_trampoline() //go:linkname libc_dup libc_dup //go:cgo_import_dynamic libc_dup dup "/usr/lib/libSystem.B.dylib" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Dup2(from int, to int) (err error) { @@ -540,6 +573,7 @@ func libc_dup2_trampoline() //go:linkname libc_dup2 libc_dup2 //go:cgo_import_dynamic libc_dup2 dup2 "/usr/lib/libSystem.B.dylib" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Exchangedata(path1 string, path2 string, options int) (err error) { @@ -564,6 +598,7 @@ func libc_exchangedata_trampoline() //go:linkname libc_exchangedata libc_exchangedata //go:cgo_import_dynamic libc_exchangedata exchangedata "/usr/lib/libSystem.B.dylib" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Fchdir(fd int) (err error) { @@ -578,6 +613,7 @@ func libc_fchdir_trampoline() //go:linkname libc_fchdir libc_fchdir //go:cgo_import_dynamic libc_fchdir fchdir "/usr/lib/libSystem.B.dylib" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Fchflags(fd int, flags int) (err error) { @@ -592,6 +628,7 @@ func libc_fchflags_trampoline() //go:linkname libc_fchflags libc_fchflags //go:cgo_import_dynamic libc_fchflags fchflags "/usr/lib/libSystem.B.dylib" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Fchmod(fd int, mode uint32) (err error) { @@ -606,6 +643,7 @@ func libc_fchmod_trampoline() //go:linkname libc_fchmod libc_fchmod //go:cgo_import_dynamic libc_fchmod fchmod "/usr/lib/libSystem.B.dylib" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Fchown(fd int, uid int, gid int) (err error) { @@ -620,6 +658,7 @@ func libc_fchown_trampoline() //go:linkname libc_fchown libc_fchown //go:cgo_import_dynamic libc_fchown fchown "/usr/lib/libSystem.B.dylib" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Flock(fd int, how int) (err error) { @@ -634,6 +673,7 @@ func libc_flock_trampoline() //go:linkname libc_flock libc_flock //go:cgo_import_dynamic libc_flock flock "/usr/lib/libSystem.B.dylib" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Fpathconf(fd int, name int) (val int, err error) { @@ -649,6 +689,7 @@ func libc_fpathconf_trampoline() //go:linkname libc_fpathconf libc_fpathconf //go:cgo_import_dynamic libc_fpathconf fpathconf "/usr/lib/libSystem.B.dylib" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Fsync(fd int) (err error) { @@ -663,6 +704,7 @@ func libc_fsync_trampoline() //go:linkname libc_fsync libc_fsync //go:cgo_import_dynamic libc_fsync fsync "/usr/lib/libSystem.B.dylib" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Ftruncate(fd int, length int64) (err error) { @@ -677,6 +719,7 @@ func libc_ftruncate_trampoline() //go:linkname libc_ftruncate libc_ftruncate //go:cgo_import_dynamic libc_ftruncate ftruncate "/usr/lib/libSystem.B.dylib" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Getdtablesize() (size int) { @@ -689,6 +732,7 @@ func libc_getdtablesize_trampoline() //go:linkname libc_getdtablesize libc_getdtablesize //go:cgo_import_dynamic libc_getdtablesize getdtablesize "/usr/lib/libSystem.B.dylib" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Getegid() (egid int) { @@ -701,6 +745,7 @@ func libc_getegid_trampoline() //go:linkname libc_getegid libc_getegid //go:cgo_import_dynamic libc_getegid getegid "/usr/lib/libSystem.B.dylib" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Geteuid() (uid int) { @@ -713,6 +758,7 @@ func libc_geteuid_trampoline() //go:linkname libc_geteuid libc_geteuid //go:cgo_import_dynamic libc_geteuid geteuid "/usr/lib/libSystem.B.dylib" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Getgid() (gid int) { @@ -725,6 +771,7 @@ func libc_getgid_trampoline() //go:linkname libc_getgid libc_getgid //go:cgo_import_dynamic libc_getgid getgid "/usr/lib/libSystem.B.dylib" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Getpgid(pid int) (pgid int, err error) { @@ -740,6 +787,7 @@ func libc_getpgid_trampoline() //go:linkname libc_getpgid libc_getpgid //go:cgo_import_dynamic libc_getpgid getpgid "/usr/lib/libSystem.B.dylib" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Getpgrp() (pgrp int) { @@ -752,6 +800,7 @@ func libc_getpgrp_trampoline() //go:linkname libc_getpgrp libc_getpgrp //go:cgo_import_dynamic libc_getpgrp getpgrp "/usr/lib/libSystem.B.dylib" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Getpid() (pid int) { @@ -764,6 +813,7 @@ func libc_getpid_trampoline() //go:linkname libc_getpid libc_getpid //go:cgo_import_dynamic libc_getpid getpid "/usr/lib/libSystem.B.dylib" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Getppid() (ppid int) { @@ -776,6 +826,7 @@ func libc_getppid_trampoline() //go:linkname libc_getppid libc_getppid //go:cgo_import_dynamic libc_getppid getppid "/usr/lib/libSystem.B.dylib" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Getpriority(which int, who int) (prio int, err error) { @@ -791,6 +842,7 @@ func libc_getpriority_trampoline() //go:linkname libc_getpriority libc_getpriority //go:cgo_import_dynamic libc_getpriority getpriority "/usr/lib/libSystem.B.dylib" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Getrlimit(which int, lim *Rlimit) (err error) { @@ -805,6 +857,7 @@ func libc_getrlimit_trampoline() //go:linkname libc_getrlimit libc_getrlimit //go:cgo_import_dynamic libc_getrlimit getrlimit "/usr/lib/libSystem.B.dylib" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Getrusage(who int, rusage *Rusage) (err error) { @@ -819,6 +872,7 @@ func libc_getrusage_trampoline() //go:linkname libc_getrusage libc_getrusage //go:cgo_import_dynamic libc_getrusage getrusage "/usr/lib/libSystem.B.dylib" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Getsid(pid int) (sid int, err error) { @@ -834,6 +888,7 @@ func libc_getsid_trampoline() //go:linkname libc_getsid libc_getsid //go:cgo_import_dynamic libc_getsid getsid "/usr/lib/libSystem.B.dylib" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Getuid() (uid int) { @@ -846,6 +901,7 @@ func libc_getuid_trampoline() //go:linkname libc_getuid libc_getuid //go:cgo_import_dynamic libc_getuid getuid "/usr/lib/libSystem.B.dylib" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Issetugid() (tainted bool) { @@ -858,6 +914,7 @@ func libc_issetugid_trampoline() //go:linkname libc_issetugid libc_issetugid //go:cgo_import_dynamic libc_issetugid issetugid "/usr/lib/libSystem.B.dylib" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Kqueue() (fd int, err error) { @@ -873,6 +930,7 @@ func libc_kqueue_trampoline() //go:linkname libc_kqueue libc_kqueue //go:cgo_import_dynamic libc_kqueue kqueue "/usr/lib/libSystem.B.dylib" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Lchown(path string, uid int, gid int) (err error) { @@ -892,6 +950,7 @@ func libc_lchown_trampoline() //go:linkname libc_lchown libc_lchown //go:cgo_import_dynamic libc_lchown lchown "/usr/lib/libSystem.B.dylib" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Link(path string, link string) (err error) { @@ -916,6 +975,7 @@ func libc_link_trampoline() //go:linkname libc_link libc_link //go:cgo_import_dynamic libc_link link "/usr/lib/libSystem.B.dylib" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Listen(s int, backlog int) (err error) { @@ -930,6 +990,7 @@ func libc_listen_trampoline() //go:linkname libc_listen libc_listen //go:cgo_import_dynamic libc_listen listen "/usr/lib/libSystem.B.dylib" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Mkdir(path string, mode uint32) (err error) { @@ -949,6 +1010,7 @@ func libc_mkdir_trampoline() //go:linkname libc_mkdir libc_mkdir //go:cgo_import_dynamic libc_mkdir mkdir "/usr/lib/libSystem.B.dylib" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Mkfifo(path string, mode uint32) (err error) { @@ -968,6 +1030,7 @@ func libc_mkfifo_trampoline() //go:linkname libc_mkfifo libc_mkfifo //go:cgo_import_dynamic libc_mkfifo mkfifo "/usr/lib/libSystem.B.dylib" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Mknod(path string, mode uint32, dev int) (err error) { @@ -987,6 +1050,7 @@ func libc_mknod_trampoline() //go:linkname libc_mknod libc_mknod //go:cgo_import_dynamic libc_mknod mknod "/usr/lib/libSystem.B.dylib" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Mlock(b []byte) (err error) { @@ -1007,6 +1071,7 @@ func libc_mlock_trampoline() //go:linkname libc_mlock libc_mlock //go:cgo_import_dynamic libc_mlock mlock "/usr/lib/libSystem.B.dylib" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Mlockall(flags int) (err error) { @@ -1021,6 +1086,7 @@ func libc_mlockall_trampoline() //go:linkname libc_mlockall libc_mlockall //go:cgo_import_dynamic libc_mlockall mlockall "/usr/lib/libSystem.B.dylib" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Mprotect(b []byte, prot int) (err error) { @@ -1041,6 +1107,7 @@ func libc_mprotect_trampoline() //go:linkname libc_mprotect libc_mprotect //go:cgo_import_dynamic libc_mprotect mprotect "/usr/lib/libSystem.B.dylib" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Munlock(b []byte) (err error) { @@ -1061,6 +1128,7 @@ func libc_munlock_trampoline() //go:linkname libc_munlock libc_munlock //go:cgo_import_dynamic libc_munlock munlock "/usr/lib/libSystem.B.dylib" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Munlockall() (err error) { @@ -1075,6 +1143,7 @@ func libc_munlockall_trampoline() //go:linkname libc_munlockall libc_munlockall //go:cgo_import_dynamic libc_munlockall munlockall "/usr/lib/libSystem.B.dylib" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Open(path string, mode int, perm uint32) (fd int, err error) { @@ -1095,6 +1164,7 @@ func libc_open_trampoline() //go:linkname libc_open libc_open //go:cgo_import_dynamic libc_open open "/usr/lib/libSystem.B.dylib" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Pathconf(path string, name int) (val int, err error) { @@ -1115,6 +1185,7 @@ func libc_pathconf_trampoline() //go:linkname libc_pathconf libc_pathconf //go:cgo_import_dynamic libc_pathconf pathconf "/usr/lib/libSystem.B.dylib" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Pread(fd int, p []byte, offset int64) (n int, err error) { @@ -1136,6 +1207,7 @@ func libc_pread_trampoline() //go:linkname libc_pread libc_pread //go:cgo_import_dynamic libc_pread pread "/usr/lib/libSystem.B.dylib" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Pwrite(fd int, p []byte, offset int64) (n int, err error) { @@ -1157,6 +1229,7 @@ func libc_pwrite_trampoline() //go:linkname libc_pwrite libc_pwrite //go:cgo_import_dynamic libc_pwrite pwrite "/usr/lib/libSystem.B.dylib" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func read(fd int, p []byte) (n int, err error) { @@ -1178,6 +1251,7 @@ func libc_read_trampoline() //go:linkname libc_read libc_read //go:cgo_import_dynamic libc_read read "/usr/lib/libSystem.B.dylib" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Readlink(path string, buf []byte) (n int, err error) { @@ -1204,6 +1278,7 @@ func libc_readlink_trampoline() //go:linkname libc_readlink libc_readlink //go:cgo_import_dynamic libc_readlink readlink "/usr/lib/libSystem.B.dylib" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Rename(from string, to string) (err error) { @@ -1228,6 +1303,7 @@ func libc_rename_trampoline() //go:linkname libc_rename libc_rename //go:cgo_import_dynamic libc_rename rename "/usr/lib/libSystem.B.dylib" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Revoke(path string) (err error) { @@ -1247,6 +1323,7 @@ func libc_revoke_trampoline() //go:linkname libc_revoke libc_revoke //go:cgo_import_dynamic libc_revoke revoke "/usr/lib/libSystem.B.dylib" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Rmdir(path string) (err error) { @@ -1266,6 +1343,7 @@ func libc_rmdir_trampoline() //go:linkname libc_rmdir libc_rmdir //go:cgo_import_dynamic libc_rmdir rmdir "/usr/lib/libSystem.B.dylib" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Seek(fd int, offset int64, whence int) (newoffset int64, err error) { @@ -1281,6 +1359,7 @@ func libc_lseek_trampoline() //go:linkname libc_lseek libc_lseek //go:cgo_import_dynamic libc_lseek lseek "/usr/lib/libSystem.B.dylib" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Select(n int, r *FdSet, w *FdSet, e *FdSet, timeout *Timeval) (err error) { @@ -1295,6 +1374,7 @@ func libc_select_trampoline() //go:linkname libc_select libc_select //go:cgo_import_dynamic libc_select select "/usr/lib/libSystem.B.dylib" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Setegid(egid int) (err error) { @@ -1309,6 +1389,7 @@ func libc_setegid_trampoline() //go:linkname libc_setegid libc_setegid //go:cgo_import_dynamic libc_setegid setegid "/usr/lib/libSystem.B.dylib" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Seteuid(euid int) (err error) { @@ -1323,6 +1404,7 @@ func libc_seteuid_trampoline() //go:linkname libc_seteuid libc_seteuid //go:cgo_import_dynamic libc_seteuid seteuid "/usr/lib/libSystem.B.dylib" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Setgid(gid int) (err error) { @@ -1337,6 +1419,7 @@ func libc_setgid_trampoline() //go:linkname libc_setgid libc_setgid //go:cgo_import_dynamic libc_setgid setgid "/usr/lib/libSystem.B.dylib" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Setlogin(name string) (err error) { @@ -1356,6 +1439,7 @@ func libc_setlogin_trampoline() //go:linkname libc_setlogin libc_setlogin //go:cgo_import_dynamic libc_setlogin setlogin "/usr/lib/libSystem.B.dylib" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Setpgid(pid int, pgid int) (err error) { @@ -1370,6 +1454,7 @@ func libc_setpgid_trampoline() //go:linkname libc_setpgid libc_setpgid //go:cgo_import_dynamic libc_setpgid setpgid "/usr/lib/libSystem.B.dylib" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Setpriority(which int, who int, prio int) (err error) { @@ -1384,6 +1469,7 @@ func libc_setpriority_trampoline() //go:linkname libc_setpriority libc_setpriority //go:cgo_import_dynamic libc_setpriority setpriority "/usr/lib/libSystem.B.dylib" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Setprivexec(flag int) (err error) { @@ -1398,6 +1484,7 @@ func libc_setprivexec_trampoline() //go:linkname libc_setprivexec libc_setprivexec //go:cgo_import_dynamic libc_setprivexec setprivexec "/usr/lib/libSystem.B.dylib" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Setregid(rgid int, egid int) (err error) { @@ -1412,6 +1499,7 @@ func libc_setregid_trampoline() //go:linkname libc_setregid libc_setregid //go:cgo_import_dynamic libc_setregid setregid "/usr/lib/libSystem.B.dylib" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Setreuid(ruid int, euid int) (err error) { @@ -1426,6 +1514,7 @@ func libc_setreuid_trampoline() //go:linkname libc_setreuid libc_setreuid //go:cgo_import_dynamic libc_setreuid setreuid "/usr/lib/libSystem.B.dylib" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Setrlimit(which int, lim *Rlimit) (err error) { @@ -1440,6 +1529,7 @@ func libc_setrlimit_trampoline() //go:linkname libc_setrlimit libc_setrlimit //go:cgo_import_dynamic libc_setrlimit setrlimit "/usr/lib/libSystem.B.dylib" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Setsid() (pid int, err error) { @@ -1455,6 +1545,7 @@ func libc_setsid_trampoline() //go:linkname libc_setsid libc_setsid //go:cgo_import_dynamic libc_setsid setsid "/usr/lib/libSystem.B.dylib" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Settimeofday(tp *Timeval) (err error) { @@ -1469,6 +1560,7 @@ func libc_settimeofday_trampoline() //go:linkname libc_settimeofday libc_settimeofday //go:cgo_import_dynamic libc_settimeofday settimeofday "/usr/lib/libSystem.B.dylib" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Setuid(uid int) (err error) { @@ -1483,6 +1575,7 @@ func libc_setuid_trampoline() //go:linkname libc_setuid libc_setuid //go:cgo_import_dynamic libc_setuid setuid "/usr/lib/libSystem.B.dylib" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Symlink(path string, link string) (err error) { @@ -1507,6 +1600,7 @@ func libc_symlink_trampoline() //go:linkname libc_symlink libc_symlink //go:cgo_import_dynamic libc_symlink symlink "/usr/lib/libSystem.B.dylib" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Sync() (err error) { @@ -1521,6 +1615,7 @@ func libc_sync_trampoline() //go:linkname libc_sync libc_sync //go:cgo_import_dynamic libc_sync sync "/usr/lib/libSystem.B.dylib" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Truncate(path string, length int64) (err error) { @@ -1540,6 +1635,7 @@ func libc_truncate_trampoline() //go:linkname libc_truncate libc_truncate //go:cgo_import_dynamic libc_truncate truncate "/usr/lib/libSystem.B.dylib" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Umask(newmask int) (oldmask int) { @@ -1552,6 +1648,7 @@ func libc_umask_trampoline() //go:linkname libc_umask libc_umask //go:cgo_import_dynamic libc_umask umask "/usr/lib/libSystem.B.dylib" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Undelete(path string) (err error) { @@ -1571,6 +1668,7 @@ func libc_undelete_trampoline() //go:linkname libc_undelete libc_undelete //go:cgo_import_dynamic libc_undelete undelete "/usr/lib/libSystem.B.dylib" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Unlink(path string) (err error) { @@ -1590,6 +1688,7 @@ func libc_unlink_trampoline() //go:linkname libc_unlink libc_unlink //go:cgo_import_dynamic libc_unlink unlink "/usr/lib/libSystem.B.dylib" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Unmount(path string, flags int) (err error) { @@ -1609,6 +1708,7 @@ func libc_unmount_trampoline() //go:linkname libc_unmount libc_unmount //go:cgo_import_dynamic libc_unmount unmount "/usr/lib/libSystem.B.dylib" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func write(fd int, p []byte) (n int, err error) { @@ -1630,6 +1730,7 @@ func libc_write_trampoline() //go:linkname libc_write libc_write //go:cgo_import_dynamic libc_write write "/usr/lib/libSystem.B.dylib" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func writev(fd int, iovecs []Iovec) (cnt uintptr, err error) { @@ -1651,6 +1752,7 @@ func libc_writev_trampoline() //go:linkname libc_writev libc_writev //go:cgo_import_dynamic libc_writev writev "/usr/lib/libSystem.B.dylib" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func mmap(addr uintptr, length uintptr, prot int, flag int, fd int, pos int64) (ret uintptr, err error) { @@ -1666,6 +1768,7 @@ func libc_mmap_trampoline() //go:linkname libc_mmap libc_mmap //go:cgo_import_dynamic libc_mmap mmap "/usr/lib/libSystem.B.dylib" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func munmap(addr uintptr, length uintptr) (err error) { @@ -1680,6 +1783,7 @@ func libc_munmap_trampoline() //go:linkname libc_munmap libc_munmap //go:cgo_import_dynamic libc_munmap munmap "/usr/lib/libSystem.B.dylib" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func fork() (pid int, err error) { @@ -1695,6 +1799,7 @@ func libc_fork_trampoline() //go:linkname libc_fork libc_fork //go:cgo_import_dynamic libc_fork fork "/usr/lib/libSystem.B.dylib" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func ioctl(fd int, req int, arg int) (err error) { @@ -1709,6 +1814,7 @@ func libc_ioctl_trampoline() //go:linkname libc_ioctl libc_ioctl //go:cgo_import_dynamic libc_ioctl ioctl "/usr/lib/libSystem.B.dylib" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func ioctlPtr(fd int, req uint, arg unsafe.Pointer) (err error) { @@ -1733,6 +1839,7 @@ func libc_execve_trampoline() //go:linkname libc_execve libc_execve //go:cgo_import_dynamic libc_execve execve "/usr/lib/libSystem.B.dylib" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func exit(res int) (err error) { @@ -1747,6 +1854,7 @@ func libc_exit_trampoline() //go:linkname libc_exit libc_exit //go:cgo_import_dynamic libc_exit exit "/usr/lib/libSystem.B.dylib" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func sysctl(mib []_C_int, old *byte, oldlen *uintptr, new *byte, newlen uintptr) (err error) { @@ -1767,6 +1875,7 @@ func libc_sysctl_trampoline() //go:linkname libc_sysctl libc_sysctl //go:cgo_import_dynamic libc_sysctl sysctl "/usr/lib/libSystem.B.dylib" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func fcntlPtr(fd int, cmd int, arg unsafe.Pointer) (val int, err error) { @@ -1797,6 +1906,7 @@ func libc_unlinkat_trampoline() //go:linkname libc_unlinkat libc_unlinkat //go:cgo_import_dynamic libc_unlinkat unlinkat "/usr/lib/libSystem.B.dylib" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func openat(fd int, path string, flags int, perm uint32) (fdret int, err error) { @@ -1817,6 +1927,7 @@ func libc_openat_trampoline() //go:linkname libc_openat libc_openat //go:cgo_import_dynamic libc_openat openat "/usr/lib/libSystem.B.dylib" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Fstat(fd int, stat *Stat_t) (err error) { @@ -1831,6 +1942,7 @@ func libc_fstat64_trampoline() //go:linkname libc_fstat64 libc_fstat64 //go:cgo_import_dynamic libc_fstat64 fstat64 "/usr/lib/libSystem.B.dylib" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Fstatfs(fd int, stat *Statfs_t) (err error) { @@ -1845,6 +1957,7 @@ func libc_fstatfs64_trampoline() //go:linkname libc_fstatfs64 libc_fstatfs64 //go:cgo_import_dynamic libc_fstatfs64 fstatfs64 "/usr/lib/libSystem.B.dylib" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Getdirentries(fd int, buf []byte, basep *uintptr) (n int, err error) { @@ -1866,6 +1979,7 @@ func libc___getdirentries64_trampoline() //go:linkname libc___getdirentries64 libc___getdirentries64 //go:cgo_import_dynamic libc___getdirentries64 __getdirentries64 "/usr/lib/libSystem.B.dylib" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Gettimeofday(tp *Timeval) (err error) { @@ -1880,6 +1994,7 @@ func libc_gettimeofday_trampoline() //go:linkname libc_gettimeofday libc_gettimeofday //go:cgo_import_dynamic libc_gettimeofday gettimeofday "/usr/lib/libSystem.B.dylib" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Lstat(path string, stat *Stat_t) (err error) { @@ -1899,6 +2014,7 @@ func libc_lstat64_trampoline() //go:linkname libc_lstat64 libc_lstat64 //go:cgo_import_dynamic libc_lstat64 lstat64 "/usr/lib/libSystem.B.dylib" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Stat(path string, stat *Stat_t) (err error) { @@ -1918,6 +2034,7 @@ func libc_stat64_trampoline() //go:linkname libc_stat64 libc_stat64 //go:cgo_import_dynamic libc_stat64 stat64 "/usr/lib/libSystem.B.dylib" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Statfs(path string, stat *Statfs_t) (err error) { @@ -1937,6 +2054,7 @@ func libc_statfs64_trampoline() //go:linkname libc_statfs64 libc_statfs64 //go:cgo_import_dynamic libc_statfs64 statfs64 "/usr/lib/libSystem.B.dylib" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func fstatat(fd int, path string, stat *Stat_t, flags int) (err error) { diff --git a/src/syscall/zsyscall_darwin_amd64.go b/src/syscall/zsyscall_darwin_amd64.go index afc3d72d8d..141f071105 100644 --- a/src/syscall/zsyscall_darwin_amd64.go +++ b/src/syscall/zsyscall_darwin_amd64.go @@ -22,6 +22,7 @@ func libc_getgroups_trampoline() //go:linkname libc_getgroups libc_getgroups //go:cgo_import_dynamic libc_getgroups getgroups "/usr/lib/libSystem.B.dylib" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func setgroups(ngid int, gid *_Gid_t) (err error) { @@ -36,6 +37,7 @@ func libc_setgroups_trampoline() //go:linkname libc_setgroups libc_setgroups //go:cgo_import_dynamic libc_setgroups setgroups "/usr/lib/libSystem.B.dylib" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func wait4(pid int, wstatus *_C_int, options int, rusage *Rusage) (wpid int, err error) { @@ -51,6 +53,7 @@ func libc_wait4_trampoline() //go:linkname libc_wait4 libc_wait4 //go:cgo_import_dynamic libc_wait4 wait4 "/usr/lib/libSystem.B.dylib" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func accept(s int, rsa *RawSockaddrAny, addrlen *_Socklen) (fd int, err error) { @@ -66,6 +69,7 @@ func libc_accept_trampoline() //go:linkname libc_accept libc_accept //go:cgo_import_dynamic libc_accept accept "/usr/lib/libSystem.B.dylib" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func bind(s int, addr unsafe.Pointer, addrlen _Socklen) (err error) { @@ -80,6 +84,7 @@ func libc_bind_trampoline() //go:linkname libc_bind libc_bind //go:cgo_import_dynamic libc_bind bind "/usr/lib/libSystem.B.dylib" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func connect(s int, addr unsafe.Pointer, addrlen _Socklen) (err error) { @@ -94,6 +99,7 @@ func libc_connect_trampoline() //go:linkname libc_connect libc_connect //go:cgo_import_dynamic libc_connect connect "/usr/lib/libSystem.B.dylib" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func socket(domain int, typ int, proto int) (fd int, err error) { @@ -109,6 +115,7 @@ func libc_socket_trampoline() //go:linkname libc_socket libc_socket //go:cgo_import_dynamic libc_socket socket "/usr/lib/libSystem.B.dylib" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func getsockopt(s int, level int, name int, val unsafe.Pointer, vallen *_Socklen) (err error) { @@ -123,6 +130,7 @@ func libc_getsockopt_trampoline() //go:linkname libc_getsockopt libc_getsockopt //go:cgo_import_dynamic libc_getsockopt getsockopt "/usr/lib/libSystem.B.dylib" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func setsockopt(s int, level int, name int, val unsafe.Pointer, vallen uintptr) (err error) { @@ -137,6 +145,7 @@ func libc_setsockopt_trampoline() //go:linkname libc_setsockopt libc_setsockopt //go:cgo_import_dynamic libc_setsockopt setsockopt "/usr/lib/libSystem.B.dylib" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func getpeername(fd int, rsa *RawSockaddrAny, addrlen *_Socklen) (err error) { @@ -151,6 +160,7 @@ func libc_getpeername_trampoline() //go:linkname libc_getpeername libc_getpeername //go:cgo_import_dynamic libc_getpeername getpeername "/usr/lib/libSystem.B.dylib" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func getsockname(fd int, rsa *RawSockaddrAny, addrlen *_Socklen) (err error) { @@ -165,6 +175,7 @@ func libc_getsockname_trampoline() //go:linkname libc_getsockname libc_getsockname //go:cgo_import_dynamic libc_getsockname getsockname "/usr/lib/libSystem.B.dylib" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Shutdown(s int, how int) (err error) { @@ -179,6 +190,7 @@ func libc_shutdown_trampoline() //go:linkname libc_shutdown libc_shutdown //go:cgo_import_dynamic libc_shutdown shutdown "/usr/lib/libSystem.B.dylib" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func socketpair(domain int, typ int, proto int, fd *[2]int32) (err error) { @@ -193,6 +205,7 @@ func libc_socketpair_trampoline() //go:linkname libc_socketpair libc_socketpair //go:cgo_import_dynamic libc_socketpair socketpair "/usr/lib/libSystem.B.dylib" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func recvfrom(fd int, p []byte, flags int, from *RawSockaddrAny, fromlen *_Socklen) (n int, err error) { @@ -214,6 +227,7 @@ func libc_recvfrom_trampoline() //go:linkname libc_recvfrom libc_recvfrom //go:cgo_import_dynamic libc_recvfrom recvfrom "/usr/lib/libSystem.B.dylib" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func sendto(s int, buf []byte, flags int, to unsafe.Pointer, addrlen _Socklen) (err error) { @@ -234,6 +248,7 @@ func libc_sendto_trampoline() //go:linkname libc_sendto libc_sendto //go:cgo_import_dynamic libc_sendto sendto "/usr/lib/libSystem.B.dylib" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func recvmsg(s int, msg *Msghdr, flags int) (n int, err error) { @@ -249,6 +264,7 @@ func libc_recvmsg_trampoline() //go:linkname libc_recvmsg libc_recvmsg //go:cgo_import_dynamic libc_recvmsg recvmsg "/usr/lib/libSystem.B.dylib" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func sendmsg(s int, msg *Msghdr, flags int) (n int, err error) { @@ -264,6 +280,7 @@ func libc_sendmsg_trampoline() //go:linkname libc_sendmsg libc_sendmsg //go:cgo_import_dynamic libc_sendmsg sendmsg "/usr/lib/libSystem.B.dylib" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func kevent(kq int, change unsafe.Pointer, nchange int, event unsafe.Pointer, nevent int, timeout *Timespec) (n int, err error) { @@ -279,6 +296,7 @@ func libc_kevent_trampoline() //go:linkname libc_kevent libc_kevent //go:cgo_import_dynamic libc_kevent kevent "/usr/lib/libSystem.B.dylib" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func utimes(path string, timeval *[2]Timeval) (err error) { @@ -298,6 +316,7 @@ func libc_utimes_trampoline() //go:linkname libc_utimes libc_utimes //go:cgo_import_dynamic libc_utimes utimes "/usr/lib/libSystem.B.dylib" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func futimes(fd int, timeval *[2]Timeval) (err error) { @@ -312,6 +331,7 @@ func libc_futimes_trampoline() //go:linkname libc_futimes libc_futimes //go:cgo_import_dynamic libc_futimes futimes "/usr/lib/libSystem.B.dylib" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func fcntl(fd int, cmd int, arg int) (val int, err error) { @@ -327,6 +347,7 @@ func libc_fcntl_trampoline() //go:linkname libc_fcntl libc_fcntl //go:cgo_import_dynamic libc_fcntl fcntl "/usr/lib/libSystem.B.dylib" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func ptrace(request int, pid int, addr uintptr, data uintptr) (err error) { @@ -341,6 +362,7 @@ func libc_ptrace_trampoline() //go:linkname libc_ptrace libc_ptrace //go:cgo_import_dynamic libc_ptrace ptrace "/usr/lib/libSystem.B.dylib" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func pipe(p *[2]int32) (err error) { @@ -355,6 +377,7 @@ func libc_pipe_trampoline() //go:linkname libc_pipe libc_pipe //go:cgo_import_dynamic libc_pipe pipe "/usr/lib/libSystem.B.dylib" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func kill(pid int, signum int, posix int) (err error) { @@ -369,6 +392,7 @@ func libc_kill_trampoline() //go:linkname libc_kill libc_kill //go:cgo_import_dynamic libc_kill kill "/usr/lib/libSystem.B.dylib" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Access(path string, mode uint32) (err error) { @@ -388,6 +412,7 @@ func libc_access_trampoline() //go:linkname libc_access libc_access //go:cgo_import_dynamic libc_access access "/usr/lib/libSystem.B.dylib" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Adjtime(delta *Timeval, olddelta *Timeval) (err error) { @@ -402,6 +427,7 @@ func libc_adjtime_trampoline() //go:linkname libc_adjtime libc_adjtime //go:cgo_import_dynamic libc_adjtime adjtime "/usr/lib/libSystem.B.dylib" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Chdir(path string) (err error) { @@ -421,6 +447,7 @@ func libc_chdir_trampoline() //go:linkname libc_chdir libc_chdir //go:cgo_import_dynamic libc_chdir chdir "/usr/lib/libSystem.B.dylib" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Chflags(path string, flags int) (err error) { @@ -440,6 +467,7 @@ func libc_chflags_trampoline() //go:linkname libc_chflags libc_chflags //go:cgo_import_dynamic libc_chflags chflags "/usr/lib/libSystem.B.dylib" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Chmod(path string, mode uint32) (err error) { @@ -459,6 +487,7 @@ func libc_chmod_trampoline() //go:linkname libc_chmod libc_chmod //go:cgo_import_dynamic libc_chmod chmod "/usr/lib/libSystem.B.dylib" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Chown(path string, uid int, gid int) (err error) { @@ -478,6 +507,7 @@ func libc_chown_trampoline() //go:linkname libc_chown libc_chown //go:cgo_import_dynamic libc_chown chown "/usr/lib/libSystem.B.dylib" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Chroot(path string) (err error) { @@ -497,6 +527,7 @@ func libc_chroot_trampoline() //go:linkname libc_chroot libc_chroot //go:cgo_import_dynamic libc_chroot chroot "/usr/lib/libSystem.B.dylib" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Close(fd int) (err error) { @@ -511,6 +542,7 @@ func libc_close_trampoline() //go:linkname libc_close libc_close //go:cgo_import_dynamic libc_close close "/usr/lib/libSystem.B.dylib" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Dup(fd int) (nfd int, err error) { @@ -526,6 +558,7 @@ func libc_dup_trampoline() //go:linkname libc_dup libc_dup //go:cgo_import_dynamic libc_dup dup "/usr/lib/libSystem.B.dylib" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Dup2(from int, to int) (err error) { @@ -540,6 +573,7 @@ func libc_dup2_trampoline() //go:linkname libc_dup2 libc_dup2 //go:cgo_import_dynamic libc_dup2 dup2 "/usr/lib/libSystem.B.dylib" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Exchangedata(path1 string, path2 string, options int) (err error) { @@ -564,6 +598,7 @@ func libc_exchangedata_trampoline() //go:linkname libc_exchangedata libc_exchangedata //go:cgo_import_dynamic libc_exchangedata exchangedata "/usr/lib/libSystem.B.dylib" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Fchdir(fd int) (err error) { @@ -578,6 +613,7 @@ func libc_fchdir_trampoline() //go:linkname libc_fchdir libc_fchdir //go:cgo_import_dynamic libc_fchdir fchdir "/usr/lib/libSystem.B.dylib" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Fchflags(fd int, flags int) (err error) { @@ -592,6 +628,7 @@ func libc_fchflags_trampoline() //go:linkname libc_fchflags libc_fchflags //go:cgo_import_dynamic libc_fchflags fchflags "/usr/lib/libSystem.B.dylib" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Fchmod(fd int, mode uint32) (err error) { @@ -606,6 +643,7 @@ func libc_fchmod_trampoline() //go:linkname libc_fchmod libc_fchmod //go:cgo_import_dynamic libc_fchmod fchmod "/usr/lib/libSystem.B.dylib" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Fchown(fd int, uid int, gid int) (err error) { @@ -620,6 +658,7 @@ func libc_fchown_trampoline() //go:linkname libc_fchown libc_fchown //go:cgo_import_dynamic libc_fchown fchown "/usr/lib/libSystem.B.dylib" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Flock(fd int, how int) (err error) { @@ -634,6 +673,7 @@ func libc_flock_trampoline() //go:linkname libc_flock libc_flock //go:cgo_import_dynamic libc_flock flock "/usr/lib/libSystem.B.dylib" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Fpathconf(fd int, name int) (val int, err error) { @@ -649,6 +689,7 @@ func libc_fpathconf_trampoline() //go:linkname libc_fpathconf libc_fpathconf //go:cgo_import_dynamic libc_fpathconf fpathconf "/usr/lib/libSystem.B.dylib" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Fsync(fd int) (err error) { @@ -663,6 +704,7 @@ func libc_fsync_trampoline() //go:linkname libc_fsync libc_fsync //go:cgo_import_dynamic libc_fsync fsync "/usr/lib/libSystem.B.dylib" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Ftruncate(fd int, length int64) (err error) { @@ -677,6 +719,7 @@ func libc_ftruncate_trampoline() //go:linkname libc_ftruncate libc_ftruncate //go:cgo_import_dynamic libc_ftruncate ftruncate "/usr/lib/libSystem.B.dylib" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Getdtablesize() (size int) { @@ -689,6 +732,7 @@ func libc_getdtablesize_trampoline() //go:linkname libc_getdtablesize libc_getdtablesize //go:cgo_import_dynamic libc_getdtablesize getdtablesize "/usr/lib/libSystem.B.dylib" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Getegid() (egid int) { @@ -701,6 +745,7 @@ func libc_getegid_trampoline() //go:linkname libc_getegid libc_getegid //go:cgo_import_dynamic libc_getegid getegid "/usr/lib/libSystem.B.dylib" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Geteuid() (uid int) { @@ -713,6 +758,7 @@ func libc_geteuid_trampoline() //go:linkname libc_geteuid libc_geteuid //go:cgo_import_dynamic libc_geteuid geteuid "/usr/lib/libSystem.B.dylib" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Getgid() (gid int) { @@ -725,6 +771,7 @@ func libc_getgid_trampoline() //go:linkname libc_getgid libc_getgid //go:cgo_import_dynamic libc_getgid getgid "/usr/lib/libSystem.B.dylib" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Getpgid(pid int) (pgid int, err error) { @@ -740,6 +787,7 @@ func libc_getpgid_trampoline() //go:linkname libc_getpgid libc_getpgid //go:cgo_import_dynamic libc_getpgid getpgid "/usr/lib/libSystem.B.dylib" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Getpgrp() (pgrp int) { @@ -752,6 +800,7 @@ func libc_getpgrp_trampoline() //go:linkname libc_getpgrp libc_getpgrp //go:cgo_import_dynamic libc_getpgrp getpgrp "/usr/lib/libSystem.B.dylib" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Getpid() (pid int) { @@ -764,6 +813,7 @@ func libc_getpid_trampoline() //go:linkname libc_getpid libc_getpid //go:cgo_import_dynamic libc_getpid getpid "/usr/lib/libSystem.B.dylib" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Getppid() (ppid int) { @@ -776,6 +826,7 @@ func libc_getppid_trampoline() //go:linkname libc_getppid libc_getppid //go:cgo_import_dynamic libc_getppid getppid "/usr/lib/libSystem.B.dylib" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Getpriority(which int, who int) (prio int, err error) { @@ -791,6 +842,7 @@ func libc_getpriority_trampoline() //go:linkname libc_getpriority libc_getpriority //go:cgo_import_dynamic libc_getpriority getpriority "/usr/lib/libSystem.B.dylib" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Getrlimit(which int, lim *Rlimit) (err error) { @@ -805,6 +857,7 @@ func libc_getrlimit_trampoline() //go:linkname libc_getrlimit libc_getrlimit //go:cgo_import_dynamic libc_getrlimit getrlimit "/usr/lib/libSystem.B.dylib" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Getrusage(who int, rusage *Rusage) (err error) { @@ -819,6 +872,7 @@ func libc_getrusage_trampoline() //go:linkname libc_getrusage libc_getrusage //go:cgo_import_dynamic libc_getrusage getrusage "/usr/lib/libSystem.B.dylib" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Getsid(pid int) (sid int, err error) { @@ -834,6 +888,7 @@ func libc_getsid_trampoline() //go:linkname libc_getsid libc_getsid //go:cgo_import_dynamic libc_getsid getsid "/usr/lib/libSystem.B.dylib" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Getuid() (uid int) { @@ -846,6 +901,7 @@ func libc_getuid_trampoline() //go:linkname libc_getuid libc_getuid //go:cgo_import_dynamic libc_getuid getuid "/usr/lib/libSystem.B.dylib" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Issetugid() (tainted bool) { @@ -858,6 +914,7 @@ func libc_issetugid_trampoline() //go:linkname libc_issetugid libc_issetugid //go:cgo_import_dynamic libc_issetugid issetugid "/usr/lib/libSystem.B.dylib" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Kqueue() (fd int, err error) { @@ -873,6 +930,7 @@ func libc_kqueue_trampoline() //go:linkname libc_kqueue libc_kqueue //go:cgo_import_dynamic libc_kqueue kqueue "/usr/lib/libSystem.B.dylib" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Lchown(path string, uid int, gid int) (err error) { @@ -892,6 +950,7 @@ func libc_lchown_trampoline() //go:linkname libc_lchown libc_lchown //go:cgo_import_dynamic libc_lchown lchown "/usr/lib/libSystem.B.dylib" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Link(path string, link string) (err error) { @@ -916,6 +975,7 @@ func libc_link_trampoline() //go:linkname libc_link libc_link //go:cgo_import_dynamic libc_link link "/usr/lib/libSystem.B.dylib" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Listen(s int, backlog int) (err error) { @@ -930,6 +990,7 @@ func libc_listen_trampoline() //go:linkname libc_listen libc_listen //go:cgo_import_dynamic libc_listen listen "/usr/lib/libSystem.B.dylib" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Mkdir(path string, mode uint32) (err error) { @@ -949,6 +1010,7 @@ func libc_mkdir_trampoline() //go:linkname libc_mkdir libc_mkdir //go:cgo_import_dynamic libc_mkdir mkdir "/usr/lib/libSystem.B.dylib" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Mkfifo(path string, mode uint32) (err error) { @@ -968,6 +1030,7 @@ func libc_mkfifo_trampoline() //go:linkname libc_mkfifo libc_mkfifo //go:cgo_import_dynamic libc_mkfifo mkfifo "/usr/lib/libSystem.B.dylib" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Mknod(path string, mode uint32, dev int) (err error) { @@ -987,6 +1050,7 @@ func libc_mknod_trampoline() //go:linkname libc_mknod libc_mknod //go:cgo_import_dynamic libc_mknod mknod "/usr/lib/libSystem.B.dylib" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Mlock(b []byte) (err error) { @@ -1007,6 +1071,7 @@ func libc_mlock_trampoline() //go:linkname libc_mlock libc_mlock //go:cgo_import_dynamic libc_mlock mlock "/usr/lib/libSystem.B.dylib" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Mlockall(flags int) (err error) { @@ -1021,6 +1086,7 @@ func libc_mlockall_trampoline() //go:linkname libc_mlockall libc_mlockall //go:cgo_import_dynamic libc_mlockall mlockall "/usr/lib/libSystem.B.dylib" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Mprotect(b []byte, prot int) (err error) { @@ -1041,6 +1107,7 @@ func libc_mprotect_trampoline() //go:linkname libc_mprotect libc_mprotect //go:cgo_import_dynamic libc_mprotect mprotect "/usr/lib/libSystem.B.dylib" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Munlock(b []byte) (err error) { @@ -1061,6 +1128,7 @@ func libc_munlock_trampoline() //go:linkname libc_munlock libc_munlock //go:cgo_import_dynamic libc_munlock munlock "/usr/lib/libSystem.B.dylib" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Munlockall() (err error) { @@ -1075,6 +1143,7 @@ func libc_munlockall_trampoline() //go:linkname libc_munlockall libc_munlockall //go:cgo_import_dynamic libc_munlockall munlockall "/usr/lib/libSystem.B.dylib" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Open(path string, mode int, perm uint32) (fd int, err error) { @@ -1095,6 +1164,7 @@ func libc_open_trampoline() //go:linkname libc_open libc_open //go:cgo_import_dynamic libc_open open "/usr/lib/libSystem.B.dylib" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Pathconf(path string, name int) (val int, err error) { @@ -1115,6 +1185,7 @@ func libc_pathconf_trampoline() //go:linkname libc_pathconf libc_pathconf //go:cgo_import_dynamic libc_pathconf pathconf "/usr/lib/libSystem.B.dylib" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Pread(fd int, p []byte, offset int64) (n int, err error) { @@ -1136,6 +1207,7 @@ func libc_pread_trampoline() //go:linkname libc_pread libc_pread //go:cgo_import_dynamic libc_pread pread "/usr/lib/libSystem.B.dylib" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Pwrite(fd int, p []byte, offset int64) (n int, err error) { @@ -1157,6 +1229,7 @@ func libc_pwrite_trampoline() //go:linkname libc_pwrite libc_pwrite //go:cgo_import_dynamic libc_pwrite pwrite "/usr/lib/libSystem.B.dylib" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func read(fd int, p []byte) (n int, err error) { @@ -1178,6 +1251,7 @@ func libc_read_trampoline() //go:linkname libc_read libc_read //go:cgo_import_dynamic libc_read read "/usr/lib/libSystem.B.dylib" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Readlink(path string, buf []byte) (n int, err error) { @@ -1204,6 +1278,7 @@ func libc_readlink_trampoline() //go:linkname libc_readlink libc_readlink //go:cgo_import_dynamic libc_readlink readlink "/usr/lib/libSystem.B.dylib" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Rename(from string, to string) (err error) { @@ -1228,6 +1303,7 @@ func libc_rename_trampoline() //go:linkname libc_rename libc_rename //go:cgo_import_dynamic libc_rename rename "/usr/lib/libSystem.B.dylib" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Revoke(path string) (err error) { @@ -1247,6 +1323,7 @@ func libc_revoke_trampoline() //go:linkname libc_revoke libc_revoke //go:cgo_import_dynamic libc_revoke revoke "/usr/lib/libSystem.B.dylib" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Rmdir(path string) (err error) { @@ -1266,6 +1343,7 @@ func libc_rmdir_trampoline() //go:linkname libc_rmdir libc_rmdir //go:cgo_import_dynamic libc_rmdir rmdir "/usr/lib/libSystem.B.dylib" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Seek(fd int, offset int64, whence int) (newoffset int64, err error) { @@ -1281,6 +1359,7 @@ func libc_lseek_trampoline() //go:linkname libc_lseek libc_lseek //go:cgo_import_dynamic libc_lseek lseek "/usr/lib/libSystem.B.dylib" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Select(n int, r *FdSet, w *FdSet, e *FdSet, timeout *Timeval) (err error) { @@ -1295,6 +1374,7 @@ func libc_select_trampoline() //go:linkname libc_select libc_select //go:cgo_import_dynamic libc_select select "/usr/lib/libSystem.B.dylib" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Setegid(egid int) (err error) { @@ -1309,6 +1389,7 @@ func libc_setegid_trampoline() //go:linkname libc_setegid libc_setegid //go:cgo_import_dynamic libc_setegid setegid "/usr/lib/libSystem.B.dylib" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Seteuid(euid int) (err error) { @@ -1323,6 +1404,7 @@ func libc_seteuid_trampoline() //go:linkname libc_seteuid libc_seteuid //go:cgo_import_dynamic libc_seteuid seteuid "/usr/lib/libSystem.B.dylib" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Setgid(gid int) (err error) { @@ -1337,6 +1419,7 @@ func libc_setgid_trampoline() //go:linkname libc_setgid libc_setgid //go:cgo_import_dynamic libc_setgid setgid "/usr/lib/libSystem.B.dylib" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Setlogin(name string) (err error) { @@ -1356,6 +1439,7 @@ func libc_setlogin_trampoline() //go:linkname libc_setlogin libc_setlogin //go:cgo_import_dynamic libc_setlogin setlogin "/usr/lib/libSystem.B.dylib" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Setpgid(pid int, pgid int) (err error) { @@ -1370,6 +1454,7 @@ func libc_setpgid_trampoline() //go:linkname libc_setpgid libc_setpgid //go:cgo_import_dynamic libc_setpgid setpgid "/usr/lib/libSystem.B.dylib" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Setpriority(which int, who int, prio int) (err error) { @@ -1384,6 +1469,7 @@ func libc_setpriority_trampoline() //go:linkname libc_setpriority libc_setpriority //go:cgo_import_dynamic libc_setpriority setpriority "/usr/lib/libSystem.B.dylib" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Setprivexec(flag int) (err error) { @@ -1398,6 +1484,7 @@ func libc_setprivexec_trampoline() //go:linkname libc_setprivexec libc_setprivexec //go:cgo_import_dynamic libc_setprivexec setprivexec "/usr/lib/libSystem.B.dylib" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Setregid(rgid int, egid int) (err error) { @@ -1412,6 +1499,7 @@ func libc_setregid_trampoline() //go:linkname libc_setregid libc_setregid //go:cgo_import_dynamic libc_setregid setregid "/usr/lib/libSystem.B.dylib" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Setreuid(ruid int, euid int) (err error) { @@ -1426,6 +1514,7 @@ func libc_setreuid_trampoline() //go:linkname libc_setreuid libc_setreuid //go:cgo_import_dynamic libc_setreuid setreuid "/usr/lib/libSystem.B.dylib" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Setrlimit(which int, lim *Rlimit) (err error) { @@ -1440,6 +1529,7 @@ func libc_setrlimit_trampoline() //go:linkname libc_setrlimit libc_setrlimit //go:cgo_import_dynamic libc_setrlimit setrlimit "/usr/lib/libSystem.B.dylib" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Setsid() (pid int, err error) { @@ -1455,6 +1545,7 @@ func libc_setsid_trampoline() //go:linkname libc_setsid libc_setsid //go:cgo_import_dynamic libc_setsid setsid "/usr/lib/libSystem.B.dylib" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Settimeofday(tp *Timeval) (err error) { @@ -1469,6 +1560,7 @@ func libc_settimeofday_trampoline() //go:linkname libc_settimeofday libc_settimeofday //go:cgo_import_dynamic libc_settimeofday settimeofday "/usr/lib/libSystem.B.dylib" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Setuid(uid int) (err error) { @@ -1483,6 +1575,7 @@ func libc_setuid_trampoline() //go:linkname libc_setuid libc_setuid //go:cgo_import_dynamic libc_setuid setuid "/usr/lib/libSystem.B.dylib" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Symlink(path string, link string) (err error) { @@ -1507,6 +1600,7 @@ func libc_symlink_trampoline() //go:linkname libc_symlink libc_symlink //go:cgo_import_dynamic libc_symlink symlink "/usr/lib/libSystem.B.dylib" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Sync() (err error) { @@ -1521,6 +1615,7 @@ func libc_sync_trampoline() //go:linkname libc_sync libc_sync //go:cgo_import_dynamic libc_sync sync "/usr/lib/libSystem.B.dylib" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Truncate(path string, length int64) (err error) { @@ -1540,6 +1635,7 @@ func libc_truncate_trampoline() //go:linkname libc_truncate libc_truncate //go:cgo_import_dynamic libc_truncate truncate "/usr/lib/libSystem.B.dylib" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Umask(newmask int) (oldmask int) { @@ -1552,6 +1648,7 @@ func libc_umask_trampoline() //go:linkname libc_umask libc_umask //go:cgo_import_dynamic libc_umask umask "/usr/lib/libSystem.B.dylib" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Undelete(path string) (err error) { @@ -1571,6 +1668,7 @@ func libc_undelete_trampoline() //go:linkname libc_undelete libc_undelete //go:cgo_import_dynamic libc_undelete undelete "/usr/lib/libSystem.B.dylib" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Unlink(path string) (err error) { @@ -1590,6 +1688,7 @@ func libc_unlink_trampoline() //go:linkname libc_unlink libc_unlink //go:cgo_import_dynamic libc_unlink unlink "/usr/lib/libSystem.B.dylib" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Unmount(path string, flags int) (err error) { @@ -1609,6 +1708,7 @@ func libc_unmount_trampoline() //go:linkname libc_unmount libc_unmount //go:cgo_import_dynamic libc_unmount unmount "/usr/lib/libSystem.B.dylib" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func write(fd int, p []byte) (n int, err error) { @@ -1630,6 +1730,7 @@ func libc_write_trampoline() //go:linkname libc_write libc_write //go:cgo_import_dynamic libc_write write "/usr/lib/libSystem.B.dylib" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func writev(fd int, iovecs []Iovec) (cnt uintptr, err error) { @@ -1651,6 +1752,7 @@ func libc_writev_trampoline() //go:linkname libc_writev libc_writev //go:cgo_import_dynamic libc_writev writev "/usr/lib/libSystem.B.dylib" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func mmap(addr uintptr, length uintptr, prot int, flag int, fd int, pos int64) (ret uintptr, err error) { @@ -1666,6 +1768,7 @@ func libc_mmap_trampoline() //go:linkname libc_mmap libc_mmap //go:cgo_import_dynamic libc_mmap mmap "/usr/lib/libSystem.B.dylib" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func munmap(addr uintptr, length uintptr) (err error) { @@ -1680,6 +1783,7 @@ func libc_munmap_trampoline() //go:linkname libc_munmap libc_munmap //go:cgo_import_dynamic libc_munmap munmap "/usr/lib/libSystem.B.dylib" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func fork() (pid int, err error) { @@ -1695,6 +1799,7 @@ func libc_fork_trampoline() //go:linkname libc_fork libc_fork //go:cgo_import_dynamic libc_fork fork "/usr/lib/libSystem.B.dylib" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func ioctl(fd int, req int, arg int) (err error) { @@ -1709,6 +1814,7 @@ func libc_ioctl_trampoline() //go:linkname libc_ioctl libc_ioctl //go:cgo_import_dynamic libc_ioctl ioctl "/usr/lib/libSystem.B.dylib" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func ioctlPtr(fd int, req uint, arg unsafe.Pointer) (err error) { @@ -1733,6 +1839,7 @@ func libc_execve_trampoline() //go:linkname libc_execve libc_execve //go:cgo_import_dynamic libc_execve execve "/usr/lib/libSystem.B.dylib" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func exit(res int) (err error) { @@ -1747,6 +1854,7 @@ func libc_exit_trampoline() //go:linkname libc_exit libc_exit //go:cgo_import_dynamic libc_exit exit "/usr/lib/libSystem.B.dylib" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func sysctl(mib []_C_int, old *byte, oldlen *uintptr, new *byte, newlen uintptr) (err error) { @@ -1767,6 +1875,7 @@ func libc_sysctl_trampoline() //go:linkname libc_sysctl libc_sysctl //go:cgo_import_dynamic libc_sysctl sysctl "/usr/lib/libSystem.B.dylib" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func fcntlPtr(fd int, cmd int, arg unsafe.Pointer) (val int, err error) { @@ -1797,6 +1906,7 @@ func libc_unlinkat_trampoline() //go:linkname libc_unlinkat libc_unlinkat //go:cgo_import_dynamic libc_unlinkat unlinkat "/usr/lib/libSystem.B.dylib" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func openat(fd int, path string, flags int, perm uint32) (fdret int, err error) { @@ -1817,6 +1927,7 @@ func libc_openat_trampoline() //go:linkname libc_openat libc_openat //go:cgo_import_dynamic libc_openat openat "/usr/lib/libSystem.B.dylib" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Fstat(fd int, stat *Stat_t) (err error) { @@ -1831,6 +1942,7 @@ func libc_fstat64_trampoline() //go:linkname libc_fstat64 libc_fstat64 //go:cgo_import_dynamic libc_fstat64 fstat64 "/usr/lib/libSystem.B.dylib" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Fstatfs(fd int, stat *Statfs_t) (err error) { @@ -1845,6 +1957,7 @@ func libc_fstatfs64_trampoline() //go:linkname libc_fstatfs64 libc_fstatfs64 //go:cgo_import_dynamic libc_fstatfs64 fstatfs64 "/usr/lib/libSystem.B.dylib" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Getdirentries(fd int, buf []byte, basep *uintptr) (n int, err error) { @@ -1866,6 +1979,7 @@ func libc___getdirentries64_trampoline() //go:linkname libc___getdirentries64 libc___getdirentries64 //go:cgo_import_dynamic libc___getdirentries64 __getdirentries64 "/usr/lib/libSystem.B.dylib" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Gettimeofday(tp *Timeval) (err error) { @@ -1880,6 +1994,7 @@ func libc_gettimeofday_trampoline() //go:linkname libc_gettimeofday libc_gettimeofday //go:cgo_import_dynamic libc_gettimeofday gettimeofday "/usr/lib/libSystem.B.dylib" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Lstat(path string, stat *Stat_t) (err error) { @@ -1899,6 +2014,7 @@ func libc_lstat64_trampoline() //go:linkname libc_lstat64 libc_lstat64 //go:cgo_import_dynamic libc_lstat64 lstat64 "/usr/lib/libSystem.B.dylib" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Stat(path string, stat *Stat_t) (err error) { @@ -1918,6 +2034,7 @@ func libc_stat64_trampoline() //go:linkname libc_stat64 libc_stat64 //go:cgo_import_dynamic libc_stat64 stat64 "/usr/lib/libSystem.B.dylib" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Statfs(path string, stat *Statfs_t) (err error) { @@ -1937,6 +2054,7 @@ func libc_statfs64_trampoline() //go:linkname libc_statfs64 libc_statfs64 //go:cgo_import_dynamic libc_statfs64 statfs64 "/usr/lib/libSystem.B.dylib" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func fstatat(fd int, path string, stat *Stat_t, flags int) (err error) { diff --git a/src/syscall/zsyscall_darwin_arm.go b/src/syscall/zsyscall_darwin_arm.go index 80ef9e514f..9bfaac6ef7 100644 --- a/src/syscall/zsyscall_darwin_arm.go +++ b/src/syscall/zsyscall_darwin_arm.go @@ -22,6 +22,7 @@ func libc_getgroups_trampoline() //go:linkname libc_getgroups libc_getgroups //go:cgo_import_dynamic libc_getgroups getgroups "/usr/lib/libSystem.B.dylib" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func setgroups(ngid int, gid *_Gid_t) (err error) { @@ -36,6 +37,7 @@ func libc_setgroups_trampoline() //go:linkname libc_setgroups libc_setgroups //go:cgo_import_dynamic libc_setgroups setgroups "/usr/lib/libSystem.B.dylib" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func wait4(pid int, wstatus *_C_int, options int, rusage *Rusage) (wpid int, err error) { @@ -51,6 +53,7 @@ func libc_wait4_trampoline() //go:linkname libc_wait4 libc_wait4 //go:cgo_import_dynamic libc_wait4 wait4 "/usr/lib/libSystem.B.dylib" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func accept(s int, rsa *RawSockaddrAny, addrlen *_Socklen) (fd int, err error) { @@ -66,6 +69,7 @@ func libc_accept_trampoline() //go:linkname libc_accept libc_accept //go:cgo_import_dynamic libc_accept accept "/usr/lib/libSystem.B.dylib" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func bind(s int, addr unsafe.Pointer, addrlen _Socklen) (err error) { @@ -80,6 +84,7 @@ func libc_bind_trampoline() //go:linkname libc_bind libc_bind //go:cgo_import_dynamic libc_bind bind "/usr/lib/libSystem.B.dylib" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func connect(s int, addr unsafe.Pointer, addrlen _Socklen) (err error) { @@ -94,6 +99,7 @@ func libc_connect_trampoline() //go:linkname libc_connect libc_connect //go:cgo_import_dynamic libc_connect connect "/usr/lib/libSystem.B.dylib" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func socket(domain int, typ int, proto int) (fd int, err error) { @@ -109,6 +115,7 @@ func libc_socket_trampoline() //go:linkname libc_socket libc_socket //go:cgo_import_dynamic libc_socket socket "/usr/lib/libSystem.B.dylib" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func getsockopt(s int, level int, name int, val unsafe.Pointer, vallen *_Socklen) (err error) { @@ -123,6 +130,7 @@ func libc_getsockopt_trampoline() //go:linkname libc_getsockopt libc_getsockopt //go:cgo_import_dynamic libc_getsockopt getsockopt "/usr/lib/libSystem.B.dylib" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func setsockopt(s int, level int, name int, val unsafe.Pointer, vallen uintptr) (err error) { @@ -137,6 +145,7 @@ func libc_setsockopt_trampoline() //go:linkname libc_setsockopt libc_setsockopt //go:cgo_import_dynamic libc_setsockopt setsockopt "/usr/lib/libSystem.B.dylib" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func getpeername(fd int, rsa *RawSockaddrAny, addrlen *_Socklen) (err error) { @@ -151,6 +160,7 @@ func libc_getpeername_trampoline() //go:linkname libc_getpeername libc_getpeername //go:cgo_import_dynamic libc_getpeername getpeername "/usr/lib/libSystem.B.dylib" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func getsockname(fd int, rsa *RawSockaddrAny, addrlen *_Socklen) (err error) { @@ -165,6 +175,7 @@ func libc_getsockname_trampoline() //go:linkname libc_getsockname libc_getsockname //go:cgo_import_dynamic libc_getsockname getsockname "/usr/lib/libSystem.B.dylib" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Shutdown(s int, how int) (err error) { @@ -179,6 +190,7 @@ func libc_shutdown_trampoline() //go:linkname libc_shutdown libc_shutdown //go:cgo_import_dynamic libc_shutdown shutdown "/usr/lib/libSystem.B.dylib" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func socketpair(domain int, typ int, proto int, fd *[2]int32) (err error) { @@ -193,6 +205,7 @@ func libc_socketpair_trampoline() //go:linkname libc_socketpair libc_socketpair //go:cgo_import_dynamic libc_socketpair socketpair "/usr/lib/libSystem.B.dylib" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func recvfrom(fd int, p []byte, flags int, from *RawSockaddrAny, fromlen *_Socklen) (n int, err error) { @@ -214,6 +227,7 @@ func libc_recvfrom_trampoline() //go:linkname libc_recvfrom libc_recvfrom //go:cgo_import_dynamic libc_recvfrom recvfrom "/usr/lib/libSystem.B.dylib" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func sendto(s int, buf []byte, flags int, to unsafe.Pointer, addrlen _Socklen) (err error) { @@ -234,6 +248,7 @@ func libc_sendto_trampoline() //go:linkname libc_sendto libc_sendto //go:cgo_import_dynamic libc_sendto sendto "/usr/lib/libSystem.B.dylib" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func recvmsg(s int, msg *Msghdr, flags int) (n int, err error) { @@ -249,6 +264,7 @@ func libc_recvmsg_trampoline() //go:linkname libc_recvmsg libc_recvmsg //go:cgo_import_dynamic libc_recvmsg recvmsg "/usr/lib/libSystem.B.dylib" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func sendmsg(s int, msg *Msghdr, flags int) (n int, err error) { @@ -264,6 +280,7 @@ func libc_sendmsg_trampoline() //go:linkname libc_sendmsg libc_sendmsg //go:cgo_import_dynamic libc_sendmsg sendmsg "/usr/lib/libSystem.B.dylib" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func kevent(kq int, change unsafe.Pointer, nchange int, event unsafe.Pointer, nevent int, timeout *Timespec) (n int, err error) { @@ -279,6 +296,7 @@ func libc_kevent_trampoline() //go:linkname libc_kevent libc_kevent //go:cgo_import_dynamic libc_kevent kevent "/usr/lib/libSystem.B.dylib" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func utimes(path string, timeval *[2]Timeval) (err error) { @@ -298,6 +316,7 @@ func libc_utimes_trampoline() //go:linkname libc_utimes libc_utimes //go:cgo_import_dynamic libc_utimes utimes "/usr/lib/libSystem.B.dylib" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func futimes(fd int, timeval *[2]Timeval) (err error) { @@ -312,6 +331,7 @@ func libc_futimes_trampoline() //go:linkname libc_futimes libc_futimes //go:cgo_import_dynamic libc_futimes futimes "/usr/lib/libSystem.B.dylib" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func fcntl(fd int, cmd int, arg int) (val int, err error) { @@ -327,6 +347,7 @@ func libc_fcntl_trampoline() //go:linkname libc_fcntl libc_fcntl //go:cgo_import_dynamic libc_fcntl fcntl "/usr/lib/libSystem.B.dylib" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func ptrace(request int, pid int, addr uintptr, data uintptr) (err error) { @@ -341,6 +362,7 @@ func libc_ptrace_trampoline() //go:linkname libc_ptrace libc_ptrace //go:cgo_import_dynamic libc_ptrace ptrace "/usr/lib/libSystem.B.dylib" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func pipe(p *[2]int32) (err error) { @@ -355,6 +377,7 @@ func libc_pipe_trampoline() //go:linkname libc_pipe libc_pipe //go:cgo_import_dynamic libc_pipe pipe "/usr/lib/libSystem.B.dylib" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func kill(pid int, signum int, posix int) (err error) { @@ -369,6 +392,7 @@ func libc_kill_trampoline() //go:linkname libc_kill libc_kill //go:cgo_import_dynamic libc_kill kill "/usr/lib/libSystem.B.dylib" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Access(path string, mode uint32) (err error) { @@ -388,6 +412,7 @@ func libc_access_trampoline() //go:linkname libc_access libc_access //go:cgo_import_dynamic libc_access access "/usr/lib/libSystem.B.dylib" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Adjtime(delta *Timeval, olddelta *Timeval) (err error) { @@ -402,6 +427,7 @@ func libc_adjtime_trampoline() //go:linkname libc_adjtime libc_adjtime //go:cgo_import_dynamic libc_adjtime adjtime "/usr/lib/libSystem.B.dylib" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Chdir(path string) (err error) { @@ -421,6 +447,7 @@ func libc_chdir_trampoline() //go:linkname libc_chdir libc_chdir //go:cgo_import_dynamic libc_chdir chdir "/usr/lib/libSystem.B.dylib" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Chflags(path string, flags int) (err error) { @@ -440,6 +467,7 @@ func libc_chflags_trampoline() //go:linkname libc_chflags libc_chflags //go:cgo_import_dynamic libc_chflags chflags "/usr/lib/libSystem.B.dylib" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Chmod(path string, mode uint32) (err error) { @@ -459,6 +487,7 @@ func libc_chmod_trampoline() //go:linkname libc_chmod libc_chmod //go:cgo_import_dynamic libc_chmod chmod "/usr/lib/libSystem.B.dylib" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Chown(path string, uid int, gid int) (err error) { @@ -478,6 +507,7 @@ func libc_chown_trampoline() //go:linkname libc_chown libc_chown //go:cgo_import_dynamic libc_chown chown "/usr/lib/libSystem.B.dylib" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Chroot(path string) (err error) { @@ -497,6 +527,7 @@ func libc_chroot_trampoline() //go:linkname libc_chroot libc_chroot //go:cgo_import_dynamic libc_chroot chroot "/usr/lib/libSystem.B.dylib" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Close(fd int) (err error) { @@ -511,6 +542,7 @@ func libc_close_trampoline() //go:linkname libc_close libc_close //go:cgo_import_dynamic libc_close close "/usr/lib/libSystem.B.dylib" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Dup(fd int) (nfd int, err error) { @@ -526,6 +558,7 @@ func libc_dup_trampoline() //go:linkname libc_dup libc_dup //go:cgo_import_dynamic libc_dup dup "/usr/lib/libSystem.B.dylib" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Dup2(from int, to int) (err error) { @@ -540,6 +573,7 @@ func libc_dup2_trampoline() //go:linkname libc_dup2 libc_dup2 //go:cgo_import_dynamic libc_dup2 dup2 "/usr/lib/libSystem.B.dylib" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Exchangedata(path1 string, path2 string, options int) (err error) { @@ -564,6 +598,7 @@ func libc_exchangedata_trampoline() //go:linkname libc_exchangedata libc_exchangedata //go:cgo_import_dynamic libc_exchangedata exchangedata "/usr/lib/libSystem.B.dylib" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Fchdir(fd int) (err error) { @@ -578,6 +613,7 @@ func libc_fchdir_trampoline() //go:linkname libc_fchdir libc_fchdir //go:cgo_import_dynamic libc_fchdir fchdir "/usr/lib/libSystem.B.dylib" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Fchflags(fd int, flags int) (err error) { @@ -592,6 +628,7 @@ func libc_fchflags_trampoline() //go:linkname libc_fchflags libc_fchflags //go:cgo_import_dynamic libc_fchflags fchflags "/usr/lib/libSystem.B.dylib" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Fchmod(fd int, mode uint32) (err error) { @@ -606,6 +643,7 @@ func libc_fchmod_trampoline() //go:linkname libc_fchmod libc_fchmod //go:cgo_import_dynamic libc_fchmod fchmod "/usr/lib/libSystem.B.dylib" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Fchown(fd int, uid int, gid int) (err error) { @@ -620,6 +658,7 @@ func libc_fchown_trampoline() //go:linkname libc_fchown libc_fchown //go:cgo_import_dynamic libc_fchown fchown "/usr/lib/libSystem.B.dylib" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Flock(fd int, how int) (err error) { @@ -634,6 +673,7 @@ func libc_flock_trampoline() //go:linkname libc_flock libc_flock //go:cgo_import_dynamic libc_flock flock "/usr/lib/libSystem.B.dylib" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Fpathconf(fd int, name int) (val int, err error) { @@ -649,6 +689,7 @@ func libc_fpathconf_trampoline() //go:linkname libc_fpathconf libc_fpathconf //go:cgo_import_dynamic libc_fpathconf fpathconf "/usr/lib/libSystem.B.dylib" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Fsync(fd int) (err error) { @@ -663,6 +704,7 @@ func libc_fsync_trampoline() //go:linkname libc_fsync libc_fsync //go:cgo_import_dynamic libc_fsync fsync "/usr/lib/libSystem.B.dylib" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Ftruncate(fd int, length int64) (err error) { @@ -677,6 +719,7 @@ func libc_ftruncate_trampoline() //go:linkname libc_ftruncate libc_ftruncate //go:cgo_import_dynamic libc_ftruncate ftruncate "/usr/lib/libSystem.B.dylib" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Getdtablesize() (size int) { @@ -689,6 +732,7 @@ func libc_getdtablesize_trampoline() //go:linkname libc_getdtablesize libc_getdtablesize //go:cgo_import_dynamic libc_getdtablesize getdtablesize "/usr/lib/libSystem.B.dylib" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Getegid() (egid int) { @@ -701,6 +745,7 @@ func libc_getegid_trampoline() //go:linkname libc_getegid libc_getegid //go:cgo_import_dynamic libc_getegid getegid "/usr/lib/libSystem.B.dylib" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Geteuid() (uid int) { @@ -713,6 +758,7 @@ func libc_geteuid_trampoline() //go:linkname libc_geteuid libc_geteuid //go:cgo_import_dynamic libc_geteuid geteuid "/usr/lib/libSystem.B.dylib" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Getgid() (gid int) { @@ -725,6 +771,7 @@ func libc_getgid_trampoline() //go:linkname libc_getgid libc_getgid //go:cgo_import_dynamic libc_getgid getgid "/usr/lib/libSystem.B.dylib" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Getpgid(pid int) (pgid int, err error) { @@ -740,6 +787,7 @@ func libc_getpgid_trampoline() //go:linkname libc_getpgid libc_getpgid //go:cgo_import_dynamic libc_getpgid getpgid "/usr/lib/libSystem.B.dylib" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Getpgrp() (pgrp int) { @@ -752,6 +800,7 @@ func libc_getpgrp_trampoline() //go:linkname libc_getpgrp libc_getpgrp //go:cgo_import_dynamic libc_getpgrp getpgrp "/usr/lib/libSystem.B.dylib" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Getpid() (pid int) { @@ -764,6 +813,7 @@ func libc_getpid_trampoline() //go:linkname libc_getpid libc_getpid //go:cgo_import_dynamic libc_getpid getpid "/usr/lib/libSystem.B.dylib" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Getppid() (ppid int) { @@ -776,6 +826,7 @@ func libc_getppid_trampoline() //go:linkname libc_getppid libc_getppid //go:cgo_import_dynamic libc_getppid getppid "/usr/lib/libSystem.B.dylib" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Getpriority(which int, who int) (prio int, err error) { @@ -791,6 +842,7 @@ func libc_getpriority_trampoline() //go:linkname libc_getpriority libc_getpriority //go:cgo_import_dynamic libc_getpriority getpriority "/usr/lib/libSystem.B.dylib" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Getrlimit(which int, lim *Rlimit) (err error) { @@ -805,6 +857,7 @@ func libc_getrlimit_trampoline() //go:linkname libc_getrlimit libc_getrlimit //go:cgo_import_dynamic libc_getrlimit getrlimit "/usr/lib/libSystem.B.dylib" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Getrusage(who int, rusage *Rusage) (err error) { @@ -819,6 +872,7 @@ func libc_getrusage_trampoline() //go:linkname libc_getrusage libc_getrusage //go:cgo_import_dynamic libc_getrusage getrusage "/usr/lib/libSystem.B.dylib" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Getsid(pid int) (sid int, err error) { @@ -834,6 +888,7 @@ func libc_getsid_trampoline() //go:linkname libc_getsid libc_getsid //go:cgo_import_dynamic libc_getsid getsid "/usr/lib/libSystem.B.dylib" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Getuid() (uid int) { @@ -846,6 +901,7 @@ func libc_getuid_trampoline() //go:linkname libc_getuid libc_getuid //go:cgo_import_dynamic libc_getuid getuid "/usr/lib/libSystem.B.dylib" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Issetugid() (tainted bool) { @@ -858,6 +914,7 @@ func libc_issetugid_trampoline() //go:linkname libc_issetugid libc_issetugid //go:cgo_import_dynamic libc_issetugid issetugid "/usr/lib/libSystem.B.dylib" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Kqueue() (fd int, err error) { @@ -873,6 +930,7 @@ func libc_kqueue_trampoline() //go:linkname libc_kqueue libc_kqueue //go:cgo_import_dynamic libc_kqueue kqueue "/usr/lib/libSystem.B.dylib" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Lchown(path string, uid int, gid int) (err error) { @@ -892,6 +950,7 @@ func libc_lchown_trampoline() //go:linkname libc_lchown libc_lchown //go:cgo_import_dynamic libc_lchown lchown "/usr/lib/libSystem.B.dylib" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Link(path string, link string) (err error) { @@ -916,6 +975,7 @@ func libc_link_trampoline() //go:linkname libc_link libc_link //go:cgo_import_dynamic libc_link link "/usr/lib/libSystem.B.dylib" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Listen(s int, backlog int) (err error) { @@ -930,6 +990,7 @@ func libc_listen_trampoline() //go:linkname libc_listen libc_listen //go:cgo_import_dynamic libc_listen listen "/usr/lib/libSystem.B.dylib" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Mkdir(path string, mode uint32) (err error) { @@ -949,6 +1010,7 @@ func libc_mkdir_trampoline() //go:linkname libc_mkdir libc_mkdir //go:cgo_import_dynamic libc_mkdir mkdir "/usr/lib/libSystem.B.dylib" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Mkfifo(path string, mode uint32) (err error) { @@ -968,6 +1030,7 @@ func libc_mkfifo_trampoline() //go:linkname libc_mkfifo libc_mkfifo //go:cgo_import_dynamic libc_mkfifo mkfifo "/usr/lib/libSystem.B.dylib" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Mknod(path string, mode uint32, dev int) (err error) { @@ -987,6 +1050,7 @@ func libc_mknod_trampoline() //go:linkname libc_mknod libc_mknod //go:cgo_import_dynamic libc_mknod mknod "/usr/lib/libSystem.B.dylib" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Mlock(b []byte) (err error) { @@ -1007,6 +1071,7 @@ func libc_mlock_trampoline() //go:linkname libc_mlock libc_mlock //go:cgo_import_dynamic libc_mlock mlock "/usr/lib/libSystem.B.dylib" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Mlockall(flags int) (err error) { @@ -1021,6 +1086,7 @@ func libc_mlockall_trampoline() //go:linkname libc_mlockall libc_mlockall //go:cgo_import_dynamic libc_mlockall mlockall "/usr/lib/libSystem.B.dylib" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Mprotect(b []byte, prot int) (err error) { @@ -1041,6 +1107,7 @@ func libc_mprotect_trampoline() //go:linkname libc_mprotect libc_mprotect //go:cgo_import_dynamic libc_mprotect mprotect "/usr/lib/libSystem.B.dylib" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Munlock(b []byte) (err error) { @@ -1061,6 +1128,7 @@ func libc_munlock_trampoline() //go:linkname libc_munlock libc_munlock //go:cgo_import_dynamic libc_munlock munlock "/usr/lib/libSystem.B.dylib" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Munlockall() (err error) { @@ -1075,6 +1143,7 @@ func libc_munlockall_trampoline() //go:linkname libc_munlockall libc_munlockall //go:cgo_import_dynamic libc_munlockall munlockall "/usr/lib/libSystem.B.dylib" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Open(path string, mode int, perm uint32) (fd int, err error) { @@ -1095,6 +1164,7 @@ func libc_open_trampoline() //go:linkname libc_open libc_open //go:cgo_import_dynamic libc_open open "/usr/lib/libSystem.B.dylib" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Pathconf(path string, name int) (val int, err error) { @@ -1115,6 +1185,7 @@ func libc_pathconf_trampoline() //go:linkname libc_pathconf libc_pathconf //go:cgo_import_dynamic libc_pathconf pathconf "/usr/lib/libSystem.B.dylib" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Pread(fd int, p []byte, offset int64) (n int, err error) { @@ -1136,6 +1207,7 @@ func libc_pread_trampoline() //go:linkname libc_pread libc_pread //go:cgo_import_dynamic libc_pread pread "/usr/lib/libSystem.B.dylib" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Pwrite(fd int, p []byte, offset int64) (n int, err error) { @@ -1157,6 +1229,7 @@ func libc_pwrite_trampoline() //go:linkname libc_pwrite libc_pwrite //go:cgo_import_dynamic libc_pwrite pwrite "/usr/lib/libSystem.B.dylib" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func read(fd int, p []byte) (n int, err error) { @@ -1178,6 +1251,7 @@ func libc_read_trampoline() //go:linkname libc_read libc_read //go:cgo_import_dynamic libc_read read "/usr/lib/libSystem.B.dylib" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Readlink(path string, buf []byte) (n int, err error) { @@ -1204,6 +1278,7 @@ func libc_readlink_trampoline() //go:linkname libc_readlink libc_readlink //go:cgo_import_dynamic libc_readlink readlink "/usr/lib/libSystem.B.dylib" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Rename(from string, to string) (err error) { @@ -1228,6 +1303,7 @@ func libc_rename_trampoline() //go:linkname libc_rename libc_rename //go:cgo_import_dynamic libc_rename rename "/usr/lib/libSystem.B.dylib" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Revoke(path string) (err error) { @@ -1247,6 +1323,7 @@ func libc_revoke_trampoline() //go:linkname libc_revoke libc_revoke //go:cgo_import_dynamic libc_revoke revoke "/usr/lib/libSystem.B.dylib" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Rmdir(path string) (err error) { @@ -1266,6 +1343,7 @@ func libc_rmdir_trampoline() //go:linkname libc_rmdir libc_rmdir //go:cgo_import_dynamic libc_rmdir rmdir "/usr/lib/libSystem.B.dylib" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Seek(fd int, offset int64, whence int) (newoffset int64, err error) { @@ -1281,6 +1359,7 @@ func libc_lseek_trampoline() //go:linkname libc_lseek libc_lseek //go:cgo_import_dynamic libc_lseek lseek "/usr/lib/libSystem.B.dylib" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Select(n int, r *FdSet, w *FdSet, e *FdSet, timeout *Timeval) (err error) { @@ -1295,6 +1374,7 @@ func libc_select_trampoline() //go:linkname libc_select libc_select //go:cgo_import_dynamic libc_select select "/usr/lib/libSystem.B.dylib" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Setegid(egid int) (err error) { @@ -1309,6 +1389,7 @@ func libc_setegid_trampoline() //go:linkname libc_setegid libc_setegid //go:cgo_import_dynamic libc_setegid setegid "/usr/lib/libSystem.B.dylib" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Seteuid(euid int) (err error) { @@ -1323,6 +1404,7 @@ func libc_seteuid_trampoline() //go:linkname libc_seteuid libc_seteuid //go:cgo_import_dynamic libc_seteuid seteuid "/usr/lib/libSystem.B.dylib" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Setgid(gid int) (err error) { @@ -1337,6 +1419,7 @@ func libc_setgid_trampoline() //go:linkname libc_setgid libc_setgid //go:cgo_import_dynamic libc_setgid setgid "/usr/lib/libSystem.B.dylib" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Setlogin(name string) (err error) { @@ -1356,6 +1439,7 @@ func libc_setlogin_trampoline() //go:linkname libc_setlogin libc_setlogin //go:cgo_import_dynamic libc_setlogin setlogin "/usr/lib/libSystem.B.dylib" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Setpgid(pid int, pgid int) (err error) { @@ -1370,6 +1454,7 @@ func libc_setpgid_trampoline() //go:linkname libc_setpgid libc_setpgid //go:cgo_import_dynamic libc_setpgid setpgid "/usr/lib/libSystem.B.dylib" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Setpriority(which int, who int, prio int) (err error) { @@ -1384,6 +1469,7 @@ func libc_setpriority_trampoline() //go:linkname libc_setpriority libc_setpriority //go:cgo_import_dynamic libc_setpriority setpriority "/usr/lib/libSystem.B.dylib" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Setprivexec(flag int) (err error) { @@ -1398,6 +1484,7 @@ func libc_setprivexec_trampoline() //go:linkname libc_setprivexec libc_setprivexec //go:cgo_import_dynamic libc_setprivexec setprivexec "/usr/lib/libSystem.B.dylib" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Setregid(rgid int, egid int) (err error) { @@ -1412,6 +1499,7 @@ func libc_setregid_trampoline() //go:linkname libc_setregid libc_setregid //go:cgo_import_dynamic libc_setregid setregid "/usr/lib/libSystem.B.dylib" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Setreuid(ruid int, euid int) (err error) { @@ -1426,6 +1514,7 @@ func libc_setreuid_trampoline() //go:linkname libc_setreuid libc_setreuid //go:cgo_import_dynamic libc_setreuid setreuid "/usr/lib/libSystem.B.dylib" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Setrlimit(which int, lim *Rlimit) (err error) { @@ -1440,6 +1529,7 @@ func libc_setrlimit_trampoline() //go:linkname libc_setrlimit libc_setrlimit //go:cgo_import_dynamic libc_setrlimit setrlimit "/usr/lib/libSystem.B.dylib" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Setsid() (pid int, err error) { @@ -1455,6 +1545,7 @@ func libc_setsid_trampoline() //go:linkname libc_setsid libc_setsid //go:cgo_import_dynamic libc_setsid setsid "/usr/lib/libSystem.B.dylib" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Settimeofday(tp *Timeval) (err error) { @@ -1469,6 +1560,7 @@ func libc_settimeofday_trampoline() //go:linkname libc_settimeofday libc_settimeofday //go:cgo_import_dynamic libc_settimeofday settimeofday "/usr/lib/libSystem.B.dylib" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Setuid(uid int) (err error) { @@ -1483,6 +1575,7 @@ func libc_setuid_trampoline() //go:linkname libc_setuid libc_setuid //go:cgo_import_dynamic libc_setuid setuid "/usr/lib/libSystem.B.dylib" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Symlink(path string, link string) (err error) { @@ -1507,6 +1600,7 @@ func libc_symlink_trampoline() //go:linkname libc_symlink libc_symlink //go:cgo_import_dynamic libc_symlink symlink "/usr/lib/libSystem.B.dylib" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Sync() (err error) { @@ -1521,6 +1615,7 @@ func libc_sync_trampoline() //go:linkname libc_sync libc_sync //go:cgo_import_dynamic libc_sync sync "/usr/lib/libSystem.B.dylib" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Truncate(path string, length int64) (err error) { @@ -1540,6 +1635,7 @@ func libc_truncate_trampoline() //go:linkname libc_truncate libc_truncate //go:cgo_import_dynamic libc_truncate truncate "/usr/lib/libSystem.B.dylib" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Umask(newmask int) (oldmask int) { @@ -1552,6 +1648,7 @@ func libc_umask_trampoline() //go:linkname libc_umask libc_umask //go:cgo_import_dynamic libc_umask umask "/usr/lib/libSystem.B.dylib" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Undelete(path string) (err error) { @@ -1571,6 +1668,7 @@ func libc_undelete_trampoline() //go:linkname libc_undelete libc_undelete //go:cgo_import_dynamic libc_undelete undelete "/usr/lib/libSystem.B.dylib" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Unlink(path string) (err error) { @@ -1590,6 +1688,7 @@ func libc_unlink_trampoline() //go:linkname libc_unlink libc_unlink //go:cgo_import_dynamic libc_unlink unlink "/usr/lib/libSystem.B.dylib" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Unmount(path string, flags int) (err error) { @@ -1609,6 +1708,7 @@ func libc_unmount_trampoline() //go:linkname libc_unmount libc_unmount //go:cgo_import_dynamic libc_unmount unmount "/usr/lib/libSystem.B.dylib" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func write(fd int, p []byte) (n int, err error) { @@ -1630,6 +1730,7 @@ func libc_write_trampoline() //go:linkname libc_write libc_write //go:cgo_import_dynamic libc_write write "/usr/lib/libSystem.B.dylib" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func writev(fd int, iovecs []Iovec) (cnt uintptr, err error) { @@ -1651,6 +1752,7 @@ func libc_writev_trampoline() //go:linkname libc_writev libc_writev //go:cgo_import_dynamic libc_writev writev "/usr/lib/libSystem.B.dylib" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func mmap(addr uintptr, length uintptr, prot int, flag int, fd int, pos int64) (ret uintptr, err error) { @@ -1666,6 +1768,7 @@ func libc_mmap_trampoline() //go:linkname libc_mmap libc_mmap //go:cgo_import_dynamic libc_mmap mmap "/usr/lib/libSystem.B.dylib" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func munmap(addr uintptr, length uintptr) (err error) { @@ -1680,6 +1783,7 @@ func libc_munmap_trampoline() //go:linkname libc_munmap libc_munmap //go:cgo_import_dynamic libc_munmap munmap "/usr/lib/libSystem.B.dylib" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func fork() (pid int, err error) { @@ -1695,6 +1799,7 @@ func libc_fork_trampoline() //go:linkname libc_fork libc_fork //go:cgo_import_dynamic libc_fork fork "/usr/lib/libSystem.B.dylib" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func ioctl(fd int, req int, arg int) (err error) { @@ -1709,6 +1814,7 @@ func libc_ioctl_trampoline() //go:linkname libc_ioctl libc_ioctl //go:cgo_import_dynamic libc_ioctl ioctl "/usr/lib/libSystem.B.dylib" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func ioctlPtr(fd int, req uint, arg unsafe.Pointer) (err error) { @@ -1733,6 +1839,7 @@ func libc_execve_trampoline() //go:linkname libc_execve libc_execve //go:cgo_import_dynamic libc_execve execve "/usr/lib/libSystem.B.dylib" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func exit(res int) (err error) { @@ -1747,6 +1854,7 @@ func libc_exit_trampoline() //go:linkname libc_exit libc_exit //go:cgo_import_dynamic libc_exit exit "/usr/lib/libSystem.B.dylib" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func sysctl(mib []_C_int, old *byte, oldlen *uintptr, new *byte, newlen uintptr) (err error) { @@ -1767,6 +1875,7 @@ func libc_sysctl_trampoline() //go:linkname libc_sysctl libc_sysctl //go:cgo_import_dynamic libc_sysctl sysctl "/usr/lib/libSystem.B.dylib" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func fcntlPtr(fd int, cmd int, arg unsafe.Pointer) (val int, err error) { @@ -1797,6 +1906,7 @@ func libc_unlinkat_trampoline() //go:linkname libc_unlinkat libc_unlinkat //go:cgo_import_dynamic libc_unlinkat unlinkat "/usr/lib/libSystem.B.dylib" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func openat(fd int, path string, flags int, perm uint32) (fdret int, err error) { @@ -1817,6 +1927,7 @@ func libc_openat_trampoline() //go:linkname libc_openat libc_openat //go:cgo_import_dynamic libc_openat openat "/usr/lib/libSystem.B.dylib" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func closedir(dir uintptr) (err error) { @@ -1831,6 +1942,7 @@ func libc_closedir_trampoline() //go:linkname libc_closedir libc_closedir //go:cgo_import_dynamic libc_closedir closedir "/usr/lib/libSystem.B.dylib" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Fstat(fd int, stat *Stat_t) (err error) { @@ -1845,6 +1957,7 @@ func libc_fstat_trampoline() //go:linkname libc_fstat libc_fstat //go:cgo_import_dynamic libc_fstat fstat "/usr/lib/libSystem.B.dylib" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Fstatfs(fd int, stat *Statfs_t) (err error) { @@ -1859,6 +1972,7 @@ func libc_fstatfs_trampoline() //go:linkname libc_fstatfs libc_fstatfs //go:cgo_import_dynamic libc_fstatfs fstatfs "/usr/lib/libSystem.B.dylib" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Gettimeofday(tp *Timeval) (err error) { @@ -1873,6 +1987,7 @@ func libc_gettimeofday_trampoline() //go:linkname libc_gettimeofday libc_gettimeofday //go:cgo_import_dynamic libc_gettimeofday gettimeofday "/usr/lib/libSystem.B.dylib" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Lstat(path string, stat *Stat_t) (err error) { @@ -1892,6 +2007,7 @@ func libc_lstat_trampoline() //go:linkname libc_lstat libc_lstat //go:cgo_import_dynamic libc_lstat lstat "/usr/lib/libSystem.B.dylib" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func readdir_r(dir uintptr, entry uintptr, result uintptr) (res int) { @@ -1904,6 +2020,7 @@ func libc_readdir_r_trampoline() //go:linkname libc_readdir_r libc_readdir_r //go:cgo_import_dynamic libc_readdir_r readdir_r "/usr/lib/libSystem.B.dylib" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Stat(path string, stat *Stat_t) (err error) { @@ -1923,6 +2040,7 @@ func libc_stat_trampoline() //go:linkname libc_stat libc_stat //go:cgo_import_dynamic libc_stat stat "/usr/lib/libSystem.B.dylib" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Statfs(path string, stat *Statfs_t) (err error) { @@ -1942,6 +2060,7 @@ func libc_statfs_trampoline() //go:linkname libc_statfs libc_statfs //go:cgo_import_dynamic libc_statfs statfs "/usr/lib/libSystem.B.dylib" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func fstatat(fd int, path string, stat *Stat_t, flags int) (err error) { diff --git a/src/syscall/zsyscall_darwin_arm64.go b/src/syscall/zsyscall_darwin_arm64.go index a917176a31..cdb3630ebd 100644 --- a/src/syscall/zsyscall_darwin_arm64.go +++ b/src/syscall/zsyscall_darwin_arm64.go @@ -22,6 +22,7 @@ func libc_getgroups_trampoline() //go:linkname libc_getgroups libc_getgroups //go:cgo_import_dynamic libc_getgroups getgroups "/usr/lib/libSystem.B.dylib" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func setgroups(ngid int, gid *_Gid_t) (err error) { @@ -36,6 +37,7 @@ func libc_setgroups_trampoline() //go:linkname libc_setgroups libc_setgroups //go:cgo_import_dynamic libc_setgroups setgroups "/usr/lib/libSystem.B.dylib" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func wait4(pid int, wstatus *_C_int, options int, rusage *Rusage) (wpid int, err error) { @@ -51,6 +53,7 @@ func libc_wait4_trampoline() //go:linkname libc_wait4 libc_wait4 //go:cgo_import_dynamic libc_wait4 wait4 "/usr/lib/libSystem.B.dylib" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func accept(s int, rsa *RawSockaddrAny, addrlen *_Socklen) (fd int, err error) { @@ -66,6 +69,7 @@ func libc_accept_trampoline() //go:linkname libc_accept libc_accept //go:cgo_import_dynamic libc_accept accept "/usr/lib/libSystem.B.dylib" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func bind(s int, addr unsafe.Pointer, addrlen _Socklen) (err error) { @@ -80,6 +84,7 @@ func libc_bind_trampoline() //go:linkname libc_bind libc_bind //go:cgo_import_dynamic libc_bind bind "/usr/lib/libSystem.B.dylib" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func connect(s int, addr unsafe.Pointer, addrlen _Socklen) (err error) { @@ -94,6 +99,7 @@ func libc_connect_trampoline() //go:linkname libc_connect libc_connect //go:cgo_import_dynamic libc_connect connect "/usr/lib/libSystem.B.dylib" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func socket(domain int, typ int, proto int) (fd int, err error) { @@ -109,6 +115,7 @@ func libc_socket_trampoline() //go:linkname libc_socket libc_socket //go:cgo_import_dynamic libc_socket socket "/usr/lib/libSystem.B.dylib" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func getsockopt(s int, level int, name int, val unsafe.Pointer, vallen *_Socklen) (err error) { @@ -123,6 +130,7 @@ func libc_getsockopt_trampoline() //go:linkname libc_getsockopt libc_getsockopt //go:cgo_import_dynamic libc_getsockopt getsockopt "/usr/lib/libSystem.B.dylib" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func setsockopt(s int, level int, name int, val unsafe.Pointer, vallen uintptr) (err error) { @@ -137,6 +145,7 @@ func libc_setsockopt_trampoline() //go:linkname libc_setsockopt libc_setsockopt //go:cgo_import_dynamic libc_setsockopt setsockopt "/usr/lib/libSystem.B.dylib" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func getpeername(fd int, rsa *RawSockaddrAny, addrlen *_Socklen) (err error) { @@ -151,6 +160,7 @@ func libc_getpeername_trampoline() //go:linkname libc_getpeername libc_getpeername //go:cgo_import_dynamic libc_getpeername getpeername "/usr/lib/libSystem.B.dylib" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func getsockname(fd int, rsa *RawSockaddrAny, addrlen *_Socklen) (err error) { @@ -165,6 +175,7 @@ func libc_getsockname_trampoline() //go:linkname libc_getsockname libc_getsockname //go:cgo_import_dynamic libc_getsockname getsockname "/usr/lib/libSystem.B.dylib" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Shutdown(s int, how int) (err error) { @@ -179,6 +190,7 @@ func libc_shutdown_trampoline() //go:linkname libc_shutdown libc_shutdown //go:cgo_import_dynamic libc_shutdown shutdown "/usr/lib/libSystem.B.dylib" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func socketpair(domain int, typ int, proto int, fd *[2]int32) (err error) { @@ -193,6 +205,7 @@ func libc_socketpair_trampoline() //go:linkname libc_socketpair libc_socketpair //go:cgo_import_dynamic libc_socketpair socketpair "/usr/lib/libSystem.B.dylib" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func recvfrom(fd int, p []byte, flags int, from *RawSockaddrAny, fromlen *_Socklen) (n int, err error) { @@ -214,6 +227,7 @@ func libc_recvfrom_trampoline() //go:linkname libc_recvfrom libc_recvfrom //go:cgo_import_dynamic libc_recvfrom recvfrom "/usr/lib/libSystem.B.dylib" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func sendto(s int, buf []byte, flags int, to unsafe.Pointer, addrlen _Socklen) (err error) { @@ -234,6 +248,7 @@ func libc_sendto_trampoline() //go:linkname libc_sendto libc_sendto //go:cgo_import_dynamic libc_sendto sendto "/usr/lib/libSystem.B.dylib" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func recvmsg(s int, msg *Msghdr, flags int) (n int, err error) { @@ -249,6 +264,7 @@ func libc_recvmsg_trampoline() //go:linkname libc_recvmsg libc_recvmsg //go:cgo_import_dynamic libc_recvmsg recvmsg "/usr/lib/libSystem.B.dylib" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func sendmsg(s int, msg *Msghdr, flags int) (n int, err error) { @@ -264,6 +280,7 @@ func libc_sendmsg_trampoline() //go:linkname libc_sendmsg libc_sendmsg //go:cgo_import_dynamic libc_sendmsg sendmsg "/usr/lib/libSystem.B.dylib" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func kevent(kq int, change unsafe.Pointer, nchange int, event unsafe.Pointer, nevent int, timeout *Timespec) (n int, err error) { @@ -279,6 +296,7 @@ func libc_kevent_trampoline() //go:linkname libc_kevent libc_kevent //go:cgo_import_dynamic libc_kevent kevent "/usr/lib/libSystem.B.dylib" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func utimes(path string, timeval *[2]Timeval) (err error) { @@ -298,6 +316,7 @@ func libc_utimes_trampoline() //go:linkname libc_utimes libc_utimes //go:cgo_import_dynamic libc_utimes utimes "/usr/lib/libSystem.B.dylib" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func futimes(fd int, timeval *[2]Timeval) (err error) { @@ -312,6 +331,7 @@ func libc_futimes_trampoline() //go:linkname libc_futimes libc_futimes //go:cgo_import_dynamic libc_futimes futimes "/usr/lib/libSystem.B.dylib" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func fcntl(fd int, cmd int, arg int) (val int, err error) { @@ -327,6 +347,7 @@ func libc_fcntl_trampoline() //go:linkname libc_fcntl libc_fcntl //go:cgo_import_dynamic libc_fcntl fcntl "/usr/lib/libSystem.B.dylib" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func ptrace(request int, pid int, addr uintptr, data uintptr) (err error) { @@ -341,6 +362,7 @@ func libc_ptrace_trampoline() //go:linkname libc_ptrace libc_ptrace //go:cgo_import_dynamic libc_ptrace ptrace "/usr/lib/libSystem.B.dylib" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func pipe(p *[2]int32) (err error) { @@ -355,6 +377,7 @@ func libc_pipe_trampoline() //go:linkname libc_pipe libc_pipe //go:cgo_import_dynamic libc_pipe pipe "/usr/lib/libSystem.B.dylib" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func kill(pid int, signum int, posix int) (err error) { @@ -369,6 +392,7 @@ func libc_kill_trampoline() //go:linkname libc_kill libc_kill //go:cgo_import_dynamic libc_kill kill "/usr/lib/libSystem.B.dylib" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Access(path string, mode uint32) (err error) { @@ -388,6 +412,7 @@ func libc_access_trampoline() //go:linkname libc_access libc_access //go:cgo_import_dynamic libc_access access "/usr/lib/libSystem.B.dylib" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Adjtime(delta *Timeval, olddelta *Timeval) (err error) { @@ -402,6 +427,7 @@ func libc_adjtime_trampoline() //go:linkname libc_adjtime libc_adjtime //go:cgo_import_dynamic libc_adjtime adjtime "/usr/lib/libSystem.B.dylib" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Chdir(path string) (err error) { @@ -421,6 +447,7 @@ func libc_chdir_trampoline() //go:linkname libc_chdir libc_chdir //go:cgo_import_dynamic libc_chdir chdir "/usr/lib/libSystem.B.dylib" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Chflags(path string, flags int) (err error) { @@ -440,6 +467,7 @@ func libc_chflags_trampoline() //go:linkname libc_chflags libc_chflags //go:cgo_import_dynamic libc_chflags chflags "/usr/lib/libSystem.B.dylib" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Chmod(path string, mode uint32) (err error) { @@ -459,6 +487,7 @@ func libc_chmod_trampoline() //go:linkname libc_chmod libc_chmod //go:cgo_import_dynamic libc_chmod chmod "/usr/lib/libSystem.B.dylib" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Chown(path string, uid int, gid int) (err error) { @@ -478,6 +507,7 @@ func libc_chown_trampoline() //go:linkname libc_chown libc_chown //go:cgo_import_dynamic libc_chown chown "/usr/lib/libSystem.B.dylib" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Chroot(path string) (err error) { @@ -497,6 +527,7 @@ func libc_chroot_trampoline() //go:linkname libc_chroot libc_chroot //go:cgo_import_dynamic libc_chroot chroot "/usr/lib/libSystem.B.dylib" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Close(fd int) (err error) { @@ -511,6 +542,7 @@ func libc_close_trampoline() //go:linkname libc_close libc_close //go:cgo_import_dynamic libc_close close "/usr/lib/libSystem.B.dylib" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Dup(fd int) (nfd int, err error) { @@ -526,6 +558,7 @@ func libc_dup_trampoline() //go:linkname libc_dup libc_dup //go:cgo_import_dynamic libc_dup dup "/usr/lib/libSystem.B.dylib" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Dup2(from int, to int) (err error) { @@ -540,6 +573,7 @@ func libc_dup2_trampoline() //go:linkname libc_dup2 libc_dup2 //go:cgo_import_dynamic libc_dup2 dup2 "/usr/lib/libSystem.B.dylib" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Exchangedata(path1 string, path2 string, options int) (err error) { @@ -564,6 +598,7 @@ func libc_exchangedata_trampoline() //go:linkname libc_exchangedata libc_exchangedata //go:cgo_import_dynamic libc_exchangedata exchangedata "/usr/lib/libSystem.B.dylib" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Fchdir(fd int) (err error) { @@ -578,6 +613,7 @@ func libc_fchdir_trampoline() //go:linkname libc_fchdir libc_fchdir //go:cgo_import_dynamic libc_fchdir fchdir "/usr/lib/libSystem.B.dylib" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Fchflags(fd int, flags int) (err error) { @@ -592,6 +628,7 @@ func libc_fchflags_trampoline() //go:linkname libc_fchflags libc_fchflags //go:cgo_import_dynamic libc_fchflags fchflags "/usr/lib/libSystem.B.dylib" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Fchmod(fd int, mode uint32) (err error) { @@ -606,6 +643,7 @@ func libc_fchmod_trampoline() //go:linkname libc_fchmod libc_fchmod //go:cgo_import_dynamic libc_fchmod fchmod "/usr/lib/libSystem.B.dylib" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Fchown(fd int, uid int, gid int) (err error) { @@ -620,6 +658,7 @@ func libc_fchown_trampoline() //go:linkname libc_fchown libc_fchown //go:cgo_import_dynamic libc_fchown fchown "/usr/lib/libSystem.B.dylib" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Flock(fd int, how int) (err error) { @@ -634,6 +673,7 @@ func libc_flock_trampoline() //go:linkname libc_flock libc_flock //go:cgo_import_dynamic libc_flock flock "/usr/lib/libSystem.B.dylib" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Fpathconf(fd int, name int) (val int, err error) { @@ -649,6 +689,7 @@ func libc_fpathconf_trampoline() //go:linkname libc_fpathconf libc_fpathconf //go:cgo_import_dynamic libc_fpathconf fpathconf "/usr/lib/libSystem.B.dylib" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Fsync(fd int) (err error) { @@ -663,6 +704,7 @@ func libc_fsync_trampoline() //go:linkname libc_fsync libc_fsync //go:cgo_import_dynamic libc_fsync fsync "/usr/lib/libSystem.B.dylib" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Ftruncate(fd int, length int64) (err error) { @@ -677,6 +719,7 @@ func libc_ftruncate_trampoline() //go:linkname libc_ftruncate libc_ftruncate //go:cgo_import_dynamic libc_ftruncate ftruncate "/usr/lib/libSystem.B.dylib" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Getdtablesize() (size int) { @@ -689,6 +732,7 @@ func libc_getdtablesize_trampoline() //go:linkname libc_getdtablesize libc_getdtablesize //go:cgo_import_dynamic libc_getdtablesize getdtablesize "/usr/lib/libSystem.B.dylib" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Getegid() (egid int) { @@ -701,6 +745,7 @@ func libc_getegid_trampoline() //go:linkname libc_getegid libc_getegid //go:cgo_import_dynamic libc_getegid getegid "/usr/lib/libSystem.B.dylib" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Geteuid() (uid int) { @@ -713,6 +758,7 @@ func libc_geteuid_trampoline() //go:linkname libc_geteuid libc_geteuid //go:cgo_import_dynamic libc_geteuid geteuid "/usr/lib/libSystem.B.dylib" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Getgid() (gid int) { @@ -725,6 +771,7 @@ func libc_getgid_trampoline() //go:linkname libc_getgid libc_getgid //go:cgo_import_dynamic libc_getgid getgid "/usr/lib/libSystem.B.dylib" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Getpgid(pid int) (pgid int, err error) { @@ -740,6 +787,7 @@ func libc_getpgid_trampoline() //go:linkname libc_getpgid libc_getpgid //go:cgo_import_dynamic libc_getpgid getpgid "/usr/lib/libSystem.B.dylib" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Getpgrp() (pgrp int) { @@ -752,6 +800,7 @@ func libc_getpgrp_trampoline() //go:linkname libc_getpgrp libc_getpgrp //go:cgo_import_dynamic libc_getpgrp getpgrp "/usr/lib/libSystem.B.dylib" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Getpid() (pid int) { @@ -764,6 +813,7 @@ func libc_getpid_trampoline() //go:linkname libc_getpid libc_getpid //go:cgo_import_dynamic libc_getpid getpid "/usr/lib/libSystem.B.dylib" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Getppid() (ppid int) { @@ -776,6 +826,7 @@ func libc_getppid_trampoline() //go:linkname libc_getppid libc_getppid //go:cgo_import_dynamic libc_getppid getppid "/usr/lib/libSystem.B.dylib" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Getpriority(which int, who int) (prio int, err error) { @@ -791,6 +842,7 @@ func libc_getpriority_trampoline() //go:linkname libc_getpriority libc_getpriority //go:cgo_import_dynamic libc_getpriority getpriority "/usr/lib/libSystem.B.dylib" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Getrlimit(which int, lim *Rlimit) (err error) { @@ -805,6 +857,7 @@ func libc_getrlimit_trampoline() //go:linkname libc_getrlimit libc_getrlimit //go:cgo_import_dynamic libc_getrlimit getrlimit "/usr/lib/libSystem.B.dylib" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Getrusage(who int, rusage *Rusage) (err error) { @@ -819,6 +872,7 @@ func libc_getrusage_trampoline() //go:linkname libc_getrusage libc_getrusage //go:cgo_import_dynamic libc_getrusage getrusage "/usr/lib/libSystem.B.dylib" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Getsid(pid int) (sid int, err error) { @@ -834,6 +888,7 @@ func libc_getsid_trampoline() //go:linkname libc_getsid libc_getsid //go:cgo_import_dynamic libc_getsid getsid "/usr/lib/libSystem.B.dylib" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Getuid() (uid int) { @@ -846,6 +901,7 @@ func libc_getuid_trampoline() //go:linkname libc_getuid libc_getuid //go:cgo_import_dynamic libc_getuid getuid "/usr/lib/libSystem.B.dylib" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Issetugid() (tainted bool) { @@ -858,6 +914,7 @@ func libc_issetugid_trampoline() //go:linkname libc_issetugid libc_issetugid //go:cgo_import_dynamic libc_issetugid issetugid "/usr/lib/libSystem.B.dylib" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Kqueue() (fd int, err error) { @@ -873,6 +930,7 @@ func libc_kqueue_trampoline() //go:linkname libc_kqueue libc_kqueue //go:cgo_import_dynamic libc_kqueue kqueue "/usr/lib/libSystem.B.dylib" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Lchown(path string, uid int, gid int) (err error) { @@ -892,6 +950,7 @@ func libc_lchown_trampoline() //go:linkname libc_lchown libc_lchown //go:cgo_import_dynamic libc_lchown lchown "/usr/lib/libSystem.B.dylib" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Link(path string, link string) (err error) { @@ -916,6 +975,7 @@ func libc_link_trampoline() //go:linkname libc_link libc_link //go:cgo_import_dynamic libc_link link "/usr/lib/libSystem.B.dylib" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Listen(s int, backlog int) (err error) { @@ -930,6 +990,7 @@ func libc_listen_trampoline() //go:linkname libc_listen libc_listen //go:cgo_import_dynamic libc_listen listen "/usr/lib/libSystem.B.dylib" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Mkdir(path string, mode uint32) (err error) { @@ -949,6 +1010,7 @@ func libc_mkdir_trampoline() //go:linkname libc_mkdir libc_mkdir //go:cgo_import_dynamic libc_mkdir mkdir "/usr/lib/libSystem.B.dylib" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Mkfifo(path string, mode uint32) (err error) { @@ -968,6 +1030,7 @@ func libc_mkfifo_trampoline() //go:linkname libc_mkfifo libc_mkfifo //go:cgo_import_dynamic libc_mkfifo mkfifo "/usr/lib/libSystem.B.dylib" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Mknod(path string, mode uint32, dev int) (err error) { @@ -987,6 +1050,7 @@ func libc_mknod_trampoline() //go:linkname libc_mknod libc_mknod //go:cgo_import_dynamic libc_mknod mknod "/usr/lib/libSystem.B.dylib" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Mlock(b []byte) (err error) { @@ -1007,6 +1071,7 @@ func libc_mlock_trampoline() //go:linkname libc_mlock libc_mlock //go:cgo_import_dynamic libc_mlock mlock "/usr/lib/libSystem.B.dylib" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Mlockall(flags int) (err error) { @@ -1021,6 +1086,7 @@ func libc_mlockall_trampoline() //go:linkname libc_mlockall libc_mlockall //go:cgo_import_dynamic libc_mlockall mlockall "/usr/lib/libSystem.B.dylib" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Mprotect(b []byte, prot int) (err error) { @@ -1041,6 +1107,7 @@ func libc_mprotect_trampoline() //go:linkname libc_mprotect libc_mprotect //go:cgo_import_dynamic libc_mprotect mprotect "/usr/lib/libSystem.B.dylib" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Munlock(b []byte) (err error) { @@ -1061,6 +1128,7 @@ func libc_munlock_trampoline() //go:linkname libc_munlock libc_munlock //go:cgo_import_dynamic libc_munlock munlock "/usr/lib/libSystem.B.dylib" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Munlockall() (err error) { @@ -1075,6 +1143,7 @@ func libc_munlockall_trampoline() //go:linkname libc_munlockall libc_munlockall //go:cgo_import_dynamic libc_munlockall munlockall "/usr/lib/libSystem.B.dylib" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Open(path string, mode int, perm uint32) (fd int, err error) { @@ -1095,6 +1164,7 @@ func libc_open_trampoline() //go:linkname libc_open libc_open //go:cgo_import_dynamic libc_open open "/usr/lib/libSystem.B.dylib" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Pathconf(path string, name int) (val int, err error) { @@ -1115,6 +1185,7 @@ func libc_pathconf_trampoline() //go:linkname libc_pathconf libc_pathconf //go:cgo_import_dynamic libc_pathconf pathconf "/usr/lib/libSystem.B.dylib" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Pread(fd int, p []byte, offset int64) (n int, err error) { @@ -1136,6 +1207,7 @@ func libc_pread_trampoline() //go:linkname libc_pread libc_pread //go:cgo_import_dynamic libc_pread pread "/usr/lib/libSystem.B.dylib" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Pwrite(fd int, p []byte, offset int64) (n int, err error) { @@ -1157,6 +1229,7 @@ func libc_pwrite_trampoline() //go:linkname libc_pwrite libc_pwrite //go:cgo_import_dynamic libc_pwrite pwrite "/usr/lib/libSystem.B.dylib" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func read(fd int, p []byte) (n int, err error) { @@ -1178,6 +1251,7 @@ func libc_read_trampoline() //go:linkname libc_read libc_read //go:cgo_import_dynamic libc_read read "/usr/lib/libSystem.B.dylib" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Readlink(path string, buf []byte) (n int, err error) { @@ -1204,6 +1278,7 @@ func libc_readlink_trampoline() //go:linkname libc_readlink libc_readlink //go:cgo_import_dynamic libc_readlink readlink "/usr/lib/libSystem.B.dylib" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Rename(from string, to string) (err error) { @@ -1228,6 +1303,7 @@ func libc_rename_trampoline() //go:linkname libc_rename libc_rename //go:cgo_import_dynamic libc_rename rename "/usr/lib/libSystem.B.dylib" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Revoke(path string) (err error) { @@ -1247,6 +1323,7 @@ func libc_revoke_trampoline() //go:linkname libc_revoke libc_revoke //go:cgo_import_dynamic libc_revoke revoke "/usr/lib/libSystem.B.dylib" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Rmdir(path string) (err error) { @@ -1266,6 +1343,7 @@ func libc_rmdir_trampoline() //go:linkname libc_rmdir libc_rmdir //go:cgo_import_dynamic libc_rmdir rmdir "/usr/lib/libSystem.B.dylib" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Seek(fd int, offset int64, whence int) (newoffset int64, err error) { @@ -1281,6 +1359,7 @@ func libc_lseek_trampoline() //go:linkname libc_lseek libc_lseek //go:cgo_import_dynamic libc_lseek lseek "/usr/lib/libSystem.B.dylib" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Select(n int, r *FdSet, w *FdSet, e *FdSet, timeout *Timeval) (err error) { @@ -1295,6 +1374,7 @@ func libc_select_trampoline() //go:linkname libc_select libc_select //go:cgo_import_dynamic libc_select select "/usr/lib/libSystem.B.dylib" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Setegid(egid int) (err error) { @@ -1309,6 +1389,7 @@ func libc_setegid_trampoline() //go:linkname libc_setegid libc_setegid //go:cgo_import_dynamic libc_setegid setegid "/usr/lib/libSystem.B.dylib" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Seteuid(euid int) (err error) { @@ -1323,6 +1404,7 @@ func libc_seteuid_trampoline() //go:linkname libc_seteuid libc_seteuid //go:cgo_import_dynamic libc_seteuid seteuid "/usr/lib/libSystem.B.dylib" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Setgid(gid int) (err error) { @@ -1337,6 +1419,7 @@ func libc_setgid_trampoline() //go:linkname libc_setgid libc_setgid //go:cgo_import_dynamic libc_setgid setgid "/usr/lib/libSystem.B.dylib" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Setlogin(name string) (err error) { @@ -1356,6 +1439,7 @@ func libc_setlogin_trampoline() //go:linkname libc_setlogin libc_setlogin //go:cgo_import_dynamic libc_setlogin setlogin "/usr/lib/libSystem.B.dylib" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Setpgid(pid int, pgid int) (err error) { @@ -1370,6 +1454,7 @@ func libc_setpgid_trampoline() //go:linkname libc_setpgid libc_setpgid //go:cgo_import_dynamic libc_setpgid setpgid "/usr/lib/libSystem.B.dylib" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Setpriority(which int, who int, prio int) (err error) { @@ -1384,6 +1469,7 @@ func libc_setpriority_trampoline() //go:linkname libc_setpriority libc_setpriority //go:cgo_import_dynamic libc_setpriority setpriority "/usr/lib/libSystem.B.dylib" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Setprivexec(flag int) (err error) { @@ -1398,6 +1484,7 @@ func libc_setprivexec_trampoline() //go:linkname libc_setprivexec libc_setprivexec //go:cgo_import_dynamic libc_setprivexec setprivexec "/usr/lib/libSystem.B.dylib" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Setregid(rgid int, egid int) (err error) { @@ -1412,6 +1499,7 @@ func libc_setregid_trampoline() //go:linkname libc_setregid libc_setregid //go:cgo_import_dynamic libc_setregid setregid "/usr/lib/libSystem.B.dylib" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Setreuid(ruid int, euid int) (err error) { @@ -1426,6 +1514,7 @@ func libc_setreuid_trampoline() //go:linkname libc_setreuid libc_setreuid //go:cgo_import_dynamic libc_setreuid setreuid "/usr/lib/libSystem.B.dylib" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Setrlimit(which int, lim *Rlimit) (err error) { @@ -1440,6 +1529,7 @@ func libc_setrlimit_trampoline() //go:linkname libc_setrlimit libc_setrlimit //go:cgo_import_dynamic libc_setrlimit setrlimit "/usr/lib/libSystem.B.dylib" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Setsid() (pid int, err error) { @@ -1455,6 +1545,7 @@ func libc_setsid_trampoline() //go:linkname libc_setsid libc_setsid //go:cgo_import_dynamic libc_setsid setsid "/usr/lib/libSystem.B.dylib" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Settimeofday(tp *Timeval) (err error) { @@ -1469,6 +1560,7 @@ func libc_settimeofday_trampoline() //go:linkname libc_settimeofday libc_settimeofday //go:cgo_import_dynamic libc_settimeofday settimeofday "/usr/lib/libSystem.B.dylib" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Setuid(uid int) (err error) { @@ -1483,6 +1575,7 @@ func libc_setuid_trampoline() //go:linkname libc_setuid libc_setuid //go:cgo_import_dynamic libc_setuid setuid "/usr/lib/libSystem.B.dylib" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Symlink(path string, link string) (err error) { @@ -1507,6 +1600,7 @@ func libc_symlink_trampoline() //go:linkname libc_symlink libc_symlink //go:cgo_import_dynamic libc_symlink symlink "/usr/lib/libSystem.B.dylib" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Sync() (err error) { @@ -1521,6 +1615,7 @@ func libc_sync_trampoline() //go:linkname libc_sync libc_sync //go:cgo_import_dynamic libc_sync sync "/usr/lib/libSystem.B.dylib" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Truncate(path string, length int64) (err error) { @@ -1540,6 +1635,7 @@ func libc_truncate_trampoline() //go:linkname libc_truncate libc_truncate //go:cgo_import_dynamic libc_truncate truncate "/usr/lib/libSystem.B.dylib" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Umask(newmask int) (oldmask int) { @@ -1552,6 +1648,7 @@ func libc_umask_trampoline() //go:linkname libc_umask libc_umask //go:cgo_import_dynamic libc_umask umask "/usr/lib/libSystem.B.dylib" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Undelete(path string) (err error) { @@ -1571,6 +1668,7 @@ func libc_undelete_trampoline() //go:linkname libc_undelete libc_undelete //go:cgo_import_dynamic libc_undelete undelete "/usr/lib/libSystem.B.dylib" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Unlink(path string) (err error) { @@ -1590,6 +1688,7 @@ func libc_unlink_trampoline() //go:linkname libc_unlink libc_unlink //go:cgo_import_dynamic libc_unlink unlink "/usr/lib/libSystem.B.dylib" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Unmount(path string, flags int) (err error) { @@ -1609,6 +1708,7 @@ func libc_unmount_trampoline() //go:linkname libc_unmount libc_unmount //go:cgo_import_dynamic libc_unmount unmount "/usr/lib/libSystem.B.dylib" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func write(fd int, p []byte) (n int, err error) { @@ -1630,6 +1730,7 @@ func libc_write_trampoline() //go:linkname libc_write libc_write //go:cgo_import_dynamic libc_write write "/usr/lib/libSystem.B.dylib" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func writev(fd int, iovecs []Iovec) (cnt uintptr, err error) { @@ -1651,6 +1752,7 @@ func libc_writev_trampoline() //go:linkname libc_writev libc_writev //go:cgo_import_dynamic libc_writev writev "/usr/lib/libSystem.B.dylib" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func mmap(addr uintptr, length uintptr, prot int, flag int, fd int, pos int64) (ret uintptr, err error) { @@ -1666,6 +1768,7 @@ func libc_mmap_trampoline() //go:linkname libc_mmap libc_mmap //go:cgo_import_dynamic libc_mmap mmap "/usr/lib/libSystem.B.dylib" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func munmap(addr uintptr, length uintptr) (err error) { @@ -1680,6 +1783,7 @@ func libc_munmap_trampoline() //go:linkname libc_munmap libc_munmap //go:cgo_import_dynamic libc_munmap munmap "/usr/lib/libSystem.B.dylib" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func fork() (pid int, err error) { @@ -1695,6 +1799,7 @@ func libc_fork_trampoline() //go:linkname libc_fork libc_fork //go:cgo_import_dynamic libc_fork fork "/usr/lib/libSystem.B.dylib" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func ioctl(fd int, req int, arg int) (err error) { @@ -1709,6 +1814,7 @@ func libc_ioctl_trampoline() //go:linkname libc_ioctl libc_ioctl //go:cgo_import_dynamic libc_ioctl ioctl "/usr/lib/libSystem.B.dylib" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func ioctlPtr(fd int, req uint, arg unsafe.Pointer) (err error) { @@ -1733,6 +1839,7 @@ func libc_execve_trampoline() //go:linkname libc_execve libc_execve //go:cgo_import_dynamic libc_execve execve "/usr/lib/libSystem.B.dylib" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func exit(res int) (err error) { @@ -1747,6 +1854,7 @@ func libc_exit_trampoline() //go:linkname libc_exit libc_exit //go:cgo_import_dynamic libc_exit exit "/usr/lib/libSystem.B.dylib" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func sysctl(mib []_C_int, old *byte, oldlen *uintptr, new *byte, newlen uintptr) (err error) { @@ -1767,6 +1875,7 @@ func libc_sysctl_trampoline() //go:linkname libc_sysctl libc_sysctl //go:cgo_import_dynamic libc_sysctl sysctl "/usr/lib/libSystem.B.dylib" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func fcntlPtr(fd int, cmd int, arg unsafe.Pointer) (val int, err error) { @@ -1797,6 +1906,7 @@ func libc_unlinkat_trampoline() //go:linkname libc_unlinkat libc_unlinkat //go:cgo_import_dynamic libc_unlinkat unlinkat "/usr/lib/libSystem.B.dylib" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func openat(fd int, path string, flags int, perm uint32) (fdret int, err error) { @@ -1817,6 +1927,7 @@ func libc_openat_trampoline() //go:linkname libc_openat libc_openat //go:cgo_import_dynamic libc_openat openat "/usr/lib/libSystem.B.dylib" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func closedir(dir uintptr) (err error) { @@ -1831,6 +1942,7 @@ func libc_closedir_trampoline() //go:linkname libc_closedir libc_closedir //go:cgo_import_dynamic libc_closedir closedir "/usr/lib/libSystem.B.dylib" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Fstat(fd int, stat *Stat_t) (err error) { @@ -1845,6 +1957,7 @@ func libc_fstat_trampoline() //go:linkname libc_fstat libc_fstat //go:cgo_import_dynamic libc_fstat fstat "/usr/lib/libSystem.B.dylib" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Fstatfs(fd int, stat *Statfs_t) (err error) { @@ -1859,6 +1972,7 @@ func libc_fstatfs_trampoline() //go:linkname libc_fstatfs libc_fstatfs //go:cgo_import_dynamic libc_fstatfs fstatfs "/usr/lib/libSystem.B.dylib" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Gettimeofday(tp *Timeval) (err error) { @@ -1873,6 +1987,7 @@ func libc_gettimeofday_trampoline() //go:linkname libc_gettimeofday libc_gettimeofday //go:cgo_import_dynamic libc_gettimeofday gettimeofday "/usr/lib/libSystem.B.dylib" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Lstat(path string, stat *Stat_t) (err error) { @@ -1892,6 +2007,7 @@ func libc_lstat_trampoline() //go:linkname libc_lstat libc_lstat //go:cgo_import_dynamic libc_lstat lstat "/usr/lib/libSystem.B.dylib" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func readdir_r(dirp uintptr, entry uintptr, result uintptr) (res int) { @@ -1904,6 +2020,7 @@ func libc_readdir_r_trampoline() //go:linkname libc_readdir_r libc_readdir_r //go:cgo_import_dynamic libc_readdir_r readdir_r "/usr/lib/libSystem.B.dylib" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Stat(path string, stat *Stat_t) (err error) { @@ -1923,6 +2040,7 @@ func libc_stat_trampoline() //go:linkname libc_stat libc_stat //go:cgo_import_dynamic libc_stat stat "/usr/lib/libSystem.B.dylib" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Statfs(path string, stat *Statfs_t) (err error) { @@ -1942,6 +2060,7 @@ func libc_statfs_trampoline() //go:linkname libc_statfs libc_statfs //go:cgo_import_dynamic libc_statfs statfs "/usr/lib/libSystem.B.dylib" + // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func fstatat(fd int, path string, stat *Stat_t, flags int) (err error) { diff --git a/src/testing/testing.go b/src/testing/testing.go index 3068630e8a..79dcf76908 100644 --- a/src/testing/testing.go +++ b/src/testing/testing.go @@ -614,7 +614,7 @@ func (c *common) log(s string) { c.logDepth(s, 3) // logDepth + log + public function } -// logDepth generates the output. At an arbitary stack depth +// logDepth generates the output at an arbitrary stack depth. func (c *common) logDepth(s string, depth int) { c.mu.Lock() defer c.mu.Unlock() diff --git a/src/text/scanner/scanner.go b/src/text/scanner/scanner.go index 893a4edbaf..8db0ed28d3 100644 --- a/src/text/scanner/scanner.go +++ b/src/text/scanner/scanner.go @@ -59,15 +59,16 @@ func (pos Position) String() string { // "foo" is scanned as the token sequence '"' Ident '"'. // const ( - ScanIdents = 1 << -Ident - ScanInts = 1 << -Int - ScanFloats = 1 << -Float // includes Ints - ScanChars = 1 << -Char - ScanStrings = 1 << -String - ScanRawStrings = 1 << -RawString - ScanComments = 1 << -Comment - SkipComments = 1 << -skipComment // if set with ScanComments, comments become white space - GoTokens = ScanIdents | ScanFloats | ScanChars | ScanStrings | ScanRawStrings | ScanComments | SkipComments + ScanIdents = 1 << -Ident + ScanInts = 1 << -Int + ScanFloats = 1 << -Float // includes Ints and hexadecimal floats + ScanChars = 1 << -Char + ScanStrings = 1 << -String + ScanRawStrings = 1 << -RawString + ScanComments = 1 << -Comment + SkipComments = 1 << -skipComment // if set with ScanComments, comments become white space + AllowNumberbars = 1 << -allowNumberbars // if set, number literals may contain underbars as digit separators + GoTokens = ScanIdents | ScanFloats | ScanChars | ScanStrings | ScanRawStrings | ScanComments | SkipComments | AllowNumberbars ) // The result of Scan is one of these tokens or a Unicode character. @@ -80,7 +81,10 @@ const ( String RawString Comment + + // internal use only skipComment + allowNumberbars ) var tokenString = map[rune]string{ @@ -266,7 +270,7 @@ func (s *Scanner) next() rune { s.srcPos += width s.lastCharLen = width s.column++ - s.error("illegal UTF-8 encoding") + s.error("invalid UTF-8 encoding") return ch } } @@ -281,7 +285,7 @@ func (s *Scanner) next() rune { switch ch { case 0: // for compatibility with other tools - s.error("illegal character NUL") + s.error("invalid character NUL") case '\n': s.line++ s.lastLineLen = s.column @@ -322,6 +326,7 @@ func (s *Scanner) Peek() rune { } func (s *Scanner) error(msg string) { + s.tokEnd = s.srcPos - s.lastCharLen // make sure token text is terminated s.ErrorCount++ if s.Error != nil { s.Error(s, msg) @@ -334,6 +339,10 @@ func (s *Scanner) error(msg string) { fmt.Fprintf(os.Stderr, "%s: %s\n", pos, msg) } +func (s *Scanner) errorf(format string, args ...interface{}) { + s.error(fmt.Sprintf(format, args...)) +} + func (s *Scanner) isIdentRune(ch rune, i int) bool { if s.IsIdentRune != nil { return s.IsIdentRune(ch, i) @@ -350,104 +359,200 @@ func (s *Scanner) scanIdentifier() rune { return ch } +func lower(ch rune) rune { return ('a' - 'A') | ch } // returns lower-case ch iff ch is ASCII letter +func isDecimal(ch rune) bool { return '0' <= ch && ch <= '9' } +func isHex(ch rune) bool { return '0' <= ch && ch <= '9' || 'a' <= lower(ch) && lower(ch) <= 'f' } + +// digits accepts the sequence { digit } (if AllowNumberbars is not set) +// or { digit | '_' } (if AllowNumberbars is set), starting with ch0. +// If base <= 10, digits accepts any decimal digit but records +// the first invalid digit >= base in *invalid if *invalid == 0. +// digits returns the first rune that is not part of the sequence +// anymore, and a bitset describing whether the sequence contained +// digits (bit 0 is set), or separators '_' (bit 1 is set). +func (s *Scanner) digits(ch0 rune, base int, invalid *rune) (ch rune, digsep int) { + ch = ch0 + if base <= 10 { + max := rune('0' + base) + for isDecimal(ch) || ch == '_' && s.Mode&AllowNumberbars != 0 { + ds := 1 + if ch == '_' { + ds = 2 + } else if ch >= max && *invalid == 0 { + *invalid = ch + } + digsep |= ds + ch = s.next() + } + } else { + for isHex(ch) || ch == '_' && s.Mode&AllowNumberbars != 0 { + ds := 1 + if ch == '_' { + ds = 2 + } + digsep |= ds + ch = s.next() + } + } + return +} + +func (s *Scanner) scanNumber(ch rune, seenDot bool) (rune, rune) { + base := 10 // number base + prefix := rune(0) // one of 0 (decimal), '0' (0-octal), 'x', 'o', or 'b' + digsep := 0 // bit 0: digit present, bit 1: '_' present + invalid := rune(0) // invalid digit in literal, or 0 + + // integer part + var tok rune + var ds int + if !seenDot { + tok = Int + if ch == '0' { + ch = s.next() + switch lower(ch) { + case 'x': + ch = s.next() + base, prefix = 16, 'x' + case 'o': + ch = s.next() + base, prefix = 8, 'o' + case 'b': + ch = s.next() + base, prefix = 2, 'b' + default: + base, prefix = 8, '0' + digsep = 1 // leading 0 + } + } + ch, ds = s.digits(ch, base, &invalid) + digsep |= ds + if ch == '.' && s.Mode&ScanFloats != 0 { + ch = s.next() + seenDot = true + } + } + + // fractional part + if seenDot { + tok = Float + if prefix == 'o' || prefix == 'b' { + s.error("invalid radix point in " + litname(prefix)) + } + ch, ds = s.digits(ch, base, &invalid) + digsep |= ds + } + + if digsep&1 == 0 { + s.error(litname(prefix) + " has no digits") + } + + // exponent + if e := lower(ch); (e == 'e' || e == 'p') && s.Mode&ScanFloats != 0 { + switch { + case e == 'e' && prefix != 0 && prefix != '0': + s.errorf("%q exponent requires decimal mantissa", ch) + case e == 'p' && prefix != 'x': + s.errorf("%q exponent requires hexadecimal mantissa", ch) + } + ch = s.next() + tok = Float + if ch == '+' || ch == '-' { + ch = s.next() + } + ch, ds = s.digits(ch, 10, nil) + digsep |= ds + if ds&1 == 0 { + s.error("exponent has no digits") + } + } else if prefix == 'x' && tok == Float { + s.error("hexadecimal mantissa requires a 'p' exponent") + } + + if tok == Int && invalid != 0 { + s.errorf("invalid digit %q in %s", invalid, litname(prefix)) + } + + if digsep&2 != 0 { + s.tokEnd = s.srcPos - s.lastCharLen // make sure token text is terminated + if i := invalidSep(s.TokenText()); i >= 0 { + s.error("'_' must separate successive digits") + } + } + + return tok, ch +} + +func litname(prefix rune) string { + switch prefix { + default: + return "decimal literal" + case 'x': + return "hexadecimal literal" + case 'o', '0': + return "octal literal" + case 'b': + return "binary literal" + } +} + +// invalidSep returns the index of the first invalid separator in x, or -1. +func invalidSep(x string) int { + x1 := ' ' // prefix char, we only care if it's 'x' + d := '.' // digit, one of '_', '0' (a digit), or '.' (anything else) + i := 0 + + // a prefix counts as a digit + if len(x) >= 2 && x[0] == '0' { + x1 = lower(rune(x[1])) + if x1 == 'x' || x1 == 'o' || x1 == 'b' { + d = '0' + i = 2 + } + } + + // mantissa and exponent + for ; i < len(x); i++ { + p := d // previous digit + d = rune(x[i]) + switch { + case d == '_': + if p != '0' { + return i + } + case isDecimal(d) || x1 == 'x' && isHex(d): + d = '0' + default: + if p == '_' { + return i - 1 + } + d = '.' + } + } + if d == '_' { + return len(x) - 1 + } + + return -1 +} + func digitVal(ch rune) int { switch { case '0' <= ch && ch <= '9': return int(ch - '0') - case 'a' <= ch && ch <= 'f': - return int(ch - 'a' + 10) - case 'A' <= ch && ch <= 'F': - return int(ch - 'A' + 10) + case 'a' <= lower(ch) && lower(ch) <= 'f': + return int(lower(ch) - 'a' + 10) } return 16 // larger than any legal digit val } -func isDecimal(ch rune) bool { return '0' <= ch && ch <= '9' } - -func (s *Scanner) scanMantissa(ch rune) rune { - for isDecimal(ch) { - ch = s.next() - } - return ch -} - -func (s *Scanner) scanFraction(ch rune) rune { - if ch == '.' { - ch = s.scanMantissa(s.next()) - } - return ch -} - -func (s *Scanner) scanExponent(ch rune) rune { - if ch == 'e' || ch == 'E' { - ch = s.next() - if ch == '-' || ch == '+' { - ch = s.next() - } - if !isDecimal(ch) { - s.error("illegal exponent") - } - ch = s.scanMantissa(ch) - } - return ch -} - -func (s *Scanner) scanNumber(ch rune) (rune, rune) { - // isDecimal(ch) - if ch == '0' { - // int or float - ch = s.next() - if ch == 'x' || ch == 'X' { - // hexadecimal int - ch = s.next() - hasMantissa := false - for digitVal(ch) < 16 { - ch = s.next() - hasMantissa = true - } - if !hasMantissa { - s.error("illegal hexadecimal number") - } - } else { - // octal int or float - has8or9 := false - for isDecimal(ch) { - if ch > '7' { - has8or9 = true - } - ch = s.next() - } - if s.Mode&ScanFloats != 0 && (ch == '.' || ch == 'e' || ch == 'E') { - // float - ch = s.scanFraction(ch) - ch = s.scanExponent(ch) - return Float, ch - } - // octal int - if has8or9 { - s.error("illegal octal number") - } - } - return Int, ch - } - // decimal int or float - ch = s.scanMantissa(ch) - if s.Mode&ScanFloats != 0 && (ch == '.' || ch == 'e' || ch == 'E') { - // float - ch = s.scanFraction(ch) - ch = s.scanExponent(ch) - return Float, ch - } - return Int, ch -} - func (s *Scanner) scanDigits(ch rune, base, n int) rune { for n > 0 && digitVal(ch) < base { ch = s.next() n-- } if n > 0 { - s.error("illegal char escape") + s.error("invalid char escape") } return ch } @@ -467,7 +572,7 @@ func (s *Scanner) scanEscape(quote rune) rune { case 'U': ch = s.scanDigits(s.next(), 16, 8) default: - s.error("illegal char escape") + s.error("invalid char escape") } return ch } @@ -502,7 +607,7 @@ func (s *Scanner) scanRawString() { func (s *Scanner) scanChar() { if s.scanString('\'') != 1 { - s.error("illegal char literal") + s.error("invalid char literal") } } @@ -583,7 +688,7 @@ redo: } case isDecimal(ch): if s.Mode&(ScanInts|ScanFloats) != 0 { - tok, ch = s.scanNumber(ch) + tok, ch = s.scanNumber(ch, false) } else { ch = s.next() } @@ -606,9 +711,7 @@ redo: case '.': ch = s.next() if isDecimal(ch) && s.Mode&ScanFloats != 0 { - tok = Float - ch = s.scanMantissa(ch) - ch = s.scanExponent(ch) + tok, ch = s.scanNumber(ch, true) } case '/': ch = s.next() @@ -664,17 +767,18 @@ func (s *Scanner) Pos() (pos Position) { } // TokenText returns the string corresponding to the most recently scanned token. -// Valid after calling Scan(). +// Valid after calling Scan and in calls of Scanner.Error. func (s *Scanner) TokenText() string { if s.tokPos < 0 { // no token text return "" } - if s.tokEnd < 0 { + if s.tokEnd < s.tokPos { // if EOF was reached, s.tokEnd is set to -1 (s.srcPos == 0) s.tokEnd = s.tokPos } + // s.tokEnd >= s.tokPos if s.tokBuf.Len() == 0 { // common case: the entire token text is still in srcBuf diff --git a/src/text/scanner/scanner_test.go b/src/text/scanner/scanner_test.go index e26e816f51..6ae8fd9a08 100644 --- a/src/text/scanner/scanner_test.go +++ b/src/text/scanner/scanner_test.go @@ -290,9 +290,15 @@ func TestScan(t *testing.T) { testScan(t, GoTokens&^SkipComments) } -func TestIllegalExponent(t *testing.T) { +func TestInvalidExponent(t *testing.T) { const src = "1.5e 1.5E 1e+ 1e- 1.5z" s := new(Scanner).Init(strings.NewReader(src)) + s.Error = func(s *Scanner, msg string) { + const want = "exponent has no digits" + if msg != want { + t.Errorf("%s: got error %q; want %q", s.TokenText(), msg, want) + } + } checkTokErr(t, s, 1, Float, "1.5e") checkTokErr(t, s, 1, Float, "1.5E") checkTokErr(t, s, 1, Float, "1e+") @@ -372,7 +378,7 @@ func TestScanSelectedMask(t *testing.T) { testScanSelectedMode(t, 0, 0) testScanSelectedMode(t, ScanIdents, Ident) // Don't test ScanInts and ScanNumbers since some parts of - // the floats in the source look like (illegal) octal ints + // the floats in the source look like (invalid) octal ints // and ScanNumbers may return either Int or Float. testScanSelectedMode(t, ScanChars, Char) testScanSelectedMode(t, ScanStrings, String) @@ -474,34 +480,34 @@ func testError(t *testing.T, src, pos, msg string, tok rune) { } func TestError(t *testing.T) { - testError(t, "\x00", ":1:1", "illegal character NUL", 0) - testError(t, "\x80", ":1:1", "illegal UTF-8 encoding", utf8.RuneError) - testError(t, "\xff", ":1:1", "illegal UTF-8 encoding", utf8.RuneError) + testError(t, "\x00", ":1:1", "invalid character NUL", 0) + testError(t, "\x80", ":1:1", "invalid UTF-8 encoding", utf8.RuneError) + testError(t, "\xff", ":1:1", "invalid UTF-8 encoding", utf8.RuneError) - testError(t, "a\x00", ":1:2", "illegal character NUL", Ident) - testError(t, "ab\x80", ":1:3", "illegal UTF-8 encoding", Ident) - testError(t, "abc\xff", ":1:4", "illegal UTF-8 encoding", Ident) + testError(t, "a\x00", ":1:2", "invalid character NUL", Ident) + testError(t, "ab\x80", ":1:3", "invalid UTF-8 encoding", Ident) + testError(t, "abc\xff", ":1:4", "invalid UTF-8 encoding", Ident) - testError(t, `"a`+"\x00", ":1:3", "illegal character NUL", String) - testError(t, `"ab`+"\x80", ":1:4", "illegal UTF-8 encoding", String) - testError(t, `"abc`+"\xff", ":1:5", "illegal UTF-8 encoding", String) + testError(t, `"a`+"\x00", ":1:3", "invalid character NUL", String) + testError(t, `"ab`+"\x80", ":1:4", "invalid UTF-8 encoding", String) + testError(t, `"abc`+"\xff", ":1:5", "invalid UTF-8 encoding", String) - testError(t, "`a"+"\x00", ":1:3", "illegal character NUL", RawString) - testError(t, "`ab"+"\x80", ":1:4", "illegal UTF-8 encoding", RawString) - testError(t, "`abc"+"\xff", ":1:5", "illegal UTF-8 encoding", RawString) + testError(t, "`a"+"\x00", ":1:3", "invalid character NUL", RawString) + testError(t, "`ab"+"\x80", ":1:4", "invalid UTF-8 encoding", RawString) + testError(t, "`abc"+"\xff", ":1:5", "invalid UTF-8 encoding", RawString) - testError(t, `'\"'`, ":1:3", "illegal char escape", Char) - testError(t, `"\'"`, ":1:3", "illegal char escape", String) + testError(t, `'\"'`, ":1:3", "invalid char escape", Char) + testError(t, `"\'"`, ":1:3", "invalid char escape", String) - testError(t, `01238`, ":1:6", "illegal octal number", Int) - testError(t, `01238123`, ":1:9", "illegal octal number", Int) - testError(t, `0x`, ":1:3", "illegal hexadecimal number", Int) - testError(t, `0xg`, ":1:3", "illegal hexadecimal number", Int) - testError(t, `'aa'`, ":1:4", "illegal char literal", Char) - testError(t, `1.5e`, ":1:5", "illegal exponent", Float) - testError(t, `1.5E`, ":1:5", "illegal exponent", Float) - testError(t, `1.5e+`, ":1:6", "illegal exponent", Float) - testError(t, `1.5e-`, ":1:6", "illegal exponent", Float) + testError(t, `01238`, ":1:6", "invalid digit '8' in octal literal", Int) + testError(t, `01238123`, ":1:9", "invalid digit '8' in octal literal", Int) + testError(t, `0x`, ":1:3", "hexadecimal literal has no digits", Int) + testError(t, `0xg`, ":1:3", "hexadecimal literal has no digits", Int) + testError(t, `'aa'`, ":1:4", "invalid char literal", Char) + testError(t, `1.5e`, ":1:5", "exponent has no digits", Float) + testError(t, `1.5E`, ":1:5", "exponent has no digits", Float) + testError(t, `1.5e+`, ":1:6", "exponent has no digits", Float) + testError(t, `1.5e-`, ":1:6", "exponent has no digits", Float) testError(t, `'`, ":1:2", "literal not terminated", Char) testError(t, `'`+"\n", ":1:2", "literal not terminated", Char) @@ -692,3 +698,219 @@ func TestScanEOFHandling(t *testing.T) { t.Errorf("scanner called Read %d times, not once", r) } } + +func TestIssue29723(t *testing.T) { + s := new(Scanner).Init(strings.NewReader(`x "`)) + s.Error = func(s *Scanner, _ string) { + got := s.TokenText() // this call shouldn't panic + const want = `"` + if got != want { + t.Errorf("got %q; want %q", got, want) + } + } + for r := s.Scan(); r != EOF; r = s.Scan() { + } +} + +func TestNumbers(t *testing.T) { + for _, test := range []struct { + tok rune + src, tokens, err string + }{ + // binaries + {Int, "0b0", "0b0", ""}, + {Int, "0b1010", "0b1010", ""}, + {Int, "0B1110", "0B1110", ""}, + + {Int, "0b", "0b", "binary literal has no digits"}, + {Int, "0b0190", "0b0190", "invalid digit '9' in binary literal"}, + {Int, "0b01a0", "0b01 a0", ""}, // only accept 0-9 + + // binary floats (invalid) + {Float, "0b.", "0b.", "invalid radix point in binary literal"}, + {Float, "0b.1", "0b.1", "invalid radix point in binary literal"}, + {Float, "0b1.0", "0b1.0", "invalid radix point in binary literal"}, + {Float, "0b1e10", "0b1e10", "'e' exponent requires decimal mantissa"}, + {Float, "0b1P-1", "0b1P-1", "'P' exponent requires hexadecimal mantissa"}, + + // octals + {Int, "0o0", "0o0", ""}, + {Int, "0o1234", "0o1234", ""}, + {Int, "0O1234", "0O1234", ""}, + + {Int, "0o", "0o", "octal literal has no digits"}, + {Int, "0o8123", "0o8123", "invalid digit '8' in octal literal"}, + {Int, "0o1293", "0o1293", "invalid digit '9' in octal literal"}, + {Int, "0o12a3", "0o12 a3", ""}, // only accept 0-9 + + // octal floats (invalid) + {Float, "0o.", "0o.", "invalid radix point in octal literal"}, + {Float, "0o.2", "0o.2", "invalid radix point in octal literal"}, + {Float, "0o1.2", "0o1.2", "invalid radix point in octal literal"}, + {Float, "0o1E+2", "0o1E+2", "'E' exponent requires decimal mantissa"}, + {Float, "0o1p10", "0o1p10", "'p' exponent requires hexadecimal mantissa"}, + + // 0-octals + {Int, "0", "0", ""}, + {Int, "0123", "0123", ""}, + + {Int, "08123", "08123", "invalid digit '8' in octal literal"}, + {Int, "01293", "01293", "invalid digit '9' in octal literal"}, + {Int, "0F.", "0 F .", ""}, // only accept 0-9 + {Int, "0123F.", "0123 F .", ""}, + {Int, "0123456x", "0123456 x", ""}, + + // decimals + {Int, "1", "1", ""}, + {Int, "1234", "1234", ""}, + + {Int, "1f", "1 f", ""}, // only accept 0-9 + + // decimal floats + {Float, "0.", "0.", ""}, + {Float, "123.", "123.", ""}, + {Float, "0123.", "0123.", ""}, + + {Float, ".0", ".0", ""}, + {Float, ".123", ".123", ""}, + {Float, ".0123", ".0123", ""}, + + {Float, "0.0", "0.0", ""}, + {Float, "123.123", "123.123", ""}, + {Float, "0123.0123", "0123.0123", ""}, + + {Float, "0e0", "0e0", ""}, + {Float, "123e+0", "123e+0", ""}, + {Float, "0123E-1", "0123E-1", ""}, + + {Float, "0.e+1", "0.e+1", ""}, + {Float, "123.E-10", "123.E-10", ""}, + {Float, "0123.e123", "0123.e123", ""}, + + {Float, ".0e-1", ".0e-1", ""}, + {Float, ".123E+10", ".123E+10", ""}, + {Float, ".0123E123", ".0123E123", ""}, + + {Float, "0.0e1", "0.0e1", ""}, + {Float, "123.123E-10", "123.123E-10", ""}, + {Float, "0123.0123e+456", "0123.0123e+456", ""}, + + {Float, "0e", "0e", "exponent has no digits"}, + {Float, "0E+", "0E+", "exponent has no digits"}, + {Float, "1e+f", "1e+ f", "exponent has no digits"}, + {Float, "0p0", "0p0", "'p' exponent requires hexadecimal mantissa"}, + {Float, "1.0P-1", "1.0P-1", "'P' exponent requires hexadecimal mantissa"}, + + // hexadecimals + {Int, "0x0", "0x0", ""}, + {Int, "0x1234", "0x1234", ""}, + {Int, "0xcafef00d", "0xcafef00d", ""}, + {Int, "0XCAFEF00D", "0XCAFEF00D", ""}, + + {Int, "0x", "0x", "hexadecimal literal has no digits"}, + {Int, "0x1g", "0x1 g", ""}, + + // hexadecimal floats + {Float, "0x0p0", "0x0p0", ""}, + {Float, "0x12efp-123", "0x12efp-123", ""}, + {Float, "0xABCD.p+0", "0xABCD.p+0", ""}, + {Float, "0x.0189P-0", "0x.0189P-0", ""}, + {Float, "0x1.ffffp+1023", "0x1.ffffp+1023", ""}, + + {Float, "0x.", "0x.", "hexadecimal literal has no digits"}, + {Float, "0x0.", "0x0.", "hexadecimal mantissa requires a 'p' exponent"}, + {Float, "0x.0", "0x.0", "hexadecimal mantissa requires a 'p' exponent"}, + {Float, "0x1.1", "0x1.1", "hexadecimal mantissa requires a 'p' exponent"}, + {Float, "0x1.1e0", "0x1.1e0", "hexadecimal mantissa requires a 'p' exponent"}, + {Float, "0x1.2gp1a", "0x1.2 gp1a", "hexadecimal mantissa requires a 'p' exponent"}, + {Float, "0x0p", "0x0p", "exponent has no digits"}, + {Float, "0xeP-", "0xeP-", "exponent has no digits"}, + {Float, "0x1234PAB", "0x1234P AB", "exponent has no digits"}, + {Float, "0x1.2p1a", "0x1.2p1 a", ""}, + + // separators + {Int, "0b_1000_0001", "0b_1000_0001", ""}, + {Int, "0o_600", "0o_600", ""}, + {Int, "0_466", "0_466", ""}, + {Int, "1_000", "1_000", ""}, + {Float, "1_000.000_1", "1_000.000_1", ""}, + {Int, "0x_f00d", "0x_f00d", ""}, + {Float, "0x_f00d.0p1_2", "0x_f00d.0p1_2", ""}, + + {Int, "0b__1000", "0b__1000", "'_' must separate successive digits"}, + {Int, "0o60___0", "0o60___0", "'_' must separate successive digits"}, + {Int, "0466_", "0466_", "'_' must separate successive digits"}, + {Float, "1_.", "1_.", "'_' must separate successive digits"}, + {Float, "0._1", "0._1", "'_' must separate successive digits"}, + {Float, "2.7_e0", "2.7_e0", "'_' must separate successive digits"}, + {Int, "0x___0", "0x___0", "'_' must separate successive digits"}, + {Float, "0x1.0_p0", "0x1.0_p0", "'_' must separate successive digits"}, + } { + s := new(Scanner).Init(strings.NewReader(test.src)) + var err string + s.Error = func(s *Scanner, msg string) { + if err == "" { + err = msg + } + } + + for i, want := range strings.Split(test.tokens, " ") { + err = "" + tok := s.Scan() + lit := s.TokenText() + if i == 0 { + if tok != test.tok { + t.Errorf("%q: got token %s; want %s", test.src, TokenString(tok), TokenString(test.tok)) + } + if err != test.err { + t.Errorf("%q: got error %q; want %q", test.src, err, test.err) + } + } + if lit != want { + t.Errorf("%q: got literal %q (%s); want %s", test.src, lit, TokenString(tok), want) + } + } + + // make sure we read all + if tok := s.Scan(); tok != EOF { + t.Errorf("%q: got %s; want EOF", test.src, TokenString(tok)) + } + } +} + +func TestIssue30320(t *testing.T) { + for _, test := range []struct { + in, want string + mode uint + }{ + {"foo01.bar31.xx-0-1-1-0", "01 31 0 1 1 0", ScanInts}, + {"foo0/12/0/5.67", "0 12 0 5 67", ScanInts}, + {"xxx1e0yyy", "1 0", ScanInts}, + {"1_2", "1 2", ScanInts}, // don't consume _ as part of a number if not explicitly enabled + {"1_2", "1_2", ScanInts | AllowNumberbars}, + {"xxx1.0yyy2e3ee", "1 0 2 3", ScanInts}, + {"xxx1.0yyy2e3ee", "1.0 2e3", ScanFloats}, + } { + got := extractInts(test.in, test.mode) + if got != test.want { + t.Errorf("%q: got %q; want %q", test.in, got, test.want) + } + } +} + +func extractInts(t string, mode uint) (res string) { + var s Scanner + s.Init(strings.NewReader(t)) + s.Mode = mode + for { + switch tok := s.Scan(); tok { + case Int, Float: + if len(res) > 0 { + res += " " + } + res += s.TokenText() + case EOF: + return + } + } +} diff --git a/src/text/template/exec.go b/src/text/template/exec.go index c6ce657cf6..62cf19d30c 100644 --- a/src/text/template/exec.go +++ b/src/text/template/exec.go @@ -495,7 +495,7 @@ func (s *state) idealConstant(constant *parse.NumberNode) reflect.Value { switch { case constant.IsComplex: return reflect.ValueOf(constant.Complex128) // incontrovertible. - case constant.IsFloat && !isHexConstant(constant.Text) && strings.ContainsAny(constant.Text, ".eE"): + case constant.IsFloat && !isHexInt(constant.Text) && strings.ContainsAny(constant.Text, ".eEpP"): return reflect.ValueOf(constant.Float64) case constant.IsInt: n := int(constant.Int64) @@ -509,8 +509,8 @@ func (s *state) idealConstant(constant *parse.NumberNode) reflect.Value { return zero } -func isHexConstant(s string) bool { - return len(s) > 2 && s[0] == '0' && (s[1] == 'x' || s[1] == 'X') +func isHexInt(s string) bool { + return len(s) > 2 && s[0] == '0' && (s[1] == 'x' || s[1] == 'X') && !strings.ContainsAny(s, "pP") } func (s *state) evalFieldNode(dot reflect.Value, field *parse.FieldNode, args []parse.Node, final reflect.Value) reflect.Value { @@ -576,6 +576,13 @@ func (s *state) evalField(dot reflect.Value, fieldName string, node parse.Node, } typ := receiver.Type() receiver, isNil := indirect(receiver) + if receiver.Kind() == reflect.Interface && isNil { + // Calling a method on a nil interface can't work. The + // MethodByName method call below would panic. + s.errorf("nil pointer evaluating %s.%s", typ, fieldName) + return zero + } + // Unless it's an interface, need to get to a value of type *T to guarantee // we see all methods of T and *T. ptr := receiver @@ -591,9 +598,6 @@ func (s *state) evalField(dot reflect.Value, fieldName string, node parse.Node, case reflect.Struct: tField, ok := receiver.Type().FieldByName(fieldName) if ok { - if isNil { - s.errorf("nil pointer evaluating %s.%s", typ, fieldName) - } field := receiver.FieldByIndex(tField.Index) if tField.PkgPath != "" { // field is unexported s.errorf("%s is an unexported field of struct type %s", fieldName, typ) @@ -605,9 +609,6 @@ func (s *state) evalField(dot reflect.Value, fieldName string, node parse.Node, return field } case reflect.Map: - if isNil { - s.errorf("nil pointer evaluating %s.%s", typ, fieldName) - } // If it's a map, attempt to use the field name as a key. nameVal := reflect.ValueOf(fieldName) if nameVal.Type().AssignableTo(receiver.Type().Key()) { @@ -627,6 +628,18 @@ func (s *state) evalField(dot reflect.Value, fieldName string, node parse.Node, } return result } + case reflect.Ptr: + etyp := receiver.Type().Elem() + if etyp.Kind() == reflect.Struct { + if _, ok := etyp.FieldByName(fieldName); !ok { + // If there's no such field, say "can't evaluate" + // instead of "nil pointer evaluating". + break + } + } + if isNil { + s.errorf("nil pointer evaluating %s.%s", typ, fieldName) + } } s.errorf("can't evaluate field %s in type %s", fieldName, typ) panic("not reached") @@ -899,7 +912,9 @@ func (s *state) evalEmptyInterface(dot reflect.Value, n parse.Node) reflect.Valu panic("not reached") } -// indirect returns the item at the end of indirection, and a bool to indicate if it's nil. +// indirect returns the item at the end of indirection, and a bool to indicate +// if it's nil. If the returned bool is true, the returned value's kind will be +// either a pointer or interface. func indirect(v reflect.Value) (rv reflect.Value, isNil bool) { for ; v.Kind() == reflect.Ptr || v.Kind() == reflect.Interface; v = v.Elem() { if v.IsNil() { diff --git a/src/text/template/exec_test.go b/src/text/template/exec_test.go index bfd6d38bf4..a95631718c 100644 --- a/src/text/template/exec_test.go +++ b/src/text/template/exec_test.go @@ -58,8 +58,10 @@ type T struct { Empty3 interface{} Empty4 interface{} // Non-empty interfaces. - NonEmptyInterface I - NonEmptyInterfacePtS *I + NonEmptyInterface I + NonEmptyInterfacePtS *I + NonEmptyInterfaceNil I + NonEmptyInterfaceTypedNil I // Stringer. Str fmt.Stringer Err error @@ -141,24 +143,25 @@ var tVal = &T{ {"one": 1, "two": 2}, {"eleven": 11, "twelve": 12}, }, - Empty1: 3, - Empty2: "empty2", - Empty3: []int{7, 8}, - Empty4: &U{"UinEmpty"}, - NonEmptyInterface: &T{X: "x"}, - NonEmptyInterfacePtS: &siVal, - Str: bytes.NewBuffer([]byte("foozle")), - Err: errors.New("erroozle"), - PI: newInt(23), - PS: newString("a string"), - PSI: newIntSlice(21, 22, 23), - BinaryFunc: func(a, b string) string { return fmt.Sprintf("[%s=%s]", a, b) }, - VariadicFunc: func(s ...string) string { return fmt.Sprint("<", strings.Join(s, "+"), ">") }, - VariadicFuncInt: func(a int, s ...string) string { return fmt.Sprint(a, "=<", strings.Join(s, "+"), ">") }, - NilOKFunc: func(s *int) bool { return s == nil }, - ErrFunc: func() (string, error) { return "bla", nil }, - PanicFunc: func() string { panic("test panic") }, - Tmpl: Must(New("x").Parse("test template")), // "x" is the value of .X + Empty1: 3, + Empty2: "empty2", + Empty3: []int{7, 8}, + Empty4: &U{"UinEmpty"}, + NonEmptyInterface: &T{X: "x"}, + NonEmptyInterfacePtS: &siVal, + NonEmptyInterfaceTypedNil: (*T)(nil), + Str: bytes.NewBuffer([]byte("foozle")), + Err: errors.New("erroozle"), + PI: newInt(23), + PS: newString("a string"), + PSI: newIntSlice(21, 22, 23), + BinaryFunc: func(a, b string) string { return fmt.Sprintf("[%s=%s]", a, b) }, + VariadicFunc: func(s ...string) string { return fmt.Sprint("<", strings.Join(s, "+"), ">") }, + VariadicFuncInt: func(a int, s ...string) string { return fmt.Sprint(a, "=<", strings.Join(s, "+"), ">") }, + NilOKFunc: func(s *int) bool { return s == nil }, + ErrFunc: func() (string, error) { return "bla", nil }, + PanicFunc: func() string { panic("test panic") }, + Tmpl: Must(New("x").Parse("test template")), // "x" is the value of .X } var tSliceOfNil = []*T{nil} @@ -365,6 +368,7 @@ var execTests = []execTest{ {".NilOKFunc not nil", "{{call .NilOKFunc .PI}}", "false", tVal, true}, {".NilOKFunc nil", "{{call .NilOKFunc nil}}", "true", tVal, true}, {"method on nil value from slice", "-{{range .}}{{.Method1 1234}}{{end}}-", "-1234-", tSliceOfNil, true}, + {"method on typed nil interface value", "{{.NonEmptyInterfaceTypedNil.Method0}}", "M0", tVal, true}, // Function call builtin. {".BinaryFunc", "{{call .BinaryFunc `1` `2`}}", "[1=2]", tVal, true}, @@ -542,6 +546,27 @@ var execTests = []execTest{ {"error method, error", "{{.MyError true}}", "", tVal, false}, {"error method, no error", "{{.MyError false}}", "false", tVal, true}, + // Numbers + {"decimal", "{{print 1234}}", "1234", tVal, true}, + {"decimal _", "{{print 12_34}}", "1234", tVal, true}, + {"binary", "{{print 0b101}}", "5", tVal, true}, + {"binary _", "{{print 0b_1_0_1}}", "5", tVal, true}, + {"BINARY", "{{print 0B101}}", "5", tVal, true}, + {"octal0", "{{print 0377}}", "255", tVal, true}, + {"octal", "{{print 0o377}}", "255", tVal, true}, + {"octal _", "{{print 0o_3_7_7}}", "255", tVal, true}, + {"OCTAL", "{{print 0O377}}", "255", tVal, true}, + {"hex", "{{print 0x123}}", "291", tVal, true}, + {"hex _", "{{print 0x1_23}}", "291", tVal, true}, + {"HEX", "{{print 0X123ABC}}", "1194684", tVal, true}, + {"float", "{{print 123.4}}", "123.4", tVal, true}, + {"float _", "{{print 0_0_1_2_3.4}}", "123.4", tVal, true}, + {"hex float", "{{print +0x1.ep+2}}", "7.5", tVal, true}, + {"hex float _", "{{print +0x_1.e_0p+0_2}}", "7.5", tVal, true}, + {"HEX float", "{{print +0X1.EP+2}}", "7.5", tVal, true}, + {"print multi", "{{print 1_2_3_4 7.5_00_00_00}}", "1234 7.5", tVal, true}, + {"print multi2", "{{print 1234 0x0_1.e_0p+02}}", "1234 7.5", tVal, true}, + // Fixed bugs. // Must separate dot and receiver; otherwise args are evaluated with dot set to variable. {"bug0", "{{range .MSIone}}{{if $.Method1 .}}X{{end}}{{end}}", "X", tVal, true}, @@ -1328,20 +1353,64 @@ func TestBlock(t *testing.T) { } } -// Check that calling an invalid field on nil pointer prints -// a field error instead of a distracting nil pointer error. -// https://golang.org/issue/15125 -func TestMissingFieldOnNil(t *testing.T) { - tmpl := Must(New("tmpl").Parse("{{.MissingField}}")) - var d *T - err := tmpl.Execute(ioutil.Discard, d) - got := " " - if err != nil { - got = err.Error() +func TestEvalFieldErrors(t *testing.T) { + tests := []struct { + name, src string + value interface{} + want string + }{ + { + // Check that calling an invalid field on nil pointer + // prints a field error instead of a distracting nil + // pointer error. https://golang.org/issue/15125 + "MissingFieldOnNil", + "{{.MissingField}}", + (*T)(nil), + "can't evaluate field MissingField in type *template.T", + }, + { + "MissingFieldOnNonNil", + "{{.MissingField}}", + &T{}, + "can't evaluate field MissingField in type *template.T", + }, + { + "ExistingFieldOnNil", + "{{.X}}", + (*T)(nil), + "nil pointer evaluating *template.T.X", + }, + { + "MissingKeyOnNilMap", + "{{.MissingKey}}", + (*map[string]string)(nil), + "nil pointer evaluating *map[string]string.MissingKey", + }, + { + "MissingKeyOnNilMapPtr", + "{{.MissingKey}}", + (*map[string]string)(nil), + "nil pointer evaluating *map[string]string.MissingKey", + }, + { + "MissingKeyOnMapPtrToNil", + "{{.MissingKey}}", + &map[string]string{}, + " ", + }, } - want := "can't evaluate field MissingField in type *template.T" - if !strings.HasSuffix(got, want) { - t.Errorf("got error %q, want %q", got, want) + for _, tc := range tests { + t.Run(tc.name, func(t *testing.T) { + tmpl := Must(New("tmpl").Parse(tc.src)) + err := tmpl.Execute(ioutil.Discard, tc.value) + got := " " + if err != nil { + got = err.Error() + } + if !strings.HasSuffix(got, tc.want) { + t.Fatalf("got error %q, want %q", got, tc.want) + } + }) } } @@ -1492,6 +1561,11 @@ func TestExecutePanicDuringCall(t *testing.T) { "{{call .PanicFunc}}", tVal, `template: t:1:2: executing "t" at : error calling call: test panic`, }, + { + "method call on nil interface", + "{{.NonEmptyInterfaceNil.Method0}}", tVal, + `template: t:1:23: executing "t" at <.NonEmptyInterfaceNil.Method0>: nil pointer evaluating template.I.Method0`, + }, } for _, tc := range tests { b := new(bytes.Buffer) diff --git a/src/text/template/parse/lex.go b/src/text/template/parse/lex.go index 94a676c579..92b97f423f 100644 --- a/src/text/template/parse/lex.go +++ b/src/text/template/parse/lex.go @@ -565,17 +565,28 @@ func (l *lexer) scanNumber() bool { // Optional leading sign. l.accept("+-") // Is it hex? - digits := "0123456789" - if l.accept("0") && l.accept("xX") { - digits = "0123456789abcdefABCDEF" + digits := "0123456789_" + if l.accept("0") { + // Note: Leading 0 does not mean octal in floats. + if l.accept("xX") { + digits = "0123456789abcdefABCDEF_" + } else if l.accept("oO") { + digits = "01234567_" + } else if l.accept("bB") { + digits = "01_" + } } l.acceptRun(digits) if l.accept(".") { l.acceptRun(digits) } - if l.accept("eE") { + if len(digits) == 10+1 && l.accept("eE") { l.accept("+-") - l.acceptRun("0123456789") + l.acceptRun("0123456789_") + } + if len(digits) == 16+6+1 && l.accept("pP") { + l.accept("+-") + l.acceptRun("0123456789_") } // Is it imaginary? l.accept("i") diff --git a/src/text/template/parse/lex_test.go b/src/text/template/parse/lex_test.go index 6e7ece9db3..563c4fc1cb 100644 --- a/src/text/template/parse/lex_test.go +++ b/src/text/template/parse/lex_test.go @@ -120,7 +120,7 @@ var lexTests = []lexTest{ {"quote", `{{"abc \n\t\" "}}`, []item{tLeft, tQuote, tRight, tEOF}}, {"raw quote", "{{" + raw + "}}", []item{tLeft, tRawQuote, tRight, tEOF}}, {"raw quote with newline", "{{" + rawNL + "}}", []item{tLeft, tRawQuoteNL, tRight, tEOF}}, - {"numbers", "{{1 02 0x14 -7.2i 1e3 +1.2e-4 4.2i 1+2i}}", []item{ + {"numbers", "{{1 02 0x14 0X14 -7.2i 1e3 1E3 +1.2e-4 4.2i 1+2i 1_2 0x1.e_fp4 0X1.E_FP4}}", []item{ tLeft, mkItem(itemNumber, "1"), tSpace, @@ -128,15 +128,25 @@ var lexTests = []lexTest{ tSpace, mkItem(itemNumber, "0x14"), tSpace, + mkItem(itemNumber, "0X14"), + tSpace, mkItem(itemNumber, "-7.2i"), tSpace, mkItem(itemNumber, "1e3"), tSpace, + mkItem(itemNumber, "1E3"), + tSpace, mkItem(itemNumber, "+1.2e-4"), tSpace, mkItem(itemNumber, "4.2i"), tSpace, mkItem(itemComplex, "1+2i"), + tSpace, + mkItem(itemNumber, "1_2"), + tSpace, + mkItem(itemNumber, "0x1.e_fp4"), + tSpace, + mkItem(itemNumber, "0X1.E_FP4"), tRight, tEOF, }}, diff --git a/src/text/template/parse/node.go b/src/text/template/parse/node.go index dca83dacce..1174a4b970 100644 --- a/src/text/template/parse/node.go +++ b/src/text/template/parse/node.go @@ -596,7 +596,7 @@ func (t *Tree) newNumber(pos Pos, text string, typ itemType) (*NumberNode, error if err == nil { // If we parsed it as a float but it looks like an integer, // it's a huge number too large to fit in an int. Reject it. - if !strings.ContainsAny(text, ".eE") { + if !strings.ContainsAny(text, ".eEpP") { return nil, fmt.Errorf("integer overflow: %q", text) } n.IsFloat = true diff --git a/src/text/template/parse/parse_test.go b/src/text/template/parse/parse_test.go index 15cc65670a..5cb41d0bf5 100644 --- a/src/text/template/parse/parse_test.go +++ b/src/text/template/parse/parse_test.go @@ -30,8 +30,15 @@ var numberTests = []numberTest{ {"0", true, true, true, false, 0, 0, 0, 0}, {"-0", true, true, true, false, 0, 0, 0, 0}, // check that -0 is a uint. {"73", true, true, true, false, 73, 73, 73, 0}, + {"7_3", true, true, true, false, 73, 73, 73, 0}, + {"0b10_010_01", true, true, true, false, 73, 73, 73, 0}, + {"0B10_010_01", true, true, true, false, 73, 73, 73, 0}, {"073", true, true, true, false, 073, 073, 073, 0}, + {"0o73", true, true, true, false, 073, 073, 073, 0}, + {"0O73", true, true, true, false, 073, 073, 073, 0}, {"0x73", true, true, true, false, 0x73, 0x73, 0x73, 0}, + {"0X73", true, true, true, false, 0x73, 0x73, 0x73, 0}, + {"0x7_3", true, true, true, false, 0x73, 0x73, 0x73, 0}, {"-73", true, false, true, false, -73, 0, -73, 0}, {"+73", true, false, true, false, 73, 0, 73, 0}, {"100", true, true, true, false, 100, 100, 100, 0}, @@ -39,7 +46,12 @@ var numberTests = []numberTest{ {"-1e9", true, false, true, false, -1e9, 0, -1e9, 0}, {"-1.2", false, false, true, false, 0, 0, -1.2, 0}, {"1e19", false, true, true, false, 0, 1e19, 1e19, 0}, + {"1e1_9", false, true, true, false, 0, 1e19, 1e19, 0}, + {"1E19", false, true, true, false, 0, 1e19, 1e19, 0}, {"-1e19", false, false, true, false, 0, 0, -1e19, 0}, + {"0x_1p4", true, true, true, false, 16, 16, 16, 0}, + {"0X_1P4", true, true, true, false, 16, 16, 16, 0}, + {"0x_1p-4", false, false, true, false, 0, 0, 1 / 16., 0}, {"4i", false, false, false, true, 0, 0, 0, 4i}, {"-1.2+4.2i", false, false, false, true, 0, 0, 0, -1.2 + 4.2i}, {"073i", false, false, false, true, 0, 0, 0, 73i}, // not octal! diff --git a/src/time/example_test.go b/src/time/example_test.go index 0fd325f2e4..3b3c88e6af 100644 --- a/src/time/example_test.go +++ b/src/time/example_test.go @@ -113,9 +113,14 @@ func ExampleDuration_Minutes() { } func ExampleDuration_Nanoseconds() { - ns, _ := time.ParseDuration("1000ns") - fmt.Printf("one microsecond has %d nanoseconds.", ns.Nanoseconds()) - // Output: one microsecond has 1000 nanoseconds. + u, _ := time.ParseDuration("1µs") + fmt.Printf("One microsecond is %d nanoseconds.\n", u.Nanoseconds()) + // The package also accepts the incorrect but common prefix u for micro. + v, _ := time.ParseDuration("1us") + fmt.Printf("One microsecond is %6.2e seconds.\n", v.Seconds()) + // Output: + // One microsecond is 1000 nanoseconds. + // One microsecond is 1.00e-06 seconds. } func ExampleDuration_Seconds() { diff --git a/src/time/zoneinfo_read.go b/src/time/zoneinfo_read.go index d8d4070d5b..d54632fb49 100644 --- a/src/time/zoneinfo_read.go +++ b/src/time/zoneinfo_read.go @@ -59,6 +59,16 @@ func (d *dataIO) big4() (n uint32, ok bool) { return uint32(p[3]) | uint32(p[2])<<8 | uint32(p[1])<<16 | uint32(p[0])<<24, true } +func (d *dataIO) big8() (n uint64, ok bool) { + n1, ok1 := d.big4() + n2, ok2 := d.big4() + if !ok1 || !ok2 { + d.error = true + return 0, false + } + return (uint64(n1) << 32) | uint64(n2), true +} + func (d *dataIO) byte() (n byte, ok bool) { p := d.read(1) if len(p) < 1 { @@ -93,9 +103,21 @@ func LoadLocationFromTZData(name string, data []byte) (*Location, error) { } // 1-byte version, then 15 bytes of padding + var version int var p []byte - if p = d.read(16); len(p) != 16 || p[0] != 0 && p[0] != '2' && p[0] != '3' { + if p = d.read(16); len(p) != 16 { return nil, badData + } else { + switch p[0] { + case 0: + version = 1 + case '2': + version = 2 + case '3': + version = 3 + default: + return nil, badData + } } // six big-endian 32-bit integers: @@ -119,11 +141,53 @@ func LoadLocationFromTZData(name string, data []byte) (*Location, error) { if !ok { return nil, badData } + if uint32(int(nn)) != nn { + return nil, badData + } n[i] = int(nn) } + // If we have version 2 or 3, then the data is first written out + // in a 32-bit format, then written out again in a 64-bit format. + // Skip the 32-bit format and read the 64-bit one, as it can + // describe a broader range of dates. + + is64 := false + if version > 1 { + // Skip the 32-bit data. + skip := n[NTime]*4 + + n[NTime] + + n[NZone]*6 + + n[NChar] + + n[NLeap]*8 + + n[NStdWall] + + n[NUTCLocal] + // Skip the version 2 header that we just read. + skip += 4 + 16 + d.read(skip) + + is64 = true + + // Read the counts again, they can differ. + for i := 0; i < 6; i++ { + nn, ok := d.big4() + if !ok { + return nil, badData + } + if uint32(int(nn)) != nn { + return nil, badData + } + n[i] = int(nn) + } + } + + size := 4 + if is64 { + size = 8 + } + // Transition times. - txtimes := dataIO{d.read(n[NTime] * 4), false} + txtimes := dataIO{d.read(n[NTime] * size), false} // Time zone indices for transition times. txzones := d.read(n[NTime]) @@ -135,7 +199,7 @@ func LoadLocationFromTZData(name string, data []byte) (*Location, error) { abbrev := d.read(n[NChar]) // Leap-second time pairs - d.read(n[NLeap] * 8) + d.read(n[NLeap] * (size + 4)) // Whether tx times associated with local time types // are specified as standard time or wall time. @@ -149,10 +213,6 @@ func LoadLocationFromTZData(name string, data []byte) (*Location, error) { return nil, badData } - // If version == 2 or 3, the entire file repeats, this time using - // 8-byte ints for txtimes and leap seconds. - // We won't need those until 2106. - // Now we can build up a useful data structure. // First the zone information. // utcoff[4] isdst[1] nameindex[1] @@ -163,6 +223,9 @@ func LoadLocationFromTZData(name string, data []byte) (*Location, error) { if n, ok = zonedata.big4(); !ok { return nil, badData } + if uint32(int(n)) != n { + return nil, badData + } zone[i].offset = int(int32(n)) var b byte if b, ok = zonedata.byte(); !ok { @@ -186,12 +249,21 @@ func LoadLocationFromTZData(name string, data []byte) (*Location, error) { // Now the transition time info. tx := make([]zoneTrans, n[NTime]) for i := range tx { - var ok bool - var n uint32 - if n, ok = txtimes.big4(); !ok { - return nil, badData + var n int64 + if !is64 { + if n4, ok := txtimes.big4(); !ok { + return nil, badData + } else { + n = int64(int32(n4)) + } + } else { + if n8, ok := txtimes.big8(); !ok { + return nil, badData + } else { + n = int64(n8) + } } - tx[i].when = int64(int32(n)) + tx[i].when = n if int(txzones[i]) >= len(zone) { return nil, badData } diff --git a/src/time/zoneinfo_test.go b/src/time/zoneinfo_test.go index 4458ba8e26..cd0731768e 100644 --- a/src/time/zoneinfo_test.go +++ b/src/time/zoneinfo_test.go @@ -152,3 +152,24 @@ func TestLoadLocationFromTZData(t *testing.T) { t.Errorf("return values of LoadLocationFromTZData and LoadLocation don't match") } } + +// Issue 30099. +func TestEarlyLocation(t *testing.T) { + time.ForceZipFileForTesting(true) + defer time.ForceZipFileForTesting(false) + + const locName = "America/New_York" + loc, err := time.LoadLocation(locName) + if err != nil { + t.Fatal(err) + } + + d := time.Date(1900, time.January, 1, 0, 0, 0, 0, loc) + tzName, tzOffset := d.Zone() + if want := "EST"; tzName != want { + t.Errorf("Zone name == %s, want %s", tzName, want) + } + if want := -18000; tzOffset != want { + t.Errorf("Zone offset == %d, want %d", tzOffset, want) + } +} diff --git a/test/codegen/alloc.go b/test/codegen/alloc.go new file mode 100644 index 0000000000..31455fdabf --- /dev/null +++ b/test/codegen/alloc.go @@ -0,0 +1,34 @@ +// asmcheck + +// 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. + +// These tests check that allocating a 0-size object does not +// introduce a call to runtime.newobject. + +package codegen + +func zeroAllocNew1() *struct{} { + // 386:-`CALL\truntime\.newobject` + // amd64:-`CALL\truntime\.newobject` + // arm:-`CALL\truntime\.newobject` + // arm64:-`CALL\truntime\.newobject` + return new(struct{}) +} + +func zeroAllocNew2() *[0]int { + // 386:-`CALL\truntime\.newobject` + // amd64:-`CALL\truntime\.newobject` + // arm:-`CALL\truntime\.newobject` + // arm64:-`CALL\truntime\.newobject` + return new([0]int) +} + +func zeroAllocSliceLit() []int { + // 386:-`CALL\truntime\.newobject` + // amd64:-`CALL\truntime\.newobject` + // arm:-`CALL\truntime\.newobject` + // arm64:-`CALL\truntime\.newobject` + return []int{} +} diff --git a/test/codegen/slices.go b/test/codegen/slices.go index 15dbcee737..6477c6f6c7 100644 --- a/test/codegen/slices.go +++ b/test/codegen/slices.go @@ -61,3 +61,13 @@ func SliceExtensionInt64(s []int, l64 int64) []int { // 386:-`.*runtime\.memclr` return append(s, make([]int, l64)...) } + +// ---------------------- // +// Nil check of &s[0] // +// ---------------------- // +// See issue 30366 +func SliceNilCheck(s []int) { + p := &s[0] + // amd64:-`TESTB` + _ = *p +} diff --git a/test/escape_because.go b/test/escape_because.go index 3b67ff9e4b..64fa28ddda 100644 --- a/test/escape_because.go +++ b/test/escape_because.go @@ -43,7 +43,7 @@ func f2(q *int) { // ERROR "from &u \(address-of\) at escape_because.go:43$" "fr sink = &u // ERROR "&u escapes to heap$" "from &u \(interface-converted\) at escape_because.go:43$" "from sink \(assigned to top level variable\) at escape_because.go:43$" } -func f3(r *int) interface{} { // ERROR "from \[\]\*int literal \(slice-literal-element\) at escape_because.go:47$" "from c \(assigned\) at escape_because.go:47$" "from c \(interface-converted\) at escape_because.go:48$" "from ~r1 \(return\) at escape_because.go:48$" "leaking param: r to result ~r1 level=-1$" +func f3(r *int) interface{} { // ERROR "from \[\]\*int literal \(slice-literal-element\) at escape_because.go:47$" "from c \(assigned\) at escape_because.go:47$" "from c \(interface-converted\) at escape_because.go:48$" "from ~r1 \(return\) at escape_because.go:48$" "leaking param: r" c := []*int{r} // ERROR "\[\]\*int literal escapes to heap$" "from c \(assigned\) at escape_because.go:47$" "from c \(interface-converted\) at escape_because.go:48$" "from ~r1 \(return\) at escape_because.go:48$" return c // "return" // ERROR "c escapes to heap$" "from ~r1 \(return\) at escape_because.go:48$" } diff --git a/test/escape_param.go b/test/escape_param.go index dff13b6f7c..175a4f03dd 100644 --- a/test/escape_param.go +++ b/test/escape_param.go @@ -424,3 +424,18 @@ func h(x *Node) { // ERROR "leaking param: x" Sink = g(y) f(y) } + +// interface(in) -> out +// See also issue 29353. + +// Convert to a non-direct interface, require an allocation and +// copy x to heap (not to result). +func param14a(x [4]*int) interface{} { // ERROR "leaking param: x$" + return x // ERROR "x escapes to heap" +} + +// Convert to a direct interface, does not need an allocation. +// So x only leaks to result. +func param14b(x *int) interface{} { // ERROR "leaking param: x to result ~r1 level=0" + return x // ERROR "x escapes to heap" +} diff --git a/test/fixedbugs/bug073.go b/test/fixedbugs/bug073.go index 49b47ae464..f3605b37cf 100644 --- a/test/fixedbugs/bug073.go +++ b/test/fixedbugs/bug073.go @@ -1,4 +1,4 @@ -// errorcheck +// compile // Copyright 2009 The Go Authors. All rights reserved. // Use of this source code is governed by a BSD-style @@ -7,8 +7,8 @@ package main func main() { - var s int = 0; - var x int = 0; - x = x << s; // ERROR "illegal|inval|shift" - x = x >> s; // ERROR "illegal|inval|shift" + var s int = 0 + var x int = 0 + x = x << s // as of 1.13, these are ok + x = x >> s // as of 1.13, these are ok } diff --git a/test/fixedbugs/gcc89321.go b/test/fixedbugs/gcc89321.go new file mode 100644 index 0000000000..93ca6b40a5 --- /dev/null +++ b/test/fixedbugs/gcc89321.go @@ -0,0 +1,17 @@ +// compile + +// 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. + +// https://gcc.gnu.org/PR89321 +// gccgo compiler crash building map literals with a zero-sized value type. + +package p + +type M map[byte]struct{} + +var ( + M1 = M{1: {}, 2: {}, 3: {}} + M2 = M{1: {}, 2: {}} +) diff --git a/test/fixedbugs/issue19113.go b/test/fixedbugs/issue19113.go new file mode 100644 index 0000000000..5e01dde699 --- /dev/null +++ b/test/fixedbugs/issue19113.go @@ -0,0 +1,108 @@ +// run + +// 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. + +package main + +import "reflect" + +var tests = []interface{}{ + func(x int, s int) int { + return x << s + }, + func(x int, s int64) int { + return x << s + }, + func(x int, s int32) int { + return x << s + }, + func(x int, s int16) int { + return x << s + }, + func(x int, s int8) int { + return x << s + }, + func(x int, s int) int { + return x >> s + }, + func(x int, s int64) int { + return x >> s + }, + func(x int, s int32) int { + return x >> s + }, + func(x int, s int16) int { + return x >> s + }, + func(x int, s int8) int { + return x >> s + }, + func(x uint, s int) uint { + return x << s + }, + func(x uint, s int64) uint { + return x << s + }, + func(x uint, s int32) uint { + return x << s + }, + func(x uint, s int16) uint { + return x << s + }, + func(x uint, s int8) uint { + return x << s + }, + func(x uint, s int) uint { + return x >> s + }, + func(x uint, s int64) uint { + return x >> s + }, + func(x uint, s int32) uint { + return x >> s + }, + func(x uint, s int16) uint { + return x >> s + }, + func(x uint, s int8) uint { + return x >> s + }, +} + +func main() { + for _, t := range tests { + runTest(reflect.ValueOf(t)) + } +} + +func runTest(f reflect.Value) { + xt := f.Type().In(0) + st := f.Type().In(1) + + for _, x := range []int{1, 0, -1} { + for _, s := range []int{-99, -64, -63, -32, -31, -16, -15, -8, -7, -1, 0, 1, 7, 8, 15, 16, 31, 32, 63, 64, 99} { + args := []reflect.Value{ + reflect.ValueOf(x).Convert(xt), + reflect.ValueOf(s).Convert(st), + } + if s < 0 { + shouldPanic(func() { + f.Call(args) + }) + } else { + f.Call(args) // should not panic + } + } + } +} + +func shouldPanic(f func()) { + defer func() { + if recover() == nil { + panic("did not panic") + } + }() + f() +} diff --git a/test/fixedbugs/issue28085.go b/test/fixedbugs/issue28085.go new file mode 100644 index 0000000000..01fffd52a6 --- /dev/null +++ b/test/fixedbugs/issue28085.go @@ -0,0 +1,29 @@ +// errorcheck + +// 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. + +package p + +var _ = map[interface{}]int{ + 0: 0, + 0: 0, // ERROR "duplicate" +} + +var _ = map[interface{}]int{ + interface{}(0): 0, + interface{}(0): 0, // ok +} + +func _() { + switch interface{}(0) { + case 0: + case 0: // ERROR "duplicate" + } + + switch interface{}(0) { + case interface{}(0): + case interface{}(0): // ok + } +} diff --git a/test/fixedbugs/issue29215.go b/test/fixedbugs/issue29215.go index df703aa25d..4e8f107aee 100644 --- a/test/fixedbugs/issue29215.go +++ b/test/fixedbugs/issue29215.go @@ -16,3 +16,20 @@ func f() { } _ = s == "bbb" } + +// Another case: load from negative offset of a symbol +// in dead code (issue 30257). +func g() { + var i int + var s string + + if true { + s = "a" + } + + if f := 0.0; -f < 0 { + i = len(s[:4]) + } + + _ = s[i-1:0] != "bb" && true +} diff --git a/test/fixedbugs/issue29855.go b/test/fixedbugs/issue29855.go new file mode 100644 index 0000000000..b57eae2b44 --- /dev/null +++ b/test/fixedbugs/issue29855.go @@ -0,0 +1,17 @@ +// errorcheck + +// 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. + +package main + +type T struct { + GlobalName string +} + +var t = T{Name: "foo"} // ERROR "unknown field 'Name' in struct literal of type T" + +func (t T) Name() string { + return t.GlobalName +} diff --git a/test/fixedbugs/issue30087.go b/test/fixedbugs/issue30087.go new file mode 100644 index 0000000000..dc12364d80 --- /dev/null +++ b/test/fixedbugs/issue30087.go @@ -0,0 +1,14 @@ +// errorcheck + +// 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. + +package main + +func main() { + var a, b = 1 // ERROR "assignment mismatch: 2 variables but 1 values" + _ = 1, 2 // ERROR "assignment mismatch: 1 variables but 2 values" + c, d := 1 // ERROR "assignment mismatch: 2 variables but 1 values" + e, f := 1, 2, 3 // ERROR "assignment mismatch: 2 variables but 3 values" +} diff --git a/test/fixedbugs/issue30243.go b/test/fixedbugs/issue30243.go new file mode 100644 index 0000000000..51fd204cbc --- /dev/null +++ b/test/fixedbugs/issue30243.go @@ -0,0 +1,27 @@ +// run + +// 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. + +// Compile-time constants, even if they cannot be represented +// accurately, should remain the same in operations that don't +// affect their values. + +package main + +import "fmt" + +func main() { + const x = 0.01 + const xi = 0.01i + const xc = complex(0, x) + + if imag(xi) != x { + fmt.Printf("FAILED: %g != %g\n", imag(xi), x) + } + + if xi != complex(0, x) { + fmt.Printf("FAILED: %g != %g\n", xi, complex(0, x)) + } +} diff --git a/test/fixedbugs/issue9036.go b/test/fixedbugs/issue9036.go index 75ffb2ddef..38f06c30c8 100644 --- a/test/fixedbugs/issue9036.go +++ b/test/fixedbugs/issue9036.go @@ -4,7 +4,8 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. -// Expects to see error messages on 'p' exponents. +// Expects to see error messages on 'p' exponents +// for non-hexadecimal floats. package main @@ -16,16 +17,9 @@ const ( x3 = 0x1e10 // integer (e is a hex digit) ) -// 'p' exponents are invalid - the 'p' is not considered -// part of a floating-point number, but introduces a new -// (unexpected) name. -// -// Error recovery is not ideal and we use a new declaration -// each time for the parser to recover. - -const x4 = 0x1p10 // ERROR "unexpected p10" -const x5 = 1p10 // ERROR "unexpected p10" -const x6 = 0p0 // ERROR "unexpected p0" +const x4 = 0x1p10 // valid hexadecimal float +const x5 = 1p10 // ERROR "'p' exponent requires hexadecimal mantissa" +const x6 = 0P0 // ERROR "'P' exponent requires hexadecimal mantissa" func main() { fmt.Printf("%g %T\n", x1, x1) diff --git a/test/literal2.go b/test/literal2.go new file mode 100644 index 0000000000..f552e33ada --- /dev/null +++ b/test/literal2.go @@ -0,0 +1,90 @@ +// run + +// 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. + +// Test Go2 literal syntax for basic types. +// Avoid running gofmt on this file to preserve the +// test cases with upper-case prefixes (0B, 0O, 0X). + +package main + +import "fmt" + +func assert(cond bool) { + if !cond { + panic("assertion failed") + } +} + +func equal(x, y interface{}) bool { + if x != y { + fmt.Printf("%g != %g\n", x, y) + return false + } + return true +} + +func main() { + // 0-octals + assert(0_1 == 01) + assert(012 == 012) + assert(0_1_2 == 012) + assert(0_1_2i == complex(0, 12)) // decimal digits despite leading 0 for backward-compatibility + assert(00089i == complex(0, 89)) // decimal digits despite leading 0 for backward-compatibility + + // decimals + assert(1_000_000 == 1000000) + assert(1_000i == complex(0, 1000)) + + // hexadecimals + assert(0x_1 == 0x1) + assert(0x1_2 == 0x12) + assert(0x_cafe_f00d == 0xcafef00d) + assert(0x_cafei == complex(0, 0xcafe)) + + // octals + assert(0o_1 == 01) + assert(0o12 == 012) + assert(0o_1_2 == 012) + assert(0o_1_2i == complex(0, 0o12)) + + // binaries + assert(0b_1 == 1) + assert(0b10 == 2) + assert(0b_1_0 == 2) + assert(0b_1_0i == complex(0, 2)) + + // decimal floats + assert(0. == 0.0) + assert(.0 == 0.0) + assert(1_0. == 10.0) + assert(.0_1 == 0.01) + assert(1_0.0_1 == 10.01) + assert(1_0.0_1i == complex(0, 10.01)) + + assert(0.e1_0 == 0.0e10) + assert(.0e1_0 == 0.0e10) + assert(1_0.e1_0 == 10.0e10) + assert(.0_1e1_0 == 0.01e10) + assert(1_0.0_1e1_0 == 10.01e10) + assert(1_0.0_1e1_0i == complex(0, 10.01e10)) + + // hexadecimal floats + assert(equal(0x1p-2, 0.25)) + assert(equal(0x2.p10, 2048.0)) + assert(equal(0x1.Fp+0, 1.9375)) + assert(equal(0x.8p-0, 0.5)) + assert(equal(0x1FFFp-16, 0.1249847412109375)) + assert(equal(0x1.fffffffffffffp1023, 1.7976931348623157e308)) + assert(equal(0x1.fffffffffffffp1023i, complex(0, 1.7976931348623157e308))) + + assert(equal(0x_1p-2, 0.25)) + assert(equal(0x2.p1_0, 2048.0)) + assert(equal(0x1_0.Fp+0, 16.9375)) + assert(equal(0x_0.8p-0, 0.5)) + assert(equal(0x_1FF_Fp-16, 0.1249847412109375)) + assert(equal(0x1.f_ffff_ffff_ffffp1_023, 1.7976931348623157e308)) + assert(equal(0x1.f_ffff_ffff_ffffp1_023i, complex(0, 1.7976931348623157e308))) +} diff --git a/test/nosplit.go b/test/nosplit.go index 734f456cc9..46810b1a2f 100644 --- a/test/nosplit.go +++ b/test/nosplit.go @@ -218,6 +218,10 @@ func main() { } defer os.RemoveAll(dir) + if err := ioutil.WriteFile(filepath.Join(dir, "go.mod"), []byte("module go-test-nosplit\n"), 0666); err != nil { + log.Panic(err) + } + tests = strings.Replace(tests, "\t", " ", -1) tests = commentRE.ReplaceAllString(tests, "")