forked from cerc-io/plugeth
vendor: update syscalls dependency
This commit is contained in:
parent
ba90a4aaa4
commit
dcc045f03c
51
vendor/golang.org/x/sys/cpu/cpu.go
generated
vendored
51
vendor/golang.org/x/sys/cpu/cpu.go
generated
vendored
@ -29,6 +29,8 @@ var X86 struct {
|
||||
HasOSXSAVE bool // OS supports XSAVE/XRESTOR for saving/restoring XMM registers.
|
||||
HasPCLMULQDQ bool // PCLMULQDQ instruction - most often used for AES-GCM
|
||||
HasPOPCNT bool // Hamming weight instruction POPCNT.
|
||||
HasRDRAND bool // RDRAND instruction (on-chip random number generator)
|
||||
HasRDSEED bool // RDSEED instruction (on-chip random number generator)
|
||||
HasSSE2 bool // Streaming SIMD extension 2 (always available on amd64)
|
||||
HasSSE3 bool // Streaming SIMD extension 3
|
||||
HasSSSE3 bool // Supplemental streaming SIMD extension 3
|
||||
@ -36,3 +38,52 @@ var X86 struct {
|
||||
HasSSE42 bool // Streaming SIMD extension 4 and 4.2
|
||||
_ CacheLinePad
|
||||
}
|
||||
|
||||
// ARM64 contains the supported CPU features of the
|
||||
// current ARMv8(aarch64) platform. If the current platform
|
||||
// is not arm64 then all feature flags are false.
|
||||
var ARM64 struct {
|
||||
_ CacheLinePad
|
||||
HasFP bool // Floating-point instruction set (always available)
|
||||
HasASIMD bool // Advanced SIMD (always available)
|
||||
HasEVTSTRM bool // Event stream support
|
||||
HasAES bool // AES hardware implementation
|
||||
HasPMULL bool // Polynomial multiplication instruction set
|
||||
HasSHA1 bool // SHA1 hardware implementation
|
||||
HasSHA2 bool // SHA2 hardware implementation
|
||||
HasCRC32 bool // CRC32 hardware implementation
|
||||
HasATOMICS bool // Atomic memory operation instruction set
|
||||
HasFPHP bool // Half precision floating-point instruction set
|
||||
HasASIMDHP bool // Advanced SIMD half precision instruction set
|
||||
HasCPUID bool // CPUID identification scheme registers
|
||||
HasASIMDRDM bool // Rounding double multiply add/subtract instruction set
|
||||
HasJSCVT bool // Javascript conversion from floating-point to integer
|
||||
HasFCMA bool // Floating-point multiplication and addition of complex numbers
|
||||
HasLRCPC bool // Release Consistent processor consistent support
|
||||
HasDCPOP bool // Persistent memory support
|
||||
HasSHA3 bool // SHA3 hardware implementation
|
||||
HasSM3 bool // SM3 hardware implementation
|
||||
HasSM4 bool // SM4 hardware implementation
|
||||
HasASIMDDP bool // Advanced SIMD double precision instruction set
|
||||
HasSHA512 bool // SHA512 hardware implementation
|
||||
HasSVE bool // Scalable Vector Extensions
|
||||
HasASIMDFHM bool // Advanced SIMD multiplication FP16 to FP32
|
||||
_ CacheLinePad
|
||||
}
|
||||
|
||||
// PPC64 contains the supported CPU features of the current ppc64/ppc64le platforms.
|
||||
// If the current platform is not ppc64/ppc64le then all feature flags are false.
|
||||
//
|
||||
// For ppc64/ppc64le, it is safe to check only for ISA level starting on ISA v3.00,
|
||||
// since there are no optional categories. There are some exceptions that also
|
||||
// require kernel support to work (DARN, SCV), so there are feature bits for
|
||||
// those as well. The minimum processor requirement is POWER8 (ISA 2.07).
|
||||
// The struct is padded to avoid false sharing.
|
||||
var PPC64 struct {
|
||||
_ CacheLinePad
|
||||
HasDARN bool // Hardware random number generator (requires kernel enablement)
|
||||
HasSCV bool // Syscall vectored (requires kernel enablement)
|
||||
IsPOWER8 bool // ISA v2.07 (POWER8)
|
||||
IsPOWER9 bool // ISA v3.00 (POWER9)
|
||||
_ CacheLinePad
|
||||
}
|
||||
|
2
vendor/golang.org/x/sys/cpu/cpu_arm.go
generated
vendored
2
vendor/golang.org/x/sys/cpu/cpu_arm.go
generated
vendored
@ -5,3 +5,5 @@
|
||||
package cpu
|
||||
|
||||
const cacheLineSize = 32
|
||||
|
||||
func doinit() {}
|
||||
|
60
vendor/golang.org/x/sys/cpu/cpu_arm64.go
generated
vendored
60
vendor/golang.org/x/sys/cpu/cpu_arm64.go
generated
vendored
@ -5,3 +5,63 @@
|
||||
package cpu
|
||||
|
||||
const cacheLineSize = 64
|
||||
|
||||
// HWCAP/HWCAP2 bits. These are exposed by Linux.
|
||||
const (
|
||||
hwcap_FP = 1 << 0
|
||||
hwcap_ASIMD = 1 << 1
|
||||
hwcap_EVTSTRM = 1 << 2
|
||||
hwcap_AES = 1 << 3
|
||||
hwcap_PMULL = 1 << 4
|
||||
hwcap_SHA1 = 1 << 5
|
||||
hwcap_SHA2 = 1 << 6
|
||||
hwcap_CRC32 = 1 << 7
|
||||
hwcap_ATOMICS = 1 << 8
|
||||
hwcap_FPHP = 1 << 9
|
||||
hwcap_ASIMDHP = 1 << 10
|
||||
hwcap_CPUID = 1 << 11
|
||||
hwcap_ASIMDRDM = 1 << 12
|
||||
hwcap_JSCVT = 1 << 13
|
||||
hwcap_FCMA = 1 << 14
|
||||
hwcap_LRCPC = 1 << 15
|
||||
hwcap_DCPOP = 1 << 16
|
||||
hwcap_SHA3 = 1 << 17
|
||||
hwcap_SM3 = 1 << 18
|
||||
hwcap_SM4 = 1 << 19
|
||||
hwcap_ASIMDDP = 1 << 20
|
||||
hwcap_SHA512 = 1 << 21
|
||||
hwcap_SVE = 1 << 22
|
||||
hwcap_ASIMDFHM = 1 << 23
|
||||
)
|
||||
|
||||
func doinit() {
|
||||
// HWCAP feature bits
|
||||
ARM64.HasFP = isSet(HWCap, hwcap_FP)
|
||||
ARM64.HasASIMD = isSet(HWCap, hwcap_ASIMD)
|
||||
ARM64.HasEVTSTRM = isSet(HWCap, hwcap_EVTSTRM)
|
||||
ARM64.HasAES = isSet(HWCap, hwcap_AES)
|
||||
ARM64.HasPMULL = isSet(HWCap, hwcap_PMULL)
|
||||
ARM64.HasSHA1 = isSet(HWCap, hwcap_SHA1)
|
||||
ARM64.HasSHA2 = isSet(HWCap, hwcap_SHA2)
|
||||
ARM64.HasCRC32 = isSet(HWCap, hwcap_CRC32)
|
||||
ARM64.HasATOMICS = isSet(HWCap, hwcap_ATOMICS)
|
||||
ARM64.HasFPHP = isSet(HWCap, hwcap_FPHP)
|
||||
ARM64.HasASIMDHP = isSet(HWCap, hwcap_ASIMDHP)
|
||||
ARM64.HasCPUID = isSet(HWCap, hwcap_CPUID)
|
||||
ARM64.HasASIMDRDM = isSet(HWCap, hwcap_ASIMDRDM)
|
||||
ARM64.HasJSCVT = isSet(HWCap, hwcap_JSCVT)
|
||||
ARM64.HasFCMA = isSet(HWCap, hwcap_FCMA)
|
||||
ARM64.HasLRCPC = isSet(HWCap, hwcap_LRCPC)
|
||||
ARM64.HasDCPOP = isSet(HWCap, hwcap_DCPOP)
|
||||
ARM64.HasSHA3 = isSet(HWCap, hwcap_SHA3)
|
||||
ARM64.HasSM3 = isSet(HWCap, hwcap_SM3)
|
||||
ARM64.HasSM4 = isSet(HWCap, hwcap_SM4)
|
||||
ARM64.HasASIMDDP = isSet(HWCap, hwcap_ASIMDDP)
|
||||
ARM64.HasSHA512 = isSet(HWCap, hwcap_SHA512)
|
||||
ARM64.HasSVE = isSet(HWCap, hwcap_SVE)
|
||||
ARM64.HasASIMDFHM = isSet(HWCap, hwcap_ASIMDFHM)
|
||||
}
|
||||
|
||||
func isSet(hwc uint, value uint) bool {
|
||||
return hwc&value != 0
|
||||
}
|
||||
|
61
vendor/golang.org/x/sys/cpu/cpu_linux.go
generated
vendored
Normal file
61
vendor/golang.org/x/sys/cpu/cpu_linux.go
generated
vendored
Normal file
@ -0,0 +1,61 @@
|
||||
// Copyright 2018 The Go Authors. All rights reserved.
|
||||
// Use of this source code is governed by a BSD-style
|
||||
// license that can be found in the LICENSE file.
|
||||
|
||||
//+build !amd64,!amd64p32,!386
|
||||
|
||||
package cpu
|
||||
|
||||
import (
|
||||
"encoding/binary"
|
||||
"io/ioutil"
|
||||
"runtime"
|
||||
)
|
||||
|
||||
const (
|
||||
_AT_HWCAP = 16
|
||||
_AT_HWCAP2 = 26
|
||||
|
||||
procAuxv = "/proc/self/auxv"
|
||||
|
||||
uintSize uint = 32 << (^uint(0) >> 63)
|
||||
)
|
||||
|
||||
// For those platforms don't have a 'cpuid' equivalent we use HWCAP/HWCAP2
|
||||
// These are initialized in cpu_$GOARCH.go
|
||||
// and should not be changed after they are initialized.
|
||||
var HWCap uint
|
||||
var HWCap2 uint
|
||||
|
||||
func init() {
|
||||
buf, err := ioutil.ReadFile(procAuxv)
|
||||
if err != nil {
|
||||
panic("read proc auxv failed: " + err.Error())
|
||||
}
|
||||
|
||||
pb := int(uintSize / 8)
|
||||
|
||||
for i := 0; i < len(buf)-pb*2; i += pb * 2 {
|
||||
var tag, val uint
|
||||
switch uintSize {
|
||||
case 32:
|
||||
tag = uint(binary.LittleEndian.Uint32(buf[i:]))
|
||||
val = uint(binary.LittleEndian.Uint32(buf[i+pb:]))
|
||||
case 64:
|
||||
if runtime.GOARCH == "ppc64" {
|
||||
tag = uint(binary.BigEndian.Uint64(buf[i:]))
|
||||
val = uint(binary.BigEndian.Uint64(buf[i+pb:]))
|
||||
} else {
|
||||
tag = uint(binary.LittleEndian.Uint64(buf[i:]))
|
||||
val = uint(binary.LittleEndian.Uint64(buf[i+pb:]))
|
||||
}
|
||||
}
|
||||
switch tag {
|
||||
case _AT_HWCAP:
|
||||
HWCap = val
|
||||
case _AT_HWCAP2:
|
||||
HWCap2 = val
|
||||
}
|
||||
}
|
||||
doinit()
|
||||
}
|
2
vendor/golang.org/x/sys/cpu/cpu_mips64x.go
generated
vendored
2
vendor/golang.org/x/sys/cpu/cpu_mips64x.go
generated
vendored
@ -7,3 +7,5 @@
|
||||
package cpu
|
||||
|
||||
const cacheLineSize = 32
|
||||
|
||||
func doinit() {}
|
||||
|
2
vendor/golang.org/x/sys/cpu/cpu_mipsx.go
generated
vendored
2
vendor/golang.org/x/sys/cpu/cpu_mipsx.go
generated
vendored
@ -7,3 +7,5 @@
|
||||
package cpu
|
||||
|
||||
const cacheLineSize = 32
|
||||
|
||||
func doinit() {}
|
||||
|
23
vendor/golang.org/x/sys/cpu/cpu_ppc64x.go
generated
vendored
23
vendor/golang.org/x/sys/cpu/cpu_ppc64x.go
generated
vendored
@ -7,3 +7,26 @@
|
||||
package cpu
|
||||
|
||||
const cacheLineSize = 128
|
||||
|
||||
// HWCAP/HWCAP2 bits. These are exposed by the kernel.
|
||||
const (
|
||||
// ISA Level
|
||||
_PPC_FEATURE2_ARCH_2_07 = 0x80000000
|
||||
_PPC_FEATURE2_ARCH_3_00 = 0x00800000
|
||||
|
||||
// CPU features
|
||||
_PPC_FEATURE2_DARN = 0x00200000
|
||||
_PPC_FEATURE2_SCV = 0x00100000
|
||||
)
|
||||
|
||||
func doinit() {
|
||||
// HWCAP2 feature bits
|
||||
PPC64.IsPOWER8 = isSet(HWCap2, _PPC_FEATURE2_ARCH_2_07)
|
||||
PPC64.IsPOWER9 = isSet(HWCap2, _PPC_FEATURE2_ARCH_3_00)
|
||||
PPC64.HasDARN = isSet(HWCap2, _PPC_FEATURE2_DARN)
|
||||
PPC64.HasSCV = isSet(HWCap2, _PPC_FEATURE2_SCV)
|
||||
}
|
||||
|
||||
func isSet(hwc uint, value uint) bool {
|
||||
return hwc&value != 0
|
||||
}
|
||||
|
2
vendor/golang.org/x/sys/cpu/cpu_s390x.go
generated
vendored
2
vendor/golang.org/x/sys/cpu/cpu_s390x.go
generated
vendored
@ -5,3 +5,5 @@
|
||||
package cpu
|
||||
|
||||
const cacheLineSize = 256
|
||||
|
||||
func doinit() {}
|
||||
|
2
vendor/golang.org/x/sys/cpu/cpu_x86.go
generated
vendored
2
vendor/golang.org/x/sys/cpu/cpu_x86.go
generated
vendored
@ -27,6 +27,7 @@ func init() {
|
||||
X86.HasPOPCNT = isSet(23, ecx1)
|
||||
X86.HasAES = isSet(25, ecx1)
|
||||
X86.HasOSXSAVE = isSet(27, ecx1)
|
||||
X86.HasRDRAND = isSet(30, ecx1)
|
||||
|
||||
osSupportsAVX := false
|
||||
// For XGETBV, OSXSAVE bit is required and sufficient.
|
||||
@ -47,6 +48,7 @@ func init() {
|
||||
X86.HasAVX2 = isSet(5, ebx7) && osSupportsAVX
|
||||
X86.HasBMI2 = isSet(8, ebx7)
|
||||
X86.HasERMS = isSet(9, ebx7)
|
||||
X86.HasRDSEED = isSet(18, ebx7)
|
||||
X86.HasADX = isSet(19, ebx7)
|
||||
}
|
||||
|
||||
|
20
vendor/golang.org/x/sys/unix/README.md
generated
vendored
20
vendor/golang.org/x/sys/unix/README.md
generated
vendored
@ -14,7 +14,7 @@ migrating the build system to use containers so the builds are reproducible.
|
||||
This is being done on an OS-by-OS basis. Please update this documentation as
|
||||
components of the build system change.
|
||||
|
||||
### Old Build System (currently for `GOOS != "Linux" || GOARCH == "sparc64"`)
|
||||
### Old Build System (currently for `GOOS != "linux"`)
|
||||
|
||||
The old build system generates the Go files based on the C header files
|
||||
present on your system. This means that files
|
||||
@ -32,9 +32,9 @@ To build the files for your current OS and architecture, make sure GOOS and
|
||||
GOARCH are set correctly and run `mkall.sh`. This will generate the files for
|
||||
your specific system. Running `mkall.sh -n` shows the commands that will be run.
|
||||
|
||||
Requirements: bash, perl, go
|
||||
Requirements: bash, go
|
||||
|
||||
### New Build System (currently for `GOOS == "Linux" && GOARCH != "sparc64"`)
|
||||
### New Build System (currently for `GOOS == "linux"`)
|
||||
|
||||
The new build system uses a Docker container to generate the go files directly
|
||||
from source checkouts of the kernel and various system libraries. This means
|
||||
@ -52,14 +52,14 @@ system and have your GOOS and GOARCH set accordingly. Running `mkall.sh` will
|
||||
then generate all of the files for all of the GOOS/GOARCH pairs in the new build
|
||||
system. Running `mkall.sh -n` shows the commands that will be run.
|
||||
|
||||
Requirements: bash, perl, go, docker
|
||||
Requirements: bash, go, docker
|
||||
|
||||
## Component files
|
||||
|
||||
This section describes the various files used in the code generation process.
|
||||
It also contains instructions on how to modify these files to add a new
|
||||
architecture/OS or to add additional syscalls, types, or constants. Note that
|
||||
if you are using the new build system, the scripts cannot be called normally.
|
||||
if you are using the new build system, the scripts/programs cannot be called normally.
|
||||
They must be called from within the docker container.
|
||||
|
||||
### asm files
|
||||
@ -81,8 +81,8 @@ each GOOS/GOARCH pair.
|
||||
|
||||
### mksysnum
|
||||
|
||||
Mksysnum is a script located at `${GOOS}/mksysnum.pl` (or `mksysnum_${GOOS}.pl`
|
||||
for the old system). This script takes in a list of header files containing the
|
||||
Mksysnum is a Go program located at `${GOOS}/mksysnum.go` (or `mksysnum_${GOOS}.go`
|
||||
for the old system). This program takes in a list of header files containing the
|
||||
syscall number declarations and parses them to produce the corresponding list of
|
||||
Go numeric constants. See `zsysnum_${GOOS}_${GOARCH}.go` for the generated
|
||||
constants.
|
||||
@ -92,14 +92,14 @@ new installation of the target OS (or updating the source checkouts for the
|
||||
new build system). However, depending on the OS, you make need to update the
|
||||
parsing in mksysnum.
|
||||
|
||||
### mksyscall.pl
|
||||
### mksyscall.go
|
||||
|
||||
The `syscall.go`, `syscall_${GOOS}.go`, `syscall_${GOOS}_${GOARCH}.go` are
|
||||
hand-written Go files which implement system calls (for unix, the specific OS,
|
||||
or the specific OS/Architecture pair respectively) that need special handling
|
||||
and list `//sys` comments giving prototypes for ones that can be generated.
|
||||
|
||||
The mksyscall.pl script takes the `//sys` and `//sysnb` comments and converts
|
||||
The mksyscall.go program takes the `//sys` and `//sysnb` comments and converts
|
||||
them into syscalls. This requires the name of the prototype in the comment to
|
||||
match a syscall number in the `zsysnum_${GOOS}_${GOARCH}.go` file. The function
|
||||
prototype can be exported (capitalized) or not.
|
||||
@ -160,7 +160,7 @@ signal numbers, and constants. Generated by `mkerrors.sh` (see above).
|
||||
### `zsyscall_${GOOS}_${GOARCH}.go`
|
||||
|
||||
A file containing all the generated syscalls for a specific GOOS and GOARCH.
|
||||
Generated by `mksyscall.pl` (see above).
|
||||
Generated by `mksyscall.go` (see above).
|
||||
|
||||
### `zsysnum_${GOOS}_${GOARCH}.go`
|
||||
|
||||
|
124
vendor/golang.org/x/sys/unix/affinity_linux.go
generated
vendored
Normal file
124
vendor/golang.org/x/sys/unix/affinity_linux.go
generated
vendored
Normal file
@ -0,0 +1,124 @@
|
||||
// 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.
|
||||
|
||||
// CPU affinity functions
|
||||
|
||||
package unix
|
||||
|
||||
import (
|
||||
"unsafe"
|
||||
)
|
||||
|
||||
const cpuSetSize = _CPU_SETSIZE / _NCPUBITS
|
||||
|
||||
// CPUSet represents a CPU affinity mask.
|
||||
type CPUSet [cpuSetSize]cpuMask
|
||||
|
||||
func schedAffinity(trap uintptr, pid int, set *CPUSet) error {
|
||||
_, _, e := RawSyscall(trap, uintptr(pid), uintptr(unsafe.Sizeof(*set)), uintptr(unsafe.Pointer(set)))
|
||||
if e != 0 {
|
||||
return errnoErr(e)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// SchedGetaffinity gets the CPU affinity mask of the thread specified by pid.
|
||||
// If pid is 0 the calling thread is used.
|
||||
func SchedGetaffinity(pid int, set *CPUSet) error {
|
||||
return schedAffinity(SYS_SCHED_GETAFFINITY, pid, set)
|
||||
}
|
||||
|
||||
// SchedSetaffinity sets the CPU affinity mask of the thread specified by pid.
|
||||
// If pid is 0 the calling thread is used.
|
||||
func SchedSetaffinity(pid int, set *CPUSet) error {
|
||||
return schedAffinity(SYS_SCHED_SETAFFINITY, pid, set)
|
||||
}
|
||||
|
||||
// Zero clears the set s, so that it contains no CPUs.
|
||||
func (s *CPUSet) Zero() {
|
||||
for i := range s {
|
||||
s[i] = 0
|
||||
}
|
||||
}
|
||||
|
||||
func cpuBitsIndex(cpu int) int {
|
||||
return cpu / _NCPUBITS
|
||||
}
|
||||
|
||||
func cpuBitsMask(cpu int) cpuMask {
|
||||
return cpuMask(1 << (uint(cpu) % _NCPUBITS))
|
||||
}
|
||||
|
||||
// Set adds cpu to the set s.
|
||||
func (s *CPUSet) Set(cpu int) {
|
||||
i := cpuBitsIndex(cpu)
|
||||
if i < len(s) {
|
||||
s[i] |= cpuBitsMask(cpu)
|
||||
}
|
||||
}
|
||||
|
||||
// Clear removes cpu from the set s.
|
||||
func (s *CPUSet) Clear(cpu int) {
|
||||
i := cpuBitsIndex(cpu)
|
||||
if i < len(s) {
|
||||
s[i] &^= cpuBitsMask(cpu)
|
||||
}
|
||||
}
|
||||
|
||||
// IsSet reports whether cpu is in the set s.
|
||||
func (s *CPUSet) IsSet(cpu int) bool {
|
||||
i := cpuBitsIndex(cpu)
|
||||
if i < len(s) {
|
||||
return s[i]&cpuBitsMask(cpu) != 0
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
// Count returns the number of CPUs in the set s.
|
||||
func (s *CPUSet) Count() int {
|
||||
c := 0
|
||||
for _, b := range s {
|
||||
c += onesCount64(uint64(b))
|
||||
}
|
||||
return c
|
||||
}
|
||||
|
||||
// onesCount64 is a copy of Go 1.9's math/bits.OnesCount64.
|
||||
// Once this package can require Go 1.9, we can delete this
|
||||
// and update the caller to use bits.OnesCount64.
|
||||
func onesCount64(x uint64) int {
|
||||
const m0 = 0x5555555555555555 // 01010101 ...
|
||||
const m1 = 0x3333333333333333 // 00110011 ...
|
||||
const m2 = 0x0f0f0f0f0f0f0f0f // 00001111 ...
|
||||
const m3 = 0x00ff00ff00ff00ff // etc.
|
||||
const m4 = 0x0000ffff0000ffff
|
||||
|
||||
// Implementation: Parallel summing of adjacent bits.
|
||||
// See "Hacker's Delight", Chap. 5: Counting Bits.
|
||||
// The following pattern shows the general approach:
|
||||
//
|
||||
// x = x>>1&(m0&m) + x&(m0&m)
|
||||
// x = x>>2&(m1&m) + x&(m1&m)
|
||||
// x = x>>4&(m2&m) + x&(m2&m)
|
||||
// x = x>>8&(m3&m) + x&(m3&m)
|
||||
// x = x>>16&(m4&m) + x&(m4&m)
|
||||
// x = x>>32&(m5&m) + x&(m5&m)
|
||||
// return int(x)
|
||||
//
|
||||
// Masking (& operations) can be left away when there's no
|
||||
// danger that a field's sum will carry over into the next
|
||||
// field: Since the result cannot be > 64, 8 bits is enough
|
||||
// and we can ignore the masks for the shifts by 8 and up.
|
||||
// Per "Hacker's Delight", the first line can be simplified
|
||||
// more, but it saves at best one instruction, so we leave
|
||||
// it alone for clarity.
|
||||
const m = 1<<64 - 1
|
||||
x = x>>1&(m0&m) + x&(m0&m)
|
||||
x = x>>2&(m1&m) + x&(m1&m)
|
||||
x = (x>>4 + x) & (m2 & m)
|
||||
x += x >> 8
|
||||
x += x >> 16
|
||||
x += x >> 32
|
||||
return int(x) & (1<<7 - 1)
|
||||
}
|
14
vendor/golang.org/x/sys/unix/aliases.go
generated
vendored
Normal file
14
vendor/golang.org/x/sys/unix/aliases.go
generated
vendored
Normal file
@ -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.
|
||||
|
||||
// +build aix darwin dragonfly freebsd linux netbsd openbsd solaris
|
||||
// +build go1.9
|
||||
|
||||
package unix
|
||||
|
||||
import "syscall"
|
||||
|
||||
type Signal = syscall.Signal
|
||||
type Errno = syscall.Errno
|
||||
type SysProcAttr = syscall.SysProcAttr
|
17
vendor/golang.org/x/sys/unix/asm_aix_ppc64.s
generated
vendored
Normal file
17
vendor/golang.org/x/sys/unix/asm_aix_ppc64.s
generated
vendored
Normal file
@ -0,0 +1,17 @@
|
||||
// Copyright 2018 The Go Authors. All rights reserved.
|
||||
// Use of this source code is governed by a BSD-style
|
||||
// license that can be found in the LICENSE file.
|
||||
|
||||
// +build !gccgo
|
||||
|
||||
#include "textflag.h"
|
||||
|
||||
//
|
||||
// System calls for ppc64, AIX are implemented in runtime/syscall_aix.go
|
||||
//
|
||||
|
||||
TEXT ·syscall6(SB),NOSPLIT,$0-88
|
||||
JMP syscall·syscall6(SB)
|
||||
|
||||
TEXT ·rawSyscall6(SB),NOSPLIT,$0-88
|
||||
JMP syscall·rawSyscall6(SB)
|
10
vendor/golang.org/x/sys/unix/asm_dragonfly_amd64.s
generated
vendored
10
vendor/golang.org/x/sys/unix/asm_dragonfly_amd64.s
generated
vendored
@ -13,17 +13,17 @@
|
||||
// Just jump to package syscall's implementation for all these functions.
|
||||
// The runtime may know about them.
|
||||
|
||||
TEXT ·Syscall(SB),NOSPLIT,$0-64
|
||||
TEXT ·Syscall(SB),NOSPLIT,$0-56
|
||||
JMP syscall·Syscall(SB)
|
||||
|
||||
TEXT ·Syscall6(SB),NOSPLIT,$0-88
|
||||
TEXT ·Syscall6(SB),NOSPLIT,$0-80
|
||||
JMP syscall·Syscall6(SB)
|
||||
|
||||
TEXT ·Syscall9(SB),NOSPLIT,$0-112
|
||||
TEXT ·Syscall9(SB),NOSPLIT,$0-104
|
||||
JMP syscall·Syscall9(SB)
|
||||
|
||||
TEXT ·RawSyscall(SB),NOSPLIT,$0-64
|
||||
TEXT ·RawSyscall(SB),NOSPLIT,$0-56
|
||||
JMP syscall·RawSyscall(SB)
|
||||
|
||||
TEXT ·RawSyscall6(SB),NOSPLIT,$0-88
|
||||
TEXT ·RawSyscall6(SB),NOSPLIT,$0-80
|
||||
JMP syscall·RawSyscall6(SB)
|
||||
|
29
vendor/golang.org/x/sys/unix/asm_freebsd_arm64.s
generated
vendored
Normal file
29
vendor/golang.org/x/sys/unix/asm_freebsd_arm64.s
generated
vendored
Normal file
@ -0,0 +1,29 @@
|
||||
// Copyright 2018 The Go Authors. All rights reserved.
|
||||
// Use of this source code is governed by a BSD-style
|
||||
// license that can be found in the LICENSE file.
|
||||
|
||||
// +build !gccgo
|
||||
|
||||
#include "textflag.h"
|
||||
|
||||
//
|
||||
// System call support for ARM64, FreeBSD
|
||||
//
|
||||
|
||||
// Just jump to package syscall's implementation for all these functions.
|
||||
// The runtime may know about them.
|
||||
|
||||
TEXT ·Syscall(SB),NOSPLIT,$0-56
|
||||
JMP syscall·Syscall(SB)
|
||||
|
||||
TEXT ·Syscall6(SB),NOSPLIT,$0-80
|
||||
JMP syscall·Syscall6(SB)
|
||||
|
||||
TEXT ·Syscall9(SB),NOSPLIT,$0-104
|
||||
JMP syscall·Syscall9(SB)
|
||||
|
||||
TEXT ·RawSyscall(SB),NOSPLIT,$0-56
|
||||
JMP syscall·RawSyscall(SB)
|
||||
|
||||
TEXT ·RawSyscall6(SB),NOSPLIT,$0-80
|
||||
JMP syscall·RawSyscall6(SB)
|
36
vendor/golang.org/x/sys/unix/asm_linux_386.s
generated
vendored
36
vendor/golang.org/x/sys/unix/asm_linux_386.s
generated
vendored
@ -10,21 +10,51 @@
|
||||
// System calls for 386, Linux
|
||||
//
|
||||
|
||||
// See ../runtime/sys_linux_386.s for the reason why we always use int 0x80
|
||||
// instead of the glibc-specific "CALL 0x10(GS)".
|
||||
#define INVOKE_SYSCALL INT $0x80
|
||||
|
||||
// Just jump to package syscall's implementation for all these functions.
|
||||
// The runtime may know about them.
|
||||
|
||||
TEXT ·Syscall(SB),NOSPLIT,$0-28
|
||||
TEXT ·Syscall(SB),NOSPLIT,$0-28
|
||||
JMP syscall·Syscall(SB)
|
||||
|
||||
TEXT ·Syscall6(SB),NOSPLIT,$0-40
|
||||
TEXT ·Syscall6(SB),NOSPLIT,$0-40
|
||||
JMP syscall·Syscall6(SB)
|
||||
|
||||
TEXT ·SyscallNoError(SB),NOSPLIT,$0-24
|
||||
CALL runtime·entersyscall(SB)
|
||||
MOVL trap+0(FP), AX // syscall entry
|
||||
MOVL a1+4(FP), BX
|
||||
MOVL a2+8(FP), CX
|
||||
MOVL a3+12(FP), DX
|
||||
MOVL $0, SI
|
||||
MOVL $0, DI
|
||||
INVOKE_SYSCALL
|
||||
MOVL AX, r1+16(FP)
|
||||
MOVL DX, r2+20(FP)
|
||||
CALL runtime·exitsyscall(SB)
|
||||
RET
|
||||
|
||||
TEXT ·RawSyscall(SB),NOSPLIT,$0-28
|
||||
JMP syscall·RawSyscall(SB)
|
||||
|
||||
TEXT ·RawSyscall6(SB),NOSPLIT,$0-40
|
||||
TEXT ·RawSyscall6(SB),NOSPLIT,$0-40
|
||||
JMP syscall·RawSyscall6(SB)
|
||||
|
||||
TEXT ·RawSyscallNoError(SB),NOSPLIT,$0-24
|
||||
MOVL trap+0(FP), AX // syscall entry
|
||||
MOVL a1+4(FP), BX
|
||||
MOVL a2+8(FP), CX
|
||||
MOVL a3+12(FP), DX
|
||||
MOVL $0, SI
|
||||
MOVL $0, DI
|
||||
INVOKE_SYSCALL
|
||||
MOVL AX, r1+16(FP)
|
||||
MOVL DX, r2+20(FP)
|
||||
RET
|
||||
|
||||
TEXT ·socketcall(SB),NOSPLIT,$0-36
|
||||
JMP syscall·socketcall(SB)
|
||||
|
||||
|
30
vendor/golang.org/x/sys/unix/asm_linux_amd64.s
generated
vendored
30
vendor/golang.org/x/sys/unix/asm_linux_amd64.s
generated
vendored
@ -13,17 +13,45 @@
|
||||
// Just jump to package syscall's implementation for all these functions.
|
||||
// The runtime may know about them.
|
||||
|
||||
TEXT ·Syscall(SB),NOSPLIT,$0-56
|
||||
TEXT ·Syscall(SB),NOSPLIT,$0-56
|
||||
JMP syscall·Syscall(SB)
|
||||
|
||||
TEXT ·Syscall6(SB),NOSPLIT,$0-80
|
||||
JMP syscall·Syscall6(SB)
|
||||
|
||||
TEXT ·SyscallNoError(SB),NOSPLIT,$0-48
|
||||
CALL runtime·entersyscall(SB)
|
||||
MOVQ a1+8(FP), DI
|
||||
MOVQ a2+16(FP), SI
|
||||
MOVQ a3+24(FP), DX
|
||||
MOVQ $0, R10
|
||||
MOVQ $0, R8
|
||||
MOVQ $0, R9
|
||||
MOVQ trap+0(FP), AX // syscall entry
|
||||
SYSCALL
|
||||
MOVQ AX, r1+32(FP)
|
||||
MOVQ DX, r2+40(FP)
|
||||
CALL runtime·exitsyscall(SB)
|
||||
RET
|
||||
|
||||
TEXT ·RawSyscall(SB),NOSPLIT,$0-56
|
||||
JMP syscall·RawSyscall(SB)
|
||||
|
||||
TEXT ·RawSyscall6(SB),NOSPLIT,$0-80
|
||||
JMP syscall·RawSyscall6(SB)
|
||||
|
||||
TEXT ·RawSyscallNoError(SB),NOSPLIT,$0-48
|
||||
MOVQ a1+8(FP), DI
|
||||
MOVQ a2+16(FP), SI
|
||||
MOVQ a3+24(FP), DX
|
||||
MOVQ $0, R10
|
||||
MOVQ $0, R8
|
||||
MOVQ $0, R9
|
||||
MOVQ trap+0(FP), AX // syscall entry
|
||||
SYSCALL
|
||||
MOVQ AX, r1+32(FP)
|
||||
MOVQ DX, r2+40(FP)
|
||||
RET
|
||||
|
||||
TEXT ·gettimeofday(SB),NOSPLIT,$0-16
|
||||
JMP syscall·gettimeofday(SB)
|
||||
|
35
vendor/golang.org/x/sys/unix/asm_linux_arm.s
generated
vendored
35
vendor/golang.org/x/sys/unix/asm_linux_arm.s
generated
vendored
@ -13,17 +13,44 @@
|
||||
// Just jump to package syscall's implementation for all these functions.
|
||||
// The runtime may know about them.
|
||||
|
||||
TEXT ·Syscall(SB),NOSPLIT,$0-28
|
||||
TEXT ·Syscall(SB),NOSPLIT,$0-28
|
||||
B syscall·Syscall(SB)
|
||||
|
||||
TEXT ·Syscall6(SB),NOSPLIT,$0-40
|
||||
TEXT ·Syscall6(SB),NOSPLIT,$0-40
|
||||
B syscall·Syscall6(SB)
|
||||
|
||||
TEXT ·SyscallNoError(SB),NOSPLIT,$0-24
|
||||
BL runtime·entersyscall(SB)
|
||||
MOVW trap+0(FP), R7
|
||||
MOVW a1+4(FP), R0
|
||||
MOVW a2+8(FP), R1
|
||||
MOVW a3+12(FP), R2
|
||||
MOVW $0, R3
|
||||
MOVW $0, R4
|
||||
MOVW $0, R5
|
||||
SWI $0
|
||||
MOVW R0, r1+16(FP)
|
||||
MOVW $0, R0
|
||||
MOVW R0, r2+20(FP)
|
||||
BL runtime·exitsyscall(SB)
|
||||
RET
|
||||
|
||||
TEXT ·RawSyscall(SB),NOSPLIT,$0-28
|
||||
B syscall·RawSyscall(SB)
|
||||
|
||||
TEXT ·RawSyscall6(SB),NOSPLIT,$0-40
|
||||
TEXT ·RawSyscall6(SB),NOSPLIT,$0-40
|
||||
B syscall·RawSyscall6(SB)
|
||||
|
||||
TEXT ·seek(SB),NOSPLIT,$0-32
|
||||
TEXT ·RawSyscallNoError(SB),NOSPLIT,$0-24
|
||||
MOVW trap+0(FP), R7 // syscall entry
|
||||
MOVW a1+4(FP), R0
|
||||
MOVW a2+8(FP), R1
|
||||
MOVW a3+12(FP), R2
|
||||
SWI $0
|
||||
MOVW R0, r1+16(FP)
|
||||
MOVW $0, R0
|
||||
MOVW R0, r2+20(FP)
|
||||
RET
|
||||
|
||||
TEXT ·seek(SB),NOSPLIT,$0-28
|
||||
B syscall·seek(SB)
|
||||
|
30
vendor/golang.org/x/sys/unix/asm_linux_arm64.s
generated
vendored
30
vendor/golang.org/x/sys/unix/asm_linux_arm64.s
generated
vendored
@ -11,14 +11,42 @@
|
||||
// Just jump to package syscall's implementation for all these functions.
|
||||
// The runtime may know about them.
|
||||
|
||||
TEXT ·Syscall(SB),NOSPLIT,$0-56
|
||||
TEXT ·Syscall(SB),NOSPLIT,$0-56
|
||||
B syscall·Syscall(SB)
|
||||
|
||||
TEXT ·Syscall6(SB),NOSPLIT,$0-80
|
||||
B syscall·Syscall6(SB)
|
||||
|
||||
TEXT ·SyscallNoError(SB),NOSPLIT,$0-48
|
||||
BL runtime·entersyscall(SB)
|
||||
MOVD a1+8(FP), R0
|
||||
MOVD a2+16(FP), R1
|
||||
MOVD a3+24(FP), R2
|
||||
MOVD $0, R3
|
||||
MOVD $0, R4
|
||||
MOVD $0, R5
|
||||
MOVD trap+0(FP), R8 // syscall entry
|
||||
SVC
|
||||
MOVD R0, r1+32(FP) // r1
|
||||
MOVD R1, r2+40(FP) // r2
|
||||
BL runtime·exitsyscall(SB)
|
||||
RET
|
||||
|
||||
TEXT ·RawSyscall(SB),NOSPLIT,$0-56
|
||||
B syscall·RawSyscall(SB)
|
||||
|
||||
TEXT ·RawSyscall6(SB),NOSPLIT,$0-80
|
||||
B syscall·RawSyscall6(SB)
|
||||
|
||||
TEXT ·RawSyscallNoError(SB),NOSPLIT,$0-48
|
||||
MOVD a1+8(FP), R0
|
||||
MOVD a2+16(FP), R1
|
||||
MOVD a3+24(FP), R2
|
||||
MOVD $0, R3
|
||||
MOVD $0, R4
|
||||
MOVD $0, R5
|
||||
MOVD trap+0(FP), R8 // syscall entry
|
||||
SVC
|
||||
MOVD R0, r1+32(FP)
|
||||
MOVD R1, r2+40(FP)
|
||||
RET
|
||||
|
36
vendor/golang.org/x/sys/unix/asm_linux_mips64x.s
generated
vendored
36
vendor/golang.org/x/sys/unix/asm_linux_mips64x.s
generated
vendored
@ -15,14 +15,42 @@
|
||||
// Just jump to package syscall's implementation for all these functions.
|
||||
// The runtime may know about them.
|
||||
|
||||
TEXT ·Syscall(SB),NOSPLIT,$0-56
|
||||
TEXT ·Syscall(SB),NOSPLIT,$0-56
|
||||
JMP syscall·Syscall(SB)
|
||||
|
||||
TEXT ·Syscall6(SB),NOSPLIT,$0-80
|
||||
TEXT ·Syscall6(SB),NOSPLIT,$0-80
|
||||
JMP syscall·Syscall6(SB)
|
||||
|
||||
TEXT ·RawSyscall(SB),NOSPLIT,$0-56
|
||||
TEXT ·SyscallNoError(SB),NOSPLIT,$0-48
|
||||
JAL runtime·entersyscall(SB)
|
||||
MOVV a1+8(FP), R4
|
||||
MOVV a2+16(FP), R5
|
||||
MOVV a3+24(FP), R6
|
||||
MOVV R0, R7
|
||||
MOVV R0, R8
|
||||
MOVV R0, R9
|
||||
MOVV trap+0(FP), R2 // syscall entry
|
||||
SYSCALL
|
||||
MOVV R2, r1+32(FP)
|
||||
MOVV R3, r2+40(FP)
|
||||
JAL runtime·exitsyscall(SB)
|
||||
RET
|
||||
|
||||
TEXT ·RawSyscall(SB),NOSPLIT,$0-56
|
||||
JMP syscall·RawSyscall(SB)
|
||||
|
||||
TEXT ·RawSyscall6(SB),NOSPLIT,$0-80
|
||||
TEXT ·RawSyscall6(SB),NOSPLIT,$0-80
|
||||
JMP syscall·RawSyscall6(SB)
|
||||
|
||||
TEXT ·RawSyscallNoError(SB),NOSPLIT,$0-48
|
||||
MOVV a1+8(FP), R4
|
||||
MOVV a2+16(FP), R5
|
||||
MOVV a3+24(FP), R6
|
||||
MOVV R0, R7
|
||||
MOVV R0, R8
|
||||
MOVV R0, R9
|
||||
MOVV trap+0(FP), R2 // syscall entry
|
||||
SYSCALL
|
||||
MOVV R2, r1+32(FP)
|
||||
MOVV R3, r2+40(FP)
|
||||
RET
|
||||
|
33
vendor/golang.org/x/sys/unix/asm_linux_mipsx.s
generated
vendored
33
vendor/golang.org/x/sys/unix/asm_linux_mipsx.s
generated
vendored
@ -15,17 +15,40 @@
|
||||
// Just jump to package syscall's implementation for all these functions.
|
||||
// The runtime may know about them.
|
||||
|
||||
TEXT ·Syscall(SB),NOSPLIT,$0-28
|
||||
TEXT ·Syscall(SB),NOSPLIT,$0-28
|
||||
JMP syscall·Syscall(SB)
|
||||
|
||||
TEXT ·Syscall6(SB),NOSPLIT,$0-40
|
||||
TEXT ·Syscall6(SB),NOSPLIT,$0-40
|
||||
JMP syscall·Syscall6(SB)
|
||||
|
||||
TEXT ·Syscall9(SB),NOSPLIT,$0-52
|
||||
TEXT ·Syscall9(SB),NOSPLIT,$0-52
|
||||
JMP syscall·Syscall9(SB)
|
||||
|
||||
TEXT ·RawSyscall(SB),NOSPLIT,$0-28
|
||||
TEXT ·SyscallNoError(SB),NOSPLIT,$0-24
|
||||
JAL runtime·entersyscall(SB)
|
||||
MOVW a1+4(FP), R4
|
||||
MOVW a2+8(FP), R5
|
||||
MOVW a3+12(FP), R6
|
||||
MOVW R0, R7
|
||||
MOVW trap+0(FP), R2 // syscall entry
|
||||
SYSCALL
|
||||
MOVW R2, r1+16(FP) // r1
|
||||
MOVW R3, r2+20(FP) // r2
|
||||
JAL runtime·exitsyscall(SB)
|
||||
RET
|
||||
|
||||
TEXT ·RawSyscall(SB),NOSPLIT,$0-28
|
||||
JMP syscall·RawSyscall(SB)
|
||||
|
||||
TEXT ·RawSyscall6(SB),NOSPLIT,$0-40
|
||||
TEXT ·RawSyscall6(SB),NOSPLIT,$0-40
|
||||
JMP syscall·RawSyscall6(SB)
|
||||
|
||||
TEXT ·RawSyscallNoError(SB),NOSPLIT,$0-24
|
||||
MOVW a1+4(FP), R4
|
||||
MOVW a2+8(FP), R5
|
||||
MOVW a3+12(FP), R6
|
||||
MOVW trap+0(FP), R2 // syscall entry
|
||||
SYSCALL
|
||||
MOVW R2, r1+16(FP)
|
||||
MOVW R3, r2+20(FP)
|
||||
RET
|
||||
|
36
vendor/golang.org/x/sys/unix/asm_linux_ppc64x.s
generated
vendored
36
vendor/golang.org/x/sys/unix/asm_linux_ppc64x.s
generated
vendored
@ -15,14 +15,30 @@
|
||||
// Just jump to package syscall's implementation for all these functions.
|
||||
// The runtime may know about them.
|
||||
|
||||
TEXT ·Syscall(SB),NOSPLIT,$0-56
|
||||
BR syscall·Syscall(SB)
|
||||
TEXT ·SyscallNoError(SB),NOSPLIT,$0-48
|
||||
BL runtime·entersyscall(SB)
|
||||
MOVD a1+8(FP), R3
|
||||
MOVD a2+16(FP), R4
|
||||
MOVD a3+24(FP), R5
|
||||
MOVD R0, R6
|
||||
MOVD R0, R7
|
||||
MOVD R0, R8
|
||||
MOVD trap+0(FP), R9 // syscall entry
|
||||
SYSCALL R9
|
||||
MOVD R3, r1+32(FP)
|
||||
MOVD R4, r2+40(FP)
|
||||
BL runtime·exitsyscall(SB)
|
||||
RET
|
||||
|
||||
TEXT ·Syscall6(SB),NOSPLIT,$0-80
|
||||
BR syscall·Syscall6(SB)
|
||||
|
||||
TEXT ·RawSyscall(SB),NOSPLIT,$0-56
|
||||
BR syscall·RawSyscall(SB)
|
||||
|
||||
TEXT ·RawSyscall6(SB),NOSPLIT,$0-80
|
||||
BR syscall·RawSyscall6(SB)
|
||||
TEXT ·RawSyscallNoError(SB),NOSPLIT,$0-48
|
||||
MOVD a1+8(FP), R3
|
||||
MOVD a2+16(FP), R4
|
||||
MOVD a3+24(FP), R5
|
||||
MOVD R0, R6
|
||||
MOVD R0, R7
|
||||
MOVD R0, R8
|
||||
MOVD trap+0(FP), R9 // syscall entry
|
||||
SYSCALL R9
|
||||
MOVD R3, r1+32(FP)
|
||||
MOVD R4, r2+40(FP)
|
||||
RET
|
||||
|
28
vendor/golang.org/x/sys/unix/asm_linux_s390x.s
generated
vendored
28
vendor/golang.org/x/sys/unix/asm_linux_s390x.s
generated
vendored
@ -21,8 +21,36 @@ TEXT ·Syscall(SB),NOSPLIT,$0-56
|
||||
TEXT ·Syscall6(SB),NOSPLIT,$0-80
|
||||
BR syscall·Syscall6(SB)
|
||||
|
||||
TEXT ·SyscallNoError(SB),NOSPLIT,$0-48
|
||||
BL runtime·entersyscall(SB)
|
||||
MOVD a1+8(FP), R2
|
||||
MOVD a2+16(FP), R3
|
||||
MOVD a3+24(FP), R4
|
||||
MOVD $0, R5
|
||||
MOVD $0, R6
|
||||
MOVD $0, R7
|
||||
MOVD trap+0(FP), R1 // syscall entry
|
||||
SYSCALL
|
||||
MOVD R2, r1+32(FP)
|
||||
MOVD R3, r2+40(FP)
|
||||
BL runtime·exitsyscall(SB)
|
||||
RET
|
||||
|
||||
TEXT ·RawSyscall(SB),NOSPLIT,$0-56
|
||||
BR syscall·RawSyscall(SB)
|
||||
|
||||
TEXT ·RawSyscall6(SB),NOSPLIT,$0-80
|
||||
BR syscall·RawSyscall6(SB)
|
||||
|
||||
TEXT ·RawSyscallNoError(SB),NOSPLIT,$0-48
|
||||
MOVD a1+8(FP), R2
|
||||
MOVD a2+16(FP), R3
|
||||
MOVD a3+24(FP), R4
|
||||
MOVD $0, R5
|
||||
MOVD $0, R6
|
||||
MOVD $0, R7
|
||||
MOVD trap+0(FP), R1 // syscall entry
|
||||
SYSCALL
|
||||
MOVD R2, r1+32(FP)
|
||||
MOVD R3, r2+40(FP)
|
||||
RET
|
||||
|
29
vendor/golang.org/x/sys/unix/asm_netbsd_arm64.s
generated
vendored
Normal file
29
vendor/golang.org/x/sys/unix/asm_netbsd_arm64.s
generated
vendored
Normal file
@ -0,0 +1,29 @@
|
||||
// Copyright 2019 The Go Authors. All rights reserved.
|
||||
// Use of this source code is governed by a BSD-style
|
||||
// license that can be found in the LICENSE file.
|
||||
|
||||
// +build !gccgo
|
||||
|
||||
#include "textflag.h"
|
||||
|
||||
//
|
||||
// System call support for ARM64, NetBSD
|
||||
//
|
||||
|
||||
// Just jump to package syscall's implementation for all these functions.
|
||||
// The runtime may know about them.
|
||||
|
||||
TEXT ·Syscall(SB),NOSPLIT,$0-56
|
||||
B syscall·Syscall(SB)
|
||||
|
||||
TEXT ·Syscall6(SB),NOSPLIT,$0-80
|
||||
B syscall·Syscall6(SB)
|
||||
|
||||
TEXT ·Syscall9(SB),NOSPLIT,$0-104
|
||||
B syscall·Syscall9(SB)
|
||||
|
||||
TEXT ·RawSyscall(SB),NOSPLIT,$0-56
|
||||
B syscall·RawSyscall(SB)
|
||||
|
||||
TEXT ·RawSyscall6(SB),NOSPLIT,$0-80
|
||||
B syscall·RawSyscall6(SB)
|
30
vendor/golang.org/x/sys/unix/cap_freebsd.go
generated
vendored
30
vendor/golang.org/x/sys/unix/cap_freebsd.go
generated
vendored
@ -7,7 +7,7 @@
|
||||
package unix
|
||||
|
||||
import (
|
||||
errorspkg "errors"
|
||||
"errors"
|
||||
"fmt"
|
||||
)
|
||||
|
||||
@ -60,26 +60,26 @@ func CapRightsSet(rights *CapRights, setrights []uint64) error {
|
||||
|
||||
n := caparsize(rights)
|
||||
if n < capArSizeMin || n > capArSizeMax {
|
||||
return errorspkg.New("bad rights size")
|
||||
return errors.New("bad rights size")
|
||||
}
|
||||
|
||||
for _, right := range setrights {
|
||||
if caprver(right) != CAP_RIGHTS_VERSION_00 {
|
||||
return errorspkg.New("bad right version")
|
||||
return errors.New("bad right version")
|
||||
}
|
||||
i, err := rightToIndex(right)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
if i >= n {
|
||||
return errorspkg.New("index overflow")
|
||||
return errors.New("index overflow")
|
||||
}
|
||||
if capidxbit(rights.Rights[i]) != capidxbit(right) {
|
||||
return errorspkg.New("index mismatch")
|
||||
return errors.New("index mismatch")
|
||||
}
|
||||
rights.Rights[i] |= right
|
||||
if capidxbit(rights.Rights[i]) != capidxbit(right) {
|
||||
return errorspkg.New("index mismatch (after assign)")
|
||||
return errors.New("index mismatch (after assign)")
|
||||
}
|
||||
}
|
||||
|
||||
@ -95,26 +95,26 @@ func CapRightsClear(rights *CapRights, clearrights []uint64) error {
|
||||
|
||||
n := caparsize(rights)
|
||||
if n < capArSizeMin || n > capArSizeMax {
|
||||
return errorspkg.New("bad rights size")
|
||||
return errors.New("bad rights size")
|
||||
}
|
||||
|
||||
for _, right := range clearrights {
|
||||
if caprver(right) != CAP_RIGHTS_VERSION_00 {
|
||||
return errorspkg.New("bad right version")
|
||||
return errors.New("bad right version")
|
||||
}
|
||||
i, err := rightToIndex(right)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
if i >= n {
|
||||
return errorspkg.New("index overflow")
|
||||
return errors.New("index overflow")
|
||||
}
|
||||
if capidxbit(rights.Rights[i]) != capidxbit(right) {
|
||||
return errorspkg.New("index mismatch")
|
||||
return errors.New("index mismatch")
|
||||
}
|
||||
rights.Rights[i] &= ^(right & 0x01FFFFFFFFFFFFFF)
|
||||
if capidxbit(rights.Rights[i]) != capidxbit(right) {
|
||||
return errorspkg.New("index mismatch (after assign)")
|
||||
return errors.New("index mismatch (after assign)")
|
||||
}
|
||||
}
|
||||
|
||||
@ -130,22 +130,22 @@ func CapRightsIsSet(rights *CapRights, setrights []uint64) (bool, error) {
|
||||
|
||||
n := caparsize(rights)
|
||||
if n < capArSizeMin || n > capArSizeMax {
|
||||
return false, errorspkg.New("bad rights size")
|
||||
return false, errors.New("bad rights size")
|
||||
}
|
||||
|
||||
for _, right := range setrights {
|
||||
if caprver(right) != CAP_RIGHTS_VERSION_00 {
|
||||
return false, errorspkg.New("bad right version")
|
||||
return false, errors.New("bad right version")
|
||||
}
|
||||
i, err := rightToIndex(right)
|
||||
if err != nil {
|
||||
return false, err
|
||||
}
|
||||
if i >= n {
|
||||
return false, errorspkg.New("index overflow")
|
||||
return false, errors.New("index overflow")
|
||||
}
|
||||
if capidxbit(rights.Rights[i]) != capidxbit(right) {
|
||||
return false, errorspkg.New("index mismatch")
|
||||
return false, errors.New("index mismatch")
|
||||
}
|
||||
if (rights.Rights[i] & right) != right {
|
||||
return false, nil
|
||||
|
2
vendor/golang.org/x/sys/unix/constants.go
generated
vendored
2
vendor/golang.org/x/sys/unix/constants.go
generated
vendored
@ -2,7 +2,7 @@
|
||||
// Use of this source code is governed by a BSD-style
|
||||
// license that can be found in the LICENSE file.
|
||||
|
||||
// +build darwin dragonfly freebsd linux netbsd openbsd solaris
|
||||
// +build aix darwin dragonfly freebsd linux netbsd openbsd solaris
|
||||
|
||||
package unix
|
||||
|
||||
|
27
vendor/golang.org/x/sys/unix/dev_aix_ppc.go
generated
vendored
Normal file
27
vendor/golang.org/x/sys/unix/dev_aix_ppc.go
generated
vendored
Normal file
@ -0,0 +1,27 @@
|
||||
// Copyright 2018 The Go Authors. All rights reserved.
|
||||
// Use of this source code is governed by a BSD-style
|
||||
// license that can be found in the LICENSE file.
|
||||
|
||||
// +build aix
|
||||
// +build ppc
|
||||
|
||||
// Functions to access/create device major and minor numbers matching the
|
||||
// encoding used by AIX.
|
||||
|
||||
package unix
|
||||
|
||||
// Major returns the major component of a Linux device number.
|
||||
func Major(dev uint64) uint32 {
|
||||
return uint32((dev >> 16) & 0xffff)
|
||||
}
|
||||
|
||||
// Minor returns the minor component of a Linux device number.
|
||||
func Minor(dev uint64) uint32 {
|
||||
return uint32(dev & 0xffff)
|
||||
}
|
||||
|
||||
// Mkdev returns a Linux device number generated from the given major and minor
|
||||
// components.
|
||||
func Mkdev(major, minor uint32) uint64 {
|
||||
return uint64(((major) << 16) | (minor))
|
||||
}
|
29
vendor/golang.org/x/sys/unix/dev_aix_ppc64.go
generated
vendored
Normal file
29
vendor/golang.org/x/sys/unix/dev_aix_ppc64.go
generated
vendored
Normal file
@ -0,0 +1,29 @@
|
||||
// Copyright 2018 The Go Authors. All rights reserved.
|
||||
// Use of this source code is governed by a BSD-style
|
||||
// license that can be found in the LICENSE file.
|
||||
|
||||
// +build aix
|
||||
// +build ppc64
|
||||
|
||||
// Functions to access/create device major and minor numbers matching the
|
||||
// encoding used AIX.
|
||||
|
||||
package unix
|
||||
|
||||
// Major returns the major component of a Linux device number.
|
||||
func Major(dev uint64) uint32 {
|
||||
return uint32((dev & 0x3fffffff00000000) >> 32)
|
||||
}
|
||||
|
||||
// Minor returns the minor component of a Linux device number.
|
||||
func Minor(dev uint64) uint32 {
|
||||
return uint32((dev & 0x00000000ffffffff) >> 0)
|
||||
}
|
||||
|
||||
// Mkdev returns a Linux device number generated from the given major and minor
|
||||
// components.
|
||||
func Mkdev(major, minor uint32) uint64 {
|
||||
var DEVNO64 uint64
|
||||
DEVNO64 = 0x8000000000000000
|
||||
return ((uint64(major) << 32) | (uint64(minor) & 0x00000000FFFFFFFF) | DEVNO64)
|
||||
}
|
91
vendor/golang.org/x/sys/unix/dirent.go
generated
vendored
91
vendor/golang.org/x/sys/unix/dirent.go
generated
vendored
@ -2,101 +2,16 @@
|
||||
// Use of this source code is governed by a BSD-style
|
||||
// license that can be found in the LICENSE file.
|
||||
|
||||
// +build darwin dragonfly freebsd linux nacl netbsd openbsd solaris
|
||||
// +build aix darwin dragonfly freebsd linux nacl netbsd openbsd solaris
|
||||
|
||||
package unix
|
||||
|
||||
import "unsafe"
|
||||
|
||||
// readInt returns the size-bytes unsigned integer in native byte order at offset off.
|
||||
func readInt(b []byte, off, size uintptr) (u uint64, ok bool) {
|
||||
if len(b) < int(off+size) {
|
||||
return 0, false
|
||||
}
|
||||
if isBigEndian {
|
||||
return readIntBE(b[off:], size), true
|
||||
}
|
||||
return readIntLE(b[off:], size), true
|
||||
}
|
||||
|
||||
func readIntBE(b []byte, size uintptr) uint64 {
|
||||
switch size {
|
||||
case 1:
|
||||
return uint64(b[0])
|
||||
case 2:
|
||||
_ = b[1] // bounds check hint to compiler; see golang.org/issue/14808
|
||||
return uint64(b[1]) | uint64(b[0])<<8
|
||||
case 4:
|
||||
_ = b[3] // bounds check hint to compiler; see golang.org/issue/14808
|
||||
return uint64(b[3]) | uint64(b[2])<<8 | uint64(b[1])<<16 | uint64(b[0])<<24
|
||||
case 8:
|
||||
_ = b[7] // bounds check hint to compiler; see golang.org/issue/14808
|
||||
return uint64(b[7]) | uint64(b[6])<<8 | uint64(b[5])<<16 | uint64(b[4])<<24 |
|
||||
uint64(b[3])<<32 | uint64(b[2])<<40 | uint64(b[1])<<48 | uint64(b[0])<<56
|
||||
default:
|
||||
panic("syscall: readInt with unsupported size")
|
||||
}
|
||||
}
|
||||
|
||||
func readIntLE(b []byte, size uintptr) uint64 {
|
||||
switch size {
|
||||
case 1:
|
||||
return uint64(b[0])
|
||||
case 2:
|
||||
_ = b[1] // bounds check hint to compiler; see golang.org/issue/14808
|
||||
return uint64(b[0]) | uint64(b[1])<<8
|
||||
case 4:
|
||||
_ = b[3] // bounds check hint to compiler; see golang.org/issue/14808
|
||||
return uint64(b[0]) | uint64(b[1])<<8 | uint64(b[2])<<16 | uint64(b[3])<<24
|
||||
case 8:
|
||||
_ = b[7] // bounds check hint to compiler; see golang.org/issue/14808
|
||||
return uint64(b[0]) | uint64(b[1])<<8 | uint64(b[2])<<16 | uint64(b[3])<<24 |
|
||||
uint64(b[4])<<32 | uint64(b[5])<<40 | uint64(b[6])<<48 | uint64(b[7])<<56
|
||||
default:
|
||||
panic("syscall: readInt with unsupported size")
|
||||
}
|
||||
}
|
||||
import "syscall"
|
||||
|
||||
// ParseDirent parses up to max directory entries in buf,
|
||||
// appending the names to names. It returns the number of
|
||||
// bytes consumed from buf, the number of entries added
|
||||
// to names, and the new names slice.
|
||||
func ParseDirent(buf []byte, max int, names []string) (consumed int, count int, newnames []string) {
|
||||
origlen := len(buf)
|
||||
count = 0
|
||||
for max != 0 && len(buf) > 0 {
|
||||
reclen, ok := direntReclen(buf)
|
||||
if !ok || reclen > uint64(len(buf)) {
|
||||
return origlen, count, names
|
||||
}
|
||||
rec := buf[:reclen]
|
||||
buf = buf[reclen:]
|
||||
ino, ok := direntIno(rec)
|
||||
if !ok {
|
||||
break
|
||||
}
|
||||
if ino == 0 { // File absent in directory.
|
||||
continue
|
||||
}
|
||||
const namoff = uint64(unsafe.Offsetof(Dirent{}.Name))
|
||||
namlen, ok := direntNamlen(rec)
|
||||
if !ok || namoff+namlen > uint64(len(rec)) {
|
||||
break
|
||||
}
|
||||
name := rec[namoff : namoff+namlen]
|
||||
for i, c := range name {
|
||||
if c == 0 {
|
||||
name = name[:i]
|
||||
break
|
||||
}
|
||||
}
|
||||
// Check for useless names before allocating a string.
|
||||
if string(name) == "." || string(name) == ".." {
|
||||
continue
|
||||
}
|
||||
max--
|
||||
count++
|
||||
names = append(names, string(name))
|
||||
}
|
||||
return origlen - len(buf), count, names
|
||||
return syscall.ParseDirent(buf, max, names)
|
||||
}
|
||||
|
6
vendor/golang.org/x/sys/unix/env_unix.go
generated
vendored
6
vendor/golang.org/x/sys/unix/env_unix.go
generated
vendored
@ -2,7 +2,7 @@
|
||||
// Use of this source code is governed by a BSD-style
|
||||
// license that can be found in the LICENSE file.
|
||||
|
||||
// +build darwin dragonfly freebsd linux netbsd openbsd solaris
|
||||
// +build aix darwin dragonfly freebsd linux netbsd openbsd solaris
|
||||
|
||||
// Unix environment variables.
|
||||
|
||||
@ -25,3 +25,7 @@ func Clearenv() {
|
||||
func Environ() []string {
|
||||
return syscall.Environ()
|
||||
}
|
||||
|
||||
func Unsetenv(key string) error {
|
||||
return syscall.Unsetenv(key)
|
||||
}
|
||||
|
14
vendor/golang.org/x/sys/unix/env_unset.go
generated
vendored
14
vendor/golang.org/x/sys/unix/env_unset.go
generated
vendored
@ -1,14 +0,0 @@
|
||||
// Copyright 2014 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 go1.4
|
||||
|
||||
package unix
|
||||
|
||||
import "syscall"
|
||||
|
||||
func Unsetenv(key string) error {
|
||||
// This was added in Go 1.4.
|
||||
return syscall.Unsetenv(key)
|
||||
}
|
12
vendor/golang.org/x/sys/unix/flock.go → vendor/golang.org/x/sys/unix/fcntl.go
generated
vendored
12
vendor/golang.org/x/sys/unix/flock.go → vendor/golang.org/x/sys/unix/fcntl.go
generated
vendored
@ -2,7 +2,7 @@
|
||||
// Use of this source code is governed by a BSD-style
|
||||
// license that can be found in the LICENSE file.
|
||||
|
||||
// +build darwin dragonfly freebsd linux netbsd openbsd
|
||||
// +build dragonfly freebsd linux netbsd openbsd
|
||||
|
||||
package unix
|
||||
|
||||
@ -12,6 +12,16 @@ import "unsafe"
|
||||
// systems by flock_linux_32bit.go to be SYS_FCNTL64.
|
||||
var fcntl64Syscall uintptr = SYS_FCNTL
|
||||
|
||||
// FcntlInt performs a fcntl syscall on fd with the provided command and argument.
|
||||
func FcntlInt(fd uintptr, cmd, arg int) (int, error) {
|
||||
valptr, _, errno := Syscall(fcntl64Syscall, fd, uintptr(cmd), uintptr(arg))
|
||||
var err error
|
||||
if errno != 0 {
|
||||
err = errno
|
||||
}
|
||||
return int(valptr), err
|
||||
}
|
||||
|
||||
// FcntlFlock performs a fcntl syscall for the F_GETLK, F_SETLK or F_SETLKW command.
|
||||
func FcntlFlock(fd uintptr, cmd int, lk *Flock_t) error {
|
||||
_, _, errno := Syscall(fcntl64Syscall, fd, uintptr(cmd), uintptr(unsafe.Pointer(lk)))
|
18
vendor/golang.org/x/sys/unix/fcntl_darwin.go
generated
vendored
Normal file
18
vendor/golang.org/x/sys/unix/fcntl_darwin.go
generated
vendored
Normal file
@ -0,0 +1,18 @@
|
||||
// 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 unix
|
||||
|
||||
import "unsafe"
|
||||
|
||||
// FcntlInt performs a fcntl syscall on fd with the provided command and argument.
|
||||
func FcntlInt(fd uintptr, cmd, arg int) (int, error) {
|
||||
return fcntl(int(fd), cmd, arg)
|
||||
}
|
||||
|
||||
// FcntlFlock performs a fcntl syscall for the F_GETLK, F_SETLK or F_SETLKW command.
|
||||
func FcntlFlock(fd uintptr, cmd int, lk *Flock_t) error {
|
||||
_, err := fcntl(int(fd), cmd, int(uintptr(unsafe.Pointer(lk))))
|
||||
return err
|
||||
}
|
16
vendor/golang.org/x/sys/unix/gccgo.go
generated
vendored
16
vendor/golang.org/x/sys/unix/gccgo.go
generated
vendored
@ -3,6 +3,7 @@
|
||||
// license that can be found in the LICENSE file.
|
||||
|
||||
// +build gccgo
|
||||
// +build !aix
|
||||
|
||||
package unix
|
||||
|
||||
@ -11,9 +12,19 @@ import "syscall"
|
||||
// We can't use the gc-syntax .s files for gccgo. On the plus side
|
||||
// much of the functionality can be written directly in Go.
|
||||
|
||||
//extern gccgoRealSyscallNoError
|
||||
func realSyscallNoError(trap, a1, a2, a3, a4, a5, a6, a7, a8, a9 uintptr) (r uintptr)
|
||||
|
||||
//extern gccgoRealSyscall
|
||||
func realSyscall(trap, a1, a2, a3, a4, a5, a6, a7, a8, a9 uintptr) (r, errno uintptr)
|
||||
|
||||
func SyscallNoError(trap, a1, a2, a3 uintptr) (r1, r2 uintptr) {
|
||||
syscall.Entersyscall()
|
||||
r := realSyscallNoError(trap, a1, a2, a3, 0, 0, 0, 0, 0, 0)
|
||||
syscall.Exitsyscall()
|
||||
return r, 0
|
||||
}
|
||||
|
||||
func Syscall(trap, a1, a2, a3 uintptr) (r1, r2 uintptr, err syscall.Errno) {
|
||||
syscall.Entersyscall()
|
||||
r, errno := realSyscall(trap, a1, a2, a3, 0, 0, 0, 0, 0, 0)
|
||||
@ -35,6 +46,11 @@ func Syscall9(trap, a1, a2, a3, a4, a5, a6, a7, a8, a9 uintptr) (r1, r2 uintptr,
|
||||
return r, 0, syscall.Errno(errno)
|
||||
}
|
||||
|
||||
func RawSyscallNoError(trap, a1, a2, a3 uintptr) (r1, r2 uintptr) {
|
||||
r := realSyscallNoError(trap, a1, a2, a3, 0, 0, 0, 0, 0, 0)
|
||||
return r, 0
|
||||
}
|
||||
|
||||
func RawSyscall(trap, a1, a2, a3 uintptr) (r1, r2 uintptr, err syscall.Errno) {
|
||||
r, errno := realSyscall(trap, a1, a2, a3, 0, 0, 0, 0, 0, 0)
|
||||
return r, 0, syscall.Errno(errno)
|
||||
|
10
vendor/golang.org/x/sys/unix/gccgo_c.c
generated
vendored
10
vendor/golang.org/x/sys/unix/gccgo_c.c
generated
vendored
@ -3,6 +3,7 @@
|
||||
// license that can be found in the LICENSE file.
|
||||
|
||||
// +build gccgo
|
||||
// +build !aix
|
||||
|
||||
#include <errno.h>
|
||||
#include <stdint.h>
|
||||
@ -31,11 +32,8 @@ gccgoRealSyscall(uintptr_t trap, uintptr_t a1, uintptr_t a2, uintptr_t a3, uintp
|
||||
return r;
|
||||
}
|
||||
|
||||
// Define the use function in C so that it is not inlined.
|
||||
|
||||
extern void use(void *) __asm__ (GOSYM_PREFIX GOPKGPATH ".use") __attribute__((noinline));
|
||||
|
||||
void
|
||||
use(void *p __attribute__ ((unused)))
|
||||
uintptr_t
|
||||
gccgoRealSyscallNoError(uintptr_t trap, uintptr_t a1, uintptr_t a2, uintptr_t a3, uintptr_t a4, uintptr_t a5, uintptr_t a6, uintptr_t a7, uintptr_t a8, uintptr_t a9)
|
||||
{
|
||||
return syscall(trap, a1, a2, a3, a4, a5, a6, a7, a8, a9);
|
||||
}
|
||||
|
30
vendor/golang.org/x/sys/unix/ioctl.go
generated
vendored
Normal file
30
vendor/golang.org/x/sys/unix/ioctl.go
generated
vendored
Normal file
@ -0,0 +1,30 @@
|
||||
// Copyright 2018 The Go Authors. All rights reserved.
|
||||
// Use of this source code is governed by a BSD-style
|
||||
// license that can be found in the LICENSE file.
|
||||
|
||||
// +build aix darwin dragonfly freebsd linux netbsd openbsd solaris
|
||||
|
||||
package unix
|
||||
|
||||
import "runtime"
|
||||
|
||||
// IoctlSetWinsize performs an ioctl on fd with a *Winsize argument.
|
||||
//
|
||||
// To change fd's window size, the req argument should be TIOCSWINSZ.
|
||||
func IoctlSetWinsize(fd int, req uint, value *Winsize) error {
|
||||
// TODO: if we get the chance, remove the req parameter and
|
||||
// hardcode TIOCSWINSZ.
|
||||
err := ioctlSetWinsize(fd, req, value)
|
||||
runtime.KeepAlive(value)
|
||||
return err
|
||||
}
|
||||
|
||||
// IoctlSetTermios performs an ioctl on fd with a *Termios.
|
||||
//
|
||||
// The req value will usually be TCSETA or TIOCSETA.
|
||||
func IoctlSetTermios(fd int, req uint, value *Termios) error {
|
||||
// TODO: if we get the chance, remove the req parameter.
|
||||
err := ioctlSetTermios(fd, req, value)
|
||||
runtime.KeepAlive(value)
|
||||
return err
|
||||
}
|
100
vendor/golang.org/x/sys/unix/mkall.sh
generated
vendored
100
vendor/golang.org/x/sys/unix/mkall.sh
generated
vendored
@ -10,13 +10,14 @@
|
||||
GOOSARCH="${GOOS}_${GOARCH}"
|
||||
|
||||
# defaults
|
||||
mksyscall="./mksyscall.pl"
|
||||
mksyscall="go run mksyscall.go"
|
||||
mkerrors="./mkerrors.sh"
|
||||
zerrors="zerrors_$GOOSARCH.go"
|
||||
mksysctl=""
|
||||
zsysctl="zsysctl_$GOOSARCH.go"
|
||||
mksysnum=
|
||||
mktypes=
|
||||
mkasm=
|
||||
run="sh"
|
||||
cmd=""
|
||||
|
||||
@ -45,8 +46,8 @@ case "$#" in
|
||||
exit 2
|
||||
esac
|
||||
|
||||
if [[ "$GOOS" = "linux" ]] && [[ "$GOARCH" != "sparc64" ]]; then
|
||||
# Use then new build system
|
||||
if [[ "$GOOS" = "linux" ]]; then
|
||||
# Use the Docker-based build system
|
||||
# Files generated through docker (use $cmd so you can Ctl-C the build or run)
|
||||
$cmd docker build --tag generate:$GOOS $GOOS
|
||||
$cmd docker run --interactive --tty --volume $(dirname "$(readlink -f "$0")"):/build generate:$GOOS
|
||||
@ -59,110 +60,117 @@ _* | *_ | _)
|
||||
echo 'undefined $GOOS_$GOARCH:' "$GOOSARCH" 1>&2
|
||||
exit 1
|
||||
;;
|
||||
aix_ppc)
|
||||
mkerrors="$mkerrors -maix32"
|
||||
mksyscall="go run mksyscall_aix_ppc.go -aix"
|
||||
mktypes="GOARCH=$GOARCH go tool cgo -godefs"
|
||||
;;
|
||||
aix_ppc64)
|
||||
mkerrors="$mkerrors -maix64"
|
||||
mksyscall="go run mksyscall_aix_ppc64.go -aix"
|
||||
mktypes="GOARCH=$GOARCH go tool cgo -godefs"
|
||||
;;
|
||||
darwin_386)
|
||||
mkerrors="$mkerrors -m32"
|
||||
mksyscall="./mksyscall.pl -l32"
|
||||
mksysnum="./mksysnum_darwin.pl $(xcrun --show-sdk-path --sdk macosx)/usr/include/sys/syscall.h"
|
||||
mksyscall="go run mksyscall.go -l32"
|
||||
mksysnum="go run mksysnum.go $(xcrun --show-sdk-path --sdk macosx)/usr/include/sys/syscall.h"
|
||||
mktypes="GOARCH=$GOARCH go tool cgo -godefs"
|
||||
mkasm="go run mkasm_darwin.go"
|
||||
;;
|
||||
darwin_amd64)
|
||||
mkerrors="$mkerrors -m64"
|
||||
mksysnum="./mksysnum_darwin.pl $(xcrun --show-sdk-path --sdk macosx)/usr/include/sys/syscall.h"
|
||||
mksysnum="go run mksysnum.go $(xcrun --show-sdk-path --sdk macosx)/usr/include/sys/syscall.h"
|
||||
mktypes="GOARCH=$GOARCH go tool cgo -godefs"
|
||||
mkasm="go run mkasm_darwin.go"
|
||||
;;
|
||||
darwin_arm)
|
||||
mkerrors="$mkerrors"
|
||||
mksysnum="./mksysnum_darwin.pl $(xcrun --show-sdk-path --sdk iphoneos)/usr/include/sys/syscall.h"
|
||||
mksyscall="go run mksyscall.go -l32"
|
||||
mksysnum="go run mksysnum.go $(xcrun --show-sdk-path --sdk iphoneos)/usr/include/sys/syscall.h"
|
||||
mktypes="GOARCH=$GOARCH go tool cgo -godefs"
|
||||
mkasm="go run mkasm_darwin.go"
|
||||
;;
|
||||
darwin_arm64)
|
||||
mkerrors="$mkerrors -m64"
|
||||
mksysnum="./mksysnum_darwin.pl $(xcrun --show-sdk-path --sdk iphoneos)/usr/include/sys/syscall.h"
|
||||
mktypes="GOARCH=$GOARCH go tool cgo -godefs"
|
||||
;;
|
||||
dragonfly_386)
|
||||
mkerrors="$mkerrors -m32"
|
||||
mksyscall="./mksyscall.pl -l32 -dragonfly"
|
||||
mksysnum="curl -s 'http://gitweb.dragonflybsd.org/dragonfly.git/blob_plain/HEAD:/sys/kern/syscalls.master' | ./mksysnum_dragonfly.pl"
|
||||
mksysnum="go run mksysnum.go $(xcrun --show-sdk-path --sdk iphoneos)/usr/include/sys/syscall.h"
|
||||
mktypes="GOARCH=$GOARCH go tool cgo -godefs"
|
||||
mkasm="go run mkasm_darwin.go"
|
||||
;;
|
||||
dragonfly_amd64)
|
||||
mkerrors="$mkerrors -m64"
|
||||
mksyscall="./mksyscall.pl -dragonfly"
|
||||
mksysnum="curl -s 'http://gitweb.dragonflybsd.org/dragonfly.git/blob_plain/HEAD:/sys/kern/syscalls.master' | ./mksysnum_dragonfly.pl"
|
||||
mksyscall="go run mksyscall.go -dragonfly"
|
||||
mksysnum="go run mksysnum.go 'https://gitweb.dragonflybsd.org/dragonfly.git/blob_plain/HEAD:/sys/kern/syscalls.master'"
|
||||
mktypes="GOARCH=$GOARCH go tool cgo -godefs"
|
||||
;;
|
||||
freebsd_386)
|
||||
mkerrors="$mkerrors -m32"
|
||||
mksyscall="./mksyscall.pl -l32"
|
||||
mksysnum="curl -s 'http://svn.freebsd.org/base/stable/10/sys/kern/syscalls.master' | ./mksysnum_freebsd.pl"
|
||||
mksyscall="go run mksyscall.go -l32"
|
||||
mksysnum="go run mksysnum.go 'https://svn.freebsd.org/base/stable/10/sys/kern/syscalls.master'"
|
||||
mktypes="GOARCH=$GOARCH go tool cgo -godefs"
|
||||
;;
|
||||
freebsd_amd64)
|
||||
mkerrors="$mkerrors -m64"
|
||||
mksysnum="curl -s 'http://svn.freebsd.org/base/stable/10/sys/kern/syscalls.master' | ./mksysnum_freebsd.pl"
|
||||
mksysnum="go run mksysnum.go 'https://svn.freebsd.org/base/stable/10/sys/kern/syscalls.master'"
|
||||
mktypes="GOARCH=$GOARCH go tool cgo -godefs"
|
||||
;;
|
||||
freebsd_arm)
|
||||
mkerrors="$mkerrors"
|
||||
mksyscall="./mksyscall.pl -l32 -arm"
|
||||
mksysnum="curl -s 'http://svn.freebsd.org/base/stable/10/sys/kern/syscalls.master' | ./mksysnum_freebsd.pl"
|
||||
mksyscall="go run mksyscall.go -l32 -arm"
|
||||
mksysnum="go run mksysnum.go 'https://svn.freebsd.org/base/stable/10/sys/kern/syscalls.master'"
|
||||
# Let the type of C char be signed for making the bare syscall
|
||||
# API consistent across platforms.
|
||||
mktypes="GOARCH=$GOARCH go tool cgo -godefs -- -fsigned-char"
|
||||
;;
|
||||
linux_sparc64)
|
||||
GOOSARCH_in=syscall_linux_sparc64.go
|
||||
unistd_h=/usr/include/sparc64-linux-gnu/asm/unistd.h
|
||||
freebsd_arm64)
|
||||
mkerrors="$mkerrors -m64"
|
||||
mksysnum="./mksysnum_linux.pl $unistd_h"
|
||||
mksysnum="go run mksysnum.go 'https://svn.freebsd.org/base/stable/10/sys/kern/syscalls.master'"
|
||||
mktypes="GOARCH=$GOARCH go tool cgo -godefs"
|
||||
;;
|
||||
netbsd_386)
|
||||
mkerrors="$mkerrors -m32"
|
||||
mksyscall="./mksyscall.pl -l32 -netbsd"
|
||||
mksysnum="curl -s 'http://cvsweb.netbsd.org/bsdweb.cgi/~checkout~/src/sys/kern/syscalls.master' | ./mksysnum_netbsd.pl"
|
||||
mksyscall="go run mksyscall.go -l32 -netbsd"
|
||||
mksysnum="go run mksysnum.go 'http://cvsweb.netbsd.org/bsdweb.cgi/~checkout~/src/sys/kern/syscalls.master'"
|
||||
mktypes="GOARCH=$GOARCH go tool cgo -godefs"
|
||||
;;
|
||||
netbsd_amd64)
|
||||
mkerrors="$mkerrors -m64"
|
||||
mksyscall="./mksyscall.pl -netbsd"
|
||||
mksysnum="curl -s 'http://cvsweb.netbsd.org/bsdweb.cgi/~checkout~/src/sys/kern/syscalls.master' | ./mksysnum_netbsd.pl"
|
||||
mksyscall="go run mksyscall.go -netbsd"
|
||||
mksysnum="go run mksysnum.go 'http://cvsweb.netbsd.org/bsdweb.cgi/~checkout~/src/sys/kern/syscalls.master'"
|
||||
mktypes="GOARCH=$GOARCH go tool cgo -godefs"
|
||||
;;
|
||||
netbsd_arm)
|
||||
mkerrors="$mkerrors"
|
||||
mksyscall="./mksyscall.pl -l32 -netbsd -arm"
|
||||
mksysnum="curl -s 'http://cvsweb.netbsd.org/bsdweb.cgi/~checkout~/src/sys/kern/syscalls.master' | ./mksysnum_netbsd.pl"
|
||||
mksyscall="go run mksyscall.go -l32 -netbsd -arm"
|
||||
mksysnum="go run mksysnum.go 'http://cvsweb.netbsd.org/bsdweb.cgi/~checkout~/src/sys/kern/syscalls.master'"
|
||||
# Let the type of C char be signed for making the bare syscall
|
||||
# API consistent across platforms.
|
||||
mktypes="GOARCH=$GOARCH go tool cgo -godefs -- -fsigned-char"
|
||||
;;
|
||||
openbsd_386)
|
||||
mkerrors="$mkerrors -m32"
|
||||
mksyscall="./mksyscall.pl -l32 -openbsd"
|
||||
mksyscall="go run mksyscall.go -l32 -openbsd"
|
||||
mksysctl="./mksysctl_openbsd.pl"
|
||||
mksysnum="curl -s 'http://cvsweb.openbsd.org/cgi-bin/cvsweb/~checkout~/src/sys/kern/syscalls.master' | ./mksysnum_openbsd.pl"
|
||||
mksysnum="go run mksysnum.go 'https://cvsweb.openbsd.org/cgi-bin/cvsweb/~checkout~/src/sys/kern/syscalls.master'"
|
||||
mktypes="GOARCH=$GOARCH go tool cgo -godefs"
|
||||
;;
|
||||
openbsd_amd64)
|
||||
mkerrors="$mkerrors -m64"
|
||||
mksyscall="./mksyscall.pl -openbsd"
|
||||
mksyscall="go run mksyscall.go -openbsd"
|
||||
mksysctl="./mksysctl_openbsd.pl"
|
||||
mksysnum="curl -s 'http://cvsweb.openbsd.org/cgi-bin/cvsweb/~checkout~/src/sys/kern/syscalls.master' | ./mksysnum_openbsd.pl"
|
||||
mksysnum="go run mksysnum.go 'https://cvsweb.openbsd.org/cgi-bin/cvsweb/~checkout~/src/sys/kern/syscalls.master'"
|
||||
mktypes="GOARCH=$GOARCH go tool cgo -godefs"
|
||||
;;
|
||||
openbsd_arm)
|
||||
mkerrors="$mkerrors"
|
||||
mksyscall="./mksyscall.pl -l32 -openbsd -arm"
|
||||
mksyscall="go run mksyscall.go -l32 -openbsd -arm"
|
||||
mksysctl="./mksysctl_openbsd.pl"
|
||||
mksysnum="curl -s 'http://cvsweb.openbsd.org/cgi-bin/cvsweb/~checkout~/src/sys/kern/syscalls.master' | ./mksysnum_openbsd.pl"
|
||||
mksysnum="go run mksysnum.go 'https://cvsweb.openbsd.org/cgi-bin/cvsweb/~checkout~/src/sys/kern/syscalls.master'"
|
||||
# Let the type of C char be signed for making the bare syscall
|
||||
# API consistent across platforms.
|
||||
mktypes="GOARCH=$GOARCH go tool cgo -godefs -- -fsigned-char"
|
||||
;;
|
||||
solaris_amd64)
|
||||
mksyscall="./mksyscall_solaris.pl"
|
||||
mksyscall="go run mksyscall_solaris.go"
|
||||
mkerrors="$mkerrors -m64"
|
||||
mksysnum=
|
||||
mktypes="GOARCH=$GOARCH go tool cgo -godefs"
|
||||
@ -183,12 +191,24 @@ esac
|
||||
syscall_goos="syscall_bsd.go $syscall_goos"
|
||||
;;
|
||||
esac
|
||||
if [ -n "$mksyscall" ]; then echo "$mksyscall -tags $GOOS,$GOARCH $syscall_goos $GOOSARCH_in |gofmt >zsyscall_$GOOSARCH.go"; fi
|
||||
;;
|
||||
if [ -n "$mksyscall" ]; then
|
||||
if [ "$GOOSARCH" == "aix_ppc64" ]; then
|
||||
# aix/ppc64 script generates files instead of writing to stdin.
|
||||
echo "$mksyscall -tags $GOOS,$GOARCH $syscall_goos $GOOSARCH_in && gofmt -w zsyscall_$GOOSARCH.go && gofmt -w zsyscall_"$GOOSARCH"_gccgo.go && gofmt -w zsyscall_"$GOOSARCH"_gc.go " ;
|
||||
elif [ "$GOOS" == "darwin" ]; then
|
||||
# pre-1.12, direct syscalls
|
||||
echo "$mksyscall -tags $GOOS,$GOARCH,!go1.12 $syscall_goos $GOOSARCH_in |gofmt >zsyscall_$GOOSARCH.1_11.go";
|
||||
# 1.12 and later, syscalls via libSystem
|
||||
echo "$mksyscall -tags $GOOS,$GOARCH,go1.12 $syscall_goos $GOOSARCH_in |gofmt >zsyscall_$GOOSARCH.go";
|
||||
else
|
||||
echo "$mksyscall -tags $GOOS,$GOARCH $syscall_goos $GOOSARCH_in |gofmt >zsyscall_$GOOSARCH.go";
|
||||
fi
|
||||
fi
|
||||
esac
|
||||
if [ -n "$mksysctl" ]; then echo "$mksysctl |gofmt >$zsysctl"; fi
|
||||
if [ -n "$mksysnum" ]; then echo "$mksysnum |gofmt >zsysnum_$GOOSARCH.go"; fi
|
||||
if [ -n "$mktypes" ]; then
|
||||
echo "$mktypes types_$GOOS.go | go run mkpost.go > ztypes_$GOOSARCH.go";
|
||||
if [ -n "$mkasm" ]; then echo "$mkasm $GOARCH"; fi
|
||||
fi
|
||||
) | $run
|
||||
|
147
vendor/golang.org/x/sys/unix/mkerrors.sh
generated
vendored
147
vendor/golang.org/x/sys/unix/mkerrors.sh
generated
vendored
@ -17,15 +17,17 @@ if test -z "$GOARCH" -o -z "$GOOS"; then
|
||||
fi
|
||||
|
||||
# Check that we are using the new build system if we should
|
||||
if [[ "$GOOS" = "linux" ]] && [[ "$GOARCH" != "sparc64" ]]; then
|
||||
if [[ "$GOLANG_SYS_BUILD" != "docker" ]]; then
|
||||
echo 1>&2 "In the new build system, mkerrors should not be called directly."
|
||||
echo 1>&2 "See README.md"
|
||||
exit 1
|
||||
fi
|
||||
if [[ "$GOOS" = "linux" ]] && [[ "$GOLANG_SYS_BUILD" != "docker" ]]; then
|
||||
echo 1>&2 "In the Docker based build system, mkerrors should not be called directly."
|
||||
echo 1>&2 "See README.md"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
CC=${CC:-cc}
|
||||
if [[ "$GOOS" = "aix" ]]; then
|
||||
CC=${CC:-gcc}
|
||||
else
|
||||
CC=${CC:-cc}
|
||||
fi
|
||||
|
||||
if [[ "$GOOS" = "solaris" ]]; then
|
||||
# Assumes GNU versions of utilities in PATH.
|
||||
@ -34,6 +36,21 @@ fi
|
||||
|
||||
uname=$(uname)
|
||||
|
||||
includes_AIX='
|
||||
#include <net/if.h>
|
||||
#include <net/netopt.h>
|
||||
#include <netinet/ip_mroute.h>
|
||||
#include <sys/protosw.h>
|
||||
#include <sys/stropts.h>
|
||||
#include <sys/mman.h>
|
||||
#include <sys/poll.h>
|
||||
#include <sys/termio.h>
|
||||
#include <termios.h>
|
||||
#include <fcntl.h>
|
||||
|
||||
#define AF_LOCAL AF_UNIX
|
||||
'
|
||||
|
||||
includes_Darwin='
|
||||
#define _DARWIN_C_SOURCE
|
||||
#define KERNEL
|
||||
@ -48,7 +65,9 @@ includes_Darwin='
|
||||
#include <sys/sysctl.h>
|
||||
#include <sys/mman.h>
|
||||
#include <sys/mount.h>
|
||||
#include <sys/utsname.h>
|
||||
#include <sys/wait.h>
|
||||
#include <sys/xattr.h>
|
||||
#include <net/bpf.h>
|
||||
#include <net/if.h>
|
||||
#include <net/if_types.h>
|
||||
@ -63,8 +82,10 @@ includes_DragonFly='
|
||||
#include <sys/event.h>
|
||||
#include <sys/socket.h>
|
||||
#include <sys/sockio.h>
|
||||
#include <sys/stat.h>
|
||||
#include <sys/sysctl.h>
|
||||
#include <sys/mman.h>
|
||||
#include <sys/mount.h>
|
||||
#include <sys/wait.h>
|
||||
#include <sys/ioctl.h>
|
||||
#include <net/bpf.h>
|
||||
@ -78,12 +99,13 @@ includes_DragonFly='
|
||||
'
|
||||
|
||||
includes_FreeBSD='
|
||||
#include <sys/capability.h>
|
||||
#include <sys/capsicum.h>
|
||||
#include <sys/param.h>
|
||||
#include <sys/types.h>
|
||||
#include <sys/event.h>
|
||||
#include <sys/socket.h>
|
||||
#include <sys/sockio.h>
|
||||
#include <sys/stat.h>
|
||||
#include <sys/sysctl.h>
|
||||
#include <sys/mman.h>
|
||||
#include <sys/mount.h>
|
||||
@ -157,20 +179,29 @@ struct ltchars {
|
||||
#include <sys/stat.h>
|
||||
#include <sys/types.h>
|
||||
#include <sys/time.h>
|
||||
#include <sys/signalfd.h>
|
||||
#include <sys/socket.h>
|
||||
#include <sys/xattr.h>
|
||||
#include <linux/errqueue.h>
|
||||
#include <linux/if.h>
|
||||
#include <linux/if_alg.h>
|
||||
#include <linux/if_arp.h>
|
||||
#include <linux/if_ether.h>
|
||||
#include <linux/if_ppp.h>
|
||||
#include <linux/if_tun.h>
|
||||
#include <linux/if_packet.h>
|
||||
#include <linux/if_addr.h>
|
||||
#include <linux/falloc.h>
|
||||
#include <linux/filter.h>
|
||||
#include <linux/fs.h>
|
||||
#include <linux/kexec.h>
|
||||
#include <linux/keyctl.h>
|
||||
#include <linux/magic.h>
|
||||
#include <linux/memfd.h>
|
||||
#include <linux/module.h>
|
||||
#include <linux/netfilter/nfnetlink.h>
|
||||
#include <linux/netlink.h>
|
||||
#include <linux/net_namespace.h>
|
||||
#include <linux/perf_event.h>
|
||||
#include <linux/random.h>
|
||||
#include <linux/reboot.h>
|
||||
@ -187,8 +218,20 @@ struct ltchars {
|
||||
#include <linux/taskstats.h>
|
||||
#include <linux/genetlink.h>
|
||||
#include <linux/watchdog.h>
|
||||
#include <linux/hdreg.h>
|
||||
#include <linux/rtc.h>
|
||||
#include <linux/if_xdp.h>
|
||||
#include <mtd/ubi-user.h>
|
||||
#include <net/route.h>
|
||||
|
||||
#if defined(__sparc__)
|
||||
// On sparc{,64}, the kernel defines struct termios2 itself which clashes with the
|
||||
// definition in glibc. As only the error constants are needed here, include the
|
||||
// generic termibits.h (which is included by termbits.h on sparc).
|
||||
#include <asm-generic/termbits.h>
|
||||
#else
|
||||
#include <asm/termbits.h>
|
||||
#endif
|
||||
|
||||
#ifndef MSG_FASTOPEN
|
||||
#define MSG_FASTOPEN 0x20000000
|
||||
@ -222,7 +265,9 @@ includes_NetBSD='
|
||||
#include <sys/types.h>
|
||||
#include <sys/param.h>
|
||||
#include <sys/event.h>
|
||||
#include <sys/extattr.h>
|
||||
#include <sys/mman.h>
|
||||
#include <sys/mount.h>
|
||||
#include <sys/socket.h>
|
||||
#include <sys/sockio.h>
|
||||
#include <sys/sysctl.h>
|
||||
@ -248,11 +293,14 @@ includes_OpenBSD='
|
||||
#include <sys/param.h>
|
||||
#include <sys/event.h>
|
||||
#include <sys/mman.h>
|
||||
#include <sys/mount.h>
|
||||
#include <sys/socket.h>
|
||||
#include <sys/sockio.h>
|
||||
#include <sys/stat.h>
|
||||
#include <sys/sysctl.h>
|
||||
#include <sys/termios.h>
|
||||
#include <sys/ttycom.h>
|
||||
#include <sys/unistd.h>
|
||||
#include <sys/wait.h>
|
||||
#include <net/bpf.h>
|
||||
#include <net/if.h>
|
||||
@ -284,6 +332,7 @@ includes_SunOS='
|
||||
#include <sys/types.h>
|
||||
#include <sys/socket.h>
|
||||
#include <sys/sockio.h>
|
||||
#include <sys/stat.h>
|
||||
#include <sys/mman.h>
|
||||
#include <sys/wait.h>
|
||||
#include <sys/ioctl.h>
|
||||
@ -346,6 +395,7 @@ ccflags="$@"
|
||||
$2 ~ /^EXTATTR_NAMESPACE_NAMES/ ||
|
||||
$2 ~ /^EXTATTR_NAMESPACE_[A-Z]+_STRING/ {next}
|
||||
|
||||
$2 !~ /^ECCAPBITS/ &&
|
||||
$2 !~ /^ETH_/ &&
|
||||
$2 !~ /^EPROC_/ &&
|
||||
$2 !~ /^EQUIV_/ &&
|
||||
@ -362,6 +412,7 @@ ccflags="$@"
|
||||
$2 ~ /^IGN/ ||
|
||||
$2 ~ /^IX(ON|ANY|OFF)$/ ||
|
||||
$2 ~ /^IN(LCR|PCK)$/ ||
|
||||
$2 !~ "X86_CR3_PCID_NOFLUSH" &&
|
||||
$2 ~ /(^FLU?SH)|(FLU?SH$)/ ||
|
||||
$2 ~ /^C(LOCAL|READ|MSPAR|RTSCTS)$/ ||
|
||||
$2 == "BRKINT" ||
|
||||
@ -380,21 +431,27 @@ ccflags="$@"
|
||||
$2 ~ /^TC[IO](ON|OFF)$/ ||
|
||||
$2 ~ /^IN_/ ||
|
||||
$2 ~ /^LOCK_(SH|EX|NB|UN)$/ ||
|
||||
$2 ~ /^(AF|SOCK|SO|SOL|IPPROTO|IP|IPV6|ICMP6|TCP|EVFILT|NOTE|EV|SHUT|PROT|MAP|PACKET|MSG|SCM|MCL|DT|MADV|PR)_/ ||
|
||||
$2 ~ /^(AF|SOCK|SO|SOL|IPPROTO|IP|IPV6|ICMP6|TCP|EVFILT|NOTE|EV|SHUT|PROT|MAP|MFD|T?PACKET|MSG|SCM|MCL|DT|MADV|PR)_/ ||
|
||||
$2 ~ /^TP_STATUS_/ ||
|
||||
$2 ~ /^FALLOC_/ ||
|
||||
$2 == "ICMPV6_FILTER" ||
|
||||
$2 == "SOMAXCONN" ||
|
||||
$2 == "NAME_MAX" ||
|
||||
$2 == "IFNAMSIZ" ||
|
||||
$2 ~ /^CTL_(MAXNAME|NET|QUERY)$/ ||
|
||||
$2 ~ /^CTL_(HW|KERN|MAXNAME|NET|QUERY)$/ ||
|
||||
$2 ~ /^KERN_(HOSTNAME|OS(RELEASE|TYPE)|VERSION)$/ ||
|
||||
$2 ~ /^HW_MACHINE$/ ||
|
||||
$2 ~ /^SYSCTL_VERS/ ||
|
||||
$2 !~ "MNT_BITS" &&
|
||||
$2 ~ /^(MS|MNT|UMOUNT)_/ ||
|
||||
$2 ~ /^TUN(SET|GET|ATTACH|DETACH)/ ||
|
||||
$2 ~ /^(O|F|E?FD|NAME|S|PTRACE|PT)_/ ||
|
||||
$2 ~ /^(O|F|[ES]?FD|NAME|S|PTRACE|PT)_/ ||
|
||||
$2 ~ /^KEXEC_/ ||
|
||||
$2 ~ /^LINUX_REBOOT_CMD_/ ||
|
||||
$2 ~ /^LINUX_REBOOT_MAGIC[12]$/ ||
|
||||
$2 ~ /^MODULE_INIT_/ ||
|
||||
$2 !~ "NLA_TYPE_MASK" &&
|
||||
$2 ~ /^(NETLINK|NLM|NLMSG|NLA|IFA|IFAN|RT|RTCF|RTN|RTPROT|RTNH|ARPHRD|ETH_P)_/ ||
|
||||
$2 ~ /^(NETLINK|NLM|NLMSG|NLA|IFA|IFAN|RT|RTC|RTCF|RTN|RTPROT|RTNH|ARPHRD|ETH_P|NETNSA)_/ ||
|
||||
$2 ~ /^SIOC/ ||
|
||||
$2 ~ /^TIOC/ ||
|
||||
$2 ~ /^TCGET/ ||
|
||||
@ -409,28 +466,41 @@ ccflags="$@"
|
||||
$2 ~ /^CLONE_[A-Z_]+/ ||
|
||||
$2 !~ /^(BPF_TIMEVAL)$/ &&
|
||||
$2 ~ /^(BPF|DLT)_/ ||
|
||||
$2 ~ /^CLOCK_/ ||
|
||||
$2 ~ /^(CLOCK|TIMER)_/ ||
|
||||
$2 ~ /^CAN_/ ||
|
||||
$2 ~ /^CAP_/ ||
|
||||
$2 ~ /^ALG_/ ||
|
||||
$2 ~ /^FS_(POLICY_FLAGS|KEY_DESC|ENCRYPTION_MODE|[A-Z0-9_]+_KEY_SIZE|IOC_(GET|SET)_ENCRYPTION)/ ||
|
||||
$2 ~ /^GRND_/ ||
|
||||
$2 ~ /^RND/ ||
|
||||
$2 ~ /^KEY_(SPEC|REQKEY_DEFL)_/ ||
|
||||
$2 ~ /^KEYCTL_/ ||
|
||||
$2 ~ /^PERF_EVENT_IOC_/ ||
|
||||
$2 ~ /^SECCOMP_MODE_/ ||
|
||||
$2 ~ /^SPLICE_/ ||
|
||||
$2 ~ /^SYNC_FILE_RANGE_/ ||
|
||||
$2 !~ /^AUDIT_RECORD_MAGIC/ &&
|
||||
$2 !~ /IOC_MAGIC/ &&
|
||||
$2 ~ /^[A-Z][A-Z0-9_]+_MAGIC2?$/ ||
|
||||
$2 ~ /^(VM|VMADDR)_/ ||
|
||||
$2 ~ /^IOCTL_VM_SOCKETS_/ ||
|
||||
$2 ~ /^(TASKSTATS|TS)_/ ||
|
||||
$2 ~ /^CGROUPSTATS_/ ||
|
||||
$2 ~ /^GENL_/ ||
|
||||
$2 ~ /^STATX_/ ||
|
||||
$2 ~ /^RENAME/ ||
|
||||
$2 ~ /^UBI_IOC[A-Z]/ ||
|
||||
$2 ~ /^UTIME_/ ||
|
||||
$2 ~ /^XATTR_(CREATE|REPLACE)/ ||
|
||||
$2 ~ /^XATTR_(CREATE|REPLACE|NO(DEFAULT|FOLLOW|SECURITY)|SHOWCOMPRESSION)/ ||
|
||||
$2 ~ /^ATTR_(BIT_MAP_COUNT|(CMN|VOL|FILE)_)/ ||
|
||||
$2 ~ /^FSOPT_/ ||
|
||||
$2 ~ /^WDIOC_/ ||
|
||||
$2 ~ /^NFN/ ||
|
||||
$2 ~ /^XDP_/ ||
|
||||
$2 ~ /^(HDIO|WIN|SMART)_/ ||
|
||||
$2 !~ "WMESGLEN" &&
|
||||
$2 ~ /^W[A-Z0-9]+$/ ||
|
||||
$2 ~/^PPPIOC/ ||
|
||||
$2 ~ /^BLK[A-Z]*(GET$|SET$|BUF$|PART$|SIZE)/ {printf("\t%s = C.%s\n", $2, $2)}
|
||||
$2 ~ /^__WCOREFLAG$/ {next}
|
||||
$2 ~ /^__W[A-Z0-9]+$/ {printf("\t%s = C.%s\n", substr($2,3), $2)}
|
||||
@ -452,7 +522,7 @@ errors=$(
|
||||
signals=$(
|
||||
echo '#include <signal.h>' | $CC -x c - -E -dM $ccflags |
|
||||
awk '$1=="#define" && $2 ~ /^SIG[A-Z0-9]+$/ { print $2 }' |
|
||||
egrep -v '(SIGSTKSIZE|SIGSTKSZ|SIGRT)' |
|
||||
egrep -v '(SIGSTKSIZE|SIGSTKSZ|SIGRT|SIGMAX64)' |
|
||||
sort
|
||||
)
|
||||
|
||||
@ -462,7 +532,7 @@ echo '#include <errno.h>' | $CC -x c - -E -dM $ccflags |
|
||||
sort >_error.grep
|
||||
echo '#include <signal.h>' | $CC -x c - -E -dM $ccflags |
|
||||
awk '$1=="#define" && $2 ~ /^SIG[A-Z0-9]+$/ { print "^\t" $2 "[ \t]*=" }' |
|
||||
egrep -v '(SIGSTKSIZE|SIGSTKSZ|SIGRT)' |
|
||||
egrep -v '(SIGSTKSIZE|SIGSTKSZ|SIGRT|SIGMAX64)' |
|
||||
sort >_signal.grep
|
||||
|
||||
echo '// mkerrors.sh' "$@"
|
||||
@ -498,21 +568,26 @@ echo ')'
|
||||
|
||||
enum { A = 'A', Z = 'Z', a = 'a', z = 'z' }; // avoid need for single quotes below
|
||||
|
||||
int errors[] = {
|
||||
struct tuple {
|
||||
int num;
|
||||
const char *name;
|
||||
};
|
||||
|
||||
struct tuple errors[] = {
|
||||
"
|
||||
for i in $errors
|
||||
do
|
||||
echo -E ' '$i,
|
||||
echo -E ' {'$i', "'$i'" },'
|
||||
done
|
||||
|
||||
echo -E "
|
||||
};
|
||||
|
||||
int signals[] = {
|
||||
struct tuple signals[] = {
|
||||
"
|
||||
for i in $signals
|
||||
do
|
||||
echo -E ' '$i,
|
||||
echo -E ' {'$i', "'$i'" },'
|
||||
done
|
||||
|
||||
# Use -E because on some systems bash builtin interprets \n itself.
|
||||
@ -520,9 +595,9 @@ int signals[] = {
|
||||
};
|
||||
|
||||
static int
|
||||
intcmp(const void *a, const void *b)
|
||||
tuplecmp(const void *a, const void *b)
|
||||
{
|
||||
return *(int*)a - *(int*)b;
|
||||
return ((struct tuple *)a)->num - ((struct tuple *)b)->num;
|
||||
}
|
||||
|
||||
int
|
||||
@ -532,26 +607,34 @@ main(void)
|
||||
char buf[1024], *p;
|
||||
|
||||
printf("\n\n// Error table\n");
|
||||
printf("var errors = [...]string {\n");
|
||||
qsort(errors, nelem(errors), sizeof errors[0], intcmp);
|
||||
printf("var errorList = [...]struct {\n");
|
||||
printf("\tnum syscall.Errno\n");
|
||||
printf("\tname string\n");
|
||||
printf("\tdesc string\n");
|
||||
printf("} {\n");
|
||||
qsort(errors, nelem(errors), sizeof errors[0], tuplecmp);
|
||||
for(i=0; i<nelem(errors); i++) {
|
||||
e = errors[i];
|
||||
if(i > 0 && errors[i-1] == e)
|
||||
e = errors[i].num;
|
||||
if(i > 0 && errors[i-1].num == e)
|
||||
continue;
|
||||
strcpy(buf, strerror(e));
|
||||
// lowercase first letter: Bad -> bad, but STREAM -> STREAM.
|
||||
if(A <= buf[0] && buf[0] <= Z && a <= buf[1] && buf[1] <= z)
|
||||
buf[0] += a - A;
|
||||
printf("\t%d: \"%s\",\n", e, buf);
|
||||
printf("\t{ %d, \"%s\", \"%s\" },\n", e, errors[i].name, buf);
|
||||
}
|
||||
printf("}\n\n");
|
||||
|
||||
printf("\n\n// Signal table\n");
|
||||
printf("var signals = [...]string {\n");
|
||||
qsort(signals, nelem(signals), sizeof signals[0], intcmp);
|
||||
printf("var signalList = [...]struct {\n");
|
||||
printf("\tnum syscall.Signal\n");
|
||||
printf("\tname string\n");
|
||||
printf("\tdesc string\n");
|
||||
printf("} {\n");
|
||||
qsort(signals, nelem(signals), sizeof signals[0], tuplecmp);
|
||||
for(i=0; i<nelem(signals); i++) {
|
||||
e = signals[i];
|
||||
if(i > 0 && signals[i-1] == e)
|
||||
e = signals[i].num;
|
||||
if(i > 0 && signals[i-1].num == e)
|
||||
continue;
|
||||
strcpy(buf, strsignal(e));
|
||||
// lowercase first letter: Bad -> bad, but STREAM -> STREAM.
|
||||
@ -561,7 +644,7 @@ main(void)
|
||||
p = strrchr(buf, ":"[0]);
|
||||
if(p)
|
||||
*p = '\0';
|
||||
printf("\t%d: \"%s\",\n", e, buf);
|
||||
printf("\t{ %d, \"%s\", \"%s\" },\n", e, signals[i].name, buf);
|
||||
}
|
||||
printf("}\n\n");
|
||||
|
||||
|
328
vendor/golang.org/x/sys/unix/mksyscall.pl
generated
vendored
328
vendor/golang.org/x/sys/unix/mksyscall.pl
generated
vendored
@ -1,328 +0,0 @@
|
||||
#!/usr/bin/env perl
|
||||
# Copyright 2009 The Go Authors. All rights reserved.
|
||||
# Use of this source code is governed by a BSD-style
|
||||
# license that can be found in the LICENSE file.
|
||||
|
||||
# This program reads a file containing function prototypes
|
||||
# (like syscall_darwin.go) and generates system call bodies.
|
||||
# The prototypes are marked by lines beginning with "//sys"
|
||||
# and read like func declarations if //sys is replaced by func, but:
|
||||
# * The parameter lists must give a name for each argument.
|
||||
# This includes return parameters.
|
||||
# * The parameter lists must give a type for each argument:
|
||||
# the (x, y, z int) shorthand is not allowed.
|
||||
# * If the return parameter is an error number, it must be named errno.
|
||||
|
||||
# A line beginning with //sysnb is like //sys, except that the
|
||||
# goroutine will not be suspended during the execution of the system
|
||||
# call. This must only be used for system calls which can never
|
||||
# block, as otherwise the system call could cause all goroutines to
|
||||
# hang.
|
||||
|
||||
use strict;
|
||||
|
||||
my $cmdline = "mksyscall.pl " . join(' ', @ARGV);
|
||||
my $errors = 0;
|
||||
my $_32bit = "";
|
||||
my $plan9 = 0;
|
||||
my $openbsd = 0;
|
||||
my $netbsd = 0;
|
||||
my $dragonfly = 0;
|
||||
my $arm = 0; # 64-bit value should use (even, odd)-pair
|
||||
my $tags = ""; # build tags
|
||||
|
||||
if($ARGV[0] eq "-b32") {
|
||||
$_32bit = "big-endian";
|
||||
shift;
|
||||
} elsif($ARGV[0] eq "-l32") {
|
||||
$_32bit = "little-endian";
|
||||
shift;
|
||||
}
|
||||
if($ARGV[0] eq "-plan9") {
|
||||
$plan9 = 1;
|
||||
shift;
|
||||
}
|
||||
if($ARGV[0] eq "-openbsd") {
|
||||
$openbsd = 1;
|
||||
shift;
|
||||
}
|
||||
if($ARGV[0] eq "-netbsd") {
|
||||
$netbsd = 1;
|
||||
shift;
|
||||
}
|
||||
if($ARGV[0] eq "-dragonfly") {
|
||||
$dragonfly = 1;
|
||||
shift;
|
||||
}
|
||||
if($ARGV[0] eq "-arm") {
|
||||
$arm = 1;
|
||||
shift;
|
||||
}
|
||||
if($ARGV[0] eq "-tags") {
|
||||
shift;
|
||||
$tags = $ARGV[0];
|
||||
shift;
|
||||
}
|
||||
|
||||
if($ARGV[0] =~ /^-/) {
|
||||
print STDERR "usage: mksyscall.pl [-b32 | -l32] [-tags x,y] [file ...]\n";
|
||||
exit 1;
|
||||
}
|
||||
|
||||
# Check that we are using the new build system if we should
|
||||
if($ENV{'GOOS'} eq "linux" && $ENV{'GOARCH'} ne "sparc64") {
|
||||
if($ENV{'GOLANG_SYS_BUILD'} ne "docker") {
|
||||
print STDERR "In the new build system, mksyscall should not be called directly.\n";
|
||||
print STDERR "See README.md\n";
|
||||
exit 1;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
sub parseparamlist($) {
|
||||
my ($list) = @_;
|
||||
$list =~ s/^\s*//;
|
||||
$list =~ s/\s*$//;
|
||||
if($list eq "") {
|
||||
return ();
|
||||
}
|
||||
return split(/\s*,\s*/, $list);
|
||||
}
|
||||
|
||||
sub parseparam($) {
|
||||
my ($p) = @_;
|
||||
if($p !~ /^(\S*) (\S*)$/) {
|
||||
print STDERR "$ARGV:$.: malformed parameter: $p\n";
|
||||
$errors = 1;
|
||||
return ("xx", "int");
|
||||
}
|
||||
return ($1, $2);
|
||||
}
|
||||
|
||||
my $text = "";
|
||||
while(<>) {
|
||||
chomp;
|
||||
s/\s+/ /g;
|
||||
s/^\s+//;
|
||||
s/\s+$//;
|
||||
my $nonblock = /^\/\/sysnb /;
|
||||
next if !/^\/\/sys / && !$nonblock;
|
||||
|
||||
# Line must be of the form
|
||||
# func Open(path string, mode int, perm int) (fd int, errno error)
|
||||
# Split into name, in params, out params.
|
||||
if(!/^\/\/sys(nb)? (\w+)\(([^()]*)\)\s*(?:\(([^()]+)\))?\s*(?:=\s*((?i)SYS_[A-Z0-9_]+))?$/) {
|
||||
print STDERR "$ARGV:$.: malformed //sys declaration\n";
|
||||
$errors = 1;
|
||||
next;
|
||||
}
|
||||
my ($func, $in, $out, $sysname) = ($2, $3, $4, $5);
|
||||
|
||||
# Split argument lists on comma.
|
||||
my @in = parseparamlist($in);
|
||||
my @out = parseparamlist($out);
|
||||
|
||||
# Try in vain to keep people from editing this file.
|
||||
# The theory is that they jump into the middle of the file
|
||||
# without reading the header.
|
||||
$text .= "// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT\n\n";
|
||||
|
||||
# Go function header.
|
||||
my $out_decl = @out ? sprintf(" (%s)", join(', ', @out)) : "";
|
||||
$text .= sprintf "func %s(%s)%s {\n", $func, join(', ', @in), $out_decl;
|
||||
|
||||
# Check if err return available
|
||||
my $errvar = "";
|
||||
foreach my $p (@out) {
|
||||
my ($name, $type) = parseparam($p);
|
||||
if($type eq "error") {
|
||||
$errvar = $name;
|
||||
last;
|
||||
}
|
||||
}
|
||||
|
||||
# Prepare arguments to Syscall.
|
||||
my @args = ();
|
||||
my $n = 0;
|
||||
foreach my $p (@in) {
|
||||
my ($name, $type) = parseparam($p);
|
||||
if($type =~ /^\*/) {
|
||||
push @args, "uintptr(unsafe.Pointer($name))";
|
||||
} elsif($type eq "string" && $errvar ne "") {
|
||||
$text .= "\tvar _p$n *byte\n";
|
||||
$text .= "\t_p$n, $errvar = BytePtrFromString($name)\n";
|
||||
$text .= "\tif $errvar != nil {\n\t\treturn\n\t}\n";
|
||||
push @args, "uintptr(unsafe.Pointer(_p$n))";
|
||||
$n++;
|
||||
} elsif($type eq "string") {
|
||||
print STDERR "$ARGV:$.: $func uses string arguments, but has no error return\n";
|
||||
$text .= "\tvar _p$n *byte\n";
|
||||
$text .= "\t_p$n, _ = BytePtrFromString($name)\n";
|
||||
push @args, "uintptr(unsafe.Pointer(_p$n))";
|
||||
$n++;
|
||||
} elsif($type =~ /^\[\](.*)/) {
|
||||
# Convert slice into pointer, length.
|
||||
# Have to be careful not to take address of &a[0] if len == 0:
|
||||
# pass dummy pointer in that case.
|
||||
# Used to pass nil, but some OSes or simulators reject write(fd, nil, 0).
|
||||
$text .= "\tvar _p$n unsafe.Pointer\n";
|
||||
$text .= "\tif len($name) > 0 {\n\t\t_p$n = unsafe.Pointer(\&${name}[0])\n\t}";
|
||||
$text .= " else {\n\t\t_p$n = unsafe.Pointer(&_zero)\n\t}";
|
||||
$text .= "\n";
|
||||
push @args, "uintptr(_p$n)", "uintptr(len($name))";
|
||||
$n++;
|
||||
} elsif($type eq "int64" && ($openbsd || $netbsd)) {
|
||||
push @args, "0";
|
||||
if($_32bit eq "big-endian") {
|
||||
push @args, "uintptr($name>>32)", "uintptr($name)";
|
||||
} elsif($_32bit eq "little-endian") {
|
||||
push @args, "uintptr($name)", "uintptr($name>>32)";
|
||||
} else {
|
||||
push @args, "uintptr($name)";
|
||||
}
|
||||
} elsif($type eq "int64" && $dragonfly) {
|
||||
if ($func !~ /^extp(read|write)/i) {
|
||||
push @args, "0";
|
||||
}
|
||||
if($_32bit eq "big-endian") {
|
||||
push @args, "uintptr($name>>32)", "uintptr($name)";
|
||||
} elsif($_32bit eq "little-endian") {
|
||||
push @args, "uintptr($name)", "uintptr($name>>32)";
|
||||
} else {
|
||||
push @args, "uintptr($name)";
|
||||
}
|
||||
} elsif($type eq "int64" && $_32bit ne "") {
|
||||
if(@args % 2 && $arm) {
|
||||
# arm abi specifies 64-bit argument uses
|
||||
# (even, odd) pair
|
||||
push @args, "0"
|
||||
}
|
||||
if($_32bit eq "big-endian") {
|
||||
push @args, "uintptr($name>>32)", "uintptr($name)";
|
||||
} else {
|
||||
push @args, "uintptr($name)", "uintptr($name>>32)";
|
||||
}
|
||||
} else {
|
||||
push @args, "uintptr($name)";
|
||||
}
|
||||
}
|
||||
|
||||
# Determine which form to use; pad args with zeros.
|
||||
my $asm = "Syscall";
|
||||
if ($nonblock) {
|
||||
$asm = "RawSyscall";
|
||||
}
|
||||
if(@args <= 3) {
|
||||
while(@args < 3) {
|
||||
push @args, "0";
|
||||
}
|
||||
} elsif(@args <= 6) {
|
||||
$asm .= "6";
|
||||
while(@args < 6) {
|
||||
push @args, "0";
|
||||
}
|
||||
} elsif(@args <= 9) {
|
||||
$asm .= "9";
|
||||
while(@args < 9) {
|
||||
push @args, "0";
|
||||
}
|
||||
} else {
|
||||
print STDERR "$ARGV:$.: too many arguments to system call\n";
|
||||
}
|
||||
|
||||
# System call number.
|
||||
if($sysname eq "") {
|
||||
$sysname = "SYS_$func";
|
||||
$sysname =~ s/([a-z])([A-Z])/${1}_$2/g; # turn FooBar into Foo_Bar
|
||||
$sysname =~ y/a-z/A-Z/;
|
||||
}
|
||||
|
||||
# Actual call.
|
||||
my $args = join(', ', @args);
|
||||
my $call = "$asm($sysname, $args)";
|
||||
|
||||
# Assign return values.
|
||||
my $body = "";
|
||||
my @ret = ("_", "_", "_");
|
||||
my $do_errno = 0;
|
||||
for(my $i=0; $i<@out; $i++) {
|
||||
my $p = $out[$i];
|
||||
my ($name, $type) = parseparam($p);
|
||||
my $reg = "";
|
||||
if($name eq "err" && !$plan9) {
|
||||
$reg = "e1";
|
||||
$ret[2] = $reg;
|
||||
$do_errno = 1;
|
||||
} elsif($name eq "err" && $plan9) {
|
||||
$ret[0] = "r0";
|
||||
$ret[2] = "e1";
|
||||
next;
|
||||
} else {
|
||||
$reg = sprintf("r%d", $i);
|
||||
$ret[$i] = $reg;
|
||||
}
|
||||
if($type eq "bool") {
|
||||
$reg = "$reg != 0";
|
||||
}
|
||||
if($type eq "int64" && $_32bit ne "") {
|
||||
# 64-bit number in r1:r0 or r0:r1.
|
||||
if($i+2 > @out) {
|
||||
print STDERR "$ARGV:$.: not enough registers for int64 return\n";
|
||||
}
|
||||
if($_32bit eq "big-endian") {
|
||||
$reg = sprintf("int64(r%d)<<32 | int64(r%d)", $i, $i+1);
|
||||
} else {
|
||||
$reg = sprintf("int64(r%d)<<32 | int64(r%d)", $i+1, $i);
|
||||
}
|
||||
$ret[$i] = sprintf("r%d", $i);
|
||||
$ret[$i+1] = sprintf("r%d", $i+1);
|
||||
}
|
||||
if($reg ne "e1" || $plan9) {
|
||||
$body .= "\t$name = $type($reg)\n";
|
||||
}
|
||||
}
|
||||
if ($ret[0] eq "_" && $ret[1] eq "_" && $ret[2] eq "_") {
|
||||
$text .= "\t$call\n";
|
||||
} else {
|
||||
$text .= "\t$ret[0], $ret[1], $ret[2] := $call\n";
|
||||
}
|
||||
$text .= $body;
|
||||
|
||||
if ($plan9 && $ret[2] eq "e1") {
|
||||
$text .= "\tif int32(r0) == -1 {\n";
|
||||
$text .= "\t\terr = e1\n";
|
||||
$text .= "\t}\n";
|
||||
} elsif ($do_errno) {
|
||||
$text .= "\tif e1 != 0 {\n";
|
||||
$text .= "\t\terr = errnoErr(e1)\n";
|
||||
$text .= "\t}\n";
|
||||
}
|
||||
$text .= "\treturn\n";
|
||||
$text .= "}\n\n";
|
||||
}
|
||||
|
||||
chomp $text;
|
||||
chomp $text;
|
||||
|
||||
if($errors) {
|
||||
exit 1;
|
||||
}
|
||||
|
||||
print <<EOF;
|
||||
// $cmdline
|
||||
// Code generated by the command above; see README.md. DO NOT EDIT.
|
||||
|
||||
// +build $tags
|
||||
|
||||
package unix
|
||||
|
||||
import (
|
||||
"syscall"
|
||||
"unsafe"
|
||||
)
|
||||
|
||||
var _ syscall.Errno
|
||||
|
||||
$text
|
||||
EOF
|
||||
exit 0;
|
289
vendor/golang.org/x/sys/unix/mksyscall_solaris.pl
generated
vendored
289
vendor/golang.org/x/sys/unix/mksyscall_solaris.pl
generated
vendored
@ -1,289 +0,0 @@
|
||||
#!/usr/bin/env perl
|
||||
# Copyright 2009 The Go Authors. All rights reserved.
|
||||
# Use of this source code is governed by a BSD-style
|
||||
# license that can be found in the LICENSE file.
|
||||
|
||||
# This program reads a file containing function prototypes
|
||||
# (like syscall_solaris.go) and generates system call bodies.
|
||||
# The prototypes are marked by lines beginning with "//sys"
|
||||
# and read like func declarations if //sys is replaced by func, but:
|
||||
# * The parameter lists must give a name for each argument.
|
||||
# This includes return parameters.
|
||||
# * The parameter lists must give a type for each argument:
|
||||
# the (x, y, z int) shorthand is not allowed.
|
||||
# * If the return parameter is an error number, it must be named err.
|
||||
# * If go func name needs to be different than its libc name,
|
||||
# * or the function is not in libc, name could be specified
|
||||
# * at the end, after "=" sign, like
|
||||
# //sys getsockopt(s int, level int, name int, val uintptr, vallen *_Socklen) (err error) = libsocket.getsockopt
|
||||
|
||||
use strict;
|
||||
|
||||
my $cmdline = "mksyscall_solaris.pl " . join(' ', @ARGV);
|
||||
my $errors = 0;
|
||||
my $_32bit = "";
|
||||
my $tags = ""; # build tags
|
||||
|
||||
binmode STDOUT;
|
||||
|
||||
if($ARGV[0] eq "-b32") {
|
||||
$_32bit = "big-endian";
|
||||
shift;
|
||||
} elsif($ARGV[0] eq "-l32") {
|
||||
$_32bit = "little-endian";
|
||||
shift;
|
||||
}
|
||||
if($ARGV[0] eq "-tags") {
|
||||
shift;
|
||||
$tags = $ARGV[0];
|
||||
shift;
|
||||
}
|
||||
|
||||
if($ARGV[0] =~ /^-/) {
|
||||
print STDERR "usage: mksyscall_solaris.pl [-b32 | -l32] [-tags x,y] [file ...]\n";
|
||||
exit 1;
|
||||
}
|
||||
|
||||
sub parseparamlist($) {
|
||||
my ($list) = @_;
|
||||
$list =~ s/^\s*//;
|
||||
$list =~ s/\s*$//;
|
||||
if($list eq "") {
|
||||
return ();
|
||||
}
|
||||
return split(/\s*,\s*/, $list);
|
||||
}
|
||||
|
||||
sub parseparam($) {
|
||||
my ($p) = @_;
|
||||
if($p !~ /^(\S*) (\S*)$/) {
|
||||
print STDERR "$ARGV:$.: malformed parameter: $p\n";
|
||||
$errors = 1;
|
||||
return ("xx", "int");
|
||||
}
|
||||
return ($1, $2);
|
||||
}
|
||||
|
||||
my $package = "";
|
||||
my $text = "";
|
||||
my $dynimports = "";
|
||||
my $linknames = "";
|
||||
my @vars = ();
|
||||
while(<>) {
|
||||
chomp;
|
||||
s/\s+/ /g;
|
||||
s/^\s+//;
|
||||
s/\s+$//;
|
||||
$package = $1 if !$package && /^package (\S+)$/;
|
||||
my $nonblock = /^\/\/sysnb /;
|
||||
next if !/^\/\/sys / && !$nonblock;
|
||||
|
||||
# Line must be of the form
|
||||
# func Open(path string, mode int, perm int) (fd int, err error)
|
||||
# Split into name, in params, out params.
|
||||
if(!/^\/\/sys(nb)? (\w+)\(([^()]*)\)\s*(?:\(([^()]+)\))?\s*(?:=\s*(?:(\w*)\.)?(\w*))?$/) {
|
||||
print STDERR "$ARGV:$.: malformed //sys declaration\n";
|
||||
$errors = 1;
|
||||
next;
|
||||
}
|
||||
my ($nb, $func, $in, $out, $modname, $sysname) = ($1, $2, $3, $4, $5, $6);
|
||||
|
||||
# Split argument lists on comma.
|
||||
my @in = parseparamlist($in);
|
||||
my @out = parseparamlist($out);
|
||||
|
||||
# So file name.
|
||||
if($modname eq "") {
|
||||
$modname = "libc";
|
||||
}
|
||||
|
||||
# System call name.
|
||||
if($sysname eq "") {
|
||||
$sysname = "$func";
|
||||
}
|
||||
|
||||
# System call pointer variable name.
|
||||
my $sysvarname = "proc$sysname";
|
||||
|
||||
my $strconvfunc = "BytePtrFromString";
|
||||
my $strconvtype = "*byte";
|
||||
|
||||
$sysname =~ y/A-Z/a-z/; # All libc functions are lowercase.
|
||||
|
||||
# Runtime import of function to allow cross-platform builds.
|
||||
$dynimports .= "//go:cgo_import_dynamic libc_${sysname} ${sysname} \"$modname.so\"\n";
|
||||
# Link symbol to proc address variable.
|
||||
$linknames .= "//go:linkname ${sysvarname} libc_${sysname}\n";
|
||||
# Library proc address variable.
|
||||
push @vars, $sysvarname;
|
||||
|
||||
# Go function header.
|
||||
$out = join(', ', @out);
|
||||
if($out ne "") {
|
||||
$out = " ($out)";
|
||||
}
|
||||
if($text ne "") {
|
||||
$text .= "\n"
|
||||
}
|
||||
$text .= sprintf "func %s(%s)%s {\n", $func, join(', ', @in), $out;
|
||||
|
||||
# Check if err return available
|
||||
my $errvar = "";
|
||||
foreach my $p (@out) {
|
||||
my ($name, $type) = parseparam($p);
|
||||
if($type eq "error") {
|
||||
$errvar = $name;
|
||||
last;
|
||||
}
|
||||
}
|
||||
|
||||
# Prepare arguments to Syscall.
|
||||
my @args = ();
|
||||
my $n = 0;
|
||||
foreach my $p (@in) {
|
||||
my ($name, $type) = parseparam($p);
|
||||
if($type =~ /^\*/) {
|
||||
push @args, "uintptr(unsafe.Pointer($name))";
|
||||
} elsif($type eq "string" && $errvar ne "") {
|
||||
$text .= "\tvar _p$n $strconvtype\n";
|
||||
$text .= "\t_p$n, $errvar = $strconvfunc($name)\n";
|
||||
$text .= "\tif $errvar != nil {\n\t\treturn\n\t}\n";
|
||||
push @args, "uintptr(unsafe.Pointer(_p$n))";
|
||||
$n++;
|
||||
} elsif($type eq "string") {
|
||||
print STDERR "$ARGV:$.: $func uses string arguments, but has no error return\n";
|
||||
$text .= "\tvar _p$n $strconvtype\n";
|
||||
$text .= "\t_p$n, _ = $strconvfunc($name)\n";
|
||||
push @args, "uintptr(unsafe.Pointer(_p$n))";
|
||||
$n++;
|
||||
} elsif($type =~ /^\[\](.*)/) {
|
||||
# Convert slice into pointer, length.
|
||||
# Have to be careful not to take address of &a[0] if len == 0:
|
||||
# pass nil in that case.
|
||||
$text .= "\tvar _p$n *$1\n";
|
||||
$text .= "\tif len($name) > 0 {\n\t\t_p$n = \&$name\[0]\n\t}\n";
|
||||
push @args, "uintptr(unsafe.Pointer(_p$n))", "uintptr(len($name))";
|
||||
$n++;
|
||||
} elsif($type eq "int64" && $_32bit ne "") {
|
||||
if($_32bit eq "big-endian") {
|
||||
push @args, "uintptr($name >> 32)", "uintptr($name)";
|
||||
} else {
|
||||
push @args, "uintptr($name)", "uintptr($name >> 32)";
|
||||
}
|
||||
} elsif($type eq "bool") {
|
||||
$text .= "\tvar _p$n uint32\n";
|
||||
$text .= "\tif $name {\n\t\t_p$n = 1\n\t} else {\n\t\t_p$n = 0\n\t}\n";
|
||||
push @args, "uintptr(_p$n)";
|
||||
$n++;
|
||||
} else {
|
||||
push @args, "uintptr($name)";
|
||||
}
|
||||
}
|
||||
my $nargs = @args;
|
||||
|
||||
# Determine which form to use; pad args with zeros.
|
||||
my $asm = "sysvicall6";
|
||||
if ($nonblock) {
|
||||
$asm = "rawSysvicall6";
|
||||
}
|
||||
if(@args <= 6) {
|
||||
while(@args < 6) {
|
||||
push @args, "0";
|
||||
}
|
||||
} else {
|
||||
print STDERR "$ARGV:$.: too many arguments to system call\n";
|
||||
}
|
||||
|
||||
# Actual call.
|
||||
my $args = join(', ', @args);
|
||||
my $call = "$asm(uintptr(unsafe.Pointer(&$sysvarname)), $nargs, $args)";
|
||||
|
||||
# Assign return values.
|
||||
my $body = "";
|
||||
my $failexpr = "";
|
||||
my @ret = ("_", "_", "_");
|
||||
my @pout= ();
|
||||
my $do_errno = 0;
|
||||
for(my $i=0; $i<@out; $i++) {
|
||||
my $p = $out[$i];
|
||||
my ($name, $type) = parseparam($p);
|
||||
my $reg = "";
|
||||
if($name eq "err") {
|
||||
$reg = "e1";
|
||||
$ret[2] = $reg;
|
||||
$do_errno = 1;
|
||||
} else {
|
||||
$reg = sprintf("r%d", $i);
|
||||
$ret[$i] = $reg;
|
||||
}
|
||||
if($type eq "bool") {
|
||||
$reg = "$reg != 0";
|
||||
}
|
||||
if($type eq "int64" && $_32bit ne "") {
|
||||
# 64-bit number in r1:r0 or r0:r1.
|
||||
if($i+2 > @out) {
|
||||
print STDERR "$ARGV:$.: not enough registers for int64 return\n";
|
||||
}
|
||||
if($_32bit eq "big-endian") {
|
||||
$reg = sprintf("int64(r%d)<<32 | int64(r%d)", $i, $i+1);
|
||||
} else {
|
||||
$reg = sprintf("int64(r%d)<<32 | int64(r%d)", $i+1, $i);
|
||||
}
|
||||
$ret[$i] = sprintf("r%d", $i);
|
||||
$ret[$i+1] = sprintf("r%d", $i+1);
|
||||
}
|
||||
if($reg ne "e1") {
|
||||
$body .= "\t$name = $type($reg)\n";
|
||||
}
|
||||
}
|
||||
if ($ret[0] eq "_" && $ret[1] eq "_" && $ret[2] eq "_") {
|
||||
$text .= "\t$call\n";
|
||||
} else {
|
||||
$text .= "\t$ret[0], $ret[1], $ret[2] := $call\n";
|
||||
}
|
||||
$text .= $body;
|
||||
|
||||
if ($do_errno) {
|
||||
$text .= "\tif e1 != 0 {\n";
|
||||
$text .= "\t\terr = e1\n";
|
||||
$text .= "\t}\n";
|
||||
}
|
||||
$text .= "\treturn\n";
|
||||
$text .= "}\n";
|
||||
}
|
||||
|
||||
if($errors) {
|
||||
exit 1;
|
||||
}
|
||||
|
||||
print <<EOF;
|
||||
// $cmdline
|
||||
// Code generated by the command above; see README.md. DO NOT EDIT.
|
||||
|
||||
// +build $tags
|
||||
|
||||
package $package
|
||||
|
||||
import (
|
||||
"syscall"
|
||||
"unsafe"
|
||||
)
|
||||
EOF
|
||||
|
||||
print "import \"golang.org/x/sys/unix\"\n" if $package ne "unix";
|
||||
|
||||
my $vardecls = "\t" . join(",\n\t", @vars);
|
||||
$vardecls .= " syscallFunc";
|
||||
|
||||
chomp($_=<<EOF);
|
||||
|
||||
$dynimports
|
||||
$linknames
|
||||
var (
|
||||
$vardecls
|
||||
)
|
||||
|
||||
$text
|
||||
EOF
|
||||
print $_;
|
||||
exit 0;
|
3
vendor/golang.org/x/sys/unix/mksysctl_openbsd.pl
generated
vendored
3
vendor/golang.org/x/sys/unix/mksysctl_openbsd.pl
generated
vendored
@ -32,6 +32,7 @@ my @headers = qw (
|
||||
sys/sem.h
|
||||
sys/shm.h
|
||||
sys/vmmeter.h
|
||||
uvm/uvmexp.h
|
||||
uvm/uvm_param.h
|
||||
uvm/uvm_swap_encrypt.h
|
||||
ddb/db_var.h
|
||||
@ -240,7 +241,7 @@ foreach my $header (@headers) {
|
||||
|
||||
print <<EOF;
|
||||
// mksysctl_openbsd.pl
|
||||
// MACHINE GENERATED BY THE ABOVE COMMAND; DO NOT EDIT
|
||||
// Code generated by the command above; DO NOT EDIT.
|
||||
|
||||
// +build $ENV{'GOARCH'},$ENV{'GOOS'}
|
||||
|
||||
|
39
vendor/golang.org/x/sys/unix/mksysnum_darwin.pl
generated
vendored
39
vendor/golang.org/x/sys/unix/mksysnum_darwin.pl
generated
vendored
@ -1,39 +0,0 @@
|
||||
#!/usr/bin/env perl
|
||||
# Copyright 2009 The Go Authors. All rights reserved.
|
||||
# Use of this source code is governed by a BSD-style
|
||||
# license that can be found in the LICENSE file.
|
||||
#
|
||||
# Generate system call table for Darwin from sys/syscall.h
|
||||
|
||||
use strict;
|
||||
|
||||
if($ENV{'GOARCH'} eq "" || $ENV{'GOOS'} eq "") {
|
||||
print STDERR "GOARCH or GOOS not defined in environment\n";
|
||||
exit 1;
|
||||
}
|
||||
|
||||
my $command = "mksysnum_darwin.pl " . join(' ', @ARGV);
|
||||
|
||||
print <<EOF;
|
||||
// $command
|
||||
// Code generated by the command above; see README.md. DO NOT EDIT.
|
||||
|
||||
// +build $ENV{'GOARCH'},$ENV{'GOOS'}
|
||||
|
||||
package unix
|
||||
|
||||
const (
|
||||
EOF
|
||||
|
||||
while(<>){
|
||||
if(/^#define\s+SYS_(\w+)\s+([0-9]+)/){
|
||||
my $name = $1;
|
||||
my $num = $2;
|
||||
$name =~ y/a-z/A-Z/;
|
||||
print " SYS_$name = $num;"
|
||||
}
|
||||
}
|
||||
|
||||
print <<EOF;
|
||||
)
|
||||
EOF
|
50
vendor/golang.org/x/sys/unix/mksysnum_dragonfly.pl
generated
vendored
50
vendor/golang.org/x/sys/unix/mksysnum_dragonfly.pl
generated
vendored
@ -1,50 +0,0 @@
|
||||
#!/usr/bin/env perl
|
||||
# Copyright 2009 The Go Authors. All rights reserved.
|
||||
# Use of this source code is governed by a BSD-style
|
||||
# license that can be found in the LICENSE file.
|
||||
#
|
||||
# Generate system call table for DragonFly from master list
|
||||
# (for example, /usr/src/sys/kern/syscalls.master).
|
||||
|
||||
use strict;
|
||||
|
||||
if($ENV{'GOARCH'} eq "" || $ENV{'GOOS'} eq "") {
|
||||
print STDERR "GOARCH or GOOS not defined in environment\n";
|
||||
exit 1;
|
||||
}
|
||||
|
||||
my $command = "mksysnum_dragonfly.pl " . join(' ', @ARGV);
|
||||
|
||||
print <<EOF;
|
||||
// $command
|
||||
// Code generated by the command above; see README.md. DO NOT EDIT.
|
||||
|
||||
// +build $ENV{'GOARCH'},$ENV{'GOOS'}
|
||||
|
||||
package unix
|
||||
|
||||
const (
|
||||
EOF
|
||||
|
||||
while(<>){
|
||||
if(/^([0-9]+)\s+STD\s+({ \S+\s+(\w+).*)$/){
|
||||
my $num = $1;
|
||||
my $proto = $2;
|
||||
my $name = "SYS_$3";
|
||||
$name =~ y/a-z/A-Z/;
|
||||
|
||||
# There are multiple entries for enosys and nosys, so comment them out.
|
||||
if($name =~ /^SYS_E?NOSYS$/){
|
||||
$name = "// $name";
|
||||
}
|
||||
if($name eq 'SYS_SYS_EXIT'){
|
||||
$name = 'SYS_EXIT';
|
||||
}
|
||||
|
||||
print " $name = $num; // $proto\n";
|
||||
}
|
||||
}
|
||||
|
||||
print <<EOF;
|
||||
)
|
||||
EOF
|
50
vendor/golang.org/x/sys/unix/mksysnum_freebsd.pl
generated
vendored
50
vendor/golang.org/x/sys/unix/mksysnum_freebsd.pl
generated
vendored
@ -1,50 +0,0 @@
|
||||
#!/usr/bin/env perl
|
||||
# Copyright 2009 The Go Authors. All rights reserved.
|
||||
# Use of this source code is governed by a BSD-style
|
||||
# license that can be found in the LICENSE file.
|
||||
#
|
||||
# Generate system call table for FreeBSD from master list
|
||||
# (for example, /usr/src/sys/kern/syscalls.master).
|
||||
|
||||
use strict;
|
||||
|
||||
if($ENV{'GOARCH'} eq "" || $ENV{'GOOS'} eq "") {
|
||||
print STDERR "GOARCH or GOOS not defined in environment\n";
|
||||
exit 1;
|
||||
}
|
||||
|
||||
my $command = "mksysnum_freebsd.pl " . join(' ', @ARGV);
|
||||
|
||||
print <<EOF;
|
||||
// $command
|
||||
// Code generated by the command above; see README.md. DO NOT EDIT.
|
||||
|
||||
// +build $ENV{'GOARCH'},$ENV{'GOOS'}
|
||||
|
||||
package unix
|
||||
|
||||
const (
|
||||
EOF
|
||||
|
||||
while(<>){
|
||||
if(/^([0-9]+)\s+\S+\s+STD\s+({ \S+\s+(\w+).*)$/){
|
||||
my $num = $1;
|
||||
my $proto = $2;
|
||||
my $name = "SYS_$3";
|
||||
$name =~ y/a-z/A-Z/;
|
||||
|
||||
# There are multiple entries for enosys and nosys, so comment them out.
|
||||
if($name =~ /^SYS_E?NOSYS$/){
|
||||
$name = "// $name";
|
||||
}
|
||||
if($name eq 'SYS_SYS_EXIT'){
|
||||
$name = 'SYS_EXIT';
|
||||
}
|
||||
|
||||
print " $name = $num; // $proto\n";
|
||||
}
|
||||
}
|
||||
|
||||
print <<EOF;
|
||||
)
|
||||
EOF
|
58
vendor/golang.org/x/sys/unix/mksysnum_netbsd.pl
generated
vendored
58
vendor/golang.org/x/sys/unix/mksysnum_netbsd.pl
generated
vendored
@ -1,58 +0,0 @@
|
||||
#!/usr/bin/env perl
|
||||
# Copyright 2009 The Go Authors. All rights reserved.
|
||||
# Use of this source code is governed by a BSD-style
|
||||
# license that can be found in the LICENSE file.
|
||||
#
|
||||
# Generate system call table for OpenBSD from master list
|
||||
# (for example, /usr/src/sys/kern/syscalls.master).
|
||||
|
||||
use strict;
|
||||
|
||||
if($ENV{'GOARCH'} eq "" || $ENV{'GOOS'} eq "") {
|
||||
print STDERR "GOARCH or GOOS not defined in environment\n";
|
||||
exit 1;
|
||||
}
|
||||
|
||||
my $command = "mksysnum_netbsd.pl " . join(' ', @ARGV);
|
||||
|
||||
print <<EOF;
|
||||
// $command
|
||||
// Code generated by the command above; see README.md. DO NOT EDIT.
|
||||
|
||||
// +build $ENV{'GOARCH'},$ENV{'GOOS'}
|
||||
|
||||
package unix
|
||||
|
||||
const (
|
||||
EOF
|
||||
|
||||
my $line = '';
|
||||
while(<>){
|
||||
if($line =~ /^(.*)\\$/) {
|
||||
# Handle continuation
|
||||
$line = $1;
|
||||
$_ =~ s/^\s+//;
|
||||
$line .= $_;
|
||||
} else {
|
||||
# New line
|
||||
$line = $_;
|
||||
}
|
||||
next if $line =~ /\\$/;
|
||||
if($line =~ /^([0-9]+)\s+((STD)|(NOERR))\s+(RUMP\s+)?({\s+\S+\s*\*?\s*\|(\S+)\|(\S*)\|(\w+).*\s+})(\s+(\S+))?$/) {
|
||||
my $num = $1;
|
||||
my $proto = $6;
|
||||
my $compat = $8;
|
||||
my $name = "$7_$9";
|
||||
|
||||
$name = "$7_$11" if $11 ne '';
|
||||
$name =~ y/a-z/A-Z/;
|
||||
|
||||
if($compat eq '' || $compat eq '13' || $compat eq '30' || $compat eq '50') {
|
||||
print " $name = $num; // $proto\n";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
print <<EOF;
|
||||
)
|
||||
EOF
|
50
vendor/golang.org/x/sys/unix/mksysnum_openbsd.pl
generated
vendored
50
vendor/golang.org/x/sys/unix/mksysnum_openbsd.pl
generated
vendored
@ -1,50 +0,0 @@
|
||||
#!/usr/bin/env perl
|
||||
# Copyright 2009 The Go Authors. All rights reserved.
|
||||
# Use of this source code is governed by a BSD-style
|
||||
# license that can be found in the LICENSE file.
|
||||
#
|
||||
# Generate system call table for OpenBSD from master list
|
||||
# (for example, /usr/src/sys/kern/syscalls.master).
|
||||
|
||||
use strict;
|
||||
|
||||
if($ENV{'GOARCH'} eq "" || $ENV{'GOOS'} eq "") {
|
||||
print STDERR "GOARCH or GOOS not defined in environment\n";
|
||||
exit 1;
|
||||
}
|
||||
|
||||
my $command = "mksysnum_openbsd.pl " . join(' ', @ARGV);
|
||||
|
||||
print <<EOF;
|
||||
// $command
|
||||
// Code generated by the command above; see README.md. DO NOT EDIT.
|
||||
|
||||
// +build $ENV{'GOARCH'},$ENV{'GOOS'}
|
||||
|
||||
package unix
|
||||
|
||||
const (
|
||||
EOF
|
||||
|
||||
while(<>){
|
||||
if(/^([0-9]+)\s+STD\s+(NOLOCK\s+)?({ \S+\s+\*?(\w+).*)$/){
|
||||
my $num = $1;
|
||||
my $proto = $3;
|
||||
my $name = $4;
|
||||
$name =~ y/a-z/A-Z/;
|
||||
|
||||
# There are multiple entries for enosys and nosys, so comment them out.
|
||||
if($name =~ /^SYS_E?NOSYS$/){
|
||||
$name = "// $name";
|
||||
}
|
||||
if($name eq 'SYS_SYS_EXIT'){
|
||||
$name = 'SYS_EXIT';
|
||||
}
|
||||
|
||||
print " $name = $num; // $proto\n";
|
||||
}
|
||||
}
|
||||
|
||||
print <<EOF;
|
||||
)
|
||||
EOF
|
154
vendor/golang.org/x/sys/unix/openbsd_pledge.go
generated
vendored
154
vendor/golang.org/x/sys/unix/openbsd_pledge.go
generated
vendored
@ -8,31 +8,159 @@
|
||||
package unix
|
||||
|
||||
import (
|
||||
"errors"
|
||||
"fmt"
|
||||
"strconv"
|
||||
"syscall"
|
||||
"unsafe"
|
||||
)
|
||||
|
||||
const (
|
||||
SYS_PLEDGE = 108
|
||||
)
|
||||
|
||||
// Pledge implements the pledge syscall. For more information see pledge(2).
|
||||
func Pledge(promises string, paths []string) error {
|
||||
promisesPtr, err := syscall.BytePtrFromString(promises)
|
||||
// Pledge implements the pledge syscall.
|
||||
//
|
||||
// The pledge syscall does not accept execpromises on OpenBSD releases
|
||||
// before 6.3.
|
||||
//
|
||||
// execpromises must be empty when Pledge is called on OpenBSD
|
||||
// releases predating 6.3, otherwise an error will be returned.
|
||||
//
|
||||
// For more information see pledge(2).
|
||||
func Pledge(promises, execpromises string) error {
|
||||
maj, min, err := majmin()
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
promisesUnsafe, pathsUnsafe := unsafe.Pointer(promisesPtr), unsafe.Pointer(nil)
|
||||
if paths != nil {
|
||||
var pathsPtr []*byte
|
||||
if pathsPtr, err = syscall.SlicePtrFromStrings(paths); err != nil {
|
||||
|
||||
err = pledgeAvailable(maj, min, execpromises)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
pptr, err := syscall.BytePtrFromString(promises)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
// This variable will hold either a nil unsafe.Pointer or
|
||||
// an unsafe.Pointer to a string (execpromises).
|
||||
var expr unsafe.Pointer
|
||||
|
||||
// If we're running on OpenBSD > 6.2, pass execpromises to the syscall.
|
||||
if maj > 6 || (maj == 6 && min > 2) {
|
||||
exptr, err := syscall.BytePtrFromString(execpromises)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
pathsUnsafe = unsafe.Pointer(&pathsPtr[0])
|
||||
expr = unsafe.Pointer(exptr)
|
||||
}
|
||||
_, _, e := syscall.Syscall(SYS_PLEDGE, uintptr(promisesUnsafe), uintptr(pathsUnsafe), 0)
|
||||
|
||||
_, _, e := syscall.Syscall(SYS_PLEDGE, uintptr(unsafe.Pointer(pptr)), uintptr(expr), 0)
|
||||
if e != 0 {
|
||||
return e
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
// PledgePromises implements the pledge syscall.
|
||||
//
|
||||
// This changes the promises and leaves the execpromises untouched.
|
||||
//
|
||||
// For more information see pledge(2).
|
||||
func PledgePromises(promises string) error {
|
||||
maj, min, err := majmin()
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
err = pledgeAvailable(maj, min, "")
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
// This variable holds the execpromises and is always nil.
|
||||
var expr unsafe.Pointer
|
||||
|
||||
pptr, err := syscall.BytePtrFromString(promises)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
_, _, e := syscall.Syscall(SYS_PLEDGE, uintptr(unsafe.Pointer(pptr)), uintptr(expr), 0)
|
||||
if e != 0 {
|
||||
return e
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
// PledgeExecpromises implements the pledge syscall.
|
||||
//
|
||||
// This changes the execpromises and leaves the promises untouched.
|
||||
//
|
||||
// For more information see pledge(2).
|
||||
func PledgeExecpromises(execpromises string) error {
|
||||
maj, min, err := majmin()
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
err = pledgeAvailable(maj, min, execpromises)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
// This variable holds the promises and is always nil.
|
||||
var pptr unsafe.Pointer
|
||||
|
||||
exptr, err := syscall.BytePtrFromString(execpromises)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
_, _, e := syscall.Syscall(SYS_PLEDGE, uintptr(pptr), uintptr(unsafe.Pointer(exptr)), 0)
|
||||
if e != 0 {
|
||||
return e
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
// majmin returns major and minor version number for an OpenBSD system.
|
||||
func majmin() (major int, minor int, err error) {
|
||||
var v Utsname
|
||||
err = Uname(&v)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
|
||||
major, err = strconv.Atoi(string(v.Release[0]))
|
||||
if err != nil {
|
||||
err = errors.New("cannot parse major version number returned by uname")
|
||||
return
|
||||
}
|
||||
|
||||
minor, err = strconv.Atoi(string(v.Release[2]))
|
||||
if err != nil {
|
||||
err = errors.New("cannot parse minor version number returned by uname")
|
||||
return
|
||||
}
|
||||
|
||||
return
|
||||
}
|
||||
|
||||
// pledgeAvailable checks for availability of the pledge(2) syscall
|
||||
// based on the running OpenBSD version.
|
||||
func pledgeAvailable(maj, min int, execpromises string) error {
|
||||
// If OpenBSD <= 5.9, pledge is not available.
|
||||
if (maj == 5 && min != 9) || maj < 5 {
|
||||
return fmt.Errorf("pledge syscall is not available on OpenBSD %d.%d", maj, min)
|
||||
}
|
||||
|
||||
// If OpenBSD <= 6.2 and execpromises is not empty,
|
||||
// return an error - execpromises is not available before 6.3
|
||||
if (maj < 6 || (maj == 6 && min <= 2)) && execpromises != "" {
|
||||
return fmt.Errorf("cannot use execpromises on OpenBSD %d.%d", maj, min)
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
44
vendor/golang.org/x/sys/unix/openbsd_unveil.go
generated
vendored
Normal file
44
vendor/golang.org/x/sys/unix/openbsd_unveil.go
generated
vendored
Normal file
@ -0,0 +1,44 @@
|
||||
// Copyright 2018 The Go Authors. All rights reserved.
|
||||
// Use of this source code is governed by a BSD-style
|
||||
// license that can be found in the LICENSE file.
|
||||
|
||||
// +build openbsd
|
||||
|
||||
package unix
|
||||
|
||||
import (
|
||||
"syscall"
|
||||
"unsafe"
|
||||
)
|
||||
|
||||
// Unveil implements the unveil syscall.
|
||||
// For more information see unveil(2).
|
||||
// Note that the special case of blocking further
|
||||
// unveil calls is handled by UnveilBlock.
|
||||
func Unveil(path string, flags string) error {
|
||||
pathPtr, err := syscall.BytePtrFromString(path)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
flagsPtr, err := syscall.BytePtrFromString(flags)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
_, _, e := syscall.Syscall(SYS_UNVEIL, uintptr(unsafe.Pointer(pathPtr)), uintptr(unsafe.Pointer(flagsPtr)), 0)
|
||||
if e != 0 {
|
||||
return e
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// UnveilBlock blocks future unveil calls.
|
||||
// For more information see unveil(2).
|
||||
func UnveilBlock() error {
|
||||
// Both pointers must be nil.
|
||||
var pathUnsafe, flagsUnsafe unsafe.Pointer
|
||||
_, _, e := syscall.Syscall(SYS_UNVEIL, uintptr(pathUnsafe), uintptr(flagsUnsafe), 0)
|
||||
if e != 0 {
|
||||
return e
|
||||
}
|
||||
return nil
|
||||
}
|
2
vendor/golang.org/x/sys/unix/pagesize_unix.go
generated
vendored
2
vendor/golang.org/x/sys/unix/pagesize_unix.go
generated
vendored
@ -2,7 +2,7 @@
|
||||
// Use of this source code is governed by a BSD-style
|
||||
// license that can be found in the LICENSE file.
|
||||
|
||||
// +build darwin dragonfly freebsd linux netbsd openbsd solaris
|
||||
// +build aix darwin dragonfly freebsd linux netbsd openbsd solaris
|
||||
|
||||
// For Unix, get the pagesize from the runtime.
|
||||
|
||||
|
2
vendor/golang.org/x/sys/unix/race0.go
generated
vendored
2
vendor/golang.org/x/sys/unix/race0.go
generated
vendored
@ -2,7 +2,7 @@
|
||||
// Use of this source code is governed by a BSD-style
|
||||
// license that can be found in the LICENSE file.
|
||||
|
||||
// +build darwin,!race linux,!race freebsd,!race netbsd openbsd solaris dragonfly
|
||||
// +build aix darwin,!race linux,!race freebsd,!race netbsd openbsd solaris dragonfly
|
||||
|
||||
package unix
|
||||
|
||||
|
29
vendor/golang.org/x/sys/unix/sockcmsg_unix.go
generated
vendored
29
vendor/golang.org/x/sys/unix/sockcmsg_unix.go
generated
vendored
@ -2,23 +2,36 @@
|
||||
// Use of this source code is governed by a BSD-style
|
||||
// license that can be found in the LICENSE file.
|
||||
|
||||
// +build darwin dragonfly freebsd linux netbsd openbsd solaris
|
||||
// +build aix darwin dragonfly freebsd linux netbsd openbsd solaris
|
||||
|
||||
// Socket control messages
|
||||
|
||||
package unix
|
||||
|
||||
import "unsafe"
|
||||
import (
|
||||
"runtime"
|
||||
"unsafe"
|
||||
)
|
||||
|
||||
// Round the length of a raw sockaddr up to align it properly.
|
||||
func cmsgAlignOf(salen int) int {
|
||||
salign := sizeofPtr
|
||||
// NOTE: It seems like 64-bit Darwin, DragonFly BSD and
|
||||
// Solaris kernels still require 32-bit aligned access to
|
||||
// network subsystem.
|
||||
if darwin64Bit || dragonfly64Bit || solaris64Bit {
|
||||
salign = 4
|
||||
salign := SizeofPtr
|
||||
|
||||
switch runtime.GOOS {
|
||||
case "darwin", "dragonfly", "solaris":
|
||||
// NOTE: It seems like 64-bit Darwin, DragonFly BSD and
|
||||
// Solaris kernels still require 32-bit aligned access to
|
||||
// network subsystem.
|
||||
if SizeofPtr == 8 {
|
||||
salign = 4
|
||||
}
|
||||
case "openbsd":
|
||||
// OpenBSD armv7 requires 64-bit alignment.
|
||||
if runtime.GOARCH == "arm" {
|
||||
salign = 8
|
||||
}
|
||||
}
|
||||
|
||||
return (salen + salign - 1) & ^(salign - 1)
|
||||
}
|
||||
|
||||
|
2
vendor/golang.org/x/sys/unix/str.go
generated
vendored
2
vendor/golang.org/x/sys/unix/str.go
generated
vendored
@ -2,7 +2,7 @@
|
||||
// Use of this source code is governed by a BSD-style
|
||||
// license that can be found in the LICENSE file.
|
||||
|
||||
// +build darwin dragonfly freebsd linux netbsd openbsd solaris
|
||||
// +build aix darwin dragonfly freebsd linux netbsd openbsd solaris
|
||||
|
||||
package unix
|
||||
|
||||
|
13
vendor/golang.org/x/sys/unix/syscall.go
generated
vendored
13
vendor/golang.org/x/sys/unix/syscall.go
generated
vendored
@ -2,7 +2,7 @@
|
||||
// Use of this source code is governed by a BSD-style
|
||||
// license that can be found in the LICENSE file.
|
||||
|
||||
// +build darwin dragonfly freebsd linux netbsd openbsd solaris
|
||||
// +build aix darwin dragonfly freebsd linux netbsd openbsd solaris
|
||||
|
||||
// Package unix contains an interface to the low-level operating system
|
||||
// primitives. OS details vary depending on the underlying system, and
|
||||
@ -11,24 +11,27 @@
|
||||
// system, set $GOOS and $GOARCH to the desired system. For example, if
|
||||
// you want to view documentation for freebsd/arm on linux/amd64, set $GOOS
|
||||
// to freebsd and $GOARCH to arm.
|
||||
//
|
||||
// The primary use of this package is inside other packages that provide a more
|
||||
// portable interface to the system, such as "os", "time" and "net". Use
|
||||
// those packages rather than this one if you can.
|
||||
//
|
||||
// For details of the functions and data types in this package consult
|
||||
// the manuals for the appropriate operating system.
|
||||
//
|
||||
// These calls return err == nil to indicate success; otherwise
|
||||
// err represents an operating system error describing the failure and
|
||||
// holds a value of type syscall.Errno.
|
||||
package unix // import "golang.org/x/sys/unix"
|
||||
|
||||
import "strings"
|
||||
|
||||
// ByteSliceFromString returns a NUL-terminated slice of bytes
|
||||
// containing the text of s. If s contains a NUL byte at any
|
||||
// location, it returns (nil, EINVAL).
|
||||
func ByteSliceFromString(s string) ([]byte, error) {
|
||||
for i := 0; i < len(s); i++ {
|
||||
if s[i] == 0 {
|
||||
return nil, EINVAL
|
||||
}
|
||||
if strings.IndexByte(s, 0) != -1 {
|
||||
return nil, EINVAL
|
||||
}
|
||||
a := make([]byte, len(s)+1)
|
||||
copy(a, s)
|
||||
|
547
vendor/golang.org/x/sys/unix/syscall_aix.go
generated
vendored
Normal file
547
vendor/golang.org/x/sys/unix/syscall_aix.go
generated
vendored
Normal file
@ -0,0 +1,547 @@
|
||||
// Copyright 2018 The Go Authors. All rights reserved.
|
||||
// Use of this source code is governed by a BSD-style
|
||||
// license that can be found in the LICENSE file.
|
||||
|
||||
// +build aix
|
||||
|
||||
// Aix system calls.
|
||||
// This file is compiled as ordinary Go code,
|
||||
// but it is also input to mksyscall,
|
||||
// which parses the //sys lines and generates system call stubs.
|
||||
// Note that sometimes we use a lowercase //sys name and
|
||||
// wrap it in our own nicer implementation.
|
||||
|
||||
package unix
|
||||
|
||||
import "unsafe"
|
||||
|
||||
/*
|
||||
* Wrapped
|
||||
*/
|
||||
|
||||
//sys utimes(path string, times *[2]Timeval) (err error)
|
||||
func Utimes(path string, tv []Timeval) error {
|
||||
if len(tv) != 2 {
|
||||
return EINVAL
|
||||
}
|
||||
return utimes(path, (*[2]Timeval)(unsafe.Pointer(&tv[0])))
|
||||
}
|
||||
|
||||
//sys utimensat(dirfd int, path string, times *[2]Timespec, flag int) (err error)
|
||||
func UtimesNano(path string, ts []Timespec) error {
|
||||
if len(ts) != 2 {
|
||||
return EINVAL
|
||||
}
|
||||
return utimensat(AT_FDCWD, path, (*[2]Timespec)(unsafe.Pointer(&ts[0])), 0)
|
||||
}
|
||||
|
||||
func UtimesNanoAt(dirfd int, path string, ts []Timespec, flags int) error {
|
||||
if ts == nil {
|
||||
return utimensat(dirfd, path, nil, flags)
|
||||
}
|
||||
if len(ts) != 2 {
|
||||
return EINVAL
|
||||
}
|
||||
return utimensat(dirfd, path, (*[2]Timespec)(unsafe.Pointer(&ts[0])), flags)
|
||||
}
|
||||
|
||||
func (sa *SockaddrInet4) sockaddr() (unsafe.Pointer, _Socklen, error) {
|
||||
if sa.Port < 0 || sa.Port > 0xFFFF {
|
||||
return nil, 0, EINVAL
|
||||
}
|
||||
sa.raw.Family = AF_INET
|
||||
p := (*[2]byte)(unsafe.Pointer(&sa.raw.Port))
|
||||
p[0] = byte(sa.Port >> 8)
|
||||
p[1] = byte(sa.Port)
|
||||
for i := 0; i < len(sa.Addr); i++ {
|
||||
sa.raw.Addr[i] = sa.Addr[i]
|
||||
}
|
||||
return unsafe.Pointer(&sa.raw), SizeofSockaddrInet4, nil
|
||||
}
|
||||
|
||||
func (sa *SockaddrInet6) sockaddr() (unsafe.Pointer, _Socklen, error) {
|
||||
if sa.Port < 0 || sa.Port > 0xFFFF {
|
||||
return nil, 0, EINVAL
|
||||
}
|
||||
sa.raw.Family = AF_INET6
|
||||
p := (*[2]byte)(unsafe.Pointer(&sa.raw.Port))
|
||||
p[0] = byte(sa.Port >> 8)
|
||||
p[1] = byte(sa.Port)
|
||||
sa.raw.Scope_id = sa.ZoneId
|
||||
for i := 0; i < len(sa.Addr); i++ {
|
||||
sa.raw.Addr[i] = sa.Addr[i]
|
||||
}
|
||||
return unsafe.Pointer(&sa.raw), SizeofSockaddrInet6, nil
|
||||
}
|
||||
|
||||
func (sa *SockaddrUnix) sockaddr() (unsafe.Pointer, _Socklen, error) {
|
||||
name := sa.Name
|
||||
n := len(name)
|
||||
if n > len(sa.raw.Path) {
|
||||
return nil, 0, EINVAL
|
||||
}
|
||||
if n == len(sa.raw.Path) && name[0] != '@' {
|
||||
return nil, 0, EINVAL
|
||||
}
|
||||
sa.raw.Family = AF_UNIX
|
||||
for i := 0; i < n; i++ {
|
||||
sa.raw.Path[i] = uint8(name[i])
|
||||
}
|
||||
// length is family (uint16), name, NUL.
|
||||
sl := _Socklen(2)
|
||||
if n > 0 {
|
||||
sl += _Socklen(n) + 1
|
||||
}
|
||||
if sa.raw.Path[0] == '@' {
|
||||
sa.raw.Path[0] = 0
|
||||
// Don't count trailing NUL for abstract address.
|
||||
sl--
|
||||
}
|
||||
|
||||
return unsafe.Pointer(&sa.raw), sl, nil
|
||||
}
|
||||
|
||||
func Getsockname(fd int) (sa Sockaddr, err error) {
|
||||
var rsa RawSockaddrAny
|
||||
var len _Socklen = SizeofSockaddrAny
|
||||
if err = getsockname(fd, &rsa, &len); err != nil {
|
||||
return
|
||||
}
|
||||
return anyToSockaddr(fd, &rsa)
|
||||
}
|
||||
|
||||
//sys getcwd(buf []byte) (err error)
|
||||
|
||||
const ImplementsGetwd = true
|
||||
|
||||
func Getwd() (ret string, err error) {
|
||||
for len := uint64(4096); ; len *= 2 {
|
||||
b := make([]byte, len)
|
||||
err := getcwd(b)
|
||||
if err == nil {
|
||||
i := 0
|
||||
for b[i] != 0 {
|
||||
i++
|
||||
}
|
||||
return string(b[0:i]), nil
|
||||
}
|
||||
if err != ERANGE {
|
||||
return "", err
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func Getcwd(buf []byte) (n int, err error) {
|
||||
err = getcwd(buf)
|
||||
if err == nil {
|
||||
i := 0
|
||||
for buf[i] != 0 {
|
||||
i++
|
||||
}
|
||||
n = i + 1
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
func Getgroups() (gids []int, err error) {
|
||||
n, err := getgroups(0, nil)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if n == 0 {
|
||||
return nil, nil
|
||||
}
|
||||
|
||||
// Sanity check group count. Max is 16 on BSD.
|
||||
if n < 0 || n > 1000 {
|
||||
return nil, EINVAL
|
||||
}
|
||||
|
||||
a := make([]_Gid_t, n)
|
||||
n, err = getgroups(n, &a[0])
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
gids = make([]int, n)
|
||||
for i, v := range a[0:n] {
|
||||
gids[i] = int(v)
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
func Setgroups(gids []int) (err error) {
|
||||
if len(gids) == 0 {
|
||||
return setgroups(0, nil)
|
||||
}
|
||||
|
||||
a := make([]_Gid_t, len(gids))
|
||||
for i, v := range gids {
|
||||
a[i] = _Gid_t(v)
|
||||
}
|
||||
return setgroups(len(a), &a[0])
|
||||
}
|
||||
|
||||
/*
|
||||
* Socket
|
||||
*/
|
||||
|
||||
//sys accept(s int, rsa *RawSockaddrAny, addrlen *_Socklen) (fd int, err error)
|
||||
|
||||
func Accept(fd int) (nfd int, sa Sockaddr, err error) {
|
||||
var rsa RawSockaddrAny
|
||||
var len _Socklen = SizeofSockaddrAny
|
||||
nfd, err = accept(fd, &rsa, &len)
|
||||
if nfd == -1 {
|
||||
return
|
||||
}
|
||||
sa, err = anyToSockaddr(fd, &rsa)
|
||||
if err != nil {
|
||||
Close(nfd)
|
||||
nfd = 0
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
func Recvmsg(fd int, p, oob []byte, flags int) (n, oobn int, recvflags int, from Sockaddr, err error) {
|
||||
// Recvmsg not implemented on AIX
|
||||
sa := new(SockaddrUnix)
|
||||
return -1, -1, -1, sa, ENOSYS
|
||||
}
|
||||
|
||||
func Sendmsg(fd int, p, oob []byte, to Sockaddr, flags int) (err error) {
|
||||
_, err = SendmsgN(fd, p, oob, to, flags)
|
||||
return
|
||||
}
|
||||
|
||||
func SendmsgN(fd int, p, oob []byte, to Sockaddr, flags int) (n int, err error) {
|
||||
// SendmsgN not implemented on AIX
|
||||
return -1, ENOSYS
|
||||
}
|
||||
|
||||
func anyToSockaddr(fd int, rsa *RawSockaddrAny) (Sockaddr, error) {
|
||||
switch rsa.Addr.Family {
|
||||
|
||||
case AF_UNIX:
|
||||
pp := (*RawSockaddrUnix)(unsafe.Pointer(rsa))
|
||||
sa := new(SockaddrUnix)
|
||||
|
||||
// Some versions of AIX have a bug in getsockname (see IV78655).
|
||||
// We can't rely on sa.Len being set correctly.
|
||||
n := SizeofSockaddrUnix - 3 // subtract leading Family, Len, terminating NUL.
|
||||
for i := 0; i < n; i++ {
|
||||
if pp.Path[i] == 0 {
|
||||
n = i
|
||||
break
|
||||
}
|
||||
}
|
||||
|
||||
bytes := (*[10000]byte)(unsafe.Pointer(&pp.Path[0]))[0:n]
|
||||
sa.Name = string(bytes)
|
||||
return sa, nil
|
||||
|
||||
case AF_INET:
|
||||
pp := (*RawSockaddrInet4)(unsafe.Pointer(rsa))
|
||||
sa := new(SockaddrInet4)
|
||||
p := (*[2]byte)(unsafe.Pointer(&pp.Port))
|
||||
sa.Port = int(p[0])<<8 + int(p[1])
|
||||
for i := 0; i < len(sa.Addr); i++ {
|
||||
sa.Addr[i] = pp.Addr[i]
|
||||
}
|
||||
return sa, nil
|
||||
|
||||
case AF_INET6:
|
||||
pp := (*RawSockaddrInet6)(unsafe.Pointer(rsa))
|
||||
sa := new(SockaddrInet6)
|
||||
p := (*[2]byte)(unsafe.Pointer(&pp.Port))
|
||||
sa.Port = int(p[0])<<8 + int(p[1])
|
||||
sa.ZoneId = pp.Scope_id
|
||||
for i := 0; i < len(sa.Addr); i++ {
|
||||
sa.Addr[i] = pp.Addr[i]
|
||||
}
|
||||
return sa, nil
|
||||
}
|
||||
return nil, EAFNOSUPPORT
|
||||
}
|
||||
|
||||
func Gettimeofday(tv *Timeval) (err error) {
|
||||
err = gettimeofday(tv, nil)
|
||||
return
|
||||
}
|
||||
|
||||
func Sendfile(outfd int, infd int, offset *int64, count int) (written int, err error) {
|
||||
if raceenabled {
|
||||
raceReleaseMerge(unsafe.Pointer(&ioSync))
|
||||
}
|
||||
return sendfile(outfd, infd, offset, count)
|
||||
}
|
||||
|
||||
// TODO
|
||||
func sendfile(outfd int, infd int, offset *int64, count int) (written int, err error) {
|
||||
return -1, ENOSYS
|
||||
}
|
||||
|
||||
//sys getdirent(fd int, buf []byte) (n int, err error)
|
||||
func ReadDirent(fd int, buf []byte) (n int, err error) {
|
||||
return getdirent(fd, buf)
|
||||
}
|
||||
|
||||
//sys wait4(pid Pid_t, status *_C_int, options int, rusage *Rusage) (wpid Pid_t, err error)
|
||||
func Wait4(pid int, wstatus *WaitStatus, options int, rusage *Rusage) (wpid int, err error) {
|
||||
var status _C_int
|
||||
var r Pid_t
|
||||
err = ERESTART
|
||||
// AIX wait4 may return with ERESTART errno, while the processus is still
|
||||
// active.
|
||||
for err == ERESTART {
|
||||
r, err = wait4(Pid_t(pid), &status, options, rusage)
|
||||
}
|
||||
wpid = int(r)
|
||||
if wstatus != nil {
|
||||
*wstatus = WaitStatus(status)
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
/*
|
||||
* Wait
|
||||
*/
|
||||
|
||||
type WaitStatus uint32
|
||||
|
||||
func (w WaitStatus) Stopped() bool { return w&0x40 != 0 }
|
||||
func (w WaitStatus) StopSignal() Signal {
|
||||
if !w.Stopped() {
|
||||
return -1
|
||||
}
|
||||
return Signal(w>>8) & 0xFF
|
||||
}
|
||||
|
||||
func (w WaitStatus) Exited() bool { return w&0xFF == 0 }
|
||||
func (w WaitStatus) ExitStatus() int {
|
||||
if !w.Exited() {
|
||||
return -1
|
||||
}
|
||||
return int((w >> 8) & 0xFF)
|
||||
}
|
||||
|
||||
func (w WaitStatus) Signaled() bool { return w&0x40 == 0 && w&0xFF != 0 }
|
||||
func (w WaitStatus) Signal() Signal {
|
||||
if !w.Signaled() {
|
||||
return -1
|
||||
}
|
||||
return Signal(w>>16) & 0xFF
|
||||
}
|
||||
|
||||
func (w WaitStatus) Continued() bool { return w&0x01000000 != 0 }
|
||||
|
||||
func (w WaitStatus) CoreDump() bool { return w&0x200 != 0 }
|
||||
|
||||
func (w WaitStatus) TrapCause() int { return -1 }
|
||||
|
||||
//sys ioctl(fd int, req uint, arg uintptr) (err error)
|
||||
|
||||
// ioctl itself should not be exposed directly, but additional get/set
|
||||
// functions for specific types are permissible.
|
||||
|
||||
// IoctlSetInt performs an ioctl operation which sets an integer value
|
||||
// on fd, using the specified request number.
|
||||
func IoctlSetInt(fd int, req uint, value int) error {
|
||||
return ioctl(fd, req, uintptr(value))
|
||||
}
|
||||
|
||||
func ioctlSetWinsize(fd int, req uint, value *Winsize) error {
|
||||
return ioctl(fd, req, uintptr(unsafe.Pointer(value)))
|
||||
}
|
||||
|
||||
func ioctlSetTermios(fd int, req uint, value *Termios) error {
|
||||
return ioctl(fd, req, uintptr(unsafe.Pointer(value)))
|
||||
}
|
||||
|
||||
// IoctlGetInt performs an ioctl operation which gets an integer value
|
||||
// from fd, using the specified request number.
|
||||
func IoctlGetInt(fd int, req uint) (int, error) {
|
||||
var value int
|
||||
err := ioctl(fd, req, uintptr(unsafe.Pointer(&value)))
|
||||
return value, err
|
||||
}
|
||||
|
||||
func IoctlGetWinsize(fd int, req uint) (*Winsize, error) {
|
||||
var value Winsize
|
||||
err := ioctl(fd, req, uintptr(unsafe.Pointer(&value)))
|
||||
return &value, err
|
||||
}
|
||||
|
||||
func IoctlGetTermios(fd int, req uint) (*Termios, error) {
|
||||
var value Termios
|
||||
err := ioctl(fd, req, uintptr(unsafe.Pointer(&value)))
|
||||
return &value, err
|
||||
}
|
||||
|
||||
// fcntl must never be called with cmd=F_DUP2FD because it doesn't work on AIX
|
||||
// There is no way to create a custom fcntl and to keep //sys fcntl easily,
|
||||
// Therefore, the programmer must call dup2 instead of fcntl in this case.
|
||||
|
||||
// FcntlInt performs a fcntl syscall on fd with the provided command and argument.
|
||||
//sys FcntlInt(fd uintptr, cmd int, arg int) (r int,err error) = fcntl
|
||||
|
||||
// FcntlFlock performs a fcntl syscall for the F_GETLK, F_SETLK or F_SETLKW command.
|
||||
//sys FcntlFlock(fd uintptr, cmd int, lk *Flock_t) (err error) = fcntl
|
||||
|
||||
//sys fcntl(fd int, cmd int, arg int) (val int, err error)
|
||||
|
||||
/*
|
||||
* Direct access
|
||||
*/
|
||||
|
||||
//sys Acct(path string) (err error)
|
||||
//sys Chdir(path string) (err error)
|
||||
//sys Chroot(path string) (err error)
|
||||
//sys Close(fd int) (err error)
|
||||
//sys Dup(oldfd int) (fd int, err error)
|
||||
//sys Exit(code int)
|
||||
//sys Faccessat(dirfd int, path string, mode uint32, flags int) (err error)
|
||||
//sys Fchdir(fd int) (err error)
|
||||
//sys Fchmod(fd int, mode uint32) (err error)
|
||||
//sys Fchmodat(dirfd int, path string, mode uint32, flags int) (err error)
|
||||
//sys Fchownat(dirfd int, path string, uid int, gid int, flags int) (err error)
|
||||
//sys Fdatasync(fd int) (err error)
|
||||
//sys Fsync(fd int) (err error)
|
||||
// readdir_r
|
||||
//sysnb Getpgid(pid int) (pgid int, err error)
|
||||
|
||||
//sys Getpgrp() (pid int)
|
||||
|
||||
//sysnb Getpid() (pid int)
|
||||
//sysnb Getppid() (ppid int)
|
||||
//sys Getpriority(which int, who int) (prio int, err error)
|
||||
//sysnb Getrusage(who int, rusage *Rusage) (err error)
|
||||
//sysnb Getsid(pid int) (sid int, err error)
|
||||
//sysnb Kill(pid int, sig Signal) (err error)
|
||||
//sys Klogctl(typ int, buf []byte) (n int, err error) = syslog
|
||||
//sys Mkdir(dirfd int, path string, mode uint32) (err error)
|
||||
//sys Mkdirat(dirfd int, path string, mode uint32) (err error)
|
||||
//sys Mkfifo(path string, mode uint32) (err error)
|
||||
//sys Mknod(path string, mode uint32, dev int) (err error)
|
||||
//sys Mknodat(dirfd int, path string, mode uint32, dev int) (err error)
|
||||
//sys Nanosleep(time *Timespec, leftover *Timespec) (err error)
|
||||
//sys Open(path string, mode int, perm uint32) (fd int, err error) = open64
|
||||
//sys Openat(dirfd int, path string, flags int, mode uint32) (fd int, err error)
|
||||
//sys read(fd int, p []byte) (n int, err error)
|
||||
//sys Readlink(path string, buf []byte) (n int, err error)
|
||||
//sys Renameat(olddirfd int, oldpath string, newdirfd int, newpath string) (err error)
|
||||
//sys Setdomainname(p []byte) (err error)
|
||||
//sys Sethostname(p []byte) (err error)
|
||||
//sysnb Setpgid(pid int, pgid int) (err error)
|
||||
//sysnb Setsid() (pid int, err error)
|
||||
//sysnb Settimeofday(tv *Timeval) (err error)
|
||||
|
||||
//sys Setuid(uid int) (err error)
|
||||
//sys Setgid(uid int) (err error)
|
||||
|
||||
//sys Setpriority(which int, who int, prio int) (err error)
|
||||
//sys Statx(dirfd int, path string, flags int, mask int, stat *Statx_t) (err error)
|
||||
//sys Sync()
|
||||
//sysnb Times(tms *Tms) (ticks uintptr, err error)
|
||||
//sysnb Umask(mask int) (oldmask int)
|
||||
//sysnb Uname(buf *Utsname) (err error)
|
||||
//TODO umount
|
||||
// //sys Unmount(target string, flags int) (err error) = umount
|
||||
//sys Unlink(path string) (err error)
|
||||
//sys Unlinkat(dirfd int, path string, flags int) (err error)
|
||||
//sys Ustat(dev int, ubuf *Ustat_t) (err error)
|
||||
//sys write(fd int, p []byte) (n int, err error)
|
||||
//sys readlen(fd int, p *byte, np int) (n int, err error) = read
|
||||
//sys writelen(fd int, p *byte, np int) (n int, err error) = write
|
||||
|
||||
//sys Dup2(oldfd int, newfd int) (err error)
|
||||
//sys Fadvise(fd int, offset int64, length int64, advice int) (err error) = posix_fadvise64
|
||||
//sys Fchown(fd int, uid int, gid int) (err error)
|
||||
//sys Fstat(fd int, stat *Stat_t) (err error)
|
||||
//sys Fstatat(dirfd int, path string, stat *Stat_t, flags int) (err error) = fstatat
|
||||
//sys Fstatfs(fd int, buf *Statfs_t) (err error)
|
||||
//sys Ftruncate(fd int, length int64) (err error)
|
||||
//sysnb Getegid() (egid int)
|
||||
//sysnb Geteuid() (euid int)
|
||||
//sysnb Getgid() (gid int)
|
||||
//sysnb Getuid() (uid int)
|
||||
//sys Lchown(path string, uid int, gid int) (err error)
|
||||
//sys Listen(s int, n int) (err error)
|
||||
//sys Lstat(path string, stat *Stat_t) (err error)
|
||||
//sys Pause() (err error)
|
||||
//sys Pread(fd int, p []byte, offset int64) (n int, err error) = pread64
|
||||
//sys Pwrite(fd int, p []byte, offset int64) (n int, err error) = pwrite64
|
||||
//TODO Select
|
||||
// //sys Select(nfd int, r *FdSet, w *FdSet, e *FdSet, timeout *Timeval) (n int, err error)
|
||||
//sys Pselect(nfd int, r *FdSet, w *FdSet, e *FdSet, timeout *Timespec, sigmask *Sigset_t) (n int, err error)
|
||||
//sysnb Setregid(rgid int, egid int) (err error)
|
||||
//sysnb Setreuid(ruid int, euid int) (err error)
|
||||
//sys Shutdown(fd int, how int) (err error)
|
||||
//sys Splice(rfd int, roff *int64, wfd int, woff *int64, len int, flags int) (n int64, err error)
|
||||
//sys Stat(path string, stat *Stat_t) (err error)
|
||||
//sys Statfs(path string, buf *Statfs_t) (err error)
|
||||
//sys Truncate(path string, length int64) (err error)
|
||||
|
||||
//sys bind(s int, addr unsafe.Pointer, addrlen _Socklen) (err error)
|
||||
//sys connect(s int, addr unsafe.Pointer, addrlen _Socklen) (err error)
|
||||
//sysnb getgroups(n int, list *_Gid_t) (nn int, err error)
|
||||
//sysnb setgroups(n int, list *_Gid_t) (err error)
|
||||
//sys getsockopt(s int, level int, name int, val unsafe.Pointer, vallen *_Socklen) (err error)
|
||||
//sys setsockopt(s int, level int, name int, val unsafe.Pointer, vallen uintptr) (err error)
|
||||
//sysnb socket(domain int, typ int, proto int) (fd int, err error)
|
||||
//sysnb socketpair(domain int, typ int, proto int, fd *[2]int32) (err error)
|
||||
//sysnb getpeername(fd int, rsa *RawSockaddrAny, addrlen *_Socklen) (err error)
|
||||
//sysnb getsockname(fd int, rsa *RawSockaddrAny, addrlen *_Socklen) (err error)
|
||||
//sys recvfrom(fd int, p []byte, flags int, from *RawSockaddrAny, fromlen *_Socklen) (n int, err error)
|
||||
//sys sendto(s int, buf []byte, flags int, to unsafe.Pointer, addrlen _Socklen) (err error)
|
||||
//sys recvmsg(s int, msg *Msghdr, flags int) (n int, err error)
|
||||
//sys sendmsg(s int, msg *Msghdr, flags int) (n int, err error)
|
||||
|
||||
//sys munmap(addr uintptr, length uintptr) (err error)
|
||||
|
||||
var mapper = &mmapper{
|
||||
active: make(map[*byte][]byte),
|
||||
mmap: mmap,
|
||||
munmap: munmap,
|
||||
}
|
||||
|
||||
func Mmap(fd int, offset int64, length int, prot int, flags int) (data []byte, err error) {
|
||||
return mapper.Mmap(fd, offset, length, prot, flags)
|
||||
}
|
||||
|
||||
func Munmap(b []byte) (err error) {
|
||||
return mapper.Munmap(b)
|
||||
}
|
||||
|
||||
//sys Madvise(b []byte, advice int) (err error)
|
||||
//sys Mprotect(b []byte, prot int) (err error)
|
||||
//sys Mlock(b []byte) (err error)
|
||||
//sys Mlockall(flags int) (err error)
|
||||
//sys Msync(b []byte, flags int) (err error)
|
||||
//sys Munlock(b []byte) (err error)
|
||||
//sys Munlockall() (err error)
|
||||
|
||||
//sysnb pipe(p *[2]_C_int) (err error)
|
||||
|
||||
func Pipe(p []int) (err error) {
|
||||
if len(p) != 2 {
|
||||
return EINVAL
|
||||
}
|
||||
var pp [2]_C_int
|
||||
err = pipe(&pp)
|
||||
p[0] = int(pp[0])
|
||||
p[1] = int(pp[1])
|
||||
return
|
||||
}
|
||||
|
||||
//sys poll(fds *PollFd, nfds int, timeout int) (n int, err error)
|
||||
|
||||
func Poll(fds []PollFd, timeout int) (n int, err error) {
|
||||
if len(fds) == 0 {
|
||||
return poll(nil, 0, timeout)
|
||||
}
|
||||
return poll(&fds[0], len(fds), timeout)
|
||||
}
|
||||
|
||||
//sys gettimeofday(tv *Timeval, tzp *Timezone) (err error)
|
||||
//sysnb Time(t *Time_t) (tt Time_t, err error)
|
||||
//sys Utime(path string, buf *Utimbuf) (err error)
|
34
vendor/golang.org/x/sys/unix/syscall_aix_ppc.go
generated
vendored
Normal file
34
vendor/golang.org/x/sys/unix/syscall_aix_ppc.go
generated
vendored
Normal file
@ -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.
|
||||
|
||||
// +build aix
|
||||
// +build ppc
|
||||
|
||||
package unix
|
||||
|
||||
//sysnb Getrlimit(resource int, rlim *Rlimit) (err error) = getrlimit64
|
||||
//sysnb Setrlimit(resource int, rlim *Rlimit) (err error) = setrlimit64
|
||||
//sys Seek(fd int, offset int64, whence int) (off int64, err error) = lseek64
|
||||
|
||||
//sys mmap(addr uintptr, length uintptr, prot int, flags int, fd int, offset int64) (xaddr uintptr, err error)
|
||||
|
||||
func setTimespec(sec, nsec int64) Timespec {
|
||||
return Timespec{Sec: int32(sec), Nsec: int32(nsec)}
|
||||
}
|
||||
|
||||
func setTimeval(sec, usec int64) Timeval {
|
||||
return Timeval{Sec: int32(sec), Usec: int32(usec)}
|
||||
}
|
||||
|
||||
func (iov *Iovec) SetLen(length int) {
|
||||
iov.Len = uint32(length)
|
||||
}
|
||||
|
||||
func (msghdr *Msghdr) SetControllen(length int) {
|
||||
msghdr.Controllen = uint32(length)
|
||||
}
|
||||
|
||||
func (cmsg *Cmsghdr) SetLen(length int) {
|
||||
cmsg.Len = uint32(length)
|
||||
}
|
34
vendor/golang.org/x/sys/unix/syscall_aix_ppc64.go
generated
vendored
Normal file
34
vendor/golang.org/x/sys/unix/syscall_aix_ppc64.go
generated
vendored
Normal file
@ -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.
|
||||
|
||||
// +build aix
|
||||
// +build ppc64
|
||||
|
||||
package unix
|
||||
|
||||
//sysnb Getrlimit(resource int, rlim *Rlimit) (err error)
|
||||
//sysnb Setrlimit(resource int, rlim *Rlimit) (err error)
|
||||
//sys Seek(fd int, offset int64, whence int) (off int64, err error) = lseek
|
||||
|
||||
//sys mmap(addr uintptr, length uintptr, prot int, flags int, fd int, offset int64) (xaddr uintptr, err error) = mmap64
|
||||
|
||||
func setTimespec(sec, nsec int64) Timespec {
|
||||
return Timespec{Sec: sec, Nsec: nsec}
|
||||
}
|
||||
|
||||
func setTimeval(sec, usec int64) Timeval {
|
||||
return Timeval{Sec: int64(sec), Usec: int32(usec)}
|
||||
}
|
||||
|
||||
func (iov *Iovec) SetLen(length int) {
|
||||
iov.Len = uint64(length)
|
||||
}
|
||||
|
||||
func (msghdr *Msghdr) SetControllen(length int) {
|
||||
msghdr.Controllen = uint32(length)
|
||||
}
|
||||
|
||||
func (cmsg *Cmsghdr) SetLen(length int) {
|
||||
cmsg.Len = uint32(length)
|
||||
}
|
57
vendor/golang.org/x/sys/unix/syscall_bsd.go
generated
vendored
57
vendor/golang.org/x/sys/unix/syscall_bsd.go
generated
vendored
@ -206,7 +206,7 @@ func (sa *SockaddrDatalink) sockaddr() (unsafe.Pointer, _Socklen, error) {
|
||||
return unsafe.Pointer(&sa.raw), SizeofSockaddrDatalink, nil
|
||||
}
|
||||
|
||||
func anyToSockaddr(rsa *RawSockaddrAny) (Sockaddr, error) {
|
||||
func anyToSockaddr(fd int, rsa *RawSockaddrAny) (Sockaddr, error) {
|
||||
switch rsa.Addr.Family {
|
||||
case AF_LINK:
|
||||
pp := (*RawSockaddrDatalink)(unsafe.Pointer(rsa))
|
||||
@ -286,7 +286,7 @@ func Accept(fd int) (nfd int, sa Sockaddr, err error) {
|
||||
Close(nfd)
|
||||
return 0, nil, ECONNABORTED
|
||||
}
|
||||
sa, err = anyToSockaddr(&rsa)
|
||||
sa, err = anyToSockaddr(fd, &rsa)
|
||||
if err != nil {
|
||||
Close(nfd)
|
||||
nfd = 0
|
||||
@ -306,50 +306,21 @@ func Getsockname(fd int) (sa Sockaddr, err error) {
|
||||
rsa.Addr.Family = AF_UNIX
|
||||
rsa.Addr.Len = SizeofSockaddrUnix
|
||||
}
|
||||
return anyToSockaddr(&rsa)
|
||||
return anyToSockaddr(fd, &rsa)
|
||||
}
|
||||
|
||||
//sysnb socketpair(domain int, typ int, proto int, fd *[2]int32) (err error)
|
||||
|
||||
func GetsockoptByte(fd, level, opt int) (value byte, err error) {
|
||||
var n byte
|
||||
vallen := _Socklen(1)
|
||||
err = getsockopt(fd, level, opt, unsafe.Pointer(&n), &vallen)
|
||||
return n, err
|
||||
}
|
||||
|
||||
func GetsockoptInet4Addr(fd, level, opt int) (value [4]byte, err error) {
|
||||
vallen := _Socklen(4)
|
||||
err = getsockopt(fd, level, opt, unsafe.Pointer(&value[0]), &vallen)
|
||||
return value, err
|
||||
}
|
||||
|
||||
func GetsockoptIPMreq(fd, level, opt int) (*IPMreq, error) {
|
||||
var value IPMreq
|
||||
vallen := _Socklen(SizeofIPMreq)
|
||||
err := getsockopt(fd, level, opt, unsafe.Pointer(&value), &vallen)
|
||||
return &value, err
|
||||
}
|
||||
|
||||
func GetsockoptIPv6Mreq(fd, level, opt int) (*IPv6Mreq, error) {
|
||||
var value IPv6Mreq
|
||||
vallen := _Socklen(SizeofIPv6Mreq)
|
||||
err := getsockopt(fd, level, opt, unsafe.Pointer(&value), &vallen)
|
||||
return &value, err
|
||||
}
|
||||
|
||||
func GetsockoptIPv6MTUInfo(fd, level, opt int) (*IPv6MTUInfo, error) {
|
||||
var value IPv6MTUInfo
|
||||
vallen := _Socklen(SizeofIPv6MTUInfo)
|
||||
err := getsockopt(fd, level, opt, unsafe.Pointer(&value), &vallen)
|
||||
return &value, err
|
||||
}
|
||||
|
||||
func GetsockoptICMPv6Filter(fd, level, opt int) (*ICMPv6Filter, error) {
|
||||
var value ICMPv6Filter
|
||||
vallen := _Socklen(SizeofICMPv6Filter)
|
||||
err := getsockopt(fd, level, opt, unsafe.Pointer(&value), &vallen)
|
||||
return &value, err
|
||||
// GetsockoptString returns the string value of the socket option opt for the
|
||||
// socket associated with fd at the given socket level.
|
||||
func GetsockoptString(fd, level, opt int) (string, error) {
|
||||
buf := make([]byte, 256)
|
||||
vallen := _Socklen(len(buf))
|
||||
err := getsockopt(fd, level, opt, unsafe.Pointer(&buf[0]), &vallen)
|
||||
if err != nil {
|
||||
return "", err
|
||||
}
|
||||
return string(buf[:vallen-1]), nil
|
||||
}
|
||||
|
||||
//sys recvfrom(fd int, p []byte, flags int, from *RawSockaddrAny, fromlen *_Socklen) (n int, err error)
|
||||
@ -385,7 +356,7 @@ func Recvmsg(fd int, p, oob []byte, flags int) (n, oobn int, recvflags int, from
|
||||
recvflags = int(msg.Flags)
|
||||
// source address is only specified if the socket is unconnected
|
||||
if rsa.Addr.Family != AF_UNSPEC {
|
||||
from, err = anyToSockaddr(&rsa)
|
||||
from, err = anyToSockaddr(fd, &rsa)
|
||||
}
|
||||
return
|
||||
}
|
||||
|
245
vendor/golang.org/x/sys/unix/syscall_darwin.go
generated
vendored
245
vendor/golang.org/x/sys/unix/syscall_darwin.go
generated
vendored
@ -13,7 +13,7 @@
|
||||
package unix
|
||||
|
||||
import (
|
||||
errorspkg "errors"
|
||||
"errors"
|
||||
"syscall"
|
||||
"unsafe"
|
||||
)
|
||||
@ -36,6 +36,7 @@ func Getwd() (string, error) {
|
||||
return "", ENOTSUP
|
||||
}
|
||||
|
||||
// SockaddrDatalink implements the Sockaddr interface for AF_LINK type sockets.
|
||||
type SockaddrDatalink struct {
|
||||
Len uint8
|
||||
Family uint8
|
||||
@ -76,18 +77,6 @@ func nametomib(name string) (mib []_C_int, err error) {
|
||||
return buf[0 : n/siz], nil
|
||||
}
|
||||
|
||||
func direntIno(buf []byte) (uint64, bool) {
|
||||
return readInt(buf, unsafe.Offsetof(Dirent{}.Ino), unsafe.Sizeof(Dirent{}.Ino))
|
||||
}
|
||||
|
||||
func direntReclen(buf []byte) (uint64, bool) {
|
||||
return readInt(buf, unsafe.Offsetof(Dirent{}.Reclen), unsafe.Sizeof(Dirent{}.Reclen))
|
||||
}
|
||||
|
||||
func direntNamlen(buf []byte) (uint64, bool) {
|
||||
return readInt(buf, unsafe.Offsetof(Dirent{}.Namlen), unsafe.Sizeof(Dirent{}.Namlen))
|
||||
}
|
||||
|
||||
//sys ptrace(request int, pid int, addr uintptr, data uintptr) (err error)
|
||||
func PtraceAttach(pid int) (err error) { return ptrace(PT_ATTACH, pid, 0, 0) }
|
||||
func PtraceDetach(pid int) (err error) { return ptrace(PT_DETACH, pid, 0, 0) }
|
||||
@ -109,7 +98,7 @@ type attrList struct {
|
||||
|
||||
func getAttrList(path string, attrList attrList, attrBuf []byte, options uint) (attrs [][]byte, err error) {
|
||||
if len(attrBuf) < 4 {
|
||||
return nil, errorspkg.New("attrBuf too small")
|
||||
return nil, errors.New("attrBuf too small")
|
||||
}
|
||||
attrList.bitmapCount = attrBitMapCount
|
||||
|
||||
@ -119,17 +108,8 @@ func getAttrList(path string, attrList attrList, attrBuf []byte, options uint) (
|
||||
return nil, err
|
||||
}
|
||||
|
||||
_, _, e1 := Syscall6(
|
||||
SYS_GETATTRLIST,
|
||||
uintptr(unsafe.Pointer(_p0)),
|
||||
uintptr(unsafe.Pointer(&attrList)),
|
||||
uintptr(unsafe.Pointer(&attrBuf[0])),
|
||||
uintptr(len(attrBuf)),
|
||||
uintptr(options),
|
||||
0,
|
||||
)
|
||||
if e1 != 0 {
|
||||
return nil, e1
|
||||
if err := getattrlist(_p0, unsafe.Pointer(&attrList), unsafe.Pointer(&attrBuf[0]), uintptr(len(attrBuf)), int(options)); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
size := *(*uint32)(unsafe.Pointer(&attrBuf[0]))
|
||||
|
||||
@ -145,12 +125,12 @@ func getAttrList(path string, attrList attrList, attrBuf []byte, options uint) (
|
||||
for i := uint32(0); int(i) < len(dat); {
|
||||
header := dat[i:]
|
||||
if len(header) < 8 {
|
||||
return attrs, errorspkg.New("truncated attribute header")
|
||||
return attrs, errors.New("truncated attribute header")
|
||||
}
|
||||
datOff := *(*int32)(unsafe.Pointer(&header[0]))
|
||||
attrLen := *(*uint32)(unsafe.Pointer(&header[4]))
|
||||
if datOff < 0 || uint32(datOff)+attrLen > uint32(len(dat)) {
|
||||
return attrs, errorspkg.New("truncated results; attrBuf too small")
|
||||
return attrs, errors.New("truncated results; attrBuf too small")
|
||||
}
|
||||
end := uint32(datOff) + attrLen
|
||||
attrs = append(attrs, dat[datOff:end])
|
||||
@ -162,6 +142,8 @@ func getAttrList(path string, attrList attrList, attrBuf []byte, options uint) (
|
||||
return
|
||||
}
|
||||
|
||||
//sys getattrlist(path *byte, list unsafe.Pointer, buf unsafe.Pointer, size uintptr, options int) (err error)
|
||||
|
||||
//sysnb pipe() (r int, w int, err error)
|
||||
|
||||
func Pipe(p []int) (err error) {
|
||||
@ -179,12 +161,113 @@ func Getfsstat(buf []Statfs_t, flags int) (n int, err error) {
|
||||
_p0 = unsafe.Pointer(&buf[0])
|
||||
bufsize = unsafe.Sizeof(Statfs_t{}) * uintptr(len(buf))
|
||||
}
|
||||
r0, _, e1 := Syscall(SYS_GETFSSTAT64, uintptr(_p0), bufsize, uintptr(flags))
|
||||
n = int(r0)
|
||||
if e1 != 0 {
|
||||
err = e1
|
||||
return getfsstat(_p0, bufsize, flags)
|
||||
}
|
||||
|
||||
func xattrPointer(dest []byte) *byte {
|
||||
// It's only when dest is set to NULL that the OS X implementations of
|
||||
// getxattr() and listxattr() return the current sizes of the named attributes.
|
||||
// An empty byte array is not sufficient. To maintain the same behaviour as the
|
||||
// linux implementation, we wrap around the system calls and pass in NULL when
|
||||
// dest is empty.
|
||||
var destp *byte
|
||||
if len(dest) > 0 {
|
||||
destp = &dest[0]
|
||||
}
|
||||
return
|
||||
return destp
|
||||
}
|
||||
|
||||
//sys getxattr(path string, attr string, dest *byte, size int, position uint32, options int) (sz int, err error)
|
||||
|
||||
func Getxattr(path string, attr string, dest []byte) (sz int, err error) {
|
||||
return getxattr(path, attr, xattrPointer(dest), len(dest), 0, 0)
|
||||
}
|
||||
|
||||
func Lgetxattr(link string, attr string, dest []byte) (sz int, err error) {
|
||||
return getxattr(link, attr, xattrPointer(dest), len(dest), 0, XATTR_NOFOLLOW)
|
||||
}
|
||||
|
||||
//sys fgetxattr(fd int, attr string, dest *byte, size int, position uint32, options int) (sz int, err error)
|
||||
|
||||
func Fgetxattr(fd int, attr string, dest []byte) (sz int, err error) {
|
||||
return fgetxattr(fd, attr, xattrPointer(dest), len(dest), 0, 0)
|
||||
}
|
||||
|
||||
//sys setxattr(path string, attr string, data *byte, size int, position uint32, options int) (err error)
|
||||
|
||||
func Setxattr(path string, attr string, data []byte, flags int) (err error) {
|
||||
// The parameters for the OS X implementation vary slightly compared to the
|
||||
// linux system call, specifically the position parameter:
|
||||
//
|
||||
// linux:
|
||||
// int setxattr(
|
||||
// const char *path,
|
||||
// const char *name,
|
||||
// const void *value,
|
||||
// size_t size,
|
||||
// int flags
|
||||
// );
|
||||
//
|
||||
// darwin:
|
||||
// int setxattr(
|
||||
// const char *path,
|
||||
// const char *name,
|
||||
// void *value,
|
||||
// size_t size,
|
||||
// u_int32_t position,
|
||||
// int options
|
||||
// );
|
||||
//
|
||||
// position specifies the offset within the extended attribute. In the
|
||||
// current implementation, only the resource fork extended attribute makes
|
||||
// use of this argument. For all others, position is reserved. We simply
|
||||
// default to setting it to zero.
|
||||
return setxattr(path, attr, xattrPointer(data), len(data), 0, flags)
|
||||
}
|
||||
|
||||
func Lsetxattr(link string, attr string, data []byte, flags int) (err error) {
|
||||
return setxattr(link, attr, xattrPointer(data), len(data), 0, flags|XATTR_NOFOLLOW)
|
||||
}
|
||||
|
||||
//sys fsetxattr(fd int, attr string, data *byte, size int, position uint32, options int) (err error)
|
||||
|
||||
func Fsetxattr(fd int, attr string, data []byte, flags int) (err error) {
|
||||
return fsetxattr(fd, attr, xattrPointer(data), len(data), 0, 0)
|
||||
}
|
||||
|
||||
//sys removexattr(path string, attr string, options int) (err error)
|
||||
|
||||
func Removexattr(path string, attr string) (err error) {
|
||||
// We wrap around and explicitly zero out the options provided to the OS X
|
||||
// implementation of removexattr, we do so for interoperability with the
|
||||
// linux variant.
|
||||
return removexattr(path, attr, 0)
|
||||
}
|
||||
|
||||
func Lremovexattr(link string, attr string) (err error) {
|
||||
return removexattr(link, attr, XATTR_NOFOLLOW)
|
||||
}
|
||||
|
||||
//sys fremovexattr(fd int, attr string, options int) (err error)
|
||||
|
||||
func Fremovexattr(fd int, attr string) (err error) {
|
||||
return fremovexattr(fd, attr, 0)
|
||||
}
|
||||
|
||||
//sys listxattr(path string, dest *byte, size int, options int) (sz int, err error)
|
||||
|
||||
func Listxattr(path string, dest []byte) (sz int, err error) {
|
||||
return listxattr(path, xattrPointer(dest), len(dest), 0)
|
||||
}
|
||||
|
||||
func Llistxattr(link string, dest []byte) (sz int, err error) {
|
||||
return listxattr(link, xattrPointer(dest), len(dest), XATTR_NOFOLLOW)
|
||||
}
|
||||
|
||||
//sys flistxattr(fd int, dest *byte, size int, options int) (sz int, err error)
|
||||
|
||||
func Flistxattr(fd int, dest []byte) (sz int, err error) {
|
||||
return flistxattr(fd, xattrPointer(dest), len(dest), 0)
|
||||
}
|
||||
|
||||
func setattrlistTimes(path string, times []Timespec, flags int) error {
|
||||
@ -203,21 +286,16 @@ func setattrlistTimes(path string, times []Timespec, flags int) error {
|
||||
if flags&AT_SYMLINK_NOFOLLOW != 0 {
|
||||
options |= FSOPT_NOFOLLOW
|
||||
}
|
||||
_, _, e1 := Syscall6(
|
||||
SYS_SETATTRLIST,
|
||||
uintptr(unsafe.Pointer(_p0)),
|
||||
uintptr(unsafe.Pointer(&attrList)),
|
||||
uintptr(unsafe.Pointer(&attributes)),
|
||||
uintptr(unsafe.Sizeof(attributes)),
|
||||
uintptr(options),
|
||||
0,
|
||||
)
|
||||
if e1 != 0 {
|
||||
return e1
|
||||
}
|
||||
return nil
|
||||
return setattrlist(
|
||||
_p0,
|
||||
unsafe.Pointer(&attrList),
|
||||
unsafe.Pointer(&attributes),
|
||||
unsafe.Sizeof(attributes),
|
||||
options)
|
||||
}
|
||||
|
||||
//sys setattrlist(path *byte, list unsafe.Pointer, buf unsafe.Pointer, size uintptr, options int) (err error)
|
||||
|
||||
func utimensat(dirfd int, path string, times *[2]Timespec, flags int) error {
|
||||
// Darwin doesn't support SYS_UTIMENSAT
|
||||
return ENOSYS
|
||||
@ -242,11 +320,11 @@ func IoctlSetInt(fd int, req uint, value int) error {
|
||||
return ioctl(fd, req, uintptr(value))
|
||||
}
|
||||
|
||||
func IoctlSetWinsize(fd int, req uint, value *Winsize) error {
|
||||
func ioctlSetWinsize(fd int, req uint, value *Winsize) error {
|
||||
return ioctl(fd, req, uintptr(unsafe.Pointer(value)))
|
||||
}
|
||||
|
||||
func IoctlSetTermios(fd int, req uint, value *Termios) error {
|
||||
func ioctlSetTermios(fd int, req uint, value *Termios) error {
|
||||
return ioctl(fd, req, uintptr(unsafe.Pointer(value)))
|
||||
}
|
||||
|
||||
@ -270,6 +348,64 @@ func IoctlGetTermios(fd int, req uint) (*Termios, error) {
|
||||
return &value, err
|
||||
}
|
||||
|
||||
func Uname(uname *Utsname) error {
|
||||
mib := []_C_int{CTL_KERN, KERN_OSTYPE}
|
||||
n := unsafe.Sizeof(uname.Sysname)
|
||||
if err := sysctl(mib, &uname.Sysname[0], &n, nil, 0); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
mib = []_C_int{CTL_KERN, KERN_HOSTNAME}
|
||||
n = unsafe.Sizeof(uname.Nodename)
|
||||
if err := sysctl(mib, &uname.Nodename[0], &n, nil, 0); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
mib = []_C_int{CTL_KERN, KERN_OSRELEASE}
|
||||
n = unsafe.Sizeof(uname.Release)
|
||||
if err := sysctl(mib, &uname.Release[0], &n, nil, 0); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
mib = []_C_int{CTL_KERN, KERN_VERSION}
|
||||
n = unsafe.Sizeof(uname.Version)
|
||||
if err := sysctl(mib, &uname.Version[0], &n, nil, 0); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
// The version might have newlines or tabs in it, convert them to
|
||||
// spaces.
|
||||
for i, b := range uname.Version {
|
||||
if b == '\n' || b == '\t' {
|
||||
if i == len(uname.Version)-1 {
|
||||
uname.Version[i] = 0
|
||||
} else {
|
||||
uname.Version[i] = ' '
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
mib = []_C_int{CTL_HW, HW_MACHINE}
|
||||
n = unsafe.Sizeof(uname.Machine)
|
||||
if err := sysctl(mib, &uname.Machine[0], &n, nil, 0); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
func Sendfile(outfd int, infd int, offset *int64, count int) (written int, err error) {
|
||||
if raceenabled {
|
||||
raceReleaseMerge(unsafe.Pointer(&ioSync))
|
||||
}
|
||||
var length = int64(count)
|
||||
err = sendfile(infd, outfd, *offset, &length, nil, 0)
|
||||
written = int(length)
|
||||
return
|
||||
}
|
||||
|
||||
//sys sendfile(infd int, outfd int, offset int64, len *int64, hdtr unsafe.Pointer, flags int) (err error)
|
||||
|
||||
/*
|
||||
* Exposed directly
|
||||
*/
|
||||
@ -280,6 +416,7 @@ func IoctlGetTermios(fd int, req uint) (*Termios, error) {
|
||||
//sys Chmod(path string, mode uint32) (err error)
|
||||
//sys Chown(path string, uid int, gid int) (err error)
|
||||
//sys Chroot(path string) (err error)
|
||||
//sys ClockGettime(clockid int32, time *Timespec) (err error)
|
||||
//sys Close(fd int) (err error)
|
||||
//sys Dup(fd int) (nfd int, err error)
|
||||
//sys Dup2(from int, to int) (err error)
|
||||
@ -294,11 +431,8 @@ func IoctlGetTermios(fd int, req uint) (*Termios, error) {
|
||||
//sys Fchownat(dirfd int, path string, uid int, gid int, flags int) (err error)
|
||||
//sys Flock(fd int, how int) (err error)
|
||||
//sys Fpathconf(fd int, name int) (val int, err error)
|
||||
//sys Fstat(fd int, stat *Stat_t) (err error) = SYS_FSTAT64
|
||||
//sys Fstatfs(fd int, stat *Statfs_t) (err error) = SYS_FSTATFS64
|
||||
//sys Fsync(fd int) (err error)
|
||||
//sys Ftruncate(fd int, length int64) (err error)
|
||||
//sys Getdirentries(fd int, buf []byte, basep *uintptr) (n int, err error) = SYS_GETDIRENTRIES64
|
||||
//sys Getdtablesize() (size int)
|
||||
//sysnb Getegid() (egid int)
|
||||
//sysnb Geteuid() (uid int)
|
||||
@ -318,7 +452,6 @@ func IoctlGetTermios(fd int, req uint) (*Termios, error) {
|
||||
//sys Link(path string, link string) (err error)
|
||||
//sys Linkat(pathfd int, path string, linkfd int, link string, flags int) (err error)
|
||||
//sys Listen(s int, backlog int) (err error)
|
||||
//sys Lstat(path string, stat *Stat_t) (err error) = SYS_LSTAT64
|
||||
//sys Mkdir(path string, mode uint32) (err error)
|
||||
//sys Mkdirat(dirfd int, path string, mode uint32) (err error)
|
||||
//sys Mkfifo(path string, mode uint32) (err error)
|
||||
@ -350,8 +483,6 @@ func IoctlGetTermios(fd int, req uint) (*Termios, error) {
|
||||
//sysnb Setsid() (pid int, err error)
|
||||
//sysnb Settimeofday(tp *Timeval) (err error)
|
||||
//sysnb Setuid(uid int) (err error)
|
||||
//sys Stat(path string, stat *Stat_t) (err error) = SYS_STAT64
|
||||
//sys Statfs(path string, stat *Statfs_t) (err error) = SYS_STATFS64
|
||||
//sys Symlink(path string, link string) (err error)
|
||||
//sys Symlinkat(oldpath string, newdirfd int, newpath string) (err error)
|
||||
//sys Sync() (err error)
|
||||
@ -411,14 +542,6 @@ func IoctlGetTermios(fd int, req uint) (*Termios, error) {
|
||||
// Watchevent
|
||||
// Waitevent
|
||||
// Modwatch
|
||||
// Getxattr
|
||||
// Fgetxattr
|
||||
// Setxattr
|
||||
// Fsetxattr
|
||||
// Removexattr
|
||||
// Fremovexattr
|
||||
// Listxattr
|
||||
// Flistxattr
|
||||
// Fsctl
|
||||
// Initgroups
|
||||
// Posix_spawn
|
||||
|
23
vendor/golang.org/x/sys/unix/syscall_darwin_386.go
generated
vendored
23
vendor/golang.org/x/sys/unix/syscall_darwin_386.go
generated
vendored
@ -8,7 +8,6 @@ package unix
|
||||
|
||||
import (
|
||||
"syscall"
|
||||
"unsafe"
|
||||
)
|
||||
|
||||
func setTimespec(sec, nsec int64) Timespec {
|
||||
@ -48,21 +47,17 @@ func (cmsg *Cmsghdr) SetLen(length int) {
|
||||
cmsg.Len = uint32(length)
|
||||
}
|
||||
|
||||
func sendfile(outfd int, infd int, offset *int64, count int) (written int, err error) {
|
||||
var length = uint64(count)
|
||||
|
||||
_, _, e1 := Syscall9(SYS_SENDFILE, uintptr(infd), uintptr(outfd), uintptr(*offset), uintptr(*offset>>32), uintptr(unsafe.Pointer(&length)), 0, 0, 0, 0)
|
||||
|
||||
written = int(length)
|
||||
|
||||
if e1 != 0 {
|
||||
err = e1
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
func Syscall9(num, a1, a2, a3, a4, a5, a6, a7, a8, a9 uintptr) (r1, r2 uintptr, err syscall.Errno)
|
||||
|
||||
// SYS___SYSCTL is used by syscall_bsd.go for all BSDs, but in modern versions
|
||||
// of darwin/386 the syscall is called sysctl instead of __sysctl.
|
||||
const SYS___SYSCTL = SYS_SYSCTL
|
||||
|
||||
//sys Fstat(fd int, stat *Stat_t) (err error) = SYS_FSTAT64
|
||||
//sys Fstatat(fd int, path string, stat *Stat_t, flags int) (err error) = SYS_FSTATAT64
|
||||
//sys Fstatfs(fd int, stat *Statfs_t) (err error) = SYS_FSTATFS64
|
||||
//sys Getdirentries(fd int, buf []byte, basep *uintptr) (n int, err error) = SYS_GETDIRENTRIES64
|
||||
//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 Stat(path string, stat *Stat_t) (err error) = SYS_STAT64
|
||||
//sys Statfs(path string, stat *Statfs_t) (err error) = SYS_STATFS64
|
||||
|
23
vendor/golang.org/x/sys/unix/syscall_darwin_amd64.go
generated
vendored
23
vendor/golang.org/x/sys/unix/syscall_darwin_amd64.go
generated
vendored
@ -8,7 +8,6 @@ package unix
|
||||
|
||||
import (
|
||||
"syscall"
|
||||
"unsafe"
|
||||
)
|
||||
|
||||
func setTimespec(sec, nsec int64) Timespec {
|
||||
@ -48,21 +47,17 @@ func (cmsg *Cmsghdr) SetLen(length int) {
|
||||
cmsg.Len = uint32(length)
|
||||
}
|
||||
|
||||
func sendfile(outfd int, infd int, offset *int64, count int) (written int, err error) {
|
||||
var length = uint64(count)
|
||||
|
||||
_, _, e1 := Syscall6(SYS_SENDFILE, uintptr(infd), uintptr(outfd), uintptr(*offset), uintptr(unsafe.Pointer(&length)), 0, 0)
|
||||
|
||||
written = int(length)
|
||||
|
||||
if e1 != 0 {
|
||||
err = e1
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
func Syscall9(num, a1, a2, a3, a4, a5, a6, a7, a8, a9 uintptr) (r1, r2 uintptr, err syscall.Errno)
|
||||
|
||||
// SYS___SYSCTL is used by syscall_bsd.go for all BSDs, but in modern versions
|
||||
// of darwin/amd64 the syscall is called sysctl instead of __sysctl.
|
||||
const SYS___SYSCTL = SYS_SYSCTL
|
||||
|
||||
//sys Fstat(fd int, stat *Stat_t) (err error) = SYS_FSTAT64
|
||||
//sys Fstatat(fd int, path string, stat *Stat_t, flags int) (err error) = SYS_FSTATAT64
|
||||
//sys Fstatfs(fd int, stat *Statfs_t) (err error) = SYS_FSTATFS64
|
||||
//sys Getdirentries(fd int, buf []byte, basep *uintptr) (n int, err error) = SYS_GETDIRENTRIES64
|
||||
//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 Stat(path string, stat *Stat_t) (err error) = SYS_STAT64
|
||||
//sys Statfs(path string, stat *Statfs_t) (err error) = SYS_STATFS64
|
||||
|
30
vendor/golang.org/x/sys/unix/syscall_darwin_arm.go
generated
vendored
30
vendor/golang.org/x/sys/unix/syscall_darwin_arm.go
generated
vendored
@ -6,7 +6,6 @@ package unix
|
||||
|
||||
import (
|
||||
"syscall"
|
||||
"unsafe"
|
||||
)
|
||||
|
||||
func setTimespec(sec, nsec int64) Timespec {
|
||||
@ -46,17 +45,20 @@ func (cmsg *Cmsghdr) SetLen(length int) {
|
||||
cmsg.Len = uint32(length)
|
||||
}
|
||||
|
||||
func sendfile(outfd int, infd int, offset *int64, count int) (written int, err error) {
|
||||
var length = uint64(count)
|
||||
|
||||
_, _, e1 := Syscall9(SYS_SENDFILE, uintptr(infd), uintptr(outfd), uintptr(*offset), uintptr(*offset>>32), uintptr(unsafe.Pointer(&length)), 0, 0, 0, 0)
|
||||
|
||||
written = int(length)
|
||||
|
||||
if e1 != 0 {
|
||||
err = e1
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
func Syscall9(num, a1, a2, a3, a4, a5, a6, a7, a8, a9 uintptr) (r1, r2 uintptr, err syscall.Errno) // sic
|
||||
|
||||
// SYS___SYSCTL is used by syscall_bsd.go for all BSDs, but in modern versions
|
||||
// of darwin/arm the syscall is called sysctl instead of __sysctl.
|
||||
const SYS___SYSCTL = SYS_SYSCTL
|
||||
|
||||
//sys Fstat(fd int, stat *Stat_t) (err error)
|
||||
//sys Fstatat(fd int, path string, stat *Stat_t, flags int) (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 Lstat(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)
|
||||
|
||||
func Getdirentries(fd int, buf []byte, basep *uintptr) (n int, err error) {
|
||||
return 0, ENOSYS
|
||||
}
|
||||
|
26
vendor/golang.org/x/sys/unix/syscall_darwin_arm64.go
generated
vendored
26
vendor/golang.org/x/sys/unix/syscall_darwin_arm64.go
generated
vendored
@ -8,7 +8,6 @@ package unix
|
||||
|
||||
import (
|
||||
"syscall"
|
||||
"unsafe"
|
||||
)
|
||||
|
||||
func setTimespec(sec, nsec int64) Timespec {
|
||||
@ -48,21 +47,20 @@ func (cmsg *Cmsghdr) SetLen(length int) {
|
||||
cmsg.Len = uint32(length)
|
||||
}
|
||||
|
||||
func sendfile(outfd int, infd int, offset *int64, count int) (written int, err error) {
|
||||
var length = uint64(count)
|
||||
|
||||
_, _, e1 := Syscall6(SYS_SENDFILE, uintptr(infd), uintptr(outfd), uintptr(*offset), uintptr(unsafe.Pointer(&length)), 0, 0)
|
||||
|
||||
written = int(length)
|
||||
|
||||
if e1 != 0 {
|
||||
err = e1
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
func Syscall9(num, a1, a2, a3, a4, a5, a6, a7, a8, a9 uintptr) (r1, r2 uintptr, err syscall.Errno) // sic
|
||||
|
||||
// SYS___SYSCTL is used by syscall_bsd.go for all BSDs, but in modern versions
|
||||
// of darwin/arm64 the syscall is called sysctl instead of __sysctl.
|
||||
const SYS___SYSCTL = SYS_SYSCTL
|
||||
|
||||
//sys Fstat(fd int, stat *Stat_t) (err error)
|
||||
//sys Fstatat(fd int, path string, stat *Stat_t, flags int) (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 Lstat(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)
|
||||
|
||||
func Getdirentries(fd int, buf []byte, basep *uintptr) (n int, err error) {
|
||||
return 0, ENOSYS
|
||||
}
|
||||
|
31
vendor/golang.org/x/sys/unix/syscall_darwin_libSystem.go
generated
vendored
Normal file
31
vendor/golang.org/x/sys/unix/syscall_darwin_libSystem.go
generated
vendored
Normal file
@ -0,0 +1,31 @@
|
||||
// Copyright 2018 The Go Authors. All rights reserved.
|
||||
// Use of this source code is governed by a BSD-style
|
||||
// license that can be found in the LICENSE file.
|
||||
|
||||
// +build darwin,go1.12
|
||||
|
||||
package unix
|
||||
|
||||
import "unsafe"
|
||||
|
||||
// Implemented in the runtime package (runtime/sys_darwin.go)
|
||||
func syscall_syscall(fn, a1, a2, a3 uintptr) (r1, r2 uintptr, err Errno)
|
||||
func syscall_syscall6(fn, a1, a2, a3, a4, a5, a6 uintptr) (r1, r2 uintptr, err Errno)
|
||||
func syscall_syscall6X(fn, a1, a2, a3, a4, a5, a6 uintptr) (r1, r2 uintptr, err Errno)
|
||||
func syscall_syscall9(fn, a1, a2, a3, a4, a5, a6, a7, a8, a9 uintptr) (r1, r2 uintptr, err Errno) // 32-bit only
|
||||
func syscall_rawSyscall(fn, a1, a2, a3 uintptr) (r1, r2 uintptr, err Errno)
|
||||
func syscall_rawSyscall6(fn, a1, a2, a3, a4, a5, a6 uintptr) (r1, r2 uintptr, err Errno)
|
||||
|
||||
//go:linkname syscall_syscall syscall.syscall
|
||||
//go:linkname syscall_syscall6 syscall.syscall6
|
||||
//go:linkname syscall_syscall6X syscall.syscall6X
|
||||
//go:linkname syscall_syscall9 syscall.syscall9
|
||||
//go:linkname syscall_rawSyscall syscall.rawSyscall
|
||||
//go:linkname syscall_rawSyscall6 syscall.rawSyscall6
|
||||
|
||||
// Find the entry point for f. See comments in runtime/proc.go for the
|
||||
// function of the same name.
|
||||
//go:nosplit
|
||||
func funcPC(f func()) uintptr {
|
||||
return **(**uintptr)(unsafe.Pointer(&f))
|
||||
}
|
121
vendor/golang.org/x/sys/unix/syscall_dragonfly.go
generated
vendored
121
vendor/golang.org/x/sys/unix/syscall_dragonfly.go
generated
vendored
@ -14,6 +14,7 @@ package unix
|
||||
|
||||
import "unsafe"
|
||||
|
||||
// SockaddrDatalink implements the Sockaddr interface for AF_LINK type sockets.
|
||||
type SockaddrDatalink struct {
|
||||
Len uint8
|
||||
Family uint8
|
||||
@ -56,22 +57,6 @@ func nametomib(name string) (mib []_C_int, err error) {
|
||||
return buf[0 : n/siz], nil
|
||||
}
|
||||
|
||||
func direntIno(buf []byte) (uint64, bool) {
|
||||
return readInt(buf, unsafe.Offsetof(Dirent{}.Fileno), unsafe.Sizeof(Dirent{}.Fileno))
|
||||
}
|
||||
|
||||
func direntReclen(buf []byte) (uint64, bool) {
|
||||
namlen, ok := direntNamlen(buf)
|
||||
if !ok {
|
||||
return 0, false
|
||||
}
|
||||
return (16 + namlen + 1 + 7) &^ 7, true
|
||||
}
|
||||
|
||||
func direntNamlen(buf []byte) (uint64, bool) {
|
||||
return readInt(buf, unsafe.Offsetof(Dirent{}.Namlen), unsafe.Sizeof(Dirent{}.Namlen))
|
||||
}
|
||||
|
||||
//sysnb pipe() (r int, w int, err error)
|
||||
|
||||
func Pipe(p []int) (err error) {
|
||||
@ -102,7 +87,7 @@ func Accept4(fd, flags int) (nfd int, sa Sockaddr, err error) {
|
||||
if len > SizeofSockaddrAny {
|
||||
panic("RawSockaddrAny too small")
|
||||
}
|
||||
sa, err = anyToSockaddr(&rsa)
|
||||
sa, err = anyToSockaddr(fd, &rsa)
|
||||
if err != nil {
|
||||
Close(nfd)
|
||||
nfd = 0
|
||||
@ -110,6 +95,23 @@ func Accept4(fd, flags int) (nfd int, sa Sockaddr, err error) {
|
||||
return
|
||||
}
|
||||
|
||||
const ImplementsGetwd = true
|
||||
|
||||
//sys Getcwd(buf []byte) (n int, err error) = SYS___GETCWD
|
||||
|
||||
func Getwd() (string, error) {
|
||||
var buf [PathMax]byte
|
||||
_, err := Getcwd(buf[0:])
|
||||
if err != nil {
|
||||
return "", err
|
||||
}
|
||||
n := clen(buf[:])
|
||||
if n < 1 {
|
||||
return "", EINVAL
|
||||
}
|
||||
return string(buf[:n]), nil
|
||||
}
|
||||
|
||||
func Getfsstat(buf []Statfs_t, flags int) (n int, err error) {
|
||||
var _p0 unsafe.Pointer
|
||||
var bufsize uintptr
|
||||
@ -141,11 +143,11 @@ func IoctlSetInt(fd int, req uint, value int) error {
|
||||
return ioctl(fd, req, uintptr(value))
|
||||
}
|
||||
|
||||
func IoctlSetWinsize(fd int, req uint, value *Winsize) error {
|
||||
func ioctlSetWinsize(fd int, req uint, value *Winsize) error {
|
||||
return ioctl(fd, req, uintptr(unsafe.Pointer(value)))
|
||||
}
|
||||
|
||||
func IoctlSetTermios(fd int, req uint, value *Termios) error {
|
||||
func ioctlSetTermios(fd int, req uint, value *Termios) error {
|
||||
return ioctl(fd, req, uintptr(unsafe.Pointer(value)))
|
||||
}
|
||||
|
||||
@ -169,6 +171,76 @@ func IoctlGetTermios(fd int, req uint) (*Termios, error) {
|
||||
return &value, err
|
||||
}
|
||||
|
||||
func sysctlUname(mib []_C_int, old *byte, oldlen *uintptr) error {
|
||||
err := sysctl(mib, old, oldlen, nil, 0)
|
||||
if err != nil {
|
||||
// Utsname members on Dragonfly are only 32 bytes and
|
||||
// the syscall returns ENOMEM in case the actual value
|
||||
// is longer.
|
||||
if err == ENOMEM {
|
||||
err = nil
|
||||
}
|
||||
}
|
||||
return err
|
||||
}
|
||||
|
||||
func Uname(uname *Utsname) error {
|
||||
mib := []_C_int{CTL_KERN, KERN_OSTYPE}
|
||||
n := unsafe.Sizeof(uname.Sysname)
|
||||
if err := sysctlUname(mib, &uname.Sysname[0], &n); err != nil {
|
||||
return err
|
||||
}
|
||||
uname.Sysname[unsafe.Sizeof(uname.Sysname)-1] = 0
|
||||
|
||||
mib = []_C_int{CTL_KERN, KERN_HOSTNAME}
|
||||
n = unsafe.Sizeof(uname.Nodename)
|
||||
if err := sysctlUname(mib, &uname.Nodename[0], &n); err != nil {
|
||||
return err
|
||||
}
|
||||
uname.Nodename[unsafe.Sizeof(uname.Nodename)-1] = 0
|
||||
|
||||
mib = []_C_int{CTL_KERN, KERN_OSRELEASE}
|
||||
n = unsafe.Sizeof(uname.Release)
|
||||
if err := sysctlUname(mib, &uname.Release[0], &n); err != nil {
|
||||
return err
|
||||
}
|
||||
uname.Release[unsafe.Sizeof(uname.Release)-1] = 0
|
||||
|
||||
mib = []_C_int{CTL_KERN, KERN_VERSION}
|
||||
n = unsafe.Sizeof(uname.Version)
|
||||
if err := sysctlUname(mib, &uname.Version[0], &n); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
// The version might have newlines or tabs in it, convert them to
|
||||
// spaces.
|
||||
for i, b := range uname.Version {
|
||||
if b == '\n' || b == '\t' {
|
||||
if i == len(uname.Version)-1 {
|
||||
uname.Version[i] = 0
|
||||
} else {
|
||||
uname.Version[i] = ' '
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
mib = []_C_int{CTL_HW, HW_MACHINE}
|
||||
n = unsafe.Sizeof(uname.Machine)
|
||||
if err := sysctlUname(mib, &uname.Machine[0], &n); err != nil {
|
||||
return err
|
||||
}
|
||||
uname.Machine[unsafe.Sizeof(uname.Machine)-1] = 0
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
func Sendfile(outfd int, infd int, offset *int64, count int) (written int, err error) {
|
||||
if raceenabled {
|
||||
raceReleaseMerge(unsafe.Pointer(&ioSync))
|
||||
}
|
||||
return sendfile(outfd, infd, offset, count)
|
||||
}
|
||||
|
||||
/*
|
||||
* Exposed directly
|
||||
*/
|
||||
@ -183,13 +255,17 @@ func IoctlGetTermios(fd int, req uint) (*Termios, error) {
|
||||
//sys Dup(fd int) (nfd int, err error)
|
||||
//sys Dup2(from int, to int) (err error)
|
||||
//sys Exit(code int)
|
||||
//sys Faccessat(dirfd int, path string, mode uint32, flags int) (err error)
|
||||
//sys Fchdir(fd int) (err error)
|
||||
//sys Fchflags(fd int, flags int) (err error)
|
||||
//sys Fchmod(fd int, mode uint32) (err error)
|
||||
//sys Fchmodat(dirfd int, path string, mode uint32, flags int) (err error)
|
||||
//sys Fchown(fd int, uid int, gid int) (err error)
|
||||
//sys Fchownat(dirfd int, path string, uid int, gid int, flags int) (err error)
|
||||
//sys Flock(fd int, how int) (err error)
|
||||
//sys Fpathconf(fd int, name int) (val int, err error)
|
||||
//sys Fstat(fd int, stat *Stat_t) (err error)
|
||||
//sys Fstatat(fd int, path string, stat *Stat_t, flags int) (err error)
|
||||
//sys Fstatfs(fd int, stat *Statfs_t) (err error)
|
||||
//sys Fsync(fd int) (err error)
|
||||
//sys Ftruncate(fd int, length int64) (err error)
|
||||
@ -213,17 +289,22 @@ func IoctlGetTermios(fd int, req uint) (*Termios, error) {
|
||||
//sys Kqueue() (fd int, err error)
|
||||
//sys Lchown(path string, uid int, gid int) (err error)
|
||||
//sys Link(path string, link string) (err error)
|
||||
//sys Linkat(pathfd int, path string, linkfd int, link string, flags int) (err error)
|
||||
//sys Listen(s int, backlog int) (err error)
|
||||
//sys Lstat(path string, stat *Stat_t) (err error)
|
||||
//sys Mkdir(path string, mode uint32) (err error)
|
||||
//sys Mkdirat(dirfd int, path string, mode uint32) (err error)
|
||||
//sys Mkfifo(path string, mode uint32) (err error)
|
||||
//sys Mknod(path string, mode uint32, dev int) (err error)
|
||||
//sys Mknodat(fd int, path string, mode uint32, dev int) (err error)
|
||||
//sys Nanosleep(time *Timespec, leftover *Timespec) (err error)
|
||||
//sys Open(path string, mode int, perm uint32) (fd int, err error)
|
||||
//sys Openat(dirfd int, path string, mode int, perm uint32) (fd int, err error)
|
||||
//sys Pathconf(path string, name int) (val int, err error)
|
||||
//sys read(fd int, p []byte) (n int, err error)
|
||||
//sys Readlink(path string, buf []byte) (n int, err error)
|
||||
//sys Rename(from string, to string) (err error)
|
||||
//sys Renameat(fromfd int, from string, tofd int, to string) (err error)
|
||||
//sys Revoke(path string) (err error)
|
||||
//sys Rmdir(path string) (err error)
|
||||
//sys Seek(fd int, offset int64, whence int) (newoffset int64, err error) = SYS_LSEEK
|
||||
@ -245,11 +326,13 @@ func IoctlGetTermios(fd int, req uint) (*Termios, error) {
|
||||
//sys Stat(path string, stat *Stat_t) (err error)
|
||||
//sys Statfs(path string, stat *Statfs_t) (err error)
|
||||
//sys Symlink(path string, link string) (err error)
|
||||
//sys Symlinkat(oldpath string, newdirfd int, newpath string) (err error)
|
||||
//sys Sync() (err error)
|
||||
//sys Truncate(path string, length int64) (err error)
|
||||
//sys Umask(newmask int) (oldmask int)
|
||||
//sys Undelete(path string) (err error)
|
||||
//sys Unlink(path string) (err error)
|
||||
//sys Unlinkat(dirfd int, path string, flags int) (err error)
|
||||
//sys Unmount(path string, flags int) (err error)
|
||||
//sys write(fd int, p []byte) (n int, err error)
|
||||
//sys mmap(addr uintptr, length uintptr, prot int, flag int, fd int, pos int64) (ret uintptr, err error)
|
||||
|
660
vendor/golang.org/x/sys/unix/syscall_freebsd.go
generated
vendored
660
vendor/golang.org/x/sys/unix/syscall_freebsd.go
generated
vendored
@ -12,8 +12,36 @@
|
||||
|
||||
package unix
|
||||
|
||||
import "unsafe"
|
||||
import (
|
||||
"sync"
|
||||
"unsafe"
|
||||
)
|
||||
|
||||
const (
|
||||
SYS_FSTAT_FREEBSD12 = 551 // { int fstat(int fd, _Out_ struct stat *sb); }
|
||||
SYS_FSTATAT_FREEBSD12 = 552 // { int fstatat(int fd, _In_z_ char *path, \
|
||||
SYS_GETDIRENTRIES_FREEBSD12 = 554 // { ssize_t getdirentries(int fd, \
|
||||
SYS_STATFS_FREEBSD12 = 555 // { int statfs(_In_z_ char *path, \
|
||||
SYS_FSTATFS_FREEBSD12 = 556 // { int fstatfs(int fd, \
|
||||
SYS_GETFSSTAT_FREEBSD12 = 557 // { int getfsstat( \
|
||||
SYS_MKNODAT_FREEBSD12 = 559 // { int mknodat(int fd, _In_z_ char *path, \
|
||||
)
|
||||
|
||||
// See https://www.freebsd.org/doc/en_US.ISO8859-1/books/porters-handbook/versions.html.
|
||||
var (
|
||||
osreldateOnce sync.Once
|
||||
osreldate uint32
|
||||
)
|
||||
|
||||
// INO64_FIRST from /usr/src/lib/libc/sys/compat-ino64.h
|
||||
const _ino64First = 1200031
|
||||
|
||||
func supportsABI(ver uint32) bool {
|
||||
osreldateOnce.Do(func() { osreldate, _ = SysctlUint32("kern.osreldate") })
|
||||
return osreldate >= ver
|
||||
}
|
||||
|
||||
// SockaddrDatalink implements the Sockaddr interface for AF_LINK type sockets.
|
||||
type SockaddrDatalink struct {
|
||||
Len uint8
|
||||
Family uint8
|
||||
@ -54,26 +82,21 @@ func nametomib(name string) (mib []_C_int, err error) {
|
||||
return buf[0 : n/siz], nil
|
||||
}
|
||||
|
||||
func direntIno(buf []byte) (uint64, bool) {
|
||||
return readInt(buf, unsafe.Offsetof(Dirent{}.Fileno), unsafe.Sizeof(Dirent{}.Fileno))
|
||||
}
|
||||
|
||||
func direntReclen(buf []byte) (uint64, bool) {
|
||||
return readInt(buf, unsafe.Offsetof(Dirent{}.Reclen), unsafe.Sizeof(Dirent{}.Reclen))
|
||||
}
|
||||
|
||||
func direntNamlen(buf []byte) (uint64, bool) {
|
||||
return readInt(buf, unsafe.Offsetof(Dirent{}.Namlen), unsafe.Sizeof(Dirent{}.Namlen))
|
||||
}
|
||||
|
||||
//sysnb pipe() (r int, w int, err error)
|
||||
|
||||
func Pipe(p []int) (err error) {
|
||||
return Pipe2(p, 0)
|
||||
}
|
||||
|
||||
//sysnb pipe2(p *[2]_C_int, flags int) (err error)
|
||||
|
||||
func Pipe2(p []int, flags int) error {
|
||||
if len(p) != 2 {
|
||||
return EINVAL
|
||||
}
|
||||
p[0], p[1], err = pipe()
|
||||
return
|
||||
var pp [2]_C_int
|
||||
err := pipe2(&pp, flags)
|
||||
p[0] = int(pp[0])
|
||||
p[1] = int(pp[1])
|
||||
return err
|
||||
}
|
||||
|
||||
func GetsockoptIPMreqn(fd, level, opt int) (*IPMreqn, error) {
|
||||
@ -97,7 +120,7 @@ func Accept4(fd, flags int) (nfd int, sa Sockaddr, err error) {
|
||||
if len > SizeofSockaddrAny {
|
||||
panic("RawSockaddrAny too small")
|
||||
}
|
||||
sa, err = anyToSockaddr(&rsa)
|
||||
sa, err = anyToSockaddr(fd, &rsa)
|
||||
if err != nil {
|
||||
Close(nfd)
|
||||
nfd = 0
|
||||
@ -105,18 +128,57 @@ func Accept4(fd, flags int) (nfd int, sa Sockaddr, err error) {
|
||||
return
|
||||
}
|
||||
|
||||
func Getfsstat(buf []Statfs_t, flags int) (n int, err error) {
|
||||
var _p0 unsafe.Pointer
|
||||
var bufsize uintptr
|
||||
if len(buf) > 0 {
|
||||
_p0 = unsafe.Pointer(&buf[0])
|
||||
bufsize = unsafe.Sizeof(Statfs_t{}) * uintptr(len(buf))
|
||||
const ImplementsGetwd = true
|
||||
|
||||
//sys Getcwd(buf []byte) (n int, err error) = SYS___GETCWD
|
||||
|
||||
func Getwd() (string, error) {
|
||||
var buf [PathMax]byte
|
||||
_, err := Getcwd(buf[0:])
|
||||
if err != nil {
|
||||
return "", err
|
||||
}
|
||||
r0, _, e1 := Syscall(SYS_GETFSSTAT, uintptr(_p0), bufsize, uintptr(flags))
|
||||
n := clen(buf[:])
|
||||
if n < 1 {
|
||||
return "", EINVAL
|
||||
}
|
||||
return string(buf[:n]), nil
|
||||
}
|
||||
|
||||
func Getfsstat(buf []Statfs_t, flags int) (n int, err error) {
|
||||
var (
|
||||
_p0 unsafe.Pointer
|
||||
bufsize uintptr
|
||||
oldBuf []statfs_freebsd11_t
|
||||
needsConvert bool
|
||||
)
|
||||
|
||||
if len(buf) > 0 {
|
||||
if supportsABI(_ino64First) {
|
||||
_p0 = unsafe.Pointer(&buf[0])
|
||||
bufsize = unsafe.Sizeof(Statfs_t{}) * uintptr(len(buf))
|
||||
} else {
|
||||
n := len(buf)
|
||||
oldBuf = make([]statfs_freebsd11_t, n)
|
||||
_p0 = unsafe.Pointer(&oldBuf[0])
|
||||
bufsize = unsafe.Sizeof(statfs_freebsd11_t{}) * uintptr(n)
|
||||
needsConvert = true
|
||||
}
|
||||
}
|
||||
var sysno uintptr = SYS_GETFSSTAT
|
||||
if supportsABI(_ino64First) {
|
||||
sysno = SYS_GETFSSTAT_FREEBSD12
|
||||
}
|
||||
r0, _, e1 := Syscall(sysno, uintptr(_p0), bufsize, uintptr(flags))
|
||||
n = int(r0)
|
||||
if e1 != 0 {
|
||||
err = e1
|
||||
}
|
||||
if e1 == 0 && needsConvert {
|
||||
for i := range oldBuf {
|
||||
buf[i].convertFrom(&oldBuf[i])
|
||||
}
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
@ -125,238 +187,6 @@ func setattrlistTimes(path string, times []Timespec, flags int) error {
|
||||
return ENOSYS
|
||||
}
|
||||
|
||||
// Derive extattr namespace and attribute name
|
||||
|
||||
func xattrnamespace(fullattr string) (ns int, attr string, err error) {
|
||||
s := -1
|
||||
for idx, val := range fullattr {
|
||||
if val == '.' {
|
||||
s = idx
|
||||
break
|
||||
}
|
||||
}
|
||||
|
||||
if s == -1 {
|
||||
return -1, "", ENOATTR
|
||||
}
|
||||
|
||||
namespace := fullattr[0:s]
|
||||
attr = fullattr[s+1:]
|
||||
|
||||
switch namespace {
|
||||
case "user":
|
||||
return EXTATTR_NAMESPACE_USER, attr, nil
|
||||
case "system":
|
||||
return EXTATTR_NAMESPACE_SYSTEM, attr, nil
|
||||
default:
|
||||
return -1, "", ENOATTR
|
||||
}
|
||||
}
|
||||
|
||||
func initxattrdest(dest []byte, idx int) (d unsafe.Pointer) {
|
||||
if len(dest) > idx {
|
||||
return unsafe.Pointer(&dest[idx])
|
||||
} else {
|
||||
return unsafe.Pointer(_zero)
|
||||
}
|
||||
}
|
||||
|
||||
// FreeBSD implements its own syscalls to handle extended attributes
|
||||
|
||||
func Getxattr(file string, attr string, dest []byte) (sz int, err error) {
|
||||
d := initxattrdest(dest, 0)
|
||||
destsize := len(dest)
|
||||
|
||||
nsid, a, err := xattrnamespace(attr)
|
||||
if err != nil {
|
||||
return -1, err
|
||||
}
|
||||
|
||||
return ExtattrGetFile(file, nsid, a, uintptr(d), destsize)
|
||||
}
|
||||
|
||||
func Fgetxattr(fd int, attr string, dest []byte) (sz int, err error) {
|
||||
d := initxattrdest(dest, 0)
|
||||
destsize := len(dest)
|
||||
|
||||
nsid, a, err := xattrnamespace(attr)
|
||||
if err != nil {
|
||||
return -1, err
|
||||
}
|
||||
|
||||
return ExtattrGetFd(fd, nsid, a, uintptr(d), destsize)
|
||||
}
|
||||
|
||||
func Lgetxattr(link string, attr string, dest []byte) (sz int, err error) {
|
||||
d := initxattrdest(dest, 0)
|
||||
destsize := len(dest)
|
||||
|
||||
nsid, a, err := xattrnamespace(attr)
|
||||
if err != nil {
|
||||
return -1, err
|
||||
}
|
||||
|
||||
return ExtattrGetLink(link, nsid, a, uintptr(d), destsize)
|
||||
}
|
||||
|
||||
// flags are unused on FreeBSD
|
||||
|
||||
func Fsetxattr(fd int, attr string, data []byte, flags int) (err error) {
|
||||
d := unsafe.Pointer(&data[0])
|
||||
datasiz := len(data)
|
||||
|
||||
nsid, a, err := xattrnamespace(attr)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
|
||||
_, err = ExtattrSetFd(fd, nsid, a, uintptr(d), datasiz)
|
||||
return
|
||||
}
|
||||
|
||||
func Setxattr(file string, attr string, data []byte, flags int) (err error) {
|
||||
d := unsafe.Pointer(&data[0])
|
||||
datasiz := len(data)
|
||||
|
||||
nsid, a, err := xattrnamespace(attr)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
|
||||
_, err = ExtattrSetFile(file, nsid, a, uintptr(d), datasiz)
|
||||
return
|
||||
}
|
||||
|
||||
func Lsetxattr(link string, attr string, data []byte, flags int) (err error) {
|
||||
d := unsafe.Pointer(&data[0])
|
||||
datasiz := len(data)
|
||||
|
||||
nsid, a, err := xattrnamespace(attr)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
|
||||
_, err = ExtattrSetLink(link, nsid, a, uintptr(d), datasiz)
|
||||
return
|
||||
}
|
||||
|
||||
func Removexattr(file string, attr string) (err error) {
|
||||
nsid, a, err := xattrnamespace(attr)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
|
||||
err = ExtattrDeleteFile(file, nsid, a)
|
||||
return
|
||||
}
|
||||
|
||||
func Fremovexattr(fd int, attr string) (err error) {
|
||||
nsid, a, err := xattrnamespace(attr)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
|
||||
err = ExtattrDeleteFd(fd, nsid, a)
|
||||
return
|
||||
}
|
||||
|
||||
func Lremovexattr(link string, attr string) (err error) {
|
||||
nsid, a, err := xattrnamespace(attr)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
|
||||
err = ExtattrDeleteLink(link, nsid, a)
|
||||
return
|
||||
}
|
||||
|
||||
func Listxattr(file string, dest []byte) (sz int, err error) {
|
||||
d := initxattrdest(dest, 0)
|
||||
destsiz := len(dest)
|
||||
|
||||
// FreeBSD won't allow you to list xattrs from multiple namespaces
|
||||
s := 0
|
||||
var e error
|
||||
for _, nsid := range [...]int{EXTATTR_NAMESPACE_USER, EXTATTR_NAMESPACE_SYSTEM} {
|
||||
stmp, e := ExtattrListFile(file, nsid, uintptr(d), destsiz)
|
||||
|
||||
/* Errors accessing system attrs are ignored so that
|
||||
* we can implement the Linux-like behavior of omitting errors that
|
||||
* we don't have read permissions on
|
||||
*
|
||||
* Linux will still error if we ask for user attributes on a file that
|
||||
* we don't have read permissions on, so don't ignore those errors
|
||||
*/
|
||||
if e != nil && e == EPERM && nsid != EXTATTR_NAMESPACE_USER {
|
||||
e = nil
|
||||
continue
|
||||
} else if e != nil {
|
||||
return s, e
|
||||
}
|
||||
|
||||
s += stmp
|
||||
destsiz -= s
|
||||
if destsiz < 0 {
|
||||
destsiz = 0
|
||||
}
|
||||
d = initxattrdest(dest, s)
|
||||
}
|
||||
|
||||
return s, e
|
||||
}
|
||||
|
||||
func Flistxattr(fd int, dest []byte) (sz int, err error) {
|
||||
d := initxattrdest(dest, 0)
|
||||
destsiz := len(dest)
|
||||
|
||||
s := 0
|
||||
var e error
|
||||
for _, nsid := range [...]int{EXTATTR_NAMESPACE_USER, EXTATTR_NAMESPACE_SYSTEM} {
|
||||
stmp, e := ExtattrListFd(fd, nsid, uintptr(d), destsiz)
|
||||
if e != nil && e == EPERM && nsid != EXTATTR_NAMESPACE_USER {
|
||||
e = nil
|
||||
continue
|
||||
} else if e != nil {
|
||||
return s, e
|
||||
}
|
||||
|
||||
s += stmp
|
||||
destsiz -= s
|
||||
if destsiz < 0 {
|
||||
destsiz = 0
|
||||
}
|
||||
d = initxattrdest(dest, s)
|
||||
}
|
||||
|
||||
return s, e
|
||||
}
|
||||
|
||||
func Llistxattr(link string, dest []byte) (sz int, err error) {
|
||||
d := initxattrdest(dest, 0)
|
||||
destsiz := len(dest)
|
||||
|
||||
s := 0
|
||||
var e error
|
||||
for _, nsid := range [...]int{EXTATTR_NAMESPACE_USER, EXTATTR_NAMESPACE_SYSTEM} {
|
||||
stmp, e := ExtattrListLink(link, nsid, uintptr(d), destsiz)
|
||||
if e != nil && e == EPERM && nsid != EXTATTR_NAMESPACE_USER {
|
||||
e = nil
|
||||
continue
|
||||
} else if e != nil {
|
||||
return s, e
|
||||
}
|
||||
|
||||
s += stmp
|
||||
destsiz -= s
|
||||
if destsiz < 0 {
|
||||
destsiz = 0
|
||||
}
|
||||
d = initxattrdest(dest, s)
|
||||
}
|
||||
|
||||
return s, e
|
||||
}
|
||||
|
||||
//sys ioctl(fd int, req uint, arg uintptr) (err error)
|
||||
|
||||
// ioctl itself should not be exposed directly, but additional get/set
|
||||
@ -368,11 +198,11 @@ func IoctlSetInt(fd int, req uint, value int) error {
|
||||
return ioctl(fd, req, uintptr(value))
|
||||
}
|
||||
|
||||
func IoctlSetWinsize(fd int, req uint, value *Winsize) error {
|
||||
func ioctlSetWinsize(fd int, req uint, value *Winsize) error {
|
||||
return ioctl(fd, req, uintptr(unsafe.Pointer(value)))
|
||||
}
|
||||
|
||||
func IoctlSetTermios(fd int, req uint, value *Termios) error {
|
||||
func ioctlSetTermios(fd int, req uint, value *Termios) error {
|
||||
return ioctl(fd, req, uintptr(unsafe.Pointer(value)))
|
||||
}
|
||||
|
||||
@ -396,6 +226,287 @@ func IoctlGetTermios(fd int, req uint) (*Termios, error) {
|
||||
return &value, err
|
||||
}
|
||||
|
||||
func Uname(uname *Utsname) error {
|
||||
mib := []_C_int{CTL_KERN, KERN_OSTYPE}
|
||||
n := unsafe.Sizeof(uname.Sysname)
|
||||
if err := sysctl(mib, &uname.Sysname[0], &n, nil, 0); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
mib = []_C_int{CTL_KERN, KERN_HOSTNAME}
|
||||
n = unsafe.Sizeof(uname.Nodename)
|
||||
if err := sysctl(mib, &uname.Nodename[0], &n, nil, 0); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
mib = []_C_int{CTL_KERN, KERN_OSRELEASE}
|
||||
n = unsafe.Sizeof(uname.Release)
|
||||
if err := sysctl(mib, &uname.Release[0], &n, nil, 0); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
mib = []_C_int{CTL_KERN, KERN_VERSION}
|
||||
n = unsafe.Sizeof(uname.Version)
|
||||
if err := sysctl(mib, &uname.Version[0], &n, nil, 0); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
// The version might have newlines or tabs in it, convert them to
|
||||
// spaces.
|
||||
for i, b := range uname.Version {
|
||||
if b == '\n' || b == '\t' {
|
||||
if i == len(uname.Version)-1 {
|
||||
uname.Version[i] = 0
|
||||
} else {
|
||||
uname.Version[i] = ' '
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
mib = []_C_int{CTL_HW, HW_MACHINE}
|
||||
n = unsafe.Sizeof(uname.Machine)
|
||||
if err := sysctl(mib, &uname.Machine[0], &n, nil, 0); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
func Stat(path string, st *Stat_t) (err error) {
|
||||
var oldStat stat_freebsd11_t
|
||||
if supportsABI(_ino64First) {
|
||||
return fstatat_freebsd12(AT_FDCWD, path, st, 0)
|
||||
}
|
||||
err = stat(path, &oldStat)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
st.convertFrom(&oldStat)
|
||||
return nil
|
||||
}
|
||||
|
||||
func Lstat(path string, st *Stat_t) (err error) {
|
||||
var oldStat stat_freebsd11_t
|
||||
if supportsABI(_ino64First) {
|
||||
return fstatat_freebsd12(AT_FDCWD, path, st, AT_SYMLINK_NOFOLLOW)
|
||||
}
|
||||
err = lstat(path, &oldStat)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
st.convertFrom(&oldStat)
|
||||
return nil
|
||||
}
|
||||
|
||||
func Fstat(fd int, st *Stat_t) (err error) {
|
||||
var oldStat stat_freebsd11_t
|
||||
if supportsABI(_ino64First) {
|
||||
return fstat_freebsd12(fd, st)
|
||||
}
|
||||
err = fstat(fd, &oldStat)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
st.convertFrom(&oldStat)
|
||||
return nil
|
||||
}
|
||||
|
||||
func Fstatat(fd int, path string, st *Stat_t, flags int) (err error) {
|
||||
var oldStat stat_freebsd11_t
|
||||
if supportsABI(_ino64First) {
|
||||
return fstatat_freebsd12(fd, path, st, flags)
|
||||
}
|
||||
err = fstatat(fd, path, &oldStat, flags)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
st.convertFrom(&oldStat)
|
||||
return nil
|
||||
}
|
||||
|
||||
func Statfs(path string, st *Statfs_t) (err error) {
|
||||
var oldStatfs statfs_freebsd11_t
|
||||
if supportsABI(_ino64First) {
|
||||
return statfs_freebsd12(path, st)
|
||||
}
|
||||
err = statfs(path, &oldStatfs)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
st.convertFrom(&oldStatfs)
|
||||
return nil
|
||||
}
|
||||
|
||||
func Fstatfs(fd int, st *Statfs_t) (err error) {
|
||||
var oldStatfs statfs_freebsd11_t
|
||||
if supportsABI(_ino64First) {
|
||||
return fstatfs_freebsd12(fd, st)
|
||||
}
|
||||
err = fstatfs(fd, &oldStatfs)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
st.convertFrom(&oldStatfs)
|
||||
return nil
|
||||
}
|
||||
|
||||
func Getdents(fd int, buf []byte) (n int, err error) {
|
||||
return Getdirentries(fd, buf, nil)
|
||||
}
|
||||
|
||||
func Getdirentries(fd int, buf []byte, basep *uintptr) (n int, err error) {
|
||||
if supportsABI(_ino64First) {
|
||||
return getdirentries_freebsd12(fd, buf, basep)
|
||||
}
|
||||
|
||||
// The old syscall entries are smaller than the new. Use 1/4 of the original
|
||||
// buffer size rounded up to DIRBLKSIZ (see /usr/src/lib/libc/sys/getdirentries.c).
|
||||
oldBufLen := roundup(len(buf)/4, _dirblksiz)
|
||||
oldBuf := make([]byte, oldBufLen)
|
||||
n, err = getdirentries(fd, oldBuf, basep)
|
||||
if err == nil && n > 0 {
|
||||
n = convertFromDirents11(buf, oldBuf[:n])
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
func Mknod(path string, mode uint32, dev uint64) (err error) {
|
||||
var oldDev int
|
||||
if supportsABI(_ino64First) {
|
||||
return mknodat_freebsd12(AT_FDCWD, path, mode, dev)
|
||||
}
|
||||
oldDev = int(dev)
|
||||
return mknod(path, mode, oldDev)
|
||||
}
|
||||
|
||||
func Mknodat(fd int, path string, mode uint32, dev uint64) (err error) {
|
||||
var oldDev int
|
||||
if supportsABI(_ino64First) {
|
||||
return mknodat_freebsd12(fd, path, mode, dev)
|
||||
}
|
||||
oldDev = int(dev)
|
||||
return mknodat(fd, path, mode, oldDev)
|
||||
}
|
||||
|
||||
// round x to the nearest multiple of y, larger or equal to x.
|
||||
//
|
||||
// from /usr/include/sys/param.h Macros for counting and rounding.
|
||||
// #define roundup(x, y) ((((x)+((y)-1))/(y))*(y))
|
||||
func roundup(x, y int) int {
|
||||
return ((x + y - 1) / y) * y
|
||||
}
|
||||
|
||||
func (s *Stat_t) convertFrom(old *stat_freebsd11_t) {
|
||||
*s = Stat_t{
|
||||
Dev: uint64(old.Dev),
|
||||
Ino: uint64(old.Ino),
|
||||
Nlink: uint64(old.Nlink),
|
||||
Mode: old.Mode,
|
||||
Uid: old.Uid,
|
||||
Gid: old.Gid,
|
||||
Rdev: uint64(old.Rdev),
|
||||
Atim: old.Atim,
|
||||
Mtim: old.Mtim,
|
||||
Ctim: old.Ctim,
|
||||
Birthtim: old.Birthtim,
|
||||
Size: old.Size,
|
||||
Blocks: old.Blocks,
|
||||
Blksize: old.Blksize,
|
||||
Flags: old.Flags,
|
||||
Gen: uint64(old.Gen),
|
||||
}
|
||||
}
|
||||
|
||||
func (s *Statfs_t) convertFrom(old *statfs_freebsd11_t) {
|
||||
*s = Statfs_t{
|
||||
Version: _statfsVersion,
|
||||
Type: old.Type,
|
||||
Flags: old.Flags,
|
||||
Bsize: old.Bsize,
|
||||
Iosize: old.Iosize,
|
||||
Blocks: old.Blocks,
|
||||
Bfree: old.Bfree,
|
||||
Bavail: old.Bavail,
|
||||
Files: old.Files,
|
||||
Ffree: old.Ffree,
|
||||
Syncwrites: old.Syncwrites,
|
||||
Asyncwrites: old.Asyncwrites,
|
||||
Syncreads: old.Syncreads,
|
||||
Asyncreads: old.Asyncreads,
|
||||
// Spare
|
||||
Namemax: old.Namemax,
|
||||
Owner: old.Owner,
|
||||
Fsid: old.Fsid,
|
||||
// Charspare
|
||||
// Fstypename
|
||||
// Mntfromname
|
||||
// Mntonname
|
||||
}
|
||||
|
||||
sl := old.Fstypename[:]
|
||||
n := clen(*(*[]byte)(unsafe.Pointer(&sl)))
|
||||
copy(s.Fstypename[:], old.Fstypename[:n])
|
||||
|
||||
sl = old.Mntfromname[:]
|
||||
n = clen(*(*[]byte)(unsafe.Pointer(&sl)))
|
||||
copy(s.Mntfromname[:], old.Mntfromname[:n])
|
||||
|
||||
sl = old.Mntonname[:]
|
||||
n = clen(*(*[]byte)(unsafe.Pointer(&sl)))
|
||||
copy(s.Mntonname[:], old.Mntonname[:n])
|
||||
}
|
||||
|
||||
func convertFromDirents11(buf []byte, old []byte) int {
|
||||
const (
|
||||
fixedSize = int(unsafe.Offsetof(Dirent{}.Name))
|
||||
oldFixedSize = int(unsafe.Offsetof(dirent_freebsd11{}.Name))
|
||||
)
|
||||
|
||||
dstPos := 0
|
||||
srcPos := 0
|
||||
for dstPos+fixedSize < len(buf) && srcPos+oldFixedSize < len(old) {
|
||||
dstDirent := (*Dirent)(unsafe.Pointer(&buf[dstPos]))
|
||||
srcDirent := (*dirent_freebsd11)(unsafe.Pointer(&old[srcPos]))
|
||||
|
||||
reclen := roundup(fixedSize+int(srcDirent.Namlen)+1, 8)
|
||||
if dstPos+reclen > len(buf) {
|
||||
break
|
||||
}
|
||||
|
||||
dstDirent.Fileno = uint64(srcDirent.Fileno)
|
||||
dstDirent.Off = 0
|
||||
dstDirent.Reclen = uint16(reclen)
|
||||
dstDirent.Type = srcDirent.Type
|
||||
dstDirent.Pad0 = 0
|
||||
dstDirent.Namlen = uint16(srcDirent.Namlen)
|
||||
dstDirent.Pad1 = 0
|
||||
|
||||
copy(dstDirent.Name[:], srcDirent.Name[:srcDirent.Namlen])
|
||||
padding := buf[dstPos+fixedSize+int(dstDirent.Namlen) : dstPos+reclen]
|
||||
for i := range padding {
|
||||
padding[i] = 0
|
||||
}
|
||||
|
||||
dstPos += int(dstDirent.Reclen)
|
||||
srcPos += int(srcDirent.Reclen)
|
||||
}
|
||||
|
||||
return dstPos
|
||||
}
|
||||
|
||||
func Sendfile(outfd int, infd int, offset *int64, count int) (written int, err error) {
|
||||
if raceenabled {
|
||||
raceReleaseMerge(unsafe.Pointer(&ioSync))
|
||||
}
|
||||
return sendfile(outfd, infd, offset, count)
|
||||
}
|
||||
|
||||
/*
|
||||
* Exposed directly
|
||||
*/
|
||||
@ -435,11 +546,16 @@ func IoctlGetTermios(fd int, req uint) (*Termios, error) {
|
||||
//sys Fchownat(dirfd int, path string, uid int, gid int, flags int) (err error)
|
||||
//sys Flock(fd int, how int) (err error)
|
||||
//sys Fpathconf(fd int, name int) (val int, err error)
|
||||
//sys Fstat(fd int, stat *Stat_t) (err error)
|
||||
//sys Fstatfs(fd int, stat *Statfs_t) (err error)
|
||||
//sys fstat(fd int, stat *stat_freebsd11_t) (err error)
|
||||
//sys fstat_freebsd12(fd int, stat *Stat_t) (err error)
|
||||
//sys fstatat(fd int, path string, stat *stat_freebsd11_t, flags int) (err error)
|
||||
//sys fstatat_freebsd12(fd int, path string, stat *Stat_t, flags int) (err error)
|
||||
//sys fstatfs(fd int, stat *statfs_freebsd11_t) (err error)
|
||||
//sys fstatfs_freebsd12(fd int, stat *Statfs_t) (err error)
|
||||
//sys Fsync(fd int) (err error)
|
||||
//sys Ftruncate(fd int, length int64) (err error)
|
||||
//sys Getdirentries(fd int, buf []byte, basep *uintptr) (n int, err error)
|
||||
//sys getdirentries(fd int, buf []byte, basep *uintptr) (n int, err error)
|
||||
//sys getdirentries_freebsd12(fd int, buf []byte, basep *uintptr) (n int, err error)
|
||||
//sys Getdtablesize() (size int)
|
||||
//sysnb Getegid() (egid int)
|
||||
//sysnb Geteuid() (uid int)
|
||||
@ -461,11 +577,13 @@ func IoctlGetTermios(fd int, req uint) (*Termios, error) {
|
||||
//sys Link(path string, link string) (err error)
|
||||
//sys Linkat(pathfd int, path string, linkfd int, link string, flags int) (err error)
|
||||
//sys Listen(s int, backlog int) (err error)
|
||||
//sys Lstat(path string, stat *Stat_t) (err error)
|
||||
//sys lstat(path string, stat *stat_freebsd11_t) (err error)
|
||||
//sys Mkdir(path string, mode uint32) (err error)
|
||||
//sys Mkdirat(dirfd int, path string, mode uint32) (err error)
|
||||
//sys Mkfifo(path string, mode uint32) (err error)
|
||||
//sys Mknod(path string, mode uint32, dev int) (err error)
|
||||
//sys mknod(path string, mode uint32, dev int) (err error)
|
||||
//sys mknodat(fd int, path string, mode uint32, dev int) (err error)
|
||||
//sys mknodat_freebsd12(fd int, path string, mode uint32, dev uint64) (err error)
|
||||
//sys Nanosleep(time *Timespec, leftover *Timespec) (err error)
|
||||
//sys Open(path string, mode int, perm uint32) (fd int, err error)
|
||||
//sys Openat(fdat int, path string, mode int, perm uint32) (fd int, err error)
|
||||
@ -495,8 +613,9 @@ func IoctlGetTermios(fd int, req uint) (*Termios, error) {
|
||||
//sysnb Setsid() (pid int, err error)
|
||||
//sysnb Settimeofday(tp *Timeval) (err error)
|
||||
//sysnb Setuid(uid int) (err error)
|
||||
//sys Stat(path string, stat *Stat_t) (err error)
|
||||
//sys Statfs(path string, stat *Statfs_t) (err error)
|
||||
//sys stat(path string, stat *stat_freebsd11_t) (err error)
|
||||
//sys statfs(path string, stat *statfs_freebsd11_t) (err error)
|
||||
//sys statfs_freebsd12(path string, stat *Statfs_t) (err error)
|
||||
//sys Symlink(path string, link string) (err error)
|
||||
//sys Symlinkat(oldpath string, newdirfd int, newpath string) (err error)
|
||||
//sys Sync() (err error)
|
||||
@ -551,6 +670,7 @@ func IoctlGetTermios(fd int, req uint) (*Termios, error) {
|
||||
// Kqueue_portset
|
||||
// Getattrlist
|
||||
// Setattrlist
|
||||
// Getdents
|
||||
// Getdirentriesattr
|
||||
// Searchfs
|
||||
// Delete
|
||||
@ -558,14 +678,6 @@ func IoctlGetTermios(fd int, req uint) (*Termios, error) {
|
||||
// Watchevent
|
||||
// Waitevent
|
||||
// Modwatch
|
||||
// Getxattr
|
||||
// Fgetxattr
|
||||
// Setxattr
|
||||
// Fsetxattr
|
||||
// Removexattr
|
||||
// Fremovexattr
|
||||
// Listxattr
|
||||
// Flistxattr
|
||||
// Fsctl
|
||||
// Initgroups
|
||||
// Posix_spawn
|
||||
|
52
vendor/golang.org/x/sys/unix/syscall_freebsd_arm64.go
generated
vendored
Normal file
52
vendor/golang.org/x/sys/unix/syscall_freebsd_arm64.go
generated
vendored
Normal file
@ -0,0 +1,52 @@
|
||||
// Copyright 2018 The Go Authors. All rights reserved.
|
||||
// Use of this source code is governed by a BSD-style
|
||||
// license that can be found in the LICENSE file.
|
||||
|
||||
// +build arm64,freebsd
|
||||
|
||||
package unix
|
||||
|
||||
import (
|
||||
"syscall"
|
||||
"unsafe"
|
||||
)
|
||||
|
||||
func setTimespec(sec, nsec int64) Timespec {
|
||||
return Timespec{Sec: sec, Nsec: nsec}
|
||||
}
|
||||
|
||||
func setTimeval(sec, usec int64) Timeval {
|
||||
return Timeval{Sec: sec, Usec: usec}
|
||||
}
|
||||
|
||||
func SetKevent(k *Kevent_t, fd, mode, flags int) {
|
||||
k.Ident = uint64(fd)
|
||||
k.Filter = int16(mode)
|
||||
k.Flags = uint16(flags)
|
||||
}
|
||||
|
||||
func (iov *Iovec) SetLen(length int) {
|
||||
iov.Len = uint64(length)
|
||||
}
|
||||
|
||||
func (msghdr *Msghdr) SetControllen(length int) {
|
||||
msghdr.Controllen = uint32(length)
|
||||
}
|
||||
|
||||
func (cmsg *Cmsghdr) SetLen(length int) {
|
||||
cmsg.Len = uint32(length)
|
||||
}
|
||||
|
||||
func sendfile(outfd int, infd int, offset *int64, count int) (written int, err error) {
|
||||
var writtenOut uint64 = 0
|
||||
_, _, e1 := Syscall9(SYS_SENDFILE, uintptr(infd), uintptr(outfd), uintptr(*offset), uintptr(count), 0, uintptr(unsafe.Pointer(&writtenOut)), 0, 0, 0)
|
||||
|
||||
written = int(writtenOut)
|
||||
|
||||
if e1 != 0 {
|
||||
err = e1
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
func Syscall9(num, a1, a2, a3, a4, a5, a6, a7, a8, a9 uintptr) (r1, r2 uintptr, err syscall.Errno)
|
489
vendor/golang.org/x/sys/unix/syscall_linux.go
generated
vendored
489
vendor/golang.org/x/sys/unix/syscall_linux.go
generated
vendored
@ -12,6 +12,9 @@
|
||||
package unix
|
||||
|
||||
import (
|
||||
"encoding/binary"
|
||||
"net"
|
||||
"runtime"
|
||||
"syscall"
|
||||
"unsafe"
|
||||
)
|
||||
@ -55,20 +58,35 @@ func Fchmodat(dirfd int, path string, mode uint32, flags int) (err error) {
|
||||
// ioctl itself should not be exposed directly, but additional get/set
|
||||
// functions for specific types are permissible.
|
||||
|
||||
// IoctlSetPointerInt performs an ioctl operation which sets an
|
||||
// integer value on fd, using the specified request number. The ioctl
|
||||
// argument is called with a pointer to the integer value, rather than
|
||||
// passing the integer value directly.
|
||||
func IoctlSetPointerInt(fd int, req uint, value int) error {
|
||||
v := int32(value)
|
||||
return ioctl(fd, req, uintptr(unsafe.Pointer(&v)))
|
||||
}
|
||||
|
||||
// IoctlSetInt performs an ioctl operation which sets an integer value
|
||||
// on fd, using the specified request number.
|
||||
func IoctlSetInt(fd int, req uint, value int) error {
|
||||
return ioctl(fd, req, uintptr(value))
|
||||
}
|
||||
|
||||
func IoctlSetWinsize(fd int, req uint, value *Winsize) error {
|
||||
func ioctlSetWinsize(fd int, req uint, value *Winsize) error {
|
||||
return ioctl(fd, req, uintptr(unsafe.Pointer(value)))
|
||||
}
|
||||
|
||||
func IoctlSetTermios(fd int, req uint, value *Termios) error {
|
||||
func ioctlSetTermios(fd int, req uint, value *Termios) error {
|
||||
return ioctl(fd, req, uintptr(unsafe.Pointer(value)))
|
||||
}
|
||||
|
||||
func IoctlSetRTCTime(fd int, value *RTCTime) error {
|
||||
err := ioctl(fd, RTC_SET_TIME, uintptr(unsafe.Pointer(value)))
|
||||
runtime.KeepAlive(value)
|
||||
return err
|
||||
}
|
||||
|
||||
// IoctlGetInt performs an ioctl operation which gets an integer value
|
||||
// from fd, using the specified request number.
|
||||
func IoctlGetInt(fd int, req uint) (int, error) {
|
||||
@ -89,6 +107,12 @@ func IoctlGetTermios(fd int, req uint) (*Termios, error) {
|
||||
return &value, err
|
||||
}
|
||||
|
||||
func IoctlGetRTCTime(fd int) (*RTCTime, error) {
|
||||
var value RTCTime
|
||||
err := ioctl(fd, RTC_RD_TIME, uintptr(unsafe.Pointer(&value)))
|
||||
return &value, err
|
||||
}
|
||||
|
||||
//sys Linkat(olddirfd int, oldpath string, newdirfd int, newpath string, flags int) (err error)
|
||||
|
||||
func Link(oldpath string, newpath string) (err error) {
|
||||
@ -148,8 +172,6 @@ func Unlink(path string) error {
|
||||
|
||||
//sys Unlinkat(dirfd int, path string, flags int) (err error)
|
||||
|
||||
//sys utimes(path string, times *[2]Timeval) (err error)
|
||||
|
||||
func Utimes(path string, tv []Timeval) error {
|
||||
if tv == nil {
|
||||
err := utimensat(AT_FDCWD, path, nil, 0)
|
||||
@ -207,20 +229,14 @@ func UtimesNanoAt(dirfd int, path string, ts []Timespec, flags int) error {
|
||||
return utimensat(dirfd, path, (*[2]Timespec)(unsafe.Pointer(&ts[0])), flags)
|
||||
}
|
||||
|
||||
//sys futimesat(dirfd int, path *byte, times *[2]Timeval) (err error)
|
||||
|
||||
func Futimesat(dirfd int, path string, tv []Timeval) error {
|
||||
pathp, err := BytePtrFromString(path)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
if tv == nil {
|
||||
return futimesat(dirfd, pathp, nil)
|
||||
return futimesat(dirfd, path, nil)
|
||||
}
|
||||
if len(tv) != 2 {
|
||||
return EINVAL
|
||||
}
|
||||
return futimesat(dirfd, pathp, (*[2]Timeval)(unsafe.Pointer(&tv[0])))
|
||||
return futimesat(dirfd, path, (*[2]Timeval)(unsafe.Pointer(&tv[0])))
|
||||
}
|
||||
|
||||
func Futimes(fd int, tv []Timeval) (err error) {
|
||||
@ -413,6 +429,7 @@ func (sa *SockaddrUnix) sockaddr() (unsafe.Pointer, _Socklen, error) {
|
||||
return unsafe.Pointer(&sa.raw), sl, nil
|
||||
}
|
||||
|
||||
// SockaddrLinklayer implements the Sockaddr interface for AF_PACKET type sockets.
|
||||
type SockaddrLinklayer struct {
|
||||
Protocol uint16
|
||||
Ifindex int
|
||||
@ -439,6 +456,7 @@ func (sa *SockaddrLinklayer) sockaddr() (unsafe.Pointer, _Socklen, error) {
|
||||
return unsafe.Pointer(&sa.raw), SizeofSockaddrLinklayer, nil
|
||||
}
|
||||
|
||||
// SockaddrNetlink implements the Sockaddr interface for AF_NETLINK type sockets.
|
||||
type SockaddrNetlink struct {
|
||||
Family uint16
|
||||
Pad uint16
|
||||
@ -455,6 +473,8 @@ func (sa *SockaddrNetlink) sockaddr() (unsafe.Pointer, _Socklen, error) {
|
||||
return unsafe.Pointer(&sa.raw), SizeofSockaddrNetlink, nil
|
||||
}
|
||||
|
||||
// SockaddrHCI implements the Sockaddr interface for AF_BLUETOOTH type sockets
|
||||
// using the HCI protocol.
|
||||
type SockaddrHCI struct {
|
||||
Dev uint16
|
||||
Channel uint16
|
||||
@ -468,6 +488,72 @@ func (sa *SockaddrHCI) sockaddr() (unsafe.Pointer, _Socklen, error) {
|
||||
return unsafe.Pointer(&sa.raw), SizeofSockaddrHCI, nil
|
||||
}
|
||||
|
||||
// SockaddrL2 implements the Sockaddr interface for AF_BLUETOOTH type sockets
|
||||
// using the L2CAP protocol.
|
||||
type SockaddrL2 struct {
|
||||
PSM uint16
|
||||
CID uint16
|
||||
Addr [6]uint8
|
||||
AddrType uint8
|
||||
raw RawSockaddrL2
|
||||
}
|
||||
|
||||
func (sa *SockaddrL2) sockaddr() (unsafe.Pointer, _Socklen, error) {
|
||||
sa.raw.Family = AF_BLUETOOTH
|
||||
psm := (*[2]byte)(unsafe.Pointer(&sa.raw.Psm))
|
||||
psm[0] = byte(sa.PSM)
|
||||
psm[1] = byte(sa.PSM >> 8)
|
||||
for i := 0; i < len(sa.Addr); i++ {
|
||||
sa.raw.Bdaddr[i] = sa.Addr[len(sa.Addr)-1-i]
|
||||
}
|
||||
cid := (*[2]byte)(unsafe.Pointer(&sa.raw.Cid))
|
||||
cid[0] = byte(sa.CID)
|
||||
cid[1] = byte(sa.CID >> 8)
|
||||
sa.raw.Bdaddr_type = sa.AddrType
|
||||
return unsafe.Pointer(&sa.raw), SizeofSockaddrL2, nil
|
||||
}
|
||||
|
||||
// SockaddrRFCOMM implements the Sockaddr interface for AF_BLUETOOTH type sockets
|
||||
// using the RFCOMM protocol.
|
||||
//
|
||||
// Server example:
|
||||
//
|
||||
// fd, _ := Socket(AF_BLUETOOTH, SOCK_STREAM, BTPROTO_RFCOMM)
|
||||
// _ = unix.Bind(fd, &unix.SockaddrRFCOMM{
|
||||
// Channel: 1,
|
||||
// Addr: [6]uint8{0, 0, 0, 0, 0, 0}, // BDADDR_ANY or 00:00:00:00:00:00
|
||||
// })
|
||||
// _ = Listen(fd, 1)
|
||||
// nfd, sa, _ := Accept(fd)
|
||||
// fmt.Printf("conn addr=%v fd=%d", sa.(*unix.SockaddrRFCOMM).Addr, nfd)
|
||||
// Read(nfd, buf)
|
||||
//
|
||||
// Client example:
|
||||
//
|
||||
// fd, _ := Socket(AF_BLUETOOTH, SOCK_STREAM, BTPROTO_RFCOMM)
|
||||
// _ = Connect(fd, &SockaddrRFCOMM{
|
||||
// Channel: 1,
|
||||
// Addr: [6]byte{0x11, 0x22, 0x33, 0xaa, 0xbb, 0xcc}, // CC:BB:AA:33:22:11
|
||||
// })
|
||||
// Write(fd, []byte(`hello`))
|
||||
type SockaddrRFCOMM struct {
|
||||
// Addr represents a bluetooth address, byte ordering is little-endian.
|
||||
Addr [6]uint8
|
||||
|
||||
// Channel is a designated bluetooth channel, only 1-30 are available for use.
|
||||
// Since Linux 2.6.7 and further zero value is the first available channel.
|
||||
Channel uint8
|
||||
|
||||
raw RawSockaddrRFCOMM
|
||||
}
|
||||
|
||||
func (sa *SockaddrRFCOMM) sockaddr() (unsafe.Pointer, _Socklen, error) {
|
||||
sa.raw.Family = AF_BLUETOOTH
|
||||
sa.raw.Channel = sa.Channel
|
||||
sa.raw.Bdaddr = sa.Addr
|
||||
return unsafe.Pointer(&sa.raw), SizeofSockaddrRFCOMM, nil
|
||||
}
|
||||
|
||||
// SockaddrCAN implements the Sockaddr interface for AF_CAN type sockets.
|
||||
// The RxID and TxID fields are used for transport protocol addressing in
|
||||
// (CAN_TP16, CAN_TP20, CAN_MCNET, and CAN_ISOTP), they can be left with
|
||||
@ -630,7 +716,70 @@ func (sa *SockaddrVM) sockaddr() (unsafe.Pointer, _Socklen, error) {
|
||||
return unsafe.Pointer(&sa.raw), SizeofSockaddrVM, nil
|
||||
}
|
||||
|
||||
func anyToSockaddr(rsa *RawSockaddrAny) (Sockaddr, error) {
|
||||
type SockaddrXDP struct {
|
||||
Flags uint16
|
||||
Ifindex uint32
|
||||
QueueID uint32
|
||||
SharedUmemFD uint32
|
||||
raw RawSockaddrXDP
|
||||
}
|
||||
|
||||
func (sa *SockaddrXDP) sockaddr() (unsafe.Pointer, _Socklen, error) {
|
||||
sa.raw.Family = AF_XDP
|
||||
sa.raw.Flags = sa.Flags
|
||||
sa.raw.Ifindex = sa.Ifindex
|
||||
sa.raw.Queue_id = sa.QueueID
|
||||
sa.raw.Shared_umem_fd = sa.SharedUmemFD
|
||||
|
||||
return unsafe.Pointer(&sa.raw), SizeofSockaddrXDP, nil
|
||||
}
|
||||
|
||||
// This constant mirrors the #define of PX_PROTO_OE in
|
||||
// linux/if_pppox.h. We're defining this by hand here instead of
|
||||
// autogenerating through mkerrors.sh because including
|
||||
// linux/if_pppox.h causes some declaration conflicts with other
|
||||
// includes (linux/if_pppox.h includes linux/in.h, which conflicts
|
||||
// with netinet/in.h). Given that we only need a single zero constant
|
||||
// out of that file, it's cleaner to just define it by hand here.
|
||||
const px_proto_oe = 0
|
||||
|
||||
type SockaddrPPPoE struct {
|
||||
SID uint16
|
||||
Remote net.HardwareAddr
|
||||
Dev string
|
||||
raw RawSockaddrPPPoX
|
||||
}
|
||||
|
||||
func (sa *SockaddrPPPoE) sockaddr() (unsafe.Pointer, _Socklen, error) {
|
||||
if len(sa.Remote) != 6 {
|
||||
return nil, 0, EINVAL
|
||||
}
|
||||
if len(sa.Dev) > IFNAMSIZ-1 {
|
||||
return nil, 0, EINVAL
|
||||
}
|
||||
|
||||
*(*uint16)(unsafe.Pointer(&sa.raw[0])) = AF_PPPOX
|
||||
// This next field is in host-endian byte order. We can't use the
|
||||
// same unsafe pointer cast as above, because this value is not
|
||||
// 32-bit aligned and some architectures don't allow unaligned
|
||||
// access.
|
||||
//
|
||||
// However, the value of px_proto_oe is 0, so we can use
|
||||
// encoding/binary helpers to write the bytes without worrying
|
||||
// about the ordering.
|
||||
binary.BigEndian.PutUint32(sa.raw[2:6], px_proto_oe)
|
||||
// This field is deliberately big-endian, unlike the previous
|
||||
// one. The kernel expects SID to be in network byte order.
|
||||
binary.BigEndian.PutUint16(sa.raw[6:8], sa.SID)
|
||||
copy(sa.raw[8:14], sa.Remote)
|
||||
for i := 14; i < 14+IFNAMSIZ; i++ {
|
||||
sa.raw[i] = 0
|
||||
}
|
||||
copy(sa.raw[14:], sa.Dev)
|
||||
return unsafe.Pointer(&sa.raw), SizeofSockaddrPPPoX, nil
|
||||
}
|
||||
|
||||
func anyToSockaddr(fd int, rsa *RawSockaddrAny) (Sockaddr, error) {
|
||||
switch rsa.Addr.Family {
|
||||
case AF_NETLINK:
|
||||
pp := (*RawSockaddrNetlink)(unsafe.Pointer(rsa))
|
||||
@ -707,6 +856,55 @@ func anyToSockaddr(rsa *RawSockaddrAny) (Sockaddr, error) {
|
||||
Port: pp.Port,
|
||||
}
|
||||
return sa, nil
|
||||
case AF_BLUETOOTH:
|
||||
proto, err := GetsockoptInt(fd, SOL_SOCKET, SO_PROTOCOL)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
// only BTPROTO_L2CAP and BTPROTO_RFCOMM can accept connections
|
||||
switch proto {
|
||||
case BTPROTO_L2CAP:
|
||||
pp := (*RawSockaddrL2)(unsafe.Pointer(rsa))
|
||||
sa := &SockaddrL2{
|
||||
PSM: pp.Psm,
|
||||
CID: pp.Cid,
|
||||
Addr: pp.Bdaddr,
|
||||
AddrType: pp.Bdaddr_type,
|
||||
}
|
||||
return sa, nil
|
||||
case BTPROTO_RFCOMM:
|
||||
pp := (*RawSockaddrRFCOMM)(unsafe.Pointer(rsa))
|
||||
sa := &SockaddrRFCOMM{
|
||||
Channel: pp.Channel,
|
||||
Addr: pp.Bdaddr,
|
||||
}
|
||||
return sa, nil
|
||||
}
|
||||
case AF_XDP:
|
||||
pp := (*RawSockaddrXDP)(unsafe.Pointer(rsa))
|
||||
sa := &SockaddrXDP{
|
||||
Flags: pp.Flags,
|
||||
Ifindex: pp.Ifindex,
|
||||
QueueID: pp.Queue_id,
|
||||
SharedUmemFD: pp.Shared_umem_fd,
|
||||
}
|
||||
return sa, nil
|
||||
case AF_PPPOX:
|
||||
pp := (*RawSockaddrPPPoX)(unsafe.Pointer(rsa))
|
||||
if binary.BigEndian.Uint32(pp[2:6]) != px_proto_oe {
|
||||
return nil, EINVAL
|
||||
}
|
||||
sa := &SockaddrPPPoE{
|
||||
SID: binary.BigEndian.Uint16(pp[6:8]),
|
||||
Remote: net.HardwareAddr(pp[8:14]),
|
||||
}
|
||||
for i := 14; i < 14+IFNAMSIZ; i++ {
|
||||
if pp[i] == 0 {
|
||||
sa.Dev = string(pp[14:i])
|
||||
break
|
||||
}
|
||||
}
|
||||
return sa, nil
|
||||
}
|
||||
return nil, EAFNOSUPPORT
|
||||
}
|
||||
@ -718,7 +916,7 @@ func Accept(fd int) (nfd int, sa Sockaddr, err error) {
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
sa, err = anyToSockaddr(&rsa)
|
||||
sa, err = anyToSockaddr(fd, &rsa)
|
||||
if err != nil {
|
||||
Close(nfd)
|
||||
nfd = 0
|
||||
@ -736,7 +934,7 @@ func Accept4(fd int, flags int) (nfd int, sa Sockaddr, err error) {
|
||||
if len > SizeofSockaddrAny {
|
||||
panic("RawSockaddrAny too small")
|
||||
}
|
||||
sa, err = anyToSockaddr(&rsa)
|
||||
sa, err = anyToSockaddr(fd, &rsa)
|
||||
if err != nil {
|
||||
Close(nfd)
|
||||
nfd = 0
|
||||
@ -750,20 +948,7 @@ func Getsockname(fd int) (sa Sockaddr, err error) {
|
||||
if err = getsockname(fd, &rsa, &len); err != nil {
|
||||
return
|
||||
}
|
||||
return anyToSockaddr(&rsa)
|
||||
}
|
||||
|
||||
func GetsockoptInet4Addr(fd, level, opt int) (value [4]byte, err error) {
|
||||
vallen := _Socklen(4)
|
||||
err = getsockopt(fd, level, opt, unsafe.Pointer(&value[0]), &vallen)
|
||||
return value, err
|
||||
}
|
||||
|
||||
func GetsockoptIPMreq(fd, level, opt int) (*IPMreq, error) {
|
||||
var value IPMreq
|
||||
vallen := _Socklen(SizeofIPMreq)
|
||||
err := getsockopt(fd, level, opt, unsafe.Pointer(&value), &vallen)
|
||||
return &value, err
|
||||
return anyToSockaddr(fd, &rsa)
|
||||
}
|
||||
|
||||
func GetsockoptIPMreqn(fd, level, opt int) (*IPMreqn, error) {
|
||||
@ -773,27 +958,6 @@ func GetsockoptIPMreqn(fd, level, opt int) (*IPMreqn, error) {
|
||||
return &value, err
|
||||
}
|
||||
|
||||
func GetsockoptIPv6Mreq(fd, level, opt int) (*IPv6Mreq, error) {
|
||||
var value IPv6Mreq
|
||||
vallen := _Socklen(SizeofIPv6Mreq)
|
||||
err := getsockopt(fd, level, opt, unsafe.Pointer(&value), &vallen)
|
||||
return &value, err
|
||||
}
|
||||
|
||||
func GetsockoptIPv6MTUInfo(fd, level, opt int) (*IPv6MTUInfo, error) {
|
||||
var value IPv6MTUInfo
|
||||
vallen := _Socklen(SizeofIPv6MTUInfo)
|
||||
err := getsockopt(fd, level, opt, unsafe.Pointer(&value), &vallen)
|
||||
return &value, err
|
||||
}
|
||||
|
||||
func GetsockoptICMPv6Filter(fd, level, opt int) (*ICMPv6Filter, error) {
|
||||
var value ICMPv6Filter
|
||||
vallen := _Socklen(SizeofICMPv6Filter)
|
||||
err := getsockopt(fd, level, opt, unsafe.Pointer(&value), &vallen)
|
||||
return &value, err
|
||||
}
|
||||
|
||||
func GetsockoptUcred(fd, level, opt int) (*Ucred, error) {
|
||||
var value Ucred
|
||||
vallen := _Socklen(SizeofUcred)
|
||||
@ -808,6 +972,24 @@ func GetsockoptTCPInfo(fd, level, opt int) (*TCPInfo, error) {
|
||||
return &value, err
|
||||
}
|
||||
|
||||
// GetsockoptString returns the string value of the socket option opt for the
|
||||
// socket associated with fd at the given socket level.
|
||||
func GetsockoptString(fd, level, opt int) (string, error) {
|
||||
buf := make([]byte, 256)
|
||||
vallen := _Socklen(len(buf))
|
||||
err := getsockopt(fd, level, opt, unsafe.Pointer(&buf[0]), &vallen)
|
||||
if err != nil {
|
||||
if err == ERANGE {
|
||||
buf = make([]byte, vallen)
|
||||
err = getsockopt(fd, level, opt, unsafe.Pointer(&buf[0]), &vallen)
|
||||
}
|
||||
if err != nil {
|
||||
return "", err
|
||||
}
|
||||
}
|
||||
return string(buf[:vallen-1]), nil
|
||||
}
|
||||
|
||||
func SetsockoptIPMreqn(fd, level, opt int, mreq *IPMreqn) (err error) {
|
||||
return setsockopt(fd, level, opt, unsafe.Pointer(mreq), unsafe.Sizeof(*mreq))
|
||||
}
|
||||
@ -931,15 +1113,17 @@ func Recvmsg(fd int, p, oob []byte, flags int) (n, oobn int, recvflags int, from
|
||||
}
|
||||
var dummy byte
|
||||
if len(oob) > 0 {
|
||||
var sockType int
|
||||
sockType, err = GetsockoptInt(fd, SOL_SOCKET, SO_TYPE)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
// receive at least one normal byte
|
||||
if sockType != SOCK_DGRAM && len(p) == 0 {
|
||||
iov.Base = &dummy
|
||||
iov.SetLen(1)
|
||||
if len(p) == 0 {
|
||||
var sockType int
|
||||
sockType, err = GetsockoptInt(fd, SOL_SOCKET, SO_TYPE)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
// receive at least one normal byte
|
||||
if sockType != SOCK_DGRAM {
|
||||
iov.Base = &dummy
|
||||
iov.SetLen(1)
|
||||
}
|
||||
}
|
||||
msg.Control = &oob[0]
|
||||
msg.SetControllen(len(oob))
|
||||
@ -953,7 +1137,7 @@ func Recvmsg(fd int, p, oob []byte, flags int) (n, oobn int, recvflags int, from
|
||||
recvflags = int(msg.Flags)
|
||||
// source address is only specified if the socket is unconnected
|
||||
if rsa.Addr.Family != AF_UNSPEC {
|
||||
from, err = anyToSockaddr(&rsa)
|
||||
from, err = anyToSockaddr(fd, &rsa)
|
||||
}
|
||||
return
|
||||
}
|
||||
@ -983,15 +1167,17 @@ func SendmsgN(fd int, p, oob []byte, to Sockaddr, flags int) (n int, err error)
|
||||
}
|
||||
var dummy byte
|
||||
if len(oob) > 0 {
|
||||
var sockType int
|
||||
sockType, err = GetsockoptInt(fd, SOL_SOCKET, SO_TYPE)
|
||||
if err != nil {
|
||||
return 0, err
|
||||
}
|
||||
// send at least one normal byte
|
||||
if sockType != SOCK_DGRAM && len(p) == 0 {
|
||||
iov.Base = &dummy
|
||||
iov.SetLen(1)
|
||||
if len(p) == 0 {
|
||||
var sockType int
|
||||
sockType, err = GetsockoptInt(fd, SOL_SOCKET, SO_TYPE)
|
||||
if err != nil {
|
||||
return 0, err
|
||||
}
|
||||
// send at least one normal byte
|
||||
if sockType != SOCK_DGRAM {
|
||||
iov.Base = &dummy
|
||||
iov.SetLen(1)
|
||||
}
|
||||
}
|
||||
msg.Control = &oob[0]
|
||||
msg.SetControllen(len(oob))
|
||||
@ -1021,7 +1207,7 @@ func ptracePeek(req int, pid int, addr uintptr, out []byte) (count int, err erro
|
||||
// The ptrace syscall differs from glibc's ptrace.
|
||||
// Peeks returns the word in *data, not as the return value.
|
||||
|
||||
var buf [sizeofPtr]byte
|
||||
var buf [SizeofPtr]byte
|
||||
|
||||
// Leading edge. PEEKTEXT/PEEKDATA don't require aligned
|
||||
// access (PEEKUSER warns that it might), but if we don't
|
||||
@ -1029,12 +1215,12 @@ func ptracePeek(req int, pid int, addr uintptr, out []byte) (count int, err erro
|
||||
// boundary and not get the bytes leading up to the page
|
||||
// boundary.
|
||||
n := 0
|
||||
if addr%sizeofPtr != 0 {
|
||||
err = ptrace(req, pid, addr-addr%sizeofPtr, uintptr(unsafe.Pointer(&buf[0])))
|
||||
if addr%SizeofPtr != 0 {
|
||||
err = ptrace(req, pid, addr-addr%SizeofPtr, uintptr(unsafe.Pointer(&buf[0])))
|
||||
if err != nil {
|
||||
return 0, err
|
||||
}
|
||||
n += copy(out, buf[addr%sizeofPtr:])
|
||||
n += copy(out, buf[addr%SizeofPtr:])
|
||||
out = out[n:]
|
||||
}
|
||||
|
||||
@ -1072,15 +1258,15 @@ func ptracePoke(pokeReq int, peekReq int, pid int, addr uintptr, data []byte) (c
|
||||
|
||||
// Leading edge.
|
||||
n := 0
|
||||
if addr%sizeofPtr != 0 {
|
||||
var buf [sizeofPtr]byte
|
||||
err = ptrace(peekReq, pid, addr-addr%sizeofPtr, uintptr(unsafe.Pointer(&buf[0])))
|
||||
if addr%SizeofPtr != 0 {
|
||||
var buf [SizeofPtr]byte
|
||||
err = ptrace(peekReq, pid, addr-addr%SizeofPtr, uintptr(unsafe.Pointer(&buf[0])))
|
||||
if err != nil {
|
||||
return 0, err
|
||||
}
|
||||
n += copy(buf[addr%sizeofPtr:], data)
|
||||
n += copy(buf[addr%SizeofPtr:], data)
|
||||
word := *((*uintptr)(unsafe.Pointer(&buf[0])))
|
||||
err = ptrace(pokeReq, pid, addr-addr%sizeofPtr, word)
|
||||
err = ptrace(pokeReq, pid, addr-addr%SizeofPtr, word)
|
||||
if err != nil {
|
||||
return 0, err
|
||||
}
|
||||
@ -1088,19 +1274,19 @@ func ptracePoke(pokeReq int, peekReq int, pid int, addr uintptr, data []byte) (c
|
||||
}
|
||||
|
||||
// Interior.
|
||||
for len(data) > sizeofPtr {
|
||||
for len(data) > SizeofPtr {
|
||||
word := *((*uintptr)(unsafe.Pointer(&data[0])))
|
||||
err = ptrace(pokeReq, pid, addr+uintptr(n), word)
|
||||
if err != nil {
|
||||
return n, err
|
||||
}
|
||||
n += sizeofPtr
|
||||
data = data[sizeofPtr:]
|
||||
n += SizeofPtr
|
||||
data = data[SizeofPtr:]
|
||||
}
|
||||
|
||||
// Trailing edge.
|
||||
if len(data) > 0 {
|
||||
var buf [sizeofPtr]byte
|
||||
var buf [SizeofPtr]byte
|
||||
err = ptrace(peekReq, pid, addr+uintptr(n), uintptr(unsafe.Pointer(&buf[0])))
|
||||
if err != nil {
|
||||
return n, err
|
||||
@ -1172,22 +1358,6 @@ func ReadDirent(fd int, buf []byte) (n int, err error) {
|
||||
return Getdents(fd, buf)
|
||||
}
|
||||
|
||||
func direntIno(buf []byte) (uint64, bool) {
|
||||
return readInt(buf, unsafe.Offsetof(Dirent{}.Ino), unsafe.Sizeof(Dirent{}.Ino))
|
||||
}
|
||||
|
||||
func direntReclen(buf []byte) (uint64, bool) {
|
||||
return readInt(buf, unsafe.Offsetof(Dirent{}.Reclen), unsafe.Sizeof(Dirent{}.Reclen))
|
||||
}
|
||||
|
||||
func direntNamlen(buf []byte) (uint64, bool) {
|
||||
reclen, ok := direntReclen(buf)
|
||||
if !ok {
|
||||
return 0, false
|
||||
}
|
||||
return reclen - uint64(unsafe.Offsetof(Dirent{}.Name)), true
|
||||
}
|
||||
|
||||
//sys mount(source string, target string, fstype string, flags uintptr, data *byte) (err error)
|
||||
|
||||
func Mount(source string, target string, fstype string, flags uintptr, data string) (err error) {
|
||||
@ -1203,6 +1373,13 @@ func Mount(source string, target string, fstype string, flags uintptr, data stri
|
||||
return mount(source, target, fstype, flags, datap)
|
||||
}
|
||||
|
||||
func Sendfile(outfd int, infd int, offset *int64, count int) (written int, err error) {
|
||||
if raceenabled {
|
||||
raceReleaseMerge(unsafe.Pointer(&ioSync))
|
||||
}
|
||||
return sendfile(outfd, infd, offset, count)
|
||||
}
|
||||
|
||||
// Sendto
|
||||
// Recvfrom
|
||||
// Socketpair
|
||||
@ -1215,24 +1392,30 @@ func Mount(source string, target string, fstype string, flags uintptr, data stri
|
||||
//sys Adjtimex(buf *Timex) (state int, err error)
|
||||
//sys Chdir(path string) (err error)
|
||||
//sys Chroot(path string) (err error)
|
||||
//sys ClockGetres(clockid int32, res *Timespec) (err error)
|
||||
//sys ClockGettime(clockid int32, time *Timespec) (err error)
|
||||
//sys ClockNanosleep(clockid int32, flags int, request *Timespec, remain *Timespec) (err error)
|
||||
//sys Close(fd int) (err error)
|
||||
//sys CopyFileRange(rfd int, roff *int64, wfd int, woff *int64, len int, flags int) (n int, err error)
|
||||
//sys DeleteModule(name string, flags int) (err error)
|
||||
//sys Dup(oldfd int) (fd int, err error)
|
||||
//sys Dup3(oldfd int, newfd int, flags int) (err error)
|
||||
//sysnb EpollCreate(size int) (fd int, err error)
|
||||
//sysnb EpollCreate1(flag int) (fd int, err error)
|
||||
//sysnb EpollCtl(epfd int, op int, fd int, event *EpollEvent) (err error)
|
||||
//sys Eventfd(initval uint, flags int) (fd int, err error) = SYS_EVENTFD2
|
||||
//sys Exit(code int) = SYS_EXIT_GROUP
|
||||
//sys Faccessat(dirfd int, path string, mode uint32, flags int) (err error)
|
||||
//sys Fallocate(fd int, mode uint32, off int64, len int64) (err error)
|
||||
//sys Fchdir(fd int) (err error)
|
||||
//sys Fchmod(fd int, mode uint32) (err error)
|
||||
//sys Fchownat(dirfd int, path string, uid int, gid int, flags int) (err error)
|
||||
//sys fcntl(fd int, cmd int, arg int) (val int, err error)
|
||||
//sys Fdatasync(fd int) (err error)
|
||||
//sys Fgetxattr(fd int, attr string, dest []byte) (sz int, err error)
|
||||
//sys FinitModule(fd int, params string, flags int) (err error)
|
||||
//sys Flistxattr(fd int, dest []byte) (sz int, err error)
|
||||
//sys Flock(fd int, how int) (err error)
|
||||
//sys Fremovexattr(fd int, attr string) (err error)
|
||||
//sys Fsetxattr(fd int, attr string, dest []byte, flags int) (err error)
|
||||
//sys Fsync(fd int) (err error)
|
||||
//sys Getdents(fd int, buf []byte) (n int, err error) = SYS_GETDENTS64
|
||||
//sysnb Getpgid(pid int) (pgid int, err error)
|
||||
@ -1250,6 +1433,7 @@ func Getpgrp() (pid int) {
|
||||
//sysnb Getsid(pid int) (sid int, err error)
|
||||
//sysnb Gettid() (tid int)
|
||||
//sys Getxattr(path string, attr string, dest []byte) (sz int, err error)
|
||||
//sys InitModule(moduleImage []byte, params string) (err error)
|
||||
//sys InotifyAddWatch(fd int, pathname string, mask uint32) (watchdesc int, err error)
|
||||
//sysnb InotifyInit1(flags int) (fd int, err error)
|
||||
//sysnb InotifyRmWatch(fd int, watchdesc uint32) (success int, err error)
|
||||
@ -1260,16 +1444,18 @@ func Getpgrp() (pid int) {
|
||||
//sys Llistxattr(path string, dest []byte) (sz int, err error)
|
||||
//sys Lremovexattr(path string, attr string) (err error)
|
||||
//sys Lsetxattr(path string, attr string, data []byte, flags int) (err error)
|
||||
//sys MemfdCreate(name string, flags int) (fd int, err error)
|
||||
//sys Mkdirat(dirfd int, path string, mode uint32) (err error)
|
||||
//sys Mknodat(dirfd int, path string, mode uint32, dev int) (err error)
|
||||
//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
|
||||
//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)
|
||||
//sys Removexattr(path string, attr string) (err error)
|
||||
//sys Renameat(olddirfd int, oldpath string, newdirfd int, newpath string) (err error)
|
||||
//sys Renameat2(olddirfd int, oldpath string, newdirfd int, newpath string, flags uint) (err error)
|
||||
//sys RequestKey(keyType string, description string, callback string, destRingid int) (id int, err error)
|
||||
//sys Setdomainname(p []byte) (err error)
|
||||
//sys Sethostname(p []byte) (err error)
|
||||
@ -1293,6 +1479,8 @@ func Setgid(uid int) (err error) {
|
||||
|
||||
//sys Setpriority(which int, who int, prio int) (err error)
|
||||
//sys Setxattr(path string, attr string, data []byte, flags int) (err error)
|
||||
//sys Signalfd(fd int, mask *Sigset_t, flags int) = SYS_SIGNALFD4
|
||||
//sys Statx(dirfd int, path string, flags int, mask int, stat *Statx_t) (err error)
|
||||
//sys Sync()
|
||||
//sys Syncfs(fd int) (err error)
|
||||
//sysnb Sysinfo(info *Sysinfo_t) (err error)
|
||||
@ -1303,7 +1491,6 @@ func Setgid(uid int) (err error) {
|
||||
//sysnb Uname(buf *Utsname) (err error)
|
||||
//sys Unmount(target string, flags int) (err error) = SYS_UMOUNT2
|
||||
//sys Unshare(flags int) (err error)
|
||||
//sys Ustat(dev int, ubuf *Ustat_t) (err error)
|
||||
//sys write(fd int, p []byte) (n int, err error)
|
||||
//sys exitThread(code int) (err error) = SYS_EXIT
|
||||
//sys readlen(fd int, p *byte, np int) (n int, err error) = SYS_READ
|
||||
@ -1337,15 +1524,12 @@ func Munmap(b []byte) (err error) {
|
||||
// Vmsplice splices user pages from a slice of Iovecs into a pipe specified by fd,
|
||||
// using the specified flags.
|
||||
func Vmsplice(fd int, iovs []Iovec, flags int) (int, error) {
|
||||
n, _, errno := Syscall6(
|
||||
SYS_VMSPLICE,
|
||||
uintptr(fd),
|
||||
uintptr(unsafe.Pointer(&iovs[0])),
|
||||
uintptr(len(iovs)),
|
||||
uintptr(flags),
|
||||
0,
|
||||
0,
|
||||
)
|
||||
var p unsafe.Pointer
|
||||
if len(iovs) > 0 {
|
||||
p = unsafe.Pointer(&iovs[0])
|
||||
}
|
||||
|
||||
n, _, errno := Syscall6(SYS_VMSPLICE, uintptr(fd), uintptr(p), uintptr(len(iovs)), uintptr(flags), 0, 0)
|
||||
if errno != 0 {
|
||||
return 0, syscall.Errno(errno)
|
||||
}
|
||||
@ -1353,6 +1537,77 @@ func Vmsplice(fd int, iovs []Iovec, flags int) (int, error) {
|
||||
return int(n), nil
|
||||
}
|
||||
|
||||
//sys faccessat(dirfd int, path string, mode uint32) (err error)
|
||||
|
||||
func Faccessat(dirfd int, path string, mode uint32, flags int) (err error) {
|
||||
if flags & ^(AT_SYMLINK_NOFOLLOW|AT_EACCESS) != 0 {
|
||||
return EINVAL
|
||||
}
|
||||
|
||||
// The Linux kernel faccessat system call does not take any flags.
|
||||
// The glibc faccessat implements the flags itself; see
|
||||
// https://sourceware.org/git/?p=glibc.git;a=blob;f=sysdeps/unix/sysv/linux/faccessat.c;hb=HEAD
|
||||
// Because people naturally expect syscall.Faccessat to act
|
||||
// like C faccessat, we do the same.
|
||||
|
||||
if flags == 0 {
|
||||
return faccessat(dirfd, path, mode)
|
||||
}
|
||||
|
||||
var st Stat_t
|
||||
if err := Fstatat(dirfd, path, &st, flags&AT_SYMLINK_NOFOLLOW); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
mode &= 7
|
||||
if mode == 0 {
|
||||
return nil
|
||||
}
|
||||
|
||||
var uid int
|
||||
if flags&AT_EACCESS != 0 {
|
||||
uid = Geteuid()
|
||||
} else {
|
||||
uid = Getuid()
|
||||
}
|
||||
|
||||
if uid == 0 {
|
||||
if mode&1 == 0 {
|
||||
// Root can read and write any file.
|
||||
return nil
|
||||
}
|
||||
if st.Mode&0111 != 0 {
|
||||
// Root can execute any file that anybody can execute.
|
||||
return nil
|
||||
}
|
||||
return EACCES
|
||||
}
|
||||
|
||||
var fmode uint32
|
||||
if uint32(uid) == st.Uid {
|
||||
fmode = (st.Mode >> 6) & 7
|
||||
} else {
|
||||
var gid int
|
||||
if flags&AT_EACCESS != 0 {
|
||||
gid = Getegid()
|
||||
} else {
|
||||
gid = Getgid()
|
||||
}
|
||||
|
||||
if uint32(gid) == st.Gid {
|
||||
fmode = (st.Mode >> 3) & 7
|
||||
} else {
|
||||
fmode = st.Mode & 7
|
||||
}
|
||||
}
|
||||
|
||||
if fmode&mode == mode {
|
||||
return nil
|
||||
}
|
||||
|
||||
return EACCES
|
||||
}
|
||||
|
||||
/*
|
||||
* Unimplemented
|
||||
*/
|
||||
@ -1362,21 +1617,14 @@ func Vmsplice(fd int, iovs []Iovec, flags int) (int, error) {
|
||||
// Brk
|
||||
// Capget
|
||||
// Capset
|
||||
// ClockGetres
|
||||
// ClockNanosleep
|
||||
// ClockSettime
|
||||
// Clone
|
||||
// CreateModule
|
||||
// DeleteModule
|
||||
// EpollCtlOld
|
||||
// EpollPwait
|
||||
// EpollWaitOld
|
||||
// Execve
|
||||
// Fgetxattr
|
||||
// Flistxattr
|
||||
// Fork
|
||||
// Fremovexattr
|
||||
// Fsetxattr
|
||||
// Futex
|
||||
// GetKernelSyms
|
||||
// GetMempolicy
|
||||
@ -1410,13 +1658,11 @@ func Vmsplice(fd int, iovs []Iovec, flags int) (int, error) {
|
||||
// Msgget
|
||||
// Msgrcv
|
||||
// Msgsnd
|
||||
// Newfstatat
|
||||
// Nfsservctl
|
||||
// Personality
|
||||
// Pselect6
|
||||
// Ptrace
|
||||
// Putpmsg
|
||||
// QueryModule
|
||||
// Quotactl
|
||||
// Readahead
|
||||
// Readv
|
||||
@ -1431,11 +1677,9 @@ func Vmsplice(fd int, iovs []Iovec, flags int) (int, error) {
|
||||
// RtSigtimedwait
|
||||
// SchedGetPriorityMax
|
||||
// SchedGetPriorityMin
|
||||
// SchedGetaffinity
|
||||
// SchedGetparam
|
||||
// SchedGetscheduler
|
||||
// SchedRrGetInterval
|
||||
// SchedSetaffinity
|
||||
// SchedSetparam
|
||||
// SchedYield
|
||||
// Security
|
||||
@ -1452,7 +1696,6 @@ func Vmsplice(fd int, iovs []Iovec, flags int) (int, error) {
|
||||
// Shmdt
|
||||
// Shmget
|
||||
// Sigaltstack
|
||||
// Signalfd
|
||||
// Swapoff
|
||||
// Swapon
|
||||
// Sysfs
|
||||
|
18
vendor/golang.org/x/sys/unix/syscall_linux_386.go
generated
vendored
18
vendor/golang.org/x/sys/unix/syscall_linux_386.go
generated
vendored
@ -10,7 +10,6 @@
|
||||
package unix
|
||||
|
||||
import (
|
||||
"syscall"
|
||||
"unsafe"
|
||||
)
|
||||
|
||||
@ -51,9 +50,12 @@ func Pipe2(p []int, flags int) (err error) {
|
||||
// 64-bit file system and 32-bit uid calls
|
||||
// (386 default is 32-bit file system and 16-bit uid).
|
||||
//sys Dup2(oldfd int, newfd int) (err error)
|
||||
//sysnb EpollCreate(size int) (fd int, err error)
|
||||
//sys EpollWait(epfd int, events []EpollEvent, msec int) (n int, err error)
|
||||
//sys Fadvise(fd int, offset int64, length int64, advice int) (err error) = SYS_FADVISE64_64
|
||||
//sys Fchown(fd int, uid int, gid int) (err error) = SYS_FCHOWN32
|
||||
//sys Fstat(fd int, stat *Stat_t) (err error) = SYS_FSTAT64
|
||||
//sys Fstatat(dirfd int, path string, stat *Stat_t, flags int) (err error) = SYS_FSTATAT64
|
||||
//sys Ftruncate(fd int, length int64) (err error) = SYS_FTRUNCATE64
|
||||
//sysnb Getegid() (egid int) = SYS_GETEGID32
|
||||
//sysnb Geteuid() (euid int) = SYS_GETEUID32
|
||||
@ -66,6 +68,7 @@ func Pipe2(p []int, flags int) (err error) {
|
||||
//sys Lstat(path string, stat *Stat_t) (err error) = SYS_LSTAT64
|
||||
//sys Pread(fd int, p []byte, offset int64) (n int, err error) = SYS_PREAD64
|
||||
//sys Pwrite(fd int, p []byte, offset int64) (n int, err error) = SYS_PWRITE64
|
||||
//sys Renameat(olddirfd int, oldpath string, newdirfd int, newpath string) (err error)
|
||||
//sys sendfile(outfd int, infd int, offset *int64, count int) (written int, err error) = SYS_SENDFILE64
|
||||
//sys Setfsgid(gid int) (err error) = SYS_SETFSGID32
|
||||
//sys Setfsuid(uid int) (err error) = SYS_SETFSUID32
|
||||
@ -77,12 +80,12 @@ func Pipe2(p []int, flags int) (err error) {
|
||||
//sys Stat(path string, stat *Stat_t) (err error) = SYS_STAT64
|
||||
//sys SyncFileRange(fd int, off int64, n int64, flags int) (err error)
|
||||
//sys Truncate(path string, length int64) (err error) = SYS_TRUNCATE64
|
||||
//sys Ustat(dev int, ubuf *Ustat_t) (err error)
|
||||
//sysnb getgroups(n int, list *_Gid_t) (nn int, err error) = SYS_GETGROUPS32
|
||||
//sysnb setgroups(n int, list *_Gid_t) (err error) = SYS_SETGROUPS32
|
||||
//sys Select(nfd int, r *FdSet, w *FdSet, e *FdSet, timeout *Timeval) (n int, err error) = SYS__NEWSELECT
|
||||
|
||||
//sys mmap2(addr uintptr, length uintptr, prot int, flags int, fd int, pageOffset uintptr) (xaddr uintptr, err error)
|
||||
//sys EpollWait(epfd int, events []EpollEvent, msec int) (n int, err error)
|
||||
//sys Pause() (err error)
|
||||
|
||||
func mmap(addr uintptr, length uintptr, prot int, flags int, fd int, offset int64) (xaddr uintptr, err error) {
|
||||
@ -156,10 +159,6 @@ func Setrlimit(resource int, rlim *Rlimit) (err error) {
|
||||
return setrlimit(resource, &rl)
|
||||
}
|
||||
|
||||
// Underlying system call writes to newoffset via pointer.
|
||||
// Implemented in assembly to avoid allocation.
|
||||
func seek(fd int, offset int64, whence int) (newoffset int64, err syscall.Errno)
|
||||
|
||||
func Seek(fd int, offset int64, whence int) (newoffset int64, err error) {
|
||||
newoffset, errno := seek(fd, offset, whence)
|
||||
if errno != 0 {
|
||||
@ -168,11 +167,11 @@ func Seek(fd int, offset int64, whence int) (newoffset int64, err error) {
|
||||
return newoffset, nil
|
||||
}
|
||||
|
||||
// Vsyscalls on amd64.
|
||||
//sys futimesat(dirfd int, path string, times *[2]Timeval) (err error)
|
||||
//sysnb Gettimeofday(tv *Timeval) (err error)
|
||||
//sysnb Time(t *Time_t) (tt Time_t, err error)
|
||||
|
||||
//sys Utime(path string, buf *Utimbuf) (err error)
|
||||
//sys utimes(path string, times *[2]Timeval) (err error)
|
||||
|
||||
// On x86 Linux, all the socket calls go through an extra indirection,
|
||||
// I think because the 5-register system call interface can't handle
|
||||
@ -205,9 +204,6 @@ const (
|
||||
_SENDMMSG = 20
|
||||
)
|
||||
|
||||
func socketcall(call int, a0, a1, a2, a3, a4, a5 uintptr) (n int, err syscall.Errno)
|
||||
func rawsocketcall(call int, a0, a1, a2, a3, a4, a5 uintptr) (n int, err syscall.Errno)
|
||||
|
||||
func accept(s int, rsa *RawSockaddrAny, addrlen *_Socklen) (fd int, err error) {
|
||||
fd, e := socketcall(_ACCEPT, uintptr(s), uintptr(unsafe.Pointer(rsa)), uintptr(unsafe.Pointer(addrlen)), 0, 0, 0)
|
||||
if e != 0 {
|
||||
|
55
vendor/golang.org/x/sys/unix/syscall_linux_amd64.go
generated
vendored
55
vendor/golang.org/x/sys/unix/syscall_linux_amd64.go
generated
vendored
@ -7,10 +7,12 @@
|
||||
package unix
|
||||
|
||||
//sys Dup2(oldfd int, newfd int) (err error)
|
||||
//sysnb EpollCreate(size int) (fd int, err error)
|
||||
//sys EpollWait(epfd int, events []EpollEvent, msec int) (n int, err error)
|
||||
//sys Fadvise(fd int, offset int64, length int64, advice int) (err error) = SYS_FADVISE64
|
||||
//sys Fchown(fd int, uid int, gid int) (err error)
|
||||
//sys Fstat(fd int, stat *Stat_t) (err error)
|
||||
//sys Fstatat(dirfd int, path string, stat *Stat_t, flags int) (err error) = SYS_NEWFSTATAT
|
||||
//sys Fstatfs(fd int, buf *Statfs_t) (err error)
|
||||
//sys Ftruncate(fd int, length int64) (err error)
|
||||
//sysnb Getegid() (egid int)
|
||||
@ -18,17 +20,40 @@ package unix
|
||||
//sysnb Getgid() (gid int)
|
||||
//sysnb Getrlimit(resource int, rlim *Rlimit) (err error)
|
||||
//sysnb Getuid() (uid int)
|
||||
//sysnb InotifyInit() (fd int, err error)
|
||||
//sysnb inotifyInit() (fd int, err error)
|
||||
|
||||
func InotifyInit() (fd int, err error) {
|
||||
// First try inotify_init1, because Android's seccomp policy blocks the latter.
|
||||
fd, err = InotifyInit1(0)
|
||||
if err == ENOSYS {
|
||||
fd, err = inotifyInit()
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
//sys Ioperm(from int, num int, on int) (err error)
|
||||
//sys Iopl(level int) (err error)
|
||||
//sys Lchown(path string, uid int, gid int) (err error)
|
||||
//sys Listen(s int, n int) (err error)
|
||||
//sys Lstat(path string, stat *Stat_t) (err error)
|
||||
|
||||
func Lstat(path string, stat *Stat_t) (err error) {
|
||||
return Fstatat(AT_FDCWD, path, stat, AT_SYMLINK_NOFOLLOW)
|
||||
}
|
||||
|
||||
//sys Pause() (err error)
|
||||
//sys Pread(fd int, p []byte, offset int64) (n int, err error) = SYS_PREAD64
|
||||
//sys Pwrite(fd int, p []byte, offset int64) (n int, err error) = SYS_PWRITE64
|
||||
//sys Renameat(olddirfd int, oldpath string, newdirfd int, newpath string) (err error)
|
||||
//sys Seek(fd int, offset int64, whence int) (off int64, err error) = SYS_LSEEK
|
||||
//sys Select(nfd int, r *FdSet, w *FdSet, e *FdSet, timeout *Timeval) (n int, err error)
|
||||
|
||||
func Select(nfd int, r *FdSet, w *FdSet, e *FdSet, timeout *Timeval) (n int, err error) {
|
||||
var ts *Timespec
|
||||
if timeout != nil {
|
||||
ts = &Timespec{Sec: timeout.Sec, Nsec: timeout.Usec * 1000}
|
||||
}
|
||||
return Pselect(nfd, r, w, e, ts, nil)
|
||||
}
|
||||
|
||||
//sys sendfile(outfd int, infd int, offset *int64, count int) (written int, err error)
|
||||
//sys Setfsgid(gid int) (err error)
|
||||
//sys Setfsuid(uid int) (err error)
|
||||
@ -39,10 +64,16 @@ package unix
|
||||
//sysnb Setreuid(ruid int, euid int) (err error)
|
||||
//sys Shutdown(fd int, how int) (err error)
|
||||
//sys Splice(rfd int, roff *int64, wfd int, woff *int64, len int, flags int) (n int64, err error)
|
||||
//sys Stat(path string, stat *Stat_t) (err error)
|
||||
|
||||
func Stat(path string, stat *Stat_t) (err error) {
|
||||
// Use fstatat, because Android's seccomp policy blocks stat.
|
||||
return Fstatat(AT_FDCWD, path, stat, 0)
|
||||
}
|
||||
|
||||
//sys Statfs(path string, buf *Statfs_t) (err error)
|
||||
//sys SyncFileRange(fd int, off int64, n int64, flags int) (err error)
|
||||
//sys Truncate(path string, length int64) (err error)
|
||||
//sys Ustat(dev int, ubuf *Ustat_t) (err error)
|
||||
//sys accept(s int, rsa *RawSockaddrAny, addrlen *_Socklen) (fd int, err error)
|
||||
//sys accept4(s int, rsa *RawSockaddrAny, addrlen *_Socklen, flags int) (fd int, err error)
|
||||
//sys bind(s int, addr unsafe.Pointer, addrlen _Socklen) (err error)
|
||||
@ -61,6 +92,8 @@ package unix
|
||||
//sys sendmsg(s int, msg *Msghdr, flags int) (n int, err error)
|
||||
//sys mmap(addr uintptr, length uintptr, prot int, flags int, fd int, offset int64) (xaddr uintptr, err error)
|
||||
|
||||
//sys futimesat(dirfd int, path string, times *[2]Timeval) (err error)
|
||||
|
||||
func Gettimeofday(tv *Timeval) (err error) {
|
||||
errno := gettimeofday(tv)
|
||||
if errno != 0 {
|
||||
@ -82,6 +115,7 @@ func Time(t *Time_t) (tt Time_t, err error) {
|
||||
}
|
||||
|
||||
//sys Utime(path string, buf *Utimbuf) (err error)
|
||||
//sys utimes(path string, times *[2]Timeval) (err error)
|
||||
|
||||
func setTimespec(sec, nsec int64) Timespec {
|
||||
return Timespec{Sec: sec, Nsec: nsec}
|
||||
@ -141,3 +175,16 @@ func Poll(fds []PollFd, timeout int) (n int, err error) {
|
||||
}
|
||||
return poll(&fds[0], len(fds), timeout)
|
||||
}
|
||||
|
||||
//sys kexecFileLoad(kernelFd int, initrdFd int, cmdlineLen int, cmdline string, flags int) (err error)
|
||||
|
||||
func KexecFileLoad(kernelFd int, initrdFd int, cmdline string, flags int) error {
|
||||
cmdlineLen := len(cmdline)
|
||||
if cmdlineLen > 0 {
|
||||
// Account for the additional NULL byte added by
|
||||
// BytePtrFromString in kexecFileLoad. The kexec_file_load
|
||||
// syscall expects a NULL-terminated string.
|
||||
cmdlineLen++
|
||||
}
|
||||
return kexecFileLoad(kernelFd, initrdFd, cmdlineLen, cmdline, flags)
|
||||
}
|
||||
|
20
vendor/golang.org/x/sys/unix/syscall_linux_arm.go
generated
vendored
20
vendor/golang.org/x/sys/unix/syscall_linux_arm.go
generated
vendored
@ -75,8 +75,11 @@ func Seek(fd int, offset int64, whence int) (newoffset int64, err error) {
|
||||
// 64-bit file system and 32-bit uid calls
|
||||
// (16-bit uid calls are not always supported in newer kernels)
|
||||
//sys Dup2(oldfd int, newfd int) (err error)
|
||||
//sysnb EpollCreate(size int) (fd int, err error)
|
||||
//sys EpollWait(epfd int, events []EpollEvent, msec int) (n int, err error)
|
||||
//sys Fchown(fd int, uid int, gid int) (err error) = SYS_FCHOWN32
|
||||
//sys Fstat(fd int, stat *Stat_t) (err error) = SYS_FSTAT64
|
||||
//sys Fstatat(dirfd int, path string, stat *Stat_t, flags int) (err error) = SYS_FSTATAT64
|
||||
//sysnb Getegid() (egid int) = SYS_GETEGID32
|
||||
//sysnb Geteuid() (euid int) = SYS_GETEUID32
|
||||
//sysnb Getgid() (gid int) = SYS_GETGID32
|
||||
@ -85,6 +88,8 @@ func Seek(fd int, offset int64, whence int) (newoffset int64, err error) {
|
||||
//sys Lchown(path string, uid int, gid int) (err error) = SYS_LCHOWN32
|
||||
//sys Listen(s int, n int) (err error)
|
||||
//sys Lstat(path string, stat *Stat_t) (err error) = SYS_LSTAT64
|
||||
//sys Pause() (err error)
|
||||
//sys Renameat(olddirfd int, oldpath string, newdirfd int, newpath string) (err error)
|
||||
//sys sendfile(outfd int, infd int, offset *int64, count int) (written int, err error) = SYS_SENDFILE64
|
||||
//sys Select(nfd int, r *FdSet, w *FdSet, e *FdSet, timeout *Timeval) (n int, err error) = SYS__NEWSELECT
|
||||
//sys Setfsgid(gid int) (err error) = SYS_SETFSGID32
|
||||
@ -96,11 +101,10 @@ func Seek(fd int, offset int64, whence int) (newoffset int64, err error) {
|
||||
//sys Shutdown(fd int, how int) (err error)
|
||||
//sys Splice(rfd int, roff *int64, wfd int, woff *int64, len int, flags int) (n int, err error)
|
||||
//sys Stat(path string, stat *Stat_t) (err error) = SYS_STAT64
|
||||
//sys Ustat(dev int, ubuf *Ustat_t) (err error)
|
||||
|
||||
// Vsyscalls on amd64.
|
||||
//sys futimesat(dirfd int, path string, times *[2]Timeval) (err error)
|
||||
//sysnb Gettimeofday(tv *Timeval) (err error)
|
||||
//sys EpollWait(epfd int, events []EpollEvent, msec int) (n int, err error)
|
||||
//sys Pause() (err error)
|
||||
|
||||
func Time(t *Time_t) (Time_t, error) {
|
||||
var tv Timeval
|
||||
@ -122,6 +126,8 @@ func Utime(path string, buf *Utimbuf) error {
|
||||
return Utimes(path, tv)
|
||||
}
|
||||
|
||||
//sys utimes(path string, times *[2]Timeval) (err error)
|
||||
|
||||
//sys Pread(fd int, p []byte, offset int64) (n int, err error) = SYS_PREAD64
|
||||
//sys Pwrite(fd int, p []byte, offset int64) (n int, err error) = SYS_PWRITE64
|
||||
//sys Truncate(path string, length int64) (err error) = SYS_TRUNCATE64
|
||||
@ -252,3 +258,11 @@ func Poll(fds []PollFd, timeout int) (n int, err error) {
|
||||
}
|
||||
return poll(&fds[0], len(fds), timeout)
|
||||
}
|
||||
|
||||
//sys armSyncFileRange(fd int, flags int, off int64, n int64) (err error) = SYS_ARM_SYNC_FILE_RANGE
|
||||
|
||||
func SyncFileRange(fd int, off int64, n int64, flags int) error {
|
||||
// The sync_file_range and arm_sync_file_range syscalls differ only in the
|
||||
// order of their arguments.
|
||||
return armSyncFileRange(fd, flags, off, n)
|
||||
}
|
||||
|
72
vendor/golang.org/x/sys/unix/syscall_linux_arm64.go
generated
vendored
72
vendor/golang.org/x/sys/unix/syscall_linux_arm64.go
generated
vendored
@ -6,7 +6,17 @@
|
||||
|
||||
package unix
|
||||
|
||||
import "unsafe"
|
||||
|
||||
func EpollCreate(size int) (fd int, err error) {
|
||||
if size <= 0 {
|
||||
return -1, EINVAL
|
||||
}
|
||||
return EpollCreate1(0)
|
||||
}
|
||||
|
||||
//sys EpollWait(epfd int, events []EpollEvent, msec int) (n int, err error) = SYS_EPOLL_PWAIT
|
||||
//sys Fadvise(fd int, offset int64, length int64, advice int) (err error) = SYS_FADVISE64
|
||||
//sys Fchown(fd int, uid int, gid int) (err error)
|
||||
//sys Fstat(fd int, stat *Stat_t) (err error)
|
||||
//sys Fstatat(fd int, path string, stat *Stat_t, flags int) (err error)
|
||||
@ -20,11 +30,15 @@ package unix
|
||||
//sys Listen(s int, n int) (err error)
|
||||
//sys Pread(fd int, p []byte, offset int64) (n int, err error) = SYS_PREAD64
|
||||
//sys Pwrite(fd int, p []byte, offset int64) (n int, err error) = SYS_PWRITE64
|
||||
//sys Renameat(olddirfd int, oldpath string, newdirfd int, newpath string) (err error)
|
||||
//sys Seek(fd int, offset int64, whence int) (off int64, err error) = SYS_LSEEK
|
||||
|
||||
func Select(nfd int, r *FdSet, w *FdSet, e *FdSet, timeout *Timeval) (n int, err error) {
|
||||
ts := Timespec{Sec: timeout.Sec, Nsec: timeout.Usec * 1000}
|
||||
return Pselect(nfd, r, w, e, &ts, nil)
|
||||
var ts *Timespec
|
||||
if timeout != nil {
|
||||
ts = &Timespec{Sec: timeout.Sec, Nsec: timeout.Usec * 1000}
|
||||
}
|
||||
return Pselect(nfd, r, w, e, ts, nil)
|
||||
}
|
||||
|
||||
//sys sendfile(outfd int, infd int, offset *int64, count int) (written int, err error)
|
||||
@ -53,6 +67,11 @@ func Lstat(path string, stat *Stat_t) (err error) {
|
||||
//sys Statfs(path string, buf *Statfs_t) (err error)
|
||||
//sys SyncFileRange(fd int, off int64, n int64, flags int) (err error)
|
||||
//sys Truncate(path string, length int64) (err error)
|
||||
|
||||
func Ustat(dev int, ubuf *Ustat_t) (err error) {
|
||||
return ENOSYS
|
||||
}
|
||||
|
||||
//sys accept(s int, rsa *RawSockaddrAny, addrlen *_Socklen) (fd int, err error)
|
||||
//sys accept4(s int, rsa *RawSockaddrAny, addrlen *_Socklen, flags int) (fd int, err error)
|
||||
//sys bind(s int, addr unsafe.Pointer, addrlen _Socklen) (err error)
|
||||
@ -81,6 +100,18 @@ func setTimeval(sec, usec int64) Timeval {
|
||||
return Timeval{Sec: sec, Usec: usec}
|
||||
}
|
||||
|
||||
func futimesat(dirfd int, path string, tv *[2]Timeval) (err error) {
|
||||
if tv == nil {
|
||||
return utimensat(dirfd, path, nil, 0)
|
||||
}
|
||||
|
||||
ts := []Timespec{
|
||||
NsecToTimespec(TimevalToNsec(tv[0])),
|
||||
NsecToTimespec(TimevalToNsec(tv[1])),
|
||||
}
|
||||
return utimensat(dirfd, path, (*[2]Timespec)(unsafe.Pointer(&ts[0])), 0)
|
||||
}
|
||||
|
||||
func Time(t *Time_t) (Time_t, error) {
|
||||
var tv Timeval
|
||||
err := Gettimeofday(&tv)
|
||||
@ -101,6 +132,18 @@ func Utime(path string, buf *Utimbuf) error {
|
||||
return Utimes(path, tv)
|
||||
}
|
||||
|
||||
func utimes(path string, tv *[2]Timeval) (err error) {
|
||||
if tv == nil {
|
||||
return utimensat(AT_FDCWD, path, nil, 0)
|
||||
}
|
||||
|
||||
ts := []Timespec{
|
||||
NsecToTimespec(TimevalToNsec(tv[0])),
|
||||
NsecToTimespec(TimevalToNsec(tv[1])),
|
||||
}
|
||||
return utimensat(AT_FDCWD, path, (*[2]Timespec)(unsafe.Pointer(&ts[0])), 0)
|
||||
}
|
||||
|
||||
func Pipe(p []int) (err error) {
|
||||
if len(p) != 2 {
|
||||
return EINVAL
|
||||
@ -149,30 +192,11 @@ func Dup2(oldfd int, newfd int) (err error) {
|
||||
return Dup3(oldfd, newfd, 0)
|
||||
}
|
||||
|
||||
func Pause() (err error) {
|
||||
_, _, e1 := Syscall6(SYS_PPOLL, 0, 0, 0, 0, 0, 0)
|
||||
if e1 != 0 {
|
||||
err = errnoErr(e1)
|
||||
}
|
||||
return
|
||||
func Pause() error {
|
||||
_, err := ppoll(nil, 0, nil, nil)
|
||||
return err
|
||||
}
|
||||
|
||||
// TODO(dfc): constants that should be in zsysnum_linux_arm64.go, remove
|
||||
// these when the deprecated syscalls that the syscall package relies on
|
||||
// are removed.
|
||||
const (
|
||||
SYS_GETPGRP = 1060
|
||||
SYS_UTIMES = 1037
|
||||
SYS_FUTIMESAT = 1066
|
||||
SYS_PAUSE = 1061
|
||||
SYS_USTAT = 1070
|
||||
SYS_UTIME = 1063
|
||||
SYS_LCHOWN = 1032
|
||||
SYS_TIME = 1062
|
||||
SYS_EPOLL_CREATE = 1042
|
||||
SYS_EPOLL_WAIT = 1069
|
||||
)
|
||||
|
||||
func Poll(fds []PollFd, timeout int) (n int, err error) {
|
||||
var ts *Timespec
|
||||
if timeout >= 0 {
|
||||
|
14
vendor/golang.org/x/sys/unix/syscall_linux_gc.go
generated
vendored
Normal file
14
vendor/golang.org/x/sys/unix/syscall_linux_gc.go
generated
vendored
Normal file
@ -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.
|
||||
|
||||
// +build linux,!gccgo
|
||||
|
||||
package unix
|
||||
|
||||
// SyscallNoError may be used instead of Syscall for syscalls that don't fail.
|
||||
func SyscallNoError(trap, a1, a2, a3 uintptr) (r1, r2 uintptr)
|
||||
|
||||
// RawSyscallNoError may be used instead of RawSyscall for syscalls that don't
|
||||
// fail.
|
||||
func RawSyscallNoError(trap, a1, a2, a3 uintptr) (r1, r2 uintptr)
|
16
vendor/golang.org/x/sys/unix/syscall_linux_gc_386.go
generated
vendored
Normal file
16
vendor/golang.org/x/sys/unix/syscall_linux_gc_386.go
generated
vendored
Normal file
@ -0,0 +1,16 @@
|
||||
// Copyright 2018 The Go Authors. All rights reserved.
|
||||
// Use of this source code is governed by a BSD-style
|
||||
// license that can be found in the LICENSE file.
|
||||
|
||||
// +build linux,!gccgo,386
|
||||
|
||||
package unix
|
||||
|
||||
import "syscall"
|
||||
|
||||
// Underlying system call writes to newoffset via pointer.
|
||||
// Implemented in assembly to avoid allocation.
|
||||
func seek(fd int, offset int64, whence int) (newoffset int64, err syscall.Errno)
|
||||
|
||||
func socketcall(call int, a0, a1, a2, a3, a4, a5 uintptr) (n int, err syscall.Errno)
|
||||
func rawsocketcall(call int, a0, a1, a2, a3, a4, a5 uintptr) (n int, err syscall.Errno)
|
30
vendor/golang.org/x/sys/unix/syscall_linux_gccgo_386.go
generated
vendored
Normal file
30
vendor/golang.org/x/sys/unix/syscall_linux_gccgo_386.go
generated
vendored
Normal file
@ -0,0 +1,30 @@
|
||||
// Copyright 2018 The Go Authors. All rights reserved.
|
||||
// Use of this source code is governed by a BSD-style
|
||||
// license that can be found in the LICENSE file.
|
||||
|
||||
// +build linux,gccgo,386
|
||||
|
||||
package unix
|
||||
|
||||
import (
|
||||
"syscall"
|
||||
"unsafe"
|
||||
)
|
||||
|
||||
func seek(fd int, offset int64, whence int) (int64, syscall.Errno) {
|
||||
var newoffset int64
|
||||
offsetLow := uint32(offset & 0xffffffff)
|
||||
offsetHigh := uint32((offset >> 32) & 0xffffffff)
|
||||
_, _, err := Syscall6(SYS__LLSEEK, uintptr(fd), uintptr(offsetHigh), uintptr(offsetLow), uintptr(unsafe.Pointer(&newoffset)), uintptr(whence), 0)
|
||||
return newoffset, err
|
||||
}
|
||||
|
||||
func socketcall(call int, a0, a1, a2, a3, a4, a5 uintptr) (int, syscall.Errno) {
|
||||
fd, _, err := Syscall(SYS_SOCKETCALL, uintptr(call), uintptr(unsafe.Pointer(&a0)), 0)
|
||||
return int(fd), err
|
||||
}
|
||||
|
||||
func rawsocketcall(call int, a0, a1, a2, a3, a4, a5 uintptr) (int, syscall.Errno) {
|
||||
fd, _, err := RawSyscall(SYS_SOCKETCALL, uintptr(call), uintptr(unsafe.Pointer(&a0)), 0)
|
||||
return int(fd), err
|
||||
}
|
20
vendor/golang.org/x/sys/unix/syscall_linux_gccgo_arm.go
generated
vendored
Normal file
20
vendor/golang.org/x/sys/unix/syscall_linux_gccgo_arm.go
generated
vendored
Normal file
@ -0,0 +1,20 @@
|
||||
// Copyright 2018 The Go Authors. All rights reserved.
|
||||
// Use of this source code is governed by a BSD-style
|
||||
// license that can be found in the LICENSE file.
|
||||
|
||||
// +build linux,gccgo,arm
|
||||
|
||||
package unix
|
||||
|
||||
import (
|
||||
"syscall"
|
||||
"unsafe"
|
||||
)
|
||||
|
||||
func seek(fd int, offset int64, whence int) (int64, syscall.Errno) {
|
||||
var newoffset int64
|
||||
offsetLow := uint32(offset & 0xffffffff)
|
||||
offsetHigh := uint32((offset >> 32) & 0xffffffff)
|
||||
_, _, err := Syscall6(SYS__LLSEEK, uintptr(fd), uintptr(offsetHigh), uintptr(offsetLow), uintptr(unsafe.Pointer(&newoffset)), uintptr(whence), 0)
|
||||
return newoffset, err
|
||||
}
|
21
vendor/golang.org/x/sys/unix/syscall_linux_mips64x.go
generated
vendored
21
vendor/golang.org/x/sys/unix/syscall_linux_mips64x.go
generated
vendored
@ -8,7 +8,9 @@
|
||||
package unix
|
||||
|
||||
//sys Dup2(oldfd int, newfd int) (err error)
|
||||
//sysnb EpollCreate(size int) (fd int, err error)
|
||||
//sys EpollWait(epfd int, events []EpollEvent, msec int) (n int, err error)
|
||||
//sys Fadvise(fd int, offset int64, length int64, advice int) (err error) = SYS_FADVISE64
|
||||
//sys Fchown(fd int, uid int, gid int) (err error)
|
||||
//sys Fstatfs(fd int, buf *Statfs_t) (err error)
|
||||
//sys Ftruncate(fd int, length int64) (err error)
|
||||
@ -22,11 +24,15 @@ package unix
|
||||
//sys Pause() (err error)
|
||||
//sys Pread(fd int, p []byte, offset int64) (n int, err error) = SYS_PREAD64
|
||||
//sys Pwrite(fd int, p []byte, offset int64) (n int, err error) = SYS_PWRITE64
|
||||
//sys Renameat(olddirfd int, oldpath string, newdirfd int, newpath string) (err error)
|
||||
//sys Seek(fd int, offset int64, whence int) (off int64, err error) = SYS_LSEEK
|
||||
|
||||
func Select(nfd int, r *FdSet, w *FdSet, e *FdSet, timeout *Timeval) (n int, err error) {
|
||||
ts := Timespec{Sec: timeout.Sec, Nsec: timeout.Usec * 1000}
|
||||
return Pselect(nfd, r, w, e, &ts, nil)
|
||||
var ts *Timespec
|
||||
if timeout != nil {
|
||||
ts = &Timespec{Sec: timeout.Sec, Nsec: timeout.Usec * 1000}
|
||||
}
|
||||
return Pselect(nfd, r, w, e, ts, nil)
|
||||
}
|
||||
|
||||
//sys sendfile(outfd int, infd int, offset *int64, count int) (written int, err error)
|
||||
@ -42,6 +48,7 @@ func Select(nfd int, r *FdSet, w *FdSet, e *FdSet, timeout *Timeval) (n int, err
|
||||
//sys Statfs(path string, buf *Statfs_t) (err error)
|
||||
//sys SyncFileRange(fd int, off int64, n int64, flags int) (err error)
|
||||
//sys Truncate(path string, length int64) (err error)
|
||||
//sys Ustat(dev int, ubuf *Ustat_t) (err error)
|
||||
//sys accept(s int, rsa *RawSockaddrAny, addrlen *_Socklen) (fd int, err error)
|
||||
//sys accept4(s int, rsa *RawSockaddrAny, addrlen *_Socklen, flags int) (fd int, err error)
|
||||
//sys bind(s int, addr unsafe.Pointer, addrlen _Socklen) (err error)
|
||||
@ -60,6 +67,7 @@ func Select(nfd int, r *FdSet, w *FdSet, e *FdSet, timeout *Timeval) (n int, err
|
||||
//sys sendmsg(s int, msg *Msghdr, flags int) (n int, err error)
|
||||
//sys mmap(addr uintptr, length uintptr, prot int, flags int, fd int, offset int64) (xaddr uintptr, err error)
|
||||
|
||||
//sys futimesat(dirfd int, path string, times *[2]Timeval) (err error)
|
||||
//sysnb Gettimeofday(tv *Timeval) (err error)
|
||||
|
||||
func Time(t *Time_t) (tt Time_t, err error) {
|
||||
@ -75,6 +83,7 @@ func Time(t *Time_t) (tt Time_t, err error) {
|
||||
}
|
||||
|
||||
//sys Utime(path string, buf *Utimbuf) (err error)
|
||||
//sys utimes(path string, times *[2]Timeval) (err error)
|
||||
|
||||
func setTimespec(sec, nsec int64) Timespec {
|
||||
return Timespec{Sec: sec, Nsec: nsec}
|
||||
@ -139,6 +148,7 @@ type stat_t struct {
|
||||
}
|
||||
|
||||
//sys fstat(fd int, st *stat_t) (err error)
|
||||
//sys fstatat(dirfd int, path string, st *stat_t, flags int) (err error) = SYS_NEWFSTATAT
|
||||
//sys lstat(path string, st *stat_t) (err error)
|
||||
//sys stat(path string, st *stat_t) (err error)
|
||||
|
||||
@ -149,6 +159,13 @@ func Fstat(fd int, s *Stat_t) (err error) {
|
||||
return
|
||||
}
|
||||
|
||||
func Fstatat(dirfd int, path string, s *Stat_t, flags int) (err error) {
|
||||
st := &stat_t{}
|
||||
err = fstatat(dirfd, path, st, flags)
|
||||
fillStat_t(s, st)
|
||||
return
|
||||
}
|
||||
|
||||
func Lstat(path string, s *Stat_t) (err error) {
|
||||
st := &stat_t{}
|
||||
err = lstat(path, st)
|
||||
|
22
vendor/golang.org/x/sys/unix/syscall_linux_mipsx.go
generated
vendored
22
vendor/golang.org/x/sys/unix/syscall_linux_mipsx.go
generated
vendored
@ -15,6 +15,9 @@ import (
|
||||
func Syscall9(trap, a1, a2, a3, a4, a5, a6, a7, a8, a9 uintptr) (r1, r2 uintptr, err syscall.Errno)
|
||||
|
||||
//sys Dup2(oldfd int, newfd int) (err error)
|
||||
//sysnb EpollCreate(size int) (fd int, err error)
|
||||
//sys EpollWait(epfd int, events []EpollEvent, msec int) (n int, err error)
|
||||
//sys Fadvise(fd int, offset int64, length int64, advice int) (err error) = SYS_FADVISE64
|
||||
//sys Fchown(fd int, uid int, gid int) (err error)
|
||||
//sys Ftruncate(fd int, length int64) (err error) = SYS_FTRUNCATE64
|
||||
//sysnb Getegid() (egid int)
|
||||
@ -25,6 +28,7 @@ func Syscall9(trap, a1, a2, a3, a4, a5, a6, a7, a8, a9 uintptr) (r1, r2 uintptr,
|
||||
//sys Listen(s int, n int) (err error)
|
||||
//sys Pread(fd int, p []byte, offset int64) (n int, err error) = SYS_PREAD64
|
||||
//sys Pwrite(fd int, p []byte, offset int64) (n int, err error) = SYS_PWRITE64
|
||||
//sys Renameat(olddirfd int, oldpath string, newdirfd int, newpath string) (err error)
|
||||
//sys Select(nfd int, r *FdSet, w *FdSet, e *FdSet, timeout *Timeval) (n int, err error) = SYS__NEWSELECT
|
||||
//sys sendfile(outfd int, infd int, offset *int64, count int) (written int, err error) = SYS_SENDFILE64
|
||||
//sys Setfsgid(gid int) (err error)
|
||||
@ -32,13 +36,12 @@ func Syscall9(trap, a1, a2, a3, a4, a5, a6, a7, a8, a9 uintptr) (r1, r2 uintptr,
|
||||
//sysnb Setregid(rgid int, egid int) (err error)
|
||||
//sysnb Setresgid(rgid int, egid int, sgid int) (err error)
|
||||
//sysnb Setresuid(ruid int, euid int, suid int) (err error)
|
||||
|
||||
//sysnb Setreuid(ruid int, euid int) (err error)
|
||||
//sys Shutdown(fd int, how int) (err error)
|
||||
//sys Splice(rfd int, roff *int64, wfd int, woff *int64, len int, flags int) (n int64, err error)
|
||||
|
||||
//sys Splice(rfd int, roff *int64, wfd int, woff *int64, len int, flags int) (n int, err error)
|
||||
//sys SyncFileRange(fd int, off int64, n int64, flags int) (err error)
|
||||
//sys Truncate(path string, length int64) (err error) = SYS_TRUNCATE64
|
||||
//sys Ustat(dev int, ubuf *Ustat_t) (err error)
|
||||
//sys accept(s int, rsa *RawSockaddrAny, addrlen *_Socklen) (fd int, err error)
|
||||
//sys accept4(s int, rsa *RawSockaddrAny, addrlen *_Socklen, flags int) (fd int, err error)
|
||||
//sys bind(s int, addr unsafe.Pointer, addrlen _Socklen) (err error)
|
||||
@ -60,15 +63,17 @@ func Syscall9(trap, a1, a2, a3, a4, a5, a6, a7, a8, a9 uintptr) (r1, r2 uintptr,
|
||||
//sys Ioperm(from int, num int, on int) (err error)
|
||||
//sys Iopl(level int) (err error)
|
||||
|
||||
//sys futimesat(dirfd int, path string, times *[2]Timeval) (err error)
|
||||
//sysnb Gettimeofday(tv *Timeval) (err error)
|
||||
//sysnb Time(t *Time_t) (tt Time_t, err error)
|
||||
//sys Utime(path string, buf *Utimbuf) (err error)
|
||||
//sys utimes(path string, times *[2]Timeval) (err error)
|
||||
|
||||
//sys Lstat(path string, stat *Stat_t) (err error) = SYS_LSTAT64
|
||||
//sys Fstat(fd int, stat *Stat_t) (err error) = SYS_FSTAT64
|
||||
//sys Fstatat(dirfd int, path string, stat *Stat_t, flags int) (err error) = SYS_FSTATAT64
|
||||
//sys Stat(path string, stat *Stat_t) (err error) = SYS_STAT64
|
||||
|
||||
//sys Utime(path string, buf *Utimbuf) (err error)
|
||||
//sys EpollWait(epfd int, events []EpollEvent, msec int) (n int, err error)
|
||||
//sys Pause() (err error)
|
||||
|
||||
func Fstatfs(fd int, buf *Statfs_t) (err error) {
|
||||
@ -120,14 +125,13 @@ func Pipe2(p []int, flags int) (err error) {
|
||||
return
|
||||
}
|
||||
|
||||
//sysnb pipe() (p1 int, p2 int, err error)
|
||||
|
||||
func Pipe(p []int) (err error) {
|
||||
if len(p) != 2 {
|
||||
return EINVAL
|
||||
}
|
||||
var pp [2]_C_int
|
||||
err = pipe2(&pp, 0)
|
||||
p[0] = int(pp[0])
|
||||
p[1] = int(pp[1])
|
||||
p[0], p[1], err = pipe()
|
||||
return
|
||||
}
|
||||
|
||||
|
32
vendor/golang.org/x/sys/unix/syscall_linux_ppc64x.go
generated
vendored
32
vendor/golang.org/x/sys/unix/syscall_linux_ppc64x.go
generated
vendored
@ -7,10 +7,13 @@
|
||||
|
||||
package unix
|
||||
|
||||
//sys EpollWait(epfd int, events []EpollEvent, msec int) (n int, err error)
|
||||
//sys Dup2(oldfd int, newfd int) (err error)
|
||||
//sysnb EpollCreate(size int) (fd int, err error)
|
||||
//sys EpollWait(epfd int, events []EpollEvent, msec int) (n int, err error)
|
||||
//sys Fadvise(fd int, offset int64, length int64, advice int) (err error) = SYS_FADVISE64
|
||||
//sys Fchown(fd int, uid int, gid int) (err error)
|
||||
//sys Fstat(fd int, stat *Stat_t) (err error)
|
||||
//sys Fstatat(dirfd int, path string, stat *Stat_t, flags int) (err error) = SYS_NEWFSTATAT
|
||||
//sys Fstatfs(fd int, buf *Statfs_t) (err error)
|
||||
//sys Ftruncate(fd int, length int64) (err error)
|
||||
//sysnb Getegid() (egid int)
|
||||
@ -27,6 +30,7 @@ package unix
|
||||
//sys Pause() (err error)
|
||||
//sys Pread(fd int, p []byte, offset int64) (n int, err error) = SYS_PREAD64
|
||||
//sys Pwrite(fd int, p []byte, offset int64) (n int, err error) = SYS_PWRITE64
|
||||
//sys Renameat(olddirfd int, oldpath string, newdirfd int, newpath string) (err error)
|
||||
//sys Seek(fd int, offset int64, whence int) (off int64, err error) = SYS_LSEEK
|
||||
//sys Select(nfd int, r *FdSet, w *FdSet, e *FdSet, timeout *Timeval) (n int, err error) = SYS__NEWSELECT
|
||||
//sys sendfile(outfd int, infd int, offset *int64, count int) (written int, err error)
|
||||
@ -41,8 +45,8 @@ package unix
|
||||
//sys Splice(rfd int, roff *int64, wfd int, woff *int64, len int, flags int) (n int64, err error)
|
||||
//sys Stat(path string, stat *Stat_t) (err error)
|
||||
//sys Statfs(path string, buf *Statfs_t) (err error)
|
||||
//sys SyncFileRange(fd int, off int64, n int64, flags int) (err error) = SYS_SYNC_FILE_RANGE2
|
||||
//sys Truncate(path string, length int64) (err error)
|
||||
//sys Ustat(dev int, ubuf *Ustat_t) (err error)
|
||||
//sys accept(s int, rsa *RawSockaddrAny, addrlen *_Socklen) (fd int, err error)
|
||||
//sys accept4(s int, rsa *RawSockaddrAny, addrlen *_Socklen, flags int) (fd int, err error)
|
||||
//sys bind(s int, addr unsafe.Pointer, addrlen _Socklen) (err error)
|
||||
@ -61,10 +65,11 @@ package unix
|
||||
//sys sendmsg(s int, msg *Msghdr, flags int) (n int, err error)
|
||||
//sys mmap(addr uintptr, length uintptr, prot int, flags int, fd int, offset int64) (xaddr uintptr, err error)
|
||||
|
||||
//sys futimesat(dirfd int, path string, times *[2]Timeval) (err error)
|
||||
//sysnb Gettimeofday(tv *Timeval) (err error)
|
||||
//sysnb Time(t *Time_t) (tt Time_t, err error)
|
||||
|
||||
//sys Utime(path string, buf *Utimbuf) (err error)
|
||||
//sys utimes(path string, times *[2]Timeval) (err error)
|
||||
|
||||
func setTimespec(sec, nsec int64) Timespec {
|
||||
return Timespec{Sec: sec, Nsec: nsec}
|
||||
@ -124,3 +129,24 @@ func Poll(fds []PollFd, timeout int) (n int, err error) {
|
||||
}
|
||||
return poll(&fds[0], len(fds), timeout)
|
||||
}
|
||||
|
||||
//sys syncFileRange2(fd int, flags int, off int64, n int64) (err error) = SYS_SYNC_FILE_RANGE2
|
||||
|
||||
func SyncFileRange(fd int, off int64, n int64, flags int) error {
|
||||
// The sync_file_range and sync_file_range2 syscalls differ only in the
|
||||
// order of their arguments.
|
||||
return syncFileRange2(fd, flags, off, n)
|
||||
}
|
||||
|
||||
//sys kexecFileLoad(kernelFd int, initrdFd int, cmdlineLen int, cmdline string, flags int) (err error)
|
||||
|
||||
func KexecFileLoad(kernelFd int, initrdFd int, cmdline string, flags int) error {
|
||||
cmdlineLen := len(cmdline)
|
||||
if cmdlineLen > 0 {
|
||||
// Account for the additional NULL byte added by
|
||||
// BytePtrFromString in kexecFileLoad. The kexec_file_load
|
||||
// syscall expects a NULL-terminated string.
|
||||
cmdlineLen++
|
||||
}
|
||||
return kexecFileLoad(kernelFd, initrdFd, cmdlineLen, cmdline, flags)
|
||||
}
|
||||
|
213
vendor/golang.org/x/sys/unix/syscall_linux_riscv64.go
generated
vendored
Normal file
213
vendor/golang.org/x/sys/unix/syscall_linux_riscv64.go
generated
vendored
Normal file
@ -0,0 +1,213 @@
|
||||
// Copyright 2018 The Go Authors. All rights reserved.
|
||||
// Use of this source code is governed by a BSD-style
|
||||
// license that can be found in the LICENSE file.
|
||||
|
||||
// +build riscv64,linux
|
||||
|
||||
package unix
|
||||
|
||||
import "unsafe"
|
||||
|
||||
func EpollCreate(size int) (fd int, err error) {
|
||||
if size <= 0 {
|
||||
return -1, EINVAL
|
||||
}
|
||||
return EpollCreate1(0)
|
||||
}
|
||||
|
||||
//sys EpollWait(epfd int, events []EpollEvent, msec int) (n int, err error) = SYS_EPOLL_PWAIT
|
||||
//sys Fadvise(fd int, offset int64, length int64, advice int) (err error) = SYS_FADVISE64
|
||||
//sys Fchown(fd int, uid int, gid int) (err error)
|
||||
//sys Fstat(fd int, stat *Stat_t) (err error)
|
||||
//sys Fstatat(fd int, path string, stat *Stat_t, flags int) (err error)
|
||||
//sys Fstatfs(fd int, buf *Statfs_t) (err error)
|
||||
//sys Ftruncate(fd int, length int64) (err error)
|
||||
//sysnb Getegid() (egid int)
|
||||
//sysnb Geteuid() (euid int)
|
||||
//sysnb Getgid() (gid int)
|
||||
//sysnb Getrlimit(resource int, rlim *Rlimit) (err error)
|
||||
//sysnb Getuid() (uid int)
|
||||
//sys Listen(s int, n int) (err error)
|
||||
//sys Pread(fd int, p []byte, offset int64) (n int, err error) = SYS_PREAD64
|
||||
//sys Pwrite(fd int, p []byte, offset int64) (n int, err error) = SYS_PWRITE64
|
||||
//sys Seek(fd int, offset int64, whence int) (off int64, err error) = SYS_LSEEK
|
||||
|
||||
func Select(nfd int, r *FdSet, w *FdSet, e *FdSet, timeout *Timeval) (n int, err error) {
|
||||
var ts *Timespec
|
||||
if timeout != nil {
|
||||
ts = &Timespec{Sec: timeout.Sec, Nsec: timeout.Usec * 1000}
|
||||
}
|
||||
return Pselect(nfd, r, w, e, ts, nil)
|
||||
}
|
||||
|
||||
//sys sendfile(outfd int, infd int, offset *int64, count int) (written int, err error)
|
||||
//sys Setfsgid(gid int) (err error)
|
||||
//sys Setfsuid(uid int) (err error)
|
||||
//sysnb Setregid(rgid int, egid int) (err error)
|
||||
//sysnb Setresgid(rgid int, egid int, sgid int) (err error)
|
||||
//sysnb Setresuid(ruid int, euid int, suid int) (err error)
|
||||
//sysnb Setrlimit(resource int, rlim *Rlimit) (err error)
|
||||
//sysnb Setreuid(ruid int, euid int) (err error)
|
||||
//sys Shutdown(fd int, how int) (err error)
|
||||
//sys Splice(rfd int, roff *int64, wfd int, woff *int64, len int, flags int) (n int64, err error)
|
||||
|
||||
func Stat(path string, stat *Stat_t) (err error) {
|
||||
return Fstatat(AT_FDCWD, path, stat, 0)
|
||||
}
|
||||
|
||||
func Lchown(path string, uid int, gid int) (err error) {
|
||||
return Fchownat(AT_FDCWD, path, uid, gid, AT_SYMLINK_NOFOLLOW)
|
||||
}
|
||||
|
||||
func Lstat(path string, stat *Stat_t) (err error) {
|
||||
return Fstatat(AT_FDCWD, path, stat, AT_SYMLINK_NOFOLLOW)
|
||||
}
|
||||
|
||||
//sys Statfs(path string, buf *Statfs_t) (err error)
|
||||
//sys SyncFileRange(fd int, off int64, n int64, flags int) (err error)
|
||||
//sys Truncate(path string, length int64) (err error)
|
||||
|
||||
func Ustat(dev int, ubuf *Ustat_t) (err error) {
|
||||
return ENOSYS
|
||||
}
|
||||
|
||||
//sys accept(s int, rsa *RawSockaddrAny, addrlen *_Socklen) (fd int, err error)
|
||||
//sys accept4(s int, rsa *RawSockaddrAny, addrlen *_Socklen, flags int) (fd int, err error)
|
||||
//sys bind(s int, addr unsafe.Pointer, addrlen _Socklen) (err error)
|
||||
//sys connect(s int, addr unsafe.Pointer, addrlen _Socklen) (err error)
|
||||
//sysnb getgroups(n int, list *_Gid_t) (nn int, err error)
|
||||
//sysnb setgroups(n int, list *_Gid_t) (err error)
|
||||
//sys getsockopt(s int, level int, name int, val unsafe.Pointer, vallen *_Socklen) (err error)
|
||||
//sys setsockopt(s int, level int, name int, val unsafe.Pointer, vallen uintptr) (err error)
|
||||
//sysnb socket(domain int, typ int, proto int) (fd int, err error)
|
||||
//sysnb socketpair(domain int, typ int, proto int, fd *[2]int32) (err error)
|
||||
//sysnb getpeername(fd int, rsa *RawSockaddrAny, addrlen *_Socklen) (err error)
|
||||
//sysnb getsockname(fd int, rsa *RawSockaddrAny, addrlen *_Socklen) (err error)
|
||||
//sys recvfrom(fd int, p []byte, flags int, from *RawSockaddrAny, fromlen *_Socklen) (n int, err error)
|
||||
//sys sendto(s int, buf []byte, flags int, to unsafe.Pointer, addrlen _Socklen) (err error)
|
||||
//sys recvmsg(s int, msg *Msghdr, flags int) (n int, err error)
|
||||
//sys sendmsg(s int, msg *Msghdr, flags int) (n int, err error)
|
||||
//sys mmap(addr uintptr, length uintptr, prot int, flags int, fd int, offset int64) (xaddr uintptr, err error)
|
||||
|
||||
//sysnb Gettimeofday(tv *Timeval) (err error)
|
||||
|
||||
func setTimespec(sec, nsec int64) Timespec {
|
||||
return Timespec{Sec: sec, Nsec: nsec}
|
||||
}
|
||||
|
||||
func setTimeval(sec, usec int64) Timeval {
|
||||
return Timeval{Sec: sec, Usec: usec}
|
||||
}
|
||||
|
||||
func futimesat(dirfd int, path string, tv *[2]Timeval) (err error) {
|
||||
if tv == nil {
|
||||
return utimensat(dirfd, path, nil, 0)
|
||||
}
|
||||
|
||||
ts := []Timespec{
|
||||
NsecToTimespec(TimevalToNsec(tv[0])),
|
||||
NsecToTimespec(TimevalToNsec(tv[1])),
|
||||
}
|
||||
return utimensat(dirfd, path, (*[2]Timespec)(unsafe.Pointer(&ts[0])), 0)
|
||||
}
|
||||
|
||||
func Time(t *Time_t) (Time_t, error) {
|
||||
var tv Timeval
|
||||
err := Gettimeofday(&tv)
|
||||
if err != nil {
|
||||
return 0, err
|
||||
}
|
||||
if t != nil {
|
||||
*t = Time_t(tv.Sec)
|
||||
}
|
||||
return Time_t(tv.Sec), nil
|
||||
}
|
||||
|
||||
func Utime(path string, buf *Utimbuf) error {
|
||||
tv := []Timeval{
|
||||
{Sec: buf.Actime},
|
||||
{Sec: buf.Modtime},
|
||||
}
|
||||
return Utimes(path, tv)
|
||||
}
|
||||
|
||||
func utimes(path string, tv *[2]Timeval) (err error) {
|
||||
if tv == nil {
|
||||
return utimensat(AT_FDCWD, path, nil, 0)
|
||||
}
|
||||
|
||||
ts := []Timespec{
|
||||
NsecToTimespec(TimevalToNsec(tv[0])),
|
||||
NsecToTimespec(TimevalToNsec(tv[1])),
|
||||
}
|
||||
return utimensat(AT_FDCWD, path, (*[2]Timespec)(unsafe.Pointer(&ts[0])), 0)
|
||||
}
|
||||
|
||||
func Pipe(p []int) (err error) {
|
||||
if len(p) != 2 {
|
||||
return EINVAL
|
||||
}
|
||||
var pp [2]_C_int
|
||||
err = pipe2(&pp, 0)
|
||||
p[0] = int(pp[0])
|
||||
p[1] = int(pp[1])
|
||||
return
|
||||
}
|
||||
|
||||
//sysnb pipe2(p *[2]_C_int, flags int) (err error)
|
||||
|
||||
func Pipe2(p []int, flags int) (err 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
|
||||
}
|
||||
|
||||
func (r *PtraceRegs) PC() uint64 { return r.Pc }
|
||||
|
||||
func (r *PtraceRegs) SetPC(pc uint64) { r.Pc = pc }
|
||||
|
||||
func (iov *Iovec) SetLen(length int) {
|
||||
iov.Len = uint64(length)
|
||||
}
|
||||
|
||||
func (msghdr *Msghdr) SetControllen(length int) {
|
||||
msghdr.Controllen = uint64(length)
|
||||
}
|
||||
|
||||
func (cmsg *Cmsghdr) SetLen(length int) {
|
||||
cmsg.Len = uint64(length)
|
||||
}
|
||||
|
||||
func InotifyInit() (fd int, err error) {
|
||||
return InotifyInit1(0)
|
||||
}
|
||||
|
||||
func Dup2(oldfd int, newfd int) (err error) {
|
||||
return Dup3(oldfd, newfd, 0)
|
||||
}
|
||||
|
||||
func Pause() error {
|
||||
_, err := ppoll(nil, 0, nil, nil)
|
||||
return err
|
||||
}
|
||||
|
||||
func Poll(fds []PollFd, timeout int) (n int, err error) {
|
||||
var ts *Timespec
|
||||
if timeout >= 0 {
|
||||
ts = new(Timespec)
|
||||
*ts = NsecToTimespec(int64(timeout) * 1e6)
|
||||
}
|
||||
if len(fds) == 0 {
|
||||
return ppoll(nil, 0, ts, nil)
|
||||
}
|
||||
return ppoll(&fds[0], len(fds), ts, nil)
|
||||
}
|
||||
|
||||
func Renameat(olddirfd int, oldpath string, newdirfd int, newpath string) (err error) {
|
||||
return Renameat2(olddirfd, oldpath, newdirfd, newpath, 0)
|
||||
}
|
19
vendor/golang.org/x/sys/unix/syscall_linux_s390x.go
generated
vendored
19
vendor/golang.org/x/sys/unix/syscall_linux_s390x.go
generated
vendored
@ -11,10 +11,12 @@ import (
|
||||
)
|
||||
|
||||
//sys Dup2(oldfd int, newfd int) (err error)
|
||||
//sysnb EpollCreate(size int) (fd int, err error)
|
||||
//sys EpollWait(epfd int, events []EpollEvent, msec int) (n int, err error)
|
||||
//sys Fadvise(fd int, offset int64, length int64, advice int) (err error) = SYS_FADVISE64
|
||||
//sys Fchown(fd int, uid int, gid int) (err error)
|
||||
//sys Fstat(fd int, stat *Stat_t) (err error)
|
||||
//sys Fstatat(dirfd int, path string, stat *Stat_t, flags int) (err error) = SYS_NEWFSTATAT
|
||||
//sys Fstatfs(fd int, buf *Statfs_t) (err error)
|
||||
//sys Ftruncate(fd int, length int64) (err error)
|
||||
//sysnb Getegid() (egid int)
|
||||
@ -28,6 +30,7 @@ import (
|
||||
//sys Pause() (err error)
|
||||
//sys Pread(fd int, p []byte, offset int64) (n int, err error) = SYS_PREAD64
|
||||
//sys Pwrite(fd int, p []byte, offset int64) (n int, err error) = SYS_PWRITE64
|
||||
//sys Renameat(olddirfd int, oldpath string, newdirfd int, newpath string) (err error)
|
||||
//sys Seek(fd int, offset int64, whence int) (off int64, err error) = SYS_LSEEK
|
||||
//sys Select(nfd int, r *FdSet, w *FdSet, e *FdSet, timeout *Timeval) (n int, err error)
|
||||
//sys sendfile(outfd int, infd int, offset *int64, count int) (written int, err error)
|
||||
@ -43,9 +46,11 @@ import (
|
||||
//sys Statfs(path string, buf *Statfs_t) (err error)
|
||||
//sys SyncFileRange(fd int, off int64, n int64, flags int) (err error)
|
||||
//sys Truncate(path string, length int64) (err error)
|
||||
//sys Ustat(dev int, ubuf *Ustat_t) (err error)
|
||||
//sysnb getgroups(n int, list *_Gid_t) (nn int, err error)
|
||||
//sysnb setgroups(n int, list *_Gid_t) (err error)
|
||||
|
||||
//sys futimesat(dirfd int, path string, times *[2]Timeval) (err error)
|
||||
//sysnb Gettimeofday(tv *Timeval) (err error)
|
||||
|
||||
func Time(t *Time_t) (tt Time_t, err error) {
|
||||
@ -61,6 +66,7 @@ func Time(t *Time_t) (tt Time_t, err error) {
|
||||
}
|
||||
|
||||
//sys Utime(path string, buf *Utimbuf) (err error)
|
||||
//sys utimes(path string, times *[2]Timeval) (err error)
|
||||
|
||||
func setTimespec(sec, nsec int64) Timespec {
|
||||
return Timespec{Sec: sec, Nsec: nsec}
|
||||
@ -317,3 +323,16 @@ func Poll(fds []PollFd, timeout int) (n int, err error) {
|
||||
}
|
||||
return poll(&fds[0], len(fds), timeout)
|
||||
}
|
||||
|
||||
//sys kexecFileLoad(kernelFd int, initrdFd int, cmdlineLen int, cmdline string, flags int) (err error)
|
||||
|
||||
func KexecFileLoad(kernelFd int, initrdFd int, cmdline string, flags int) error {
|
||||
cmdlineLen := len(cmdline)
|
||||
if cmdlineLen > 0 {
|
||||
// Account for the additional NULL byte added by
|
||||
// BytePtrFromString in kexecFileLoad. The kexec_file_load
|
||||
// syscall expects a NULL-terminated string.
|
||||
cmdlineLen++
|
||||
}
|
||||
return kexecFileLoad(kernelFd, initrdFd, cmdlineLen, cmdline, flags)
|
||||
}
|
||||
|
5
vendor/golang.org/x/sys/unix/syscall_linux_sparc64.go
generated
vendored
5
vendor/golang.org/x/sys/unix/syscall_linux_sparc64.go
generated
vendored
@ -7,9 +7,11 @@
|
||||
package unix
|
||||
|
||||
//sys EpollWait(epfd int, events []EpollEvent, msec int) (n int, err error)
|
||||
//sys Fadvise(fd int, offset int64, length int64, advice int) (err error) = SYS_FADVISE64
|
||||
//sys Dup2(oldfd int, newfd int) (err error)
|
||||
//sys Fchown(fd int, uid int, gid int) (err error)
|
||||
//sys Fstat(fd int, stat *Stat_t) (err error)
|
||||
//sys Fstatat(dirfd int, path string, stat *Stat_t, flags int) (err error) = SYS_FSTATAT64
|
||||
//sys Fstatfs(fd int, buf *Statfs_t) (err error)
|
||||
//sys Ftruncate(fd int, length int64) (err error)
|
||||
//sysnb Getegid() (egid int)
|
||||
@ -24,6 +26,7 @@ package unix
|
||||
//sys Pause() (err error)
|
||||
//sys Pread(fd int, p []byte, offset int64) (n int, err error) = SYS_PREAD64
|
||||
//sys Pwrite(fd int, p []byte, offset int64) (n int, err error) = SYS_PWRITE64
|
||||
//sys Renameat(olddirfd int, oldpath string, newdirfd int, newpath string) (err error)
|
||||
//sys Seek(fd int, offset int64, whence int) (off int64, err error) = SYS_LSEEK
|
||||
//sys Select(nfd int, r *FdSet, w *FdSet, e *FdSet, timeout *Timeval) (n int, err error)
|
||||
//sys sendfile(outfd int, infd int, offset *int64, count int) (written int, err error)
|
||||
@ -66,6 +69,7 @@ func Iopl(level int) (err error) {
|
||||
return ENOSYS
|
||||
}
|
||||
|
||||
//sys futimesat(dirfd int, path string, times *[2]Timeval) (err error)
|
||||
//sysnb Gettimeofday(tv *Timeval) (err error)
|
||||
|
||||
func Time(t *Time_t) (tt Time_t, err error) {
|
||||
@ -81,6 +85,7 @@ func Time(t *Time_t) (tt Time_t, err error) {
|
||||
}
|
||||
|
||||
//sys Utime(path string, buf *Utimbuf) (err error)
|
||||
//sys utimes(path string, times *[2]Timeval) (err error)
|
||||
|
||||
func setTimespec(sec, nsec int64) Timespec {
|
||||
return Timespec{Sec: sec, Nsec: nsec}
|
||||
|
133
vendor/golang.org/x/sys/unix/syscall_netbsd.go
generated
vendored
133
vendor/golang.org/x/sys/unix/syscall_netbsd.go
generated
vendored
@ -13,10 +13,12 @@
|
||||
package unix
|
||||
|
||||
import (
|
||||
"runtime"
|
||||
"syscall"
|
||||
"unsafe"
|
||||
)
|
||||
|
||||
// SockaddrDatalink implements the Sockaddr interface for AF_LINK type sockets.
|
||||
type SockaddrDatalink struct {
|
||||
Len uint8
|
||||
Family uint8
|
||||
@ -92,16 +94,21 @@ func nametomib(name string) (mib []_C_int, err error) {
|
||||
return mib, nil
|
||||
}
|
||||
|
||||
func direntIno(buf []byte) (uint64, bool) {
|
||||
return readInt(buf, unsafe.Offsetof(Dirent{}.Fileno), unsafe.Sizeof(Dirent{}.Fileno))
|
||||
}
|
||||
func SysctlClockinfo(name string) (*Clockinfo, error) {
|
||||
mib, err := sysctlmib(name)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
func direntReclen(buf []byte) (uint64, bool) {
|
||||
return readInt(buf, unsafe.Offsetof(Dirent{}.Reclen), unsafe.Sizeof(Dirent{}.Reclen))
|
||||
}
|
||||
|
||||
func direntNamlen(buf []byte) (uint64, bool) {
|
||||
return readInt(buf, unsafe.Offsetof(Dirent{}.Namlen), unsafe.Sizeof(Dirent{}.Namlen))
|
||||
n := uintptr(SizeofClockinfo)
|
||||
var ci Clockinfo
|
||||
if err := sysctl(mib, (*byte)(unsafe.Pointer(&ci)), &n, nil, 0); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if n != SizeofClockinfo {
|
||||
return nil, EIO
|
||||
}
|
||||
return &ci, nil
|
||||
}
|
||||
|
||||
//sysnb pipe() (fd1 int, fd2 int, err error)
|
||||
@ -118,6 +125,23 @@ func Getdirentries(fd int, buf []byte, basep *uintptr) (n int, err error) {
|
||||
return getdents(fd, buf)
|
||||
}
|
||||
|
||||
const ImplementsGetwd = true
|
||||
|
||||
//sys Getcwd(buf []byte) (n int, err error) = SYS___GETCWD
|
||||
|
||||
func Getwd() (string, error) {
|
||||
var buf [PathMax]byte
|
||||
_, err := Getcwd(buf[0:])
|
||||
if err != nil {
|
||||
return "", err
|
||||
}
|
||||
n := clen(buf[:])
|
||||
if n < 1 {
|
||||
return "", EINVAL
|
||||
}
|
||||
return string(buf[:n]), nil
|
||||
}
|
||||
|
||||
// TODO
|
||||
func sendfile(outfd int, infd int, offset *int64, count int) (written int, err error) {
|
||||
return -1, ENOSYS
|
||||
@ -139,11 +163,11 @@ func IoctlSetInt(fd int, req uint, value int) error {
|
||||
return ioctl(fd, req, uintptr(value))
|
||||
}
|
||||
|
||||
func IoctlSetWinsize(fd int, req uint, value *Winsize) error {
|
||||
func ioctlSetWinsize(fd int, req uint, value *Winsize) error {
|
||||
return ioctl(fd, req, uintptr(unsafe.Pointer(value)))
|
||||
}
|
||||
|
||||
func IoctlSetTermios(fd int, req uint, value *Termios) error {
|
||||
func ioctlSetTermios(fd int, req uint, value *Termios) error {
|
||||
return ioctl(fd, req, uintptr(unsafe.Pointer(value)))
|
||||
}
|
||||
|
||||
@ -167,6 +191,66 @@ func IoctlGetTermios(fd int, req uint) (*Termios, error) {
|
||||
return &value, err
|
||||
}
|
||||
|
||||
func IoctlGetPtmget(fd int, req uint) (*Ptmget, error) {
|
||||
var value Ptmget
|
||||
err := ioctl(fd, req, uintptr(unsafe.Pointer(&value)))
|
||||
runtime.KeepAlive(value)
|
||||
return &value, err
|
||||
}
|
||||
|
||||
func Uname(uname *Utsname) error {
|
||||
mib := []_C_int{CTL_KERN, KERN_OSTYPE}
|
||||
n := unsafe.Sizeof(uname.Sysname)
|
||||
if err := sysctl(mib, &uname.Sysname[0], &n, nil, 0); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
mib = []_C_int{CTL_KERN, KERN_HOSTNAME}
|
||||
n = unsafe.Sizeof(uname.Nodename)
|
||||
if err := sysctl(mib, &uname.Nodename[0], &n, nil, 0); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
mib = []_C_int{CTL_KERN, KERN_OSRELEASE}
|
||||
n = unsafe.Sizeof(uname.Release)
|
||||
if err := sysctl(mib, &uname.Release[0], &n, nil, 0); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
mib = []_C_int{CTL_KERN, KERN_VERSION}
|
||||
n = unsafe.Sizeof(uname.Version)
|
||||
if err := sysctl(mib, &uname.Version[0], &n, nil, 0); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
// The version might have newlines or tabs in it, convert them to
|
||||
// spaces.
|
||||
for i, b := range uname.Version {
|
||||
if b == '\n' || b == '\t' {
|
||||
if i == len(uname.Version)-1 {
|
||||
uname.Version[i] = 0
|
||||
} else {
|
||||
uname.Version[i] = ' '
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
mib = []_C_int{CTL_HW, HW_MACHINE}
|
||||
n = unsafe.Sizeof(uname.Machine)
|
||||
if err := sysctl(mib, &uname.Machine[0], &n, nil, 0); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
func Sendfile(outfd int, infd int, offset *int64, count int) (written int, err error) {
|
||||
if raceenabled {
|
||||
raceReleaseMerge(unsafe.Pointer(&ioSync))
|
||||
}
|
||||
return sendfile(outfd, infd, offset, count)
|
||||
}
|
||||
|
||||
/*
|
||||
* Exposed directly
|
||||
*/
|
||||
@ -181,13 +265,30 @@ func IoctlGetTermios(fd int, req uint) (*Termios, error) {
|
||||
//sys Dup(fd int) (nfd int, err error)
|
||||
//sys Dup2(from int, to int) (err error)
|
||||
//sys Exit(code int)
|
||||
//sys ExtattrGetFd(fd int, attrnamespace int, attrname string, data uintptr, nbytes int) (ret int, err error)
|
||||
//sys ExtattrSetFd(fd int, attrnamespace int, attrname string, data uintptr, nbytes int) (ret int, err error)
|
||||
//sys ExtattrDeleteFd(fd int, attrnamespace int, attrname string) (err error)
|
||||
//sys ExtattrListFd(fd int, attrnamespace int, data uintptr, nbytes int) (ret int, err error)
|
||||
//sys ExtattrGetFile(file string, attrnamespace int, attrname string, data uintptr, nbytes int) (ret int, err error)
|
||||
//sys ExtattrSetFile(file string, attrnamespace int, attrname string, data uintptr, nbytes int) (ret int, err error)
|
||||
//sys ExtattrDeleteFile(file string, attrnamespace int, attrname string) (err error)
|
||||
//sys ExtattrListFile(file string, attrnamespace int, data uintptr, nbytes int) (ret int, err error)
|
||||
//sys ExtattrGetLink(link string, attrnamespace int, attrname string, data uintptr, nbytes int) (ret int, err error)
|
||||
//sys ExtattrSetLink(link string, attrnamespace int, attrname string, data uintptr, nbytes int) (ret int, err error)
|
||||
//sys ExtattrDeleteLink(link string, attrnamespace int, attrname string) (err error)
|
||||
//sys ExtattrListLink(link string, attrnamespace int, data uintptr, nbytes int) (ret int, err error)
|
||||
//sys Faccessat(dirfd int, path string, mode uint32, flags int) (err error)
|
||||
//sys Fadvise(fd int, offset int64, length int64, advice int) (err error) = SYS_POSIX_FADVISE
|
||||
//sys Fchdir(fd int) (err error)
|
||||
//sys Fchflags(fd int, flags int) (err error)
|
||||
//sys Fchmod(fd int, mode uint32) (err error)
|
||||
//sys Fchmodat(dirfd int, path string, mode uint32, flags int) (err error)
|
||||
//sys Fchown(fd int, uid int, gid int) (err error)
|
||||
//sys Fchownat(dirfd int, path string, uid int, gid int, flags int) (err error)
|
||||
//sys Flock(fd int, how int) (err error)
|
||||
//sys Fpathconf(fd int, name int) (val int, err error)
|
||||
//sys Fstat(fd int, stat *Stat_t) (err error)
|
||||
//sys Fstatat(fd int, path string, stat *Stat_t, flags int) (err error)
|
||||
//sys Fsync(fd int) (err error)
|
||||
//sys Ftruncate(fd int, length int64) (err error)
|
||||
//sysnb Getegid() (egid int)
|
||||
@ -208,19 +309,26 @@ func IoctlGetTermios(fd int, req uint) (*Termios, error) {
|
||||
//sys Kqueue() (fd int, err error)
|
||||
//sys Lchown(path string, uid int, gid int) (err error)
|
||||
//sys Link(path string, link string) (err error)
|
||||
//sys Linkat(pathfd int, path string, linkfd int, link string, flags int) (err error)
|
||||
//sys Listen(s int, backlog int) (err error)
|
||||
//sys Lstat(path string, stat *Stat_t) (err error)
|
||||
//sys Mkdir(path string, mode uint32) (err error)
|
||||
//sys Mkdirat(dirfd int, path string, mode uint32) (err error)
|
||||
//sys Mkfifo(path string, mode uint32) (err error)
|
||||
//sys Mkfifoat(dirfd int, path string, mode uint32) (err error)
|
||||
//sys Mknod(path string, mode uint32, dev int) (err error)
|
||||
//sys Mknodat(dirfd int, path string, mode uint32, dev int) (err error)
|
||||
//sys Nanosleep(time *Timespec, leftover *Timespec) (err error)
|
||||
//sys Open(path string, mode int, perm uint32) (fd int, err error)
|
||||
//sys Openat(dirfd int, path string, mode int, perm uint32) (fd int, err error)
|
||||
//sys Pathconf(path string, name int) (val int, err error)
|
||||
//sys Pread(fd int, p []byte, offset int64) (n int, err error)
|
||||
//sys Pwrite(fd int, p []byte, offset int64) (n int, err error)
|
||||
//sys read(fd int, p []byte) (n int, err error)
|
||||
//sys Readlink(path string, buf []byte) (n int, err error)
|
||||
//sys Readlinkat(dirfd int, path string, buf []byte) (n int, err error)
|
||||
//sys Rename(from string, to string) (err error)
|
||||
//sys Renameat(fromfd int, from string, tofd int, to string) (err error)
|
||||
//sys Revoke(path string) (err error)
|
||||
//sys Rmdir(path string) (err error)
|
||||
//sys Seek(fd int, offset int64, whence int) (newoffset int64, err error) = SYS_LSEEK
|
||||
@ -238,10 +346,12 @@ func IoctlGetTermios(fd int, req uint) (*Termios, error) {
|
||||
//sysnb Setuid(uid int) (err error)
|
||||
//sys Stat(path string, stat *Stat_t) (err error)
|
||||
//sys Symlink(path string, link string) (err error)
|
||||
//sys Symlinkat(oldpath string, newdirfd int, newpath string) (err error)
|
||||
//sys Sync() (err error)
|
||||
//sys Truncate(path string, length int64) (err error)
|
||||
//sys Umask(newmask int) (oldmask int)
|
||||
//sys Unlink(path string) (err error)
|
||||
//sys Unlinkat(dirfd int, path string, flags int) (err error)
|
||||
//sys Unmount(path string, flags int) (err error)
|
||||
//sys write(fd int, p []byte) (n int, err error)
|
||||
//sys mmap(addr uintptr, length uintptr, prot int, flag int, fd int, pos int64) (ret uintptr, err error)
|
||||
@ -268,7 +378,6 @@ func IoctlGetTermios(fd int, req uint) (*Termios, error) {
|
||||
// __msync13
|
||||
// __ntp_gettime30
|
||||
// __posix_chown
|
||||
// __posix_fadvise50
|
||||
// __posix_fchown
|
||||
// __posix_lchown
|
||||
// __posix_rename
|
||||
|
33
vendor/golang.org/x/sys/unix/syscall_netbsd_arm64.go
generated
vendored
Normal file
33
vendor/golang.org/x/sys/unix/syscall_netbsd_arm64.go
generated
vendored
Normal file
@ -0,0 +1,33 @@
|
||||
// Copyright 2019 The Go Authors. All rights reserved.
|
||||
// Use of this source code is governed by a BSD-style
|
||||
// license that can be found in the LICENSE file.
|
||||
|
||||
// +build arm64,netbsd
|
||||
|
||||
package unix
|
||||
|
||||
func setTimespec(sec, nsec int64) Timespec {
|
||||
return Timespec{Sec: sec, Nsec: nsec}
|
||||
}
|
||||
|
||||
func setTimeval(sec, usec int64) Timeval {
|
||||
return Timeval{Sec: sec, Usec: int32(usec)}
|
||||
}
|
||||
|
||||
func SetKevent(k *Kevent_t, fd, mode, flags int) {
|
||||
k.Ident = uint64(fd)
|
||||
k.Filter = uint32(mode)
|
||||
k.Flags = uint32(flags)
|
||||
}
|
||||
|
||||
func (iov *Iovec) SetLen(length int) {
|
||||
iov.Len = uint64(length)
|
||||
}
|
||||
|
||||
func (msghdr *Msghdr) SetControllen(length int) {
|
||||
msghdr.Controllen = uint32(length)
|
||||
}
|
||||
|
||||
func (cmsg *Cmsghdr) SetLen(length int) {
|
||||
cmsg.Len = uint32(length)
|
||||
}
|
11
vendor/golang.org/x/sys/unix/syscall_no_getwd.go
generated
vendored
11
vendor/golang.org/x/sys/unix/syscall_no_getwd.go
generated
vendored
@ -1,11 +0,0 @@
|
||||
// Copyright 2013 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 dragonfly freebsd netbsd openbsd
|
||||
|
||||
package unix
|
||||
|
||||
const ImplementsGetwd = false
|
||||
|
||||
func Getwd() (string, error) { return "", ENOTSUP }
|
158
vendor/golang.org/x/sys/unix/syscall_openbsd.go
generated
vendored
158
vendor/golang.org/x/sys/unix/syscall_openbsd.go
generated
vendored
@ -13,10 +13,12 @@
|
||||
package unix
|
||||
|
||||
import (
|
||||
"sort"
|
||||
"syscall"
|
||||
"unsafe"
|
||||
)
|
||||
|
||||
// SockaddrDatalink implements the Sockaddr interface for AF_LINK type sockets.
|
||||
type SockaddrDatalink struct {
|
||||
Len uint8
|
||||
Family uint8
|
||||
@ -32,36 +34,30 @@ type SockaddrDatalink struct {
|
||||
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) {
|
||||
// Perform lookup via a binary search
|
||||
left := 0
|
||||
right := len(sysctlMib) - 1
|
||||
for {
|
||||
idx := left + (right-left)/2
|
||||
switch {
|
||||
case name == sysctlMib[idx].ctlname:
|
||||
return sysctlMib[idx].ctloid, nil
|
||||
case name > sysctlMib[idx].ctlname:
|
||||
left = idx + 1
|
||||
default:
|
||||
right = idx - 1
|
||||
}
|
||||
if left > right {
|
||||
break
|
||||
}
|
||||
i := sort.Search(len(sysctlMib), func(i int) bool {
|
||||
return sysctlMib[i].ctlname >= name
|
||||
})
|
||||
if i < len(sysctlMib) && sysctlMib[i].ctlname == name {
|
||||
return sysctlMib[i].ctloid, nil
|
||||
}
|
||||
return nil, EINVAL
|
||||
}
|
||||
|
||||
func direntIno(buf []byte) (uint64, bool) {
|
||||
return readInt(buf, unsafe.Offsetof(Dirent{}.Fileno), unsafe.Sizeof(Dirent{}.Fileno))
|
||||
}
|
||||
func SysctlUvmexp(name string) (*Uvmexp, error) {
|
||||
mib, err := sysctlmib(name)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
func direntReclen(buf []byte) (uint64, bool) {
|
||||
return readInt(buf, unsafe.Offsetof(Dirent{}.Reclen), unsafe.Sizeof(Dirent{}.Reclen))
|
||||
}
|
||||
|
||||
func direntNamlen(buf []byte) (uint64, bool) {
|
||||
return readInt(buf, unsafe.Offsetof(Dirent{}.Namlen), unsafe.Sizeof(Dirent{}.Namlen))
|
||||
n := uintptr(SizeofUvmexp)
|
||||
var u Uvmexp
|
||||
if err := sysctl(mib, (*byte)(unsafe.Pointer(&u)), &n, nil, 0); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if n != SizeofUvmexp {
|
||||
return nil, EIO
|
||||
}
|
||||
return &u, nil
|
||||
}
|
||||
|
||||
//sysnb pipe(p *[2]_C_int) (err error)
|
||||
@ -81,6 +77,30 @@ func Getdirentries(fd int, buf []byte, basep *uintptr) (n int, err error) {
|
||||
return getdents(fd, buf)
|
||||
}
|
||||
|
||||
const ImplementsGetwd = true
|
||||
|
||||
//sys Getcwd(buf []byte) (n int, err error) = SYS___GETCWD
|
||||
|
||||
func Getwd() (string, error) {
|
||||
var buf [PathMax]byte
|
||||
_, err := Getcwd(buf[0:])
|
||||
if err != nil {
|
||||
return "", err
|
||||
}
|
||||
n := clen(buf[:])
|
||||
if n < 1 {
|
||||
return "", EINVAL
|
||||
}
|
||||
return string(buf[:n]), nil
|
||||
}
|
||||
|
||||
func Sendfile(outfd int, infd int, offset *int64, count int) (written int, err error) {
|
||||
if raceenabled {
|
||||
raceReleaseMerge(unsafe.Pointer(&ioSync))
|
||||
}
|
||||
return sendfile(outfd, infd, offset, count)
|
||||
}
|
||||
|
||||
// TODO
|
||||
func sendfile(outfd int, infd int, offset *int64, count int) (written int, err error) {
|
||||
return -1, ENOSYS
|
||||
@ -117,11 +137,11 @@ func IoctlSetInt(fd int, req uint, value int) error {
|
||||
return ioctl(fd, req, uintptr(value))
|
||||
}
|
||||
|
||||
func IoctlSetWinsize(fd int, req uint, value *Winsize) error {
|
||||
func ioctlSetWinsize(fd int, req uint, value *Winsize) error {
|
||||
return ioctl(fd, req, uintptr(unsafe.Pointer(value)))
|
||||
}
|
||||
|
||||
func IoctlSetTermios(fd int, req uint, value *Termios) error {
|
||||
func ioctlSetTermios(fd int, req uint, value *Termios) error {
|
||||
return ioctl(fd, req, uintptr(unsafe.Pointer(value)))
|
||||
}
|
||||
|
||||
@ -145,6 +165,61 @@ func IoctlGetTermios(fd int, req uint) (*Termios, error) {
|
||||
return &value, err
|
||||
}
|
||||
|
||||
//sys ppoll(fds *PollFd, nfds int, timeout *Timespec, sigmask *Sigset_t) (n int, err error)
|
||||
|
||||
func Ppoll(fds []PollFd, timeout *Timespec, sigmask *Sigset_t) (n int, err error) {
|
||||
if len(fds) == 0 {
|
||||
return ppoll(nil, 0, timeout, sigmask)
|
||||
}
|
||||
return ppoll(&fds[0], len(fds), timeout, sigmask)
|
||||
}
|
||||
|
||||
func Uname(uname *Utsname) error {
|
||||
mib := []_C_int{CTL_KERN, KERN_OSTYPE}
|
||||
n := unsafe.Sizeof(uname.Sysname)
|
||||
if err := sysctl(mib, &uname.Sysname[0], &n, nil, 0); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
mib = []_C_int{CTL_KERN, KERN_HOSTNAME}
|
||||
n = unsafe.Sizeof(uname.Nodename)
|
||||
if err := sysctl(mib, &uname.Nodename[0], &n, nil, 0); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
mib = []_C_int{CTL_KERN, KERN_OSRELEASE}
|
||||
n = unsafe.Sizeof(uname.Release)
|
||||
if err := sysctl(mib, &uname.Release[0], &n, nil, 0); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
mib = []_C_int{CTL_KERN, KERN_VERSION}
|
||||
n = unsafe.Sizeof(uname.Version)
|
||||
if err := sysctl(mib, &uname.Version[0], &n, nil, 0); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
// The version might have newlines or tabs in it, convert them to
|
||||
// spaces.
|
||||
for i, b := range uname.Version {
|
||||
if b == '\n' || b == '\t' {
|
||||
if i == len(uname.Version)-1 {
|
||||
uname.Version[i] = 0
|
||||
} else {
|
||||
uname.Version[i] = ' '
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
mib = []_C_int{CTL_HW, HW_MACHINE}
|
||||
n = unsafe.Sizeof(uname.Machine)
|
||||
if err := sysctl(mib, &uname.Machine[0], &n, nil, 0); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
/*
|
||||
* Exposed directly
|
||||
*/
|
||||
@ -159,13 +234,17 @@ func IoctlGetTermios(fd int, req uint) (*Termios, error) {
|
||||
//sys Dup(fd int) (nfd int, err error)
|
||||
//sys Dup2(from int, to int) (err error)
|
||||
//sys Exit(code int)
|
||||
//sys Faccessat(dirfd int, path string, mode uint32, flags int) (err error)
|
||||
//sys Fchdir(fd int) (err error)
|
||||
//sys Fchflags(fd int, flags int) (err error)
|
||||
//sys Fchmod(fd int, mode uint32) (err error)
|
||||
//sys Fchmodat(dirfd int, path string, mode uint32, flags int) (err error)
|
||||
//sys Fchown(fd int, uid int, gid int) (err error)
|
||||
//sys Fchownat(dirfd int, path string, uid int, gid int, flags int) (err error)
|
||||
//sys Flock(fd int, how int) (err error)
|
||||
//sys Fpathconf(fd int, name int) (val int, err error)
|
||||
//sys Fstat(fd int, stat *Stat_t) (err error)
|
||||
//sys Fstatat(fd int, path string, stat *Stat_t, flags int) (err error)
|
||||
//sys Fstatfs(fd int, stat *Statfs_t) (err error)
|
||||
//sys Fsync(fd int) (err error)
|
||||
//sys Ftruncate(fd int, length int64) (err error)
|
||||
@ -178,6 +257,7 @@ func IoctlGetTermios(fd int, req uint) (*Termios, error) {
|
||||
//sysnb Getppid() (ppid int)
|
||||
//sys Getpriority(which int, who int) (prio int, err error)
|
||||
//sysnb Getrlimit(which int, lim *Rlimit) (err error)
|
||||
//sysnb Getrtable() (rtable int, err error)
|
||||
//sysnb Getrusage(who int, rusage *Rusage) (err error)
|
||||
//sysnb Getsid(pid int) (sid int, err error)
|
||||
//sysnb Gettimeofday(tv *Timeval) (err error)
|
||||
@ -187,19 +267,26 @@ func IoctlGetTermios(fd int, req uint) (*Termios, error) {
|
||||
//sys Kqueue() (fd int, err error)
|
||||
//sys Lchown(path string, uid int, gid int) (err error)
|
||||
//sys Link(path string, link string) (err error)
|
||||
//sys Linkat(pathfd int, path string, linkfd int, link string, flags int) (err error)
|
||||
//sys Listen(s int, backlog int) (err error)
|
||||
//sys Lstat(path string, stat *Stat_t) (err error)
|
||||
//sys Mkdir(path string, mode uint32) (err error)
|
||||
//sys Mkdirat(dirfd int, path string, mode uint32) (err error)
|
||||
//sys Mkfifo(path string, mode uint32) (err error)
|
||||
//sys Mkfifoat(dirfd int, path string, mode uint32) (err error)
|
||||
//sys Mknod(path string, mode uint32, dev int) (err error)
|
||||
//sys Mknodat(dirfd int, path string, mode uint32, dev int) (err error)
|
||||
//sys Nanosleep(time *Timespec, leftover *Timespec) (err error)
|
||||
//sys Open(path string, mode int, perm uint32) (fd int, err error)
|
||||
//sys Openat(dirfd int, path string, mode int, perm uint32) (fd int, err error)
|
||||
//sys Pathconf(path string, name int) (val int, err error)
|
||||
//sys Pread(fd int, p []byte, offset int64) (n int, err error)
|
||||
//sys Pwrite(fd int, p []byte, offset int64) (n int, err error)
|
||||
//sys read(fd int, p []byte) (n int, err error)
|
||||
//sys Readlink(path string, buf []byte) (n int, err error)
|
||||
//sys Readlinkat(dirfd int, path string, buf []byte) (n int, err error)
|
||||
//sys Rename(from string, to string) (err error)
|
||||
//sys Renameat(fromfd int, from string, tofd int, to string) (err error)
|
||||
//sys Revoke(path string) (err error)
|
||||
//sys Rmdir(path string) (err error)
|
||||
//sys Seek(fd int, offset int64, whence int) (newoffset int64, err error) = SYS_LSEEK
|
||||
@ -215,16 +302,19 @@ func IoctlGetTermios(fd int, req uint) (*Termios, error) {
|
||||
//sysnb Setresgid(rgid int, egid int, sgid int) (err error)
|
||||
//sysnb Setresuid(ruid int, euid int, suid int) (err error)
|
||||
//sysnb Setrlimit(which int, lim *Rlimit) (err error)
|
||||
//sysnb Setrtable(rtable int) (err error)
|
||||
//sysnb Setsid() (pid int, err error)
|
||||
//sysnb Settimeofday(tp *Timeval) (err error)
|
||||
//sysnb Setuid(uid int) (err error)
|
||||
//sys Stat(path string, stat *Stat_t) (err error)
|
||||
//sys Statfs(path string, stat *Statfs_t) (err error)
|
||||
//sys Symlink(path string, link string) (err error)
|
||||
//sys Symlinkat(oldpath string, newdirfd int, newpath string) (err error)
|
||||
//sys Sync() (err error)
|
||||
//sys Truncate(path string, length int64) (err error)
|
||||
//sys Umask(newmask int) (oldmask int)
|
||||
//sys Unlink(path string) (err error)
|
||||
//sys Unlinkat(dirfd int, path string, flags int) (err error)
|
||||
//sys Unmount(path string, flags int) (err error)
|
||||
//sys write(fd int, p []byte) (n int, err error)
|
||||
//sys mmap(addr uintptr, length uintptr, prot int, flag int, fd int, pos int64) (ret uintptr, err error)
|
||||
@ -247,15 +337,11 @@ func IoctlGetTermios(fd int, req uint) (*Termios, error) {
|
||||
// clock_settime
|
||||
// closefrom
|
||||
// execve
|
||||
// faccessat
|
||||
// fchmodat
|
||||
// fchownat
|
||||
// fcntl
|
||||
// fhopen
|
||||
// fhstat
|
||||
// fhstatfs
|
||||
// fork
|
||||
// fstatat
|
||||
// futimens
|
||||
// getfh
|
||||
// getgid
|
||||
@ -263,19 +349,14 @@ func IoctlGetTermios(fd int, req uint) (*Termios, error) {
|
||||
// getlogin
|
||||
// getresgid
|
||||
// getresuid
|
||||
// getrtable
|
||||
// getthrid
|
||||
// ktrace
|
||||
// lfs_bmapv
|
||||
// lfs_markv
|
||||
// lfs_segclean
|
||||
// lfs_segwait
|
||||
// linkat
|
||||
// mincore
|
||||
// minherit
|
||||
// mkdirat
|
||||
// mkfifoat
|
||||
// mknodat
|
||||
// mount
|
||||
// mquery
|
||||
// msgctl
|
||||
@ -284,12 +365,10 @@ func IoctlGetTermios(fd int, req uint) (*Termios, error) {
|
||||
// msgsnd
|
||||
// nfssvc
|
||||
// nnpfspioctl
|
||||
// openat
|
||||
// preadv
|
||||
// profil
|
||||
// pwritev
|
||||
// quotactl
|
||||
// readlinkat
|
||||
// readv
|
||||
// reboot
|
||||
// renameat
|
||||
@ -299,7 +378,6 @@ func IoctlGetTermios(fd int, req uint) (*Termios, error) {
|
||||
// semop
|
||||
// setgroups
|
||||
// setitimer
|
||||
// setrtable
|
||||
// setsockopt
|
||||
// shmat
|
||||
// shmctl
|
||||
@ -311,13 +389,11 @@ func IoctlGetTermios(fd int, req uint) (*Termios, error) {
|
||||
// sigprocmask
|
||||
// sigreturn
|
||||
// sigsuspend
|
||||
// symlinkat
|
||||
// sysarch
|
||||
// syscall
|
||||
// threxit
|
||||
// thrsigdivert
|
||||
// thrsleep
|
||||
// thrwakeup
|
||||
// unlinkat
|
||||
// vfork
|
||||
// writev
|
||||
|
4
vendor/golang.org/x/sys/unix/syscall_openbsd_386.go
generated
vendored
4
vendor/golang.org/x/sys/unix/syscall_openbsd_386.go
generated
vendored
@ -31,3 +31,7 @@ func (msghdr *Msghdr) SetControllen(length int) {
|
||||
func (cmsg *Cmsghdr) SetLen(length int) {
|
||||
cmsg.Len = uint32(length)
|
||||
}
|
||||
|
||||
// SYS___SYSCTL is used by syscall_bsd.go for all BSDs, but in modern versions
|
||||
// of openbsd/386 the syscall is called sysctl instead of __sysctl.
|
||||
const SYS___SYSCTL = SYS_SYSCTL
|
||||
|
4
vendor/golang.org/x/sys/unix/syscall_openbsd_amd64.go
generated
vendored
4
vendor/golang.org/x/sys/unix/syscall_openbsd_amd64.go
generated
vendored
@ -31,3 +31,7 @@ func (msghdr *Msghdr) SetControllen(length int) {
|
||||
func (cmsg *Cmsghdr) SetLen(length int) {
|
||||
cmsg.Len = uint32(length)
|
||||
}
|
||||
|
||||
// SYS___SYSCTL is used by syscall_bsd.go for all BSDs, but in modern versions
|
||||
// of openbsd/amd64 the syscall is called sysctl instead of __sysctl.
|
||||
const SYS___SYSCTL = SYS_SYSCTL
|
||||
|
4
vendor/golang.org/x/sys/unix/syscall_openbsd_arm.go
generated
vendored
4
vendor/golang.org/x/sys/unix/syscall_openbsd_arm.go
generated
vendored
@ -31,3 +31,7 @@ func (msghdr *Msghdr) SetControllen(length int) {
|
||||
func (cmsg *Cmsghdr) SetLen(length int) {
|
||||
cmsg.Len = uint32(length)
|
||||
}
|
||||
|
||||
// SYS___SYSCTL is used by syscall_bsd.go for all BSDs, but in modern versions
|
||||
// of openbsd/arm the syscall is called sysctl instead of __sysctl.
|
||||
const SYS___SYSCTL = SYS_SYSCTL
|
||||
|
73
vendor/golang.org/x/sys/unix/syscall_solaris.go
generated
vendored
73
vendor/golang.org/x/sys/unix/syscall_solaris.go
generated
vendored
@ -23,6 +23,7 @@ type syscallFunc uintptr
|
||||
func rawSysvicall6(trap, nargs, a1, a2, a3, a4, a5, a6 uintptr) (r1, r2 uintptr, err syscall.Errno)
|
||||
func sysvicall6(trap, nargs, a1, a2, a3, a4, a5, a6 uintptr) (r1, r2 uintptr, err syscall.Errno)
|
||||
|
||||
// SockaddrDatalink implements the Sockaddr interface for AF_LINK type sockets.
|
||||
type SockaddrDatalink struct {
|
||||
Family uint16
|
||||
Index uint16
|
||||
@ -34,31 +35,6 @@ type SockaddrDatalink struct {
|
||||
raw RawSockaddrDatalink
|
||||
}
|
||||
|
||||
func clen(n []byte) int {
|
||||
for i := 0; i < len(n); i++ {
|
||||
if n[i] == 0 {
|
||||
return i
|
||||
}
|
||||
}
|
||||
return len(n)
|
||||
}
|
||||
|
||||
func direntIno(buf []byte) (uint64, bool) {
|
||||
return readInt(buf, unsafe.Offsetof(Dirent{}.Ino), unsafe.Sizeof(Dirent{}.Ino))
|
||||
}
|
||||
|
||||
func direntReclen(buf []byte) (uint64, bool) {
|
||||
return readInt(buf, unsafe.Offsetof(Dirent{}.Reclen), unsafe.Sizeof(Dirent{}.Reclen))
|
||||
}
|
||||
|
||||
func direntNamlen(buf []byte) (uint64, bool) {
|
||||
reclen, ok := direntReclen(buf)
|
||||
if !ok {
|
||||
return 0, false
|
||||
}
|
||||
return reclen - uint64(unsafe.Offsetof(Dirent{}.Name)), true
|
||||
}
|
||||
|
||||
//sysnb pipe(p *[2]_C_int) (n int, err error)
|
||||
|
||||
func Pipe(p []int) (err error) {
|
||||
@ -136,7 +112,19 @@ func Getsockname(fd int) (sa Sockaddr, err error) {
|
||||
if err = getsockname(fd, &rsa, &len); err != nil {
|
||||
return
|
||||
}
|
||||
return anyToSockaddr(&rsa)
|
||||
return anyToSockaddr(fd, &rsa)
|
||||
}
|
||||
|
||||
// GetsockoptString returns the string value of the socket option opt for the
|
||||
// socket associated with fd at the given socket level.
|
||||
func GetsockoptString(fd, level, opt int) (string, error) {
|
||||
buf := make([]byte, 256)
|
||||
vallen := _Socklen(len(buf))
|
||||
err := getsockopt(fd, level, opt, unsafe.Pointer(&buf[0]), &vallen)
|
||||
if err != nil {
|
||||
return "", err
|
||||
}
|
||||
return string(buf[:vallen-1]), nil
|
||||
}
|
||||
|
||||
const ImplementsGetwd = true
|
||||
@ -324,6 +312,16 @@ func UtimesNanoAt(dirfd int, path string, ts []Timespec, flags int) error {
|
||||
|
||||
//sys fcntl(fd int, cmd int, arg int) (val int, err error)
|
||||
|
||||
// FcntlInt performs a fcntl syscall on fd with the provided command and argument.
|
||||
func FcntlInt(fd uintptr, cmd, arg int) (int, error) {
|
||||
valptr, _, errno := sysvicall6(uintptr(unsafe.Pointer(&procfcntl)), 3, uintptr(fd), uintptr(cmd), uintptr(arg), 0, 0, 0)
|
||||
var err error
|
||||
if errno != 0 {
|
||||
err = errno
|
||||
}
|
||||
return int(valptr), err
|
||||
}
|
||||
|
||||
// FcntlFlock performs a fcntl syscall for the F_GETLK, F_SETLK or F_SETLKW command.
|
||||
func FcntlFlock(fd uintptr, cmd int, lk *Flock_t) error {
|
||||
_, _, e1 := sysvicall6(uintptr(unsafe.Pointer(&procfcntl)), 3, uintptr(fd), uintptr(cmd), uintptr(unsafe.Pointer(lk)), 0, 0, 0)
|
||||
@ -362,7 +360,7 @@ func Futimes(fd int, tv []Timeval) error {
|
||||
return futimesat(fd, nil, (*[2]Timeval)(unsafe.Pointer(&tv[0])))
|
||||
}
|
||||
|
||||
func anyToSockaddr(rsa *RawSockaddrAny) (Sockaddr, error) {
|
||||
func anyToSockaddr(fd int, rsa *RawSockaddrAny) (Sockaddr, error) {
|
||||
switch rsa.Addr.Family {
|
||||
case AF_UNIX:
|
||||
pp := (*RawSockaddrUnix)(unsafe.Pointer(rsa))
|
||||
@ -413,7 +411,7 @@ func Accept(fd int) (nfd int, sa Sockaddr, err error) {
|
||||
if nfd == -1 {
|
||||
return
|
||||
}
|
||||
sa, err = anyToSockaddr(&rsa)
|
||||
sa, err = anyToSockaddr(fd, &rsa)
|
||||
if err != nil {
|
||||
Close(nfd)
|
||||
nfd = 0
|
||||
@ -450,7 +448,7 @@ func Recvmsg(fd int, p, oob []byte, flags int) (n, oobn int, recvflags int, from
|
||||
oobn = int(msg.Accrightslen)
|
||||
// source address is only specified if the socket is unconnected
|
||||
if rsa.Addr.Family != AF_UNSPEC {
|
||||
from, err = anyToSockaddr(&rsa)
|
||||
from, err = anyToSockaddr(fd, &rsa)
|
||||
}
|
||||
return
|
||||
}
|
||||
@ -542,11 +540,11 @@ func IoctlSetInt(fd int, req uint, value int) (err error) {
|
||||
return ioctl(fd, req, uintptr(value))
|
||||
}
|
||||
|
||||
func IoctlSetWinsize(fd int, req uint, value *Winsize) (err error) {
|
||||
func ioctlSetWinsize(fd int, req uint, value *Winsize) (err error) {
|
||||
return ioctl(fd, req, uintptr(unsafe.Pointer(value)))
|
||||
}
|
||||
|
||||
func IoctlSetTermios(fd int, req uint, value *Termios) (err error) {
|
||||
func ioctlSetTermios(fd int, req uint, value *Termios) (err error) {
|
||||
return ioctl(fd, req, uintptr(unsafe.Pointer(value)))
|
||||
}
|
||||
|
||||
@ -587,6 +585,13 @@ func Poll(fds []PollFd, timeout int) (n int, err error) {
|
||||
return poll(&fds[0], len(fds), timeout)
|
||||
}
|
||||
|
||||
func Sendfile(outfd int, infd int, offset *int64, count int) (written int, err error) {
|
||||
if raceenabled {
|
||||
raceReleaseMerge(unsafe.Pointer(&ioSync))
|
||||
}
|
||||
return sendfile(outfd, infd, offset, count)
|
||||
}
|
||||
|
||||
/*
|
||||
* Exposed directly
|
||||
*/
|
||||
@ -601,15 +606,17 @@ func Poll(fds []PollFd, timeout int) (n int, err error) {
|
||||
//sys Dup(fd int) (nfd int, err error)
|
||||
//sys Dup2(oldfd int, newfd int) (err error)
|
||||
//sys Exit(code int)
|
||||
//sys Faccessat(dirfd int, path string, mode uint32, flags int) (err error)
|
||||
//sys Fchdir(fd int) (err error)
|
||||
//sys Fchmod(fd int, mode uint32) (err error)
|
||||
//sys Fchmodat(dirfd int, path string, mode uint32, flags int) (err error)
|
||||
//sys Fchown(fd int, uid int, gid int) (err error)
|
||||
//sys Fchownat(dirfd int, path string, uid int, gid int, flags int) (err error)
|
||||
//sys Fdatasync(fd int) (err error)
|
||||
//sys Flock(fd int, how int) (err error)
|
||||
//sys Flock(fd int, how int) (err error)
|
||||
//sys Fpathconf(fd int, name int) (val int, err error)
|
||||
//sys Fstat(fd int, stat *Stat_t) (err error)
|
||||
//sys Fstatat(fd int, path string, stat *Stat_t, flags int) (err error)
|
||||
//sys Fstatvfs(fd int, vfsstat *Statvfs_t) (err error)
|
||||
//sys Getdents(fd int, buf []byte, basep *uintptr) (n int, err error)
|
||||
//sysnb Getgid() (gid int)
|
||||
@ -655,6 +662,7 @@ func Poll(fds []PollFd, timeout int) (n int, err error) {
|
||||
//sys Renameat(olddirfd int, oldpath string, newdirfd int, newpath string) (err error)
|
||||
//sys Rmdir(path string) (err error)
|
||||
//sys Seek(fd int, offset int64, whence int) (newoffset int64, err error) = lseek
|
||||
//sys Select(n int, r *FdSet, w *FdSet, e *FdSet, timeout *Timeval) (err error)
|
||||
//sysnb Setegid(egid int) (err error)
|
||||
//sysnb Seteuid(euid int) (err error)
|
||||
//sysnb Setgid(gid int) (err error)
|
||||
@ -686,6 +694,7 @@ func Poll(fds []PollFd, timeout int) (n int, err error) {
|
||||
//sys connect(s int, addr unsafe.Pointer, addrlen _Socklen) (err error) = libsocket.__xnet_connect
|
||||
//sys mmap(addr uintptr, length uintptr, prot int, flag int, fd int, pos int64) (ret uintptr, err error)
|
||||
//sys munmap(addr uintptr, length uintptr) (err error)
|
||||
//sys sendfile(outfd int, infd int, offset *int64, count int) (written int, err error) = libsendfile.sendfile
|
||||
//sys sendto(s int, buf []byte, flags int, to unsafe.Pointer, addrlen _Socklen) (err error) = libsocket.__xnet_sendto
|
||||
//sys socket(domain int, typ int, proto int) (fd int, err error) = libsocket.__xnet_socket
|
||||
//sysnb socketpair(domain int, typ int, proto int, fd *[2]int32) (err error) = libsocket.__xnet_socketpair
|
||||
|
5
vendor/golang.org/x/sys/unix/syscall_solaris_amd64.go
generated
vendored
5
vendor/golang.org/x/sys/unix/syscall_solaris_amd64.go
generated
vendored
@ -21,8 +21,3 @@ func (iov *Iovec) SetLen(length int) {
|
||||
func (cmsg *Cmsghdr) SetLen(length int) {
|
||||
cmsg.Len = uint32(length)
|
||||
}
|
||||
|
||||
func sendfile(outfd int, infd int, offset *int64, count int) (written int, err error) {
|
||||
// TODO(aram): implement this, see issue 5847.
|
||||
panic("unimplemented")
|
||||
}
|
||||
|
122
vendor/golang.org/x/sys/unix/syscall_unix.go
generated
vendored
122
vendor/golang.org/x/sys/unix/syscall_unix.go
generated
vendored
@ -2,12 +2,13 @@
|
||||
// Use of this source code is governed by a BSD-style
|
||||
// license that can be found in the LICENSE file.
|
||||
|
||||
// +build darwin dragonfly freebsd linux netbsd openbsd solaris
|
||||
// +build aix darwin dragonfly freebsd linux netbsd openbsd solaris
|
||||
|
||||
package unix
|
||||
|
||||
import (
|
||||
"runtime"
|
||||
"bytes"
|
||||
"sort"
|
||||
"sync"
|
||||
"syscall"
|
||||
"unsafe"
|
||||
@ -19,13 +20,6 @@ var (
|
||||
Stderr = 2
|
||||
)
|
||||
|
||||
const (
|
||||
darwin64Bit = runtime.GOOS == "darwin" && sizeofPtr == 8
|
||||
dragonfly64Bit = runtime.GOOS == "dragonfly" && sizeofPtr == 8
|
||||
netbsd32Bit = runtime.GOOS == "netbsd" && sizeofPtr == 4
|
||||
solaris64Bit = runtime.GOOS == "solaris" && sizeofPtr == 8
|
||||
)
|
||||
|
||||
// Do the interface allocations only once for common
|
||||
// Errno values.
|
||||
var (
|
||||
@ -50,6 +44,37 @@ func errnoErr(e syscall.Errno) error {
|
||||
return e
|
||||
}
|
||||
|
||||
// ErrnoName returns the error name for error number e.
|
||||
func ErrnoName(e syscall.Errno) string {
|
||||
i := sort.Search(len(errorList), func(i int) bool {
|
||||
return errorList[i].num >= e
|
||||
})
|
||||
if i < len(errorList) && errorList[i].num == e {
|
||||
return errorList[i].name
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
// SignalName returns the signal name for signal number s.
|
||||
func SignalName(s syscall.Signal) string {
|
||||
i := sort.Search(len(signalList), func(i int) bool {
|
||||
return signalList[i].num >= s
|
||||
})
|
||||
if i < len(signalList) && signalList[i].num == s {
|
||||
return signalList[i].name
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
// clen returns the index of the first NULL byte in n or len(n) if n contains no NULL byte.
|
||||
func clen(n []byte) int {
|
||||
i := bytes.IndexByte(n, 0)
|
||||
if i == -1 {
|
||||
i = len(n)
|
||||
}
|
||||
return i
|
||||
}
|
||||
|
||||
// Mmap manager, for use by operating system-specific implementations.
|
||||
|
||||
type mmapper struct {
|
||||
@ -138,16 +163,19 @@ func Write(fd int, p []byte) (n int, err error) {
|
||||
// creation of IPv6 sockets to return EAFNOSUPPORT.
|
||||
var SocketDisableIPv6 bool
|
||||
|
||||
// Sockaddr represents a socket address.
|
||||
type Sockaddr interface {
|
||||
sockaddr() (ptr unsafe.Pointer, len _Socklen, err error) // lowercase; only we can define Sockaddrs
|
||||
}
|
||||
|
||||
// SockaddrInet4 implements the Sockaddr interface for AF_INET type sockets.
|
||||
type SockaddrInet4 struct {
|
||||
Port int
|
||||
Addr [4]byte
|
||||
raw RawSockaddrInet4
|
||||
}
|
||||
|
||||
// SockaddrInet6 implements the Sockaddr interface for AF_INET6 type sockets.
|
||||
type SockaddrInet6 struct {
|
||||
Port int
|
||||
ZoneId uint32
|
||||
@ -155,6 +183,7 @@ type SockaddrInet6 struct {
|
||||
raw RawSockaddrInet6
|
||||
}
|
||||
|
||||
// SockaddrUnix implements the Sockaddr interface for AF_UNIX type sockets.
|
||||
type SockaddrUnix struct {
|
||||
Name string
|
||||
raw RawSockaddrUnix
|
||||
@ -182,7 +211,14 @@ func Getpeername(fd int) (sa Sockaddr, err error) {
|
||||
if err = getpeername(fd, &rsa, &len); err != nil {
|
||||
return
|
||||
}
|
||||
return anyToSockaddr(&rsa)
|
||||
return anyToSockaddr(fd, &rsa)
|
||||
}
|
||||
|
||||
func GetsockoptByte(fd, level, opt int) (value byte, err error) {
|
||||
var n byte
|
||||
vallen := _Socklen(1)
|
||||
err = getsockopt(fd, level, opt, unsafe.Pointer(&n), &vallen)
|
||||
return n, err
|
||||
}
|
||||
|
||||
func GetsockoptInt(fd, level, opt int) (value int, err error) {
|
||||
@ -192,6 +228,54 @@ func GetsockoptInt(fd, level, opt int) (value int, err error) {
|
||||
return int(n), err
|
||||
}
|
||||
|
||||
func GetsockoptInet4Addr(fd, level, opt int) (value [4]byte, err error) {
|
||||
vallen := _Socklen(4)
|
||||
err = getsockopt(fd, level, opt, unsafe.Pointer(&value[0]), &vallen)
|
||||
return value, err
|
||||
}
|
||||
|
||||
func GetsockoptIPMreq(fd, level, opt int) (*IPMreq, error) {
|
||||
var value IPMreq
|
||||
vallen := _Socklen(SizeofIPMreq)
|
||||
err := getsockopt(fd, level, opt, unsafe.Pointer(&value), &vallen)
|
||||
return &value, err
|
||||
}
|
||||
|
||||
func GetsockoptIPv6Mreq(fd, level, opt int) (*IPv6Mreq, error) {
|
||||
var value IPv6Mreq
|
||||
vallen := _Socklen(SizeofIPv6Mreq)
|
||||
err := getsockopt(fd, level, opt, unsafe.Pointer(&value), &vallen)
|
||||
return &value, err
|
||||
}
|
||||
|
||||
func GetsockoptIPv6MTUInfo(fd, level, opt int) (*IPv6MTUInfo, error) {
|
||||
var value IPv6MTUInfo
|
||||
vallen := _Socklen(SizeofIPv6MTUInfo)
|
||||
err := getsockopt(fd, level, opt, unsafe.Pointer(&value), &vallen)
|
||||
return &value, err
|
||||
}
|
||||
|
||||
func GetsockoptICMPv6Filter(fd, level, opt int) (*ICMPv6Filter, error) {
|
||||
var value ICMPv6Filter
|
||||
vallen := _Socklen(SizeofICMPv6Filter)
|
||||
err := getsockopt(fd, level, opt, unsafe.Pointer(&value), &vallen)
|
||||
return &value, err
|
||||
}
|
||||
|
||||
func GetsockoptLinger(fd, level, opt int) (*Linger, error) {
|
||||
var linger Linger
|
||||
vallen := _Socklen(SizeofLinger)
|
||||
err := getsockopt(fd, level, opt, unsafe.Pointer(&linger), &vallen)
|
||||
return &linger, err
|
||||
}
|
||||
|
||||
func GetsockoptTimeval(fd, level, opt int) (*Timeval, error) {
|
||||
var tv Timeval
|
||||
vallen := _Socklen(unsafe.Sizeof(tv))
|
||||
err := getsockopt(fd, level, opt, unsafe.Pointer(&tv), &vallen)
|
||||
return &tv, err
|
||||
}
|
||||
|
||||
func Recvfrom(fd int, p []byte, flags int) (n int, from Sockaddr, err error) {
|
||||
var rsa RawSockaddrAny
|
||||
var len _Socklen = SizeofSockaddrAny
|
||||
@ -199,7 +283,7 @@ func Recvfrom(fd int, p []byte, flags int) (n int, from Sockaddr, err error) {
|
||||
return
|
||||
}
|
||||
if rsa.Addr.Family != AF_UNSPEC {
|
||||
from, err = anyToSockaddr(&rsa)
|
||||
from, err = anyToSockaddr(fd, &rsa)
|
||||
}
|
||||
return
|
||||
}
|
||||
@ -267,13 +351,6 @@ func Socketpair(domain, typ, proto int) (fd [2]int, err error) {
|
||||
return
|
||||
}
|
||||
|
||||
func Sendfile(outfd int, infd int, offset *int64, count int) (written int, err error) {
|
||||
if raceenabled {
|
||||
raceReleaseMerge(unsafe.Pointer(&ioSync))
|
||||
}
|
||||
return sendfile(outfd, infd, offset, count)
|
||||
}
|
||||
|
||||
var ioSync int64
|
||||
|
||||
func CloseOnExec(fd int) { fcntl(fd, F_SETFD, FD_CLOEXEC) }
|
||||
@ -291,3 +368,12 @@ func SetNonblock(fd int, nonblocking bool) (err error) {
|
||||
_, err = fcntl(fd, F_SETFL, flag)
|
||||
return err
|
||||
}
|
||||
|
||||
// Exec calls execve(2), which replaces the calling executable in the process
|
||||
// tree. argv0 should be the full path to an executable ("/bin/ls") and the
|
||||
// executable name should also be the first argument in argv (["ls", "-l"]).
|
||||
// envv are the environment variables that should be passed to the new
|
||||
// process (["USER=go", "PWD=/tmp"]).
|
||||
func Exec(argv0 string, argv []string, envv []string) error {
|
||||
return syscall.Exec(argv0, argv, envv)
|
||||
}
|
||||
|
2
vendor/golang.org/x/sys/unix/syscall_unix_gc.go
generated
vendored
2
vendor/golang.org/x/sys/unix/syscall_unix_gc.go
generated
vendored
@ -3,7 +3,7 @@
|
||||
// license that can be found in the LICENSE file.
|
||||
|
||||
// +build darwin dragonfly freebsd linux netbsd openbsd solaris
|
||||
// +build !gccgo
|
||||
// +build !gccgo,!ppc64le,!ppc64
|
||||
|
||||
package unix
|
||||
|
||||
|
24
vendor/golang.org/x/sys/unix/syscall_unix_gc_ppc64x.go
generated
vendored
Normal file
24
vendor/golang.org/x/sys/unix/syscall_unix_gc_ppc64x.go
generated
vendored
Normal file
@ -0,0 +1,24 @@
|
||||
// Copyright 2018 The Go Authors. All rights reserved.
|
||||
// Use of this source code is governed by a BSD-style
|
||||
// license that can be found in the LICENSE file.
|
||||
|
||||
// +build linux
|
||||
// +build ppc64le ppc64
|
||||
// +build !gccgo
|
||||
|
||||
package unix
|
||||
|
||||
import "syscall"
|
||||
|
||||
func Syscall(trap, a1, a2, a3 uintptr) (r1, r2 uintptr, err syscall.Errno) {
|
||||
return syscall.Syscall(trap, a1, a2, a3)
|
||||
}
|
||||
func Syscall6(trap, a1, a2, a3, a4, a5, a6 uintptr) (r1, r2 uintptr, err syscall.Errno) {
|
||||
return syscall.Syscall6(trap, a1, a2, a3, a4, a5, a6)
|
||||
}
|
||||
func RawSyscall(trap, a1, a2, a3 uintptr) (r1, r2 uintptr, err syscall.Errno) {
|
||||
return syscall.RawSyscall(trap, a1, a2, a3)
|
||||
}
|
||||
func RawSyscall6(trap, a1, a2, a3, a4, a5, a6 uintptr) (r1, r2 uintptr, err syscall.Errno) {
|
||||
return syscall.RawSyscall6(trap, a1, a2, a3, a4, a5, a6)
|
||||
}
|
22
vendor/golang.org/x/sys/unix/timestruct.go
generated
vendored
22
vendor/golang.org/x/sys/unix/timestruct.go
generated
vendored
@ -2,10 +2,12 @@
|
||||
// Use of this source code is governed by a BSD-style
|
||||
// license that can be found in the LICENSE file.
|
||||
|
||||
// +build darwin dragonfly freebsd linux netbsd openbsd solaris
|
||||
// +build aix darwin dragonfly freebsd linux netbsd openbsd solaris
|
||||
|
||||
package unix
|
||||
|
||||
import "time"
|
||||
|
||||
// TimespecToNsec converts a Timespec value into a number of
|
||||
// nanoseconds since the Unix epoch.
|
||||
func TimespecToNsec(ts Timespec) int64 { return int64(ts.Sec)*1e9 + int64(ts.Nsec) }
|
||||
@ -22,6 +24,24 @@ func NsecToTimespec(nsec int64) Timespec {
|
||||
return setTimespec(sec, nsec)
|
||||
}
|
||||
|
||||
// TimeToTimespec converts t into a Timespec.
|
||||
// On some 32-bit systems the range of valid Timespec values are smaller
|
||||
// than that of time.Time values. So if t is out of the valid range of
|
||||
// Timespec, it returns a zero Timespec and ERANGE.
|
||||
func TimeToTimespec(t time.Time) (Timespec, error) {
|
||||
sec := t.Unix()
|
||||
nsec := int64(t.Nanosecond())
|
||||
ts := setTimespec(sec, nsec)
|
||||
|
||||
// Currently all targets have either int32 or int64 for Timespec.Sec.
|
||||
// If there were a new target with floating point type for it, we have
|
||||
// to consider the rounding error.
|
||||
if int64(ts.Sec) != sec {
|
||||
return Timespec{}, ERANGE
|
||||
}
|
||||
return ts, nil
|
||||
}
|
||||
|
||||
// TimevalToNsec converts a Timeval value into a number of nanoseconds
|
||||
// since the Unix epoch.
|
||||
func TimevalToNsec(tv Timeval) int64 { return int64(tv.Sec)*1e9 + int64(tv.Usec)*1e3 }
|
||||
|
240
vendor/golang.org/x/sys/unix/xattr_bsd.go
generated
vendored
Normal file
240
vendor/golang.org/x/sys/unix/xattr_bsd.go
generated
vendored
Normal file
@ -0,0 +1,240 @@
|
||||
// Copyright 2018 The Go Authors. All rights reserved.
|
||||
// Use of this source code is governed by a BSD-style
|
||||
// license that can be found in the LICENSE file.
|
||||
|
||||
// +build freebsd netbsd
|
||||
|
||||
package unix
|
||||
|
||||
import (
|
||||
"strings"
|
||||
"unsafe"
|
||||
)
|
||||
|
||||
// Derive extattr namespace and attribute name
|
||||
|
||||
func xattrnamespace(fullattr string) (ns int, attr string, err error) {
|
||||
s := strings.IndexByte(fullattr, '.')
|
||||
if s == -1 {
|
||||
return -1, "", ENOATTR
|
||||
}
|
||||
|
||||
namespace := fullattr[0:s]
|
||||
attr = fullattr[s+1:]
|
||||
|
||||
switch namespace {
|
||||
case "user":
|
||||
return EXTATTR_NAMESPACE_USER, attr, nil
|
||||
case "system":
|
||||
return EXTATTR_NAMESPACE_SYSTEM, attr, nil
|
||||
default:
|
||||
return -1, "", ENOATTR
|
||||
}
|
||||
}
|
||||
|
||||
func initxattrdest(dest []byte, idx int) (d unsafe.Pointer) {
|
||||
if len(dest) > idx {
|
||||
return unsafe.Pointer(&dest[idx])
|
||||
} else {
|
||||
return unsafe.Pointer(_zero)
|
||||
}
|
||||
}
|
||||
|
||||
// FreeBSD and NetBSD implement their own syscalls to handle extended attributes
|
||||
|
||||
func Getxattr(file string, attr string, dest []byte) (sz int, err error) {
|
||||
d := initxattrdest(dest, 0)
|
||||
destsize := len(dest)
|
||||
|
||||
nsid, a, err := xattrnamespace(attr)
|
||||
if err != nil {
|
||||
return -1, err
|
||||
}
|
||||
|
||||
return ExtattrGetFile(file, nsid, a, uintptr(d), destsize)
|
||||
}
|
||||
|
||||
func Fgetxattr(fd int, attr string, dest []byte) (sz int, err error) {
|
||||
d := initxattrdest(dest, 0)
|
||||
destsize := len(dest)
|
||||
|
||||
nsid, a, err := xattrnamespace(attr)
|
||||
if err != nil {
|
||||
return -1, err
|
||||
}
|
||||
|
||||
return ExtattrGetFd(fd, nsid, a, uintptr(d), destsize)
|
||||
}
|
||||
|
||||
func Lgetxattr(link string, attr string, dest []byte) (sz int, err error) {
|
||||
d := initxattrdest(dest, 0)
|
||||
destsize := len(dest)
|
||||
|
||||
nsid, a, err := xattrnamespace(attr)
|
||||
if err != nil {
|
||||
return -1, err
|
||||
}
|
||||
|
||||
return ExtattrGetLink(link, nsid, a, uintptr(d), destsize)
|
||||
}
|
||||
|
||||
// flags are unused on FreeBSD
|
||||
|
||||
func Fsetxattr(fd int, attr string, data []byte, flags int) (err error) {
|
||||
var d unsafe.Pointer
|
||||
if len(data) > 0 {
|
||||
d = unsafe.Pointer(&data[0])
|
||||
}
|
||||
datasiz := len(data)
|
||||
|
||||
nsid, a, err := xattrnamespace(attr)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
|
||||
_, err = ExtattrSetFd(fd, nsid, a, uintptr(d), datasiz)
|
||||
return
|
||||
}
|
||||
|
||||
func Setxattr(file string, attr string, data []byte, flags int) (err error) {
|
||||
var d unsafe.Pointer
|
||||
if len(data) > 0 {
|
||||
d = unsafe.Pointer(&data[0])
|
||||
}
|
||||
datasiz := len(data)
|
||||
|
||||
nsid, a, err := xattrnamespace(attr)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
|
||||
_, err = ExtattrSetFile(file, nsid, a, uintptr(d), datasiz)
|
||||
return
|
||||
}
|
||||
|
||||
func Lsetxattr(link string, attr string, data []byte, flags int) (err error) {
|
||||
var d unsafe.Pointer
|
||||
if len(data) > 0 {
|
||||
d = unsafe.Pointer(&data[0])
|
||||
}
|
||||
datasiz := len(data)
|
||||
|
||||
nsid, a, err := xattrnamespace(attr)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
|
||||
_, err = ExtattrSetLink(link, nsid, a, uintptr(d), datasiz)
|
||||
return
|
||||
}
|
||||
|
||||
func Removexattr(file string, attr string) (err error) {
|
||||
nsid, a, err := xattrnamespace(attr)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
|
||||
err = ExtattrDeleteFile(file, nsid, a)
|
||||
return
|
||||
}
|
||||
|
||||
func Fremovexattr(fd int, attr string) (err error) {
|
||||
nsid, a, err := xattrnamespace(attr)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
|
||||
err = ExtattrDeleteFd(fd, nsid, a)
|
||||
return
|
||||
}
|
||||
|
||||
func Lremovexattr(link string, attr string) (err error) {
|
||||
nsid, a, err := xattrnamespace(attr)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
|
||||
err = ExtattrDeleteLink(link, nsid, a)
|
||||
return
|
||||
}
|
||||
|
||||
func Listxattr(file string, dest []byte) (sz int, err error) {
|
||||
d := initxattrdest(dest, 0)
|
||||
destsiz := len(dest)
|
||||
|
||||
// FreeBSD won't allow you to list xattrs from multiple namespaces
|
||||
s := 0
|
||||
for _, nsid := range [...]int{EXTATTR_NAMESPACE_USER, EXTATTR_NAMESPACE_SYSTEM} {
|
||||
stmp, e := ExtattrListFile(file, nsid, uintptr(d), destsiz)
|
||||
|
||||
/* Errors accessing system attrs are ignored so that
|
||||
* we can implement the Linux-like behavior of omitting errors that
|
||||
* we don't have read permissions on
|
||||
*
|
||||
* Linux will still error if we ask for user attributes on a file that
|
||||
* we don't have read permissions on, so don't ignore those errors
|
||||
*/
|
||||
if e != nil && e == EPERM && nsid != EXTATTR_NAMESPACE_USER {
|
||||
continue
|
||||
} else if e != nil {
|
||||
return s, e
|
||||
}
|
||||
|
||||
s += stmp
|
||||
destsiz -= s
|
||||
if destsiz < 0 {
|
||||
destsiz = 0
|
||||
}
|
||||
d = initxattrdest(dest, s)
|
||||
}
|
||||
|
||||
return s, nil
|
||||
}
|
||||
|
||||
func Flistxattr(fd int, dest []byte) (sz int, err error) {
|
||||
d := initxattrdest(dest, 0)
|
||||
destsiz := len(dest)
|
||||
|
||||
s := 0
|
||||
for _, nsid := range [...]int{EXTATTR_NAMESPACE_USER, EXTATTR_NAMESPACE_SYSTEM} {
|
||||
stmp, e := ExtattrListFd(fd, nsid, uintptr(d), destsiz)
|
||||
if e != nil && e == EPERM && nsid != EXTATTR_NAMESPACE_USER {
|
||||
continue
|
||||
} else if e != nil {
|
||||
return s, e
|
||||
}
|
||||
|
||||
s += stmp
|
||||
destsiz -= s
|
||||
if destsiz < 0 {
|
||||
destsiz = 0
|
||||
}
|
||||
d = initxattrdest(dest, s)
|
||||
}
|
||||
|
||||
return s, nil
|
||||
}
|
||||
|
||||
func Llistxattr(link string, dest []byte) (sz int, err error) {
|
||||
d := initxattrdest(dest, 0)
|
||||
destsiz := len(dest)
|
||||
|
||||
s := 0
|
||||
for _, nsid := range [...]int{EXTATTR_NAMESPACE_USER, EXTATTR_NAMESPACE_SYSTEM} {
|
||||
stmp, e := ExtattrListLink(link, nsid, uintptr(d), destsiz)
|
||||
if e != nil && e == EPERM && nsid != EXTATTR_NAMESPACE_USER {
|
||||
continue
|
||||
} else if e != nil {
|
||||
return s, e
|
||||
}
|
||||
|
||||
s += stmp
|
||||
destsiz -= s
|
||||
if destsiz < 0 {
|
||||
destsiz = 0
|
||||
}
|
||||
d = initxattrdest(dest, s)
|
||||
}
|
||||
|
||||
return s, nil
|
||||
}
|
1372
vendor/golang.org/x/sys/unix/zerrors_aix_ppc.go
generated
vendored
Normal file
1372
vendor/golang.org/x/sys/unix/zerrors_aix_ppc.go
generated
vendored
Normal file
File diff suppressed because it is too large
Load Diff
1373
vendor/golang.org/x/sys/unix/zerrors_aix_ppc64.go
generated
vendored
Normal file
1373
vendor/golang.org/x/sys/unix/zerrors_aix_ppc64.go
generated
vendored
Normal file
File diff suppressed because it is too large
Load Diff
299
vendor/golang.org/x/sys/unix/zerrors_darwin_386.go
generated
vendored
299
vendor/golang.org/x/sys/unix/zerrors_darwin_386.go
generated
vendored
@ -249,6 +249,8 @@ const (
|
||||
CSTOP = 0x13
|
||||
CSTOPB = 0x400
|
||||
CSUSP = 0x1a
|
||||
CTL_HW = 0x6
|
||||
CTL_KERN = 0x1
|
||||
CTL_MAXNAME = 0xc
|
||||
CTL_NET = 0x4
|
||||
DLT_A429 = 0xb8
|
||||
@ -532,6 +534,7 @@ const (
|
||||
F_VOLPOSMODE = 0x4
|
||||
F_WRLCK = 0x3
|
||||
HUPCL = 0x4000
|
||||
HW_MACHINE = 0x1
|
||||
ICANON = 0x100
|
||||
ICMP6_FILTER = 0x12
|
||||
ICRNL = 0x100
|
||||
@ -878,6 +881,10 @@ const (
|
||||
IXANY = 0x800
|
||||
IXOFF = 0x400
|
||||
IXON = 0x200
|
||||
KERN_HOSTNAME = 0xa
|
||||
KERN_OSRELEASE = 0x2
|
||||
KERN_OSTYPE = 0x1
|
||||
KERN_VERSION = 0x4
|
||||
LOCK_EX = 0x2
|
||||
LOCK_NB = 0x4
|
||||
LOCK_SH = 0x1
|
||||
@ -1466,6 +1473,12 @@ const (
|
||||
WORDSIZE = 0x20
|
||||
WSTOPPED = 0x8
|
||||
WUNTRACED = 0x2
|
||||
XATTR_CREATE = 0x2
|
||||
XATTR_NODEFAULT = 0x10
|
||||
XATTR_NOFOLLOW = 0x1
|
||||
XATTR_NOSECURITY = 0x8
|
||||
XATTR_REPLACE = 0x4
|
||||
XATTR_SHOWCOMPRESSION = 0x20
|
||||
)
|
||||
|
||||
// Errors
|
||||
@ -1617,146 +1630,154 @@ const (
|
||||
)
|
||||
|
||||
// Error table
|
||||
var errors = [...]string{
|
||||
1: "operation not permitted",
|
||||
2: "no such file or directory",
|
||||
3: "no such process",
|
||||
4: "interrupted system call",
|
||||
5: "input/output error",
|
||||
6: "device not configured",
|
||||
7: "argument list too long",
|
||||
8: "exec format error",
|
||||
9: "bad file descriptor",
|
||||
10: "no child processes",
|
||||
11: "resource deadlock avoided",
|
||||
12: "cannot allocate memory",
|
||||
13: "permission denied",
|
||||
14: "bad address",
|
||||
15: "block device required",
|
||||
16: "resource busy",
|
||||
17: "file exists",
|
||||
18: "cross-device link",
|
||||
19: "operation not supported by device",
|
||||
20: "not a directory",
|
||||
21: "is a directory",
|
||||
22: "invalid argument",
|
||||
23: "too many open files in system",
|
||||
24: "too many open files",
|
||||
25: "inappropriate ioctl for device",
|
||||
26: "text file busy",
|
||||
27: "file too large",
|
||||
28: "no space left on device",
|
||||
29: "illegal seek",
|
||||
30: "read-only file system",
|
||||
31: "too many links",
|
||||
32: "broken pipe",
|
||||
33: "numerical argument out of domain",
|
||||
34: "result too large",
|
||||
35: "resource temporarily unavailable",
|
||||
36: "operation now in progress",
|
||||
37: "operation already in progress",
|
||||
38: "socket operation on non-socket",
|
||||
39: "destination address required",
|
||||
40: "message too long",
|
||||
41: "protocol wrong type for socket",
|
||||
42: "protocol not available",
|
||||
43: "protocol not supported",
|
||||
44: "socket type not supported",
|
||||
45: "operation not supported",
|
||||
46: "protocol family not supported",
|
||||
47: "address family not supported by protocol family",
|
||||
48: "address already in use",
|
||||
49: "can't assign requested address",
|
||||
50: "network is down",
|
||||
51: "network is unreachable",
|
||||
52: "network dropped connection on reset",
|
||||
53: "software caused connection abort",
|
||||
54: "connection reset by peer",
|
||||
55: "no buffer space available",
|
||||
56: "socket is already connected",
|
||||
57: "socket is not connected",
|
||||
58: "can't send after socket shutdown",
|
||||
59: "too many references: can't splice",
|
||||
60: "operation timed out",
|
||||
61: "connection refused",
|
||||
62: "too many levels of symbolic links",
|
||||
63: "file name too long",
|
||||
64: "host is down",
|
||||
65: "no route to host",
|
||||
66: "directory not empty",
|
||||
67: "too many processes",
|
||||
68: "too many users",
|
||||
69: "disc quota exceeded",
|
||||
70: "stale NFS file handle",
|
||||
71: "too many levels of remote in path",
|
||||
72: "RPC struct is bad",
|
||||
73: "RPC version wrong",
|
||||
74: "RPC prog. not avail",
|
||||
75: "program version wrong",
|
||||
76: "bad procedure for program",
|
||||
77: "no locks available",
|
||||
78: "function not implemented",
|
||||
79: "inappropriate file type or format",
|
||||
80: "authentication error",
|
||||
81: "need authenticator",
|
||||
82: "device power is off",
|
||||
83: "device error",
|
||||
84: "value too large to be stored in data type",
|
||||
85: "bad executable (or shared library)",
|
||||
86: "bad CPU type in executable",
|
||||
87: "shared library version mismatch",
|
||||
88: "malformed Mach-o file",
|
||||
89: "operation canceled",
|
||||
90: "identifier removed",
|
||||
91: "no message of desired type",
|
||||
92: "illegal byte sequence",
|
||||
93: "attribute not found",
|
||||
94: "bad message",
|
||||
95: "EMULTIHOP (Reserved)",
|
||||
96: "no message available on STREAM",
|
||||
97: "ENOLINK (Reserved)",
|
||||
98: "no STREAM resources",
|
||||
99: "not a STREAM",
|
||||
100: "protocol error",
|
||||
101: "STREAM ioctl timeout",
|
||||
102: "operation not supported on socket",
|
||||
103: "policy not found",
|
||||
104: "state not recoverable",
|
||||
105: "previous owner died",
|
||||
106: "interface output queue is full",
|
||||
var errorList = [...]struct {
|
||||
num syscall.Errno
|
||||
name string
|
||||
desc string
|
||||
}{
|
||||
{1, "EPERM", "operation not permitted"},
|
||||
{2, "ENOENT", "no such file or directory"},
|
||||
{3, "ESRCH", "no such process"},
|
||||
{4, "EINTR", "interrupted system call"},
|
||||
{5, "EIO", "input/output error"},
|
||||
{6, "ENXIO", "device not configured"},
|
||||
{7, "E2BIG", "argument list too long"},
|
||||
{8, "ENOEXEC", "exec format error"},
|
||||
{9, "EBADF", "bad file descriptor"},
|
||||
{10, "ECHILD", "no child processes"},
|
||||
{11, "EDEADLK", "resource deadlock avoided"},
|
||||
{12, "ENOMEM", "cannot allocate memory"},
|
||||
{13, "EACCES", "permission denied"},
|
||||
{14, "EFAULT", "bad address"},
|
||||
{15, "ENOTBLK", "block device required"},
|
||||
{16, "EBUSY", "resource busy"},
|
||||
{17, "EEXIST", "file exists"},
|
||||
{18, "EXDEV", "cross-device link"},
|
||||
{19, "ENODEV", "operation not supported by device"},
|
||||
{20, "ENOTDIR", "not a directory"},
|
||||
{21, "EISDIR", "is a directory"},
|
||||
{22, "EINVAL", "invalid argument"},
|
||||
{23, "ENFILE", "too many open files in system"},
|
||||
{24, "EMFILE", "too many open files"},
|
||||
{25, "ENOTTY", "inappropriate ioctl for device"},
|
||||
{26, "ETXTBSY", "text file busy"},
|
||||
{27, "EFBIG", "file too large"},
|
||||
{28, "ENOSPC", "no space left on device"},
|
||||
{29, "ESPIPE", "illegal seek"},
|
||||
{30, "EROFS", "read-only file system"},
|
||||
{31, "EMLINK", "too many links"},
|
||||
{32, "EPIPE", "broken pipe"},
|
||||
{33, "EDOM", "numerical argument out of domain"},
|
||||
{34, "ERANGE", "result too large"},
|
||||
{35, "EAGAIN", "resource temporarily unavailable"},
|
||||
{36, "EINPROGRESS", "operation now in progress"},
|
||||
{37, "EALREADY", "operation already in progress"},
|
||||
{38, "ENOTSOCK", "socket operation on non-socket"},
|
||||
{39, "EDESTADDRREQ", "destination address required"},
|
||||
{40, "EMSGSIZE", "message too long"},
|
||||
{41, "EPROTOTYPE", "protocol wrong type for socket"},
|
||||
{42, "ENOPROTOOPT", "protocol not available"},
|
||||
{43, "EPROTONOSUPPORT", "protocol not supported"},
|
||||
{44, "ESOCKTNOSUPPORT", "socket type not supported"},
|
||||
{45, "ENOTSUP", "operation not supported"},
|
||||
{46, "EPFNOSUPPORT", "protocol family not supported"},
|
||||
{47, "EAFNOSUPPORT", "address family not supported by protocol family"},
|
||||
{48, "EADDRINUSE", "address already in use"},
|
||||
{49, "EADDRNOTAVAIL", "can't assign requested address"},
|
||||
{50, "ENETDOWN", "network is down"},
|
||||
{51, "ENETUNREACH", "network is unreachable"},
|
||||
{52, "ENETRESET", "network dropped connection on reset"},
|
||||
{53, "ECONNABORTED", "software caused connection abort"},
|
||||
{54, "ECONNRESET", "connection reset by peer"},
|
||||
{55, "ENOBUFS", "no buffer space available"},
|
||||
{56, "EISCONN", "socket is already connected"},
|
||||
{57, "ENOTCONN", "socket is not connected"},
|
||||
{58, "ESHUTDOWN", "can't send after socket shutdown"},
|
||||
{59, "ETOOMANYREFS", "too many references: can't splice"},
|
||||
{60, "ETIMEDOUT", "operation timed out"},
|
||||
{61, "ECONNREFUSED", "connection refused"},
|
||||
{62, "ELOOP", "too many levels of symbolic links"},
|
||||
{63, "ENAMETOOLONG", "file name too long"},
|
||||
{64, "EHOSTDOWN", "host is down"},
|
||||
{65, "EHOSTUNREACH", "no route to host"},
|
||||
{66, "ENOTEMPTY", "directory not empty"},
|
||||
{67, "EPROCLIM", "too many processes"},
|
||||
{68, "EUSERS", "too many users"},
|
||||
{69, "EDQUOT", "disc quota exceeded"},
|
||||
{70, "ESTALE", "stale NFS file handle"},
|
||||
{71, "EREMOTE", "too many levels of remote in path"},
|
||||
{72, "EBADRPC", "RPC struct is bad"},
|
||||
{73, "ERPCMISMATCH", "RPC version wrong"},
|
||||
{74, "EPROGUNAVAIL", "RPC prog. not avail"},
|
||||
{75, "EPROGMISMATCH", "program version wrong"},
|
||||
{76, "EPROCUNAVAIL", "bad procedure for program"},
|
||||
{77, "ENOLCK", "no locks available"},
|
||||
{78, "ENOSYS", "function not implemented"},
|
||||
{79, "EFTYPE", "inappropriate file type or format"},
|
||||
{80, "EAUTH", "authentication error"},
|
||||
{81, "ENEEDAUTH", "need authenticator"},
|
||||
{82, "EPWROFF", "device power is off"},
|
||||
{83, "EDEVERR", "device error"},
|
||||
{84, "EOVERFLOW", "value too large to be stored in data type"},
|
||||
{85, "EBADEXEC", "bad executable (or shared library)"},
|
||||
{86, "EBADARCH", "bad CPU type in executable"},
|
||||
{87, "ESHLIBVERS", "shared library version mismatch"},
|
||||
{88, "EBADMACHO", "malformed Mach-o file"},
|
||||
{89, "ECANCELED", "operation canceled"},
|
||||
{90, "EIDRM", "identifier removed"},
|
||||
{91, "ENOMSG", "no message of desired type"},
|
||||
{92, "EILSEQ", "illegal byte sequence"},
|
||||
{93, "ENOATTR", "attribute not found"},
|
||||
{94, "EBADMSG", "bad message"},
|
||||
{95, "EMULTIHOP", "EMULTIHOP (Reserved)"},
|
||||
{96, "ENODATA", "no message available on STREAM"},
|
||||
{97, "ENOLINK", "ENOLINK (Reserved)"},
|
||||
{98, "ENOSR", "no STREAM resources"},
|
||||
{99, "ENOSTR", "not a STREAM"},
|
||||
{100, "EPROTO", "protocol error"},
|
||||
{101, "ETIME", "STREAM ioctl timeout"},
|
||||
{102, "EOPNOTSUPP", "operation not supported on socket"},
|
||||
{103, "ENOPOLICY", "policy not found"},
|
||||
{104, "ENOTRECOVERABLE", "state not recoverable"},
|
||||
{105, "EOWNERDEAD", "previous owner died"},
|
||||
{106, "EQFULL", "interface output queue is full"},
|
||||
}
|
||||
|
||||
// Signal table
|
||||
var signals = [...]string{
|
||||
1: "hangup",
|
||||
2: "interrupt",
|
||||
3: "quit",
|
||||
4: "illegal instruction",
|
||||
5: "trace/BPT trap",
|
||||
6: "abort trap",
|
||||
7: "EMT trap",
|
||||
8: "floating point exception",
|
||||
9: "killed",
|
||||
10: "bus error",
|
||||
11: "segmentation fault",
|
||||
12: "bad system call",
|
||||
13: "broken pipe",
|
||||
14: "alarm clock",
|
||||
15: "terminated",
|
||||
16: "urgent I/O condition",
|
||||
17: "suspended (signal)",
|
||||
18: "suspended",
|
||||
19: "continued",
|
||||
20: "child exited",
|
||||
21: "stopped (tty input)",
|
||||
22: "stopped (tty output)",
|
||||
23: "I/O possible",
|
||||
24: "cputime limit exceeded",
|
||||
25: "filesize limit exceeded",
|
||||
26: "virtual timer expired",
|
||||
27: "profiling timer expired",
|
||||
28: "window size changes",
|
||||
29: "information request",
|
||||
30: "user defined signal 1",
|
||||
31: "user defined signal 2",
|
||||
var signalList = [...]struct {
|
||||
num syscall.Signal
|
||||
name string
|
||||
desc string
|
||||
}{
|
||||
{1, "SIGHUP", "hangup"},
|
||||
{2, "SIGINT", "interrupt"},
|
||||
{3, "SIGQUIT", "quit"},
|
||||
{4, "SIGILL", "illegal instruction"},
|
||||
{5, "SIGTRAP", "trace/BPT trap"},
|
||||
{6, "SIGABRT", "abort trap"},
|
||||
{7, "SIGEMT", "EMT trap"},
|
||||
{8, "SIGFPE", "floating point exception"},
|
||||
{9, "SIGKILL", "killed"},
|
||||
{10, "SIGBUS", "bus error"},
|
||||
{11, "SIGSEGV", "segmentation fault"},
|
||||
{12, "SIGSYS", "bad system call"},
|
||||
{13, "SIGPIPE", "broken pipe"},
|
||||
{14, "SIGALRM", "alarm clock"},
|
||||
{15, "SIGTERM", "terminated"},
|
||||
{16, "SIGURG", "urgent I/O condition"},
|
||||
{17, "SIGSTOP", "suspended (signal)"},
|
||||
{18, "SIGTSTP", "suspended"},
|
||||
{19, "SIGCONT", "continued"},
|
||||
{20, "SIGCHLD", "child exited"},
|
||||
{21, "SIGTTIN", "stopped (tty input)"},
|
||||
{22, "SIGTTOU", "stopped (tty output)"},
|
||||
{23, "SIGIO", "I/O possible"},
|
||||
{24, "SIGXCPU", "cputime limit exceeded"},
|
||||
{25, "SIGXFSZ", "filesize limit exceeded"},
|
||||
{26, "SIGVTALRM", "virtual timer expired"},
|
||||
{27, "SIGPROF", "profiling timer expired"},
|
||||
{28, "SIGWINCH", "window size changes"},
|
||||
{29, "SIGINFO", "information request"},
|
||||
{30, "SIGUSR1", "user defined signal 1"},
|
||||
{31, "SIGUSR2", "user defined signal 2"},
|
||||
}
|
||||
|
299
vendor/golang.org/x/sys/unix/zerrors_darwin_amd64.go
generated
vendored
299
vendor/golang.org/x/sys/unix/zerrors_darwin_amd64.go
generated
vendored
@ -249,6 +249,8 @@ const (
|
||||
CSTOP = 0x13
|
||||
CSTOPB = 0x400
|
||||
CSUSP = 0x1a
|
||||
CTL_HW = 0x6
|
||||
CTL_KERN = 0x1
|
||||
CTL_MAXNAME = 0xc
|
||||
CTL_NET = 0x4
|
||||
DLT_A429 = 0xb8
|
||||
@ -532,6 +534,7 @@ const (
|
||||
F_VOLPOSMODE = 0x4
|
||||
F_WRLCK = 0x3
|
||||
HUPCL = 0x4000
|
||||
HW_MACHINE = 0x1
|
||||
ICANON = 0x100
|
||||
ICMP6_FILTER = 0x12
|
||||
ICRNL = 0x100
|
||||
@ -878,6 +881,10 @@ const (
|
||||
IXANY = 0x800
|
||||
IXOFF = 0x400
|
||||
IXON = 0x200
|
||||
KERN_HOSTNAME = 0xa
|
||||
KERN_OSRELEASE = 0x2
|
||||
KERN_OSTYPE = 0x1
|
||||
KERN_VERSION = 0x4
|
||||
LOCK_EX = 0x2
|
||||
LOCK_NB = 0x4
|
||||
LOCK_SH = 0x1
|
||||
@ -1466,6 +1473,12 @@ const (
|
||||
WORDSIZE = 0x40
|
||||
WSTOPPED = 0x8
|
||||
WUNTRACED = 0x2
|
||||
XATTR_CREATE = 0x2
|
||||
XATTR_NODEFAULT = 0x10
|
||||
XATTR_NOFOLLOW = 0x1
|
||||
XATTR_NOSECURITY = 0x8
|
||||
XATTR_REPLACE = 0x4
|
||||
XATTR_SHOWCOMPRESSION = 0x20
|
||||
)
|
||||
|
||||
// Errors
|
||||
@ -1617,146 +1630,154 @@ const (
|
||||
)
|
||||
|
||||
// Error table
|
||||
var errors = [...]string{
|
||||
1: "operation not permitted",
|
||||
2: "no such file or directory",
|
||||
3: "no such process",
|
||||
4: "interrupted system call",
|
||||
5: "input/output error",
|
||||
6: "device not configured",
|
||||
7: "argument list too long",
|
||||
8: "exec format error",
|
||||
9: "bad file descriptor",
|
||||
10: "no child processes",
|
||||
11: "resource deadlock avoided",
|
||||
12: "cannot allocate memory",
|
||||
13: "permission denied",
|
||||
14: "bad address",
|
||||
15: "block device required",
|
||||
16: "resource busy",
|
||||
17: "file exists",
|
||||
18: "cross-device link",
|
||||
19: "operation not supported by device",
|
||||
20: "not a directory",
|
||||
21: "is a directory",
|
||||
22: "invalid argument",
|
||||
23: "too many open files in system",
|
||||
24: "too many open files",
|
||||
25: "inappropriate ioctl for device",
|
||||
26: "text file busy",
|
||||
27: "file too large",
|
||||
28: "no space left on device",
|
||||
29: "illegal seek",
|
||||
30: "read-only file system",
|
||||
31: "too many links",
|
||||
32: "broken pipe",
|
||||
33: "numerical argument out of domain",
|
||||
34: "result too large",
|
||||
35: "resource temporarily unavailable",
|
||||
36: "operation now in progress",
|
||||
37: "operation already in progress",
|
||||
38: "socket operation on non-socket",
|
||||
39: "destination address required",
|
||||
40: "message too long",
|
||||
41: "protocol wrong type for socket",
|
||||
42: "protocol not available",
|
||||
43: "protocol not supported",
|
||||
44: "socket type not supported",
|
||||
45: "operation not supported",
|
||||
46: "protocol family not supported",
|
||||
47: "address family not supported by protocol family",
|
||||
48: "address already in use",
|
||||
49: "can't assign requested address",
|
||||
50: "network is down",
|
||||
51: "network is unreachable",
|
||||
52: "network dropped connection on reset",
|
||||
53: "software caused connection abort",
|
||||
54: "connection reset by peer",
|
||||
55: "no buffer space available",
|
||||
56: "socket is already connected",
|
||||
57: "socket is not connected",
|
||||
58: "can't send after socket shutdown",
|
||||
59: "too many references: can't splice",
|
||||
60: "operation timed out",
|
||||
61: "connection refused",
|
||||
62: "too many levels of symbolic links",
|
||||
63: "file name too long",
|
||||
64: "host is down",
|
||||
65: "no route to host",
|
||||
66: "directory not empty",
|
||||
67: "too many processes",
|
||||
68: "too many users",
|
||||
69: "disc quota exceeded",
|
||||
70: "stale NFS file handle",
|
||||
71: "too many levels of remote in path",
|
||||
72: "RPC struct is bad",
|
||||
73: "RPC version wrong",
|
||||
74: "RPC prog. not avail",
|
||||
75: "program version wrong",
|
||||
76: "bad procedure for program",
|
||||
77: "no locks available",
|
||||
78: "function not implemented",
|
||||
79: "inappropriate file type or format",
|
||||
80: "authentication error",
|
||||
81: "need authenticator",
|
||||
82: "device power is off",
|
||||
83: "device error",
|
||||
84: "value too large to be stored in data type",
|
||||
85: "bad executable (or shared library)",
|
||||
86: "bad CPU type in executable",
|
||||
87: "shared library version mismatch",
|
||||
88: "malformed Mach-o file",
|
||||
89: "operation canceled",
|
||||
90: "identifier removed",
|
||||
91: "no message of desired type",
|
||||
92: "illegal byte sequence",
|
||||
93: "attribute not found",
|
||||
94: "bad message",
|
||||
95: "EMULTIHOP (Reserved)",
|
||||
96: "no message available on STREAM",
|
||||
97: "ENOLINK (Reserved)",
|
||||
98: "no STREAM resources",
|
||||
99: "not a STREAM",
|
||||
100: "protocol error",
|
||||
101: "STREAM ioctl timeout",
|
||||
102: "operation not supported on socket",
|
||||
103: "policy not found",
|
||||
104: "state not recoverable",
|
||||
105: "previous owner died",
|
||||
106: "interface output queue is full",
|
||||
var errorList = [...]struct {
|
||||
num syscall.Errno
|
||||
name string
|
||||
desc string
|
||||
}{
|
||||
{1, "EPERM", "operation not permitted"},
|
||||
{2, "ENOENT", "no such file or directory"},
|
||||
{3, "ESRCH", "no such process"},
|
||||
{4, "EINTR", "interrupted system call"},
|
||||
{5, "EIO", "input/output error"},
|
||||
{6, "ENXIO", "device not configured"},
|
||||
{7, "E2BIG", "argument list too long"},
|
||||
{8, "ENOEXEC", "exec format error"},
|
||||
{9, "EBADF", "bad file descriptor"},
|
||||
{10, "ECHILD", "no child processes"},
|
||||
{11, "EDEADLK", "resource deadlock avoided"},
|
||||
{12, "ENOMEM", "cannot allocate memory"},
|
||||
{13, "EACCES", "permission denied"},
|
||||
{14, "EFAULT", "bad address"},
|
||||
{15, "ENOTBLK", "block device required"},
|
||||
{16, "EBUSY", "resource busy"},
|
||||
{17, "EEXIST", "file exists"},
|
||||
{18, "EXDEV", "cross-device link"},
|
||||
{19, "ENODEV", "operation not supported by device"},
|
||||
{20, "ENOTDIR", "not a directory"},
|
||||
{21, "EISDIR", "is a directory"},
|
||||
{22, "EINVAL", "invalid argument"},
|
||||
{23, "ENFILE", "too many open files in system"},
|
||||
{24, "EMFILE", "too many open files"},
|
||||
{25, "ENOTTY", "inappropriate ioctl for device"},
|
||||
{26, "ETXTBSY", "text file busy"},
|
||||
{27, "EFBIG", "file too large"},
|
||||
{28, "ENOSPC", "no space left on device"},
|
||||
{29, "ESPIPE", "illegal seek"},
|
||||
{30, "EROFS", "read-only file system"},
|
||||
{31, "EMLINK", "too many links"},
|
||||
{32, "EPIPE", "broken pipe"},
|
||||
{33, "EDOM", "numerical argument out of domain"},
|
||||
{34, "ERANGE", "result too large"},
|
||||
{35, "EAGAIN", "resource temporarily unavailable"},
|
||||
{36, "EINPROGRESS", "operation now in progress"},
|
||||
{37, "EALREADY", "operation already in progress"},
|
||||
{38, "ENOTSOCK", "socket operation on non-socket"},
|
||||
{39, "EDESTADDRREQ", "destination address required"},
|
||||
{40, "EMSGSIZE", "message too long"},
|
||||
{41, "EPROTOTYPE", "protocol wrong type for socket"},
|
||||
{42, "ENOPROTOOPT", "protocol not available"},
|
||||
{43, "EPROTONOSUPPORT", "protocol not supported"},
|
||||
{44, "ESOCKTNOSUPPORT", "socket type not supported"},
|
||||
{45, "ENOTSUP", "operation not supported"},
|
||||
{46, "EPFNOSUPPORT", "protocol family not supported"},
|
||||
{47, "EAFNOSUPPORT", "address family not supported by protocol family"},
|
||||
{48, "EADDRINUSE", "address already in use"},
|
||||
{49, "EADDRNOTAVAIL", "can't assign requested address"},
|
||||
{50, "ENETDOWN", "network is down"},
|
||||
{51, "ENETUNREACH", "network is unreachable"},
|
||||
{52, "ENETRESET", "network dropped connection on reset"},
|
||||
{53, "ECONNABORTED", "software caused connection abort"},
|
||||
{54, "ECONNRESET", "connection reset by peer"},
|
||||
{55, "ENOBUFS", "no buffer space available"},
|
||||
{56, "EISCONN", "socket is already connected"},
|
||||
{57, "ENOTCONN", "socket is not connected"},
|
||||
{58, "ESHUTDOWN", "can't send after socket shutdown"},
|
||||
{59, "ETOOMANYREFS", "too many references: can't splice"},
|
||||
{60, "ETIMEDOUT", "operation timed out"},
|
||||
{61, "ECONNREFUSED", "connection refused"},
|
||||
{62, "ELOOP", "too many levels of symbolic links"},
|
||||
{63, "ENAMETOOLONG", "file name too long"},
|
||||
{64, "EHOSTDOWN", "host is down"},
|
||||
{65, "EHOSTUNREACH", "no route to host"},
|
||||
{66, "ENOTEMPTY", "directory not empty"},
|
||||
{67, "EPROCLIM", "too many processes"},
|
||||
{68, "EUSERS", "too many users"},
|
||||
{69, "EDQUOT", "disc quota exceeded"},
|
||||
{70, "ESTALE", "stale NFS file handle"},
|
||||
{71, "EREMOTE", "too many levels of remote in path"},
|
||||
{72, "EBADRPC", "RPC struct is bad"},
|
||||
{73, "ERPCMISMATCH", "RPC version wrong"},
|
||||
{74, "EPROGUNAVAIL", "RPC prog. not avail"},
|
||||
{75, "EPROGMISMATCH", "program version wrong"},
|
||||
{76, "EPROCUNAVAIL", "bad procedure for program"},
|
||||
{77, "ENOLCK", "no locks available"},
|
||||
{78, "ENOSYS", "function not implemented"},
|
||||
{79, "EFTYPE", "inappropriate file type or format"},
|
||||
{80, "EAUTH", "authentication error"},
|
||||
{81, "ENEEDAUTH", "need authenticator"},
|
||||
{82, "EPWROFF", "device power is off"},
|
||||
{83, "EDEVERR", "device error"},
|
||||
{84, "EOVERFLOW", "value too large to be stored in data type"},
|
||||
{85, "EBADEXEC", "bad executable (or shared library)"},
|
||||
{86, "EBADARCH", "bad CPU type in executable"},
|
||||
{87, "ESHLIBVERS", "shared library version mismatch"},
|
||||
{88, "EBADMACHO", "malformed Mach-o file"},
|
||||
{89, "ECANCELED", "operation canceled"},
|
||||
{90, "EIDRM", "identifier removed"},
|
||||
{91, "ENOMSG", "no message of desired type"},
|
||||
{92, "EILSEQ", "illegal byte sequence"},
|
||||
{93, "ENOATTR", "attribute not found"},
|
||||
{94, "EBADMSG", "bad message"},
|
||||
{95, "EMULTIHOP", "EMULTIHOP (Reserved)"},
|
||||
{96, "ENODATA", "no message available on STREAM"},
|
||||
{97, "ENOLINK", "ENOLINK (Reserved)"},
|
||||
{98, "ENOSR", "no STREAM resources"},
|
||||
{99, "ENOSTR", "not a STREAM"},
|
||||
{100, "EPROTO", "protocol error"},
|
||||
{101, "ETIME", "STREAM ioctl timeout"},
|
||||
{102, "EOPNOTSUPP", "operation not supported on socket"},
|
||||
{103, "ENOPOLICY", "policy not found"},
|
||||
{104, "ENOTRECOVERABLE", "state not recoverable"},
|
||||
{105, "EOWNERDEAD", "previous owner died"},
|
||||
{106, "EQFULL", "interface output queue is full"},
|
||||
}
|
||||
|
||||
// Signal table
|
||||
var signals = [...]string{
|
||||
1: "hangup",
|
||||
2: "interrupt",
|
||||
3: "quit",
|
||||
4: "illegal instruction",
|
||||
5: "trace/BPT trap",
|
||||
6: "abort trap",
|
||||
7: "EMT trap",
|
||||
8: "floating point exception",
|
||||
9: "killed",
|
||||
10: "bus error",
|
||||
11: "segmentation fault",
|
||||
12: "bad system call",
|
||||
13: "broken pipe",
|
||||
14: "alarm clock",
|
||||
15: "terminated",
|
||||
16: "urgent I/O condition",
|
||||
17: "suspended (signal)",
|
||||
18: "suspended",
|
||||
19: "continued",
|
||||
20: "child exited",
|
||||
21: "stopped (tty input)",
|
||||
22: "stopped (tty output)",
|
||||
23: "I/O possible",
|
||||
24: "cputime limit exceeded",
|
||||
25: "filesize limit exceeded",
|
||||
26: "virtual timer expired",
|
||||
27: "profiling timer expired",
|
||||
28: "window size changes",
|
||||
29: "information request",
|
||||
30: "user defined signal 1",
|
||||
31: "user defined signal 2",
|
||||
var signalList = [...]struct {
|
||||
num syscall.Signal
|
||||
name string
|
||||
desc string
|
||||
}{
|
||||
{1, "SIGHUP", "hangup"},
|
||||
{2, "SIGINT", "interrupt"},
|
||||
{3, "SIGQUIT", "quit"},
|
||||
{4, "SIGILL", "illegal instruction"},
|
||||
{5, "SIGTRAP", "trace/BPT trap"},
|
||||
{6, "SIGABRT", "abort trap"},
|
||||
{7, "SIGEMT", "EMT trap"},
|
||||
{8, "SIGFPE", "floating point exception"},
|
||||
{9, "SIGKILL", "killed"},
|
||||
{10, "SIGBUS", "bus error"},
|
||||
{11, "SIGSEGV", "segmentation fault"},
|
||||
{12, "SIGSYS", "bad system call"},
|
||||
{13, "SIGPIPE", "broken pipe"},
|
||||
{14, "SIGALRM", "alarm clock"},
|
||||
{15, "SIGTERM", "terminated"},
|
||||
{16, "SIGURG", "urgent I/O condition"},
|
||||
{17, "SIGSTOP", "suspended (signal)"},
|
||||
{18, "SIGTSTP", "suspended"},
|
||||
{19, "SIGCONT", "continued"},
|
||||
{20, "SIGCHLD", "child exited"},
|
||||
{21, "SIGTTIN", "stopped (tty input)"},
|
||||
{22, "SIGTTOU", "stopped (tty output)"},
|
||||
{23, "SIGIO", "I/O possible"},
|
||||
{24, "SIGXCPU", "cputime limit exceeded"},
|
||||
{25, "SIGXFSZ", "filesize limit exceeded"},
|
||||
{26, "SIGVTALRM", "virtual timer expired"},
|
||||
{27, "SIGPROF", "profiling timer expired"},
|
||||
{28, "SIGWINCH", "window size changes"},
|
||||
{29, "SIGINFO", "information request"},
|
||||
{30, "SIGUSR1", "user defined signal 1"},
|
||||
{31, "SIGUSR2", "user defined signal 2"},
|
||||
}
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user