diff options
Diffstat (limited to 'vendor/golang.org/x')
120 files changed, 16617 insertions, 3248 deletions
diff --git a/vendor/golang.org/x/mod/LICENSE b/vendor/golang.org/x/mod/LICENSE new file mode 100644 index 000000000..6a66aea5e --- /dev/null +++ b/vendor/golang.org/x/mod/LICENSE @@ -0,0 +1,27 @@ +Copyright (c) 2009 The Go Authors. All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are +met: + +   * Redistributions of source code must retain the above copyright +notice, this list of conditions and the following disclaimer. +   * Redistributions in binary form must reproduce the above +copyright notice, this list of conditions and the following disclaimer +in the documentation and/or other materials provided with the +distribution. +   * Neither the name of Google Inc. nor the names of its +contributors may be used to endorse or promote products derived from +this software without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. diff --git a/vendor/golang.org/x/mod/PATENTS b/vendor/golang.org/x/mod/PATENTS new file mode 100644 index 000000000..733099041 --- /dev/null +++ b/vendor/golang.org/x/mod/PATENTS @@ -0,0 +1,22 @@ +Additional IP Rights Grant (Patents) + +"This implementation" means the copyrightable works distributed by +Google as part of the Go project. + +Google hereby grants to You a perpetual, worldwide, non-exclusive, +no-charge, royalty-free, irrevocable (except as stated in this section) +patent license to make, have made, use, offer to sell, sell, import, +transfer and otherwise run, modify and propagate the contents of this +implementation of Go, where such license applies only to those patent +claims, both currently owned or controlled by Google and acquired in +the future, licensable by Google that are necessarily infringed by this +implementation of Go.  This grant does not include claims that would be +infringed only as a consequence of further modification of this +implementation.  If you or your agent or exclusive licensee institute or +order or agree to the institution of patent litigation against any +entity (including a cross-claim or counterclaim in a lawsuit) alleging +that this implementation of Go or any code incorporated within this +implementation of Go constitutes direct or contributory patent +infringement, or inducement of patent infringement, then any patent +rights granted to you under this License for this implementation of Go +shall terminate as of the date such litigation is filed. diff --git a/vendor/golang.org/x/mod/semver/semver.go b/vendor/golang.org/x/mod/semver/semver.go new file mode 100644 index 000000000..7be398f80 --- /dev/null +++ b/vendor/golang.org/x/mod/semver/semver.go @@ -0,0 +1,411 @@ +// 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 semver implements comparison of semantic version strings. +// In this package, semantic version strings must begin with a leading "v", +// as in "v1.0.0". +// +// The general form of a semantic version string accepted by this package is +// +//	vMAJOR[.MINOR[.PATCH[-PRERELEASE][+BUILD]]] +// +// where square brackets indicate optional parts of the syntax; +// MAJOR, MINOR, and PATCH are decimal integers without extra leading zeros; +// PRERELEASE and BUILD are each a series of non-empty dot-separated identifiers +// using only alphanumeric characters and hyphens; and +// all-numeric PRERELEASE identifiers must not have leading zeros. +// +// This package follows Semantic Versioning 2.0.0 (see semver.org) +// with two exceptions. First, it requires the "v" prefix. Second, it recognizes +// vMAJOR and vMAJOR.MINOR (with no prerelease or build suffixes) +// as shorthands for vMAJOR.0.0 and vMAJOR.MINOR.0. +package semver + +import "sort" + +// parsed returns the parsed form of a semantic version string. +type parsed struct { +	major      string +	minor      string +	patch      string +	short      string +	prerelease string +	build      string +	err        string +} + +// IsValid reports whether v is a valid semantic version string. +func IsValid(v string) bool { +	_, ok := parse(v) +	return ok +} + +// Canonical returns the canonical formatting of the semantic version v. +// It fills in any missing .MINOR or .PATCH and discards build metadata. +// Two semantic versions compare equal only if their canonical formattings +// are identical strings. +// The canonical invalid semantic version is the empty string. +func Canonical(v string) string { +	p, ok := parse(v) +	if !ok { +		return "" +	} +	if p.build != "" { +		return v[:len(v)-len(p.build)] +	} +	if p.short != "" { +		return v + p.short +	} +	return v +} + +// Major returns the major version prefix of the semantic version v. +// For example, Major("v2.1.0") == "v2". +// If v is an invalid semantic version string, Major returns the empty string. +func Major(v string) string { +	pv, ok := parse(v) +	if !ok { +		return "" +	} +	return v[:1+len(pv.major)] +} + +// MajorMinor returns the major.minor version prefix of the semantic version v. +// For example, MajorMinor("v2.1.0") == "v2.1". +// If v is an invalid semantic version string, MajorMinor returns the empty string. +func MajorMinor(v string) string { +	pv, ok := parse(v) +	if !ok { +		return "" +	} +	i := 1 + len(pv.major) +	if j := i + 1 + len(pv.minor); j <= len(v) && v[i] == '.' && v[i+1:j] == pv.minor { +		return v[:j] +	} +	return v[:i] + "." + pv.minor +} + +// Prerelease returns the prerelease suffix of the semantic version v. +// For example, Prerelease("v2.1.0-pre+meta") == "-pre". +// If v is an invalid semantic version string, Prerelease returns the empty string. +func Prerelease(v string) string { +	pv, ok := parse(v) +	if !ok { +		return "" +	} +	return pv.prerelease +} + +// Build returns the build suffix of the semantic version v. +// For example, Build("v2.1.0+meta") == "+meta". +// If v is an invalid semantic version string, Build returns the empty string. +func Build(v string) string { +	pv, ok := parse(v) +	if !ok { +		return "" +	} +	return pv.build +} + +// Compare returns an integer comparing two versions according to +// semantic version precedence. +// The result will be 0 if v == w, -1 if v < w, or +1 if v > w. +// +// An invalid semantic version string is considered less than a valid one. +// All invalid semantic version strings compare equal to each other. +func Compare(v, w string) int { +	pv, ok1 := parse(v) +	pw, ok2 := parse(w) +	if !ok1 && !ok2 { +		return 0 +	} +	if !ok1 { +		return -1 +	} +	if !ok2 { +		return +1 +	} +	if c := compareInt(pv.major, pw.major); c != 0 { +		return c +	} +	if c := compareInt(pv.minor, pw.minor); c != 0 { +		return c +	} +	if c := compareInt(pv.patch, pw.patch); c != 0 { +		return c +	} +	return comparePrerelease(pv.prerelease, pw.prerelease) +} + +// Max canonicalizes its arguments and then returns the version string +// that compares greater. +// +// Deprecated: use Compare instead. In most cases, returning a canonicalized +// version is not expected or desired. +func Max(v, w string) string { +	v = Canonical(v) +	w = Canonical(w) +	if Compare(v, w) > 0 { +		return v +	} +	return w +} + +// ByVersion implements sort.Interface for sorting semantic version strings. +type ByVersion []string + +func (vs ByVersion) Len() int      { return len(vs) } +func (vs ByVersion) Swap(i, j int) { vs[i], vs[j] = vs[j], vs[i] } +func (vs ByVersion) Less(i, j int) bool { +	cmp := Compare(vs[i], vs[j]) +	if cmp != 0 { +		return cmp < 0 +	} +	return vs[i] < vs[j] +} + +// Sort sorts a list of semantic version strings using ByVersion. +func Sort(list []string) { +	sort.Sort(ByVersion(list)) +} + +func parse(v string) (p parsed, ok bool) { +	if v == "" || v[0] != 'v' { +		p.err = "missing v prefix" +		return +	} +	p.major, v, ok = parseInt(v[1:]) +	if !ok { +		p.err = "bad major version" +		return +	} +	if v == "" { +		p.minor = "0" +		p.patch = "0" +		p.short = ".0.0" +		return +	} +	if v[0] != '.' { +		p.err = "bad minor prefix" +		ok = false +		return +	} +	p.minor, v, ok = parseInt(v[1:]) +	if !ok { +		p.err = "bad minor version" +		return +	} +	if v == "" { +		p.patch = "0" +		p.short = ".0" +		return +	} +	if v[0] != '.' { +		p.err = "bad patch prefix" +		ok = false +		return +	} +	p.patch, v, ok = parseInt(v[1:]) +	if !ok { +		p.err = "bad patch version" +		return +	} +	if len(v) > 0 && v[0] == '-' { +		p.prerelease, v, ok = parsePrerelease(v) +		if !ok { +			p.err = "bad prerelease" +			return +		} +	} +	if len(v) > 0 && v[0] == '+' { +		p.build, v, ok = parseBuild(v) +		if !ok { +			p.err = "bad build" +			return +		} +	} +	if v != "" { +		p.err = "junk on end" +		ok = false +		return +	} +	ok = true +	return +} + +func parseInt(v string) (t, rest string, ok bool) { +	if v == "" { +		return +	} +	if v[0] < '0' || '9' < v[0] { +		return +	} +	i := 1 +	for i < len(v) && '0' <= v[i] && v[i] <= '9' { +		i++ +	} +	if v[0] == '0' && i != 1 { +		return +	} +	return v[:i], v[i:], true +} + +func parsePrerelease(v string) (t, rest string, ok bool) { +	// "A pre-release version MAY be denoted by appending a hyphen and +	// a series of dot separated identifiers immediately following the patch version. +	// Identifiers MUST comprise only ASCII alphanumerics and hyphen [0-9A-Za-z-]. +	// Identifiers MUST NOT be empty. Numeric identifiers MUST NOT include leading zeroes." +	if v == "" || v[0] != '-' { +		return +	} +	i := 1 +	start := 1 +	for i < len(v) && v[i] != '+' { +		if !isIdentChar(v[i]) && v[i] != '.' { +			return +		} +		if v[i] == '.' { +			if start == i || isBadNum(v[start:i]) { +				return +			} +			start = i + 1 +		} +		i++ +	} +	if start == i || isBadNum(v[start:i]) { +		return +	} +	return v[:i], v[i:], true +} + +func parseBuild(v string) (t, rest string, ok bool) { +	if v == "" || v[0] != '+' { +		return +	} +	i := 1 +	start := 1 +	for i < len(v) { +		if !isIdentChar(v[i]) && v[i] != '.' { +			return +		} +		if v[i] == '.' { +			if start == i { +				return +			} +			start = i + 1 +		} +		i++ +	} +	if start == i { +		return +	} +	return v[:i], v[i:], true +} + +func isIdentChar(c byte) bool { +	return 'A' <= c && c <= 'Z' || 'a' <= c && c <= 'z' || '0' <= c && c <= '9' || c == '-' +} + +func isBadNum(v string) bool { +	i := 0 +	for i < len(v) && '0' <= v[i] && v[i] <= '9' { +		i++ +	} +	return i == len(v) && i > 1 && v[0] == '0' +} + +func isNum(v string) bool { +	i := 0 +	for i < len(v) && '0' <= v[i] && v[i] <= '9' { +		i++ +	} +	return i == len(v) +} + +func compareInt(x, y string) int { +	if x == y { +		return 0 +	} +	if len(x) < len(y) { +		return -1 +	} +	if len(x) > len(y) { +		return +1 +	} +	if x < y { +		return -1 +	} else { +		return +1 +	} +} + +func comparePrerelease(x, y string) int { +	// "When major, minor, and patch are equal, a pre-release version has +	// lower precedence than a normal version. +	// Example: 1.0.0-alpha < 1.0.0. +	// Precedence for two pre-release versions with the same major, minor, +	// and patch version MUST be determined by comparing each dot separated +	// identifier from left to right until a difference is found as follows: +	// identifiers consisting of only digits are compared numerically and +	// identifiers with letters or hyphens are compared lexically in ASCII +	// sort order. Numeric identifiers always have lower precedence than +	// non-numeric identifiers. A larger set of pre-release fields has a +	// higher precedence than a smaller set, if all of the preceding +	// identifiers are equal. +	// Example: 1.0.0-alpha < 1.0.0-alpha.1 < 1.0.0-alpha.beta < +	// 1.0.0-beta < 1.0.0-beta.2 < 1.0.0-beta.11 < 1.0.0-rc.1 < 1.0.0." +	if x == y { +		return 0 +	} +	if x == "" { +		return +1 +	} +	if y == "" { +		return -1 +	} +	for x != "" && y != "" { +		x = x[1:] // skip - or . +		y = y[1:] // skip - or . +		var dx, dy string +		dx, x = nextIdent(x) +		dy, y = nextIdent(y) +		if dx != dy { +			ix := isNum(dx) +			iy := isNum(dy) +			if ix != iy { +				if ix { +					return -1 +				} else { +					return +1 +				} +			} +			if ix { +				if len(dx) < len(dy) { +					return -1 +				} +				if len(dx) > len(dy) { +					return +1 +				} +			} +			if dx < dy { +				return -1 +			} else { +				return +1 +			} +		} +	} +	if x == "" { +		return -1 +	} else { +		return +1 +	} +} + +func nextIdent(x string) (dx, rest string) { +	i := 0 +	for i < len(x) && x[i] != '.' { +		i++ +	} +	return x[:i], x[i:] +} diff --git a/vendor/golang.org/x/sys/cpu/cpu.go b/vendor/golang.org/x/sys/cpu/cpu.go index abbec2d44..b56886f26 100644 --- a/vendor/golang.org/x/sys/cpu/cpu.go +++ b/vendor/golang.org/x/sys/cpu/cpu.go @@ -56,6 +56,7 @@ var X86 struct {  	HasAVX512BF16       bool // Advanced vector extension 512 BFloat16 Instructions  	HasBMI1             bool // Bit manipulation instruction set 1  	HasBMI2             bool // Bit manipulation instruction set 2 +	HasCX16             bool // Compare and exchange 16 Bytes  	HasERMS             bool // Enhanced REP for MOVSB and STOSB  	HasFMA              bool // Fused-multiply-add instructions  	HasOSXSAVE          bool // OS supports XSAVE/XRESTOR for saving/restoring XMM registers. diff --git a/vendor/golang.org/x/sys/cpu/cpu_x86.go b/vendor/golang.org/x/sys/cpu/cpu_x86.go index 54ca4667f..5ea287b7e 100644 --- a/vendor/golang.org/x/sys/cpu/cpu_x86.go +++ b/vendor/golang.org/x/sys/cpu/cpu_x86.go @@ -39,6 +39,7 @@ func initOptions() {  		{Name: "avx512bf16", Feature: &X86.HasAVX512BF16},  		{Name: "bmi1", Feature: &X86.HasBMI1},  		{Name: "bmi2", Feature: &X86.HasBMI2}, +		{Name: "cx16", Feature: &X86.HasCX16},  		{Name: "erms", Feature: &X86.HasERMS},  		{Name: "fma", Feature: &X86.HasFMA},  		{Name: "osxsave", Feature: &X86.HasOSXSAVE}, @@ -73,6 +74,7 @@ func archInit() {  	X86.HasPCLMULQDQ = isSet(1, ecx1)  	X86.HasSSSE3 = isSet(9, ecx1)  	X86.HasFMA = isSet(12, ecx1) +	X86.HasCX16 = isSet(13, ecx1)  	X86.HasSSE41 = isSet(19, ecx1)  	X86.HasSSE42 = isSet(20, ecx1)  	X86.HasPOPCNT = isSet(23, ecx1) diff --git a/vendor/golang.org/x/sys/execabs/execabs.go b/vendor/golang.org/x/sys/execabs/execabs.go new file mode 100644 index 000000000..78192498d --- /dev/null +++ b/vendor/golang.org/x/sys/execabs/execabs.go @@ -0,0 +1,102 @@ +// Copyright 2020 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +// Package execabs is a drop-in replacement for os/exec +// that requires PATH lookups to find absolute paths. +// That is, execabs.Command("cmd") runs the same PATH lookup +// as exec.Command("cmd"), but if the result is a path +// which is relative, the Run and Start methods will report +// an error instead of running the executable. +// +// See https://blog.golang.org/path-security for more information +// about when it may be necessary or appropriate to use this package. +package execabs + +import ( +	"context" +	"fmt" +	"os/exec" +	"path/filepath" +	"reflect" +	"unsafe" +) + +// ErrNotFound is the error resulting if a path search failed to find an executable file. +// It is an alias for exec.ErrNotFound. +var ErrNotFound = exec.ErrNotFound + +// Cmd represents an external command being prepared or run. +// It is an alias for exec.Cmd. +type Cmd = exec.Cmd + +// Error is returned by LookPath when it fails to classify a file as an executable. +// It is an alias for exec.Error. +type Error = exec.Error + +// An ExitError reports an unsuccessful exit by a command. +// It is an alias for exec.ExitError. +type ExitError = exec.ExitError + +func relError(file, path string) error { +	return fmt.Errorf("%s resolves to executable in current directory (.%c%s)", file, filepath.Separator, path) +} + +// LookPath searches for an executable named file in the directories +// named by the PATH environment variable. If file contains a slash, +// it is tried directly and the PATH is not consulted. The result will be +// an absolute path. +// +// LookPath differs from exec.LookPath in its handling of PATH lookups, +// which are used for file names without slashes. If exec.LookPath's +// PATH lookup would have returned an executable from the current directory, +// LookPath instead returns an error. +func LookPath(file string) (string, error) { +	path, err := exec.LookPath(file) +	if err != nil { +		return "", err +	} +	if filepath.Base(file) == file && !filepath.IsAbs(path) { +		return "", relError(file, path) +	} +	return path, nil +} + +func fixCmd(name string, cmd *exec.Cmd) { +	if filepath.Base(name) == name && !filepath.IsAbs(cmd.Path) { +		// exec.Command was called with a bare binary name and +		// exec.LookPath returned a path which is not absolute. +		// Set cmd.lookPathErr and clear cmd.Path so that it +		// cannot be run. +		lookPathErr := (*error)(unsafe.Pointer(reflect.ValueOf(cmd).Elem().FieldByName("lookPathErr").Addr().Pointer())) +		if *lookPathErr == nil { +			*lookPathErr = relError(name, cmd.Path) +		} +		cmd.Path = "" +	} +} + +// CommandContext is like Command but includes a context. +// +// The provided context is used to kill the process (by calling os.Process.Kill) +// if the context becomes done before the command completes on its own. +func CommandContext(ctx context.Context, name string, arg ...string) *exec.Cmd { +	cmd := exec.CommandContext(ctx, name, arg...) +	fixCmd(name, cmd) +	return cmd + +} + +// Command returns the Cmd struct to execute the named program with the given arguments. +// See exec.Command for most details. +// +// Command differs from exec.Command in its handling of PATH lookups, +// which are used when the program name contains no slashes. +// If exec.Command would have returned an exec.Cmd configured to run an +// executable from the current directory, Command instead +// returns an exec.Cmd that will return an error from Start or Run. +func Command(name string, arg ...string) *exec.Cmd { +	cmd := exec.Command(name, arg...) +	fixCmd(name, cmd) +	return cmd +} diff --git a/vendor/golang.org/x/sys/unix/ifreq_linux.go b/vendor/golang.org/x/sys/unix/ifreq_linux.go new file mode 100644 index 000000000..934af313c --- /dev/null +++ b/vendor/golang.org/x/sys/unix/ifreq_linux.go @@ -0,0 +1,149 @@ +// Copyright 2021 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +//go:build linux +// +build linux + +package unix + +import ( +	"bytes" +	"unsafe" +) + +// Helpers for dealing with ifreq since it contains a union and thus requires a +// lot of unsafe.Pointer casts to use properly. + +// An Ifreq is a type-safe wrapper around the raw ifreq struct. An Ifreq +// contains an interface name and a union of arbitrary data which can be +// accessed using the Ifreq's methods. To create an Ifreq, use the NewIfreq +// function. +// +// Use the Name method to access the stored interface name. The union data +// fields can be get and set using the following methods: +//   - Uint16/SetUint16: flags +//   - Uint32/SetUint32: ifindex, metric, mtu +type Ifreq struct{ raw ifreq } + +// NewIfreq creates an Ifreq with the input network interface name after +// validating the name does not exceed IFNAMSIZ-1 (trailing NULL required) +// bytes. +func NewIfreq(name string) (*Ifreq, error) { +	// Leave room for terminating NULL byte. +	if len(name) >= IFNAMSIZ { +		return nil, EINVAL +	} + +	var ifr ifreq +	copy(ifr.Ifrn[:], name) + +	return &Ifreq{raw: ifr}, nil +} + +// TODO(mdlayher): get/set methods for hardware address sockaddr, char array, etc. + +// Name returns the interface name associated with the Ifreq. +func (ifr *Ifreq) Name() string { +	// BytePtrToString requires a NULL terminator or the program may crash. If +	// one is not present, just return the empty string. +	if !bytes.Contains(ifr.raw.Ifrn[:], []byte{0x00}) { +		return "" +	} + +	return BytePtrToString(&ifr.raw.Ifrn[0]) +} + +// According to netdevice(7), only AF_INET addresses are returned for numerous +// sockaddr ioctls. For convenience, we expose these as Inet4Addr since the Port +// field and other data is always empty. + +// Inet4Addr returns the Ifreq union data from an embedded sockaddr as a C +// in_addr/Go []byte (4-byte IPv4 address) value. If the sockaddr family is not +// AF_INET, an error is returned. +func (ifr *Ifreq) Inet4Addr() ([]byte, error) { +	raw := *(*RawSockaddrInet4)(unsafe.Pointer(&ifr.raw.Ifru[:SizeofSockaddrInet4][0])) +	if raw.Family != AF_INET { +		// Cannot safely interpret raw.Addr bytes as an IPv4 address. +		return nil, EINVAL +	} + +	return raw.Addr[:], nil +} + +// SetInet4Addr sets a C in_addr/Go []byte (4-byte IPv4 address) value in an +// embedded sockaddr within the Ifreq's union data. v must be 4 bytes in length +// or an error will be returned. +func (ifr *Ifreq) SetInet4Addr(v []byte) error { +	if len(v) != 4 { +		return EINVAL +	} + +	var addr [4]byte +	copy(addr[:], v) + +	ifr.clear() +	*(*RawSockaddrInet4)( +		unsafe.Pointer(&ifr.raw.Ifru[:SizeofSockaddrInet4][0]), +	) = RawSockaddrInet4{ +		// Always set IP family as ioctls would require it anyway. +		Family: AF_INET, +		Addr:   addr, +	} + +	return nil +} + +// Uint16 returns the Ifreq union data as a C short/Go uint16 value. +func (ifr *Ifreq) Uint16() uint16 { +	return *(*uint16)(unsafe.Pointer(&ifr.raw.Ifru[:2][0])) +} + +// SetUint16 sets a C short/Go uint16 value as the Ifreq's union data. +func (ifr *Ifreq) SetUint16(v uint16) { +	ifr.clear() +	*(*uint16)(unsafe.Pointer(&ifr.raw.Ifru[:2][0])) = v +} + +// Uint32 returns the Ifreq union data as a C int/Go uint32 value. +func (ifr *Ifreq) Uint32() uint32 { +	return *(*uint32)(unsafe.Pointer(&ifr.raw.Ifru[:4][0])) +} + +// SetUint32 sets a C int/Go uint32 value as the Ifreq's union data. +func (ifr *Ifreq) SetUint32(v uint32) { +	ifr.clear() +	*(*uint32)(unsafe.Pointer(&ifr.raw.Ifru[:4][0])) = v +} + +// clear zeroes the ifreq's union field to prevent trailing garbage data from +// being sent to the kernel if an ifreq is reused. +func (ifr *Ifreq) clear() { +	for i := range ifr.raw.Ifru { +		ifr.raw.Ifru[i] = 0 +	} +} + +// TODO(mdlayher): export as IfreqData? For now we can provide helpers such as +// IoctlGetEthtoolDrvinfo which use these APIs under the hood. + +// An ifreqData is an Ifreq which carries pointer data. To produce an ifreqData, +// use the Ifreq.withData method. +type ifreqData struct { +	name [IFNAMSIZ]byte +	// A type separate from ifreq is required in order to comply with the +	// unsafe.Pointer rules since the "pointer-ness" of data would not be +	// preserved if it were cast into the byte array of a raw ifreq. +	data unsafe.Pointer +	// Pad to the same size as ifreq. +	_ [len(ifreq{}.Ifru) - SizeofPtr]byte +} + +// withData produces an ifreqData with the pointer p set for ioctls which require +// arbitrary pointer data. +func (ifr Ifreq) withData(p unsafe.Pointer) ifreqData { +	return ifreqData{ +		name: ifr.raw.Ifrn, +		data: p, +	} +} diff --git a/vendor/golang.org/x/sys/unix/ioctl_linux.go b/vendor/golang.org/x/sys/unix/ioctl_linux.go index 48773f730..1dadead21 100644 --- a/vendor/golang.org/x/sys/unix/ioctl_linux.go +++ b/vendor/golang.org/x/sys/unix/ioctl_linux.go @@ -5,7 +5,6 @@  package unix  import ( -	"runtime"  	"unsafe"  ) @@ -22,56 +21,42 @@ func IoctlRetInt(fd int, req uint) (int, error) {  func IoctlGetUint32(fd int, req uint) (uint32, error) {  	var value uint32 -	err := ioctl(fd, req, uintptr(unsafe.Pointer(&value))) +	err := ioctlPtr(fd, req, unsafe.Pointer(&value))  	return value, err  }  func IoctlGetRTCTime(fd int) (*RTCTime, error) {  	var value RTCTime -	err := ioctl(fd, RTC_RD_TIME, uintptr(unsafe.Pointer(&value))) +	err := ioctlPtr(fd, RTC_RD_TIME, unsafe.Pointer(&value))  	return &value, err  }  func IoctlSetRTCTime(fd int, value *RTCTime) error { -	err := ioctl(fd, RTC_SET_TIME, uintptr(unsafe.Pointer(value))) -	runtime.KeepAlive(value) -	return err +	return ioctlPtr(fd, RTC_SET_TIME, unsafe.Pointer(value))  }  func IoctlGetRTCWkAlrm(fd int) (*RTCWkAlrm, error) {  	var value RTCWkAlrm -	err := ioctl(fd, RTC_WKALM_RD, uintptr(unsafe.Pointer(&value))) +	err := ioctlPtr(fd, RTC_WKALM_RD, unsafe.Pointer(&value))  	return &value, err  }  func IoctlSetRTCWkAlrm(fd int, value *RTCWkAlrm) error { -	err := ioctl(fd, RTC_WKALM_SET, uintptr(unsafe.Pointer(value))) -	runtime.KeepAlive(value) -	return err -} - -type ifreqEthtool struct { -	name [IFNAMSIZ]byte -	data unsafe.Pointer +	return ioctlPtr(fd, RTC_WKALM_SET, unsafe.Pointer(value))  }  // IoctlGetEthtoolDrvinfo fetches ethtool driver information for the network  // device specified by ifname.  func IoctlGetEthtoolDrvinfo(fd int, ifname string) (*EthtoolDrvinfo, error) { -	// Leave room for terminating NULL byte. -	if len(ifname) >= IFNAMSIZ { -		return nil, EINVAL +	ifr, err := NewIfreq(ifname) +	if err != nil { +		return nil, err  	} -	value := EthtoolDrvinfo{ -		Cmd: ETHTOOL_GDRVINFO, -	} -	ifreq := ifreqEthtool{ -		data: unsafe.Pointer(&value), -	} -	copy(ifreq.name[:], ifname) -	err := ioctl(fd, SIOCETHTOOL, uintptr(unsafe.Pointer(&ifreq))) -	runtime.KeepAlive(ifreq) +	value := EthtoolDrvinfo{Cmd: ETHTOOL_GDRVINFO} +	ifrd := ifr.withData(unsafe.Pointer(&value)) + +	err = ioctlIfreqData(fd, SIOCETHTOOL, &ifrd)  	return &value, err  } @@ -80,7 +65,7 @@ func IoctlGetEthtoolDrvinfo(fd int, ifname string) (*EthtoolDrvinfo, error) {  // https://www.kernel.org/doc/html/latest/watchdog/watchdog-api.html.  func IoctlGetWatchdogInfo(fd int) (*WatchdogInfo, error) {  	var value WatchdogInfo -	err := ioctl(fd, WDIOC_GETSUPPORT, uintptr(unsafe.Pointer(&value))) +	err := ioctlPtr(fd, WDIOC_GETSUPPORT, unsafe.Pointer(&value))  	return &value, err  } @@ -88,6 +73,7 @@ func IoctlGetWatchdogInfo(fd int) (*WatchdogInfo, error) {  // more information, see:  // https://www.kernel.org/doc/html/latest/watchdog/watchdog-api.html.  func IoctlWatchdogKeepalive(fd int) error { +	// arg is ignored and not a pointer, so ioctl is fine instead of ioctlPtr.  	return ioctl(fd, WDIOC_KEEPALIVE, 0)  } @@ -95,9 +81,7 @@ func IoctlWatchdogKeepalive(fd int) error {  // range of data conveyed in value to the file associated with the file  // descriptor destFd. See the ioctl_ficlonerange(2) man page for details.  func IoctlFileCloneRange(destFd int, value *FileCloneRange) error { -	err := ioctl(destFd, FICLONERANGE, uintptr(unsafe.Pointer(value))) -	runtime.KeepAlive(value) -	return err +	return ioctlPtr(destFd, FICLONERANGE, unsafe.Pointer(value))  }  // IoctlFileClone performs an FICLONE ioctl operation to clone the entire file @@ -148,7 +132,7 @@ func IoctlFileDedupeRange(srcFd int, value *FileDedupeRange) error {  		rawinfo.Reserved = value.Info[i].Reserved  	} -	err := ioctl(srcFd, FIDEDUPERANGE, uintptr(unsafe.Pointer(&buf[0]))) +	err := ioctlPtr(srcFd, FIDEDUPERANGE, unsafe.Pointer(&buf[0]))  	// Output  	for i := range value.Info { @@ -166,31 +150,47 @@ func IoctlFileDedupeRange(srcFd int, value *FileDedupeRange) error {  }  func IoctlHIDGetDesc(fd int, value *HIDRawReportDescriptor) error { -	err := ioctl(fd, HIDIOCGRDESC, uintptr(unsafe.Pointer(value))) -	runtime.KeepAlive(value) -	return err +	return ioctlPtr(fd, HIDIOCGRDESC, unsafe.Pointer(value))  }  func IoctlHIDGetRawInfo(fd int) (*HIDRawDevInfo, error) {  	var value HIDRawDevInfo -	err := ioctl(fd, HIDIOCGRAWINFO, uintptr(unsafe.Pointer(&value))) +	err := ioctlPtr(fd, HIDIOCGRAWINFO, unsafe.Pointer(&value))  	return &value, err  }  func IoctlHIDGetRawName(fd int) (string, error) {  	var value [_HIDIOCGRAWNAME_LEN]byte -	err := ioctl(fd, _HIDIOCGRAWNAME, uintptr(unsafe.Pointer(&value[0]))) +	err := ioctlPtr(fd, _HIDIOCGRAWNAME, unsafe.Pointer(&value[0]))  	return ByteSliceToString(value[:]), err  }  func IoctlHIDGetRawPhys(fd int) (string, error) {  	var value [_HIDIOCGRAWPHYS_LEN]byte -	err := ioctl(fd, _HIDIOCGRAWPHYS, uintptr(unsafe.Pointer(&value[0]))) +	err := ioctlPtr(fd, _HIDIOCGRAWPHYS, unsafe.Pointer(&value[0]))  	return ByteSliceToString(value[:]), err  }  func IoctlHIDGetRawUniq(fd int) (string, error) {  	var value [_HIDIOCGRAWUNIQ_LEN]byte -	err := ioctl(fd, _HIDIOCGRAWUNIQ, uintptr(unsafe.Pointer(&value[0]))) +	err := ioctlPtr(fd, _HIDIOCGRAWUNIQ, unsafe.Pointer(&value[0]))  	return ByteSliceToString(value[:]), err  } + +// IoctlIfreq performs an ioctl using an Ifreq structure for input and/or +// output. See the netdevice(7) man page for details. +func IoctlIfreq(fd int, req uint, value *Ifreq) error { +	// It is possible we will add more fields to *Ifreq itself later to prevent +	// misuse, so pass the raw *ifreq directly. +	return ioctlPtr(fd, req, unsafe.Pointer(&value.raw)) +} + +// TODO(mdlayher): export if and when IfreqData is exported. + +// ioctlIfreqData performs an ioctl using an ifreqData structure for input +// and/or output. See the netdevice(7) man page for details. +func ioctlIfreqData(fd int, req uint, value *ifreqData) error { +	// The memory layout of IfreqData (type-safe) and ifreq (not type-safe) are +	// identical so pass *IfreqData directly. +	return ioctlPtr(fd, req, unsafe.Pointer(value)) +} diff --git a/vendor/golang.org/x/sys/unix/mkerrors.sh b/vendor/golang.org/x/sys/unix/mkerrors.sh index 6e6afcaa1..0bcb8c322 100644 --- a/vendor/golang.org/x/sys/unix/mkerrors.sh +++ b/vendor/golang.org/x/sys/unix/mkerrors.sh @@ -217,8 +217,6 @@ struct ltchars {  #include <linux/genetlink.h>  #include <linux/hdreg.h>  #include <linux/hidraw.h> -#include <linux/icmp.h> -#include <linux/icmpv6.h>  #include <linux/if.h>  #include <linux/if_addr.h>  #include <linux/if_alg.h> @@ -502,7 +500,7 @@ ccflags="$@"  		$2 ~ /^LOCK_(SH|EX|NB|UN)$/ ||  		$2 ~ /^LO_(KEY|NAME)_SIZE$/ ||  		$2 ~ /^LOOP_(CLR|CTL|GET|SET)_/ || -		$2 ~ /^(AF|SOCK|SO|SOL|IPPROTO|IP|IPV6|TCP|MCAST|EVFILT|NOTE|SHUT|PROT|MAP|MFD|T?PACKET|MSG|SCM|MCL|DT|MADV|PR|LOCAL)_/ || +		$2 ~ /^(AF|SOCK|SO|SOL|IPPROTO|IP|IPV6|TCP|MCAST|EVFILT|NOTE|SHUT|PROT|MAP|MFD|T?PACKET|MSG|SCM|MCL|DT|MADV|PR|LOCAL|TCPOPT)_/ ||  		$2 ~ /^NFC_(GENL|PROTO|COMM|RF|SE|DIRECTION|LLCP|SOCKPROTO)_/ ||  		$2 ~ /^NFC_.*_(MAX)?SIZE$/ ||  		$2 ~ /^RAW_PAYLOAD_/ || diff --git a/vendor/golang.org/x/sys/unix/syscall_linux.go b/vendor/golang.org/x/sys/unix/syscall_linux.go index 41b91fdfb..2839435e3 100644 --- a/vendor/golang.org/x/sys/unix/syscall_linux.go +++ b/vendor/golang.org/x/sys/unix/syscall_linux.go @@ -66,11 +66,18 @@ func Fchmodat(dirfd int, path string, mode uint32, flags int) (err error) {  	return fchmodat(dirfd, path, mode)  } -//sys	ioctl(fd int, req uint, arg uintptr) (err error) +//sys	ioctl(fd int, req uint, arg uintptr) (err error) = SYS_IOCTL +//sys	ioctlPtr(fd int, req uint, arg unsafe.Pointer) (err error) = SYS_IOCTL -// ioctl itself should not be exposed directly, but additional get/set -// functions for specific types are permissible. -// These are defined in ioctl.go and ioctl_linux.go. +// ioctl itself should not be exposed directly, but additional get/set functions +// for specific types are permissible. These are defined in ioctl.go and +// ioctl_linux.go. +// +// The third argument to ioctl is often a pointer but sometimes an integer. +// Callers should use ioctlPtr when the third argument is a pointer and ioctl +// when the third argument is an integer. +// +// TODO: some existing code incorrectly uses ioctl when it should use ioctlPtr.  //sys	Linkat(olddirfd int, oldpath string, newdirfd int, newpath string, flags int) (err error) @@ -1348,6 +1355,13 @@ func SetsockoptTpacketReq3(fd, level, opt int, tp *TpacketReq3) error {  	return setsockopt(fd, level, opt, unsafe.Pointer(tp), unsafe.Sizeof(*tp))  } +func SetsockoptTCPRepairOpt(fd, level, opt int, o []TCPRepairOpt) (err error) { +	if len(o) == 0 { +		return EINVAL +	} +	return setsockopt(fd, level, opt, unsafe.Pointer(&o[0]), uintptr(SizeofTCPRepairOpt*len(o))) +} +  // Keyctl Commands (http://man7.org/linux/man-pages/man2/keyctl.2.html)  // KeyctlInt calls keyctl commands in which each argument is an int. @@ -1859,7 +1873,7 @@ func Getpgrp() (pid int) {  //sys	Nanosleep(time *Timespec, leftover *Timespec) (err error)  //sys	PerfEventOpen(attr *PerfEventAttr, pid int, cpu int, groupFd int, flags int) (fd int, err error)  //sys	PivotRoot(newroot string, putold string) (err error) = SYS_PIVOT_ROOT -//sysnb	prlimit(pid int, resource int, newlimit *Rlimit, old *Rlimit) (err error) = SYS_PRLIMIT64 +//sysnb	Prlimit(pid int, resource int, newlimit *Rlimit, old *Rlimit) (err error) = SYS_PRLIMIT64  //sys	Prctl(option int, arg2 uintptr, arg3 uintptr, arg4 uintptr, arg5 uintptr) (err error)  //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) diff --git a/vendor/golang.org/x/sys/unix/syscall_linux_386.go b/vendor/golang.org/x/sys/unix/syscall_linux_386.go index b430536c8..91317d749 100644 --- a/vendor/golang.org/x/sys/unix/syscall_linux_386.go +++ b/vendor/golang.org/x/sys/unix/syscall_linux_386.go @@ -105,7 +105,7 @@ const rlimInf32 = ^uint32(0)  const rlimInf64 = ^uint64(0)  func Getrlimit(resource int, rlim *Rlimit) (err error) { -	err = prlimit(0, resource, nil, rlim) +	err = Prlimit(0, resource, nil, rlim)  	if err != ENOSYS {  		return err  	} @@ -133,7 +133,7 @@ func Getrlimit(resource int, rlim *Rlimit) (err error) {  //sysnb	setrlimit(resource int, rlim *rlimit32) (err error) = SYS_SETRLIMIT  func Setrlimit(resource int, rlim *Rlimit) (err error) { -	err = prlimit(0, resource, rlim, nil) +	err = Prlimit(0, resource, rlim, nil)  	if err != ENOSYS {  		return err  	} diff --git a/vendor/golang.org/x/sys/unix/syscall_linux_arm.go b/vendor/golang.org/x/sys/unix/syscall_linux_arm.go index 39a864d4e..b961a620e 100644 --- a/vendor/golang.org/x/sys/unix/syscall_linux_arm.go +++ b/vendor/golang.org/x/sys/unix/syscall_linux_arm.go @@ -184,7 +184,7 @@ const rlimInf32 = ^uint32(0)  const rlimInf64 = ^uint64(0)  func Getrlimit(resource int, rlim *Rlimit) (err error) { -	err = prlimit(0, resource, nil, rlim) +	err = Prlimit(0, resource, nil, rlim)  	if err != ENOSYS {  		return err  	} @@ -212,7 +212,7 @@ func Getrlimit(resource int, rlim *Rlimit) (err error) {  //sysnb	setrlimit(resource int, rlim *rlimit32) (err error) = SYS_SETRLIMIT  func Setrlimit(resource int, rlim *Rlimit) (err error) { -	err = prlimit(0, resource, rlim, nil) +	err = Prlimit(0, resource, rlim, nil)  	if err != ENOSYS {  		return err  	} diff --git a/vendor/golang.org/x/sys/unix/syscall_linux_arm64.go b/vendor/golang.org/x/sys/unix/syscall_linux_arm64.go index 7f27ebf2f..4b977ba44 100644 --- a/vendor/golang.org/x/sys/unix/syscall_linux_arm64.go +++ b/vendor/golang.org/x/sys/unix/syscall_linux_arm64.go @@ -171,7 +171,7 @@ func Pipe2(p []int, flags int) (err error) {  // Getrlimit prefers the prlimit64 system call. See issue 38604.  func Getrlimit(resource int, rlim *Rlimit) error { -	err := prlimit(0, resource, nil, rlim) +	err := Prlimit(0, resource, nil, rlim)  	if err != ENOSYS {  		return err  	} @@ -180,7 +180,7 @@ func Getrlimit(resource int, rlim *Rlimit) error {  // Setrlimit prefers the prlimit64 system call. See issue 38604.  func Setrlimit(resource int, rlim *Rlimit) error { -	err := prlimit(0, resource, rlim, nil) +	err := Prlimit(0, resource, rlim, nil)  	if err != ENOSYS {  		return err  	} diff --git a/vendor/golang.org/x/sys/unix/syscall_linux_mipsx.go b/vendor/golang.org/x/sys/unix/syscall_linux_mipsx.go index 3a5621e37..21d74e2fb 100644 --- a/vendor/golang.org/x/sys/unix/syscall_linux_mipsx.go +++ b/vendor/golang.org/x/sys/unix/syscall_linux_mipsx.go @@ -157,7 +157,7 @@ type rlimit32 struct {  //sysnb	getrlimit(resource int, rlim *rlimit32) (err error) = SYS_GETRLIMIT  func Getrlimit(resource int, rlim *Rlimit) (err error) { -	err = prlimit(0, resource, nil, rlim) +	err = Prlimit(0, resource, nil, rlim)  	if err != ENOSYS {  		return err  	} @@ -185,7 +185,7 @@ func Getrlimit(resource int, rlim *Rlimit) (err error) {  //sysnb	setrlimit(resource int, rlim *rlimit32) (err error) = SYS_SETRLIMIT  func Setrlimit(resource int, rlim *Rlimit) (err error) { -	err = prlimit(0, resource, rlim, nil) +	err = Prlimit(0, resource, rlim, nil)  	if err != ENOSYS {  		return err  	} diff --git a/vendor/golang.org/x/sys/unix/syscall_linux_ppc.go b/vendor/golang.org/x/sys/unix/syscall_linux_ppc.go index cf0d36f76..6f1fc581e 100644 --- a/vendor/golang.org/x/sys/unix/syscall_linux_ppc.go +++ b/vendor/golang.org/x/sys/unix/syscall_linux_ppc.go @@ -3,8 +3,7 @@  // license that can be found in the LICENSE file.  //go:build linux && ppc -// +build linux -// +build ppc +// +build linux,ppc  package unix @@ -143,7 +142,7 @@ const rlimInf32 = ^uint32(0)  const rlimInf64 = ^uint64(0)  func Getrlimit(resource int, rlim *Rlimit) (err error) { -	err = prlimit(0, resource, nil, rlim) +	err = Prlimit(0, resource, nil, rlim)  	if err != ENOSYS {  		return err  	} @@ -171,7 +170,7 @@ func Getrlimit(resource int, rlim *Rlimit) (err error) {  //sysnb	setrlimit(resource int, rlim *rlimit32) (err error) = SYS_SETRLIMIT  func Setrlimit(resource int, rlim *Rlimit) (err error) { -	err = prlimit(0, resource, rlim, nil) +	err = Prlimit(0, resource, rlim, nil)  	if err != ENOSYS {  		return err  	} diff --git a/vendor/golang.org/x/sys/unix/syscall_solaris.go b/vendor/golang.org/x/sys/unix/syscall_solaris.go index 77fcde7c1..d2a6495c7 100644 --- a/vendor/golang.org/x/sys/unix/syscall_solaris.go +++ b/vendor/golang.org/x/sys/unix/syscall_solaris.go @@ -13,7 +13,10 @@  package unix  import ( +	"fmt" +	"os"  	"runtime" +	"sync"  	"syscall"  	"unsafe"  ) @@ -744,3 +747,240 @@ func Mmap(fd int, offset int64, length int, prot int, flags int) (data []byte, e  func Munmap(b []byte) (err error) {  	return mapper.Munmap(b)  } + +// Event Ports + +type fileObjCookie struct { +	fobj   *fileObj +	cookie interface{} +} + +// EventPort provides a safe abstraction on top of Solaris/illumos Event Ports. +type EventPort struct { +	port  int +	mu    sync.Mutex +	fds   map[uintptr]interface{} +	paths map[string]*fileObjCookie +} + +// PortEvent is an abstraction of the port_event C struct. +// Compare Source against PORT_SOURCE_FILE or PORT_SOURCE_FD +// to see if Path or Fd was the event source. The other will be +// uninitialized. +type PortEvent struct { +	Cookie interface{} +	Events int32 +	Fd     uintptr +	Path   string +	Source uint16 +	fobj   *fileObj +} + +// NewEventPort creates a new EventPort including the +// underlying call to port_create(3c). +func NewEventPort() (*EventPort, error) { +	port, err := port_create() +	if err != nil { +		return nil, err +	} +	e := &EventPort{ +		port:  port, +		fds:   make(map[uintptr]interface{}), +		paths: make(map[string]*fileObjCookie), +	} +	return e, nil +} + +//sys	port_create() (n int, err error) +//sys	port_associate(port int, source int, object uintptr, events int, user *byte) (n int, err error) +//sys	port_dissociate(port int, source int, object uintptr) (n int, err error) +//sys	port_get(port int, pe *portEvent, timeout *Timespec) (n int, err error) +//sys	port_getn(port int, pe *portEvent, max uint32, nget *uint32, timeout *Timespec) (n int, err error) + +// Close closes the event port. +func (e *EventPort) Close() error { +	e.mu.Lock() +	defer e.mu.Unlock() +	e.fds = nil +	e.paths = nil +	return Close(e.port) +} + +// PathIsWatched checks to see if path is associated with this EventPort. +func (e *EventPort) PathIsWatched(path string) bool { +	e.mu.Lock() +	defer e.mu.Unlock() +	_, found := e.paths[path] +	return found +} + +// FdIsWatched checks to see if fd is associated with this EventPort. +func (e *EventPort) FdIsWatched(fd uintptr) bool { +	e.mu.Lock() +	defer e.mu.Unlock() +	_, found := e.fds[fd] +	return found +} + +// AssociatePath wraps port_associate(3c) for a filesystem path including +// creating the necessary file_obj from the provided stat information. +func (e *EventPort) AssociatePath(path string, stat os.FileInfo, events int, cookie interface{}) error { +	e.mu.Lock() +	defer e.mu.Unlock() +	if _, found := e.paths[path]; found { +		return fmt.Errorf("%v is already associated with this Event Port", path) +	} +	fobj, err := createFileObj(path, stat) +	if err != nil { +		return err +	} +	fCookie := &fileObjCookie{fobj, cookie} +	_, err = port_associate(e.port, PORT_SOURCE_FILE, uintptr(unsafe.Pointer(fobj)), events, (*byte)(unsafe.Pointer(&fCookie.cookie))) +	if err != nil { +		return err +	} +	e.paths[path] = fCookie +	return nil +} + +// DissociatePath wraps port_dissociate(3c) for a filesystem path. +func (e *EventPort) DissociatePath(path string) error { +	e.mu.Lock() +	defer e.mu.Unlock() +	f, ok := e.paths[path] +	if !ok { +		return fmt.Errorf("%v is not associated with this Event Port", path) +	} +	_, err := port_dissociate(e.port, PORT_SOURCE_FILE, uintptr(unsafe.Pointer(f.fobj))) +	if err != nil { +		return err +	} +	delete(e.paths, path) +	return nil +} + +// AssociateFd wraps calls to port_associate(3c) on file descriptors. +func (e *EventPort) AssociateFd(fd uintptr, events int, cookie interface{}) error { +	e.mu.Lock() +	defer e.mu.Unlock() +	if _, found := e.fds[fd]; found { +		return fmt.Errorf("%v is already associated with this Event Port", fd) +	} +	pcookie := &cookie +	_, err := port_associate(e.port, PORT_SOURCE_FD, fd, events, (*byte)(unsafe.Pointer(pcookie))) +	if err != nil { +		return err +	} +	e.fds[fd] = pcookie +	return nil +} + +// DissociateFd wraps calls to port_dissociate(3c) on file descriptors. +func (e *EventPort) DissociateFd(fd uintptr) error { +	e.mu.Lock() +	defer e.mu.Unlock() +	_, ok := e.fds[fd] +	if !ok { +		return fmt.Errorf("%v is not associated with this Event Port", fd) +	} +	_, err := port_dissociate(e.port, PORT_SOURCE_FD, fd) +	if err != nil { +		return err +	} +	delete(e.fds, fd) +	return nil +} + +func createFileObj(name string, stat os.FileInfo) (*fileObj, error) { +	fobj := new(fileObj) +	bs, err := ByteSliceFromString(name) +	if err != nil { +		return nil, err +	} +	fobj.Name = (*int8)(unsafe.Pointer(&bs[0])) +	s := stat.Sys().(*syscall.Stat_t) +	fobj.Atim.Sec = s.Atim.Sec +	fobj.Atim.Nsec = s.Atim.Nsec +	fobj.Mtim.Sec = s.Mtim.Sec +	fobj.Mtim.Nsec = s.Mtim.Nsec +	fobj.Ctim.Sec = s.Ctim.Sec +	fobj.Ctim.Nsec = s.Ctim.Nsec +	return fobj, nil +} + +// GetOne wraps port_get(3c) and returns a single PortEvent. +func (e *EventPort) GetOne(t *Timespec) (*PortEvent, error) { +	pe := new(portEvent) +	_, err := port_get(e.port, pe, t) +	if err != nil { +		return nil, err +	} +	p := new(PortEvent) +	p.Events = pe.Events +	p.Source = pe.Source +	e.mu.Lock() +	defer e.mu.Unlock() +	switch pe.Source { +	case PORT_SOURCE_FD: +		p.Fd = uintptr(pe.Object) +		cookie := (*interface{})(unsafe.Pointer(pe.User)) +		p.Cookie = *cookie +		delete(e.fds, p.Fd) +	case PORT_SOURCE_FILE: +		p.fobj = (*fileObj)(unsafe.Pointer(uintptr(pe.Object))) +		p.Path = BytePtrToString((*byte)(unsafe.Pointer(p.fobj.Name))) +		cookie := (*interface{})(unsafe.Pointer(pe.User)) +		p.Cookie = *cookie +		delete(e.paths, p.Path) +	} +	return p, nil +} + +// Pending wraps port_getn(3c) and returns how many events are pending. +func (e *EventPort) Pending() (int, error) { +	var n uint32 = 0 +	_, err := port_getn(e.port, nil, 0, &n, nil) +	return int(n), err +} + +// Get wraps port_getn(3c) and fills a slice of PortEvent. +// It will block until either min events have been received +// or the timeout has been exceeded. It will return how many +// events were actually received along with any error information. +func (e *EventPort) Get(s []PortEvent, min int, timeout *Timespec) (int, error) { +	if min == 0 { +		return 0, fmt.Errorf("need to request at least one event or use Pending() instead") +	} +	if len(s) < min { +		return 0, fmt.Errorf("len(s) (%d) is less than min events requested (%d)", len(s), min) +	} +	got := uint32(min) +	max := uint32(len(s)) +	var err error +	ps := make([]portEvent, max, max) +	_, err = port_getn(e.port, &ps[0], max, &got, timeout) +	// got will be trustworthy with ETIME, but not any other error. +	if err != nil && err != ETIME { +		return 0, err +	} +	e.mu.Lock() +	defer e.mu.Unlock() +	for i := 0; i < int(got); i++ { +		s[i].Events = ps[i].Events +		s[i].Source = ps[i].Source +		switch ps[i].Source { +		case PORT_SOURCE_FD: +			s[i].Fd = uintptr(ps[i].Object) +			cookie := (*interface{})(unsafe.Pointer(ps[i].User)) +			s[i].Cookie = *cookie +			delete(e.fds, s[i].Fd) +		case PORT_SOURCE_FILE: +			s[i].fobj = (*fileObj)(unsafe.Pointer(uintptr(ps[i].Object))) +			s[i].Path = BytePtrToString((*byte)(unsafe.Pointer(s[i].fobj.Name))) +			cookie := (*interface{})(unsafe.Pointer(ps[i].User)) +			s[i].Cookie = *cookie +			delete(e.paths, s[i].Path) +		} +	} +	return int(got), err +} diff --git a/vendor/golang.org/x/sys/unix/syscall_unix.go b/vendor/golang.org/x/sys/unix/syscall_unix.go index a7618ceb5..cf296a243 100644 --- a/vendor/golang.org/x/sys/unix/syscall_unix.go +++ b/vendor/golang.org/x/sys/unix/syscall_unix.go @@ -313,6 +313,10 @@ func Recvfrom(fd int, p []byte, flags int) (n int, from Sockaddr, err error) {  	return  } +func Send(s int, buf []byte, flags int) (err error) { +	return sendto(s, buf, flags, nil, 0) +} +  func Sendto(fd int, p []byte, flags int, to Sockaddr) (err error) {  	ptr, n, err := to.sockaddr()  	if err != nil { diff --git a/vendor/golang.org/x/sys/unix/zerrors_darwin_amd64.go b/vendor/golang.org/x/sys/unix/zerrors_darwin_amd64.go index 5bb48ef54..a3a45fec5 100644 --- a/vendor/golang.org/x/sys/unix/zerrors_darwin_amd64.go +++ b/vendor/golang.org/x/sys/unix/zerrors_darwin_amd64.go @@ -1206,6 +1206,7 @@ const (  	RTF_DONE                          = 0x40  	RTF_DYNAMIC                       = 0x10  	RTF_GATEWAY                       = 0x2 +	RTF_GLOBAL                        = 0x40000000  	RTF_HOST                          = 0x4  	RTF_IFREF                         = 0x4000000  	RTF_IFSCOPE                       = 0x1000000 diff --git a/vendor/golang.org/x/sys/unix/zerrors_darwin_arm64.go b/vendor/golang.org/x/sys/unix/zerrors_darwin_arm64.go index 11e570979..31009d7f0 100644 --- a/vendor/golang.org/x/sys/unix/zerrors_darwin_arm64.go +++ b/vendor/golang.org/x/sys/unix/zerrors_darwin_arm64.go @@ -1206,6 +1206,7 @@ const (  	RTF_DONE                          = 0x40  	RTF_DYNAMIC                       = 0x10  	RTF_GATEWAY                       = 0x2 +	RTF_GLOBAL                        = 0x40000000  	RTF_HOST                          = 0x4  	RTF_IFREF                         = 0x4000000  	RTF_IFSCOPE                       = 0x1000000 diff --git a/vendor/golang.org/x/sys/unix/zerrors_linux.go b/vendor/golang.org/x/sys/unix/zerrors_linux.go index 52f5bbc14..135e3a47a 100644 --- a/vendor/golang.org/x/sys/unix/zerrors_linux.go +++ b/vendor/golang.org/x/sys/unix/zerrors_linux.go @@ -228,6 +228,8 @@ const (  	BPF_OR                                      = 0x40  	BPF_PSEUDO_BTF_ID                           = 0x3  	BPF_PSEUDO_CALL                             = 0x1 +	BPF_PSEUDO_FUNC                             = 0x4 +	BPF_PSEUDO_KFUNC_CALL                       = 0x2  	BPF_PSEUDO_MAP_FD                           = 0x1  	BPF_PSEUDO_MAP_VALUE                        = 0x2  	BPF_RET                                     = 0x6 @@ -475,6 +477,8 @@ const (  	DM_LIST_VERSIONS                            = 0xc138fd0d  	DM_MAX_TYPE_NAME                            = 0x10  	DM_NAME_LEN                                 = 0x80 +	DM_NAME_LIST_FLAG_DOESNT_HAVE_UUID          = 0x2 +	DM_NAME_LIST_FLAG_HAS_UUID                  = 0x1  	DM_NOFLUSH_FLAG                             = 0x800  	DM_PERSISTENT_DEV_FLAG                      = 0x8  	DM_QUERY_INACTIVE_TABLE_FLAG                = 0x1000 @@ -494,9 +498,9 @@ const (  	DM_UUID_FLAG                                = 0x4000  	DM_UUID_LEN                                 = 0x81  	DM_VERSION                                  = 0xc138fd00 -	DM_VERSION_EXTRA                            = "-ioctl (2021-02-01)" +	DM_VERSION_EXTRA                            = "-ioctl (2021-03-22)"  	DM_VERSION_MAJOR                            = 0x4 -	DM_VERSION_MINOR                            = 0x2c +	DM_VERSION_MINOR                            = 0x2d  	DM_VERSION_PATCHLEVEL                       = 0x0  	DT_BLK                                      = 0x6  	DT_CHR                                      = 0x2 @@ -981,12 +985,6 @@ const (  	HPFS_SUPER_MAGIC                            = 0xf995e849  	HUGETLBFS_MAGIC                             = 0x958458f6  	IBSHIFT                                     = 0x10 -	ICMPV6_FILTER                               = 0x1 -	ICMPV6_FILTER_BLOCK                         = 0x1 -	ICMPV6_FILTER_BLOCKOTHERS                   = 0x3 -	ICMPV6_FILTER_PASS                          = 0x2 -	ICMPV6_FILTER_PASSONLY                      = 0x4 -	ICMP_FILTER                                 = 0x1  	ICRNL                                       = 0x100  	IFA_F_DADFAILED                             = 0x8  	IFA_F_DEPRECATED                            = 0x20 @@ -1257,6 +1255,7 @@ const (  	KEXEC_ARCH_PARISC                           = 0xf0000  	KEXEC_ARCH_PPC                              = 0x140000  	KEXEC_ARCH_PPC64                            = 0x150000 +	KEXEC_ARCH_RISCV                            = 0xf30000  	KEXEC_ARCH_S390                             = 0x160000  	KEXEC_ARCH_SH                               = 0x2a0000  	KEXEC_ARCH_X86_64                           = 0x3e0000 @@ -1756,14 +1755,19 @@ const (  	PERF_ATTR_SIZE_VER4                         = 0x68  	PERF_ATTR_SIZE_VER5                         = 0x70  	PERF_ATTR_SIZE_VER6                         = 0x78 +	PERF_ATTR_SIZE_VER7                         = 0x80  	PERF_AUX_FLAG_COLLISION                     = 0x8 +	PERF_AUX_FLAG_CORESIGHT_FORMAT_CORESIGHT    = 0x0 +	PERF_AUX_FLAG_CORESIGHT_FORMAT_RAW          = 0x100  	PERF_AUX_FLAG_OVERWRITE                     = 0x2  	PERF_AUX_FLAG_PARTIAL                       = 0x4 +	PERF_AUX_FLAG_PMU_FORMAT_TYPE_MASK          = 0xff00  	PERF_AUX_FLAG_TRUNCATED                     = 0x1  	PERF_FLAG_FD_CLOEXEC                        = 0x8  	PERF_FLAG_FD_NO_GROUP                       = 0x1  	PERF_FLAG_FD_OUTPUT                         = 0x2  	PERF_FLAG_PID_CGROUP                        = 0x4 +	PERF_HW_EVENT_MASK                          = 0xffffffff  	PERF_MAX_CONTEXTS_PER_STACK                 = 0x8  	PERF_MAX_STACK_DEPTH                        = 0x7f  	PERF_MEM_BLK_ADDR                           = 0x4 @@ -1822,6 +1826,7 @@ const (  	PERF_MEM_TLB_OS                             = 0x40  	PERF_MEM_TLB_SHIFT                          = 0x1a  	PERF_MEM_TLB_WK                             = 0x20 +	PERF_PMU_TYPE_SHIFT                         = 0x20  	PERF_RECORD_KSYMBOL_FLAGS_UNREGISTER        = 0x1  	PERF_RECORD_MISC_COMM_EXEC                  = 0x2000  	PERF_RECORD_MISC_CPUMODE_MASK               = 0x7 @@ -1921,7 +1926,9 @@ const (  	PR_PAC_APGAKEY                              = 0x10  	PR_PAC_APIAKEY                              = 0x1  	PR_PAC_APIBKEY                              = 0x2 +	PR_PAC_GET_ENABLED_KEYS                     = 0x3d  	PR_PAC_RESET_KEYS                           = 0x36 +	PR_PAC_SET_ENABLED_KEYS                     = 0x3c  	PR_SET_CHILD_SUBREAPER                      = 0x24  	PR_SET_DUMPABLE                             = 0x4  	PR_SET_ENDIAN                               = 0x14 @@ -2003,6 +2010,7 @@ const (  	PTRACE_GETREGSET                            = 0x4204  	PTRACE_GETSIGINFO                           = 0x4202  	PTRACE_GETSIGMASK                           = 0x420a +	PTRACE_GET_RSEQ_CONFIGURATION               = 0x420f  	PTRACE_GET_SYSCALL_INFO                     = 0x420e  	PTRACE_INTERRUPT                            = 0x4207  	PTRACE_KILL                                 = 0x8 @@ -2163,6 +2171,7 @@ const (  	RTM_DELNEIGH                                = 0x1d  	RTM_DELNETCONF                              = 0x51  	RTM_DELNEXTHOP                              = 0x69 +	RTM_DELNEXTHOPBUCKET                        = 0x75  	RTM_DELNSID                                 = 0x59  	RTM_DELQDISC                                = 0x25  	RTM_DELROUTE                                = 0x19 @@ -2193,6 +2202,7 @@ const (  	RTM_GETNEIGHTBL                             = 0x42  	RTM_GETNETCONF                              = 0x52  	RTM_GETNEXTHOP                              = 0x6a +	RTM_GETNEXTHOPBUCKET                        = 0x76  	RTM_GETNSID                                 = 0x5a  	RTM_GETQDISC                                = 0x26  	RTM_GETROUTE                                = 0x1a @@ -2201,7 +2211,7 @@ const (  	RTM_GETTCLASS                               = 0x2a  	RTM_GETTFILTER                              = 0x2e  	RTM_GETVLAN                                 = 0x72 -	RTM_MAX                                     = 0x73 +	RTM_MAX                                     = 0x77  	RTM_NEWACTION                               = 0x30  	RTM_NEWADDR                                 = 0x14  	RTM_NEWADDRLABEL                            = 0x48 @@ -2215,6 +2225,7 @@ const (  	RTM_NEWNEIGHTBL                             = 0x40  	RTM_NEWNETCONF                              = 0x50  	RTM_NEWNEXTHOP                              = 0x68 +	RTM_NEWNEXTHOPBUCKET                        = 0x74  	RTM_NEWNSID                                 = 0x58  	RTM_NEWNVLAN                                = 0x70  	RTM_NEWPREFIX                               = 0x34 @@ -2224,8 +2235,8 @@ const (  	RTM_NEWSTATS                                = 0x5c  	RTM_NEWTCLASS                               = 0x28  	RTM_NEWTFILTER                              = 0x2c -	RTM_NR_FAMILIES                             = 0x19 -	RTM_NR_MSGTYPES                             = 0x64 +	RTM_NR_FAMILIES                             = 0x1a +	RTM_NR_MSGTYPES                             = 0x68  	RTM_SETDCB                                  = 0x4f  	RTM_SETLINK                                 = 0x13  	RTM_SETNEIGHTBL                             = 0x43 @@ -2253,6 +2264,7 @@ const (  	RTPROT_MROUTED                              = 0x11  	RTPROT_MRT                                  = 0xa  	RTPROT_NTK                                  = 0xf +	RTPROT_OPENR                                = 0x63  	RTPROT_OSPF                                 = 0xbc  	RTPROT_RA                                   = 0x9  	RTPROT_REDIRECT                             = 0x1 @@ -2536,6 +2548,14 @@ const (  	TCOFLUSH                                    = 0x1  	TCOOFF                                      = 0x0  	TCOON                                       = 0x1 +	TCPOPT_EOL                                  = 0x0 +	TCPOPT_MAXSEG                               = 0x2 +	TCPOPT_NOP                                  = 0x1 +	TCPOPT_SACK                                 = 0x5 +	TCPOPT_SACK_PERMITTED                       = 0x4 +	TCPOPT_TIMESTAMP                            = 0x8 +	TCPOPT_TSTAMP_HDR                           = 0x101080a +	TCPOPT_WINDOW                               = 0x3  	TCP_CC_INFO                                 = 0x1a  	TCP_CM_INQ                                  = 0x24  	TCP_CONGESTION                              = 0xd diff --git a/vendor/golang.org/x/sys/unix/zerrors_linux_386.go b/vendor/golang.org/x/sys/unix/zerrors_linux_386.go index 09fc559ed..cca248d1d 100644 --- a/vendor/golang.org/x/sys/unix/zerrors_linux_386.go +++ b/vendor/golang.org/x/sys/unix/zerrors_linux_386.go @@ -147,6 +147,7 @@ const (  	NS_GET_USERNS                    = 0xb701  	OLCUC                            = 0x2  	ONLCR                            = 0x4 +	OTPERASE                         = 0x400c4d19  	OTPGETREGIONCOUNT                = 0x40044d0e  	OTPGETREGIONINFO                 = 0x400c4d0f  	OTPLOCK                          = 0x800c4d10 diff --git a/vendor/golang.org/x/sys/unix/zerrors_linux_amd64.go b/vendor/golang.org/x/sys/unix/zerrors_linux_amd64.go index 75730cc22..9521a4804 100644 --- a/vendor/golang.org/x/sys/unix/zerrors_linux_amd64.go +++ b/vendor/golang.org/x/sys/unix/zerrors_linux_amd64.go @@ -147,6 +147,7 @@ const (  	NS_GET_USERNS                    = 0xb701  	OLCUC                            = 0x2  	ONLCR                            = 0x4 +	OTPERASE                         = 0x400c4d19  	OTPGETREGIONCOUNT                = 0x40044d0e  	OTPGETREGIONINFO                 = 0x400c4d0f  	OTPLOCK                          = 0x800c4d10 diff --git a/vendor/golang.org/x/sys/unix/zerrors_linux_arm.go b/vendor/golang.org/x/sys/unix/zerrors_linux_arm.go index 127cf17ad..ddb40a40d 100644 --- a/vendor/golang.org/x/sys/unix/zerrors_linux_arm.go +++ b/vendor/golang.org/x/sys/unix/zerrors_linux_arm.go @@ -145,6 +145,7 @@ const (  	NS_GET_USERNS                    = 0xb701  	OLCUC                            = 0x2  	ONLCR                            = 0x4 +	OTPERASE                         = 0x400c4d19  	OTPGETREGIONCOUNT                = 0x40044d0e  	OTPGETREGIONINFO                 = 0x400c4d0f  	OTPLOCK                          = 0x800c4d10 diff --git a/vendor/golang.org/x/sys/unix/zerrors_linux_arm64.go b/vendor/golang.org/x/sys/unix/zerrors_linux_arm64.go index 957ca1ff1..3df31e0d4 100644 --- a/vendor/golang.org/x/sys/unix/zerrors_linux_arm64.go +++ b/vendor/golang.org/x/sys/unix/zerrors_linux_arm64.go @@ -148,6 +148,7 @@ const (  	NS_GET_USERNS                    = 0xb701  	OLCUC                            = 0x2  	ONLCR                            = 0x4 +	OTPERASE                         = 0x400c4d19  	OTPGETREGIONCOUNT                = 0x40044d0e  	OTPGETREGIONINFO                 = 0x400c4d0f  	OTPLOCK                          = 0x800c4d10 diff --git a/vendor/golang.org/x/sys/unix/zerrors_linux_mips.go b/vendor/golang.org/x/sys/unix/zerrors_linux_mips.go index 314a2054f..179c7d68d 100644 --- a/vendor/golang.org/x/sys/unix/zerrors_linux_mips.go +++ b/vendor/golang.org/x/sys/unix/zerrors_linux_mips.go @@ -145,6 +145,7 @@ const (  	NS_GET_USERNS                    = 0x2000b701  	OLCUC                            = 0x2  	ONLCR                            = 0x4 +	OTPERASE                         = 0x800c4d19  	OTPGETREGIONCOUNT                = 0x80044d0e  	OTPGETREGIONINFO                 = 0x800c4d0f  	OTPLOCK                          = 0x400c4d10 diff --git a/vendor/golang.org/x/sys/unix/zerrors_linux_mips64.go b/vendor/golang.org/x/sys/unix/zerrors_linux_mips64.go index 457e8de97..84ab15a85 100644 --- a/vendor/golang.org/x/sys/unix/zerrors_linux_mips64.go +++ b/vendor/golang.org/x/sys/unix/zerrors_linux_mips64.go @@ -145,6 +145,7 @@ const (  	NS_GET_USERNS                    = 0x2000b701  	OLCUC                            = 0x2  	ONLCR                            = 0x4 +	OTPERASE                         = 0x800c4d19  	OTPGETREGIONCOUNT                = 0x80044d0e  	OTPGETREGIONINFO                 = 0x800c4d0f  	OTPLOCK                          = 0x400c4d10 diff --git a/vendor/golang.org/x/sys/unix/zerrors_linux_mips64le.go b/vendor/golang.org/x/sys/unix/zerrors_linux_mips64le.go index 33cd28f6b..6aa064da5 100644 --- a/vendor/golang.org/x/sys/unix/zerrors_linux_mips64le.go +++ b/vendor/golang.org/x/sys/unix/zerrors_linux_mips64le.go @@ -145,6 +145,7 @@ const (  	NS_GET_USERNS                    = 0x2000b701  	OLCUC                            = 0x2  	ONLCR                            = 0x4 +	OTPERASE                         = 0x800c4d19  	OTPGETREGIONCOUNT                = 0x80044d0e  	OTPGETREGIONINFO                 = 0x800c4d0f  	OTPLOCK                          = 0x400c4d10 diff --git a/vendor/golang.org/x/sys/unix/zerrors_linux_mipsle.go b/vendor/golang.org/x/sys/unix/zerrors_linux_mipsle.go index 0e085ba14..960650f2b 100644 --- a/vendor/golang.org/x/sys/unix/zerrors_linux_mipsle.go +++ b/vendor/golang.org/x/sys/unix/zerrors_linux_mipsle.go @@ -145,6 +145,7 @@ const (  	NS_GET_USERNS                    = 0x2000b701  	OLCUC                            = 0x2  	ONLCR                            = 0x4 +	OTPERASE                         = 0x800c4d19  	OTPGETREGIONCOUNT                = 0x80044d0e  	OTPGETREGIONINFO                 = 0x800c4d0f  	OTPLOCK                          = 0x400c4d10 diff --git a/vendor/golang.org/x/sys/unix/zerrors_linux_ppc.go b/vendor/golang.org/x/sys/unix/zerrors_linux_ppc.go index 1b5928cff..7365221d0 100644 --- a/vendor/golang.org/x/sys/unix/zerrors_linux_ppc.go +++ b/vendor/golang.org/x/sys/unix/zerrors_linux_ppc.go @@ -147,6 +147,7 @@ const (  	NS_GET_USERNS                    = 0x2000b701  	OLCUC                            = 0x4  	ONLCR                            = 0x2 +	OTPERASE                         = 0x800c4d19  	OTPGETREGIONCOUNT                = 0x80044d0e  	OTPGETREGIONINFO                 = 0x800c4d0f  	OTPLOCK                          = 0x400c4d10 diff --git a/vendor/golang.org/x/sys/unix/zerrors_linux_ppc64.go b/vendor/golang.org/x/sys/unix/zerrors_linux_ppc64.go index f3a41d6ec..5967db35c 100644 --- a/vendor/golang.org/x/sys/unix/zerrors_linux_ppc64.go +++ b/vendor/golang.org/x/sys/unix/zerrors_linux_ppc64.go @@ -147,6 +147,7 @@ const (  	NS_GET_USERNS                    = 0x2000b701  	OLCUC                            = 0x4  	ONLCR                            = 0x2 +	OTPERASE                         = 0x800c4d19  	OTPGETREGIONCOUNT                = 0x80044d0e  	OTPGETREGIONINFO                 = 0x800c4d0f  	OTPLOCK                          = 0x400c4d10 diff --git a/vendor/golang.org/x/sys/unix/zerrors_linux_ppc64le.go b/vendor/golang.org/x/sys/unix/zerrors_linux_ppc64le.go index 6a5a555d5..f88869849 100644 --- a/vendor/golang.org/x/sys/unix/zerrors_linux_ppc64le.go +++ b/vendor/golang.org/x/sys/unix/zerrors_linux_ppc64le.go @@ -147,6 +147,7 @@ const (  	NS_GET_USERNS                    = 0x2000b701  	OLCUC                            = 0x4  	ONLCR                            = 0x2 +	OTPERASE                         = 0x800c4d19  	OTPGETREGIONCOUNT                = 0x80044d0e  	OTPGETREGIONINFO                 = 0x800c4d0f  	OTPLOCK                          = 0x400c4d10 diff --git a/vendor/golang.org/x/sys/unix/zerrors_linux_riscv64.go b/vendor/golang.org/x/sys/unix/zerrors_linux_riscv64.go index a4da67edb..8048706f3 100644 --- a/vendor/golang.org/x/sys/unix/zerrors_linux_riscv64.go +++ b/vendor/golang.org/x/sys/unix/zerrors_linux_riscv64.go @@ -145,6 +145,7 @@ const (  	NS_GET_USERNS                    = 0xb701  	OLCUC                            = 0x2  	ONLCR                            = 0x4 +	OTPERASE                         = 0x400c4d19  	OTPGETREGIONCOUNT                = 0x40044d0e  	OTPGETREGIONINFO                 = 0x400c4d0f  	OTPLOCK                          = 0x800c4d10 diff --git a/vendor/golang.org/x/sys/unix/zerrors_linux_s390x.go b/vendor/golang.org/x/sys/unix/zerrors_linux_s390x.go index a7028e0ef..fb7859417 100644 --- a/vendor/golang.org/x/sys/unix/zerrors_linux_s390x.go +++ b/vendor/golang.org/x/sys/unix/zerrors_linux_s390x.go @@ -145,6 +145,7 @@ const (  	NS_GET_USERNS                    = 0xb701  	OLCUC                            = 0x2  	ONLCR                            = 0x4 +	OTPERASE                         = 0x400c4d19  	OTPGETREGIONCOUNT                = 0x40044d0e  	OTPGETREGIONINFO                 = 0x400c4d0f  	OTPLOCK                          = 0x800c4d10 diff --git a/vendor/golang.org/x/sys/unix/zerrors_linux_sparc64.go b/vendor/golang.org/x/sys/unix/zerrors_linux_sparc64.go index ed3b3286c..81e18d23f 100644 --- a/vendor/golang.org/x/sys/unix/zerrors_linux_sparc64.go +++ b/vendor/golang.org/x/sys/unix/zerrors_linux_sparc64.go @@ -150,6 +150,7 @@ const (  	NS_GET_USERNS                    = 0x2000b701  	OLCUC                            = 0x2  	ONLCR                            = 0x4 +	OTPERASE                         = 0x800c4d19  	OTPGETREGIONCOUNT                = 0x80044d0e  	OTPGETREGIONINFO                 = 0x800c4d0f  	OTPLOCK                          = 0x400c4d10 diff --git a/vendor/golang.org/x/sys/unix/zerrors_openbsd_386.go b/vendor/golang.org/x/sys/unix/zerrors_openbsd_386.go index 593cc0fef..6d56edc05 100644 --- a/vendor/golang.org/x/sys/unix/zerrors_openbsd_386.go +++ b/vendor/golang.org/x/sys/unix/zerrors_openbsd_386.go @@ -1020,7 +1020,10 @@ const (  	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 diff --git a/vendor/golang.org/x/sys/unix/zerrors_openbsd_arm.go b/vendor/golang.org/x/sys/unix/zerrors_openbsd_arm.go index a4e4c2231..aef6c0856 100644 --- a/vendor/golang.org/x/sys/unix/zerrors_openbsd_arm.go +++ b/vendor/golang.org/x/sys/unix/zerrors_openbsd_arm.go @@ -1020,7 +1020,10 @@ const (  	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 diff --git a/vendor/golang.org/x/sys/unix/zsyscall_linux.go b/vendor/golang.org/x/sys/unix/zsyscall_linux.go index 7305cc915..2dbe3da7a 100644 --- a/vendor/golang.org/x/sys/unix/zsyscall_linux.go +++ b/vendor/golang.org/x/sys/unix/zsyscall_linux.go @@ -48,6 +48,16 @@ func ioctl(fd int, req uint, arg uintptr) (err error) {  // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT +func ioctlPtr(fd int, req uint, arg unsafe.Pointer) (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 Linkat(olddirfd int, oldpath string, newdirfd int, newpath string, flags int) (err error) {  	var _p0 *byte  	_p0, err = BytePtrFromString(oldpath) @@ -1201,7 +1211,7 @@ func PivotRoot(newroot string, putold string) (err error) {  // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT -func prlimit(pid int, resource int, newlimit *Rlimit, old *Rlimit) (err error) { +func Prlimit(pid int, resource int, newlimit *Rlimit, old *Rlimit) (err error) {  	_, _, e1 := RawSyscall6(SYS_PRLIMIT64, uintptr(pid), uintptr(resource), uintptr(unsafe.Pointer(newlimit)), uintptr(unsafe.Pointer(old)), 0, 0)  	if e1 != 0 {  		err = errnoErr(e1) diff --git a/vendor/golang.org/x/sys/unix/zsyscall_solaris_amd64.go b/vendor/golang.org/x/sys/unix/zsyscall_solaris_amd64.go index 4e18d5c99..b5f926cee 100644 --- a/vendor/golang.org/x/sys/unix/zsyscall_solaris_amd64.go +++ b/vendor/golang.org/x/sys/unix/zsyscall_solaris_amd64.go @@ -141,6 +141,11 @@ import (  //go:cgo_import_dynamic libc_getpeername getpeername "libsocket.so"  //go:cgo_import_dynamic libc_setsockopt setsockopt "libsocket.so"  //go:cgo_import_dynamic libc_recvfrom recvfrom "libsocket.so" +//go:cgo_import_dynamic libc_port_create port_create "libc.so" +//go:cgo_import_dynamic libc_port_associate port_associate "libc.so" +//go:cgo_import_dynamic libc_port_dissociate port_dissociate "libc.so" +//go:cgo_import_dynamic libc_port_get port_get "libc.so" +//go:cgo_import_dynamic libc_port_getn port_getn "libc.so"  //go:linkname procpipe libc_pipe  //go:linkname procpipe2 libc_pipe2 @@ -272,6 +277,11 @@ import (  //go:linkname procgetpeername libc_getpeername  //go:linkname procsetsockopt libc_setsockopt  //go:linkname procrecvfrom libc_recvfrom +//go:linkname procport_create libc_port_create +//go:linkname procport_associate libc_port_associate +//go:linkname procport_dissociate libc_port_dissociate +//go:linkname procport_get libc_port_get +//go:linkname procport_getn libc_port_getn  var (  	procpipe, @@ -403,7 +413,12 @@ var (  	proc__xnet_getsockopt,  	procgetpeername,  	procsetsockopt, -	procrecvfrom syscallFunc +	procrecvfrom, +	procport_create, +	procport_associate, +	procport_dissociate, +	procport_get, +	procport_getn syscallFunc  )  // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT @@ -1981,3 +1996,58 @@ func recvfrom(fd int, p []byte, flags int, from *RawSockaddrAny, fromlen *_Sockl  	}  	return  } + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func port_create() (n int, err error) { +	r0, _, e1 := sysvicall6(uintptr(unsafe.Pointer(&procport_create)), 0, 0, 0, 0, 0, 0, 0) +	n = int(r0) +	if e1 != 0 { +		err = e1 +	} +	return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func port_associate(port int, source int, object uintptr, events int, user *byte) (n int, err error) { +	r0, _, e1 := sysvicall6(uintptr(unsafe.Pointer(&procport_associate)), 5, uintptr(port), uintptr(source), uintptr(object), uintptr(events), uintptr(unsafe.Pointer(user)), 0) +	n = int(r0) +	if e1 != 0 { +		err = e1 +	} +	return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func port_dissociate(port int, source int, object uintptr) (n int, err error) { +	r0, _, e1 := sysvicall6(uintptr(unsafe.Pointer(&procport_dissociate)), 3, uintptr(port), uintptr(source), uintptr(object), 0, 0, 0) +	n = int(r0) +	if e1 != 0 { +		err = e1 +	} +	return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func port_get(port int, pe *portEvent, timeout *Timespec) (n int, err error) { +	r0, _, e1 := sysvicall6(uintptr(unsafe.Pointer(&procport_get)), 3, uintptr(port), uintptr(unsafe.Pointer(pe)), uintptr(unsafe.Pointer(timeout)), 0, 0, 0) +	n = int(r0) +	if e1 != 0 { +		err = e1 +	} +	return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func port_getn(port int, pe *portEvent, max uint32, nget *uint32, timeout *Timespec) (n int, err error) { +	r0, _, e1 := sysvicall6(uintptr(unsafe.Pointer(&procport_getn)), 5, uintptr(port), uintptr(unsafe.Pointer(pe)), uintptr(max), uintptr(unsafe.Pointer(nget)), uintptr(unsafe.Pointer(timeout)), 0) +	n = int(r0) +	if e1 != 0 { +		err = e1 +	} +	return +} diff --git a/vendor/golang.org/x/sys/unix/zsysnum_linux_386.go b/vendor/golang.org/x/sys/unix/zsysnum_linux_386.go index fbc59b7fd..eb3afe678 100644 --- a/vendor/golang.org/x/sys/unix/zsysnum_linux_386.go +++ b/vendor/golang.org/x/sys/unix/zsysnum_linux_386.go @@ -439,4 +439,7 @@ const (  	SYS_PROCESS_MADVISE              = 440  	SYS_EPOLL_PWAIT2                 = 441  	SYS_MOUNT_SETATTR                = 442 +	SYS_LANDLOCK_CREATE_RULESET      = 444 +	SYS_LANDLOCK_ADD_RULE            = 445 +	SYS_LANDLOCK_RESTRICT_SELF       = 446  ) diff --git a/vendor/golang.org/x/sys/unix/zsysnum_linux_amd64.go b/vendor/golang.org/x/sys/unix/zsysnum_linux_amd64.go index 04d16d771..8e7e3aedc 100644 --- a/vendor/golang.org/x/sys/unix/zsysnum_linux_amd64.go +++ b/vendor/golang.org/x/sys/unix/zsysnum_linux_amd64.go @@ -7,358 +7,361 @@  package unix  const ( -	SYS_READ                   = 0 -	SYS_WRITE                  = 1 -	SYS_OPEN                   = 2 -	SYS_CLOSE                  = 3 -	SYS_STAT                   = 4 -	SYS_FSTAT                  = 5 -	SYS_LSTAT                  = 6 -	SYS_POLL                   = 7 -	SYS_LSEEK                  = 8 -	SYS_MMAP                   = 9 -	SYS_MPROTECT               = 10 -	SYS_MUNMAP                 = 11 -	SYS_BRK                    = 12 -	SYS_RT_SIGACTION           = 13 -	SYS_RT_SIGPROCMASK         = 14 -	SYS_RT_SIGRETURN           = 15 -	SYS_IOCTL                  = 16 -	SYS_PREAD64                = 17 -	SYS_PWRITE64               = 18 -	SYS_READV                  = 19 -	SYS_WRITEV                 = 20 -	SYS_ACCESS                 = 21 -	SYS_PIPE                   = 22 -	SYS_SELECT                 = 23 -	SYS_SCHED_YIELD            = 24 -	SYS_MREMAP                 = 25 -	SYS_MSYNC                  = 26 -	SYS_MINCORE                = 27 -	SYS_MADVISE                = 28 -	SYS_SHMGET                 = 29 -	SYS_SHMAT                  = 30 -	SYS_SHMCTL                 = 31 -	SYS_DUP                    = 32 -	SYS_DUP2                   = 33 -	SYS_PAUSE                  = 34 -	SYS_NANOSLEEP              = 35 -	SYS_GETITIMER              = 36 -	SYS_ALARM                  = 37 -	SYS_SETITIMER              = 38 -	SYS_GETPID                 = 39 -	SYS_SENDFILE               = 40 -	SYS_SOCKET                 = 41 -	SYS_CONNECT                = 42 -	SYS_ACCEPT                 = 43 -	SYS_SENDTO                 = 44 -	SYS_RECVFROM               = 45 -	SYS_SENDMSG                = 46 -	SYS_RECVMSG                = 47 -	SYS_SHUTDOWN               = 48 -	SYS_BIND                   = 49 -	SYS_LISTEN                 = 50 -	SYS_GETSOCKNAME            = 51 -	SYS_GETPEERNAME            = 52 -	SYS_SOCKETPAIR             = 53 -	SYS_SETSOCKOPT             = 54 -	SYS_GETSOCKOPT             = 55 -	SYS_CLONE                  = 56 -	SYS_FORK                   = 57 -	SYS_VFORK                  = 58 -	SYS_EXECVE                 = 59 -	SYS_EXIT                   = 60 -	SYS_WAIT4                  = 61 -	SYS_KILL                   = 62 -	SYS_UNAME                  = 63 -	SYS_SEMGET                 = 64 -	SYS_SEMOP                  = 65 -	SYS_SEMCTL                 = 66 -	SYS_SHMDT                  = 67 -	SYS_MSGGET                 = 68 -	SYS_MSGSND                 = 69 -	SYS_MSGRCV                 = 70 -	SYS_MSGCTL                 = 71 -	SYS_FCNTL                  = 72 -	SYS_FLOCK                  = 73 -	SYS_FSYNC                  = 74 -	SYS_FDATASYNC              = 75 -	SYS_TRUNCATE               = 76 -	SYS_FTRUNCATE              = 77 -	SYS_GETDENTS               = 78 -	SYS_GETCWD                 = 79 -	SYS_CHDIR                  = 80 -	SYS_FCHDIR                 = 81 -	SYS_RENAME                 = 82 -	SYS_MKDIR                  = 83 -	SYS_RMDIR                  = 84 -	SYS_CREAT                  = 85 -	SYS_LINK                   = 86 -	SYS_UNLINK                 = 87 -	SYS_SYMLINK                = 88 -	SYS_READLINK               = 89 -	SYS_CHMOD                  = 90 -	SYS_FCHMOD                 = 91 -	SYS_CHOWN                  = 92 -	SYS_FCHOWN                 = 93 -	SYS_LCHOWN                 = 94 -	SYS_UMASK                  = 95 -	SYS_GETTIMEOFDAY           = 96 -	SYS_GETRLIMIT              = 97 -	SYS_GETRUSAGE              = 98 -	SYS_SYSINFO                = 99 -	SYS_TIMES                  = 100 -	SYS_PTRACE                 = 101 -	SYS_GETUID                 = 102 -	SYS_SYSLOG                 = 103 -	SYS_GETGID                 = 104 -	SYS_SETUID                 = 105 -	SYS_SETGID                 = 106 -	SYS_GETEUID                = 107 -	SYS_GETEGID                = 108 -	SYS_SETPGID                = 109 -	SYS_GETPPID                = 110 -	SYS_GETPGRP                = 111 -	SYS_SETSID                 = 112 -	SYS_SETREUID               = 113 -	SYS_SETREGID               = 114 -	SYS_GETGROUPS              = 115 -	SYS_SETGROUPS              = 116 -	SYS_SETRESUID              = 117 -	SYS_GETRESUID              = 118 -	SYS_SETRESGID              = 119 -	SYS_GETRESGID              = 120 -	SYS_GETPGID                = 121 -	SYS_SETFSUID               = 122 -	SYS_SETFSGID               = 123 -	SYS_GETSID                 = 124 -	SYS_CAPGET                 = 125 -	SYS_CAPSET                 = 126 -	SYS_RT_SIGPENDING          = 127 -	SYS_RT_SIGTIMEDWAIT        = 128 -	SYS_RT_SIGQUEUEINFO        = 129 -	SYS_RT_SIGSUSPEND          = 130 -	SYS_SIGALTSTACK            = 131 -	SYS_UTIME                  = 132 -	SYS_MKNOD                  = 133 -	SYS_USELIB                 = 134 -	SYS_PERSONALITY            = 135 -	SYS_USTAT                  = 136 -	SYS_STATFS                 = 137 -	SYS_FSTATFS                = 138 -	SYS_SYSFS                  = 139 -	SYS_GETPRIORITY            = 140 -	SYS_SETPRIORITY            = 141 -	SYS_SCHED_SETPARAM         = 142 -	SYS_SCHED_GETPARAM         = 143 -	SYS_SCHED_SETSCHEDULER     = 144 -	SYS_SCHED_GETSCHEDULER     = 145 -	SYS_SCHED_GET_PRIORITY_MAX = 146 -	SYS_SCHED_GET_PRIORITY_MIN = 147 -	SYS_SCHED_RR_GET_INTERVAL  = 148 -	SYS_MLOCK                  = 149 -	SYS_MUNLOCK                = 150 -	SYS_MLOCKALL               = 151 -	SYS_MUNLOCKALL             = 152 -	SYS_VHANGUP                = 153 -	SYS_MODIFY_LDT             = 154 -	SYS_PIVOT_ROOT             = 155 -	SYS__SYSCTL                = 156 -	SYS_PRCTL                  = 157 -	SYS_ARCH_PRCTL             = 158 -	SYS_ADJTIMEX               = 159 -	SYS_SETRLIMIT              = 160 -	SYS_CHROOT                 = 161 -	SYS_SYNC                   = 162 -	SYS_ACCT                   = 163 -	SYS_SETTIMEOFDAY           = 164 -	SYS_MOUNT                  = 165 -	SYS_UMOUNT2                = 166 -	SYS_SWAPON                 = 167 -	SYS_SWAPOFF                = 168 -	SYS_REBOOT                 = 169 -	SYS_SETHOSTNAME            = 170 -	SYS_SETDOMAINNAME          = 171 -	SYS_IOPL                   = 172 -	SYS_IOPERM                 = 173 -	SYS_CREATE_MODULE          = 174 -	SYS_INIT_MODULE            = 175 -	SYS_DELETE_MODULE          = 176 -	SYS_GET_KERNEL_SYMS        = 177 -	SYS_QUERY_MODULE           = 178 -	SYS_QUOTACTL               = 179 -	SYS_NFSSERVCTL             = 180 -	SYS_GETPMSG                = 181 -	SYS_PUTPMSG                = 182 -	SYS_AFS_SYSCALL            = 183 -	SYS_TUXCALL                = 184 -	SYS_SECURITY               = 185 -	SYS_GETTID                 = 186 -	SYS_READAHEAD              = 187 -	SYS_SETXATTR               = 188 -	SYS_LSETXATTR              = 189 -	SYS_FSETXATTR              = 190 -	SYS_GETXATTR               = 191 -	SYS_LGETXATTR              = 192 -	SYS_FGETXATTR              = 193 -	SYS_LISTXATTR              = 194 -	SYS_LLISTXATTR             = 195 -	SYS_FLISTXATTR             = 196 -	SYS_REMOVEXATTR            = 197 -	SYS_LREMOVEXATTR           = 198 -	SYS_FREMOVEXATTR           = 199 -	SYS_TKILL                  = 200 -	SYS_TIME                   = 201 -	SYS_FUTEX                  = 202 -	SYS_SCHED_SETAFFINITY      = 203 -	SYS_SCHED_GETAFFINITY      = 204 -	SYS_SET_THREAD_AREA        = 205 -	SYS_IO_SETUP               = 206 -	SYS_IO_DESTROY             = 207 -	SYS_IO_GETEVENTS           = 208 -	SYS_IO_SUBMIT              = 209 -	SYS_IO_CANCEL              = 210 -	SYS_GET_THREAD_AREA        = 211 -	SYS_LOOKUP_DCOOKIE         = 212 -	SYS_EPOLL_CREATE           = 213 -	SYS_EPOLL_CTL_OLD          = 214 -	SYS_EPOLL_WAIT_OLD         = 215 -	SYS_REMAP_FILE_PAGES       = 216 -	SYS_GETDENTS64             = 217 -	SYS_SET_TID_ADDRESS        = 218 -	SYS_RESTART_SYSCALL        = 219 -	SYS_SEMTIMEDOP             = 220 -	SYS_FADVISE64              = 221 -	SYS_TIMER_CREATE           = 222 -	SYS_TIMER_SETTIME          = 223 -	SYS_TIMER_GETTIME          = 224 -	SYS_TIMER_GETOVERRUN       = 225 -	SYS_TIMER_DELETE           = 226 -	SYS_CLOCK_SETTIME          = 227 -	SYS_CLOCK_GETTIME          = 228 -	SYS_CLOCK_GETRES           = 229 -	SYS_CLOCK_NANOSLEEP        = 230 -	SYS_EXIT_GROUP             = 231 -	SYS_EPOLL_WAIT             = 232 -	SYS_EPOLL_CTL              = 233 -	SYS_TGKILL                 = 234 -	SYS_UTIMES                 = 235 -	SYS_VSERVER                = 236 -	SYS_MBIND                  = 237 -	SYS_SET_MEMPOLICY          = 238 -	SYS_GET_MEMPOLICY          = 239 -	SYS_MQ_OPEN                = 240 -	SYS_MQ_UNLINK              = 241 -	SYS_MQ_TIMEDSEND           = 242 -	SYS_MQ_TIMEDRECEIVE        = 243 -	SYS_MQ_NOTIFY              = 244 -	SYS_MQ_GETSETATTR          = 245 -	SYS_KEXEC_LOAD             = 246 -	SYS_WAITID                 = 247 -	SYS_ADD_KEY                = 248 -	SYS_REQUEST_KEY            = 249 -	SYS_KEYCTL                 = 250 -	SYS_IOPRIO_SET             = 251 -	SYS_IOPRIO_GET             = 252 -	SYS_INOTIFY_INIT           = 253 -	SYS_INOTIFY_ADD_WATCH      = 254 -	SYS_INOTIFY_RM_WATCH       = 255 -	SYS_MIGRATE_PAGES          = 256 -	SYS_OPENAT                 = 257 -	SYS_MKDIRAT                = 258 -	SYS_MKNODAT                = 259 -	SYS_FCHOWNAT               = 260 -	SYS_FUTIMESAT              = 261 -	SYS_NEWFSTATAT             = 262 -	SYS_UNLINKAT               = 263 -	SYS_RENAMEAT               = 264 -	SYS_LINKAT                 = 265 -	SYS_SYMLINKAT              = 266 -	SYS_READLINKAT             = 267 -	SYS_FCHMODAT               = 268 -	SYS_FACCESSAT              = 269 -	SYS_PSELECT6               = 270 -	SYS_PPOLL                  = 271 -	SYS_UNSHARE                = 272 -	SYS_SET_ROBUST_LIST        = 273 -	SYS_GET_ROBUST_LIST        = 274 -	SYS_SPLICE                 = 275 -	SYS_TEE                    = 276 -	SYS_SYNC_FILE_RANGE        = 277 -	SYS_VMSPLICE               = 278 -	SYS_MOVE_PAGES             = 279 -	SYS_UTIMENSAT              = 280 -	SYS_EPOLL_PWAIT            = 281 -	SYS_SIGNALFD               = 282 -	SYS_TIMERFD_CREATE         = 283 -	SYS_EVENTFD                = 284 -	SYS_FALLOCATE              = 285 -	SYS_TIMERFD_SETTIME        = 286 -	SYS_TIMERFD_GETTIME        = 287 -	SYS_ACCEPT4                = 288 -	SYS_SIGNALFD4              = 289 -	SYS_EVENTFD2               = 290 -	SYS_EPOLL_CREATE1          = 291 -	SYS_DUP3                   = 292 -	SYS_PIPE2                  = 293 -	SYS_INOTIFY_INIT1          = 294 -	SYS_PREADV                 = 295 -	SYS_PWRITEV                = 296 -	SYS_RT_TGSIGQUEUEINFO      = 297 -	SYS_PERF_EVENT_OPEN        = 298 -	SYS_RECVMMSG               = 299 -	SYS_FANOTIFY_INIT          = 300 -	SYS_FANOTIFY_MARK          = 301 -	SYS_PRLIMIT64              = 302 -	SYS_NAME_TO_HANDLE_AT      = 303 -	SYS_OPEN_BY_HANDLE_AT      = 304 -	SYS_CLOCK_ADJTIME          = 305 -	SYS_SYNCFS                 = 306 -	SYS_SENDMMSG               = 307 -	SYS_SETNS                  = 308 -	SYS_GETCPU                 = 309 -	SYS_PROCESS_VM_READV       = 310 -	SYS_PROCESS_VM_WRITEV      = 311 -	SYS_KCMP                   = 312 -	SYS_FINIT_MODULE           = 313 -	SYS_SCHED_SETATTR          = 314 -	SYS_SCHED_GETATTR          = 315 -	SYS_RENAMEAT2              = 316 -	SYS_SECCOMP                = 317 -	SYS_GETRANDOM              = 318 -	SYS_MEMFD_CREATE           = 319 -	SYS_KEXEC_FILE_LOAD        = 320 -	SYS_BPF                    = 321 -	SYS_EXECVEAT               = 322 -	SYS_USERFAULTFD            = 323 -	SYS_MEMBARRIER             = 324 -	SYS_MLOCK2                 = 325 -	SYS_COPY_FILE_RANGE        = 326 -	SYS_PREADV2                = 327 -	SYS_PWRITEV2               = 328 -	SYS_PKEY_MPROTECT          = 329 -	SYS_PKEY_ALLOC             = 330 -	SYS_PKEY_FREE              = 331 -	SYS_STATX                  = 332 -	SYS_IO_PGETEVENTS          = 333 -	SYS_RSEQ                   = 334 -	SYS_PIDFD_SEND_SIGNAL      = 424 -	SYS_IO_URING_SETUP         = 425 -	SYS_IO_URING_ENTER         = 426 -	SYS_IO_URING_REGISTER      = 427 -	SYS_OPEN_TREE              = 428 -	SYS_MOVE_MOUNT             = 429 -	SYS_FSOPEN                 = 430 -	SYS_FSCONFIG               = 431 -	SYS_FSMOUNT                = 432 -	SYS_FSPICK                 = 433 -	SYS_PIDFD_OPEN             = 434 -	SYS_CLONE3                 = 435 -	SYS_CLOSE_RANGE            = 436 -	SYS_OPENAT2                = 437 -	SYS_PIDFD_GETFD            = 438 -	SYS_FACCESSAT2             = 439 -	SYS_PROCESS_MADVISE        = 440 -	SYS_EPOLL_PWAIT2           = 441 -	SYS_MOUNT_SETATTR          = 442 +	SYS_READ                    = 0 +	SYS_WRITE                   = 1 +	SYS_OPEN                    = 2 +	SYS_CLOSE                   = 3 +	SYS_STAT                    = 4 +	SYS_FSTAT                   = 5 +	SYS_LSTAT                   = 6 +	SYS_POLL                    = 7 +	SYS_LSEEK                   = 8 +	SYS_MMAP                    = 9 +	SYS_MPROTECT                = 10 +	SYS_MUNMAP                  = 11 +	SYS_BRK                     = 12 +	SYS_RT_SIGACTION            = 13 +	SYS_RT_SIGPROCMASK          = 14 +	SYS_RT_SIGRETURN            = 15 +	SYS_IOCTL                   = 16 +	SYS_PREAD64                 = 17 +	SYS_PWRITE64                = 18 +	SYS_READV                   = 19 +	SYS_WRITEV                  = 20 +	SYS_ACCESS                  = 21 +	SYS_PIPE                    = 22 +	SYS_SELECT                  = 23 +	SYS_SCHED_YIELD             = 24 +	SYS_MREMAP                  = 25 +	SYS_MSYNC                   = 26 +	SYS_MINCORE                 = 27 +	SYS_MADVISE                 = 28 +	SYS_SHMGET                  = 29 +	SYS_SHMAT                   = 30 +	SYS_SHMCTL                  = 31 +	SYS_DUP                     = 32 +	SYS_DUP2                    = 33 +	SYS_PAUSE                   = 34 +	SYS_NANOSLEEP               = 35 +	SYS_GETITIMER               = 36 +	SYS_ALARM                   = 37 +	SYS_SETITIMER               = 38 +	SYS_GETPID                  = 39 +	SYS_SENDFILE                = 40 +	SYS_SOCKET                  = 41 +	SYS_CONNECT                 = 42 +	SYS_ACCEPT                  = 43 +	SYS_SENDTO                  = 44 +	SYS_RECVFROM                = 45 +	SYS_SENDMSG                 = 46 +	SYS_RECVMSG                 = 47 +	SYS_SHUTDOWN                = 48 +	SYS_BIND                    = 49 +	SYS_LISTEN                  = 50 +	SYS_GETSOCKNAME             = 51 +	SYS_GETPEERNAME             = 52 +	SYS_SOCKETPAIR              = 53 +	SYS_SETSOCKOPT              = 54 +	SYS_GETSOCKOPT              = 55 +	SYS_CLONE                   = 56 +	SYS_FORK                    = 57 +	SYS_VFORK                   = 58 +	SYS_EXECVE                  = 59 +	SYS_EXIT                    = 60 +	SYS_WAIT4                   = 61 +	SYS_KILL                    = 62 +	SYS_UNAME                   = 63 +	SYS_SEMGET                  = 64 +	SYS_SEMOP                   = 65 +	SYS_SEMCTL                  = 66 +	SYS_SHMDT                   = 67 +	SYS_MSGGET                  = 68 +	SYS_MSGSND                  = 69 +	SYS_MSGRCV                  = 70 +	SYS_MSGCTL                  = 71 +	SYS_FCNTL                   = 72 +	SYS_FLOCK                   = 73 +	SYS_FSYNC                   = 74 +	SYS_FDATASYNC               = 75 +	SYS_TRUNCATE                = 76 +	SYS_FTRUNCATE               = 77 +	SYS_GETDENTS                = 78 +	SYS_GETCWD                  = 79 +	SYS_CHDIR                   = 80 +	SYS_FCHDIR                  = 81 +	SYS_RENAME                  = 82 +	SYS_MKDIR                   = 83 +	SYS_RMDIR                   = 84 +	SYS_CREAT                   = 85 +	SYS_LINK                    = 86 +	SYS_UNLINK                  = 87 +	SYS_SYMLINK                 = 88 +	SYS_READLINK                = 89 +	SYS_CHMOD                   = 90 +	SYS_FCHMOD                  = 91 +	SYS_CHOWN                   = 92 +	SYS_FCHOWN                  = 93 +	SYS_LCHOWN                  = 94 +	SYS_UMASK                   = 95 +	SYS_GETTIMEOFDAY            = 96 +	SYS_GETRLIMIT               = 97 +	SYS_GETRUSAGE               = 98 +	SYS_SYSINFO                 = 99 +	SYS_TIMES                   = 100 +	SYS_PTRACE                  = 101 +	SYS_GETUID                  = 102 +	SYS_SYSLOG                  = 103 +	SYS_GETGID                  = 104 +	SYS_SETUID                  = 105 +	SYS_SETGID                  = 106 +	SYS_GETEUID                 = 107 +	SYS_GETEGID                 = 108 +	SYS_SETPGID                 = 109 +	SYS_GETPPID                 = 110 +	SYS_GETPGRP                 = 111 +	SYS_SETSID                  = 112 +	SYS_SETREUID                = 113 +	SYS_SETREGID                = 114 +	SYS_GETGROUPS               = 115 +	SYS_SETGROUPS               = 116 +	SYS_SETRESUID               = 117 +	SYS_GETRESUID               = 118 +	SYS_SETRESGID               = 119 +	SYS_GETRESGID               = 120 +	SYS_GETPGID                 = 121 +	SYS_SETFSUID                = 122 +	SYS_SETFSGID                = 123 +	SYS_GETSID                  = 124 +	SYS_CAPGET                  = 125 +	SYS_CAPSET                  = 126 +	SYS_RT_SIGPENDING           = 127 +	SYS_RT_SIGTIMEDWAIT         = 128 +	SYS_RT_SIGQUEUEINFO         = 129 +	SYS_RT_SIGSUSPEND           = 130 +	SYS_SIGALTSTACK             = 131 +	SYS_UTIME                   = 132 +	SYS_MKNOD                   = 133 +	SYS_USELIB                  = 134 +	SYS_PERSONALITY             = 135 +	SYS_USTAT                   = 136 +	SYS_STATFS                  = 137 +	SYS_FSTATFS                 = 138 +	SYS_SYSFS                   = 139 +	SYS_GETPRIORITY             = 140 +	SYS_SETPRIORITY             = 141 +	SYS_SCHED_SETPARAM          = 142 +	SYS_SCHED_GETPARAM          = 143 +	SYS_SCHED_SETSCHEDULER      = 144 +	SYS_SCHED_GETSCHEDULER      = 145 +	SYS_SCHED_GET_PRIORITY_MAX  = 146 +	SYS_SCHED_GET_PRIORITY_MIN  = 147 +	SYS_SCHED_RR_GET_INTERVAL   = 148 +	SYS_MLOCK                   = 149 +	SYS_MUNLOCK                 = 150 +	SYS_MLOCKALL                = 151 +	SYS_MUNLOCKALL              = 152 +	SYS_VHANGUP                 = 153 +	SYS_MODIFY_LDT              = 154 +	SYS_PIVOT_ROOT              = 155 +	SYS__SYSCTL                 = 156 +	SYS_PRCTL                   = 157 +	SYS_ARCH_PRCTL              = 158 +	SYS_ADJTIMEX                = 159 +	SYS_SETRLIMIT               = 160 +	SYS_CHROOT                  = 161 +	SYS_SYNC                    = 162 +	SYS_ACCT                    = 163 +	SYS_SETTIMEOFDAY            = 164 +	SYS_MOUNT                   = 165 +	SYS_UMOUNT2                 = 166 +	SYS_SWAPON                  = 167 +	SYS_SWAPOFF                 = 168 +	SYS_REBOOT                  = 169 +	SYS_SETHOSTNAME             = 170 +	SYS_SETDOMAINNAME           = 171 +	SYS_IOPL                    = 172 +	SYS_IOPERM                  = 173 +	SYS_CREATE_MODULE           = 174 +	SYS_INIT_MODULE             = 175 +	SYS_DELETE_MODULE           = 176 +	SYS_GET_KERNEL_SYMS         = 177 +	SYS_QUERY_MODULE            = 178 +	SYS_QUOTACTL                = 179 +	SYS_NFSSERVCTL              = 180 +	SYS_GETPMSG                 = 181 +	SYS_PUTPMSG                 = 182 +	SYS_AFS_SYSCALL             = 183 +	SYS_TUXCALL                 = 184 +	SYS_SECURITY                = 185 +	SYS_GETTID                  = 186 +	SYS_READAHEAD               = 187 +	SYS_SETXATTR                = 188 +	SYS_LSETXATTR               = 189 +	SYS_FSETXATTR               = 190 +	SYS_GETXATTR                = 191 +	SYS_LGETXATTR               = 192 +	SYS_FGETXATTR               = 193 +	SYS_LISTXATTR               = 194 +	SYS_LLISTXATTR              = 195 +	SYS_FLISTXATTR              = 196 +	SYS_REMOVEXATTR             = 197 +	SYS_LREMOVEXATTR            = 198 +	SYS_FREMOVEXATTR            = 199 +	SYS_TKILL                   = 200 +	SYS_TIME                    = 201 +	SYS_FUTEX                   = 202 +	SYS_SCHED_SETAFFINITY       = 203 +	SYS_SCHED_GETAFFINITY       = 204 +	SYS_SET_THREAD_AREA         = 205 +	SYS_IO_SETUP                = 206 +	SYS_IO_DESTROY              = 207 +	SYS_IO_GETEVENTS            = 208 +	SYS_IO_SUBMIT               = 209 +	SYS_IO_CANCEL               = 210 +	SYS_GET_THREAD_AREA         = 211 +	SYS_LOOKUP_DCOOKIE          = 212 +	SYS_EPOLL_CREATE            = 213 +	SYS_EPOLL_CTL_OLD           = 214 +	SYS_EPOLL_WAIT_OLD          = 215 +	SYS_REMAP_FILE_PAGES        = 216 +	SYS_GETDENTS64              = 217 +	SYS_SET_TID_ADDRESS         = 218 +	SYS_RESTART_SYSCALL         = 219 +	SYS_SEMTIMEDOP              = 220 +	SYS_FADVISE64               = 221 +	SYS_TIMER_CREATE            = 222 +	SYS_TIMER_SETTIME           = 223 +	SYS_TIMER_GETTIME           = 224 +	SYS_TIMER_GETOVERRUN        = 225 +	SYS_TIMER_DELETE            = 226 +	SYS_CLOCK_SETTIME           = 227 +	SYS_CLOCK_GETTIME           = 228 +	SYS_CLOCK_GETRES            = 229 +	SYS_CLOCK_NANOSLEEP         = 230 +	SYS_EXIT_GROUP              = 231 +	SYS_EPOLL_WAIT              = 232 +	SYS_EPOLL_CTL               = 233 +	SYS_TGKILL                  = 234 +	SYS_UTIMES                  = 235 +	SYS_VSERVER                 = 236 +	SYS_MBIND                   = 237 +	SYS_SET_MEMPOLICY           = 238 +	SYS_GET_MEMPOLICY           = 239 +	SYS_MQ_OPEN                 = 240 +	SYS_MQ_UNLINK               = 241 +	SYS_MQ_TIMEDSEND            = 242 +	SYS_MQ_TIMEDRECEIVE         = 243 +	SYS_MQ_NOTIFY               = 244 +	SYS_MQ_GETSETATTR           = 245 +	SYS_KEXEC_LOAD              = 246 +	SYS_WAITID                  = 247 +	SYS_ADD_KEY                 = 248 +	SYS_REQUEST_KEY             = 249 +	SYS_KEYCTL                  = 250 +	SYS_IOPRIO_SET              = 251 +	SYS_IOPRIO_GET              = 252 +	SYS_INOTIFY_INIT            = 253 +	SYS_INOTIFY_ADD_WATCH       = 254 +	SYS_INOTIFY_RM_WATCH        = 255 +	SYS_MIGRATE_PAGES           = 256 +	SYS_OPENAT                  = 257 +	SYS_MKDIRAT                 = 258 +	SYS_MKNODAT                 = 259 +	SYS_FCHOWNAT                = 260 +	SYS_FUTIMESAT               = 261 +	SYS_NEWFSTATAT              = 262 +	SYS_UNLINKAT                = 263 +	SYS_RENAMEAT                = 264 +	SYS_LINKAT                  = 265 +	SYS_SYMLINKAT               = 266 +	SYS_READLINKAT              = 267 +	SYS_FCHMODAT                = 268 +	SYS_FACCESSAT               = 269 +	SYS_PSELECT6                = 270 +	SYS_PPOLL                   = 271 +	SYS_UNSHARE                 = 272 +	SYS_SET_ROBUST_LIST         = 273 +	SYS_GET_ROBUST_LIST         = 274 +	SYS_SPLICE                  = 275 +	SYS_TEE                     = 276 +	SYS_SYNC_FILE_RANGE         = 277 +	SYS_VMSPLICE                = 278 +	SYS_MOVE_PAGES              = 279 +	SYS_UTIMENSAT               = 280 +	SYS_EPOLL_PWAIT             = 281 +	SYS_SIGNALFD                = 282 +	SYS_TIMERFD_CREATE          = 283 +	SYS_EVENTFD                 = 284 +	SYS_FALLOCATE               = 285 +	SYS_TIMERFD_SETTIME         = 286 +	SYS_TIMERFD_GETTIME         = 287 +	SYS_ACCEPT4                 = 288 +	SYS_SIGNALFD4               = 289 +	SYS_EVENTFD2                = 290 +	SYS_EPOLL_CREATE1           = 291 +	SYS_DUP3                    = 292 +	SYS_PIPE2                   = 293 +	SYS_INOTIFY_INIT1           = 294 +	SYS_PREADV                  = 295 +	SYS_PWRITEV                 = 296 +	SYS_RT_TGSIGQUEUEINFO       = 297 +	SYS_PERF_EVENT_OPEN         = 298 +	SYS_RECVMMSG                = 299 +	SYS_FANOTIFY_INIT           = 300 +	SYS_FANOTIFY_MARK           = 301 +	SYS_PRLIMIT64               = 302 +	SYS_NAME_TO_HANDLE_AT       = 303 +	SYS_OPEN_BY_HANDLE_AT       = 304 +	SYS_CLOCK_ADJTIME           = 305 +	SYS_SYNCFS                  = 306 +	SYS_SENDMMSG                = 307 +	SYS_SETNS                   = 308 +	SYS_GETCPU                  = 309 +	SYS_PROCESS_VM_READV        = 310 +	SYS_PROCESS_VM_WRITEV       = 311 +	SYS_KCMP                    = 312 +	SYS_FINIT_MODULE            = 313 +	SYS_SCHED_SETATTR           = 314 +	SYS_SCHED_GETATTR           = 315 +	SYS_RENAMEAT2               = 316 +	SYS_SECCOMP                 = 317 +	SYS_GETRANDOM               = 318 +	SYS_MEMFD_CREATE            = 319 +	SYS_KEXEC_FILE_LOAD         = 320 +	SYS_BPF                     = 321 +	SYS_EXECVEAT                = 322 +	SYS_USERFAULTFD             = 323 +	SYS_MEMBARRIER              = 324 +	SYS_MLOCK2                  = 325 +	SYS_COPY_FILE_RANGE         = 326 +	SYS_PREADV2                 = 327 +	SYS_PWRITEV2                = 328 +	SYS_PKEY_MPROTECT           = 329 +	SYS_PKEY_ALLOC              = 330 +	SYS_PKEY_FREE               = 331 +	SYS_STATX                   = 332 +	SYS_IO_PGETEVENTS           = 333 +	SYS_RSEQ                    = 334 +	SYS_PIDFD_SEND_SIGNAL       = 424 +	SYS_IO_URING_SETUP          = 425 +	SYS_IO_URING_ENTER          = 426 +	SYS_IO_URING_REGISTER       = 427 +	SYS_OPEN_TREE               = 428 +	SYS_MOVE_MOUNT              = 429 +	SYS_FSOPEN                  = 430 +	SYS_FSCONFIG                = 431 +	SYS_FSMOUNT                 = 432 +	SYS_FSPICK                  = 433 +	SYS_PIDFD_OPEN              = 434 +	SYS_CLONE3                  = 435 +	SYS_CLOSE_RANGE             = 436 +	SYS_OPENAT2                 = 437 +	SYS_PIDFD_GETFD             = 438 +	SYS_FACCESSAT2              = 439 +	SYS_PROCESS_MADVISE         = 440 +	SYS_EPOLL_PWAIT2            = 441 +	SYS_MOUNT_SETATTR           = 442 +	SYS_LANDLOCK_CREATE_RULESET = 444 +	SYS_LANDLOCK_ADD_RULE       = 445 +	SYS_LANDLOCK_RESTRICT_SELF  = 446  ) diff --git a/vendor/golang.org/x/sys/unix/zsysnum_linux_arm.go b/vendor/golang.org/x/sys/unix/zsysnum_linux_arm.go index 3b1c10513..0e6ebfef0 100644 --- a/vendor/golang.org/x/sys/unix/zsysnum_linux_arm.go +++ b/vendor/golang.org/x/sys/unix/zsysnum_linux_arm.go @@ -403,4 +403,7 @@ const (  	SYS_PROCESS_MADVISE              = 440  	SYS_EPOLL_PWAIT2                 = 441  	SYS_MOUNT_SETATTR                = 442 +	SYS_LANDLOCK_CREATE_RULESET      = 444 +	SYS_LANDLOCK_ADD_RULE            = 445 +	SYS_LANDLOCK_RESTRICT_SELF       = 446  ) diff --git a/vendor/golang.org/x/sys/unix/zsysnum_linux_arm64.go b/vendor/golang.org/x/sys/unix/zsysnum_linux_arm64.go index 3198adcf7..cd2a3ef41 100644 --- a/vendor/golang.org/x/sys/unix/zsysnum_linux_arm64.go +++ b/vendor/golang.org/x/sys/unix/zsysnum_linux_arm64.go @@ -7,303 +7,306 @@  package unix  const ( -	SYS_IO_SETUP               = 0 -	SYS_IO_DESTROY             = 1 -	SYS_IO_SUBMIT              = 2 -	SYS_IO_CANCEL              = 3 -	SYS_IO_GETEVENTS           = 4 -	SYS_SETXATTR               = 5 -	SYS_LSETXATTR              = 6 -	SYS_FSETXATTR              = 7 -	SYS_GETXATTR               = 8 -	SYS_LGETXATTR              = 9 -	SYS_FGETXATTR              = 10 -	SYS_LISTXATTR              = 11 -	SYS_LLISTXATTR             = 12 -	SYS_FLISTXATTR             = 13 -	SYS_REMOVEXATTR            = 14 -	SYS_LREMOVEXATTR           = 15 -	SYS_FREMOVEXATTR           = 16 -	SYS_GETCWD                 = 17 -	SYS_LOOKUP_DCOOKIE         = 18 -	SYS_EVENTFD2               = 19 -	SYS_EPOLL_CREATE1          = 20 -	SYS_EPOLL_CTL              = 21 -	SYS_EPOLL_PWAIT            = 22 -	SYS_DUP                    = 23 -	SYS_DUP3                   = 24 -	SYS_FCNTL                  = 25 -	SYS_INOTIFY_INIT1          = 26 -	SYS_INOTIFY_ADD_WATCH      = 27 -	SYS_INOTIFY_RM_WATCH       = 28 -	SYS_IOCTL                  = 29 -	SYS_IOPRIO_SET             = 30 -	SYS_IOPRIO_GET             = 31 -	SYS_FLOCK                  = 32 -	SYS_MKNODAT                = 33 -	SYS_MKDIRAT                = 34 -	SYS_UNLINKAT               = 35 -	SYS_SYMLINKAT              = 36 -	SYS_LINKAT                 = 37 -	SYS_RENAMEAT               = 38 -	SYS_UMOUNT2                = 39 -	SYS_MOUNT                  = 40 -	SYS_PIVOT_ROOT             = 41 -	SYS_NFSSERVCTL             = 42 -	SYS_STATFS                 = 43 -	SYS_FSTATFS                = 44 -	SYS_TRUNCATE               = 45 -	SYS_FTRUNCATE              = 46 -	SYS_FALLOCATE              = 47 -	SYS_FACCESSAT              = 48 -	SYS_CHDIR                  = 49 -	SYS_FCHDIR                 = 50 -	SYS_CHROOT                 = 51 -	SYS_FCHMOD                 = 52 -	SYS_FCHMODAT               = 53 -	SYS_FCHOWNAT               = 54 -	SYS_FCHOWN                 = 55 -	SYS_OPENAT                 = 56 -	SYS_CLOSE                  = 57 -	SYS_VHANGUP                = 58 -	SYS_PIPE2                  = 59 -	SYS_QUOTACTL               = 60 -	SYS_GETDENTS64             = 61 -	SYS_LSEEK                  = 62 -	SYS_READ                   = 63 -	SYS_WRITE                  = 64 -	SYS_READV                  = 65 -	SYS_WRITEV                 = 66 -	SYS_PREAD64                = 67 -	SYS_PWRITE64               = 68 -	SYS_PREADV                 = 69 -	SYS_PWRITEV                = 70 -	SYS_SENDFILE               = 71 -	SYS_PSELECT6               = 72 -	SYS_PPOLL                  = 73 -	SYS_SIGNALFD4              = 74 -	SYS_VMSPLICE               = 75 -	SYS_SPLICE                 = 76 -	SYS_TEE                    = 77 -	SYS_READLINKAT             = 78 -	SYS_FSTATAT                = 79 -	SYS_FSTAT                  = 80 -	SYS_SYNC                   = 81 -	SYS_FSYNC                  = 82 -	SYS_FDATASYNC              = 83 -	SYS_SYNC_FILE_RANGE        = 84 -	SYS_TIMERFD_CREATE         = 85 -	SYS_TIMERFD_SETTIME        = 86 -	SYS_TIMERFD_GETTIME        = 87 -	SYS_UTIMENSAT              = 88 -	SYS_ACCT                   = 89 -	SYS_CAPGET                 = 90 -	SYS_CAPSET                 = 91 -	SYS_PERSONALITY            = 92 -	SYS_EXIT                   = 93 -	SYS_EXIT_GROUP             = 94 -	SYS_WAITID                 = 95 -	SYS_SET_TID_ADDRESS        = 96 -	SYS_UNSHARE                = 97 -	SYS_FUTEX                  = 98 -	SYS_SET_ROBUST_LIST        = 99 -	SYS_GET_ROBUST_LIST        = 100 -	SYS_NANOSLEEP              = 101 -	SYS_GETITIMER              = 102 -	SYS_SETITIMER              = 103 -	SYS_KEXEC_LOAD             = 104 -	SYS_INIT_MODULE            = 105 -	SYS_DELETE_MODULE          = 106 -	SYS_TIMER_CREATE           = 107 -	SYS_TIMER_GETTIME          = 108 -	SYS_TIMER_GETOVERRUN       = 109 -	SYS_TIMER_SETTIME          = 110 -	SYS_TIMER_DELETE           = 111 -	SYS_CLOCK_SETTIME          = 112 -	SYS_CLOCK_GETTIME          = 113 -	SYS_CLOCK_GETRES           = 114 -	SYS_CLOCK_NANOSLEEP        = 115 -	SYS_SYSLOG                 = 116 -	SYS_PTRACE                 = 117 -	SYS_SCHED_SETPARAM         = 118 -	SYS_SCHED_SETSCHEDULER     = 119 -	SYS_SCHED_GETSCHEDULER     = 120 -	SYS_SCHED_GETPARAM         = 121 -	SYS_SCHED_SETAFFINITY      = 122 -	SYS_SCHED_GETAFFINITY      = 123 -	SYS_SCHED_YIELD            = 124 -	SYS_SCHED_GET_PRIORITY_MAX = 125 -	SYS_SCHED_GET_PRIORITY_MIN = 126 -	SYS_SCHED_RR_GET_INTERVAL  = 127 -	SYS_RESTART_SYSCALL        = 128 -	SYS_KILL                   = 129 -	SYS_TKILL                  = 130 -	SYS_TGKILL                 = 131 -	SYS_SIGALTSTACK            = 132 -	SYS_RT_SIGSUSPEND          = 133 -	SYS_RT_SIGACTION           = 134 -	SYS_RT_SIGPROCMASK         = 135 -	SYS_RT_SIGPENDING          = 136 -	SYS_RT_SIGTIMEDWAIT        = 137 -	SYS_RT_SIGQUEUEINFO        = 138 -	SYS_RT_SIGRETURN           = 139 -	SYS_SETPRIORITY            = 140 -	SYS_GETPRIORITY            = 141 -	SYS_REBOOT                 = 142 -	SYS_SETREGID               = 143 -	SYS_SETGID                 = 144 -	SYS_SETREUID               = 145 -	SYS_SETUID                 = 146 -	SYS_SETRESUID              = 147 -	SYS_GETRESUID              = 148 -	SYS_SETRESGID              = 149 -	SYS_GETRESGID              = 150 -	SYS_SETFSUID               = 151 -	SYS_SETFSGID               = 152 -	SYS_TIMES                  = 153 -	SYS_SETPGID                = 154 -	SYS_GETPGID                = 155 -	SYS_GETSID                 = 156 -	SYS_SETSID                 = 157 -	SYS_GETGROUPS              = 158 -	SYS_SETGROUPS              = 159 -	SYS_UNAME                  = 160 -	SYS_SETHOSTNAME            = 161 -	SYS_SETDOMAINNAME          = 162 -	SYS_GETRLIMIT              = 163 -	SYS_SETRLIMIT              = 164 -	SYS_GETRUSAGE              = 165 -	SYS_UMASK                  = 166 -	SYS_PRCTL                  = 167 -	SYS_GETCPU                 = 168 -	SYS_GETTIMEOFDAY           = 169 -	SYS_SETTIMEOFDAY           = 170 -	SYS_ADJTIMEX               = 171 -	SYS_GETPID                 = 172 -	SYS_GETPPID                = 173 -	SYS_GETUID                 = 174 -	SYS_GETEUID                = 175 -	SYS_GETGID                 = 176 -	SYS_GETEGID                = 177 -	SYS_GETTID                 = 178 -	SYS_SYSINFO                = 179 -	SYS_MQ_OPEN                = 180 -	SYS_MQ_UNLINK              = 181 -	SYS_MQ_TIMEDSEND           = 182 -	SYS_MQ_TIMEDRECEIVE        = 183 -	SYS_MQ_NOTIFY              = 184 -	SYS_MQ_GETSETATTR          = 185 -	SYS_MSGGET                 = 186 -	SYS_MSGCTL                 = 187 -	SYS_MSGRCV                 = 188 -	SYS_MSGSND                 = 189 -	SYS_SEMGET                 = 190 -	SYS_SEMCTL                 = 191 -	SYS_SEMTIMEDOP             = 192 -	SYS_SEMOP                  = 193 -	SYS_SHMGET                 = 194 -	SYS_SHMCTL                 = 195 -	SYS_SHMAT                  = 196 -	SYS_SHMDT                  = 197 -	SYS_SOCKET                 = 198 -	SYS_SOCKETPAIR             = 199 -	SYS_BIND                   = 200 -	SYS_LISTEN                 = 201 -	SYS_ACCEPT                 = 202 -	SYS_CONNECT                = 203 -	SYS_GETSOCKNAME            = 204 -	SYS_GETPEERNAME            = 205 -	SYS_SENDTO                 = 206 -	SYS_RECVFROM               = 207 -	SYS_SETSOCKOPT             = 208 -	SYS_GETSOCKOPT             = 209 -	SYS_SHUTDOWN               = 210 -	SYS_SENDMSG                = 211 -	SYS_RECVMSG                = 212 -	SYS_READAHEAD              = 213 -	SYS_BRK                    = 214 -	SYS_MUNMAP                 = 215 -	SYS_MREMAP                 = 216 -	SYS_ADD_KEY                = 217 -	SYS_REQUEST_KEY            = 218 -	SYS_KEYCTL                 = 219 -	SYS_CLONE                  = 220 -	SYS_EXECVE                 = 221 -	SYS_MMAP                   = 222 -	SYS_FADVISE64              = 223 -	SYS_SWAPON                 = 224 -	SYS_SWAPOFF                = 225 -	SYS_MPROTECT               = 226 -	SYS_MSYNC                  = 227 -	SYS_MLOCK                  = 228 -	SYS_MUNLOCK                = 229 -	SYS_MLOCKALL               = 230 -	SYS_MUNLOCKALL             = 231 -	SYS_MINCORE                = 232 -	SYS_MADVISE                = 233 -	SYS_REMAP_FILE_PAGES       = 234 -	SYS_MBIND                  = 235 -	SYS_GET_MEMPOLICY          = 236 -	SYS_SET_MEMPOLICY          = 237 -	SYS_MIGRATE_PAGES          = 238 -	SYS_MOVE_PAGES             = 239 -	SYS_RT_TGSIGQUEUEINFO      = 240 -	SYS_PERF_EVENT_OPEN        = 241 -	SYS_ACCEPT4                = 242 -	SYS_RECVMMSG               = 243 -	SYS_ARCH_SPECIFIC_SYSCALL  = 244 -	SYS_WAIT4                  = 260 -	SYS_PRLIMIT64              = 261 -	SYS_FANOTIFY_INIT          = 262 -	SYS_FANOTIFY_MARK          = 263 -	SYS_NAME_TO_HANDLE_AT      = 264 -	SYS_OPEN_BY_HANDLE_AT      = 265 -	SYS_CLOCK_ADJTIME          = 266 -	SYS_SYNCFS                 = 267 -	SYS_SETNS                  = 268 -	SYS_SENDMMSG               = 269 -	SYS_PROCESS_VM_READV       = 270 -	SYS_PROCESS_VM_WRITEV      = 271 -	SYS_KCMP                   = 272 -	SYS_FINIT_MODULE           = 273 -	SYS_SCHED_SETATTR          = 274 -	SYS_SCHED_GETATTR          = 275 -	SYS_RENAMEAT2              = 276 -	SYS_SECCOMP                = 277 -	SYS_GETRANDOM              = 278 -	SYS_MEMFD_CREATE           = 279 -	SYS_BPF                    = 280 -	SYS_EXECVEAT               = 281 -	SYS_USERFAULTFD            = 282 -	SYS_MEMBARRIER             = 283 -	SYS_MLOCK2                 = 284 -	SYS_COPY_FILE_RANGE        = 285 -	SYS_PREADV2                = 286 -	SYS_PWRITEV2               = 287 -	SYS_PKEY_MPROTECT          = 288 -	SYS_PKEY_ALLOC             = 289 -	SYS_PKEY_FREE              = 290 -	SYS_STATX                  = 291 -	SYS_IO_PGETEVENTS          = 292 -	SYS_RSEQ                   = 293 -	SYS_KEXEC_FILE_LOAD        = 294 -	SYS_PIDFD_SEND_SIGNAL      = 424 -	SYS_IO_URING_SETUP         = 425 -	SYS_IO_URING_ENTER         = 426 -	SYS_IO_URING_REGISTER      = 427 -	SYS_OPEN_TREE              = 428 -	SYS_MOVE_MOUNT             = 429 -	SYS_FSOPEN                 = 430 -	SYS_FSCONFIG               = 431 -	SYS_FSMOUNT                = 432 -	SYS_FSPICK                 = 433 -	SYS_PIDFD_OPEN             = 434 -	SYS_CLONE3                 = 435 -	SYS_CLOSE_RANGE            = 436 -	SYS_OPENAT2                = 437 -	SYS_PIDFD_GETFD            = 438 -	SYS_FACCESSAT2             = 439 -	SYS_PROCESS_MADVISE        = 440 -	SYS_EPOLL_PWAIT2           = 441 -	SYS_MOUNT_SETATTR          = 442 +	SYS_IO_SETUP                = 0 +	SYS_IO_DESTROY              = 1 +	SYS_IO_SUBMIT               = 2 +	SYS_IO_CANCEL               = 3 +	SYS_IO_GETEVENTS            = 4 +	SYS_SETXATTR                = 5 +	SYS_LSETXATTR               = 6 +	SYS_FSETXATTR               = 7 +	SYS_GETXATTR                = 8 +	SYS_LGETXATTR               = 9 +	SYS_FGETXATTR               = 10 +	SYS_LISTXATTR               = 11 +	SYS_LLISTXATTR              = 12 +	SYS_FLISTXATTR              = 13 +	SYS_REMOVEXATTR             = 14 +	SYS_LREMOVEXATTR            = 15 +	SYS_FREMOVEXATTR            = 16 +	SYS_GETCWD                  = 17 +	SYS_LOOKUP_DCOOKIE          = 18 +	SYS_EVENTFD2                = 19 +	SYS_EPOLL_CREATE1           = 20 +	SYS_EPOLL_CTL               = 21 +	SYS_EPOLL_PWAIT             = 22 +	SYS_DUP                     = 23 +	SYS_DUP3                    = 24 +	SYS_FCNTL                   = 25 +	SYS_INOTIFY_INIT1           = 26 +	SYS_INOTIFY_ADD_WATCH       = 27 +	SYS_INOTIFY_RM_WATCH        = 28 +	SYS_IOCTL                   = 29 +	SYS_IOPRIO_SET              = 30 +	SYS_IOPRIO_GET              = 31 +	SYS_FLOCK                   = 32 +	SYS_MKNODAT                 = 33 +	SYS_MKDIRAT                 = 34 +	SYS_UNLINKAT                = 35 +	SYS_SYMLINKAT               = 36 +	SYS_LINKAT                  = 37 +	SYS_RENAMEAT                = 38 +	SYS_UMOUNT2                 = 39 +	SYS_MOUNT                   = 40 +	SYS_PIVOT_ROOT              = 41 +	SYS_NFSSERVCTL              = 42 +	SYS_STATFS                  = 43 +	SYS_FSTATFS                 = 44 +	SYS_TRUNCATE                = 45 +	SYS_FTRUNCATE               = 46 +	SYS_FALLOCATE               = 47 +	SYS_FACCESSAT               = 48 +	SYS_CHDIR                   = 49 +	SYS_FCHDIR                  = 50 +	SYS_CHROOT                  = 51 +	SYS_FCHMOD                  = 52 +	SYS_FCHMODAT                = 53 +	SYS_FCHOWNAT                = 54 +	SYS_FCHOWN                  = 55 +	SYS_OPENAT                  = 56 +	SYS_CLOSE                   = 57 +	SYS_VHANGUP                 = 58 +	SYS_PIPE2                   = 59 +	SYS_QUOTACTL                = 60 +	SYS_GETDENTS64              = 61 +	SYS_LSEEK                   = 62 +	SYS_READ                    = 63 +	SYS_WRITE                   = 64 +	SYS_READV                   = 65 +	SYS_WRITEV                  = 66 +	SYS_PREAD64                 = 67 +	SYS_PWRITE64                = 68 +	SYS_PREADV                  = 69 +	SYS_PWRITEV                 = 70 +	SYS_SENDFILE                = 71 +	SYS_PSELECT6                = 72 +	SYS_PPOLL                   = 73 +	SYS_SIGNALFD4               = 74 +	SYS_VMSPLICE                = 75 +	SYS_SPLICE                  = 76 +	SYS_TEE                     = 77 +	SYS_READLINKAT              = 78 +	SYS_FSTATAT                 = 79 +	SYS_FSTAT                   = 80 +	SYS_SYNC                    = 81 +	SYS_FSYNC                   = 82 +	SYS_FDATASYNC               = 83 +	SYS_SYNC_FILE_RANGE         = 84 +	SYS_TIMERFD_CREATE          = 85 +	SYS_TIMERFD_SETTIME         = 86 +	SYS_TIMERFD_GETTIME         = 87 +	SYS_UTIMENSAT               = 88 +	SYS_ACCT                    = 89 +	SYS_CAPGET                  = 90 +	SYS_CAPSET                  = 91 +	SYS_PERSONALITY             = 92 +	SYS_EXIT                    = 93 +	SYS_EXIT_GROUP              = 94 +	SYS_WAITID                  = 95 +	SYS_SET_TID_ADDRESS         = 96 +	SYS_UNSHARE                 = 97 +	SYS_FUTEX                   = 98 +	SYS_SET_ROBUST_LIST         = 99 +	SYS_GET_ROBUST_LIST         = 100 +	SYS_NANOSLEEP               = 101 +	SYS_GETITIMER               = 102 +	SYS_SETITIMER               = 103 +	SYS_KEXEC_LOAD              = 104 +	SYS_INIT_MODULE             = 105 +	SYS_DELETE_MODULE           = 106 +	SYS_TIMER_CREATE            = 107 +	SYS_TIMER_GETTIME           = 108 +	SYS_TIMER_GETOVERRUN        = 109 +	SYS_TIMER_SETTIME           = 110 +	SYS_TIMER_DELETE            = 111 +	SYS_CLOCK_SETTIME           = 112 +	SYS_CLOCK_GETTIME           = 113 +	SYS_CLOCK_GETRES            = 114 +	SYS_CLOCK_NANOSLEEP         = 115 +	SYS_SYSLOG                  = 116 +	SYS_PTRACE                  = 117 +	SYS_SCHED_SETPARAM          = 118 +	SYS_SCHED_SETSCHEDULER      = 119 +	SYS_SCHED_GETSCHEDULER      = 120 +	SYS_SCHED_GETPARAM          = 121 +	SYS_SCHED_SETAFFINITY       = 122 +	SYS_SCHED_GETAFFINITY       = 123 +	SYS_SCHED_YIELD             = 124 +	SYS_SCHED_GET_PRIORITY_MAX  = 125 +	SYS_SCHED_GET_PRIORITY_MIN  = 126 +	SYS_SCHED_RR_GET_INTERVAL   = 127 +	SYS_RESTART_SYSCALL         = 128 +	SYS_KILL                    = 129 +	SYS_TKILL                   = 130 +	SYS_TGKILL                  = 131 +	SYS_SIGALTSTACK             = 132 +	SYS_RT_SIGSUSPEND           = 133 +	SYS_RT_SIGACTION            = 134 +	SYS_RT_SIGPROCMASK          = 135 +	SYS_RT_SIGPENDING           = 136 +	SYS_RT_SIGTIMEDWAIT         = 137 +	SYS_RT_SIGQUEUEINFO         = 138 +	SYS_RT_SIGRETURN            = 139 +	SYS_SETPRIORITY             = 140 +	SYS_GETPRIORITY             = 141 +	SYS_REBOOT                  = 142 +	SYS_SETREGID                = 143 +	SYS_SETGID                  = 144 +	SYS_SETREUID                = 145 +	SYS_SETUID                  = 146 +	SYS_SETRESUID               = 147 +	SYS_GETRESUID               = 148 +	SYS_SETRESGID               = 149 +	SYS_GETRESGID               = 150 +	SYS_SETFSUID                = 151 +	SYS_SETFSGID                = 152 +	SYS_TIMES                   = 153 +	SYS_SETPGID                 = 154 +	SYS_GETPGID                 = 155 +	SYS_GETSID                  = 156 +	SYS_SETSID                  = 157 +	SYS_GETGROUPS               = 158 +	SYS_SETGROUPS               = 159 +	SYS_UNAME                   = 160 +	SYS_SETHOSTNAME             = 161 +	SYS_SETDOMAINNAME           = 162 +	SYS_GETRLIMIT               = 163 +	SYS_SETRLIMIT               = 164 +	SYS_GETRUSAGE               = 165 +	SYS_UMASK                   = 166 +	SYS_PRCTL                   = 167 +	SYS_GETCPU                  = 168 +	SYS_GETTIMEOFDAY            = 169 +	SYS_SETTIMEOFDAY            = 170 +	SYS_ADJTIMEX                = 171 +	SYS_GETPID                  = 172 +	SYS_GETPPID                 = 173 +	SYS_GETUID                  = 174 +	SYS_GETEUID                 = 175 +	SYS_GETGID                  = 176 +	SYS_GETEGID                 = 177 +	SYS_GETTID                  = 178 +	SYS_SYSINFO                 = 179 +	SYS_MQ_OPEN                 = 180 +	SYS_MQ_UNLINK               = 181 +	SYS_MQ_TIMEDSEND            = 182 +	SYS_MQ_TIMEDRECEIVE         = 183 +	SYS_MQ_NOTIFY               = 184 +	SYS_MQ_GETSETATTR           = 185 +	SYS_MSGGET                  = 186 +	SYS_MSGCTL                  = 187 +	SYS_MSGRCV                  = 188 +	SYS_MSGSND                  = 189 +	SYS_SEMGET                  = 190 +	SYS_SEMCTL                  = 191 +	SYS_SEMTIMEDOP              = 192 +	SYS_SEMOP                   = 193 +	SYS_SHMGET                  = 194 +	SYS_SHMCTL                  = 195 +	SYS_SHMAT                   = 196 +	SYS_SHMDT                   = 197 +	SYS_SOCKET                  = 198 +	SYS_SOCKETPAIR              = 199 +	SYS_BIND                    = 200 +	SYS_LISTEN                  = 201 +	SYS_ACCEPT                  = 202 +	SYS_CONNECT                 = 203 +	SYS_GETSOCKNAME             = 204 +	SYS_GETPEERNAME             = 205 +	SYS_SENDTO                  = 206 +	SYS_RECVFROM                = 207 +	SYS_SETSOCKOPT              = 208 +	SYS_GETSOCKOPT              = 209 +	SYS_SHUTDOWN                = 210 +	SYS_SENDMSG                 = 211 +	SYS_RECVMSG                 = 212 +	SYS_READAHEAD               = 213 +	SYS_BRK                     = 214 +	SYS_MUNMAP                  = 215 +	SYS_MREMAP                  = 216 +	SYS_ADD_KEY                 = 217 +	SYS_REQUEST_KEY             = 218 +	SYS_KEYCTL                  = 219 +	SYS_CLONE                   = 220 +	SYS_EXECVE                  = 221 +	SYS_MMAP                    = 222 +	SYS_FADVISE64               = 223 +	SYS_SWAPON                  = 224 +	SYS_SWAPOFF                 = 225 +	SYS_MPROTECT                = 226 +	SYS_MSYNC                   = 227 +	SYS_MLOCK                   = 228 +	SYS_MUNLOCK                 = 229 +	SYS_MLOCKALL                = 230 +	SYS_MUNLOCKALL              = 231 +	SYS_MINCORE                 = 232 +	SYS_MADVISE                 = 233 +	SYS_REMAP_FILE_PAGES        = 234 +	SYS_MBIND                   = 235 +	SYS_GET_MEMPOLICY           = 236 +	SYS_SET_MEMPOLICY           = 237 +	SYS_MIGRATE_PAGES           = 238 +	SYS_MOVE_PAGES              = 239 +	SYS_RT_TGSIGQUEUEINFO       = 240 +	SYS_PERF_EVENT_OPEN         = 241 +	SYS_ACCEPT4                 = 242 +	SYS_RECVMMSG                = 243 +	SYS_ARCH_SPECIFIC_SYSCALL   = 244 +	SYS_WAIT4                   = 260 +	SYS_PRLIMIT64               = 261 +	SYS_FANOTIFY_INIT           = 262 +	SYS_FANOTIFY_MARK           = 263 +	SYS_NAME_TO_HANDLE_AT       = 264 +	SYS_OPEN_BY_HANDLE_AT       = 265 +	SYS_CLOCK_ADJTIME           = 266 +	SYS_SYNCFS                  = 267 +	SYS_SETNS                   = 268 +	SYS_SENDMMSG                = 269 +	SYS_PROCESS_VM_READV        = 270 +	SYS_PROCESS_VM_WRITEV       = 271 +	SYS_KCMP                    = 272 +	SYS_FINIT_MODULE            = 273 +	SYS_SCHED_SETATTR           = 274 +	SYS_SCHED_GETATTR           = 275 +	SYS_RENAMEAT2               = 276 +	SYS_SECCOMP                 = 277 +	SYS_GETRANDOM               = 278 +	SYS_MEMFD_CREATE            = 279 +	SYS_BPF                     = 280 +	SYS_EXECVEAT                = 281 +	SYS_USERFAULTFD             = 282 +	SYS_MEMBARRIER              = 283 +	SYS_MLOCK2                  = 284 +	SYS_COPY_FILE_RANGE         = 285 +	SYS_PREADV2                 = 286 +	SYS_PWRITEV2                = 287 +	SYS_PKEY_MPROTECT           = 288 +	SYS_PKEY_ALLOC              = 289 +	SYS_PKEY_FREE               = 290 +	SYS_STATX                   = 291 +	SYS_IO_PGETEVENTS           = 292 +	SYS_RSEQ                    = 293 +	SYS_KEXEC_FILE_LOAD         = 294 +	SYS_PIDFD_SEND_SIGNAL       = 424 +	SYS_IO_URING_SETUP          = 425 +	SYS_IO_URING_ENTER          = 426 +	SYS_IO_URING_REGISTER       = 427 +	SYS_OPEN_TREE               = 428 +	SYS_MOVE_MOUNT              = 429 +	SYS_FSOPEN                  = 430 +	SYS_FSCONFIG                = 431 +	SYS_FSMOUNT                 = 432 +	SYS_FSPICK                  = 433 +	SYS_PIDFD_OPEN              = 434 +	SYS_CLONE3                  = 435 +	SYS_CLOSE_RANGE             = 436 +	SYS_OPENAT2                 = 437 +	SYS_PIDFD_GETFD             = 438 +	SYS_FACCESSAT2              = 439 +	SYS_PROCESS_MADVISE         = 440 +	SYS_EPOLL_PWAIT2            = 441 +	SYS_MOUNT_SETATTR           = 442 +	SYS_LANDLOCK_CREATE_RULESET = 444 +	SYS_LANDLOCK_ADD_RULE       = 445 +	SYS_LANDLOCK_RESTRICT_SELF  = 446  ) diff --git a/vendor/golang.org/x/sys/unix/zsysnum_linux_mips.go b/vendor/golang.org/x/sys/unix/zsysnum_linux_mips.go index c877ec6e6..773640b83 100644 --- a/vendor/golang.org/x/sys/unix/zsysnum_linux_mips.go +++ b/vendor/golang.org/x/sys/unix/zsysnum_linux_mips.go @@ -424,4 +424,7 @@ const (  	SYS_PROCESS_MADVISE              = 4440  	SYS_EPOLL_PWAIT2                 = 4441  	SYS_MOUNT_SETATTR                = 4442 +	SYS_LANDLOCK_CREATE_RULESET      = 4444 +	SYS_LANDLOCK_ADD_RULE            = 4445 +	SYS_LANDLOCK_RESTRICT_SELF       = 4446  ) diff --git a/vendor/golang.org/x/sys/unix/zsysnum_linux_mips64.go b/vendor/golang.org/x/sys/unix/zsysnum_linux_mips64.go index b5f290372..86a41e568 100644 --- a/vendor/golang.org/x/sys/unix/zsysnum_linux_mips64.go +++ b/vendor/golang.org/x/sys/unix/zsysnum_linux_mips64.go @@ -7,351 +7,354 @@  package unix  const ( -	SYS_READ                   = 5000 -	SYS_WRITE                  = 5001 -	SYS_OPEN                   = 5002 -	SYS_CLOSE                  = 5003 -	SYS_STAT                   = 5004 -	SYS_FSTAT                  = 5005 -	SYS_LSTAT                  = 5006 -	SYS_POLL                   = 5007 -	SYS_LSEEK                  = 5008 -	SYS_MMAP                   = 5009 -	SYS_MPROTECT               = 5010 -	SYS_MUNMAP                 = 5011 -	SYS_BRK                    = 5012 -	SYS_RT_SIGACTION           = 5013 -	SYS_RT_SIGPROCMASK         = 5014 -	SYS_IOCTL                  = 5015 -	SYS_PREAD64                = 5016 -	SYS_PWRITE64               = 5017 -	SYS_READV                  = 5018 -	SYS_WRITEV                 = 5019 -	SYS_ACCESS                 = 5020 -	SYS_PIPE                   = 5021 -	SYS__NEWSELECT             = 5022 -	SYS_SCHED_YIELD            = 5023 -	SYS_MREMAP                 = 5024 -	SYS_MSYNC                  = 5025 -	SYS_MINCORE                = 5026 -	SYS_MADVISE                = 5027 -	SYS_SHMGET                 = 5028 -	SYS_SHMAT                  = 5029 -	SYS_SHMCTL                 = 5030 -	SYS_DUP                    = 5031 -	SYS_DUP2                   = 5032 -	SYS_PAUSE                  = 5033 -	SYS_NANOSLEEP              = 5034 -	SYS_GETITIMER              = 5035 -	SYS_SETITIMER              = 5036 -	SYS_ALARM                  = 5037 -	SYS_GETPID                 = 5038 -	SYS_SENDFILE               = 5039 -	SYS_SOCKET                 = 5040 -	SYS_CONNECT                = 5041 -	SYS_ACCEPT                 = 5042 -	SYS_SENDTO                 = 5043 -	SYS_RECVFROM               = 5044 -	SYS_SENDMSG                = 5045 -	SYS_RECVMSG                = 5046 -	SYS_SHUTDOWN               = 5047 -	SYS_BIND                   = 5048 -	SYS_LISTEN                 = 5049 -	SYS_GETSOCKNAME            = 5050 -	SYS_GETPEERNAME            = 5051 -	SYS_SOCKETPAIR             = 5052 -	SYS_SETSOCKOPT             = 5053 -	SYS_GETSOCKOPT             = 5054 -	SYS_CLONE                  = 5055 -	SYS_FORK                   = 5056 -	SYS_EXECVE                 = 5057 -	SYS_EXIT                   = 5058 -	SYS_WAIT4                  = 5059 -	SYS_KILL                   = 5060 -	SYS_UNAME                  = 5061 -	SYS_SEMGET                 = 5062 -	SYS_SEMOP                  = 5063 -	SYS_SEMCTL                 = 5064 -	SYS_SHMDT                  = 5065 -	SYS_MSGGET                 = 5066 -	SYS_MSGSND                 = 5067 -	SYS_MSGRCV                 = 5068 -	SYS_MSGCTL                 = 5069 -	SYS_FCNTL                  = 5070 -	SYS_FLOCK                  = 5071 -	SYS_FSYNC                  = 5072 -	SYS_FDATASYNC              = 5073 -	SYS_TRUNCATE               = 5074 -	SYS_FTRUNCATE              = 5075 -	SYS_GETDENTS               = 5076 -	SYS_GETCWD                 = 5077 -	SYS_CHDIR                  = 5078 -	SYS_FCHDIR                 = 5079 -	SYS_RENAME                 = 5080 -	SYS_MKDIR                  = 5081 -	SYS_RMDIR                  = 5082 -	SYS_CREAT                  = 5083 -	SYS_LINK                   = 5084 -	SYS_UNLINK                 = 5085 -	SYS_SYMLINK                = 5086 -	SYS_READLINK               = 5087 -	SYS_CHMOD                  = 5088 -	SYS_FCHMOD                 = 5089 -	SYS_CHOWN                  = 5090 -	SYS_FCHOWN                 = 5091 -	SYS_LCHOWN                 = 5092 -	SYS_UMASK                  = 5093 -	SYS_GETTIMEOFDAY           = 5094 -	SYS_GETRLIMIT              = 5095 -	SYS_GETRUSAGE              = 5096 -	SYS_SYSINFO                = 5097 -	SYS_TIMES                  = 5098 -	SYS_PTRACE                 = 5099 -	SYS_GETUID                 = 5100 -	SYS_SYSLOG                 = 5101 -	SYS_GETGID                 = 5102 -	SYS_SETUID                 = 5103 -	SYS_SETGID                 = 5104 -	SYS_GETEUID                = 5105 -	SYS_GETEGID                = 5106 -	SYS_SETPGID                = 5107 -	SYS_GETPPID                = 5108 -	SYS_GETPGRP                = 5109 -	SYS_SETSID                 = 5110 -	SYS_SETREUID               = 5111 -	SYS_SETREGID               = 5112 -	SYS_GETGROUPS              = 5113 -	SYS_SETGROUPS              = 5114 -	SYS_SETRESUID              = 5115 -	SYS_GETRESUID              = 5116 -	SYS_SETRESGID              = 5117 -	SYS_GETRESGID              = 5118 -	SYS_GETPGID                = 5119 -	SYS_SETFSUID               = 5120 -	SYS_SETFSGID               = 5121 -	SYS_GETSID                 = 5122 -	SYS_CAPGET                 = 5123 -	SYS_CAPSET                 = 5124 -	SYS_RT_SIGPENDING          = 5125 -	SYS_RT_SIGTIMEDWAIT        = 5126 -	SYS_RT_SIGQUEUEINFO        = 5127 -	SYS_RT_SIGSUSPEND          = 5128 -	SYS_SIGALTSTACK            = 5129 -	SYS_UTIME                  = 5130 -	SYS_MKNOD                  = 5131 -	SYS_PERSONALITY            = 5132 -	SYS_USTAT                  = 5133 -	SYS_STATFS                 = 5134 -	SYS_FSTATFS                = 5135 -	SYS_SYSFS                  = 5136 -	SYS_GETPRIORITY            = 5137 -	SYS_SETPRIORITY            = 5138 -	SYS_SCHED_SETPARAM         = 5139 -	SYS_SCHED_GETPARAM         = 5140 -	SYS_SCHED_SETSCHEDULER     = 5141 -	SYS_SCHED_GETSCHEDULER     = 5142 -	SYS_SCHED_GET_PRIORITY_MAX = 5143 -	SYS_SCHED_GET_PRIORITY_MIN = 5144 -	SYS_SCHED_RR_GET_INTERVAL  = 5145 -	SYS_MLOCK                  = 5146 -	SYS_MUNLOCK                = 5147 -	SYS_MLOCKALL               = 5148 -	SYS_MUNLOCKALL             = 5149 -	SYS_VHANGUP                = 5150 -	SYS_PIVOT_ROOT             = 5151 -	SYS__SYSCTL                = 5152 -	SYS_PRCTL                  = 5153 -	SYS_ADJTIMEX               = 5154 -	SYS_SETRLIMIT              = 5155 -	SYS_CHROOT                 = 5156 -	SYS_SYNC                   = 5157 -	SYS_ACCT                   = 5158 -	SYS_SETTIMEOFDAY           = 5159 -	SYS_MOUNT                  = 5160 -	SYS_UMOUNT2                = 5161 -	SYS_SWAPON                 = 5162 -	SYS_SWAPOFF                = 5163 -	SYS_REBOOT                 = 5164 -	SYS_SETHOSTNAME            = 5165 -	SYS_SETDOMAINNAME          = 5166 -	SYS_CREATE_MODULE          = 5167 -	SYS_INIT_MODULE            = 5168 -	SYS_DELETE_MODULE          = 5169 -	SYS_GET_KERNEL_SYMS        = 5170 -	SYS_QUERY_MODULE           = 5171 -	SYS_QUOTACTL               = 5172 -	SYS_NFSSERVCTL             = 5173 -	SYS_GETPMSG                = 5174 -	SYS_PUTPMSG                = 5175 -	SYS_AFS_SYSCALL            = 5176 -	SYS_RESERVED177            = 5177 -	SYS_GETTID                 = 5178 -	SYS_READAHEAD              = 5179 -	SYS_SETXATTR               = 5180 -	SYS_LSETXATTR              = 5181 -	SYS_FSETXATTR              = 5182 -	SYS_GETXATTR               = 5183 -	SYS_LGETXATTR              = 5184 -	SYS_FGETXATTR              = 5185 -	SYS_LISTXATTR              = 5186 -	SYS_LLISTXATTR             = 5187 -	SYS_FLISTXATTR             = 5188 -	SYS_REMOVEXATTR            = 5189 -	SYS_LREMOVEXATTR           = 5190 -	SYS_FREMOVEXATTR           = 5191 -	SYS_TKILL                  = 5192 -	SYS_RESERVED193            = 5193 -	SYS_FUTEX                  = 5194 -	SYS_SCHED_SETAFFINITY      = 5195 -	SYS_SCHED_GETAFFINITY      = 5196 -	SYS_CACHEFLUSH             = 5197 -	SYS_CACHECTL               = 5198 -	SYS_SYSMIPS                = 5199 -	SYS_IO_SETUP               = 5200 -	SYS_IO_DESTROY             = 5201 -	SYS_IO_GETEVENTS           = 5202 -	SYS_IO_SUBMIT              = 5203 -	SYS_IO_CANCEL              = 5204 -	SYS_EXIT_GROUP             = 5205 -	SYS_LOOKUP_DCOOKIE         = 5206 -	SYS_EPOLL_CREATE           = 5207 -	SYS_EPOLL_CTL              = 5208 -	SYS_EPOLL_WAIT             = 5209 -	SYS_REMAP_FILE_PAGES       = 5210 -	SYS_RT_SIGRETURN           = 5211 -	SYS_SET_TID_ADDRESS        = 5212 -	SYS_RESTART_SYSCALL        = 5213 -	SYS_SEMTIMEDOP             = 5214 -	SYS_FADVISE64              = 5215 -	SYS_TIMER_CREATE           = 5216 -	SYS_TIMER_SETTIME          = 5217 -	SYS_TIMER_GETTIME          = 5218 -	SYS_TIMER_GETOVERRUN       = 5219 -	SYS_TIMER_DELETE           = 5220 -	SYS_CLOCK_SETTIME          = 5221 -	SYS_CLOCK_GETTIME          = 5222 -	SYS_CLOCK_GETRES           = 5223 -	SYS_CLOCK_NANOSLEEP        = 5224 -	SYS_TGKILL                 = 5225 -	SYS_UTIMES                 = 5226 -	SYS_MBIND                  = 5227 -	SYS_GET_MEMPOLICY          = 5228 -	SYS_SET_MEMPOLICY          = 5229 -	SYS_MQ_OPEN                = 5230 -	SYS_MQ_UNLINK              = 5231 -	SYS_MQ_TIMEDSEND           = 5232 -	SYS_MQ_TIMEDRECEIVE        = 5233 -	SYS_MQ_NOTIFY              = 5234 -	SYS_MQ_GETSETATTR          = 5235 -	SYS_VSERVER                = 5236 -	SYS_WAITID                 = 5237 -	SYS_ADD_KEY                = 5239 -	SYS_REQUEST_KEY            = 5240 -	SYS_KEYCTL                 = 5241 -	SYS_SET_THREAD_AREA        = 5242 -	SYS_INOTIFY_INIT           = 5243 -	SYS_INOTIFY_ADD_WATCH      = 5244 -	SYS_INOTIFY_RM_WATCH       = 5245 -	SYS_MIGRATE_PAGES          = 5246 -	SYS_OPENAT                 = 5247 -	SYS_MKDIRAT                = 5248 -	SYS_MKNODAT                = 5249 -	SYS_FCHOWNAT               = 5250 -	SYS_FUTIMESAT              = 5251 -	SYS_NEWFSTATAT             = 5252 -	SYS_UNLINKAT               = 5253 -	SYS_RENAMEAT               = 5254 -	SYS_LINKAT                 = 5255 -	SYS_SYMLINKAT              = 5256 -	SYS_READLINKAT             = 5257 -	SYS_FCHMODAT               = 5258 -	SYS_FACCESSAT              = 5259 -	SYS_PSELECT6               = 5260 -	SYS_PPOLL                  = 5261 -	SYS_UNSHARE                = 5262 -	SYS_SPLICE                 = 5263 -	SYS_SYNC_FILE_RANGE        = 5264 -	SYS_TEE                    = 5265 -	SYS_VMSPLICE               = 5266 -	SYS_MOVE_PAGES             = 5267 -	SYS_SET_ROBUST_LIST        = 5268 -	SYS_GET_ROBUST_LIST        = 5269 -	SYS_KEXEC_LOAD             = 5270 -	SYS_GETCPU                 = 5271 -	SYS_EPOLL_PWAIT            = 5272 -	SYS_IOPRIO_SET             = 5273 -	SYS_IOPRIO_GET             = 5274 -	SYS_UTIMENSAT              = 5275 -	SYS_SIGNALFD               = 5276 -	SYS_TIMERFD                = 5277 -	SYS_EVENTFD                = 5278 -	SYS_FALLOCATE              = 5279 -	SYS_TIMERFD_CREATE         = 5280 -	SYS_TIMERFD_GETTIME        = 5281 -	SYS_TIMERFD_SETTIME        = 5282 -	SYS_SIGNALFD4              = 5283 -	SYS_EVENTFD2               = 5284 -	SYS_EPOLL_CREATE1          = 5285 -	SYS_DUP3                   = 5286 -	SYS_PIPE2                  = 5287 -	SYS_INOTIFY_INIT1          = 5288 -	SYS_PREADV                 = 5289 -	SYS_PWRITEV                = 5290 -	SYS_RT_TGSIGQUEUEINFO      = 5291 -	SYS_PERF_EVENT_OPEN        = 5292 -	SYS_ACCEPT4                = 5293 -	SYS_RECVMMSG               = 5294 -	SYS_FANOTIFY_INIT          = 5295 -	SYS_FANOTIFY_MARK          = 5296 -	SYS_PRLIMIT64              = 5297 -	SYS_NAME_TO_HANDLE_AT      = 5298 -	SYS_OPEN_BY_HANDLE_AT      = 5299 -	SYS_CLOCK_ADJTIME          = 5300 -	SYS_SYNCFS                 = 5301 -	SYS_SENDMMSG               = 5302 -	SYS_SETNS                  = 5303 -	SYS_PROCESS_VM_READV       = 5304 -	SYS_PROCESS_VM_WRITEV      = 5305 -	SYS_KCMP                   = 5306 -	SYS_FINIT_MODULE           = 5307 -	SYS_GETDENTS64             = 5308 -	SYS_SCHED_SETATTR          = 5309 -	SYS_SCHED_GETATTR          = 5310 -	SYS_RENAMEAT2              = 5311 -	SYS_SECCOMP                = 5312 -	SYS_GETRANDOM              = 5313 -	SYS_MEMFD_CREATE           = 5314 -	SYS_BPF                    = 5315 -	SYS_EXECVEAT               = 5316 -	SYS_USERFAULTFD            = 5317 -	SYS_MEMBARRIER             = 5318 -	SYS_MLOCK2                 = 5319 -	SYS_COPY_FILE_RANGE        = 5320 -	SYS_PREADV2                = 5321 -	SYS_PWRITEV2               = 5322 -	SYS_PKEY_MPROTECT          = 5323 -	SYS_PKEY_ALLOC             = 5324 -	SYS_PKEY_FREE              = 5325 -	SYS_STATX                  = 5326 -	SYS_RSEQ                   = 5327 -	SYS_IO_PGETEVENTS          = 5328 -	SYS_PIDFD_SEND_SIGNAL      = 5424 -	SYS_IO_URING_SETUP         = 5425 -	SYS_IO_URING_ENTER         = 5426 -	SYS_IO_URING_REGISTER      = 5427 -	SYS_OPEN_TREE              = 5428 -	SYS_MOVE_MOUNT             = 5429 -	SYS_FSOPEN                 = 5430 -	SYS_FSCONFIG               = 5431 -	SYS_FSMOUNT                = 5432 -	SYS_FSPICK                 = 5433 -	SYS_PIDFD_OPEN             = 5434 -	SYS_CLONE3                 = 5435 -	SYS_CLOSE_RANGE            = 5436 -	SYS_OPENAT2                = 5437 -	SYS_PIDFD_GETFD            = 5438 -	SYS_FACCESSAT2             = 5439 -	SYS_PROCESS_MADVISE        = 5440 -	SYS_EPOLL_PWAIT2           = 5441 -	SYS_MOUNT_SETATTR          = 5442 +	SYS_READ                    = 5000 +	SYS_WRITE                   = 5001 +	SYS_OPEN                    = 5002 +	SYS_CLOSE                   = 5003 +	SYS_STAT                    = 5004 +	SYS_FSTAT                   = 5005 +	SYS_LSTAT                   = 5006 +	SYS_POLL                    = 5007 +	SYS_LSEEK                   = 5008 +	SYS_MMAP                    = 5009 +	SYS_MPROTECT                = 5010 +	SYS_MUNMAP                  = 5011 +	SYS_BRK                     = 5012 +	SYS_RT_SIGACTION            = 5013 +	SYS_RT_SIGPROCMASK          = 5014 +	SYS_IOCTL                   = 5015 +	SYS_PREAD64                 = 5016 +	SYS_PWRITE64                = 5017 +	SYS_READV                   = 5018 +	SYS_WRITEV                  = 5019 +	SYS_ACCESS                  = 5020 +	SYS_PIPE                    = 5021 +	SYS__NEWSELECT              = 5022 +	SYS_SCHED_YIELD             = 5023 +	SYS_MREMAP                  = 5024 +	SYS_MSYNC                   = 5025 +	SYS_MINCORE                 = 5026 +	SYS_MADVISE                 = 5027 +	SYS_SHMGET                  = 5028 +	SYS_SHMAT                   = 5029 +	SYS_SHMCTL                  = 5030 +	SYS_DUP                     = 5031 +	SYS_DUP2                    = 5032 +	SYS_PAUSE                   = 5033 +	SYS_NANOSLEEP               = 5034 +	SYS_GETITIMER               = 5035 +	SYS_SETITIMER               = 5036 +	SYS_ALARM                   = 5037 +	SYS_GETPID                  = 5038 +	SYS_SENDFILE                = 5039 +	SYS_SOCKET                  = 5040 +	SYS_CONNECT                 = 5041 +	SYS_ACCEPT                  = 5042 +	SYS_SENDTO                  = 5043 +	SYS_RECVFROM                = 5044 +	SYS_SENDMSG                 = 5045 +	SYS_RECVMSG                 = 5046 +	SYS_SHUTDOWN                = 5047 +	SYS_BIND                    = 5048 +	SYS_LISTEN                  = 5049 +	SYS_GETSOCKNAME             = 5050 +	SYS_GETPEERNAME             = 5051 +	SYS_SOCKETPAIR              = 5052 +	SYS_SETSOCKOPT              = 5053 +	SYS_GETSOCKOPT              = 5054 +	SYS_CLONE                   = 5055 +	SYS_FORK                    = 5056 +	SYS_EXECVE                  = 5057 +	SYS_EXIT                    = 5058 +	SYS_WAIT4                   = 5059 +	SYS_KILL                    = 5060 +	SYS_UNAME                   = 5061 +	SYS_SEMGET                  = 5062 +	SYS_SEMOP                   = 5063 +	SYS_SEMCTL                  = 5064 +	SYS_SHMDT                   = 5065 +	SYS_MSGGET                  = 5066 +	SYS_MSGSND                  = 5067 +	SYS_MSGRCV                  = 5068 +	SYS_MSGCTL                  = 5069 +	SYS_FCNTL                   = 5070 +	SYS_FLOCK                   = 5071 +	SYS_FSYNC                   = 5072 +	SYS_FDATASYNC               = 5073 +	SYS_TRUNCATE                = 5074 +	SYS_FTRUNCATE               = 5075 +	SYS_GETDENTS                = 5076 +	SYS_GETCWD                  = 5077 +	SYS_CHDIR                   = 5078 +	SYS_FCHDIR                  = 5079 +	SYS_RENAME                  = 5080 +	SYS_MKDIR                   = 5081 +	SYS_RMDIR                   = 5082 +	SYS_CREAT                   = 5083 +	SYS_LINK                    = 5084 +	SYS_UNLINK                  = 5085 +	SYS_SYMLINK                 = 5086 +	SYS_READLINK                = 5087 +	SYS_CHMOD                   = 5088 +	SYS_FCHMOD                  = 5089 +	SYS_CHOWN                   = 5090 +	SYS_FCHOWN                  = 5091 +	SYS_LCHOWN                  = 5092 +	SYS_UMASK                   = 5093 +	SYS_GETTIMEOFDAY            = 5094 +	SYS_GETRLIMIT               = 5095 +	SYS_GETRUSAGE               = 5096 +	SYS_SYSINFO                 = 5097 +	SYS_TIMES                   = 5098 +	SYS_PTRACE                  = 5099 +	SYS_GETUID                  = 5100 +	SYS_SYSLOG                  = 5101 +	SYS_GETGID                  = 5102 +	SYS_SETUID                  = 5103 +	SYS_SETGID                  = 5104 +	SYS_GETEUID                 = 5105 +	SYS_GETEGID                 = 5106 +	SYS_SETPGID                 = 5107 +	SYS_GETPPID                 = 5108 +	SYS_GETPGRP                 = 5109 +	SYS_SETSID                  = 5110 +	SYS_SETREUID                = 5111 +	SYS_SETREGID                = 5112 +	SYS_GETGROUPS               = 5113 +	SYS_SETGROUPS               = 5114 +	SYS_SETRESUID               = 5115 +	SYS_GETRESUID               = 5116 +	SYS_SETRESGID               = 5117 +	SYS_GETRESGID               = 5118 +	SYS_GETPGID                 = 5119 +	SYS_SETFSUID                = 5120 +	SYS_SETFSGID                = 5121 +	SYS_GETSID                  = 5122 +	SYS_CAPGET                  = 5123 +	SYS_CAPSET                  = 5124 +	SYS_RT_SIGPENDING           = 5125 +	SYS_RT_SIGTIMEDWAIT         = 5126 +	SYS_RT_SIGQUEUEINFO         = 5127 +	SYS_RT_SIGSUSPEND           = 5128 +	SYS_SIGALTSTACK             = 5129 +	SYS_UTIME                   = 5130 +	SYS_MKNOD                   = 5131 +	SYS_PERSONALITY             = 5132 +	SYS_USTAT                   = 5133 +	SYS_STATFS                  = 5134 +	SYS_FSTATFS                 = 5135 +	SYS_SYSFS                   = 5136 +	SYS_GETPRIORITY             = 5137 +	SYS_SETPRIORITY             = 5138 +	SYS_SCHED_SETPARAM          = 5139 +	SYS_SCHED_GETPARAM          = 5140 +	SYS_SCHED_SETSCHEDULER      = 5141 +	SYS_SCHED_GETSCHEDULER      = 5142 +	SYS_SCHED_GET_PRIORITY_MAX  = 5143 +	SYS_SCHED_GET_PRIORITY_MIN  = 5144 +	SYS_SCHED_RR_GET_INTERVAL   = 5145 +	SYS_MLOCK                   = 5146 +	SYS_MUNLOCK                 = 5147 +	SYS_MLOCKALL                = 5148 +	SYS_MUNLOCKALL              = 5149 +	SYS_VHANGUP                 = 5150 +	SYS_PIVOT_ROOT              = 5151 +	SYS__SYSCTL                 = 5152 +	SYS_PRCTL                   = 5153 +	SYS_ADJTIMEX                = 5154 +	SYS_SETRLIMIT               = 5155 +	SYS_CHROOT                  = 5156 +	SYS_SYNC                    = 5157 +	SYS_ACCT                    = 5158 +	SYS_SETTIMEOFDAY            = 5159 +	SYS_MOUNT                   = 5160 +	SYS_UMOUNT2                 = 5161 +	SYS_SWAPON                  = 5162 +	SYS_SWAPOFF                 = 5163 +	SYS_REBOOT                  = 5164 +	SYS_SETHOSTNAME             = 5165 +	SYS_SETDOMAINNAME           = 5166 +	SYS_CREATE_MODULE           = 5167 +	SYS_INIT_MODULE             = 5168 +	SYS_DELETE_MODULE           = 5169 +	SYS_GET_KERNEL_SYMS         = 5170 +	SYS_QUERY_MODULE            = 5171 +	SYS_QUOTACTL                = 5172 +	SYS_NFSSERVCTL              = 5173 +	SYS_GETPMSG                 = 5174 +	SYS_PUTPMSG                 = 5175 +	SYS_AFS_SYSCALL             = 5176 +	SYS_RESERVED177             = 5177 +	SYS_GETTID                  = 5178 +	SYS_READAHEAD               = 5179 +	SYS_SETXATTR                = 5180 +	SYS_LSETXATTR               = 5181 +	SYS_FSETXATTR               = 5182 +	SYS_GETXATTR                = 5183 +	SYS_LGETXATTR               = 5184 +	SYS_FGETXATTR               = 5185 +	SYS_LISTXATTR               = 5186 +	SYS_LLISTXATTR              = 5187 +	SYS_FLISTXATTR              = 5188 +	SYS_REMOVEXATTR             = 5189 +	SYS_LREMOVEXATTR            = 5190 +	SYS_FREMOVEXATTR            = 5191 +	SYS_TKILL                   = 5192 +	SYS_RESERVED193             = 5193 +	SYS_FUTEX                   = 5194 +	SYS_SCHED_SETAFFINITY       = 5195 +	SYS_SCHED_GETAFFINITY       = 5196 +	SYS_CACHEFLUSH              = 5197 +	SYS_CACHECTL                = 5198 +	SYS_SYSMIPS                 = 5199 +	SYS_IO_SETUP                = 5200 +	SYS_IO_DESTROY              = 5201 +	SYS_IO_GETEVENTS            = 5202 +	SYS_IO_SUBMIT               = 5203 +	SYS_IO_CANCEL               = 5204 +	SYS_EXIT_GROUP              = 5205 +	SYS_LOOKUP_DCOOKIE          = 5206 +	SYS_EPOLL_CREATE            = 5207 +	SYS_EPOLL_CTL               = 5208 +	SYS_EPOLL_WAIT              = 5209 +	SYS_REMAP_FILE_PAGES        = 5210 +	SYS_RT_SIGRETURN            = 5211 +	SYS_SET_TID_ADDRESS         = 5212 +	SYS_RESTART_SYSCALL         = 5213 +	SYS_SEMTIMEDOP              = 5214 +	SYS_FADVISE64               = 5215 +	SYS_TIMER_CREATE            = 5216 +	SYS_TIMER_SETTIME           = 5217 +	SYS_TIMER_GETTIME           = 5218 +	SYS_TIMER_GETOVERRUN        = 5219 +	SYS_TIMER_DELETE            = 5220 +	SYS_CLOCK_SETTIME           = 5221 +	SYS_CLOCK_GETTIME           = 5222 +	SYS_CLOCK_GETRES            = 5223 +	SYS_CLOCK_NANOSLEEP         = 5224 +	SYS_TGKILL                  = 5225 +	SYS_UTIMES                  = 5226 +	SYS_MBIND                   = 5227 +	SYS_GET_MEMPOLICY           = 5228 +	SYS_SET_MEMPOLICY           = 5229 +	SYS_MQ_OPEN                 = 5230 +	SYS_MQ_UNLINK               = 5231 +	SYS_MQ_TIMEDSEND            = 5232 +	SYS_MQ_TIMEDRECEIVE         = 5233 +	SYS_MQ_NOTIFY               = 5234 +	SYS_MQ_GETSETATTR           = 5235 +	SYS_VSERVER                 = 5236 +	SYS_WAITID                  = 5237 +	SYS_ADD_KEY                 = 5239 +	SYS_REQUEST_KEY             = 5240 +	SYS_KEYCTL                  = 5241 +	SYS_SET_THREAD_AREA         = 5242 +	SYS_INOTIFY_INIT            = 5243 +	SYS_INOTIFY_ADD_WATCH       = 5244 +	SYS_INOTIFY_RM_WATCH        = 5245 +	SYS_MIGRATE_PAGES           = 5246 +	SYS_OPENAT                  = 5247 +	SYS_MKDIRAT                 = 5248 +	SYS_MKNODAT                 = 5249 +	SYS_FCHOWNAT                = 5250 +	SYS_FUTIMESAT               = 5251 +	SYS_NEWFSTATAT              = 5252 +	SYS_UNLINKAT                = 5253 +	SYS_RENAMEAT                = 5254 +	SYS_LINKAT                  = 5255 +	SYS_SYMLINKAT               = 5256 +	SYS_READLINKAT              = 5257 +	SYS_FCHMODAT                = 5258 +	SYS_FACCESSAT               = 5259 +	SYS_PSELECT6                = 5260 +	SYS_PPOLL                   = 5261 +	SYS_UNSHARE                 = 5262 +	SYS_SPLICE                  = 5263 +	SYS_SYNC_FILE_RANGE         = 5264 +	SYS_TEE                     = 5265 +	SYS_VMSPLICE                = 5266 +	SYS_MOVE_PAGES              = 5267 +	SYS_SET_ROBUST_LIST         = 5268 +	SYS_GET_ROBUST_LIST         = 5269 +	SYS_KEXEC_LOAD              = 5270 +	SYS_GETCPU                  = 5271 +	SYS_EPOLL_PWAIT             = 5272 +	SYS_IOPRIO_SET              = 5273 +	SYS_IOPRIO_GET              = 5274 +	SYS_UTIMENSAT               = 5275 +	SYS_SIGNALFD                = 5276 +	SYS_TIMERFD                 = 5277 +	SYS_EVENTFD                 = 5278 +	SYS_FALLOCATE               = 5279 +	SYS_TIMERFD_CREATE          = 5280 +	SYS_TIMERFD_GETTIME         = 5281 +	SYS_TIMERFD_SETTIME         = 5282 +	SYS_SIGNALFD4               = 5283 +	SYS_EVENTFD2                = 5284 +	SYS_EPOLL_CREATE1           = 5285 +	SYS_DUP3                    = 5286 +	SYS_PIPE2                   = 5287 +	SYS_INOTIFY_INIT1           = 5288 +	SYS_PREADV                  = 5289 +	SYS_PWRITEV                 = 5290 +	SYS_RT_TGSIGQUEUEINFO       = 5291 +	SYS_PERF_EVENT_OPEN         = 5292 +	SYS_ACCEPT4                 = 5293 +	SYS_RECVMMSG                = 5294 +	SYS_FANOTIFY_INIT           = 5295 +	SYS_FANOTIFY_MARK           = 5296 +	SYS_PRLIMIT64               = 5297 +	SYS_NAME_TO_HANDLE_AT       = 5298 +	SYS_OPEN_BY_HANDLE_AT       = 5299 +	SYS_CLOCK_ADJTIME           = 5300 +	SYS_SYNCFS                  = 5301 +	SYS_SENDMMSG                = 5302 +	SYS_SETNS                   = 5303 +	SYS_PROCESS_VM_READV        = 5304 +	SYS_PROCESS_VM_WRITEV       = 5305 +	SYS_KCMP                    = 5306 +	SYS_FINIT_MODULE            = 5307 +	SYS_GETDENTS64              = 5308 +	SYS_SCHED_SETATTR           = 5309 +	SYS_SCHED_GETATTR           = 5310 +	SYS_RENAMEAT2               = 5311 +	SYS_SECCOMP                 = 5312 +	SYS_GETRANDOM               = 5313 +	SYS_MEMFD_CREATE            = 5314 +	SYS_BPF                     = 5315 +	SYS_EXECVEAT                = 5316 +	SYS_USERFAULTFD             = 5317 +	SYS_MEMBARRIER              = 5318 +	SYS_MLOCK2                  = 5319 +	SYS_COPY_FILE_RANGE         = 5320 +	SYS_PREADV2                 = 5321 +	SYS_PWRITEV2                = 5322 +	SYS_PKEY_MPROTECT           = 5323 +	SYS_PKEY_ALLOC              = 5324 +	SYS_PKEY_FREE               = 5325 +	SYS_STATX                   = 5326 +	SYS_RSEQ                    = 5327 +	SYS_IO_PGETEVENTS           = 5328 +	SYS_PIDFD_SEND_SIGNAL       = 5424 +	SYS_IO_URING_SETUP          = 5425 +	SYS_IO_URING_ENTER          = 5426 +	SYS_IO_URING_REGISTER       = 5427 +	SYS_OPEN_TREE               = 5428 +	SYS_MOVE_MOUNT              = 5429 +	SYS_FSOPEN                  = 5430 +	SYS_FSCONFIG                = 5431 +	SYS_FSMOUNT                 = 5432 +	SYS_FSPICK                  = 5433 +	SYS_PIDFD_OPEN              = 5434 +	SYS_CLONE3                  = 5435 +	SYS_CLOSE_RANGE             = 5436 +	SYS_OPENAT2                 = 5437 +	SYS_PIDFD_GETFD             = 5438 +	SYS_FACCESSAT2              = 5439 +	SYS_PROCESS_MADVISE         = 5440 +	SYS_EPOLL_PWAIT2            = 5441 +	SYS_MOUNT_SETATTR           = 5442 +	SYS_LANDLOCK_CREATE_RULESET = 5444 +	SYS_LANDLOCK_ADD_RULE       = 5445 +	SYS_LANDLOCK_RESTRICT_SELF  = 5446  ) diff --git a/vendor/golang.org/x/sys/unix/zsysnum_linux_mips64le.go b/vendor/golang.org/x/sys/unix/zsysnum_linux_mips64le.go index 46077689a..77f5728da 100644 --- a/vendor/golang.org/x/sys/unix/zsysnum_linux_mips64le.go +++ b/vendor/golang.org/x/sys/unix/zsysnum_linux_mips64le.go @@ -7,351 +7,354 @@  package unix  const ( -	SYS_READ                   = 5000 -	SYS_WRITE                  = 5001 -	SYS_OPEN                   = 5002 -	SYS_CLOSE                  = 5003 -	SYS_STAT                   = 5004 -	SYS_FSTAT                  = 5005 -	SYS_LSTAT                  = 5006 -	SYS_POLL                   = 5007 -	SYS_LSEEK                  = 5008 -	SYS_MMAP                   = 5009 -	SYS_MPROTECT               = 5010 -	SYS_MUNMAP                 = 5011 -	SYS_BRK                    = 5012 -	SYS_RT_SIGACTION           = 5013 -	SYS_RT_SIGPROCMASK         = 5014 -	SYS_IOCTL                  = 5015 -	SYS_PREAD64                = 5016 -	SYS_PWRITE64               = 5017 -	SYS_READV                  = 5018 -	SYS_WRITEV                 = 5019 -	SYS_ACCESS                 = 5020 -	SYS_PIPE                   = 5021 -	SYS__NEWSELECT             = 5022 -	SYS_SCHED_YIELD            = 5023 -	SYS_MREMAP                 = 5024 -	SYS_MSYNC                  = 5025 -	SYS_MINCORE                = 5026 -	SYS_MADVISE                = 5027 -	SYS_SHMGET                 = 5028 -	SYS_SHMAT                  = 5029 -	SYS_SHMCTL                 = 5030 -	SYS_DUP                    = 5031 -	SYS_DUP2                   = 5032 -	SYS_PAUSE                  = 5033 -	SYS_NANOSLEEP              = 5034 -	SYS_GETITIMER              = 5035 -	SYS_SETITIMER              = 5036 -	SYS_ALARM                  = 5037 -	SYS_GETPID                 = 5038 -	SYS_SENDFILE               = 5039 -	SYS_SOCKET                 = 5040 -	SYS_CONNECT                = 5041 -	SYS_ACCEPT                 = 5042 -	SYS_SENDTO                 = 5043 -	SYS_RECVFROM               = 5044 -	SYS_SENDMSG                = 5045 -	SYS_RECVMSG                = 5046 -	SYS_SHUTDOWN               = 5047 -	SYS_BIND                   = 5048 -	SYS_LISTEN                 = 5049 -	SYS_GETSOCKNAME            = 5050 -	SYS_GETPEERNAME            = 5051 -	SYS_SOCKETPAIR             = 5052 -	SYS_SETSOCKOPT             = 5053 -	SYS_GETSOCKOPT             = 5054 -	SYS_CLONE                  = 5055 -	SYS_FORK                   = 5056 -	SYS_EXECVE                 = 5057 -	SYS_EXIT                   = 5058 -	SYS_WAIT4                  = 5059 -	SYS_KILL                   = 5060 -	SYS_UNAME                  = 5061 -	SYS_SEMGET                 = 5062 -	SYS_SEMOP                  = 5063 -	SYS_SEMCTL                 = 5064 -	SYS_SHMDT                  = 5065 -	SYS_MSGGET                 = 5066 -	SYS_MSGSND                 = 5067 -	SYS_MSGRCV                 = 5068 -	SYS_MSGCTL                 = 5069 -	SYS_FCNTL                  = 5070 -	SYS_FLOCK                  = 5071 -	SYS_FSYNC                  = 5072 -	SYS_FDATASYNC              = 5073 -	SYS_TRUNCATE               = 5074 -	SYS_FTRUNCATE              = 5075 -	SYS_GETDENTS               = 5076 -	SYS_GETCWD                 = 5077 -	SYS_CHDIR                  = 5078 -	SYS_FCHDIR                 = 5079 -	SYS_RENAME                 = 5080 -	SYS_MKDIR                  = 5081 -	SYS_RMDIR                  = 5082 -	SYS_CREAT                  = 5083 -	SYS_LINK                   = 5084 -	SYS_UNLINK                 = 5085 -	SYS_SYMLINK                = 5086 -	SYS_READLINK               = 5087 -	SYS_CHMOD                  = 5088 -	SYS_FCHMOD                 = 5089 -	SYS_CHOWN                  = 5090 -	SYS_FCHOWN                 = 5091 -	SYS_LCHOWN                 = 5092 -	SYS_UMASK                  = 5093 -	SYS_GETTIMEOFDAY           = 5094 -	SYS_GETRLIMIT              = 5095 -	SYS_GETRUSAGE              = 5096 -	SYS_SYSINFO                = 5097 -	SYS_TIMES                  = 5098 -	SYS_PTRACE                 = 5099 -	SYS_GETUID                 = 5100 -	SYS_SYSLOG                 = 5101 -	SYS_GETGID                 = 5102 -	SYS_SETUID                 = 5103 -	SYS_SETGID                 = 5104 -	SYS_GETEUID                = 5105 -	SYS_GETEGID                = 5106 -	SYS_SETPGID                = 5107 -	SYS_GETPPID                = 5108 -	SYS_GETPGRP                = 5109 -	SYS_SETSID                 = 5110 -	SYS_SETREUID               = 5111 -	SYS_SETREGID               = 5112 -	SYS_GETGROUPS              = 5113 -	SYS_SETGROUPS              = 5114 -	SYS_SETRESUID              = 5115 -	SYS_GETRESUID              = 5116 -	SYS_SETRESGID              = 5117 -	SYS_GETRESGID              = 5118 -	SYS_GETPGID                = 5119 -	SYS_SETFSUID               = 5120 -	SYS_SETFSGID               = 5121 -	SYS_GETSID                 = 5122 -	SYS_CAPGET                 = 5123 -	SYS_CAPSET                 = 5124 -	SYS_RT_SIGPENDING          = 5125 -	SYS_RT_SIGTIMEDWAIT        = 5126 -	SYS_RT_SIGQUEUEINFO        = 5127 -	SYS_RT_SIGSUSPEND          = 5128 -	SYS_SIGALTSTACK            = 5129 -	SYS_UTIME                  = 5130 -	SYS_MKNOD                  = 5131 -	SYS_PERSONALITY            = 5132 -	SYS_USTAT                  = 5133 -	SYS_STATFS                 = 5134 -	SYS_FSTATFS                = 5135 -	SYS_SYSFS                  = 5136 -	SYS_GETPRIORITY            = 5137 -	SYS_SETPRIORITY            = 5138 -	SYS_SCHED_SETPARAM         = 5139 -	SYS_SCHED_GETPARAM         = 5140 -	SYS_SCHED_SETSCHEDULER     = 5141 -	SYS_SCHED_GETSCHEDULER     = 5142 -	SYS_SCHED_GET_PRIORITY_MAX = 5143 -	SYS_SCHED_GET_PRIORITY_MIN = 5144 -	SYS_SCHED_RR_GET_INTERVAL  = 5145 -	SYS_MLOCK                  = 5146 -	SYS_MUNLOCK                = 5147 -	SYS_MLOCKALL               = 5148 -	SYS_MUNLOCKALL             = 5149 -	SYS_VHANGUP                = 5150 -	SYS_PIVOT_ROOT             = 5151 -	SYS__SYSCTL                = 5152 -	SYS_PRCTL                  = 5153 -	SYS_ADJTIMEX               = 5154 -	SYS_SETRLIMIT              = 5155 -	SYS_CHROOT                 = 5156 -	SYS_SYNC                   = 5157 -	SYS_ACCT                   = 5158 -	SYS_SETTIMEOFDAY           = 5159 -	SYS_MOUNT                  = 5160 -	SYS_UMOUNT2                = 5161 -	SYS_SWAPON                 = 5162 -	SYS_SWAPOFF                = 5163 -	SYS_REBOOT                 = 5164 -	SYS_SETHOSTNAME            = 5165 -	SYS_SETDOMAINNAME          = 5166 -	SYS_CREATE_MODULE          = 5167 -	SYS_INIT_MODULE            = 5168 -	SYS_DELETE_MODULE          = 5169 -	SYS_GET_KERNEL_SYMS        = 5170 -	SYS_QUERY_MODULE           = 5171 -	SYS_QUOTACTL               = 5172 -	SYS_NFSSERVCTL             = 5173 -	SYS_GETPMSG                = 5174 -	SYS_PUTPMSG                = 5175 -	SYS_AFS_SYSCALL            = 5176 -	SYS_RESERVED177            = 5177 -	SYS_GETTID                 = 5178 -	SYS_READAHEAD              = 5179 -	SYS_SETXATTR               = 5180 -	SYS_LSETXATTR              = 5181 -	SYS_FSETXATTR              = 5182 -	SYS_GETXATTR               = 5183 -	SYS_LGETXATTR              = 5184 -	SYS_FGETXATTR              = 5185 -	SYS_LISTXATTR              = 5186 -	SYS_LLISTXATTR             = 5187 -	SYS_FLISTXATTR             = 5188 -	SYS_REMOVEXATTR            = 5189 -	SYS_LREMOVEXATTR           = 5190 -	SYS_FREMOVEXATTR           = 5191 -	SYS_TKILL                  = 5192 -	SYS_RESERVED193            = 5193 -	SYS_FUTEX                  = 5194 -	SYS_SCHED_SETAFFINITY      = 5195 -	SYS_SCHED_GETAFFINITY      = 5196 -	SYS_CACHEFLUSH             = 5197 -	SYS_CACHECTL               = 5198 -	SYS_SYSMIPS                = 5199 -	SYS_IO_SETUP               = 5200 -	SYS_IO_DESTROY             = 5201 -	SYS_IO_GETEVENTS           = 5202 -	SYS_IO_SUBMIT              = 5203 -	SYS_IO_CANCEL              = 5204 -	SYS_EXIT_GROUP             = 5205 -	SYS_LOOKUP_DCOOKIE         = 5206 -	SYS_EPOLL_CREATE           = 5207 -	SYS_EPOLL_CTL              = 5208 -	SYS_EPOLL_WAIT             = 5209 -	SYS_REMAP_FILE_PAGES       = 5210 -	SYS_RT_SIGRETURN           = 5211 -	SYS_SET_TID_ADDRESS        = 5212 -	SYS_RESTART_SYSCALL        = 5213 -	SYS_SEMTIMEDOP             = 5214 -	SYS_FADVISE64              = 5215 -	SYS_TIMER_CREATE           = 5216 -	SYS_TIMER_SETTIME          = 5217 -	SYS_TIMER_GETTIME          = 5218 -	SYS_TIMER_GETOVERRUN       = 5219 -	SYS_TIMER_DELETE           = 5220 -	SYS_CLOCK_SETTIME          = 5221 -	SYS_CLOCK_GETTIME          = 5222 -	SYS_CLOCK_GETRES           = 5223 -	SYS_CLOCK_NANOSLEEP        = 5224 -	SYS_TGKILL                 = 5225 -	SYS_UTIMES                 = 5226 -	SYS_MBIND                  = 5227 -	SYS_GET_MEMPOLICY          = 5228 -	SYS_SET_MEMPOLICY          = 5229 -	SYS_MQ_OPEN                = 5230 -	SYS_MQ_UNLINK              = 5231 -	SYS_MQ_TIMEDSEND           = 5232 -	SYS_MQ_TIMEDRECEIVE        = 5233 -	SYS_MQ_NOTIFY              = 5234 -	SYS_MQ_GETSETATTR          = 5235 -	SYS_VSERVER                = 5236 -	SYS_WAITID                 = 5237 -	SYS_ADD_KEY                = 5239 -	SYS_REQUEST_KEY            = 5240 -	SYS_KEYCTL                 = 5241 -	SYS_SET_THREAD_AREA        = 5242 -	SYS_INOTIFY_INIT           = 5243 -	SYS_INOTIFY_ADD_WATCH      = 5244 -	SYS_INOTIFY_RM_WATCH       = 5245 -	SYS_MIGRATE_PAGES          = 5246 -	SYS_OPENAT                 = 5247 -	SYS_MKDIRAT                = 5248 -	SYS_MKNODAT                = 5249 -	SYS_FCHOWNAT               = 5250 -	SYS_FUTIMESAT              = 5251 -	SYS_NEWFSTATAT             = 5252 -	SYS_UNLINKAT               = 5253 -	SYS_RENAMEAT               = 5254 -	SYS_LINKAT                 = 5255 -	SYS_SYMLINKAT              = 5256 -	SYS_READLINKAT             = 5257 -	SYS_FCHMODAT               = 5258 -	SYS_FACCESSAT              = 5259 -	SYS_PSELECT6               = 5260 -	SYS_PPOLL                  = 5261 -	SYS_UNSHARE                = 5262 -	SYS_SPLICE                 = 5263 -	SYS_SYNC_FILE_RANGE        = 5264 -	SYS_TEE                    = 5265 -	SYS_VMSPLICE               = 5266 -	SYS_MOVE_PAGES             = 5267 -	SYS_SET_ROBUST_LIST        = 5268 -	SYS_GET_ROBUST_LIST        = 5269 -	SYS_KEXEC_LOAD             = 5270 -	SYS_GETCPU                 = 5271 -	SYS_EPOLL_PWAIT            = 5272 -	SYS_IOPRIO_SET             = 5273 -	SYS_IOPRIO_GET             = 5274 -	SYS_UTIMENSAT              = 5275 -	SYS_SIGNALFD               = 5276 -	SYS_TIMERFD                = 5277 -	SYS_EVENTFD                = 5278 -	SYS_FALLOCATE              = 5279 -	SYS_TIMERFD_CREATE         = 5280 -	SYS_TIMERFD_GETTIME        = 5281 -	SYS_TIMERFD_SETTIME        = 5282 -	SYS_SIGNALFD4              = 5283 -	SYS_EVENTFD2               = 5284 -	SYS_EPOLL_CREATE1          = 5285 -	SYS_DUP3                   = 5286 -	SYS_PIPE2                  = 5287 -	SYS_INOTIFY_INIT1          = 5288 -	SYS_PREADV                 = 5289 -	SYS_PWRITEV                = 5290 -	SYS_RT_TGSIGQUEUEINFO      = 5291 -	SYS_PERF_EVENT_OPEN        = 5292 -	SYS_ACCEPT4                = 5293 -	SYS_RECVMMSG               = 5294 -	SYS_FANOTIFY_INIT          = 5295 -	SYS_FANOTIFY_MARK          = 5296 -	SYS_PRLIMIT64              = 5297 -	SYS_NAME_TO_HANDLE_AT      = 5298 -	SYS_OPEN_BY_HANDLE_AT      = 5299 -	SYS_CLOCK_ADJTIME          = 5300 -	SYS_SYNCFS                 = 5301 -	SYS_SENDMMSG               = 5302 -	SYS_SETNS                  = 5303 -	SYS_PROCESS_VM_READV       = 5304 -	SYS_PROCESS_VM_WRITEV      = 5305 -	SYS_KCMP                   = 5306 -	SYS_FINIT_MODULE           = 5307 -	SYS_GETDENTS64             = 5308 -	SYS_SCHED_SETATTR          = 5309 -	SYS_SCHED_GETATTR          = 5310 -	SYS_RENAMEAT2              = 5311 -	SYS_SECCOMP                = 5312 -	SYS_GETRANDOM              = 5313 -	SYS_MEMFD_CREATE           = 5314 -	SYS_BPF                    = 5315 -	SYS_EXECVEAT               = 5316 -	SYS_USERFAULTFD            = 5317 -	SYS_MEMBARRIER             = 5318 -	SYS_MLOCK2                 = 5319 -	SYS_COPY_FILE_RANGE        = 5320 -	SYS_PREADV2                = 5321 -	SYS_PWRITEV2               = 5322 -	SYS_PKEY_MPROTECT          = 5323 -	SYS_PKEY_ALLOC             = 5324 -	SYS_PKEY_FREE              = 5325 -	SYS_STATX                  = 5326 -	SYS_RSEQ                   = 5327 -	SYS_IO_PGETEVENTS          = 5328 -	SYS_PIDFD_SEND_SIGNAL      = 5424 -	SYS_IO_URING_SETUP         = 5425 -	SYS_IO_URING_ENTER         = 5426 -	SYS_IO_URING_REGISTER      = 5427 -	SYS_OPEN_TREE              = 5428 -	SYS_MOVE_MOUNT             = 5429 -	SYS_FSOPEN                 = 5430 -	SYS_FSCONFIG               = 5431 -	SYS_FSMOUNT                = 5432 -	SYS_FSPICK                 = 5433 -	SYS_PIDFD_OPEN             = 5434 -	SYS_CLONE3                 = 5435 -	SYS_CLOSE_RANGE            = 5436 -	SYS_OPENAT2                = 5437 -	SYS_PIDFD_GETFD            = 5438 -	SYS_FACCESSAT2             = 5439 -	SYS_PROCESS_MADVISE        = 5440 -	SYS_EPOLL_PWAIT2           = 5441 -	SYS_MOUNT_SETATTR          = 5442 +	SYS_READ                    = 5000 +	SYS_WRITE                   = 5001 +	SYS_OPEN                    = 5002 +	SYS_CLOSE                   = 5003 +	SYS_STAT                    = 5004 +	SYS_FSTAT                   = 5005 +	SYS_LSTAT                   = 5006 +	SYS_POLL                    = 5007 +	SYS_LSEEK                   = 5008 +	SYS_MMAP                    = 5009 +	SYS_MPROTECT                = 5010 +	SYS_MUNMAP                  = 5011 +	SYS_BRK                     = 5012 +	SYS_RT_SIGACTION            = 5013 +	SYS_RT_SIGPROCMASK          = 5014 +	SYS_IOCTL                   = 5015 +	SYS_PREAD64                 = 5016 +	SYS_PWRITE64                = 5017 +	SYS_READV                   = 5018 +	SYS_WRITEV                  = 5019 +	SYS_ACCESS                  = 5020 +	SYS_PIPE                    = 5021 +	SYS__NEWSELECT              = 5022 +	SYS_SCHED_YIELD             = 5023 +	SYS_MREMAP                  = 5024 +	SYS_MSYNC                   = 5025 +	SYS_MINCORE                 = 5026 +	SYS_MADVISE                 = 5027 +	SYS_SHMGET                  = 5028 +	SYS_SHMAT                   = 5029 +	SYS_SHMCTL                  = 5030 +	SYS_DUP                     = 5031 +	SYS_DUP2                    = 5032 +	SYS_PAUSE                   = 5033 +	SYS_NANOSLEEP               = 5034 +	SYS_GETITIMER               = 5035 +	SYS_SETITIMER               = 5036 +	SYS_ALARM                   = 5037 +	SYS_GETPID                  = 5038 +	SYS_SENDFILE                = 5039 +	SYS_SOCKET                  = 5040 +	SYS_CONNECT                 = 5041 +	SYS_ACCEPT                  = 5042 +	SYS_SENDTO                  = 5043 +	SYS_RECVFROM                = 5044 +	SYS_SENDMSG                 = 5045 +	SYS_RECVMSG                 = 5046 +	SYS_SHUTDOWN                = 5047 +	SYS_BIND                    = 5048 +	SYS_LISTEN                  = 5049 +	SYS_GETSOCKNAME             = 5050 +	SYS_GETPEERNAME             = 5051 +	SYS_SOCKETPAIR              = 5052 +	SYS_SETSOCKOPT              = 5053 +	SYS_GETSOCKOPT              = 5054 +	SYS_CLONE                   = 5055 +	SYS_FORK                    = 5056 +	SYS_EXECVE                  = 5057 +	SYS_EXIT                    = 5058 +	SYS_WAIT4                   = 5059 +	SYS_KILL                    = 5060 +	SYS_UNAME                   = 5061 +	SYS_SEMGET                  = 5062 +	SYS_SEMOP                   = 5063 +	SYS_SEMCTL                  = 5064 +	SYS_SHMDT                   = 5065 +	SYS_MSGGET                  = 5066 +	SYS_MSGSND                  = 5067 +	SYS_MSGRCV                  = 5068 +	SYS_MSGCTL                  = 5069 +	SYS_FCNTL                   = 5070 +	SYS_FLOCK                   = 5071 +	SYS_FSYNC                   = 5072 +	SYS_FDATASYNC               = 5073 +	SYS_TRUNCATE                = 5074 +	SYS_FTRUNCATE               = 5075 +	SYS_GETDENTS                = 5076 +	SYS_GETCWD                  = 5077 +	SYS_CHDIR                   = 5078 +	SYS_FCHDIR                  = 5079 +	SYS_RENAME                  = 5080 +	SYS_MKDIR                   = 5081 +	SYS_RMDIR                   = 5082 +	SYS_CREAT                   = 5083 +	SYS_LINK                    = 5084 +	SYS_UNLINK                  = 5085 +	SYS_SYMLINK                 = 5086 +	SYS_READLINK                = 5087 +	SYS_CHMOD                   = 5088 +	SYS_FCHMOD                  = 5089 +	SYS_CHOWN                   = 5090 +	SYS_FCHOWN                  = 5091 +	SYS_LCHOWN                  = 5092 +	SYS_UMASK                   = 5093 +	SYS_GETTIMEOFDAY            = 5094 +	SYS_GETRLIMIT               = 5095 +	SYS_GETRUSAGE               = 5096 +	SYS_SYSINFO                 = 5097 +	SYS_TIMES                   = 5098 +	SYS_PTRACE                  = 5099 +	SYS_GETUID                  = 5100 +	SYS_SYSLOG                  = 5101 +	SYS_GETGID                  = 5102 +	SYS_SETUID                  = 5103 +	SYS_SETGID                  = 5104 +	SYS_GETEUID                 = 5105 +	SYS_GETEGID                 = 5106 +	SYS_SETPGID                 = 5107 +	SYS_GETPPID                 = 5108 +	SYS_GETPGRP                 = 5109 +	SYS_SETSID                  = 5110 +	SYS_SETREUID                = 5111 +	SYS_SETREGID                = 5112 +	SYS_GETGROUPS               = 5113 +	SYS_SETGROUPS               = 5114 +	SYS_SETRESUID               = 5115 +	SYS_GETRESUID               = 5116 +	SYS_SETRESGID               = 5117 +	SYS_GETRESGID               = 5118 +	SYS_GETPGID                 = 5119 +	SYS_SETFSUID                = 5120 +	SYS_SETFSGID                = 5121 +	SYS_GETSID                  = 5122 +	SYS_CAPGET                  = 5123 +	SYS_CAPSET                  = 5124 +	SYS_RT_SIGPENDING           = 5125 +	SYS_RT_SIGTIMEDWAIT         = 5126 +	SYS_RT_SIGQUEUEINFO         = 5127 +	SYS_RT_SIGSUSPEND           = 5128 +	SYS_SIGALTSTACK             = 5129 +	SYS_UTIME                   = 5130 +	SYS_MKNOD                   = 5131 +	SYS_PERSONALITY             = 5132 +	SYS_USTAT                   = 5133 +	SYS_STATFS                  = 5134 +	SYS_FSTATFS                 = 5135 +	SYS_SYSFS                   = 5136 +	SYS_GETPRIORITY             = 5137 +	SYS_SETPRIORITY             = 5138 +	SYS_SCHED_SETPARAM          = 5139 +	SYS_SCHED_GETPARAM          = 5140 +	SYS_SCHED_SETSCHEDULER      = 5141 +	SYS_SCHED_GETSCHEDULER      = 5142 +	SYS_SCHED_GET_PRIORITY_MAX  = 5143 +	SYS_SCHED_GET_PRIORITY_MIN  = 5144 +	SYS_SCHED_RR_GET_INTERVAL   = 5145 +	SYS_MLOCK                   = 5146 +	SYS_MUNLOCK                 = 5147 +	SYS_MLOCKALL                = 5148 +	SYS_MUNLOCKALL              = 5149 +	SYS_VHANGUP                 = 5150 +	SYS_PIVOT_ROOT              = 5151 +	SYS__SYSCTL                 = 5152 +	SYS_PRCTL                   = 5153 +	SYS_ADJTIMEX                = 5154 +	SYS_SETRLIMIT               = 5155 +	SYS_CHROOT                  = 5156 +	SYS_SYNC                    = 5157 +	SYS_ACCT                    = 5158 +	SYS_SETTIMEOFDAY            = 5159 +	SYS_MOUNT                   = 5160 +	SYS_UMOUNT2                 = 5161 +	SYS_SWAPON                  = 5162 +	SYS_SWAPOFF                 = 5163 +	SYS_REBOOT                  = 5164 +	SYS_SETHOSTNAME             = 5165 +	SYS_SETDOMAINNAME           = 5166 +	SYS_CREATE_MODULE           = 5167 +	SYS_INIT_MODULE             = 5168 +	SYS_DELETE_MODULE           = 5169 +	SYS_GET_KERNEL_SYMS         = 5170 +	SYS_QUERY_MODULE            = 5171 +	SYS_QUOTACTL                = 5172 +	SYS_NFSSERVCTL              = 5173 +	SYS_GETPMSG                 = 5174 +	SYS_PUTPMSG                 = 5175 +	SYS_AFS_SYSCALL             = 5176 +	SYS_RESERVED177             = 5177 +	SYS_GETTID                  = 5178 +	SYS_READAHEAD               = 5179 +	SYS_SETXATTR                = 5180 +	SYS_LSETXATTR               = 5181 +	SYS_FSETXATTR               = 5182 +	SYS_GETXATTR                = 5183 +	SYS_LGETXATTR               = 5184 +	SYS_FGETXATTR               = 5185 +	SYS_LISTXATTR               = 5186 +	SYS_LLISTXATTR              = 5187 +	SYS_FLISTXATTR              = 5188 +	SYS_REMOVEXATTR             = 5189 +	SYS_LREMOVEXATTR            = 5190 +	SYS_FREMOVEXATTR            = 5191 +	SYS_TKILL                   = 5192 +	SYS_RESERVED193             = 5193 +	SYS_FUTEX                   = 5194 +	SYS_SCHED_SETAFFINITY       = 5195 +	SYS_SCHED_GETAFFINITY       = 5196 +	SYS_CACHEFLUSH              = 5197 +	SYS_CACHECTL                = 5198 +	SYS_SYSMIPS                 = 5199 +	SYS_IO_SETUP                = 5200 +	SYS_IO_DESTROY              = 5201 +	SYS_IO_GETEVENTS            = 5202 +	SYS_IO_SUBMIT               = 5203 +	SYS_IO_CANCEL               = 5204 +	SYS_EXIT_GROUP              = 5205 +	SYS_LOOKUP_DCOOKIE          = 5206 +	SYS_EPOLL_CREATE            = 5207 +	SYS_EPOLL_CTL               = 5208 +	SYS_EPOLL_WAIT              = 5209 +	SYS_REMAP_FILE_PAGES        = 5210 +	SYS_RT_SIGRETURN            = 5211 +	SYS_SET_TID_ADDRESS         = 5212 +	SYS_RESTART_SYSCALL         = 5213 +	SYS_SEMTIMEDOP              = 5214 +	SYS_FADVISE64               = 5215 +	SYS_TIMER_CREATE            = 5216 +	SYS_TIMER_SETTIME           = 5217 +	SYS_TIMER_GETTIME           = 5218 +	SYS_TIMER_GETOVERRUN        = 5219 +	SYS_TIMER_DELETE            = 5220 +	SYS_CLOCK_SETTIME           = 5221 +	SYS_CLOCK_GETTIME           = 5222 +	SYS_CLOCK_GETRES            = 5223 +	SYS_CLOCK_NANOSLEEP         = 5224 +	SYS_TGKILL                  = 5225 +	SYS_UTIMES                  = 5226 +	SYS_MBIND                   = 5227 +	SYS_GET_MEMPOLICY           = 5228 +	SYS_SET_MEMPOLICY           = 5229 +	SYS_MQ_OPEN                 = 5230 +	SYS_MQ_UNLINK               = 5231 +	SYS_MQ_TIMEDSEND            = 5232 +	SYS_MQ_TIMEDRECEIVE         = 5233 +	SYS_MQ_NOTIFY               = 5234 +	SYS_MQ_GETSETATTR           = 5235 +	SYS_VSERVER                 = 5236 +	SYS_WAITID                  = 5237 +	SYS_ADD_KEY                 = 5239 +	SYS_REQUEST_KEY             = 5240 +	SYS_KEYCTL                  = 5241 +	SYS_SET_THREAD_AREA         = 5242 +	SYS_INOTIFY_INIT            = 5243 +	SYS_INOTIFY_ADD_WATCH       = 5244 +	SYS_INOTIFY_RM_WATCH        = 5245 +	SYS_MIGRATE_PAGES           = 5246 +	SYS_OPENAT                  = 5247 +	SYS_MKDIRAT                 = 5248 +	SYS_MKNODAT                 = 5249 +	SYS_FCHOWNAT                = 5250 +	SYS_FUTIMESAT               = 5251 +	SYS_NEWFSTATAT              = 5252 +	SYS_UNLINKAT                = 5253 +	SYS_RENAMEAT                = 5254 +	SYS_LINKAT                  = 5255 +	SYS_SYMLINKAT               = 5256 +	SYS_READLINKAT              = 5257 +	SYS_FCHMODAT                = 5258 +	SYS_FACCESSAT               = 5259 +	SYS_PSELECT6                = 5260 +	SYS_PPOLL                   = 5261 +	SYS_UNSHARE                 = 5262 +	SYS_SPLICE                  = 5263 +	SYS_SYNC_FILE_RANGE         = 5264 +	SYS_TEE                     = 5265 +	SYS_VMSPLICE                = 5266 +	SYS_MOVE_PAGES              = 5267 +	SYS_SET_ROBUST_LIST         = 5268 +	SYS_GET_ROBUST_LIST         = 5269 +	SYS_KEXEC_LOAD              = 5270 +	SYS_GETCPU                  = 5271 +	SYS_EPOLL_PWAIT             = 5272 +	SYS_IOPRIO_SET              = 5273 +	SYS_IOPRIO_GET              = 5274 +	SYS_UTIMENSAT               = 5275 +	SYS_SIGNALFD                = 5276 +	SYS_TIMERFD                 = 5277 +	SYS_EVENTFD                 = 5278 +	SYS_FALLOCATE               = 5279 +	SYS_TIMERFD_CREATE          = 5280 +	SYS_TIMERFD_GETTIME         = 5281 +	SYS_TIMERFD_SETTIME         = 5282 +	SYS_SIGNALFD4               = 5283 +	SYS_EVENTFD2                = 5284 +	SYS_EPOLL_CREATE1           = 5285 +	SYS_DUP3                    = 5286 +	SYS_PIPE2                   = 5287 +	SYS_INOTIFY_INIT1           = 5288 +	SYS_PREADV                  = 5289 +	SYS_PWRITEV                 = 5290 +	SYS_RT_TGSIGQUEUEINFO       = 5291 +	SYS_PERF_EVENT_OPEN         = 5292 +	SYS_ACCEPT4                 = 5293 +	SYS_RECVMMSG                = 5294 +	SYS_FANOTIFY_INIT           = 5295 +	SYS_FANOTIFY_MARK           = 5296 +	SYS_PRLIMIT64               = 5297 +	SYS_NAME_TO_HANDLE_AT       = 5298 +	SYS_OPEN_BY_HANDLE_AT       = 5299 +	SYS_CLOCK_ADJTIME           = 5300 +	SYS_SYNCFS                  = 5301 +	SYS_SENDMMSG                = 5302 +	SYS_SETNS                   = 5303 +	SYS_PROCESS_VM_READV        = 5304 +	SYS_PROCESS_VM_WRITEV       = 5305 +	SYS_KCMP                    = 5306 +	SYS_FINIT_MODULE            = 5307 +	SYS_GETDENTS64              = 5308 +	SYS_SCHED_SETATTR           = 5309 +	SYS_SCHED_GETATTR           = 5310 +	SYS_RENAMEAT2               = 5311 +	SYS_SECCOMP                 = 5312 +	SYS_GETRANDOM               = 5313 +	SYS_MEMFD_CREATE            = 5314 +	SYS_BPF                     = 5315 +	SYS_EXECVEAT                = 5316 +	SYS_USERFAULTFD             = 5317 +	SYS_MEMBARRIER              = 5318 +	SYS_MLOCK2                  = 5319 +	SYS_COPY_FILE_RANGE         = 5320 +	SYS_PREADV2                 = 5321 +	SYS_PWRITEV2                = 5322 +	SYS_PKEY_MPROTECT           = 5323 +	SYS_PKEY_ALLOC              = 5324 +	SYS_PKEY_FREE               = 5325 +	SYS_STATX                   = 5326 +	SYS_RSEQ                    = 5327 +	SYS_IO_PGETEVENTS           = 5328 +	SYS_PIDFD_SEND_SIGNAL       = 5424 +	SYS_IO_URING_SETUP          = 5425 +	SYS_IO_URING_ENTER          = 5426 +	SYS_IO_URING_REGISTER       = 5427 +	SYS_OPEN_TREE               = 5428 +	SYS_MOVE_MOUNT              = 5429 +	SYS_FSOPEN                  = 5430 +	SYS_FSCONFIG                = 5431 +	SYS_FSMOUNT                 = 5432 +	SYS_FSPICK                  = 5433 +	SYS_PIDFD_OPEN              = 5434 +	SYS_CLONE3                  = 5435 +	SYS_CLOSE_RANGE             = 5436 +	SYS_OPENAT2                 = 5437 +	SYS_PIDFD_GETFD             = 5438 +	SYS_FACCESSAT2              = 5439 +	SYS_PROCESS_MADVISE         = 5440 +	SYS_EPOLL_PWAIT2            = 5441 +	SYS_MOUNT_SETATTR           = 5442 +	SYS_LANDLOCK_CREATE_RULESET = 5444 +	SYS_LANDLOCK_ADD_RULE       = 5445 +	SYS_LANDLOCK_RESTRICT_SELF  = 5446  ) diff --git a/vendor/golang.org/x/sys/unix/zsysnum_linux_mipsle.go b/vendor/golang.org/x/sys/unix/zsysnum_linux_mipsle.go index 80e6696b3..dcd926513 100644 --- a/vendor/golang.org/x/sys/unix/zsysnum_linux_mipsle.go +++ b/vendor/golang.org/x/sys/unix/zsysnum_linux_mipsle.go @@ -424,4 +424,7 @@ const (  	SYS_PROCESS_MADVISE              = 4440  	SYS_EPOLL_PWAIT2                 = 4441  	SYS_MOUNT_SETATTR                = 4442 +	SYS_LANDLOCK_CREATE_RULESET      = 4444 +	SYS_LANDLOCK_ADD_RULE            = 4445 +	SYS_LANDLOCK_RESTRICT_SELF       = 4446  ) diff --git a/vendor/golang.org/x/sys/unix/zsysnum_linux_ppc.go b/vendor/golang.org/x/sys/unix/zsysnum_linux_ppc.go index b9d697ffb..d5ee2c935 100644 --- a/vendor/golang.org/x/sys/unix/zsysnum_linux_ppc.go +++ b/vendor/golang.org/x/sys/unix/zsysnum_linux_ppc.go @@ -431,4 +431,7 @@ const (  	SYS_PROCESS_MADVISE              = 440  	SYS_EPOLL_PWAIT2                 = 441  	SYS_MOUNT_SETATTR                = 442 +	SYS_LANDLOCK_CREATE_RULESET      = 444 +	SYS_LANDLOCK_ADD_RULE            = 445 +	SYS_LANDLOCK_RESTRICT_SELF       = 446  ) diff --git a/vendor/golang.org/x/sys/unix/zsysnum_linux_ppc64.go b/vendor/golang.org/x/sys/unix/zsysnum_linux_ppc64.go index 08edc54d3..fec32207c 100644 --- a/vendor/golang.org/x/sys/unix/zsysnum_linux_ppc64.go +++ b/vendor/golang.org/x/sys/unix/zsysnum_linux_ppc64.go @@ -7,400 +7,403 @@  package unix  const ( -	SYS_RESTART_SYSCALL        = 0 -	SYS_EXIT                   = 1 -	SYS_FORK                   = 2 -	SYS_READ                   = 3 -	SYS_WRITE                  = 4 -	SYS_OPEN                   = 5 -	SYS_CLOSE                  = 6 -	SYS_WAITPID                = 7 -	SYS_CREAT                  = 8 -	SYS_LINK                   = 9 -	SYS_UNLINK                 = 10 -	SYS_EXECVE                 = 11 -	SYS_CHDIR                  = 12 -	SYS_TIME                   = 13 -	SYS_MKNOD                  = 14 -	SYS_CHMOD                  = 15 -	SYS_LCHOWN                 = 16 -	SYS_BREAK                  = 17 -	SYS_OLDSTAT                = 18 -	SYS_LSEEK                  = 19 -	SYS_GETPID                 = 20 -	SYS_MOUNT                  = 21 -	SYS_UMOUNT                 = 22 -	SYS_SETUID                 = 23 -	SYS_GETUID                 = 24 -	SYS_STIME                  = 25 -	SYS_PTRACE                 = 26 -	SYS_ALARM                  = 27 -	SYS_OLDFSTAT               = 28 -	SYS_PAUSE                  = 29 -	SYS_UTIME                  = 30 -	SYS_STTY                   = 31 -	SYS_GTTY                   = 32 -	SYS_ACCESS                 = 33 -	SYS_NICE                   = 34 -	SYS_FTIME                  = 35 -	SYS_SYNC                   = 36 -	SYS_KILL                   = 37 -	SYS_RENAME                 = 38 -	SYS_MKDIR                  = 39 -	SYS_RMDIR                  = 40 -	SYS_DUP                    = 41 -	SYS_PIPE                   = 42 -	SYS_TIMES                  = 43 -	SYS_PROF                   = 44 -	SYS_BRK                    = 45 -	SYS_SETGID                 = 46 -	SYS_GETGID                 = 47 -	SYS_SIGNAL                 = 48 -	SYS_GETEUID                = 49 -	SYS_GETEGID                = 50 -	SYS_ACCT                   = 51 -	SYS_UMOUNT2                = 52 -	SYS_LOCK                   = 53 -	SYS_IOCTL                  = 54 -	SYS_FCNTL                  = 55 -	SYS_MPX                    = 56 -	SYS_SETPGID                = 57 -	SYS_ULIMIT                 = 58 -	SYS_OLDOLDUNAME            = 59 -	SYS_UMASK                  = 60 -	SYS_CHROOT                 = 61 -	SYS_USTAT                  = 62 -	SYS_DUP2                   = 63 -	SYS_GETPPID                = 64 -	SYS_GETPGRP                = 65 -	SYS_SETSID                 = 66 -	SYS_SIGACTION              = 67 -	SYS_SGETMASK               = 68 -	SYS_SSETMASK               = 69 -	SYS_SETREUID               = 70 -	SYS_SETREGID               = 71 -	SYS_SIGSUSPEND             = 72 -	SYS_SIGPENDING             = 73 -	SYS_SETHOSTNAME            = 74 -	SYS_SETRLIMIT              = 75 -	SYS_GETRLIMIT              = 76 -	SYS_GETRUSAGE              = 77 -	SYS_GETTIMEOFDAY           = 78 -	SYS_SETTIMEOFDAY           = 79 -	SYS_GETGROUPS              = 80 -	SYS_SETGROUPS              = 81 -	SYS_SELECT                 = 82 -	SYS_SYMLINK                = 83 -	SYS_OLDLSTAT               = 84 -	SYS_READLINK               = 85 -	SYS_USELIB                 = 86 -	SYS_SWAPON                 = 87 -	SYS_REBOOT                 = 88 -	SYS_READDIR                = 89 -	SYS_MMAP                   = 90 -	SYS_MUNMAP                 = 91 -	SYS_TRUNCATE               = 92 -	SYS_FTRUNCATE              = 93 -	SYS_FCHMOD                 = 94 -	SYS_FCHOWN                 = 95 -	SYS_GETPRIORITY            = 96 -	SYS_SETPRIORITY            = 97 -	SYS_PROFIL                 = 98 -	SYS_STATFS                 = 99 -	SYS_FSTATFS                = 100 -	SYS_IOPERM                 = 101 -	SYS_SOCKETCALL             = 102 -	SYS_SYSLOG                 = 103 -	SYS_SETITIMER              = 104 -	SYS_GETITIMER              = 105 -	SYS_STAT                   = 106 -	SYS_LSTAT                  = 107 -	SYS_FSTAT                  = 108 -	SYS_OLDUNAME               = 109 -	SYS_IOPL                   = 110 -	SYS_VHANGUP                = 111 -	SYS_IDLE                   = 112 -	SYS_VM86                   = 113 -	SYS_WAIT4                  = 114 -	SYS_SWAPOFF                = 115 -	SYS_SYSINFO                = 116 -	SYS_IPC                    = 117 -	SYS_FSYNC                  = 118 -	SYS_SIGRETURN              = 119 -	SYS_CLONE                  = 120 -	SYS_SETDOMAINNAME          = 121 -	SYS_UNAME                  = 122 -	SYS_MODIFY_LDT             = 123 -	SYS_ADJTIMEX               = 124 -	SYS_MPROTECT               = 125 -	SYS_SIGPROCMASK            = 126 -	SYS_CREATE_MODULE          = 127 -	SYS_INIT_MODULE            = 128 -	SYS_DELETE_MODULE          = 129 -	SYS_GET_KERNEL_SYMS        = 130 -	SYS_QUOTACTL               = 131 -	SYS_GETPGID                = 132 -	SYS_FCHDIR                 = 133 -	SYS_BDFLUSH                = 134 -	SYS_SYSFS                  = 135 -	SYS_PERSONALITY            = 136 -	SYS_AFS_SYSCALL            = 137 -	SYS_SETFSUID               = 138 -	SYS_SETFSGID               = 139 -	SYS__LLSEEK                = 140 -	SYS_GETDENTS               = 141 -	SYS__NEWSELECT             = 142 -	SYS_FLOCK                  = 143 -	SYS_MSYNC                  = 144 -	SYS_READV                  = 145 -	SYS_WRITEV                 = 146 -	SYS_GETSID                 = 147 -	SYS_FDATASYNC              = 148 -	SYS__SYSCTL                = 149 -	SYS_MLOCK                  = 150 -	SYS_MUNLOCK                = 151 -	SYS_MLOCKALL               = 152 -	SYS_MUNLOCKALL             = 153 -	SYS_SCHED_SETPARAM         = 154 -	SYS_SCHED_GETPARAM         = 155 -	SYS_SCHED_SETSCHEDULER     = 156 -	SYS_SCHED_GETSCHEDULER     = 157 -	SYS_SCHED_YIELD            = 158 -	SYS_SCHED_GET_PRIORITY_MAX = 159 -	SYS_SCHED_GET_PRIORITY_MIN = 160 -	SYS_SCHED_RR_GET_INTERVAL  = 161 -	SYS_NANOSLEEP              = 162 -	SYS_MREMAP                 = 163 -	SYS_SETRESUID              = 164 -	SYS_GETRESUID              = 165 -	SYS_QUERY_MODULE           = 166 -	SYS_POLL                   = 167 -	SYS_NFSSERVCTL             = 168 -	SYS_SETRESGID              = 169 -	SYS_GETRESGID              = 170 -	SYS_PRCTL                  = 171 -	SYS_RT_SIGRETURN           = 172 -	SYS_RT_SIGACTION           = 173 -	SYS_RT_SIGPROCMASK         = 174 -	SYS_RT_SIGPENDING          = 175 -	SYS_RT_SIGTIMEDWAIT        = 176 -	SYS_RT_SIGQUEUEINFO        = 177 -	SYS_RT_SIGSUSPEND          = 178 -	SYS_PREAD64                = 179 -	SYS_PWRITE64               = 180 -	SYS_CHOWN                  = 181 -	SYS_GETCWD                 = 182 -	SYS_CAPGET                 = 183 -	SYS_CAPSET                 = 184 -	SYS_SIGALTSTACK            = 185 -	SYS_SENDFILE               = 186 -	SYS_GETPMSG                = 187 -	SYS_PUTPMSG                = 188 -	SYS_VFORK                  = 189 -	SYS_UGETRLIMIT             = 190 -	SYS_READAHEAD              = 191 -	SYS_PCICONFIG_READ         = 198 -	SYS_PCICONFIG_WRITE        = 199 -	SYS_PCICONFIG_IOBASE       = 200 -	SYS_MULTIPLEXER            = 201 -	SYS_GETDENTS64             = 202 -	SYS_PIVOT_ROOT             = 203 -	SYS_MADVISE                = 205 -	SYS_MINCORE                = 206 -	SYS_GETTID                 = 207 -	SYS_TKILL                  = 208 -	SYS_SETXATTR               = 209 -	SYS_LSETXATTR              = 210 -	SYS_FSETXATTR              = 211 -	SYS_GETXATTR               = 212 -	SYS_LGETXATTR              = 213 -	SYS_FGETXATTR              = 214 -	SYS_LISTXATTR              = 215 -	SYS_LLISTXATTR             = 216 -	SYS_FLISTXATTR             = 217 -	SYS_REMOVEXATTR            = 218 -	SYS_LREMOVEXATTR           = 219 -	SYS_FREMOVEXATTR           = 220 -	SYS_FUTEX                  = 221 -	SYS_SCHED_SETAFFINITY      = 222 -	SYS_SCHED_GETAFFINITY      = 223 -	SYS_TUXCALL                = 225 -	SYS_IO_SETUP               = 227 -	SYS_IO_DESTROY             = 228 -	SYS_IO_GETEVENTS           = 229 -	SYS_IO_SUBMIT              = 230 -	SYS_IO_CANCEL              = 231 -	SYS_SET_TID_ADDRESS        = 232 -	SYS_FADVISE64              = 233 -	SYS_EXIT_GROUP             = 234 -	SYS_LOOKUP_DCOOKIE         = 235 -	SYS_EPOLL_CREATE           = 236 -	SYS_EPOLL_CTL              = 237 -	SYS_EPOLL_WAIT             = 238 -	SYS_REMAP_FILE_PAGES       = 239 -	SYS_TIMER_CREATE           = 240 -	SYS_TIMER_SETTIME          = 241 -	SYS_TIMER_GETTIME          = 242 -	SYS_TIMER_GETOVERRUN       = 243 -	SYS_TIMER_DELETE           = 244 -	SYS_CLOCK_SETTIME          = 245 -	SYS_CLOCK_GETTIME          = 246 -	SYS_CLOCK_GETRES           = 247 -	SYS_CLOCK_NANOSLEEP        = 248 -	SYS_SWAPCONTEXT            = 249 -	SYS_TGKILL                 = 250 -	SYS_UTIMES                 = 251 -	SYS_STATFS64               = 252 -	SYS_FSTATFS64              = 253 -	SYS_RTAS                   = 255 -	SYS_SYS_DEBUG_SETCONTEXT   = 256 -	SYS_MIGRATE_PAGES          = 258 -	SYS_MBIND                  = 259 -	SYS_GET_MEMPOLICY          = 260 -	SYS_SET_MEMPOLICY          = 261 -	SYS_MQ_OPEN                = 262 -	SYS_MQ_UNLINK              = 263 -	SYS_MQ_TIMEDSEND           = 264 -	SYS_MQ_TIMEDRECEIVE        = 265 -	SYS_MQ_NOTIFY              = 266 -	SYS_MQ_GETSETATTR          = 267 -	SYS_KEXEC_LOAD             = 268 -	SYS_ADD_KEY                = 269 -	SYS_REQUEST_KEY            = 270 -	SYS_KEYCTL                 = 271 -	SYS_WAITID                 = 272 -	SYS_IOPRIO_SET             = 273 -	SYS_IOPRIO_GET             = 274 -	SYS_INOTIFY_INIT           = 275 -	SYS_INOTIFY_ADD_WATCH      = 276 -	SYS_INOTIFY_RM_WATCH       = 277 -	SYS_SPU_RUN                = 278 -	SYS_SPU_CREATE             = 279 -	SYS_PSELECT6               = 280 -	SYS_PPOLL                  = 281 -	SYS_UNSHARE                = 282 -	SYS_SPLICE                 = 283 -	SYS_TEE                    = 284 -	SYS_VMSPLICE               = 285 -	SYS_OPENAT                 = 286 -	SYS_MKDIRAT                = 287 -	SYS_MKNODAT                = 288 -	SYS_FCHOWNAT               = 289 -	SYS_FUTIMESAT              = 290 -	SYS_NEWFSTATAT             = 291 -	SYS_UNLINKAT               = 292 -	SYS_RENAMEAT               = 293 -	SYS_LINKAT                 = 294 -	SYS_SYMLINKAT              = 295 -	SYS_READLINKAT             = 296 -	SYS_FCHMODAT               = 297 -	SYS_FACCESSAT              = 298 -	SYS_GET_ROBUST_LIST        = 299 -	SYS_SET_ROBUST_LIST        = 300 -	SYS_MOVE_PAGES             = 301 -	SYS_GETCPU                 = 302 -	SYS_EPOLL_PWAIT            = 303 -	SYS_UTIMENSAT              = 304 -	SYS_SIGNALFD               = 305 -	SYS_TIMERFD_CREATE         = 306 -	SYS_EVENTFD                = 307 -	SYS_SYNC_FILE_RANGE2       = 308 -	SYS_FALLOCATE              = 309 -	SYS_SUBPAGE_PROT           = 310 -	SYS_TIMERFD_SETTIME        = 311 -	SYS_TIMERFD_GETTIME        = 312 -	SYS_SIGNALFD4              = 313 -	SYS_EVENTFD2               = 314 -	SYS_EPOLL_CREATE1          = 315 -	SYS_DUP3                   = 316 -	SYS_PIPE2                  = 317 -	SYS_INOTIFY_INIT1          = 318 -	SYS_PERF_EVENT_OPEN        = 319 -	SYS_PREADV                 = 320 -	SYS_PWRITEV                = 321 -	SYS_RT_TGSIGQUEUEINFO      = 322 -	SYS_FANOTIFY_INIT          = 323 -	SYS_FANOTIFY_MARK          = 324 -	SYS_PRLIMIT64              = 325 -	SYS_SOCKET                 = 326 -	SYS_BIND                   = 327 -	SYS_CONNECT                = 328 -	SYS_LISTEN                 = 329 -	SYS_ACCEPT                 = 330 -	SYS_GETSOCKNAME            = 331 -	SYS_GETPEERNAME            = 332 -	SYS_SOCKETPAIR             = 333 -	SYS_SEND                   = 334 -	SYS_SENDTO                 = 335 -	SYS_RECV                   = 336 -	SYS_RECVFROM               = 337 -	SYS_SHUTDOWN               = 338 -	SYS_SETSOCKOPT             = 339 -	SYS_GETSOCKOPT             = 340 -	SYS_SENDMSG                = 341 -	SYS_RECVMSG                = 342 -	SYS_RECVMMSG               = 343 -	SYS_ACCEPT4                = 344 -	SYS_NAME_TO_HANDLE_AT      = 345 -	SYS_OPEN_BY_HANDLE_AT      = 346 -	SYS_CLOCK_ADJTIME          = 347 -	SYS_SYNCFS                 = 348 -	SYS_SENDMMSG               = 349 -	SYS_SETNS                  = 350 -	SYS_PROCESS_VM_READV       = 351 -	SYS_PROCESS_VM_WRITEV      = 352 -	SYS_FINIT_MODULE           = 353 -	SYS_KCMP                   = 354 -	SYS_SCHED_SETATTR          = 355 -	SYS_SCHED_GETATTR          = 356 -	SYS_RENAMEAT2              = 357 -	SYS_SECCOMP                = 358 -	SYS_GETRANDOM              = 359 -	SYS_MEMFD_CREATE           = 360 -	SYS_BPF                    = 361 -	SYS_EXECVEAT               = 362 -	SYS_SWITCH_ENDIAN          = 363 -	SYS_USERFAULTFD            = 364 -	SYS_MEMBARRIER             = 365 -	SYS_MLOCK2                 = 378 -	SYS_COPY_FILE_RANGE        = 379 -	SYS_PREADV2                = 380 -	SYS_PWRITEV2               = 381 -	SYS_KEXEC_FILE_LOAD        = 382 -	SYS_STATX                  = 383 -	SYS_PKEY_ALLOC             = 384 -	SYS_PKEY_FREE              = 385 -	SYS_PKEY_MPROTECT          = 386 -	SYS_RSEQ                   = 387 -	SYS_IO_PGETEVENTS          = 388 -	SYS_SEMTIMEDOP             = 392 -	SYS_SEMGET                 = 393 -	SYS_SEMCTL                 = 394 -	SYS_SHMGET                 = 395 -	SYS_SHMCTL                 = 396 -	SYS_SHMAT                  = 397 -	SYS_SHMDT                  = 398 -	SYS_MSGGET                 = 399 -	SYS_MSGSND                 = 400 -	SYS_MSGRCV                 = 401 -	SYS_MSGCTL                 = 402 -	SYS_PIDFD_SEND_SIGNAL      = 424 -	SYS_IO_URING_SETUP         = 425 -	SYS_IO_URING_ENTER         = 426 -	SYS_IO_URING_REGISTER      = 427 -	SYS_OPEN_TREE              = 428 -	SYS_MOVE_MOUNT             = 429 -	SYS_FSOPEN                 = 430 -	SYS_FSCONFIG               = 431 -	SYS_FSMOUNT                = 432 -	SYS_FSPICK                 = 433 -	SYS_PIDFD_OPEN             = 434 -	SYS_CLONE3                 = 435 -	SYS_CLOSE_RANGE            = 436 -	SYS_OPENAT2                = 437 -	SYS_PIDFD_GETFD            = 438 -	SYS_FACCESSAT2             = 439 -	SYS_PROCESS_MADVISE        = 440 -	SYS_EPOLL_PWAIT2           = 441 -	SYS_MOUNT_SETATTR          = 442 +	SYS_RESTART_SYSCALL         = 0 +	SYS_EXIT                    = 1 +	SYS_FORK                    = 2 +	SYS_READ                    = 3 +	SYS_WRITE                   = 4 +	SYS_OPEN                    = 5 +	SYS_CLOSE                   = 6 +	SYS_WAITPID                 = 7 +	SYS_CREAT                   = 8 +	SYS_LINK                    = 9 +	SYS_UNLINK                  = 10 +	SYS_EXECVE                  = 11 +	SYS_CHDIR                   = 12 +	SYS_TIME                    = 13 +	SYS_MKNOD                   = 14 +	SYS_CHMOD                   = 15 +	SYS_LCHOWN                  = 16 +	SYS_BREAK                   = 17 +	SYS_OLDSTAT                 = 18 +	SYS_LSEEK                   = 19 +	SYS_GETPID                  = 20 +	SYS_MOUNT                   = 21 +	SYS_UMOUNT                  = 22 +	SYS_SETUID                  = 23 +	SYS_GETUID                  = 24 +	SYS_STIME                   = 25 +	SYS_PTRACE                  = 26 +	SYS_ALARM                   = 27 +	SYS_OLDFSTAT                = 28 +	SYS_PAUSE                   = 29 +	SYS_UTIME                   = 30 +	SYS_STTY                    = 31 +	SYS_GTTY                    = 32 +	SYS_ACCESS                  = 33 +	SYS_NICE                    = 34 +	SYS_FTIME                   = 35 +	SYS_SYNC                    = 36 +	SYS_KILL                    = 37 +	SYS_RENAME                  = 38 +	SYS_MKDIR                   = 39 +	SYS_RMDIR                   = 40 +	SYS_DUP                     = 41 +	SYS_PIPE                    = 42 +	SYS_TIMES                   = 43 +	SYS_PROF                    = 44 +	SYS_BRK                     = 45 +	SYS_SETGID                  = 46 +	SYS_GETGID                  = 47 +	SYS_SIGNAL                  = 48 +	SYS_GETEUID                 = 49 +	SYS_GETEGID                 = 50 +	SYS_ACCT                    = 51 +	SYS_UMOUNT2                 = 52 +	SYS_LOCK                    = 53 +	SYS_IOCTL                   = 54 +	SYS_FCNTL                   = 55 +	SYS_MPX                     = 56 +	SYS_SETPGID                 = 57 +	SYS_ULIMIT                  = 58 +	SYS_OLDOLDUNAME             = 59 +	SYS_UMASK                   = 60 +	SYS_CHROOT                  = 61 +	SYS_USTAT                   = 62 +	SYS_DUP2                    = 63 +	SYS_GETPPID                 = 64 +	SYS_GETPGRP                 = 65 +	SYS_SETSID                  = 66 +	SYS_SIGACTION               = 67 +	SYS_SGETMASK                = 68 +	SYS_SSETMASK                = 69 +	SYS_SETREUID                = 70 +	SYS_SETREGID                = 71 +	SYS_SIGSUSPEND              = 72 +	SYS_SIGPENDING              = 73 +	SYS_SETHOSTNAME             = 74 +	SYS_SETRLIMIT               = 75 +	SYS_GETRLIMIT               = 76 +	SYS_GETRUSAGE               = 77 +	SYS_GETTIMEOFDAY            = 78 +	SYS_SETTIMEOFDAY            = 79 +	SYS_GETGROUPS               = 80 +	SYS_SETGROUPS               = 81 +	SYS_SELECT                  = 82 +	SYS_SYMLINK                 = 83 +	SYS_OLDLSTAT                = 84 +	SYS_READLINK                = 85 +	SYS_USELIB                  = 86 +	SYS_SWAPON                  = 87 +	SYS_REBOOT                  = 88 +	SYS_READDIR                 = 89 +	SYS_MMAP                    = 90 +	SYS_MUNMAP                  = 91 +	SYS_TRUNCATE                = 92 +	SYS_FTRUNCATE               = 93 +	SYS_FCHMOD                  = 94 +	SYS_FCHOWN                  = 95 +	SYS_GETPRIORITY             = 96 +	SYS_SETPRIORITY             = 97 +	SYS_PROFIL                  = 98 +	SYS_STATFS                  = 99 +	SYS_FSTATFS                 = 100 +	SYS_IOPERM                  = 101 +	SYS_SOCKETCALL              = 102 +	SYS_SYSLOG                  = 103 +	SYS_SETITIMER               = 104 +	SYS_GETITIMER               = 105 +	SYS_STAT                    = 106 +	SYS_LSTAT                   = 107 +	SYS_FSTAT                   = 108 +	SYS_OLDUNAME                = 109 +	SYS_IOPL                    = 110 +	SYS_VHANGUP                 = 111 +	SYS_IDLE                    = 112 +	SYS_VM86                    = 113 +	SYS_WAIT4                   = 114 +	SYS_SWAPOFF                 = 115 +	SYS_SYSINFO                 = 116 +	SYS_IPC                     = 117 +	SYS_FSYNC                   = 118 +	SYS_SIGRETURN               = 119 +	SYS_CLONE                   = 120 +	SYS_SETDOMAINNAME           = 121 +	SYS_UNAME                   = 122 +	SYS_MODIFY_LDT              = 123 +	SYS_ADJTIMEX                = 124 +	SYS_MPROTECT                = 125 +	SYS_SIGPROCMASK             = 126 +	SYS_CREATE_MODULE           = 127 +	SYS_INIT_MODULE             = 128 +	SYS_DELETE_MODULE           = 129 +	SYS_GET_KERNEL_SYMS         = 130 +	SYS_QUOTACTL                = 131 +	SYS_GETPGID                 = 132 +	SYS_FCHDIR                  = 133 +	SYS_BDFLUSH                 = 134 +	SYS_SYSFS                   = 135 +	SYS_PERSONALITY             = 136 +	SYS_AFS_SYSCALL             = 137 +	SYS_SETFSUID                = 138 +	SYS_SETFSGID                = 139 +	SYS__LLSEEK                 = 140 +	SYS_GETDENTS                = 141 +	SYS__NEWSELECT              = 142 +	SYS_FLOCK                   = 143 +	SYS_MSYNC                   = 144 +	SYS_READV                   = 145 +	SYS_WRITEV                  = 146 +	SYS_GETSID                  = 147 +	SYS_FDATASYNC               = 148 +	SYS__SYSCTL                 = 149 +	SYS_MLOCK                   = 150 +	SYS_MUNLOCK                 = 151 +	SYS_MLOCKALL                = 152 +	SYS_MUNLOCKALL              = 153 +	SYS_SCHED_SETPARAM          = 154 +	SYS_SCHED_GETPARAM          = 155 +	SYS_SCHED_SETSCHEDULER      = 156 +	SYS_SCHED_GETSCHEDULER      = 157 +	SYS_SCHED_YIELD             = 158 +	SYS_SCHED_GET_PRIORITY_MAX  = 159 +	SYS_SCHED_GET_PRIORITY_MIN  = 160 +	SYS_SCHED_RR_GET_INTERVAL   = 161 +	SYS_NANOSLEEP               = 162 +	SYS_MREMAP                  = 163 +	SYS_SETRESUID               = 164 +	SYS_GETRESUID               = 165 +	SYS_QUERY_MODULE            = 166 +	SYS_POLL                    = 167 +	SYS_NFSSERVCTL              = 168 +	SYS_SETRESGID               = 169 +	SYS_GETRESGID               = 170 +	SYS_PRCTL                   = 171 +	SYS_RT_SIGRETURN            = 172 +	SYS_RT_SIGACTION            = 173 +	SYS_RT_SIGPROCMASK          = 174 +	SYS_RT_SIGPENDING           = 175 +	SYS_RT_SIGTIMEDWAIT         = 176 +	SYS_RT_SIGQUEUEINFO         = 177 +	SYS_RT_SIGSUSPEND           = 178 +	SYS_PREAD64                 = 179 +	SYS_PWRITE64                = 180 +	SYS_CHOWN                   = 181 +	SYS_GETCWD                  = 182 +	SYS_CAPGET                  = 183 +	SYS_CAPSET                  = 184 +	SYS_SIGALTSTACK             = 185 +	SYS_SENDFILE                = 186 +	SYS_GETPMSG                 = 187 +	SYS_PUTPMSG                 = 188 +	SYS_VFORK                   = 189 +	SYS_UGETRLIMIT              = 190 +	SYS_READAHEAD               = 191 +	SYS_PCICONFIG_READ          = 198 +	SYS_PCICONFIG_WRITE         = 199 +	SYS_PCICONFIG_IOBASE        = 200 +	SYS_MULTIPLEXER             = 201 +	SYS_GETDENTS64              = 202 +	SYS_PIVOT_ROOT              = 203 +	SYS_MADVISE                 = 205 +	SYS_MINCORE                 = 206 +	SYS_GETTID                  = 207 +	SYS_TKILL                   = 208 +	SYS_SETXATTR                = 209 +	SYS_LSETXATTR               = 210 +	SYS_FSETXATTR               = 211 +	SYS_GETXATTR                = 212 +	SYS_LGETXATTR               = 213 +	SYS_FGETXATTR               = 214 +	SYS_LISTXATTR               = 215 +	SYS_LLISTXATTR              = 216 +	SYS_FLISTXATTR              = 217 +	SYS_REMOVEXATTR             = 218 +	SYS_LREMOVEXATTR            = 219 +	SYS_FREMOVEXATTR            = 220 +	SYS_FUTEX                   = 221 +	SYS_SCHED_SETAFFINITY       = 222 +	SYS_SCHED_GETAFFINITY       = 223 +	SYS_TUXCALL                 = 225 +	SYS_IO_SETUP                = 227 +	SYS_IO_DESTROY              = 228 +	SYS_IO_GETEVENTS            = 229 +	SYS_IO_SUBMIT               = 230 +	SYS_IO_CANCEL               = 231 +	SYS_SET_TID_ADDRESS         = 232 +	SYS_FADVISE64               = 233 +	SYS_EXIT_GROUP              = 234 +	SYS_LOOKUP_DCOOKIE          = 235 +	SYS_EPOLL_CREATE            = 236 +	SYS_EPOLL_CTL               = 237 +	SYS_EPOLL_WAIT              = 238 +	SYS_REMAP_FILE_PAGES        = 239 +	SYS_TIMER_CREATE            = 240 +	SYS_TIMER_SETTIME           = 241 +	SYS_TIMER_GETTIME           = 242 +	SYS_TIMER_GETOVERRUN        = 243 +	SYS_TIMER_DELETE            = 244 +	SYS_CLOCK_SETTIME           = 245 +	SYS_CLOCK_GETTIME           = 246 +	SYS_CLOCK_GETRES            = 247 +	SYS_CLOCK_NANOSLEEP         = 248 +	SYS_SWAPCONTEXT             = 249 +	SYS_TGKILL                  = 250 +	SYS_UTIMES                  = 251 +	SYS_STATFS64                = 252 +	SYS_FSTATFS64               = 253 +	SYS_RTAS                    = 255 +	SYS_SYS_DEBUG_SETCONTEXT    = 256 +	SYS_MIGRATE_PAGES           = 258 +	SYS_MBIND                   = 259 +	SYS_GET_MEMPOLICY           = 260 +	SYS_SET_MEMPOLICY           = 261 +	SYS_MQ_OPEN                 = 262 +	SYS_MQ_UNLINK               = 263 +	SYS_MQ_TIMEDSEND            = 264 +	SYS_MQ_TIMEDRECEIVE         = 265 +	SYS_MQ_NOTIFY               = 266 +	SYS_MQ_GETSETATTR           = 267 +	SYS_KEXEC_LOAD              = 268 +	SYS_ADD_KEY                 = 269 +	SYS_REQUEST_KEY             = 270 +	SYS_KEYCTL                  = 271 +	SYS_WAITID                  = 272 +	SYS_IOPRIO_SET              = 273 +	SYS_IOPRIO_GET              = 274 +	SYS_INOTIFY_INIT            = 275 +	SYS_INOTIFY_ADD_WATCH       = 276 +	SYS_INOTIFY_RM_WATCH        = 277 +	SYS_SPU_RUN                 = 278 +	SYS_SPU_CREATE              = 279 +	SYS_PSELECT6                = 280 +	SYS_PPOLL                   = 281 +	SYS_UNSHARE                 = 282 +	SYS_SPLICE                  = 283 +	SYS_TEE                     = 284 +	SYS_VMSPLICE                = 285 +	SYS_OPENAT                  = 286 +	SYS_MKDIRAT                 = 287 +	SYS_MKNODAT                 = 288 +	SYS_FCHOWNAT                = 289 +	SYS_FUTIMESAT               = 290 +	SYS_NEWFSTATAT              = 291 +	SYS_UNLINKAT                = 292 +	SYS_RENAMEAT                = 293 +	SYS_LINKAT                  = 294 +	SYS_SYMLINKAT               = 295 +	SYS_READLINKAT              = 296 +	SYS_FCHMODAT                = 297 +	SYS_FACCESSAT               = 298 +	SYS_GET_ROBUST_LIST         = 299 +	SYS_SET_ROBUST_LIST         = 300 +	SYS_MOVE_PAGES              = 301 +	SYS_GETCPU                  = 302 +	SYS_EPOLL_PWAIT             = 303 +	SYS_UTIMENSAT               = 304 +	SYS_SIGNALFD                = 305 +	SYS_TIMERFD_CREATE          = 306 +	SYS_EVENTFD                 = 307 +	SYS_SYNC_FILE_RANGE2        = 308 +	SYS_FALLOCATE               = 309 +	SYS_SUBPAGE_PROT            = 310 +	SYS_TIMERFD_SETTIME         = 311 +	SYS_TIMERFD_GETTIME         = 312 +	SYS_SIGNALFD4               = 313 +	SYS_EVENTFD2                = 314 +	SYS_EPOLL_CREATE1           = 315 +	SYS_DUP3                    = 316 +	SYS_PIPE2                   = 317 +	SYS_INOTIFY_INIT1           = 318 +	SYS_PERF_EVENT_OPEN         = 319 +	SYS_PREADV                  = 320 +	SYS_PWRITEV                 = 321 +	SYS_RT_TGSIGQUEUEINFO       = 322 +	SYS_FANOTIFY_INIT           = 323 +	SYS_FANOTIFY_MARK           = 324 +	SYS_PRLIMIT64               = 325 +	SYS_SOCKET                  = 326 +	SYS_BIND                    = 327 +	SYS_CONNECT                 = 328 +	SYS_LISTEN                  = 329 +	SYS_ACCEPT                  = 330 +	SYS_GETSOCKNAME             = 331 +	SYS_GETPEERNAME             = 332 +	SYS_SOCKETPAIR              = 333 +	SYS_SEND                    = 334 +	SYS_SENDTO                  = 335 +	SYS_RECV                    = 336 +	SYS_RECVFROM                = 337 +	SYS_SHUTDOWN                = 338 +	SYS_SETSOCKOPT              = 339 +	SYS_GETSOCKOPT              = 340 +	SYS_SENDMSG                 = 341 +	SYS_RECVMSG                 = 342 +	SYS_RECVMMSG                = 343 +	SYS_ACCEPT4                 = 344 +	SYS_NAME_TO_HANDLE_AT       = 345 +	SYS_OPEN_BY_HANDLE_AT       = 346 +	SYS_CLOCK_ADJTIME           = 347 +	SYS_SYNCFS                  = 348 +	SYS_SENDMMSG                = 349 +	SYS_SETNS                   = 350 +	SYS_PROCESS_VM_READV        = 351 +	SYS_PROCESS_VM_WRITEV       = 352 +	SYS_FINIT_MODULE            = 353 +	SYS_KCMP                    = 354 +	SYS_SCHED_SETATTR           = 355 +	SYS_SCHED_GETATTR           = 356 +	SYS_RENAMEAT2               = 357 +	SYS_SECCOMP                 = 358 +	SYS_GETRANDOM               = 359 +	SYS_MEMFD_CREATE            = 360 +	SYS_BPF                     = 361 +	SYS_EXECVEAT                = 362 +	SYS_SWITCH_ENDIAN           = 363 +	SYS_USERFAULTFD             = 364 +	SYS_MEMBARRIER              = 365 +	SYS_MLOCK2                  = 378 +	SYS_COPY_FILE_RANGE         = 379 +	SYS_PREADV2                 = 380 +	SYS_PWRITEV2                = 381 +	SYS_KEXEC_FILE_LOAD         = 382 +	SYS_STATX                   = 383 +	SYS_PKEY_ALLOC              = 384 +	SYS_PKEY_FREE               = 385 +	SYS_PKEY_MPROTECT           = 386 +	SYS_RSEQ                    = 387 +	SYS_IO_PGETEVENTS           = 388 +	SYS_SEMTIMEDOP              = 392 +	SYS_SEMGET                  = 393 +	SYS_SEMCTL                  = 394 +	SYS_SHMGET                  = 395 +	SYS_SHMCTL                  = 396 +	SYS_SHMAT                   = 397 +	SYS_SHMDT                   = 398 +	SYS_MSGGET                  = 399 +	SYS_MSGSND                  = 400 +	SYS_MSGRCV                  = 401 +	SYS_MSGCTL                  = 402 +	SYS_PIDFD_SEND_SIGNAL       = 424 +	SYS_IO_URING_SETUP          = 425 +	SYS_IO_URING_ENTER          = 426 +	SYS_IO_URING_REGISTER       = 427 +	SYS_OPEN_TREE               = 428 +	SYS_MOVE_MOUNT              = 429 +	SYS_FSOPEN                  = 430 +	SYS_FSCONFIG                = 431 +	SYS_FSMOUNT                 = 432 +	SYS_FSPICK                  = 433 +	SYS_PIDFD_OPEN              = 434 +	SYS_CLONE3                  = 435 +	SYS_CLOSE_RANGE             = 436 +	SYS_OPENAT2                 = 437 +	SYS_PIDFD_GETFD             = 438 +	SYS_FACCESSAT2              = 439 +	SYS_PROCESS_MADVISE         = 440 +	SYS_EPOLL_PWAIT2            = 441 +	SYS_MOUNT_SETATTR           = 442 +	SYS_LANDLOCK_CREATE_RULESET = 444 +	SYS_LANDLOCK_ADD_RULE       = 445 +	SYS_LANDLOCK_RESTRICT_SELF  = 446  ) diff --git a/vendor/golang.org/x/sys/unix/zsysnum_linux_ppc64le.go b/vendor/golang.org/x/sys/unix/zsysnum_linux_ppc64le.go index 33b33b083..53a89b206 100644 --- a/vendor/golang.org/x/sys/unix/zsysnum_linux_ppc64le.go +++ b/vendor/golang.org/x/sys/unix/zsysnum_linux_ppc64le.go @@ -7,400 +7,403 @@  package unix  const ( -	SYS_RESTART_SYSCALL        = 0 -	SYS_EXIT                   = 1 -	SYS_FORK                   = 2 -	SYS_READ                   = 3 -	SYS_WRITE                  = 4 -	SYS_OPEN                   = 5 -	SYS_CLOSE                  = 6 -	SYS_WAITPID                = 7 -	SYS_CREAT                  = 8 -	SYS_LINK                   = 9 -	SYS_UNLINK                 = 10 -	SYS_EXECVE                 = 11 -	SYS_CHDIR                  = 12 -	SYS_TIME                   = 13 -	SYS_MKNOD                  = 14 -	SYS_CHMOD                  = 15 -	SYS_LCHOWN                 = 16 -	SYS_BREAK                  = 17 -	SYS_OLDSTAT                = 18 -	SYS_LSEEK                  = 19 -	SYS_GETPID                 = 20 -	SYS_MOUNT                  = 21 -	SYS_UMOUNT                 = 22 -	SYS_SETUID                 = 23 -	SYS_GETUID                 = 24 -	SYS_STIME                  = 25 -	SYS_PTRACE                 = 26 -	SYS_ALARM                  = 27 -	SYS_OLDFSTAT               = 28 -	SYS_PAUSE                  = 29 -	SYS_UTIME                  = 30 -	SYS_STTY                   = 31 -	SYS_GTTY                   = 32 -	SYS_ACCESS                 = 33 -	SYS_NICE                   = 34 -	SYS_FTIME                  = 35 -	SYS_SYNC                   = 36 -	SYS_KILL                   = 37 -	SYS_RENAME                 = 38 -	SYS_MKDIR                  = 39 -	SYS_RMDIR                  = 40 -	SYS_DUP                    = 41 -	SYS_PIPE                   = 42 -	SYS_TIMES                  = 43 -	SYS_PROF                   = 44 -	SYS_BRK                    = 45 -	SYS_SETGID                 = 46 -	SYS_GETGID                 = 47 -	SYS_SIGNAL                 = 48 -	SYS_GETEUID                = 49 -	SYS_GETEGID                = 50 -	SYS_ACCT                   = 51 -	SYS_UMOUNT2                = 52 -	SYS_LOCK                   = 53 -	SYS_IOCTL                  = 54 -	SYS_FCNTL                  = 55 -	SYS_MPX                    = 56 -	SYS_SETPGID                = 57 -	SYS_ULIMIT                 = 58 -	SYS_OLDOLDUNAME            = 59 -	SYS_UMASK                  = 60 -	SYS_CHROOT                 = 61 -	SYS_USTAT                  = 62 -	SYS_DUP2                   = 63 -	SYS_GETPPID                = 64 -	SYS_GETPGRP                = 65 -	SYS_SETSID                 = 66 -	SYS_SIGACTION              = 67 -	SYS_SGETMASK               = 68 -	SYS_SSETMASK               = 69 -	SYS_SETREUID               = 70 -	SYS_SETREGID               = 71 -	SYS_SIGSUSPEND             = 72 -	SYS_SIGPENDING             = 73 -	SYS_SETHOSTNAME            = 74 -	SYS_SETRLIMIT              = 75 -	SYS_GETRLIMIT              = 76 -	SYS_GETRUSAGE              = 77 -	SYS_GETTIMEOFDAY           = 78 -	SYS_SETTIMEOFDAY           = 79 -	SYS_GETGROUPS              = 80 -	SYS_SETGROUPS              = 81 -	SYS_SELECT                 = 82 -	SYS_SYMLINK                = 83 -	SYS_OLDLSTAT               = 84 -	SYS_READLINK               = 85 -	SYS_USELIB                 = 86 -	SYS_SWAPON                 = 87 -	SYS_REBOOT                 = 88 -	SYS_READDIR                = 89 -	SYS_MMAP                   = 90 -	SYS_MUNMAP                 = 91 -	SYS_TRUNCATE               = 92 -	SYS_FTRUNCATE              = 93 -	SYS_FCHMOD                 = 94 -	SYS_FCHOWN                 = 95 -	SYS_GETPRIORITY            = 96 -	SYS_SETPRIORITY            = 97 -	SYS_PROFIL                 = 98 -	SYS_STATFS                 = 99 -	SYS_FSTATFS                = 100 -	SYS_IOPERM                 = 101 -	SYS_SOCKETCALL             = 102 -	SYS_SYSLOG                 = 103 -	SYS_SETITIMER              = 104 -	SYS_GETITIMER              = 105 -	SYS_STAT                   = 106 -	SYS_LSTAT                  = 107 -	SYS_FSTAT                  = 108 -	SYS_OLDUNAME               = 109 -	SYS_IOPL                   = 110 -	SYS_VHANGUP                = 111 -	SYS_IDLE                   = 112 -	SYS_VM86                   = 113 -	SYS_WAIT4                  = 114 -	SYS_SWAPOFF                = 115 -	SYS_SYSINFO                = 116 -	SYS_IPC                    = 117 -	SYS_FSYNC                  = 118 -	SYS_SIGRETURN              = 119 -	SYS_CLONE                  = 120 -	SYS_SETDOMAINNAME          = 121 -	SYS_UNAME                  = 122 -	SYS_MODIFY_LDT             = 123 -	SYS_ADJTIMEX               = 124 -	SYS_MPROTECT               = 125 -	SYS_SIGPROCMASK            = 126 -	SYS_CREATE_MODULE          = 127 -	SYS_INIT_MODULE            = 128 -	SYS_DELETE_MODULE          = 129 -	SYS_GET_KERNEL_SYMS        = 130 -	SYS_QUOTACTL               = 131 -	SYS_GETPGID                = 132 -	SYS_FCHDIR                 = 133 -	SYS_BDFLUSH                = 134 -	SYS_SYSFS                  = 135 -	SYS_PERSONALITY            = 136 -	SYS_AFS_SYSCALL            = 137 -	SYS_SETFSUID               = 138 -	SYS_SETFSGID               = 139 -	SYS__LLSEEK                = 140 -	SYS_GETDENTS               = 141 -	SYS__NEWSELECT             = 142 -	SYS_FLOCK                  = 143 -	SYS_MSYNC                  = 144 -	SYS_READV                  = 145 -	SYS_WRITEV                 = 146 -	SYS_GETSID                 = 147 -	SYS_FDATASYNC              = 148 -	SYS__SYSCTL                = 149 -	SYS_MLOCK                  = 150 -	SYS_MUNLOCK                = 151 -	SYS_MLOCKALL               = 152 -	SYS_MUNLOCKALL             = 153 -	SYS_SCHED_SETPARAM         = 154 -	SYS_SCHED_GETPARAM         = 155 -	SYS_SCHED_SETSCHEDULER     = 156 -	SYS_SCHED_GETSCHEDULER     = 157 -	SYS_SCHED_YIELD            = 158 -	SYS_SCHED_GET_PRIORITY_MAX = 159 -	SYS_SCHED_GET_PRIORITY_MIN = 160 -	SYS_SCHED_RR_GET_INTERVAL  = 161 -	SYS_NANOSLEEP              = 162 -	SYS_MREMAP                 = 163 -	SYS_SETRESUID              = 164 -	SYS_GETRESUID              = 165 -	SYS_QUERY_MODULE           = 166 -	SYS_POLL                   = 167 -	SYS_NFSSERVCTL             = 168 -	SYS_SETRESGID              = 169 -	SYS_GETRESGID              = 170 -	SYS_PRCTL                  = 171 -	SYS_RT_SIGRETURN           = 172 -	SYS_RT_SIGACTION           = 173 -	SYS_RT_SIGPROCMASK         = 174 -	SYS_RT_SIGPENDING          = 175 -	SYS_RT_SIGTIMEDWAIT        = 176 -	SYS_RT_SIGQUEUEINFO        = 177 -	SYS_RT_SIGSUSPEND          = 178 -	SYS_PREAD64                = 179 -	SYS_PWRITE64               = 180 -	SYS_CHOWN                  = 181 -	SYS_GETCWD                 = 182 -	SYS_CAPGET                 = 183 -	SYS_CAPSET                 = 184 -	SYS_SIGALTSTACK            = 185 -	SYS_SENDFILE               = 186 -	SYS_GETPMSG                = 187 -	SYS_PUTPMSG                = 188 -	SYS_VFORK                  = 189 -	SYS_UGETRLIMIT             = 190 -	SYS_READAHEAD              = 191 -	SYS_PCICONFIG_READ         = 198 -	SYS_PCICONFIG_WRITE        = 199 -	SYS_PCICONFIG_IOBASE       = 200 -	SYS_MULTIPLEXER            = 201 -	SYS_GETDENTS64             = 202 -	SYS_PIVOT_ROOT             = 203 -	SYS_MADVISE                = 205 -	SYS_MINCORE                = 206 -	SYS_GETTID                 = 207 -	SYS_TKILL                  = 208 -	SYS_SETXATTR               = 209 -	SYS_LSETXATTR              = 210 -	SYS_FSETXATTR              = 211 -	SYS_GETXATTR               = 212 -	SYS_LGETXATTR              = 213 -	SYS_FGETXATTR              = 214 -	SYS_LISTXATTR              = 215 -	SYS_LLISTXATTR             = 216 -	SYS_FLISTXATTR             = 217 -	SYS_REMOVEXATTR            = 218 -	SYS_LREMOVEXATTR           = 219 -	SYS_FREMOVEXATTR           = 220 -	SYS_FUTEX                  = 221 -	SYS_SCHED_SETAFFINITY      = 222 -	SYS_SCHED_GETAFFINITY      = 223 -	SYS_TUXCALL                = 225 -	SYS_IO_SETUP               = 227 -	SYS_IO_DESTROY             = 228 -	SYS_IO_GETEVENTS           = 229 -	SYS_IO_SUBMIT              = 230 -	SYS_IO_CANCEL              = 231 -	SYS_SET_TID_ADDRESS        = 232 -	SYS_FADVISE64              = 233 -	SYS_EXIT_GROUP             = 234 -	SYS_LOOKUP_DCOOKIE         = 235 -	SYS_EPOLL_CREATE           = 236 -	SYS_EPOLL_CTL              = 237 -	SYS_EPOLL_WAIT             = 238 -	SYS_REMAP_FILE_PAGES       = 239 -	SYS_TIMER_CREATE           = 240 -	SYS_TIMER_SETTIME          = 241 -	SYS_TIMER_GETTIME          = 242 -	SYS_TIMER_GETOVERRUN       = 243 -	SYS_TIMER_DELETE           = 244 -	SYS_CLOCK_SETTIME          = 245 -	SYS_CLOCK_GETTIME          = 246 -	SYS_CLOCK_GETRES           = 247 -	SYS_CLOCK_NANOSLEEP        = 248 -	SYS_SWAPCONTEXT            = 249 -	SYS_TGKILL                 = 250 -	SYS_UTIMES                 = 251 -	SYS_STATFS64               = 252 -	SYS_FSTATFS64              = 253 -	SYS_RTAS                   = 255 -	SYS_SYS_DEBUG_SETCONTEXT   = 256 -	SYS_MIGRATE_PAGES          = 258 -	SYS_MBIND                  = 259 -	SYS_GET_MEMPOLICY          = 260 -	SYS_SET_MEMPOLICY          = 261 -	SYS_MQ_OPEN                = 262 -	SYS_MQ_UNLINK              = 263 -	SYS_MQ_TIMEDSEND           = 264 -	SYS_MQ_TIMEDRECEIVE        = 265 -	SYS_MQ_NOTIFY              = 266 -	SYS_MQ_GETSETATTR          = 267 -	SYS_KEXEC_LOAD             = 268 -	SYS_ADD_KEY                = 269 -	SYS_REQUEST_KEY            = 270 -	SYS_KEYCTL                 = 271 -	SYS_WAITID                 = 272 -	SYS_IOPRIO_SET             = 273 -	SYS_IOPRIO_GET             = 274 -	SYS_INOTIFY_INIT           = 275 -	SYS_INOTIFY_ADD_WATCH      = 276 -	SYS_INOTIFY_RM_WATCH       = 277 -	SYS_SPU_RUN                = 278 -	SYS_SPU_CREATE             = 279 -	SYS_PSELECT6               = 280 -	SYS_PPOLL                  = 281 -	SYS_UNSHARE                = 282 -	SYS_SPLICE                 = 283 -	SYS_TEE                    = 284 -	SYS_VMSPLICE               = 285 -	SYS_OPENAT                 = 286 -	SYS_MKDIRAT                = 287 -	SYS_MKNODAT                = 288 -	SYS_FCHOWNAT               = 289 -	SYS_FUTIMESAT              = 290 -	SYS_NEWFSTATAT             = 291 -	SYS_UNLINKAT               = 292 -	SYS_RENAMEAT               = 293 -	SYS_LINKAT                 = 294 -	SYS_SYMLINKAT              = 295 -	SYS_READLINKAT             = 296 -	SYS_FCHMODAT               = 297 -	SYS_FACCESSAT              = 298 -	SYS_GET_ROBUST_LIST        = 299 -	SYS_SET_ROBUST_LIST        = 300 -	SYS_MOVE_PAGES             = 301 -	SYS_GETCPU                 = 302 -	SYS_EPOLL_PWAIT            = 303 -	SYS_UTIMENSAT              = 304 -	SYS_SIGNALFD               = 305 -	SYS_TIMERFD_CREATE         = 306 -	SYS_EVENTFD                = 307 -	SYS_SYNC_FILE_RANGE2       = 308 -	SYS_FALLOCATE              = 309 -	SYS_SUBPAGE_PROT           = 310 -	SYS_TIMERFD_SETTIME        = 311 -	SYS_TIMERFD_GETTIME        = 312 -	SYS_SIGNALFD4              = 313 -	SYS_EVENTFD2               = 314 -	SYS_EPOLL_CREATE1          = 315 -	SYS_DUP3                   = 316 -	SYS_PIPE2                  = 317 -	SYS_INOTIFY_INIT1          = 318 -	SYS_PERF_EVENT_OPEN        = 319 -	SYS_PREADV                 = 320 -	SYS_PWRITEV                = 321 -	SYS_RT_TGSIGQUEUEINFO      = 322 -	SYS_FANOTIFY_INIT          = 323 -	SYS_FANOTIFY_MARK          = 324 -	SYS_PRLIMIT64              = 325 -	SYS_SOCKET                 = 326 -	SYS_BIND                   = 327 -	SYS_CONNECT                = 328 -	SYS_LISTEN                 = 329 -	SYS_ACCEPT                 = 330 -	SYS_GETSOCKNAME            = 331 -	SYS_GETPEERNAME            = 332 -	SYS_SOCKETPAIR             = 333 -	SYS_SEND                   = 334 -	SYS_SENDTO                 = 335 -	SYS_RECV                   = 336 -	SYS_RECVFROM               = 337 -	SYS_SHUTDOWN               = 338 -	SYS_SETSOCKOPT             = 339 -	SYS_GETSOCKOPT             = 340 -	SYS_SENDMSG                = 341 -	SYS_RECVMSG                = 342 -	SYS_RECVMMSG               = 343 -	SYS_ACCEPT4                = 344 -	SYS_NAME_TO_HANDLE_AT      = 345 -	SYS_OPEN_BY_HANDLE_AT      = 346 -	SYS_CLOCK_ADJTIME          = 347 -	SYS_SYNCFS                 = 348 -	SYS_SENDMMSG               = 349 -	SYS_SETNS                  = 350 -	SYS_PROCESS_VM_READV       = 351 -	SYS_PROCESS_VM_WRITEV      = 352 -	SYS_FINIT_MODULE           = 353 -	SYS_KCMP                   = 354 -	SYS_SCHED_SETATTR          = 355 -	SYS_SCHED_GETATTR          = 356 -	SYS_RENAMEAT2              = 357 -	SYS_SECCOMP                = 358 -	SYS_GETRANDOM              = 359 -	SYS_MEMFD_CREATE           = 360 -	SYS_BPF                    = 361 -	SYS_EXECVEAT               = 362 -	SYS_SWITCH_ENDIAN          = 363 -	SYS_USERFAULTFD            = 364 -	SYS_MEMBARRIER             = 365 -	SYS_MLOCK2                 = 378 -	SYS_COPY_FILE_RANGE        = 379 -	SYS_PREADV2                = 380 -	SYS_PWRITEV2               = 381 -	SYS_KEXEC_FILE_LOAD        = 382 -	SYS_STATX                  = 383 -	SYS_PKEY_ALLOC             = 384 -	SYS_PKEY_FREE              = 385 -	SYS_PKEY_MPROTECT          = 386 -	SYS_RSEQ                   = 387 -	SYS_IO_PGETEVENTS          = 388 -	SYS_SEMTIMEDOP             = 392 -	SYS_SEMGET                 = 393 -	SYS_SEMCTL                 = 394 -	SYS_SHMGET                 = 395 -	SYS_SHMCTL                 = 396 -	SYS_SHMAT                  = 397 -	SYS_SHMDT                  = 398 -	SYS_MSGGET                 = 399 -	SYS_MSGSND                 = 400 -	SYS_MSGRCV                 = 401 -	SYS_MSGCTL                 = 402 -	SYS_PIDFD_SEND_SIGNAL      = 424 -	SYS_IO_URING_SETUP         = 425 -	SYS_IO_URING_ENTER         = 426 -	SYS_IO_URING_REGISTER      = 427 -	SYS_OPEN_TREE              = 428 -	SYS_MOVE_MOUNT             = 429 -	SYS_FSOPEN                 = 430 -	SYS_FSCONFIG               = 431 -	SYS_FSMOUNT                = 432 -	SYS_FSPICK                 = 433 -	SYS_PIDFD_OPEN             = 434 -	SYS_CLONE3                 = 435 -	SYS_CLOSE_RANGE            = 436 -	SYS_OPENAT2                = 437 -	SYS_PIDFD_GETFD            = 438 -	SYS_FACCESSAT2             = 439 -	SYS_PROCESS_MADVISE        = 440 -	SYS_EPOLL_PWAIT2           = 441 -	SYS_MOUNT_SETATTR          = 442 +	SYS_RESTART_SYSCALL         = 0 +	SYS_EXIT                    = 1 +	SYS_FORK                    = 2 +	SYS_READ                    = 3 +	SYS_WRITE                   = 4 +	SYS_OPEN                    = 5 +	SYS_CLOSE                   = 6 +	SYS_WAITPID                 = 7 +	SYS_CREAT                   = 8 +	SYS_LINK                    = 9 +	SYS_UNLINK                  = 10 +	SYS_EXECVE                  = 11 +	SYS_CHDIR                   = 12 +	SYS_TIME                    = 13 +	SYS_MKNOD                   = 14 +	SYS_CHMOD                   = 15 +	SYS_LCHOWN                  = 16 +	SYS_BREAK                   = 17 +	SYS_OLDSTAT                 = 18 +	SYS_LSEEK                   = 19 +	SYS_GETPID                  = 20 +	SYS_MOUNT                   = 21 +	SYS_UMOUNT                  = 22 +	SYS_SETUID                  = 23 +	SYS_GETUID                  = 24 +	SYS_STIME                   = 25 +	SYS_PTRACE                  = 26 +	SYS_ALARM                   = 27 +	SYS_OLDFSTAT                = 28 +	SYS_PAUSE                   = 29 +	SYS_UTIME                   = 30 +	SYS_STTY                    = 31 +	SYS_GTTY                    = 32 +	SYS_ACCESS                  = 33 +	SYS_NICE                    = 34 +	SYS_FTIME                   = 35 +	SYS_SYNC                    = 36 +	SYS_KILL                    = 37 +	SYS_RENAME                  = 38 +	SYS_MKDIR                   = 39 +	SYS_RMDIR                   = 40 +	SYS_DUP                     = 41 +	SYS_PIPE                    = 42 +	SYS_TIMES                   = 43 +	SYS_PROF                    = 44 +	SYS_BRK                     = 45 +	SYS_SETGID                  = 46 +	SYS_GETGID                  = 47 +	SYS_SIGNAL                  = 48 +	SYS_GETEUID                 = 49 +	SYS_GETEGID                 = 50 +	SYS_ACCT                    = 51 +	SYS_UMOUNT2                 = 52 +	SYS_LOCK                    = 53 +	SYS_IOCTL                   = 54 +	SYS_FCNTL                   = 55 +	SYS_MPX                     = 56 +	SYS_SETPGID                 = 57 +	SYS_ULIMIT                  = 58 +	SYS_OLDOLDUNAME             = 59 +	SYS_UMASK                   = 60 +	SYS_CHROOT                  = 61 +	SYS_USTAT                   = 62 +	SYS_DUP2                    = 63 +	SYS_GETPPID                 = 64 +	SYS_GETPGRP                 = 65 +	SYS_SETSID                  = 66 +	SYS_SIGACTION               = 67 +	SYS_SGETMASK                = 68 +	SYS_SSETMASK                = 69 +	SYS_SETREUID                = 70 +	SYS_SETREGID                = 71 +	SYS_SIGSUSPEND              = 72 +	SYS_SIGPENDING              = 73 +	SYS_SETHOSTNAME             = 74 +	SYS_SETRLIMIT               = 75 +	SYS_GETRLIMIT               = 76 +	SYS_GETRUSAGE               = 77 +	SYS_GETTIMEOFDAY            = 78 +	SYS_SETTIMEOFDAY            = 79 +	SYS_GETGROUPS               = 80 +	SYS_SETGROUPS               = 81 +	SYS_SELECT                  = 82 +	SYS_SYMLINK                 = 83 +	SYS_OLDLSTAT                = 84 +	SYS_READLINK                = 85 +	SYS_USELIB                  = 86 +	SYS_SWAPON                  = 87 +	SYS_REBOOT                  = 88 +	SYS_READDIR                 = 89 +	SYS_MMAP                    = 90 +	SYS_MUNMAP                  = 91 +	SYS_TRUNCATE                = 92 +	SYS_FTRUNCATE               = 93 +	SYS_FCHMOD                  = 94 +	SYS_FCHOWN                  = 95 +	SYS_GETPRIORITY             = 96 +	SYS_SETPRIORITY             = 97 +	SYS_PROFIL                  = 98 +	SYS_STATFS                  = 99 +	SYS_FSTATFS                 = 100 +	SYS_IOPERM                  = 101 +	SYS_SOCKETCALL              = 102 +	SYS_SYSLOG                  = 103 +	SYS_SETITIMER               = 104 +	SYS_GETITIMER               = 105 +	SYS_STAT                    = 106 +	SYS_LSTAT                   = 107 +	SYS_FSTAT                   = 108 +	SYS_OLDUNAME                = 109 +	SYS_IOPL                    = 110 +	SYS_VHANGUP                 = 111 +	SYS_IDLE                    = 112 +	SYS_VM86                    = 113 +	SYS_WAIT4                   = 114 +	SYS_SWAPOFF                 = 115 +	SYS_SYSINFO                 = 116 +	SYS_IPC                     = 117 +	SYS_FSYNC                   = 118 +	SYS_SIGRETURN               = 119 +	SYS_CLONE                   = 120 +	SYS_SETDOMAINNAME           = 121 +	SYS_UNAME                   = 122 +	SYS_MODIFY_LDT              = 123 +	SYS_ADJTIMEX                = 124 +	SYS_MPROTECT                = 125 +	SYS_SIGPROCMASK             = 126 +	SYS_CREATE_MODULE           = 127 +	SYS_INIT_MODULE             = 128 +	SYS_DELETE_MODULE           = 129 +	SYS_GET_KERNEL_SYMS         = 130 +	SYS_QUOTACTL                = 131 +	SYS_GETPGID                 = 132 +	SYS_FCHDIR                  = 133 +	SYS_BDFLUSH                 = 134 +	SYS_SYSFS                   = 135 +	SYS_PERSONALITY             = 136 +	SYS_AFS_SYSCALL             = 137 +	SYS_SETFSUID                = 138 +	SYS_SETFSGID                = 139 +	SYS__LLSEEK                 = 140 +	SYS_GETDENTS                = 141 +	SYS__NEWSELECT              = 142 +	SYS_FLOCK                   = 143 +	SYS_MSYNC                   = 144 +	SYS_READV                   = 145 +	SYS_WRITEV                  = 146 +	SYS_GETSID                  = 147 +	SYS_FDATASYNC               = 148 +	SYS__SYSCTL                 = 149 +	SYS_MLOCK                   = 150 +	SYS_MUNLOCK                 = 151 +	SYS_MLOCKALL                = 152 +	SYS_MUNLOCKALL              = 153 +	SYS_SCHED_SETPARAM          = 154 +	SYS_SCHED_GETPARAM          = 155 +	SYS_SCHED_SETSCHEDULER      = 156 +	SYS_SCHED_GETSCHEDULER      = 157 +	SYS_SCHED_YIELD             = 158 +	SYS_SCHED_GET_PRIORITY_MAX  = 159 +	SYS_SCHED_GET_PRIORITY_MIN  = 160 +	SYS_SCHED_RR_GET_INTERVAL   = 161 +	SYS_NANOSLEEP               = 162 +	SYS_MREMAP                  = 163 +	SYS_SETRESUID               = 164 +	SYS_GETRESUID               = 165 +	SYS_QUERY_MODULE            = 166 +	SYS_POLL                    = 167 +	SYS_NFSSERVCTL              = 168 +	SYS_SETRESGID               = 169 +	SYS_GETRESGID               = 170 +	SYS_PRCTL                   = 171 +	SYS_RT_SIGRETURN            = 172 +	SYS_RT_SIGACTION            = 173 +	SYS_RT_SIGPROCMASK          = 174 +	SYS_RT_SIGPENDING           = 175 +	SYS_RT_SIGTIMEDWAIT         = 176 +	SYS_RT_SIGQUEUEINFO         = 177 +	SYS_RT_SIGSUSPEND           = 178 +	SYS_PREAD64                 = 179 +	SYS_PWRITE64                = 180 +	SYS_CHOWN                   = 181 +	SYS_GETCWD                  = 182 +	SYS_CAPGET                  = 183 +	SYS_CAPSET                  = 184 +	SYS_SIGALTSTACK             = 185 +	SYS_SENDFILE                = 186 +	SYS_GETPMSG                 = 187 +	SYS_PUTPMSG                 = 188 +	SYS_VFORK                   = 189 +	SYS_UGETRLIMIT              = 190 +	SYS_READAHEAD               = 191 +	SYS_PCICONFIG_READ          = 198 +	SYS_PCICONFIG_WRITE         = 199 +	SYS_PCICONFIG_IOBASE        = 200 +	SYS_MULTIPLEXER             = 201 +	SYS_GETDENTS64              = 202 +	SYS_PIVOT_ROOT              = 203 +	SYS_MADVISE                 = 205 +	SYS_MINCORE                 = 206 +	SYS_GETTID                  = 207 +	SYS_TKILL                   = 208 +	SYS_SETXATTR                = 209 +	SYS_LSETXATTR               = 210 +	SYS_FSETXATTR               = 211 +	SYS_GETXATTR                = 212 +	SYS_LGETXATTR               = 213 +	SYS_FGETXATTR               = 214 +	SYS_LISTXATTR               = 215 +	SYS_LLISTXATTR              = 216 +	SYS_FLISTXATTR              = 217 +	SYS_REMOVEXATTR             = 218 +	SYS_LREMOVEXATTR            = 219 +	SYS_FREMOVEXATTR            = 220 +	SYS_FUTEX                   = 221 +	SYS_SCHED_SETAFFINITY       = 222 +	SYS_SCHED_GETAFFINITY       = 223 +	SYS_TUXCALL                 = 225 +	SYS_IO_SETUP                = 227 +	SYS_IO_DESTROY              = 228 +	SYS_IO_GETEVENTS            = 229 +	SYS_IO_SUBMIT               = 230 +	SYS_IO_CANCEL               = 231 +	SYS_SET_TID_ADDRESS         = 232 +	SYS_FADVISE64               = 233 +	SYS_EXIT_GROUP              = 234 +	SYS_LOOKUP_DCOOKIE          = 235 +	SYS_EPOLL_CREATE            = 236 +	SYS_EPOLL_CTL               = 237 +	SYS_EPOLL_WAIT              = 238 +	SYS_REMAP_FILE_PAGES        = 239 +	SYS_TIMER_CREATE            = 240 +	SYS_TIMER_SETTIME           = 241 +	SYS_TIMER_GETTIME           = 242 +	SYS_TIMER_GETOVERRUN        = 243 +	SYS_TIMER_DELETE            = 244 +	SYS_CLOCK_SETTIME           = 245 +	SYS_CLOCK_GETTIME           = 246 +	SYS_CLOCK_GETRES            = 247 +	SYS_CLOCK_NANOSLEEP         = 248 +	SYS_SWAPCONTEXT             = 249 +	SYS_TGKILL                  = 250 +	SYS_UTIMES                  = 251 +	SYS_STATFS64                = 252 +	SYS_FSTATFS64               = 253 +	SYS_RTAS                    = 255 +	SYS_SYS_DEBUG_SETCONTEXT    = 256 +	SYS_MIGRATE_PAGES           = 258 +	SYS_MBIND                   = 259 +	SYS_GET_MEMPOLICY           = 260 +	SYS_SET_MEMPOLICY           = 261 +	SYS_MQ_OPEN                 = 262 +	SYS_MQ_UNLINK               = 263 +	SYS_MQ_TIMEDSEND            = 264 +	SYS_MQ_TIMEDRECEIVE         = 265 +	SYS_MQ_NOTIFY               = 266 +	SYS_MQ_GETSETATTR           = 267 +	SYS_KEXEC_LOAD              = 268 +	SYS_ADD_KEY                 = 269 +	SYS_REQUEST_KEY             = 270 +	SYS_KEYCTL                  = 271 +	SYS_WAITID                  = 272 +	SYS_IOPRIO_SET              = 273 +	SYS_IOPRIO_GET              = 274 +	SYS_INOTIFY_INIT            = 275 +	SYS_INOTIFY_ADD_WATCH       = 276 +	SYS_INOTIFY_RM_WATCH        = 277 +	SYS_SPU_RUN                 = 278 +	SYS_SPU_CREATE              = 279 +	SYS_PSELECT6                = 280 +	SYS_PPOLL                   = 281 +	SYS_UNSHARE                 = 282 +	SYS_SPLICE                  = 283 +	SYS_TEE                     = 284 +	SYS_VMSPLICE                = 285 +	SYS_OPENAT                  = 286 +	SYS_MKDIRAT                 = 287 +	SYS_MKNODAT                 = 288 +	SYS_FCHOWNAT                = 289 +	SYS_FUTIMESAT               = 290 +	SYS_NEWFSTATAT              = 291 +	SYS_UNLINKAT                = 292 +	SYS_RENAMEAT                = 293 +	SYS_LINKAT                  = 294 +	SYS_SYMLINKAT               = 295 +	SYS_READLINKAT              = 296 +	SYS_FCHMODAT                = 297 +	SYS_FACCESSAT               = 298 +	SYS_GET_ROBUST_LIST         = 299 +	SYS_SET_ROBUST_LIST         = 300 +	SYS_MOVE_PAGES              = 301 +	SYS_GETCPU                  = 302 +	SYS_EPOLL_PWAIT             = 303 +	SYS_UTIMENSAT               = 304 +	SYS_SIGNALFD                = 305 +	SYS_TIMERFD_CREATE          = 306 +	SYS_EVENTFD                 = 307 +	SYS_SYNC_FILE_RANGE2        = 308 +	SYS_FALLOCATE               = 309 +	SYS_SUBPAGE_PROT            = 310 +	SYS_TIMERFD_SETTIME         = 311 +	SYS_TIMERFD_GETTIME         = 312 +	SYS_SIGNALFD4               = 313 +	SYS_EVENTFD2                = 314 +	SYS_EPOLL_CREATE1           = 315 +	SYS_DUP3                    = 316 +	SYS_PIPE2                   = 317 +	SYS_INOTIFY_INIT1           = 318 +	SYS_PERF_EVENT_OPEN         = 319 +	SYS_PREADV                  = 320 +	SYS_PWRITEV                 = 321 +	SYS_RT_TGSIGQUEUEINFO       = 322 +	SYS_FANOTIFY_INIT           = 323 +	SYS_FANOTIFY_MARK           = 324 +	SYS_PRLIMIT64               = 325 +	SYS_SOCKET                  = 326 +	SYS_BIND                    = 327 +	SYS_CONNECT                 = 328 +	SYS_LISTEN                  = 329 +	SYS_ACCEPT                  = 330 +	SYS_GETSOCKNAME             = 331 +	SYS_GETPEERNAME             = 332 +	SYS_SOCKETPAIR              = 333 +	SYS_SEND                    = 334 +	SYS_SENDTO                  = 335 +	SYS_RECV                    = 336 +	SYS_RECVFROM                = 337 +	SYS_SHUTDOWN                = 338 +	SYS_SETSOCKOPT              = 339 +	SYS_GETSOCKOPT              = 340 +	SYS_SENDMSG                 = 341 +	SYS_RECVMSG                 = 342 +	SYS_RECVMMSG                = 343 +	SYS_ACCEPT4                 = 344 +	SYS_NAME_TO_HANDLE_AT       = 345 +	SYS_OPEN_BY_HANDLE_AT       = 346 +	SYS_CLOCK_ADJTIME           = 347 +	SYS_SYNCFS                  = 348 +	SYS_SENDMMSG                = 349 +	SYS_SETNS                   = 350 +	SYS_PROCESS_VM_READV        = 351 +	SYS_PROCESS_VM_WRITEV       = 352 +	SYS_FINIT_MODULE            = 353 +	SYS_KCMP                    = 354 +	SYS_SCHED_SETATTR           = 355 +	SYS_SCHED_GETATTR           = 356 +	SYS_RENAMEAT2               = 357 +	SYS_SECCOMP                 = 358 +	SYS_GETRANDOM               = 359 +	SYS_MEMFD_CREATE            = 360 +	SYS_BPF                     = 361 +	SYS_EXECVEAT                = 362 +	SYS_SWITCH_ENDIAN           = 363 +	SYS_USERFAULTFD             = 364 +	SYS_MEMBARRIER              = 365 +	SYS_MLOCK2                  = 378 +	SYS_COPY_FILE_RANGE         = 379 +	SYS_PREADV2                 = 380 +	SYS_PWRITEV2                = 381 +	SYS_KEXEC_FILE_LOAD         = 382 +	SYS_STATX                   = 383 +	SYS_PKEY_ALLOC              = 384 +	SYS_PKEY_FREE               = 385 +	SYS_PKEY_MPROTECT           = 386 +	SYS_RSEQ                    = 387 +	SYS_IO_PGETEVENTS           = 388 +	SYS_SEMTIMEDOP              = 392 +	SYS_SEMGET                  = 393 +	SYS_SEMCTL                  = 394 +	SYS_SHMGET                  = 395 +	SYS_SHMCTL                  = 396 +	SYS_SHMAT                   = 397 +	SYS_SHMDT                   = 398 +	SYS_MSGGET                  = 399 +	SYS_MSGSND                  = 400 +	SYS_MSGRCV                  = 401 +	SYS_MSGCTL                  = 402 +	SYS_PIDFD_SEND_SIGNAL       = 424 +	SYS_IO_URING_SETUP          = 425 +	SYS_IO_URING_ENTER          = 426 +	SYS_IO_URING_REGISTER       = 427 +	SYS_OPEN_TREE               = 428 +	SYS_MOVE_MOUNT              = 429 +	SYS_FSOPEN                  = 430 +	SYS_FSCONFIG                = 431 +	SYS_FSMOUNT                 = 432 +	SYS_FSPICK                  = 433 +	SYS_PIDFD_OPEN              = 434 +	SYS_CLONE3                  = 435 +	SYS_CLOSE_RANGE             = 436 +	SYS_OPENAT2                 = 437 +	SYS_PIDFD_GETFD             = 438 +	SYS_FACCESSAT2              = 439 +	SYS_PROCESS_MADVISE         = 440 +	SYS_EPOLL_PWAIT2            = 441 +	SYS_MOUNT_SETATTR           = 442 +	SYS_LANDLOCK_CREATE_RULESET = 444 +	SYS_LANDLOCK_ADD_RULE       = 445 +	SYS_LANDLOCK_RESTRICT_SELF  = 446  ) diff --git a/vendor/golang.org/x/sys/unix/zsysnum_linux_riscv64.go b/vendor/golang.org/x/sys/unix/zsysnum_linux_riscv64.go index 66c8a8e09..0db9fbba5 100644 --- a/vendor/golang.org/x/sys/unix/zsysnum_linux_riscv64.go +++ b/vendor/golang.org/x/sys/unix/zsysnum_linux_riscv64.go @@ -7,302 +7,305 @@  package unix  const ( -	SYS_IO_SETUP               = 0 -	SYS_IO_DESTROY             = 1 -	SYS_IO_SUBMIT              = 2 -	SYS_IO_CANCEL              = 3 -	SYS_IO_GETEVENTS           = 4 -	SYS_SETXATTR               = 5 -	SYS_LSETXATTR              = 6 -	SYS_FSETXATTR              = 7 -	SYS_GETXATTR               = 8 -	SYS_LGETXATTR              = 9 -	SYS_FGETXATTR              = 10 -	SYS_LISTXATTR              = 11 -	SYS_LLISTXATTR             = 12 -	SYS_FLISTXATTR             = 13 -	SYS_REMOVEXATTR            = 14 -	SYS_LREMOVEXATTR           = 15 -	SYS_FREMOVEXATTR           = 16 -	SYS_GETCWD                 = 17 -	SYS_LOOKUP_DCOOKIE         = 18 -	SYS_EVENTFD2               = 19 -	SYS_EPOLL_CREATE1          = 20 -	SYS_EPOLL_CTL              = 21 -	SYS_EPOLL_PWAIT            = 22 -	SYS_DUP                    = 23 -	SYS_DUP3                   = 24 -	SYS_FCNTL                  = 25 -	SYS_INOTIFY_INIT1          = 26 -	SYS_INOTIFY_ADD_WATCH      = 27 -	SYS_INOTIFY_RM_WATCH       = 28 -	SYS_IOCTL                  = 29 -	SYS_IOPRIO_SET             = 30 -	SYS_IOPRIO_GET             = 31 -	SYS_FLOCK                  = 32 -	SYS_MKNODAT                = 33 -	SYS_MKDIRAT                = 34 -	SYS_UNLINKAT               = 35 -	SYS_SYMLINKAT              = 36 -	SYS_LINKAT                 = 37 -	SYS_UMOUNT2                = 39 -	SYS_MOUNT                  = 40 -	SYS_PIVOT_ROOT             = 41 -	SYS_NFSSERVCTL             = 42 -	SYS_STATFS                 = 43 -	SYS_FSTATFS                = 44 -	SYS_TRUNCATE               = 45 -	SYS_FTRUNCATE              = 46 -	SYS_FALLOCATE              = 47 -	SYS_FACCESSAT              = 48 -	SYS_CHDIR                  = 49 -	SYS_FCHDIR                 = 50 -	SYS_CHROOT                 = 51 -	SYS_FCHMOD                 = 52 -	SYS_FCHMODAT               = 53 -	SYS_FCHOWNAT               = 54 -	SYS_FCHOWN                 = 55 -	SYS_OPENAT                 = 56 -	SYS_CLOSE                  = 57 -	SYS_VHANGUP                = 58 -	SYS_PIPE2                  = 59 -	SYS_QUOTACTL               = 60 -	SYS_GETDENTS64             = 61 -	SYS_LSEEK                  = 62 -	SYS_READ                   = 63 -	SYS_WRITE                  = 64 -	SYS_READV                  = 65 -	SYS_WRITEV                 = 66 -	SYS_PREAD64                = 67 -	SYS_PWRITE64               = 68 -	SYS_PREADV                 = 69 -	SYS_PWRITEV                = 70 -	SYS_SENDFILE               = 71 -	SYS_PSELECT6               = 72 -	SYS_PPOLL                  = 73 -	SYS_SIGNALFD4              = 74 -	SYS_VMSPLICE               = 75 -	SYS_SPLICE                 = 76 -	SYS_TEE                    = 77 -	SYS_READLINKAT             = 78 -	SYS_FSTATAT                = 79 -	SYS_FSTAT                  = 80 -	SYS_SYNC                   = 81 -	SYS_FSYNC                  = 82 -	SYS_FDATASYNC              = 83 -	SYS_SYNC_FILE_RANGE        = 84 -	SYS_TIMERFD_CREATE         = 85 -	SYS_TIMERFD_SETTIME        = 86 -	SYS_TIMERFD_GETTIME        = 87 -	SYS_UTIMENSAT              = 88 -	SYS_ACCT                   = 89 -	SYS_CAPGET                 = 90 -	SYS_CAPSET                 = 91 -	SYS_PERSONALITY            = 92 -	SYS_EXIT                   = 93 -	SYS_EXIT_GROUP             = 94 -	SYS_WAITID                 = 95 -	SYS_SET_TID_ADDRESS        = 96 -	SYS_UNSHARE                = 97 -	SYS_FUTEX                  = 98 -	SYS_SET_ROBUST_LIST        = 99 -	SYS_GET_ROBUST_LIST        = 100 -	SYS_NANOSLEEP              = 101 -	SYS_GETITIMER              = 102 -	SYS_SETITIMER              = 103 -	SYS_KEXEC_LOAD             = 104 -	SYS_INIT_MODULE            = 105 -	SYS_DELETE_MODULE          = 106 -	SYS_TIMER_CREATE           = 107 -	SYS_TIMER_GETTIME          = 108 -	SYS_TIMER_GETOVERRUN       = 109 -	SYS_TIMER_SETTIME          = 110 -	SYS_TIMER_DELETE           = 111 -	SYS_CLOCK_SETTIME          = 112 -	SYS_CLOCK_GETTIME          = 113 -	SYS_CLOCK_GETRES           = 114 -	SYS_CLOCK_NANOSLEEP        = 115 -	SYS_SYSLOG                 = 116 -	SYS_PTRACE                 = 117 -	SYS_SCHED_SETPARAM         = 118 -	SYS_SCHED_SETSCHEDULER     = 119 -	SYS_SCHED_GETSCHEDULER     = 120 -	SYS_SCHED_GETPARAM         = 121 -	SYS_SCHED_SETAFFINITY      = 122 -	SYS_SCHED_GETAFFINITY      = 123 -	SYS_SCHED_YIELD            = 124 -	SYS_SCHED_GET_PRIORITY_MAX = 125 -	SYS_SCHED_GET_PRIORITY_MIN = 126 -	SYS_SCHED_RR_GET_INTERVAL  = 127 -	SYS_RESTART_SYSCALL        = 128 -	SYS_KILL                   = 129 -	SYS_TKILL                  = 130 -	SYS_TGKILL                 = 131 -	SYS_SIGALTSTACK            = 132 -	SYS_RT_SIGSUSPEND          = 133 -	SYS_RT_SIGACTION           = 134 -	SYS_RT_SIGPROCMASK         = 135 -	SYS_RT_SIGPENDING          = 136 -	SYS_RT_SIGTIMEDWAIT        = 137 -	SYS_RT_SIGQUEUEINFO        = 138 -	SYS_RT_SIGRETURN           = 139 -	SYS_SETPRIORITY            = 140 -	SYS_GETPRIORITY            = 141 -	SYS_REBOOT                 = 142 -	SYS_SETREGID               = 143 -	SYS_SETGID                 = 144 -	SYS_SETREUID               = 145 -	SYS_SETUID                 = 146 -	SYS_SETRESUID              = 147 -	SYS_GETRESUID              = 148 -	SYS_SETRESGID              = 149 -	SYS_GETRESGID              = 150 -	SYS_SETFSUID               = 151 -	SYS_SETFSGID               = 152 -	SYS_TIMES                  = 153 -	SYS_SETPGID                = 154 -	SYS_GETPGID                = 155 -	SYS_GETSID                 = 156 -	SYS_SETSID                 = 157 -	SYS_GETGROUPS              = 158 -	SYS_SETGROUPS              = 159 -	SYS_UNAME                  = 160 -	SYS_SETHOSTNAME            = 161 -	SYS_SETDOMAINNAME          = 162 -	SYS_GETRLIMIT              = 163 -	SYS_SETRLIMIT              = 164 -	SYS_GETRUSAGE              = 165 -	SYS_UMASK                  = 166 -	SYS_PRCTL                  = 167 -	SYS_GETCPU                 = 168 -	SYS_GETTIMEOFDAY           = 169 -	SYS_SETTIMEOFDAY           = 170 -	SYS_ADJTIMEX               = 171 -	SYS_GETPID                 = 172 -	SYS_GETPPID                = 173 -	SYS_GETUID                 = 174 -	SYS_GETEUID                = 175 -	SYS_GETGID                 = 176 -	SYS_GETEGID                = 177 -	SYS_GETTID                 = 178 -	SYS_SYSINFO                = 179 -	SYS_MQ_OPEN                = 180 -	SYS_MQ_UNLINK              = 181 -	SYS_MQ_TIMEDSEND           = 182 -	SYS_MQ_TIMEDRECEIVE        = 183 -	SYS_MQ_NOTIFY              = 184 -	SYS_MQ_GETSETATTR          = 185 -	SYS_MSGGET                 = 186 -	SYS_MSGCTL                 = 187 -	SYS_MSGRCV                 = 188 -	SYS_MSGSND                 = 189 -	SYS_SEMGET                 = 190 -	SYS_SEMCTL                 = 191 -	SYS_SEMTIMEDOP             = 192 -	SYS_SEMOP                  = 193 -	SYS_SHMGET                 = 194 -	SYS_SHMCTL                 = 195 -	SYS_SHMAT                  = 196 -	SYS_SHMDT                  = 197 -	SYS_SOCKET                 = 198 -	SYS_SOCKETPAIR             = 199 -	SYS_BIND                   = 200 -	SYS_LISTEN                 = 201 -	SYS_ACCEPT                 = 202 -	SYS_CONNECT                = 203 -	SYS_GETSOCKNAME            = 204 -	SYS_GETPEERNAME            = 205 -	SYS_SENDTO                 = 206 -	SYS_RECVFROM               = 207 -	SYS_SETSOCKOPT             = 208 -	SYS_GETSOCKOPT             = 209 -	SYS_SHUTDOWN               = 210 -	SYS_SENDMSG                = 211 -	SYS_RECVMSG                = 212 -	SYS_READAHEAD              = 213 -	SYS_BRK                    = 214 -	SYS_MUNMAP                 = 215 -	SYS_MREMAP                 = 216 -	SYS_ADD_KEY                = 217 -	SYS_REQUEST_KEY            = 218 -	SYS_KEYCTL                 = 219 -	SYS_CLONE                  = 220 -	SYS_EXECVE                 = 221 -	SYS_MMAP                   = 222 -	SYS_FADVISE64              = 223 -	SYS_SWAPON                 = 224 -	SYS_SWAPOFF                = 225 -	SYS_MPROTECT               = 226 -	SYS_MSYNC                  = 227 -	SYS_MLOCK                  = 228 -	SYS_MUNLOCK                = 229 -	SYS_MLOCKALL               = 230 -	SYS_MUNLOCKALL             = 231 -	SYS_MINCORE                = 232 -	SYS_MADVISE                = 233 -	SYS_REMAP_FILE_PAGES       = 234 -	SYS_MBIND                  = 235 -	SYS_GET_MEMPOLICY          = 236 -	SYS_SET_MEMPOLICY          = 237 -	SYS_MIGRATE_PAGES          = 238 -	SYS_MOVE_PAGES             = 239 -	SYS_RT_TGSIGQUEUEINFO      = 240 -	SYS_PERF_EVENT_OPEN        = 241 -	SYS_ACCEPT4                = 242 -	SYS_RECVMMSG               = 243 -	SYS_ARCH_SPECIFIC_SYSCALL  = 244 -	SYS_WAIT4                  = 260 -	SYS_PRLIMIT64              = 261 -	SYS_FANOTIFY_INIT          = 262 -	SYS_FANOTIFY_MARK          = 263 -	SYS_NAME_TO_HANDLE_AT      = 264 -	SYS_OPEN_BY_HANDLE_AT      = 265 -	SYS_CLOCK_ADJTIME          = 266 -	SYS_SYNCFS                 = 267 -	SYS_SETNS                  = 268 -	SYS_SENDMMSG               = 269 -	SYS_PROCESS_VM_READV       = 270 -	SYS_PROCESS_VM_WRITEV      = 271 -	SYS_KCMP                   = 272 -	SYS_FINIT_MODULE           = 273 -	SYS_SCHED_SETATTR          = 274 -	SYS_SCHED_GETATTR          = 275 -	SYS_RENAMEAT2              = 276 -	SYS_SECCOMP                = 277 -	SYS_GETRANDOM              = 278 -	SYS_MEMFD_CREATE           = 279 -	SYS_BPF                    = 280 -	SYS_EXECVEAT               = 281 -	SYS_USERFAULTFD            = 282 -	SYS_MEMBARRIER             = 283 -	SYS_MLOCK2                 = 284 -	SYS_COPY_FILE_RANGE        = 285 -	SYS_PREADV2                = 286 -	SYS_PWRITEV2               = 287 -	SYS_PKEY_MPROTECT          = 288 -	SYS_PKEY_ALLOC             = 289 -	SYS_PKEY_FREE              = 290 -	SYS_STATX                  = 291 -	SYS_IO_PGETEVENTS          = 292 -	SYS_RSEQ                   = 293 -	SYS_KEXEC_FILE_LOAD        = 294 -	SYS_PIDFD_SEND_SIGNAL      = 424 -	SYS_IO_URING_SETUP         = 425 -	SYS_IO_URING_ENTER         = 426 -	SYS_IO_URING_REGISTER      = 427 -	SYS_OPEN_TREE              = 428 -	SYS_MOVE_MOUNT             = 429 -	SYS_FSOPEN                 = 430 -	SYS_FSCONFIG               = 431 -	SYS_FSMOUNT                = 432 -	SYS_FSPICK                 = 433 -	SYS_PIDFD_OPEN             = 434 -	SYS_CLONE3                 = 435 -	SYS_CLOSE_RANGE            = 436 -	SYS_OPENAT2                = 437 -	SYS_PIDFD_GETFD            = 438 -	SYS_FACCESSAT2             = 439 -	SYS_PROCESS_MADVISE        = 440 -	SYS_EPOLL_PWAIT2           = 441 -	SYS_MOUNT_SETATTR          = 442 +	SYS_IO_SETUP                = 0 +	SYS_IO_DESTROY              = 1 +	SYS_IO_SUBMIT               = 2 +	SYS_IO_CANCEL               = 3 +	SYS_IO_GETEVENTS            = 4 +	SYS_SETXATTR                = 5 +	SYS_LSETXATTR               = 6 +	SYS_FSETXATTR               = 7 +	SYS_GETXATTR                = 8 +	SYS_LGETXATTR               = 9 +	SYS_FGETXATTR               = 10 +	SYS_LISTXATTR               = 11 +	SYS_LLISTXATTR              = 12 +	SYS_FLISTXATTR              = 13 +	SYS_REMOVEXATTR             = 14 +	SYS_LREMOVEXATTR            = 15 +	SYS_FREMOVEXATTR            = 16 +	SYS_GETCWD                  = 17 +	SYS_LOOKUP_DCOOKIE          = 18 +	SYS_EVENTFD2                = 19 +	SYS_EPOLL_CREATE1           = 20 +	SYS_EPOLL_CTL               = 21 +	SYS_EPOLL_PWAIT             = 22 +	SYS_DUP                     = 23 +	SYS_DUP3                    = 24 +	SYS_FCNTL                   = 25 +	SYS_INOTIFY_INIT1           = 26 +	SYS_INOTIFY_ADD_WATCH       = 27 +	SYS_INOTIFY_RM_WATCH        = 28 +	SYS_IOCTL                   = 29 +	SYS_IOPRIO_SET              = 30 +	SYS_IOPRIO_GET              = 31 +	SYS_FLOCK                   = 32 +	SYS_MKNODAT                 = 33 +	SYS_MKDIRAT                 = 34 +	SYS_UNLINKAT                = 35 +	SYS_SYMLINKAT               = 36 +	SYS_LINKAT                  = 37 +	SYS_UMOUNT2                 = 39 +	SYS_MOUNT                   = 40 +	SYS_PIVOT_ROOT              = 41 +	SYS_NFSSERVCTL              = 42 +	SYS_STATFS                  = 43 +	SYS_FSTATFS                 = 44 +	SYS_TRUNCATE                = 45 +	SYS_FTRUNCATE               = 46 +	SYS_FALLOCATE               = 47 +	SYS_FACCESSAT               = 48 +	SYS_CHDIR                   = 49 +	SYS_FCHDIR                  = 50 +	SYS_CHROOT                  = 51 +	SYS_FCHMOD                  = 52 +	SYS_FCHMODAT                = 53 +	SYS_FCHOWNAT                = 54 +	SYS_FCHOWN                  = 55 +	SYS_OPENAT                  = 56 +	SYS_CLOSE                   = 57 +	SYS_VHANGUP                 = 58 +	SYS_PIPE2                   = 59 +	SYS_QUOTACTL                = 60 +	SYS_GETDENTS64              = 61 +	SYS_LSEEK                   = 62 +	SYS_READ                    = 63 +	SYS_WRITE                   = 64 +	SYS_READV                   = 65 +	SYS_WRITEV                  = 66 +	SYS_PREAD64                 = 67 +	SYS_PWRITE64                = 68 +	SYS_PREADV                  = 69 +	SYS_PWRITEV                 = 70 +	SYS_SENDFILE                = 71 +	SYS_PSELECT6                = 72 +	SYS_PPOLL                   = 73 +	SYS_SIGNALFD4               = 74 +	SYS_VMSPLICE                = 75 +	SYS_SPLICE                  = 76 +	SYS_TEE                     = 77 +	SYS_READLINKAT              = 78 +	SYS_FSTATAT                 = 79 +	SYS_FSTAT                   = 80 +	SYS_SYNC                    = 81 +	SYS_FSYNC                   = 82 +	SYS_FDATASYNC               = 83 +	SYS_SYNC_FILE_RANGE         = 84 +	SYS_TIMERFD_CREATE          = 85 +	SYS_TIMERFD_SETTIME         = 86 +	SYS_TIMERFD_GETTIME         = 87 +	SYS_UTIMENSAT               = 88 +	SYS_ACCT                    = 89 +	SYS_CAPGET                  = 90 +	SYS_CAPSET                  = 91 +	SYS_PERSONALITY             = 92 +	SYS_EXIT                    = 93 +	SYS_EXIT_GROUP              = 94 +	SYS_WAITID                  = 95 +	SYS_SET_TID_ADDRESS         = 96 +	SYS_UNSHARE                 = 97 +	SYS_FUTEX                   = 98 +	SYS_SET_ROBUST_LIST         = 99 +	SYS_GET_ROBUST_LIST         = 100 +	SYS_NANOSLEEP               = 101 +	SYS_GETITIMER               = 102 +	SYS_SETITIMER               = 103 +	SYS_KEXEC_LOAD              = 104 +	SYS_INIT_MODULE             = 105 +	SYS_DELETE_MODULE           = 106 +	SYS_TIMER_CREATE            = 107 +	SYS_TIMER_GETTIME           = 108 +	SYS_TIMER_GETOVERRUN        = 109 +	SYS_TIMER_SETTIME           = 110 +	SYS_TIMER_DELETE            = 111 +	SYS_CLOCK_SETTIME           = 112 +	SYS_CLOCK_GETTIME           = 113 +	SYS_CLOCK_GETRES            = 114 +	SYS_CLOCK_NANOSLEEP         = 115 +	SYS_SYSLOG                  = 116 +	SYS_PTRACE                  = 117 +	SYS_SCHED_SETPARAM          = 118 +	SYS_SCHED_SETSCHEDULER      = 119 +	SYS_SCHED_GETSCHEDULER      = 120 +	SYS_SCHED_GETPARAM          = 121 +	SYS_SCHED_SETAFFINITY       = 122 +	SYS_SCHED_GETAFFINITY       = 123 +	SYS_SCHED_YIELD             = 124 +	SYS_SCHED_GET_PRIORITY_MAX  = 125 +	SYS_SCHED_GET_PRIORITY_MIN  = 126 +	SYS_SCHED_RR_GET_INTERVAL   = 127 +	SYS_RESTART_SYSCALL         = 128 +	SYS_KILL                    = 129 +	SYS_TKILL                   = 130 +	SYS_TGKILL                  = 131 +	SYS_SIGALTSTACK             = 132 +	SYS_RT_SIGSUSPEND           = 133 +	SYS_RT_SIGACTION            = 134 +	SYS_RT_SIGPROCMASK          = 135 +	SYS_RT_SIGPENDING           = 136 +	SYS_RT_SIGTIMEDWAIT         = 137 +	SYS_RT_SIGQUEUEINFO         = 138 +	SYS_RT_SIGRETURN            = 139 +	SYS_SETPRIORITY             = 140 +	SYS_GETPRIORITY             = 141 +	SYS_REBOOT                  = 142 +	SYS_SETREGID                = 143 +	SYS_SETGID                  = 144 +	SYS_SETREUID                = 145 +	SYS_SETUID                  = 146 +	SYS_SETRESUID               = 147 +	SYS_GETRESUID               = 148 +	SYS_SETRESGID               = 149 +	SYS_GETRESGID               = 150 +	SYS_SETFSUID                = 151 +	SYS_SETFSGID                = 152 +	SYS_TIMES                   = 153 +	SYS_SETPGID                 = 154 +	SYS_GETPGID                 = 155 +	SYS_GETSID                  = 156 +	SYS_SETSID                  = 157 +	SYS_GETGROUPS               = 158 +	SYS_SETGROUPS               = 159 +	SYS_UNAME                   = 160 +	SYS_SETHOSTNAME             = 161 +	SYS_SETDOMAINNAME           = 162 +	SYS_GETRLIMIT               = 163 +	SYS_SETRLIMIT               = 164 +	SYS_GETRUSAGE               = 165 +	SYS_UMASK                   = 166 +	SYS_PRCTL                   = 167 +	SYS_GETCPU                  = 168 +	SYS_GETTIMEOFDAY            = 169 +	SYS_SETTIMEOFDAY            = 170 +	SYS_ADJTIMEX                = 171 +	SYS_GETPID                  = 172 +	SYS_GETPPID                 = 173 +	SYS_GETUID                  = 174 +	SYS_GETEUID                 = 175 +	SYS_GETGID                  = 176 +	SYS_GETEGID                 = 177 +	SYS_GETTID                  = 178 +	SYS_SYSINFO                 = 179 +	SYS_MQ_OPEN                 = 180 +	SYS_MQ_UNLINK               = 181 +	SYS_MQ_TIMEDSEND            = 182 +	SYS_MQ_TIMEDRECEIVE         = 183 +	SYS_MQ_NOTIFY               = 184 +	SYS_MQ_GETSETATTR           = 185 +	SYS_MSGGET                  = 186 +	SYS_MSGCTL                  = 187 +	SYS_MSGRCV                  = 188 +	SYS_MSGSND                  = 189 +	SYS_SEMGET                  = 190 +	SYS_SEMCTL                  = 191 +	SYS_SEMTIMEDOP              = 192 +	SYS_SEMOP                   = 193 +	SYS_SHMGET                  = 194 +	SYS_SHMCTL                  = 195 +	SYS_SHMAT                   = 196 +	SYS_SHMDT                   = 197 +	SYS_SOCKET                  = 198 +	SYS_SOCKETPAIR              = 199 +	SYS_BIND                    = 200 +	SYS_LISTEN                  = 201 +	SYS_ACCEPT                  = 202 +	SYS_CONNECT                 = 203 +	SYS_GETSOCKNAME             = 204 +	SYS_GETPEERNAME             = 205 +	SYS_SENDTO                  = 206 +	SYS_RECVFROM                = 207 +	SYS_SETSOCKOPT              = 208 +	SYS_GETSOCKOPT              = 209 +	SYS_SHUTDOWN                = 210 +	SYS_SENDMSG                 = 211 +	SYS_RECVMSG                 = 212 +	SYS_READAHEAD               = 213 +	SYS_BRK                     = 214 +	SYS_MUNMAP                  = 215 +	SYS_MREMAP                  = 216 +	SYS_ADD_KEY                 = 217 +	SYS_REQUEST_KEY             = 218 +	SYS_KEYCTL                  = 219 +	SYS_CLONE                   = 220 +	SYS_EXECVE                  = 221 +	SYS_MMAP                    = 222 +	SYS_FADVISE64               = 223 +	SYS_SWAPON                  = 224 +	SYS_SWAPOFF                 = 225 +	SYS_MPROTECT                = 226 +	SYS_MSYNC                   = 227 +	SYS_MLOCK                   = 228 +	SYS_MUNLOCK                 = 229 +	SYS_MLOCKALL                = 230 +	SYS_MUNLOCKALL              = 231 +	SYS_MINCORE                 = 232 +	SYS_MADVISE                 = 233 +	SYS_REMAP_FILE_PAGES        = 234 +	SYS_MBIND                   = 235 +	SYS_GET_MEMPOLICY           = 236 +	SYS_SET_MEMPOLICY           = 237 +	SYS_MIGRATE_PAGES           = 238 +	SYS_MOVE_PAGES              = 239 +	SYS_RT_TGSIGQUEUEINFO       = 240 +	SYS_PERF_EVENT_OPEN         = 241 +	SYS_ACCEPT4                 = 242 +	SYS_RECVMMSG                = 243 +	SYS_ARCH_SPECIFIC_SYSCALL   = 244 +	SYS_WAIT4                   = 260 +	SYS_PRLIMIT64               = 261 +	SYS_FANOTIFY_INIT           = 262 +	SYS_FANOTIFY_MARK           = 263 +	SYS_NAME_TO_HANDLE_AT       = 264 +	SYS_OPEN_BY_HANDLE_AT       = 265 +	SYS_CLOCK_ADJTIME           = 266 +	SYS_SYNCFS                  = 267 +	SYS_SETNS                   = 268 +	SYS_SENDMMSG                = 269 +	SYS_PROCESS_VM_READV        = 270 +	SYS_PROCESS_VM_WRITEV       = 271 +	SYS_KCMP                    = 272 +	SYS_FINIT_MODULE            = 273 +	SYS_SCHED_SETATTR           = 274 +	SYS_SCHED_GETATTR           = 275 +	SYS_RENAMEAT2               = 276 +	SYS_SECCOMP                 = 277 +	SYS_GETRANDOM               = 278 +	SYS_MEMFD_CREATE            = 279 +	SYS_BPF                     = 280 +	SYS_EXECVEAT                = 281 +	SYS_USERFAULTFD             = 282 +	SYS_MEMBARRIER              = 283 +	SYS_MLOCK2                  = 284 +	SYS_COPY_FILE_RANGE         = 285 +	SYS_PREADV2                 = 286 +	SYS_PWRITEV2                = 287 +	SYS_PKEY_MPROTECT           = 288 +	SYS_PKEY_ALLOC              = 289 +	SYS_PKEY_FREE               = 290 +	SYS_STATX                   = 291 +	SYS_IO_PGETEVENTS           = 292 +	SYS_RSEQ                    = 293 +	SYS_KEXEC_FILE_LOAD         = 294 +	SYS_PIDFD_SEND_SIGNAL       = 424 +	SYS_IO_URING_SETUP          = 425 +	SYS_IO_URING_ENTER          = 426 +	SYS_IO_URING_REGISTER       = 427 +	SYS_OPEN_TREE               = 428 +	SYS_MOVE_MOUNT              = 429 +	SYS_FSOPEN                  = 430 +	SYS_FSCONFIG                = 431 +	SYS_FSMOUNT                 = 432 +	SYS_FSPICK                  = 433 +	SYS_PIDFD_OPEN              = 434 +	SYS_CLONE3                  = 435 +	SYS_CLOSE_RANGE             = 436 +	SYS_OPENAT2                 = 437 +	SYS_PIDFD_GETFD             = 438 +	SYS_FACCESSAT2              = 439 +	SYS_PROCESS_MADVISE         = 440 +	SYS_EPOLL_PWAIT2            = 441 +	SYS_MOUNT_SETATTR           = 442 +	SYS_LANDLOCK_CREATE_RULESET = 444 +	SYS_LANDLOCK_ADD_RULE       = 445 +	SYS_LANDLOCK_RESTRICT_SELF  = 446  ) diff --git a/vendor/golang.org/x/sys/unix/zsysnum_linux_s390x.go b/vendor/golang.org/x/sys/unix/zsysnum_linux_s390x.go index aea5760ce..378e6ec8b 100644 --- a/vendor/golang.org/x/sys/unix/zsysnum_linux_s390x.go +++ b/vendor/golang.org/x/sys/unix/zsysnum_linux_s390x.go @@ -7,365 +7,368 @@  package unix  const ( -	SYS_EXIT                   = 1 -	SYS_FORK                   = 2 -	SYS_READ                   = 3 -	SYS_WRITE                  = 4 -	SYS_OPEN                   = 5 -	SYS_CLOSE                  = 6 -	SYS_RESTART_SYSCALL        = 7 -	SYS_CREAT                  = 8 -	SYS_LINK                   = 9 -	SYS_UNLINK                 = 10 -	SYS_EXECVE                 = 11 -	SYS_CHDIR                  = 12 -	SYS_MKNOD                  = 14 -	SYS_CHMOD                  = 15 -	SYS_LSEEK                  = 19 -	SYS_GETPID                 = 20 -	SYS_MOUNT                  = 21 -	SYS_UMOUNT                 = 22 -	SYS_PTRACE                 = 26 -	SYS_ALARM                  = 27 -	SYS_PAUSE                  = 29 -	SYS_UTIME                  = 30 -	SYS_ACCESS                 = 33 -	SYS_NICE                   = 34 -	SYS_SYNC                   = 36 -	SYS_KILL                   = 37 -	SYS_RENAME                 = 38 -	SYS_MKDIR                  = 39 -	SYS_RMDIR                  = 40 -	SYS_DUP                    = 41 -	SYS_PIPE                   = 42 -	SYS_TIMES                  = 43 -	SYS_BRK                    = 45 -	SYS_SIGNAL                 = 48 -	SYS_ACCT                   = 51 -	SYS_UMOUNT2                = 52 -	SYS_IOCTL                  = 54 -	SYS_FCNTL                  = 55 -	SYS_SETPGID                = 57 -	SYS_UMASK                  = 60 -	SYS_CHROOT                 = 61 -	SYS_USTAT                  = 62 -	SYS_DUP2                   = 63 -	SYS_GETPPID                = 64 -	SYS_GETPGRP                = 65 -	SYS_SETSID                 = 66 -	SYS_SIGACTION              = 67 -	SYS_SIGSUSPEND             = 72 -	SYS_SIGPENDING             = 73 -	SYS_SETHOSTNAME            = 74 -	SYS_SETRLIMIT              = 75 -	SYS_GETRUSAGE              = 77 -	SYS_GETTIMEOFDAY           = 78 -	SYS_SETTIMEOFDAY           = 79 -	SYS_SYMLINK                = 83 -	SYS_READLINK               = 85 -	SYS_USELIB                 = 86 -	SYS_SWAPON                 = 87 -	SYS_REBOOT                 = 88 -	SYS_READDIR                = 89 -	SYS_MMAP                   = 90 -	SYS_MUNMAP                 = 91 -	SYS_TRUNCATE               = 92 -	SYS_FTRUNCATE              = 93 -	SYS_FCHMOD                 = 94 -	SYS_GETPRIORITY            = 96 -	SYS_SETPRIORITY            = 97 -	SYS_STATFS                 = 99 -	SYS_FSTATFS                = 100 -	SYS_SOCKETCALL             = 102 -	SYS_SYSLOG                 = 103 -	SYS_SETITIMER              = 104 -	SYS_GETITIMER              = 105 -	SYS_STAT                   = 106 -	SYS_LSTAT                  = 107 -	SYS_FSTAT                  = 108 -	SYS_LOOKUP_DCOOKIE         = 110 -	SYS_VHANGUP                = 111 -	SYS_IDLE                   = 112 -	SYS_WAIT4                  = 114 -	SYS_SWAPOFF                = 115 -	SYS_SYSINFO                = 116 -	SYS_IPC                    = 117 -	SYS_FSYNC                  = 118 -	SYS_SIGRETURN              = 119 -	SYS_CLONE                  = 120 -	SYS_SETDOMAINNAME          = 121 -	SYS_UNAME                  = 122 -	SYS_ADJTIMEX               = 124 -	SYS_MPROTECT               = 125 -	SYS_SIGPROCMASK            = 126 -	SYS_CREATE_MODULE          = 127 -	SYS_INIT_MODULE            = 128 -	SYS_DELETE_MODULE          = 129 -	SYS_GET_KERNEL_SYMS        = 130 -	SYS_QUOTACTL               = 131 -	SYS_GETPGID                = 132 -	SYS_FCHDIR                 = 133 -	SYS_BDFLUSH                = 134 -	SYS_SYSFS                  = 135 -	SYS_PERSONALITY            = 136 -	SYS_AFS_SYSCALL            = 137 -	SYS_GETDENTS               = 141 -	SYS_SELECT                 = 142 -	SYS_FLOCK                  = 143 -	SYS_MSYNC                  = 144 -	SYS_READV                  = 145 -	SYS_WRITEV                 = 146 -	SYS_GETSID                 = 147 -	SYS_FDATASYNC              = 148 -	SYS__SYSCTL                = 149 -	SYS_MLOCK                  = 150 -	SYS_MUNLOCK                = 151 -	SYS_MLOCKALL               = 152 -	SYS_MUNLOCKALL             = 153 -	SYS_SCHED_SETPARAM         = 154 -	SYS_SCHED_GETPARAM         = 155 -	SYS_SCHED_SETSCHEDULER     = 156 -	SYS_SCHED_GETSCHEDULER     = 157 -	SYS_SCHED_YIELD            = 158 -	SYS_SCHED_GET_PRIORITY_MAX = 159 -	SYS_SCHED_GET_PRIORITY_MIN = 160 -	SYS_SCHED_RR_GET_INTERVAL  = 161 -	SYS_NANOSLEEP              = 162 -	SYS_MREMAP                 = 163 -	SYS_QUERY_MODULE           = 167 -	SYS_POLL                   = 168 -	SYS_NFSSERVCTL             = 169 -	SYS_PRCTL                  = 172 -	SYS_RT_SIGRETURN           = 173 -	SYS_RT_SIGACTION           = 174 -	SYS_RT_SIGPROCMASK         = 175 -	SYS_RT_SIGPENDING          = 176 -	SYS_RT_SIGTIMEDWAIT        = 177 -	SYS_RT_SIGQUEUEINFO        = 178 -	SYS_RT_SIGSUSPEND          = 179 -	SYS_PREAD64                = 180 -	SYS_PWRITE64               = 181 -	SYS_GETCWD                 = 183 -	SYS_CAPGET                 = 184 -	SYS_CAPSET                 = 185 -	SYS_SIGALTSTACK            = 186 -	SYS_SENDFILE               = 187 -	SYS_GETPMSG                = 188 -	SYS_PUTPMSG                = 189 -	SYS_VFORK                  = 190 -	SYS_GETRLIMIT              = 191 -	SYS_LCHOWN                 = 198 -	SYS_GETUID                 = 199 -	SYS_GETGID                 = 200 -	SYS_GETEUID                = 201 -	SYS_GETEGID                = 202 -	SYS_SETREUID               = 203 -	SYS_SETREGID               = 204 -	SYS_GETGROUPS              = 205 -	SYS_SETGROUPS              = 206 -	SYS_FCHOWN                 = 207 -	SYS_SETRESUID              = 208 -	SYS_GETRESUID              = 209 -	SYS_SETRESGID              = 210 -	SYS_GETRESGID              = 211 -	SYS_CHOWN                  = 212 -	SYS_SETUID                 = 213 -	SYS_SETGID                 = 214 -	SYS_SETFSUID               = 215 -	SYS_SETFSGID               = 216 -	SYS_PIVOT_ROOT             = 217 -	SYS_MINCORE                = 218 -	SYS_MADVISE                = 219 -	SYS_GETDENTS64             = 220 -	SYS_READAHEAD              = 222 -	SYS_SETXATTR               = 224 -	SYS_LSETXATTR              = 225 -	SYS_FSETXATTR              = 226 -	SYS_GETXATTR               = 227 -	SYS_LGETXATTR              = 228 -	SYS_FGETXATTR              = 229 -	SYS_LISTXATTR              = 230 -	SYS_LLISTXATTR             = 231 -	SYS_FLISTXATTR             = 232 -	SYS_REMOVEXATTR            = 233 -	SYS_LREMOVEXATTR           = 234 -	SYS_FREMOVEXATTR           = 235 -	SYS_GETTID                 = 236 -	SYS_TKILL                  = 237 -	SYS_FUTEX                  = 238 -	SYS_SCHED_SETAFFINITY      = 239 -	SYS_SCHED_GETAFFINITY      = 240 -	SYS_TGKILL                 = 241 -	SYS_IO_SETUP               = 243 -	SYS_IO_DESTROY             = 244 -	SYS_IO_GETEVENTS           = 245 -	SYS_IO_SUBMIT              = 246 -	SYS_IO_CANCEL              = 247 -	SYS_EXIT_GROUP             = 248 -	SYS_EPOLL_CREATE           = 249 -	SYS_EPOLL_CTL              = 250 -	SYS_EPOLL_WAIT             = 251 -	SYS_SET_TID_ADDRESS        = 252 -	SYS_FADVISE64              = 253 -	SYS_TIMER_CREATE           = 254 -	SYS_TIMER_SETTIME          = 255 -	SYS_TIMER_GETTIME          = 256 -	SYS_TIMER_GETOVERRUN       = 257 -	SYS_TIMER_DELETE           = 258 -	SYS_CLOCK_SETTIME          = 259 -	SYS_CLOCK_GETTIME          = 260 -	SYS_CLOCK_GETRES           = 261 -	SYS_CLOCK_NANOSLEEP        = 262 -	SYS_STATFS64               = 265 -	SYS_FSTATFS64              = 266 -	SYS_REMAP_FILE_PAGES       = 267 -	SYS_MBIND                  = 268 -	SYS_GET_MEMPOLICY          = 269 -	SYS_SET_MEMPOLICY          = 270 -	SYS_MQ_OPEN                = 271 -	SYS_MQ_UNLINK              = 272 -	SYS_MQ_TIMEDSEND           = 273 -	SYS_MQ_TIMEDRECEIVE        = 274 -	SYS_MQ_NOTIFY              = 275 -	SYS_MQ_GETSETATTR          = 276 -	SYS_KEXEC_LOAD             = 277 -	SYS_ADD_KEY                = 278 -	SYS_REQUEST_KEY            = 279 -	SYS_KEYCTL                 = 280 -	SYS_WAITID                 = 281 -	SYS_IOPRIO_SET             = 282 -	SYS_IOPRIO_GET             = 283 -	SYS_INOTIFY_INIT           = 284 -	SYS_INOTIFY_ADD_WATCH      = 285 -	SYS_INOTIFY_RM_WATCH       = 286 -	SYS_MIGRATE_PAGES          = 287 -	SYS_OPENAT                 = 288 -	SYS_MKDIRAT                = 289 -	SYS_MKNODAT                = 290 -	SYS_FCHOWNAT               = 291 -	SYS_FUTIMESAT              = 292 -	SYS_NEWFSTATAT             = 293 -	SYS_UNLINKAT               = 294 -	SYS_RENAMEAT               = 295 -	SYS_LINKAT                 = 296 -	SYS_SYMLINKAT              = 297 -	SYS_READLINKAT             = 298 -	SYS_FCHMODAT               = 299 -	SYS_FACCESSAT              = 300 -	SYS_PSELECT6               = 301 -	SYS_PPOLL                  = 302 -	SYS_UNSHARE                = 303 -	SYS_SET_ROBUST_LIST        = 304 -	SYS_GET_ROBUST_LIST        = 305 -	SYS_SPLICE                 = 306 -	SYS_SYNC_FILE_RANGE        = 307 -	SYS_TEE                    = 308 -	SYS_VMSPLICE               = 309 -	SYS_MOVE_PAGES             = 310 -	SYS_GETCPU                 = 311 -	SYS_EPOLL_PWAIT            = 312 -	SYS_UTIMES                 = 313 -	SYS_FALLOCATE              = 314 -	SYS_UTIMENSAT              = 315 -	SYS_SIGNALFD               = 316 -	SYS_TIMERFD                = 317 -	SYS_EVENTFD                = 318 -	SYS_TIMERFD_CREATE         = 319 -	SYS_TIMERFD_SETTIME        = 320 -	SYS_TIMERFD_GETTIME        = 321 -	SYS_SIGNALFD4              = 322 -	SYS_EVENTFD2               = 323 -	SYS_INOTIFY_INIT1          = 324 -	SYS_PIPE2                  = 325 -	SYS_DUP3                   = 326 -	SYS_EPOLL_CREATE1          = 327 -	SYS_PREADV                 = 328 -	SYS_PWRITEV                = 329 -	SYS_RT_TGSIGQUEUEINFO      = 330 -	SYS_PERF_EVENT_OPEN        = 331 -	SYS_FANOTIFY_INIT          = 332 -	SYS_FANOTIFY_MARK          = 333 -	SYS_PRLIMIT64              = 334 -	SYS_NAME_TO_HANDLE_AT      = 335 -	SYS_OPEN_BY_HANDLE_AT      = 336 -	SYS_CLOCK_ADJTIME          = 337 -	SYS_SYNCFS                 = 338 -	SYS_SETNS                  = 339 -	SYS_PROCESS_VM_READV       = 340 -	SYS_PROCESS_VM_WRITEV      = 341 -	SYS_S390_RUNTIME_INSTR     = 342 -	SYS_KCMP                   = 343 -	SYS_FINIT_MODULE           = 344 -	SYS_SCHED_SETATTR          = 345 -	SYS_SCHED_GETATTR          = 346 -	SYS_RENAMEAT2              = 347 -	SYS_SECCOMP                = 348 -	SYS_GETRANDOM              = 349 -	SYS_MEMFD_CREATE           = 350 -	SYS_BPF                    = 351 -	SYS_S390_PCI_MMIO_WRITE    = 352 -	SYS_S390_PCI_MMIO_READ     = 353 -	SYS_EXECVEAT               = 354 -	SYS_USERFAULTFD            = 355 -	SYS_MEMBARRIER             = 356 -	SYS_RECVMMSG               = 357 -	SYS_SENDMMSG               = 358 -	SYS_SOCKET                 = 359 -	SYS_SOCKETPAIR             = 360 -	SYS_BIND                   = 361 -	SYS_CONNECT                = 362 -	SYS_LISTEN                 = 363 -	SYS_ACCEPT4                = 364 -	SYS_GETSOCKOPT             = 365 -	SYS_SETSOCKOPT             = 366 -	SYS_GETSOCKNAME            = 367 -	SYS_GETPEERNAME            = 368 -	SYS_SENDTO                 = 369 -	SYS_SENDMSG                = 370 -	SYS_RECVFROM               = 371 -	SYS_RECVMSG                = 372 -	SYS_SHUTDOWN               = 373 -	SYS_MLOCK2                 = 374 -	SYS_COPY_FILE_RANGE        = 375 -	SYS_PREADV2                = 376 -	SYS_PWRITEV2               = 377 -	SYS_S390_GUARDED_STORAGE   = 378 -	SYS_STATX                  = 379 -	SYS_S390_STHYI             = 380 -	SYS_KEXEC_FILE_LOAD        = 381 -	SYS_IO_PGETEVENTS          = 382 -	SYS_RSEQ                   = 383 -	SYS_PKEY_MPROTECT          = 384 -	SYS_PKEY_ALLOC             = 385 -	SYS_PKEY_FREE              = 386 -	SYS_SEMTIMEDOP             = 392 -	SYS_SEMGET                 = 393 -	SYS_SEMCTL                 = 394 -	SYS_SHMGET                 = 395 -	SYS_SHMCTL                 = 396 -	SYS_SHMAT                  = 397 -	SYS_SHMDT                  = 398 -	SYS_MSGGET                 = 399 -	SYS_MSGSND                 = 400 -	SYS_MSGRCV                 = 401 -	SYS_MSGCTL                 = 402 -	SYS_PIDFD_SEND_SIGNAL      = 424 -	SYS_IO_URING_SETUP         = 425 -	SYS_IO_URING_ENTER         = 426 -	SYS_IO_URING_REGISTER      = 427 -	SYS_OPEN_TREE              = 428 -	SYS_MOVE_MOUNT             = 429 -	SYS_FSOPEN                 = 430 -	SYS_FSCONFIG               = 431 -	SYS_FSMOUNT                = 432 -	SYS_FSPICK                 = 433 -	SYS_PIDFD_OPEN             = 434 -	SYS_CLONE3                 = 435 -	SYS_CLOSE_RANGE            = 436 -	SYS_OPENAT2                = 437 -	SYS_PIDFD_GETFD            = 438 -	SYS_FACCESSAT2             = 439 -	SYS_PROCESS_MADVISE        = 440 -	SYS_EPOLL_PWAIT2           = 441 -	SYS_MOUNT_SETATTR          = 442 +	SYS_EXIT                    = 1 +	SYS_FORK                    = 2 +	SYS_READ                    = 3 +	SYS_WRITE                   = 4 +	SYS_OPEN                    = 5 +	SYS_CLOSE                   = 6 +	SYS_RESTART_SYSCALL         = 7 +	SYS_CREAT                   = 8 +	SYS_LINK                    = 9 +	SYS_UNLINK                  = 10 +	SYS_EXECVE                  = 11 +	SYS_CHDIR                   = 12 +	SYS_MKNOD                   = 14 +	SYS_CHMOD                   = 15 +	SYS_LSEEK                   = 19 +	SYS_GETPID                  = 20 +	SYS_MOUNT                   = 21 +	SYS_UMOUNT                  = 22 +	SYS_PTRACE                  = 26 +	SYS_ALARM                   = 27 +	SYS_PAUSE                   = 29 +	SYS_UTIME                   = 30 +	SYS_ACCESS                  = 33 +	SYS_NICE                    = 34 +	SYS_SYNC                    = 36 +	SYS_KILL                    = 37 +	SYS_RENAME                  = 38 +	SYS_MKDIR                   = 39 +	SYS_RMDIR                   = 40 +	SYS_DUP                     = 41 +	SYS_PIPE                    = 42 +	SYS_TIMES                   = 43 +	SYS_BRK                     = 45 +	SYS_SIGNAL                  = 48 +	SYS_ACCT                    = 51 +	SYS_UMOUNT2                 = 52 +	SYS_IOCTL                   = 54 +	SYS_FCNTL                   = 55 +	SYS_SETPGID                 = 57 +	SYS_UMASK                   = 60 +	SYS_CHROOT                  = 61 +	SYS_USTAT                   = 62 +	SYS_DUP2                    = 63 +	SYS_GETPPID                 = 64 +	SYS_GETPGRP                 = 65 +	SYS_SETSID                  = 66 +	SYS_SIGACTION               = 67 +	SYS_SIGSUSPEND              = 72 +	SYS_SIGPENDING              = 73 +	SYS_SETHOSTNAME             = 74 +	SYS_SETRLIMIT               = 75 +	SYS_GETRUSAGE               = 77 +	SYS_GETTIMEOFDAY            = 78 +	SYS_SETTIMEOFDAY            = 79 +	SYS_SYMLINK                 = 83 +	SYS_READLINK                = 85 +	SYS_USELIB                  = 86 +	SYS_SWAPON                  = 87 +	SYS_REBOOT                  = 88 +	SYS_READDIR                 = 89 +	SYS_MMAP                    = 90 +	SYS_MUNMAP                  = 91 +	SYS_TRUNCATE                = 92 +	SYS_FTRUNCATE               = 93 +	SYS_FCHMOD                  = 94 +	SYS_GETPRIORITY             = 96 +	SYS_SETPRIORITY             = 97 +	SYS_STATFS                  = 99 +	SYS_FSTATFS                 = 100 +	SYS_SOCKETCALL              = 102 +	SYS_SYSLOG                  = 103 +	SYS_SETITIMER               = 104 +	SYS_GETITIMER               = 105 +	SYS_STAT                    = 106 +	SYS_LSTAT                   = 107 +	SYS_FSTAT                   = 108 +	SYS_LOOKUP_DCOOKIE          = 110 +	SYS_VHANGUP                 = 111 +	SYS_IDLE                    = 112 +	SYS_WAIT4                   = 114 +	SYS_SWAPOFF                 = 115 +	SYS_SYSINFO                 = 116 +	SYS_IPC                     = 117 +	SYS_FSYNC                   = 118 +	SYS_SIGRETURN               = 119 +	SYS_CLONE                   = 120 +	SYS_SETDOMAINNAME           = 121 +	SYS_UNAME                   = 122 +	SYS_ADJTIMEX                = 124 +	SYS_MPROTECT                = 125 +	SYS_SIGPROCMASK             = 126 +	SYS_CREATE_MODULE           = 127 +	SYS_INIT_MODULE             = 128 +	SYS_DELETE_MODULE           = 129 +	SYS_GET_KERNEL_SYMS         = 130 +	SYS_QUOTACTL                = 131 +	SYS_GETPGID                 = 132 +	SYS_FCHDIR                  = 133 +	SYS_BDFLUSH                 = 134 +	SYS_SYSFS                   = 135 +	SYS_PERSONALITY             = 136 +	SYS_AFS_SYSCALL             = 137 +	SYS_GETDENTS                = 141 +	SYS_SELECT                  = 142 +	SYS_FLOCK                   = 143 +	SYS_MSYNC                   = 144 +	SYS_READV                   = 145 +	SYS_WRITEV                  = 146 +	SYS_GETSID                  = 147 +	SYS_FDATASYNC               = 148 +	SYS__SYSCTL                 = 149 +	SYS_MLOCK                   = 150 +	SYS_MUNLOCK                 = 151 +	SYS_MLOCKALL                = 152 +	SYS_MUNLOCKALL              = 153 +	SYS_SCHED_SETPARAM          = 154 +	SYS_SCHED_GETPARAM          = 155 +	SYS_SCHED_SETSCHEDULER      = 156 +	SYS_SCHED_GETSCHEDULER      = 157 +	SYS_SCHED_YIELD             = 158 +	SYS_SCHED_GET_PRIORITY_MAX  = 159 +	SYS_SCHED_GET_PRIORITY_MIN  = 160 +	SYS_SCHED_RR_GET_INTERVAL   = 161 +	SYS_NANOSLEEP               = 162 +	SYS_MREMAP                  = 163 +	SYS_QUERY_MODULE            = 167 +	SYS_POLL                    = 168 +	SYS_NFSSERVCTL              = 169 +	SYS_PRCTL                   = 172 +	SYS_RT_SIGRETURN            = 173 +	SYS_RT_SIGACTION            = 174 +	SYS_RT_SIGPROCMASK          = 175 +	SYS_RT_SIGPENDING           = 176 +	SYS_RT_SIGTIMEDWAIT         = 177 +	SYS_RT_SIGQUEUEINFO         = 178 +	SYS_RT_SIGSUSPEND           = 179 +	SYS_PREAD64                 = 180 +	SYS_PWRITE64                = 181 +	SYS_GETCWD                  = 183 +	SYS_CAPGET                  = 184 +	SYS_CAPSET                  = 185 +	SYS_SIGALTSTACK             = 186 +	SYS_SENDFILE                = 187 +	SYS_GETPMSG                 = 188 +	SYS_PUTPMSG                 = 189 +	SYS_VFORK                   = 190 +	SYS_GETRLIMIT               = 191 +	SYS_LCHOWN                  = 198 +	SYS_GETUID                  = 199 +	SYS_GETGID                  = 200 +	SYS_GETEUID                 = 201 +	SYS_GETEGID                 = 202 +	SYS_SETREUID                = 203 +	SYS_SETREGID                = 204 +	SYS_GETGROUPS               = 205 +	SYS_SETGROUPS               = 206 +	SYS_FCHOWN                  = 207 +	SYS_SETRESUID               = 208 +	SYS_GETRESUID               = 209 +	SYS_SETRESGID               = 210 +	SYS_GETRESGID               = 211 +	SYS_CHOWN                   = 212 +	SYS_SETUID                  = 213 +	SYS_SETGID                  = 214 +	SYS_SETFSUID                = 215 +	SYS_SETFSGID                = 216 +	SYS_PIVOT_ROOT              = 217 +	SYS_MINCORE                 = 218 +	SYS_MADVISE                 = 219 +	SYS_GETDENTS64              = 220 +	SYS_READAHEAD               = 222 +	SYS_SETXATTR                = 224 +	SYS_LSETXATTR               = 225 +	SYS_FSETXATTR               = 226 +	SYS_GETXATTR                = 227 +	SYS_LGETXATTR               = 228 +	SYS_FGETXATTR               = 229 +	SYS_LISTXATTR               = 230 +	SYS_LLISTXATTR              = 231 +	SYS_FLISTXATTR              = 232 +	SYS_REMOVEXATTR             = 233 +	SYS_LREMOVEXATTR            = 234 +	SYS_FREMOVEXATTR            = 235 +	SYS_GETTID                  = 236 +	SYS_TKILL                   = 237 +	SYS_FUTEX                   = 238 +	SYS_SCHED_SETAFFINITY       = 239 +	SYS_SCHED_GETAFFINITY       = 240 +	SYS_TGKILL                  = 241 +	SYS_IO_SETUP                = 243 +	SYS_IO_DESTROY              = 244 +	SYS_IO_GETEVENTS            = 245 +	SYS_IO_SUBMIT               = 246 +	SYS_IO_CANCEL               = 247 +	SYS_EXIT_GROUP              = 248 +	SYS_EPOLL_CREATE            = 249 +	SYS_EPOLL_CTL               = 250 +	SYS_EPOLL_WAIT              = 251 +	SYS_SET_TID_ADDRESS         = 252 +	SYS_FADVISE64               = 253 +	SYS_TIMER_CREATE            = 254 +	SYS_TIMER_SETTIME           = 255 +	SYS_TIMER_GETTIME           = 256 +	SYS_TIMER_GETOVERRUN        = 257 +	SYS_TIMER_DELETE            = 258 +	SYS_CLOCK_SETTIME           = 259 +	SYS_CLOCK_GETTIME           = 260 +	SYS_CLOCK_GETRES            = 261 +	SYS_CLOCK_NANOSLEEP         = 262 +	SYS_STATFS64                = 265 +	SYS_FSTATFS64               = 266 +	SYS_REMAP_FILE_PAGES        = 267 +	SYS_MBIND                   = 268 +	SYS_GET_MEMPOLICY           = 269 +	SYS_SET_MEMPOLICY           = 270 +	SYS_MQ_OPEN                 = 271 +	SYS_MQ_UNLINK               = 272 +	SYS_MQ_TIMEDSEND            = 273 +	SYS_MQ_TIMEDRECEIVE         = 274 +	SYS_MQ_NOTIFY               = 275 +	SYS_MQ_GETSETATTR           = 276 +	SYS_KEXEC_LOAD              = 277 +	SYS_ADD_KEY                 = 278 +	SYS_REQUEST_KEY             = 279 +	SYS_KEYCTL                  = 280 +	SYS_WAITID                  = 281 +	SYS_IOPRIO_SET              = 282 +	SYS_IOPRIO_GET              = 283 +	SYS_INOTIFY_INIT            = 284 +	SYS_INOTIFY_ADD_WATCH       = 285 +	SYS_INOTIFY_RM_WATCH        = 286 +	SYS_MIGRATE_PAGES           = 287 +	SYS_OPENAT                  = 288 +	SYS_MKDIRAT                 = 289 +	SYS_MKNODAT                 = 290 +	SYS_FCHOWNAT                = 291 +	SYS_FUTIMESAT               = 292 +	SYS_NEWFSTATAT              = 293 +	SYS_UNLINKAT                = 294 +	SYS_RENAMEAT                = 295 +	SYS_LINKAT                  = 296 +	SYS_SYMLINKAT               = 297 +	SYS_READLINKAT              = 298 +	SYS_FCHMODAT                = 299 +	SYS_FACCESSAT               = 300 +	SYS_PSELECT6                = 301 +	SYS_PPOLL                   = 302 +	SYS_UNSHARE                 = 303 +	SYS_SET_ROBUST_LIST         = 304 +	SYS_GET_ROBUST_LIST         = 305 +	SYS_SPLICE                  = 306 +	SYS_SYNC_FILE_RANGE         = 307 +	SYS_TEE                     = 308 +	SYS_VMSPLICE                = 309 +	SYS_MOVE_PAGES              = 310 +	SYS_GETCPU                  = 311 +	SYS_EPOLL_PWAIT             = 312 +	SYS_UTIMES                  = 313 +	SYS_FALLOCATE               = 314 +	SYS_UTIMENSAT               = 315 +	SYS_SIGNALFD                = 316 +	SYS_TIMERFD                 = 317 +	SYS_EVENTFD                 = 318 +	SYS_TIMERFD_CREATE          = 319 +	SYS_TIMERFD_SETTIME         = 320 +	SYS_TIMERFD_GETTIME         = 321 +	SYS_SIGNALFD4               = 322 +	SYS_EVENTFD2                = 323 +	SYS_INOTIFY_INIT1           = 324 +	SYS_PIPE2                   = 325 +	SYS_DUP3                    = 326 +	SYS_EPOLL_CREATE1           = 327 +	SYS_PREADV                  = 328 +	SYS_PWRITEV                 = 329 +	SYS_RT_TGSIGQUEUEINFO       = 330 +	SYS_PERF_EVENT_OPEN         = 331 +	SYS_FANOTIFY_INIT           = 332 +	SYS_FANOTIFY_MARK           = 333 +	SYS_PRLIMIT64               = 334 +	SYS_NAME_TO_HANDLE_AT       = 335 +	SYS_OPEN_BY_HANDLE_AT       = 336 +	SYS_CLOCK_ADJTIME           = 337 +	SYS_SYNCFS                  = 338 +	SYS_SETNS                   = 339 +	SYS_PROCESS_VM_READV        = 340 +	SYS_PROCESS_VM_WRITEV       = 341 +	SYS_S390_RUNTIME_INSTR      = 342 +	SYS_KCMP                    = 343 +	SYS_FINIT_MODULE            = 344 +	SYS_SCHED_SETATTR           = 345 +	SYS_SCHED_GETATTR           = 346 +	SYS_RENAMEAT2               = 347 +	SYS_SECCOMP                 = 348 +	SYS_GETRANDOM               = 349 +	SYS_MEMFD_CREATE            = 350 +	SYS_BPF                     = 351 +	SYS_S390_PCI_MMIO_WRITE     = 352 +	SYS_S390_PCI_MMIO_READ      = 353 +	SYS_EXECVEAT                = 354 +	SYS_USERFAULTFD             = 355 +	SYS_MEMBARRIER              = 356 +	SYS_RECVMMSG                = 357 +	SYS_SENDMMSG                = 358 +	SYS_SOCKET                  = 359 +	SYS_SOCKETPAIR              = 360 +	SYS_BIND                    = 361 +	SYS_CONNECT                 = 362 +	SYS_LISTEN                  = 363 +	SYS_ACCEPT4                 = 364 +	SYS_GETSOCKOPT              = 365 +	SYS_SETSOCKOPT              = 366 +	SYS_GETSOCKNAME             = 367 +	SYS_GETPEERNAME             = 368 +	SYS_SENDTO                  = 369 +	SYS_SENDMSG                 = 370 +	SYS_RECVFROM                = 371 +	SYS_RECVMSG                 = 372 +	SYS_SHUTDOWN                = 373 +	SYS_MLOCK2                  = 374 +	SYS_COPY_FILE_RANGE         = 375 +	SYS_PREADV2                 = 376 +	SYS_PWRITEV2                = 377 +	SYS_S390_GUARDED_STORAGE    = 378 +	SYS_STATX                   = 379 +	SYS_S390_STHYI              = 380 +	SYS_KEXEC_FILE_LOAD         = 381 +	SYS_IO_PGETEVENTS           = 382 +	SYS_RSEQ                    = 383 +	SYS_PKEY_MPROTECT           = 384 +	SYS_PKEY_ALLOC              = 385 +	SYS_PKEY_FREE               = 386 +	SYS_SEMTIMEDOP              = 392 +	SYS_SEMGET                  = 393 +	SYS_SEMCTL                  = 394 +	SYS_SHMGET                  = 395 +	SYS_SHMCTL                  = 396 +	SYS_SHMAT                   = 397 +	SYS_SHMDT                   = 398 +	SYS_MSGGET                  = 399 +	SYS_MSGSND                  = 400 +	SYS_MSGRCV                  = 401 +	SYS_MSGCTL                  = 402 +	SYS_PIDFD_SEND_SIGNAL       = 424 +	SYS_IO_URING_SETUP          = 425 +	SYS_IO_URING_ENTER          = 426 +	SYS_IO_URING_REGISTER       = 427 +	SYS_OPEN_TREE               = 428 +	SYS_MOVE_MOUNT              = 429 +	SYS_FSOPEN                  = 430 +	SYS_FSCONFIG                = 431 +	SYS_FSMOUNT                 = 432 +	SYS_FSPICK                  = 433 +	SYS_PIDFD_OPEN              = 434 +	SYS_CLONE3                  = 435 +	SYS_CLOSE_RANGE             = 436 +	SYS_OPENAT2                 = 437 +	SYS_PIDFD_GETFD             = 438 +	SYS_FACCESSAT2              = 439 +	SYS_PROCESS_MADVISE         = 440 +	SYS_EPOLL_PWAIT2            = 441 +	SYS_MOUNT_SETATTR           = 442 +	SYS_LANDLOCK_CREATE_RULESET = 444 +	SYS_LANDLOCK_ADD_RULE       = 445 +	SYS_LANDLOCK_RESTRICT_SELF  = 446  ) diff --git a/vendor/golang.org/x/sys/unix/zsysnum_linux_sparc64.go b/vendor/golang.org/x/sys/unix/zsysnum_linux_sparc64.go index 488ca848d..58e72b0cb 100644 --- a/vendor/golang.org/x/sys/unix/zsysnum_linux_sparc64.go +++ b/vendor/golang.org/x/sys/unix/zsysnum_linux_sparc64.go @@ -7,379 +7,382 @@  package unix  const ( -	SYS_RESTART_SYSCALL        = 0 -	SYS_EXIT                   = 1 -	SYS_FORK                   = 2 -	SYS_READ                   = 3 -	SYS_WRITE                  = 4 -	SYS_OPEN                   = 5 -	SYS_CLOSE                  = 6 -	SYS_WAIT4                  = 7 -	SYS_CREAT                  = 8 -	SYS_LINK                   = 9 -	SYS_UNLINK                 = 10 -	SYS_EXECV                  = 11 -	SYS_CHDIR                  = 12 -	SYS_CHOWN                  = 13 -	SYS_MKNOD                  = 14 -	SYS_CHMOD                  = 15 -	SYS_LCHOWN                 = 16 -	SYS_BRK                    = 17 -	SYS_PERFCTR                = 18 -	SYS_LSEEK                  = 19 -	SYS_GETPID                 = 20 -	SYS_CAPGET                 = 21 -	SYS_CAPSET                 = 22 -	SYS_SETUID                 = 23 -	SYS_GETUID                 = 24 -	SYS_VMSPLICE               = 25 -	SYS_PTRACE                 = 26 -	SYS_ALARM                  = 27 -	SYS_SIGALTSTACK            = 28 -	SYS_PAUSE                  = 29 -	SYS_UTIME                  = 30 -	SYS_ACCESS                 = 33 -	SYS_NICE                   = 34 -	SYS_SYNC                   = 36 -	SYS_KILL                   = 37 -	SYS_STAT                   = 38 -	SYS_SENDFILE               = 39 -	SYS_LSTAT                  = 40 -	SYS_DUP                    = 41 -	SYS_PIPE                   = 42 -	SYS_TIMES                  = 43 -	SYS_UMOUNT2                = 45 -	SYS_SETGID                 = 46 -	SYS_GETGID                 = 47 -	SYS_SIGNAL                 = 48 -	SYS_GETEUID                = 49 -	SYS_GETEGID                = 50 -	SYS_ACCT                   = 51 -	SYS_MEMORY_ORDERING        = 52 -	SYS_IOCTL                  = 54 -	SYS_REBOOT                 = 55 -	SYS_SYMLINK                = 57 -	SYS_READLINK               = 58 -	SYS_EXECVE                 = 59 -	SYS_UMASK                  = 60 -	SYS_CHROOT                 = 61 -	SYS_FSTAT                  = 62 -	SYS_FSTAT64                = 63 -	SYS_GETPAGESIZE            = 64 -	SYS_MSYNC                  = 65 -	SYS_VFORK                  = 66 -	SYS_PREAD64                = 67 -	SYS_PWRITE64               = 68 -	SYS_MMAP                   = 71 -	SYS_MUNMAP                 = 73 -	SYS_MPROTECT               = 74 -	SYS_MADVISE                = 75 -	SYS_VHANGUP                = 76 -	SYS_MINCORE                = 78 -	SYS_GETGROUPS              = 79 -	SYS_SETGROUPS              = 80 -	SYS_GETPGRP                = 81 -	SYS_SETITIMER              = 83 -	SYS_SWAPON                 = 85 -	SYS_GETITIMER              = 86 -	SYS_SETHOSTNAME            = 88 -	SYS_DUP2                   = 90 -	SYS_FCNTL                  = 92 -	SYS_SELECT                 = 93 -	SYS_FSYNC                  = 95 -	SYS_SETPRIORITY            = 96 -	SYS_SOCKET                 = 97 -	SYS_CONNECT                = 98 -	SYS_ACCEPT                 = 99 -	SYS_GETPRIORITY            = 100 -	SYS_RT_SIGRETURN           = 101 -	SYS_RT_SIGACTION           = 102 -	SYS_RT_SIGPROCMASK         = 103 -	SYS_RT_SIGPENDING          = 104 -	SYS_RT_SIGTIMEDWAIT        = 105 -	SYS_RT_SIGQUEUEINFO        = 106 -	SYS_RT_SIGSUSPEND          = 107 -	SYS_SETRESUID              = 108 -	SYS_GETRESUID              = 109 -	SYS_SETRESGID              = 110 -	SYS_GETRESGID              = 111 -	SYS_RECVMSG                = 113 -	SYS_SENDMSG                = 114 -	SYS_GETTIMEOFDAY           = 116 -	SYS_GETRUSAGE              = 117 -	SYS_GETSOCKOPT             = 118 -	SYS_GETCWD                 = 119 -	SYS_READV                  = 120 -	SYS_WRITEV                 = 121 -	SYS_SETTIMEOFDAY           = 122 -	SYS_FCHOWN                 = 123 -	SYS_FCHMOD                 = 124 -	SYS_RECVFROM               = 125 -	SYS_SETREUID               = 126 -	SYS_SETREGID               = 127 -	SYS_RENAME                 = 128 -	SYS_TRUNCATE               = 129 -	SYS_FTRUNCATE              = 130 -	SYS_FLOCK                  = 131 -	SYS_LSTAT64                = 132 -	SYS_SENDTO                 = 133 -	SYS_SHUTDOWN               = 134 -	SYS_SOCKETPAIR             = 135 -	SYS_MKDIR                  = 136 -	SYS_RMDIR                  = 137 -	SYS_UTIMES                 = 138 -	SYS_STAT64                 = 139 -	SYS_SENDFILE64             = 140 -	SYS_GETPEERNAME            = 141 -	SYS_FUTEX                  = 142 -	SYS_GETTID                 = 143 -	SYS_GETRLIMIT              = 144 -	SYS_SETRLIMIT              = 145 -	SYS_PIVOT_ROOT             = 146 -	SYS_PRCTL                  = 147 -	SYS_PCICONFIG_READ         = 148 -	SYS_PCICONFIG_WRITE        = 149 -	SYS_GETSOCKNAME            = 150 -	SYS_INOTIFY_INIT           = 151 -	SYS_INOTIFY_ADD_WATCH      = 152 -	SYS_POLL                   = 153 -	SYS_GETDENTS64             = 154 -	SYS_INOTIFY_RM_WATCH       = 156 -	SYS_STATFS                 = 157 -	SYS_FSTATFS                = 158 -	SYS_UMOUNT                 = 159 -	SYS_SCHED_SET_AFFINITY     = 160 -	SYS_SCHED_GET_AFFINITY     = 161 -	SYS_GETDOMAINNAME          = 162 -	SYS_SETDOMAINNAME          = 163 -	SYS_UTRAP_INSTALL          = 164 -	SYS_QUOTACTL               = 165 -	SYS_SET_TID_ADDRESS        = 166 -	SYS_MOUNT                  = 167 -	SYS_USTAT                  = 168 -	SYS_SETXATTR               = 169 -	SYS_LSETXATTR              = 170 -	SYS_FSETXATTR              = 171 -	SYS_GETXATTR               = 172 -	SYS_LGETXATTR              = 173 -	SYS_GETDENTS               = 174 -	SYS_SETSID                 = 175 -	SYS_FCHDIR                 = 176 -	SYS_FGETXATTR              = 177 -	SYS_LISTXATTR              = 178 -	SYS_LLISTXATTR             = 179 -	SYS_FLISTXATTR             = 180 -	SYS_REMOVEXATTR            = 181 -	SYS_LREMOVEXATTR           = 182 -	SYS_SIGPENDING             = 183 -	SYS_QUERY_MODULE           = 184 -	SYS_SETPGID                = 185 -	SYS_FREMOVEXATTR           = 186 -	SYS_TKILL                  = 187 -	SYS_EXIT_GROUP             = 188 -	SYS_UNAME                  = 189 -	SYS_INIT_MODULE            = 190 -	SYS_PERSONALITY            = 191 -	SYS_REMAP_FILE_PAGES       = 192 -	SYS_EPOLL_CREATE           = 193 -	SYS_EPOLL_CTL              = 194 -	SYS_EPOLL_WAIT             = 195 -	SYS_IOPRIO_SET             = 196 -	SYS_GETPPID                = 197 -	SYS_SIGACTION              = 198 -	SYS_SGETMASK               = 199 -	SYS_SSETMASK               = 200 -	SYS_SIGSUSPEND             = 201 -	SYS_OLDLSTAT               = 202 -	SYS_USELIB                 = 203 -	SYS_READDIR                = 204 -	SYS_READAHEAD              = 205 -	SYS_SOCKETCALL             = 206 -	SYS_SYSLOG                 = 207 -	SYS_LOOKUP_DCOOKIE         = 208 -	SYS_FADVISE64              = 209 -	SYS_FADVISE64_64           = 210 -	SYS_TGKILL                 = 211 -	SYS_WAITPID                = 212 -	SYS_SWAPOFF                = 213 -	SYS_SYSINFO                = 214 -	SYS_IPC                    = 215 -	SYS_SIGRETURN              = 216 -	SYS_CLONE                  = 217 -	SYS_IOPRIO_GET             = 218 -	SYS_ADJTIMEX               = 219 -	SYS_SIGPROCMASK            = 220 -	SYS_CREATE_MODULE          = 221 -	SYS_DELETE_MODULE          = 222 -	SYS_GET_KERNEL_SYMS        = 223 -	SYS_GETPGID                = 224 -	SYS_BDFLUSH                = 225 -	SYS_SYSFS                  = 226 -	SYS_AFS_SYSCALL            = 227 -	SYS_SETFSUID               = 228 -	SYS_SETFSGID               = 229 -	SYS__NEWSELECT             = 230 -	SYS_SPLICE                 = 232 -	SYS_STIME                  = 233 -	SYS_STATFS64               = 234 -	SYS_FSTATFS64              = 235 -	SYS__LLSEEK                = 236 -	SYS_MLOCK                  = 237 -	SYS_MUNLOCK                = 238 -	SYS_MLOCKALL               = 239 -	SYS_MUNLOCKALL             = 240 -	SYS_SCHED_SETPARAM         = 241 -	SYS_SCHED_GETPARAM         = 242 -	SYS_SCHED_SETSCHEDULER     = 243 -	SYS_SCHED_GETSCHEDULER     = 244 -	SYS_SCHED_YIELD            = 245 -	SYS_SCHED_GET_PRIORITY_MAX = 246 -	SYS_SCHED_GET_PRIORITY_MIN = 247 -	SYS_SCHED_RR_GET_INTERVAL  = 248 -	SYS_NANOSLEEP              = 249 -	SYS_MREMAP                 = 250 -	SYS__SYSCTL                = 251 -	SYS_GETSID                 = 252 -	SYS_FDATASYNC              = 253 -	SYS_NFSSERVCTL             = 254 -	SYS_SYNC_FILE_RANGE        = 255 -	SYS_CLOCK_SETTIME          = 256 -	SYS_CLOCK_GETTIME          = 257 -	SYS_CLOCK_GETRES           = 258 -	SYS_CLOCK_NANOSLEEP        = 259 -	SYS_SCHED_GETAFFINITY      = 260 -	SYS_SCHED_SETAFFINITY      = 261 -	SYS_TIMER_SETTIME          = 262 -	SYS_TIMER_GETTIME          = 263 -	SYS_TIMER_GETOVERRUN       = 264 -	SYS_TIMER_DELETE           = 265 -	SYS_TIMER_CREATE           = 266 -	SYS_VSERVER                = 267 -	SYS_IO_SETUP               = 268 -	SYS_IO_DESTROY             = 269 -	SYS_IO_SUBMIT              = 270 -	SYS_IO_CANCEL              = 271 -	SYS_IO_GETEVENTS           = 272 -	SYS_MQ_OPEN                = 273 -	SYS_MQ_UNLINK              = 274 -	SYS_MQ_TIMEDSEND           = 275 -	SYS_MQ_TIMEDRECEIVE        = 276 -	SYS_MQ_NOTIFY              = 277 -	SYS_MQ_GETSETATTR          = 278 -	SYS_WAITID                 = 279 -	SYS_TEE                    = 280 -	SYS_ADD_KEY                = 281 -	SYS_REQUEST_KEY            = 282 -	SYS_KEYCTL                 = 283 -	SYS_OPENAT                 = 284 -	SYS_MKDIRAT                = 285 -	SYS_MKNODAT                = 286 -	SYS_FCHOWNAT               = 287 -	SYS_FUTIMESAT              = 288 -	SYS_FSTATAT64              = 289 -	SYS_UNLINKAT               = 290 -	SYS_RENAMEAT               = 291 -	SYS_LINKAT                 = 292 -	SYS_SYMLINKAT              = 293 -	SYS_READLINKAT             = 294 -	SYS_FCHMODAT               = 295 -	SYS_FACCESSAT              = 296 -	SYS_PSELECT6               = 297 -	SYS_PPOLL                  = 298 -	SYS_UNSHARE                = 299 -	SYS_SET_ROBUST_LIST        = 300 -	SYS_GET_ROBUST_LIST        = 301 -	SYS_MIGRATE_PAGES          = 302 -	SYS_MBIND                  = 303 -	SYS_GET_MEMPOLICY          = 304 -	SYS_SET_MEMPOLICY          = 305 -	SYS_KEXEC_LOAD             = 306 -	SYS_MOVE_PAGES             = 307 -	SYS_GETCPU                 = 308 -	SYS_EPOLL_PWAIT            = 309 -	SYS_UTIMENSAT              = 310 -	SYS_SIGNALFD               = 311 -	SYS_TIMERFD_CREATE         = 312 -	SYS_EVENTFD                = 313 -	SYS_FALLOCATE              = 314 -	SYS_TIMERFD_SETTIME        = 315 -	SYS_TIMERFD_GETTIME        = 316 -	SYS_SIGNALFD4              = 317 -	SYS_EVENTFD2               = 318 -	SYS_EPOLL_CREATE1          = 319 -	SYS_DUP3                   = 320 -	SYS_PIPE2                  = 321 -	SYS_INOTIFY_INIT1          = 322 -	SYS_ACCEPT4                = 323 -	SYS_PREADV                 = 324 -	SYS_PWRITEV                = 325 -	SYS_RT_TGSIGQUEUEINFO      = 326 -	SYS_PERF_EVENT_OPEN        = 327 -	SYS_RECVMMSG               = 328 -	SYS_FANOTIFY_INIT          = 329 -	SYS_FANOTIFY_MARK          = 330 -	SYS_PRLIMIT64              = 331 -	SYS_NAME_TO_HANDLE_AT      = 332 -	SYS_OPEN_BY_HANDLE_AT      = 333 -	SYS_CLOCK_ADJTIME          = 334 -	SYS_SYNCFS                 = 335 -	SYS_SENDMMSG               = 336 -	SYS_SETNS                  = 337 -	SYS_PROCESS_VM_READV       = 338 -	SYS_PROCESS_VM_WRITEV      = 339 -	SYS_KERN_FEATURES          = 340 -	SYS_KCMP                   = 341 -	SYS_FINIT_MODULE           = 342 -	SYS_SCHED_SETATTR          = 343 -	SYS_SCHED_GETATTR          = 344 -	SYS_RENAMEAT2              = 345 -	SYS_SECCOMP                = 346 -	SYS_GETRANDOM              = 347 -	SYS_MEMFD_CREATE           = 348 -	SYS_BPF                    = 349 -	SYS_EXECVEAT               = 350 -	SYS_MEMBARRIER             = 351 -	SYS_USERFAULTFD            = 352 -	SYS_BIND                   = 353 -	SYS_LISTEN                 = 354 -	SYS_SETSOCKOPT             = 355 -	SYS_MLOCK2                 = 356 -	SYS_COPY_FILE_RANGE        = 357 -	SYS_PREADV2                = 358 -	SYS_PWRITEV2               = 359 -	SYS_STATX                  = 360 -	SYS_IO_PGETEVENTS          = 361 -	SYS_PKEY_MPROTECT          = 362 -	SYS_PKEY_ALLOC             = 363 -	SYS_PKEY_FREE              = 364 -	SYS_RSEQ                   = 365 -	SYS_SEMTIMEDOP             = 392 -	SYS_SEMGET                 = 393 -	SYS_SEMCTL                 = 394 -	SYS_SHMGET                 = 395 -	SYS_SHMCTL                 = 396 -	SYS_SHMAT                  = 397 -	SYS_SHMDT                  = 398 -	SYS_MSGGET                 = 399 -	SYS_MSGSND                 = 400 -	SYS_MSGRCV                 = 401 -	SYS_MSGCTL                 = 402 -	SYS_PIDFD_SEND_SIGNAL      = 424 -	SYS_IO_URING_SETUP         = 425 -	SYS_IO_URING_ENTER         = 426 -	SYS_IO_URING_REGISTER      = 427 -	SYS_OPEN_TREE              = 428 -	SYS_MOVE_MOUNT             = 429 -	SYS_FSOPEN                 = 430 -	SYS_FSCONFIG               = 431 -	SYS_FSMOUNT                = 432 -	SYS_FSPICK                 = 433 -	SYS_PIDFD_OPEN             = 434 -	SYS_CLOSE_RANGE            = 436 -	SYS_OPENAT2                = 437 -	SYS_PIDFD_GETFD            = 438 -	SYS_FACCESSAT2             = 439 -	SYS_PROCESS_MADVISE        = 440 -	SYS_EPOLL_PWAIT2           = 441 -	SYS_MOUNT_SETATTR          = 442 +	SYS_RESTART_SYSCALL         = 0 +	SYS_EXIT                    = 1 +	SYS_FORK                    = 2 +	SYS_READ                    = 3 +	SYS_WRITE                   = 4 +	SYS_OPEN                    = 5 +	SYS_CLOSE                   = 6 +	SYS_WAIT4                   = 7 +	SYS_CREAT                   = 8 +	SYS_LINK                    = 9 +	SYS_UNLINK                  = 10 +	SYS_EXECV                   = 11 +	SYS_CHDIR                   = 12 +	SYS_CHOWN                   = 13 +	SYS_MKNOD                   = 14 +	SYS_CHMOD                   = 15 +	SYS_LCHOWN                  = 16 +	SYS_BRK                     = 17 +	SYS_PERFCTR                 = 18 +	SYS_LSEEK                   = 19 +	SYS_GETPID                  = 20 +	SYS_CAPGET                  = 21 +	SYS_CAPSET                  = 22 +	SYS_SETUID                  = 23 +	SYS_GETUID                  = 24 +	SYS_VMSPLICE                = 25 +	SYS_PTRACE                  = 26 +	SYS_ALARM                   = 27 +	SYS_SIGALTSTACK             = 28 +	SYS_PAUSE                   = 29 +	SYS_UTIME                   = 30 +	SYS_ACCESS                  = 33 +	SYS_NICE                    = 34 +	SYS_SYNC                    = 36 +	SYS_KILL                    = 37 +	SYS_STAT                    = 38 +	SYS_SENDFILE                = 39 +	SYS_LSTAT                   = 40 +	SYS_DUP                     = 41 +	SYS_PIPE                    = 42 +	SYS_TIMES                   = 43 +	SYS_UMOUNT2                 = 45 +	SYS_SETGID                  = 46 +	SYS_GETGID                  = 47 +	SYS_SIGNAL                  = 48 +	SYS_GETEUID                 = 49 +	SYS_GETEGID                 = 50 +	SYS_ACCT                    = 51 +	SYS_MEMORY_ORDERING         = 52 +	SYS_IOCTL                   = 54 +	SYS_REBOOT                  = 55 +	SYS_SYMLINK                 = 57 +	SYS_READLINK                = 58 +	SYS_EXECVE                  = 59 +	SYS_UMASK                   = 60 +	SYS_CHROOT                  = 61 +	SYS_FSTAT                   = 62 +	SYS_FSTAT64                 = 63 +	SYS_GETPAGESIZE             = 64 +	SYS_MSYNC                   = 65 +	SYS_VFORK                   = 66 +	SYS_PREAD64                 = 67 +	SYS_PWRITE64                = 68 +	SYS_MMAP                    = 71 +	SYS_MUNMAP                  = 73 +	SYS_MPROTECT                = 74 +	SYS_MADVISE                 = 75 +	SYS_VHANGUP                 = 76 +	SYS_MINCORE                 = 78 +	SYS_GETGROUPS               = 79 +	SYS_SETGROUPS               = 80 +	SYS_GETPGRP                 = 81 +	SYS_SETITIMER               = 83 +	SYS_SWAPON                  = 85 +	SYS_GETITIMER               = 86 +	SYS_SETHOSTNAME             = 88 +	SYS_DUP2                    = 90 +	SYS_FCNTL                   = 92 +	SYS_SELECT                  = 93 +	SYS_FSYNC                   = 95 +	SYS_SETPRIORITY             = 96 +	SYS_SOCKET                  = 97 +	SYS_CONNECT                 = 98 +	SYS_ACCEPT                  = 99 +	SYS_GETPRIORITY             = 100 +	SYS_RT_SIGRETURN            = 101 +	SYS_RT_SIGACTION            = 102 +	SYS_RT_SIGPROCMASK          = 103 +	SYS_RT_SIGPENDING           = 104 +	SYS_RT_SIGTIMEDWAIT         = 105 +	SYS_RT_SIGQUEUEINFO         = 106 +	SYS_RT_SIGSUSPEND           = 107 +	SYS_SETRESUID               = 108 +	SYS_GETRESUID               = 109 +	SYS_SETRESGID               = 110 +	SYS_GETRESGID               = 111 +	SYS_RECVMSG                 = 113 +	SYS_SENDMSG                 = 114 +	SYS_GETTIMEOFDAY            = 116 +	SYS_GETRUSAGE               = 117 +	SYS_GETSOCKOPT              = 118 +	SYS_GETCWD                  = 119 +	SYS_READV                   = 120 +	SYS_WRITEV                  = 121 +	SYS_SETTIMEOFDAY            = 122 +	SYS_FCHOWN                  = 123 +	SYS_FCHMOD                  = 124 +	SYS_RECVFROM                = 125 +	SYS_SETREUID                = 126 +	SYS_SETREGID                = 127 +	SYS_RENAME                  = 128 +	SYS_TRUNCATE                = 129 +	SYS_FTRUNCATE               = 130 +	SYS_FLOCK                   = 131 +	SYS_LSTAT64                 = 132 +	SYS_SENDTO                  = 133 +	SYS_SHUTDOWN                = 134 +	SYS_SOCKETPAIR              = 135 +	SYS_MKDIR                   = 136 +	SYS_RMDIR                   = 137 +	SYS_UTIMES                  = 138 +	SYS_STAT64                  = 139 +	SYS_SENDFILE64              = 140 +	SYS_GETPEERNAME             = 141 +	SYS_FUTEX                   = 142 +	SYS_GETTID                  = 143 +	SYS_GETRLIMIT               = 144 +	SYS_SETRLIMIT               = 145 +	SYS_PIVOT_ROOT              = 146 +	SYS_PRCTL                   = 147 +	SYS_PCICONFIG_READ          = 148 +	SYS_PCICONFIG_WRITE         = 149 +	SYS_GETSOCKNAME             = 150 +	SYS_INOTIFY_INIT            = 151 +	SYS_INOTIFY_ADD_WATCH       = 152 +	SYS_POLL                    = 153 +	SYS_GETDENTS64              = 154 +	SYS_INOTIFY_RM_WATCH        = 156 +	SYS_STATFS                  = 157 +	SYS_FSTATFS                 = 158 +	SYS_UMOUNT                  = 159 +	SYS_SCHED_SET_AFFINITY      = 160 +	SYS_SCHED_GET_AFFINITY      = 161 +	SYS_GETDOMAINNAME           = 162 +	SYS_SETDOMAINNAME           = 163 +	SYS_UTRAP_INSTALL           = 164 +	SYS_QUOTACTL                = 165 +	SYS_SET_TID_ADDRESS         = 166 +	SYS_MOUNT                   = 167 +	SYS_USTAT                   = 168 +	SYS_SETXATTR                = 169 +	SYS_LSETXATTR               = 170 +	SYS_FSETXATTR               = 171 +	SYS_GETXATTR                = 172 +	SYS_LGETXATTR               = 173 +	SYS_GETDENTS                = 174 +	SYS_SETSID                  = 175 +	SYS_FCHDIR                  = 176 +	SYS_FGETXATTR               = 177 +	SYS_LISTXATTR               = 178 +	SYS_LLISTXATTR              = 179 +	SYS_FLISTXATTR              = 180 +	SYS_REMOVEXATTR             = 181 +	SYS_LREMOVEXATTR            = 182 +	SYS_SIGPENDING              = 183 +	SYS_QUERY_MODULE            = 184 +	SYS_SETPGID                 = 185 +	SYS_FREMOVEXATTR            = 186 +	SYS_TKILL                   = 187 +	SYS_EXIT_GROUP              = 188 +	SYS_UNAME                   = 189 +	SYS_INIT_MODULE             = 190 +	SYS_PERSONALITY             = 191 +	SYS_REMAP_FILE_PAGES        = 192 +	SYS_EPOLL_CREATE            = 193 +	SYS_EPOLL_CTL               = 194 +	SYS_EPOLL_WAIT              = 195 +	SYS_IOPRIO_SET              = 196 +	SYS_GETPPID                 = 197 +	SYS_SIGACTION               = 198 +	SYS_SGETMASK                = 199 +	SYS_SSETMASK                = 200 +	SYS_SIGSUSPEND              = 201 +	SYS_OLDLSTAT                = 202 +	SYS_USELIB                  = 203 +	SYS_READDIR                 = 204 +	SYS_READAHEAD               = 205 +	SYS_SOCKETCALL              = 206 +	SYS_SYSLOG                  = 207 +	SYS_LOOKUP_DCOOKIE          = 208 +	SYS_FADVISE64               = 209 +	SYS_FADVISE64_64            = 210 +	SYS_TGKILL                  = 211 +	SYS_WAITPID                 = 212 +	SYS_SWAPOFF                 = 213 +	SYS_SYSINFO                 = 214 +	SYS_IPC                     = 215 +	SYS_SIGRETURN               = 216 +	SYS_CLONE                   = 217 +	SYS_IOPRIO_GET              = 218 +	SYS_ADJTIMEX                = 219 +	SYS_SIGPROCMASK             = 220 +	SYS_CREATE_MODULE           = 221 +	SYS_DELETE_MODULE           = 222 +	SYS_GET_KERNEL_SYMS         = 223 +	SYS_GETPGID                 = 224 +	SYS_BDFLUSH                 = 225 +	SYS_SYSFS                   = 226 +	SYS_AFS_SYSCALL             = 227 +	SYS_SETFSUID                = 228 +	SYS_SETFSGID                = 229 +	SYS__NEWSELECT              = 230 +	SYS_SPLICE                  = 232 +	SYS_STIME                   = 233 +	SYS_STATFS64                = 234 +	SYS_FSTATFS64               = 235 +	SYS__LLSEEK                 = 236 +	SYS_MLOCK                   = 237 +	SYS_MUNLOCK                 = 238 +	SYS_MLOCKALL                = 239 +	SYS_MUNLOCKALL              = 240 +	SYS_SCHED_SETPARAM          = 241 +	SYS_SCHED_GETPARAM          = 242 +	SYS_SCHED_SETSCHEDULER      = 243 +	SYS_SCHED_GETSCHEDULER      = 244 +	SYS_SCHED_YIELD             = 245 +	SYS_SCHED_GET_PRIORITY_MAX  = 246 +	SYS_SCHED_GET_PRIORITY_MIN  = 247 +	SYS_SCHED_RR_GET_INTERVAL   = 248 +	SYS_NANOSLEEP               = 249 +	SYS_MREMAP                  = 250 +	SYS__SYSCTL                 = 251 +	SYS_GETSID                  = 252 +	SYS_FDATASYNC               = 253 +	SYS_NFSSERVCTL              = 254 +	SYS_SYNC_FILE_RANGE         = 255 +	SYS_CLOCK_SETTIME           = 256 +	SYS_CLOCK_GETTIME           = 257 +	SYS_CLOCK_GETRES            = 258 +	SYS_CLOCK_NANOSLEEP         = 259 +	SYS_SCHED_GETAFFINITY       = 260 +	SYS_SCHED_SETAFFINITY       = 261 +	SYS_TIMER_SETTIME           = 262 +	SYS_TIMER_GETTIME           = 263 +	SYS_TIMER_GETOVERRUN        = 264 +	SYS_TIMER_DELETE            = 265 +	SYS_TIMER_CREATE            = 266 +	SYS_VSERVER                 = 267 +	SYS_IO_SETUP                = 268 +	SYS_IO_DESTROY              = 269 +	SYS_IO_SUBMIT               = 270 +	SYS_IO_CANCEL               = 271 +	SYS_IO_GETEVENTS            = 272 +	SYS_MQ_OPEN                 = 273 +	SYS_MQ_UNLINK               = 274 +	SYS_MQ_TIMEDSEND            = 275 +	SYS_MQ_TIMEDRECEIVE         = 276 +	SYS_MQ_NOTIFY               = 277 +	SYS_MQ_GETSETATTR           = 278 +	SYS_WAITID                  = 279 +	SYS_TEE                     = 280 +	SYS_ADD_KEY                 = 281 +	SYS_REQUEST_KEY             = 282 +	SYS_KEYCTL                  = 283 +	SYS_OPENAT                  = 284 +	SYS_MKDIRAT                 = 285 +	SYS_MKNODAT                 = 286 +	SYS_FCHOWNAT                = 287 +	SYS_FUTIMESAT               = 288 +	SYS_FSTATAT64               = 289 +	SYS_UNLINKAT                = 290 +	SYS_RENAMEAT                = 291 +	SYS_LINKAT                  = 292 +	SYS_SYMLINKAT               = 293 +	SYS_READLINKAT              = 294 +	SYS_FCHMODAT                = 295 +	SYS_FACCESSAT               = 296 +	SYS_PSELECT6                = 297 +	SYS_PPOLL                   = 298 +	SYS_UNSHARE                 = 299 +	SYS_SET_ROBUST_LIST         = 300 +	SYS_GET_ROBUST_LIST         = 301 +	SYS_MIGRATE_PAGES           = 302 +	SYS_MBIND                   = 303 +	SYS_GET_MEMPOLICY           = 304 +	SYS_SET_MEMPOLICY           = 305 +	SYS_KEXEC_LOAD              = 306 +	SYS_MOVE_PAGES              = 307 +	SYS_GETCPU                  = 308 +	SYS_EPOLL_PWAIT             = 309 +	SYS_UTIMENSAT               = 310 +	SYS_SIGNALFD                = 311 +	SYS_TIMERFD_CREATE          = 312 +	SYS_EVENTFD                 = 313 +	SYS_FALLOCATE               = 314 +	SYS_TIMERFD_SETTIME         = 315 +	SYS_TIMERFD_GETTIME         = 316 +	SYS_SIGNALFD4               = 317 +	SYS_EVENTFD2                = 318 +	SYS_EPOLL_CREATE1           = 319 +	SYS_DUP3                    = 320 +	SYS_PIPE2                   = 321 +	SYS_INOTIFY_INIT1           = 322 +	SYS_ACCEPT4                 = 323 +	SYS_PREADV                  = 324 +	SYS_PWRITEV                 = 325 +	SYS_RT_TGSIGQUEUEINFO       = 326 +	SYS_PERF_EVENT_OPEN         = 327 +	SYS_RECVMMSG                = 328 +	SYS_FANOTIFY_INIT           = 329 +	SYS_FANOTIFY_MARK           = 330 +	SYS_PRLIMIT64               = 331 +	SYS_NAME_TO_HANDLE_AT       = 332 +	SYS_OPEN_BY_HANDLE_AT       = 333 +	SYS_CLOCK_ADJTIME           = 334 +	SYS_SYNCFS                  = 335 +	SYS_SENDMMSG                = 336 +	SYS_SETNS                   = 337 +	SYS_PROCESS_VM_READV        = 338 +	SYS_PROCESS_VM_WRITEV       = 339 +	SYS_KERN_FEATURES           = 340 +	SYS_KCMP                    = 341 +	SYS_FINIT_MODULE            = 342 +	SYS_SCHED_SETATTR           = 343 +	SYS_SCHED_GETATTR           = 344 +	SYS_RENAMEAT2               = 345 +	SYS_SECCOMP                 = 346 +	SYS_GETRANDOM               = 347 +	SYS_MEMFD_CREATE            = 348 +	SYS_BPF                     = 349 +	SYS_EXECVEAT                = 350 +	SYS_MEMBARRIER              = 351 +	SYS_USERFAULTFD             = 352 +	SYS_BIND                    = 353 +	SYS_LISTEN                  = 354 +	SYS_SETSOCKOPT              = 355 +	SYS_MLOCK2                  = 356 +	SYS_COPY_FILE_RANGE         = 357 +	SYS_PREADV2                 = 358 +	SYS_PWRITEV2                = 359 +	SYS_STATX                   = 360 +	SYS_IO_PGETEVENTS           = 361 +	SYS_PKEY_MPROTECT           = 362 +	SYS_PKEY_ALLOC              = 363 +	SYS_PKEY_FREE               = 364 +	SYS_RSEQ                    = 365 +	SYS_SEMTIMEDOP              = 392 +	SYS_SEMGET                  = 393 +	SYS_SEMCTL                  = 394 +	SYS_SHMGET                  = 395 +	SYS_SHMCTL                  = 396 +	SYS_SHMAT                   = 397 +	SYS_SHMDT                   = 398 +	SYS_MSGGET                  = 399 +	SYS_MSGSND                  = 400 +	SYS_MSGRCV                  = 401 +	SYS_MSGCTL                  = 402 +	SYS_PIDFD_SEND_SIGNAL       = 424 +	SYS_IO_URING_SETUP          = 425 +	SYS_IO_URING_ENTER          = 426 +	SYS_IO_URING_REGISTER       = 427 +	SYS_OPEN_TREE               = 428 +	SYS_MOVE_MOUNT              = 429 +	SYS_FSOPEN                  = 430 +	SYS_FSCONFIG                = 431 +	SYS_FSMOUNT                 = 432 +	SYS_FSPICK                  = 433 +	SYS_PIDFD_OPEN              = 434 +	SYS_CLOSE_RANGE             = 436 +	SYS_OPENAT2                 = 437 +	SYS_PIDFD_GETFD             = 438 +	SYS_FACCESSAT2              = 439 +	SYS_PROCESS_MADVISE         = 440 +	SYS_EPOLL_PWAIT2            = 441 +	SYS_MOUNT_SETATTR           = 442 +	SYS_LANDLOCK_CREATE_RULESET = 444 +	SYS_LANDLOCK_ADD_RULE       = 445 +	SYS_LANDLOCK_RESTRICT_SELF  = 446  ) diff --git a/vendor/golang.org/x/sys/unix/ztypes_linux.go b/vendor/golang.org/x/sys/unix/ztypes_linux.go index c9d7eb41e..878141d6d 100644 --- a/vendor/golang.org/x/sys/unix/ztypes_linux.go +++ b/vendor/golang.org/x/sys/unix/ztypes_linux.go @@ -452,6 +452,11 @@ type CanFilter struct {  	Mask uint32  } +type TCPRepairOpt struct { +	Code uint32 +	Val  uint32 +} +  const (  	SizeofSockaddrInet4     = 0x10  	SizeofSockaddrInet6     = 0x1c @@ -484,6 +489,7 @@ const (  	SizeofUcred             = 0xc  	SizeofTCPInfo           = 0x68  	SizeofCanFilter         = 0x8 +	SizeofTCPRepairOpt      = 0x8  )  const ( @@ -682,6 +688,16 @@ type NdMsg struct {  }  const ( +	ICMP_FILTER = 0x1 + +	ICMPV6_FILTER             = 0x1 +	ICMPV6_FILTER_BLOCK       = 0x1 +	ICMPV6_FILTER_BLOCKOTHERS = 0x3 +	ICMPV6_FILTER_PASS        = 0x2 +	ICMPV6_FILTER_PASSONLY    = 0x4 +) + +const (  	SizeofSockFilter = 0x8  ) @@ -1001,7 +1017,7 @@ const (  	PERF_COUNT_SW_EMULATION_FAULTS        = 0x8  	PERF_COUNT_SW_DUMMY                   = 0x9  	PERF_COUNT_SW_BPF_OUTPUT              = 0xa -	PERF_COUNT_SW_MAX                     = 0xb +	PERF_COUNT_SW_MAX                     = 0xc  	PERF_SAMPLE_IP                        = 0x1  	PERF_SAMPLE_TID                       = 0x2  	PERF_SAMPLE_TIME                      = 0x4 @@ -3436,7 +3452,7 @@ const (  	ETHTOOL_MSG_CABLE_TEST_ACT                = 0x1a  	ETHTOOL_MSG_CABLE_TEST_TDR_ACT            = 0x1b  	ETHTOOL_MSG_TUNNEL_INFO_GET               = 0x1c -	ETHTOOL_MSG_USER_MAX                      = 0x1c +	ETHTOOL_MSG_USER_MAX                      = 0x20  	ETHTOOL_MSG_KERNEL_NONE                   = 0x0  	ETHTOOL_MSG_STRSET_GET_REPLY              = 0x1  	ETHTOOL_MSG_LINKINFO_GET_REPLY            = 0x2 @@ -3467,7 +3483,7 @@ const (  	ETHTOOL_MSG_CABLE_TEST_NTF                = 0x1b  	ETHTOOL_MSG_CABLE_TEST_TDR_NTF            = 0x1c  	ETHTOOL_MSG_TUNNEL_INFO_GET_REPLY         = 0x1d -	ETHTOOL_MSG_KERNEL_MAX                    = 0x1d +	ETHTOOL_MSG_KERNEL_MAX                    = 0x21  	ETHTOOL_A_HEADER_UNSPEC                   = 0x0  	ETHTOOL_A_HEADER_DEV_INDEX                = 0x1  	ETHTOOL_A_HEADER_DEV_NAME                 = 0x2 diff --git a/vendor/golang.org/x/sys/unix/ztypes_linux_386.go b/vendor/golang.org/x/sys/unix/ztypes_linux_386.go index 235c62e46..72f2e96f3 100644 --- a/vendor/golang.org/x/sys/unix/ztypes_linux_386.go +++ b/vendor/golang.org/x/sys/unix/ztypes_linux_386.go @@ -170,6 +170,11 @@ type Cmsghdr struct {  	Type  int32  } +type ifreq struct { +	Ifrn [16]byte +	Ifru [16]byte +} +  const (  	SizeofSockaddrNFCLLCP = 0x58  	SizeofIovec           = 0x8 diff --git a/vendor/golang.org/x/sys/unix/ztypes_linux_amd64.go b/vendor/golang.org/x/sys/unix/ztypes_linux_amd64.go index 99b1e5b6a..d5f018d13 100644 --- a/vendor/golang.org/x/sys/unix/ztypes_linux_amd64.go +++ b/vendor/golang.org/x/sys/unix/ztypes_linux_amd64.go @@ -173,6 +173,11 @@ type Cmsghdr struct {  	Type  int32  } +type ifreq struct { +	Ifrn [16]byte +	Ifru [24]byte +} +  const (  	SizeofSockaddrNFCLLCP = 0x60  	SizeofIovec           = 0x10 diff --git a/vendor/golang.org/x/sys/unix/ztypes_linux_arm.go b/vendor/golang.org/x/sys/unix/ztypes_linux_arm.go index cc8bba791..675446d93 100644 --- a/vendor/golang.org/x/sys/unix/ztypes_linux_arm.go +++ b/vendor/golang.org/x/sys/unix/ztypes_linux_arm.go @@ -176,6 +176,11 @@ type Cmsghdr struct {  	Type  int32  } +type ifreq struct { +	Ifrn [16]byte +	Ifru [16]byte +} +  const (  	SizeofSockaddrNFCLLCP = 0x58  	SizeofIovec           = 0x8 diff --git a/vendor/golang.org/x/sys/unix/ztypes_linux_arm64.go b/vendor/golang.org/x/sys/unix/ztypes_linux_arm64.go index fa8fe3a75..711d0711c 100644 --- a/vendor/golang.org/x/sys/unix/ztypes_linux_arm64.go +++ b/vendor/golang.org/x/sys/unix/ztypes_linux_arm64.go @@ -174,6 +174,11 @@ type Cmsghdr struct {  	Type  int32  } +type ifreq struct { +	Ifrn [16]byte +	Ifru [24]byte +} +  const (  	SizeofSockaddrNFCLLCP = 0x60  	SizeofIovec           = 0x10 diff --git a/vendor/golang.org/x/sys/unix/ztypes_linux_mips.go b/vendor/golang.org/x/sys/unix/ztypes_linux_mips.go index e7fb8d9b7..c1131c741 100644 --- a/vendor/golang.org/x/sys/unix/ztypes_linux_mips.go +++ b/vendor/golang.org/x/sys/unix/ztypes_linux_mips.go @@ -175,6 +175,11 @@ type Cmsghdr struct {  	Type  int32  } +type ifreq struct { +	Ifrn [16]byte +	Ifru [16]byte +} +  const (  	SizeofSockaddrNFCLLCP = 0x58  	SizeofIovec           = 0x8 diff --git a/vendor/golang.org/x/sys/unix/ztypes_linux_mips64.go b/vendor/golang.org/x/sys/unix/ztypes_linux_mips64.go index 2fa61d593..91d5574ff 100644 --- a/vendor/golang.org/x/sys/unix/ztypes_linux_mips64.go +++ b/vendor/golang.org/x/sys/unix/ztypes_linux_mips64.go @@ -174,6 +174,11 @@ type Cmsghdr struct {  	Type  int32  } +type ifreq struct { +	Ifrn [16]byte +	Ifru [24]byte +} +  const (  	SizeofSockaddrNFCLLCP = 0x60  	SizeofIovec           = 0x10 diff --git a/vendor/golang.org/x/sys/unix/ztypes_linux_mips64le.go b/vendor/golang.org/x/sys/unix/ztypes_linux_mips64le.go index 7f3639933..5d721497b 100644 --- a/vendor/golang.org/x/sys/unix/ztypes_linux_mips64le.go +++ b/vendor/golang.org/x/sys/unix/ztypes_linux_mips64le.go @@ -174,6 +174,11 @@ type Cmsghdr struct {  	Type  int32  } +type ifreq struct { +	Ifrn [16]byte +	Ifru [24]byte +} +  const (  	SizeofSockaddrNFCLLCP = 0x60  	SizeofIovec           = 0x10 diff --git a/vendor/golang.org/x/sys/unix/ztypes_linux_mipsle.go b/vendor/golang.org/x/sys/unix/ztypes_linux_mipsle.go index f3c20cb86..a5addd06a 100644 --- a/vendor/golang.org/x/sys/unix/ztypes_linux_mipsle.go +++ b/vendor/golang.org/x/sys/unix/ztypes_linux_mipsle.go @@ -175,6 +175,11 @@ type Cmsghdr struct {  	Type  int32  } +type ifreq struct { +	Ifrn [16]byte +	Ifru [16]byte +} +  const (  	SizeofSockaddrNFCLLCP = 0x58  	SizeofIovec           = 0x8 diff --git a/vendor/golang.org/x/sys/unix/ztypes_linux_ppc.go b/vendor/golang.org/x/sys/unix/ztypes_linux_ppc.go index 885d27950..bb6b03dfc 100644 --- a/vendor/golang.org/x/sys/unix/ztypes_linux_ppc.go +++ b/vendor/golang.org/x/sys/unix/ztypes_linux_ppc.go @@ -176,6 +176,11 @@ type Cmsghdr struct {  	Type  int32  } +type ifreq struct { +	Ifrn [16]byte +	Ifru [16]byte +} +  const (  	SizeofSockaddrNFCLLCP = 0x58  	SizeofIovec           = 0x8 diff --git a/vendor/golang.org/x/sys/unix/ztypes_linux_ppc64.go b/vendor/golang.org/x/sys/unix/ztypes_linux_ppc64.go index a94eb8e18..7637243b7 100644 --- a/vendor/golang.org/x/sys/unix/ztypes_linux_ppc64.go +++ b/vendor/golang.org/x/sys/unix/ztypes_linux_ppc64.go @@ -175,6 +175,11 @@ type Cmsghdr struct {  	Type  int32  } +type ifreq struct { +	Ifrn [16]byte +	Ifru [24]byte +} +  const (  	SizeofSockaddrNFCLLCP = 0x60  	SizeofIovec           = 0x10 diff --git a/vendor/golang.org/x/sys/unix/ztypes_linux_ppc64le.go b/vendor/golang.org/x/sys/unix/ztypes_linux_ppc64le.go index 659e32ebd..a1a28e525 100644 --- a/vendor/golang.org/x/sys/unix/ztypes_linux_ppc64le.go +++ b/vendor/golang.org/x/sys/unix/ztypes_linux_ppc64le.go @@ -175,6 +175,11 @@ type Cmsghdr struct {  	Type  int32  } +type ifreq struct { +	Ifrn [16]byte +	Ifru [24]byte +} +  const (  	SizeofSockaddrNFCLLCP = 0x60  	SizeofIovec           = 0x10 diff --git a/vendor/golang.org/x/sys/unix/ztypes_linux_riscv64.go b/vendor/golang.org/x/sys/unix/ztypes_linux_riscv64.go index ab8ec604f..e0a8a1362 100644 --- a/vendor/golang.org/x/sys/unix/ztypes_linux_riscv64.go +++ b/vendor/golang.org/x/sys/unix/ztypes_linux_riscv64.go @@ -174,6 +174,11 @@ type Cmsghdr struct {  	Type  int32  } +type ifreq struct { +	Ifrn [16]byte +	Ifru [24]byte +} +  const (  	SizeofSockaddrNFCLLCP = 0x60  	SizeofIovec           = 0x10 diff --git a/vendor/golang.org/x/sys/unix/ztypes_linux_s390x.go b/vendor/golang.org/x/sys/unix/ztypes_linux_s390x.go index 3ec08237f..21d6e56c7 100644 --- a/vendor/golang.org/x/sys/unix/ztypes_linux_s390x.go +++ b/vendor/golang.org/x/sys/unix/ztypes_linux_s390x.go @@ -173,6 +173,11 @@ type Cmsghdr struct {  	Type  int32  } +type ifreq struct { +	Ifrn [16]byte +	Ifru [24]byte +} +  const (  	SizeofSockaddrNFCLLCP = 0x60  	SizeofIovec           = 0x10 diff --git a/vendor/golang.org/x/sys/unix/ztypes_linux_sparc64.go b/vendor/golang.org/x/sys/unix/ztypes_linux_sparc64.go index 23d474470..0531e98f6 100644 --- a/vendor/golang.org/x/sys/unix/ztypes_linux_sparc64.go +++ b/vendor/golang.org/x/sys/unix/ztypes_linux_sparc64.go @@ -177,6 +177,11 @@ type Cmsghdr struct {  	Type  int32  } +type ifreq struct { +	Ifrn [16]byte +	Ifru [24]byte +} +  const (  	SizeofSockaddrNFCLLCP = 0x60  	SizeofIovec           = 0x10 diff --git a/vendor/golang.org/x/sys/unix/ztypes_solaris_amd64.go b/vendor/golang.org/x/sys/unix/ztypes_solaris_amd64.go index 85effef9c..ad4aad279 100644 --- a/vendor/golang.org/x/sys/unix/ztypes_solaris_amd64.go +++ b/vendor/golang.org/x/sys/unix/ztypes_solaris_amd64.go @@ -440,3 +440,43 @@ const (  	POLLWRBAND = 0x100  	POLLWRNORM = 0x4  ) + +type fileObj struct { +	Atim Timespec +	Mtim Timespec +	Ctim Timespec +	Pad  [3]uint64 +	Name *int8 +} + +type portEvent struct { +	Events int32 +	Source uint16 +	Pad    uint16 +	Object uint64 +	User   *byte +} + +const ( +	PORT_SOURCE_AIO    = 0x1 +	PORT_SOURCE_TIMER  = 0x2 +	PORT_SOURCE_USER   = 0x3 +	PORT_SOURCE_FD     = 0x4 +	PORT_SOURCE_ALERT  = 0x5 +	PORT_SOURCE_MQ     = 0x6 +	PORT_SOURCE_FILE   = 0x7 +	PORT_ALERT_SET     = 0x1 +	PORT_ALERT_UPDATE  = 0x2 +	PORT_ALERT_INVALID = 0x3 +	FILE_ACCESS        = 0x1 +	FILE_MODIFIED      = 0x2 +	FILE_ATTRIB        = 0x4 +	FILE_TRUNC         = 0x100000 +	FILE_NOFOLLOW      = 0x10000000 +	FILE_DELETE        = 0x10 +	FILE_RENAME_TO     = 0x20 +	FILE_RENAME_FROM   = 0x40 +	UNMOUNTED          = 0x20000000 +	MOUNTEDOVER        = 0x40000000 +	FILE_EXCEPTION     = 0x60000070 +) diff --git a/vendor/golang.org/x/sys/windows/security_windows.go b/vendor/golang.org/x/sys/windows/security_windows.go index 111c10d3a..d414ef13b 100644 --- a/vendor/golang.org/x/sys/windows/security_windows.go +++ b/vendor/golang.org/x/sys/windows/security_windows.go @@ -889,6 +889,7 @@ type WTS_SESSION_INFO struct {  //sys WTSQueryUserToken(session uint32, token *Token) (err error) = wtsapi32.WTSQueryUserToken  //sys WTSEnumerateSessions(handle Handle, reserved uint32, version uint32, sessions **WTS_SESSION_INFO, count *uint32) (err error) = wtsapi32.WTSEnumerateSessionsW  //sys WTSFreeMemory(ptr uintptr) = wtsapi32.WTSFreeMemory +//sys WTSGetActiveConsoleSessionId() (sessionID uint32)  type ACL struct {  	aclRevision byte diff --git a/vendor/golang.org/x/sys/windows/zsyscall_windows.go b/vendor/golang.org/x/sys/windows/zsyscall_windows.go index 148de0ffb..2083ec376 100644 --- a/vendor/golang.org/x/sys/windows/zsyscall_windows.go +++ b/vendor/golang.org/x/sys/windows/zsyscall_windows.go @@ -346,6 +346,7 @@ var (  	procVirtualLock                                          = modkernel32.NewProc("VirtualLock")  	procVirtualProtect                                       = modkernel32.NewProc("VirtualProtect")  	procVirtualUnlock                                        = modkernel32.NewProc("VirtualUnlock") +	procWTSGetActiveConsoleSessionId                         = modkernel32.NewProc("WTSGetActiveConsoleSessionId")  	procWaitForMultipleObjects                               = modkernel32.NewProc("WaitForMultipleObjects")  	procWaitForSingleObject                                  = modkernel32.NewProc("WaitForSingleObject")  	procWriteConsoleW                                        = modkernel32.NewProc("WriteConsoleW") @@ -2992,6 +2993,12 @@ func VirtualUnlock(addr uintptr, length uintptr) (err error) {  	return  } +func WTSGetActiveConsoleSessionId() (sessionID uint32) { +	r0, _, _ := syscall.Syscall(procWTSGetActiveConsoleSessionId.Addr(), 0, 0, 0, 0) +	sessionID = uint32(r0) +	return +} +  func waitForMultipleObjects(count uint32, handles uintptr, waitAll bool, waitMilliseconds uint32) (event uint32, err error) {  	var _p0 uint32  	if waitAll { diff --git a/vendor/golang.org/x/tools/AUTHORS b/vendor/golang.org/x/tools/AUTHORS new file mode 100644 index 000000000..15167cd74 --- /dev/null +++ b/vendor/golang.org/x/tools/AUTHORS @@ -0,0 +1,3 @@ +# This source code refers to The Go Authors for copyright purposes. +# The master list of authors is in the main Go distribution, +# visible at http://tip.golang.org/AUTHORS. diff --git a/vendor/golang.org/x/tools/CONTRIBUTORS b/vendor/golang.org/x/tools/CONTRIBUTORS new file mode 100644 index 000000000..1c4577e96 --- /dev/null +++ b/vendor/golang.org/x/tools/CONTRIBUTORS @@ -0,0 +1,3 @@ +# This source code was written by the Go contributors. +# The master list of contributors is in the main Go distribution, +# visible at http://tip.golang.org/CONTRIBUTORS. diff --git a/vendor/golang.org/x/tools/LICENSE b/vendor/golang.org/x/tools/LICENSE new file mode 100644 index 000000000..6a66aea5e --- /dev/null +++ b/vendor/golang.org/x/tools/LICENSE @@ -0,0 +1,27 @@ +Copyright (c) 2009 The Go Authors. All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are +met: + +   * Redistributions of source code must retain the above copyright +notice, this list of conditions and the following disclaimer. +   * Redistributions in binary form must reproduce the above +copyright notice, this list of conditions and the following disclaimer +in the documentation and/or other materials provided with the +distribution. +   * Neither the name of Google Inc. nor the names of its +contributors may be used to endorse or promote products derived from +this software without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. diff --git a/vendor/golang.org/x/tools/PATENTS b/vendor/golang.org/x/tools/PATENTS new file mode 100644 index 000000000..733099041 --- /dev/null +++ b/vendor/golang.org/x/tools/PATENTS @@ -0,0 +1,22 @@ +Additional IP Rights Grant (Patents) + +"This implementation" means the copyrightable works distributed by +Google as part of the Go project. + +Google hereby grants to You a perpetual, worldwide, non-exclusive, +no-charge, royalty-free, irrevocable (except as stated in this section) +patent license to make, have made, use, offer to sell, sell, import, +transfer and otherwise run, modify and propagate the contents of this +implementation of Go, where such license applies only to those patent +claims, both currently owned or controlled by Google and acquired in +the future, licensable by Google that are necessarily infringed by this +implementation of Go.  This grant does not include claims that would be +infringed only as a consequence of further modification of this +implementation.  If you or your agent or exclusive licensee institute or +order or agree to the institution of patent litigation against any +entity (including a cross-claim or counterclaim in a lawsuit) alleging +that this implementation of Go or any code incorporated within this +implementation of Go constitutes direct or contributory patent +infringement, or inducement of patent infringement, then any patent +rights granted to you under this License for this implementation of Go +shall terminate as of the date such litigation is filed. diff --git a/vendor/golang.org/x/tools/go/gcexportdata/gcexportdata.go b/vendor/golang.org/x/tools/go/gcexportdata/gcexportdata.go new file mode 100644 index 000000000..fc8beea5d --- /dev/null +++ b/vendor/golang.org/x/tools/go/gcexportdata/gcexportdata.go @@ -0,0 +1,133 @@ +// 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. + +// Package gcexportdata provides functions for locating, reading, and +// writing export data files containing type information produced by the +// gc compiler.  This package supports go1.7 export data format and all +// later versions. +// +// Although it might seem convenient for this package to live alongside +// go/types in the standard library, this would cause version skew +// problems for developer tools that use it, since they must be able to +// consume the outputs of the gc compiler both before and after a Go +// update such as from Go 1.7 to Go 1.8.  Because this package lives in +// golang.org/x/tools, sites can update their version of this repo some +// time before the Go 1.8 release and rebuild and redeploy their +// developer tools, which will then be able to consume both Go 1.7 and +// Go 1.8 export data files, so they will work before and after the +// Go update. (See discussion at https://golang.org/issue/15651.) +// +package gcexportdata // import "golang.org/x/tools/go/gcexportdata" + +import ( +	"bufio" +	"bytes" +	"fmt" +	"go/token" +	"go/types" +	"io" +	"io/ioutil" + +	"golang.org/x/tools/go/internal/gcimporter" +) + +// Find returns the name of an object (.o) or archive (.a) file +// containing type information for the specified import path, +// using the workspace layout conventions of go/build. +// If no file was found, an empty filename is returned. +// +// A relative srcDir is interpreted relative to the current working directory. +// +// Find also returns the package's resolved (canonical) import path, +// reflecting the effects of srcDir and vendoring on importPath. +func Find(importPath, srcDir string) (filename, path string) { +	return gcimporter.FindPkg(importPath, srcDir) +} + +// NewReader returns a reader for the export data section of an object +// (.o) or archive (.a) file read from r.  The new reader may provide +// additional trailing data beyond the end of the export data. +func NewReader(r io.Reader) (io.Reader, error) { +	buf := bufio.NewReader(r) +	_, err := gcimporter.FindExportData(buf) +	// If we ever switch to a zip-like archive format with the ToC +	// at the end, we can return the correct portion of export data, +	// but for now we must return the entire rest of the file. +	return buf, err +} + +// Read reads export data from in, decodes it, and returns type +// information for the package. +// The package name is specified by path. +// File position information is added to fset. +// +// Read may inspect and add to the imports map to ensure that references +// within the export data to other packages are consistent.  The caller +// must ensure that imports[path] does not exist, or exists but is +// incomplete (see types.Package.Complete), and Read inserts the +// resulting package into this map entry. +// +// On return, the state of the reader is undefined. +func Read(in io.Reader, fset *token.FileSet, imports map[string]*types.Package, path string) (*types.Package, error) { +	data, err := ioutil.ReadAll(in) +	if err != nil { +		return nil, fmt.Errorf("reading export data for %q: %v", path, err) +	} + +	if bytes.HasPrefix(data, []byte("!<arch>")) { +		return nil, fmt.Errorf("can't read export data for %q directly from an archive file (call gcexportdata.NewReader first to extract export data)", path) +	} + +	// The App Engine Go runtime v1.6 uses the old export data format. +	// TODO(adonovan): delete once v1.7 has been around for a while. +	if bytes.HasPrefix(data, []byte("package ")) { +		return gcimporter.ImportData(imports, path, path, bytes.NewReader(data)) +	} + +	// The indexed export format starts with an 'i'; the older +	// binary export format starts with a 'c', 'd', or 'v' +	// (from "version"). Select appropriate importer. +	if len(data) > 0 && data[0] == 'i' { +		_, pkg, err := gcimporter.IImportData(fset, imports, data[1:], path) +		return pkg, err +	} + +	_, pkg, err := gcimporter.BImportData(fset, imports, data, path) +	return pkg, err +} + +// Write writes encoded type information for the specified package to out. +// The FileSet provides file position information for named objects. +func Write(out io.Writer, fset *token.FileSet, pkg *types.Package) error { +	if _, err := io.WriteString(out, "i"); err != nil { +		return err +	} +	return gcimporter.IExportData(out, fset, pkg) +} + +// ReadBundle reads an export bundle from in, decodes it, and returns type +// information for the packages. +// File position information is added to fset. +// +// ReadBundle may inspect and add to the imports map to ensure that references +// within the export bundle to other packages are consistent. +// +// On return, the state of the reader is undefined. +// +// Experimental: This API is experimental and may change in the future. +func ReadBundle(in io.Reader, fset *token.FileSet, imports map[string]*types.Package) ([]*types.Package, error) { +	data, err := ioutil.ReadAll(in) +	if err != nil { +		return nil, fmt.Errorf("reading export bundle: %v", err) +	} +	return gcimporter.IImportBundle(fset, imports, data) +} + +// WriteBundle writes encoded type information for the specified packages to out. +// The FileSet provides file position information for named objects. +// +// Experimental: This API is experimental and may change in the future. +func WriteBundle(out io.Writer, fset *token.FileSet, pkgs []*types.Package) error { +	return gcimporter.IExportBundle(out, fset, pkgs) +} diff --git a/vendor/golang.org/x/tools/go/gcexportdata/importer.go b/vendor/golang.org/x/tools/go/gcexportdata/importer.go new file mode 100644 index 000000000..efe221e7e --- /dev/null +++ b/vendor/golang.org/x/tools/go/gcexportdata/importer.go @@ -0,0 +1,73 @@ +// 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. + +package gcexportdata + +import ( +	"fmt" +	"go/token" +	"go/types" +	"os" +) + +// NewImporter returns a new instance of the types.Importer interface +// that reads type information from export data files written by gc. +// The Importer also satisfies types.ImporterFrom. +// +// Export data files are located using "go build" workspace conventions +// and the build.Default context. +// +// Use this importer instead of go/importer.For("gc", ...) to avoid the +// version-skew problems described in the documentation of this package, +// or to control the FileSet or access the imports map populated during +// package loading. +// +func NewImporter(fset *token.FileSet, imports map[string]*types.Package) types.ImporterFrom { +	return importer{fset, imports} +} + +type importer struct { +	fset    *token.FileSet +	imports map[string]*types.Package +} + +func (imp importer) Import(importPath string) (*types.Package, error) { +	return imp.ImportFrom(importPath, "", 0) +} + +func (imp importer) ImportFrom(importPath, srcDir string, mode types.ImportMode) (_ *types.Package, err error) { +	filename, path := Find(importPath, srcDir) +	if filename == "" { +		if importPath == "unsafe" { +			// Even for unsafe, call Find first in case +			// the package was vendored. +			return types.Unsafe, nil +		} +		return nil, fmt.Errorf("can't find import: %s", importPath) +	} + +	if pkg, ok := imp.imports[path]; ok && pkg.Complete() { +		return pkg, nil // cache hit +	} + +	// open file +	f, err := os.Open(filename) +	if err != nil { +		return nil, err +	} +	defer func() { +		f.Close() +		if err != nil { +			// add file name to error +			err = fmt.Errorf("reading export data: %s: %v", filename, err) +		} +	}() + +	r, err := NewReader(f) +	if err != nil { +		return nil, err +	} + +	return Read(r, imp.fset, imp.imports, path) +} diff --git a/vendor/golang.org/x/tools/go/internal/gcimporter/bexport.go b/vendor/golang.org/x/tools/go/internal/gcimporter/bexport.go new file mode 100644 index 000000000..a807d0aaa --- /dev/null +++ b/vendor/golang.org/x/tools/go/internal/gcimporter/bexport.go @@ -0,0 +1,852 @@ +// 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. + +// Binary package export. +// This file was derived from $GOROOT/src/cmd/compile/internal/gc/bexport.go; +// see that file for specification of the format. + +package gcimporter + +import ( +	"bytes" +	"encoding/binary" +	"fmt" +	"go/ast" +	"go/constant" +	"go/token" +	"go/types" +	"math" +	"math/big" +	"sort" +	"strings" +) + +// If debugFormat is set, each integer and string value is preceded by a marker +// and position information in the encoding. This mechanism permits an importer +// to recognize immediately when it is out of sync. The importer recognizes this +// mode automatically (i.e., it can import export data produced with debugging +// support even if debugFormat is not set at the time of import). This mode will +// lead to massively larger export data (by a factor of 2 to 3) and should only +// be enabled during development and debugging. +// +// NOTE: This flag is the first flag to enable if importing dies because of +// (suspected) format errors, and whenever a change is made to the format. +const debugFormat = false // default: false + +// If trace is set, debugging output is printed to std out. +const trace = false // default: false + +// Current export format version. Increase with each format change. +// Note: The latest binary (non-indexed) export format is at version 6. +//       This exporter is still at level 4, but it doesn't matter since +//       the binary importer can handle older versions just fine. +// 6: package height (CL 105038) -- NOT IMPLEMENTED HERE +// 5: improved position encoding efficiency (issue 20080, CL 41619) -- NOT IMPLEMEMTED HERE +// 4: type name objects support type aliases, uses aliasTag +// 3: Go1.8 encoding (same as version 2, aliasTag defined but never used) +// 2: removed unused bool in ODCL export (compiler only) +// 1: header format change (more regular), export package for _ struct fields +// 0: Go1.7 encoding +const exportVersion = 4 + +// trackAllTypes enables cycle tracking for all types, not just named +// types. The existing compiler invariants assume that unnamed types +// that are not completely set up are not used, or else there are spurious +// errors. +// If disabled, only named types are tracked, possibly leading to slightly +// less efficient encoding in rare cases. It also prevents the export of +// some corner-case type declarations (but those are not handled correctly +// with with the textual export format either). +// TODO(gri) enable and remove once issues caused by it are fixed +const trackAllTypes = false + +type exporter struct { +	fset *token.FileSet +	out  bytes.Buffer + +	// object -> index maps, indexed in order of serialization +	strIndex map[string]int +	pkgIndex map[*types.Package]int +	typIndex map[types.Type]int + +	// position encoding +	posInfoFormat bool +	prevFile      string +	prevLine      int + +	// debugging support +	written int // bytes written +	indent  int // for trace +} + +// internalError represents an error generated inside this package. +type internalError string + +func (e internalError) Error() string { return "gcimporter: " + string(e) } + +func internalErrorf(format string, args ...interface{}) error { +	return internalError(fmt.Sprintf(format, args...)) +} + +// BExportData returns binary export data for pkg. +// If no file set is provided, position info will be missing. +func BExportData(fset *token.FileSet, pkg *types.Package) (b []byte, err error) { +	defer func() { +		if e := recover(); e != nil { +			if ierr, ok := e.(internalError); ok { +				err = ierr +				return +			} +			// Not an internal error; panic again. +			panic(e) +		} +	}() + +	p := exporter{ +		fset:          fset, +		strIndex:      map[string]int{"": 0}, // empty string is mapped to 0 +		pkgIndex:      make(map[*types.Package]int), +		typIndex:      make(map[types.Type]int), +		posInfoFormat: true, // TODO(gri) might become a flag, eventually +	} + +	// write version info +	// The version string must start with "version %d" where %d is the version +	// number. Additional debugging information may follow after a blank; that +	// text is ignored by the importer. +	p.rawStringln(fmt.Sprintf("version %d", exportVersion)) +	var debug string +	if debugFormat { +		debug = "debug" +	} +	p.rawStringln(debug) // cannot use p.bool since it's affected by debugFormat; also want to see this clearly +	p.bool(trackAllTypes) +	p.bool(p.posInfoFormat) + +	// --- generic export data --- + +	// populate type map with predeclared "known" types +	for index, typ := range predeclared() { +		p.typIndex[typ] = index +	} +	if len(p.typIndex) != len(predeclared()) { +		return nil, internalError("duplicate entries in type map?") +	} + +	// write package data +	p.pkg(pkg, true) +	if trace { +		p.tracef("\n") +	} + +	// write objects +	objcount := 0 +	scope := pkg.Scope() +	for _, name := range scope.Names() { +		if !ast.IsExported(name) { +			continue +		} +		if trace { +			p.tracef("\n") +		} +		p.obj(scope.Lookup(name)) +		objcount++ +	} + +	// indicate end of list +	if trace { +		p.tracef("\n") +	} +	p.tag(endTag) + +	// for self-verification only (redundant) +	p.int(objcount) + +	if trace { +		p.tracef("\n") +	} + +	// --- end of export data --- + +	return p.out.Bytes(), nil +} + +func (p *exporter) pkg(pkg *types.Package, emptypath bool) { +	if pkg == nil { +		panic(internalError("unexpected nil pkg")) +	} + +	// if we saw the package before, write its index (>= 0) +	if i, ok := p.pkgIndex[pkg]; ok { +		p.index('P', i) +		return +	} + +	// otherwise, remember the package, write the package tag (< 0) and package data +	if trace { +		p.tracef("P%d = { ", len(p.pkgIndex)) +		defer p.tracef("} ") +	} +	p.pkgIndex[pkg] = len(p.pkgIndex) + +	p.tag(packageTag) +	p.string(pkg.Name()) +	if emptypath { +		p.string("") +	} else { +		p.string(pkg.Path()) +	} +} + +func (p *exporter) obj(obj types.Object) { +	switch obj := obj.(type) { +	case *types.Const: +		p.tag(constTag) +		p.pos(obj) +		p.qualifiedName(obj) +		p.typ(obj.Type()) +		p.value(obj.Val()) + +	case *types.TypeName: +		if obj.IsAlias() { +			p.tag(aliasTag) +			p.pos(obj) +			p.qualifiedName(obj) +		} else { +			p.tag(typeTag) +		} +		p.typ(obj.Type()) + +	case *types.Var: +		p.tag(varTag) +		p.pos(obj) +		p.qualifiedName(obj) +		p.typ(obj.Type()) + +	case *types.Func: +		p.tag(funcTag) +		p.pos(obj) +		p.qualifiedName(obj) +		sig := obj.Type().(*types.Signature) +		p.paramList(sig.Params(), sig.Variadic()) +		p.paramList(sig.Results(), false) + +	default: +		panic(internalErrorf("unexpected object %v (%T)", obj, obj)) +	} +} + +func (p *exporter) pos(obj types.Object) { +	if !p.posInfoFormat { +		return +	} + +	file, line := p.fileLine(obj) +	if file == p.prevFile { +		// common case: write line delta +		// delta == 0 means different file or no line change +		delta := line - p.prevLine +		p.int(delta) +		if delta == 0 { +			p.int(-1) // -1 means no file change +		} +	} else { +		// different file +		p.int(0) +		// Encode filename as length of common prefix with previous +		// filename, followed by (possibly empty) suffix. Filenames +		// frequently share path prefixes, so this can save a lot +		// of space and make export data size less dependent on file +		// path length. The suffix is unlikely to be empty because +		// file names tend to end in ".go". +		n := commonPrefixLen(p.prevFile, file) +		p.int(n)           // n >= 0 +		p.string(file[n:]) // write suffix only +		p.prevFile = file +		p.int(line) +	} +	p.prevLine = line +} + +func (p *exporter) fileLine(obj types.Object) (file string, line int) { +	if p.fset != nil { +		pos := p.fset.Position(obj.Pos()) +		file = pos.Filename +		line = pos.Line +	} +	return +} + +func commonPrefixLen(a, b string) int { +	if len(a) > len(b) { +		a, b = b, a +	} +	// len(a) <= len(b) +	i := 0 +	for i < len(a) && a[i] == b[i] { +		i++ +	} +	return i +} + +func (p *exporter) qualifiedName(obj types.Object) { +	p.string(obj.Name()) +	p.pkg(obj.Pkg(), false) +} + +func (p *exporter) typ(t types.Type) { +	if t == nil { +		panic(internalError("nil type")) +	} + +	// Possible optimization: Anonymous pointer types *T where +	// T is a named type are common. We could canonicalize all +	// such types *T to a single type PT = *T. This would lead +	// to at most one *T entry in typIndex, and all future *T's +	// would be encoded as the respective index directly. Would +	// save 1 byte (pointerTag) per *T and reduce the typIndex +	// size (at the cost of a canonicalization map). We can do +	// this later, without encoding format change. + +	// if we saw the type before, write its index (>= 0) +	if i, ok := p.typIndex[t]; ok { +		p.index('T', i) +		return +	} + +	// otherwise, remember the type, write the type tag (< 0) and type data +	if trackAllTypes { +		if trace { +			p.tracef("T%d = {>\n", len(p.typIndex)) +			defer p.tracef("<\n} ") +		} +		p.typIndex[t] = len(p.typIndex) +	} + +	switch t := t.(type) { +	case *types.Named: +		if !trackAllTypes { +			// if we don't track all types, track named types now +			p.typIndex[t] = len(p.typIndex) +		} + +		p.tag(namedTag) +		p.pos(t.Obj()) +		p.qualifiedName(t.Obj()) +		p.typ(t.Underlying()) +		if !types.IsInterface(t) { +			p.assocMethods(t) +		} + +	case *types.Array: +		p.tag(arrayTag) +		p.int64(t.Len()) +		p.typ(t.Elem()) + +	case *types.Slice: +		p.tag(sliceTag) +		p.typ(t.Elem()) + +	case *dddSlice: +		p.tag(dddTag) +		p.typ(t.elem) + +	case *types.Struct: +		p.tag(structTag) +		p.fieldList(t) + +	case *types.Pointer: +		p.tag(pointerTag) +		p.typ(t.Elem()) + +	case *types.Signature: +		p.tag(signatureTag) +		p.paramList(t.Params(), t.Variadic()) +		p.paramList(t.Results(), false) + +	case *types.Interface: +		p.tag(interfaceTag) +		p.iface(t) + +	case *types.Map: +		p.tag(mapTag) +		p.typ(t.Key()) +		p.typ(t.Elem()) + +	case *types.Chan: +		p.tag(chanTag) +		p.int(int(3 - t.Dir())) // hack +		p.typ(t.Elem()) + +	default: +		panic(internalErrorf("unexpected type %T: %s", t, t)) +	} +} + +func (p *exporter) assocMethods(named *types.Named) { +	// Sort methods (for determinism). +	var methods []*types.Func +	for i := 0; i < named.NumMethods(); i++ { +		methods = append(methods, named.Method(i)) +	} +	sort.Sort(methodsByName(methods)) + +	p.int(len(methods)) + +	if trace && methods != nil { +		p.tracef("associated methods {>\n") +	} + +	for i, m := range methods { +		if trace && i > 0 { +			p.tracef("\n") +		} + +		p.pos(m) +		name := m.Name() +		p.string(name) +		if !exported(name) { +			p.pkg(m.Pkg(), false) +		} + +		sig := m.Type().(*types.Signature) +		p.paramList(types.NewTuple(sig.Recv()), false) +		p.paramList(sig.Params(), sig.Variadic()) +		p.paramList(sig.Results(), false) +		p.int(0) // dummy value for go:nointerface pragma - ignored by importer +	} + +	if trace && methods != nil { +		p.tracef("<\n} ") +	} +} + +type methodsByName []*types.Func + +func (x methodsByName) Len() int           { return len(x) } +func (x methodsByName) Swap(i, j int)      { x[i], x[j] = x[j], x[i] } +func (x methodsByName) Less(i, j int) bool { return x[i].Name() < x[j].Name() } + +func (p *exporter) fieldList(t *types.Struct) { +	if trace && t.NumFields() > 0 { +		p.tracef("fields {>\n") +		defer p.tracef("<\n} ") +	} + +	p.int(t.NumFields()) +	for i := 0; i < t.NumFields(); i++ { +		if trace && i > 0 { +			p.tracef("\n") +		} +		p.field(t.Field(i)) +		p.string(t.Tag(i)) +	} +} + +func (p *exporter) field(f *types.Var) { +	if !f.IsField() { +		panic(internalError("field expected")) +	} + +	p.pos(f) +	p.fieldName(f) +	p.typ(f.Type()) +} + +func (p *exporter) iface(t *types.Interface) { +	// TODO(gri): enable importer to load embedded interfaces, +	// then emit Embeddeds and ExplicitMethods separately here. +	p.int(0) + +	n := t.NumMethods() +	if trace && n > 0 { +		p.tracef("methods {>\n") +		defer p.tracef("<\n} ") +	} +	p.int(n) +	for i := 0; i < n; i++ { +		if trace && i > 0 { +			p.tracef("\n") +		} +		p.method(t.Method(i)) +	} +} + +func (p *exporter) method(m *types.Func) { +	sig := m.Type().(*types.Signature) +	if sig.Recv() == nil { +		panic(internalError("method expected")) +	} + +	p.pos(m) +	p.string(m.Name()) +	if m.Name() != "_" && !ast.IsExported(m.Name()) { +		p.pkg(m.Pkg(), false) +	} + +	// interface method; no need to encode receiver. +	p.paramList(sig.Params(), sig.Variadic()) +	p.paramList(sig.Results(), false) +} + +func (p *exporter) fieldName(f *types.Var) { +	name := f.Name() + +	if f.Anonymous() { +		// anonymous field - we distinguish between 3 cases: +		// 1) field name matches base type name and is exported +		// 2) field name matches base type name and is not exported +		// 3) field name doesn't match base type name (alias name) +		bname := basetypeName(f.Type()) +		if name == bname { +			if ast.IsExported(name) { +				name = "" // 1) we don't need to know the field name or package +			} else { +				name = "?" // 2) use unexported name "?" to force package export +			} +		} else { +			// 3) indicate alias and export name as is +			// (this requires an extra "@" but this is a rare case) +			p.string("@") +		} +	} + +	p.string(name) +	if name != "" && !ast.IsExported(name) { +		p.pkg(f.Pkg(), false) +	} +} + +func basetypeName(typ types.Type) string { +	switch typ := deref(typ).(type) { +	case *types.Basic: +		return typ.Name() +	case *types.Named: +		return typ.Obj().Name() +	default: +		return "" // unnamed type +	} +} + +func (p *exporter) paramList(params *types.Tuple, variadic bool) { +	// use negative length to indicate unnamed parameters +	// (look at the first parameter only since either all +	// names are present or all are absent) +	n := params.Len() +	if n > 0 && params.At(0).Name() == "" { +		n = -n +	} +	p.int(n) +	for i := 0; i < params.Len(); i++ { +		q := params.At(i) +		t := q.Type() +		if variadic && i == params.Len()-1 { +			t = &dddSlice{t.(*types.Slice).Elem()} +		} +		p.typ(t) +		if n > 0 { +			name := q.Name() +			p.string(name) +			if name != "_" { +				p.pkg(q.Pkg(), false) +			} +		} +		p.string("") // no compiler-specific info +	} +} + +func (p *exporter) value(x constant.Value) { +	if trace { +		p.tracef("= ") +	} + +	switch x.Kind() { +	case constant.Bool: +		tag := falseTag +		if constant.BoolVal(x) { +			tag = trueTag +		} +		p.tag(tag) + +	case constant.Int: +		if v, exact := constant.Int64Val(x); exact { +			// common case: x fits into an int64 - use compact encoding +			p.tag(int64Tag) +			p.int64(v) +			return +		} +		// uncommon case: large x - use float encoding +		// (powers of 2 will be encoded efficiently with exponent) +		p.tag(floatTag) +		p.float(constant.ToFloat(x)) + +	case constant.Float: +		p.tag(floatTag) +		p.float(x) + +	case constant.Complex: +		p.tag(complexTag) +		p.float(constant.Real(x)) +		p.float(constant.Imag(x)) + +	case constant.String: +		p.tag(stringTag) +		p.string(constant.StringVal(x)) + +	case constant.Unknown: +		// package contains type errors +		p.tag(unknownTag) + +	default: +		panic(internalErrorf("unexpected value %v (%T)", x, x)) +	} +} + +func (p *exporter) float(x constant.Value) { +	if x.Kind() != constant.Float { +		panic(internalErrorf("unexpected constant %v, want float", x)) +	} +	// extract sign (there is no -0) +	sign := constant.Sign(x) +	if sign == 0 { +		// x == 0 +		p.int(0) +		return +	} +	// x != 0 + +	var f big.Float +	if v, exact := constant.Float64Val(x); exact { +		// float64 +		f.SetFloat64(v) +	} else if num, denom := constant.Num(x), constant.Denom(x); num.Kind() == constant.Int { +		// TODO(gri): add big.Rat accessor to constant.Value. +		r := valueToRat(num) +		f.SetRat(r.Quo(r, valueToRat(denom))) +	} else { +		// Value too large to represent as a fraction => inaccessible. +		// TODO(gri): add big.Float accessor to constant.Value. +		f.SetFloat64(math.MaxFloat64) // FIXME +	} + +	// extract exponent such that 0.5 <= m < 1.0 +	var m big.Float +	exp := f.MantExp(&m) + +	// extract mantissa as *big.Int +	// - set exponent large enough so mant satisfies mant.IsInt() +	// - get *big.Int from mant +	m.SetMantExp(&m, int(m.MinPrec())) +	mant, acc := m.Int(nil) +	if acc != big.Exact { +		panic(internalError("internal error")) +	} + +	p.int(sign) +	p.int(exp) +	p.string(string(mant.Bytes())) +} + +func valueToRat(x constant.Value) *big.Rat { +	// Convert little-endian to big-endian. +	// I can't believe this is necessary. +	bytes := constant.Bytes(x) +	for i := 0; i < len(bytes)/2; i++ { +		bytes[i], bytes[len(bytes)-1-i] = bytes[len(bytes)-1-i], bytes[i] +	} +	return new(big.Rat).SetInt(new(big.Int).SetBytes(bytes)) +} + +func (p *exporter) bool(b bool) bool { +	if trace { +		p.tracef("[") +		defer p.tracef("= %v] ", b) +	} + +	x := 0 +	if b { +		x = 1 +	} +	p.int(x) +	return b +} + +// ---------------------------------------------------------------------------- +// Low-level encoders + +func (p *exporter) index(marker byte, index int) { +	if index < 0 { +		panic(internalError("invalid index < 0")) +	} +	if debugFormat { +		p.marker('t') +	} +	if trace { +		p.tracef("%c%d ", marker, index) +	} +	p.rawInt64(int64(index)) +} + +func (p *exporter) tag(tag int) { +	if tag >= 0 { +		panic(internalError("invalid tag >= 0")) +	} +	if debugFormat { +		p.marker('t') +	} +	if trace { +		p.tracef("%s ", tagString[-tag]) +	} +	p.rawInt64(int64(tag)) +} + +func (p *exporter) int(x int) { +	p.int64(int64(x)) +} + +func (p *exporter) int64(x int64) { +	if debugFormat { +		p.marker('i') +	} +	if trace { +		p.tracef("%d ", x) +	} +	p.rawInt64(x) +} + +func (p *exporter) string(s string) { +	if debugFormat { +		p.marker('s') +	} +	if trace { +		p.tracef("%q ", s) +	} +	// if we saw the string before, write its index (>= 0) +	// (the empty string is mapped to 0) +	if i, ok := p.strIndex[s]; ok { +		p.rawInt64(int64(i)) +		return +	} +	// otherwise, remember string and write its negative length and bytes +	p.strIndex[s] = len(p.strIndex) +	p.rawInt64(-int64(len(s))) +	for i := 0; i < len(s); i++ { +		p.rawByte(s[i]) +	} +} + +// marker emits a marker byte and position information which makes +// it easy for a reader to detect if it is "out of sync". Used for +// debugFormat format only. +func (p *exporter) marker(m byte) { +	p.rawByte(m) +	// Enable this for help tracking down the location +	// of an incorrect marker when running in debugFormat. +	if false && trace { +		p.tracef("#%d ", p.written) +	} +	p.rawInt64(int64(p.written)) +} + +// rawInt64 should only be used by low-level encoders. +func (p *exporter) rawInt64(x int64) { +	var tmp [binary.MaxVarintLen64]byte +	n := binary.PutVarint(tmp[:], x) +	for i := 0; i < n; i++ { +		p.rawByte(tmp[i]) +	} +} + +// rawStringln should only be used to emit the initial version string. +func (p *exporter) rawStringln(s string) { +	for i := 0; i < len(s); i++ { +		p.rawByte(s[i]) +	} +	p.rawByte('\n') +} + +// rawByte is the bottleneck interface to write to p.out. +// rawByte escapes b as follows (any encoding does that +// hides '$'): +// +//	'$'  => '|' 'S' +//	'|'  => '|' '|' +// +// Necessary so other tools can find the end of the +// export data by searching for "$$". +// rawByte should only be used by low-level encoders. +func (p *exporter) rawByte(b byte) { +	switch b { +	case '$': +		// write '$' as '|' 'S' +		b = 'S' +		fallthrough +	case '|': +		// write '|' as '|' '|' +		p.out.WriteByte('|') +		p.written++ +	} +	p.out.WriteByte(b) +	p.written++ +} + +// tracef is like fmt.Printf but it rewrites the format string +// to take care of indentation. +func (p *exporter) tracef(format string, args ...interface{}) { +	if strings.ContainsAny(format, "<>\n") { +		var buf bytes.Buffer +		for i := 0; i < len(format); i++ { +			// no need to deal with runes +			ch := format[i] +			switch ch { +			case '>': +				p.indent++ +				continue +			case '<': +				p.indent-- +				continue +			} +			buf.WriteByte(ch) +			if ch == '\n' { +				for j := p.indent; j > 0; j-- { +					buf.WriteString(".  ") +				} +			} +		} +		format = buf.String() +	} +	fmt.Printf(format, args...) +} + +// Debugging support. +// (tagString is only used when tracing is enabled) +var tagString = [...]string{ +	// Packages +	-packageTag: "package", + +	// Types +	-namedTag:     "named type", +	-arrayTag:     "array", +	-sliceTag:     "slice", +	-dddTag:       "ddd", +	-structTag:    "struct", +	-pointerTag:   "pointer", +	-signatureTag: "signature", +	-interfaceTag: "interface", +	-mapTag:       "map", +	-chanTag:      "chan", + +	// Values +	-falseTag:    "false", +	-trueTag:     "true", +	-int64Tag:    "int64", +	-floatTag:    "float", +	-fractionTag: "fraction", +	-complexTag:  "complex", +	-stringTag:   "string", +	-unknownTag:  "unknown", + +	// Type aliases +	-aliasTag: "alias", +} diff --git a/vendor/golang.org/x/tools/go/internal/gcimporter/bimport.go b/vendor/golang.org/x/tools/go/internal/gcimporter/bimport.go new file mode 100644 index 000000000..e9f73d14a --- /dev/null +++ b/vendor/golang.org/x/tools/go/internal/gcimporter/bimport.go @@ -0,0 +1,1039 @@ +// 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. + +// This file is a copy of $GOROOT/src/go/internal/gcimporter/bimport.go. + +package gcimporter + +import ( +	"encoding/binary" +	"fmt" +	"go/constant" +	"go/token" +	"go/types" +	"sort" +	"strconv" +	"strings" +	"sync" +	"unicode" +	"unicode/utf8" +) + +type importer struct { +	imports    map[string]*types.Package +	data       []byte +	importpath string +	buf        []byte // for reading strings +	version    int    // export format version + +	// object lists +	strList       []string           // in order of appearance +	pathList      []string           // in order of appearance +	pkgList       []*types.Package   // in order of appearance +	typList       []types.Type       // in order of appearance +	interfaceList []*types.Interface // for delayed completion only +	trackAllTypes bool + +	// position encoding +	posInfoFormat bool +	prevFile      string +	prevLine      int +	fake          fakeFileSet + +	// debugging support +	debugFormat bool +	read        int // bytes read +} + +// BImportData imports a package from the serialized package data +// and returns the number of bytes consumed and a reference to the package. +// If the export data version is not recognized or the format is otherwise +// compromised, an error is returned. +func BImportData(fset *token.FileSet, imports map[string]*types.Package, data []byte, path string) (_ int, pkg *types.Package, err error) { +	// catch panics and return them as errors +	const currentVersion = 6 +	version := -1 // unknown version +	defer func() { +		if e := recover(); e != nil { +			// Return a (possibly nil or incomplete) package unchanged (see #16088). +			if version > currentVersion { +				err = fmt.Errorf("cannot import %q (%v), export data is newer version - update tool", path, e) +			} else { +				err = fmt.Errorf("cannot import %q (%v), possibly version skew - reinstall package", path, e) +			} +		} +	}() + +	p := importer{ +		imports:    imports, +		data:       data, +		importpath: path, +		version:    version, +		strList:    []string{""}, // empty string is mapped to 0 +		pathList:   []string{""}, // empty string is mapped to 0 +		fake: fakeFileSet{ +			fset:  fset, +			files: make(map[string]*token.File), +		}, +	} + +	// read version info +	var versionstr string +	if b := p.rawByte(); b == 'c' || b == 'd' { +		// Go1.7 encoding; first byte encodes low-level +		// encoding format (compact vs debug). +		// For backward-compatibility only (avoid problems with +		// old installed packages). Newly compiled packages use +		// the extensible format string. +		// TODO(gri) Remove this support eventually; after Go1.8. +		if b == 'd' { +			p.debugFormat = true +		} +		p.trackAllTypes = p.rawByte() == 'a' +		p.posInfoFormat = p.int() != 0 +		versionstr = p.string() +		if versionstr == "v1" { +			version = 0 +		} +	} else { +		// Go1.8 extensible encoding +		// read version string and extract version number (ignore anything after the version number) +		versionstr = p.rawStringln(b) +		if s := strings.SplitN(versionstr, " ", 3); len(s) >= 2 && s[0] == "version" { +			if v, err := strconv.Atoi(s[1]); err == nil && v > 0 { +				version = v +			} +		} +	} +	p.version = version + +	// read version specific flags - extend as necessary +	switch p.version { +	// case currentVersion: +	// 	... +	//	fallthrough +	case currentVersion, 5, 4, 3, 2, 1: +		p.debugFormat = p.rawStringln(p.rawByte()) == "debug" +		p.trackAllTypes = p.int() != 0 +		p.posInfoFormat = p.int() != 0 +	case 0: +		// Go1.7 encoding format - nothing to do here +	default: +		errorf("unknown bexport format version %d (%q)", p.version, versionstr) +	} + +	// --- generic export data --- + +	// populate typList with predeclared "known" types +	p.typList = append(p.typList, predeclared()...) + +	// read package data +	pkg = p.pkg() + +	// read objects of phase 1 only (see cmd/compile/internal/gc/bexport.go) +	objcount := 0 +	for { +		tag := p.tagOrIndex() +		if tag == endTag { +			break +		} +		p.obj(tag) +		objcount++ +	} + +	// self-verification +	if count := p.int(); count != objcount { +		errorf("got %d objects; want %d", objcount, count) +	} + +	// ignore compiler-specific import data + +	// complete interfaces +	// TODO(gri) re-investigate if we still need to do this in a delayed fashion +	for _, typ := range p.interfaceList { +		typ.Complete() +	} + +	// record all referenced packages as imports +	list := append(([]*types.Package)(nil), p.pkgList[1:]...) +	sort.Sort(byPath(list)) +	pkg.SetImports(list) + +	// package was imported completely and without errors +	pkg.MarkComplete() + +	return p.read, pkg, nil +} + +func errorf(format string, args ...interface{}) { +	panic(fmt.Sprintf(format, args...)) +} + +func (p *importer) pkg() *types.Package { +	// if the package was seen before, i is its index (>= 0) +	i := p.tagOrIndex() +	if i >= 0 { +		return p.pkgList[i] +	} + +	// otherwise, i is the package tag (< 0) +	if i != packageTag { +		errorf("unexpected package tag %d version %d", i, p.version) +	} + +	// read package data +	name := p.string() +	var path string +	if p.version >= 5 { +		path = p.path() +	} else { +		path = p.string() +	} +	if p.version >= 6 { +		p.int() // package height; unused by go/types +	} + +	// we should never see an empty package name +	if name == "" { +		errorf("empty package name in import") +	} + +	// an empty path denotes the package we are currently importing; +	// it must be the first package we see +	if (path == "") != (len(p.pkgList) == 0) { +		errorf("package path %q for pkg index %d", path, len(p.pkgList)) +	} + +	// if the package was imported before, use that one; otherwise create a new one +	if path == "" { +		path = p.importpath +	} +	pkg := p.imports[path] +	if pkg == nil { +		pkg = types.NewPackage(path, name) +		p.imports[path] = pkg +	} else if pkg.Name() != name { +		errorf("conflicting names %s and %s for package %q", pkg.Name(), name, path) +	} +	p.pkgList = append(p.pkgList, pkg) + +	return pkg +} + +// objTag returns the tag value for each object kind. +func objTag(obj types.Object) int { +	switch obj.(type) { +	case *types.Const: +		return constTag +	case *types.TypeName: +		return typeTag +	case *types.Var: +		return varTag +	case *types.Func: +		return funcTag +	default: +		errorf("unexpected object: %v (%T)", obj, obj) // panics +		panic("unreachable") +	} +} + +func sameObj(a, b types.Object) bool { +	// Because unnamed types are not canonicalized, we cannot simply compare types for +	// (pointer) identity. +	// Ideally we'd check equality of constant values as well, but this is good enough. +	return objTag(a) == objTag(b) && types.Identical(a.Type(), b.Type()) +} + +func (p *importer) declare(obj types.Object) { +	pkg := obj.Pkg() +	if alt := pkg.Scope().Insert(obj); alt != nil { +		// This can only trigger if we import a (non-type) object a second time. +		// Excluding type aliases, this cannot happen because 1) we only import a package +		// once; and b) we ignore compiler-specific export data which may contain +		// functions whose inlined function bodies refer to other functions that +		// were already imported. +		// However, type aliases require reexporting the original type, so we need +		// to allow it (see also the comment in cmd/compile/internal/gc/bimport.go, +		// method importer.obj, switch case importing functions). +		// TODO(gri) review/update this comment once the gc compiler handles type aliases. +		if !sameObj(obj, alt) { +			errorf("inconsistent import:\n\t%v\npreviously imported as:\n\t%v\n", obj, alt) +		} +	} +} + +func (p *importer) obj(tag int) { +	switch tag { +	case constTag: +		pos := p.pos() +		pkg, name := p.qualifiedName() +		typ := p.typ(nil, nil) +		val := p.value() +		p.declare(types.NewConst(pos, pkg, name, typ, val)) + +	case aliasTag: +		// TODO(gri) verify type alias hookup is correct +		pos := p.pos() +		pkg, name := p.qualifiedName() +		typ := p.typ(nil, nil) +		p.declare(types.NewTypeName(pos, pkg, name, typ)) + +	case typeTag: +		p.typ(nil, nil) + +	case varTag: +		pos := p.pos() +		pkg, name := p.qualifiedName() +		typ := p.typ(nil, nil) +		p.declare(types.NewVar(pos, pkg, name, typ)) + +	case funcTag: +		pos := p.pos() +		pkg, name := p.qualifiedName() +		params, isddd := p.paramList() +		result, _ := p.paramList() +		sig := types.NewSignature(nil, params, result, isddd) +		p.declare(types.NewFunc(pos, pkg, name, sig)) + +	default: +		errorf("unexpected object tag %d", tag) +	} +} + +const deltaNewFile = -64 // see cmd/compile/internal/gc/bexport.go + +func (p *importer) pos() token.Pos { +	if !p.posInfoFormat { +		return token.NoPos +	} + +	file := p.prevFile +	line := p.prevLine +	delta := p.int() +	line += delta +	if p.version >= 5 { +		if delta == deltaNewFile { +			if n := p.int(); n >= 0 { +				// file changed +				file = p.path() +				line = n +			} +		} +	} else { +		if delta == 0 { +			if n := p.int(); n >= 0 { +				// file changed +				file = p.prevFile[:n] + p.string() +				line = p.int() +			} +		} +	} +	p.prevFile = file +	p.prevLine = line + +	return p.fake.pos(file, line, 0) +} + +// Synthesize a token.Pos +type fakeFileSet struct { +	fset  *token.FileSet +	files map[string]*token.File +} + +func (s *fakeFileSet) pos(file string, line, column int) token.Pos { +	// TODO(mdempsky): Make use of column. + +	// Since we don't know the set of needed file positions, we +	// reserve maxlines positions per file. +	const maxlines = 64 * 1024 +	f := s.files[file] +	if f == nil { +		f = s.fset.AddFile(file, -1, maxlines) +		s.files[file] = f +		// Allocate the fake linebreak indices on first use. +		// TODO(adonovan): opt: save ~512KB using a more complex scheme? +		fakeLinesOnce.Do(func() { +			fakeLines = make([]int, maxlines) +			for i := range fakeLines { +				fakeLines[i] = i +			} +		}) +		f.SetLines(fakeLines) +	} + +	if line > maxlines { +		line = 1 +	} + +	// Treat the file as if it contained only newlines +	// and column=1: use the line number as the offset. +	return f.Pos(line - 1) +} + +var ( +	fakeLines     []int +	fakeLinesOnce sync.Once +) + +func (p *importer) qualifiedName() (pkg *types.Package, name string) { +	name = p.string() +	pkg = p.pkg() +	return +} + +func (p *importer) record(t types.Type) { +	p.typList = append(p.typList, t) +} + +// A dddSlice is a types.Type representing ...T parameters. +// It only appears for parameter types and does not escape +// the importer. +type dddSlice struct { +	elem types.Type +} + +func (t *dddSlice) Underlying() types.Type { return t } +func (t *dddSlice) String() string         { return "..." + t.elem.String() } + +// parent is the package which declared the type; parent == nil means +// the package currently imported. The parent package is needed for +// exported struct fields and interface methods which don't contain +// explicit package information in the export data. +// +// A non-nil tname is used as the "owner" of the result type; i.e., +// the result type is the underlying type of tname. tname is used +// to give interface methods a named receiver type where possible. +func (p *importer) typ(parent *types.Package, tname *types.Named) types.Type { +	// if the type was seen before, i is its index (>= 0) +	i := p.tagOrIndex() +	if i >= 0 { +		return p.typList[i] +	} + +	// otherwise, i is the type tag (< 0) +	switch i { +	case namedTag: +		// read type object +		pos := p.pos() +		parent, name := p.qualifiedName() +		scope := parent.Scope() +		obj := scope.Lookup(name) + +		// if the object doesn't exist yet, create and insert it +		if obj == nil { +			obj = types.NewTypeName(pos, parent, name, nil) +			scope.Insert(obj) +		} + +		if _, ok := obj.(*types.TypeName); !ok { +			errorf("pkg = %s, name = %s => %s", parent, name, obj) +		} + +		// associate new named type with obj if it doesn't exist yet +		t0 := types.NewNamed(obj.(*types.TypeName), nil, nil) + +		// but record the existing type, if any +		tname := obj.Type().(*types.Named) // tname is either t0 or the existing type +		p.record(tname) + +		// read underlying type +		t0.SetUnderlying(p.typ(parent, t0)) + +		// interfaces don't have associated methods +		if types.IsInterface(t0) { +			return tname +		} + +		// read associated methods +		for i := p.int(); i > 0; i-- { +			// TODO(gri) replace this with something closer to fieldName +			pos := p.pos() +			name := p.string() +			if !exported(name) { +				p.pkg() +			} + +			recv, _ := p.paramList() // TODO(gri) do we need a full param list for the receiver? +			params, isddd := p.paramList() +			result, _ := p.paramList() +			p.int() // go:nointerface pragma - discarded + +			sig := types.NewSignature(recv.At(0), params, result, isddd) +			t0.AddMethod(types.NewFunc(pos, parent, name, sig)) +		} + +		return tname + +	case arrayTag: +		t := new(types.Array) +		if p.trackAllTypes { +			p.record(t) +		} + +		n := p.int64() +		*t = *types.NewArray(p.typ(parent, nil), n) +		return t + +	case sliceTag: +		t := new(types.Slice) +		if p.trackAllTypes { +			p.record(t) +		} + +		*t = *types.NewSlice(p.typ(parent, nil)) +		return t + +	case dddTag: +		t := new(dddSlice) +		if p.trackAllTypes { +			p.record(t) +		} + +		t.elem = p.typ(parent, nil) +		return t + +	case structTag: +		t := new(types.Struct) +		if p.trackAllTypes { +			p.record(t) +		} + +		*t = *types.NewStruct(p.fieldList(parent)) +		return t + +	case pointerTag: +		t := new(types.Pointer) +		if p.trackAllTypes { +			p.record(t) +		} + +		*t = *types.NewPointer(p.typ(parent, nil)) +		return t + +	case signatureTag: +		t := new(types.Signature) +		if p.trackAllTypes { +			p.record(t) +		} + +		params, isddd := p.paramList() +		result, _ := p.paramList() +		*t = *types.NewSignature(nil, params, result, isddd) +		return t + +	case interfaceTag: +		// Create a dummy entry in the type list. This is safe because we +		// cannot expect the interface type to appear in a cycle, as any +		// such cycle must contain a named type which would have been +		// first defined earlier. +		// TODO(gri) Is this still true now that we have type aliases? +		// See issue #23225. +		n := len(p.typList) +		if p.trackAllTypes { +			p.record(nil) +		} + +		var embeddeds []types.Type +		for n := p.int(); n > 0; n-- { +			p.pos() +			embeddeds = append(embeddeds, p.typ(parent, nil)) +		} + +		t := newInterface(p.methodList(parent, tname), embeddeds) +		p.interfaceList = append(p.interfaceList, t) +		if p.trackAllTypes { +			p.typList[n] = t +		} +		return t + +	case mapTag: +		t := new(types.Map) +		if p.trackAllTypes { +			p.record(t) +		} + +		key := p.typ(parent, nil) +		val := p.typ(parent, nil) +		*t = *types.NewMap(key, val) +		return t + +	case chanTag: +		t := new(types.Chan) +		if p.trackAllTypes { +			p.record(t) +		} + +		dir := chanDir(p.int()) +		val := p.typ(parent, nil) +		*t = *types.NewChan(dir, val) +		return t + +	default: +		errorf("unexpected type tag %d", i) // panics +		panic("unreachable") +	} +} + +func chanDir(d int) types.ChanDir { +	// tag values must match the constants in cmd/compile/internal/gc/go.go +	switch d { +	case 1 /* Crecv */ : +		return types.RecvOnly +	case 2 /* Csend */ : +		return types.SendOnly +	case 3 /* Cboth */ : +		return types.SendRecv +	default: +		errorf("unexpected channel dir %d", d) +		return 0 +	} +} + +func (p *importer) fieldList(parent *types.Package) (fields []*types.Var, tags []string) { +	if n := p.int(); n > 0 { +		fields = make([]*types.Var, n) +		tags = make([]string, n) +		for i := range fields { +			fields[i], tags[i] = p.field(parent) +		} +	} +	return +} + +func (p *importer) field(parent *types.Package) (*types.Var, string) { +	pos := p.pos() +	pkg, name, alias := p.fieldName(parent) +	typ := p.typ(parent, nil) +	tag := p.string() + +	anonymous := false +	if name == "" { +		// anonymous field - typ must be T or *T and T must be a type name +		switch typ := deref(typ).(type) { +		case *types.Basic: // basic types are named types +			pkg = nil // // objects defined in Universe scope have no package +			name = typ.Name() +		case *types.Named: +			name = typ.Obj().Name() +		default: +			errorf("named base type expected") +		} +		anonymous = true +	} else if alias { +		// anonymous field: we have an explicit name because it's an alias +		anonymous = true +	} + +	return types.NewField(pos, pkg, name, typ, anonymous), tag +} + +func (p *importer) methodList(parent *types.Package, baseType *types.Named) (methods []*types.Func) { +	if n := p.int(); n > 0 { +		methods = make([]*types.Func, n) +		for i := range methods { +			methods[i] = p.method(parent, baseType) +		} +	} +	return +} + +func (p *importer) method(parent *types.Package, baseType *types.Named) *types.Func { +	pos := p.pos() +	pkg, name, _ := p.fieldName(parent) +	// If we don't have a baseType, use a nil receiver. +	// A receiver using the actual interface type (which +	// we don't know yet) will be filled in when we call +	// types.Interface.Complete. +	var recv *types.Var +	if baseType != nil { +		recv = types.NewVar(token.NoPos, parent, "", baseType) +	} +	params, isddd := p.paramList() +	result, _ := p.paramList() +	sig := types.NewSignature(recv, params, result, isddd) +	return types.NewFunc(pos, pkg, name, sig) +} + +func (p *importer) fieldName(parent *types.Package) (pkg *types.Package, name string, alias bool) { +	name = p.string() +	pkg = parent +	if pkg == nil { +		// use the imported package instead +		pkg = p.pkgList[0] +	} +	if p.version == 0 && name == "_" { +		// version 0 didn't export a package for _ fields +		return +	} +	switch name { +	case "": +		// 1) field name matches base type name and is exported: nothing to do +	case "?": +		// 2) field name matches base type name and is not exported: need package +		name = "" +		pkg = p.pkg() +	case "@": +		// 3) field name doesn't match type name (alias) +		name = p.string() +		alias = true +		fallthrough +	default: +		if !exported(name) { +			pkg = p.pkg() +		} +	} +	return +} + +func (p *importer) paramList() (*types.Tuple, bool) { +	n := p.int() +	if n == 0 { +		return nil, false +	} +	// negative length indicates unnamed parameters +	named := true +	if n < 0 { +		n = -n +		named = false +	} +	// n > 0 +	params := make([]*types.Var, n) +	isddd := false +	for i := range params { +		params[i], isddd = p.param(named) +	} +	return types.NewTuple(params...), isddd +} + +func (p *importer) param(named bool) (*types.Var, bool) { +	t := p.typ(nil, nil) +	td, isddd := t.(*dddSlice) +	if isddd { +		t = types.NewSlice(td.elem) +	} + +	var pkg *types.Package +	var name string +	if named { +		name = p.string() +		if name == "" { +			errorf("expected named parameter") +		} +		if name != "_" { +			pkg = p.pkg() +		} +		if i := strings.Index(name, "·"); i > 0 { +			name = name[:i] // cut off gc-specific parameter numbering +		} +	} + +	// read and discard compiler-specific info +	p.string() + +	return types.NewVar(token.NoPos, pkg, name, t), isddd +} + +func exported(name string) bool { +	ch, _ := utf8.DecodeRuneInString(name) +	return unicode.IsUpper(ch) +} + +func (p *importer) value() constant.Value { +	switch tag := p.tagOrIndex(); tag { +	case falseTag: +		return constant.MakeBool(false) +	case trueTag: +		return constant.MakeBool(true) +	case int64Tag: +		return constant.MakeInt64(p.int64()) +	case floatTag: +		return p.float() +	case complexTag: +		re := p.float() +		im := p.float() +		return constant.BinaryOp(re, token.ADD, constant.MakeImag(im)) +	case stringTag: +		return constant.MakeString(p.string()) +	case unknownTag: +		return constant.MakeUnknown() +	default: +		errorf("unexpected value tag %d", tag) // panics +		panic("unreachable") +	} +} + +func (p *importer) float() constant.Value { +	sign := p.int() +	if sign == 0 { +		return constant.MakeInt64(0) +	} + +	exp := p.int() +	mant := []byte(p.string()) // big endian + +	// remove leading 0's if any +	for len(mant) > 0 && mant[0] == 0 { +		mant = mant[1:] +	} + +	// convert to little endian +	// TODO(gri) go/constant should have a more direct conversion function +	//           (e.g., once it supports a big.Float based implementation) +	for i, j := 0, len(mant)-1; i < j; i, j = i+1, j-1 { +		mant[i], mant[j] = mant[j], mant[i] +	} + +	// adjust exponent (constant.MakeFromBytes creates an integer value, +	// but mant represents the mantissa bits such that 0.5 <= mant < 1.0) +	exp -= len(mant) << 3 +	if len(mant) > 0 { +		for msd := mant[len(mant)-1]; msd&0x80 == 0; msd <<= 1 { +			exp++ +		} +	} + +	x := constant.MakeFromBytes(mant) +	switch { +	case exp < 0: +		d := constant.Shift(constant.MakeInt64(1), token.SHL, uint(-exp)) +		x = constant.BinaryOp(x, token.QUO, d) +	case exp > 0: +		x = constant.Shift(x, token.SHL, uint(exp)) +	} + +	if sign < 0 { +		x = constant.UnaryOp(token.SUB, x, 0) +	} +	return x +} + +// ---------------------------------------------------------------------------- +// Low-level decoders + +func (p *importer) tagOrIndex() int { +	if p.debugFormat { +		p.marker('t') +	} + +	return int(p.rawInt64()) +} + +func (p *importer) int() int { +	x := p.int64() +	if int64(int(x)) != x { +		errorf("exported integer too large") +	} +	return int(x) +} + +func (p *importer) int64() int64 { +	if p.debugFormat { +		p.marker('i') +	} + +	return p.rawInt64() +} + +func (p *importer) path() string { +	if p.debugFormat { +		p.marker('p') +	} +	// if the path was seen before, i is its index (>= 0) +	// (the empty string is at index 0) +	i := p.rawInt64() +	if i >= 0 { +		return p.pathList[i] +	} +	// otherwise, i is the negative path length (< 0) +	a := make([]string, -i) +	for n := range a { +		a[n] = p.string() +	} +	s := strings.Join(a, "/") +	p.pathList = append(p.pathList, s) +	return s +} + +func (p *importer) string() string { +	if p.debugFormat { +		p.marker('s') +	} +	// if the string was seen before, i is its index (>= 0) +	// (the empty string is at index 0) +	i := p.rawInt64() +	if i >= 0 { +		return p.strList[i] +	} +	// otherwise, i is the negative string length (< 0) +	if n := int(-i); n <= cap(p.buf) { +		p.buf = p.buf[:n] +	} else { +		p.buf = make([]byte, n) +	} +	for i := range p.buf { +		p.buf[i] = p.rawByte() +	} +	s := string(p.buf) +	p.strList = append(p.strList, s) +	return s +} + +func (p *importer) marker(want byte) { +	if got := p.rawByte(); got != want { +		errorf("incorrect marker: got %c; want %c (pos = %d)", got, want, p.read) +	} + +	pos := p.read +	if n := int(p.rawInt64()); n != pos { +		errorf("incorrect position: got %d; want %d", n, pos) +	} +} + +// rawInt64 should only be used by low-level decoders. +func (p *importer) rawInt64() int64 { +	i, err := binary.ReadVarint(p) +	if err != nil { +		errorf("read error: %v", err) +	} +	return i +} + +// rawStringln should only be used to read the initial version string. +func (p *importer) rawStringln(b byte) string { +	p.buf = p.buf[:0] +	for b != '\n' { +		p.buf = append(p.buf, b) +		b = p.rawByte() +	} +	return string(p.buf) +} + +// needed for binary.ReadVarint in rawInt64 +func (p *importer) ReadByte() (byte, error) { +	return p.rawByte(), nil +} + +// byte is the bottleneck interface for reading p.data. +// It unescapes '|' 'S' to '$' and '|' '|' to '|'. +// rawByte should only be used by low-level decoders. +func (p *importer) rawByte() byte { +	b := p.data[0] +	r := 1 +	if b == '|' { +		b = p.data[1] +		r = 2 +		switch b { +		case 'S': +			b = '$' +		case '|': +			// nothing to do +		default: +			errorf("unexpected escape sequence in export data") +		} +	} +	p.data = p.data[r:] +	p.read += r +	return b + +} + +// ---------------------------------------------------------------------------- +// Export format + +// Tags. Must be < 0. +const ( +	// Objects +	packageTag = -(iota + 1) +	constTag +	typeTag +	varTag +	funcTag +	endTag + +	// Types +	namedTag +	arrayTag +	sliceTag +	dddTag +	structTag +	pointerTag +	signatureTag +	interfaceTag +	mapTag +	chanTag + +	// Values +	falseTag +	trueTag +	int64Tag +	floatTag +	fractionTag // not used by gc +	complexTag +	stringTag +	nilTag     // only used by gc (appears in exported inlined function bodies) +	unknownTag // not used by gc (only appears in packages with errors) + +	// Type aliases +	aliasTag +) + +var predeclOnce sync.Once +var predecl []types.Type // initialized lazily + +func predeclared() []types.Type { +	predeclOnce.Do(func() { +		// initialize lazily to be sure that all +		// elements have been initialized before +		predecl = []types.Type{ // basic types +			types.Typ[types.Bool], +			types.Typ[types.Int], +			types.Typ[types.Int8], +			types.Typ[types.Int16], +			types.Typ[types.Int32], +			types.Typ[types.Int64], +			types.Typ[types.Uint], +			types.Typ[types.Uint8], +			types.Typ[types.Uint16], +			types.Typ[types.Uint32], +			types.Typ[types.Uint64], +			types.Typ[types.Uintptr], +			types.Typ[types.Float32], +			types.Typ[types.Float64], +			types.Typ[types.Complex64], +			types.Typ[types.Complex128], +			types.Typ[types.String], + +			// basic type aliases +			types.Universe.Lookup("byte").Type(), +			types.Universe.Lookup("rune").Type(), + +			// error +			types.Universe.Lookup("error").Type(), + +			// untyped types +			types.Typ[types.UntypedBool], +			types.Typ[types.UntypedInt], +			types.Typ[types.UntypedRune], +			types.Typ[types.UntypedFloat], +			types.Typ[types.UntypedComplex], +			types.Typ[types.UntypedString], +			types.Typ[types.UntypedNil], + +			// package unsafe +			types.Typ[types.UnsafePointer], + +			// invalid type +			types.Typ[types.Invalid], // only appears in packages with errors + +			// used internally by gc; never used by this package or in .a files +			anyType{}, +		} +	}) +	return predecl +} + +type anyType struct{} + +func (t anyType) Underlying() types.Type { return t } +func (t anyType) String() string         { return "any" } diff --git a/vendor/golang.org/x/tools/go/internal/gcimporter/exportdata.go b/vendor/golang.org/x/tools/go/internal/gcimporter/exportdata.go new file mode 100644 index 000000000..f33dc5613 --- /dev/null +++ b/vendor/golang.org/x/tools/go/internal/gcimporter/exportdata.go @@ -0,0 +1,93 @@ +// 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. + +// This file is a copy of $GOROOT/src/go/internal/gcimporter/exportdata.go. + +// This file implements FindExportData. + +package gcimporter + +import ( +	"bufio" +	"fmt" +	"io" +	"strconv" +	"strings" +) + +func readGopackHeader(r *bufio.Reader) (name string, size int, err error) { +	// See $GOROOT/include/ar.h. +	hdr := make([]byte, 16+12+6+6+8+10+2) +	_, err = io.ReadFull(r, hdr) +	if err != nil { +		return +	} +	// leave for debugging +	if false { +		fmt.Printf("header: %s", hdr) +	} +	s := strings.TrimSpace(string(hdr[16+12+6+6+8:][:10])) +	size, err = strconv.Atoi(s) +	if err != nil || hdr[len(hdr)-2] != '`' || hdr[len(hdr)-1] != '\n' { +		err = fmt.Errorf("invalid archive header") +		return +	} +	name = strings.TrimSpace(string(hdr[:16])) +	return +} + +// FindExportData positions the reader r at the beginning of the +// export data section of an underlying GC-created object/archive +// file by reading from it. The reader must be positioned at the +// start of the file before calling this function. The hdr result +// is the string before the export data, either "$$" or "$$B". +// +func FindExportData(r *bufio.Reader) (hdr string, err error) { +	// Read first line to make sure this is an object file. +	line, err := r.ReadSlice('\n') +	if err != nil { +		err = fmt.Errorf("can't find export data (%v)", err) +		return +	} + +	if string(line) == "!<arch>\n" { +		// Archive file. Scan to __.PKGDEF. +		var name string +		if name, _, err = readGopackHeader(r); err != nil { +			return +		} + +		// First entry should be __.PKGDEF. +		if name != "__.PKGDEF" { +			err = fmt.Errorf("go archive is missing __.PKGDEF") +			return +		} + +		// Read first line of __.PKGDEF data, so that line +		// is once again the first line of the input. +		if line, err = r.ReadSlice('\n'); err != nil { +			err = fmt.Errorf("can't find export data (%v)", err) +			return +		} +	} + +	// Now at __.PKGDEF in archive or still at beginning of file. +	// Either way, line should begin with "go object ". +	if !strings.HasPrefix(string(line), "go object ") { +		err = fmt.Errorf("not a Go object file") +		return +	} + +	// Skip over object header to export data. +	// Begins after first line starting with $$. +	for line[0] != '$' { +		if line, err = r.ReadSlice('\n'); err != nil { +			err = fmt.Errorf("can't find export data (%v)", err) +			return +		} +	} +	hdr = string(line) + +	return +} diff --git a/vendor/golang.org/x/tools/go/internal/gcimporter/gcimporter.go b/vendor/golang.org/x/tools/go/internal/gcimporter/gcimporter.go new file mode 100644 index 000000000..e8cba6b23 --- /dev/null +++ b/vendor/golang.org/x/tools/go/internal/gcimporter/gcimporter.go @@ -0,0 +1,1078 @@ +// 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. + +// This file is a modified copy of $GOROOT/src/go/internal/gcimporter/gcimporter.go, +// but it also contains the original source-based importer code for Go1.6. +// Once we stop supporting 1.6, we can remove that code. + +// Package gcimporter provides various functions for reading +// gc-generated object files that can be used to implement the +// Importer interface defined by the Go 1.5 standard library package. +package gcimporter // import "golang.org/x/tools/go/internal/gcimporter" + +import ( +	"bufio" +	"errors" +	"fmt" +	"go/build" +	"go/constant" +	"go/token" +	"go/types" +	"io" +	"io/ioutil" +	"os" +	"path/filepath" +	"sort" +	"strconv" +	"strings" +	"text/scanner" +) + +// debugging/development support +const debug = false + +var pkgExts = [...]string{".a", ".o"} + +// FindPkg returns the filename and unique package id for an import +// path based on package information provided by build.Import (using +// the build.Default build.Context). A relative srcDir is interpreted +// relative to the current working directory. +// If no file was found, an empty filename is returned. +// +func FindPkg(path, srcDir string) (filename, id string) { +	if path == "" { +		return +	} + +	var noext string +	switch { +	default: +		// "x" -> "$GOPATH/pkg/$GOOS_$GOARCH/x.ext", "x" +		// Don't require the source files to be present. +		if abs, err := filepath.Abs(srcDir); err == nil { // see issue 14282 +			srcDir = abs +		} +		bp, _ := build.Import(path, srcDir, build.FindOnly|build.AllowBinary) +		if bp.PkgObj == "" { +			id = path // make sure we have an id to print in error message +			return +		} +		noext = strings.TrimSuffix(bp.PkgObj, ".a") +		id = bp.ImportPath + +	case build.IsLocalImport(path): +		// "./x" -> "/this/directory/x.ext", "/this/directory/x" +		noext = filepath.Join(srcDir, path) +		id = noext + +	case filepath.IsAbs(path): +		// for completeness only - go/build.Import +		// does not support absolute imports +		// "/x" -> "/x.ext", "/x" +		noext = path +		id = path +	} + +	if false { // for debugging +		if path != id { +			fmt.Printf("%s -> %s\n", path, id) +		} +	} + +	// try extensions +	for _, ext := range pkgExts { +		filename = noext + ext +		if f, err := os.Stat(filename); err == nil && !f.IsDir() { +			return +		} +	} + +	filename = "" // not found +	return +} + +// ImportData imports a package by reading the gc-generated export data, +// adds the corresponding package object to the packages map indexed by id, +// and returns the object. +// +// The packages map must contains all packages already imported. The data +// reader position must be the beginning of the export data section. The +// filename is only used in error messages. +// +// If packages[id] contains the completely imported package, that package +// can be used directly, and there is no need to call this function (but +// there is also no harm but for extra time used). +// +func ImportData(packages map[string]*types.Package, filename, id string, data io.Reader) (pkg *types.Package, err error) { +	// support for parser error handling +	defer func() { +		switch r := recover().(type) { +		case nil: +			// nothing to do +		case importError: +			err = r +		default: +			panic(r) // internal error +		} +	}() + +	var p parser +	p.init(filename, id, data, packages) +	pkg = p.parseExport() + +	return +} + +// Import imports a gc-generated package given its import path and srcDir, adds +// the corresponding package object to the packages map, and returns the object. +// The packages map must contain all packages already imported. +// +func Import(packages map[string]*types.Package, path, srcDir string, lookup func(path string) (io.ReadCloser, error)) (pkg *types.Package, err error) { +	var rc io.ReadCloser +	var filename, id string +	if lookup != nil { +		// With custom lookup specified, assume that caller has +		// converted path to a canonical import path for use in the map. +		if path == "unsafe" { +			return types.Unsafe, nil +		} +		id = path + +		// No need to re-import if the package was imported completely before. +		if pkg = packages[id]; pkg != nil && pkg.Complete() { +			return +		} +		f, err := lookup(path) +		if err != nil { +			return nil, err +		} +		rc = f +	} else { +		filename, id = FindPkg(path, srcDir) +		if filename == "" { +			if path == "unsafe" { +				return types.Unsafe, nil +			} +			return nil, fmt.Errorf("can't find import: %q", id) +		} + +		// no need to re-import if the package was imported completely before +		if pkg = packages[id]; pkg != nil && pkg.Complete() { +			return +		} + +		// open file +		f, err := os.Open(filename) +		if err != nil { +			return nil, err +		} +		defer func() { +			if err != nil { +				// add file name to error +				err = fmt.Errorf("%s: %v", filename, err) +			} +		}() +		rc = f +	} +	defer rc.Close() + +	var hdr string +	buf := bufio.NewReader(rc) +	if hdr, err = FindExportData(buf); err != nil { +		return +	} + +	switch hdr { +	case "$$\n": +		// Work-around if we don't have a filename; happens only if lookup != nil. +		// Either way, the filename is only needed for importer error messages, so +		// this is fine. +		if filename == "" { +			filename = path +		} +		return ImportData(packages, filename, id, buf) + +	case "$$B\n": +		var data []byte +		data, err = ioutil.ReadAll(buf) +		if err != nil { +			break +		} + +		// TODO(gri): allow clients of go/importer to provide a FileSet. +		// Or, define a new standard go/types/gcexportdata package. +		fset := token.NewFileSet() + +		// The indexed export format starts with an 'i'; the older +		// binary export format starts with a 'c', 'd', or 'v' +		// (from "version"). Select appropriate importer. +		if len(data) > 0 && data[0] == 'i' { +			_, pkg, err = IImportData(fset, packages, data[1:], id) +		} else { +			_, pkg, err = BImportData(fset, packages, data, id) +		} + +	default: +		err = fmt.Errorf("unknown export data header: %q", hdr) +	} + +	return +} + +// ---------------------------------------------------------------------------- +// Parser + +// TODO(gri) Imported objects don't have position information. +//           Ideally use the debug table line info; alternatively +//           create some fake position (or the position of the +//           import). That way error messages referring to imported +//           objects can print meaningful information. + +// parser parses the exports inside a gc compiler-produced +// object/archive file and populates its scope with the results. +type parser struct { +	scanner    scanner.Scanner +	tok        rune                      // current token +	lit        string                    // literal string; only valid for Ident, Int, String tokens +	id         string                    // package id of imported package +	sharedPkgs map[string]*types.Package // package id -> package object (across importer) +	localPkgs  map[string]*types.Package // package id -> package object (just this package) +} + +func (p *parser) init(filename, id string, src io.Reader, packages map[string]*types.Package) { +	p.scanner.Init(src) +	p.scanner.Error = func(_ *scanner.Scanner, msg string) { p.error(msg) } +	p.scanner.Mode = scanner.ScanIdents | scanner.ScanInts | scanner.ScanChars | scanner.ScanStrings | scanner.ScanComments | scanner.SkipComments +	p.scanner.Whitespace = 1<<'\t' | 1<<' ' +	p.scanner.Filename = filename // for good error messages +	p.next() +	p.id = id +	p.sharedPkgs = packages +	if debug { +		// check consistency of packages map +		for _, pkg := range packages { +			if pkg.Name() == "" { +				fmt.Printf("no package name for %s\n", pkg.Path()) +			} +		} +	} +} + +func (p *parser) next() { +	p.tok = p.scanner.Scan() +	switch p.tok { +	case scanner.Ident, scanner.Int, scanner.Char, scanner.String, '·': +		p.lit = p.scanner.TokenText() +	default: +		p.lit = "" +	} +	if debug { +		fmt.Printf("%s: %q -> %q\n", scanner.TokenString(p.tok), p.scanner.TokenText(), p.lit) +	} +} + +func declTypeName(pkg *types.Package, name string) *types.TypeName { +	scope := pkg.Scope() +	if obj := scope.Lookup(name); obj != nil { +		return obj.(*types.TypeName) +	} +	obj := types.NewTypeName(token.NoPos, pkg, name, nil) +	// a named type may be referred to before the underlying type +	// is known - set it up +	types.NewNamed(obj, nil, nil) +	scope.Insert(obj) +	return obj +} + +// ---------------------------------------------------------------------------- +// Error handling + +// Internal errors are boxed as importErrors. +type importError struct { +	pos scanner.Position +	err error +} + +func (e importError) Error() string { +	return fmt.Sprintf("import error %s (byte offset = %d): %s", e.pos, e.pos.Offset, e.err) +} + +func (p *parser) error(err interface{}) { +	if s, ok := err.(string); ok { +		err = errors.New(s) +	} +	// panic with a runtime.Error if err is not an error +	panic(importError{p.scanner.Pos(), err.(error)}) +} + +func (p *parser) errorf(format string, args ...interface{}) { +	p.error(fmt.Sprintf(format, args...)) +} + +func (p *parser) expect(tok rune) string { +	lit := p.lit +	if p.tok != tok { +		p.errorf("expected %s, got %s (%s)", scanner.TokenString(tok), scanner.TokenString(p.tok), lit) +	} +	p.next() +	return lit +} + +func (p *parser) expectSpecial(tok string) { +	sep := 'x' // not white space +	i := 0 +	for i < len(tok) && p.tok == rune(tok[i]) && sep > ' ' { +		sep = p.scanner.Peek() // if sep <= ' ', there is white space before the next token +		p.next() +		i++ +	} +	if i < len(tok) { +		p.errorf("expected %q, got %q", tok, tok[0:i]) +	} +} + +func (p *parser) expectKeyword(keyword string) { +	lit := p.expect(scanner.Ident) +	if lit != keyword { +		p.errorf("expected keyword %s, got %q", keyword, lit) +	} +} + +// ---------------------------------------------------------------------------- +// Qualified and unqualified names + +// PackageId = string_lit . +// +func (p *parser) parsePackageID() string { +	id, err := strconv.Unquote(p.expect(scanner.String)) +	if err != nil { +		p.error(err) +	} +	// id == "" stands for the imported package id +	// (only known at time of package installation) +	if id == "" { +		id = p.id +	} +	return id +} + +// PackageName = ident . +// +func (p *parser) parsePackageName() string { +	return p.expect(scanner.Ident) +} + +// dotIdentifier = ( ident | '·' ) { ident | int | '·' } . +func (p *parser) parseDotIdent() string { +	ident := "" +	if p.tok != scanner.Int { +		sep := 'x' // not white space +		for (p.tok == scanner.Ident || p.tok == scanner.Int || p.tok == '·') && sep > ' ' { +			ident += p.lit +			sep = p.scanner.Peek() // if sep <= ' ', there is white space before the next token +			p.next() +		} +	} +	if ident == "" { +		p.expect(scanner.Ident) // use expect() for error handling +	} +	return ident +} + +// QualifiedName = "@" PackageId "." ( "?" | dotIdentifier ) . +// +func (p *parser) parseQualifiedName() (id, name string) { +	p.expect('@') +	id = p.parsePackageID() +	p.expect('.') +	// Per rev f280b8a485fd (10/2/2013), qualified names may be used for anonymous fields. +	if p.tok == '?' { +		p.next() +	} else { +		name = p.parseDotIdent() +	} +	return +} + +// getPkg returns the package for a given id. If the package is +// not found, create the package and add it to the p.localPkgs +// and p.sharedPkgs maps. name is the (expected) name of the +// package. If name == "", the package name is expected to be +// set later via an import clause in the export data. +// +// id identifies a package, usually by a canonical package path like +// "encoding/json" but possibly by a non-canonical import path like +// "./json". +// +func (p *parser) getPkg(id, name string) *types.Package { +	// package unsafe is not in the packages maps - handle explicitly +	if id == "unsafe" { +		return types.Unsafe +	} + +	pkg := p.localPkgs[id] +	if pkg == nil { +		// first import of id from this package +		pkg = p.sharedPkgs[id] +		if pkg == nil { +			// first import of id by this importer; +			// add (possibly unnamed) pkg to shared packages +			pkg = types.NewPackage(id, name) +			p.sharedPkgs[id] = pkg +		} +		// add (possibly unnamed) pkg to local packages +		if p.localPkgs == nil { +			p.localPkgs = make(map[string]*types.Package) +		} +		p.localPkgs[id] = pkg +	} else if name != "" { +		// package exists already and we have an expected package name; +		// make sure names match or set package name if necessary +		if pname := pkg.Name(); pname == "" { +			pkg.SetName(name) +		} else if pname != name { +			p.errorf("%s package name mismatch: %s (given) vs %s (expected)", id, pname, name) +		} +	} +	return pkg +} + +// parseExportedName is like parseQualifiedName, but +// the package id is resolved to an imported *types.Package. +// +func (p *parser) parseExportedName() (pkg *types.Package, name string) { +	id, name := p.parseQualifiedName() +	pkg = p.getPkg(id, "") +	return +} + +// ---------------------------------------------------------------------------- +// Types + +// BasicType = identifier . +// +func (p *parser) parseBasicType() types.Type { +	id := p.expect(scanner.Ident) +	obj := types.Universe.Lookup(id) +	if obj, ok := obj.(*types.TypeName); ok { +		return obj.Type() +	} +	p.errorf("not a basic type: %s", id) +	return nil +} + +// ArrayType = "[" int_lit "]" Type . +// +func (p *parser) parseArrayType(parent *types.Package) types.Type { +	// "[" already consumed and lookahead known not to be "]" +	lit := p.expect(scanner.Int) +	p.expect(']') +	elem := p.parseType(parent) +	n, err := strconv.ParseInt(lit, 10, 64) +	if err != nil { +		p.error(err) +	} +	return types.NewArray(elem, n) +} + +// MapType = "map" "[" Type "]" Type . +// +func (p *parser) parseMapType(parent *types.Package) types.Type { +	p.expectKeyword("map") +	p.expect('[') +	key := p.parseType(parent) +	p.expect(']') +	elem := p.parseType(parent) +	return types.NewMap(key, elem) +} + +// Name = identifier | "?" | QualifiedName . +// +// For unqualified and anonymous names, the returned package is the parent +// package unless parent == nil, in which case the returned package is the +// package being imported. (The parent package is not nil if the name +// is an unqualified struct field or interface method name belonging to a +// type declared in another package.) +// +// For qualified names, the returned package is nil (and not created if +// it doesn't exist yet) unless materializePkg is set (which creates an +// unnamed package with valid package path). In the latter case, a +// subsequent import clause is expected to provide a name for the package. +// +func (p *parser) parseName(parent *types.Package, materializePkg bool) (pkg *types.Package, name string) { +	pkg = parent +	if pkg == nil { +		pkg = p.sharedPkgs[p.id] +	} +	switch p.tok { +	case scanner.Ident: +		name = p.lit +		p.next() +	case '?': +		// anonymous +		p.next() +	case '@': +		// exported name prefixed with package path +		pkg = nil +		var id string +		id, name = p.parseQualifiedName() +		if materializePkg { +			pkg = p.getPkg(id, "") +		} +	default: +		p.error("name expected") +	} +	return +} + +func deref(typ types.Type) types.Type { +	if p, _ := typ.(*types.Pointer); p != nil { +		return p.Elem() +	} +	return typ +} + +// Field = Name Type [ string_lit ] . +// +func (p *parser) parseField(parent *types.Package) (*types.Var, string) { +	pkg, name := p.parseName(parent, true) + +	if name == "_" { +		// Blank fields should be package-qualified because they +		// are unexported identifiers, but gc does not qualify them. +		// Assuming that the ident belongs to the current package +		// causes types to change during re-exporting, leading +		// to spurious "can't assign A to B" errors from go/types. +		// As a workaround, pretend all blank fields belong +		// to the same unique dummy package. +		const blankpkg = "<_>" +		pkg = p.getPkg(blankpkg, blankpkg) +	} + +	typ := p.parseType(parent) +	anonymous := false +	if name == "" { +		// anonymous field - typ must be T or *T and T must be a type name +		switch typ := deref(typ).(type) { +		case *types.Basic: // basic types are named types +			pkg = nil // objects defined in Universe scope have no package +			name = typ.Name() +		case *types.Named: +			name = typ.Obj().Name() +		default: +			p.errorf("anonymous field expected") +		} +		anonymous = true +	} +	tag := "" +	if p.tok == scanner.String { +		s := p.expect(scanner.String) +		var err error +		tag, err = strconv.Unquote(s) +		if err != nil { +			p.errorf("invalid struct tag %s: %s", s, err) +		} +	} +	return types.NewField(token.NoPos, pkg, name, typ, anonymous), tag +} + +// StructType = "struct" "{" [ FieldList ] "}" . +// FieldList  = Field { ";" Field } . +// +func (p *parser) parseStructType(parent *types.Package) types.Type { +	var fields []*types.Var +	var tags []string + +	p.expectKeyword("struct") +	p.expect('{') +	for i := 0; p.tok != '}' && p.tok != scanner.EOF; i++ { +		if i > 0 { +			p.expect(';') +		} +		fld, tag := p.parseField(parent) +		if tag != "" && tags == nil { +			tags = make([]string, i) +		} +		if tags != nil { +			tags = append(tags, tag) +		} +		fields = append(fields, fld) +	} +	p.expect('}') + +	return types.NewStruct(fields, tags) +} + +// Parameter = ( identifier | "?" ) [ "..." ] Type [ string_lit ] . +// +func (p *parser) parseParameter() (par *types.Var, isVariadic bool) { +	_, name := p.parseName(nil, false) +	// remove gc-specific parameter numbering +	if i := strings.Index(name, "·"); i >= 0 { +		name = name[:i] +	} +	if p.tok == '.' { +		p.expectSpecial("...") +		isVariadic = true +	} +	typ := p.parseType(nil) +	if isVariadic { +		typ = types.NewSlice(typ) +	} +	// ignore argument tag (e.g. "noescape") +	if p.tok == scanner.String { +		p.next() +	} +	// TODO(gri) should we provide a package? +	par = types.NewVar(token.NoPos, nil, name, typ) +	return +} + +// Parameters    = "(" [ ParameterList ] ")" . +// ParameterList = { Parameter "," } Parameter . +// +func (p *parser) parseParameters() (list []*types.Var, isVariadic bool) { +	p.expect('(') +	for p.tok != ')' && p.tok != scanner.EOF { +		if len(list) > 0 { +			p.expect(',') +		} +		par, variadic := p.parseParameter() +		list = append(list, par) +		if variadic { +			if isVariadic { +				p.error("... not on final argument") +			} +			isVariadic = true +		} +	} +	p.expect(')') + +	return +} + +// Signature = Parameters [ Result ] . +// Result    = Type | Parameters . +// +func (p *parser) parseSignature(recv *types.Var) *types.Signature { +	params, isVariadic := p.parseParameters() + +	// optional result type +	var results []*types.Var +	if p.tok == '(' { +		var variadic bool +		results, variadic = p.parseParameters() +		if variadic { +			p.error("... not permitted on result type") +		} +	} + +	return types.NewSignature(recv, types.NewTuple(params...), types.NewTuple(results...), isVariadic) +} + +// InterfaceType = "interface" "{" [ MethodList ] "}" . +// MethodList    = Method { ";" Method } . +// Method        = Name Signature . +// +// The methods of embedded interfaces are always "inlined" +// by the compiler and thus embedded interfaces are never +// visible in the export data. +// +func (p *parser) parseInterfaceType(parent *types.Package) types.Type { +	var methods []*types.Func + +	p.expectKeyword("interface") +	p.expect('{') +	for i := 0; p.tok != '}' && p.tok != scanner.EOF; i++ { +		if i > 0 { +			p.expect(';') +		} +		pkg, name := p.parseName(parent, true) +		sig := p.parseSignature(nil) +		methods = append(methods, types.NewFunc(token.NoPos, pkg, name, sig)) +	} +	p.expect('}') + +	// Complete requires the type's embedded interfaces to be fully defined, +	// but we do not define any +	return newInterface(methods, nil).Complete() +} + +// ChanType = ( "chan" [ "<-" ] | "<-" "chan" ) Type . +// +func (p *parser) parseChanType(parent *types.Package) types.Type { +	dir := types.SendRecv +	if p.tok == scanner.Ident { +		p.expectKeyword("chan") +		if p.tok == '<' { +			p.expectSpecial("<-") +			dir = types.SendOnly +		} +	} else { +		p.expectSpecial("<-") +		p.expectKeyword("chan") +		dir = types.RecvOnly +	} +	elem := p.parseType(parent) +	return types.NewChan(dir, elem) +} + +// Type = +//	BasicType | TypeName | ArrayType | SliceType | StructType | +//      PointerType | FuncType | InterfaceType | MapType | ChanType | +//      "(" Type ")" . +// +// BasicType   = ident . +// TypeName    = ExportedName . +// SliceType   = "[" "]" Type . +// PointerType = "*" Type . +// FuncType    = "func" Signature . +// +func (p *parser) parseType(parent *types.Package) types.Type { +	switch p.tok { +	case scanner.Ident: +		switch p.lit { +		default: +			return p.parseBasicType() +		case "struct": +			return p.parseStructType(parent) +		case "func": +			// FuncType +			p.next() +			return p.parseSignature(nil) +		case "interface": +			return p.parseInterfaceType(parent) +		case "map": +			return p.parseMapType(parent) +		case "chan": +			return p.parseChanType(parent) +		} +	case '@': +		// TypeName +		pkg, name := p.parseExportedName() +		return declTypeName(pkg, name).Type() +	case '[': +		p.next() // look ahead +		if p.tok == ']' { +			// SliceType +			p.next() +			return types.NewSlice(p.parseType(parent)) +		} +		return p.parseArrayType(parent) +	case '*': +		// PointerType +		p.next() +		return types.NewPointer(p.parseType(parent)) +	case '<': +		return p.parseChanType(parent) +	case '(': +		// "(" Type ")" +		p.next() +		typ := p.parseType(parent) +		p.expect(')') +		return typ +	} +	p.errorf("expected type, got %s (%q)", scanner.TokenString(p.tok), p.lit) +	return nil +} + +// ---------------------------------------------------------------------------- +// Declarations + +// ImportDecl = "import" PackageName PackageId . +// +func (p *parser) parseImportDecl() { +	p.expectKeyword("import") +	name := p.parsePackageName() +	p.getPkg(p.parsePackageID(), name) +} + +// int_lit = [ "+" | "-" ] { "0" ... "9" } . +// +func (p *parser) parseInt() string { +	s := "" +	switch p.tok { +	case '-': +		s = "-" +		p.next() +	case '+': +		p.next() +	} +	return s + p.expect(scanner.Int) +} + +// number = int_lit [ "p" int_lit ] . +// +func (p *parser) parseNumber() (typ *types.Basic, val constant.Value) { +	// mantissa +	mant := constant.MakeFromLiteral(p.parseInt(), token.INT, 0) +	if mant == nil { +		panic("invalid mantissa") +	} + +	if p.lit == "p" { +		// exponent (base 2) +		p.next() +		exp, err := strconv.ParseInt(p.parseInt(), 10, 0) +		if err != nil { +			p.error(err) +		} +		if exp < 0 { +			denom := constant.MakeInt64(1) +			denom = constant.Shift(denom, token.SHL, uint(-exp)) +			typ = types.Typ[types.UntypedFloat] +			val = constant.BinaryOp(mant, token.QUO, denom) +			return +		} +		if exp > 0 { +			mant = constant.Shift(mant, token.SHL, uint(exp)) +		} +		typ = types.Typ[types.UntypedFloat] +		val = mant +		return +	} + +	typ = types.Typ[types.UntypedInt] +	val = mant +	return +} + +// ConstDecl   = "const" ExportedName [ Type ] "=" Literal . +// Literal     = bool_lit | int_lit | float_lit | complex_lit | rune_lit | string_lit . +// bool_lit    = "true" | "false" . +// complex_lit = "(" float_lit "+" float_lit "i" ")" . +// rune_lit    = "(" int_lit "+" int_lit ")" . +// string_lit  = `"` { unicode_char } `"` . +// +func (p *parser) parseConstDecl() { +	p.expectKeyword("const") +	pkg, name := p.parseExportedName() + +	var typ0 types.Type +	if p.tok != '=' { +		// constant types are never structured - no need for parent type +		typ0 = p.parseType(nil) +	} + +	p.expect('=') +	var typ types.Type +	var val constant.Value +	switch p.tok { +	case scanner.Ident: +		// bool_lit +		if p.lit != "true" && p.lit != "false" { +			p.error("expected true or false") +		} +		typ = types.Typ[types.UntypedBool] +		val = constant.MakeBool(p.lit == "true") +		p.next() + +	case '-', scanner.Int: +		// int_lit +		typ, val = p.parseNumber() + +	case '(': +		// complex_lit or rune_lit +		p.next() +		if p.tok == scanner.Char { +			p.next() +			p.expect('+') +			typ = types.Typ[types.UntypedRune] +			_, val = p.parseNumber() +			p.expect(')') +			break +		} +		_, re := p.parseNumber() +		p.expect('+') +		_, im := p.parseNumber() +		p.expectKeyword("i") +		p.expect(')') +		typ = types.Typ[types.UntypedComplex] +		val = constant.BinaryOp(re, token.ADD, constant.MakeImag(im)) + +	case scanner.Char: +		// rune_lit +		typ = types.Typ[types.UntypedRune] +		val = constant.MakeFromLiteral(p.lit, token.CHAR, 0) +		p.next() + +	case scanner.String: +		// string_lit +		typ = types.Typ[types.UntypedString] +		val = constant.MakeFromLiteral(p.lit, token.STRING, 0) +		p.next() + +	default: +		p.errorf("expected literal got %s", scanner.TokenString(p.tok)) +	} + +	if typ0 == nil { +		typ0 = typ +	} + +	pkg.Scope().Insert(types.NewConst(token.NoPos, pkg, name, typ0, val)) +} + +// TypeDecl = "type" ExportedName Type . +// +func (p *parser) parseTypeDecl() { +	p.expectKeyword("type") +	pkg, name := p.parseExportedName() +	obj := declTypeName(pkg, name) + +	// The type object may have been imported before and thus already +	// have a type associated with it. We still need to parse the type +	// structure, but throw it away if the object already has a type. +	// This ensures that all imports refer to the same type object for +	// a given type declaration. +	typ := p.parseType(pkg) + +	if name := obj.Type().(*types.Named); name.Underlying() == nil { +		name.SetUnderlying(typ) +	} +} + +// VarDecl = "var" ExportedName Type . +// +func (p *parser) parseVarDecl() { +	p.expectKeyword("var") +	pkg, name := p.parseExportedName() +	typ := p.parseType(pkg) +	pkg.Scope().Insert(types.NewVar(token.NoPos, pkg, name, typ)) +} + +// Func = Signature [ Body ] . +// Body = "{" ... "}" . +// +func (p *parser) parseFunc(recv *types.Var) *types.Signature { +	sig := p.parseSignature(recv) +	if p.tok == '{' { +		p.next() +		for i := 1; i > 0; p.next() { +			switch p.tok { +			case '{': +				i++ +			case '}': +				i-- +			} +		} +	} +	return sig +} + +// MethodDecl = "func" Receiver Name Func . +// Receiver   = "(" ( identifier | "?" ) [ "*" ] ExportedName ")" . +// +func (p *parser) parseMethodDecl() { +	// "func" already consumed +	p.expect('(') +	recv, _ := p.parseParameter() // receiver +	p.expect(')') + +	// determine receiver base type object +	base := deref(recv.Type()).(*types.Named) + +	// parse method name, signature, and possibly inlined body +	_, name := p.parseName(nil, false) +	sig := p.parseFunc(recv) + +	// methods always belong to the same package as the base type object +	pkg := base.Obj().Pkg() + +	// add method to type unless type was imported before +	// and method exists already +	// TODO(gri) This leads to a quadratic algorithm - ok for now because method counts are small. +	base.AddMethod(types.NewFunc(token.NoPos, pkg, name, sig)) +} + +// FuncDecl = "func" ExportedName Func . +// +func (p *parser) parseFuncDecl() { +	// "func" already consumed +	pkg, name := p.parseExportedName() +	typ := p.parseFunc(nil) +	pkg.Scope().Insert(types.NewFunc(token.NoPos, pkg, name, typ)) +} + +// Decl = [ ImportDecl | ConstDecl | TypeDecl | VarDecl | FuncDecl | MethodDecl ] "\n" . +// +func (p *parser) parseDecl() { +	if p.tok == scanner.Ident { +		switch p.lit { +		case "import": +			p.parseImportDecl() +		case "const": +			p.parseConstDecl() +		case "type": +			p.parseTypeDecl() +		case "var": +			p.parseVarDecl() +		case "func": +			p.next() // look ahead +			if p.tok == '(' { +				p.parseMethodDecl() +			} else { +				p.parseFuncDecl() +			} +		} +	} +	p.expect('\n') +} + +// ---------------------------------------------------------------------------- +// Export + +// Export        = "PackageClause { Decl } "$$" . +// PackageClause = "package" PackageName [ "safe" ] "\n" . +// +func (p *parser) parseExport() *types.Package { +	p.expectKeyword("package") +	name := p.parsePackageName() +	if p.tok == scanner.Ident && p.lit == "safe" { +		// package was compiled with -u option - ignore +		p.next() +	} +	p.expect('\n') + +	pkg := p.getPkg(p.id, name) + +	for p.tok != '$' && p.tok != scanner.EOF { +		p.parseDecl() +	} + +	if ch := p.scanner.Peek(); p.tok != '$' || ch != '$' { +		// don't call next()/expect() since reading past the +		// export data may cause scanner errors (e.g. NUL chars) +		p.errorf("expected '$$', got %s %c", scanner.TokenString(p.tok), ch) +	} + +	if n := p.scanner.ErrorCount; n != 0 { +		p.errorf("expected no scanner errors, got %d", n) +	} + +	// Record all locally referenced packages as imports. +	var imports []*types.Package +	for id, pkg2 := range p.localPkgs { +		if pkg2.Name() == "" { +			p.errorf("%s package has no name", id) +		} +		if id == p.id { +			continue // avoid self-edge +		} +		imports = append(imports, pkg2) +	} +	sort.Sort(byPath(imports)) +	pkg.SetImports(imports) + +	// package was imported completely and without errors +	pkg.MarkComplete() + +	return pkg +} + +type byPath []*types.Package + +func (a byPath) Len() int           { return len(a) } +func (a byPath) Swap(i, j int)      { a[i], a[j] = a[j], a[i] } +func (a byPath) Less(i, j int) bool { return a[i].Path() < a[j].Path() } diff --git a/vendor/golang.org/x/tools/go/internal/gcimporter/iexport.go b/vendor/golang.org/x/tools/go/internal/gcimporter/iexport.go new file mode 100644 index 000000000..d2fc8b6fa --- /dev/null +++ b/vendor/golang.org/x/tools/go/internal/gcimporter/iexport.go @@ -0,0 +1,781 @@ +// 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. + +// Indexed binary package export. +// This file was derived from $GOROOT/src/cmd/compile/internal/gc/iexport.go; +// see that file for specification of the format. + +package gcimporter + +import ( +	"bytes" +	"encoding/binary" +	"go/ast" +	"go/constant" +	"go/token" +	"go/types" +	"io" +	"math/big" +	"reflect" +	"sort" +) + +// Current indexed export format version. Increase with each format change. +// 0: Go1.11 encoding +const iexportVersion = 0 + +// Current bundled export format version. Increase with each format change. +// 0: initial implementation +const bundleVersion = 0 + +// IExportData writes indexed export data for pkg to out. +// +// If no file set is provided, position info will be missing. +// The package path of the top-level package will not be recorded, +// so that calls to IImportData can override with a provided package path. +func IExportData(out io.Writer, fset *token.FileSet, pkg *types.Package) error { +	return iexportCommon(out, fset, false, []*types.Package{pkg}) +} + +// IExportBundle writes an indexed export bundle for pkgs to out. +func IExportBundle(out io.Writer, fset *token.FileSet, pkgs []*types.Package) error { +	return iexportCommon(out, fset, true, pkgs) +} + +func iexportCommon(out io.Writer, fset *token.FileSet, bundle bool, pkgs []*types.Package) (err error) { +	defer func() { +		if e := recover(); e != nil { +			if ierr, ok := e.(internalError); ok { +				err = ierr +				return +			} +			// Not an internal error; panic again. +			panic(e) +		} +	}() + +	p := iexporter{ +		fset:        fset, +		allPkgs:     map[*types.Package]bool{}, +		stringIndex: map[string]uint64{}, +		declIndex:   map[types.Object]uint64{}, +		typIndex:    map[types.Type]uint64{}, +	} +	if !bundle { +		p.localpkg = pkgs[0] +	} + +	for i, pt := range predeclared() { +		p.typIndex[pt] = uint64(i) +	} +	if len(p.typIndex) > predeclReserved { +		panic(internalErrorf("too many predeclared types: %d > %d", len(p.typIndex), predeclReserved)) +	} + +	// Initialize work queue with exported declarations. +	for _, pkg := range pkgs { +		scope := pkg.Scope() +		for _, name := range scope.Names() { +			if ast.IsExported(name) { +				p.pushDecl(scope.Lookup(name)) +			} +		} + +		if bundle { +			// Ensure pkg and its imports are included in the index. +			p.allPkgs[pkg] = true +			for _, imp := range pkg.Imports() { +				p.allPkgs[imp] = true +			} +		} +	} + +	// Loop until no more work. +	for !p.declTodo.empty() { +		p.doDecl(p.declTodo.popHead()) +	} + +	// Append indices to data0 section. +	dataLen := uint64(p.data0.Len()) +	w := p.newWriter() +	w.writeIndex(p.declIndex) + +	if bundle { +		w.uint64(uint64(len(pkgs))) +		for _, pkg := range pkgs { +			w.pkg(pkg) +			imps := pkg.Imports() +			w.uint64(uint64(len(imps))) +			for _, imp := range imps { +				w.pkg(imp) +			} +		} +	} +	w.flush() + +	// Assemble header. +	var hdr intWriter +	if bundle { +		hdr.uint64(bundleVersion) +	} +	hdr.uint64(iexportVersion) +	hdr.uint64(uint64(p.strings.Len())) +	hdr.uint64(dataLen) + +	// Flush output. +	io.Copy(out, &hdr) +	io.Copy(out, &p.strings) +	io.Copy(out, &p.data0) + +	return nil +} + +// writeIndex writes out an object index. mainIndex indicates whether +// we're writing out the main index, which is also read by +// non-compiler tools and includes a complete package description +// (i.e., name and height). +func (w *exportWriter) writeIndex(index map[types.Object]uint64) { +	// Build a map from packages to objects from that package. +	pkgObjs := map[*types.Package][]types.Object{} + +	// For the main index, make sure to include every package that +	// we reference, even if we're not exporting (or reexporting) +	// any symbols from it. +	if w.p.localpkg != nil { +		pkgObjs[w.p.localpkg] = nil +	} +	for pkg := range w.p.allPkgs { +		pkgObjs[pkg] = nil +	} + +	for obj := range index { +		pkgObjs[obj.Pkg()] = append(pkgObjs[obj.Pkg()], obj) +	} + +	var pkgs []*types.Package +	for pkg, objs := range pkgObjs { +		pkgs = append(pkgs, pkg) + +		sort.Slice(objs, func(i, j int) bool { +			return objs[i].Name() < objs[j].Name() +		}) +	} + +	sort.Slice(pkgs, func(i, j int) bool { +		return w.exportPath(pkgs[i]) < w.exportPath(pkgs[j]) +	}) + +	w.uint64(uint64(len(pkgs))) +	for _, pkg := range pkgs { +		w.string(w.exportPath(pkg)) +		w.string(pkg.Name()) +		w.uint64(uint64(0)) // package height is not needed for go/types + +		objs := pkgObjs[pkg] +		w.uint64(uint64(len(objs))) +		for _, obj := range objs { +			w.string(obj.Name()) +			w.uint64(index[obj]) +		} +	} +} + +type iexporter struct { +	fset *token.FileSet +	out  *bytes.Buffer + +	localpkg *types.Package + +	// allPkgs tracks all packages that have been referenced by +	// the export data, so we can ensure to include them in the +	// main index. +	allPkgs map[*types.Package]bool + +	declTodo objQueue + +	strings     intWriter +	stringIndex map[string]uint64 + +	data0     intWriter +	declIndex map[types.Object]uint64 +	typIndex  map[types.Type]uint64 +} + +// stringOff returns the offset of s within the string section. +// If not already present, it's added to the end. +func (p *iexporter) stringOff(s string) uint64 { +	off, ok := p.stringIndex[s] +	if !ok { +		off = uint64(p.strings.Len()) +		p.stringIndex[s] = off + +		p.strings.uint64(uint64(len(s))) +		p.strings.WriteString(s) +	} +	return off +} + +// pushDecl adds n to the declaration work queue, if not already present. +func (p *iexporter) pushDecl(obj types.Object) { +	// Package unsafe is known to the compiler and predeclared. +	assert(obj.Pkg() != types.Unsafe) + +	if _, ok := p.declIndex[obj]; ok { +		return +	} + +	p.declIndex[obj] = ^uint64(0) // mark n present in work queue +	p.declTodo.pushTail(obj) +} + +// exportWriter handles writing out individual data section chunks. +type exportWriter struct { +	p *iexporter + +	data     intWriter +	currPkg  *types.Package +	prevFile string +	prevLine int64 +} + +func (w *exportWriter) exportPath(pkg *types.Package) string { +	if pkg == w.p.localpkg { +		return "" +	} +	return pkg.Path() +} + +func (p *iexporter) doDecl(obj types.Object) { +	w := p.newWriter() +	w.setPkg(obj.Pkg(), false) + +	switch obj := obj.(type) { +	case *types.Var: +		w.tag('V') +		w.pos(obj.Pos()) +		w.typ(obj.Type(), obj.Pkg()) + +	case *types.Func: +		sig, _ := obj.Type().(*types.Signature) +		if sig.Recv() != nil { +			panic(internalErrorf("unexpected method: %v", sig)) +		} +		w.tag('F') +		w.pos(obj.Pos()) +		w.signature(sig) + +	case *types.Const: +		w.tag('C') +		w.pos(obj.Pos()) +		w.value(obj.Type(), obj.Val()) + +	case *types.TypeName: +		if obj.IsAlias() { +			w.tag('A') +			w.pos(obj.Pos()) +			w.typ(obj.Type(), obj.Pkg()) +			break +		} + +		// Defined type. +		w.tag('T') +		w.pos(obj.Pos()) + +		underlying := obj.Type().Underlying() +		w.typ(underlying, obj.Pkg()) + +		t := obj.Type() +		if types.IsInterface(t) { +			break +		} + +		named, ok := t.(*types.Named) +		if !ok { +			panic(internalErrorf("%s is not a defined type", t)) +		} + +		n := named.NumMethods() +		w.uint64(uint64(n)) +		for i := 0; i < n; i++ { +			m := named.Method(i) +			w.pos(m.Pos()) +			w.string(m.Name()) +			sig, _ := m.Type().(*types.Signature) +			w.param(sig.Recv()) +			w.signature(sig) +		} + +	default: +		panic(internalErrorf("unexpected object: %v", obj)) +	} + +	p.declIndex[obj] = w.flush() +} + +func (w *exportWriter) tag(tag byte) { +	w.data.WriteByte(tag) +} + +func (w *exportWriter) pos(pos token.Pos) { +	if w.p.fset == nil { +		w.int64(0) +		return +	} + +	p := w.p.fset.Position(pos) +	file := p.Filename +	line := int64(p.Line) + +	// When file is the same as the last position (common case), +	// we can save a few bytes by delta encoding just the line +	// number. +	// +	// Note: Because data objects may be read out of order (or not +	// at all), we can only apply delta encoding within a single +	// object. This is handled implicitly by tracking prevFile and +	// prevLine as fields of exportWriter. + +	if file == w.prevFile { +		delta := line - w.prevLine +		w.int64(delta) +		if delta == deltaNewFile { +			w.int64(-1) +		} +	} else { +		w.int64(deltaNewFile) +		w.int64(line) // line >= 0 +		w.string(file) +		w.prevFile = file +	} +	w.prevLine = line +} + +func (w *exportWriter) pkg(pkg *types.Package) { +	// Ensure any referenced packages are declared in the main index. +	w.p.allPkgs[pkg] = true + +	w.string(w.exportPath(pkg)) +} + +func (w *exportWriter) qualifiedIdent(obj types.Object) { +	// Ensure any referenced declarations are written out too. +	w.p.pushDecl(obj) + +	w.string(obj.Name()) +	w.pkg(obj.Pkg()) +} + +func (w *exportWriter) typ(t types.Type, pkg *types.Package) { +	w.data.uint64(w.p.typOff(t, pkg)) +} + +func (p *iexporter) newWriter() *exportWriter { +	return &exportWriter{p: p} +} + +func (w *exportWriter) flush() uint64 { +	off := uint64(w.p.data0.Len()) +	io.Copy(&w.p.data0, &w.data) +	return off +} + +func (p *iexporter) typOff(t types.Type, pkg *types.Package) uint64 { +	off, ok := p.typIndex[t] +	if !ok { +		w := p.newWriter() +		w.doTyp(t, pkg) +		off = predeclReserved + w.flush() +		p.typIndex[t] = off +	} +	return off +} + +func (w *exportWriter) startType(k itag) { +	w.data.uint64(uint64(k)) +} + +func (w *exportWriter) doTyp(t types.Type, pkg *types.Package) { +	switch t := t.(type) { +	case *types.Named: +		w.startType(definedType) +		w.qualifiedIdent(t.Obj()) + +	case *types.Pointer: +		w.startType(pointerType) +		w.typ(t.Elem(), pkg) + +	case *types.Slice: +		w.startType(sliceType) +		w.typ(t.Elem(), pkg) + +	case *types.Array: +		w.startType(arrayType) +		w.uint64(uint64(t.Len())) +		w.typ(t.Elem(), pkg) + +	case *types.Chan: +		w.startType(chanType) +		// 1 RecvOnly; 2 SendOnly; 3 SendRecv +		var dir uint64 +		switch t.Dir() { +		case types.RecvOnly: +			dir = 1 +		case types.SendOnly: +			dir = 2 +		case types.SendRecv: +			dir = 3 +		} +		w.uint64(dir) +		w.typ(t.Elem(), pkg) + +	case *types.Map: +		w.startType(mapType) +		w.typ(t.Key(), pkg) +		w.typ(t.Elem(), pkg) + +	case *types.Signature: +		w.startType(signatureType) +		w.setPkg(pkg, true) +		w.signature(t) + +	case *types.Struct: +		w.startType(structType) +		w.setPkg(pkg, true) + +		n := t.NumFields() +		w.uint64(uint64(n)) +		for i := 0; i < n; i++ { +			f := t.Field(i) +			w.pos(f.Pos()) +			w.string(f.Name()) +			w.typ(f.Type(), pkg) +			w.bool(f.Anonymous()) +			w.string(t.Tag(i)) // note (or tag) +		} + +	case *types.Interface: +		w.startType(interfaceType) +		w.setPkg(pkg, true) + +		n := t.NumEmbeddeds() +		w.uint64(uint64(n)) +		for i := 0; i < n; i++ { +			f := t.Embedded(i) +			w.pos(f.Obj().Pos()) +			w.typ(f.Obj().Type(), f.Obj().Pkg()) +		} + +		n = t.NumExplicitMethods() +		w.uint64(uint64(n)) +		for i := 0; i < n; i++ { +			m := t.ExplicitMethod(i) +			w.pos(m.Pos()) +			w.string(m.Name()) +			sig, _ := m.Type().(*types.Signature) +			w.signature(sig) +		} + +	default: +		panic(internalErrorf("unexpected type: %v, %v", t, reflect.TypeOf(t))) +	} +} + +func (w *exportWriter) setPkg(pkg *types.Package, write bool) { +	if write { +		w.pkg(pkg) +	} + +	w.currPkg = pkg +} + +func (w *exportWriter) signature(sig *types.Signature) { +	w.paramList(sig.Params()) +	w.paramList(sig.Results()) +	if sig.Params().Len() > 0 { +		w.bool(sig.Variadic()) +	} +} + +func (w *exportWriter) paramList(tup *types.Tuple) { +	n := tup.Len() +	w.uint64(uint64(n)) +	for i := 0; i < n; i++ { +		w.param(tup.At(i)) +	} +} + +func (w *exportWriter) param(obj types.Object) { +	w.pos(obj.Pos()) +	w.localIdent(obj) +	w.typ(obj.Type(), obj.Pkg()) +} + +func (w *exportWriter) value(typ types.Type, v constant.Value) { +	w.typ(typ, nil) + +	switch b := typ.Underlying().(*types.Basic); b.Info() & types.IsConstType { +	case types.IsBoolean: +		w.bool(constant.BoolVal(v)) +	case types.IsInteger: +		var i big.Int +		if i64, exact := constant.Int64Val(v); exact { +			i.SetInt64(i64) +		} else if ui64, exact := constant.Uint64Val(v); exact { +			i.SetUint64(ui64) +		} else { +			i.SetString(v.ExactString(), 10) +		} +		w.mpint(&i, typ) +	case types.IsFloat: +		f := constantToFloat(v) +		w.mpfloat(f, typ) +	case types.IsComplex: +		w.mpfloat(constantToFloat(constant.Real(v)), typ) +		w.mpfloat(constantToFloat(constant.Imag(v)), typ) +	case types.IsString: +		w.string(constant.StringVal(v)) +	default: +		if b.Kind() == types.Invalid { +			// package contains type errors +			break +		} +		panic(internalErrorf("unexpected type %v (%v)", typ, typ.Underlying())) +	} +} + +// constantToFloat converts a constant.Value with kind constant.Float to a +// big.Float. +func constantToFloat(x constant.Value) *big.Float { +	x = constant.ToFloat(x) +	// Use the same floating-point precision (512) as cmd/compile +	// (see Mpprec in cmd/compile/internal/gc/mpfloat.go). +	const mpprec = 512 +	var f big.Float +	f.SetPrec(mpprec) +	if v, exact := constant.Float64Val(x); exact { +		// float64 +		f.SetFloat64(v) +	} else if num, denom := constant.Num(x), constant.Denom(x); num.Kind() == constant.Int { +		// TODO(gri): add big.Rat accessor to constant.Value. +		n := valueToRat(num) +		d := valueToRat(denom) +		f.SetRat(n.Quo(n, d)) +	} else { +		// Value too large to represent as a fraction => inaccessible. +		// TODO(gri): add big.Float accessor to constant.Value. +		_, ok := f.SetString(x.ExactString()) +		assert(ok) +	} +	return &f +} + +// mpint exports a multi-precision integer. +// +// For unsigned types, small values are written out as a single +// byte. Larger values are written out as a length-prefixed big-endian +// byte string, where the length prefix is encoded as its complement. +// For example, bytes 0, 1, and 2 directly represent the integer +// values 0, 1, and 2; while bytes 255, 254, and 253 indicate a 1-, +// 2-, and 3-byte big-endian string follow. +// +// Encoding for signed types use the same general approach as for +// unsigned types, except small values use zig-zag encoding and the +// bottom bit of length prefix byte for large values is reserved as a +// sign bit. +// +// The exact boundary between small and large encodings varies +// according to the maximum number of bytes needed to encode a value +// of type typ. As a special case, 8-bit types are always encoded as a +// single byte. +// +// TODO(mdempsky): Is this level of complexity really worthwhile? +func (w *exportWriter) mpint(x *big.Int, typ types.Type) { +	basic, ok := typ.Underlying().(*types.Basic) +	if !ok { +		panic(internalErrorf("unexpected type %v (%T)", typ.Underlying(), typ.Underlying())) +	} + +	signed, maxBytes := intSize(basic) + +	negative := x.Sign() < 0 +	if !signed && negative { +		panic(internalErrorf("negative unsigned integer; type %v, value %v", typ, x)) +	} + +	b := x.Bytes() +	if len(b) > 0 && b[0] == 0 { +		panic(internalErrorf("leading zeros")) +	} +	if uint(len(b)) > maxBytes { +		panic(internalErrorf("bad mpint length: %d > %d (type %v, value %v)", len(b), maxBytes, typ, x)) +	} + +	maxSmall := 256 - maxBytes +	if signed { +		maxSmall = 256 - 2*maxBytes +	} +	if maxBytes == 1 { +		maxSmall = 256 +	} + +	// Check if x can use small value encoding. +	if len(b) <= 1 { +		var ux uint +		if len(b) == 1 { +			ux = uint(b[0]) +		} +		if signed { +			ux <<= 1 +			if negative { +				ux-- +			} +		} +		if ux < maxSmall { +			w.data.WriteByte(byte(ux)) +			return +		} +	} + +	n := 256 - uint(len(b)) +	if signed { +		n = 256 - 2*uint(len(b)) +		if negative { +			n |= 1 +		} +	} +	if n < maxSmall || n >= 256 { +		panic(internalErrorf("encoding mistake: %d, %v, %v => %d", len(b), signed, negative, n)) +	} + +	w.data.WriteByte(byte(n)) +	w.data.Write(b) +} + +// mpfloat exports a multi-precision floating point number. +// +// The number's value is decomposed into mantissa × 2**exponent, where +// mantissa is an integer. The value is written out as mantissa (as a +// multi-precision integer) and then the exponent, except exponent is +// omitted if mantissa is zero. +func (w *exportWriter) mpfloat(f *big.Float, typ types.Type) { +	if f.IsInf() { +		panic("infinite constant") +	} + +	// Break into f = mant × 2**exp, with 0.5 <= mant < 1. +	var mant big.Float +	exp := int64(f.MantExp(&mant)) + +	// Scale so that mant is an integer. +	prec := mant.MinPrec() +	mant.SetMantExp(&mant, int(prec)) +	exp -= int64(prec) + +	manti, acc := mant.Int(nil) +	if acc != big.Exact { +		panic(internalErrorf("mantissa scaling failed for %f (%s)", f, acc)) +	} +	w.mpint(manti, typ) +	if manti.Sign() != 0 { +		w.int64(exp) +	} +} + +func (w *exportWriter) bool(b bool) bool { +	var x uint64 +	if b { +		x = 1 +	} +	w.uint64(x) +	return b +} + +func (w *exportWriter) int64(x int64)   { w.data.int64(x) } +func (w *exportWriter) uint64(x uint64) { w.data.uint64(x) } +func (w *exportWriter) string(s string) { w.uint64(w.p.stringOff(s)) } + +func (w *exportWriter) localIdent(obj types.Object) { +	// Anonymous parameters. +	if obj == nil { +		w.string("") +		return +	} + +	name := obj.Name() +	if name == "_" { +		w.string("_") +		return +	} + +	w.string(name) +} + +type intWriter struct { +	bytes.Buffer +} + +func (w *intWriter) int64(x int64) { +	var buf [binary.MaxVarintLen64]byte +	n := binary.PutVarint(buf[:], x) +	w.Write(buf[:n]) +} + +func (w *intWriter) uint64(x uint64) { +	var buf [binary.MaxVarintLen64]byte +	n := binary.PutUvarint(buf[:], x) +	w.Write(buf[:n]) +} + +func assert(cond bool) { +	if !cond { +		panic("internal error: assertion failed") +	} +} + +// The below is copied from go/src/cmd/compile/internal/gc/syntax.go. + +// objQueue is a FIFO queue of types.Object. The zero value of objQueue is +// a ready-to-use empty queue. +type objQueue struct { +	ring       []types.Object +	head, tail int +} + +// empty returns true if q contains no Nodes. +func (q *objQueue) empty() bool { +	return q.head == q.tail +} + +// pushTail appends n to the tail of the queue. +func (q *objQueue) pushTail(obj types.Object) { +	if len(q.ring) == 0 { +		q.ring = make([]types.Object, 16) +	} else if q.head+len(q.ring) == q.tail { +		// Grow the ring. +		nring := make([]types.Object, len(q.ring)*2) +		// Copy the old elements. +		part := q.ring[q.head%len(q.ring):] +		if q.tail-q.head <= len(part) { +			part = part[:q.tail-q.head] +			copy(nring, part) +		} else { +			pos := copy(nring, part) +			copy(nring[pos:], q.ring[:q.tail%len(q.ring)]) +		} +		q.ring, q.head, q.tail = nring, 0, q.tail-q.head +	} + +	q.ring[q.tail%len(q.ring)] = obj +	q.tail++ +} + +// popHead pops a node from the head of the queue. It panics if q is empty. +func (q *objQueue) popHead() types.Object { +	if q.empty() { +		panic("dequeue empty") +	} +	obj := q.ring[q.head%len(q.ring)] +	q.head++ +	return obj +} diff --git a/vendor/golang.org/x/tools/go/internal/gcimporter/iimport.go b/vendor/golang.org/x/tools/go/internal/gcimporter/iimport.go new file mode 100644 index 000000000..8ed8bc62d --- /dev/null +++ b/vendor/golang.org/x/tools/go/internal/gcimporter/iimport.go @@ -0,0 +1,676 @@ +// 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. + +// Indexed package import. +// See cmd/compile/internal/gc/iexport.go for the export data format. + +// This file is a copy of $GOROOT/src/go/internal/gcimporter/iimport.go. + +package gcimporter + +import ( +	"bytes" +	"encoding/binary" +	"fmt" +	"go/constant" +	"go/token" +	"go/types" +	"io" +	"sort" +) + +type intReader struct { +	*bytes.Reader +	path string +} + +func (r *intReader) int64() int64 { +	i, err := binary.ReadVarint(r.Reader) +	if err != nil { +		errorf("import %q: read varint error: %v", r.path, err) +	} +	return i +} + +func (r *intReader) uint64() uint64 { +	i, err := binary.ReadUvarint(r.Reader) +	if err != nil { +		errorf("import %q: read varint error: %v", r.path, err) +	} +	return i +} + +const predeclReserved = 32 + +type itag uint64 + +const ( +	// Types +	definedType itag = iota +	pointerType +	sliceType +	arrayType +	chanType +	mapType +	signatureType +	structType +	interfaceType +) + +// IImportData imports a package from the serialized package data +// and returns 0 and a reference to the package. +// If the export data version is not recognized or the format is otherwise +// compromised, an error is returned. +func IImportData(fset *token.FileSet, imports map[string]*types.Package, data []byte, path string) (int, *types.Package, error) { +	pkgs, err := iimportCommon(fset, imports, data, false, path) +	if err != nil { +		return 0, nil, err +	} +	return 0, pkgs[0], nil +} + +// IImportBundle imports a set of packages from the serialized package bundle. +func IImportBundle(fset *token.FileSet, imports map[string]*types.Package, data []byte) ([]*types.Package, error) { +	return iimportCommon(fset, imports, data, true, "") +} + +func iimportCommon(fset *token.FileSet, imports map[string]*types.Package, data []byte, bundle bool, path string) (pkgs []*types.Package, err error) { +	const currentVersion = 1 +	version := int64(-1) +	defer func() { +		if e := recover(); e != nil { +			if version > currentVersion { +				err = fmt.Errorf("cannot import %q (%v), export data is newer version - update tool", path, e) +			} else { +				err = fmt.Errorf("cannot import %q (%v), possibly version skew - reinstall package", path, e) +			} +		} +	}() + +	r := &intReader{bytes.NewReader(data), path} + +	if bundle { +		bundleVersion := r.uint64() +		switch bundleVersion { +		case bundleVersion: +		default: +			errorf("unknown bundle format version %d", bundleVersion) +		} +	} + +	version = int64(r.uint64()) +	switch version { +	case currentVersion, 0: +	default: +		errorf("unknown iexport format version %d", version) +	} + +	sLen := int64(r.uint64()) +	dLen := int64(r.uint64()) + +	whence, _ := r.Seek(0, io.SeekCurrent) +	stringData := data[whence : whence+sLen] +	declData := data[whence+sLen : whence+sLen+dLen] +	r.Seek(sLen+dLen, io.SeekCurrent) + +	p := iimporter{ +		ipath:   path, +		version: int(version), + +		stringData:  stringData, +		stringCache: make(map[uint64]string), +		pkgCache:    make(map[uint64]*types.Package), + +		declData: declData, +		pkgIndex: make(map[*types.Package]map[string]uint64), +		typCache: make(map[uint64]types.Type), + +		fake: fakeFileSet{ +			fset:  fset, +			files: make(map[string]*token.File), +		}, +	} + +	for i, pt := range predeclared() { +		p.typCache[uint64(i)] = pt +	} + +	pkgList := make([]*types.Package, r.uint64()) +	for i := range pkgList { +		pkgPathOff := r.uint64() +		pkgPath := p.stringAt(pkgPathOff) +		pkgName := p.stringAt(r.uint64()) +		_ = r.uint64() // package height; unused by go/types + +		if pkgPath == "" { +			pkgPath = path +		} +		pkg := imports[pkgPath] +		if pkg == nil { +			pkg = types.NewPackage(pkgPath, pkgName) +			imports[pkgPath] = pkg +		} else if pkg.Name() != pkgName { +			errorf("conflicting names %s and %s for package %q", pkg.Name(), pkgName, path) +		} + +		p.pkgCache[pkgPathOff] = pkg + +		nameIndex := make(map[string]uint64) +		for nSyms := r.uint64(); nSyms > 0; nSyms-- { +			name := p.stringAt(r.uint64()) +			nameIndex[name] = r.uint64() +		} + +		p.pkgIndex[pkg] = nameIndex +		pkgList[i] = pkg +	} + +	if bundle { +		pkgs = make([]*types.Package, r.uint64()) +		for i := range pkgs { +			pkg := p.pkgAt(r.uint64()) +			imps := make([]*types.Package, r.uint64()) +			for j := range imps { +				imps[j] = p.pkgAt(r.uint64()) +			} +			pkg.SetImports(imps) +			pkgs[i] = pkg +		} +	} else { +		if len(pkgList) == 0 { +			errorf("no packages found for %s", path) +			panic("unreachable") +		} +		pkgs = pkgList[:1] + +		// record all referenced packages as imports +		list := append(([]*types.Package)(nil), pkgList[1:]...) +		sort.Sort(byPath(list)) +		pkgs[0].SetImports(list) +	} + +	for _, pkg := range pkgs { +		if pkg.Complete() { +			continue +		} + +		names := make([]string, 0, len(p.pkgIndex[pkg])) +		for name := range p.pkgIndex[pkg] { +			names = append(names, name) +		} +		sort.Strings(names) +		for _, name := range names { +			p.doDecl(pkg, name) +		} + +		// package was imported completely and without errors +		pkg.MarkComplete() +	} + +	for _, typ := range p.interfaceList { +		typ.Complete() +	} + +	return pkgs, nil +} + +type iimporter struct { +	ipath   string +	version int + +	stringData  []byte +	stringCache map[uint64]string +	pkgCache    map[uint64]*types.Package + +	declData []byte +	pkgIndex map[*types.Package]map[string]uint64 +	typCache map[uint64]types.Type + +	fake          fakeFileSet +	interfaceList []*types.Interface +} + +func (p *iimporter) doDecl(pkg *types.Package, name string) { +	// See if we've already imported this declaration. +	if obj := pkg.Scope().Lookup(name); obj != nil { +		return +	} + +	off, ok := p.pkgIndex[pkg][name] +	if !ok { +		errorf("%v.%v not in index", pkg, name) +	} + +	r := &importReader{p: p, currPkg: pkg} +	r.declReader.Reset(p.declData[off:]) + +	r.obj(name) +} + +func (p *iimporter) stringAt(off uint64) string { +	if s, ok := p.stringCache[off]; ok { +		return s +	} + +	slen, n := binary.Uvarint(p.stringData[off:]) +	if n <= 0 { +		errorf("varint failed") +	} +	spos := off + uint64(n) +	s := string(p.stringData[spos : spos+slen]) +	p.stringCache[off] = s +	return s +} + +func (p *iimporter) pkgAt(off uint64) *types.Package { +	if pkg, ok := p.pkgCache[off]; ok { +		return pkg +	} +	path := p.stringAt(off) +	errorf("missing package %q in %q", path, p.ipath) +	return nil +} + +func (p *iimporter) typAt(off uint64, base *types.Named) types.Type { +	if t, ok := p.typCache[off]; ok && (base == nil || !isInterface(t)) { +		return t +	} + +	if off < predeclReserved { +		errorf("predeclared type missing from cache: %v", off) +	} + +	r := &importReader{p: p} +	r.declReader.Reset(p.declData[off-predeclReserved:]) +	t := r.doType(base) + +	if base == nil || !isInterface(t) { +		p.typCache[off] = t +	} +	return t +} + +type importReader struct { +	p          *iimporter +	declReader bytes.Reader +	currPkg    *types.Package +	prevFile   string +	prevLine   int64 +	prevColumn int64 +} + +func (r *importReader) obj(name string) { +	tag := r.byte() +	pos := r.pos() + +	switch tag { +	case 'A': +		typ := r.typ() + +		r.declare(types.NewTypeName(pos, r.currPkg, name, typ)) + +	case 'C': +		typ, val := r.value() + +		r.declare(types.NewConst(pos, r.currPkg, name, typ, val)) + +	case 'F': +		sig := r.signature(nil) + +		r.declare(types.NewFunc(pos, r.currPkg, name, sig)) + +	case 'T': +		// Types can be recursive. We need to setup a stub +		// declaration before recursing. +		obj := types.NewTypeName(pos, r.currPkg, name, nil) +		named := types.NewNamed(obj, nil, nil) +		r.declare(obj) + +		underlying := r.p.typAt(r.uint64(), named).Underlying() +		named.SetUnderlying(underlying) + +		if !isInterface(underlying) { +			for n := r.uint64(); n > 0; n-- { +				mpos := r.pos() +				mname := r.ident() +				recv := r.param() +				msig := r.signature(recv) + +				named.AddMethod(types.NewFunc(mpos, r.currPkg, mname, msig)) +			} +		} + +	case 'V': +		typ := r.typ() + +		r.declare(types.NewVar(pos, r.currPkg, name, typ)) + +	default: +		errorf("unexpected tag: %v", tag) +	} +} + +func (r *importReader) declare(obj types.Object) { +	obj.Pkg().Scope().Insert(obj) +} + +func (r *importReader) value() (typ types.Type, val constant.Value) { +	typ = r.typ() + +	switch b := typ.Underlying().(*types.Basic); b.Info() & types.IsConstType { +	case types.IsBoolean: +		val = constant.MakeBool(r.bool()) + +	case types.IsString: +		val = constant.MakeString(r.string()) + +	case types.IsInteger: +		val = r.mpint(b) + +	case types.IsFloat: +		val = r.mpfloat(b) + +	case types.IsComplex: +		re := r.mpfloat(b) +		im := r.mpfloat(b) +		val = constant.BinaryOp(re, token.ADD, constant.MakeImag(im)) + +	default: +		if b.Kind() == types.Invalid { +			val = constant.MakeUnknown() +			return +		} +		errorf("unexpected type %v", typ) // panics +		panic("unreachable") +	} + +	return +} + +func intSize(b *types.Basic) (signed bool, maxBytes uint) { +	if (b.Info() & types.IsUntyped) != 0 { +		return true, 64 +	} + +	switch b.Kind() { +	case types.Float32, types.Complex64: +		return true, 3 +	case types.Float64, types.Complex128: +		return true, 7 +	} + +	signed = (b.Info() & types.IsUnsigned) == 0 +	switch b.Kind() { +	case types.Int8, types.Uint8: +		maxBytes = 1 +	case types.Int16, types.Uint16: +		maxBytes = 2 +	case types.Int32, types.Uint32: +		maxBytes = 4 +	default: +		maxBytes = 8 +	} + +	return +} + +func (r *importReader) mpint(b *types.Basic) constant.Value { +	signed, maxBytes := intSize(b) + +	maxSmall := 256 - maxBytes +	if signed { +		maxSmall = 256 - 2*maxBytes +	} +	if maxBytes == 1 { +		maxSmall = 256 +	} + +	n, _ := r.declReader.ReadByte() +	if uint(n) < maxSmall { +		v := int64(n) +		if signed { +			v >>= 1 +			if n&1 != 0 { +				v = ^v +			} +		} +		return constant.MakeInt64(v) +	} + +	v := -n +	if signed { +		v = -(n &^ 1) >> 1 +	} +	if v < 1 || uint(v) > maxBytes { +		errorf("weird decoding: %v, %v => %v", n, signed, v) +	} + +	buf := make([]byte, v) +	io.ReadFull(&r.declReader, buf) + +	// convert to little endian +	// TODO(gri) go/constant should have a more direct conversion function +	//           (e.g., once it supports a big.Float based implementation) +	for i, j := 0, len(buf)-1; i < j; i, j = i+1, j-1 { +		buf[i], buf[j] = buf[j], buf[i] +	} + +	x := constant.MakeFromBytes(buf) +	if signed && n&1 != 0 { +		x = constant.UnaryOp(token.SUB, x, 0) +	} +	return x +} + +func (r *importReader) mpfloat(b *types.Basic) constant.Value { +	x := r.mpint(b) +	if constant.Sign(x) == 0 { +		return x +	} + +	exp := r.int64() +	switch { +	case exp > 0: +		x = constant.Shift(x, token.SHL, uint(exp)) +		// Ensure that the imported Kind is Float, else this constant may run into +		// bitsize limits on overlarge integers. Eventually we can instead adopt +		// the approach of CL 288632, but that CL relies on go/constant APIs that +		// were introduced in go1.13. +		// +		// TODO(rFindley): sync the logic here with tip Go once we no longer +		// support go1.12. +		x = constant.ToFloat(x) +	case exp < 0: +		d := constant.Shift(constant.MakeInt64(1), token.SHL, uint(-exp)) +		x = constant.BinaryOp(x, token.QUO, d) +	} +	return x +} + +func (r *importReader) ident() string { +	return r.string() +} + +func (r *importReader) qualifiedIdent() (*types.Package, string) { +	name := r.string() +	pkg := r.pkg() +	return pkg, name +} + +func (r *importReader) pos() token.Pos { +	if r.p.version >= 1 { +		r.posv1() +	} else { +		r.posv0() +	} + +	if r.prevFile == "" && r.prevLine == 0 && r.prevColumn == 0 { +		return token.NoPos +	} +	return r.p.fake.pos(r.prevFile, int(r.prevLine), int(r.prevColumn)) +} + +func (r *importReader) posv0() { +	delta := r.int64() +	if delta != deltaNewFile { +		r.prevLine += delta +	} else if l := r.int64(); l == -1 { +		r.prevLine += deltaNewFile +	} else { +		r.prevFile = r.string() +		r.prevLine = l +	} +} + +func (r *importReader) posv1() { +	delta := r.int64() +	r.prevColumn += delta >> 1 +	if delta&1 != 0 { +		delta = r.int64() +		r.prevLine += delta >> 1 +		if delta&1 != 0 { +			r.prevFile = r.string() +		} +	} +} + +func (r *importReader) typ() types.Type { +	return r.p.typAt(r.uint64(), nil) +} + +func isInterface(t types.Type) bool { +	_, ok := t.(*types.Interface) +	return ok +} + +func (r *importReader) pkg() *types.Package { return r.p.pkgAt(r.uint64()) } +func (r *importReader) string() string      { return r.p.stringAt(r.uint64()) } + +func (r *importReader) doType(base *types.Named) types.Type { +	switch k := r.kind(); k { +	default: +		errorf("unexpected kind tag in %q: %v", r.p.ipath, k) +		return nil + +	case definedType: +		pkg, name := r.qualifiedIdent() +		r.p.doDecl(pkg, name) +		return pkg.Scope().Lookup(name).(*types.TypeName).Type() +	case pointerType: +		return types.NewPointer(r.typ()) +	case sliceType: +		return types.NewSlice(r.typ()) +	case arrayType: +		n := r.uint64() +		return types.NewArray(r.typ(), int64(n)) +	case chanType: +		dir := chanDir(int(r.uint64())) +		return types.NewChan(dir, r.typ()) +	case mapType: +		return types.NewMap(r.typ(), r.typ()) +	case signatureType: +		r.currPkg = r.pkg() +		return r.signature(nil) + +	case structType: +		r.currPkg = r.pkg() + +		fields := make([]*types.Var, r.uint64()) +		tags := make([]string, len(fields)) +		for i := range fields { +			fpos := r.pos() +			fname := r.ident() +			ftyp := r.typ() +			emb := r.bool() +			tag := r.string() + +			fields[i] = types.NewField(fpos, r.currPkg, fname, ftyp, emb) +			tags[i] = tag +		} +		return types.NewStruct(fields, tags) + +	case interfaceType: +		r.currPkg = r.pkg() + +		embeddeds := make([]types.Type, r.uint64()) +		for i := range embeddeds { +			_ = r.pos() +			embeddeds[i] = r.typ() +		} + +		methods := make([]*types.Func, r.uint64()) +		for i := range methods { +			mpos := r.pos() +			mname := r.ident() + +			// TODO(mdempsky): Matches bimport.go, but I +			// don't agree with this. +			var recv *types.Var +			if base != nil { +				recv = types.NewVar(token.NoPos, r.currPkg, "", base) +			} + +			msig := r.signature(recv) +			methods[i] = types.NewFunc(mpos, r.currPkg, mname, msig) +		} + +		typ := newInterface(methods, embeddeds) +		r.p.interfaceList = append(r.p.interfaceList, typ) +		return typ +	} +} + +func (r *importReader) kind() itag { +	return itag(r.uint64()) +} + +func (r *importReader) signature(recv *types.Var) *types.Signature { +	params := r.paramList() +	results := r.paramList() +	variadic := params.Len() > 0 && r.bool() +	return types.NewSignature(recv, params, results, variadic) +} + +func (r *importReader) paramList() *types.Tuple { +	xs := make([]*types.Var, r.uint64()) +	for i := range xs { +		xs[i] = r.param() +	} +	return types.NewTuple(xs...) +} + +func (r *importReader) param() *types.Var { +	pos := r.pos() +	name := r.ident() +	typ := r.typ() +	return types.NewParam(pos, r.currPkg, name, typ) +} + +func (r *importReader) bool() bool { +	return r.uint64() != 0 +} + +func (r *importReader) int64() int64 { +	n, err := binary.ReadVarint(&r.declReader) +	if err != nil { +		errorf("readVarint: %v", err) +	} +	return n +} + +func (r *importReader) uint64() uint64 { +	n, err := binary.ReadUvarint(&r.declReader) +	if err != nil { +		errorf("readUvarint: %v", err) +	} +	return n +} + +func (r *importReader) byte() byte { +	x, err := r.declReader.ReadByte() +	if err != nil { +		errorf("declReader.ReadByte: %v", err) +	} +	return x +} diff --git a/vendor/golang.org/x/tools/go/internal/gcimporter/newInterface10.go b/vendor/golang.org/x/tools/go/internal/gcimporter/newInterface10.go new file mode 100644 index 000000000..8b163e3d0 --- /dev/null +++ b/vendor/golang.org/x/tools/go/internal/gcimporter/newInterface10.go @@ -0,0 +1,22 @@ +// 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. + +//go:build !go1.11 +// +build !go1.11 + +package gcimporter + +import "go/types" + +func newInterface(methods []*types.Func, embeddeds []types.Type) *types.Interface { +	named := make([]*types.Named, len(embeddeds)) +	for i, e := range embeddeds { +		var ok bool +		named[i], ok = e.(*types.Named) +		if !ok { +			panic("embedding of non-defined interfaces in interfaces is not supported before Go 1.11") +		} +	} +	return types.NewInterface(methods, named) +} diff --git a/vendor/golang.org/x/tools/go/internal/gcimporter/newInterface11.go b/vendor/golang.org/x/tools/go/internal/gcimporter/newInterface11.go new file mode 100644 index 000000000..49984f40f --- /dev/null +++ b/vendor/golang.org/x/tools/go/internal/gcimporter/newInterface11.go @@ -0,0 +1,14 @@ +// Copyright 2018 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +//go:build go1.11 +// +build go1.11 + +package gcimporter + +import "go/types" + +func newInterface(methods []*types.Func, embeddeds []types.Type) *types.Interface { +	return types.NewInterfaceType(methods, embeddeds) +} diff --git a/vendor/golang.org/x/tools/go/internal/packagesdriver/sizes.go b/vendor/golang.org/x/tools/go/internal/packagesdriver/sizes.go new file mode 100644 index 000000000..18a002f82 --- /dev/null +++ b/vendor/golang.org/x/tools/go/internal/packagesdriver/sizes.go @@ -0,0 +1,49 @@ +// 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 packagesdriver fetches type sizes for go/packages and go/analysis. +package packagesdriver + +import ( +	"context" +	"fmt" +	"go/types" +	"strings" + +	"golang.org/x/tools/internal/gocommand" +) + +var debug = false + +func GetSizesGolist(ctx context.Context, inv gocommand.Invocation, gocmdRunner *gocommand.Runner) (types.Sizes, error) { +	inv.Verb = "list" +	inv.Args = []string{"-f", "{{context.GOARCH}} {{context.Compiler}}", "--", "unsafe"} +	stdout, stderr, friendlyErr, rawErr := gocmdRunner.RunRaw(ctx, inv) +	var goarch, compiler string +	if rawErr != nil { +		if rawErrMsg := rawErr.Error(); strings.Contains(rawErrMsg, "cannot find main module") || strings.Contains(rawErrMsg, "go.mod file not found") { +			// User's running outside of a module. All bets are off. Get GOARCH and guess compiler is gc. +			// TODO(matloob): Is this a problem in practice? +			inv.Verb = "env" +			inv.Args = []string{"GOARCH"} +			envout, enverr := gocmdRunner.Run(ctx, inv) +			if enverr != nil { +				return nil, enverr +			} +			goarch = strings.TrimSpace(envout.String()) +			compiler = "gc" +		} else { +			return nil, friendlyErr +		} +	} else { +		fields := strings.Fields(stdout.String()) +		if len(fields) < 2 { +			return nil, fmt.Errorf("could not parse GOARCH and Go compiler in format \"<GOARCH> <compiler>\":\nstdout: <<%s>>\nstderr: <<%s>>", +				stdout.String(), stderr.String()) +		} +		goarch = fields[0] +		compiler = fields[1] +	} +	return types.SizesFor(compiler, goarch), nil +} diff --git a/vendor/golang.org/x/tools/go/packages/doc.go b/vendor/golang.org/x/tools/go/packages/doc.go new file mode 100644 index 000000000..4bfe28a51 --- /dev/null +++ b/vendor/golang.org/x/tools/go/packages/doc.go @@ -0,0 +1,221 @@ +// 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 packages loads Go packages for inspection and analysis. + +The Load function takes as input a list of patterns and return a list of Package +structs describing individual packages matched by those patterns. +The LoadMode controls the amount of detail in the loaded packages. + +Load passes most patterns directly to the underlying build tool, +but all patterns with the prefix "query=", where query is a +non-empty string of letters from [a-z], are reserved and may be +interpreted as query operators. + +Two query operators are currently supported: "file" and "pattern". + +The query "file=path/to/file.go" matches the package or packages enclosing +the Go source file path/to/file.go.  For example "file=~/go/src/fmt/print.go" +might return the packages "fmt" and "fmt [fmt.test]". + +The query "pattern=string" causes "string" to be passed directly to +the underlying build tool. In most cases this is unnecessary, +but an application can use Load("pattern=" + x) as an escaping mechanism +to ensure that x is not interpreted as a query operator if it contains '='. + +All other query operators are reserved for future use and currently +cause Load to report an error. + +The Package struct provides basic information about the package, including + +  - ID, a unique identifier for the package in the returned set; +  - GoFiles, the names of the package's Go source files; +  - Imports, a map from source import strings to the Packages they name; +  - Types, the type information for the package's exported symbols; +  - Syntax, the parsed syntax trees for the package's source code; and +  - TypeInfo, the result of a complete type-check of the package syntax trees. + +(See the documentation for type Package for the complete list of fields +and more detailed descriptions.) + +For example, + +	Load(nil, "bytes", "unicode...") + +returns four Package structs describing the standard library packages +bytes, unicode, unicode/utf16, and unicode/utf8. Note that one pattern +can match multiple packages and that a package might be matched by +multiple patterns: in general it is not possible to determine which +packages correspond to which patterns. + +Note that the list returned by Load contains only the packages matched +by the patterns. Their dependencies can be found by walking the import +graph using the Imports fields. + +The Load function can be configured by passing a pointer to a Config as +the first argument. A nil Config is equivalent to the zero Config, which +causes Load to run in LoadFiles mode, collecting minimal information. +See the documentation for type Config for details. + +As noted earlier, the Config.Mode controls the amount of detail +reported about the loaded packages. See the documentation for type LoadMode +for details. + +Most tools should pass their command-line arguments (after any flags) +uninterpreted to the loader, so that the loader can interpret them +according to the conventions of the underlying build system. +See the Example function for typical usage. + +*/ +package packages // import "golang.org/x/tools/go/packages" + +/* + +Motivation and design considerations + +The new package's design solves problems addressed by two existing +packages: go/build, which locates and describes packages, and +golang.org/x/tools/go/loader, which loads, parses and type-checks them. +The go/build.Package structure encodes too much of the 'go build' way +of organizing projects, leaving us in need of a data type that describes a +package of Go source code independent of the underlying build system. +We wanted something that works equally well with go build and vgo, and +also other build systems such as Bazel and Blaze, making it possible to +construct analysis tools that work in all these environments. +Tools such as errcheck and staticcheck were essentially unavailable to +the Go community at Google, and some of Google's internal tools for Go +are unavailable externally. +This new package provides a uniform way to obtain package metadata by +querying each of these build systems, optionally supporting their +preferred command-line notations for packages, so that tools integrate +neatly with users' build environments. The Metadata query function +executes an external query tool appropriate to the current workspace. + +Loading packages always returns the complete import graph "all the way down", +even if all you want is information about a single package, because the query +mechanisms of all the build systems we currently support ({go,vgo} list, and +blaze/bazel aspect-based query) cannot provide detailed information +about one package without visiting all its dependencies too, so there is +no additional asymptotic cost to providing transitive information. +(This property might not be true of a hypothetical 5th build system.) + +In calls to TypeCheck, all initial packages, and any package that +transitively depends on one of them, must be loaded from source. +Consider A->B->C->D->E: if A,C are initial, A,B,C must be loaded from +source; D may be loaded from export data, and E may not be loaded at all +(though it's possible that D's export data mentions it, so a +types.Package may be created for it and exposed.) + +The old loader had a feature to suppress type-checking of function +bodies on a per-package basis, primarily intended to reduce the work of +obtaining type information for imported packages. Now that imports are +satisfied by export data, the optimization no longer seems necessary. + +Despite some early attempts, the old loader did not exploit export data, +instead always using the equivalent of WholeProgram mode. This was due +to the complexity of mixing source and export data packages (now +resolved by the upward traversal mentioned above), and because export data +files were nearly always missing or stale. Now that 'go build' supports +caching, all the underlying build systems can guarantee to produce +export data in a reasonable (amortized) time. + +Test "main" packages synthesized by the build system are now reported as +first-class packages, avoiding the need for clients (such as go/ssa) to +reinvent this generation logic. + +One way in which go/packages is simpler than the old loader is in its +treatment of in-package tests. In-package tests are packages that +consist of all the files of the library under test, plus the test files. +The old loader constructed in-package tests by a two-phase process of +mutation called "augmentation": first it would construct and type check +all the ordinary library packages and type-check the packages that +depend on them; then it would add more (test) files to the package and +type-check again. This two-phase approach had four major problems: +1) in processing the tests, the loader modified the library package, +   leaving no way for a client application to see both the test +   package and the library package; one would mutate into the other. +2) because test files can declare additional methods on types defined in +   the library portion of the package, the dispatch of method calls in +   the library portion was affected by the presence of the test files. +   This should have been a clue that the packages were logically +   different. +3) this model of "augmentation" assumed at most one in-package test +   per library package, which is true of projects using 'go build', +   but not other build systems. +4) because of the two-phase nature of test processing, all packages that +   import the library package had to be processed before augmentation, +   forcing a "one-shot" API and preventing the client from calling Load +   in several times in sequence as is now possible in WholeProgram mode. +   (TypeCheck mode has a similar one-shot restriction for a different reason.) + +Early drafts of this package supported "multi-shot" operation. +Although it allowed clients to make a sequence of calls (or concurrent +calls) to Load, building up the graph of Packages incrementally, +it was of marginal value: it complicated the API +(since it allowed some options to vary across calls but not others), +it complicated the implementation, +it cannot be made to work in Types mode, as explained above, +and it was less efficient than making one combined call (when this is possible). +Among the clients we have inspected, none made multiple calls to load +but could not be easily and satisfactorily modified to make only a single call. +However, applications changes may be required. +For example, the ssadump command loads the user-specified packages +and in addition the runtime package.  It is tempting to simply append +"runtime" to the user-provided list, but that does not work if the user +specified an ad-hoc package such as [a.go b.go]. +Instead, ssadump no longer requests the runtime package, +but seeks it among the dependencies of the user-specified packages, +and emits an error if it is not found. + +Overlays: The Overlay field in the Config allows providing alternate contents +for Go source files, by providing a mapping from file path to contents. +go/packages will pull in new imports added in overlay files when go/packages +is run in LoadImports mode or greater. +Overlay support for the go list driver isn't complete yet: if the file doesn't +exist on disk, it will only be recognized in an overlay if it is a non-test file +and the package would be reported even without the overlay. + +Questions & Tasks + +- Add GOARCH/GOOS? +  They are not portable concepts, but could be made portable. +  Our goal has been to allow users to express themselves using the conventions +  of the underlying build system: if the build system honors GOARCH +  during a build and during a metadata query, then so should +  applications built atop that query mechanism. +  Conversely, if the target architecture of the build is determined by +  command-line flags, the application can pass the relevant +  flags through to the build system using a command such as: +    myapp -query_flag="--cpu=amd64" -query_flag="--os=darwin" +  However, this approach is low-level, unwieldy, and non-portable. +  GOOS and GOARCH seem important enough to warrant a dedicated option. + +- How should we handle partial failures such as a mixture of good and +  malformed patterns, existing and non-existent packages, successful and +  failed builds, import failures, import cycles, and so on, in a call to +  Load? + +- Support bazel, blaze, and go1.10 list, not just go1.11 list. + +- Handle (and test) various partial success cases, e.g. +  a mixture of good packages and: +  invalid patterns +  nonexistent packages +  empty packages +  packages with malformed package or import declarations +  unreadable files +  import cycles +  other parse errors +  type errors +  Make sure we record errors at the correct place in the graph. + +- Missing packages among initial arguments are not reported. +  Return bogus packages for them, like golist does. + +- "undeclared name" errors (for example) are reported out of source file +  order. I suspect this is due to the breadth-first resolution now used +  by go/types. Is that a bug? Discuss with gri. + +*/ diff --git a/vendor/golang.org/x/tools/go/packages/external.go b/vendor/golang.org/x/tools/go/packages/external.go new file mode 100644 index 000000000..7242a0a7d --- /dev/null +++ b/vendor/golang.org/x/tools/go/packages/external.go @@ -0,0 +1,101 @@ +// 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 file enables an external tool to intercept package requests. +// If the tool is present then its results are used in preference to +// the go list command. + +package packages + +import ( +	"bytes" +	"encoding/json" +	"fmt" +	exec "golang.org/x/sys/execabs" +	"os" +	"strings" +) + +// The Driver Protocol +// +// The driver, given the inputs to a call to Load, returns metadata about the packages specified. +// This allows for different build systems to support go/packages by telling go/packages how the +// packages' source is organized. +// The driver is a binary, either specified by the GOPACKAGESDRIVER environment variable or in +// the path as gopackagesdriver. It's given the inputs to load in its argv. See the package +// documentation in doc.go for the full description of the patterns that need to be supported. +// A driver receives as a JSON-serialized driverRequest struct in standard input and will +// produce a JSON-serialized driverResponse (see definition in packages.go) in its standard output. + +// driverRequest is used to provide the portion of Load's Config that is needed by a driver. +type driverRequest struct { +	Mode LoadMode `json:"mode"` +	// Env specifies the environment the underlying build system should be run in. +	Env []string `json:"env"` +	// BuildFlags are flags that should be passed to the underlying build system. +	BuildFlags []string `json:"build_flags"` +	// Tests specifies whether the patterns should also return test packages. +	Tests bool `json:"tests"` +	// Overlay maps file paths (relative to the driver's working directory) to the byte contents +	// of overlay files. +	Overlay map[string][]byte `json:"overlay"` +} + +// findExternalDriver returns the file path of a tool that supplies +// the build system package structure, or "" if not found." +// If GOPACKAGESDRIVER is set in the environment findExternalTool returns its +// value, otherwise it searches for a binary named gopackagesdriver on the PATH. +func findExternalDriver(cfg *Config) driver { +	const toolPrefix = "GOPACKAGESDRIVER=" +	tool := "" +	for _, env := range cfg.Env { +		if val := strings.TrimPrefix(env, toolPrefix); val != env { +			tool = val +		} +	} +	if tool != "" && tool == "off" { +		return nil +	} +	if tool == "" { +		var err error +		tool, err = exec.LookPath("gopackagesdriver") +		if err != nil { +			return nil +		} +	} +	return func(cfg *Config, words ...string) (*driverResponse, error) { +		req, err := json.Marshal(driverRequest{ +			Mode:       cfg.Mode, +			Env:        cfg.Env, +			BuildFlags: cfg.BuildFlags, +			Tests:      cfg.Tests, +			Overlay:    cfg.Overlay, +		}) +		if err != nil { +			return nil, fmt.Errorf("failed to encode message to driver tool: %v", err) +		} + +		buf := new(bytes.Buffer) +		stderr := new(bytes.Buffer) +		cmd := exec.CommandContext(cfg.Context, tool, words...) +		cmd.Dir = cfg.Dir +		cmd.Env = cfg.Env +		cmd.Stdin = bytes.NewReader(req) +		cmd.Stdout = buf +		cmd.Stderr = stderr + +		if err := cmd.Run(); err != nil { +			return nil, fmt.Errorf("%v: %v: %s", tool, err, cmd.Stderr) +		} +		if len(stderr.Bytes()) != 0 && os.Getenv("GOPACKAGESPRINTDRIVERERRORS") != "" { +			fmt.Fprintf(os.Stderr, "%s stderr: <<%s>>\n", cmdDebugStr(cmd), stderr) +		} + +		var response driverResponse +		if err := json.Unmarshal(buf.Bytes(), &response); err != nil { +			return nil, err +		} +		return &response, nil +	} +} diff --git a/vendor/golang.org/x/tools/go/packages/golist.go b/vendor/golang.org/x/tools/go/packages/golist.go new file mode 100644 index 000000000..0e1e7f11f --- /dev/null +++ b/vendor/golang.org/x/tools/go/packages/golist.go @@ -0,0 +1,1099 @@ +// 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 packages + +import ( +	"bytes" +	"context" +	"encoding/json" +	"fmt" +	"go/types" +	"io/ioutil" +	"log" +	"os" +	"path" +	"path/filepath" +	"reflect" +	"sort" +	"strconv" +	"strings" +	"sync" +	"unicode" + +	exec "golang.org/x/sys/execabs" +	"golang.org/x/tools/go/internal/packagesdriver" +	"golang.org/x/tools/internal/gocommand" +	"golang.org/x/tools/internal/packagesinternal" +	"golang.org/x/xerrors" +) + +// debug controls verbose logging. +var debug, _ = strconv.ParseBool(os.Getenv("GOPACKAGESDEBUG")) + +// A goTooOldError reports that the go command +// found by exec.LookPath is too old to use the new go list behavior. +type goTooOldError struct { +	error +} + +// responseDeduper wraps a driverResponse, deduplicating its contents. +type responseDeduper struct { +	seenRoots    map[string]bool +	seenPackages map[string]*Package +	dr           *driverResponse +} + +func newDeduper() *responseDeduper { +	return &responseDeduper{ +		dr:           &driverResponse{}, +		seenRoots:    map[string]bool{}, +		seenPackages: map[string]*Package{}, +	} +} + +// addAll fills in r with a driverResponse. +func (r *responseDeduper) addAll(dr *driverResponse) { +	for _, pkg := range dr.Packages { +		r.addPackage(pkg) +	} +	for _, root := range dr.Roots { +		r.addRoot(root) +	} +} + +func (r *responseDeduper) addPackage(p *Package) { +	if r.seenPackages[p.ID] != nil { +		return +	} +	r.seenPackages[p.ID] = p +	r.dr.Packages = append(r.dr.Packages, p) +} + +func (r *responseDeduper) addRoot(id string) { +	if r.seenRoots[id] { +		return +	} +	r.seenRoots[id] = true +	r.dr.Roots = append(r.dr.Roots, id) +} + +type golistState struct { +	cfg *Config +	ctx context.Context + +	envOnce    sync.Once +	goEnvError error +	goEnv      map[string]string + +	rootsOnce     sync.Once +	rootDirsError error +	rootDirs      map[string]string + +	goVersionOnce  sync.Once +	goVersionError error +	goVersion      int // The X in Go 1.X. + +	// vendorDirs caches the (non)existence of vendor directories. +	vendorDirs map[string]bool +} + +// getEnv returns Go environment variables. Only specific variables are +// populated -- computing all of them is slow. +func (state *golistState) getEnv() (map[string]string, error) { +	state.envOnce.Do(func() { +		var b *bytes.Buffer +		b, state.goEnvError = state.invokeGo("env", "-json", "GOMOD", "GOPATH") +		if state.goEnvError != nil { +			return +		} + +		state.goEnv = make(map[string]string) +		decoder := json.NewDecoder(b) +		if state.goEnvError = decoder.Decode(&state.goEnv); state.goEnvError != nil { +			return +		} +	}) +	return state.goEnv, state.goEnvError +} + +// mustGetEnv is a convenience function that can be used if getEnv has already succeeded. +func (state *golistState) mustGetEnv() map[string]string { +	env, err := state.getEnv() +	if err != nil { +		panic(fmt.Sprintf("mustGetEnv: %v", err)) +	} +	return env +} + +// goListDriver uses the go list command to interpret the patterns and produce +// the build system package structure. +// See driver for more details. +func goListDriver(cfg *Config, patterns ...string) (*driverResponse, error) { +	// Make sure that any asynchronous go commands are killed when we return. +	parentCtx := cfg.Context +	if parentCtx == nil { +		parentCtx = context.Background() +	} +	ctx, cancel := context.WithCancel(parentCtx) +	defer cancel() + +	response := newDeduper() + +	state := &golistState{ +		cfg:        cfg, +		ctx:        ctx, +		vendorDirs: map[string]bool{}, +	} + +	// Fill in response.Sizes asynchronously if necessary. +	var sizeserr error +	var sizeswg sync.WaitGroup +	if cfg.Mode&NeedTypesSizes != 0 || cfg.Mode&NeedTypes != 0 { +		sizeswg.Add(1) +		go func() { +			var sizes types.Sizes +			sizes, sizeserr = packagesdriver.GetSizesGolist(ctx, state.cfgInvocation(), cfg.gocmdRunner) +			// types.SizesFor always returns nil or a *types.StdSizes. +			response.dr.Sizes, _ = sizes.(*types.StdSizes) +			sizeswg.Done() +		}() +	} + +	// Determine files requested in contains patterns +	var containFiles []string +	restPatterns := make([]string, 0, len(patterns)) +	// Extract file= and other [querytype]= patterns. Report an error if querytype +	// doesn't exist. +extractQueries: +	for _, pattern := range patterns { +		eqidx := strings.Index(pattern, "=") +		if eqidx < 0 { +			restPatterns = append(restPatterns, pattern) +		} else { +			query, value := pattern[:eqidx], pattern[eqidx+len("="):] +			switch query { +			case "file": +				containFiles = append(containFiles, value) +			case "pattern": +				restPatterns = append(restPatterns, value) +			case "": // not a reserved query +				restPatterns = append(restPatterns, pattern) +			default: +				for _, rune := range query { +					if rune < 'a' || rune > 'z' { // not a reserved query +						restPatterns = append(restPatterns, pattern) +						continue extractQueries +					} +				} +				// Reject all other patterns containing "=" +				return nil, fmt.Errorf("invalid query type %q in query pattern %q", query, pattern) +			} +		} +	} + +	// See if we have any patterns to pass through to go list. Zero initial +	// patterns also requires a go list call, since it's the equivalent of +	// ".". +	if len(restPatterns) > 0 || len(patterns) == 0 { +		dr, err := state.createDriverResponse(restPatterns...) +		if err != nil { +			return nil, err +		} +		response.addAll(dr) +	} + +	if len(containFiles) != 0 { +		if err := state.runContainsQueries(response, containFiles); err != nil { +			return nil, err +		} +	} + +	// Only use go/packages' overlay processing if we're using a Go version +	// below 1.16. Otherwise, go list handles it. +	if goVersion, err := state.getGoVersion(); err == nil && goVersion < 16 { +		modifiedPkgs, needPkgs, err := state.processGolistOverlay(response) +		if err != nil { +			return nil, err +		} + +		var containsCandidates []string +		if len(containFiles) > 0 { +			containsCandidates = append(containsCandidates, modifiedPkgs...) +			containsCandidates = append(containsCandidates, needPkgs...) +		} +		if err := state.addNeededOverlayPackages(response, needPkgs); err != nil { +			return nil, err +		} +		// Check candidate packages for containFiles. +		if len(containFiles) > 0 { +			for _, id := range containsCandidates { +				pkg, ok := response.seenPackages[id] +				if !ok { +					response.addPackage(&Package{ +						ID: id, +						Errors: []Error{{ +							Kind: ListError, +							Msg:  fmt.Sprintf("package %s expected but not seen", id), +						}}, +					}) +					continue +				} +				for _, f := range containFiles { +					for _, g := range pkg.GoFiles { +						if sameFile(f, g) { +							response.addRoot(id) +						} +					} +				} +			} +		} +		// Add root for any package that matches a pattern. This applies only to +		// packages that are modified by overlays, since they are not added as +		// roots automatically. +		for _, pattern := range restPatterns { +			match := matchPattern(pattern) +			for _, pkgID := range modifiedPkgs { +				pkg, ok := response.seenPackages[pkgID] +				if !ok { +					continue +				} +				if match(pkg.PkgPath) { +					response.addRoot(pkg.ID) +				} +			} +		} +	} + +	sizeswg.Wait() +	if sizeserr != nil { +		return nil, sizeserr +	} +	return response.dr, nil +} + +func (state *golistState) addNeededOverlayPackages(response *responseDeduper, pkgs []string) error { +	if len(pkgs) == 0 { +		return nil +	} +	dr, err := state.createDriverResponse(pkgs...) +	if err != nil { +		return err +	} +	for _, pkg := range dr.Packages { +		response.addPackage(pkg) +	} +	_, needPkgs, err := state.processGolistOverlay(response) +	if err != nil { +		return err +	} +	return state.addNeededOverlayPackages(response, needPkgs) +} + +func (state *golistState) runContainsQueries(response *responseDeduper, queries []string) error { +	for _, query := range queries { +		// TODO(matloob): Do only one query per directory. +		fdir := filepath.Dir(query) +		// Pass absolute path of directory to go list so that it knows to treat it as a directory, +		// not a package path. +		pattern, err := filepath.Abs(fdir) +		if err != nil { +			return fmt.Errorf("could not determine absolute path of file= query path %q: %v", query, err) +		} +		dirResponse, err := state.createDriverResponse(pattern) + +		// If there was an error loading the package, or the package is returned +		// with errors, try to load the file as an ad-hoc package. +		// Usually the error will appear in a returned package, but may not if we're +		// in module mode and the ad-hoc is located outside a module. +		if err != nil || len(dirResponse.Packages) == 1 && len(dirResponse.Packages[0].GoFiles) == 0 && +			len(dirResponse.Packages[0].Errors) == 1 { +			var queryErr error +			if dirResponse, queryErr = state.adhocPackage(pattern, query); queryErr != nil { +				return err // return the original error +			} +		} +		isRoot := make(map[string]bool, len(dirResponse.Roots)) +		for _, root := range dirResponse.Roots { +			isRoot[root] = true +		} +		for _, pkg := range dirResponse.Packages { +			// Add any new packages to the main set +			// We don't bother to filter packages that will be dropped by the changes of roots, +			// that will happen anyway during graph construction outside this function. +			// Over-reporting packages is not a problem. +			response.addPackage(pkg) +			// if the package was not a root one, it cannot have the file +			if !isRoot[pkg.ID] { +				continue +			} +			for _, pkgFile := range pkg.GoFiles { +				if filepath.Base(query) == filepath.Base(pkgFile) { +					response.addRoot(pkg.ID) +					break +				} +			} +		} +	} +	return nil +} + +// adhocPackage attempts to load or construct an ad-hoc package for a given +// query, if the original call to the driver produced inadequate results. +func (state *golistState) adhocPackage(pattern, query string) (*driverResponse, error) { +	response, err := state.createDriverResponse(query) +	if err != nil { +		return nil, err +	} +	// If we get nothing back from `go list`, +	// try to make this file into its own ad-hoc package. +	// TODO(rstambler): Should this check against the original response? +	if len(response.Packages) == 0 { +		response.Packages = append(response.Packages, &Package{ +			ID:              "command-line-arguments", +			PkgPath:         query, +			GoFiles:         []string{query}, +			CompiledGoFiles: []string{query}, +			Imports:         make(map[string]*Package), +		}) +		response.Roots = append(response.Roots, "command-line-arguments") +	} +	// Handle special cases. +	if len(response.Packages) == 1 { +		// golang/go#33482: If this is a file= query for ad-hoc packages where +		// the file only exists on an overlay, and exists outside of a module, +		// add the file to the package and remove the errors. +		if response.Packages[0].ID == "command-line-arguments" || +			filepath.ToSlash(response.Packages[0].PkgPath) == filepath.ToSlash(query) { +			if len(response.Packages[0].GoFiles) == 0 { +				filename := filepath.Join(pattern, filepath.Base(query)) // avoid recomputing abspath +				// TODO(matloob): check if the file is outside of a root dir? +				for path := range state.cfg.Overlay { +					if path == filename { +						response.Packages[0].Errors = nil +						response.Packages[0].GoFiles = []string{path} +						response.Packages[0].CompiledGoFiles = []string{path} +					} +				} +			} +		} +	} +	return response, nil +} + +// Fields must match go list; +// see $GOROOT/src/cmd/go/internal/load/pkg.go. +type jsonPackage struct { +	ImportPath        string +	Dir               string +	Name              string +	Export            string +	GoFiles           []string +	CompiledGoFiles   []string +	IgnoredGoFiles    []string +	IgnoredOtherFiles []string +	CFiles            []string +	CgoFiles          []string +	CXXFiles          []string +	MFiles            []string +	HFiles            []string +	FFiles            []string +	SFiles            []string +	SwigFiles         []string +	SwigCXXFiles      []string +	SysoFiles         []string +	Imports           []string +	ImportMap         map[string]string +	Deps              []string +	Module            *Module +	TestGoFiles       []string +	TestImports       []string +	XTestGoFiles      []string +	XTestImports      []string +	ForTest           string // q in a "p [q.test]" package, else "" +	DepOnly           bool + +	Error      *packagesinternal.PackageError +	DepsErrors []*packagesinternal.PackageError +} + +type jsonPackageError struct { +	ImportStack []string +	Pos         string +	Err         string +} + +func otherFiles(p *jsonPackage) [][]string { +	return [][]string{p.CFiles, p.CXXFiles, p.MFiles, p.HFiles, p.FFiles, p.SFiles, p.SwigFiles, p.SwigCXXFiles, p.SysoFiles} +} + +// createDriverResponse uses the "go list" command to expand the pattern +// words and return a response for the specified packages. +func (state *golistState) createDriverResponse(words ...string) (*driverResponse, error) { +	// go list uses the following identifiers in ImportPath and Imports: +	// +	// 	"p"			-- importable package or main (command) +	// 	"q.test"		-- q's test executable +	// 	"p [q.test]"		-- variant of p as built for q's test executable +	// 	"q_test [q.test]"	-- q's external test package +	// +	// The packages p that are built differently for a test q.test +	// are q itself, plus any helpers used by the external test q_test, +	// typically including "testing" and all its dependencies. + +	// Run "go list" for complete +	// information on the specified packages. +	buf, err := state.invokeGo("list", golistargs(state.cfg, words)...) +	if err != nil { +		return nil, err +	} +	seen := make(map[string]*jsonPackage) +	pkgs := make(map[string]*Package) +	additionalErrors := make(map[string][]Error) +	// Decode the JSON and convert it to Package form. +	var response driverResponse +	for dec := json.NewDecoder(buf); dec.More(); { +		p := new(jsonPackage) +		if err := dec.Decode(p); err != nil { +			return nil, fmt.Errorf("JSON decoding failed: %v", err) +		} + +		if p.ImportPath == "" { +			// The documentation for go list says that “[e]rroneous packages will have +			// a non-empty ImportPath”. If for some reason it comes back empty, we +			// prefer to error out rather than silently discarding data or handing +			// back a package without any way to refer to it. +			if p.Error != nil { +				return nil, Error{ +					Pos: p.Error.Pos, +					Msg: p.Error.Err, +				} +			} +			return nil, fmt.Errorf("package missing import path: %+v", p) +		} + +		// Work around https://golang.org/issue/33157: +		// go list -e, when given an absolute path, will find the package contained at +		// that directory. But when no package exists there, it will return a fake package +		// with an error and the ImportPath set to the absolute path provided to go list. +		// Try to convert that absolute path to what its package path would be if it's +		// contained in a known module or GOPATH entry. This will allow the package to be +		// properly "reclaimed" when overlays are processed. +		if filepath.IsAbs(p.ImportPath) && p.Error != nil { +			pkgPath, ok, err := state.getPkgPath(p.ImportPath) +			if err != nil { +				return nil, err +			} +			if ok { +				p.ImportPath = pkgPath +			} +		} + +		if old, found := seen[p.ImportPath]; found { +			// If one version of the package has an error, and the other doesn't, assume +			// that this is a case where go list is reporting a fake dependency variant +			// of the imported package: When a package tries to invalidly import another +			// package, go list emits a variant of the imported package (with the same +			// import path, but with an error on it, and the package will have a +			// DepError set on it). An example of when this can happen is for imports of +			// main packages: main packages can not be imported, but they may be +			// separately matched and listed by another pattern. +			// See golang.org/issue/36188 for more details. + +			// The plan is that eventually, hopefully in Go 1.15, the error will be +			// reported on the importing package rather than the duplicate "fake" +			// version of the imported package. Once all supported versions of Go +			// have the new behavior this logic can be deleted. +			// TODO(matloob): delete the workaround logic once all supported versions of +			// Go return the errors on the proper package. + +			// There should be exactly one version of a package that doesn't have an +			// error. +			if old.Error == nil && p.Error == nil { +				if !reflect.DeepEqual(p, old) { +					return nil, fmt.Errorf("internal error: go list gives conflicting information for package %v", p.ImportPath) +				} +				continue +			} + +			// Determine if this package's error needs to be bubbled up. +			// This is a hack, and we expect for go list to eventually set the error +			// on the package. +			if old.Error != nil { +				var errkind string +				if strings.Contains(old.Error.Err, "not an importable package") { +					errkind = "not an importable package" +				} else if strings.Contains(old.Error.Err, "use of internal package") && strings.Contains(old.Error.Err, "not allowed") { +					errkind = "use of internal package not allowed" +				} +				if errkind != "" { +					if len(old.Error.ImportStack) < 1 { +						return nil, fmt.Errorf(`internal error: go list gave a %q error with empty import stack`, errkind) +					} +					importingPkg := old.Error.ImportStack[len(old.Error.ImportStack)-1] +					if importingPkg == old.ImportPath { +						// Using an older version of Go which put this package itself on top of import +						// stack, instead of the importer. Look for importer in second from top +						// position. +						if len(old.Error.ImportStack) < 2 { +							return nil, fmt.Errorf(`internal error: go list gave a %q error with an import stack without importing package`, errkind) +						} +						importingPkg = old.Error.ImportStack[len(old.Error.ImportStack)-2] +					} +					additionalErrors[importingPkg] = append(additionalErrors[importingPkg], Error{ +						Pos:  old.Error.Pos, +						Msg:  old.Error.Err, +						Kind: ListError, +					}) +				} +			} + +			// Make sure that if there's a version of the package without an error, +			// that's the one reported to the user. +			if old.Error == nil { +				continue +			} + +			// This package will replace the old one at the end of the loop. +		} +		seen[p.ImportPath] = p + +		pkg := &Package{ +			Name:            p.Name, +			ID:              p.ImportPath, +			GoFiles:         absJoin(p.Dir, p.GoFiles, p.CgoFiles), +			CompiledGoFiles: absJoin(p.Dir, p.CompiledGoFiles), +			OtherFiles:      absJoin(p.Dir, otherFiles(p)...), +			IgnoredFiles:    absJoin(p.Dir, p.IgnoredGoFiles, p.IgnoredOtherFiles), +			forTest:         p.ForTest, +			depsErrors:      p.DepsErrors, +			Module:          p.Module, +		} + +		if (state.cfg.Mode&typecheckCgo) != 0 && len(p.CgoFiles) != 0 { +			if len(p.CompiledGoFiles) > len(p.GoFiles) { +				// We need the cgo definitions, which are in the first +				// CompiledGoFile after the non-cgo ones. This is a hack but there +				// isn't currently a better way to find it. We also need the pure +				// Go files and unprocessed cgo files, all of which are already +				// in pkg.GoFiles. +				cgoTypes := p.CompiledGoFiles[len(p.GoFiles)] +				pkg.CompiledGoFiles = append([]string{cgoTypes}, pkg.GoFiles...) +			} else { +				// golang/go#38990: go list silently fails to do cgo processing +				pkg.CompiledGoFiles = nil +				pkg.Errors = append(pkg.Errors, Error{ +					Msg:  "go list failed to return CompiledGoFiles. This may indicate failure to perform cgo processing; try building at the command line. See https://golang.org/issue/38990.", +					Kind: ListError, +				}) +			} +		} + +		// Work around https://golang.org/issue/28749: +		// cmd/go puts assembly, C, and C++ files in CompiledGoFiles. +		// Filter out any elements of CompiledGoFiles that are also in OtherFiles. +		// We have to keep this workaround in place until go1.12 is a distant memory. +		if len(pkg.OtherFiles) > 0 { +			other := make(map[string]bool, len(pkg.OtherFiles)) +			for _, f := range pkg.OtherFiles { +				other[f] = true +			} + +			out := pkg.CompiledGoFiles[:0] +			for _, f := range pkg.CompiledGoFiles { +				if other[f] { +					continue +				} +				out = append(out, f) +			} +			pkg.CompiledGoFiles = out +		} + +		// Extract the PkgPath from the package's ID. +		if i := strings.IndexByte(pkg.ID, ' '); i >= 0 { +			pkg.PkgPath = pkg.ID[:i] +		} else { +			pkg.PkgPath = pkg.ID +		} + +		if pkg.PkgPath == "unsafe" { +			pkg.GoFiles = nil // ignore fake unsafe.go file +		} + +		// Assume go list emits only absolute paths for Dir. +		if p.Dir != "" && !filepath.IsAbs(p.Dir) { +			log.Fatalf("internal error: go list returned non-absolute Package.Dir: %s", p.Dir) +		} + +		if p.Export != "" && !filepath.IsAbs(p.Export) { +			pkg.ExportFile = filepath.Join(p.Dir, p.Export) +		} else { +			pkg.ExportFile = p.Export +		} + +		// imports +		// +		// Imports contains the IDs of all imported packages. +		// ImportsMap records (path, ID) only where they differ. +		ids := make(map[string]bool) +		for _, id := range p.Imports { +			ids[id] = true +		} +		pkg.Imports = make(map[string]*Package) +		for path, id := range p.ImportMap { +			pkg.Imports[path] = &Package{ID: id} // non-identity import +			delete(ids, id) +		} +		for id := range ids { +			if id == "C" { +				continue +			} + +			pkg.Imports[id] = &Package{ID: id} // identity import +		} +		if !p.DepOnly { +			response.Roots = append(response.Roots, pkg.ID) +		} + +		// Work around for pre-go.1.11 versions of go list. +		// TODO(matloob): they should be handled by the fallback. +		// Can we delete this? +		if len(pkg.CompiledGoFiles) == 0 { +			pkg.CompiledGoFiles = pkg.GoFiles +		} + +		// Temporary work-around for golang/go#39986. Parse filenames out of +		// error messages. This happens if there are unrecoverable syntax +		// errors in the source, so we can't match on a specific error message. +		if err := p.Error; err != nil && state.shouldAddFilenameFromError(p) { +			addFilenameFromPos := func(pos string) bool { +				split := strings.Split(pos, ":") +				if len(split) < 1 { +					return false +				} +				filename := strings.TrimSpace(split[0]) +				if filename == "" { +					return false +				} +				if !filepath.IsAbs(filename) { +					filename = filepath.Join(state.cfg.Dir, filename) +				} +				info, _ := os.Stat(filename) +				if info == nil { +					return false +				} +				pkg.CompiledGoFiles = append(pkg.CompiledGoFiles, filename) +				pkg.GoFiles = append(pkg.GoFiles, filename) +				return true +			} +			found := addFilenameFromPos(err.Pos) +			// In some cases, go list only reports the error position in the +			// error text, not the error position. One such case is when the +			// file's package name is a keyword (see golang.org/issue/39763). +			if !found { +				addFilenameFromPos(err.Err) +			} +		} + +		if p.Error != nil { +			msg := strings.TrimSpace(p.Error.Err) // Trim to work around golang.org/issue/32363. +			// Address golang.org/issue/35964 by appending import stack to error message. +			if msg == "import cycle not allowed" && len(p.Error.ImportStack) != 0 { +				msg += fmt.Sprintf(": import stack: %v", p.Error.ImportStack) +			} +			pkg.Errors = append(pkg.Errors, Error{ +				Pos:  p.Error.Pos, +				Msg:  msg, +				Kind: ListError, +			}) +		} + +		pkgs[pkg.ID] = pkg +	} + +	for id, errs := range additionalErrors { +		if p, ok := pkgs[id]; ok { +			p.Errors = append(p.Errors, errs...) +		} +	} +	for _, pkg := range pkgs { +		response.Packages = append(response.Packages, pkg) +	} +	sort.Slice(response.Packages, func(i, j int) bool { return response.Packages[i].ID < response.Packages[j].ID }) + +	return &response, nil +} + +func (state *golistState) shouldAddFilenameFromError(p *jsonPackage) bool { +	if len(p.GoFiles) > 0 || len(p.CompiledGoFiles) > 0 { +		return false +	} + +	goV, err := state.getGoVersion() +	if err != nil { +		return false +	} + +	// On Go 1.14 and earlier, only add filenames from errors if the import stack is empty. +	// The import stack behaves differently for these versions than newer Go versions. +	if goV < 15 { +		return len(p.Error.ImportStack) == 0 +	} + +	// On Go 1.15 and later, only parse filenames out of error if there's no import stack, +	// or the current package is at the top of the import stack. This is not guaranteed +	// to work perfectly, but should avoid some cases where files in errors don't belong to this +	// package. +	return len(p.Error.ImportStack) == 0 || p.Error.ImportStack[len(p.Error.ImportStack)-1] == p.ImportPath +} + +func (state *golistState) getGoVersion() (int, error) { +	state.goVersionOnce.Do(func() { +		state.goVersion, state.goVersionError = gocommand.GoVersion(state.ctx, state.cfgInvocation(), state.cfg.gocmdRunner) +	}) +	return state.goVersion, state.goVersionError +} + +// getPkgPath finds the package path of a directory if it's relative to a root +// directory. +func (state *golistState) getPkgPath(dir string) (string, bool, error) { +	absDir, err := filepath.Abs(dir) +	if err != nil { +		return "", false, err +	} +	roots, err := state.determineRootDirs() +	if err != nil { +		return "", false, err +	} + +	for rdir, rpath := range roots { +		// Make sure that the directory is in the module, +		// to avoid creating a path relative to another module. +		if !strings.HasPrefix(absDir, rdir) { +			continue +		} +		// TODO(matloob): This doesn't properly handle symlinks. +		r, err := filepath.Rel(rdir, dir) +		if err != nil { +			continue +		} +		if rpath != "" { +			// We choose only one root even though the directory even it can belong in multiple modules +			// or GOPATH entries. This is okay because we only need to work with absolute dirs when a +			// file is missing from disk, for instance when gopls calls go/packages in an overlay. +			// Once the file is saved, gopls, or the next invocation of the tool will get the correct +			// result straight from golist. +			// TODO(matloob): Implement module tiebreaking? +			return path.Join(rpath, filepath.ToSlash(r)), true, nil +		} +		return filepath.ToSlash(r), true, nil +	} +	return "", false, nil +} + +// absJoin absolutizes and flattens the lists of files. +func absJoin(dir string, fileses ...[]string) (res []string) { +	for _, files := range fileses { +		for _, file := range files { +			if !filepath.IsAbs(file) { +				file = filepath.Join(dir, file) +			} +			res = append(res, file) +		} +	} +	return res +} + +func golistargs(cfg *Config, words []string) []string { +	const findFlags = NeedImports | NeedTypes | NeedSyntax | NeedTypesInfo +	fullargs := []string{ +		"-e", "-json", +		fmt.Sprintf("-compiled=%t", cfg.Mode&(NeedCompiledGoFiles|NeedSyntax|NeedTypes|NeedTypesInfo|NeedTypesSizes) != 0), +		fmt.Sprintf("-test=%t", cfg.Tests), +		fmt.Sprintf("-export=%t", usesExportData(cfg)), +		fmt.Sprintf("-deps=%t", cfg.Mode&NeedImports != 0), +		// go list doesn't let you pass -test and -find together, +		// probably because you'd just get the TestMain. +		fmt.Sprintf("-find=%t", !cfg.Tests && cfg.Mode&findFlags == 0), +	} +	fullargs = append(fullargs, cfg.BuildFlags...) +	fullargs = append(fullargs, "--") +	fullargs = append(fullargs, words...) +	return fullargs +} + +// cfgInvocation returns an Invocation that reflects cfg's settings. +func (state *golistState) cfgInvocation() gocommand.Invocation { +	cfg := state.cfg +	return gocommand.Invocation{ +		BuildFlags: cfg.BuildFlags, +		ModFile:    cfg.modFile, +		ModFlag:    cfg.modFlag, +		CleanEnv:   cfg.Env != nil, +		Env:        cfg.Env, +		Logf:       cfg.Logf, +		WorkingDir: cfg.Dir, +	} +} + +// invokeGo returns the stdout of a go command invocation. +func (state *golistState) invokeGo(verb string, args ...string) (*bytes.Buffer, error) { +	cfg := state.cfg + +	inv := state.cfgInvocation() + +	// For Go versions 1.16 and above, `go list` accepts overlays directly via +	// the -overlay flag. Set it, if it's available. +	// +	// The check for "list" is not necessarily required, but we should avoid +	// getting the go version if possible. +	if verb == "list" { +		goVersion, err := state.getGoVersion() +		if err != nil { +			return nil, err +		} +		if goVersion >= 16 { +			filename, cleanup, err := state.writeOverlays() +			if err != nil { +				return nil, err +			} +			defer cleanup() +			inv.Overlay = filename +		} +	} +	inv.Verb = verb +	inv.Args = args +	gocmdRunner := cfg.gocmdRunner +	if gocmdRunner == nil { +		gocmdRunner = &gocommand.Runner{} +	} +	stdout, stderr, friendlyErr, err := gocmdRunner.RunRaw(cfg.Context, inv) +	if err != nil { +		// Check for 'go' executable not being found. +		if ee, ok := err.(*exec.Error); ok && ee.Err == exec.ErrNotFound { +			return nil, fmt.Errorf("'go list' driver requires 'go', but %s", exec.ErrNotFound) +		} + +		exitErr, ok := err.(*exec.ExitError) +		if !ok { +			// Catastrophic error: +			// - context cancellation +			return nil, xerrors.Errorf("couldn't run 'go': %w", err) +		} + +		// Old go version? +		if strings.Contains(stderr.String(), "flag provided but not defined") { +			return nil, goTooOldError{fmt.Errorf("unsupported version of go: %s: %s", exitErr, stderr)} +		} + +		// Related to #24854 +		if len(stderr.String()) > 0 && strings.Contains(stderr.String(), "unexpected directory layout") { +			return nil, friendlyErr +		} + +		// Is there an error running the C compiler in cgo? This will be reported in the "Error" field +		// and should be suppressed by go list -e. +		// +		// This condition is not perfect yet because the error message can include other error messages than runtime/cgo. +		isPkgPathRune := func(r rune) bool { +			// From https://golang.org/ref/spec#Import_declarations: +			//    Implementation restriction: A compiler may restrict ImportPaths to non-empty strings +			//    using only characters belonging to Unicode's L, M, N, P, and S general categories +			//    (the Graphic characters without spaces) and may also exclude the +			//    characters !"#$%&'()*,:;<=>?[\]^`{|} and the Unicode replacement character U+FFFD. +			return unicode.IsOneOf([]*unicode.RangeTable{unicode.L, unicode.M, unicode.N, unicode.P, unicode.S}, r) && +				!strings.ContainsRune("!\"#$%&'()*,:;<=>?[\\]^`{|}\uFFFD", r) +		} +		// golang/go#36770: Handle case where cmd/go prints module download messages before the error. +		msg := stderr.String() +		for strings.HasPrefix(msg, "go: downloading") { +			msg = msg[strings.IndexRune(msg, '\n')+1:] +		} +		if len(stderr.String()) > 0 && strings.HasPrefix(stderr.String(), "# ") { +			msg := msg[len("# "):] +			if strings.HasPrefix(strings.TrimLeftFunc(msg, isPkgPathRune), "\n") { +				return stdout, nil +			} +			// Treat pkg-config errors as a special case (golang.org/issue/36770). +			if strings.HasPrefix(msg, "pkg-config") { +				return stdout, nil +			} +		} + +		// This error only appears in stderr. See golang.org/cl/166398 for a fix in go list to show +		// the error in the Err section of stdout in case -e option is provided. +		// This fix is provided for backwards compatibility. +		if len(stderr.String()) > 0 && strings.Contains(stderr.String(), "named files must be .go files") { +			output := fmt.Sprintf(`{"ImportPath": "command-line-arguments","Incomplete": true,"Error": {"Pos": "","Err": %q}}`, +				strings.Trim(stderr.String(), "\n")) +			return bytes.NewBufferString(output), nil +		} + +		// Similar to the previous error, but currently lacks a fix in Go. +		if len(stderr.String()) > 0 && strings.Contains(stderr.String(), "named files must all be in one directory") { +			output := fmt.Sprintf(`{"ImportPath": "command-line-arguments","Incomplete": true,"Error": {"Pos": "","Err": %q}}`, +				strings.Trim(stderr.String(), "\n")) +			return bytes.NewBufferString(output), nil +		} + +		// Backwards compatibility for Go 1.11 because 1.12 and 1.13 put the directory in the ImportPath. +		// If the package doesn't exist, put the absolute path of the directory into the error message, +		// as Go 1.13 list does. +		const noSuchDirectory = "no such directory" +		if len(stderr.String()) > 0 && strings.Contains(stderr.String(), noSuchDirectory) { +			errstr := stderr.String() +			abspath := strings.TrimSpace(errstr[strings.Index(errstr, noSuchDirectory)+len(noSuchDirectory):]) +			output := fmt.Sprintf(`{"ImportPath": %q,"Incomplete": true,"Error": {"Pos": "","Err": %q}}`, +				abspath, strings.Trim(stderr.String(), "\n")) +			return bytes.NewBufferString(output), nil +		} + +		// Workaround for #29280: go list -e has incorrect behavior when an ad-hoc package doesn't exist. +		// Note that the error message we look for in this case is different that the one looked for above. +		if len(stderr.String()) > 0 && strings.Contains(stderr.String(), "no such file or directory") { +			output := fmt.Sprintf(`{"ImportPath": "command-line-arguments","Incomplete": true,"Error": {"Pos": "","Err": %q}}`, +				strings.Trim(stderr.String(), "\n")) +			return bytes.NewBufferString(output), nil +		} + +		// Workaround for #34273. go list -e with GO111MODULE=on has incorrect behavior when listing a +		// directory outside any module. +		if len(stderr.String()) > 0 && strings.Contains(stderr.String(), "outside available modules") { +			output := fmt.Sprintf(`{"ImportPath": %q,"Incomplete": true,"Error": {"Pos": "","Err": %q}}`, +				// TODO(matloob): command-line-arguments isn't correct here. +				"command-line-arguments", strings.Trim(stderr.String(), "\n")) +			return bytes.NewBufferString(output), nil +		} + +		// Another variation of the previous error +		if len(stderr.String()) > 0 && strings.Contains(stderr.String(), "outside module root") { +			output := fmt.Sprintf(`{"ImportPath": %q,"Incomplete": true,"Error": {"Pos": "","Err": %q}}`, +				// TODO(matloob): command-line-arguments isn't correct here. +				"command-line-arguments", strings.Trim(stderr.String(), "\n")) +			return bytes.NewBufferString(output), nil +		} + +		// Workaround for an instance of golang.org/issue/26755: go list -e  will return a non-zero exit +		// status if there's a dependency on a package that doesn't exist. But it should return +		// a zero exit status and set an error on that package. +		if len(stderr.String()) > 0 && strings.Contains(stderr.String(), "no Go files in") { +			// Don't clobber stdout if `go list` actually returned something. +			if len(stdout.String()) > 0 { +				return stdout, nil +			} +			// try to extract package name from string +			stderrStr := stderr.String() +			var importPath string +			colon := strings.Index(stderrStr, ":") +			if colon > 0 && strings.HasPrefix(stderrStr, "go build ") { +				importPath = stderrStr[len("go build "):colon] +			} +			output := fmt.Sprintf(`{"ImportPath": %q,"Incomplete": true,"Error": {"Pos": "","Err": %q}}`, +				importPath, strings.Trim(stderrStr, "\n")) +			return bytes.NewBufferString(output), nil +		} + +		// Export mode entails a build. +		// If that build fails, errors appear on stderr +		// (despite the -e flag) and the Export field is blank. +		// Do not fail in that case. +		// The same is true if an ad-hoc package given to go list doesn't exist. +		// TODO(matloob): Remove these once we can depend on go list to exit with a zero status with -e even when +		// packages don't exist or a build fails. +		if !usesExportData(cfg) && !containsGoFile(args) { +			return nil, friendlyErr +		} +	} +	return stdout, nil +} + +// OverlayJSON is the format overlay files are expected to be in. +// The Replace map maps from overlaid paths to replacement paths: +// the Go command will forward all reads trying to open +// each overlaid path to its replacement path, or consider the overlaid +// path not to exist if the replacement path is empty. +// +// From golang/go#39958. +type OverlayJSON struct { +	Replace map[string]string `json:"replace,omitempty"` +} + +// writeOverlays writes out files for go list's -overlay flag, as described +// above. +func (state *golistState) writeOverlays() (filename string, cleanup func(), err error) { +	// Do nothing if there are no overlays in the config. +	if len(state.cfg.Overlay) == 0 { +		return "", func() {}, nil +	} +	dir, err := ioutil.TempDir("", "gopackages-*") +	if err != nil { +		return "", nil, err +	} +	// The caller must clean up this directory, unless this function returns an +	// error. +	cleanup = func() { +		os.RemoveAll(dir) +	} +	defer func() { +		if err != nil { +			cleanup() +		} +	}() +	overlays := map[string]string{} +	for k, v := range state.cfg.Overlay { +		// Create a unique filename for the overlaid files, to avoid +		// creating nested directories. +		noSeparator := strings.Join(strings.Split(filepath.ToSlash(k), "/"), "") +		f, err := ioutil.TempFile(dir, fmt.Sprintf("*-%s", noSeparator)) +		if err != nil { +			return "", func() {}, err +		} +		if _, err := f.Write(v); err != nil { +			return "", func() {}, err +		} +		if err := f.Close(); err != nil { +			return "", func() {}, err +		} +		overlays[k] = f.Name() +	} +	b, err := json.Marshal(OverlayJSON{Replace: overlays}) +	if err != nil { +		return "", func() {}, err +	} +	// Write out the overlay file that contains the filepath mappings. +	filename = filepath.Join(dir, "overlay.json") +	if err := ioutil.WriteFile(filename, b, 0665); err != nil { +		return "", func() {}, err +	} +	return filename, cleanup, nil +} + +func containsGoFile(s []string) bool { +	for _, f := range s { +		if strings.HasSuffix(f, ".go") { +			return true +		} +	} +	return false +} + +func cmdDebugStr(cmd *exec.Cmd) string { +	env := make(map[string]string) +	for _, kv := range cmd.Env { +		split := strings.SplitN(kv, "=", 2) +		k, v := split[0], split[1] +		env[k] = v +	} + +	var args []string +	for _, arg := range cmd.Args { +		quoted := strconv.Quote(arg) +		if quoted[1:len(quoted)-1] != arg || strings.Contains(arg, " ") { +			args = append(args, quoted) +		} else { +			args = append(args, arg) +		} +	} +	return fmt.Sprintf("GOROOT=%v GOPATH=%v GO111MODULE=%v GOPROXY=%v PWD=%v %v", env["GOROOT"], env["GOPATH"], env["GO111MODULE"], env["GOPROXY"], env["PWD"], strings.Join(args, " ")) +} diff --git a/vendor/golang.org/x/tools/go/packages/golist_overlay.go b/vendor/golang.org/x/tools/go/packages/golist_overlay.go new file mode 100644 index 000000000..9576b472f --- /dev/null +++ b/vendor/golang.org/x/tools/go/packages/golist_overlay.go @@ -0,0 +1,575 @@ +// 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 packages + +import ( +	"encoding/json" +	"fmt" +	"go/parser" +	"go/token" +	"os" +	"path/filepath" +	"regexp" +	"sort" +	"strconv" +	"strings" + +	"golang.org/x/tools/internal/gocommand" +) + +// processGolistOverlay provides rudimentary support for adding +// files that don't exist on disk to an overlay. The results can be +// sometimes incorrect. +// TODO(matloob): Handle unsupported cases, including the following: +// - determining the correct package to add given a new import path +func (state *golistState) processGolistOverlay(response *responseDeduper) (modifiedPkgs, needPkgs []string, err error) { +	havePkgs := make(map[string]string) // importPath -> non-test package ID +	needPkgsSet := make(map[string]bool) +	modifiedPkgsSet := make(map[string]bool) + +	pkgOfDir := make(map[string][]*Package) +	for _, pkg := range response.dr.Packages { +		// This is an approximation of import path to id. This can be +		// wrong for tests, vendored packages, and a number of other cases. +		havePkgs[pkg.PkgPath] = pkg.ID +		dir, err := commonDir(pkg.GoFiles) +		if err != nil { +			return nil, nil, err +		} +		if dir != "" { +			pkgOfDir[dir] = append(pkgOfDir[dir], pkg) +		} +	} + +	// If no new imports are added, it is safe to avoid loading any needPkgs. +	// Otherwise, it's hard to tell which package is actually being loaded +	// (due to vendoring) and whether any modified package will show up +	// in the transitive set of dependencies (because new imports are added, +	// potentially modifying the transitive set of dependencies). +	var overlayAddsImports bool + +	// If both a package and its test package are created by the overlay, we +	// need the real package first. Process all non-test files before test +	// files, and make the whole process deterministic while we're at it. +	var overlayFiles []string +	for opath := range state.cfg.Overlay { +		overlayFiles = append(overlayFiles, opath) +	} +	sort.Slice(overlayFiles, func(i, j int) bool { +		iTest := strings.HasSuffix(overlayFiles[i], "_test.go") +		jTest := strings.HasSuffix(overlayFiles[j], "_test.go") +		if iTest != jTest { +			return !iTest // non-tests are before tests. +		} +		return overlayFiles[i] < overlayFiles[j] +	}) +	for _, opath := range overlayFiles { +		contents := state.cfg.Overlay[opath] +		base := filepath.Base(opath) +		dir := filepath.Dir(opath) +		var pkg *Package           // if opath belongs to both a package and its test variant, this will be the test variant +		var testVariantOf *Package // if opath is a test file, this is the package it is testing +		var fileExists bool +		isTestFile := strings.HasSuffix(opath, "_test.go") +		pkgName, ok := extractPackageName(opath, contents) +		if !ok { +			// Don't bother adding a file that doesn't even have a parsable package statement +			// to the overlay. +			continue +		} +		// If all the overlay files belong to a different package, change the +		// package name to that package. +		maybeFixPackageName(pkgName, isTestFile, pkgOfDir[dir]) +	nextPackage: +		for _, p := range response.dr.Packages { +			if pkgName != p.Name && p.ID != "command-line-arguments" { +				continue +			} +			for _, f := range p.GoFiles { +				if !sameFile(filepath.Dir(f), dir) { +					continue +				} +				// Make sure to capture information on the package's test variant, if needed. +				if isTestFile && !hasTestFiles(p) { +					// TODO(matloob): Are there packages other than the 'production' variant +					// of a package that this can match? This shouldn't match the test main package +					// because the file is generated in another directory. +					testVariantOf = p +					continue nextPackage +				} else if !isTestFile && hasTestFiles(p) { +					// We're examining a test variant, but the overlaid file is +					// a non-test file. Because the overlay implementation +					// (currently) only adds a file to one package, skip this +					// package, so that we can add the file to the production +					// variant of the package. (https://golang.org/issue/36857 +					// tracks handling overlays on both the production and test +					// variant of a package). +					continue nextPackage +				} +				if pkg != nil && p != pkg && pkg.PkgPath == p.PkgPath { +					// We have already seen the production version of the +					// for which p is a test variant. +					if hasTestFiles(p) { +						testVariantOf = pkg +					} +				} +				pkg = p +				if filepath.Base(f) == base { +					fileExists = true +				} +			} +		} +		// The overlay could have included an entirely new package or an +		// ad-hoc package. An ad-hoc package is one that we have manually +		// constructed from inadequate `go list` results for a file= query. +		// It will have the ID command-line-arguments. +		if pkg == nil || pkg.ID == "command-line-arguments" { +			// Try to find the module or gopath dir the file is contained in. +			// Then for modules, add the module opath to the beginning. +			pkgPath, ok, err := state.getPkgPath(dir) +			if err != nil { +				return nil, nil, err +			} +			if !ok { +				break +			} +			var forTest string // only set for x tests +			isXTest := strings.HasSuffix(pkgName, "_test") +			if isXTest { +				forTest = pkgPath +				pkgPath += "_test" +			} +			id := pkgPath +			if isTestFile { +				if isXTest { +					id = fmt.Sprintf("%s [%s.test]", pkgPath, forTest) +				} else { +					id = fmt.Sprintf("%s [%s.test]", pkgPath, pkgPath) +				} +			} +			if pkg != nil { +				// TODO(rstambler): We should change the package's path and ID +				// here. The only issue is that this messes with the roots. +			} else { +				// Try to reclaim a package with the same ID, if it exists in the response. +				for _, p := range response.dr.Packages { +					if reclaimPackage(p, id, opath, contents) { +						pkg = p +						break +					} +				} +				// Otherwise, create a new package. +				if pkg == nil { +					pkg = &Package{ +						PkgPath: pkgPath, +						ID:      id, +						Name:    pkgName, +						Imports: make(map[string]*Package), +					} +					response.addPackage(pkg) +					havePkgs[pkg.PkgPath] = id +					// Add the production package's sources for a test variant. +					if isTestFile && !isXTest && testVariantOf != nil { +						pkg.GoFiles = append(pkg.GoFiles, testVariantOf.GoFiles...) +						pkg.CompiledGoFiles = append(pkg.CompiledGoFiles, testVariantOf.CompiledGoFiles...) +						// Add the package under test and its imports to the test variant. +						pkg.forTest = testVariantOf.PkgPath +						for k, v := range testVariantOf.Imports { +							pkg.Imports[k] = &Package{ID: v.ID} +						} +					} +					if isXTest { +						pkg.forTest = forTest +					} +				} +			} +		} +		if !fileExists { +			pkg.GoFiles = append(pkg.GoFiles, opath) +			// TODO(matloob): Adding the file to CompiledGoFiles can exhibit the wrong behavior +			// if the file will be ignored due to its build tags. +			pkg.CompiledGoFiles = append(pkg.CompiledGoFiles, opath) +			modifiedPkgsSet[pkg.ID] = true +		} +		imports, err := extractImports(opath, contents) +		if err != nil { +			// Let the parser or type checker report errors later. +			continue +		} +		for _, imp := range imports { +			// TODO(rstambler): If the package is an x test and the import has +			// a test variant, make sure to replace it. +			if _, found := pkg.Imports[imp]; found { +				continue +			} +			overlayAddsImports = true +			id, ok := havePkgs[imp] +			if !ok { +				var err error +				id, err = state.resolveImport(dir, imp) +				if err != nil { +					return nil, nil, err +				} +			} +			pkg.Imports[imp] = &Package{ID: id} +			// Add dependencies to the non-test variant version of this package as well. +			if testVariantOf != nil { +				testVariantOf.Imports[imp] = &Package{ID: id} +			} +		} +	} + +	// toPkgPath guesses the package path given the id. +	toPkgPath := func(sourceDir, id string) (string, error) { +		if i := strings.IndexByte(id, ' '); i >= 0 { +			return state.resolveImport(sourceDir, id[:i]) +		} +		return state.resolveImport(sourceDir, id) +	} + +	// Now that new packages have been created, do another pass to determine +	// the new set of missing packages. +	for _, pkg := range response.dr.Packages { +		for _, imp := range pkg.Imports { +			if len(pkg.GoFiles) == 0 { +				return nil, nil, fmt.Errorf("cannot resolve imports for package %q with no Go files", pkg.PkgPath) +			} +			pkgPath, err := toPkgPath(filepath.Dir(pkg.GoFiles[0]), imp.ID) +			if err != nil { +				return nil, nil, err +			} +			if _, ok := havePkgs[pkgPath]; !ok { +				needPkgsSet[pkgPath] = true +			} +		} +	} + +	if overlayAddsImports { +		needPkgs = make([]string, 0, len(needPkgsSet)) +		for pkg := range needPkgsSet { +			needPkgs = append(needPkgs, pkg) +		} +	} +	modifiedPkgs = make([]string, 0, len(modifiedPkgsSet)) +	for pkg := range modifiedPkgsSet { +		modifiedPkgs = append(modifiedPkgs, pkg) +	} +	return modifiedPkgs, needPkgs, err +} + +// resolveImport finds the ID of a package given its import path. +// In particular, it will find the right vendored copy when in GOPATH mode. +func (state *golistState) resolveImport(sourceDir, importPath string) (string, error) { +	env, err := state.getEnv() +	if err != nil { +		return "", err +	} +	if env["GOMOD"] != "" { +		return importPath, nil +	} + +	searchDir := sourceDir +	for { +		vendorDir := filepath.Join(searchDir, "vendor") +		exists, ok := state.vendorDirs[vendorDir] +		if !ok { +			info, err := os.Stat(vendorDir) +			exists = err == nil && info.IsDir() +			state.vendorDirs[vendorDir] = exists +		} + +		if exists { +			vendoredPath := filepath.Join(vendorDir, importPath) +			if info, err := os.Stat(vendoredPath); err == nil && info.IsDir() { +				// We should probably check for .go files here, but shame on anyone who fools us. +				path, ok, err := state.getPkgPath(vendoredPath) +				if err != nil { +					return "", err +				} +				if ok { +					return path, nil +				} +			} +		} + +		// We know we've hit the top of the filesystem when we Dir / and get /, +		// or C:\ and get C:\, etc. +		next := filepath.Dir(searchDir) +		if next == searchDir { +			break +		} +		searchDir = next +	} +	return importPath, nil +} + +func hasTestFiles(p *Package) bool { +	for _, f := range p.GoFiles { +		if strings.HasSuffix(f, "_test.go") { +			return true +		} +	} +	return false +} + +// determineRootDirs returns a mapping from absolute directories that could +// contain code to their corresponding import path prefixes. +func (state *golistState) determineRootDirs() (map[string]string, error) { +	env, err := state.getEnv() +	if err != nil { +		return nil, err +	} +	if env["GOMOD"] != "" { +		state.rootsOnce.Do(func() { +			state.rootDirs, state.rootDirsError = state.determineRootDirsModules() +		}) +	} else { +		state.rootsOnce.Do(func() { +			state.rootDirs, state.rootDirsError = state.determineRootDirsGOPATH() +		}) +	} +	return state.rootDirs, state.rootDirsError +} + +func (state *golistState) determineRootDirsModules() (map[string]string, error) { +	// List all of the modules--the first will be the directory for the main +	// module. Any replaced modules will also need to be treated as roots. +	// Editing files in the module cache isn't a great idea, so we don't +	// plan to ever support that. +	out, err := state.invokeGo("list", "-m", "-json", "all") +	if err != nil { +		// 'go list all' will fail if we're outside of a module and +		// GO111MODULE=on. Try falling back without 'all'. +		var innerErr error +		out, innerErr = state.invokeGo("list", "-m", "-json") +		if innerErr != nil { +			return nil, err +		} +	} +	roots := map[string]string{} +	modules := map[string]string{} +	var i int +	for dec := json.NewDecoder(out); dec.More(); { +		mod := new(gocommand.ModuleJSON) +		if err := dec.Decode(mod); err != nil { +			return nil, err +		} +		if mod.Dir != "" && mod.Path != "" { +			// This is a valid module; add it to the map. +			absDir, err := filepath.Abs(mod.Dir) +			if err != nil { +				return nil, err +			} +			modules[absDir] = mod.Path +			// The first result is the main module. +			if i == 0 || mod.Replace != nil && mod.Replace.Path != "" { +				roots[absDir] = mod.Path +			} +		} +		i++ +	} +	return roots, nil +} + +func (state *golistState) determineRootDirsGOPATH() (map[string]string, error) { +	m := map[string]string{} +	for _, dir := range filepath.SplitList(state.mustGetEnv()["GOPATH"]) { +		absDir, err := filepath.Abs(dir) +		if err != nil { +			return nil, err +		} +		m[filepath.Join(absDir, "src")] = "" +	} +	return m, nil +} + +func extractImports(filename string, contents []byte) ([]string, error) { +	f, err := parser.ParseFile(token.NewFileSet(), filename, contents, parser.ImportsOnly) // TODO(matloob): reuse fileset? +	if err != nil { +		return nil, err +	} +	var res []string +	for _, imp := range f.Imports { +		quotedPath := imp.Path.Value +		path, err := strconv.Unquote(quotedPath) +		if err != nil { +			return nil, err +		} +		res = append(res, path) +	} +	return res, nil +} + +// reclaimPackage attempts to reuse a package that failed to load in an overlay. +// +// If the package has errors and has no Name, GoFiles, or Imports, +// then it's possible that it doesn't yet exist on disk. +func reclaimPackage(pkg *Package, id string, filename string, contents []byte) bool { +	// TODO(rstambler): Check the message of the actual error? +	// It differs between $GOPATH and module mode. +	if pkg.ID != id { +		return false +	} +	if len(pkg.Errors) != 1 { +		return false +	} +	if pkg.Name != "" || pkg.ExportFile != "" { +		return false +	} +	if len(pkg.GoFiles) > 0 || len(pkg.CompiledGoFiles) > 0 || len(pkg.OtherFiles) > 0 { +		return false +	} +	if len(pkg.Imports) > 0 { +		return false +	} +	pkgName, ok := extractPackageName(filename, contents) +	if !ok { +		return false +	} +	pkg.Name = pkgName +	pkg.Errors = nil +	return true +} + +func extractPackageName(filename string, contents []byte) (string, bool) { +	// TODO(rstambler): Check the message of the actual error? +	// It differs between $GOPATH and module mode. +	f, err := parser.ParseFile(token.NewFileSet(), filename, contents, parser.PackageClauseOnly) // TODO(matloob): reuse fileset? +	if err != nil { +		return "", false +	} +	return f.Name.Name, true +} + +// commonDir returns the directory that all files are in, "" if files is empty, +// or an error if they aren't in the same directory. +func commonDir(files []string) (string, error) { +	seen := make(map[string]bool) +	for _, f := range files { +		seen[filepath.Dir(f)] = true +	} +	if len(seen) > 1 { +		return "", fmt.Errorf("files (%v) are in more than one directory: %v", files, seen) +	} +	for k := range seen { +		// seen has only one element; return it. +		return k, nil +	} +	return "", nil // no files +} + +// It is possible that the files in the disk directory dir have a different package +// name from newName, which is deduced from the overlays. If they all have a different +// package name, and they all have the same package name, then that name becomes +// the package name. +// It returns true if it changes the package name, false otherwise. +func maybeFixPackageName(newName string, isTestFile bool, pkgsOfDir []*Package) { +	names := make(map[string]int) +	for _, p := range pkgsOfDir { +		names[p.Name]++ +	} +	if len(names) != 1 { +		// some files are in different packages +		return +	} +	var oldName string +	for k := range names { +		oldName = k +	} +	if newName == oldName { +		return +	} +	// We might have a case where all of the package names in the directory are +	// the same, but the overlay file is for an x test, which belongs to its +	// own package. If the x test does not yet exist on disk, we may not yet +	// have its package name on disk, but we should not rename the packages. +	// +	// We use a heuristic to determine if this file belongs to an x test: +	// The test file should have a package name whose package name has a _test +	// suffix or looks like "newName_test". +	maybeXTest := strings.HasPrefix(oldName+"_test", newName) || strings.HasSuffix(newName, "_test") +	if isTestFile && maybeXTest { +		return +	} +	for _, p := range pkgsOfDir { +		p.Name = newName +	} +} + +// This function is copy-pasted from +// https://github.com/golang/go/blob/9706f510a5e2754595d716bd64be8375997311fb/src/cmd/go/internal/search/search.go#L360. +// It should be deleted when we remove support for overlays from go/packages. +// +// NOTE: This does not handle any ./... or ./ style queries, as this function +// doesn't know the working directory. +// +// matchPattern(pattern)(name) reports whether +// name matches pattern. Pattern is a limited glob +// pattern in which '...' means 'any string' and there +// is no other special syntax. +// Unfortunately, there are two special cases. Quoting "go help packages": +// +// First, /... at the end of the pattern can match an empty string, +// so that net/... matches both net and packages in its subdirectories, like net/http. +// Second, any slash-separated pattern element containing a wildcard never +// participates in a match of the "vendor" element in the path of a vendored +// package, so that ./... does not match packages in subdirectories of +// ./vendor or ./mycode/vendor, but ./vendor/... and ./mycode/vendor/... do. +// Note, however, that a directory named vendor that itself contains code +// is not a vendored package: cmd/vendor would be a command named vendor, +// and the pattern cmd/... matches it. +func matchPattern(pattern string) func(name string) bool { +	// Convert pattern to regular expression. +	// The strategy for the trailing /... is to nest it in an explicit ? expression. +	// The strategy for the vendor exclusion is to change the unmatchable +	// vendor strings to a disallowed code point (vendorChar) and to use +	// "(anything but that codepoint)*" as the implementation of the ... wildcard. +	// This is a bit complicated but the obvious alternative, +	// namely a hand-written search like in most shell glob matchers, +	// is too easy to make accidentally exponential. +	// Using package regexp guarantees linear-time matching. + +	const vendorChar = "\x00" + +	if strings.Contains(pattern, vendorChar) { +		return func(name string) bool { return false } +	} + +	re := regexp.QuoteMeta(pattern) +	re = replaceVendor(re, vendorChar) +	switch { +	case strings.HasSuffix(re, `/`+vendorChar+`/\.\.\.`): +		re = strings.TrimSuffix(re, `/`+vendorChar+`/\.\.\.`) + `(/vendor|/` + vendorChar + `/\.\.\.)` +	case re == vendorChar+`/\.\.\.`: +		re = `(/vendor|/` + vendorChar + `/\.\.\.)` +	case strings.HasSuffix(re, `/\.\.\.`): +		re = strings.TrimSuffix(re, `/\.\.\.`) + `(/\.\.\.)?` +	} +	re = strings.ReplaceAll(re, `\.\.\.`, `[^`+vendorChar+`]*`) + +	reg := regexp.MustCompile(`^` + re + `$`) + +	return func(name string) bool { +		if strings.Contains(name, vendorChar) { +			return false +		} +		return reg.MatchString(replaceVendor(name, vendorChar)) +	} +} + +// replaceVendor returns the result of replacing +// non-trailing vendor path elements in x with repl. +func replaceVendor(x, repl string) string { +	if !strings.Contains(x, "vendor") { +		return x +	} +	elem := strings.Split(x, "/") +	for i := 0; i < len(elem)-1; i++ { +		if elem[i] == "vendor" { +			elem[i] = repl +		} +	} +	return strings.Join(elem, "/") +} diff --git a/vendor/golang.org/x/tools/go/packages/loadmode_string.go b/vendor/golang.org/x/tools/go/packages/loadmode_string.go new file mode 100644 index 000000000..7ea37e7ee --- /dev/null +++ b/vendor/golang.org/x/tools/go/packages/loadmode_string.go @@ -0,0 +1,57 @@ +// 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 packages + +import ( +	"fmt" +	"strings" +) + +var allModes = []LoadMode{ +	NeedName, +	NeedFiles, +	NeedCompiledGoFiles, +	NeedImports, +	NeedDeps, +	NeedExportsFile, +	NeedTypes, +	NeedSyntax, +	NeedTypesInfo, +	NeedTypesSizes, +} + +var modeStrings = []string{ +	"NeedName", +	"NeedFiles", +	"NeedCompiledGoFiles", +	"NeedImports", +	"NeedDeps", +	"NeedExportsFile", +	"NeedTypes", +	"NeedSyntax", +	"NeedTypesInfo", +	"NeedTypesSizes", +} + +func (mod LoadMode) String() string { +	m := mod +	if m == 0 { +		return "LoadMode(0)" +	} +	var out []string +	for i, x := range allModes { +		if x > m { +			break +		} +		if (m & x) != 0 { +			out = append(out, modeStrings[i]) +			m = m ^ x +		} +	} +	if m != 0 { +		out = append(out, "Unknown") +	} +	return fmt.Sprintf("LoadMode(%s)", strings.Join(out, "|")) +} diff --git a/vendor/golang.org/x/tools/go/packages/packages.go b/vendor/golang.org/x/tools/go/packages/packages.go new file mode 100644 index 000000000..8a1a2d681 --- /dev/null +++ b/vendor/golang.org/x/tools/go/packages/packages.go @@ -0,0 +1,1239 @@ +// 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 packages + +// See doc.go for package documentation and implementation notes. + +import ( +	"context" +	"encoding/json" +	"fmt" +	"go/ast" +	"go/parser" +	"go/scanner" +	"go/token" +	"go/types" +	"io/ioutil" +	"log" +	"os" +	"path/filepath" +	"strings" +	"sync" +	"time" + +	"golang.org/x/tools/go/gcexportdata" +	"golang.org/x/tools/internal/gocommand" +	"golang.org/x/tools/internal/packagesinternal" +	"golang.org/x/tools/internal/typesinternal" +) + +// A LoadMode controls the amount of detail to return when loading. +// The bits below can be combined to specify which fields should be +// filled in the result packages. +// The zero value is a special case, equivalent to combining +// the NeedName, NeedFiles, and NeedCompiledGoFiles bits. +// ID and Errors (if present) will always be filled. +// Load may return more information than requested. +type LoadMode int + +// TODO(matloob): When a V2 of go/packages is released, rename NeedExportsFile to +// NeedExportFile to make it consistent with the Package field it's adding. + +const ( +	// NeedName adds Name and PkgPath. +	NeedName LoadMode = 1 << iota + +	// NeedFiles adds GoFiles and OtherFiles. +	NeedFiles + +	// NeedCompiledGoFiles adds CompiledGoFiles. +	NeedCompiledGoFiles + +	// NeedImports adds Imports. If NeedDeps is not set, the Imports field will contain +	// "placeholder" Packages with only the ID set. +	NeedImports + +	// NeedDeps adds the fields requested by the LoadMode in the packages in Imports. +	NeedDeps + +	// NeedExportsFile adds ExportFile. +	NeedExportsFile + +	// NeedTypes adds Types, Fset, and IllTyped. +	NeedTypes + +	// NeedSyntax adds Syntax. +	NeedSyntax + +	// NeedTypesInfo adds TypesInfo. +	NeedTypesInfo + +	// NeedTypesSizes adds TypesSizes. +	NeedTypesSizes + +	// typecheckCgo enables full support for type checking cgo. Requires Go 1.15+. +	// Modifies CompiledGoFiles and Types, and has no effect on its own. +	typecheckCgo + +	// NeedModule adds Module. +	NeedModule +) + +const ( +	// Deprecated: LoadFiles exists for historical compatibility +	// and should not be used. Please directly specify the needed fields using the Need values. +	LoadFiles = NeedName | NeedFiles | NeedCompiledGoFiles + +	// Deprecated: LoadImports exists for historical compatibility +	// and should not be used. Please directly specify the needed fields using the Need values. +	LoadImports = LoadFiles | NeedImports + +	// Deprecated: LoadTypes exists for historical compatibility +	// and should not be used. Please directly specify the needed fields using the Need values. +	LoadTypes = LoadImports | NeedTypes | NeedTypesSizes + +	// Deprecated: LoadSyntax exists for historical compatibility +	// and should not be used. Please directly specify the needed fields using the Need values. +	LoadSyntax = LoadTypes | NeedSyntax | NeedTypesInfo + +	// Deprecated: LoadAllSyntax exists for historical compatibility +	// and should not be used. Please directly specify the needed fields using the Need values. +	LoadAllSyntax = LoadSyntax | NeedDeps +) + +// A Config specifies details about how packages should be loaded. +// The zero value is a valid configuration. +// Calls to Load do not modify this struct. +type Config struct { +	// Mode controls the level of information returned for each package. +	Mode LoadMode + +	// Context specifies the context for the load operation. +	// If the context is cancelled, the loader may stop early +	// and return an ErrCancelled error. +	// If Context is nil, the load cannot be cancelled. +	Context context.Context + +	// Logf is the logger for the config. +	// If the user provides a logger, debug logging is enabled. +	// If the GOPACKAGESDEBUG environment variable is set to true, +	// but the logger is nil, default to log.Printf. +	Logf func(format string, args ...interface{}) + +	// Dir is the directory in which to run the build system's query tool +	// that provides information about the packages. +	// If Dir is empty, the tool is run in the current directory. +	Dir string + +	// Env is the environment to use when invoking the build system's query tool. +	// If Env is nil, the current environment is used. +	// As in os/exec's Cmd, only the last value in the slice for +	// each environment key is used. To specify the setting of only +	// a few variables, append to the current environment, as in: +	// +	//	opt.Env = append(os.Environ(), "GOOS=plan9", "GOARCH=386") +	// +	Env []string + +	// gocmdRunner guards go command calls from concurrency errors. +	gocmdRunner *gocommand.Runner + +	// BuildFlags is a list of command-line flags to be passed through to +	// the build system's query tool. +	BuildFlags []string + +	// modFile will be used for -modfile in go command invocations. +	modFile string + +	// modFlag will be used for -modfile in go command invocations. +	modFlag string + +	// Fset provides source position information for syntax trees and types. +	// If Fset is nil, Load will use a new fileset, but preserve Fset's value. +	Fset *token.FileSet + +	// ParseFile is called to read and parse each file +	// when preparing a package's type-checked syntax tree. +	// It must be safe to call ParseFile simultaneously from multiple goroutines. +	// If ParseFile is nil, the loader will uses parser.ParseFile. +	// +	// ParseFile should parse the source from src and use filename only for +	// recording position information. +	// +	// An application may supply a custom implementation of ParseFile +	// to change the effective file contents or the behavior of the parser, +	// or to modify the syntax tree. For example, selectively eliminating +	// unwanted function bodies can significantly accelerate type checking. +	ParseFile func(fset *token.FileSet, filename string, src []byte) (*ast.File, error) + +	// If Tests is set, the loader includes not just the packages +	// matching a particular pattern but also any related test packages, +	// including test-only variants of the package and the test executable. +	// +	// For example, when using the go command, loading "fmt" with Tests=true +	// returns four packages, with IDs "fmt" (the standard package), +	// "fmt [fmt.test]" (the package as compiled for the test), +	// "fmt_test" (the test functions from source files in package fmt_test), +	// and "fmt.test" (the test binary). +	// +	// In build systems with explicit names for tests, +	// setting Tests may have no effect. +	Tests bool + +	// Overlay provides a mapping of absolute file paths to file contents. +	// If the file with the given path already exists, the parser will use the +	// alternative file contents provided by the map. +	// +	// Overlays provide incomplete support for when a given file doesn't +	// already exist on disk. See the package doc above for more details. +	Overlay map[string][]byte +} + +// driver is the type for functions that query the build system for the +// packages named by the patterns. +type driver func(cfg *Config, patterns ...string) (*driverResponse, error) + +// driverResponse contains the results for a driver query. +type driverResponse struct { +	// NotHandled is returned if the request can't be handled by the current +	// driver. If an external driver returns a response with NotHandled, the +	// rest of the driverResponse is ignored, and go/packages will fallback +	// to the next driver. If go/packages is extended in the future to support +	// lists of multiple drivers, go/packages will fall back to the next driver. +	NotHandled bool + +	// Sizes, if not nil, is the types.Sizes to use when type checking. +	Sizes *types.StdSizes + +	// Roots is the set of package IDs that make up the root packages. +	// We have to encode this separately because when we encode a single package +	// we cannot know if it is one of the roots as that requires knowledge of the +	// graph it is part of. +	Roots []string `json:",omitempty"` + +	// Packages is the full set of packages in the graph. +	// The packages are not connected into a graph. +	// The Imports if populated will be stubs that only have their ID set. +	// Imports will be connected and then type and syntax information added in a +	// later pass (see refine). +	Packages []*Package +} + +// Load loads and returns the Go packages named by the given patterns. +// +// Config specifies loading options; +// nil behaves the same as an empty Config. +// +// Load returns an error if any of the patterns was invalid +// as defined by the underlying build system. +// It may return an empty list of packages without an error, +// for instance for an empty expansion of a valid wildcard. +// Errors associated with a particular package are recorded in the +// corresponding Package's Errors list, and do not cause Load to +// return an error. Clients may need to handle such errors before +// proceeding with further analysis. The PrintErrors function is +// provided for convenient display of all errors. +func Load(cfg *Config, patterns ...string) ([]*Package, error) { +	l := newLoader(cfg) +	response, err := defaultDriver(&l.Config, patterns...) +	if err != nil { +		return nil, err +	} +	l.sizes = response.Sizes +	return l.refine(response.Roots, response.Packages...) +} + +// defaultDriver is a driver that implements go/packages' fallback behavior. +// It will try to request to an external driver, if one exists. If there's +// no external driver, or the driver returns a response with NotHandled set, +// defaultDriver will fall back to the go list driver. +func defaultDriver(cfg *Config, patterns ...string) (*driverResponse, error) { +	driver := findExternalDriver(cfg) +	if driver == nil { +		driver = goListDriver +	} +	response, err := driver(cfg, patterns...) +	if err != nil { +		return response, err +	} else if response.NotHandled { +		return goListDriver(cfg, patterns...) +	} +	return response, nil +} + +// A Package describes a loaded Go package. +type Package struct { +	// ID is a unique identifier for a package, +	// in a syntax provided by the underlying build system. +	// +	// Because the syntax varies based on the build system, +	// clients should treat IDs as opaque and not attempt to +	// interpret them. +	ID string + +	// Name is the package name as it appears in the package source code. +	Name string + +	// PkgPath is the package path as used by the go/types package. +	PkgPath string + +	// Errors contains any errors encountered querying the metadata +	// of the package, or while parsing or type-checking its files. +	Errors []Error + +	// GoFiles lists the absolute file paths of the package's Go source files. +	GoFiles []string + +	// CompiledGoFiles lists the absolute file paths of the package's source +	// files that are suitable for type checking. +	// This may differ from GoFiles if files are processed before compilation. +	CompiledGoFiles []string + +	// OtherFiles lists the absolute file paths of the package's non-Go source files, +	// including assembly, C, C++, Fortran, Objective-C, SWIG, and so on. +	OtherFiles []string + +	// IgnoredFiles lists source files that are not part of the package +	// using the current build configuration but that might be part of +	// the package using other build configurations. +	IgnoredFiles []string + +	// ExportFile is the absolute path to a file containing type +	// information for the package as provided by the build system. +	ExportFile string + +	// Imports maps import paths appearing in the package's Go source files +	// to corresponding loaded Packages. +	Imports map[string]*Package + +	// Types provides type information for the package. +	// The NeedTypes LoadMode bit sets this field for packages matching the +	// patterns; type information for dependencies may be missing or incomplete, +	// unless NeedDeps and NeedImports are also set. +	Types *types.Package + +	// Fset provides position information for Types, TypesInfo, and Syntax. +	// It is set only when Types is set. +	Fset *token.FileSet + +	// IllTyped indicates whether the package or any dependency contains errors. +	// It is set only when Types is set. +	IllTyped bool + +	// Syntax is the package's syntax trees, for the files listed in CompiledGoFiles. +	// +	// The NeedSyntax LoadMode bit populates this field for packages matching the patterns. +	// If NeedDeps and NeedImports are also set, this field will also be populated +	// for dependencies. +	Syntax []*ast.File + +	// TypesInfo provides type information about the package's syntax trees. +	// It is set only when Syntax is set. +	TypesInfo *types.Info + +	// TypesSizes provides the effective size function for types in TypesInfo. +	TypesSizes types.Sizes + +	// forTest is the package under test, if any. +	forTest string + +	// depsErrors is the DepsErrors field from the go list response, if any. +	depsErrors []*packagesinternal.PackageError + +	// module is the module information for the package if it exists. +	Module *Module +} + +// Module provides module information for a package. +type Module struct { +	Path      string       // module path +	Version   string       // module version +	Replace   *Module      // replaced by this module +	Time      *time.Time   // time version was created +	Main      bool         // is this the main module? +	Indirect  bool         // is this module only an indirect dependency of main module? +	Dir       string       // directory holding files for this module, if any +	GoMod     string       // path to go.mod file used when loading this module, if any +	GoVersion string       // go version used in module +	Error     *ModuleError // error loading module +} + +// ModuleError holds errors loading a module. +type ModuleError struct { +	Err string // the error itself +} + +func init() { +	packagesinternal.GetForTest = func(p interface{}) string { +		return p.(*Package).forTest +	} +	packagesinternal.GetDepsErrors = func(p interface{}) []*packagesinternal.PackageError { +		return p.(*Package).depsErrors +	} +	packagesinternal.GetGoCmdRunner = func(config interface{}) *gocommand.Runner { +		return config.(*Config).gocmdRunner +	} +	packagesinternal.SetGoCmdRunner = func(config interface{}, runner *gocommand.Runner) { +		config.(*Config).gocmdRunner = runner +	} +	packagesinternal.SetModFile = func(config interface{}, value string) { +		config.(*Config).modFile = value +	} +	packagesinternal.SetModFlag = func(config interface{}, value string) { +		config.(*Config).modFlag = value +	} +	packagesinternal.TypecheckCgo = int(typecheckCgo) +} + +// An Error describes a problem with a package's metadata, syntax, or types. +type Error struct { +	Pos  string // "file:line:col" or "file:line" or "" or "-" +	Msg  string +	Kind ErrorKind +} + +// ErrorKind describes the source of the error, allowing the user to +// differentiate between errors generated by the driver, the parser, or the +// type-checker. +type ErrorKind int + +const ( +	UnknownError ErrorKind = iota +	ListError +	ParseError +	TypeError +) + +func (err Error) Error() string { +	pos := err.Pos +	if pos == "" { +		pos = "-" // like token.Position{}.String() +	} +	return pos + ": " + err.Msg +} + +// flatPackage is the JSON form of Package +// It drops all the type and syntax fields, and transforms the Imports +// +// TODO(adonovan): identify this struct with Package, effectively +// publishing the JSON protocol. +type flatPackage struct { +	ID              string +	Name            string            `json:",omitempty"` +	PkgPath         string            `json:",omitempty"` +	Errors          []Error           `json:",omitempty"` +	GoFiles         []string          `json:",omitempty"` +	CompiledGoFiles []string          `json:",omitempty"` +	OtherFiles      []string          `json:",omitempty"` +	IgnoredFiles    []string          `json:",omitempty"` +	ExportFile      string            `json:",omitempty"` +	Imports         map[string]string `json:",omitempty"` +} + +// MarshalJSON returns the Package in its JSON form. +// For the most part, the structure fields are written out unmodified, and +// the type and syntax fields are skipped. +// The imports are written out as just a map of path to package id. +// The errors are written using a custom type that tries to preserve the +// structure of error types we know about. +// +// This method exists to enable support for additional build systems.  It is +// not intended for use by clients of the API and we may change the format. +func (p *Package) MarshalJSON() ([]byte, error) { +	flat := &flatPackage{ +		ID:              p.ID, +		Name:            p.Name, +		PkgPath:         p.PkgPath, +		Errors:          p.Errors, +		GoFiles:         p.GoFiles, +		CompiledGoFiles: p.CompiledGoFiles, +		OtherFiles:      p.OtherFiles, +		IgnoredFiles:    p.IgnoredFiles, +		ExportFile:      p.ExportFile, +	} +	if len(p.Imports) > 0 { +		flat.Imports = make(map[string]string, len(p.Imports)) +		for path, ipkg := range p.Imports { +			flat.Imports[path] = ipkg.ID +		} +	} +	return json.Marshal(flat) +} + +// UnmarshalJSON reads in a Package from its JSON format. +// See MarshalJSON for details about the format accepted. +func (p *Package) UnmarshalJSON(b []byte) error { +	flat := &flatPackage{} +	if err := json.Unmarshal(b, &flat); err != nil { +		return err +	} +	*p = Package{ +		ID:              flat.ID, +		Name:            flat.Name, +		PkgPath:         flat.PkgPath, +		Errors:          flat.Errors, +		GoFiles:         flat.GoFiles, +		CompiledGoFiles: flat.CompiledGoFiles, +		OtherFiles:      flat.OtherFiles, +		ExportFile:      flat.ExportFile, +	} +	if len(flat.Imports) > 0 { +		p.Imports = make(map[string]*Package, len(flat.Imports)) +		for path, id := range flat.Imports { +			p.Imports[path] = &Package{ID: id} +		} +	} +	return nil +} + +func (p *Package) String() string { return p.ID } + +// loaderPackage augments Package with state used during the loading phase +type loaderPackage struct { +	*Package +	importErrors map[string]error // maps each bad import to its error +	loadOnce     sync.Once +	color        uint8 // for cycle detection +	needsrc      bool  // load from source (Mode >= LoadTypes) +	needtypes    bool  // type information is either requested or depended on +	initial      bool  // package was matched by a pattern +} + +// loader holds the working state of a single call to load. +type loader struct { +	pkgs map[string]*loaderPackage +	Config +	sizes        types.Sizes +	parseCache   map[string]*parseValue +	parseCacheMu sync.Mutex +	exportMu     sync.Mutex // enforces mutual exclusion of exportdata operations + +	// Config.Mode contains the implied mode (see impliedLoadMode). +	// Implied mode contains all the fields we need the data for. +	// In requestedMode there are the actually requested fields. +	// We'll zero them out before returning packages to the user. +	// This makes it easier for us to get the conditions where +	// we need certain modes right. +	requestedMode LoadMode +} + +type parseValue struct { +	f     *ast.File +	err   error +	ready chan struct{} +} + +func newLoader(cfg *Config) *loader { +	ld := &loader{ +		parseCache: map[string]*parseValue{}, +	} +	if cfg != nil { +		ld.Config = *cfg +		// If the user has provided a logger, use it. +		ld.Config.Logf = cfg.Logf +	} +	if ld.Config.Logf == nil { +		// If the GOPACKAGESDEBUG environment variable is set to true, +		// but the user has not provided a logger, default to log.Printf. +		if debug { +			ld.Config.Logf = log.Printf +		} else { +			ld.Config.Logf = func(format string, args ...interface{}) {} +		} +	} +	if ld.Config.Mode == 0 { +		ld.Config.Mode = NeedName | NeedFiles | NeedCompiledGoFiles // Preserve zero behavior of Mode for backwards compatibility. +	} +	if ld.Config.Env == nil { +		ld.Config.Env = os.Environ() +	} +	if ld.Config.gocmdRunner == nil { +		ld.Config.gocmdRunner = &gocommand.Runner{} +	} +	if ld.Context == nil { +		ld.Context = context.Background() +	} +	if ld.Dir == "" { +		if dir, err := os.Getwd(); err == nil { +			ld.Dir = dir +		} +	} + +	// Save the actually requested fields. We'll zero them out before returning packages to the user. +	ld.requestedMode = ld.Mode +	ld.Mode = impliedLoadMode(ld.Mode) + +	if ld.Mode&NeedTypes != 0 || ld.Mode&NeedSyntax != 0 { +		if ld.Fset == nil { +			ld.Fset = token.NewFileSet() +		} + +		// ParseFile is required even in LoadTypes mode +		// because we load source if export data is missing. +		if ld.ParseFile == nil { +			ld.ParseFile = func(fset *token.FileSet, filename string, src []byte) (*ast.File, error) { +				const mode = parser.AllErrors | parser.ParseComments +				return parser.ParseFile(fset, filename, src, mode) +			} +		} +	} + +	return ld +} + +// refine connects the supplied packages into a graph and then adds type and +// and syntax information as requested by the LoadMode. +func (ld *loader) refine(roots []string, list ...*Package) ([]*Package, error) { +	rootMap := make(map[string]int, len(roots)) +	for i, root := range roots { +		rootMap[root] = i +	} +	ld.pkgs = make(map[string]*loaderPackage) +	// first pass, fixup and build the map and roots +	var initial = make([]*loaderPackage, len(roots)) +	for _, pkg := range list { +		rootIndex := -1 +		if i, found := rootMap[pkg.ID]; found { +			rootIndex = i +		} + +		// Overlays can invalidate export data. +		// TODO(matloob): make this check fine-grained based on dependencies on overlaid files +		exportDataInvalid := len(ld.Overlay) > 0 || pkg.ExportFile == "" && pkg.PkgPath != "unsafe" +		// This package needs type information if the caller requested types and the package is +		// either a root, or it's a non-root and the user requested dependencies ... +		needtypes := (ld.Mode&NeedTypes|NeedTypesInfo != 0 && (rootIndex >= 0 || ld.Mode&NeedDeps != 0)) +		// This package needs source if the call requested source (or types info, which implies source) +		// and the package is either a root, or itas a non- root and the user requested dependencies... +		needsrc := ((ld.Mode&(NeedSyntax|NeedTypesInfo) != 0 && (rootIndex >= 0 || ld.Mode&NeedDeps != 0)) || +			// ... or if we need types and the exportData is invalid. We fall back to (incompletely) +			// typechecking packages from source if they fail to compile. +			(ld.Mode&NeedTypes|NeedTypesInfo != 0 && exportDataInvalid)) && pkg.PkgPath != "unsafe" +		lpkg := &loaderPackage{ +			Package:   pkg, +			needtypes: needtypes, +			needsrc:   needsrc, +		} +		ld.pkgs[lpkg.ID] = lpkg +		if rootIndex >= 0 { +			initial[rootIndex] = lpkg +			lpkg.initial = true +		} +	} +	for i, root := range roots { +		if initial[i] == nil { +			return nil, fmt.Errorf("root package %v is missing", root) +		} +	} + +	// Materialize the import graph. + +	const ( +		white = 0 // new +		grey  = 1 // in progress +		black = 2 // complete +	) + +	// visit traverses the import graph, depth-first, +	// and materializes the graph as Packages.Imports. +	// +	// Valid imports are saved in the Packages.Import map. +	// Invalid imports (cycles and missing nodes) are saved in the importErrors map. +	// Thus, even in the presence of both kinds of errors, the Import graph remains a DAG. +	// +	// visit returns whether the package needs src or has a transitive +	// dependency on a package that does. These are the only packages +	// for which we load source code. +	var stack []*loaderPackage +	var visit func(lpkg *loaderPackage) bool +	var srcPkgs []*loaderPackage +	visit = func(lpkg *loaderPackage) bool { +		switch lpkg.color { +		case black: +			return lpkg.needsrc +		case grey: +			panic("internal error: grey node") +		} +		lpkg.color = grey +		stack = append(stack, lpkg) // push +		stubs := lpkg.Imports       // the structure form has only stubs with the ID in the Imports +		// If NeedImports isn't set, the imports fields will all be zeroed out. +		if ld.Mode&NeedImports != 0 { +			lpkg.Imports = make(map[string]*Package, len(stubs)) +			for importPath, ipkg := range stubs { +				var importErr error +				imp := ld.pkgs[ipkg.ID] +				if imp == nil { +					// (includes package "C" when DisableCgo) +					importErr = fmt.Errorf("missing package: %q", ipkg.ID) +				} else if imp.color == grey { +					importErr = fmt.Errorf("import cycle: %s", stack) +				} +				if importErr != nil { +					if lpkg.importErrors == nil { +						lpkg.importErrors = make(map[string]error) +					} +					lpkg.importErrors[importPath] = importErr +					continue +				} + +				if visit(imp) { +					lpkg.needsrc = true +				} +				lpkg.Imports[importPath] = imp.Package +			} +		} +		if lpkg.needsrc { +			srcPkgs = append(srcPkgs, lpkg) +		} +		if ld.Mode&NeedTypesSizes != 0 { +			lpkg.TypesSizes = ld.sizes +		} +		stack = stack[:len(stack)-1] // pop +		lpkg.color = black + +		return lpkg.needsrc +	} + +	if ld.Mode&NeedImports == 0 { +		// We do this to drop the stub import packages that we are not even going to try to resolve. +		for _, lpkg := range initial { +			lpkg.Imports = nil +		} +	} else { +		// For each initial package, create its import DAG. +		for _, lpkg := range initial { +			visit(lpkg) +		} +	} +	if ld.Mode&NeedImports != 0 && ld.Mode&NeedTypes != 0 { +		for _, lpkg := range srcPkgs { +			// Complete type information is required for the +			// immediate dependencies of each source package. +			for _, ipkg := range lpkg.Imports { +				imp := ld.pkgs[ipkg.ID] +				imp.needtypes = true +			} +		} +	} +	// Load type data and syntax if needed, starting at +	// the initial packages (roots of the import DAG). +	if ld.Mode&NeedTypes != 0 || ld.Mode&NeedSyntax != 0 { +		var wg sync.WaitGroup +		for _, lpkg := range initial { +			wg.Add(1) +			go func(lpkg *loaderPackage) { +				ld.loadRecursive(lpkg) +				wg.Done() +			}(lpkg) +		} +		wg.Wait() +	} + +	result := make([]*Package, len(initial)) +	for i, lpkg := range initial { +		result[i] = lpkg.Package +	} +	for i := range ld.pkgs { +		// Clear all unrequested fields, +		// to catch programs that use more than they request. +		if ld.requestedMode&NeedName == 0 { +			ld.pkgs[i].Name = "" +			ld.pkgs[i].PkgPath = "" +		} +		if ld.requestedMode&NeedFiles == 0 { +			ld.pkgs[i].GoFiles = nil +			ld.pkgs[i].OtherFiles = nil +			ld.pkgs[i].IgnoredFiles = nil +		} +		if ld.requestedMode&NeedCompiledGoFiles == 0 { +			ld.pkgs[i].CompiledGoFiles = nil +		} +		if ld.requestedMode&NeedImports == 0 { +			ld.pkgs[i].Imports = nil +		} +		if ld.requestedMode&NeedExportsFile == 0 { +			ld.pkgs[i].ExportFile = "" +		} +		if ld.requestedMode&NeedTypes == 0 { +			ld.pkgs[i].Types = nil +			ld.pkgs[i].Fset = nil +			ld.pkgs[i].IllTyped = false +		} +		if ld.requestedMode&NeedSyntax == 0 { +			ld.pkgs[i].Syntax = nil +		} +		if ld.requestedMode&NeedTypesInfo == 0 { +			ld.pkgs[i].TypesInfo = nil +		} +		if ld.requestedMode&NeedTypesSizes == 0 { +			ld.pkgs[i].TypesSizes = nil +		} +		if ld.requestedMode&NeedModule == 0 { +			ld.pkgs[i].Module = nil +		} +	} + +	return result, nil +} + +// loadRecursive loads the specified package and its dependencies, +// recursively, in parallel, in topological order. +// It is atomic and idempotent. +// Precondition: ld.Mode&NeedTypes. +func (ld *loader) loadRecursive(lpkg *loaderPackage) { +	lpkg.loadOnce.Do(func() { +		// Load the direct dependencies, in parallel. +		var wg sync.WaitGroup +		for _, ipkg := range lpkg.Imports { +			imp := ld.pkgs[ipkg.ID] +			wg.Add(1) +			go func(imp *loaderPackage) { +				ld.loadRecursive(imp) +				wg.Done() +			}(imp) +		} +		wg.Wait() +		ld.loadPackage(lpkg) +	}) +} + +// loadPackage loads the specified package. +// It must be called only once per Package, +// after immediate dependencies are loaded. +// Precondition: ld.Mode & NeedTypes. +func (ld *loader) loadPackage(lpkg *loaderPackage) { +	if lpkg.PkgPath == "unsafe" { +		// Fill in the blanks to avoid surprises. +		lpkg.Types = types.Unsafe +		lpkg.Fset = ld.Fset +		lpkg.Syntax = []*ast.File{} +		lpkg.TypesInfo = new(types.Info) +		lpkg.TypesSizes = ld.sizes +		return +	} + +	// Call NewPackage directly with explicit name. +	// This avoids skew between golist and go/types when the files' +	// package declarations are inconsistent. +	lpkg.Types = types.NewPackage(lpkg.PkgPath, lpkg.Name) +	lpkg.Fset = ld.Fset + +	// Subtle: we populate all Types fields with an empty Package +	// before loading export data so that export data processing +	// never has to create a types.Package for an indirect dependency, +	// which would then require that such created packages be explicitly +	// inserted back into the Import graph as a final step after export data loading. +	// The Diamond test exercises this case. +	if !lpkg.needtypes && !lpkg.needsrc { +		return +	} +	if !lpkg.needsrc { +		ld.loadFromExportData(lpkg) +		return // not a source package, don't get syntax trees +	} + +	appendError := func(err error) { +		// Convert various error types into the one true Error. +		var errs []Error +		switch err := err.(type) { +		case Error: +			// from driver +			errs = append(errs, err) + +		case *os.PathError: +			// from parser +			errs = append(errs, Error{ +				Pos:  err.Path + ":1", +				Msg:  err.Err.Error(), +				Kind: ParseError, +			}) + +		case scanner.ErrorList: +			// from parser +			for _, err := range err { +				errs = append(errs, Error{ +					Pos:  err.Pos.String(), +					Msg:  err.Msg, +					Kind: ParseError, +				}) +			} + +		case types.Error: +			// from type checker +			errs = append(errs, Error{ +				Pos:  err.Fset.Position(err.Pos).String(), +				Msg:  err.Msg, +				Kind: TypeError, +			}) + +		default: +			// unexpected impoverished error from parser? +			errs = append(errs, Error{ +				Pos:  "-", +				Msg:  err.Error(), +				Kind: UnknownError, +			}) + +			// If you see this error message, please file a bug. +			log.Printf("internal error: error %q (%T) without position", err, err) +		} + +		lpkg.Errors = append(lpkg.Errors, errs...) +	} + +	if ld.Config.Mode&NeedTypes != 0 && len(lpkg.CompiledGoFiles) == 0 && lpkg.ExportFile != "" { +		// The config requested loading sources and types, but sources are missing. +		// Add an error to the package and fall back to loading from export data. +		appendError(Error{"-", fmt.Sprintf("sources missing for package %s", lpkg.ID), ParseError}) +		ld.loadFromExportData(lpkg) +		return // can't get syntax trees for this package +	} + +	files, errs := ld.parseFiles(lpkg.CompiledGoFiles) +	for _, err := range errs { +		appendError(err) +	} + +	lpkg.Syntax = files +	if ld.Config.Mode&NeedTypes == 0 { +		return +	} + +	lpkg.TypesInfo = &types.Info{ +		Types:      make(map[ast.Expr]types.TypeAndValue), +		Defs:       make(map[*ast.Ident]types.Object), +		Uses:       make(map[*ast.Ident]types.Object), +		Implicits:  make(map[ast.Node]types.Object), +		Scopes:     make(map[ast.Node]*types.Scope), +		Selections: make(map[*ast.SelectorExpr]*types.Selection), +	} +	lpkg.TypesSizes = ld.sizes + +	importer := importerFunc(func(path string) (*types.Package, error) { +		if path == "unsafe" { +			return types.Unsafe, nil +		} + +		// The imports map is keyed by import path. +		ipkg := lpkg.Imports[path] +		if ipkg == nil { +			if err := lpkg.importErrors[path]; err != nil { +				return nil, err +			} +			// There was skew between the metadata and the +			// import declarations, likely due to an edit +			// race, or because the ParseFile feature was +			// used to supply alternative file contents. +			return nil, fmt.Errorf("no metadata for %s", path) +		} + +		if ipkg.Types != nil && ipkg.Types.Complete() { +			return ipkg.Types, nil +		} +		log.Fatalf("internal error: package %q without types was imported from %q", path, lpkg) +		panic("unreachable") +	}) + +	// type-check +	tc := &types.Config{ +		Importer: importer, + +		// Type-check bodies of functions only in non-initial packages. +		// Example: for import graph A->B->C and initial packages {A,C}, +		// we can ignore function bodies in B. +		IgnoreFuncBodies: ld.Mode&NeedDeps == 0 && !lpkg.initial, + +		Error: appendError, +		Sizes: ld.sizes, +	} +	if (ld.Mode & typecheckCgo) != 0 { +		if !typesinternal.SetUsesCgo(tc) { +			appendError(Error{ +				Msg:  "typecheckCgo requires Go 1.15+", +				Kind: ListError, +			}) +			return +		} +	} +	types.NewChecker(tc, ld.Fset, lpkg.Types, lpkg.TypesInfo).Files(lpkg.Syntax) + +	lpkg.importErrors = nil // no longer needed + +	// If !Cgo, the type-checker uses FakeImportC mode, so +	// it doesn't invoke the importer for import "C", +	// nor report an error for the import, +	// or for any undefined C.f reference. +	// We must detect this explicitly and correctly +	// mark the package as IllTyped (by reporting an error). +	// TODO(adonovan): if these errors are annoying, +	// we could just set IllTyped quietly. +	if tc.FakeImportC { +	outer: +		for _, f := range lpkg.Syntax { +			for _, imp := range f.Imports { +				if imp.Path.Value == `"C"` { +					err := types.Error{Fset: ld.Fset, Pos: imp.Pos(), Msg: `import "C" ignored`} +					appendError(err) +					break outer +				} +			} +		} +	} + +	// Record accumulated errors. +	illTyped := len(lpkg.Errors) > 0 +	if !illTyped { +		for _, imp := range lpkg.Imports { +			if imp.IllTyped { +				illTyped = true +				break +			} +		} +	} +	lpkg.IllTyped = illTyped +} + +// An importFunc is an implementation of the single-method +// types.Importer interface based on a function value. +type importerFunc func(path string) (*types.Package, error) + +func (f importerFunc) Import(path string) (*types.Package, error) { return f(path) } + +// We use a counting semaphore to limit +// the number of parallel I/O calls per process. +var ioLimit = make(chan bool, 20) + +func (ld *loader) parseFile(filename string) (*ast.File, error) { +	ld.parseCacheMu.Lock() +	v, ok := ld.parseCache[filename] +	if ok { +		// cache hit +		ld.parseCacheMu.Unlock() +		<-v.ready +	} else { +		// cache miss +		v = &parseValue{ready: make(chan struct{})} +		ld.parseCache[filename] = v +		ld.parseCacheMu.Unlock() + +		var src []byte +		for f, contents := range ld.Config.Overlay { +			if sameFile(f, filename) { +				src = contents +			} +		} +		var err error +		if src == nil { +			ioLimit <- true // wait +			src, err = ioutil.ReadFile(filename) +			<-ioLimit // signal +		} +		if err != nil { +			v.err = err +		} else { +			v.f, v.err = ld.ParseFile(ld.Fset, filename, src) +		} + +		close(v.ready) +	} +	return v.f, v.err +} + +// parseFiles reads and parses the Go source files and returns the ASTs +// of the ones that could be at least partially parsed, along with a +// list of I/O and parse errors encountered. +// +// Because files are scanned in parallel, the token.Pos +// positions of the resulting ast.Files are not ordered. +// +func (ld *loader) parseFiles(filenames []string) ([]*ast.File, []error) { +	var wg sync.WaitGroup +	n := len(filenames) +	parsed := make([]*ast.File, n) +	errors := make([]error, n) +	for i, file := range filenames { +		if ld.Config.Context.Err() != nil { +			parsed[i] = nil +			errors[i] = ld.Config.Context.Err() +			continue +		} +		wg.Add(1) +		go func(i int, filename string) { +			parsed[i], errors[i] = ld.parseFile(filename) +			wg.Done() +		}(i, file) +	} +	wg.Wait() + +	// Eliminate nils, preserving order. +	var o int +	for _, f := range parsed { +		if f != nil { +			parsed[o] = f +			o++ +		} +	} +	parsed = parsed[:o] + +	o = 0 +	for _, err := range errors { +		if err != nil { +			errors[o] = err +			o++ +		} +	} +	errors = errors[:o] + +	return parsed, errors +} + +// sameFile returns true if x and y have the same basename and denote +// the same file. +// +func sameFile(x, y string) bool { +	if x == y { +		// It could be the case that y doesn't exist. +		// For instance, it may be an overlay file that +		// hasn't been written to disk. To handle that case +		// let x == y through. (We added the exact absolute path +		// string to the CompiledGoFiles list, so the unwritten +		// overlay case implies x==y.) +		return true +	} +	if strings.EqualFold(filepath.Base(x), filepath.Base(y)) { // (optimisation) +		if xi, err := os.Stat(x); err == nil { +			if yi, err := os.Stat(y); err == nil { +				return os.SameFile(xi, yi) +			} +		} +	} +	return false +} + +// loadFromExportData returns type information for the specified +// package, loading it from an export data file on the first request. +func (ld *loader) loadFromExportData(lpkg *loaderPackage) (*types.Package, error) { +	if lpkg.PkgPath == "" { +		log.Fatalf("internal error: Package %s has no PkgPath", lpkg) +	} + +	// Because gcexportdata.Read has the potential to create or +	// modify the types.Package for each node in the transitive +	// closure of dependencies of lpkg, all exportdata operations +	// must be sequential. (Finer-grained locking would require +	// changes to the gcexportdata API.) +	// +	// The exportMu lock guards the Package.Pkg field and the +	// types.Package it points to, for each Package in the graph. +	// +	// Not all accesses to Package.Pkg need to be protected by exportMu: +	// graph ordering ensures that direct dependencies of source +	// packages are fully loaded before the importer reads their Pkg field. +	ld.exportMu.Lock() +	defer ld.exportMu.Unlock() + +	if tpkg := lpkg.Types; tpkg != nil && tpkg.Complete() { +		return tpkg, nil // cache hit +	} + +	lpkg.IllTyped = true // fail safe + +	if lpkg.ExportFile == "" { +		// Errors while building export data will have been printed to stderr. +		return nil, fmt.Errorf("no export data file") +	} +	f, err := os.Open(lpkg.ExportFile) +	if err != nil { +		return nil, err +	} +	defer f.Close() + +	// Read gc export data. +	// +	// We don't currently support gccgo export data because all +	// underlying workspaces use the gc toolchain. (Even build +	// systems that support gccgo don't use it for workspace +	// queries.) +	r, err := gcexportdata.NewReader(f) +	if err != nil { +		return nil, fmt.Errorf("reading %s: %v", lpkg.ExportFile, err) +	} + +	// Build the view. +	// +	// The gcexportdata machinery has no concept of package ID. +	// It identifies packages by their PkgPath, which although not +	// globally unique is unique within the scope of one invocation +	// of the linker, type-checker, or gcexportdata. +	// +	// So, we must build a PkgPath-keyed view of the global +	// (conceptually ID-keyed) cache of packages and pass it to +	// gcexportdata. The view must contain every existing +	// package that might possibly be mentioned by the +	// current package---its transitive closure. +	// +	// In loadPackage, we unconditionally create a types.Package for +	// each dependency so that export data loading does not +	// create new ones. +	// +	// TODO(adonovan): it would be simpler and more efficient +	// if the export data machinery invoked a callback to +	// get-or-create a package instead of a map. +	// +	view := make(map[string]*types.Package) // view seen by gcexportdata +	seen := make(map[*loaderPackage]bool)   // all visited packages +	var visit func(pkgs map[string]*Package) +	visit = func(pkgs map[string]*Package) { +		for _, p := range pkgs { +			lpkg := ld.pkgs[p.ID] +			if !seen[lpkg] { +				seen[lpkg] = true +				view[lpkg.PkgPath] = lpkg.Types +				visit(lpkg.Imports) +			} +		} +	} +	visit(lpkg.Imports) + +	viewLen := len(view) + 1 // adding the self package +	// Parse the export data. +	// (May modify incomplete packages in view but not create new ones.) +	tpkg, err := gcexportdata.Read(r, ld.Fset, view, lpkg.PkgPath) +	if err != nil { +		return nil, fmt.Errorf("reading %s: %v", lpkg.ExportFile, err) +	} +	if viewLen != len(view) { +		log.Fatalf("Unexpected package creation during export data loading") +	} + +	lpkg.Types = tpkg +	lpkg.IllTyped = false + +	return tpkg, nil +} + +// impliedLoadMode returns loadMode with its dependencies. +func impliedLoadMode(loadMode LoadMode) LoadMode { +	if loadMode&NeedTypesInfo != 0 && loadMode&NeedImports == 0 { +		// If NeedTypesInfo, go/packages needs to do typechecking itself so it can +		// associate type info with the AST. To do so, we need the export data +		// for dependencies, which means we need to ask for the direct dependencies. +		// NeedImports is used to ask for the direct dependencies. +		loadMode |= NeedImports +	} + +	if loadMode&NeedDeps != 0 && loadMode&NeedImports == 0 { +		// With NeedDeps we need to load at least direct dependencies. +		// NeedImports is used to ask for the direct dependencies. +		loadMode |= NeedImports +	} + +	return loadMode +} + +func usesExportData(cfg *Config) bool { +	return cfg.Mode&NeedExportsFile != 0 || cfg.Mode&NeedTypes != 0 && cfg.Mode&NeedDeps == 0 +} diff --git a/vendor/golang.org/x/tools/go/packages/visit.go b/vendor/golang.org/x/tools/go/packages/visit.go new file mode 100644 index 000000000..a1dcc40b7 --- /dev/null +++ b/vendor/golang.org/x/tools/go/packages/visit.go @@ -0,0 +1,59 @@ +// 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 packages + +import ( +	"fmt" +	"os" +	"sort" +) + +// Visit visits all the packages in the import graph whose roots are +// pkgs, calling the optional pre function the first time each package +// is encountered (preorder), and the optional post function after a +// package's dependencies have been visited (postorder). +// The boolean result of pre(pkg) determines whether +// the imports of package pkg are visited. +func Visit(pkgs []*Package, pre func(*Package) bool, post func(*Package)) { +	seen := make(map[*Package]bool) +	var visit func(*Package) +	visit = func(pkg *Package) { +		if !seen[pkg] { +			seen[pkg] = true + +			if pre == nil || pre(pkg) { +				paths := make([]string, 0, len(pkg.Imports)) +				for path := range pkg.Imports { +					paths = append(paths, path) +				} +				sort.Strings(paths) // Imports is a map, this makes visit stable +				for _, path := range paths { +					visit(pkg.Imports[path]) +				} +			} + +			if post != nil { +				post(pkg) +			} +		} +	} +	for _, pkg := range pkgs { +		visit(pkg) +	} +} + +// PrintErrors prints to os.Stderr the accumulated errors of all +// packages in the import graph rooted at pkgs, dependencies first. +// PrintErrors returns the number of errors printed. +func PrintErrors(pkgs []*Package) int { +	var n int +	Visit(pkgs, nil, func(pkg *Package) { +		for _, err := range pkg.Errors { +			fmt.Fprintln(os.Stderr, err) +			n++ +		} +	}) +	return n +} diff --git a/vendor/golang.org/x/tools/internal/event/core/event.go b/vendor/golang.org/x/tools/internal/event/core/event.go new file mode 100644 index 000000000..a6cf0e64a --- /dev/null +++ b/vendor/golang.org/x/tools/internal/event/core/event.go @@ -0,0 +1,85 @@ +// 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 core provides support for event based telemetry. +package core + +import ( +	"fmt" +	"time" + +	"golang.org/x/tools/internal/event/label" +) + +// Event holds the information about an event of note that occurred. +type Event struct { +	at time.Time + +	// As events are often on the stack, storing the first few labels directly +	// in the event can avoid an allocation at all for the very common cases of +	// simple events. +	// The length needs to be large enough to cope with the majority of events +	// but no so large as to cause undue stack pressure. +	// A log message with two values will use 3 labels (one for each value and +	// one for the message itself). + +	static  [3]label.Label // inline storage for the first few labels +	dynamic []label.Label  // dynamically sized storage for remaining labels +} + +// eventLabelMap implements label.Map for a the labels of an Event. +type eventLabelMap struct { +	event Event +} + +func (ev Event) At() time.Time { return ev.at } + +func (ev Event) Format(f fmt.State, r rune) { +	if !ev.at.IsZero() { +		fmt.Fprint(f, ev.at.Format("2006/01/02 15:04:05 ")) +	} +	for index := 0; ev.Valid(index); index++ { +		if l := ev.Label(index); l.Valid() { +			fmt.Fprintf(f, "\n\t%v", l) +		} +	} +} + +func (ev Event) Valid(index int) bool { +	return index >= 0 && index < len(ev.static)+len(ev.dynamic) +} + +func (ev Event) Label(index int) label.Label { +	if index < len(ev.static) { +		return ev.static[index] +	} +	return ev.dynamic[index-len(ev.static)] +} + +func (ev Event) Find(key label.Key) label.Label { +	for _, l := range ev.static { +		if l.Key() == key { +			return l +		} +	} +	for _, l := range ev.dynamic { +		if l.Key() == key { +			return l +		} +	} +	return label.Label{} +} + +func MakeEvent(static [3]label.Label, labels []label.Label) Event { +	return Event{ +		static:  static, +		dynamic: labels, +	} +} + +// CloneEvent event returns a copy of the event with the time adjusted to at. +func CloneEvent(ev Event, at time.Time) Event { +	ev.at = at +	return ev +} diff --git a/vendor/golang.org/x/tools/internal/event/core/export.go b/vendor/golang.org/x/tools/internal/event/core/export.go new file mode 100644 index 000000000..05f3a9a57 --- /dev/null +++ b/vendor/golang.org/x/tools/internal/event/core/export.go @@ -0,0 +1,70 @@ +// 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 core + +import ( +	"context" +	"sync/atomic" +	"time" +	"unsafe" + +	"golang.org/x/tools/internal/event/label" +) + +// Exporter is a function that handles events. +// It may return a modified context and event. +type Exporter func(context.Context, Event, label.Map) context.Context + +var ( +	exporter unsafe.Pointer +) + +// SetExporter sets the global exporter function that handles all events. +// The exporter is called synchronously from the event call site, so it should +// return quickly so as not to hold up user code. +func SetExporter(e Exporter) { +	p := unsafe.Pointer(&e) +	if e == nil { +		// &e is always valid, and so p is always valid, but for the early abort +		// of ProcessEvent to be efficient it needs to make the nil check on the +		// pointer without having to dereference it, so we make the nil function +		// also a nil pointer +		p = nil +	} +	atomic.StorePointer(&exporter, p) +} + +// deliver is called to deliver an event to the supplied exporter. +// it will fill in the time. +func deliver(ctx context.Context, exporter Exporter, ev Event) context.Context { +	// add the current time to the event +	ev.at = time.Now() +	// hand the event off to the current exporter +	return exporter(ctx, ev, ev) +} + +// Export is called to deliver an event to the global exporter if set. +func Export(ctx context.Context, ev Event) context.Context { +	// get the global exporter and abort early if there is not one +	exporterPtr := (*Exporter)(atomic.LoadPointer(&exporter)) +	if exporterPtr == nil { +		return ctx +	} +	return deliver(ctx, *exporterPtr, ev) +} + +// ExportPair is called to deliver a start event to the supplied exporter. +// It also returns a function that will deliver the end event to the same +// exporter. +// It will fill in the time. +func ExportPair(ctx context.Context, begin, end Event) (context.Context, func()) { +	// get the global exporter and abort early if there is not one +	exporterPtr := (*Exporter)(atomic.LoadPointer(&exporter)) +	if exporterPtr == nil { +		return ctx, func() {} +	} +	ctx = deliver(ctx, *exporterPtr, begin) +	return ctx, func() { deliver(ctx, *exporterPtr, end) } +} diff --git a/vendor/golang.org/x/tools/internal/event/core/fast.go b/vendor/golang.org/x/tools/internal/event/core/fast.go new file mode 100644 index 000000000..06c1d4615 --- /dev/null +++ b/vendor/golang.org/x/tools/internal/event/core/fast.go @@ -0,0 +1,77 @@ +// 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 core + +import ( +	"context" + +	"golang.org/x/tools/internal/event/keys" +	"golang.org/x/tools/internal/event/label" +) + +// Log1 takes a message and one label delivers a log event to the exporter. +// It is a customized version of Print that is faster and does no allocation. +func Log1(ctx context.Context, message string, t1 label.Label) { +	Export(ctx, MakeEvent([3]label.Label{ +		keys.Msg.Of(message), +		t1, +	}, nil)) +} + +// Log2 takes a message and two labels and delivers a log event to the exporter. +// It is a customized version of Print that is faster and does no allocation. +func Log2(ctx context.Context, message string, t1 label.Label, t2 label.Label) { +	Export(ctx, MakeEvent([3]label.Label{ +		keys.Msg.Of(message), +		t1, +		t2, +	}, nil)) +} + +// Metric1 sends a label event to the exporter with the supplied labels. +func Metric1(ctx context.Context, t1 label.Label) context.Context { +	return Export(ctx, MakeEvent([3]label.Label{ +		keys.Metric.New(), +		t1, +	}, nil)) +} + +// Metric2 sends a label event to the exporter with the supplied labels. +func Metric2(ctx context.Context, t1, t2 label.Label) context.Context { +	return Export(ctx, MakeEvent([3]label.Label{ +		keys.Metric.New(), +		t1, +		t2, +	}, nil)) +} + +// Start1 sends a span start event with the supplied label list to the exporter. +// It also returns a function that will end the span, which should normally be +// deferred. +func Start1(ctx context.Context, name string, t1 label.Label) (context.Context, func()) { +	return ExportPair(ctx, +		MakeEvent([3]label.Label{ +			keys.Start.Of(name), +			t1, +		}, nil), +		MakeEvent([3]label.Label{ +			keys.End.New(), +		}, nil)) +} + +// Start2 sends a span start event with the supplied label list to the exporter. +// It also returns a function that will end the span, which should normally be +// deferred. +func Start2(ctx context.Context, name string, t1, t2 label.Label) (context.Context, func()) { +	return ExportPair(ctx, +		MakeEvent([3]label.Label{ +			keys.Start.Of(name), +			t1, +			t2, +		}, nil), +		MakeEvent([3]label.Label{ +			keys.End.New(), +		}, nil)) +} diff --git a/vendor/golang.org/x/tools/internal/event/doc.go b/vendor/golang.org/x/tools/internal/event/doc.go new file mode 100644 index 000000000..5dc6e6bab --- /dev/null +++ b/vendor/golang.org/x/tools/internal/event/doc.go @@ -0,0 +1,7 @@ +// 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 event provides a set of packages that cover the main +// concepts of telemetry in an implementation agnostic way. +package event diff --git a/vendor/golang.org/x/tools/internal/event/event.go b/vendor/golang.org/x/tools/internal/event/event.go new file mode 100644 index 000000000..4d55e577d --- /dev/null +++ b/vendor/golang.org/x/tools/internal/event/event.go @@ -0,0 +1,127 @@ +// 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 event + +import ( +	"context" + +	"golang.org/x/tools/internal/event/core" +	"golang.org/x/tools/internal/event/keys" +	"golang.org/x/tools/internal/event/label" +) + +// Exporter is a function that handles events. +// It may return a modified context and event. +type Exporter func(context.Context, core.Event, label.Map) context.Context + +// SetExporter sets the global exporter function that handles all events. +// The exporter is called synchronously from the event call site, so it should +// return quickly so as not to hold up user code. +func SetExporter(e Exporter) { +	core.SetExporter(core.Exporter(e)) +} + +// Log takes a message and a label list and combines them into a single event +// before delivering them to the exporter. +func Log(ctx context.Context, message string, labels ...label.Label) { +	core.Export(ctx, core.MakeEvent([3]label.Label{ +		keys.Msg.Of(message), +	}, labels)) +} + +// IsLog returns true if the event was built by the Log function. +// It is intended to be used in exporters to identify the semantics of the +// event when deciding what to do with it. +func IsLog(ev core.Event) bool { +	return ev.Label(0).Key() == keys.Msg +} + +// Error takes a message and a label list and combines them into a single event +// before delivering them to the exporter. It captures the error in the +// delivered event. +func Error(ctx context.Context, message string, err error, labels ...label.Label) { +	core.Export(ctx, core.MakeEvent([3]label.Label{ +		keys.Msg.Of(message), +		keys.Err.Of(err), +	}, labels)) +} + +// IsError returns true if the event was built by the Error function. +// It is intended to be used in exporters to identify the semantics of the +// event when deciding what to do with it. +func IsError(ev core.Event) bool { +	return ev.Label(0).Key() == keys.Msg && +		ev.Label(1).Key() == keys.Err +} + +// Metric sends a label event to the exporter with the supplied labels. +func Metric(ctx context.Context, labels ...label.Label) { +	core.Export(ctx, core.MakeEvent([3]label.Label{ +		keys.Metric.New(), +	}, labels)) +} + +// IsMetric returns true if the event was built by the Metric function. +// It is intended to be used in exporters to identify the semantics of the +// event when deciding what to do with it. +func IsMetric(ev core.Event) bool { +	return ev.Label(0).Key() == keys.Metric +} + +// Label sends a label event to the exporter with the supplied labels. +func Label(ctx context.Context, labels ...label.Label) context.Context { +	return core.Export(ctx, core.MakeEvent([3]label.Label{ +		keys.Label.New(), +	}, labels)) +} + +// IsLabel returns true if the event was built by the Label function. +// It is intended to be used in exporters to identify the semantics of the +// event when deciding what to do with it. +func IsLabel(ev core.Event) bool { +	return ev.Label(0).Key() == keys.Label +} + +// Start sends a span start event with the supplied label list to the exporter. +// It also returns a function that will end the span, which should normally be +// deferred. +func Start(ctx context.Context, name string, labels ...label.Label) (context.Context, func()) { +	return core.ExportPair(ctx, +		core.MakeEvent([3]label.Label{ +			keys.Start.Of(name), +		}, labels), +		core.MakeEvent([3]label.Label{ +			keys.End.New(), +		}, nil)) +} + +// IsStart returns true if the event was built by the Start function. +// It is intended to be used in exporters to identify the semantics of the +// event when deciding what to do with it. +func IsStart(ev core.Event) bool { +	return ev.Label(0).Key() == keys.Start +} + +// IsEnd returns true if the event was built by the End function. +// It is intended to be used in exporters to identify the semantics of the +// event when deciding what to do with it. +func IsEnd(ev core.Event) bool { +	return ev.Label(0).Key() == keys.End +} + +// Detach returns a context without an associated span. +// This allows the creation of spans that are not children of the current span. +func Detach(ctx context.Context) context.Context { +	return core.Export(ctx, core.MakeEvent([3]label.Label{ +		keys.Detach.New(), +	}, nil)) +} + +// IsDetach returns true if the event was built by the Detach function. +// It is intended to be used in exporters to identify the semantics of the +// event when deciding what to do with it. +func IsDetach(ev core.Event) bool { +	return ev.Label(0).Key() == keys.Detach +} diff --git a/vendor/golang.org/x/tools/internal/event/keys/keys.go b/vendor/golang.org/x/tools/internal/event/keys/keys.go new file mode 100644 index 000000000..a02206e30 --- /dev/null +++ b/vendor/golang.org/x/tools/internal/event/keys/keys.go @@ -0,0 +1,564 @@ +// 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 keys + +import ( +	"fmt" +	"io" +	"math" +	"strconv" + +	"golang.org/x/tools/internal/event/label" +) + +// Value represents a key for untyped values. +type Value struct { +	name        string +	description string +} + +// New creates a new Key for untyped values. +func New(name, description string) *Value { +	return &Value{name: name, description: description} +} + +func (k *Value) Name() string        { return k.name } +func (k *Value) Description() string { return k.description } + +func (k *Value) Format(w io.Writer, buf []byte, l label.Label) { +	fmt.Fprint(w, k.From(l)) +} + +// Get can be used to get a label for the key from a label.Map. +func (k *Value) Get(lm label.Map) interface{} { +	if t := lm.Find(k); t.Valid() { +		return k.From(t) +	} +	return nil +} + +// From can be used to get a value from a Label. +func (k *Value) From(t label.Label) interface{} { return t.UnpackValue() } + +// Of creates a new Label with this key and the supplied value. +func (k *Value) Of(value interface{}) label.Label { return label.OfValue(k, value) } + +// Tag represents a key for tagging labels that have no value. +// These are used when the existence of the label is the entire information it +// carries, such as marking events to be of a specific kind, or from a specific +// package. +type Tag struct { +	name        string +	description string +} + +// NewTag creates a new Key for tagging labels. +func NewTag(name, description string) *Tag { +	return &Tag{name: name, description: description} +} + +func (k *Tag) Name() string        { return k.name } +func (k *Tag) Description() string { return k.description } + +func (k *Tag) Format(w io.Writer, buf []byte, l label.Label) {} + +// New creates a new Label with this key. +func (k *Tag) New() label.Label { return label.OfValue(k, nil) } + +// Int represents a key +type Int struct { +	name        string +	description string +} + +// NewInt creates a new Key for int values. +func NewInt(name, description string) *Int { +	return &Int{name: name, description: description} +} + +func (k *Int) Name() string        { return k.name } +func (k *Int) Description() string { return k.description } + +func (k *Int) Format(w io.Writer, buf []byte, l label.Label) { +	w.Write(strconv.AppendInt(buf, int64(k.From(l)), 10)) +} + +// Of creates a new Label with this key and the supplied value. +func (k *Int) Of(v int) label.Label { return label.Of64(k, uint64(v)) } + +// Get can be used to get a label for the key from a label.Map. +func (k *Int) Get(lm label.Map) int { +	if t := lm.Find(k); t.Valid() { +		return k.From(t) +	} +	return 0 +} + +// From can be used to get a value from a Label. +func (k *Int) From(t label.Label) int { return int(t.Unpack64()) } + +// Int8 represents a key +type Int8 struct { +	name        string +	description string +} + +// NewInt8 creates a new Key for int8 values. +func NewInt8(name, description string) *Int8 { +	return &Int8{name: name, description: description} +} + +func (k *Int8) Name() string        { return k.name } +func (k *Int8) Description() string { return k.description } + +func (k *Int8) Format(w io.Writer, buf []byte, l label.Label) { +	w.Write(strconv.AppendInt(buf, int64(k.From(l)), 10)) +} + +// Of creates a new Label with this key and the supplied value. +func (k *Int8) Of(v int8) label.Label { return label.Of64(k, uint64(v)) } + +// Get can be used to get a label for the key from a label.Map. +func (k *Int8) Get(lm label.Map) int8 { +	if t := lm.Find(k); t.Valid() { +		return k.From(t) +	} +	return 0 +} + +// From can be used to get a value from a Label. +func (k *Int8) From(t label.Label) int8 { return int8(t.Unpack64()) } + +// Int16 represents a key +type Int16 struct { +	name        string +	description string +} + +// NewInt16 creates a new Key for int16 values. +func NewInt16(name, description string) *Int16 { +	return &Int16{name: name, description: description} +} + +func (k *Int16) Name() string        { return k.name } +func (k *Int16) Description() string { return k.description } + +func (k *Int16) Format(w io.Writer, buf []byte, l label.Label) { +	w.Write(strconv.AppendInt(buf, int64(k.From(l)), 10)) +} + +// Of creates a new Label with this key and the supplied value. +func (k *Int16) Of(v int16) label.Label { return label.Of64(k, uint64(v)) } + +// Get can be used to get a label for the key from a label.Map. +func (k *Int16) Get(lm label.Map) int16 { +	if t := lm.Find(k); t.Valid() { +		return k.From(t) +	} +	return 0 +} + +// From can be used to get a value from a Label. +func (k *Int16) From(t label.Label) int16 { return int16(t.Unpack64()) } + +// Int32 represents a key +type Int32 struct { +	name        string +	description string +} + +// NewInt32 creates a new Key for int32 values. +func NewInt32(name, description string) *Int32 { +	return &Int32{name: name, description: description} +} + +func (k *Int32) Name() string        { return k.name } +func (k *Int32) Description() string { return k.description } + +func (k *Int32) Format(w io.Writer, buf []byte, l label.Label) { +	w.Write(strconv.AppendInt(buf, int64(k.From(l)), 10)) +} + +// Of creates a new Label with this key and the supplied value. +func (k *Int32) Of(v int32) label.Label { return label.Of64(k, uint64(v)) } + +// Get can be used to get a label for the key from a label.Map. +func (k *Int32) Get(lm label.Map) int32 { +	if t := lm.Find(k); t.Valid() { +		return k.From(t) +	} +	return 0 +} + +// From can be used to get a value from a Label. +func (k *Int32) From(t label.Label) int32 { return int32(t.Unpack64()) } + +// Int64 represents a key +type Int64 struct { +	name        string +	description string +} + +// NewInt64 creates a new Key for int64 values. +func NewInt64(name, description string) *Int64 { +	return &Int64{name: name, description: description} +} + +func (k *Int64) Name() string        { return k.name } +func (k *Int64) Description() string { return k.description } + +func (k *Int64) Format(w io.Writer, buf []byte, l label.Label) { +	w.Write(strconv.AppendInt(buf, k.From(l), 10)) +} + +// Of creates a new Label with this key and the supplied value. +func (k *Int64) Of(v int64) label.Label { return label.Of64(k, uint64(v)) } + +// Get can be used to get a label for the key from a label.Map. +func (k *Int64) Get(lm label.Map) int64 { +	if t := lm.Find(k); t.Valid() { +		return k.From(t) +	} +	return 0 +} + +// From can be used to get a value from a Label. +func (k *Int64) From(t label.Label) int64 { return int64(t.Unpack64()) } + +// UInt represents a key +type UInt struct { +	name        string +	description string +} + +// NewUInt creates a new Key for uint values. +func NewUInt(name, description string) *UInt { +	return &UInt{name: name, description: description} +} + +func (k *UInt) Name() string        { return k.name } +func (k *UInt) Description() string { return k.description } + +func (k *UInt) Format(w io.Writer, buf []byte, l label.Label) { +	w.Write(strconv.AppendUint(buf, uint64(k.From(l)), 10)) +} + +// Of creates a new Label with this key and the supplied value. +func (k *UInt) Of(v uint) label.Label { return label.Of64(k, uint64(v)) } + +// Get can be used to get a label for the key from a label.Map. +func (k *UInt) Get(lm label.Map) uint { +	if t := lm.Find(k); t.Valid() { +		return k.From(t) +	} +	return 0 +} + +// From can be used to get a value from a Label. +func (k *UInt) From(t label.Label) uint { return uint(t.Unpack64()) } + +// UInt8 represents a key +type UInt8 struct { +	name        string +	description string +} + +// NewUInt8 creates a new Key for uint8 values. +func NewUInt8(name, description string) *UInt8 { +	return &UInt8{name: name, description: description} +} + +func (k *UInt8) Name() string        { return k.name } +func (k *UInt8) Description() string { return k.description } + +func (k *UInt8) Format(w io.Writer, buf []byte, l label.Label) { +	w.Write(strconv.AppendUint(buf, uint64(k.From(l)), 10)) +} + +// Of creates a new Label with this key and the supplied value. +func (k *UInt8) Of(v uint8) label.Label { return label.Of64(k, uint64(v)) } + +// Get can be used to get a label for the key from a label.Map. +func (k *UInt8) Get(lm label.Map) uint8 { +	if t := lm.Find(k); t.Valid() { +		return k.From(t) +	} +	return 0 +} + +// From can be used to get a value from a Label. +func (k *UInt8) From(t label.Label) uint8 { return uint8(t.Unpack64()) } + +// UInt16 represents a key +type UInt16 struct { +	name        string +	description string +} + +// NewUInt16 creates a new Key for uint16 values. +func NewUInt16(name, description string) *UInt16 { +	return &UInt16{name: name, description: description} +} + +func (k *UInt16) Name() string        { return k.name } +func (k *UInt16) Description() string { return k.description } + +func (k *UInt16) Format(w io.Writer, buf []byte, l label.Label) { +	w.Write(strconv.AppendUint(buf, uint64(k.From(l)), 10)) +} + +// Of creates a new Label with this key and the supplied value. +func (k *UInt16) Of(v uint16) label.Label { return label.Of64(k, uint64(v)) } + +// Get can be used to get a label for the key from a label.Map. +func (k *UInt16) Get(lm label.Map) uint16 { +	if t := lm.Find(k); t.Valid() { +		return k.From(t) +	} +	return 0 +} + +// From can be used to get a value from a Label. +func (k *UInt16) From(t label.Label) uint16 { return uint16(t.Unpack64()) } + +// UInt32 represents a key +type UInt32 struct { +	name        string +	description string +} + +// NewUInt32 creates a new Key for uint32 values. +func NewUInt32(name, description string) *UInt32 { +	return &UInt32{name: name, description: description} +} + +func (k *UInt32) Name() string        { return k.name } +func (k *UInt32) Description() string { return k.description } + +func (k *UInt32) Format(w io.Writer, buf []byte, l label.Label) { +	w.Write(strconv.AppendUint(buf, uint64(k.From(l)), 10)) +} + +// Of creates a new Label with this key and the supplied value. +func (k *UInt32) Of(v uint32) label.Label { return label.Of64(k, uint64(v)) } + +// Get can be used to get a label for the key from a label.Map. +func (k *UInt32) Get(lm label.Map) uint32 { +	if t := lm.Find(k); t.Valid() { +		return k.From(t) +	} +	return 0 +} + +// From can be used to get a value from a Label. +func (k *UInt32) From(t label.Label) uint32 { return uint32(t.Unpack64()) } + +// UInt64 represents a key +type UInt64 struct { +	name        string +	description string +} + +// NewUInt64 creates a new Key for uint64 values. +func NewUInt64(name, description string) *UInt64 { +	return &UInt64{name: name, description: description} +} + +func (k *UInt64) Name() string        { return k.name } +func (k *UInt64) Description() string { return k.description } + +func (k *UInt64) Format(w io.Writer, buf []byte, l label.Label) { +	w.Write(strconv.AppendUint(buf, k.From(l), 10)) +} + +// Of creates a new Label with this key and the supplied value. +func (k *UInt64) Of(v uint64) label.Label { return label.Of64(k, v) } + +// Get can be used to get a label for the key from a label.Map. +func (k *UInt64) Get(lm label.Map) uint64 { +	if t := lm.Find(k); t.Valid() { +		return k.From(t) +	} +	return 0 +} + +// From can be used to get a value from a Label. +func (k *UInt64) From(t label.Label) uint64 { return t.Unpack64() } + +// Float32 represents a key +type Float32 struct { +	name        string +	description string +} + +// NewFloat32 creates a new Key for float32 values. +func NewFloat32(name, description string) *Float32 { +	return &Float32{name: name, description: description} +} + +func (k *Float32) Name() string        { return k.name } +func (k *Float32) Description() string { return k.description } + +func (k *Float32) Format(w io.Writer, buf []byte, l label.Label) { +	w.Write(strconv.AppendFloat(buf, float64(k.From(l)), 'E', -1, 32)) +} + +// Of creates a new Label with this key and the supplied value. +func (k *Float32) Of(v float32) label.Label { +	return label.Of64(k, uint64(math.Float32bits(v))) +} + +// Get can be used to get a label for the key from a label.Map. +func (k *Float32) Get(lm label.Map) float32 { +	if t := lm.Find(k); t.Valid() { +		return k.From(t) +	} +	return 0 +} + +// From can be used to get a value from a Label. +func (k *Float32) From(t label.Label) float32 { +	return math.Float32frombits(uint32(t.Unpack64())) +} + +// Float64 represents a key +type Float64 struct { +	name        string +	description string +} + +// NewFloat64 creates a new Key for int64 values. +func NewFloat64(name, description string) *Float64 { +	return &Float64{name: name, description: description} +} + +func (k *Float64) Name() string        { return k.name } +func (k *Float64) Description() string { return k.description } + +func (k *Float64) Format(w io.Writer, buf []byte, l label.Label) { +	w.Write(strconv.AppendFloat(buf, k.From(l), 'E', -1, 64)) +} + +// Of creates a new Label with this key and the supplied value. +func (k *Float64) Of(v float64) label.Label { +	return label.Of64(k, math.Float64bits(v)) +} + +// Get can be used to get a label for the key from a label.Map. +func (k *Float64) Get(lm label.Map) float64 { +	if t := lm.Find(k); t.Valid() { +		return k.From(t) +	} +	return 0 +} + +// From can be used to get a value from a Label. +func (k *Float64) From(t label.Label) float64 { +	return math.Float64frombits(t.Unpack64()) +} + +// String represents a key +type String struct { +	name        string +	description string +} + +// NewString creates a new Key for int64 values. +func NewString(name, description string) *String { +	return &String{name: name, description: description} +} + +func (k *String) Name() string        { return k.name } +func (k *String) Description() string { return k.description } + +func (k *String) Format(w io.Writer, buf []byte, l label.Label) { +	w.Write(strconv.AppendQuote(buf, k.From(l))) +} + +// Of creates a new Label with this key and the supplied value. +func (k *String) Of(v string) label.Label { return label.OfString(k, v) } + +// Get can be used to get a label for the key from a label.Map. +func (k *String) Get(lm label.Map) string { +	if t := lm.Find(k); t.Valid() { +		return k.From(t) +	} +	return "" +} + +// From can be used to get a value from a Label. +func (k *String) From(t label.Label) string { return t.UnpackString() } + +// Boolean represents a key +type Boolean struct { +	name        string +	description string +} + +// NewBoolean creates a new Key for bool values. +func NewBoolean(name, description string) *Boolean { +	return &Boolean{name: name, description: description} +} + +func (k *Boolean) Name() string        { return k.name } +func (k *Boolean) Description() string { return k.description } + +func (k *Boolean) Format(w io.Writer, buf []byte, l label.Label) { +	w.Write(strconv.AppendBool(buf, k.From(l))) +} + +// Of creates a new Label with this key and the supplied value. +func (k *Boolean) Of(v bool) label.Label { +	if v { +		return label.Of64(k, 1) +	} +	return label.Of64(k, 0) +} + +// Get can be used to get a label for the key from a label.Map. +func (k *Boolean) Get(lm label.Map) bool { +	if t := lm.Find(k); t.Valid() { +		return k.From(t) +	} +	return false +} + +// From can be used to get a value from a Label. +func (k *Boolean) From(t label.Label) bool { return t.Unpack64() > 0 } + +// Error represents a key +type Error struct { +	name        string +	description string +} + +// NewError creates a new Key for int64 values. +func NewError(name, description string) *Error { +	return &Error{name: name, description: description} +} + +func (k *Error) Name() string        { return k.name } +func (k *Error) Description() string { return k.description } + +func (k *Error) Format(w io.Writer, buf []byte, l label.Label) { +	io.WriteString(w, k.From(l).Error()) +} + +// Of creates a new Label with this key and the supplied value. +func (k *Error) Of(v error) label.Label { return label.OfValue(k, v) } + +// Get can be used to get a label for the key from a label.Map. +func (k *Error) Get(lm label.Map) error { +	if t := lm.Find(k); t.Valid() { +		return k.From(t) +	} +	return nil +} + +// From can be used to get a value from a Label. +func (k *Error) From(t label.Label) error { +	err, _ := t.UnpackValue().(error) +	return err +} diff --git a/vendor/golang.org/x/tools/internal/event/keys/standard.go b/vendor/golang.org/x/tools/internal/event/keys/standard.go new file mode 100644 index 000000000..7e9586659 --- /dev/null +++ b/vendor/golang.org/x/tools/internal/event/keys/standard.go @@ -0,0 +1,22 @@ +// Copyright 2020 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +package keys + +var ( +	// Msg is a key used to add message strings to label lists. +	Msg = NewString("message", "a readable message") +	// Label is a key used to indicate an event adds labels to the context. +	Label = NewTag("label", "a label context marker") +	// Start is used for things like traces that have a name. +	Start = NewString("start", "span start") +	// Metric is a key used to indicate an event records metrics. +	End = NewTag("end", "a span end marker") +	// Metric is a key used to indicate an event records metrics. +	Detach = NewTag("detach", "a span detach marker") +	// Err is a key used to add error values to label lists. +	Err = NewError("error", "an error that occurred") +	// Metric is a key used to indicate an event records metrics. +	Metric = NewTag("metric", "a metric event marker") +) diff --git a/vendor/golang.org/x/tools/internal/event/label/label.go b/vendor/golang.org/x/tools/internal/event/label/label.go new file mode 100644 index 000000000..0f526e1f9 --- /dev/null +++ b/vendor/golang.org/x/tools/internal/event/label/label.go @@ -0,0 +1,215 @@ +// 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 label + +import ( +	"fmt" +	"io" +	"reflect" +	"unsafe" +) + +// Key is used as the identity of a Label. +// Keys are intended to be compared by pointer only, the name should be unique +// for communicating with external systems, but it is not required or enforced. +type Key interface { +	// Name returns the key name. +	Name() string +	// Description returns a string that can be used to describe the value. +	Description() string + +	// Format is used in formatting to append the value of the label to the +	// supplied buffer. +	// The formatter may use the supplied buf as a scratch area to avoid +	// allocations. +	Format(w io.Writer, buf []byte, l Label) +} + +// Label holds a key and value pair. +// It is normally used when passing around lists of labels. +type Label struct { +	key     Key +	packed  uint64 +	untyped interface{} +} + +// Map is the interface to a collection of Labels indexed by key. +type Map interface { +	// Find returns the label that matches the supplied key. +	Find(key Key) Label +} + +// List is the interface to something that provides an iterable +// list of labels. +// Iteration should start from 0 and continue until Valid returns false. +type List interface { +	// Valid returns true if the index is within range for the list. +	// It does not imply the label at that index will itself be valid. +	Valid(index int) bool +	// Label returns the label at the given index. +	Label(index int) Label +} + +// list implements LabelList for a list of Labels. +type list struct { +	labels []Label +} + +// filter wraps a LabelList filtering out specific labels. +type filter struct { +	keys       []Key +	underlying List +} + +// listMap implements LabelMap for a simple list of labels. +type listMap struct { +	labels []Label +} + +// mapChain implements LabelMap for a list of underlying LabelMap. +type mapChain struct { +	maps []Map +} + +// OfValue creates a new label from the key and value. +// This method is for implementing new key types, label creation should +// normally be done with the Of method of the key. +func OfValue(k Key, value interface{}) Label { return Label{key: k, untyped: value} } + +// UnpackValue assumes the label was built using LabelOfValue and returns the value +// that was passed to that constructor. +// This method is for implementing new key types, for type safety normal +// access should be done with the From method of the key. +func (t Label) UnpackValue() interface{} { return t.untyped } + +// Of64 creates a new label from a key and a uint64. This is often +// used for non uint64 values that can be packed into a uint64. +// This method is for implementing new key types, label creation should +// normally be done with the Of method of the key. +func Of64(k Key, v uint64) Label { return Label{key: k, packed: v} } + +// Unpack64 assumes the label was built using LabelOf64 and returns the value that +// was passed to that constructor. +// This method is for implementing new key types, for type safety normal +// access should be done with the From method of the key. +func (t Label) Unpack64() uint64 { return t.packed } + +type stringptr unsafe.Pointer + +// OfString creates a new label from a key and a string. +// This method is for implementing new key types, label creation should +// normally be done with the Of method of the key. +func OfString(k Key, v string) Label { +	hdr := (*reflect.StringHeader)(unsafe.Pointer(&v)) +	return Label{ +		key:     k, +		packed:  uint64(hdr.Len), +		untyped: stringptr(hdr.Data), +	} +} + +// UnpackString assumes the label was built using LabelOfString and returns the +// value that was passed to that constructor. +// This method is for implementing new key types, for type safety normal +// access should be done with the From method of the key. +func (t Label) UnpackString() string { +	var v string +	hdr := (*reflect.StringHeader)(unsafe.Pointer(&v)) +	hdr.Data = uintptr(t.untyped.(stringptr)) +	hdr.Len = int(t.packed) +	return v +} + +// Valid returns true if the Label is a valid one (it has a key). +func (t Label) Valid() bool { return t.key != nil } + +// Key returns the key of this Label. +func (t Label) Key() Key { return t.key } + +// Format is used for debug printing of labels. +func (t Label) Format(f fmt.State, r rune) { +	if !t.Valid() { +		io.WriteString(f, `nil`) +		return +	} +	io.WriteString(f, t.Key().Name()) +	io.WriteString(f, "=") +	var buf [128]byte +	t.Key().Format(f, buf[:0], t) +} + +func (l *list) Valid(index int) bool { +	return index >= 0 && index < len(l.labels) +} + +func (l *list) Label(index int) Label { +	return l.labels[index] +} + +func (f *filter) Valid(index int) bool { +	return f.underlying.Valid(index) +} + +func (f *filter) Label(index int) Label { +	l := f.underlying.Label(index) +	for _, f := range f.keys { +		if l.Key() == f { +			return Label{} +		} +	} +	return l +} + +func (lm listMap) Find(key Key) Label { +	for _, l := range lm.labels { +		if l.Key() == key { +			return l +		} +	} +	return Label{} +} + +func (c mapChain) Find(key Key) Label { +	for _, src := range c.maps { +		l := src.Find(key) +		if l.Valid() { +			return l +		} +	} +	return Label{} +} + +var emptyList = &list{} + +func NewList(labels ...Label) List { +	if len(labels) == 0 { +		return emptyList +	} +	return &list{labels: labels} +} + +func Filter(l List, keys ...Key) List { +	if len(keys) == 0 { +		return l +	} +	return &filter{keys: keys, underlying: l} +} + +func NewMap(labels ...Label) Map { +	return listMap{labels: labels} +} + +func MergeMaps(srcs ...Map) Map { +	var nonNil []Map +	for _, src := range srcs { +		if src != nil { +			nonNil = append(nonNil, src) +		} +	} +	if len(nonNil) == 1 { +		return nonNil[0] +	} +	return mapChain{maps: nonNil} +} diff --git a/vendor/golang.org/x/tools/internal/gocommand/invoke.go b/vendor/golang.org/x/tools/internal/gocommand/invoke.go new file mode 100644 index 000000000..8659a0c5d --- /dev/null +++ b/vendor/golang.org/x/tools/internal/gocommand/invoke.go @@ -0,0 +1,273 @@ +// Copyright 2020 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +// Package gocommand is a helper for calling the go command. +package gocommand + +import ( +	"bytes" +	"context" +	"fmt" +	exec "golang.org/x/sys/execabs" +	"io" +	"os" +	"regexp" +	"strconv" +	"strings" +	"sync" +	"time" + +	"golang.org/x/tools/internal/event" +) + +// An Runner will run go command invocations and serialize +// them if it sees a concurrency error. +type Runner struct { +	// once guards the runner initialization. +	once sync.Once + +	// inFlight tracks available workers. +	inFlight chan struct{} + +	// serialized guards the ability to run a go command serially, +	// to avoid deadlocks when claiming workers. +	serialized chan struct{} +} + +const maxInFlight = 10 + +func (runner *Runner) initialize() { +	runner.once.Do(func() { +		runner.inFlight = make(chan struct{}, maxInFlight) +		runner.serialized = make(chan struct{}, 1) +	}) +} + +// 1.13: go: updates to go.mod needed, but contents have changed +// 1.14: go: updating go.mod: existing contents have changed since last read +var modConcurrencyError = regexp.MustCompile(`go:.*go.mod.*contents have changed`) + +// Run is a convenience wrapper around RunRaw. +// It returns only stdout and a "friendly" error. +func (runner *Runner) Run(ctx context.Context, inv Invocation) (*bytes.Buffer, error) { +	stdout, _, friendly, _ := runner.RunRaw(ctx, inv) +	return stdout, friendly +} + +// RunPiped runs the invocation serially, always waiting for any concurrent +// invocations to complete first. +func (runner *Runner) RunPiped(ctx context.Context, inv Invocation, stdout, stderr io.Writer) error { +	_, err := runner.runPiped(ctx, inv, stdout, stderr) +	return err +} + +// RunRaw runs the invocation, serializing requests only if they fight over +// go.mod changes. +func (runner *Runner) RunRaw(ctx context.Context, inv Invocation) (*bytes.Buffer, *bytes.Buffer, error, error) { +	// Make sure the runner is always initialized. +	runner.initialize() + +	// First, try to run the go command concurrently. +	stdout, stderr, friendlyErr, err := runner.runConcurrent(ctx, inv) + +	// If we encounter a load concurrency error, we need to retry serially. +	if friendlyErr == nil || !modConcurrencyError.MatchString(friendlyErr.Error()) { +		return stdout, stderr, friendlyErr, err +	} +	event.Error(ctx, "Load concurrency error, will retry serially", err) + +	// Run serially by calling runPiped. +	stdout.Reset() +	stderr.Reset() +	friendlyErr, err = runner.runPiped(ctx, inv, stdout, stderr) +	return stdout, stderr, friendlyErr, err +} + +func (runner *Runner) runConcurrent(ctx context.Context, inv Invocation) (*bytes.Buffer, *bytes.Buffer, error, error) { +	// Wait for 1 worker to become available. +	select { +	case <-ctx.Done(): +		return nil, nil, nil, ctx.Err() +	case runner.inFlight <- struct{}{}: +		defer func() { <-runner.inFlight }() +	} + +	stdout, stderr := &bytes.Buffer{}, &bytes.Buffer{} +	friendlyErr, err := inv.runWithFriendlyError(ctx, stdout, stderr) +	return stdout, stderr, friendlyErr, err +} + +func (runner *Runner) runPiped(ctx context.Context, inv Invocation, stdout, stderr io.Writer) (error, error) { +	// Make sure the runner is always initialized. +	runner.initialize() + +	// Acquire the serialization lock. This avoids deadlocks between two +	// runPiped commands. +	select { +	case <-ctx.Done(): +		return nil, ctx.Err() +	case runner.serialized <- struct{}{}: +		defer func() { <-runner.serialized }() +	} + +	// Wait for all in-progress go commands to return before proceeding, +	// to avoid load concurrency errors. +	for i := 0; i < maxInFlight; i++ { +		select { +		case <-ctx.Done(): +			return nil, ctx.Err() +		case runner.inFlight <- struct{}{}: +			// Make sure we always "return" any workers we took. +			defer func() { <-runner.inFlight }() +		} +	} + +	return inv.runWithFriendlyError(ctx, stdout, stderr) +} + +// An Invocation represents a call to the go command. +type Invocation struct { +	Verb       string +	Args       []string +	BuildFlags []string +	ModFlag    string +	ModFile    string +	Overlay    string +	// If CleanEnv is set, the invocation will run only with the environment +	// in Env, not starting with os.Environ. +	CleanEnv   bool +	Env        []string +	WorkingDir string +	Logf       func(format string, args ...interface{}) +} + +func (i *Invocation) runWithFriendlyError(ctx context.Context, stdout, stderr io.Writer) (friendlyError error, rawError error) { +	rawError = i.run(ctx, stdout, stderr) +	if rawError != nil { +		friendlyError = rawError +		// Check for 'go' executable not being found. +		if ee, ok := rawError.(*exec.Error); ok && ee.Err == exec.ErrNotFound { +			friendlyError = fmt.Errorf("go command required, not found: %v", ee) +		} +		if ctx.Err() != nil { +			friendlyError = ctx.Err() +		} +		friendlyError = fmt.Errorf("err: %v: stderr: %s", friendlyError, stderr) +	} +	return +} + +func (i *Invocation) run(ctx context.Context, stdout, stderr io.Writer) error { +	log := i.Logf +	if log == nil { +		log = func(string, ...interface{}) {} +	} + +	goArgs := []string{i.Verb} + +	appendModFile := func() { +		if i.ModFile != "" { +			goArgs = append(goArgs, "-modfile="+i.ModFile) +		} +	} +	appendModFlag := func() { +		if i.ModFlag != "" { +			goArgs = append(goArgs, "-mod="+i.ModFlag) +		} +	} +	appendOverlayFlag := func() { +		if i.Overlay != "" { +			goArgs = append(goArgs, "-overlay="+i.Overlay) +		} +	} + +	switch i.Verb { +	case "env", "version": +		goArgs = append(goArgs, i.Args...) +	case "mod": +		// mod needs the sub-verb before flags. +		goArgs = append(goArgs, i.Args[0]) +		appendModFile() +		goArgs = append(goArgs, i.Args[1:]...) +	case "get": +		goArgs = append(goArgs, i.BuildFlags...) +		appendModFile() +		goArgs = append(goArgs, i.Args...) + +	default: // notably list and build. +		goArgs = append(goArgs, i.BuildFlags...) +		appendModFile() +		appendModFlag() +		appendOverlayFlag() +		goArgs = append(goArgs, i.Args...) +	} +	cmd := exec.Command("go", goArgs...) +	cmd.Stdout = stdout +	cmd.Stderr = stderr +	// On darwin the cwd gets resolved to the real path, which breaks anything that +	// expects the working directory to keep the original path, including the +	// go command when dealing with modules. +	// The Go stdlib has a special feature where if the cwd and the PWD are the +	// same node then it trusts the PWD, so by setting it in the env for the child +	// process we fix up all the paths returned by the go command. +	if !i.CleanEnv { +		cmd.Env = os.Environ() +	} +	cmd.Env = append(cmd.Env, i.Env...) +	if i.WorkingDir != "" { +		cmd.Env = append(cmd.Env, "PWD="+i.WorkingDir) +		cmd.Dir = i.WorkingDir +	} +	defer func(start time.Time) { log("%s for %v", time.Since(start), cmdDebugStr(cmd)) }(time.Now()) + +	return runCmdContext(ctx, cmd) +} + +// runCmdContext is like exec.CommandContext except it sends os.Interrupt +// before os.Kill. +func runCmdContext(ctx context.Context, cmd *exec.Cmd) error { +	if err := cmd.Start(); err != nil { +		return err +	} +	resChan := make(chan error, 1) +	go func() { +		resChan <- cmd.Wait() +	}() + +	select { +	case err := <-resChan: +		return err +	case <-ctx.Done(): +	} +	// Cancelled. Interrupt and see if it ends voluntarily. +	cmd.Process.Signal(os.Interrupt) +	select { +	case err := <-resChan: +		return err +	case <-time.After(time.Second): +	} +	// Didn't shut down in response to interrupt. Kill it hard. +	cmd.Process.Kill() +	return <-resChan +} + +func cmdDebugStr(cmd *exec.Cmd) string { +	env := make(map[string]string) +	for _, kv := range cmd.Env { +		split := strings.SplitN(kv, "=", 2) +		k, v := split[0], split[1] +		env[k] = v +	} + +	var args []string +	for _, arg := range cmd.Args { +		quoted := strconv.Quote(arg) +		if quoted[1:len(quoted)-1] != arg || strings.Contains(arg, " ") { +			args = append(args, quoted) +		} else { +			args = append(args, arg) +		} +	} +	return fmt.Sprintf("GOROOT=%v GOPATH=%v GO111MODULE=%v GOPROXY=%v PWD=%v %v", env["GOROOT"], env["GOPATH"], env["GO111MODULE"], env["GOPROXY"], env["PWD"], strings.Join(args, " ")) +} diff --git a/vendor/golang.org/x/tools/internal/gocommand/vendor.go b/vendor/golang.org/x/tools/internal/gocommand/vendor.go new file mode 100644 index 000000000..5e75bd6d8 --- /dev/null +++ b/vendor/golang.org/x/tools/internal/gocommand/vendor.go @@ -0,0 +1,107 @@ +// Copyright 2020 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +package gocommand + +import ( +	"bytes" +	"context" +	"fmt" +	"os" +	"path/filepath" +	"regexp" +	"strings" +	"time" + +	"golang.org/x/mod/semver" +) + +// ModuleJSON holds information about a module. +type ModuleJSON struct { +	Path      string      // module path +	Version   string      // module version +	Versions  []string    // available module versions (with -versions) +	Replace   *ModuleJSON // replaced by this module +	Time      *time.Time  // time version was created +	Update    *ModuleJSON // available update, if any (with -u) +	Main      bool        // is this the main module? +	Indirect  bool        // is this module only an indirect dependency of main module? +	Dir       string      // directory holding files for this module, if any +	GoMod     string      // path to go.mod file used when loading this module, if any +	GoVersion string      // go version used in module +} + +var modFlagRegexp = regexp.MustCompile(`-mod[ =](\w+)`) + +// VendorEnabled reports whether vendoring is enabled. It takes a *Runner to execute Go commands +// with the supplied context.Context and Invocation. The Invocation can contain pre-defined fields, +// of which only Verb and Args are modified to run the appropriate Go command. +// Inspired by setDefaultBuildMod in modload/init.go +func VendorEnabled(ctx context.Context, inv Invocation, r *Runner) (*ModuleJSON, bool, error) { +	mainMod, go114, err := getMainModuleAnd114(ctx, inv, r) +	if err != nil { +		return nil, false, err +	} + +	// We check the GOFLAGS to see if there is anything overridden or not. +	inv.Verb = "env" +	inv.Args = []string{"GOFLAGS"} +	stdout, err := r.Run(ctx, inv) +	if err != nil { +		return nil, false, err +	} +	goflags := string(bytes.TrimSpace(stdout.Bytes())) +	matches := modFlagRegexp.FindStringSubmatch(goflags) +	var modFlag string +	if len(matches) != 0 { +		modFlag = matches[1] +	} +	if modFlag != "" { +		// Don't override an explicit '-mod=' argument. +		return mainMod, modFlag == "vendor", nil +	} +	if mainMod == nil || !go114 { +		return mainMod, false, nil +	} +	// Check 1.14's automatic vendor mode. +	if fi, err := os.Stat(filepath.Join(mainMod.Dir, "vendor")); err == nil && fi.IsDir() { +		if mainMod.GoVersion != "" && semver.Compare("v"+mainMod.GoVersion, "v1.14") >= 0 { +			// The Go version is at least 1.14, and a vendor directory exists. +			// Set -mod=vendor by default. +			return mainMod, true, nil +		} +	} +	return mainMod, false, nil +} + +// getMainModuleAnd114 gets the main module's information and whether the +// go command in use is 1.14+. This is the information needed to figure out +// if vendoring should be enabled. +func getMainModuleAnd114(ctx context.Context, inv Invocation, r *Runner) (*ModuleJSON, bool, error) { +	const format = `{{.Path}} +{{.Dir}} +{{.GoMod}} +{{.GoVersion}} +{{range context.ReleaseTags}}{{if eq . "go1.14"}}{{.}}{{end}}{{end}} +` +	inv.Verb = "list" +	inv.Args = []string{"-m", "-f", format} +	stdout, err := r.Run(ctx, inv) +	if err != nil { +		return nil, false, err +	} + +	lines := strings.Split(stdout.String(), "\n") +	if len(lines) < 5 { +		return nil, false, fmt.Errorf("unexpected stdout: %q", stdout.String()) +	} +	mod := &ModuleJSON{ +		Path:      lines[0], +		Dir:       lines[1], +		GoMod:     lines[2], +		GoVersion: lines[3], +		Main:      true, +	} +	return mod, lines[4] == "go1.14", nil +} diff --git a/vendor/golang.org/x/tools/internal/gocommand/version.go b/vendor/golang.org/x/tools/internal/gocommand/version.go new file mode 100644 index 000000000..713043680 --- /dev/null +++ b/vendor/golang.org/x/tools/internal/gocommand/version.go @@ -0,0 +1,51 @@ +// Copyright 2020 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +package gocommand + +import ( +	"context" +	"fmt" +	"strings" +) + +// GoVersion checks the go version by running "go list" with modules off. +// It returns the X in Go 1.X. +func GoVersion(ctx context.Context, inv Invocation, r *Runner) (int, error) { +	inv.Verb = "list" +	inv.Args = []string{"-e", "-f", `{{context.ReleaseTags}}`, `--`, `unsafe`} +	inv.Env = append(append([]string{}, inv.Env...), "GO111MODULE=off") +	// Unset any unneeded flags, and remove them from BuildFlags, if they're +	// present. +	inv.ModFile = "" +	inv.ModFlag = "" +	var buildFlags []string +	for _, flag := range inv.BuildFlags { +		// Flags can be prefixed by one or two dashes. +		f := strings.TrimPrefix(strings.TrimPrefix(flag, "-"), "-") +		if strings.HasPrefix(f, "mod=") || strings.HasPrefix(f, "modfile=") { +			continue +		} +		buildFlags = append(buildFlags, flag) +	} +	inv.BuildFlags = buildFlags +	stdoutBytes, err := r.Run(ctx, inv) +	if err != nil { +		return 0, err +	} +	stdout := stdoutBytes.String() +	if len(stdout) < 3 { +		return 0, fmt.Errorf("bad ReleaseTags output: %q", stdout) +	} +	// Split up "[go1.1 go1.15]" +	tags := strings.Fields(stdout[1 : len(stdout)-2]) +	for i := len(tags) - 1; i >= 0; i-- { +		var version int +		if _, err := fmt.Sscanf(tags[i], "go1.%d", &version); err != nil { +			continue +		} +		return version, nil +	} +	return 0, fmt.Errorf("no parseable ReleaseTags in %v", tags) +} diff --git a/vendor/golang.org/x/tools/internal/packagesinternal/packages.go b/vendor/golang.org/x/tools/internal/packagesinternal/packages.go new file mode 100644 index 000000000..9702094c5 --- /dev/null +++ b/vendor/golang.org/x/tools/internal/packagesinternal/packages.go @@ -0,0 +1,28 @@ +// Copyright 2020 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +// Package packagesinternal exposes internal-only fields from go/packages. +package packagesinternal + +import ( +	"golang.org/x/tools/internal/gocommand" +) + +var GetForTest = func(p interface{}) string { return "" } +var GetDepsErrors = func(p interface{}) []*PackageError { return nil } + +type PackageError struct { +	ImportStack []string // shortest path from package named on command line to this one +	Pos         string   // position of error (if present, file:line:col) +	Err         string   // the error itself +} + +var GetGoCmdRunner = func(config interface{}) *gocommand.Runner { return nil } + +var SetGoCmdRunner = func(config interface{}, runner *gocommand.Runner) {} + +var TypecheckCgo int + +var SetModFlag = func(config interface{}, value string) {} +var SetModFile = func(config interface{}, value string) {} diff --git a/vendor/golang.org/x/tools/internal/typesinternal/errorcode.go b/vendor/golang.org/x/tools/internal/typesinternal/errorcode.go new file mode 100644 index 000000000..fa2834e2a --- /dev/null +++ b/vendor/golang.org/x/tools/internal/typesinternal/errorcode.go @@ -0,0 +1,1368 @@ +// Copyright 2020 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +package typesinternal + +//go:generate stringer -type=ErrorCode + +type ErrorCode int + +// This file defines the error codes that can be produced during type-checking. +// Collectively, these codes provide an identifier that may be used to +// implement special handling for certain types of errors. +// +// Error codes should be fine-grained enough that the exact nature of the error +// can be easily determined, but coarse enough that they are not an +// implementation detail of the type checking algorithm. As a rule-of-thumb, +// errors should be considered equivalent if there is a theoretical refactoring +// of the type checker in which they are emitted in exactly one place. For +// example, the type checker emits different error messages for "too many +// arguments" and "too few arguments", but one can imagine an alternative type +// checker where this check instead just emits a single "wrong number of +// arguments", so these errors should have the same code. +// +// Error code names should be as brief as possible while retaining accuracy and +// distinctiveness. In most cases names should start with an adjective +// describing the nature of the error (e.g. "invalid", "unused", "misplaced"), +// and end with a noun identifying the relevant language object. For example, +// "DuplicateDecl" or "InvalidSliceExpr". For brevity, naming follows the +// convention that "bad" implies a problem with syntax, and "invalid" implies a +// problem with types. + +const ( +	_ ErrorCode = iota + +	// Test is reserved for errors that only apply while in self-test mode. +	Test + +	/* package names */ + +	// BlankPkgName occurs when a package name is the blank identifier "_". +	// +	// Per the spec: +	//  "The PackageName must not be the blank identifier." +	BlankPkgName + +	// MismatchedPkgName occurs when a file's package name doesn't match the +	// package name already established by other files. +	MismatchedPkgName + +	// InvalidPkgUse occurs when a package identifier is used outside of a +	// selector expression. +	// +	// Example: +	//  import "fmt" +	// +	//  var _ = fmt +	InvalidPkgUse + +	/* imports */ + +	// BadImportPath occurs when an import path is not valid. +	BadImportPath + +	// BrokenImport occurs when importing a package fails. +	// +	// Example: +	//  import "amissingpackage" +	BrokenImport + +	// ImportCRenamed occurs when the special import "C" is renamed. "C" is a +	// pseudo-package, and must not be renamed. +	// +	// Example: +	//  import _ "C" +	ImportCRenamed + +	// UnusedImport occurs when an import is unused. +	// +	// Example: +	//  import "fmt" +	// +	//  func main() {} +	UnusedImport + +	/* initialization */ + +	// InvalidInitCycle occurs when an invalid cycle is detected within the +	// initialization graph. +	// +	// Example: +	//  var x int = f() +	// +	//  func f() int { return x } +	InvalidInitCycle + +	/* decls */ + +	// DuplicateDecl occurs when an identifier is declared multiple times. +	// +	// Example: +	//  var x = 1 +	//  var x = 2 +	DuplicateDecl + +	// InvalidDeclCycle occurs when a declaration cycle is not valid. +	// +	// Example: +	//  import "unsafe" +	// +	//  type T struct { +	//  	a [n]int +	//  } +	// +	//  var n = unsafe.Sizeof(T{}) +	InvalidDeclCycle + +	// InvalidTypeCycle occurs when a cycle in type definitions results in a +	// type that is not well-defined. +	// +	// Example: +	//  import "unsafe" +	// +	//  type T [unsafe.Sizeof(T{})]int +	InvalidTypeCycle + +	/* decls > const */ + +	// InvalidConstInit occurs when a const declaration has a non-constant +	// initializer. +	// +	// Example: +	//  var x int +	//  const _ = x +	InvalidConstInit + +	// InvalidConstVal occurs when a const value cannot be converted to its +	// target type. +	// +	// TODO(findleyr): this error code and example are not very clear. Consider +	// removing it. +	// +	// Example: +	//  const _ = 1 << "hello" +	InvalidConstVal + +	// InvalidConstType occurs when the underlying type in a const declaration +	// is not a valid constant type. +	// +	// Example: +	//  const c *int = 4 +	InvalidConstType + +	/* decls > var (+ other variable assignment codes) */ + +	// UntypedNil occurs when the predeclared (untyped) value nil is used to +	// initialize a variable declared without an explicit type. +	// +	// Example: +	//  var x = nil +	UntypedNil + +	// WrongAssignCount occurs when the number of values on the right-hand side +	// of an assignment or or initialization expression does not match the number +	// of variables on the left-hand side. +	// +	// Example: +	//  var x = 1, 2 +	WrongAssignCount + +	// UnassignableOperand occurs when the left-hand side of an assignment is +	// not assignable. +	// +	// Example: +	//  func f() { +	//  	const c = 1 +	//  	c = 2 +	//  } +	UnassignableOperand + +	// NoNewVar occurs when a short variable declaration (':=') does not declare +	// new variables. +	// +	// Example: +	//  func f() { +	//  	x := 1 +	//  	x := 2 +	//  } +	NoNewVar + +	// MultiValAssignOp occurs when an assignment operation (+=, *=, etc) does +	// not have single-valued left-hand or right-hand side. +	// +	// Per the spec: +	//  "In assignment operations, both the left- and right-hand expression lists +	//  must contain exactly one single-valued expression" +	// +	// Example: +	//  func f() int { +	//  	x, y := 1, 2 +	//  	x, y += 1 +	//  	return x + y +	//  } +	MultiValAssignOp + +	// InvalidIfaceAssign occurs when a value of type T is used as an +	// interface, but T does not implement a method of the expected interface. +	// +	// Example: +	//  type I interface { +	//  	f() +	//  } +	// +	//  type T int +	// +	//  var x I = T(1) +	InvalidIfaceAssign + +	// InvalidChanAssign occurs when a chan assignment is invalid. +	// +	// Per the spec, a value x is assignable to a channel type T if: +	//  "x is a bidirectional channel value, T is a channel type, x's type V and +	//  T have identical element types, and at least one of V or T is not a +	//  defined type." +	// +	// Example: +	//  type T1 chan int +	//  type T2 chan int +	// +	//  var x T1 +	//  // Invalid assignment because both types are named +	//  var _ T2 = x +	InvalidChanAssign + +	// IncompatibleAssign occurs when the type of the right-hand side expression +	// in an assignment cannot be assigned to the type of the variable being +	// assigned. +	// +	// Example: +	//  var x []int +	//  var _ int = x +	IncompatibleAssign + +	// UnaddressableFieldAssign occurs when trying to assign to a struct field +	// in a map value. +	// +	// Example: +	//  func f() { +	//  	m := make(map[string]struct{i int}) +	//  	m["foo"].i = 42 +	//  } +	UnaddressableFieldAssign + +	/* decls > type (+ other type expression codes) */ + +	// NotAType occurs when the identifier used as the underlying type in a type +	// declaration or the right-hand side of a type alias does not denote a type. +	// +	// Example: +	//  var S = 2 +	// +	//  type T S +	NotAType + +	// InvalidArrayLen occurs when an array length is not a constant value. +	// +	// Example: +	//  var n = 3 +	//  var _ = [n]int{} +	InvalidArrayLen + +	// BlankIfaceMethod occurs when a method name is '_'. +	// +	// Per the spec: +	//  "The name of each explicitly specified method must be unique and not +	//  blank." +	// +	// Example: +	//  type T interface { +	//  	_(int) +	//  } +	BlankIfaceMethod + +	// IncomparableMapKey occurs when a map key type does not support the == and +	// != operators. +	// +	// Per the spec: +	//  "The comparison operators == and != must be fully defined for operands of +	//  the key type; thus the key type must not be a function, map, or slice." +	// +	// Example: +	//  var x map[T]int +	// +	//  type T []int +	IncomparableMapKey + +	// InvalidIfaceEmbed occurs when a non-interface type is embedded in an +	// interface. +	// +	// Example: +	//  type T struct {} +	// +	//  func (T) m() +	// +	//  type I interface { +	//  	T +	//  } +	InvalidIfaceEmbed + +	// InvalidPtrEmbed occurs when an embedded field is of the pointer form *T, +	// and T itself is itself a pointer, an unsafe.Pointer, or an interface. +	// +	// Per the spec: +	//  "An embedded field must be specified as a type name T or as a pointer to +	//  a non-interface type name *T, and T itself may not be a pointer type." +	// +	// Example: +	//  type T *int +	// +	//  type S struct { +	//  	*T +	//  } +	InvalidPtrEmbed + +	/* decls > func and method */ + +	// BadRecv occurs when a method declaration does not have exactly one +	// receiver parameter. +	// +	// Example: +	//  func () _() {} +	BadRecv + +	// InvalidRecv occurs when a receiver type expression is not of the form T +	// or *T, or T is a pointer type. +	// +	// Example: +	//  type T struct {} +	// +	//  func (**T) m() {} +	InvalidRecv + +	// DuplicateFieldAndMethod occurs when an identifier appears as both a field +	// and method name. +	// +	// Example: +	//  type T struct { +	//  	m int +	//  } +	// +	//  func (T) m() {} +	DuplicateFieldAndMethod + +	// DuplicateMethod occurs when two methods on the same receiver type have +	// the same name. +	// +	// Example: +	//  type T struct {} +	//  func (T) m() {} +	//  func (T) m(i int) int { return i } +	DuplicateMethod + +	/* decls > special */ + +	// InvalidBlank occurs when a blank identifier is used as a value or type. +	// +	// Per the spec: +	//  "The blank identifier may appear as an operand only on the left-hand side +	//  of an assignment." +	// +	// Example: +	//  var x = _ +	InvalidBlank + +	// InvalidIota occurs when the predeclared identifier iota is used outside +	// of a constant declaration. +	// +	// Example: +	//  var x = iota +	InvalidIota + +	// MissingInitBody occurs when an init function is missing its body. +	// +	// Example: +	//  func init() +	MissingInitBody + +	// InvalidInitSig occurs when an init function declares parameters or +	// results. +	// +	// Example: +	//  func init() int { return 1 } +	InvalidInitSig + +	// InvalidInitDecl occurs when init is declared as anything other than a +	// function. +	// +	// Example: +	//  var init = 1 +	InvalidInitDecl + +	// InvalidMainDecl occurs when main is declared as anything other than a +	// function, in a main package. +	InvalidMainDecl + +	/* exprs */ + +	// TooManyValues occurs when a function returns too many values for the +	// expression context in which it is used. +	// +	// Example: +	//  func ReturnTwo() (int, int) { +	//  	return 1, 2 +	//  } +	// +	//  var x = ReturnTwo() +	TooManyValues + +	// NotAnExpr occurs when a type expression is used where a value expression +	// is expected. +	// +	// Example: +	//  type T struct {} +	// +	//  func f() { +	//  	T +	//  } +	NotAnExpr + +	/* exprs > const */ + +	// TruncatedFloat occurs when a float constant is truncated to an integer +	// value. +	// +	// Example: +	//  var _ int = 98.6 +	TruncatedFloat + +	// NumericOverflow occurs when a numeric constant overflows its target type. +	// +	// Example: +	//  var x int8 = 1000 +	NumericOverflow + +	/* exprs > operation */ + +	// UndefinedOp occurs when an operator is not defined for the type(s) used +	// in an operation. +	// +	// Example: +	//  var c = "a" - "b" +	UndefinedOp + +	// MismatchedTypes occurs when operand types are incompatible in a binary +	// operation. +	// +	// Example: +	//  var a = "hello" +	//  var b = 1 +	//  var c = a - b +	MismatchedTypes + +	// DivByZero occurs when a division operation is provable at compile +	// time to be a division by zero. +	// +	// Example: +	//  const divisor = 0 +	//  var x int = 1/divisor +	DivByZero + +	// NonNumericIncDec occurs when an increment or decrement operator is +	// applied to a non-numeric value. +	// +	// Example: +	//  func f() { +	//  	var c = "c" +	//  	c++ +	//  } +	NonNumericIncDec + +	/* exprs > ptr */ + +	// UnaddressableOperand occurs when the & operator is applied to an +	// unaddressable expression. +	// +	// Example: +	//  var x = &1 +	UnaddressableOperand + +	// InvalidIndirection occurs when a non-pointer value is indirected via the +	// '*' operator. +	// +	// Example: +	//  var x int +	//  var y = *x +	InvalidIndirection + +	/* exprs > [] */ + +	// NonIndexableOperand occurs when an index operation is applied to a value +	// that cannot be indexed. +	// +	// Example: +	//  var x = 1 +	//  var y = x[1] +	NonIndexableOperand + +	// InvalidIndex occurs when an index argument is not of integer type, +	// negative, or out-of-bounds. +	// +	// Example: +	//  var s = [...]int{1,2,3} +	//  var x = s[5] +	// +	// Example: +	//  var s = []int{1,2,3} +	//  var _ = s[-1] +	// +	// Example: +	//  var s = []int{1,2,3} +	//  var i string +	//  var _ = s[i] +	InvalidIndex + +	// SwappedSliceIndices occurs when constant indices in a slice expression +	// are decreasing in value. +	// +	// Example: +	//  var _ = []int{1,2,3}[2:1] +	SwappedSliceIndices + +	/* operators > slice */ + +	// NonSliceableOperand occurs when a slice operation is applied to a value +	// whose type is not sliceable, or is unaddressable. +	// +	// Example: +	//  var x = [...]int{1, 2, 3}[:1] +	// +	// Example: +	//  var x = 1 +	//  var y = 1[:1] +	NonSliceableOperand + +	// InvalidSliceExpr occurs when a three-index slice expression (a[x:y:z]) is +	// applied to a string. +	// +	// Example: +	//  var s = "hello" +	//  var x = s[1:2:3] +	InvalidSliceExpr + +	/* exprs > shift */ + +	// InvalidShiftCount occurs when the right-hand side of a shift operation is +	// either non-integer, negative, or too large. +	// +	// Example: +	//  var ( +	//  	x string +	//  	y int = 1 << x +	//  ) +	InvalidShiftCount + +	// InvalidShiftOperand occurs when the shifted operand is not an integer. +	// +	// Example: +	//  var s = "hello" +	//  var x = s << 2 +	InvalidShiftOperand + +	/* exprs > chan */ + +	// InvalidReceive occurs when there is a channel receive from a value that +	// is either not a channel, or is a send-only channel. +	// +	// Example: +	//  func f() { +	//  	var x = 1 +	//  	<-x +	//  } +	InvalidReceive + +	// InvalidSend occurs when there is a channel send to a value that is not a +	// channel, or is a receive-only channel. +	// +	// Example: +	//  func f() { +	//  	var x = 1 +	//  	x <- "hello!" +	//  } +	InvalidSend + +	/* exprs > literal */ + +	// DuplicateLitKey occurs when an index is duplicated in a slice, array, or +	// map literal. +	// +	// Example: +	//  var _ = []int{0:1, 0:2} +	// +	// Example: +	//  var _ = map[string]int{"a": 1, "a": 2} +	DuplicateLitKey + +	// MissingLitKey occurs when a map literal is missing a key expression. +	// +	// Example: +	//  var _ = map[string]int{1} +	MissingLitKey + +	// InvalidLitIndex occurs when the key in a key-value element of a slice or +	// array literal is not an integer constant. +	// +	// Example: +	//  var i = 0 +	//  var x = []string{i: "world"} +	InvalidLitIndex + +	// OversizeArrayLit occurs when an array literal exceeds its length. +	// +	// Example: +	//  var _ = [2]int{1,2,3} +	OversizeArrayLit + +	// MixedStructLit occurs when a struct literal contains a mix of positional +	// and named elements. +	// +	// Example: +	//  var _ = struct{i, j int}{i: 1, 2} +	MixedStructLit + +	// InvalidStructLit occurs when a positional struct literal has an incorrect +	// number of values. +	// +	// Example: +	//  var _ = struct{i, j int}{1,2,3} +	InvalidStructLit + +	// MissingLitField occurs when a struct literal refers to a field that does +	// not exist on the struct type. +	// +	// Example: +	//  var _ = struct{i int}{j: 2} +	MissingLitField + +	// DuplicateLitField occurs when a struct literal contains duplicated +	// fields. +	// +	// Example: +	//  var _ = struct{i int}{i: 1, i: 2} +	DuplicateLitField + +	// UnexportedLitField occurs when a positional struct literal implicitly +	// assigns an unexported field of an imported type. +	UnexportedLitField + +	// InvalidLitField occurs when a field name is not a valid identifier. +	// +	// Example: +	//  var _ = struct{i int}{1: 1} +	InvalidLitField + +	// UntypedLit occurs when a composite literal omits a required type +	// identifier. +	// +	// Example: +	//  type outer struct{ +	//  	inner struct { i int } +	//  } +	// +	//  var _ = outer{inner: {1}} +	UntypedLit + +	// InvalidLit occurs when a composite literal expression does not match its +	// type. +	// +	// Example: +	//  type P *struct{ +	//  	x int +	//  } +	//  var _ = P {} +	InvalidLit + +	/* exprs > selector */ + +	// AmbiguousSelector occurs when a selector is ambiguous. +	// +	// Example: +	//  type E1 struct { i int } +	//  type E2 struct { i int } +	//  type T struct { E1; E2 } +	// +	//  var x T +	//  var _ = x.i +	AmbiguousSelector + +	// UndeclaredImportedName occurs when a package-qualified identifier is +	// undeclared by the imported package. +	// +	// Example: +	//  import "go/types" +	// +	//  var _ = types.NotAnActualIdentifier +	UndeclaredImportedName + +	// UnexportedName occurs when a selector refers to an unexported identifier +	// of an imported package. +	// +	// Example: +	//  import "reflect" +	// +	//  type _ reflect.flag +	UnexportedName + +	// UndeclaredName occurs when an identifier is not declared in the current +	// scope. +	// +	// Example: +	//  var x T +	UndeclaredName + +	// MissingFieldOrMethod occurs when a selector references a field or method +	// that does not exist. +	// +	// Example: +	//  type T struct {} +	// +	//  var x = T{}.f +	MissingFieldOrMethod + +	/* exprs > ... */ + +	// BadDotDotDotSyntax occurs when a "..." occurs in a context where it is +	// not valid. +	// +	// Example: +	//  var _ = map[int][...]int{0: {}} +	BadDotDotDotSyntax + +	// NonVariadicDotDotDot occurs when a "..." is used on the final argument to +	// a non-variadic function. +	// +	// Example: +	//  func printArgs(s []string) { +	//  	for _, a := range s { +	//  		println(a) +	//  	} +	//  } +	// +	//  func f() { +	//  	s := []string{"a", "b", "c"} +	//  	printArgs(s...) +	//  } +	NonVariadicDotDotDot + +	// MisplacedDotDotDot occurs when a "..." is used somewhere other than the +	// final argument to a function call. +	// +	// Example: +	//  func printArgs(args ...int) { +	//  	for _, a := range args { +	//  		println(a) +	//  	} +	//  } +	// +	//  func f() { +	//  	a := []int{1,2,3} +	//  	printArgs(0, a...) +	//  } +	MisplacedDotDotDot + +	// InvalidDotDotDotOperand occurs when a "..." operator is applied to a +	// single-valued operand. +	// +	// Example: +	//  func printArgs(args ...int) { +	//  	for _, a := range args { +	//  		println(a) +	//  	} +	//  } +	// +	//  func f() { +	//  	a := 1 +	//  	printArgs(a...) +	//  } +	// +	// Example: +	//  func args() (int, int) { +	//  	return 1, 2 +	//  } +	// +	//  func printArgs(args ...int) { +	//  	for _, a := range args { +	//  		println(a) +	//  	} +	//  } +	// +	//  func g() { +	//  	printArgs(args()...) +	//  } +	InvalidDotDotDotOperand + +	// InvalidDotDotDot occurs when a "..." is used in a non-variadic built-in +	// function. +	// +	// Example: +	//  var s = []int{1, 2, 3} +	//  var l = len(s...) +	InvalidDotDotDot + +	/* exprs > built-in */ + +	// UncalledBuiltin occurs when a built-in function is used as a +	// function-valued expression, instead of being called. +	// +	// Per the spec: +	//  "The built-in functions do not have standard Go types, so they can only +	//  appear in call expressions; they cannot be used as function values." +	// +	// Example: +	//  var _ = copy +	UncalledBuiltin + +	// InvalidAppend occurs when append is called with a first argument that is +	// not a slice. +	// +	// Example: +	//  var _ = append(1, 2) +	InvalidAppend + +	// InvalidCap occurs when an argument to the cap built-in function is not of +	// supported type. +	// +	// See https://golang.org/ref/spec#Lengthand_capacity for information on +	// which underlying types are supported as arguments to cap and len. +	// +	// Example: +	//  var s = 2 +	//  var x = cap(s) +	InvalidCap + +	// InvalidClose occurs when close(...) is called with an argument that is +	// not of channel type, or that is a receive-only channel. +	// +	// Example: +	//  func f() { +	//  	var x int +	//  	close(x) +	//  } +	InvalidClose + +	// InvalidCopy occurs when the arguments are not of slice type or do not +	// have compatible type. +	// +	// See https://golang.org/ref/spec#Appendingand_copying_slices for more +	// information on the type requirements for the copy built-in. +	// +	// Example: +	//  func f() { +	//  	var x []int +	//  	y := []int64{1,2,3} +	//  	copy(x, y) +	//  } +	InvalidCopy + +	// InvalidComplex occurs when the complex built-in function is called with +	// arguments with incompatible types. +	// +	// Example: +	//  var _ = complex(float32(1), float64(2)) +	InvalidComplex + +	// InvalidDelete occurs when the delete built-in function is called with a +	// first argument that is not a map. +	// +	// Example: +	//  func f() { +	//  	m := "hello" +	//  	delete(m, "e") +	//  } +	InvalidDelete + +	// InvalidImag occurs when the imag built-in function is called with an +	// argument that does not have complex type. +	// +	// Example: +	//  var _ = imag(int(1)) +	InvalidImag + +	// InvalidLen occurs when an argument to the len built-in function is not of +	// supported type. +	// +	// See https://golang.org/ref/spec#Lengthand_capacity for information on +	// which underlying types are supported as arguments to cap and len. +	// +	// Example: +	//  var s = 2 +	//  var x = len(s) +	InvalidLen + +	// SwappedMakeArgs occurs when make is called with three arguments, and its +	// length argument is larger than its capacity argument. +	// +	// Example: +	//  var x = make([]int, 3, 2) +	SwappedMakeArgs + +	// InvalidMake occurs when make is called with an unsupported type argument. +	// +	// See https://golang.org/ref/spec#Makingslices_maps_and_channels for +	// information on the types that may be created using make. +	// +	// Example: +	//  var x = make(int) +	InvalidMake + +	// InvalidReal occurs when the real built-in function is called with an +	// argument that does not have complex type. +	// +	// Example: +	//  var _ = real(int(1)) +	InvalidReal + +	/* exprs > assertion */ + +	// InvalidAssert occurs when a type assertion is applied to a +	// value that is not of interface type. +	// +	// Example: +	//  var x = 1 +	//  var _ = x.(float64) +	InvalidAssert + +	// ImpossibleAssert occurs for a type assertion x.(T) when the value x of +	// interface cannot have dynamic type T, due to a missing or mismatching +	// method on T. +	// +	// Example: +	//  type T int +	// +	//  func (t *T) m() int { return int(*t) } +	// +	//  type I interface { m() int } +	// +	//  var x I +	//  var _ = x.(T) +	ImpossibleAssert + +	/* exprs > conversion */ + +	// InvalidConversion occurs when the argument type cannot be converted to the +	// target. +	// +	// See https://golang.org/ref/spec#Conversions for the rules of +	// convertibility. +	// +	// Example: +	//  var x float64 +	//  var _ = string(x) +	InvalidConversion + +	// InvalidUntypedConversion occurs when an there is no valid implicit +	// conversion from an untyped value satisfying the type constraints of the +	// context in which it is used. +	// +	// Example: +	//  var _ = 1 + "" +	InvalidUntypedConversion + +	/* offsetof */ + +	// BadOffsetofSyntax occurs when unsafe.Offsetof is called with an argument +	// that is not a selector expression. +	// +	// Example: +	//  import "unsafe" +	// +	//  var x int +	//  var _ = unsafe.Offsetof(x) +	BadOffsetofSyntax + +	// InvalidOffsetof occurs when unsafe.Offsetof is called with a method +	// selector, rather than a field selector, or when the field is embedded via +	// a pointer. +	// +	// Per the spec: +	// +	//  "If f is an embedded field, it must be reachable without pointer +	//  indirections through fields of the struct. " +	// +	// Example: +	//  import "unsafe" +	// +	//  type T struct { f int } +	//  type S struct { *T } +	//  var s S +	//  var _ = unsafe.Offsetof(s.f) +	// +	// Example: +	//  import "unsafe" +	// +	//  type S struct{} +	// +	//  func (S) m() {} +	// +	//  var s S +	//  var _ = unsafe.Offsetof(s.m) +	InvalidOffsetof + +	/* control flow > scope */ + +	// UnusedExpr occurs when a side-effect free expression is used as a +	// statement. Such a statement has no effect. +	// +	// Example: +	//  func f(i int) { +	//  	i*i +	//  } +	UnusedExpr + +	// UnusedVar occurs when a variable is declared but unused. +	// +	// Example: +	//  func f() { +	//  	x := 1 +	//  } +	UnusedVar + +	// MissingReturn occurs when a function with results is missing a return +	// statement. +	// +	// Example: +	//  func f() int {} +	MissingReturn + +	// WrongResultCount occurs when a return statement returns an incorrect +	// number of values. +	// +	// Example: +	//  func ReturnOne() int { +	//  	return 1, 2 +	//  } +	WrongResultCount + +	// OutOfScopeResult occurs when the name of a value implicitly returned by +	// an empty return statement is shadowed in a nested scope. +	// +	// Example: +	//  func factor(n int) (i int) { +	//  	for i := 2; i < n; i++ { +	//  		if n%i == 0 { +	//  			return +	//  		} +	//  	} +	//  	return 0 +	//  } +	OutOfScopeResult + +	/* control flow > if */ + +	// InvalidCond occurs when an if condition is not a boolean expression. +	// +	// Example: +	//  func checkReturn(i int) { +	//  	if i { +	//  		panic("non-zero return") +	//  	} +	//  } +	InvalidCond + +	/* control flow > for */ + +	// InvalidPostDecl occurs when there is a declaration in a for-loop post +	// statement. +	// +	// Example: +	//  func f() { +	//  	for i := 0; i < 10; j := 0 {} +	//  } +	InvalidPostDecl + +	// InvalidChanRange occurs when a send-only channel used in a range +	// expression. +	// +	// Example: +	//  func sum(c chan<- int) { +	//  	s := 0 +	//  	for i := range c { +	//  		s += i +	//  	} +	//  } +	InvalidChanRange + +	// InvalidIterVar occurs when two iteration variables are used while ranging +	// over a channel. +	// +	// Example: +	//  func f(c chan int) { +	//  	for k, v := range c { +	//  		println(k, v) +	//  	} +	//  } +	InvalidIterVar + +	// InvalidRangeExpr occurs when the type of a range expression is not array, +	// slice, string, map, or channel. +	// +	// Example: +	//  func f(i int) { +	//  	for j := range i { +	//  		println(j) +	//  	} +	//  } +	InvalidRangeExpr + +	/* control flow > switch */ + +	// MisplacedBreak occurs when a break statement is not within a for, switch, +	// or select statement of the innermost function definition. +	// +	// Example: +	//  func f() { +	//  	break +	//  } +	MisplacedBreak + +	// MisplacedContinue occurs when a continue statement is not within a for +	// loop of the innermost function definition. +	// +	// Example: +	//  func sumeven(n int) int { +	//  	proceed := func() { +	//  		continue +	//  	} +	//  	sum := 0 +	//  	for i := 1; i <= n; i++ { +	//  		if i % 2 != 0 { +	//  			proceed() +	//  		} +	//  		sum += i +	//  	} +	//  	return sum +	//  } +	MisplacedContinue + +	// MisplacedFallthrough occurs when a fallthrough statement is not within an +	// expression switch. +	// +	// Example: +	//  func typename(i interface{}) string { +	//  	switch i.(type) { +	//  	case int64: +	//  		fallthrough +	//  	case int: +	//  		return "int" +	//  	} +	//  	return "unsupported" +	//  } +	MisplacedFallthrough + +	// DuplicateCase occurs when a type or expression switch has duplicate +	// cases. +	// +	// Example: +	//  func printInt(i int) { +	//  	switch i { +	//  	case 1: +	//  		println("one") +	//  	case 1: +	//  		println("One") +	//  	} +	//  } +	DuplicateCase + +	// DuplicateDefault occurs when a type or expression switch has multiple +	// default clauses. +	// +	// Example: +	//  func printInt(i int) { +	//  	switch i { +	//  	case 1: +	//  		println("one") +	//  	default: +	//  		println("One") +	//  	default: +	//  		println("1") +	//  	} +	//  } +	DuplicateDefault + +	// BadTypeKeyword occurs when a .(type) expression is used anywhere other +	// than a type switch. +	// +	// Example: +	//  type I interface { +	//  	m() +	//  } +	//  var t I +	//  var _ = t.(type) +	BadTypeKeyword + +	// InvalidTypeSwitch occurs when .(type) is used on an expression that is +	// not of interface type. +	// +	// Example: +	//  func f(i int) { +	//  	switch x := i.(type) {} +	//  } +	InvalidTypeSwitch + +	// InvalidExprSwitch occurs when a switch expression is not comparable. +	// +	// Example: +	//  func _() { +	//  	var a struct{ _ func() } +	//  	switch a /* ERROR cannot switch on a */ { +	//  	} +	//  } +	InvalidExprSwitch + +	/* control flow > select */ + +	// InvalidSelectCase occurs when a select case is not a channel send or +	// receive. +	// +	// Example: +	//  func checkChan(c <-chan int) bool { +	//  	select { +	//  	case c: +	//  		return true +	//  	default: +	//  		return false +	//  	} +	//  } +	InvalidSelectCase + +	/* control flow > labels and jumps */ + +	// UndeclaredLabel occurs when an undeclared label is jumped to. +	// +	// Example: +	//  func f() { +	//  	goto L +	//  } +	UndeclaredLabel + +	// DuplicateLabel occurs when a label is declared more than once. +	// +	// Example: +	//  func f() int { +	//  L: +	//  L: +	//  	return 1 +	//  } +	DuplicateLabel + +	// MisplacedLabel occurs when a break or continue label is not on a for, +	// switch, or select statement. +	// +	// Example: +	//  func f() { +	//  L: +	//  	a := []int{1,2,3} +	//  	for _, e := range a { +	//  		if e > 10 { +	//  			break L +	//  		} +	//  		println(a) +	//  	} +	//  } +	MisplacedLabel + +	// UnusedLabel occurs when a label is declared but not used. +	// +	// Example: +	//  func f() { +	//  L: +	//  } +	UnusedLabel + +	// JumpOverDecl occurs when a label jumps over a variable declaration. +	// +	// Example: +	//  func f() int { +	//  	goto L +	//  	x := 2 +	//  L: +	//  	x++ +	//  	return x +	//  } +	JumpOverDecl + +	// JumpIntoBlock occurs when a forward jump goes to a label inside a nested +	// block. +	// +	// Example: +	//  func f(x int) { +	//  	goto L +	//  	if x > 0 { +	//  	L: +	//  		print("inside block") +	//  	} +	// } +	JumpIntoBlock + +	/* control flow > calls */ + +	// InvalidMethodExpr occurs when a pointer method is called but the argument +	// is not addressable. +	// +	// Example: +	//  type T struct {} +	// +	//  func (*T) m() int { return 1 } +	// +	//  var _ = T.m(T{}) +	InvalidMethodExpr + +	// WrongArgCount occurs when too few or too many arguments are passed by a +	// function call. +	// +	// Example: +	//  func f(i int) {} +	//  var x = f() +	WrongArgCount + +	// InvalidCall occurs when an expression is called that is not of function +	// type. +	// +	// Example: +	//  var x = "x" +	//  var y = x() +	InvalidCall + +	/* control flow > suspended */ + +	// UnusedResults occurs when a restricted expression-only built-in function +	// is suspended via go or defer. Such a suspension discards the results of +	// these side-effect free built-in functions, and therefore is ineffectual. +	// +	// Example: +	//  func f(a []int) int { +	//  	defer len(a) +	//  	return i +	//  } +	UnusedResults + +	// InvalidDefer occurs when a deferred expression is not a function call, +	// for example if the expression is a type conversion. +	// +	// Example: +	//  func f(i int) int { +	//  	defer int32(i) +	//  	return i +	//  } +	InvalidDefer + +	// InvalidGo occurs when a go expression is not a function call, for example +	// if the expression is a type conversion. +	// +	// Example: +	//  func f(i int) int { +	//  	go int32(i) +	//  	return i +	//  } +	InvalidGo +) diff --git a/vendor/golang.org/x/tools/internal/typesinternal/errorcode_string.go b/vendor/golang.org/x/tools/internal/typesinternal/errorcode_string.go new file mode 100644 index 000000000..3e5842a5f --- /dev/null +++ b/vendor/golang.org/x/tools/internal/typesinternal/errorcode_string.go @@ -0,0 +1,153 @@ +// Code generated by "stringer -type=ErrorCode"; DO NOT EDIT. + +package typesinternal + +import "strconv" + +func _() { +	// An "invalid array index" compiler error signifies that the constant values have changed. +	// Re-run the stringer command to generate them again. +	var x [1]struct{} +	_ = x[Test-1] +	_ = x[BlankPkgName-2] +	_ = x[MismatchedPkgName-3] +	_ = x[InvalidPkgUse-4] +	_ = x[BadImportPath-5] +	_ = x[BrokenImport-6] +	_ = x[ImportCRenamed-7] +	_ = x[UnusedImport-8] +	_ = x[InvalidInitCycle-9] +	_ = x[DuplicateDecl-10] +	_ = x[InvalidDeclCycle-11] +	_ = x[InvalidTypeCycle-12] +	_ = x[InvalidConstInit-13] +	_ = x[InvalidConstVal-14] +	_ = x[InvalidConstType-15] +	_ = x[UntypedNil-16] +	_ = x[WrongAssignCount-17] +	_ = x[UnassignableOperand-18] +	_ = x[NoNewVar-19] +	_ = x[MultiValAssignOp-20] +	_ = x[InvalidIfaceAssign-21] +	_ = x[InvalidChanAssign-22] +	_ = x[IncompatibleAssign-23] +	_ = x[UnaddressableFieldAssign-24] +	_ = x[NotAType-25] +	_ = x[InvalidArrayLen-26] +	_ = x[BlankIfaceMethod-27] +	_ = x[IncomparableMapKey-28] +	_ = x[InvalidIfaceEmbed-29] +	_ = x[InvalidPtrEmbed-30] +	_ = x[BadRecv-31] +	_ = x[InvalidRecv-32] +	_ = x[DuplicateFieldAndMethod-33] +	_ = x[DuplicateMethod-34] +	_ = x[InvalidBlank-35] +	_ = x[InvalidIota-36] +	_ = x[MissingInitBody-37] +	_ = x[InvalidInitSig-38] +	_ = x[InvalidInitDecl-39] +	_ = x[InvalidMainDecl-40] +	_ = x[TooManyValues-41] +	_ = x[NotAnExpr-42] +	_ = x[TruncatedFloat-43] +	_ = x[NumericOverflow-44] +	_ = x[UndefinedOp-45] +	_ = x[MismatchedTypes-46] +	_ = x[DivByZero-47] +	_ = x[NonNumericIncDec-48] +	_ = x[UnaddressableOperand-49] +	_ = x[InvalidIndirection-50] +	_ = x[NonIndexableOperand-51] +	_ = x[InvalidIndex-52] +	_ = x[SwappedSliceIndices-53] +	_ = x[NonSliceableOperand-54] +	_ = x[InvalidSliceExpr-55] +	_ = x[InvalidShiftCount-56] +	_ = x[InvalidShiftOperand-57] +	_ = x[InvalidReceive-58] +	_ = x[InvalidSend-59] +	_ = x[DuplicateLitKey-60] +	_ = x[MissingLitKey-61] +	_ = x[InvalidLitIndex-62] +	_ = x[OversizeArrayLit-63] +	_ = x[MixedStructLit-64] +	_ = x[InvalidStructLit-65] +	_ = x[MissingLitField-66] +	_ = x[DuplicateLitField-67] +	_ = x[UnexportedLitField-68] +	_ = x[InvalidLitField-69] +	_ = x[UntypedLit-70] +	_ = x[InvalidLit-71] +	_ = x[AmbiguousSelector-72] +	_ = x[UndeclaredImportedName-73] +	_ = x[UnexportedName-74] +	_ = x[UndeclaredName-75] +	_ = x[MissingFieldOrMethod-76] +	_ = x[BadDotDotDotSyntax-77] +	_ = x[NonVariadicDotDotDot-78] +	_ = x[MisplacedDotDotDot-79] +	_ = x[InvalidDotDotDotOperand-80] +	_ = x[InvalidDotDotDot-81] +	_ = x[UncalledBuiltin-82] +	_ = x[InvalidAppend-83] +	_ = x[InvalidCap-84] +	_ = x[InvalidClose-85] +	_ = x[InvalidCopy-86] +	_ = x[InvalidComplex-87] +	_ = x[InvalidDelete-88] +	_ = x[InvalidImag-89] +	_ = x[InvalidLen-90] +	_ = x[SwappedMakeArgs-91] +	_ = x[InvalidMake-92] +	_ = x[InvalidReal-93] +	_ = x[InvalidAssert-94] +	_ = x[ImpossibleAssert-95] +	_ = x[InvalidConversion-96] +	_ = x[InvalidUntypedConversion-97] +	_ = x[BadOffsetofSyntax-98] +	_ = x[InvalidOffsetof-99] +	_ = x[UnusedExpr-100] +	_ = x[UnusedVar-101] +	_ = x[MissingReturn-102] +	_ = x[WrongResultCount-103] +	_ = x[OutOfScopeResult-104] +	_ = x[InvalidCond-105] +	_ = x[InvalidPostDecl-106] +	_ = x[InvalidChanRange-107] +	_ = x[InvalidIterVar-108] +	_ = x[InvalidRangeExpr-109] +	_ = x[MisplacedBreak-110] +	_ = x[MisplacedContinue-111] +	_ = x[MisplacedFallthrough-112] +	_ = x[DuplicateCase-113] +	_ = x[DuplicateDefault-114] +	_ = x[BadTypeKeyword-115] +	_ = x[InvalidTypeSwitch-116] +	_ = x[InvalidExprSwitch-117] +	_ = x[InvalidSelectCase-118] +	_ = x[UndeclaredLabel-119] +	_ = x[DuplicateLabel-120] +	_ = x[MisplacedLabel-121] +	_ = x[UnusedLabel-122] +	_ = x[JumpOverDecl-123] +	_ = x[JumpIntoBlock-124] +	_ = x[InvalidMethodExpr-125] +	_ = x[WrongArgCount-126] +	_ = x[InvalidCall-127] +	_ = x[UnusedResults-128] +	_ = x[InvalidDefer-129] +	_ = x[InvalidGo-130] +} + +const _ErrorCode_name = "TestBlankPkgNameMismatchedPkgNameInvalidPkgUseBadImportPathBrokenImportImportCRenamedUnusedImportInvalidInitCycleDuplicateDeclInvalidDeclCycleInvalidTypeCycleInvalidConstInitInvalidConstValInvalidConstTypeUntypedNilWrongAssignCountUnassignableOperandNoNewVarMultiValAssignOpInvalidIfaceAssignInvalidChanAssignIncompatibleAssignUnaddressableFieldAssignNotATypeInvalidArrayLenBlankIfaceMethodIncomparableMapKeyInvalidIfaceEmbedInvalidPtrEmbedBadRecvInvalidRecvDuplicateFieldAndMethodDuplicateMethodInvalidBlankInvalidIotaMissingInitBodyInvalidInitSigInvalidInitDeclInvalidMainDeclTooManyValuesNotAnExprTruncatedFloatNumericOverflowUndefinedOpMismatchedTypesDivByZeroNonNumericIncDecUnaddressableOperandInvalidIndirectionNonIndexableOperandInvalidIndexSwappedSliceIndicesNonSliceableOperandInvalidSliceExprInvalidShiftCountInvalidShiftOperandInvalidReceiveInvalidSendDuplicateLitKeyMissingLitKeyInvalidLitIndexOversizeArrayLitMixedStructLitInvalidStructLitMissingLitFieldDuplicateLitFieldUnexportedLitFieldInvalidLitFieldUntypedLitInvalidLitAmbiguousSelectorUndeclaredImportedNameUnexportedNameUndeclaredNameMissingFieldOrMethodBadDotDotDotSyntaxNonVariadicDotDotDotMisplacedDotDotDotInvalidDotDotDotOperandInvalidDotDotDotUncalledBuiltinInvalidAppendInvalidCapInvalidCloseInvalidCopyInvalidComplexInvalidDeleteInvalidImagInvalidLenSwappedMakeArgsInvalidMakeInvalidRealInvalidAssertImpossibleAssertInvalidConversionInvalidUntypedConversionBadOffsetofSyntaxInvalidOffsetofUnusedExprUnusedVarMissingReturnWrongResultCountOutOfScopeResultInvalidCondInvalidPostDeclInvalidChanRangeInvalidIterVarInvalidRangeExprMisplacedBreakMisplacedContinueMisplacedFallthroughDuplicateCaseDuplicateDefaultBadTypeKeywordInvalidTypeSwitchInvalidExprSwitchInvalidSelectCaseUndeclaredLabelDuplicateLabelMisplacedLabelUnusedLabelJumpOverDeclJumpIntoBlockInvalidMethodExprWrongArgCountInvalidCallUnusedResultsInvalidDeferInvalidGo" + +var _ErrorCode_index = [...]uint16{0, 4, 16, 33, 46, 59, 71, 85, 97, 113, 126, 142, 158, 174, 189, 205, 215, 231, 250, 258, 274, 292, 309, 327, 351, 359, 374, 390, 408, 425, 440, 447, 458, 481, 496, 508, 519, 534, 548, 563, 578, 591, 600, 614, 629, 640, 655, 664, 680, 700, 718, 737, 749, 768, 787, 803, 820, 839, 853, 864, 879, 892, 907, 923, 937, 953, 968, 985, 1003, 1018, 1028, 1038, 1055, 1077, 1091, 1105, 1125, 1143, 1163, 1181, 1204, 1220, 1235, 1248, 1258, 1270, 1281, 1295, 1308, 1319, 1329, 1344, 1355, 1366, 1379, 1395, 1412, 1436, 1453, 1468, 1478, 1487, 1500, 1516, 1532, 1543, 1558, 1574, 1588, 1604, 1618, 1635, 1655, 1668, 1684, 1698, 1715, 1732, 1749, 1764, 1778, 1792, 1803, 1815, 1828, 1845, 1858, 1869, 1882, 1894, 1903} + +func (i ErrorCode) String() string { +	i -= 1 +	if i < 0 || i >= ErrorCode(len(_ErrorCode_index)-1) { +		return "ErrorCode(" + strconv.FormatInt(int64(i+1), 10) + ")" +	} +	return _ErrorCode_name[_ErrorCode_index[i]:_ErrorCode_index[i+1]] +} diff --git a/vendor/golang.org/x/tools/internal/typesinternal/types.go b/vendor/golang.org/x/tools/internal/typesinternal/types.go new file mode 100644 index 000000000..c3e1a397d --- /dev/null +++ b/vendor/golang.org/x/tools/internal/typesinternal/types.go @@ -0,0 +1,45 @@ +// Copyright 2020 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +// Package typesinternal provides access to internal go/types APIs that are not +// yet exported. +package typesinternal + +import ( +	"go/token" +	"go/types" +	"reflect" +	"unsafe" +) + +func SetUsesCgo(conf *types.Config) bool { +	v := reflect.ValueOf(conf).Elem() + +	f := v.FieldByName("go115UsesCgo") +	if !f.IsValid() { +		f = v.FieldByName("UsesCgo") +		if !f.IsValid() { +			return false +		} +	} + +	addr := unsafe.Pointer(f.UnsafeAddr()) +	*(*bool)(addr) = true + +	return true +} + +func ReadGo116ErrorData(terr types.Error) (ErrorCode, token.Pos, token.Pos, bool) { +	var data [3]int +	// By coincidence all of these fields are ints, which simplifies things. +	v := reflect.ValueOf(terr) +	for i, name := range []string{"go116code", "go116start", "go116end"} { +		f := v.FieldByName(name) +		if !f.IsValid() { +			return 0, 0, 0, false +		} +		data[i] = int(f.Int()) +	} +	return ErrorCode(data[0]), token.Pos(data[1]), token.Pos(data[2]), true +} diff --git a/vendor/golang.org/x/xerrors/LICENSE b/vendor/golang.org/x/xerrors/LICENSE new file mode 100644 index 000000000..e4a47e17f --- /dev/null +++ b/vendor/golang.org/x/xerrors/LICENSE @@ -0,0 +1,27 @@ +Copyright (c) 2019 The Go Authors. All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are +met: + +   * Redistributions of source code must retain the above copyright +notice, this list of conditions and the following disclaimer. +   * Redistributions in binary form must reproduce the above +copyright notice, this list of conditions and the following disclaimer +in the documentation and/or other materials provided with the +distribution. +   * Neither the name of Google Inc. nor the names of its +contributors may be used to endorse or promote products derived from +this software without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. diff --git a/vendor/golang.org/x/xerrors/PATENTS b/vendor/golang.org/x/xerrors/PATENTS new file mode 100644 index 000000000..733099041 --- /dev/null +++ b/vendor/golang.org/x/xerrors/PATENTS @@ -0,0 +1,22 @@ +Additional IP Rights Grant (Patents) + +"This implementation" means the copyrightable works distributed by +Google as part of the Go project. + +Google hereby grants to You a perpetual, worldwide, non-exclusive, +no-charge, royalty-free, irrevocable (except as stated in this section) +patent license to make, have made, use, offer to sell, sell, import, +transfer and otherwise run, modify and propagate the contents of this +implementation of Go, where such license applies only to those patent +claims, both currently owned or controlled by Google and acquired in +the future, licensable by Google that are necessarily infringed by this +implementation of Go.  This grant does not include claims that would be +infringed only as a consequence of further modification of this +implementation.  If you or your agent or exclusive licensee institute or +order or agree to the institution of patent litigation against any +entity (including a cross-claim or counterclaim in a lawsuit) alleging +that this implementation of Go or any code incorporated within this +implementation of Go constitutes direct or contributory patent +infringement, or inducement of patent infringement, then any patent +rights granted to you under this License for this implementation of Go +shall terminate as of the date such litigation is filed. diff --git a/vendor/golang.org/x/xerrors/README b/vendor/golang.org/x/xerrors/README new file mode 100644 index 000000000..aac7867a5 --- /dev/null +++ b/vendor/golang.org/x/xerrors/README @@ -0,0 +1,2 @@ +This repository holds the transition packages for the new Go 1.13 error values. +See golang.org/design/29934-error-values. diff --git a/vendor/golang.org/x/xerrors/adaptor.go b/vendor/golang.org/x/xerrors/adaptor.go new file mode 100644 index 000000000..4317f2483 --- /dev/null +++ b/vendor/golang.org/x/xerrors/adaptor.go @@ -0,0 +1,193 @@ +// 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 xerrors + +import ( +	"bytes" +	"fmt" +	"io" +	"reflect" +	"strconv" +) + +// FormatError calls the FormatError method of f with an errors.Printer +// configured according to s and verb, and writes the result to s. +func FormatError(f Formatter, s fmt.State, verb rune) { +	// Assuming this function is only called from the Format method, and given +	// that FormatError takes precedence over Format, it cannot be called from +	// any package that supports errors.Formatter. It is therefore safe to +	// disregard that State may be a specific printer implementation and use one +	// of our choice instead. + +	// limitations: does not support printing error as Go struct. + +	var ( +		sep    = " " // separator before next error +		p      = &state{State: s} +		direct = true +	) + +	var err error = f + +	switch verb { +	// Note that this switch must match the preference order +	// for ordinary string printing (%#v before %+v, and so on). + +	case 'v': +		if s.Flag('#') { +			if stringer, ok := err.(fmt.GoStringer); ok { +				io.WriteString(&p.buf, stringer.GoString()) +				goto exit +			} +			// proceed as if it were %v +		} else if s.Flag('+') { +			p.printDetail = true +			sep = "\n  - " +		} +	case 's': +	case 'q', 'x', 'X': +		// Use an intermediate buffer in the rare cases that precision, +		// truncation, or one of the alternative verbs (q, x, and X) are +		// specified. +		direct = false + +	default: +		p.buf.WriteString("%!") +		p.buf.WriteRune(verb) +		p.buf.WriteByte('(') +		switch { +		case err != nil: +			p.buf.WriteString(reflect.TypeOf(f).String()) +		default: +			p.buf.WriteString("<nil>") +		} +		p.buf.WriteByte(')') +		io.Copy(s, &p.buf) +		return +	} + +loop: +	for { +		switch v := err.(type) { +		case Formatter: +			err = v.FormatError((*printer)(p)) +		case fmt.Formatter: +			v.Format(p, 'v') +			break loop +		default: +			io.WriteString(&p.buf, v.Error()) +			break loop +		} +		if err == nil { +			break +		} +		if p.needColon || !p.printDetail { +			p.buf.WriteByte(':') +			p.needColon = false +		} +		p.buf.WriteString(sep) +		p.inDetail = false +		p.needNewline = false +	} + +exit: +	width, okW := s.Width() +	prec, okP := s.Precision() + +	if !direct || (okW && width > 0) || okP { +		// Construct format string from State s. +		format := []byte{'%'} +		if s.Flag('-') { +			format = append(format, '-') +		} +		if s.Flag('+') { +			format = append(format, '+') +		} +		if s.Flag(' ') { +			format = append(format, ' ') +		} +		if okW { +			format = strconv.AppendInt(format, int64(width), 10) +		} +		if okP { +			format = append(format, '.') +			format = strconv.AppendInt(format, int64(prec), 10) +		} +		format = append(format, string(verb)...) +		fmt.Fprintf(s, string(format), p.buf.String()) +	} else { +		io.Copy(s, &p.buf) +	} +} + +var detailSep = []byte("\n    ") + +// state tracks error printing state. It implements fmt.State. +type state struct { +	fmt.State +	buf bytes.Buffer + +	printDetail bool +	inDetail    bool +	needColon   bool +	needNewline bool +} + +func (s *state) Write(b []byte) (n int, err error) { +	if s.printDetail { +		if len(b) == 0 { +			return 0, nil +		} +		if s.inDetail && s.needColon { +			s.needNewline = true +			if b[0] == '\n' { +				b = b[1:] +			} +		} +		k := 0 +		for i, c := range b { +			if s.needNewline { +				if s.inDetail && s.needColon { +					s.buf.WriteByte(':') +					s.needColon = false +				} +				s.buf.Write(detailSep) +				s.needNewline = false +			} +			if c == '\n' { +				s.buf.Write(b[k:i]) +				k = i + 1 +				s.needNewline = true +			} +		} +		s.buf.Write(b[k:]) +		if !s.inDetail { +			s.needColon = true +		} +	} else if !s.inDetail { +		s.buf.Write(b) +	} +	return len(b), nil +} + +// printer wraps a state to implement an xerrors.Printer. +type printer state + +func (s *printer) Print(args ...interface{}) { +	if !s.inDetail || s.printDetail { +		fmt.Fprint((*state)(s), args...) +	} +} + +func (s *printer) Printf(format string, args ...interface{}) { +	if !s.inDetail || s.printDetail { +		fmt.Fprintf((*state)(s), format, args...) +	} +} + +func (s *printer) Detail() bool { +	s.inDetail = true +	return s.printDetail +} diff --git a/vendor/golang.org/x/xerrors/codereview.cfg b/vendor/golang.org/x/xerrors/codereview.cfg new file mode 100644 index 000000000..3f8b14b64 --- /dev/null +++ b/vendor/golang.org/x/xerrors/codereview.cfg @@ -0,0 +1 @@ +issuerepo: golang/go diff --git a/vendor/golang.org/x/xerrors/doc.go b/vendor/golang.org/x/xerrors/doc.go new file mode 100644 index 000000000..eef99d9d5 --- /dev/null +++ b/vendor/golang.org/x/xerrors/doc.go @@ -0,0 +1,22 @@ +// 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 xerrors implements functions to manipulate errors. +// +// This package is based on the Go 2 proposal for error values: +//   https://golang.org/design/29934-error-values +// +// These functions were incorporated into the standard library's errors package +// in Go 1.13: +// - Is +// - As +// - Unwrap +// +// Also, Errorf's %w verb was incorporated into fmt.Errorf. +// +// Use this package to get equivalent behavior in all supported Go versions. +// +// No other features of this package were included in Go 1.13, and at present +// there are no plans to include any of them. +package xerrors // import "golang.org/x/xerrors" diff --git a/vendor/golang.org/x/xerrors/errors.go b/vendor/golang.org/x/xerrors/errors.go new file mode 100644 index 000000000..e88d3772d --- /dev/null +++ b/vendor/golang.org/x/xerrors/errors.go @@ -0,0 +1,33 @@ +// 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 xerrors + +import "fmt" + +// errorString is a trivial implementation of error. +type errorString struct { +	s     string +	frame Frame +} + +// New returns an error that formats as the given text. +// +// The returned error contains a Frame set to the caller's location and +// implements Formatter to show this information when printed with details. +func New(text string) error { +	return &errorString{text, Caller(1)} +} + +func (e *errorString) Error() string { +	return e.s +} + +func (e *errorString) Format(s fmt.State, v rune) { FormatError(e, s, v) } + +func (e *errorString) FormatError(p Printer) (next error) { +	p.Print(e.s) +	e.frame.Format(p) +	return nil +} diff --git a/vendor/golang.org/x/xerrors/fmt.go b/vendor/golang.org/x/xerrors/fmt.go new file mode 100644 index 000000000..829862ddf --- /dev/null +++ b/vendor/golang.org/x/xerrors/fmt.go @@ -0,0 +1,187 @@ +// 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 xerrors + +import ( +	"fmt" +	"strings" +	"unicode" +	"unicode/utf8" + +	"golang.org/x/xerrors/internal" +) + +const percentBangString = "%!" + +// Errorf formats according to a format specifier and returns the string as a +// value that satisfies error. +// +// The returned error includes the file and line number of the caller when +// formatted with additional detail enabled. If the last argument is an error +// the returned error's Format method will return it if the format string ends +// with ": %s", ": %v", or ": %w". If the last argument is an error and the +// format string ends with ": %w", the returned error implements an Unwrap +// method returning it. +// +// If the format specifier includes a %w verb with an error operand in a +// position other than at the end, the returned error will still implement an +// Unwrap method returning the operand, but the error's Format method will not +// return the wrapped error. +// +// It is invalid to include more than one %w verb or to supply it with an +// operand that does not implement the error interface. The %w verb is otherwise +// a synonym for %v. +func Errorf(format string, a ...interface{}) error { +	format = formatPlusW(format) +	// Support a ": %[wsv]" suffix, which works well with xerrors.Formatter. +	wrap := strings.HasSuffix(format, ": %w") +	idx, format2, ok := parsePercentW(format) +	percentWElsewhere := !wrap && idx >= 0 +	if !percentWElsewhere && (wrap || strings.HasSuffix(format, ": %s") || strings.HasSuffix(format, ": %v")) { +		err := errorAt(a, len(a)-1) +		if err == nil { +			return &noWrapError{fmt.Sprintf(format, a...), nil, Caller(1)} +		} +		// TODO: this is not entirely correct. The error value could be +		// printed elsewhere in format if it mixes numbered with unnumbered +		// substitutions. With relatively small changes to doPrintf we can +		// have it optionally ignore extra arguments and pass the argument +		// list in its entirety. +		msg := fmt.Sprintf(format[:len(format)-len(": %s")], a[:len(a)-1]...) +		frame := Frame{} +		if internal.EnableTrace { +			frame = Caller(1) +		} +		if wrap { +			return &wrapError{msg, err, frame} +		} +		return &noWrapError{msg, err, frame} +	} +	// Support %w anywhere. +	// TODO: don't repeat the wrapped error's message when %w occurs in the middle. +	msg := fmt.Sprintf(format2, a...) +	if idx < 0 { +		return &noWrapError{msg, nil, Caller(1)} +	} +	err := errorAt(a, idx) +	if !ok || err == nil { +		// Too many %ws or argument of %w is not an error. Approximate the Go +		// 1.13 fmt.Errorf message. +		return &noWrapError{fmt.Sprintf("%sw(%s)", percentBangString, msg), nil, Caller(1)} +	} +	frame := Frame{} +	if internal.EnableTrace { +		frame = Caller(1) +	} +	return &wrapError{msg, err, frame} +} + +func errorAt(args []interface{}, i int) error { +	if i < 0 || i >= len(args) { +		return nil +	} +	err, ok := args[i].(error) +	if !ok { +		return nil +	} +	return err +} + +// formatPlusW is used to avoid the vet check that will barf at %w. +func formatPlusW(s string) string { +	return s +} + +// Return the index of the only %w in format, or -1 if none. +// Also return a rewritten format string with %w replaced by %v, and +// false if there is more than one %w. +// TODO: handle "%[N]w". +func parsePercentW(format string) (idx int, newFormat string, ok bool) { +	// Loosely copied from golang.org/x/tools/go/analysis/passes/printf/printf.go. +	idx = -1 +	ok = true +	n := 0 +	sz := 0 +	var isW bool +	for i := 0; i < len(format); i += sz { +		if format[i] != '%' { +			sz = 1 +			continue +		} +		// "%%" is not a format directive. +		if i+1 < len(format) && format[i+1] == '%' { +			sz = 2 +			continue +		} +		sz, isW = parsePrintfVerb(format[i:]) +		if isW { +			if idx >= 0 { +				ok = false +			} else { +				idx = n +			} +			// "Replace" the last character, the 'w', with a 'v'. +			p := i + sz - 1 +			format = format[:p] + "v" + format[p+1:] +		} +		n++ +	} +	return idx, format, ok +} + +// Parse the printf verb starting with a % at s[0]. +// Return how many bytes it occupies and whether the verb is 'w'. +func parsePrintfVerb(s string) (int, bool) { +	// Assume only that the directive is a sequence of non-letters followed by a single letter. +	sz := 0 +	var r rune +	for i := 1; i < len(s); i += sz { +		r, sz = utf8.DecodeRuneInString(s[i:]) +		if unicode.IsLetter(r) { +			return i + sz, r == 'w' +		} +	} +	return len(s), false +} + +type noWrapError struct { +	msg   string +	err   error +	frame Frame +} + +func (e *noWrapError) Error() string { +	return fmt.Sprint(e) +} + +func (e *noWrapError) Format(s fmt.State, v rune) { FormatError(e, s, v) } + +func (e *noWrapError) FormatError(p Printer) (next error) { +	p.Print(e.msg) +	e.frame.Format(p) +	return e.err +} + +type wrapError struct { +	msg   string +	err   error +	frame Frame +} + +func (e *wrapError) Error() string { +	return fmt.Sprint(e) +} + +func (e *wrapError) Format(s fmt.State, v rune) { FormatError(e, s, v) } + +func (e *wrapError) FormatError(p Printer) (next error) { +	p.Print(e.msg) +	e.frame.Format(p) +	return e.err +} + +func (e *wrapError) Unwrap() error { +	return e.err +} diff --git a/vendor/golang.org/x/xerrors/format.go b/vendor/golang.org/x/xerrors/format.go new file mode 100644 index 000000000..1bc9c26b9 --- /dev/null +++ b/vendor/golang.org/x/xerrors/format.go @@ -0,0 +1,34 @@ +// 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 xerrors + +// A Formatter formats error messages. +type Formatter interface { +	error + +	// FormatError prints the receiver's first error and returns the next error in +	// the error chain, if any. +	FormatError(p Printer) (next error) +} + +// A Printer formats error messages. +// +// The most common implementation of Printer is the one provided by package fmt +// during Printf (as of Go 1.13). Localization packages such as golang.org/x/text/message +// typically provide their own implementations. +type Printer interface { +	// Print appends args to the message output. +	Print(args ...interface{}) + +	// Printf writes a formatted string. +	Printf(format string, args ...interface{}) + +	// Detail reports whether error detail is requested. +	// After the first call to Detail, all text written to the Printer +	// is formatted as additional detail, or ignored when +	// detail has not been requested. +	// If Detail returns false, the caller can avoid printing the detail at all. +	Detail() bool +} diff --git a/vendor/golang.org/x/xerrors/frame.go b/vendor/golang.org/x/xerrors/frame.go new file mode 100644 index 000000000..0de628ec5 --- /dev/null +++ b/vendor/golang.org/x/xerrors/frame.go @@ -0,0 +1,56 @@ +// 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 xerrors + +import ( +	"runtime" +) + +// A Frame contains part of a call stack. +type Frame struct { +	// Make room for three PCs: the one we were asked for, what it called, +	// and possibly a PC for skipPleaseUseCallersFrames. See: +	// https://go.googlesource.com/go/+/032678e0fb/src/runtime/extern.go#169 +	frames [3]uintptr +} + +// Caller returns a Frame that describes a frame on the caller's stack. +// The argument skip is the number of frames to skip over. +// Caller(0) returns the frame for the caller of Caller. +func Caller(skip int) Frame { +	var s Frame +	runtime.Callers(skip+1, s.frames[:]) +	return s +} + +// location reports the file, line, and function of a frame. +// +// The returned function may be "" even if file and line are not. +func (f Frame) location() (function, file string, line int) { +	frames := runtime.CallersFrames(f.frames[:]) +	if _, ok := frames.Next(); !ok { +		return "", "", 0 +	} +	fr, ok := frames.Next() +	if !ok { +		return "", "", 0 +	} +	return fr.Function, fr.File, fr.Line +} + +// Format prints the stack as error detail. +// It should be called from an error's Format implementation +// after printing any other error detail. +func (f Frame) Format(p Printer) { +	if p.Detail() { +		function, file, line := f.location() +		if function != "" { +			p.Printf("%s\n    ", function) +		} +		if file != "" { +			p.Printf("%s:%d\n", file, line) +		} +	} +} diff --git a/vendor/golang.org/x/xerrors/go.mod b/vendor/golang.org/x/xerrors/go.mod new file mode 100644 index 000000000..870d4f612 --- /dev/null +++ b/vendor/golang.org/x/xerrors/go.mod @@ -0,0 +1,3 @@ +module golang.org/x/xerrors + +go 1.11 diff --git a/vendor/golang.org/x/xerrors/internal/internal.go b/vendor/golang.org/x/xerrors/internal/internal.go new file mode 100644 index 000000000..89f4eca5d --- /dev/null +++ b/vendor/golang.org/x/xerrors/internal/internal.go @@ -0,0 +1,8 @@ +// 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 internal + +// EnableTrace indicates whether stack information should be recorded in errors. +var EnableTrace = true diff --git a/vendor/golang.org/x/xerrors/wrap.go b/vendor/golang.org/x/xerrors/wrap.go new file mode 100644 index 000000000..9a3b51037 --- /dev/null +++ b/vendor/golang.org/x/xerrors/wrap.go @@ -0,0 +1,106 @@ +// 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 xerrors + +import ( +	"reflect" +) + +// A Wrapper provides context around another error. +type Wrapper interface { +	// Unwrap returns the next error in the error chain. +	// If there is no next error, Unwrap returns nil. +	Unwrap() error +} + +// Opaque returns an error with the same error formatting as err +// but that does not match err and cannot be unwrapped. +func Opaque(err error) error { +	return noWrapper{err} +} + +type noWrapper struct { +	error +} + +func (e noWrapper) FormatError(p Printer) (next error) { +	if f, ok := e.error.(Formatter); ok { +		return f.FormatError(p) +	} +	p.Print(e.error) +	return nil +} + +// Unwrap returns the result of calling the Unwrap method on err, if err implements +// Unwrap. Otherwise, Unwrap returns nil. +func Unwrap(err error) error { +	u, ok := err.(Wrapper) +	if !ok { +		return nil +	} +	return u.Unwrap() +} + +// Is reports whether any error in err's chain matches target. +// +// An error is considered to match a target if it is equal to that target or if +// it implements a method Is(error) bool such that Is(target) returns true. +func Is(err, target error) bool { +	if target == nil { +		return err == target +	} + +	isComparable := reflect.TypeOf(target).Comparable() +	for { +		if isComparable && err == target { +			return true +		} +		if x, ok := err.(interface{ Is(error) bool }); ok && x.Is(target) { +			return true +		} +		// TODO: consider supporing target.Is(err). This would allow +		// user-definable predicates, but also may allow for coping with sloppy +		// APIs, thereby making it easier to get away with them. +		if err = Unwrap(err); err == nil { +			return false +		} +	} +} + +// As finds the first error in err's chain that matches the type to which target +// points, and if so, sets the target to its value and returns true. An error +// matches a type if it is assignable to the target type, or if it has a method +// As(interface{}) bool such that As(target) returns true. As will panic if target +// is not a non-nil pointer to a type which implements error or is of interface type. +// +// The As method should set the target to its value and return true if err +// matches the type to which target points. +func As(err error, target interface{}) bool { +	if target == nil { +		panic("errors: target cannot be nil") +	} +	val := reflect.ValueOf(target) +	typ := val.Type() +	if typ.Kind() != reflect.Ptr || val.IsNil() { +		panic("errors: target must be a non-nil pointer") +	} +	if e := typ.Elem(); e.Kind() != reflect.Interface && !e.Implements(errorType) { +		panic("errors: *target must be interface or implement error") +	} +	targetType := typ.Elem() +	for err != nil { +		if reflect.TypeOf(err).AssignableTo(targetType) { +			val.Elem().Set(reflect.ValueOf(err)) +			return true +		} +		if x, ok := err.(interface{ As(interface{}) bool }); ok && x.As(target) { +			return true +		} +		err = Unwrap(err) +	} +	return false +} + +var errorType = reflect.TypeOf((*error)(nil)).Elem()  | 
