Merge pull request #2950 from tiborvass/execabs

Use golang.org/x/sys/execabs
This commit is contained in:
Sebastiaan van Stijn 2021-01-27 08:05:56 +01:00 committed by GitHub
commit d26bdfd4ea
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
178 changed files with 5222 additions and 1525 deletions

View File

@ -1,7 +1,7 @@
package manager package manager
import ( import (
"os/exec" exec "golang.org/x/sys/execabs"
) )
// Candidate represents a possible plugin candidate, for mocking purposes // Candidate represents a possible plugin candidate, for mocking purposes

View File

@ -3,7 +3,6 @@ package manager
import ( import (
"io/ioutil" "io/ioutil"
"os" "os"
"os/exec"
"path/filepath" "path/filepath"
"sort" "sort"
"strings" "strings"
@ -12,6 +11,7 @@ import (
"github.com/docker/cli/cli/config" "github.com/docker/cli/cli/config"
"github.com/fvbommel/sortorder" "github.com/fvbommel/sortorder"
"github.com/spf13/cobra" "github.com/spf13/cobra"
exec "golang.org/x/sys/execabs"
) )
// ReexecEnvvar is the name of an ennvar which is set to the command // ReexecEnvvar is the name of an ennvar which is set to the command

View File

@ -9,7 +9,6 @@ import (
"io/ioutil" "io/ioutil"
"net/http" "net/http"
"os" "os"
"os/exec"
"path/filepath" "path/filepath"
"runtime" "runtime"
"strings" "strings"
@ -24,6 +23,7 @@ import (
"github.com/docker/docker/pkg/streamformatter" "github.com/docker/docker/pkg/streamformatter"
"github.com/docker/docker/pkg/stringid" "github.com/docker/docker/pkg/stringid"
"github.com/pkg/errors" "github.com/pkg/errors"
exec "golang.org/x/sys/execabs"
) )
const ( const (

View File

@ -1,7 +1,7 @@
package credentials package credentials
import ( import (
"os/exec" exec "golang.org/x/sys/execabs"
) )
// DetectDefaultStore return the default credentials store for the platform if // DetectDefaultStore return the default credentials store for the platform if

View File

@ -20,7 +20,6 @@ import (
"io" "io"
"net" "net"
"os" "os"
"os/exec"
"runtime" "runtime"
"strings" "strings"
"sync" "sync"
@ -29,6 +28,7 @@ import (
"github.com/pkg/errors" "github.com/pkg/errors"
"github.com/sirupsen/logrus" "github.com/sirupsen/logrus"
exec "golang.org/x/sys/execabs"
) )
// New returns net.Conn // New returns net.Conn

View File

@ -13,8 +13,8 @@ github.com/creack/pty 2a38352e8b4d7ab6c336eef107e4
github.com/davecgh/go-spew 8991bc29aa16c548c550c7ff78260e27b9ab7c73 # v1.1.1 github.com/davecgh/go-spew 8991bc29aa16c548c550c7ff78260e27b9ab7c73 # v1.1.1
github.com/docker/compose-on-kubernetes 78e6a00beda64ac8ccb9fec787e601fe2ce0d5bb # v0.5.0-alpha1 github.com/docker/compose-on-kubernetes 78e6a00beda64ac8ccb9fec787e601fe2ce0d5bb # v0.5.0-alpha1
github.com/docker/distribution 0d3efadf0154c2b8a4e7b6621fff9809655cc580 github.com/docker/distribution 0d3efadf0154c2b8a4e7b6621fff9809655cc580
github.com/docker/docker f0014860c1b3345e1fcc7ed81c491298de2633fb # v20.10.1 github.com/docker/docker d5209b29b9777e0b9713d87847a5dc8ce9d93da6
github.com/docker/docker-credential-helpers 54f0238b6bf101fc3ad3b34114cb5520beb562f5 # v0.6.3 github.com/docker/docker-credential-helpers 38bea2ce277ad0c9d2a6230692b0606ca5286526
github.com/docker/go d30aec9fd63c35133f8f79c3412ad91a3b08be06 # Contains a customized version of canonical/json and is used by Notary. The package is periodically rebased on current Go versions. github.com/docker/go d30aec9fd63c35133f8f79c3412ad91a3b08be06 # Contains a customized version of canonical/json and is used by Notary. The package is periodically rebased on current Go versions.
github.com/docker/go-connections 7395e3f8aa162843a74ed6d48e79627d9792ac55 # v0.4.0 github.com/docker/go-connections 7395e3f8aa162843a74ed6d48e79627d9792ac55 # v0.4.0
github.com/docker/go-events e31b211e4f1cd09aa76fe4ac244571fab96ae47f github.com/docker/go-events e31b211e4f1cd09aa76fe4ac244571fab96ae47f
@ -79,7 +79,7 @@ golang.org/x/crypto c1f2f97bffc9c53fc40a1a28a5b4
golang.org/x/net ab34263943818b32f575efc978a3d24e80b04bd7 golang.org/x/net ab34263943818b32f575efc978a3d24e80b04bd7
golang.org/x/oauth2 bf48bf16ab8d622ce64ec6ce98d2c98f916b6303 golang.org/x/oauth2 bf48bf16ab8d622ce64ec6ce98d2c98f916b6303
golang.org/x/sync cd5d95a43a6e21273425c7ae415d3df9ea832eeb golang.org/x/sync cd5d95a43a6e21273425c7ae415d3df9ea832eeb
golang.org/x/sys eeed37f84f13f52d35e095e8023ba65671ff86a1 golang.org/x/sys b64e53b001e413bd5067f36d4e439eded3827374
golang.org/x/term f5c789dd3221ff39d752ac54467d762de7cfbec6 golang.org/x/term f5c789dd3221ff39d752ac54467d762de7cfbec6
golang.org/x/text 23ae387dee1f90d29a23c0e87ee0b46038fbed0e # v0.3.3 golang.org/x/text 23ae387dee1f90d29a23c0e87ee0b46038fbed0e # v0.3.3
golang.org/x/time 555d28b269f0569763d25dbe1a237ae74c6bcc82 golang.org/x/time 555d28b269f0569763d25dbe1a237ae74c6bcc82

View File

@ -4,7 +4,8 @@ import (
"fmt" "fmt"
"io" "io"
"os" "os"
"os/exec"
exec "golang.org/x/sys/execabs"
) )
// Program is an interface to execute external programs. // Program is an interface to execute external programs.

View File

@ -0,0 +1,8 @@
module github.com/docker/docker-credential-helpers
go 1.13
require (
github.com/danieljoos/wincred v1.1.0
golang.org/x/sys v0.0.0-20210119212857-b64e53b001e4
)

View File

@ -21,6 +21,13 @@ import (
// when the credentials are not in the keychain. // when the credentials are not in the keychain.
const errCredentialsNotFound = "The specified item could not be found in the keychain." const errCredentialsNotFound = "The specified item could not be found in the keychain."
// errCredentialsNotFound is the specific error message returned by OS X
// when environment does not allow showing dialog to unlock keychain.
const errInteractionNotAllowed = "User interaction is not allowed."
// ErrInteractionNotAllowed is returned if keychain password prompt can not be shown.
var ErrInteractionNotAllowed = errors.New(`keychain cannot be accessed because the current session does not allow user interaction. The keychain may be locked; unlock it by running "security -v unlock-keychain ~/Library/Keychains/login.keychain-db" and try again`)
// Osxkeychain handles secrets using the OS X Keychain as store. // Osxkeychain handles secrets using the OS X Keychain as store.
type Osxkeychain struct{} type Osxkeychain struct{}
@ -89,6 +96,9 @@ func (h Osxkeychain) Get(serverURL string) (string, string, error) {
if goMsg == errCredentialsNotFound { if goMsg == errCredentialsNotFound {
return "", "", credentials.NewErrCredentialsNotFound() return "", "", credentials.NewErrCredentialsNotFound()
} }
if goMsg == errInteractionNotAllowed {
return "", "", ErrInteractionNotAllowed
}
return "", "", errors.New(goMsg) return "", "", errors.New(goMsg)
} }
@ -117,6 +127,9 @@ func (h Osxkeychain) List() (map[string]string, error) {
if goMsg == errCredentialsNotFound { if goMsg == errCredentialsNotFound {
return make(map[string]string), nil return make(map[string]string), nil
} }
if goMsg == errInteractionNotAllowed {
return nil, ErrInteractionNotAllowed
}
return nil, errors.New(goMsg) return nil, errors.New(goMsg)
} }

View File

@ -5,12 +5,12 @@ import (
"net/http" "net/http"
"net/url" "net/url"
"os" "os"
"os/exec"
"path/filepath" "path/filepath"
"strings" "strings"
"github.com/moby/sys/symlink" "github.com/moby/sys/symlink"
"github.com/pkg/errors" "github.com/pkg/errors"
exec "golang.org/x/sys/execabs"
) )
type gitRepo struct { type gitRepo struct {

View File

@ -11,7 +11,6 @@ import (
"io" "io"
"io/ioutil" "io/ioutil"
"os" "os"
"os/exec"
"path/filepath" "path/filepath"
"runtime" "runtime"
"strconv" "strconv"
@ -25,6 +24,7 @@ import (
"github.com/docker/docker/pkg/pools" "github.com/docker/docker/pkg/pools"
"github.com/docker/docker/pkg/system" "github.com/docker/docker/pkg/system"
"github.com/sirupsen/logrus" "github.com/sirupsen/logrus"
exec "golang.org/x/sys/execabs"
) )
type ( type (
@ -402,10 +402,24 @@ func fillGo18FileTypeBits(mode int64, fi os.FileInfo) int64 {
// ReadSecurityXattrToTarHeader reads security.capability xattr from filesystem // ReadSecurityXattrToTarHeader reads security.capability xattr from filesystem
// to a tar header // to a tar header
func ReadSecurityXattrToTarHeader(path string, hdr *tar.Header) error { func ReadSecurityXattrToTarHeader(path string, hdr *tar.Header) error {
const (
// Values based on linux/include/uapi/linux/capability.h
xattrCapsSz2 = 20
versionOffset = 3
vfsCapRevision2 = 2
vfsCapRevision3 = 3
)
capability, _ := system.Lgetxattr(path, "security.capability") capability, _ := system.Lgetxattr(path, "security.capability")
if capability != nil { if capability != nil {
length := len(capability)
if capability[versionOffset] == vfsCapRevision3 {
// Convert VFS_CAP_REVISION_3 to VFS_CAP_REVISION_2 as root UID makes no
// sense outside the user namespace the archive is built in.
capability[versionOffset] = vfsCapRevision2
length = xattrCapsSz2
}
hdr.Xattrs = make(map[string]string) hdr.Xattrs = make(map[string]string)
hdr.Xattrs["security.capability"] = string(capability) hdr.Xattrs["security.capability"] = string(capability[:length])
} }
return nil return nil
} }

View File

@ -20,11 +20,11 @@ github.com/creack/pty 2a38352e8b4d7ab6c336eef107e4
github.com/sirupsen/logrus 6699a89a232f3db797f2e280639854bbc4b89725 # v1.7.0 github.com/sirupsen/logrus 6699a89a232f3db797f2e280639854bbc4b89725 # v1.7.0
github.com/tchap/go-patricia a7f0089c6f496e8e70402f61733606daa326cac5 # v2.3.0 github.com/tchap/go-patricia a7f0089c6f496e8e70402f61733606daa326cac5 # v2.3.0
golang.org/x/net ab34263943818b32f575efc978a3d24e80b04bd7 golang.org/x/net ab34263943818b32f575efc978a3d24e80b04bd7
golang.org/x/sys eeed37f84f13f52d35e095e8023ba65671ff86a1 golang.org/x/sys b64e53b001e413bd5067f36d4e439eded3827374
github.com/docker/go-units 519db1ee28dcc9fd2474ae59fca29a810482bfb1 # v0.4.0 github.com/docker/go-units 519db1ee28dcc9fd2474ae59fca29a810482bfb1 # v0.4.0
github.com/docker/go-connections 7395e3f8aa162843a74ed6d48e79627d9792ac55 # v0.4.0 github.com/docker/go-connections 7395e3f8aa162843a74ed6d48e79627d9792ac55 # v0.4.0
golang.org/x/text 23ae387dee1f90d29a23c0e87ee0b46038fbed0e # v0.3.3 golang.org/x/text 23ae387dee1f90d29a23c0e87ee0b46038fbed0e # v0.3.3
gotest.tools/v3 bb0d8a963040ea5048dcef1a14d8f8b58a33d4b3 # v3.0.2 gotest.tools/v3 568bc57cc5c19a2ef85e5749870b49a4cc2ab54d # v3.0.3
github.com/google/go-cmp 3af367b6b30c263d47e8895973edcca9a49cf029 # v0.2.0 github.com/google/go-cmp 3af367b6b30c263d47e8895973edcca9a49cf029 # v0.2.0
github.com/syndtr/gocapability 42c35b4376354fd554efc7ad35e0b7f94e3a0ffb github.com/syndtr/gocapability 42c35b4376354fd554efc7ad35e0b7f94e3a0ffb
@ -47,7 +47,7 @@ github.com/grpc-ecosystem/go-grpc-middleware 3c51f7f332123e8be5a157c0802a
# libnetwork # libnetwork
# When updating, also update LIBNETWORK_COMMIT in hack/dockerfile/install/proxy.installer accordingly # When updating, also update LIBNETWORK_COMMIT in hack/dockerfile/install/proxy.installer accordingly
github.com/docker/libnetwork 5c6a95bfb20c61571a00f913c6b91959ede84e8d github.com/docker/libnetwork fa125a3512ee0f6187721c88582bf8c4378bd4d7
github.com/docker/go-events e31b211e4f1cd09aa76fe4ac244571fab96ae47f github.com/docker/go-events e31b211e4f1cd09aa76fe4ac244571fab96ae47f
github.com/armon/go-radix e39d623f12e8e41c7b5529e9a9dd67a1e2261f80 github.com/armon/go-radix e39d623f12e8e41c7b5529e9a9dd67a1e2261f80
github.com/armon/go-metrics eb0af217e5e9747e41dd5303755356b62d28e3ec github.com/armon/go-metrics eb0af217e5e9747e41dd5303755356b62d28e3ec
@ -176,7 +176,7 @@ github.com/morikuni/aec 39771216ff4c63d11f5e604076f9
# metrics # metrics
github.com/docker/go-metrics b619b3592b65de4f087d9f16863a7e6ff905973c # v0.0.1 github.com/docker/go-metrics b619b3592b65de4f087d9f16863a7e6ff905973c # v0.0.1
github.com/opencontainers/selinux 25504e34a9826d481f6e2903963ecaa881749124 # v1.6.0 github.com/opencontainers/selinux 2f45b3796d18f1ab4c9fc0c888a98d0a0fd6e429 # v1.8.0
github.com/willf/bitset 559910e8471e48d76d9e5a1ba15842dee77ad45d # v1.1.11 github.com/willf/bitset 559910e8471e48d76d9e5a1ba15842dee77ad45d # v1.1.11

2
vendor/golang.org/x/sys/README.md generated vendored
View File

@ -1,5 +1,7 @@
# sys # sys
[![Go Reference](https://pkg.go.dev/badge/golang.org/x/sys.svg)](https://pkg.go.dev/golang.org/x/sys)
This repository holds supplemental Go packages for low-level interactions with This repository holds supplemental Go packages for low-level interactions with
the operating system. the operating system.

View File

@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style // Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file. // license that can be found in the LICENSE file.
// +build !gccgo // +build gc
#include "textflag.h" #include "textflag.h"

View File

@ -39,34 +39,34 @@ func initOptions() {
func archInit() { func archInit() {
switch runtime.GOOS { switch runtime.GOOS {
case "android", "darwin", "ios", "netbsd", "openbsd": case "freebsd":
// Android and iOS don't seem to allow reading these registers. readARM64Registers()
// case "linux", "netbsd":
// NetBSD: doinit()
// ID_AA64ISAR0_EL1 is a privileged register and cannot be read from EL0. default:
// It can be read via sysctl(3). Example for future implementers: // Most platforms don't seem to allow reading these registers.
// https://nxr.netbsd.org/xref/src/usr.sbin/cpuctl/arch/aarch64.c
// //
// OpenBSD: // OpenBSD:
// See https://golang.org/issue/31746 // See https://golang.org/issue/31746
// setMinimalFeatures()
// Fake the minimal features expected by }
// TestARM64minimalFeatures. }
// setMinimalFeatures fakes the minimal ARM64 features expected by
// TestARM64minimalFeatures.
func setMinimalFeatures() {
ARM64.HasASIMD = true ARM64.HasASIMD = true
ARM64.HasFP = true ARM64.HasFP = true
case "linux":
doinit()
default:
readARM64Registers()
}
} }
func readARM64Registers() { func readARM64Registers() {
Initialized = true Initialized = true
// ID_AA64ISAR0_EL1 parseARM64SystemRegisters(getisar0(), getisar1(), getpfr0())
isar0 := getisar0() }
func parseARM64SystemRegisters(isar0, isar1, pfr0 uint64) {
// ID_AA64ISAR0_EL1
switch extractBits(isar0, 4, 7) { switch extractBits(isar0, 4, 7) {
case 1: case 1:
ARM64.HasAES = true ARM64.HasAES = true
@ -124,8 +124,6 @@ func readARM64Registers() {
} }
// ID_AA64ISAR1_EL1 // ID_AA64ISAR1_EL1
isar1 := getisar1()
switch extractBits(isar1, 0, 3) { switch extractBits(isar1, 0, 3) {
case 1: case 1:
ARM64.HasDCPOP = true ARM64.HasDCPOP = true
@ -147,8 +145,6 @@ func readARM64Registers() {
} }
// ID_AA64PFR0_EL1 // ID_AA64PFR0_EL1
pfr0 := getpfr0()
switch extractBits(pfr0, 16, 19) { switch extractBits(pfr0, 16, 19) {
case 0: case 0:
ARM64.HasFP = true ARM64.HasFP = true

View File

@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style // Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file. // license that can be found in the LICENSE file.
// +build !gccgo // +build gc
#include "textflag.h" #include "textflag.h"

View File

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

View File

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

View File

@ -3,7 +3,7 @@
// license that can be found in the LICENSE file. // license that can be found in the LICENSE file.
// +build 386 amd64 amd64p32 // +build 386 amd64 amd64p32
// +build !gccgo // +build gc
package cpu package cpu

View File

@ -17,86 +17,7 @@ const (
hwcap_VXE = 8192 hwcap_VXE = 8192
) )
// bitIsSet reports whether the bit at index is set. The bit index func initS390Xbase() {
// is in big endian order, so bit index 0 is the leftmost bit.
func bitIsSet(bits []uint64, index uint) bool {
return bits[index/64]&((1<<63)>>(index%64)) != 0
}
// function is the code for the named cryptographic function.
type function uint8
const (
// KM{,A,C,CTR} function codes
aes128 function = 18 // AES-128
aes192 function = 19 // AES-192
aes256 function = 20 // AES-256
// K{I,L}MD function codes
sha1 function = 1 // SHA-1
sha256 function = 2 // SHA-256
sha512 function = 3 // SHA-512
sha3_224 function = 32 // SHA3-224
sha3_256 function = 33 // SHA3-256
sha3_384 function = 34 // SHA3-384
sha3_512 function = 35 // SHA3-512
shake128 function = 36 // SHAKE-128
shake256 function = 37 // SHAKE-256
// KLMD function codes
ghash function = 65 // GHASH
)
// queryResult contains the result of a Query function
// call. Bits are numbered in big endian order so the
// leftmost bit (the MSB) is at index 0.
type queryResult struct {
bits [2]uint64
}
// Has reports whether the given functions are present.
func (q *queryResult) Has(fns ...function) bool {
if len(fns) == 0 {
panic("no function codes provided")
}
for _, f := range fns {
if !bitIsSet(q.bits[:], uint(f)) {
return false
}
}
return true
}
// facility is a bit index for the named facility.
type facility uint8
const (
// cryptography facilities
msa4 facility = 77 // message-security-assist extension 4
msa8 facility = 146 // message-security-assist extension 8
)
// facilityList contains the result of an STFLE call.
// Bits are numbered in big endian order so the
// leftmost bit (the MSB) is at index 0.
type facilityList struct {
bits [4]uint64
}
// Has reports whether the given facilities are present.
func (s *facilityList) Has(fs ...facility) bool {
if len(fs) == 0 {
panic("no facility bits provided")
}
for _, f := range fs {
if !bitIsSet(s.bits[:], uint(f)) {
return false
}
}
return true
}
func doinit() {
// test HWCAP bit vector // test HWCAP bit vector
has := func(featureMask uint) bool { has := func(featureMask uint) bool {
return hwCap&featureMask == featureMask return hwCap&featureMask == featureMask
@ -116,44 +37,4 @@ func doinit() {
if S390X.HasVX { if S390X.HasVX {
S390X.HasVXE = has(hwcap_VXE) S390X.HasVXE = has(hwcap_VXE)
} }
// We need implementations of stfle, km and so on
// to detect cryptographic features.
if !haveAsmFunctions() {
return
}
// optional cryptographic functions
if S390X.HasMSA {
aes := []function{aes128, aes192, aes256}
// cipher message
km, kmc := kmQuery(), kmcQuery()
S390X.HasAES = km.Has(aes...)
S390X.HasAESCBC = kmc.Has(aes...)
if S390X.HasSTFLE {
facilities := stfle()
if facilities.Has(msa4) {
kmctr := kmctrQuery()
S390X.HasAESCTR = kmctr.Has(aes...)
}
if facilities.Has(msa8) {
kma := kmaQuery()
S390X.HasAESGCM = kma.Has(aes...)
}
}
// compute message digest
kimd := kimdQuery() // intermediate (no padding)
klmd := klmdQuery() // last (padding)
S390X.HasSHA1 = kimd.Has(sha1) && klmd.Has(sha1)
S390X.HasSHA256 = kimd.Has(sha256) && klmd.Has(sha256)
S390X.HasSHA512 = kimd.Has(sha512) && klmd.Has(sha512)
S390X.HasGHASH = kimd.Has(ghash) // KLMD-GHASH does not exist
sha3 := []function{
sha3_224, sha3_256, sha3_384, sha3_512,
shake128, shake256,
}
S390X.HasSHA3 = kimd.Has(sha3...) && klmd.Has(sha3...)
}
} }

173
vendor/golang.org/x/sys/cpu/cpu_netbsd_arm64.go generated vendored Normal file
View File

@ -0,0 +1,173 @@
// 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 cpu
import (
"syscall"
"unsafe"
)
// Minimal copy of functionality from x/sys/unix so the cpu package can call
// sysctl without depending on x/sys/unix.
const (
_CTL_QUERY = -2
_SYSCTL_VERS_1 = 0x1000000
)
var _zero uintptr
func sysctl(mib []int32, old *byte, oldlen *uintptr, new *byte, newlen uintptr) (err error) {
var _p0 unsafe.Pointer
if len(mib) > 0 {
_p0 = unsafe.Pointer(&mib[0])
} else {
_p0 = unsafe.Pointer(&_zero)
}
_, _, errno := syscall.Syscall6(
syscall.SYS___SYSCTL,
uintptr(_p0),
uintptr(len(mib)),
uintptr(unsafe.Pointer(old)),
uintptr(unsafe.Pointer(oldlen)),
uintptr(unsafe.Pointer(new)),
uintptr(newlen))
if errno != 0 {
return errno
}
return nil
}
type sysctlNode struct {
Flags uint32
Num int32
Name [32]int8
Ver uint32
__rsvd uint32
Un [16]byte
_sysctl_size [8]byte
_sysctl_func [8]byte
_sysctl_parent [8]byte
_sysctl_desc [8]byte
}
func sysctlNodes(mib []int32) ([]sysctlNode, error) {
var olen uintptr
// Get a list of all sysctl nodes below the given MIB by performing
// a sysctl for the given MIB with CTL_QUERY appended.
mib = append(mib, _CTL_QUERY)
qnode := sysctlNode{Flags: _SYSCTL_VERS_1}
qp := (*byte)(unsafe.Pointer(&qnode))
sz := unsafe.Sizeof(qnode)
if err := sysctl(mib, nil, &olen, qp, sz); err != nil {
return nil, err
}
// Now that we know the size, get the actual nodes.
nodes := make([]sysctlNode, olen/sz)
np := (*byte)(unsafe.Pointer(&nodes[0]))
if err := sysctl(mib, np, &olen, qp, sz); err != nil {
return nil, err
}
return nodes, nil
}
func nametomib(name string) ([]int32, error) {
// Split name into components.
var parts []string
last := 0
for i := 0; i < len(name); i++ {
if name[i] == '.' {
parts = append(parts, name[last:i])
last = i + 1
}
}
parts = append(parts, name[last:])
mib := []int32{}
// Discover the nodes and construct the MIB OID.
for partno, part := range parts {
nodes, err := sysctlNodes(mib)
if err != nil {
return nil, err
}
for _, node := range nodes {
n := make([]byte, 0)
for i := range node.Name {
if node.Name[i] != 0 {
n = append(n, byte(node.Name[i]))
}
}
if string(n) == part {
mib = append(mib, int32(node.Num))
break
}
}
if len(mib) != partno+1 {
return nil, err
}
}
return mib, nil
}
// aarch64SysctlCPUID is struct aarch64_sysctl_cpu_id from NetBSD's <aarch64/armreg.h>
type aarch64SysctlCPUID struct {
midr uint64 /* Main ID Register */
revidr uint64 /* Revision ID Register */
mpidr uint64 /* Multiprocessor Affinity Register */
aa64dfr0 uint64 /* A64 Debug Feature Register 0 */
aa64dfr1 uint64 /* A64 Debug Feature Register 1 */
aa64isar0 uint64 /* A64 Instruction Set Attribute Register 0 */
aa64isar1 uint64 /* A64 Instruction Set Attribute Register 1 */
aa64mmfr0 uint64 /* A64 Memory Model Feature Register 0 */
aa64mmfr1 uint64 /* A64 Memory Model Feature Register 1 */
aa64mmfr2 uint64 /* A64 Memory Model Feature Register 2 */
aa64pfr0 uint64 /* A64 Processor Feature Register 0 */
aa64pfr1 uint64 /* A64 Processor Feature Register 1 */
aa64zfr0 uint64 /* A64 SVE Feature ID Register 0 */
mvfr0 uint32 /* Media and VFP Feature Register 0 */
mvfr1 uint32 /* Media and VFP Feature Register 1 */
mvfr2 uint32 /* Media and VFP Feature Register 2 */
pad uint32
clidr uint64 /* Cache Level ID Register */
ctr uint64 /* Cache Type Register */
}
func sysctlCPUID(name string) (*aarch64SysctlCPUID, error) {
mib, err := nametomib(name)
if err != nil {
return nil, err
}
out := aarch64SysctlCPUID{}
n := unsafe.Sizeof(out)
_, _, errno := syscall.Syscall6(
syscall.SYS___SYSCTL,
uintptr(unsafe.Pointer(&mib[0])),
uintptr(len(mib)),
uintptr(unsafe.Pointer(&out)),
uintptr(unsafe.Pointer(&n)),
uintptr(0),
uintptr(0))
if errno != 0 {
return nil, errno
}
return &out, nil
}
func doinit() {
cpuid, err := sysctlCPUID("machdep.cpu0.cpu_id")
if err != nil {
setMinimalFeatures()
return
}
parseARM64SystemRegisters(cpuid.aa64isar0, cpuid.aa64isar1, cpuid.aa64pfr0)
Initialized = true
}

View File

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

12
vendor/golang.org/x/sys/cpu/cpu_other_mips64x.go generated vendored Normal file
View File

@ -0,0 +1,12 @@
// 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.
// +build !linux
// +build mips64 mips64le
package cpu
func archInit() {
Initialized = true
}

View File

@ -8,10 +8,10 @@ const cacheLineSize = 256
func initOptions() { func initOptions() {
options = []option{ options = []option{
{Name: "zarch", Feature: &S390X.HasZARCH}, {Name: "zarch", Feature: &S390X.HasZARCH, Required: true},
{Name: "stfle", Feature: &S390X.HasSTFLE}, {Name: "stfle", Feature: &S390X.HasSTFLE, Required: true},
{Name: "ldisp", Feature: &S390X.HasLDISP}, {Name: "ldisp", Feature: &S390X.HasLDISP, Required: true},
{Name: "eimm", Feature: &S390X.HasEIMM}, {Name: "eimm", Feature: &S390X.HasEIMM, Required: true},
{Name: "dfp", Feature: &S390X.HasDFP}, {Name: "dfp", Feature: &S390X.HasDFP},
{Name: "etf3eh", Feature: &S390X.HasETF3EH}, {Name: "etf3eh", Feature: &S390X.HasETF3EH},
{Name: "msa", Feature: &S390X.HasMSA}, {Name: "msa", Feature: &S390X.HasMSA},
@ -28,3 +28,145 @@ func initOptions() {
{Name: "vxe", Feature: &S390X.HasVXE}, {Name: "vxe", Feature: &S390X.HasVXE},
} }
} }
// bitIsSet reports whether the bit at index is set. The bit index
// is in big endian order, so bit index 0 is the leftmost bit.
func bitIsSet(bits []uint64, index uint) bool {
return bits[index/64]&((1<<63)>>(index%64)) != 0
}
// facility is a bit index for the named facility.
type facility uint8
const (
// mandatory facilities
zarch facility = 1 // z architecture mode is active
stflef facility = 7 // store-facility-list-extended
ldisp facility = 18 // long-displacement
eimm facility = 21 // extended-immediate
// miscellaneous facilities
dfp facility = 42 // decimal-floating-point
etf3eh facility = 30 // extended-translation 3 enhancement
// cryptography facilities
msa facility = 17 // message-security-assist
msa3 facility = 76 // message-security-assist extension 3
msa4 facility = 77 // message-security-assist extension 4
msa5 facility = 57 // message-security-assist extension 5
msa8 facility = 146 // message-security-assist extension 8
msa9 facility = 155 // message-security-assist extension 9
// vector facilities
vx facility = 129 // vector facility
vxe facility = 135 // vector-enhancements 1
vxe2 facility = 148 // vector-enhancements 2
)
// facilityList contains the result of an STFLE call.
// Bits are numbered in big endian order so the
// leftmost bit (the MSB) is at index 0.
type facilityList struct {
bits [4]uint64
}
// Has reports whether the given facilities are present.
func (s *facilityList) Has(fs ...facility) bool {
if len(fs) == 0 {
panic("no facility bits provided")
}
for _, f := range fs {
if !bitIsSet(s.bits[:], uint(f)) {
return false
}
}
return true
}
// function is the code for the named cryptographic function.
type function uint8
const (
// KM{,A,C,CTR} function codes
aes128 function = 18 // AES-128
aes192 function = 19 // AES-192
aes256 function = 20 // AES-256
// K{I,L}MD function codes
sha1 function = 1 // SHA-1
sha256 function = 2 // SHA-256
sha512 function = 3 // SHA-512
sha3_224 function = 32 // SHA3-224
sha3_256 function = 33 // SHA3-256
sha3_384 function = 34 // SHA3-384
sha3_512 function = 35 // SHA3-512
shake128 function = 36 // SHAKE-128
shake256 function = 37 // SHAKE-256
// KLMD function codes
ghash function = 65 // GHASH
)
// queryResult contains the result of a Query function
// call. Bits are numbered in big endian order so the
// leftmost bit (the MSB) is at index 0.
type queryResult struct {
bits [2]uint64
}
// Has reports whether the given functions are present.
func (q *queryResult) Has(fns ...function) bool {
if len(fns) == 0 {
panic("no function codes provided")
}
for _, f := range fns {
if !bitIsSet(q.bits[:], uint(f)) {
return false
}
}
return true
}
func doinit() {
initS390Xbase()
// We need implementations of stfle, km and so on
// to detect cryptographic features.
if !haveAsmFunctions() {
return
}
// optional cryptographic functions
if S390X.HasMSA {
aes := []function{aes128, aes192, aes256}
// cipher message
km, kmc := kmQuery(), kmcQuery()
S390X.HasAES = km.Has(aes...)
S390X.HasAESCBC = kmc.Has(aes...)
if S390X.HasSTFLE {
facilities := stfle()
if facilities.Has(msa4) {
kmctr := kmctrQuery()
S390X.HasAESCTR = kmctr.Has(aes...)
}
if facilities.Has(msa8) {
kma := kmaQuery()
S390X.HasAESGCM = kma.Has(aes...)
}
}
// compute message digest
kimd := kimdQuery() // intermediate (no padding)
klmd := klmdQuery() // last (padding)
S390X.HasSHA1 = kimd.Has(sha1) && klmd.Has(sha1)
S390X.HasSHA256 = kimd.Has(sha256) && klmd.Has(sha256)
S390X.HasSHA512 = kimd.Has(sha512) && klmd.Has(sha512)
S390X.HasGHASH = kimd.Has(ghash) // KLMD-GHASH does not exist
sha3 := []function{
sha3_224, sha3_256, sha3_384, sha3_512,
shake128, shake256,
}
S390X.HasSHA3 = kimd.Has(sha3...) && klmd.Has(sha3...)
}
}

View File

@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style // Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file. // license that can be found in the LICENSE file.
// +build !gccgo // +build gc
#include "textflag.h" #include "textflag.h"

View File

@ -3,7 +3,7 @@
// license that can be found in the LICENSE file. // license that can be found in the LICENSE file.
// +build 386 amd64 amd64p32 // +build 386 amd64 amd64p32
// +build !gccgo // +build gc
#include "textflag.h" #include "textflag.h"

10
vendor/golang.org/x/sys/cpu/cpu_zos.go generated vendored Normal file
View File

@ -0,0 +1,10 @@
// 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 cpu
func archInit() {
doinit()
Initialized = true
}

25
vendor/golang.org/x/sys/cpu/cpu_zos_s390x.go generated vendored Normal file
View File

@ -0,0 +1,25 @@
// 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 cpu
func initS390Xbase() {
// get the facilities list
facilities := stfle()
// mandatory
S390X.HasZARCH = facilities.Has(zarch)
S390X.HasSTFLE = facilities.Has(stflef)
S390X.HasLDISP = facilities.Has(ldisp)
S390X.HasEIMM = facilities.Has(eimm)
// optional
S390X.HasETF3EH = facilities.Has(etf3eh)
S390X.HasDFP = facilities.Has(dfp)
S390X.HasMSA = facilities.Has(msa)
S390X.HasVX = facilities.Has(vx)
if S390X.HasVX {
S390X.HasVXE = facilities.Has(vxe)
}
}

View File

@ -7,7 +7,7 @@
// (See golang.org/issue/32102) // (See golang.org/issue/32102)
// +build aix,ppc64 // +build aix,ppc64
// +build !gccgo // +build gc
package cpu package cpu

102
vendor/golang.org/x/sys/execabs/execabs.go generated vendored Normal file
View File

@ -0,0 +1,102 @@
// Copyright 2020 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
// Package execabs is a drop-in replacement for os/exec
// that requires PATH lookups to find absolute paths.
// That is, execabs.Command("cmd") runs the same PATH lookup
// as exec.Command("cmd"), but if the result is a path
// which is relative, the Run and Start methods will report
// an error instead of running the executable.
//
// See https://blog.golang.org/path-security for more information
// about when it may be necessary or appropriate to use this package.
package execabs
import (
"context"
"fmt"
"os/exec"
"path/filepath"
"reflect"
"unsafe"
)
// ErrNotFound is the error resulting if a path search failed to find an executable file.
// It is an alias for exec.ErrNotFound.
var ErrNotFound = exec.ErrNotFound
// Cmd represents an external command being prepared or run.
// It is an alias for exec.Cmd.
type Cmd = exec.Cmd
// Error is returned by LookPath when it fails to classify a file as an executable.
// It is an alias for exec.Error.
type Error = exec.Error
// An ExitError reports an unsuccessful exit by a command.
// It is an alias for exec.ExitError.
type ExitError = exec.ExitError
func relError(file, path string) error {
return fmt.Errorf("%s resolves to executable in current directory (.%c%s)", file, filepath.Separator, path)
}
// LookPath searches for an executable named file in the directories
// named by the PATH environment variable. If file contains a slash,
// it is tried directly and the PATH is not consulted. The result will be
// an absolute path.
//
// LookPath differs from exec.LookPath in its handling of PATH lookups,
// which are used for file names without slashes. If exec.LookPath's
// PATH lookup would have returned an executable from the current directory,
// LookPath instead returns an error.
func LookPath(file string) (string, error) {
path, err := exec.LookPath(file)
if err != nil {
return "", err
}
if filepath.Base(file) == file && !filepath.IsAbs(path) {
return "", relError(file, path)
}
return path, nil
}
func fixCmd(name string, cmd *exec.Cmd) {
if filepath.Base(name) == name && !filepath.IsAbs(cmd.Path) {
// exec.Command was called with a bare binary name and
// exec.LookPath returned a path which is not absolute.
// Set cmd.lookPathErr and clear cmd.Path so that it
// cannot be run.
lookPathErr := (*error)(unsafe.Pointer(reflect.ValueOf(cmd).Elem().FieldByName("lookPathErr").Addr().Pointer()))
if *lookPathErr == nil {
*lookPathErr = relError(name, cmd.Path)
}
cmd.Path = ""
}
}
// CommandContext is like Command but includes a context.
//
// The provided context is used to kill the process (by calling os.Process.Kill)
// if the context becomes done before the command completes on its own.
func CommandContext(ctx context.Context, name string, arg ...string) *exec.Cmd {
cmd := exec.CommandContext(ctx, name, arg...)
fixCmd(name, cmd)
return cmd
}
// Command returns the Cmd struct to execute the named program with the given arguments.
// See exec.Command for most details.
//
// Command differs from exec.Command in its handling of PATH lookups,
// which are used when the program name contains no slashes.
// If exec.Command would have returned an exec.Cmd configured to run an
// executable from the current directory, Command instead
// returns an exec.Cmd that will return an error from Start or Run.
func Command(name string, arg ...string) *exec.Cmd {
cmd := exec.Command(name, arg...)
fixCmd(name, cmd)
return cmd
}

View File

@ -24,17 +24,21 @@
// holds a value of type syscall.ErrorString. // holds a value of type syscall.ErrorString.
package plan9 // import "golang.org/x/sys/plan9" package plan9 // import "golang.org/x/sys/plan9"
import "unsafe" import (
"bytes"
"strings"
"unsafe"
"golang.org/x/sys/internal/unsafeheader"
)
// ByteSliceFromString returns a NUL-terminated slice of bytes // ByteSliceFromString returns a NUL-terminated slice of bytes
// containing the text of s. If s contains a NUL byte at any // containing the text of s. If s contains a NUL byte at any
// location, it returns (nil, EINVAL). // location, it returns (nil, EINVAL).
func ByteSliceFromString(s string) ([]byte, error) { func ByteSliceFromString(s string) ([]byte, error) {
for i := 0; i < len(s); i++ { if strings.IndexByte(s, 0) != -1 {
if s[i] == 0 {
return nil, EINVAL return nil, EINVAL
} }
}
a := make([]byte, len(s)+1) a := make([]byte, len(s)+1)
copy(a, s) copy(a, s)
return a, nil return a, nil
@ -51,6 +55,41 @@ func BytePtrFromString(s string) (*byte, error) {
return &a[0], nil return &a[0], nil
} }
// ByteSliceToString returns a string form of the text represented by the slice s, with a terminating NUL and any
// bytes after the NUL removed.
func ByteSliceToString(s []byte) string {
if i := bytes.IndexByte(s, 0); i != -1 {
s = s[:i]
}
return string(s)
}
// BytePtrToString takes a pointer to a sequence of text and returns the corresponding string.
// If the pointer is nil, it returns the empty string. It assumes that the text sequence is terminated
// at a zero byte; if the zero byte is not present, the program may crash.
func BytePtrToString(p *byte) string {
if p == nil {
return ""
}
if *p == 0 {
return ""
}
// Find NUL terminator.
n := 0
for ptr := unsafe.Pointer(p); *(*byte)(ptr) != 0; n++ {
ptr = unsafe.Pointer(uintptr(ptr) + 1)
}
var s []byte
h := (*unsafeheader.Slice)(unsafe.Pointer(&s))
h.Data = unsafe.Pointer(p)
h.Len = n
h.Cap = n
return string(s)
}
// Single-word zero for use when we need a valid pointer to 0 bytes. // Single-word zero for use when we need a valid pointer to 0 bytes.
// See mksyscall.pl. // See mksyscall.pl.
var _zero uintptr var _zero uintptr

View File

@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style // Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file. // license that can be found in the LICENSE file.
// +build !gccgo // +build gc
#include "textflag.h" #include "textflag.h"

View File

@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style // Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file. // license that can be found in the LICENSE file.
// +build !gccgo // +build gc
#include "textflag.h" #include "textflag.h"

View File

@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style // Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file. // license that can be found in the LICENSE file.
// +build !gccgo // +build gc
#include "textflag.h" #include "textflag.h"

View File

@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style // Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file. // license that can be found in the LICENSE file.
// +build !gccgo // +build gc
// +build arm,darwin // +build arm,darwin
#include "textflag.h" #include "textflag.h"

View File

@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style // Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file. // license that can be found in the LICENSE file.
// +build !gccgo // +build gc
// +build arm64,darwin // +build arm64,darwin
#include "textflag.h" #include "textflag.h"

View File

@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style // Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file. // license that can be found in the LICENSE file.
// +build !gccgo // +build gc
#include "textflag.h" #include "textflag.h"

View File

@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style // Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file. // license that can be found in the LICENSE file.
// +build !gccgo // +build gc
#include "textflag.h" #include "textflag.h"

View File

@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style // Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file. // license that can be found in the LICENSE file.
// +build !gccgo // +build gc
#include "textflag.h" #include "textflag.h"

View File

@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style // Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file. // license that can be found in the LICENSE file.
// +build !gccgo // +build gc
#include "textflag.h" #include "textflag.h"

View File

@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style // Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file. // license that can be found in the LICENSE file.
// +build !gccgo // +build gc
#include "textflag.h" #include "textflag.h"

View File

@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style // Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file. // license that can be found in the LICENSE file.
// +build !gccgo // +build gc
#include "textflag.h" #include "textflag.h"

View File

@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style // Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file. // license that can be found in the LICENSE file.
// +build !gccgo // +build gc
#include "textflag.h" #include "textflag.h"

View File

@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style // Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file. // license that can be found in the LICENSE file.
// +build !gccgo // +build gc
#include "textflag.h" #include "textflag.h"

View File

@ -4,7 +4,7 @@
// +build linux // +build linux
// +build arm64 // +build arm64
// +build !gccgo // +build gc
#include "textflag.h" #include "textflag.h"

View File

@ -4,7 +4,7 @@
// +build linux // +build linux
// +build mips64 mips64le // +build mips64 mips64le
// +build !gccgo // +build gc
#include "textflag.h" #include "textflag.h"

View File

@ -4,7 +4,7 @@
// +build linux // +build linux
// +build mips mipsle // +build mips mipsle
// +build !gccgo // +build gc
#include "textflag.h" #include "textflag.h"

View File

@ -4,7 +4,7 @@
// +build linux // +build linux
// +build ppc64 ppc64le // +build ppc64 ppc64le
// +build !gccgo // +build gc
#include "textflag.h" #include "textflag.h"

View File

@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style // Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file. // license that can be found in the LICENSE file.
// +build riscv64,!gccgo // +build riscv64,gc
#include "textflag.h" #include "textflag.h"

View File

@ -4,7 +4,7 @@
// +build s390x // +build s390x
// +build linux // +build linux
// +build !gccgo // +build gc
#include "textflag.h" #include "textflag.h"

View File

@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style // Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file. // license that can be found in the LICENSE file.
// +build !gccgo // +build gc
#include "textflag.h" #include "textflag.h"

View File

@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style // Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file. // license that can be found in the LICENSE file.
// +build !gccgo // +build gc
#include "textflag.h" #include "textflag.h"

View File

@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style // Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file. // license that can be found in the LICENSE file.
// +build !gccgo // +build gc
#include "textflag.h" #include "textflag.h"

View File

@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style // Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file. // license that can be found in the LICENSE file.
// +build !gccgo // +build gc
#include "textflag.h" #include "textflag.h"

View File

@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style // Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file. // license that can be found in the LICENSE file.
// +build !gccgo // +build gc
#include "textflag.h" #include "textflag.h"

View File

@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style // Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file. // license that can be found in the LICENSE file.
// +build !gccgo // +build gc
#include "textflag.h" #include "textflag.h"

View File

@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style // Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file. // license that can be found in the LICENSE file.
// +build !gccgo // +build gc
#include "textflag.h" #include "textflag.h"

View File

@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style // Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file. // license that can be found in the LICENSE file.
// +build !gccgo // +build gc
#include "textflag.h" #include "textflag.h"

View File

@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style // Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file. // license that can be found in the LICENSE file.
// +build !gccgo // +build gc
#include "textflag.h" #include "textflag.h"

View File

@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style // Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file. // license that can be found in the LICENSE file.
// +build !gccgo // +build gc
#include "textflag.h" #include "textflag.h"

View File

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

View File

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

11
vendor/golang.org/x/sys/unix/ptrace_darwin.go generated vendored Normal file
View File

@ -0,0 +1,11 @@
// 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.
// +build darwin,!ios
package unix
func ptrace(request int, pid int, addr uintptr, data uintptr) error {
return ptrace1(request, pid, addr, data)
}

11
vendor/golang.org/x/sys/unix/ptrace_ios.go generated vendored Normal file
View File

@ -0,0 +1,11 @@
// 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.
// +build ios
package unix
func ptrace(request int, pid int, addr uintptr, data uintptr) (err error) {
return ENOTSUP
}

View File

@ -24,7 +24,13 @@
// holds a value of type syscall.Errno. // holds a value of type syscall.Errno.
package unix // import "golang.org/x/sys/unix" package unix // import "golang.org/x/sys/unix"
import "strings" import (
"bytes"
"strings"
"unsafe"
"golang.org/x/sys/internal/unsafeheader"
)
// ByteSliceFromString returns a NUL-terminated slice of bytes // ByteSliceFromString returns a NUL-terminated slice of bytes
// containing the text of s. If s contains a NUL byte at any // containing the text of s. If s contains a NUL byte at any
@ -49,5 +55,40 @@ func BytePtrFromString(s string) (*byte, error) {
return &a[0], nil return &a[0], nil
} }
// ByteSliceToString returns a string form of the text represented by the slice s, with a terminating NUL and any
// bytes after the NUL removed.
func ByteSliceToString(s []byte) string {
if i := bytes.IndexByte(s, 0); i != -1 {
s = s[:i]
}
return string(s)
}
// BytePtrToString takes a pointer to a sequence of text and returns the corresponding string.
// If the pointer is nil, it returns the empty string. It assumes that the text sequence is terminated
// at a zero byte; if the zero byte is not present, the program may crash.
func BytePtrToString(p *byte) string {
if p == nil {
return ""
}
if *p == 0 {
return ""
}
// Find NUL terminator.
n := 0
for ptr := unsafe.Pointer(p); *(*byte)(ptr) != 0; n++ {
ptr = unsafe.Pointer(uintptr(ptr) + 1)
}
var s []byte
h := (*unsafeheader.Slice)(unsafe.Pointer(&s))
h.Data = unsafe.Pointer(p)
h.Len = n
h.Cap = n
return string(s)
}
// Single-word zero for use when we need a valid pointer to 0 bytes. // Single-word zero for use when we need a valid pointer to 0 bytes.
var _zero uintptr var _zero uintptr

View File

@ -277,7 +277,7 @@ func anyToSockaddr(fd int, rsa *RawSockaddrAny) (Sockaddr, error) {
} }
return sa, nil return sa, nil
} }
return nil, EAFNOSUPPORT return anyToSockaddrGOOS(fd, rsa)
} }
func Accept(fd int) (nfd int, sa Sockaddr, err error) { func Accept(fd int) (nfd int, sa Sockaddr, err error) {

View File

@ -26,7 +26,6 @@ func fdopendir(fd int) (dir uintptr, err error) {
func libc_fdopendir_trampoline() func libc_fdopendir_trampoline()
//go:linkname libc_fdopendir libc_fdopendir
//go:cgo_import_dynamic libc_fdopendir fdopendir "/usr/lib/libSystem.B.dylib" //go:cgo_import_dynamic libc_fdopendir fdopendir "/usr/lib/libSystem.B.dylib"
func Getdirentries(fd int, buf []byte, basep *uintptr) (n int, err error) { func Getdirentries(fd int, buf []byte, basep *uintptr) (n int, err error) {

View File

@ -31,10 +31,40 @@ type SockaddrDatalink struct {
raw RawSockaddrDatalink raw RawSockaddrDatalink
} }
// SockaddrCtl implements the Sockaddr interface for AF_SYSTEM type sockets.
type SockaddrCtl struct {
ID uint32
Unit uint32
raw RawSockaddrCtl
}
func (sa *SockaddrCtl) sockaddr() (unsafe.Pointer, _Socklen, error) {
sa.raw.Sc_len = SizeofSockaddrCtl
sa.raw.Sc_family = AF_SYSTEM
sa.raw.Ss_sysaddr = AF_SYS_CONTROL
sa.raw.Sc_id = sa.ID
sa.raw.Sc_unit = sa.Unit
return unsafe.Pointer(&sa.raw), SizeofSockaddrCtl, nil
}
func anyToSockaddrGOOS(fd int, rsa *RawSockaddrAny) (Sockaddr, error) {
switch rsa.Addr.Family {
case AF_SYSTEM:
pp := (*RawSockaddrCtl)(unsafe.Pointer(rsa))
if pp.Ss_sysaddr == AF_SYS_CONTROL {
sa := new(SockaddrCtl)
sa.ID = pp.Sc_id
sa.Unit = pp.Sc_unit
return sa, nil
}
}
return nil, EAFNOSUPPORT
}
// Some external packages rely on SYS___SYSCTL being defined to implement their // Some external packages rely on SYS___SYSCTL being defined to implement their
// own sysctl wrappers. Provide it here, even though direct syscalls are no // own sysctl wrappers. Provide it here, even though direct syscalls are no
// longer supported on darwin. // longer supported on darwin.
const SYS___SYSCTL = 202 const SYS___SYSCTL = SYS_SYSCTL
// Translate "kern.hostname" to []_C_int{0,1,2,3}. // Translate "kern.hostname" to []_C_int{0,1,2,3}.
func nametomib(name string) (mib []_C_int, err error) { func nametomib(name string) (mib []_C_int, err error) {
@ -89,13 +119,16 @@ type attrList struct {
Forkattr uint32 Forkattr uint32
} }
//sysnb pipe() (r int, w int, err error) //sysnb pipe(p *[2]int32) (err error)
func Pipe(p []int) (err error) { func Pipe(p []int) (err error) {
if len(p) != 2 { if len(p) != 2 {
return EINVAL return EINVAL
} }
p[0], p[1], err = pipe() var x [2]int32
err = pipe(&x)
p[0] = int(x[0])
p[1] = int(x[1])
return return
} }
@ -264,6 +297,29 @@ func IoctlCtlInfo(fd int, ctlInfo *CtlInfo) error {
return err return err
} }
// IfreqMTU is struct ifreq used to get or set a network device's MTU.
type IfreqMTU struct {
Name [IFNAMSIZ]byte
MTU int32
}
// IoctlGetIfreqMTU performs the SIOCGIFMTU ioctl operation on fd to get the MTU
// of the network device specified by ifname.
func IoctlGetIfreqMTU(fd int, ifname string) (*IfreqMTU, error) {
var ifreq IfreqMTU
copy(ifreq.Name[:], ifname)
err := ioctl(fd, SIOCGIFMTU, uintptr(unsafe.Pointer(&ifreq)))
return &ifreq, err
}
// IoctlSetIfreqMTU performs the SIOCSIFMTU ioctl operation on fd to set the MTU
// of the network device specified by ifreq.Name.
func IoctlSetIfreqMTU(fd int, ifreq *IfreqMTU) error {
err := ioctl(fd, SIOCSIFMTU, uintptr(unsafe.Pointer(ifreq)))
runtime.KeepAlive(ifreq)
return err
}
//sys sysctl(mib []_C_int, old *byte, oldlen *uintptr, new *byte, newlen uintptr) (err error) = SYS_SYSCTL //sys sysctl(mib []_C_int, old *byte, oldlen *uintptr, new *byte, newlen uintptr) (err error) = SYS_SYSCTL
func Uname(uname *Utsname) error { func Uname(uname *Utsname) error {

View File

@ -45,6 +45,6 @@ func Syscall9(num, a1, a2, a3, a4, a5, a6, a7, a8, a9 uintptr) (r1, r2 uintptr,
//sys Fstatfs(fd int, stat *Statfs_t) (err error) = SYS_FSTATFS64 //sys Fstatfs(fd int, stat *Statfs_t) (err error) = SYS_FSTATFS64
//sys getfsstat(buf unsafe.Pointer, size uintptr, flags int) (n int, err error) = SYS_GETFSSTAT64 //sys getfsstat(buf unsafe.Pointer, size uintptr, flags int) (n int, err error) = SYS_GETFSSTAT64
//sys Lstat(path string, stat *Stat_t) (err error) = SYS_LSTAT64 //sys Lstat(path string, stat *Stat_t) (err error) = SYS_LSTAT64
//sys ptrace(request int, pid int, addr uintptr, data uintptr) (err error) //sys ptrace1(request int, pid int, addr uintptr, data uintptr) (err error) = SYS_ptrace
//sys Stat(path string, stat *Stat_t) (err error) = SYS_STAT64 //sys Stat(path string, stat *Stat_t) (err error) = SYS_STAT64
//sys Statfs(path string, stat *Statfs_t) (err error) = SYS_STATFS64 //sys Statfs(path string, stat *Statfs_t) (err error) = SYS_STATFS64

View File

@ -45,6 +45,6 @@ func Syscall9(num, a1, a2, a3, a4, a5, a6, a7, a8, a9 uintptr) (r1, r2 uintptr,
//sys Fstatfs(fd int, stat *Statfs_t) (err error) = SYS_FSTATFS64 //sys Fstatfs(fd int, stat *Statfs_t) (err error) = SYS_FSTATFS64
//sys getfsstat(buf unsafe.Pointer, size uintptr, flags int) (n int, err error) = SYS_GETFSSTAT64 //sys getfsstat(buf unsafe.Pointer, size uintptr, flags int) (n int, err error) = SYS_GETFSSTAT64
//sys Lstat(path string, stat *Stat_t) (err error) = SYS_LSTAT64 //sys Lstat(path string, stat *Stat_t) (err error) = SYS_LSTAT64
//sys ptrace(request int, pid int, addr uintptr, data uintptr) (err error) //sys ptrace1(request int, pid int, addr uintptr, data uintptr) (err error) = SYS_ptrace
//sys Stat(path string, stat *Stat_t) (err error) = SYS_STAT64 //sys Stat(path string, stat *Stat_t) (err error) = SYS_STAT64
//sys Statfs(path string, stat *Statfs_t) (err error) = SYS_STATFS64 //sys Statfs(path string, stat *Statfs_t) (err error) = SYS_STATFS64

View File

@ -6,7 +6,7 @@ package unix
import "syscall" import "syscall"
func ptrace(request int, pid int, addr uintptr, data uintptr) error { func ptrace1(request int, pid int, addr uintptr, data uintptr) error {
return ENOTSUP return ENOTSUP
} }

View File

@ -45,6 +45,6 @@ func Syscall9(num, a1, a2, a3, a4, a5, a6, a7, a8, a9 uintptr) (r1, r2 uintptr,
//sys Fstatfs(fd int, stat *Statfs_t) (err error) //sys Fstatfs(fd int, stat *Statfs_t) (err error)
//sys getfsstat(buf unsafe.Pointer, size uintptr, flags int) (n int, err error) = SYS_GETFSSTAT //sys getfsstat(buf unsafe.Pointer, size uintptr, flags int) (n int, err error) = SYS_GETFSSTAT
//sys Lstat(path string, stat *Stat_t) (err error) //sys Lstat(path string, stat *Stat_t) (err error)
//sys ptrace(request int, pid int, addr uintptr, data uintptr) (err error) //sys ptrace1(request int, pid int, addr uintptr, data uintptr) (err error) = SYS_ptrace
//sys Stat(path string, stat *Stat_t) (err error) //sys Stat(path string, stat *Stat_t) (err error)
//sys Statfs(path string, stat *Statfs_t) (err error) //sys Statfs(path string, stat *Statfs_t) (err error)

View File

@ -47,6 +47,10 @@ type SockaddrDatalink struct {
raw RawSockaddrDatalink raw RawSockaddrDatalink
} }
func anyToSockaddrGOOS(fd int, rsa *RawSockaddrAny) (Sockaddr, error) {
return nil, EAFNOSUPPORT
}
// Translate "kern.hostname" to []_C_int{0,1,2,3}. // Translate "kern.hostname" to []_C_int{0,1,2,3}.
func nametomib(name string) (mib []_C_int, err error) { func nametomib(name string) (mib []_C_int, err error) {
const siz = unsafe.Sizeof(mib[0]) const siz = unsafe.Sizeof(mib[0])
@ -101,6 +105,19 @@ func Pipe(p []int) (err error) {
return return
} }
//sysnb pipe2(p *[2]_C_int, flags int) (err error)
func Pipe2(p []int, flags int) error {
if len(p) != 2 {
return EINVAL
}
var pp [2]_C_int
err := pipe2(&pp, flags)
p[0] = int(pp[0])
p[1] = int(pp[1])
return err
}
//sys extpread(fd int, p []byte, flags int, offset int64) (n int, err error) //sys extpread(fd int, p []byte, flags int, offset int64) (n int, err error)
func Pread(fd int, p []byte, offset int64) (n int, err error) { func Pread(fd int, p []byte, offset int64) (n int, err error) {
return extpread(fd, p, 0, offset) return extpread(fd, p, 0, offset)

View File

@ -54,6 +54,10 @@ type SockaddrDatalink struct {
raw RawSockaddrDatalink raw RawSockaddrDatalink
} }
func anyToSockaddrGOOS(fd int, rsa *RawSockaddrAny) (Sockaddr, error) {
return nil, EAFNOSUPPORT
}
// Translate "kern.hostname" to []_C_int{0,1,2,3}. // Translate "kern.hostname" to []_C_int{0,1,2,3}.
func nametomib(name string) (mib []_C_int, err error) { func nametomib(name string) (mib []_C_int, err error) {
const siz = unsafe.Sizeof(mib[0]) const siz = unsafe.Sizeof(mib[0])

View File

@ -75,16 +75,3 @@ func Accept4(fd int, flags int) (nfd int, sa Sockaddr, err error) {
} }
return return
} }
//sysnb pipe2(p *[2]_C_int, flags int) (err error)
func Pipe2(p []int, flags int) error {
if len(p) != 2 {
return EINVAL
}
var pp [2]_C_int
err := pipe2(&pp, flags)
p[0] = int(pp[0])
p[1] = int(pp[1])
return err
}

View File

@ -641,6 +641,36 @@ func (sa *SockaddrCAN) sockaddr() (unsafe.Pointer, _Socklen, error) {
return unsafe.Pointer(&sa.raw), SizeofSockaddrCAN, nil return unsafe.Pointer(&sa.raw), SizeofSockaddrCAN, nil
} }
// SockaddrCANJ1939 implements the Sockaddr interface for AF_CAN using J1939
// protocol (https://en.wikipedia.org/wiki/SAE_J1939). For more information
// on the purposes of the fields, check the official linux kernel documentation
// available here: https://www.kernel.org/doc/Documentation/networking/j1939.rst
type SockaddrCANJ1939 struct {
Ifindex int
Name uint64
PGN uint32
Addr uint8
raw RawSockaddrCAN
}
func (sa *SockaddrCANJ1939) sockaddr() (unsafe.Pointer, _Socklen, error) {
if sa.Ifindex < 0 || sa.Ifindex > 0x7fffffff {
return nil, 0, EINVAL
}
sa.raw.Family = AF_CAN
sa.raw.Ifindex = int32(sa.Ifindex)
n := (*[8]byte)(unsafe.Pointer(&sa.Name))
for i := 0; i < 8; i++ {
sa.raw.Addr[i] = n[i]
}
p := (*[4]byte)(unsafe.Pointer(&sa.PGN))
for i := 0; i < 4; i++ {
sa.raw.Addr[i+8] = p[i]
}
sa.raw.Addr[12] = sa.Addr
return unsafe.Pointer(&sa.raw), SizeofSockaddrCAN, nil
}
// SockaddrALG implements the Sockaddr interface for AF_ALG type sockets. // SockaddrALG implements the Sockaddr interface for AF_ALG type sockets.
// SockaddrALG enables userspace access to the Linux kernel's cryptography // SockaddrALG enables userspace access to the Linux kernel's cryptography
// subsystem. The Type and Name fields specify which type of hash or cipher // subsystem. The Type and Name fields specify which type of hash or cipher
@ -952,6 +982,10 @@ func (sa *SockaddrIUCV) sockaddr() (unsafe.Pointer, _Socklen, error) {
return unsafe.Pointer(&sa.raw), SizeofSockaddrIUCV, nil return unsafe.Pointer(&sa.raw), SizeofSockaddrIUCV, nil
} }
var socketProtocol = func(fd int) (int, error) {
return GetsockoptInt(fd, SOL_SOCKET, SO_PROTOCOL)
}
func anyToSockaddr(fd int, rsa *RawSockaddrAny) (Sockaddr, error) { func anyToSockaddr(fd int, rsa *RawSockaddrAny) (Sockaddr, error) {
switch rsa.Addr.Family { switch rsa.Addr.Family {
case AF_NETLINK: case AF_NETLINK:
@ -1002,7 +1036,7 @@ func anyToSockaddr(fd int, rsa *RawSockaddrAny) (Sockaddr, error) {
return sa, nil return sa, nil
case AF_INET: case AF_INET:
proto, err := GetsockoptInt(fd, SOL_SOCKET, SO_PROTOCOL) proto, err := socketProtocol(fd)
if err != nil { if err != nil {
return nil, err return nil, err
} }
@ -1028,7 +1062,7 @@ func anyToSockaddr(fd int, rsa *RawSockaddrAny) (Sockaddr, error) {
} }
case AF_INET6: case AF_INET6:
proto, err := GetsockoptInt(fd, SOL_SOCKET, SO_PROTOCOL) proto, err := socketProtocol(fd)
if err != nil { if err != nil {
return nil, err return nil, err
} }
@ -1063,7 +1097,7 @@ func anyToSockaddr(fd int, rsa *RawSockaddrAny) (Sockaddr, error) {
} }
return sa, nil return sa, nil
case AF_BLUETOOTH: case AF_BLUETOOTH:
proto, err := GetsockoptInt(fd, SOL_SOCKET, SO_PROTOCOL) proto, err := socketProtocol(fd)
if err != nil { if err != nil {
return nil, err return nil, err
} }
@ -1150,7 +1184,30 @@ func anyToSockaddr(fd int, rsa *RawSockaddrAny) (Sockaddr, error) {
return sa, nil return sa, nil
case AF_CAN: case AF_CAN:
proto, err := socketProtocol(fd)
if err != nil {
return nil, err
}
pp := (*RawSockaddrCAN)(unsafe.Pointer(rsa)) pp := (*RawSockaddrCAN)(unsafe.Pointer(rsa))
switch proto {
case CAN_J1939:
sa := &SockaddrCANJ1939{
Ifindex: int(pp.Ifindex),
}
name := (*[8]byte)(unsafe.Pointer(&sa.Name))
for i := 0; i < 8; i++ {
name[i] = pp.Addr[i]
}
pgn := (*[4]byte)(unsafe.Pointer(&sa.PGN))
for i := 0; i < 4; i++ {
pgn[i] = pp.Addr[i+8]
}
addr := (*[1]byte)(unsafe.Pointer(&sa.Addr))
addr[0] = pp.Addr[12]
return sa, nil
default:
sa := &SockaddrCAN{ sa := &SockaddrCAN{
Ifindex: int(pp.Ifindex), Ifindex: int(pp.Ifindex),
} }
@ -1163,7 +1220,7 @@ func anyToSockaddr(fd int, rsa *RawSockaddrAny) (Sockaddr, error) {
tx[i] = pp.Addr[i+4] tx[i] = pp.Addr[i+4]
} }
return sa, nil return sa, nil
}
} }
return nil, EAFNOSUPPORT return nil, EAFNOSUPPORT
} }

View File

@ -3,7 +3,7 @@
// license that can be found in the LICENSE file. // license that can be found in the LICENSE file.
// +build amd64,linux // +build amd64,linux
// +build !gccgo // +build gc
package unix package unix

View File

@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style // Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file. // license that can be found in the LICENSE file.
// +build linux,!gccgo // +build linux,gc
package unix package unix

View File

@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style // Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file. // license that can be found in the LICENSE file.
// +build linux,!gccgo,386 // +build linux,gc,386
package unix package unix

View File

@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style // Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file. // license that can be found in the LICENSE file.
// +build arm,!gccgo,linux // +build arm,gc,linux
package unix package unix

View File

@ -31,6 +31,10 @@ type SockaddrDatalink struct {
raw RawSockaddrDatalink raw RawSockaddrDatalink
} }
func anyToSockaddrGOOS(fd int, rsa *RawSockaddrAny) (Sockaddr, error) {
return nil, EAFNOSUPPORT
}
func Syscall9(trap, a1, a2, a3, a4, a5, a6, a7, a8, a9 uintptr) (r1, r2 uintptr, err syscall.Errno) func Syscall9(trap, a1, a2, a3, a4, a5, a6, a7, a8, a9 uintptr) (r1, r2 uintptr, err syscall.Errno)
func sysctlNodes(mib []_C_int) (nodes []Sysctlnode, err error) { func sysctlNodes(mib []_C_int) (nodes []Sysctlnode, err error) {

View File

@ -31,6 +31,10 @@ type SockaddrDatalink struct {
raw RawSockaddrDatalink raw RawSockaddrDatalink
} }
func anyToSockaddrGOOS(fd int, rsa *RawSockaddrAny) (Sockaddr, error) {
return nil, EAFNOSUPPORT
}
func Syscall9(trap, a1, a2, a3, a4, a5, a6, a7, a8, a9 uintptr) (r1, r2 uintptr, err syscall.Errno) func Syscall9(trap, a1, a2, a3, a4, a5, a6, a7, a8, a9 uintptr) (r1, r2 uintptr, err syscall.Errno)
func nametomib(name string) (mib []_C_int, err error) { func nametomib(name string) (mib []_C_int, err error) {

View File

@ -68,6 +68,19 @@ func Pipe(p []int) (err error) {
return nil return nil
} }
//sysnb pipe2(p *[2]_C_int, flags int) (err error)
func Pipe2(p []int, flags int) error {
if len(p) != 2 {
return EINVAL
}
var pp [2]_C_int
err := pipe2(&pp, flags)
p[0] = int(pp[0])
p[1] = int(pp[1])
return err
}
func (sa *SockaddrInet4) sockaddr() (unsafe.Pointer, _Socklen, error) { func (sa *SockaddrInet4) sockaddr() (unsafe.Pointer, _Socklen, error) {
if sa.Port < 0 || sa.Port > 0xFFFF { if sa.Port < 0 || sa.Port > 0xFFFF {
return nil, 0, EINVAL return nil, 0, EINVAL

View File

@ -3,7 +3,7 @@
// license that can be found in the LICENSE file. // license that can be found in the LICENSE file.
// +build darwin dragonfly freebsd linux netbsd openbsd solaris // +build darwin dragonfly freebsd linux netbsd openbsd solaris
// +build !gccgo,!ppc64le,!ppc64 // +build gc,!ppc64le,!ppc64
package unix package unix

View File

@ -4,7 +4,7 @@
// +build linux // +build linux
// +build ppc64le ppc64 // +build ppc64le ppc64
// +build !gccgo // +build gc
package unix package unix

View File

@ -8,12 +8,10 @@ package unix
import "time" import "time"
// TimespecToNsec converts a Timespec value into a number of // TimespecToNSec returns the time stored in ts as nanoseconds.
// nanoseconds since the Unix epoch. func TimespecToNsec(ts Timespec) int64 { return ts.Nano() }
func TimespecToNsec(ts Timespec) int64 { return int64(ts.Sec)*1e9 + int64(ts.Nsec) }
// NsecToTimespec takes a number of nanoseconds since the Unix epoch // NsecToTimespec converts a number of nanoseconds into a Timespec.
// and returns the corresponding Timespec value.
func NsecToTimespec(nsec int64) Timespec { func NsecToTimespec(nsec int64) Timespec {
sec := nsec / 1e9 sec := nsec / 1e9
nsec = nsec % 1e9 nsec = nsec % 1e9
@ -42,12 +40,10 @@ func TimeToTimespec(t time.Time) (Timespec, error) {
return ts, nil return ts, nil
} }
// TimevalToNsec converts a Timeval value into a number of nanoseconds // TimevalToNsec returns the time stored in tv as nanoseconds.
// since the Unix epoch. func TimevalToNsec(tv Timeval) int64 { return tv.Nano() }
func TimevalToNsec(tv Timeval) int64 { return int64(tv.Sec)*1e9 + int64(tv.Usec)*1e3 }
// NsecToTimeval takes a number of nanoseconds since the Unix epoch // NsecToTimeval converts a number of nanoseconds into a Timeval.
// and returns the corresponding Timeval value.
func NsecToTimeval(nsec int64) Timeval { func NsecToTimeval(nsec int64) Timeval {
nsec += 999 // round up to microsecond nsec += 999 // round up to microsecond
usec := nsec % 1e9 / 1e3 usec := nsec % 1e9 / 1e3
@ -59,24 +55,22 @@ func NsecToTimeval(nsec int64) Timeval {
return setTimeval(sec, usec) return setTimeval(sec, usec)
} }
// Unix returns ts as the number of seconds and nanoseconds elapsed since the // Unix returns the time stored in ts as seconds plus nanoseconds.
// Unix epoch.
func (ts *Timespec) Unix() (sec int64, nsec int64) { func (ts *Timespec) Unix() (sec int64, nsec int64) {
return int64(ts.Sec), int64(ts.Nsec) return int64(ts.Sec), int64(ts.Nsec)
} }
// Unix returns tv as the number of seconds and nanoseconds elapsed since the // Unix returns the time stored in tv as seconds plus nanoseconds.
// Unix epoch.
func (tv *Timeval) Unix() (sec int64, nsec int64) { func (tv *Timeval) Unix() (sec int64, nsec int64) {
return int64(tv.Sec), int64(tv.Usec) * 1000 return int64(tv.Sec), int64(tv.Usec) * 1000
} }
// Nano returns ts as the number of nanoseconds elapsed since the Unix epoch. // Nano returns the time stored in ts as nanoseconds.
func (ts *Timespec) Nano() int64 { func (ts *Timespec) Nano() int64 {
return int64(ts.Sec)*1e9 + int64(ts.Nsec) return int64(ts.Sec)*1e9 + int64(ts.Nsec)
} }
// Nano returns tv as the number of nanoseconds elapsed since the Unix epoch. // Nano returns the time stored in tv as nanoseconds.
func (tv *Timeval) Nano() int64 { func (tv *Timeval) Nano() int64 {
return int64(tv.Sec)*1e9 + int64(tv.Usec)*1000 return int64(tv.Sec)*1e9 + int64(tv.Usec)*1000
} }

View File

@ -45,6 +45,7 @@ const (
AF_SIP = 0x18 AF_SIP = 0x18
AF_SNA = 0xb AF_SNA = 0xb
AF_SYSTEM = 0x20 AF_SYSTEM = 0x20
AF_SYS_CONTROL = 0x2
AF_UNIX = 0x1 AF_UNIX = 0x1
AF_UNSPEC = 0x0 AF_UNSPEC = 0x0
AF_UTUN = 0x26 AF_UTUN = 0x26

View File

@ -45,6 +45,7 @@ const (
AF_SIP = 0x18 AF_SIP = 0x18
AF_SNA = 0xb AF_SNA = 0xb
AF_SYSTEM = 0x20 AF_SYSTEM = 0x20
AF_SYS_CONTROL = 0x2
AF_UNIX = 0x1 AF_UNIX = 0x1
AF_UNSPEC = 0x0 AF_UNSPEC = 0x0
AF_UTUN = 0x26 AF_UTUN = 0x26

View File

@ -45,6 +45,7 @@ const (
AF_SIP = 0x18 AF_SIP = 0x18
AF_SNA = 0xb AF_SNA = 0xb
AF_SYSTEM = 0x20 AF_SYSTEM = 0x20
AF_SYS_CONTROL = 0x2
AF_UNIX = 0x1 AF_UNIX = 0x1
AF_UNSPEC = 0x0 AF_UNSPEC = 0x0
AF_UTUN = 0x26 AF_UTUN = 0x26

View File

@ -45,6 +45,7 @@ const (
AF_SIP = 0x18 AF_SIP = 0x18
AF_SNA = 0xb AF_SNA = 0xb
AF_SYSTEM = 0x20 AF_SYSTEM = 0x20
AF_SYS_CONTROL = 0x2
AF_UNIX = 0x1 AF_UNIX = 0x1
AF_UNSPEC = 0x0 AF_UNSPEC = 0x0
AF_UTUN = 0x26 AF_UTUN = 0x26

View File

@ -65,6 +65,7 @@ const (
ALG_OP_ENCRYPT = 0x1 ALG_OP_ENCRYPT = 0x1
ALG_SET_AEAD_ASSOCLEN = 0x4 ALG_SET_AEAD_ASSOCLEN = 0x4
ALG_SET_AEAD_AUTHSIZE = 0x5 ALG_SET_AEAD_AUTHSIZE = 0x5
ALG_SET_DRBG_ENTROPY = 0x6
ALG_SET_IV = 0x2 ALG_SET_IV = 0x2
ALG_SET_KEY = 0x1 ALG_SET_KEY = 0x1
ALG_SET_OP = 0x3 ALG_SET_OP = 0x3
@ -179,8 +180,10 @@ const (
BPF_F_ANY_ALIGNMENT = 0x2 BPF_F_ANY_ALIGNMENT = 0x2
BPF_F_QUERY_EFFECTIVE = 0x1 BPF_F_QUERY_EFFECTIVE = 0x1
BPF_F_REPLACE = 0x4 BPF_F_REPLACE = 0x4
BPF_F_SLEEPABLE = 0x10
BPF_F_STRICT_ALIGNMENT = 0x1 BPF_F_STRICT_ALIGNMENT = 0x1
BPF_F_TEST_RND_HI32 = 0x4 BPF_F_TEST_RND_HI32 = 0x4
BPF_F_TEST_RUN_ON_CPU = 0x1
BPF_F_TEST_STATE_FREQ = 0x8 BPF_F_TEST_STATE_FREQ = 0x8
BPF_H = 0x8 BPF_H = 0x8
BPF_IMM = 0x0 BPF_IMM = 0x0
@ -219,6 +222,7 @@ const (
BPF_NET_OFF = -0x100000 BPF_NET_OFF = -0x100000
BPF_OBJ_NAME_LEN = 0x10 BPF_OBJ_NAME_LEN = 0x10
BPF_OR = 0x40 BPF_OR = 0x40
BPF_PSEUDO_BTF_ID = 0x3
BPF_PSEUDO_CALL = 0x1 BPF_PSEUDO_CALL = 0x1
BPF_PSEUDO_MAP_FD = 0x1 BPF_PSEUDO_MAP_FD = 0x1
BPF_PSEUDO_MAP_VALUE = 0x2 BPF_PSEUDO_MAP_VALUE = 0x2
@ -429,10 +433,13 @@ const (
DEBUGFS_MAGIC = 0x64626720 DEBUGFS_MAGIC = 0x64626720
DEVLINK_CMD_ESWITCH_MODE_GET = 0x1d DEVLINK_CMD_ESWITCH_MODE_GET = 0x1d
DEVLINK_CMD_ESWITCH_MODE_SET = 0x1e DEVLINK_CMD_ESWITCH_MODE_SET = 0x1e
DEVLINK_FLASH_OVERWRITE_IDENTIFIERS = 0x2
DEVLINK_FLASH_OVERWRITE_SETTINGS = 0x1
DEVLINK_GENL_MCGRP_CONFIG_NAME = "config" DEVLINK_GENL_MCGRP_CONFIG_NAME = "config"
DEVLINK_GENL_NAME = "devlink" DEVLINK_GENL_NAME = "devlink"
DEVLINK_GENL_VERSION = 0x1 DEVLINK_GENL_VERSION = 0x1
DEVLINK_SB_THRESHOLD_TO_ALPHA_MAX = 0x14 DEVLINK_SB_THRESHOLD_TO_ALPHA_MAX = 0x14
DEVLINK_SUPPORTED_FLASH_OVERWRITE_SECTIONS = 0x3
DEVMEM_MAGIC = 0x454d444d DEVMEM_MAGIC = 0x454d444d
DEVPTS_SUPER_MAGIC = 0x1cd1 DEVPTS_SUPER_MAGIC = 0x1cd1
DMA_BUF_MAGIC = 0x444d4142 DMA_BUF_MAGIC = 0x444d4142
@ -477,9 +484,9 @@ const (
DM_UUID_FLAG = 0x4000 DM_UUID_FLAG = 0x4000
DM_UUID_LEN = 0x81 DM_UUID_LEN = 0x81
DM_VERSION = 0xc138fd00 DM_VERSION = 0xc138fd00
DM_VERSION_EXTRA = "-ioctl (2020-02-27)" DM_VERSION_EXTRA = "-ioctl (2020-10-01)"
DM_VERSION_MAJOR = 0x4 DM_VERSION_MAJOR = 0x4
DM_VERSION_MINOR = 0x2a DM_VERSION_MINOR = 0x2b
DM_VERSION_PATCHLEVEL = 0x0 DM_VERSION_PATCHLEVEL = 0x0
DT_BLK = 0x6 DT_BLK = 0x6
DT_CHR = 0x2 DT_CHR = 0x2
@ -520,6 +527,119 @@ const (
EPOLL_CTL_DEL = 0x2 EPOLL_CTL_DEL = 0x2
EPOLL_CTL_MOD = 0x3 EPOLL_CTL_MOD = 0x3
EROFS_SUPER_MAGIC_V1 = 0xe0f5e1e2 EROFS_SUPER_MAGIC_V1 = 0xe0f5e1e2
ESP_V4_FLOW = 0xa
ESP_V6_FLOW = 0xc
ETHER_FLOW = 0x12
ETHTOOL_BUSINFO_LEN = 0x20
ETHTOOL_EROMVERS_LEN = 0x20
ETHTOOL_FEC_AUTO = 0x2
ETHTOOL_FEC_BASER = 0x10
ETHTOOL_FEC_LLRS = 0x20
ETHTOOL_FEC_NONE = 0x1
ETHTOOL_FEC_OFF = 0x4
ETHTOOL_FEC_RS = 0x8
ETHTOOL_FLAG_ALL = 0x7
ETHTOOL_FLAG_COMPACT_BITSETS = 0x1
ETHTOOL_FLAG_OMIT_REPLY = 0x2
ETHTOOL_FLAG_STATS = 0x4
ETHTOOL_FLASHDEV = 0x33
ETHTOOL_FLASH_MAX_FILENAME = 0x80
ETHTOOL_FWVERS_LEN = 0x20
ETHTOOL_F_COMPAT = 0x4
ETHTOOL_F_UNSUPPORTED = 0x1
ETHTOOL_F_WISH = 0x2
ETHTOOL_GCHANNELS = 0x3c
ETHTOOL_GCOALESCE = 0xe
ETHTOOL_GDRVINFO = 0x3
ETHTOOL_GEEE = 0x44
ETHTOOL_GEEPROM = 0xb
ETHTOOL_GENL_NAME = "ethtool"
ETHTOOL_GENL_VERSION = 0x1
ETHTOOL_GET_DUMP_DATA = 0x40
ETHTOOL_GET_DUMP_FLAG = 0x3f
ETHTOOL_GET_TS_INFO = 0x41
ETHTOOL_GFEATURES = 0x3a
ETHTOOL_GFECPARAM = 0x50
ETHTOOL_GFLAGS = 0x25
ETHTOOL_GGRO = 0x2b
ETHTOOL_GGSO = 0x23
ETHTOOL_GLINK = 0xa
ETHTOOL_GLINKSETTINGS = 0x4c
ETHTOOL_GMODULEEEPROM = 0x43
ETHTOOL_GMODULEINFO = 0x42
ETHTOOL_GMSGLVL = 0x7
ETHTOOL_GPAUSEPARAM = 0x12
ETHTOOL_GPERMADDR = 0x20
ETHTOOL_GPFLAGS = 0x27
ETHTOOL_GPHYSTATS = 0x4a
ETHTOOL_GREGS = 0x4
ETHTOOL_GRINGPARAM = 0x10
ETHTOOL_GRSSH = 0x46
ETHTOOL_GRXCLSRLALL = 0x30
ETHTOOL_GRXCLSRLCNT = 0x2e
ETHTOOL_GRXCLSRULE = 0x2f
ETHTOOL_GRXCSUM = 0x14
ETHTOOL_GRXFH = 0x29
ETHTOOL_GRXFHINDIR = 0x38
ETHTOOL_GRXNTUPLE = 0x36
ETHTOOL_GRXRINGS = 0x2d
ETHTOOL_GSET = 0x1
ETHTOOL_GSG = 0x18
ETHTOOL_GSSET_INFO = 0x37
ETHTOOL_GSTATS = 0x1d
ETHTOOL_GSTRINGS = 0x1b
ETHTOOL_GTSO = 0x1e
ETHTOOL_GTUNABLE = 0x48
ETHTOOL_GTXCSUM = 0x16
ETHTOOL_GUFO = 0x21
ETHTOOL_GWOL = 0x5
ETHTOOL_MCGRP_MONITOR_NAME = "monitor"
ETHTOOL_NWAY_RST = 0x9
ETHTOOL_PERQUEUE = 0x4b
ETHTOOL_PHYS_ID = 0x1c
ETHTOOL_PHY_EDPD_DFLT_TX_MSECS = 0xffff
ETHTOOL_PHY_EDPD_DISABLE = 0x0
ETHTOOL_PHY_EDPD_NO_TX = 0xfffe
ETHTOOL_PHY_FAST_LINK_DOWN_OFF = 0xff
ETHTOOL_PHY_FAST_LINK_DOWN_ON = 0x0
ETHTOOL_PHY_GTUNABLE = 0x4e
ETHTOOL_PHY_STUNABLE = 0x4f
ETHTOOL_RESET = 0x34
ETHTOOL_RXNTUPLE_ACTION_CLEAR = -0x2
ETHTOOL_RXNTUPLE_ACTION_DROP = -0x1
ETHTOOL_RX_FLOW_SPEC_RING = 0xffffffff
ETHTOOL_RX_FLOW_SPEC_RING_VF = 0xff00000000
ETHTOOL_RX_FLOW_SPEC_RING_VF_OFF = 0x20
ETHTOOL_SCHANNELS = 0x3d
ETHTOOL_SCOALESCE = 0xf
ETHTOOL_SEEE = 0x45
ETHTOOL_SEEPROM = 0xc
ETHTOOL_SET_DUMP = 0x3e
ETHTOOL_SFEATURES = 0x3b
ETHTOOL_SFECPARAM = 0x51
ETHTOOL_SFLAGS = 0x26
ETHTOOL_SGRO = 0x2c
ETHTOOL_SGSO = 0x24
ETHTOOL_SLINKSETTINGS = 0x4d
ETHTOOL_SMSGLVL = 0x8
ETHTOOL_SPAUSEPARAM = 0x13
ETHTOOL_SPFLAGS = 0x28
ETHTOOL_SRINGPARAM = 0x11
ETHTOOL_SRSSH = 0x47
ETHTOOL_SRXCLSRLDEL = 0x31
ETHTOOL_SRXCLSRLINS = 0x32
ETHTOOL_SRXCSUM = 0x15
ETHTOOL_SRXFH = 0x2a
ETHTOOL_SRXFHINDIR = 0x39
ETHTOOL_SRXNTUPLE = 0x35
ETHTOOL_SSET = 0x2
ETHTOOL_SSG = 0x19
ETHTOOL_STSO = 0x1f
ETHTOOL_STUNABLE = 0x49
ETHTOOL_STXCSUM = 0x17
ETHTOOL_SUFO = 0x22
ETHTOOL_SWOL = 0x6
ETHTOOL_TEST = 0x1a
ETH_P_1588 = 0x88f7 ETH_P_1588 = 0x88f7
ETH_P_8021AD = 0x88a8 ETH_P_8021AD = 0x88a8
ETH_P_8021AH = 0x88e7 ETH_P_8021AH = 0x88e7
@ -989,6 +1109,7 @@ const (
IPV6_DONTFRAG = 0x3e IPV6_DONTFRAG = 0x3e
IPV6_DROP_MEMBERSHIP = 0x15 IPV6_DROP_MEMBERSHIP = 0x15
IPV6_DSTOPTS = 0x3b IPV6_DSTOPTS = 0x3b
IPV6_FLOW = 0x11
IPV6_FREEBIND = 0x4e IPV6_FREEBIND = 0x4e
IPV6_HDRINCL = 0x24 IPV6_HDRINCL = 0x24
IPV6_HOPLIMIT = 0x34 IPV6_HOPLIMIT = 0x34
@ -1038,6 +1159,7 @@ const (
IPV6_TRANSPARENT = 0x4b IPV6_TRANSPARENT = 0x4b
IPV6_UNICAST_HOPS = 0x10 IPV6_UNICAST_HOPS = 0x10
IPV6_UNICAST_IF = 0x4c IPV6_UNICAST_IF = 0x4c
IPV6_USER_FLOW = 0xe
IPV6_V6ONLY = 0x1a IPV6_V6ONLY = 0x1a
IPV6_XFRM_POLICY = 0x23 IPV6_XFRM_POLICY = 0x23
IP_ADD_MEMBERSHIP = 0x23 IP_ADD_MEMBERSHIP = 0x23
@ -1094,6 +1216,7 @@ const (
IP_TTL = 0x2 IP_TTL = 0x2
IP_UNBLOCK_SOURCE = 0x25 IP_UNBLOCK_SOURCE = 0x25
IP_UNICAST_IF = 0x32 IP_UNICAST_IF = 0x32
IP_USER_FLOW = 0xd
IP_XFRM_POLICY = 0x11 IP_XFRM_POLICY = 0x11
ISOFS_SUPER_MAGIC = 0x9660 ISOFS_SUPER_MAGIC = 0x9660
ISTRIP = 0x20 ISTRIP = 0x20
@ -1217,6 +1340,12 @@ const (
LOOP_SET_STATUS_SETTABLE_FLAGS = 0xc LOOP_SET_STATUS_SETTABLE_FLAGS = 0xc
LO_KEY_SIZE = 0x20 LO_KEY_SIZE = 0x20
LO_NAME_SIZE = 0x40 LO_NAME_SIZE = 0x40
LWTUNNEL_IP6_MAX = 0x8
LWTUNNEL_IP_MAX = 0x8
LWTUNNEL_IP_OPTS_MAX = 0x3
LWTUNNEL_IP_OPT_ERSPAN_MAX = 0x4
LWTUNNEL_IP_OPT_GENEVE_MAX = 0x3
LWTUNNEL_IP_OPT_VXLAN_MAX = 0x1
MADV_COLD = 0x14 MADV_COLD = 0x14
MADV_DODUMP = 0x11 MADV_DODUMP = 0x11
MADV_DOFORK = 0xb MADV_DOFORK = 0xb
@ -1325,6 +1454,7 @@ const (
MS_NOREMOTELOCK = 0x8000000 MS_NOREMOTELOCK = 0x8000000
MS_NOSEC = 0x10000000 MS_NOSEC = 0x10000000
MS_NOSUID = 0x2 MS_NOSUID = 0x2
MS_NOSYMFOLLOW = 0x100
MS_NOUSER = -0x80000000 MS_NOUSER = -0x80000000
MS_POSIXACL = 0x10000 MS_POSIXACL = 0x10000
MS_PRIVATE = 0x40000 MS_PRIVATE = 0x40000
@ -1566,7 +1696,7 @@ const (
PERF_MEM_REMOTE_REMOTE = 0x1 PERF_MEM_REMOTE_REMOTE = 0x1
PERF_MEM_REMOTE_SHIFT = 0x25 PERF_MEM_REMOTE_SHIFT = 0x25
PERF_MEM_SNOOPX_FWD = 0x1 PERF_MEM_SNOOPX_FWD = 0x1
PERF_MEM_SNOOPX_SHIFT = 0x25 PERF_MEM_SNOOPX_SHIFT = 0x26
PERF_MEM_SNOOP_HIT = 0x4 PERF_MEM_SNOOP_HIT = 0x4
PERF_MEM_SNOOP_HITM = 0x10 PERF_MEM_SNOOP_HITM = 0x10
PERF_MEM_SNOOP_MISS = 0x8 PERF_MEM_SNOOP_MISS = 0x8
@ -1666,6 +1796,13 @@ const (
PR_MCE_KILL_SET = 0x1 PR_MCE_KILL_SET = 0x1
PR_MPX_DISABLE_MANAGEMENT = 0x2c PR_MPX_DISABLE_MANAGEMENT = 0x2c
PR_MPX_ENABLE_MANAGEMENT = 0x2b PR_MPX_ENABLE_MANAGEMENT = 0x2b
PR_MTE_TAG_MASK = 0x7fff8
PR_MTE_TAG_SHIFT = 0x3
PR_MTE_TCF_ASYNC = 0x4
PR_MTE_TCF_MASK = 0x6
PR_MTE_TCF_NONE = 0x0
PR_MTE_TCF_SHIFT = 0x1
PR_MTE_TCF_SYNC = 0x2
PR_PAC_APDAKEY = 0x4 PR_PAC_APDAKEY = 0x4
PR_PAC_APDBKEY = 0x8 PR_PAC_APDBKEY = 0x8
PR_PAC_APGAKEY = 0x10 PR_PAC_APGAKEY = 0x10
@ -2200,7 +2337,7 @@ const (
STATX_ATTR_APPEND = 0x20 STATX_ATTR_APPEND = 0x20
STATX_ATTR_AUTOMOUNT = 0x1000 STATX_ATTR_AUTOMOUNT = 0x1000
STATX_ATTR_COMPRESSED = 0x4 STATX_ATTR_COMPRESSED = 0x4
STATX_ATTR_DAX = 0x2000 STATX_ATTR_DAX = 0x200000
STATX_ATTR_ENCRYPTED = 0x800 STATX_ATTR_ENCRYPTED = 0x800
STATX_ATTR_IMMUTABLE = 0x10 STATX_ATTR_IMMUTABLE = 0x10
STATX_ATTR_MOUNT_ROOT = 0x2000 STATX_ATTR_MOUNT_ROOT = 0x2000
@ -2319,6 +2456,8 @@ const (
TCP_TX_DELAY = 0x25 TCP_TX_DELAY = 0x25
TCP_ULP = 0x1f TCP_ULP = 0x1f
TCP_USER_TIMEOUT = 0x12 TCP_USER_TIMEOUT = 0x12
TCP_V4_FLOW = 0x1
TCP_V6_FLOW = 0x5
TCP_WINDOW_CLAMP = 0xa TCP_WINDOW_CLAMP = 0xa
TCP_ZEROCOPY_RECEIVE = 0x23 TCP_ZEROCOPY_RECEIVE = 0x23
TFD_TIMER_ABSTIME = 0x1 TFD_TIMER_ABSTIME = 0x1
@ -2384,6 +2523,7 @@ const (
TIPC_NODE_STATE = 0x0 TIPC_NODE_STATE = 0x0
TIPC_OK = 0x0 TIPC_OK = 0x0
TIPC_PUBLISHED = 0x1 TIPC_PUBLISHED = 0x1
TIPC_REKEYING_NOW = 0xffffffff
TIPC_RESERVED_TYPES = 0x40 TIPC_RESERVED_TYPES = 0x40
TIPC_RETDATA = 0x2 TIPC_RETDATA = 0x2
TIPC_SERVICE_ADDR = 0x2 TIPC_SERVICE_ADDR = 0x2
@ -2444,6 +2584,7 @@ const (
VM_SOCKETS_INVALID_VERSION = 0xffffffff VM_SOCKETS_INVALID_VERSION = 0xffffffff
VQUIT = 0x1 VQUIT = 0x1
VT0 = 0x0 VT0 = 0x0
WAKE_MAGIC = 0x20
WALL = 0x40000000 WALL = 0x40000000
WCLONE = 0x80000000 WCLONE = 0x80000000
WCONTINUED = 0x8 WCONTINUED = 0x8

View File

@ -4,7 +4,7 @@
// +build 386,linux // +build 386,linux
// Code generated by cmd/cgo -godefs; DO NOT EDIT. // Code generated by cmd/cgo -godefs; DO NOT EDIT.
// cgo -godefs -- -Wall -Werror -static -I/tmp/include -m32 _const.go // cgo -godefs -- -Wall -Werror -static -I/tmp/include -m32 /build/_const.go
package unix package unix

View File

@ -4,7 +4,7 @@
// +build amd64,linux // +build amd64,linux
// Code generated by cmd/cgo -godefs; DO NOT EDIT. // Code generated by cmd/cgo -godefs; DO NOT EDIT.
// cgo -godefs -- -Wall -Werror -static -I/tmp/include -m64 _const.go // cgo -godefs -- -Wall -Werror -static -I/tmp/include -m64 /build/_const.go
package unix package unix

View File

@ -4,7 +4,7 @@
// +build arm,linux // +build arm,linux
// Code generated by cmd/cgo -godefs; DO NOT EDIT. // Code generated by cmd/cgo -godefs; DO NOT EDIT.
// cgo -godefs -- -Wall -Werror -static -I/tmp/include _const.go // cgo -godefs -- -Wall -Werror -static -I/tmp/include /build/_const.go
package unix package unix

View File

@ -4,7 +4,7 @@
// +build arm64,linux // +build arm64,linux
// Code generated by cmd/cgo -godefs; DO NOT EDIT. // Code generated by cmd/cgo -godefs; DO NOT EDIT.
// cgo -godefs -- -Wall -Werror -static -I/tmp/include -fsigned-char _const.go // cgo -godefs -- -Wall -Werror -static -I/tmp/include -fsigned-char /build/_const.go
package unix package unix
@ -196,6 +196,8 @@ const (
PPPIOCXFERUNIT = 0x744e PPPIOCXFERUNIT = 0x744e
PROT_BTI = 0x10 PROT_BTI = 0x10
PR_SET_PTRACER_ANY = 0xffffffffffffffff PR_SET_PTRACER_ANY = 0xffffffffffffffff
PTRACE_PEEKMTETAGS = 0x21
PTRACE_POKEMTETAGS = 0x22
PTRACE_SYSEMU = 0x1f PTRACE_SYSEMU = 0x1f
PTRACE_SYSEMU_SINGLESTEP = 0x20 PTRACE_SYSEMU_SINGLESTEP = 0x20
RLIMIT_AS = 0x9 RLIMIT_AS = 0x9

View File

@ -4,7 +4,7 @@
// +build mips,linux // +build mips,linux
// Code generated by cmd/cgo -godefs; DO NOT EDIT. // Code generated by cmd/cgo -godefs; DO NOT EDIT.
// cgo -godefs -- -Wall -Werror -static -I/tmp/include _const.go // cgo -godefs -- -Wall -Werror -static -I/tmp/include /build/_const.go
package unix package unix

View File

@ -4,7 +4,7 @@
// +build mips64,linux // +build mips64,linux
// Code generated by cmd/cgo -godefs; DO NOT EDIT. // Code generated by cmd/cgo -godefs; DO NOT EDIT.
// cgo -godefs -- -Wall -Werror -static -I/tmp/include _const.go // cgo -godefs -- -Wall -Werror -static -I/tmp/include /build/_const.go
package unix package unix

View File

@ -4,7 +4,7 @@
// +build mips64le,linux // +build mips64le,linux
// Code generated by cmd/cgo -godefs; DO NOT EDIT. // Code generated by cmd/cgo -godefs; DO NOT EDIT.
// cgo -godefs -- -Wall -Werror -static -I/tmp/include _const.go // cgo -godefs -- -Wall -Werror -static -I/tmp/include /build/_const.go
package unix package unix

View File

@ -4,7 +4,7 @@
// +build mipsle,linux // +build mipsle,linux
// Code generated by cmd/cgo -godefs; DO NOT EDIT. // Code generated by cmd/cgo -godefs; DO NOT EDIT.
// cgo -godefs -- -Wall -Werror -static -I/tmp/include _const.go // cgo -godefs -- -Wall -Werror -static -I/tmp/include /build/_const.go
package unix package unix

View File

@ -4,7 +4,7 @@
// +build ppc64,linux // +build ppc64,linux
// Code generated by cmd/cgo -godefs; DO NOT EDIT. // Code generated by cmd/cgo -godefs; DO NOT EDIT.
// cgo -godefs -- -Wall -Werror -static -I/tmp/include _const.go // cgo -godefs -- -Wall -Werror -static -I/tmp/include /build/_const.go
package unix package unix

Some files were not shown because too many files have changed in this diff Show More