= len(out) {
+ break
+ }
+ out[off] |= bb
+ }
+ }
+
+ return out[:]
+}
+
+// Equal returns 1 if v and u are equal, and 0 otherwise.
+func (v *Element) Equal(u *Element) int {
+ sa, sv := u.Bytes(), v.Bytes()
+ return subtle.ConstantTimeCompare(sa, sv)
+}
+
+// mask64Bits returns 0xffffffff if cond is 1, and 0 otherwise.
+func mask64Bits(cond int) uint64 { return ^(uint64(cond) - 1) }
+
+// Select sets v to a if cond == 1, and to b if cond == 0.
+func (v *Element) Select(a, b *Element, cond int) *Element {
+ m := mask64Bits(cond)
+ v.l0 = (m & a.l0) | (^m & b.l0)
+ v.l1 = (m & a.l1) | (^m & b.l1)
+ v.l2 = (m & a.l2) | (^m & b.l2)
+ v.l3 = (m & a.l3) | (^m & b.l3)
+ v.l4 = (m & a.l4) | (^m & b.l4)
+ return v
+}
+
+// Swap swaps v and u if cond == 1 or leaves them unchanged if cond == 0, and returns v.
+func (v *Element) Swap(u *Element, cond int) {
+ m := mask64Bits(cond)
+ t := m & (v.l0 ^ u.l0)
+ v.l0 ^= t
+ u.l0 ^= t
+ t = m & (v.l1 ^ u.l1)
+ v.l1 ^= t
+ u.l1 ^= t
+ t = m & (v.l2 ^ u.l2)
+ v.l2 ^= t
+ u.l2 ^= t
+ t = m & (v.l3 ^ u.l3)
+ v.l3 ^= t
+ u.l3 ^= t
+ t = m & (v.l4 ^ u.l4)
+ v.l4 ^= t
+ u.l4 ^= t
+}
+
+// IsNegative returns 1 if v is negative, and 0 otherwise.
+func (v *Element) IsNegative() int {
+ return int(v.Bytes()[0] & 1)
+}
+
+// Absolute sets v to |u|, and returns v.
+func (v *Element) Absolute(u *Element) *Element {
+ return v.Select(new(Element).Negate(u), u, u.IsNegative())
+}
+
+// Multiply sets v = x * y, and returns v.
+func (v *Element) Multiply(x, y *Element) *Element {
+ feMul(v, x, y)
+ return v
+}
+
+// Square sets v = x * x, and returns v.
+func (v *Element) Square(x *Element) *Element {
+ feSquare(v, x)
+ return v
+}
+
+// Mult32 sets v = x * y, and returns v.
+func (v *Element) Mult32(x *Element, y uint32) *Element {
+ x0lo, x0hi := mul51(x.l0, y)
+ x1lo, x1hi := mul51(x.l1, y)
+ x2lo, x2hi := mul51(x.l2, y)
+ x3lo, x3hi := mul51(x.l3, y)
+ x4lo, x4hi := mul51(x.l4, y)
+ v.l0 = x0lo + 19*x4hi // carried over per the reduction identity
+ v.l1 = x1lo + x0hi
+ v.l2 = x2lo + x1hi
+ v.l3 = x3lo + x2hi
+ v.l4 = x4lo + x3hi
+ // The hi portions are going to be only 32 bits, plus any previous excess,
+ // so we can skip the carry propagation.
+ return v
+}
+
+// mul51 returns lo + hi * 2⁵¹ = a * b.
+func mul51(a uint64, b uint32) (lo uint64, hi uint64) {
+ mh, ml := bits.Mul64(a, uint64(b))
+ lo = ml & maskLow51Bits
+ hi = (mh << 13) | (ml >> 51)
+ return
+}
+
+// Pow22523 set v = x^((p-5)/8), and returns v. (p-5)/8 is 2^252-3.
+func (v *Element) Pow22523(x *Element) *Element {
+ var t0, t1, t2 Element
+
+ t0.Square(x) // x^2
+ t1.Square(&t0) // x^4
+ t1.Square(&t1) // x^8
+ t1.Multiply(x, &t1) // x^9
+ t0.Multiply(&t0, &t1) // x^11
+ t0.Square(&t0) // x^22
+ t0.Multiply(&t1, &t0) // x^31
+ t1.Square(&t0) // x^62
+ for i := 1; i < 5; i++ { // x^992
+ t1.Square(&t1)
+ }
+ t0.Multiply(&t1, &t0) // x^1023 -> 1023 = 2^10 - 1
+ t1.Square(&t0) // 2^11 - 2
+ for i := 1; i < 10; i++ { // 2^20 - 2^10
+ t1.Square(&t1)
+ }
+ t1.Multiply(&t1, &t0) // 2^20 - 1
+ t2.Square(&t1) // 2^21 - 2
+ for i := 1; i < 20; i++ { // 2^40 - 2^20
+ t2.Square(&t2)
+ }
+ t1.Multiply(&t2, &t1) // 2^40 - 1
+ t1.Square(&t1) // 2^41 - 2
+ for i := 1; i < 10; i++ { // 2^50 - 2^10
+ t1.Square(&t1)
+ }
+ t0.Multiply(&t1, &t0) // 2^50 - 1
+ t1.Square(&t0) // 2^51 - 2
+ for i := 1; i < 50; i++ { // 2^100 - 2^50
+ t1.Square(&t1)
+ }
+ t1.Multiply(&t1, &t0) // 2^100 - 1
+ t2.Square(&t1) // 2^101 - 2
+ for i := 1; i < 100; i++ { // 2^200 - 2^100
+ t2.Square(&t2)
+ }
+ t1.Multiply(&t2, &t1) // 2^200 - 1
+ t1.Square(&t1) // 2^201 - 2
+ for i := 1; i < 50; i++ { // 2^250 - 2^50
+ t1.Square(&t1)
+ }
+ t0.Multiply(&t1, &t0) // 2^250 - 1
+ t0.Square(&t0) // 2^251 - 2
+ t0.Square(&t0) // 2^252 - 4
+ return v.Multiply(&t0, x) // 2^252 - 3 -> x^(2^252-3)
+}
+
+// sqrtM1 is 2^((p-1)/4), which squared is equal to -1 by Euler's Criterion.
+var sqrtM1 = &Element{1718705420411056, 234908883556509,
+ 2233514472574048, 2117202627021982, 765476049583133}
+
+// SqrtRatio sets r to the non-negative square root of the ratio of u and v.
+//
+// If u/v is square, SqrtRatio returns r and 1. If u/v is not square, SqrtRatio
+// sets r according to Section 4.3 of draft-irtf-cfrg-ristretto255-decaf448-00,
+// and returns r and 0.
+func (r *Element) SqrtRatio(u, v *Element) (rr *Element, wasSquare int) {
+ var a, b Element
+
+ // r = (u * v3) * (u * v7)^((p-5)/8)
+ v2 := a.Square(v)
+ uv3 := b.Multiply(u, b.Multiply(v2, v))
+ uv7 := a.Multiply(uv3, a.Square(v2))
+ r.Multiply(uv3, r.Pow22523(uv7))
+
+ check := a.Multiply(v, a.Square(r)) // check = v * r^2
+
+ uNeg := b.Negate(u)
+ correctSignSqrt := check.Equal(u)
+ flippedSignSqrt := check.Equal(uNeg)
+ flippedSignSqrtI := check.Equal(uNeg.Multiply(uNeg, sqrtM1))
+
+ rPrime := b.Multiply(r, sqrtM1) // r_prime = SQRT_M1 * r
+ // r = CT_SELECT(r_prime IF flipped_sign_sqrt | flipped_sign_sqrt_i ELSE r)
+ r.Select(rPrime, r, flippedSignSqrt|flippedSignSqrtI)
+
+ r.Absolute(r) // Choose the nonnegative square root.
+ return r, correctSignSqrt | flippedSignSqrt
+}
diff --git a/vendor/golang.org/x/crypto/curve25519/internal/field/fe_amd64.go b/vendor/golang.org/x/crypto/curve25519/internal/field/fe_amd64.go
new file mode 100644
index 00000000..70c54169
--- /dev/null
+++ b/vendor/golang.org/x/crypto/curve25519/internal/field/fe_amd64.go
@@ -0,0 +1,15 @@
+// Code generated by command: go run fe_amd64_asm.go -out ../fe_amd64.s -stubs ../fe_amd64.go -pkg field. DO NOT EDIT.
+
+//go:build amd64 && gc && !purego
+
+package field
+
+// feMul sets out = a * b. It works like feMulGeneric.
+//
+//go:noescape
+func feMul(out *Element, a *Element, b *Element)
+
+// feSquare sets out = a * a. It works like feSquareGeneric.
+//
+//go:noescape
+func feSquare(out *Element, a *Element)
diff --git a/vendor/golang.org/x/crypto/curve25519/internal/field/fe_amd64.s b/vendor/golang.org/x/crypto/curve25519/internal/field/fe_amd64.s
new file mode 100644
index 00000000..60817acc
--- /dev/null
+++ b/vendor/golang.org/x/crypto/curve25519/internal/field/fe_amd64.s
@@ -0,0 +1,378 @@
+// Code generated by command: go run fe_amd64_asm.go -out ../fe_amd64.s -stubs ../fe_amd64.go -pkg field. DO NOT EDIT.
+
+//go:build amd64 && gc && !purego
+
+#include "textflag.h"
+
+// func feMul(out *Element, a *Element, b *Element)
+TEXT ·feMul(SB), NOSPLIT, $0-24
+ MOVQ a+8(FP), CX
+ MOVQ b+16(FP), BX
+
+ // r0 = a0×b0
+ MOVQ (CX), AX
+ MULQ (BX)
+ MOVQ AX, DI
+ MOVQ DX, SI
+
+ // r0 += 19×a1×b4
+ MOVQ 8(CX), AX
+ IMUL3Q $0x13, AX, AX
+ MULQ 32(BX)
+ ADDQ AX, DI
+ ADCQ DX, SI
+
+ // r0 += 19×a2×b3
+ MOVQ 16(CX), AX
+ IMUL3Q $0x13, AX, AX
+ MULQ 24(BX)
+ ADDQ AX, DI
+ ADCQ DX, SI
+
+ // r0 += 19×a3×b2
+ MOVQ 24(CX), AX
+ IMUL3Q $0x13, AX, AX
+ MULQ 16(BX)
+ ADDQ AX, DI
+ ADCQ DX, SI
+
+ // r0 += 19×a4×b1
+ MOVQ 32(CX), AX
+ IMUL3Q $0x13, AX, AX
+ MULQ 8(BX)
+ ADDQ AX, DI
+ ADCQ DX, SI
+
+ // r1 = a0×b1
+ MOVQ (CX), AX
+ MULQ 8(BX)
+ MOVQ AX, R9
+ MOVQ DX, R8
+
+ // r1 += a1×b0
+ MOVQ 8(CX), AX
+ MULQ (BX)
+ ADDQ AX, R9
+ ADCQ DX, R8
+
+ // r1 += 19×a2×b4
+ MOVQ 16(CX), AX
+ IMUL3Q $0x13, AX, AX
+ MULQ 32(BX)
+ ADDQ AX, R9
+ ADCQ DX, R8
+
+ // r1 += 19×a3×b3
+ MOVQ 24(CX), AX
+ IMUL3Q $0x13, AX, AX
+ MULQ 24(BX)
+ ADDQ AX, R9
+ ADCQ DX, R8
+
+ // r1 += 19×a4×b2
+ MOVQ 32(CX), AX
+ IMUL3Q $0x13, AX, AX
+ MULQ 16(BX)
+ ADDQ AX, R9
+ ADCQ DX, R8
+
+ // r2 = a0×b2
+ MOVQ (CX), AX
+ MULQ 16(BX)
+ MOVQ AX, R11
+ MOVQ DX, R10
+
+ // r2 += a1×b1
+ MOVQ 8(CX), AX
+ MULQ 8(BX)
+ ADDQ AX, R11
+ ADCQ DX, R10
+
+ // r2 += a2×b0
+ MOVQ 16(CX), AX
+ MULQ (BX)
+ ADDQ AX, R11
+ ADCQ DX, R10
+
+ // r2 += 19×a3×b4
+ MOVQ 24(CX), AX
+ IMUL3Q $0x13, AX, AX
+ MULQ 32(BX)
+ ADDQ AX, R11
+ ADCQ DX, R10
+
+ // r2 += 19×a4×b3
+ MOVQ 32(CX), AX
+ IMUL3Q $0x13, AX, AX
+ MULQ 24(BX)
+ ADDQ AX, R11
+ ADCQ DX, R10
+
+ // r3 = a0×b3
+ MOVQ (CX), AX
+ MULQ 24(BX)
+ MOVQ AX, R13
+ MOVQ DX, R12
+
+ // r3 += a1×b2
+ MOVQ 8(CX), AX
+ MULQ 16(BX)
+ ADDQ AX, R13
+ ADCQ DX, R12
+
+ // r3 += a2×b1
+ MOVQ 16(CX), AX
+ MULQ 8(BX)
+ ADDQ AX, R13
+ ADCQ DX, R12
+
+ // r3 += a3×b0
+ MOVQ 24(CX), AX
+ MULQ (BX)
+ ADDQ AX, R13
+ ADCQ DX, R12
+
+ // r3 += 19×a4×b4
+ MOVQ 32(CX), AX
+ IMUL3Q $0x13, AX, AX
+ MULQ 32(BX)
+ ADDQ AX, R13
+ ADCQ DX, R12
+
+ // r4 = a0×b4
+ MOVQ (CX), AX
+ MULQ 32(BX)
+ MOVQ AX, R15
+ MOVQ DX, R14
+
+ // r4 += a1×b3
+ MOVQ 8(CX), AX
+ MULQ 24(BX)
+ ADDQ AX, R15
+ ADCQ DX, R14
+
+ // r4 += a2×b2
+ MOVQ 16(CX), AX
+ MULQ 16(BX)
+ ADDQ AX, R15
+ ADCQ DX, R14
+
+ // r4 += a3×b1
+ MOVQ 24(CX), AX
+ MULQ 8(BX)
+ ADDQ AX, R15
+ ADCQ DX, R14
+
+ // r4 += a4×b0
+ MOVQ 32(CX), AX
+ MULQ (BX)
+ ADDQ AX, R15
+ ADCQ DX, R14
+
+ // First reduction chain
+ MOVQ $0x0007ffffffffffff, AX
+ SHLQ $0x0d, DI, SI
+ SHLQ $0x0d, R9, R8
+ SHLQ $0x0d, R11, R10
+ SHLQ $0x0d, R13, R12
+ SHLQ $0x0d, R15, R14
+ ANDQ AX, DI
+ IMUL3Q $0x13, R14, R14
+ ADDQ R14, DI
+ ANDQ AX, R9
+ ADDQ SI, R9
+ ANDQ AX, R11
+ ADDQ R8, R11
+ ANDQ AX, R13
+ ADDQ R10, R13
+ ANDQ AX, R15
+ ADDQ R12, R15
+
+ // Second reduction chain (carryPropagate)
+ MOVQ DI, SI
+ SHRQ $0x33, SI
+ MOVQ R9, R8
+ SHRQ $0x33, R8
+ MOVQ R11, R10
+ SHRQ $0x33, R10
+ MOVQ R13, R12
+ SHRQ $0x33, R12
+ MOVQ R15, R14
+ SHRQ $0x33, R14
+ ANDQ AX, DI
+ IMUL3Q $0x13, R14, R14
+ ADDQ R14, DI
+ ANDQ AX, R9
+ ADDQ SI, R9
+ ANDQ AX, R11
+ ADDQ R8, R11
+ ANDQ AX, R13
+ ADDQ R10, R13
+ ANDQ AX, R15
+ ADDQ R12, R15
+
+ // Store output
+ MOVQ out+0(FP), AX
+ MOVQ DI, (AX)
+ MOVQ R9, 8(AX)
+ MOVQ R11, 16(AX)
+ MOVQ R13, 24(AX)
+ MOVQ R15, 32(AX)
+ RET
+
+// func feSquare(out *Element, a *Element)
+TEXT ·feSquare(SB), NOSPLIT, $0-16
+ MOVQ a+8(FP), CX
+
+ // r0 = l0×l0
+ MOVQ (CX), AX
+ MULQ (CX)
+ MOVQ AX, SI
+ MOVQ DX, BX
+
+ // r0 += 38×l1×l4
+ MOVQ 8(CX), AX
+ IMUL3Q $0x26, AX, AX
+ MULQ 32(CX)
+ ADDQ AX, SI
+ ADCQ DX, BX
+
+ // r0 += 38×l2×l3
+ MOVQ 16(CX), AX
+ IMUL3Q $0x26, AX, AX
+ MULQ 24(CX)
+ ADDQ AX, SI
+ ADCQ DX, BX
+
+ // r1 = 2×l0×l1
+ MOVQ (CX), AX
+ SHLQ $0x01, AX
+ MULQ 8(CX)
+ MOVQ AX, R8
+ MOVQ DX, DI
+
+ // r1 += 38×l2×l4
+ MOVQ 16(CX), AX
+ IMUL3Q $0x26, AX, AX
+ MULQ 32(CX)
+ ADDQ AX, R8
+ ADCQ DX, DI
+
+ // r1 += 19×l3×l3
+ MOVQ 24(CX), AX
+ IMUL3Q $0x13, AX, AX
+ MULQ 24(CX)
+ ADDQ AX, R8
+ ADCQ DX, DI
+
+ // r2 = 2×l0×l2
+ MOVQ (CX), AX
+ SHLQ $0x01, AX
+ MULQ 16(CX)
+ MOVQ AX, R10
+ MOVQ DX, R9
+
+ // r2 += l1×l1
+ MOVQ 8(CX), AX
+ MULQ 8(CX)
+ ADDQ AX, R10
+ ADCQ DX, R9
+
+ // r2 += 38×l3×l4
+ MOVQ 24(CX), AX
+ IMUL3Q $0x26, AX, AX
+ MULQ 32(CX)
+ ADDQ AX, R10
+ ADCQ DX, R9
+
+ // r3 = 2×l0×l3
+ MOVQ (CX), AX
+ SHLQ $0x01, AX
+ MULQ 24(CX)
+ MOVQ AX, R12
+ MOVQ DX, R11
+
+ // r3 += 2×l1×l2
+ MOVQ 8(CX), AX
+ IMUL3Q $0x02, AX, AX
+ MULQ 16(CX)
+ ADDQ AX, R12
+ ADCQ DX, R11
+
+ // r3 += 19×l4×l4
+ MOVQ 32(CX), AX
+ IMUL3Q $0x13, AX, AX
+ MULQ 32(CX)
+ ADDQ AX, R12
+ ADCQ DX, R11
+
+ // r4 = 2×l0×l4
+ MOVQ (CX), AX
+ SHLQ $0x01, AX
+ MULQ 32(CX)
+ MOVQ AX, R14
+ MOVQ DX, R13
+
+ // r4 += 2×l1×l3
+ MOVQ 8(CX), AX
+ IMUL3Q $0x02, AX, AX
+ MULQ 24(CX)
+ ADDQ AX, R14
+ ADCQ DX, R13
+
+ // r4 += l2×l2
+ MOVQ 16(CX), AX
+ MULQ 16(CX)
+ ADDQ AX, R14
+ ADCQ DX, R13
+
+ // First reduction chain
+ MOVQ $0x0007ffffffffffff, AX
+ SHLQ $0x0d, SI, BX
+ SHLQ $0x0d, R8, DI
+ SHLQ $0x0d, R10, R9
+ SHLQ $0x0d, R12, R11
+ SHLQ $0x0d, R14, R13
+ ANDQ AX, SI
+ IMUL3Q $0x13, R13, R13
+ ADDQ R13, SI
+ ANDQ AX, R8
+ ADDQ BX, R8
+ ANDQ AX, R10
+ ADDQ DI, R10
+ ANDQ AX, R12
+ ADDQ R9, R12
+ ANDQ AX, R14
+ ADDQ R11, R14
+
+ // Second reduction chain (carryPropagate)
+ MOVQ SI, BX
+ SHRQ $0x33, BX
+ MOVQ R8, DI
+ SHRQ $0x33, DI
+ MOVQ R10, R9
+ SHRQ $0x33, R9
+ MOVQ R12, R11
+ SHRQ $0x33, R11
+ MOVQ R14, R13
+ SHRQ $0x33, R13
+ ANDQ AX, SI
+ IMUL3Q $0x13, R13, R13
+ ADDQ R13, SI
+ ANDQ AX, R8
+ ADDQ BX, R8
+ ANDQ AX, R10
+ ADDQ DI, R10
+ ANDQ AX, R12
+ ADDQ R9, R12
+ ANDQ AX, R14
+ ADDQ R11, R14
+
+ // Store output
+ MOVQ out+0(FP), AX
+ MOVQ SI, (AX)
+ MOVQ R8, 8(AX)
+ MOVQ R10, 16(AX)
+ MOVQ R12, 24(AX)
+ MOVQ R14, 32(AX)
+ RET
diff --git a/vendor/golang.org/x/crypto/curve25519/internal/field/fe_amd64_noasm.go b/vendor/golang.org/x/crypto/curve25519/internal/field/fe_amd64_noasm.go
new file mode 100644
index 00000000..9da280d1
--- /dev/null
+++ b/vendor/golang.org/x/crypto/curve25519/internal/field/fe_amd64_noasm.go
@@ -0,0 +1,11 @@
+// Copyright (c) 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.
+
+//go:build !amd64 || !gc || purego
+
+package field
+
+func feMul(v, x, y *Element) { feMulGeneric(v, x, y) }
+
+func feSquare(v, x *Element) { feSquareGeneric(v, x) }
diff --git a/vendor/golang.org/x/crypto/curve25519/internal/field/fe_arm64.go b/vendor/golang.org/x/crypto/curve25519/internal/field/fe_arm64.go
new file mode 100644
index 00000000..075fe9b9
--- /dev/null
+++ b/vendor/golang.org/x/crypto/curve25519/internal/field/fe_arm64.go
@@ -0,0 +1,15 @@
+// Copyright (c) 2020 The Go Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style
+// license that can be found in the LICENSE file.
+
+//go:build arm64 && gc && !purego
+
+package field
+
+//go:noescape
+func carryPropagate(v *Element)
+
+func (v *Element) carryPropagate() *Element {
+ carryPropagate(v)
+ return v
+}
diff --git a/vendor/golang.org/x/crypto/curve25519/internal/field/fe_arm64.s b/vendor/golang.org/x/crypto/curve25519/internal/field/fe_arm64.s
new file mode 100644
index 00000000..3126a434
--- /dev/null
+++ b/vendor/golang.org/x/crypto/curve25519/internal/field/fe_arm64.s
@@ -0,0 +1,42 @@
+// Copyright (c) 2020 The Go Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style
+// license that can be found in the LICENSE file.
+
+//go:build arm64 && gc && !purego
+
+#include "textflag.h"
+
+// carryPropagate works exactly like carryPropagateGeneric and uses the
+// same AND, ADD, and LSR+MADD instructions emitted by the compiler, but
+// avoids loading R0-R4 twice and uses LDP and STP.
+//
+// See https://golang.org/issues/43145 for the main compiler issue.
+//
+// func carryPropagate(v *Element)
+TEXT ·carryPropagate(SB),NOFRAME|NOSPLIT,$0-8
+ MOVD v+0(FP), R20
+
+ LDP 0(R20), (R0, R1)
+ LDP 16(R20), (R2, R3)
+ MOVD 32(R20), R4
+
+ AND $0x7ffffffffffff, R0, R10
+ AND $0x7ffffffffffff, R1, R11
+ AND $0x7ffffffffffff, R2, R12
+ AND $0x7ffffffffffff, R3, R13
+ AND $0x7ffffffffffff, R4, R14
+
+ ADD R0>>51, R11, R11
+ ADD R1>>51, R12, R12
+ ADD R2>>51, R13, R13
+ ADD R3>>51, R14, R14
+ // R4>>51 * 19 + R10 -> R10
+ LSR $51, R4, R21
+ MOVD $19, R22
+ MADD R22, R10, R21, R10
+
+ STP (R10, R11), 0(R20)
+ STP (R12, R13), 16(R20)
+ MOVD R14, 32(R20)
+
+ RET
diff --git a/vendor/golang.org/x/crypto/curve25519/internal/field/fe_arm64_noasm.go b/vendor/golang.org/x/crypto/curve25519/internal/field/fe_arm64_noasm.go
new file mode 100644
index 00000000..fc029ac1
--- /dev/null
+++ b/vendor/golang.org/x/crypto/curve25519/internal/field/fe_arm64_noasm.go
@@ -0,0 +1,11 @@
+// Copyright (c) 2021 The Go Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style
+// license that can be found in the LICENSE file.
+
+//go:build !arm64 || !gc || purego
+
+package field
+
+func (v *Element) carryPropagate() *Element {
+ return v.carryPropagateGeneric()
+}
diff --git a/vendor/golang.org/x/crypto/curve25519/internal/field/fe_generic.go b/vendor/golang.org/x/crypto/curve25519/internal/field/fe_generic.go
new file mode 100644
index 00000000..2671217d
--- /dev/null
+++ b/vendor/golang.org/x/crypto/curve25519/internal/field/fe_generic.go
@@ -0,0 +1,264 @@
+// Copyright (c) 2017 The Go Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style
+// license that can be found in the LICENSE file.
+
+package field
+
+import "math/bits"
+
+// uint128 holds a 128-bit number as two 64-bit limbs, for use with the
+// bits.Mul64 and bits.Add64 intrinsics.
+type uint128 struct {
+ lo, hi uint64
+}
+
+// mul64 returns a * b.
+func mul64(a, b uint64) uint128 {
+ hi, lo := bits.Mul64(a, b)
+ return uint128{lo, hi}
+}
+
+// addMul64 returns v + a * b.
+func addMul64(v uint128, a, b uint64) uint128 {
+ hi, lo := bits.Mul64(a, b)
+ lo, c := bits.Add64(lo, v.lo, 0)
+ hi, _ = bits.Add64(hi, v.hi, c)
+ return uint128{lo, hi}
+}
+
+// shiftRightBy51 returns a >> 51. a is assumed to be at most 115 bits.
+func shiftRightBy51(a uint128) uint64 {
+ return (a.hi << (64 - 51)) | (a.lo >> 51)
+}
+
+func feMulGeneric(v, a, b *Element) {
+ a0 := a.l0
+ a1 := a.l1
+ a2 := a.l2
+ a3 := a.l3
+ a4 := a.l4
+
+ b0 := b.l0
+ b1 := b.l1
+ b2 := b.l2
+ b3 := b.l3
+ b4 := b.l4
+
+ // Limb multiplication works like pen-and-paper columnar multiplication, but
+ // with 51-bit limbs instead of digits.
+ //
+ // a4 a3 a2 a1 a0 x
+ // b4 b3 b2 b1 b0 =
+ // ------------------------
+ // a4b0 a3b0 a2b0 a1b0 a0b0 +
+ // a4b1 a3b1 a2b1 a1b1 a0b1 +
+ // a4b2 a3b2 a2b2 a1b2 a0b2 +
+ // a4b3 a3b3 a2b3 a1b3 a0b3 +
+ // a4b4 a3b4 a2b4 a1b4 a0b4 =
+ // ----------------------------------------------
+ // r8 r7 r6 r5 r4 r3 r2 r1 r0
+ //
+ // We can then use the reduction identity (a * 2²⁵⁵ + b = a * 19 + b) to
+ // reduce the limbs that would overflow 255 bits. r5 * 2²⁵⁵ becomes 19 * r5,
+ // r6 * 2³⁰⁶ becomes 19 * r6 * 2⁵¹, etc.
+ //
+ // Reduction can be carried out simultaneously to multiplication. For
+ // example, we do not compute r5: whenever the result of a multiplication
+ // belongs to r5, like a1b4, we multiply it by 19 and add the result to r0.
+ //
+ // a4b0 a3b0 a2b0 a1b0 a0b0 +
+ // a3b1 a2b1 a1b1 a0b1 19×a4b1 +
+ // a2b2 a1b2 a0b2 19×a4b2 19×a3b2 +
+ // a1b3 a0b3 19×a4b3 19×a3b3 19×a2b3 +
+ // a0b4 19×a4b4 19×a3b4 19×a2b4 19×a1b4 =
+ // --------------------------------------
+ // r4 r3 r2 r1 r0
+ //
+ // Finally we add up the columns into wide, overlapping limbs.
+
+ a1_19 := a1 * 19
+ a2_19 := a2 * 19
+ a3_19 := a3 * 19
+ a4_19 := a4 * 19
+
+ // r0 = a0×b0 + 19×(a1×b4 + a2×b3 + a3×b2 + a4×b1)
+ r0 := mul64(a0, b0)
+ r0 = addMul64(r0, a1_19, b4)
+ r0 = addMul64(r0, a2_19, b3)
+ r0 = addMul64(r0, a3_19, b2)
+ r0 = addMul64(r0, a4_19, b1)
+
+ // r1 = a0×b1 + a1×b0 + 19×(a2×b4 + a3×b3 + a4×b2)
+ r1 := mul64(a0, b1)
+ r1 = addMul64(r1, a1, b0)
+ r1 = addMul64(r1, a2_19, b4)
+ r1 = addMul64(r1, a3_19, b3)
+ r1 = addMul64(r1, a4_19, b2)
+
+ // r2 = a0×b2 + a1×b1 + a2×b0 + 19×(a3×b4 + a4×b3)
+ r2 := mul64(a0, b2)
+ r2 = addMul64(r2, a1, b1)
+ r2 = addMul64(r2, a2, b0)
+ r2 = addMul64(r2, a3_19, b4)
+ r2 = addMul64(r2, a4_19, b3)
+
+ // r3 = a0×b3 + a1×b2 + a2×b1 + a3×b0 + 19×a4×b4
+ r3 := mul64(a0, b3)
+ r3 = addMul64(r3, a1, b2)
+ r3 = addMul64(r3, a2, b1)
+ r3 = addMul64(r3, a3, b0)
+ r3 = addMul64(r3, a4_19, b4)
+
+ // r4 = a0×b4 + a1×b3 + a2×b2 + a3×b1 + a4×b0
+ r4 := mul64(a0, b4)
+ r4 = addMul64(r4, a1, b3)
+ r4 = addMul64(r4, a2, b2)
+ r4 = addMul64(r4, a3, b1)
+ r4 = addMul64(r4, a4, b0)
+
+ // After the multiplication, we need to reduce (carry) the five coefficients
+ // to obtain a result with limbs that are at most slightly larger than 2⁵¹,
+ // to respect the Element invariant.
+ //
+ // Overall, the reduction works the same as carryPropagate, except with
+ // wider inputs: we take the carry for each coefficient by shifting it right
+ // by 51, and add it to the limb above it. The top carry is multiplied by 19
+ // according to the reduction identity and added to the lowest limb.
+ //
+ // The largest coefficient (r0) will be at most 111 bits, which guarantees
+ // that all carries are at most 111 - 51 = 60 bits, which fits in a uint64.
+ //
+ // r0 = a0×b0 + 19×(a1×b4 + a2×b3 + a3×b2 + a4×b1)
+ // r0 < 2⁵²×2⁵² + 19×(2⁵²×2⁵² + 2⁵²×2⁵² + 2⁵²×2⁵² + 2⁵²×2⁵²)
+ // r0 < (1 + 19 × 4) × 2⁵² × 2⁵²
+ // r0 < 2⁷ × 2⁵² × 2⁵²
+ // r0 < 2¹¹¹
+ //
+ // Moreover, the top coefficient (r4) is at most 107 bits, so c4 is at most
+ // 56 bits, and c4 * 19 is at most 61 bits, which again fits in a uint64 and
+ // allows us to easily apply the reduction identity.
+ //
+ // r4 = a0×b4 + a1×b3 + a2×b2 + a3×b1 + a4×b0
+ // r4 < 5 × 2⁵² × 2⁵²
+ // r4 < 2¹⁰⁷
+ //
+
+ c0 := shiftRightBy51(r0)
+ c1 := shiftRightBy51(r1)
+ c2 := shiftRightBy51(r2)
+ c3 := shiftRightBy51(r3)
+ c4 := shiftRightBy51(r4)
+
+ rr0 := r0.lo&maskLow51Bits + c4*19
+ rr1 := r1.lo&maskLow51Bits + c0
+ rr2 := r2.lo&maskLow51Bits + c1
+ rr3 := r3.lo&maskLow51Bits + c2
+ rr4 := r4.lo&maskLow51Bits + c3
+
+ // Now all coefficients fit into 64-bit registers but are still too large to
+ // be passed around as a Element. We therefore do one last carry chain,
+ // where the carries will be small enough to fit in the wiggle room above 2⁵¹.
+ *v = Element{rr0, rr1, rr2, rr3, rr4}
+ v.carryPropagate()
+}
+
+func feSquareGeneric(v, a *Element) {
+ l0 := a.l0
+ l1 := a.l1
+ l2 := a.l2
+ l3 := a.l3
+ l4 := a.l4
+
+ // Squaring works precisely like multiplication above, but thanks to its
+ // symmetry we get to group a few terms together.
+ //
+ // l4 l3 l2 l1 l0 x
+ // l4 l3 l2 l1 l0 =
+ // ------------------------
+ // l4l0 l3l0 l2l0 l1l0 l0l0 +
+ // l4l1 l3l1 l2l1 l1l1 l0l1 +
+ // l4l2 l3l2 l2l2 l1l2 l0l2 +
+ // l4l3 l3l3 l2l3 l1l3 l0l3 +
+ // l4l4 l3l4 l2l4 l1l4 l0l4 =
+ // ----------------------------------------------
+ // r8 r7 r6 r5 r4 r3 r2 r1 r0
+ //
+ // l4l0 l3l0 l2l0 l1l0 l0l0 +
+ // l3l1 l2l1 l1l1 l0l1 19×l4l1 +
+ // l2l2 l1l2 l0l2 19×l4l2 19×l3l2 +
+ // l1l3 l0l3 19×l4l3 19×l3l3 19×l2l3 +
+ // l0l4 19×l4l4 19×l3l4 19×l2l4 19×l1l4 =
+ // --------------------------------------
+ // r4 r3 r2 r1 r0
+ //
+ // With precomputed 2×, 19×, and 2×19× terms, we can compute each limb with
+ // only three Mul64 and four Add64, instead of five and eight.
+
+ l0_2 := l0 * 2
+ l1_2 := l1 * 2
+
+ l1_38 := l1 * 38
+ l2_38 := l2 * 38
+ l3_38 := l3 * 38
+
+ l3_19 := l3 * 19
+ l4_19 := l4 * 19
+
+ // r0 = l0×l0 + 19×(l1×l4 + l2×l3 + l3×l2 + l4×l1) = l0×l0 + 19×2×(l1×l4 + l2×l3)
+ r0 := mul64(l0, l0)
+ r0 = addMul64(r0, l1_38, l4)
+ r0 = addMul64(r0, l2_38, l3)
+
+ // r1 = l0×l1 + l1×l0 + 19×(l2×l4 + l3×l3 + l4×l2) = 2×l0×l1 + 19×2×l2×l4 + 19×l3×l3
+ r1 := mul64(l0_2, l1)
+ r1 = addMul64(r1, l2_38, l4)
+ r1 = addMul64(r1, l3_19, l3)
+
+ // r2 = l0×l2 + l1×l1 + l2×l0 + 19×(l3×l4 + l4×l3) = 2×l0×l2 + l1×l1 + 19×2×l3×l4
+ r2 := mul64(l0_2, l2)
+ r2 = addMul64(r2, l1, l1)
+ r2 = addMul64(r2, l3_38, l4)
+
+ // r3 = l0×l3 + l1×l2 + l2×l1 + l3×l0 + 19×l4×l4 = 2×l0×l3 + 2×l1×l2 + 19×l4×l4
+ r3 := mul64(l0_2, l3)
+ r3 = addMul64(r3, l1_2, l2)
+ r3 = addMul64(r3, l4_19, l4)
+
+ // r4 = l0×l4 + l1×l3 + l2×l2 + l3×l1 + l4×l0 = 2×l0×l4 + 2×l1×l3 + l2×l2
+ r4 := mul64(l0_2, l4)
+ r4 = addMul64(r4, l1_2, l3)
+ r4 = addMul64(r4, l2, l2)
+
+ c0 := shiftRightBy51(r0)
+ c1 := shiftRightBy51(r1)
+ c2 := shiftRightBy51(r2)
+ c3 := shiftRightBy51(r3)
+ c4 := shiftRightBy51(r4)
+
+ rr0 := r0.lo&maskLow51Bits + c4*19
+ rr1 := r1.lo&maskLow51Bits + c0
+ rr2 := r2.lo&maskLow51Bits + c1
+ rr3 := r3.lo&maskLow51Bits + c2
+ rr4 := r4.lo&maskLow51Bits + c3
+
+ *v = Element{rr0, rr1, rr2, rr3, rr4}
+ v.carryPropagate()
+}
+
+// carryPropagateGeneric brings the limbs below 52 bits by applying the reduction
+// identity (a * 2²⁵⁵ + b = a * 19 + b) to the l4 carry. TODO inline
+func (v *Element) carryPropagateGeneric() *Element {
+ c0 := v.l0 >> 51
+ c1 := v.l1 >> 51
+ c2 := v.l2 >> 51
+ c3 := v.l3 >> 51
+ c4 := v.l4 >> 51
+
+ v.l0 = v.l0&maskLow51Bits + c4*19
+ v.l1 = v.l1&maskLow51Bits + c0
+ v.l2 = v.l2&maskLow51Bits + c1
+ v.l3 = v.l3&maskLow51Bits + c2
+ v.l4 = v.l4&maskLow51Bits + c3
+
+ return v
+}
diff --git a/vendor/golang.org/x/crypto/curve25519/internal/field/sync.checkpoint b/vendor/golang.org/x/crypto/curve25519/internal/field/sync.checkpoint
new file mode 100644
index 00000000..e3685f95
--- /dev/null
+++ b/vendor/golang.org/x/crypto/curve25519/internal/field/sync.checkpoint
@@ -0,0 +1 @@
+b0c49ae9f59d233526f8934262c5bbbe14d4358d
diff --git a/vendor/golang.org/x/crypto/curve25519/internal/field/sync.sh b/vendor/golang.org/x/crypto/curve25519/internal/field/sync.sh
new file mode 100644
index 00000000..1ba22a8b
--- /dev/null
+++ b/vendor/golang.org/x/crypto/curve25519/internal/field/sync.sh
@@ -0,0 +1,19 @@
+#! /bin/bash
+set -euo pipefail
+
+cd "$(git rev-parse --show-toplevel)"
+
+STD_PATH=src/crypto/ed25519/internal/edwards25519/field
+LOCAL_PATH=curve25519/internal/field
+LAST_SYNC_REF=$(cat $LOCAL_PATH/sync.checkpoint)
+
+git fetch https://go.googlesource.com/go master
+
+if git diff --quiet $LAST_SYNC_REF:$STD_PATH FETCH_HEAD:$STD_PATH; then
+ echo "No changes."
+else
+ NEW_REF=$(git rev-parse FETCH_HEAD | tee $LOCAL_PATH/sync.checkpoint)
+ echo "Applying changes from $LAST_SYNC_REF to $NEW_REF..."
+ git diff $LAST_SYNC_REF:$STD_PATH FETCH_HEAD:$STD_PATH | \
+ git apply -3 --directory=$LOCAL_PATH
+fi
diff --git a/vendor/golang.org/x/crypto/hkdf/hkdf.go b/vendor/golang.org/x/crypto/hkdf/hkdf.go
new file mode 100644
index 00000000..f4ded5fe
--- /dev/null
+++ b/vendor/golang.org/x/crypto/hkdf/hkdf.go
@@ -0,0 +1,95 @@
+// 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.
+
+// Package hkdf implements the HMAC-based Extract-and-Expand Key Derivation
+// Function (HKDF) as defined in RFC 5869.
+//
+// HKDF is a cryptographic key derivation function (KDF) with the goal of
+// expanding limited input keying material into one or more cryptographically
+// strong secret keys.
+package hkdf // import "golang.org/x/crypto/hkdf"
+
+import (
+ "crypto/hmac"
+ "errors"
+ "hash"
+ "io"
+)
+
+// Extract generates a pseudorandom key for use with Expand from an input secret
+// and an optional independent salt.
+//
+// Only use this function if you need to reuse the extracted key with multiple
+// Expand invocations and different context values. Most common scenarios,
+// including the generation of multiple keys, should use New instead.
+func Extract(hash func() hash.Hash, secret, salt []byte) []byte {
+ if salt == nil {
+ salt = make([]byte, hash().Size())
+ }
+ extractor := hmac.New(hash, salt)
+ extractor.Write(secret)
+ return extractor.Sum(nil)
+}
+
+type hkdf struct {
+ expander hash.Hash
+ size int
+
+ info []byte
+ counter byte
+
+ prev []byte
+ buf []byte
+}
+
+func (f *hkdf) Read(p []byte) (int, error) {
+ // Check whether enough data can be generated
+ need := len(p)
+ remains := len(f.buf) + int(255-f.counter+1)*f.size
+ if remains < need {
+ return 0, errors.New("hkdf: entropy limit reached")
+ }
+ // Read any leftover from the buffer
+ n := copy(p, f.buf)
+ p = p[n:]
+
+ // Fill the rest of the buffer
+ for len(p) > 0 {
+ if f.counter > 1 {
+ f.expander.Reset()
+ }
+ f.expander.Write(f.prev)
+ f.expander.Write(f.info)
+ f.expander.Write([]byte{f.counter})
+ f.prev = f.expander.Sum(f.prev[:0])
+ f.counter++
+
+ // Copy the new batch into p
+ f.buf = f.prev
+ n = copy(p, f.buf)
+ p = p[n:]
+ }
+ // Save leftovers for next run
+ f.buf = f.buf[n:]
+
+ return need, nil
+}
+
+// Expand returns a Reader, from which keys can be read, using the given
+// pseudorandom key and optional context info, skipping the extraction step.
+//
+// The pseudorandomKey should have been generated by Extract, or be a uniformly
+// random or pseudorandom cryptographically strong key. See RFC 5869, Section
+// 3.3. Most common scenarios will want to use New instead.
+func Expand(hash func() hash.Hash, pseudorandomKey, info []byte) io.Reader {
+ expander := hmac.New(hash, pseudorandomKey)
+ return &hkdf{expander, expander.Size(), info, 1, nil, nil}
+}
+
+// New returns a Reader, from which keys can be read, using the given hash,
+// secret, salt and context info. Salt and info can be nil.
+func New(hash func() hash.Hash, secret, salt, info []byte) io.Reader {
+ prk := Extract(hash, secret, salt)
+ return Expand(hash, prk, info)
+}
diff --git a/vendor/golang.org/x/crypto/internal/alias/alias.go b/vendor/golang.org/x/crypto/internal/alias/alias.go
new file mode 100644
index 00000000..551ff0c3
--- /dev/null
+++ b/vendor/golang.org/x/crypto/internal/alias/alias.go
@@ -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.
+
+//go:build !purego
+
+// Package alias implements memory aliasing tests.
+package alias
+
+import "unsafe"
+
+// AnyOverlap reports whether x and y share memory at any (not necessarily
+// corresponding) index. The memory beyond the slice length is ignored.
+func AnyOverlap(x, y []byte) bool {
+ return len(x) > 0 && len(y) > 0 &&
+ uintptr(unsafe.Pointer(&x[0])) <= uintptr(unsafe.Pointer(&y[len(y)-1])) &&
+ uintptr(unsafe.Pointer(&y[0])) <= uintptr(unsafe.Pointer(&x[len(x)-1]))
+}
+
+// InexactOverlap reports whether x and y share memory at any non-corresponding
+// index. The memory beyond the slice length is ignored. Note that x and y can
+// have different lengths and still not have any inexact overlap.
+//
+// InexactOverlap can be used to implement the requirements of the crypto/cipher
+// AEAD, Block, BlockMode and Stream interfaces.
+func InexactOverlap(x, y []byte) bool {
+ if len(x) == 0 || len(y) == 0 || &x[0] == &y[0] {
+ return false
+ }
+ return AnyOverlap(x, y)
+}
diff --git a/vendor/golang.org/x/crypto/internal/alias/alias_purego.go b/vendor/golang.org/x/crypto/internal/alias/alias_purego.go
new file mode 100644
index 00000000..6fe61b5c
--- /dev/null
+++ b/vendor/golang.org/x/crypto/internal/alias/alias_purego.go
@@ -0,0 +1,34 @@
+// Copyright 2018 The Go Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style
+// license that can be found in the LICENSE file.
+
+//go:build purego
+
+// Package alias implements memory aliasing tests.
+package alias
+
+// This is the Google App Engine standard variant based on reflect
+// because the unsafe package and cgo are disallowed.
+
+import "reflect"
+
+// AnyOverlap reports whether x and y share memory at any (not necessarily
+// corresponding) index. The memory beyond the slice length is ignored.
+func AnyOverlap(x, y []byte) bool {
+ return len(x) > 0 && len(y) > 0 &&
+ reflect.ValueOf(&x[0]).Pointer() <= reflect.ValueOf(&y[len(y)-1]).Pointer() &&
+ reflect.ValueOf(&y[0]).Pointer() <= reflect.ValueOf(&x[len(x)-1]).Pointer()
+}
+
+// InexactOverlap reports whether x and y share memory at any non-corresponding
+// index. The memory beyond the slice length is ignored. Note that x and y can
+// have different lengths and still not have any inexact overlap.
+//
+// InexactOverlap can be used to implement the requirements of the crypto/cipher
+// AEAD, Block, BlockMode and Stream interfaces.
+func InexactOverlap(x, y []byte) bool {
+ if len(x) == 0 || len(y) == 0 || &x[0] == &y[0] {
+ return false
+ }
+ return AnyOverlap(x, y)
+}
diff --git a/vendor/golang.org/x/crypto/internal/poly1305/bits_compat.go b/vendor/golang.org/x/crypto/internal/poly1305/bits_compat.go
new file mode 100644
index 00000000..d33c8890
--- /dev/null
+++ b/vendor/golang.org/x/crypto/internal/poly1305/bits_compat.go
@@ -0,0 +1,39 @@
+// 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.
+
+//go:build !go1.13
+
+package poly1305
+
+// Generic fallbacks for the math/bits intrinsics, copied from
+// src/math/bits/bits.go. They were added in Go 1.12, but Add64 and Sum64 had
+// variable time fallbacks until Go 1.13.
+
+func bitsAdd64(x, y, carry uint64) (sum, carryOut uint64) {
+ sum = x + y + carry
+ carryOut = ((x & y) | ((x | y) &^ sum)) >> 63
+ return
+}
+
+func bitsSub64(x, y, borrow uint64) (diff, borrowOut uint64) {
+ diff = x - y - borrow
+ borrowOut = ((^x & y) | (^(x ^ y) & diff)) >> 63
+ return
+}
+
+func bitsMul64(x, y uint64) (hi, lo uint64) {
+ const mask32 = 1<<32 - 1
+ x0 := x & mask32
+ x1 := x >> 32
+ y0 := y & mask32
+ y1 := y >> 32
+ w0 := x0 * y0
+ t := x1*y0 + w0>>32
+ w1 := t & mask32
+ w2 := t >> 32
+ w1 += x0 * y1
+ hi = x1*y1 + w2 + w1>>32
+ lo = x * y
+ return
+}
diff --git a/vendor/golang.org/x/crypto/internal/poly1305/bits_go1.13.go b/vendor/golang.org/x/crypto/internal/poly1305/bits_go1.13.go
new file mode 100644
index 00000000..495c1fa6
--- /dev/null
+++ b/vendor/golang.org/x/crypto/internal/poly1305/bits_go1.13.go
@@ -0,0 +1,21 @@
+// 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.
+
+//go:build go1.13
+
+package poly1305
+
+import "math/bits"
+
+func bitsAdd64(x, y, carry uint64) (sum, carryOut uint64) {
+ return bits.Add64(x, y, carry)
+}
+
+func bitsSub64(x, y, borrow uint64) (diff, borrowOut uint64) {
+ return bits.Sub64(x, y, borrow)
+}
+
+func bitsMul64(x, y uint64) (hi, lo uint64) {
+ return bits.Mul64(x, y)
+}
diff --git a/vendor/golang.org/x/crypto/internal/poly1305/mac_noasm.go b/vendor/golang.org/x/crypto/internal/poly1305/mac_noasm.go
new file mode 100644
index 00000000..333da285
--- /dev/null
+++ b/vendor/golang.org/x/crypto/internal/poly1305/mac_noasm.go
@@ -0,0 +1,9 @@
+// Copyright 2018 The Go Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style
+// license that can be found in the LICENSE file.
+
+//go:build (!amd64 && !ppc64le && !s390x) || !gc || purego
+
+package poly1305
+
+type mac struct{ macGeneric }
diff --git a/vendor/golang.org/x/crypto/internal/poly1305/poly1305.go b/vendor/golang.org/x/crypto/internal/poly1305/poly1305.go
new file mode 100644
index 00000000..4aaea810
--- /dev/null
+++ b/vendor/golang.org/x/crypto/internal/poly1305/poly1305.go
@@ -0,0 +1,99 @@
+// Copyright 2012 The Go Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style
+// license that can be found in the LICENSE file.
+
+// Package poly1305 implements Poly1305 one-time message authentication code as
+// specified in https://cr.yp.to/mac/poly1305-20050329.pdf.
+//
+// Poly1305 is a fast, one-time authentication function. It is infeasible for an
+// attacker to generate an authenticator for a message without the key. However, a
+// key must only be used for a single message. Authenticating two different
+// messages with the same key allows an attacker to forge authenticators for other
+// messages with the same key.
+//
+// Poly1305 was originally coupled with AES in order to make Poly1305-AES. AES was
+// used with a fixed key in order to generate one-time keys from an nonce.
+// However, in this package AES isn't used and the one-time key is specified
+// directly.
+package poly1305
+
+import "crypto/subtle"
+
+// TagSize is the size, in bytes, of a poly1305 authenticator.
+const TagSize = 16
+
+// Sum generates an authenticator for msg using a one-time key and puts the
+// 16-byte result into out. Authenticating two different messages with the same
+// key allows an attacker to forge messages at will.
+func Sum(out *[16]byte, m []byte, key *[32]byte) {
+ h := New(key)
+ h.Write(m)
+ h.Sum(out[:0])
+}
+
+// Verify returns true if mac is a valid authenticator for m with the given key.
+func Verify(mac *[16]byte, m []byte, key *[32]byte) bool {
+ var tmp [16]byte
+ Sum(&tmp, m, key)
+ return subtle.ConstantTimeCompare(tmp[:], mac[:]) == 1
+}
+
+// New returns a new MAC computing an authentication
+// tag of all data written to it with the given key.
+// This allows writing the message progressively instead
+// of passing it as a single slice. Common users should use
+// the Sum function instead.
+//
+// The key must be unique for each message, as authenticating
+// two different messages with the same key allows an attacker
+// to forge messages at will.
+func New(key *[32]byte) *MAC {
+ m := &MAC{}
+ initialize(key, &m.macState)
+ return m
+}
+
+// MAC is an io.Writer computing an authentication tag
+// of the data written to it.
+//
+// MAC cannot be used like common hash.Hash implementations,
+// because using a poly1305 key twice breaks its security.
+// Therefore writing data to a running MAC after calling
+// Sum or Verify causes it to panic.
+type MAC struct {
+ mac // platform-dependent implementation
+
+ finalized bool
+}
+
+// Size returns the number of bytes Sum will return.
+func (h *MAC) Size() int { return TagSize }
+
+// Write adds more data to the running message authentication code.
+// It never returns an error.
+//
+// It must not be called after the first call of Sum or Verify.
+func (h *MAC) Write(p []byte) (n int, err error) {
+ if h.finalized {
+ panic("poly1305: write to MAC after Sum or Verify")
+ }
+ return h.mac.Write(p)
+}
+
+// Sum computes the authenticator of all data written to the
+// message authentication code.
+func (h *MAC) Sum(b []byte) []byte {
+ var mac [TagSize]byte
+ h.mac.Sum(&mac)
+ h.finalized = true
+ return append(b, mac[:]...)
+}
+
+// Verify returns whether the authenticator of all data written to
+// the message authentication code matches the expected value.
+func (h *MAC) Verify(expected []byte) bool {
+ var mac [TagSize]byte
+ h.mac.Sum(&mac)
+ h.finalized = true
+ return subtle.ConstantTimeCompare(expected, mac[:]) == 1
+}
diff --git a/vendor/golang.org/x/crypto/internal/poly1305/sum_amd64.go b/vendor/golang.org/x/crypto/internal/poly1305/sum_amd64.go
new file mode 100644
index 00000000..164cd47d
--- /dev/null
+++ b/vendor/golang.org/x/crypto/internal/poly1305/sum_amd64.go
@@ -0,0 +1,47 @@
+// Copyright 2012 The Go Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style
+// license that can be found in the LICENSE file.
+
+//go:build gc && !purego
+
+package poly1305
+
+//go:noescape
+func update(state *macState, msg []byte)
+
+// mac is a wrapper for macGeneric that redirects calls that would have gone to
+// updateGeneric to update.
+//
+// Its Write and Sum methods are otherwise identical to the macGeneric ones, but
+// using function pointers would carry a major performance cost.
+type mac struct{ macGeneric }
+
+func (h *mac) Write(p []byte) (int, error) {
+ nn := len(p)
+ if h.offset > 0 {
+ n := copy(h.buffer[h.offset:], p)
+ if h.offset+n < TagSize {
+ h.offset += n
+ return nn, nil
+ }
+ p = p[n:]
+ h.offset = 0
+ update(&h.macState, h.buffer[:])
+ }
+ if n := len(p) - (len(p) % TagSize); n > 0 {
+ update(&h.macState, p[:n])
+ p = p[n:]
+ }
+ if len(p) > 0 {
+ h.offset += copy(h.buffer[h.offset:], p)
+ }
+ return nn, nil
+}
+
+func (h *mac) Sum(out *[16]byte) {
+ state := h.macState
+ if h.offset > 0 {
+ update(&state, h.buffer[:h.offset])
+ }
+ finalize(out, &state.h, &state.s)
+}
diff --git a/vendor/golang.org/x/crypto/internal/poly1305/sum_amd64.s b/vendor/golang.org/x/crypto/internal/poly1305/sum_amd64.s
new file mode 100644
index 00000000..e0d3c647
--- /dev/null
+++ b/vendor/golang.org/x/crypto/internal/poly1305/sum_amd64.s
@@ -0,0 +1,108 @@
+// Copyright 2012 The Go Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style
+// license that can be found in the LICENSE file.
+
+//go:build gc && !purego
+
+#include "textflag.h"
+
+#define POLY1305_ADD(msg, h0, h1, h2) \
+ ADDQ 0(msg), h0; \
+ ADCQ 8(msg), h1; \
+ ADCQ $1, h2; \
+ LEAQ 16(msg), msg
+
+#define POLY1305_MUL(h0, h1, h2, r0, r1, t0, t1, t2, t3) \
+ MOVQ r0, AX; \
+ MULQ h0; \
+ MOVQ AX, t0; \
+ MOVQ DX, t1; \
+ MOVQ r0, AX; \
+ MULQ h1; \
+ ADDQ AX, t1; \
+ ADCQ $0, DX; \
+ MOVQ r0, t2; \
+ IMULQ h2, t2; \
+ ADDQ DX, t2; \
+ \
+ MOVQ r1, AX; \
+ MULQ h0; \
+ ADDQ AX, t1; \
+ ADCQ $0, DX; \
+ MOVQ DX, h0; \
+ MOVQ r1, t3; \
+ IMULQ h2, t3; \
+ MOVQ r1, AX; \
+ MULQ h1; \
+ ADDQ AX, t2; \
+ ADCQ DX, t3; \
+ ADDQ h0, t2; \
+ ADCQ $0, t3; \
+ \
+ MOVQ t0, h0; \
+ MOVQ t1, h1; \
+ MOVQ t2, h2; \
+ ANDQ $3, h2; \
+ MOVQ t2, t0; \
+ ANDQ $0xFFFFFFFFFFFFFFFC, t0; \
+ ADDQ t0, h0; \
+ ADCQ t3, h1; \
+ ADCQ $0, h2; \
+ SHRQ $2, t3, t2; \
+ SHRQ $2, t3; \
+ ADDQ t2, h0; \
+ ADCQ t3, h1; \
+ ADCQ $0, h2
+
+// func update(state *[7]uint64, msg []byte)
+TEXT ·update(SB), $0-32
+ MOVQ state+0(FP), DI
+ MOVQ msg_base+8(FP), SI
+ MOVQ msg_len+16(FP), R15
+
+ MOVQ 0(DI), R8 // h0
+ MOVQ 8(DI), R9 // h1
+ MOVQ 16(DI), R10 // h2
+ MOVQ 24(DI), R11 // r0
+ MOVQ 32(DI), R12 // r1
+
+ CMPQ R15, $16
+ JB bytes_between_0_and_15
+
+loop:
+ POLY1305_ADD(SI, R8, R9, R10)
+
+multiply:
+ POLY1305_MUL(R8, R9, R10, R11, R12, BX, CX, R13, R14)
+ SUBQ $16, R15
+ CMPQ R15, $16
+ JAE loop
+
+bytes_between_0_and_15:
+ TESTQ R15, R15
+ JZ done
+ MOVQ $1, BX
+ XORQ CX, CX
+ XORQ R13, R13
+ ADDQ R15, SI
+
+flush_buffer:
+ SHLQ $8, BX, CX
+ SHLQ $8, BX
+ MOVB -1(SI), R13
+ XORQ R13, BX
+ DECQ SI
+ DECQ R15
+ JNZ flush_buffer
+
+ ADDQ BX, R8
+ ADCQ CX, R9
+ ADCQ $0, R10
+ MOVQ $16, R15
+ JMP multiply
+
+done:
+ MOVQ R8, 0(DI)
+ MOVQ R9, 8(DI)
+ MOVQ R10, 16(DI)
+ RET
diff --git a/vendor/golang.org/x/crypto/internal/poly1305/sum_generic.go b/vendor/golang.org/x/crypto/internal/poly1305/sum_generic.go
new file mode 100644
index 00000000..e041da5e
--- /dev/null
+++ b/vendor/golang.org/x/crypto/internal/poly1305/sum_generic.go
@@ -0,0 +1,309 @@
+// Copyright 2018 The Go Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style
+// license that can be found in the LICENSE file.
+
+// This file provides the generic implementation of Sum and MAC. Other files
+// might provide optimized assembly implementations of some of this code.
+
+package poly1305
+
+import "encoding/binary"
+
+// Poly1305 [RFC 7539] is a relatively simple algorithm: the authentication tag
+// for a 64 bytes message is approximately
+//
+// s + m[0:16] * r⁴ + m[16:32] * r³ + m[32:48] * r² + m[48:64] * r mod 2¹³⁰ - 5
+//
+// for some secret r and s. It can be computed sequentially like
+//
+// for len(msg) > 0:
+// h += read(msg, 16)
+// h *= r
+// h %= 2¹³⁰ - 5
+// return h + s
+//
+// All the complexity is about doing performant constant-time math on numbers
+// larger than any available numeric type.
+
+func sumGeneric(out *[TagSize]byte, msg []byte, key *[32]byte) {
+ h := newMACGeneric(key)
+ h.Write(msg)
+ h.Sum(out)
+}
+
+func newMACGeneric(key *[32]byte) macGeneric {
+ m := macGeneric{}
+ initialize(key, &m.macState)
+ return m
+}
+
+// macState holds numbers in saturated 64-bit little-endian limbs. That is,
+// the value of [x0, x1, x2] is x[0] + x[1] * 2⁶⁴ + x[2] * 2¹²⁸.
+type macState struct {
+ // h is the main accumulator. It is to be interpreted modulo 2¹³⁰ - 5, but
+ // can grow larger during and after rounds. It must, however, remain below
+ // 2 * (2¹³⁰ - 5).
+ h [3]uint64
+ // r and s are the private key components.
+ r [2]uint64
+ s [2]uint64
+}
+
+type macGeneric struct {
+ macState
+
+ buffer [TagSize]byte
+ offset int
+}
+
+// Write splits the incoming message into TagSize chunks, and passes them to
+// update. It buffers incomplete chunks.
+func (h *macGeneric) Write(p []byte) (int, error) {
+ nn := len(p)
+ if h.offset > 0 {
+ n := copy(h.buffer[h.offset:], p)
+ if h.offset+n < TagSize {
+ h.offset += n
+ return nn, nil
+ }
+ p = p[n:]
+ h.offset = 0
+ updateGeneric(&h.macState, h.buffer[:])
+ }
+ if n := len(p) - (len(p) % TagSize); n > 0 {
+ updateGeneric(&h.macState, p[:n])
+ p = p[n:]
+ }
+ if len(p) > 0 {
+ h.offset += copy(h.buffer[h.offset:], p)
+ }
+ return nn, nil
+}
+
+// Sum flushes the last incomplete chunk from the buffer, if any, and generates
+// the MAC output. It does not modify its state, in order to allow for multiple
+// calls to Sum, even if no Write is allowed after Sum.
+func (h *macGeneric) Sum(out *[TagSize]byte) {
+ state := h.macState
+ if h.offset > 0 {
+ updateGeneric(&state, h.buffer[:h.offset])
+ }
+ finalize(out, &state.h, &state.s)
+}
+
+// [rMask0, rMask1] is the specified Poly1305 clamping mask in little-endian. It
+// clears some bits of the secret coefficient to make it possible to implement
+// multiplication more efficiently.
+const (
+ rMask0 = 0x0FFFFFFC0FFFFFFF
+ rMask1 = 0x0FFFFFFC0FFFFFFC
+)
+
+// initialize loads the 256-bit key into the two 128-bit secret values r and s.
+func initialize(key *[32]byte, m *macState) {
+ m.r[0] = binary.LittleEndian.Uint64(key[0:8]) & rMask0
+ m.r[1] = binary.LittleEndian.Uint64(key[8:16]) & rMask1
+ m.s[0] = binary.LittleEndian.Uint64(key[16:24])
+ m.s[1] = binary.LittleEndian.Uint64(key[24:32])
+}
+
+// uint128 holds a 128-bit number as two 64-bit limbs, for use with the
+// bits.Mul64 and bits.Add64 intrinsics.
+type uint128 struct {
+ lo, hi uint64
+}
+
+func mul64(a, b uint64) uint128 {
+ hi, lo := bitsMul64(a, b)
+ return uint128{lo, hi}
+}
+
+func add128(a, b uint128) uint128 {
+ lo, c := bitsAdd64(a.lo, b.lo, 0)
+ hi, c := bitsAdd64(a.hi, b.hi, c)
+ if c != 0 {
+ panic("poly1305: unexpected overflow")
+ }
+ return uint128{lo, hi}
+}
+
+func shiftRightBy2(a uint128) uint128 {
+ a.lo = a.lo>>2 | (a.hi&3)<<62
+ a.hi = a.hi >> 2
+ return a
+}
+
+// updateGeneric absorbs msg into the state.h accumulator. For each chunk m of
+// 128 bits of message, it computes
+//
+// h₊ = (h + m) * r mod 2¹³⁰ - 5
+//
+// If the msg length is not a multiple of TagSize, it assumes the last
+// incomplete chunk is the final one.
+func updateGeneric(state *macState, msg []byte) {
+ h0, h1, h2 := state.h[0], state.h[1], state.h[2]
+ r0, r1 := state.r[0], state.r[1]
+
+ for len(msg) > 0 {
+ var c uint64
+
+ // For the first step, h + m, we use a chain of bits.Add64 intrinsics.
+ // The resulting value of h might exceed 2¹³⁰ - 5, but will be partially
+ // reduced at the end of the multiplication below.
+ //
+ // The spec requires us to set a bit just above the message size, not to
+ // hide leading zeroes. For full chunks, that's 1 << 128, so we can just
+ // add 1 to the most significant (2¹²⁸) limb, h2.
+ if len(msg) >= TagSize {
+ h0, c = bitsAdd64(h0, binary.LittleEndian.Uint64(msg[0:8]), 0)
+ h1, c = bitsAdd64(h1, binary.LittleEndian.Uint64(msg[8:16]), c)
+ h2 += c + 1
+
+ msg = msg[TagSize:]
+ } else {
+ var buf [TagSize]byte
+ copy(buf[:], msg)
+ buf[len(msg)] = 1
+
+ h0, c = bitsAdd64(h0, binary.LittleEndian.Uint64(buf[0:8]), 0)
+ h1, c = bitsAdd64(h1, binary.LittleEndian.Uint64(buf[8:16]), c)
+ h2 += c
+
+ msg = nil
+ }
+
+ // Multiplication of big number limbs is similar to elementary school
+ // columnar multiplication. Instead of digits, there are 64-bit limbs.
+ //
+ // We are multiplying a 3 limbs number, h, by a 2 limbs number, r.
+ //
+ // h2 h1 h0 x
+ // r1 r0 =
+ // ----------------
+ // h2r0 h1r0 h0r0 <-- individual 128-bit products
+ // + h2r1 h1r1 h0r1
+ // ------------------------
+ // m3 m2 m1 m0 <-- result in 128-bit overlapping limbs
+ // ------------------------
+ // m3.hi m2.hi m1.hi m0.hi <-- carry propagation
+ // + m3.lo m2.lo m1.lo m0.lo
+ // -------------------------------
+ // t4 t3 t2 t1 t0 <-- final result in 64-bit limbs
+ //
+ // The main difference from pen-and-paper multiplication is that we do
+ // carry propagation in a separate step, as if we wrote two digit sums
+ // at first (the 128-bit limbs), and then carried the tens all at once.
+
+ h0r0 := mul64(h0, r0)
+ h1r0 := mul64(h1, r0)
+ h2r0 := mul64(h2, r0)
+ h0r1 := mul64(h0, r1)
+ h1r1 := mul64(h1, r1)
+ h2r1 := mul64(h2, r1)
+
+ // Since h2 is known to be at most 7 (5 + 1 + 1), and r0 and r1 have their
+ // top 4 bits cleared by rMask{0,1}, we know that their product is not going
+ // to overflow 64 bits, so we can ignore the high part of the products.
+ //
+ // This also means that the product doesn't have a fifth limb (t4).
+ if h2r0.hi != 0 {
+ panic("poly1305: unexpected overflow")
+ }
+ if h2r1.hi != 0 {
+ panic("poly1305: unexpected overflow")
+ }
+
+ m0 := h0r0
+ m1 := add128(h1r0, h0r1) // These two additions don't overflow thanks again
+ m2 := add128(h2r0, h1r1) // to the 4 masked bits at the top of r0 and r1.
+ m3 := h2r1
+
+ t0 := m0.lo
+ t1, c := bitsAdd64(m1.lo, m0.hi, 0)
+ t2, c := bitsAdd64(m2.lo, m1.hi, c)
+ t3, _ := bitsAdd64(m3.lo, m2.hi, c)
+
+ // Now we have the result as 4 64-bit limbs, and we need to reduce it
+ // modulo 2¹³⁰ - 5. The special shape of this Crandall prime lets us do
+ // a cheap partial reduction according to the reduction identity
+ //
+ // c * 2¹³⁰ + n = c * 5 + n mod 2¹³⁰ - 5
+ //
+ // because 2¹³⁰ = 5 mod 2¹³⁰ - 5. Partial reduction since the result is
+ // likely to be larger than 2¹³⁰ - 5, but still small enough to fit the
+ // assumptions we make about h in the rest of the code.
+ //
+ // See also https://speakerdeck.com/gtank/engineering-prime-numbers?slide=23
+
+ // We split the final result at the 2¹³⁰ mark into h and cc, the carry.
+ // Note that the carry bits are effectively shifted left by 2, in other
+ // words, cc = c * 4 for the c in the reduction identity.
+ h0, h1, h2 = t0, t1, t2&maskLow2Bits
+ cc := uint128{t2 & maskNotLow2Bits, t3}
+
+ // To add c * 5 to h, we first add cc = c * 4, and then add (cc >> 2) = c.
+
+ h0, c = bitsAdd64(h0, cc.lo, 0)
+ h1, c = bitsAdd64(h1, cc.hi, c)
+ h2 += c
+
+ cc = shiftRightBy2(cc)
+
+ h0, c = bitsAdd64(h0, cc.lo, 0)
+ h1, c = bitsAdd64(h1, cc.hi, c)
+ h2 += c
+
+ // h2 is at most 3 + 1 + 1 = 5, making the whole of h at most
+ //
+ // 5 * 2¹²⁸ + (2¹²⁸ - 1) = 6 * 2¹²⁸ - 1
+ }
+
+ state.h[0], state.h[1], state.h[2] = h0, h1, h2
+}
+
+const (
+ maskLow2Bits uint64 = 0x0000000000000003
+ maskNotLow2Bits uint64 = ^maskLow2Bits
+)
+
+// select64 returns x if v == 1 and y if v == 0, in constant time.
+func select64(v, x, y uint64) uint64 { return ^(v-1)&x | (v-1)&y }
+
+// [p0, p1, p2] is 2¹³⁰ - 5 in little endian order.
+const (
+ p0 = 0xFFFFFFFFFFFFFFFB
+ p1 = 0xFFFFFFFFFFFFFFFF
+ p2 = 0x0000000000000003
+)
+
+// finalize completes the modular reduction of h and computes
+//
+// out = h + s mod 2¹²⁸
+func finalize(out *[TagSize]byte, h *[3]uint64, s *[2]uint64) {
+ h0, h1, h2 := h[0], h[1], h[2]
+
+ // After the partial reduction in updateGeneric, h might be more than
+ // 2¹³⁰ - 5, but will be less than 2 * (2¹³⁰ - 5). To complete the reduction
+ // in constant time, we compute t = h - (2¹³⁰ - 5), and select h as the
+ // result if the subtraction underflows, and t otherwise.
+
+ hMinusP0, b := bitsSub64(h0, p0, 0)
+ hMinusP1, b := bitsSub64(h1, p1, b)
+ _, b = bitsSub64(h2, p2, b)
+
+ // h = h if h < p else h - p
+ h0 = select64(b, h0, hMinusP0)
+ h1 = select64(b, h1, hMinusP1)
+
+ // Finally, we compute the last Poly1305 step
+ //
+ // tag = h + s mod 2¹²⁸
+ //
+ // by just doing a wide addition with the 128 low bits of h and discarding
+ // the overflow.
+ h0, c := bitsAdd64(h0, s[0], 0)
+ h1, _ = bitsAdd64(h1, s[1], c)
+
+ binary.LittleEndian.PutUint64(out[0:8], h0)
+ binary.LittleEndian.PutUint64(out[8:16], h1)
+}
diff --git a/vendor/golang.org/x/crypto/internal/poly1305/sum_ppc64le.go b/vendor/golang.org/x/crypto/internal/poly1305/sum_ppc64le.go
new file mode 100644
index 00000000..4aec4874
--- /dev/null
+++ b/vendor/golang.org/x/crypto/internal/poly1305/sum_ppc64le.go
@@ -0,0 +1,47 @@
+// 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.
+
+//go:build gc && !purego
+
+package poly1305
+
+//go:noescape
+func update(state *macState, msg []byte)
+
+// mac is a wrapper for macGeneric that redirects calls that would have gone to
+// updateGeneric to update.
+//
+// Its Write and Sum methods are otherwise identical to the macGeneric ones, but
+// using function pointers would carry a major performance cost.
+type mac struct{ macGeneric }
+
+func (h *mac) Write(p []byte) (int, error) {
+ nn := len(p)
+ if h.offset > 0 {
+ n := copy(h.buffer[h.offset:], p)
+ if h.offset+n < TagSize {
+ h.offset += n
+ return nn, nil
+ }
+ p = p[n:]
+ h.offset = 0
+ update(&h.macState, h.buffer[:])
+ }
+ if n := len(p) - (len(p) % TagSize); n > 0 {
+ update(&h.macState, p[:n])
+ p = p[n:]
+ }
+ if len(p) > 0 {
+ h.offset += copy(h.buffer[h.offset:], p)
+ }
+ return nn, nil
+}
+
+func (h *mac) Sum(out *[16]byte) {
+ state := h.macState
+ if h.offset > 0 {
+ update(&state, h.buffer[:h.offset])
+ }
+ finalize(out, &state.h, &state.s)
+}
diff --git a/vendor/golang.org/x/crypto/internal/poly1305/sum_ppc64le.s b/vendor/golang.org/x/crypto/internal/poly1305/sum_ppc64le.s
new file mode 100644
index 00000000..d2ca5dee
--- /dev/null
+++ b/vendor/golang.org/x/crypto/internal/poly1305/sum_ppc64le.s
@@ -0,0 +1,181 @@
+// 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.
+
+//go:build gc && !purego
+
+#include "textflag.h"
+
+// This was ported from the amd64 implementation.
+
+#define POLY1305_ADD(msg, h0, h1, h2, t0, t1, t2) \
+ MOVD (msg), t0; \
+ MOVD 8(msg), t1; \
+ MOVD $1, t2; \
+ ADDC t0, h0, h0; \
+ ADDE t1, h1, h1; \
+ ADDE t2, h2; \
+ ADD $16, msg
+
+#define POLY1305_MUL(h0, h1, h2, r0, r1, t0, t1, t2, t3, t4, t5) \
+ MULLD r0, h0, t0; \
+ MULLD r0, h1, t4; \
+ MULHDU r0, h0, t1; \
+ MULHDU r0, h1, t5; \
+ ADDC t4, t1, t1; \
+ MULLD r0, h2, t2; \
+ ADDZE t5; \
+ MULHDU r1, h0, t4; \
+ MULLD r1, h0, h0; \
+ ADD t5, t2, t2; \
+ ADDC h0, t1, t1; \
+ MULLD h2, r1, t3; \
+ ADDZE t4, h0; \
+ MULHDU r1, h1, t5; \
+ MULLD r1, h1, t4; \
+ ADDC t4, t2, t2; \
+ ADDE t5, t3, t3; \
+ ADDC h0, t2, t2; \
+ MOVD $-4, t4; \
+ MOVD t0, h0; \
+ MOVD t1, h1; \
+ ADDZE t3; \
+ ANDCC $3, t2, h2; \
+ AND t2, t4, t0; \
+ ADDC t0, h0, h0; \
+ ADDE t3, h1, h1; \
+ SLD $62, t3, t4; \
+ SRD $2, t2; \
+ ADDZE h2; \
+ OR t4, t2, t2; \
+ SRD $2, t3; \
+ ADDC t2, h0, h0; \
+ ADDE t3, h1, h1; \
+ ADDZE h2
+
+DATA ·poly1305Mask<>+0x00(SB)/8, $0x0FFFFFFC0FFFFFFF
+DATA ·poly1305Mask<>+0x08(SB)/8, $0x0FFFFFFC0FFFFFFC
+GLOBL ·poly1305Mask<>(SB), RODATA, $16
+
+// func update(state *[7]uint64, msg []byte)
+TEXT ·update(SB), $0-32
+ MOVD state+0(FP), R3
+ MOVD msg_base+8(FP), R4
+ MOVD msg_len+16(FP), R5
+
+ MOVD 0(R3), R8 // h0
+ MOVD 8(R3), R9 // h1
+ MOVD 16(R3), R10 // h2
+ MOVD 24(R3), R11 // r0
+ MOVD 32(R3), R12 // r1
+
+ CMP R5, $16
+ BLT bytes_between_0_and_15
+
+loop:
+ POLY1305_ADD(R4, R8, R9, R10, R20, R21, R22)
+
+multiply:
+ POLY1305_MUL(R8, R9, R10, R11, R12, R16, R17, R18, R14, R20, R21)
+ ADD $-16, R5
+ CMP R5, $16
+ BGE loop
+
+bytes_between_0_and_15:
+ CMP R5, $0
+ BEQ done
+ MOVD $0, R16 // h0
+ MOVD $0, R17 // h1
+
+flush_buffer:
+ CMP R5, $8
+ BLE just1
+
+ MOVD $8, R21
+ SUB R21, R5, R21
+
+ // Greater than 8 -- load the rightmost remaining bytes in msg
+ // and put into R17 (h1)
+ MOVD (R4)(R21), R17
+ MOVD $16, R22
+
+ // Find the offset to those bytes
+ SUB R5, R22, R22
+ SLD $3, R22
+
+ // Shift to get only the bytes in msg
+ SRD R22, R17, R17
+
+ // Put 1 at high end
+ MOVD $1, R23
+ SLD $3, R21
+ SLD R21, R23, R23
+ OR R23, R17, R17
+
+ // Remainder is 8
+ MOVD $8, R5
+
+just1:
+ CMP R5, $8
+ BLT less8
+
+ // Exactly 8
+ MOVD (R4), R16
+
+ CMP R17, $0
+
+ // Check if we've already set R17; if not
+ // set 1 to indicate end of msg.
+ BNE carry
+ MOVD $1, R17
+ BR carry
+
+less8:
+ MOVD $0, R16 // h0
+ MOVD $0, R22 // shift count
+ CMP R5, $4
+ BLT less4
+ MOVWZ (R4), R16
+ ADD $4, R4
+ ADD $-4, R5
+ MOVD $32, R22
+
+less4:
+ CMP R5, $2
+ BLT less2
+ MOVHZ (R4), R21
+ SLD R22, R21, R21
+ OR R16, R21, R16
+ ADD $16, R22
+ ADD $-2, R5
+ ADD $2, R4
+
+less2:
+ CMP R5, $0
+ BEQ insert1
+ MOVBZ (R4), R21
+ SLD R22, R21, R21
+ OR R16, R21, R16
+ ADD $8, R22
+
+insert1:
+ // Insert 1 at end of msg
+ MOVD $1, R21
+ SLD R22, R21, R21
+ OR R16, R21, R16
+
+carry:
+ // Add new values to h0, h1, h2
+ ADDC R16, R8
+ ADDE R17, R9
+ ADDZE R10, R10
+ MOVD $16, R5
+ ADD R5, R4
+ BR multiply
+
+done:
+ // Save h0, h1, h2 in state
+ MOVD R8, 0(R3)
+ MOVD R9, 8(R3)
+ MOVD R10, 16(R3)
+ RET
diff --git a/vendor/golang.org/x/crypto/internal/poly1305/sum_s390x.go b/vendor/golang.org/x/crypto/internal/poly1305/sum_s390x.go
new file mode 100644
index 00000000..e1d033a4
--- /dev/null
+++ b/vendor/golang.org/x/crypto/internal/poly1305/sum_s390x.go
@@ -0,0 +1,76 @@
+// Copyright 2018 The Go Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style
+// license that can be found in the LICENSE file.
+
+//go:build gc && !purego
+
+package poly1305
+
+import (
+ "golang.org/x/sys/cpu"
+)
+
+// updateVX is an assembly implementation of Poly1305 that uses vector
+// instructions. It must only be called if the vector facility (vx) is
+// available.
+//
+//go:noescape
+func updateVX(state *macState, msg []byte)
+
+// mac is a replacement for macGeneric that uses a larger buffer and redirects
+// calls that would have gone to updateGeneric to updateVX if the vector
+// facility is installed.
+//
+// A larger buffer is required for good performance because the vector
+// implementation has a higher fixed cost per call than the generic
+// implementation.
+type mac struct {
+ macState
+
+ buffer [16 * TagSize]byte // size must be a multiple of block size (16)
+ offset int
+}
+
+func (h *mac) Write(p []byte) (int, error) {
+ nn := len(p)
+ if h.offset > 0 {
+ n := copy(h.buffer[h.offset:], p)
+ if h.offset+n < len(h.buffer) {
+ h.offset += n
+ return nn, nil
+ }
+ p = p[n:]
+ h.offset = 0
+ if cpu.S390X.HasVX {
+ updateVX(&h.macState, h.buffer[:])
+ } else {
+ updateGeneric(&h.macState, h.buffer[:])
+ }
+ }
+
+ tail := len(p) % len(h.buffer) // number of bytes to copy into buffer
+ body := len(p) - tail // number of bytes to process now
+ if body > 0 {
+ if cpu.S390X.HasVX {
+ updateVX(&h.macState, p[:body])
+ } else {
+ updateGeneric(&h.macState, p[:body])
+ }
+ }
+ h.offset = copy(h.buffer[:], p[body:]) // copy tail bytes - can be 0
+ return nn, nil
+}
+
+func (h *mac) Sum(out *[TagSize]byte) {
+ state := h.macState
+ remainder := h.buffer[:h.offset]
+
+ // Use the generic implementation if we have 2 or fewer blocks left
+ // to sum. The vector implementation has a higher startup time.
+ if cpu.S390X.HasVX && len(remainder) > 2*TagSize {
+ updateVX(&state, remainder)
+ } else if len(remainder) > 0 {
+ updateGeneric(&state, remainder)
+ }
+ finalize(out, &state.h, &state.s)
+}
diff --git a/vendor/golang.org/x/crypto/internal/poly1305/sum_s390x.s b/vendor/golang.org/x/crypto/internal/poly1305/sum_s390x.s
new file mode 100644
index 00000000..0fe3a7c2
--- /dev/null
+++ b/vendor/golang.org/x/crypto/internal/poly1305/sum_s390x.s
@@ -0,0 +1,503 @@
+// Copyright 2018 The Go Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style
+// license that can be found in the LICENSE file.
+
+//go:build gc && !purego
+
+#include "textflag.h"
+
+// This implementation of Poly1305 uses the vector facility (vx)
+// to process up to 2 blocks (32 bytes) per iteration using an
+// algorithm based on the one described in:
+//
+// NEON crypto, Daniel J. Bernstein & Peter Schwabe
+// https://cryptojedi.org/papers/neoncrypto-20120320.pdf
+//
+// This algorithm uses 5 26-bit limbs to represent a 130-bit
+// value. These limbs are, for the most part, zero extended and
+// placed into 64-bit vector register elements. Each vector
+// register is 128-bits wide and so holds 2 of these elements.
+// Using 26-bit limbs allows us plenty of headroom to accommodate
+// accumulations before and after multiplication without
+// overflowing either 32-bits (before multiplication) or 64-bits
+// (after multiplication).
+//
+// In order to parallelise the operations required to calculate
+// the sum we use two separate accumulators and then sum those
+// in an extra final step. For compatibility with the generic
+// implementation we perform this summation at the end of every
+// updateVX call.
+//
+// To use two accumulators we must multiply the message blocks
+// by r² rather than r. Only the final message block should be
+// multiplied by r.
+//
+// Example:
+//
+// We want to calculate the sum (h) for a 64 byte message (m):
+//
+// h = m[0:16]r⁴ + m[16:32]r³ + m[32:48]r² + m[48:64]r
+//
+// To do this we split the calculation into the even indices
+// and odd indices of the message. These form our SIMD 'lanes':
+//
+// h = m[ 0:16]r⁴ + m[32:48]r² + <- lane 0
+// m[16:32]r³ + m[48:64]r <- lane 1
+//
+// To calculate this iteratively we refactor so that both lanes
+// are written in terms of r² and r:
+//
+// h = (m[ 0:16]r² + m[32:48])r² + <- lane 0
+// (m[16:32]r² + m[48:64])r <- lane 1
+// ^ ^
+// | coefficients for second iteration
+// coefficients for first iteration
+//
+// So in this case we would have two iterations. In the first
+// both lanes are multiplied by r². In the second only the
+// first lane is multiplied by r² and the second lane is
+// instead multiplied by r. This gives use the odd and even
+// powers of r that we need from the original equation.
+//
+// Notation:
+//
+// h - accumulator
+// r - key
+// m - message
+//
+// [a, b] - SIMD register holding two 64-bit values
+// [a, b, c, d] - SIMD register holding four 32-bit values
+// xᵢ[n] - limb n of variable x with bit width i
+//
+// Limbs are expressed in little endian order, so for 26-bit
+// limbs x₂₆[4] will be the most significant limb and x₂₆[0]
+// will be the least significant limb.
+
+// masking constants
+#define MOD24 V0 // [0x0000000000ffffff, 0x0000000000ffffff] - mask low 24-bits
+#define MOD26 V1 // [0x0000000003ffffff, 0x0000000003ffffff] - mask low 26-bits
+
+// expansion constants (see EXPAND macro)
+#define EX0 V2
+#define EX1 V3
+#define EX2 V4
+
+// key (r², r or 1 depending on context)
+#define R_0 V5
+#define R_1 V6
+#define R_2 V7
+#define R_3 V8
+#define R_4 V9
+
+// precalculated coefficients (5r², 5r or 0 depending on context)
+#define R5_1 V10
+#define R5_2 V11
+#define R5_3 V12
+#define R5_4 V13
+
+// message block (m)
+#define M_0 V14
+#define M_1 V15
+#define M_2 V16
+#define M_3 V17
+#define M_4 V18
+
+// accumulator (h)
+#define H_0 V19
+#define H_1 V20
+#define H_2 V21
+#define H_3 V22
+#define H_4 V23
+
+// temporary registers (for short-lived values)
+#define T_0 V24
+#define T_1 V25
+#define T_2 V26
+#define T_3 V27
+#define T_4 V28
+
+GLOBL ·constants<>(SB), RODATA, $0x30
+// EX0
+DATA ·constants<>+0x00(SB)/8, $0x0006050403020100
+DATA ·constants<>+0x08(SB)/8, $0x1016151413121110
+// EX1
+DATA ·constants<>+0x10(SB)/8, $0x060c0b0a09080706
+DATA ·constants<>+0x18(SB)/8, $0x161c1b1a19181716
+// EX2
+DATA ·constants<>+0x20(SB)/8, $0x0d0d0d0d0d0f0e0d
+DATA ·constants<>+0x28(SB)/8, $0x1d1d1d1d1d1f1e1d
+
+// MULTIPLY multiplies each lane of f and g, partially reduced
+// modulo 2¹³⁰ - 5. The result, h, consists of partial products
+// in each lane that need to be reduced further to produce the
+// final result.
+//
+// h₁₃₀ = (f₁₃₀g₁₃₀) % 2¹³⁰ + (5f₁₃₀g₁₃₀) / 2¹³⁰
+//
+// Note that the multiplication by 5 of the high bits is
+// achieved by precalculating the multiplication of four of the
+// g coefficients by 5. These are g51-g54.
+#define MULTIPLY(f0, f1, f2, f3, f4, g0, g1, g2, g3, g4, g51, g52, g53, g54, h0, h1, h2, h3, h4) \
+ VMLOF f0, g0, h0 \
+ VMLOF f0, g3, h3 \
+ VMLOF f0, g1, h1 \
+ VMLOF f0, g4, h4 \
+ VMLOF f0, g2, h2 \
+ VMLOF f1, g54, T_0 \
+ VMLOF f1, g2, T_3 \
+ VMLOF f1, g0, T_1 \
+ VMLOF f1, g3, T_4 \
+ VMLOF f1, g1, T_2 \
+ VMALOF f2, g53, h0, h0 \
+ VMALOF f2, g1, h3, h3 \
+ VMALOF f2, g54, h1, h1 \
+ VMALOF f2, g2, h4, h4 \
+ VMALOF f2, g0, h2, h2 \
+ VMALOF f3, g52, T_0, T_0 \
+ VMALOF f3, g0, T_3, T_3 \
+ VMALOF f3, g53, T_1, T_1 \
+ VMALOF f3, g1, T_4, T_4 \
+ VMALOF f3, g54, T_2, T_2 \
+ VMALOF f4, g51, h0, h0 \
+ VMALOF f4, g54, h3, h3 \
+ VMALOF f4, g52, h1, h1 \
+ VMALOF f4, g0, h4, h4 \
+ VMALOF f4, g53, h2, h2 \
+ VAG T_0, h0, h0 \
+ VAG T_3, h3, h3 \
+ VAG T_1, h1, h1 \
+ VAG T_4, h4, h4 \
+ VAG T_2, h2, h2
+
+// REDUCE performs the following carry operations in four
+// stages, as specified in Bernstein & Schwabe:
+//
+// 1: h₂₆[0]->h₂₆[1] h₂₆[3]->h₂₆[4]
+// 2: h₂₆[1]->h₂₆[2] h₂₆[4]->h₂₆[0]
+// 3: h₂₆[0]->h₂₆[1] h₂₆[2]->h₂₆[3]
+// 4: h₂₆[3]->h₂₆[4]
+//
+// The result is that all of the limbs are limited to 26-bits
+// except for h₂₆[1] and h₂₆[4] which are limited to 27-bits.
+//
+// Note that although each limb is aligned at 26-bit intervals
+// they may contain values that exceed 2²⁶ - 1, hence the need
+// to carry the excess bits in each limb.
+#define REDUCE(h0, h1, h2, h3, h4) \
+ VESRLG $26, h0, T_0 \
+ VESRLG $26, h3, T_1 \
+ VN MOD26, h0, h0 \
+ VN MOD26, h3, h3 \
+ VAG T_0, h1, h1 \
+ VAG T_1, h4, h4 \
+ VESRLG $26, h1, T_2 \
+ VESRLG $26, h4, T_3 \
+ VN MOD26, h1, h1 \
+ VN MOD26, h4, h4 \
+ VESLG $2, T_3, T_4 \
+ VAG T_3, T_4, T_4 \
+ VAG T_2, h2, h2 \
+ VAG T_4, h0, h0 \
+ VESRLG $26, h2, T_0 \
+ VESRLG $26, h0, T_1 \
+ VN MOD26, h2, h2 \
+ VN MOD26, h0, h0 \
+ VAG T_0, h3, h3 \
+ VAG T_1, h1, h1 \
+ VESRLG $26, h3, T_2 \
+ VN MOD26, h3, h3 \
+ VAG T_2, h4, h4
+
+// EXPAND splits the 128-bit little-endian values in0 and in1
+// into 26-bit big-endian limbs and places the results into
+// the first and second lane of d₂₆[0:4] respectively.
+//
+// The EX0, EX1 and EX2 constants are arrays of byte indices
+// for permutation. The permutation both reverses the bytes
+// in the input and ensures the bytes are copied into the
+// destination limb ready to be shifted into their final
+// position.
+#define EXPAND(in0, in1, d0, d1, d2, d3, d4) \
+ VPERM in0, in1, EX0, d0 \
+ VPERM in0, in1, EX1, d2 \
+ VPERM in0, in1, EX2, d4 \
+ VESRLG $26, d0, d1 \
+ VESRLG $30, d2, d3 \
+ VESRLG $4, d2, d2 \
+ VN MOD26, d0, d0 \ // [in0₂₆[0], in1₂₆[0]]
+ VN MOD26, d3, d3 \ // [in0₂₆[3], in1₂₆[3]]
+ VN MOD26, d1, d1 \ // [in0₂₆[1], in1₂₆[1]]
+ VN MOD24, d4, d4 \ // [in0₂₆[4], in1₂₆[4]]
+ VN MOD26, d2, d2 // [in0₂₆[2], in1₂₆[2]]
+
+// func updateVX(state *macState, msg []byte)
+TEXT ·updateVX(SB), NOSPLIT, $0
+ MOVD state+0(FP), R1
+ LMG msg+8(FP), R2, R3 // R2=msg_base, R3=msg_len
+
+ // load EX0, EX1 and EX2
+ MOVD $·constants<>(SB), R5
+ VLM (R5), EX0, EX2
+
+ // generate masks
+ VGMG $(64-24), $63, MOD24 // [0x00ffffff, 0x00ffffff]
+ VGMG $(64-26), $63, MOD26 // [0x03ffffff, 0x03ffffff]
+
+ // load h (accumulator) and r (key) from state
+ VZERO T_1 // [0, 0]
+ VL 0(R1), T_0 // [h₆₄[0], h₆₄[1]]
+ VLEG $0, 16(R1), T_1 // [h₆₄[2], 0]
+ VL 24(R1), T_2 // [r₆₄[0], r₆₄[1]]
+ VPDI $0, T_0, T_2, T_3 // [h₆₄[0], r₆₄[0]]
+ VPDI $5, T_0, T_2, T_4 // [h₆₄[1], r₆₄[1]]
+
+ // unpack h and r into 26-bit limbs
+ // note: h₆₄[2] may have the low 3 bits set, so h₂₆[4] is a 27-bit value
+ VN MOD26, T_3, H_0 // [h₂₆[0], r₂₆[0]]
+ VZERO H_1 // [0, 0]
+ VZERO H_3 // [0, 0]
+ VGMG $(64-12-14), $(63-12), T_0 // [0x03fff000, 0x03fff000] - 26-bit mask with low 12 bits masked out
+ VESLG $24, T_1, T_1 // [h₆₄[2]<<24, 0]
+ VERIMG $-26&63, T_3, MOD26, H_1 // [h₂₆[1], r₂₆[1]]
+ VESRLG $+52&63, T_3, H_2 // [h₂₆[2], r₂₆[2]] - low 12 bits only
+ VERIMG $-14&63, T_4, MOD26, H_3 // [h₂₆[1], r₂₆[1]]
+ VESRLG $40, T_4, H_4 // [h₂₆[4], r₂₆[4]] - low 24 bits only
+ VERIMG $+12&63, T_4, T_0, H_2 // [h₂₆[2], r₂₆[2]] - complete
+ VO T_1, H_4, H_4 // [h₂₆[4], r₂₆[4]] - complete
+
+ // replicate r across all 4 vector elements
+ VREPF $3, H_0, R_0 // [r₂₆[0], r₂₆[0], r₂₆[0], r₂₆[0]]
+ VREPF $3, H_1, R_1 // [r₂₆[1], r₂₆[1], r₂₆[1], r₂₆[1]]
+ VREPF $3, H_2, R_2 // [r₂₆[2], r₂₆[2], r₂₆[2], r₂₆[2]]
+ VREPF $3, H_3, R_3 // [r₂₆[3], r₂₆[3], r₂₆[3], r₂₆[3]]
+ VREPF $3, H_4, R_4 // [r₂₆[4], r₂₆[4], r₂₆[4], r₂₆[4]]
+
+ // zero out lane 1 of h
+ VLEIG $1, $0, H_0 // [h₂₆[0], 0]
+ VLEIG $1, $0, H_1 // [h₂₆[1], 0]
+ VLEIG $1, $0, H_2 // [h₂₆[2], 0]
+ VLEIG $1, $0, H_3 // [h₂₆[3], 0]
+ VLEIG $1, $0, H_4 // [h₂₆[4], 0]
+
+ // calculate 5r (ignore least significant limb)
+ VREPIF $5, T_0
+ VMLF T_0, R_1, R5_1 // [5r₂₆[1], 5r₂₆[1], 5r₂₆[1], 5r₂₆[1]]
+ VMLF T_0, R_2, R5_2 // [5r₂₆[2], 5r₂₆[2], 5r₂₆[2], 5r₂₆[2]]
+ VMLF T_0, R_3, R5_3 // [5r₂₆[3], 5r₂₆[3], 5r₂₆[3], 5r₂₆[3]]
+ VMLF T_0, R_4, R5_4 // [5r₂₆[4], 5r₂₆[4], 5r₂₆[4], 5r₂₆[4]]
+
+ // skip r² calculation if we are only calculating one block
+ CMPBLE R3, $16, skip
+
+ // calculate r²
+ MULTIPLY(R_0, R_1, R_2, R_3, R_4, R_0, R_1, R_2, R_3, R_4, R5_1, R5_2, R5_3, R5_4, M_0, M_1, M_2, M_3, M_4)
+ REDUCE(M_0, M_1, M_2, M_3, M_4)
+ VGBM $0x0f0f, T_0
+ VERIMG $0, M_0, T_0, R_0 // [r₂₆[0], r²₂₆[0], r₂₆[0], r²₂₆[0]]
+ VERIMG $0, M_1, T_0, R_1 // [r₂₆[1], r²₂₆[1], r₂₆[1], r²₂₆[1]]
+ VERIMG $0, M_2, T_0, R_2 // [r₂₆[2], r²₂₆[2], r₂₆[2], r²₂₆[2]]
+ VERIMG $0, M_3, T_0, R_3 // [r₂₆[3], r²₂₆[3], r₂₆[3], r²₂₆[3]]
+ VERIMG $0, M_4, T_0, R_4 // [r₂₆[4], r²₂₆[4], r₂₆[4], r²₂₆[4]]
+
+ // calculate 5r² (ignore least significant limb)
+ VREPIF $5, T_0
+ VMLF T_0, R_1, R5_1 // [5r₂₆[1], 5r²₂₆[1], 5r₂₆[1], 5r²₂₆[1]]
+ VMLF T_0, R_2, R5_2 // [5r₂₆[2], 5r²₂₆[2], 5r₂₆[2], 5r²₂₆[2]]
+ VMLF T_0, R_3, R5_3 // [5r₂₆[3], 5r²₂₆[3], 5r₂₆[3], 5r²₂₆[3]]
+ VMLF T_0, R_4, R5_4 // [5r₂₆[4], 5r²₂₆[4], 5r₂₆[4], 5r²₂₆[4]]
+
+loop:
+ CMPBLE R3, $32, b2 // 2 or fewer blocks remaining, need to change key coefficients
+
+ // load next 2 blocks from message
+ VLM (R2), T_0, T_1
+
+ // update message slice
+ SUB $32, R3
+ MOVD $32(R2), R2
+
+ // unpack message blocks into 26-bit big-endian limbs
+ EXPAND(T_0, T_1, M_0, M_1, M_2, M_3, M_4)
+
+ // add 2¹²⁸ to each message block value
+ VLEIB $4, $1, M_4
+ VLEIB $12, $1, M_4
+
+multiply:
+ // accumulate the incoming message
+ VAG H_0, M_0, M_0
+ VAG H_3, M_3, M_3
+ VAG H_1, M_1, M_1
+ VAG H_4, M_4, M_4
+ VAG H_2, M_2, M_2
+
+ // multiply the accumulator by the key coefficient
+ MULTIPLY(M_0, M_1, M_2, M_3, M_4, R_0, R_1, R_2, R_3, R_4, R5_1, R5_2, R5_3, R5_4, H_0, H_1, H_2, H_3, H_4)
+
+ // carry and partially reduce the partial products
+ REDUCE(H_0, H_1, H_2, H_3, H_4)
+
+ CMPBNE R3, $0, loop
+
+finish:
+ // sum lane 0 and lane 1 and put the result in lane 1
+ VZERO T_0
+ VSUMQG H_0, T_0, H_0
+ VSUMQG H_3, T_0, H_3
+ VSUMQG H_1, T_0, H_1
+ VSUMQG H_4, T_0, H_4
+ VSUMQG H_2, T_0, H_2
+
+ // reduce again after summation
+ // TODO(mundaym): there might be a more efficient way to do this
+ // now that we only have 1 active lane. For example, we could
+ // simultaneously pack the values as we reduce them.
+ REDUCE(H_0, H_1, H_2, H_3, H_4)
+
+ // carry h[1] through to h[4] so that only h[4] can exceed 2²⁶ - 1
+ // TODO(mundaym): in testing this final carry was unnecessary.
+ // Needs a proof before it can be removed though.
+ VESRLG $26, H_1, T_1
+ VN MOD26, H_1, H_1
+ VAQ T_1, H_2, H_2
+ VESRLG $26, H_2, T_2
+ VN MOD26, H_2, H_2
+ VAQ T_2, H_3, H_3
+ VESRLG $26, H_3, T_3
+ VN MOD26, H_3, H_3
+ VAQ T_3, H_4, H_4
+
+ // h is now < 2(2¹³⁰ - 5)
+ // Pack each lane in h₂₆[0:4] into h₁₂₈[0:1].
+ VESLG $26, H_1, H_1
+ VESLG $26, H_3, H_3
+ VO H_0, H_1, H_0
+ VO H_2, H_3, H_2
+ VESLG $4, H_2, H_2
+ VLEIB $7, $48, H_1
+ VSLB H_1, H_2, H_2
+ VO H_0, H_2, H_0
+ VLEIB $7, $104, H_1
+ VSLB H_1, H_4, H_3
+ VO H_3, H_0, H_0
+ VLEIB $7, $24, H_1
+ VSRLB H_1, H_4, H_1
+
+ // update state
+ VSTEG $1, H_0, 0(R1)
+ VSTEG $0, H_0, 8(R1)
+ VSTEG $1, H_1, 16(R1)
+ RET
+
+b2: // 2 or fewer blocks remaining
+ CMPBLE R3, $16, b1
+
+ // Load the 2 remaining blocks (17-32 bytes remaining).
+ MOVD $-17(R3), R0 // index of final byte to load modulo 16
+ VL (R2), T_0 // load full 16 byte block
+ VLL R0, 16(R2), T_1 // load final (possibly partial) block and pad with zeros to 16 bytes
+
+ // The Poly1305 algorithm requires that a 1 bit be appended to
+ // each message block. If the final block is less than 16 bytes
+ // long then it is easiest to insert the 1 before the message
+ // block is split into 26-bit limbs. If, on the other hand, the
+ // final message block is 16 bytes long then we append the 1 bit
+ // after expansion as normal.
+ MOVBZ $1, R0
+ MOVD $-16(R3), R3 // index of byte in last block to insert 1 at (could be 16)
+ CMPBEQ R3, $16, 2(PC) // skip the insertion if the final block is 16 bytes long
+ VLVGB R3, R0, T_1 // insert 1 into the byte at index R3
+
+ // Split both blocks into 26-bit limbs in the appropriate lanes.
+ EXPAND(T_0, T_1, M_0, M_1, M_2, M_3, M_4)
+
+ // Append a 1 byte to the end of the second to last block.
+ VLEIB $4, $1, M_4
+
+ // Append a 1 byte to the end of the last block only if it is a
+ // full 16 byte block.
+ CMPBNE R3, $16, 2(PC)
+ VLEIB $12, $1, M_4
+
+ // Finally, set up the coefficients for the final multiplication.
+ // We have previously saved r and 5r in the 32-bit even indexes
+ // of the R_[0-4] and R5_[1-4] coefficient registers.
+ //
+ // We want lane 0 to be multiplied by r² so that can be kept the
+ // same. We want lane 1 to be multiplied by r so we need to move
+ // the saved r value into the 32-bit odd index in lane 1 by
+ // rotating the 64-bit lane by 32.
+ VGBM $0x00ff, T_0 // [0, 0xffffffffffffffff] - mask lane 1 only
+ VERIMG $32, R_0, T_0, R_0 // [_, r²₂₆[0], _, r₂₆[0]]
+ VERIMG $32, R_1, T_0, R_1 // [_, r²₂₆[1], _, r₂₆[1]]
+ VERIMG $32, R_2, T_0, R_2 // [_, r²₂₆[2], _, r₂₆[2]]
+ VERIMG $32, R_3, T_0, R_3 // [_, r²₂₆[3], _, r₂₆[3]]
+ VERIMG $32, R_4, T_0, R_4 // [_, r²₂₆[4], _, r₂₆[4]]
+ VERIMG $32, R5_1, T_0, R5_1 // [_, 5r²₂₆[1], _, 5r₂₆[1]]
+ VERIMG $32, R5_2, T_0, R5_2 // [_, 5r²₂₆[2], _, 5r₂₆[2]]
+ VERIMG $32, R5_3, T_0, R5_3 // [_, 5r²₂₆[3], _, 5r₂₆[3]]
+ VERIMG $32, R5_4, T_0, R5_4 // [_, 5r²₂₆[4], _, 5r₂₆[4]]
+
+ MOVD $0, R3
+ BR multiply
+
+skip:
+ CMPBEQ R3, $0, finish
+
+b1: // 1 block remaining
+
+ // Load the final block (1-16 bytes). This will be placed into
+ // lane 0.
+ MOVD $-1(R3), R0
+ VLL R0, (R2), T_0 // pad to 16 bytes with zeros
+
+ // The Poly1305 algorithm requires that a 1 bit be appended to
+ // each message block. If the final block is less than 16 bytes
+ // long then it is easiest to insert the 1 before the message
+ // block is split into 26-bit limbs. If, on the other hand, the
+ // final message block is 16 bytes long then we append the 1 bit
+ // after expansion as normal.
+ MOVBZ $1, R0
+ CMPBEQ R3, $16, 2(PC)
+ VLVGB R3, R0, T_0
+
+ // Set the message block in lane 1 to the value 0 so that it
+ // can be accumulated without affecting the final result.
+ VZERO T_1
+
+ // Split the final message block into 26-bit limbs in lane 0.
+ // Lane 1 will be contain 0.
+ EXPAND(T_0, T_1, M_0, M_1, M_2, M_3, M_4)
+
+ // Append a 1 byte to the end of the last block only if it is a
+ // full 16 byte block.
+ CMPBNE R3, $16, 2(PC)
+ VLEIB $4, $1, M_4
+
+ // We have previously saved r and 5r in the 32-bit even indexes
+ // of the R_[0-4] and R5_[1-4] coefficient registers.
+ //
+ // We want lane 0 to be multiplied by r so we need to move the
+ // saved r value into the 32-bit odd index in lane 0. We want
+ // lane 1 to be set to the value 1. This makes multiplication
+ // a no-op. We do this by setting lane 1 in every register to 0
+ // and then just setting the 32-bit index 3 in R_0 to 1.
+ VZERO T_0
+ MOVD $0, R0
+ MOVD $0x10111213, R12
+ VLVGP R12, R0, T_1 // [_, 0x10111213, _, 0x00000000]
+ VPERM T_0, R_0, T_1, R_0 // [_, r₂₆[0], _, 0]
+ VPERM T_0, R_1, T_1, R_1 // [_, r₂₆[1], _, 0]
+ VPERM T_0, R_2, T_1, R_2 // [_, r₂₆[2], _, 0]
+ VPERM T_0, R_3, T_1, R_3 // [_, r₂₆[3], _, 0]
+ VPERM T_0, R_4, T_1, R_4 // [_, r₂₆[4], _, 0]
+ VPERM T_0, R5_1, T_1, R5_1 // [_, 5r₂₆[1], _, 0]
+ VPERM T_0, R5_2, T_1, R5_2 // [_, 5r₂₆[2], _, 0]
+ VPERM T_0, R5_3, T_1, R5_3 // [_, 5r₂₆[3], _, 0]
+ VPERM T_0, R5_4, T_1, R5_4 // [_, 5r₂₆[4], _, 0]
+
+ // Set the value of lane 1 to be 1.
+ VLEIF $3, $1, R_0 // [_, r₂₆[0], _, 1]
+
+ MOVD $0, R3
+ BR multiply
diff --git a/vendor/golang.org/x/crypto/poly1305/poly1305_compat.go b/vendor/golang.org/x/crypto/poly1305/poly1305_compat.go
new file mode 100644
index 00000000..dd975a32
--- /dev/null
+++ b/vendor/golang.org/x/crypto/poly1305/poly1305_compat.go
@@ -0,0 +1,91 @@
+// Copyright 2012 The Go Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style
+// license that can be found in the LICENSE file.
+
+// Package poly1305 implements Poly1305 one-time message authentication code as
+// specified in https://cr.yp.to/mac/poly1305-20050329.pdf.
+//
+// Poly1305 is a fast, one-time authentication function. It is infeasible for an
+// attacker to generate an authenticator for a message without the key. However, a
+// key must only be used for a single message. Authenticating two different
+// messages with the same key allows an attacker to forge authenticators for other
+// messages with the same key.
+//
+// Poly1305 was originally coupled with AES in order to make Poly1305-AES. AES was
+// used with a fixed key in order to generate one-time keys from an nonce.
+// However, in this package AES isn't used and the one-time key is specified
+// directly.
+//
+// Deprecated: Poly1305 as implemented by this package is a cryptographic
+// building block that is not safe for general purpose use.
+// For encryption, use the full ChaCha20-Poly1305 construction implemented by
+// golang.org/x/crypto/chacha20poly1305. For authentication, use a general
+// purpose MAC such as HMAC implemented by crypto/hmac.
+package poly1305 // import "golang.org/x/crypto/poly1305"
+
+import "golang.org/x/crypto/internal/poly1305"
+
+// TagSize is the size, in bytes, of a poly1305 authenticator.
+//
+// For use with golang.org/x/crypto/chacha20poly1305, chacha20poly1305.Overhead
+// can be used instead.
+const TagSize = 16
+
+// Sum generates an authenticator for msg using a one-time key and puts the
+// 16-byte result into out. Authenticating two different messages with the same
+// key allows an attacker to forge messages at will.
+func Sum(out *[16]byte, m []byte, key *[32]byte) {
+ poly1305.Sum(out, m, key)
+}
+
+// Verify returns true if mac is a valid authenticator for m with the given key.
+func Verify(mac *[16]byte, m []byte, key *[32]byte) bool {
+ return poly1305.Verify(mac, m, key)
+}
+
+// New returns a new MAC computing an authentication
+// tag of all data written to it with the given key.
+// This allows writing the message progressively instead
+// of passing it as a single slice. Common users should use
+// the Sum function instead.
+//
+// The key must be unique for each message, as authenticating
+// two different messages with the same key allows an attacker
+// to forge messages at will.
+func New(key *[32]byte) *MAC {
+ return &MAC{mac: poly1305.New(key)}
+}
+
+// MAC is an io.Writer computing an authentication tag
+// of the data written to it.
+//
+// MAC cannot be used like common hash.Hash implementations,
+// because using a poly1305 key twice breaks its security.
+// Therefore writing data to a running MAC after calling
+// Sum or Verify causes it to panic.
+type MAC struct {
+ mac *poly1305.MAC
+}
+
+// Size returns the number of bytes Sum will return.
+func (h *MAC) Size() int { return TagSize }
+
+// Write adds more data to the running message authentication code.
+// It never returns an error.
+//
+// It must not be called after the first call of Sum or Verify.
+func (h *MAC) Write(p []byte) (n int, err error) {
+ return h.mac.Write(p)
+}
+
+// Sum computes the authenticator of all data written to the
+// message authentication code.
+func (h *MAC) Sum(b []byte) []byte {
+ return h.mac.Sum(b)
+}
+
+// Verify returns whether the authenticator of all data written to
+// the message authentication code matches the expected value.
+func (h *MAC) Verify(expected []byte) bool {
+ return h.mac.Verify(expected)
+}
diff --git a/vendor/golang.org/x/crypto/scrypt/scrypt.go b/vendor/golang.org/x/crypto/scrypt/scrypt.go
new file mode 100644
index 00000000..c971a99f
--- /dev/null
+++ b/vendor/golang.org/x/crypto/scrypt/scrypt.go
@@ -0,0 +1,212 @@
+// Copyright 2012 The Go Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style
+// license that can be found in the LICENSE file.
+
+// Package scrypt implements the scrypt key derivation function as defined in
+// Colin Percival's paper "Stronger Key Derivation via Sequential Memory-Hard
+// Functions" (https://www.tarsnap.com/scrypt/scrypt.pdf).
+package scrypt // import "golang.org/x/crypto/scrypt"
+
+import (
+ "crypto/sha256"
+ "encoding/binary"
+ "errors"
+ "math/bits"
+
+ "golang.org/x/crypto/pbkdf2"
+)
+
+const maxInt = int(^uint(0) >> 1)
+
+// blockCopy copies n numbers from src into dst.
+func blockCopy(dst, src []uint32, n int) {
+ copy(dst, src[:n])
+}
+
+// blockXOR XORs numbers from dst with n numbers from src.
+func blockXOR(dst, src []uint32, n int) {
+ for i, v := range src[:n] {
+ dst[i] ^= v
+ }
+}
+
+// salsaXOR applies Salsa20/8 to the XOR of 16 numbers from tmp and in,
+// and puts the result into both tmp and out.
+func salsaXOR(tmp *[16]uint32, in, out []uint32) {
+ w0 := tmp[0] ^ in[0]
+ w1 := tmp[1] ^ in[1]
+ w2 := tmp[2] ^ in[2]
+ w3 := tmp[3] ^ in[3]
+ w4 := tmp[4] ^ in[4]
+ w5 := tmp[5] ^ in[5]
+ w6 := tmp[6] ^ in[6]
+ w7 := tmp[7] ^ in[7]
+ w8 := tmp[8] ^ in[8]
+ w9 := tmp[9] ^ in[9]
+ w10 := tmp[10] ^ in[10]
+ w11 := tmp[11] ^ in[11]
+ w12 := tmp[12] ^ in[12]
+ w13 := tmp[13] ^ in[13]
+ w14 := tmp[14] ^ in[14]
+ w15 := tmp[15] ^ in[15]
+
+ x0, x1, x2, x3, x4, x5, x6, x7, x8 := w0, w1, w2, w3, w4, w5, w6, w7, w8
+ x9, x10, x11, x12, x13, x14, x15 := w9, w10, w11, w12, w13, w14, w15
+
+ for i := 0; i < 8; i += 2 {
+ x4 ^= bits.RotateLeft32(x0+x12, 7)
+ x8 ^= bits.RotateLeft32(x4+x0, 9)
+ x12 ^= bits.RotateLeft32(x8+x4, 13)
+ x0 ^= bits.RotateLeft32(x12+x8, 18)
+
+ x9 ^= bits.RotateLeft32(x5+x1, 7)
+ x13 ^= bits.RotateLeft32(x9+x5, 9)
+ x1 ^= bits.RotateLeft32(x13+x9, 13)
+ x5 ^= bits.RotateLeft32(x1+x13, 18)
+
+ x14 ^= bits.RotateLeft32(x10+x6, 7)
+ x2 ^= bits.RotateLeft32(x14+x10, 9)
+ x6 ^= bits.RotateLeft32(x2+x14, 13)
+ x10 ^= bits.RotateLeft32(x6+x2, 18)
+
+ x3 ^= bits.RotateLeft32(x15+x11, 7)
+ x7 ^= bits.RotateLeft32(x3+x15, 9)
+ x11 ^= bits.RotateLeft32(x7+x3, 13)
+ x15 ^= bits.RotateLeft32(x11+x7, 18)
+
+ x1 ^= bits.RotateLeft32(x0+x3, 7)
+ x2 ^= bits.RotateLeft32(x1+x0, 9)
+ x3 ^= bits.RotateLeft32(x2+x1, 13)
+ x0 ^= bits.RotateLeft32(x3+x2, 18)
+
+ x6 ^= bits.RotateLeft32(x5+x4, 7)
+ x7 ^= bits.RotateLeft32(x6+x5, 9)
+ x4 ^= bits.RotateLeft32(x7+x6, 13)
+ x5 ^= bits.RotateLeft32(x4+x7, 18)
+
+ x11 ^= bits.RotateLeft32(x10+x9, 7)
+ x8 ^= bits.RotateLeft32(x11+x10, 9)
+ x9 ^= bits.RotateLeft32(x8+x11, 13)
+ x10 ^= bits.RotateLeft32(x9+x8, 18)
+
+ x12 ^= bits.RotateLeft32(x15+x14, 7)
+ x13 ^= bits.RotateLeft32(x12+x15, 9)
+ x14 ^= bits.RotateLeft32(x13+x12, 13)
+ x15 ^= bits.RotateLeft32(x14+x13, 18)
+ }
+ x0 += w0
+ x1 += w1
+ x2 += w2
+ x3 += w3
+ x4 += w4
+ x5 += w5
+ x6 += w6
+ x7 += w7
+ x8 += w8
+ x9 += w9
+ x10 += w10
+ x11 += w11
+ x12 += w12
+ x13 += w13
+ x14 += w14
+ x15 += w15
+
+ out[0], tmp[0] = x0, x0
+ out[1], tmp[1] = x1, x1
+ out[2], tmp[2] = x2, x2
+ out[3], tmp[3] = x3, x3
+ out[4], tmp[4] = x4, x4
+ out[5], tmp[5] = x5, x5
+ out[6], tmp[6] = x6, x6
+ out[7], tmp[7] = x7, x7
+ out[8], tmp[8] = x8, x8
+ out[9], tmp[9] = x9, x9
+ out[10], tmp[10] = x10, x10
+ out[11], tmp[11] = x11, x11
+ out[12], tmp[12] = x12, x12
+ out[13], tmp[13] = x13, x13
+ out[14], tmp[14] = x14, x14
+ out[15], tmp[15] = x15, x15
+}
+
+func blockMix(tmp *[16]uint32, in, out []uint32, r int) {
+ blockCopy(tmp[:], in[(2*r-1)*16:], 16)
+ for i := 0; i < 2*r; i += 2 {
+ salsaXOR(tmp, in[i*16:], out[i*8:])
+ salsaXOR(tmp, in[i*16+16:], out[i*8+r*16:])
+ }
+}
+
+func integer(b []uint32, r int) uint64 {
+ j := (2*r - 1) * 16
+ return uint64(b[j]) | uint64(b[j+1])<<32
+}
+
+func smix(b []byte, r, N int, v, xy []uint32) {
+ var tmp [16]uint32
+ R := 32 * r
+ x := xy
+ y := xy[R:]
+
+ j := 0
+ for i := 0; i < R; i++ {
+ x[i] = binary.LittleEndian.Uint32(b[j:])
+ j += 4
+ }
+ for i := 0; i < N; i += 2 {
+ blockCopy(v[i*R:], x, R)
+ blockMix(&tmp, x, y, r)
+
+ blockCopy(v[(i+1)*R:], y, R)
+ blockMix(&tmp, y, x, r)
+ }
+ for i := 0; i < N; i += 2 {
+ j := int(integer(x, r) & uint64(N-1))
+ blockXOR(x, v[j*R:], R)
+ blockMix(&tmp, x, y, r)
+
+ j = int(integer(y, r) & uint64(N-1))
+ blockXOR(y, v[j*R:], R)
+ blockMix(&tmp, y, x, r)
+ }
+ j = 0
+ for _, v := range x[:R] {
+ binary.LittleEndian.PutUint32(b[j:], v)
+ j += 4
+ }
+}
+
+// Key derives a key from the password, salt, and cost parameters, returning
+// a byte slice of length keyLen that can be used as cryptographic key.
+//
+// N is a CPU/memory cost parameter, which must be a power of two greater than 1.
+// r and p must satisfy r * p < 2³⁰. If the parameters do not satisfy the
+// limits, the function returns a nil byte slice and an error.
+//
+// For example, you can get a derived key for e.g. AES-256 (which needs a
+// 32-byte key) by doing:
+//
+// dk, err := scrypt.Key([]byte("some password"), salt, 32768, 8, 1, 32)
+//
+// The recommended parameters for interactive logins as of 2017 are N=32768, r=8
+// and p=1. The parameters N, r, and p should be increased as memory latency and
+// CPU parallelism increases; consider setting N to the highest power of 2 you
+// can derive within 100 milliseconds. Remember to get a good random salt.
+func Key(password, salt []byte, N, r, p, keyLen int) ([]byte, error) {
+ if N <= 1 || N&(N-1) != 0 {
+ return nil, errors.New("scrypt: N must be > 1 and a power of 2")
+ }
+ if uint64(r)*uint64(p) >= 1<<30 || r > maxInt/128/p || r > maxInt/256 || N > maxInt/128/r {
+ return nil, errors.New("scrypt: parameters are too large")
+ }
+
+ xy := make([]uint32, 64*r)
+ v := make([]uint32, 32*N*r)
+ b := pbkdf2.Key(password, salt, 1, p*128*r, sha256.New)
+
+ for i := 0; i < p; i++ {
+ smix(b[i*128*r:], r, N, v, xy)
+ }
+
+ return pbkdf2.Key(password, b, 1, keyLen, sha256.New), nil
+}
diff --git a/vendor/golang.org/x/crypto/ssh/buffer.go b/vendor/golang.org/x/crypto/ssh/buffer.go
new file mode 100644
index 00000000..1ab07d07
--- /dev/null
+++ b/vendor/golang.org/x/crypto/ssh/buffer.go
@@ -0,0 +1,97 @@
+// Copyright 2012 The Go Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style
+// license that can be found in the LICENSE file.
+
+package ssh
+
+import (
+ "io"
+ "sync"
+)
+
+// buffer provides a linked list buffer for data exchange
+// between producer and consumer. Theoretically the buffer is
+// of unlimited capacity as it does no allocation of its own.
+type buffer struct {
+ // protects concurrent access to head, tail and closed
+ *sync.Cond
+
+ head *element // the buffer that will be read first
+ tail *element // the buffer that will be read last
+
+ closed bool
+}
+
+// An element represents a single link in a linked list.
+type element struct {
+ buf []byte
+ next *element
+}
+
+// newBuffer returns an empty buffer that is not closed.
+func newBuffer() *buffer {
+ e := new(element)
+ b := &buffer{
+ Cond: newCond(),
+ head: e,
+ tail: e,
+ }
+ return b
+}
+
+// write makes buf available for Read to receive.
+// buf must not be modified after the call to write.
+func (b *buffer) write(buf []byte) {
+ b.Cond.L.Lock()
+ e := &element{buf: buf}
+ b.tail.next = e
+ b.tail = e
+ b.Cond.Signal()
+ b.Cond.L.Unlock()
+}
+
+// eof closes the buffer. Reads from the buffer once all
+// the data has been consumed will receive io.EOF.
+func (b *buffer) eof() {
+ b.Cond.L.Lock()
+ b.closed = true
+ b.Cond.Signal()
+ b.Cond.L.Unlock()
+}
+
+// Read reads data from the internal buffer in buf. Reads will block
+// if no data is available, or until the buffer is closed.
+func (b *buffer) Read(buf []byte) (n int, err error) {
+ b.Cond.L.Lock()
+ defer b.Cond.L.Unlock()
+
+ for len(buf) > 0 {
+ // if there is data in b.head, copy it
+ if len(b.head.buf) > 0 {
+ r := copy(buf, b.head.buf)
+ buf, b.head.buf = buf[r:], b.head.buf[r:]
+ n += r
+ continue
+ }
+ // if there is a next buffer, make it the head
+ if len(b.head.buf) == 0 && b.head != b.tail {
+ b.head = b.head.next
+ continue
+ }
+
+ // if at least one byte has been copied, return
+ if n > 0 {
+ break
+ }
+
+ // if nothing was read, and there is nothing outstanding
+ // check to see if the buffer is closed.
+ if b.closed {
+ err = io.EOF
+ break
+ }
+ // out of buffers, wait for producer
+ b.Cond.Wait()
+ }
+ return
+}
diff --git a/vendor/golang.org/x/crypto/ssh/certs.go b/vendor/golang.org/x/crypto/ssh/certs.go
new file mode 100644
index 00000000..27d0e14a
--- /dev/null
+++ b/vendor/golang.org/x/crypto/ssh/certs.go
@@ -0,0 +1,611 @@
+// Copyright 2012 The Go Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style
+// license that can be found in the LICENSE file.
+
+package ssh
+
+import (
+ "bytes"
+ "errors"
+ "fmt"
+ "io"
+ "net"
+ "sort"
+ "time"
+)
+
+// Certificate algorithm names from [PROTOCOL.certkeys]. These values can appear
+// in Certificate.Type, PublicKey.Type, and ClientConfig.HostKeyAlgorithms.
+// Unlike key algorithm names, these are not passed to AlgorithmSigner nor
+// returned by MultiAlgorithmSigner and don't appear in the Signature.Format
+// field.
+const (
+ CertAlgoRSAv01 = "ssh-rsa-cert-v01@openssh.com"
+ CertAlgoDSAv01 = "ssh-dss-cert-v01@openssh.com"
+ CertAlgoECDSA256v01 = "ecdsa-sha2-nistp256-cert-v01@openssh.com"
+ CertAlgoECDSA384v01 = "ecdsa-sha2-nistp384-cert-v01@openssh.com"
+ CertAlgoECDSA521v01 = "ecdsa-sha2-nistp521-cert-v01@openssh.com"
+ CertAlgoSKECDSA256v01 = "sk-ecdsa-sha2-nistp256-cert-v01@openssh.com"
+ CertAlgoED25519v01 = "ssh-ed25519-cert-v01@openssh.com"
+ CertAlgoSKED25519v01 = "sk-ssh-ed25519-cert-v01@openssh.com"
+
+ // CertAlgoRSASHA256v01 and CertAlgoRSASHA512v01 can't appear as a
+ // Certificate.Type (or PublicKey.Type), but only in
+ // ClientConfig.HostKeyAlgorithms.
+ CertAlgoRSASHA256v01 = "rsa-sha2-256-cert-v01@openssh.com"
+ CertAlgoRSASHA512v01 = "rsa-sha2-512-cert-v01@openssh.com"
+)
+
+const (
+ // Deprecated: use CertAlgoRSAv01.
+ CertSigAlgoRSAv01 = CertAlgoRSAv01
+ // Deprecated: use CertAlgoRSASHA256v01.
+ CertSigAlgoRSASHA2256v01 = CertAlgoRSASHA256v01
+ // Deprecated: use CertAlgoRSASHA512v01.
+ CertSigAlgoRSASHA2512v01 = CertAlgoRSASHA512v01
+)
+
+// Certificate types distinguish between host and user
+// certificates. The values can be set in the CertType field of
+// Certificate.
+const (
+ UserCert = 1
+ HostCert = 2
+)
+
+// Signature represents a cryptographic signature.
+type Signature struct {
+ Format string
+ Blob []byte
+ Rest []byte `ssh:"rest"`
+}
+
+// CertTimeInfinity can be used for OpenSSHCertV01.ValidBefore to indicate that
+// a certificate does not expire.
+const CertTimeInfinity = 1<<64 - 1
+
+// An Certificate represents an OpenSSH certificate as defined in
+// [PROTOCOL.certkeys]?rev=1.8. The Certificate type implements the
+// PublicKey interface, so it can be unmarshaled using
+// ParsePublicKey.
+type Certificate struct {
+ Nonce []byte
+ Key PublicKey
+ Serial uint64
+ CertType uint32
+ KeyId string
+ ValidPrincipals []string
+ ValidAfter uint64
+ ValidBefore uint64
+ Permissions
+ Reserved []byte
+ SignatureKey PublicKey
+ Signature *Signature
+}
+
+// genericCertData holds the key-independent part of the certificate data.
+// Overall, certificates contain an nonce, public key fields and
+// key-independent fields.
+type genericCertData struct {
+ Serial uint64
+ CertType uint32
+ KeyId string
+ ValidPrincipals []byte
+ ValidAfter uint64
+ ValidBefore uint64
+ CriticalOptions []byte
+ Extensions []byte
+ Reserved []byte
+ SignatureKey []byte
+ Signature []byte
+}
+
+func marshalStringList(namelist []string) []byte {
+ var to []byte
+ for _, name := range namelist {
+ s := struct{ N string }{name}
+ to = append(to, Marshal(&s)...)
+ }
+ return to
+}
+
+type optionsTuple struct {
+ Key string
+ Value []byte
+}
+
+type optionsTupleValue struct {
+ Value string
+}
+
+// serialize a map of critical options or extensions
+// issue #10569 - per [PROTOCOL.certkeys] and SSH implementation,
+// we need two length prefixes for a non-empty string value
+func marshalTuples(tups map[string]string) []byte {
+ keys := make([]string, 0, len(tups))
+ for key := range tups {
+ keys = append(keys, key)
+ }
+ sort.Strings(keys)
+
+ var ret []byte
+ for _, key := range keys {
+ s := optionsTuple{Key: key}
+ if value := tups[key]; len(value) > 0 {
+ s.Value = Marshal(&optionsTupleValue{value})
+ }
+ ret = append(ret, Marshal(&s)...)
+ }
+ return ret
+}
+
+// issue #10569 - per [PROTOCOL.certkeys] and SSH implementation,
+// we need two length prefixes for a non-empty option value
+func parseTuples(in []byte) (map[string]string, error) {
+ tups := map[string]string{}
+ var lastKey string
+ var haveLastKey bool
+
+ for len(in) > 0 {
+ var key, val, extra []byte
+ var ok bool
+
+ if key, in, ok = parseString(in); !ok {
+ return nil, errShortRead
+ }
+ keyStr := string(key)
+ // according to [PROTOCOL.certkeys], the names must be in
+ // lexical order.
+ if haveLastKey && keyStr <= lastKey {
+ return nil, fmt.Errorf("ssh: certificate options are not in lexical order")
+ }
+ lastKey, haveLastKey = keyStr, true
+ // the next field is a data field, which if non-empty has a string embedded
+ if val, in, ok = parseString(in); !ok {
+ return nil, errShortRead
+ }
+ if len(val) > 0 {
+ val, extra, ok = parseString(val)
+ if !ok {
+ return nil, errShortRead
+ }
+ if len(extra) > 0 {
+ return nil, fmt.Errorf("ssh: unexpected trailing data after certificate option value")
+ }
+ tups[keyStr] = string(val)
+ } else {
+ tups[keyStr] = ""
+ }
+ }
+ return tups, nil
+}
+
+func parseCert(in []byte, privAlgo string) (*Certificate, error) {
+ nonce, rest, ok := parseString(in)
+ if !ok {
+ return nil, errShortRead
+ }
+
+ key, rest, err := parsePubKey(rest, privAlgo)
+ if err != nil {
+ return nil, err
+ }
+
+ var g genericCertData
+ if err := Unmarshal(rest, &g); err != nil {
+ return nil, err
+ }
+
+ c := &Certificate{
+ Nonce: nonce,
+ Key: key,
+ Serial: g.Serial,
+ CertType: g.CertType,
+ KeyId: g.KeyId,
+ ValidAfter: g.ValidAfter,
+ ValidBefore: g.ValidBefore,
+ }
+
+ for principals := g.ValidPrincipals; len(principals) > 0; {
+ principal, rest, ok := parseString(principals)
+ if !ok {
+ return nil, errShortRead
+ }
+ c.ValidPrincipals = append(c.ValidPrincipals, string(principal))
+ principals = rest
+ }
+
+ c.CriticalOptions, err = parseTuples(g.CriticalOptions)
+ if err != nil {
+ return nil, err
+ }
+ c.Extensions, err = parseTuples(g.Extensions)
+ if err != nil {
+ return nil, err
+ }
+ c.Reserved = g.Reserved
+ k, err := ParsePublicKey(g.SignatureKey)
+ if err != nil {
+ return nil, err
+ }
+
+ c.SignatureKey = k
+ c.Signature, rest, ok = parseSignatureBody(g.Signature)
+ if !ok || len(rest) > 0 {
+ return nil, errors.New("ssh: signature parse error")
+ }
+
+ return c, nil
+}
+
+type openSSHCertSigner struct {
+ pub *Certificate
+ signer Signer
+}
+
+type algorithmOpenSSHCertSigner struct {
+ *openSSHCertSigner
+ algorithmSigner AlgorithmSigner
+}
+
+// NewCertSigner returns a Signer that signs with the given Certificate, whose
+// private key is held by signer. It returns an error if the public key in cert
+// doesn't match the key used by signer.
+func NewCertSigner(cert *Certificate, signer Signer) (Signer, error) {
+ if !bytes.Equal(cert.Key.Marshal(), signer.PublicKey().Marshal()) {
+ return nil, errors.New("ssh: signer and cert have different public key")
+ }
+
+ switch s := signer.(type) {
+ case MultiAlgorithmSigner:
+ return &multiAlgorithmSigner{
+ AlgorithmSigner: &algorithmOpenSSHCertSigner{
+ &openSSHCertSigner{cert, signer}, s},
+ supportedAlgorithms: s.Algorithms(),
+ }, nil
+ case AlgorithmSigner:
+ return &algorithmOpenSSHCertSigner{
+ &openSSHCertSigner{cert, signer}, s}, nil
+ default:
+ return &openSSHCertSigner{cert, signer}, nil
+ }
+}
+
+func (s *openSSHCertSigner) Sign(rand io.Reader, data []byte) (*Signature, error) {
+ return s.signer.Sign(rand, data)
+}
+
+func (s *openSSHCertSigner) PublicKey() PublicKey {
+ return s.pub
+}
+
+func (s *algorithmOpenSSHCertSigner) SignWithAlgorithm(rand io.Reader, data []byte, algorithm string) (*Signature, error) {
+ return s.algorithmSigner.SignWithAlgorithm(rand, data, algorithm)
+}
+
+const sourceAddressCriticalOption = "source-address"
+
+// CertChecker does the work of verifying a certificate. Its methods
+// can be plugged into ClientConfig.HostKeyCallback and
+// ServerConfig.PublicKeyCallback. For the CertChecker to work,
+// minimally, the IsAuthority callback should be set.
+type CertChecker struct {
+ // SupportedCriticalOptions lists the CriticalOptions that the
+ // server application layer understands. These are only used
+ // for user certificates.
+ SupportedCriticalOptions []string
+
+ // IsUserAuthority should return true if the key is recognized as an
+ // authority for the given user certificate. This allows for
+ // certificates to be signed by other certificates. This must be set
+ // if this CertChecker will be checking user certificates.
+ IsUserAuthority func(auth PublicKey) bool
+
+ // IsHostAuthority should report whether the key is recognized as
+ // an authority for this host. This allows for certificates to be
+ // signed by other keys, and for those other keys to only be valid
+ // signers for particular hostnames. This must be set if this
+ // CertChecker will be checking host certificates.
+ IsHostAuthority func(auth PublicKey, address string) bool
+
+ // Clock is used for verifying time stamps. If nil, time.Now
+ // is used.
+ Clock func() time.Time
+
+ // UserKeyFallback is called when CertChecker.Authenticate encounters a
+ // public key that is not a certificate. It must implement validation
+ // of user keys or else, if nil, all such keys are rejected.
+ UserKeyFallback func(conn ConnMetadata, key PublicKey) (*Permissions, error)
+
+ // HostKeyFallback is called when CertChecker.CheckHostKey encounters a
+ // public key that is not a certificate. It must implement host key
+ // validation or else, if nil, all such keys are rejected.
+ HostKeyFallback HostKeyCallback
+
+ // IsRevoked is called for each certificate so that revocation checking
+ // can be implemented. It should return true if the given certificate
+ // is revoked and false otherwise. If nil, no certificates are
+ // considered to have been revoked.
+ IsRevoked func(cert *Certificate) bool
+}
+
+// CheckHostKey checks a host key certificate. This method can be
+// plugged into ClientConfig.HostKeyCallback.
+func (c *CertChecker) CheckHostKey(addr string, remote net.Addr, key PublicKey) error {
+ cert, ok := key.(*Certificate)
+ if !ok {
+ if c.HostKeyFallback != nil {
+ return c.HostKeyFallback(addr, remote, key)
+ }
+ return errors.New("ssh: non-certificate host key")
+ }
+ if cert.CertType != HostCert {
+ return fmt.Errorf("ssh: certificate presented as a host key has type %d", cert.CertType)
+ }
+ if !c.IsHostAuthority(cert.SignatureKey, addr) {
+ return fmt.Errorf("ssh: no authorities for hostname: %v", addr)
+ }
+
+ hostname, _, err := net.SplitHostPort(addr)
+ if err != nil {
+ return err
+ }
+
+ // Pass hostname only as principal for host certificates (consistent with OpenSSH)
+ return c.CheckCert(hostname, cert)
+}
+
+// Authenticate checks a user certificate. Authenticate can be used as
+// a value for ServerConfig.PublicKeyCallback.
+func (c *CertChecker) Authenticate(conn ConnMetadata, pubKey PublicKey) (*Permissions, error) {
+ cert, ok := pubKey.(*Certificate)
+ if !ok {
+ if c.UserKeyFallback != nil {
+ return c.UserKeyFallback(conn, pubKey)
+ }
+ return nil, errors.New("ssh: normal key pairs not accepted")
+ }
+
+ if cert.CertType != UserCert {
+ return nil, fmt.Errorf("ssh: cert has type %d", cert.CertType)
+ }
+ if !c.IsUserAuthority(cert.SignatureKey) {
+ return nil, fmt.Errorf("ssh: certificate signed by unrecognized authority")
+ }
+
+ if err := c.CheckCert(conn.User(), cert); err != nil {
+ return nil, err
+ }
+
+ return &cert.Permissions, nil
+}
+
+// CheckCert checks CriticalOptions, ValidPrincipals, revocation, timestamp and
+// the signature of the certificate.
+func (c *CertChecker) CheckCert(principal string, cert *Certificate) error {
+ if c.IsRevoked != nil && c.IsRevoked(cert) {
+ return fmt.Errorf("ssh: certificate serial %d revoked", cert.Serial)
+ }
+
+ for opt := range cert.CriticalOptions {
+ // sourceAddressCriticalOption will be enforced by
+ // serverAuthenticate
+ if opt == sourceAddressCriticalOption {
+ continue
+ }
+
+ found := false
+ for _, supp := range c.SupportedCriticalOptions {
+ if supp == opt {
+ found = true
+ break
+ }
+ }
+ if !found {
+ return fmt.Errorf("ssh: unsupported critical option %q in certificate", opt)
+ }
+ }
+
+ if len(cert.ValidPrincipals) > 0 {
+ // By default, certs are valid for all users/hosts.
+ found := false
+ for _, p := range cert.ValidPrincipals {
+ if p == principal {
+ found = true
+ break
+ }
+ }
+ if !found {
+ return fmt.Errorf("ssh: principal %q not in the set of valid principals for given certificate: %q", principal, cert.ValidPrincipals)
+ }
+ }
+
+ clock := c.Clock
+ if clock == nil {
+ clock = time.Now
+ }
+
+ unixNow := clock().Unix()
+ if after := int64(cert.ValidAfter); after < 0 || unixNow < int64(cert.ValidAfter) {
+ return fmt.Errorf("ssh: cert is not yet valid")
+ }
+ if before := int64(cert.ValidBefore); cert.ValidBefore != uint64(CertTimeInfinity) && (unixNow >= before || before < 0) {
+ return fmt.Errorf("ssh: cert has expired")
+ }
+ if err := cert.SignatureKey.Verify(cert.bytesForSigning(), cert.Signature); err != nil {
+ return fmt.Errorf("ssh: certificate signature does not verify")
+ }
+
+ return nil
+}
+
+// SignCert signs the certificate with an authority, setting the Nonce,
+// SignatureKey, and Signature fields. If the authority implements the
+// MultiAlgorithmSigner interface the first algorithm in the list is used. This
+// is useful if you want to sign with a specific algorithm.
+func (c *Certificate) SignCert(rand io.Reader, authority Signer) error {
+ c.Nonce = make([]byte, 32)
+ if _, err := io.ReadFull(rand, c.Nonce); err != nil {
+ return err
+ }
+ c.SignatureKey = authority.PublicKey()
+
+ if v, ok := authority.(MultiAlgorithmSigner); ok {
+ if len(v.Algorithms()) == 0 {
+ return errors.New("the provided authority has no signature algorithm")
+ }
+ // Use the first algorithm in the list.
+ sig, err := v.SignWithAlgorithm(rand, c.bytesForSigning(), v.Algorithms()[0])
+ if err != nil {
+ return err
+ }
+ c.Signature = sig
+ return nil
+ } else if v, ok := authority.(AlgorithmSigner); ok && v.PublicKey().Type() == KeyAlgoRSA {
+ // Default to KeyAlgoRSASHA512 for ssh-rsa signers.
+ // TODO: consider using KeyAlgoRSASHA256 as default.
+ sig, err := v.SignWithAlgorithm(rand, c.bytesForSigning(), KeyAlgoRSASHA512)
+ if err != nil {
+ return err
+ }
+ c.Signature = sig
+ return nil
+ }
+
+ sig, err := authority.Sign(rand, c.bytesForSigning())
+ if err != nil {
+ return err
+ }
+ c.Signature = sig
+ return nil
+}
+
+// certKeyAlgoNames is a mapping from known certificate algorithm names to the
+// corresponding public key signature algorithm.
+//
+// This map must be kept in sync with the one in agent/client.go.
+var certKeyAlgoNames = map[string]string{
+ CertAlgoRSAv01: KeyAlgoRSA,
+ CertAlgoRSASHA256v01: KeyAlgoRSASHA256,
+ CertAlgoRSASHA512v01: KeyAlgoRSASHA512,
+ CertAlgoDSAv01: KeyAlgoDSA,
+ CertAlgoECDSA256v01: KeyAlgoECDSA256,
+ CertAlgoECDSA384v01: KeyAlgoECDSA384,
+ CertAlgoECDSA521v01: KeyAlgoECDSA521,
+ CertAlgoSKECDSA256v01: KeyAlgoSKECDSA256,
+ CertAlgoED25519v01: KeyAlgoED25519,
+ CertAlgoSKED25519v01: KeyAlgoSKED25519,
+}
+
+// underlyingAlgo returns the signature algorithm associated with algo (which is
+// an advertised or negotiated public key or host key algorithm). These are
+// usually the same, except for certificate algorithms.
+func underlyingAlgo(algo string) string {
+ if a, ok := certKeyAlgoNames[algo]; ok {
+ return a
+ }
+ return algo
+}
+
+// certificateAlgo returns the certificate algorithms that uses the provided
+// underlying signature algorithm.
+func certificateAlgo(algo string) (certAlgo string, ok bool) {
+ for certName, algoName := range certKeyAlgoNames {
+ if algoName == algo {
+ return certName, true
+ }
+ }
+ return "", false
+}
+
+func (cert *Certificate) bytesForSigning() []byte {
+ c2 := *cert
+ c2.Signature = nil
+ out := c2.Marshal()
+ // Drop trailing signature length.
+ return out[:len(out)-4]
+}
+
+// Marshal serializes c into OpenSSH's wire format. It is part of the
+// PublicKey interface.
+func (c *Certificate) Marshal() []byte {
+ generic := genericCertData{
+ Serial: c.Serial,
+ CertType: c.CertType,
+ KeyId: c.KeyId,
+ ValidPrincipals: marshalStringList(c.ValidPrincipals),
+ ValidAfter: uint64(c.ValidAfter),
+ ValidBefore: uint64(c.ValidBefore),
+ CriticalOptions: marshalTuples(c.CriticalOptions),
+ Extensions: marshalTuples(c.Extensions),
+ Reserved: c.Reserved,
+ SignatureKey: c.SignatureKey.Marshal(),
+ }
+ if c.Signature != nil {
+ generic.Signature = Marshal(c.Signature)
+ }
+ genericBytes := Marshal(&generic)
+ keyBytes := c.Key.Marshal()
+ _, keyBytes, _ = parseString(keyBytes)
+ prefix := Marshal(&struct {
+ Name string
+ Nonce []byte
+ Key []byte `ssh:"rest"`
+ }{c.Type(), c.Nonce, keyBytes})
+
+ result := make([]byte, 0, len(prefix)+len(genericBytes))
+ result = append(result, prefix...)
+ result = append(result, genericBytes...)
+ return result
+}
+
+// Type returns the certificate algorithm name. It is part of the PublicKey interface.
+func (c *Certificate) Type() string {
+ certName, ok := certificateAlgo(c.Key.Type())
+ if !ok {
+ panic("unknown certificate type for key type " + c.Key.Type())
+ }
+ return certName
+}
+
+// Verify verifies a signature against the certificate's public
+// key. It is part of the PublicKey interface.
+func (c *Certificate) Verify(data []byte, sig *Signature) error {
+ return c.Key.Verify(data, sig)
+}
+
+func parseSignatureBody(in []byte) (out *Signature, rest []byte, ok bool) {
+ format, in, ok := parseString(in)
+ if !ok {
+ return
+ }
+
+ out = &Signature{
+ Format: string(format),
+ }
+
+ if out.Blob, in, ok = parseString(in); !ok {
+ return
+ }
+
+ switch out.Format {
+ case KeyAlgoSKECDSA256, CertAlgoSKECDSA256v01, KeyAlgoSKED25519, CertAlgoSKED25519v01:
+ out.Rest = in
+ return out, nil, ok
+ }
+
+ return out, in, ok
+}
+
+func parseSignature(in []byte) (out *Signature, rest []byte, ok bool) {
+ sigBytes, rest, ok := parseString(in)
+ if !ok {
+ return
+ }
+
+ out, trailing, ok := parseSignatureBody(sigBytes)
+ if !ok || len(trailing) > 0 {
+ return nil, nil, false
+ }
+ return
+}
diff --git a/vendor/golang.org/x/crypto/ssh/channel.go b/vendor/golang.org/x/crypto/ssh/channel.go
new file mode 100644
index 00000000..cc0bb7ab
--- /dev/null
+++ b/vendor/golang.org/x/crypto/ssh/channel.go
@@ -0,0 +1,645 @@
+// Copyright 2011 The Go Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style
+// license that can be found in the LICENSE file.
+
+package ssh
+
+import (
+ "encoding/binary"
+ "errors"
+ "fmt"
+ "io"
+ "log"
+ "sync"
+)
+
+const (
+ minPacketLength = 9
+ // channelMaxPacket contains the maximum number of bytes that will be
+ // sent in a single packet. As per RFC 4253, section 6.1, 32k is also
+ // the minimum.
+ channelMaxPacket = 1 << 15
+ // We follow OpenSSH here.
+ channelWindowSize = 64 * channelMaxPacket
+)
+
+// NewChannel represents an incoming request to a channel. It must either be
+// accepted for use by calling Accept, or rejected by calling Reject.
+type NewChannel interface {
+ // Accept accepts the channel creation request. It returns the Channel
+ // and a Go channel containing SSH requests. The Go channel must be
+ // serviced otherwise the Channel will hang.
+ Accept() (Channel, <-chan *Request, error)
+
+ // Reject rejects the channel creation request. After calling
+ // this, no other methods on the Channel may be called.
+ Reject(reason RejectionReason, message string) error
+
+ // ChannelType returns the type of the channel, as supplied by the
+ // client.
+ ChannelType() string
+
+ // ExtraData returns the arbitrary payload for this channel, as supplied
+ // by the client. This data is specific to the channel type.
+ ExtraData() []byte
+}
+
+// A Channel is an ordered, reliable, flow-controlled, duplex stream
+// that is multiplexed over an SSH connection.
+type Channel interface {
+ // Read reads up to len(data) bytes from the channel.
+ Read(data []byte) (int, error)
+
+ // Write writes len(data) bytes to the channel.
+ Write(data []byte) (int, error)
+
+ // Close signals end of channel use. No data may be sent after this
+ // call.
+ Close() error
+
+ // CloseWrite signals the end of sending in-band
+ // data. Requests may still be sent, and the other side may
+ // still send data
+ CloseWrite() error
+
+ // SendRequest sends a channel request. If wantReply is true,
+ // it will wait for a reply and return the result as a
+ // boolean, otherwise the return value will be false. Channel
+ // requests are out-of-band messages so they may be sent even
+ // if the data stream is closed or blocked by flow control.
+ // If the channel is closed before a reply is returned, io.EOF
+ // is returned.
+ SendRequest(name string, wantReply bool, payload []byte) (bool, error)
+
+ // Stderr returns an io.ReadWriter that writes to this channel
+ // with the extended data type set to stderr. Stderr may
+ // safely be read and written from a different goroutine than
+ // Read and Write respectively.
+ Stderr() io.ReadWriter
+}
+
+// Request is a request sent outside of the normal stream of
+// data. Requests can either be specific to an SSH channel, or they
+// can be global.
+type Request struct {
+ Type string
+ WantReply bool
+ Payload []byte
+
+ ch *channel
+ mux *mux
+}
+
+// Reply sends a response to a request. It must be called for all requests
+// where WantReply is true and is a no-op otherwise. The payload argument is
+// ignored for replies to channel-specific requests.
+func (r *Request) Reply(ok bool, payload []byte) error {
+ if !r.WantReply {
+ return nil
+ }
+
+ if r.ch == nil {
+ return r.mux.ackRequest(ok, payload)
+ }
+
+ return r.ch.ackRequest(ok)
+}
+
+// RejectionReason is an enumeration used when rejecting channel creation
+// requests. See RFC 4254, section 5.1.
+type RejectionReason uint32
+
+const (
+ Prohibited RejectionReason = iota + 1
+ ConnectionFailed
+ UnknownChannelType
+ ResourceShortage
+)
+
+// String converts the rejection reason to human readable form.
+func (r RejectionReason) String() string {
+ switch r {
+ case Prohibited:
+ return "administratively prohibited"
+ case ConnectionFailed:
+ return "connect failed"
+ case UnknownChannelType:
+ return "unknown channel type"
+ case ResourceShortage:
+ return "resource shortage"
+ }
+ return fmt.Sprintf("unknown reason %d", int(r))
+}
+
+func min(a uint32, b int) uint32 {
+ if a < uint32(b) {
+ return a
+ }
+ return uint32(b)
+}
+
+type channelDirection uint8
+
+const (
+ channelInbound channelDirection = iota
+ channelOutbound
+)
+
+// channel is an implementation of the Channel interface that works
+// with the mux class.
+type channel struct {
+ // R/O after creation
+ chanType string
+ extraData []byte
+ localId, remoteId uint32
+
+ // maxIncomingPayload and maxRemotePayload are the maximum
+ // payload sizes of normal and extended data packets for
+ // receiving and sending, respectively. The wire packet will
+ // be 9 or 13 bytes larger (excluding encryption overhead).
+ maxIncomingPayload uint32
+ maxRemotePayload uint32
+
+ mux *mux
+
+ // decided is set to true if an accept or reject message has been sent
+ // (for outbound channels) or received (for inbound channels).
+ decided bool
+
+ // direction contains either channelOutbound, for channels created
+ // locally, or channelInbound, for channels created by the peer.
+ direction channelDirection
+
+ // Pending internal channel messages.
+ msg chan interface{}
+
+ // Since requests have no ID, there can be only one request
+ // with WantReply=true outstanding. This lock is held by a
+ // goroutine that has such an outgoing request pending.
+ sentRequestMu sync.Mutex
+
+ incomingRequests chan *Request
+
+ sentEOF bool
+
+ // thread-safe data
+ remoteWin window
+ pending *buffer
+ extPending *buffer
+
+ // windowMu protects myWindow, the flow-control window, and myConsumed,
+ // the number of bytes consumed since we last increased myWindow
+ windowMu sync.Mutex
+ myWindow uint32
+ myConsumed uint32
+
+ // writeMu serializes calls to mux.conn.writePacket() and
+ // protects sentClose and packetPool. This mutex must be
+ // different from windowMu, as writePacket can block if there
+ // is a key exchange pending.
+ writeMu sync.Mutex
+ sentClose bool
+
+ // packetPool has a buffer for each extended channel ID to
+ // save allocations during writes.
+ packetPool map[uint32][]byte
+}
+
+// writePacket sends a packet. If the packet is a channel close, it updates
+// sentClose. This method takes the lock c.writeMu.
+func (ch *channel) writePacket(packet []byte) error {
+ ch.writeMu.Lock()
+ if ch.sentClose {
+ ch.writeMu.Unlock()
+ return io.EOF
+ }
+ ch.sentClose = (packet[0] == msgChannelClose)
+ err := ch.mux.conn.writePacket(packet)
+ ch.writeMu.Unlock()
+ return err
+}
+
+func (ch *channel) sendMessage(msg interface{}) error {
+ if debugMux {
+ log.Printf("send(%d): %#v", ch.mux.chanList.offset, msg)
+ }
+
+ p := Marshal(msg)
+ binary.BigEndian.PutUint32(p[1:], ch.remoteId)
+ return ch.writePacket(p)
+}
+
+// WriteExtended writes data to a specific extended stream. These streams are
+// used, for example, for stderr.
+func (ch *channel) WriteExtended(data []byte, extendedCode uint32) (n int, err error) {
+ if ch.sentEOF {
+ return 0, io.EOF
+ }
+ // 1 byte message type, 4 bytes remoteId, 4 bytes data length
+ opCode := byte(msgChannelData)
+ headerLength := uint32(9)
+ if extendedCode > 0 {
+ headerLength += 4
+ opCode = msgChannelExtendedData
+ }
+
+ ch.writeMu.Lock()
+ packet := ch.packetPool[extendedCode]
+ // We don't remove the buffer from packetPool, so
+ // WriteExtended calls from different goroutines will be
+ // flagged as errors by the race detector.
+ ch.writeMu.Unlock()
+
+ for len(data) > 0 {
+ space := min(ch.maxRemotePayload, len(data))
+ if space, err = ch.remoteWin.reserve(space); err != nil {
+ return n, err
+ }
+ if want := headerLength + space; uint32(cap(packet)) < want {
+ packet = make([]byte, want)
+ } else {
+ packet = packet[:want]
+ }
+
+ todo := data[:space]
+
+ packet[0] = opCode
+ binary.BigEndian.PutUint32(packet[1:], ch.remoteId)
+ if extendedCode > 0 {
+ binary.BigEndian.PutUint32(packet[5:], uint32(extendedCode))
+ }
+ binary.BigEndian.PutUint32(packet[headerLength-4:], uint32(len(todo)))
+ copy(packet[headerLength:], todo)
+ if err = ch.writePacket(packet); err != nil {
+ return n, err
+ }
+
+ n += len(todo)
+ data = data[len(todo):]
+ }
+
+ ch.writeMu.Lock()
+ ch.packetPool[extendedCode] = packet
+ ch.writeMu.Unlock()
+
+ return n, err
+}
+
+func (ch *channel) handleData(packet []byte) error {
+ headerLen := 9
+ isExtendedData := packet[0] == msgChannelExtendedData
+ if isExtendedData {
+ headerLen = 13
+ }
+ if len(packet) < headerLen {
+ // malformed data packet
+ return parseError(packet[0])
+ }
+
+ var extended uint32
+ if isExtendedData {
+ extended = binary.BigEndian.Uint32(packet[5:])
+ }
+
+ length := binary.BigEndian.Uint32(packet[headerLen-4 : headerLen])
+ if length == 0 {
+ return nil
+ }
+ if length > ch.maxIncomingPayload {
+ // TODO(hanwen): should send Disconnect?
+ return errors.New("ssh: incoming packet exceeds maximum payload size")
+ }
+
+ data := packet[headerLen:]
+ if length != uint32(len(data)) {
+ return errors.New("ssh: wrong packet length")
+ }
+
+ ch.windowMu.Lock()
+ if ch.myWindow < length {
+ ch.windowMu.Unlock()
+ // TODO(hanwen): should send Disconnect with reason?
+ return errors.New("ssh: remote side wrote too much")
+ }
+ ch.myWindow -= length
+ ch.windowMu.Unlock()
+
+ if extended == 1 {
+ ch.extPending.write(data)
+ } else if extended > 0 {
+ // discard other extended data.
+ } else {
+ ch.pending.write(data)
+ }
+ return nil
+}
+
+func (c *channel) adjustWindow(adj uint32) error {
+ c.windowMu.Lock()
+ // Since myConsumed and myWindow are managed on our side, and can never
+ // exceed the initial window setting, we don't worry about overflow.
+ c.myConsumed += adj
+ var sendAdj uint32
+ if (channelWindowSize-c.myWindow > 3*c.maxIncomingPayload) ||
+ (c.myWindow < channelWindowSize/2) {
+ sendAdj = c.myConsumed
+ c.myConsumed = 0
+ c.myWindow += sendAdj
+ }
+ c.windowMu.Unlock()
+ if sendAdj == 0 {
+ return nil
+ }
+ return c.sendMessage(windowAdjustMsg{
+ AdditionalBytes: sendAdj,
+ })
+}
+
+func (c *channel) ReadExtended(data []byte, extended uint32) (n int, err error) {
+ switch extended {
+ case 1:
+ n, err = c.extPending.Read(data)
+ case 0:
+ n, err = c.pending.Read(data)
+ default:
+ return 0, fmt.Errorf("ssh: extended code %d unimplemented", extended)
+ }
+
+ if n > 0 {
+ err = c.adjustWindow(uint32(n))
+ // sendWindowAdjust can return io.EOF if the remote
+ // peer has closed the connection, however we want to
+ // defer forwarding io.EOF to the caller of Read until
+ // the buffer has been drained.
+ if n > 0 && err == io.EOF {
+ err = nil
+ }
+ }
+
+ return n, err
+}
+
+func (c *channel) close() {
+ c.pending.eof()
+ c.extPending.eof()
+ close(c.msg)
+ close(c.incomingRequests)
+ c.writeMu.Lock()
+ // This is not necessary for a normal channel teardown, but if
+ // there was another error, it is.
+ c.sentClose = true
+ c.writeMu.Unlock()
+ // Unblock writers.
+ c.remoteWin.close()
+}
+
+// responseMessageReceived is called when a success or failure message is
+// received on a channel to check that such a message is reasonable for the
+// given channel.
+func (ch *channel) responseMessageReceived() error {
+ if ch.direction == channelInbound {
+ return errors.New("ssh: channel response message received on inbound channel")
+ }
+ if ch.decided {
+ return errors.New("ssh: duplicate response received for channel")
+ }
+ ch.decided = true
+ return nil
+}
+
+func (ch *channel) handlePacket(packet []byte) error {
+ switch packet[0] {
+ case msgChannelData, msgChannelExtendedData:
+ return ch.handleData(packet)
+ case msgChannelClose:
+ ch.sendMessage(channelCloseMsg{PeersID: ch.remoteId})
+ ch.mux.chanList.remove(ch.localId)
+ ch.close()
+ return nil
+ case msgChannelEOF:
+ // RFC 4254 is mute on how EOF affects dataExt messages but
+ // it is logical to signal EOF at the same time.
+ ch.extPending.eof()
+ ch.pending.eof()
+ return nil
+ }
+
+ decoded, err := decode(packet)
+ if err != nil {
+ return err
+ }
+
+ switch msg := decoded.(type) {
+ case *channelOpenFailureMsg:
+ if err := ch.responseMessageReceived(); err != nil {
+ return err
+ }
+ ch.mux.chanList.remove(msg.PeersID)
+ ch.msg <- msg
+ case *channelOpenConfirmMsg:
+ if err := ch.responseMessageReceived(); err != nil {
+ return err
+ }
+ if msg.MaxPacketSize < minPacketLength || msg.MaxPacketSize > 1<<31 {
+ return fmt.Errorf("ssh: invalid MaxPacketSize %d from peer", msg.MaxPacketSize)
+ }
+ ch.remoteId = msg.MyID
+ ch.maxRemotePayload = msg.MaxPacketSize
+ ch.remoteWin.add(msg.MyWindow)
+ ch.msg <- msg
+ case *windowAdjustMsg:
+ if !ch.remoteWin.add(msg.AdditionalBytes) {
+ return fmt.Errorf("ssh: invalid window update for %d bytes", msg.AdditionalBytes)
+ }
+ case *channelRequestMsg:
+ req := Request{
+ Type: msg.Request,
+ WantReply: msg.WantReply,
+ Payload: msg.RequestSpecificData,
+ ch: ch,
+ }
+
+ ch.incomingRequests <- &req
+ default:
+ ch.msg <- msg
+ }
+ return nil
+}
+
+func (m *mux) newChannel(chanType string, direction channelDirection, extraData []byte) *channel {
+ ch := &channel{
+ remoteWin: window{Cond: newCond()},
+ myWindow: channelWindowSize,
+ pending: newBuffer(),
+ extPending: newBuffer(),
+ direction: direction,
+ incomingRequests: make(chan *Request, chanSize),
+ msg: make(chan interface{}, chanSize),
+ chanType: chanType,
+ extraData: extraData,
+ mux: m,
+ packetPool: make(map[uint32][]byte),
+ }
+ ch.localId = m.chanList.add(ch)
+ return ch
+}
+
+var errUndecided = errors.New("ssh: must Accept or Reject channel")
+var errDecidedAlready = errors.New("ssh: can call Accept or Reject only once")
+
+type extChannel struct {
+ code uint32
+ ch *channel
+}
+
+func (e *extChannel) Write(data []byte) (n int, err error) {
+ return e.ch.WriteExtended(data, e.code)
+}
+
+func (e *extChannel) Read(data []byte) (n int, err error) {
+ return e.ch.ReadExtended(data, e.code)
+}
+
+func (ch *channel) Accept() (Channel, <-chan *Request, error) {
+ if ch.decided {
+ return nil, nil, errDecidedAlready
+ }
+ ch.maxIncomingPayload = channelMaxPacket
+ confirm := channelOpenConfirmMsg{
+ PeersID: ch.remoteId,
+ MyID: ch.localId,
+ MyWindow: ch.myWindow,
+ MaxPacketSize: ch.maxIncomingPayload,
+ }
+ ch.decided = true
+ if err := ch.sendMessage(confirm); err != nil {
+ return nil, nil, err
+ }
+
+ return ch, ch.incomingRequests, nil
+}
+
+func (ch *channel) Reject(reason RejectionReason, message string) error {
+ if ch.decided {
+ return errDecidedAlready
+ }
+ reject := channelOpenFailureMsg{
+ PeersID: ch.remoteId,
+ Reason: reason,
+ Message: message,
+ Language: "en",
+ }
+ ch.decided = true
+ return ch.sendMessage(reject)
+}
+
+func (ch *channel) Read(data []byte) (int, error) {
+ if !ch.decided {
+ return 0, errUndecided
+ }
+ return ch.ReadExtended(data, 0)
+}
+
+func (ch *channel) Write(data []byte) (int, error) {
+ if !ch.decided {
+ return 0, errUndecided
+ }
+ return ch.WriteExtended(data, 0)
+}
+
+func (ch *channel) CloseWrite() error {
+ if !ch.decided {
+ return errUndecided
+ }
+ ch.sentEOF = true
+ return ch.sendMessage(channelEOFMsg{
+ PeersID: ch.remoteId})
+}
+
+func (ch *channel) Close() error {
+ if !ch.decided {
+ return errUndecided
+ }
+
+ return ch.sendMessage(channelCloseMsg{
+ PeersID: ch.remoteId})
+}
+
+// Extended returns an io.ReadWriter that sends and receives data on the given,
+// SSH extended stream. Such streams are used, for example, for stderr.
+func (ch *channel) Extended(code uint32) io.ReadWriter {
+ if !ch.decided {
+ return nil
+ }
+ return &extChannel{code, ch}
+}
+
+func (ch *channel) Stderr() io.ReadWriter {
+ return ch.Extended(1)
+}
+
+func (ch *channel) SendRequest(name string, wantReply bool, payload []byte) (bool, error) {
+ if !ch.decided {
+ return false, errUndecided
+ }
+
+ if wantReply {
+ ch.sentRequestMu.Lock()
+ defer ch.sentRequestMu.Unlock()
+ }
+
+ msg := channelRequestMsg{
+ PeersID: ch.remoteId,
+ Request: name,
+ WantReply: wantReply,
+ RequestSpecificData: payload,
+ }
+
+ if err := ch.sendMessage(msg); err != nil {
+ return false, err
+ }
+
+ if wantReply {
+ m, ok := (<-ch.msg)
+ if !ok {
+ return false, io.EOF
+ }
+ switch m.(type) {
+ case *channelRequestFailureMsg:
+ return false, nil
+ case *channelRequestSuccessMsg:
+ return true, nil
+ default:
+ return false, fmt.Errorf("ssh: unexpected response to channel request: %#v", m)
+ }
+ }
+
+ return false, nil
+}
+
+// ackRequest either sends an ack or nack to the channel request.
+func (ch *channel) ackRequest(ok bool) error {
+ if !ch.decided {
+ return errUndecided
+ }
+
+ var msg interface{}
+ if !ok {
+ msg = channelRequestFailureMsg{
+ PeersID: ch.remoteId,
+ }
+ } else {
+ msg = channelRequestSuccessMsg{
+ PeersID: ch.remoteId,
+ }
+ }
+ return ch.sendMessage(msg)
+}
+
+func (ch *channel) ChannelType() string {
+ return ch.chanType
+}
+
+func (ch *channel) ExtraData() []byte {
+ return ch.extraData
+}
diff --git a/vendor/golang.org/x/crypto/ssh/cipher.go b/vendor/golang.org/x/crypto/ssh/cipher.go
new file mode 100644
index 00000000..741e984f
--- /dev/null
+++ b/vendor/golang.org/x/crypto/ssh/cipher.go
@@ -0,0 +1,789 @@
+// Copyright 2011 The Go Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style
+// license that can be found in the LICENSE file.
+
+package ssh
+
+import (
+ "crypto/aes"
+ "crypto/cipher"
+ "crypto/des"
+ "crypto/rc4"
+ "crypto/subtle"
+ "encoding/binary"
+ "errors"
+ "fmt"
+ "hash"
+ "io"
+
+ "golang.org/x/crypto/chacha20"
+ "golang.org/x/crypto/internal/poly1305"
+)
+
+const (
+ packetSizeMultiple = 16 // TODO(huin) this should be determined by the cipher.
+
+ // RFC 4253 section 6.1 defines a minimum packet size of 32768 that implementations
+ // MUST be able to process (plus a few more kilobytes for padding and mac). The RFC
+ // indicates implementations SHOULD be able to handle larger packet sizes, but then
+ // waffles on about reasonable limits.
+ //
+ // OpenSSH caps their maxPacket at 256kB so we choose to do
+ // the same. maxPacket is also used to ensure that uint32
+ // length fields do not overflow, so it should remain well
+ // below 4G.
+ maxPacket = 256 * 1024
+)
+
+// noneCipher implements cipher.Stream and provides no encryption. It is used
+// by the transport before the first key-exchange.
+type noneCipher struct{}
+
+func (c noneCipher) XORKeyStream(dst, src []byte) {
+ copy(dst, src)
+}
+
+func newAESCTR(key, iv []byte) (cipher.Stream, error) {
+ c, err := aes.NewCipher(key)
+ if err != nil {
+ return nil, err
+ }
+ return cipher.NewCTR(c, iv), nil
+}
+
+func newRC4(key, iv []byte) (cipher.Stream, error) {
+ return rc4.NewCipher(key)
+}
+
+type cipherMode struct {
+ keySize int
+ ivSize int
+ create func(key, iv []byte, macKey []byte, algs directionAlgorithms) (packetCipher, error)
+}
+
+func streamCipherMode(skip int, createFunc func(key, iv []byte) (cipher.Stream, error)) func(key, iv []byte, macKey []byte, algs directionAlgorithms) (packetCipher, error) {
+ return func(key, iv, macKey []byte, algs directionAlgorithms) (packetCipher, error) {
+ stream, err := createFunc(key, iv)
+ if err != nil {
+ return nil, err
+ }
+
+ var streamDump []byte
+ if skip > 0 {
+ streamDump = make([]byte, 512)
+ }
+
+ for remainingToDump := skip; remainingToDump > 0; {
+ dumpThisTime := remainingToDump
+ if dumpThisTime > len(streamDump) {
+ dumpThisTime = len(streamDump)
+ }
+ stream.XORKeyStream(streamDump[:dumpThisTime], streamDump[:dumpThisTime])
+ remainingToDump -= dumpThisTime
+ }
+
+ mac := macModes[algs.MAC].new(macKey)
+ return &streamPacketCipher{
+ mac: mac,
+ etm: macModes[algs.MAC].etm,
+ macResult: make([]byte, mac.Size()),
+ cipher: stream,
+ }, nil
+ }
+}
+
+// cipherModes documents properties of supported ciphers. Ciphers not included
+// are not supported and will not be negotiated, even if explicitly requested in
+// ClientConfig.Crypto.Ciphers.
+var cipherModes = map[string]*cipherMode{
+ // Ciphers from RFC 4344, which introduced many CTR-based ciphers. Algorithms
+ // are defined in the order specified in the RFC.
+ "aes128-ctr": {16, aes.BlockSize, streamCipherMode(0, newAESCTR)},
+ "aes192-ctr": {24, aes.BlockSize, streamCipherMode(0, newAESCTR)},
+ "aes256-ctr": {32, aes.BlockSize, streamCipherMode(0, newAESCTR)},
+
+ // Ciphers from RFC 4345, which introduces security-improved arcfour ciphers.
+ // They are defined in the order specified in the RFC.
+ "arcfour128": {16, 0, streamCipherMode(1536, newRC4)},
+ "arcfour256": {32, 0, streamCipherMode(1536, newRC4)},
+
+ // Cipher defined in RFC 4253, which describes SSH Transport Layer Protocol.
+ // Note that this cipher is not safe, as stated in RFC 4253: "Arcfour (and
+ // RC4) has problems with weak keys, and should be used with caution."
+ // RFC 4345 introduces improved versions of Arcfour.
+ "arcfour": {16, 0, streamCipherMode(0, newRC4)},
+
+ // AEAD ciphers
+ gcm128CipherID: {16, 12, newGCMCipher},
+ gcm256CipherID: {32, 12, newGCMCipher},
+ chacha20Poly1305ID: {64, 0, newChaCha20Cipher},
+
+ // CBC mode is insecure and so is not included in the default config.
+ // (See https://www.ieee-security.org/TC/SP2013/papers/4977a526.pdf). If absolutely
+ // needed, it's possible to specify a custom Config to enable it.
+ // You should expect that an active attacker can recover plaintext if
+ // you do.
+ aes128cbcID: {16, aes.BlockSize, newAESCBCCipher},
+
+ // 3des-cbc is insecure and is not included in the default
+ // config.
+ tripledescbcID: {24, des.BlockSize, newTripleDESCBCCipher},
+}
+
+// prefixLen is the length of the packet prefix that contains the packet length
+// and number of padding bytes.
+const prefixLen = 5
+
+// streamPacketCipher is a packetCipher using a stream cipher.
+type streamPacketCipher struct {
+ mac hash.Hash
+ cipher cipher.Stream
+ etm bool
+
+ // The following members are to avoid per-packet allocations.
+ prefix [prefixLen]byte
+ seqNumBytes [4]byte
+ padding [2 * packetSizeMultiple]byte
+ packetData []byte
+ macResult []byte
+}
+
+// readCipherPacket reads and decrypt a single packet from the reader argument.
+func (s *streamPacketCipher) readCipherPacket(seqNum uint32, r io.Reader) ([]byte, error) {
+ if _, err := io.ReadFull(r, s.prefix[:]); err != nil {
+ return nil, err
+ }
+
+ var encryptedPaddingLength [1]byte
+ if s.mac != nil && s.etm {
+ copy(encryptedPaddingLength[:], s.prefix[4:5])
+ s.cipher.XORKeyStream(s.prefix[4:5], s.prefix[4:5])
+ } else {
+ s.cipher.XORKeyStream(s.prefix[:], s.prefix[:])
+ }
+
+ length := binary.BigEndian.Uint32(s.prefix[0:4])
+ paddingLength := uint32(s.prefix[4])
+
+ var macSize uint32
+ if s.mac != nil {
+ s.mac.Reset()
+ binary.BigEndian.PutUint32(s.seqNumBytes[:], seqNum)
+ s.mac.Write(s.seqNumBytes[:])
+ if s.etm {
+ s.mac.Write(s.prefix[:4])
+ s.mac.Write(encryptedPaddingLength[:])
+ } else {
+ s.mac.Write(s.prefix[:])
+ }
+ macSize = uint32(s.mac.Size())
+ }
+
+ if length <= paddingLength+1 {
+ return nil, errors.New("ssh: invalid packet length, packet too small")
+ }
+
+ if length > maxPacket {
+ return nil, errors.New("ssh: invalid packet length, packet too large")
+ }
+
+ // the maxPacket check above ensures that length-1+macSize
+ // does not overflow.
+ if uint32(cap(s.packetData)) < length-1+macSize {
+ s.packetData = make([]byte, length-1+macSize)
+ } else {
+ s.packetData = s.packetData[:length-1+macSize]
+ }
+
+ if _, err := io.ReadFull(r, s.packetData); err != nil {
+ return nil, err
+ }
+ mac := s.packetData[length-1:]
+ data := s.packetData[:length-1]
+
+ if s.mac != nil && s.etm {
+ s.mac.Write(data)
+ }
+
+ s.cipher.XORKeyStream(data, data)
+
+ if s.mac != nil {
+ if !s.etm {
+ s.mac.Write(data)
+ }
+ s.macResult = s.mac.Sum(s.macResult[:0])
+ if subtle.ConstantTimeCompare(s.macResult, mac) != 1 {
+ return nil, errors.New("ssh: MAC failure")
+ }
+ }
+
+ return s.packetData[:length-paddingLength-1], nil
+}
+
+// writeCipherPacket encrypts and sends a packet of data to the writer argument
+func (s *streamPacketCipher) writeCipherPacket(seqNum uint32, w io.Writer, rand io.Reader, packet []byte) error {
+ if len(packet) > maxPacket {
+ return errors.New("ssh: packet too large")
+ }
+
+ aadlen := 0
+ if s.mac != nil && s.etm {
+ // packet length is not encrypted for EtM modes
+ aadlen = 4
+ }
+
+ paddingLength := packetSizeMultiple - (prefixLen+len(packet)-aadlen)%packetSizeMultiple
+ if paddingLength < 4 {
+ paddingLength += packetSizeMultiple
+ }
+
+ length := len(packet) + 1 + paddingLength
+ binary.BigEndian.PutUint32(s.prefix[:], uint32(length))
+ s.prefix[4] = byte(paddingLength)
+ padding := s.padding[:paddingLength]
+ if _, err := io.ReadFull(rand, padding); err != nil {
+ return err
+ }
+
+ if s.mac != nil {
+ s.mac.Reset()
+ binary.BigEndian.PutUint32(s.seqNumBytes[:], seqNum)
+ s.mac.Write(s.seqNumBytes[:])
+
+ if s.etm {
+ // For EtM algorithms, the packet length must stay unencrypted,
+ // but the following data (padding length) must be encrypted
+ s.cipher.XORKeyStream(s.prefix[4:5], s.prefix[4:5])
+ }
+
+ s.mac.Write(s.prefix[:])
+
+ if !s.etm {
+ // For non-EtM algorithms, the algorithm is applied on unencrypted data
+ s.mac.Write(packet)
+ s.mac.Write(padding)
+ }
+ }
+
+ if !(s.mac != nil && s.etm) {
+ // For EtM algorithms, the padding length has already been encrypted
+ // and the packet length must remain unencrypted
+ s.cipher.XORKeyStream(s.prefix[:], s.prefix[:])
+ }
+
+ s.cipher.XORKeyStream(packet, packet)
+ s.cipher.XORKeyStream(padding, padding)
+
+ if s.mac != nil && s.etm {
+ // For EtM algorithms, packet and padding must be encrypted
+ s.mac.Write(packet)
+ s.mac.Write(padding)
+ }
+
+ if _, err := w.Write(s.prefix[:]); err != nil {
+ return err
+ }
+ if _, err := w.Write(packet); err != nil {
+ return err
+ }
+ if _, err := w.Write(padding); err != nil {
+ return err
+ }
+
+ if s.mac != nil {
+ s.macResult = s.mac.Sum(s.macResult[:0])
+ if _, err := w.Write(s.macResult); err != nil {
+ return err
+ }
+ }
+
+ return nil
+}
+
+type gcmCipher struct {
+ aead cipher.AEAD
+ prefix [4]byte
+ iv []byte
+ buf []byte
+}
+
+func newGCMCipher(key, iv, unusedMacKey []byte, unusedAlgs directionAlgorithms) (packetCipher, error) {
+ c, err := aes.NewCipher(key)
+ if err != nil {
+ return nil, err
+ }
+
+ aead, err := cipher.NewGCM(c)
+ if err != nil {
+ return nil, err
+ }
+
+ return &gcmCipher{
+ aead: aead,
+ iv: iv,
+ }, nil
+}
+
+const gcmTagSize = 16
+
+func (c *gcmCipher) writeCipherPacket(seqNum uint32, w io.Writer, rand io.Reader, packet []byte) error {
+ // Pad out to multiple of 16 bytes. This is different from the
+ // stream cipher because that encrypts the length too.
+ padding := byte(packetSizeMultiple - (1+len(packet))%packetSizeMultiple)
+ if padding < 4 {
+ padding += packetSizeMultiple
+ }
+
+ length := uint32(len(packet) + int(padding) + 1)
+ binary.BigEndian.PutUint32(c.prefix[:], length)
+ if _, err := w.Write(c.prefix[:]); err != nil {
+ return err
+ }
+
+ if cap(c.buf) < int(length) {
+ c.buf = make([]byte, length)
+ } else {
+ c.buf = c.buf[:length]
+ }
+
+ c.buf[0] = padding
+ copy(c.buf[1:], packet)
+ if _, err := io.ReadFull(rand, c.buf[1+len(packet):]); err != nil {
+ return err
+ }
+ c.buf = c.aead.Seal(c.buf[:0], c.iv, c.buf, c.prefix[:])
+ if _, err := w.Write(c.buf); err != nil {
+ return err
+ }
+ c.incIV()
+
+ return nil
+}
+
+func (c *gcmCipher) incIV() {
+ for i := 4 + 7; i >= 4; i-- {
+ c.iv[i]++
+ if c.iv[i] != 0 {
+ break
+ }
+ }
+}
+
+func (c *gcmCipher) readCipherPacket(seqNum uint32, r io.Reader) ([]byte, error) {
+ if _, err := io.ReadFull(r, c.prefix[:]); err != nil {
+ return nil, err
+ }
+ length := binary.BigEndian.Uint32(c.prefix[:])
+ if length > maxPacket {
+ return nil, errors.New("ssh: max packet length exceeded")
+ }
+
+ if cap(c.buf) < int(length+gcmTagSize) {
+ c.buf = make([]byte, length+gcmTagSize)
+ } else {
+ c.buf = c.buf[:length+gcmTagSize]
+ }
+
+ if _, err := io.ReadFull(r, c.buf); err != nil {
+ return nil, err
+ }
+
+ plain, err := c.aead.Open(c.buf[:0], c.iv, c.buf, c.prefix[:])
+ if err != nil {
+ return nil, err
+ }
+ c.incIV()
+
+ if len(plain) == 0 {
+ return nil, errors.New("ssh: empty packet")
+ }
+
+ padding := plain[0]
+ if padding < 4 {
+ // padding is a byte, so it automatically satisfies
+ // the maximum size, which is 255.
+ return nil, fmt.Errorf("ssh: illegal padding %d", padding)
+ }
+
+ if int(padding+1) >= len(plain) {
+ return nil, fmt.Errorf("ssh: padding %d too large", padding)
+ }
+ plain = plain[1 : length-uint32(padding)]
+ return plain, nil
+}
+
+// cbcCipher implements aes128-cbc cipher defined in RFC 4253 section 6.1
+type cbcCipher struct {
+ mac hash.Hash
+ macSize uint32
+ decrypter cipher.BlockMode
+ encrypter cipher.BlockMode
+
+ // The following members are to avoid per-packet allocations.
+ seqNumBytes [4]byte
+ packetData []byte
+ macResult []byte
+
+ // Amount of data we should still read to hide which
+ // verification error triggered.
+ oracleCamouflage uint32
+}
+
+func newCBCCipher(c cipher.Block, key, iv, macKey []byte, algs directionAlgorithms) (packetCipher, error) {
+ cbc := &cbcCipher{
+ mac: macModes[algs.MAC].new(macKey),
+ decrypter: cipher.NewCBCDecrypter(c, iv),
+ encrypter: cipher.NewCBCEncrypter(c, iv),
+ packetData: make([]byte, 1024),
+ }
+ if cbc.mac != nil {
+ cbc.macSize = uint32(cbc.mac.Size())
+ }
+
+ return cbc, nil
+}
+
+func newAESCBCCipher(key, iv, macKey []byte, algs directionAlgorithms) (packetCipher, error) {
+ c, err := aes.NewCipher(key)
+ if err != nil {
+ return nil, err
+ }
+
+ cbc, err := newCBCCipher(c, key, iv, macKey, algs)
+ if err != nil {
+ return nil, err
+ }
+
+ return cbc, nil
+}
+
+func newTripleDESCBCCipher(key, iv, macKey []byte, algs directionAlgorithms) (packetCipher, error) {
+ c, err := des.NewTripleDESCipher(key)
+ if err != nil {
+ return nil, err
+ }
+
+ cbc, err := newCBCCipher(c, key, iv, macKey, algs)
+ if err != nil {
+ return nil, err
+ }
+
+ return cbc, nil
+}
+
+func maxUInt32(a, b int) uint32 {
+ if a > b {
+ return uint32(a)
+ }
+ return uint32(b)
+}
+
+const (
+ cbcMinPacketSizeMultiple = 8
+ cbcMinPacketSize = 16
+ cbcMinPaddingSize = 4
+)
+
+// cbcError represents a verification error that may leak information.
+type cbcError string
+
+func (e cbcError) Error() string { return string(e) }
+
+func (c *cbcCipher) readCipherPacket(seqNum uint32, r io.Reader) ([]byte, error) {
+ p, err := c.readCipherPacketLeaky(seqNum, r)
+ if err != nil {
+ if _, ok := err.(cbcError); ok {
+ // Verification error: read a fixed amount of
+ // data, to make distinguishing between
+ // failing MAC and failing length check more
+ // difficult.
+ io.CopyN(io.Discard, r, int64(c.oracleCamouflage))
+ }
+ }
+ return p, err
+}
+
+func (c *cbcCipher) readCipherPacketLeaky(seqNum uint32, r io.Reader) ([]byte, error) {
+ blockSize := c.decrypter.BlockSize()
+
+ // Read the header, which will include some of the subsequent data in the
+ // case of block ciphers - this is copied back to the payload later.
+ // How many bytes of payload/padding will be read with this first read.
+ firstBlockLength := uint32((prefixLen + blockSize - 1) / blockSize * blockSize)
+ firstBlock := c.packetData[:firstBlockLength]
+ if _, err := io.ReadFull(r, firstBlock); err != nil {
+ return nil, err
+ }
+
+ c.oracleCamouflage = maxPacket + 4 + c.macSize - firstBlockLength
+
+ c.decrypter.CryptBlocks(firstBlock, firstBlock)
+ length := binary.BigEndian.Uint32(firstBlock[:4])
+ if length > maxPacket {
+ return nil, cbcError("ssh: packet too large")
+ }
+ if length+4 < maxUInt32(cbcMinPacketSize, blockSize) {
+ // The minimum size of a packet is 16 (or the cipher block size, whichever
+ // is larger) bytes.
+ return nil, cbcError("ssh: packet too small")
+ }
+ // The length of the packet (including the length field but not the MAC) must
+ // be a multiple of the block size or 8, whichever is larger.
+ if (length+4)%maxUInt32(cbcMinPacketSizeMultiple, blockSize) != 0 {
+ return nil, cbcError("ssh: invalid packet length multiple")
+ }
+
+ paddingLength := uint32(firstBlock[4])
+ if paddingLength < cbcMinPaddingSize || length <= paddingLength+1 {
+ return nil, cbcError("ssh: invalid packet length")
+ }
+
+ // Positions within the c.packetData buffer:
+ macStart := 4 + length
+ paddingStart := macStart - paddingLength
+
+ // Entire packet size, starting before length, ending at end of mac.
+ entirePacketSize := macStart + c.macSize
+
+ // Ensure c.packetData is large enough for the entire packet data.
+ if uint32(cap(c.packetData)) < entirePacketSize {
+ // Still need to upsize and copy, but this should be rare at runtime, only
+ // on upsizing the packetData buffer.
+ c.packetData = make([]byte, entirePacketSize)
+ copy(c.packetData, firstBlock)
+ } else {
+ c.packetData = c.packetData[:entirePacketSize]
+ }
+
+ n, err := io.ReadFull(r, c.packetData[firstBlockLength:])
+ if err != nil {
+ return nil, err
+ }
+ c.oracleCamouflage -= uint32(n)
+
+ remainingCrypted := c.packetData[firstBlockLength:macStart]
+ c.decrypter.CryptBlocks(remainingCrypted, remainingCrypted)
+
+ mac := c.packetData[macStart:]
+ if c.mac != nil {
+ c.mac.Reset()
+ binary.BigEndian.PutUint32(c.seqNumBytes[:], seqNum)
+ c.mac.Write(c.seqNumBytes[:])
+ c.mac.Write(c.packetData[:macStart])
+ c.macResult = c.mac.Sum(c.macResult[:0])
+ if subtle.ConstantTimeCompare(c.macResult, mac) != 1 {
+ return nil, cbcError("ssh: MAC failure")
+ }
+ }
+
+ return c.packetData[prefixLen:paddingStart], nil
+}
+
+func (c *cbcCipher) writeCipherPacket(seqNum uint32, w io.Writer, rand io.Reader, packet []byte) error {
+ effectiveBlockSize := maxUInt32(cbcMinPacketSizeMultiple, c.encrypter.BlockSize())
+
+ // Length of encrypted portion of the packet (header, payload, padding).
+ // Enforce minimum padding and packet size.
+ encLength := maxUInt32(prefixLen+len(packet)+cbcMinPaddingSize, cbcMinPaddingSize)
+ // Enforce block size.
+ encLength = (encLength + effectiveBlockSize - 1) / effectiveBlockSize * effectiveBlockSize
+
+ length := encLength - 4
+ paddingLength := int(length) - (1 + len(packet))
+
+ // Overall buffer contains: header, payload, padding, mac.
+ // Space for the MAC is reserved in the capacity but not the slice length.
+ bufferSize := encLength + c.macSize
+ if uint32(cap(c.packetData)) < bufferSize {
+ c.packetData = make([]byte, encLength, bufferSize)
+ } else {
+ c.packetData = c.packetData[:encLength]
+ }
+
+ p := c.packetData
+
+ // Packet header.
+ binary.BigEndian.PutUint32(p, length)
+ p = p[4:]
+ p[0] = byte(paddingLength)
+
+ // Payload.
+ p = p[1:]
+ copy(p, packet)
+
+ // Padding.
+ p = p[len(packet):]
+ if _, err := io.ReadFull(rand, p); err != nil {
+ return err
+ }
+
+ if c.mac != nil {
+ c.mac.Reset()
+ binary.BigEndian.PutUint32(c.seqNumBytes[:], seqNum)
+ c.mac.Write(c.seqNumBytes[:])
+ c.mac.Write(c.packetData)
+ // The MAC is now appended into the capacity reserved for it earlier.
+ c.packetData = c.mac.Sum(c.packetData)
+ }
+
+ c.encrypter.CryptBlocks(c.packetData[:encLength], c.packetData[:encLength])
+
+ if _, err := w.Write(c.packetData); err != nil {
+ return err
+ }
+
+ return nil
+}
+
+const chacha20Poly1305ID = "chacha20-poly1305@openssh.com"
+
+// chacha20Poly1305Cipher implements the chacha20-poly1305@openssh.com
+// AEAD, which is described here:
+//
+// https://tools.ietf.org/html/draft-josefsson-ssh-chacha20-poly1305-openssh-00
+//
+// the methods here also implement padding, which RFC 4253 Section 6
+// also requires of stream ciphers.
+type chacha20Poly1305Cipher struct {
+ lengthKey [32]byte
+ contentKey [32]byte
+ buf []byte
+}
+
+func newChaCha20Cipher(key, unusedIV, unusedMACKey []byte, unusedAlgs directionAlgorithms) (packetCipher, error) {
+ if len(key) != 64 {
+ panic(len(key))
+ }
+
+ c := &chacha20Poly1305Cipher{
+ buf: make([]byte, 256),
+ }
+
+ copy(c.contentKey[:], key[:32])
+ copy(c.lengthKey[:], key[32:])
+ return c, nil
+}
+
+func (c *chacha20Poly1305Cipher) readCipherPacket(seqNum uint32, r io.Reader) ([]byte, error) {
+ nonce := make([]byte, 12)
+ binary.BigEndian.PutUint32(nonce[8:], seqNum)
+ s, err := chacha20.NewUnauthenticatedCipher(c.contentKey[:], nonce)
+ if err != nil {
+ return nil, err
+ }
+ var polyKey, discardBuf [32]byte
+ s.XORKeyStream(polyKey[:], polyKey[:])
+ s.XORKeyStream(discardBuf[:], discardBuf[:]) // skip the next 32 bytes
+
+ encryptedLength := c.buf[:4]
+ if _, err := io.ReadFull(r, encryptedLength); err != nil {
+ return nil, err
+ }
+
+ var lenBytes [4]byte
+ ls, err := chacha20.NewUnauthenticatedCipher(c.lengthKey[:], nonce)
+ if err != nil {
+ return nil, err
+ }
+ ls.XORKeyStream(lenBytes[:], encryptedLength)
+
+ length := binary.BigEndian.Uint32(lenBytes[:])
+ if length > maxPacket {
+ return nil, errors.New("ssh: invalid packet length, packet too large")
+ }
+
+ contentEnd := 4 + length
+ packetEnd := contentEnd + poly1305.TagSize
+ if uint32(cap(c.buf)) < packetEnd {
+ c.buf = make([]byte, packetEnd)
+ copy(c.buf[:], encryptedLength)
+ } else {
+ c.buf = c.buf[:packetEnd]
+ }
+
+ if _, err := io.ReadFull(r, c.buf[4:packetEnd]); err != nil {
+ return nil, err
+ }
+
+ var mac [poly1305.TagSize]byte
+ copy(mac[:], c.buf[contentEnd:packetEnd])
+ if !poly1305.Verify(&mac, c.buf[:contentEnd], &polyKey) {
+ return nil, errors.New("ssh: MAC failure")
+ }
+
+ plain := c.buf[4:contentEnd]
+ s.XORKeyStream(plain, plain)
+
+ if len(plain) == 0 {
+ return nil, errors.New("ssh: empty packet")
+ }
+
+ padding := plain[0]
+ if padding < 4 {
+ // padding is a byte, so it automatically satisfies
+ // the maximum size, which is 255.
+ return nil, fmt.Errorf("ssh: illegal padding %d", padding)
+ }
+
+ if int(padding)+1 >= len(plain) {
+ return nil, fmt.Errorf("ssh: padding %d too large", padding)
+ }
+
+ plain = plain[1 : len(plain)-int(padding)]
+
+ return plain, nil
+}
+
+func (c *chacha20Poly1305Cipher) writeCipherPacket(seqNum uint32, w io.Writer, rand io.Reader, payload []byte) error {
+ nonce := make([]byte, 12)
+ binary.BigEndian.PutUint32(nonce[8:], seqNum)
+ s, err := chacha20.NewUnauthenticatedCipher(c.contentKey[:], nonce)
+ if err != nil {
+ return err
+ }
+ var polyKey, discardBuf [32]byte
+ s.XORKeyStream(polyKey[:], polyKey[:])
+ s.XORKeyStream(discardBuf[:], discardBuf[:]) // skip the next 32 bytes
+
+ // There is no blocksize, so fall back to multiple of 8 byte
+ // padding, as described in RFC 4253, Sec 6.
+ const packetSizeMultiple = 8
+
+ padding := packetSizeMultiple - (1+len(payload))%packetSizeMultiple
+ if padding < 4 {
+ padding += packetSizeMultiple
+ }
+
+ // size (4 bytes), padding (1), payload, padding, tag.
+ totalLength := 4 + 1 + len(payload) + padding + poly1305.TagSize
+ if cap(c.buf) < totalLength {
+ c.buf = make([]byte, totalLength)
+ } else {
+ c.buf = c.buf[:totalLength]
+ }
+
+ binary.BigEndian.PutUint32(c.buf, uint32(1+len(payload)+padding))
+ ls, err := chacha20.NewUnauthenticatedCipher(c.lengthKey[:], nonce)
+ if err != nil {
+ return err
+ }
+ ls.XORKeyStream(c.buf, c.buf[:4])
+ c.buf[4] = byte(padding)
+ copy(c.buf[5:], payload)
+ packetEnd := 5 + len(payload) + padding
+ if _, err := io.ReadFull(rand, c.buf[5+len(payload):packetEnd]); err != nil {
+ return err
+ }
+
+ s.XORKeyStream(c.buf[4:], c.buf[4:packetEnd])
+
+ var mac [poly1305.TagSize]byte
+ poly1305.Sum(&mac, c.buf[:packetEnd], &polyKey)
+
+ copy(c.buf[packetEnd:], mac[:])
+
+ if _, err := w.Write(c.buf); err != nil {
+ return err
+ }
+ return nil
+}
diff --git a/vendor/golang.org/x/crypto/ssh/client.go b/vendor/golang.org/x/crypto/ssh/client.go
new file mode 100644
index 00000000..fd8c4974
--- /dev/null
+++ b/vendor/golang.org/x/crypto/ssh/client.go
@@ -0,0 +1,282 @@
+// Copyright 2011 The Go Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style
+// license that can be found in the LICENSE file.
+
+package ssh
+
+import (
+ "bytes"
+ "errors"
+ "fmt"
+ "net"
+ "os"
+ "sync"
+ "time"
+)
+
+// Client implements a traditional SSH client that supports shells,
+// subprocesses, TCP port/streamlocal forwarding and tunneled dialing.
+type Client struct {
+ Conn
+
+ handleForwardsOnce sync.Once // guards calling (*Client).handleForwards
+
+ forwards forwardList // forwarded tcpip connections from the remote side
+ mu sync.Mutex
+ channelHandlers map[string]chan NewChannel
+}
+
+// HandleChannelOpen returns a channel on which NewChannel requests
+// for the given type are sent. If the type already is being handled,
+// nil is returned. The channel is closed when the connection is closed.
+func (c *Client) HandleChannelOpen(channelType string) <-chan NewChannel {
+ c.mu.Lock()
+ defer c.mu.Unlock()
+ if c.channelHandlers == nil {
+ // The SSH channel has been closed.
+ c := make(chan NewChannel)
+ close(c)
+ return c
+ }
+
+ ch := c.channelHandlers[channelType]
+ if ch != nil {
+ return nil
+ }
+
+ ch = make(chan NewChannel, chanSize)
+ c.channelHandlers[channelType] = ch
+ return ch
+}
+
+// NewClient creates a Client on top of the given connection.
+func NewClient(c Conn, chans <-chan NewChannel, reqs <-chan *Request) *Client {
+ conn := &Client{
+ Conn: c,
+ channelHandlers: make(map[string]chan NewChannel, 1),
+ }
+
+ go conn.handleGlobalRequests(reqs)
+ go conn.handleChannelOpens(chans)
+ go func() {
+ conn.Wait()
+ conn.forwards.closeAll()
+ }()
+ return conn
+}
+
+// NewClientConn establishes an authenticated SSH connection using c
+// as the underlying transport. The Request and NewChannel channels
+// must be serviced or the connection will hang.
+func NewClientConn(c net.Conn, addr string, config *ClientConfig) (Conn, <-chan NewChannel, <-chan *Request, error) {
+ fullConf := *config
+ fullConf.SetDefaults()
+ if fullConf.HostKeyCallback == nil {
+ c.Close()
+ return nil, nil, nil, errors.New("ssh: must specify HostKeyCallback")
+ }
+
+ conn := &connection{
+ sshConn: sshConn{conn: c, user: fullConf.User},
+ }
+
+ if err := conn.clientHandshake(addr, &fullConf); err != nil {
+ c.Close()
+ return nil, nil, nil, fmt.Errorf("ssh: handshake failed: %w", err)
+ }
+ conn.mux = newMux(conn.transport)
+ return conn, conn.mux.incomingChannels, conn.mux.incomingRequests, nil
+}
+
+// clientHandshake performs the client side key exchange. See RFC 4253 Section
+// 7.
+func (c *connection) clientHandshake(dialAddress string, config *ClientConfig) error {
+ if config.ClientVersion != "" {
+ c.clientVersion = []byte(config.ClientVersion)
+ } else {
+ c.clientVersion = []byte(packageVersion)
+ }
+ var err error
+ c.serverVersion, err = exchangeVersions(c.sshConn.conn, c.clientVersion)
+ if err != nil {
+ return err
+ }
+
+ c.transport = newClientTransport(
+ newTransport(c.sshConn.conn, config.Rand, true /* is client */),
+ c.clientVersion, c.serverVersion, config, dialAddress, c.sshConn.RemoteAddr())
+ if err := c.transport.waitSession(); err != nil {
+ return err
+ }
+
+ c.sessionID = c.transport.getSessionID()
+ return c.clientAuthenticate(config)
+}
+
+// verifyHostKeySignature verifies the host key obtained in the key exchange.
+// algo is the negotiated algorithm, and may be a certificate type.
+func verifyHostKeySignature(hostKey PublicKey, algo string, result *kexResult) error {
+ sig, rest, ok := parseSignatureBody(result.Signature)
+ if len(rest) > 0 || !ok {
+ return errors.New("ssh: signature parse error")
+ }
+
+ if a := underlyingAlgo(algo); sig.Format != a {
+ return fmt.Errorf("ssh: invalid signature algorithm %q, expected %q", sig.Format, a)
+ }
+
+ return hostKey.Verify(result.H, sig)
+}
+
+// NewSession opens a new Session for this client. (A session is a remote
+// execution of a program.)
+func (c *Client) NewSession() (*Session, error) {
+ ch, in, err := c.OpenChannel("session", nil)
+ if err != nil {
+ return nil, err
+ }
+ return newSession(ch, in)
+}
+
+func (c *Client) handleGlobalRequests(incoming <-chan *Request) {
+ for r := range incoming {
+ // This handles keepalive messages and matches
+ // the behaviour of OpenSSH.
+ r.Reply(false, nil)
+ }
+}
+
+// handleChannelOpens channel open messages from the remote side.
+func (c *Client) handleChannelOpens(in <-chan NewChannel) {
+ for ch := range in {
+ c.mu.Lock()
+ handler := c.channelHandlers[ch.ChannelType()]
+ c.mu.Unlock()
+
+ if handler != nil {
+ handler <- ch
+ } else {
+ ch.Reject(UnknownChannelType, fmt.Sprintf("unknown channel type: %v", ch.ChannelType()))
+ }
+ }
+
+ c.mu.Lock()
+ for _, ch := range c.channelHandlers {
+ close(ch)
+ }
+ c.channelHandlers = nil
+ c.mu.Unlock()
+}
+
+// Dial starts a client connection to the given SSH server. It is a
+// convenience function that connects to the given network address,
+// initiates the SSH handshake, and then sets up a Client. For access
+// to incoming channels and requests, use net.Dial with NewClientConn
+// instead.
+func Dial(network, addr string, config *ClientConfig) (*Client, error) {
+ conn, err := net.DialTimeout(network, addr, config.Timeout)
+ if err != nil {
+ return nil, err
+ }
+ c, chans, reqs, err := NewClientConn(conn, addr, config)
+ if err != nil {
+ return nil, err
+ }
+ return NewClient(c, chans, reqs), nil
+}
+
+// HostKeyCallback is the function type used for verifying server
+// keys. A HostKeyCallback must return nil if the host key is OK, or
+// an error to reject it. It receives the hostname as passed to Dial
+// or NewClientConn. The remote address is the RemoteAddr of the
+// net.Conn underlying the SSH connection.
+type HostKeyCallback func(hostname string, remote net.Addr, key PublicKey) error
+
+// BannerCallback is the function type used for treat the banner sent by
+// the server. A BannerCallback receives the message sent by the remote server.
+type BannerCallback func(message string) error
+
+// A ClientConfig structure is used to configure a Client. It must not be
+// modified after having been passed to an SSH function.
+type ClientConfig struct {
+ // Config contains configuration that is shared between clients and
+ // servers.
+ Config
+
+ // User contains the username to authenticate as.
+ User string
+
+ // Auth contains possible authentication methods to use with the
+ // server. Only the first instance of a particular RFC 4252 method will
+ // be used during authentication.
+ Auth []AuthMethod
+
+ // HostKeyCallback is called during the cryptographic
+ // handshake to validate the server's host key. The client
+ // configuration must supply this callback for the connection
+ // to succeed. The functions InsecureIgnoreHostKey or
+ // FixedHostKey can be used for simplistic host key checks.
+ HostKeyCallback HostKeyCallback
+
+ // BannerCallback is called during the SSH dance to display a custom
+ // server's message. The client configuration can supply this callback to
+ // handle it as wished. The function BannerDisplayStderr can be used for
+ // simplistic display on Stderr.
+ BannerCallback BannerCallback
+
+ // ClientVersion contains the version identification string that will
+ // be used for the connection. If empty, a reasonable default is used.
+ ClientVersion string
+
+ // HostKeyAlgorithms lists the public key algorithms that the client will
+ // accept from the server for host key authentication, in order of
+ // preference. If empty, a reasonable default is used. Any
+ // string returned from a PublicKey.Type method may be used, or
+ // any of the CertAlgo and KeyAlgo constants.
+ HostKeyAlgorithms []string
+
+ // Timeout is the maximum amount of time for the TCP connection to establish.
+ //
+ // A Timeout of zero means no timeout.
+ Timeout time.Duration
+}
+
+// InsecureIgnoreHostKey returns a function that can be used for
+// ClientConfig.HostKeyCallback to accept any host key. It should
+// not be used for production code.
+func InsecureIgnoreHostKey() HostKeyCallback {
+ return func(hostname string, remote net.Addr, key PublicKey) error {
+ return nil
+ }
+}
+
+type fixedHostKey struct {
+ key PublicKey
+}
+
+func (f *fixedHostKey) check(hostname string, remote net.Addr, key PublicKey) error {
+ if f.key == nil {
+ return fmt.Errorf("ssh: required host key was nil")
+ }
+ if !bytes.Equal(key.Marshal(), f.key.Marshal()) {
+ return fmt.Errorf("ssh: host key mismatch")
+ }
+ return nil
+}
+
+// FixedHostKey returns a function for use in
+// ClientConfig.HostKeyCallback to accept only a specific host key.
+func FixedHostKey(key PublicKey) HostKeyCallback {
+ hk := &fixedHostKey{key}
+ return hk.check
+}
+
+// BannerDisplayStderr returns a function that can be used for
+// ClientConfig.BannerCallback to display banners on os.Stderr.
+func BannerDisplayStderr() BannerCallback {
+ return func(banner string) error {
+ _, err := os.Stderr.WriteString(banner)
+
+ return err
+ }
+}
diff --git a/vendor/golang.org/x/crypto/ssh/client_auth.go b/vendor/golang.org/x/crypto/ssh/client_auth.go
new file mode 100644
index 00000000..34bf089d
--- /dev/null
+++ b/vendor/golang.org/x/crypto/ssh/client_auth.go
@@ -0,0 +1,779 @@
+// Copyright 2011 The Go Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style
+// license that can be found in the LICENSE file.
+
+package ssh
+
+import (
+ "bytes"
+ "errors"
+ "fmt"
+ "io"
+ "strings"
+)
+
+type authResult int
+
+const (
+ authFailure authResult = iota
+ authPartialSuccess
+ authSuccess
+)
+
+// clientAuthenticate authenticates with the remote server. See RFC 4252.
+func (c *connection) clientAuthenticate(config *ClientConfig) error {
+ // initiate user auth session
+ if err := c.transport.writePacket(Marshal(&serviceRequestMsg{serviceUserAuth})); err != nil {
+ return err
+ }
+ packet, err := c.transport.readPacket()
+ if err != nil {
+ return err
+ }
+ // The server may choose to send a SSH_MSG_EXT_INFO at this point (if we
+ // advertised willingness to receive one, which we always do) or not. See
+ // RFC 8308, Section 2.4.
+ extensions := make(map[string][]byte)
+ if len(packet) > 0 && packet[0] == msgExtInfo {
+ var extInfo extInfoMsg
+ if err := Unmarshal(packet, &extInfo); err != nil {
+ return err
+ }
+ payload := extInfo.Payload
+ for i := uint32(0); i < extInfo.NumExtensions; i++ {
+ name, rest, ok := parseString(payload)
+ if !ok {
+ return parseError(msgExtInfo)
+ }
+ value, rest, ok := parseString(rest)
+ if !ok {
+ return parseError(msgExtInfo)
+ }
+ extensions[string(name)] = value
+ payload = rest
+ }
+ packet, err = c.transport.readPacket()
+ if err != nil {
+ return err
+ }
+ }
+ var serviceAccept serviceAcceptMsg
+ if err := Unmarshal(packet, &serviceAccept); err != nil {
+ return err
+ }
+
+ // during the authentication phase the client first attempts the "none" method
+ // then any untried methods suggested by the server.
+ var tried []string
+ var lastMethods []string
+
+ sessionID := c.transport.getSessionID()
+ for auth := AuthMethod(new(noneAuth)); auth != nil; {
+ ok, methods, err := auth.auth(sessionID, config.User, c.transport, config.Rand, extensions)
+ if err != nil {
+ // We return the error later if there is no other method left to
+ // try.
+ ok = authFailure
+ }
+ if ok == authSuccess {
+ // success
+ return nil
+ } else if ok == authFailure {
+ if m := auth.method(); !contains(tried, m) {
+ tried = append(tried, m)
+ }
+ }
+ if methods == nil {
+ methods = lastMethods
+ }
+ lastMethods = methods
+
+ auth = nil
+
+ findNext:
+ for _, a := range config.Auth {
+ candidateMethod := a.method()
+ if contains(tried, candidateMethod) {
+ continue
+ }
+ for _, meth := range methods {
+ if meth == candidateMethod {
+ auth = a
+ break findNext
+ }
+ }
+ }
+
+ if auth == nil && err != nil {
+ // We have an error and there are no other authentication methods to
+ // try, so we return it.
+ return err
+ }
+ }
+ return fmt.Errorf("ssh: unable to authenticate, attempted methods %v, no supported methods remain", tried)
+}
+
+func contains(list []string, e string) bool {
+ for _, s := range list {
+ if s == e {
+ return true
+ }
+ }
+ return false
+}
+
+// An AuthMethod represents an instance of an RFC 4252 authentication method.
+type AuthMethod interface {
+ // auth authenticates user over transport t.
+ // Returns true if authentication is successful.
+ // If authentication is not successful, a []string of alternative
+ // method names is returned. If the slice is nil, it will be ignored
+ // and the previous set of possible methods will be reused.
+ auth(session []byte, user string, p packetConn, rand io.Reader, extensions map[string][]byte) (authResult, []string, error)
+
+ // method returns the RFC 4252 method name.
+ method() string
+}
+
+// "none" authentication, RFC 4252 section 5.2.
+type noneAuth int
+
+func (n *noneAuth) auth(session []byte, user string, c packetConn, rand io.Reader, _ map[string][]byte) (authResult, []string, error) {
+ if err := c.writePacket(Marshal(&userAuthRequestMsg{
+ User: user,
+ Service: serviceSSH,
+ Method: "none",
+ })); err != nil {
+ return authFailure, nil, err
+ }
+
+ return handleAuthResponse(c)
+}
+
+func (n *noneAuth) method() string {
+ return "none"
+}
+
+// passwordCallback is an AuthMethod that fetches the password through
+// a function call, e.g. by prompting the user.
+type passwordCallback func() (password string, err error)
+
+func (cb passwordCallback) auth(session []byte, user string, c packetConn, rand io.Reader, _ map[string][]byte) (authResult, []string, error) {
+ type passwordAuthMsg struct {
+ User string `sshtype:"50"`
+ Service string
+ Method string
+ Reply bool
+ Password string
+ }
+
+ pw, err := cb()
+ // REVIEW NOTE: is there a need to support skipping a password attempt?
+ // The program may only find out that the user doesn't have a password
+ // when prompting.
+ if err != nil {
+ return authFailure, nil, err
+ }
+
+ if err := c.writePacket(Marshal(&passwordAuthMsg{
+ User: user,
+ Service: serviceSSH,
+ Method: cb.method(),
+ Reply: false,
+ Password: pw,
+ })); err != nil {
+ return authFailure, nil, err
+ }
+
+ return handleAuthResponse(c)
+}
+
+func (cb passwordCallback) method() string {
+ return "password"
+}
+
+// Password returns an AuthMethod using the given password.
+func Password(secret string) AuthMethod {
+ return passwordCallback(func() (string, error) { return secret, nil })
+}
+
+// PasswordCallback returns an AuthMethod that uses a callback for
+// fetching a password.
+func PasswordCallback(prompt func() (secret string, err error)) AuthMethod {
+ return passwordCallback(prompt)
+}
+
+type publickeyAuthMsg struct {
+ User string `sshtype:"50"`
+ Service string
+ Method string
+ // HasSig indicates to the receiver packet that the auth request is signed and
+ // should be used for authentication of the request.
+ HasSig bool
+ Algoname string
+ PubKey []byte
+ // Sig is tagged with "rest" so Marshal will exclude it during
+ // validateKey
+ Sig []byte `ssh:"rest"`
+}
+
+// publicKeyCallback is an AuthMethod that uses a set of key
+// pairs for authentication.
+type publicKeyCallback func() ([]Signer, error)
+
+func (cb publicKeyCallback) method() string {
+ return "publickey"
+}
+
+func pickSignatureAlgorithm(signer Signer, extensions map[string][]byte) (MultiAlgorithmSigner, string, error) {
+ var as MultiAlgorithmSigner
+ keyFormat := signer.PublicKey().Type()
+
+ // If the signer implements MultiAlgorithmSigner we use the algorithms it
+ // support, if it implements AlgorithmSigner we assume it supports all
+ // algorithms, otherwise only the key format one.
+ switch s := signer.(type) {
+ case MultiAlgorithmSigner:
+ as = s
+ case AlgorithmSigner:
+ as = &multiAlgorithmSigner{
+ AlgorithmSigner: s,
+ supportedAlgorithms: algorithmsForKeyFormat(underlyingAlgo(keyFormat)),
+ }
+ default:
+ as = &multiAlgorithmSigner{
+ AlgorithmSigner: algorithmSignerWrapper{signer},
+ supportedAlgorithms: []string{underlyingAlgo(keyFormat)},
+ }
+ }
+
+ getFallbackAlgo := func() (string, error) {
+ // Fallback to use if there is no "server-sig-algs" extension or a
+ // common algorithm cannot be found. We use the public key format if the
+ // MultiAlgorithmSigner supports it, otherwise we return an error.
+ if !contains(as.Algorithms(), underlyingAlgo(keyFormat)) {
+ return "", fmt.Errorf("ssh: no common public key signature algorithm, server only supports %q for key type %q, signer only supports %v",
+ underlyingAlgo(keyFormat), keyFormat, as.Algorithms())
+ }
+ return keyFormat, nil
+ }
+
+ extPayload, ok := extensions["server-sig-algs"]
+ if !ok {
+ // If there is no "server-sig-algs" extension use the fallback
+ // algorithm.
+ algo, err := getFallbackAlgo()
+ return as, algo, err
+ }
+
+ // The server-sig-algs extension only carries underlying signature
+ // algorithm, but we are trying to select a protocol-level public key
+ // algorithm, which might be a certificate type. Extend the list of server
+ // supported algorithms to include the corresponding certificate algorithms.
+ serverAlgos := strings.Split(string(extPayload), ",")
+ for _, algo := range serverAlgos {
+ if certAlgo, ok := certificateAlgo(algo); ok {
+ serverAlgos = append(serverAlgos, certAlgo)
+ }
+ }
+
+ // Filter algorithms based on those supported by MultiAlgorithmSigner.
+ var keyAlgos []string
+ for _, algo := range algorithmsForKeyFormat(keyFormat) {
+ if contains(as.Algorithms(), underlyingAlgo(algo)) {
+ keyAlgos = append(keyAlgos, algo)
+ }
+ }
+
+ algo, err := findCommon("public key signature algorithm", keyAlgos, serverAlgos)
+ if err != nil {
+ // If there is no overlap, return the fallback algorithm to support
+ // servers that fail to list all supported algorithms.
+ algo, err := getFallbackAlgo()
+ return as, algo, err
+ }
+ return as, algo, nil
+}
+
+func (cb publicKeyCallback) auth(session []byte, user string, c packetConn, rand io.Reader, extensions map[string][]byte) (authResult, []string, error) {
+ // Authentication is performed by sending an enquiry to test if a key is
+ // acceptable to the remote. If the key is acceptable, the client will
+ // attempt to authenticate with the valid key. If not the client will repeat
+ // the process with the remaining keys.
+
+ signers, err := cb()
+ if err != nil {
+ return authFailure, nil, err
+ }
+ var methods []string
+ var errSigAlgo error
+
+ origSignersLen := len(signers)
+ for idx := 0; idx < len(signers); idx++ {
+ signer := signers[idx]
+ pub := signer.PublicKey()
+ as, algo, err := pickSignatureAlgorithm(signer, extensions)
+ if err != nil && errSigAlgo == nil {
+ // If we cannot negotiate a signature algorithm store the first
+ // error so we can return it to provide a more meaningful message if
+ // no other signers work.
+ errSigAlgo = err
+ continue
+ }
+ ok, err := validateKey(pub, algo, user, c)
+ if err != nil {
+ return authFailure, nil, err
+ }
+ // OpenSSH 7.2-7.7 advertises support for rsa-sha2-256 and rsa-sha2-512
+ // in the "server-sig-algs" extension but doesn't support these
+ // algorithms for certificate authentication, so if the server rejects
+ // the key try to use the obtained algorithm as if "server-sig-algs" had
+ // not been implemented if supported from the algorithm signer.
+ if !ok && idx < origSignersLen && isRSACert(algo) && algo != CertAlgoRSAv01 {
+ if contains(as.Algorithms(), KeyAlgoRSA) {
+ // We retry using the compat algorithm after all signers have
+ // been tried normally.
+ signers = append(signers, &multiAlgorithmSigner{
+ AlgorithmSigner: as,
+ supportedAlgorithms: []string{KeyAlgoRSA},
+ })
+ }
+ }
+ if !ok {
+ continue
+ }
+
+ pubKey := pub.Marshal()
+ data := buildDataSignedForAuth(session, userAuthRequestMsg{
+ User: user,
+ Service: serviceSSH,
+ Method: cb.method(),
+ }, algo, pubKey)
+ sign, err := as.SignWithAlgorithm(rand, data, underlyingAlgo(algo))
+ if err != nil {
+ return authFailure, nil, err
+ }
+
+ // manually wrap the serialized signature in a string
+ s := Marshal(sign)
+ sig := make([]byte, stringLength(len(s)))
+ marshalString(sig, s)
+ msg := publickeyAuthMsg{
+ User: user,
+ Service: serviceSSH,
+ Method: cb.method(),
+ HasSig: true,
+ Algoname: algo,
+ PubKey: pubKey,
+ Sig: sig,
+ }
+ p := Marshal(&msg)
+ if err := c.writePacket(p); err != nil {
+ return authFailure, nil, err
+ }
+ var success authResult
+ success, methods, err = handleAuthResponse(c)
+ if err != nil {
+ return authFailure, nil, err
+ }
+
+ // If authentication succeeds or the list of available methods does not
+ // contain the "publickey" method, do not attempt to authenticate with any
+ // other keys. According to RFC 4252 Section 7, the latter can occur when
+ // additional authentication methods are required.
+ if success == authSuccess || !contains(methods, cb.method()) {
+ return success, methods, err
+ }
+ }
+
+ return authFailure, methods, errSigAlgo
+}
+
+// validateKey validates the key provided is acceptable to the server.
+func validateKey(key PublicKey, algo string, user string, c packetConn) (bool, error) {
+ pubKey := key.Marshal()
+ msg := publickeyAuthMsg{
+ User: user,
+ Service: serviceSSH,
+ Method: "publickey",
+ HasSig: false,
+ Algoname: algo,
+ PubKey: pubKey,
+ }
+ if err := c.writePacket(Marshal(&msg)); err != nil {
+ return false, err
+ }
+
+ return confirmKeyAck(key, algo, c)
+}
+
+func confirmKeyAck(key PublicKey, algo string, c packetConn) (bool, error) {
+ pubKey := key.Marshal()
+
+ for {
+ packet, err := c.readPacket()
+ if err != nil {
+ return false, err
+ }
+ switch packet[0] {
+ case msgUserAuthBanner:
+ if err := handleBannerResponse(c, packet); err != nil {
+ return false, err
+ }
+ case msgUserAuthPubKeyOk:
+ var msg userAuthPubKeyOkMsg
+ if err := Unmarshal(packet, &msg); err != nil {
+ return false, err
+ }
+ if msg.Algo != algo || !bytes.Equal(msg.PubKey, pubKey) {
+ return false, nil
+ }
+ return true, nil
+ case msgUserAuthFailure:
+ return false, nil
+ default:
+ return false, unexpectedMessageError(msgUserAuthPubKeyOk, packet[0])
+ }
+ }
+}
+
+// PublicKeys returns an AuthMethod that uses the given key
+// pairs.
+func PublicKeys(signers ...Signer) AuthMethod {
+ return publicKeyCallback(func() ([]Signer, error) { return signers, nil })
+}
+
+// PublicKeysCallback returns an AuthMethod that runs the given
+// function to obtain a list of key pairs.
+func PublicKeysCallback(getSigners func() (signers []Signer, err error)) AuthMethod {
+ return publicKeyCallback(getSigners)
+}
+
+// handleAuthResponse returns whether the preceding authentication request succeeded
+// along with a list of remaining authentication methods to try next and
+// an error if an unexpected response was received.
+func handleAuthResponse(c packetConn) (authResult, []string, error) {
+ gotMsgExtInfo := false
+ for {
+ packet, err := c.readPacket()
+ if err != nil {
+ return authFailure, nil, err
+ }
+
+ switch packet[0] {
+ case msgUserAuthBanner:
+ if err := handleBannerResponse(c, packet); err != nil {
+ return authFailure, nil, err
+ }
+ case msgExtInfo:
+ // Ignore post-authentication RFC 8308 extensions, once.
+ if gotMsgExtInfo {
+ return authFailure, nil, unexpectedMessageError(msgUserAuthSuccess, packet[0])
+ }
+ gotMsgExtInfo = true
+ case msgUserAuthFailure:
+ var msg userAuthFailureMsg
+ if err := Unmarshal(packet, &msg); err != nil {
+ return authFailure, nil, err
+ }
+ if msg.PartialSuccess {
+ return authPartialSuccess, msg.Methods, nil
+ }
+ return authFailure, msg.Methods, nil
+ case msgUserAuthSuccess:
+ return authSuccess, nil, nil
+ default:
+ return authFailure, nil, unexpectedMessageError(msgUserAuthSuccess, packet[0])
+ }
+ }
+}
+
+func handleBannerResponse(c packetConn, packet []byte) error {
+ var msg userAuthBannerMsg
+ if err := Unmarshal(packet, &msg); err != nil {
+ return err
+ }
+
+ transport, ok := c.(*handshakeTransport)
+ if !ok {
+ return nil
+ }
+
+ if transport.bannerCallback != nil {
+ return transport.bannerCallback(msg.Message)
+ }
+
+ return nil
+}
+
+// KeyboardInteractiveChallenge should print questions, optionally
+// disabling echoing (e.g. for passwords), and return all the answers.
+// Challenge may be called multiple times in a single session. After
+// successful authentication, the server may send a challenge with no
+// questions, for which the name and instruction messages should be
+// printed. RFC 4256 section 3.3 details how the UI should behave for
+// both CLI and GUI environments.
+type KeyboardInteractiveChallenge func(name, instruction string, questions []string, echos []bool) (answers []string, err error)
+
+// KeyboardInteractive returns an AuthMethod using a prompt/response
+// sequence controlled by the server.
+func KeyboardInteractive(challenge KeyboardInteractiveChallenge) AuthMethod {
+ return challenge
+}
+
+func (cb KeyboardInteractiveChallenge) method() string {
+ return "keyboard-interactive"
+}
+
+func (cb KeyboardInteractiveChallenge) auth(session []byte, user string, c packetConn, rand io.Reader, _ map[string][]byte) (authResult, []string, error) {
+ type initiateMsg struct {
+ User string `sshtype:"50"`
+ Service string
+ Method string
+ Language string
+ Submethods string
+ }
+
+ if err := c.writePacket(Marshal(&initiateMsg{
+ User: user,
+ Service: serviceSSH,
+ Method: "keyboard-interactive",
+ })); err != nil {
+ return authFailure, nil, err
+ }
+
+ gotMsgExtInfo := false
+ for {
+ packet, err := c.readPacket()
+ if err != nil {
+ return authFailure, nil, err
+ }
+
+ // like handleAuthResponse, but with less options.
+ switch packet[0] {
+ case msgUserAuthBanner:
+ if err := handleBannerResponse(c, packet); err != nil {
+ return authFailure, nil, err
+ }
+ continue
+ case msgExtInfo:
+ // Ignore post-authentication RFC 8308 extensions, once.
+ if gotMsgExtInfo {
+ return authFailure, nil, unexpectedMessageError(msgUserAuthInfoRequest, packet[0])
+ }
+ gotMsgExtInfo = true
+ continue
+ case msgUserAuthInfoRequest:
+ // OK
+ case msgUserAuthFailure:
+ var msg userAuthFailureMsg
+ if err := Unmarshal(packet, &msg); err != nil {
+ return authFailure, nil, err
+ }
+ if msg.PartialSuccess {
+ return authPartialSuccess, msg.Methods, nil
+ }
+ return authFailure, msg.Methods, nil
+ case msgUserAuthSuccess:
+ return authSuccess, nil, nil
+ default:
+ return authFailure, nil, unexpectedMessageError(msgUserAuthInfoRequest, packet[0])
+ }
+
+ var msg userAuthInfoRequestMsg
+ if err := Unmarshal(packet, &msg); err != nil {
+ return authFailure, nil, err
+ }
+
+ // Manually unpack the prompt/echo pairs.
+ rest := msg.Prompts
+ var prompts []string
+ var echos []bool
+ for i := 0; i < int(msg.NumPrompts); i++ {
+ prompt, r, ok := parseString(rest)
+ if !ok || len(r) == 0 {
+ return authFailure, nil, errors.New("ssh: prompt format error")
+ }
+ prompts = append(prompts, string(prompt))
+ echos = append(echos, r[0] != 0)
+ rest = r[1:]
+ }
+
+ if len(rest) != 0 {
+ return authFailure, nil, errors.New("ssh: extra data following keyboard-interactive pairs")
+ }
+
+ answers, err := cb(msg.Name, msg.Instruction, prompts, echos)
+ if err != nil {
+ return authFailure, nil, err
+ }
+
+ if len(answers) != len(prompts) {
+ return authFailure, nil, fmt.Errorf("ssh: incorrect number of answers from keyboard-interactive callback %d (expected %d)", len(answers), len(prompts))
+ }
+ responseLength := 1 + 4
+ for _, a := range answers {
+ responseLength += stringLength(len(a))
+ }
+ serialized := make([]byte, responseLength)
+ p := serialized
+ p[0] = msgUserAuthInfoResponse
+ p = p[1:]
+ p = marshalUint32(p, uint32(len(answers)))
+ for _, a := range answers {
+ p = marshalString(p, []byte(a))
+ }
+
+ if err := c.writePacket(serialized); err != nil {
+ return authFailure, nil, err
+ }
+ }
+}
+
+type retryableAuthMethod struct {
+ authMethod AuthMethod
+ maxTries int
+}
+
+func (r *retryableAuthMethod) auth(session []byte, user string, c packetConn, rand io.Reader, extensions map[string][]byte) (ok authResult, methods []string, err error) {
+ for i := 0; r.maxTries <= 0 || i < r.maxTries; i++ {
+ ok, methods, err = r.authMethod.auth(session, user, c, rand, extensions)
+ if ok != authFailure || err != nil { // either success, partial success or error terminate
+ return ok, methods, err
+ }
+ }
+ return ok, methods, err
+}
+
+func (r *retryableAuthMethod) method() string {
+ return r.authMethod.method()
+}
+
+// RetryableAuthMethod is a decorator for other auth methods enabling them to
+// be retried up to maxTries before considering that AuthMethod itself failed.
+// If maxTries is <= 0, will retry indefinitely
+//
+// This is useful for interactive clients using challenge/response type
+// authentication (e.g. Keyboard-Interactive, Password, etc) where the user
+// could mistype their response resulting in the server issuing a
+// SSH_MSG_USERAUTH_FAILURE (rfc4252 #8 [password] and rfc4256 #3.4
+// [keyboard-interactive]); Without this decorator, the non-retryable
+// AuthMethod would be removed from future consideration, and never tried again
+// (and so the user would never be able to retry their entry).
+func RetryableAuthMethod(auth AuthMethod, maxTries int) AuthMethod {
+ return &retryableAuthMethod{authMethod: auth, maxTries: maxTries}
+}
+
+// GSSAPIWithMICAuthMethod is an AuthMethod with "gssapi-with-mic" authentication.
+// See RFC 4462 section 3
+// gssAPIClient is implementation of the GSSAPIClient interface, see the definition of the interface for details.
+// target is the server host you want to log in to.
+func GSSAPIWithMICAuthMethod(gssAPIClient GSSAPIClient, target string) AuthMethod {
+ if gssAPIClient == nil {
+ panic("gss-api client must be not nil with enable gssapi-with-mic")
+ }
+ return &gssAPIWithMICCallback{gssAPIClient: gssAPIClient, target: target}
+}
+
+type gssAPIWithMICCallback struct {
+ gssAPIClient GSSAPIClient
+ target string
+}
+
+func (g *gssAPIWithMICCallback) auth(session []byte, user string, c packetConn, rand io.Reader, _ map[string][]byte) (authResult, []string, error) {
+ m := &userAuthRequestMsg{
+ User: user,
+ Service: serviceSSH,
+ Method: g.method(),
+ }
+ // The GSS-API authentication method is initiated when the client sends an SSH_MSG_USERAUTH_REQUEST.
+ // See RFC 4462 section 3.2.
+ m.Payload = appendU32(m.Payload, 1)
+ m.Payload = appendString(m.Payload, string(krb5OID))
+ if err := c.writePacket(Marshal(m)); err != nil {
+ return authFailure, nil, err
+ }
+ // The server responds to the SSH_MSG_USERAUTH_REQUEST with either an
+ // SSH_MSG_USERAUTH_FAILURE if none of the mechanisms are supported or
+ // with an SSH_MSG_USERAUTH_GSSAPI_RESPONSE.
+ // See RFC 4462 section 3.3.
+ // OpenSSH supports Kerberos V5 mechanism only for GSS-API authentication,so I don't want to check
+ // selected mech if it is valid.
+ packet, err := c.readPacket()
+ if err != nil {
+ return authFailure, nil, err
+ }
+ userAuthGSSAPIResp := &userAuthGSSAPIResponse{}
+ if err := Unmarshal(packet, userAuthGSSAPIResp); err != nil {
+ return authFailure, nil, err
+ }
+ // Start the loop into the exchange token.
+ // See RFC 4462 section 3.4.
+ var token []byte
+ defer g.gssAPIClient.DeleteSecContext()
+ for {
+ // Initiates the establishment of a security context between the application and a remote peer.
+ nextToken, needContinue, err := g.gssAPIClient.InitSecContext("host@"+g.target, token, false)
+ if err != nil {
+ return authFailure, nil, err
+ }
+ if len(nextToken) > 0 {
+ if err := c.writePacket(Marshal(&userAuthGSSAPIToken{
+ Token: nextToken,
+ })); err != nil {
+ return authFailure, nil, err
+ }
+ }
+ if !needContinue {
+ break
+ }
+ packet, err = c.readPacket()
+ if err != nil {
+ return authFailure, nil, err
+ }
+ switch packet[0] {
+ case msgUserAuthFailure:
+ var msg userAuthFailureMsg
+ if err := Unmarshal(packet, &msg); err != nil {
+ return authFailure, nil, err
+ }
+ if msg.PartialSuccess {
+ return authPartialSuccess, msg.Methods, nil
+ }
+ return authFailure, msg.Methods, nil
+ case msgUserAuthGSSAPIError:
+ userAuthGSSAPIErrorResp := &userAuthGSSAPIError{}
+ if err := Unmarshal(packet, userAuthGSSAPIErrorResp); err != nil {
+ return authFailure, nil, err
+ }
+ return authFailure, nil, fmt.Errorf("GSS-API Error:\n"+
+ "Major Status: %d\n"+
+ "Minor Status: %d\n"+
+ "Error Message: %s\n", userAuthGSSAPIErrorResp.MajorStatus, userAuthGSSAPIErrorResp.MinorStatus,
+ userAuthGSSAPIErrorResp.Message)
+ case msgUserAuthGSSAPIToken:
+ userAuthGSSAPITokenReq := &userAuthGSSAPIToken{}
+ if err := Unmarshal(packet, userAuthGSSAPITokenReq); err != nil {
+ return authFailure, nil, err
+ }
+ token = userAuthGSSAPITokenReq.Token
+ }
+ }
+ // Binding Encryption Keys.
+ // See RFC 4462 section 3.5.
+ micField := buildMIC(string(session), user, "ssh-connection", "gssapi-with-mic")
+ micToken, err := g.gssAPIClient.GetMIC(micField)
+ if err != nil {
+ return authFailure, nil, err
+ }
+ if err := c.writePacket(Marshal(&userAuthGSSAPIMIC{
+ MIC: micToken,
+ })); err != nil {
+ return authFailure, nil, err
+ }
+ return handleAuthResponse(c)
+}
+
+func (g *gssAPIWithMICCallback) method() string {
+ return "gssapi-with-mic"
+}
diff --git a/vendor/golang.org/x/crypto/ssh/common.go b/vendor/golang.org/x/crypto/ssh/common.go
new file mode 100644
index 00000000..7e9c2cbc
--- /dev/null
+++ b/vendor/golang.org/x/crypto/ssh/common.go
@@ -0,0 +1,476 @@
+// Copyright 2011 The Go Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style
+// license that can be found in the LICENSE file.
+
+package ssh
+
+import (
+ "crypto"
+ "crypto/rand"
+ "fmt"
+ "io"
+ "math"
+ "sync"
+
+ _ "crypto/sha1"
+ _ "crypto/sha256"
+ _ "crypto/sha512"
+)
+
+// These are string constants in the SSH protocol.
+const (
+ compressionNone = "none"
+ serviceUserAuth = "ssh-userauth"
+ serviceSSH = "ssh-connection"
+)
+
+// supportedCiphers lists ciphers we support but might not recommend.
+var supportedCiphers = []string{
+ "aes128-ctr", "aes192-ctr", "aes256-ctr",
+ "aes128-gcm@openssh.com", gcm256CipherID,
+ chacha20Poly1305ID,
+ "arcfour256", "arcfour128", "arcfour",
+ aes128cbcID,
+ tripledescbcID,
+}
+
+// preferredCiphers specifies the default preference for ciphers.
+var preferredCiphers = []string{
+ "aes128-gcm@openssh.com", gcm256CipherID,
+ chacha20Poly1305ID,
+ "aes128-ctr", "aes192-ctr", "aes256-ctr",
+}
+
+// supportedKexAlgos specifies the supported key-exchange algorithms in
+// preference order.
+var supportedKexAlgos = []string{
+ kexAlgoCurve25519SHA256, kexAlgoCurve25519SHA256LibSSH,
+ // P384 and P521 are not constant-time yet, but since we don't
+ // reuse ephemeral keys, using them for ECDH should be OK.
+ kexAlgoECDH256, kexAlgoECDH384, kexAlgoECDH521,
+ kexAlgoDH14SHA256, kexAlgoDH16SHA512, kexAlgoDH14SHA1,
+ kexAlgoDH1SHA1,
+}
+
+// serverForbiddenKexAlgos contains key exchange algorithms, that are forbidden
+// for the server half.
+var serverForbiddenKexAlgos = map[string]struct{}{
+ kexAlgoDHGEXSHA1: {}, // server half implementation is only minimal to satisfy the automated tests
+ kexAlgoDHGEXSHA256: {}, // server half implementation is only minimal to satisfy the automated tests
+}
+
+// preferredKexAlgos specifies the default preference for key-exchange
+// algorithms in preference order. The diffie-hellman-group16-sha512 algorithm
+// is disabled by default because it is a bit slower than the others.
+var preferredKexAlgos = []string{
+ kexAlgoCurve25519SHA256, kexAlgoCurve25519SHA256LibSSH,
+ kexAlgoECDH256, kexAlgoECDH384, kexAlgoECDH521,
+ kexAlgoDH14SHA256, kexAlgoDH14SHA1,
+}
+
+// supportedHostKeyAlgos specifies the supported host-key algorithms (i.e. methods
+// of authenticating servers) in preference order.
+var supportedHostKeyAlgos = []string{
+ CertAlgoRSASHA256v01, CertAlgoRSASHA512v01,
+ CertAlgoRSAv01, CertAlgoDSAv01, CertAlgoECDSA256v01,
+ CertAlgoECDSA384v01, CertAlgoECDSA521v01, CertAlgoED25519v01,
+
+ KeyAlgoECDSA256, KeyAlgoECDSA384, KeyAlgoECDSA521,
+ KeyAlgoRSASHA256, KeyAlgoRSASHA512,
+ KeyAlgoRSA, KeyAlgoDSA,
+
+ KeyAlgoED25519,
+}
+
+// supportedMACs specifies a default set of MAC algorithms in preference order.
+// This is based on RFC 4253, section 6.4, but with hmac-md5 variants removed
+// because they have reached the end of their useful life.
+var supportedMACs = []string{
+ "hmac-sha2-256-etm@openssh.com", "hmac-sha2-512-etm@openssh.com", "hmac-sha2-256", "hmac-sha2-512", "hmac-sha1", "hmac-sha1-96",
+}
+
+var supportedCompressions = []string{compressionNone}
+
+// hashFuncs keeps the mapping of supported signature algorithms to their
+// respective hashes needed for signing and verification.
+var hashFuncs = map[string]crypto.Hash{
+ KeyAlgoRSA: crypto.SHA1,
+ KeyAlgoRSASHA256: crypto.SHA256,
+ KeyAlgoRSASHA512: crypto.SHA512,
+ KeyAlgoDSA: crypto.SHA1,
+ KeyAlgoECDSA256: crypto.SHA256,
+ KeyAlgoECDSA384: crypto.SHA384,
+ KeyAlgoECDSA521: crypto.SHA512,
+ // KeyAlgoED25519 doesn't pre-hash.
+ KeyAlgoSKECDSA256: crypto.SHA256,
+ KeyAlgoSKED25519: crypto.SHA256,
+}
+
+// algorithmsForKeyFormat returns the supported signature algorithms for a given
+// public key format (PublicKey.Type), in order of preference. See RFC 8332,
+// Section 2. See also the note in sendKexInit on backwards compatibility.
+func algorithmsForKeyFormat(keyFormat string) []string {
+ switch keyFormat {
+ case KeyAlgoRSA:
+ return []string{KeyAlgoRSASHA256, KeyAlgoRSASHA512, KeyAlgoRSA}
+ case CertAlgoRSAv01:
+ return []string{CertAlgoRSASHA256v01, CertAlgoRSASHA512v01, CertAlgoRSAv01}
+ default:
+ return []string{keyFormat}
+ }
+}
+
+// isRSA returns whether algo is a supported RSA algorithm, including certificate
+// algorithms.
+func isRSA(algo string) bool {
+ algos := algorithmsForKeyFormat(KeyAlgoRSA)
+ return contains(algos, underlyingAlgo(algo))
+}
+
+func isRSACert(algo string) bool {
+ _, ok := certKeyAlgoNames[algo]
+ if !ok {
+ return false
+ }
+ return isRSA(algo)
+}
+
+// supportedPubKeyAuthAlgos specifies the supported client public key
+// authentication algorithms. Note that this doesn't include certificate types
+// since those use the underlying algorithm. This list is sent to the client if
+// it supports the server-sig-algs extension. Order is irrelevant.
+var supportedPubKeyAuthAlgos = []string{
+ KeyAlgoED25519,
+ KeyAlgoSKED25519, KeyAlgoSKECDSA256,
+ KeyAlgoECDSA256, KeyAlgoECDSA384, KeyAlgoECDSA521,
+ KeyAlgoRSASHA256, KeyAlgoRSASHA512, KeyAlgoRSA,
+ KeyAlgoDSA,
+}
+
+// unexpectedMessageError results when the SSH message that we received didn't
+// match what we wanted.
+func unexpectedMessageError(expected, got uint8) error {
+ return fmt.Errorf("ssh: unexpected message type %d (expected %d)", got, expected)
+}
+
+// parseError results from a malformed SSH message.
+func parseError(tag uint8) error {
+ return fmt.Errorf("ssh: parse error in message type %d", tag)
+}
+
+func findCommon(what string, client []string, server []string) (common string, err error) {
+ for _, c := range client {
+ for _, s := range server {
+ if c == s {
+ return c, nil
+ }
+ }
+ }
+ return "", fmt.Errorf("ssh: no common algorithm for %s; client offered: %v, server offered: %v", what, client, server)
+}
+
+// directionAlgorithms records algorithm choices in one direction (either read or write)
+type directionAlgorithms struct {
+ Cipher string
+ MAC string
+ Compression string
+}
+
+// rekeyBytes returns a rekeying intervals in bytes.
+func (a *directionAlgorithms) rekeyBytes() int64 {
+ // According to RFC 4344 block ciphers should rekey after
+ // 2^(BLOCKSIZE/4) blocks. For all AES flavors BLOCKSIZE is
+ // 128.
+ switch a.Cipher {
+ case "aes128-ctr", "aes192-ctr", "aes256-ctr", gcm128CipherID, gcm256CipherID, aes128cbcID:
+ return 16 * (1 << 32)
+
+ }
+
+ // For others, stick with RFC 4253 recommendation to rekey after 1 Gb of data.
+ return 1 << 30
+}
+
+var aeadCiphers = map[string]bool{
+ gcm128CipherID: true,
+ gcm256CipherID: true,
+ chacha20Poly1305ID: true,
+}
+
+type algorithms struct {
+ kex string
+ hostKey string
+ w directionAlgorithms
+ r directionAlgorithms
+}
+
+func findAgreedAlgorithms(isClient bool, clientKexInit, serverKexInit *kexInitMsg) (algs *algorithms, err error) {
+ result := &algorithms{}
+
+ result.kex, err = findCommon("key exchange", clientKexInit.KexAlgos, serverKexInit.KexAlgos)
+ if err != nil {
+ return
+ }
+
+ result.hostKey, err = findCommon("host key", clientKexInit.ServerHostKeyAlgos, serverKexInit.ServerHostKeyAlgos)
+ if err != nil {
+ return
+ }
+
+ stoc, ctos := &result.w, &result.r
+ if isClient {
+ ctos, stoc = stoc, ctos
+ }
+
+ ctos.Cipher, err = findCommon("client to server cipher", clientKexInit.CiphersClientServer, serverKexInit.CiphersClientServer)
+ if err != nil {
+ return
+ }
+
+ stoc.Cipher, err = findCommon("server to client cipher", clientKexInit.CiphersServerClient, serverKexInit.CiphersServerClient)
+ if err != nil {
+ return
+ }
+
+ if !aeadCiphers[ctos.Cipher] {
+ ctos.MAC, err = findCommon("client to server MAC", clientKexInit.MACsClientServer, serverKexInit.MACsClientServer)
+ if err != nil {
+ return
+ }
+ }
+
+ if !aeadCiphers[stoc.Cipher] {
+ stoc.MAC, err = findCommon("server to client MAC", clientKexInit.MACsServerClient, serverKexInit.MACsServerClient)
+ if err != nil {
+ return
+ }
+ }
+
+ ctos.Compression, err = findCommon("client to server compression", clientKexInit.CompressionClientServer, serverKexInit.CompressionClientServer)
+ if err != nil {
+ return
+ }
+
+ stoc.Compression, err = findCommon("server to client compression", clientKexInit.CompressionServerClient, serverKexInit.CompressionServerClient)
+ if err != nil {
+ return
+ }
+
+ return result, nil
+}
+
+// If rekeythreshold is too small, we can't make any progress sending
+// stuff.
+const minRekeyThreshold uint64 = 256
+
+// Config contains configuration data common to both ServerConfig and
+// ClientConfig.
+type Config struct {
+ // Rand provides the source of entropy for cryptographic
+ // primitives. If Rand is nil, the cryptographic random reader
+ // in package crypto/rand will be used.
+ Rand io.Reader
+
+ // The maximum number of bytes sent or received after which a
+ // new key is negotiated. It must be at least 256. If
+ // unspecified, a size suitable for the chosen cipher is used.
+ RekeyThreshold uint64
+
+ // The allowed key exchanges algorithms. If unspecified then a default set
+ // of algorithms is used. Unsupported values are silently ignored.
+ KeyExchanges []string
+
+ // The allowed cipher algorithms. If unspecified then a sensible default is
+ // used. Unsupported values are silently ignored.
+ Ciphers []string
+
+ // The allowed MAC algorithms. If unspecified then a sensible default is
+ // used. Unsupported values are silently ignored.
+ MACs []string
+}
+
+// SetDefaults sets sensible values for unset fields in config. This is
+// exported for testing: Configs passed to SSH functions are copied and have
+// default values set automatically.
+func (c *Config) SetDefaults() {
+ if c.Rand == nil {
+ c.Rand = rand.Reader
+ }
+ if c.Ciphers == nil {
+ c.Ciphers = preferredCiphers
+ }
+ var ciphers []string
+ for _, c := range c.Ciphers {
+ if cipherModes[c] != nil {
+ // Ignore the cipher if we have no cipherModes definition.
+ ciphers = append(ciphers, c)
+ }
+ }
+ c.Ciphers = ciphers
+
+ if c.KeyExchanges == nil {
+ c.KeyExchanges = preferredKexAlgos
+ }
+ var kexs []string
+ for _, k := range c.KeyExchanges {
+ if kexAlgoMap[k] != nil {
+ // Ignore the KEX if we have no kexAlgoMap definition.
+ kexs = append(kexs, k)
+ }
+ }
+ c.KeyExchanges = kexs
+
+ if c.MACs == nil {
+ c.MACs = supportedMACs
+ }
+ var macs []string
+ for _, m := range c.MACs {
+ if macModes[m] != nil {
+ // Ignore the MAC if we have no macModes definition.
+ macs = append(macs, m)
+ }
+ }
+ c.MACs = macs
+
+ if c.RekeyThreshold == 0 {
+ // cipher specific default
+ } else if c.RekeyThreshold < minRekeyThreshold {
+ c.RekeyThreshold = minRekeyThreshold
+ } else if c.RekeyThreshold >= math.MaxInt64 {
+ // Avoid weirdness if somebody uses -1 as a threshold.
+ c.RekeyThreshold = math.MaxInt64
+ }
+}
+
+// buildDataSignedForAuth returns the data that is signed in order to prove
+// possession of a private key. See RFC 4252, section 7. algo is the advertised
+// algorithm, and may be a certificate type.
+func buildDataSignedForAuth(sessionID []byte, req userAuthRequestMsg, algo string, pubKey []byte) []byte {
+ data := struct {
+ Session []byte
+ Type byte
+ User string
+ Service string
+ Method string
+ Sign bool
+ Algo string
+ PubKey []byte
+ }{
+ sessionID,
+ msgUserAuthRequest,
+ req.User,
+ req.Service,
+ req.Method,
+ true,
+ algo,
+ pubKey,
+ }
+ return Marshal(data)
+}
+
+func appendU16(buf []byte, n uint16) []byte {
+ return append(buf, byte(n>>8), byte(n))
+}
+
+func appendU32(buf []byte, n uint32) []byte {
+ return append(buf, byte(n>>24), byte(n>>16), byte(n>>8), byte(n))
+}
+
+func appendU64(buf []byte, n uint64) []byte {
+ return append(buf,
+ byte(n>>56), byte(n>>48), byte(n>>40), byte(n>>32),
+ byte(n>>24), byte(n>>16), byte(n>>8), byte(n))
+}
+
+func appendInt(buf []byte, n int) []byte {
+ return appendU32(buf, uint32(n))
+}
+
+func appendString(buf []byte, s string) []byte {
+ buf = appendU32(buf, uint32(len(s)))
+ buf = append(buf, s...)
+ return buf
+}
+
+func appendBool(buf []byte, b bool) []byte {
+ if b {
+ return append(buf, 1)
+ }
+ return append(buf, 0)
+}
+
+// newCond is a helper to hide the fact that there is no usable zero
+// value for sync.Cond.
+func newCond() *sync.Cond { return sync.NewCond(new(sync.Mutex)) }
+
+// window represents the buffer available to clients
+// wishing to write to a channel.
+type window struct {
+ *sync.Cond
+ win uint32 // RFC 4254 5.2 says the window size can grow to 2^32-1
+ writeWaiters int
+ closed bool
+}
+
+// add adds win to the amount of window available
+// for consumers.
+func (w *window) add(win uint32) bool {
+ // a zero sized window adjust is a noop.
+ if win == 0 {
+ return true
+ }
+ w.L.Lock()
+ if w.win+win < win {
+ w.L.Unlock()
+ return false
+ }
+ w.win += win
+ // It is unusual that multiple goroutines would be attempting to reserve
+ // window space, but not guaranteed. Use broadcast to notify all waiters
+ // that additional window is available.
+ w.Broadcast()
+ w.L.Unlock()
+ return true
+}
+
+// close sets the window to closed, so all reservations fail
+// immediately.
+func (w *window) close() {
+ w.L.Lock()
+ w.closed = true
+ w.Broadcast()
+ w.L.Unlock()
+}
+
+// reserve reserves win from the available window capacity.
+// If no capacity remains, reserve will block. reserve may
+// return less than requested.
+func (w *window) reserve(win uint32) (uint32, error) {
+ var err error
+ w.L.Lock()
+ w.writeWaiters++
+ w.Broadcast()
+ for w.win == 0 && !w.closed {
+ w.Wait()
+ }
+ w.writeWaiters--
+ if w.win < win {
+ win = w.win
+ }
+ w.win -= win
+ if w.closed {
+ err = io.EOF
+ }
+ w.L.Unlock()
+ return win, err
+}
+
+// waitWriterBlocked waits until some goroutine is blocked for further
+// writes. It is used in tests only.
+func (w *window) waitWriterBlocked() {
+ w.Cond.L.Lock()
+ for w.writeWaiters == 0 {
+ w.Cond.Wait()
+ }
+ w.Cond.L.Unlock()
+}
diff --git a/vendor/golang.org/x/crypto/ssh/connection.go b/vendor/golang.org/x/crypto/ssh/connection.go
new file mode 100644
index 00000000..8f345ee9
--- /dev/null
+++ b/vendor/golang.org/x/crypto/ssh/connection.go
@@ -0,0 +1,143 @@
+// 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.
+
+package ssh
+
+import (
+ "fmt"
+ "net"
+)
+
+// OpenChannelError is returned if the other side rejects an
+// OpenChannel request.
+type OpenChannelError struct {
+ Reason RejectionReason
+ Message string
+}
+
+func (e *OpenChannelError) Error() string {
+ return fmt.Sprintf("ssh: rejected: %s (%s)", e.Reason, e.Message)
+}
+
+// ConnMetadata holds metadata for the connection.
+type ConnMetadata interface {
+ // User returns the user ID for this connection.
+ User() string
+
+ // SessionID returns the session hash, also denoted by H.
+ SessionID() []byte
+
+ // ClientVersion returns the client's version string as hashed
+ // into the session ID.
+ ClientVersion() []byte
+
+ // ServerVersion returns the server's version string as hashed
+ // into the session ID.
+ ServerVersion() []byte
+
+ // RemoteAddr returns the remote address for this connection.
+ RemoteAddr() net.Addr
+
+ // LocalAddr returns the local address for this connection.
+ LocalAddr() net.Addr
+}
+
+// Conn represents an SSH connection for both server and client roles.
+// Conn is the basis for implementing an application layer, such
+// as ClientConn, which implements the traditional shell access for
+// clients.
+type Conn interface {
+ ConnMetadata
+
+ // SendRequest sends a global request, and returns the
+ // reply. If wantReply is true, it returns the response status
+ // and payload. See also RFC 4254, section 4.
+ SendRequest(name string, wantReply bool, payload []byte) (bool, []byte, error)
+
+ // OpenChannel tries to open an channel. If the request is
+ // rejected, it returns *OpenChannelError. On success it returns
+ // the SSH Channel and a Go channel for incoming, out-of-band
+ // requests. The Go channel must be serviced, or the
+ // connection will hang.
+ OpenChannel(name string, data []byte) (Channel, <-chan *Request, error)
+
+ // Close closes the underlying network connection
+ Close() error
+
+ // Wait blocks until the connection has shut down, and returns the
+ // error causing the shutdown.
+ Wait() error
+
+ // TODO(hanwen): consider exposing:
+ // RequestKeyChange
+ // Disconnect
+}
+
+// DiscardRequests consumes and rejects all requests from the
+// passed-in channel.
+func DiscardRequests(in <-chan *Request) {
+ for req := range in {
+ if req.WantReply {
+ req.Reply(false, nil)
+ }
+ }
+}
+
+// A connection represents an incoming connection.
+type connection struct {
+ transport *handshakeTransport
+ sshConn
+
+ // The connection protocol.
+ *mux
+}
+
+func (c *connection) Close() error {
+ return c.sshConn.conn.Close()
+}
+
+// sshConn provides net.Conn metadata, but disallows direct reads and
+// writes.
+type sshConn struct {
+ conn net.Conn
+
+ user string
+ sessionID []byte
+ clientVersion []byte
+ serverVersion []byte
+}
+
+func dup(src []byte) []byte {
+ dst := make([]byte, len(src))
+ copy(dst, src)
+ return dst
+}
+
+func (c *sshConn) User() string {
+ return c.user
+}
+
+func (c *sshConn) RemoteAddr() net.Addr {
+ return c.conn.RemoteAddr()
+}
+
+func (c *sshConn) Close() error {
+ return c.conn.Close()
+}
+
+func (c *sshConn) LocalAddr() net.Addr {
+ return c.conn.LocalAddr()
+}
+
+func (c *sshConn) SessionID() []byte {
+ return dup(c.sessionID)
+}
+
+func (c *sshConn) ClientVersion() []byte {
+ return dup(c.clientVersion)
+}
+
+func (c *sshConn) ServerVersion() []byte {
+ return dup(c.serverVersion)
+}
diff --git a/vendor/golang.org/x/crypto/ssh/doc.go b/vendor/golang.org/x/crypto/ssh/doc.go
new file mode 100644
index 00000000..edbe6334
--- /dev/null
+++ b/vendor/golang.org/x/crypto/ssh/doc.go
@@ -0,0 +1,23 @@
+// Copyright 2011 The Go Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style
+// license that can be found in the LICENSE file.
+
+/*
+Package ssh implements an SSH client and server.
+
+SSH is a transport security protocol, an authentication protocol and a
+family of application protocols. The most typical application level
+protocol is a remote shell and this is specifically implemented. However,
+the multiplexed nature of SSH is exposed to users that wish to support
+others.
+
+References:
+
+ [PROTOCOL]: https://cvsweb.openbsd.org/cgi-bin/cvsweb/src/usr.bin/ssh/PROTOCOL?rev=HEAD
+ [PROTOCOL.certkeys]: http://cvsweb.openbsd.org/cgi-bin/cvsweb/src/usr.bin/ssh/PROTOCOL.certkeys?rev=HEAD
+ [SSH-PARAMETERS]: http://www.iana.org/assignments/ssh-parameters/ssh-parameters.xml#ssh-parameters-1
+
+This package does not fall under the stability promise of the Go language itself,
+so its API may be changed when pressing needs arise.
+*/
+package ssh // import "golang.org/x/crypto/ssh"
diff --git a/vendor/golang.org/x/crypto/ssh/handshake.go b/vendor/golang.org/x/crypto/ssh/handshake.go
new file mode 100644
index 00000000..56cdc7c2
--- /dev/null
+++ b/vendor/golang.org/x/crypto/ssh/handshake.go
@@ -0,0 +1,806 @@
+// 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.
+
+package ssh
+
+import (
+ "crypto/rand"
+ "errors"
+ "fmt"
+ "io"
+ "log"
+ "net"
+ "strings"
+ "sync"
+)
+
+// debugHandshake, if set, prints messages sent and received. Key
+// exchange messages are printed as if DH were used, so the debug
+// messages are wrong when using ECDH.
+const debugHandshake = false
+
+// chanSize sets the amount of buffering SSH connections. This is
+// primarily for testing: setting chanSize=0 uncovers deadlocks more
+// quickly.
+const chanSize = 16
+
+// keyingTransport is a packet based transport that supports key
+// changes. It need not be thread-safe. It should pass through
+// msgNewKeys in both directions.
+type keyingTransport interface {
+ packetConn
+
+ // prepareKeyChange sets up a key change. The key change for a
+ // direction will be effected if a msgNewKeys message is sent
+ // or received.
+ prepareKeyChange(*algorithms, *kexResult) error
+
+ // setStrictMode sets the strict KEX mode, notably triggering
+ // sequence number resets on sending or receiving msgNewKeys.
+ // If the sequence number is already > 1 when setStrictMode
+ // is called, an error is returned.
+ setStrictMode() error
+
+ // setInitialKEXDone indicates to the transport that the initial key exchange
+ // was completed
+ setInitialKEXDone()
+}
+
+// handshakeTransport implements rekeying on top of a keyingTransport
+// and offers a thread-safe writePacket() interface.
+type handshakeTransport struct {
+ conn keyingTransport
+ config *Config
+
+ serverVersion []byte
+ clientVersion []byte
+
+ // hostKeys is non-empty if we are the server. In that case,
+ // it contains all host keys that can be used to sign the
+ // connection.
+ hostKeys []Signer
+
+ // publicKeyAuthAlgorithms is non-empty if we are the server. In that case,
+ // it contains the supported client public key authentication algorithms.
+ publicKeyAuthAlgorithms []string
+
+ // hostKeyAlgorithms is non-empty if we are the client. In that case,
+ // we accept these key types from the server as host key.
+ hostKeyAlgorithms []string
+
+ // On read error, incoming is closed, and readError is set.
+ incoming chan []byte
+ readError error
+
+ mu sync.Mutex
+ writeError error
+ sentInitPacket []byte
+ sentInitMsg *kexInitMsg
+ pendingPackets [][]byte // Used when a key exchange is in progress.
+ writePacketsLeft uint32
+ writeBytesLeft int64
+
+ // If the read loop wants to schedule a kex, it pings this
+ // channel, and the write loop will send out a kex
+ // message.
+ requestKex chan struct{}
+
+ // If the other side requests or confirms a kex, its kexInit
+ // packet is sent here for the write loop to find it.
+ startKex chan *pendingKex
+ kexLoopDone chan struct{} // closed (with writeError non-nil) when kexLoop exits
+
+ // data for host key checking
+ hostKeyCallback HostKeyCallback
+ dialAddress string
+ remoteAddr net.Addr
+
+ // bannerCallback is non-empty if we are the client and it has been set in
+ // ClientConfig. In that case it is called during the user authentication
+ // dance to handle a custom server's message.
+ bannerCallback BannerCallback
+
+ // Algorithms agreed in the last key exchange.
+ algorithms *algorithms
+
+ // Counters exclusively owned by readLoop.
+ readPacketsLeft uint32
+ readBytesLeft int64
+
+ // The session ID or nil if first kex did not complete yet.
+ sessionID []byte
+
+ // strictMode indicates if the other side of the handshake indicated
+ // that we should be following the strict KEX protocol restrictions.
+ strictMode bool
+}
+
+type pendingKex struct {
+ otherInit []byte
+ done chan error
+}
+
+func newHandshakeTransport(conn keyingTransport, config *Config, clientVersion, serverVersion []byte) *handshakeTransport {
+ t := &handshakeTransport{
+ conn: conn,
+ serverVersion: serverVersion,
+ clientVersion: clientVersion,
+ incoming: make(chan []byte, chanSize),
+ requestKex: make(chan struct{}, 1),
+ startKex: make(chan *pendingKex),
+ kexLoopDone: make(chan struct{}),
+
+ config: config,
+ }
+ t.resetReadThresholds()
+ t.resetWriteThresholds()
+
+ // We always start with a mandatory key exchange.
+ t.requestKex <- struct{}{}
+ return t
+}
+
+func newClientTransport(conn keyingTransport, clientVersion, serverVersion []byte, config *ClientConfig, dialAddr string, addr net.Addr) *handshakeTransport {
+ t := newHandshakeTransport(conn, &config.Config, clientVersion, serverVersion)
+ t.dialAddress = dialAddr
+ t.remoteAddr = addr
+ t.hostKeyCallback = config.HostKeyCallback
+ t.bannerCallback = config.BannerCallback
+ if config.HostKeyAlgorithms != nil {
+ t.hostKeyAlgorithms = config.HostKeyAlgorithms
+ } else {
+ t.hostKeyAlgorithms = supportedHostKeyAlgos
+ }
+ go t.readLoop()
+ go t.kexLoop()
+ return t
+}
+
+func newServerTransport(conn keyingTransport, clientVersion, serverVersion []byte, config *ServerConfig) *handshakeTransport {
+ t := newHandshakeTransport(conn, &config.Config, clientVersion, serverVersion)
+ t.hostKeys = config.hostKeys
+ t.publicKeyAuthAlgorithms = config.PublicKeyAuthAlgorithms
+ go t.readLoop()
+ go t.kexLoop()
+ return t
+}
+
+func (t *handshakeTransport) getSessionID() []byte {
+ return t.sessionID
+}
+
+// waitSession waits for the session to be established. This should be
+// the first thing to call after instantiating handshakeTransport.
+func (t *handshakeTransport) waitSession() error {
+ p, err := t.readPacket()
+ if err != nil {
+ return err
+ }
+ if p[0] != msgNewKeys {
+ return fmt.Errorf("ssh: first packet should be msgNewKeys")
+ }
+
+ return nil
+}
+
+func (t *handshakeTransport) id() string {
+ if len(t.hostKeys) > 0 {
+ return "server"
+ }
+ return "client"
+}
+
+func (t *handshakeTransport) printPacket(p []byte, write bool) {
+ action := "got"
+ if write {
+ action = "sent"
+ }
+
+ if p[0] == msgChannelData || p[0] == msgChannelExtendedData {
+ log.Printf("%s %s data (packet %d bytes)", t.id(), action, len(p))
+ } else {
+ msg, err := decode(p)
+ log.Printf("%s %s %T %v (%v)", t.id(), action, msg, msg, err)
+ }
+}
+
+func (t *handshakeTransport) readPacket() ([]byte, error) {
+ p, ok := <-t.incoming
+ if !ok {
+ return nil, t.readError
+ }
+ return p, nil
+}
+
+func (t *handshakeTransport) readLoop() {
+ first := true
+ for {
+ p, err := t.readOnePacket(first)
+ first = false
+ if err != nil {
+ t.readError = err
+ close(t.incoming)
+ break
+ }
+ // If this is the first kex, and strict KEX mode is enabled,
+ // we don't ignore any messages, as they may be used to manipulate
+ // the packet sequence numbers.
+ if !(t.sessionID == nil && t.strictMode) && (p[0] == msgIgnore || p[0] == msgDebug) {
+ continue
+ }
+ t.incoming <- p
+ }
+
+ // Stop writers too.
+ t.recordWriteError(t.readError)
+
+ // Unblock the writer should it wait for this.
+ close(t.startKex)
+
+ // Don't close t.requestKex; it's also written to from writePacket.
+}
+
+func (t *handshakeTransport) pushPacket(p []byte) error {
+ if debugHandshake {
+ t.printPacket(p, true)
+ }
+ return t.conn.writePacket(p)
+}
+
+func (t *handshakeTransport) getWriteError() error {
+ t.mu.Lock()
+ defer t.mu.Unlock()
+ return t.writeError
+}
+
+func (t *handshakeTransport) recordWriteError(err error) {
+ t.mu.Lock()
+ defer t.mu.Unlock()
+ if t.writeError == nil && err != nil {
+ t.writeError = err
+ }
+}
+
+func (t *handshakeTransport) requestKeyExchange() {
+ select {
+ case t.requestKex <- struct{}{}:
+ default:
+ // something already requested a kex, so do nothing.
+ }
+}
+
+func (t *handshakeTransport) resetWriteThresholds() {
+ t.writePacketsLeft = packetRekeyThreshold
+ if t.config.RekeyThreshold > 0 {
+ t.writeBytesLeft = int64(t.config.RekeyThreshold)
+ } else if t.algorithms != nil {
+ t.writeBytesLeft = t.algorithms.w.rekeyBytes()
+ } else {
+ t.writeBytesLeft = 1 << 30
+ }
+}
+
+func (t *handshakeTransport) kexLoop() {
+
+write:
+ for t.getWriteError() == nil {
+ var request *pendingKex
+ var sent bool
+
+ for request == nil || !sent {
+ var ok bool
+ select {
+ case request, ok = <-t.startKex:
+ if !ok {
+ break write
+ }
+ case <-t.requestKex:
+ break
+ }
+
+ if !sent {
+ if err := t.sendKexInit(); err != nil {
+ t.recordWriteError(err)
+ break
+ }
+ sent = true
+ }
+ }
+
+ if err := t.getWriteError(); err != nil {
+ if request != nil {
+ request.done <- err
+ }
+ break
+ }
+
+ // We're not servicing t.requestKex, but that is OK:
+ // we never block on sending to t.requestKex.
+
+ // We're not servicing t.startKex, but the remote end
+ // has just sent us a kexInitMsg, so it can't send
+ // another key change request, until we close the done
+ // channel on the pendingKex request.
+
+ err := t.enterKeyExchange(request.otherInit)
+
+ t.mu.Lock()
+ t.writeError = err
+ t.sentInitPacket = nil
+ t.sentInitMsg = nil
+
+ t.resetWriteThresholds()
+
+ // we have completed the key exchange. Since the
+ // reader is still blocked, it is safe to clear out
+ // the requestKex channel. This avoids the situation
+ // where: 1) we consumed our own request for the
+ // initial kex, and 2) the kex from the remote side
+ // caused another send on the requestKex channel,
+ clear:
+ for {
+ select {
+ case <-t.requestKex:
+ //
+ default:
+ break clear
+ }
+ }
+
+ request.done <- t.writeError
+
+ // kex finished. Push packets that we received while
+ // the kex was in progress. Don't look at t.startKex
+ // and don't increment writtenSinceKex: if we trigger
+ // another kex while we are still busy with the last
+ // one, things will become very confusing.
+ for _, p := range t.pendingPackets {
+ t.writeError = t.pushPacket(p)
+ if t.writeError != nil {
+ break
+ }
+ }
+ t.pendingPackets = t.pendingPackets[:0]
+ t.mu.Unlock()
+ }
+
+ // Unblock reader.
+ t.conn.Close()
+
+ // drain startKex channel. We don't service t.requestKex
+ // because nobody does blocking sends there.
+ for request := range t.startKex {
+ request.done <- t.getWriteError()
+ }
+
+ // Mark that the loop is done so that Close can return.
+ close(t.kexLoopDone)
+}
+
+// The protocol uses uint32 for packet counters, so we can't let them
+// reach 1<<32. We will actually read and write more packets than
+// this, though: the other side may send more packets, and after we
+// hit this limit on writing we will send a few more packets for the
+// key exchange itself.
+const packetRekeyThreshold = (1 << 31)
+
+func (t *handshakeTransport) resetReadThresholds() {
+ t.readPacketsLeft = packetRekeyThreshold
+ if t.config.RekeyThreshold > 0 {
+ t.readBytesLeft = int64(t.config.RekeyThreshold)
+ } else if t.algorithms != nil {
+ t.readBytesLeft = t.algorithms.r.rekeyBytes()
+ } else {
+ t.readBytesLeft = 1 << 30
+ }
+}
+
+func (t *handshakeTransport) readOnePacket(first bool) ([]byte, error) {
+ p, err := t.conn.readPacket()
+ if err != nil {
+ return nil, err
+ }
+
+ if t.readPacketsLeft > 0 {
+ t.readPacketsLeft--
+ } else {
+ t.requestKeyExchange()
+ }
+
+ if t.readBytesLeft > 0 {
+ t.readBytesLeft -= int64(len(p))
+ } else {
+ t.requestKeyExchange()
+ }
+
+ if debugHandshake {
+ t.printPacket(p, false)
+ }
+
+ if first && p[0] != msgKexInit {
+ return nil, fmt.Errorf("ssh: first packet should be msgKexInit")
+ }
+
+ if p[0] != msgKexInit {
+ return p, nil
+ }
+
+ firstKex := t.sessionID == nil
+
+ kex := pendingKex{
+ done: make(chan error, 1),
+ otherInit: p,
+ }
+ t.startKex <- &kex
+ err = <-kex.done
+
+ if debugHandshake {
+ log.Printf("%s exited key exchange (first %v), err %v", t.id(), firstKex, err)
+ }
+
+ if err != nil {
+ return nil, err
+ }
+
+ t.resetReadThresholds()
+
+ // By default, a key exchange is hidden from higher layers by
+ // translating it into msgIgnore.
+ successPacket := []byte{msgIgnore}
+ if firstKex {
+ // sendKexInit() for the first kex waits for
+ // msgNewKeys so the authentication process is
+ // guaranteed to happen over an encrypted transport.
+ successPacket = []byte{msgNewKeys}
+ }
+
+ return successPacket, nil
+}
+
+const (
+ kexStrictClient = "kex-strict-c-v00@openssh.com"
+ kexStrictServer = "kex-strict-s-v00@openssh.com"
+)
+
+// sendKexInit sends a key change message.
+func (t *handshakeTransport) sendKexInit() error {
+ t.mu.Lock()
+ defer t.mu.Unlock()
+ if t.sentInitMsg != nil {
+ // kexInits may be sent either in response to the other side,
+ // or because our side wants to initiate a key change, so we
+ // may have already sent a kexInit. In that case, don't send a
+ // second kexInit.
+ return nil
+ }
+
+ msg := &kexInitMsg{
+ CiphersClientServer: t.config.Ciphers,
+ CiphersServerClient: t.config.Ciphers,
+ MACsClientServer: t.config.MACs,
+ MACsServerClient: t.config.MACs,
+ CompressionClientServer: supportedCompressions,
+ CompressionServerClient: supportedCompressions,
+ }
+ io.ReadFull(rand.Reader, msg.Cookie[:])
+
+ // We mutate the KexAlgos slice, in order to add the kex-strict extension algorithm,
+ // and possibly to add the ext-info extension algorithm. Since the slice may be the
+ // user owned KeyExchanges, we create our own slice in order to avoid using user
+ // owned memory by mistake.
+ msg.KexAlgos = make([]string, 0, len(t.config.KeyExchanges)+2) // room for kex-strict and ext-info
+ msg.KexAlgos = append(msg.KexAlgos, t.config.KeyExchanges...)
+
+ isServer := len(t.hostKeys) > 0
+ if isServer {
+ for _, k := range t.hostKeys {
+ // If k is a MultiAlgorithmSigner, we restrict the signature
+ // algorithms. If k is a AlgorithmSigner, presume it supports all
+ // signature algorithms associated with the key format. If k is not
+ // an AlgorithmSigner, we can only assume it only supports the
+ // algorithms that matches the key format. (This means that Sign
+ // can't pick a different default).
+ keyFormat := k.PublicKey().Type()
+
+ switch s := k.(type) {
+ case MultiAlgorithmSigner:
+ for _, algo := range algorithmsForKeyFormat(keyFormat) {
+ if contains(s.Algorithms(), underlyingAlgo(algo)) {
+ msg.ServerHostKeyAlgos = append(msg.ServerHostKeyAlgos, algo)
+ }
+ }
+ case AlgorithmSigner:
+ msg.ServerHostKeyAlgos = append(msg.ServerHostKeyAlgos, algorithmsForKeyFormat(keyFormat)...)
+ default:
+ msg.ServerHostKeyAlgos = append(msg.ServerHostKeyAlgos, keyFormat)
+ }
+ }
+
+ if t.sessionID == nil {
+ msg.KexAlgos = append(msg.KexAlgos, kexStrictServer)
+ }
+ } else {
+ msg.ServerHostKeyAlgos = t.hostKeyAlgorithms
+
+ // As a client we opt in to receiving SSH_MSG_EXT_INFO so we know what
+ // algorithms the server supports for public key authentication. See RFC
+ // 8308, Section 2.1.
+ //
+ // We also send the strict KEX mode extension algorithm, in order to opt
+ // into the strict KEX mode.
+ if firstKeyExchange := t.sessionID == nil; firstKeyExchange {
+ msg.KexAlgos = append(msg.KexAlgos, "ext-info-c")
+ msg.KexAlgos = append(msg.KexAlgos, kexStrictClient)
+ }
+
+ }
+
+ packet := Marshal(msg)
+
+ // writePacket destroys the contents, so save a copy.
+ packetCopy := make([]byte, len(packet))
+ copy(packetCopy, packet)
+
+ if err := t.pushPacket(packetCopy); err != nil {
+ return err
+ }
+
+ t.sentInitMsg = msg
+ t.sentInitPacket = packet
+
+ return nil
+}
+
+func (t *handshakeTransport) writePacket(p []byte) error {
+ switch p[0] {
+ case msgKexInit:
+ return errors.New("ssh: only handshakeTransport can send kexInit")
+ case msgNewKeys:
+ return errors.New("ssh: only handshakeTransport can send newKeys")
+ }
+
+ t.mu.Lock()
+ defer t.mu.Unlock()
+ if t.writeError != nil {
+ return t.writeError
+ }
+
+ if t.sentInitMsg != nil {
+ // Copy the packet so the writer can reuse the buffer.
+ cp := make([]byte, len(p))
+ copy(cp, p)
+ t.pendingPackets = append(t.pendingPackets, cp)
+ return nil
+ }
+
+ if t.writeBytesLeft > 0 {
+ t.writeBytesLeft -= int64(len(p))
+ } else {
+ t.requestKeyExchange()
+ }
+
+ if t.writePacketsLeft > 0 {
+ t.writePacketsLeft--
+ } else {
+ t.requestKeyExchange()
+ }
+
+ if err := t.pushPacket(p); err != nil {
+ t.writeError = err
+ }
+
+ return nil
+}
+
+func (t *handshakeTransport) Close() error {
+ // Close the connection. This should cause the readLoop goroutine to wake up
+ // and close t.startKex, which will shut down kexLoop if running.
+ err := t.conn.Close()
+
+ // Wait for the kexLoop goroutine to complete.
+ // At that point we know that the readLoop goroutine is complete too,
+ // because kexLoop itself waits for readLoop to close the startKex channel.
+ <-t.kexLoopDone
+
+ return err
+}
+
+func (t *handshakeTransport) enterKeyExchange(otherInitPacket []byte) error {
+ if debugHandshake {
+ log.Printf("%s entered key exchange", t.id())
+ }
+
+ otherInit := &kexInitMsg{}
+ if err := Unmarshal(otherInitPacket, otherInit); err != nil {
+ return err
+ }
+
+ magics := handshakeMagics{
+ clientVersion: t.clientVersion,
+ serverVersion: t.serverVersion,
+ clientKexInit: otherInitPacket,
+ serverKexInit: t.sentInitPacket,
+ }
+
+ clientInit := otherInit
+ serverInit := t.sentInitMsg
+ isClient := len(t.hostKeys) == 0
+ if isClient {
+ clientInit, serverInit = serverInit, clientInit
+
+ magics.clientKexInit = t.sentInitPacket
+ magics.serverKexInit = otherInitPacket
+ }
+
+ var err error
+ t.algorithms, err = findAgreedAlgorithms(isClient, clientInit, serverInit)
+ if err != nil {
+ return err
+ }
+
+ if t.sessionID == nil && ((isClient && contains(serverInit.KexAlgos, kexStrictServer)) || (!isClient && contains(clientInit.KexAlgos, kexStrictClient))) {
+ t.strictMode = true
+ if err := t.conn.setStrictMode(); err != nil {
+ return err
+ }
+ }
+
+ // We don't send FirstKexFollows, but we handle receiving it.
+ //
+ // RFC 4253 section 7 defines the kex and the agreement method for
+ // first_kex_packet_follows. It states that the guessed packet
+ // should be ignored if the "kex algorithm and/or the host
+ // key algorithm is guessed wrong (server and client have
+ // different preferred algorithm), or if any of the other
+ // algorithms cannot be agreed upon". The other algorithms have
+ // already been checked above so the kex algorithm and host key
+ // algorithm are checked here.
+ if otherInit.FirstKexFollows && (clientInit.KexAlgos[0] != serverInit.KexAlgos[0] || clientInit.ServerHostKeyAlgos[0] != serverInit.ServerHostKeyAlgos[0]) {
+ // other side sent a kex message for the wrong algorithm,
+ // which we have to ignore.
+ if _, err := t.conn.readPacket(); err != nil {
+ return err
+ }
+ }
+
+ kex, ok := kexAlgoMap[t.algorithms.kex]
+ if !ok {
+ return fmt.Errorf("ssh: unexpected key exchange algorithm %v", t.algorithms.kex)
+ }
+
+ var result *kexResult
+ if len(t.hostKeys) > 0 {
+ result, err = t.server(kex, &magics)
+ } else {
+ result, err = t.client(kex, &magics)
+ }
+
+ if err != nil {
+ return err
+ }
+
+ firstKeyExchange := t.sessionID == nil
+ if firstKeyExchange {
+ t.sessionID = result.H
+ }
+ result.SessionID = t.sessionID
+
+ if err := t.conn.prepareKeyChange(t.algorithms, result); err != nil {
+ return err
+ }
+ if err = t.conn.writePacket([]byte{msgNewKeys}); err != nil {
+ return err
+ }
+
+ // On the server side, after the first SSH_MSG_NEWKEYS, send a SSH_MSG_EXT_INFO
+ // message with the server-sig-algs extension if the client supports it. See
+ // RFC 8308, Sections 2.4 and 3.1, and [PROTOCOL], Section 1.9.
+ if !isClient && firstKeyExchange && contains(clientInit.KexAlgos, "ext-info-c") {
+ supportedPubKeyAuthAlgosList := strings.Join(t.publicKeyAuthAlgorithms, ",")
+ extInfo := &extInfoMsg{
+ NumExtensions: 2,
+ Payload: make([]byte, 0, 4+15+4+len(supportedPubKeyAuthAlgosList)+4+16+4+1),
+ }
+ extInfo.Payload = appendInt(extInfo.Payload, len("server-sig-algs"))
+ extInfo.Payload = append(extInfo.Payload, "server-sig-algs"...)
+ extInfo.Payload = appendInt(extInfo.Payload, len(supportedPubKeyAuthAlgosList))
+ extInfo.Payload = append(extInfo.Payload, supportedPubKeyAuthAlgosList...)
+ extInfo.Payload = appendInt(extInfo.Payload, len("ping@openssh.com"))
+ extInfo.Payload = append(extInfo.Payload, "ping@openssh.com"...)
+ extInfo.Payload = appendInt(extInfo.Payload, 1)
+ extInfo.Payload = append(extInfo.Payload, "0"...)
+ if err := t.conn.writePacket(Marshal(extInfo)); err != nil {
+ return err
+ }
+ }
+
+ if packet, err := t.conn.readPacket(); err != nil {
+ return err
+ } else if packet[0] != msgNewKeys {
+ return unexpectedMessageError(msgNewKeys, packet[0])
+ }
+
+ if firstKeyExchange {
+ // Indicates to the transport that the first key exchange is completed
+ // after receiving SSH_MSG_NEWKEYS.
+ t.conn.setInitialKEXDone()
+ }
+
+ return nil
+}
+
+// algorithmSignerWrapper is an AlgorithmSigner that only supports the default
+// key format algorithm.
+//
+// This is technically a violation of the AlgorithmSigner interface, but it
+// should be unreachable given where we use this. Anyway, at least it returns an
+// error instead of panicing or producing an incorrect signature.
+type algorithmSignerWrapper struct {
+ Signer
+}
+
+func (a algorithmSignerWrapper) SignWithAlgorithm(rand io.Reader, data []byte, algorithm string) (*Signature, error) {
+ if algorithm != underlyingAlgo(a.PublicKey().Type()) {
+ return nil, errors.New("ssh: internal error: algorithmSignerWrapper invoked with non-default algorithm")
+ }
+ return a.Sign(rand, data)
+}
+
+func pickHostKey(hostKeys []Signer, algo string) AlgorithmSigner {
+ for _, k := range hostKeys {
+ if s, ok := k.(MultiAlgorithmSigner); ok {
+ if !contains(s.Algorithms(), underlyingAlgo(algo)) {
+ continue
+ }
+ }
+
+ if algo == k.PublicKey().Type() {
+ return algorithmSignerWrapper{k}
+ }
+
+ k, ok := k.(AlgorithmSigner)
+ if !ok {
+ continue
+ }
+ for _, a := range algorithmsForKeyFormat(k.PublicKey().Type()) {
+ if algo == a {
+ return k
+ }
+ }
+ }
+ return nil
+}
+
+func (t *handshakeTransport) server(kex kexAlgorithm, magics *handshakeMagics) (*kexResult, error) {
+ hostKey := pickHostKey(t.hostKeys, t.algorithms.hostKey)
+ if hostKey == nil {
+ return nil, errors.New("ssh: internal error: negotiated unsupported signature type")
+ }
+
+ r, err := kex.Server(t.conn, t.config.Rand, magics, hostKey, t.algorithms.hostKey)
+ return r, err
+}
+
+func (t *handshakeTransport) client(kex kexAlgorithm, magics *handshakeMagics) (*kexResult, error) {
+ result, err := kex.Client(t.conn, t.config.Rand, magics)
+ if err != nil {
+ return nil, err
+ }
+
+ hostKey, err := ParsePublicKey(result.HostKey)
+ if err != nil {
+ return nil, err
+ }
+
+ if err := verifyHostKeySignature(hostKey, t.algorithms.hostKey, result); err != nil {
+ return nil, err
+ }
+
+ err = t.hostKeyCallback(t.dialAddress, t.remoteAddr, hostKey)
+ if err != nil {
+ return nil, err
+ }
+
+ return result, nil
+}
diff --git a/vendor/golang.org/x/crypto/ssh/internal/bcrypt_pbkdf/bcrypt_pbkdf.go b/vendor/golang.org/x/crypto/ssh/internal/bcrypt_pbkdf/bcrypt_pbkdf.go
new file mode 100644
index 00000000..af81d266
--- /dev/null
+++ b/vendor/golang.org/x/crypto/ssh/internal/bcrypt_pbkdf/bcrypt_pbkdf.go
@@ -0,0 +1,93 @@
+// 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.
+
+// Package bcrypt_pbkdf implements bcrypt_pbkdf(3) from OpenBSD.
+//
+// See https://flak.tedunangst.com/post/bcrypt-pbkdf and
+// https://cvsweb.openbsd.org/cgi-bin/cvsweb/src/lib/libutil/bcrypt_pbkdf.c.
+package bcrypt_pbkdf
+
+import (
+ "crypto/sha512"
+ "errors"
+ "golang.org/x/crypto/blowfish"
+)
+
+const blockSize = 32
+
+// Key derives a key from the password, salt and rounds count, returning a
+// []byte of length keyLen that can be used as cryptographic key.
+func Key(password, salt []byte, rounds, keyLen int) ([]byte, error) {
+ if rounds < 1 {
+ return nil, errors.New("bcrypt_pbkdf: number of rounds is too small")
+ }
+ if len(password) == 0 {
+ return nil, errors.New("bcrypt_pbkdf: empty password")
+ }
+ if len(salt) == 0 || len(salt) > 1<<20 {
+ return nil, errors.New("bcrypt_pbkdf: bad salt length")
+ }
+ if keyLen > 1024 {
+ return nil, errors.New("bcrypt_pbkdf: keyLen is too large")
+ }
+
+ numBlocks := (keyLen + blockSize - 1) / blockSize
+ key := make([]byte, numBlocks*blockSize)
+
+ h := sha512.New()
+ h.Write(password)
+ shapass := h.Sum(nil)
+
+ shasalt := make([]byte, 0, sha512.Size)
+ cnt, tmp := make([]byte, 4), make([]byte, blockSize)
+ for block := 1; block <= numBlocks; block++ {
+ h.Reset()
+ h.Write(salt)
+ cnt[0] = byte(block >> 24)
+ cnt[1] = byte(block >> 16)
+ cnt[2] = byte(block >> 8)
+ cnt[3] = byte(block)
+ h.Write(cnt)
+ bcryptHash(tmp, shapass, h.Sum(shasalt))
+
+ out := make([]byte, blockSize)
+ copy(out, tmp)
+ for i := 2; i <= rounds; i++ {
+ h.Reset()
+ h.Write(tmp)
+ bcryptHash(tmp, shapass, h.Sum(shasalt))
+ for j := 0; j < len(out); j++ {
+ out[j] ^= tmp[j]
+ }
+ }
+
+ for i, v := range out {
+ key[i*numBlocks+(block-1)] = v
+ }
+ }
+ return key[:keyLen], nil
+}
+
+var magic = []byte("OxychromaticBlowfishSwatDynamite")
+
+func bcryptHash(out, shapass, shasalt []byte) {
+ c, err := blowfish.NewSaltedCipher(shapass, shasalt)
+ if err != nil {
+ panic(err)
+ }
+ for i := 0; i < 64; i++ {
+ blowfish.ExpandKey(shasalt, c)
+ blowfish.ExpandKey(shapass, c)
+ }
+ copy(out, magic)
+ for i := 0; i < 32; i += 8 {
+ for j := 0; j < 64; j++ {
+ c.Encrypt(out[i:i+8], out[i:i+8])
+ }
+ }
+ // Swap bytes due to different endianness.
+ for i := 0; i < 32; i += 4 {
+ out[i+3], out[i+2], out[i+1], out[i] = out[i], out[i+1], out[i+2], out[i+3]
+ }
+}
diff --git a/vendor/golang.org/x/crypto/ssh/kex.go b/vendor/golang.org/x/crypto/ssh/kex.go
new file mode 100644
index 00000000..8a05f799
--- /dev/null
+++ b/vendor/golang.org/x/crypto/ssh/kex.go
@@ -0,0 +1,786 @@
+// 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.
+
+package ssh
+
+import (
+ "crypto"
+ "crypto/ecdsa"
+ "crypto/elliptic"
+ "crypto/rand"
+ "crypto/subtle"
+ "encoding/binary"
+ "errors"
+ "fmt"
+ "io"
+ "math/big"
+
+ "golang.org/x/crypto/curve25519"
+)
+
+const (
+ kexAlgoDH1SHA1 = "diffie-hellman-group1-sha1"
+ kexAlgoDH14SHA1 = "diffie-hellman-group14-sha1"
+ kexAlgoDH14SHA256 = "diffie-hellman-group14-sha256"
+ kexAlgoDH16SHA512 = "diffie-hellman-group16-sha512"
+ kexAlgoECDH256 = "ecdh-sha2-nistp256"
+ kexAlgoECDH384 = "ecdh-sha2-nistp384"
+ kexAlgoECDH521 = "ecdh-sha2-nistp521"
+ kexAlgoCurve25519SHA256LibSSH = "curve25519-sha256@libssh.org"
+ kexAlgoCurve25519SHA256 = "curve25519-sha256"
+
+ // For the following kex only the client half contains a production
+ // ready implementation. The server half only consists of a minimal
+ // implementation to satisfy the automated tests.
+ kexAlgoDHGEXSHA1 = "diffie-hellman-group-exchange-sha1"
+ kexAlgoDHGEXSHA256 = "diffie-hellman-group-exchange-sha256"
+)
+
+// kexResult captures the outcome of a key exchange.
+type kexResult struct {
+ // Session hash. See also RFC 4253, section 8.
+ H []byte
+
+ // Shared secret. See also RFC 4253, section 8.
+ K []byte
+
+ // Host key as hashed into H.
+ HostKey []byte
+
+ // Signature of H.
+ Signature []byte
+
+ // A cryptographic hash function that matches the security
+ // level of the key exchange algorithm. It is used for
+ // calculating H, and for deriving keys from H and K.
+ Hash crypto.Hash
+
+ // The session ID, which is the first H computed. This is used
+ // to derive key material inside the transport.
+ SessionID []byte
+}
+
+// handshakeMagics contains data that is always included in the
+// session hash.
+type handshakeMagics struct {
+ clientVersion, serverVersion []byte
+ clientKexInit, serverKexInit []byte
+}
+
+func (m *handshakeMagics) write(w io.Writer) {
+ writeString(w, m.clientVersion)
+ writeString(w, m.serverVersion)
+ writeString(w, m.clientKexInit)
+ writeString(w, m.serverKexInit)
+}
+
+// kexAlgorithm abstracts different key exchange algorithms.
+type kexAlgorithm interface {
+ // Server runs server-side key agreement, signing the result
+ // with a hostkey. algo is the negotiated algorithm, and may
+ // be a certificate type.
+ Server(p packetConn, rand io.Reader, magics *handshakeMagics, s AlgorithmSigner, algo string) (*kexResult, error)
+
+ // Client runs the client-side key agreement. Caller is
+ // responsible for verifying the host key signature.
+ Client(p packetConn, rand io.Reader, magics *handshakeMagics) (*kexResult, error)
+}
+
+// dhGroup is a multiplicative group suitable for implementing Diffie-Hellman key agreement.
+type dhGroup struct {
+ g, p, pMinus1 *big.Int
+ hashFunc crypto.Hash
+}
+
+func (group *dhGroup) diffieHellman(theirPublic, myPrivate *big.Int) (*big.Int, error) {
+ if theirPublic.Cmp(bigOne) <= 0 || theirPublic.Cmp(group.pMinus1) >= 0 {
+ return nil, errors.New("ssh: DH parameter out of bounds")
+ }
+ return new(big.Int).Exp(theirPublic, myPrivate, group.p), nil
+}
+
+func (group *dhGroup) Client(c packetConn, randSource io.Reader, magics *handshakeMagics) (*kexResult, error) {
+ var x *big.Int
+ for {
+ var err error
+ if x, err = rand.Int(randSource, group.pMinus1); err != nil {
+ return nil, err
+ }
+ if x.Sign() > 0 {
+ break
+ }
+ }
+
+ X := new(big.Int).Exp(group.g, x, group.p)
+ kexDHInit := kexDHInitMsg{
+ X: X,
+ }
+ if err := c.writePacket(Marshal(&kexDHInit)); err != nil {
+ return nil, err
+ }
+
+ packet, err := c.readPacket()
+ if err != nil {
+ return nil, err
+ }
+
+ var kexDHReply kexDHReplyMsg
+ if err = Unmarshal(packet, &kexDHReply); err != nil {
+ return nil, err
+ }
+
+ ki, err := group.diffieHellman(kexDHReply.Y, x)
+ if err != nil {
+ return nil, err
+ }
+
+ h := group.hashFunc.New()
+ magics.write(h)
+ writeString(h, kexDHReply.HostKey)
+ writeInt(h, X)
+ writeInt(h, kexDHReply.Y)
+ K := make([]byte, intLength(ki))
+ marshalInt(K, ki)
+ h.Write(K)
+
+ return &kexResult{
+ H: h.Sum(nil),
+ K: K,
+ HostKey: kexDHReply.HostKey,
+ Signature: kexDHReply.Signature,
+ Hash: group.hashFunc,
+ }, nil
+}
+
+func (group *dhGroup) Server(c packetConn, randSource io.Reader, magics *handshakeMagics, priv AlgorithmSigner, algo string) (result *kexResult, err error) {
+ packet, err := c.readPacket()
+ if err != nil {
+ return
+ }
+ var kexDHInit kexDHInitMsg
+ if err = Unmarshal(packet, &kexDHInit); err != nil {
+ return
+ }
+
+ var y *big.Int
+ for {
+ if y, err = rand.Int(randSource, group.pMinus1); err != nil {
+ return
+ }
+ if y.Sign() > 0 {
+ break
+ }
+ }
+
+ Y := new(big.Int).Exp(group.g, y, group.p)
+ ki, err := group.diffieHellman(kexDHInit.X, y)
+ if err != nil {
+ return nil, err
+ }
+
+ hostKeyBytes := priv.PublicKey().Marshal()
+
+ h := group.hashFunc.New()
+ magics.write(h)
+ writeString(h, hostKeyBytes)
+ writeInt(h, kexDHInit.X)
+ writeInt(h, Y)
+
+ K := make([]byte, intLength(ki))
+ marshalInt(K, ki)
+ h.Write(K)
+
+ H := h.Sum(nil)
+
+ // H is already a hash, but the hostkey signing will apply its
+ // own key-specific hash algorithm.
+ sig, err := signAndMarshal(priv, randSource, H, algo)
+ if err != nil {
+ return nil, err
+ }
+
+ kexDHReply := kexDHReplyMsg{
+ HostKey: hostKeyBytes,
+ Y: Y,
+ Signature: sig,
+ }
+ packet = Marshal(&kexDHReply)
+
+ err = c.writePacket(packet)
+ return &kexResult{
+ H: H,
+ K: K,
+ HostKey: hostKeyBytes,
+ Signature: sig,
+ Hash: group.hashFunc,
+ }, err
+}
+
+// ecdh performs Elliptic Curve Diffie-Hellman key exchange as
+// described in RFC 5656, section 4.
+type ecdh struct {
+ curve elliptic.Curve
+}
+
+func (kex *ecdh) Client(c packetConn, rand io.Reader, magics *handshakeMagics) (*kexResult, error) {
+ ephKey, err := ecdsa.GenerateKey(kex.curve, rand)
+ if err != nil {
+ return nil, err
+ }
+
+ kexInit := kexECDHInitMsg{
+ ClientPubKey: elliptic.Marshal(kex.curve, ephKey.PublicKey.X, ephKey.PublicKey.Y),
+ }
+
+ serialized := Marshal(&kexInit)
+ if err := c.writePacket(serialized); err != nil {
+ return nil, err
+ }
+
+ packet, err := c.readPacket()
+ if err != nil {
+ return nil, err
+ }
+
+ var reply kexECDHReplyMsg
+ if err = Unmarshal(packet, &reply); err != nil {
+ return nil, err
+ }
+
+ x, y, err := unmarshalECKey(kex.curve, reply.EphemeralPubKey)
+ if err != nil {
+ return nil, err
+ }
+
+ // generate shared secret
+ secret, _ := kex.curve.ScalarMult(x, y, ephKey.D.Bytes())
+
+ h := ecHash(kex.curve).New()
+ magics.write(h)
+ writeString(h, reply.HostKey)
+ writeString(h, kexInit.ClientPubKey)
+ writeString(h, reply.EphemeralPubKey)
+ K := make([]byte, intLength(secret))
+ marshalInt(K, secret)
+ h.Write(K)
+
+ return &kexResult{
+ H: h.Sum(nil),
+ K: K,
+ HostKey: reply.HostKey,
+ Signature: reply.Signature,
+ Hash: ecHash(kex.curve),
+ }, nil
+}
+
+// unmarshalECKey parses and checks an EC key.
+func unmarshalECKey(curve elliptic.Curve, pubkey []byte) (x, y *big.Int, err error) {
+ x, y = elliptic.Unmarshal(curve, pubkey)
+ if x == nil {
+ return nil, nil, errors.New("ssh: elliptic.Unmarshal failure")
+ }
+ if !validateECPublicKey(curve, x, y) {
+ return nil, nil, errors.New("ssh: public key not on curve")
+ }
+ return x, y, nil
+}
+
+// validateECPublicKey checks that the point is a valid public key for
+// the given curve. See [SEC1], 3.2.2
+func validateECPublicKey(curve elliptic.Curve, x, y *big.Int) bool {
+ if x.Sign() == 0 && y.Sign() == 0 {
+ return false
+ }
+
+ if x.Cmp(curve.Params().P) >= 0 {
+ return false
+ }
+
+ if y.Cmp(curve.Params().P) >= 0 {
+ return false
+ }
+
+ if !curve.IsOnCurve(x, y) {
+ return false
+ }
+
+ // We don't check if N * PubKey == 0, since
+ //
+ // - the NIST curves have cofactor = 1, so this is implicit.
+ // (We don't foresee an implementation that supports non NIST
+ // curves)
+ //
+ // - for ephemeral keys, we don't need to worry about small
+ // subgroup attacks.
+ return true
+}
+
+func (kex *ecdh) Server(c packetConn, rand io.Reader, magics *handshakeMagics, priv AlgorithmSigner, algo string) (result *kexResult, err error) {
+ packet, err := c.readPacket()
+ if err != nil {
+ return nil, err
+ }
+
+ var kexECDHInit kexECDHInitMsg
+ if err = Unmarshal(packet, &kexECDHInit); err != nil {
+ return nil, err
+ }
+
+ clientX, clientY, err := unmarshalECKey(kex.curve, kexECDHInit.ClientPubKey)
+ if err != nil {
+ return nil, err
+ }
+
+ // We could cache this key across multiple users/multiple
+ // connection attempts, but the benefit is small. OpenSSH
+ // generates a new key for each incoming connection.
+ ephKey, err := ecdsa.GenerateKey(kex.curve, rand)
+ if err != nil {
+ return nil, err
+ }
+
+ hostKeyBytes := priv.PublicKey().Marshal()
+
+ serializedEphKey := elliptic.Marshal(kex.curve, ephKey.PublicKey.X, ephKey.PublicKey.Y)
+
+ // generate shared secret
+ secret, _ := kex.curve.ScalarMult(clientX, clientY, ephKey.D.Bytes())
+
+ h := ecHash(kex.curve).New()
+ magics.write(h)
+ writeString(h, hostKeyBytes)
+ writeString(h, kexECDHInit.ClientPubKey)
+ writeString(h, serializedEphKey)
+
+ K := make([]byte, intLength(secret))
+ marshalInt(K, secret)
+ h.Write(K)
+
+ H := h.Sum(nil)
+
+ // H is already a hash, but the hostkey signing will apply its
+ // own key-specific hash algorithm.
+ sig, err := signAndMarshal(priv, rand, H, algo)
+ if err != nil {
+ return nil, err
+ }
+
+ reply := kexECDHReplyMsg{
+ EphemeralPubKey: serializedEphKey,
+ HostKey: hostKeyBytes,
+ Signature: sig,
+ }
+
+ serialized := Marshal(&reply)
+ if err := c.writePacket(serialized); err != nil {
+ return nil, err
+ }
+
+ return &kexResult{
+ H: H,
+ K: K,
+ HostKey: reply.HostKey,
+ Signature: sig,
+ Hash: ecHash(kex.curve),
+ }, nil
+}
+
+// ecHash returns the hash to match the given elliptic curve, see RFC
+// 5656, section 6.2.1
+func ecHash(curve elliptic.Curve) crypto.Hash {
+ bitSize := curve.Params().BitSize
+ switch {
+ case bitSize <= 256:
+ return crypto.SHA256
+ case bitSize <= 384:
+ return crypto.SHA384
+ }
+ return crypto.SHA512
+}
+
+var kexAlgoMap = map[string]kexAlgorithm{}
+
+func init() {
+ // This is the group called diffie-hellman-group1-sha1 in
+ // RFC 4253 and Oakley Group 2 in RFC 2409.
+ p, _ := new(big.Int).SetString("FFFFFFFFFFFFFFFFC90FDAA22168C234C4C6628B80DC1CD129024E088A67CC74020BBEA63B139B22514A08798E3404DDEF9519B3CD3A431B302B0A6DF25F14374FE1356D6D51C245E485B576625E7EC6F44C42E9A637ED6B0BFF5CB6F406B7EDEE386BFB5A899FA5AE9F24117C4B1FE649286651ECE65381FFFFFFFFFFFFFFFF", 16)
+ kexAlgoMap[kexAlgoDH1SHA1] = &dhGroup{
+ g: new(big.Int).SetInt64(2),
+ p: p,
+ pMinus1: new(big.Int).Sub(p, bigOne),
+ hashFunc: crypto.SHA1,
+ }
+
+ // This are the groups called diffie-hellman-group14-sha1 and
+ // diffie-hellman-group14-sha256 in RFC 4253 and RFC 8268,
+ // and Oakley Group 14 in RFC 3526.
+ p, _ = new(big.Int).SetString("FFFFFFFFFFFFFFFFC90FDAA22168C234C4C6628B80DC1CD129024E088A67CC74020BBEA63B139B22514A08798E3404DDEF9519B3CD3A431B302B0A6DF25F14374FE1356D6D51C245E485B576625E7EC6F44C42E9A637ED6B0BFF5CB6F406B7EDEE386BFB5A899FA5AE9F24117C4B1FE649286651ECE45B3DC2007CB8A163BF0598DA48361C55D39A69163FA8FD24CF5F83655D23DCA3AD961C62F356208552BB9ED529077096966D670C354E4ABC9804F1746C08CA18217C32905E462E36CE3BE39E772C180E86039B2783A2EC07A28FB5C55DF06F4C52C9DE2BCBF6955817183995497CEA956AE515D2261898FA051015728E5A8AACAA68FFFFFFFFFFFFFFFF", 16)
+ group14 := &dhGroup{
+ g: new(big.Int).SetInt64(2),
+ p: p,
+ pMinus1: new(big.Int).Sub(p, bigOne),
+ }
+
+ kexAlgoMap[kexAlgoDH14SHA1] = &dhGroup{
+ g: group14.g, p: group14.p, pMinus1: group14.pMinus1,
+ hashFunc: crypto.SHA1,
+ }
+ kexAlgoMap[kexAlgoDH14SHA256] = &dhGroup{
+ g: group14.g, p: group14.p, pMinus1: group14.pMinus1,
+ hashFunc: crypto.SHA256,
+ }
+
+ // This is the group called diffie-hellman-group16-sha512 in RFC
+ // 8268 and Oakley Group 16 in RFC 3526.
+ p, _ = new(big.Int).SetString("FFFFFFFFFFFFFFFFC90FDAA22168C234C4C6628B80DC1CD129024E088A67CC74020BBEA63B139B22514A08798E3404DDEF9519B3CD3A431B302B0A6DF25F14374FE1356D6D51C245E485B576625E7EC6F44C42E9A637ED6B0BFF5CB6F406B7EDEE386BFB5A899FA5AE9F24117C4B1FE649286651ECE45B3DC2007CB8A163BF0598DA48361C55D39A69163FA8FD24CF5F83655D23DCA3AD961C62F356208552BB9ED529077096966D670C354E4ABC9804F1746C08CA18217C32905E462E36CE3BE39E772C180E86039B2783A2EC07A28FB5C55DF06F4C52C9DE2BCBF6955817183995497CEA956AE515D2261898FA051015728E5A8AAAC42DAD33170D04507A33A85521ABDF1CBA64ECFB850458DBEF0A8AEA71575D060C7DB3970F85A6E1E4C7ABF5AE8CDB0933D71E8C94E04A25619DCEE3D2261AD2EE6BF12FFA06D98A0864D87602733EC86A64521F2B18177B200CBBE117577A615D6C770988C0BAD946E208E24FA074E5AB3143DB5BFCE0FD108E4B82D120A92108011A723C12A787E6D788719A10BDBA5B2699C327186AF4E23C1A946834B6150BDA2583E9CA2AD44CE8DBBBC2DB04DE8EF92E8EFC141FBECAA6287C59474E6BC05D99B2964FA090C3A2233BA186515BE7ED1F612970CEE2D7AFB81BDD762170481CD0069127D5B05AA993B4EA988D8FDDC186FFB7DC90A6C08F4DF435C934063199FFFFFFFFFFFFFFFF", 16)
+
+ kexAlgoMap[kexAlgoDH16SHA512] = &dhGroup{
+ g: new(big.Int).SetInt64(2),
+ p: p,
+ pMinus1: new(big.Int).Sub(p, bigOne),
+ hashFunc: crypto.SHA512,
+ }
+
+ kexAlgoMap[kexAlgoECDH521] = &ecdh{elliptic.P521()}
+ kexAlgoMap[kexAlgoECDH384] = &ecdh{elliptic.P384()}
+ kexAlgoMap[kexAlgoECDH256] = &ecdh{elliptic.P256()}
+ kexAlgoMap[kexAlgoCurve25519SHA256] = &curve25519sha256{}
+ kexAlgoMap[kexAlgoCurve25519SHA256LibSSH] = &curve25519sha256{}
+ kexAlgoMap[kexAlgoDHGEXSHA1] = &dhGEXSHA{hashFunc: crypto.SHA1}
+ kexAlgoMap[kexAlgoDHGEXSHA256] = &dhGEXSHA{hashFunc: crypto.SHA256}
+}
+
+// curve25519sha256 implements the curve25519-sha256 (formerly known as
+// curve25519-sha256@libssh.org) key exchange method, as described in RFC 8731.
+type curve25519sha256 struct{}
+
+type curve25519KeyPair struct {
+ priv [32]byte
+ pub [32]byte
+}
+
+func (kp *curve25519KeyPair) generate(rand io.Reader) error {
+ if _, err := io.ReadFull(rand, kp.priv[:]); err != nil {
+ return err
+ }
+ curve25519.ScalarBaseMult(&kp.pub, &kp.priv)
+ return nil
+}
+
+// curve25519Zeros is just an array of 32 zero bytes so that we have something
+// convenient to compare against in order to reject curve25519 points with the
+// wrong order.
+var curve25519Zeros [32]byte
+
+func (kex *curve25519sha256) Client(c packetConn, rand io.Reader, magics *handshakeMagics) (*kexResult, error) {
+ var kp curve25519KeyPair
+ if err := kp.generate(rand); err != nil {
+ return nil, err
+ }
+ if err := c.writePacket(Marshal(&kexECDHInitMsg{kp.pub[:]})); err != nil {
+ return nil, err
+ }
+
+ packet, err := c.readPacket()
+ if err != nil {
+ return nil, err
+ }
+
+ var reply kexECDHReplyMsg
+ if err = Unmarshal(packet, &reply); err != nil {
+ return nil, err
+ }
+ if len(reply.EphemeralPubKey) != 32 {
+ return nil, errors.New("ssh: peer's curve25519 public value has wrong length")
+ }
+
+ var servPub, secret [32]byte
+ copy(servPub[:], reply.EphemeralPubKey)
+ curve25519.ScalarMult(&secret, &kp.priv, &servPub)
+ if subtle.ConstantTimeCompare(secret[:], curve25519Zeros[:]) == 1 {
+ return nil, errors.New("ssh: peer's curve25519 public value has wrong order")
+ }
+
+ h := crypto.SHA256.New()
+ magics.write(h)
+ writeString(h, reply.HostKey)
+ writeString(h, kp.pub[:])
+ writeString(h, reply.EphemeralPubKey)
+
+ ki := new(big.Int).SetBytes(secret[:])
+ K := make([]byte, intLength(ki))
+ marshalInt(K, ki)
+ h.Write(K)
+
+ return &kexResult{
+ H: h.Sum(nil),
+ K: K,
+ HostKey: reply.HostKey,
+ Signature: reply.Signature,
+ Hash: crypto.SHA256,
+ }, nil
+}
+
+func (kex *curve25519sha256) Server(c packetConn, rand io.Reader, magics *handshakeMagics, priv AlgorithmSigner, algo string) (result *kexResult, err error) {
+ packet, err := c.readPacket()
+ if err != nil {
+ return
+ }
+ var kexInit kexECDHInitMsg
+ if err = Unmarshal(packet, &kexInit); err != nil {
+ return
+ }
+
+ if len(kexInit.ClientPubKey) != 32 {
+ return nil, errors.New("ssh: peer's curve25519 public value has wrong length")
+ }
+
+ var kp curve25519KeyPair
+ if err := kp.generate(rand); err != nil {
+ return nil, err
+ }
+
+ var clientPub, secret [32]byte
+ copy(clientPub[:], kexInit.ClientPubKey)
+ curve25519.ScalarMult(&secret, &kp.priv, &clientPub)
+ if subtle.ConstantTimeCompare(secret[:], curve25519Zeros[:]) == 1 {
+ return nil, errors.New("ssh: peer's curve25519 public value has wrong order")
+ }
+
+ hostKeyBytes := priv.PublicKey().Marshal()
+
+ h := crypto.SHA256.New()
+ magics.write(h)
+ writeString(h, hostKeyBytes)
+ writeString(h, kexInit.ClientPubKey)
+ writeString(h, kp.pub[:])
+
+ ki := new(big.Int).SetBytes(secret[:])
+ K := make([]byte, intLength(ki))
+ marshalInt(K, ki)
+ h.Write(K)
+
+ H := h.Sum(nil)
+
+ sig, err := signAndMarshal(priv, rand, H, algo)
+ if err != nil {
+ return nil, err
+ }
+
+ reply := kexECDHReplyMsg{
+ EphemeralPubKey: kp.pub[:],
+ HostKey: hostKeyBytes,
+ Signature: sig,
+ }
+ if err := c.writePacket(Marshal(&reply)); err != nil {
+ return nil, err
+ }
+ return &kexResult{
+ H: H,
+ K: K,
+ HostKey: hostKeyBytes,
+ Signature: sig,
+ Hash: crypto.SHA256,
+ }, nil
+}
+
+// dhGEXSHA implements the diffie-hellman-group-exchange-sha1 and
+// diffie-hellman-group-exchange-sha256 key agreement protocols,
+// as described in RFC 4419
+type dhGEXSHA struct {
+ hashFunc crypto.Hash
+}
+
+const (
+ dhGroupExchangeMinimumBits = 2048
+ dhGroupExchangePreferredBits = 2048
+ dhGroupExchangeMaximumBits = 8192
+)
+
+func (gex *dhGEXSHA) Client(c packetConn, randSource io.Reader, magics *handshakeMagics) (*kexResult, error) {
+ // Send GexRequest
+ kexDHGexRequest := kexDHGexRequestMsg{
+ MinBits: dhGroupExchangeMinimumBits,
+ PreferedBits: dhGroupExchangePreferredBits,
+ MaxBits: dhGroupExchangeMaximumBits,
+ }
+ if err := c.writePacket(Marshal(&kexDHGexRequest)); err != nil {
+ return nil, err
+ }
+
+ // Receive GexGroup
+ packet, err := c.readPacket()
+ if err != nil {
+ return nil, err
+ }
+
+ var msg kexDHGexGroupMsg
+ if err = Unmarshal(packet, &msg); err != nil {
+ return nil, err
+ }
+
+ // reject if p's bit length < dhGroupExchangeMinimumBits or > dhGroupExchangeMaximumBits
+ if msg.P.BitLen() < dhGroupExchangeMinimumBits || msg.P.BitLen() > dhGroupExchangeMaximumBits {
+ return nil, fmt.Errorf("ssh: server-generated gex p is out of range (%d bits)", msg.P.BitLen())
+ }
+
+ // Check if g is safe by verifying that 1 < g < p-1
+ pMinusOne := new(big.Int).Sub(msg.P, bigOne)
+ if msg.G.Cmp(bigOne) <= 0 || msg.G.Cmp(pMinusOne) >= 0 {
+ return nil, fmt.Errorf("ssh: server provided gex g is not safe")
+ }
+
+ // Send GexInit
+ pHalf := new(big.Int).Rsh(msg.P, 1)
+ x, err := rand.Int(randSource, pHalf)
+ if err != nil {
+ return nil, err
+ }
+ X := new(big.Int).Exp(msg.G, x, msg.P)
+ kexDHGexInit := kexDHGexInitMsg{
+ X: X,
+ }
+ if err := c.writePacket(Marshal(&kexDHGexInit)); err != nil {
+ return nil, err
+ }
+
+ // Receive GexReply
+ packet, err = c.readPacket()
+ if err != nil {
+ return nil, err
+ }
+
+ var kexDHGexReply kexDHGexReplyMsg
+ if err = Unmarshal(packet, &kexDHGexReply); err != nil {
+ return nil, err
+ }
+
+ if kexDHGexReply.Y.Cmp(bigOne) <= 0 || kexDHGexReply.Y.Cmp(pMinusOne) >= 0 {
+ return nil, errors.New("ssh: DH parameter out of bounds")
+ }
+ kInt := new(big.Int).Exp(kexDHGexReply.Y, x, msg.P)
+
+ // Check if k is safe by verifying that k > 1 and k < p - 1
+ if kInt.Cmp(bigOne) <= 0 || kInt.Cmp(pMinusOne) >= 0 {
+ return nil, fmt.Errorf("ssh: derived k is not safe")
+ }
+
+ h := gex.hashFunc.New()
+ magics.write(h)
+ writeString(h, kexDHGexReply.HostKey)
+ binary.Write(h, binary.BigEndian, uint32(dhGroupExchangeMinimumBits))
+ binary.Write(h, binary.BigEndian, uint32(dhGroupExchangePreferredBits))
+ binary.Write(h, binary.BigEndian, uint32(dhGroupExchangeMaximumBits))
+ writeInt(h, msg.P)
+ writeInt(h, msg.G)
+ writeInt(h, X)
+ writeInt(h, kexDHGexReply.Y)
+ K := make([]byte, intLength(kInt))
+ marshalInt(K, kInt)
+ h.Write(K)
+
+ return &kexResult{
+ H: h.Sum(nil),
+ K: K,
+ HostKey: kexDHGexReply.HostKey,
+ Signature: kexDHGexReply.Signature,
+ Hash: gex.hashFunc,
+ }, nil
+}
+
+// Server half implementation of the Diffie Hellman Key Exchange with SHA1 and SHA256.
+//
+// This is a minimal implementation to satisfy the automated tests.
+func (gex dhGEXSHA) Server(c packetConn, randSource io.Reader, magics *handshakeMagics, priv AlgorithmSigner, algo string) (result *kexResult, err error) {
+ // Receive GexRequest
+ packet, err := c.readPacket()
+ if err != nil {
+ return
+ }
+ var kexDHGexRequest kexDHGexRequestMsg
+ if err = Unmarshal(packet, &kexDHGexRequest); err != nil {
+ return
+ }
+
+ // Send GexGroup
+ // This is the group called diffie-hellman-group14-sha1 in RFC
+ // 4253 and Oakley Group 14 in RFC 3526.
+ p, _ := new(big.Int).SetString("FFFFFFFFFFFFFFFFC90FDAA22168C234C4C6628B80DC1CD129024E088A67CC74020BBEA63B139B22514A08798E3404DDEF9519B3CD3A431B302B0A6DF25F14374FE1356D6D51C245E485B576625E7EC6F44C42E9A637ED6B0BFF5CB6F406B7EDEE386BFB5A899FA5AE9F24117C4B1FE649286651ECE45B3DC2007CB8A163BF0598DA48361C55D39A69163FA8FD24CF5F83655D23DCA3AD961C62F356208552BB9ED529077096966D670C354E4ABC9804F1746C08CA18217C32905E462E36CE3BE39E772C180E86039B2783A2EC07A28FB5C55DF06F4C52C9DE2BCBF6955817183995497CEA956AE515D2261898FA051015728E5A8AACAA68FFFFFFFFFFFFFFFF", 16)
+ g := big.NewInt(2)
+
+ msg := &kexDHGexGroupMsg{
+ P: p,
+ G: g,
+ }
+ if err := c.writePacket(Marshal(msg)); err != nil {
+ return nil, err
+ }
+
+ // Receive GexInit
+ packet, err = c.readPacket()
+ if err != nil {
+ return
+ }
+ var kexDHGexInit kexDHGexInitMsg
+ if err = Unmarshal(packet, &kexDHGexInit); err != nil {
+ return
+ }
+
+ pHalf := new(big.Int).Rsh(p, 1)
+
+ y, err := rand.Int(randSource, pHalf)
+ if err != nil {
+ return
+ }
+ Y := new(big.Int).Exp(g, y, p)
+
+ pMinusOne := new(big.Int).Sub(p, bigOne)
+ if kexDHGexInit.X.Cmp(bigOne) <= 0 || kexDHGexInit.X.Cmp(pMinusOne) >= 0 {
+ return nil, errors.New("ssh: DH parameter out of bounds")
+ }
+ kInt := new(big.Int).Exp(kexDHGexInit.X, y, p)
+
+ hostKeyBytes := priv.PublicKey().Marshal()
+
+ h := gex.hashFunc.New()
+ magics.write(h)
+ writeString(h, hostKeyBytes)
+ binary.Write(h, binary.BigEndian, uint32(dhGroupExchangeMinimumBits))
+ binary.Write(h, binary.BigEndian, uint32(dhGroupExchangePreferredBits))
+ binary.Write(h, binary.BigEndian, uint32(dhGroupExchangeMaximumBits))
+ writeInt(h, p)
+ writeInt(h, g)
+ writeInt(h, kexDHGexInit.X)
+ writeInt(h, Y)
+
+ K := make([]byte, intLength(kInt))
+ marshalInt(K, kInt)
+ h.Write(K)
+
+ H := h.Sum(nil)
+
+ // H is already a hash, but the hostkey signing will apply its
+ // own key-specific hash algorithm.
+ sig, err := signAndMarshal(priv, randSource, H, algo)
+ if err != nil {
+ return nil, err
+ }
+
+ kexDHGexReply := kexDHGexReplyMsg{
+ HostKey: hostKeyBytes,
+ Y: Y,
+ Signature: sig,
+ }
+ packet = Marshal(&kexDHGexReply)
+
+ err = c.writePacket(packet)
+
+ return &kexResult{
+ H: H,
+ K: K,
+ HostKey: hostKeyBytes,
+ Signature: sig,
+ Hash: gex.hashFunc,
+ }, err
+}
diff --git a/vendor/golang.org/x/crypto/ssh/keys.go b/vendor/golang.org/x/crypto/ssh/keys.go
new file mode 100644
index 00000000..df4ebdad
--- /dev/null
+++ b/vendor/golang.org/x/crypto/ssh/keys.go
@@ -0,0 +1,1728 @@
+// Copyright 2012 The Go Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style
+// license that can be found in the LICENSE file.
+
+package ssh
+
+import (
+ "bytes"
+ "crypto"
+ "crypto/aes"
+ "crypto/cipher"
+ "crypto/dsa"
+ "crypto/ecdsa"
+ "crypto/ed25519"
+ "crypto/elliptic"
+ "crypto/md5"
+ "crypto/rand"
+ "crypto/rsa"
+ "crypto/sha256"
+ "crypto/x509"
+ "encoding/asn1"
+ "encoding/base64"
+ "encoding/binary"
+ "encoding/hex"
+ "encoding/pem"
+ "errors"
+ "fmt"
+ "io"
+ "math/big"
+ "strings"
+
+ "golang.org/x/crypto/ssh/internal/bcrypt_pbkdf"
+)
+
+// Public key algorithms names. These values can appear in PublicKey.Type,
+// ClientConfig.HostKeyAlgorithms, Signature.Format, or as AlgorithmSigner
+// arguments.
+const (
+ KeyAlgoRSA = "ssh-rsa"
+ KeyAlgoDSA = "ssh-dss"
+ KeyAlgoECDSA256 = "ecdsa-sha2-nistp256"
+ KeyAlgoSKECDSA256 = "sk-ecdsa-sha2-nistp256@openssh.com"
+ KeyAlgoECDSA384 = "ecdsa-sha2-nistp384"
+ KeyAlgoECDSA521 = "ecdsa-sha2-nistp521"
+ KeyAlgoED25519 = "ssh-ed25519"
+ KeyAlgoSKED25519 = "sk-ssh-ed25519@openssh.com"
+
+ // KeyAlgoRSASHA256 and KeyAlgoRSASHA512 are only public key algorithms, not
+ // public key formats, so they can't appear as a PublicKey.Type. The
+ // corresponding PublicKey.Type is KeyAlgoRSA. See RFC 8332, Section 2.
+ KeyAlgoRSASHA256 = "rsa-sha2-256"
+ KeyAlgoRSASHA512 = "rsa-sha2-512"
+)
+
+const (
+ // Deprecated: use KeyAlgoRSA.
+ SigAlgoRSA = KeyAlgoRSA
+ // Deprecated: use KeyAlgoRSASHA256.
+ SigAlgoRSASHA2256 = KeyAlgoRSASHA256
+ // Deprecated: use KeyAlgoRSASHA512.
+ SigAlgoRSASHA2512 = KeyAlgoRSASHA512
+)
+
+// parsePubKey parses a public key of the given algorithm.
+// Use ParsePublicKey for keys with prepended algorithm.
+func parsePubKey(in []byte, algo string) (pubKey PublicKey, rest []byte, err error) {
+ switch algo {
+ case KeyAlgoRSA:
+ return parseRSA(in)
+ case KeyAlgoDSA:
+ return parseDSA(in)
+ case KeyAlgoECDSA256, KeyAlgoECDSA384, KeyAlgoECDSA521:
+ return parseECDSA(in)
+ case KeyAlgoSKECDSA256:
+ return parseSKECDSA(in)
+ case KeyAlgoED25519:
+ return parseED25519(in)
+ case KeyAlgoSKED25519:
+ return parseSKEd25519(in)
+ case CertAlgoRSAv01, CertAlgoDSAv01, CertAlgoECDSA256v01, CertAlgoECDSA384v01, CertAlgoECDSA521v01, CertAlgoSKECDSA256v01, CertAlgoED25519v01, CertAlgoSKED25519v01:
+ cert, err := parseCert(in, certKeyAlgoNames[algo])
+ if err != nil {
+ return nil, nil, err
+ }
+ return cert, nil, nil
+ }
+ return nil, nil, fmt.Errorf("ssh: unknown key algorithm: %v", algo)
+}
+
+// parseAuthorizedKey parses a public key in OpenSSH authorized_keys format
+// (see sshd(8) manual page) once the options and key type fields have been
+// removed.
+func parseAuthorizedKey(in []byte) (out PublicKey, comment string, err error) {
+ in = bytes.TrimSpace(in)
+
+ i := bytes.IndexAny(in, " \t")
+ if i == -1 {
+ i = len(in)
+ }
+ base64Key := in[:i]
+
+ key := make([]byte, base64.StdEncoding.DecodedLen(len(base64Key)))
+ n, err := base64.StdEncoding.Decode(key, base64Key)
+ if err != nil {
+ return nil, "", err
+ }
+ key = key[:n]
+ out, err = ParsePublicKey(key)
+ if err != nil {
+ return nil, "", err
+ }
+ comment = string(bytes.TrimSpace(in[i:]))
+ return out, comment, nil
+}
+
+// ParseKnownHosts parses an entry in the format of the known_hosts file.
+//
+// The known_hosts format is documented in the sshd(8) manual page. This
+// function will parse a single entry from in. On successful return, marker
+// will contain the optional marker value (i.e. "cert-authority" or "revoked")
+// or else be empty, hosts will contain the hosts that this entry matches,
+// pubKey will contain the public key and comment will contain any trailing
+// comment at the end of the line. See the sshd(8) manual page for the various
+// forms that a host string can take.
+//
+// The unparsed remainder of the input will be returned in rest. This function
+// can be called repeatedly to parse multiple entries.
+//
+// If no entries were found in the input then err will be io.EOF. Otherwise a
+// non-nil err value indicates a parse error.
+func ParseKnownHosts(in []byte) (marker string, hosts []string, pubKey PublicKey, comment string, rest []byte, err error) {
+ for len(in) > 0 {
+ end := bytes.IndexByte(in, '\n')
+ if end != -1 {
+ rest = in[end+1:]
+ in = in[:end]
+ } else {
+ rest = nil
+ }
+
+ end = bytes.IndexByte(in, '\r')
+ if end != -1 {
+ in = in[:end]
+ }
+
+ in = bytes.TrimSpace(in)
+ if len(in) == 0 || in[0] == '#' {
+ in = rest
+ continue
+ }
+
+ i := bytes.IndexAny(in, " \t")
+ if i == -1 {
+ in = rest
+ continue
+ }
+
+ // Strip out the beginning of the known_host key.
+ // This is either an optional marker or a (set of) hostname(s).
+ keyFields := bytes.Fields(in)
+ if len(keyFields) < 3 || len(keyFields) > 5 {
+ return "", nil, nil, "", nil, errors.New("ssh: invalid entry in known_hosts data")
+ }
+
+ // keyFields[0] is either "@cert-authority", "@revoked" or a comma separated
+ // list of hosts
+ marker := ""
+ if keyFields[0][0] == '@' {
+ marker = string(keyFields[0][1:])
+ keyFields = keyFields[1:]
+ }
+
+ hosts := string(keyFields[0])
+ // keyFields[1] contains the key type (e.g. “ssh-rsa”).
+ // However, that information is duplicated inside the
+ // base64-encoded key and so is ignored here.
+
+ key := bytes.Join(keyFields[2:], []byte(" "))
+ if pubKey, comment, err = parseAuthorizedKey(key); err != nil {
+ return "", nil, nil, "", nil, err
+ }
+
+ return marker, strings.Split(hosts, ","), pubKey, comment, rest, nil
+ }
+
+ return "", nil, nil, "", nil, io.EOF
+}
+
+// ParseAuthorizedKey parses a public key from an authorized_keys
+// file used in OpenSSH according to the sshd(8) manual page.
+func ParseAuthorizedKey(in []byte) (out PublicKey, comment string, options []string, rest []byte, err error) {
+ for len(in) > 0 {
+ end := bytes.IndexByte(in, '\n')
+ if end != -1 {
+ rest = in[end+1:]
+ in = in[:end]
+ } else {
+ rest = nil
+ }
+
+ end = bytes.IndexByte(in, '\r')
+ if end != -1 {
+ in = in[:end]
+ }
+
+ in = bytes.TrimSpace(in)
+ if len(in) == 0 || in[0] == '#' {
+ in = rest
+ continue
+ }
+
+ i := bytes.IndexAny(in, " \t")
+ if i == -1 {
+ in = rest
+ continue
+ }
+
+ if out, comment, err = parseAuthorizedKey(in[i:]); err == nil {
+ return out, comment, options, rest, nil
+ }
+
+ // No key type recognised. Maybe there's an options field at
+ // the beginning.
+ var b byte
+ inQuote := false
+ var candidateOptions []string
+ optionStart := 0
+ for i, b = range in {
+ isEnd := !inQuote && (b == ' ' || b == '\t')
+ if (b == ',' && !inQuote) || isEnd {
+ if i-optionStart > 0 {
+ candidateOptions = append(candidateOptions, string(in[optionStart:i]))
+ }
+ optionStart = i + 1
+ }
+ if isEnd {
+ break
+ }
+ if b == '"' && (i == 0 || (i > 0 && in[i-1] != '\\')) {
+ inQuote = !inQuote
+ }
+ }
+ for i < len(in) && (in[i] == ' ' || in[i] == '\t') {
+ i++
+ }
+ if i == len(in) {
+ // Invalid line: unmatched quote
+ in = rest
+ continue
+ }
+
+ in = in[i:]
+ i = bytes.IndexAny(in, " \t")
+ if i == -1 {
+ in = rest
+ continue
+ }
+
+ if out, comment, err = parseAuthorizedKey(in[i:]); err == nil {
+ options = candidateOptions
+ return out, comment, options, rest, nil
+ }
+
+ in = rest
+ continue
+ }
+
+ return nil, "", nil, nil, errors.New("ssh: no key found")
+}
+
+// ParsePublicKey parses an SSH public key formatted for use in
+// the SSH wire protocol according to RFC 4253, section 6.6.
+func ParsePublicKey(in []byte) (out PublicKey, err error) {
+ algo, in, ok := parseString(in)
+ if !ok {
+ return nil, errShortRead
+ }
+ var rest []byte
+ out, rest, err = parsePubKey(in, string(algo))
+ if len(rest) > 0 {
+ return nil, errors.New("ssh: trailing junk in public key")
+ }
+
+ return out, err
+}
+
+// MarshalAuthorizedKey serializes key for inclusion in an OpenSSH
+// authorized_keys file. The return value ends with newline.
+func MarshalAuthorizedKey(key PublicKey) []byte {
+ b := &bytes.Buffer{}
+ b.WriteString(key.Type())
+ b.WriteByte(' ')
+ e := base64.NewEncoder(base64.StdEncoding, b)
+ e.Write(key.Marshal())
+ e.Close()
+ b.WriteByte('\n')
+ return b.Bytes()
+}
+
+// MarshalPrivateKey returns a PEM block with the private key serialized in the
+// OpenSSH format.
+func MarshalPrivateKey(key crypto.PrivateKey, comment string) (*pem.Block, error) {
+ return marshalOpenSSHPrivateKey(key, comment, unencryptedOpenSSHMarshaler)
+}
+
+// MarshalPrivateKeyWithPassphrase returns a PEM block holding the encrypted
+// private key serialized in the OpenSSH format.
+func MarshalPrivateKeyWithPassphrase(key crypto.PrivateKey, comment string, passphrase []byte) (*pem.Block, error) {
+ return marshalOpenSSHPrivateKey(key, comment, passphraseProtectedOpenSSHMarshaler(passphrase))
+}
+
+// PublicKey represents a public key using an unspecified algorithm.
+//
+// Some PublicKeys provided by this package also implement CryptoPublicKey.
+type PublicKey interface {
+ // Type returns the key format name, e.g. "ssh-rsa".
+ Type() string
+
+ // Marshal returns the serialized key data in SSH wire format, with the name
+ // prefix. To unmarshal the returned data, use the ParsePublicKey function.
+ Marshal() []byte
+
+ // Verify that sig is a signature on the given data using this key. This
+ // method will hash the data appropriately first. sig.Format is allowed to
+ // be any signature algorithm compatible with the key type, the caller
+ // should check if it has more stringent requirements.
+ Verify(data []byte, sig *Signature) error
+}
+
+// CryptoPublicKey, if implemented by a PublicKey,
+// returns the underlying crypto.PublicKey form of the key.
+type CryptoPublicKey interface {
+ CryptoPublicKey() crypto.PublicKey
+}
+
+// A Signer can create signatures that verify against a public key.
+//
+// Some Signers provided by this package also implement MultiAlgorithmSigner.
+type Signer interface {
+ // PublicKey returns the associated PublicKey.
+ PublicKey() PublicKey
+
+ // Sign returns a signature for the given data. This method will hash the
+ // data appropriately first. The signature algorithm is expected to match
+ // the key format returned by the PublicKey.Type method (and not to be any
+ // alternative algorithm supported by the key format).
+ Sign(rand io.Reader, data []byte) (*Signature, error)
+}
+
+// An AlgorithmSigner is a Signer that also supports specifying an algorithm to
+// use for signing.
+//
+// An AlgorithmSigner can't advertise the algorithms it supports, unless it also
+// implements MultiAlgorithmSigner, so it should be prepared to be invoked with
+// every algorithm supported by the public key format.
+type AlgorithmSigner interface {
+ Signer
+
+ // SignWithAlgorithm is like Signer.Sign, but allows specifying a desired
+ // signing algorithm. Callers may pass an empty string for the algorithm in
+ // which case the AlgorithmSigner will use a default algorithm. This default
+ // doesn't currently control any behavior in this package.
+ SignWithAlgorithm(rand io.Reader, data []byte, algorithm string) (*Signature, error)
+}
+
+// MultiAlgorithmSigner is an AlgorithmSigner that also reports the algorithms
+// supported by that signer.
+type MultiAlgorithmSigner interface {
+ AlgorithmSigner
+
+ // Algorithms returns the available algorithms in preference order. The list
+ // must not be empty, and it must not include certificate types.
+ Algorithms() []string
+}
+
+// NewSignerWithAlgorithms returns a signer restricted to the specified
+// algorithms. The algorithms must be set in preference order. The list must not
+// be empty, and it must not include certificate types. An error is returned if
+// the specified algorithms are incompatible with the public key type.
+func NewSignerWithAlgorithms(signer AlgorithmSigner, algorithms []string) (MultiAlgorithmSigner, error) {
+ if len(algorithms) == 0 {
+ return nil, errors.New("ssh: please specify at least one valid signing algorithm")
+ }
+ var signerAlgos []string
+ supportedAlgos := algorithmsForKeyFormat(underlyingAlgo(signer.PublicKey().Type()))
+ if s, ok := signer.(*multiAlgorithmSigner); ok {
+ signerAlgos = s.Algorithms()
+ } else {
+ signerAlgos = supportedAlgos
+ }
+
+ for _, algo := range algorithms {
+ if !contains(supportedAlgos, algo) {
+ return nil, fmt.Errorf("ssh: algorithm %q is not supported for key type %q",
+ algo, signer.PublicKey().Type())
+ }
+ if !contains(signerAlgos, algo) {
+ return nil, fmt.Errorf("ssh: algorithm %q is restricted for the provided signer", algo)
+ }
+ }
+ return &multiAlgorithmSigner{
+ AlgorithmSigner: signer,
+ supportedAlgorithms: algorithms,
+ }, nil
+}
+
+type multiAlgorithmSigner struct {
+ AlgorithmSigner
+ supportedAlgorithms []string
+}
+
+func (s *multiAlgorithmSigner) Algorithms() []string {
+ return s.supportedAlgorithms
+}
+
+func (s *multiAlgorithmSigner) isAlgorithmSupported(algorithm string) bool {
+ if algorithm == "" {
+ algorithm = underlyingAlgo(s.PublicKey().Type())
+ }
+ for _, algo := range s.supportedAlgorithms {
+ if algorithm == algo {
+ return true
+ }
+ }
+ return false
+}
+
+func (s *multiAlgorithmSigner) SignWithAlgorithm(rand io.Reader, data []byte, algorithm string) (*Signature, error) {
+ if !s.isAlgorithmSupported(algorithm) {
+ return nil, fmt.Errorf("ssh: algorithm %q is not supported: %v", algorithm, s.supportedAlgorithms)
+ }
+ return s.AlgorithmSigner.SignWithAlgorithm(rand, data, algorithm)
+}
+
+type rsaPublicKey rsa.PublicKey
+
+func (r *rsaPublicKey) Type() string {
+ return "ssh-rsa"
+}
+
+// parseRSA parses an RSA key according to RFC 4253, section 6.6.
+func parseRSA(in []byte) (out PublicKey, rest []byte, err error) {
+ var w struct {
+ E *big.Int
+ N *big.Int
+ Rest []byte `ssh:"rest"`
+ }
+ if err := Unmarshal(in, &w); err != nil {
+ return nil, nil, err
+ }
+
+ if w.E.BitLen() > 24 {
+ return nil, nil, errors.New("ssh: exponent too large")
+ }
+ e := w.E.Int64()
+ if e < 3 || e&1 == 0 {
+ return nil, nil, errors.New("ssh: incorrect exponent")
+ }
+
+ var key rsa.PublicKey
+ key.E = int(e)
+ key.N = w.N
+ return (*rsaPublicKey)(&key), w.Rest, nil
+}
+
+func (r *rsaPublicKey) Marshal() []byte {
+ e := new(big.Int).SetInt64(int64(r.E))
+ // RSA publickey struct layout should match the struct used by
+ // parseRSACert in the x/crypto/ssh/agent package.
+ wirekey := struct {
+ Name string
+ E *big.Int
+ N *big.Int
+ }{
+ KeyAlgoRSA,
+ e,
+ r.N,
+ }
+ return Marshal(&wirekey)
+}
+
+func (r *rsaPublicKey) Verify(data []byte, sig *Signature) error {
+ supportedAlgos := algorithmsForKeyFormat(r.Type())
+ if !contains(supportedAlgos, sig.Format) {
+ return fmt.Errorf("ssh: signature type %s for key type %s", sig.Format, r.Type())
+ }
+ hash := hashFuncs[sig.Format]
+ h := hash.New()
+ h.Write(data)
+ digest := h.Sum(nil)
+ return rsa.VerifyPKCS1v15((*rsa.PublicKey)(r), hash, digest, sig.Blob)
+}
+
+func (r *rsaPublicKey) CryptoPublicKey() crypto.PublicKey {
+ return (*rsa.PublicKey)(r)
+}
+
+type dsaPublicKey dsa.PublicKey
+
+func (k *dsaPublicKey) Type() string {
+ return "ssh-dss"
+}
+
+func checkDSAParams(param *dsa.Parameters) error {
+ // SSH specifies FIPS 186-2, which only provided a single size
+ // (1024 bits) DSA key. FIPS 186-3 allows for larger key
+ // sizes, which would confuse SSH.
+ if l := param.P.BitLen(); l != 1024 {
+ return fmt.Errorf("ssh: unsupported DSA key size %d", l)
+ }
+
+ return nil
+}
+
+// parseDSA parses an DSA key according to RFC 4253, section 6.6.
+func parseDSA(in []byte) (out PublicKey, rest []byte, err error) {
+ var w struct {
+ P, Q, G, Y *big.Int
+ Rest []byte `ssh:"rest"`
+ }
+ if err := Unmarshal(in, &w); err != nil {
+ return nil, nil, err
+ }
+
+ param := dsa.Parameters{
+ P: w.P,
+ Q: w.Q,
+ G: w.G,
+ }
+ if err := checkDSAParams(¶m); err != nil {
+ return nil, nil, err
+ }
+
+ key := &dsaPublicKey{
+ Parameters: param,
+ Y: w.Y,
+ }
+ return key, w.Rest, nil
+}
+
+func (k *dsaPublicKey) Marshal() []byte {
+ // DSA publickey struct layout should match the struct used by
+ // parseDSACert in the x/crypto/ssh/agent package.
+ w := struct {
+ Name string
+ P, Q, G, Y *big.Int
+ }{
+ k.Type(),
+ k.P,
+ k.Q,
+ k.G,
+ k.Y,
+ }
+
+ return Marshal(&w)
+}
+
+func (k *dsaPublicKey) Verify(data []byte, sig *Signature) error {
+ if sig.Format != k.Type() {
+ return fmt.Errorf("ssh: signature type %s for key type %s", sig.Format, k.Type())
+ }
+ h := hashFuncs[sig.Format].New()
+ h.Write(data)
+ digest := h.Sum(nil)
+
+ // Per RFC 4253, section 6.6,
+ // The value for 'dss_signature_blob' is encoded as a string containing
+ // r, followed by s (which are 160-bit integers, without lengths or
+ // padding, unsigned, and in network byte order).
+ // For DSS purposes, sig.Blob should be exactly 40 bytes in length.
+ if len(sig.Blob) != 40 {
+ return errors.New("ssh: DSA signature parse error")
+ }
+ r := new(big.Int).SetBytes(sig.Blob[:20])
+ s := new(big.Int).SetBytes(sig.Blob[20:])
+ if dsa.Verify((*dsa.PublicKey)(k), digest, r, s) {
+ return nil
+ }
+ return errors.New("ssh: signature did not verify")
+}
+
+func (k *dsaPublicKey) CryptoPublicKey() crypto.PublicKey {
+ return (*dsa.PublicKey)(k)
+}
+
+type dsaPrivateKey struct {
+ *dsa.PrivateKey
+}
+
+func (k *dsaPrivateKey) PublicKey() PublicKey {
+ return (*dsaPublicKey)(&k.PrivateKey.PublicKey)
+}
+
+func (k *dsaPrivateKey) Sign(rand io.Reader, data []byte) (*Signature, error) {
+ return k.SignWithAlgorithm(rand, data, k.PublicKey().Type())
+}
+
+func (k *dsaPrivateKey) Algorithms() []string {
+ return []string{k.PublicKey().Type()}
+}
+
+func (k *dsaPrivateKey) SignWithAlgorithm(rand io.Reader, data []byte, algorithm string) (*Signature, error) {
+ if algorithm != "" && algorithm != k.PublicKey().Type() {
+ return nil, fmt.Errorf("ssh: unsupported signature algorithm %s", algorithm)
+ }
+
+ h := hashFuncs[k.PublicKey().Type()].New()
+ h.Write(data)
+ digest := h.Sum(nil)
+ r, s, err := dsa.Sign(rand, k.PrivateKey, digest)
+ if err != nil {
+ return nil, err
+ }
+
+ sig := make([]byte, 40)
+ rb := r.Bytes()
+ sb := s.Bytes()
+
+ copy(sig[20-len(rb):20], rb)
+ copy(sig[40-len(sb):], sb)
+
+ return &Signature{
+ Format: k.PublicKey().Type(),
+ Blob: sig,
+ }, nil
+}
+
+type ecdsaPublicKey ecdsa.PublicKey
+
+func (k *ecdsaPublicKey) Type() string {
+ return "ecdsa-sha2-" + k.nistID()
+}
+
+func (k *ecdsaPublicKey) nistID() string {
+ switch k.Params().BitSize {
+ case 256:
+ return "nistp256"
+ case 384:
+ return "nistp384"
+ case 521:
+ return "nistp521"
+ }
+ panic("ssh: unsupported ecdsa key size")
+}
+
+type ed25519PublicKey ed25519.PublicKey
+
+func (k ed25519PublicKey) Type() string {
+ return KeyAlgoED25519
+}
+
+func parseED25519(in []byte) (out PublicKey, rest []byte, err error) {
+ var w struct {
+ KeyBytes []byte
+ Rest []byte `ssh:"rest"`
+ }
+
+ if err := Unmarshal(in, &w); err != nil {
+ return nil, nil, err
+ }
+
+ if l := len(w.KeyBytes); l != ed25519.PublicKeySize {
+ return nil, nil, fmt.Errorf("invalid size %d for Ed25519 public key", l)
+ }
+
+ return ed25519PublicKey(w.KeyBytes), w.Rest, nil
+}
+
+func (k ed25519PublicKey) Marshal() []byte {
+ w := struct {
+ Name string
+ KeyBytes []byte
+ }{
+ KeyAlgoED25519,
+ []byte(k),
+ }
+ return Marshal(&w)
+}
+
+func (k ed25519PublicKey) Verify(b []byte, sig *Signature) error {
+ if sig.Format != k.Type() {
+ return fmt.Errorf("ssh: signature type %s for key type %s", sig.Format, k.Type())
+ }
+ if l := len(k); l != ed25519.PublicKeySize {
+ return fmt.Errorf("ssh: invalid size %d for Ed25519 public key", l)
+ }
+
+ if ok := ed25519.Verify(ed25519.PublicKey(k), b, sig.Blob); !ok {
+ return errors.New("ssh: signature did not verify")
+ }
+
+ return nil
+}
+
+func (k ed25519PublicKey) CryptoPublicKey() crypto.PublicKey {
+ return ed25519.PublicKey(k)
+}
+
+func supportedEllipticCurve(curve elliptic.Curve) bool {
+ return curve == elliptic.P256() || curve == elliptic.P384() || curve == elliptic.P521()
+}
+
+// parseECDSA parses an ECDSA key according to RFC 5656, section 3.1.
+func parseECDSA(in []byte) (out PublicKey, rest []byte, err error) {
+ var w struct {
+ Curve string
+ KeyBytes []byte
+ Rest []byte `ssh:"rest"`
+ }
+
+ if err := Unmarshal(in, &w); err != nil {
+ return nil, nil, err
+ }
+
+ key := new(ecdsa.PublicKey)
+
+ switch w.Curve {
+ case "nistp256":
+ key.Curve = elliptic.P256()
+ case "nistp384":
+ key.Curve = elliptic.P384()
+ case "nistp521":
+ key.Curve = elliptic.P521()
+ default:
+ return nil, nil, errors.New("ssh: unsupported curve")
+ }
+
+ key.X, key.Y = elliptic.Unmarshal(key.Curve, w.KeyBytes)
+ if key.X == nil || key.Y == nil {
+ return nil, nil, errors.New("ssh: invalid curve point")
+ }
+ return (*ecdsaPublicKey)(key), w.Rest, nil
+}
+
+func (k *ecdsaPublicKey) Marshal() []byte {
+ // See RFC 5656, section 3.1.
+ keyBytes := elliptic.Marshal(k.Curve, k.X, k.Y)
+ // ECDSA publickey struct layout should match the struct used by
+ // parseECDSACert in the x/crypto/ssh/agent package.
+ w := struct {
+ Name string
+ ID string
+ Key []byte
+ }{
+ k.Type(),
+ k.nistID(),
+ keyBytes,
+ }
+
+ return Marshal(&w)
+}
+
+func (k *ecdsaPublicKey) Verify(data []byte, sig *Signature) error {
+ if sig.Format != k.Type() {
+ return fmt.Errorf("ssh: signature type %s for key type %s", sig.Format, k.Type())
+ }
+
+ h := hashFuncs[sig.Format].New()
+ h.Write(data)
+ digest := h.Sum(nil)
+
+ // Per RFC 5656, section 3.1.2,
+ // The ecdsa_signature_blob value has the following specific encoding:
+ // mpint r
+ // mpint s
+ var ecSig struct {
+ R *big.Int
+ S *big.Int
+ }
+
+ if err := Unmarshal(sig.Blob, &ecSig); err != nil {
+ return err
+ }
+
+ if ecdsa.Verify((*ecdsa.PublicKey)(k), digest, ecSig.R, ecSig.S) {
+ return nil
+ }
+ return errors.New("ssh: signature did not verify")
+}
+
+func (k *ecdsaPublicKey) CryptoPublicKey() crypto.PublicKey {
+ return (*ecdsa.PublicKey)(k)
+}
+
+// skFields holds the additional fields present in U2F/FIDO2 signatures.
+// See openssh/PROTOCOL.u2f 'SSH U2F Signatures' for details.
+type skFields struct {
+ // Flags contains U2F/FIDO2 flags such as 'user present'
+ Flags byte
+ // Counter is a monotonic signature counter which can be
+ // used to detect concurrent use of a private key, should
+ // it be extracted from hardware.
+ Counter uint32
+}
+
+type skECDSAPublicKey struct {
+ // application is a URL-like string, typically "ssh:" for SSH.
+ // see openssh/PROTOCOL.u2f for details.
+ application string
+ ecdsa.PublicKey
+}
+
+func (k *skECDSAPublicKey) Type() string {
+ return KeyAlgoSKECDSA256
+}
+
+func (k *skECDSAPublicKey) nistID() string {
+ return "nistp256"
+}
+
+func parseSKECDSA(in []byte) (out PublicKey, rest []byte, err error) {
+ var w struct {
+ Curve string
+ KeyBytes []byte
+ Application string
+ Rest []byte `ssh:"rest"`
+ }
+
+ if err := Unmarshal(in, &w); err != nil {
+ return nil, nil, err
+ }
+
+ key := new(skECDSAPublicKey)
+ key.application = w.Application
+
+ if w.Curve != "nistp256" {
+ return nil, nil, errors.New("ssh: unsupported curve")
+ }
+ key.Curve = elliptic.P256()
+
+ key.X, key.Y = elliptic.Unmarshal(key.Curve, w.KeyBytes)
+ if key.X == nil || key.Y == nil {
+ return nil, nil, errors.New("ssh: invalid curve point")
+ }
+
+ return key, w.Rest, nil
+}
+
+func (k *skECDSAPublicKey) Marshal() []byte {
+ // See RFC 5656, section 3.1.
+ keyBytes := elliptic.Marshal(k.Curve, k.X, k.Y)
+ w := struct {
+ Name string
+ ID string
+ Key []byte
+ Application string
+ }{
+ k.Type(),
+ k.nistID(),
+ keyBytes,
+ k.application,
+ }
+
+ return Marshal(&w)
+}
+
+func (k *skECDSAPublicKey) Verify(data []byte, sig *Signature) error {
+ if sig.Format != k.Type() {
+ return fmt.Errorf("ssh: signature type %s for key type %s", sig.Format, k.Type())
+ }
+
+ h := hashFuncs[sig.Format].New()
+ h.Write([]byte(k.application))
+ appDigest := h.Sum(nil)
+
+ h.Reset()
+ h.Write(data)
+ dataDigest := h.Sum(nil)
+
+ var ecSig struct {
+ R *big.Int
+ S *big.Int
+ }
+ if err := Unmarshal(sig.Blob, &ecSig); err != nil {
+ return err
+ }
+
+ var skf skFields
+ if err := Unmarshal(sig.Rest, &skf); err != nil {
+ return err
+ }
+
+ blob := struct {
+ ApplicationDigest []byte `ssh:"rest"`
+ Flags byte
+ Counter uint32
+ MessageDigest []byte `ssh:"rest"`
+ }{
+ appDigest,
+ skf.Flags,
+ skf.Counter,
+ dataDigest,
+ }
+
+ original := Marshal(blob)
+
+ h.Reset()
+ h.Write(original)
+ digest := h.Sum(nil)
+
+ if ecdsa.Verify((*ecdsa.PublicKey)(&k.PublicKey), digest, ecSig.R, ecSig.S) {
+ return nil
+ }
+ return errors.New("ssh: signature did not verify")
+}
+
+type skEd25519PublicKey struct {
+ // application is a URL-like string, typically "ssh:" for SSH.
+ // see openssh/PROTOCOL.u2f for details.
+ application string
+ ed25519.PublicKey
+}
+
+func (k *skEd25519PublicKey) Type() string {
+ return KeyAlgoSKED25519
+}
+
+func parseSKEd25519(in []byte) (out PublicKey, rest []byte, err error) {
+ var w struct {
+ KeyBytes []byte
+ Application string
+ Rest []byte `ssh:"rest"`
+ }
+
+ if err := Unmarshal(in, &w); err != nil {
+ return nil, nil, err
+ }
+
+ if l := len(w.KeyBytes); l != ed25519.PublicKeySize {
+ return nil, nil, fmt.Errorf("invalid size %d for Ed25519 public key", l)
+ }
+
+ key := new(skEd25519PublicKey)
+ key.application = w.Application
+ key.PublicKey = ed25519.PublicKey(w.KeyBytes)
+
+ return key, w.Rest, nil
+}
+
+func (k *skEd25519PublicKey) Marshal() []byte {
+ w := struct {
+ Name string
+ KeyBytes []byte
+ Application string
+ }{
+ KeyAlgoSKED25519,
+ []byte(k.PublicKey),
+ k.application,
+ }
+ return Marshal(&w)
+}
+
+func (k *skEd25519PublicKey) Verify(data []byte, sig *Signature) error {
+ if sig.Format != k.Type() {
+ return fmt.Errorf("ssh: signature type %s for key type %s", sig.Format, k.Type())
+ }
+ if l := len(k.PublicKey); l != ed25519.PublicKeySize {
+ return fmt.Errorf("invalid size %d for Ed25519 public key", l)
+ }
+
+ h := hashFuncs[sig.Format].New()
+ h.Write([]byte(k.application))
+ appDigest := h.Sum(nil)
+
+ h.Reset()
+ h.Write(data)
+ dataDigest := h.Sum(nil)
+
+ var edSig struct {
+ Signature []byte `ssh:"rest"`
+ }
+
+ if err := Unmarshal(sig.Blob, &edSig); err != nil {
+ return err
+ }
+
+ var skf skFields
+ if err := Unmarshal(sig.Rest, &skf); err != nil {
+ return err
+ }
+
+ blob := struct {
+ ApplicationDigest []byte `ssh:"rest"`
+ Flags byte
+ Counter uint32
+ MessageDigest []byte `ssh:"rest"`
+ }{
+ appDigest,
+ skf.Flags,
+ skf.Counter,
+ dataDigest,
+ }
+
+ original := Marshal(blob)
+
+ if ok := ed25519.Verify(k.PublicKey, original, edSig.Signature); !ok {
+ return errors.New("ssh: signature did not verify")
+ }
+
+ return nil
+}
+
+// NewSignerFromKey takes an *rsa.PrivateKey, *dsa.PrivateKey,
+// *ecdsa.PrivateKey or any other crypto.Signer and returns a
+// corresponding Signer instance. ECDSA keys must use P-256, P-384 or
+// P-521. DSA keys must use parameter size L1024N160.
+func NewSignerFromKey(key interface{}) (Signer, error) {
+ switch key := key.(type) {
+ case crypto.Signer:
+ return NewSignerFromSigner(key)
+ case *dsa.PrivateKey:
+ return newDSAPrivateKey(key)
+ default:
+ return nil, fmt.Errorf("ssh: unsupported key type %T", key)
+ }
+}
+
+func newDSAPrivateKey(key *dsa.PrivateKey) (Signer, error) {
+ if err := checkDSAParams(&key.PublicKey.Parameters); err != nil {
+ return nil, err
+ }
+
+ return &dsaPrivateKey{key}, nil
+}
+
+type wrappedSigner struct {
+ signer crypto.Signer
+ pubKey PublicKey
+}
+
+// NewSignerFromSigner takes any crypto.Signer implementation and
+// returns a corresponding Signer interface. This can be used, for
+// example, with keys kept in hardware modules.
+func NewSignerFromSigner(signer crypto.Signer) (Signer, error) {
+ pubKey, err := NewPublicKey(signer.Public())
+ if err != nil {
+ return nil, err
+ }
+
+ return &wrappedSigner{signer, pubKey}, nil
+}
+
+func (s *wrappedSigner) PublicKey() PublicKey {
+ return s.pubKey
+}
+
+func (s *wrappedSigner) Sign(rand io.Reader, data []byte) (*Signature, error) {
+ return s.SignWithAlgorithm(rand, data, s.pubKey.Type())
+}
+
+func (s *wrappedSigner) Algorithms() []string {
+ return algorithmsForKeyFormat(s.pubKey.Type())
+}
+
+func (s *wrappedSigner) SignWithAlgorithm(rand io.Reader, data []byte, algorithm string) (*Signature, error) {
+ if algorithm == "" {
+ algorithm = s.pubKey.Type()
+ }
+
+ if !contains(s.Algorithms(), algorithm) {
+ return nil, fmt.Errorf("ssh: unsupported signature algorithm %q for key format %q", algorithm, s.pubKey.Type())
+ }
+
+ hashFunc := hashFuncs[algorithm]
+ var digest []byte
+ if hashFunc != 0 {
+ h := hashFunc.New()
+ h.Write(data)
+ digest = h.Sum(nil)
+ } else {
+ digest = data
+ }
+
+ signature, err := s.signer.Sign(rand, digest, hashFunc)
+ if err != nil {
+ return nil, err
+ }
+
+ // crypto.Signer.Sign is expected to return an ASN.1-encoded signature
+ // for ECDSA and DSA, but that's not the encoding expected by SSH, so
+ // re-encode.
+ switch s.pubKey.(type) {
+ case *ecdsaPublicKey, *dsaPublicKey:
+ type asn1Signature struct {
+ R, S *big.Int
+ }
+ asn1Sig := new(asn1Signature)
+ _, err := asn1.Unmarshal(signature, asn1Sig)
+ if err != nil {
+ return nil, err
+ }
+
+ switch s.pubKey.(type) {
+ case *ecdsaPublicKey:
+ signature = Marshal(asn1Sig)
+
+ case *dsaPublicKey:
+ signature = make([]byte, 40)
+ r := asn1Sig.R.Bytes()
+ s := asn1Sig.S.Bytes()
+ copy(signature[20-len(r):20], r)
+ copy(signature[40-len(s):40], s)
+ }
+ }
+
+ return &Signature{
+ Format: algorithm,
+ Blob: signature,
+ }, nil
+}
+
+// NewPublicKey takes an *rsa.PublicKey, *dsa.PublicKey, *ecdsa.PublicKey,
+// or ed25519.PublicKey returns a corresponding PublicKey instance.
+// ECDSA keys must use P-256, P-384 or P-521.
+func NewPublicKey(key interface{}) (PublicKey, error) {
+ switch key := key.(type) {
+ case *rsa.PublicKey:
+ return (*rsaPublicKey)(key), nil
+ case *ecdsa.PublicKey:
+ if !supportedEllipticCurve(key.Curve) {
+ return nil, errors.New("ssh: only P-256, P-384 and P-521 EC keys are supported")
+ }
+ return (*ecdsaPublicKey)(key), nil
+ case *dsa.PublicKey:
+ return (*dsaPublicKey)(key), nil
+ case ed25519.PublicKey:
+ if l := len(key); l != ed25519.PublicKeySize {
+ return nil, fmt.Errorf("ssh: invalid size %d for Ed25519 public key", l)
+ }
+ return ed25519PublicKey(key), nil
+ default:
+ return nil, fmt.Errorf("ssh: unsupported key type %T", key)
+ }
+}
+
+// ParsePrivateKey returns a Signer from a PEM encoded private key. It supports
+// the same keys as ParseRawPrivateKey. If the private key is encrypted, it
+// will return a PassphraseMissingError.
+func ParsePrivateKey(pemBytes []byte) (Signer, error) {
+ key, err := ParseRawPrivateKey(pemBytes)
+ if err != nil {
+ return nil, err
+ }
+
+ return NewSignerFromKey(key)
+}
+
+// ParsePrivateKeyWithPassphrase returns a Signer from a PEM encoded private
+// key and passphrase. It supports the same keys as
+// ParseRawPrivateKeyWithPassphrase.
+func ParsePrivateKeyWithPassphrase(pemBytes, passphrase []byte) (Signer, error) {
+ key, err := ParseRawPrivateKeyWithPassphrase(pemBytes, passphrase)
+ if err != nil {
+ return nil, err
+ }
+
+ return NewSignerFromKey(key)
+}
+
+// encryptedBlock tells whether a private key is
+// encrypted by examining its Proc-Type header
+// for a mention of ENCRYPTED
+// according to RFC 1421 Section 4.6.1.1.
+func encryptedBlock(block *pem.Block) bool {
+ return strings.Contains(block.Headers["Proc-Type"], "ENCRYPTED")
+}
+
+// A PassphraseMissingError indicates that parsing this private key requires a
+// passphrase. Use ParsePrivateKeyWithPassphrase.
+type PassphraseMissingError struct {
+ // PublicKey will be set if the private key format includes an unencrypted
+ // public key along with the encrypted private key.
+ PublicKey PublicKey
+}
+
+func (*PassphraseMissingError) Error() string {
+ return "ssh: this private key is passphrase protected"
+}
+
+// ParseRawPrivateKey returns a private key from a PEM encoded private key. It supports
+// RSA, DSA, ECDSA, and Ed25519 private keys in PKCS#1, PKCS#8, OpenSSL, and OpenSSH
+// formats. If the private key is encrypted, it will return a PassphraseMissingError.
+func ParseRawPrivateKey(pemBytes []byte) (interface{}, error) {
+ block, _ := pem.Decode(pemBytes)
+ if block == nil {
+ return nil, errors.New("ssh: no key found")
+ }
+
+ if encryptedBlock(block) {
+ return nil, &PassphraseMissingError{}
+ }
+
+ switch block.Type {
+ case "RSA PRIVATE KEY":
+ return x509.ParsePKCS1PrivateKey(block.Bytes)
+ // RFC5208 - https://tools.ietf.org/html/rfc5208
+ case "PRIVATE KEY":
+ return x509.ParsePKCS8PrivateKey(block.Bytes)
+ case "EC PRIVATE KEY":
+ return x509.ParseECPrivateKey(block.Bytes)
+ case "DSA PRIVATE KEY":
+ return ParseDSAPrivateKey(block.Bytes)
+ case "OPENSSH PRIVATE KEY":
+ return parseOpenSSHPrivateKey(block.Bytes, unencryptedOpenSSHKey)
+ default:
+ return nil, fmt.Errorf("ssh: unsupported key type %q", block.Type)
+ }
+}
+
+// ParseRawPrivateKeyWithPassphrase returns a private key decrypted with
+// passphrase from a PEM encoded private key. If the passphrase is wrong, it
+// will return x509.IncorrectPasswordError.
+func ParseRawPrivateKeyWithPassphrase(pemBytes, passphrase []byte) (interface{}, error) {
+ block, _ := pem.Decode(pemBytes)
+ if block == nil {
+ return nil, errors.New("ssh: no key found")
+ }
+
+ if block.Type == "OPENSSH PRIVATE KEY" {
+ return parseOpenSSHPrivateKey(block.Bytes, passphraseProtectedOpenSSHKey(passphrase))
+ }
+
+ if !encryptedBlock(block) || !x509.IsEncryptedPEMBlock(block) {
+ return nil, errors.New("ssh: not an encrypted key")
+ }
+
+ buf, err := x509.DecryptPEMBlock(block, passphrase)
+ if err != nil {
+ if err == x509.IncorrectPasswordError {
+ return nil, err
+ }
+ return nil, fmt.Errorf("ssh: cannot decode encrypted private keys: %v", err)
+ }
+
+ var result interface{}
+
+ switch block.Type {
+ case "RSA PRIVATE KEY":
+ result, err = x509.ParsePKCS1PrivateKey(buf)
+ case "EC PRIVATE KEY":
+ result, err = x509.ParseECPrivateKey(buf)
+ case "DSA PRIVATE KEY":
+ result, err = ParseDSAPrivateKey(buf)
+ default:
+ err = fmt.Errorf("ssh: unsupported key type %q", block.Type)
+ }
+ // Because of deficiencies in the format, DecryptPEMBlock does not always
+ // detect an incorrect password. In these cases decrypted DER bytes is
+ // random noise. If the parsing of the key returns an asn1.StructuralError
+ // we return x509.IncorrectPasswordError.
+ if _, ok := err.(asn1.StructuralError); ok {
+ return nil, x509.IncorrectPasswordError
+ }
+
+ return result, err
+}
+
+// ParseDSAPrivateKey returns a DSA private key from its ASN.1 DER encoding, as
+// specified by the OpenSSL DSA man page.
+func ParseDSAPrivateKey(der []byte) (*dsa.PrivateKey, error) {
+ var k struct {
+ Version int
+ P *big.Int
+ Q *big.Int
+ G *big.Int
+ Pub *big.Int
+ Priv *big.Int
+ }
+ rest, err := asn1.Unmarshal(der, &k)
+ if err != nil {
+ return nil, errors.New("ssh: failed to parse DSA key: " + err.Error())
+ }
+ if len(rest) > 0 {
+ return nil, errors.New("ssh: garbage after DSA key")
+ }
+
+ return &dsa.PrivateKey{
+ PublicKey: dsa.PublicKey{
+ Parameters: dsa.Parameters{
+ P: k.P,
+ Q: k.Q,
+ G: k.G,
+ },
+ Y: k.Pub,
+ },
+ X: k.Priv,
+ }, nil
+}
+
+func unencryptedOpenSSHKey(cipherName, kdfName, kdfOpts string, privKeyBlock []byte) ([]byte, error) {
+ if kdfName != "none" || cipherName != "none" {
+ return nil, &PassphraseMissingError{}
+ }
+ if kdfOpts != "" {
+ return nil, errors.New("ssh: invalid openssh private key")
+ }
+ return privKeyBlock, nil
+}
+
+func passphraseProtectedOpenSSHKey(passphrase []byte) openSSHDecryptFunc {
+ return func(cipherName, kdfName, kdfOpts string, privKeyBlock []byte) ([]byte, error) {
+ if kdfName == "none" || cipherName == "none" {
+ return nil, errors.New("ssh: key is not password protected")
+ }
+ if kdfName != "bcrypt" {
+ return nil, fmt.Errorf("ssh: unknown KDF %q, only supports %q", kdfName, "bcrypt")
+ }
+
+ var opts struct {
+ Salt string
+ Rounds uint32
+ }
+ if err := Unmarshal([]byte(kdfOpts), &opts); err != nil {
+ return nil, err
+ }
+
+ k, err := bcrypt_pbkdf.Key(passphrase, []byte(opts.Salt), int(opts.Rounds), 32+16)
+ if err != nil {
+ return nil, err
+ }
+ key, iv := k[:32], k[32:]
+
+ c, err := aes.NewCipher(key)
+ if err != nil {
+ return nil, err
+ }
+ switch cipherName {
+ case "aes256-ctr":
+ ctr := cipher.NewCTR(c, iv)
+ ctr.XORKeyStream(privKeyBlock, privKeyBlock)
+ case "aes256-cbc":
+ if len(privKeyBlock)%c.BlockSize() != 0 {
+ return nil, fmt.Errorf("ssh: invalid encrypted private key length, not a multiple of the block size")
+ }
+ cbc := cipher.NewCBCDecrypter(c, iv)
+ cbc.CryptBlocks(privKeyBlock, privKeyBlock)
+ default:
+ return nil, fmt.Errorf("ssh: unknown cipher %q, only supports %q or %q", cipherName, "aes256-ctr", "aes256-cbc")
+ }
+
+ return privKeyBlock, nil
+ }
+}
+
+func unencryptedOpenSSHMarshaler(privKeyBlock []byte) ([]byte, string, string, string, error) {
+ key := generateOpenSSHPadding(privKeyBlock, 8)
+ return key, "none", "none", "", nil
+}
+
+func passphraseProtectedOpenSSHMarshaler(passphrase []byte) openSSHEncryptFunc {
+ return func(privKeyBlock []byte) ([]byte, string, string, string, error) {
+ salt := make([]byte, 16)
+ if _, err := rand.Read(salt); err != nil {
+ return nil, "", "", "", err
+ }
+
+ opts := struct {
+ Salt []byte
+ Rounds uint32
+ }{salt, 16}
+
+ // Derive key to encrypt the private key block.
+ k, err := bcrypt_pbkdf.Key(passphrase, salt, int(opts.Rounds), 32+aes.BlockSize)
+ if err != nil {
+ return nil, "", "", "", err
+ }
+
+ // Add padding matching the block size of AES.
+ keyBlock := generateOpenSSHPadding(privKeyBlock, aes.BlockSize)
+
+ // Encrypt the private key using the derived secret.
+
+ dst := make([]byte, len(keyBlock))
+ key, iv := k[:32], k[32:]
+ block, err := aes.NewCipher(key)
+ if err != nil {
+ return nil, "", "", "", err
+ }
+
+ stream := cipher.NewCTR(block, iv)
+ stream.XORKeyStream(dst, keyBlock)
+
+ return dst, "aes256-ctr", "bcrypt", string(Marshal(opts)), nil
+ }
+}
+
+const privateKeyAuthMagic = "openssh-key-v1\x00"
+
+type openSSHDecryptFunc func(CipherName, KdfName, KdfOpts string, PrivKeyBlock []byte) ([]byte, error)
+type openSSHEncryptFunc func(PrivKeyBlock []byte) (ProtectedKeyBlock []byte, cipherName, kdfName, kdfOptions string, err error)
+
+type openSSHEncryptedPrivateKey struct {
+ CipherName string
+ KdfName string
+ KdfOpts string
+ NumKeys uint32
+ PubKey []byte
+ PrivKeyBlock []byte
+}
+
+type openSSHPrivateKey struct {
+ Check1 uint32
+ Check2 uint32
+ Keytype string
+ Rest []byte `ssh:"rest"`
+}
+
+type openSSHRSAPrivateKey struct {
+ N *big.Int
+ E *big.Int
+ D *big.Int
+ Iqmp *big.Int
+ P *big.Int
+ Q *big.Int
+ Comment string
+ Pad []byte `ssh:"rest"`
+}
+
+type openSSHEd25519PrivateKey struct {
+ Pub []byte
+ Priv []byte
+ Comment string
+ Pad []byte `ssh:"rest"`
+}
+
+type openSSHECDSAPrivateKey struct {
+ Curve string
+ Pub []byte
+ D *big.Int
+ Comment string
+ Pad []byte `ssh:"rest"`
+}
+
+// parseOpenSSHPrivateKey parses an OpenSSH private key, using the decrypt
+// function to unwrap the encrypted portion. unencryptedOpenSSHKey can be used
+// as the decrypt function to parse an unencrypted private key. See
+// https://github.com/openssh/openssh-portable/blob/master/PROTOCOL.key.
+func parseOpenSSHPrivateKey(key []byte, decrypt openSSHDecryptFunc) (crypto.PrivateKey, error) {
+ if len(key) < len(privateKeyAuthMagic) || string(key[:len(privateKeyAuthMagic)]) != privateKeyAuthMagic {
+ return nil, errors.New("ssh: invalid openssh private key format")
+ }
+ remaining := key[len(privateKeyAuthMagic):]
+
+ var w openSSHEncryptedPrivateKey
+ if err := Unmarshal(remaining, &w); err != nil {
+ return nil, err
+ }
+ if w.NumKeys != 1 {
+ // We only support single key files, and so does OpenSSH.
+ // https://github.com/openssh/openssh-portable/blob/4103a3ec7/sshkey.c#L4171
+ return nil, errors.New("ssh: multi-key files are not supported")
+ }
+
+ privKeyBlock, err := decrypt(w.CipherName, w.KdfName, w.KdfOpts, w.PrivKeyBlock)
+ if err != nil {
+ if err, ok := err.(*PassphraseMissingError); ok {
+ pub, errPub := ParsePublicKey(w.PubKey)
+ if errPub != nil {
+ return nil, fmt.Errorf("ssh: failed to parse embedded public key: %v", errPub)
+ }
+ err.PublicKey = pub
+ }
+ return nil, err
+ }
+
+ var pk1 openSSHPrivateKey
+ if err := Unmarshal(privKeyBlock, &pk1); err != nil || pk1.Check1 != pk1.Check2 {
+ if w.CipherName != "none" {
+ return nil, x509.IncorrectPasswordError
+ }
+ return nil, errors.New("ssh: malformed OpenSSH key")
+ }
+
+ switch pk1.Keytype {
+ case KeyAlgoRSA:
+ var key openSSHRSAPrivateKey
+ if err := Unmarshal(pk1.Rest, &key); err != nil {
+ return nil, err
+ }
+
+ if err := checkOpenSSHKeyPadding(key.Pad); err != nil {
+ return nil, err
+ }
+
+ pk := &rsa.PrivateKey{
+ PublicKey: rsa.PublicKey{
+ N: key.N,
+ E: int(key.E.Int64()),
+ },
+ D: key.D,
+ Primes: []*big.Int{key.P, key.Q},
+ }
+
+ if err := pk.Validate(); err != nil {
+ return nil, err
+ }
+
+ pk.Precompute()
+
+ return pk, nil
+ case KeyAlgoED25519:
+ var key openSSHEd25519PrivateKey
+ if err := Unmarshal(pk1.Rest, &key); err != nil {
+ return nil, err
+ }
+
+ if len(key.Priv) != ed25519.PrivateKeySize {
+ return nil, errors.New("ssh: private key unexpected length")
+ }
+
+ if err := checkOpenSSHKeyPadding(key.Pad); err != nil {
+ return nil, err
+ }
+
+ pk := ed25519.PrivateKey(make([]byte, ed25519.PrivateKeySize))
+ copy(pk, key.Priv)
+ return &pk, nil
+ case KeyAlgoECDSA256, KeyAlgoECDSA384, KeyAlgoECDSA521:
+ var key openSSHECDSAPrivateKey
+ if err := Unmarshal(pk1.Rest, &key); err != nil {
+ return nil, err
+ }
+
+ if err := checkOpenSSHKeyPadding(key.Pad); err != nil {
+ return nil, err
+ }
+
+ var curve elliptic.Curve
+ switch key.Curve {
+ case "nistp256":
+ curve = elliptic.P256()
+ case "nistp384":
+ curve = elliptic.P384()
+ case "nistp521":
+ curve = elliptic.P521()
+ default:
+ return nil, errors.New("ssh: unhandled elliptic curve: " + key.Curve)
+ }
+
+ X, Y := elliptic.Unmarshal(curve, key.Pub)
+ if X == nil || Y == nil {
+ return nil, errors.New("ssh: failed to unmarshal public key")
+ }
+
+ if key.D.Cmp(curve.Params().N) >= 0 {
+ return nil, errors.New("ssh: scalar is out of range")
+ }
+
+ x, y := curve.ScalarBaseMult(key.D.Bytes())
+ if x.Cmp(X) != 0 || y.Cmp(Y) != 0 {
+ return nil, errors.New("ssh: public key does not match private key")
+ }
+
+ return &ecdsa.PrivateKey{
+ PublicKey: ecdsa.PublicKey{
+ Curve: curve,
+ X: X,
+ Y: Y,
+ },
+ D: key.D,
+ }, nil
+ default:
+ return nil, errors.New("ssh: unhandled key type")
+ }
+}
+
+func marshalOpenSSHPrivateKey(key crypto.PrivateKey, comment string, encrypt openSSHEncryptFunc) (*pem.Block, error) {
+ var w openSSHEncryptedPrivateKey
+ var pk1 openSSHPrivateKey
+
+ // Random check bytes.
+ var check uint32
+ if err := binary.Read(rand.Reader, binary.BigEndian, &check); err != nil {
+ return nil, err
+ }
+
+ pk1.Check1 = check
+ pk1.Check2 = check
+ w.NumKeys = 1
+
+ // Use a []byte directly on ed25519 keys.
+ if k, ok := key.(*ed25519.PrivateKey); ok {
+ key = *k
+ }
+
+ switch k := key.(type) {
+ case *rsa.PrivateKey:
+ E := new(big.Int).SetInt64(int64(k.PublicKey.E))
+ // Marshal public key:
+ // E and N are in reversed order in the public and private key.
+ pubKey := struct {
+ KeyType string
+ E *big.Int
+ N *big.Int
+ }{
+ KeyAlgoRSA,
+ E, k.PublicKey.N,
+ }
+ w.PubKey = Marshal(pubKey)
+
+ // Marshal private key.
+ key := openSSHRSAPrivateKey{
+ N: k.PublicKey.N,
+ E: E,
+ D: k.D,
+ Iqmp: k.Precomputed.Qinv,
+ P: k.Primes[0],
+ Q: k.Primes[1],
+ Comment: comment,
+ }
+ pk1.Keytype = KeyAlgoRSA
+ pk1.Rest = Marshal(key)
+ case ed25519.PrivateKey:
+ pub := make([]byte, ed25519.PublicKeySize)
+ priv := make([]byte, ed25519.PrivateKeySize)
+ copy(pub, k[32:])
+ copy(priv, k)
+
+ // Marshal public key.
+ pubKey := struct {
+ KeyType string
+ Pub []byte
+ }{
+ KeyAlgoED25519, pub,
+ }
+ w.PubKey = Marshal(pubKey)
+
+ // Marshal private key.
+ key := openSSHEd25519PrivateKey{
+ Pub: pub,
+ Priv: priv,
+ Comment: comment,
+ }
+ pk1.Keytype = KeyAlgoED25519
+ pk1.Rest = Marshal(key)
+ case *ecdsa.PrivateKey:
+ var curve, keyType string
+ switch name := k.Curve.Params().Name; name {
+ case "P-256":
+ curve = "nistp256"
+ keyType = KeyAlgoECDSA256
+ case "P-384":
+ curve = "nistp384"
+ keyType = KeyAlgoECDSA384
+ case "P-521":
+ curve = "nistp521"
+ keyType = KeyAlgoECDSA521
+ default:
+ return nil, errors.New("ssh: unhandled elliptic curve " + name)
+ }
+
+ pub := elliptic.Marshal(k.Curve, k.PublicKey.X, k.PublicKey.Y)
+
+ // Marshal public key.
+ pubKey := struct {
+ KeyType string
+ Curve string
+ Pub []byte
+ }{
+ keyType, curve, pub,
+ }
+ w.PubKey = Marshal(pubKey)
+
+ // Marshal private key.
+ key := openSSHECDSAPrivateKey{
+ Curve: curve,
+ Pub: pub,
+ D: k.D,
+ Comment: comment,
+ }
+ pk1.Keytype = keyType
+ pk1.Rest = Marshal(key)
+ default:
+ return nil, fmt.Errorf("ssh: unsupported key type %T", k)
+ }
+
+ var err error
+ // Add padding and encrypt the key if necessary.
+ w.PrivKeyBlock, w.CipherName, w.KdfName, w.KdfOpts, err = encrypt(Marshal(pk1))
+ if err != nil {
+ return nil, err
+ }
+
+ b := Marshal(w)
+ block := &pem.Block{
+ Type: "OPENSSH PRIVATE KEY",
+ Bytes: append([]byte(privateKeyAuthMagic), b...),
+ }
+ return block, nil
+}
+
+func checkOpenSSHKeyPadding(pad []byte) error {
+ for i, b := range pad {
+ if int(b) != i+1 {
+ return errors.New("ssh: padding not as expected")
+ }
+ }
+ return nil
+}
+
+func generateOpenSSHPadding(block []byte, blockSize int) []byte {
+ for i, l := 0, len(block); (l+i)%blockSize != 0; i++ {
+ block = append(block, byte(i+1))
+ }
+ return block
+}
+
+// FingerprintLegacyMD5 returns the user presentation of the key's
+// fingerprint as described by RFC 4716 section 4.
+func FingerprintLegacyMD5(pubKey PublicKey) string {
+ md5sum := md5.Sum(pubKey.Marshal())
+ hexarray := make([]string, len(md5sum))
+ for i, c := range md5sum {
+ hexarray[i] = hex.EncodeToString([]byte{c})
+ }
+ return strings.Join(hexarray, ":")
+}
+
+// FingerprintSHA256 returns the user presentation of the key's
+// fingerprint as unpadded base64 encoded sha256 hash.
+// This format was introduced from OpenSSH 6.8.
+// https://www.openssh.com/txt/release-6.8
+// https://tools.ietf.org/html/rfc4648#section-3.2 (unpadded base64 encoding)
+func FingerprintSHA256(pubKey PublicKey) string {
+ sha256sum := sha256.Sum256(pubKey.Marshal())
+ hash := base64.RawStdEncoding.EncodeToString(sha256sum[:])
+ return "SHA256:" + hash
+}
diff --git a/vendor/golang.org/x/crypto/ssh/mac.go b/vendor/golang.org/x/crypto/ssh/mac.go
new file mode 100644
index 00000000..06a1b275
--- /dev/null
+++ b/vendor/golang.org/x/crypto/ssh/mac.go
@@ -0,0 +1,68 @@
+// Copyright 2012 The Go Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style
+// license that can be found in the LICENSE file.
+
+package ssh
+
+// Message authentication support
+
+import (
+ "crypto/hmac"
+ "crypto/sha1"
+ "crypto/sha256"
+ "crypto/sha512"
+ "hash"
+)
+
+type macMode struct {
+ keySize int
+ etm bool
+ new func(key []byte) hash.Hash
+}
+
+// truncatingMAC wraps around a hash.Hash and truncates the output digest to
+// a given size.
+type truncatingMAC struct {
+ length int
+ hmac hash.Hash
+}
+
+func (t truncatingMAC) Write(data []byte) (int, error) {
+ return t.hmac.Write(data)
+}
+
+func (t truncatingMAC) Sum(in []byte) []byte {
+ out := t.hmac.Sum(in)
+ return out[:len(in)+t.length]
+}
+
+func (t truncatingMAC) Reset() {
+ t.hmac.Reset()
+}
+
+func (t truncatingMAC) Size() int {
+ return t.length
+}
+
+func (t truncatingMAC) BlockSize() int { return t.hmac.BlockSize() }
+
+var macModes = map[string]*macMode{
+ "hmac-sha2-512-etm@openssh.com": {64, true, func(key []byte) hash.Hash {
+ return hmac.New(sha512.New, key)
+ }},
+ "hmac-sha2-256-etm@openssh.com": {32, true, func(key []byte) hash.Hash {
+ return hmac.New(sha256.New, key)
+ }},
+ "hmac-sha2-512": {64, false, func(key []byte) hash.Hash {
+ return hmac.New(sha512.New, key)
+ }},
+ "hmac-sha2-256": {32, false, func(key []byte) hash.Hash {
+ return hmac.New(sha256.New, key)
+ }},
+ "hmac-sha1": {20, false, func(key []byte) hash.Hash {
+ return hmac.New(sha1.New, key)
+ }},
+ "hmac-sha1-96": {20, false, func(key []byte) hash.Hash {
+ return truncatingMAC{12, hmac.New(sha1.New, key)}
+ }},
+}
diff --git a/vendor/golang.org/x/crypto/ssh/messages.go b/vendor/golang.org/x/crypto/ssh/messages.go
new file mode 100644
index 00000000..b55f8605
--- /dev/null
+++ b/vendor/golang.org/x/crypto/ssh/messages.go
@@ -0,0 +1,891 @@
+// Copyright 2011 The Go Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style
+// license that can be found in the LICENSE file.
+
+package ssh
+
+import (
+ "bytes"
+ "encoding/binary"
+ "errors"
+ "fmt"
+ "io"
+ "math/big"
+ "reflect"
+ "strconv"
+ "strings"
+)
+
+// These are SSH message type numbers. They are scattered around several
+// documents but many were taken from [SSH-PARAMETERS].
+const (
+ msgIgnore = 2
+ msgUnimplemented = 3
+ msgDebug = 4
+ msgNewKeys = 21
+)
+
+// SSH messages:
+//
+// These structures mirror the wire format of the corresponding SSH messages.
+// They are marshaled using reflection with the marshal and unmarshal functions
+// in this file. The only wrinkle is that a final member of type []byte with a
+// ssh tag of "rest" receives the remainder of a packet when unmarshaling.
+
+// See RFC 4253, section 11.1.
+const msgDisconnect = 1
+
+// disconnectMsg is the message that signals a disconnect. It is also
+// the error type returned from mux.Wait()
+type disconnectMsg struct {
+ Reason uint32 `sshtype:"1"`
+ Message string
+ Language string
+}
+
+func (d *disconnectMsg) Error() string {
+ return fmt.Sprintf("ssh: disconnect, reason %d: %s", d.Reason, d.Message)
+}
+
+// See RFC 4253, section 7.1.
+const msgKexInit = 20
+
+type kexInitMsg struct {
+ Cookie [16]byte `sshtype:"20"`
+ KexAlgos []string
+ ServerHostKeyAlgos []string
+ CiphersClientServer []string
+ CiphersServerClient []string
+ MACsClientServer []string
+ MACsServerClient []string
+ CompressionClientServer []string
+ CompressionServerClient []string
+ LanguagesClientServer []string
+ LanguagesServerClient []string
+ FirstKexFollows bool
+ Reserved uint32
+}
+
+// See RFC 4253, section 8.
+
+// Diffie-Hellman
+const msgKexDHInit = 30
+
+type kexDHInitMsg struct {
+ X *big.Int `sshtype:"30"`
+}
+
+const msgKexECDHInit = 30
+
+type kexECDHInitMsg struct {
+ ClientPubKey []byte `sshtype:"30"`
+}
+
+const msgKexECDHReply = 31
+
+type kexECDHReplyMsg struct {
+ HostKey []byte `sshtype:"31"`
+ EphemeralPubKey []byte
+ Signature []byte
+}
+
+const msgKexDHReply = 31
+
+type kexDHReplyMsg struct {
+ HostKey []byte `sshtype:"31"`
+ Y *big.Int
+ Signature []byte
+}
+
+// See RFC 4419, section 5.
+const msgKexDHGexGroup = 31
+
+type kexDHGexGroupMsg struct {
+ P *big.Int `sshtype:"31"`
+ G *big.Int
+}
+
+const msgKexDHGexInit = 32
+
+type kexDHGexInitMsg struct {
+ X *big.Int `sshtype:"32"`
+}
+
+const msgKexDHGexReply = 33
+
+type kexDHGexReplyMsg struct {
+ HostKey []byte `sshtype:"33"`
+ Y *big.Int
+ Signature []byte
+}
+
+const msgKexDHGexRequest = 34
+
+type kexDHGexRequestMsg struct {
+ MinBits uint32 `sshtype:"34"`
+ PreferedBits uint32
+ MaxBits uint32
+}
+
+// See RFC 4253, section 10.
+const msgServiceRequest = 5
+
+type serviceRequestMsg struct {
+ Service string `sshtype:"5"`
+}
+
+// See RFC 4253, section 10.
+const msgServiceAccept = 6
+
+type serviceAcceptMsg struct {
+ Service string `sshtype:"6"`
+}
+
+// See RFC 8308, section 2.3
+const msgExtInfo = 7
+
+type extInfoMsg struct {
+ NumExtensions uint32 `sshtype:"7"`
+ Payload []byte `ssh:"rest"`
+}
+
+// See RFC 4252, section 5.
+const msgUserAuthRequest = 50
+
+type userAuthRequestMsg struct {
+ User string `sshtype:"50"`
+ Service string
+ Method string
+ Payload []byte `ssh:"rest"`
+}
+
+// Used for debug printouts of packets.
+type userAuthSuccessMsg struct {
+}
+
+// See RFC 4252, section 5.1
+const msgUserAuthFailure = 51
+
+type userAuthFailureMsg struct {
+ Methods []string `sshtype:"51"`
+ PartialSuccess bool
+}
+
+// See RFC 4252, section 5.1
+const msgUserAuthSuccess = 52
+
+// See RFC 4252, section 5.4
+const msgUserAuthBanner = 53
+
+type userAuthBannerMsg struct {
+ Message string `sshtype:"53"`
+ // unused, but required to allow message parsing
+ Language string
+}
+
+// See RFC 4256, section 3.2
+const msgUserAuthInfoRequest = 60
+const msgUserAuthInfoResponse = 61
+
+type userAuthInfoRequestMsg struct {
+ Name string `sshtype:"60"`
+ Instruction string
+ Language string
+ NumPrompts uint32
+ Prompts []byte `ssh:"rest"`
+}
+
+// See RFC 4254, section 5.1.
+const msgChannelOpen = 90
+
+type channelOpenMsg struct {
+ ChanType string `sshtype:"90"`
+ PeersID uint32
+ PeersWindow uint32
+ MaxPacketSize uint32
+ TypeSpecificData []byte `ssh:"rest"`
+}
+
+const msgChannelExtendedData = 95
+const msgChannelData = 94
+
+// Used for debug print outs of packets.
+type channelDataMsg struct {
+ PeersID uint32 `sshtype:"94"`
+ Length uint32
+ Rest []byte `ssh:"rest"`
+}
+
+// See RFC 4254, section 5.1.
+const msgChannelOpenConfirm = 91
+
+type channelOpenConfirmMsg struct {
+ PeersID uint32 `sshtype:"91"`
+ MyID uint32
+ MyWindow uint32
+ MaxPacketSize uint32
+ TypeSpecificData []byte `ssh:"rest"`
+}
+
+// See RFC 4254, section 5.1.
+const msgChannelOpenFailure = 92
+
+type channelOpenFailureMsg struct {
+ PeersID uint32 `sshtype:"92"`
+ Reason RejectionReason
+ Message string
+ Language string
+}
+
+const msgChannelRequest = 98
+
+type channelRequestMsg struct {
+ PeersID uint32 `sshtype:"98"`
+ Request string
+ WantReply bool
+ RequestSpecificData []byte `ssh:"rest"`
+}
+
+// See RFC 4254, section 5.4.
+const msgChannelSuccess = 99
+
+type channelRequestSuccessMsg struct {
+ PeersID uint32 `sshtype:"99"`
+}
+
+// See RFC 4254, section 5.4.
+const msgChannelFailure = 100
+
+type channelRequestFailureMsg struct {
+ PeersID uint32 `sshtype:"100"`
+}
+
+// See RFC 4254, section 5.3
+const msgChannelClose = 97
+
+type channelCloseMsg struct {
+ PeersID uint32 `sshtype:"97"`
+}
+
+// See RFC 4254, section 5.3
+const msgChannelEOF = 96
+
+type channelEOFMsg struct {
+ PeersID uint32 `sshtype:"96"`
+}
+
+// See RFC 4254, section 4
+const msgGlobalRequest = 80
+
+type globalRequestMsg struct {
+ Type string `sshtype:"80"`
+ WantReply bool
+ Data []byte `ssh:"rest"`
+}
+
+// See RFC 4254, section 4
+const msgRequestSuccess = 81
+
+type globalRequestSuccessMsg struct {
+ Data []byte `ssh:"rest" sshtype:"81"`
+}
+
+// See RFC 4254, section 4
+const msgRequestFailure = 82
+
+type globalRequestFailureMsg struct {
+ Data []byte `ssh:"rest" sshtype:"82"`
+}
+
+// See RFC 4254, section 5.2
+const msgChannelWindowAdjust = 93
+
+type windowAdjustMsg struct {
+ PeersID uint32 `sshtype:"93"`
+ AdditionalBytes uint32
+}
+
+// See RFC 4252, section 7
+const msgUserAuthPubKeyOk = 60
+
+type userAuthPubKeyOkMsg struct {
+ Algo string `sshtype:"60"`
+ PubKey []byte
+}
+
+// See RFC 4462, section 3
+const msgUserAuthGSSAPIResponse = 60
+
+type userAuthGSSAPIResponse struct {
+ SupportMech []byte `sshtype:"60"`
+}
+
+const msgUserAuthGSSAPIToken = 61
+
+type userAuthGSSAPIToken struct {
+ Token []byte `sshtype:"61"`
+}
+
+const msgUserAuthGSSAPIMIC = 66
+
+type userAuthGSSAPIMIC struct {
+ MIC []byte `sshtype:"66"`
+}
+
+// See RFC 4462, section 3.9
+const msgUserAuthGSSAPIErrTok = 64
+
+type userAuthGSSAPIErrTok struct {
+ ErrorToken []byte `sshtype:"64"`
+}
+
+// See RFC 4462, section 3.8
+const msgUserAuthGSSAPIError = 65
+
+type userAuthGSSAPIError struct {
+ MajorStatus uint32 `sshtype:"65"`
+ MinorStatus uint32
+ Message string
+ LanguageTag string
+}
+
+// Transport layer OpenSSH extension. See [PROTOCOL], section 1.9
+const msgPing = 192
+
+type pingMsg struct {
+ Data string `sshtype:"192"`
+}
+
+// Transport layer OpenSSH extension. See [PROTOCOL], section 1.9
+const msgPong = 193
+
+type pongMsg struct {
+ Data string `sshtype:"193"`
+}
+
+// typeTags returns the possible type bytes for the given reflect.Type, which
+// should be a struct. The possible values are separated by a '|' character.
+func typeTags(structType reflect.Type) (tags []byte) {
+ tagStr := structType.Field(0).Tag.Get("sshtype")
+
+ for _, tag := range strings.Split(tagStr, "|") {
+ i, err := strconv.Atoi(tag)
+ if err == nil {
+ tags = append(tags, byte(i))
+ }
+ }
+
+ return tags
+}
+
+func fieldError(t reflect.Type, field int, problem string) error {
+ if problem != "" {
+ problem = ": " + problem
+ }
+ return fmt.Errorf("ssh: unmarshal error for field %s of type %s%s", t.Field(field).Name, t.Name(), problem)
+}
+
+var errShortRead = errors.New("ssh: short read")
+
+// Unmarshal parses data in SSH wire format into a structure. The out
+// argument should be a pointer to struct. If the first member of the
+// struct has the "sshtype" tag set to a '|'-separated set of numbers
+// in decimal, the packet must start with one of those numbers. In
+// case of error, Unmarshal returns a ParseError or
+// UnexpectedMessageError.
+func Unmarshal(data []byte, out interface{}) error {
+ v := reflect.ValueOf(out).Elem()
+ structType := v.Type()
+ expectedTypes := typeTags(structType)
+
+ var expectedType byte
+ if len(expectedTypes) > 0 {
+ expectedType = expectedTypes[0]
+ }
+
+ if len(data) == 0 {
+ return parseError(expectedType)
+ }
+
+ if len(expectedTypes) > 0 {
+ goodType := false
+ for _, e := range expectedTypes {
+ if e > 0 && data[0] == e {
+ goodType = true
+ break
+ }
+ }
+ if !goodType {
+ return fmt.Errorf("ssh: unexpected message type %d (expected one of %v)", data[0], expectedTypes)
+ }
+ data = data[1:]
+ }
+
+ var ok bool
+ for i := 0; i < v.NumField(); i++ {
+ field := v.Field(i)
+ t := field.Type()
+ switch t.Kind() {
+ case reflect.Bool:
+ if len(data) < 1 {
+ return errShortRead
+ }
+ field.SetBool(data[0] != 0)
+ data = data[1:]
+ case reflect.Array:
+ if t.Elem().Kind() != reflect.Uint8 {
+ return fieldError(structType, i, "array of unsupported type")
+ }
+ if len(data) < t.Len() {
+ return errShortRead
+ }
+ for j, n := 0, t.Len(); j < n; j++ {
+ field.Index(j).Set(reflect.ValueOf(data[j]))
+ }
+ data = data[t.Len():]
+ case reflect.Uint64:
+ var u64 uint64
+ if u64, data, ok = parseUint64(data); !ok {
+ return errShortRead
+ }
+ field.SetUint(u64)
+ case reflect.Uint32:
+ var u32 uint32
+ if u32, data, ok = parseUint32(data); !ok {
+ return errShortRead
+ }
+ field.SetUint(uint64(u32))
+ case reflect.Uint8:
+ if len(data) < 1 {
+ return errShortRead
+ }
+ field.SetUint(uint64(data[0]))
+ data = data[1:]
+ case reflect.String:
+ var s []byte
+ if s, data, ok = parseString(data); !ok {
+ return fieldError(structType, i, "")
+ }
+ field.SetString(string(s))
+ case reflect.Slice:
+ switch t.Elem().Kind() {
+ case reflect.Uint8:
+ if structType.Field(i).Tag.Get("ssh") == "rest" {
+ field.Set(reflect.ValueOf(data))
+ data = nil
+ } else {
+ var s []byte
+ if s, data, ok = parseString(data); !ok {
+ return errShortRead
+ }
+ field.Set(reflect.ValueOf(s))
+ }
+ case reflect.String:
+ var nl []string
+ if nl, data, ok = parseNameList(data); !ok {
+ return errShortRead
+ }
+ field.Set(reflect.ValueOf(nl))
+ default:
+ return fieldError(structType, i, "slice of unsupported type")
+ }
+ case reflect.Ptr:
+ if t == bigIntType {
+ var n *big.Int
+ if n, data, ok = parseInt(data); !ok {
+ return errShortRead
+ }
+ field.Set(reflect.ValueOf(n))
+ } else {
+ return fieldError(structType, i, "pointer to unsupported type")
+ }
+ default:
+ return fieldError(structType, i, fmt.Sprintf("unsupported type: %v", t))
+ }
+ }
+
+ if len(data) != 0 {
+ return parseError(expectedType)
+ }
+
+ return nil
+}
+
+// Marshal serializes the message in msg to SSH wire format. The msg
+// argument should be a struct or pointer to struct. If the first
+// member has the "sshtype" tag set to a number in decimal, that
+// number is prepended to the result. If the last of member has the
+// "ssh" tag set to "rest", its contents are appended to the output.
+func Marshal(msg interface{}) []byte {
+ out := make([]byte, 0, 64)
+ return marshalStruct(out, msg)
+}
+
+func marshalStruct(out []byte, msg interface{}) []byte {
+ v := reflect.Indirect(reflect.ValueOf(msg))
+ msgTypes := typeTags(v.Type())
+ if len(msgTypes) > 0 {
+ out = append(out, msgTypes[0])
+ }
+
+ for i, n := 0, v.NumField(); i < n; i++ {
+ field := v.Field(i)
+ switch t := field.Type(); t.Kind() {
+ case reflect.Bool:
+ var v uint8
+ if field.Bool() {
+ v = 1
+ }
+ out = append(out, v)
+ case reflect.Array:
+ if t.Elem().Kind() != reflect.Uint8 {
+ panic(fmt.Sprintf("array of non-uint8 in field %d: %T", i, field.Interface()))
+ }
+ for j, l := 0, t.Len(); j < l; j++ {
+ out = append(out, uint8(field.Index(j).Uint()))
+ }
+ case reflect.Uint32:
+ out = appendU32(out, uint32(field.Uint()))
+ case reflect.Uint64:
+ out = appendU64(out, uint64(field.Uint()))
+ case reflect.Uint8:
+ out = append(out, uint8(field.Uint()))
+ case reflect.String:
+ s := field.String()
+ out = appendInt(out, len(s))
+ out = append(out, s...)
+ case reflect.Slice:
+ switch t.Elem().Kind() {
+ case reflect.Uint8:
+ if v.Type().Field(i).Tag.Get("ssh") != "rest" {
+ out = appendInt(out, field.Len())
+ }
+ out = append(out, field.Bytes()...)
+ case reflect.String:
+ offset := len(out)
+ out = appendU32(out, 0)
+ if n := field.Len(); n > 0 {
+ for j := 0; j < n; j++ {
+ f := field.Index(j)
+ if j != 0 {
+ out = append(out, ',')
+ }
+ out = append(out, f.String()...)
+ }
+ // overwrite length value
+ binary.BigEndian.PutUint32(out[offset:], uint32(len(out)-offset-4))
+ }
+ default:
+ panic(fmt.Sprintf("slice of unknown type in field %d: %T", i, field.Interface()))
+ }
+ case reflect.Ptr:
+ if t == bigIntType {
+ var n *big.Int
+ nValue := reflect.ValueOf(&n)
+ nValue.Elem().Set(field)
+ needed := intLength(n)
+ oldLength := len(out)
+
+ if cap(out)-len(out) < needed {
+ newOut := make([]byte, len(out), 2*(len(out)+needed))
+ copy(newOut, out)
+ out = newOut
+ }
+ out = out[:oldLength+needed]
+ marshalInt(out[oldLength:], n)
+ } else {
+ panic(fmt.Sprintf("pointer to unknown type in field %d: %T", i, field.Interface()))
+ }
+ }
+ }
+
+ return out
+}
+
+var bigOne = big.NewInt(1)
+
+func parseString(in []byte) (out, rest []byte, ok bool) {
+ if len(in) < 4 {
+ return
+ }
+ length := binary.BigEndian.Uint32(in)
+ in = in[4:]
+ if uint32(len(in)) < length {
+ return
+ }
+ out = in[:length]
+ rest = in[length:]
+ ok = true
+ return
+}
+
+var (
+ comma = []byte{','}
+ emptyNameList = []string{}
+)
+
+func parseNameList(in []byte) (out []string, rest []byte, ok bool) {
+ contents, rest, ok := parseString(in)
+ if !ok {
+ return
+ }
+ if len(contents) == 0 {
+ out = emptyNameList
+ return
+ }
+ parts := bytes.Split(contents, comma)
+ out = make([]string, len(parts))
+ for i, part := range parts {
+ out[i] = string(part)
+ }
+ return
+}
+
+func parseInt(in []byte) (out *big.Int, rest []byte, ok bool) {
+ contents, rest, ok := parseString(in)
+ if !ok {
+ return
+ }
+ out = new(big.Int)
+
+ if len(contents) > 0 && contents[0]&0x80 == 0x80 {
+ // This is a negative number
+ notBytes := make([]byte, len(contents))
+ for i := range notBytes {
+ notBytes[i] = ^contents[i]
+ }
+ out.SetBytes(notBytes)
+ out.Add(out, bigOne)
+ out.Neg(out)
+ } else {
+ // Positive number
+ out.SetBytes(contents)
+ }
+ ok = true
+ return
+}
+
+func parseUint32(in []byte) (uint32, []byte, bool) {
+ if len(in) < 4 {
+ return 0, nil, false
+ }
+ return binary.BigEndian.Uint32(in), in[4:], true
+}
+
+func parseUint64(in []byte) (uint64, []byte, bool) {
+ if len(in) < 8 {
+ return 0, nil, false
+ }
+ return binary.BigEndian.Uint64(in), in[8:], true
+}
+
+func intLength(n *big.Int) int {
+ length := 4 /* length bytes */
+ if n.Sign() < 0 {
+ nMinus1 := new(big.Int).Neg(n)
+ nMinus1.Sub(nMinus1, bigOne)
+ bitLen := nMinus1.BitLen()
+ if bitLen%8 == 0 {
+ // The number will need 0xff padding
+ length++
+ }
+ length += (bitLen + 7) / 8
+ } else if n.Sign() == 0 {
+ // A zero is the zero length string
+ } else {
+ bitLen := n.BitLen()
+ if bitLen%8 == 0 {
+ // The number will need 0x00 padding
+ length++
+ }
+ length += (bitLen + 7) / 8
+ }
+
+ return length
+}
+
+func marshalUint32(to []byte, n uint32) []byte {
+ binary.BigEndian.PutUint32(to, n)
+ return to[4:]
+}
+
+func marshalUint64(to []byte, n uint64) []byte {
+ binary.BigEndian.PutUint64(to, n)
+ return to[8:]
+}
+
+func marshalInt(to []byte, n *big.Int) []byte {
+ lengthBytes := to
+ to = to[4:]
+ length := 0
+
+ if n.Sign() < 0 {
+ // A negative number has to be converted to two's-complement
+ // form. So we'll subtract 1 and invert. If the
+ // most-significant-bit isn't set then we'll need to pad the
+ // beginning with 0xff in order to keep the number negative.
+ nMinus1 := new(big.Int).Neg(n)
+ nMinus1.Sub(nMinus1, bigOne)
+ bytes := nMinus1.Bytes()
+ for i := range bytes {
+ bytes[i] ^= 0xff
+ }
+ if len(bytes) == 0 || bytes[0]&0x80 == 0 {
+ to[0] = 0xff
+ to = to[1:]
+ length++
+ }
+ nBytes := copy(to, bytes)
+ to = to[nBytes:]
+ length += nBytes
+ } else if n.Sign() == 0 {
+ // A zero is the zero length string
+ } else {
+ bytes := n.Bytes()
+ if len(bytes) > 0 && bytes[0]&0x80 != 0 {
+ // We'll have to pad this with a 0x00 in order to
+ // stop it looking like a negative number.
+ to[0] = 0
+ to = to[1:]
+ length++
+ }
+ nBytes := copy(to, bytes)
+ to = to[nBytes:]
+ length += nBytes
+ }
+
+ lengthBytes[0] = byte(length >> 24)
+ lengthBytes[1] = byte(length >> 16)
+ lengthBytes[2] = byte(length >> 8)
+ lengthBytes[3] = byte(length)
+ return to
+}
+
+func writeInt(w io.Writer, n *big.Int) {
+ length := intLength(n)
+ buf := make([]byte, length)
+ marshalInt(buf, n)
+ w.Write(buf)
+}
+
+func writeString(w io.Writer, s []byte) {
+ var lengthBytes [4]byte
+ lengthBytes[0] = byte(len(s) >> 24)
+ lengthBytes[1] = byte(len(s) >> 16)
+ lengthBytes[2] = byte(len(s) >> 8)
+ lengthBytes[3] = byte(len(s))
+ w.Write(lengthBytes[:])
+ w.Write(s)
+}
+
+func stringLength(n int) int {
+ return 4 + n
+}
+
+func marshalString(to []byte, s []byte) []byte {
+ to[0] = byte(len(s) >> 24)
+ to[1] = byte(len(s) >> 16)
+ to[2] = byte(len(s) >> 8)
+ to[3] = byte(len(s))
+ to = to[4:]
+ copy(to, s)
+ return to[len(s):]
+}
+
+var bigIntType = reflect.TypeOf((*big.Int)(nil))
+
+// Decode a packet into its corresponding message.
+func decode(packet []byte) (interface{}, error) {
+ var msg interface{}
+ switch packet[0] {
+ case msgDisconnect:
+ msg = new(disconnectMsg)
+ case msgServiceRequest:
+ msg = new(serviceRequestMsg)
+ case msgServiceAccept:
+ msg = new(serviceAcceptMsg)
+ case msgExtInfo:
+ msg = new(extInfoMsg)
+ case msgKexInit:
+ msg = new(kexInitMsg)
+ case msgKexDHInit:
+ msg = new(kexDHInitMsg)
+ case msgKexDHReply:
+ msg = new(kexDHReplyMsg)
+ case msgUserAuthRequest:
+ msg = new(userAuthRequestMsg)
+ case msgUserAuthSuccess:
+ return new(userAuthSuccessMsg), nil
+ case msgUserAuthFailure:
+ msg = new(userAuthFailureMsg)
+ case msgUserAuthPubKeyOk:
+ msg = new(userAuthPubKeyOkMsg)
+ case msgGlobalRequest:
+ msg = new(globalRequestMsg)
+ case msgRequestSuccess:
+ msg = new(globalRequestSuccessMsg)
+ case msgRequestFailure:
+ msg = new(globalRequestFailureMsg)
+ case msgChannelOpen:
+ msg = new(channelOpenMsg)
+ case msgChannelData:
+ msg = new(channelDataMsg)
+ case msgChannelOpenConfirm:
+ msg = new(channelOpenConfirmMsg)
+ case msgChannelOpenFailure:
+ msg = new(channelOpenFailureMsg)
+ case msgChannelWindowAdjust:
+ msg = new(windowAdjustMsg)
+ case msgChannelEOF:
+ msg = new(channelEOFMsg)
+ case msgChannelClose:
+ msg = new(channelCloseMsg)
+ case msgChannelRequest:
+ msg = new(channelRequestMsg)
+ case msgChannelSuccess:
+ msg = new(channelRequestSuccessMsg)
+ case msgChannelFailure:
+ msg = new(channelRequestFailureMsg)
+ case msgUserAuthGSSAPIToken:
+ msg = new(userAuthGSSAPIToken)
+ case msgUserAuthGSSAPIMIC:
+ msg = new(userAuthGSSAPIMIC)
+ case msgUserAuthGSSAPIErrTok:
+ msg = new(userAuthGSSAPIErrTok)
+ case msgUserAuthGSSAPIError:
+ msg = new(userAuthGSSAPIError)
+ default:
+ return nil, unexpectedMessageError(0, packet[0])
+ }
+ if err := Unmarshal(packet, msg); err != nil {
+ return nil, err
+ }
+ return msg, nil
+}
+
+var packetTypeNames = map[byte]string{
+ msgDisconnect: "disconnectMsg",
+ msgServiceRequest: "serviceRequestMsg",
+ msgServiceAccept: "serviceAcceptMsg",
+ msgExtInfo: "extInfoMsg",
+ msgKexInit: "kexInitMsg",
+ msgKexDHInit: "kexDHInitMsg",
+ msgKexDHReply: "kexDHReplyMsg",
+ msgUserAuthRequest: "userAuthRequestMsg",
+ msgUserAuthSuccess: "userAuthSuccessMsg",
+ msgUserAuthFailure: "userAuthFailureMsg",
+ msgUserAuthPubKeyOk: "userAuthPubKeyOkMsg",
+ msgGlobalRequest: "globalRequestMsg",
+ msgRequestSuccess: "globalRequestSuccessMsg",
+ msgRequestFailure: "globalRequestFailureMsg",
+ msgChannelOpen: "channelOpenMsg",
+ msgChannelData: "channelDataMsg",
+ msgChannelOpenConfirm: "channelOpenConfirmMsg",
+ msgChannelOpenFailure: "channelOpenFailureMsg",
+ msgChannelWindowAdjust: "windowAdjustMsg",
+ msgChannelEOF: "channelEOFMsg",
+ msgChannelClose: "channelCloseMsg",
+ msgChannelRequest: "channelRequestMsg",
+ msgChannelSuccess: "channelRequestSuccessMsg",
+ msgChannelFailure: "channelRequestFailureMsg",
+}
diff --git a/vendor/golang.org/x/crypto/ssh/mux.go b/vendor/golang.org/x/crypto/ssh/mux.go
new file mode 100644
index 00000000..d2d24c63
--- /dev/null
+++ b/vendor/golang.org/x/crypto/ssh/mux.go
@@ -0,0 +1,357 @@
+// 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.
+
+package ssh
+
+import (
+ "encoding/binary"
+ "fmt"
+ "io"
+ "log"
+ "sync"
+ "sync/atomic"
+)
+
+// debugMux, if set, causes messages in the connection protocol to be
+// logged.
+const debugMux = false
+
+// chanList is a thread safe channel list.
+type chanList struct {
+ // protects concurrent access to chans
+ sync.Mutex
+
+ // chans are indexed by the local id of the channel, which the
+ // other side should send in the PeersId field.
+ chans []*channel
+
+ // This is a debugging aid: it offsets all IDs by this
+ // amount. This helps distinguish otherwise identical
+ // server/client muxes
+ offset uint32
+}
+
+// Assigns a channel ID to the given channel.
+func (c *chanList) add(ch *channel) uint32 {
+ c.Lock()
+ defer c.Unlock()
+ for i := range c.chans {
+ if c.chans[i] == nil {
+ c.chans[i] = ch
+ return uint32(i) + c.offset
+ }
+ }
+ c.chans = append(c.chans, ch)
+ return uint32(len(c.chans)-1) + c.offset
+}
+
+// getChan returns the channel for the given ID.
+func (c *chanList) getChan(id uint32) *channel {
+ id -= c.offset
+
+ c.Lock()
+ defer c.Unlock()
+ if id < uint32(len(c.chans)) {
+ return c.chans[id]
+ }
+ return nil
+}
+
+func (c *chanList) remove(id uint32) {
+ id -= c.offset
+ c.Lock()
+ if id < uint32(len(c.chans)) {
+ c.chans[id] = nil
+ }
+ c.Unlock()
+}
+
+// dropAll forgets all channels it knows, returning them in a slice.
+func (c *chanList) dropAll() []*channel {
+ c.Lock()
+ defer c.Unlock()
+ var r []*channel
+
+ for _, ch := range c.chans {
+ if ch == nil {
+ continue
+ }
+ r = append(r, ch)
+ }
+ c.chans = nil
+ return r
+}
+
+// mux represents the state for the SSH connection protocol, which
+// multiplexes many channels onto a single packet transport.
+type mux struct {
+ conn packetConn
+ chanList chanList
+
+ incomingChannels chan NewChannel
+
+ globalSentMu sync.Mutex
+ globalResponses chan interface{}
+ incomingRequests chan *Request
+
+ errCond *sync.Cond
+ err error
+}
+
+// When debugging, each new chanList instantiation has a different
+// offset.
+var globalOff uint32
+
+func (m *mux) Wait() error {
+ m.errCond.L.Lock()
+ defer m.errCond.L.Unlock()
+ for m.err == nil {
+ m.errCond.Wait()
+ }
+ return m.err
+}
+
+// newMux returns a mux that runs over the given connection.
+func newMux(p packetConn) *mux {
+ m := &mux{
+ conn: p,
+ incomingChannels: make(chan NewChannel, chanSize),
+ globalResponses: make(chan interface{}, 1),
+ incomingRequests: make(chan *Request, chanSize),
+ errCond: newCond(),
+ }
+ if debugMux {
+ m.chanList.offset = atomic.AddUint32(&globalOff, 1)
+ }
+
+ go m.loop()
+ return m
+}
+
+func (m *mux) sendMessage(msg interface{}) error {
+ p := Marshal(msg)
+ if debugMux {
+ log.Printf("send global(%d): %#v", m.chanList.offset, msg)
+ }
+ return m.conn.writePacket(p)
+}
+
+func (m *mux) SendRequest(name string, wantReply bool, payload []byte) (bool, []byte, error) {
+ if wantReply {
+ m.globalSentMu.Lock()
+ defer m.globalSentMu.Unlock()
+ }
+
+ if err := m.sendMessage(globalRequestMsg{
+ Type: name,
+ WantReply: wantReply,
+ Data: payload,
+ }); err != nil {
+ return false, nil, err
+ }
+
+ if !wantReply {
+ return false, nil, nil
+ }
+
+ msg, ok := <-m.globalResponses
+ if !ok {
+ return false, nil, io.EOF
+ }
+ switch msg := msg.(type) {
+ case *globalRequestFailureMsg:
+ return false, msg.Data, nil
+ case *globalRequestSuccessMsg:
+ return true, msg.Data, nil
+ default:
+ return false, nil, fmt.Errorf("ssh: unexpected response to request: %#v", msg)
+ }
+}
+
+// ackRequest must be called after processing a global request that
+// has WantReply set.
+func (m *mux) ackRequest(ok bool, data []byte) error {
+ if ok {
+ return m.sendMessage(globalRequestSuccessMsg{Data: data})
+ }
+ return m.sendMessage(globalRequestFailureMsg{Data: data})
+}
+
+func (m *mux) Close() error {
+ return m.conn.Close()
+}
+
+// loop runs the connection machine. It will process packets until an
+// error is encountered. To synchronize on loop exit, use mux.Wait.
+func (m *mux) loop() {
+ var err error
+ for err == nil {
+ err = m.onePacket()
+ }
+
+ for _, ch := range m.chanList.dropAll() {
+ ch.close()
+ }
+
+ close(m.incomingChannels)
+ close(m.incomingRequests)
+ close(m.globalResponses)
+
+ m.conn.Close()
+
+ m.errCond.L.Lock()
+ m.err = err
+ m.errCond.Broadcast()
+ m.errCond.L.Unlock()
+
+ if debugMux {
+ log.Println("loop exit", err)
+ }
+}
+
+// onePacket reads and processes one packet.
+func (m *mux) onePacket() error {
+ packet, err := m.conn.readPacket()
+ if err != nil {
+ return err
+ }
+
+ if debugMux {
+ if packet[0] == msgChannelData || packet[0] == msgChannelExtendedData {
+ log.Printf("decoding(%d): data packet - %d bytes", m.chanList.offset, len(packet))
+ } else {
+ p, _ := decode(packet)
+ log.Printf("decoding(%d): %d %#v - %d bytes", m.chanList.offset, packet[0], p, len(packet))
+ }
+ }
+
+ switch packet[0] {
+ case msgChannelOpen:
+ return m.handleChannelOpen(packet)
+ case msgGlobalRequest, msgRequestSuccess, msgRequestFailure:
+ return m.handleGlobalPacket(packet)
+ case msgPing:
+ var msg pingMsg
+ if err := Unmarshal(packet, &msg); err != nil {
+ return fmt.Errorf("failed to unmarshal ping@openssh.com message: %w", err)
+ }
+ return m.sendMessage(pongMsg(msg))
+ }
+
+ // assume a channel packet.
+ if len(packet) < 5 {
+ return parseError(packet[0])
+ }
+ id := binary.BigEndian.Uint32(packet[1:])
+ ch := m.chanList.getChan(id)
+ if ch == nil {
+ return m.handleUnknownChannelPacket(id, packet)
+ }
+
+ return ch.handlePacket(packet)
+}
+
+func (m *mux) handleGlobalPacket(packet []byte) error {
+ msg, err := decode(packet)
+ if err != nil {
+ return err
+ }
+
+ switch msg := msg.(type) {
+ case *globalRequestMsg:
+ m.incomingRequests <- &Request{
+ Type: msg.Type,
+ WantReply: msg.WantReply,
+ Payload: msg.Data,
+ mux: m,
+ }
+ case *globalRequestSuccessMsg, *globalRequestFailureMsg:
+ m.globalResponses <- msg
+ default:
+ panic(fmt.Sprintf("not a global message %#v", msg))
+ }
+
+ return nil
+}
+
+// handleChannelOpen schedules a channel to be Accept()ed.
+func (m *mux) handleChannelOpen(packet []byte) error {
+ var msg channelOpenMsg
+ if err := Unmarshal(packet, &msg); err != nil {
+ return err
+ }
+
+ if msg.MaxPacketSize < minPacketLength || msg.MaxPacketSize > 1<<31 {
+ failMsg := channelOpenFailureMsg{
+ PeersID: msg.PeersID,
+ Reason: ConnectionFailed,
+ Message: "invalid request",
+ Language: "en_US.UTF-8",
+ }
+ return m.sendMessage(failMsg)
+ }
+
+ c := m.newChannel(msg.ChanType, channelInbound, msg.TypeSpecificData)
+ c.remoteId = msg.PeersID
+ c.maxRemotePayload = msg.MaxPacketSize
+ c.remoteWin.add(msg.PeersWindow)
+ m.incomingChannels <- c
+ return nil
+}
+
+func (m *mux) OpenChannel(chanType string, extra []byte) (Channel, <-chan *Request, error) {
+ ch, err := m.openChannel(chanType, extra)
+ if err != nil {
+ return nil, nil, err
+ }
+
+ return ch, ch.incomingRequests, nil
+}
+
+func (m *mux) openChannel(chanType string, extra []byte) (*channel, error) {
+ ch := m.newChannel(chanType, channelOutbound, extra)
+
+ ch.maxIncomingPayload = channelMaxPacket
+
+ open := channelOpenMsg{
+ ChanType: chanType,
+ PeersWindow: ch.myWindow,
+ MaxPacketSize: ch.maxIncomingPayload,
+ TypeSpecificData: extra,
+ PeersID: ch.localId,
+ }
+ if err := m.sendMessage(open); err != nil {
+ return nil, err
+ }
+
+ switch msg := (<-ch.msg).(type) {
+ case *channelOpenConfirmMsg:
+ return ch, nil
+ case *channelOpenFailureMsg:
+ return nil, &OpenChannelError{msg.Reason, msg.Message}
+ default:
+ return nil, fmt.Errorf("ssh: unexpected packet in response to channel open: %T", msg)
+ }
+}
+
+func (m *mux) handleUnknownChannelPacket(id uint32, packet []byte) error {
+ msg, err := decode(packet)
+ if err != nil {
+ return err
+ }
+
+ switch msg := msg.(type) {
+ // RFC 4254 section 5.4 says unrecognized channel requests should
+ // receive a failure response.
+ case *channelRequestMsg:
+ if msg.WantReply {
+ return m.sendMessage(channelRequestFailureMsg{
+ PeersID: msg.PeersID,
+ })
+ }
+ return nil
+ default:
+ return fmt.Errorf("ssh: invalid channel %d", id)
+ }
+}
diff --git a/vendor/golang.org/x/crypto/ssh/server.go b/vendor/golang.org/x/crypto/ssh/server.go
new file mode 100644
index 00000000..c2dfe326
--- /dev/null
+++ b/vendor/golang.org/x/crypto/ssh/server.go
@@ -0,0 +1,802 @@
+// Copyright 2011 The Go Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style
+// license that can be found in the LICENSE file.
+
+package ssh
+
+import (
+ "bytes"
+ "errors"
+ "fmt"
+ "io"
+ "net"
+ "strings"
+)
+
+// The Permissions type holds fine-grained permissions that are
+// specific to a user or a specific authentication method for a user.
+// The Permissions value for a successful authentication attempt is
+// available in ServerConn, so it can be used to pass information from
+// the user-authentication phase to the application layer.
+type Permissions struct {
+ // CriticalOptions indicate restrictions to the default
+ // permissions, and are typically used in conjunction with
+ // user certificates. The standard for SSH certificates
+ // defines "force-command" (only allow the given command to
+ // execute) and "source-address" (only allow connections from
+ // the given address). The SSH package currently only enforces
+ // the "source-address" critical option. It is up to server
+ // implementations to enforce other critical options, such as
+ // "force-command", by checking them after the SSH handshake
+ // is successful. In general, SSH servers should reject
+ // connections that specify critical options that are unknown
+ // or not supported.
+ CriticalOptions map[string]string
+
+ // Extensions are extra functionality that the server may
+ // offer on authenticated connections. Lack of support for an
+ // extension does not preclude authenticating a user. Common
+ // extensions are "permit-agent-forwarding",
+ // "permit-X11-forwarding". The Go SSH library currently does
+ // not act on any extension, and it is up to server
+ // implementations to honor them. Extensions can be used to
+ // pass data from the authentication callbacks to the server
+ // application layer.
+ Extensions map[string]string
+}
+
+type GSSAPIWithMICConfig struct {
+ // AllowLogin, must be set, is called when gssapi-with-mic
+ // authentication is selected (RFC 4462 section 3). The srcName is from the
+ // results of the GSS-API authentication. The format is username@DOMAIN.
+ // GSSAPI just guarantees to the server who the user is, but not if they can log in, and with what permissions.
+ // This callback is called after the user identity is established with GSSAPI to decide if the user can login with
+ // which permissions. If the user is allowed to login, it should return a nil error.
+ AllowLogin func(conn ConnMetadata, srcName string) (*Permissions, error)
+
+ // Server must be set. It's the implementation
+ // of the GSSAPIServer interface. See GSSAPIServer interface for details.
+ Server GSSAPIServer
+}
+
+// ServerConfig holds server specific configuration data.
+type ServerConfig struct {
+ // Config contains configuration shared between client and server.
+ Config
+
+ // PublicKeyAuthAlgorithms specifies the supported client public key
+ // authentication algorithms. Note that this should not include certificate
+ // types since those use the underlying algorithm. This list is sent to the
+ // client if it supports the server-sig-algs extension. Order is irrelevant.
+ // If unspecified then a default set of algorithms is used.
+ PublicKeyAuthAlgorithms []string
+
+ hostKeys []Signer
+
+ // NoClientAuth is true if clients are allowed to connect without
+ // authenticating.
+ // To determine NoClientAuth at runtime, set NoClientAuth to true
+ // and the optional NoClientAuthCallback to a non-nil value.
+ NoClientAuth bool
+
+ // NoClientAuthCallback, if non-nil, is called when a user
+ // attempts to authenticate with auth method "none".
+ // NoClientAuth must also be set to true for this be used, or
+ // this func is unused.
+ NoClientAuthCallback func(ConnMetadata) (*Permissions, error)
+
+ // MaxAuthTries specifies the maximum number of authentication attempts
+ // permitted per connection. If set to a negative number, the number of
+ // attempts are unlimited. If set to zero, the number of attempts are limited
+ // to 6.
+ MaxAuthTries int
+
+ // PasswordCallback, if non-nil, is called when a user
+ // attempts to authenticate using a password.
+ PasswordCallback func(conn ConnMetadata, password []byte) (*Permissions, error)
+
+ // PublicKeyCallback, if non-nil, is called when a client
+ // offers a public key for authentication. It must return a nil error
+ // if the given public key can be used to authenticate the
+ // given user. For example, see CertChecker.Authenticate. A
+ // call to this function does not guarantee that the key
+ // offered is in fact used to authenticate. To record any data
+ // depending on the public key, store it inside a
+ // Permissions.Extensions entry.
+ PublicKeyCallback func(conn ConnMetadata, key PublicKey) (*Permissions, error)
+
+ // KeyboardInteractiveCallback, if non-nil, is called when
+ // keyboard-interactive authentication is selected (RFC
+ // 4256). The client object's Challenge function should be
+ // used to query the user. The callback may offer multiple
+ // Challenge rounds. To avoid information leaks, the client
+ // should be presented a challenge even if the user is
+ // unknown.
+ KeyboardInteractiveCallback func(conn ConnMetadata, client KeyboardInteractiveChallenge) (*Permissions, error)
+
+ // AuthLogCallback, if non-nil, is called to log all authentication
+ // attempts.
+ AuthLogCallback func(conn ConnMetadata, method string, err error)
+
+ // ServerVersion is the version identification string to announce in
+ // the public handshake.
+ // If empty, a reasonable default is used.
+ // Note that RFC 4253 section 4.2 requires that this string start with
+ // "SSH-2.0-".
+ ServerVersion string
+
+ // BannerCallback, if present, is called and the return string is sent to
+ // the client after key exchange completed but before authentication.
+ BannerCallback func(conn ConnMetadata) string
+
+ // GSSAPIWithMICConfig includes gssapi server and callback, which if both non-nil, is used
+ // when gssapi-with-mic authentication is selected (RFC 4462 section 3).
+ GSSAPIWithMICConfig *GSSAPIWithMICConfig
+}
+
+// AddHostKey adds a private key as a host key. If an existing host
+// key exists with the same public key format, it is replaced. Each server
+// config must have at least one host key.
+func (s *ServerConfig) AddHostKey(key Signer) {
+ for i, k := range s.hostKeys {
+ if k.PublicKey().Type() == key.PublicKey().Type() {
+ s.hostKeys[i] = key
+ return
+ }
+ }
+
+ s.hostKeys = append(s.hostKeys, key)
+}
+
+// cachedPubKey contains the results of querying whether a public key is
+// acceptable for a user.
+type cachedPubKey struct {
+ user string
+ pubKeyData []byte
+ result error
+ perms *Permissions
+}
+
+const maxCachedPubKeys = 16
+
+// pubKeyCache caches tests for public keys. Since SSH clients
+// will query whether a public key is acceptable before attempting to
+// authenticate with it, we end up with duplicate queries for public
+// key validity. The cache only applies to a single ServerConn.
+type pubKeyCache struct {
+ keys []cachedPubKey
+}
+
+// get returns the result for a given user/algo/key tuple.
+func (c *pubKeyCache) get(user string, pubKeyData []byte) (cachedPubKey, bool) {
+ for _, k := range c.keys {
+ if k.user == user && bytes.Equal(k.pubKeyData, pubKeyData) {
+ return k, true
+ }
+ }
+ return cachedPubKey{}, false
+}
+
+// add adds the given tuple to the cache.
+func (c *pubKeyCache) add(candidate cachedPubKey) {
+ if len(c.keys) < maxCachedPubKeys {
+ c.keys = append(c.keys, candidate)
+ }
+}
+
+// ServerConn is an authenticated SSH connection, as seen from the
+// server
+type ServerConn struct {
+ Conn
+
+ // If the succeeding authentication callback returned a
+ // non-nil Permissions pointer, it is stored here.
+ Permissions *Permissions
+}
+
+// NewServerConn starts a new SSH server with c as the underlying
+// transport. It starts with a handshake and, if the handshake is
+// unsuccessful, it closes the connection and returns an error. The
+// Request and NewChannel channels must be serviced, or the connection
+// will hang.
+//
+// The returned error may be of type *ServerAuthError for
+// authentication errors.
+func NewServerConn(c net.Conn, config *ServerConfig) (*ServerConn, <-chan NewChannel, <-chan *Request, error) {
+ fullConf := *config
+ fullConf.SetDefaults()
+ if fullConf.MaxAuthTries == 0 {
+ fullConf.MaxAuthTries = 6
+ }
+ if len(fullConf.PublicKeyAuthAlgorithms) == 0 {
+ fullConf.PublicKeyAuthAlgorithms = supportedPubKeyAuthAlgos
+ } else {
+ for _, algo := range fullConf.PublicKeyAuthAlgorithms {
+ if !contains(supportedPubKeyAuthAlgos, algo) {
+ c.Close()
+ return nil, nil, nil, fmt.Errorf("ssh: unsupported public key authentication algorithm %s", algo)
+ }
+ }
+ }
+ // Check if the config contains any unsupported key exchanges
+ for _, kex := range fullConf.KeyExchanges {
+ if _, ok := serverForbiddenKexAlgos[kex]; ok {
+ c.Close()
+ return nil, nil, nil, fmt.Errorf("ssh: unsupported key exchange %s for server", kex)
+ }
+ }
+
+ s := &connection{
+ sshConn: sshConn{conn: c},
+ }
+ perms, err := s.serverHandshake(&fullConf)
+ if err != nil {
+ c.Close()
+ return nil, nil, nil, err
+ }
+ return &ServerConn{s, perms}, s.mux.incomingChannels, s.mux.incomingRequests, nil
+}
+
+// signAndMarshal signs the data with the appropriate algorithm,
+// and serializes the result in SSH wire format. algo is the negotiate
+// algorithm and may be a certificate type.
+func signAndMarshal(k AlgorithmSigner, rand io.Reader, data []byte, algo string) ([]byte, error) {
+ sig, err := k.SignWithAlgorithm(rand, data, underlyingAlgo(algo))
+ if err != nil {
+ return nil, err
+ }
+
+ return Marshal(sig), nil
+}
+
+// handshake performs key exchange and user authentication.
+func (s *connection) serverHandshake(config *ServerConfig) (*Permissions, error) {
+ if len(config.hostKeys) == 0 {
+ return nil, errors.New("ssh: server has no host keys")
+ }
+
+ if !config.NoClientAuth && config.PasswordCallback == nil && config.PublicKeyCallback == nil &&
+ config.KeyboardInteractiveCallback == nil && (config.GSSAPIWithMICConfig == nil ||
+ config.GSSAPIWithMICConfig.AllowLogin == nil || config.GSSAPIWithMICConfig.Server == nil) {
+ return nil, errors.New("ssh: no authentication methods configured but NoClientAuth is also false")
+ }
+
+ if config.ServerVersion != "" {
+ s.serverVersion = []byte(config.ServerVersion)
+ } else {
+ s.serverVersion = []byte(packageVersion)
+ }
+ var err error
+ s.clientVersion, err = exchangeVersions(s.sshConn.conn, s.serverVersion)
+ if err != nil {
+ return nil, err
+ }
+
+ tr := newTransport(s.sshConn.conn, config.Rand, false /* not client */)
+ s.transport = newServerTransport(tr, s.clientVersion, s.serverVersion, config)
+
+ if err := s.transport.waitSession(); err != nil {
+ return nil, err
+ }
+
+ // We just did the key change, so the session ID is established.
+ s.sessionID = s.transport.getSessionID()
+
+ var packet []byte
+ if packet, err = s.transport.readPacket(); err != nil {
+ return nil, err
+ }
+
+ var serviceRequest serviceRequestMsg
+ if err = Unmarshal(packet, &serviceRequest); err != nil {
+ return nil, err
+ }
+ if serviceRequest.Service != serviceUserAuth {
+ return nil, errors.New("ssh: requested service '" + serviceRequest.Service + "' before authenticating")
+ }
+ serviceAccept := serviceAcceptMsg{
+ Service: serviceUserAuth,
+ }
+ if err := s.transport.writePacket(Marshal(&serviceAccept)); err != nil {
+ return nil, err
+ }
+
+ perms, err := s.serverAuthenticate(config)
+ if err != nil {
+ return nil, err
+ }
+ s.mux = newMux(s.transport)
+ return perms, err
+}
+
+func checkSourceAddress(addr net.Addr, sourceAddrs string) error {
+ if addr == nil {
+ return errors.New("ssh: no address known for client, but source-address match required")
+ }
+
+ tcpAddr, ok := addr.(*net.TCPAddr)
+ if !ok {
+ return fmt.Errorf("ssh: remote address %v is not an TCP address when checking source-address match", addr)
+ }
+
+ for _, sourceAddr := range strings.Split(sourceAddrs, ",") {
+ if allowedIP := net.ParseIP(sourceAddr); allowedIP != nil {
+ if allowedIP.Equal(tcpAddr.IP) {
+ return nil
+ }
+ } else {
+ _, ipNet, err := net.ParseCIDR(sourceAddr)
+ if err != nil {
+ return fmt.Errorf("ssh: error parsing source-address restriction %q: %v", sourceAddr, err)
+ }
+
+ if ipNet.Contains(tcpAddr.IP) {
+ return nil
+ }
+ }
+ }
+
+ return fmt.Errorf("ssh: remote address %v is not allowed because of source-address restriction", addr)
+}
+
+func gssExchangeToken(gssapiConfig *GSSAPIWithMICConfig, token []byte, s *connection,
+ sessionID []byte, userAuthReq userAuthRequestMsg) (authErr error, perms *Permissions, err error) {
+ gssAPIServer := gssapiConfig.Server
+ defer gssAPIServer.DeleteSecContext()
+ var srcName string
+ for {
+ var (
+ outToken []byte
+ needContinue bool
+ )
+ outToken, srcName, needContinue, err = gssAPIServer.AcceptSecContext(token)
+ if err != nil {
+ return err, nil, nil
+ }
+ if len(outToken) != 0 {
+ if err := s.transport.writePacket(Marshal(&userAuthGSSAPIToken{
+ Token: outToken,
+ })); err != nil {
+ return nil, nil, err
+ }
+ }
+ if !needContinue {
+ break
+ }
+ packet, err := s.transport.readPacket()
+ if err != nil {
+ return nil, nil, err
+ }
+ userAuthGSSAPITokenReq := &userAuthGSSAPIToken{}
+ if err := Unmarshal(packet, userAuthGSSAPITokenReq); err != nil {
+ return nil, nil, err
+ }
+ token = userAuthGSSAPITokenReq.Token
+ }
+ packet, err := s.transport.readPacket()
+ if err != nil {
+ return nil, nil, err
+ }
+ userAuthGSSAPIMICReq := &userAuthGSSAPIMIC{}
+ if err := Unmarshal(packet, userAuthGSSAPIMICReq); err != nil {
+ return nil, nil, err
+ }
+ mic := buildMIC(string(sessionID), userAuthReq.User, userAuthReq.Service, userAuthReq.Method)
+ if err := gssAPIServer.VerifyMIC(mic, userAuthGSSAPIMICReq.MIC); err != nil {
+ return err, nil, nil
+ }
+ perms, authErr = gssapiConfig.AllowLogin(s, srcName)
+ return authErr, perms, nil
+}
+
+// isAlgoCompatible checks if the signature format is compatible with the
+// selected algorithm taking into account edge cases that occur with old
+// clients.
+func isAlgoCompatible(algo, sigFormat string) bool {
+ // Compatibility for old clients.
+ //
+ // For certificate authentication with OpenSSH 7.2-7.7 signature format can
+ // be rsa-sha2-256 or rsa-sha2-512 for the algorithm
+ // ssh-rsa-cert-v01@openssh.com.
+ //
+ // With gpg-agent < 2.2.6 the algorithm can be rsa-sha2-256 or rsa-sha2-512
+ // for signature format ssh-rsa.
+ if isRSA(algo) && isRSA(sigFormat) {
+ return true
+ }
+ // Standard case: the underlying algorithm must match the signature format.
+ return underlyingAlgo(algo) == sigFormat
+}
+
+// ServerAuthError represents server authentication errors and is
+// sometimes returned by NewServerConn. It appends any authentication
+// errors that may occur, and is returned if all of the authentication
+// methods provided by the user failed to authenticate.
+type ServerAuthError struct {
+ // Errors contains authentication errors returned by the authentication
+ // callback methods. The first entry is typically ErrNoAuth.
+ Errors []error
+}
+
+func (l ServerAuthError) Error() string {
+ var errs []string
+ for _, err := range l.Errors {
+ errs = append(errs, err.Error())
+ }
+ return "[" + strings.Join(errs, ", ") + "]"
+}
+
+// ErrNoAuth is the error value returned if no
+// authentication method has been passed yet. This happens as a normal
+// part of the authentication loop, since the client first tries
+// 'none' authentication to discover available methods.
+// It is returned in ServerAuthError.Errors from NewServerConn.
+var ErrNoAuth = errors.New("ssh: no auth passed yet")
+
+func (s *connection) serverAuthenticate(config *ServerConfig) (*Permissions, error) {
+ sessionID := s.transport.getSessionID()
+ var cache pubKeyCache
+ var perms *Permissions
+
+ authFailures := 0
+ var authErrs []error
+ var displayedBanner bool
+
+userAuthLoop:
+ for {
+ if authFailures >= config.MaxAuthTries && config.MaxAuthTries > 0 {
+ discMsg := &disconnectMsg{
+ Reason: 2,
+ Message: "too many authentication failures",
+ }
+
+ if err := s.transport.writePacket(Marshal(discMsg)); err != nil {
+ return nil, err
+ }
+
+ return nil, discMsg
+ }
+
+ var userAuthReq userAuthRequestMsg
+ if packet, err := s.transport.readPacket(); err != nil {
+ if err == io.EOF {
+ return nil, &ServerAuthError{Errors: authErrs}
+ }
+ return nil, err
+ } else if err = Unmarshal(packet, &userAuthReq); err != nil {
+ return nil, err
+ }
+
+ if userAuthReq.Service != serviceSSH {
+ return nil, errors.New("ssh: client attempted to negotiate for unknown service: " + userAuthReq.Service)
+ }
+
+ s.user = userAuthReq.User
+
+ if !displayedBanner && config.BannerCallback != nil {
+ displayedBanner = true
+ msg := config.BannerCallback(s)
+ if msg != "" {
+ bannerMsg := &userAuthBannerMsg{
+ Message: msg,
+ }
+ if err := s.transport.writePacket(Marshal(bannerMsg)); err != nil {
+ return nil, err
+ }
+ }
+ }
+
+ perms = nil
+ authErr := ErrNoAuth
+
+ switch userAuthReq.Method {
+ case "none":
+ if config.NoClientAuth {
+ if config.NoClientAuthCallback != nil {
+ perms, authErr = config.NoClientAuthCallback(s)
+ } else {
+ authErr = nil
+ }
+ }
+
+ // allow initial attempt of 'none' without penalty
+ if authFailures == 0 {
+ authFailures--
+ }
+ case "password":
+ if config.PasswordCallback == nil {
+ authErr = errors.New("ssh: password auth not configured")
+ break
+ }
+ payload := userAuthReq.Payload
+ if len(payload) < 1 || payload[0] != 0 {
+ return nil, parseError(msgUserAuthRequest)
+ }
+ payload = payload[1:]
+ password, payload, ok := parseString(payload)
+ if !ok || len(payload) > 0 {
+ return nil, parseError(msgUserAuthRequest)
+ }
+
+ perms, authErr = config.PasswordCallback(s, password)
+ case "keyboard-interactive":
+ if config.KeyboardInteractiveCallback == nil {
+ authErr = errors.New("ssh: keyboard-interactive auth not configured")
+ break
+ }
+
+ prompter := &sshClientKeyboardInteractive{s}
+ perms, authErr = config.KeyboardInteractiveCallback(s, prompter.Challenge)
+ case "publickey":
+ if config.PublicKeyCallback == nil {
+ authErr = errors.New("ssh: publickey auth not configured")
+ break
+ }
+ payload := userAuthReq.Payload
+ if len(payload) < 1 {
+ return nil, parseError(msgUserAuthRequest)
+ }
+ isQuery := payload[0] == 0
+ payload = payload[1:]
+ algoBytes, payload, ok := parseString(payload)
+ if !ok {
+ return nil, parseError(msgUserAuthRequest)
+ }
+ algo := string(algoBytes)
+ if !contains(config.PublicKeyAuthAlgorithms, underlyingAlgo(algo)) {
+ authErr = fmt.Errorf("ssh: algorithm %q not accepted", algo)
+ break
+ }
+
+ pubKeyData, payload, ok := parseString(payload)
+ if !ok {
+ return nil, parseError(msgUserAuthRequest)
+ }
+
+ pubKey, err := ParsePublicKey(pubKeyData)
+ if err != nil {
+ return nil, err
+ }
+
+ candidate, ok := cache.get(s.user, pubKeyData)
+ if !ok {
+ candidate.user = s.user
+ candidate.pubKeyData = pubKeyData
+ candidate.perms, candidate.result = config.PublicKeyCallback(s, pubKey)
+ if candidate.result == nil && candidate.perms != nil && candidate.perms.CriticalOptions != nil && candidate.perms.CriticalOptions[sourceAddressCriticalOption] != "" {
+ candidate.result = checkSourceAddress(
+ s.RemoteAddr(),
+ candidate.perms.CriticalOptions[sourceAddressCriticalOption])
+ }
+ cache.add(candidate)
+ }
+
+ if isQuery {
+ // The client can query if the given public key
+ // would be okay.
+
+ if len(payload) > 0 {
+ return nil, parseError(msgUserAuthRequest)
+ }
+
+ if candidate.result == nil {
+ okMsg := userAuthPubKeyOkMsg{
+ Algo: algo,
+ PubKey: pubKeyData,
+ }
+ if err = s.transport.writePacket(Marshal(&okMsg)); err != nil {
+ return nil, err
+ }
+ continue userAuthLoop
+ }
+ authErr = candidate.result
+ } else {
+ sig, payload, ok := parseSignature(payload)
+ if !ok || len(payload) > 0 {
+ return nil, parseError(msgUserAuthRequest)
+ }
+ // Ensure the declared public key algo is compatible with the
+ // decoded one. This check will ensure we don't accept e.g.
+ // ssh-rsa-cert-v01@openssh.com algorithm with ssh-rsa public
+ // key type. The algorithm and public key type must be
+ // consistent: both must be certificate algorithms, or neither.
+ if !contains(algorithmsForKeyFormat(pubKey.Type()), algo) {
+ authErr = fmt.Errorf("ssh: public key type %q not compatible with selected algorithm %q",
+ pubKey.Type(), algo)
+ break
+ }
+ // Ensure the public key algo and signature algo
+ // are supported. Compare the private key
+ // algorithm name that corresponds to algo with
+ // sig.Format. This is usually the same, but
+ // for certs, the names differ.
+ if !contains(config.PublicKeyAuthAlgorithms, sig.Format) {
+ authErr = fmt.Errorf("ssh: algorithm %q not accepted", sig.Format)
+ break
+ }
+ if !isAlgoCompatible(algo, sig.Format) {
+ authErr = fmt.Errorf("ssh: signature %q not compatible with selected algorithm %q", sig.Format, algo)
+ break
+ }
+
+ signedData := buildDataSignedForAuth(sessionID, userAuthReq, algo, pubKeyData)
+
+ if err := pubKey.Verify(signedData, sig); err != nil {
+ return nil, err
+ }
+
+ authErr = candidate.result
+ perms = candidate.perms
+ }
+ case "gssapi-with-mic":
+ if config.GSSAPIWithMICConfig == nil {
+ authErr = errors.New("ssh: gssapi-with-mic auth not configured")
+ break
+ }
+ gssapiConfig := config.GSSAPIWithMICConfig
+ userAuthRequestGSSAPI, err := parseGSSAPIPayload(userAuthReq.Payload)
+ if err != nil {
+ return nil, parseError(msgUserAuthRequest)
+ }
+ // OpenSSH supports Kerberos V5 mechanism only for GSS-API authentication.
+ if userAuthRequestGSSAPI.N == 0 {
+ authErr = fmt.Errorf("ssh: Mechanism negotiation is not supported")
+ break
+ }
+ var i uint32
+ present := false
+ for i = 0; i < userAuthRequestGSSAPI.N; i++ {
+ if userAuthRequestGSSAPI.OIDS[i].Equal(krb5Mesh) {
+ present = true
+ break
+ }
+ }
+ if !present {
+ authErr = fmt.Errorf("ssh: GSSAPI authentication must use the Kerberos V5 mechanism")
+ break
+ }
+ // Initial server response, see RFC 4462 section 3.3.
+ if err := s.transport.writePacket(Marshal(&userAuthGSSAPIResponse{
+ SupportMech: krb5OID,
+ })); err != nil {
+ return nil, err
+ }
+ // Exchange token, see RFC 4462 section 3.4.
+ packet, err := s.transport.readPacket()
+ if err != nil {
+ return nil, err
+ }
+ userAuthGSSAPITokenReq := &userAuthGSSAPIToken{}
+ if err := Unmarshal(packet, userAuthGSSAPITokenReq); err != nil {
+ return nil, err
+ }
+ authErr, perms, err = gssExchangeToken(gssapiConfig, userAuthGSSAPITokenReq.Token, s, sessionID,
+ userAuthReq)
+ if err != nil {
+ return nil, err
+ }
+ default:
+ authErr = fmt.Errorf("ssh: unknown method %q", userAuthReq.Method)
+ }
+
+ authErrs = append(authErrs, authErr)
+
+ if config.AuthLogCallback != nil {
+ config.AuthLogCallback(s, userAuthReq.Method, authErr)
+ }
+
+ if authErr == nil {
+ break userAuthLoop
+ }
+
+ authFailures++
+ if config.MaxAuthTries > 0 && authFailures >= config.MaxAuthTries {
+ // If we have hit the max attempts, don't bother sending the
+ // final SSH_MSG_USERAUTH_FAILURE message, since there are
+ // no more authentication methods which can be attempted,
+ // and this message may cause the client to re-attempt
+ // authentication while we send the disconnect message.
+ // Continue, and trigger the disconnect at the start of
+ // the loop.
+ //
+ // The SSH specification is somewhat confusing about this,
+ // RFC 4252 Section 5.1 requires each authentication failure
+ // be responded to with a respective SSH_MSG_USERAUTH_FAILURE
+ // message, but Section 4 says the server should disconnect
+ // after some number of attempts, but it isn't explicit which
+ // message should take precedence (i.e. should there be a failure
+ // message than a disconnect message, or if we are going to
+ // disconnect, should we only send that message.)
+ //
+ // Either way, OpenSSH disconnects immediately after the last
+ // failed authnetication attempt, and given they are typically
+ // considered the golden implementation it seems reasonable
+ // to match that behavior.
+ continue
+ }
+
+ var failureMsg userAuthFailureMsg
+ if config.PasswordCallback != nil {
+ failureMsg.Methods = append(failureMsg.Methods, "password")
+ }
+ if config.PublicKeyCallback != nil {
+ failureMsg.Methods = append(failureMsg.Methods, "publickey")
+ }
+ if config.KeyboardInteractiveCallback != nil {
+ failureMsg.Methods = append(failureMsg.Methods, "keyboard-interactive")
+ }
+ if config.GSSAPIWithMICConfig != nil && config.GSSAPIWithMICConfig.Server != nil &&
+ config.GSSAPIWithMICConfig.AllowLogin != nil {
+ failureMsg.Methods = append(failureMsg.Methods, "gssapi-with-mic")
+ }
+
+ if len(failureMsg.Methods) == 0 {
+ return nil, errors.New("ssh: no authentication methods configured but NoClientAuth is also false")
+ }
+
+ if err := s.transport.writePacket(Marshal(&failureMsg)); err != nil {
+ return nil, err
+ }
+ }
+
+ if err := s.transport.writePacket([]byte{msgUserAuthSuccess}); err != nil {
+ return nil, err
+ }
+ return perms, nil
+}
+
+// sshClientKeyboardInteractive implements a ClientKeyboardInteractive by
+// asking the client on the other side of a ServerConn.
+type sshClientKeyboardInteractive struct {
+ *connection
+}
+
+func (c *sshClientKeyboardInteractive) Challenge(name, instruction string, questions []string, echos []bool) (answers []string, err error) {
+ if len(questions) != len(echos) {
+ return nil, errors.New("ssh: echos and questions must have equal length")
+ }
+
+ var prompts []byte
+ for i := range questions {
+ prompts = appendString(prompts, questions[i])
+ prompts = appendBool(prompts, echos[i])
+ }
+
+ if err := c.transport.writePacket(Marshal(&userAuthInfoRequestMsg{
+ Name: name,
+ Instruction: instruction,
+ NumPrompts: uint32(len(questions)),
+ Prompts: prompts,
+ })); err != nil {
+ return nil, err
+ }
+
+ packet, err := c.transport.readPacket()
+ if err != nil {
+ return nil, err
+ }
+ if packet[0] != msgUserAuthInfoResponse {
+ return nil, unexpectedMessageError(msgUserAuthInfoResponse, packet[0])
+ }
+ packet = packet[1:]
+
+ n, packet, ok := parseUint32(packet)
+ if !ok || int(n) != len(questions) {
+ return nil, parseError(msgUserAuthInfoResponse)
+ }
+
+ for i := uint32(0); i < n; i++ {
+ ans, rest, ok := parseString(packet)
+ if !ok {
+ return nil, parseError(msgUserAuthInfoResponse)
+ }
+
+ answers = append(answers, string(ans))
+ packet = rest
+ }
+ if len(packet) != 0 {
+ return nil, errors.New("ssh: junk at end of message")
+ }
+
+ return answers, nil
+}
diff --git a/vendor/golang.org/x/crypto/ssh/session.go b/vendor/golang.org/x/crypto/ssh/session.go
new file mode 100644
index 00000000..acef6225
--- /dev/null
+++ b/vendor/golang.org/x/crypto/ssh/session.go
@@ -0,0 +1,647 @@
+// Copyright 2011 The Go Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style
+// license that can be found in the LICENSE file.
+
+package ssh
+
+// Session implements an interactive session described in
+// "RFC 4254, section 6".
+
+import (
+ "bytes"
+ "encoding/binary"
+ "errors"
+ "fmt"
+ "io"
+ "sync"
+)
+
+type Signal string
+
+// POSIX signals as listed in RFC 4254 Section 6.10.
+const (
+ SIGABRT Signal = "ABRT"
+ SIGALRM Signal = "ALRM"
+ SIGFPE Signal = "FPE"
+ SIGHUP Signal = "HUP"
+ SIGILL Signal = "ILL"
+ SIGINT Signal = "INT"
+ SIGKILL Signal = "KILL"
+ SIGPIPE Signal = "PIPE"
+ SIGQUIT Signal = "QUIT"
+ SIGSEGV Signal = "SEGV"
+ SIGTERM Signal = "TERM"
+ SIGUSR1 Signal = "USR1"
+ SIGUSR2 Signal = "USR2"
+)
+
+var signals = map[Signal]int{
+ SIGABRT: 6,
+ SIGALRM: 14,
+ SIGFPE: 8,
+ SIGHUP: 1,
+ SIGILL: 4,
+ SIGINT: 2,
+ SIGKILL: 9,
+ SIGPIPE: 13,
+ SIGQUIT: 3,
+ SIGSEGV: 11,
+ SIGTERM: 15,
+}
+
+type TerminalModes map[uint8]uint32
+
+// POSIX terminal mode flags as listed in RFC 4254 Section 8.
+const (
+ tty_OP_END = 0
+ VINTR = 1
+ VQUIT = 2
+ VERASE = 3
+ VKILL = 4
+ VEOF = 5
+ VEOL = 6
+ VEOL2 = 7
+ VSTART = 8
+ VSTOP = 9
+ VSUSP = 10
+ VDSUSP = 11
+ VREPRINT = 12
+ VWERASE = 13
+ VLNEXT = 14
+ VFLUSH = 15
+ VSWTCH = 16
+ VSTATUS = 17
+ VDISCARD = 18
+ IGNPAR = 30
+ PARMRK = 31
+ INPCK = 32
+ ISTRIP = 33
+ INLCR = 34
+ IGNCR = 35
+ ICRNL = 36
+ IUCLC = 37
+ IXON = 38
+ IXANY = 39
+ IXOFF = 40
+ IMAXBEL = 41
+ IUTF8 = 42 // RFC 8160
+ ISIG = 50
+ ICANON = 51
+ XCASE = 52
+ ECHO = 53
+ ECHOE = 54
+ ECHOK = 55
+ ECHONL = 56
+ NOFLSH = 57
+ TOSTOP = 58
+ IEXTEN = 59
+ ECHOCTL = 60
+ ECHOKE = 61
+ PENDIN = 62
+ OPOST = 70
+ OLCUC = 71
+ ONLCR = 72
+ OCRNL = 73
+ ONOCR = 74
+ ONLRET = 75
+ CS7 = 90
+ CS8 = 91
+ PARENB = 92
+ PARODD = 93
+ TTY_OP_ISPEED = 128
+ TTY_OP_OSPEED = 129
+)
+
+// A Session represents a connection to a remote command or shell.
+type Session struct {
+ // Stdin specifies the remote process's standard input.
+ // If Stdin is nil, the remote process reads from an empty
+ // bytes.Buffer.
+ Stdin io.Reader
+
+ // Stdout and Stderr specify the remote process's standard
+ // output and error.
+ //
+ // If either is nil, Run connects the corresponding file
+ // descriptor to an instance of io.Discard. There is a
+ // fixed amount of buffering that is shared for the two streams.
+ // If either blocks it may eventually cause the remote
+ // command to block.
+ Stdout io.Writer
+ Stderr io.Writer
+
+ ch Channel // the channel backing this session
+ started bool // true once Start, Run or Shell is invoked.
+ copyFuncs []func() error
+ errors chan error // one send per copyFunc
+
+ // true if pipe method is active
+ stdinpipe, stdoutpipe, stderrpipe bool
+
+ // stdinPipeWriter is non-nil if StdinPipe has not been called
+ // and Stdin was specified by the user; it is the write end of
+ // a pipe connecting Session.Stdin to the stdin channel.
+ stdinPipeWriter io.WriteCloser
+
+ exitStatus chan error
+}
+
+// SendRequest sends an out-of-band channel request on the SSH channel
+// underlying the session.
+func (s *Session) SendRequest(name string, wantReply bool, payload []byte) (bool, error) {
+ return s.ch.SendRequest(name, wantReply, payload)
+}
+
+func (s *Session) Close() error {
+ return s.ch.Close()
+}
+
+// RFC 4254 Section 6.4.
+type setenvRequest struct {
+ Name string
+ Value string
+}
+
+// Setenv sets an environment variable that will be applied to any
+// command executed by Shell or Run.
+func (s *Session) Setenv(name, value string) error {
+ msg := setenvRequest{
+ Name: name,
+ Value: value,
+ }
+ ok, err := s.ch.SendRequest("env", true, Marshal(&msg))
+ if err == nil && !ok {
+ err = errors.New("ssh: setenv failed")
+ }
+ return err
+}
+
+// RFC 4254 Section 6.2.
+type ptyRequestMsg struct {
+ Term string
+ Columns uint32
+ Rows uint32
+ Width uint32
+ Height uint32
+ Modelist string
+}
+
+// RequestPty requests the association of a pty with the session on the remote host.
+func (s *Session) RequestPty(term string, h, w int, termmodes TerminalModes) error {
+ var tm []byte
+ for k, v := range termmodes {
+ kv := struct {
+ Key byte
+ Val uint32
+ }{k, v}
+
+ tm = append(tm, Marshal(&kv)...)
+ }
+ tm = append(tm, tty_OP_END)
+ req := ptyRequestMsg{
+ Term: term,
+ Columns: uint32(w),
+ Rows: uint32(h),
+ Width: uint32(w * 8),
+ Height: uint32(h * 8),
+ Modelist: string(tm),
+ }
+ ok, err := s.ch.SendRequest("pty-req", true, Marshal(&req))
+ if err == nil && !ok {
+ err = errors.New("ssh: pty-req failed")
+ }
+ return err
+}
+
+// RFC 4254 Section 6.5.
+type subsystemRequestMsg struct {
+ Subsystem string
+}
+
+// RequestSubsystem requests the association of a subsystem with the session on the remote host.
+// A subsystem is a predefined command that runs in the background when the ssh session is initiated
+func (s *Session) RequestSubsystem(subsystem string) error {
+ msg := subsystemRequestMsg{
+ Subsystem: subsystem,
+ }
+ ok, err := s.ch.SendRequest("subsystem", true, Marshal(&msg))
+ if err == nil && !ok {
+ err = errors.New("ssh: subsystem request failed")
+ }
+ return err
+}
+
+// RFC 4254 Section 6.7.
+type ptyWindowChangeMsg struct {
+ Columns uint32
+ Rows uint32
+ Width uint32
+ Height uint32
+}
+
+// WindowChange informs the remote host about a terminal window dimension change to h rows and w columns.
+func (s *Session) WindowChange(h, w int) error {
+ req := ptyWindowChangeMsg{
+ Columns: uint32(w),
+ Rows: uint32(h),
+ Width: uint32(w * 8),
+ Height: uint32(h * 8),
+ }
+ _, err := s.ch.SendRequest("window-change", false, Marshal(&req))
+ return err
+}
+
+// RFC 4254 Section 6.9.
+type signalMsg struct {
+ Signal string
+}
+
+// Signal sends the given signal to the remote process.
+// sig is one of the SIG* constants.
+func (s *Session) Signal(sig Signal) error {
+ msg := signalMsg{
+ Signal: string(sig),
+ }
+
+ _, err := s.ch.SendRequest("signal", false, Marshal(&msg))
+ return err
+}
+
+// RFC 4254 Section 6.5.
+type execMsg struct {
+ Command string
+}
+
+// Start runs cmd on the remote host. Typically, the remote
+// server passes cmd to the shell for interpretation.
+// A Session only accepts one call to Run, Start or Shell.
+func (s *Session) Start(cmd string) error {
+ if s.started {
+ return errors.New("ssh: session already started")
+ }
+ req := execMsg{
+ Command: cmd,
+ }
+
+ ok, err := s.ch.SendRequest("exec", true, Marshal(&req))
+ if err == nil && !ok {
+ err = fmt.Errorf("ssh: command %v failed", cmd)
+ }
+ if err != nil {
+ return err
+ }
+ return s.start()
+}
+
+// Run runs cmd on the remote host. Typically, the remote
+// server passes cmd to the shell for interpretation.
+// A Session only accepts one call to Run, Start, Shell, Output,
+// or CombinedOutput.
+//
+// The returned error is nil if the command runs, has no problems
+// copying stdin, stdout, and stderr, and exits with a zero exit
+// status.
+//
+// If the remote server does not send an exit status, an error of type
+// *ExitMissingError is returned. If the command completes
+// unsuccessfully or is interrupted by a signal, the error is of type
+// *ExitError. Other error types may be returned for I/O problems.
+func (s *Session) Run(cmd string) error {
+ err := s.Start(cmd)
+ if err != nil {
+ return err
+ }
+ return s.Wait()
+}
+
+// Output runs cmd on the remote host and returns its standard output.
+func (s *Session) Output(cmd string) ([]byte, error) {
+ if s.Stdout != nil {
+ return nil, errors.New("ssh: Stdout already set")
+ }
+ var b bytes.Buffer
+ s.Stdout = &b
+ err := s.Run(cmd)
+ return b.Bytes(), err
+}
+
+type singleWriter struct {
+ b bytes.Buffer
+ mu sync.Mutex
+}
+
+func (w *singleWriter) Write(p []byte) (int, error) {
+ w.mu.Lock()
+ defer w.mu.Unlock()
+ return w.b.Write(p)
+}
+
+// CombinedOutput runs cmd on the remote host and returns its combined
+// standard output and standard error.
+func (s *Session) CombinedOutput(cmd string) ([]byte, error) {
+ if s.Stdout != nil {
+ return nil, errors.New("ssh: Stdout already set")
+ }
+ if s.Stderr != nil {
+ return nil, errors.New("ssh: Stderr already set")
+ }
+ var b singleWriter
+ s.Stdout = &b
+ s.Stderr = &b
+ err := s.Run(cmd)
+ return b.b.Bytes(), err
+}
+
+// Shell starts a login shell on the remote host. A Session only
+// accepts one call to Run, Start, Shell, Output, or CombinedOutput.
+func (s *Session) Shell() error {
+ if s.started {
+ return errors.New("ssh: session already started")
+ }
+
+ ok, err := s.ch.SendRequest("shell", true, nil)
+ if err == nil && !ok {
+ return errors.New("ssh: could not start shell")
+ }
+ if err != nil {
+ return err
+ }
+ return s.start()
+}
+
+func (s *Session) start() error {
+ s.started = true
+
+ type F func(*Session)
+ for _, setupFd := range []F{(*Session).stdin, (*Session).stdout, (*Session).stderr} {
+ setupFd(s)
+ }
+
+ s.errors = make(chan error, len(s.copyFuncs))
+ for _, fn := range s.copyFuncs {
+ go func(fn func() error) {
+ s.errors <- fn()
+ }(fn)
+ }
+ return nil
+}
+
+// Wait waits for the remote command to exit.
+//
+// The returned error is nil if the command runs, has no problems
+// copying stdin, stdout, and stderr, and exits with a zero exit
+// status.
+//
+// If the remote server does not send an exit status, an error of type
+// *ExitMissingError is returned. If the command completes
+// unsuccessfully or is interrupted by a signal, the error is of type
+// *ExitError. Other error types may be returned for I/O problems.
+func (s *Session) Wait() error {
+ if !s.started {
+ return errors.New("ssh: session not started")
+ }
+ waitErr := <-s.exitStatus
+
+ if s.stdinPipeWriter != nil {
+ s.stdinPipeWriter.Close()
+ }
+ var copyError error
+ for range s.copyFuncs {
+ if err := <-s.errors; err != nil && copyError == nil {
+ copyError = err
+ }
+ }
+ if waitErr != nil {
+ return waitErr
+ }
+ return copyError
+}
+
+func (s *Session) wait(reqs <-chan *Request) error {
+ wm := Waitmsg{status: -1}
+ // Wait for msg channel to be closed before returning.
+ for msg := range reqs {
+ switch msg.Type {
+ case "exit-status":
+ wm.status = int(binary.BigEndian.Uint32(msg.Payload))
+ case "exit-signal":
+ var sigval struct {
+ Signal string
+ CoreDumped bool
+ Error string
+ Lang string
+ }
+ if err := Unmarshal(msg.Payload, &sigval); err != nil {
+ return err
+ }
+
+ // Must sanitize strings?
+ wm.signal = sigval.Signal
+ wm.msg = sigval.Error
+ wm.lang = sigval.Lang
+ default:
+ // This handles keepalives and matches
+ // OpenSSH's behaviour.
+ if msg.WantReply {
+ msg.Reply(false, nil)
+ }
+ }
+ }
+ if wm.status == 0 {
+ return nil
+ }
+ if wm.status == -1 {
+ // exit-status was never sent from server
+ if wm.signal == "" {
+ // signal was not sent either. RFC 4254
+ // section 6.10 recommends against this
+ // behavior, but it is allowed, so we let
+ // clients handle it.
+ return &ExitMissingError{}
+ }
+ wm.status = 128
+ if _, ok := signals[Signal(wm.signal)]; ok {
+ wm.status += signals[Signal(wm.signal)]
+ }
+ }
+
+ return &ExitError{wm}
+}
+
+// ExitMissingError is returned if a session is torn down cleanly, but
+// the server sends no confirmation of the exit status.
+type ExitMissingError struct{}
+
+func (e *ExitMissingError) Error() string {
+ return "wait: remote command exited without exit status or exit signal"
+}
+
+func (s *Session) stdin() {
+ if s.stdinpipe {
+ return
+ }
+ var stdin io.Reader
+ if s.Stdin == nil {
+ stdin = new(bytes.Buffer)
+ } else {
+ r, w := io.Pipe()
+ go func() {
+ _, err := io.Copy(w, s.Stdin)
+ w.CloseWithError(err)
+ }()
+ stdin, s.stdinPipeWriter = r, w
+ }
+ s.copyFuncs = append(s.copyFuncs, func() error {
+ _, err := io.Copy(s.ch, stdin)
+ if err1 := s.ch.CloseWrite(); err == nil && err1 != io.EOF {
+ err = err1
+ }
+ return err
+ })
+}
+
+func (s *Session) stdout() {
+ if s.stdoutpipe {
+ return
+ }
+ if s.Stdout == nil {
+ s.Stdout = io.Discard
+ }
+ s.copyFuncs = append(s.copyFuncs, func() error {
+ _, err := io.Copy(s.Stdout, s.ch)
+ return err
+ })
+}
+
+func (s *Session) stderr() {
+ if s.stderrpipe {
+ return
+ }
+ if s.Stderr == nil {
+ s.Stderr = io.Discard
+ }
+ s.copyFuncs = append(s.copyFuncs, func() error {
+ _, err := io.Copy(s.Stderr, s.ch.Stderr())
+ return err
+ })
+}
+
+// sessionStdin reroutes Close to CloseWrite.
+type sessionStdin struct {
+ io.Writer
+ ch Channel
+}
+
+func (s *sessionStdin) Close() error {
+ return s.ch.CloseWrite()
+}
+
+// StdinPipe returns a pipe that will be connected to the
+// remote command's standard input when the command starts.
+func (s *Session) StdinPipe() (io.WriteCloser, error) {
+ if s.Stdin != nil {
+ return nil, errors.New("ssh: Stdin already set")
+ }
+ if s.started {
+ return nil, errors.New("ssh: StdinPipe after process started")
+ }
+ s.stdinpipe = true
+ return &sessionStdin{s.ch, s.ch}, nil
+}
+
+// StdoutPipe returns a pipe that will be connected to the
+// remote command's standard output when the command starts.
+// There is a fixed amount of buffering that is shared between
+// stdout and stderr streams. If the StdoutPipe reader is
+// not serviced fast enough it may eventually cause the
+// remote command to block.
+func (s *Session) StdoutPipe() (io.Reader, error) {
+ if s.Stdout != nil {
+ return nil, errors.New("ssh: Stdout already set")
+ }
+ if s.started {
+ return nil, errors.New("ssh: StdoutPipe after process started")
+ }
+ s.stdoutpipe = true
+ return s.ch, nil
+}
+
+// StderrPipe returns a pipe that will be connected to the
+// remote command's standard error when the command starts.
+// There is a fixed amount of buffering that is shared between
+// stdout and stderr streams. If the StderrPipe reader is
+// not serviced fast enough it may eventually cause the
+// remote command to block.
+func (s *Session) StderrPipe() (io.Reader, error) {
+ if s.Stderr != nil {
+ return nil, errors.New("ssh: Stderr already set")
+ }
+ if s.started {
+ return nil, errors.New("ssh: StderrPipe after process started")
+ }
+ s.stderrpipe = true
+ return s.ch.Stderr(), nil
+}
+
+// newSession returns a new interactive session on the remote host.
+func newSession(ch Channel, reqs <-chan *Request) (*Session, error) {
+ s := &Session{
+ ch: ch,
+ }
+ s.exitStatus = make(chan error, 1)
+ go func() {
+ s.exitStatus <- s.wait(reqs)
+ }()
+
+ return s, nil
+}
+
+// An ExitError reports unsuccessful completion of a remote command.
+type ExitError struct {
+ Waitmsg
+}
+
+func (e *ExitError) Error() string {
+ return e.Waitmsg.String()
+}
+
+// Waitmsg stores the information about an exited remote command
+// as reported by Wait.
+type Waitmsg struct {
+ status int
+ signal string
+ msg string
+ lang string
+}
+
+// ExitStatus returns the exit status of the remote command.
+func (w Waitmsg) ExitStatus() int {
+ return w.status
+}
+
+// Signal returns the exit signal of the remote command if
+// it was terminated violently.
+func (w Waitmsg) Signal() string {
+ return w.signal
+}
+
+// Msg returns the exit message given by the remote command
+func (w Waitmsg) Msg() string {
+ return w.msg
+}
+
+// Lang returns the language tag. See RFC 3066
+func (w Waitmsg) Lang() string {
+ return w.lang
+}
+
+func (w Waitmsg) String() string {
+ str := fmt.Sprintf("Process exited with status %v", w.status)
+ if w.signal != "" {
+ str += fmt.Sprintf(" from signal %v", w.signal)
+ }
+ if w.msg != "" {
+ str += fmt.Sprintf(". Reason was: %v", w.msg)
+ }
+ return str
+}
diff --git a/vendor/golang.org/x/crypto/ssh/ssh_gss.go b/vendor/golang.org/x/crypto/ssh/ssh_gss.go
new file mode 100644
index 00000000..24bd7c8e
--- /dev/null
+++ b/vendor/golang.org/x/crypto/ssh/ssh_gss.go
@@ -0,0 +1,139 @@
+// Copyright 2011 The Go Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style
+// license that can be found in the LICENSE file.
+
+package ssh
+
+import (
+ "encoding/asn1"
+ "errors"
+)
+
+var krb5OID []byte
+
+func init() {
+ krb5OID, _ = asn1.Marshal(krb5Mesh)
+}
+
+// GSSAPIClient provides the API to plug-in GSSAPI authentication for client logins.
+type GSSAPIClient interface {
+ // InitSecContext initiates the establishment of a security context for GSS-API between the
+ // ssh client and ssh server. Initially the token parameter should be specified as nil.
+ // The routine may return a outputToken which should be transferred to
+ // the ssh server, where the ssh server will present it to
+ // AcceptSecContext. If no token need be sent, InitSecContext will indicate this by setting
+ // needContinue to false. To complete the context
+ // establishment, one or more reply tokens may be required from the ssh
+ // server;if so, InitSecContext will return a needContinue which is true.
+ // In this case, InitSecContext should be called again when the
+ // reply token is received from the ssh server, passing the reply
+ // token to InitSecContext via the token parameters.
+ // See RFC 2743 section 2.2.1 and RFC 4462 section 3.4.
+ InitSecContext(target string, token []byte, isGSSDelegCreds bool) (outputToken []byte, needContinue bool, err error)
+ // GetMIC generates a cryptographic MIC for the SSH2 message, and places
+ // the MIC in a token for transfer to the ssh server.
+ // The contents of the MIC field are obtained by calling GSS_GetMIC()
+ // over the following, using the GSS-API context that was just
+ // established:
+ // string session identifier
+ // byte SSH_MSG_USERAUTH_REQUEST
+ // string user name
+ // string service
+ // string "gssapi-with-mic"
+ // See RFC 2743 section 2.3.1 and RFC 4462 3.5.
+ GetMIC(micFiled []byte) ([]byte, error)
+ // Whenever possible, it should be possible for
+ // DeleteSecContext() calls to be successfully processed even
+ // if other calls cannot succeed, thereby enabling context-related
+ // resources to be released.
+ // In addition to deleting established security contexts,
+ // gss_delete_sec_context must also be able to delete "half-built"
+ // security contexts resulting from an incomplete sequence of
+ // InitSecContext()/AcceptSecContext() calls.
+ // See RFC 2743 section 2.2.3.
+ DeleteSecContext() error
+}
+
+// GSSAPIServer provides the API to plug in GSSAPI authentication for server logins.
+type GSSAPIServer interface {
+ // AcceptSecContext allows a remotely initiated security context between the application
+ // and a remote peer to be established by the ssh client. The routine may return a
+ // outputToken which should be transferred to the ssh client,
+ // where the ssh client will present it to InitSecContext.
+ // If no token need be sent, AcceptSecContext will indicate this
+ // by setting the needContinue to false. To
+ // complete the context establishment, one or more reply tokens may be
+ // required from the ssh client. if so, AcceptSecContext
+ // will return a needContinue which is true, in which case it
+ // should be called again when the reply token is received from the ssh
+ // client, passing the token to AcceptSecContext via the
+ // token parameters.
+ // The srcName return value is the authenticated username.
+ // See RFC 2743 section 2.2.2 and RFC 4462 section 3.4.
+ AcceptSecContext(token []byte) (outputToken []byte, srcName string, needContinue bool, err error)
+ // VerifyMIC verifies that a cryptographic MIC, contained in the token parameter,
+ // fits the supplied message is received from the ssh client.
+ // See RFC 2743 section 2.3.2.
+ VerifyMIC(micField []byte, micToken []byte) error
+ // Whenever possible, it should be possible for
+ // DeleteSecContext() calls to be successfully processed even
+ // if other calls cannot succeed, thereby enabling context-related
+ // resources to be released.
+ // In addition to deleting established security contexts,
+ // gss_delete_sec_context must also be able to delete "half-built"
+ // security contexts resulting from an incomplete sequence of
+ // InitSecContext()/AcceptSecContext() calls.
+ // See RFC 2743 section 2.2.3.
+ DeleteSecContext() error
+}
+
+var (
+ // OpenSSH supports Kerberos V5 mechanism only for GSS-API authentication,
+ // so we also support the krb5 mechanism only.
+ // See RFC 1964 section 1.
+ krb5Mesh = asn1.ObjectIdentifier{1, 2, 840, 113554, 1, 2, 2}
+)
+
+// The GSS-API authentication method is initiated when the client sends an SSH_MSG_USERAUTH_REQUEST
+// See RFC 4462 section 3.2.
+type userAuthRequestGSSAPI struct {
+ N uint32
+ OIDS []asn1.ObjectIdentifier
+}
+
+func parseGSSAPIPayload(payload []byte) (*userAuthRequestGSSAPI, error) {
+ n, rest, ok := parseUint32(payload)
+ if !ok {
+ return nil, errors.New("parse uint32 failed")
+ }
+ s := &userAuthRequestGSSAPI{
+ N: n,
+ OIDS: make([]asn1.ObjectIdentifier, n),
+ }
+ for i := 0; i < int(n); i++ {
+ var (
+ desiredMech []byte
+ err error
+ )
+ desiredMech, rest, ok = parseString(rest)
+ if !ok {
+ return nil, errors.New("parse string failed")
+ }
+ if rest, err = asn1.Unmarshal(desiredMech, &s.OIDS[i]); err != nil {
+ return nil, err
+ }
+
+ }
+ return s, nil
+}
+
+// See RFC 4462 section 3.6.
+func buildMIC(sessionID string, username string, service string, authMethod string) []byte {
+ out := make([]byte, 0, 0)
+ out = appendString(out, sessionID)
+ out = append(out, msgUserAuthRequest)
+ out = appendString(out, username)
+ out = appendString(out, service)
+ out = appendString(out, authMethod)
+ return out
+}
diff --git a/vendor/golang.org/x/crypto/ssh/streamlocal.go b/vendor/golang.org/x/crypto/ssh/streamlocal.go
new file mode 100644
index 00000000..b171b330
--- /dev/null
+++ b/vendor/golang.org/x/crypto/ssh/streamlocal.go
@@ -0,0 +1,116 @@
+package ssh
+
+import (
+ "errors"
+ "io"
+ "net"
+)
+
+// streamLocalChannelOpenDirectMsg is a struct used for SSH_MSG_CHANNEL_OPEN message
+// with "direct-streamlocal@openssh.com" string.
+//
+// See openssh-portable/PROTOCOL, section 2.4. connection: Unix domain socket forwarding
+// https://github.com/openssh/openssh-portable/blob/master/PROTOCOL#L235
+type streamLocalChannelOpenDirectMsg struct {
+ socketPath string
+ reserved0 string
+ reserved1 uint32
+}
+
+// forwardedStreamLocalPayload is a struct used for SSH_MSG_CHANNEL_OPEN message
+// with "forwarded-streamlocal@openssh.com" string.
+type forwardedStreamLocalPayload struct {
+ SocketPath string
+ Reserved0 string
+}
+
+// streamLocalChannelForwardMsg is a struct used for SSH2_MSG_GLOBAL_REQUEST message
+// with "streamlocal-forward@openssh.com"/"cancel-streamlocal-forward@openssh.com" string.
+type streamLocalChannelForwardMsg struct {
+ socketPath string
+}
+
+// ListenUnix is similar to ListenTCP but uses a Unix domain socket.
+func (c *Client) ListenUnix(socketPath string) (net.Listener, error) {
+ c.handleForwardsOnce.Do(c.handleForwards)
+ m := streamLocalChannelForwardMsg{
+ socketPath,
+ }
+ // send message
+ ok, _, err := c.SendRequest("streamlocal-forward@openssh.com", true, Marshal(&m))
+ if err != nil {
+ return nil, err
+ }
+ if !ok {
+ return nil, errors.New("ssh: streamlocal-forward@openssh.com request denied by peer")
+ }
+ ch := c.forwards.add(&net.UnixAddr{Name: socketPath, Net: "unix"})
+
+ return &unixListener{socketPath, c, ch}, nil
+}
+
+func (c *Client) dialStreamLocal(socketPath string) (Channel, error) {
+ msg := streamLocalChannelOpenDirectMsg{
+ socketPath: socketPath,
+ }
+ ch, in, err := c.OpenChannel("direct-streamlocal@openssh.com", Marshal(&msg))
+ if err != nil {
+ return nil, err
+ }
+ go DiscardRequests(in)
+ return ch, err
+}
+
+type unixListener struct {
+ socketPath string
+
+ conn *Client
+ in <-chan forward
+}
+
+// Accept waits for and returns the next connection to the listener.
+func (l *unixListener) Accept() (net.Conn, error) {
+ s, ok := <-l.in
+ if !ok {
+ return nil, io.EOF
+ }
+ ch, incoming, err := s.newCh.Accept()
+ if err != nil {
+ return nil, err
+ }
+ go DiscardRequests(incoming)
+
+ return &chanConn{
+ Channel: ch,
+ laddr: &net.UnixAddr{
+ Name: l.socketPath,
+ Net: "unix",
+ },
+ raddr: &net.UnixAddr{
+ Name: "@",
+ Net: "unix",
+ },
+ }, nil
+}
+
+// Close closes the listener.
+func (l *unixListener) Close() error {
+ // this also closes the listener.
+ l.conn.forwards.remove(&net.UnixAddr{Name: l.socketPath, Net: "unix"})
+ m := streamLocalChannelForwardMsg{
+ l.socketPath,
+ }
+ ok, _, err := l.conn.SendRequest("cancel-streamlocal-forward@openssh.com", true, Marshal(&m))
+ if err == nil && !ok {
+ err = errors.New("ssh: cancel-streamlocal-forward@openssh.com failed")
+ }
+ return err
+}
+
+// Addr returns the listener's network address.
+func (l *unixListener) Addr() net.Addr {
+ return &net.UnixAddr{
+ Name: l.socketPath,
+ Net: "unix",
+ }
+}
diff --git a/vendor/golang.org/x/crypto/ssh/tcpip.go b/vendor/golang.org/x/crypto/ssh/tcpip.go
new file mode 100644
index 00000000..ef5059a1
--- /dev/null
+++ b/vendor/golang.org/x/crypto/ssh/tcpip.go
@@ -0,0 +1,509 @@
+// Copyright 2011 The Go Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style
+// license that can be found in the LICENSE file.
+
+package ssh
+
+import (
+ "context"
+ "errors"
+ "fmt"
+ "io"
+ "math/rand"
+ "net"
+ "strconv"
+ "strings"
+ "sync"
+ "time"
+)
+
+// Listen requests the remote peer open a listening socket on
+// addr. Incoming connections will be available by calling Accept on
+// the returned net.Listener. The listener must be serviced, or the
+// SSH connection may hang.
+// N must be "tcp", "tcp4", "tcp6", or "unix".
+func (c *Client) Listen(n, addr string) (net.Listener, error) {
+ switch n {
+ case "tcp", "tcp4", "tcp6":
+ laddr, err := net.ResolveTCPAddr(n, addr)
+ if err != nil {
+ return nil, err
+ }
+ return c.ListenTCP(laddr)
+ case "unix":
+ return c.ListenUnix(addr)
+ default:
+ return nil, fmt.Errorf("ssh: unsupported protocol: %s", n)
+ }
+}
+
+// Automatic port allocation is broken with OpenSSH before 6.0. See
+// also https://bugzilla.mindrot.org/show_bug.cgi?id=2017. In
+// particular, OpenSSH 5.9 sends a channelOpenMsg with port number 0,
+// rather than the actual port number. This means you can never open
+// two different listeners with auto allocated ports. We work around
+// this by trying explicit ports until we succeed.
+
+const openSSHPrefix = "OpenSSH_"
+
+var portRandomizer = rand.New(rand.NewSource(time.Now().UnixNano()))
+
+// isBrokenOpenSSHVersion returns true if the given version string
+// specifies a version of OpenSSH that is known to have a bug in port
+// forwarding.
+func isBrokenOpenSSHVersion(versionStr string) bool {
+ i := strings.Index(versionStr, openSSHPrefix)
+ if i < 0 {
+ return false
+ }
+ i += len(openSSHPrefix)
+ j := i
+ for ; j < len(versionStr); j++ {
+ if versionStr[j] < '0' || versionStr[j] > '9' {
+ break
+ }
+ }
+ version, _ := strconv.Atoi(versionStr[i:j])
+ return version < 6
+}
+
+// autoPortListenWorkaround simulates automatic port allocation by
+// trying random ports repeatedly.
+func (c *Client) autoPortListenWorkaround(laddr *net.TCPAddr) (net.Listener, error) {
+ var sshListener net.Listener
+ var err error
+ const tries = 10
+ for i := 0; i < tries; i++ {
+ addr := *laddr
+ addr.Port = 1024 + portRandomizer.Intn(60000)
+ sshListener, err = c.ListenTCP(&addr)
+ if err == nil {
+ laddr.Port = addr.Port
+ return sshListener, err
+ }
+ }
+ return nil, fmt.Errorf("ssh: listen on random port failed after %d tries: %v", tries, err)
+}
+
+// RFC 4254 7.1
+type channelForwardMsg struct {
+ addr string
+ rport uint32
+}
+
+// handleForwards starts goroutines handling forwarded connections.
+// It's called on first use by (*Client).ListenTCP to not launch
+// goroutines until needed.
+func (c *Client) handleForwards() {
+ go c.forwards.handleChannels(c.HandleChannelOpen("forwarded-tcpip"))
+ go c.forwards.handleChannels(c.HandleChannelOpen("forwarded-streamlocal@openssh.com"))
+}
+
+// ListenTCP requests the remote peer open a listening socket
+// on laddr. Incoming connections will be available by calling
+// Accept on the returned net.Listener.
+func (c *Client) ListenTCP(laddr *net.TCPAddr) (net.Listener, error) {
+ c.handleForwardsOnce.Do(c.handleForwards)
+ if laddr.Port == 0 && isBrokenOpenSSHVersion(string(c.ServerVersion())) {
+ return c.autoPortListenWorkaround(laddr)
+ }
+
+ m := channelForwardMsg{
+ laddr.IP.String(),
+ uint32(laddr.Port),
+ }
+ // send message
+ ok, resp, err := c.SendRequest("tcpip-forward", true, Marshal(&m))
+ if err != nil {
+ return nil, err
+ }
+ if !ok {
+ return nil, errors.New("ssh: tcpip-forward request denied by peer")
+ }
+
+ // If the original port was 0, then the remote side will
+ // supply a real port number in the response.
+ if laddr.Port == 0 {
+ var p struct {
+ Port uint32
+ }
+ if err := Unmarshal(resp, &p); err != nil {
+ return nil, err
+ }
+ laddr.Port = int(p.Port)
+ }
+
+ // Register this forward, using the port number we obtained.
+ ch := c.forwards.add(laddr)
+
+ return &tcpListener{laddr, c, ch}, nil
+}
+
+// forwardList stores a mapping between remote
+// forward requests and the tcpListeners.
+type forwardList struct {
+ sync.Mutex
+ entries []forwardEntry
+}
+
+// forwardEntry represents an established mapping of a laddr on a
+// remote ssh server to a channel connected to a tcpListener.
+type forwardEntry struct {
+ laddr net.Addr
+ c chan forward
+}
+
+// forward represents an incoming forwarded tcpip connection. The
+// arguments to add/remove/lookup should be address as specified in
+// the original forward-request.
+type forward struct {
+ newCh NewChannel // the ssh client channel underlying this forward
+ raddr net.Addr // the raddr of the incoming connection
+}
+
+func (l *forwardList) add(addr net.Addr) chan forward {
+ l.Lock()
+ defer l.Unlock()
+ f := forwardEntry{
+ laddr: addr,
+ c: make(chan forward, 1),
+ }
+ l.entries = append(l.entries, f)
+ return f.c
+}
+
+// See RFC 4254, section 7.2
+type forwardedTCPPayload struct {
+ Addr string
+ Port uint32
+ OriginAddr string
+ OriginPort uint32
+}
+
+// parseTCPAddr parses the originating address from the remote into a *net.TCPAddr.
+func parseTCPAddr(addr string, port uint32) (*net.TCPAddr, error) {
+ if port == 0 || port > 65535 {
+ return nil, fmt.Errorf("ssh: port number out of range: %d", port)
+ }
+ ip := net.ParseIP(string(addr))
+ if ip == nil {
+ return nil, fmt.Errorf("ssh: cannot parse IP address %q", addr)
+ }
+ return &net.TCPAddr{IP: ip, Port: int(port)}, nil
+}
+
+func (l *forwardList) handleChannels(in <-chan NewChannel) {
+ for ch := range in {
+ var (
+ laddr net.Addr
+ raddr net.Addr
+ err error
+ )
+ switch channelType := ch.ChannelType(); channelType {
+ case "forwarded-tcpip":
+ var payload forwardedTCPPayload
+ if err = Unmarshal(ch.ExtraData(), &payload); err != nil {
+ ch.Reject(ConnectionFailed, "could not parse forwarded-tcpip payload: "+err.Error())
+ continue
+ }
+
+ // RFC 4254 section 7.2 specifies that incoming
+ // addresses should list the address, in string
+ // format. It is implied that this should be an IP
+ // address, as it would be impossible to connect to it
+ // otherwise.
+ laddr, err = parseTCPAddr(payload.Addr, payload.Port)
+ if err != nil {
+ ch.Reject(ConnectionFailed, err.Error())
+ continue
+ }
+ raddr, err = parseTCPAddr(payload.OriginAddr, payload.OriginPort)
+ if err != nil {
+ ch.Reject(ConnectionFailed, err.Error())
+ continue
+ }
+
+ case "forwarded-streamlocal@openssh.com":
+ var payload forwardedStreamLocalPayload
+ if err = Unmarshal(ch.ExtraData(), &payload); err != nil {
+ ch.Reject(ConnectionFailed, "could not parse forwarded-streamlocal@openssh.com payload: "+err.Error())
+ continue
+ }
+ laddr = &net.UnixAddr{
+ Name: payload.SocketPath,
+ Net: "unix",
+ }
+ raddr = &net.UnixAddr{
+ Name: "@",
+ Net: "unix",
+ }
+ default:
+ panic(fmt.Errorf("ssh: unknown channel type %s", channelType))
+ }
+ if ok := l.forward(laddr, raddr, ch); !ok {
+ // Section 7.2, implementations MUST reject spurious incoming
+ // connections.
+ ch.Reject(Prohibited, "no forward for address")
+ continue
+ }
+
+ }
+}
+
+// remove removes the forward entry, and the channel feeding its
+// listener.
+func (l *forwardList) remove(addr net.Addr) {
+ l.Lock()
+ defer l.Unlock()
+ for i, f := range l.entries {
+ if addr.Network() == f.laddr.Network() && addr.String() == f.laddr.String() {
+ l.entries = append(l.entries[:i], l.entries[i+1:]...)
+ close(f.c)
+ return
+ }
+ }
+}
+
+// closeAll closes and clears all forwards.
+func (l *forwardList) closeAll() {
+ l.Lock()
+ defer l.Unlock()
+ for _, f := range l.entries {
+ close(f.c)
+ }
+ l.entries = nil
+}
+
+func (l *forwardList) forward(laddr, raddr net.Addr, ch NewChannel) bool {
+ l.Lock()
+ defer l.Unlock()
+ for _, f := range l.entries {
+ if laddr.Network() == f.laddr.Network() && laddr.String() == f.laddr.String() {
+ f.c <- forward{newCh: ch, raddr: raddr}
+ return true
+ }
+ }
+ return false
+}
+
+type tcpListener struct {
+ laddr *net.TCPAddr
+
+ conn *Client
+ in <-chan forward
+}
+
+// Accept waits for and returns the next connection to the listener.
+func (l *tcpListener) Accept() (net.Conn, error) {
+ s, ok := <-l.in
+ if !ok {
+ return nil, io.EOF
+ }
+ ch, incoming, err := s.newCh.Accept()
+ if err != nil {
+ return nil, err
+ }
+ go DiscardRequests(incoming)
+
+ return &chanConn{
+ Channel: ch,
+ laddr: l.laddr,
+ raddr: s.raddr,
+ }, nil
+}
+
+// Close closes the listener.
+func (l *tcpListener) Close() error {
+ m := channelForwardMsg{
+ l.laddr.IP.String(),
+ uint32(l.laddr.Port),
+ }
+
+ // this also closes the listener.
+ l.conn.forwards.remove(l.laddr)
+ ok, _, err := l.conn.SendRequest("cancel-tcpip-forward", true, Marshal(&m))
+ if err == nil && !ok {
+ err = errors.New("ssh: cancel-tcpip-forward failed")
+ }
+ return err
+}
+
+// Addr returns the listener's network address.
+func (l *tcpListener) Addr() net.Addr {
+ return l.laddr
+}
+
+// DialContext initiates a connection to the addr from the remote host.
+//
+// The provided Context must be non-nil. If the context expires before the
+// connection is complete, an error is returned. Once successfully connected,
+// any expiration of the context will not affect the connection.
+//
+// See func Dial for additional information.
+func (c *Client) DialContext(ctx context.Context, n, addr string) (net.Conn, error) {
+ if err := ctx.Err(); err != nil {
+ return nil, err
+ }
+ type connErr struct {
+ conn net.Conn
+ err error
+ }
+ ch := make(chan connErr)
+ go func() {
+ conn, err := c.Dial(n, addr)
+ select {
+ case ch <- connErr{conn, err}:
+ case <-ctx.Done():
+ if conn != nil {
+ conn.Close()
+ }
+ }
+ }()
+ select {
+ case res := <-ch:
+ return res.conn, res.err
+ case <-ctx.Done():
+ return nil, ctx.Err()
+ }
+}
+
+// Dial initiates a connection to the addr from the remote host.
+// The resulting connection has a zero LocalAddr() and RemoteAddr().
+func (c *Client) Dial(n, addr string) (net.Conn, error) {
+ var ch Channel
+ switch n {
+ case "tcp", "tcp4", "tcp6":
+ // Parse the address into host and numeric port.
+ host, portString, err := net.SplitHostPort(addr)
+ if err != nil {
+ return nil, err
+ }
+ port, err := strconv.ParseUint(portString, 10, 16)
+ if err != nil {
+ return nil, err
+ }
+ ch, err = c.dial(net.IPv4zero.String(), 0, host, int(port))
+ if err != nil {
+ return nil, err
+ }
+ // Use a zero address for local and remote address.
+ zeroAddr := &net.TCPAddr{
+ IP: net.IPv4zero,
+ Port: 0,
+ }
+ return &chanConn{
+ Channel: ch,
+ laddr: zeroAddr,
+ raddr: zeroAddr,
+ }, nil
+ case "unix":
+ var err error
+ ch, err = c.dialStreamLocal(addr)
+ if err != nil {
+ return nil, err
+ }
+ return &chanConn{
+ Channel: ch,
+ laddr: &net.UnixAddr{
+ Name: "@",
+ Net: "unix",
+ },
+ raddr: &net.UnixAddr{
+ Name: addr,
+ Net: "unix",
+ },
+ }, nil
+ default:
+ return nil, fmt.Errorf("ssh: unsupported protocol: %s", n)
+ }
+}
+
+// DialTCP connects to the remote address raddr on the network net,
+// which must be "tcp", "tcp4", or "tcp6". If laddr is not nil, it is used
+// as the local address for the connection.
+func (c *Client) DialTCP(n string, laddr, raddr *net.TCPAddr) (net.Conn, error) {
+ if laddr == nil {
+ laddr = &net.TCPAddr{
+ IP: net.IPv4zero,
+ Port: 0,
+ }
+ }
+ ch, err := c.dial(laddr.IP.String(), laddr.Port, raddr.IP.String(), raddr.Port)
+ if err != nil {
+ return nil, err
+ }
+ return &chanConn{
+ Channel: ch,
+ laddr: laddr,
+ raddr: raddr,
+ }, nil
+}
+
+// RFC 4254 7.2
+type channelOpenDirectMsg struct {
+ raddr string
+ rport uint32
+ laddr string
+ lport uint32
+}
+
+func (c *Client) dial(laddr string, lport int, raddr string, rport int) (Channel, error) {
+ msg := channelOpenDirectMsg{
+ raddr: raddr,
+ rport: uint32(rport),
+ laddr: laddr,
+ lport: uint32(lport),
+ }
+ ch, in, err := c.OpenChannel("direct-tcpip", Marshal(&msg))
+ if err != nil {
+ return nil, err
+ }
+ go DiscardRequests(in)
+ return ch, err
+}
+
+type tcpChan struct {
+ Channel // the backing channel
+}
+
+// chanConn fulfills the net.Conn interface without
+// the tcpChan having to hold laddr or raddr directly.
+type chanConn struct {
+ Channel
+ laddr, raddr net.Addr
+}
+
+// LocalAddr returns the local network address.
+func (t *chanConn) LocalAddr() net.Addr {
+ return t.laddr
+}
+
+// RemoteAddr returns the remote network address.
+func (t *chanConn) RemoteAddr() net.Addr {
+ return t.raddr
+}
+
+// SetDeadline sets the read and write deadlines associated
+// with the connection.
+func (t *chanConn) SetDeadline(deadline time.Time) error {
+ if err := t.SetReadDeadline(deadline); err != nil {
+ return err
+ }
+ return t.SetWriteDeadline(deadline)
+}
+
+// SetReadDeadline sets the read deadline.
+// A zero value for t means Read will not time out.
+// After the deadline, the error from Read will implement net.Error
+// with Timeout() == true.
+func (t *chanConn) SetReadDeadline(deadline time.Time) error {
+ // for compatibility with previous version,
+ // the error message contains "tcpChan"
+ return errors.New("ssh: tcpChan: deadline not supported")
+}
+
+// SetWriteDeadline exists to satisfy the net.Conn interface
+// but is not implemented by this type. It always returns an error.
+func (t *chanConn) SetWriteDeadline(deadline time.Time) error {
+ return errors.New("ssh: tcpChan: deadline not supported")
+}
diff --git a/vendor/golang.org/x/crypto/ssh/transport.go b/vendor/golang.org/x/crypto/ssh/transport.go
new file mode 100644
index 00000000..0424d2d3
--- /dev/null
+++ b/vendor/golang.org/x/crypto/ssh/transport.go
@@ -0,0 +1,380 @@
+// Copyright 2011 The Go Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style
+// license that can be found in the LICENSE file.
+
+package ssh
+
+import (
+ "bufio"
+ "bytes"
+ "errors"
+ "io"
+ "log"
+)
+
+// debugTransport if set, will print packet types as they go over the
+// wire. No message decoding is done, to minimize the impact on timing.
+const debugTransport = false
+
+const (
+ gcm128CipherID = "aes128-gcm@openssh.com"
+ gcm256CipherID = "aes256-gcm@openssh.com"
+ aes128cbcID = "aes128-cbc"
+ tripledescbcID = "3des-cbc"
+)
+
+// packetConn represents a transport that implements packet based
+// operations.
+type packetConn interface {
+ // Encrypt and send a packet of data to the remote peer.
+ writePacket(packet []byte) error
+
+ // Read a packet from the connection. The read is blocking,
+ // i.e. if error is nil, then the returned byte slice is
+ // always non-empty.
+ readPacket() ([]byte, error)
+
+ // Close closes the write-side of the connection.
+ Close() error
+}
+
+// transport is the keyingTransport that implements the SSH packet
+// protocol.
+type transport struct {
+ reader connectionState
+ writer connectionState
+
+ bufReader *bufio.Reader
+ bufWriter *bufio.Writer
+ rand io.Reader
+ isClient bool
+ io.Closer
+
+ strictMode bool
+ initialKEXDone bool
+}
+
+// packetCipher represents a combination of SSH encryption/MAC
+// protocol. A single instance should be used for one direction only.
+type packetCipher interface {
+ // writeCipherPacket encrypts the packet and writes it to w. The
+ // contents of the packet are generally scrambled.
+ writeCipherPacket(seqnum uint32, w io.Writer, rand io.Reader, packet []byte) error
+
+ // readCipherPacket reads and decrypts a packet of data. The
+ // returned packet may be overwritten by future calls of
+ // readPacket.
+ readCipherPacket(seqnum uint32, r io.Reader) ([]byte, error)
+}
+
+// connectionState represents one side (read or write) of the
+// connection. This is necessary because each direction has its own
+// keys, and can even have its own algorithms
+type connectionState struct {
+ packetCipher
+ seqNum uint32
+ dir direction
+ pendingKeyChange chan packetCipher
+}
+
+func (t *transport) setStrictMode() error {
+ if t.reader.seqNum != 1 {
+ return errors.New("ssh: sequence number != 1 when strict KEX mode requested")
+ }
+ t.strictMode = true
+ return nil
+}
+
+func (t *transport) setInitialKEXDone() {
+ t.initialKEXDone = true
+}
+
+// prepareKeyChange sets up key material for a keychange. The key changes in
+// both directions are triggered by reading and writing a msgNewKey packet
+// respectively.
+func (t *transport) prepareKeyChange(algs *algorithms, kexResult *kexResult) error {
+ ciph, err := newPacketCipher(t.reader.dir, algs.r, kexResult)
+ if err != nil {
+ return err
+ }
+ t.reader.pendingKeyChange <- ciph
+
+ ciph, err = newPacketCipher(t.writer.dir, algs.w, kexResult)
+ if err != nil {
+ return err
+ }
+ t.writer.pendingKeyChange <- ciph
+
+ return nil
+}
+
+func (t *transport) printPacket(p []byte, write bool) {
+ if len(p) == 0 {
+ return
+ }
+ who := "server"
+ if t.isClient {
+ who = "client"
+ }
+ what := "read"
+ if write {
+ what = "write"
+ }
+
+ log.Println(what, who, p[0])
+}
+
+// Read and decrypt next packet.
+func (t *transport) readPacket() (p []byte, err error) {
+ for {
+ p, err = t.reader.readPacket(t.bufReader, t.strictMode)
+ if err != nil {
+ break
+ }
+ // in strict mode we pass through DEBUG and IGNORE packets only during the initial KEX
+ if len(p) == 0 || (t.strictMode && !t.initialKEXDone) || (p[0] != msgIgnore && p[0] != msgDebug) {
+ break
+ }
+ }
+ if debugTransport {
+ t.printPacket(p, false)
+ }
+
+ return p, err
+}
+
+func (s *connectionState) readPacket(r *bufio.Reader, strictMode bool) ([]byte, error) {
+ packet, err := s.packetCipher.readCipherPacket(s.seqNum, r)
+ s.seqNum++
+ if err == nil && len(packet) == 0 {
+ err = errors.New("ssh: zero length packet")
+ }
+
+ if len(packet) > 0 {
+ switch packet[0] {
+ case msgNewKeys:
+ select {
+ case cipher := <-s.pendingKeyChange:
+ s.packetCipher = cipher
+ if strictMode {
+ s.seqNum = 0
+ }
+ default:
+ return nil, errors.New("ssh: got bogus newkeys message")
+ }
+
+ case msgDisconnect:
+ // Transform a disconnect message into an
+ // error. Since this is lowest level at which
+ // we interpret message types, doing it here
+ // ensures that we don't have to handle it
+ // elsewhere.
+ var msg disconnectMsg
+ if err := Unmarshal(packet, &msg); err != nil {
+ return nil, err
+ }
+ return nil, &msg
+ }
+ }
+
+ // The packet may point to an internal buffer, so copy the
+ // packet out here.
+ fresh := make([]byte, len(packet))
+ copy(fresh, packet)
+
+ return fresh, err
+}
+
+func (t *transport) writePacket(packet []byte) error {
+ if debugTransport {
+ t.printPacket(packet, true)
+ }
+ return t.writer.writePacket(t.bufWriter, t.rand, packet, t.strictMode)
+}
+
+func (s *connectionState) writePacket(w *bufio.Writer, rand io.Reader, packet []byte, strictMode bool) error {
+ changeKeys := len(packet) > 0 && packet[0] == msgNewKeys
+
+ err := s.packetCipher.writeCipherPacket(s.seqNum, w, rand, packet)
+ if err != nil {
+ return err
+ }
+ if err = w.Flush(); err != nil {
+ return err
+ }
+ s.seqNum++
+ if changeKeys {
+ select {
+ case cipher := <-s.pendingKeyChange:
+ s.packetCipher = cipher
+ if strictMode {
+ s.seqNum = 0
+ }
+ default:
+ panic("ssh: no key material for msgNewKeys")
+ }
+ }
+ return err
+}
+
+func newTransport(rwc io.ReadWriteCloser, rand io.Reader, isClient bool) *transport {
+ t := &transport{
+ bufReader: bufio.NewReader(rwc),
+ bufWriter: bufio.NewWriter(rwc),
+ rand: rand,
+ reader: connectionState{
+ packetCipher: &streamPacketCipher{cipher: noneCipher{}},
+ pendingKeyChange: make(chan packetCipher, 1),
+ },
+ writer: connectionState{
+ packetCipher: &streamPacketCipher{cipher: noneCipher{}},
+ pendingKeyChange: make(chan packetCipher, 1),
+ },
+ Closer: rwc,
+ }
+ t.isClient = isClient
+
+ if isClient {
+ t.reader.dir = serverKeys
+ t.writer.dir = clientKeys
+ } else {
+ t.reader.dir = clientKeys
+ t.writer.dir = serverKeys
+ }
+
+ return t
+}
+
+type direction struct {
+ ivTag []byte
+ keyTag []byte
+ macKeyTag []byte
+}
+
+var (
+ serverKeys = direction{[]byte{'B'}, []byte{'D'}, []byte{'F'}}
+ clientKeys = direction{[]byte{'A'}, []byte{'C'}, []byte{'E'}}
+)
+
+// setupKeys sets the cipher and MAC keys from kex.K, kex.H and sessionId, as
+// described in RFC 4253, section 6.4. direction should either be serverKeys
+// (to setup server->client keys) or clientKeys (for client->server keys).
+func newPacketCipher(d direction, algs directionAlgorithms, kex *kexResult) (packetCipher, error) {
+ cipherMode := cipherModes[algs.Cipher]
+
+ iv := make([]byte, cipherMode.ivSize)
+ key := make([]byte, cipherMode.keySize)
+
+ generateKeyMaterial(iv, d.ivTag, kex)
+ generateKeyMaterial(key, d.keyTag, kex)
+
+ var macKey []byte
+ if !aeadCiphers[algs.Cipher] {
+ macMode := macModes[algs.MAC]
+ macKey = make([]byte, macMode.keySize)
+ generateKeyMaterial(macKey, d.macKeyTag, kex)
+ }
+
+ return cipherModes[algs.Cipher].create(key, iv, macKey, algs)
+}
+
+// generateKeyMaterial fills out with key material generated from tag, K, H
+// and sessionId, as specified in RFC 4253, section 7.2.
+func generateKeyMaterial(out, tag []byte, r *kexResult) {
+ var digestsSoFar []byte
+
+ h := r.Hash.New()
+ for len(out) > 0 {
+ h.Reset()
+ h.Write(r.K)
+ h.Write(r.H)
+
+ if len(digestsSoFar) == 0 {
+ h.Write(tag)
+ h.Write(r.SessionID)
+ } else {
+ h.Write(digestsSoFar)
+ }
+
+ digest := h.Sum(nil)
+ n := copy(out, digest)
+ out = out[n:]
+ if len(out) > 0 {
+ digestsSoFar = append(digestsSoFar, digest...)
+ }
+ }
+}
+
+const packageVersion = "SSH-2.0-Go"
+
+// Sends and receives a version line. The versionLine string should
+// be US ASCII, start with "SSH-2.0-", and should not include a
+// newline. exchangeVersions returns the other side's version line.
+func exchangeVersions(rw io.ReadWriter, versionLine []byte) (them []byte, err error) {
+ // Contrary to the RFC, we do not ignore lines that don't
+ // start with "SSH-2.0-" to make the library usable with
+ // nonconforming servers.
+ for _, c := range versionLine {
+ // The spec disallows non US-ASCII chars, and
+ // specifically forbids null chars.
+ if c < 32 {
+ return nil, errors.New("ssh: junk character in version line")
+ }
+ }
+ if _, err = rw.Write(append(versionLine, '\r', '\n')); err != nil {
+ return
+ }
+
+ them, err = readVersion(rw)
+ return them, err
+}
+
+// maxVersionStringBytes is the maximum number of bytes that we'll
+// accept as a version string. RFC 4253 section 4.2 limits this at 255
+// chars
+const maxVersionStringBytes = 255
+
+// Read version string as specified by RFC 4253, section 4.2.
+func readVersion(r io.Reader) ([]byte, error) {
+ versionString := make([]byte, 0, 64)
+ var ok bool
+ var buf [1]byte
+
+ for length := 0; length < maxVersionStringBytes; length++ {
+ _, err := io.ReadFull(r, buf[:])
+ if err != nil {
+ return nil, err
+ }
+ // The RFC says that the version should be terminated with \r\n
+ // but several SSH servers actually only send a \n.
+ if buf[0] == '\n' {
+ if !bytes.HasPrefix(versionString, []byte("SSH-")) {
+ // RFC 4253 says we need to ignore all version string lines
+ // except the one containing the SSH version (provided that
+ // all the lines do not exceed 255 bytes in total).
+ versionString = versionString[:0]
+ continue
+ }
+ ok = true
+ break
+ }
+
+ // non ASCII chars are disallowed, but we are lenient,
+ // since Go doesn't use null-terminated strings.
+
+ // The RFC allows a comment after a space, however,
+ // all of it (version and comments) goes into the
+ // session hash.
+ versionString = append(versionString, buf[0])
+ }
+
+ if !ok {
+ return nil, errors.New("ssh: overflow reading version string")
+ }
+
+ // There might be a '\r' on the end which we should remove.
+ if len(versionString) > 0 && versionString[len(versionString)-1] == '\r' {
+ versionString = versionString[:len(versionString)-1]
+ }
+ return versionString, nil
+}
diff --git a/vendor/golang.org/x/exp/LICENSE b/vendor/golang.org/x/exp/LICENSE
new file mode 100644
index 00000000..6a66aea5
--- /dev/null
+++ b/vendor/golang.org/x/exp/LICENSE
@@ -0,0 +1,27 @@
+Copyright (c) 2009 The Go Authors. All rights reserved.
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions are
+met:
+
+ * Redistributions of source code must retain the above copyright
+notice, this list of conditions and the following disclaimer.
+ * Redistributions in binary form must reproduce the above
+copyright notice, this list of conditions and the following disclaimer
+in the documentation and/or other materials provided with the
+distribution.
+ * Neither the name of Google Inc. nor the names of its
+contributors may be used to endorse or promote products derived from
+this software without specific prior written permission.
+
+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
diff --git a/vendor/golang.org/x/term/PATENTS b/vendor/golang.org/x/exp/PATENTS
similarity index 100%
rename from vendor/golang.org/x/term/PATENTS
rename to vendor/golang.org/x/exp/PATENTS
diff --git a/vendor/golang.org/x/exp/constraints/constraints.go b/vendor/golang.org/x/exp/constraints/constraints.go
new file mode 100644
index 00000000..2c033dff
--- /dev/null
+++ b/vendor/golang.org/x/exp/constraints/constraints.go
@@ -0,0 +1,50 @@
+// Copyright 2021 The Go Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style
+// license that can be found in the LICENSE file.
+
+// Package constraints defines a set of useful constraints to be used
+// with type parameters.
+package constraints
+
+// Signed is a constraint that permits any signed integer type.
+// If future releases of Go add new predeclared signed integer types,
+// this constraint will be modified to include them.
+type Signed interface {
+ ~int | ~int8 | ~int16 | ~int32 | ~int64
+}
+
+// Unsigned is a constraint that permits any unsigned integer type.
+// If future releases of Go add new predeclared unsigned integer types,
+// this constraint will be modified to include them.
+type Unsigned interface {
+ ~uint | ~uint8 | ~uint16 | ~uint32 | ~uint64 | ~uintptr
+}
+
+// Integer is a constraint that permits any integer type.
+// If future releases of Go add new predeclared integer types,
+// this constraint will be modified to include them.
+type Integer interface {
+ Signed | Unsigned
+}
+
+// Float is a constraint that permits any floating-point type.
+// If future releases of Go add new predeclared floating-point types,
+// this constraint will be modified to include them.
+type Float interface {
+ ~float32 | ~float64
+}
+
+// Complex is a constraint that permits any complex numeric type.
+// If future releases of Go add new predeclared complex numeric types,
+// this constraint will be modified to include them.
+type Complex interface {
+ ~complex64 | ~complex128
+}
+
+// Ordered is a constraint that permits any ordered type: any type
+// that supports the operators < <= >= >.
+// If future releases of Go add new ordered types,
+// this constraint will be modified to include them.
+type Ordered interface {
+ Integer | Float | ~string
+}
diff --git a/vendor/golang.org/x/exp/slices/cmp.go b/vendor/golang.org/x/exp/slices/cmp.go
new file mode 100644
index 00000000..fbf1934a
--- /dev/null
+++ b/vendor/golang.org/x/exp/slices/cmp.go
@@ -0,0 +1,44 @@
+// Copyright 2023 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 slices
+
+import "golang.org/x/exp/constraints"
+
+// min is a version of the predeclared function from the Go 1.21 release.
+func min[T constraints.Ordered](a, b T) T {
+ if a < b || isNaN(a) {
+ return a
+ }
+ return b
+}
+
+// max is a version of the predeclared function from the Go 1.21 release.
+func max[T constraints.Ordered](a, b T) T {
+ if a > b || isNaN(a) {
+ return a
+ }
+ return b
+}
+
+// cmpLess is a copy of cmp.Less from the Go 1.21 release.
+func cmpLess[T constraints.Ordered](x, y T) bool {
+ return (isNaN(x) && !isNaN(y)) || x < y
+}
+
+// cmpCompare is a copy of cmp.Compare from the Go 1.21 release.
+func cmpCompare[T constraints.Ordered](x, y T) int {
+ xNaN := isNaN(x)
+ yNaN := isNaN(y)
+ if xNaN && yNaN {
+ return 0
+ }
+ if xNaN || x < y {
+ return -1
+ }
+ if yNaN || x > y {
+ return +1
+ }
+ return 0
+}
diff --git a/vendor/golang.org/x/exp/slices/slices.go b/vendor/golang.org/x/exp/slices/slices.go
new file mode 100644
index 00000000..5e8158bb
--- /dev/null
+++ b/vendor/golang.org/x/exp/slices/slices.go
@@ -0,0 +1,499 @@
+// Copyright 2021 The Go Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style
+// license that can be found in the LICENSE file.
+
+// Package slices defines various functions useful with slices of any type.
+package slices
+
+import (
+ "unsafe"
+
+ "golang.org/x/exp/constraints"
+)
+
+// Equal reports whether two slices are equal: the same length and all
+// elements equal. If the lengths are different, Equal returns false.
+// Otherwise, the elements are compared in increasing index order, and the
+// comparison stops at the first unequal pair.
+// Floating point NaNs are not considered equal.
+func Equal[S ~[]E, E comparable](s1, s2 S) bool {
+ if len(s1) != len(s2) {
+ return false
+ }
+ for i := range s1 {
+ if s1[i] != s2[i] {
+ return false
+ }
+ }
+ return true
+}
+
+// EqualFunc reports whether two slices are equal using an equality
+// function on each pair of elements. If the lengths are different,
+// EqualFunc returns false. Otherwise, the elements are compared in
+// increasing index order, and the comparison stops at the first index
+// for which eq returns false.
+func EqualFunc[S1 ~[]E1, S2 ~[]E2, E1, E2 any](s1 S1, s2 S2, eq func(E1, E2) bool) bool {
+ if len(s1) != len(s2) {
+ return false
+ }
+ for i, v1 := range s1 {
+ v2 := s2[i]
+ if !eq(v1, v2) {
+ return false
+ }
+ }
+ return true
+}
+
+// Compare compares the elements of s1 and s2, using [cmp.Compare] on each pair
+// of elements. The elements are compared sequentially, starting at index 0,
+// until one element is not equal to the other.
+// The result of comparing the first non-matching elements is returned.
+// If both slices are equal until one of them ends, the shorter slice is
+// considered less than the longer one.
+// The result is 0 if s1 == s2, -1 if s1 < s2, and +1 if s1 > s2.
+func Compare[S ~[]E, E constraints.Ordered](s1, s2 S) int {
+ for i, v1 := range s1 {
+ if i >= len(s2) {
+ return +1
+ }
+ v2 := s2[i]
+ if c := cmpCompare(v1, v2); c != 0 {
+ return c
+ }
+ }
+ if len(s1) < len(s2) {
+ return -1
+ }
+ return 0
+}
+
+// CompareFunc is like [Compare] but uses a custom comparison function on each
+// pair of elements.
+// The result is the first non-zero result of cmp; if cmp always
+// returns 0 the result is 0 if len(s1) == len(s2), -1 if len(s1) < len(s2),
+// and +1 if len(s1) > len(s2).
+func CompareFunc[S1 ~[]E1, S2 ~[]E2, E1, E2 any](s1 S1, s2 S2, cmp func(E1, E2) int) int {
+ for i, v1 := range s1 {
+ if i >= len(s2) {
+ return +1
+ }
+ v2 := s2[i]
+ if c := cmp(v1, v2); c != 0 {
+ return c
+ }
+ }
+ if len(s1) < len(s2) {
+ return -1
+ }
+ return 0
+}
+
+// Index returns the index of the first occurrence of v in s,
+// or -1 if not present.
+func Index[S ~[]E, E comparable](s S, v E) int {
+ for i := range s {
+ if v == s[i] {
+ return i
+ }
+ }
+ return -1
+}
+
+// IndexFunc returns the first index i satisfying f(s[i]),
+// or -1 if none do.
+func IndexFunc[S ~[]E, E any](s S, f func(E) bool) int {
+ for i := range s {
+ if f(s[i]) {
+ return i
+ }
+ }
+ return -1
+}
+
+// Contains reports whether v is present in s.
+func Contains[S ~[]E, E comparable](s S, v E) bool {
+ return Index(s, v) >= 0
+}
+
+// ContainsFunc reports whether at least one
+// element e of s satisfies f(e).
+func ContainsFunc[S ~[]E, E any](s S, f func(E) bool) bool {
+ return IndexFunc(s, f) >= 0
+}
+
+// Insert inserts the values v... into s at index i,
+// returning the modified slice.
+// The elements at s[i:] are shifted up to make room.
+// In the returned slice r, r[i] == v[0],
+// and r[i+len(v)] == value originally at r[i].
+// Insert panics if i is out of range.
+// This function is O(len(s) + len(v)).
+func Insert[S ~[]E, E any](s S, i int, v ...E) S {
+ m := len(v)
+ if m == 0 {
+ return s
+ }
+ n := len(s)
+ if i == n {
+ return append(s, v...)
+ }
+ if n+m > cap(s) {
+ // Use append rather than make so that we bump the size of
+ // the slice up to the next storage class.
+ // This is what Grow does but we don't call Grow because
+ // that might copy the values twice.
+ s2 := append(s[:i], make(S, n+m-i)...)
+ copy(s2[i:], v)
+ copy(s2[i+m:], s[i:])
+ return s2
+ }
+ s = s[:n+m]
+
+ // before:
+ // s: aaaaaaaabbbbccccccccdddd
+ // ^ ^ ^ ^
+ // i i+m n n+m
+ // after:
+ // s: aaaaaaaavvvvbbbbcccccccc
+ // ^ ^ ^ ^
+ // i i+m n n+m
+ //
+ // a are the values that don't move in s.
+ // v are the values copied in from v.
+ // b and c are the values from s that are shifted up in index.
+ // d are the values that get overwritten, never to be seen again.
+
+ if !overlaps(v, s[i+m:]) {
+ // Easy case - v does not overlap either the c or d regions.
+ // (It might be in some of a or b, or elsewhere entirely.)
+ // The data we copy up doesn't write to v at all, so just do it.
+
+ copy(s[i+m:], s[i:])
+
+ // Now we have
+ // s: aaaaaaaabbbbbbbbcccccccc
+ // ^ ^ ^ ^
+ // i i+m n n+m
+ // Note the b values are duplicated.
+
+ copy(s[i:], v)
+
+ // Now we have
+ // s: aaaaaaaavvvvbbbbcccccccc
+ // ^ ^ ^ ^
+ // i i+m n n+m
+ // That's the result we want.
+ return s
+ }
+
+ // The hard case - v overlaps c or d. We can't just shift up
+ // the data because we'd move or clobber the values we're trying
+ // to insert.
+ // So instead, write v on top of d, then rotate.
+ copy(s[n:], v)
+
+ // Now we have
+ // s: aaaaaaaabbbbccccccccvvvv
+ // ^ ^ ^ ^
+ // i i+m n n+m
+
+ rotateRight(s[i:], m)
+
+ // Now we have
+ // s: aaaaaaaavvvvbbbbcccccccc
+ // ^ ^ ^ ^
+ // i i+m n n+m
+ // That's the result we want.
+ return s
+}
+
+// Delete removes the elements s[i:j] from s, returning the modified slice.
+// Delete panics if s[i:j] is not a valid slice of s.
+// Delete is O(len(s)-j), so if many items must be deleted, it is better to
+// make a single call deleting them all together than to delete one at a time.
+// Delete might not modify the elements s[len(s)-(j-i):len(s)]. If those
+// elements contain pointers you might consider zeroing those elements so that
+// objects they reference can be garbage collected.
+func Delete[S ~[]E, E any](s S, i, j int) S {
+ _ = s[i:j] // bounds check
+
+ return append(s[:i], s[j:]...)
+}
+
+// DeleteFunc removes any elements from s for which del returns true,
+// returning the modified slice.
+// When DeleteFunc removes m elements, it might not modify the elements
+// s[len(s)-m:len(s)]. If those elements contain pointers you might consider
+// zeroing those elements so that objects they reference can be garbage
+// collected.
+func DeleteFunc[S ~[]E, E any](s S, del func(E) bool) S {
+ i := IndexFunc(s, del)
+ if i == -1 {
+ return s
+ }
+ // Don't start copying elements until we find one to delete.
+ for j := i + 1; j < len(s); j++ {
+ if v := s[j]; !del(v) {
+ s[i] = v
+ i++
+ }
+ }
+ return s[:i]
+}
+
+// Replace replaces the elements s[i:j] by the given v, and returns the
+// modified slice. Replace panics if s[i:j] is not a valid slice of s.
+func Replace[S ~[]E, E any](s S, i, j int, v ...E) S {
+ _ = s[i:j] // verify that i:j is a valid subslice
+
+ if i == j {
+ return Insert(s, i, v...)
+ }
+ if j == len(s) {
+ return append(s[:i], v...)
+ }
+
+ tot := len(s[:i]) + len(v) + len(s[j:])
+ if tot > cap(s) {
+ // Too big to fit, allocate and copy over.
+ s2 := append(s[:i], make(S, tot-i)...) // See Insert
+ copy(s2[i:], v)
+ copy(s2[i+len(v):], s[j:])
+ return s2
+ }
+
+ r := s[:tot]
+
+ if i+len(v) <= j {
+ // Easy, as v fits in the deleted portion.
+ copy(r[i:], v)
+ if i+len(v) != j {
+ copy(r[i+len(v):], s[j:])
+ }
+ return r
+ }
+
+ // We are expanding (v is bigger than j-i).
+ // The situation is something like this:
+ // (example has i=4,j=8,len(s)=16,len(v)=6)
+ // s: aaaaxxxxbbbbbbbbyy
+ // ^ ^ ^ ^
+ // i j len(s) tot
+ // a: prefix of s
+ // x: deleted range
+ // b: more of s
+ // y: area to expand into
+
+ if !overlaps(r[i+len(v):], v) {
+ // Easy, as v is not clobbered by the first copy.
+ copy(r[i+len(v):], s[j:])
+ copy(r[i:], v)
+ return r
+ }
+
+ // This is a situation where we don't have a single place to which
+ // we can copy v. Parts of it need to go to two different places.
+ // We want to copy the prefix of v into y and the suffix into x, then
+ // rotate |y| spots to the right.
+ //
+ // v[2:] v[:2]
+ // | |
+ // s: aaaavvvvbbbbbbbbvv
+ // ^ ^ ^ ^
+ // i j len(s) tot
+ //
+ // If either of those two destinations don't alias v, then we're good.
+ y := len(v) - (j - i) // length of y portion
+
+ if !overlaps(r[i:j], v) {
+ copy(r[i:j], v[y:])
+ copy(r[len(s):], v[:y])
+ rotateRight(r[i:], y)
+ return r
+ }
+ if !overlaps(r[len(s):], v) {
+ copy(r[len(s):], v[:y])
+ copy(r[i:j], v[y:])
+ rotateRight(r[i:], y)
+ return r
+ }
+
+ // Now we know that v overlaps both x and y.
+ // That means that the entirety of b is *inside* v.
+ // So we don't need to preserve b at all; instead we
+ // can copy v first, then copy the b part of v out of
+ // v to the right destination.
+ k := startIdx(v, s[j:])
+ copy(r[i:], v)
+ copy(r[i+len(v):], r[i+k:])
+ return r
+}
+
+// Clone returns a copy of the slice.
+// The elements are copied using assignment, so this is a shallow clone.
+func Clone[S ~[]E, E any](s S) S {
+ // Preserve nil in case it matters.
+ if s == nil {
+ return nil
+ }
+ return append(S([]E{}), s...)
+}
+
+// Compact replaces consecutive runs of equal elements with a single copy.
+// This is like the uniq command found on Unix.
+// Compact modifies the contents of the slice s and returns the modified slice,
+// which may have a smaller length.
+// When Compact discards m elements in total, it might not modify the elements
+// s[len(s)-m:len(s)]. If those elements contain pointers you might consider
+// zeroing those elements so that objects they reference can be garbage collected.
+func Compact[S ~[]E, E comparable](s S) S {
+ if len(s) < 2 {
+ return s
+ }
+ i := 1
+ for k := 1; k < len(s); k++ {
+ if s[k] != s[k-1] {
+ if i != k {
+ s[i] = s[k]
+ }
+ i++
+ }
+ }
+ return s[:i]
+}
+
+// CompactFunc is like [Compact] but uses an equality function to compare elements.
+// For runs of elements that compare equal, CompactFunc keeps the first one.
+func CompactFunc[S ~[]E, E any](s S, eq func(E, E) bool) S {
+ if len(s) < 2 {
+ return s
+ }
+ i := 1
+ for k := 1; k < len(s); k++ {
+ if !eq(s[k], s[k-1]) {
+ if i != k {
+ s[i] = s[k]
+ }
+ i++
+ }
+ }
+ return s[:i]
+}
+
+// Grow increases the slice's capacity, if necessary, to guarantee space for
+// another n elements. After Grow(n), at least n elements can be appended
+// to the slice without another allocation. If n is negative or too large to
+// allocate the memory, Grow panics.
+func Grow[S ~[]E, E any](s S, n int) S {
+ if n < 0 {
+ panic("cannot be negative")
+ }
+ if n -= cap(s) - len(s); n > 0 {
+ // TODO(https://go.dev/issue/53888): Make using []E instead of S
+ // to workaround a compiler bug where the runtime.growslice optimization
+ // does not take effect. Revert when the compiler is fixed.
+ s = append([]E(s)[:cap(s)], make([]E, n)...)[:len(s)]
+ }
+ return s
+}
+
+// Clip removes unused capacity from the slice, returning s[:len(s):len(s)].
+func Clip[S ~[]E, E any](s S) S {
+ return s[:len(s):len(s)]
+}
+
+// Rotation algorithm explanation:
+//
+// rotate left by 2
+// start with
+// 0123456789
+// split up like this
+// 01 234567 89
+// swap first 2 and last 2
+// 89 234567 01
+// join first parts
+// 89234567 01
+// recursively rotate first left part by 2
+// 23456789 01
+// join at the end
+// 2345678901
+//
+// rotate left by 8
+// start with
+// 0123456789
+// split up like this
+// 01 234567 89
+// swap first 2 and last 2
+// 89 234567 01
+// join last parts
+// 89 23456701
+// recursively rotate second part left by 6
+// 89 01234567
+// join at the end
+// 8901234567
+
+// TODO: There are other rotate algorithms.
+// This algorithm has the desirable property that it moves each element exactly twice.
+// The triple-reverse algorithm is simpler and more cache friendly, but takes more writes.
+// The follow-cycles algorithm can be 1-write but it is not very cache friendly.
+
+// rotateLeft rotates b left by n spaces.
+// s_final[i] = s_orig[i+r], wrapping around.
+func rotateLeft[E any](s []E, r int) {
+ for r != 0 && r != len(s) {
+ if r*2 <= len(s) {
+ swap(s[:r], s[len(s)-r:])
+ s = s[:len(s)-r]
+ } else {
+ swap(s[:len(s)-r], s[r:])
+ s, r = s[len(s)-r:], r*2-len(s)
+ }
+ }
+}
+func rotateRight[E any](s []E, r int) {
+ rotateLeft(s, len(s)-r)
+}
+
+// swap swaps the contents of x and y. x and y must be equal length and disjoint.
+func swap[E any](x, y []E) {
+ for i := 0; i < len(x); i++ {
+ x[i], y[i] = y[i], x[i]
+ }
+}
+
+// overlaps reports whether the memory ranges a[0:len(a)] and b[0:len(b)] overlap.
+func overlaps[E any](a, b []E) bool {
+ if len(a) == 0 || len(b) == 0 {
+ return false
+ }
+ elemSize := unsafe.Sizeof(a[0])
+ if elemSize == 0 {
+ return false
+ }
+ // TODO: use a runtime/unsafe facility once one becomes available. See issue 12445.
+ // Also see crypto/internal/alias/alias.go:AnyOverlap
+ return uintptr(unsafe.Pointer(&a[0])) <= uintptr(unsafe.Pointer(&b[len(b)-1]))+(elemSize-1) &&
+ uintptr(unsafe.Pointer(&b[0])) <= uintptr(unsafe.Pointer(&a[len(a)-1]))+(elemSize-1)
+}
+
+// startIdx returns the index in haystack where the needle starts.
+// prerequisite: the needle must be aliased entirely inside the haystack.
+func startIdx[E any](haystack, needle []E) int {
+ p := &needle[0]
+ for i := range haystack {
+ if p == &haystack[i] {
+ return i
+ }
+ }
+ // TODO: what if the overlap is by a non-integral number of Es?
+ panic("needle not found")
+}
+
+// Reverse reverses the elements of the slice in place.
+func Reverse[S ~[]E, E any](s S) {
+ for i, j := 0, len(s)-1; i < j; i, j = i+1, j-1 {
+ s[i], s[j] = s[j], s[i]
+ }
+}
diff --git a/vendor/golang.org/x/exp/slices/sort.go b/vendor/golang.org/x/exp/slices/sort.go
new file mode 100644
index 00000000..b67897f7
--- /dev/null
+++ b/vendor/golang.org/x/exp/slices/sort.go
@@ -0,0 +1,195 @@
+// Copyright 2022 The Go Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style
+// license that can be found in the LICENSE file.
+
+//go:generate go run $GOROOT/src/sort/gen_sort_variants.go -exp
+
+package slices
+
+import (
+ "math/bits"
+
+ "golang.org/x/exp/constraints"
+)
+
+// Sort sorts a slice of any ordered type in ascending order.
+// When sorting floating-point numbers, NaNs are ordered before other values.
+func Sort[S ~[]E, E constraints.Ordered](x S) {
+ n := len(x)
+ pdqsortOrdered(x, 0, n, bits.Len(uint(n)))
+}
+
+// SortFunc sorts the slice x in ascending order as determined by the cmp
+// function. This sort is not guaranteed to be stable.
+// cmp(a, b) should return a negative number when a < b, a positive number when
+// a > b and zero when a == b.
+//
+// SortFunc requires that cmp is a strict weak ordering.
+// See https://en.wikipedia.org/wiki/Weak_ordering#Strict_weak_orderings.
+func SortFunc[S ~[]E, E any](x S, cmp func(a, b E) int) {
+ n := len(x)
+ pdqsortCmpFunc(x, 0, n, bits.Len(uint(n)), cmp)
+}
+
+// SortStableFunc sorts the slice x while keeping the original order of equal
+// elements, using cmp to compare elements in the same way as [SortFunc].
+func SortStableFunc[S ~[]E, E any](x S, cmp func(a, b E) int) {
+ stableCmpFunc(x, len(x), cmp)
+}
+
+// IsSorted reports whether x is sorted in ascending order.
+func IsSorted[S ~[]E, E constraints.Ordered](x S) bool {
+ for i := len(x) - 1; i > 0; i-- {
+ if cmpLess(x[i], x[i-1]) {
+ return false
+ }
+ }
+ return true
+}
+
+// IsSortedFunc reports whether x is sorted in ascending order, with cmp as the
+// comparison function as defined by [SortFunc].
+func IsSortedFunc[S ~[]E, E any](x S, cmp func(a, b E) int) bool {
+ for i := len(x) - 1; i > 0; i-- {
+ if cmp(x[i], x[i-1]) < 0 {
+ return false
+ }
+ }
+ return true
+}
+
+// Min returns the minimal value in x. It panics if x is empty.
+// For floating-point numbers, Min propagates NaNs (any NaN value in x
+// forces the output to be NaN).
+func Min[S ~[]E, E constraints.Ordered](x S) E {
+ if len(x) < 1 {
+ panic("slices.Min: empty list")
+ }
+ m := x[0]
+ for i := 1; i < len(x); i++ {
+ m = min(m, x[i])
+ }
+ return m
+}
+
+// MinFunc returns the minimal value in x, using cmp to compare elements.
+// It panics if x is empty. If there is more than one minimal element
+// according to the cmp function, MinFunc returns the first one.
+func MinFunc[S ~[]E, E any](x S, cmp func(a, b E) int) E {
+ if len(x) < 1 {
+ panic("slices.MinFunc: empty list")
+ }
+ m := x[0]
+ for i := 1; i < len(x); i++ {
+ if cmp(x[i], m) < 0 {
+ m = x[i]
+ }
+ }
+ return m
+}
+
+// Max returns the maximal value in x. It panics if x is empty.
+// For floating-point E, Max propagates NaNs (any NaN value in x
+// forces the output to be NaN).
+func Max[S ~[]E, E constraints.Ordered](x S) E {
+ if len(x) < 1 {
+ panic("slices.Max: empty list")
+ }
+ m := x[0]
+ for i := 1; i < len(x); i++ {
+ m = max(m, x[i])
+ }
+ return m
+}
+
+// MaxFunc returns the maximal value in x, using cmp to compare elements.
+// It panics if x is empty. If there is more than one maximal element
+// according to the cmp function, MaxFunc returns the first one.
+func MaxFunc[S ~[]E, E any](x S, cmp func(a, b E) int) E {
+ if len(x) < 1 {
+ panic("slices.MaxFunc: empty list")
+ }
+ m := x[0]
+ for i := 1; i < len(x); i++ {
+ if cmp(x[i], m) > 0 {
+ m = x[i]
+ }
+ }
+ return m
+}
+
+// BinarySearch searches for target in a sorted slice and returns the position
+// where target is found, or the position where target would appear in the
+// sort order; it also returns a bool saying whether the target is really found
+// in the slice. The slice must be sorted in increasing order.
+func BinarySearch[S ~[]E, E constraints.Ordered](x S, target E) (int, bool) {
+ // Inlining is faster than calling BinarySearchFunc with a lambda.
+ n := len(x)
+ // Define x[-1] < target and x[n] >= target.
+ // Invariant: x[i-1] < target, x[j] >= target.
+ i, j := 0, n
+ for i < j {
+ h := int(uint(i+j) >> 1) // avoid overflow when computing h
+ // i ≤ h < j
+ if cmpLess(x[h], target) {
+ i = h + 1 // preserves x[i-1] < target
+ } else {
+ j = h // preserves x[j] >= target
+ }
+ }
+ // i == j, x[i-1] < target, and x[j] (= x[i]) >= target => answer is i.
+ return i, i < n && (x[i] == target || (isNaN(x[i]) && isNaN(target)))
+}
+
+// BinarySearchFunc works like [BinarySearch], but uses a custom comparison
+// function. The slice must be sorted in increasing order, where "increasing"
+// is defined by cmp. cmp should return 0 if the slice element matches
+// the target, a negative number if the slice element precedes the target,
+// or a positive number if the slice element follows the target.
+// cmp must implement the same ordering as the slice, such that if
+// cmp(a, t) < 0 and cmp(b, t) >= 0, then a must precede b in the slice.
+func BinarySearchFunc[S ~[]E, E, T any](x S, target T, cmp func(E, T) int) (int, bool) {
+ n := len(x)
+ // Define cmp(x[-1], target) < 0 and cmp(x[n], target) >= 0 .
+ // Invariant: cmp(x[i - 1], target) < 0, cmp(x[j], target) >= 0.
+ i, j := 0, n
+ for i < j {
+ h := int(uint(i+j) >> 1) // avoid overflow when computing h
+ // i ≤ h < j
+ if cmp(x[h], target) < 0 {
+ i = h + 1 // preserves cmp(x[i - 1], target) < 0
+ } else {
+ j = h // preserves cmp(x[j], target) >= 0
+ }
+ }
+ // i == j, cmp(x[i-1], target) < 0, and cmp(x[j], target) (= cmp(x[i], target)) >= 0 => answer is i.
+ return i, i < n && cmp(x[i], target) == 0
+}
+
+type sortedHint int // hint for pdqsort when choosing the pivot
+
+const (
+ unknownHint sortedHint = iota
+ increasingHint
+ decreasingHint
+)
+
+// xorshift paper: https://www.jstatsoft.org/article/view/v008i14/xorshift.pdf
+type xorshift uint64
+
+func (r *xorshift) Next() uint64 {
+ *r ^= *r << 13
+ *r ^= *r >> 17
+ *r ^= *r << 5
+ return uint64(*r)
+}
+
+func nextPowerOfTwo(length int) uint {
+ return 1 << bits.Len(uint(length))
+}
+
+// isNaN reports whether x is a NaN without requiring the math package.
+// This will always return false if T is not floating-point.
+func isNaN[T constraints.Ordered](x T) bool {
+ return x != x
+}
diff --git a/vendor/golang.org/x/exp/slices/zsortanyfunc.go b/vendor/golang.org/x/exp/slices/zsortanyfunc.go
new file mode 100644
index 00000000..06f2c7a2
--- /dev/null
+++ b/vendor/golang.org/x/exp/slices/zsortanyfunc.go
@@ -0,0 +1,479 @@
+// Code generated by gen_sort_variants.go; DO NOT EDIT.
+
+// Copyright 2022 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 slices
+
+// insertionSortCmpFunc sorts data[a:b] using insertion sort.
+func insertionSortCmpFunc[E any](data []E, a, b int, cmp func(a, b E) int) {
+ for i := a + 1; i < b; i++ {
+ for j := i; j > a && (cmp(data[j], data[j-1]) < 0); j-- {
+ data[j], data[j-1] = data[j-1], data[j]
+ }
+ }
+}
+
+// siftDownCmpFunc implements the heap property on data[lo:hi].
+// first is an offset into the array where the root of the heap lies.
+func siftDownCmpFunc[E any](data []E, lo, hi, first int, cmp func(a, b E) int) {
+ root := lo
+ for {
+ child := 2*root + 1
+ if child >= hi {
+ break
+ }
+ if child+1 < hi && (cmp(data[first+child], data[first+child+1]) < 0) {
+ child++
+ }
+ if !(cmp(data[first+root], data[first+child]) < 0) {
+ return
+ }
+ data[first+root], data[first+child] = data[first+child], data[first+root]
+ root = child
+ }
+}
+
+func heapSortCmpFunc[E any](data []E, a, b int, cmp func(a, b E) int) {
+ first := a
+ lo := 0
+ hi := b - a
+
+ // Build heap with greatest element at top.
+ for i := (hi - 1) / 2; i >= 0; i-- {
+ siftDownCmpFunc(data, i, hi, first, cmp)
+ }
+
+ // Pop elements, largest first, into end of data.
+ for i := hi - 1; i >= 0; i-- {
+ data[first], data[first+i] = data[first+i], data[first]
+ siftDownCmpFunc(data, lo, i, first, cmp)
+ }
+}
+
+// pdqsortCmpFunc sorts data[a:b].
+// The algorithm based on pattern-defeating quicksort(pdqsort), but without the optimizations from BlockQuicksort.
+// pdqsort paper: https://arxiv.org/pdf/2106.05123.pdf
+// C++ implementation: https://github.com/orlp/pdqsort
+// Rust implementation: https://docs.rs/pdqsort/latest/pdqsort/
+// limit is the number of allowed bad (very unbalanced) pivots before falling back to heapsort.
+func pdqsortCmpFunc[E any](data []E, a, b, limit int, cmp func(a, b E) int) {
+ const maxInsertion = 12
+
+ var (
+ wasBalanced = true // whether the last partitioning was reasonably balanced
+ wasPartitioned = true // whether the slice was already partitioned
+ )
+
+ for {
+ length := b - a
+
+ if length <= maxInsertion {
+ insertionSortCmpFunc(data, a, b, cmp)
+ return
+ }
+
+ // Fall back to heapsort if too many bad choices were made.
+ if limit == 0 {
+ heapSortCmpFunc(data, a, b, cmp)
+ return
+ }
+
+ // If the last partitioning was imbalanced, we need to breaking patterns.
+ if !wasBalanced {
+ breakPatternsCmpFunc(data, a, b, cmp)
+ limit--
+ }
+
+ pivot, hint := choosePivotCmpFunc(data, a, b, cmp)
+ if hint == decreasingHint {
+ reverseRangeCmpFunc(data, a, b, cmp)
+ // The chosen pivot was pivot-a elements after the start of the array.
+ // After reversing it is pivot-a elements before the end of the array.
+ // The idea came from Rust's implementation.
+ pivot = (b - 1) - (pivot - a)
+ hint = increasingHint
+ }
+
+ // The slice is likely already sorted.
+ if wasBalanced && wasPartitioned && hint == increasingHint {
+ if partialInsertionSortCmpFunc(data, a, b, cmp) {
+ return
+ }
+ }
+
+ // Probably the slice contains many duplicate elements, partition the slice into
+ // elements equal to and elements greater than the pivot.
+ if a > 0 && !(cmp(data[a-1], data[pivot]) < 0) {
+ mid := partitionEqualCmpFunc(data, a, b, pivot, cmp)
+ a = mid
+ continue
+ }
+
+ mid, alreadyPartitioned := partitionCmpFunc(data, a, b, pivot, cmp)
+ wasPartitioned = alreadyPartitioned
+
+ leftLen, rightLen := mid-a, b-mid
+ balanceThreshold := length / 8
+ if leftLen < rightLen {
+ wasBalanced = leftLen >= balanceThreshold
+ pdqsortCmpFunc(data, a, mid, limit, cmp)
+ a = mid + 1
+ } else {
+ wasBalanced = rightLen >= balanceThreshold
+ pdqsortCmpFunc(data, mid+1, b, limit, cmp)
+ b = mid
+ }
+ }
+}
+
+// partitionCmpFunc does one quicksort partition.
+// Let p = data[pivot]
+// Moves elements in data[a:b] around, so that data[i]=p for inewpivot.
+// On return, data[newpivot] = p
+func partitionCmpFunc[E any](data []E, a, b, pivot int, cmp func(a, b E) int) (newpivot int, alreadyPartitioned bool) {
+ data[a], data[pivot] = data[pivot], data[a]
+ i, j := a+1, b-1 // i and j are inclusive of the elements remaining to be partitioned
+
+ for i <= j && (cmp(data[i], data[a]) < 0) {
+ i++
+ }
+ for i <= j && !(cmp(data[j], data[a]) < 0) {
+ j--
+ }
+ if i > j {
+ data[j], data[a] = data[a], data[j]
+ return j, true
+ }
+ data[i], data[j] = data[j], data[i]
+ i++
+ j--
+
+ for {
+ for i <= j && (cmp(data[i], data[a]) < 0) {
+ i++
+ }
+ for i <= j && !(cmp(data[j], data[a]) < 0) {
+ j--
+ }
+ if i > j {
+ break
+ }
+ data[i], data[j] = data[j], data[i]
+ i++
+ j--
+ }
+ data[j], data[a] = data[a], data[j]
+ return j, false
+}
+
+// partitionEqualCmpFunc partitions data[a:b] into elements equal to data[pivot] followed by elements greater than data[pivot].
+// It assumed that data[a:b] does not contain elements smaller than the data[pivot].
+func partitionEqualCmpFunc[E any](data []E, a, b, pivot int, cmp func(a, b E) int) (newpivot int) {
+ data[a], data[pivot] = data[pivot], data[a]
+ i, j := a+1, b-1 // i and j are inclusive of the elements remaining to be partitioned
+
+ for {
+ for i <= j && !(cmp(data[a], data[i]) < 0) {
+ i++
+ }
+ for i <= j && (cmp(data[a], data[j]) < 0) {
+ j--
+ }
+ if i > j {
+ break
+ }
+ data[i], data[j] = data[j], data[i]
+ i++
+ j--
+ }
+ return i
+}
+
+// partialInsertionSortCmpFunc partially sorts a slice, returns true if the slice is sorted at the end.
+func partialInsertionSortCmpFunc[E any](data []E, a, b int, cmp func(a, b E) int) bool {
+ const (
+ maxSteps = 5 // maximum number of adjacent out-of-order pairs that will get shifted
+ shortestShifting = 50 // don't shift any elements on short arrays
+ )
+ i := a + 1
+ for j := 0; j < maxSteps; j++ {
+ for i < b && !(cmp(data[i], data[i-1]) < 0) {
+ i++
+ }
+
+ if i == b {
+ return true
+ }
+
+ if b-a < shortestShifting {
+ return false
+ }
+
+ data[i], data[i-1] = data[i-1], data[i]
+
+ // Shift the smaller one to the left.
+ if i-a >= 2 {
+ for j := i - 1; j >= 1; j-- {
+ if !(cmp(data[j], data[j-1]) < 0) {
+ break
+ }
+ data[j], data[j-1] = data[j-1], data[j]
+ }
+ }
+ // Shift the greater one to the right.
+ if b-i >= 2 {
+ for j := i + 1; j < b; j++ {
+ if !(cmp(data[j], data[j-1]) < 0) {
+ break
+ }
+ data[j], data[j-1] = data[j-1], data[j]
+ }
+ }
+ }
+ return false
+}
+
+// breakPatternsCmpFunc scatters some elements around in an attempt to break some patterns
+// that might cause imbalanced partitions in quicksort.
+func breakPatternsCmpFunc[E any](data []E, a, b int, cmp func(a, b E) int) {
+ length := b - a
+ if length >= 8 {
+ random := xorshift(length)
+ modulus := nextPowerOfTwo(length)
+
+ for idx := a + (length/4)*2 - 1; idx <= a+(length/4)*2+1; idx++ {
+ other := int(uint(random.Next()) & (modulus - 1))
+ if other >= length {
+ other -= length
+ }
+ data[idx], data[a+other] = data[a+other], data[idx]
+ }
+ }
+}
+
+// choosePivotCmpFunc chooses a pivot in data[a:b].
+//
+// [0,8): chooses a static pivot.
+// [8,shortestNinther): uses the simple median-of-three method.
+// [shortestNinther,∞): uses the Tukey ninther method.
+func choosePivotCmpFunc[E any](data []E, a, b int, cmp func(a, b E) int) (pivot int, hint sortedHint) {
+ const (
+ shortestNinther = 50
+ maxSwaps = 4 * 3
+ )
+
+ l := b - a
+
+ var (
+ swaps int
+ i = a + l/4*1
+ j = a + l/4*2
+ k = a + l/4*3
+ )
+
+ if l >= 8 {
+ if l >= shortestNinther {
+ // Tukey ninther method, the idea came from Rust's implementation.
+ i = medianAdjacentCmpFunc(data, i, &swaps, cmp)
+ j = medianAdjacentCmpFunc(data, j, &swaps, cmp)
+ k = medianAdjacentCmpFunc(data, k, &swaps, cmp)
+ }
+ // Find the median among i, j, k and stores it into j.
+ j = medianCmpFunc(data, i, j, k, &swaps, cmp)
+ }
+
+ switch swaps {
+ case 0:
+ return j, increasingHint
+ case maxSwaps:
+ return j, decreasingHint
+ default:
+ return j, unknownHint
+ }
+}
+
+// order2CmpFunc returns x,y where data[x] <= data[y], where x,y=a,b or x,y=b,a.
+func order2CmpFunc[E any](data []E, a, b int, swaps *int, cmp func(a, b E) int) (int, int) {
+ if cmp(data[b], data[a]) < 0 {
+ *swaps++
+ return b, a
+ }
+ return a, b
+}
+
+// medianCmpFunc returns x where data[x] is the median of data[a],data[b],data[c], where x is a, b, or c.
+func medianCmpFunc[E any](data []E, a, b, c int, swaps *int, cmp func(a, b E) int) int {
+ a, b = order2CmpFunc(data, a, b, swaps, cmp)
+ b, c = order2CmpFunc(data, b, c, swaps, cmp)
+ a, b = order2CmpFunc(data, a, b, swaps, cmp)
+ return b
+}
+
+// medianAdjacentCmpFunc finds the median of data[a - 1], data[a], data[a + 1] and stores the index into a.
+func medianAdjacentCmpFunc[E any](data []E, a int, swaps *int, cmp func(a, b E) int) int {
+ return medianCmpFunc(data, a-1, a, a+1, swaps, cmp)
+}
+
+func reverseRangeCmpFunc[E any](data []E, a, b int, cmp func(a, b E) int) {
+ i := a
+ j := b - 1
+ for i < j {
+ data[i], data[j] = data[j], data[i]
+ i++
+ j--
+ }
+}
+
+func swapRangeCmpFunc[E any](data []E, a, b, n int, cmp func(a, b E) int) {
+ for i := 0; i < n; i++ {
+ data[a+i], data[b+i] = data[b+i], data[a+i]
+ }
+}
+
+func stableCmpFunc[E any](data []E, n int, cmp func(a, b E) int) {
+ blockSize := 20 // must be > 0
+ a, b := 0, blockSize
+ for b <= n {
+ insertionSortCmpFunc(data, a, b, cmp)
+ a = b
+ b += blockSize
+ }
+ insertionSortCmpFunc(data, a, n, cmp)
+
+ for blockSize < n {
+ a, b = 0, 2*blockSize
+ for b <= n {
+ symMergeCmpFunc(data, a, a+blockSize, b, cmp)
+ a = b
+ b += 2 * blockSize
+ }
+ if m := a + blockSize; m < n {
+ symMergeCmpFunc(data, a, m, n, cmp)
+ }
+ blockSize *= 2
+ }
+}
+
+// symMergeCmpFunc merges the two sorted subsequences data[a:m] and data[m:b] using
+// the SymMerge algorithm from Pok-Son Kim and Arne Kutzner, "Stable Minimum
+// Storage Merging by Symmetric Comparisons", in Susanne Albers and Tomasz
+// Radzik, editors, Algorithms - ESA 2004, volume 3221 of Lecture Notes in
+// Computer Science, pages 714-723. Springer, 2004.
+//
+// Let M = m-a and N = b-n. Wolog M < N.
+// The recursion depth is bound by ceil(log(N+M)).
+// The algorithm needs O(M*log(N/M + 1)) calls to data.Less.
+// The algorithm needs O((M+N)*log(M)) calls to data.Swap.
+//
+// The paper gives O((M+N)*log(M)) as the number of assignments assuming a
+// rotation algorithm which uses O(M+N+gcd(M+N)) assignments. The argumentation
+// in the paper carries through for Swap operations, especially as the block
+// swapping rotate uses only O(M+N) Swaps.
+//
+// symMerge assumes non-degenerate arguments: a < m && m < b.
+// Having the caller check this condition eliminates many leaf recursion calls,
+// which improves performance.
+func symMergeCmpFunc[E any](data []E, a, m, b int, cmp func(a, b E) int) {
+ // Avoid unnecessary recursions of symMerge
+ // by direct insertion of data[a] into data[m:b]
+ // if data[a:m] only contains one element.
+ if m-a == 1 {
+ // Use binary search to find the lowest index i
+ // such that data[i] >= data[a] for m <= i < b.
+ // Exit the search loop with i == b in case no such index exists.
+ i := m
+ j := b
+ for i < j {
+ h := int(uint(i+j) >> 1)
+ if cmp(data[h], data[a]) < 0 {
+ i = h + 1
+ } else {
+ j = h
+ }
+ }
+ // Swap values until data[a] reaches the position before i.
+ for k := a; k < i-1; k++ {
+ data[k], data[k+1] = data[k+1], data[k]
+ }
+ return
+ }
+
+ // Avoid unnecessary recursions of symMerge
+ // by direct insertion of data[m] into data[a:m]
+ // if data[m:b] only contains one element.
+ if b-m == 1 {
+ // Use binary search to find the lowest index i
+ // such that data[i] > data[m] for a <= i < m.
+ // Exit the search loop with i == m in case no such index exists.
+ i := a
+ j := m
+ for i < j {
+ h := int(uint(i+j) >> 1)
+ if !(cmp(data[m], data[h]) < 0) {
+ i = h + 1
+ } else {
+ j = h
+ }
+ }
+ // Swap values until data[m] reaches the position i.
+ for k := m; k > i; k-- {
+ data[k], data[k-1] = data[k-1], data[k]
+ }
+ return
+ }
+
+ mid := int(uint(a+b) >> 1)
+ n := mid + m
+ var start, r int
+ if m > mid {
+ start = n - b
+ r = mid
+ } else {
+ start = a
+ r = m
+ }
+ p := n - 1
+
+ for start < r {
+ c := int(uint(start+r) >> 1)
+ if !(cmp(data[p-c], data[c]) < 0) {
+ start = c + 1
+ } else {
+ r = c
+ }
+ }
+
+ end := n - start
+ if start < m && m < end {
+ rotateCmpFunc(data, start, m, end, cmp)
+ }
+ if a < start && start < mid {
+ symMergeCmpFunc(data, a, start, mid, cmp)
+ }
+ if mid < end && end < b {
+ symMergeCmpFunc(data, mid, end, b, cmp)
+ }
+}
+
+// rotateCmpFunc rotates two consecutive blocks u = data[a:m] and v = data[m:b] in data:
+// Data of the form 'x u v y' is changed to 'x v u y'.
+// rotate performs at most b-a many calls to data.Swap,
+// and it assumes non-degenerate arguments: a < m && m < b.
+func rotateCmpFunc[E any](data []E, a, m, b int, cmp func(a, b E) int) {
+ i := m - a
+ j := b - m
+
+ for i != j {
+ if i > j {
+ swapRangeCmpFunc(data, m-i, m, j, cmp)
+ i -= j
+ } else {
+ swapRangeCmpFunc(data, m-i, m+j-i, i, cmp)
+ j -= i
+ }
+ }
+ // i == j
+ swapRangeCmpFunc(data, m-i, m, i, cmp)
+}
diff --git a/vendor/golang.org/x/exp/slices/zsortordered.go b/vendor/golang.org/x/exp/slices/zsortordered.go
new file mode 100644
index 00000000..99b47c39
--- /dev/null
+++ b/vendor/golang.org/x/exp/slices/zsortordered.go
@@ -0,0 +1,481 @@
+// Code generated by gen_sort_variants.go; DO NOT EDIT.
+
+// Copyright 2022 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 slices
+
+import "golang.org/x/exp/constraints"
+
+// insertionSortOrdered sorts data[a:b] using insertion sort.
+func insertionSortOrdered[E constraints.Ordered](data []E, a, b int) {
+ for i := a + 1; i < b; i++ {
+ for j := i; j > a && cmpLess(data[j], data[j-1]); j-- {
+ data[j], data[j-1] = data[j-1], data[j]
+ }
+ }
+}
+
+// siftDownOrdered implements the heap property on data[lo:hi].
+// first is an offset into the array where the root of the heap lies.
+func siftDownOrdered[E constraints.Ordered](data []E, lo, hi, first int) {
+ root := lo
+ for {
+ child := 2*root + 1
+ if child >= hi {
+ break
+ }
+ if child+1 < hi && cmpLess(data[first+child], data[first+child+1]) {
+ child++
+ }
+ if !cmpLess(data[first+root], data[first+child]) {
+ return
+ }
+ data[first+root], data[first+child] = data[first+child], data[first+root]
+ root = child
+ }
+}
+
+func heapSortOrdered[E constraints.Ordered](data []E, a, b int) {
+ first := a
+ lo := 0
+ hi := b - a
+
+ // Build heap with greatest element at top.
+ for i := (hi - 1) / 2; i >= 0; i-- {
+ siftDownOrdered(data, i, hi, first)
+ }
+
+ // Pop elements, largest first, into end of data.
+ for i := hi - 1; i >= 0; i-- {
+ data[first], data[first+i] = data[first+i], data[first]
+ siftDownOrdered(data, lo, i, first)
+ }
+}
+
+// pdqsortOrdered sorts data[a:b].
+// The algorithm based on pattern-defeating quicksort(pdqsort), but without the optimizations from BlockQuicksort.
+// pdqsort paper: https://arxiv.org/pdf/2106.05123.pdf
+// C++ implementation: https://github.com/orlp/pdqsort
+// Rust implementation: https://docs.rs/pdqsort/latest/pdqsort/
+// limit is the number of allowed bad (very unbalanced) pivots before falling back to heapsort.
+func pdqsortOrdered[E constraints.Ordered](data []E, a, b, limit int) {
+ const maxInsertion = 12
+
+ var (
+ wasBalanced = true // whether the last partitioning was reasonably balanced
+ wasPartitioned = true // whether the slice was already partitioned
+ )
+
+ for {
+ length := b - a
+
+ if length <= maxInsertion {
+ insertionSortOrdered(data, a, b)
+ return
+ }
+
+ // Fall back to heapsort if too many bad choices were made.
+ if limit == 0 {
+ heapSortOrdered(data, a, b)
+ return
+ }
+
+ // If the last partitioning was imbalanced, we need to breaking patterns.
+ if !wasBalanced {
+ breakPatternsOrdered(data, a, b)
+ limit--
+ }
+
+ pivot, hint := choosePivotOrdered(data, a, b)
+ if hint == decreasingHint {
+ reverseRangeOrdered(data, a, b)
+ // The chosen pivot was pivot-a elements after the start of the array.
+ // After reversing it is pivot-a elements before the end of the array.
+ // The idea came from Rust's implementation.
+ pivot = (b - 1) - (pivot - a)
+ hint = increasingHint
+ }
+
+ // The slice is likely already sorted.
+ if wasBalanced && wasPartitioned && hint == increasingHint {
+ if partialInsertionSortOrdered(data, a, b) {
+ return
+ }
+ }
+
+ // Probably the slice contains many duplicate elements, partition the slice into
+ // elements equal to and elements greater than the pivot.
+ if a > 0 && !cmpLess(data[a-1], data[pivot]) {
+ mid := partitionEqualOrdered(data, a, b, pivot)
+ a = mid
+ continue
+ }
+
+ mid, alreadyPartitioned := partitionOrdered(data, a, b, pivot)
+ wasPartitioned = alreadyPartitioned
+
+ leftLen, rightLen := mid-a, b-mid
+ balanceThreshold := length / 8
+ if leftLen < rightLen {
+ wasBalanced = leftLen >= balanceThreshold
+ pdqsortOrdered(data, a, mid, limit)
+ a = mid + 1
+ } else {
+ wasBalanced = rightLen >= balanceThreshold
+ pdqsortOrdered(data, mid+1, b, limit)
+ b = mid
+ }
+ }
+}
+
+// partitionOrdered does one quicksort partition.
+// Let p = data[pivot]
+// Moves elements in data[a:b] around, so that data[i]=p for inewpivot.
+// On return, data[newpivot] = p
+func partitionOrdered[E constraints.Ordered](data []E, a, b, pivot int) (newpivot int, alreadyPartitioned bool) {
+ data[a], data[pivot] = data[pivot], data[a]
+ i, j := a+1, b-1 // i and j are inclusive of the elements remaining to be partitioned
+
+ for i <= j && cmpLess(data[i], data[a]) {
+ i++
+ }
+ for i <= j && !cmpLess(data[j], data[a]) {
+ j--
+ }
+ if i > j {
+ data[j], data[a] = data[a], data[j]
+ return j, true
+ }
+ data[i], data[j] = data[j], data[i]
+ i++
+ j--
+
+ for {
+ for i <= j && cmpLess(data[i], data[a]) {
+ i++
+ }
+ for i <= j && !cmpLess(data[j], data[a]) {
+ j--
+ }
+ if i > j {
+ break
+ }
+ data[i], data[j] = data[j], data[i]
+ i++
+ j--
+ }
+ data[j], data[a] = data[a], data[j]
+ return j, false
+}
+
+// partitionEqualOrdered partitions data[a:b] into elements equal to data[pivot] followed by elements greater than data[pivot].
+// It assumed that data[a:b] does not contain elements smaller than the data[pivot].
+func partitionEqualOrdered[E constraints.Ordered](data []E, a, b, pivot int) (newpivot int) {
+ data[a], data[pivot] = data[pivot], data[a]
+ i, j := a+1, b-1 // i and j are inclusive of the elements remaining to be partitioned
+
+ for {
+ for i <= j && !cmpLess(data[a], data[i]) {
+ i++
+ }
+ for i <= j && cmpLess(data[a], data[j]) {
+ j--
+ }
+ if i > j {
+ break
+ }
+ data[i], data[j] = data[j], data[i]
+ i++
+ j--
+ }
+ return i
+}
+
+// partialInsertionSortOrdered partially sorts a slice, returns true if the slice is sorted at the end.
+func partialInsertionSortOrdered[E constraints.Ordered](data []E, a, b int) bool {
+ const (
+ maxSteps = 5 // maximum number of adjacent out-of-order pairs that will get shifted
+ shortestShifting = 50 // don't shift any elements on short arrays
+ )
+ i := a + 1
+ for j := 0; j < maxSteps; j++ {
+ for i < b && !cmpLess(data[i], data[i-1]) {
+ i++
+ }
+
+ if i == b {
+ return true
+ }
+
+ if b-a < shortestShifting {
+ return false
+ }
+
+ data[i], data[i-1] = data[i-1], data[i]
+
+ // Shift the smaller one to the left.
+ if i-a >= 2 {
+ for j := i - 1; j >= 1; j-- {
+ if !cmpLess(data[j], data[j-1]) {
+ break
+ }
+ data[j], data[j-1] = data[j-1], data[j]
+ }
+ }
+ // Shift the greater one to the right.
+ if b-i >= 2 {
+ for j := i + 1; j < b; j++ {
+ if !cmpLess(data[j], data[j-1]) {
+ break
+ }
+ data[j], data[j-1] = data[j-1], data[j]
+ }
+ }
+ }
+ return false
+}
+
+// breakPatternsOrdered scatters some elements around in an attempt to break some patterns
+// that might cause imbalanced partitions in quicksort.
+func breakPatternsOrdered[E constraints.Ordered](data []E, a, b int) {
+ length := b - a
+ if length >= 8 {
+ random := xorshift(length)
+ modulus := nextPowerOfTwo(length)
+
+ for idx := a + (length/4)*2 - 1; idx <= a+(length/4)*2+1; idx++ {
+ other := int(uint(random.Next()) & (modulus - 1))
+ if other >= length {
+ other -= length
+ }
+ data[idx], data[a+other] = data[a+other], data[idx]
+ }
+ }
+}
+
+// choosePivotOrdered chooses a pivot in data[a:b].
+//
+// [0,8): chooses a static pivot.
+// [8,shortestNinther): uses the simple median-of-three method.
+// [shortestNinther,∞): uses the Tukey ninther method.
+func choosePivotOrdered[E constraints.Ordered](data []E, a, b int) (pivot int, hint sortedHint) {
+ const (
+ shortestNinther = 50
+ maxSwaps = 4 * 3
+ )
+
+ l := b - a
+
+ var (
+ swaps int
+ i = a + l/4*1
+ j = a + l/4*2
+ k = a + l/4*3
+ )
+
+ if l >= 8 {
+ if l >= shortestNinther {
+ // Tukey ninther method, the idea came from Rust's implementation.
+ i = medianAdjacentOrdered(data, i, &swaps)
+ j = medianAdjacentOrdered(data, j, &swaps)
+ k = medianAdjacentOrdered(data, k, &swaps)
+ }
+ // Find the median among i, j, k and stores it into j.
+ j = medianOrdered(data, i, j, k, &swaps)
+ }
+
+ switch swaps {
+ case 0:
+ return j, increasingHint
+ case maxSwaps:
+ return j, decreasingHint
+ default:
+ return j, unknownHint
+ }
+}
+
+// order2Ordered returns x,y where data[x] <= data[y], where x,y=a,b or x,y=b,a.
+func order2Ordered[E constraints.Ordered](data []E, a, b int, swaps *int) (int, int) {
+ if cmpLess(data[b], data[a]) {
+ *swaps++
+ return b, a
+ }
+ return a, b
+}
+
+// medianOrdered returns x where data[x] is the median of data[a],data[b],data[c], where x is a, b, or c.
+func medianOrdered[E constraints.Ordered](data []E, a, b, c int, swaps *int) int {
+ a, b = order2Ordered(data, a, b, swaps)
+ b, c = order2Ordered(data, b, c, swaps)
+ a, b = order2Ordered(data, a, b, swaps)
+ return b
+}
+
+// medianAdjacentOrdered finds the median of data[a - 1], data[a], data[a + 1] and stores the index into a.
+func medianAdjacentOrdered[E constraints.Ordered](data []E, a int, swaps *int) int {
+ return medianOrdered(data, a-1, a, a+1, swaps)
+}
+
+func reverseRangeOrdered[E constraints.Ordered](data []E, a, b int) {
+ i := a
+ j := b - 1
+ for i < j {
+ data[i], data[j] = data[j], data[i]
+ i++
+ j--
+ }
+}
+
+func swapRangeOrdered[E constraints.Ordered](data []E, a, b, n int) {
+ for i := 0; i < n; i++ {
+ data[a+i], data[b+i] = data[b+i], data[a+i]
+ }
+}
+
+func stableOrdered[E constraints.Ordered](data []E, n int) {
+ blockSize := 20 // must be > 0
+ a, b := 0, blockSize
+ for b <= n {
+ insertionSortOrdered(data, a, b)
+ a = b
+ b += blockSize
+ }
+ insertionSortOrdered(data, a, n)
+
+ for blockSize < n {
+ a, b = 0, 2*blockSize
+ for b <= n {
+ symMergeOrdered(data, a, a+blockSize, b)
+ a = b
+ b += 2 * blockSize
+ }
+ if m := a + blockSize; m < n {
+ symMergeOrdered(data, a, m, n)
+ }
+ blockSize *= 2
+ }
+}
+
+// symMergeOrdered merges the two sorted subsequences data[a:m] and data[m:b] using
+// the SymMerge algorithm from Pok-Son Kim and Arne Kutzner, "Stable Minimum
+// Storage Merging by Symmetric Comparisons", in Susanne Albers and Tomasz
+// Radzik, editors, Algorithms - ESA 2004, volume 3221 of Lecture Notes in
+// Computer Science, pages 714-723. Springer, 2004.
+//
+// Let M = m-a and N = b-n. Wolog M < N.
+// The recursion depth is bound by ceil(log(N+M)).
+// The algorithm needs O(M*log(N/M + 1)) calls to data.Less.
+// The algorithm needs O((M+N)*log(M)) calls to data.Swap.
+//
+// The paper gives O((M+N)*log(M)) as the number of assignments assuming a
+// rotation algorithm which uses O(M+N+gcd(M+N)) assignments. The argumentation
+// in the paper carries through for Swap operations, especially as the block
+// swapping rotate uses only O(M+N) Swaps.
+//
+// symMerge assumes non-degenerate arguments: a < m && m < b.
+// Having the caller check this condition eliminates many leaf recursion calls,
+// which improves performance.
+func symMergeOrdered[E constraints.Ordered](data []E, a, m, b int) {
+ // Avoid unnecessary recursions of symMerge
+ // by direct insertion of data[a] into data[m:b]
+ // if data[a:m] only contains one element.
+ if m-a == 1 {
+ // Use binary search to find the lowest index i
+ // such that data[i] >= data[a] for m <= i < b.
+ // Exit the search loop with i == b in case no such index exists.
+ i := m
+ j := b
+ for i < j {
+ h := int(uint(i+j) >> 1)
+ if cmpLess(data[h], data[a]) {
+ i = h + 1
+ } else {
+ j = h
+ }
+ }
+ // Swap values until data[a] reaches the position before i.
+ for k := a; k < i-1; k++ {
+ data[k], data[k+1] = data[k+1], data[k]
+ }
+ return
+ }
+
+ // Avoid unnecessary recursions of symMerge
+ // by direct insertion of data[m] into data[a:m]
+ // if data[m:b] only contains one element.
+ if b-m == 1 {
+ // Use binary search to find the lowest index i
+ // such that data[i] > data[m] for a <= i < m.
+ // Exit the search loop with i == m in case no such index exists.
+ i := a
+ j := m
+ for i < j {
+ h := int(uint(i+j) >> 1)
+ if !cmpLess(data[m], data[h]) {
+ i = h + 1
+ } else {
+ j = h
+ }
+ }
+ // Swap values until data[m] reaches the position i.
+ for k := m; k > i; k-- {
+ data[k], data[k-1] = data[k-1], data[k]
+ }
+ return
+ }
+
+ mid := int(uint(a+b) >> 1)
+ n := mid + m
+ var start, r int
+ if m > mid {
+ start = n - b
+ r = mid
+ } else {
+ start = a
+ r = m
+ }
+ p := n - 1
+
+ for start < r {
+ c := int(uint(start+r) >> 1)
+ if !cmpLess(data[p-c], data[c]) {
+ start = c + 1
+ } else {
+ r = c
+ }
+ }
+
+ end := n - start
+ if start < m && m < end {
+ rotateOrdered(data, start, m, end)
+ }
+ if a < start && start < mid {
+ symMergeOrdered(data, a, start, mid)
+ }
+ if mid < end && end < b {
+ symMergeOrdered(data, mid, end, b)
+ }
+}
+
+// rotateOrdered rotates two consecutive blocks u = data[a:m] and v = data[m:b] in data:
+// Data of the form 'x u v y' is changed to 'x v u y'.
+// rotate performs at most b-a many calls to data.Swap,
+// and it assumes non-degenerate arguments: a < m && m < b.
+func rotateOrdered[E constraints.Ordered](data []E, a, m, b int) {
+ i := m - a
+ j := b - m
+
+ for i != j {
+ if i > j {
+ swapRangeOrdered(data, m-i, m, j)
+ i -= j
+ } else {
+ swapRangeOrdered(data, m-i, m+j-i, i)
+ j -= i
+ }
+ }
+ // i == j
+ swapRangeOrdered(data, m-i, m, i)
+}
diff --git a/vendor/golang.org/x/exp/slog/attr.go b/vendor/golang.org/x/exp/slog/attr.go
new file mode 100644
index 00000000..a180d0e1
--- /dev/null
+++ b/vendor/golang.org/x/exp/slog/attr.go
@@ -0,0 +1,102 @@
+// Copyright 2022 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 slog
+
+import (
+ "fmt"
+ "time"
+)
+
+// An Attr is a key-value pair.
+type Attr struct {
+ Key string
+ Value Value
+}
+
+// String returns an Attr for a string value.
+func String(key, value string) Attr {
+ return Attr{key, StringValue(value)}
+}
+
+// Int64 returns an Attr for an int64.
+func Int64(key string, value int64) Attr {
+ return Attr{key, Int64Value(value)}
+}
+
+// Int converts an int to an int64 and returns
+// an Attr with that value.
+func Int(key string, value int) Attr {
+ return Int64(key, int64(value))
+}
+
+// Uint64 returns an Attr for a uint64.
+func Uint64(key string, v uint64) Attr {
+ return Attr{key, Uint64Value(v)}
+}
+
+// Float64 returns an Attr for a floating-point number.
+func Float64(key string, v float64) Attr {
+ return Attr{key, Float64Value(v)}
+}
+
+// Bool returns an Attr for a bool.
+func Bool(key string, v bool) Attr {
+ return Attr{key, BoolValue(v)}
+}
+
+// Time returns an Attr for a time.Time.
+// It discards the monotonic portion.
+func Time(key string, v time.Time) Attr {
+ return Attr{key, TimeValue(v)}
+}
+
+// Duration returns an Attr for a time.Duration.
+func Duration(key string, v time.Duration) Attr {
+ return Attr{key, DurationValue(v)}
+}
+
+// Group returns an Attr for a Group Value.
+// The first argument is the key; the remaining arguments
+// are converted to Attrs as in [Logger.Log].
+//
+// Use Group to collect several key-value pairs under a single
+// key on a log line, or as the result of LogValue
+// in order to log a single value as multiple Attrs.
+func Group(key string, args ...any) Attr {
+ return Attr{key, GroupValue(argsToAttrSlice(args)...)}
+}
+
+func argsToAttrSlice(args []any) []Attr {
+ var (
+ attr Attr
+ attrs []Attr
+ )
+ for len(args) > 0 {
+ attr, args = argsToAttr(args)
+ attrs = append(attrs, attr)
+ }
+ return attrs
+}
+
+// Any returns an Attr for the supplied value.
+// See [Value.AnyValue] for how values are treated.
+func Any(key string, value any) Attr {
+ return Attr{key, AnyValue(value)}
+}
+
+// Equal reports whether a and b have equal keys and values.
+func (a Attr) Equal(b Attr) bool {
+ return a.Key == b.Key && a.Value.Equal(b.Value)
+}
+
+func (a Attr) String() string {
+ return fmt.Sprintf("%s=%s", a.Key, a.Value)
+}
+
+// isEmpty reports whether a has an empty key and a nil value.
+// That can be written as Attr{} or Any("", nil).
+func (a Attr) isEmpty() bool {
+ return a.Key == "" && a.Value.num == 0 && a.Value.any == nil
+}
diff --git a/vendor/golang.org/x/exp/slog/doc.go b/vendor/golang.org/x/exp/slog/doc.go
new file mode 100644
index 00000000..4beaf867
--- /dev/null
+++ b/vendor/golang.org/x/exp/slog/doc.go
@@ -0,0 +1,316 @@
+// Copyright 2022 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 slog provides structured logging,
+in which log records include a message,
+a severity level, and various other attributes
+expressed as key-value pairs.
+
+It defines a type, [Logger],
+which provides several methods (such as [Logger.Info] and [Logger.Error])
+for reporting events of interest.
+
+Each Logger is associated with a [Handler].
+A Logger output method creates a [Record] from the method arguments
+and passes it to the Handler, which decides how to handle it.
+There is a default Logger accessible through top-level functions
+(such as [Info] and [Error]) that call the corresponding Logger methods.
+
+A log record consists of a time, a level, a message, and a set of key-value
+pairs, where the keys are strings and the values may be of any type.
+As an example,
+
+ slog.Info("hello", "count", 3)
+
+creates a record containing the time of the call,
+a level of Info, the message "hello", and a single
+pair with key "count" and value 3.
+
+The [Info] top-level function calls the [Logger.Info] method on the default Logger.
+In addition to [Logger.Info], there are methods for Debug, Warn and Error levels.
+Besides these convenience methods for common levels,
+there is also a [Logger.Log] method which takes the level as an argument.
+Each of these methods has a corresponding top-level function that uses the
+default logger.
+
+The default handler formats the log record's message, time, level, and attributes
+as a string and passes it to the [log] package.
+
+ 2022/11/08 15:28:26 INFO hello count=3
+
+For more control over the output format, create a logger with a different handler.
+This statement uses [New] to create a new logger with a TextHandler
+that writes structured records in text form to standard error:
+
+ logger := slog.New(slog.NewTextHandler(os.Stderr, nil))
+
+[TextHandler] output is a sequence of key=value pairs, easily and unambiguously
+parsed by machine. This statement:
+
+ logger.Info("hello", "count", 3)
+
+produces this output:
+
+ time=2022-11-08T15:28:26.000-05:00 level=INFO msg=hello count=3
+
+The package also provides [JSONHandler], whose output is line-delimited JSON:
+
+ logger := slog.New(slog.NewJSONHandler(os.Stdout, nil))
+ logger.Info("hello", "count", 3)
+
+produces this output:
+
+ {"time":"2022-11-08T15:28:26.000000000-05:00","level":"INFO","msg":"hello","count":3}
+
+Both [TextHandler] and [JSONHandler] can be configured with [HandlerOptions].
+There are options for setting the minimum level (see Levels, below),
+displaying the source file and line of the log call, and
+modifying attributes before they are logged.
+
+Setting a logger as the default with
+
+ slog.SetDefault(logger)
+
+will cause the top-level functions like [Info] to use it.
+[SetDefault] also updates the default logger used by the [log] package,
+so that existing applications that use [log.Printf] and related functions
+will send log records to the logger's handler without needing to be rewritten.
+
+Some attributes are common to many log calls.
+For example, you may wish to include the URL or trace identifier of a server request
+with all log events arising from the request.
+Rather than repeat the attribute with every log call, you can use [Logger.With]
+to construct a new Logger containing the attributes:
+
+ logger2 := logger.With("url", r.URL)
+
+The arguments to With are the same key-value pairs used in [Logger.Info].
+The result is a new Logger with the same handler as the original, but additional
+attributes that will appear in the output of every call.
+
+# Levels
+
+A [Level] is an integer representing the importance or severity of a log event.
+The higher the level, the more severe the event.
+This package defines constants for the most common levels,
+but any int can be used as a level.
+
+In an application, you may wish to log messages only at a certain level or greater.
+One common configuration is to log messages at Info or higher levels,
+suppressing debug logging until it is needed.
+The built-in handlers can be configured with the minimum level to output by
+setting [HandlerOptions.Level].
+The program's `main` function typically does this.
+The default value is LevelInfo.
+
+Setting the [HandlerOptions.Level] field to a [Level] value
+fixes the handler's minimum level throughout its lifetime.
+Setting it to a [LevelVar] allows the level to be varied dynamically.
+A LevelVar holds a Level and is safe to read or write from multiple
+goroutines.
+To vary the level dynamically for an entire program, first initialize
+a global LevelVar:
+
+ var programLevel = new(slog.LevelVar) // Info by default
+
+Then use the LevelVar to construct a handler, and make it the default:
+
+ h := slog.NewJSONHandler(os.Stderr, &slog.HandlerOptions{Level: programLevel})
+ slog.SetDefault(slog.New(h))
+
+Now the program can change its logging level with a single statement:
+
+ programLevel.Set(slog.LevelDebug)
+
+# Groups
+
+Attributes can be collected into groups.
+A group has a name that is used to qualify the names of its attributes.
+How this qualification is displayed depends on the handler.
+[TextHandler] separates the group and attribute names with a dot.
+[JSONHandler] treats each group as a separate JSON object, with the group name as the key.
+
+Use [Group] to create a Group attribute from a name and a list of key-value pairs:
+
+ slog.Group("request",
+ "method", r.Method,
+ "url", r.URL)
+
+TextHandler would display this group as
+
+ request.method=GET request.url=http://example.com
+
+JSONHandler would display it as
+
+ "request":{"method":"GET","url":"http://example.com"}
+
+Use [Logger.WithGroup] to qualify all of a Logger's output
+with a group name. Calling WithGroup on a Logger results in a
+new Logger with the same Handler as the original, but with all
+its attributes qualified by the group name.
+
+This can help prevent duplicate attribute keys in large systems,
+where subsystems might use the same keys.
+Pass each subsystem a different Logger with its own group name so that
+potential duplicates are qualified:
+
+ logger := slog.Default().With("id", systemID)
+ parserLogger := logger.WithGroup("parser")
+ parseInput(input, parserLogger)
+
+When parseInput logs with parserLogger, its keys will be qualified with "parser",
+so even if it uses the common key "id", the log line will have distinct keys.
+
+# Contexts
+
+Some handlers may wish to include information from the [context.Context] that is
+available at the call site. One example of such information
+is the identifier for the current span when tracing is enabled.
+
+The [Logger.Log] and [Logger.LogAttrs] methods take a context as a first
+argument, as do their corresponding top-level functions.
+
+Although the convenience methods on Logger (Info and so on) and the
+corresponding top-level functions do not take a context, the alternatives ending
+in "Context" do. For example,
+
+ slog.InfoContext(ctx, "message")
+
+It is recommended to pass a context to an output method if one is available.
+
+# Attrs and Values
+
+An [Attr] is a key-value pair. The Logger output methods accept Attrs as well as
+alternating keys and values. The statement
+
+ slog.Info("hello", slog.Int("count", 3))
+
+behaves the same as
+
+ slog.Info("hello", "count", 3)
+
+There are convenience constructors for [Attr] such as [Int], [String], and [Bool]
+for common types, as well as the function [Any] for constructing Attrs of any
+type.
+
+The value part of an Attr is a type called [Value].
+Like an [any], a Value can hold any Go value,
+but it can represent typical values, including all numbers and strings,
+without an allocation.
+
+For the most efficient log output, use [Logger.LogAttrs].
+It is similar to [Logger.Log] but accepts only Attrs, not alternating
+keys and values; this allows it, too, to avoid allocation.
+
+The call
+
+ logger.LogAttrs(nil, slog.LevelInfo, "hello", slog.Int("count", 3))
+
+is the most efficient way to achieve the same output as
+
+ slog.Info("hello", "count", 3)
+
+# Customizing a type's logging behavior
+
+If a type implements the [LogValuer] interface, the [Value] returned from its LogValue
+method is used for logging. You can use this to control how values of the type
+appear in logs. For example, you can redact secret information like passwords,
+or gather a struct's fields in a Group. See the examples under [LogValuer] for
+details.
+
+A LogValue method may return a Value that itself implements [LogValuer]. The [Value.Resolve]
+method handles these cases carefully, avoiding infinite loops and unbounded recursion.
+Handler authors and others may wish to use Value.Resolve instead of calling LogValue directly.
+
+# Wrapping output methods
+
+The logger functions use reflection over the call stack to find the file name
+and line number of the logging call within the application. This can produce
+incorrect source information for functions that wrap slog. For instance, if you
+define this function in file mylog.go:
+
+ func Infof(format string, args ...any) {
+ slog.Default().Info(fmt.Sprintf(format, args...))
+ }
+
+and you call it like this in main.go:
+
+ Infof(slog.Default(), "hello, %s", "world")
+
+then slog will report the source file as mylog.go, not main.go.
+
+A correct implementation of Infof will obtain the source location
+(pc) and pass it to NewRecord.
+The Infof function in the package-level example called "wrapping"
+demonstrates how to do this.
+
+# Working with Records
+
+Sometimes a Handler will need to modify a Record
+before passing it on to another Handler or backend.
+A Record contains a mixture of simple public fields (e.g. Time, Level, Message)
+and hidden fields that refer to state (such as attributes) indirectly. This
+means that modifying a simple copy of a Record (e.g. by calling
+[Record.Add] or [Record.AddAttrs] to add attributes)
+may have unexpected effects on the original.
+Before modifying a Record, use [Clone] to
+create a copy that shares no state with the original,
+or create a new Record with [NewRecord]
+and build up its Attrs by traversing the old ones with [Record.Attrs].
+
+# Performance considerations
+
+If profiling your application demonstrates that logging is taking significant time,
+the following suggestions may help.
+
+If many log lines have a common attribute, use [Logger.With] to create a Logger with
+that attribute. The built-in handlers will format that attribute only once, at the
+call to [Logger.With]. The [Handler] interface is designed to allow that optimization,
+and a well-written Handler should take advantage of it.
+
+The arguments to a log call are always evaluated, even if the log event is discarded.
+If possible, defer computation so that it happens only if the value is actually logged.
+For example, consider the call
+
+ slog.Info("starting request", "url", r.URL.String()) // may compute String unnecessarily
+
+The URL.String method will be called even if the logger discards Info-level events.
+Instead, pass the URL directly:
+
+ slog.Info("starting request", "url", &r.URL) // calls URL.String only if needed
+
+The built-in [TextHandler] will call its String method, but only
+if the log event is enabled.
+Avoiding the call to String also preserves the structure of the underlying value.
+For example [JSONHandler] emits the components of the parsed URL as a JSON object.
+If you want to avoid eagerly paying the cost of the String call
+without causing the handler to potentially inspect the structure of the value,
+wrap the value in a fmt.Stringer implementation that hides its Marshal methods.
+
+You can also use the [LogValuer] interface to avoid unnecessary work in disabled log
+calls. Say you need to log some expensive value:
+
+ slog.Debug("frobbing", "value", computeExpensiveValue(arg))
+
+Even if this line is disabled, computeExpensiveValue will be called.
+To avoid that, define a type implementing LogValuer:
+
+ type expensive struct { arg int }
+
+ func (e expensive) LogValue() slog.Value {
+ return slog.AnyValue(computeExpensiveValue(e.arg))
+ }
+
+Then use a value of that type in log calls:
+
+ slog.Debug("frobbing", "value", expensive{arg})
+
+Now computeExpensiveValue will only be called when the line is enabled.
+
+The built-in handlers acquire a lock before calling [io.Writer.Write]
+to ensure that each record is written in one piece. User-defined
+handlers are responsible for their own locking.
+*/
+package slog
diff --git a/vendor/golang.org/x/exp/slog/handler.go b/vendor/golang.org/x/exp/slog/handler.go
new file mode 100644
index 00000000..bd635cb8
--- /dev/null
+++ b/vendor/golang.org/x/exp/slog/handler.go
@@ -0,0 +1,577 @@
+// Copyright 2022 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 slog
+
+import (
+ "context"
+ "fmt"
+ "io"
+ "reflect"
+ "strconv"
+ "sync"
+ "time"
+
+ "golang.org/x/exp/slices"
+ "golang.org/x/exp/slog/internal/buffer"
+)
+
+// A Handler handles log records produced by a Logger..
+//
+// A typical handler may print log records to standard error,
+// or write them to a file or database, or perhaps augment them
+// with additional attributes and pass them on to another handler.
+//
+// Any of the Handler's methods may be called concurrently with itself
+// or with other methods. It is the responsibility of the Handler to
+// manage this concurrency.
+//
+// Users of the slog package should not invoke Handler methods directly.
+// They should use the methods of [Logger] instead.
+type Handler interface {
+ // Enabled reports whether the handler handles records at the given level.
+ // The handler ignores records whose level is lower.
+ // It is called early, before any arguments are processed,
+ // to save effort if the log event should be discarded.
+ // If called from a Logger method, the first argument is the context
+ // passed to that method, or context.Background() if nil was passed
+ // or the method does not take a context.
+ // The context is passed so Enabled can use its values
+ // to make a decision.
+ Enabled(context.Context, Level) bool
+
+ // Handle handles the Record.
+ // It will only be called when Enabled returns true.
+ // The Context argument is as for Enabled.
+ // It is present solely to provide Handlers access to the context's values.
+ // Canceling the context should not affect record processing.
+ // (Among other things, log messages may be necessary to debug a
+ // cancellation-related problem.)
+ //
+ // Handle methods that produce output should observe the following rules:
+ // - If r.Time is the zero time, ignore the time.
+ // - If r.PC is zero, ignore it.
+ // - Attr's values should be resolved.
+ // - If an Attr's key and value are both the zero value, ignore the Attr.
+ // This can be tested with attr.Equal(Attr{}).
+ // - If a group's key is empty, inline the group's Attrs.
+ // - If a group has no Attrs (even if it has a non-empty key),
+ // ignore it.
+ Handle(context.Context, Record) error
+
+ // WithAttrs returns a new Handler whose attributes consist of
+ // both the receiver's attributes and the arguments.
+ // The Handler owns the slice: it may retain, modify or discard it.
+ WithAttrs(attrs []Attr) Handler
+
+ // WithGroup returns a new Handler with the given group appended to
+ // the receiver's existing groups.
+ // The keys of all subsequent attributes, whether added by With or in a
+ // Record, should be qualified by the sequence of group names.
+ //
+ // How this qualification happens is up to the Handler, so long as
+ // this Handler's attribute keys differ from those of another Handler
+ // with a different sequence of group names.
+ //
+ // A Handler should treat WithGroup as starting a Group of Attrs that ends
+ // at the end of the log event. That is,
+ //
+ // logger.WithGroup("s").LogAttrs(level, msg, slog.Int("a", 1), slog.Int("b", 2))
+ //
+ // should behave like
+ //
+ // logger.LogAttrs(level, msg, slog.Group("s", slog.Int("a", 1), slog.Int("b", 2)))
+ //
+ // If the name is empty, WithGroup returns the receiver.
+ WithGroup(name string) Handler
+}
+
+type defaultHandler struct {
+ ch *commonHandler
+ // log.Output, except for testing
+ output func(calldepth int, message string) error
+}
+
+func newDefaultHandler(output func(int, string) error) *defaultHandler {
+ return &defaultHandler{
+ ch: &commonHandler{json: false},
+ output: output,
+ }
+}
+
+func (*defaultHandler) Enabled(_ context.Context, l Level) bool {
+ return l >= LevelInfo
+}
+
+// Collect the level, attributes and message in a string and
+// write it with the default log.Logger.
+// Let the log.Logger handle time and file/line.
+func (h *defaultHandler) Handle(ctx context.Context, r Record) error {
+ buf := buffer.New()
+ buf.WriteString(r.Level.String())
+ buf.WriteByte(' ')
+ buf.WriteString(r.Message)
+ state := h.ch.newHandleState(buf, true, " ", nil)
+ defer state.free()
+ state.appendNonBuiltIns(r)
+
+ // skip [h.output, defaultHandler.Handle, handlerWriter.Write, log.Output]
+ return h.output(4, buf.String())
+}
+
+func (h *defaultHandler) WithAttrs(as []Attr) Handler {
+ return &defaultHandler{h.ch.withAttrs(as), h.output}
+}
+
+func (h *defaultHandler) WithGroup(name string) Handler {
+ return &defaultHandler{h.ch.withGroup(name), h.output}
+}
+
+// HandlerOptions are options for a TextHandler or JSONHandler.
+// A zero HandlerOptions consists entirely of default values.
+type HandlerOptions struct {
+ // AddSource causes the handler to compute the source code position
+ // of the log statement and add a SourceKey attribute to the output.
+ AddSource bool
+
+ // Level reports the minimum record level that will be logged.
+ // The handler discards records with lower levels.
+ // If Level is nil, the handler assumes LevelInfo.
+ // The handler calls Level.Level for each record processed;
+ // to adjust the minimum level dynamically, use a LevelVar.
+ Level Leveler
+
+ // ReplaceAttr is called to rewrite each non-group attribute before it is logged.
+ // The attribute's value has been resolved (see [Value.Resolve]).
+ // If ReplaceAttr returns an Attr with Key == "", the attribute is discarded.
+ //
+ // The built-in attributes with keys "time", "level", "source", and "msg"
+ // are passed to this function, except that time is omitted
+ // if zero, and source is omitted if AddSource is false.
+ //
+ // The first argument is a list of currently open groups that contain the
+ // Attr. It must not be retained or modified. ReplaceAttr is never called
+ // for Group attributes, only their contents. For example, the attribute
+ // list
+ //
+ // Int("a", 1), Group("g", Int("b", 2)), Int("c", 3)
+ //
+ // results in consecutive calls to ReplaceAttr with the following arguments:
+ //
+ // nil, Int("a", 1)
+ // []string{"g"}, Int("b", 2)
+ // nil, Int("c", 3)
+ //
+ // ReplaceAttr can be used to change the default keys of the built-in
+ // attributes, convert types (for example, to replace a `time.Time` with the
+ // integer seconds since the Unix epoch), sanitize personal information, or
+ // remove attributes from the output.
+ ReplaceAttr func(groups []string, a Attr) Attr
+}
+
+// Keys for "built-in" attributes.
+const (
+ // TimeKey is the key used by the built-in handlers for the time
+ // when the log method is called. The associated Value is a [time.Time].
+ TimeKey = "time"
+ // LevelKey is the key used by the built-in handlers for the level
+ // of the log call. The associated value is a [Level].
+ LevelKey = "level"
+ // MessageKey is the key used by the built-in handlers for the
+ // message of the log call. The associated value is a string.
+ MessageKey = "msg"
+ // SourceKey is the key used by the built-in handlers for the source file
+ // and line of the log call. The associated value is a string.
+ SourceKey = "source"
+)
+
+type commonHandler struct {
+ json bool // true => output JSON; false => output text
+ opts HandlerOptions
+ preformattedAttrs []byte
+ groupPrefix string // for text: prefix of groups opened in preformatting
+ groups []string // all groups started from WithGroup
+ nOpenGroups int // the number of groups opened in preformattedAttrs
+ mu sync.Mutex
+ w io.Writer
+}
+
+func (h *commonHandler) clone() *commonHandler {
+ // We can't use assignment because we can't copy the mutex.
+ return &commonHandler{
+ json: h.json,
+ opts: h.opts,
+ preformattedAttrs: slices.Clip(h.preformattedAttrs),
+ groupPrefix: h.groupPrefix,
+ groups: slices.Clip(h.groups),
+ nOpenGroups: h.nOpenGroups,
+ w: h.w,
+ }
+}
+
+// enabled reports whether l is greater than or equal to the
+// minimum level.
+func (h *commonHandler) enabled(l Level) bool {
+ minLevel := LevelInfo
+ if h.opts.Level != nil {
+ minLevel = h.opts.Level.Level()
+ }
+ return l >= minLevel
+}
+
+func (h *commonHandler) withAttrs(as []Attr) *commonHandler {
+ h2 := h.clone()
+ // Pre-format the attributes as an optimization.
+ prefix := buffer.New()
+ defer prefix.Free()
+ prefix.WriteString(h.groupPrefix)
+ state := h2.newHandleState((*buffer.Buffer)(&h2.preformattedAttrs), false, "", prefix)
+ defer state.free()
+ if len(h2.preformattedAttrs) > 0 {
+ state.sep = h.attrSep()
+ }
+ state.openGroups()
+ for _, a := range as {
+ state.appendAttr(a)
+ }
+ // Remember the new prefix for later keys.
+ h2.groupPrefix = state.prefix.String()
+ // Remember how many opened groups are in preformattedAttrs,
+ // so we don't open them again when we handle a Record.
+ h2.nOpenGroups = len(h2.groups)
+ return h2
+}
+
+func (h *commonHandler) withGroup(name string) *commonHandler {
+ if name == "" {
+ return h
+ }
+ h2 := h.clone()
+ h2.groups = append(h2.groups, name)
+ return h2
+}
+
+func (h *commonHandler) handle(r Record) error {
+ state := h.newHandleState(buffer.New(), true, "", nil)
+ defer state.free()
+ if h.json {
+ state.buf.WriteByte('{')
+ }
+ // Built-in attributes. They are not in a group.
+ stateGroups := state.groups
+ state.groups = nil // So ReplaceAttrs sees no groups instead of the pre groups.
+ rep := h.opts.ReplaceAttr
+ // time
+ if !r.Time.IsZero() {
+ key := TimeKey
+ val := r.Time.Round(0) // strip monotonic to match Attr behavior
+ if rep == nil {
+ state.appendKey(key)
+ state.appendTime(val)
+ } else {
+ state.appendAttr(Time(key, val))
+ }
+ }
+ // level
+ key := LevelKey
+ val := r.Level
+ if rep == nil {
+ state.appendKey(key)
+ state.appendString(val.String())
+ } else {
+ state.appendAttr(Any(key, val))
+ }
+ // source
+ if h.opts.AddSource {
+ state.appendAttr(Any(SourceKey, r.source()))
+ }
+ key = MessageKey
+ msg := r.Message
+ if rep == nil {
+ state.appendKey(key)
+ state.appendString(msg)
+ } else {
+ state.appendAttr(String(key, msg))
+ }
+ state.groups = stateGroups // Restore groups passed to ReplaceAttrs.
+ state.appendNonBuiltIns(r)
+ state.buf.WriteByte('\n')
+
+ h.mu.Lock()
+ defer h.mu.Unlock()
+ _, err := h.w.Write(*state.buf)
+ return err
+}
+
+func (s *handleState) appendNonBuiltIns(r Record) {
+ // preformatted Attrs
+ if len(s.h.preformattedAttrs) > 0 {
+ s.buf.WriteString(s.sep)
+ s.buf.Write(s.h.preformattedAttrs)
+ s.sep = s.h.attrSep()
+ }
+ // Attrs in Record -- unlike the built-in ones, they are in groups started
+ // from WithGroup.
+ s.prefix = buffer.New()
+ defer s.prefix.Free()
+ s.prefix.WriteString(s.h.groupPrefix)
+ s.openGroups()
+ r.Attrs(func(a Attr) bool {
+ s.appendAttr(a)
+ return true
+ })
+ if s.h.json {
+ // Close all open groups.
+ for range s.h.groups {
+ s.buf.WriteByte('}')
+ }
+ // Close the top-level object.
+ s.buf.WriteByte('}')
+ }
+}
+
+// attrSep returns the separator between attributes.
+func (h *commonHandler) attrSep() string {
+ if h.json {
+ return ","
+ }
+ return " "
+}
+
+// handleState holds state for a single call to commonHandler.handle.
+// The initial value of sep determines whether to emit a separator
+// before the next key, after which it stays true.
+type handleState struct {
+ h *commonHandler
+ buf *buffer.Buffer
+ freeBuf bool // should buf be freed?
+ sep string // separator to write before next key
+ prefix *buffer.Buffer // for text: key prefix
+ groups *[]string // pool-allocated slice of active groups, for ReplaceAttr
+}
+
+var groupPool = sync.Pool{New: func() any {
+ s := make([]string, 0, 10)
+ return &s
+}}
+
+func (h *commonHandler) newHandleState(buf *buffer.Buffer, freeBuf bool, sep string, prefix *buffer.Buffer) handleState {
+ s := handleState{
+ h: h,
+ buf: buf,
+ freeBuf: freeBuf,
+ sep: sep,
+ prefix: prefix,
+ }
+ if h.opts.ReplaceAttr != nil {
+ s.groups = groupPool.Get().(*[]string)
+ *s.groups = append(*s.groups, h.groups[:h.nOpenGroups]...)
+ }
+ return s
+}
+
+func (s *handleState) free() {
+ if s.freeBuf {
+ s.buf.Free()
+ }
+ if gs := s.groups; gs != nil {
+ *gs = (*gs)[:0]
+ groupPool.Put(gs)
+ }
+}
+
+func (s *handleState) openGroups() {
+ for _, n := range s.h.groups[s.h.nOpenGroups:] {
+ s.openGroup(n)
+ }
+}
+
+// Separator for group names and keys.
+const keyComponentSep = '.'
+
+// openGroup starts a new group of attributes
+// with the given name.
+func (s *handleState) openGroup(name string) {
+ if s.h.json {
+ s.appendKey(name)
+ s.buf.WriteByte('{')
+ s.sep = ""
+ } else {
+ s.prefix.WriteString(name)
+ s.prefix.WriteByte(keyComponentSep)
+ }
+ // Collect group names for ReplaceAttr.
+ if s.groups != nil {
+ *s.groups = append(*s.groups, name)
+ }
+}
+
+// closeGroup ends the group with the given name.
+func (s *handleState) closeGroup(name string) {
+ if s.h.json {
+ s.buf.WriteByte('}')
+ } else {
+ (*s.prefix) = (*s.prefix)[:len(*s.prefix)-len(name)-1 /* for keyComponentSep */]
+ }
+ s.sep = s.h.attrSep()
+ if s.groups != nil {
+ *s.groups = (*s.groups)[:len(*s.groups)-1]
+ }
+}
+
+// appendAttr appends the Attr's key and value using app.
+// It handles replacement and checking for an empty key.
+// after replacement).
+func (s *handleState) appendAttr(a Attr) {
+ if rep := s.h.opts.ReplaceAttr; rep != nil && a.Value.Kind() != KindGroup {
+ var gs []string
+ if s.groups != nil {
+ gs = *s.groups
+ }
+ // Resolve before calling ReplaceAttr, so the user doesn't have to.
+ a.Value = a.Value.Resolve()
+ a = rep(gs, a)
+ }
+ a.Value = a.Value.Resolve()
+ // Elide empty Attrs.
+ if a.isEmpty() {
+ return
+ }
+ // Special case: Source.
+ if v := a.Value; v.Kind() == KindAny {
+ if src, ok := v.Any().(*Source); ok {
+ if s.h.json {
+ a.Value = src.group()
+ } else {
+ a.Value = StringValue(fmt.Sprintf("%s:%d", src.File, src.Line))
+ }
+ }
+ }
+ if a.Value.Kind() == KindGroup {
+ attrs := a.Value.Group()
+ // Output only non-empty groups.
+ if len(attrs) > 0 {
+ // Inline a group with an empty key.
+ if a.Key != "" {
+ s.openGroup(a.Key)
+ }
+ for _, aa := range attrs {
+ s.appendAttr(aa)
+ }
+ if a.Key != "" {
+ s.closeGroup(a.Key)
+ }
+ }
+ } else {
+ s.appendKey(a.Key)
+ s.appendValue(a.Value)
+ }
+}
+
+func (s *handleState) appendError(err error) {
+ s.appendString(fmt.Sprintf("!ERROR:%v", err))
+}
+
+func (s *handleState) appendKey(key string) {
+ s.buf.WriteString(s.sep)
+ if s.prefix != nil {
+ // TODO: optimize by avoiding allocation.
+ s.appendString(string(*s.prefix) + key)
+ } else {
+ s.appendString(key)
+ }
+ if s.h.json {
+ s.buf.WriteByte(':')
+ } else {
+ s.buf.WriteByte('=')
+ }
+ s.sep = s.h.attrSep()
+}
+
+func (s *handleState) appendString(str string) {
+ if s.h.json {
+ s.buf.WriteByte('"')
+ *s.buf = appendEscapedJSONString(*s.buf, str)
+ s.buf.WriteByte('"')
+ } else {
+ // text
+ if needsQuoting(str) {
+ *s.buf = strconv.AppendQuote(*s.buf, str)
+ } else {
+ s.buf.WriteString(str)
+ }
+ }
+}
+
+func (s *handleState) appendValue(v Value) {
+ defer func() {
+ if r := recover(); r != nil {
+ // If it panics with a nil pointer, the most likely cases are
+ // an encoding.TextMarshaler or error fails to guard against nil,
+ // in which case "" seems to be the feasible choice.
+ //
+ // Adapted from the code in fmt/print.go.
+ if v := reflect.ValueOf(v.any); v.Kind() == reflect.Pointer && v.IsNil() {
+ s.appendString("")
+ return
+ }
+
+ // Otherwise just print the original panic message.
+ s.appendString(fmt.Sprintf("!PANIC: %v", r))
+ }
+ }()
+
+ var err error
+ if s.h.json {
+ err = appendJSONValue(s, v)
+ } else {
+ err = appendTextValue(s, v)
+ }
+ if err != nil {
+ s.appendError(err)
+ }
+}
+
+func (s *handleState) appendTime(t time.Time) {
+ if s.h.json {
+ appendJSONTime(s, t)
+ } else {
+ writeTimeRFC3339Millis(s.buf, t)
+ }
+}
+
+// This takes half the time of Time.AppendFormat.
+func writeTimeRFC3339Millis(buf *buffer.Buffer, t time.Time) {
+ year, month, day := t.Date()
+ buf.WritePosIntWidth(year, 4)
+ buf.WriteByte('-')
+ buf.WritePosIntWidth(int(month), 2)
+ buf.WriteByte('-')
+ buf.WritePosIntWidth(day, 2)
+ buf.WriteByte('T')
+ hour, min, sec := t.Clock()
+ buf.WritePosIntWidth(hour, 2)
+ buf.WriteByte(':')
+ buf.WritePosIntWidth(min, 2)
+ buf.WriteByte(':')
+ buf.WritePosIntWidth(sec, 2)
+ ns := t.Nanosecond()
+ buf.WriteByte('.')
+ buf.WritePosIntWidth(ns/1e6, 3)
+ _, offsetSeconds := t.Zone()
+ if offsetSeconds == 0 {
+ buf.WriteByte('Z')
+ } else {
+ offsetMinutes := offsetSeconds / 60
+ if offsetMinutes < 0 {
+ buf.WriteByte('-')
+ offsetMinutes = -offsetMinutes
+ } else {
+ buf.WriteByte('+')
+ }
+ buf.WritePosIntWidth(offsetMinutes/60, 2)
+ buf.WriteByte(':')
+ buf.WritePosIntWidth(offsetMinutes%60, 2)
+ }
+}
diff --git a/vendor/golang.org/x/exp/slog/internal/buffer/buffer.go b/vendor/golang.org/x/exp/slog/internal/buffer/buffer.go
new file mode 100644
index 00000000..7786c166
--- /dev/null
+++ b/vendor/golang.org/x/exp/slog/internal/buffer/buffer.go
@@ -0,0 +1,84 @@
+// Copyright 2022 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 buffer provides a pool-allocated byte buffer.
+package buffer
+
+import (
+ "sync"
+)
+
+// Buffer adapted from go/src/fmt/print.go
+type Buffer []byte
+
+// Having an initial size gives a dramatic speedup.
+var bufPool = sync.Pool{
+ New: func() any {
+ b := make([]byte, 0, 1024)
+ return (*Buffer)(&b)
+ },
+}
+
+func New() *Buffer {
+ return bufPool.Get().(*Buffer)
+}
+
+func (b *Buffer) Free() {
+ // To reduce peak allocation, return only smaller buffers to the pool.
+ const maxBufferSize = 16 << 10
+ if cap(*b) <= maxBufferSize {
+ *b = (*b)[:0]
+ bufPool.Put(b)
+ }
+}
+
+func (b *Buffer) Reset() {
+ *b = (*b)[:0]
+}
+
+func (b *Buffer) Write(p []byte) (int, error) {
+ *b = append(*b, p...)
+ return len(p), nil
+}
+
+func (b *Buffer) WriteString(s string) {
+ *b = append(*b, s...)
+}
+
+func (b *Buffer) WriteByte(c byte) {
+ *b = append(*b, c)
+}
+
+func (b *Buffer) WritePosInt(i int) {
+ b.WritePosIntWidth(i, 0)
+}
+
+// WritePosIntWidth writes non-negative integer i to the buffer, padded on the left
+// by zeroes to the given width. Use a width of 0 to omit padding.
+func (b *Buffer) WritePosIntWidth(i, width int) {
+ // Cheap integer to fixed-width decimal ASCII.
+ // Copied from log/log.go.
+
+ if i < 0 {
+ panic("negative int")
+ }
+
+ // Assemble decimal in reverse order.
+ var bb [20]byte
+ bp := len(bb) - 1
+ for i >= 10 || width > 1 {
+ width--
+ q := i / 10
+ bb[bp] = byte('0' + i - q*10)
+ bp--
+ i = q
+ }
+ // i < 10
+ bb[bp] = byte('0' + i)
+ b.Write(bb[bp:])
+}
+
+func (b *Buffer) String() string {
+ return string(*b)
+}
diff --git a/vendor/golang.org/x/exp/slog/internal/ignorepc.go b/vendor/golang.org/x/exp/slog/internal/ignorepc.go
new file mode 100644
index 00000000..d1256426
--- /dev/null
+++ b/vendor/golang.org/x/exp/slog/internal/ignorepc.go
@@ -0,0 +1,9 @@
+// Copyright 2023 The Go Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style
+// license that can be found in the LICENSE file.
+
+package internal
+
+// If IgnorePC is true, do not invoke runtime.Callers to get the pc.
+// This is solely for benchmarking the slowdown from runtime.Callers.
+var IgnorePC = false
diff --git a/vendor/golang.org/x/exp/slog/json_handler.go b/vendor/golang.org/x/exp/slog/json_handler.go
new file mode 100644
index 00000000..157ada86
--- /dev/null
+++ b/vendor/golang.org/x/exp/slog/json_handler.go
@@ -0,0 +1,336 @@
+// Copyright 2022 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 slog
+
+import (
+ "bytes"
+ "context"
+ "encoding/json"
+ "errors"
+ "fmt"
+ "io"
+ "strconv"
+ "time"
+ "unicode/utf8"
+
+ "golang.org/x/exp/slog/internal/buffer"
+)
+
+// JSONHandler is a Handler that writes Records to an io.Writer as
+// line-delimited JSON objects.
+type JSONHandler struct {
+ *commonHandler
+}
+
+// NewJSONHandler creates a JSONHandler that writes to w,
+// using the given options.
+// If opts is nil, the default options are used.
+func NewJSONHandler(w io.Writer, opts *HandlerOptions) *JSONHandler {
+ if opts == nil {
+ opts = &HandlerOptions{}
+ }
+ return &JSONHandler{
+ &commonHandler{
+ json: true,
+ w: w,
+ opts: *opts,
+ },
+ }
+}
+
+// Enabled reports whether the handler handles records at the given level.
+// The handler ignores records whose level is lower.
+func (h *JSONHandler) Enabled(_ context.Context, level Level) bool {
+ return h.commonHandler.enabled(level)
+}
+
+// WithAttrs returns a new JSONHandler whose attributes consists
+// of h's attributes followed by attrs.
+func (h *JSONHandler) WithAttrs(attrs []Attr) Handler {
+ return &JSONHandler{commonHandler: h.commonHandler.withAttrs(attrs)}
+}
+
+func (h *JSONHandler) WithGroup(name string) Handler {
+ return &JSONHandler{commonHandler: h.commonHandler.withGroup(name)}
+}
+
+// Handle formats its argument Record as a JSON object on a single line.
+//
+// If the Record's time is zero, the time is omitted.
+// Otherwise, the key is "time"
+// and the value is output as with json.Marshal.
+//
+// If the Record's level is zero, the level is omitted.
+// Otherwise, the key is "level"
+// and the value of [Level.String] is output.
+//
+// If the AddSource option is set and source information is available,
+// the key is "source"
+// and the value is output as "FILE:LINE".
+//
+// The message's key is "msg".
+//
+// To modify these or other attributes, or remove them from the output, use
+// [HandlerOptions.ReplaceAttr].
+//
+// Values are formatted as with an [encoding/json.Encoder] with SetEscapeHTML(false),
+// with two exceptions.
+//
+// First, an Attr whose Value is of type error is formatted as a string, by
+// calling its Error method. Only errors in Attrs receive this special treatment,
+// not errors embedded in structs, slices, maps or other data structures that
+// are processed by the encoding/json package.
+//
+// Second, an encoding failure does not cause Handle to return an error.
+// Instead, the error message is formatted as a string.
+//
+// Each call to Handle results in a single serialized call to io.Writer.Write.
+func (h *JSONHandler) Handle(_ context.Context, r Record) error {
+ return h.commonHandler.handle(r)
+}
+
+// Adapted from time.Time.MarshalJSON to avoid allocation.
+func appendJSONTime(s *handleState, t time.Time) {
+ if y := t.Year(); y < 0 || y >= 10000 {
+ // RFC 3339 is clear that years are 4 digits exactly.
+ // See golang.org/issue/4556#c15 for more discussion.
+ s.appendError(errors.New("time.Time year outside of range [0,9999]"))
+ }
+ s.buf.WriteByte('"')
+ *s.buf = t.AppendFormat(*s.buf, time.RFC3339Nano)
+ s.buf.WriteByte('"')
+}
+
+func appendJSONValue(s *handleState, v Value) error {
+ switch v.Kind() {
+ case KindString:
+ s.appendString(v.str())
+ case KindInt64:
+ *s.buf = strconv.AppendInt(*s.buf, v.Int64(), 10)
+ case KindUint64:
+ *s.buf = strconv.AppendUint(*s.buf, v.Uint64(), 10)
+ case KindFloat64:
+ // json.Marshal is funny about floats; it doesn't
+ // always match strconv.AppendFloat. So just call it.
+ // That's expensive, but floats are rare.
+ if err := appendJSONMarshal(s.buf, v.Float64()); err != nil {
+ return err
+ }
+ case KindBool:
+ *s.buf = strconv.AppendBool(*s.buf, v.Bool())
+ case KindDuration:
+ // Do what json.Marshal does.
+ *s.buf = strconv.AppendInt(*s.buf, int64(v.Duration()), 10)
+ case KindTime:
+ s.appendTime(v.Time())
+ case KindAny:
+ a := v.Any()
+ _, jm := a.(json.Marshaler)
+ if err, ok := a.(error); ok && !jm {
+ s.appendString(err.Error())
+ } else {
+ return appendJSONMarshal(s.buf, a)
+ }
+ default:
+ panic(fmt.Sprintf("bad kind: %s", v.Kind()))
+ }
+ return nil
+}
+
+func appendJSONMarshal(buf *buffer.Buffer, v any) error {
+ // Use a json.Encoder to avoid escaping HTML.
+ var bb bytes.Buffer
+ enc := json.NewEncoder(&bb)
+ enc.SetEscapeHTML(false)
+ if err := enc.Encode(v); err != nil {
+ return err
+ }
+ bs := bb.Bytes()
+ buf.Write(bs[:len(bs)-1]) // remove final newline
+ return nil
+}
+
+// appendEscapedJSONString escapes s for JSON and appends it to buf.
+// It does not surround the string in quotation marks.
+//
+// Modified from encoding/json/encode.go:encodeState.string,
+// with escapeHTML set to false.
+func appendEscapedJSONString(buf []byte, s string) []byte {
+ char := func(b byte) { buf = append(buf, b) }
+ str := func(s string) { buf = append(buf, s...) }
+
+ start := 0
+ for i := 0; i < len(s); {
+ if b := s[i]; b < utf8.RuneSelf {
+ if safeSet[b] {
+ i++
+ continue
+ }
+ if start < i {
+ str(s[start:i])
+ }
+ char('\\')
+ switch b {
+ case '\\', '"':
+ char(b)
+ case '\n':
+ char('n')
+ case '\r':
+ char('r')
+ case '\t':
+ char('t')
+ default:
+ // This encodes bytes < 0x20 except for \t, \n and \r.
+ str(`u00`)
+ char(hex[b>>4])
+ char(hex[b&0xF])
+ }
+ i++
+ start = i
+ continue
+ }
+ c, size := utf8.DecodeRuneInString(s[i:])
+ if c == utf8.RuneError && size == 1 {
+ if start < i {
+ str(s[start:i])
+ }
+ str(`\ufffd`)
+ i += size
+ start = i
+ continue
+ }
+ // U+2028 is LINE SEPARATOR.
+ // U+2029 is PARAGRAPH SEPARATOR.
+ // They are both technically valid characters in JSON strings,
+ // but don't work in JSONP, which has to be evaluated as JavaScript,
+ // and can lead to security holes there. It is valid JSON to
+ // escape them, so we do so unconditionally.
+ // See http://timelessrepo.com/json-isnt-a-javascript-subset for discussion.
+ if c == '\u2028' || c == '\u2029' {
+ if start < i {
+ str(s[start:i])
+ }
+ str(`\u202`)
+ char(hex[c&0xF])
+ i += size
+ start = i
+ continue
+ }
+ i += size
+ }
+ if start < len(s) {
+ str(s[start:])
+ }
+ return buf
+}
+
+var hex = "0123456789abcdef"
+
+// Copied from encoding/json/tables.go.
+//
+// safeSet holds the value true if the ASCII character with the given array
+// position can be represented inside a JSON string without any further
+// escaping.
+//
+// All values are true except for the ASCII control characters (0-31), the
+// double quote ("), and the backslash character ("\").
+var safeSet = [utf8.RuneSelf]bool{
+ ' ': true,
+ '!': true,
+ '"': false,
+ '#': true,
+ '$': true,
+ '%': true,
+ '&': true,
+ '\'': true,
+ '(': true,
+ ')': true,
+ '*': true,
+ '+': true,
+ ',': true,
+ '-': true,
+ '.': true,
+ '/': true,
+ '0': true,
+ '1': true,
+ '2': true,
+ '3': true,
+ '4': true,
+ '5': true,
+ '6': true,
+ '7': true,
+ '8': true,
+ '9': true,
+ ':': true,
+ ';': true,
+ '<': true,
+ '=': true,
+ '>': true,
+ '?': true,
+ '@': true,
+ 'A': true,
+ 'B': true,
+ 'C': true,
+ 'D': true,
+ 'E': true,
+ 'F': true,
+ 'G': true,
+ 'H': true,
+ 'I': true,
+ 'J': true,
+ 'K': true,
+ 'L': true,
+ 'M': true,
+ 'N': true,
+ 'O': true,
+ 'P': true,
+ 'Q': true,
+ 'R': true,
+ 'S': true,
+ 'T': true,
+ 'U': true,
+ 'V': true,
+ 'W': true,
+ 'X': true,
+ 'Y': true,
+ 'Z': true,
+ '[': true,
+ '\\': false,
+ ']': true,
+ '^': true,
+ '_': true,
+ '`': true,
+ 'a': true,
+ 'b': true,
+ 'c': true,
+ 'd': true,
+ 'e': true,
+ 'f': true,
+ 'g': true,
+ 'h': true,
+ 'i': true,
+ 'j': true,
+ 'k': true,
+ 'l': true,
+ 'm': true,
+ 'n': true,
+ 'o': true,
+ 'p': true,
+ 'q': true,
+ 'r': true,
+ 's': true,
+ 't': true,
+ 'u': true,
+ 'v': true,
+ 'w': true,
+ 'x': true,
+ 'y': true,
+ 'z': true,
+ '{': true,
+ '|': true,
+ '}': true,
+ '~': true,
+ '\u007f': true,
+}
diff --git a/vendor/golang.org/x/exp/slog/level.go b/vendor/golang.org/x/exp/slog/level.go
new file mode 100644
index 00000000..b2365f0a
--- /dev/null
+++ b/vendor/golang.org/x/exp/slog/level.go
@@ -0,0 +1,201 @@
+// Copyright 2022 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 slog
+
+import (
+ "errors"
+ "fmt"
+ "strconv"
+ "strings"
+ "sync/atomic"
+)
+
+// A Level is the importance or severity of a log event.
+// The higher the level, the more important or severe the event.
+type Level int
+
+// Level numbers are inherently arbitrary,
+// but we picked them to satisfy three constraints.
+// Any system can map them to another numbering scheme if it wishes.
+//
+// First, we wanted the default level to be Info, Since Levels are ints, Info is
+// the default value for int, zero.
+//
+
+// Second, we wanted to make it easy to use levels to specify logger verbosity.
+// Since a larger level means a more severe event, a logger that accepts events
+// with smaller (or more negative) level means a more verbose logger. Logger
+// verbosity is thus the negation of event severity, and the default verbosity
+// of 0 accepts all events at least as severe as INFO.
+//
+// Third, we wanted some room between levels to accommodate schemes with named
+// levels between ours. For example, Google Cloud Logging defines a Notice level
+// between Info and Warn. Since there are only a few of these intermediate
+// levels, the gap between the numbers need not be large. Our gap of 4 matches
+// OpenTelemetry's mapping. Subtracting 9 from an OpenTelemetry level in the
+// DEBUG, INFO, WARN and ERROR ranges converts it to the corresponding slog
+// Level range. OpenTelemetry also has the names TRACE and FATAL, which slog
+// does not. But those OpenTelemetry levels can still be represented as slog
+// Levels by using the appropriate integers.
+//
+// Names for common levels.
+const (
+ LevelDebug Level = -4
+ LevelInfo Level = 0
+ LevelWarn Level = 4
+ LevelError Level = 8
+)
+
+// String returns a name for the level.
+// If the level has a name, then that name
+// in uppercase is returned.
+// If the level is between named values, then
+// an integer is appended to the uppercased name.
+// Examples:
+//
+// LevelWarn.String() => "WARN"
+// (LevelInfo+2).String() => "INFO+2"
+func (l Level) String() string {
+ str := func(base string, val Level) string {
+ if val == 0 {
+ return base
+ }
+ return fmt.Sprintf("%s%+d", base, val)
+ }
+
+ switch {
+ case l < LevelInfo:
+ return str("DEBUG", l-LevelDebug)
+ case l < LevelWarn:
+ return str("INFO", l-LevelInfo)
+ case l < LevelError:
+ return str("WARN", l-LevelWarn)
+ default:
+ return str("ERROR", l-LevelError)
+ }
+}
+
+// MarshalJSON implements [encoding/json.Marshaler]
+// by quoting the output of [Level.String].
+func (l Level) MarshalJSON() ([]byte, error) {
+ // AppendQuote is sufficient for JSON-encoding all Level strings.
+ // They don't contain any runes that would produce invalid JSON
+ // when escaped.
+ return strconv.AppendQuote(nil, l.String()), nil
+}
+
+// UnmarshalJSON implements [encoding/json.Unmarshaler]
+// It accepts any string produced by [Level.MarshalJSON],
+// ignoring case.
+// It also accepts numeric offsets that would result in a different string on
+// output. For example, "Error-8" would marshal as "INFO".
+func (l *Level) UnmarshalJSON(data []byte) error {
+ s, err := strconv.Unquote(string(data))
+ if err != nil {
+ return err
+ }
+ return l.parse(s)
+}
+
+// MarshalText implements [encoding.TextMarshaler]
+// by calling [Level.String].
+func (l Level) MarshalText() ([]byte, error) {
+ return []byte(l.String()), nil
+}
+
+// UnmarshalText implements [encoding.TextUnmarshaler].
+// It accepts any string produced by [Level.MarshalText],
+// ignoring case.
+// It also accepts numeric offsets that would result in a different string on
+// output. For example, "Error-8" would marshal as "INFO".
+func (l *Level) UnmarshalText(data []byte) error {
+ return l.parse(string(data))
+}
+
+func (l *Level) parse(s string) (err error) {
+ defer func() {
+ if err != nil {
+ err = fmt.Errorf("slog: level string %q: %w", s, err)
+ }
+ }()
+
+ name := s
+ offset := 0
+ if i := strings.IndexAny(s, "+-"); i >= 0 {
+ name = s[:i]
+ offset, err = strconv.Atoi(s[i:])
+ if err != nil {
+ return err
+ }
+ }
+ switch strings.ToUpper(name) {
+ case "DEBUG":
+ *l = LevelDebug
+ case "INFO":
+ *l = LevelInfo
+ case "WARN":
+ *l = LevelWarn
+ case "ERROR":
+ *l = LevelError
+ default:
+ return errors.New("unknown name")
+ }
+ *l += Level(offset)
+ return nil
+}
+
+// Level returns the receiver.
+// It implements Leveler.
+func (l Level) Level() Level { return l }
+
+// A LevelVar is a Level variable, to allow a Handler level to change
+// dynamically.
+// It implements Leveler as well as a Set method,
+// and it is safe for use by multiple goroutines.
+// The zero LevelVar corresponds to LevelInfo.
+type LevelVar struct {
+ val atomic.Int64
+}
+
+// Level returns v's level.
+func (v *LevelVar) Level() Level {
+ return Level(int(v.val.Load()))
+}
+
+// Set sets v's level to l.
+func (v *LevelVar) Set(l Level) {
+ v.val.Store(int64(l))
+}
+
+func (v *LevelVar) String() string {
+ return fmt.Sprintf("LevelVar(%s)", v.Level())
+}
+
+// MarshalText implements [encoding.TextMarshaler]
+// by calling [Level.MarshalText].
+func (v *LevelVar) MarshalText() ([]byte, error) {
+ return v.Level().MarshalText()
+}
+
+// UnmarshalText implements [encoding.TextUnmarshaler]
+// by calling [Level.UnmarshalText].
+func (v *LevelVar) UnmarshalText(data []byte) error {
+ var l Level
+ if err := l.UnmarshalText(data); err != nil {
+ return err
+ }
+ v.Set(l)
+ return nil
+}
+
+// A Leveler provides a Level value.
+//
+// As Level itself implements Leveler, clients typically supply
+// a Level value wherever a Leveler is needed, such as in HandlerOptions.
+// Clients who need to vary the level dynamically can provide a more complex
+// Leveler implementation such as *LevelVar.
+type Leveler interface {
+ Level() Level
+}
diff --git a/vendor/golang.org/x/exp/slog/logger.go b/vendor/golang.org/x/exp/slog/logger.go
new file mode 100644
index 00000000..e87ec993
--- /dev/null
+++ b/vendor/golang.org/x/exp/slog/logger.go
@@ -0,0 +1,343 @@
+// Copyright 2022 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 slog
+
+import (
+ "context"
+ "log"
+ "runtime"
+ "sync/atomic"
+ "time"
+
+ "golang.org/x/exp/slog/internal"
+)
+
+var defaultLogger atomic.Value
+
+func init() {
+ defaultLogger.Store(New(newDefaultHandler(log.Output)))
+}
+
+// Default returns the default Logger.
+func Default() *Logger { return defaultLogger.Load().(*Logger) }
+
+// SetDefault makes l the default Logger.
+// After this call, output from the log package's default Logger
+// (as with [log.Print], etc.) will be logged at LevelInfo using l's Handler.
+func SetDefault(l *Logger) {
+ defaultLogger.Store(l)
+ // If the default's handler is a defaultHandler, then don't use a handleWriter,
+ // or we'll deadlock as they both try to acquire the log default mutex.
+ // The defaultHandler will use whatever the log default writer is currently
+ // set to, which is correct.
+ // This can occur with SetDefault(Default()).
+ // See TestSetDefault.
+ if _, ok := l.Handler().(*defaultHandler); !ok {
+ capturePC := log.Flags()&(log.Lshortfile|log.Llongfile) != 0
+ log.SetOutput(&handlerWriter{l.Handler(), LevelInfo, capturePC})
+ log.SetFlags(0) // we want just the log message, no time or location
+ }
+}
+
+// handlerWriter is an io.Writer that calls a Handler.
+// It is used to link the default log.Logger to the default slog.Logger.
+type handlerWriter struct {
+ h Handler
+ level Level
+ capturePC bool
+}
+
+func (w *handlerWriter) Write(buf []byte) (int, error) {
+ if !w.h.Enabled(context.Background(), w.level) {
+ return 0, nil
+ }
+ var pc uintptr
+ if !internal.IgnorePC && w.capturePC {
+ // skip [runtime.Callers, w.Write, Logger.Output, log.Print]
+ var pcs [1]uintptr
+ runtime.Callers(4, pcs[:])
+ pc = pcs[0]
+ }
+
+ // Remove final newline.
+ origLen := len(buf) // Report that the entire buf was written.
+ if len(buf) > 0 && buf[len(buf)-1] == '\n' {
+ buf = buf[:len(buf)-1]
+ }
+ r := NewRecord(time.Now(), w.level, string(buf), pc)
+ return origLen, w.h.Handle(context.Background(), r)
+}
+
+// A Logger records structured information about each call to its
+// Log, Debug, Info, Warn, and Error methods.
+// For each call, it creates a Record and passes it to a Handler.
+//
+// To create a new Logger, call [New] or a Logger method
+// that begins "With".
+type Logger struct {
+ handler Handler // for structured logging
+}
+
+func (l *Logger) clone() *Logger {
+ c := *l
+ return &c
+}
+
+// Handler returns l's Handler.
+func (l *Logger) Handler() Handler { return l.handler }
+
+// With returns a new Logger that includes the given arguments, converted to
+// Attrs as in [Logger.Log].
+// The Attrs will be added to each output from the Logger.
+// The new Logger shares the old Logger's context.
+// The new Logger's handler is the result of calling WithAttrs on the receiver's
+// handler.
+func (l *Logger) With(args ...any) *Logger {
+ c := l.clone()
+ c.handler = l.handler.WithAttrs(argsToAttrSlice(args))
+ return c
+}
+
+// WithGroup returns a new Logger that starts a group. The keys of all
+// attributes added to the Logger will be qualified by the given name.
+// (How that qualification happens depends on the [Handler.WithGroup]
+// method of the Logger's Handler.)
+// The new Logger shares the old Logger's context.
+//
+// The new Logger's handler is the result of calling WithGroup on the receiver's
+// handler.
+func (l *Logger) WithGroup(name string) *Logger {
+ c := l.clone()
+ c.handler = l.handler.WithGroup(name)
+ return c
+
+}
+
+// New creates a new Logger with the given non-nil Handler and a nil context.
+func New(h Handler) *Logger {
+ if h == nil {
+ panic("nil Handler")
+ }
+ return &Logger{handler: h}
+}
+
+// With calls Logger.With on the default logger.
+func With(args ...any) *Logger {
+ return Default().With(args...)
+}
+
+// Enabled reports whether l emits log records at the given context and level.
+func (l *Logger) Enabled(ctx context.Context, level Level) bool {
+ if ctx == nil {
+ ctx = context.Background()
+ }
+ return l.Handler().Enabled(ctx, level)
+}
+
+// NewLogLogger returns a new log.Logger such that each call to its Output method
+// dispatches a Record to the specified handler. The logger acts as a bridge from
+// the older log API to newer structured logging handlers.
+func NewLogLogger(h Handler, level Level) *log.Logger {
+ return log.New(&handlerWriter{h, level, true}, "", 0)
+}
+
+// Log emits a log record with the current time and the given level and message.
+// The Record's Attrs consist of the Logger's attributes followed by
+// the Attrs specified by args.
+//
+// The attribute arguments are processed as follows:
+// - If an argument is an Attr, it is used as is.
+// - If an argument is a string and this is not the last argument,
+// the following argument is treated as the value and the two are combined
+// into an Attr.
+// - Otherwise, the argument is treated as a value with key "!BADKEY".
+func (l *Logger) Log(ctx context.Context, level Level, msg string, args ...any) {
+ l.log(ctx, level, msg, args...)
+}
+
+// LogAttrs is a more efficient version of [Logger.Log] that accepts only Attrs.
+func (l *Logger) LogAttrs(ctx context.Context, level Level, msg string, attrs ...Attr) {
+ l.logAttrs(ctx, level, msg, attrs...)
+}
+
+// Debug logs at LevelDebug.
+func (l *Logger) Debug(msg string, args ...any) {
+ l.log(nil, LevelDebug, msg, args...)
+}
+
+// DebugContext logs at LevelDebug with the given context.
+func (l *Logger) DebugContext(ctx context.Context, msg string, args ...any) {
+ l.log(ctx, LevelDebug, msg, args...)
+}
+
+// DebugCtx logs at LevelDebug with the given context.
+// Deprecated: Use Logger.DebugContext.
+func (l *Logger) DebugCtx(ctx context.Context, msg string, args ...any) {
+ l.log(ctx, LevelDebug, msg, args...)
+}
+
+// Info logs at LevelInfo.
+func (l *Logger) Info(msg string, args ...any) {
+ l.log(nil, LevelInfo, msg, args...)
+}
+
+// InfoContext logs at LevelInfo with the given context.
+func (l *Logger) InfoContext(ctx context.Context, msg string, args ...any) {
+ l.log(ctx, LevelInfo, msg, args...)
+}
+
+// InfoCtx logs at LevelInfo with the given context.
+// Deprecated: Use Logger.InfoContext.
+func (l *Logger) InfoCtx(ctx context.Context, msg string, args ...any) {
+ l.log(ctx, LevelInfo, msg, args...)
+}
+
+// Warn logs at LevelWarn.
+func (l *Logger) Warn(msg string, args ...any) {
+ l.log(nil, LevelWarn, msg, args...)
+}
+
+// WarnContext logs at LevelWarn with the given context.
+func (l *Logger) WarnContext(ctx context.Context, msg string, args ...any) {
+ l.log(ctx, LevelWarn, msg, args...)
+}
+
+// WarnCtx logs at LevelWarn with the given context.
+// Deprecated: Use Logger.WarnContext.
+func (l *Logger) WarnCtx(ctx context.Context, msg string, args ...any) {
+ l.log(ctx, LevelWarn, msg, args...)
+}
+
+// Error logs at LevelError.
+func (l *Logger) Error(msg string, args ...any) {
+ l.log(nil, LevelError, msg, args...)
+}
+
+// ErrorContext logs at LevelError with the given context.
+func (l *Logger) ErrorContext(ctx context.Context, msg string, args ...any) {
+ l.log(ctx, LevelError, msg, args...)
+}
+
+// ErrorCtx logs at LevelError with the given context.
+// Deprecated: Use Logger.ErrorContext.
+func (l *Logger) ErrorCtx(ctx context.Context, msg string, args ...any) {
+ l.log(ctx, LevelError, msg, args...)
+}
+
+// log is the low-level logging method for methods that take ...any.
+// It must always be called directly by an exported logging method
+// or function, because it uses a fixed call depth to obtain the pc.
+func (l *Logger) log(ctx context.Context, level Level, msg string, args ...any) {
+ if !l.Enabled(ctx, level) {
+ return
+ }
+ var pc uintptr
+ if !internal.IgnorePC {
+ var pcs [1]uintptr
+ // skip [runtime.Callers, this function, this function's caller]
+ runtime.Callers(3, pcs[:])
+ pc = pcs[0]
+ }
+ r := NewRecord(time.Now(), level, msg, pc)
+ r.Add(args...)
+ if ctx == nil {
+ ctx = context.Background()
+ }
+ _ = l.Handler().Handle(ctx, r)
+}
+
+// logAttrs is like [Logger.log], but for methods that take ...Attr.
+func (l *Logger) logAttrs(ctx context.Context, level Level, msg string, attrs ...Attr) {
+ if !l.Enabled(ctx, level) {
+ return
+ }
+ var pc uintptr
+ if !internal.IgnorePC {
+ var pcs [1]uintptr
+ // skip [runtime.Callers, this function, this function's caller]
+ runtime.Callers(3, pcs[:])
+ pc = pcs[0]
+ }
+ r := NewRecord(time.Now(), level, msg, pc)
+ r.AddAttrs(attrs...)
+ if ctx == nil {
+ ctx = context.Background()
+ }
+ _ = l.Handler().Handle(ctx, r)
+}
+
+// Debug calls Logger.Debug on the default logger.
+func Debug(msg string, args ...any) {
+ Default().log(nil, LevelDebug, msg, args...)
+}
+
+// DebugContext calls Logger.DebugContext on the default logger.
+func DebugContext(ctx context.Context, msg string, args ...any) {
+ Default().log(ctx, LevelDebug, msg, args...)
+}
+
+// Info calls Logger.Info on the default logger.
+func Info(msg string, args ...any) {
+ Default().log(nil, LevelInfo, msg, args...)
+}
+
+// InfoContext calls Logger.InfoContext on the default logger.
+func InfoContext(ctx context.Context, msg string, args ...any) {
+ Default().log(ctx, LevelInfo, msg, args...)
+}
+
+// Warn calls Logger.Warn on the default logger.
+func Warn(msg string, args ...any) {
+ Default().log(nil, LevelWarn, msg, args...)
+}
+
+// WarnContext calls Logger.WarnContext on the default logger.
+func WarnContext(ctx context.Context, msg string, args ...any) {
+ Default().log(ctx, LevelWarn, msg, args...)
+}
+
+// Error calls Logger.Error on the default logger.
+func Error(msg string, args ...any) {
+ Default().log(nil, LevelError, msg, args...)
+}
+
+// ErrorContext calls Logger.ErrorContext on the default logger.
+func ErrorContext(ctx context.Context, msg string, args ...any) {
+ Default().log(ctx, LevelError, msg, args...)
+}
+
+// DebugCtx calls Logger.DebugContext on the default logger.
+// Deprecated: call DebugContext.
+func DebugCtx(ctx context.Context, msg string, args ...any) {
+ Default().log(ctx, LevelDebug, msg, args...)
+}
+
+// InfoCtx calls Logger.InfoContext on the default logger.
+// Deprecated: call InfoContext.
+func InfoCtx(ctx context.Context, msg string, args ...any) {
+ Default().log(ctx, LevelInfo, msg, args...)
+}
+
+// WarnCtx calls Logger.WarnContext on the default logger.
+// Deprecated: call WarnContext.
+func WarnCtx(ctx context.Context, msg string, args ...any) {
+ Default().log(ctx, LevelWarn, msg, args...)
+}
+
+// ErrorCtx calls Logger.ErrorContext on the default logger.
+// Deprecated: call ErrorContext.
+func ErrorCtx(ctx context.Context, msg string, args ...any) {
+ Default().log(ctx, LevelError, msg, args...)
+}
+
+// Log calls Logger.Log on the default logger.
+func Log(ctx context.Context, level Level, msg string, args ...any) {
+ Default().log(ctx, level, msg, args...)
+}
+
+// LogAttrs calls Logger.LogAttrs on the default logger.
+func LogAttrs(ctx context.Context, level Level, msg string, attrs ...Attr) {
+ Default().logAttrs(ctx, level, msg, attrs...)
+}
diff --git a/vendor/golang.org/x/exp/slog/noplog.bench b/vendor/golang.org/x/exp/slog/noplog.bench
new file mode 100644
index 00000000..ed9296ff
--- /dev/null
+++ b/vendor/golang.org/x/exp/slog/noplog.bench
@@ -0,0 +1,36 @@
+goos: linux
+goarch: amd64
+pkg: golang.org/x/exp/slog
+cpu: Intel(R) Xeon(R) CPU @ 2.20GHz
+BenchmarkNopLog/attrs-8 1000000 1090 ns/op 0 B/op 0 allocs/op
+BenchmarkNopLog/attrs-8 1000000 1097 ns/op 0 B/op 0 allocs/op
+BenchmarkNopLog/attrs-8 1000000 1078 ns/op 0 B/op 0 allocs/op
+BenchmarkNopLog/attrs-8 1000000 1095 ns/op 0 B/op 0 allocs/op
+BenchmarkNopLog/attrs-8 1000000 1096 ns/op 0 B/op 0 allocs/op
+BenchmarkNopLog/attrs-parallel-8 4007268 308.2 ns/op 0 B/op 0 allocs/op
+BenchmarkNopLog/attrs-parallel-8 4016138 299.7 ns/op 0 B/op 0 allocs/op
+BenchmarkNopLog/attrs-parallel-8 4020529 305.9 ns/op 0 B/op 0 allocs/op
+BenchmarkNopLog/attrs-parallel-8 3977829 303.4 ns/op 0 B/op 0 allocs/op
+BenchmarkNopLog/attrs-parallel-8 3225438 318.5 ns/op 0 B/op 0 allocs/op
+BenchmarkNopLog/keys-values-8 1179256 994.2 ns/op 0 B/op 0 allocs/op
+BenchmarkNopLog/keys-values-8 1000000 1002 ns/op 0 B/op 0 allocs/op
+BenchmarkNopLog/keys-values-8 1216710 993.2 ns/op 0 B/op 0 allocs/op
+BenchmarkNopLog/keys-values-8 1000000 1013 ns/op 0 B/op 0 allocs/op
+BenchmarkNopLog/keys-values-8 1000000 1016 ns/op 0 B/op 0 allocs/op
+BenchmarkNopLog/WithContext-8 989066 1163 ns/op 0 B/op 0 allocs/op
+BenchmarkNopLog/WithContext-8 994116 1163 ns/op 0 B/op 0 allocs/op
+BenchmarkNopLog/WithContext-8 1000000 1152 ns/op 0 B/op 0 allocs/op
+BenchmarkNopLog/WithContext-8 991675 1165 ns/op 0 B/op 0 allocs/op
+BenchmarkNopLog/WithContext-8 965268 1166 ns/op 0 B/op 0 allocs/op
+BenchmarkNopLog/WithContext-parallel-8 3955503 303.3 ns/op 0 B/op 0 allocs/op
+BenchmarkNopLog/WithContext-parallel-8 3861188 307.8 ns/op 0 B/op 0 allocs/op
+BenchmarkNopLog/WithContext-parallel-8 3967752 303.9 ns/op 0 B/op 0 allocs/op
+BenchmarkNopLog/WithContext-parallel-8 3955203 302.7 ns/op 0 B/op 0 allocs/op
+BenchmarkNopLog/WithContext-parallel-8 3948278 301.1 ns/op 0 B/op 0 allocs/op
+BenchmarkNopLog/Ctx-8 940622 1247 ns/op 0 B/op 0 allocs/op
+BenchmarkNopLog/Ctx-8 936381 1257 ns/op 0 B/op 0 allocs/op
+BenchmarkNopLog/Ctx-8 959730 1266 ns/op 0 B/op 0 allocs/op
+BenchmarkNopLog/Ctx-8 943473 1290 ns/op 0 B/op 0 allocs/op
+BenchmarkNopLog/Ctx-8 919414 1259 ns/op 0 B/op 0 allocs/op
+PASS
+ok golang.org/x/exp/slog 40.566s
diff --git a/vendor/golang.org/x/exp/slog/record.go b/vendor/golang.org/x/exp/slog/record.go
new file mode 100644
index 00000000..38b3440f
--- /dev/null
+++ b/vendor/golang.org/x/exp/slog/record.go
@@ -0,0 +1,207 @@
+// Copyright 2022 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 slog
+
+import (
+ "runtime"
+ "time"
+
+ "golang.org/x/exp/slices"
+)
+
+const nAttrsInline = 5
+
+// A Record holds information about a log event.
+// Copies of a Record share state.
+// Do not modify a Record after handing out a copy to it.
+// Use [Record.Clone] to create a copy with no shared state.
+type Record struct {
+ // The time at which the output method (Log, Info, etc.) was called.
+ Time time.Time
+
+ // The log message.
+ Message string
+
+ // The level of the event.
+ Level Level
+
+ // The program counter at the time the record was constructed, as determined
+ // by runtime.Callers. If zero, no program counter is available.
+ //
+ // The only valid use for this value is as an argument to
+ // [runtime.CallersFrames]. In particular, it must not be passed to
+ // [runtime.FuncForPC].
+ PC uintptr
+
+ // Allocation optimization: an inline array sized to hold
+ // the majority of log calls (based on examination of open-source
+ // code). It holds the start of the list of Attrs.
+ front [nAttrsInline]Attr
+
+ // The number of Attrs in front.
+ nFront int
+
+ // The list of Attrs except for those in front.
+ // Invariants:
+ // - len(back) > 0 iff nFront == len(front)
+ // - Unused array elements are zero. Used to detect mistakes.
+ back []Attr
+}
+
+// NewRecord creates a Record from the given arguments.
+// Use [Record.AddAttrs] to add attributes to the Record.
+//
+// NewRecord is intended for logging APIs that want to support a [Handler] as
+// a backend.
+func NewRecord(t time.Time, level Level, msg string, pc uintptr) Record {
+ return Record{
+ Time: t,
+ Message: msg,
+ Level: level,
+ PC: pc,
+ }
+}
+
+// Clone returns a copy of the record with no shared state.
+// The original record and the clone can both be modified
+// without interfering with each other.
+func (r Record) Clone() Record {
+ r.back = slices.Clip(r.back) // prevent append from mutating shared array
+ return r
+}
+
+// NumAttrs returns the number of attributes in the Record.
+func (r Record) NumAttrs() int {
+ return r.nFront + len(r.back)
+}
+
+// Attrs calls f on each Attr in the Record.
+// Iteration stops if f returns false.
+func (r Record) Attrs(f func(Attr) bool) {
+ for i := 0; i < r.nFront; i++ {
+ if !f(r.front[i]) {
+ return
+ }
+ }
+ for _, a := range r.back {
+ if !f(a) {
+ return
+ }
+ }
+}
+
+// AddAttrs appends the given Attrs to the Record's list of Attrs.
+func (r *Record) AddAttrs(attrs ...Attr) {
+ n := copy(r.front[r.nFront:], attrs)
+ r.nFront += n
+ // Check if a copy was modified by slicing past the end
+ // and seeing if the Attr there is non-zero.
+ if cap(r.back) > len(r.back) {
+ end := r.back[:len(r.back)+1][len(r.back)]
+ if !end.isEmpty() {
+ panic("copies of a slog.Record were both modified")
+ }
+ }
+ r.back = append(r.back, attrs[n:]...)
+}
+
+// Add converts the args to Attrs as described in [Logger.Log],
+// then appends the Attrs to the Record's list of Attrs.
+func (r *Record) Add(args ...any) {
+ var a Attr
+ for len(args) > 0 {
+ a, args = argsToAttr(args)
+ if r.nFront < len(r.front) {
+ r.front[r.nFront] = a
+ r.nFront++
+ } else {
+ if r.back == nil {
+ r.back = make([]Attr, 0, countAttrs(args))
+ }
+ r.back = append(r.back, a)
+ }
+ }
+
+}
+
+// countAttrs returns the number of Attrs that would be created from args.
+func countAttrs(args []any) int {
+ n := 0
+ for i := 0; i < len(args); i++ {
+ n++
+ if _, ok := args[i].(string); ok {
+ i++
+ }
+ }
+ return n
+}
+
+const badKey = "!BADKEY"
+
+// argsToAttr turns a prefix of the nonempty args slice into an Attr
+// and returns the unconsumed portion of the slice.
+// If args[0] is an Attr, it returns it.
+// If args[0] is a string, it treats the first two elements as
+// a key-value pair.
+// Otherwise, it treats args[0] as a value with a missing key.
+func argsToAttr(args []any) (Attr, []any) {
+ switch x := args[0].(type) {
+ case string:
+ if len(args) == 1 {
+ return String(badKey, x), nil
+ }
+ return Any(x, args[1]), args[2:]
+
+ case Attr:
+ return x, args[1:]
+
+ default:
+ return Any(badKey, x), args[1:]
+ }
+}
+
+// Source describes the location of a line of source code.
+type Source struct {
+ // Function is the package path-qualified function name containing the
+ // source line. If non-empty, this string uniquely identifies a single
+ // function in the program. This may be the empty string if not known.
+ Function string `json:"function"`
+ // File and Line are the file name and line number (1-based) of the source
+ // line. These may be the empty string and zero, respectively, if not known.
+ File string `json:"file"`
+ Line int `json:"line"`
+}
+
+// attrs returns the non-zero fields of s as a slice of attrs.
+// It is similar to a LogValue method, but we don't want Source
+// to implement LogValuer because it would be resolved before
+// the ReplaceAttr function was called.
+func (s *Source) group() Value {
+ var as []Attr
+ if s.Function != "" {
+ as = append(as, String("function", s.Function))
+ }
+ if s.File != "" {
+ as = append(as, String("file", s.File))
+ }
+ if s.Line != 0 {
+ as = append(as, Int("line", s.Line))
+ }
+ return GroupValue(as...)
+}
+
+// source returns a Source for the log event.
+// If the Record was created without the necessary information,
+// or if the location is unavailable, it returns a non-nil *Source
+// with zero fields.
+func (r Record) source() *Source {
+ fs := runtime.CallersFrames([]uintptr{r.PC})
+ f, _ := fs.Next()
+ return &Source{
+ Function: f.Function,
+ File: f.File,
+ Line: f.Line,
+ }
+}
diff --git a/vendor/golang.org/x/exp/slog/text_handler.go b/vendor/golang.org/x/exp/slog/text_handler.go
new file mode 100644
index 00000000..75b66b71
--- /dev/null
+++ b/vendor/golang.org/x/exp/slog/text_handler.go
@@ -0,0 +1,161 @@
+// Copyright 2022 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 slog
+
+import (
+ "context"
+ "encoding"
+ "fmt"
+ "io"
+ "reflect"
+ "strconv"
+ "unicode"
+ "unicode/utf8"
+)
+
+// TextHandler is a Handler that writes Records to an io.Writer as a
+// sequence of key=value pairs separated by spaces and followed by a newline.
+type TextHandler struct {
+ *commonHandler
+}
+
+// NewTextHandler creates a TextHandler that writes to w,
+// using the given options.
+// If opts is nil, the default options are used.
+func NewTextHandler(w io.Writer, opts *HandlerOptions) *TextHandler {
+ if opts == nil {
+ opts = &HandlerOptions{}
+ }
+ return &TextHandler{
+ &commonHandler{
+ json: false,
+ w: w,
+ opts: *opts,
+ },
+ }
+}
+
+// Enabled reports whether the handler handles records at the given level.
+// The handler ignores records whose level is lower.
+func (h *TextHandler) Enabled(_ context.Context, level Level) bool {
+ return h.commonHandler.enabled(level)
+}
+
+// WithAttrs returns a new TextHandler whose attributes consists
+// of h's attributes followed by attrs.
+func (h *TextHandler) WithAttrs(attrs []Attr) Handler {
+ return &TextHandler{commonHandler: h.commonHandler.withAttrs(attrs)}
+}
+
+func (h *TextHandler) WithGroup(name string) Handler {
+ return &TextHandler{commonHandler: h.commonHandler.withGroup(name)}
+}
+
+// Handle formats its argument Record as a single line of space-separated
+// key=value items.
+//
+// If the Record's time is zero, the time is omitted.
+// Otherwise, the key is "time"
+// and the value is output in RFC3339 format with millisecond precision.
+//
+// If the Record's level is zero, the level is omitted.
+// Otherwise, the key is "level"
+// and the value of [Level.String] is output.
+//
+// If the AddSource option is set and source information is available,
+// the key is "source" and the value is output as FILE:LINE.
+//
+// The message's key is "msg".
+//
+// To modify these or other attributes, or remove them from the output, use
+// [HandlerOptions.ReplaceAttr].
+//
+// If a value implements [encoding.TextMarshaler], the result of MarshalText is
+// written. Otherwise, the result of fmt.Sprint is written.
+//
+// Keys and values are quoted with [strconv.Quote] if they contain Unicode space
+// characters, non-printing characters, '"' or '='.
+//
+// Keys inside groups consist of components (keys or group names) separated by
+// dots. No further escaping is performed.
+// Thus there is no way to determine from the key "a.b.c" whether there
+// are two groups "a" and "b" and a key "c", or a single group "a.b" and a key "c",
+// or single group "a" and a key "b.c".
+// If it is necessary to reconstruct the group structure of a key
+// even in the presence of dots inside components, use
+// [HandlerOptions.ReplaceAttr] to encode that information in the key.
+//
+// Each call to Handle results in a single serialized call to
+// io.Writer.Write.
+func (h *TextHandler) Handle(_ context.Context, r Record) error {
+ return h.commonHandler.handle(r)
+}
+
+func appendTextValue(s *handleState, v Value) error {
+ switch v.Kind() {
+ case KindString:
+ s.appendString(v.str())
+ case KindTime:
+ s.appendTime(v.time())
+ case KindAny:
+ if tm, ok := v.any.(encoding.TextMarshaler); ok {
+ data, err := tm.MarshalText()
+ if err != nil {
+ return err
+ }
+ // TODO: avoid the conversion to string.
+ s.appendString(string(data))
+ return nil
+ }
+ if bs, ok := byteSlice(v.any); ok {
+ // As of Go 1.19, this only allocates for strings longer than 32 bytes.
+ s.buf.WriteString(strconv.Quote(string(bs)))
+ return nil
+ }
+ s.appendString(fmt.Sprintf("%+v", v.Any()))
+ default:
+ *s.buf = v.append(*s.buf)
+ }
+ return nil
+}
+
+// byteSlice returns its argument as a []byte if the argument's
+// underlying type is []byte, along with a second return value of true.
+// Otherwise it returns nil, false.
+func byteSlice(a any) ([]byte, bool) {
+ if bs, ok := a.([]byte); ok {
+ return bs, true
+ }
+ // Like Printf's %s, we allow both the slice type and the byte element type to be named.
+ t := reflect.TypeOf(a)
+ if t != nil && t.Kind() == reflect.Slice && t.Elem().Kind() == reflect.Uint8 {
+ return reflect.ValueOf(a).Bytes(), true
+ }
+ return nil, false
+}
+
+func needsQuoting(s string) bool {
+ if len(s) == 0 {
+ return true
+ }
+ for i := 0; i < len(s); {
+ b := s[i]
+ if b < utf8.RuneSelf {
+ // Quote anything except a backslash that would need quoting in a
+ // JSON string, as well as space and '='
+ if b != '\\' && (b == ' ' || b == '=' || !safeSet[b]) {
+ return true
+ }
+ i++
+ continue
+ }
+ r, size := utf8.DecodeRuneInString(s[i:])
+ if r == utf8.RuneError || unicode.IsSpace(r) || !unicode.IsPrint(r) {
+ return true
+ }
+ i += size
+ }
+ return false
+}
diff --git a/vendor/golang.org/x/exp/slog/value.go b/vendor/golang.org/x/exp/slog/value.go
new file mode 100644
index 00000000..3550c46f
--- /dev/null
+++ b/vendor/golang.org/x/exp/slog/value.go
@@ -0,0 +1,456 @@
+// Copyright 2022 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 slog
+
+import (
+ "fmt"
+ "math"
+ "runtime"
+ "strconv"
+ "strings"
+ "time"
+ "unsafe"
+
+ "golang.org/x/exp/slices"
+)
+
+// A Value can represent any Go value, but unlike type any,
+// it can represent most small values without an allocation.
+// The zero Value corresponds to nil.
+type Value struct {
+ _ [0]func() // disallow ==
+ // num holds the value for Kinds Int64, Uint64, Float64, Bool and Duration,
+ // the string length for KindString, and nanoseconds since the epoch for KindTime.
+ num uint64
+ // If any is of type Kind, then the value is in num as described above.
+ // If any is of type *time.Location, then the Kind is Time and time.Time value
+ // can be constructed from the Unix nanos in num and the location (monotonic time
+ // is not preserved).
+ // If any is of type stringptr, then the Kind is String and the string value
+ // consists of the length in num and the pointer in any.
+ // Otherwise, the Kind is Any and any is the value.
+ // (This implies that Attrs cannot store values of type Kind, *time.Location
+ // or stringptr.)
+ any any
+}
+
+// Kind is the kind of a Value.
+type Kind int
+
+// The following list is sorted alphabetically, but it's also important that
+// KindAny is 0 so that a zero Value represents nil.
+
+const (
+ KindAny Kind = iota
+ KindBool
+ KindDuration
+ KindFloat64
+ KindInt64
+ KindString
+ KindTime
+ KindUint64
+ KindGroup
+ KindLogValuer
+)
+
+var kindStrings = []string{
+ "Any",
+ "Bool",
+ "Duration",
+ "Float64",
+ "Int64",
+ "String",
+ "Time",
+ "Uint64",
+ "Group",
+ "LogValuer",
+}
+
+func (k Kind) String() string {
+ if k >= 0 && int(k) < len(kindStrings) {
+ return kindStrings[k]
+ }
+ return ""
+}
+
+// Unexported version of Kind, just so we can store Kinds in Values.
+// (No user-provided value has this type.)
+type kind Kind
+
+// Kind returns v's Kind.
+func (v Value) Kind() Kind {
+ switch x := v.any.(type) {
+ case Kind:
+ return x
+ case stringptr:
+ return KindString
+ case timeLocation:
+ return KindTime
+ case groupptr:
+ return KindGroup
+ case LogValuer:
+ return KindLogValuer
+ case kind: // a kind is just a wrapper for a Kind
+ return KindAny
+ default:
+ return KindAny
+ }
+}
+
+//////////////// Constructors
+
+// IntValue returns a Value for an int.
+func IntValue(v int) Value {
+ return Int64Value(int64(v))
+}
+
+// Int64Value returns a Value for an int64.
+func Int64Value(v int64) Value {
+ return Value{num: uint64(v), any: KindInt64}
+}
+
+// Uint64Value returns a Value for a uint64.
+func Uint64Value(v uint64) Value {
+ return Value{num: v, any: KindUint64}
+}
+
+// Float64Value returns a Value for a floating-point number.
+func Float64Value(v float64) Value {
+ return Value{num: math.Float64bits(v), any: KindFloat64}
+}
+
+// BoolValue returns a Value for a bool.
+func BoolValue(v bool) Value {
+ u := uint64(0)
+ if v {
+ u = 1
+ }
+ return Value{num: u, any: KindBool}
+}
+
+// Unexported version of *time.Location, just so we can store *time.Locations in
+// Values. (No user-provided value has this type.)
+type timeLocation *time.Location
+
+// TimeValue returns a Value for a time.Time.
+// It discards the monotonic portion.
+func TimeValue(v time.Time) Value {
+ if v.IsZero() {
+ // UnixNano on the zero time is undefined, so represent the zero time
+ // with a nil *time.Location instead. time.Time.Location method never
+ // returns nil, so a Value with any == timeLocation(nil) cannot be
+ // mistaken for any other Value, time.Time or otherwise.
+ return Value{any: timeLocation(nil)}
+ }
+ return Value{num: uint64(v.UnixNano()), any: timeLocation(v.Location())}
+}
+
+// DurationValue returns a Value for a time.Duration.
+func DurationValue(v time.Duration) Value {
+ return Value{num: uint64(v.Nanoseconds()), any: KindDuration}
+}
+
+// AnyValue returns a Value for the supplied value.
+//
+// If the supplied value is of type Value, it is returned
+// unmodified.
+//
+// Given a value of one of Go's predeclared string, bool, or
+// (non-complex) numeric types, AnyValue returns a Value of kind
+// String, Bool, Uint64, Int64, or Float64. The width of the
+// original numeric type is not preserved.
+//
+// Given a time.Time or time.Duration value, AnyValue returns a Value of kind
+// KindTime or KindDuration. The monotonic time is not preserved.
+//
+// For nil, or values of all other types, including named types whose
+// underlying type is numeric, AnyValue returns a value of kind KindAny.
+func AnyValue(v any) Value {
+ switch v := v.(type) {
+ case string:
+ return StringValue(v)
+ case int:
+ return Int64Value(int64(v))
+ case uint:
+ return Uint64Value(uint64(v))
+ case int64:
+ return Int64Value(v)
+ case uint64:
+ return Uint64Value(v)
+ case bool:
+ return BoolValue(v)
+ case time.Duration:
+ return DurationValue(v)
+ case time.Time:
+ return TimeValue(v)
+ case uint8:
+ return Uint64Value(uint64(v))
+ case uint16:
+ return Uint64Value(uint64(v))
+ case uint32:
+ return Uint64Value(uint64(v))
+ case uintptr:
+ return Uint64Value(uint64(v))
+ case int8:
+ return Int64Value(int64(v))
+ case int16:
+ return Int64Value(int64(v))
+ case int32:
+ return Int64Value(int64(v))
+ case float64:
+ return Float64Value(v)
+ case float32:
+ return Float64Value(float64(v))
+ case []Attr:
+ return GroupValue(v...)
+ case Kind:
+ return Value{any: kind(v)}
+ case Value:
+ return v
+ default:
+ return Value{any: v}
+ }
+}
+
+//////////////// Accessors
+
+// Any returns v's value as an any.
+func (v Value) Any() any {
+ switch v.Kind() {
+ case KindAny:
+ if k, ok := v.any.(kind); ok {
+ return Kind(k)
+ }
+ return v.any
+ case KindLogValuer:
+ return v.any
+ case KindGroup:
+ return v.group()
+ case KindInt64:
+ return int64(v.num)
+ case KindUint64:
+ return v.num
+ case KindFloat64:
+ return v.float()
+ case KindString:
+ return v.str()
+ case KindBool:
+ return v.bool()
+ case KindDuration:
+ return v.duration()
+ case KindTime:
+ return v.time()
+ default:
+ panic(fmt.Sprintf("bad kind: %s", v.Kind()))
+ }
+}
+
+// Int64 returns v's value as an int64. It panics
+// if v is not a signed integer.
+func (v Value) Int64() int64 {
+ if g, w := v.Kind(), KindInt64; g != w {
+ panic(fmt.Sprintf("Value kind is %s, not %s", g, w))
+ }
+ return int64(v.num)
+}
+
+// Uint64 returns v's value as a uint64. It panics
+// if v is not an unsigned integer.
+func (v Value) Uint64() uint64 {
+ if g, w := v.Kind(), KindUint64; g != w {
+ panic(fmt.Sprintf("Value kind is %s, not %s", g, w))
+ }
+ return v.num
+}
+
+// Bool returns v's value as a bool. It panics
+// if v is not a bool.
+func (v Value) Bool() bool {
+ if g, w := v.Kind(), KindBool; g != w {
+ panic(fmt.Sprintf("Value kind is %s, not %s", g, w))
+ }
+ return v.bool()
+}
+
+func (v Value) bool() bool {
+ return v.num == 1
+}
+
+// Duration returns v's value as a time.Duration. It panics
+// if v is not a time.Duration.
+func (v Value) Duration() time.Duration {
+ if g, w := v.Kind(), KindDuration; g != w {
+ panic(fmt.Sprintf("Value kind is %s, not %s", g, w))
+ }
+
+ return v.duration()
+}
+
+func (v Value) duration() time.Duration {
+ return time.Duration(int64(v.num))
+}
+
+// Float64 returns v's value as a float64. It panics
+// if v is not a float64.
+func (v Value) Float64() float64 {
+ if g, w := v.Kind(), KindFloat64; g != w {
+ panic(fmt.Sprintf("Value kind is %s, not %s", g, w))
+ }
+
+ return v.float()
+}
+
+func (v Value) float() float64 {
+ return math.Float64frombits(v.num)
+}
+
+// Time returns v's value as a time.Time. It panics
+// if v is not a time.Time.
+func (v Value) Time() time.Time {
+ if g, w := v.Kind(), KindTime; g != w {
+ panic(fmt.Sprintf("Value kind is %s, not %s", g, w))
+ }
+ return v.time()
+}
+
+func (v Value) time() time.Time {
+ loc := v.any.(timeLocation)
+ if loc == nil {
+ return time.Time{}
+ }
+ return time.Unix(0, int64(v.num)).In(loc)
+}
+
+// LogValuer returns v's value as a LogValuer. It panics
+// if v is not a LogValuer.
+func (v Value) LogValuer() LogValuer {
+ return v.any.(LogValuer)
+}
+
+// Group returns v's value as a []Attr.
+// It panics if v's Kind is not KindGroup.
+func (v Value) Group() []Attr {
+ if sp, ok := v.any.(groupptr); ok {
+ return unsafe.Slice((*Attr)(sp), v.num)
+ }
+ panic("Group: bad kind")
+}
+
+func (v Value) group() []Attr {
+ return unsafe.Slice((*Attr)(v.any.(groupptr)), v.num)
+}
+
+//////////////// Other
+
+// Equal reports whether v and w represent the same Go value.
+func (v Value) Equal(w Value) bool {
+ k1 := v.Kind()
+ k2 := w.Kind()
+ if k1 != k2 {
+ return false
+ }
+ switch k1 {
+ case KindInt64, KindUint64, KindBool, KindDuration:
+ return v.num == w.num
+ case KindString:
+ return v.str() == w.str()
+ case KindFloat64:
+ return v.float() == w.float()
+ case KindTime:
+ return v.time().Equal(w.time())
+ case KindAny, KindLogValuer:
+ return v.any == w.any // may panic if non-comparable
+ case KindGroup:
+ return slices.EqualFunc(v.group(), w.group(), Attr.Equal)
+ default:
+ panic(fmt.Sprintf("bad kind: %s", k1))
+ }
+}
+
+// append appends a text representation of v to dst.
+// v is formatted as with fmt.Sprint.
+func (v Value) append(dst []byte) []byte {
+ switch v.Kind() {
+ case KindString:
+ return append(dst, v.str()...)
+ case KindInt64:
+ return strconv.AppendInt(dst, int64(v.num), 10)
+ case KindUint64:
+ return strconv.AppendUint(dst, v.num, 10)
+ case KindFloat64:
+ return strconv.AppendFloat(dst, v.float(), 'g', -1, 64)
+ case KindBool:
+ return strconv.AppendBool(dst, v.bool())
+ case KindDuration:
+ return append(dst, v.duration().String()...)
+ case KindTime:
+ return append(dst, v.time().String()...)
+ case KindGroup:
+ return fmt.Append(dst, v.group())
+ case KindAny, KindLogValuer:
+ return fmt.Append(dst, v.any)
+ default:
+ panic(fmt.Sprintf("bad kind: %s", v.Kind()))
+ }
+}
+
+// A LogValuer is any Go value that can convert itself into a Value for logging.
+//
+// This mechanism may be used to defer expensive operations until they are
+// needed, or to expand a single value into a sequence of components.
+type LogValuer interface {
+ LogValue() Value
+}
+
+const maxLogValues = 100
+
+// Resolve repeatedly calls LogValue on v while it implements LogValuer,
+// and returns the result.
+// If v resolves to a group, the group's attributes' values are not recursively
+// resolved.
+// If the number of LogValue calls exceeds a threshold, a Value containing an
+// error is returned.
+// Resolve's return value is guaranteed not to be of Kind KindLogValuer.
+func (v Value) Resolve() (rv Value) {
+ orig := v
+ defer func() {
+ if r := recover(); r != nil {
+ rv = AnyValue(fmt.Errorf("LogValue panicked\n%s", stack(3, 5)))
+ }
+ }()
+
+ for i := 0; i < maxLogValues; i++ {
+ if v.Kind() != KindLogValuer {
+ return v
+ }
+ v = v.LogValuer().LogValue()
+ }
+ err := fmt.Errorf("LogValue called too many times on Value of type %T", orig.Any())
+ return AnyValue(err)
+}
+
+func stack(skip, nFrames int) string {
+ pcs := make([]uintptr, nFrames+1)
+ n := runtime.Callers(skip+1, pcs)
+ if n == 0 {
+ return "(no stack)"
+ }
+ frames := runtime.CallersFrames(pcs[:n])
+ var b strings.Builder
+ i := 0
+ for {
+ frame, more := frames.Next()
+ fmt.Fprintf(&b, "called from %s (%s:%d)\n", frame.Function, frame.File, frame.Line)
+ if !more {
+ break
+ }
+ i++
+ if i >= nFrames {
+ fmt.Fprintf(&b, "(rest of stack elided)\n")
+ break
+ }
+ }
+ return b.String()
+}
diff --git a/vendor/golang.org/x/exp/slog/value_119.go b/vendor/golang.org/x/exp/slog/value_119.go
new file mode 100644
index 00000000..29b0d732
--- /dev/null
+++ b/vendor/golang.org/x/exp/slog/value_119.go
@@ -0,0 +1,53 @@
+// Copyright 2022 The Go Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style
+// license that can be found in the LICENSE file.
+
+//go:build go1.19 && !go1.20
+
+package slog
+
+import (
+ "reflect"
+ "unsafe"
+)
+
+type (
+ stringptr unsafe.Pointer // used in Value.any when the Value is a string
+ groupptr unsafe.Pointer // used in Value.any when the Value is a []Attr
+)
+
+// StringValue returns a new Value for a string.
+func StringValue(value string) Value {
+ hdr := (*reflect.StringHeader)(unsafe.Pointer(&value))
+ return Value{num: uint64(hdr.Len), any: stringptr(hdr.Data)}
+}
+
+func (v Value) str() string {
+ var s string
+ hdr := (*reflect.StringHeader)(unsafe.Pointer(&s))
+ hdr.Data = uintptr(v.any.(stringptr))
+ hdr.Len = int(v.num)
+ return s
+}
+
+// String returns Value's value as a string, formatted like fmt.Sprint. Unlike
+// the methods Int64, Float64, and so on, which panic if v is of the
+// wrong kind, String never panics.
+func (v Value) String() string {
+ if sp, ok := v.any.(stringptr); ok {
+ // Inlining this code makes a huge difference.
+ var s string
+ hdr := (*reflect.StringHeader)(unsafe.Pointer(&s))
+ hdr.Data = uintptr(sp)
+ hdr.Len = int(v.num)
+ return s
+ }
+ return string(v.append(nil))
+}
+
+// GroupValue returns a new Value for a list of Attrs.
+// The caller must not subsequently mutate the argument slice.
+func GroupValue(as ...Attr) Value {
+ hdr := (*reflect.SliceHeader)(unsafe.Pointer(&as))
+ return Value{num: uint64(hdr.Len), any: groupptr(hdr.Data)}
+}
diff --git a/vendor/golang.org/x/exp/slog/value_120.go b/vendor/golang.org/x/exp/slog/value_120.go
new file mode 100644
index 00000000..f7d4c093
--- /dev/null
+++ b/vendor/golang.org/x/exp/slog/value_120.go
@@ -0,0 +1,39 @@
+// Copyright 2022 The Go Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style
+// license that can be found in the LICENSE file.
+
+//go:build go1.20
+
+package slog
+
+import "unsafe"
+
+type (
+ stringptr *byte // used in Value.any when the Value is a string
+ groupptr *Attr // used in Value.any when the Value is a []Attr
+)
+
+// StringValue returns a new Value for a string.
+func StringValue(value string) Value {
+ return Value{num: uint64(len(value)), any: stringptr(unsafe.StringData(value))}
+}
+
+// GroupValue returns a new Value for a list of Attrs.
+// The caller must not subsequently mutate the argument slice.
+func GroupValue(as ...Attr) Value {
+ return Value{num: uint64(len(as)), any: groupptr(unsafe.SliceData(as))}
+}
+
+// String returns Value's value as a string, formatted like fmt.Sprint. Unlike
+// the methods Int64, Float64, and so on, which panic if v is of the
+// wrong kind, String never panics.
+func (v Value) String() string {
+ if sp, ok := v.any.(stringptr); ok {
+ return unsafe.String(sp, v.num)
+ }
+ return string(v.append(nil))
+}
+
+func (v Value) str() string {
+ return unsafe.String(v.any.(stringptr), v.num)
+}
diff --git a/vendor/golang.org/x/net/http2/databuffer.go b/vendor/golang.org/x/net/http2/databuffer.go
index a3067f8d..e6f55cbd 100644
--- a/vendor/golang.org/x/net/http2/databuffer.go
+++ b/vendor/golang.org/x/net/http2/databuffer.go
@@ -20,41 +20,44 @@ import (
// TODO: Benchmark to determine if the pools are necessary. The GC may have
// improved enough that we can instead allocate chunks like this:
// make([]byte, max(16<<10, expectedBytesRemaining))
-var (
- dataChunkSizeClasses = []int{
- 1 << 10,
- 2 << 10,
- 4 << 10,
- 8 << 10,
- 16 << 10,
- }
- dataChunkPools = [...]sync.Pool{
- {New: func() interface{} { return make([]byte, 1<<10) }},
- {New: func() interface{} { return make([]byte, 2<<10) }},
- {New: func() interface{} { return make([]byte, 4<<10) }},
- {New: func() interface{} { return make([]byte, 8<<10) }},
- {New: func() interface{} { return make([]byte, 16<<10) }},
- }
-)
+var dataChunkPools = [...]sync.Pool{
+ {New: func() interface{} { return new([1 << 10]byte) }},
+ {New: func() interface{} { return new([2 << 10]byte) }},
+ {New: func() interface{} { return new([4 << 10]byte) }},
+ {New: func() interface{} { return new([8 << 10]byte) }},
+ {New: func() interface{} { return new([16 << 10]byte) }},
+}
func getDataBufferChunk(size int64) []byte {
- i := 0
- for ; i < len(dataChunkSizeClasses)-1; i++ {
- if size <= int64(dataChunkSizeClasses[i]) {
- break
- }
+ switch {
+ case size <= 1<<10:
+ return dataChunkPools[0].Get().(*[1 << 10]byte)[:]
+ case size <= 2<<10:
+ return dataChunkPools[1].Get().(*[2 << 10]byte)[:]
+ case size <= 4<<10:
+ return dataChunkPools[2].Get().(*[4 << 10]byte)[:]
+ case size <= 8<<10:
+ return dataChunkPools[3].Get().(*[8 << 10]byte)[:]
+ default:
+ return dataChunkPools[4].Get().(*[16 << 10]byte)[:]
}
- return dataChunkPools[i].Get().([]byte)
}
func putDataBufferChunk(p []byte) {
- for i, n := range dataChunkSizeClasses {
- if len(p) == n {
- dataChunkPools[i].Put(p)
- return
- }
+ switch len(p) {
+ case 1 << 10:
+ dataChunkPools[0].Put((*[1 << 10]byte)(p))
+ case 2 << 10:
+ dataChunkPools[1].Put((*[2 << 10]byte)(p))
+ case 4 << 10:
+ dataChunkPools[2].Put((*[4 << 10]byte)(p))
+ case 8 << 10:
+ dataChunkPools[3].Put((*[8 << 10]byte)(p))
+ case 16 << 10:
+ dataChunkPools[4].Put((*[16 << 10]byte)(p))
+ default:
+ panic(fmt.Sprintf("unexpected buffer len=%v", len(p)))
}
- panic(fmt.Sprintf("unexpected buffer len=%v", len(p)))
}
// dataBuffer is an io.ReadWriter backed by a list of data chunks.
diff --git a/vendor/golang.org/x/net/http2/go111.go b/vendor/golang.org/x/net/http2/go111.go
deleted file mode 100644
index 5bf62b03..00000000
--- a/vendor/golang.org/x/net/http2/go111.go
+++ /dev/null
@@ -1,30 +0,0 @@
-// Copyright 2018 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-//go:build go1.11
-// +build go1.11
-
-package http2
-
-import (
- "net/http/httptrace"
- "net/textproto"
-)
-
-func traceHasWroteHeaderField(trace *httptrace.ClientTrace) bool {
- return trace != nil && trace.WroteHeaderField != nil
-}
-
-func traceWroteHeaderField(trace *httptrace.ClientTrace, k, v string) {
- if trace != nil && trace.WroteHeaderField != nil {
- trace.WroteHeaderField(k, []string{v})
- }
-}
-
-func traceGot1xxResponseFunc(trace *httptrace.ClientTrace) func(int, textproto.MIMEHeader) error {
- if trace != nil {
- return trace.Got1xxResponse
- }
- return nil
-}
diff --git a/vendor/golang.org/x/net/http2/go115.go b/vendor/golang.org/x/net/http2/go115.go
deleted file mode 100644
index 908af1ab..00000000
--- a/vendor/golang.org/x/net/http2/go115.go
+++ /dev/null
@@ -1,27 +0,0 @@
-// Copyright 2021 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-//go:build go1.15
-// +build go1.15
-
-package http2
-
-import (
- "context"
- "crypto/tls"
-)
-
-// dialTLSWithContext uses tls.Dialer, added in Go 1.15, to open a TLS
-// connection.
-func (t *Transport) dialTLSWithContext(ctx context.Context, network, addr string, cfg *tls.Config) (*tls.Conn, error) {
- dialer := &tls.Dialer{
- Config: cfg,
- }
- cn, err := dialer.DialContext(ctx, network, addr)
- if err != nil {
- return nil, err
- }
- tlsCn := cn.(*tls.Conn) // DialContext comment promises this will always succeed
- return tlsCn, nil
-}
diff --git a/vendor/golang.org/x/net/http2/go118.go b/vendor/golang.org/x/net/http2/go118.go
deleted file mode 100644
index aca4b2b3..00000000
--- a/vendor/golang.org/x/net/http2/go118.go
+++ /dev/null
@@ -1,17 +0,0 @@
-// Copyright 2021 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-//go:build go1.18
-// +build go1.18
-
-package http2
-
-import (
- "crypto/tls"
- "net"
-)
-
-func tlsUnderlyingConn(tc *tls.Conn) net.Conn {
- return tc.NetConn()
-}
diff --git a/vendor/golang.org/x/net/http2/not_go111.go b/vendor/golang.org/x/net/http2/not_go111.go
deleted file mode 100644
index cc0baa81..00000000
--- a/vendor/golang.org/x/net/http2/not_go111.go
+++ /dev/null
@@ -1,21 +0,0 @@
-// Copyright 2018 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-//go:build !go1.11
-// +build !go1.11
-
-package http2
-
-import (
- "net/http/httptrace"
- "net/textproto"
-)
-
-func traceHasWroteHeaderField(trace *httptrace.ClientTrace) bool { return false }
-
-func traceWroteHeaderField(trace *httptrace.ClientTrace, k, v string) {}
-
-func traceGot1xxResponseFunc(trace *httptrace.ClientTrace) func(int, textproto.MIMEHeader) error {
- return nil
-}
diff --git a/vendor/golang.org/x/net/http2/not_go115.go b/vendor/golang.org/x/net/http2/not_go115.go
deleted file mode 100644
index e6c04cf7..00000000
--- a/vendor/golang.org/x/net/http2/not_go115.go
+++ /dev/null
@@ -1,31 +0,0 @@
-// Copyright 2021 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-//go:build !go1.15
-// +build !go1.15
-
-package http2
-
-import (
- "context"
- "crypto/tls"
-)
-
-// dialTLSWithContext opens a TLS connection.
-func (t *Transport) dialTLSWithContext(ctx context.Context, network, addr string, cfg *tls.Config) (*tls.Conn, error) {
- cn, err := tls.Dial(network, addr, cfg)
- if err != nil {
- return nil, err
- }
- if err := cn.Handshake(); err != nil {
- return nil, err
- }
- if cfg.InsecureSkipVerify {
- return cn, nil
- }
- if err := cn.VerifyHostname(cfg.ServerName); err != nil {
- return nil, err
- }
- return cn, nil
-}
diff --git a/vendor/golang.org/x/net/http2/not_go118.go b/vendor/golang.org/x/net/http2/not_go118.go
deleted file mode 100644
index eab532c9..00000000
--- a/vendor/golang.org/x/net/http2/not_go118.go
+++ /dev/null
@@ -1,17 +0,0 @@
-// Copyright 2021 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-//go:build !go1.18
-// +build !go1.18
-
-package http2
-
-import (
- "crypto/tls"
- "net"
-)
-
-func tlsUnderlyingConn(tc *tls.Conn) net.Conn {
- return nil
-}
diff --git a/vendor/golang.org/x/net/http2/server.go b/vendor/golang.org/x/net/http2/server.go
index 6d5e0088..ae94c640 100644
--- a/vendor/golang.org/x/net/http2/server.go
+++ b/vendor/golang.org/x/net/http2/server.go
@@ -581,9 +581,11 @@ type serverConn struct {
advMaxStreams uint32 // our SETTINGS_MAX_CONCURRENT_STREAMS advertised the client
curClientStreams uint32 // number of open streams initiated by the client
curPushedStreams uint32 // number of open streams initiated by server push
+ curHandlers uint32 // number of running handler goroutines
maxClientStreamID uint32 // max ever seen from client (odd), or 0 if there have been no client requests
maxPushPromiseID uint32 // ID of the last push promise (even), or 0 if there have been no pushes
streams map[uint32]*stream
+ unstartedHandlers []unstartedHandler
initialStreamSendWindowSize int32
maxFrameSize int32
peerMaxHeaderListSize uint32 // zero means unknown (default)
@@ -981,6 +983,8 @@ func (sc *serverConn) serve() {
return
case gracefulShutdownMsg:
sc.startGracefulShutdownInternal()
+ case handlerDoneMsg:
+ sc.handlerDone()
default:
panic("unknown timer")
}
@@ -1020,6 +1024,7 @@ var (
idleTimerMsg = new(serverMessage)
shutdownTimerMsg = new(serverMessage)
gracefulShutdownMsg = new(serverMessage)
+ handlerDoneMsg = new(serverMessage)
)
func (sc *serverConn) onSettingsTimer() { sc.sendServeMsg(settingsTimerMsg) }
@@ -1892,9 +1897,11 @@ func (st *stream) copyTrailersToHandlerRequest() {
// onReadTimeout is run on its own goroutine (from time.AfterFunc)
// when the stream's ReadTimeout has fired.
func (st *stream) onReadTimeout() {
- // Wrap the ErrDeadlineExceeded to avoid callers depending on us
- // returning the bare error.
- st.body.CloseWithError(fmt.Errorf("%w", os.ErrDeadlineExceeded))
+ if st.body != nil {
+ // Wrap the ErrDeadlineExceeded to avoid callers depending on us
+ // returning the bare error.
+ st.body.CloseWithError(fmt.Errorf("%w", os.ErrDeadlineExceeded))
+ }
}
// onWriteTimeout is run on its own goroutine (from time.AfterFunc)
@@ -2012,13 +2019,10 @@ func (sc *serverConn) processHeaders(f *MetaHeadersFrame) error {
// (in Go 1.8), though. That's a more sane option anyway.
if sc.hs.ReadTimeout != 0 {
sc.conn.SetReadDeadline(time.Time{})
- if st.body != nil {
- st.readDeadline = time.AfterFunc(sc.hs.ReadTimeout, st.onReadTimeout)
- }
+ st.readDeadline = time.AfterFunc(sc.hs.ReadTimeout, st.onReadTimeout)
}
- go sc.runHandler(rw, req, handler)
- return nil
+ return sc.scheduleHandler(id, rw, req, handler)
}
func (sc *serverConn) upgradeRequest(req *http.Request) {
@@ -2038,6 +2042,10 @@ func (sc *serverConn) upgradeRequest(req *http.Request) {
sc.conn.SetReadDeadline(time.Time{})
}
+ // This is the first request on the connection,
+ // so start the handler directly rather than going
+ // through scheduleHandler.
+ sc.curHandlers++
go sc.runHandler(rw, req, sc.handler.ServeHTTP)
}
@@ -2278,8 +2286,62 @@ func (sc *serverConn) newResponseWriter(st *stream, req *http.Request) *response
return &responseWriter{rws: rws}
}
+type unstartedHandler struct {
+ streamID uint32
+ rw *responseWriter
+ req *http.Request
+ handler func(http.ResponseWriter, *http.Request)
+}
+
+// scheduleHandler starts a handler goroutine,
+// or schedules one to start as soon as an existing handler finishes.
+func (sc *serverConn) scheduleHandler(streamID uint32, rw *responseWriter, req *http.Request, handler func(http.ResponseWriter, *http.Request)) error {
+ sc.serveG.check()
+ maxHandlers := sc.advMaxStreams
+ if sc.curHandlers < maxHandlers {
+ sc.curHandlers++
+ go sc.runHandler(rw, req, handler)
+ return nil
+ }
+ if len(sc.unstartedHandlers) > int(4*sc.advMaxStreams) {
+ return sc.countError("too_many_early_resets", ConnectionError(ErrCodeEnhanceYourCalm))
+ }
+ sc.unstartedHandlers = append(sc.unstartedHandlers, unstartedHandler{
+ streamID: streamID,
+ rw: rw,
+ req: req,
+ handler: handler,
+ })
+ return nil
+}
+
+func (sc *serverConn) handlerDone() {
+ sc.serveG.check()
+ sc.curHandlers--
+ i := 0
+ maxHandlers := sc.advMaxStreams
+ for ; i < len(sc.unstartedHandlers); i++ {
+ u := sc.unstartedHandlers[i]
+ if sc.streams[u.streamID] == nil {
+ // This stream was reset before its goroutine had a chance to start.
+ continue
+ }
+ if sc.curHandlers >= maxHandlers {
+ break
+ }
+ sc.curHandlers++
+ go sc.runHandler(u.rw, u.req, u.handler)
+ sc.unstartedHandlers[i] = unstartedHandler{} // don't retain references
+ }
+ sc.unstartedHandlers = sc.unstartedHandlers[i:]
+ if len(sc.unstartedHandlers) == 0 {
+ sc.unstartedHandlers = nil
+ }
+}
+
// Run on its own goroutine.
func (sc *serverConn) runHandler(rw *responseWriter, req *http.Request, handler func(http.ResponseWriter, *http.Request)) {
+ defer sc.sendServeMsg(handlerDoneMsg)
didPanic := true
defer func() {
rw.rws.stream.cancelCtx()
@@ -2487,7 +2549,6 @@ type responseWriterState struct {
wroteHeader bool // WriteHeader called (explicitly or implicitly). Not necessarily sent to user yet.
sentHeader bool // have we sent the header frame?
handlerDone bool // handler has finished
- dirty bool // a Write failed; don't reuse this responseWriterState
sentContentLen int64 // non-zero if handler set a Content-Length header
wroteBytes int64
@@ -2607,7 +2668,6 @@ func (rws *responseWriterState) writeChunk(p []byte) (n int, err error) {
date: date,
})
if err != nil {
- rws.dirty = true
return 0, err
}
if endStream {
@@ -2628,7 +2688,6 @@ func (rws *responseWriterState) writeChunk(p []byte) (n int, err error) {
if len(p) > 0 || endStream {
// only send a 0 byte DATA frame if we're ending the stream.
if err := rws.conn.writeDataFromHandler(rws.stream, p, endStream); err != nil {
- rws.dirty = true
return 0, err
}
}
@@ -2640,9 +2699,6 @@ func (rws *responseWriterState) writeChunk(p []byte) (n int, err error) {
trailers: rws.trailers,
endStream: true,
})
- if err != nil {
- rws.dirty = true
- }
return len(p), err
}
return len(p), nil
@@ -2858,14 +2914,12 @@ func (rws *responseWriterState) writeHeader(code int) {
h.Del("Transfer-Encoding")
}
- if rws.conn.writeHeaders(rws.stream, &writeResHeaders{
+ rws.conn.writeHeaders(rws.stream, &writeResHeaders{
streamID: rws.stream.id,
httpResCode: code,
h: h,
endStream: rws.handlerDone && !rws.hasTrailers(),
- }) != nil {
- rws.dirty = true
- }
+ })
return
}
@@ -2930,19 +2984,10 @@ func (w *responseWriter) write(lenData int, dataB []byte, dataS string) (n int,
func (w *responseWriter) handlerDone() {
rws := w.rws
- dirty := rws.dirty
rws.handlerDone = true
w.Flush()
w.rws = nil
- if !dirty {
- // Only recycle the pool if all prior Write calls to
- // the serverConn goroutine completed successfully. If
- // they returned earlier due to resets from the peer
- // there might still be write goroutines outstanding
- // from the serverConn referencing the rws memory. See
- // issue 20704.
- responseWriterStatePool.Put(rws)
- }
+ responseWriterStatePool.Put(rws)
}
// Push errors.
@@ -3125,6 +3170,7 @@ func (sc *serverConn) startPush(msg *startPushRequest) {
panic(fmt.Sprintf("newWriterAndRequestNoBody(%+v): %v", msg.url, err))
}
+ sc.curHandlers++
go sc.runHandler(rw, req, sc.handler.ServeHTTP)
return promisedID, nil
}
diff --git a/vendor/golang.org/x/net/http2/transport.go b/vendor/golang.org/x/net/http2/transport.go
index 4515b22c..df578b86 100644
--- a/vendor/golang.org/x/net/http2/transport.go
+++ b/vendor/golang.org/x/net/http2/transport.go
@@ -1018,7 +1018,7 @@ func (cc *ClientConn) forceCloseConn() {
if !ok {
return
}
- if nc := tlsUnderlyingConn(tc); nc != nil {
+ if nc := tc.NetConn(); nc != nil {
nc.Close()
}
}
@@ -3201,3 +3201,34 @@ func traceFirstResponseByte(trace *httptrace.ClientTrace) {
trace.GotFirstResponseByte()
}
}
+
+func traceHasWroteHeaderField(trace *httptrace.ClientTrace) bool {
+ return trace != nil && trace.WroteHeaderField != nil
+}
+
+func traceWroteHeaderField(trace *httptrace.ClientTrace, k, v string) {
+ if trace != nil && trace.WroteHeaderField != nil {
+ trace.WroteHeaderField(k, []string{v})
+ }
+}
+
+func traceGot1xxResponseFunc(trace *httptrace.ClientTrace) func(int, textproto.MIMEHeader) error {
+ if trace != nil {
+ return trace.Got1xxResponse
+ }
+ return nil
+}
+
+// dialTLSWithContext uses tls.Dialer, added in Go 1.15, to open a TLS
+// connection.
+func (t *Transport) dialTLSWithContext(ctx context.Context, network, addr string, cfg *tls.Config) (*tls.Conn, error) {
+ dialer := &tls.Dialer{
+ Config: cfg,
+ }
+ cn, err := dialer.DialContext(ctx, network, addr)
+ if err != nil {
+ return nil, err
+ }
+ tlsCn := cn.(*tls.Conn) // DialContext comment promises this will always succeed
+ return tlsCn, nil
+}
diff --git a/vendor/golang.org/x/net/idna/go118.go b/vendor/golang.org/x/net/idna/go118.go
index c5c4338d..712f1ad8 100644
--- a/vendor/golang.org/x/net/idna/go118.go
+++ b/vendor/golang.org/x/net/idna/go118.go
@@ -5,7 +5,6 @@
// license that can be found in the LICENSE file.
//go:build go1.18
-// +build go1.18
package idna
diff --git a/vendor/golang.org/x/net/idna/idna10.0.0.go b/vendor/golang.org/x/net/idna/idna10.0.0.go
index 64ccf85f..7b371788 100644
--- a/vendor/golang.org/x/net/idna/idna10.0.0.go
+++ b/vendor/golang.org/x/net/idna/idna10.0.0.go
@@ -5,7 +5,6 @@
// license that can be found in the LICENSE file.
//go:build go1.10
-// +build go1.10
// Package idna implements IDNA2008 using the compatibility processing
// defined by UTS (Unicode Technical Standard) #46, which defines a standard to
diff --git a/vendor/golang.org/x/net/idna/idna9.0.0.go b/vendor/golang.org/x/net/idna/idna9.0.0.go
index ee1698ce..cc6a892a 100644
--- a/vendor/golang.org/x/net/idna/idna9.0.0.go
+++ b/vendor/golang.org/x/net/idna/idna9.0.0.go
@@ -5,7 +5,6 @@
// license that can be found in the LICENSE file.
//go:build !go1.10
-// +build !go1.10
// Package idna implements IDNA2008 using the compatibility processing
// defined by UTS (Unicode Technical Standard) #46, which defines a standard to
diff --git a/vendor/golang.org/x/net/idna/pre_go118.go b/vendor/golang.org/x/net/idna/pre_go118.go
index 3aaccab1..40e74bb3 100644
--- a/vendor/golang.org/x/net/idna/pre_go118.go
+++ b/vendor/golang.org/x/net/idna/pre_go118.go
@@ -5,7 +5,6 @@
// license that can be found in the LICENSE file.
//go:build !go1.18
-// +build !go1.18
package idna
diff --git a/vendor/golang.org/x/net/idna/tables10.0.0.go b/vendor/golang.org/x/net/idna/tables10.0.0.go
index d1d62ef4..c6c2bf10 100644
--- a/vendor/golang.org/x/net/idna/tables10.0.0.go
+++ b/vendor/golang.org/x/net/idna/tables10.0.0.go
@@ -1,7 +1,6 @@
// Code generated by running "go generate" in golang.org/x/text. DO NOT EDIT.
//go:build go1.10 && !go1.13
-// +build go1.10,!go1.13
package idna
diff --git a/vendor/golang.org/x/net/idna/tables11.0.0.go b/vendor/golang.org/x/net/idna/tables11.0.0.go
index 167efba7..76789393 100644
--- a/vendor/golang.org/x/net/idna/tables11.0.0.go
+++ b/vendor/golang.org/x/net/idna/tables11.0.0.go
@@ -1,7 +1,6 @@
// Code generated by running "go generate" in golang.org/x/text. DO NOT EDIT.
//go:build go1.13 && !go1.14
-// +build go1.13,!go1.14
package idna
diff --git a/vendor/golang.org/x/net/idna/tables12.0.0.go b/vendor/golang.org/x/net/idna/tables12.0.0.go
index ab40f7bc..0600cd2a 100644
--- a/vendor/golang.org/x/net/idna/tables12.0.0.go
+++ b/vendor/golang.org/x/net/idna/tables12.0.0.go
@@ -1,7 +1,6 @@
// Code generated by running "go generate" in golang.org/x/text. DO NOT EDIT.
//go:build go1.14 && !go1.16
-// +build go1.14,!go1.16
package idna
diff --git a/vendor/golang.org/x/net/idna/tables13.0.0.go b/vendor/golang.org/x/net/idna/tables13.0.0.go
index 66701ead..2fb768ef 100644
--- a/vendor/golang.org/x/net/idna/tables13.0.0.go
+++ b/vendor/golang.org/x/net/idna/tables13.0.0.go
@@ -1,7 +1,6 @@
// Code generated by running "go generate" in golang.org/x/text. DO NOT EDIT.
//go:build go1.16 && !go1.21
-// +build go1.16,!go1.21
package idna
diff --git a/vendor/golang.org/x/net/idna/tables15.0.0.go b/vendor/golang.org/x/net/idna/tables15.0.0.go
index 40033778..5ff05fe1 100644
--- a/vendor/golang.org/x/net/idna/tables15.0.0.go
+++ b/vendor/golang.org/x/net/idna/tables15.0.0.go
@@ -1,7 +1,6 @@
// Code generated by running "go generate" in golang.org/x/text. DO NOT EDIT.
//go:build go1.21
-// +build go1.21
package idna
diff --git a/vendor/golang.org/x/net/idna/tables9.0.0.go b/vendor/golang.org/x/net/idna/tables9.0.0.go
index 4074b533..0f25e84c 100644
--- a/vendor/golang.org/x/net/idna/tables9.0.0.go
+++ b/vendor/golang.org/x/net/idna/tables9.0.0.go
@@ -1,7 +1,6 @@
// Code generated by running "go generate" in golang.org/x/text. DO NOT EDIT.
//go:build !go1.10
-// +build !go1.10
package idna
diff --git a/vendor/golang.org/x/net/idna/trie12.0.0.go b/vendor/golang.org/x/net/idna/trie12.0.0.go
index bb63f904..8a75b966 100644
--- a/vendor/golang.org/x/net/idna/trie12.0.0.go
+++ b/vendor/golang.org/x/net/idna/trie12.0.0.go
@@ -5,7 +5,6 @@
// license that can be found in the LICENSE file.
//go:build !go1.16
-// +build !go1.16
package idna
diff --git a/vendor/golang.org/x/net/idna/trie13.0.0.go b/vendor/golang.org/x/net/idna/trie13.0.0.go
index 7d68a8dc..fa45bb90 100644
--- a/vendor/golang.org/x/net/idna/trie13.0.0.go
+++ b/vendor/golang.org/x/net/idna/trie13.0.0.go
@@ -5,7 +5,6 @@
// license that can be found in the LICENSE file.
//go:build go1.16
-// +build go1.16
package idna
diff --git a/vendor/golang.org/x/oauth2/clientcredentials/clientcredentials.go b/vendor/golang.org/x/oauth2/clientcredentials/clientcredentials.go
new file mode 100644
index 00000000..2459d069
--- /dev/null
+++ b/vendor/golang.org/x/oauth2/clientcredentials/clientcredentials.go
@@ -0,0 +1,124 @@
+// 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.
+
+// Package clientcredentials implements the OAuth2.0 "client credentials" token flow,
+// also known as the "two-legged OAuth 2.0".
+//
+// This should be used when the client is acting on its own behalf or when the client
+// is the resource owner. It may also be used when requesting access to protected
+// resources based on an authorization previously arranged with the authorization
+// server.
+//
+// See https://tools.ietf.org/html/rfc6749#section-4.4
+package clientcredentials // import "golang.org/x/oauth2/clientcredentials"
+
+import (
+ "context"
+ "fmt"
+ "net/http"
+ "net/url"
+ "strings"
+
+ "golang.org/x/oauth2"
+ "golang.org/x/oauth2/internal"
+)
+
+// Config describes a 2-legged OAuth2 flow, with both the
+// client application information and the server's endpoint URLs.
+type Config struct {
+ // ClientID is the application's ID.
+ ClientID string
+
+ // ClientSecret is the application's secret.
+ ClientSecret string
+
+ // TokenURL is the resource server's token endpoint
+ // URL. This is a constant specific to each server.
+ TokenURL string
+
+ // Scope specifies optional requested permissions.
+ Scopes []string
+
+ // EndpointParams specifies additional parameters for requests to the token endpoint.
+ EndpointParams url.Values
+
+ // AuthStyle optionally specifies how the endpoint wants the
+ // client ID & client secret sent. The zero value means to
+ // auto-detect.
+ AuthStyle oauth2.AuthStyle
+
+ // authStyleCache caches which auth style to use when Endpoint.AuthStyle is
+ // the zero value (AuthStyleAutoDetect).
+ authStyleCache internal.LazyAuthStyleCache
+}
+
+// Token uses client credentials to retrieve a token.
+//
+// The provided context optionally controls which HTTP client is used. See the oauth2.HTTPClient variable.
+func (c *Config) Token(ctx context.Context) (*oauth2.Token, error) {
+ return c.TokenSource(ctx).Token()
+}
+
+// Client returns an HTTP client using the provided token.
+// The token will auto-refresh as necessary.
+//
+// The provided context optionally controls which HTTP client
+// is returned. See the oauth2.HTTPClient variable.
+//
+// The returned Client and its Transport should not be modified.
+func (c *Config) Client(ctx context.Context) *http.Client {
+ return oauth2.NewClient(ctx, c.TokenSource(ctx))
+}
+
+// TokenSource returns a TokenSource that returns t until t expires,
+// automatically refreshing it as necessary using the provided context and the
+// client ID and client secret.
+//
+// Most users will use Config.Client instead.
+func (c *Config) TokenSource(ctx context.Context) oauth2.TokenSource {
+ source := &tokenSource{
+ ctx: ctx,
+ conf: c,
+ }
+ return oauth2.ReuseTokenSource(nil, source)
+}
+
+type tokenSource struct {
+ ctx context.Context
+ conf *Config
+}
+
+// Token refreshes the token by using a new client credentials request.
+// tokens received this way do not include a refresh token
+func (c *tokenSource) Token() (*oauth2.Token, error) {
+ v := url.Values{
+ "grant_type": {"client_credentials"},
+ }
+ if len(c.conf.Scopes) > 0 {
+ v.Set("scope", strings.Join(c.conf.Scopes, " "))
+ }
+ for k, p := range c.conf.EndpointParams {
+ // Allow grant_type to be overridden to allow interoperability with
+ // non-compliant implementations.
+ if _, ok := v[k]; ok && k != "grant_type" {
+ return nil, fmt.Errorf("oauth2: cannot overwrite parameter %q", k)
+ }
+ v[k] = p
+ }
+
+ tk, err := internal.RetrieveToken(c.ctx, c.conf.ClientID, c.conf.ClientSecret, c.conf.TokenURL, v, internal.AuthStyle(c.conf.AuthStyle), c.conf.authStyleCache.Get())
+ if err != nil {
+ if rErr, ok := err.(*internal.RetrieveError); ok {
+ return nil, (*oauth2.RetrieveError)(rErr)
+ }
+ return nil, err
+ }
+ t := &oauth2.Token{
+ AccessToken: tk.AccessToken,
+ TokenType: tk.TokenType,
+ RefreshToken: tk.RefreshToken,
+ Expiry: tk.Expiry,
+ }
+ return t.WithExtra(tk.Raw), nil
+}
diff --git a/vendor/golang.org/x/oauth2/deviceauth.go b/vendor/golang.org/x/oauth2/deviceauth.go
new file mode 100644
index 00000000..e99c92f3
--- /dev/null
+++ b/vendor/golang.org/x/oauth2/deviceauth.go
@@ -0,0 +1,198 @@
+package oauth2
+
+import (
+ "context"
+ "encoding/json"
+ "errors"
+ "fmt"
+ "io"
+ "net/http"
+ "net/url"
+ "strings"
+ "time"
+
+ "golang.org/x/oauth2/internal"
+)
+
+// https://datatracker.ietf.org/doc/html/rfc8628#section-3.5
+const (
+ errAuthorizationPending = "authorization_pending"
+ errSlowDown = "slow_down"
+ errAccessDenied = "access_denied"
+ errExpiredToken = "expired_token"
+)
+
+// DeviceAuthResponse describes a successful RFC 8628 Device Authorization Response
+// https://datatracker.ietf.org/doc/html/rfc8628#section-3.2
+type DeviceAuthResponse struct {
+ // DeviceCode
+ DeviceCode string `json:"device_code"`
+ // UserCode is the code the user should enter at the verification uri
+ UserCode string `json:"user_code"`
+ // VerificationURI is where user should enter the user code
+ VerificationURI string `json:"verification_uri"`
+ // VerificationURIComplete (if populated) includes the user code in the verification URI. This is typically shown to the user in non-textual form, such as a QR code.
+ VerificationURIComplete string `json:"verification_uri_complete,omitempty"`
+ // Expiry is when the device code and user code expire
+ Expiry time.Time `json:"expires_in,omitempty"`
+ // Interval is the duration in seconds that Poll should wait between requests
+ Interval int64 `json:"interval,omitempty"`
+}
+
+func (d DeviceAuthResponse) MarshalJSON() ([]byte, error) {
+ type Alias DeviceAuthResponse
+ var expiresIn int64
+ if !d.Expiry.IsZero() {
+ expiresIn = int64(time.Until(d.Expiry).Seconds())
+ }
+ return json.Marshal(&struct {
+ ExpiresIn int64 `json:"expires_in,omitempty"`
+ *Alias
+ }{
+ ExpiresIn: expiresIn,
+ Alias: (*Alias)(&d),
+ })
+
+}
+
+func (c *DeviceAuthResponse) UnmarshalJSON(data []byte) error {
+ type Alias DeviceAuthResponse
+ aux := &struct {
+ ExpiresIn int64 `json:"expires_in"`
+ // workaround misspelling of verification_uri
+ VerificationURL string `json:"verification_url"`
+ *Alias
+ }{
+ Alias: (*Alias)(c),
+ }
+ if err := json.Unmarshal(data, &aux); err != nil {
+ return err
+ }
+ if aux.ExpiresIn != 0 {
+ c.Expiry = time.Now().UTC().Add(time.Second * time.Duration(aux.ExpiresIn))
+ }
+ if c.VerificationURI == "" {
+ c.VerificationURI = aux.VerificationURL
+ }
+ return nil
+}
+
+// DeviceAuth returns a device auth struct which contains a device code
+// and authorization information provided for users to enter on another device.
+func (c *Config) DeviceAuth(ctx context.Context, opts ...AuthCodeOption) (*DeviceAuthResponse, error) {
+ // https://datatracker.ietf.org/doc/html/rfc8628#section-3.1
+ v := url.Values{
+ "client_id": {c.ClientID},
+ }
+ if len(c.Scopes) > 0 {
+ v.Set("scope", strings.Join(c.Scopes, " "))
+ }
+ for _, opt := range opts {
+ opt.setValue(v)
+ }
+ return retrieveDeviceAuth(ctx, c, v)
+}
+
+func retrieveDeviceAuth(ctx context.Context, c *Config, v url.Values) (*DeviceAuthResponse, error) {
+ if c.Endpoint.DeviceAuthURL == "" {
+ return nil, errors.New("endpoint missing DeviceAuthURL")
+ }
+
+ req, err := http.NewRequest("POST", c.Endpoint.DeviceAuthURL, strings.NewReader(v.Encode()))
+ if err != nil {
+ return nil, err
+ }
+ req.Header.Set("Content-Type", "application/x-www-form-urlencoded")
+ req.Header.Set("Accept", "application/json")
+
+ t := time.Now()
+ r, err := internal.ContextClient(ctx).Do(req)
+ if err != nil {
+ return nil, err
+ }
+
+ body, err := io.ReadAll(io.LimitReader(r.Body, 1<<20))
+ if err != nil {
+ return nil, fmt.Errorf("oauth2: cannot auth device: %v", err)
+ }
+ if code := r.StatusCode; code < 200 || code > 299 {
+ return nil, &RetrieveError{
+ Response: r,
+ Body: body,
+ }
+ }
+
+ da := &DeviceAuthResponse{}
+ err = json.Unmarshal(body, &da)
+ if err != nil {
+ return nil, fmt.Errorf("unmarshal %s", err)
+ }
+
+ if !da.Expiry.IsZero() {
+ // Make a small adjustment to account for time taken by the request
+ da.Expiry = da.Expiry.Add(-time.Since(t))
+ }
+
+ return da, nil
+}
+
+// DeviceAccessToken polls the server to exchange a device code for a token.
+func (c *Config) DeviceAccessToken(ctx context.Context, da *DeviceAuthResponse, opts ...AuthCodeOption) (*Token, error) {
+ if !da.Expiry.IsZero() {
+ var cancel context.CancelFunc
+ ctx, cancel = context.WithDeadline(ctx, da.Expiry)
+ defer cancel()
+ }
+
+ // https://datatracker.ietf.org/doc/html/rfc8628#section-3.4
+ v := url.Values{
+ "client_id": {c.ClientID},
+ "grant_type": {"urn:ietf:params:oauth:grant-type:device_code"},
+ "device_code": {da.DeviceCode},
+ }
+ if len(c.Scopes) > 0 {
+ v.Set("scope", strings.Join(c.Scopes, " "))
+ }
+ for _, opt := range opts {
+ opt.setValue(v)
+ }
+
+ // "If no value is provided, clients MUST use 5 as the default."
+ // https://datatracker.ietf.org/doc/html/rfc8628#section-3.2
+ interval := da.Interval
+ if interval == 0 {
+ interval = 5
+ }
+
+ ticker := time.NewTicker(time.Duration(interval) * time.Second)
+ defer ticker.Stop()
+ for {
+ select {
+ case <-ctx.Done():
+ return nil, ctx.Err()
+ case <-ticker.C:
+ tok, err := retrieveToken(ctx, c, v)
+ if err == nil {
+ return tok, nil
+ }
+
+ e, ok := err.(*RetrieveError)
+ if !ok {
+ return nil, err
+ }
+ switch e.ErrorCode {
+ case errSlowDown:
+ // https://datatracker.ietf.org/doc/html/rfc8628#section-3.5
+ // "the interval MUST be increased by 5 seconds for this and all subsequent requests"
+ interval += 5
+ ticker.Reset(time.Duration(interval) * time.Second)
+ case errAuthorizationPending:
+ // Do nothing.
+ case errAccessDenied, errExpiredToken:
+ fallthrough
+ default:
+ return tok, err
+ }
+ }
+ }
+}
diff --git a/vendor/golang.org/x/oauth2/jws/jws.go b/vendor/golang.org/x/oauth2/jws/jws.go
new file mode 100644
index 00000000..95015648
--- /dev/null
+++ b/vendor/golang.org/x/oauth2/jws/jws.go
@@ -0,0 +1,182 @@
+// 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.
+
+// Package jws provides a partial implementation
+// of JSON Web Signature encoding and decoding.
+// It exists to support the golang.org/x/oauth2 package.
+//
+// See RFC 7515.
+//
+// Deprecated: this package is not intended for public use and might be
+// removed in the future. It exists for internal use only.
+// Please switch to another JWS package or copy this package into your own
+// source tree.
+package jws // import "golang.org/x/oauth2/jws"
+
+import (
+ "bytes"
+ "crypto"
+ "crypto/rand"
+ "crypto/rsa"
+ "crypto/sha256"
+ "encoding/base64"
+ "encoding/json"
+ "errors"
+ "fmt"
+ "strings"
+ "time"
+)
+
+// ClaimSet contains information about the JWT signature including the
+// permissions being requested (scopes), the target of the token, the issuer,
+// the time the token was issued, and the lifetime of the token.
+type ClaimSet struct {
+ Iss string `json:"iss"` // email address of the client_id of the application making the access token request
+ Scope string `json:"scope,omitempty"` // space-delimited list of the permissions the application requests
+ Aud string `json:"aud"` // descriptor of the intended target of the assertion (Optional).
+ Exp int64 `json:"exp"` // the expiration time of the assertion (seconds since Unix epoch)
+ Iat int64 `json:"iat"` // the time the assertion was issued (seconds since Unix epoch)
+ Typ string `json:"typ,omitempty"` // token type (Optional).
+
+ // Email for which the application is requesting delegated access (Optional).
+ Sub string `json:"sub,omitempty"`
+
+ // The old name of Sub. Client keeps setting Prn to be
+ // complaint with legacy OAuth 2.0 providers. (Optional)
+ Prn string `json:"prn,omitempty"`
+
+ // See http://tools.ietf.org/html/draft-jones-json-web-token-10#section-4.3
+ // This array is marshalled using custom code (see (c *ClaimSet) encode()).
+ PrivateClaims map[string]interface{} `json:"-"`
+}
+
+func (c *ClaimSet) encode() (string, error) {
+ // Reverting time back for machines whose time is not perfectly in sync.
+ // If client machine's time is in the future according
+ // to Google servers, an access token will not be issued.
+ now := time.Now().Add(-10 * time.Second)
+ if c.Iat == 0 {
+ c.Iat = now.Unix()
+ }
+ if c.Exp == 0 {
+ c.Exp = now.Add(time.Hour).Unix()
+ }
+ if c.Exp < c.Iat {
+ return "", fmt.Errorf("jws: invalid Exp = %v; must be later than Iat = %v", c.Exp, c.Iat)
+ }
+
+ b, err := json.Marshal(c)
+ if err != nil {
+ return "", err
+ }
+
+ if len(c.PrivateClaims) == 0 {
+ return base64.RawURLEncoding.EncodeToString(b), nil
+ }
+
+ // Marshal private claim set and then append it to b.
+ prv, err := json.Marshal(c.PrivateClaims)
+ if err != nil {
+ return "", fmt.Errorf("jws: invalid map of private claims %v", c.PrivateClaims)
+ }
+
+ // Concatenate public and private claim JSON objects.
+ if !bytes.HasSuffix(b, []byte{'}'}) {
+ return "", fmt.Errorf("jws: invalid JSON %s", b)
+ }
+ if !bytes.HasPrefix(prv, []byte{'{'}) {
+ return "", fmt.Errorf("jws: invalid JSON %s", prv)
+ }
+ b[len(b)-1] = ',' // Replace closing curly brace with a comma.
+ b = append(b, prv[1:]...) // Append private claims.
+ return base64.RawURLEncoding.EncodeToString(b), nil
+}
+
+// Header represents the header for the signed JWS payloads.
+type Header struct {
+ // The algorithm used for signature.
+ Algorithm string `json:"alg"`
+
+ // Represents the token type.
+ Typ string `json:"typ"`
+
+ // The optional hint of which key is being used.
+ KeyID string `json:"kid,omitempty"`
+}
+
+func (h *Header) encode() (string, error) {
+ b, err := json.Marshal(h)
+ if err != nil {
+ return "", err
+ }
+ return base64.RawURLEncoding.EncodeToString(b), nil
+}
+
+// Decode decodes a claim set from a JWS payload.
+func Decode(payload string) (*ClaimSet, error) {
+ // decode returned id token to get expiry
+ s := strings.Split(payload, ".")
+ if len(s) < 2 {
+ // TODO(jbd): Provide more context about the error.
+ return nil, errors.New("jws: invalid token received")
+ }
+ decoded, err := base64.RawURLEncoding.DecodeString(s[1])
+ if err != nil {
+ return nil, err
+ }
+ c := &ClaimSet{}
+ err = json.NewDecoder(bytes.NewBuffer(decoded)).Decode(c)
+ return c, err
+}
+
+// Signer returns a signature for the given data.
+type Signer func(data []byte) (sig []byte, err error)
+
+// EncodeWithSigner encodes a header and claim set with the provided signer.
+func EncodeWithSigner(header *Header, c *ClaimSet, sg Signer) (string, error) {
+ head, err := header.encode()
+ if err != nil {
+ return "", err
+ }
+ cs, err := c.encode()
+ if err != nil {
+ return "", err
+ }
+ ss := fmt.Sprintf("%s.%s", head, cs)
+ sig, err := sg([]byte(ss))
+ if err != nil {
+ return "", err
+ }
+ return fmt.Sprintf("%s.%s", ss, base64.RawURLEncoding.EncodeToString(sig)), nil
+}
+
+// Encode encodes a signed JWS with provided header and claim set.
+// This invokes EncodeWithSigner using crypto/rsa.SignPKCS1v15 with the given RSA private key.
+func Encode(header *Header, c *ClaimSet, key *rsa.PrivateKey) (string, error) {
+ sg := func(data []byte) (sig []byte, err error) {
+ h := sha256.New()
+ h.Write(data)
+ return rsa.SignPKCS1v15(rand.Reader, key, crypto.SHA256, h.Sum(nil))
+ }
+ return EncodeWithSigner(header, c, sg)
+}
+
+// Verify tests whether the provided JWT token's signature was produced by the private key
+// associated with the supplied public key.
+func Verify(token string, key *rsa.PublicKey) error {
+ parts := strings.Split(token, ".")
+ if len(parts) != 3 {
+ return errors.New("jws: invalid token received, token must have 3 parts")
+ }
+
+ signedContent := parts[0] + "." + parts[1]
+ signatureString, err := base64.RawURLEncoding.DecodeString(parts[2])
+ if err != nil {
+ return err
+ }
+
+ h := sha256.New()
+ h.Write([]byte(signedContent))
+ return rsa.VerifyPKCS1v15(key, crypto.SHA256, h.Sum(nil), signatureString)
+}
diff --git a/vendor/golang.org/x/oauth2/jwt/jwt.go b/vendor/golang.org/x/oauth2/jwt/jwt.go
new file mode 100644
index 00000000..b2bf1829
--- /dev/null
+++ b/vendor/golang.org/x/oauth2/jwt/jwt.go
@@ -0,0 +1,185 @@
+// 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.
+
+// Package jwt implements the OAuth 2.0 JSON Web Token flow, commonly
+// known as "two-legged OAuth 2.0".
+//
+// See: https://tools.ietf.org/html/draft-ietf-oauth-jwt-bearer-12
+package jwt
+
+import (
+ "context"
+ "encoding/json"
+ "fmt"
+ "io"
+ "io/ioutil"
+ "net/http"
+ "net/url"
+ "strings"
+ "time"
+
+ "golang.org/x/oauth2"
+ "golang.org/x/oauth2/internal"
+ "golang.org/x/oauth2/jws"
+)
+
+var (
+ defaultGrantType = "urn:ietf:params:oauth:grant-type:jwt-bearer"
+ defaultHeader = &jws.Header{Algorithm: "RS256", Typ: "JWT"}
+)
+
+// Config is the configuration for using JWT to fetch tokens,
+// commonly known as "two-legged OAuth 2.0".
+type Config struct {
+ // Email is the OAuth client identifier used when communicating with
+ // the configured OAuth provider.
+ Email string
+
+ // PrivateKey contains the contents of an RSA private key or the
+ // contents of a PEM file that contains a private key. The provided
+ // private key is used to sign JWT payloads.
+ // PEM containers with a passphrase are not supported.
+ // Use the following command to convert a PKCS 12 file into a PEM.
+ //
+ // $ openssl pkcs12 -in key.p12 -out key.pem -nodes
+ //
+ PrivateKey []byte
+
+ // PrivateKeyID contains an optional hint indicating which key is being
+ // used.
+ PrivateKeyID string
+
+ // Subject is the optional user to impersonate.
+ Subject string
+
+ // Scopes optionally specifies a list of requested permission scopes.
+ Scopes []string
+
+ // TokenURL is the endpoint required to complete the 2-legged JWT flow.
+ TokenURL string
+
+ // Expires optionally specifies how long the token is valid for.
+ Expires time.Duration
+
+ // Audience optionally specifies the intended audience of the
+ // request. If empty, the value of TokenURL is used as the
+ // intended audience.
+ Audience string
+
+ // PrivateClaims optionally specifies custom private claims in the JWT.
+ // See http://tools.ietf.org/html/draft-jones-json-web-token-10#section-4.3
+ PrivateClaims map[string]interface{}
+
+ // UseIDToken optionally specifies whether ID token should be used instead
+ // of access token when the server returns both.
+ UseIDToken bool
+}
+
+// TokenSource returns a JWT TokenSource using the configuration
+// in c and the HTTP client from the provided context.
+func (c *Config) TokenSource(ctx context.Context) oauth2.TokenSource {
+ return oauth2.ReuseTokenSource(nil, jwtSource{ctx, c})
+}
+
+// Client returns an HTTP client wrapping the context's
+// HTTP transport and adding Authorization headers with tokens
+// obtained from c.
+//
+// The returned client and its Transport should not be modified.
+func (c *Config) Client(ctx context.Context) *http.Client {
+ return oauth2.NewClient(ctx, c.TokenSource(ctx))
+}
+
+// jwtSource is a source that always does a signed JWT request for a token.
+// It should typically be wrapped with a reuseTokenSource.
+type jwtSource struct {
+ ctx context.Context
+ conf *Config
+}
+
+func (js jwtSource) Token() (*oauth2.Token, error) {
+ pk, err := internal.ParseKey(js.conf.PrivateKey)
+ if err != nil {
+ return nil, err
+ }
+ hc := oauth2.NewClient(js.ctx, nil)
+ claimSet := &jws.ClaimSet{
+ Iss: js.conf.Email,
+ Scope: strings.Join(js.conf.Scopes, " "),
+ Aud: js.conf.TokenURL,
+ PrivateClaims: js.conf.PrivateClaims,
+ }
+ if subject := js.conf.Subject; subject != "" {
+ claimSet.Sub = subject
+ // prn is the old name of sub. Keep setting it
+ // to be compatible with legacy OAuth 2.0 providers.
+ claimSet.Prn = subject
+ }
+ if t := js.conf.Expires; t > 0 {
+ claimSet.Exp = time.Now().Add(t).Unix()
+ }
+ if aud := js.conf.Audience; aud != "" {
+ claimSet.Aud = aud
+ }
+ h := *defaultHeader
+ h.KeyID = js.conf.PrivateKeyID
+ payload, err := jws.Encode(&h, claimSet, pk)
+ if err != nil {
+ return nil, err
+ }
+ v := url.Values{}
+ v.Set("grant_type", defaultGrantType)
+ v.Set("assertion", payload)
+ resp, err := hc.PostForm(js.conf.TokenURL, v)
+ if err != nil {
+ return nil, fmt.Errorf("oauth2: cannot fetch token: %v", err)
+ }
+ defer resp.Body.Close()
+ body, err := ioutil.ReadAll(io.LimitReader(resp.Body, 1<<20))
+ if err != nil {
+ return nil, fmt.Errorf("oauth2: cannot fetch token: %v", err)
+ }
+ if c := resp.StatusCode; c < 200 || c > 299 {
+ return nil, &oauth2.RetrieveError{
+ Response: resp,
+ Body: body,
+ }
+ }
+ // tokenRes is the JSON response body.
+ var tokenRes struct {
+ AccessToken string `json:"access_token"`
+ TokenType string `json:"token_type"`
+ IDToken string `json:"id_token"`
+ ExpiresIn int64 `json:"expires_in"` // relative seconds from now
+ }
+ if err := json.Unmarshal(body, &tokenRes); err != nil {
+ return nil, fmt.Errorf("oauth2: cannot fetch token: %v", err)
+ }
+ token := &oauth2.Token{
+ AccessToken: tokenRes.AccessToken,
+ TokenType: tokenRes.TokenType,
+ }
+ raw := make(map[string]interface{})
+ json.Unmarshal(body, &raw) // no error checks for optional fields
+ token = token.WithExtra(raw)
+
+ if secs := tokenRes.ExpiresIn; secs > 0 {
+ token.Expiry = time.Now().Add(time.Duration(secs) * time.Second)
+ }
+ if v := tokenRes.IDToken; v != "" {
+ // decode returned id token to get expiry
+ claimSet, err := jws.Decode(v)
+ if err != nil {
+ return nil, fmt.Errorf("oauth2: error decoding JWT token: %v", err)
+ }
+ token.Expiry = time.Unix(claimSet.Exp, 0)
+ }
+ if js.conf.UseIDToken {
+ if tokenRes.IDToken == "" {
+ return nil, fmt.Errorf("oauth2: response doesn't have JWT token")
+ }
+ token.AccessToken = tokenRes.IDToken
+ }
+ return token, nil
+}
diff --git a/vendor/golang.org/x/oauth2/oauth2.go b/vendor/golang.org/x/oauth2/oauth2.go
index cc7c98c2..90a2c3d6 100644
--- a/vendor/golang.org/x/oauth2/oauth2.go
+++ b/vendor/golang.org/x/oauth2/oauth2.go
@@ -75,8 +75,9 @@ type TokenSource interface {
// Endpoint represents an OAuth 2.0 provider's authorization and token
// endpoint URLs.
type Endpoint struct {
- AuthURL string
- TokenURL string
+ AuthURL string
+ DeviceAuthURL string
+ TokenURL string
// AuthStyle optionally specifies how the endpoint wants the
// client ID & client secret sent. The zero value means to
@@ -143,15 +144,19 @@ func SetAuthURLParam(key, value string) AuthCodeOption {
// AuthCodeURL returns a URL to OAuth 2.0 provider's consent page
// that asks for permissions for the required scopes explicitly.
//
-// State is a token to protect the user from CSRF attacks. You must
-// always provide a non-empty string and validate that it matches the
-// state query parameter on your redirect callback.
-// See http://tools.ietf.org/html/rfc6749#section-10.12 for more info.
+// State is an opaque value used by the client to maintain state between the
+// request and callback. The authorization server includes this value when
+// redirecting the user agent back to the client.
//
// Opts may include AccessTypeOnline or AccessTypeOffline, as well
// as ApprovalForce.
-// It can also be used to pass the PKCE challenge.
-// See https://www.oauth.com/oauth2-servers/pkce/ for more info.
+//
+// To protect against CSRF attacks, opts should include a PKCE challenge
+// (S256ChallengeOption). Not all servers support PKCE. An alternative is to
+// generate a random state parameter and verify it after exchange.
+// See https://datatracker.ietf.org/doc/html/rfc6749#section-10.12 (predating
+// PKCE), https://www.oauth.com/oauth2-servers/pkce/ and
+// https://www.ietf.org/archive/id/draft-ietf-oauth-v2-1-09.html#name-cross-site-request-forgery (describing both approaches)
func (c *Config) AuthCodeURL(state string, opts ...AuthCodeOption) string {
var buf bytes.Buffer
buf.WriteString(c.Endpoint.AuthURL)
@@ -166,7 +171,6 @@ func (c *Config) AuthCodeURL(state string, opts ...AuthCodeOption) string {
v.Set("scope", strings.Join(c.Scopes, " "))
}
if state != "" {
- // TODO(light): Docs say never to omit state; don't allow empty.
v.Set("state", state)
}
for _, opt := range opts {
@@ -211,10 +215,11 @@ func (c *Config) PasswordCredentialsToken(ctx context.Context, username, passwor
// The provided context optionally controls which HTTP client is used. See the HTTPClient variable.
//
// The code will be in the *http.Request.FormValue("code"). Before
-// calling Exchange, be sure to validate FormValue("state").
+// calling Exchange, be sure to validate FormValue("state") if you are
+// using it to protect against CSRF attacks.
//
-// Opts may include the PKCE verifier code if previously used in AuthCodeURL.
-// See https://www.oauth.com/oauth2-servers/pkce/ for more info.
+// If using PKCE to protect against CSRF attacks, opts should include a
+// VerifierOption.
func (c *Config) Exchange(ctx context.Context, code string, opts ...AuthCodeOption) (*Token, error) {
v := url.Values{
"grant_type": {"authorization_code"},
diff --git a/vendor/golang.org/x/oauth2/pkce.go b/vendor/golang.org/x/oauth2/pkce.go
new file mode 100644
index 00000000..50593b6d
--- /dev/null
+++ b/vendor/golang.org/x/oauth2/pkce.go
@@ -0,0 +1,68 @@
+// Copyright 2023 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 oauth2
+
+import (
+ "crypto/rand"
+ "crypto/sha256"
+ "encoding/base64"
+ "net/url"
+)
+
+const (
+ codeChallengeKey = "code_challenge"
+ codeChallengeMethodKey = "code_challenge_method"
+ codeVerifierKey = "code_verifier"
+)
+
+// GenerateVerifier generates a PKCE code verifier with 32 octets of randomness.
+// This follows recommendations in RFC 7636.
+//
+// A fresh verifier should be generated for each authorization.
+// S256ChallengeOption(verifier) should then be passed to Config.AuthCodeURL
+// (or Config.DeviceAccess) and VerifierOption(verifier) to Config.Exchange
+// (or Config.DeviceAccessToken).
+func GenerateVerifier() string {
+ // "RECOMMENDED that the output of a suitable random number generator be
+ // used to create a 32-octet sequence. The octet sequence is then
+ // base64url-encoded to produce a 43-octet URL-safe string to use as the
+ // code verifier."
+ // https://datatracker.ietf.org/doc/html/rfc7636#section-4.1
+ data := make([]byte, 32)
+ if _, err := rand.Read(data); err != nil {
+ panic(err)
+ }
+ return base64.RawURLEncoding.EncodeToString(data)
+}
+
+// VerifierOption returns a PKCE code verifier AuthCodeOption. It should be
+// passed to Config.Exchange or Config.DeviceAccessToken only.
+func VerifierOption(verifier string) AuthCodeOption {
+ return setParam{k: codeVerifierKey, v: verifier}
+}
+
+// S256ChallengeFromVerifier returns a PKCE code challenge derived from verifier with method S256.
+//
+// Prefer to use S256ChallengeOption where possible.
+func S256ChallengeFromVerifier(verifier string) string {
+ sha := sha256.Sum256([]byte(verifier))
+ return base64.RawURLEncoding.EncodeToString(sha[:])
+}
+
+// S256ChallengeOption derives a PKCE code challenge derived from verifier with
+// method S256. It should be passed to Config.AuthCodeURL or Config.DeviceAccess
+// only.
+func S256ChallengeOption(verifier string) AuthCodeOption {
+ return challengeOption{
+ challenge_method: "S256",
+ challenge: S256ChallengeFromVerifier(verifier),
+ }
+}
+
+type challengeOption struct{ challenge_method, challenge string }
+
+func (p challengeOption) setValue(m url.Values) {
+ m.Set(codeChallengeMethodKey, p.challenge_method)
+ m.Set(codeChallengeKey, p.challenge)
+}
diff --git a/vendor/golang.org/x/sys/cpu/asm_aix_ppc64.s b/vendor/golang.org/x/sys/cpu/asm_aix_ppc64.s
new file mode 100644
index 00000000..269e173c
--- /dev/null
+++ b/vendor/golang.org/x/sys/cpu/asm_aix_ppc64.s
@@ -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.
+
+//go:build gc
+
+#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)
diff --git a/vendor/golang.org/x/sys/cpu/byteorder.go b/vendor/golang.org/x/sys/cpu/byteorder.go
new file mode 100644
index 00000000..271055be
--- /dev/null
+++ b/vendor/golang.org/x/sys/cpu/byteorder.go
@@ -0,0 +1,66 @@
+// Copyright 2019 The Go Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style
+// license that can be found in the LICENSE file.
+
+package cpu
+
+import (
+ "runtime"
+)
+
+// byteOrder is a subset of encoding/binary.ByteOrder.
+type byteOrder interface {
+ Uint32([]byte) uint32
+ Uint64([]byte) uint64
+}
+
+type littleEndian struct{}
+type bigEndian struct{}
+
+func (littleEndian) Uint32(b []byte) uint32 {
+ _ = b[3] // bounds check hint to compiler; see golang.org/issue/14808
+ return uint32(b[0]) | uint32(b[1])<<8 | uint32(b[2])<<16 | uint32(b[3])<<24
+}
+
+func (littleEndian) Uint64(b []byte) uint64 {
+ _ = 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
+}
+
+func (bigEndian) Uint32(b []byte) uint32 {
+ _ = b[3] // bounds check hint to compiler; see golang.org/issue/14808
+ return uint32(b[3]) | uint32(b[2])<<8 | uint32(b[1])<<16 | uint32(b[0])<<24
+}
+
+func (bigEndian) Uint64(b []byte) uint64 {
+ _ = 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
+}
+
+// hostByteOrder returns littleEndian on little-endian machines and
+// bigEndian on big-endian machines.
+func hostByteOrder() byteOrder {
+ switch runtime.GOARCH {
+ case "386", "amd64", "amd64p32",
+ "alpha",
+ "arm", "arm64",
+ "loong64",
+ "mipsle", "mips64le", "mips64p32le",
+ "nios2",
+ "ppc64le",
+ "riscv", "riscv64",
+ "sh":
+ return littleEndian{}
+ case "armbe", "arm64be",
+ "m68k",
+ "mips", "mips64", "mips64p32",
+ "ppc", "ppc64",
+ "s390", "s390x",
+ "shbe",
+ "sparc", "sparc64":
+ return bigEndian{}
+ }
+ panic("unknown architecture")
+}
diff --git a/vendor/golang.org/x/sys/cpu/cpu.go b/vendor/golang.org/x/sys/cpu/cpu.go
new file mode 100644
index 00000000..4756ad5f
--- /dev/null
+++ b/vendor/golang.org/x/sys/cpu/cpu.go
@@ -0,0 +1,290 @@
+// Copyright 2018 The Go Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style
+// license that can be found in the LICENSE file.
+
+// Package cpu implements processor feature detection for
+// various CPU architectures.
+package cpu
+
+import (
+ "os"
+ "strings"
+)
+
+// Initialized reports whether the CPU features were initialized.
+//
+// For some GOOS/GOARCH combinations initialization of the CPU features depends
+// on reading an operating specific file, e.g. /proc/self/auxv on linux/arm
+// Initialized will report false if reading the file fails.
+var Initialized bool
+
+// CacheLinePad is used to pad structs to avoid false sharing.
+type CacheLinePad struct{ _ [cacheLineSize]byte }
+
+// X86 contains the supported CPU features of the
+// current X86/AMD64 platform. If the current platform
+// is not X86/AMD64 then all feature flags are false.
+//
+// X86 is padded to avoid false sharing. Further the HasAVX
+// and HasAVX2 are only set if the OS supports XMM and YMM
+// registers in addition to the CPUID feature bit being set.
+var X86 struct {
+ _ CacheLinePad
+ HasAES bool // AES hardware implementation (AES NI)
+ HasADX bool // Multi-precision add-carry instruction extensions
+ HasAVX bool // Advanced vector extension
+ HasAVX2 bool // Advanced vector extension 2
+ HasAVX512 bool // Advanced vector extension 512
+ HasAVX512F bool // Advanced vector extension 512 Foundation Instructions
+ HasAVX512CD bool // Advanced vector extension 512 Conflict Detection Instructions
+ HasAVX512ER bool // Advanced vector extension 512 Exponential and Reciprocal Instructions
+ HasAVX512PF bool // Advanced vector extension 512 Prefetch Instructions
+ HasAVX512VL bool // Advanced vector extension 512 Vector Length Extensions
+ HasAVX512BW bool // Advanced vector extension 512 Byte and Word Instructions
+ HasAVX512DQ bool // Advanced vector extension 512 Doubleword and Quadword Instructions
+ HasAVX512IFMA bool // Advanced vector extension 512 Integer Fused Multiply Add
+ HasAVX512VBMI bool // Advanced vector extension 512 Vector Byte Manipulation Instructions
+ HasAVX5124VNNIW bool // Advanced vector extension 512 Vector Neural Network Instructions Word variable precision
+ HasAVX5124FMAPS bool // Advanced vector extension 512 Fused Multiply Accumulation Packed Single precision
+ HasAVX512VPOPCNTDQ bool // Advanced vector extension 512 Double and quad word population count instructions
+ HasAVX512VPCLMULQDQ bool // Advanced vector extension 512 Vector carry-less multiply operations
+ HasAVX512VNNI bool // Advanced vector extension 512 Vector Neural Network Instructions
+ HasAVX512GFNI bool // Advanced vector extension 512 Galois field New Instructions
+ HasAVX512VAES bool // Advanced vector extension 512 Vector AES instructions
+ HasAVX512VBMI2 bool // Advanced vector extension 512 Vector Byte Manipulation Instructions 2
+ HasAVX512BITALG bool // Advanced vector extension 512 Bit Algorithms
+ HasAVX512BF16 bool // Advanced vector extension 512 BFloat16 Instructions
+ HasAMXTile bool // Advanced Matrix Extension Tile instructions
+ HasAMXInt8 bool // Advanced Matrix Extension Int8 instructions
+ HasAMXBF16 bool // Advanced Matrix Extension BFloat16 instructions
+ HasBMI1 bool // Bit manipulation instruction set 1
+ HasBMI2 bool // Bit manipulation instruction set 2
+ HasCX16 bool // Compare and exchange 16 Bytes
+ HasERMS bool // Enhanced REP for MOVSB and STOSB
+ HasFMA bool // Fused-multiply-add instructions
+ HasOSXSAVE bool // OS supports XSAVE/XRESTOR for saving/restoring XMM registers.
+ 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
+ HasSSE41 bool // Streaming SIMD extension 4 and 4.1
+ 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
+}
+
+// ARM contains the supported CPU features of the current ARM (32-bit) platform.
+// All feature flags are false if:
+// 1. the current platform is not arm, or
+// 2. the current operating system is not Linux.
+var ARM struct {
+ _ CacheLinePad
+ HasSWP bool // SWP instruction support
+ HasHALF bool // Half-word load and store support
+ HasTHUMB bool // ARM Thumb instruction set
+ Has26BIT bool // Address space limited to 26-bits
+ HasFASTMUL bool // 32-bit operand, 64-bit result multiplication support
+ HasFPA bool // Floating point arithmetic support
+ HasVFP bool // Vector floating point support
+ HasEDSP bool // DSP Extensions support
+ HasJAVA bool // Java instruction set
+ HasIWMMXT bool // Intel Wireless MMX technology support
+ HasCRUNCH bool // MaverickCrunch context switching and handling
+ HasTHUMBEE bool // Thumb EE instruction set
+ HasNEON bool // NEON instruction set
+ HasVFPv3 bool // Vector floating point version 3 support
+ HasVFPv3D16 bool // Vector floating point version 3 D8-D15
+ HasTLS bool // Thread local storage support
+ HasVFPv4 bool // Vector floating point version 4 support
+ HasIDIVA bool // Integer divide instruction support in ARM mode
+ HasIDIVT bool // Integer divide instruction support in Thumb mode
+ HasVFPD32 bool // Vector floating point version 3 D15-D31
+ HasLPAE bool // Large Physical Address Extensions
+ 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
+ _ CacheLinePad
+}
+
+// MIPS64X contains the supported CPU features of the current mips64/mips64le
+// platforms. If the current platform is not mips64/mips64le or the current
+// operating system is not Linux then all feature flags are false.
+var MIPS64X struct {
+ _ CacheLinePad
+ HasMSA bool // MIPS SIMD architecture
+ _ 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 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), implies IsPOWER8
+ _ CacheLinePad
+}
+
+// S390X contains the supported CPU features of the current IBM Z
+// (s390x) platform. If the current platform is not IBM Z then all
+// feature flags are false.
+//
+// S390X is padded to avoid false sharing. Further HasVX is only set
+// if the OS supports vector registers in addition to the STFLE
+// feature bit being set.
+var S390X struct {
+ _ CacheLinePad
+ HasZARCH bool // z/Architecture mode is active [mandatory]
+ HasSTFLE bool // store facility list extended
+ HasLDISP bool // long (20-bit) displacements
+ HasEIMM bool // 32-bit immediates
+ HasDFP bool // decimal floating point
+ HasETF3EH bool // ETF-3 enhanced
+ HasMSA bool // message security assist (CPACF)
+ HasAES bool // KM-AES{128,192,256} functions
+ HasAESCBC bool // KMC-AES{128,192,256} functions
+ HasAESCTR bool // KMCTR-AES{128,192,256} functions
+ HasAESGCM bool // KMA-GCM-AES{128,192,256} functions
+ HasGHASH bool // KIMD-GHASH function
+ HasSHA1 bool // K{I,L}MD-SHA-1 functions
+ HasSHA256 bool // K{I,L}MD-SHA-256 functions
+ HasSHA512 bool // K{I,L}MD-SHA-512 functions
+ HasSHA3 bool // K{I,L}MD-SHA3-{224,256,384,512} and K{I,L}MD-SHAKE-{128,256} functions
+ HasVX bool // vector facility
+ HasVXE bool // vector-enhancements facility 1
+ _ CacheLinePad
+}
+
+func init() {
+ archInit()
+ initOptions()
+ processOptions()
+}
+
+// options contains the cpu debug options that can be used in GODEBUG.
+// Options are arch dependent and are added by the arch specific initOptions functions.
+// Features that are mandatory for the specific GOARCH should have the Required field set
+// (e.g. SSE2 on amd64).
+var options []option
+
+// Option names should be lower case. e.g. avx instead of AVX.
+type option struct {
+ Name string
+ Feature *bool
+ Specified bool // whether feature value was specified in GODEBUG
+ Enable bool // whether feature should be enabled
+ Required bool // whether feature is mandatory and can not be disabled
+}
+
+func processOptions() {
+ env := os.Getenv("GODEBUG")
+field:
+ for env != "" {
+ field := ""
+ i := strings.IndexByte(env, ',')
+ if i < 0 {
+ field, env = env, ""
+ } else {
+ field, env = env[:i], env[i+1:]
+ }
+ if len(field) < 4 || field[:4] != "cpu." {
+ continue
+ }
+ i = strings.IndexByte(field, '=')
+ if i < 0 {
+ print("GODEBUG sys/cpu: no value specified for \"", field, "\"\n")
+ continue
+ }
+ key, value := field[4:i], field[i+1:] // e.g. "SSE2", "on"
+
+ var enable bool
+ switch value {
+ case "on":
+ enable = true
+ case "off":
+ enable = false
+ default:
+ print("GODEBUG sys/cpu: value \"", value, "\" not supported for cpu option \"", key, "\"\n")
+ continue field
+ }
+
+ if key == "all" {
+ for i := range options {
+ options[i].Specified = true
+ options[i].Enable = enable || options[i].Required
+ }
+ continue field
+ }
+
+ for i := range options {
+ if options[i].Name == key {
+ options[i].Specified = true
+ options[i].Enable = enable
+ continue field
+ }
+ }
+
+ print("GODEBUG sys/cpu: unknown cpu feature \"", key, "\"\n")
+ }
+
+ for _, o := range options {
+ if !o.Specified {
+ continue
+ }
+
+ if o.Enable && !*o.Feature {
+ print("GODEBUG sys/cpu: can not enable \"", o.Name, "\", missing CPU support\n")
+ continue
+ }
+
+ if !o.Enable && o.Required {
+ print("GODEBUG sys/cpu: can not disable \"", o.Name, "\", required CPU feature\n")
+ continue
+ }
+
+ *o.Feature = o.Enable
+ }
+}
diff --git a/vendor/golang.org/x/sys/cpu/cpu_aix.go b/vendor/golang.org/x/sys/cpu/cpu_aix.go
new file mode 100644
index 00000000..9bf0c32e
--- /dev/null
+++ b/vendor/golang.org/x/sys/cpu/cpu_aix.go
@@ -0,0 +1,33 @@
+// Copyright 2019 The Go Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style
+// license that can be found in the LICENSE file.
+
+//go:build aix
+
+package cpu
+
+const (
+ // getsystemcfg constants
+ _SC_IMPL = 2
+ _IMPL_POWER8 = 0x10000
+ _IMPL_POWER9 = 0x20000
+)
+
+func archInit() {
+ impl := getsystemcfg(_SC_IMPL)
+ if impl&_IMPL_POWER8 != 0 {
+ PPC64.IsPOWER8 = true
+ }
+ if impl&_IMPL_POWER9 != 0 {
+ PPC64.IsPOWER8 = true
+ PPC64.IsPOWER9 = true
+ }
+
+ Initialized = true
+}
+
+func getsystemcfg(label int) (n uint64) {
+ r0, _ := callgetsystemcfg(label)
+ n = uint64(r0)
+ return
+}
diff --git a/vendor/golang.org/x/sys/cpu/cpu_arm.go b/vendor/golang.org/x/sys/cpu/cpu_arm.go
new file mode 100644
index 00000000..301b752e
--- /dev/null
+++ b/vendor/golang.org/x/sys/cpu/cpu_arm.go
@@ -0,0 +1,73 @@
+// Copyright 2018 The Go Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style
+// license that can be found in the LICENSE file.
+
+package cpu
+
+const cacheLineSize = 32
+
+// HWCAP/HWCAP2 bits.
+// These are specific to Linux.
+const (
+ hwcap_SWP = 1 << 0
+ hwcap_HALF = 1 << 1
+ hwcap_THUMB = 1 << 2
+ hwcap_26BIT = 1 << 3
+ hwcap_FAST_MULT = 1 << 4
+ hwcap_FPA = 1 << 5
+ hwcap_VFP = 1 << 6
+ hwcap_EDSP = 1 << 7
+ hwcap_JAVA = 1 << 8
+ hwcap_IWMMXT = 1 << 9
+ hwcap_CRUNCH = 1 << 10
+ hwcap_THUMBEE = 1 << 11
+ hwcap_NEON = 1 << 12
+ hwcap_VFPv3 = 1 << 13
+ hwcap_VFPv3D16 = 1 << 14
+ hwcap_TLS = 1 << 15
+ hwcap_VFPv4 = 1 << 16
+ hwcap_IDIVA = 1 << 17
+ hwcap_IDIVT = 1 << 18
+ hwcap_VFPD32 = 1 << 19
+ hwcap_LPAE = 1 << 20
+ hwcap_EVTSTRM = 1 << 21
+
+ hwcap2_AES = 1 << 0
+ hwcap2_PMULL = 1 << 1
+ hwcap2_SHA1 = 1 << 2
+ hwcap2_SHA2 = 1 << 3
+ hwcap2_CRC32 = 1 << 4
+)
+
+func initOptions() {
+ options = []option{
+ {Name: "pmull", Feature: &ARM.HasPMULL},
+ {Name: "sha1", Feature: &ARM.HasSHA1},
+ {Name: "sha2", Feature: &ARM.HasSHA2},
+ {Name: "swp", Feature: &ARM.HasSWP},
+ {Name: "thumb", Feature: &ARM.HasTHUMB},
+ {Name: "thumbee", Feature: &ARM.HasTHUMBEE},
+ {Name: "tls", Feature: &ARM.HasTLS},
+ {Name: "vfp", Feature: &ARM.HasVFP},
+ {Name: "vfpd32", Feature: &ARM.HasVFPD32},
+ {Name: "vfpv3", Feature: &ARM.HasVFPv3},
+ {Name: "vfpv3d16", Feature: &ARM.HasVFPv3D16},
+ {Name: "vfpv4", Feature: &ARM.HasVFPv4},
+ {Name: "half", Feature: &ARM.HasHALF},
+ {Name: "26bit", Feature: &ARM.Has26BIT},
+ {Name: "fastmul", Feature: &ARM.HasFASTMUL},
+ {Name: "fpa", Feature: &ARM.HasFPA},
+ {Name: "edsp", Feature: &ARM.HasEDSP},
+ {Name: "java", Feature: &ARM.HasJAVA},
+ {Name: "iwmmxt", Feature: &ARM.HasIWMMXT},
+ {Name: "crunch", Feature: &ARM.HasCRUNCH},
+ {Name: "neon", Feature: &ARM.HasNEON},
+ {Name: "idivt", Feature: &ARM.HasIDIVT},
+ {Name: "idiva", Feature: &ARM.HasIDIVA},
+ {Name: "lpae", Feature: &ARM.HasLPAE},
+ {Name: "evtstrm", Feature: &ARM.HasEVTSTRM},
+ {Name: "aes", Feature: &ARM.HasAES},
+ {Name: "crc32", Feature: &ARM.HasCRC32},
+ }
+
+}
diff --git a/vendor/golang.org/x/sys/cpu/cpu_arm64.go b/vendor/golang.org/x/sys/cpu/cpu_arm64.go
new file mode 100644
index 00000000..f3eb993b
--- /dev/null
+++ b/vendor/golang.org/x/sys/cpu/cpu_arm64.go
@@ -0,0 +1,172 @@
+// 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 cpu
+
+import "runtime"
+
+// cacheLineSize is used to prevent false sharing of cache lines.
+// We choose 128 because Apple Silicon, a.k.a. M1, has 128-byte cache line size.
+// It doesn't cost much and is much more future-proof.
+const cacheLineSize = 128
+
+func initOptions() {
+ options = []option{
+ {Name: "fp", Feature: &ARM64.HasFP},
+ {Name: "asimd", Feature: &ARM64.HasASIMD},
+ {Name: "evstrm", Feature: &ARM64.HasEVTSTRM},
+ {Name: "aes", Feature: &ARM64.HasAES},
+ {Name: "fphp", Feature: &ARM64.HasFPHP},
+ {Name: "jscvt", Feature: &ARM64.HasJSCVT},
+ {Name: "lrcpc", Feature: &ARM64.HasLRCPC},
+ {Name: "pmull", Feature: &ARM64.HasPMULL},
+ {Name: "sha1", Feature: &ARM64.HasSHA1},
+ {Name: "sha2", Feature: &ARM64.HasSHA2},
+ {Name: "sha3", Feature: &ARM64.HasSHA3},
+ {Name: "sha512", Feature: &ARM64.HasSHA512},
+ {Name: "sm3", Feature: &ARM64.HasSM3},
+ {Name: "sm4", Feature: &ARM64.HasSM4},
+ {Name: "sve", Feature: &ARM64.HasSVE},
+ {Name: "crc32", Feature: &ARM64.HasCRC32},
+ {Name: "atomics", Feature: &ARM64.HasATOMICS},
+ {Name: "asimdhp", Feature: &ARM64.HasASIMDHP},
+ {Name: "cpuid", Feature: &ARM64.HasCPUID},
+ {Name: "asimrdm", Feature: &ARM64.HasASIMDRDM},
+ {Name: "fcma", Feature: &ARM64.HasFCMA},
+ {Name: "dcpop", Feature: &ARM64.HasDCPOP},
+ {Name: "asimddp", Feature: &ARM64.HasASIMDDP},
+ {Name: "asimdfhm", Feature: &ARM64.HasASIMDFHM},
+ }
+}
+
+func archInit() {
+ switch runtime.GOOS {
+ case "freebsd":
+ readARM64Registers()
+ case "linux", "netbsd", "openbsd":
+ doinit()
+ default:
+ // Many platforms don't seem to allow reading these registers.
+ setMinimalFeatures()
+ }
+}
+
+// setMinimalFeatures fakes the minimal ARM64 features expected by
+// TestARM64minimalFeatures.
+func setMinimalFeatures() {
+ ARM64.HasASIMD = true
+ ARM64.HasFP = true
+}
+
+func readARM64Registers() {
+ Initialized = true
+
+ parseARM64SystemRegisters(getisar0(), getisar1(), getpfr0())
+}
+
+func parseARM64SystemRegisters(isar0, isar1, pfr0 uint64) {
+ // ID_AA64ISAR0_EL1
+ switch extractBits(isar0, 4, 7) {
+ case 1:
+ ARM64.HasAES = true
+ case 2:
+ ARM64.HasAES = true
+ ARM64.HasPMULL = true
+ }
+
+ switch extractBits(isar0, 8, 11) {
+ case 1:
+ ARM64.HasSHA1 = true
+ }
+
+ switch extractBits(isar0, 12, 15) {
+ case 1:
+ ARM64.HasSHA2 = true
+ case 2:
+ ARM64.HasSHA2 = true
+ ARM64.HasSHA512 = true
+ }
+
+ switch extractBits(isar0, 16, 19) {
+ case 1:
+ ARM64.HasCRC32 = true
+ }
+
+ switch extractBits(isar0, 20, 23) {
+ case 2:
+ ARM64.HasATOMICS = true
+ }
+
+ switch extractBits(isar0, 28, 31) {
+ case 1:
+ ARM64.HasASIMDRDM = true
+ }
+
+ switch extractBits(isar0, 32, 35) {
+ case 1:
+ ARM64.HasSHA3 = true
+ }
+
+ switch extractBits(isar0, 36, 39) {
+ case 1:
+ ARM64.HasSM3 = true
+ }
+
+ switch extractBits(isar0, 40, 43) {
+ case 1:
+ ARM64.HasSM4 = true
+ }
+
+ switch extractBits(isar0, 44, 47) {
+ case 1:
+ ARM64.HasASIMDDP = true
+ }
+
+ // ID_AA64ISAR1_EL1
+ switch extractBits(isar1, 0, 3) {
+ case 1:
+ ARM64.HasDCPOP = true
+ }
+
+ switch extractBits(isar1, 12, 15) {
+ case 1:
+ ARM64.HasJSCVT = true
+ }
+
+ switch extractBits(isar1, 16, 19) {
+ case 1:
+ ARM64.HasFCMA = true
+ }
+
+ switch extractBits(isar1, 20, 23) {
+ case 1:
+ ARM64.HasLRCPC = true
+ }
+
+ // ID_AA64PFR0_EL1
+ switch extractBits(pfr0, 16, 19) {
+ case 0:
+ ARM64.HasFP = true
+ case 1:
+ ARM64.HasFP = true
+ ARM64.HasFPHP = true
+ }
+
+ switch extractBits(pfr0, 20, 23) {
+ case 0:
+ ARM64.HasASIMD = true
+ case 1:
+ ARM64.HasASIMD = true
+ ARM64.HasASIMDHP = true
+ }
+
+ switch extractBits(pfr0, 32, 35) {
+ case 1:
+ ARM64.HasSVE = true
+ }
+}
+
+func extractBits(data uint64, start, end uint) uint {
+ return (uint)(data>>start) & ((1 << (end - start + 1)) - 1)
+}
diff --git a/vendor/golang.org/x/sys/cpu/cpu_arm64.s b/vendor/golang.org/x/sys/cpu/cpu_arm64.s
new file mode 100644
index 00000000..fcb9a388
--- /dev/null
+++ b/vendor/golang.org/x/sys/cpu/cpu_arm64.s
@@ -0,0 +1,31 @@
+// 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.
+
+//go:build gc
+
+#include "textflag.h"
+
+// func getisar0() uint64
+TEXT ·getisar0(SB),NOSPLIT,$0-8
+ // get Instruction Set Attributes 0 into x0
+ // mrs x0, ID_AA64ISAR0_EL1 = d5380600
+ WORD $0xd5380600
+ MOVD R0, ret+0(FP)
+ RET
+
+// func getisar1() uint64
+TEXT ·getisar1(SB),NOSPLIT,$0-8
+ // get Instruction Set Attributes 1 into x0
+ // mrs x0, ID_AA64ISAR1_EL1 = d5380620
+ WORD $0xd5380620
+ MOVD R0, ret+0(FP)
+ RET
+
+// func getpfr0() uint64
+TEXT ·getpfr0(SB),NOSPLIT,$0-8
+ // get Processor Feature Register 0 into x0
+ // mrs x0, ID_AA64PFR0_EL1 = d5380400
+ WORD $0xd5380400
+ MOVD R0, ret+0(FP)
+ RET
diff --git a/vendor/golang.org/x/sys/cpu/cpu_gc_arm64.go b/vendor/golang.org/x/sys/cpu/cpu_gc_arm64.go
new file mode 100644
index 00000000..a8acd3e3
--- /dev/null
+++ b/vendor/golang.org/x/sys/cpu/cpu_gc_arm64.go
@@ -0,0 +1,11 @@
+// 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.
+
+//go:build gc
+
+package cpu
+
+func getisar0() uint64
+func getisar1() uint64
+func getpfr0() uint64
diff --git a/vendor/golang.org/x/sys/cpu/cpu_gc_s390x.go b/vendor/golang.org/x/sys/cpu/cpu_gc_s390x.go
new file mode 100644
index 00000000..c8ae6ddc
--- /dev/null
+++ b/vendor/golang.org/x/sys/cpu/cpu_gc_s390x.go
@@ -0,0 +1,21 @@
+// 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.
+
+//go:build gc
+
+package cpu
+
+// haveAsmFunctions reports whether the other functions in this file can
+// be safely called.
+func haveAsmFunctions() bool { return true }
+
+// The following feature detection functions are defined in cpu_s390x.s.
+// They are likely to be expensive to call so the results should be cached.
+func stfle() facilityList
+func kmQuery() queryResult
+func kmcQuery() queryResult
+func kmctrQuery() queryResult
+func kmaQuery() queryResult
+func kimdQuery() queryResult
+func klmdQuery() queryResult
diff --git a/vendor/golang.org/x/sys/cpu/cpu_gc_x86.go b/vendor/golang.org/x/sys/cpu/cpu_gc_x86.go
new file mode 100644
index 00000000..910728fb
--- /dev/null
+++ b/vendor/golang.org/x/sys/cpu/cpu_gc_x86.go
@@ -0,0 +1,15 @@
+// Copyright 2018 The Go Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style
+// license that can be found in the LICENSE file.
+
+//go:build (386 || amd64 || amd64p32) && gc
+
+package cpu
+
+// cpuid is implemented in cpu_x86.s for gc compiler
+// and in cpu_gccgo.c for gccgo.
+func cpuid(eaxArg, ecxArg uint32) (eax, ebx, ecx, edx uint32)
+
+// xgetbv with ecx = 0 is implemented in cpu_x86.s for gc compiler
+// and in cpu_gccgo.c for gccgo.
+func xgetbv() (eax, edx uint32)
diff --git a/vendor/golang.org/x/sys/cpu/cpu_gccgo_arm64.go b/vendor/golang.org/x/sys/cpu/cpu_gccgo_arm64.go
new file mode 100644
index 00000000..7f194678
--- /dev/null
+++ b/vendor/golang.org/x/sys/cpu/cpu_gccgo_arm64.go
@@ -0,0 +1,11 @@
+// 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.
+
+//go:build gccgo
+
+package cpu
+
+func getisar0() uint64 { return 0 }
+func getisar1() uint64 { return 0 }
+func getpfr0() uint64 { return 0 }
diff --git a/vendor/golang.org/x/sys/cpu/cpu_gccgo_s390x.go b/vendor/golang.org/x/sys/cpu/cpu_gccgo_s390x.go
new file mode 100644
index 00000000..9526d2ce
--- /dev/null
+++ b/vendor/golang.org/x/sys/cpu/cpu_gccgo_s390x.go
@@ -0,0 +1,22 @@
+// Copyright 2019 The Go Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style
+// license that can be found in the LICENSE file.
+
+//go:build gccgo
+
+package cpu
+
+// haveAsmFunctions reports whether the other functions in this file can
+// be safely called.
+func haveAsmFunctions() bool { return false }
+
+// TODO(mundaym): the following feature detection functions are currently
+// stubs. See https://golang.org/cl/162887 for how to fix this.
+// They are likely to be expensive to call so the results should be cached.
+func stfle() facilityList { panic("not implemented for gccgo") }
+func kmQuery() queryResult { panic("not implemented for gccgo") }
+func kmcQuery() queryResult { panic("not implemented for gccgo") }
+func kmctrQuery() queryResult { panic("not implemented for gccgo") }
+func kmaQuery() queryResult { panic("not implemented for gccgo") }
+func kimdQuery() queryResult { panic("not implemented for gccgo") }
+func klmdQuery() queryResult { panic("not implemented for gccgo") }
diff --git a/vendor/golang.org/x/sys/cpu/cpu_gccgo_x86.c b/vendor/golang.org/x/sys/cpu/cpu_gccgo_x86.c
new file mode 100644
index 00000000..3f73a05d
--- /dev/null
+++ b/vendor/golang.org/x/sys/cpu/cpu_gccgo_x86.c
@@ -0,0 +1,37 @@
+// Copyright 2018 The Go Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style
+// license that can be found in the LICENSE file.
+
+//go:build (386 || amd64 || amd64p32) && gccgo
+
+#include
+#include
+#include
+
+// Need to wrap __get_cpuid_count because it's declared as static.
+int
+gccgoGetCpuidCount(uint32_t leaf, uint32_t subleaf,
+ uint32_t *eax, uint32_t *ebx,
+ uint32_t *ecx, uint32_t *edx)
+{
+ return __get_cpuid_count(leaf, subleaf, eax, ebx, ecx, edx);
+}
+
+#pragma GCC diagnostic ignored "-Wunknown-pragmas"
+#pragma GCC push_options
+#pragma GCC target("xsave")
+#pragma clang attribute push (__attribute__((target("xsave"))), apply_to=function)
+
+// xgetbv reads the contents of an XCR (Extended Control Register)
+// specified in the ECX register into registers EDX:EAX.
+// Currently, the only supported value for XCR is 0.
+void
+gccgoXgetbv(uint32_t *eax, uint32_t *edx)
+{
+ uint64_t v = _xgetbv(0);
+ *eax = v & 0xffffffff;
+ *edx = v >> 32;
+}
+
+#pragma clang attribute pop
+#pragma GCC pop_options
diff --git a/vendor/golang.org/x/sys/cpu/cpu_gccgo_x86.go b/vendor/golang.org/x/sys/cpu/cpu_gccgo_x86.go
new file mode 100644
index 00000000..99c60fe9
--- /dev/null
+++ b/vendor/golang.org/x/sys/cpu/cpu_gccgo_x86.go
@@ -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.
+
+//go:build (386 || amd64 || amd64p32) && gccgo
+
+package cpu
+
+//extern gccgoGetCpuidCount
+func gccgoGetCpuidCount(eaxArg, ecxArg uint32, eax, ebx, ecx, edx *uint32)
+
+func cpuid(eaxArg, ecxArg uint32) (eax, ebx, ecx, edx uint32) {
+ var a, b, c, d uint32
+ gccgoGetCpuidCount(eaxArg, ecxArg, &a, &b, &c, &d)
+ return a, b, c, d
+}
+
+//extern gccgoXgetbv
+func gccgoXgetbv(eax, edx *uint32)
+
+func xgetbv() (eax, edx uint32) {
+ var a, d uint32
+ gccgoXgetbv(&a, &d)
+ return a, d
+}
+
+// gccgo doesn't build on Darwin, per:
+// https://github.com/Homebrew/homebrew-core/blob/HEAD/Formula/gcc.rb#L76
+func darwinSupportsAVX512() bool {
+ return false
+}
diff --git a/vendor/golang.org/x/sys/cpu/cpu_linux.go b/vendor/golang.org/x/sys/cpu/cpu_linux.go
new file mode 100644
index 00000000..743eb543
--- /dev/null
+++ b/vendor/golang.org/x/sys/cpu/cpu_linux.go
@@ -0,0 +1,15 @@
+// Copyright 2018 The Go Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style
+// license that can be found in the LICENSE file.
+
+//go:build !386 && !amd64 && !amd64p32 && !arm64
+
+package cpu
+
+func archInit() {
+ if err := readHWCAP(); err != nil {
+ return
+ }
+ doinit()
+ Initialized = true
+}
diff --git a/vendor/golang.org/x/sys/cpu/cpu_linux_arm.go b/vendor/golang.org/x/sys/cpu/cpu_linux_arm.go
new file mode 100644
index 00000000..2057006d
--- /dev/null
+++ b/vendor/golang.org/x/sys/cpu/cpu_linux_arm.go
@@ -0,0 +1,39 @@
+// 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 cpu
+
+func doinit() {
+ ARM.HasSWP = isSet(hwCap, hwcap_SWP)
+ ARM.HasHALF = isSet(hwCap, hwcap_HALF)
+ ARM.HasTHUMB = isSet(hwCap, hwcap_THUMB)
+ ARM.Has26BIT = isSet(hwCap, hwcap_26BIT)
+ ARM.HasFASTMUL = isSet(hwCap, hwcap_FAST_MULT)
+ ARM.HasFPA = isSet(hwCap, hwcap_FPA)
+ ARM.HasVFP = isSet(hwCap, hwcap_VFP)
+ ARM.HasEDSP = isSet(hwCap, hwcap_EDSP)
+ ARM.HasJAVA = isSet(hwCap, hwcap_JAVA)
+ ARM.HasIWMMXT = isSet(hwCap, hwcap_IWMMXT)
+ ARM.HasCRUNCH = isSet(hwCap, hwcap_CRUNCH)
+ ARM.HasTHUMBEE = isSet(hwCap, hwcap_THUMBEE)
+ ARM.HasNEON = isSet(hwCap, hwcap_NEON)
+ ARM.HasVFPv3 = isSet(hwCap, hwcap_VFPv3)
+ ARM.HasVFPv3D16 = isSet(hwCap, hwcap_VFPv3D16)
+ ARM.HasTLS = isSet(hwCap, hwcap_TLS)
+ ARM.HasVFPv4 = isSet(hwCap, hwcap_VFPv4)
+ ARM.HasIDIVA = isSet(hwCap, hwcap_IDIVA)
+ ARM.HasIDIVT = isSet(hwCap, hwcap_IDIVT)
+ ARM.HasVFPD32 = isSet(hwCap, hwcap_VFPD32)
+ ARM.HasLPAE = isSet(hwCap, hwcap_LPAE)
+ ARM.HasEVTSTRM = isSet(hwCap, hwcap_EVTSTRM)
+ ARM.HasAES = isSet(hwCap2, hwcap2_AES)
+ ARM.HasPMULL = isSet(hwCap2, hwcap2_PMULL)
+ ARM.HasSHA1 = isSet(hwCap2, hwcap2_SHA1)
+ ARM.HasSHA2 = isSet(hwCap2, hwcap2_SHA2)
+ ARM.HasCRC32 = isSet(hwCap2, hwcap2_CRC32)
+}
+
+func isSet(hwc uint, value uint) bool {
+ return hwc&value != 0
+}
diff --git a/vendor/golang.org/x/sys/cpu/cpu_linux_arm64.go b/vendor/golang.org/x/sys/cpu/cpu_linux_arm64.go
new file mode 100644
index 00000000..a968b80f
--- /dev/null
+++ b/vendor/golang.org/x/sys/cpu/cpu_linux_arm64.go
@@ -0,0 +1,111 @@
+// Copyright 2018 The Go Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style
+// license that can be found in the LICENSE file.
+
+package cpu
+
+import (
+ "strings"
+ "syscall"
+)
+
+// 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
+)
+
+// linuxKernelCanEmulateCPUID reports whether we're running
+// on Linux 4.11+. Ideally we'd like to ask the question about
+// whether the current kernel contains
+// https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=77c97b4ee21290f5f083173d957843b615abbff2
+// but the version number will have to do.
+func linuxKernelCanEmulateCPUID() bool {
+ var un syscall.Utsname
+ syscall.Uname(&un)
+ var sb strings.Builder
+ for _, b := range un.Release[:] {
+ if b == 0 {
+ break
+ }
+ sb.WriteByte(byte(b))
+ }
+ major, minor, _, ok := parseRelease(sb.String())
+ return ok && (major > 4 || major == 4 && minor >= 11)
+}
+
+func doinit() {
+ if err := readHWCAP(); err != nil {
+ // We failed to read /proc/self/auxv. This can happen if the binary has
+ // been given extra capabilities(7) with /bin/setcap.
+ //
+ // When this happens, we have two options. If the Linux kernel is new
+ // enough (4.11+), we can read the arm64 registers directly which'll
+ // trap into the kernel and then return back to userspace.
+ //
+ // But on older kernels, such as Linux 4.4.180 as used on many Synology
+ // devices, calling readARM64Registers (specifically getisar0) will
+ // cause a SIGILL and we'll die. So for older kernels, parse /proc/cpuinfo
+ // instead.
+ //
+ // See golang/go#57336.
+ if linuxKernelCanEmulateCPUID() {
+ readARM64Registers()
+ } else {
+ readLinuxProcCPUInfo()
+ }
+ return
+ }
+
+ // 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
+}
diff --git a/vendor/golang.org/x/sys/cpu/cpu_linux_mips64x.go b/vendor/golang.org/x/sys/cpu/cpu_linux_mips64x.go
new file mode 100644
index 00000000..4686c1d5
--- /dev/null
+++ b/vendor/golang.org/x/sys/cpu/cpu_linux_mips64x.go
@@ -0,0 +1,22 @@
+// Copyright 2020 The Go Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style
+// license that can be found in the LICENSE file.
+
+//go:build linux && (mips64 || mips64le)
+
+package cpu
+
+// HWCAP bits. These are exposed by the Linux kernel 5.4.
+const (
+ // CPU features
+ hwcap_MIPS_MSA = 1 << 1
+)
+
+func doinit() {
+ // HWCAP feature bits
+ MIPS64X.HasMSA = isSet(hwCap, hwcap_MIPS_MSA)
+}
+
+func isSet(hwc uint, value uint) bool {
+ return hwc&value != 0
+}
diff --git a/vendor/golang.org/x/sys/cpu/cpu_linux_noinit.go b/vendor/golang.org/x/sys/cpu/cpu_linux_noinit.go
new file mode 100644
index 00000000..cd63e733
--- /dev/null
+++ b/vendor/golang.org/x/sys/cpu/cpu_linux_noinit.go
@@ -0,0 +1,9 @@
+// Copyright 2019 The Go Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style
+// license that can be found in the LICENSE file.
+
+//go:build linux && !arm && !arm64 && !mips64 && !mips64le && !ppc64 && !ppc64le && !s390x
+
+package cpu
+
+func doinit() {}
diff --git a/vendor/golang.org/x/sys/cpu/cpu_linux_ppc64x.go b/vendor/golang.org/x/sys/cpu/cpu_linux_ppc64x.go
new file mode 100644
index 00000000..197188e6
--- /dev/null
+++ b/vendor/golang.org/x/sys/cpu/cpu_linux_ppc64x.go
@@ -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.
+
+//go:build linux && (ppc64 || ppc64le)
+
+package cpu
+
+// 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
+}
diff --git a/vendor/golang.org/x/sys/cpu/cpu_linux_s390x.go b/vendor/golang.org/x/sys/cpu/cpu_linux_s390x.go
new file mode 100644
index 00000000..1517ac61
--- /dev/null
+++ b/vendor/golang.org/x/sys/cpu/cpu_linux_s390x.go
@@ -0,0 +1,40 @@
+// Copyright 2019 The Go Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style
+// license that can be found in the LICENSE file.
+
+package cpu
+
+const (
+ // bit mask values from /usr/include/bits/hwcap.h
+ hwcap_ZARCH = 2
+ hwcap_STFLE = 4
+ hwcap_MSA = 8
+ hwcap_LDISP = 16
+ hwcap_EIMM = 32
+ hwcap_DFP = 64
+ hwcap_ETF3EH = 256
+ hwcap_VX = 2048
+ hwcap_VXE = 8192
+)
+
+func initS390Xbase() {
+ // test HWCAP bit vector
+ has := func(featureMask uint) bool {
+ return hwCap&featureMask == featureMask
+ }
+
+ // mandatory
+ S390X.HasZARCH = has(hwcap_ZARCH)
+
+ // optional
+ S390X.HasSTFLE = has(hwcap_STFLE)
+ S390X.HasLDISP = has(hwcap_LDISP)
+ S390X.HasEIMM = has(hwcap_EIMM)
+ S390X.HasETF3EH = has(hwcap_ETF3EH)
+ S390X.HasDFP = has(hwcap_DFP)
+ S390X.HasMSA = has(hwcap_MSA)
+ S390X.HasVX = has(hwcap_VX)
+ if S390X.HasVX {
+ S390X.HasVXE = has(hwcap_VXE)
+ }
+}
diff --git a/vendor/golang.org/x/sys/cpu/cpu_loong64.go b/vendor/golang.org/x/sys/cpu/cpu_loong64.go
new file mode 100644
index 00000000..55863585
--- /dev/null
+++ b/vendor/golang.org/x/sys/cpu/cpu_loong64.go
@@ -0,0 +1,12 @@
+// Copyright 2022 The Go Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style
+// license that can be found in the LICENSE file.
+
+//go:build loong64
+
+package cpu
+
+const cacheLineSize = 64
+
+func initOptions() {
+}
diff --git a/vendor/golang.org/x/sys/cpu/cpu_mips64x.go b/vendor/golang.org/x/sys/cpu/cpu_mips64x.go
new file mode 100644
index 00000000..fedb00cc
--- /dev/null
+++ b/vendor/golang.org/x/sys/cpu/cpu_mips64x.go
@@ -0,0 +1,15 @@
+// Copyright 2018 The Go Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style
+// license that can be found in the LICENSE file.
+
+//go:build mips64 || mips64le
+
+package cpu
+
+const cacheLineSize = 32
+
+func initOptions() {
+ options = []option{
+ {Name: "msa", Feature: &MIPS64X.HasMSA},
+ }
+}
diff --git a/vendor/golang.org/x/sys/cpu/cpu_mipsx.go b/vendor/golang.org/x/sys/cpu/cpu_mipsx.go
new file mode 100644
index 00000000..ffb4ec7e
--- /dev/null
+++ b/vendor/golang.org/x/sys/cpu/cpu_mipsx.go
@@ -0,0 +1,11 @@
+// Copyright 2018 The Go Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style
+// license that can be found in the LICENSE file.
+
+//go:build mips || mipsle
+
+package cpu
+
+const cacheLineSize = 32
+
+func initOptions() {}
diff --git a/vendor/golang.org/x/sys/cpu/cpu_netbsd_arm64.go b/vendor/golang.org/x/sys/cpu/cpu_netbsd_arm64.go
new file mode 100644
index 00000000..ebfb3fc8
--- /dev/null
+++ b/vendor/golang.org/x/sys/cpu/cpu_netbsd_arm64.go
@@ -0,0 +1,173 @@
+// Copyright 2020 The Go Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style
+// license that can be found in the LICENSE file.
+
+package cpu
+
+import (
+ "syscall"
+ "unsafe"
+)
+
+// Minimal copy of functionality from x/sys/unix so the cpu package can call
+// sysctl without depending on x/sys/unix.
+
+const (
+ _CTL_QUERY = -2
+
+ _SYSCTL_VERS_1 = 0x1000000
+)
+
+var _zero uintptr
+
+func sysctl(mib []int32, old *byte, oldlen *uintptr, new *byte, newlen uintptr) (err error) {
+ var _p0 unsafe.Pointer
+ if len(mib) > 0 {
+ _p0 = unsafe.Pointer(&mib[0])
+ } else {
+ _p0 = unsafe.Pointer(&_zero)
+ }
+ _, _, errno := syscall.Syscall6(
+ syscall.SYS___SYSCTL,
+ uintptr(_p0),
+ uintptr(len(mib)),
+ uintptr(unsafe.Pointer(old)),
+ uintptr(unsafe.Pointer(oldlen)),
+ uintptr(unsafe.Pointer(new)),
+ uintptr(newlen))
+ if errno != 0 {
+ return errno
+ }
+ return nil
+}
+
+type sysctlNode struct {
+ Flags uint32
+ Num int32
+ Name [32]int8
+ Ver uint32
+ __rsvd uint32
+ Un [16]byte
+ _sysctl_size [8]byte
+ _sysctl_func [8]byte
+ _sysctl_parent [8]byte
+ _sysctl_desc [8]byte
+}
+
+func sysctlNodes(mib []int32) ([]sysctlNode, error) {
+ var olen uintptr
+
+ // Get a list of all sysctl nodes below the given MIB by performing
+ // a sysctl for the given MIB with CTL_QUERY appended.
+ mib = append(mib, _CTL_QUERY)
+ qnode := sysctlNode{Flags: _SYSCTL_VERS_1}
+ qp := (*byte)(unsafe.Pointer(&qnode))
+ sz := unsafe.Sizeof(qnode)
+ if err := sysctl(mib, nil, &olen, qp, sz); err != nil {
+ return nil, err
+ }
+
+ // Now that we know the size, get the actual nodes.
+ nodes := make([]sysctlNode, olen/sz)
+ np := (*byte)(unsafe.Pointer(&nodes[0]))
+ if err := sysctl(mib, np, &olen, qp, sz); err != nil {
+ return nil, err
+ }
+
+ return nodes, nil
+}
+
+func nametomib(name string) ([]int32, error) {
+ // Split name into components.
+ var parts []string
+ last := 0
+ for i := 0; i < len(name); i++ {
+ if name[i] == '.' {
+ parts = append(parts, name[last:i])
+ last = i + 1
+ }
+ }
+ parts = append(parts, name[last:])
+
+ mib := []int32{}
+ // Discover the nodes and construct the MIB OID.
+ for partno, part := range parts {
+ nodes, err := sysctlNodes(mib)
+ if err != nil {
+ return nil, err
+ }
+ for _, node := range nodes {
+ n := make([]byte, 0)
+ for i := range node.Name {
+ if node.Name[i] != 0 {
+ n = append(n, byte(node.Name[i]))
+ }
+ }
+ if string(n) == part {
+ mib = append(mib, int32(node.Num))
+ break
+ }
+ }
+ if len(mib) != partno+1 {
+ return nil, err
+ }
+ }
+
+ return mib, nil
+}
+
+// aarch64SysctlCPUID is struct aarch64_sysctl_cpu_id from NetBSD's
+type aarch64SysctlCPUID struct {
+ midr uint64 /* Main ID Register */
+ revidr uint64 /* Revision ID Register */
+ mpidr uint64 /* Multiprocessor Affinity Register */
+ aa64dfr0 uint64 /* A64 Debug Feature Register 0 */
+ aa64dfr1 uint64 /* A64 Debug Feature Register 1 */
+ aa64isar0 uint64 /* A64 Instruction Set Attribute Register 0 */
+ aa64isar1 uint64 /* A64 Instruction Set Attribute Register 1 */
+ aa64mmfr0 uint64 /* A64 Memory Model Feature Register 0 */
+ aa64mmfr1 uint64 /* A64 Memory Model Feature Register 1 */
+ aa64mmfr2 uint64 /* A64 Memory Model Feature Register 2 */
+ aa64pfr0 uint64 /* A64 Processor Feature Register 0 */
+ aa64pfr1 uint64 /* A64 Processor Feature Register 1 */
+ aa64zfr0 uint64 /* A64 SVE Feature ID Register 0 */
+ mvfr0 uint32 /* Media and VFP Feature Register 0 */
+ mvfr1 uint32 /* Media and VFP Feature Register 1 */
+ mvfr2 uint32 /* Media and VFP Feature Register 2 */
+ pad uint32
+ clidr uint64 /* Cache Level ID Register */
+ ctr uint64 /* Cache Type Register */
+}
+
+func sysctlCPUID(name string) (*aarch64SysctlCPUID, error) {
+ mib, err := nametomib(name)
+ if err != nil {
+ return nil, err
+ }
+
+ out := aarch64SysctlCPUID{}
+ n := unsafe.Sizeof(out)
+ _, _, errno := syscall.Syscall6(
+ syscall.SYS___SYSCTL,
+ uintptr(unsafe.Pointer(&mib[0])),
+ uintptr(len(mib)),
+ uintptr(unsafe.Pointer(&out)),
+ uintptr(unsafe.Pointer(&n)),
+ uintptr(0),
+ uintptr(0))
+ if errno != 0 {
+ return nil, errno
+ }
+ return &out, nil
+}
+
+func doinit() {
+ cpuid, err := sysctlCPUID("machdep.cpu0.cpu_id")
+ if err != nil {
+ setMinimalFeatures()
+ return
+ }
+ parseARM64SystemRegisters(cpuid.aa64isar0, cpuid.aa64isar1, cpuid.aa64pfr0)
+
+ Initialized = true
+}
diff --git a/vendor/golang.org/x/sys/cpu/cpu_openbsd_arm64.go b/vendor/golang.org/x/sys/cpu/cpu_openbsd_arm64.go
new file mode 100644
index 00000000..85b64d5c
--- /dev/null
+++ b/vendor/golang.org/x/sys/cpu/cpu_openbsd_arm64.go
@@ -0,0 +1,65 @@
+// Copyright 2022 The Go Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style
+// license that can be found in the LICENSE file.
+
+package cpu
+
+import (
+ "syscall"
+ "unsafe"
+)
+
+// Minimal copy of functionality from x/sys/unix so the cpu package can call
+// sysctl without depending on x/sys/unix.
+
+const (
+ // From OpenBSD's sys/sysctl.h.
+ _CTL_MACHDEP = 7
+
+ // From OpenBSD's machine/cpu.h.
+ _CPU_ID_AA64ISAR0 = 2
+ _CPU_ID_AA64ISAR1 = 3
+)
+
+// Implemented in the runtime package (runtime/sys_openbsd3.go)
+func syscall_syscall6(fn, a1, a2, a3, a4, a5, a6 uintptr) (r1, r2 uintptr, err syscall.Errno)
+
+//go:linkname syscall_syscall6 syscall.syscall6
+
+func sysctl(mib []uint32, old *byte, oldlen *uintptr, new *byte, newlen uintptr) (err error) {
+ _, _, errno := syscall_syscall6(libc_sysctl_trampoline_addr, uintptr(unsafe.Pointer(&mib[0])), uintptr(len(mib)), uintptr(unsafe.Pointer(old)), uintptr(unsafe.Pointer(oldlen)), uintptr(unsafe.Pointer(new)), uintptr(newlen))
+ if errno != 0 {
+ return errno
+ }
+ return nil
+}
+
+var libc_sysctl_trampoline_addr uintptr
+
+//go:cgo_import_dynamic libc_sysctl sysctl "libc.so"
+
+func sysctlUint64(mib []uint32) (uint64, bool) {
+ var out uint64
+ nout := unsafe.Sizeof(out)
+ if err := sysctl(mib, (*byte)(unsafe.Pointer(&out)), &nout, nil, 0); err != nil {
+ return 0, false
+ }
+ return out, true
+}
+
+func doinit() {
+ setMinimalFeatures()
+
+ // Get ID_AA64ISAR0 and ID_AA64ISAR1 from sysctl.
+ isar0, ok := sysctlUint64([]uint32{_CTL_MACHDEP, _CPU_ID_AA64ISAR0})
+ if !ok {
+ return
+ }
+ isar1, ok := sysctlUint64([]uint32{_CTL_MACHDEP, _CPU_ID_AA64ISAR1})
+ if !ok {
+ return
+ }
+ parseARM64SystemRegisters(isar0, isar1, 0)
+
+ Initialized = true
+}
diff --git a/vendor/golang.org/x/sys/cpu/cpu_openbsd_arm64.s b/vendor/golang.org/x/sys/cpu/cpu_openbsd_arm64.s
new file mode 100644
index 00000000..054ba05d
--- /dev/null
+++ b/vendor/golang.org/x/sys/cpu/cpu_openbsd_arm64.s
@@ -0,0 +1,11 @@
+// Copyright 2022 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.
+
+#include "textflag.h"
+
+TEXT libc_sysctl_trampoline<>(SB),NOSPLIT,$0-0
+ JMP libc_sysctl(SB)
+
+GLOBL ·libc_sysctl_trampoline_addr(SB), RODATA, $8
+DATA ·libc_sysctl_trampoline_addr(SB)/8, $libc_sysctl_trampoline<>(SB)
diff --git a/vendor/golang.org/x/sys/cpu/cpu_other_arm.go b/vendor/golang.org/x/sys/cpu/cpu_other_arm.go
new file mode 100644
index 00000000..e9ecf2a4
--- /dev/null
+++ b/vendor/golang.org/x/sys/cpu/cpu_other_arm.go
@@ -0,0 +1,9 @@
+// Copyright 2020 The Go Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style
+// license that can be found in the LICENSE file.
+
+//go:build !linux && arm
+
+package cpu
+
+func archInit() {}
diff --git a/vendor/golang.org/x/sys/cpu/cpu_other_arm64.go b/vendor/golang.org/x/sys/cpu/cpu_other_arm64.go
new file mode 100644
index 00000000..5341e7f8
--- /dev/null
+++ b/vendor/golang.org/x/sys/cpu/cpu_other_arm64.go
@@ -0,0 +1,9 @@
+// Copyright 2019 The Go Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style
+// license that can be found in the LICENSE file.
+
+//go:build !linux && !netbsd && !openbsd && arm64
+
+package cpu
+
+func doinit() {}
diff --git a/vendor/golang.org/x/sys/cpu/cpu_other_mips64x.go b/vendor/golang.org/x/sys/cpu/cpu_other_mips64x.go
new file mode 100644
index 00000000..5f8f2419
--- /dev/null
+++ b/vendor/golang.org/x/sys/cpu/cpu_other_mips64x.go
@@ -0,0 +1,11 @@
+// Copyright 2020 The Go Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style
+// license that can be found in the LICENSE file.
+
+//go:build !linux && (mips64 || mips64le)
+
+package cpu
+
+func archInit() {
+ Initialized = true
+}
diff --git a/vendor/golang.org/x/sys/cpu/cpu_other_ppc64x.go b/vendor/golang.org/x/sys/cpu/cpu_other_ppc64x.go
new file mode 100644
index 00000000..89608fba
--- /dev/null
+++ b/vendor/golang.org/x/sys/cpu/cpu_other_ppc64x.go
@@ -0,0 +1,12 @@
+// Copyright 2022 The Go Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style
+// license that can be found in the LICENSE file.
+
+//go:build !aix && !linux && (ppc64 || ppc64le)
+
+package cpu
+
+func archInit() {
+ PPC64.IsPOWER8 = true
+ Initialized = true
+}
diff --git a/vendor/golang.org/x/sys/cpu/cpu_other_riscv64.go b/vendor/golang.org/x/sys/cpu/cpu_other_riscv64.go
new file mode 100644
index 00000000..5ab87808
--- /dev/null
+++ b/vendor/golang.org/x/sys/cpu/cpu_other_riscv64.go
@@ -0,0 +1,11 @@
+// Copyright 2022 The Go Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style
+// license that can be found in the LICENSE file.
+
+//go:build !linux && riscv64
+
+package cpu
+
+func archInit() {
+ Initialized = true
+}
diff --git a/vendor/golang.org/x/sys/cpu/cpu_ppc64x.go b/vendor/golang.org/x/sys/cpu/cpu_ppc64x.go
new file mode 100644
index 00000000..c14f12b1
--- /dev/null
+++ b/vendor/golang.org/x/sys/cpu/cpu_ppc64x.go
@@ -0,0 +1,16 @@
+// Copyright 2020 The Go Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style
+// license that can be found in the LICENSE file.
+
+//go:build ppc64 || ppc64le
+
+package cpu
+
+const cacheLineSize = 128
+
+func initOptions() {
+ options = []option{
+ {Name: "darn", Feature: &PPC64.HasDARN},
+ {Name: "scv", Feature: &PPC64.HasSCV},
+ }
+}
diff --git a/vendor/golang.org/x/sys/cpu/cpu_riscv64.go b/vendor/golang.org/x/sys/cpu/cpu_riscv64.go
new file mode 100644
index 00000000..7f0c79c0
--- /dev/null
+++ b/vendor/golang.org/x/sys/cpu/cpu_riscv64.go
@@ -0,0 +1,11 @@
+// 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.
+
+//go:build riscv64
+
+package cpu
+
+const cacheLineSize = 64
+
+func initOptions() {}
diff --git a/vendor/golang.org/x/sys/cpu/cpu_s390x.go b/vendor/golang.org/x/sys/cpu/cpu_s390x.go
new file mode 100644
index 00000000..5881b883
--- /dev/null
+++ b/vendor/golang.org/x/sys/cpu/cpu_s390x.go
@@ -0,0 +1,172 @@
+// Copyright 2020 The Go Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style
+// license that can be found in the LICENSE file.
+
+package cpu
+
+const cacheLineSize = 256
+
+func initOptions() {
+ options = []option{
+ {Name: "zarch", Feature: &S390X.HasZARCH, Required: true},
+ {Name: "stfle", Feature: &S390X.HasSTFLE, Required: true},
+ {Name: "ldisp", Feature: &S390X.HasLDISP, Required: true},
+ {Name: "eimm", Feature: &S390X.HasEIMM, Required: true},
+ {Name: "dfp", Feature: &S390X.HasDFP},
+ {Name: "etf3eh", Feature: &S390X.HasETF3EH},
+ {Name: "msa", Feature: &S390X.HasMSA},
+ {Name: "aes", Feature: &S390X.HasAES},
+ {Name: "aescbc", Feature: &S390X.HasAESCBC},
+ {Name: "aesctr", Feature: &S390X.HasAESCTR},
+ {Name: "aesgcm", Feature: &S390X.HasAESGCM},
+ {Name: "ghash", Feature: &S390X.HasGHASH},
+ {Name: "sha1", Feature: &S390X.HasSHA1},
+ {Name: "sha256", Feature: &S390X.HasSHA256},
+ {Name: "sha3", Feature: &S390X.HasSHA3},
+ {Name: "sha512", Feature: &S390X.HasSHA512},
+ {Name: "vx", Feature: &S390X.HasVX},
+ {Name: "vxe", Feature: &S390X.HasVXE},
+ }
+}
+
+// bitIsSet reports whether the bit at index is set. The bit index
+// is in big endian order, so bit index 0 is the leftmost bit.
+func bitIsSet(bits []uint64, index uint) bool {
+ return bits[index/64]&((1<<63)>>(index%64)) != 0
+}
+
+// facility is a bit index for the named facility.
+type facility uint8
+
+const (
+ // mandatory facilities
+ zarch facility = 1 // z architecture mode is active
+ stflef facility = 7 // store-facility-list-extended
+ ldisp facility = 18 // long-displacement
+ eimm facility = 21 // extended-immediate
+
+ // miscellaneous facilities
+ dfp facility = 42 // decimal-floating-point
+ etf3eh facility = 30 // extended-translation 3 enhancement
+
+ // cryptography facilities
+ msa facility = 17 // message-security-assist
+ msa3 facility = 76 // message-security-assist extension 3
+ msa4 facility = 77 // message-security-assist extension 4
+ msa5 facility = 57 // message-security-assist extension 5
+ msa8 facility = 146 // message-security-assist extension 8
+ msa9 facility = 155 // message-security-assist extension 9
+
+ // vector facilities
+ vx facility = 129 // vector facility
+ vxe facility = 135 // vector-enhancements 1
+ vxe2 facility = 148 // vector-enhancements 2
+)
+
+// facilityList contains the result of an STFLE call.
+// Bits are numbered in big endian order so the
+// leftmost bit (the MSB) is at index 0.
+type facilityList struct {
+ bits [4]uint64
+}
+
+// Has reports whether the given facilities are present.
+func (s *facilityList) Has(fs ...facility) bool {
+ if len(fs) == 0 {
+ panic("no facility bits provided")
+ }
+ for _, f := range fs {
+ if !bitIsSet(s.bits[:], uint(f)) {
+ return false
+ }
+ }
+ return true
+}
+
+// function is the code for the named cryptographic function.
+type function uint8
+
+const (
+ // KM{,A,C,CTR} function codes
+ aes128 function = 18 // AES-128
+ aes192 function = 19 // AES-192
+ aes256 function = 20 // AES-256
+
+ // K{I,L}MD function codes
+ sha1 function = 1 // SHA-1
+ sha256 function = 2 // SHA-256
+ sha512 function = 3 // SHA-512
+ sha3_224 function = 32 // SHA3-224
+ sha3_256 function = 33 // SHA3-256
+ sha3_384 function = 34 // SHA3-384
+ sha3_512 function = 35 // SHA3-512
+ shake128 function = 36 // SHAKE-128
+ shake256 function = 37 // SHAKE-256
+
+ // KLMD function codes
+ ghash function = 65 // GHASH
+)
+
+// queryResult contains the result of a Query function
+// call. Bits are numbered in big endian order so the
+// leftmost bit (the MSB) is at index 0.
+type queryResult struct {
+ bits [2]uint64
+}
+
+// Has reports whether the given functions are present.
+func (q *queryResult) Has(fns ...function) bool {
+ if len(fns) == 0 {
+ panic("no function codes provided")
+ }
+ for _, f := range fns {
+ if !bitIsSet(q.bits[:], uint(f)) {
+ return false
+ }
+ }
+ return true
+}
+
+func doinit() {
+ initS390Xbase()
+
+ // We need implementations of stfle, km and so on
+ // to detect cryptographic features.
+ if !haveAsmFunctions() {
+ return
+ }
+
+ // optional cryptographic functions
+ if S390X.HasMSA {
+ aes := []function{aes128, aes192, aes256}
+
+ // cipher message
+ km, kmc := kmQuery(), kmcQuery()
+ S390X.HasAES = km.Has(aes...)
+ S390X.HasAESCBC = kmc.Has(aes...)
+ if S390X.HasSTFLE {
+ facilities := stfle()
+ if facilities.Has(msa4) {
+ kmctr := kmctrQuery()
+ S390X.HasAESCTR = kmctr.Has(aes...)
+ }
+ if facilities.Has(msa8) {
+ kma := kmaQuery()
+ S390X.HasAESGCM = kma.Has(aes...)
+ }
+ }
+
+ // compute message digest
+ kimd := kimdQuery() // intermediate (no padding)
+ klmd := klmdQuery() // last (padding)
+ S390X.HasSHA1 = kimd.Has(sha1) && klmd.Has(sha1)
+ S390X.HasSHA256 = kimd.Has(sha256) && klmd.Has(sha256)
+ S390X.HasSHA512 = kimd.Has(sha512) && klmd.Has(sha512)
+ S390X.HasGHASH = kimd.Has(ghash) // KLMD-GHASH does not exist
+ sha3 := []function{
+ sha3_224, sha3_256, sha3_384, sha3_512,
+ shake128, shake256,
+ }
+ S390X.HasSHA3 = kimd.Has(sha3...) && klmd.Has(sha3...)
+ }
+}
diff --git a/vendor/golang.org/x/sys/cpu/cpu_s390x.s b/vendor/golang.org/x/sys/cpu/cpu_s390x.s
new file mode 100644
index 00000000..1fb4b701
--- /dev/null
+++ b/vendor/golang.org/x/sys/cpu/cpu_s390x.s
@@ -0,0 +1,57 @@
+// Copyright 2019 The Go Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style
+// license that can be found in the LICENSE file.
+
+//go:build gc
+
+#include "textflag.h"
+
+// func stfle() facilityList
+TEXT ·stfle(SB), NOSPLIT|NOFRAME, $0-32
+ MOVD $ret+0(FP), R1
+ MOVD $3, R0 // last doubleword index to store
+ XC $32, (R1), (R1) // clear 4 doublewords (32 bytes)
+ WORD $0xb2b01000 // store facility list extended (STFLE)
+ RET
+
+// func kmQuery() queryResult
+TEXT ·kmQuery(SB), NOSPLIT|NOFRAME, $0-16
+ MOVD $0, R0 // set function code to 0 (KM-Query)
+ MOVD $ret+0(FP), R1 // address of 16-byte return value
+ WORD $0xB92E0024 // cipher message (KM)
+ RET
+
+// func kmcQuery() queryResult
+TEXT ·kmcQuery(SB), NOSPLIT|NOFRAME, $0-16
+ MOVD $0, R0 // set function code to 0 (KMC-Query)
+ MOVD $ret+0(FP), R1 // address of 16-byte return value
+ WORD $0xB92F0024 // cipher message with chaining (KMC)
+ RET
+
+// func kmctrQuery() queryResult
+TEXT ·kmctrQuery(SB), NOSPLIT|NOFRAME, $0-16
+ MOVD $0, R0 // set function code to 0 (KMCTR-Query)
+ MOVD $ret+0(FP), R1 // address of 16-byte return value
+ WORD $0xB92D4024 // cipher message with counter (KMCTR)
+ RET
+
+// func kmaQuery() queryResult
+TEXT ·kmaQuery(SB), NOSPLIT|NOFRAME, $0-16
+ MOVD $0, R0 // set function code to 0 (KMA-Query)
+ MOVD $ret+0(FP), R1 // address of 16-byte return value
+ WORD $0xb9296024 // cipher message with authentication (KMA)
+ RET
+
+// func kimdQuery() queryResult
+TEXT ·kimdQuery(SB), NOSPLIT|NOFRAME, $0-16
+ MOVD $0, R0 // set function code to 0 (KIMD-Query)
+ MOVD $ret+0(FP), R1 // address of 16-byte return value
+ WORD $0xB93E0024 // compute intermediate message digest (KIMD)
+ RET
+
+// func klmdQuery() queryResult
+TEXT ·klmdQuery(SB), NOSPLIT|NOFRAME, $0-16
+ MOVD $0, R0 // set function code to 0 (KLMD-Query)
+ MOVD $ret+0(FP), R1 // address of 16-byte return value
+ WORD $0xB93F0024 // compute last message digest (KLMD)
+ RET
diff --git a/vendor/golang.org/x/sys/cpu/cpu_wasm.go b/vendor/golang.org/x/sys/cpu/cpu_wasm.go
new file mode 100644
index 00000000..384787ea
--- /dev/null
+++ b/vendor/golang.org/x/sys/cpu/cpu_wasm.go
@@ -0,0 +1,17 @@
+// 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.
+
+//go:build wasm
+
+package cpu
+
+// We're compiling the cpu package for an unknown (software-abstracted) CPU.
+// Make CacheLinePad an empty struct and hope that the usual struct alignment
+// rules are good enough.
+
+const cacheLineSize = 0
+
+func initOptions() {}
+
+func archInit() {}
diff --git a/vendor/golang.org/x/sys/cpu/cpu_x86.go b/vendor/golang.org/x/sys/cpu/cpu_x86.go
new file mode 100644
index 00000000..c29f5e4c
--- /dev/null
+++ b/vendor/golang.org/x/sys/cpu/cpu_x86.go
@@ -0,0 +1,151 @@
+// Copyright 2018 The Go Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style
+// license that can be found in the LICENSE file.
+
+//go:build 386 || amd64 || amd64p32
+
+package cpu
+
+import "runtime"
+
+const cacheLineSize = 64
+
+func initOptions() {
+ options = []option{
+ {Name: "adx", Feature: &X86.HasADX},
+ {Name: "aes", Feature: &X86.HasAES},
+ {Name: "avx", Feature: &X86.HasAVX},
+ {Name: "avx2", Feature: &X86.HasAVX2},
+ {Name: "avx512", Feature: &X86.HasAVX512},
+ {Name: "avx512f", Feature: &X86.HasAVX512F},
+ {Name: "avx512cd", Feature: &X86.HasAVX512CD},
+ {Name: "avx512er", Feature: &X86.HasAVX512ER},
+ {Name: "avx512pf", Feature: &X86.HasAVX512PF},
+ {Name: "avx512vl", Feature: &X86.HasAVX512VL},
+ {Name: "avx512bw", Feature: &X86.HasAVX512BW},
+ {Name: "avx512dq", Feature: &X86.HasAVX512DQ},
+ {Name: "avx512ifma", Feature: &X86.HasAVX512IFMA},
+ {Name: "avx512vbmi", Feature: &X86.HasAVX512VBMI},
+ {Name: "avx512vnniw", Feature: &X86.HasAVX5124VNNIW},
+ {Name: "avx5124fmaps", Feature: &X86.HasAVX5124FMAPS},
+ {Name: "avx512vpopcntdq", Feature: &X86.HasAVX512VPOPCNTDQ},
+ {Name: "avx512vpclmulqdq", Feature: &X86.HasAVX512VPCLMULQDQ},
+ {Name: "avx512vnni", Feature: &X86.HasAVX512VNNI},
+ {Name: "avx512gfni", Feature: &X86.HasAVX512GFNI},
+ {Name: "avx512vaes", Feature: &X86.HasAVX512VAES},
+ {Name: "avx512vbmi2", Feature: &X86.HasAVX512VBMI2},
+ {Name: "avx512bitalg", Feature: &X86.HasAVX512BITALG},
+ {Name: "avx512bf16", Feature: &X86.HasAVX512BF16},
+ {Name: "amxtile", Feature: &X86.HasAMXTile},
+ {Name: "amxint8", Feature: &X86.HasAMXInt8},
+ {Name: "amxbf16", Feature: &X86.HasAMXBF16},
+ {Name: "bmi1", Feature: &X86.HasBMI1},
+ {Name: "bmi2", Feature: &X86.HasBMI2},
+ {Name: "cx16", Feature: &X86.HasCX16},
+ {Name: "erms", Feature: &X86.HasERMS},
+ {Name: "fma", Feature: &X86.HasFMA},
+ {Name: "osxsave", Feature: &X86.HasOSXSAVE},
+ {Name: "pclmulqdq", Feature: &X86.HasPCLMULQDQ},
+ {Name: "popcnt", Feature: &X86.HasPOPCNT},
+ {Name: "rdrand", Feature: &X86.HasRDRAND},
+ {Name: "rdseed", Feature: &X86.HasRDSEED},
+ {Name: "sse3", Feature: &X86.HasSSE3},
+ {Name: "sse41", Feature: &X86.HasSSE41},
+ {Name: "sse42", Feature: &X86.HasSSE42},
+ {Name: "ssse3", Feature: &X86.HasSSSE3},
+
+ // These capabilities should always be enabled on amd64:
+ {Name: "sse2", Feature: &X86.HasSSE2, Required: runtime.GOARCH == "amd64"},
+ }
+}
+
+func archInit() {
+
+ Initialized = true
+
+ maxID, _, _, _ := cpuid(0, 0)
+
+ if maxID < 1 {
+ return
+ }
+
+ _, _, ecx1, edx1 := cpuid(1, 0)
+ X86.HasSSE2 = isSet(26, edx1)
+
+ X86.HasSSE3 = isSet(0, ecx1)
+ X86.HasPCLMULQDQ = isSet(1, ecx1)
+ X86.HasSSSE3 = isSet(9, ecx1)
+ X86.HasFMA = isSet(12, ecx1)
+ X86.HasCX16 = isSet(13, ecx1)
+ X86.HasSSE41 = isSet(19, ecx1)
+ X86.HasSSE42 = isSet(20, ecx1)
+ X86.HasPOPCNT = isSet(23, ecx1)
+ X86.HasAES = isSet(25, ecx1)
+ X86.HasOSXSAVE = isSet(27, ecx1)
+ X86.HasRDRAND = isSet(30, ecx1)
+
+ var osSupportsAVX, osSupportsAVX512 bool
+ // For XGETBV, OSXSAVE bit is required and sufficient.
+ if X86.HasOSXSAVE {
+ eax, _ := xgetbv()
+ // Check if XMM and YMM registers have OS support.
+ osSupportsAVX = isSet(1, eax) && isSet(2, eax)
+
+ if runtime.GOOS == "darwin" {
+ // Darwin doesn't save/restore AVX-512 mask registers correctly across signal handlers.
+ // Since users can't rely on mask register contents, let's not advertise AVX-512 support.
+ // See issue 49233.
+ osSupportsAVX512 = false
+ } else {
+ // Check if OPMASK and ZMM registers have OS support.
+ osSupportsAVX512 = osSupportsAVX && isSet(5, eax) && isSet(6, eax) && isSet(7, eax)
+ }
+ }
+
+ X86.HasAVX = isSet(28, ecx1) && osSupportsAVX
+
+ if maxID < 7 {
+ return
+ }
+
+ _, ebx7, ecx7, edx7 := cpuid(7, 0)
+ X86.HasBMI1 = isSet(3, ebx7)
+ 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)
+
+ X86.HasAVX512 = isSet(16, ebx7) && osSupportsAVX512 // Because avx-512 foundation is the core required extension
+ if X86.HasAVX512 {
+ X86.HasAVX512F = true
+ X86.HasAVX512CD = isSet(28, ebx7)
+ X86.HasAVX512ER = isSet(27, ebx7)
+ X86.HasAVX512PF = isSet(26, ebx7)
+ X86.HasAVX512VL = isSet(31, ebx7)
+ X86.HasAVX512BW = isSet(30, ebx7)
+ X86.HasAVX512DQ = isSet(17, ebx7)
+ X86.HasAVX512IFMA = isSet(21, ebx7)
+ X86.HasAVX512VBMI = isSet(1, ecx7)
+ X86.HasAVX5124VNNIW = isSet(2, edx7)
+ X86.HasAVX5124FMAPS = isSet(3, edx7)
+ X86.HasAVX512VPOPCNTDQ = isSet(14, ecx7)
+ X86.HasAVX512VPCLMULQDQ = isSet(10, ecx7)
+ X86.HasAVX512VNNI = isSet(11, ecx7)
+ X86.HasAVX512GFNI = isSet(8, ecx7)
+ X86.HasAVX512VAES = isSet(9, ecx7)
+ X86.HasAVX512VBMI2 = isSet(6, ecx7)
+ X86.HasAVX512BITALG = isSet(12, ecx7)
+
+ eax71, _, _, _ := cpuid(7, 1)
+ X86.HasAVX512BF16 = isSet(5, eax71)
+ }
+
+ X86.HasAMXTile = isSet(24, edx7)
+ X86.HasAMXInt8 = isSet(25, edx7)
+ X86.HasAMXBF16 = isSet(22, edx7)
+}
+
+func isSet(bitpos uint, value uint32) bool {
+ return value&(1<> 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 readHWCAP() error {
+ // For Go 1.21+, get auxv from the Go runtime.
+ if a := getAuxv(); len(a) > 0 {
+ for len(a) >= 2 {
+ tag, val := a[0], uint(a[1])
+ a = a[2:]
+ switch tag {
+ case _AT_HWCAP:
+ hwCap = val
+ case _AT_HWCAP2:
+ hwCap2 = val
+ }
+ }
+ return nil
+ }
+
+ buf, err := os.ReadFile(procAuxv)
+ if err != nil {
+ // e.g. on android /proc/self/auxv is not accessible, so silently
+ // ignore the error and leave Initialized = false. On some
+ // architectures (e.g. arm64) doinit() implements a fallback
+ // readout and will set Initialized = true again.
+ return err
+ }
+ bo := hostByteOrder()
+ for len(buf) >= 2*(uintSize/8) {
+ var tag, val uint
+ switch uintSize {
+ case 32:
+ tag = uint(bo.Uint32(buf[0:]))
+ val = uint(bo.Uint32(buf[4:]))
+ buf = buf[8:]
+ case 64:
+ tag = uint(bo.Uint64(buf[0:]))
+ val = uint(bo.Uint64(buf[8:]))
+ buf = buf[16:]
+ }
+ switch tag {
+ case _AT_HWCAP:
+ hwCap = val
+ case _AT_HWCAP2:
+ hwCap2 = val
+ }
+ }
+ return nil
+}
diff --git a/vendor/golang.org/x/sys/cpu/parse.go b/vendor/golang.org/x/sys/cpu/parse.go
new file mode 100644
index 00000000..762b63d6
--- /dev/null
+++ b/vendor/golang.org/x/sys/cpu/parse.go
@@ -0,0 +1,43 @@
+// Copyright 2022 The Go Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style
+// license that can be found in the LICENSE file.
+
+package cpu
+
+import "strconv"
+
+// parseRelease parses a dot-separated version number. It follows the semver
+// syntax, but allows the minor and patch versions to be elided.
+//
+// This is a copy of the Go runtime's parseRelease from
+// https://golang.org/cl/209597.
+func parseRelease(rel string) (major, minor, patch int, ok bool) {
+ // Strip anything after a dash or plus.
+ for i := 0; i < len(rel); i++ {
+ if rel[i] == '-' || rel[i] == '+' {
+ rel = rel[:i]
+ break
+ }
+ }
+
+ next := func() (int, bool) {
+ for i := 0; i < len(rel); i++ {
+ if rel[i] == '.' {
+ ver, err := strconv.Atoi(rel[:i])
+ rel = rel[i+1:]
+ return ver, err == nil
+ }
+ }
+ ver, err := strconv.Atoi(rel)
+ rel = ""
+ return ver, err == nil
+ }
+ if major, ok = next(); !ok || rel == "" {
+ return
+ }
+ if minor, ok = next(); !ok || rel == "" {
+ return
+ }
+ patch, ok = next()
+ return
+}
diff --git a/vendor/golang.org/x/sys/cpu/proc_cpuinfo_linux.go b/vendor/golang.org/x/sys/cpu/proc_cpuinfo_linux.go
new file mode 100644
index 00000000..4cd64c70
--- /dev/null
+++ b/vendor/golang.org/x/sys/cpu/proc_cpuinfo_linux.go
@@ -0,0 +1,53 @@
+// Copyright 2022 The Go Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style
+// license that can be found in the LICENSE file.
+
+//go:build linux && arm64
+
+package cpu
+
+import (
+ "errors"
+ "io"
+ "os"
+ "strings"
+)
+
+func readLinuxProcCPUInfo() error {
+ f, err := os.Open("/proc/cpuinfo")
+ if err != nil {
+ return err
+ }
+ defer f.Close()
+
+ var buf [1 << 10]byte // enough for first CPU
+ n, err := io.ReadFull(f, buf[:])
+ if err != nil && err != io.ErrUnexpectedEOF {
+ return err
+ }
+ in := string(buf[:n])
+ const features = "\nFeatures : "
+ i := strings.Index(in, features)
+ if i == -1 {
+ return errors.New("no CPU features found")
+ }
+ in = in[i+len(features):]
+ if i := strings.Index(in, "\n"); i != -1 {
+ in = in[:i]
+ }
+ m := map[string]*bool{}
+
+ initOptions() // need it early here; it's harmless to call twice
+ for _, o := range options {
+ m[o.Name] = o.Feature
+ }
+ // The EVTSTRM field has alias "evstrm" in Go, but Linux calls it "evtstrm".
+ m["evtstrm"] = &ARM64.HasEVTSTRM
+
+ for _, f := range strings.Fields(in) {
+ if p, ok := m[f]; ok {
+ *p = true
+ }
+ }
+ return nil
+}
diff --git a/vendor/golang.org/x/sys/cpu/runtime_auxv.go b/vendor/golang.org/x/sys/cpu/runtime_auxv.go
new file mode 100644
index 00000000..5f92ac9a
--- /dev/null
+++ b/vendor/golang.org/x/sys/cpu/runtime_auxv.go
@@ -0,0 +1,16 @@
+// Copyright 2023 The Go Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style
+// license that can be found in the LICENSE file.
+
+package cpu
+
+// getAuxvFn is non-nil on Go 1.21+ (via runtime_auxv_go121.go init)
+// on platforms that use auxv.
+var getAuxvFn func() []uintptr
+
+func getAuxv() []uintptr {
+ if getAuxvFn == nil {
+ return nil
+ }
+ return getAuxvFn()
+}
diff --git a/vendor/golang.org/x/sys/cpu/runtime_auxv_go121.go b/vendor/golang.org/x/sys/cpu/runtime_auxv_go121.go
new file mode 100644
index 00000000..4c9788ea
--- /dev/null
+++ b/vendor/golang.org/x/sys/cpu/runtime_auxv_go121.go
@@ -0,0 +1,18 @@
+// Copyright 2023 The Go Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style
+// license that can be found in the LICENSE file.
+
+//go:build go1.21
+
+package cpu
+
+import (
+ _ "unsafe" // for linkname
+)
+
+//go:linkname runtime_getAuxv runtime.getAuxv
+func runtime_getAuxv() []uintptr
+
+func init() {
+ getAuxvFn = runtime_getAuxv
+}
diff --git a/vendor/golang.org/x/sys/cpu/syscall_aix_gccgo.go b/vendor/golang.org/x/sys/cpu/syscall_aix_gccgo.go
new file mode 100644
index 00000000..1b9ccb09
--- /dev/null
+++ b/vendor/golang.org/x/sys/cpu/syscall_aix_gccgo.go
@@ -0,0 +1,26 @@
+// Copyright 2020 The Go Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style
+// license that can be found in the LICENSE file.
+
+// Recreate a getsystemcfg syscall handler instead of
+// using the one provided by x/sys/unix to avoid having
+// the dependency between them. (See golang.org/issue/32102)
+// Moreover, this file will be used during the building of
+// gccgo's libgo and thus must not used a CGo method.
+
+//go:build aix && gccgo
+
+package cpu
+
+import (
+ "syscall"
+)
+
+//extern getsystemcfg
+func gccgoGetsystemcfg(label uint32) (r uint64)
+
+func callgetsystemcfg(label int) (r1 uintptr, e1 syscall.Errno) {
+ r1 = uintptr(gccgoGetsystemcfg(uint32(label)))
+ e1 = syscall.GetErrno()
+ return
+}
diff --git a/vendor/golang.org/x/sys/cpu/syscall_aix_ppc64_gc.go b/vendor/golang.org/x/sys/cpu/syscall_aix_ppc64_gc.go
new file mode 100644
index 00000000..e8b6cdbe
--- /dev/null
+++ b/vendor/golang.org/x/sys/cpu/syscall_aix_ppc64_gc.go
@@ -0,0 +1,35 @@
+// 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.
+
+// Minimal copy of x/sys/unix so the cpu package can make a
+// system call on AIX without depending on x/sys/unix.
+// (See golang.org/issue/32102)
+
+//go:build aix && ppc64 && gc
+
+package cpu
+
+import (
+ "syscall"
+ "unsafe"
+)
+
+//go:cgo_import_dynamic libc_getsystemcfg getsystemcfg "libc.a/shr_64.o"
+
+//go:linkname libc_getsystemcfg libc_getsystemcfg
+
+type syscallFunc uintptr
+
+var libc_getsystemcfg syscallFunc
+
+type errno = syscall.Errno
+
+// Implemented in runtime/syscall_aix.go.
+func rawSyscall6(trap, nargs, a1, a2, a3, a4, a5, a6 uintptr) (r1, r2 uintptr, err errno)
+func syscall6(trap, nargs, a1, a2, a3, a4, a5, a6 uintptr) (r1, r2 uintptr, err errno)
+
+func callgetsystemcfg(label int) (r1 uintptr, e1 errno) {
+ r1, _, e1 = syscall6(uintptr(unsafe.Pointer(&libc_getsystemcfg)), 1, uintptr(label), 0, 0, 0, 0, 0)
+ return
+}
diff --git a/vendor/golang.org/x/sys/internal/unsafeheader/unsafeheader.go b/vendor/golang.org/x/sys/internal/unsafeheader/unsafeheader.go
deleted file mode 100644
index e07899b9..00000000
--- a/vendor/golang.org/x/sys/internal/unsafeheader/unsafeheader.go
+++ /dev/null
@@ -1,30 +0,0 @@
-// Copyright 2020 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-// Package unsafeheader contains header declarations for the Go runtime's
-// slice and string implementations.
-//
-// This package allows x/sys to use types equivalent to
-// reflect.SliceHeader and reflect.StringHeader without introducing
-// a dependency on the (relatively heavy) "reflect" package.
-package unsafeheader
-
-import (
- "unsafe"
-)
-
-// Slice is the runtime representation of a slice.
-// It cannot be used safely or portably and its representation may change in a later release.
-type Slice struct {
- Data unsafe.Pointer
- Len int
- Cap int
-}
-
-// String is the runtime representation of a string.
-// It cannot be used safely or portably and its representation may change in a later release.
-type String struct {
- Data unsafe.Pointer
- Len int
-}
diff --git a/vendor/golang.org/x/sys/plan9/asm.s b/vendor/golang.org/x/sys/plan9/asm.s
deleted file mode 100644
index 06449ebf..00000000
--- a/vendor/golang.org/x/sys/plan9/asm.s
+++ /dev/null
@@ -1,8 +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.
-
-#include "textflag.h"
-
-TEXT ·use(SB),NOSPLIT,$0
- RET
diff --git a/vendor/golang.org/x/sys/plan9/asm_plan9_386.s b/vendor/golang.org/x/sys/plan9/asm_plan9_386.s
deleted file mode 100644
index bc5cab1f..00000000
--- a/vendor/golang.org/x/sys/plan9/asm_plan9_386.s
+++ /dev/null
@@ -1,30 +0,0 @@
-// Copyright 2009 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-#include "textflag.h"
-
-//
-// System call support for 386, Plan 9
-//
-
-// Just jump to package syscall's implementation for all these functions.
-// The runtime may know about them.
-
-TEXT ·Syscall(SB),NOSPLIT,$0-32
- JMP syscall·Syscall(SB)
-
-TEXT ·Syscall6(SB),NOSPLIT,$0-44
- JMP syscall·Syscall6(SB)
-
-TEXT ·RawSyscall(SB),NOSPLIT,$0-28
- JMP syscall·RawSyscall(SB)
-
-TEXT ·RawSyscall6(SB),NOSPLIT,$0-40
- JMP syscall·RawSyscall6(SB)
-
-TEXT ·seek(SB),NOSPLIT,$0-36
- JMP syscall·seek(SB)
-
-TEXT ·exit(SB),NOSPLIT,$4-4
- JMP syscall·exit(SB)
diff --git a/vendor/golang.org/x/sys/plan9/asm_plan9_amd64.s b/vendor/golang.org/x/sys/plan9/asm_plan9_amd64.s
deleted file mode 100644
index d3448e67..00000000
--- a/vendor/golang.org/x/sys/plan9/asm_plan9_amd64.s
+++ /dev/null
@@ -1,30 +0,0 @@
-// Copyright 2009 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-#include "textflag.h"
-
-//
-// System call support for amd64, Plan 9
-//
-
-// Just jump to package syscall's implementation for all these functions.
-// The runtime may know about them.
-
-TEXT ·Syscall(SB),NOSPLIT,$0-64
- JMP syscall·Syscall(SB)
-
-TEXT ·Syscall6(SB),NOSPLIT,$0-88
- JMP syscall·Syscall6(SB)
-
-TEXT ·RawSyscall(SB),NOSPLIT,$0-56
- JMP syscall·RawSyscall(SB)
-
-TEXT ·RawSyscall6(SB),NOSPLIT,$0-80
- JMP syscall·RawSyscall6(SB)
-
-TEXT ·seek(SB),NOSPLIT,$0-56
- JMP syscall·seek(SB)
-
-TEXT ·exit(SB),NOSPLIT,$8-8
- JMP syscall·exit(SB)
diff --git a/vendor/golang.org/x/sys/plan9/asm_plan9_arm.s b/vendor/golang.org/x/sys/plan9/asm_plan9_arm.s
deleted file mode 100644
index afb7c0a9..00000000
--- a/vendor/golang.org/x/sys/plan9/asm_plan9_arm.s
+++ /dev/null
@@ -1,25 +0,0 @@
-// Copyright 2009 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-#include "textflag.h"
-
-// System call support for plan9 on arm
-
-// Just jump to package syscall's implementation for all these functions.
-// The runtime may know about them.
-
-TEXT ·Syscall(SB),NOSPLIT,$0-32
- JMP syscall·Syscall(SB)
-
-TEXT ·Syscall6(SB),NOSPLIT,$0-44
- JMP syscall·Syscall6(SB)
-
-TEXT ·RawSyscall(SB),NOSPLIT,$0-28
- JMP syscall·RawSyscall(SB)
-
-TEXT ·RawSyscall6(SB),NOSPLIT,$0-40
- JMP syscall·RawSyscall6(SB)
-
-TEXT ·seek(SB),NOSPLIT,$0-36
- JMP syscall·exit(SB)
diff --git a/vendor/golang.org/x/sys/plan9/const_plan9.go b/vendor/golang.org/x/sys/plan9/const_plan9.go
deleted file mode 100644
index b4e85a3a..00000000
--- a/vendor/golang.org/x/sys/plan9/const_plan9.go
+++ /dev/null
@@ -1,70 +0,0 @@
-package plan9
-
-// Plan 9 Constants
-
-// Open modes
-const (
- O_RDONLY = 0
- O_WRONLY = 1
- O_RDWR = 2
- O_TRUNC = 16
- O_CLOEXEC = 32
- O_EXCL = 0x1000
-)
-
-// Rfork flags
-const (
- RFNAMEG = 1 << 0
- RFENVG = 1 << 1
- RFFDG = 1 << 2
- RFNOTEG = 1 << 3
- RFPROC = 1 << 4
- RFMEM = 1 << 5
- RFNOWAIT = 1 << 6
- RFCNAMEG = 1 << 10
- RFCENVG = 1 << 11
- RFCFDG = 1 << 12
- RFREND = 1 << 13
- RFNOMNT = 1 << 14
-)
-
-// Qid.Type bits
-const (
- QTDIR = 0x80
- QTAPPEND = 0x40
- QTEXCL = 0x20
- QTMOUNT = 0x10
- QTAUTH = 0x08
- QTTMP = 0x04
- QTFILE = 0x00
-)
-
-// Dir.Mode bits
-const (
- DMDIR = 0x80000000
- DMAPPEND = 0x40000000
- DMEXCL = 0x20000000
- DMMOUNT = 0x10000000
- DMAUTH = 0x08000000
- DMTMP = 0x04000000
- DMREAD = 0x4
- DMWRITE = 0x2
- DMEXEC = 0x1
-)
-
-const (
- STATMAX = 65535
- ERRMAX = 128
- STATFIXLEN = 49
-)
-
-// Mount and bind flags
-const (
- MREPL = 0x0000
- MBEFORE = 0x0001
- MAFTER = 0x0002
- MORDER = 0x0003
- MCREATE = 0x0004
- MCACHE = 0x0010
- MMASK = 0x0017
-)
diff --git a/vendor/golang.org/x/sys/plan9/dir_plan9.go b/vendor/golang.org/x/sys/plan9/dir_plan9.go
deleted file mode 100644
index 0955e0c5..00000000
--- a/vendor/golang.org/x/sys/plan9/dir_plan9.go
+++ /dev/null
@@ -1,212 +0,0 @@
-// Copyright 2012 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-// Plan 9 directory marshalling. See intro(5).
-
-package plan9
-
-import "errors"
-
-var (
- ErrShortStat = errors.New("stat buffer too short")
- ErrBadStat = errors.New("malformed stat buffer")
- ErrBadName = errors.New("bad character in file name")
-)
-
-// A Qid represents a 9P server's unique identification for a file.
-type Qid struct {
- Path uint64 // the file server's unique identification for the file
- Vers uint32 // version number for given Path
- Type uint8 // the type of the file (plan9.QTDIR for example)
-}
-
-// A Dir contains the metadata for a file.
-type Dir struct {
- // system-modified data
- Type uint16 // server type
- Dev uint32 // server subtype
-
- // file data
- Qid Qid // unique id from server
- Mode uint32 // permissions
- Atime uint32 // last read time
- Mtime uint32 // last write time
- Length int64 // file length
- Name string // last element of path
- Uid string // owner name
- Gid string // group name
- Muid string // last modifier name
-}
-
-var nullDir = Dir{
- Type: ^uint16(0),
- Dev: ^uint32(0),
- Qid: Qid{
- Path: ^uint64(0),
- Vers: ^uint32(0),
- Type: ^uint8(0),
- },
- Mode: ^uint32(0),
- Atime: ^uint32(0),
- Mtime: ^uint32(0),
- Length: ^int64(0),
-}
-
-// Null assigns special "don't touch" values to members of d to
-// avoid modifying them during plan9.Wstat.
-func (d *Dir) Null() { *d = nullDir }
-
-// Marshal encodes a 9P stat message corresponding to d into b
-//
-// If there isn't enough space in b for a stat message, ErrShortStat is returned.
-func (d *Dir) Marshal(b []byte) (n int, err error) {
- n = STATFIXLEN + len(d.Name) + len(d.Uid) + len(d.Gid) + len(d.Muid)
- if n > len(b) {
- return n, ErrShortStat
- }
-
- for _, c := range d.Name {
- if c == '/' {
- return n, ErrBadName
- }
- }
-
- b = pbit16(b, uint16(n)-2)
- b = pbit16(b, d.Type)
- b = pbit32(b, d.Dev)
- b = pbit8(b, d.Qid.Type)
- b = pbit32(b, d.Qid.Vers)
- b = pbit64(b, d.Qid.Path)
- b = pbit32(b, d.Mode)
- b = pbit32(b, d.Atime)
- b = pbit32(b, d.Mtime)
- b = pbit64(b, uint64(d.Length))
- b = pstring(b, d.Name)
- b = pstring(b, d.Uid)
- b = pstring(b, d.Gid)
- b = pstring(b, d.Muid)
-
- return n, nil
-}
-
-// UnmarshalDir decodes a single 9P stat message from b and returns the resulting Dir.
-//
-// If b is too small to hold a valid stat message, ErrShortStat is returned.
-//
-// If the stat message itself is invalid, ErrBadStat is returned.
-func UnmarshalDir(b []byte) (*Dir, error) {
- if len(b) < STATFIXLEN {
- return nil, ErrShortStat
- }
- size, buf := gbit16(b)
- if len(b) != int(size)+2 {
- return nil, ErrBadStat
- }
- b = buf
-
- var d Dir
- d.Type, b = gbit16(b)
- d.Dev, b = gbit32(b)
- d.Qid.Type, b = gbit8(b)
- d.Qid.Vers, b = gbit32(b)
- d.Qid.Path, b = gbit64(b)
- d.Mode, b = gbit32(b)
- d.Atime, b = gbit32(b)
- d.Mtime, b = gbit32(b)
-
- n, b := gbit64(b)
- d.Length = int64(n)
-
- var ok bool
- if d.Name, b, ok = gstring(b); !ok {
- return nil, ErrBadStat
- }
- if d.Uid, b, ok = gstring(b); !ok {
- return nil, ErrBadStat
- }
- if d.Gid, b, ok = gstring(b); !ok {
- return nil, ErrBadStat
- }
- if d.Muid, b, ok = gstring(b); !ok {
- return nil, ErrBadStat
- }
-
- return &d, nil
-}
-
-// pbit8 copies the 8-bit number v to b and returns the remaining slice of b.
-func pbit8(b []byte, v uint8) []byte {
- b[0] = byte(v)
- return b[1:]
-}
-
-// pbit16 copies the 16-bit number v to b in little-endian order and returns the remaining slice of b.
-func pbit16(b []byte, v uint16) []byte {
- b[0] = byte(v)
- b[1] = byte(v >> 8)
- return b[2:]
-}
-
-// pbit32 copies the 32-bit number v to b in little-endian order and returns the remaining slice of b.
-func pbit32(b []byte, v uint32) []byte {
- b[0] = byte(v)
- b[1] = byte(v >> 8)
- b[2] = byte(v >> 16)
- b[3] = byte(v >> 24)
- return b[4:]
-}
-
-// pbit64 copies the 64-bit number v to b in little-endian order and returns the remaining slice of b.
-func pbit64(b []byte, v uint64) []byte {
- b[0] = byte(v)
- b[1] = byte(v >> 8)
- b[2] = byte(v >> 16)
- b[3] = byte(v >> 24)
- b[4] = byte(v >> 32)
- b[5] = byte(v >> 40)
- b[6] = byte(v >> 48)
- b[7] = byte(v >> 56)
- return b[8:]
-}
-
-// pstring copies the string s to b, prepending it with a 16-bit length in little-endian order, and
-// returning the remaining slice of b..
-func pstring(b []byte, s string) []byte {
- b = pbit16(b, uint16(len(s)))
- n := copy(b, s)
- return b[n:]
-}
-
-// gbit8 reads an 8-bit number from b and returns it with the remaining slice of b.
-func gbit8(b []byte) (uint8, []byte) {
- return uint8(b[0]), b[1:]
-}
-
-// gbit16 reads a 16-bit number in little-endian order from b and returns it with the remaining slice of b.
-func gbit16(b []byte) (uint16, []byte) {
- return uint16(b[0]) | uint16(b[1])<<8, b[2:]
-}
-
-// gbit32 reads a 32-bit number in little-endian order from b and returns it with the remaining slice of b.
-func gbit32(b []byte) (uint32, []byte) {
- return uint32(b[0]) | uint32(b[1])<<8 | uint32(b[2])<<16 | uint32(b[3])<<24, b[4:]
-}
-
-// gbit64 reads a 64-bit number in little-endian order from b and returns it with the remaining slice of b.
-func gbit64(b []byte) (uint64, []byte) {
- lo := uint32(b[0]) | uint32(b[1])<<8 | uint32(b[2])<<16 | uint32(b[3])<<24
- hi := uint32(b[4]) | uint32(b[5])<<8 | uint32(b[6])<<16 | uint32(b[7])<<24
- return uint64(lo) | uint64(hi)<<32, b[8:]
-}
-
-// gstring reads a string from b, prefixed with a 16-bit length in little-endian order.
-// It returns the string with the remaining slice of b and a boolean. If the length is
-// greater than the number of bytes in b, the boolean will be false.
-func gstring(b []byte) (string, []byte, bool) {
- n, b := gbit16(b)
- if int(n) > len(b) {
- return "", b, false
- }
- return string(b[:n]), b[n:], true
-}
diff --git a/vendor/golang.org/x/sys/plan9/env_plan9.go b/vendor/golang.org/x/sys/plan9/env_plan9.go
deleted file mode 100644
index 8f191800..00000000
--- a/vendor/golang.org/x/sys/plan9/env_plan9.go
+++ /dev/null
@@ -1,31 +0,0 @@
-// Copyright 2011 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-// Plan 9 environment variables.
-
-package plan9
-
-import (
- "syscall"
-)
-
-func Getenv(key string) (value string, found bool) {
- return syscall.Getenv(key)
-}
-
-func Setenv(key, value string) error {
- return syscall.Setenv(key, value)
-}
-
-func Clearenv() {
- syscall.Clearenv()
-}
-
-func Environ() []string {
- return syscall.Environ()
-}
-
-func Unsetenv(key string) error {
- return syscall.Unsetenv(key)
-}
diff --git a/vendor/golang.org/x/sys/plan9/errors_plan9.go b/vendor/golang.org/x/sys/plan9/errors_plan9.go
deleted file mode 100644
index 65fe74d3..00000000
--- a/vendor/golang.org/x/sys/plan9/errors_plan9.go
+++ /dev/null
@@ -1,50 +0,0 @@
-// Copyright 2011 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-package plan9
-
-import "syscall"
-
-// Constants
-const (
- // Invented values to support what package os expects.
- O_CREAT = 0x02000
- O_APPEND = 0x00400
- O_NOCTTY = 0x00000
- O_NONBLOCK = 0x00000
- O_SYNC = 0x00000
- O_ASYNC = 0x00000
-
- S_IFMT = 0x1f000
- S_IFIFO = 0x1000
- S_IFCHR = 0x2000
- S_IFDIR = 0x4000
- S_IFBLK = 0x6000
- S_IFREG = 0x8000
- S_IFLNK = 0xa000
- S_IFSOCK = 0xc000
-)
-
-// Errors
-var (
- EINVAL = syscall.NewError("bad arg in system call")
- ENOTDIR = syscall.NewError("not a directory")
- EISDIR = syscall.NewError("file is a directory")
- ENOENT = syscall.NewError("file does not exist")
- EEXIST = syscall.NewError("file already exists")
- EMFILE = syscall.NewError("no free file descriptors")
- EIO = syscall.NewError("i/o error")
- ENAMETOOLONG = syscall.NewError("file name too long")
- EINTR = syscall.NewError("interrupted")
- EPERM = syscall.NewError("permission denied")
- EBUSY = syscall.NewError("no free devices")
- ETIMEDOUT = syscall.NewError("connection timed out")
- EPLAN9 = syscall.NewError("not supported by plan 9")
-
- // The following errors do not correspond to any
- // Plan 9 system messages. Invented to support
- // what package os and others expect.
- EACCES = syscall.NewError("access permission denied")
- EAFNOSUPPORT = syscall.NewError("address family not supported by protocol")
-)
diff --git a/vendor/golang.org/x/sys/plan9/mkall.sh b/vendor/golang.org/x/sys/plan9/mkall.sh
deleted file mode 100644
index 1650fbcc..00000000
--- a/vendor/golang.org/x/sys/plan9/mkall.sh
+++ /dev/null
@@ -1,150 +0,0 @@
-#!/usr/bin/env bash
-# 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.
-
-# The plan9 package provides access to the raw system call
-# interface of the underlying operating system. Porting Go to
-# a new architecture/operating system combination requires
-# some manual effort, though there are tools that automate
-# much of the process. The auto-generated files have names
-# beginning with z.
-#
-# This script runs or (given -n) prints suggested commands to generate z files
-# for the current system. Running those commands is not automatic.
-# This script is documentation more than anything else.
-#
-# * asm_${GOOS}_${GOARCH}.s
-#
-# This hand-written assembly file implements system call dispatch.
-# There are three entry points:
-#
-# func Syscall(trap, a1, a2, a3 uintptr) (r1, r2, err uintptr);
-# func Syscall6(trap, a1, a2, a3, a4, a5, a6 uintptr) (r1, r2, err uintptr);
-# func RawSyscall(trap, a1, a2, a3 uintptr) (r1, r2, err uintptr);
-#
-# The first and second are the standard ones; they differ only in
-# how many arguments can be passed to the kernel.
-# The third is for low-level use by the ForkExec wrapper;
-# unlike the first two, it does not call into the scheduler to
-# let it know that a system call is running.
-#
-# * syscall_${GOOS}.go
-#
-# This hand-written Go file implements system calls that need
-# special handling and lists "//sys" comments giving prototypes
-# for ones that can be auto-generated. Mksyscall reads those
-# comments to generate the stubs.
-#
-# * syscall_${GOOS}_${GOARCH}.go
-#
-# Same as syscall_${GOOS}.go except that it contains code specific
-# to ${GOOS} on one particular architecture.
-#
-# * types_${GOOS}.c
-#
-# This hand-written C file includes standard C headers and then
-# creates typedef or enum names beginning with a dollar sign
-# (use of $ in variable names is a gcc extension). The hardest
-# part about preparing this file is figuring out which headers to
-# include and which symbols need to be #defined to get the
-# actual data structures that pass through to the kernel system calls.
-# Some C libraries present alternate versions for binary compatibility
-# and translate them on the way in and out of system calls, but
-# there is almost always a #define that can get the real ones.
-# See types_darwin.c and types_linux.c for examples.
-#
-# * zerror_${GOOS}_${GOARCH}.go
-#
-# This machine-generated file defines the system's error numbers,
-# error strings, and signal numbers. The generator is "mkerrors.sh".
-# Usually no arguments are needed, but mkerrors.sh will pass its
-# arguments on to godefs.
-#
-# * zsyscall_${GOOS}_${GOARCH}.go
-#
-# Generated by mksyscall.pl; see syscall_${GOOS}.go above.
-#
-# * zsysnum_${GOOS}_${GOARCH}.go
-#
-# Generated by mksysnum_${GOOS}.
-#
-# * ztypes_${GOOS}_${GOARCH}.go
-#
-# Generated by godefs; see types_${GOOS}.c above.
-
-GOOSARCH="${GOOS}_${GOARCH}"
-
-# defaults
-mksyscall="go run mksyscall.go"
-mkerrors="./mkerrors.sh"
-zerrors="zerrors_$GOOSARCH.go"
-mksysctl=""
-zsysctl="zsysctl_$GOOSARCH.go"
-mksysnum=
-mktypes=
-run="sh"
-
-case "$1" in
--syscalls)
- for i in zsyscall*go
- do
- sed 1q $i | sed 's;^// ;;' | sh > _$i && gofmt < _$i > $i
- rm _$i
- done
- exit 0
- ;;
--n)
- run="cat"
- shift
-esac
-
-case "$#" in
-0)
- ;;
-*)
- echo 'usage: mkall.sh [-n]' 1>&2
- exit 2
-esac
-
-case "$GOOSARCH" in
-_* | *_ | _)
- echo 'undefined $GOOS_$GOARCH:' "$GOOSARCH" 1>&2
- exit 1
- ;;
-plan9_386)
- mkerrors=
- mksyscall="go run mksyscall.go -l32 -plan9 -tags plan9,386"
- mksysnum="./mksysnum_plan9.sh /n/sources/plan9/sys/src/libc/9syscall/sys.h"
- mktypes="XXX"
- ;;
-plan9_amd64)
- mkerrors=
- mksyscall="go run mksyscall.go -l32 -plan9 -tags plan9,amd64"
- mksysnum="./mksysnum_plan9.sh /n/sources/plan9/sys/src/libc/9syscall/sys.h"
- mktypes="XXX"
- ;;
-plan9_arm)
- mkerrors=
- mksyscall="go run mksyscall.go -l32 -plan9 -tags plan9,arm"
- mksysnum="./mksysnum_plan9.sh /n/sources/plan9/sys/src/libc/9syscall/sys.h"
- mktypes="XXX"
- ;;
-*)
- echo 'unrecognized $GOOS_$GOARCH: ' "$GOOSARCH" 1>&2
- exit 1
- ;;
-esac
-
-(
- if [ -n "$mkerrors" ]; then echo "$mkerrors |gofmt >$zerrors"; fi
- case "$GOOS" in
- plan9)
- syscall_goos="syscall_$GOOS.go"
- if [ -n "$mksyscall" ]; then echo "$mksyscall $syscall_goos |gofmt >zsyscall_$GOOSARCH.go"; 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 |gofmt >ztypes_$GOOSARCH.go"; fi
-) | $run
diff --git a/vendor/golang.org/x/sys/plan9/mkerrors.sh b/vendor/golang.org/x/sys/plan9/mkerrors.sh
deleted file mode 100644
index 526d04ab..00000000
--- a/vendor/golang.org/x/sys/plan9/mkerrors.sh
+++ /dev/null
@@ -1,246 +0,0 @@
-#!/usr/bin/env bash
-# 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 Go code listing errors and other #defined constant
-# values (ENAMETOOLONG etc.), by asking the preprocessor
-# about the definitions.
-
-unset LANG
-export LC_ALL=C
-export LC_CTYPE=C
-
-CC=${CC:-gcc}
-
-uname=$(uname)
-
-includes='
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-'
-
-ccflags="$@"
-
-# Write go tool cgo -godefs input.
-(
- echo package plan9
- echo
- echo '/*'
- indirect="includes_$(uname)"
- echo "${!indirect} $includes"
- echo '*/'
- echo 'import "C"'
- echo
- echo 'const ('
-
- # The gcc command line prints all the #defines
- # it encounters while processing the input
- echo "${!indirect} $includes" | $CC -x c - -E -dM $ccflags |
- awk '
- $1 != "#define" || $2 ~ /\(/ || $3 == "" {next}
-
- $2 ~ /^E([ABCD]X|[BIS]P|[SD]I|S|FL)$/ {next} # 386 registers
- $2 ~ /^(SIGEV_|SIGSTKSZ|SIGRT(MIN|MAX))/ {next}
- $2 ~ /^(SCM_SRCRT)$/ {next}
- $2 ~ /^(MAP_FAILED)$/ {next}
-
- $2 !~ /^ETH_/ &&
- $2 !~ /^EPROC_/ &&
- $2 !~ /^EQUIV_/ &&
- $2 !~ /^EXPR_/ &&
- $2 ~ /^E[A-Z0-9_]+$/ ||
- $2 ~ /^B[0-9_]+$/ ||
- $2 ~ /^V[A-Z0-9]+$/ ||
- $2 ~ /^CS[A-Z0-9]/ ||
- $2 ~ /^I(SIG|CANON|CRNL|EXTEN|MAXBEL|STRIP|UTF8)$/ ||
- $2 ~ /^IGN/ ||
- $2 ~ /^IX(ON|ANY|OFF)$/ ||
- $2 ~ /^IN(LCR|PCK)$/ ||
- $2 ~ /(^FLU?SH)|(FLU?SH$)/ ||
- $2 ~ /^C(LOCAL|READ)$/ ||
- $2 == "BRKINT" ||
- $2 == "HUPCL" ||
- $2 == "PENDIN" ||
- $2 == "TOSTOP" ||
- $2 ~ /^PAR/ ||
- $2 ~ /^SIG[^_]/ ||
- $2 ~ /^O[CNPFP][A-Z]+[^_][A-Z]+$/ ||
- $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 == "ICMPV6_FILTER" ||
- $2 == "SOMAXCONN" ||
- $2 == "NAME_MAX" ||
- $2 == "IFNAMSIZ" ||
- $2 ~ /^CTL_(MAXNAME|NET|QUERY)$/ ||
- $2 ~ /^SYSCTL_VERS/ ||
- $2 ~ /^(MS|MNT)_/ ||
- $2 ~ /^TUN(SET|GET|ATTACH|DETACH)/ ||
- $2 ~ /^(O|F|FD|NAME|S|PTRACE|PT)_/ ||
- $2 ~ /^LINUX_REBOOT_CMD_/ ||
- $2 ~ /^LINUX_REBOOT_MAGIC[12]$/ ||
- $2 !~ "NLA_TYPE_MASK" &&
- $2 ~ /^(NETLINK|NLM|NLMSG|NLA|IFA|IFAN|RT|RTCF|RTN|RTPROT|RTNH|ARPHRD|ETH_P)_/ ||
- $2 ~ /^SIOC/ ||
- $2 ~ /^TIOC/ ||
- $2 !~ "RTF_BITS" &&
- $2 ~ /^(IFF|IFT|NET_RT|RTM|RTF|RTV|RTA|RTAX)_/ ||
- $2 ~ /^BIOC/ ||
- $2 ~ /^RUSAGE_(SELF|CHILDREN|THREAD)/ ||
- $2 ~ /^RLIMIT_(AS|CORE|CPU|DATA|FSIZE|NOFILE|STACK)|RLIM_INFINITY/ ||
- $2 ~ /^PRIO_(PROCESS|PGRP|USER)/ ||
- $2 ~ /^CLONE_[A-Z_]+/ ||
- $2 !~ /^(BPF_TIMEVAL)$/ &&
- $2 ~ /^(BPF|DLT)_/ ||
- $2 !~ "WMESGLEN" &&
- $2 ~ /^W[A-Z0-9]+$/ {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)}
-
- {next}
- ' | sort
-
- echo ')'
-) >_const.go
-
-# Pull out the error names for later.
-errors=$(
- echo '#include ' | $CC -x c - -E -dM $ccflags |
- awk '$1=="#define" && $2 ~ /^E[A-Z0-9_]+$/ { print $2 }' |
- sort
-)
-
-# Pull out the signal names for later.
-signals=$(
- echo '#include ' | $CC -x c - -E -dM $ccflags |
- awk '$1=="#define" && $2 ~ /^SIG[A-Z0-9]+$/ { print $2 }' |
- grep -v 'SIGSTKSIZE\|SIGSTKSZ\|SIGRT' |
- sort
-)
-
-# Again, writing regexps to a file.
-echo '#include ' | $CC -x c - -E -dM $ccflags |
- awk '$1=="#define" && $2 ~ /^E[A-Z0-9_]+$/ { print "^\t" $2 "[ \t]*=" }' |
- sort >_error.grep
-echo '#include ' | $CC -x c - -E -dM $ccflags |
- awk '$1=="#define" && $2 ~ /^SIG[A-Z0-9]+$/ { print "^\t" $2 "[ \t]*=" }' |
- grep -v 'SIGSTKSIZE\|SIGSTKSZ\|SIGRT' |
- sort >_signal.grep
-
-echo '// mkerrors.sh' "$@"
-echo '// Code generated by the command above; DO NOT EDIT.'
-echo
-go tool cgo -godefs -- "$@" _const.go >_error.out
-cat _error.out | grep -vf _error.grep | grep -vf _signal.grep
-echo
-echo '// Errors'
-echo 'const ('
-cat _error.out | grep -f _error.grep | sed 's/=\(.*\)/= Errno(\1)/'
-echo ')'
-
-echo
-echo '// Signals'
-echo 'const ('
-cat _error.out | grep -f _signal.grep | sed 's/=\(.*\)/= Signal(\1)/'
-echo ')'
-
-# Run C program to print error and syscall strings.
-(
- echo -E "
-#include
-#include
-#include
-#include
-#include
-#include
-
-#define nelem(x) (sizeof(x)/sizeof((x)[0]))
-
-enum { A = 'A', Z = 'Z', a = 'a', z = 'z' }; // avoid need for single quotes below
-
-int errors[] = {
-"
- for i in $errors
- do
- echo -E ' '$i,
- done
-
- echo -E "
-};
-
-int signals[] = {
-"
- for i in $signals
- do
- echo -E ' '$i,
- done
-
- # Use -E because on some systems bash builtin interprets \n itself.
- echo -E '
-};
-
-static int
-intcmp(const void *a, const void *b)
-{
- return *(int*)a - *(int*)b;
-}
-
-int
-main(void)
-{
- int i, j, e;
- char buf[1024], *p;
-
- printf("\n\n// Error table\n");
- printf("var errors = [...]string {\n");
- qsort(errors, nelem(errors), sizeof errors[0], intcmp);
- for(i=0; i 0 && errors[i-1] == 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("}\n\n");
-
- printf("\n\n// Signal table\n");
- printf("var signals = [...]string {\n");
- qsort(signals, nelem(signals), sizeof signals[0], intcmp);
- for(i=0; i 0 && signals[i-1] == e)
- continue;
- strcpy(buf, strsignal(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;
- // cut trailing : number.
- p = strrchr(buf, ":"[0]);
- if(p)
- *p = '\0';
- printf("\t%d: \"%s\",\n", e, buf);
- }
- printf("}\n\n");
-
- return 0;
-}
-
-'
-) >_errors.c
-
-$CC $ccflags -o _errors _errors.c && $GORUN ./_errors && rm -f _errors.c _errors _const.go _error.grep _signal.grep _error.out
diff --git a/vendor/golang.org/x/sys/plan9/mksysnum_plan9.sh b/vendor/golang.org/x/sys/plan9/mksysnum_plan9.sh
deleted file mode 100644
index 3c3ab058..00000000
--- a/vendor/golang.org/x/sys/plan9/mksysnum_plan9.sh
+++ /dev/null
@@ -1,23 +0,0 @@
-#!/bin/sh
-# 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.
-
-COMMAND="mksysnum_plan9.sh $@"
-
-cat <= 10 {
- buf[i] = byte(val%10 + '0')
- i--
- val /= 10
- }
- buf[i] = byte(val + '0')
- return string(buf[i:])
-}
diff --git a/vendor/golang.org/x/sys/plan9/syscall.go b/vendor/golang.org/x/sys/plan9/syscall.go
deleted file mode 100644
index 67e5b011..00000000
--- a/vendor/golang.org/x/sys/plan9/syscall.go
+++ /dev/null
@@ -1,110 +0,0 @@
-// Copyright 2009 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-//go:build plan9
-// +build plan9
-
-// Package plan9 contains an interface to the low-level operating system
-// primitives. OS details vary depending on the underlying system, and
-// by default, godoc will display the OS-specific documentation for the current
-// system. If you want godoc to display documentation for another
-// 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.ErrorString.
-package plan9 // import "golang.org/x/sys/plan9"
-
-import (
- "bytes"
- "strings"
- "unsafe"
-)
-
-// 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) {
- if strings.IndexByte(s, 0) != -1 {
- return nil, EINVAL
- }
- a := make([]byte, len(s)+1)
- copy(a, s)
- return a, nil
-}
-
-// BytePtrFromString returns a pointer to a NUL-terminated array of
-// bytes containing the text of s. If s contains a NUL byte at any
-// location, it returns (nil, EINVAL).
-func BytePtrFromString(s string) (*byte, error) {
- a, err := ByteSliceFromString(s)
- if err != nil {
- return nil, err
- }
- return &a[0], nil
-}
-
-// ByteSliceToString returns a string form of the text represented by the slice s, with a terminating NUL and any
-// bytes after the NUL removed.
-func ByteSliceToString(s []byte) string {
- if i := bytes.IndexByte(s, 0); i != -1 {
- s = s[:i]
- }
- return string(s)
-}
-
-// BytePtrToString takes a pointer to a sequence of text and returns the corresponding string.
-// If the pointer is nil, it returns the empty string. It assumes that the text sequence is terminated
-// at a zero byte; if the zero byte is not present, the program may crash.
-func BytePtrToString(p *byte) string {
- if p == nil {
- return ""
- }
- if *p == 0 {
- return ""
- }
-
- // Find NUL terminator.
- n := 0
- for ptr := unsafe.Pointer(p); *(*byte)(ptr) != 0; n++ {
- ptr = unsafe.Pointer(uintptr(ptr) + 1)
- }
-
- return string(unsafe.Slice(p, n))
-}
-
-// Single-word zero for use when we need a valid pointer to 0 bytes.
-// See mksyscall.pl.
-var _zero uintptr
-
-func (ts *Timespec) Unix() (sec int64, nsec int64) {
- return int64(ts.Sec), int64(ts.Nsec)
-}
-
-func (tv *Timeval) Unix() (sec int64, nsec int64) {
- return int64(tv.Sec), int64(tv.Usec) * 1000
-}
-
-func (ts *Timespec) Nano() int64 {
- return int64(ts.Sec)*1e9 + int64(ts.Nsec)
-}
-
-func (tv *Timeval) Nano() int64 {
- return int64(tv.Sec)*1e9 + int64(tv.Usec)*1000
-}
-
-// use is a no-op, but the compiler cannot see that it is.
-// Calling use(p) ensures that p is kept live until that point.
-//
-//go:noescape
-func use(p unsafe.Pointer)
diff --git a/vendor/golang.org/x/sys/plan9/syscall_plan9.go b/vendor/golang.org/x/sys/plan9/syscall_plan9.go
deleted file mode 100644
index d079d811..00000000
--- a/vendor/golang.org/x/sys/plan9/syscall_plan9.go
+++ /dev/null
@@ -1,361 +0,0 @@
-// Copyright 2011 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-// Plan 9 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 plan9
-
-import (
- "bytes"
- "syscall"
- "unsafe"
-)
-
-// A Note is a string describing a process note.
-// It implements the os.Signal interface.
-type Note string
-
-func (n Note) Signal() {}
-
-func (n Note) String() string {
- return string(n)
-}
-
-var (
- Stdin = 0
- Stdout = 1
- Stderr = 2
-)
-
-// For testing: clients can set this flag to force
-// creation of IPv6 sockets to return EAFNOSUPPORT.
-var SocketDisableIPv6 bool
-
-func Syscall(trap, a1, a2, a3 uintptr) (r1, r2 uintptr, err syscall.ErrorString)
-func Syscall6(trap, a1, a2, a3, a4, a5, a6 uintptr) (r1, r2 uintptr, err syscall.ErrorString)
-func RawSyscall(trap, a1, a2, a3 uintptr) (r1, r2, err uintptr)
-func RawSyscall6(trap, a1, a2, a3, a4, a5, a6 uintptr) (r1, r2, err uintptr)
-
-func atoi(b []byte) (n uint) {
- n = 0
- for i := 0; i < len(b); i++ {
- n = n*10 + uint(b[i]-'0')
- }
- return
-}
-
-func cstring(s []byte) string {
- i := bytes.IndexByte(s, 0)
- if i == -1 {
- i = len(s)
- }
- return string(s[:i])
-}
-
-func errstr() string {
- var buf [ERRMAX]byte
-
- RawSyscall(SYS_ERRSTR, uintptr(unsafe.Pointer(&buf[0])), uintptr(len(buf)), 0)
-
- buf[len(buf)-1] = 0
- return cstring(buf[:])
-}
-
-// Implemented in assembly to import from runtime.
-func exit(code int)
-
-func Exit(code int) { exit(code) }
-
-func readnum(path string) (uint, error) {
- var b [12]byte
-
- fd, e := Open(path, O_RDONLY)
- if e != nil {
- return 0, e
- }
- defer Close(fd)
-
- n, e := Pread(fd, b[:], 0)
-
- if e != nil {
- return 0, e
- }
-
- m := 0
- for ; m < n && b[m] == ' '; m++ {
- }
-
- return atoi(b[m : n-1]), nil
-}
-
-func Getpid() (pid int) {
- n, _ := readnum("#c/pid")
- return int(n)
-}
-
-func Getppid() (ppid int) {
- n, _ := readnum("#c/ppid")
- return int(n)
-}
-
-func Read(fd int, p []byte) (n int, err error) {
- return Pread(fd, p, -1)
-}
-
-func Write(fd int, p []byte) (n int, err error) {
- return Pwrite(fd, p, -1)
-}
-
-var ioSync int64
-
-//sys fd2path(fd int, buf []byte) (err error)
-
-func Fd2path(fd int) (path string, err error) {
- var buf [512]byte
-
- e := fd2path(fd, buf[:])
- if e != nil {
- return "", e
- }
- return cstring(buf[:]), nil
-}
-
-//sys pipe(p *[2]int32) (err error)
-
-func Pipe(p []int) (err error) {
- if len(p) != 2 {
- return syscall.ErrorString("bad arg in system call")
- }
- var pp [2]int32
- err = pipe(&pp)
- if err == nil {
- p[0] = int(pp[0])
- p[1] = int(pp[1])
- }
- return
-}
-
-// Underlying system call writes to newoffset via pointer.
-// Implemented in assembly to avoid allocation.
-func seek(placeholder uintptr, fd int, offset int64, whence int) (newoffset int64, err string)
-
-func Seek(fd int, offset int64, whence int) (newoffset int64, err error) {
- newoffset, e := seek(0, fd, offset, whence)
-
- if newoffset == -1 {
- err = syscall.ErrorString(e)
- }
- return
-}
-
-func Mkdir(path string, mode uint32) (err error) {
- fd, err := Create(path, O_RDONLY, DMDIR|mode)
-
- if fd != -1 {
- Close(fd)
- }
-
- return
-}
-
-type Waitmsg struct {
- Pid int
- Time [3]uint32
- Msg string
-}
-
-func (w Waitmsg) Exited() bool { return true }
-func (w Waitmsg) Signaled() bool { return false }
-
-func (w Waitmsg) ExitStatus() int {
- if len(w.Msg) == 0 {
- // a normal exit returns no message
- return 0
- }
- return 1
-}
-
-//sys await(s []byte) (n int, err error)
-
-func Await(w *Waitmsg) (err error) {
- var buf [512]byte
- var f [5][]byte
-
- n, err := await(buf[:])
-
- if err != nil || w == nil {
- return
- }
-
- nf := 0
- p := 0
- for i := 0; i < n && nf < len(f)-1; i++ {
- if buf[i] == ' ' {
- f[nf] = buf[p:i]
- p = i + 1
- nf++
- }
- }
- f[nf] = buf[p:]
- nf++
-
- if nf != len(f) {
- return syscall.ErrorString("invalid wait message")
- }
- w.Pid = int(atoi(f[0]))
- w.Time[0] = uint32(atoi(f[1]))
- w.Time[1] = uint32(atoi(f[2]))
- w.Time[2] = uint32(atoi(f[3]))
- w.Msg = cstring(f[4])
- if w.Msg == "''" {
- // await() returns '' for no error
- w.Msg = ""
- }
- return
-}
-
-func Unmount(name, old string) (err error) {
- fixwd()
- oldp, err := BytePtrFromString(old)
- if err != nil {
- return err
- }
- oldptr := uintptr(unsafe.Pointer(oldp))
-
- var r0 uintptr
- var e syscall.ErrorString
-
- // bind(2) man page: If name is zero, everything bound or mounted upon old is unbound or unmounted.
- if name == "" {
- r0, _, e = Syscall(SYS_UNMOUNT, _zero, oldptr, 0)
- } else {
- namep, err := BytePtrFromString(name)
- if err != nil {
- return err
- }
- r0, _, e = Syscall(SYS_UNMOUNT, uintptr(unsafe.Pointer(namep)), oldptr, 0)
- }
-
- if int32(r0) == -1 {
- err = e
- }
- return
-}
-
-func Fchdir(fd int) (err error) {
- path, err := Fd2path(fd)
-
- if err != nil {
- return
- }
-
- return Chdir(path)
-}
-
-type Timespec struct {
- Sec int32
- Nsec int32
-}
-
-type Timeval struct {
- Sec int32
- Usec int32
-}
-
-func NsecToTimeval(nsec int64) (tv Timeval) {
- nsec += 999 // round up to microsecond
- tv.Usec = int32(nsec % 1e9 / 1e3)
- tv.Sec = int32(nsec / 1e9)
- return
-}
-
-func nsec() int64 {
- var scratch int64
-
- r0, _, _ := Syscall(SYS_NSEC, uintptr(unsafe.Pointer(&scratch)), 0, 0)
- // TODO(aram): remove hack after I fix _nsec in the pc64 kernel.
- if r0 == 0 {
- return scratch
- }
- return int64(r0)
-}
-
-func Gettimeofday(tv *Timeval) error {
- nsec := nsec()
- *tv = NsecToTimeval(nsec)
- return nil
-}
-
-func Getpagesize() int { return 0x1000 }
-
-func Getegid() (egid int) { return -1 }
-func Geteuid() (euid int) { return -1 }
-func Getgid() (gid int) { return -1 }
-func Getuid() (uid int) { return -1 }
-
-func Getgroups() (gids []int, err error) {
- return make([]int, 0), nil
-}
-
-//sys open(path string, mode int) (fd int, err error)
-
-func Open(path string, mode int) (fd int, err error) {
- fixwd()
- return open(path, mode)
-}
-
-//sys create(path string, mode int, perm uint32) (fd int, err error)
-
-func Create(path string, mode int, perm uint32) (fd int, err error) {
- fixwd()
- return create(path, mode, perm)
-}
-
-//sys remove(path string) (err error)
-
-func Remove(path string) error {
- fixwd()
- return remove(path)
-}
-
-//sys stat(path string, edir []byte) (n int, err error)
-
-func Stat(path string, edir []byte) (n int, err error) {
- fixwd()
- return stat(path, edir)
-}
-
-//sys bind(name string, old string, flag int) (err error)
-
-func Bind(name string, old string, flag int) (err error) {
- fixwd()
- return bind(name, old, flag)
-}
-
-//sys mount(fd int, afd int, old string, flag int, aname string) (err error)
-
-func Mount(fd int, afd int, old string, flag int, aname string) (err error) {
- fixwd()
- return mount(fd, afd, old, flag, aname)
-}
-
-//sys wstat(path string, edir []byte) (err error)
-
-func Wstat(path string, edir []byte) (err error) {
- fixwd()
- return wstat(path, edir)
-}
-
-//sys chdir(path string) (err error)
-//sys Dup(oldfd int, newfd int) (fd 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 Close(fd int) (err error)
-//sys Fstat(fd int, edir []byte) (n int, err error)
-//sys Fwstat(fd int, edir []byte) (err error)
diff --git a/vendor/golang.org/x/sys/plan9/zsyscall_plan9_386.go b/vendor/golang.org/x/sys/plan9/zsyscall_plan9_386.go
deleted file mode 100644
index 3f40b9bd..00000000
--- a/vendor/golang.org/x/sys/plan9/zsyscall_plan9_386.go
+++ /dev/null
@@ -1,285 +0,0 @@
-// go run mksyscall.go -l32 -plan9 -tags plan9,386 syscall_plan9.go
-// Code generated by the command above; see README.md. DO NOT EDIT.
-
-//go:build plan9 && 386
-// +build plan9,386
-
-package plan9
-
-import "unsafe"
-
-// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
-
-func fd2path(fd int, buf []byte) (err error) {
- var _p0 unsafe.Pointer
- if len(buf) > 0 {
- _p0 = unsafe.Pointer(&buf[0])
- } else {
- _p0 = unsafe.Pointer(&_zero)
- }
- r0, _, e1 := Syscall(SYS_FD2PATH, uintptr(fd), uintptr(_p0), uintptr(len(buf)))
- if int32(r0) == -1 {
- err = e1
- }
- return
-}
-
-// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
-
-func pipe(p *[2]int32) (err error) {
- r0, _, e1 := Syscall(SYS_PIPE, uintptr(unsafe.Pointer(p)), 0, 0)
- if int32(r0) == -1 {
- err = e1
- }
- return
-}
-
-// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
-
-func await(s []byte) (n int, err error) {
- var _p0 unsafe.Pointer
- if len(s) > 0 {
- _p0 = unsafe.Pointer(&s[0])
- } else {
- _p0 = unsafe.Pointer(&_zero)
- }
- r0, _, e1 := Syscall(SYS_AWAIT, uintptr(_p0), uintptr(len(s)), 0)
- n = int(r0)
- if int32(r0) == -1 {
- err = e1
- }
- return
-}
-
-// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
-
-func open(path string, mode int) (fd int, err error) {
- var _p0 *byte
- _p0, err = BytePtrFromString(path)
- if err != nil {
- return
- }
- r0, _, e1 := Syscall(SYS_OPEN, uintptr(unsafe.Pointer(_p0)), uintptr(mode), 0)
- fd = int(r0)
- if int32(r0) == -1 {
- err = e1
- }
- return
-}
-
-// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
-
-func create(path string, mode int, perm uint32) (fd int, err error) {
- var _p0 *byte
- _p0, err = BytePtrFromString(path)
- if err != nil {
- return
- }
- r0, _, e1 := Syscall(SYS_CREATE, uintptr(unsafe.Pointer(_p0)), uintptr(mode), uintptr(perm))
- fd = int(r0)
- if int32(r0) == -1 {
- err = e1
- }
- return
-}
-
-// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
-
-func remove(path string) (err error) {
- var _p0 *byte
- _p0, err = BytePtrFromString(path)
- if err != nil {
- return
- }
- r0, _, e1 := Syscall(SYS_REMOVE, uintptr(unsafe.Pointer(_p0)), 0, 0)
- if int32(r0) == -1 {
- err = e1
- }
- return
-}
-
-// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
-
-func stat(path string, edir []byte) (n int, err error) {
- var _p0 *byte
- _p0, err = BytePtrFromString(path)
- if err != nil {
- return
- }
- var _p1 unsafe.Pointer
- if len(edir) > 0 {
- _p1 = unsafe.Pointer(&edir[0])
- } else {
- _p1 = unsafe.Pointer(&_zero)
- }
- r0, _, e1 := Syscall(SYS_STAT, uintptr(unsafe.Pointer(_p0)), uintptr(_p1), uintptr(len(edir)))
- n = int(r0)
- if int32(r0) == -1 {
- err = e1
- }
- return
-}
-
-// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
-
-func bind(name string, old string, flag int) (err error) {
- var _p0 *byte
- _p0, err = BytePtrFromString(name)
- if err != nil {
- return
- }
- var _p1 *byte
- _p1, err = BytePtrFromString(old)
- if err != nil {
- return
- }
- r0, _, e1 := Syscall(SYS_BIND, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(_p1)), uintptr(flag))
- if int32(r0) == -1 {
- err = e1
- }
- return
-}
-
-// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
-
-func mount(fd int, afd int, old string, flag int, aname string) (err error) {
- var _p0 *byte
- _p0, err = BytePtrFromString(old)
- if err != nil {
- return
- }
- var _p1 *byte
- _p1, err = BytePtrFromString(aname)
- if err != nil {
- return
- }
- r0, _, e1 := Syscall6(SYS_MOUNT, uintptr(fd), uintptr(afd), uintptr(unsafe.Pointer(_p0)), uintptr(flag), uintptr(unsafe.Pointer(_p1)), 0)
- if int32(r0) == -1 {
- err = e1
- }
- return
-}
-
-// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
-
-func wstat(path string, edir []byte) (err error) {
- var _p0 *byte
- _p0, err = BytePtrFromString(path)
- if err != nil {
- return
- }
- var _p1 unsafe.Pointer
- if len(edir) > 0 {
- _p1 = unsafe.Pointer(&edir[0])
- } else {
- _p1 = unsafe.Pointer(&_zero)
- }
- r0, _, e1 := Syscall(SYS_WSTAT, uintptr(unsafe.Pointer(_p0)), uintptr(_p1), uintptr(len(edir)))
- if int32(r0) == -1 {
- err = e1
- }
- return
-}
-
-// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
-
-func chdir(path string) (err error) {
- var _p0 *byte
- _p0, err = BytePtrFromString(path)
- if err != nil {
- return
- }
- r0, _, e1 := Syscall(SYS_CHDIR, uintptr(unsafe.Pointer(_p0)), 0, 0)
- if int32(r0) == -1 {
- err = e1
- }
- return
-}
-
-// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
-
-func Dup(oldfd int, newfd int) (fd int, err error) {
- r0, _, e1 := Syscall(SYS_DUP, uintptr(oldfd), uintptr(newfd), 0)
- fd = int(r0)
- if int32(r0) == -1 {
- err = e1
- }
- return
-}
-
-// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
-
-func Pread(fd int, p []byte, offset int64) (n int, err error) {
- var _p0 unsafe.Pointer
- if len(p) > 0 {
- _p0 = unsafe.Pointer(&p[0])
- } else {
- _p0 = unsafe.Pointer(&_zero)
- }
- r0, _, e1 := Syscall6(SYS_PREAD, uintptr(fd), uintptr(_p0), uintptr(len(p)), uintptr(offset), uintptr(offset>>32), 0)
- n = int(r0)
- if int32(r0) == -1 {
- err = e1
- }
- return
-}
-
-// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
-
-func Pwrite(fd int, p []byte, offset int64) (n int, err error) {
- var _p0 unsafe.Pointer
- if len(p) > 0 {
- _p0 = unsafe.Pointer(&p[0])
- } else {
- _p0 = unsafe.Pointer(&_zero)
- }
- r0, _, e1 := Syscall6(SYS_PWRITE, uintptr(fd), uintptr(_p0), uintptr(len(p)), uintptr(offset), uintptr(offset>>32), 0)
- n = int(r0)
- if int32(r0) == -1 {
- err = e1
- }
- return
-}
-
-// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
-
-func Close(fd int) (err error) {
- r0, _, e1 := Syscall(SYS_CLOSE, uintptr(fd), 0, 0)
- if int32(r0) == -1 {
- err = e1
- }
- return
-}
-
-// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
-
-func Fstat(fd int, edir []byte) (n int, err error) {
- var _p0 unsafe.Pointer
- if len(edir) > 0 {
- _p0 = unsafe.Pointer(&edir[0])
- } else {
- _p0 = unsafe.Pointer(&_zero)
- }
- r0, _, e1 := Syscall(SYS_FSTAT, uintptr(fd), uintptr(_p0), uintptr(len(edir)))
- n = int(r0)
- if int32(r0) == -1 {
- err = e1
- }
- return
-}
-
-// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
-
-func Fwstat(fd int, edir []byte) (err error) {
- var _p0 unsafe.Pointer
- if len(edir) > 0 {
- _p0 = unsafe.Pointer(&edir[0])
- } else {
- _p0 = unsafe.Pointer(&_zero)
- }
- r0, _, e1 := Syscall(SYS_FWSTAT, uintptr(fd), uintptr(_p0), uintptr(len(edir)))
- if int32(r0) == -1 {
- err = e1
- }
- return
-}
diff --git a/vendor/golang.org/x/sys/plan9/zsyscall_plan9_amd64.go b/vendor/golang.org/x/sys/plan9/zsyscall_plan9_amd64.go
deleted file mode 100644
index 0e6a96aa..00000000
--- a/vendor/golang.org/x/sys/plan9/zsyscall_plan9_amd64.go
+++ /dev/null
@@ -1,285 +0,0 @@
-// go run mksyscall.go -l32 -plan9 -tags plan9,amd64 syscall_plan9.go
-// Code generated by the command above; see README.md. DO NOT EDIT.
-
-//go:build plan9 && amd64
-// +build plan9,amd64
-
-package plan9
-
-import "unsafe"
-
-// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
-
-func fd2path(fd int, buf []byte) (err error) {
- var _p0 unsafe.Pointer
- if len(buf) > 0 {
- _p0 = unsafe.Pointer(&buf[0])
- } else {
- _p0 = unsafe.Pointer(&_zero)
- }
- r0, _, e1 := Syscall(SYS_FD2PATH, uintptr(fd), uintptr(_p0), uintptr(len(buf)))
- if int32(r0) == -1 {
- err = e1
- }
- return
-}
-
-// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
-
-func pipe(p *[2]int32) (err error) {
- r0, _, e1 := Syscall(SYS_PIPE, uintptr(unsafe.Pointer(p)), 0, 0)
- if int32(r0) == -1 {
- err = e1
- }
- return
-}
-
-// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
-
-func await(s []byte) (n int, err error) {
- var _p0 unsafe.Pointer
- if len(s) > 0 {
- _p0 = unsafe.Pointer(&s[0])
- } else {
- _p0 = unsafe.Pointer(&_zero)
- }
- r0, _, e1 := Syscall(SYS_AWAIT, uintptr(_p0), uintptr(len(s)), 0)
- n = int(r0)
- if int32(r0) == -1 {
- err = e1
- }
- return
-}
-
-// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
-
-func open(path string, mode int) (fd int, err error) {
- var _p0 *byte
- _p0, err = BytePtrFromString(path)
- if err != nil {
- return
- }
- r0, _, e1 := Syscall(SYS_OPEN, uintptr(unsafe.Pointer(_p0)), uintptr(mode), 0)
- fd = int(r0)
- if int32(r0) == -1 {
- err = e1
- }
- return
-}
-
-// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
-
-func create(path string, mode int, perm uint32) (fd int, err error) {
- var _p0 *byte
- _p0, err = BytePtrFromString(path)
- if err != nil {
- return
- }
- r0, _, e1 := Syscall(SYS_CREATE, uintptr(unsafe.Pointer(_p0)), uintptr(mode), uintptr(perm))
- fd = int(r0)
- if int32(r0) == -1 {
- err = e1
- }
- return
-}
-
-// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
-
-func remove(path string) (err error) {
- var _p0 *byte
- _p0, err = BytePtrFromString(path)
- if err != nil {
- return
- }
- r0, _, e1 := Syscall(SYS_REMOVE, uintptr(unsafe.Pointer(_p0)), 0, 0)
- if int32(r0) == -1 {
- err = e1
- }
- return
-}
-
-// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
-
-func stat(path string, edir []byte) (n int, err error) {
- var _p0 *byte
- _p0, err = BytePtrFromString(path)
- if err != nil {
- return
- }
- var _p1 unsafe.Pointer
- if len(edir) > 0 {
- _p1 = unsafe.Pointer(&edir[0])
- } else {
- _p1 = unsafe.Pointer(&_zero)
- }
- r0, _, e1 := Syscall(SYS_STAT, uintptr(unsafe.Pointer(_p0)), uintptr(_p1), uintptr(len(edir)))
- n = int(r0)
- if int32(r0) == -1 {
- err = e1
- }
- return
-}
-
-// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
-
-func bind(name string, old string, flag int) (err error) {
- var _p0 *byte
- _p0, err = BytePtrFromString(name)
- if err != nil {
- return
- }
- var _p1 *byte
- _p1, err = BytePtrFromString(old)
- if err != nil {
- return
- }
- r0, _, e1 := Syscall(SYS_BIND, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(_p1)), uintptr(flag))
- if int32(r0) == -1 {
- err = e1
- }
- return
-}
-
-// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
-
-func mount(fd int, afd int, old string, flag int, aname string) (err error) {
- var _p0 *byte
- _p0, err = BytePtrFromString(old)
- if err != nil {
- return
- }
- var _p1 *byte
- _p1, err = BytePtrFromString(aname)
- if err != nil {
- return
- }
- r0, _, e1 := Syscall6(SYS_MOUNT, uintptr(fd), uintptr(afd), uintptr(unsafe.Pointer(_p0)), uintptr(flag), uintptr(unsafe.Pointer(_p1)), 0)
- if int32(r0) == -1 {
- err = e1
- }
- return
-}
-
-// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
-
-func wstat(path string, edir []byte) (err error) {
- var _p0 *byte
- _p0, err = BytePtrFromString(path)
- if err != nil {
- return
- }
- var _p1 unsafe.Pointer
- if len(edir) > 0 {
- _p1 = unsafe.Pointer(&edir[0])
- } else {
- _p1 = unsafe.Pointer(&_zero)
- }
- r0, _, e1 := Syscall(SYS_WSTAT, uintptr(unsafe.Pointer(_p0)), uintptr(_p1), uintptr(len(edir)))
- if int32(r0) == -1 {
- err = e1
- }
- return
-}
-
-// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
-
-func chdir(path string) (err error) {
- var _p0 *byte
- _p0, err = BytePtrFromString(path)
- if err != nil {
- return
- }
- r0, _, e1 := Syscall(SYS_CHDIR, uintptr(unsafe.Pointer(_p0)), 0, 0)
- if int32(r0) == -1 {
- err = e1
- }
- return
-}
-
-// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
-
-func Dup(oldfd int, newfd int) (fd int, err error) {
- r0, _, e1 := Syscall(SYS_DUP, uintptr(oldfd), uintptr(newfd), 0)
- fd = int(r0)
- if int32(r0) == -1 {
- err = e1
- }
- return
-}
-
-// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
-
-func Pread(fd int, p []byte, offset int64) (n int, err error) {
- var _p0 unsafe.Pointer
- if len(p) > 0 {
- _p0 = unsafe.Pointer(&p[0])
- } else {
- _p0 = unsafe.Pointer(&_zero)
- }
- r0, _, e1 := Syscall6(SYS_PREAD, uintptr(fd), uintptr(_p0), uintptr(len(p)), uintptr(offset), uintptr(offset>>32), 0)
- n = int(r0)
- if int32(r0) == -1 {
- err = e1
- }
- return
-}
-
-// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
-
-func Pwrite(fd int, p []byte, offset int64) (n int, err error) {
- var _p0 unsafe.Pointer
- if len(p) > 0 {
- _p0 = unsafe.Pointer(&p[0])
- } else {
- _p0 = unsafe.Pointer(&_zero)
- }
- r0, _, e1 := Syscall6(SYS_PWRITE, uintptr(fd), uintptr(_p0), uintptr(len(p)), uintptr(offset), uintptr(offset>>32), 0)
- n = int(r0)
- if int32(r0) == -1 {
- err = e1
- }
- return
-}
-
-// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
-
-func Close(fd int) (err error) {
- r0, _, e1 := Syscall(SYS_CLOSE, uintptr(fd), 0, 0)
- if int32(r0) == -1 {
- err = e1
- }
- return
-}
-
-// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
-
-func Fstat(fd int, edir []byte) (n int, err error) {
- var _p0 unsafe.Pointer
- if len(edir) > 0 {
- _p0 = unsafe.Pointer(&edir[0])
- } else {
- _p0 = unsafe.Pointer(&_zero)
- }
- r0, _, e1 := Syscall(SYS_FSTAT, uintptr(fd), uintptr(_p0), uintptr(len(edir)))
- n = int(r0)
- if int32(r0) == -1 {
- err = e1
- }
- return
-}
-
-// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
-
-func Fwstat(fd int, edir []byte) (err error) {
- var _p0 unsafe.Pointer
- if len(edir) > 0 {
- _p0 = unsafe.Pointer(&edir[0])
- } else {
- _p0 = unsafe.Pointer(&_zero)
- }
- r0, _, e1 := Syscall(SYS_FWSTAT, uintptr(fd), uintptr(_p0), uintptr(len(edir)))
- if int32(r0) == -1 {
- err = e1
- }
- return
-}
diff --git a/vendor/golang.org/x/sys/plan9/zsyscall_plan9_arm.go b/vendor/golang.org/x/sys/plan9/zsyscall_plan9_arm.go
deleted file mode 100644
index 244c501b..00000000
--- a/vendor/golang.org/x/sys/plan9/zsyscall_plan9_arm.go
+++ /dev/null
@@ -1,285 +0,0 @@
-// go run mksyscall.go -l32 -plan9 -tags plan9,arm syscall_plan9.go
-// Code generated by the command above; see README.md. DO NOT EDIT.
-
-//go:build plan9 && arm
-// +build plan9,arm
-
-package plan9
-
-import "unsafe"
-
-// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
-
-func fd2path(fd int, buf []byte) (err error) {
- var _p0 unsafe.Pointer
- if len(buf) > 0 {
- _p0 = unsafe.Pointer(&buf[0])
- } else {
- _p0 = unsafe.Pointer(&_zero)
- }
- r0, _, e1 := Syscall(SYS_FD2PATH, uintptr(fd), uintptr(_p0), uintptr(len(buf)))
- if int32(r0) == -1 {
- err = e1
- }
- return
-}
-
-// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
-
-func pipe(p *[2]int32) (err error) {
- r0, _, e1 := Syscall(SYS_PIPE, uintptr(unsafe.Pointer(p)), 0, 0)
- if int32(r0) == -1 {
- err = e1
- }
- return
-}
-
-// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
-
-func await(s []byte) (n int, err error) {
- var _p0 unsafe.Pointer
- if len(s) > 0 {
- _p0 = unsafe.Pointer(&s[0])
- } else {
- _p0 = unsafe.Pointer(&_zero)
- }
- r0, _, e1 := Syscall(SYS_AWAIT, uintptr(_p0), uintptr(len(s)), 0)
- n = int(r0)
- if int32(r0) == -1 {
- err = e1
- }
- return
-}
-
-// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
-
-func open(path string, mode int) (fd int, err error) {
- var _p0 *byte
- _p0, err = BytePtrFromString(path)
- if err != nil {
- return
- }
- r0, _, e1 := Syscall(SYS_OPEN, uintptr(unsafe.Pointer(_p0)), uintptr(mode), 0)
- fd = int(r0)
- if int32(r0) == -1 {
- err = e1
- }
- return
-}
-
-// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
-
-func create(path string, mode int, perm uint32) (fd int, err error) {
- var _p0 *byte
- _p0, err = BytePtrFromString(path)
- if err != nil {
- return
- }
- r0, _, e1 := Syscall(SYS_CREATE, uintptr(unsafe.Pointer(_p0)), uintptr(mode), uintptr(perm))
- fd = int(r0)
- if int32(r0) == -1 {
- err = e1
- }
- return
-}
-
-// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
-
-func remove(path string) (err error) {
- var _p0 *byte
- _p0, err = BytePtrFromString(path)
- if err != nil {
- return
- }
- r0, _, e1 := Syscall(SYS_REMOVE, uintptr(unsafe.Pointer(_p0)), 0, 0)
- if int32(r0) == -1 {
- err = e1
- }
- return
-}
-
-// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
-
-func stat(path string, edir []byte) (n int, err error) {
- var _p0 *byte
- _p0, err = BytePtrFromString(path)
- if err != nil {
- return
- }
- var _p1 unsafe.Pointer
- if len(edir) > 0 {
- _p1 = unsafe.Pointer(&edir[0])
- } else {
- _p1 = unsafe.Pointer(&_zero)
- }
- r0, _, e1 := Syscall(SYS_STAT, uintptr(unsafe.Pointer(_p0)), uintptr(_p1), uintptr(len(edir)))
- n = int(r0)
- if int32(r0) == -1 {
- err = e1
- }
- return
-}
-
-// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
-
-func bind(name string, old string, flag int) (err error) {
- var _p0 *byte
- _p0, err = BytePtrFromString(name)
- if err != nil {
- return
- }
- var _p1 *byte
- _p1, err = BytePtrFromString(old)
- if err != nil {
- return
- }
- r0, _, e1 := Syscall(SYS_BIND, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(_p1)), uintptr(flag))
- if int32(r0) == -1 {
- err = e1
- }
- return
-}
-
-// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
-
-func mount(fd int, afd int, old string, flag int, aname string) (err error) {
- var _p0 *byte
- _p0, err = BytePtrFromString(old)
- if err != nil {
- return
- }
- var _p1 *byte
- _p1, err = BytePtrFromString(aname)
- if err != nil {
- return
- }
- r0, _, e1 := Syscall6(SYS_MOUNT, uintptr(fd), uintptr(afd), uintptr(unsafe.Pointer(_p0)), uintptr(flag), uintptr(unsafe.Pointer(_p1)), 0)
- if int32(r0) == -1 {
- err = e1
- }
- return
-}
-
-// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
-
-func wstat(path string, edir []byte) (err error) {
- var _p0 *byte
- _p0, err = BytePtrFromString(path)
- if err != nil {
- return
- }
- var _p1 unsafe.Pointer
- if len(edir) > 0 {
- _p1 = unsafe.Pointer(&edir[0])
- } else {
- _p1 = unsafe.Pointer(&_zero)
- }
- r0, _, e1 := Syscall(SYS_WSTAT, uintptr(unsafe.Pointer(_p0)), uintptr(_p1), uintptr(len(edir)))
- if int32(r0) == -1 {
- err = e1
- }
- return
-}
-
-// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
-
-func chdir(path string) (err error) {
- var _p0 *byte
- _p0, err = BytePtrFromString(path)
- if err != nil {
- return
- }
- r0, _, e1 := Syscall(SYS_CHDIR, uintptr(unsafe.Pointer(_p0)), 0, 0)
- if int32(r0) == -1 {
- err = e1
- }
- return
-}
-
-// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
-
-func Dup(oldfd int, newfd int) (fd int, err error) {
- r0, _, e1 := Syscall(SYS_DUP, uintptr(oldfd), uintptr(newfd), 0)
- fd = int(r0)
- if int32(r0) == -1 {
- err = e1
- }
- return
-}
-
-// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
-
-func Pread(fd int, p []byte, offset int64) (n int, err error) {
- var _p0 unsafe.Pointer
- if len(p) > 0 {
- _p0 = unsafe.Pointer(&p[0])
- } else {
- _p0 = unsafe.Pointer(&_zero)
- }
- r0, _, e1 := Syscall6(SYS_PREAD, uintptr(fd), uintptr(_p0), uintptr(len(p)), uintptr(offset), uintptr(offset>>32), 0)
- n = int(r0)
- if int32(r0) == -1 {
- err = e1
- }
- return
-}
-
-// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
-
-func Pwrite(fd int, p []byte, offset int64) (n int, err error) {
- var _p0 unsafe.Pointer
- if len(p) > 0 {
- _p0 = unsafe.Pointer(&p[0])
- } else {
- _p0 = unsafe.Pointer(&_zero)
- }
- r0, _, e1 := Syscall6(SYS_PWRITE, uintptr(fd), uintptr(_p0), uintptr(len(p)), uintptr(offset), uintptr(offset>>32), 0)
- n = int(r0)
- if int32(r0) == -1 {
- err = e1
- }
- return
-}
-
-// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
-
-func Close(fd int) (err error) {
- r0, _, e1 := Syscall(SYS_CLOSE, uintptr(fd), 0, 0)
- if int32(r0) == -1 {
- err = e1
- }
- return
-}
-
-// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
-
-func Fstat(fd int, edir []byte) (n int, err error) {
- var _p0 unsafe.Pointer
- if len(edir) > 0 {
- _p0 = unsafe.Pointer(&edir[0])
- } else {
- _p0 = unsafe.Pointer(&_zero)
- }
- r0, _, e1 := Syscall(SYS_FSTAT, uintptr(fd), uintptr(_p0), uintptr(len(edir)))
- n = int(r0)
- if int32(r0) == -1 {
- err = e1
- }
- return
-}
-
-// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
-
-func Fwstat(fd int, edir []byte) (err error) {
- var _p0 unsafe.Pointer
- if len(edir) > 0 {
- _p0 = unsafe.Pointer(&edir[0])
- } else {
- _p0 = unsafe.Pointer(&_zero)
- }
- r0, _, e1 := Syscall(SYS_FWSTAT, uintptr(fd), uintptr(_p0), uintptr(len(edir)))
- if int32(r0) == -1 {
- err = e1
- }
- return
-}
diff --git a/vendor/golang.org/x/sys/plan9/zsysnum_plan9.go b/vendor/golang.org/x/sys/plan9/zsysnum_plan9.go
deleted file mode 100644
index 22e8abd4..00000000
--- a/vendor/golang.org/x/sys/plan9/zsysnum_plan9.go
+++ /dev/null
@@ -1,49 +0,0 @@
-// mksysnum_plan9.sh /opt/plan9/sys/src/libc/9syscall/sys.h
-// MACHINE GENERATED BY THE ABOVE COMMAND; DO NOT EDIT
-
-package plan9
-
-const (
- SYS_SYSR1 = 0
- SYS_BIND = 2
- SYS_CHDIR = 3
- SYS_CLOSE = 4
- SYS_DUP = 5
- SYS_ALARM = 6
- SYS_EXEC = 7
- SYS_EXITS = 8
- SYS_FAUTH = 10
- SYS_SEGBRK = 12
- SYS_OPEN = 14
- SYS_OSEEK = 16
- SYS_SLEEP = 17
- SYS_RFORK = 19
- SYS_PIPE = 21
- SYS_CREATE = 22
- SYS_FD2PATH = 23
- SYS_BRK_ = 24
- SYS_REMOVE = 25
- SYS_NOTIFY = 28
- SYS_NOTED = 29
- SYS_SEGATTACH = 30
- SYS_SEGDETACH = 31
- SYS_SEGFREE = 32
- SYS_SEGFLUSH = 33
- SYS_RENDEZVOUS = 34
- SYS_UNMOUNT = 35
- SYS_SEMACQUIRE = 37
- SYS_SEMRELEASE = 38
- SYS_SEEK = 39
- SYS_FVERSION = 40
- SYS_ERRSTR = 41
- SYS_STAT = 42
- SYS_FSTAT = 43
- SYS_WSTAT = 44
- SYS_FWSTAT = 45
- SYS_MOUNT = 46
- SYS_AWAIT = 47
- SYS_PREAD = 50
- SYS_PWRITE = 51
- SYS_TSEMACQUIRE = 52
- SYS_NSEC = 53
-)
diff --git a/vendor/golang.org/x/sys/unix/aliases.go b/vendor/golang.org/x/sys/unix/aliases.go
index abc89c10..e7d3df4b 100644
--- a/vendor/golang.org/x/sys/unix/aliases.go
+++ b/vendor/golang.org/x/sys/unix/aliases.go
@@ -3,8 +3,6 @@
// license that can be found in the LICENSE file.
//go:build (aix || darwin || dragonfly || freebsd || linux || netbsd || openbsd || solaris || zos) && go1.9
-// +build aix darwin dragonfly freebsd linux netbsd openbsd solaris zos
-// +build go1.9
package unix
diff --git a/vendor/golang.org/x/sys/unix/asm_aix_ppc64.s b/vendor/golang.org/x/sys/unix/asm_aix_ppc64.s
index db9171c2..269e173c 100644
--- a/vendor/golang.org/x/sys/unix/asm_aix_ppc64.s
+++ b/vendor/golang.org/x/sys/unix/asm_aix_ppc64.s
@@ -3,7 +3,6 @@
// license that can be found in the LICENSE file.
//go:build gc
-// +build gc
#include "textflag.h"
diff --git a/vendor/golang.org/x/sys/unix/asm_bsd_386.s b/vendor/golang.org/x/sys/unix/asm_bsd_386.s
index e0fcd9b3..a4fcef0e 100644
--- a/vendor/golang.org/x/sys/unix/asm_bsd_386.s
+++ b/vendor/golang.org/x/sys/unix/asm_bsd_386.s
@@ -3,8 +3,6 @@
// license that can be found in the LICENSE file.
//go:build (freebsd || netbsd || openbsd) && gc
-// +build freebsd netbsd openbsd
-// +build gc
#include "textflag.h"
diff --git a/vendor/golang.org/x/sys/unix/asm_bsd_amd64.s b/vendor/golang.org/x/sys/unix/asm_bsd_amd64.s
index 2b99c349..1e63615c 100644
--- a/vendor/golang.org/x/sys/unix/asm_bsd_amd64.s
+++ b/vendor/golang.org/x/sys/unix/asm_bsd_amd64.s
@@ -3,8 +3,6 @@
// license that can be found in the LICENSE file.
//go:build (darwin || dragonfly || freebsd || netbsd || openbsd) && gc
-// +build darwin dragonfly freebsd netbsd openbsd
-// +build gc
#include "textflag.h"
diff --git a/vendor/golang.org/x/sys/unix/asm_bsd_arm.s b/vendor/golang.org/x/sys/unix/asm_bsd_arm.s
index d702d4ad..6496c310 100644
--- a/vendor/golang.org/x/sys/unix/asm_bsd_arm.s
+++ b/vendor/golang.org/x/sys/unix/asm_bsd_arm.s
@@ -3,8 +3,6 @@
// license that can be found in the LICENSE file.
//go:build (freebsd || netbsd || openbsd) && gc
-// +build freebsd netbsd openbsd
-// +build gc
#include "textflag.h"
diff --git a/vendor/golang.org/x/sys/unix/asm_bsd_arm64.s b/vendor/golang.org/x/sys/unix/asm_bsd_arm64.s
index fe36a739..4fd1f54d 100644
--- a/vendor/golang.org/x/sys/unix/asm_bsd_arm64.s
+++ b/vendor/golang.org/x/sys/unix/asm_bsd_arm64.s
@@ -3,8 +3,6 @@
// license that can be found in the LICENSE file.
//go:build (darwin || freebsd || netbsd || openbsd) && gc
-// +build darwin freebsd netbsd openbsd
-// +build gc
#include "textflag.h"
diff --git a/vendor/golang.org/x/sys/unix/asm_bsd_ppc64.s b/vendor/golang.org/x/sys/unix/asm_bsd_ppc64.s
index e5b9a848..42f7eb9e 100644
--- a/vendor/golang.org/x/sys/unix/asm_bsd_ppc64.s
+++ b/vendor/golang.org/x/sys/unix/asm_bsd_ppc64.s
@@ -3,8 +3,6 @@
// license that can be found in the LICENSE file.
//go:build (darwin || freebsd || netbsd || openbsd) && gc
-// +build darwin freebsd netbsd openbsd
-// +build gc
#include "textflag.h"
diff --git a/vendor/golang.org/x/sys/unix/asm_bsd_riscv64.s b/vendor/golang.org/x/sys/unix/asm_bsd_riscv64.s
index d560019e..f8902667 100644
--- a/vendor/golang.org/x/sys/unix/asm_bsd_riscv64.s
+++ b/vendor/golang.org/x/sys/unix/asm_bsd_riscv64.s
@@ -3,8 +3,6 @@
// license that can be found in the LICENSE file.
//go:build (darwin || freebsd || netbsd || openbsd) && gc
-// +build darwin freebsd netbsd openbsd
-// +build gc
#include "textflag.h"
diff --git a/vendor/golang.org/x/sys/unix/asm_linux_386.s b/vendor/golang.org/x/sys/unix/asm_linux_386.s
index 8fd101d0..3b473487 100644
--- a/vendor/golang.org/x/sys/unix/asm_linux_386.s
+++ b/vendor/golang.org/x/sys/unix/asm_linux_386.s
@@ -3,7 +3,6 @@
// license that can be found in the LICENSE file.
//go:build gc
-// +build gc
#include "textflag.h"
diff --git a/vendor/golang.org/x/sys/unix/asm_linux_amd64.s b/vendor/golang.org/x/sys/unix/asm_linux_amd64.s
index 7ed38e43..67e29f31 100644
--- a/vendor/golang.org/x/sys/unix/asm_linux_amd64.s
+++ b/vendor/golang.org/x/sys/unix/asm_linux_amd64.s
@@ -3,7 +3,6 @@
// license that can be found in the LICENSE file.
//go:build gc
-// +build gc
#include "textflag.h"
diff --git a/vendor/golang.org/x/sys/unix/asm_linux_arm.s b/vendor/golang.org/x/sys/unix/asm_linux_arm.s
index 8ef1d514..d6ae269c 100644
--- a/vendor/golang.org/x/sys/unix/asm_linux_arm.s
+++ b/vendor/golang.org/x/sys/unix/asm_linux_arm.s
@@ -3,7 +3,6 @@
// license that can be found in the LICENSE file.
//go:build gc
-// +build gc
#include "textflag.h"
diff --git a/vendor/golang.org/x/sys/unix/asm_linux_arm64.s b/vendor/golang.org/x/sys/unix/asm_linux_arm64.s
index 98ae0276..01e5e253 100644
--- a/vendor/golang.org/x/sys/unix/asm_linux_arm64.s
+++ b/vendor/golang.org/x/sys/unix/asm_linux_arm64.s
@@ -3,9 +3,6 @@
// license that can be found in the LICENSE file.
//go:build linux && arm64 && gc
-// +build linux
-// +build arm64
-// +build gc
#include "textflag.h"
diff --git a/vendor/golang.org/x/sys/unix/asm_linux_loong64.s b/vendor/golang.org/x/sys/unix/asm_linux_loong64.s
index 56535728..2abf12f6 100644
--- a/vendor/golang.org/x/sys/unix/asm_linux_loong64.s
+++ b/vendor/golang.org/x/sys/unix/asm_linux_loong64.s
@@ -3,9 +3,6 @@
// license that can be found in the LICENSE file.
//go:build linux && loong64 && gc
-// +build linux
-// +build loong64
-// +build gc
#include "textflag.h"
diff --git a/vendor/golang.org/x/sys/unix/asm_linux_mips64x.s b/vendor/golang.org/x/sys/unix/asm_linux_mips64x.s
index 21231d2c..f84bae71 100644
--- a/vendor/golang.org/x/sys/unix/asm_linux_mips64x.s
+++ b/vendor/golang.org/x/sys/unix/asm_linux_mips64x.s
@@ -3,9 +3,6 @@
// license that can be found in the LICENSE file.
//go:build linux && (mips64 || mips64le) && gc
-// +build linux
-// +build mips64 mips64le
-// +build gc
#include "textflag.h"
diff --git a/vendor/golang.org/x/sys/unix/asm_linux_mipsx.s b/vendor/golang.org/x/sys/unix/asm_linux_mipsx.s
index 6783b26c..f08f6280 100644
--- a/vendor/golang.org/x/sys/unix/asm_linux_mipsx.s
+++ b/vendor/golang.org/x/sys/unix/asm_linux_mipsx.s
@@ -3,9 +3,6 @@
// license that can be found in the LICENSE file.
//go:build linux && (mips || mipsle) && gc
-// +build linux
-// +build mips mipsle
-// +build gc
#include "textflag.h"
diff --git a/vendor/golang.org/x/sys/unix/asm_linux_ppc64x.s b/vendor/golang.org/x/sys/unix/asm_linux_ppc64x.s
index 19d49893..bdfc024d 100644
--- a/vendor/golang.org/x/sys/unix/asm_linux_ppc64x.s
+++ b/vendor/golang.org/x/sys/unix/asm_linux_ppc64x.s
@@ -3,9 +3,6 @@
// license that can be found in the LICENSE file.
//go:build linux && (ppc64 || ppc64le) && gc
-// +build linux
-// +build ppc64 ppc64le
-// +build gc
#include "textflag.h"
diff --git a/vendor/golang.org/x/sys/unix/asm_linux_riscv64.s b/vendor/golang.org/x/sys/unix/asm_linux_riscv64.s
index e42eb81d..2e8c9961 100644
--- a/vendor/golang.org/x/sys/unix/asm_linux_riscv64.s
+++ b/vendor/golang.org/x/sys/unix/asm_linux_riscv64.s
@@ -3,8 +3,6 @@
// license that can be found in the LICENSE file.
//go:build riscv64 && gc
-// +build riscv64
-// +build gc
#include "textflag.h"
diff --git a/vendor/golang.org/x/sys/unix/asm_linux_s390x.s b/vendor/golang.org/x/sys/unix/asm_linux_s390x.s
index c46aab33..2c394b11 100644
--- a/vendor/golang.org/x/sys/unix/asm_linux_s390x.s
+++ b/vendor/golang.org/x/sys/unix/asm_linux_s390x.s
@@ -3,9 +3,6 @@
// license that can be found in the LICENSE file.
//go:build linux && s390x && gc
-// +build linux
-// +build s390x
-// +build gc
#include "textflag.h"
diff --git a/vendor/golang.org/x/sys/unix/asm_openbsd_mips64.s b/vendor/golang.org/x/sys/unix/asm_openbsd_mips64.s
index 5e7a1169..fab586a2 100644
--- a/vendor/golang.org/x/sys/unix/asm_openbsd_mips64.s
+++ b/vendor/golang.org/x/sys/unix/asm_openbsd_mips64.s
@@ -3,7 +3,6 @@
// license that can be found in the LICENSE file.
//go:build gc
-// +build gc
#include "textflag.h"
diff --git a/vendor/golang.org/x/sys/unix/asm_solaris_amd64.s b/vendor/golang.org/x/sys/unix/asm_solaris_amd64.s
index f8c5394c..f949ec54 100644
--- a/vendor/golang.org/x/sys/unix/asm_solaris_amd64.s
+++ b/vendor/golang.org/x/sys/unix/asm_solaris_amd64.s
@@ -3,7 +3,6 @@
// license that can be found in the LICENSE file.
//go:build gc
-// +build gc
#include "textflag.h"
diff --git a/vendor/golang.org/x/sys/unix/asm_zos_s390x.s b/vendor/golang.org/x/sys/unix/asm_zos_s390x.s
index 3b54e185..2f67ba86 100644
--- a/vendor/golang.org/x/sys/unix/asm_zos_s390x.s
+++ b/vendor/golang.org/x/sys/unix/asm_zos_s390x.s
@@ -3,9 +3,6 @@
// license that can be found in the LICENSE file.
//go:build zos && s390x && gc
-// +build zos
-// +build s390x
-// +build gc
#include "textflag.h"
diff --git a/vendor/golang.org/x/sys/unix/cap_freebsd.go b/vendor/golang.org/x/sys/unix/cap_freebsd.go
index 0b7c6adb..a0865789 100644
--- a/vendor/golang.org/x/sys/unix/cap_freebsd.go
+++ b/vendor/golang.org/x/sys/unix/cap_freebsd.go
@@ -3,7 +3,6 @@
// license that can be found in the LICENSE file.
//go:build freebsd
-// +build freebsd
package unix
diff --git a/vendor/golang.org/x/sys/unix/constants.go b/vendor/golang.org/x/sys/unix/constants.go
index 394a3965..6fb7cb77 100644
--- a/vendor/golang.org/x/sys/unix/constants.go
+++ b/vendor/golang.org/x/sys/unix/constants.go
@@ -3,7 +3,6 @@
// license that can be found in the LICENSE file.
//go:build aix || darwin || dragonfly || freebsd || linux || netbsd || openbsd || solaris || zos
-// +build aix darwin dragonfly freebsd linux netbsd openbsd solaris zos
package unix
diff --git a/vendor/golang.org/x/sys/unix/dev_aix_ppc.go b/vendor/golang.org/x/sys/unix/dev_aix_ppc.go
index 65a99850..d7851346 100644
--- a/vendor/golang.org/x/sys/unix/dev_aix_ppc.go
+++ b/vendor/golang.org/x/sys/unix/dev_aix_ppc.go
@@ -3,7 +3,6 @@
// license that can be found in the LICENSE file.
//go:build aix && ppc
-// +build aix,ppc
// Functions to access/create device major and minor numbers matching the
// encoding used by AIX.
diff --git a/vendor/golang.org/x/sys/unix/dev_aix_ppc64.go b/vendor/golang.org/x/sys/unix/dev_aix_ppc64.go
index 8fc08ad0..623a5e69 100644
--- a/vendor/golang.org/x/sys/unix/dev_aix_ppc64.go
+++ b/vendor/golang.org/x/sys/unix/dev_aix_ppc64.go
@@ -3,7 +3,6 @@
// license that can be found in the LICENSE file.
//go:build aix && ppc64
-// +build aix,ppc64
// Functions to access/create device major and minor numbers matching the
// encoding used AIX.
diff --git a/vendor/golang.org/x/sys/unix/dev_zos.go b/vendor/golang.org/x/sys/unix/dev_zos.go
index a388e59a..bb6a64fe 100644
--- a/vendor/golang.org/x/sys/unix/dev_zos.go
+++ b/vendor/golang.org/x/sys/unix/dev_zos.go
@@ -3,7 +3,6 @@
// license that can be found in the LICENSE file.
//go:build zos && s390x
-// +build zos,s390x
// Functions to access/create device major and minor numbers matching the
// encoding used by z/OS.
diff --git a/vendor/golang.org/x/sys/unix/dirent.go b/vendor/golang.org/x/sys/unix/dirent.go
index 2499f977..1ebf1178 100644
--- a/vendor/golang.org/x/sys/unix/dirent.go
+++ b/vendor/golang.org/x/sys/unix/dirent.go
@@ -3,7 +3,6 @@
// license that can be found in the LICENSE file.
//go:build aix || darwin || dragonfly || freebsd || linux || netbsd || openbsd || solaris || zos
-// +build aix darwin dragonfly freebsd linux netbsd openbsd solaris zos
package unix
diff --git a/vendor/golang.org/x/sys/unix/endian_big.go b/vendor/golang.org/x/sys/unix/endian_big.go
index a5202655..1095fd31 100644
--- a/vendor/golang.org/x/sys/unix/endian_big.go
+++ b/vendor/golang.org/x/sys/unix/endian_big.go
@@ -3,7 +3,6 @@
// license that can be found in the LICENSE file.
//
//go:build armbe || arm64be || m68k || mips || mips64 || mips64p32 || ppc || ppc64 || s390 || s390x || shbe || sparc || sparc64
-// +build armbe arm64be m68k mips mips64 mips64p32 ppc ppc64 s390 s390x shbe sparc sparc64
package unix
diff --git a/vendor/golang.org/x/sys/unix/endian_little.go b/vendor/golang.org/x/sys/unix/endian_little.go
index b0f2bc4a..b9f0e277 100644
--- a/vendor/golang.org/x/sys/unix/endian_little.go
+++ b/vendor/golang.org/x/sys/unix/endian_little.go
@@ -3,7 +3,6 @@
// license that can be found in the LICENSE file.
//
//go:build 386 || amd64 || amd64p32 || alpha || arm || arm64 || loong64 || mipsle || mips64le || mips64p32le || nios2 || ppc64le || riscv || riscv64 || sh
-// +build 386 amd64 amd64p32 alpha arm arm64 loong64 mipsle mips64le mips64p32le nios2 ppc64le riscv riscv64 sh
package unix
diff --git a/vendor/golang.org/x/sys/unix/env_unix.go b/vendor/golang.org/x/sys/unix/env_unix.go
index 29ccc4d1..a96da71f 100644
--- a/vendor/golang.org/x/sys/unix/env_unix.go
+++ b/vendor/golang.org/x/sys/unix/env_unix.go
@@ -3,7 +3,6 @@
// license that can be found in the LICENSE file.
//go:build aix || darwin || dragonfly || freebsd || linux || netbsd || openbsd || solaris || zos
-// +build aix darwin dragonfly freebsd linux netbsd openbsd solaris zos
// Unix environment variables.
diff --git a/vendor/golang.org/x/sys/unix/epoll_zos.go b/vendor/golang.org/x/sys/unix/epoll_zos.go
index cedaf7e0..7753fdde 100644
--- a/vendor/golang.org/x/sys/unix/epoll_zos.go
+++ b/vendor/golang.org/x/sys/unix/epoll_zos.go
@@ -3,7 +3,6 @@
// license that can be found in the LICENSE file.
//go:build zos && s390x
-// +build zos,s390x
package unix
diff --git a/vendor/golang.org/x/sys/unix/fcntl.go b/vendor/golang.org/x/sys/unix/fcntl.go
index e9b99125..6200876f 100644
--- a/vendor/golang.org/x/sys/unix/fcntl.go
+++ b/vendor/golang.org/x/sys/unix/fcntl.go
@@ -2,8 +2,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
-//go:build dragonfly || freebsd || linux || netbsd || openbsd
-// +build dragonfly freebsd linux netbsd openbsd
+//go:build dragonfly || freebsd || linux || netbsd
package unix
diff --git a/vendor/golang.org/x/sys/unix/fcntl_linux_32bit.go b/vendor/golang.org/x/sys/unix/fcntl_linux_32bit.go
index 29d44808..13b4acd5 100644
--- a/vendor/golang.org/x/sys/unix/fcntl_linux_32bit.go
+++ b/vendor/golang.org/x/sys/unix/fcntl_linux_32bit.go
@@ -3,7 +3,6 @@
// license that can be found in the LICENSE file.
//go:build (linux && 386) || (linux && arm) || (linux && mips) || (linux && mipsle) || (linux && ppc)
-// +build linux,386 linux,arm linux,mips linux,mipsle linux,ppc
package unix
diff --git a/vendor/golang.org/x/sys/unix/fdset.go b/vendor/golang.org/x/sys/unix/fdset.go
index a8068f94..9e83d18c 100644
--- a/vendor/golang.org/x/sys/unix/fdset.go
+++ b/vendor/golang.org/x/sys/unix/fdset.go
@@ -3,7 +3,6 @@
// license that can be found in the LICENSE file.
//go:build aix || darwin || dragonfly || freebsd || linux || netbsd || openbsd || solaris || zos
-// +build aix darwin dragonfly freebsd linux netbsd openbsd solaris zos
package unix
diff --git a/vendor/golang.org/x/sys/unix/fstatfs_zos.go b/vendor/golang.org/x/sys/unix/fstatfs_zos.go
index e377cc9f..c8bde601 100644
--- a/vendor/golang.org/x/sys/unix/fstatfs_zos.go
+++ b/vendor/golang.org/x/sys/unix/fstatfs_zos.go
@@ -3,7 +3,6 @@
// license that can be found in the LICENSE file.
//go:build zos && s390x
-// +build zos,s390x
package unix
diff --git a/vendor/golang.org/x/sys/unix/gccgo.go b/vendor/golang.org/x/sys/unix/gccgo.go
index b06f52d7..aca5721d 100644
--- a/vendor/golang.org/x/sys/unix/gccgo.go
+++ b/vendor/golang.org/x/sys/unix/gccgo.go
@@ -3,7 +3,6 @@
// license that can be found in the LICENSE file.
//go:build gccgo && !aix && !hurd
-// +build gccgo,!aix,!hurd
package unix
diff --git a/vendor/golang.org/x/sys/unix/gccgo_c.c b/vendor/golang.org/x/sys/unix/gccgo_c.c
index f98a1c54..d468b7b4 100644
--- a/vendor/golang.org/x/sys/unix/gccgo_c.c
+++ b/vendor/golang.org/x/sys/unix/gccgo_c.c
@@ -3,7 +3,6 @@
// license that can be found in the LICENSE file.
//go:build gccgo && !aix && !hurd
-// +build gccgo,!aix,!hurd
#include
#include
diff --git a/vendor/golang.org/x/sys/unix/gccgo_linux_amd64.go b/vendor/golang.org/x/sys/unix/gccgo_linux_amd64.go
index e60e49a3..972d61bd 100644
--- a/vendor/golang.org/x/sys/unix/gccgo_linux_amd64.go
+++ b/vendor/golang.org/x/sys/unix/gccgo_linux_amd64.go
@@ -3,7 +3,6 @@
// license that can be found in the LICENSE file.
//go:build gccgo && linux && amd64
-// +build gccgo,linux,amd64
package unix
diff --git a/vendor/golang.org/x/sys/unix/ifreq_linux.go b/vendor/golang.org/x/sys/unix/ifreq_linux.go
index 15721a51..848840ae 100644
--- a/vendor/golang.org/x/sys/unix/ifreq_linux.go
+++ b/vendor/golang.org/x/sys/unix/ifreq_linux.go
@@ -3,7 +3,6 @@
// license that can be found in the LICENSE file.
//go:build linux
-// +build linux
package unix
diff --git a/vendor/golang.org/x/sys/unix/ioctl_linux.go b/vendor/golang.org/x/sys/unix/ioctl_linux.go
index 0d12c085..dbe680ea 100644
--- a/vendor/golang.org/x/sys/unix/ioctl_linux.go
+++ b/vendor/golang.org/x/sys/unix/ioctl_linux.go
@@ -231,3 +231,8 @@ func IoctlLoopGetStatus64(fd int) (*LoopInfo64, error) {
func IoctlLoopSetStatus64(fd int, value *LoopInfo64) error {
return ioctlPtr(fd, LOOP_SET_STATUS64, unsafe.Pointer(value))
}
+
+// IoctlLoopConfigure configures all loop device parameters in a single step
+func IoctlLoopConfigure(fd int, value *LoopConfig) error {
+ return ioctlPtr(fd, LOOP_CONFIGURE, unsafe.Pointer(value))
+}
diff --git a/vendor/golang.org/x/sys/unix/ioctl_signed.go b/vendor/golang.org/x/sys/unix/ioctl_signed.go
index 7def9580..5b0759bd 100644
--- a/vendor/golang.org/x/sys/unix/ioctl_signed.go
+++ b/vendor/golang.org/x/sys/unix/ioctl_signed.go
@@ -3,7 +3,6 @@
// license that can be found in the LICENSE file.
//go:build aix || solaris
-// +build aix solaris
package unix
diff --git a/vendor/golang.org/x/sys/unix/ioctl_unsigned.go b/vendor/golang.org/x/sys/unix/ioctl_unsigned.go
index 649913d1..20f470b9 100644
--- a/vendor/golang.org/x/sys/unix/ioctl_unsigned.go
+++ b/vendor/golang.org/x/sys/unix/ioctl_unsigned.go
@@ -3,7 +3,6 @@
// license that can be found in the LICENSE file.
//go:build darwin || dragonfly || freebsd || hurd || linux || netbsd || openbsd
-// +build darwin dragonfly freebsd hurd linux netbsd openbsd
package unix
diff --git a/vendor/golang.org/x/sys/unix/ioctl_zos.go b/vendor/golang.org/x/sys/unix/ioctl_zos.go
index cdc21bf7..c8b2a750 100644
--- a/vendor/golang.org/x/sys/unix/ioctl_zos.go
+++ b/vendor/golang.org/x/sys/unix/ioctl_zos.go
@@ -3,7 +3,6 @@
// license that can be found in the LICENSE file.
//go:build zos && s390x
-// +build zos,s390x
package unix
diff --git a/vendor/golang.org/x/sys/unix/mkerrors.sh b/vendor/golang.org/x/sys/unix/mkerrors.sh
index 47fa6a7e..6202638b 100644
--- a/vendor/golang.org/x/sys/unix/mkerrors.sh
+++ b/vendor/golang.org/x/sys/unix/mkerrors.sh
@@ -519,6 +519,7 @@ ccflags="$@"
$2 ~ /^LOCK_(SH|EX|NB|UN)$/ ||
$2 ~ /^LO_(KEY|NAME)_SIZE$/ ||
$2 ~ /^LOOP_(CLR|CTL|GET|SET)_/ ||
+ $2 == "LOOP_CONFIGURE" ||
$2 ~ /^(AF|SOCK|SO|SOL|IPPROTO|IP|IPV6|TCP|MCAST|EVFILT|NOTE|SHUT|PROT|MAP|MREMAP|MFD|T?PACKET|MSG|SCM|MCL|DT|MADV|PR|LOCAL|TCPOPT|UDP)_/ ||
$2 ~ /^NFC_(GENL|PROTO|COMM|RF|SE|DIRECTION|LLCP|SOCKPROTO)_/ ||
$2 ~ /^NFC_.*_(MAX)?SIZE$/ ||
@@ -560,7 +561,7 @@ ccflags="$@"
$2 ~ /^RLIMIT_(AS|CORE|CPU|DATA|FSIZE|LOCKS|MEMLOCK|MSGQUEUE|NICE|NOFILE|NPROC|RSS|RTPRIO|RTTIME|SIGPENDING|STACK)|RLIM_INFINITY/ ||
$2 ~ /^PRIO_(PROCESS|PGRP|USER)/ ||
$2 ~ /^CLONE_[A-Z_]+/ ||
- $2 !~ /^(BPF_TIMEVAL|BPF_FIB_LOOKUP_[A-Z]+)$/ &&
+ $2 !~ /^(BPF_TIMEVAL|BPF_FIB_LOOKUP_[A-Z]+|BPF_F_LINK)$/ &&
$2 ~ /^(BPF|DLT)_/ ||
$2 ~ /^AUDIT_/ ||
$2 ~ /^(CLOCK|TIMER)_/ ||
@@ -663,7 +664,6 @@ echo '// mkerrors.sh' "$@"
echo '// Code generated by the command above; see README.md. DO NOT EDIT.'
echo
echo "//go:build ${GOARCH} && ${GOOS}"
-echo "// +build ${GOARCH},${GOOS}"
echo
go tool cgo -godefs -- "$@" _const.go >_error.out
cat _error.out | grep -vf _error.grep | grep -vf _signal.grep
diff --git a/vendor/golang.org/x/sys/unix/mmap_nomremap.go b/vendor/golang.org/x/sys/unix/mmap_nomremap.go
index ca051363..4b68e597 100644
--- a/vendor/golang.org/x/sys/unix/mmap_nomremap.go
+++ b/vendor/golang.org/x/sys/unix/mmap_nomremap.go
@@ -3,7 +3,6 @@
// license that can be found in the LICENSE file.
//go:build aix || darwin || dragonfly || freebsd || openbsd || solaris
-// +build aix darwin dragonfly freebsd openbsd solaris
package unix
diff --git a/vendor/golang.org/x/sys/unix/mremap.go b/vendor/golang.org/x/sys/unix/mremap.go
index fa93d0aa..fd45fe52 100644
--- a/vendor/golang.org/x/sys/unix/mremap.go
+++ b/vendor/golang.org/x/sys/unix/mremap.go
@@ -3,7 +3,6 @@
// license that can be found in the LICENSE file.
//go:build linux || netbsd
-// +build linux netbsd
package unix
diff --git a/vendor/golang.org/x/sys/unix/pagesize_unix.go b/vendor/golang.org/x/sys/unix/pagesize_unix.go
index 53f1b4c5..4d0a3430 100644
--- a/vendor/golang.org/x/sys/unix/pagesize_unix.go
+++ b/vendor/golang.org/x/sys/unix/pagesize_unix.go
@@ -3,7 +3,6 @@
// license that can be found in the LICENSE file.
//go:build aix || darwin || dragonfly || freebsd || linux || netbsd || openbsd || solaris
-// +build aix darwin dragonfly freebsd linux netbsd openbsd solaris
// For Unix, get the pagesize from the runtime.
diff --git a/vendor/golang.org/x/sys/unix/pledge_openbsd.go b/vendor/golang.org/x/sys/unix/pledge_openbsd.go
index eb48294b..6a09af53 100644
--- a/vendor/golang.org/x/sys/unix/pledge_openbsd.go
+++ b/vendor/golang.org/x/sys/unix/pledge_openbsd.go
@@ -8,54 +8,31 @@ import (
"errors"
"fmt"
"strconv"
- "syscall"
- "unsafe"
)
// 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.
+// This changes both the promises and execpromises; use PledgePromises or
+// PledgeExecpromises to only change the promises or execpromises
+// respectively.
//
// For more information see pledge(2).
func Pledge(promises, execpromises string) error {
- maj, min, err := majmin()
- if err != nil {
+ if err := pledgeAvailable(); err != nil {
return err
}
- err = pledgeAvailable(maj, min, execpromises)
+ pptr, err := BytePtrFromString(promises)
if err != nil {
return err
}
- pptr, err := syscall.BytePtrFromString(promises)
+ exptr, err := BytePtrFromString(execpromises)
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
- }
- expr = unsafe.Pointer(exptr)
- }
-
- _, _, e := syscall.Syscall(SYS_PLEDGE, uintptr(unsafe.Pointer(pptr)), uintptr(expr), 0)
- if e != 0 {
- return e
- }
-
- return nil
+ return pledge(pptr, exptr)
}
// PledgePromises implements the pledge syscall.
@@ -64,30 +41,16 @@ func Pledge(promises, execpromises string) error {
//
// 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 {
+ if err := pledgeAvailable(); err != nil {
return err
}
- // This variable holds the execpromises and is always nil.
- var expr unsafe.Pointer
-
- pptr, err := syscall.BytePtrFromString(promises)
+ pptr, err := 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
+ return pledge(pptr, nil)
}
// PledgeExecpromises implements the pledge syscall.
@@ -96,30 +59,16 @@ func PledgePromises(promises string) error {
//
// For more information see pledge(2).
func PledgeExecpromises(execpromises string) error {
- maj, min, err := majmin()
- if err != nil {
+ if err := pledgeAvailable(); err != nil {
return err
}
- err = pledgeAvailable(maj, min, execpromises)
+ exptr, err := BytePtrFromString(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
+ return pledge(nil, exptr)
}
// majmin returns major and minor version number for an OpenBSD system.
@@ -147,16 +96,15 @@ func majmin() (major int, minor int, err error) {
// 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)
+func pledgeAvailable() error {
+ maj, min, err := majmin()
+ if err != nil {
+ return err
}
- // 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)
+ // Require OpenBSD 6.4 as a minimum.
+ if maj < 6 || (maj == 6 && min <= 3) {
+ return fmt.Errorf("cannot call Pledge on OpenBSD %d.%d", maj, min)
}
return nil
diff --git a/vendor/golang.org/x/sys/unix/ptrace_darwin.go b/vendor/golang.org/x/sys/unix/ptrace_darwin.go
index 39dba6ca..3f0975f3 100644
--- a/vendor/golang.org/x/sys/unix/ptrace_darwin.go
+++ b/vendor/golang.org/x/sys/unix/ptrace_darwin.go
@@ -3,16 +3,9 @@
// license that can be found in the LICENSE file.
//go:build darwin && !ios
-// +build darwin,!ios
package unix
-import "unsafe"
-
func ptrace(request int, pid int, addr uintptr, data uintptr) error {
return ptrace1(request, pid, addr, data)
}
-
-func ptracePtr(request int, pid int, addr uintptr, data unsafe.Pointer) error {
- return ptrace1Ptr(request, pid, addr, data)
-}
diff --git a/vendor/golang.org/x/sys/unix/ptrace_ios.go b/vendor/golang.org/x/sys/unix/ptrace_ios.go
index 9ea66330..a4d35db5 100644
--- a/vendor/golang.org/x/sys/unix/ptrace_ios.go
+++ b/vendor/golang.org/x/sys/unix/ptrace_ios.go
@@ -3,16 +3,9 @@
// license that can be found in the LICENSE file.
//go:build ios
-// +build ios
package unix
-import "unsafe"
-
func ptrace(request int, pid int, addr uintptr, data uintptr) (err error) {
return ENOTSUP
}
-
-func ptracePtr(request int, pid int, addr uintptr, data unsafe.Pointer) (err error) {
- return ENOTSUP
-}
diff --git a/vendor/golang.org/x/sys/unix/race.go b/vendor/golang.org/x/sys/unix/race.go
index 6f6c5fec..714d2aae 100644
--- a/vendor/golang.org/x/sys/unix/race.go
+++ b/vendor/golang.org/x/sys/unix/race.go
@@ -3,7 +3,6 @@
// license that can be found in the LICENSE file.
//go:build (darwin && race) || (linux && race) || (freebsd && race)
-// +build darwin,race linux,race freebsd,race
package unix
diff --git a/vendor/golang.org/x/sys/unix/race0.go b/vendor/golang.org/x/sys/unix/race0.go
index 706e1322..4a9f6634 100644
--- a/vendor/golang.org/x/sys/unix/race0.go
+++ b/vendor/golang.org/x/sys/unix/race0.go
@@ -3,7 +3,6 @@
// license that can be found in the LICENSE file.
//go:build aix || (darwin && !race) || (linux && !race) || (freebsd && !race) || netbsd || openbsd || solaris || dragonfly || zos
-// +build aix darwin,!race linux,!race freebsd,!race netbsd openbsd solaris dragonfly zos
package unix
diff --git a/vendor/golang.org/x/sys/unix/readdirent_getdents.go b/vendor/golang.org/x/sys/unix/readdirent_getdents.go
index 4d625756..dbd2b6cc 100644
--- a/vendor/golang.org/x/sys/unix/readdirent_getdents.go
+++ b/vendor/golang.org/x/sys/unix/readdirent_getdents.go
@@ -3,7 +3,6 @@
// license that can be found in the LICENSE file.
//go:build aix || dragonfly || freebsd || linux || netbsd || openbsd
-// +build aix dragonfly freebsd linux netbsd openbsd
package unix
diff --git a/vendor/golang.org/x/sys/unix/readdirent_getdirentries.go b/vendor/golang.org/x/sys/unix/readdirent_getdirentries.go
index 2a4ba47c..130398b6 100644
--- a/vendor/golang.org/x/sys/unix/readdirent_getdirentries.go
+++ b/vendor/golang.org/x/sys/unix/readdirent_getdirentries.go
@@ -3,7 +3,6 @@
// license that can be found in the LICENSE file.
//go:build darwin
-// +build darwin
package unix
diff --git a/vendor/golang.org/x/sys/unix/sockcmsg_unix.go b/vendor/golang.org/x/sys/unix/sockcmsg_unix.go
index 3865943f..c3a62dbb 100644
--- a/vendor/golang.org/x/sys/unix/sockcmsg_unix.go
+++ b/vendor/golang.org/x/sys/unix/sockcmsg_unix.go
@@ -3,7 +3,6 @@
// license that can be found in the LICENSE file.
//go:build aix || darwin || dragonfly || freebsd || linux || netbsd || openbsd || solaris || zos
-// +build aix darwin dragonfly freebsd linux netbsd openbsd solaris zos
// Socket control messages
diff --git a/vendor/golang.org/x/sys/unix/sockcmsg_unix_other.go b/vendor/golang.org/x/sys/unix/sockcmsg_unix_other.go
index 0840fe4a..4a1eab37 100644
--- a/vendor/golang.org/x/sys/unix/sockcmsg_unix_other.go
+++ b/vendor/golang.org/x/sys/unix/sockcmsg_unix_other.go
@@ -3,7 +3,6 @@
// license that can be found in the LICENSE file.
//go:build aix || darwin || freebsd || linux || netbsd || openbsd || solaris || zos
-// +build aix darwin freebsd linux netbsd openbsd solaris zos
package unix
diff --git a/vendor/golang.org/x/sys/unix/syscall.go b/vendor/golang.org/x/sys/unix/syscall.go
index 63e8c838..5ea74da9 100644
--- a/vendor/golang.org/x/sys/unix/syscall.go
+++ b/vendor/golang.org/x/sys/unix/syscall.go
@@ -3,7 +3,6 @@
// license that can be found in the LICENSE file.
//go:build aix || darwin || dragonfly || freebsd || linux || netbsd || openbsd || solaris || zos
-// +build aix darwin dragonfly freebsd linux netbsd openbsd solaris zos
// Package unix contains an interface to the low-level operating system
// primitives. OS details vary depending on the underlying system, and
diff --git a/vendor/golang.org/x/sys/unix/syscall_aix.go b/vendor/golang.org/x/sys/unix/syscall_aix.go
index 9a6e5aca..67ce6cef 100644
--- a/vendor/golang.org/x/sys/unix/syscall_aix.go
+++ b/vendor/golang.org/x/sys/unix/syscall_aix.go
@@ -3,7 +3,6 @@
// license that can be found in the LICENSE file.
//go:build aix
-// +build aix
// Aix system calls.
// This file is compiled as ordinary Go code,
@@ -107,7 +106,8 @@ func (sa *SockaddrUnix) sockaddr() (unsafe.Pointer, _Socklen, error) {
if n > 0 {
sl += _Socklen(n) + 1
}
- if sa.raw.Path[0] == '@' {
+ if sa.raw.Path[0] == '@' || (sa.raw.Path[0] == 0 && sl > 3) {
+ // Check sl > 3 so we don't change unnamed socket behavior.
sa.raw.Path[0] = 0
// Don't count trailing NUL for abstract address.
sl--
@@ -487,8 +487,6 @@ func Fsync(fd int) 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
diff --git a/vendor/golang.org/x/sys/unix/syscall_aix_ppc.go b/vendor/golang.org/x/sys/unix/syscall_aix_ppc.go
index f2871fa9..1fdaa476 100644
--- a/vendor/golang.org/x/sys/unix/syscall_aix_ppc.go
+++ b/vendor/golang.org/x/sys/unix/syscall_aix_ppc.go
@@ -3,7 +3,6 @@
// license that can be found in the LICENSE file.
//go:build aix && ppc
-// +build aix,ppc
package unix
diff --git a/vendor/golang.org/x/sys/unix/syscall_aix_ppc64.go b/vendor/golang.org/x/sys/unix/syscall_aix_ppc64.go
index 75718ec0..c87f9a9f 100644
--- a/vendor/golang.org/x/sys/unix/syscall_aix_ppc64.go
+++ b/vendor/golang.org/x/sys/unix/syscall_aix_ppc64.go
@@ -3,7 +3,6 @@
// license that can be found in the LICENSE file.
//go:build aix && ppc64
-// +build aix,ppc64
package unix
diff --git a/vendor/golang.org/x/sys/unix/syscall_bsd.go b/vendor/golang.org/x/sys/unix/syscall_bsd.go
index 4217de51..a00c3e54 100644
--- a/vendor/golang.org/x/sys/unix/syscall_bsd.go
+++ b/vendor/golang.org/x/sys/unix/syscall_bsd.go
@@ -3,7 +3,6 @@
// license that can be found in the LICENSE file.
//go:build darwin || dragonfly || freebsd || netbsd || openbsd
-// +build darwin dragonfly freebsd netbsd openbsd
// BSD system call wrappers shared by *BSD based systems
// including OS X (Darwin) and FreeBSD. Like the other
@@ -317,7 +316,7 @@ func GetsockoptString(fd, level, opt int) (string, error) {
if err != nil {
return "", err
}
- return string(buf[:vallen-1]), nil
+ return ByteSliceToString(buf[:vallen]), nil
}
//sys recvfrom(fd int, p []byte, flags int, from *RawSockaddrAny, fromlen *_Socklen) (n int, err error)
diff --git a/vendor/golang.org/x/sys/unix/syscall_darwin.go b/vendor/golang.org/x/sys/unix/syscall_darwin.go
index 135cc3cd..59542a89 100644
--- a/vendor/golang.org/x/sys/unix/syscall_darwin.go
+++ b/vendor/golang.org/x/sys/unix/syscall_darwin.go
@@ -644,189 +644,3 @@ func SysctlKinfoProcSlice(name string, args ...int) ([]KinfoProc, 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)
//sys munmap(addr uintptr, length uintptr) (err error)
-//sys readlen(fd int, buf *byte, nbuf int) (n int, err error) = SYS_READ
-//sys writelen(fd int, buf *byte, nbuf int) (n int, err error) = SYS_WRITE
-
-/*
- * Unimplemented
- */
-// Profil
-// Sigaction
-// Sigprocmask
-// Getlogin
-// Sigpending
-// Sigaltstack
-// Ioctl
-// Reboot
-// Execve
-// Vfork
-// Sbrk
-// Sstk
-// Ovadvise
-// Mincore
-// Setitimer
-// Swapon
-// Select
-// Sigsuspend
-// Readv
-// Writev
-// Nfssvc
-// Getfh
-// Quotactl
-// Csops
-// Waitid
-// Add_profil
-// Kdebug_trace
-// Sigreturn
-// Atsocket
-// Kqueue_from_portset_np
-// Kqueue_portset
-// Getattrlist
-// Getdirentriesattr
-// Searchfs
-// Delete
-// Copyfile
-// Watchevent
-// Waitevent
-// Modwatch
-// Fsctl
-// Initgroups
-// Posix_spawn
-// Nfsclnt
-// Fhopen
-// Minherit
-// Semsys
-// Msgsys
-// Shmsys
-// Semctl
-// Semget
-// Semop
-// Msgctl
-// Msgget
-// Msgsnd
-// Msgrcv
-// Shm_open
-// Shm_unlink
-// Sem_open
-// Sem_close
-// Sem_unlink
-// Sem_wait
-// Sem_trywait
-// Sem_post
-// Sem_getvalue
-// Sem_init
-// Sem_destroy
-// Open_extended
-// Umask_extended
-// Stat_extended
-// Lstat_extended
-// Fstat_extended
-// Chmod_extended
-// Fchmod_extended
-// Access_extended
-// Settid
-// Gettid
-// Setsgroups
-// Getsgroups
-// Setwgroups
-// Getwgroups
-// Mkfifo_extended
-// Mkdir_extended
-// Identitysvc
-// Shared_region_check_np
-// Shared_region_map_np
-// __pthread_mutex_destroy
-// __pthread_mutex_init
-// __pthread_mutex_lock
-// __pthread_mutex_trylock
-// __pthread_mutex_unlock
-// __pthread_cond_init
-// __pthread_cond_destroy
-// __pthread_cond_broadcast
-// __pthread_cond_signal
-// Setsid_with_pid
-// __pthread_cond_timedwait
-// Aio_fsync
-// Aio_return
-// Aio_suspend
-// Aio_cancel
-// Aio_error
-// Aio_read
-// Aio_write
-// Lio_listio
-// __pthread_cond_wait
-// Iopolicysys
-// __pthread_kill
-// __pthread_sigmask
-// __sigwait
-// __disable_threadsignal
-// __pthread_markcancel
-// __pthread_canceled
-// __semwait_signal
-// Proc_info
-// sendfile
-// Stat64_extended
-// Lstat64_extended
-// Fstat64_extended
-// __pthread_chdir
-// __pthread_fchdir
-// Audit
-// Auditon
-// Getauid
-// Setauid
-// Getaudit
-// Setaudit
-// Getaudit_addr
-// Setaudit_addr
-// Auditctl
-// Bsdthread_create
-// Bsdthread_terminate
-// Stack_snapshot
-// Bsdthread_register
-// Workq_open
-// Workq_ops
-// __mac_execve
-// __mac_syscall
-// __mac_get_file
-// __mac_set_file
-// __mac_get_link
-// __mac_set_link
-// __mac_get_proc
-// __mac_set_proc
-// __mac_get_fd
-// __mac_set_fd
-// __mac_get_pid
-// __mac_get_lcid
-// __mac_get_lctx
-// __mac_set_lctx
-// Setlcid
-// Read_nocancel
-// Write_nocancel
-// Open_nocancel
-// Close_nocancel
-// Wait4_nocancel
-// Recvmsg_nocancel
-// Sendmsg_nocancel
-// Recvfrom_nocancel
-// Accept_nocancel
-// Fcntl_nocancel
-// Select_nocancel
-// Fsync_nocancel
-// Connect_nocancel
-// Sigsuspend_nocancel
-// Readv_nocancel
-// Writev_nocancel
-// Sendto_nocancel
-// Pread_nocancel
-// Pwrite_nocancel
-// Waitid_nocancel
-// Poll_nocancel
-// Msgsnd_nocancel
-// Msgrcv_nocancel
-// Sem_wait_nocancel
-// Aio_suspend_nocancel
-// __sigwait_nocancel
-// __semwait_signal_nocancel
-// __mac_mount
-// __mac_get_mount
-// __mac_getfsstat
diff --git a/vendor/golang.org/x/sys/unix/syscall_darwin_amd64.go b/vendor/golang.org/x/sys/unix/syscall_darwin_amd64.go
index 9fa87980..0eaecf5f 100644
--- a/vendor/golang.org/x/sys/unix/syscall_darwin_amd64.go
+++ b/vendor/golang.org/x/sys/unix/syscall_darwin_amd64.go
@@ -3,7 +3,6 @@
// license that can be found in the LICENSE file.
//go:build amd64 && darwin
-// +build amd64,darwin
package unix
@@ -47,6 +46,5 @@ func Syscall9(num, a1, a2, a3, a4, a5, a6, a7, a8, a9 uintptr) (r1, r2 uintptr,
//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 ptrace1(request int, pid int, addr uintptr, data uintptr) (err error) = SYS_ptrace
-//sys ptrace1Ptr(request int, pid int, addr unsafe.Pointer, data uintptr) (err error) = SYS_ptrace
//sys Stat(path string, stat *Stat_t) (err error) = SYS_STAT64
//sys Statfs(path string, stat *Statfs_t) (err error) = SYS_STATFS64
diff --git a/vendor/golang.org/x/sys/unix/syscall_darwin_arm64.go b/vendor/golang.org/x/sys/unix/syscall_darwin_arm64.go
index f17b8c52..f36c6707 100644
--- a/vendor/golang.org/x/sys/unix/syscall_darwin_arm64.go
+++ b/vendor/golang.org/x/sys/unix/syscall_darwin_arm64.go
@@ -3,7 +3,6 @@
// license that can be found in the LICENSE file.
//go:build arm64 && darwin
-// +build arm64,darwin
package unix
@@ -47,6 +46,5 @@ func Syscall9(num, a1, a2, a3, a4, a5, a6, a7, a8, a9 uintptr) (r1, r2 uintptr,
//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 ptrace1(request int, pid int, addr uintptr, data uintptr) (err error) = SYS_ptrace
-//sys ptrace1Ptr(request int, pid int, addr unsafe.Pointer, data uintptr) (err error) = SYS_ptrace
//sys Stat(path string, stat *Stat_t) (err error)
//sys Statfs(path string, stat *Statfs_t) (err error)
diff --git a/vendor/golang.org/x/sys/unix/syscall_darwin_libSystem.go b/vendor/golang.org/x/sys/unix/syscall_darwin_libSystem.go
index 53c96641..16dc6993 100644
--- a/vendor/golang.org/x/sys/unix/syscall_darwin_libSystem.go
+++ b/vendor/golang.org/x/sys/unix/syscall_darwin_libSystem.go
@@ -3,7 +3,6 @@
// license that can be found in the LICENSE file.
//go:build darwin && go1.12
-// +build darwin,go1.12
package unix
diff --git a/vendor/golang.org/x/sys/unix/syscall_dragonfly.go b/vendor/golang.org/x/sys/unix/syscall_dragonfly.go
index d4ce988e..97cb916f 100644
--- a/vendor/golang.org/x/sys/unix/syscall_dragonfly.go
+++ b/vendor/golang.org/x/sys/unix/syscall_dragonfly.go
@@ -343,203 +343,5 @@ func Sendfile(outfd int, infd int, offset *int64, count int) (written int, err e
//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)
//sys munmap(addr uintptr, length uintptr) (err error)
-//sys readlen(fd int, buf *byte, nbuf int) (n int, err error) = SYS_READ
-//sys writelen(fd int, buf *byte, nbuf int) (n int, err error) = SYS_WRITE
//sys accept4(fd int, rsa *RawSockaddrAny, addrlen *_Socklen, flags int) (nfd int, err error)
//sys utimensat(dirfd int, path string, times *[2]Timespec, flags int) (err error)
-
-/*
- * Unimplemented
- * TODO(jsing): Update this list for DragonFly.
- */
-// Profil
-// Sigaction
-// Sigprocmask
-// Getlogin
-// Sigpending
-// Sigaltstack
-// Reboot
-// Execve
-// Vfork
-// Sbrk
-// Sstk
-// Ovadvise
-// Mincore
-// Setitimer
-// Swapon
-// Select
-// Sigsuspend
-// Readv
-// Writev
-// Nfssvc
-// Getfh
-// Quotactl
-// Mount
-// Csops
-// Waitid
-// Add_profil
-// Kdebug_trace
-// Sigreturn
-// Atsocket
-// Kqueue_from_portset_np
-// Kqueue_portset
-// Getattrlist
-// Setattrlist
-// Getdirentriesattr
-// Searchfs
-// Delete
-// Copyfile
-// Watchevent
-// Waitevent
-// Modwatch
-// Getxattr
-// Fgetxattr
-// Setxattr
-// Fsetxattr
-// Removexattr
-// Fremovexattr
-// Listxattr
-// Flistxattr
-// Fsctl
-// Initgroups
-// Posix_spawn
-// Nfsclnt
-// Fhopen
-// Minherit
-// Semsys
-// Msgsys
-// Shmsys
-// Semctl
-// Semget
-// Semop
-// Msgctl
-// Msgget
-// Msgsnd
-// Msgrcv
-// Shmat
-// Shmctl
-// Shmdt
-// Shmget
-// Shm_open
-// Shm_unlink
-// Sem_open
-// Sem_close
-// Sem_unlink
-// Sem_wait
-// Sem_trywait
-// Sem_post
-// Sem_getvalue
-// Sem_init
-// Sem_destroy
-// Open_extended
-// Umask_extended
-// Stat_extended
-// Lstat_extended
-// Fstat_extended
-// Chmod_extended
-// Fchmod_extended
-// Access_extended
-// Settid
-// Gettid
-// Setsgroups
-// Getsgroups
-// Setwgroups
-// Getwgroups
-// Mkfifo_extended
-// Mkdir_extended
-// Identitysvc
-// Shared_region_check_np
-// Shared_region_map_np
-// __pthread_mutex_destroy
-// __pthread_mutex_init
-// __pthread_mutex_lock
-// __pthread_mutex_trylock
-// __pthread_mutex_unlock
-// __pthread_cond_init
-// __pthread_cond_destroy
-// __pthread_cond_broadcast
-// __pthread_cond_signal
-// Setsid_with_pid
-// __pthread_cond_timedwait
-// Aio_fsync
-// Aio_return
-// Aio_suspend
-// Aio_cancel
-// Aio_error
-// Aio_read
-// Aio_write
-// Lio_listio
-// __pthread_cond_wait
-// Iopolicysys
-// __pthread_kill
-// __pthread_sigmask
-// __sigwait
-// __disable_threadsignal
-// __pthread_markcancel
-// __pthread_canceled
-// __semwait_signal
-// Proc_info
-// Stat64_extended
-// Lstat64_extended
-// Fstat64_extended
-// __pthread_chdir
-// __pthread_fchdir
-// Audit
-// Auditon
-// Getauid
-// Setauid
-// Getaudit
-// Setaudit
-// Getaudit_addr
-// Setaudit_addr
-// Auditctl
-// Bsdthread_create
-// Bsdthread_terminate
-// Stack_snapshot
-// Bsdthread_register
-// Workq_open
-// Workq_ops
-// __mac_execve
-// __mac_syscall
-// __mac_get_file
-// __mac_set_file
-// __mac_get_link
-// __mac_set_link
-// __mac_get_proc
-// __mac_set_proc
-// __mac_get_fd
-// __mac_set_fd
-// __mac_get_pid
-// __mac_get_lcid
-// __mac_get_lctx
-// __mac_set_lctx
-// Setlcid
-// Read_nocancel
-// Write_nocancel
-// Open_nocancel
-// Close_nocancel
-// Wait4_nocancel
-// Recvmsg_nocancel
-// Sendmsg_nocancel
-// Recvfrom_nocancel
-// Accept_nocancel
-// Fcntl_nocancel
-// Select_nocancel
-// Fsync_nocancel
-// Connect_nocancel
-// Sigsuspend_nocancel
-// Readv_nocancel
-// Writev_nocancel
-// Sendto_nocancel
-// Pread_nocancel
-// Pwrite_nocancel
-// Waitid_nocancel
-// Msgsnd_nocancel
-// Msgrcv_nocancel
-// Sem_wait_nocancel
-// Aio_suspend_nocancel
-// __sigwait_nocancel
-// __semwait_signal_nocancel
-// __mac_mount
-// __mac_get_mount
-// __mac_getfsstat
diff --git a/vendor/golang.org/x/sys/unix/syscall_dragonfly_amd64.go b/vendor/golang.org/x/sys/unix/syscall_dragonfly_amd64.go
index 4e2d3212..14bab6b2 100644
--- a/vendor/golang.org/x/sys/unix/syscall_dragonfly_amd64.go
+++ b/vendor/golang.org/x/sys/unix/syscall_dragonfly_amd64.go
@@ -3,7 +3,6 @@
// license that can be found in the LICENSE file.
//go:build amd64 && dragonfly
-// +build amd64,dragonfly
package unix
diff --git a/vendor/golang.org/x/sys/unix/syscall_freebsd.go b/vendor/golang.org/x/sys/unix/syscall_freebsd.go
index afb10106..64d1bb4d 100644
--- a/vendor/golang.org/x/sys/unix/syscall_freebsd.go
+++ b/vendor/golang.org/x/sys/unix/syscall_freebsd.go
@@ -449,197 +449,5 @@ func Dup3(oldfd, newfd, flags int) 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)
//sys munmap(addr uintptr, length uintptr) (err error)
-//sys readlen(fd int, buf *byte, nbuf int) (n int, err error) = SYS_READ
-//sys writelen(fd int, buf *byte, nbuf int) (n int, err error) = SYS_WRITE
//sys accept4(fd int, rsa *RawSockaddrAny, addrlen *_Socklen, flags int) (nfd int, err error)
//sys utimensat(dirfd int, path string, times *[2]Timespec, flags int) (err error)
-
-/*
- * Unimplemented
- */
-// Profil
-// Sigaction
-// Sigprocmask
-// Getlogin
-// Sigpending
-// Sigaltstack
-// Ioctl
-// Reboot
-// Execve
-// Vfork
-// Sbrk
-// Sstk
-// Ovadvise
-// Mincore
-// Setitimer
-// Swapon
-// Select
-// Sigsuspend
-// Readv
-// Writev
-// Nfssvc
-// Getfh
-// Quotactl
-// Mount
-// Csops
-// Waitid
-// Add_profil
-// Kdebug_trace
-// Sigreturn
-// Atsocket
-// Kqueue_from_portset_np
-// Kqueue_portset
-// Getattrlist
-// Setattrlist
-// Getdents
-// Getdirentriesattr
-// Searchfs
-// Delete
-// Copyfile
-// Watchevent
-// Waitevent
-// Modwatch
-// Fsctl
-// Initgroups
-// Posix_spawn
-// Nfsclnt
-// Fhopen
-// Minherit
-// Semsys
-// Msgsys
-// Shmsys
-// Semctl
-// Semget
-// Semop
-// Msgctl
-// Msgget
-// Msgsnd
-// Msgrcv
-// Shmat
-// Shmctl
-// Shmdt
-// Shmget
-// Shm_open
-// Shm_unlink
-// Sem_open
-// Sem_close
-// Sem_unlink
-// Sem_wait
-// Sem_trywait
-// Sem_post
-// Sem_getvalue
-// Sem_init
-// Sem_destroy
-// Open_extended
-// Umask_extended
-// Stat_extended
-// Lstat_extended
-// Fstat_extended
-// Chmod_extended
-// Fchmod_extended
-// Access_extended
-// Settid
-// Gettid
-// Setsgroups
-// Getsgroups
-// Setwgroups
-// Getwgroups
-// Mkfifo_extended
-// Mkdir_extended
-// Identitysvc
-// Shared_region_check_np
-// Shared_region_map_np
-// __pthread_mutex_destroy
-// __pthread_mutex_init
-// __pthread_mutex_lock
-// __pthread_mutex_trylock
-// __pthread_mutex_unlock
-// __pthread_cond_init
-// __pthread_cond_destroy
-// __pthread_cond_broadcast
-// __pthread_cond_signal
-// Setsid_with_pid
-// __pthread_cond_timedwait
-// Aio_fsync
-// Aio_return
-// Aio_suspend
-// Aio_cancel
-// Aio_error
-// Aio_read
-// Aio_write
-// Lio_listio
-// __pthread_cond_wait
-// Iopolicysys
-// __pthread_kill
-// __pthread_sigmask
-// __sigwait
-// __disable_threadsignal
-// __pthread_markcancel
-// __pthread_canceled
-// __semwait_signal
-// Proc_info
-// Stat64_extended
-// Lstat64_extended
-// Fstat64_extended
-// __pthread_chdir
-// __pthread_fchdir
-// Audit
-// Auditon
-// Getauid
-// Setauid
-// Getaudit
-// Setaudit
-// Getaudit_addr
-// Setaudit_addr
-// Auditctl
-// Bsdthread_create
-// Bsdthread_terminate
-// Stack_snapshot
-// Bsdthread_register
-// Workq_open
-// Workq_ops
-// __mac_execve
-// __mac_syscall
-// __mac_get_file
-// __mac_set_file
-// __mac_get_link
-// __mac_set_link
-// __mac_get_proc
-// __mac_set_proc
-// __mac_get_fd
-// __mac_set_fd
-// __mac_get_pid
-// __mac_get_lcid
-// __mac_get_lctx
-// __mac_set_lctx
-// Setlcid
-// Read_nocancel
-// Write_nocancel
-// Open_nocancel
-// Close_nocancel
-// Wait4_nocancel
-// Recvmsg_nocancel
-// Sendmsg_nocancel
-// Recvfrom_nocancel
-// Accept_nocancel
-// Fcntl_nocancel
-// Select_nocancel
-// Fsync_nocancel
-// Connect_nocancel
-// Sigsuspend_nocancel
-// Readv_nocancel
-// Writev_nocancel
-// Sendto_nocancel
-// Pread_nocancel
-// Pwrite_nocancel
-// Waitid_nocancel
-// Poll_nocancel
-// Msgsnd_nocancel
-// Msgrcv_nocancel
-// Sem_wait_nocancel
-// Aio_suspend_nocancel
-// __sigwait_nocancel
-// __semwait_signal_nocancel
-// __mac_mount
-// __mac_get_mount
-// __mac_getfsstat
diff --git a/vendor/golang.org/x/sys/unix/syscall_freebsd_386.go b/vendor/golang.org/x/sys/unix/syscall_freebsd_386.go
index b8da5100..3967bca7 100644
--- a/vendor/golang.org/x/sys/unix/syscall_freebsd_386.go
+++ b/vendor/golang.org/x/sys/unix/syscall_freebsd_386.go
@@ -3,7 +3,6 @@
// license that can be found in the LICENSE file.
//go:build 386 && freebsd
-// +build 386,freebsd
package unix
diff --git a/vendor/golang.org/x/sys/unix/syscall_freebsd_amd64.go b/vendor/golang.org/x/sys/unix/syscall_freebsd_amd64.go
index 47155c48..eff19ada 100644
--- a/vendor/golang.org/x/sys/unix/syscall_freebsd_amd64.go
+++ b/vendor/golang.org/x/sys/unix/syscall_freebsd_amd64.go
@@ -3,7 +3,6 @@
// license that can be found in the LICENSE file.
//go:build amd64 && freebsd
-// +build amd64,freebsd
package unix
diff --git a/vendor/golang.org/x/sys/unix/syscall_freebsd_arm.go b/vendor/golang.org/x/sys/unix/syscall_freebsd_arm.go
index 08932093..4f24b517 100644
--- a/vendor/golang.org/x/sys/unix/syscall_freebsd_arm.go
+++ b/vendor/golang.org/x/sys/unix/syscall_freebsd_arm.go
@@ -3,7 +3,6 @@
// license that can be found in the LICENSE file.
//go:build arm && freebsd
-// +build arm,freebsd
package unix
diff --git a/vendor/golang.org/x/sys/unix/syscall_freebsd_arm64.go b/vendor/golang.org/x/sys/unix/syscall_freebsd_arm64.go
index d151a0d0..ac30759e 100644
--- a/vendor/golang.org/x/sys/unix/syscall_freebsd_arm64.go
+++ b/vendor/golang.org/x/sys/unix/syscall_freebsd_arm64.go
@@ -3,7 +3,6 @@
// license that can be found in the LICENSE file.
//go:build arm64 && freebsd
-// +build arm64,freebsd
package unix
diff --git a/vendor/golang.org/x/sys/unix/syscall_freebsd_riscv64.go b/vendor/golang.org/x/sys/unix/syscall_freebsd_riscv64.go
index d5cd64b3..aab725ca 100644
--- a/vendor/golang.org/x/sys/unix/syscall_freebsd_riscv64.go
+++ b/vendor/golang.org/x/sys/unix/syscall_freebsd_riscv64.go
@@ -3,7 +3,6 @@
// license that can be found in the LICENSE file.
//go:build riscv64 && freebsd
-// +build riscv64,freebsd
package unix
diff --git a/vendor/golang.org/x/sys/unix/syscall_hurd.go b/vendor/golang.org/x/sys/unix/syscall_hurd.go
index 381fd467..ba46651f 100644
--- a/vendor/golang.org/x/sys/unix/syscall_hurd.go
+++ b/vendor/golang.org/x/sys/unix/syscall_hurd.go
@@ -3,7 +3,6 @@
// license that can be found in the LICENSE file.
//go:build hurd
-// +build hurd
package unix
diff --git a/vendor/golang.org/x/sys/unix/syscall_hurd_386.go b/vendor/golang.org/x/sys/unix/syscall_hurd_386.go
index 7cf54a3e..df89f9e6 100644
--- a/vendor/golang.org/x/sys/unix/syscall_hurd_386.go
+++ b/vendor/golang.org/x/sys/unix/syscall_hurd_386.go
@@ -3,7 +3,6 @@
// license that can be found in the LICENSE file.
//go:build 386 && hurd
-// +build 386,hurd
package unix
diff --git a/vendor/golang.org/x/sys/unix/syscall_illumos.go b/vendor/golang.org/x/sys/unix/syscall_illumos.go
index 87db5a6a..a863f705 100644
--- a/vendor/golang.org/x/sys/unix/syscall_illumos.go
+++ b/vendor/golang.org/x/sys/unix/syscall_illumos.go
@@ -5,7 +5,6 @@
// illumos system calls not present on Solaris.
//go:build amd64 && illumos
-// +build amd64,illumos
package unix
diff --git a/vendor/golang.org/x/sys/unix/syscall_linux.go b/vendor/golang.org/x/sys/unix/syscall_linux.go
index 0ba03019..0f85e29e 100644
--- a/vendor/golang.org/x/sys/unix/syscall_linux.go
+++ b/vendor/golang.org/x/sys/unix/syscall_linux.go
@@ -61,15 +61,23 @@ func FanotifyMark(fd int, flags uint, mask uint64, dirFd int, pathname string) (
}
//sys fchmodat(dirfd int, path string, mode uint32) (err error)
-
-func Fchmodat(dirfd int, path string, mode uint32, flags int) (err error) {
- // Linux fchmodat doesn't support the flags parameter. Mimick glibc's behavior
- // and check the flags. Otherwise the mode would be applied to the symlink
- // destination which is not what the user expects.
- if flags&^AT_SYMLINK_NOFOLLOW != 0 {
- return EINVAL
- } else if flags&AT_SYMLINK_NOFOLLOW != 0 {
- return EOPNOTSUPP
+//sys fchmodat2(dirfd int, path string, mode uint32, flags int) (err error)
+
+func Fchmodat(dirfd int, path string, mode uint32, flags int) error {
+ // Linux fchmodat doesn't support the flags parameter, but fchmodat2 does.
+ // Try fchmodat2 if flags are specified.
+ if flags != 0 {
+ err := fchmodat2(dirfd, path, mode, flags)
+ if err == ENOSYS {
+ // fchmodat2 isn't available. If the flags are known to be valid,
+ // return EOPNOTSUPP to indicate that fchmodat doesn't support them.
+ if flags&^(AT_SYMLINK_NOFOLLOW|AT_EMPTY_PATH) != 0 {
+ return EINVAL
+ } else if flags&(AT_SYMLINK_NOFOLLOW|AT_EMPTY_PATH) != 0 {
+ return EOPNOTSUPP
+ }
+ }
+ return err
}
return fchmodat(dirfd, path, mode)
}
@@ -417,7 +425,8 @@ func (sa *SockaddrUnix) sockaddr() (unsafe.Pointer, _Socklen, error) {
if n > 0 {
sl += _Socklen(n) + 1
}
- if sa.raw.Path[0] == '@' {
+ if sa.raw.Path[0] == '@' || (sa.raw.Path[0] == 0 && sl > 3) {
+ // Check sl > 3 so we don't change unnamed socket behavior.
sa.raw.Path[0] = 0
// Don't count trailing NUL for abstract address.
sl--
@@ -693,10 +702,10 @@ type SockaddrALG struct {
func (sa *SockaddrALG) sockaddr() (unsafe.Pointer, _Socklen, error) {
// Leave room for NUL byte terminator.
- if len(sa.Type) > 13 {
+ if len(sa.Type) > len(sa.raw.Type)-1 {
return nil, 0, EINVAL
}
- if len(sa.Name) > 63 {
+ if len(sa.Name) > len(sa.raw.Name)-1 {
return nil, 0, EINVAL
}
@@ -704,17 +713,8 @@ func (sa *SockaddrALG) sockaddr() (unsafe.Pointer, _Socklen, error) {
sa.raw.Feat = sa.Feature
sa.raw.Mask = sa.Mask
- typ, err := ByteSliceFromString(sa.Type)
- if err != nil {
- return nil, 0, err
- }
- name, err := ByteSliceFromString(sa.Name)
- if err != nil {
- return nil, 0, err
- }
-
- copy(sa.raw.Type[:], typ)
- copy(sa.raw.Name[:], name)
+ copy(sa.raw.Type[:], sa.Type)
+ copy(sa.raw.Name[:], sa.Name)
return unsafe.Pointer(&sa.raw), SizeofSockaddrALG, nil
}
@@ -1310,7 +1310,7 @@ func GetsockoptString(fd, level, opt int) (string, error) {
return "", err
}
}
- return string(buf[:vallen-1]), nil
+ return ByteSliceToString(buf[:vallen]), nil
}
func GetsockoptTpacketStats(fd, level, opt int) (*TpacketStats, error) {
@@ -1988,8 +1988,6 @@ func Signalfd(fd int, sigmask *Sigset_t, flags int) (newfd int, err error) {
//sys Unshare(flags int) (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
-//sys writelen(fd int, p *byte, np int) (n int, err error) = SYS_WRITE
//sys readv(fd int, iovs []Iovec) (n int, err error) = SYS_READV
//sys writev(fd int, iovs []Iovec) (n int, err error) = SYS_WRITEV
//sys preadv(fd int, iovs []Iovec, offs_l uintptr, offs_h uintptr) (n int, err error) = SYS_PREADV
@@ -2494,98 +2492,4 @@ func SchedGetAttr(pid int, flags uint) (*SchedAttr, error) {
return attr, nil
}
-/*
- * Unimplemented
- */
-// AfsSyscall
-// ArchPrctl
-// Brk
-// ClockNanosleep
-// ClockSettime
-// Clone
-// EpollCtlOld
-// EpollPwait
-// EpollWaitOld
-// Execve
-// Fork
-// Futex
-// GetKernelSyms
-// GetMempolicy
-// GetRobustList
-// GetThreadArea
-// Getpmsg
-// IoCancel
-// IoDestroy
-// IoGetevents
-// IoSetup
-// IoSubmit
-// IoprioGet
-// IoprioSet
-// KexecLoad
-// LookupDcookie
-// Mbind
-// MigratePages
-// Mincore
-// ModifyLdt
-// Mount
-// MovePages
-// MqGetsetattr
-// MqNotify
-// MqOpen
-// MqTimedreceive
-// MqTimedsend
-// MqUnlink
-// Msgctl
-// Msgget
-// Msgrcv
-// Msgsnd
-// Nfsservctl
-// Personality
-// Pselect6
-// Ptrace
-// Putpmsg
-// Quotactl
-// Readahead
-// Readv
-// RemapFilePages
-// RestartSyscall
-// RtSigaction
-// RtSigpending
-// RtSigqueueinfo
-// RtSigreturn
-// RtSigsuspend
-// RtSigtimedwait
-// SchedGetPriorityMax
-// SchedGetPriorityMin
-// SchedGetparam
-// SchedGetscheduler
-// SchedRrGetInterval
-// SchedSetparam
-// SchedYield
-// Security
-// Semctl
-// Semget
-// Semop
-// Semtimedop
-// SetMempolicy
-// SetRobustList
-// SetThreadArea
-// SetTidAddress
-// Sigaltstack
-// Swapoff
-// Swapon
-// Sysfs
-// TimerCreate
-// TimerDelete
-// TimerGetoverrun
-// TimerGettime
-// TimerSettime
-// Tkill (obsolete)
-// Tuxcall
-// Umount2
-// Uselib
-// Utimensat
-// Vfork
-// Vhangup
-// Vserver
-// _Sysctl
+//sys Cachestat(fd uint, crange *CachestatRange, cstat *Cachestat_t, flags uint) (err error)
diff --git a/vendor/golang.org/x/sys/unix/syscall_linux_386.go b/vendor/golang.org/x/sys/unix/syscall_linux_386.go
index c7d9945e..506dafa7 100644
--- a/vendor/golang.org/x/sys/unix/syscall_linux_386.go
+++ b/vendor/golang.org/x/sys/unix/syscall_linux_386.go
@@ -3,7 +3,6 @@
// license that can be found in the LICENSE file.
//go:build 386 && linux
-// +build 386,linux
package unix
diff --git a/vendor/golang.org/x/sys/unix/syscall_linux_alarm.go b/vendor/golang.org/x/sys/unix/syscall_linux_alarm.go
index 08086ac6..38d55641 100644
--- a/vendor/golang.org/x/sys/unix/syscall_linux_alarm.go
+++ b/vendor/golang.org/x/sys/unix/syscall_linux_alarm.go
@@ -3,8 +3,6 @@
// license that can be found in the LICENSE file.
//go:build linux && (386 || amd64 || mips || mipsle || mips64 || mipsle || ppc64 || ppc64le || ppc || s390x || sparc64)
-// +build linux
-// +build 386 amd64 mips mipsle mips64 mipsle ppc64 ppc64le ppc s390x sparc64
package unix
diff --git a/vendor/golang.org/x/sys/unix/syscall_linux_amd64.go b/vendor/golang.org/x/sys/unix/syscall_linux_amd64.go
index 70601ce3..d557cf8d 100644
--- a/vendor/golang.org/x/sys/unix/syscall_linux_amd64.go
+++ b/vendor/golang.org/x/sys/unix/syscall_linux_amd64.go
@@ -3,7 +3,6 @@
// license that can be found in the LICENSE file.
//go:build amd64 && linux
-// +build amd64,linux
package unix
diff --git a/vendor/golang.org/x/sys/unix/syscall_linux_amd64_gc.go b/vendor/golang.org/x/sys/unix/syscall_linux_amd64_gc.go
index 8b0f0f3a..facdb83b 100644
--- a/vendor/golang.org/x/sys/unix/syscall_linux_amd64_gc.go
+++ b/vendor/golang.org/x/sys/unix/syscall_linux_amd64_gc.go
@@ -3,7 +3,6 @@
// license that can be found in the LICENSE file.
//go:build amd64 && linux && gc
-// +build amd64,linux,gc
package unix
diff --git a/vendor/golang.org/x/sys/unix/syscall_linux_arm.go b/vendor/golang.org/x/sys/unix/syscall_linux_arm.go
index da298641..cd2dd797 100644
--- a/vendor/golang.org/x/sys/unix/syscall_linux_arm.go
+++ b/vendor/golang.org/x/sys/unix/syscall_linux_arm.go
@@ -3,7 +3,6 @@
// license that can be found in the LICENSE file.
//go:build arm && linux
-// +build arm,linux
package unix
diff --git a/vendor/golang.org/x/sys/unix/syscall_linux_arm64.go b/vendor/golang.org/x/sys/unix/syscall_linux_arm64.go
index f5266689..cf2ee6c7 100644
--- a/vendor/golang.org/x/sys/unix/syscall_linux_arm64.go
+++ b/vendor/golang.org/x/sys/unix/syscall_linux_arm64.go
@@ -3,7 +3,6 @@
// license that can be found in the LICENSE file.
//go:build arm64 && linux
-// +build arm64,linux
package unix
diff --git a/vendor/golang.org/x/sys/unix/syscall_linux_gc.go b/vendor/golang.org/x/sys/unix/syscall_linux_gc.go
index 2b1168d7..ffc4c2b6 100644
--- a/vendor/golang.org/x/sys/unix/syscall_linux_gc.go
+++ b/vendor/golang.org/x/sys/unix/syscall_linux_gc.go
@@ -3,7 +3,6 @@
// license that can be found in the LICENSE file.
//go:build linux && gc
-// +build linux,gc
package unix
diff --git a/vendor/golang.org/x/sys/unix/syscall_linux_gc_386.go b/vendor/golang.org/x/sys/unix/syscall_linux_gc_386.go
index 9843fb48..9ebfdcf4 100644
--- a/vendor/golang.org/x/sys/unix/syscall_linux_gc_386.go
+++ b/vendor/golang.org/x/sys/unix/syscall_linux_gc_386.go
@@ -3,7 +3,6 @@
// license that can be found in the LICENSE file.
//go:build linux && gc && 386
-// +build linux,gc,386
package unix
diff --git a/vendor/golang.org/x/sys/unix/syscall_linux_gc_arm.go b/vendor/golang.org/x/sys/unix/syscall_linux_gc_arm.go
index a6008fcc..5f2b57c4 100644
--- a/vendor/golang.org/x/sys/unix/syscall_linux_gc_arm.go
+++ b/vendor/golang.org/x/sys/unix/syscall_linux_gc_arm.go
@@ -3,7 +3,6 @@
// license that can be found in the LICENSE file.
//go:build arm && gc && linux
-// +build arm,gc,linux
package unix
diff --git a/vendor/golang.org/x/sys/unix/syscall_linux_gccgo_386.go b/vendor/golang.org/x/sys/unix/syscall_linux_gccgo_386.go
index 7740af24..d1a3ad82 100644
--- a/vendor/golang.org/x/sys/unix/syscall_linux_gccgo_386.go
+++ b/vendor/golang.org/x/sys/unix/syscall_linux_gccgo_386.go
@@ -3,7 +3,6 @@
// license that can be found in the LICENSE file.
//go:build linux && gccgo && 386
-// +build linux,gccgo,386
package unix
diff --git a/vendor/golang.org/x/sys/unix/syscall_linux_gccgo_arm.go b/vendor/golang.org/x/sys/unix/syscall_linux_gccgo_arm.go
index e16a1229..f2f67423 100644
--- a/vendor/golang.org/x/sys/unix/syscall_linux_gccgo_arm.go
+++ b/vendor/golang.org/x/sys/unix/syscall_linux_gccgo_arm.go
@@ -3,7 +3,6 @@
// license that can be found in the LICENSE file.
//go:build linux && gccgo && arm
-// +build linux,gccgo,arm
package unix
diff --git a/vendor/golang.org/x/sys/unix/syscall_linux_loong64.go b/vendor/golang.org/x/sys/unix/syscall_linux_loong64.go
index f6ab02ec..3d0e9845 100644
--- a/vendor/golang.org/x/sys/unix/syscall_linux_loong64.go
+++ b/vendor/golang.org/x/sys/unix/syscall_linux_loong64.go
@@ -3,7 +3,6 @@
// license that can be found in the LICENSE file.
//go:build loong64 && linux
-// +build loong64,linux
package unix
diff --git a/vendor/golang.org/x/sys/unix/syscall_linux_mips64x.go b/vendor/golang.org/x/sys/unix/syscall_linux_mips64x.go
index 93fe59d2..70963a95 100644
--- a/vendor/golang.org/x/sys/unix/syscall_linux_mips64x.go
+++ b/vendor/golang.org/x/sys/unix/syscall_linux_mips64x.go
@@ -3,8 +3,6 @@
// license that can be found in the LICENSE file.
//go:build linux && (mips64 || mips64le)
-// +build linux
-// +build mips64 mips64le
package unix
diff --git a/vendor/golang.org/x/sys/unix/syscall_linux_mipsx.go b/vendor/golang.org/x/sys/unix/syscall_linux_mipsx.go
index aae7f0ff..c218ebd2 100644
--- a/vendor/golang.org/x/sys/unix/syscall_linux_mipsx.go
+++ b/vendor/golang.org/x/sys/unix/syscall_linux_mipsx.go
@@ -3,8 +3,6 @@
// license that can be found in the LICENSE file.
//go:build linux && (mips || mipsle)
-// +build linux
-// +build mips mipsle
package unix
diff --git a/vendor/golang.org/x/sys/unix/syscall_linux_ppc.go b/vendor/golang.org/x/sys/unix/syscall_linux_ppc.go
index 66eff19a..e6c48500 100644
--- a/vendor/golang.org/x/sys/unix/syscall_linux_ppc.go
+++ b/vendor/golang.org/x/sys/unix/syscall_linux_ppc.go
@@ -3,7 +3,6 @@
// license that can be found in the LICENSE file.
//go:build linux && ppc
-// +build linux,ppc
package unix
diff --git a/vendor/golang.org/x/sys/unix/syscall_linux_ppc64x.go b/vendor/golang.org/x/sys/unix/syscall_linux_ppc64x.go
index 806aa257..7286a9aa 100644
--- a/vendor/golang.org/x/sys/unix/syscall_linux_ppc64x.go
+++ b/vendor/golang.org/x/sys/unix/syscall_linux_ppc64x.go
@@ -3,8 +3,6 @@
// license that can be found in the LICENSE file.
//go:build linux && (ppc64 || ppc64le)
-// +build linux
-// +build ppc64 ppc64le
package unix
diff --git a/vendor/golang.org/x/sys/unix/syscall_linux_riscv64.go b/vendor/golang.org/x/sys/unix/syscall_linux_riscv64.go
index 5e6ceee1..6f5a2889 100644
--- a/vendor/golang.org/x/sys/unix/syscall_linux_riscv64.go
+++ b/vendor/golang.org/x/sys/unix/syscall_linux_riscv64.go
@@ -3,7 +3,6 @@
// license that can be found in the LICENSE file.
//go:build riscv64 && linux
-// +build riscv64,linux
package unix
diff --git a/vendor/golang.org/x/sys/unix/syscall_linux_s390x.go b/vendor/golang.org/x/sys/unix/syscall_linux_s390x.go
index 2f89e8f5..66f31210 100644
--- a/vendor/golang.org/x/sys/unix/syscall_linux_s390x.go
+++ b/vendor/golang.org/x/sys/unix/syscall_linux_s390x.go
@@ -3,7 +3,6 @@
// license that can be found in the LICENSE file.
//go:build s390x && linux
-// +build s390x,linux
package unix
diff --git a/vendor/golang.org/x/sys/unix/syscall_linux_sparc64.go b/vendor/golang.org/x/sys/unix/syscall_linux_sparc64.go
index 7ca064ae..11d1f169 100644
--- a/vendor/golang.org/x/sys/unix/syscall_linux_sparc64.go
+++ b/vendor/golang.org/x/sys/unix/syscall_linux_sparc64.go
@@ -3,7 +3,6 @@
// license that can be found in the LICENSE file.
//go:build sparc64 && linux
-// +build sparc64,linux
package unix
diff --git a/vendor/golang.org/x/sys/unix/syscall_netbsd.go b/vendor/golang.org/x/sys/unix/syscall_netbsd.go
index ddd1ac85..88162099 100644
--- a/vendor/golang.org/x/sys/unix/syscall_netbsd.go
+++ b/vendor/golang.org/x/sys/unix/syscall_netbsd.go
@@ -356,8 +356,6 @@ func Statvfs(path string, buf *Statvfs_t) (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)
//sys munmap(addr uintptr, length uintptr) (err error)
-//sys readlen(fd int, buf *byte, nbuf int) (n int, err error) = SYS_READ
-//sys writelen(fd int, buf *byte, nbuf int) (n int, err error) = SYS_WRITE
//sys utimensat(dirfd int, path string, times *[2]Timespec, flags int) (err error)
const (
@@ -371,262 +369,3 @@ const (
func mremap(oldaddr uintptr, oldlength uintptr, newlength uintptr, flags int, newaddr uintptr) (uintptr, error) {
return mremapNetBSD(oldaddr, oldlength, newaddr, newlength, flags)
}
-
-/*
- * Unimplemented
- */
-// ____semctl13
-// __clone
-// __fhopen40
-// __fhstat40
-// __fhstatvfs140
-// __fstat30
-// __getcwd
-// __getfh30
-// __getlogin
-// __lstat30
-// __mount50
-// __msgctl13
-// __msync13
-// __ntp_gettime30
-// __posix_chown
-// __posix_fchown
-// __posix_lchown
-// __posix_rename
-// __setlogin
-// __shmctl13
-// __sigaction_sigtramp
-// __sigaltstack14
-// __sigpending14
-// __sigprocmask14
-// __sigsuspend14
-// __sigtimedwait
-// __stat30
-// __syscall
-// __vfork14
-// _ksem_close
-// _ksem_destroy
-// _ksem_getvalue
-// _ksem_init
-// _ksem_open
-// _ksem_post
-// _ksem_trywait
-// _ksem_unlink
-// _ksem_wait
-// _lwp_continue
-// _lwp_create
-// _lwp_ctl
-// _lwp_detach
-// _lwp_exit
-// _lwp_getname
-// _lwp_getprivate
-// _lwp_kill
-// _lwp_park
-// _lwp_self
-// _lwp_setname
-// _lwp_setprivate
-// _lwp_suspend
-// _lwp_unpark
-// _lwp_unpark_all
-// _lwp_wait
-// _lwp_wakeup
-// _pset_bind
-// _sched_getaffinity
-// _sched_getparam
-// _sched_setaffinity
-// _sched_setparam
-// acct
-// aio_cancel
-// aio_error
-// aio_fsync
-// aio_read
-// aio_return
-// aio_suspend
-// aio_write
-// break
-// clock_getres
-// clock_gettime
-// clock_settime
-// compat_09_ogetdomainname
-// compat_09_osetdomainname
-// compat_09_ouname
-// compat_10_omsgsys
-// compat_10_osemsys
-// compat_10_oshmsys
-// compat_12_fstat12
-// compat_12_getdirentries
-// compat_12_lstat12
-// compat_12_msync
-// compat_12_oreboot
-// compat_12_oswapon
-// compat_12_stat12
-// compat_13_sigaction13
-// compat_13_sigaltstack13
-// compat_13_sigpending13
-// compat_13_sigprocmask13
-// compat_13_sigreturn13
-// compat_13_sigsuspend13
-// compat_14___semctl
-// compat_14_msgctl
-// compat_14_shmctl
-// compat_16___sigaction14
-// compat_16___sigreturn14
-// compat_20_fhstatfs
-// compat_20_fstatfs
-// compat_20_getfsstat
-// compat_20_statfs
-// compat_30___fhstat30
-// compat_30___fstat13
-// compat_30___lstat13
-// compat_30___stat13
-// compat_30_fhopen
-// compat_30_fhstat
-// compat_30_fhstatvfs1
-// compat_30_getdents
-// compat_30_getfh
-// compat_30_ntp_gettime
-// compat_30_socket
-// compat_40_mount
-// compat_43_fstat43
-// compat_43_lstat43
-// compat_43_oaccept
-// compat_43_ocreat
-// compat_43_oftruncate
-// compat_43_ogetdirentries
-// compat_43_ogetdtablesize
-// compat_43_ogethostid
-// compat_43_ogethostname
-// compat_43_ogetkerninfo
-// compat_43_ogetpagesize
-// compat_43_ogetpeername
-// compat_43_ogetrlimit
-// compat_43_ogetsockname
-// compat_43_okillpg
-// compat_43_olseek
-// compat_43_ommap
-// compat_43_oquota
-// compat_43_orecv
-// compat_43_orecvfrom
-// compat_43_orecvmsg
-// compat_43_osend
-// compat_43_osendmsg
-// compat_43_osethostid
-// compat_43_osethostname
-// compat_43_osigblock
-// compat_43_osigsetmask
-// compat_43_osigstack
-// compat_43_osigvec
-// compat_43_otruncate
-// compat_43_owait
-// compat_43_stat43
-// execve
-// extattr_delete_fd
-// extattr_delete_file
-// extattr_delete_link
-// extattr_get_fd
-// extattr_get_file
-// extattr_get_link
-// extattr_list_fd
-// extattr_list_file
-// extattr_list_link
-// extattr_set_fd
-// extattr_set_file
-// extattr_set_link
-// extattrctl
-// fchroot
-// fdatasync
-// fgetxattr
-// fktrace
-// flistxattr
-// fork
-// fremovexattr
-// fsetxattr
-// fstatvfs1
-// fsync_range
-// getcontext
-// getitimer
-// getvfsstat
-// getxattr
-// ktrace
-// lchflags
-// lchmod
-// lfs_bmapv
-// lfs_markv
-// lfs_segclean
-// lfs_segwait
-// lgetxattr
-// lio_listio
-// listxattr
-// llistxattr
-// lremovexattr
-// lseek
-// lsetxattr
-// lutimes
-// madvise
-// mincore
-// minherit
-// modctl
-// mq_close
-// mq_getattr
-// mq_notify
-// mq_open
-// mq_receive
-// mq_send
-// mq_setattr
-// mq_timedreceive
-// mq_timedsend
-// mq_unlink
-// msgget
-// msgrcv
-// msgsnd
-// nfssvc
-// ntp_adjtime
-// pmc_control
-// pmc_get_info
-// pollts
-// preadv
-// profil
-// pselect
-// pset_assign
-// pset_create
-// pset_destroy
-// ptrace
-// pwritev
-// quotactl
-// rasctl
-// readv
-// reboot
-// removexattr
-// sa_enable
-// sa_preempt
-// sa_register
-// sa_setconcurrency
-// sa_stacks
-// sa_yield
-// sbrk
-// sched_yield
-// semconfig
-// semget
-// semop
-// setcontext
-// setitimer
-// setxattr
-// shmat
-// shmdt
-// shmget
-// sstk
-// statvfs1
-// swapctl
-// sysarch
-// syscall
-// timer_create
-// timer_delete
-// timer_getoverrun
-// timer_gettime
-// timer_settime
-// undelete
-// utrace
-// uuidgen
-// vadvise
-// vfork
-// writev
diff --git a/vendor/golang.org/x/sys/unix/syscall_netbsd_386.go b/vendor/golang.org/x/sys/unix/syscall_netbsd_386.go
index 5199d282..7a5eb574 100644
--- a/vendor/golang.org/x/sys/unix/syscall_netbsd_386.go
+++ b/vendor/golang.org/x/sys/unix/syscall_netbsd_386.go
@@ -3,7 +3,6 @@
// license that can be found in the LICENSE file.
//go:build 386 && netbsd
-// +build 386,netbsd
package unix
diff --git a/vendor/golang.org/x/sys/unix/syscall_netbsd_amd64.go b/vendor/golang.org/x/sys/unix/syscall_netbsd_amd64.go
index 70a9c52e..62d8957a 100644
--- a/vendor/golang.org/x/sys/unix/syscall_netbsd_amd64.go
+++ b/vendor/golang.org/x/sys/unix/syscall_netbsd_amd64.go
@@ -3,7 +3,6 @@
// license that can be found in the LICENSE file.
//go:build amd64 && netbsd
-// +build amd64,netbsd
package unix
diff --git a/vendor/golang.org/x/sys/unix/syscall_netbsd_arm.go b/vendor/golang.org/x/sys/unix/syscall_netbsd_arm.go
index 3eb5942f..ce6a0688 100644
--- a/vendor/golang.org/x/sys/unix/syscall_netbsd_arm.go
+++ b/vendor/golang.org/x/sys/unix/syscall_netbsd_arm.go
@@ -3,7 +3,6 @@
// license that can be found in the LICENSE file.
//go:build arm && netbsd
-// +build arm,netbsd
package unix
diff --git a/vendor/golang.org/x/sys/unix/syscall_netbsd_arm64.go b/vendor/golang.org/x/sys/unix/syscall_netbsd_arm64.go
index fc6ccfd8..d46d689d 100644
--- a/vendor/golang.org/x/sys/unix/syscall_netbsd_arm64.go
+++ b/vendor/golang.org/x/sys/unix/syscall_netbsd_arm64.go
@@ -3,7 +3,6 @@
// license that can be found in the LICENSE file.
//go:build arm64 && netbsd
-// +build arm64,netbsd
package unix
diff --git a/vendor/golang.org/x/sys/unix/syscall_openbsd.go b/vendor/golang.org/x/sys/unix/syscall_openbsd.go
index c5f166a1..b25343c7 100644
--- a/vendor/golang.org/x/sys/unix/syscall_openbsd.go
+++ b/vendor/golang.org/x/sys/unix/syscall_openbsd.go
@@ -137,18 +137,13 @@ func sendfile(outfd int, infd int, offset *int64, count int) (written int, err e
}
func Getfsstat(buf []Statfs_t, flags int) (n int, err error) {
- var _p0 unsafe.Pointer
+ var bufptr *Statfs_t
var bufsize uintptr
if len(buf) > 0 {
- _p0 = unsafe.Pointer(&buf[0])
+ bufptr = &buf[0]
bufsize = unsafe.Sizeof(Statfs_t{}) * uintptr(len(buf))
}
- r0, _, e1 := Syscall(SYS_GETFSSTAT, uintptr(_p0), bufsize, uintptr(flags))
- n = int(r0)
- if e1 != 0 {
- err = e1
- }
- return
+ return getfsstat(bufptr, bufsize, flags)
}
//sysnb getresuid(ruid *_C_int, euid *_C_int, suid *_C_int)
@@ -171,6 +166,20 @@ func Getresgid() (rgid, egid, sgid int) {
//sys sysctl(mib []_C_int, old *byte, oldlen *uintptr, new *byte, newlen uintptr) (err error) = SYS___SYSCTL
+//sys fcntl(fd int, cmd int, arg int) (n int, err error)
+//sys fcntlPtr(fd int, cmd int, arg unsafe.Pointer) (n int, err error) = SYS_FCNTL
+
+// 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 := fcntlPtr(int(fd), cmd, unsafe.Pointer(lk))
+ return 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) {
@@ -326,78 +335,7 @@ func Uname(uname *Utsname) 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)
//sys munmap(addr uintptr, length uintptr) (err error)
-//sys readlen(fd int, buf *byte, nbuf int) (n int, err error) = SYS_READ
-//sys writelen(fd int, buf *byte, nbuf int) (n int, err error) = SYS_WRITE
+//sys getfsstat(stat *Statfs_t, bufsize uintptr, flags int) (n int, err error)
//sys utimensat(dirfd int, path string, times *[2]Timespec, flags int) (err error)
-
-/*
- * Unimplemented
- */
-// __getcwd
-// __semctl
-// __syscall
-// __sysctl
-// adjfreq
-// break
-// clock_getres
-// clock_gettime
-// clock_settime
-// closefrom
-// execve
-// fhopen
-// fhstat
-// fhstatfs
-// fork
-// futimens
-// getfh
-// getgid
-// getitimer
-// getlogin
-// getthrid
-// ktrace
-// lfs_bmapv
-// lfs_markv
-// lfs_segclean
-// lfs_segwait
-// mincore
-// minherit
-// mount
-// mquery
-// msgctl
-// msgget
-// msgrcv
-// msgsnd
-// nfssvc
-// nnpfspioctl
-// preadv
-// profil
-// pwritev
-// quotactl
-// readv
-// reboot
-// renameat
-// rfork
-// sched_yield
-// semget
-// semop
-// setgroups
-// setitimer
-// setsockopt
-// shmat
-// shmctl
-// shmdt
-// shmget
-// sigaction
-// sigaltstack
-// sigpending
-// sigprocmask
-// sigreturn
-// sigsuspend
-// sysarch
-// syscall
-// threxit
-// thrsigdivert
-// thrsleep
-// thrwakeup
-// vfork
-// writev
+//sys pledge(promises *byte, execpromises *byte) (err error)
+//sys unveil(path *byte, flags *byte) (err error)
diff --git a/vendor/golang.org/x/sys/unix/syscall_openbsd_386.go b/vendor/golang.org/x/sys/unix/syscall_openbsd_386.go
index 6baabcdc..9ddc89f4 100644
--- a/vendor/golang.org/x/sys/unix/syscall_openbsd_386.go
+++ b/vendor/golang.org/x/sys/unix/syscall_openbsd_386.go
@@ -3,7 +3,6 @@
// license that can be found in the LICENSE file.
//go:build 386 && openbsd
-// +build 386,openbsd
package unix
diff --git a/vendor/golang.org/x/sys/unix/syscall_openbsd_amd64.go b/vendor/golang.org/x/sys/unix/syscall_openbsd_amd64.go
index bab25360..70a3c96e 100644
--- a/vendor/golang.org/x/sys/unix/syscall_openbsd_amd64.go
+++ b/vendor/golang.org/x/sys/unix/syscall_openbsd_amd64.go
@@ -3,7 +3,6 @@
// license that can be found in the LICENSE file.
//go:build amd64 && openbsd
-// +build amd64,openbsd
package unix
diff --git a/vendor/golang.org/x/sys/unix/syscall_openbsd_arm.go b/vendor/golang.org/x/sys/unix/syscall_openbsd_arm.go
index 8eed3c4d..265caa87 100644
--- a/vendor/golang.org/x/sys/unix/syscall_openbsd_arm.go
+++ b/vendor/golang.org/x/sys/unix/syscall_openbsd_arm.go
@@ -3,7 +3,6 @@
// license that can be found in the LICENSE file.
//go:build arm && openbsd
-// +build arm,openbsd
package unix
diff --git a/vendor/golang.org/x/sys/unix/syscall_openbsd_arm64.go b/vendor/golang.org/x/sys/unix/syscall_openbsd_arm64.go
index 483dde99..ac4fda17 100644
--- a/vendor/golang.org/x/sys/unix/syscall_openbsd_arm64.go
+++ b/vendor/golang.org/x/sys/unix/syscall_openbsd_arm64.go
@@ -3,7 +3,6 @@
// license that can be found in the LICENSE file.
//go:build arm64 && openbsd
-// +build arm64,openbsd
package unix
diff --git a/vendor/golang.org/x/sys/unix/syscall_openbsd_libc.go b/vendor/golang.org/x/sys/unix/syscall_openbsd_libc.go
index 04aa43f4..0a451e6d 100644
--- a/vendor/golang.org/x/sys/unix/syscall_openbsd_libc.go
+++ b/vendor/golang.org/x/sys/unix/syscall_openbsd_libc.go
@@ -3,7 +3,6 @@
// license that can be found in the LICENSE file.
//go:build openbsd
-// +build openbsd
package unix
diff --git a/vendor/golang.org/x/sys/unix/syscall_openbsd_ppc64.go b/vendor/golang.org/x/sys/unix/syscall_openbsd_ppc64.go
index c2796139..30a308cb 100644
--- a/vendor/golang.org/x/sys/unix/syscall_openbsd_ppc64.go
+++ b/vendor/golang.org/x/sys/unix/syscall_openbsd_ppc64.go
@@ -3,7 +3,6 @@
// license that can be found in the LICENSE file.
//go:build ppc64 && openbsd
-// +build ppc64,openbsd
package unix
diff --git a/vendor/golang.org/x/sys/unix/syscall_openbsd_riscv64.go b/vendor/golang.org/x/sys/unix/syscall_openbsd_riscv64.go
index 23199a7f..ea954330 100644
--- a/vendor/golang.org/x/sys/unix/syscall_openbsd_riscv64.go
+++ b/vendor/golang.org/x/sys/unix/syscall_openbsd_riscv64.go
@@ -3,7 +3,6 @@
// license that can be found in the LICENSE file.
//go:build riscv64 && openbsd
-// +build riscv64,openbsd
package unix
diff --git a/vendor/golang.org/x/sys/unix/syscall_solaris.go b/vendor/golang.org/x/sys/unix/syscall_solaris.go
index 72d23575..21974af0 100644
--- a/vendor/golang.org/x/sys/unix/syscall_solaris.go
+++ b/vendor/golang.org/x/sys/unix/syscall_solaris.go
@@ -128,7 +128,8 @@ func (sa *SockaddrUnix) sockaddr() (unsafe.Pointer, _Socklen, error) {
if n > 0 {
sl += _Socklen(n) + 1
}
- if sa.raw.Path[0] == '@' {
+ if sa.raw.Path[0] == '@' || (sa.raw.Path[0] == 0 && sl > 3) {
+ // Check sl > 3 so we don't change unnamed socket behavior.
sa.raw.Path[0] = 0
// Don't count trailing NUL for abstract address.
sl--
@@ -157,7 +158,7 @@ func GetsockoptString(fd, level, opt int) (string, error) {
if err != nil {
return "", err
}
- return string(buf[:vallen-1]), nil
+ return ByteSliceToString(buf[:vallen]), nil
}
const ImplementsGetwd = true
@@ -698,24 +699,6 @@ func Sendfile(outfd int, infd int, offset *int64, count int) (written int, err e
//sys setsockopt(s int, level int, name int, val unsafe.Pointer, vallen uintptr) (err error) = libsocket.setsockopt
//sys recvfrom(fd int, p []byte, flags int, from *RawSockaddrAny, fromlen *_Socklen) (n int, err error) = libsocket.recvfrom
-func readlen(fd int, buf *byte, nbuf int) (n int, err error) {
- r0, _, e1 := sysvicall6(uintptr(unsafe.Pointer(&procread)), 3, uintptr(fd), uintptr(unsafe.Pointer(buf)), uintptr(nbuf), 0, 0, 0)
- n = int(r0)
- if e1 != 0 {
- err = e1
- }
- return
-}
-
-func writelen(fd int, buf *byte, nbuf int) (n int, err error) {
- r0, _, e1 := sysvicall6(uintptr(unsafe.Pointer(&procwrite)), 3, uintptr(fd), uintptr(unsafe.Pointer(buf)), uintptr(nbuf), 0, 0, 0)
- n = int(r0)
- if e1 != 0 {
- err = e1
- }
- return
-}
-
// Event Ports
type fileObjCookie struct {
diff --git a/vendor/golang.org/x/sys/unix/syscall_solaris_amd64.go b/vendor/golang.org/x/sys/unix/syscall_solaris_amd64.go
index 0bd25ef8..e02d8cea 100644
--- a/vendor/golang.org/x/sys/unix/syscall_solaris_amd64.go
+++ b/vendor/golang.org/x/sys/unix/syscall_solaris_amd64.go
@@ -3,7 +3,6 @@
// license that can be found in the LICENSE file.
//go:build amd64 && solaris
-// +build amd64,solaris
package unix
diff --git a/vendor/golang.org/x/sys/unix/syscall_unix.go b/vendor/golang.org/x/sys/unix/syscall_unix.go
index f6eda270..77081de8 100644
--- a/vendor/golang.org/x/sys/unix/syscall_unix.go
+++ b/vendor/golang.org/x/sys/unix/syscall_unix.go
@@ -3,7 +3,6 @@
// license that can be found in the LICENSE file.
//go:build aix || darwin || dragonfly || freebsd || linux || netbsd || openbsd || solaris
-// +build aix darwin dragonfly freebsd linux netbsd openbsd solaris
package unix
diff --git a/vendor/golang.org/x/sys/unix/syscall_unix_gc.go b/vendor/golang.org/x/sys/unix/syscall_unix_gc.go
index b6919ca5..05c95bcc 100644
--- a/vendor/golang.org/x/sys/unix/syscall_unix_gc.go
+++ b/vendor/golang.org/x/sys/unix/syscall_unix_gc.go
@@ -3,8 +3,6 @@
// license that can be found in the LICENSE file.
//go:build (darwin || dragonfly || freebsd || (linux && !ppc64 && !ppc64le) || netbsd || openbsd || solaris) && gc
-// +build darwin dragonfly freebsd linux,!ppc64,!ppc64le netbsd openbsd solaris
-// +build gc
package unix
diff --git a/vendor/golang.org/x/sys/unix/syscall_unix_gc_ppc64x.go b/vendor/golang.org/x/sys/unix/syscall_unix_gc_ppc64x.go
index f6f707ac..23f39b7a 100644
--- a/vendor/golang.org/x/sys/unix/syscall_unix_gc_ppc64x.go
+++ b/vendor/golang.org/x/sys/unix/syscall_unix_gc_ppc64x.go
@@ -3,9 +3,6 @@
// license that can be found in the LICENSE file.
//go:build linux && (ppc64le || ppc64) && gc
-// +build linux
-// +build ppc64le ppc64
-// +build gc
package unix
diff --git a/vendor/golang.org/x/sys/unix/syscall_zos_s390x.go b/vendor/golang.org/x/sys/unix/syscall_zos_s390x.go
index 44e72edb..b473038c 100644
--- a/vendor/golang.org/x/sys/unix/syscall_zos_s390x.go
+++ b/vendor/golang.org/x/sys/unix/syscall_zos_s390x.go
@@ -3,7 +3,6 @@
// license that can be found in the LICENSE file.
//go:build zos && s390x
-// +build zos,s390x
package unix
@@ -192,7 +191,6 @@ func (cmsg *Cmsghdr) SetLen(length int) {
//sys fcntl(fd int, cmd int, arg int) (val int, err error)
//sys read(fd int, p []byte) (n int, err error)
-//sys readlen(fd int, buf *byte, nbuf int) (n int, err error) = SYS_READ
//sys write(fd int, p []byte) (n int, err error)
//sys accept(s int, rsa *RawSockaddrAny, addrlen *_Socklen) (fd int, err error) = SYS___ACCEPT_A
@@ -1106,7 +1104,7 @@ func GetsockoptString(fd, level, opt int) (string, error) {
return "", err
}
- return string(buf[:vallen-1]), nil
+ return ByteSliceToString(buf[:vallen]), nil
}
func Recvmsg(fd int, p, oob []byte, flags int) (n, oobn int, recvflags int, from Sockaddr, err error) {
diff --git a/vendor/golang.org/x/sys/unix/sysvshm_linux.go b/vendor/golang.org/x/sys/unix/sysvshm_linux.go
index 2c3a4437..4fcd38de 100644
--- a/vendor/golang.org/x/sys/unix/sysvshm_linux.go
+++ b/vendor/golang.org/x/sys/unix/sysvshm_linux.go
@@ -3,7 +3,6 @@
// license that can be found in the LICENSE file.
//go:build linux
-// +build linux
package unix
diff --git a/vendor/golang.org/x/sys/unix/sysvshm_unix.go b/vendor/golang.org/x/sys/unix/sysvshm_unix.go
index 5bb41d17..79a84f18 100644
--- a/vendor/golang.org/x/sys/unix/sysvshm_unix.go
+++ b/vendor/golang.org/x/sys/unix/sysvshm_unix.go
@@ -3,7 +3,6 @@
// license that can be found in the LICENSE file.
//go:build (darwin && !ios) || linux
-// +build darwin,!ios linux
package unix
diff --git a/vendor/golang.org/x/sys/unix/sysvshm_unix_other.go b/vendor/golang.org/x/sys/unix/sysvshm_unix_other.go
index 71bddefd..9eb0db66 100644
--- a/vendor/golang.org/x/sys/unix/sysvshm_unix_other.go
+++ b/vendor/golang.org/x/sys/unix/sysvshm_unix_other.go
@@ -3,7 +3,6 @@
// license that can be found in the LICENSE file.
//go:build darwin && !ios
-// +build darwin,!ios
package unix
diff --git a/vendor/golang.org/x/sys/unix/timestruct.go b/vendor/golang.org/x/sys/unix/timestruct.go
index 616b1b28..7997b190 100644
--- a/vendor/golang.org/x/sys/unix/timestruct.go
+++ b/vendor/golang.org/x/sys/unix/timestruct.go
@@ -3,7 +3,6 @@
// license that can be found in the LICENSE file.
//go:build aix || darwin || dragonfly || freebsd || linux || netbsd || openbsd || solaris || zos
-// +build aix darwin dragonfly freebsd linux netbsd openbsd solaris zos
package unix
diff --git a/vendor/golang.org/x/sys/unix/unveil_openbsd.go b/vendor/golang.org/x/sys/unix/unveil_openbsd.go
index 168d5ae7..cb7e598c 100644
--- a/vendor/golang.org/x/sys/unix/unveil_openbsd.go
+++ b/vendor/golang.org/x/sys/unix/unveil_openbsd.go
@@ -4,39 +4,48 @@
package unix
-import (
- "syscall"
- "unsafe"
-)
+import "fmt"
// 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 {
+ if err := supportsUnveil(); err != nil {
return err
}
- flagsPtr, err := syscall.BytePtrFromString(flags)
+ pathPtr, err := BytePtrFromString(path)
if err != nil {
return err
}
- _, _, e := syscall.Syscall(SYS_UNVEIL, uintptr(unsafe.Pointer(pathPtr)), uintptr(unsafe.Pointer(flagsPtr)), 0)
- if e != 0 {
- return e
+ flagsPtr, err := BytePtrFromString(flags)
+ if err != nil {
+ return err
}
- return nil
+ return unveil(pathPtr, flagsPtr)
}
// 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
+ if err := supportsUnveil(); err != nil {
+ return err
}
+ return unveil(nil, nil)
+}
+
+// supportsUnveil checks for availability of the unveil(2) system call based
+// on the running OpenBSD version.
+func supportsUnveil() error {
+ maj, min, err := majmin()
+ if err != nil {
+ return err
+ }
+
+ // unveil is not available before 6.4
+ if maj < 6 || (maj == 6 && min <= 3) {
+ return fmt.Errorf("cannot call Unveil on OpenBSD %d.%d", maj, min)
+ }
+
return nil
}
diff --git a/vendor/golang.org/x/sys/unix/xattr_bsd.go b/vendor/golang.org/x/sys/unix/xattr_bsd.go
index f5f8e9f3..e1687939 100644
--- a/vendor/golang.org/x/sys/unix/xattr_bsd.go
+++ b/vendor/golang.org/x/sys/unix/xattr_bsd.go
@@ -3,7 +3,6 @@
// license that can be found in the LICENSE file.
//go:build freebsd || netbsd
-// +build freebsd netbsd
package unix
diff --git a/vendor/golang.org/x/sys/unix/zerrors_aix_ppc.go b/vendor/golang.org/x/sys/unix/zerrors_aix_ppc.go
index ca9799b7..2fb219d7 100644
--- a/vendor/golang.org/x/sys/unix/zerrors_aix_ppc.go
+++ b/vendor/golang.org/x/sys/unix/zerrors_aix_ppc.go
@@ -2,7 +2,6 @@
// Code generated by the command above; see README.md. DO NOT EDIT.
//go:build ppc && aix
-// +build ppc,aix
// Created by cgo -godefs - DO NOT EDIT
// cgo -godefs -- -maix32 _const.go
diff --git a/vendor/golang.org/x/sys/unix/zerrors_aix_ppc64.go b/vendor/golang.org/x/sys/unix/zerrors_aix_ppc64.go
index 200c8c26..b0e6f5c8 100644
--- a/vendor/golang.org/x/sys/unix/zerrors_aix_ppc64.go
+++ b/vendor/golang.org/x/sys/unix/zerrors_aix_ppc64.go
@@ -2,7 +2,6 @@
// Code generated by the command above; see README.md. DO NOT EDIT.
//go:build ppc64 && aix
-// +build ppc64,aix
// Code generated by cmd/cgo -godefs; DO NOT EDIT.
// cgo -godefs -- -maix64 _const.go
diff --git a/vendor/golang.org/x/sys/unix/zerrors_darwin_amd64.go b/vendor/golang.org/x/sys/unix/zerrors_darwin_amd64.go
index 14300762..e40fa852 100644
--- a/vendor/golang.org/x/sys/unix/zerrors_darwin_amd64.go
+++ b/vendor/golang.org/x/sys/unix/zerrors_darwin_amd64.go
@@ -2,7 +2,6 @@
// Code generated by the command above; see README.md. DO NOT EDIT.
//go:build amd64 && darwin
-// +build amd64,darwin
// Code generated by cmd/cgo -godefs; DO NOT EDIT.
// cgo -godefs -- -m64 _const.go
diff --git a/vendor/golang.org/x/sys/unix/zerrors_darwin_arm64.go b/vendor/golang.org/x/sys/unix/zerrors_darwin_arm64.go
index ab044a74..bb02aa6c 100644
--- a/vendor/golang.org/x/sys/unix/zerrors_darwin_arm64.go
+++ b/vendor/golang.org/x/sys/unix/zerrors_darwin_arm64.go
@@ -2,7 +2,6 @@
// Code generated by the command above; see README.md. DO NOT EDIT.
//go:build arm64 && darwin
-// +build arm64,darwin
// Code generated by cmd/cgo -godefs; DO NOT EDIT.
// cgo -godefs -- -m64 _const.go
diff --git a/vendor/golang.org/x/sys/unix/zerrors_dragonfly_amd64.go b/vendor/golang.org/x/sys/unix/zerrors_dragonfly_amd64.go
index 17bba0e4..c0e0f869 100644
--- a/vendor/golang.org/x/sys/unix/zerrors_dragonfly_amd64.go
+++ b/vendor/golang.org/x/sys/unix/zerrors_dragonfly_amd64.go
@@ -2,7 +2,6 @@
// Code generated by the command above; see README.md. DO NOT EDIT.
//go:build amd64 && dragonfly
-// +build amd64,dragonfly
// Code generated by cmd/cgo -godefs; DO NOT EDIT.
// cgo -godefs -- -m64 _const.go
diff --git a/vendor/golang.org/x/sys/unix/zerrors_freebsd_386.go b/vendor/golang.org/x/sys/unix/zerrors_freebsd_386.go
index f8c2c513..6c692390 100644
--- a/vendor/golang.org/x/sys/unix/zerrors_freebsd_386.go
+++ b/vendor/golang.org/x/sys/unix/zerrors_freebsd_386.go
@@ -2,7 +2,6 @@
// Code generated by the command above; see README.md. DO NOT EDIT.
//go:build 386 && freebsd
-// +build 386,freebsd
// Code generated by cmd/cgo -godefs; DO NOT EDIT.
// cgo -godefs -- -m32 _const.go
diff --git a/vendor/golang.org/x/sys/unix/zerrors_freebsd_amd64.go b/vendor/golang.org/x/sys/unix/zerrors_freebsd_amd64.go
index 96310c3b..dd9163f8 100644
--- a/vendor/golang.org/x/sys/unix/zerrors_freebsd_amd64.go
+++ b/vendor/golang.org/x/sys/unix/zerrors_freebsd_amd64.go
@@ -2,7 +2,6 @@
// Code generated by the command above; see README.md. DO NOT EDIT.
//go:build amd64 && freebsd
-// +build amd64,freebsd
// Code generated by cmd/cgo -godefs; DO NOT EDIT.
// cgo -godefs -- -m64 _const.go
diff --git a/vendor/golang.org/x/sys/unix/zerrors_freebsd_arm.go b/vendor/golang.org/x/sys/unix/zerrors_freebsd_arm.go
index 777b69de..493a2a79 100644
--- a/vendor/golang.org/x/sys/unix/zerrors_freebsd_arm.go
+++ b/vendor/golang.org/x/sys/unix/zerrors_freebsd_arm.go
@@ -2,7 +2,6 @@
// Code generated by the command above; see README.md. DO NOT EDIT.
//go:build arm && freebsd
-// +build arm,freebsd
// Code generated by cmd/cgo -godefs; DO NOT EDIT.
// cgo -godefs -- _const.go
diff --git a/vendor/golang.org/x/sys/unix/zerrors_freebsd_arm64.go b/vendor/golang.org/x/sys/unix/zerrors_freebsd_arm64.go
index c557ac2d..8b437b30 100644
--- a/vendor/golang.org/x/sys/unix/zerrors_freebsd_arm64.go
+++ b/vendor/golang.org/x/sys/unix/zerrors_freebsd_arm64.go
@@ -2,7 +2,6 @@
// Code generated by the command above; see README.md. DO NOT EDIT.
//go:build arm64 && freebsd
-// +build arm64,freebsd
// Code generated by cmd/cgo -godefs; DO NOT EDIT.
// cgo -godefs -- -m64 _const.go
diff --git a/vendor/golang.org/x/sys/unix/zerrors_freebsd_riscv64.go b/vendor/golang.org/x/sys/unix/zerrors_freebsd_riscv64.go
index 341b4d96..67c02dd5 100644
--- a/vendor/golang.org/x/sys/unix/zerrors_freebsd_riscv64.go
+++ b/vendor/golang.org/x/sys/unix/zerrors_freebsd_riscv64.go
@@ -2,7 +2,6 @@
// Code generated by the command above; see README.md. DO NOT EDIT.
//go:build riscv64 && freebsd
-// +build riscv64,freebsd
// Code generated by cmd/cgo -godefs; DO NOT EDIT.
// cgo -godefs -- -m64 _const.go
diff --git a/vendor/golang.org/x/sys/unix/zerrors_linux.go b/vendor/golang.org/x/sys/unix/zerrors_linux.go
index 0787a043..c73cfe2f 100644
--- a/vendor/golang.org/x/sys/unix/zerrors_linux.go
+++ b/vendor/golang.org/x/sys/unix/zerrors_linux.go
@@ -1,7 +1,6 @@
// Code generated by mkmerge; DO NOT EDIT.
//go:build linux
-// +build linux
package unix
@@ -481,10 +480,13 @@ const (
BPF_FROM_BE = 0x8
BPF_FROM_LE = 0x0
BPF_FS_MAGIC = 0xcafe4a11
+ BPF_F_AFTER = 0x10
BPF_F_ALLOW_MULTI = 0x2
BPF_F_ALLOW_OVERRIDE = 0x1
BPF_F_ANY_ALIGNMENT = 0x2
- BPF_F_KPROBE_MULTI_RETURN = 0x1
+ BPF_F_BEFORE = 0x8
+ BPF_F_ID = 0x20
+ BPF_F_NETFILTER_IP_DEFRAG = 0x1
BPF_F_QUERY_EFFECTIVE = 0x1
BPF_F_REPLACE = 0x4
BPF_F_SLEEPABLE = 0x10
@@ -521,6 +523,7 @@ const (
BPF_MAJOR_VERSION = 0x1
BPF_MAXINSNS = 0x1000
BPF_MEM = 0x60
+ BPF_MEMSX = 0x80
BPF_MEMWORDS = 0x10
BPF_MINOR_VERSION = 0x1
BPF_MISC = 0x7
@@ -776,6 +779,8 @@ const (
DEVLINK_GENL_MCGRP_CONFIG_NAME = "config"
DEVLINK_GENL_NAME = "devlink"
DEVLINK_GENL_VERSION = 0x1
+ DEVLINK_PORT_FN_CAP_IPSEC_CRYPTO = 0x4
+ DEVLINK_PORT_FN_CAP_IPSEC_PACKET = 0x8
DEVLINK_PORT_FN_CAP_MIGRATABLE = 0x2
DEVLINK_PORT_FN_CAP_ROCE = 0x1
DEVLINK_SB_THRESHOLD_TO_ALPHA_MAX = 0x14
@@ -1698,6 +1703,7 @@ const (
KEXEC_ON_CRASH = 0x1
KEXEC_PRESERVE_CONTEXT = 0x2
KEXEC_SEGMENT_MAX = 0x10
+ KEXEC_UPDATE_ELFCOREHDR = 0x4
KEYCTL_ASSUME_AUTHORITY = 0x10
KEYCTL_CAPABILITIES = 0x1f
KEYCTL_CAPS0_BIG_KEY = 0x10
@@ -1795,6 +1801,7 @@ const (
LOCK_SH = 0x1
LOCK_UN = 0x8
LOOP_CLR_FD = 0x4c01
+ LOOP_CONFIGURE = 0x4c0a
LOOP_CTL_ADD = 0x4c80
LOOP_CTL_GET_FREE = 0x4c82
LOOP_CTL_REMOVE = 0x4c81
@@ -2275,6 +2282,7 @@ const (
PERF_MEM_LVLNUM_PMEM = 0xe
PERF_MEM_LVLNUM_RAM = 0xd
PERF_MEM_LVLNUM_SHIFT = 0x21
+ PERF_MEM_LVLNUM_UNC = 0x8
PERF_MEM_LVL_HIT = 0x2
PERF_MEM_LVL_IO = 0x1000
PERF_MEM_LVL_L1 = 0x8
@@ -2421,6 +2429,15 @@ const (
PR_PAC_GET_ENABLED_KEYS = 0x3d
PR_PAC_RESET_KEYS = 0x36
PR_PAC_SET_ENABLED_KEYS = 0x3c
+ PR_RISCV_V_GET_CONTROL = 0x46
+ PR_RISCV_V_SET_CONTROL = 0x45
+ PR_RISCV_V_VSTATE_CTRL_CUR_MASK = 0x3
+ PR_RISCV_V_VSTATE_CTRL_DEFAULT = 0x0
+ PR_RISCV_V_VSTATE_CTRL_INHERIT = 0x10
+ PR_RISCV_V_VSTATE_CTRL_MASK = 0x1f
+ PR_RISCV_V_VSTATE_CTRL_NEXT_MASK = 0xc
+ PR_RISCV_V_VSTATE_CTRL_OFF = 0x1
+ PR_RISCV_V_VSTATE_CTRL_ON = 0x2
PR_SCHED_CORE = 0x3e
PR_SCHED_CORE_CREATE = 0x1
PR_SCHED_CORE_GET = 0x0
@@ -3452,6 +3469,7 @@ const (
XDP_PACKET_HEADROOM = 0x100
XDP_PGOFF_RX_RING = 0x0
XDP_PGOFF_TX_RING = 0x80000000
+ XDP_PKT_CONTD = 0x1
XDP_RING_NEED_WAKEUP = 0x1
XDP_RX_RING = 0x2
XDP_SHARED_UMEM = 0x1
@@ -3464,6 +3482,7 @@ const (
XDP_UMEM_REG = 0x4
XDP_UMEM_UNALIGNED_CHUNK_FLAG = 0x1
XDP_USE_NEED_WAKEUP = 0x8
+ XDP_USE_SG = 0x10
XDP_ZEROCOPY = 0x4
XENFS_SUPER_MAGIC = 0xabba1974
XFS_SUPER_MAGIC = 0x58465342
diff --git a/vendor/golang.org/x/sys/unix/zerrors_linux_386.go b/vendor/golang.org/x/sys/unix/zerrors_linux_386.go
index cfb14300..4920821c 100644
--- a/vendor/golang.org/x/sys/unix/zerrors_linux_386.go
+++ b/vendor/golang.org/x/sys/unix/zerrors_linux_386.go
@@ -2,7 +2,6 @@
// Code generated by the command above; see README.md. DO NOT EDIT.
//go:build 386 && linux
-// +build 386,linux
// Code generated by cmd/cgo -godefs; DO NOT EDIT.
// cgo -godefs -- -Wall -Werror -static -I/tmp/386/include -m32 _const.go
@@ -326,10 +325,12 @@ const (
SO_NOFCS = 0x2b
SO_OOBINLINE = 0xa
SO_PASSCRED = 0x10
+ SO_PASSPIDFD = 0x4c
SO_PASSSEC = 0x22
SO_PEEK_OFF = 0x2a
SO_PEERCRED = 0x11
SO_PEERGROUPS = 0x3b
+ SO_PEERPIDFD = 0x4d
SO_PEERSEC = 0x1f
SO_PREFER_BUSY_POLL = 0x45
SO_PROTOCOL = 0x26
diff --git a/vendor/golang.org/x/sys/unix/zerrors_linux_amd64.go b/vendor/golang.org/x/sys/unix/zerrors_linux_amd64.go
index df64f2d5..a0c1e411 100644
--- a/vendor/golang.org/x/sys/unix/zerrors_linux_amd64.go
+++ b/vendor/golang.org/x/sys/unix/zerrors_linux_amd64.go
@@ -2,7 +2,6 @@
// Code generated by the command above; see README.md. DO NOT EDIT.
//go:build amd64 && linux
-// +build amd64,linux
// Code generated by cmd/cgo -godefs; DO NOT EDIT.
// cgo -godefs -- -Wall -Werror -static -I/tmp/amd64/include -m64 _const.go
@@ -327,10 +326,12 @@ const (
SO_NOFCS = 0x2b
SO_OOBINLINE = 0xa
SO_PASSCRED = 0x10
+ SO_PASSPIDFD = 0x4c
SO_PASSSEC = 0x22
SO_PEEK_OFF = 0x2a
SO_PEERCRED = 0x11
SO_PEERGROUPS = 0x3b
+ SO_PEERPIDFD = 0x4d
SO_PEERSEC = 0x1f
SO_PREFER_BUSY_POLL = 0x45
SO_PROTOCOL = 0x26
diff --git a/vendor/golang.org/x/sys/unix/zerrors_linux_arm.go b/vendor/golang.org/x/sys/unix/zerrors_linux_arm.go
index 3025cd5b..c6398556 100644
--- a/vendor/golang.org/x/sys/unix/zerrors_linux_arm.go
+++ b/vendor/golang.org/x/sys/unix/zerrors_linux_arm.go
@@ -2,7 +2,6 @@
// Code generated by the command above; see README.md. DO NOT EDIT.
//go:build arm && linux
-// +build arm,linux
// Code generated by cmd/cgo -godefs; DO NOT EDIT.
// cgo -godefs -- -Wall -Werror -static -I/tmp/arm/include _const.go
@@ -333,10 +332,12 @@ const (
SO_NOFCS = 0x2b
SO_OOBINLINE = 0xa
SO_PASSCRED = 0x10
+ SO_PASSPIDFD = 0x4c
SO_PASSSEC = 0x22
SO_PEEK_OFF = 0x2a
SO_PEERCRED = 0x11
SO_PEERGROUPS = 0x3b
+ SO_PEERPIDFD = 0x4d
SO_PEERSEC = 0x1f
SO_PREFER_BUSY_POLL = 0x45
SO_PROTOCOL = 0x26
diff --git a/vendor/golang.org/x/sys/unix/zerrors_linux_arm64.go b/vendor/golang.org/x/sys/unix/zerrors_linux_arm64.go
index 09e1ffbe..47cc62e2 100644
--- a/vendor/golang.org/x/sys/unix/zerrors_linux_arm64.go
+++ b/vendor/golang.org/x/sys/unix/zerrors_linux_arm64.go
@@ -2,7 +2,6 @@
// Code generated by the command above; see README.md. DO NOT EDIT.
//go:build arm64 && linux
-// +build arm64,linux
// Code generated by cmd/cgo -godefs; DO NOT EDIT.
// cgo -godefs -- -Wall -Werror -static -I/tmp/arm64/include -fsigned-char _const.go
@@ -323,10 +322,12 @@ const (
SO_NOFCS = 0x2b
SO_OOBINLINE = 0xa
SO_PASSCRED = 0x10
+ SO_PASSPIDFD = 0x4c
SO_PASSSEC = 0x22
SO_PEEK_OFF = 0x2a
SO_PEERCRED = 0x11
SO_PEERGROUPS = 0x3b
+ SO_PEERPIDFD = 0x4d
SO_PEERSEC = 0x1f
SO_PREFER_BUSY_POLL = 0x45
SO_PROTOCOL = 0x26
diff --git a/vendor/golang.org/x/sys/unix/zerrors_linux_loong64.go b/vendor/golang.org/x/sys/unix/zerrors_linux_loong64.go
index a4572354..27ac4a09 100644
--- a/vendor/golang.org/x/sys/unix/zerrors_linux_loong64.go
+++ b/vendor/golang.org/x/sys/unix/zerrors_linux_loong64.go
@@ -2,7 +2,6 @@
// Code generated by the command above; see README.md. DO NOT EDIT.
//go:build loong64 && linux
-// +build loong64,linux
// Code generated by cmd/cgo -godefs; DO NOT EDIT.
// cgo -godefs -- -Wall -Werror -static -I/tmp/loong64/include _const.go
@@ -118,6 +117,9 @@ const (
IUCLC = 0x200
IXOFF = 0x1000
IXON = 0x400
+ LASX_CTX_MAGIC = 0x41535801
+ LBT_CTX_MAGIC = 0x42540001
+ LSX_CTX_MAGIC = 0x53580001
MAP_ANON = 0x20
MAP_ANONYMOUS = 0x20
MAP_DENYWRITE = 0x800
@@ -317,10 +319,12 @@ const (
SO_NOFCS = 0x2b
SO_OOBINLINE = 0xa
SO_PASSCRED = 0x10
+ SO_PASSPIDFD = 0x4c
SO_PASSSEC = 0x22
SO_PEEK_OFF = 0x2a
SO_PEERCRED = 0x11
SO_PEERGROUPS = 0x3b
+ SO_PEERPIDFD = 0x4d
SO_PEERSEC = 0x1f
SO_PREFER_BUSY_POLL = 0x45
SO_PROTOCOL = 0x26
diff --git a/vendor/golang.org/x/sys/unix/zerrors_linux_mips.go b/vendor/golang.org/x/sys/unix/zerrors_linux_mips.go
index fee7dfb8..54694642 100644
--- a/vendor/golang.org/x/sys/unix/zerrors_linux_mips.go
+++ b/vendor/golang.org/x/sys/unix/zerrors_linux_mips.go
@@ -2,7 +2,6 @@
// Code generated by the command above; see README.md. DO NOT EDIT.
//go:build mips && linux
-// +build mips,linux
// Code generated by cmd/cgo -godefs; DO NOT EDIT.
// cgo -godefs -- -Wall -Werror -static -I/tmp/mips/include _const.go
@@ -326,10 +325,12 @@ const (
SO_NOFCS = 0x2b
SO_OOBINLINE = 0x100
SO_PASSCRED = 0x11
+ SO_PASSPIDFD = 0x4c
SO_PASSSEC = 0x22
SO_PEEK_OFF = 0x2a
SO_PEERCRED = 0x12
SO_PEERGROUPS = 0x3b
+ SO_PEERPIDFD = 0x4d
SO_PEERSEC = 0x1e
SO_PREFER_BUSY_POLL = 0x45
SO_PROTOCOL = 0x1028
diff --git a/vendor/golang.org/x/sys/unix/zerrors_linux_mips64.go b/vendor/golang.org/x/sys/unix/zerrors_linux_mips64.go
index a5b2373a..3adb81d7 100644
--- a/vendor/golang.org/x/sys/unix/zerrors_linux_mips64.go
+++ b/vendor/golang.org/x/sys/unix/zerrors_linux_mips64.go
@@ -2,7 +2,6 @@
// Code generated by the command above; see README.md. DO NOT EDIT.
//go:build mips64 && linux
-// +build mips64,linux
// Code generated by cmd/cgo -godefs; DO NOT EDIT.
// cgo -godefs -- -Wall -Werror -static -I/tmp/mips64/include _const.go
@@ -326,10 +325,12 @@ const (
SO_NOFCS = 0x2b
SO_OOBINLINE = 0x100
SO_PASSCRED = 0x11
+ SO_PASSPIDFD = 0x4c
SO_PASSSEC = 0x22
SO_PEEK_OFF = 0x2a
SO_PEERCRED = 0x12
SO_PEERGROUPS = 0x3b
+ SO_PEERPIDFD = 0x4d
SO_PEERSEC = 0x1e
SO_PREFER_BUSY_POLL = 0x45
SO_PROTOCOL = 0x1028
diff --git a/vendor/golang.org/x/sys/unix/zerrors_linux_mips64le.go b/vendor/golang.org/x/sys/unix/zerrors_linux_mips64le.go
index 5dde82c9..2dfe98f0 100644
--- a/vendor/golang.org/x/sys/unix/zerrors_linux_mips64le.go
+++ b/vendor/golang.org/x/sys/unix/zerrors_linux_mips64le.go
@@ -2,7 +2,6 @@
// Code generated by the command above; see README.md. DO NOT EDIT.
//go:build mips64le && linux
-// +build mips64le,linux
// Code generated by cmd/cgo -godefs; DO NOT EDIT.
// cgo -godefs -- -Wall -Werror -static -I/tmp/mips64le/include _const.go
@@ -326,10 +325,12 @@ const (
SO_NOFCS = 0x2b
SO_OOBINLINE = 0x100
SO_PASSCRED = 0x11
+ SO_PASSPIDFD = 0x4c
SO_PASSSEC = 0x22
SO_PEEK_OFF = 0x2a
SO_PEERCRED = 0x12
SO_PEERGROUPS = 0x3b
+ SO_PEERPIDFD = 0x4d
SO_PEERSEC = 0x1e
SO_PREFER_BUSY_POLL = 0x45
SO_PROTOCOL = 0x1028
diff --git a/vendor/golang.org/x/sys/unix/zerrors_linux_mipsle.go b/vendor/golang.org/x/sys/unix/zerrors_linux_mipsle.go
index 2e80ea6b..f5398f84 100644
--- a/vendor/golang.org/x/sys/unix/zerrors_linux_mipsle.go
+++ b/vendor/golang.org/x/sys/unix/zerrors_linux_mipsle.go
@@ -2,7 +2,6 @@
// Code generated by the command above; see README.md. DO NOT EDIT.
//go:build mipsle && linux
-// +build mipsle,linux
// Code generated by cmd/cgo -godefs; DO NOT EDIT.
// cgo -godefs -- -Wall -Werror -static -I/tmp/mipsle/include _const.go
@@ -326,10 +325,12 @@ const (
SO_NOFCS = 0x2b
SO_OOBINLINE = 0x100
SO_PASSCRED = 0x11
+ SO_PASSPIDFD = 0x4c
SO_PASSSEC = 0x22
SO_PEEK_OFF = 0x2a
SO_PEERCRED = 0x12
SO_PEERGROUPS = 0x3b
+ SO_PEERPIDFD = 0x4d
SO_PEERSEC = 0x1e
SO_PREFER_BUSY_POLL = 0x45
SO_PROTOCOL = 0x1028
diff --git a/vendor/golang.org/x/sys/unix/zerrors_linux_ppc.go b/vendor/golang.org/x/sys/unix/zerrors_linux_ppc.go
index a65dcd7c..c54f152d 100644
--- a/vendor/golang.org/x/sys/unix/zerrors_linux_ppc.go
+++ b/vendor/golang.org/x/sys/unix/zerrors_linux_ppc.go
@@ -2,7 +2,6 @@
// Code generated by the command above; see README.md. DO NOT EDIT.
//go:build ppc && linux
-// +build ppc,linux
// Code generated by cmd/cgo -godefs; DO NOT EDIT.
// cgo -godefs -- -Wall -Werror -static -I/tmp/ppc/include _const.go
@@ -381,10 +380,12 @@ const (
SO_NOFCS = 0x2b
SO_OOBINLINE = 0xa
SO_PASSCRED = 0x14
+ SO_PASSPIDFD = 0x4c
SO_PASSSEC = 0x22
SO_PEEK_OFF = 0x2a
SO_PEERCRED = 0x15
SO_PEERGROUPS = 0x3b
+ SO_PEERPIDFD = 0x4d
SO_PEERSEC = 0x1f
SO_PREFER_BUSY_POLL = 0x45
SO_PROTOCOL = 0x26
diff --git a/vendor/golang.org/x/sys/unix/zerrors_linux_ppc64.go b/vendor/golang.org/x/sys/unix/zerrors_linux_ppc64.go
index cbd34e3d..76057dc7 100644
--- a/vendor/golang.org/x/sys/unix/zerrors_linux_ppc64.go
+++ b/vendor/golang.org/x/sys/unix/zerrors_linux_ppc64.go
@@ -2,7 +2,6 @@
// Code generated by the command above; see README.md. DO NOT EDIT.
//go:build ppc64 && linux
-// +build ppc64,linux
// Code generated by cmd/cgo -godefs; DO NOT EDIT.
// cgo -godefs -- -Wall -Werror -static -I/tmp/ppc64/include _const.go
@@ -385,10 +384,12 @@ const (
SO_NOFCS = 0x2b
SO_OOBINLINE = 0xa
SO_PASSCRED = 0x14
+ SO_PASSPIDFD = 0x4c
SO_PASSSEC = 0x22
SO_PEEK_OFF = 0x2a
SO_PEERCRED = 0x15
SO_PEERGROUPS = 0x3b
+ SO_PEERPIDFD = 0x4d
SO_PEERSEC = 0x1f
SO_PREFER_BUSY_POLL = 0x45
SO_PROTOCOL = 0x26
diff --git a/vendor/golang.org/x/sys/unix/zerrors_linux_ppc64le.go b/vendor/golang.org/x/sys/unix/zerrors_linux_ppc64le.go
index e4afa7a3..e0c3725e 100644
--- a/vendor/golang.org/x/sys/unix/zerrors_linux_ppc64le.go
+++ b/vendor/golang.org/x/sys/unix/zerrors_linux_ppc64le.go
@@ -2,7 +2,6 @@
// Code generated by the command above; see README.md. DO NOT EDIT.
//go:build ppc64le && linux
-// +build ppc64le,linux
// Code generated by cmd/cgo -godefs; DO NOT EDIT.
// cgo -godefs -- -Wall -Werror -static -I/tmp/ppc64le/include _const.go
@@ -385,10 +384,12 @@ const (
SO_NOFCS = 0x2b
SO_OOBINLINE = 0xa
SO_PASSCRED = 0x14
+ SO_PASSPIDFD = 0x4c
SO_PASSSEC = 0x22
SO_PEEK_OFF = 0x2a
SO_PEERCRED = 0x15
SO_PEERGROUPS = 0x3b
+ SO_PEERPIDFD = 0x4d
SO_PEERSEC = 0x1f
SO_PREFER_BUSY_POLL = 0x45
SO_PROTOCOL = 0x26
diff --git a/vendor/golang.org/x/sys/unix/zerrors_linux_riscv64.go b/vendor/golang.org/x/sys/unix/zerrors_linux_riscv64.go
index 44f45a03..18f2813e 100644
--- a/vendor/golang.org/x/sys/unix/zerrors_linux_riscv64.go
+++ b/vendor/golang.org/x/sys/unix/zerrors_linux_riscv64.go
@@ -2,7 +2,6 @@
// Code generated by the command above; see README.md. DO NOT EDIT.
//go:build riscv64 && linux
-// +build riscv64,linux
// Code generated by cmd/cgo -godefs; DO NOT EDIT.
// cgo -godefs -- -Wall -Werror -static -I/tmp/riscv64/include _const.go
@@ -228,6 +227,9 @@ const (
PPPIOCUNBRIDGECHAN = 0x7434
PPPIOCXFERUNIT = 0x744e
PR_SET_PTRACER_ANY = 0xffffffffffffffff
+ PTRACE_GETFDPIC = 0x21
+ PTRACE_GETFDPIC_EXEC = 0x0
+ PTRACE_GETFDPIC_INTERP = 0x1
RLIMIT_AS = 0x9
RLIMIT_MEMLOCK = 0x8
RLIMIT_NOFILE = 0x7
@@ -314,10 +316,12 @@ const (
SO_NOFCS = 0x2b
SO_OOBINLINE = 0xa
SO_PASSCRED = 0x10
+ SO_PASSPIDFD = 0x4c
SO_PASSSEC = 0x22
SO_PEEK_OFF = 0x2a
SO_PEERCRED = 0x11
SO_PEERGROUPS = 0x3b
+ SO_PEERPIDFD = 0x4d
SO_PEERSEC = 0x1f
SO_PREFER_BUSY_POLL = 0x45
SO_PROTOCOL = 0x26
diff --git a/vendor/golang.org/x/sys/unix/zerrors_linux_s390x.go b/vendor/golang.org/x/sys/unix/zerrors_linux_s390x.go
index 74733e26..11619d4e 100644
--- a/vendor/golang.org/x/sys/unix/zerrors_linux_s390x.go
+++ b/vendor/golang.org/x/sys/unix/zerrors_linux_s390x.go
@@ -2,7 +2,6 @@
// Code generated by the command above; see README.md. DO NOT EDIT.
//go:build s390x && linux
-// +build s390x,linux
// Code generated by cmd/cgo -godefs; DO NOT EDIT.
// cgo -godefs -- -Wall -Werror -static -I/tmp/s390x/include -fsigned-char _const.go
@@ -389,10 +388,12 @@ const (
SO_NOFCS = 0x2b
SO_OOBINLINE = 0xa
SO_PASSCRED = 0x10
+ SO_PASSPIDFD = 0x4c
SO_PASSSEC = 0x22
SO_PEEK_OFF = 0x2a
SO_PEERCRED = 0x11
SO_PEERGROUPS = 0x3b
+ SO_PEERPIDFD = 0x4d
SO_PEERSEC = 0x1f
SO_PREFER_BUSY_POLL = 0x45
SO_PROTOCOL = 0x26
diff --git a/vendor/golang.org/x/sys/unix/zerrors_linux_sparc64.go b/vendor/golang.org/x/sys/unix/zerrors_linux_sparc64.go
index f5f3934b..396d994d 100644
--- a/vendor/golang.org/x/sys/unix/zerrors_linux_sparc64.go
+++ b/vendor/golang.org/x/sys/unix/zerrors_linux_sparc64.go
@@ -2,7 +2,6 @@
// Code generated by the command above; see README.md. DO NOT EDIT.
//go:build sparc64 && linux
-// +build sparc64,linux
// Code generated by cmd/cgo -godefs; DO NOT EDIT.
// cgo -godefs -- -Wall -Werror -static -I/tmp/sparc64/include _const.go
@@ -428,10 +427,12 @@ const (
SO_NOFCS = 0x27
SO_OOBINLINE = 0x100
SO_PASSCRED = 0x2
+ SO_PASSPIDFD = 0x55
SO_PASSSEC = 0x1f
SO_PEEK_OFF = 0x26
SO_PEERCRED = 0x40
SO_PEERGROUPS = 0x3d
+ SO_PEERPIDFD = 0x56
SO_PEERSEC = 0x1e
SO_PREFER_BUSY_POLL = 0x48
SO_PROTOCOL = 0x1028
diff --git a/vendor/golang.org/x/sys/unix/zerrors_netbsd_386.go b/vendor/golang.org/x/sys/unix/zerrors_netbsd_386.go
index 72f7420d..130085df 100644
--- a/vendor/golang.org/x/sys/unix/zerrors_netbsd_386.go
+++ b/vendor/golang.org/x/sys/unix/zerrors_netbsd_386.go
@@ -2,7 +2,6 @@
// Code generated by the command above; see README.md. DO NOT EDIT.
//go:build 386 && netbsd
-// +build 386,netbsd
// Code generated by cmd/cgo -godefs; DO NOT EDIT.
// cgo -godefs -- -m32 _const.go
diff --git a/vendor/golang.org/x/sys/unix/zerrors_netbsd_amd64.go b/vendor/golang.org/x/sys/unix/zerrors_netbsd_amd64.go
index 8d4eb0c0..84769a1a 100644
--- a/vendor/golang.org/x/sys/unix/zerrors_netbsd_amd64.go
+++ b/vendor/golang.org/x/sys/unix/zerrors_netbsd_amd64.go
@@ -2,7 +2,6 @@
// Code generated by the command above; see README.md. DO NOT EDIT.
//go:build amd64 && netbsd
-// +build amd64,netbsd
// Code generated by cmd/cgo -godefs; DO NOT EDIT.
// cgo -godefs -- -m64 _const.go
diff --git a/vendor/golang.org/x/sys/unix/zerrors_netbsd_arm.go b/vendor/golang.org/x/sys/unix/zerrors_netbsd_arm.go
index 9eef9749..602ded00 100644
--- a/vendor/golang.org/x/sys/unix/zerrors_netbsd_arm.go
+++ b/vendor/golang.org/x/sys/unix/zerrors_netbsd_arm.go
@@ -2,7 +2,6 @@
// Code generated by the command above; see README.md. DO NOT EDIT.
//go:build arm && netbsd
-// +build arm,netbsd
// Code generated by cmd/cgo -godefs; DO NOT EDIT.
// cgo -godefs -- -marm _const.go
diff --git a/vendor/golang.org/x/sys/unix/zerrors_netbsd_arm64.go b/vendor/golang.org/x/sys/unix/zerrors_netbsd_arm64.go
index 3b62ba19..efc0406e 100644
--- a/vendor/golang.org/x/sys/unix/zerrors_netbsd_arm64.go
+++ b/vendor/golang.org/x/sys/unix/zerrors_netbsd_arm64.go
@@ -2,7 +2,6 @@
// Code generated by the command above; see README.md. DO NOT EDIT.
//go:build arm64 && netbsd
-// +build arm64,netbsd
// Code generated by cmd/cgo -godefs; DO NOT EDIT.
// cgo -godefs -- -m64 _const.go
diff --git a/vendor/golang.org/x/sys/unix/zerrors_openbsd_386.go b/vendor/golang.org/x/sys/unix/zerrors_openbsd_386.go
index af20e474..5a6500f8 100644
--- a/vendor/golang.org/x/sys/unix/zerrors_openbsd_386.go
+++ b/vendor/golang.org/x/sys/unix/zerrors_openbsd_386.go
@@ -2,7 +2,6 @@
// Code generated by the command above; see README.md. DO NOT EDIT.
//go:build 386 && openbsd
-// +build 386,openbsd
// Code generated by cmd/cgo -godefs; DO NOT EDIT.
// cgo -godefs -- -m32 _const.go
diff --git a/vendor/golang.org/x/sys/unix/zerrors_openbsd_amd64.go b/vendor/golang.org/x/sys/unix/zerrors_openbsd_amd64.go
index 6015fcb2..a5aeeb97 100644
--- a/vendor/golang.org/x/sys/unix/zerrors_openbsd_amd64.go
+++ b/vendor/golang.org/x/sys/unix/zerrors_openbsd_amd64.go
@@ -2,7 +2,6 @@
// Code generated by the command above; see README.md. DO NOT EDIT.
//go:build amd64 && openbsd
-// +build amd64,openbsd
// Code generated by cmd/cgo -godefs; DO NOT EDIT.
// cgo -godefs -- -m64 _const.go
diff --git a/vendor/golang.org/x/sys/unix/zerrors_openbsd_arm.go b/vendor/golang.org/x/sys/unix/zerrors_openbsd_arm.go
index 8d44955e..0e9748a7 100644
--- a/vendor/golang.org/x/sys/unix/zerrors_openbsd_arm.go
+++ b/vendor/golang.org/x/sys/unix/zerrors_openbsd_arm.go
@@ -2,7 +2,6 @@
// Code generated by the command above; see README.md. DO NOT EDIT.
//go:build arm && openbsd
-// +build arm,openbsd
// Code generated by cmd/cgo -godefs; DO NOT EDIT.
// cgo -godefs -- _const.go
diff --git a/vendor/golang.org/x/sys/unix/zerrors_openbsd_arm64.go b/vendor/golang.org/x/sys/unix/zerrors_openbsd_arm64.go
index ae16fe75..4f4449ab 100644
--- a/vendor/golang.org/x/sys/unix/zerrors_openbsd_arm64.go
+++ b/vendor/golang.org/x/sys/unix/zerrors_openbsd_arm64.go
@@ -2,7 +2,6 @@
// Code generated by the command above; see README.md. DO NOT EDIT.
//go:build arm64 && openbsd
-// +build arm64,openbsd
// Code generated by cmd/cgo -godefs; DO NOT EDIT.
// cgo -godefs -- -m64 _const.go
diff --git a/vendor/golang.org/x/sys/unix/zerrors_openbsd_mips64.go b/vendor/golang.org/x/sys/unix/zerrors_openbsd_mips64.go
index 03d90fe3..76a363f0 100644
--- a/vendor/golang.org/x/sys/unix/zerrors_openbsd_mips64.go
+++ b/vendor/golang.org/x/sys/unix/zerrors_openbsd_mips64.go
@@ -2,7 +2,6 @@
// Code generated by the command above; see README.md. DO NOT EDIT.
//go:build mips64 && openbsd
-// +build mips64,openbsd
// Code generated by cmd/cgo -godefs; DO NOT EDIT.
// cgo -godefs -- -m64 _const.go
diff --git a/vendor/golang.org/x/sys/unix/zerrors_openbsd_ppc64.go b/vendor/golang.org/x/sys/unix/zerrors_openbsd_ppc64.go
index 8e2c51b1..43ca0cdf 100644
--- a/vendor/golang.org/x/sys/unix/zerrors_openbsd_ppc64.go
+++ b/vendor/golang.org/x/sys/unix/zerrors_openbsd_ppc64.go
@@ -2,7 +2,6 @@
// Code generated by the command above; see README.md. DO NOT EDIT.
//go:build ppc64 && openbsd
-// +build ppc64,openbsd
// Code generated by cmd/cgo -godefs; DO NOT EDIT.
// cgo -godefs -- -m64 _const.go
diff --git a/vendor/golang.org/x/sys/unix/zerrors_openbsd_riscv64.go b/vendor/golang.org/x/sys/unix/zerrors_openbsd_riscv64.go
index 13d40303..b1b8bb20 100644
--- a/vendor/golang.org/x/sys/unix/zerrors_openbsd_riscv64.go
+++ b/vendor/golang.org/x/sys/unix/zerrors_openbsd_riscv64.go
@@ -2,7 +2,6 @@
// Code generated by the command above; see README.md. DO NOT EDIT.
//go:build riscv64 && openbsd
-// +build riscv64,openbsd
// Code generated by cmd/cgo -godefs; DO NOT EDIT.
// cgo -godefs -- -m64 _const.go
diff --git a/vendor/golang.org/x/sys/unix/zerrors_solaris_amd64.go b/vendor/golang.org/x/sys/unix/zerrors_solaris_amd64.go
index 1afee6a0..d2ddd317 100644
--- a/vendor/golang.org/x/sys/unix/zerrors_solaris_amd64.go
+++ b/vendor/golang.org/x/sys/unix/zerrors_solaris_amd64.go
@@ -2,7 +2,6 @@
// Code generated by the command above; see README.md. DO NOT EDIT.
//go:build amd64 && solaris
-// +build amd64,solaris
// Code generated by cmd/cgo -godefs; DO NOT EDIT.
// cgo -godefs -- -m64 _const.go
diff --git a/vendor/golang.org/x/sys/unix/zerrors_zos_s390x.go b/vendor/golang.org/x/sys/unix/zerrors_zos_s390x.go
index fc7d0506..4dfd2e05 100644
--- a/vendor/golang.org/x/sys/unix/zerrors_zos_s390x.go
+++ b/vendor/golang.org/x/sys/unix/zerrors_zos_s390x.go
@@ -3,7 +3,6 @@
// license that can be found in the LICENSE file.
//go:build zos && s390x
-// +build zos,s390x
// Hand edited based on zerrors_linux_s390x.go
// TODO: auto-generate.
diff --git a/vendor/golang.org/x/sys/unix/zptrace_armnn_linux.go b/vendor/golang.org/x/sys/unix/zptrace_armnn_linux.go
index 97f20ca2..586317c7 100644
--- a/vendor/golang.org/x/sys/unix/zptrace_armnn_linux.go
+++ b/vendor/golang.org/x/sys/unix/zptrace_armnn_linux.go
@@ -1,8 +1,6 @@
// Code generated by linux/mkall.go generatePtracePair("arm", "arm64"). DO NOT EDIT.
//go:build linux && (arm || arm64)
-// +build linux
-// +build arm arm64
package unix
diff --git a/vendor/golang.org/x/sys/unix/zptrace_mipsnn_linux.go b/vendor/golang.org/x/sys/unix/zptrace_mipsnn_linux.go
index 0b5f7943..d7c881be 100644
--- a/vendor/golang.org/x/sys/unix/zptrace_mipsnn_linux.go
+++ b/vendor/golang.org/x/sys/unix/zptrace_mipsnn_linux.go
@@ -1,8 +1,6 @@
// Code generated by linux/mkall.go generatePtracePair("mips", "mips64"). DO NOT EDIT.
//go:build linux && (mips || mips64)
-// +build linux
-// +build mips mips64
package unix
diff --git a/vendor/golang.org/x/sys/unix/zptrace_mipsnnle_linux.go b/vendor/golang.org/x/sys/unix/zptrace_mipsnnle_linux.go
index 2807f7e6..2d2de5d2 100644
--- a/vendor/golang.org/x/sys/unix/zptrace_mipsnnle_linux.go
+++ b/vendor/golang.org/x/sys/unix/zptrace_mipsnnle_linux.go
@@ -1,8 +1,6 @@
// Code generated by linux/mkall.go generatePtracePair("mipsle", "mips64le"). DO NOT EDIT.
//go:build linux && (mipsle || mips64le)
-// +build linux
-// +build mipsle mips64le
package unix
diff --git a/vendor/golang.org/x/sys/unix/zptrace_x86_linux.go b/vendor/golang.org/x/sys/unix/zptrace_x86_linux.go
index 281ea64e..5adc79fb 100644
--- a/vendor/golang.org/x/sys/unix/zptrace_x86_linux.go
+++ b/vendor/golang.org/x/sys/unix/zptrace_x86_linux.go
@@ -1,8 +1,6 @@
// Code generated by linux/mkall.go generatePtracePair("386", "amd64"). DO NOT EDIT.
//go:build linux && (386 || amd64)
-// +build linux
-// +build 386 amd64
package unix
diff --git a/vendor/golang.org/x/sys/unix/zsyscall_aix_ppc.go b/vendor/golang.org/x/sys/unix/zsyscall_aix_ppc.go
index 9a257219..6ea64a3c 100644
--- a/vendor/golang.org/x/sys/unix/zsyscall_aix_ppc.go
+++ b/vendor/golang.org/x/sys/unix/zsyscall_aix_ppc.go
@@ -2,7 +2,6 @@
// Code generated by the command above; see README.md. DO NOT EDIT.
//go:build aix && ppc
-// +build aix,ppc
package unix
@@ -817,28 +816,6 @@ func write(fd int, p []byte) (n int, err error) {
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
-func readlen(fd int, p *byte, np int) (n int, err error) {
- r0, er := C.read(C.int(fd), C.uintptr_t(uintptr(unsafe.Pointer(p))), C.size_t(np))
- n = int(r0)
- if r0 == -1 && er != nil {
- err = er
- }
- return
-}
-
-// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
-
-func writelen(fd int, p *byte, np int) (n int, err error) {
- r0, er := C.write(C.int(fd), C.uintptr_t(uintptr(unsafe.Pointer(p))), C.size_t(np))
- n = int(r0)
- if r0 == -1 && er != nil {
- err = er
- }
- return
-}
-
-// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
-
func Dup2(oldfd int, newfd int) (err error) {
r0, er := C.dup2(C.int(oldfd), C.int(newfd))
if r0 == -1 && er != nil {
diff --git a/vendor/golang.org/x/sys/unix/zsyscall_aix_ppc64.go b/vendor/golang.org/x/sys/unix/zsyscall_aix_ppc64.go
index 6de80c20..99ee4399 100644
--- a/vendor/golang.org/x/sys/unix/zsyscall_aix_ppc64.go
+++ b/vendor/golang.org/x/sys/unix/zsyscall_aix_ppc64.go
@@ -2,7 +2,6 @@
// Code generated by the command above; see README.md. DO NOT EDIT.
//go:build aix && ppc64
-// +build aix,ppc64
package unix
@@ -762,28 +761,6 @@ func write(fd int, p []byte) (n int, err error) {
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
-func readlen(fd int, p *byte, np int) (n int, err error) {
- r0, e1 := callread(fd, uintptr(unsafe.Pointer(p)), np)
- n = int(r0)
- if e1 != 0 {
- err = errnoErr(e1)
- }
- return
-}
-
-// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
-
-func writelen(fd int, p *byte, np int) (n int, err error) {
- r0, e1 := callwrite(fd, uintptr(unsafe.Pointer(p)), np)
- n = int(r0)
- if e1 != 0 {
- err = errnoErr(e1)
- }
- return
-}
-
-// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
-
func Dup2(oldfd int, newfd int) (err error) {
_, e1 := calldup2(oldfd, newfd)
if e1 != 0 {
diff --git a/vendor/golang.org/x/sys/unix/zsyscall_aix_ppc64_gc.go b/vendor/golang.org/x/sys/unix/zsyscall_aix_ppc64_gc.go
index c4d50ae5..b68a7836 100644
--- a/vendor/golang.org/x/sys/unix/zsyscall_aix_ppc64_gc.go
+++ b/vendor/golang.org/x/sys/unix/zsyscall_aix_ppc64_gc.go
@@ -2,7 +2,6 @@
// Code generated by the command above; see README.md. DO NOT EDIT.
//go:build aix && ppc64 && gc
-// +build aix,ppc64,gc
package unix
diff --git a/vendor/golang.org/x/sys/unix/zsyscall_aix_ppc64_gccgo.go b/vendor/golang.org/x/sys/unix/zsyscall_aix_ppc64_gccgo.go
index 6903d3b0..0a87450b 100644
--- a/vendor/golang.org/x/sys/unix/zsyscall_aix_ppc64_gccgo.go
+++ b/vendor/golang.org/x/sys/unix/zsyscall_aix_ppc64_gccgo.go
@@ -2,7 +2,6 @@
// Code generated by the command above; see README.md. DO NOT EDIT.
//go:build aix && ppc64 && gccgo
-// +build aix,ppc64,gccgo
package unix
diff --git a/vendor/golang.org/x/sys/unix/zsyscall_darwin_amd64.go b/vendor/golang.org/x/sys/unix/zsyscall_darwin_amd64.go
index 4037ccf7..ccb02f24 100644
--- a/vendor/golang.org/x/sys/unix/zsyscall_darwin_amd64.go
+++ b/vendor/golang.org/x/sys/unix/zsyscall_darwin_amd64.go
@@ -2,7 +2,6 @@
// Code generated by the command above; see README.md. DO NOT EDIT.
//go:build darwin && amd64
-// +build darwin,amd64
package unix
@@ -725,6 +724,12 @@ func ioctl(fd int, req uint, arg uintptr) (err error) {
return
}
+var libc_ioctl_trampoline_addr uintptr
+
+//go:cgo_import_dynamic libc_ioctl ioctl "/usr/lib/libSystem.B.dylib"
+
+// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
+
func ioctlPtr(fd int, req uint, arg unsafe.Pointer) (err error) {
_, _, e1 := syscall_syscall(libc_ioctl_trampoline_addr, uintptr(fd), uintptr(req), uintptr(arg))
if e1 != 0 {
@@ -733,10 +738,6 @@ func ioctlPtr(fd int, req uint, arg unsafe.Pointer) (err error) {
return
}
-var libc_ioctl_trampoline_addr uintptr
-
-//go:cgo_import_dynamic libc_ioctl ioctl "/usr/lib/libSystem.B.dylib"
-
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
func sysctl(mib []_C_int, old *byte, oldlen *uintptr, new *byte, newlen uintptr) (err error) {
@@ -2410,28 +2411,6 @@ var libc_munmap_trampoline_addr uintptr
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
-func readlen(fd int, buf *byte, nbuf int) (n int, err error) {
- r0, _, e1 := syscall_syscall(libc_read_trampoline_addr, uintptr(fd), uintptr(unsafe.Pointer(buf)), uintptr(nbuf))
- n = int(r0)
- if e1 != 0 {
- err = errnoErr(e1)
- }
- return
-}
-
-// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
-
-func writelen(fd int, buf *byte, nbuf int) (n int, err error) {
- r0, _, e1 := syscall_syscall(libc_write_trampoline_addr, uintptr(fd), uintptr(unsafe.Pointer(buf)), uintptr(nbuf))
- n = int(r0)
- if e1 != 0 {
- err = errnoErr(e1)
- }
- return
-}
-
-// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
-
func Fstat(fd int, stat *Stat_t) (err error) {
_, _, e1 := syscall_syscall(libc_fstat64_trampoline_addr, uintptr(fd), uintptr(unsafe.Pointer(stat)), 0)
if e1 != 0 {
@@ -2521,14 +2500,6 @@ func ptrace1(request int, pid int, addr uintptr, data uintptr) (err error) {
return
}
-func ptrace1Ptr(request int, pid int, addr uintptr, data unsafe.Pointer) (err error) {
- _, _, e1 := syscall_syscall6(libc_ptrace_trampoline_addr, uintptr(request), uintptr(pid), addr, uintptr(data), 0, 0)
- if e1 != 0 {
- err = errnoErr(e1)
- }
- return
-}
-
var libc_ptrace_trampoline_addr uintptr
//go:cgo_import_dynamic libc_ptrace ptrace "/usr/lib/libSystem.B.dylib"
diff --git a/vendor/golang.org/x/sys/unix/zsyscall_darwin_amd64.s b/vendor/golang.org/x/sys/unix/zsyscall_darwin_amd64.s
index 4baaed0b..8b8bb284 100644
--- a/vendor/golang.org/x/sys/unix/zsyscall_darwin_amd64.s
+++ b/vendor/golang.org/x/sys/unix/zsyscall_darwin_amd64.s
@@ -5,703 +5,586 @@
TEXT libc_fdopendir_trampoline<>(SB),NOSPLIT,$0-0
JMP libc_fdopendir(SB)
-
GLOBL ·libc_fdopendir_trampoline_addr(SB), RODATA, $8
DATA ·libc_fdopendir_trampoline_addr(SB)/8, $libc_fdopendir_trampoline<>(SB)
TEXT libc_getgroups_trampoline<>(SB),NOSPLIT,$0-0
JMP libc_getgroups(SB)
-
GLOBL ·libc_getgroups_trampoline_addr(SB), RODATA, $8
DATA ·libc_getgroups_trampoline_addr(SB)/8, $libc_getgroups_trampoline<>(SB)
TEXT libc_setgroups_trampoline<>(SB),NOSPLIT,$0-0
JMP libc_setgroups(SB)
-
GLOBL ·libc_setgroups_trampoline_addr(SB), RODATA, $8
DATA ·libc_setgroups_trampoline_addr(SB)/8, $libc_setgroups_trampoline<>(SB)
TEXT libc_wait4_trampoline<>(SB),NOSPLIT,$0-0
JMP libc_wait4(SB)
-
GLOBL ·libc_wait4_trampoline_addr(SB), RODATA, $8
DATA ·libc_wait4_trampoline_addr(SB)/8, $libc_wait4_trampoline<>(SB)
TEXT libc_accept_trampoline<>(SB),NOSPLIT,$0-0
JMP libc_accept(SB)
-
GLOBL ·libc_accept_trampoline_addr(SB), RODATA, $8
DATA ·libc_accept_trampoline_addr(SB)/8, $libc_accept_trampoline<>(SB)
TEXT libc_bind_trampoline<>(SB),NOSPLIT,$0-0
JMP libc_bind(SB)
-
GLOBL ·libc_bind_trampoline_addr(SB), RODATA, $8
DATA ·libc_bind_trampoline_addr(SB)/8, $libc_bind_trampoline<>(SB)
TEXT libc_connect_trampoline<>(SB),NOSPLIT,$0-0
JMP libc_connect(SB)
-
GLOBL ·libc_connect_trampoline_addr(SB), RODATA, $8
DATA ·libc_connect_trampoline_addr(SB)/8, $libc_connect_trampoline<>(SB)
TEXT libc_socket_trampoline<>(SB),NOSPLIT,$0-0
JMP libc_socket(SB)
-
GLOBL ·libc_socket_trampoline_addr(SB), RODATA, $8
DATA ·libc_socket_trampoline_addr(SB)/8, $libc_socket_trampoline<>(SB)
TEXT libc_getsockopt_trampoline<>(SB),NOSPLIT,$0-0
JMP libc_getsockopt(SB)
-
GLOBL ·libc_getsockopt_trampoline_addr(SB), RODATA, $8
DATA ·libc_getsockopt_trampoline_addr(SB)/8, $libc_getsockopt_trampoline<>(SB)
TEXT libc_setsockopt_trampoline<>(SB),NOSPLIT,$0-0
JMP libc_setsockopt(SB)
-
GLOBL ·libc_setsockopt_trampoline_addr(SB), RODATA, $8
DATA ·libc_setsockopt_trampoline_addr(SB)/8, $libc_setsockopt_trampoline<>(SB)
TEXT libc_getpeername_trampoline<>(SB),NOSPLIT,$0-0
JMP libc_getpeername(SB)
-
GLOBL ·libc_getpeername_trampoline_addr(SB), RODATA, $8
DATA ·libc_getpeername_trampoline_addr(SB)/8, $libc_getpeername_trampoline<>(SB)
TEXT libc_getsockname_trampoline<>(SB),NOSPLIT,$0-0
JMP libc_getsockname(SB)
-
GLOBL ·libc_getsockname_trampoline_addr(SB), RODATA, $8
DATA ·libc_getsockname_trampoline_addr(SB)/8, $libc_getsockname_trampoline<>(SB)
TEXT libc_shutdown_trampoline<>(SB),NOSPLIT,$0-0
JMP libc_shutdown(SB)
-
GLOBL ·libc_shutdown_trampoline_addr(SB), RODATA, $8
DATA ·libc_shutdown_trampoline_addr(SB)/8, $libc_shutdown_trampoline<>(SB)
TEXT libc_socketpair_trampoline<>(SB),NOSPLIT,$0-0
JMP libc_socketpair(SB)
-
GLOBL ·libc_socketpair_trampoline_addr(SB), RODATA, $8
DATA ·libc_socketpair_trampoline_addr(SB)/8, $libc_socketpair_trampoline<>(SB)
TEXT libc_recvfrom_trampoline<>(SB),NOSPLIT,$0-0
JMP libc_recvfrom(SB)
-
GLOBL ·libc_recvfrom_trampoline_addr(SB), RODATA, $8
DATA ·libc_recvfrom_trampoline_addr(SB)/8, $libc_recvfrom_trampoline<>(SB)
TEXT libc_sendto_trampoline<>(SB),NOSPLIT,$0-0
JMP libc_sendto(SB)
-
GLOBL ·libc_sendto_trampoline_addr(SB), RODATA, $8
DATA ·libc_sendto_trampoline_addr(SB)/8, $libc_sendto_trampoline<>(SB)
TEXT libc_recvmsg_trampoline<>(SB),NOSPLIT,$0-0
JMP libc_recvmsg(SB)
-
GLOBL ·libc_recvmsg_trampoline_addr(SB), RODATA, $8
DATA ·libc_recvmsg_trampoline_addr(SB)/8, $libc_recvmsg_trampoline<>(SB)
TEXT libc_sendmsg_trampoline<>(SB),NOSPLIT,$0-0
JMP libc_sendmsg(SB)
-
GLOBL ·libc_sendmsg_trampoline_addr(SB), RODATA, $8
DATA ·libc_sendmsg_trampoline_addr(SB)/8, $libc_sendmsg_trampoline<>(SB)
TEXT libc_kevent_trampoline<>(SB),NOSPLIT,$0-0
JMP libc_kevent(SB)
-
GLOBL ·libc_kevent_trampoline_addr(SB), RODATA, $8
DATA ·libc_kevent_trampoline_addr(SB)/8, $libc_kevent_trampoline<>(SB)
TEXT libc_utimes_trampoline<>(SB),NOSPLIT,$0-0
JMP libc_utimes(SB)
-
GLOBL ·libc_utimes_trampoline_addr(SB), RODATA, $8
DATA ·libc_utimes_trampoline_addr(SB)/8, $libc_utimes_trampoline<>(SB)
TEXT libc_futimes_trampoline<>(SB),NOSPLIT,$0-0
JMP libc_futimes(SB)
-
GLOBL ·libc_futimes_trampoline_addr(SB), RODATA, $8
DATA ·libc_futimes_trampoline_addr(SB)/8, $libc_futimes_trampoline<>(SB)
TEXT libc_poll_trampoline<>(SB),NOSPLIT,$0-0
JMP libc_poll(SB)
-
GLOBL ·libc_poll_trampoline_addr(SB), RODATA, $8
DATA ·libc_poll_trampoline_addr(SB)/8, $libc_poll_trampoline<>(SB)
TEXT libc_madvise_trampoline<>(SB),NOSPLIT,$0-0
JMP libc_madvise(SB)
-
GLOBL ·libc_madvise_trampoline_addr(SB), RODATA, $8
DATA ·libc_madvise_trampoline_addr(SB)/8, $libc_madvise_trampoline<>(SB)
TEXT libc_mlock_trampoline<>(SB),NOSPLIT,$0-0
JMP libc_mlock(SB)
-
GLOBL ·libc_mlock_trampoline_addr(SB), RODATA, $8
DATA ·libc_mlock_trampoline_addr(SB)/8, $libc_mlock_trampoline<>(SB)
TEXT libc_mlockall_trampoline<>(SB),NOSPLIT,$0-0
JMP libc_mlockall(SB)
-
GLOBL ·libc_mlockall_trampoline_addr(SB), RODATA, $8
DATA ·libc_mlockall_trampoline_addr(SB)/8, $libc_mlockall_trampoline<>(SB)
TEXT libc_mprotect_trampoline<>(SB),NOSPLIT,$0-0
JMP libc_mprotect(SB)
-
GLOBL ·libc_mprotect_trampoline_addr(SB), RODATA, $8
DATA ·libc_mprotect_trampoline_addr(SB)/8, $libc_mprotect_trampoline<>(SB)
TEXT libc_msync_trampoline<>(SB),NOSPLIT,$0-0
JMP libc_msync(SB)
-
GLOBL ·libc_msync_trampoline_addr(SB), RODATA, $8
DATA ·libc_msync_trampoline_addr(SB)/8, $libc_msync_trampoline<>(SB)
TEXT libc_munlock_trampoline<>(SB),NOSPLIT,$0-0
JMP libc_munlock(SB)
-
GLOBL ·libc_munlock_trampoline_addr(SB), RODATA, $8
DATA ·libc_munlock_trampoline_addr(SB)/8, $libc_munlock_trampoline<>(SB)
TEXT libc_munlockall_trampoline<>(SB),NOSPLIT,$0-0
JMP libc_munlockall(SB)
-
GLOBL ·libc_munlockall_trampoline_addr(SB), RODATA, $8
DATA ·libc_munlockall_trampoline_addr(SB)/8, $libc_munlockall_trampoline<>(SB)
TEXT libc_closedir_trampoline<>(SB),NOSPLIT,$0-0
JMP libc_closedir(SB)
-
GLOBL ·libc_closedir_trampoline_addr(SB), RODATA, $8
DATA ·libc_closedir_trampoline_addr(SB)/8, $libc_closedir_trampoline<>(SB)
TEXT libc_readdir_r_trampoline<>(SB),NOSPLIT,$0-0
JMP libc_readdir_r(SB)
-
GLOBL ·libc_readdir_r_trampoline_addr(SB), RODATA, $8
DATA ·libc_readdir_r_trampoline_addr(SB)/8, $libc_readdir_r_trampoline<>(SB)
TEXT libc_pipe_trampoline<>(SB),NOSPLIT,$0-0
JMP libc_pipe(SB)
-
GLOBL ·libc_pipe_trampoline_addr(SB), RODATA, $8
DATA ·libc_pipe_trampoline_addr(SB)/8, $libc_pipe_trampoline<>(SB)
TEXT libc_getxattr_trampoline<>(SB),NOSPLIT,$0-0
JMP libc_getxattr(SB)
-
GLOBL ·libc_getxattr_trampoline_addr(SB), RODATA, $8
DATA ·libc_getxattr_trampoline_addr(SB)/8, $libc_getxattr_trampoline<>(SB)
TEXT libc_fgetxattr_trampoline<>(SB),NOSPLIT,$0-0
JMP libc_fgetxattr(SB)
-
GLOBL ·libc_fgetxattr_trampoline_addr(SB), RODATA, $8
DATA ·libc_fgetxattr_trampoline_addr(SB)/8, $libc_fgetxattr_trampoline<>(SB)
TEXT libc_setxattr_trampoline<>(SB),NOSPLIT,$0-0
JMP libc_setxattr(SB)
-
GLOBL ·libc_setxattr_trampoline_addr(SB), RODATA, $8
DATA ·libc_setxattr_trampoline_addr(SB)/8, $libc_setxattr_trampoline<>(SB)
TEXT libc_fsetxattr_trampoline<>(SB),NOSPLIT,$0-0
JMP libc_fsetxattr(SB)
-
GLOBL ·libc_fsetxattr_trampoline_addr(SB), RODATA, $8
DATA ·libc_fsetxattr_trampoline_addr(SB)/8, $libc_fsetxattr_trampoline<>(SB)
TEXT libc_removexattr_trampoline<>(SB),NOSPLIT,$0-0
JMP libc_removexattr(SB)
-
GLOBL ·libc_removexattr_trampoline_addr(SB), RODATA, $8
DATA ·libc_removexattr_trampoline_addr(SB)/8, $libc_removexattr_trampoline<>(SB)
TEXT libc_fremovexattr_trampoline<>(SB),NOSPLIT,$0-0
JMP libc_fremovexattr(SB)
-
GLOBL ·libc_fremovexattr_trampoline_addr(SB), RODATA, $8
DATA ·libc_fremovexattr_trampoline_addr(SB)/8, $libc_fremovexattr_trampoline<>(SB)
TEXT libc_listxattr_trampoline<>(SB),NOSPLIT,$0-0
JMP libc_listxattr(SB)
-
GLOBL ·libc_listxattr_trampoline_addr(SB), RODATA, $8
DATA ·libc_listxattr_trampoline_addr(SB)/8, $libc_listxattr_trampoline<>(SB)
TEXT libc_flistxattr_trampoline<>(SB),NOSPLIT,$0-0
JMP libc_flistxattr(SB)
-
GLOBL ·libc_flistxattr_trampoline_addr(SB), RODATA, $8
DATA ·libc_flistxattr_trampoline_addr(SB)/8, $libc_flistxattr_trampoline<>(SB)
TEXT libc_utimensat_trampoline<>(SB),NOSPLIT,$0-0
JMP libc_utimensat(SB)
-
GLOBL ·libc_utimensat_trampoline_addr(SB), RODATA, $8
DATA ·libc_utimensat_trampoline_addr(SB)/8, $libc_utimensat_trampoline<>(SB)
TEXT libc_fcntl_trampoline<>(SB),NOSPLIT,$0-0
JMP libc_fcntl(SB)
-
GLOBL ·libc_fcntl_trampoline_addr(SB), RODATA, $8
DATA ·libc_fcntl_trampoline_addr(SB)/8, $libc_fcntl_trampoline<>(SB)
TEXT libc_kill_trampoline<>(SB),NOSPLIT,$0-0
JMP libc_kill(SB)
-
GLOBL ·libc_kill_trampoline_addr(SB), RODATA, $8
DATA ·libc_kill_trampoline_addr(SB)/8, $libc_kill_trampoline<>(SB)
TEXT libc_ioctl_trampoline<>(SB),NOSPLIT,$0-0
JMP libc_ioctl(SB)
-
GLOBL ·libc_ioctl_trampoline_addr(SB), RODATA, $8
DATA ·libc_ioctl_trampoline_addr(SB)/8, $libc_ioctl_trampoline<>(SB)
TEXT libc_sysctl_trampoline<>(SB),NOSPLIT,$0-0
JMP libc_sysctl(SB)
-
GLOBL ·libc_sysctl_trampoline_addr(SB), RODATA, $8
DATA ·libc_sysctl_trampoline_addr(SB)/8, $libc_sysctl_trampoline<>(SB)
TEXT libc_sendfile_trampoline<>(SB),NOSPLIT,$0-0
JMP libc_sendfile(SB)
-
GLOBL ·libc_sendfile_trampoline_addr(SB), RODATA, $8
DATA ·libc_sendfile_trampoline_addr(SB)/8, $libc_sendfile_trampoline<>(SB)
TEXT libc_shmat_trampoline<>(SB),NOSPLIT,$0-0
JMP libc_shmat(SB)
-
GLOBL ·libc_shmat_trampoline_addr(SB), RODATA, $8
DATA ·libc_shmat_trampoline_addr(SB)/8, $libc_shmat_trampoline<>(SB)
TEXT libc_shmctl_trampoline<>(SB),NOSPLIT,$0-0
JMP libc_shmctl(SB)
-
GLOBL ·libc_shmctl_trampoline_addr(SB), RODATA, $8
DATA ·libc_shmctl_trampoline_addr(SB)/8, $libc_shmctl_trampoline<>(SB)
TEXT libc_shmdt_trampoline<>(SB),NOSPLIT,$0-0
JMP libc_shmdt(SB)
-
GLOBL ·libc_shmdt_trampoline_addr(SB), RODATA, $8
DATA ·libc_shmdt_trampoline_addr(SB)/8, $libc_shmdt_trampoline<>(SB)
TEXT libc_shmget_trampoline<>(SB),NOSPLIT,$0-0
JMP libc_shmget(SB)
-
GLOBL ·libc_shmget_trampoline_addr(SB), RODATA, $8
DATA ·libc_shmget_trampoline_addr(SB)/8, $libc_shmget_trampoline<>(SB)
TEXT libc_access_trampoline<>(SB),NOSPLIT,$0-0
JMP libc_access(SB)
-
GLOBL ·libc_access_trampoline_addr(SB), RODATA, $8
DATA ·libc_access_trampoline_addr(SB)/8, $libc_access_trampoline<>(SB)
TEXT libc_adjtime_trampoline<>(SB),NOSPLIT,$0-0
JMP libc_adjtime(SB)
-
GLOBL ·libc_adjtime_trampoline_addr(SB), RODATA, $8
DATA ·libc_adjtime_trampoline_addr(SB)/8, $libc_adjtime_trampoline<>(SB)
TEXT libc_chdir_trampoline<>(SB),NOSPLIT,$0-0
JMP libc_chdir(SB)
-
GLOBL ·libc_chdir_trampoline_addr(SB), RODATA, $8
DATA ·libc_chdir_trampoline_addr(SB)/8, $libc_chdir_trampoline<>(SB)
TEXT libc_chflags_trampoline<>(SB),NOSPLIT,$0-0
JMP libc_chflags(SB)
-
GLOBL ·libc_chflags_trampoline_addr(SB), RODATA, $8
DATA ·libc_chflags_trampoline_addr(SB)/8, $libc_chflags_trampoline<>(SB)
TEXT libc_chmod_trampoline<>(SB),NOSPLIT,$0-0
JMP libc_chmod(SB)
-
GLOBL ·libc_chmod_trampoline_addr(SB), RODATA, $8
DATA ·libc_chmod_trampoline_addr(SB)/8, $libc_chmod_trampoline<>(SB)
TEXT libc_chown_trampoline<>(SB),NOSPLIT,$0-0
JMP libc_chown(SB)
-
GLOBL ·libc_chown_trampoline_addr(SB), RODATA, $8
DATA ·libc_chown_trampoline_addr(SB)/8, $libc_chown_trampoline<>(SB)
TEXT libc_chroot_trampoline<>(SB),NOSPLIT,$0-0
JMP libc_chroot(SB)
-
GLOBL ·libc_chroot_trampoline_addr(SB), RODATA, $8
DATA ·libc_chroot_trampoline_addr(SB)/8, $libc_chroot_trampoline<>(SB)
TEXT libc_clock_gettime_trampoline<>(SB),NOSPLIT,$0-0
JMP libc_clock_gettime(SB)
-
GLOBL ·libc_clock_gettime_trampoline_addr(SB), RODATA, $8
DATA ·libc_clock_gettime_trampoline_addr(SB)/8, $libc_clock_gettime_trampoline<>(SB)
TEXT libc_close_trampoline<>(SB),NOSPLIT,$0-0
JMP libc_close(SB)
-
GLOBL ·libc_close_trampoline_addr(SB), RODATA, $8
DATA ·libc_close_trampoline_addr(SB)/8, $libc_close_trampoline<>(SB)
TEXT libc_clonefile_trampoline<>(SB),NOSPLIT,$0-0
JMP libc_clonefile(SB)
-
GLOBL ·libc_clonefile_trampoline_addr(SB), RODATA, $8
DATA ·libc_clonefile_trampoline_addr(SB)/8, $libc_clonefile_trampoline<>(SB)
TEXT libc_clonefileat_trampoline<>(SB),NOSPLIT,$0-0
JMP libc_clonefileat(SB)
-
GLOBL ·libc_clonefileat_trampoline_addr(SB), RODATA, $8
DATA ·libc_clonefileat_trampoline_addr(SB)/8, $libc_clonefileat_trampoline<>(SB)
TEXT libc_dup_trampoline<>(SB),NOSPLIT,$0-0
JMP libc_dup(SB)
-
GLOBL ·libc_dup_trampoline_addr(SB), RODATA, $8
DATA ·libc_dup_trampoline_addr(SB)/8, $libc_dup_trampoline<>(SB)
TEXT libc_dup2_trampoline<>(SB),NOSPLIT,$0-0
JMP libc_dup2(SB)
-
GLOBL ·libc_dup2_trampoline_addr(SB), RODATA, $8
DATA ·libc_dup2_trampoline_addr(SB)/8, $libc_dup2_trampoline<>(SB)
TEXT libc_exchangedata_trampoline<>(SB),NOSPLIT,$0-0
JMP libc_exchangedata(SB)
-
GLOBL ·libc_exchangedata_trampoline_addr(SB), RODATA, $8
DATA ·libc_exchangedata_trampoline_addr(SB)/8, $libc_exchangedata_trampoline<>(SB)
TEXT libc_exit_trampoline<>(SB),NOSPLIT,$0-0
JMP libc_exit(SB)
-
GLOBL ·libc_exit_trampoline_addr(SB), RODATA, $8
DATA ·libc_exit_trampoline_addr(SB)/8, $libc_exit_trampoline<>(SB)
TEXT libc_faccessat_trampoline<>(SB),NOSPLIT,$0-0
JMP libc_faccessat(SB)
-
GLOBL ·libc_faccessat_trampoline_addr(SB), RODATA, $8
DATA ·libc_faccessat_trampoline_addr(SB)/8, $libc_faccessat_trampoline<>(SB)
TEXT libc_fchdir_trampoline<>(SB),NOSPLIT,$0-0
JMP libc_fchdir(SB)
-
GLOBL ·libc_fchdir_trampoline_addr(SB), RODATA, $8
DATA ·libc_fchdir_trampoline_addr(SB)/8, $libc_fchdir_trampoline<>(SB)
TEXT libc_fchflags_trampoline<>(SB),NOSPLIT,$0-0
JMP libc_fchflags(SB)
-
GLOBL ·libc_fchflags_trampoline_addr(SB), RODATA, $8
DATA ·libc_fchflags_trampoline_addr(SB)/8, $libc_fchflags_trampoline<>(SB)
TEXT libc_fchmod_trampoline<>(SB),NOSPLIT,$0-0
JMP libc_fchmod(SB)
-
GLOBL ·libc_fchmod_trampoline_addr(SB), RODATA, $8
DATA ·libc_fchmod_trampoline_addr(SB)/8, $libc_fchmod_trampoline<>(SB)
TEXT libc_fchmodat_trampoline<>(SB),NOSPLIT,$0-0
JMP libc_fchmodat(SB)
-
GLOBL ·libc_fchmodat_trampoline_addr(SB), RODATA, $8
DATA ·libc_fchmodat_trampoline_addr(SB)/8, $libc_fchmodat_trampoline<>(SB)
TEXT libc_fchown_trampoline<>(SB),NOSPLIT,$0-0
JMP libc_fchown(SB)
-
GLOBL ·libc_fchown_trampoline_addr(SB), RODATA, $8
DATA ·libc_fchown_trampoline_addr(SB)/8, $libc_fchown_trampoline<>(SB)
TEXT libc_fchownat_trampoline<>(SB),NOSPLIT,$0-0
JMP libc_fchownat(SB)
-
GLOBL ·libc_fchownat_trampoline_addr(SB), RODATA, $8
DATA ·libc_fchownat_trampoline_addr(SB)/8, $libc_fchownat_trampoline<>(SB)
TEXT libc_fclonefileat_trampoline<>(SB),NOSPLIT,$0-0
JMP libc_fclonefileat(SB)
-
GLOBL ·libc_fclonefileat_trampoline_addr(SB), RODATA, $8
DATA ·libc_fclonefileat_trampoline_addr(SB)/8, $libc_fclonefileat_trampoline<>(SB)
TEXT libc_flock_trampoline<>(SB),NOSPLIT,$0-0
JMP libc_flock(SB)
-
GLOBL ·libc_flock_trampoline_addr(SB), RODATA, $8
DATA ·libc_flock_trampoline_addr(SB)/8, $libc_flock_trampoline<>(SB)
TEXT libc_fpathconf_trampoline<>(SB),NOSPLIT,$0-0
JMP libc_fpathconf(SB)
-
GLOBL ·libc_fpathconf_trampoline_addr(SB), RODATA, $8
DATA ·libc_fpathconf_trampoline_addr(SB)/8, $libc_fpathconf_trampoline<>(SB)
TEXT libc_fsync_trampoline<>(SB),NOSPLIT,$0-0
JMP libc_fsync(SB)
-
GLOBL ·libc_fsync_trampoline_addr(SB), RODATA, $8
DATA ·libc_fsync_trampoline_addr(SB)/8, $libc_fsync_trampoline<>(SB)
TEXT libc_ftruncate_trampoline<>(SB),NOSPLIT,$0-0
JMP libc_ftruncate(SB)
-
GLOBL ·libc_ftruncate_trampoline_addr(SB), RODATA, $8
DATA ·libc_ftruncate_trampoline_addr(SB)/8, $libc_ftruncate_trampoline<>(SB)
TEXT libc_getcwd_trampoline<>(SB),NOSPLIT,$0-0
JMP libc_getcwd(SB)
-
GLOBL ·libc_getcwd_trampoline_addr(SB), RODATA, $8
DATA ·libc_getcwd_trampoline_addr(SB)/8, $libc_getcwd_trampoline<>(SB)
TEXT libc_getdtablesize_trampoline<>(SB),NOSPLIT,$0-0
JMP libc_getdtablesize(SB)
-
GLOBL ·libc_getdtablesize_trampoline_addr(SB), RODATA, $8
DATA ·libc_getdtablesize_trampoline_addr(SB)/8, $libc_getdtablesize_trampoline<>(SB)
TEXT libc_getegid_trampoline<>(SB),NOSPLIT,$0-0
JMP libc_getegid(SB)
-
GLOBL ·libc_getegid_trampoline_addr(SB), RODATA, $8
DATA ·libc_getegid_trampoline_addr(SB)/8, $libc_getegid_trampoline<>(SB)
TEXT libc_geteuid_trampoline<>(SB),NOSPLIT,$0-0
JMP libc_geteuid(SB)
-
GLOBL ·libc_geteuid_trampoline_addr(SB), RODATA, $8
DATA ·libc_geteuid_trampoline_addr(SB)/8, $libc_geteuid_trampoline<>(SB)
TEXT libc_getgid_trampoline<>(SB),NOSPLIT,$0-0
JMP libc_getgid(SB)
-
GLOBL ·libc_getgid_trampoline_addr(SB), RODATA, $8
DATA ·libc_getgid_trampoline_addr(SB)/8, $libc_getgid_trampoline<>(SB)
TEXT libc_getpgid_trampoline<>(SB),NOSPLIT,$0-0
JMP libc_getpgid(SB)
-
GLOBL ·libc_getpgid_trampoline_addr(SB), RODATA, $8
DATA ·libc_getpgid_trampoline_addr(SB)/8, $libc_getpgid_trampoline<>(SB)
TEXT libc_getpgrp_trampoline<>(SB),NOSPLIT,$0-0
JMP libc_getpgrp(SB)
-
GLOBL ·libc_getpgrp_trampoline_addr(SB), RODATA, $8
DATA ·libc_getpgrp_trampoline_addr(SB)/8, $libc_getpgrp_trampoline<>(SB)
TEXT libc_getpid_trampoline<>(SB),NOSPLIT,$0-0
JMP libc_getpid(SB)
-
GLOBL ·libc_getpid_trampoline_addr(SB), RODATA, $8
DATA ·libc_getpid_trampoline_addr(SB)/8, $libc_getpid_trampoline<>(SB)
TEXT libc_getppid_trampoline<>(SB),NOSPLIT,$0-0
JMP libc_getppid(SB)
-
GLOBL ·libc_getppid_trampoline_addr(SB), RODATA, $8
DATA ·libc_getppid_trampoline_addr(SB)/8, $libc_getppid_trampoline<>(SB)
TEXT libc_getpriority_trampoline<>(SB),NOSPLIT,$0-0
JMP libc_getpriority(SB)
-
GLOBL ·libc_getpriority_trampoline_addr(SB), RODATA, $8
DATA ·libc_getpriority_trampoline_addr(SB)/8, $libc_getpriority_trampoline<>(SB)
TEXT libc_getrlimit_trampoline<>(SB),NOSPLIT,$0-0
JMP libc_getrlimit(SB)
-
GLOBL ·libc_getrlimit_trampoline_addr(SB), RODATA, $8
DATA ·libc_getrlimit_trampoline_addr(SB)/8, $libc_getrlimit_trampoline<>(SB)
TEXT libc_getrusage_trampoline<>(SB),NOSPLIT,$0-0
JMP libc_getrusage(SB)
-
GLOBL ·libc_getrusage_trampoline_addr(SB), RODATA, $8
DATA ·libc_getrusage_trampoline_addr(SB)/8, $libc_getrusage_trampoline<>(SB)
TEXT libc_getsid_trampoline<>(SB),NOSPLIT,$0-0
JMP libc_getsid(SB)
-
GLOBL ·libc_getsid_trampoline_addr(SB), RODATA, $8
DATA ·libc_getsid_trampoline_addr(SB)/8, $libc_getsid_trampoline<>(SB)
TEXT libc_gettimeofday_trampoline<>(SB),NOSPLIT,$0-0
JMP libc_gettimeofday(SB)
-
GLOBL ·libc_gettimeofday_trampoline_addr(SB), RODATA, $8
DATA ·libc_gettimeofday_trampoline_addr(SB)/8, $libc_gettimeofday_trampoline<>(SB)
TEXT libc_getuid_trampoline<>(SB),NOSPLIT,$0-0
JMP libc_getuid(SB)
-
GLOBL ·libc_getuid_trampoline_addr(SB), RODATA, $8
DATA ·libc_getuid_trampoline_addr(SB)/8, $libc_getuid_trampoline<>(SB)
TEXT libc_issetugid_trampoline<>(SB),NOSPLIT,$0-0
JMP libc_issetugid(SB)
-
GLOBL ·libc_issetugid_trampoline_addr(SB), RODATA, $8
DATA ·libc_issetugid_trampoline_addr(SB)/8, $libc_issetugid_trampoline<>(SB)
TEXT libc_kqueue_trampoline<>(SB),NOSPLIT,$0-0
JMP libc_kqueue(SB)
-
GLOBL ·libc_kqueue_trampoline_addr(SB), RODATA, $8
DATA ·libc_kqueue_trampoline_addr(SB)/8, $libc_kqueue_trampoline<>(SB)
TEXT libc_lchown_trampoline<>(SB),NOSPLIT,$0-0
JMP libc_lchown(SB)
-
GLOBL ·libc_lchown_trampoline_addr(SB), RODATA, $8
DATA ·libc_lchown_trampoline_addr(SB)/8, $libc_lchown_trampoline<>(SB)
TEXT libc_link_trampoline<>(SB),NOSPLIT,$0-0
JMP libc_link(SB)
-
GLOBL ·libc_link_trampoline_addr(SB), RODATA, $8
DATA ·libc_link_trampoline_addr(SB)/8, $libc_link_trampoline<>(SB)
TEXT libc_linkat_trampoline<>(SB),NOSPLIT,$0-0
JMP libc_linkat(SB)
-
GLOBL ·libc_linkat_trampoline_addr(SB), RODATA, $8
DATA ·libc_linkat_trampoline_addr(SB)/8, $libc_linkat_trampoline<>(SB)
TEXT libc_listen_trampoline<>(SB),NOSPLIT,$0-0
JMP libc_listen(SB)
-
GLOBL ·libc_listen_trampoline_addr(SB), RODATA, $8
DATA ·libc_listen_trampoline_addr(SB)/8, $libc_listen_trampoline<>(SB)
TEXT libc_mkdir_trampoline<>(SB),NOSPLIT,$0-0
JMP libc_mkdir(SB)
-
GLOBL ·libc_mkdir_trampoline_addr(SB), RODATA, $8
DATA ·libc_mkdir_trampoline_addr(SB)/8, $libc_mkdir_trampoline<>(SB)
TEXT libc_mkdirat_trampoline<>(SB),NOSPLIT,$0-0
JMP libc_mkdirat(SB)
-
GLOBL ·libc_mkdirat_trampoline_addr(SB), RODATA, $8
DATA ·libc_mkdirat_trampoline_addr(SB)/8, $libc_mkdirat_trampoline<>(SB)
TEXT libc_mkfifo_trampoline<>(SB),NOSPLIT,$0-0
JMP libc_mkfifo(SB)
-
GLOBL ·libc_mkfifo_trampoline_addr(SB), RODATA, $8
DATA ·libc_mkfifo_trampoline_addr(SB)/8, $libc_mkfifo_trampoline<>(SB)
TEXT libc_mknod_trampoline<>(SB),NOSPLIT,$0-0
JMP libc_mknod(SB)
-
GLOBL ·libc_mknod_trampoline_addr(SB), RODATA, $8
DATA ·libc_mknod_trampoline_addr(SB)/8, $libc_mknod_trampoline<>(SB)
TEXT libc_mount_trampoline<>(SB),NOSPLIT,$0-0
JMP libc_mount(SB)
-
GLOBL ·libc_mount_trampoline_addr(SB), RODATA, $8
DATA ·libc_mount_trampoline_addr(SB)/8, $libc_mount_trampoline<>(SB)
TEXT libc_open_trampoline<>(SB),NOSPLIT,$0-0
JMP libc_open(SB)
-
GLOBL ·libc_open_trampoline_addr(SB), RODATA, $8
DATA ·libc_open_trampoline_addr(SB)/8, $libc_open_trampoline<>(SB)
TEXT libc_openat_trampoline<>(SB),NOSPLIT,$0-0
JMP libc_openat(SB)
-
GLOBL ·libc_openat_trampoline_addr(SB), RODATA, $8
DATA ·libc_openat_trampoline_addr(SB)/8, $libc_openat_trampoline<>(SB)
TEXT libc_pathconf_trampoline<>(SB),NOSPLIT,$0-0
JMP libc_pathconf(SB)
-
GLOBL ·libc_pathconf_trampoline_addr(SB), RODATA, $8
DATA ·libc_pathconf_trampoline_addr(SB)/8, $libc_pathconf_trampoline<>(SB)
TEXT libc_pread_trampoline<>(SB),NOSPLIT,$0-0
JMP libc_pread(SB)
-
GLOBL ·libc_pread_trampoline_addr(SB), RODATA, $8
DATA ·libc_pread_trampoline_addr(SB)/8, $libc_pread_trampoline<>(SB)
TEXT libc_pwrite_trampoline<>(SB),NOSPLIT,$0-0
JMP libc_pwrite(SB)
-
GLOBL ·libc_pwrite_trampoline_addr(SB), RODATA, $8
DATA ·libc_pwrite_trampoline_addr(SB)/8, $libc_pwrite_trampoline<>(SB)
TEXT libc_read_trampoline<>(SB),NOSPLIT,$0-0
JMP libc_read(SB)
-
GLOBL ·libc_read_trampoline_addr(SB), RODATA, $8
DATA ·libc_read_trampoline_addr(SB)/8, $libc_read_trampoline<>(SB)
TEXT libc_readlink_trampoline<>(SB),NOSPLIT,$0-0
JMP libc_readlink(SB)
-
GLOBL ·libc_readlink_trampoline_addr(SB), RODATA, $8
DATA ·libc_readlink_trampoline_addr(SB)/8, $libc_readlink_trampoline<>(SB)
TEXT libc_readlinkat_trampoline<>(SB),NOSPLIT,$0-0
JMP libc_readlinkat(SB)
-
GLOBL ·libc_readlinkat_trampoline_addr(SB), RODATA, $8
DATA ·libc_readlinkat_trampoline_addr(SB)/8, $libc_readlinkat_trampoline<>(SB)
TEXT libc_rename_trampoline<>(SB),NOSPLIT,$0-0
JMP libc_rename(SB)
-
GLOBL ·libc_rename_trampoline_addr(SB), RODATA, $8
DATA ·libc_rename_trampoline_addr(SB)/8, $libc_rename_trampoline<>(SB)
TEXT libc_renameat_trampoline<>(SB),NOSPLIT,$0-0
JMP libc_renameat(SB)
-
GLOBL ·libc_renameat_trampoline_addr(SB), RODATA, $8
DATA ·libc_renameat_trampoline_addr(SB)/8, $libc_renameat_trampoline<>(SB)
TEXT libc_revoke_trampoline<>(SB),NOSPLIT,$0-0
JMP libc_revoke(SB)
-
GLOBL ·libc_revoke_trampoline_addr(SB), RODATA, $8
DATA ·libc_revoke_trampoline_addr(SB)/8, $libc_revoke_trampoline<>(SB)
TEXT libc_rmdir_trampoline<>(SB),NOSPLIT,$0-0
JMP libc_rmdir(SB)
-
GLOBL ·libc_rmdir_trampoline_addr(SB), RODATA, $8
DATA ·libc_rmdir_trampoline_addr(SB)/8, $libc_rmdir_trampoline<>(SB)
TEXT libc_lseek_trampoline<>(SB),NOSPLIT,$0-0
JMP libc_lseek(SB)
-
GLOBL ·libc_lseek_trampoline_addr(SB), RODATA, $8
DATA ·libc_lseek_trampoline_addr(SB)/8, $libc_lseek_trampoline<>(SB)
TEXT libc_select_trampoline<>(SB),NOSPLIT,$0-0
JMP libc_select(SB)
-
GLOBL ·libc_select_trampoline_addr(SB), RODATA, $8
DATA ·libc_select_trampoline_addr(SB)/8, $libc_select_trampoline<>(SB)
@@ -712,192 +595,160 @@ DATA ·libc_setattrlist_trampoline_addr(SB)/8, $libc_setattrlist_trampoline<>(SB
TEXT libc_setegid_trampoline<>(SB),NOSPLIT,$0-0
JMP libc_setegid(SB)
-
GLOBL ·libc_setegid_trampoline_addr(SB), RODATA, $8
DATA ·libc_setegid_trampoline_addr(SB)/8, $libc_setegid_trampoline<>(SB)
TEXT libc_seteuid_trampoline<>(SB),NOSPLIT,$0-0
JMP libc_seteuid(SB)
-
GLOBL ·libc_seteuid_trampoline_addr(SB), RODATA, $8
DATA ·libc_seteuid_trampoline_addr(SB)/8, $libc_seteuid_trampoline<>(SB)
TEXT libc_setgid_trampoline<>(SB),NOSPLIT,$0-0
JMP libc_setgid(SB)
-
GLOBL ·libc_setgid_trampoline_addr(SB), RODATA, $8
DATA ·libc_setgid_trampoline_addr(SB)/8, $libc_setgid_trampoline<>(SB)
TEXT libc_setlogin_trampoline<>(SB),NOSPLIT,$0-0
JMP libc_setlogin(SB)
-
GLOBL ·libc_setlogin_trampoline_addr(SB), RODATA, $8
DATA ·libc_setlogin_trampoline_addr(SB)/8, $libc_setlogin_trampoline<>(SB)
TEXT libc_setpgid_trampoline<>(SB),NOSPLIT,$0-0
JMP libc_setpgid(SB)
-
GLOBL ·libc_setpgid_trampoline_addr(SB), RODATA, $8
DATA ·libc_setpgid_trampoline_addr(SB)/8, $libc_setpgid_trampoline<>(SB)
TEXT libc_setpriority_trampoline<>(SB),NOSPLIT,$0-0
JMP libc_setpriority(SB)
-
GLOBL ·libc_setpriority_trampoline_addr(SB), RODATA, $8
DATA ·libc_setpriority_trampoline_addr(SB)/8, $libc_setpriority_trampoline<>(SB)
TEXT libc_setprivexec_trampoline<>(SB),NOSPLIT,$0-0
JMP libc_setprivexec(SB)
-
GLOBL ·libc_setprivexec_trampoline_addr(SB), RODATA, $8
DATA ·libc_setprivexec_trampoline_addr(SB)/8, $libc_setprivexec_trampoline<>(SB)
TEXT libc_setregid_trampoline<>(SB),NOSPLIT,$0-0
JMP libc_setregid(SB)
-
GLOBL ·libc_setregid_trampoline_addr(SB), RODATA, $8
DATA ·libc_setregid_trampoline_addr(SB)/8, $libc_setregid_trampoline<>(SB)
TEXT libc_setreuid_trampoline<>(SB),NOSPLIT,$0-0
JMP libc_setreuid(SB)
-
GLOBL ·libc_setreuid_trampoline_addr(SB), RODATA, $8
DATA ·libc_setreuid_trampoline_addr(SB)/8, $libc_setreuid_trampoline<>(SB)
TEXT libc_setsid_trampoline<>(SB),NOSPLIT,$0-0
JMP libc_setsid(SB)
-
GLOBL ·libc_setsid_trampoline_addr(SB), RODATA, $8
DATA ·libc_setsid_trampoline_addr(SB)/8, $libc_setsid_trampoline<>(SB)
TEXT libc_settimeofday_trampoline<>(SB),NOSPLIT,$0-0
JMP libc_settimeofday(SB)
-
GLOBL ·libc_settimeofday_trampoline_addr(SB), RODATA, $8
DATA ·libc_settimeofday_trampoline_addr(SB)/8, $libc_settimeofday_trampoline<>(SB)
TEXT libc_setuid_trampoline<>(SB),NOSPLIT,$0-0
JMP libc_setuid(SB)
-
GLOBL ·libc_setuid_trampoline_addr(SB), RODATA, $8
DATA ·libc_setuid_trampoline_addr(SB)/8, $libc_setuid_trampoline<>(SB)
TEXT libc_symlink_trampoline<>(SB),NOSPLIT,$0-0
JMP libc_symlink(SB)
-
GLOBL ·libc_symlink_trampoline_addr(SB), RODATA, $8
DATA ·libc_symlink_trampoline_addr(SB)/8, $libc_symlink_trampoline<>(SB)
TEXT libc_symlinkat_trampoline<>(SB),NOSPLIT,$0-0
JMP libc_symlinkat(SB)
-
GLOBL ·libc_symlinkat_trampoline_addr(SB), RODATA, $8
DATA ·libc_symlinkat_trampoline_addr(SB)/8, $libc_symlinkat_trampoline<>(SB)
TEXT libc_sync_trampoline<>(SB),NOSPLIT,$0-0
JMP libc_sync(SB)
-
GLOBL ·libc_sync_trampoline_addr(SB), RODATA, $8
DATA ·libc_sync_trampoline_addr(SB)/8, $libc_sync_trampoline<>(SB)
TEXT libc_truncate_trampoline<>(SB),NOSPLIT,$0-0
JMP libc_truncate(SB)
-
GLOBL ·libc_truncate_trampoline_addr(SB), RODATA, $8
DATA ·libc_truncate_trampoline_addr(SB)/8, $libc_truncate_trampoline<>(SB)
TEXT libc_umask_trampoline<>(SB),NOSPLIT,$0-0
JMP libc_umask(SB)
-
GLOBL ·libc_umask_trampoline_addr(SB), RODATA, $8
DATA ·libc_umask_trampoline_addr(SB)/8, $libc_umask_trampoline<>(SB)
TEXT libc_undelete_trampoline<>(SB),NOSPLIT,$0-0
JMP libc_undelete(SB)
-
GLOBL ·libc_undelete_trampoline_addr(SB), RODATA, $8
DATA ·libc_undelete_trampoline_addr(SB)/8, $libc_undelete_trampoline<>(SB)
TEXT libc_unlink_trampoline<>(SB),NOSPLIT,$0-0
JMP libc_unlink(SB)
-
GLOBL ·libc_unlink_trampoline_addr(SB), RODATA, $8
DATA ·libc_unlink_trampoline_addr(SB)/8, $libc_unlink_trampoline<>(SB)
TEXT libc_unlinkat_trampoline<>(SB),NOSPLIT,$0-0
JMP libc_unlinkat(SB)
-
GLOBL ·libc_unlinkat_trampoline_addr(SB), RODATA, $8
DATA ·libc_unlinkat_trampoline_addr(SB)/8, $libc_unlinkat_trampoline<>(SB)
TEXT libc_unmount_trampoline<>(SB),NOSPLIT,$0-0
JMP libc_unmount(SB)
-
GLOBL ·libc_unmount_trampoline_addr(SB), RODATA, $8
DATA ·libc_unmount_trampoline_addr(SB)/8, $libc_unmount_trampoline<>(SB)
TEXT libc_write_trampoline<>(SB),NOSPLIT,$0-0
JMP libc_write(SB)
-
GLOBL ·libc_write_trampoline_addr(SB), RODATA, $8
DATA ·libc_write_trampoline_addr(SB)/8, $libc_write_trampoline<>(SB)
TEXT libc_mmap_trampoline<>(SB),NOSPLIT,$0-0
JMP libc_mmap(SB)
-
GLOBL ·libc_mmap_trampoline_addr(SB), RODATA, $8
DATA ·libc_mmap_trampoline_addr(SB)/8, $libc_mmap_trampoline<>(SB)
TEXT libc_munmap_trampoline<>(SB),NOSPLIT,$0-0
JMP libc_munmap(SB)
-
GLOBL ·libc_munmap_trampoline_addr(SB), RODATA, $8
DATA ·libc_munmap_trampoline_addr(SB)/8, $libc_munmap_trampoline<>(SB)
TEXT libc_fstat64_trampoline<>(SB),NOSPLIT,$0-0
JMP libc_fstat64(SB)
-
GLOBL ·libc_fstat64_trampoline_addr(SB), RODATA, $8
DATA ·libc_fstat64_trampoline_addr(SB)/8, $libc_fstat64_trampoline<>(SB)
TEXT libc_fstatat64_trampoline<>(SB),NOSPLIT,$0-0
JMP libc_fstatat64(SB)
-
GLOBL ·libc_fstatat64_trampoline_addr(SB), RODATA, $8
DATA ·libc_fstatat64_trampoline_addr(SB)/8, $libc_fstatat64_trampoline<>(SB)
TEXT libc_fstatfs64_trampoline<>(SB),NOSPLIT,$0-0
JMP libc_fstatfs64(SB)
-
GLOBL ·libc_fstatfs64_trampoline_addr(SB), RODATA, $8
DATA ·libc_fstatfs64_trampoline_addr(SB)/8, $libc_fstatfs64_trampoline<>(SB)
TEXT libc_getfsstat64_trampoline<>(SB),NOSPLIT,$0-0
JMP libc_getfsstat64(SB)
-
GLOBL ·libc_getfsstat64_trampoline_addr(SB), RODATA, $8
DATA ·libc_getfsstat64_trampoline_addr(SB)/8, $libc_getfsstat64_trampoline<>(SB)
TEXT libc_lstat64_trampoline<>(SB),NOSPLIT,$0-0
JMP libc_lstat64(SB)
-
GLOBL ·libc_lstat64_trampoline_addr(SB), RODATA, $8
DATA ·libc_lstat64_trampoline_addr(SB)/8, $libc_lstat64_trampoline<>(SB)
TEXT libc_ptrace_trampoline<>(SB),NOSPLIT,$0-0
JMP libc_ptrace(SB)
-
GLOBL ·libc_ptrace_trampoline_addr(SB), RODATA, $8
DATA ·libc_ptrace_trampoline_addr(SB)/8, $libc_ptrace_trampoline<>(SB)
TEXT libc_stat64_trampoline<>(SB),NOSPLIT,$0-0
JMP libc_stat64(SB)
-
GLOBL ·libc_stat64_trampoline_addr(SB), RODATA, $8
DATA ·libc_stat64_trampoline_addr(SB)/8, $libc_stat64_trampoline<>(SB)
TEXT libc_statfs64_trampoline<>(SB),NOSPLIT,$0-0
JMP libc_statfs64(SB)
-
GLOBL ·libc_statfs64_trampoline_addr(SB), RODATA, $8
DATA ·libc_statfs64_trampoline_addr(SB)/8, $libc_statfs64_trampoline<>(SB)
diff --git a/vendor/golang.org/x/sys/unix/zsyscall_darwin_arm64.go b/vendor/golang.org/x/sys/unix/zsyscall_darwin_arm64.go
index 51d6f3fb..1b40b997 100644
--- a/vendor/golang.org/x/sys/unix/zsyscall_darwin_arm64.go
+++ b/vendor/golang.org/x/sys/unix/zsyscall_darwin_arm64.go
@@ -2,7 +2,6 @@
// Code generated by the command above; see README.md. DO NOT EDIT.
//go:build darwin && arm64
-// +build darwin,arm64
package unix
@@ -725,6 +724,12 @@ func ioctl(fd int, req uint, arg uintptr) (err error) {
return
}
+var libc_ioctl_trampoline_addr uintptr
+
+//go:cgo_import_dynamic libc_ioctl ioctl "/usr/lib/libSystem.B.dylib"
+
+// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
+
func ioctlPtr(fd int, req uint, arg unsafe.Pointer) (err error) {
_, _, e1 := syscall_syscall(libc_ioctl_trampoline_addr, uintptr(fd), uintptr(req), uintptr(arg))
if e1 != 0 {
@@ -733,10 +738,6 @@ func ioctlPtr(fd int, req uint, arg unsafe.Pointer) (err error) {
return
}
-var libc_ioctl_trampoline_addr uintptr
-
-//go:cgo_import_dynamic libc_ioctl ioctl "/usr/lib/libSystem.B.dylib"
-
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
func sysctl(mib []_C_int, old *byte, oldlen *uintptr, new *byte, newlen uintptr) (err error) {
@@ -2410,28 +2411,6 @@ var libc_munmap_trampoline_addr uintptr
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
-func readlen(fd int, buf *byte, nbuf int) (n int, err error) {
- r0, _, e1 := syscall_syscall(libc_read_trampoline_addr, uintptr(fd), uintptr(unsafe.Pointer(buf)), uintptr(nbuf))
- n = int(r0)
- if e1 != 0 {
- err = errnoErr(e1)
- }
- return
-}
-
-// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
-
-func writelen(fd int, buf *byte, nbuf int) (n int, err error) {
- r0, _, e1 := syscall_syscall(libc_write_trampoline_addr, uintptr(fd), uintptr(unsafe.Pointer(buf)), uintptr(nbuf))
- n = int(r0)
- if e1 != 0 {
- err = errnoErr(e1)
- }
- return
-}
-
-// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
-
func Fstat(fd int, stat *Stat_t) (err error) {
_, _, e1 := syscall_syscall(libc_fstat_trampoline_addr, uintptr(fd), uintptr(unsafe.Pointer(stat)), 0)
if e1 != 0 {
@@ -2521,14 +2500,6 @@ func ptrace1(request int, pid int, addr uintptr, data uintptr) (err error) {
return
}
-func ptrace1Ptr(request int, pid int, addr uintptr, data unsafe.Pointer) (err error) {
- _, _, e1 := syscall_syscall6(libc_ptrace_trampoline_addr, uintptr(request), uintptr(pid), addr, uintptr(data), 0, 0)
- if e1 != 0 {
- err = errnoErr(e1)
- }
- return
-}
-
var libc_ptrace_trampoline_addr uintptr
//go:cgo_import_dynamic libc_ptrace ptrace "/usr/lib/libSystem.B.dylib"
diff --git a/vendor/golang.org/x/sys/unix/zsyscall_darwin_arm64.s b/vendor/golang.org/x/sys/unix/zsyscall_darwin_arm64.s
index c3b82c03..08362c1a 100644
--- a/vendor/golang.org/x/sys/unix/zsyscall_darwin_arm64.s
+++ b/vendor/golang.org/x/sys/unix/zsyscall_darwin_arm64.s
@@ -5,703 +5,586 @@
TEXT libc_fdopendir_trampoline<>(SB),NOSPLIT,$0-0
JMP libc_fdopendir(SB)
-
GLOBL ·libc_fdopendir_trampoline_addr(SB), RODATA, $8
DATA ·libc_fdopendir_trampoline_addr(SB)/8, $libc_fdopendir_trampoline<>(SB)
TEXT libc_getgroups_trampoline<>(SB),NOSPLIT,$0-0
JMP libc_getgroups(SB)
-
GLOBL ·libc_getgroups_trampoline_addr(SB), RODATA, $8
DATA ·libc_getgroups_trampoline_addr(SB)/8, $libc_getgroups_trampoline<>(SB)
TEXT libc_setgroups_trampoline<>(SB),NOSPLIT,$0-0
JMP libc_setgroups(SB)
-
GLOBL ·libc_setgroups_trampoline_addr(SB), RODATA, $8
DATA ·libc_setgroups_trampoline_addr(SB)/8, $libc_setgroups_trampoline<>(SB)
TEXT libc_wait4_trampoline<>(SB),NOSPLIT,$0-0
JMP libc_wait4(SB)
-
GLOBL ·libc_wait4_trampoline_addr(SB), RODATA, $8
DATA ·libc_wait4_trampoline_addr(SB)/8, $libc_wait4_trampoline<>(SB)
TEXT libc_accept_trampoline<>(SB),NOSPLIT,$0-0
JMP libc_accept(SB)
-
GLOBL ·libc_accept_trampoline_addr(SB), RODATA, $8
DATA ·libc_accept_trampoline_addr(SB)/8, $libc_accept_trampoline<>(SB)
TEXT libc_bind_trampoline<>(SB),NOSPLIT,$0-0
JMP libc_bind(SB)
-
GLOBL ·libc_bind_trampoline_addr(SB), RODATA, $8
DATA ·libc_bind_trampoline_addr(SB)/8, $libc_bind_trampoline<>(SB)
TEXT libc_connect_trampoline<>(SB),NOSPLIT,$0-0
JMP libc_connect(SB)
-
GLOBL ·libc_connect_trampoline_addr(SB), RODATA, $8
DATA ·libc_connect_trampoline_addr(SB)/8, $libc_connect_trampoline<>(SB)
TEXT libc_socket_trampoline<>(SB),NOSPLIT,$0-0
JMP libc_socket(SB)
-
GLOBL ·libc_socket_trampoline_addr(SB), RODATA, $8
DATA ·libc_socket_trampoline_addr(SB)/8, $libc_socket_trampoline<>(SB)
TEXT libc_getsockopt_trampoline<>(SB),NOSPLIT,$0-0
JMP libc_getsockopt(SB)
-
GLOBL ·libc_getsockopt_trampoline_addr(SB), RODATA, $8
DATA ·libc_getsockopt_trampoline_addr(SB)/8, $libc_getsockopt_trampoline<>(SB)
TEXT libc_setsockopt_trampoline<>(SB),NOSPLIT,$0-0
JMP libc_setsockopt(SB)
-
GLOBL ·libc_setsockopt_trampoline_addr(SB), RODATA, $8
DATA ·libc_setsockopt_trampoline_addr(SB)/8, $libc_setsockopt_trampoline<>(SB)
TEXT libc_getpeername_trampoline<>(SB),NOSPLIT,$0-0
JMP libc_getpeername(SB)
-
GLOBL ·libc_getpeername_trampoline_addr(SB), RODATA, $8
DATA ·libc_getpeername_trampoline_addr(SB)/8, $libc_getpeername_trampoline<>(SB)
TEXT libc_getsockname_trampoline<>(SB),NOSPLIT,$0-0
JMP libc_getsockname(SB)
-
GLOBL ·libc_getsockname_trampoline_addr(SB), RODATA, $8
DATA ·libc_getsockname_trampoline_addr(SB)/8, $libc_getsockname_trampoline<>(SB)
TEXT libc_shutdown_trampoline<>(SB),NOSPLIT,$0-0
JMP libc_shutdown(SB)
-
GLOBL ·libc_shutdown_trampoline_addr(SB), RODATA, $8
DATA ·libc_shutdown_trampoline_addr(SB)/8, $libc_shutdown_trampoline<>(SB)
TEXT libc_socketpair_trampoline<>(SB),NOSPLIT,$0-0
JMP libc_socketpair(SB)
-
GLOBL ·libc_socketpair_trampoline_addr(SB), RODATA, $8
DATA ·libc_socketpair_trampoline_addr(SB)/8, $libc_socketpair_trampoline<>(SB)
TEXT libc_recvfrom_trampoline<>(SB),NOSPLIT,$0-0
JMP libc_recvfrom(SB)
-
GLOBL ·libc_recvfrom_trampoline_addr(SB), RODATA, $8
DATA ·libc_recvfrom_trampoline_addr(SB)/8, $libc_recvfrom_trampoline<>(SB)
TEXT libc_sendto_trampoline<>(SB),NOSPLIT,$0-0
JMP libc_sendto(SB)
-
GLOBL ·libc_sendto_trampoline_addr(SB), RODATA, $8
DATA ·libc_sendto_trampoline_addr(SB)/8, $libc_sendto_trampoline<>(SB)
TEXT libc_recvmsg_trampoline<>(SB),NOSPLIT,$0-0
JMP libc_recvmsg(SB)
-
GLOBL ·libc_recvmsg_trampoline_addr(SB), RODATA, $8
DATA ·libc_recvmsg_trampoline_addr(SB)/8, $libc_recvmsg_trampoline<>(SB)
TEXT libc_sendmsg_trampoline<>(SB),NOSPLIT,$0-0
JMP libc_sendmsg(SB)
-
GLOBL ·libc_sendmsg_trampoline_addr(SB), RODATA, $8
DATA ·libc_sendmsg_trampoline_addr(SB)/8, $libc_sendmsg_trampoline<>(SB)
TEXT libc_kevent_trampoline<>(SB),NOSPLIT,$0-0
JMP libc_kevent(SB)
-
GLOBL ·libc_kevent_trampoline_addr(SB), RODATA, $8
DATA ·libc_kevent_trampoline_addr(SB)/8, $libc_kevent_trampoline<>(SB)
TEXT libc_utimes_trampoline<>(SB),NOSPLIT,$0-0
JMP libc_utimes(SB)
-
GLOBL ·libc_utimes_trampoline_addr(SB), RODATA, $8
DATA ·libc_utimes_trampoline_addr(SB)/8, $libc_utimes_trampoline<>(SB)
TEXT libc_futimes_trampoline<>(SB),NOSPLIT,$0-0
JMP libc_futimes(SB)
-
GLOBL ·libc_futimes_trampoline_addr(SB), RODATA, $8
DATA ·libc_futimes_trampoline_addr(SB)/8, $libc_futimes_trampoline<>(SB)
TEXT libc_poll_trampoline<>(SB),NOSPLIT,$0-0
JMP libc_poll(SB)
-
GLOBL ·libc_poll_trampoline_addr(SB), RODATA, $8
DATA ·libc_poll_trampoline_addr(SB)/8, $libc_poll_trampoline<>(SB)
TEXT libc_madvise_trampoline<>(SB),NOSPLIT,$0-0
JMP libc_madvise(SB)
-
GLOBL ·libc_madvise_trampoline_addr(SB), RODATA, $8
DATA ·libc_madvise_trampoline_addr(SB)/8, $libc_madvise_trampoline<>(SB)
TEXT libc_mlock_trampoline<>(SB),NOSPLIT,$0-0
JMP libc_mlock(SB)
-
GLOBL ·libc_mlock_trampoline_addr(SB), RODATA, $8
DATA ·libc_mlock_trampoline_addr(SB)/8, $libc_mlock_trampoline<>(SB)
TEXT libc_mlockall_trampoline<>(SB),NOSPLIT,$0-0
JMP libc_mlockall(SB)
-
GLOBL ·libc_mlockall_trampoline_addr(SB), RODATA, $8
DATA ·libc_mlockall_trampoline_addr(SB)/8, $libc_mlockall_trampoline<>(SB)
TEXT libc_mprotect_trampoline<>(SB),NOSPLIT,$0-0
JMP libc_mprotect(SB)
-
GLOBL ·libc_mprotect_trampoline_addr(SB), RODATA, $8
DATA ·libc_mprotect_trampoline_addr(SB)/8, $libc_mprotect_trampoline<>(SB)
TEXT libc_msync_trampoline<>(SB),NOSPLIT,$0-0
JMP libc_msync(SB)
-
GLOBL ·libc_msync_trampoline_addr(SB), RODATA, $8
DATA ·libc_msync_trampoline_addr(SB)/8, $libc_msync_trampoline<>(SB)
TEXT libc_munlock_trampoline<>(SB),NOSPLIT,$0-0
JMP libc_munlock(SB)
-
GLOBL ·libc_munlock_trampoline_addr(SB), RODATA, $8
DATA ·libc_munlock_trampoline_addr(SB)/8, $libc_munlock_trampoline<>(SB)
TEXT libc_munlockall_trampoline<>(SB),NOSPLIT,$0-0
JMP libc_munlockall(SB)
-
GLOBL ·libc_munlockall_trampoline_addr(SB), RODATA, $8
DATA ·libc_munlockall_trampoline_addr(SB)/8, $libc_munlockall_trampoline<>(SB)
TEXT libc_closedir_trampoline<>(SB),NOSPLIT,$0-0
JMP libc_closedir(SB)
-
GLOBL ·libc_closedir_trampoline_addr(SB), RODATA, $8
DATA ·libc_closedir_trampoline_addr(SB)/8, $libc_closedir_trampoline<>(SB)
TEXT libc_readdir_r_trampoline<>(SB),NOSPLIT,$0-0
JMP libc_readdir_r(SB)
-
GLOBL ·libc_readdir_r_trampoline_addr(SB), RODATA, $8
DATA ·libc_readdir_r_trampoline_addr(SB)/8, $libc_readdir_r_trampoline<>(SB)
TEXT libc_pipe_trampoline<>(SB),NOSPLIT,$0-0
JMP libc_pipe(SB)
-
GLOBL ·libc_pipe_trampoline_addr(SB), RODATA, $8
DATA ·libc_pipe_trampoline_addr(SB)/8, $libc_pipe_trampoline<>(SB)
TEXT libc_getxattr_trampoline<>(SB),NOSPLIT,$0-0
JMP libc_getxattr(SB)
-
GLOBL ·libc_getxattr_trampoline_addr(SB), RODATA, $8
DATA ·libc_getxattr_trampoline_addr(SB)/8, $libc_getxattr_trampoline<>(SB)
TEXT libc_fgetxattr_trampoline<>(SB),NOSPLIT,$0-0
JMP libc_fgetxattr(SB)
-
GLOBL ·libc_fgetxattr_trampoline_addr(SB), RODATA, $8
DATA ·libc_fgetxattr_trampoline_addr(SB)/8, $libc_fgetxattr_trampoline<>(SB)
TEXT libc_setxattr_trampoline<>(SB),NOSPLIT,$0-0
JMP libc_setxattr(SB)
-
GLOBL ·libc_setxattr_trampoline_addr(SB), RODATA, $8
DATA ·libc_setxattr_trampoline_addr(SB)/8, $libc_setxattr_trampoline<>(SB)
TEXT libc_fsetxattr_trampoline<>(SB),NOSPLIT,$0-0
JMP libc_fsetxattr(SB)
-
GLOBL ·libc_fsetxattr_trampoline_addr(SB), RODATA, $8
DATA ·libc_fsetxattr_trampoline_addr(SB)/8, $libc_fsetxattr_trampoline<>(SB)
TEXT libc_removexattr_trampoline<>(SB),NOSPLIT,$0-0
JMP libc_removexattr(SB)
-
GLOBL ·libc_removexattr_trampoline_addr(SB), RODATA, $8
DATA ·libc_removexattr_trampoline_addr(SB)/8, $libc_removexattr_trampoline<>(SB)
TEXT libc_fremovexattr_trampoline<>(SB),NOSPLIT,$0-0
JMP libc_fremovexattr(SB)
-
GLOBL ·libc_fremovexattr_trampoline_addr(SB), RODATA, $8
DATA ·libc_fremovexattr_trampoline_addr(SB)/8, $libc_fremovexattr_trampoline<>(SB)
TEXT libc_listxattr_trampoline<>(SB),NOSPLIT,$0-0
JMP libc_listxattr(SB)
-
GLOBL ·libc_listxattr_trampoline_addr(SB), RODATA, $8
DATA ·libc_listxattr_trampoline_addr(SB)/8, $libc_listxattr_trampoline<>(SB)
TEXT libc_flistxattr_trampoline<>(SB),NOSPLIT,$0-0
JMP libc_flistxattr(SB)
-
GLOBL ·libc_flistxattr_trampoline_addr(SB), RODATA, $8
DATA ·libc_flistxattr_trampoline_addr(SB)/8, $libc_flistxattr_trampoline<>(SB)
TEXT libc_utimensat_trampoline<>(SB),NOSPLIT,$0-0
JMP libc_utimensat(SB)
-
GLOBL ·libc_utimensat_trampoline_addr(SB), RODATA, $8
DATA ·libc_utimensat_trampoline_addr(SB)/8, $libc_utimensat_trampoline<>(SB)
TEXT libc_fcntl_trampoline<>(SB),NOSPLIT,$0-0
JMP libc_fcntl(SB)
-
GLOBL ·libc_fcntl_trampoline_addr(SB), RODATA, $8
DATA ·libc_fcntl_trampoline_addr(SB)/8, $libc_fcntl_trampoline<>(SB)
TEXT libc_kill_trampoline<>(SB),NOSPLIT,$0-0
JMP libc_kill(SB)
-
GLOBL ·libc_kill_trampoline_addr(SB), RODATA, $8
DATA ·libc_kill_trampoline_addr(SB)/8, $libc_kill_trampoline<>(SB)
TEXT libc_ioctl_trampoline<>(SB),NOSPLIT,$0-0
JMP libc_ioctl(SB)
-
GLOBL ·libc_ioctl_trampoline_addr(SB), RODATA, $8
DATA ·libc_ioctl_trampoline_addr(SB)/8, $libc_ioctl_trampoline<>(SB)
TEXT libc_sysctl_trampoline<>(SB),NOSPLIT,$0-0
JMP libc_sysctl(SB)
-
GLOBL ·libc_sysctl_trampoline_addr(SB), RODATA, $8
DATA ·libc_sysctl_trampoline_addr(SB)/8, $libc_sysctl_trampoline<>(SB)
TEXT libc_sendfile_trampoline<>(SB),NOSPLIT,$0-0
JMP libc_sendfile(SB)
-
GLOBL ·libc_sendfile_trampoline_addr(SB), RODATA, $8
DATA ·libc_sendfile_trampoline_addr(SB)/8, $libc_sendfile_trampoline<>(SB)
TEXT libc_shmat_trampoline<>(SB),NOSPLIT,$0-0
JMP libc_shmat(SB)
-
GLOBL ·libc_shmat_trampoline_addr(SB), RODATA, $8
DATA ·libc_shmat_trampoline_addr(SB)/8, $libc_shmat_trampoline<>(SB)
TEXT libc_shmctl_trampoline<>(SB),NOSPLIT,$0-0
JMP libc_shmctl(SB)
-
GLOBL ·libc_shmctl_trampoline_addr(SB), RODATA, $8
DATA ·libc_shmctl_trampoline_addr(SB)/8, $libc_shmctl_trampoline<>(SB)
TEXT libc_shmdt_trampoline<>(SB),NOSPLIT,$0-0
JMP libc_shmdt(SB)
-
GLOBL ·libc_shmdt_trampoline_addr(SB), RODATA, $8
DATA ·libc_shmdt_trampoline_addr(SB)/8, $libc_shmdt_trampoline<>(SB)
TEXT libc_shmget_trampoline<>(SB),NOSPLIT,$0-0
JMP libc_shmget(SB)
-
GLOBL ·libc_shmget_trampoline_addr(SB), RODATA, $8
DATA ·libc_shmget_trampoline_addr(SB)/8, $libc_shmget_trampoline<>(SB)
TEXT libc_access_trampoline<>(SB),NOSPLIT,$0-0
JMP libc_access(SB)
-
GLOBL ·libc_access_trampoline_addr(SB), RODATA, $8
DATA ·libc_access_trampoline_addr(SB)/8, $libc_access_trampoline<>(SB)
TEXT libc_adjtime_trampoline<>(SB),NOSPLIT,$0-0
JMP libc_adjtime(SB)
-
GLOBL ·libc_adjtime_trampoline_addr(SB), RODATA, $8
DATA ·libc_adjtime_trampoline_addr(SB)/8, $libc_adjtime_trampoline<>(SB)
TEXT libc_chdir_trampoline<>(SB),NOSPLIT,$0-0
JMP libc_chdir(SB)
-
GLOBL ·libc_chdir_trampoline_addr(SB), RODATA, $8
DATA ·libc_chdir_trampoline_addr(SB)/8, $libc_chdir_trampoline<>(SB)
TEXT libc_chflags_trampoline<>(SB),NOSPLIT,$0-0
JMP libc_chflags(SB)
-
GLOBL ·libc_chflags_trampoline_addr(SB), RODATA, $8
DATA ·libc_chflags_trampoline_addr(SB)/8, $libc_chflags_trampoline<>(SB)
TEXT libc_chmod_trampoline<>(SB),NOSPLIT,$0-0
JMP libc_chmod(SB)
-
GLOBL ·libc_chmod_trampoline_addr(SB), RODATA, $8
DATA ·libc_chmod_trampoline_addr(SB)/8, $libc_chmod_trampoline<>(SB)
TEXT libc_chown_trampoline<>(SB),NOSPLIT,$0-0
JMP libc_chown(SB)
-
GLOBL ·libc_chown_trampoline_addr(SB), RODATA, $8
DATA ·libc_chown_trampoline_addr(SB)/8, $libc_chown_trampoline<>(SB)
TEXT libc_chroot_trampoline<>(SB),NOSPLIT,$0-0
JMP libc_chroot(SB)
-
GLOBL ·libc_chroot_trampoline_addr(SB), RODATA, $8
DATA ·libc_chroot_trampoline_addr(SB)/8, $libc_chroot_trampoline<>(SB)
TEXT libc_clock_gettime_trampoline<>(SB),NOSPLIT,$0-0
JMP libc_clock_gettime(SB)
-
GLOBL ·libc_clock_gettime_trampoline_addr(SB), RODATA, $8
DATA ·libc_clock_gettime_trampoline_addr(SB)/8, $libc_clock_gettime_trampoline<>(SB)
TEXT libc_close_trampoline<>(SB),NOSPLIT,$0-0
JMP libc_close(SB)
-
GLOBL ·libc_close_trampoline_addr(SB), RODATA, $8
DATA ·libc_close_trampoline_addr(SB)/8, $libc_close_trampoline<>(SB)
TEXT libc_clonefile_trampoline<>(SB),NOSPLIT,$0-0
JMP libc_clonefile(SB)
-
GLOBL ·libc_clonefile_trampoline_addr(SB), RODATA, $8
DATA ·libc_clonefile_trampoline_addr(SB)/8, $libc_clonefile_trampoline<>(SB)
TEXT libc_clonefileat_trampoline<>(SB),NOSPLIT,$0-0
JMP libc_clonefileat(SB)
-
GLOBL ·libc_clonefileat_trampoline_addr(SB), RODATA, $8
DATA ·libc_clonefileat_trampoline_addr(SB)/8, $libc_clonefileat_trampoline<>(SB)
TEXT libc_dup_trampoline<>(SB),NOSPLIT,$0-0
JMP libc_dup(SB)
-
GLOBL ·libc_dup_trampoline_addr(SB), RODATA, $8
DATA ·libc_dup_trampoline_addr(SB)/8, $libc_dup_trampoline<>(SB)
TEXT libc_dup2_trampoline<>(SB),NOSPLIT,$0-0
JMP libc_dup2(SB)
-
GLOBL ·libc_dup2_trampoline_addr(SB), RODATA, $8
DATA ·libc_dup2_trampoline_addr(SB)/8, $libc_dup2_trampoline<>(SB)
TEXT libc_exchangedata_trampoline<>(SB),NOSPLIT,$0-0
JMP libc_exchangedata(SB)
-
GLOBL ·libc_exchangedata_trampoline_addr(SB), RODATA, $8
DATA ·libc_exchangedata_trampoline_addr(SB)/8, $libc_exchangedata_trampoline<>(SB)
TEXT libc_exit_trampoline<>(SB),NOSPLIT,$0-0
JMP libc_exit(SB)
-
GLOBL ·libc_exit_trampoline_addr(SB), RODATA, $8
DATA ·libc_exit_trampoline_addr(SB)/8, $libc_exit_trampoline<>(SB)
TEXT libc_faccessat_trampoline<>(SB),NOSPLIT,$0-0
JMP libc_faccessat(SB)
-
GLOBL ·libc_faccessat_trampoline_addr(SB), RODATA, $8
DATA ·libc_faccessat_trampoline_addr(SB)/8, $libc_faccessat_trampoline<>(SB)
TEXT libc_fchdir_trampoline<>(SB),NOSPLIT,$0-0
JMP libc_fchdir(SB)
-
GLOBL ·libc_fchdir_trampoline_addr(SB), RODATA, $8
DATA ·libc_fchdir_trampoline_addr(SB)/8, $libc_fchdir_trampoline<>(SB)
TEXT libc_fchflags_trampoline<>(SB),NOSPLIT,$0-0
JMP libc_fchflags(SB)
-
GLOBL ·libc_fchflags_trampoline_addr(SB), RODATA, $8
DATA ·libc_fchflags_trampoline_addr(SB)/8, $libc_fchflags_trampoline<>(SB)
TEXT libc_fchmod_trampoline<>(SB),NOSPLIT,$0-0
JMP libc_fchmod(SB)
-
GLOBL ·libc_fchmod_trampoline_addr(SB), RODATA, $8
DATA ·libc_fchmod_trampoline_addr(SB)/8, $libc_fchmod_trampoline<>(SB)
TEXT libc_fchmodat_trampoline<>(SB),NOSPLIT,$0-0
JMP libc_fchmodat(SB)
-
GLOBL ·libc_fchmodat_trampoline_addr(SB), RODATA, $8
DATA ·libc_fchmodat_trampoline_addr(SB)/8, $libc_fchmodat_trampoline<>(SB)
TEXT libc_fchown_trampoline<>(SB),NOSPLIT,$0-0
JMP libc_fchown(SB)
-
GLOBL ·libc_fchown_trampoline_addr(SB), RODATA, $8
DATA ·libc_fchown_trampoline_addr(SB)/8, $libc_fchown_trampoline<>(SB)
TEXT libc_fchownat_trampoline<>(SB),NOSPLIT,$0-0
JMP libc_fchownat(SB)
-
GLOBL ·libc_fchownat_trampoline_addr(SB), RODATA, $8
DATA ·libc_fchownat_trampoline_addr(SB)/8, $libc_fchownat_trampoline<>(SB)
TEXT libc_fclonefileat_trampoline<>(SB),NOSPLIT,$0-0
JMP libc_fclonefileat(SB)
-
GLOBL ·libc_fclonefileat_trampoline_addr(SB), RODATA, $8
DATA ·libc_fclonefileat_trampoline_addr(SB)/8, $libc_fclonefileat_trampoline<>(SB)
TEXT libc_flock_trampoline<>(SB),NOSPLIT,$0-0
JMP libc_flock(SB)
-
GLOBL ·libc_flock_trampoline_addr(SB), RODATA, $8
DATA ·libc_flock_trampoline_addr(SB)/8, $libc_flock_trampoline<>(SB)
TEXT libc_fpathconf_trampoline<>(SB),NOSPLIT,$0-0
JMP libc_fpathconf(SB)
-
GLOBL ·libc_fpathconf_trampoline_addr(SB), RODATA, $8
DATA ·libc_fpathconf_trampoline_addr(SB)/8, $libc_fpathconf_trampoline<>(SB)
TEXT libc_fsync_trampoline<>(SB),NOSPLIT,$0-0
JMP libc_fsync(SB)
-
GLOBL ·libc_fsync_trampoline_addr(SB), RODATA, $8
DATA ·libc_fsync_trampoline_addr(SB)/8, $libc_fsync_trampoline<>(SB)
TEXT libc_ftruncate_trampoline<>(SB),NOSPLIT,$0-0
JMP libc_ftruncate(SB)
-
GLOBL ·libc_ftruncate_trampoline_addr(SB), RODATA, $8
DATA ·libc_ftruncate_trampoline_addr(SB)/8, $libc_ftruncate_trampoline<>(SB)
TEXT libc_getcwd_trampoline<>(SB),NOSPLIT,$0-0
JMP libc_getcwd(SB)
-
GLOBL ·libc_getcwd_trampoline_addr(SB), RODATA, $8
DATA ·libc_getcwd_trampoline_addr(SB)/8, $libc_getcwd_trampoline<>(SB)
TEXT libc_getdtablesize_trampoline<>(SB),NOSPLIT,$0-0
JMP libc_getdtablesize(SB)
-
GLOBL ·libc_getdtablesize_trampoline_addr(SB), RODATA, $8
DATA ·libc_getdtablesize_trampoline_addr(SB)/8, $libc_getdtablesize_trampoline<>(SB)
TEXT libc_getegid_trampoline<>(SB),NOSPLIT,$0-0
JMP libc_getegid(SB)
-
GLOBL ·libc_getegid_trampoline_addr(SB), RODATA, $8
DATA ·libc_getegid_trampoline_addr(SB)/8, $libc_getegid_trampoline<>(SB)
TEXT libc_geteuid_trampoline<>(SB),NOSPLIT,$0-0
JMP libc_geteuid(SB)
-
GLOBL ·libc_geteuid_trampoline_addr(SB), RODATA, $8
DATA ·libc_geteuid_trampoline_addr(SB)/8, $libc_geteuid_trampoline<>(SB)
TEXT libc_getgid_trampoline<>(SB),NOSPLIT,$0-0
JMP libc_getgid(SB)
-
GLOBL ·libc_getgid_trampoline_addr(SB), RODATA, $8
DATA ·libc_getgid_trampoline_addr(SB)/8, $libc_getgid_trampoline<>(SB)
TEXT libc_getpgid_trampoline<>(SB),NOSPLIT,$0-0
JMP libc_getpgid(SB)
-
GLOBL ·libc_getpgid_trampoline_addr(SB), RODATA, $8
DATA ·libc_getpgid_trampoline_addr(SB)/8, $libc_getpgid_trampoline<>(SB)
TEXT libc_getpgrp_trampoline<>(SB),NOSPLIT,$0-0
JMP libc_getpgrp(SB)
-
GLOBL ·libc_getpgrp_trampoline_addr(SB), RODATA, $8
DATA ·libc_getpgrp_trampoline_addr(SB)/8, $libc_getpgrp_trampoline<>(SB)
TEXT libc_getpid_trampoline<>(SB),NOSPLIT,$0-0
JMP libc_getpid(SB)
-
GLOBL ·libc_getpid_trampoline_addr(SB), RODATA, $8
DATA ·libc_getpid_trampoline_addr(SB)/8, $libc_getpid_trampoline<>(SB)
TEXT libc_getppid_trampoline<>(SB),NOSPLIT,$0-0
JMP libc_getppid(SB)
-
GLOBL ·libc_getppid_trampoline_addr(SB), RODATA, $8
DATA ·libc_getppid_trampoline_addr(SB)/8, $libc_getppid_trampoline<>(SB)
TEXT libc_getpriority_trampoline<>(SB),NOSPLIT,$0-0
JMP libc_getpriority(SB)
-
GLOBL ·libc_getpriority_trampoline_addr(SB), RODATA, $8
DATA ·libc_getpriority_trampoline_addr(SB)/8, $libc_getpriority_trampoline<>(SB)
TEXT libc_getrlimit_trampoline<>(SB),NOSPLIT,$0-0
JMP libc_getrlimit(SB)
-
GLOBL ·libc_getrlimit_trampoline_addr(SB), RODATA, $8
DATA ·libc_getrlimit_trampoline_addr(SB)/8, $libc_getrlimit_trampoline<>(SB)
TEXT libc_getrusage_trampoline<>(SB),NOSPLIT,$0-0
JMP libc_getrusage(SB)
-
GLOBL ·libc_getrusage_trampoline_addr(SB), RODATA, $8
DATA ·libc_getrusage_trampoline_addr(SB)/8, $libc_getrusage_trampoline<>(SB)
TEXT libc_getsid_trampoline<>(SB),NOSPLIT,$0-0
JMP libc_getsid(SB)
-
GLOBL ·libc_getsid_trampoline_addr(SB), RODATA, $8
DATA ·libc_getsid_trampoline_addr(SB)/8, $libc_getsid_trampoline<>(SB)
TEXT libc_gettimeofday_trampoline<>(SB),NOSPLIT,$0-0
JMP libc_gettimeofday(SB)
-
GLOBL ·libc_gettimeofday_trampoline_addr(SB), RODATA, $8
DATA ·libc_gettimeofday_trampoline_addr(SB)/8, $libc_gettimeofday_trampoline<>(SB)
TEXT libc_getuid_trampoline<>(SB),NOSPLIT,$0-0
JMP libc_getuid(SB)
-
GLOBL ·libc_getuid_trampoline_addr(SB), RODATA, $8
DATA ·libc_getuid_trampoline_addr(SB)/8, $libc_getuid_trampoline<>(SB)
TEXT libc_issetugid_trampoline<>(SB),NOSPLIT,$0-0
JMP libc_issetugid(SB)
-
GLOBL ·libc_issetugid_trampoline_addr(SB), RODATA, $8
DATA ·libc_issetugid_trampoline_addr(SB)/8, $libc_issetugid_trampoline<>(SB)
TEXT libc_kqueue_trampoline<>(SB),NOSPLIT,$0-0
JMP libc_kqueue(SB)
-
GLOBL ·libc_kqueue_trampoline_addr(SB), RODATA, $8
DATA ·libc_kqueue_trampoline_addr(SB)/8, $libc_kqueue_trampoline<>(SB)
TEXT libc_lchown_trampoline<>(SB),NOSPLIT,$0-0
JMP libc_lchown(SB)
-
GLOBL ·libc_lchown_trampoline_addr(SB), RODATA, $8
DATA ·libc_lchown_trampoline_addr(SB)/8, $libc_lchown_trampoline<>(SB)
TEXT libc_link_trampoline<>(SB),NOSPLIT,$0-0
JMP libc_link(SB)
-
GLOBL ·libc_link_trampoline_addr(SB), RODATA, $8
DATA ·libc_link_trampoline_addr(SB)/8, $libc_link_trampoline<>(SB)
TEXT libc_linkat_trampoline<>(SB),NOSPLIT,$0-0
JMP libc_linkat(SB)
-
GLOBL ·libc_linkat_trampoline_addr(SB), RODATA, $8
DATA ·libc_linkat_trampoline_addr(SB)/8, $libc_linkat_trampoline<>(SB)
TEXT libc_listen_trampoline<>(SB),NOSPLIT,$0-0
JMP libc_listen(SB)
-
GLOBL ·libc_listen_trampoline_addr(SB), RODATA, $8
DATA ·libc_listen_trampoline_addr(SB)/8, $libc_listen_trampoline<>(SB)
TEXT libc_mkdir_trampoline<>(SB),NOSPLIT,$0-0
JMP libc_mkdir(SB)
-
GLOBL ·libc_mkdir_trampoline_addr(SB), RODATA, $8
DATA ·libc_mkdir_trampoline_addr(SB)/8, $libc_mkdir_trampoline<>(SB)
TEXT libc_mkdirat_trampoline<>(SB),NOSPLIT,$0-0
JMP libc_mkdirat(SB)
-
GLOBL ·libc_mkdirat_trampoline_addr(SB), RODATA, $8
DATA ·libc_mkdirat_trampoline_addr(SB)/8, $libc_mkdirat_trampoline<>(SB)
TEXT libc_mkfifo_trampoline<>(SB),NOSPLIT,$0-0
JMP libc_mkfifo(SB)
-
GLOBL ·libc_mkfifo_trampoline_addr(SB), RODATA, $8
DATA ·libc_mkfifo_trampoline_addr(SB)/8, $libc_mkfifo_trampoline<>(SB)
TEXT libc_mknod_trampoline<>(SB),NOSPLIT,$0-0
JMP libc_mknod(SB)
-
GLOBL ·libc_mknod_trampoline_addr(SB), RODATA, $8
DATA ·libc_mknod_trampoline_addr(SB)/8, $libc_mknod_trampoline<>(SB)
TEXT libc_mount_trampoline<>(SB),NOSPLIT,$0-0
JMP libc_mount(SB)
-
GLOBL ·libc_mount_trampoline_addr(SB), RODATA, $8
DATA ·libc_mount_trampoline_addr(SB)/8, $libc_mount_trampoline<>(SB)
TEXT libc_open_trampoline<>(SB),NOSPLIT,$0-0
JMP libc_open(SB)
-
GLOBL ·libc_open_trampoline_addr(SB), RODATA, $8
DATA ·libc_open_trampoline_addr(SB)/8, $libc_open_trampoline<>(SB)
TEXT libc_openat_trampoline<>(SB),NOSPLIT,$0-0
JMP libc_openat(SB)
-
GLOBL ·libc_openat_trampoline_addr(SB), RODATA, $8
DATA ·libc_openat_trampoline_addr(SB)/8, $libc_openat_trampoline<>(SB)
TEXT libc_pathconf_trampoline<>(SB),NOSPLIT,$0-0
JMP libc_pathconf(SB)
-
GLOBL ·libc_pathconf_trampoline_addr(SB), RODATA, $8
DATA ·libc_pathconf_trampoline_addr(SB)/8, $libc_pathconf_trampoline<>(SB)
TEXT libc_pread_trampoline<>(SB),NOSPLIT,$0-0
JMP libc_pread(SB)
-
GLOBL ·libc_pread_trampoline_addr(SB), RODATA, $8
DATA ·libc_pread_trampoline_addr(SB)/8, $libc_pread_trampoline<>(SB)
TEXT libc_pwrite_trampoline<>(SB),NOSPLIT,$0-0
JMP libc_pwrite(SB)
-
GLOBL ·libc_pwrite_trampoline_addr(SB), RODATA, $8
DATA ·libc_pwrite_trampoline_addr(SB)/8, $libc_pwrite_trampoline<>(SB)
TEXT libc_read_trampoline<>(SB),NOSPLIT,$0-0
JMP libc_read(SB)
-
GLOBL ·libc_read_trampoline_addr(SB), RODATA, $8
DATA ·libc_read_trampoline_addr(SB)/8, $libc_read_trampoline<>(SB)
TEXT libc_readlink_trampoline<>(SB),NOSPLIT,$0-0
JMP libc_readlink(SB)
-
GLOBL ·libc_readlink_trampoline_addr(SB), RODATA, $8
DATA ·libc_readlink_trampoline_addr(SB)/8, $libc_readlink_trampoline<>(SB)
TEXT libc_readlinkat_trampoline<>(SB),NOSPLIT,$0-0
JMP libc_readlinkat(SB)
-
GLOBL ·libc_readlinkat_trampoline_addr(SB), RODATA, $8
DATA ·libc_readlinkat_trampoline_addr(SB)/8, $libc_readlinkat_trampoline<>(SB)
TEXT libc_rename_trampoline<>(SB),NOSPLIT,$0-0
JMP libc_rename(SB)
-
GLOBL ·libc_rename_trampoline_addr(SB), RODATA, $8
DATA ·libc_rename_trampoline_addr(SB)/8, $libc_rename_trampoline<>(SB)
TEXT libc_renameat_trampoline<>(SB),NOSPLIT,$0-0
JMP libc_renameat(SB)
-
GLOBL ·libc_renameat_trampoline_addr(SB), RODATA, $8
DATA ·libc_renameat_trampoline_addr(SB)/8, $libc_renameat_trampoline<>(SB)
TEXT libc_revoke_trampoline<>(SB),NOSPLIT,$0-0
JMP libc_revoke(SB)
-
GLOBL ·libc_revoke_trampoline_addr(SB), RODATA, $8
DATA ·libc_revoke_trampoline_addr(SB)/8, $libc_revoke_trampoline<>(SB)
TEXT libc_rmdir_trampoline<>(SB),NOSPLIT,$0-0
JMP libc_rmdir(SB)
-
GLOBL ·libc_rmdir_trampoline_addr(SB), RODATA, $8
DATA ·libc_rmdir_trampoline_addr(SB)/8, $libc_rmdir_trampoline<>(SB)
TEXT libc_lseek_trampoline<>(SB),NOSPLIT,$0-0
JMP libc_lseek(SB)
-
GLOBL ·libc_lseek_trampoline_addr(SB), RODATA, $8
DATA ·libc_lseek_trampoline_addr(SB)/8, $libc_lseek_trampoline<>(SB)
TEXT libc_select_trampoline<>(SB),NOSPLIT,$0-0
JMP libc_select(SB)
-
GLOBL ·libc_select_trampoline_addr(SB), RODATA, $8
DATA ·libc_select_trampoline_addr(SB)/8, $libc_select_trampoline<>(SB)
@@ -712,192 +595,160 @@ DATA ·libc_setattrlist_trampoline_addr(SB)/8, $libc_setattrlist_trampoline<>(SB
TEXT libc_setegid_trampoline<>(SB),NOSPLIT,$0-0
JMP libc_setegid(SB)
-
GLOBL ·libc_setegid_trampoline_addr(SB), RODATA, $8
DATA ·libc_setegid_trampoline_addr(SB)/8, $libc_setegid_trampoline<>(SB)
TEXT libc_seteuid_trampoline<>(SB),NOSPLIT,$0-0
JMP libc_seteuid(SB)
-
GLOBL ·libc_seteuid_trampoline_addr(SB), RODATA, $8
DATA ·libc_seteuid_trampoline_addr(SB)/8, $libc_seteuid_trampoline<>(SB)
TEXT libc_setgid_trampoline<>(SB),NOSPLIT,$0-0
JMP libc_setgid(SB)
-
GLOBL ·libc_setgid_trampoline_addr(SB), RODATA, $8
DATA ·libc_setgid_trampoline_addr(SB)/8, $libc_setgid_trampoline<>(SB)
TEXT libc_setlogin_trampoline<>(SB),NOSPLIT,$0-0
JMP libc_setlogin(SB)
-
GLOBL ·libc_setlogin_trampoline_addr(SB), RODATA, $8
DATA ·libc_setlogin_trampoline_addr(SB)/8, $libc_setlogin_trampoline<>(SB)
TEXT libc_setpgid_trampoline<>(SB),NOSPLIT,$0-0
JMP libc_setpgid(SB)
-
GLOBL ·libc_setpgid_trampoline_addr(SB), RODATA, $8
DATA ·libc_setpgid_trampoline_addr(SB)/8, $libc_setpgid_trampoline<>(SB)
TEXT libc_setpriority_trampoline<>(SB),NOSPLIT,$0-0
JMP libc_setpriority(SB)
-
GLOBL ·libc_setpriority_trampoline_addr(SB), RODATA, $8
DATA ·libc_setpriority_trampoline_addr(SB)/8, $libc_setpriority_trampoline<>(SB)
TEXT libc_setprivexec_trampoline<>(SB),NOSPLIT,$0-0
JMP libc_setprivexec(SB)
-
GLOBL ·libc_setprivexec_trampoline_addr(SB), RODATA, $8
DATA ·libc_setprivexec_trampoline_addr(SB)/8, $libc_setprivexec_trampoline<>(SB)
TEXT libc_setregid_trampoline<>(SB),NOSPLIT,$0-0
JMP libc_setregid(SB)
-
GLOBL ·libc_setregid_trampoline_addr(SB), RODATA, $8
DATA ·libc_setregid_trampoline_addr(SB)/8, $libc_setregid_trampoline<>(SB)
TEXT libc_setreuid_trampoline<>(SB),NOSPLIT,$0-0
JMP libc_setreuid(SB)
-
GLOBL ·libc_setreuid_trampoline_addr(SB), RODATA, $8
DATA ·libc_setreuid_trampoline_addr(SB)/8, $libc_setreuid_trampoline<>(SB)
TEXT libc_setsid_trampoline<>(SB),NOSPLIT,$0-0
JMP libc_setsid(SB)
-
GLOBL ·libc_setsid_trampoline_addr(SB), RODATA, $8
DATA ·libc_setsid_trampoline_addr(SB)/8, $libc_setsid_trampoline<>(SB)
TEXT libc_settimeofday_trampoline<>(SB),NOSPLIT,$0-0
JMP libc_settimeofday(SB)
-
GLOBL ·libc_settimeofday_trampoline_addr(SB), RODATA, $8
DATA ·libc_settimeofday_trampoline_addr(SB)/8, $libc_settimeofday_trampoline<>(SB)
TEXT libc_setuid_trampoline<>(SB),NOSPLIT,$0-0
JMP libc_setuid(SB)
-
GLOBL ·libc_setuid_trampoline_addr(SB), RODATA, $8
DATA ·libc_setuid_trampoline_addr(SB)/8, $libc_setuid_trampoline<>(SB)
TEXT libc_symlink_trampoline<>(SB),NOSPLIT,$0-0
JMP libc_symlink(SB)
-
GLOBL ·libc_symlink_trampoline_addr(SB), RODATA, $8
DATA ·libc_symlink_trampoline_addr(SB)/8, $libc_symlink_trampoline<>(SB)
TEXT libc_symlinkat_trampoline<>(SB),NOSPLIT,$0-0
JMP libc_symlinkat(SB)
-
GLOBL ·libc_symlinkat_trampoline_addr(SB), RODATA, $8
DATA ·libc_symlinkat_trampoline_addr(SB)/8, $libc_symlinkat_trampoline<>(SB)
TEXT libc_sync_trampoline<>(SB),NOSPLIT,$0-0
JMP libc_sync(SB)
-
GLOBL ·libc_sync_trampoline_addr(SB), RODATA, $8
DATA ·libc_sync_trampoline_addr(SB)/8, $libc_sync_trampoline<>(SB)
TEXT libc_truncate_trampoline<>(SB),NOSPLIT,$0-0
JMP libc_truncate(SB)
-
GLOBL ·libc_truncate_trampoline_addr(SB), RODATA, $8
DATA ·libc_truncate_trampoline_addr(SB)/8, $libc_truncate_trampoline<>(SB)
TEXT libc_umask_trampoline<>(SB),NOSPLIT,$0-0
JMP libc_umask(SB)
-
GLOBL ·libc_umask_trampoline_addr(SB), RODATA, $8
DATA ·libc_umask_trampoline_addr(SB)/8, $libc_umask_trampoline<>(SB)
TEXT libc_undelete_trampoline<>(SB),NOSPLIT,$0-0
JMP libc_undelete(SB)
-
GLOBL ·libc_undelete_trampoline_addr(SB), RODATA, $8
DATA ·libc_undelete_trampoline_addr(SB)/8, $libc_undelete_trampoline<>(SB)
TEXT libc_unlink_trampoline<>(SB),NOSPLIT,$0-0
JMP libc_unlink(SB)
-
GLOBL ·libc_unlink_trampoline_addr(SB), RODATA, $8
DATA ·libc_unlink_trampoline_addr(SB)/8, $libc_unlink_trampoline<>(SB)
TEXT libc_unlinkat_trampoline<>(SB),NOSPLIT,$0-0
JMP libc_unlinkat(SB)
-
GLOBL ·libc_unlinkat_trampoline_addr(SB), RODATA, $8
DATA ·libc_unlinkat_trampoline_addr(SB)/8, $libc_unlinkat_trampoline<>(SB)
TEXT libc_unmount_trampoline<>(SB),NOSPLIT,$0-0
JMP libc_unmount(SB)
-
GLOBL ·libc_unmount_trampoline_addr(SB), RODATA, $8
DATA ·libc_unmount_trampoline_addr(SB)/8, $libc_unmount_trampoline<>(SB)
TEXT libc_write_trampoline<>(SB),NOSPLIT,$0-0
JMP libc_write(SB)
-
GLOBL ·libc_write_trampoline_addr(SB), RODATA, $8
DATA ·libc_write_trampoline_addr(SB)/8, $libc_write_trampoline<>(SB)
TEXT libc_mmap_trampoline<>(SB),NOSPLIT,$0-0
JMP libc_mmap(SB)
-
GLOBL ·libc_mmap_trampoline_addr(SB), RODATA, $8
DATA ·libc_mmap_trampoline_addr(SB)/8, $libc_mmap_trampoline<>(SB)
TEXT libc_munmap_trampoline<>(SB),NOSPLIT,$0-0
JMP libc_munmap(SB)
-
GLOBL ·libc_munmap_trampoline_addr(SB), RODATA, $8
DATA ·libc_munmap_trampoline_addr(SB)/8, $libc_munmap_trampoline<>(SB)
TEXT libc_fstat_trampoline<>(SB),NOSPLIT,$0-0
JMP libc_fstat(SB)
-
GLOBL ·libc_fstat_trampoline_addr(SB), RODATA, $8
DATA ·libc_fstat_trampoline_addr(SB)/8, $libc_fstat_trampoline<>(SB)
TEXT libc_fstatat_trampoline<>(SB),NOSPLIT,$0-0
JMP libc_fstatat(SB)
-
GLOBL ·libc_fstatat_trampoline_addr(SB), RODATA, $8
DATA ·libc_fstatat_trampoline_addr(SB)/8, $libc_fstatat_trampoline<>(SB)
TEXT libc_fstatfs_trampoline<>(SB),NOSPLIT,$0-0
JMP libc_fstatfs(SB)
-
GLOBL ·libc_fstatfs_trampoline_addr(SB), RODATA, $8
DATA ·libc_fstatfs_trampoline_addr(SB)/8, $libc_fstatfs_trampoline<>(SB)
TEXT libc_getfsstat_trampoline<>(SB),NOSPLIT,$0-0
JMP libc_getfsstat(SB)
-
GLOBL ·libc_getfsstat_trampoline_addr(SB), RODATA, $8
DATA ·libc_getfsstat_trampoline_addr(SB)/8, $libc_getfsstat_trampoline<>(SB)
TEXT libc_lstat_trampoline<>(SB),NOSPLIT,$0-0
JMP libc_lstat(SB)
-
GLOBL ·libc_lstat_trampoline_addr(SB), RODATA, $8
DATA ·libc_lstat_trampoline_addr(SB)/8, $libc_lstat_trampoline<>(SB)
TEXT libc_ptrace_trampoline<>(SB),NOSPLIT,$0-0
JMP libc_ptrace(SB)
-
GLOBL ·libc_ptrace_trampoline_addr(SB), RODATA, $8
DATA ·libc_ptrace_trampoline_addr(SB)/8, $libc_ptrace_trampoline<>(SB)
TEXT libc_stat_trampoline<>(SB),NOSPLIT,$0-0
JMP libc_stat(SB)
-
GLOBL ·libc_stat_trampoline_addr(SB), RODATA, $8
DATA ·libc_stat_trampoline_addr(SB)/8, $libc_stat_trampoline<>(SB)
TEXT libc_statfs_trampoline<>(SB),NOSPLIT,$0-0
JMP libc_statfs(SB)
-
GLOBL ·libc_statfs_trampoline_addr(SB), RODATA, $8
DATA ·libc_statfs_trampoline_addr(SB)/8, $libc_statfs_trampoline<>(SB)
diff --git a/vendor/golang.org/x/sys/unix/zsyscall_dragonfly_amd64.go b/vendor/golang.org/x/sys/unix/zsyscall_dragonfly_amd64.go
index 0eabac7a..aad65fc7 100644
--- a/vendor/golang.org/x/sys/unix/zsyscall_dragonfly_amd64.go
+++ b/vendor/golang.org/x/sys/unix/zsyscall_dragonfly_amd64.go
@@ -2,7 +2,6 @@
// Code generated by the command above; see README.md. DO NOT EDIT.
//go:build dragonfly && amd64
-// +build dragonfly,amd64
package unix
@@ -1642,28 +1641,6 @@ func munmap(addr uintptr, length uintptr) (err error) {
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
-func readlen(fd int, buf *byte, nbuf int) (n int, err error) {
- r0, _, e1 := Syscall(SYS_READ, uintptr(fd), uintptr(unsafe.Pointer(buf)), uintptr(nbuf))
- n = int(r0)
- if e1 != 0 {
- err = errnoErr(e1)
- }
- return
-}
-
-// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
-
-func writelen(fd int, buf *byte, nbuf int) (n int, err error) {
- r0, _, e1 := Syscall(SYS_WRITE, uintptr(fd), uintptr(unsafe.Pointer(buf)), uintptr(nbuf))
- n = int(r0)
- if e1 != 0 {
- err = errnoErr(e1)
- }
- return
-}
-
-// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
-
func accept4(fd int, rsa *RawSockaddrAny, addrlen *_Socklen, flags int) (nfd int, err error) {
r0, _, e1 := Syscall6(SYS_ACCEPT4, uintptr(fd), uintptr(unsafe.Pointer(rsa)), uintptr(unsafe.Pointer(addrlen)), uintptr(flags), 0, 0)
nfd = int(r0)
diff --git a/vendor/golang.org/x/sys/unix/zsyscall_freebsd_386.go b/vendor/golang.org/x/sys/unix/zsyscall_freebsd_386.go
index ee313eb0..c0096391 100644
--- a/vendor/golang.org/x/sys/unix/zsyscall_freebsd_386.go
+++ b/vendor/golang.org/x/sys/unix/zsyscall_freebsd_386.go
@@ -2,7 +2,6 @@
// Code generated by the command above; see README.md. DO NOT EDIT.
//go:build freebsd && 386
-// +build freebsd,386
package unix
@@ -1862,28 +1861,6 @@ func munmap(addr uintptr, length uintptr) (err error) {
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
-func readlen(fd int, buf *byte, nbuf int) (n int, err error) {
- r0, _, e1 := Syscall(SYS_READ, uintptr(fd), uintptr(unsafe.Pointer(buf)), uintptr(nbuf))
- n = int(r0)
- if e1 != 0 {
- err = errnoErr(e1)
- }
- return
-}
-
-// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
-
-func writelen(fd int, buf *byte, nbuf int) (n int, err error) {
- r0, _, e1 := Syscall(SYS_WRITE, uintptr(fd), uintptr(unsafe.Pointer(buf)), uintptr(nbuf))
- n = int(r0)
- if e1 != 0 {
- err = errnoErr(e1)
- }
- return
-}
-
-// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
-
func accept4(fd int, rsa *RawSockaddrAny, addrlen *_Socklen, flags int) (nfd int, err error) {
r0, _, e1 := Syscall6(SYS_ACCEPT4, uintptr(fd), uintptr(unsafe.Pointer(rsa)), uintptr(unsafe.Pointer(addrlen)), uintptr(flags), 0, 0)
nfd = int(r0)
diff --git a/vendor/golang.org/x/sys/unix/zsyscall_freebsd_amd64.go b/vendor/golang.org/x/sys/unix/zsyscall_freebsd_amd64.go
index 4c986e44..7664df74 100644
--- a/vendor/golang.org/x/sys/unix/zsyscall_freebsd_amd64.go
+++ b/vendor/golang.org/x/sys/unix/zsyscall_freebsd_amd64.go
@@ -2,7 +2,6 @@
// Code generated by the command above; see README.md. DO NOT EDIT.
//go:build freebsd && amd64
-// +build freebsd,amd64
package unix
@@ -1862,28 +1861,6 @@ func munmap(addr uintptr, length uintptr) (err error) {
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
-func readlen(fd int, buf *byte, nbuf int) (n int, err error) {
- r0, _, e1 := Syscall(SYS_READ, uintptr(fd), uintptr(unsafe.Pointer(buf)), uintptr(nbuf))
- n = int(r0)
- if e1 != 0 {
- err = errnoErr(e1)
- }
- return
-}
-
-// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
-
-func writelen(fd int, buf *byte, nbuf int) (n int, err error) {
- r0, _, e1 := Syscall(SYS_WRITE, uintptr(fd), uintptr(unsafe.Pointer(buf)), uintptr(nbuf))
- n = int(r0)
- if e1 != 0 {
- err = errnoErr(e1)
- }
- return
-}
-
-// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
-
func accept4(fd int, rsa *RawSockaddrAny, addrlen *_Socklen, flags int) (nfd int, err error) {
r0, _, e1 := Syscall6(SYS_ACCEPT4, uintptr(fd), uintptr(unsafe.Pointer(rsa)), uintptr(unsafe.Pointer(addrlen)), uintptr(flags), 0, 0)
nfd = int(r0)
diff --git a/vendor/golang.org/x/sys/unix/zsyscall_freebsd_arm.go b/vendor/golang.org/x/sys/unix/zsyscall_freebsd_arm.go
index 55521694..ae099182 100644
--- a/vendor/golang.org/x/sys/unix/zsyscall_freebsd_arm.go
+++ b/vendor/golang.org/x/sys/unix/zsyscall_freebsd_arm.go
@@ -2,7 +2,6 @@
// Code generated by the command above; see README.md. DO NOT EDIT.
//go:build freebsd && arm
-// +build freebsd,arm
package unix
@@ -1862,28 +1861,6 @@ func munmap(addr uintptr, length uintptr) (err error) {
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
-func readlen(fd int, buf *byte, nbuf int) (n int, err error) {
- r0, _, e1 := Syscall(SYS_READ, uintptr(fd), uintptr(unsafe.Pointer(buf)), uintptr(nbuf))
- n = int(r0)
- if e1 != 0 {
- err = errnoErr(e1)
- }
- return
-}
-
-// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
-
-func writelen(fd int, buf *byte, nbuf int) (n int, err error) {
- r0, _, e1 := Syscall(SYS_WRITE, uintptr(fd), uintptr(unsafe.Pointer(buf)), uintptr(nbuf))
- n = int(r0)
- if e1 != 0 {
- err = errnoErr(e1)
- }
- return
-}
-
-// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
-
func accept4(fd int, rsa *RawSockaddrAny, addrlen *_Socklen, flags int) (nfd int, err error) {
r0, _, e1 := Syscall6(SYS_ACCEPT4, uintptr(fd), uintptr(unsafe.Pointer(rsa)), uintptr(unsafe.Pointer(addrlen)), uintptr(flags), 0, 0)
nfd = int(r0)
diff --git a/vendor/golang.org/x/sys/unix/zsyscall_freebsd_arm64.go b/vendor/golang.org/x/sys/unix/zsyscall_freebsd_arm64.go
index 67a226fb..11fd5d45 100644
--- a/vendor/golang.org/x/sys/unix/zsyscall_freebsd_arm64.go
+++ b/vendor/golang.org/x/sys/unix/zsyscall_freebsd_arm64.go
@@ -2,7 +2,6 @@
// Code generated by the command above; see README.md. DO NOT EDIT.
//go:build freebsd && arm64
-// +build freebsd,arm64
package unix
@@ -1862,28 +1861,6 @@ func munmap(addr uintptr, length uintptr) (err error) {
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
-func readlen(fd int, buf *byte, nbuf int) (n int, err error) {
- r0, _, e1 := Syscall(SYS_READ, uintptr(fd), uintptr(unsafe.Pointer(buf)), uintptr(nbuf))
- n = int(r0)
- if e1 != 0 {
- err = errnoErr(e1)
- }
- return
-}
-
-// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
-
-func writelen(fd int, buf *byte, nbuf int) (n int, err error) {
- r0, _, e1 := Syscall(SYS_WRITE, uintptr(fd), uintptr(unsafe.Pointer(buf)), uintptr(nbuf))
- n = int(r0)
- if e1 != 0 {
- err = errnoErr(e1)
- }
- return
-}
-
-// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
-
func accept4(fd int, rsa *RawSockaddrAny, addrlen *_Socklen, flags int) (nfd int, err error) {
r0, _, e1 := Syscall6(SYS_ACCEPT4, uintptr(fd), uintptr(unsafe.Pointer(rsa)), uintptr(unsafe.Pointer(addrlen)), uintptr(flags), 0, 0)
nfd = int(r0)
diff --git a/vendor/golang.org/x/sys/unix/zsyscall_freebsd_riscv64.go b/vendor/golang.org/x/sys/unix/zsyscall_freebsd_riscv64.go
index f0b9ddaa..c3d2d653 100644
--- a/vendor/golang.org/x/sys/unix/zsyscall_freebsd_riscv64.go
+++ b/vendor/golang.org/x/sys/unix/zsyscall_freebsd_riscv64.go
@@ -2,7 +2,6 @@
// Code generated by the command above; see README.md. DO NOT EDIT.
//go:build freebsd && riscv64
-// +build freebsd,riscv64
package unix
@@ -1862,28 +1861,6 @@ func munmap(addr uintptr, length uintptr) (err error) {
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
-func readlen(fd int, buf *byte, nbuf int) (n int, err error) {
- r0, _, e1 := Syscall(SYS_READ, uintptr(fd), uintptr(unsafe.Pointer(buf)), uintptr(nbuf))
- n = int(r0)
- if e1 != 0 {
- err = errnoErr(e1)
- }
- return
-}
-
-// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
-
-func writelen(fd int, buf *byte, nbuf int) (n int, err error) {
- r0, _, e1 := Syscall(SYS_WRITE, uintptr(fd), uintptr(unsafe.Pointer(buf)), uintptr(nbuf))
- n = int(r0)
- if e1 != 0 {
- err = errnoErr(e1)
- }
- return
-}
-
-// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
-
func accept4(fd int, rsa *RawSockaddrAny, addrlen *_Socklen, flags int) (nfd int, err error) {
r0, _, e1 := Syscall6(SYS_ACCEPT4, uintptr(fd), uintptr(unsafe.Pointer(rsa)), uintptr(unsafe.Pointer(addrlen)), uintptr(flags), 0, 0)
nfd = int(r0)
diff --git a/vendor/golang.org/x/sys/unix/zsyscall_illumos_amd64.go b/vendor/golang.org/x/sys/unix/zsyscall_illumos_amd64.go
index b57c7050..c698cbc0 100644
--- a/vendor/golang.org/x/sys/unix/zsyscall_illumos_amd64.go
+++ b/vendor/golang.org/x/sys/unix/zsyscall_illumos_amd64.go
@@ -2,7 +2,6 @@
// Code generated by the command above; see README.md. DO NOT EDIT.
//go:build illumos && amd64
-// +build illumos,amd64
package unix
@@ -40,7 +39,7 @@ func readv(fd int, iovs []Iovec) (n int, err error) {
r0, _, e1 := sysvicall6(uintptr(unsafe.Pointer(&procreadv)), 3, uintptr(fd), uintptr(unsafe.Pointer(_p0)), uintptr(len(iovs)), 0, 0, 0)
n = int(r0)
if e1 != 0 {
- err = e1
+ err = errnoErr(e1)
}
return
}
@@ -55,7 +54,7 @@ func preadv(fd int, iovs []Iovec, off int64) (n int, err error) {
r0, _, e1 := sysvicall6(uintptr(unsafe.Pointer(&procpreadv)), 4, uintptr(fd), uintptr(unsafe.Pointer(_p0)), uintptr(len(iovs)), uintptr(off), 0, 0)
n = int(r0)
if e1 != 0 {
- err = e1
+ err = errnoErr(e1)
}
return
}
@@ -70,7 +69,7 @@ func writev(fd int, iovs []Iovec) (n int, err error) {
r0, _, e1 := sysvicall6(uintptr(unsafe.Pointer(&procwritev)), 3, uintptr(fd), uintptr(unsafe.Pointer(_p0)), uintptr(len(iovs)), 0, 0, 0)
n = int(r0)
if e1 != 0 {
- err = e1
+ err = errnoErr(e1)
}
return
}
@@ -85,7 +84,7 @@ func pwritev(fd int, iovs []Iovec, off int64) (n int, err error) {
r0, _, e1 := sysvicall6(uintptr(unsafe.Pointer(&procpwritev)), 4, uintptr(fd), uintptr(unsafe.Pointer(_p0)), uintptr(len(iovs)), uintptr(off), 0, 0)
n = int(r0)
if e1 != 0 {
- err = e1
+ err = errnoErr(e1)
}
return
}
@@ -96,7 +95,7 @@ func accept4(s int, rsa *RawSockaddrAny, addrlen *_Socklen, flags int) (fd int,
r0, _, e1 := sysvicall6(uintptr(unsafe.Pointer(&procaccept4)), 4, uintptr(s), uintptr(unsafe.Pointer(rsa)), uintptr(unsafe.Pointer(addrlen)), uintptr(flags), 0, 0)
fd = int(r0)
if e1 != 0 {
- err = e1
+ err = errnoErr(e1)
}
return
}
diff --git a/vendor/golang.org/x/sys/unix/zsyscall_linux.go b/vendor/golang.org/x/sys/unix/zsyscall_linux.go
index 14ab34a5..1488d271 100644
--- a/vendor/golang.org/x/sys/unix/zsyscall_linux.go
+++ b/vendor/golang.org/x/sys/unix/zsyscall_linux.go
@@ -1,7 +1,6 @@
// Code generated by mkmerge; DO NOT EDIT.
//go:build linux
-// +build linux
package unix
@@ -38,6 +37,21 @@ func fchmodat(dirfd int, path string, mode uint32) (err error) {
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
+func fchmodat2(dirfd int, path string, mode uint32, flags int) (err error) {
+ var _p0 *byte
+ _p0, err = BytePtrFromString(path)
+ if err != nil {
+ return
+ }
+ _, _, e1 := Syscall6(SYS_FCHMODAT2, uintptr(dirfd), uintptr(unsafe.Pointer(_p0)), uintptr(mode), uintptr(flags), 0, 0)
+ if e1 != 0 {
+ err = errnoErr(e1)
+ }
+ return
+}
+
+// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
+
func ioctl(fd int, req uint, arg uintptr) (err error) {
_, _, e1 := Syscall(SYS_IOCTL, uintptr(fd), uintptr(req), uintptr(arg))
if e1 != 0 {
@@ -1734,28 +1748,6 @@ func exitThread(code int) (err error) {
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
-func readlen(fd int, p *byte, np int) (n int, err error) {
- r0, _, e1 := Syscall(SYS_READ, uintptr(fd), uintptr(unsafe.Pointer(p)), uintptr(np))
- n = int(r0)
- if e1 != 0 {
- err = errnoErr(e1)
- }
- return
-}
-
-// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
-
-func writelen(fd int, p *byte, np int) (n int, err error) {
- r0, _, e1 := Syscall(SYS_WRITE, uintptr(fd), uintptr(unsafe.Pointer(p)), uintptr(np))
- n = int(r0)
- if e1 != 0 {
- err = errnoErr(e1)
- }
- return
-}
-
-// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
-
func readv(fd int, iovs []Iovec) (n int, err error) {
var _p0 unsafe.Pointer
if len(iovs) > 0 {
@@ -2217,3 +2209,13 @@ func schedGetattr(pid int, attr *SchedAttr, size uint, flags uint) (err error) {
}
return
}
+
+// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
+
+func Cachestat(fd uint, crange *CachestatRange, cstat *Cachestat_t, flags uint) (err error) {
+ _, _, e1 := Syscall6(SYS_CACHESTAT, uintptr(fd), uintptr(unsafe.Pointer(crange)), uintptr(unsafe.Pointer(cstat)), uintptr(flags), 0, 0)
+ if e1 != 0 {
+ err = errnoErr(e1)
+ }
+ return
+}
diff --git a/vendor/golang.org/x/sys/unix/zsyscall_linux_386.go b/vendor/golang.org/x/sys/unix/zsyscall_linux_386.go
index 07b549cc..4def3e9f 100644
--- a/vendor/golang.org/x/sys/unix/zsyscall_linux_386.go
+++ b/vendor/golang.org/x/sys/unix/zsyscall_linux_386.go
@@ -2,7 +2,6 @@
// Code generated by the command above; see README.md. DO NOT EDIT.
//go:build linux && 386
-// +build linux,386
package unix
diff --git a/vendor/golang.org/x/sys/unix/zsyscall_linux_amd64.go b/vendor/golang.org/x/sys/unix/zsyscall_linux_amd64.go
index 5f481bf8..fef2bc8b 100644
--- a/vendor/golang.org/x/sys/unix/zsyscall_linux_amd64.go
+++ b/vendor/golang.org/x/sys/unix/zsyscall_linux_amd64.go
@@ -2,7 +2,6 @@
// Code generated by the command above; see README.md. DO NOT EDIT.
//go:build linux && amd64
-// +build linux,amd64
package unix
diff --git a/vendor/golang.org/x/sys/unix/zsyscall_linux_arm.go b/vendor/golang.org/x/sys/unix/zsyscall_linux_arm.go
index 824cd52c..a9fd76a8 100644
--- a/vendor/golang.org/x/sys/unix/zsyscall_linux_arm.go
+++ b/vendor/golang.org/x/sys/unix/zsyscall_linux_arm.go
@@ -2,7 +2,6 @@
// Code generated by the command above; see README.md. DO NOT EDIT.
//go:build linux && arm
-// +build linux,arm
package unix
diff --git a/vendor/golang.org/x/sys/unix/zsyscall_linux_arm64.go b/vendor/golang.org/x/sys/unix/zsyscall_linux_arm64.go
index e77aecfe..46006502 100644
--- a/vendor/golang.org/x/sys/unix/zsyscall_linux_arm64.go
+++ b/vendor/golang.org/x/sys/unix/zsyscall_linux_arm64.go
@@ -2,7 +2,6 @@
// Code generated by the command above; see README.md. DO NOT EDIT.
//go:build linux && arm64
-// +build linux,arm64
package unix
diff --git a/vendor/golang.org/x/sys/unix/zsyscall_linux_loong64.go b/vendor/golang.org/x/sys/unix/zsyscall_linux_loong64.go
index 806ffd1e..c8987d26 100644
--- a/vendor/golang.org/x/sys/unix/zsyscall_linux_loong64.go
+++ b/vendor/golang.org/x/sys/unix/zsyscall_linux_loong64.go
@@ -2,7 +2,6 @@
// Code generated by the command above; see README.md. DO NOT EDIT.
//go:build linux && loong64
-// +build linux,loong64
package unix
diff --git a/vendor/golang.org/x/sys/unix/zsyscall_linux_mips.go b/vendor/golang.org/x/sys/unix/zsyscall_linux_mips.go
index 961a3afb..921f4306 100644
--- a/vendor/golang.org/x/sys/unix/zsyscall_linux_mips.go
+++ b/vendor/golang.org/x/sys/unix/zsyscall_linux_mips.go
@@ -2,7 +2,6 @@
// Code generated by the command above; see README.md. DO NOT EDIT.
//go:build linux && mips
-// +build linux,mips
package unix
diff --git a/vendor/golang.org/x/sys/unix/zsyscall_linux_mips64.go b/vendor/golang.org/x/sys/unix/zsyscall_linux_mips64.go
index ed05005e..44f06782 100644
--- a/vendor/golang.org/x/sys/unix/zsyscall_linux_mips64.go
+++ b/vendor/golang.org/x/sys/unix/zsyscall_linux_mips64.go
@@ -2,7 +2,6 @@
// Code generated by the command above; see README.md. DO NOT EDIT.
//go:build linux && mips64
-// +build linux,mips64
package unix
diff --git a/vendor/golang.org/x/sys/unix/zsyscall_linux_mips64le.go b/vendor/golang.org/x/sys/unix/zsyscall_linux_mips64le.go
index d365b718..e7fa0abf 100644
--- a/vendor/golang.org/x/sys/unix/zsyscall_linux_mips64le.go
+++ b/vendor/golang.org/x/sys/unix/zsyscall_linux_mips64le.go
@@ -2,7 +2,6 @@
// Code generated by the command above; see README.md. DO NOT EDIT.
//go:build linux && mips64le
-// +build linux,mips64le
package unix
diff --git a/vendor/golang.org/x/sys/unix/zsyscall_linux_mipsle.go b/vendor/golang.org/x/sys/unix/zsyscall_linux_mipsle.go
index c3f1b8bb..8c512567 100644
--- a/vendor/golang.org/x/sys/unix/zsyscall_linux_mipsle.go
+++ b/vendor/golang.org/x/sys/unix/zsyscall_linux_mipsle.go
@@ -2,7 +2,6 @@
// Code generated by the command above; see README.md. DO NOT EDIT.
//go:build linux && mipsle
-// +build linux,mipsle
package unix
diff --git a/vendor/golang.org/x/sys/unix/zsyscall_linux_ppc.go b/vendor/golang.org/x/sys/unix/zsyscall_linux_ppc.go
index a6574cf9..7392fd45 100644
--- a/vendor/golang.org/x/sys/unix/zsyscall_linux_ppc.go
+++ b/vendor/golang.org/x/sys/unix/zsyscall_linux_ppc.go
@@ -2,7 +2,6 @@
// Code generated by the command above; see README.md. DO NOT EDIT.
//go:build linux && ppc
-// +build linux,ppc
package unix
diff --git a/vendor/golang.org/x/sys/unix/zsyscall_linux_ppc64.go b/vendor/golang.org/x/sys/unix/zsyscall_linux_ppc64.go
index f4099026..41180434 100644
--- a/vendor/golang.org/x/sys/unix/zsyscall_linux_ppc64.go
+++ b/vendor/golang.org/x/sys/unix/zsyscall_linux_ppc64.go
@@ -2,7 +2,6 @@
// Code generated by the command above; see README.md. DO NOT EDIT.
//go:build linux && ppc64
-// +build linux,ppc64
package unix
diff --git a/vendor/golang.org/x/sys/unix/zsyscall_linux_ppc64le.go b/vendor/golang.org/x/sys/unix/zsyscall_linux_ppc64le.go
index 9dfcc299..40c6ce7a 100644
--- a/vendor/golang.org/x/sys/unix/zsyscall_linux_ppc64le.go
+++ b/vendor/golang.org/x/sys/unix/zsyscall_linux_ppc64le.go
@@ -2,7 +2,6 @@
// Code generated by the command above; see README.md. DO NOT EDIT.
//go:build linux && ppc64le
-// +build linux,ppc64le
package unix
diff --git a/vendor/golang.org/x/sys/unix/zsyscall_linux_riscv64.go b/vendor/golang.org/x/sys/unix/zsyscall_linux_riscv64.go
index 0ab4f2ed..2cfe34ad 100644
--- a/vendor/golang.org/x/sys/unix/zsyscall_linux_riscv64.go
+++ b/vendor/golang.org/x/sys/unix/zsyscall_linux_riscv64.go
@@ -2,7 +2,6 @@
// Code generated by the command above; see README.md. DO NOT EDIT.
//go:build linux && riscv64
-// +build linux,riscv64
package unix
diff --git a/vendor/golang.org/x/sys/unix/zsyscall_linux_s390x.go b/vendor/golang.org/x/sys/unix/zsyscall_linux_s390x.go
index 6cde3223..61e6f070 100644
--- a/vendor/golang.org/x/sys/unix/zsyscall_linux_s390x.go
+++ b/vendor/golang.org/x/sys/unix/zsyscall_linux_s390x.go
@@ -2,7 +2,6 @@
// Code generated by the command above; see README.md. DO NOT EDIT.
//go:build linux && s390x
-// +build linux,s390x
package unix
diff --git a/vendor/golang.org/x/sys/unix/zsyscall_linux_sparc64.go b/vendor/golang.org/x/sys/unix/zsyscall_linux_sparc64.go
index 5253d65b..834b8420 100644
--- a/vendor/golang.org/x/sys/unix/zsyscall_linux_sparc64.go
+++ b/vendor/golang.org/x/sys/unix/zsyscall_linux_sparc64.go
@@ -2,7 +2,6 @@
// Code generated by the command above; see README.md. DO NOT EDIT.
//go:build linux && sparc64
-// +build linux,sparc64
package unix
diff --git a/vendor/golang.org/x/sys/unix/zsyscall_netbsd_386.go b/vendor/golang.org/x/sys/unix/zsyscall_netbsd_386.go
index 35f499b3..e91ebc14 100644
--- a/vendor/golang.org/x/sys/unix/zsyscall_netbsd_386.go
+++ b/vendor/golang.org/x/sys/unix/zsyscall_netbsd_386.go
@@ -2,7 +2,6 @@
// Code generated by the command above; see README.md. DO NOT EDIT.
//go:build netbsd && 386
-// +build netbsd,386
package unix
@@ -1824,28 +1823,6 @@ func munmap(addr uintptr, length uintptr) (err error) {
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
-func readlen(fd int, buf *byte, nbuf int) (n int, err error) {
- r0, _, e1 := Syscall(SYS_READ, uintptr(fd), uintptr(unsafe.Pointer(buf)), uintptr(nbuf))
- n = int(r0)
- if e1 != 0 {
- err = errnoErr(e1)
- }
- return
-}
-
-// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
-
-func writelen(fd int, buf *byte, nbuf int) (n int, err error) {
- r0, _, e1 := Syscall(SYS_WRITE, uintptr(fd), uintptr(unsafe.Pointer(buf)), uintptr(nbuf))
- n = int(r0)
- if e1 != 0 {
- err = errnoErr(e1)
- }
- return
-}
-
-// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
-
func utimensat(dirfd int, path string, times *[2]Timespec, flags int) (err error) {
var _p0 *byte
_p0, err = BytePtrFromString(path)
diff --git a/vendor/golang.org/x/sys/unix/zsyscall_netbsd_amd64.go b/vendor/golang.org/x/sys/unix/zsyscall_netbsd_amd64.go
index 3cda65b0..be28babb 100644
--- a/vendor/golang.org/x/sys/unix/zsyscall_netbsd_amd64.go
+++ b/vendor/golang.org/x/sys/unix/zsyscall_netbsd_amd64.go
@@ -2,7 +2,6 @@
// Code generated by the command above; see README.md. DO NOT EDIT.
//go:build netbsd && amd64
-// +build netbsd,amd64
package unix
@@ -1824,28 +1823,6 @@ func munmap(addr uintptr, length uintptr) (err error) {
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
-func readlen(fd int, buf *byte, nbuf int) (n int, err error) {
- r0, _, e1 := Syscall(SYS_READ, uintptr(fd), uintptr(unsafe.Pointer(buf)), uintptr(nbuf))
- n = int(r0)
- if e1 != 0 {
- err = errnoErr(e1)
- }
- return
-}
-
-// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
-
-func writelen(fd int, buf *byte, nbuf int) (n int, err error) {
- r0, _, e1 := Syscall(SYS_WRITE, uintptr(fd), uintptr(unsafe.Pointer(buf)), uintptr(nbuf))
- n = int(r0)
- if e1 != 0 {
- err = errnoErr(e1)
- }
- return
-}
-
-// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
-
func utimensat(dirfd int, path string, times *[2]Timespec, flags int) (err error) {
var _p0 *byte
_p0, err = BytePtrFromString(path)
diff --git a/vendor/golang.org/x/sys/unix/zsyscall_netbsd_arm.go b/vendor/golang.org/x/sys/unix/zsyscall_netbsd_arm.go
index 1e1fea90..fb587e82 100644
--- a/vendor/golang.org/x/sys/unix/zsyscall_netbsd_arm.go
+++ b/vendor/golang.org/x/sys/unix/zsyscall_netbsd_arm.go
@@ -2,7 +2,6 @@
// Code generated by the command above; see README.md. DO NOT EDIT.
//go:build netbsd && arm
-// +build netbsd,arm
package unix
@@ -1824,28 +1823,6 @@ func munmap(addr uintptr, length uintptr) (err error) {
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
-func readlen(fd int, buf *byte, nbuf int) (n int, err error) {
- r0, _, e1 := Syscall(SYS_READ, uintptr(fd), uintptr(unsafe.Pointer(buf)), uintptr(nbuf))
- n = int(r0)
- if e1 != 0 {
- err = errnoErr(e1)
- }
- return
-}
-
-// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
-
-func writelen(fd int, buf *byte, nbuf int) (n int, err error) {
- r0, _, e1 := Syscall(SYS_WRITE, uintptr(fd), uintptr(unsafe.Pointer(buf)), uintptr(nbuf))
- n = int(r0)
- if e1 != 0 {
- err = errnoErr(e1)
- }
- return
-}
-
-// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
-
func utimensat(dirfd int, path string, times *[2]Timespec, flags int) (err error) {
var _p0 *byte
_p0, err = BytePtrFromString(path)
diff --git a/vendor/golang.org/x/sys/unix/zsyscall_netbsd_arm64.go b/vendor/golang.org/x/sys/unix/zsyscall_netbsd_arm64.go
index 3b77da11..d576438b 100644
--- a/vendor/golang.org/x/sys/unix/zsyscall_netbsd_arm64.go
+++ b/vendor/golang.org/x/sys/unix/zsyscall_netbsd_arm64.go
@@ -2,7 +2,6 @@
// Code generated by the command above; see README.md. DO NOT EDIT.
//go:build netbsd && arm64
-// +build netbsd,arm64
package unix
@@ -1824,28 +1823,6 @@ func munmap(addr uintptr, length uintptr) (err error) {
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
-func readlen(fd int, buf *byte, nbuf int) (n int, err error) {
- r0, _, e1 := Syscall(SYS_READ, uintptr(fd), uintptr(unsafe.Pointer(buf)), uintptr(nbuf))
- n = int(r0)
- if e1 != 0 {
- err = errnoErr(e1)
- }
- return
-}
-
-// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
-
-func writelen(fd int, buf *byte, nbuf int) (n int, err error) {
- r0, _, e1 := Syscall(SYS_WRITE, uintptr(fd), uintptr(unsafe.Pointer(buf)), uintptr(nbuf))
- n = int(r0)
- if e1 != 0 {
- err = errnoErr(e1)
- }
- return
-}
-
-// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
-
func utimensat(dirfd int, path string, times *[2]Timespec, flags int) (err error) {
var _p0 *byte
_p0, err = BytePtrFromString(path)
diff --git a/vendor/golang.org/x/sys/unix/zsyscall_openbsd_386.go b/vendor/golang.org/x/sys/unix/zsyscall_openbsd_386.go
index 9ab9abf7..a1d06159 100644
--- a/vendor/golang.org/x/sys/unix/zsyscall_openbsd_386.go
+++ b/vendor/golang.org/x/sys/unix/zsyscall_openbsd_386.go
@@ -2,7 +2,6 @@
// Code generated by the command above; see README.md. DO NOT EDIT.
//go:build openbsd && 386
-// +build openbsd,386
package unix
@@ -549,6 +548,12 @@ func ioctl(fd int, req uint, arg uintptr) (err error) {
return
}
+var libc_ioctl_trampoline_addr uintptr
+
+//go:cgo_import_dynamic libc_ioctl ioctl "libc.so"
+
+// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
+
func ioctlPtr(fd int, req uint, arg unsafe.Pointer) (err error) {
_, _, e1 := syscall_syscall(libc_ioctl_trampoline_addr, uintptr(fd), uintptr(req), uintptr(arg))
if e1 != 0 {
@@ -557,10 +562,6 @@ func ioctlPtr(fd int, req uint, arg unsafe.Pointer) (err error) {
return
}
-var libc_ioctl_trampoline_addr uintptr
-
-//go:cgo_import_dynamic libc_ioctl ioctl "libc.so"
-
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
func sysctl(mib []_C_int, old *byte, oldlen *uintptr, new *byte, newlen uintptr) (err error) {
@@ -583,6 +584,32 @@ var libc_sysctl_trampoline_addr uintptr
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
+func fcntl(fd int, cmd int, arg int) (n int, err error) {
+ r0, _, e1 := syscall_syscall(libc_fcntl_trampoline_addr, uintptr(fd), uintptr(cmd), uintptr(arg))
+ n = int(r0)
+ if e1 != 0 {
+ err = errnoErr(e1)
+ }
+ return
+}
+
+var libc_fcntl_trampoline_addr uintptr
+
+//go:cgo_import_dynamic libc_fcntl fcntl "libc.so"
+
+// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
+
+func fcntlPtr(fd int, cmd int, arg unsafe.Pointer) (n int, err error) {
+ r0, _, e1 := syscall_syscall(libc_fcntl_trampoline_addr, uintptr(fd), uintptr(cmd), uintptr(arg))
+ n = int(r0)
+ if e1 != 0 {
+ err = errnoErr(e1)
+ }
+ return
+}
+
+// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
+
func ppoll(fds *PollFd, nfds int, timeout *Timespec, sigmask *Sigset_t) (n int, err error) {
r0, _, e1 := syscall_syscall6(libc_ppoll_trampoline_addr, uintptr(unsafe.Pointer(fds)), uintptr(nfds), uintptr(unsafe.Pointer(timeout)), uintptr(unsafe.Pointer(sigmask)), 0, 0)
n = int(r0)
@@ -2211,8 +2238,8 @@ var libc_munmap_trampoline_addr uintptr
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
-func readlen(fd int, buf *byte, nbuf int) (n int, err error) {
- r0, _, e1 := syscall_syscall(libc_read_trampoline_addr, uintptr(fd), uintptr(unsafe.Pointer(buf)), uintptr(nbuf))
+func getfsstat(stat *Statfs_t, bufsize uintptr, flags int) (n int, err error) {
+ r0, _, e1 := syscall_syscall(libc_getfsstat_trampoline_addr, uintptr(unsafe.Pointer(stat)), uintptr(bufsize), uintptr(flags))
n = int(r0)
if e1 != 0 {
err = errnoErr(e1)
@@ -2220,16 +2247,9 @@ func readlen(fd int, buf *byte, nbuf int) (n int, err error) {
return
}
-// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
+var libc_getfsstat_trampoline_addr uintptr
-func writelen(fd int, buf *byte, nbuf int) (n int, err error) {
- r0, _, e1 := syscall_syscall(libc_write_trampoline_addr, uintptr(fd), uintptr(unsafe.Pointer(buf)), uintptr(nbuf))
- n = int(r0)
- if e1 != 0 {
- err = errnoErr(e1)
- }
- return
-}
+//go:cgo_import_dynamic libc_getfsstat getfsstat "libc.so"
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
@@ -2249,3 +2269,33 @@ func utimensat(dirfd int, path string, times *[2]Timespec, flags int) (err error
var libc_utimensat_trampoline_addr uintptr
//go:cgo_import_dynamic libc_utimensat utimensat "libc.so"
+
+// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
+
+func pledge(promises *byte, execpromises *byte) (err error) {
+ _, _, e1 := syscall_syscall(libc_pledge_trampoline_addr, uintptr(unsafe.Pointer(promises)), uintptr(unsafe.Pointer(execpromises)), 0)
+ if e1 != 0 {
+ err = errnoErr(e1)
+ }
+ return
+}
+
+var libc_pledge_trampoline_addr uintptr
+
+//go:cgo_import_dynamic libc_pledge pledge "libc.so"
+
+// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
+
+func unveil(path *byte, flags *byte) (err error) {
+ _, _, e1 := syscall_syscall(libc_unveil_trampoline_addr, uintptr(unsafe.Pointer(path)), uintptr(unsafe.Pointer(flags)), 0)
+ if e1 != 0 {
+ err = errnoErr(e1)
+ }
+ return
+}
+
+var libc_unveil_trampoline_addr uintptr
+
+//go:cgo_import_dynamic libc_unveil unveil "libc.so"
+
+
diff --git a/vendor/golang.org/x/sys/unix/zsyscall_openbsd_386.s b/vendor/golang.org/x/sys/unix/zsyscall_openbsd_386.s
index 3dcacd30..41b56173 100644
--- a/vendor/golang.org/x/sys/unix/zsyscall_openbsd_386.s
+++ b/vendor/golang.org/x/sys/unix/zsyscall_openbsd_386.s
@@ -178,6 +178,11 @@ TEXT libc_sysctl_trampoline<>(SB),NOSPLIT,$0-0
GLOBL ·libc_sysctl_trampoline_addr(SB), RODATA, $4
DATA ·libc_sysctl_trampoline_addr(SB)/4, $libc_sysctl_trampoline<>(SB)
+TEXT libc_fcntl_trampoline<>(SB),NOSPLIT,$0-0
+ JMP libc_fcntl(SB)
+GLOBL ·libc_fcntl_trampoline_addr(SB), RODATA, $4
+DATA ·libc_fcntl_trampoline_addr(SB)/4, $libc_fcntl_trampoline<>(SB)
+
TEXT libc_ppoll_trampoline<>(SB),NOSPLIT,$0-0
JMP libc_ppoll(SB)
GLOBL ·libc_ppoll_trampoline_addr(SB), RODATA, $4
@@ -668,7 +673,22 @@ TEXT libc_munmap_trampoline<>(SB),NOSPLIT,$0-0
GLOBL ·libc_munmap_trampoline_addr(SB), RODATA, $4
DATA ·libc_munmap_trampoline_addr(SB)/4, $libc_munmap_trampoline<>(SB)
+TEXT libc_getfsstat_trampoline<>(SB),NOSPLIT,$0-0
+ JMP libc_getfsstat(SB)
+GLOBL ·libc_getfsstat_trampoline_addr(SB), RODATA, $4
+DATA ·libc_getfsstat_trampoline_addr(SB)/4, $libc_getfsstat_trampoline<>(SB)
+
TEXT libc_utimensat_trampoline<>(SB),NOSPLIT,$0-0
JMP libc_utimensat(SB)
GLOBL ·libc_utimensat_trampoline_addr(SB), RODATA, $4
DATA ·libc_utimensat_trampoline_addr(SB)/4, $libc_utimensat_trampoline<>(SB)
+
+TEXT libc_pledge_trampoline<>(SB),NOSPLIT,$0-0
+ JMP libc_pledge(SB)
+GLOBL ·libc_pledge_trampoline_addr(SB), RODATA, $4
+DATA ·libc_pledge_trampoline_addr(SB)/4, $libc_pledge_trampoline<>(SB)
+
+TEXT libc_unveil_trampoline<>(SB),NOSPLIT,$0-0
+ JMP libc_unveil(SB)
+GLOBL ·libc_unveil_trampoline_addr(SB), RODATA, $4
+DATA ·libc_unveil_trampoline_addr(SB)/4, $libc_unveil_trampoline<>(SB)
diff --git a/vendor/golang.org/x/sys/unix/zsyscall_openbsd_amd64.go b/vendor/golang.org/x/sys/unix/zsyscall_openbsd_amd64.go
index 915761ea..5b2a7409 100644
--- a/vendor/golang.org/x/sys/unix/zsyscall_openbsd_amd64.go
+++ b/vendor/golang.org/x/sys/unix/zsyscall_openbsd_amd64.go
@@ -2,7 +2,6 @@
// Code generated by the command above; see README.md. DO NOT EDIT.
//go:build openbsd && amd64
-// +build openbsd,amd64
package unix
@@ -585,6 +584,32 @@ var libc_sysctl_trampoline_addr uintptr
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
+func fcntl(fd int, cmd int, arg int) (n int, err error) {
+ r0, _, e1 := syscall_syscall(libc_fcntl_trampoline_addr, uintptr(fd), uintptr(cmd), uintptr(arg))
+ n = int(r0)
+ if e1 != 0 {
+ err = errnoErr(e1)
+ }
+ return
+}
+
+var libc_fcntl_trampoline_addr uintptr
+
+//go:cgo_import_dynamic libc_fcntl fcntl "libc.so"
+
+// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
+
+func fcntlPtr(fd int, cmd int, arg unsafe.Pointer) (n int, err error) {
+ r0, _, e1 := syscall_syscall(libc_fcntl_trampoline_addr, uintptr(fd), uintptr(cmd), uintptr(arg))
+ n = int(r0)
+ if e1 != 0 {
+ err = errnoErr(e1)
+ }
+ return
+}
+
+// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
+
func ppoll(fds *PollFd, nfds int, timeout *Timespec, sigmask *Sigset_t) (n int, err error) {
r0, _, e1 := syscall_syscall6(libc_ppoll_trampoline_addr, uintptr(unsafe.Pointer(fds)), uintptr(nfds), uintptr(unsafe.Pointer(timeout)), uintptr(unsafe.Pointer(sigmask)), 0, 0)
n = int(r0)
@@ -2213,8 +2238,8 @@ var libc_munmap_trampoline_addr uintptr
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
-func readlen(fd int, buf *byte, nbuf int) (n int, err error) {
- r0, _, e1 := syscall_syscall(libc_read_trampoline_addr, uintptr(fd), uintptr(unsafe.Pointer(buf)), uintptr(nbuf))
+func getfsstat(stat *Statfs_t, bufsize uintptr, flags int) (n int, err error) {
+ r0, _, e1 := syscall_syscall(libc_getfsstat_trampoline_addr, uintptr(unsafe.Pointer(stat)), uintptr(bufsize), uintptr(flags))
n = int(r0)
if e1 != 0 {
err = errnoErr(e1)
@@ -2222,16 +2247,9 @@ func readlen(fd int, buf *byte, nbuf int) (n int, err error) {
return
}
-// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
+var libc_getfsstat_trampoline_addr uintptr
-func writelen(fd int, buf *byte, nbuf int) (n int, err error) {
- r0, _, e1 := syscall_syscall(libc_write_trampoline_addr, uintptr(fd), uintptr(unsafe.Pointer(buf)), uintptr(nbuf))
- n = int(r0)
- if e1 != 0 {
- err = errnoErr(e1)
- }
- return
-}
+//go:cgo_import_dynamic libc_getfsstat getfsstat "libc.so"
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
@@ -2251,3 +2269,33 @@ func utimensat(dirfd int, path string, times *[2]Timespec, flags int) (err error
var libc_utimensat_trampoline_addr uintptr
//go:cgo_import_dynamic libc_utimensat utimensat "libc.so"
+
+// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
+
+func pledge(promises *byte, execpromises *byte) (err error) {
+ _, _, e1 := syscall_syscall(libc_pledge_trampoline_addr, uintptr(unsafe.Pointer(promises)), uintptr(unsafe.Pointer(execpromises)), 0)
+ if e1 != 0 {
+ err = errnoErr(e1)
+ }
+ return
+}
+
+var libc_pledge_trampoline_addr uintptr
+
+//go:cgo_import_dynamic libc_pledge pledge "libc.so"
+
+// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
+
+func unveil(path *byte, flags *byte) (err error) {
+ _, _, e1 := syscall_syscall(libc_unveil_trampoline_addr, uintptr(unsafe.Pointer(path)), uintptr(unsafe.Pointer(flags)), 0)
+ if e1 != 0 {
+ err = errnoErr(e1)
+ }
+ return
+}
+
+var libc_unveil_trampoline_addr uintptr
+
+//go:cgo_import_dynamic libc_unveil unveil "libc.so"
+
+
diff --git a/vendor/golang.org/x/sys/unix/zsyscall_openbsd_amd64.s b/vendor/golang.org/x/sys/unix/zsyscall_openbsd_amd64.s
index 2763620b..4019a656 100644
--- a/vendor/golang.org/x/sys/unix/zsyscall_openbsd_amd64.s
+++ b/vendor/golang.org/x/sys/unix/zsyscall_openbsd_amd64.s
@@ -178,6 +178,11 @@ TEXT libc_sysctl_trampoline<>(SB),NOSPLIT,$0-0
GLOBL ·libc_sysctl_trampoline_addr(SB), RODATA, $8
DATA ·libc_sysctl_trampoline_addr(SB)/8, $libc_sysctl_trampoline<>(SB)
+TEXT libc_fcntl_trampoline<>(SB),NOSPLIT,$0-0
+ JMP libc_fcntl(SB)
+GLOBL ·libc_fcntl_trampoline_addr(SB), RODATA, $8
+DATA ·libc_fcntl_trampoline_addr(SB)/8, $libc_fcntl_trampoline<>(SB)
+
TEXT libc_ppoll_trampoline<>(SB),NOSPLIT,$0-0
JMP libc_ppoll(SB)
GLOBL ·libc_ppoll_trampoline_addr(SB), RODATA, $8
@@ -668,7 +673,22 @@ TEXT libc_munmap_trampoline<>(SB),NOSPLIT,$0-0
GLOBL ·libc_munmap_trampoline_addr(SB), RODATA, $8
DATA ·libc_munmap_trampoline_addr(SB)/8, $libc_munmap_trampoline<>(SB)
+TEXT libc_getfsstat_trampoline<>(SB),NOSPLIT,$0-0
+ JMP libc_getfsstat(SB)
+GLOBL ·libc_getfsstat_trampoline_addr(SB), RODATA, $8
+DATA ·libc_getfsstat_trampoline_addr(SB)/8, $libc_getfsstat_trampoline<>(SB)
+
TEXT libc_utimensat_trampoline<>(SB),NOSPLIT,$0-0
JMP libc_utimensat(SB)
GLOBL ·libc_utimensat_trampoline_addr(SB), RODATA, $8
DATA ·libc_utimensat_trampoline_addr(SB)/8, $libc_utimensat_trampoline<>(SB)
+
+TEXT libc_pledge_trampoline<>(SB),NOSPLIT,$0-0
+ JMP libc_pledge(SB)
+GLOBL ·libc_pledge_trampoline_addr(SB), RODATA, $8
+DATA ·libc_pledge_trampoline_addr(SB)/8, $libc_pledge_trampoline<>(SB)
+
+TEXT libc_unveil_trampoline<>(SB),NOSPLIT,$0-0
+ JMP libc_unveil(SB)
+GLOBL ·libc_unveil_trampoline_addr(SB), RODATA, $8
+DATA ·libc_unveil_trampoline_addr(SB)/8, $libc_unveil_trampoline<>(SB)
diff --git a/vendor/golang.org/x/sys/unix/zsyscall_openbsd_arm.go b/vendor/golang.org/x/sys/unix/zsyscall_openbsd_arm.go
index 8e87fdf1..f6eda134 100644
--- a/vendor/golang.org/x/sys/unix/zsyscall_openbsd_arm.go
+++ b/vendor/golang.org/x/sys/unix/zsyscall_openbsd_arm.go
@@ -2,7 +2,6 @@
// Code generated by the command above; see README.md. DO NOT EDIT.
//go:build openbsd && arm
-// +build openbsd,arm
package unix
@@ -549,6 +548,12 @@ func ioctl(fd int, req uint, arg uintptr) (err error) {
return
}
+var libc_ioctl_trampoline_addr uintptr
+
+//go:cgo_import_dynamic libc_ioctl ioctl "libc.so"
+
+// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
+
func ioctlPtr(fd int, req uint, arg unsafe.Pointer) (err error) {
_, _, e1 := syscall_syscall(libc_ioctl_trampoline_addr, uintptr(fd), uintptr(req), uintptr(arg))
if e1 != 0 {
@@ -557,10 +562,6 @@ func ioctlPtr(fd int, req uint, arg unsafe.Pointer) (err error) {
return
}
-var libc_ioctl_trampoline_addr uintptr
-
-//go:cgo_import_dynamic libc_ioctl ioctl "libc.so"
-
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
func sysctl(mib []_C_int, old *byte, oldlen *uintptr, new *byte, newlen uintptr) (err error) {
@@ -583,6 +584,32 @@ var libc_sysctl_trampoline_addr uintptr
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
+func fcntl(fd int, cmd int, arg int) (n int, err error) {
+ r0, _, e1 := syscall_syscall(libc_fcntl_trampoline_addr, uintptr(fd), uintptr(cmd), uintptr(arg))
+ n = int(r0)
+ if e1 != 0 {
+ err = errnoErr(e1)
+ }
+ return
+}
+
+var libc_fcntl_trampoline_addr uintptr
+
+//go:cgo_import_dynamic libc_fcntl fcntl "libc.so"
+
+// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
+
+func fcntlPtr(fd int, cmd int, arg unsafe.Pointer) (n int, err error) {
+ r0, _, e1 := syscall_syscall(libc_fcntl_trampoline_addr, uintptr(fd), uintptr(cmd), uintptr(arg))
+ n = int(r0)
+ if e1 != 0 {
+ err = errnoErr(e1)
+ }
+ return
+}
+
+// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
+
func ppoll(fds *PollFd, nfds int, timeout *Timespec, sigmask *Sigset_t) (n int, err error) {
r0, _, e1 := syscall_syscall6(libc_ppoll_trampoline_addr, uintptr(unsafe.Pointer(fds)), uintptr(nfds), uintptr(unsafe.Pointer(timeout)), uintptr(unsafe.Pointer(sigmask)), 0, 0)
n = int(r0)
@@ -2211,8 +2238,8 @@ var libc_munmap_trampoline_addr uintptr
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
-func readlen(fd int, buf *byte, nbuf int) (n int, err error) {
- r0, _, e1 := syscall_syscall(libc_read_trampoline_addr, uintptr(fd), uintptr(unsafe.Pointer(buf)), uintptr(nbuf))
+func getfsstat(stat *Statfs_t, bufsize uintptr, flags int) (n int, err error) {
+ r0, _, e1 := syscall_syscall(libc_getfsstat_trampoline_addr, uintptr(unsafe.Pointer(stat)), uintptr(bufsize), uintptr(flags))
n = int(r0)
if e1 != 0 {
err = errnoErr(e1)
@@ -2220,16 +2247,9 @@ func readlen(fd int, buf *byte, nbuf int) (n int, err error) {
return
}
-// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
+var libc_getfsstat_trampoline_addr uintptr
-func writelen(fd int, buf *byte, nbuf int) (n int, err error) {
- r0, _, e1 := syscall_syscall(libc_write_trampoline_addr, uintptr(fd), uintptr(unsafe.Pointer(buf)), uintptr(nbuf))
- n = int(r0)
- if e1 != 0 {
- err = errnoErr(e1)
- }
- return
-}
+//go:cgo_import_dynamic libc_getfsstat getfsstat "libc.so"
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
@@ -2249,3 +2269,33 @@ func utimensat(dirfd int, path string, times *[2]Timespec, flags int) (err error
var libc_utimensat_trampoline_addr uintptr
//go:cgo_import_dynamic libc_utimensat utimensat "libc.so"
+
+// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
+
+func pledge(promises *byte, execpromises *byte) (err error) {
+ _, _, e1 := syscall_syscall(libc_pledge_trampoline_addr, uintptr(unsafe.Pointer(promises)), uintptr(unsafe.Pointer(execpromises)), 0)
+ if e1 != 0 {
+ err = errnoErr(e1)
+ }
+ return
+}
+
+var libc_pledge_trampoline_addr uintptr
+
+//go:cgo_import_dynamic libc_pledge pledge "libc.so"
+
+// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
+
+func unveil(path *byte, flags *byte) (err error) {
+ _, _, e1 := syscall_syscall(libc_unveil_trampoline_addr, uintptr(unsafe.Pointer(path)), uintptr(unsafe.Pointer(flags)), 0)
+ if e1 != 0 {
+ err = errnoErr(e1)
+ }
+ return
+}
+
+var libc_unveil_trampoline_addr uintptr
+
+//go:cgo_import_dynamic libc_unveil unveil "libc.so"
+
+
diff --git a/vendor/golang.org/x/sys/unix/zsyscall_openbsd_arm.s b/vendor/golang.org/x/sys/unix/zsyscall_openbsd_arm.s
index c9223140..ac4af24f 100644
--- a/vendor/golang.org/x/sys/unix/zsyscall_openbsd_arm.s
+++ b/vendor/golang.org/x/sys/unix/zsyscall_openbsd_arm.s
@@ -178,6 +178,11 @@ TEXT libc_sysctl_trampoline<>(SB),NOSPLIT,$0-0
GLOBL ·libc_sysctl_trampoline_addr(SB), RODATA, $4
DATA ·libc_sysctl_trampoline_addr(SB)/4, $libc_sysctl_trampoline<>(SB)
+TEXT libc_fcntl_trampoline<>(SB),NOSPLIT,$0-0
+ JMP libc_fcntl(SB)
+GLOBL ·libc_fcntl_trampoline_addr(SB), RODATA, $4
+DATA ·libc_fcntl_trampoline_addr(SB)/4, $libc_fcntl_trampoline<>(SB)
+
TEXT libc_ppoll_trampoline<>(SB),NOSPLIT,$0-0
JMP libc_ppoll(SB)
GLOBL ·libc_ppoll_trampoline_addr(SB), RODATA, $4
@@ -668,7 +673,22 @@ TEXT libc_munmap_trampoline<>(SB),NOSPLIT,$0-0
GLOBL ·libc_munmap_trampoline_addr(SB), RODATA, $4
DATA ·libc_munmap_trampoline_addr(SB)/4, $libc_munmap_trampoline<>(SB)
+TEXT libc_getfsstat_trampoline<>(SB),NOSPLIT,$0-0
+ JMP libc_getfsstat(SB)
+GLOBL ·libc_getfsstat_trampoline_addr(SB), RODATA, $4
+DATA ·libc_getfsstat_trampoline_addr(SB)/4, $libc_getfsstat_trampoline<>(SB)
+
TEXT libc_utimensat_trampoline<>(SB),NOSPLIT,$0-0
JMP libc_utimensat(SB)
GLOBL ·libc_utimensat_trampoline_addr(SB), RODATA, $4
DATA ·libc_utimensat_trampoline_addr(SB)/4, $libc_utimensat_trampoline<>(SB)
+
+TEXT libc_pledge_trampoline<>(SB),NOSPLIT,$0-0
+ JMP libc_pledge(SB)
+GLOBL ·libc_pledge_trampoline_addr(SB), RODATA, $4
+DATA ·libc_pledge_trampoline_addr(SB)/4, $libc_pledge_trampoline<>(SB)
+
+TEXT libc_unveil_trampoline<>(SB),NOSPLIT,$0-0
+ JMP libc_unveil(SB)
+GLOBL ·libc_unveil_trampoline_addr(SB), RODATA, $4
+DATA ·libc_unveil_trampoline_addr(SB)/4, $libc_unveil_trampoline<>(SB)
diff --git a/vendor/golang.org/x/sys/unix/zsyscall_openbsd_arm64.go b/vendor/golang.org/x/sys/unix/zsyscall_openbsd_arm64.go
index 12a7a216..55df20ae 100644
--- a/vendor/golang.org/x/sys/unix/zsyscall_openbsd_arm64.go
+++ b/vendor/golang.org/x/sys/unix/zsyscall_openbsd_arm64.go
@@ -2,7 +2,6 @@
// Code generated by the command above; see README.md. DO NOT EDIT.
//go:build openbsd && arm64
-// +build openbsd,arm64
package unix
@@ -549,6 +548,12 @@ func ioctl(fd int, req uint, arg uintptr) (err error) {
return
}
+var libc_ioctl_trampoline_addr uintptr
+
+//go:cgo_import_dynamic libc_ioctl ioctl "libc.so"
+
+// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
+
func ioctlPtr(fd int, req uint, arg unsafe.Pointer) (err error) {
_, _, e1 := syscall_syscall(libc_ioctl_trampoline_addr, uintptr(fd), uintptr(req), uintptr(arg))
if e1 != 0 {
@@ -557,10 +562,6 @@ func ioctlPtr(fd int, req uint, arg unsafe.Pointer) (err error) {
return
}
-var libc_ioctl_trampoline_addr uintptr
-
-//go:cgo_import_dynamic libc_ioctl ioctl "libc.so"
-
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
func sysctl(mib []_C_int, old *byte, oldlen *uintptr, new *byte, newlen uintptr) (err error) {
@@ -583,6 +584,32 @@ var libc_sysctl_trampoline_addr uintptr
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
+func fcntl(fd int, cmd int, arg int) (n int, err error) {
+ r0, _, e1 := syscall_syscall(libc_fcntl_trampoline_addr, uintptr(fd), uintptr(cmd), uintptr(arg))
+ n = int(r0)
+ if e1 != 0 {
+ err = errnoErr(e1)
+ }
+ return
+}
+
+var libc_fcntl_trampoline_addr uintptr
+
+//go:cgo_import_dynamic libc_fcntl fcntl "libc.so"
+
+// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
+
+func fcntlPtr(fd int, cmd int, arg unsafe.Pointer) (n int, err error) {
+ r0, _, e1 := syscall_syscall(libc_fcntl_trampoline_addr, uintptr(fd), uintptr(cmd), uintptr(arg))
+ n = int(r0)
+ if e1 != 0 {
+ err = errnoErr(e1)
+ }
+ return
+}
+
+// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
+
func ppoll(fds *PollFd, nfds int, timeout *Timespec, sigmask *Sigset_t) (n int, err error) {
r0, _, e1 := syscall_syscall6(libc_ppoll_trampoline_addr, uintptr(unsafe.Pointer(fds)), uintptr(nfds), uintptr(unsafe.Pointer(timeout)), uintptr(unsafe.Pointer(sigmask)), 0, 0)
n = int(r0)
@@ -2211,8 +2238,8 @@ var libc_munmap_trampoline_addr uintptr
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
-func readlen(fd int, buf *byte, nbuf int) (n int, err error) {
- r0, _, e1 := syscall_syscall(libc_read_trampoline_addr, uintptr(fd), uintptr(unsafe.Pointer(buf)), uintptr(nbuf))
+func getfsstat(stat *Statfs_t, bufsize uintptr, flags int) (n int, err error) {
+ r0, _, e1 := syscall_syscall(libc_getfsstat_trampoline_addr, uintptr(unsafe.Pointer(stat)), uintptr(bufsize), uintptr(flags))
n = int(r0)
if e1 != 0 {
err = errnoErr(e1)
@@ -2220,16 +2247,9 @@ func readlen(fd int, buf *byte, nbuf int) (n int, err error) {
return
}
-// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
+var libc_getfsstat_trampoline_addr uintptr
-func writelen(fd int, buf *byte, nbuf int) (n int, err error) {
- r0, _, e1 := syscall_syscall(libc_write_trampoline_addr, uintptr(fd), uintptr(unsafe.Pointer(buf)), uintptr(nbuf))
- n = int(r0)
- if e1 != 0 {
- err = errnoErr(e1)
- }
- return
-}
+//go:cgo_import_dynamic libc_getfsstat getfsstat "libc.so"
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
@@ -2249,3 +2269,33 @@ func utimensat(dirfd int, path string, times *[2]Timespec, flags int) (err error
var libc_utimensat_trampoline_addr uintptr
//go:cgo_import_dynamic libc_utimensat utimensat "libc.so"
+
+// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
+
+func pledge(promises *byte, execpromises *byte) (err error) {
+ _, _, e1 := syscall_syscall(libc_pledge_trampoline_addr, uintptr(unsafe.Pointer(promises)), uintptr(unsafe.Pointer(execpromises)), 0)
+ if e1 != 0 {
+ err = errnoErr(e1)
+ }
+ return
+}
+
+var libc_pledge_trampoline_addr uintptr
+
+//go:cgo_import_dynamic libc_pledge pledge "libc.so"
+
+// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
+
+func unveil(path *byte, flags *byte) (err error) {
+ _, _, e1 := syscall_syscall(libc_unveil_trampoline_addr, uintptr(unsafe.Pointer(path)), uintptr(unsafe.Pointer(flags)), 0)
+ if e1 != 0 {
+ err = errnoErr(e1)
+ }
+ return
+}
+
+var libc_unveil_trampoline_addr uintptr
+
+//go:cgo_import_dynamic libc_unveil unveil "libc.so"
+
+
diff --git a/vendor/golang.org/x/sys/unix/zsyscall_openbsd_arm64.s b/vendor/golang.org/x/sys/unix/zsyscall_openbsd_arm64.s
index a6bc32c9..f77d5321 100644
--- a/vendor/golang.org/x/sys/unix/zsyscall_openbsd_arm64.s
+++ b/vendor/golang.org/x/sys/unix/zsyscall_openbsd_arm64.s
@@ -178,6 +178,11 @@ TEXT libc_sysctl_trampoline<>(SB),NOSPLIT,$0-0
GLOBL ·libc_sysctl_trampoline_addr(SB), RODATA, $8
DATA ·libc_sysctl_trampoline_addr(SB)/8, $libc_sysctl_trampoline<>(SB)
+TEXT libc_fcntl_trampoline<>(SB),NOSPLIT,$0-0
+ JMP libc_fcntl(SB)
+GLOBL ·libc_fcntl_trampoline_addr(SB), RODATA, $8
+DATA ·libc_fcntl_trampoline_addr(SB)/8, $libc_fcntl_trampoline<>(SB)
+
TEXT libc_ppoll_trampoline<>(SB),NOSPLIT,$0-0
JMP libc_ppoll(SB)
GLOBL ·libc_ppoll_trampoline_addr(SB), RODATA, $8
@@ -668,7 +673,22 @@ TEXT libc_munmap_trampoline<>(SB),NOSPLIT,$0-0
GLOBL ·libc_munmap_trampoline_addr(SB), RODATA, $8
DATA ·libc_munmap_trampoline_addr(SB)/8, $libc_munmap_trampoline<>(SB)
+TEXT libc_getfsstat_trampoline<>(SB),NOSPLIT,$0-0
+ JMP libc_getfsstat(SB)
+GLOBL ·libc_getfsstat_trampoline_addr(SB), RODATA, $8
+DATA ·libc_getfsstat_trampoline_addr(SB)/8, $libc_getfsstat_trampoline<>(SB)
+
TEXT libc_utimensat_trampoline<>(SB),NOSPLIT,$0-0
JMP libc_utimensat(SB)
GLOBL ·libc_utimensat_trampoline_addr(SB), RODATA, $8
DATA ·libc_utimensat_trampoline_addr(SB)/8, $libc_utimensat_trampoline<>(SB)
+
+TEXT libc_pledge_trampoline<>(SB),NOSPLIT,$0-0
+ JMP libc_pledge(SB)
+GLOBL ·libc_pledge_trampoline_addr(SB), RODATA, $8
+DATA ·libc_pledge_trampoline_addr(SB)/8, $libc_pledge_trampoline<>(SB)
+
+TEXT libc_unveil_trampoline<>(SB),NOSPLIT,$0-0
+ JMP libc_unveil(SB)
+GLOBL ·libc_unveil_trampoline_addr(SB), RODATA, $8
+DATA ·libc_unveil_trampoline_addr(SB)/8, $libc_unveil_trampoline<>(SB)
diff --git a/vendor/golang.org/x/sys/unix/zsyscall_openbsd_mips64.go b/vendor/golang.org/x/sys/unix/zsyscall_openbsd_mips64.go
index b19e8aa0..8c1155cb 100644
--- a/vendor/golang.org/x/sys/unix/zsyscall_openbsd_mips64.go
+++ b/vendor/golang.org/x/sys/unix/zsyscall_openbsd_mips64.go
@@ -2,7 +2,6 @@
// Code generated by the command above; see README.md. DO NOT EDIT.
//go:build openbsd && mips64
-// +build openbsd,mips64
package unix
@@ -549,6 +548,12 @@ func ioctl(fd int, req uint, arg uintptr) (err error) {
return
}
+var libc_ioctl_trampoline_addr uintptr
+
+//go:cgo_import_dynamic libc_ioctl ioctl "libc.so"
+
+// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
+
func ioctlPtr(fd int, req uint, arg unsafe.Pointer) (err error) {
_, _, e1 := syscall_syscall(libc_ioctl_trampoline_addr, uintptr(fd), uintptr(req), uintptr(arg))
if e1 != 0 {
@@ -557,10 +562,6 @@ func ioctlPtr(fd int, req uint, arg unsafe.Pointer) (err error) {
return
}
-var libc_ioctl_trampoline_addr uintptr
-
-//go:cgo_import_dynamic libc_ioctl ioctl "libc.so"
-
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
func sysctl(mib []_C_int, old *byte, oldlen *uintptr, new *byte, newlen uintptr) (err error) {
@@ -583,6 +584,32 @@ var libc_sysctl_trampoline_addr uintptr
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
+func fcntl(fd int, cmd int, arg int) (n int, err error) {
+ r0, _, e1 := syscall_syscall(libc_fcntl_trampoline_addr, uintptr(fd), uintptr(cmd), uintptr(arg))
+ n = int(r0)
+ if e1 != 0 {
+ err = errnoErr(e1)
+ }
+ return
+}
+
+var libc_fcntl_trampoline_addr uintptr
+
+//go:cgo_import_dynamic libc_fcntl fcntl "libc.so"
+
+// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
+
+func fcntlPtr(fd int, cmd int, arg unsafe.Pointer) (n int, err error) {
+ r0, _, e1 := syscall_syscall(libc_fcntl_trampoline_addr, uintptr(fd), uintptr(cmd), uintptr(arg))
+ n = int(r0)
+ if e1 != 0 {
+ err = errnoErr(e1)
+ }
+ return
+}
+
+// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
+
func ppoll(fds *PollFd, nfds int, timeout *Timespec, sigmask *Sigset_t) (n int, err error) {
r0, _, e1 := syscall_syscall6(libc_ppoll_trampoline_addr, uintptr(unsafe.Pointer(fds)), uintptr(nfds), uintptr(unsafe.Pointer(timeout)), uintptr(unsafe.Pointer(sigmask)), 0, 0)
n = int(r0)
@@ -2211,8 +2238,8 @@ var libc_munmap_trampoline_addr uintptr
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
-func readlen(fd int, buf *byte, nbuf int) (n int, err error) {
- r0, _, e1 := syscall_syscall(libc_read_trampoline_addr, uintptr(fd), uintptr(unsafe.Pointer(buf)), uintptr(nbuf))
+func getfsstat(stat *Statfs_t, bufsize uintptr, flags int) (n int, err error) {
+ r0, _, e1 := syscall_syscall(libc_getfsstat_trampoline_addr, uintptr(unsafe.Pointer(stat)), uintptr(bufsize), uintptr(flags))
n = int(r0)
if e1 != 0 {
err = errnoErr(e1)
@@ -2220,16 +2247,9 @@ func readlen(fd int, buf *byte, nbuf int) (n int, err error) {
return
}
-// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
+var libc_getfsstat_trampoline_addr uintptr
-func writelen(fd int, buf *byte, nbuf int) (n int, err error) {
- r0, _, e1 := syscall_syscall(libc_write_trampoline_addr, uintptr(fd), uintptr(unsafe.Pointer(buf)), uintptr(nbuf))
- n = int(r0)
- if e1 != 0 {
- err = errnoErr(e1)
- }
- return
-}
+//go:cgo_import_dynamic libc_getfsstat getfsstat "libc.so"
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
@@ -2249,3 +2269,33 @@ func utimensat(dirfd int, path string, times *[2]Timespec, flags int) (err error
var libc_utimensat_trampoline_addr uintptr
//go:cgo_import_dynamic libc_utimensat utimensat "libc.so"
+
+// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
+
+func pledge(promises *byte, execpromises *byte) (err error) {
+ _, _, e1 := syscall_syscall(libc_pledge_trampoline_addr, uintptr(unsafe.Pointer(promises)), uintptr(unsafe.Pointer(execpromises)), 0)
+ if e1 != 0 {
+ err = errnoErr(e1)
+ }
+ return
+}
+
+var libc_pledge_trampoline_addr uintptr
+
+//go:cgo_import_dynamic libc_pledge pledge "libc.so"
+
+// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
+
+func unveil(path *byte, flags *byte) (err error) {
+ _, _, e1 := syscall_syscall(libc_unveil_trampoline_addr, uintptr(unsafe.Pointer(path)), uintptr(unsafe.Pointer(flags)), 0)
+ if e1 != 0 {
+ err = errnoErr(e1)
+ }
+ return
+}
+
+var libc_unveil_trampoline_addr uintptr
+
+//go:cgo_import_dynamic libc_unveil unveil "libc.so"
+
+
diff --git a/vendor/golang.org/x/sys/unix/zsyscall_openbsd_mips64.s b/vendor/golang.org/x/sys/unix/zsyscall_openbsd_mips64.s
index b4e7bcea..fae140b6 100644
--- a/vendor/golang.org/x/sys/unix/zsyscall_openbsd_mips64.s
+++ b/vendor/golang.org/x/sys/unix/zsyscall_openbsd_mips64.s
@@ -178,6 +178,11 @@ TEXT libc_sysctl_trampoline<>(SB),NOSPLIT,$0-0
GLOBL ·libc_sysctl_trampoline_addr(SB), RODATA, $8
DATA ·libc_sysctl_trampoline_addr(SB)/8, $libc_sysctl_trampoline<>(SB)
+TEXT libc_fcntl_trampoline<>(SB),NOSPLIT,$0-0
+ JMP libc_fcntl(SB)
+GLOBL ·libc_fcntl_trampoline_addr(SB), RODATA, $8
+DATA ·libc_fcntl_trampoline_addr(SB)/8, $libc_fcntl_trampoline<>(SB)
+
TEXT libc_ppoll_trampoline<>(SB),NOSPLIT,$0-0
JMP libc_ppoll(SB)
GLOBL ·libc_ppoll_trampoline_addr(SB), RODATA, $8
@@ -668,7 +673,22 @@ TEXT libc_munmap_trampoline<>(SB),NOSPLIT,$0-0
GLOBL ·libc_munmap_trampoline_addr(SB), RODATA, $8
DATA ·libc_munmap_trampoline_addr(SB)/8, $libc_munmap_trampoline<>(SB)
+TEXT libc_getfsstat_trampoline<>(SB),NOSPLIT,$0-0
+ JMP libc_getfsstat(SB)
+GLOBL ·libc_getfsstat_trampoline_addr(SB), RODATA, $8
+DATA ·libc_getfsstat_trampoline_addr(SB)/8, $libc_getfsstat_trampoline<>(SB)
+
TEXT libc_utimensat_trampoline<>(SB),NOSPLIT,$0-0
JMP libc_utimensat(SB)
GLOBL ·libc_utimensat_trampoline_addr(SB), RODATA, $8
DATA ·libc_utimensat_trampoline_addr(SB)/8, $libc_utimensat_trampoline<>(SB)
+
+TEXT libc_pledge_trampoline<>(SB),NOSPLIT,$0-0
+ JMP libc_pledge(SB)
+GLOBL ·libc_pledge_trampoline_addr(SB), RODATA, $8
+DATA ·libc_pledge_trampoline_addr(SB)/8, $libc_pledge_trampoline<>(SB)
+
+TEXT libc_unveil_trampoline<>(SB),NOSPLIT,$0-0
+ JMP libc_unveil(SB)
+GLOBL ·libc_unveil_trampoline_addr(SB), RODATA, $8
+DATA ·libc_unveil_trampoline_addr(SB)/8, $libc_unveil_trampoline<>(SB)
diff --git a/vendor/golang.org/x/sys/unix/zsyscall_openbsd_ppc64.go b/vendor/golang.org/x/sys/unix/zsyscall_openbsd_ppc64.go
index fb99594c..7cc80c58 100644
--- a/vendor/golang.org/x/sys/unix/zsyscall_openbsd_ppc64.go
+++ b/vendor/golang.org/x/sys/unix/zsyscall_openbsd_ppc64.go
@@ -2,7 +2,6 @@
// Code generated by the command above; see README.md. DO NOT EDIT.
//go:build openbsd && ppc64
-// +build openbsd,ppc64
package unix
@@ -549,6 +548,12 @@ func ioctl(fd int, req uint, arg uintptr) (err error) {
return
}
+var libc_ioctl_trampoline_addr uintptr
+
+//go:cgo_import_dynamic libc_ioctl ioctl "libc.so"
+
+// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
+
func ioctlPtr(fd int, req uint, arg unsafe.Pointer) (err error) {
_, _, e1 := syscall_syscall(libc_ioctl_trampoline_addr, uintptr(fd), uintptr(req), uintptr(arg))
if e1 != 0 {
@@ -557,10 +562,6 @@ func ioctlPtr(fd int, req uint, arg unsafe.Pointer) (err error) {
return
}
-var libc_ioctl_trampoline_addr uintptr
-
-//go:cgo_import_dynamic libc_ioctl ioctl "libc.so"
-
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
func sysctl(mib []_C_int, old *byte, oldlen *uintptr, new *byte, newlen uintptr) (err error) {
@@ -583,6 +584,32 @@ var libc_sysctl_trampoline_addr uintptr
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
+func fcntl(fd int, cmd int, arg int) (n int, err error) {
+ r0, _, e1 := syscall_syscall(libc_fcntl_trampoline_addr, uintptr(fd), uintptr(cmd), uintptr(arg))
+ n = int(r0)
+ if e1 != 0 {
+ err = errnoErr(e1)
+ }
+ return
+}
+
+var libc_fcntl_trampoline_addr uintptr
+
+//go:cgo_import_dynamic libc_fcntl fcntl "libc.so"
+
+// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
+
+func fcntlPtr(fd int, cmd int, arg unsafe.Pointer) (n int, err error) {
+ r0, _, e1 := syscall_syscall(libc_fcntl_trampoline_addr, uintptr(fd), uintptr(cmd), uintptr(arg))
+ n = int(r0)
+ if e1 != 0 {
+ err = errnoErr(e1)
+ }
+ return
+}
+
+// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
+
func ppoll(fds *PollFd, nfds int, timeout *Timespec, sigmask *Sigset_t) (n int, err error) {
r0, _, e1 := syscall_syscall6(libc_ppoll_trampoline_addr, uintptr(unsafe.Pointer(fds)), uintptr(nfds), uintptr(unsafe.Pointer(timeout)), uintptr(unsafe.Pointer(sigmask)), 0, 0)
n = int(r0)
@@ -2211,8 +2238,8 @@ var libc_munmap_trampoline_addr uintptr
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
-func readlen(fd int, buf *byte, nbuf int) (n int, err error) {
- r0, _, e1 := syscall_syscall(libc_read_trampoline_addr, uintptr(fd), uintptr(unsafe.Pointer(buf)), uintptr(nbuf))
+func getfsstat(stat *Statfs_t, bufsize uintptr, flags int) (n int, err error) {
+ r0, _, e1 := syscall_syscall(libc_getfsstat_trampoline_addr, uintptr(unsafe.Pointer(stat)), uintptr(bufsize), uintptr(flags))
n = int(r0)
if e1 != 0 {
err = errnoErr(e1)
@@ -2220,16 +2247,9 @@ func readlen(fd int, buf *byte, nbuf int) (n int, err error) {
return
}
-// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
+var libc_getfsstat_trampoline_addr uintptr
-func writelen(fd int, buf *byte, nbuf int) (n int, err error) {
- r0, _, e1 := syscall_syscall(libc_write_trampoline_addr, uintptr(fd), uintptr(unsafe.Pointer(buf)), uintptr(nbuf))
- n = int(r0)
- if e1 != 0 {
- err = errnoErr(e1)
- }
- return
-}
+//go:cgo_import_dynamic libc_getfsstat getfsstat "libc.so"
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
@@ -2249,3 +2269,33 @@ func utimensat(dirfd int, path string, times *[2]Timespec, flags int) (err error
var libc_utimensat_trampoline_addr uintptr
//go:cgo_import_dynamic libc_utimensat utimensat "libc.so"
+
+// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
+
+func pledge(promises *byte, execpromises *byte) (err error) {
+ _, _, e1 := syscall_syscall(libc_pledge_trampoline_addr, uintptr(unsafe.Pointer(promises)), uintptr(unsafe.Pointer(execpromises)), 0)
+ if e1 != 0 {
+ err = errnoErr(e1)
+ }
+ return
+}
+
+var libc_pledge_trampoline_addr uintptr
+
+//go:cgo_import_dynamic libc_pledge pledge "libc.so"
+
+// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
+
+func unveil(path *byte, flags *byte) (err error) {
+ _, _, e1 := syscall_syscall(libc_unveil_trampoline_addr, uintptr(unsafe.Pointer(path)), uintptr(unsafe.Pointer(flags)), 0)
+ if e1 != 0 {
+ err = errnoErr(e1)
+ }
+ return
+}
+
+var libc_unveil_trampoline_addr uintptr
+
+//go:cgo_import_dynamic libc_unveil unveil "libc.so"
+
+
diff --git a/vendor/golang.org/x/sys/unix/zsyscall_openbsd_ppc64.s b/vendor/golang.org/x/sys/unix/zsyscall_openbsd_ppc64.s
index ca3f7660..9d1e0ff0 100644
--- a/vendor/golang.org/x/sys/unix/zsyscall_openbsd_ppc64.s
+++ b/vendor/golang.org/x/sys/unix/zsyscall_openbsd_ppc64.s
@@ -213,6 +213,12 @@ TEXT libc_sysctl_trampoline<>(SB),NOSPLIT,$0-0
GLOBL ·libc_sysctl_trampoline_addr(SB), RODATA, $8
DATA ·libc_sysctl_trampoline_addr(SB)/8, $libc_sysctl_trampoline<>(SB)
+TEXT libc_fcntl_trampoline<>(SB),NOSPLIT,$0-0
+ CALL libc_fcntl(SB)
+ RET
+GLOBL ·libc_fcntl_trampoline_addr(SB), RODATA, $8
+DATA ·libc_fcntl_trampoline_addr(SB)/8, $libc_fcntl_trampoline<>(SB)
+
TEXT libc_ppoll_trampoline<>(SB),NOSPLIT,$0-0
CALL libc_ppoll(SB)
RET
@@ -801,8 +807,26 @@ TEXT libc_munmap_trampoline<>(SB),NOSPLIT,$0-0
GLOBL ·libc_munmap_trampoline_addr(SB), RODATA, $8
DATA ·libc_munmap_trampoline_addr(SB)/8, $libc_munmap_trampoline<>(SB)
+TEXT libc_getfsstat_trampoline<>(SB),NOSPLIT,$0-0
+ CALL libc_getfsstat(SB)
+ RET
+GLOBL ·libc_getfsstat_trampoline_addr(SB), RODATA, $8
+DATA ·libc_getfsstat_trampoline_addr(SB)/8, $libc_getfsstat_trampoline<>(SB)
+
TEXT libc_utimensat_trampoline<>(SB),NOSPLIT,$0-0
CALL libc_utimensat(SB)
RET
GLOBL ·libc_utimensat_trampoline_addr(SB), RODATA, $8
DATA ·libc_utimensat_trampoline_addr(SB)/8, $libc_utimensat_trampoline<>(SB)
+
+TEXT libc_pledge_trampoline<>(SB),NOSPLIT,$0-0
+ CALL libc_pledge(SB)
+ RET
+GLOBL ·libc_pledge_trampoline_addr(SB), RODATA, $8
+DATA ·libc_pledge_trampoline_addr(SB)/8, $libc_pledge_trampoline<>(SB)
+
+TEXT libc_unveil_trampoline<>(SB),NOSPLIT,$0-0
+ CALL libc_unveil(SB)
+ RET
+GLOBL ·libc_unveil_trampoline_addr(SB), RODATA, $8
+DATA ·libc_unveil_trampoline_addr(SB)/8, $libc_unveil_trampoline<>(SB)
diff --git a/vendor/golang.org/x/sys/unix/zsyscall_openbsd_riscv64.go b/vendor/golang.org/x/sys/unix/zsyscall_openbsd_riscv64.go
index 32cbbbc5..0688737f 100644
--- a/vendor/golang.org/x/sys/unix/zsyscall_openbsd_riscv64.go
+++ b/vendor/golang.org/x/sys/unix/zsyscall_openbsd_riscv64.go
@@ -2,7 +2,6 @@
// Code generated by the command above; see README.md. DO NOT EDIT.
//go:build openbsd && riscv64
-// +build openbsd,riscv64
package unix
@@ -549,6 +548,12 @@ func ioctl(fd int, req uint, arg uintptr) (err error) {
return
}
+var libc_ioctl_trampoline_addr uintptr
+
+//go:cgo_import_dynamic libc_ioctl ioctl "libc.so"
+
+// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
+
func ioctlPtr(fd int, req uint, arg unsafe.Pointer) (err error) {
_, _, e1 := syscall_syscall(libc_ioctl_trampoline_addr, uintptr(fd), uintptr(req), uintptr(arg))
if e1 != 0 {
@@ -557,10 +562,6 @@ func ioctlPtr(fd int, req uint, arg unsafe.Pointer) (err error) {
return
}
-var libc_ioctl_trampoline_addr uintptr
-
-//go:cgo_import_dynamic libc_ioctl ioctl "libc.so"
-
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
func sysctl(mib []_C_int, old *byte, oldlen *uintptr, new *byte, newlen uintptr) (err error) {
@@ -583,6 +584,32 @@ var libc_sysctl_trampoline_addr uintptr
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
+func fcntl(fd int, cmd int, arg int) (n int, err error) {
+ r0, _, e1 := syscall_syscall(libc_fcntl_trampoline_addr, uintptr(fd), uintptr(cmd), uintptr(arg))
+ n = int(r0)
+ if e1 != 0 {
+ err = errnoErr(e1)
+ }
+ return
+}
+
+var libc_fcntl_trampoline_addr uintptr
+
+//go:cgo_import_dynamic libc_fcntl fcntl "libc.so"
+
+// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
+
+func fcntlPtr(fd int, cmd int, arg unsafe.Pointer) (n int, err error) {
+ r0, _, e1 := syscall_syscall(libc_fcntl_trampoline_addr, uintptr(fd), uintptr(cmd), uintptr(arg))
+ n = int(r0)
+ if e1 != 0 {
+ err = errnoErr(e1)
+ }
+ return
+}
+
+// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
+
func ppoll(fds *PollFd, nfds int, timeout *Timespec, sigmask *Sigset_t) (n int, err error) {
r0, _, e1 := syscall_syscall6(libc_ppoll_trampoline_addr, uintptr(unsafe.Pointer(fds)), uintptr(nfds), uintptr(unsafe.Pointer(timeout)), uintptr(unsafe.Pointer(sigmask)), 0, 0)
n = int(r0)
@@ -2211,8 +2238,8 @@ var libc_munmap_trampoline_addr uintptr
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
-func readlen(fd int, buf *byte, nbuf int) (n int, err error) {
- r0, _, e1 := syscall_syscall(libc_read_trampoline_addr, uintptr(fd), uintptr(unsafe.Pointer(buf)), uintptr(nbuf))
+func getfsstat(stat *Statfs_t, bufsize uintptr, flags int) (n int, err error) {
+ r0, _, e1 := syscall_syscall(libc_getfsstat_trampoline_addr, uintptr(unsafe.Pointer(stat)), uintptr(bufsize), uintptr(flags))
n = int(r0)
if e1 != 0 {
err = errnoErr(e1)
@@ -2220,16 +2247,9 @@ func readlen(fd int, buf *byte, nbuf int) (n int, err error) {
return
}
-// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
+var libc_getfsstat_trampoline_addr uintptr
-func writelen(fd int, buf *byte, nbuf int) (n int, err error) {
- r0, _, e1 := syscall_syscall(libc_write_trampoline_addr, uintptr(fd), uintptr(unsafe.Pointer(buf)), uintptr(nbuf))
- n = int(r0)
- if e1 != 0 {
- err = errnoErr(e1)
- }
- return
-}
+//go:cgo_import_dynamic libc_getfsstat getfsstat "libc.so"
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
@@ -2249,3 +2269,33 @@ func utimensat(dirfd int, path string, times *[2]Timespec, flags int) (err error
var libc_utimensat_trampoline_addr uintptr
//go:cgo_import_dynamic libc_utimensat utimensat "libc.so"
+
+// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
+
+func pledge(promises *byte, execpromises *byte) (err error) {
+ _, _, e1 := syscall_syscall(libc_pledge_trampoline_addr, uintptr(unsafe.Pointer(promises)), uintptr(unsafe.Pointer(execpromises)), 0)
+ if e1 != 0 {
+ err = errnoErr(e1)
+ }
+ return
+}
+
+var libc_pledge_trampoline_addr uintptr
+
+//go:cgo_import_dynamic libc_pledge pledge "libc.so"
+
+// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
+
+func unveil(path *byte, flags *byte) (err error) {
+ _, _, e1 := syscall_syscall(libc_unveil_trampoline_addr, uintptr(unsafe.Pointer(path)), uintptr(unsafe.Pointer(flags)), 0)
+ if e1 != 0 {
+ err = errnoErr(e1)
+ }
+ return
+}
+
+var libc_unveil_trampoline_addr uintptr
+
+//go:cgo_import_dynamic libc_unveil unveil "libc.so"
+
+
diff --git a/vendor/golang.org/x/sys/unix/zsyscall_openbsd_riscv64.s b/vendor/golang.org/x/sys/unix/zsyscall_openbsd_riscv64.s
index 477a7d5b..da115f9a 100644
--- a/vendor/golang.org/x/sys/unix/zsyscall_openbsd_riscv64.s
+++ b/vendor/golang.org/x/sys/unix/zsyscall_openbsd_riscv64.s
@@ -178,6 +178,11 @@ TEXT libc_sysctl_trampoline<>(SB),NOSPLIT,$0-0
GLOBL ·libc_sysctl_trampoline_addr(SB), RODATA, $8
DATA ·libc_sysctl_trampoline_addr(SB)/8, $libc_sysctl_trampoline<>(SB)
+TEXT libc_fcntl_trampoline<>(SB),NOSPLIT,$0-0
+ JMP libc_fcntl(SB)
+GLOBL ·libc_fcntl_trampoline_addr(SB), RODATA, $8
+DATA ·libc_fcntl_trampoline_addr(SB)/8, $libc_fcntl_trampoline<>(SB)
+
TEXT libc_ppoll_trampoline<>(SB),NOSPLIT,$0-0
JMP libc_ppoll(SB)
GLOBL ·libc_ppoll_trampoline_addr(SB), RODATA, $8
@@ -668,7 +673,22 @@ TEXT libc_munmap_trampoline<>(SB),NOSPLIT,$0-0
GLOBL ·libc_munmap_trampoline_addr(SB), RODATA, $8
DATA ·libc_munmap_trampoline_addr(SB)/8, $libc_munmap_trampoline<>(SB)
+TEXT libc_getfsstat_trampoline<>(SB),NOSPLIT,$0-0
+ JMP libc_getfsstat(SB)
+GLOBL ·libc_getfsstat_trampoline_addr(SB), RODATA, $8
+DATA ·libc_getfsstat_trampoline_addr(SB)/8, $libc_getfsstat_trampoline<>(SB)
+
TEXT libc_utimensat_trampoline<>(SB),NOSPLIT,$0-0
JMP libc_utimensat(SB)
GLOBL ·libc_utimensat_trampoline_addr(SB), RODATA, $8
DATA ·libc_utimensat_trampoline_addr(SB)/8, $libc_utimensat_trampoline<>(SB)
+
+TEXT libc_pledge_trampoline<>(SB),NOSPLIT,$0-0
+ JMP libc_pledge(SB)
+GLOBL ·libc_pledge_trampoline_addr(SB), RODATA, $8
+DATA ·libc_pledge_trampoline_addr(SB)/8, $libc_pledge_trampoline<>(SB)
+
+TEXT libc_unveil_trampoline<>(SB),NOSPLIT,$0-0
+ JMP libc_unveil(SB)
+GLOBL ·libc_unveil_trampoline_addr(SB), RODATA, $8
+DATA ·libc_unveil_trampoline_addr(SB)/8, $libc_unveil_trampoline<>(SB)
diff --git a/vendor/golang.org/x/sys/unix/zsyscall_solaris_amd64.go b/vendor/golang.org/x/sys/unix/zsyscall_solaris_amd64.go
index 609d1c59..829b87fe 100644
--- a/vendor/golang.org/x/sys/unix/zsyscall_solaris_amd64.go
+++ b/vendor/golang.org/x/sys/unix/zsyscall_solaris_amd64.go
@@ -2,7 +2,6 @@
// Code generated by the command above; see README.md. DO NOT EDIT.
//go:build solaris && amd64
-// +build solaris,amd64
package unix
@@ -436,7 +435,7 @@ func pipe(p *[2]_C_int) (n int, err error) {
r0, _, e1 := rawSysvicall6(uintptr(unsafe.Pointer(&procpipe)), 1, uintptr(unsafe.Pointer(p)), 0, 0, 0, 0, 0)
n = int(r0)
if e1 != 0 {
- err = e1
+ err = errnoErr(e1)
}
return
}
@@ -446,7 +445,7 @@ func pipe(p *[2]_C_int) (n int, err error) {
func pipe2(p *[2]_C_int, flags int) (err error) {
_, _, e1 := rawSysvicall6(uintptr(unsafe.Pointer(&procpipe2)), 2, uintptr(unsafe.Pointer(p)), uintptr(flags), 0, 0, 0, 0)
if e1 != 0 {
- err = e1
+ err = errnoErr(e1)
}
return
}
@@ -456,7 +455,7 @@ func pipe2(p *[2]_C_int, flags int) (err error) {
func getsockname(fd int, rsa *RawSockaddrAny, addrlen *_Socklen) (err error) {
_, _, e1 := sysvicall6(uintptr(unsafe.Pointer(&procgetsockname)), 3, uintptr(fd), uintptr(unsafe.Pointer(rsa)), uintptr(unsafe.Pointer(addrlen)), 0, 0, 0)
if e1 != 0 {
- err = e1
+ err = errnoErr(e1)
}
return
}
@@ -471,7 +470,7 @@ func Getcwd(buf []byte) (n int, err error) {
r0, _, e1 := sysvicall6(uintptr(unsafe.Pointer(&procGetcwd)), 2, uintptr(unsafe.Pointer(_p0)), uintptr(len(buf)), 0, 0, 0, 0)
n = int(r0)
if e1 != 0 {
- err = e1
+ err = errnoErr(e1)
}
return
}
@@ -482,7 +481,7 @@ func getgroups(ngid int, gid *_Gid_t) (n int, err error) {
r0, _, e1 := rawSysvicall6(uintptr(unsafe.Pointer(&procgetgroups)), 2, uintptr(ngid), uintptr(unsafe.Pointer(gid)), 0, 0, 0, 0)
n = int(r0)
if e1 != 0 {
- err = e1
+ err = errnoErr(e1)
}
return
}
@@ -492,7 +491,7 @@ func getgroups(ngid int, gid *_Gid_t) (n int, err error) {
func setgroups(ngid int, gid *_Gid_t) (err error) {
_, _, e1 := rawSysvicall6(uintptr(unsafe.Pointer(&procsetgroups)), 2, uintptr(ngid), uintptr(unsafe.Pointer(gid)), 0, 0, 0, 0)
if e1 != 0 {
- err = e1
+ err = errnoErr(e1)
}
return
}
@@ -503,7 +502,7 @@ func wait4(pid int32, statusp *_C_int, options int, rusage *Rusage) (wpid int32,
r0, _, e1 := sysvicall6(uintptr(unsafe.Pointer(&procwait4)), 4, uintptr(pid), uintptr(unsafe.Pointer(statusp)), uintptr(options), uintptr(unsafe.Pointer(rusage)), 0, 0)
wpid = int32(r0)
if e1 != 0 {
- err = e1
+ err = errnoErr(e1)
}
return
}
@@ -518,7 +517,7 @@ func gethostname(buf []byte) (n int, err error) {
r0, _, e1 := sysvicall6(uintptr(unsafe.Pointer(&procgethostname)), 2, uintptr(unsafe.Pointer(_p0)), uintptr(len(buf)), 0, 0, 0, 0)
n = int(r0)
if e1 != 0 {
- err = e1
+ err = errnoErr(e1)
}
return
}
@@ -533,7 +532,7 @@ func utimes(path string, times *[2]Timeval) (err error) {
}
_, _, e1 := sysvicall6(uintptr(unsafe.Pointer(&procutimes)), 2, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(times)), 0, 0, 0, 0)
if e1 != 0 {
- err = e1
+ err = errnoErr(e1)
}
return
}
@@ -548,7 +547,7 @@ func utimensat(fd int, path string, times *[2]Timespec, flag int) (err error) {
}
_, _, e1 := sysvicall6(uintptr(unsafe.Pointer(&procutimensat)), 4, uintptr(fd), uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(times)), uintptr(flag), 0, 0)
if e1 != 0 {
- err = e1
+ err = errnoErr(e1)
}
return
}
@@ -559,7 +558,7 @@ func fcntl(fd int, cmd int, arg int) (val int, err error) {
r0, _, e1 := sysvicall6(uintptr(unsafe.Pointer(&procfcntl)), 3, uintptr(fd), uintptr(cmd), uintptr(arg), 0, 0, 0)
val = int(r0)
if e1 != 0 {
- err = e1
+ err = errnoErr(e1)
}
return
}
@@ -569,7 +568,7 @@ func fcntl(fd int, cmd int, arg int) (val int, err error) {
func futimesat(fildes int, path *byte, times *[2]Timeval) (err error) {
_, _, e1 := sysvicall6(uintptr(unsafe.Pointer(&procfutimesat)), 3, uintptr(fildes), uintptr(unsafe.Pointer(path)), uintptr(unsafe.Pointer(times)), 0, 0, 0)
if e1 != 0 {
- err = e1
+ err = errnoErr(e1)
}
return
}
@@ -580,7 +579,7 @@ func accept(s int, rsa *RawSockaddrAny, addrlen *_Socklen) (fd int, err error) {
r0, _, e1 := sysvicall6(uintptr(unsafe.Pointer(&procaccept)), 3, uintptr(s), uintptr(unsafe.Pointer(rsa)), uintptr(unsafe.Pointer(addrlen)), 0, 0, 0)
fd = int(r0)
if e1 != 0 {
- err = e1
+ err = errnoErr(e1)
}
return
}
@@ -591,7 +590,7 @@ func recvmsg(s int, msg *Msghdr, flags int) (n int, err error) {
r0, _, e1 := sysvicall6(uintptr(unsafe.Pointer(&proc__xnet_recvmsg)), 3, uintptr(s), uintptr(unsafe.Pointer(msg)), uintptr(flags), 0, 0, 0)
n = int(r0)
if e1 != 0 {
- err = e1
+ err = errnoErr(e1)
}
return
}
@@ -602,7 +601,7 @@ func sendmsg(s int, msg *Msghdr, flags int) (n int, err error) {
r0, _, e1 := sysvicall6(uintptr(unsafe.Pointer(&proc__xnet_sendmsg)), 3, uintptr(s), uintptr(unsafe.Pointer(msg)), uintptr(flags), 0, 0, 0)
n = int(r0)
if e1 != 0 {
- err = e1
+ err = errnoErr(e1)
}
return
}
@@ -612,7 +611,7 @@ func sendmsg(s int, msg *Msghdr, flags int) (n int, err error) {
func acct(path *byte) (err error) {
_, _, e1 := sysvicall6(uintptr(unsafe.Pointer(&procacct)), 1, uintptr(unsafe.Pointer(path)), 0, 0, 0, 0, 0)
if e1 != 0 {
- err = e1
+ err = errnoErr(e1)
}
return
}
@@ -647,7 +646,7 @@ func ioctlRet(fd int, req int, arg uintptr) (ret int, err error) {
r0, _, e1 := sysvicall6(uintptr(unsafe.Pointer(&procioctl)), 3, uintptr(fd), uintptr(req), uintptr(arg), 0, 0, 0)
ret = int(r0)
if e1 != 0 {
- err = e1
+ err = errnoErr(e1)
}
return
}
@@ -658,7 +657,7 @@ func ioctlPtrRet(fd int, req int, arg unsafe.Pointer) (ret int, err error) {
r0, _, e1 := sysvicall6(uintptr(unsafe.Pointer(&procioctl)), 3, uintptr(fd), uintptr(req), uintptr(arg), 0, 0, 0)
ret = int(r0)
if e1 != 0 {
- err = e1
+ err = errnoErr(e1)
}
return
}
@@ -669,7 +668,7 @@ func poll(fds *PollFd, nfds int, timeout int) (n int, err error) {
r0, _, e1 := sysvicall6(uintptr(unsafe.Pointer(&procpoll)), 3, uintptr(unsafe.Pointer(fds)), uintptr(nfds), uintptr(timeout), 0, 0, 0)
n = int(r0)
if e1 != 0 {
- err = e1
+ err = errnoErr(e1)
}
return
}
@@ -684,7 +683,7 @@ func Access(path string, mode uint32) (err error) {
}
_, _, e1 := sysvicall6(uintptr(unsafe.Pointer(&procAccess)), 2, uintptr(unsafe.Pointer(_p0)), uintptr(mode), 0, 0, 0, 0)
if e1 != 0 {
- err = e1
+ err = errnoErr(e1)
}
return
}
@@ -694,7 +693,7 @@ func Access(path string, mode uint32) (err error) {
func Adjtime(delta *Timeval, olddelta *Timeval) (err error) {
_, _, e1 := sysvicall6(uintptr(unsafe.Pointer(&procAdjtime)), 2, uintptr(unsafe.Pointer(delta)), uintptr(unsafe.Pointer(olddelta)), 0, 0, 0, 0)
if e1 != 0 {
- err = e1
+ err = errnoErr(e1)
}
return
}
@@ -709,7 +708,7 @@ func Chdir(path string) (err error) {
}
_, _, e1 := sysvicall6(uintptr(unsafe.Pointer(&procChdir)), 1, uintptr(unsafe.Pointer(_p0)), 0, 0, 0, 0, 0)
if e1 != 0 {
- err = e1
+ err = errnoErr(e1)
}
return
}
@@ -724,7 +723,7 @@ func Chmod(path string, mode uint32) (err error) {
}
_, _, e1 := sysvicall6(uintptr(unsafe.Pointer(&procChmod)), 2, uintptr(unsafe.Pointer(_p0)), uintptr(mode), 0, 0, 0, 0)
if e1 != 0 {
- err = e1
+ err = errnoErr(e1)
}
return
}
@@ -739,7 +738,7 @@ func Chown(path string, uid int, gid int) (err error) {
}
_, _, e1 := sysvicall6(uintptr(unsafe.Pointer(&procChown)), 3, uintptr(unsafe.Pointer(_p0)), uintptr(uid), uintptr(gid), 0, 0, 0)
if e1 != 0 {
- err = e1
+ err = errnoErr(e1)
}
return
}
@@ -754,7 +753,7 @@ func Chroot(path string) (err error) {
}
_, _, e1 := sysvicall6(uintptr(unsafe.Pointer(&procChroot)), 1, uintptr(unsafe.Pointer(_p0)), 0, 0, 0, 0, 0)
if e1 != 0 {
- err = e1
+ err = errnoErr(e1)
}
return
}
@@ -764,7 +763,7 @@ func Chroot(path string) (err error) {
func ClockGettime(clockid int32, time *Timespec) (err error) {
_, _, e1 := sysvicall6(uintptr(unsafe.Pointer(&procClockGettime)), 2, uintptr(clockid), uintptr(unsafe.Pointer(time)), 0, 0, 0, 0)
if e1 != 0 {
- err = e1
+ err = errnoErr(e1)
}
return
}
@@ -774,7 +773,7 @@ func ClockGettime(clockid int32, time *Timespec) (err error) {
func Close(fd int) (err error) {
_, _, e1 := sysvicall6(uintptr(unsafe.Pointer(&procClose)), 1, uintptr(fd), 0, 0, 0, 0, 0)
if e1 != 0 {
- err = e1
+ err = errnoErr(e1)
}
return
}
@@ -790,7 +789,7 @@ func Creat(path string, mode uint32) (fd int, err error) {
r0, _, e1 := sysvicall6(uintptr(unsafe.Pointer(&procCreat)), 2, uintptr(unsafe.Pointer(_p0)), uintptr(mode), 0, 0, 0, 0)
fd = int(r0)
if e1 != 0 {
- err = e1
+ err = errnoErr(e1)
}
return
}
@@ -801,7 +800,7 @@ func Dup(fd int) (nfd int, err error) {
r0, _, e1 := sysvicall6(uintptr(unsafe.Pointer(&procDup)), 1, uintptr(fd), 0, 0, 0, 0, 0)
nfd = int(r0)
if e1 != 0 {
- err = e1
+ err = errnoErr(e1)
}
return
}
@@ -811,7 +810,7 @@ func Dup(fd int) (nfd int, err error) {
func Dup2(oldfd int, newfd int) (err error) {
_, _, e1 := sysvicall6(uintptr(unsafe.Pointer(&procDup2)), 2, uintptr(oldfd), uintptr(newfd), 0, 0, 0, 0)
if e1 != 0 {
- err = e1
+ err = errnoErr(e1)
}
return
}
@@ -833,7 +832,7 @@ func Faccessat(dirfd int, path string, mode uint32, flags int) (err error) {
}
_, _, e1 := sysvicall6(uintptr(unsafe.Pointer(&procFaccessat)), 4, uintptr(dirfd), uintptr(unsafe.Pointer(_p0)), uintptr(mode), uintptr(flags), 0, 0)
if e1 != 0 {
- err = e1
+ err = errnoErr(e1)
}
return
}
@@ -843,7 +842,7 @@ func Faccessat(dirfd int, path string, mode uint32, flags int) (err error) {
func Fchdir(fd int) (err error) {
_, _, e1 := sysvicall6(uintptr(unsafe.Pointer(&procFchdir)), 1, uintptr(fd), 0, 0, 0, 0, 0)
if e1 != 0 {
- err = e1
+ err = errnoErr(e1)
}
return
}
@@ -853,7 +852,7 @@ func Fchdir(fd int) (err error) {
func Fchmod(fd int, mode uint32) (err error) {
_, _, e1 := sysvicall6(uintptr(unsafe.Pointer(&procFchmod)), 2, uintptr(fd), uintptr(mode), 0, 0, 0, 0)
if e1 != 0 {
- err = e1
+ err = errnoErr(e1)
}
return
}
@@ -868,7 +867,7 @@ func Fchmodat(dirfd int, path string, mode uint32, flags int) (err error) {
}
_, _, e1 := sysvicall6(uintptr(unsafe.Pointer(&procFchmodat)), 4, uintptr(dirfd), uintptr(unsafe.Pointer(_p0)), uintptr(mode), uintptr(flags), 0, 0)
if e1 != 0 {
- err = e1
+ err = errnoErr(e1)
}
return
}
@@ -878,7 +877,7 @@ func Fchmodat(dirfd int, path string, mode uint32, flags int) (err error) {
func Fchown(fd int, uid int, gid int) (err error) {
_, _, e1 := sysvicall6(uintptr(unsafe.Pointer(&procFchown)), 3, uintptr(fd), uintptr(uid), uintptr(gid), 0, 0, 0)
if e1 != 0 {
- err = e1
+ err = errnoErr(e1)
}
return
}
@@ -893,7 +892,7 @@ func Fchownat(dirfd int, path string, uid int, gid int, flags int) (err error) {
}
_, _, e1 := sysvicall6(uintptr(unsafe.Pointer(&procFchownat)), 5, uintptr(dirfd), uintptr(unsafe.Pointer(_p0)), uintptr(uid), uintptr(gid), uintptr(flags), 0)
if e1 != 0 {
- err = e1
+ err = errnoErr(e1)
}
return
}
@@ -903,7 +902,7 @@ func Fchownat(dirfd int, path string, uid int, gid int, flags int) (err error) {
func Fdatasync(fd int) (err error) {
_, _, e1 := sysvicall6(uintptr(unsafe.Pointer(&procFdatasync)), 1, uintptr(fd), 0, 0, 0, 0, 0)
if e1 != 0 {
- err = e1
+ err = errnoErr(e1)
}
return
}
@@ -913,7 +912,7 @@ func Fdatasync(fd int) (err error) {
func Flock(fd int, how int) (err error) {
_, _, e1 := sysvicall6(uintptr(unsafe.Pointer(&procFlock)), 2, uintptr(fd), uintptr(how), 0, 0, 0, 0)
if e1 != 0 {
- err = e1
+ err = errnoErr(e1)
}
return
}
@@ -924,7 +923,7 @@ func Fpathconf(fd int, name int) (val int, err error) {
r0, _, e1 := sysvicall6(uintptr(unsafe.Pointer(&procFpathconf)), 2, uintptr(fd), uintptr(name), 0, 0, 0, 0)
val = int(r0)
if e1 != 0 {
- err = e1
+ err = errnoErr(e1)
}
return
}
@@ -934,7 +933,7 @@ func Fpathconf(fd int, name int) (val int, err error) {
func Fstat(fd int, stat *Stat_t) (err error) {
_, _, e1 := sysvicall6(uintptr(unsafe.Pointer(&procFstat)), 2, uintptr(fd), uintptr(unsafe.Pointer(stat)), 0, 0, 0, 0)
if e1 != 0 {
- err = e1
+ err = errnoErr(e1)
}
return
}
@@ -949,7 +948,7 @@ func Fstatat(fd int, path string, stat *Stat_t, flags int) (err error) {
}
_, _, e1 := sysvicall6(uintptr(unsafe.Pointer(&procFstatat)), 4, uintptr(fd), uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(stat)), uintptr(flags), 0, 0)
if e1 != 0 {
- err = e1
+ err = errnoErr(e1)
}
return
}
@@ -959,7 +958,7 @@ func Fstatat(fd int, path string, stat *Stat_t, flags int) (err error) {
func Fstatvfs(fd int, vfsstat *Statvfs_t) (err error) {
_, _, e1 := sysvicall6(uintptr(unsafe.Pointer(&procFstatvfs)), 2, uintptr(fd), uintptr(unsafe.Pointer(vfsstat)), 0, 0, 0, 0)
if e1 != 0 {
- err = e1
+ err = errnoErr(e1)
}
return
}
@@ -974,7 +973,7 @@ func Getdents(fd int, buf []byte, basep *uintptr) (n int, err error) {
r0, _, e1 := sysvicall6(uintptr(unsafe.Pointer(&procGetdents)), 4, uintptr(fd), uintptr(unsafe.Pointer(_p0)), uintptr(len(buf)), uintptr(unsafe.Pointer(basep)), 0, 0)
n = int(r0)
if e1 != 0 {
- err = e1
+ err = errnoErr(e1)
}
return
}
@@ -1001,7 +1000,7 @@ func Getpgid(pid int) (pgid int, err error) {
r0, _, e1 := rawSysvicall6(uintptr(unsafe.Pointer(&procGetpgid)), 1, uintptr(pid), 0, 0, 0, 0, 0)
pgid = int(r0)
if e1 != 0 {
- err = e1
+ err = errnoErr(e1)
}
return
}
@@ -1012,7 +1011,7 @@ func Getpgrp() (pgid int, err error) {
r0, _, e1 := rawSysvicall6(uintptr(unsafe.Pointer(&procGetpgrp)), 0, 0, 0, 0, 0, 0, 0)
pgid = int(r0)
if e1 != 0 {
- err = e1
+ err = errnoErr(e1)
}
return
}
@@ -1047,7 +1046,7 @@ func Getpriority(which int, who int) (n int, err error) {
r0, _, e1 := sysvicall6(uintptr(unsafe.Pointer(&procGetpriority)), 2, uintptr(which), uintptr(who), 0, 0, 0, 0)
n = int(r0)
if e1 != 0 {
- err = e1
+ err = errnoErr(e1)
}
return
}
@@ -1057,7 +1056,7 @@ func Getpriority(which int, who int) (n int, err error) {
func Getrlimit(which int, lim *Rlimit) (err error) {
_, _, e1 := rawSysvicall6(uintptr(unsafe.Pointer(&procGetrlimit)), 2, uintptr(which), uintptr(unsafe.Pointer(lim)), 0, 0, 0, 0)
if e1 != 0 {
- err = e1
+ err = errnoErr(e1)
}
return
}
@@ -1067,7 +1066,7 @@ func Getrlimit(which int, lim *Rlimit) (err error) {
func Getrusage(who int, rusage *Rusage) (err error) {
_, _, e1 := rawSysvicall6(uintptr(unsafe.Pointer(&procGetrusage)), 2, uintptr(who), uintptr(unsafe.Pointer(rusage)), 0, 0, 0, 0)
if e1 != 0 {
- err = e1
+ err = errnoErr(e1)
}
return
}
@@ -1078,7 +1077,7 @@ func Getsid(pid int) (sid int, err error) {
r0, _, e1 := rawSysvicall6(uintptr(unsafe.Pointer(&procGetsid)), 1, uintptr(pid), 0, 0, 0, 0, 0)
sid = int(r0)
if e1 != 0 {
- err = e1
+ err = errnoErr(e1)
}
return
}
@@ -1088,7 +1087,7 @@ func Getsid(pid int) (sid int, err error) {
func Gettimeofday(tv *Timeval) (err error) {
_, _, e1 := rawSysvicall6(uintptr(unsafe.Pointer(&procGettimeofday)), 1, uintptr(unsafe.Pointer(tv)), 0, 0, 0, 0, 0)
if e1 != 0 {
- err = e1
+ err = errnoErr(e1)
}
return
}
@@ -1106,7 +1105,7 @@ func Getuid() (uid int) {
func Kill(pid int, signum syscall.Signal) (err error) {
_, _, e1 := sysvicall6(uintptr(unsafe.Pointer(&procKill)), 2, uintptr(pid), uintptr(signum), 0, 0, 0, 0)
if e1 != 0 {
- err = e1
+ err = errnoErr(e1)
}
return
}
@@ -1121,7 +1120,7 @@ func Lchown(path string, uid int, gid int) (err error) {
}
_, _, e1 := sysvicall6(uintptr(unsafe.Pointer(&procLchown)), 3, uintptr(unsafe.Pointer(_p0)), uintptr(uid), uintptr(gid), 0, 0, 0)
if e1 != 0 {
- err = e1
+ err = errnoErr(e1)
}
return
}
@@ -1141,7 +1140,7 @@ func Link(path string, link string) (err error) {
}
_, _, e1 := sysvicall6(uintptr(unsafe.Pointer(&procLink)), 2, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(_p1)), 0, 0, 0, 0)
if e1 != 0 {
- err = e1
+ err = errnoErr(e1)
}
return
}
@@ -1151,7 +1150,7 @@ func Link(path string, link string) (err error) {
func Listen(s int, backlog int) (err error) {
_, _, e1 := sysvicall6(uintptr(unsafe.Pointer(&proc__xnet_llisten)), 2, uintptr(s), uintptr(backlog), 0, 0, 0, 0)
if e1 != 0 {
- err = e1
+ err = errnoErr(e1)
}
return
}
@@ -1166,7 +1165,7 @@ func Lstat(path string, stat *Stat_t) (err error) {
}
_, _, e1 := sysvicall6(uintptr(unsafe.Pointer(&procLstat)), 2, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(stat)), 0, 0, 0, 0)
if e1 != 0 {
- err = e1
+ err = errnoErr(e1)
}
return
}
@@ -1180,7 +1179,7 @@ func Madvise(b []byte, advice int) (err error) {
}
_, _, e1 := sysvicall6(uintptr(unsafe.Pointer(&procMadvise)), 3, uintptr(unsafe.Pointer(_p0)), uintptr(len(b)), uintptr(advice), 0, 0, 0)
if e1 != 0 {
- err = e1
+ err = errnoErr(e1)
}
return
}
@@ -1195,7 +1194,7 @@ func Mkdir(path string, mode uint32) (err error) {
}
_, _, e1 := sysvicall6(uintptr(unsafe.Pointer(&procMkdir)), 2, uintptr(unsafe.Pointer(_p0)), uintptr(mode), 0, 0, 0, 0)
if e1 != 0 {
- err = e1
+ err = errnoErr(e1)
}
return
}
@@ -1210,7 +1209,7 @@ func Mkdirat(dirfd int, path string, mode uint32) (err error) {
}
_, _, e1 := sysvicall6(uintptr(unsafe.Pointer(&procMkdirat)), 3, uintptr(dirfd), uintptr(unsafe.Pointer(_p0)), uintptr(mode), 0, 0, 0)
if e1 != 0 {
- err = e1
+ err = errnoErr(e1)
}
return
}
@@ -1225,7 +1224,7 @@ func Mkfifo(path string, mode uint32) (err error) {
}
_, _, e1 := sysvicall6(uintptr(unsafe.Pointer(&procMkfifo)), 2, uintptr(unsafe.Pointer(_p0)), uintptr(mode), 0, 0, 0, 0)
if e1 != 0 {
- err = e1
+ err = errnoErr(e1)
}
return
}
@@ -1240,7 +1239,7 @@ func Mkfifoat(dirfd int, path string, mode uint32) (err error) {
}
_, _, e1 := sysvicall6(uintptr(unsafe.Pointer(&procMkfifoat)), 3, uintptr(dirfd), uintptr(unsafe.Pointer(_p0)), uintptr(mode), 0, 0, 0)
if e1 != 0 {
- err = e1
+ err = errnoErr(e1)
}
return
}
@@ -1255,7 +1254,7 @@ func Mknod(path string, mode uint32, dev int) (err error) {
}
_, _, e1 := sysvicall6(uintptr(unsafe.Pointer(&procMknod)), 3, uintptr(unsafe.Pointer(_p0)), uintptr(mode), uintptr(dev), 0, 0, 0)
if e1 != 0 {
- err = e1
+ err = errnoErr(e1)
}
return
}
@@ -1270,7 +1269,7 @@ func Mknodat(dirfd int, path string, mode uint32, dev int) (err error) {
}
_, _, e1 := sysvicall6(uintptr(unsafe.Pointer(&procMknodat)), 4, uintptr(dirfd), uintptr(unsafe.Pointer(_p0)), uintptr(mode), uintptr(dev), 0, 0)
if e1 != 0 {
- err = e1
+ err = errnoErr(e1)
}
return
}
@@ -1284,7 +1283,7 @@ func Mlock(b []byte) (err error) {
}
_, _, e1 := sysvicall6(uintptr(unsafe.Pointer(&procMlock)), 2, uintptr(unsafe.Pointer(_p0)), uintptr(len(b)), 0, 0, 0, 0)
if e1 != 0 {
- err = e1
+ err = errnoErr(e1)
}
return
}
@@ -1294,7 +1293,7 @@ func Mlock(b []byte) (err error) {
func Mlockall(flags int) (err error) {
_, _, e1 := sysvicall6(uintptr(unsafe.Pointer(&procMlockall)), 1, uintptr(flags), 0, 0, 0, 0, 0)
if e1 != 0 {
- err = e1
+ err = errnoErr(e1)
}
return
}
@@ -1308,7 +1307,7 @@ func Mprotect(b []byte, prot int) (err error) {
}
_, _, e1 := sysvicall6(uintptr(unsafe.Pointer(&procMprotect)), 3, uintptr(unsafe.Pointer(_p0)), uintptr(len(b)), uintptr(prot), 0, 0, 0)
if e1 != 0 {
- err = e1
+ err = errnoErr(e1)
}
return
}
@@ -1322,7 +1321,7 @@ func Msync(b []byte, flags int) (err error) {
}
_, _, e1 := sysvicall6(uintptr(unsafe.Pointer(&procMsync)), 3, uintptr(unsafe.Pointer(_p0)), uintptr(len(b)), uintptr(flags), 0, 0, 0)
if e1 != 0 {
- err = e1
+ err = errnoErr(e1)
}
return
}
@@ -1336,7 +1335,7 @@ func Munlock(b []byte) (err error) {
}
_, _, e1 := sysvicall6(uintptr(unsafe.Pointer(&procMunlock)), 2, uintptr(unsafe.Pointer(_p0)), uintptr(len(b)), 0, 0, 0, 0)
if e1 != 0 {
- err = e1
+ err = errnoErr(e1)
}
return
}
@@ -1346,7 +1345,7 @@ func Munlock(b []byte) (err error) {
func Munlockall() (err error) {
_, _, e1 := sysvicall6(uintptr(unsafe.Pointer(&procMunlockall)), 0, 0, 0, 0, 0, 0, 0)
if e1 != 0 {
- err = e1
+ err = errnoErr(e1)
}
return
}
@@ -1356,7 +1355,7 @@ func Munlockall() (err error) {
func Nanosleep(time *Timespec, leftover *Timespec) (err error) {
_, _, e1 := sysvicall6(uintptr(unsafe.Pointer(&procNanosleep)), 2, uintptr(unsafe.Pointer(time)), uintptr(unsafe.Pointer(leftover)), 0, 0, 0, 0)
if e1 != 0 {
- err = e1
+ err = errnoErr(e1)
}
return
}
@@ -1372,7 +1371,7 @@ func Open(path string, mode int, perm uint32) (fd int, err error) {
r0, _, e1 := sysvicall6(uintptr(unsafe.Pointer(&procOpen)), 3, uintptr(unsafe.Pointer(_p0)), uintptr(mode), uintptr(perm), 0, 0, 0)
fd = int(r0)
if e1 != 0 {
- err = e1
+ err = errnoErr(e1)
}
return
}
@@ -1388,7 +1387,7 @@ func Openat(dirfd int, path string, flags int, mode uint32) (fd int, err error)
r0, _, e1 := sysvicall6(uintptr(unsafe.Pointer(&procOpenat)), 4, uintptr(dirfd), uintptr(unsafe.Pointer(_p0)), uintptr(flags), uintptr(mode), 0, 0)
fd = int(r0)
if e1 != 0 {
- err = e1
+ err = errnoErr(e1)
}
return
}
@@ -1404,7 +1403,7 @@ func Pathconf(path string, name int) (val int, err error) {
r0, _, e1 := sysvicall6(uintptr(unsafe.Pointer(&procPathconf)), 2, uintptr(unsafe.Pointer(_p0)), uintptr(name), 0, 0, 0, 0)
val = int(r0)
if e1 != 0 {
- err = e1
+ err = errnoErr(e1)
}
return
}
@@ -1414,7 +1413,7 @@ func Pathconf(path string, name int) (val int, err error) {
func Pause() (err error) {
_, _, e1 := sysvicall6(uintptr(unsafe.Pointer(&procPause)), 0, 0, 0, 0, 0, 0, 0)
if e1 != 0 {
- err = e1
+ err = errnoErr(e1)
}
return
}
@@ -1429,7 +1428,7 @@ func pread(fd int, p []byte, offset int64) (n int, err error) {
r0, _, e1 := sysvicall6(uintptr(unsafe.Pointer(&procpread)), 4, uintptr(fd), uintptr(unsafe.Pointer(_p0)), uintptr(len(p)), uintptr(offset), 0, 0)
n = int(r0)
if e1 != 0 {
- err = e1
+ err = errnoErr(e1)
}
return
}
@@ -1444,7 +1443,7 @@ func pwrite(fd int, p []byte, offset int64) (n int, err error) {
r0, _, e1 := sysvicall6(uintptr(unsafe.Pointer(&procpwrite)), 4, uintptr(fd), uintptr(unsafe.Pointer(_p0)), uintptr(len(p)), uintptr(offset), 0, 0)
n = int(r0)
if e1 != 0 {
- err = e1
+ err = errnoErr(e1)
}
return
}
@@ -1459,7 +1458,7 @@ func read(fd int, p []byte) (n int, err error) {
r0, _, e1 := sysvicall6(uintptr(unsafe.Pointer(&procread)), 3, uintptr(fd), uintptr(unsafe.Pointer(_p0)), uintptr(len(p)), 0, 0, 0)
n = int(r0)
if e1 != 0 {
- err = e1
+ err = errnoErr(e1)
}
return
}
@@ -1479,7 +1478,7 @@ func Readlink(path string, buf []byte) (n int, err error) {
r0, _, e1 := sysvicall6(uintptr(unsafe.Pointer(&procReadlink)), 3, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(_p1)), uintptr(len(buf)), 0, 0, 0)
n = int(r0)
if e1 != 0 {
- err = e1
+ err = errnoErr(e1)
}
return
}
@@ -1499,7 +1498,7 @@ func Rename(from string, to string) (err error) {
}
_, _, e1 := sysvicall6(uintptr(unsafe.Pointer(&procRename)), 2, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(_p1)), 0, 0, 0, 0)
if e1 != 0 {
- err = e1
+ err = errnoErr(e1)
}
return
}
@@ -1519,7 +1518,7 @@ func Renameat(olddirfd int, oldpath string, newdirfd int, newpath string) (err e
}
_, _, e1 := sysvicall6(uintptr(unsafe.Pointer(&procRenameat)), 4, uintptr(olddirfd), uintptr(unsafe.Pointer(_p0)), uintptr(newdirfd), uintptr(unsafe.Pointer(_p1)), 0, 0)
if e1 != 0 {
- err = e1
+ err = errnoErr(e1)
}
return
}
@@ -1534,7 +1533,7 @@ func Rmdir(path string) (err error) {
}
_, _, e1 := sysvicall6(uintptr(unsafe.Pointer(&procRmdir)), 1, uintptr(unsafe.Pointer(_p0)), 0, 0, 0, 0, 0)
if e1 != 0 {
- err = e1
+ err = errnoErr(e1)
}
return
}
@@ -1545,7 +1544,7 @@ func Seek(fd int, offset int64, whence int) (newoffset int64, err error) {
r0, _, e1 := sysvicall6(uintptr(unsafe.Pointer(&proclseek)), 3, uintptr(fd), uintptr(offset), uintptr(whence), 0, 0, 0)
newoffset = int64(r0)
if e1 != 0 {
- err = e1
+ err = errnoErr(e1)
}
return
}
@@ -1556,7 +1555,7 @@ func Select(nfd int, r *FdSet, w *FdSet, e *FdSet, timeout *Timeval) (n int, err
r0, _, e1 := sysvicall6(uintptr(unsafe.Pointer(&procSelect)), 5, uintptr(nfd), uintptr(unsafe.Pointer(r)), uintptr(unsafe.Pointer(w)), uintptr(unsafe.Pointer(e)), uintptr(unsafe.Pointer(timeout)), 0)
n = int(r0)
if e1 != 0 {
- err = e1
+ err = errnoErr(e1)
}
return
}
@@ -1566,7 +1565,7 @@ func Select(nfd int, r *FdSet, w *FdSet, e *FdSet, timeout *Timeval) (n int, err
func Setegid(egid int) (err error) {
_, _, e1 := rawSysvicall6(uintptr(unsafe.Pointer(&procSetegid)), 1, uintptr(egid), 0, 0, 0, 0, 0)
if e1 != 0 {
- err = e1
+ err = errnoErr(e1)
}
return
}
@@ -1576,7 +1575,7 @@ func Setegid(egid int) (err error) {
func Seteuid(euid int) (err error) {
_, _, e1 := rawSysvicall6(uintptr(unsafe.Pointer(&procSeteuid)), 1, uintptr(euid), 0, 0, 0, 0, 0)
if e1 != 0 {
- err = e1
+ err = errnoErr(e1)
}
return
}
@@ -1586,7 +1585,7 @@ func Seteuid(euid int) (err error) {
func Setgid(gid int) (err error) {
_, _, e1 := rawSysvicall6(uintptr(unsafe.Pointer(&procSetgid)), 1, uintptr(gid), 0, 0, 0, 0, 0)
if e1 != 0 {
- err = e1
+ err = errnoErr(e1)
}
return
}
@@ -1600,7 +1599,7 @@ func Sethostname(p []byte) (err error) {
}
_, _, e1 := sysvicall6(uintptr(unsafe.Pointer(&procSethostname)), 2, uintptr(unsafe.Pointer(_p0)), uintptr(len(p)), 0, 0, 0, 0)
if e1 != 0 {
- err = e1
+ err = errnoErr(e1)
}
return
}
@@ -1610,7 +1609,7 @@ func Sethostname(p []byte) (err error) {
func Setpgid(pid int, pgid int) (err error) {
_, _, e1 := rawSysvicall6(uintptr(unsafe.Pointer(&procSetpgid)), 2, uintptr(pid), uintptr(pgid), 0, 0, 0, 0)
if e1 != 0 {
- err = e1
+ err = errnoErr(e1)
}
return
}
@@ -1620,7 +1619,7 @@ func Setpgid(pid int, pgid int) (err error) {
func Setpriority(which int, who int, prio int) (err error) {
_, _, e1 := sysvicall6(uintptr(unsafe.Pointer(&procSetpriority)), 3, uintptr(which), uintptr(who), uintptr(prio), 0, 0, 0)
if e1 != 0 {
- err = e1
+ err = errnoErr(e1)
}
return
}
@@ -1630,7 +1629,7 @@ func Setpriority(which int, who int, prio int) (err error) {
func Setregid(rgid int, egid int) (err error) {
_, _, e1 := rawSysvicall6(uintptr(unsafe.Pointer(&procSetregid)), 2, uintptr(rgid), uintptr(egid), 0, 0, 0, 0)
if e1 != 0 {
- err = e1
+ err = errnoErr(e1)
}
return
}
@@ -1640,7 +1639,7 @@ func Setregid(rgid int, egid int) (err error) {
func Setreuid(ruid int, euid int) (err error) {
_, _, e1 := rawSysvicall6(uintptr(unsafe.Pointer(&procSetreuid)), 2, uintptr(ruid), uintptr(euid), 0, 0, 0, 0)
if e1 != 0 {
- err = e1
+ err = errnoErr(e1)
}
return
}
@@ -1651,7 +1650,7 @@ func Setsid() (pid int, err error) {
r0, _, e1 := rawSysvicall6(uintptr(unsafe.Pointer(&procSetsid)), 0, 0, 0, 0, 0, 0, 0)
pid = int(r0)
if e1 != 0 {
- err = e1
+ err = errnoErr(e1)
}
return
}
@@ -1661,7 +1660,7 @@ func Setsid() (pid int, err error) {
func Setuid(uid int) (err error) {
_, _, e1 := rawSysvicall6(uintptr(unsafe.Pointer(&procSetuid)), 1, uintptr(uid), 0, 0, 0, 0, 0)
if e1 != 0 {
- err = e1
+ err = errnoErr(e1)
}
return
}
@@ -1671,7 +1670,7 @@ func Setuid(uid int) (err error) {
func Shutdown(s int, how int) (err error) {
_, _, e1 := sysvicall6(uintptr(unsafe.Pointer(&procshutdown)), 2, uintptr(s), uintptr(how), 0, 0, 0, 0)
if e1 != 0 {
- err = e1
+ err = errnoErr(e1)
}
return
}
@@ -1686,7 +1685,7 @@ func Stat(path string, stat *Stat_t) (err error) {
}
_, _, e1 := sysvicall6(uintptr(unsafe.Pointer(&procStat)), 2, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(stat)), 0, 0, 0, 0)
if e1 != 0 {
- err = e1
+ err = errnoErr(e1)
}
return
}
@@ -1701,7 +1700,7 @@ func Statvfs(path string, vfsstat *Statvfs_t) (err error) {
}
_, _, e1 := sysvicall6(uintptr(unsafe.Pointer(&procStatvfs)), 2, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(vfsstat)), 0, 0, 0, 0)
if e1 != 0 {
- err = e1
+ err = errnoErr(e1)
}
return
}
@@ -1721,7 +1720,7 @@ func Symlink(path string, link string) (err error) {
}
_, _, e1 := sysvicall6(uintptr(unsafe.Pointer(&procSymlink)), 2, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(_p1)), 0, 0, 0, 0)
if e1 != 0 {
- err = e1
+ err = errnoErr(e1)
}
return
}
@@ -1731,7 +1730,7 @@ func Symlink(path string, link string) (err error) {
func Sync() (err error) {
_, _, e1 := sysvicall6(uintptr(unsafe.Pointer(&procSync)), 0, 0, 0, 0, 0, 0, 0)
if e1 != 0 {
- err = e1
+ err = errnoErr(e1)
}
return
}
@@ -1742,7 +1741,7 @@ func Sysconf(which int) (n int64, err error) {
r0, _, e1 := sysvicall6(uintptr(unsafe.Pointer(&procSysconf)), 1, uintptr(which), 0, 0, 0, 0, 0)
n = int64(r0)
if e1 != 0 {
- err = e1
+ err = errnoErr(e1)
}
return
}
@@ -1753,7 +1752,7 @@ func Times(tms *Tms) (ticks uintptr, err error) {
r0, _, e1 := rawSysvicall6(uintptr(unsafe.Pointer(&procTimes)), 1, uintptr(unsafe.Pointer(tms)), 0, 0, 0, 0, 0)
ticks = uintptr(r0)
if e1 != 0 {
- err = e1
+ err = errnoErr(e1)
}
return
}
@@ -1768,7 +1767,7 @@ func Truncate(path string, length int64) (err error) {
}
_, _, e1 := sysvicall6(uintptr(unsafe.Pointer(&procTruncate)), 2, uintptr(unsafe.Pointer(_p0)), uintptr(length), 0, 0, 0, 0)
if e1 != 0 {
- err = e1
+ err = errnoErr(e1)
}
return
}
@@ -1778,7 +1777,7 @@ func Truncate(path string, length int64) (err error) {
func Fsync(fd int) (err error) {
_, _, e1 := sysvicall6(uintptr(unsafe.Pointer(&procFsync)), 1, uintptr(fd), 0, 0, 0, 0, 0)
if e1 != 0 {
- err = e1
+ err = errnoErr(e1)
}
return
}
@@ -1788,7 +1787,7 @@ func Fsync(fd int) (err error) {
func Ftruncate(fd int, length int64) (err error) {
_, _, e1 := sysvicall6(uintptr(unsafe.Pointer(&procFtruncate)), 2, uintptr(fd), uintptr(length), 0, 0, 0, 0)
if e1 != 0 {
- err = e1
+ err = errnoErr(e1)
}
return
}
@@ -1806,7 +1805,7 @@ func Umask(mask int) (oldmask int) {
func Uname(buf *Utsname) (err error) {
_, _, e1 := rawSysvicall6(uintptr(unsafe.Pointer(&procUname)), 1, uintptr(unsafe.Pointer(buf)), 0, 0, 0, 0, 0)
if e1 != 0 {
- err = e1
+ err = errnoErr(e1)
}
return
}
@@ -1821,7 +1820,7 @@ func Unmount(target string, flags int) (err error) {
}
_, _, e1 := sysvicall6(uintptr(unsafe.Pointer(&procumount)), 2, uintptr(unsafe.Pointer(_p0)), uintptr(flags), 0, 0, 0, 0)
if e1 != 0 {
- err = e1
+ err = errnoErr(e1)
}
return
}
@@ -1836,7 +1835,7 @@ func Unlink(path string) (err error) {
}
_, _, e1 := sysvicall6(uintptr(unsafe.Pointer(&procUnlink)), 1, uintptr(unsafe.Pointer(_p0)), 0, 0, 0, 0, 0)
if e1 != 0 {
- err = e1
+ err = errnoErr(e1)
}
return
}
@@ -1851,7 +1850,7 @@ func Unlinkat(dirfd int, path string, flags int) (err error) {
}
_, _, e1 := sysvicall6(uintptr(unsafe.Pointer(&procUnlinkat)), 3, uintptr(dirfd), uintptr(unsafe.Pointer(_p0)), uintptr(flags), 0, 0, 0)
if e1 != 0 {
- err = e1
+ err = errnoErr(e1)
}
return
}
@@ -1861,7 +1860,7 @@ func Unlinkat(dirfd int, path string, flags int) (err error) {
func Ustat(dev int, ubuf *Ustat_t) (err error) {
_, _, e1 := sysvicall6(uintptr(unsafe.Pointer(&procUstat)), 2, uintptr(dev), uintptr(unsafe.Pointer(ubuf)), 0, 0, 0, 0)
if e1 != 0 {
- err = e1
+ err = errnoErr(e1)
}
return
}
@@ -1876,7 +1875,7 @@ func Utime(path string, buf *Utimbuf) (err error) {
}
_, _, e1 := sysvicall6(uintptr(unsafe.Pointer(&procUtime)), 2, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(buf)), 0, 0, 0, 0)
if e1 != 0 {
- err = e1
+ err = errnoErr(e1)
}
return
}
@@ -1886,7 +1885,7 @@ func Utime(path string, buf *Utimbuf) (err error) {
func bind(s int, addr unsafe.Pointer, addrlen _Socklen) (err error) {
_, _, e1 := sysvicall6(uintptr(unsafe.Pointer(&proc__xnet_bind)), 3, uintptr(s), uintptr(addr), uintptr(addrlen), 0, 0, 0)
if e1 != 0 {
- err = e1
+ err = errnoErr(e1)
}
return
}
@@ -1896,7 +1895,7 @@ func bind(s int, addr unsafe.Pointer, addrlen _Socklen) (err error) {
func connect(s int, addr unsafe.Pointer, addrlen _Socklen) (err error) {
_, _, e1 := sysvicall6(uintptr(unsafe.Pointer(&proc__xnet_connect)), 3, uintptr(s), uintptr(addr), uintptr(addrlen), 0, 0, 0)
if e1 != 0 {
- err = e1
+ err = errnoErr(e1)
}
return
}
@@ -1907,7 +1906,7 @@ func mmap(addr uintptr, length uintptr, prot int, flag int, fd int, pos int64) (
r0, _, e1 := sysvicall6(uintptr(unsafe.Pointer(&procmmap)), 6, uintptr(addr), uintptr(length), uintptr(prot), uintptr(flag), uintptr(fd), uintptr(pos))
ret = uintptr(r0)
if e1 != 0 {
- err = e1
+ err = errnoErr(e1)
}
return
}
@@ -1917,7 +1916,7 @@ func mmap(addr uintptr, length uintptr, prot int, flag int, fd int, pos int64) (
func munmap(addr uintptr, length uintptr) (err error) {
_, _, e1 := sysvicall6(uintptr(unsafe.Pointer(&procmunmap)), 2, uintptr(addr), uintptr(length), 0, 0, 0, 0)
if e1 != 0 {
- err = e1
+ err = errnoErr(e1)
}
return
}
@@ -1928,7 +1927,7 @@ func sendfile(outfd int, infd int, offset *int64, count int) (written int, err e
r0, _, e1 := sysvicall6(uintptr(unsafe.Pointer(&procsendfile)), 4, uintptr(outfd), uintptr(infd), uintptr(unsafe.Pointer(offset)), uintptr(count), 0, 0)
written = int(r0)
if e1 != 0 {
- err = e1
+ err = errnoErr(e1)
}
return
}
@@ -1942,7 +1941,7 @@ func sendto(s int, buf []byte, flags int, to unsafe.Pointer, addrlen _Socklen) (
}
_, _, e1 := sysvicall6(uintptr(unsafe.Pointer(&proc__xnet_sendto)), 6, uintptr(s), uintptr(unsafe.Pointer(_p0)), uintptr(len(buf)), uintptr(flags), uintptr(to), uintptr(addrlen))
if e1 != 0 {
- err = e1
+ err = errnoErr(e1)
}
return
}
@@ -1953,7 +1952,7 @@ func socket(domain int, typ int, proto int) (fd int, err error) {
r0, _, e1 := sysvicall6(uintptr(unsafe.Pointer(&proc__xnet_socket)), 3, uintptr(domain), uintptr(typ), uintptr(proto), 0, 0, 0)
fd = int(r0)
if e1 != 0 {
- err = e1
+ err = errnoErr(e1)
}
return
}
@@ -1963,7 +1962,7 @@ func socket(domain int, typ int, proto int) (fd int, err error) {
func socketpair(domain int, typ int, proto int, fd *[2]int32) (err error) {
_, _, e1 := rawSysvicall6(uintptr(unsafe.Pointer(&proc__xnet_socketpair)), 4, uintptr(domain), uintptr(typ), uintptr(proto), uintptr(unsafe.Pointer(fd)), 0, 0)
if e1 != 0 {
- err = e1
+ err = errnoErr(e1)
}
return
}
@@ -1978,7 +1977,7 @@ func write(fd int, p []byte) (n int, err error) {
r0, _, e1 := sysvicall6(uintptr(unsafe.Pointer(&procwrite)), 3, uintptr(fd), uintptr(unsafe.Pointer(_p0)), uintptr(len(p)), 0, 0, 0)
n = int(r0)
if e1 != 0 {
- err = e1
+ err = errnoErr(e1)
}
return
}
@@ -1988,7 +1987,7 @@ func write(fd int, p []byte) (n int, err error) {
func getsockopt(s int, level int, name int, val unsafe.Pointer, vallen *_Socklen) (err error) {
_, _, e1 := sysvicall6(uintptr(unsafe.Pointer(&proc__xnet_getsockopt)), 5, uintptr(s), uintptr(level), uintptr(name), uintptr(val), uintptr(unsafe.Pointer(vallen)), 0)
if e1 != 0 {
- err = e1
+ err = errnoErr(e1)
}
return
}
@@ -1998,7 +1997,7 @@ func getsockopt(s int, level int, name int, val unsafe.Pointer, vallen *_Socklen
func getpeername(fd int, rsa *RawSockaddrAny, addrlen *_Socklen) (err error) {
_, _, e1 := rawSysvicall6(uintptr(unsafe.Pointer(&procgetpeername)), 3, uintptr(fd), uintptr(unsafe.Pointer(rsa)), uintptr(unsafe.Pointer(addrlen)), 0, 0, 0)
if e1 != 0 {
- err = e1
+ err = errnoErr(e1)
}
return
}
@@ -2008,7 +2007,7 @@ func getpeername(fd int, rsa *RawSockaddrAny, addrlen *_Socklen) (err error) {
func setsockopt(s int, level int, name int, val unsafe.Pointer, vallen uintptr) (err error) {
_, _, e1 := sysvicall6(uintptr(unsafe.Pointer(&procsetsockopt)), 5, uintptr(s), uintptr(level), uintptr(name), uintptr(val), uintptr(vallen), 0)
if e1 != 0 {
- err = e1
+ err = errnoErr(e1)
}
return
}
@@ -2023,7 +2022,7 @@ func recvfrom(fd int, p []byte, flags int, from *RawSockaddrAny, fromlen *_Sockl
r0, _, e1 := sysvicall6(uintptr(unsafe.Pointer(&procrecvfrom)), 6, uintptr(fd), uintptr(unsafe.Pointer(_p0)), uintptr(len(p)), uintptr(flags), uintptr(unsafe.Pointer(from)), uintptr(unsafe.Pointer(fromlen)))
n = int(r0)
if e1 != 0 {
- err = e1
+ err = errnoErr(e1)
}
return
}
@@ -2034,7 +2033,7 @@ func port_create() (n int, err error) {
r0, _, e1 := sysvicall6(uintptr(unsafe.Pointer(&procport_create)), 0, 0, 0, 0, 0, 0, 0)
n = int(r0)
if e1 != 0 {
- err = e1
+ err = errnoErr(e1)
}
return
}
@@ -2045,7 +2044,7 @@ func port_associate(port int, source int, object uintptr, events int, user *byte
r0, _, e1 := sysvicall6(uintptr(unsafe.Pointer(&procport_associate)), 5, uintptr(port), uintptr(source), uintptr(object), uintptr(events), uintptr(unsafe.Pointer(user)), 0)
n = int(r0)
if e1 != 0 {
- err = e1
+ err = errnoErr(e1)
}
return
}
@@ -2056,7 +2055,7 @@ func port_dissociate(port int, source int, object uintptr) (n int, err error) {
r0, _, e1 := sysvicall6(uintptr(unsafe.Pointer(&procport_dissociate)), 3, uintptr(port), uintptr(source), uintptr(object), 0, 0, 0)
n = int(r0)
if e1 != 0 {
- err = e1
+ err = errnoErr(e1)
}
return
}
@@ -2067,7 +2066,7 @@ func port_get(port int, pe *portEvent, timeout *Timespec) (n int, err error) {
r0, _, e1 := sysvicall6(uintptr(unsafe.Pointer(&procport_get)), 3, uintptr(port), uintptr(unsafe.Pointer(pe)), uintptr(unsafe.Pointer(timeout)), 0, 0, 0)
n = int(r0)
if e1 != 0 {
- err = e1
+ err = errnoErr(e1)
}
return
}
@@ -2078,7 +2077,7 @@ func port_getn(port int, pe *portEvent, max uint32, nget *uint32, timeout *Times
r0, _, e1 := sysvicall6(uintptr(unsafe.Pointer(&procport_getn)), 5, uintptr(port), uintptr(unsafe.Pointer(pe)), uintptr(max), uintptr(unsafe.Pointer(nget)), uintptr(unsafe.Pointer(timeout)), 0)
n = int(r0)
if e1 != 0 {
- err = e1
+ err = errnoErr(e1)
}
return
}
@@ -2088,7 +2087,7 @@ func port_getn(port int, pe *portEvent, max uint32, nget *uint32, timeout *Times
func putmsg(fd int, clptr *strbuf, dataptr *strbuf, flags int) (err error) {
_, _, e1 := sysvicall6(uintptr(unsafe.Pointer(&procputmsg)), 4, uintptr(fd), uintptr(unsafe.Pointer(clptr)), uintptr(unsafe.Pointer(dataptr)), uintptr(flags), 0, 0)
if e1 != 0 {
- err = e1
+ err = errnoErr(e1)
}
return
}
@@ -2098,7 +2097,7 @@ func putmsg(fd int, clptr *strbuf, dataptr *strbuf, flags int) (err error) {
func getmsg(fd int, clptr *strbuf, dataptr *strbuf, flags *int) (err error) {
_, _, e1 := sysvicall6(uintptr(unsafe.Pointer(&procgetmsg)), 4, uintptr(fd), uintptr(unsafe.Pointer(clptr)), uintptr(unsafe.Pointer(dataptr)), uintptr(unsafe.Pointer(flags)), 0, 0)
if e1 != 0 {
- err = e1
+ err = errnoErr(e1)
}
return
}
diff --git a/vendor/golang.org/x/sys/unix/zsyscall_zos_s390x.go b/vendor/golang.org/x/sys/unix/zsyscall_zos_s390x.go
index c3168174..94f01123 100644
--- a/vendor/golang.org/x/sys/unix/zsyscall_zos_s390x.go
+++ b/vendor/golang.org/x/sys/unix/zsyscall_zos_s390x.go
@@ -2,7 +2,6 @@
// Code generated by the command above; see README.md. DO NOT EDIT.
//go:build zos && s390x
-// +build zos,s390x
package unix
@@ -40,17 +39,6 @@ func read(fd int, p []byte) (n int, err error) {
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
-func readlen(fd int, buf *byte, nbuf int) (n int, err error) {
- r0, _, e1 := syscall_syscall(SYS_READ, uintptr(fd), uintptr(unsafe.Pointer(buf)), uintptr(nbuf))
- n = int(r0)
- if e1 != 0 {
- err = errnoErr(e1)
- }
- return
-}
-
-// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
-
func write(fd int, p []byte) (n int, err error) {
var _p0 unsafe.Pointer
if len(p) > 0 {
diff --git a/vendor/golang.org/x/sys/unix/zsysctl_openbsd_386.go b/vendor/golang.org/x/sys/unix/zsysctl_openbsd_386.go
index 55e04847..3a58ae81 100644
--- a/vendor/golang.org/x/sys/unix/zsysctl_openbsd_386.go
+++ b/vendor/golang.org/x/sys/unix/zsysctl_openbsd_386.go
@@ -2,7 +2,6 @@
// Code generated by the command above; DO NOT EDIT.
//go:build 386 && openbsd
-// +build 386,openbsd
package unix
diff --git a/vendor/golang.org/x/sys/unix/zsysctl_openbsd_amd64.go b/vendor/golang.org/x/sys/unix/zsysctl_openbsd_amd64.go
index d2243cf8..dcb7a0eb 100644
--- a/vendor/golang.org/x/sys/unix/zsysctl_openbsd_amd64.go
+++ b/vendor/golang.org/x/sys/unix/zsysctl_openbsd_amd64.go
@@ -2,7 +2,6 @@
// Code generated by the command above; DO NOT EDIT.
//go:build amd64 && openbsd
-// +build amd64,openbsd
package unix
diff --git a/vendor/golang.org/x/sys/unix/zsysctl_openbsd_arm.go b/vendor/golang.org/x/sys/unix/zsysctl_openbsd_arm.go
index 82dc51bd..db5a7bf1 100644
--- a/vendor/golang.org/x/sys/unix/zsysctl_openbsd_arm.go
+++ b/vendor/golang.org/x/sys/unix/zsysctl_openbsd_arm.go
@@ -2,7 +2,6 @@
// Code generated by the command above; DO NOT EDIT.
//go:build arm && openbsd
-// +build arm,openbsd
package unix
diff --git a/vendor/golang.org/x/sys/unix/zsysctl_openbsd_arm64.go b/vendor/golang.org/x/sys/unix/zsysctl_openbsd_arm64.go
index cbdda1a4..7be575a7 100644
--- a/vendor/golang.org/x/sys/unix/zsysctl_openbsd_arm64.go
+++ b/vendor/golang.org/x/sys/unix/zsysctl_openbsd_arm64.go
@@ -2,7 +2,6 @@
// Code generated by the command above; DO NOT EDIT.
//go:build arm64 && openbsd
-// +build arm64,openbsd
package unix
diff --git a/vendor/golang.org/x/sys/unix/zsysctl_openbsd_mips64.go b/vendor/golang.org/x/sys/unix/zsysctl_openbsd_mips64.go
index f55eae1a..d6e3174c 100644
--- a/vendor/golang.org/x/sys/unix/zsysctl_openbsd_mips64.go
+++ b/vendor/golang.org/x/sys/unix/zsysctl_openbsd_mips64.go
@@ -2,7 +2,6 @@
// Code generated by the command above; DO NOT EDIT.
//go:build mips64 && openbsd
-// +build mips64,openbsd
package unix
diff --git a/vendor/golang.org/x/sys/unix/zsysctl_openbsd_ppc64.go b/vendor/golang.org/x/sys/unix/zsysctl_openbsd_ppc64.go
index e4405447..ee97157d 100644
--- a/vendor/golang.org/x/sys/unix/zsysctl_openbsd_ppc64.go
+++ b/vendor/golang.org/x/sys/unix/zsysctl_openbsd_ppc64.go
@@ -2,7 +2,6 @@
// Code generated by the command above; DO NOT EDIT.
//go:build ppc64 && openbsd
-// +build ppc64,openbsd
package unix
diff --git a/vendor/golang.org/x/sys/unix/zsysctl_openbsd_riscv64.go b/vendor/golang.org/x/sys/unix/zsysctl_openbsd_riscv64.go
index a0db82fc..35c3b91d 100644
--- a/vendor/golang.org/x/sys/unix/zsysctl_openbsd_riscv64.go
+++ b/vendor/golang.org/x/sys/unix/zsysctl_openbsd_riscv64.go
@@ -2,7 +2,6 @@
// Code generated by the command above; DO NOT EDIT.
//go:build riscv64 && openbsd
-// +build riscv64,openbsd
package unix
diff --git a/vendor/golang.org/x/sys/unix/zsysnum_darwin_amd64.go b/vendor/golang.org/x/sys/unix/zsysnum_darwin_amd64.go
index f8298ff9..5edda768 100644
--- a/vendor/golang.org/x/sys/unix/zsysnum_darwin_amd64.go
+++ b/vendor/golang.org/x/sys/unix/zsysnum_darwin_amd64.go
@@ -2,7 +2,6 @@
// Code generated by the command above; see README.md. DO NOT EDIT.
//go:build amd64 && darwin
-// +build amd64,darwin
package unix
diff --git a/vendor/golang.org/x/sys/unix/zsysnum_darwin_arm64.go b/vendor/golang.org/x/sys/unix/zsysnum_darwin_arm64.go
index 5eb433bb..0dc9e8b4 100644
--- a/vendor/golang.org/x/sys/unix/zsysnum_darwin_arm64.go
+++ b/vendor/golang.org/x/sys/unix/zsysnum_darwin_arm64.go
@@ -2,7 +2,6 @@
// Code generated by the command above; see README.md. DO NOT EDIT.
//go:build arm64 && darwin
-// +build arm64,darwin
package unix
diff --git a/vendor/golang.org/x/sys/unix/zsysnum_dragonfly_amd64.go b/vendor/golang.org/x/sys/unix/zsysnum_dragonfly_amd64.go
index 703675c0..308ddf3a 100644
--- a/vendor/golang.org/x/sys/unix/zsysnum_dragonfly_amd64.go
+++ b/vendor/golang.org/x/sys/unix/zsysnum_dragonfly_amd64.go
@@ -2,7 +2,6 @@
// Code generated by the command above; see README.md. DO NOT EDIT.
//go:build amd64 && dragonfly
-// +build amd64,dragonfly
package unix
diff --git a/vendor/golang.org/x/sys/unix/zsysnum_freebsd_386.go b/vendor/golang.org/x/sys/unix/zsysnum_freebsd_386.go
index 4e0d9610..418664e3 100644
--- a/vendor/golang.org/x/sys/unix/zsysnum_freebsd_386.go
+++ b/vendor/golang.org/x/sys/unix/zsysnum_freebsd_386.go
@@ -2,7 +2,6 @@
// Code generated by the command above; see README.md. DO NOT EDIT.
//go:build 386 && freebsd
-// +build 386,freebsd
package unix
diff --git a/vendor/golang.org/x/sys/unix/zsysnum_freebsd_amd64.go b/vendor/golang.org/x/sys/unix/zsysnum_freebsd_amd64.go
index 01636b83..34d0b86d 100644
--- a/vendor/golang.org/x/sys/unix/zsysnum_freebsd_amd64.go
+++ b/vendor/golang.org/x/sys/unix/zsysnum_freebsd_amd64.go
@@ -2,7 +2,6 @@
// Code generated by the command above; see README.md. DO NOT EDIT.
//go:build amd64 && freebsd
-// +build amd64,freebsd
package unix
diff --git a/vendor/golang.org/x/sys/unix/zsysnum_freebsd_arm.go b/vendor/golang.org/x/sys/unix/zsysnum_freebsd_arm.go
index ad99bc10..b71cf45e 100644
--- a/vendor/golang.org/x/sys/unix/zsysnum_freebsd_arm.go
+++ b/vendor/golang.org/x/sys/unix/zsysnum_freebsd_arm.go
@@ -2,7 +2,6 @@
// Code generated by the command above; see README.md. DO NOT EDIT.
//go:build arm && freebsd
-// +build arm,freebsd
package unix
diff --git a/vendor/golang.org/x/sys/unix/zsysnum_freebsd_arm64.go b/vendor/golang.org/x/sys/unix/zsysnum_freebsd_arm64.go
index 89dcc427..e32df1c1 100644
--- a/vendor/golang.org/x/sys/unix/zsysnum_freebsd_arm64.go
+++ b/vendor/golang.org/x/sys/unix/zsysnum_freebsd_arm64.go
@@ -2,7 +2,6 @@
// Code generated by the command above; see README.md. DO NOT EDIT.
//go:build arm64 && freebsd
-// +build arm64,freebsd
package unix
diff --git a/vendor/golang.org/x/sys/unix/zsysnum_freebsd_riscv64.go b/vendor/golang.org/x/sys/unix/zsysnum_freebsd_riscv64.go
index ee37aaa0..15ad6111 100644
--- a/vendor/golang.org/x/sys/unix/zsysnum_freebsd_riscv64.go
+++ b/vendor/golang.org/x/sys/unix/zsysnum_freebsd_riscv64.go
@@ -2,7 +2,6 @@
// Code generated by the command above; see README.md. DO NOT EDIT.
//go:build riscv64 && freebsd
-// +build riscv64,freebsd
package unix
diff --git a/vendor/golang.org/x/sys/unix/zsysnum_linux_386.go b/vendor/golang.org/x/sys/unix/zsysnum_linux_386.go
index c9c4ad03..fcf3ecbd 100644
--- a/vendor/golang.org/x/sys/unix/zsysnum_linux_386.go
+++ b/vendor/golang.org/x/sys/unix/zsysnum_linux_386.go
@@ -2,7 +2,6 @@
// Code generated by the command above; see README.md. DO NOT EDIT.
//go:build 386 && linux
-// +build 386,linux
package unix
@@ -447,4 +446,6 @@ const (
SYS_PROCESS_MRELEASE = 448
SYS_FUTEX_WAITV = 449
SYS_SET_MEMPOLICY_HOME_NODE = 450
+ SYS_CACHESTAT = 451
+ SYS_FCHMODAT2 = 452
)
diff --git a/vendor/golang.org/x/sys/unix/zsysnum_linux_amd64.go b/vendor/golang.org/x/sys/unix/zsysnum_linux_amd64.go
index 12ff3417..f56dc250 100644
--- a/vendor/golang.org/x/sys/unix/zsysnum_linux_amd64.go
+++ b/vendor/golang.org/x/sys/unix/zsysnum_linux_amd64.go
@@ -2,7 +2,6 @@
// Code generated by the command above; see README.md. DO NOT EDIT.
//go:build amd64 && linux
-// +build amd64,linux
package unix
@@ -369,4 +368,7 @@ const (
SYS_PROCESS_MRELEASE = 448
SYS_FUTEX_WAITV = 449
SYS_SET_MEMPOLICY_HOME_NODE = 450
+ SYS_CACHESTAT = 451
+ SYS_FCHMODAT2 = 452
+ SYS_MAP_SHADOW_STACK = 453
)
diff --git a/vendor/golang.org/x/sys/unix/zsysnum_linux_arm.go b/vendor/golang.org/x/sys/unix/zsysnum_linux_arm.go
index c3fb5e77..974bf246 100644
--- a/vendor/golang.org/x/sys/unix/zsysnum_linux_arm.go
+++ b/vendor/golang.org/x/sys/unix/zsysnum_linux_arm.go
@@ -2,7 +2,6 @@
// Code generated by the command above; see README.md. DO NOT EDIT.
//go:build arm && linux
-// +build arm,linux
package unix
@@ -411,4 +410,6 @@ const (
SYS_PROCESS_MRELEASE = 448
SYS_FUTEX_WAITV = 449
SYS_SET_MEMPOLICY_HOME_NODE = 450
+ SYS_CACHESTAT = 451
+ SYS_FCHMODAT2 = 452
)
diff --git a/vendor/golang.org/x/sys/unix/zsysnum_linux_arm64.go b/vendor/golang.org/x/sys/unix/zsysnum_linux_arm64.go
index 358c847a..39a2739e 100644
--- a/vendor/golang.org/x/sys/unix/zsysnum_linux_arm64.go
+++ b/vendor/golang.org/x/sys/unix/zsysnum_linux_arm64.go
@@ -2,7 +2,6 @@
// Code generated by the command above; see README.md. DO NOT EDIT.
//go:build arm64 && linux
-// +build arm64,linux
package unix
@@ -314,4 +313,6 @@ const (
SYS_PROCESS_MRELEASE = 448
SYS_FUTEX_WAITV = 449
SYS_SET_MEMPOLICY_HOME_NODE = 450
+ SYS_CACHESTAT = 451
+ SYS_FCHMODAT2 = 452
)
diff --git a/vendor/golang.org/x/sys/unix/zsysnum_linux_loong64.go b/vendor/golang.org/x/sys/unix/zsysnum_linux_loong64.go
index 81c4849b..cf9c9d77 100644
--- a/vendor/golang.org/x/sys/unix/zsysnum_linux_loong64.go
+++ b/vendor/golang.org/x/sys/unix/zsysnum_linux_loong64.go
@@ -2,7 +2,6 @@
// Code generated by the command above; see README.md. DO NOT EDIT.
//go:build loong64 && linux
-// +build loong64,linux
package unix
@@ -308,4 +307,6 @@ const (
SYS_PROCESS_MRELEASE = 448
SYS_FUTEX_WAITV = 449
SYS_SET_MEMPOLICY_HOME_NODE = 450
+ SYS_CACHESTAT = 451
+ SYS_FCHMODAT2 = 452
)
diff --git a/vendor/golang.org/x/sys/unix/zsysnum_linux_mips.go b/vendor/golang.org/x/sys/unix/zsysnum_linux_mips.go
index 202a57e9..10b7362e 100644
--- a/vendor/golang.org/x/sys/unix/zsysnum_linux_mips.go
+++ b/vendor/golang.org/x/sys/unix/zsysnum_linux_mips.go
@@ -2,7 +2,6 @@
// Code generated by the command above; see README.md. DO NOT EDIT.
//go:build mips && linux
-// +build mips,linux
package unix
@@ -431,4 +430,6 @@ const (
SYS_PROCESS_MRELEASE = 4448
SYS_FUTEX_WAITV = 4449
SYS_SET_MEMPOLICY_HOME_NODE = 4450
+ SYS_CACHESTAT = 4451
+ SYS_FCHMODAT2 = 4452
)
diff --git a/vendor/golang.org/x/sys/unix/zsysnum_linux_mips64.go b/vendor/golang.org/x/sys/unix/zsysnum_linux_mips64.go
index 1fbceb52..cd4d8b4f 100644
--- a/vendor/golang.org/x/sys/unix/zsysnum_linux_mips64.go
+++ b/vendor/golang.org/x/sys/unix/zsysnum_linux_mips64.go
@@ -2,7 +2,6 @@
// Code generated by the command above; see README.md. DO NOT EDIT.
//go:build mips64 && linux
-// +build mips64,linux
package unix
@@ -361,4 +360,6 @@ const (
SYS_PROCESS_MRELEASE = 5448
SYS_FUTEX_WAITV = 5449
SYS_SET_MEMPOLICY_HOME_NODE = 5450
+ SYS_CACHESTAT = 5451
+ SYS_FCHMODAT2 = 5452
)
diff --git a/vendor/golang.org/x/sys/unix/zsysnum_linux_mips64le.go b/vendor/golang.org/x/sys/unix/zsysnum_linux_mips64le.go
index b4ffb7a2..2c0efca8 100644
--- a/vendor/golang.org/x/sys/unix/zsysnum_linux_mips64le.go
+++ b/vendor/golang.org/x/sys/unix/zsysnum_linux_mips64le.go
@@ -2,7 +2,6 @@
// Code generated by the command above; see README.md. DO NOT EDIT.
//go:build mips64le && linux
-// +build mips64le,linux
package unix
@@ -361,4 +360,6 @@ const (
SYS_PROCESS_MRELEASE = 5448
SYS_FUTEX_WAITV = 5449
SYS_SET_MEMPOLICY_HOME_NODE = 5450
+ SYS_CACHESTAT = 5451
+ SYS_FCHMODAT2 = 5452
)
diff --git a/vendor/golang.org/x/sys/unix/zsysnum_linux_mipsle.go b/vendor/golang.org/x/sys/unix/zsysnum_linux_mipsle.go
index 867985f9..a72e31d3 100644
--- a/vendor/golang.org/x/sys/unix/zsysnum_linux_mipsle.go
+++ b/vendor/golang.org/x/sys/unix/zsysnum_linux_mipsle.go
@@ -2,7 +2,6 @@
// Code generated by the command above; see README.md. DO NOT EDIT.
//go:build mipsle && linux
-// +build mipsle,linux
package unix
@@ -431,4 +430,6 @@ const (
SYS_PROCESS_MRELEASE = 4448
SYS_FUTEX_WAITV = 4449
SYS_SET_MEMPOLICY_HOME_NODE = 4450
+ SYS_CACHESTAT = 4451
+ SYS_FCHMODAT2 = 4452
)
diff --git a/vendor/golang.org/x/sys/unix/zsysnum_linux_ppc.go b/vendor/golang.org/x/sys/unix/zsysnum_linux_ppc.go
index a8cce69e..c7d1e374 100644
--- a/vendor/golang.org/x/sys/unix/zsysnum_linux_ppc.go
+++ b/vendor/golang.org/x/sys/unix/zsysnum_linux_ppc.go
@@ -2,7 +2,6 @@
// Code generated by the command above; see README.md. DO NOT EDIT.
//go:build ppc && linux
-// +build ppc,linux
package unix
@@ -438,4 +437,6 @@ const (
SYS_PROCESS_MRELEASE = 448
SYS_FUTEX_WAITV = 449
SYS_SET_MEMPOLICY_HOME_NODE = 450
+ SYS_CACHESTAT = 451
+ SYS_FCHMODAT2 = 452
)
diff --git a/vendor/golang.org/x/sys/unix/zsysnum_linux_ppc64.go b/vendor/golang.org/x/sys/unix/zsysnum_linux_ppc64.go
index d44c5b39..f4d4838c 100644
--- a/vendor/golang.org/x/sys/unix/zsysnum_linux_ppc64.go
+++ b/vendor/golang.org/x/sys/unix/zsysnum_linux_ppc64.go
@@ -2,7 +2,6 @@
// Code generated by the command above; see README.md. DO NOT EDIT.
//go:build ppc64 && linux
-// +build ppc64,linux
package unix
@@ -410,4 +409,6 @@ const (
SYS_PROCESS_MRELEASE = 448
SYS_FUTEX_WAITV = 449
SYS_SET_MEMPOLICY_HOME_NODE = 450
+ SYS_CACHESTAT = 451
+ SYS_FCHMODAT2 = 452
)
diff --git a/vendor/golang.org/x/sys/unix/zsysnum_linux_ppc64le.go b/vendor/golang.org/x/sys/unix/zsysnum_linux_ppc64le.go
index 4214dd9c..b64f0e59 100644
--- a/vendor/golang.org/x/sys/unix/zsysnum_linux_ppc64le.go
+++ b/vendor/golang.org/x/sys/unix/zsysnum_linux_ppc64le.go
@@ -2,7 +2,6 @@
// Code generated by the command above; see README.md. DO NOT EDIT.
//go:build ppc64le && linux
-// +build ppc64le,linux
package unix
@@ -410,4 +409,6 @@ const (
SYS_PROCESS_MRELEASE = 448
SYS_FUTEX_WAITV = 449
SYS_SET_MEMPOLICY_HOME_NODE = 450
+ SYS_CACHESTAT = 451
+ SYS_FCHMODAT2 = 452
)
diff --git a/vendor/golang.org/x/sys/unix/zsysnum_linux_riscv64.go b/vendor/golang.org/x/sys/unix/zsysnum_linux_riscv64.go
index ef285c56..95711195 100644
--- a/vendor/golang.org/x/sys/unix/zsysnum_linux_riscv64.go
+++ b/vendor/golang.org/x/sys/unix/zsysnum_linux_riscv64.go
@@ -2,7 +2,6 @@
// Code generated by the command above; see README.md. DO NOT EDIT.
//go:build riscv64 && linux
-// +build riscv64,linux
package unix
@@ -315,4 +314,6 @@ const (
SYS_PROCESS_MRELEASE = 448
SYS_FUTEX_WAITV = 449
SYS_SET_MEMPOLICY_HOME_NODE = 450
+ SYS_CACHESTAT = 451
+ SYS_FCHMODAT2 = 452
)
diff --git a/vendor/golang.org/x/sys/unix/zsysnum_linux_s390x.go b/vendor/golang.org/x/sys/unix/zsysnum_linux_s390x.go
index e6ed7d63..f94e943b 100644
--- a/vendor/golang.org/x/sys/unix/zsysnum_linux_s390x.go
+++ b/vendor/golang.org/x/sys/unix/zsysnum_linux_s390x.go
@@ -2,7 +2,6 @@
// Code generated by the command above; see README.md. DO NOT EDIT.
//go:build s390x && linux
-// +build s390x,linux
package unix
@@ -376,4 +375,6 @@ const (
SYS_PROCESS_MRELEASE = 448
SYS_FUTEX_WAITV = 449
SYS_SET_MEMPOLICY_HOME_NODE = 450
+ SYS_CACHESTAT = 451
+ SYS_FCHMODAT2 = 452
)
diff --git a/vendor/golang.org/x/sys/unix/zsysnum_linux_sparc64.go b/vendor/golang.org/x/sys/unix/zsysnum_linux_sparc64.go
index 92f628ef..ba0c2bc5 100644
--- a/vendor/golang.org/x/sys/unix/zsysnum_linux_sparc64.go
+++ b/vendor/golang.org/x/sys/unix/zsysnum_linux_sparc64.go
@@ -2,7 +2,6 @@
// Code generated by the command above; see README.md. DO NOT EDIT.
//go:build sparc64 && linux
-// +build sparc64,linux
package unix
@@ -389,4 +388,6 @@ const (
SYS_PROCESS_MRELEASE = 448
SYS_FUTEX_WAITV = 449
SYS_SET_MEMPOLICY_HOME_NODE = 450
+ SYS_CACHESTAT = 451
+ SYS_FCHMODAT2 = 452
)
diff --git a/vendor/golang.org/x/sys/unix/zsysnum_netbsd_386.go b/vendor/golang.org/x/sys/unix/zsysnum_netbsd_386.go
index 3a6699eb..b2aa8cd4 100644
--- a/vendor/golang.org/x/sys/unix/zsysnum_netbsd_386.go
+++ b/vendor/golang.org/x/sys/unix/zsysnum_netbsd_386.go
@@ -2,7 +2,6 @@
// Code generated by the command above; see README.md. DO NOT EDIT.
//go:build 386 && netbsd
-// +build 386,netbsd
package unix
diff --git a/vendor/golang.org/x/sys/unix/zsysnum_netbsd_amd64.go b/vendor/golang.org/x/sys/unix/zsysnum_netbsd_amd64.go
index 5677cd4f..524a1b1c 100644
--- a/vendor/golang.org/x/sys/unix/zsysnum_netbsd_amd64.go
+++ b/vendor/golang.org/x/sys/unix/zsysnum_netbsd_amd64.go
@@ -2,7 +2,6 @@
// Code generated by the command above; see README.md. DO NOT EDIT.
//go:build amd64 && netbsd
-// +build amd64,netbsd
package unix
diff --git a/vendor/golang.org/x/sys/unix/zsysnum_netbsd_arm.go b/vendor/golang.org/x/sys/unix/zsysnum_netbsd_arm.go
index e784cb6d..d59b943a 100644
--- a/vendor/golang.org/x/sys/unix/zsysnum_netbsd_arm.go
+++ b/vendor/golang.org/x/sys/unix/zsysnum_netbsd_arm.go
@@ -2,7 +2,6 @@
// Code generated by the command above; see README.md. DO NOT EDIT.
//go:build arm && netbsd
-// +build arm,netbsd
package unix
diff --git a/vendor/golang.org/x/sys/unix/zsysnum_netbsd_arm64.go b/vendor/golang.org/x/sys/unix/zsysnum_netbsd_arm64.go
index bd4952ef..31e771d5 100644
--- a/vendor/golang.org/x/sys/unix/zsysnum_netbsd_arm64.go
+++ b/vendor/golang.org/x/sys/unix/zsysnum_netbsd_arm64.go
@@ -2,7 +2,6 @@
// Code generated by the command above; DO NOT EDIT.
//go:build arm64 && netbsd
-// +build arm64,netbsd
package unix
diff --git a/vendor/golang.org/x/sys/unix/zsysnum_openbsd_386.go b/vendor/golang.org/x/sys/unix/zsysnum_openbsd_386.go
index 59773381..9fd77c6c 100644
--- a/vendor/golang.org/x/sys/unix/zsysnum_openbsd_386.go
+++ b/vendor/golang.org/x/sys/unix/zsysnum_openbsd_386.go
@@ -2,7 +2,6 @@
// Code generated by the command above; see README.md. DO NOT EDIT.
//go:build 386 && openbsd
-// +build 386,openbsd
package unix
diff --git a/vendor/golang.org/x/sys/unix/zsysnum_openbsd_amd64.go b/vendor/golang.org/x/sys/unix/zsysnum_openbsd_amd64.go
index 16af2918..af10af28 100644
--- a/vendor/golang.org/x/sys/unix/zsysnum_openbsd_amd64.go
+++ b/vendor/golang.org/x/sys/unix/zsysnum_openbsd_amd64.go
@@ -2,7 +2,6 @@
// Code generated by the command above; see README.md. DO NOT EDIT.
//go:build amd64 && openbsd
-// +build amd64,openbsd
package unix
diff --git a/vendor/golang.org/x/sys/unix/zsysnum_openbsd_arm.go b/vendor/golang.org/x/sys/unix/zsysnum_openbsd_arm.go
index f59b18a9..cc2028af 100644
--- a/vendor/golang.org/x/sys/unix/zsysnum_openbsd_arm.go
+++ b/vendor/golang.org/x/sys/unix/zsysnum_openbsd_arm.go
@@ -2,7 +2,6 @@
// Code generated by the command above; see README.md. DO NOT EDIT.
//go:build arm && openbsd
-// +build arm,openbsd
package unix
diff --git a/vendor/golang.org/x/sys/unix/zsysnum_openbsd_arm64.go b/vendor/golang.org/x/sys/unix/zsysnum_openbsd_arm64.go
index 721ef591..c06dd441 100644
--- a/vendor/golang.org/x/sys/unix/zsysnum_openbsd_arm64.go
+++ b/vendor/golang.org/x/sys/unix/zsysnum_openbsd_arm64.go
@@ -2,7 +2,6 @@
// Code generated by the command above; see README.md. DO NOT EDIT.
//go:build arm64 && openbsd
-// +build arm64,openbsd
package unix
diff --git a/vendor/golang.org/x/sys/unix/zsysnum_openbsd_mips64.go b/vendor/golang.org/x/sys/unix/zsysnum_openbsd_mips64.go
index 01c43a01..9ddbf3e0 100644
--- a/vendor/golang.org/x/sys/unix/zsysnum_openbsd_mips64.go
+++ b/vendor/golang.org/x/sys/unix/zsysnum_openbsd_mips64.go
@@ -2,7 +2,6 @@
// Code generated by the command above; see README.md. DO NOT EDIT.
//go:build mips64 && openbsd
-// +build mips64,openbsd
package unix
diff --git a/vendor/golang.org/x/sys/unix/zsysnum_openbsd_ppc64.go b/vendor/golang.org/x/sys/unix/zsysnum_openbsd_ppc64.go
index f258cfa2..19a6ee41 100644
--- a/vendor/golang.org/x/sys/unix/zsysnum_openbsd_ppc64.go
+++ b/vendor/golang.org/x/sys/unix/zsysnum_openbsd_ppc64.go
@@ -2,7 +2,6 @@
// Code generated by the command above; see README.md. DO NOT EDIT.
//go:build ppc64 && openbsd
-// +build ppc64,openbsd
package unix
diff --git a/vendor/golang.org/x/sys/unix/zsysnum_openbsd_riscv64.go b/vendor/golang.org/x/sys/unix/zsysnum_openbsd_riscv64.go
index 07919e0e..05192a78 100644
--- a/vendor/golang.org/x/sys/unix/zsysnum_openbsd_riscv64.go
+++ b/vendor/golang.org/x/sys/unix/zsysnum_openbsd_riscv64.go
@@ -2,7 +2,6 @@
// Code generated by the command above; see README.md. DO NOT EDIT.
//go:build riscv64 && openbsd
-// +build riscv64,openbsd
package unix
diff --git a/vendor/golang.org/x/sys/unix/zsysnum_zos_s390x.go b/vendor/golang.org/x/sys/unix/zsysnum_zos_s390x.go
index 073daad4..b2e30858 100644
--- a/vendor/golang.org/x/sys/unix/zsysnum_zos_s390x.go
+++ b/vendor/golang.org/x/sys/unix/zsysnum_zos_s390x.go
@@ -3,7 +3,6 @@
// license that can be found in the LICENSE file.
//go:build zos && s390x
-// +build zos,s390x
package unix
diff --git a/vendor/golang.org/x/sys/unix/ztypes_aix_ppc.go b/vendor/golang.org/x/sys/unix/ztypes_aix_ppc.go
index 7a8161c1..3e6d57ca 100644
--- a/vendor/golang.org/x/sys/unix/ztypes_aix_ppc.go
+++ b/vendor/golang.org/x/sys/unix/ztypes_aix_ppc.go
@@ -2,7 +2,6 @@
// Code generated by the command above; see README.md. DO NOT EDIT.
//go:build ppc && aix
-// +build ppc,aix
package unix
diff --git a/vendor/golang.org/x/sys/unix/ztypes_aix_ppc64.go b/vendor/golang.org/x/sys/unix/ztypes_aix_ppc64.go
index 07ed733c..3a219bdc 100644
--- a/vendor/golang.org/x/sys/unix/ztypes_aix_ppc64.go
+++ b/vendor/golang.org/x/sys/unix/ztypes_aix_ppc64.go
@@ -2,7 +2,6 @@
// Code generated by the command above; see README.md. DO NOT EDIT.
//go:build ppc64 && aix
-// +build ppc64,aix
package unix
diff --git a/vendor/golang.org/x/sys/unix/ztypes_darwin_amd64.go b/vendor/golang.org/x/sys/unix/ztypes_darwin_amd64.go
index 690cefc3..091d107f 100644
--- a/vendor/golang.org/x/sys/unix/ztypes_darwin_amd64.go
+++ b/vendor/golang.org/x/sys/unix/ztypes_darwin_amd64.go
@@ -2,7 +2,6 @@
// Code generated by the command above; see README.md. DO NOT EDIT.
//go:build amd64 && darwin
-// +build amd64,darwin
package unix
diff --git a/vendor/golang.org/x/sys/unix/ztypes_darwin_arm64.go b/vendor/golang.org/x/sys/unix/ztypes_darwin_arm64.go
index 5bffc10e..28ff4ef7 100644
--- a/vendor/golang.org/x/sys/unix/ztypes_darwin_arm64.go
+++ b/vendor/golang.org/x/sys/unix/ztypes_darwin_arm64.go
@@ -2,7 +2,6 @@
// Code generated by the command above; see README.md. DO NOT EDIT.
//go:build arm64 && darwin
-// +build arm64,darwin
package unix
diff --git a/vendor/golang.org/x/sys/unix/ztypes_dragonfly_amd64.go b/vendor/golang.org/x/sys/unix/ztypes_dragonfly_amd64.go
index d0ba8e9b..30e405bb 100644
--- a/vendor/golang.org/x/sys/unix/ztypes_dragonfly_amd64.go
+++ b/vendor/golang.org/x/sys/unix/ztypes_dragonfly_amd64.go
@@ -2,7 +2,6 @@
// Code generated by the command above; see README.md. DO NOT EDIT.
//go:build amd64 && dragonfly
-// +build amd64,dragonfly
package unix
diff --git a/vendor/golang.org/x/sys/unix/ztypes_freebsd_386.go b/vendor/golang.org/x/sys/unix/ztypes_freebsd_386.go
index 29dc4833..6cbd094a 100644
--- a/vendor/golang.org/x/sys/unix/ztypes_freebsd_386.go
+++ b/vendor/golang.org/x/sys/unix/ztypes_freebsd_386.go
@@ -2,7 +2,6 @@
// Code generated by the command above; see README.md. DO NOT EDIT.
//go:build 386 && freebsd
-// +build 386,freebsd
package unix
diff --git a/vendor/golang.org/x/sys/unix/ztypes_freebsd_amd64.go b/vendor/golang.org/x/sys/unix/ztypes_freebsd_amd64.go
index 0a89b289..7c03b6ee 100644
--- a/vendor/golang.org/x/sys/unix/ztypes_freebsd_amd64.go
+++ b/vendor/golang.org/x/sys/unix/ztypes_freebsd_amd64.go
@@ -2,7 +2,6 @@
// Code generated by the command above; see README.md. DO NOT EDIT.
//go:build amd64 && freebsd
-// +build amd64,freebsd
package unix
diff --git a/vendor/golang.org/x/sys/unix/ztypes_freebsd_arm.go b/vendor/golang.org/x/sys/unix/ztypes_freebsd_arm.go
index c8666bb1..422107ee 100644
--- a/vendor/golang.org/x/sys/unix/ztypes_freebsd_arm.go
+++ b/vendor/golang.org/x/sys/unix/ztypes_freebsd_arm.go
@@ -2,7 +2,6 @@
// Code generated by the command above; see README.md. DO NOT EDIT.
//go:build arm && freebsd
-// +build arm,freebsd
package unix
diff --git a/vendor/golang.org/x/sys/unix/ztypes_freebsd_arm64.go b/vendor/golang.org/x/sys/unix/ztypes_freebsd_arm64.go
index 88fb48a8..505a12ac 100644
--- a/vendor/golang.org/x/sys/unix/ztypes_freebsd_arm64.go
+++ b/vendor/golang.org/x/sys/unix/ztypes_freebsd_arm64.go
@@ -2,7 +2,6 @@
// Code generated by the command above; see README.md. DO NOT EDIT.
//go:build arm64 && freebsd
-// +build arm64,freebsd
package unix
diff --git a/vendor/golang.org/x/sys/unix/ztypes_freebsd_riscv64.go b/vendor/golang.org/x/sys/unix/ztypes_freebsd_riscv64.go
index 698dc975..cc986c79 100644
--- a/vendor/golang.org/x/sys/unix/ztypes_freebsd_riscv64.go
+++ b/vendor/golang.org/x/sys/unix/ztypes_freebsd_riscv64.go
@@ -2,7 +2,6 @@
// Code generated by the command above; see README.md. DO NOT EDIT.
//go:build riscv64 && freebsd
-// +build riscv64,freebsd
package unix
diff --git a/vendor/golang.org/x/sys/unix/ztypes_linux.go b/vendor/golang.org/x/sys/unix/ztypes_linux.go
index 494493c7..bbf8399f 100644
--- a/vendor/golang.org/x/sys/unix/ztypes_linux.go
+++ b/vendor/golang.org/x/sys/unix/ztypes_linux.go
@@ -1,7 +1,6 @@
// Code generated by mkmerge; DO NOT EDIT.
//go:build linux
-// +build linux
package unix
@@ -1977,7 +1976,7 @@ const (
NFT_MSG_GETFLOWTABLE = 0x17
NFT_MSG_DELFLOWTABLE = 0x18
NFT_MSG_GETRULE_RESET = 0x19
- NFT_MSG_MAX = 0x21
+ NFT_MSG_MAX = 0x22
NFTA_LIST_UNSPEC = 0x0
NFTA_LIST_ELEM = 0x1
NFTA_HOOK_UNSPEC = 0x0
@@ -2672,6 +2671,7 @@ const (
BPF_PROG_TYPE_LSM = 0x1d
BPF_PROG_TYPE_SK_LOOKUP = 0x1e
BPF_PROG_TYPE_SYSCALL = 0x1f
+ BPF_PROG_TYPE_NETFILTER = 0x20
BPF_CGROUP_INET_INGRESS = 0x0
BPF_CGROUP_INET_EGRESS = 0x1
BPF_CGROUP_INET_SOCK_CREATE = 0x2
@@ -2716,6 +2716,11 @@ const (
BPF_PERF_EVENT = 0x29
BPF_TRACE_KPROBE_MULTI = 0x2a
BPF_LSM_CGROUP = 0x2b
+ BPF_STRUCT_OPS = 0x2c
+ BPF_NETFILTER = 0x2d
+ BPF_TCX_INGRESS = 0x2e
+ BPF_TCX_EGRESS = 0x2f
+ BPF_TRACE_UPROBE_MULTI = 0x30
BPF_LINK_TYPE_UNSPEC = 0x0
BPF_LINK_TYPE_RAW_TRACEPOINT = 0x1
BPF_LINK_TYPE_TRACING = 0x2
@@ -2726,6 +2731,18 @@ const (
BPF_LINK_TYPE_PERF_EVENT = 0x7
BPF_LINK_TYPE_KPROBE_MULTI = 0x8
BPF_LINK_TYPE_STRUCT_OPS = 0x9
+ BPF_LINK_TYPE_NETFILTER = 0xa
+ BPF_LINK_TYPE_TCX = 0xb
+ BPF_LINK_TYPE_UPROBE_MULTI = 0xc
+ BPF_PERF_EVENT_UNSPEC = 0x0
+ BPF_PERF_EVENT_UPROBE = 0x1
+ BPF_PERF_EVENT_URETPROBE = 0x2
+ BPF_PERF_EVENT_KPROBE = 0x3
+ BPF_PERF_EVENT_KRETPROBE = 0x4
+ BPF_PERF_EVENT_TRACEPOINT = 0x5
+ BPF_PERF_EVENT_EVENT = 0x6
+ BPF_F_KPROBE_MULTI_RETURN = 0x1
+ BPF_F_UPROBE_MULTI_RETURN = 0x1
BPF_ANY = 0x0
BPF_NOEXIST = 0x1
BPF_EXIST = 0x2
@@ -2743,6 +2760,8 @@ const (
BPF_F_MMAPABLE = 0x400
BPF_F_PRESERVE_ELEMS = 0x800
BPF_F_INNER_MAP = 0x1000
+ BPF_F_LINK = 0x2000
+ BPF_F_PATH_FD = 0x4000
BPF_STATS_RUN_TIME = 0x0
BPF_STACK_BUILD_ID_EMPTY = 0x0
BPF_STACK_BUILD_ID_VALID = 0x1
@@ -2763,6 +2782,7 @@ const (
BPF_F_ZERO_CSUM_TX = 0x2
BPF_F_DONT_FRAGMENT = 0x4
BPF_F_SEQ_NUMBER = 0x8
+ BPF_F_NO_TUNNEL_KEY = 0x10
BPF_F_TUNINFO_FLAGS = 0x10
BPF_F_INDEX_MASK = 0xffffffff
BPF_F_CURRENT_CPU = 0xffffffff
@@ -2779,6 +2799,8 @@ const (
BPF_F_ADJ_ROOM_ENCAP_L4_UDP = 0x10
BPF_F_ADJ_ROOM_NO_CSUM_RESET = 0x20
BPF_F_ADJ_ROOM_ENCAP_L2_ETH = 0x40
+ BPF_F_ADJ_ROOM_DECAP_L3_IPV4 = 0x80
+ BPF_F_ADJ_ROOM_DECAP_L3_IPV6 = 0x100
BPF_ADJ_ROOM_ENCAP_L2_MASK = 0xff
BPF_ADJ_ROOM_ENCAP_L2_SHIFT = 0x38
BPF_F_SYSCTL_BASE_NAME = 0x1
@@ -2867,6 +2889,8 @@ const (
BPF_DEVCG_DEV_CHAR = 0x2
BPF_FIB_LOOKUP_DIRECT = 0x1
BPF_FIB_LOOKUP_OUTPUT = 0x2
+ BPF_FIB_LOOKUP_SKIP_NEIGH = 0x4
+ BPF_FIB_LOOKUP_TBID = 0x8
BPF_FIB_LKUP_RET_SUCCESS = 0x0
BPF_FIB_LKUP_RET_BLACKHOLE = 0x1
BPF_FIB_LKUP_RET_UNREACHABLE = 0x2
@@ -2902,6 +2926,7 @@ const (
BPF_CORE_ENUMVAL_EXISTS = 0xa
BPF_CORE_ENUMVAL_VALUE = 0xb
BPF_CORE_TYPE_MATCHES = 0xc
+ BPF_F_TIMER_ABS = 0x1
)
const (
@@ -2980,6 +3005,12 @@ type LoopInfo64 struct {
Encrypt_key [32]uint8
Init [2]uint64
}
+type LoopConfig struct {
+ Fd uint32
+ Size uint32
+ Info LoopInfo64
+ _ [8]uint64
+}
type TIPCSocketAddr struct {
Ref uint32
@@ -4499,7 +4530,7 @@ const (
NL80211_ATTR_MAC_HINT = 0xc8
NL80211_ATTR_MAC_MASK = 0xd7
NL80211_ATTR_MAX_AP_ASSOC_STA = 0xca
- NL80211_ATTR_MAX = 0x145
+ NL80211_ATTR_MAX = 0x146
NL80211_ATTR_MAX_CRIT_PROT_DURATION = 0xb4
NL80211_ATTR_MAX_CSA_COUNTERS = 0xce
NL80211_ATTR_MAX_MATCH_SETS = 0x85
@@ -4869,7 +4900,7 @@ const (
NL80211_CMD_LEAVE_IBSS = 0x2c
NL80211_CMD_LEAVE_MESH = 0x45
NL80211_CMD_LEAVE_OCB = 0x6d
- NL80211_CMD_MAX = 0x99
+ NL80211_CMD_MAX = 0x9a
NL80211_CMD_MICHAEL_MIC_FAILURE = 0x29
NL80211_CMD_MODIFY_LINK_STA = 0x97
NL80211_CMD_NAN_MATCH = 0x78
@@ -5503,7 +5534,7 @@ const (
NL80211_RATE_INFO_HE_RU_ALLOC_52 = 0x1
NL80211_RATE_INFO_HE_RU_ALLOC_996 = 0x5
NL80211_RATE_INFO_HE_RU_ALLOC = 0x11
- NL80211_RATE_INFO_MAX = 0x16
+ NL80211_RATE_INFO_MAX = 0x1d
NL80211_RATE_INFO_MCS = 0x2
NL80211_RATE_INFO_SHORT_GI = 0x4
NL80211_RATE_INFO_VHT_MCS = 0x6
@@ -5883,3 +5914,15 @@ type SchedAttr struct {
}
const SizeofSchedAttr = 0x38
+
+type Cachestat_t struct {
+ Cache uint64
+ Dirty uint64
+ Writeback uint64
+ Evicted uint64
+ Recently_evicted uint64
+}
+type CachestatRange struct {
+ Off uint64
+ Len uint64
+}
diff --git a/vendor/golang.org/x/sys/unix/ztypes_linux_386.go b/vendor/golang.org/x/sys/unix/ztypes_linux_386.go
index 6d8acbcc..438a30af 100644
--- a/vendor/golang.org/x/sys/unix/ztypes_linux_386.go
+++ b/vendor/golang.org/x/sys/unix/ztypes_linux_386.go
@@ -2,7 +2,6 @@
// Code generated by the command above; see README.md. DO NOT EDIT.
//go:build 386 && linux
-// +build 386,linux
package unix
diff --git a/vendor/golang.org/x/sys/unix/ztypes_linux_amd64.go b/vendor/golang.org/x/sys/unix/ztypes_linux_amd64.go
index 59293c68..adceca35 100644
--- a/vendor/golang.org/x/sys/unix/ztypes_linux_amd64.go
+++ b/vendor/golang.org/x/sys/unix/ztypes_linux_amd64.go
@@ -2,7 +2,6 @@
// Code generated by the command above; see README.md. DO NOT EDIT.
//go:build amd64 && linux
-// +build amd64,linux
package unix
diff --git a/vendor/golang.org/x/sys/unix/ztypes_linux_arm.go b/vendor/golang.org/x/sys/unix/ztypes_linux_arm.go
index 40cfa38c..eeaa00a3 100644
--- a/vendor/golang.org/x/sys/unix/ztypes_linux_arm.go
+++ b/vendor/golang.org/x/sys/unix/ztypes_linux_arm.go
@@ -2,7 +2,6 @@
// Code generated by the command above; see README.md. DO NOT EDIT.
//go:build arm && linux
-// +build arm,linux
package unix
diff --git a/vendor/golang.org/x/sys/unix/ztypes_linux_arm64.go b/vendor/golang.org/x/sys/unix/ztypes_linux_arm64.go
index 055bc421..6739aa91 100644
--- a/vendor/golang.org/x/sys/unix/ztypes_linux_arm64.go
+++ b/vendor/golang.org/x/sys/unix/ztypes_linux_arm64.go
@@ -2,7 +2,6 @@
// Code generated by the command above; see README.md. DO NOT EDIT.
//go:build arm64 && linux
-// +build arm64,linux
package unix
diff --git a/vendor/golang.org/x/sys/unix/ztypes_linux_loong64.go b/vendor/golang.org/x/sys/unix/ztypes_linux_loong64.go
index f28affbc..9920ef63 100644
--- a/vendor/golang.org/x/sys/unix/ztypes_linux_loong64.go
+++ b/vendor/golang.org/x/sys/unix/ztypes_linux_loong64.go
@@ -2,7 +2,6 @@
// Code generated by the command above; see README.md. DO NOT EDIT.
//go:build loong64 && linux
-// +build loong64,linux
package unix
diff --git a/vendor/golang.org/x/sys/unix/ztypes_linux_mips.go b/vendor/golang.org/x/sys/unix/ztypes_linux_mips.go
index 9d71e7cc..2923b799 100644
--- a/vendor/golang.org/x/sys/unix/ztypes_linux_mips.go
+++ b/vendor/golang.org/x/sys/unix/ztypes_linux_mips.go
@@ -2,7 +2,6 @@
// Code generated by the command above; see README.md. DO NOT EDIT.
//go:build mips && linux
-// +build mips,linux
package unix
diff --git a/vendor/golang.org/x/sys/unix/ztypes_linux_mips64.go b/vendor/golang.org/x/sys/unix/ztypes_linux_mips64.go
index fd5ccd33..ce2750ee 100644
--- a/vendor/golang.org/x/sys/unix/ztypes_linux_mips64.go
+++ b/vendor/golang.org/x/sys/unix/ztypes_linux_mips64.go
@@ -2,7 +2,6 @@
// Code generated by the command above; see README.md. DO NOT EDIT.
//go:build mips64 && linux
-// +build mips64,linux
package unix
diff --git a/vendor/golang.org/x/sys/unix/ztypes_linux_mips64le.go b/vendor/golang.org/x/sys/unix/ztypes_linux_mips64le.go
index 7704de77..3038811d 100644
--- a/vendor/golang.org/x/sys/unix/ztypes_linux_mips64le.go
+++ b/vendor/golang.org/x/sys/unix/ztypes_linux_mips64le.go
@@ -2,7 +2,6 @@
// Code generated by the command above; see README.md. DO NOT EDIT.
//go:build mips64le && linux
-// +build mips64le,linux
package unix
diff --git a/vendor/golang.org/x/sys/unix/ztypes_linux_mipsle.go b/vendor/golang.org/x/sys/unix/ztypes_linux_mipsle.go
index df00b875..efc6fed1 100644
--- a/vendor/golang.org/x/sys/unix/ztypes_linux_mipsle.go
+++ b/vendor/golang.org/x/sys/unix/ztypes_linux_mipsle.go
@@ -2,7 +2,6 @@
// Code generated by the command above; see README.md. DO NOT EDIT.
//go:build mipsle && linux
-// +build mipsle,linux
package unix
diff --git a/vendor/golang.org/x/sys/unix/ztypes_linux_ppc.go b/vendor/golang.org/x/sys/unix/ztypes_linux_ppc.go
index 0942840d..9a654b75 100644
--- a/vendor/golang.org/x/sys/unix/ztypes_linux_ppc.go
+++ b/vendor/golang.org/x/sys/unix/ztypes_linux_ppc.go
@@ -2,7 +2,6 @@
// Code generated by the command above; see README.md. DO NOT EDIT.
//go:build ppc && linux
-// +build ppc,linux
package unix
diff --git a/vendor/golang.org/x/sys/unix/ztypes_linux_ppc64.go b/vendor/golang.org/x/sys/unix/ztypes_linux_ppc64.go
index 03487439..40d358e3 100644
--- a/vendor/golang.org/x/sys/unix/ztypes_linux_ppc64.go
+++ b/vendor/golang.org/x/sys/unix/ztypes_linux_ppc64.go
@@ -2,7 +2,6 @@
// Code generated by the command above; see README.md. DO NOT EDIT.
//go:build ppc64 && linux
-// +build ppc64,linux
package unix
diff --git a/vendor/golang.org/x/sys/unix/ztypes_linux_ppc64le.go b/vendor/golang.org/x/sys/unix/ztypes_linux_ppc64le.go
index bad06704..148c6ceb 100644
--- a/vendor/golang.org/x/sys/unix/ztypes_linux_ppc64le.go
+++ b/vendor/golang.org/x/sys/unix/ztypes_linux_ppc64le.go
@@ -2,7 +2,6 @@
// Code generated by the command above; see README.md. DO NOT EDIT.
//go:build ppc64le && linux
-// +build ppc64le,linux
package unix
diff --git a/vendor/golang.org/x/sys/unix/ztypes_linux_riscv64.go b/vendor/golang.org/x/sys/unix/ztypes_linux_riscv64.go
index 83c69c11..72ba8154 100644
--- a/vendor/golang.org/x/sys/unix/ztypes_linux_riscv64.go
+++ b/vendor/golang.org/x/sys/unix/ztypes_linux_riscv64.go
@@ -2,7 +2,6 @@
// Code generated by the command above; see README.md. DO NOT EDIT.
//go:build riscv64 && linux
-// +build riscv64,linux
package unix
@@ -733,6 +732,10 @@ const (
RISCV_HWPROBE_KEY_IMA_EXT_0 = 0x4
RISCV_HWPROBE_IMA_FD = 0x1
RISCV_HWPROBE_IMA_C = 0x2
+ RISCV_HWPROBE_IMA_V = 0x4
+ RISCV_HWPROBE_EXT_ZBA = 0x8
+ RISCV_HWPROBE_EXT_ZBB = 0x10
+ RISCV_HWPROBE_EXT_ZBS = 0x20
RISCV_HWPROBE_KEY_CPUPERF_0 = 0x5
RISCV_HWPROBE_MISALIGNED_UNKNOWN = 0x0
RISCV_HWPROBE_MISALIGNED_EMULATED = 0x1
diff --git a/vendor/golang.org/x/sys/unix/ztypes_linux_s390x.go b/vendor/golang.org/x/sys/unix/ztypes_linux_s390x.go
index aa268d02..71e76550 100644
--- a/vendor/golang.org/x/sys/unix/ztypes_linux_s390x.go
+++ b/vendor/golang.org/x/sys/unix/ztypes_linux_s390x.go
@@ -2,7 +2,6 @@
// Code generated by the command above; see README.md. DO NOT EDIT.
//go:build s390x && linux
-// +build s390x,linux
package unix
diff --git a/vendor/golang.org/x/sys/unix/ztypes_linux_sparc64.go b/vendor/golang.org/x/sys/unix/ztypes_linux_sparc64.go
index 444045b6..4abbdb9d 100644
--- a/vendor/golang.org/x/sys/unix/ztypes_linux_sparc64.go
+++ b/vendor/golang.org/x/sys/unix/ztypes_linux_sparc64.go
@@ -2,7 +2,6 @@
// Code generated by the command above; see README.md. DO NOT EDIT.
//go:build sparc64 && linux
-// +build sparc64,linux
package unix
diff --git a/vendor/golang.org/x/sys/unix/ztypes_netbsd_386.go b/vendor/golang.org/x/sys/unix/ztypes_netbsd_386.go
index 9bc4c8f9..f22e7947 100644
--- a/vendor/golang.org/x/sys/unix/ztypes_netbsd_386.go
+++ b/vendor/golang.org/x/sys/unix/ztypes_netbsd_386.go
@@ -2,7 +2,6 @@
// Code generated by the command above; see README.md. DO NOT EDIT.
//go:build 386 && netbsd
-// +build 386,netbsd
package unix
diff --git a/vendor/golang.org/x/sys/unix/ztypes_netbsd_amd64.go b/vendor/golang.org/x/sys/unix/ztypes_netbsd_amd64.go
index bb05f655..066a7d83 100644
--- a/vendor/golang.org/x/sys/unix/ztypes_netbsd_amd64.go
+++ b/vendor/golang.org/x/sys/unix/ztypes_netbsd_amd64.go
@@ -2,7 +2,6 @@
// Code generated by the command above; see README.md. DO NOT EDIT.
//go:build amd64 && netbsd
-// +build amd64,netbsd
package unix
diff --git a/vendor/golang.org/x/sys/unix/ztypes_netbsd_arm.go b/vendor/golang.org/x/sys/unix/ztypes_netbsd_arm.go
index db40e3a1..439548ec 100644
--- a/vendor/golang.org/x/sys/unix/ztypes_netbsd_arm.go
+++ b/vendor/golang.org/x/sys/unix/ztypes_netbsd_arm.go
@@ -2,7 +2,6 @@
// Code generated by the command above; see README.md. DO NOT EDIT.
//go:build arm && netbsd
-// +build arm,netbsd
package unix
diff --git a/vendor/golang.org/x/sys/unix/ztypes_netbsd_arm64.go b/vendor/golang.org/x/sys/unix/ztypes_netbsd_arm64.go
index 11121151..16085d3b 100644
--- a/vendor/golang.org/x/sys/unix/ztypes_netbsd_arm64.go
+++ b/vendor/golang.org/x/sys/unix/ztypes_netbsd_arm64.go
@@ -2,7 +2,6 @@
// Code generated by the command above; see README.md. DO NOT EDIT.
//go:build arm64 && netbsd
-// +build arm64,netbsd
package unix
diff --git a/vendor/golang.org/x/sys/unix/ztypes_openbsd_386.go b/vendor/golang.org/x/sys/unix/ztypes_openbsd_386.go
index 26eba23b..afd13a3a 100644
--- a/vendor/golang.org/x/sys/unix/ztypes_openbsd_386.go
+++ b/vendor/golang.org/x/sys/unix/ztypes_openbsd_386.go
@@ -2,7 +2,6 @@
// Code generated by the command above; see README.md. DO NOT EDIT.
//go:build 386 && openbsd
-// +build 386,openbsd
package unix
diff --git a/vendor/golang.org/x/sys/unix/ztypes_openbsd_amd64.go b/vendor/golang.org/x/sys/unix/ztypes_openbsd_amd64.go
index 5a547988..5d97f1f9 100644
--- a/vendor/golang.org/x/sys/unix/ztypes_openbsd_amd64.go
+++ b/vendor/golang.org/x/sys/unix/ztypes_openbsd_amd64.go
@@ -2,7 +2,6 @@
// Code generated by the command above; see README.md. DO NOT EDIT.
//go:build amd64 && openbsd
-// +build amd64,openbsd
package unix
diff --git a/vendor/golang.org/x/sys/unix/ztypes_openbsd_arm.go b/vendor/golang.org/x/sys/unix/ztypes_openbsd_arm.go
index be58c4e1..34871cdc 100644
--- a/vendor/golang.org/x/sys/unix/ztypes_openbsd_arm.go
+++ b/vendor/golang.org/x/sys/unix/ztypes_openbsd_arm.go
@@ -2,7 +2,6 @@
// Code generated by the command above; see README.md. DO NOT EDIT.
//go:build arm && openbsd
-// +build arm,openbsd
package unix
diff --git a/vendor/golang.org/x/sys/unix/ztypes_openbsd_arm64.go b/vendor/golang.org/x/sys/unix/ztypes_openbsd_arm64.go
index 52338266..5911bceb 100644
--- a/vendor/golang.org/x/sys/unix/ztypes_openbsd_arm64.go
+++ b/vendor/golang.org/x/sys/unix/ztypes_openbsd_arm64.go
@@ -2,7 +2,6 @@
// Code generated by the command above; see README.md. DO NOT EDIT.
//go:build arm64 && openbsd
-// +build arm64,openbsd
package unix
diff --git a/vendor/golang.org/x/sys/unix/ztypes_openbsd_mips64.go b/vendor/golang.org/x/sys/unix/ztypes_openbsd_mips64.go
index 605cfdb1..e4f24f3b 100644
--- a/vendor/golang.org/x/sys/unix/ztypes_openbsd_mips64.go
+++ b/vendor/golang.org/x/sys/unix/ztypes_openbsd_mips64.go
@@ -2,7 +2,6 @@
// Code generated by the command above; see README.md. DO NOT EDIT.
//go:build mips64 && openbsd
-// +build mips64,openbsd
package unix
diff --git a/vendor/golang.org/x/sys/unix/ztypes_openbsd_ppc64.go b/vendor/golang.org/x/sys/unix/ztypes_openbsd_ppc64.go
index d6724c01..ca50a793 100644
--- a/vendor/golang.org/x/sys/unix/ztypes_openbsd_ppc64.go
+++ b/vendor/golang.org/x/sys/unix/ztypes_openbsd_ppc64.go
@@ -2,7 +2,6 @@
// Code generated by the command above; see README.md. DO NOT EDIT.
//go:build ppc64 && openbsd
-// +build ppc64,openbsd
package unix
diff --git a/vendor/golang.org/x/sys/unix/ztypes_openbsd_riscv64.go b/vendor/golang.org/x/sys/unix/ztypes_openbsd_riscv64.go
index ddfd27a4..d7d7f790 100644
--- a/vendor/golang.org/x/sys/unix/ztypes_openbsd_riscv64.go
+++ b/vendor/golang.org/x/sys/unix/ztypes_openbsd_riscv64.go
@@ -2,7 +2,6 @@
// Code generated by the command above; see README.md. DO NOT EDIT.
//go:build riscv64 && openbsd
-// +build riscv64,openbsd
package unix
diff --git a/vendor/golang.org/x/sys/unix/ztypes_solaris_amd64.go b/vendor/golang.org/x/sys/unix/ztypes_solaris_amd64.go
index 0400747c..14160576 100644
--- a/vendor/golang.org/x/sys/unix/ztypes_solaris_amd64.go
+++ b/vendor/golang.org/x/sys/unix/ztypes_solaris_amd64.go
@@ -2,7 +2,6 @@
// Code generated by the command above; see README.md. DO NOT EDIT.
//go:build amd64 && solaris
-// +build amd64,solaris
package unix
diff --git a/vendor/golang.org/x/sys/unix/ztypes_zos_s390x.go b/vendor/golang.org/x/sys/unix/ztypes_zos_s390x.go
index aec1efcb..54f31be6 100644
--- a/vendor/golang.org/x/sys/unix/ztypes_zos_s390x.go
+++ b/vendor/golang.org/x/sys/unix/ztypes_zos_s390x.go
@@ -3,7 +3,6 @@
// license that can be found in the LICENSE file.
//go:build zos && s390x
-// +build zos,s390x
// Hand edited based on ztypes_linux_s390x.go
// TODO: auto-generate.
diff --git a/vendor/golang.org/x/sys/windows/aliases.go b/vendor/golang.org/x/sys/windows/aliases.go
index a20ebea6..ce2d713d 100644
--- a/vendor/golang.org/x/sys/windows/aliases.go
+++ b/vendor/golang.org/x/sys/windows/aliases.go
@@ -3,7 +3,6 @@
// license that can be found in the LICENSE file.
//go:build windows && go1.9
-// +build windows,go1.9
package windows
diff --git a/vendor/golang.org/x/sys/windows/empty.s b/vendor/golang.org/x/sys/windows/empty.s
index fdbbbcd3..ba64caca 100644
--- a/vendor/golang.org/x/sys/windows/empty.s
+++ b/vendor/golang.org/x/sys/windows/empty.s
@@ -3,7 +3,6 @@
// license that can be found in the LICENSE file.
//go:build !go1.12
-// +build !go1.12
// This file is here to allow bodyless functions with go:linkname for Go 1.11
// and earlier (see https://golang.org/issue/23311).
diff --git a/vendor/golang.org/x/sys/windows/eventlog.go b/vendor/golang.org/x/sys/windows/eventlog.go
index 2cd60645..6c366955 100644
--- a/vendor/golang.org/x/sys/windows/eventlog.go
+++ b/vendor/golang.org/x/sys/windows/eventlog.go
@@ -3,7 +3,6 @@
// license that can be found in the LICENSE file.
//go:build windows
-// +build windows
package windows
diff --git a/vendor/golang.org/x/sys/windows/exec_windows.go b/vendor/golang.org/x/sys/windows/exec_windows.go
index a52e0331..9cabbb69 100644
--- a/vendor/golang.org/x/sys/windows/exec_windows.go
+++ b/vendor/golang.org/x/sys/windows/exec_windows.go
@@ -22,7 +22,7 @@ import (
// but only if there is space or tab inside s.
func EscapeArg(s string) string {
if len(s) == 0 {
- return "\"\""
+ return `""`
}
n := len(s)
hasSpace := false
@@ -35,7 +35,7 @@ func EscapeArg(s string) string {
}
}
if hasSpace {
- n += 2
+ n += 2 // Reserve space for quotes.
}
if n == len(s) {
return s
@@ -82,20 +82,68 @@ func EscapeArg(s string) string {
// in CreateProcess's CommandLine argument, CreateService/ChangeServiceConfig's BinaryPathName argument,
// or any program that uses CommandLineToArgv.
func ComposeCommandLine(args []string) string {
- var commandLine string
- for i := range args {
- if i > 0 {
- commandLine += " "
+ if len(args) == 0 {
+ return ""
+ }
+
+ // Per https://learn.microsoft.com/en-us/windows/win32/api/shellapi/nf-shellapi-commandlinetoargvw:
+ // “This function accepts command lines that contain a program name; the
+ // program name can be enclosed in quotation marks or not.”
+ //
+ // Unfortunately, it provides no means of escaping interior quotation marks
+ // within that program name, and we have no way to report them here.
+ prog := args[0]
+ mustQuote := len(prog) == 0
+ for i := 0; i < len(prog); i++ {
+ c := prog[i]
+ if c <= ' ' || (c == '"' && i == 0) {
+ // Force quotes for not only the ASCII space and tab as described in the
+ // MSDN article, but also ASCII control characters.
+ // The documentation for CommandLineToArgvW doesn't say what happens when
+ // the first argument is not a valid program name, but it empirically
+ // seems to drop unquoted control characters.
+ mustQuote = true
+ break
+ }
+ }
+ var commandLine []byte
+ if mustQuote {
+ commandLine = make([]byte, 0, len(prog)+2)
+ commandLine = append(commandLine, '"')
+ for i := 0; i < len(prog); i++ {
+ c := prog[i]
+ if c == '"' {
+ // This quote would interfere with our surrounding quotes.
+ // We have no way to report an error, so just strip out
+ // the offending character instead.
+ continue
+ }
+ commandLine = append(commandLine, c)
}
- commandLine += EscapeArg(args[i])
+ commandLine = append(commandLine, '"')
+ } else {
+ if len(args) == 1 {
+ // args[0] is a valid command line representing itself.
+ // No need to allocate a new slice or string for it.
+ return prog
+ }
+ commandLine = []byte(prog)
}
- return commandLine
+
+ for _, arg := range args[1:] {
+ commandLine = append(commandLine, ' ')
+ // TODO(bcmills): since we're already appending to a slice, it would be nice
+ // to avoid the intermediate allocations of EscapeArg.
+ // Perhaps we can factor out an appendEscapedArg function.
+ commandLine = append(commandLine, EscapeArg(arg)...)
+ }
+ return string(commandLine)
}
// DecomposeCommandLine breaks apart its argument command line into unescaped parts using CommandLineToArgv,
// as gathered from GetCommandLine, QUERY_SERVICE_CONFIG's BinaryPathName argument, or elsewhere that
// command lines are passed around.
-// DecomposeCommandLine returns error if commandLine contains NUL.
+// DecomposeCommandLine returns an error if commandLine contains NUL.
func DecomposeCommandLine(commandLine string) ([]string, error) {
if len(commandLine) == 0 {
return []string{}, nil
@@ -105,18 +153,35 @@ func DecomposeCommandLine(commandLine string) ([]string, error) {
return nil, errorspkg.New("string with NUL passed to DecomposeCommandLine")
}
var argc int32
- argv, err := CommandLineToArgv(&utf16CommandLine[0], &argc)
+ argv, err := commandLineToArgv(&utf16CommandLine[0], &argc)
if err != nil {
return nil, err
}
defer LocalFree(Handle(unsafe.Pointer(argv)))
+
var args []string
- for _, v := range (*argv)[:argc] {
- args = append(args, UTF16ToString((*v)[:]))
+ for _, p := range unsafe.Slice(argv, argc) {
+ args = append(args, UTF16PtrToString(p))
}
return args, nil
}
+// CommandLineToArgv parses a Unicode command line string and sets
+// argc to the number of parsed arguments.
+//
+// The returned memory should be freed using a single call to LocalFree.
+//
+// Note that although the return type of CommandLineToArgv indicates 8192
+// entries of up to 8192 characters each, the actual count of parsed arguments
+// may exceed 8192, and the documentation for CommandLineToArgvW does not mention
+// any bound on the lengths of the individual argument strings.
+// (See https://go.dev/issue/63236.)
+func CommandLineToArgv(cmd *uint16, argc *int32) (argv *[8192]*[8192]uint16, err error) {
+ argp, err := commandLineToArgv(cmd, argc)
+ argv = (*[8192]*[8192]uint16)(unsafe.Pointer(argp))
+ return argv, err
+}
+
func CloseOnExec(fd Handle) {
SetHandleInformation(Handle(fd), HANDLE_FLAG_INHERIT, 0)
}
diff --git a/vendor/golang.org/x/sys/windows/mksyscall.go b/vendor/golang.org/x/sys/windows/mksyscall.go
index 8563f79c..dbcdb090 100644
--- a/vendor/golang.org/x/sys/windows/mksyscall.go
+++ b/vendor/golang.org/x/sys/windows/mksyscall.go
@@ -3,7 +3,6 @@
// license that can be found in the LICENSE file.
//go:build generate
-// +build generate
package windows
diff --git a/vendor/golang.org/x/sys/windows/race.go b/vendor/golang.org/x/sys/windows/race.go
index 9196b089..0f1bdc38 100644
--- a/vendor/golang.org/x/sys/windows/race.go
+++ b/vendor/golang.org/x/sys/windows/race.go
@@ -3,7 +3,6 @@
// license that can be found in the LICENSE file.
//go:build windows && race
-// +build windows,race
package windows
diff --git a/vendor/golang.org/x/sys/windows/race0.go b/vendor/golang.org/x/sys/windows/race0.go
index 7bae4817..0c78da78 100644
--- a/vendor/golang.org/x/sys/windows/race0.go
+++ b/vendor/golang.org/x/sys/windows/race0.go
@@ -3,7 +3,6 @@
// license that can be found in the LICENSE file.
//go:build windows && !race
-// +build windows,!race
package windows
diff --git a/vendor/golang.org/x/sys/windows/registry/key.go b/vendor/golang.org/x/sys/windows/registry/key.go
index 6c8d97b6..fd863244 100644
--- a/vendor/golang.org/x/sys/windows/registry/key.go
+++ b/vendor/golang.org/x/sys/windows/registry/key.go
@@ -3,7 +3,6 @@
// license that can be found in the LICENSE file.
//go:build windows
-// +build windows
// Package registry provides access to the Windows registry.
//
diff --git a/vendor/golang.org/x/sys/windows/registry/mksyscall.go b/vendor/golang.org/x/sys/windows/registry/mksyscall.go
index ee74927d..bbf86ccf 100644
--- a/vendor/golang.org/x/sys/windows/registry/mksyscall.go
+++ b/vendor/golang.org/x/sys/windows/registry/mksyscall.go
@@ -3,7 +3,6 @@
// license that can be found in the LICENSE file.
//go:build generate
-// +build generate
package registry
diff --git a/vendor/golang.org/x/sys/windows/registry/syscall.go b/vendor/golang.org/x/sys/windows/registry/syscall.go
index 41733512..f533091c 100644
--- a/vendor/golang.org/x/sys/windows/registry/syscall.go
+++ b/vendor/golang.org/x/sys/windows/registry/syscall.go
@@ -3,7 +3,6 @@
// license that can be found in the LICENSE file.
//go:build windows
-// +build windows
package registry
diff --git a/vendor/golang.org/x/sys/windows/registry/value.go b/vendor/golang.org/x/sys/windows/registry/value.go
index 2789f6f1..74db26b9 100644
--- a/vendor/golang.org/x/sys/windows/registry/value.go
+++ b/vendor/golang.org/x/sys/windows/registry/value.go
@@ -3,7 +3,6 @@
// license that can be found in the LICENSE file.
//go:build windows
-// +build windows
package registry
diff --git a/vendor/golang.org/x/sys/windows/security_windows.go b/vendor/golang.org/x/sys/windows/security_windows.go
index d414ef13..26be94a8 100644
--- a/vendor/golang.org/x/sys/windows/security_windows.go
+++ b/vendor/golang.org/x/sys/windows/security_windows.go
@@ -7,8 +7,6 @@ package windows
import (
"syscall"
"unsafe"
-
- "golang.org/x/sys/internal/unsafeheader"
)
const (
@@ -1341,21 +1339,14 @@ func (selfRelativeSD *SECURITY_DESCRIPTOR) copySelfRelativeSecurityDescriptor()
sdLen = min
}
- var src []byte
- h := (*unsafeheader.Slice)(unsafe.Pointer(&src))
- h.Data = unsafe.Pointer(selfRelativeSD)
- h.Len = sdLen
- h.Cap = sdLen
-
+ src := unsafe.Slice((*byte)(unsafe.Pointer(selfRelativeSD)), sdLen)
+ // SECURITY_DESCRIPTOR has pointers in it, which means checkptr expects for it to
+ // be aligned properly. When we're copying a Windows-allocated struct to a
+ // Go-allocated one, make sure that the Go allocation is aligned to the
+ // pointer size.
const psize = int(unsafe.Sizeof(uintptr(0)))
-
- var dst []byte
- h = (*unsafeheader.Slice)(unsafe.Pointer(&dst))
alloc := make([]uintptr, (sdLen+psize-1)/psize)
- h.Data = (*unsafeheader.Slice)(unsafe.Pointer(&alloc)).Data
- h.Len = sdLen
- h.Cap = sdLen
-
+ dst := unsafe.Slice((*byte)(unsafe.Pointer(&alloc[0])), sdLen)
copy(dst, src)
return (*SECURITY_DESCRIPTOR)(unsafe.Pointer(&dst[0]))
}
diff --git a/vendor/golang.org/x/sys/windows/service.go b/vendor/golang.org/x/sys/windows/service.go
index c44a1b96..a9dc6308 100644
--- a/vendor/golang.org/x/sys/windows/service.go
+++ b/vendor/golang.org/x/sys/windows/service.go
@@ -3,7 +3,6 @@
// license that can be found in the LICENSE file.
//go:build windows
-// +build windows
package windows
diff --git a/vendor/golang.org/x/sys/windows/str.go b/vendor/golang.org/x/sys/windows/str.go
index 4fc01434..6a4f9ce6 100644
--- a/vendor/golang.org/x/sys/windows/str.go
+++ b/vendor/golang.org/x/sys/windows/str.go
@@ -3,7 +3,6 @@
// license that can be found in the LICENSE file.
//go:build windows
-// +build windows
package windows
diff --git a/vendor/golang.org/x/sys/windows/svc/debug/log.go b/vendor/golang.org/x/sys/windows/svc/debug/log.go
index 6ee64ca8..e99d8317 100644
--- a/vendor/golang.org/x/sys/windows/svc/debug/log.go
+++ b/vendor/golang.org/x/sys/windows/svc/debug/log.go
@@ -3,7 +3,6 @@
// license that can be found in the LICENSE file.
//go:build windows
-// +build windows
package debug
diff --git a/vendor/golang.org/x/sys/windows/svc/debug/service.go b/vendor/golang.org/x/sys/windows/svc/debug/service.go
index 684c5dcb..bd1327e7 100644
--- a/vendor/golang.org/x/sys/windows/svc/debug/service.go
+++ b/vendor/golang.org/x/sys/windows/svc/debug/service.go
@@ -3,7 +3,6 @@
// license that can be found in the LICENSE file.
//go:build windows
-// +build windows
// Package debug provides facilities to execute svc.Handler on console.
package debug
diff --git a/vendor/golang.org/x/sys/windows/svc/eventlog/install.go b/vendor/golang.org/x/sys/windows/svc/eventlog/install.go
index 43e324f4..1179c38b 100644
--- a/vendor/golang.org/x/sys/windows/svc/eventlog/install.go
+++ b/vendor/golang.org/x/sys/windows/svc/eventlog/install.go
@@ -3,7 +3,6 @@
// license that can be found in the LICENSE file.
//go:build windows
-// +build windows
package eventlog
diff --git a/vendor/golang.org/x/sys/windows/svc/eventlog/log.go b/vendor/golang.org/x/sys/windows/svc/eventlog/log.go
index f37b4b51..f279444d 100644
--- a/vendor/golang.org/x/sys/windows/svc/eventlog/log.go
+++ b/vendor/golang.org/x/sys/windows/svc/eventlog/log.go
@@ -3,7 +3,6 @@
// license that can be found in the LICENSE file.
//go:build windows
-// +build windows
// Package eventlog implements access to Windows event log.
package eventlog
diff --git a/vendor/golang.org/x/sys/windows/svc/mgr/config.go b/vendor/golang.org/x/sys/windows/svc/mgr/config.go
index 04554862..a6d3e8a8 100644
--- a/vendor/golang.org/x/sys/windows/svc/mgr/config.go
+++ b/vendor/golang.org/x/sys/windows/svc/mgr/config.go
@@ -3,7 +3,6 @@
// license that can be found in the LICENSE file.
//go:build windows
-// +build windows
package mgr
diff --git a/vendor/golang.org/x/sys/windows/svc/mgr/mgr.go b/vendor/golang.org/x/sys/windows/svc/mgr/mgr.go
index c2dc8701..dbfd729f 100644
--- a/vendor/golang.org/x/sys/windows/svc/mgr/mgr.go
+++ b/vendor/golang.org/x/sys/windows/svc/mgr/mgr.go
@@ -3,7 +3,6 @@
// license that can be found in the LICENSE file.
//go:build windows
-// +build windows
// Package mgr can be used to manage Windows service programs.
// It can be used to install and remove them. It can also start,
@@ -17,7 +16,6 @@ import (
"unicode/utf16"
"unsafe"
- "golang.org/x/sys/internal/unsafeheader"
"golang.org/x/sys/windows"
)
@@ -199,12 +197,7 @@ func (m *Mgr) ListServices() ([]string, error) {
if servicesReturned == 0 {
return nil, nil
}
-
- var services []windows.ENUM_SERVICE_STATUS_PROCESS
- hdr := (*unsafeheader.Slice)(unsafe.Pointer(&services))
- hdr.Data = unsafe.Pointer(&buf[0])
- hdr.Len = int(servicesReturned)
- hdr.Cap = int(servicesReturned)
+ services := unsafe.Slice((*windows.ENUM_SERVICE_STATUS_PROCESS)(unsafe.Pointer(&buf[0])), int(servicesReturned))
var names []string
for _, s := range services {
diff --git a/vendor/golang.org/x/sys/windows/svc/mgr/recovery.go b/vendor/golang.org/x/sys/windows/svc/mgr/recovery.go
index 32145199..cdf880e1 100644
--- a/vendor/golang.org/x/sys/windows/svc/mgr/recovery.go
+++ b/vendor/golang.org/x/sys/windows/svc/mgr/recovery.go
@@ -3,7 +3,6 @@
// license that can be found in the LICENSE file.
//go:build windows
-// +build windows
package mgr
@@ -13,7 +12,6 @@ import (
"time"
"unsafe"
- "golang.org/x/sys/internal/unsafeheader"
"golang.org/x/sys/windows"
)
@@ -70,12 +68,7 @@ func (s *Service) RecoveryActions() ([]RecoveryAction, error) {
return nil, err
}
- var actions []windows.SC_ACTION
- hdr := (*unsafeheader.Slice)(unsafe.Pointer(&actions))
- hdr.Data = unsafe.Pointer(p.Actions)
- hdr.Len = int(p.ActionsCount)
- hdr.Cap = int(p.ActionsCount)
-
+ actions := unsafe.Slice(p.Actions, int(p.ActionsCount))
var recoveryActions []RecoveryAction
for _, action := range actions {
recoveryActions = append(recoveryActions, RecoveryAction{Type: int(action.Type), Delay: time.Duration(action.Delay) * time.Millisecond})
diff --git a/vendor/golang.org/x/sys/windows/svc/mgr/service.go b/vendor/golang.org/x/sys/windows/svc/mgr/service.go
index be3d151a..c9740ef0 100644
--- a/vendor/golang.org/x/sys/windows/svc/mgr/service.go
+++ b/vendor/golang.org/x/sys/windows/svc/mgr/service.go
@@ -3,7 +3,6 @@
// license that can be found in the LICENSE file.
//go:build windows
-// +build windows
package mgr
diff --git a/vendor/golang.org/x/sys/windows/svc/security.go b/vendor/golang.org/x/sys/windows/svc/security.go
index 1c51006e..6a1f3c62 100644
--- a/vendor/golang.org/x/sys/windows/svc/security.go
+++ b/vendor/golang.org/x/sys/windows/svc/security.go
@@ -3,7 +3,6 @@
// license that can be found in the LICENSE file.
//go:build windows
-// +build windows
package svc
diff --git a/vendor/golang.org/x/sys/windows/svc/service.go b/vendor/golang.org/x/sys/windows/svc/service.go
index 2b4a7bc6..c96932d9 100644
--- a/vendor/golang.org/x/sys/windows/svc/service.go
+++ b/vendor/golang.org/x/sys/windows/svc/service.go
@@ -3,7 +3,6 @@
// license that can be found in the LICENSE file.
//go:build windows
-// +build windows
// Package svc provides everything required to build Windows service.
package svc
@@ -13,7 +12,6 @@ import (
"sync"
"unsafe"
- "golang.org/x/sys/internal/unsafeheader"
"golang.org/x/sys/windows"
)
@@ -222,11 +220,7 @@ func serviceMain(argc uint32, argv **uint16) uintptr {
defer func() {
theService.h = 0
}()
- var args16 []*uint16
- hdr := (*unsafeheader.Slice)(unsafe.Pointer(&args16))
- hdr.Data = unsafe.Pointer(argv)
- hdr.Len = int(argc)
- hdr.Cap = int(argc)
+ args16 := unsafe.Slice(argv, int(argc))
args := make([]string, len(args16))
for i, a := range args16 {
diff --git a/vendor/golang.org/x/sys/windows/syscall.go b/vendor/golang.org/x/sys/windows/syscall.go
index 8732cdb9..e85ed6b9 100644
--- a/vendor/golang.org/x/sys/windows/syscall.go
+++ b/vendor/golang.org/x/sys/windows/syscall.go
@@ -3,7 +3,6 @@
// license that can be found in the LICENSE file.
//go:build windows
-// +build windows
// Package windows contains an interface to the low-level operating system
// primitives. OS details vary depending on the underlying system, and
diff --git a/vendor/golang.org/x/sys/windows/syscall_windows.go b/vendor/golang.org/x/sys/windows/syscall_windows.go
index 67bad092..47dc5796 100644
--- a/vendor/golang.org/x/sys/windows/syscall_windows.go
+++ b/vendor/golang.org/x/sys/windows/syscall_windows.go
@@ -15,8 +15,6 @@ import (
"time"
"unicode/utf16"
"unsafe"
-
- "golang.org/x/sys/internal/unsafeheader"
)
type Handle uintptr
@@ -157,6 +155,8 @@ func NewCallbackCDecl(fn interface{}) uintptr {
//sys GetModuleFileName(module Handle, filename *uint16, size uint32) (n uint32, err error) = kernel32.GetModuleFileNameW
//sys GetModuleHandleEx(flags uint32, moduleName *uint16, module *Handle) (err error) = kernel32.GetModuleHandleExW
//sys SetDefaultDllDirectories(directoryFlags uint32) (err error)
+//sys AddDllDirectory(path *uint16) (cookie uintptr, err error) = kernel32.AddDllDirectory
+//sys RemoveDllDirectory(cookie uintptr) (err error) = kernel32.RemoveDllDirectory
//sys SetDllDirectory(path string) (err error) = kernel32.SetDllDirectoryW
//sys GetVersion() (ver uint32, err error)
//sys FormatMessage(flags uint32, msgsrc uintptr, msgid uint32, langid uint32, buf []uint16, args *byte) (n uint32, err error) = FormatMessageW
@@ -235,12 +235,13 @@ func NewCallbackCDecl(fn interface{}) uintptr {
//sys CreateEnvironmentBlock(block **uint16, token Token, inheritExisting bool) (err error) = userenv.CreateEnvironmentBlock
//sys DestroyEnvironmentBlock(block *uint16) (err error) = userenv.DestroyEnvironmentBlock
//sys getTickCount64() (ms uint64) = kernel32.GetTickCount64
+//sys GetFileTime(handle Handle, ctime *Filetime, atime *Filetime, wtime *Filetime) (err error)
//sys SetFileTime(handle Handle, ctime *Filetime, atime *Filetime, wtime *Filetime) (err error)
//sys GetFileAttributes(name *uint16) (attrs uint32, err error) [failretval==INVALID_FILE_ATTRIBUTES] = kernel32.GetFileAttributesW
//sys SetFileAttributes(name *uint16, attrs uint32) (err error) = kernel32.SetFileAttributesW
//sys GetFileAttributesEx(name *uint16, level uint32, info *byte) (err error) = kernel32.GetFileAttributesExW
//sys GetCommandLine() (cmd *uint16) = kernel32.GetCommandLineW
-//sys CommandLineToArgv(cmd *uint16, argc *int32) (argv *[8192]*[8192]uint16, err error) [failretval==nil] = shell32.CommandLineToArgvW
+//sys commandLineToArgv(cmd *uint16, argc *int32) (argv **uint16, err error) [failretval==nil] = shell32.CommandLineToArgvW
//sys LocalFree(hmem Handle) (handle Handle, err error) [failretval!=0]
//sys LocalAlloc(flags uint32, length uint32) (ptr uintptr, err error)
//sys SetHandleInformation(handle Handle, mask uint32, flags uint32) (err error)
@@ -299,12 +300,15 @@ func NewCallbackCDecl(fn interface{}) uintptr {
//sys RegNotifyChangeKeyValue(key Handle, watchSubtree bool, notifyFilter uint32, event Handle, asynchronous bool) (regerrno error) = advapi32.RegNotifyChangeKeyValue
//sys GetCurrentProcessId() (pid uint32) = kernel32.GetCurrentProcessId
//sys ProcessIdToSessionId(pid uint32, sessionid *uint32) (err error) = kernel32.ProcessIdToSessionId
+//sys ClosePseudoConsole(console Handle) = kernel32.ClosePseudoConsole
+//sys createPseudoConsole(size uint32, in Handle, out Handle, flags uint32, pconsole *Handle) (hr error) = kernel32.CreatePseudoConsole
//sys GetConsoleMode(console Handle, mode *uint32) (err error) = kernel32.GetConsoleMode
//sys SetConsoleMode(console Handle, mode uint32) (err error) = kernel32.SetConsoleMode
//sys GetConsoleScreenBufferInfo(console Handle, info *ConsoleScreenBufferInfo) (err error) = kernel32.GetConsoleScreenBufferInfo
//sys setConsoleCursorPosition(console Handle, position uint32) (err error) = kernel32.SetConsoleCursorPosition
//sys WriteConsole(console Handle, buf *uint16, towrite uint32, written *uint32, reserved *byte) (err error) = kernel32.WriteConsoleW
//sys ReadConsole(console Handle, buf *uint16, toread uint32, read *uint32, inputControl *byte) (err error) = kernel32.ReadConsoleW
+//sys resizePseudoConsole(pconsole Handle, size uint32) (hr error) = kernel32.ResizePseudoConsole
//sys CreateToolhelp32Snapshot(flags uint32, processId uint32) (handle Handle, err error) [failretval==InvalidHandle] = kernel32.CreateToolhelp32Snapshot
//sys Module32First(snapshot Handle, moduleEntry *ModuleEntry32) (err error) = kernel32.Module32FirstW
//sys Module32Next(snapshot Handle, moduleEntry *ModuleEntry32) (err error) = kernel32.Module32NextW
@@ -968,7 +972,8 @@ func (sa *SockaddrUnix) sockaddr() (unsafe.Pointer, int32, error) {
if n > 0 {
sl += int32(n) + 1
}
- if sa.raw.Path[0] == '@' {
+ if sa.raw.Path[0] == '@' || (sa.raw.Path[0] == 0 && sl > 3) {
+ // Check sl > 3 so we don't change unnamed socket behavior.
sa.raw.Path[0] = 0
// Don't count trailing NUL for abstract address.
sl--
@@ -1667,12 +1672,8 @@ func NewNTUnicodeString(s string) (*NTUnicodeString, error) {
// Slice returns a uint16 slice that aliases the data in the NTUnicodeString.
func (s *NTUnicodeString) Slice() []uint16 {
- var slice []uint16
- hdr := (*unsafeheader.Slice)(unsafe.Pointer(&slice))
- hdr.Data = unsafe.Pointer(s.Buffer)
- hdr.Len = int(s.Length)
- hdr.Cap = int(s.MaximumLength)
- return slice
+ slice := unsafe.Slice(s.Buffer, s.MaximumLength)
+ return slice[:s.Length]
}
func (s *NTUnicodeString) String() string {
@@ -1695,12 +1696,8 @@ func NewNTString(s string) (*NTString, error) {
// Slice returns a byte slice that aliases the data in the NTString.
func (s *NTString) Slice() []byte {
- var slice []byte
- hdr := (*unsafeheader.Slice)(unsafe.Pointer(&slice))
- hdr.Data = unsafe.Pointer(s.Buffer)
- hdr.Len = int(s.Length)
- hdr.Cap = int(s.MaximumLength)
- return slice
+ slice := unsafe.Slice(s.Buffer, s.MaximumLength)
+ return slice[:s.Length]
}
func (s *NTString) String() string {
@@ -1752,10 +1749,7 @@ func LoadResourceData(module, resInfo Handle) (data []byte, err error) {
if err != nil {
return
}
- h := (*unsafeheader.Slice)(unsafe.Pointer(&data))
- h.Data = unsafe.Pointer(ptr)
- h.Len = int(size)
- h.Cap = int(size)
+ data = unsafe.Slice((*byte)(unsafe.Pointer(ptr)), size)
return
}
@@ -1826,3 +1820,17 @@ type PSAPI_WORKING_SET_EX_INFORMATION struct {
// A PSAPI_WORKING_SET_EX_BLOCK union that indicates the attributes of the page at VirtualAddress.
VirtualAttributes PSAPI_WORKING_SET_EX_BLOCK
}
+
+// CreatePseudoConsole creates a windows pseudo console.
+func CreatePseudoConsole(size Coord, in Handle, out Handle, flags uint32, pconsole *Handle) error {
+ // We need this wrapper to manually cast Coord to uint32. The autogenerated wrappers only
+ // accept arguments that can be casted to uintptr, and Coord can't.
+ return createPseudoConsole(*((*uint32)(unsafe.Pointer(&size))), in, out, flags, pconsole)
+}
+
+// ResizePseudoConsole resizes the internal buffers of the pseudo console to the width and height specified in `size`.
+func ResizePseudoConsole(pconsole Handle, size Coord) error {
+ // We need this wrapper to manually cast Coord to uint32. The autogenerated wrappers only
+ // accept arguments that can be casted to uintptr, and Coord can't.
+ return resizePseudoConsole(pconsole, *((*uint32)(unsafe.Pointer(&size))))
+}
diff --git a/vendor/golang.org/x/sys/windows/types_windows.go b/vendor/golang.org/x/sys/windows/types_windows.go
index 88e62a63..359780f6 100644
--- a/vendor/golang.org/x/sys/windows/types_windows.go
+++ b/vendor/golang.org/x/sys/windows/types_windows.go
@@ -247,6 +247,7 @@ const (
PROC_THREAD_ATTRIBUTE_MITIGATION_POLICY = 0x00020007
PROC_THREAD_ATTRIBUTE_UMS_THREAD = 0x00030006
PROC_THREAD_ATTRIBUTE_PROTECTION_LEVEL = 0x0002000b
+ PROC_THREAD_ATTRIBUTE_PSEUDOCONSOLE = 0x00020016
)
const (
@@ -1093,7 +1094,33 @@ const (
SOMAXCONN = 0x7fffffff
- TCP_NODELAY = 1
+ TCP_NODELAY = 1
+ TCP_EXPEDITED_1122 = 2
+ TCP_KEEPALIVE = 3
+ TCP_MAXSEG = 4
+ TCP_MAXRT = 5
+ TCP_STDURG = 6
+ TCP_NOURG = 7
+ TCP_ATMARK = 8
+ TCP_NOSYNRETRIES = 9
+ TCP_TIMESTAMPS = 10
+ TCP_OFFLOAD_PREFERENCE = 11
+ TCP_CONGESTION_ALGORITHM = 12
+ TCP_DELAY_FIN_ACK = 13
+ TCP_MAXRTMS = 14
+ TCP_FASTOPEN = 15
+ TCP_KEEPCNT = 16
+ TCP_KEEPIDLE = TCP_KEEPALIVE
+ TCP_KEEPINTVL = 17
+ TCP_FAIL_CONNECT_ON_ICMP_ERROR = 18
+ TCP_ICMP_ERROR_INFO = 19
+
+ UDP_NOCHECKSUM = 1
+ UDP_SEND_MSG_SIZE = 2
+ UDP_RECV_MAX_COALESCED_SIZE = 3
+ UDP_CHECKSUM_COVERAGE = 20
+
+ UDP_COALESCED_INFO = 3
SHUT_RD = 0
SHUT_WR = 1
@@ -2139,6 +2166,12 @@ const (
ENABLE_LVB_GRID_WORLDWIDE = 0x10
)
+// Pseudo console related constants used for the flags parameter to
+// CreatePseudoConsole. See: https://learn.microsoft.com/en-us/windows/console/createpseudoconsole
+const (
+ PSEUDOCONSOLE_INHERIT_CURSOR = 0x1
+)
+
type Coord struct {
X int16
Y int16
diff --git a/vendor/golang.org/x/sys/windows/zsyscall_windows.go b/vendor/golang.org/x/sys/windows/zsyscall_windows.go
index 5c385580..146a1f01 100644
--- a/vendor/golang.org/x/sys/windows/zsyscall_windows.go
+++ b/vendor/golang.org/x/sys/windows/zsyscall_windows.go
@@ -184,10 +184,12 @@ var (
procGetAdaptersInfo = modiphlpapi.NewProc("GetAdaptersInfo")
procGetBestInterfaceEx = modiphlpapi.NewProc("GetBestInterfaceEx")
procGetIfEntry = modiphlpapi.NewProc("GetIfEntry")
+ procAddDllDirectory = modkernel32.NewProc("AddDllDirectory")
procAssignProcessToJobObject = modkernel32.NewProc("AssignProcessToJobObject")
procCancelIo = modkernel32.NewProc("CancelIo")
procCancelIoEx = modkernel32.NewProc("CancelIoEx")
procCloseHandle = modkernel32.NewProc("CloseHandle")
+ procClosePseudoConsole = modkernel32.NewProc("ClosePseudoConsole")
procConnectNamedPipe = modkernel32.NewProc("ConnectNamedPipe")
procCreateDirectoryW = modkernel32.NewProc("CreateDirectoryW")
procCreateEventExW = modkernel32.NewProc("CreateEventExW")
@@ -202,6 +204,7 @@ var (
procCreateNamedPipeW = modkernel32.NewProc("CreateNamedPipeW")
procCreatePipe = modkernel32.NewProc("CreatePipe")
procCreateProcessW = modkernel32.NewProc("CreateProcessW")
+ procCreatePseudoConsole = modkernel32.NewProc("CreatePseudoConsole")
procCreateSymbolicLinkW = modkernel32.NewProc("CreateSymbolicLinkW")
procCreateToolhelp32Snapshot = modkernel32.NewProc("CreateToolhelp32Snapshot")
procDefineDosDeviceW = modkernel32.NewProc("DefineDosDeviceW")
@@ -251,6 +254,7 @@ var (
procGetFileAttributesW = modkernel32.NewProc("GetFileAttributesW")
procGetFileInformationByHandle = modkernel32.NewProc("GetFileInformationByHandle")
procGetFileInformationByHandleEx = modkernel32.NewProc("GetFileInformationByHandleEx")
+ procGetFileTime = modkernel32.NewProc("GetFileTime")
procGetFileType = modkernel32.NewProc("GetFileType")
procGetFinalPathNameByHandleW = modkernel32.NewProc("GetFinalPathNameByHandleW")
procGetFullPathNameW = modkernel32.NewProc("GetFullPathNameW")
@@ -327,7 +331,9 @@ var (
procReadProcessMemory = modkernel32.NewProc("ReadProcessMemory")
procReleaseMutex = modkernel32.NewProc("ReleaseMutex")
procRemoveDirectoryW = modkernel32.NewProc("RemoveDirectoryW")
+ procRemoveDllDirectory = modkernel32.NewProc("RemoveDllDirectory")
procResetEvent = modkernel32.NewProc("ResetEvent")
+ procResizePseudoConsole = modkernel32.NewProc("ResizePseudoConsole")
procResumeThread = modkernel32.NewProc("ResumeThread")
procSetCommTimeouts = modkernel32.NewProc("SetCommTimeouts")
procSetConsoleCursorPosition = modkernel32.NewProc("SetConsoleCursorPosition")
@@ -1601,6 +1607,15 @@ func GetIfEntry(pIfRow *MibIfRow) (errcode error) {
return
}
+func AddDllDirectory(path *uint16) (cookie uintptr, err error) {
+ r0, _, e1 := syscall.Syscall(procAddDllDirectory.Addr(), 1, uintptr(unsafe.Pointer(path)), 0, 0)
+ cookie = uintptr(r0)
+ if cookie == 0 {
+ err = errnoErr(e1)
+ }
+ return
+}
+
func AssignProcessToJobObject(job Handle, process Handle) (err error) {
r1, _, e1 := syscall.Syscall(procAssignProcessToJobObject.Addr(), 2, uintptr(job), uintptr(process), 0)
if r1 == 0 {
@@ -1633,6 +1648,11 @@ func CloseHandle(handle Handle) (err error) {
return
}
+func ClosePseudoConsole(console Handle) {
+ syscall.Syscall(procClosePseudoConsole.Addr(), 1, uintptr(console), 0, 0)
+ return
+}
+
func ConnectNamedPipe(pipe Handle, overlapped *Overlapped) (err error) {
r1, _, e1 := syscall.Syscall(procConnectNamedPipe.Addr(), 2, uintptr(pipe), uintptr(unsafe.Pointer(overlapped)), 0)
if r1 == 0 {
@@ -1762,6 +1782,14 @@ func CreateProcess(appName *uint16, commandLine *uint16, procSecurity *SecurityA
return
}
+func createPseudoConsole(size uint32, in Handle, out Handle, flags uint32, pconsole *Handle) (hr error) {
+ r0, _, _ := syscall.Syscall6(procCreatePseudoConsole.Addr(), 5, uintptr(size), uintptr(in), uintptr(out), uintptr(flags), uintptr(unsafe.Pointer(pconsole)), 0)
+ if r0 != 0 {
+ hr = syscall.Errno(r0)
+ }
+ return
+}
+
func CreateSymbolicLink(symlinkfilename *uint16, targetfilename *uint16, flags uint32) (err error) {
r1, _, e1 := syscall.Syscall(procCreateSymbolicLinkW.Addr(), 3, uintptr(unsafe.Pointer(symlinkfilename)), uintptr(unsafe.Pointer(targetfilename)), uintptr(flags))
if r1&0xff == 0 {
@@ -2169,6 +2197,14 @@ func GetFileInformationByHandleEx(handle Handle, class uint32, outBuffer *byte,
return
}
+func GetFileTime(handle Handle, ctime *Filetime, atime *Filetime, wtime *Filetime) (err error) {
+ r1, _, e1 := syscall.Syscall6(procGetFileTime.Addr(), 4, uintptr(handle), uintptr(unsafe.Pointer(ctime)), uintptr(unsafe.Pointer(atime)), uintptr(unsafe.Pointer(wtime)), 0, 0)
+ if r1 == 0 {
+ err = errnoErr(e1)
+ }
+ return
+}
+
func GetFileType(filehandle Handle) (n uint32, err error) {
r0, _, e1 := syscall.Syscall(procGetFileType.Addr(), 1, uintptr(filehandle), 0, 0)
n = uint32(r0)
@@ -2854,6 +2890,14 @@ func RemoveDirectory(path *uint16) (err error) {
return
}
+func RemoveDllDirectory(cookie uintptr) (err error) {
+ r1, _, e1 := syscall.Syscall(procRemoveDllDirectory.Addr(), 1, uintptr(cookie), 0, 0)
+ if r1 == 0 {
+ err = errnoErr(e1)
+ }
+ return
+}
+
func ResetEvent(event Handle) (err error) {
r1, _, e1 := syscall.Syscall(procResetEvent.Addr(), 1, uintptr(event), 0, 0)
if r1 == 0 {
@@ -2862,6 +2906,14 @@ func ResetEvent(event Handle) (err error) {
return
}
+func resizePseudoConsole(pconsole Handle, size uint32) (hr error) {
+ r0, _, _ := syscall.Syscall(procResizePseudoConsole.Addr(), 2, uintptr(pconsole), uintptr(size), 0)
+ if r0 != 0 {
+ hr = syscall.Errno(r0)
+ }
+ return
+}
+
func ResumeThread(thread Handle) (ret uint32, err error) {
r0, _, e1 := syscall.Syscall(procResumeThread.Addr(), 1, uintptr(thread), 0, 0)
ret = uint32(r0)
@@ -3820,9 +3872,9 @@ func setupUninstallOEMInf(infFileName *uint16, flags SUOI, reserved uintptr) (er
return
}
-func CommandLineToArgv(cmd *uint16, argc *int32) (argv *[8192]*[8192]uint16, err error) {
+func commandLineToArgv(cmd *uint16, argc *int32) (argv **uint16, err error) {
r0, _, e1 := syscall.Syscall(procCommandLineToArgvW.Addr(), 2, uintptr(unsafe.Pointer(cmd)), uintptr(unsafe.Pointer(argc)), 0)
- argv = (*[8192]*[8192]uint16)(unsafe.Pointer(r0))
+ argv = (**uint16)(unsafe.Pointer(r0))
if argv == nil {
err = errnoErr(e1)
}
diff --git a/vendor/golang.org/x/term/CONTRIBUTING.md b/vendor/golang.org/x/term/CONTRIBUTING.md
deleted file mode 100644
index d0485e88..00000000
--- a/vendor/golang.org/x/term/CONTRIBUTING.md
+++ /dev/null
@@ -1,26 +0,0 @@
-# Contributing to Go
-
-Go is an open source project.
-
-It is the work of hundreds of contributors. We appreciate your help!
-
-## Filing issues
-
-When [filing an issue](https://golang.org/issue/new), make sure to answer these five questions:
-
-1. What version of Go are you using (`go version`)?
-2. What operating system and processor architecture are you using?
-3. What did you do?
-4. What did you expect to see?
-5. What did you see instead?
-
-General questions should go to the [golang-nuts mailing list](https://groups.google.com/group/golang-nuts) instead of the issue tracker.
-The gophers there will answer or ask you to file an issue if you've tripped over a bug.
-
-## Contributing code
-
-Please read the [Contribution Guidelines](https://golang.org/doc/contribute.html)
-before sending patches.
-
-Unless otherwise noted, the Go source files are distributed under
-the BSD-style license found in the LICENSE file.
diff --git a/vendor/golang.org/x/term/README.md b/vendor/golang.org/x/term/README.md
deleted file mode 100644
index d03d0aef..00000000
--- a/vendor/golang.org/x/term/README.md
+++ /dev/null
@@ -1,19 +0,0 @@
-# Go terminal/console support
-
-[](https://pkg.go.dev/golang.org/x/term)
-
-This repository provides Go terminal and console support packages.
-
-## Download/Install
-
-The easiest way to install is to run `go get -u golang.org/x/term`. You can
-also manually git clone the repository to `$GOPATH/src/golang.org/x/term`.
-
-## Report Issues / Send Patches
-
-This repository uses Gerrit for code changes. To learn how to submit changes to
-this repository, see https://golang.org/doc/contribute.html.
-
-The main issue tracker for the term repository is located at
-https://github.com/golang/go/issues. Prefix your issue with "x/term:" in the
-subject line, so it is easy to find.
diff --git a/vendor/golang.org/x/term/codereview.cfg b/vendor/golang.org/x/term/codereview.cfg
deleted file mode 100644
index 3f8b14b6..00000000
--- a/vendor/golang.org/x/term/codereview.cfg
+++ /dev/null
@@ -1 +0,0 @@
-issuerepo: golang/go
diff --git a/vendor/golang.org/x/term/term.go b/vendor/golang.org/x/term/term.go
deleted file mode 100644
index 1a40d101..00000000
--- a/vendor/golang.org/x/term/term.go
+++ /dev/null
@@ -1,60 +0,0 @@
-// Copyright 2019 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-// Package term provides support functions for dealing with terminals, as
-// commonly found on UNIX systems.
-//
-// Putting a terminal into raw mode is the most common requirement:
-//
-// oldState, err := term.MakeRaw(int(os.Stdin.Fd()))
-// if err != nil {
-// panic(err)
-// }
-// defer term.Restore(int(os.Stdin.Fd()), oldState)
-//
-// Note that on non-Unix systems os.Stdin.Fd() may not be 0.
-package term
-
-// State contains the state of a terminal.
-type State struct {
- state
-}
-
-// IsTerminal returns whether the given file descriptor is a terminal.
-func IsTerminal(fd int) bool {
- return isTerminal(fd)
-}
-
-// MakeRaw puts the terminal connected to the given file descriptor into raw
-// mode and returns the previous state of the terminal so that it can be
-// restored.
-func MakeRaw(fd int) (*State, error) {
- return makeRaw(fd)
-}
-
-// GetState returns the current state of a terminal which may be useful to
-// restore the terminal after a signal.
-func GetState(fd int) (*State, error) {
- return getState(fd)
-}
-
-// Restore restores the terminal connected to the given file descriptor to a
-// previous state.
-func Restore(fd int, oldState *State) error {
- return restore(fd, oldState)
-}
-
-// GetSize returns the visible dimensions of the given terminal.
-//
-// These dimensions don't include any scrollback buffer height.
-func GetSize(fd int) (width, height int, err error) {
- return getSize(fd)
-}
-
-// ReadPassword reads a line of input from a terminal without local echo. This
-// is commonly used for inputting passwords and other sensitive data. The slice
-// returned does not include the \n.
-func ReadPassword(fd int) ([]byte, error) {
- return readPassword(fd)
-}
diff --git a/vendor/golang.org/x/term/term_plan9.go b/vendor/golang.org/x/term/term_plan9.go
deleted file mode 100644
index 21afa55c..00000000
--- a/vendor/golang.org/x/term/term_plan9.go
+++ /dev/null
@@ -1,42 +0,0 @@
-// Copyright 2019 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-package term
-
-import (
- "fmt"
- "runtime"
-
- "golang.org/x/sys/plan9"
-)
-
-type state struct{}
-
-func isTerminal(fd int) bool {
- path, err := plan9.Fd2path(fd)
- if err != nil {
- return false
- }
- return path == "/dev/cons" || path == "/mnt/term/dev/cons"
-}
-
-func makeRaw(fd int) (*State, error) {
- return nil, fmt.Errorf("terminal: MakeRaw not implemented on %s/%s", runtime.GOOS, runtime.GOARCH)
-}
-
-func getState(fd int) (*State, error) {
- return nil, fmt.Errorf("terminal: GetState not implemented on %s/%s", runtime.GOOS, runtime.GOARCH)
-}
-
-func restore(fd int, state *State) error {
- return fmt.Errorf("terminal: Restore not implemented on %s/%s", runtime.GOOS, runtime.GOARCH)
-}
-
-func getSize(fd int) (width, height int, err error) {
- return 0, 0, fmt.Errorf("terminal: GetSize not implemented on %s/%s", runtime.GOOS, runtime.GOARCH)
-}
-
-func readPassword(fd int) ([]byte, error) {
- return nil, fmt.Errorf("terminal: ReadPassword not implemented on %s/%s", runtime.GOOS, runtime.GOARCH)
-}
diff --git a/vendor/golang.org/x/term/term_unix.go b/vendor/golang.org/x/term/term_unix.go
deleted file mode 100644
index 62c2b3f4..00000000
--- a/vendor/golang.org/x/term/term_unix.go
+++ /dev/null
@@ -1,92 +0,0 @@
-// Copyright 2019 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-//go:build aix || darwin || dragonfly || freebsd || linux || netbsd || openbsd || solaris || zos
-// +build aix darwin dragonfly freebsd linux netbsd openbsd solaris zos
-
-package term
-
-import (
- "golang.org/x/sys/unix"
-)
-
-type state struct {
- termios unix.Termios
-}
-
-func isTerminal(fd int) bool {
- _, err := unix.IoctlGetTermios(fd, ioctlReadTermios)
- return err == nil
-}
-
-func makeRaw(fd int) (*State, error) {
- termios, err := unix.IoctlGetTermios(fd, ioctlReadTermios)
- if err != nil {
- return nil, err
- }
-
- oldState := State{state{termios: *termios}}
-
- // This attempts to replicate the behaviour documented for cfmakeraw in
- // the termios(3) manpage.
- termios.Iflag &^= unix.IGNBRK | unix.BRKINT | unix.PARMRK | unix.ISTRIP | unix.INLCR | unix.IGNCR | unix.ICRNL | unix.IXON
- termios.Oflag &^= unix.OPOST
- termios.Lflag &^= unix.ECHO | unix.ECHONL | unix.ICANON | unix.ISIG | unix.IEXTEN
- termios.Cflag &^= unix.CSIZE | unix.PARENB
- termios.Cflag |= unix.CS8
- termios.Cc[unix.VMIN] = 1
- termios.Cc[unix.VTIME] = 0
- if err := unix.IoctlSetTermios(fd, ioctlWriteTermios, termios); err != nil {
- return nil, err
- }
-
- return &oldState, nil
-}
-
-func getState(fd int) (*State, error) {
- termios, err := unix.IoctlGetTermios(fd, ioctlReadTermios)
- if err != nil {
- return nil, err
- }
-
- return &State{state{termios: *termios}}, nil
-}
-
-func restore(fd int, state *State) error {
- return unix.IoctlSetTermios(fd, ioctlWriteTermios, &state.termios)
-}
-
-func getSize(fd int) (width, height int, err error) {
- ws, err := unix.IoctlGetWinsize(fd, unix.TIOCGWINSZ)
- if err != nil {
- return 0, 0, err
- }
- return int(ws.Col), int(ws.Row), nil
-}
-
-// passwordReader is an io.Reader that reads from a specific file descriptor.
-type passwordReader int
-
-func (r passwordReader) Read(buf []byte) (int, error) {
- return unix.Read(int(r), buf)
-}
-
-func readPassword(fd int) ([]byte, error) {
- termios, err := unix.IoctlGetTermios(fd, ioctlReadTermios)
- if err != nil {
- return nil, err
- }
-
- newState := *termios
- newState.Lflag &^= unix.ECHO
- newState.Lflag |= unix.ICANON | unix.ISIG
- newState.Iflag |= unix.ICRNL
- if err := unix.IoctlSetTermios(fd, ioctlWriteTermios, &newState); err != nil {
- return nil, err
- }
-
- defer unix.IoctlSetTermios(fd, ioctlWriteTermios, termios)
-
- return readPasswordLine(passwordReader(fd))
-}
diff --git a/vendor/golang.org/x/term/term_unix_bsd.go b/vendor/golang.org/x/term/term_unix_bsd.go
deleted file mode 100644
index 853b3d69..00000000
--- a/vendor/golang.org/x/term/term_unix_bsd.go
+++ /dev/null
@@ -1,13 +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.
-
-//go:build darwin || dragonfly || freebsd || netbsd || openbsd
-// +build darwin dragonfly freebsd netbsd openbsd
-
-package term
-
-import "golang.org/x/sys/unix"
-
-const ioctlReadTermios = unix.TIOCGETA
-const ioctlWriteTermios = unix.TIOCSETA
diff --git a/vendor/golang.org/x/term/term_unix_other.go b/vendor/golang.org/x/term/term_unix_other.go
deleted file mode 100644
index 1e8955c9..00000000
--- a/vendor/golang.org/x/term/term_unix_other.go
+++ /dev/null
@@ -1,13 +0,0 @@
-// Copyright 2021 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-//go:build aix || linux || solaris || zos
-// +build aix linux solaris zos
-
-package term
-
-import "golang.org/x/sys/unix"
-
-const ioctlReadTermios = unix.TCGETS
-const ioctlWriteTermios = unix.TCSETS
diff --git a/vendor/golang.org/x/term/term_unsupported.go b/vendor/golang.org/x/term/term_unsupported.go
deleted file mode 100644
index f1df8506..00000000
--- a/vendor/golang.org/x/term/term_unsupported.go
+++ /dev/null
@@ -1,39 +0,0 @@
-// Copyright 2019 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-//go:build !aix && !darwin && !dragonfly && !freebsd && !linux && !netbsd && !openbsd && !zos && !windows && !solaris && !plan9
-// +build !aix,!darwin,!dragonfly,!freebsd,!linux,!netbsd,!openbsd,!zos,!windows,!solaris,!plan9
-
-package term
-
-import (
- "fmt"
- "runtime"
-)
-
-type state struct{}
-
-func isTerminal(fd int) bool {
- return false
-}
-
-func makeRaw(fd int) (*State, error) {
- return nil, fmt.Errorf("terminal: MakeRaw not implemented on %s/%s", runtime.GOOS, runtime.GOARCH)
-}
-
-func getState(fd int) (*State, error) {
- return nil, fmt.Errorf("terminal: GetState not implemented on %s/%s", runtime.GOOS, runtime.GOARCH)
-}
-
-func restore(fd int, state *State) error {
- return fmt.Errorf("terminal: Restore not implemented on %s/%s", runtime.GOOS, runtime.GOARCH)
-}
-
-func getSize(fd int) (width, height int, err error) {
- return 0, 0, fmt.Errorf("terminal: GetSize not implemented on %s/%s", runtime.GOOS, runtime.GOARCH)
-}
-
-func readPassword(fd int) ([]byte, error) {
- return nil, fmt.Errorf("terminal: ReadPassword not implemented on %s/%s", runtime.GOOS, runtime.GOARCH)
-}
diff --git a/vendor/golang.org/x/term/term_windows.go b/vendor/golang.org/x/term/term_windows.go
deleted file mode 100644
index 465f5606..00000000
--- a/vendor/golang.org/x/term/term_windows.go
+++ /dev/null
@@ -1,79 +0,0 @@
-// Copyright 2019 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-package term
-
-import (
- "os"
-
- "golang.org/x/sys/windows"
-)
-
-type state struct {
- mode uint32
-}
-
-func isTerminal(fd int) bool {
- var st uint32
- err := windows.GetConsoleMode(windows.Handle(fd), &st)
- return err == nil
-}
-
-func makeRaw(fd int) (*State, error) {
- var st uint32
- if err := windows.GetConsoleMode(windows.Handle(fd), &st); err != nil {
- return nil, err
- }
- raw := st &^ (windows.ENABLE_ECHO_INPUT | windows.ENABLE_PROCESSED_INPUT | windows.ENABLE_LINE_INPUT | windows.ENABLE_PROCESSED_OUTPUT)
- if err := windows.SetConsoleMode(windows.Handle(fd), raw); err != nil {
- return nil, err
- }
- return &State{state{st}}, nil
-}
-
-func getState(fd int) (*State, error) {
- var st uint32
- if err := windows.GetConsoleMode(windows.Handle(fd), &st); err != nil {
- return nil, err
- }
- return &State{state{st}}, nil
-}
-
-func restore(fd int, state *State) error {
- return windows.SetConsoleMode(windows.Handle(fd), state.mode)
-}
-
-func getSize(fd int) (width, height int, err error) {
- var info windows.ConsoleScreenBufferInfo
- if err := windows.GetConsoleScreenBufferInfo(windows.Handle(fd), &info); err != nil {
- return 0, 0, err
- }
- return int(info.Window.Right - info.Window.Left + 1), int(info.Window.Bottom - info.Window.Top + 1), nil
-}
-
-func readPassword(fd int) ([]byte, error) {
- var st uint32
- if err := windows.GetConsoleMode(windows.Handle(fd), &st); err != nil {
- return nil, err
- }
- old := st
-
- st &^= (windows.ENABLE_ECHO_INPUT | windows.ENABLE_LINE_INPUT)
- st |= (windows.ENABLE_PROCESSED_OUTPUT | windows.ENABLE_PROCESSED_INPUT)
- if err := windows.SetConsoleMode(windows.Handle(fd), st); err != nil {
- return nil, err
- }
-
- defer windows.SetConsoleMode(windows.Handle(fd), old)
-
- var h windows.Handle
- p, _ := windows.GetCurrentProcess()
- if err := windows.DuplicateHandle(p, windows.Handle(fd), p, &h, 0, false, windows.DUPLICATE_SAME_ACCESS); err != nil {
- return nil, err
- }
-
- f := os.NewFile(uintptr(h), "stdin")
- defer f.Close()
- return readPasswordLine(f)
-}
diff --git a/vendor/golang.org/x/term/terminal.go b/vendor/golang.org/x/term/terminal.go
deleted file mode 100644
index f636667f..00000000
--- a/vendor/golang.org/x/term/terminal.go
+++ /dev/null
@@ -1,986 +0,0 @@
-// Copyright 2011 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-package term
-
-import (
- "bytes"
- "io"
- "runtime"
- "strconv"
- "sync"
- "unicode/utf8"
-)
-
-// EscapeCodes contains escape sequences that can be written to the terminal in
-// order to achieve different styles of text.
-type EscapeCodes struct {
- // Foreground colors
- Black, Red, Green, Yellow, Blue, Magenta, Cyan, White []byte
-
- // Reset all attributes
- Reset []byte
-}
-
-var vt100EscapeCodes = EscapeCodes{
- Black: []byte{keyEscape, '[', '3', '0', 'm'},
- Red: []byte{keyEscape, '[', '3', '1', 'm'},
- Green: []byte{keyEscape, '[', '3', '2', 'm'},
- Yellow: []byte{keyEscape, '[', '3', '3', 'm'},
- Blue: []byte{keyEscape, '[', '3', '4', 'm'},
- Magenta: []byte{keyEscape, '[', '3', '5', 'm'},
- Cyan: []byte{keyEscape, '[', '3', '6', 'm'},
- White: []byte{keyEscape, '[', '3', '7', 'm'},
-
- Reset: []byte{keyEscape, '[', '0', 'm'},
-}
-
-// Terminal contains the state for running a VT100 terminal that is capable of
-// reading lines of input.
-type Terminal struct {
- // AutoCompleteCallback, if non-null, is called for each keypress with
- // the full input line and the current position of the cursor (in
- // bytes, as an index into |line|). If it returns ok=false, the key
- // press is processed normally. Otherwise it returns a replacement line
- // and the new cursor position.
- AutoCompleteCallback func(line string, pos int, key rune) (newLine string, newPos int, ok bool)
-
- // Escape contains a pointer to the escape codes for this terminal.
- // It's always a valid pointer, although the escape codes themselves
- // may be empty if the terminal doesn't support them.
- Escape *EscapeCodes
-
- // lock protects the terminal and the state in this object from
- // concurrent processing of a key press and a Write() call.
- lock sync.Mutex
-
- c io.ReadWriter
- prompt []rune
-
- // line is the current line being entered.
- line []rune
- // pos is the logical position of the cursor in line
- pos int
- // echo is true if local echo is enabled
- echo bool
- // pasteActive is true iff there is a bracketed paste operation in
- // progress.
- pasteActive bool
-
- // cursorX contains the current X value of the cursor where the left
- // edge is 0. cursorY contains the row number where the first row of
- // the current line is 0.
- cursorX, cursorY int
- // maxLine is the greatest value of cursorY so far.
- maxLine int
-
- termWidth, termHeight int
-
- // outBuf contains the terminal data to be sent.
- outBuf []byte
- // remainder contains the remainder of any partial key sequences after
- // a read. It aliases into inBuf.
- remainder []byte
- inBuf [256]byte
-
- // history contains previously entered commands so that they can be
- // accessed with the up and down keys.
- history stRingBuffer
- // historyIndex stores the currently accessed history entry, where zero
- // means the immediately previous entry.
- historyIndex int
- // When navigating up and down the history it's possible to return to
- // the incomplete, initial line. That value is stored in
- // historyPending.
- historyPending string
-}
-
-// NewTerminal runs a VT100 terminal on the given ReadWriter. If the ReadWriter is
-// a local terminal, that terminal must first have been put into raw mode.
-// prompt is a string that is written at the start of each input line (i.e.
-// "> ").
-func NewTerminal(c io.ReadWriter, prompt string) *Terminal {
- return &Terminal{
- Escape: &vt100EscapeCodes,
- c: c,
- prompt: []rune(prompt),
- termWidth: 80,
- termHeight: 24,
- echo: true,
- historyIndex: -1,
- }
-}
-
-const (
- keyCtrlC = 3
- keyCtrlD = 4
- keyCtrlU = 21
- keyEnter = '\r'
- keyEscape = 27
- keyBackspace = 127
- keyUnknown = 0xd800 /* UTF-16 surrogate area */ + iota
- keyUp
- keyDown
- keyLeft
- keyRight
- keyAltLeft
- keyAltRight
- keyHome
- keyEnd
- keyDeleteWord
- keyDeleteLine
- keyClearScreen
- keyPasteStart
- keyPasteEnd
-)
-
-var (
- crlf = []byte{'\r', '\n'}
- pasteStart = []byte{keyEscape, '[', '2', '0', '0', '~'}
- pasteEnd = []byte{keyEscape, '[', '2', '0', '1', '~'}
-)
-
-// bytesToKey tries to parse a key sequence from b. If successful, it returns
-// the key and the remainder of the input. Otherwise it returns utf8.RuneError.
-func bytesToKey(b []byte, pasteActive bool) (rune, []byte) {
- if len(b) == 0 {
- return utf8.RuneError, nil
- }
-
- if !pasteActive {
- switch b[0] {
- case 1: // ^A
- return keyHome, b[1:]
- case 2: // ^B
- return keyLeft, b[1:]
- case 5: // ^E
- return keyEnd, b[1:]
- case 6: // ^F
- return keyRight, b[1:]
- case 8: // ^H
- return keyBackspace, b[1:]
- case 11: // ^K
- return keyDeleteLine, b[1:]
- case 12: // ^L
- return keyClearScreen, b[1:]
- case 23: // ^W
- return keyDeleteWord, b[1:]
- case 14: // ^N
- return keyDown, b[1:]
- case 16: // ^P
- return keyUp, b[1:]
- }
- }
-
- if b[0] != keyEscape {
- if !utf8.FullRune(b) {
- return utf8.RuneError, b
- }
- r, l := utf8.DecodeRune(b)
- return r, b[l:]
- }
-
- if !pasteActive && len(b) >= 3 && b[0] == keyEscape && b[1] == '[' {
- switch b[2] {
- case 'A':
- return keyUp, b[3:]
- case 'B':
- return keyDown, b[3:]
- case 'C':
- return keyRight, b[3:]
- case 'D':
- return keyLeft, b[3:]
- case 'H':
- return keyHome, b[3:]
- case 'F':
- return keyEnd, b[3:]
- }
- }
-
- if !pasteActive && len(b) >= 6 && b[0] == keyEscape && b[1] == '[' && b[2] == '1' && b[3] == ';' && b[4] == '3' {
- switch b[5] {
- case 'C':
- return keyAltRight, b[6:]
- case 'D':
- return keyAltLeft, b[6:]
- }
- }
-
- if !pasteActive && len(b) >= 6 && bytes.Equal(b[:6], pasteStart) {
- return keyPasteStart, b[6:]
- }
-
- if pasteActive && len(b) >= 6 && bytes.Equal(b[:6], pasteEnd) {
- return keyPasteEnd, b[6:]
- }
-
- // If we get here then we have a key that we don't recognise, or a
- // partial sequence. It's not clear how one should find the end of a
- // sequence without knowing them all, but it seems that [a-zA-Z~] only
- // appears at the end of a sequence.
- for i, c := range b[0:] {
- if c >= 'a' && c <= 'z' || c >= 'A' && c <= 'Z' || c == '~' {
- return keyUnknown, b[i+1:]
- }
- }
-
- return utf8.RuneError, b
-}
-
-// queue appends data to the end of t.outBuf
-func (t *Terminal) queue(data []rune) {
- t.outBuf = append(t.outBuf, []byte(string(data))...)
-}
-
-var space = []rune{' '}
-
-func isPrintable(key rune) bool {
- isInSurrogateArea := key >= 0xd800 && key <= 0xdbff
- return key >= 32 && !isInSurrogateArea
-}
-
-// moveCursorToPos appends data to t.outBuf which will move the cursor to the
-// given, logical position in the text.
-func (t *Terminal) moveCursorToPos(pos int) {
- if !t.echo {
- return
- }
-
- x := visualLength(t.prompt) + pos
- y := x / t.termWidth
- x = x % t.termWidth
-
- up := 0
- if y < t.cursorY {
- up = t.cursorY - y
- }
-
- down := 0
- if y > t.cursorY {
- down = y - t.cursorY
- }
-
- left := 0
- if x < t.cursorX {
- left = t.cursorX - x
- }
-
- right := 0
- if x > t.cursorX {
- right = x - t.cursorX
- }
-
- t.cursorX = x
- t.cursorY = y
- t.move(up, down, left, right)
-}
-
-func (t *Terminal) move(up, down, left, right int) {
- m := []rune{}
-
- // 1 unit up can be expressed as ^[[A or ^[A
- // 5 units up can be expressed as ^[[5A
-
- if up == 1 {
- m = append(m, keyEscape, '[', 'A')
- } else if up > 1 {
- m = append(m, keyEscape, '[')
- m = append(m, []rune(strconv.Itoa(up))...)
- m = append(m, 'A')
- }
-
- if down == 1 {
- m = append(m, keyEscape, '[', 'B')
- } else if down > 1 {
- m = append(m, keyEscape, '[')
- m = append(m, []rune(strconv.Itoa(down))...)
- m = append(m, 'B')
- }
-
- if right == 1 {
- m = append(m, keyEscape, '[', 'C')
- } else if right > 1 {
- m = append(m, keyEscape, '[')
- m = append(m, []rune(strconv.Itoa(right))...)
- m = append(m, 'C')
- }
-
- if left == 1 {
- m = append(m, keyEscape, '[', 'D')
- } else if left > 1 {
- m = append(m, keyEscape, '[')
- m = append(m, []rune(strconv.Itoa(left))...)
- m = append(m, 'D')
- }
-
- t.queue(m)
-}
-
-func (t *Terminal) clearLineToRight() {
- op := []rune{keyEscape, '[', 'K'}
- t.queue(op)
-}
-
-const maxLineLength = 4096
-
-func (t *Terminal) setLine(newLine []rune, newPos int) {
- if t.echo {
- t.moveCursorToPos(0)
- t.writeLine(newLine)
- for i := len(newLine); i < len(t.line); i++ {
- t.writeLine(space)
- }
- t.moveCursorToPos(newPos)
- }
- t.line = newLine
- t.pos = newPos
-}
-
-func (t *Terminal) advanceCursor(places int) {
- t.cursorX += places
- t.cursorY += t.cursorX / t.termWidth
- if t.cursorY > t.maxLine {
- t.maxLine = t.cursorY
- }
- t.cursorX = t.cursorX % t.termWidth
-
- if places > 0 && t.cursorX == 0 {
- // Normally terminals will advance the current position
- // when writing a character. But that doesn't happen
- // for the last character in a line. However, when
- // writing a character (except a new line) that causes
- // a line wrap, the position will be advanced two
- // places.
- //
- // So, if we are stopping at the end of a line, we
- // need to write a newline so that our cursor can be
- // advanced to the next line.
- t.outBuf = append(t.outBuf, '\r', '\n')
- }
-}
-
-func (t *Terminal) eraseNPreviousChars(n int) {
- if n == 0 {
- return
- }
-
- if t.pos < n {
- n = t.pos
- }
- t.pos -= n
- t.moveCursorToPos(t.pos)
-
- copy(t.line[t.pos:], t.line[n+t.pos:])
- t.line = t.line[:len(t.line)-n]
- if t.echo {
- t.writeLine(t.line[t.pos:])
- for i := 0; i < n; i++ {
- t.queue(space)
- }
- t.advanceCursor(n)
- t.moveCursorToPos(t.pos)
- }
-}
-
-// countToLeftWord returns then number of characters from the cursor to the
-// start of the previous word.
-func (t *Terminal) countToLeftWord() int {
- if t.pos == 0 {
- return 0
- }
-
- pos := t.pos - 1
- for pos > 0 {
- if t.line[pos] != ' ' {
- break
- }
- pos--
- }
- for pos > 0 {
- if t.line[pos] == ' ' {
- pos++
- break
- }
- pos--
- }
-
- return t.pos - pos
-}
-
-// countToRightWord returns then number of characters from the cursor to the
-// start of the next word.
-func (t *Terminal) countToRightWord() int {
- pos := t.pos
- for pos < len(t.line) {
- if t.line[pos] == ' ' {
- break
- }
- pos++
- }
- for pos < len(t.line) {
- if t.line[pos] != ' ' {
- break
- }
- pos++
- }
- return pos - t.pos
-}
-
-// visualLength returns the number of visible glyphs in s.
-func visualLength(runes []rune) int {
- inEscapeSeq := false
- length := 0
-
- for _, r := range runes {
- switch {
- case inEscapeSeq:
- if (r >= 'a' && r <= 'z') || (r >= 'A' && r <= 'Z') {
- inEscapeSeq = false
- }
- case r == '\x1b':
- inEscapeSeq = true
- default:
- length++
- }
- }
-
- return length
-}
-
-// handleKey processes the given key and, optionally, returns a line of text
-// that the user has entered.
-func (t *Terminal) handleKey(key rune) (line string, ok bool) {
- if t.pasteActive && key != keyEnter {
- t.addKeyToLine(key)
- return
- }
-
- switch key {
- case keyBackspace:
- if t.pos == 0 {
- return
- }
- t.eraseNPreviousChars(1)
- case keyAltLeft:
- // move left by a word.
- t.pos -= t.countToLeftWord()
- t.moveCursorToPos(t.pos)
- case keyAltRight:
- // move right by a word.
- t.pos += t.countToRightWord()
- t.moveCursorToPos(t.pos)
- case keyLeft:
- if t.pos == 0 {
- return
- }
- t.pos--
- t.moveCursorToPos(t.pos)
- case keyRight:
- if t.pos == len(t.line) {
- return
- }
- t.pos++
- t.moveCursorToPos(t.pos)
- case keyHome:
- if t.pos == 0 {
- return
- }
- t.pos = 0
- t.moveCursorToPos(t.pos)
- case keyEnd:
- if t.pos == len(t.line) {
- return
- }
- t.pos = len(t.line)
- t.moveCursorToPos(t.pos)
- case keyUp:
- entry, ok := t.history.NthPreviousEntry(t.historyIndex + 1)
- if !ok {
- return "", false
- }
- if t.historyIndex == -1 {
- t.historyPending = string(t.line)
- }
- t.historyIndex++
- runes := []rune(entry)
- t.setLine(runes, len(runes))
- case keyDown:
- switch t.historyIndex {
- case -1:
- return
- case 0:
- runes := []rune(t.historyPending)
- t.setLine(runes, len(runes))
- t.historyIndex--
- default:
- entry, ok := t.history.NthPreviousEntry(t.historyIndex - 1)
- if ok {
- t.historyIndex--
- runes := []rune(entry)
- t.setLine(runes, len(runes))
- }
- }
- case keyEnter:
- t.moveCursorToPos(len(t.line))
- t.queue([]rune("\r\n"))
- line = string(t.line)
- ok = true
- t.line = t.line[:0]
- t.pos = 0
- t.cursorX = 0
- t.cursorY = 0
- t.maxLine = 0
- case keyDeleteWord:
- // Delete zero or more spaces and then one or more characters.
- t.eraseNPreviousChars(t.countToLeftWord())
- case keyDeleteLine:
- // Delete everything from the current cursor position to the
- // end of line.
- for i := t.pos; i < len(t.line); i++ {
- t.queue(space)
- t.advanceCursor(1)
- }
- t.line = t.line[:t.pos]
- t.moveCursorToPos(t.pos)
- case keyCtrlD:
- // Erase the character under the current position.
- // The EOF case when the line is empty is handled in
- // readLine().
- if t.pos < len(t.line) {
- t.pos++
- t.eraseNPreviousChars(1)
- }
- case keyCtrlU:
- t.eraseNPreviousChars(t.pos)
- case keyClearScreen:
- // Erases the screen and moves the cursor to the home position.
- t.queue([]rune("\x1b[2J\x1b[H"))
- t.queue(t.prompt)
- t.cursorX, t.cursorY = 0, 0
- t.advanceCursor(visualLength(t.prompt))
- t.setLine(t.line, t.pos)
- default:
- if t.AutoCompleteCallback != nil {
- prefix := string(t.line[:t.pos])
- suffix := string(t.line[t.pos:])
-
- t.lock.Unlock()
- newLine, newPos, completeOk := t.AutoCompleteCallback(prefix+suffix, len(prefix), key)
- t.lock.Lock()
-
- if completeOk {
- t.setLine([]rune(newLine), utf8.RuneCount([]byte(newLine)[:newPos]))
- return
- }
- }
- if !isPrintable(key) {
- return
- }
- if len(t.line) == maxLineLength {
- return
- }
- t.addKeyToLine(key)
- }
- return
-}
-
-// addKeyToLine inserts the given key at the current position in the current
-// line.
-func (t *Terminal) addKeyToLine(key rune) {
- if len(t.line) == cap(t.line) {
- newLine := make([]rune, len(t.line), 2*(1+len(t.line)))
- copy(newLine, t.line)
- t.line = newLine
- }
- t.line = t.line[:len(t.line)+1]
- copy(t.line[t.pos+1:], t.line[t.pos:])
- t.line[t.pos] = key
- if t.echo {
- t.writeLine(t.line[t.pos:])
- }
- t.pos++
- t.moveCursorToPos(t.pos)
-}
-
-func (t *Terminal) writeLine(line []rune) {
- for len(line) != 0 {
- remainingOnLine := t.termWidth - t.cursorX
- todo := len(line)
- if todo > remainingOnLine {
- todo = remainingOnLine
- }
- t.queue(line[:todo])
- t.advanceCursor(visualLength(line[:todo]))
- line = line[todo:]
- }
-}
-
-// writeWithCRLF writes buf to w but replaces all occurrences of \n with \r\n.
-func writeWithCRLF(w io.Writer, buf []byte) (n int, err error) {
- for len(buf) > 0 {
- i := bytes.IndexByte(buf, '\n')
- todo := len(buf)
- if i >= 0 {
- todo = i
- }
-
- var nn int
- nn, err = w.Write(buf[:todo])
- n += nn
- if err != nil {
- return n, err
- }
- buf = buf[todo:]
-
- if i >= 0 {
- if _, err = w.Write(crlf); err != nil {
- return n, err
- }
- n++
- buf = buf[1:]
- }
- }
-
- return n, nil
-}
-
-func (t *Terminal) Write(buf []byte) (n int, err error) {
- t.lock.Lock()
- defer t.lock.Unlock()
-
- if t.cursorX == 0 && t.cursorY == 0 {
- // This is the easy case: there's nothing on the screen that we
- // have to move out of the way.
- return writeWithCRLF(t.c, buf)
- }
-
- // We have a prompt and possibly user input on the screen. We
- // have to clear it first.
- t.move(0 /* up */, 0 /* down */, t.cursorX /* left */, 0 /* right */)
- t.cursorX = 0
- t.clearLineToRight()
-
- for t.cursorY > 0 {
- t.move(1 /* up */, 0, 0, 0)
- t.cursorY--
- t.clearLineToRight()
- }
-
- if _, err = t.c.Write(t.outBuf); err != nil {
- return
- }
- t.outBuf = t.outBuf[:0]
-
- if n, err = writeWithCRLF(t.c, buf); err != nil {
- return
- }
-
- t.writeLine(t.prompt)
- if t.echo {
- t.writeLine(t.line)
- }
-
- t.moveCursorToPos(t.pos)
-
- if _, err = t.c.Write(t.outBuf); err != nil {
- return
- }
- t.outBuf = t.outBuf[:0]
- return
-}
-
-// ReadPassword temporarily changes the prompt and reads a password, without
-// echo, from the terminal.
-func (t *Terminal) ReadPassword(prompt string) (line string, err error) {
- t.lock.Lock()
- defer t.lock.Unlock()
-
- oldPrompt := t.prompt
- t.prompt = []rune(prompt)
- t.echo = false
-
- line, err = t.readLine()
-
- t.prompt = oldPrompt
- t.echo = true
-
- return
-}
-
-// ReadLine returns a line of input from the terminal.
-func (t *Terminal) ReadLine() (line string, err error) {
- t.lock.Lock()
- defer t.lock.Unlock()
-
- return t.readLine()
-}
-
-func (t *Terminal) readLine() (line string, err error) {
- // t.lock must be held at this point
-
- if t.cursorX == 0 && t.cursorY == 0 {
- t.writeLine(t.prompt)
- t.c.Write(t.outBuf)
- t.outBuf = t.outBuf[:0]
- }
-
- lineIsPasted := t.pasteActive
-
- for {
- rest := t.remainder
- lineOk := false
- for !lineOk {
- var key rune
- key, rest = bytesToKey(rest, t.pasteActive)
- if key == utf8.RuneError {
- break
- }
- if !t.pasteActive {
- if key == keyCtrlD {
- if len(t.line) == 0 {
- return "", io.EOF
- }
- }
- if key == keyCtrlC {
- return "", io.EOF
- }
- if key == keyPasteStart {
- t.pasteActive = true
- if len(t.line) == 0 {
- lineIsPasted = true
- }
- continue
- }
- } else if key == keyPasteEnd {
- t.pasteActive = false
- continue
- }
- if !t.pasteActive {
- lineIsPasted = false
- }
- line, lineOk = t.handleKey(key)
- }
- if len(rest) > 0 {
- n := copy(t.inBuf[:], rest)
- t.remainder = t.inBuf[:n]
- } else {
- t.remainder = nil
- }
- t.c.Write(t.outBuf)
- t.outBuf = t.outBuf[:0]
- if lineOk {
- if t.echo {
- t.historyIndex = -1
- t.history.Add(line)
- }
- if lineIsPasted {
- err = ErrPasteIndicator
- }
- return
- }
-
- // t.remainder is a slice at the beginning of t.inBuf
- // containing a partial key sequence
- readBuf := t.inBuf[len(t.remainder):]
- var n int
-
- t.lock.Unlock()
- n, err = t.c.Read(readBuf)
- t.lock.Lock()
-
- if err != nil {
- return
- }
-
- t.remainder = t.inBuf[:n+len(t.remainder)]
- }
-}
-
-// SetPrompt sets the prompt to be used when reading subsequent lines.
-func (t *Terminal) SetPrompt(prompt string) {
- t.lock.Lock()
- defer t.lock.Unlock()
-
- t.prompt = []rune(prompt)
-}
-
-func (t *Terminal) clearAndRepaintLinePlusNPrevious(numPrevLines int) {
- // Move cursor to column zero at the start of the line.
- t.move(t.cursorY, 0, t.cursorX, 0)
- t.cursorX, t.cursorY = 0, 0
- t.clearLineToRight()
- for t.cursorY < numPrevLines {
- // Move down a line
- t.move(0, 1, 0, 0)
- t.cursorY++
- t.clearLineToRight()
- }
- // Move back to beginning.
- t.move(t.cursorY, 0, 0, 0)
- t.cursorX, t.cursorY = 0, 0
-
- t.queue(t.prompt)
- t.advanceCursor(visualLength(t.prompt))
- t.writeLine(t.line)
- t.moveCursorToPos(t.pos)
-}
-
-func (t *Terminal) SetSize(width, height int) error {
- t.lock.Lock()
- defer t.lock.Unlock()
-
- if width == 0 {
- width = 1
- }
-
- oldWidth := t.termWidth
- t.termWidth, t.termHeight = width, height
-
- switch {
- case width == oldWidth:
- // If the width didn't change then nothing else needs to be
- // done.
- return nil
- case len(t.line) == 0 && t.cursorX == 0 && t.cursorY == 0:
- // If there is nothing on current line and no prompt printed,
- // just do nothing
- return nil
- case width < oldWidth:
- // Some terminals (e.g. xterm) will truncate lines that were
- // too long when shinking. Others, (e.g. gnome-terminal) will
- // attempt to wrap them. For the former, repainting t.maxLine
- // works great, but that behaviour goes badly wrong in the case
- // of the latter because they have doubled every full line.
-
- // We assume that we are working on a terminal that wraps lines
- // and adjust the cursor position based on every previous line
- // wrapping and turning into two. This causes the prompt on
- // xterms to move upwards, which isn't great, but it avoids a
- // huge mess with gnome-terminal.
- if t.cursorX >= t.termWidth {
- t.cursorX = t.termWidth - 1
- }
- t.cursorY *= 2
- t.clearAndRepaintLinePlusNPrevious(t.maxLine * 2)
- case width > oldWidth:
- // If the terminal expands then our position calculations will
- // be wrong in the future because we think the cursor is
- // |t.pos| chars into the string, but there will be a gap at
- // the end of any wrapped line.
- //
- // But the position will actually be correct until we move, so
- // we can move back to the beginning and repaint everything.
- t.clearAndRepaintLinePlusNPrevious(t.maxLine)
- }
-
- _, err := t.c.Write(t.outBuf)
- t.outBuf = t.outBuf[:0]
- return err
-}
-
-type pasteIndicatorError struct{}
-
-func (pasteIndicatorError) Error() string {
- return "terminal: ErrPasteIndicator not correctly handled"
-}
-
-// ErrPasteIndicator may be returned from ReadLine as the error, in addition
-// to valid line data. It indicates that bracketed paste mode is enabled and
-// that the returned line consists only of pasted data. Programs may wish to
-// interpret pasted data more literally than typed data.
-var ErrPasteIndicator = pasteIndicatorError{}
-
-// SetBracketedPasteMode requests that the terminal bracket paste operations
-// with markers. Not all terminals support this but, if it is supported, then
-// enabling this mode will stop any autocomplete callback from running due to
-// pastes. Additionally, any lines that are completely pasted will be returned
-// from ReadLine with the error set to ErrPasteIndicator.
-func (t *Terminal) SetBracketedPasteMode(on bool) {
- if on {
- io.WriteString(t.c, "\x1b[?2004h")
- } else {
- io.WriteString(t.c, "\x1b[?2004l")
- }
-}
-
-// stRingBuffer is a ring buffer of strings.
-type stRingBuffer struct {
- // entries contains max elements.
- entries []string
- max int
- // head contains the index of the element most recently added to the ring.
- head int
- // size contains the number of elements in the ring.
- size int
-}
-
-func (s *stRingBuffer) Add(a string) {
- if s.entries == nil {
- const defaultNumEntries = 100
- s.entries = make([]string, defaultNumEntries)
- s.max = defaultNumEntries
- }
-
- s.head = (s.head + 1) % s.max
- s.entries[s.head] = a
- if s.size < s.max {
- s.size++
- }
-}
-
-// NthPreviousEntry returns the value passed to the nth previous call to Add.
-// If n is zero then the immediately prior value is returned, if one, then the
-// next most recent, and so on. If such an element doesn't exist then ok is
-// false.
-func (s *stRingBuffer) NthPreviousEntry(n int) (value string, ok bool) {
- if n < 0 || n >= s.size {
- return "", false
- }
- index := s.head - n
- if index < 0 {
- index += s.max
- }
- return s.entries[index], true
-}
-
-// readPasswordLine reads from reader until it finds \n or io.EOF.
-// The slice returned does not include the \n.
-// readPasswordLine also ignores any \r it finds.
-// Windows uses \r as end of line. So, on Windows, readPasswordLine
-// reads until it finds \r and ignores any \n it finds during processing.
-func readPasswordLine(reader io.Reader) ([]byte, error) {
- var buf [1]byte
- var ret []byte
-
- for {
- n, err := reader.Read(buf[:])
- if n > 0 {
- switch buf[0] {
- case '\b':
- if len(ret) > 0 {
- ret = ret[:len(ret)-1]
- }
- case '\n':
- if runtime.GOOS != "windows" {
- return ret, nil
- }
- // otherwise ignore \n
- case '\r':
- if runtime.GOOS == "windows" {
- return ret, nil
- }
- // otherwise ignore \r
- default:
- ret = append(ret, buf[0])
- }
- continue
- }
- if err != nil {
- if err == io.EOF && len(ret) > 0 {
- return ret, nil
- }
- return ret, err
- }
- }
-}
diff --git a/vendor/golang.org/x/text/secure/bidirule/bidirule10.0.0.go b/vendor/golang.org/x/text/secure/bidirule/bidirule10.0.0.go
index 8a7392c4..784bb880 100644
--- a/vendor/golang.org/x/text/secure/bidirule/bidirule10.0.0.go
+++ b/vendor/golang.org/x/text/secure/bidirule/bidirule10.0.0.go
@@ -3,7 +3,6 @@
// license that can be found in the LICENSE file.
//go:build go1.10
-// +build go1.10
package bidirule
diff --git a/vendor/golang.org/x/text/secure/bidirule/bidirule9.0.0.go b/vendor/golang.org/x/text/secure/bidirule/bidirule9.0.0.go
index bb0a9200..8e1e9439 100644
--- a/vendor/golang.org/x/text/secure/bidirule/bidirule9.0.0.go
+++ b/vendor/golang.org/x/text/secure/bidirule/bidirule9.0.0.go
@@ -3,7 +3,6 @@
// license that can be found in the LICENSE file.
//go:build !go1.10
-// +build !go1.10
package bidirule
diff --git a/vendor/golang.org/x/text/unicode/bidi/tables10.0.0.go b/vendor/golang.org/x/text/unicode/bidi/tables10.0.0.go
index 42fa8d72..d2bd7118 100644
--- a/vendor/golang.org/x/text/unicode/bidi/tables10.0.0.go
+++ b/vendor/golang.org/x/text/unicode/bidi/tables10.0.0.go
@@ -1,7 +1,6 @@
// Code generated by running "go generate" in golang.org/x/text. DO NOT EDIT.
//go:build go1.10 && !go1.13
-// +build go1.10,!go1.13
package bidi
diff --git a/vendor/golang.org/x/text/unicode/bidi/tables11.0.0.go b/vendor/golang.org/x/text/unicode/bidi/tables11.0.0.go
index 56a0e1ea..f76bdca2 100644
--- a/vendor/golang.org/x/text/unicode/bidi/tables11.0.0.go
+++ b/vendor/golang.org/x/text/unicode/bidi/tables11.0.0.go
@@ -1,7 +1,6 @@
// Code generated by running "go generate" in golang.org/x/text. DO NOT EDIT.
//go:build go1.13 && !go1.14
-// +build go1.13,!go1.14
package bidi
diff --git a/vendor/golang.org/x/text/unicode/bidi/tables12.0.0.go b/vendor/golang.org/x/text/unicode/bidi/tables12.0.0.go
index baacf32b..3aa2c3bd 100644
--- a/vendor/golang.org/x/text/unicode/bidi/tables12.0.0.go
+++ b/vendor/golang.org/x/text/unicode/bidi/tables12.0.0.go
@@ -1,7 +1,6 @@
// Code generated by running "go generate" in golang.org/x/text. DO NOT EDIT.
//go:build go1.14 && !go1.16
-// +build go1.14,!go1.16
package bidi
diff --git a/vendor/golang.org/x/text/unicode/bidi/tables13.0.0.go b/vendor/golang.org/x/text/unicode/bidi/tables13.0.0.go
index ffadb7be..a7137579 100644
--- a/vendor/golang.org/x/text/unicode/bidi/tables13.0.0.go
+++ b/vendor/golang.org/x/text/unicode/bidi/tables13.0.0.go
@@ -1,7 +1,6 @@
// Code generated by running "go generate" in golang.org/x/text. DO NOT EDIT.
//go:build go1.16 && !go1.21
-// +build go1.16,!go1.21
package bidi
diff --git a/vendor/golang.org/x/text/unicode/bidi/tables15.0.0.go b/vendor/golang.org/x/text/unicode/bidi/tables15.0.0.go
index 92cce580..f15746f7 100644
--- a/vendor/golang.org/x/text/unicode/bidi/tables15.0.0.go
+++ b/vendor/golang.org/x/text/unicode/bidi/tables15.0.0.go
@@ -1,7 +1,6 @@
// Code generated by running "go generate" in golang.org/x/text. DO NOT EDIT.
//go:build go1.21
-// +build go1.21
package bidi
diff --git a/vendor/golang.org/x/text/unicode/bidi/tables9.0.0.go b/vendor/golang.org/x/text/unicode/bidi/tables9.0.0.go
index f517fdb2..c164d379 100644
--- a/vendor/golang.org/x/text/unicode/bidi/tables9.0.0.go
+++ b/vendor/golang.org/x/text/unicode/bidi/tables9.0.0.go
@@ -1,7 +1,6 @@
// Code generated by running "go generate" in golang.org/x/text. DO NOT EDIT.
//go:build !go1.10
-// +build !go1.10
package bidi
diff --git a/vendor/golang.org/x/text/unicode/norm/tables10.0.0.go b/vendor/golang.org/x/text/unicode/norm/tables10.0.0.go
index f5a07882..1af161c7 100644
--- a/vendor/golang.org/x/text/unicode/norm/tables10.0.0.go
+++ b/vendor/golang.org/x/text/unicode/norm/tables10.0.0.go
@@ -1,7 +1,6 @@
// Code generated by running "go generate" in golang.org/x/text. DO NOT EDIT.
//go:build go1.10 && !go1.13
-// +build go1.10,!go1.13
package norm
diff --git a/vendor/golang.org/x/text/unicode/norm/tables11.0.0.go b/vendor/golang.org/x/text/unicode/norm/tables11.0.0.go
index cb7239c4..eb73ecc3 100644
--- a/vendor/golang.org/x/text/unicode/norm/tables11.0.0.go
+++ b/vendor/golang.org/x/text/unicode/norm/tables11.0.0.go
@@ -1,7 +1,6 @@
// Code generated by running "go generate" in golang.org/x/text. DO NOT EDIT.
//go:build go1.13 && !go1.14
-// +build go1.13,!go1.14
package norm
diff --git a/vendor/golang.org/x/text/unicode/norm/tables12.0.0.go b/vendor/golang.org/x/text/unicode/norm/tables12.0.0.go
index 11b27330..276cb8d8 100644
--- a/vendor/golang.org/x/text/unicode/norm/tables12.0.0.go
+++ b/vendor/golang.org/x/text/unicode/norm/tables12.0.0.go
@@ -1,7 +1,6 @@
// Code generated by running "go generate" in golang.org/x/text. DO NOT EDIT.
//go:build go1.14 && !go1.16
-// +build go1.14,!go1.16
package norm
diff --git a/vendor/golang.org/x/text/unicode/norm/tables13.0.0.go b/vendor/golang.org/x/text/unicode/norm/tables13.0.0.go
index f65785e8..0cceffd7 100644
--- a/vendor/golang.org/x/text/unicode/norm/tables13.0.0.go
+++ b/vendor/golang.org/x/text/unicode/norm/tables13.0.0.go
@@ -1,7 +1,6 @@
// Code generated by running "go generate" in golang.org/x/text. DO NOT EDIT.
//go:build go1.16 && !go1.21
-// +build go1.16,!go1.21
package norm
diff --git a/vendor/golang.org/x/text/unicode/norm/tables15.0.0.go b/vendor/golang.org/x/text/unicode/norm/tables15.0.0.go
index e1858b87..b0819e42 100644
--- a/vendor/golang.org/x/text/unicode/norm/tables15.0.0.go
+++ b/vendor/golang.org/x/text/unicode/norm/tables15.0.0.go
@@ -1,7 +1,6 @@
// Code generated by running "go generate" in golang.org/x/text. DO NOT EDIT.
//go:build go1.21
-// +build go1.21
package norm
diff --git a/vendor/golang.org/x/text/unicode/norm/tables9.0.0.go b/vendor/golang.org/x/text/unicode/norm/tables9.0.0.go
index 0175eae5..bf65457d 100644
--- a/vendor/golang.org/x/text/unicode/norm/tables9.0.0.go
+++ b/vendor/golang.org/x/text/unicode/norm/tables9.0.0.go
@@ -1,7 +1,6 @@
// Code generated by running "go generate" in golang.org/x/text. DO NOT EDIT.
//go:build !go1.10
-// +build !go1.10
package norm
diff --git a/vendor/google.golang.org/grpc/README.md b/vendor/google.golang.org/grpc/README.md
index 1bc92248..ab0fbb79 100644
--- a/vendor/google.golang.org/grpc/README.md
+++ b/vendor/google.golang.org/grpc/README.md
@@ -1,8 +1,8 @@
# gRPC-Go
-[](https://travis-ci.org/grpc/grpc-go)
[][API]
[](https://goreportcard.com/report/github.com/grpc/grpc-go)
+[](https://codecov.io/gh/grpc/grpc-go)
The [Go][] implementation of [gRPC][]: A high performance, open source, general
RPC framework that puts mobile and HTTP/2 first. For more information see the
diff --git a/vendor/google.golang.org/grpc/attributes/attributes.go b/vendor/google.golang.org/grpc/attributes/attributes.go
index 712fef4d..52d530d7 100644
--- a/vendor/google.golang.org/grpc/attributes/attributes.go
+++ b/vendor/google.golang.org/grpc/attributes/attributes.go
@@ -121,9 +121,9 @@ func (a *Attributes) String() string {
return sb.String()
}
-func str(x any) string {
+func str(x any) (s string) {
if v, ok := x.(fmt.Stringer); ok {
- return v.String()
+ return fmt.Sprint(v)
} else if v, ok := x.(string); ok {
return v
}
diff --git a/vendor/google.golang.org/grpc/balancer/balancer.go b/vendor/google.golang.org/grpc/balancer/balancer.go
index b6377f44..d79560a2 100644
--- a/vendor/google.golang.org/grpc/balancer/balancer.go
+++ b/vendor/google.golang.org/grpc/balancer/balancer.go
@@ -30,6 +30,7 @@ import (
"google.golang.org/grpc/channelz"
"google.golang.org/grpc/connectivity"
"google.golang.org/grpc/credentials"
+ "google.golang.org/grpc/grpclog"
"google.golang.org/grpc/internal"
"google.golang.org/grpc/metadata"
"google.golang.org/grpc/resolver"
@@ -39,6 +40,8 @@ import (
var (
// m is a map from name to balancer builder.
m = make(map[string]Builder)
+
+ logger = grpclog.Component("balancer")
)
// Register registers the balancer builder to the balancer map. b.Name
@@ -51,6 +54,12 @@ var (
// an init() function), and is not thread-safe. If multiple Balancers are
// registered with the same name, the one registered last will take effect.
func Register(b Builder) {
+ if strings.ToLower(b.Name()) != b.Name() {
+ // TODO: Skip the use of strings.ToLower() to index the map after v1.59
+ // is released to switch to case sensitive balancer registry. Also,
+ // remove this warning and update the docstrings for Register and Get.
+ logger.Warningf("Balancer registered with name %q. grpc-go will be switching to case sensitive balancer registries soon", b.Name())
+ }
m[strings.ToLower(b.Name())] = b
}
@@ -70,6 +79,12 @@ func init() {
// Note that the compare is done in a case-insensitive fashion.
// If no builder is register with the name, nil will be returned.
func Get(name string) Builder {
+ if strings.ToLower(name) != name {
+ // TODO: Skip the use of strings.ToLower() to index the map after v1.59
+ // is released to switch to case sensitive balancer registry. Also,
+ // remove this warning and update the docstrings for Register and Get.
+ logger.Warningf("Balancer retrieved for name %q. grpc-go will be switching to case sensitive balancer registries soon", name)
+ }
if b, ok := m[strings.ToLower(name)]; ok {
return b
}
diff --git a/vendor/google.golang.org/grpc/call.go b/vendor/google.golang.org/grpc/call.go
index a67a3db0..788c89c1 100644
--- a/vendor/google.golang.org/grpc/call.go
+++ b/vendor/google.golang.org/grpc/call.go
@@ -27,11 +27,6 @@ import (
//
// All errors returned by Invoke are compatible with the status package.
func (cc *ClientConn) Invoke(ctx context.Context, method string, args, reply any, opts ...CallOption) error {
- if err := cc.idlenessMgr.OnCallBegin(); err != nil {
- return err
- }
- defer cc.idlenessMgr.OnCallEnd()
-
// allow interceptor to see all applicable call options, which means those
// configured as defaults from dial option as well as per-call options
opts = combine(cc.dopts.callOptions, opts)
diff --git a/vendor/google.golang.org/grpc/clientconn.go b/vendor/google.golang.org/grpc/clientconn.go
index d53d91d5..429c389e 100644
--- a/vendor/google.golang.org/grpc/clientconn.go
+++ b/vendor/google.golang.org/grpc/clientconn.go
@@ -337,8 +337,8 @@ func (cc *ClientConn) exitIdleMode() error {
return errConnClosing
}
if cc.idlenessState != ccIdlenessStateIdle {
- cc.mu.Unlock()
channelz.Infof(logger, cc.channelzID, "ClientConn asked to exit idle mode, current mode is %v", cc.idlenessState)
+ cc.mu.Unlock()
return nil
}
@@ -404,13 +404,13 @@ func (cc *ClientConn) exitIdleMode() error {
// name resolver, load balancer and any subchannels.
func (cc *ClientConn) enterIdleMode() error {
cc.mu.Lock()
+ defer cc.mu.Unlock()
+
if cc.conns == nil {
- cc.mu.Unlock()
return ErrClientConnClosing
}
if cc.idlenessState != ccIdlenessStateActive {
- channelz.Errorf(logger, cc.channelzID, "ClientConn asked to enter idle mode, current mode is %v", cc.idlenessState)
- cc.mu.Unlock()
+ channelz.Warningf(logger, cc.channelzID, "ClientConn asked to enter idle mode, current mode is %v", cc.idlenessState)
return nil
}
@@ -431,14 +431,14 @@ func (cc *ClientConn) enterIdleMode() error {
cc.balancerWrapper.enterIdleMode()
cc.csMgr.updateState(connectivity.Idle)
cc.idlenessState = ccIdlenessStateIdle
- cc.mu.Unlock()
+ cc.addTraceEvent("entering idle mode")
go func() {
- cc.addTraceEvent("entering idle mode")
for ac := range conns {
ac.tearDown(errConnIdling)
}
}()
+
return nil
}
@@ -804,6 +804,12 @@ func init() {
internal.SubscribeToConnectivityStateChanges = func(cc *ClientConn, s grpcsync.Subscriber) func() {
return cc.csMgr.pubSub.Subscribe(s)
}
+ internal.EnterIdleModeForTesting = func(cc *ClientConn) error {
+ return cc.enterIdleMode()
+ }
+ internal.ExitIdleModeForTesting = func(cc *ClientConn) error {
+ return cc.exitIdleMode()
+ }
}
func (cc *ClientConn) maybeApplyDefaultServiceConfig(addrs []resolver.Address) {
@@ -1091,8 +1097,8 @@ func (ac *addrConn) updateAddrs(addrs []resolver.Address) {
ac.cancel()
ac.ctx, ac.cancel = context.WithCancel(ac.cc.ctx)
- // We have to defer here because GracefulClose => Close => onClose, which
- // requires locking ac.mu.
+ // We have to defer here because GracefulClose => onClose, which requires
+ // locking ac.mu.
if ac.transport != nil {
defer ac.transport.GracefulClose()
ac.transport = nil
@@ -1680,16 +1686,7 @@ func (ac *addrConn) tearDown(err error) {
ac.updateConnectivityState(connectivity.Shutdown, nil)
ac.cancel()
ac.curAddr = resolver.Address{}
- if err == errConnDrain && curTr != nil {
- // GracefulClose(...) may be executed multiple times when
- // i) receiving multiple GoAway frames from the server; or
- // ii) there are concurrent name resolver/Balancer triggered
- // address removal and GoAway.
- // We have to unlock and re-lock here because GracefulClose => Close => onClose, which requires locking ac.mu.
- ac.mu.Unlock()
- curTr.GracefulClose()
- ac.mu.Lock()
- }
+
channelz.AddTraceEvent(logger, ac.channelzID, 0, &channelz.TraceEventDesc{
Desc: "Subchannel deleted",
Severity: channelz.CtInfo,
@@ -1703,6 +1700,29 @@ func (ac *addrConn) tearDown(err error) {
// being deleted right away.
channelz.RemoveEntry(ac.channelzID)
ac.mu.Unlock()
+
+ // We have to release the lock before the call to GracefulClose/Close here
+ // because both of them call onClose(), which requires locking ac.mu.
+ if curTr != nil {
+ if err == errConnDrain {
+ // Close the transport gracefully when the subConn is being shutdown.
+ //
+ // GracefulClose() may be executed multiple times if:
+ // - multiple GoAway frames are received from the server
+ // - there are concurrent name resolver or balancer triggered
+ // address removal and GoAway
+ curTr.GracefulClose()
+ } else {
+ // Hard close the transport when the channel is entering idle or is
+ // being shutdown. In the case where the channel is being shutdown,
+ // closing of transports is also taken care of by cancelation of cc.ctx.
+ // But in the case where the channel is entering idle, we need to
+ // explicitly close the transports here. Instead of distinguishing
+ // between these two cases, it is simpler to close the transport
+ // unconditionally here.
+ curTr.Close(err)
+ }
+ }
}
func (ac *addrConn) getState() connectivity.State {
diff --git a/vendor/google.golang.org/grpc/dialoptions.go b/vendor/google.golang.org/grpc/dialoptions.go
index 1fd0d5c1..cfc9fd85 100644
--- a/vendor/google.golang.org/grpc/dialoptions.go
+++ b/vendor/google.golang.org/grpc/dialoptions.go
@@ -644,6 +644,7 @@ func defaultDialOptions() dialOptions {
UseProxy: true,
},
recvBufferPool: nopBufferPool{},
+ idleTimeout: 30 * time.Minute,
}
}
@@ -680,8 +681,8 @@ func WithResolvers(rs ...resolver.Builder) DialOption {
// channel will exit idle mode when the Connect() method is called or when an
// RPC is initiated.
//
-// By default this feature is disabled, which can also be explicitly configured
-// by passing zero to this function.
+// A default timeout of 30 minutes will be used if this dial option is not set
+// at dial time and idleness can be disabled by passing a timeout of zero.
//
// # Experimental
//
diff --git a/vendor/google.golang.org/grpc/encoding/encoding.go b/vendor/google.golang.org/grpc/encoding/encoding.go
index 69d5580b..5ebf88d7 100644
--- a/vendor/google.golang.org/grpc/encoding/encoding.go
+++ b/vendor/google.golang.org/grpc/encoding/encoding.go
@@ -38,6 +38,10 @@ const Identity = "identity"
// Compressor is used for compressing and decompressing when sending or
// receiving messages.
+//
+// If a Compressor implements `DecompressedSize(compressedBytes []byte) int`,
+// gRPC will invoke it to determine the size of the buffer allocated for the
+// result of decompression. A return value of -1 indicates unknown size.
type Compressor interface {
// Compress writes the data written to wc to w after compressing it. If an
// error occurs while initializing the compressor, that error is returned
@@ -51,15 +55,6 @@ type Compressor interface {
// coding header. The result must be static; the result cannot change
// between calls.
Name() string
- // If a Compressor implements
- // DecompressedSize(compressedBytes []byte) int, gRPC will call it
- // to determine the size of the buffer allocated for the result of decompression.
- // Return -1 to indicate unknown size.
- //
- // Experimental
- //
- // Notice: This API is EXPERIMENTAL and may be changed or removed in a
- // later release.
}
var registeredCompressor = make(map[string]Compressor)
diff --git a/vendor/google.golang.org/grpc/internal/backoff/backoff.go b/vendor/google.golang.org/grpc/internal/backoff/backoff.go
index 5fc0ee3d..fed1c011 100644
--- a/vendor/google.golang.org/grpc/internal/backoff/backoff.go
+++ b/vendor/google.golang.org/grpc/internal/backoff/backoff.go
@@ -23,6 +23,8 @@
package backoff
import (
+ "context"
+ "errors"
"time"
grpcbackoff "google.golang.org/grpc/backoff"
@@ -71,3 +73,37 @@ func (bc Exponential) Backoff(retries int) time.Duration {
}
return time.Duration(backoff)
}
+
+// ErrResetBackoff is the error to be returned by the function executed by RunF,
+// to instruct the latter to reset its backoff state.
+var ErrResetBackoff = errors.New("reset backoff state")
+
+// RunF provides a convenient way to run a function f repeatedly until the
+// context expires or f returns a non-nil error that is not ErrResetBackoff.
+// When f returns ErrResetBackoff, RunF continues to run f, but resets its
+// backoff state before doing so. backoff accepts an integer representing the
+// number of retries, and returns the amount of time to backoff.
+func RunF(ctx context.Context, f func() error, backoff func(int) time.Duration) {
+ attempt := 0
+ timer := time.NewTimer(0)
+ for ctx.Err() == nil {
+ select {
+ case <-timer.C:
+ case <-ctx.Done():
+ timer.Stop()
+ return
+ }
+
+ err := f()
+ if errors.Is(err, ErrResetBackoff) {
+ timer.Reset(0)
+ attempt = 0
+ continue
+ }
+ if err != nil {
+ return
+ }
+ timer.Reset(backoff(attempt))
+ attempt++
+ }
+}
diff --git a/vendor/google.golang.org/grpc/internal/internal.go b/vendor/google.golang.org/grpc/internal/internal.go
index c8a8c76d..0d94c63e 100644
--- a/vendor/google.golang.org/grpc/internal/internal.go
+++ b/vendor/google.golang.org/grpc/internal/internal.go
@@ -175,6 +175,12 @@ var (
// GRPCResolverSchemeExtraMetadata determines when gRPC will add extra
// metadata to RPCs.
GRPCResolverSchemeExtraMetadata string = "xds"
+
+ // EnterIdleModeForTesting gets the ClientConn to enter IDLE mode.
+ EnterIdleModeForTesting any // func(*grpc.ClientConn) error
+
+ // ExitIdleModeForTesting gets the ClientConn to exit IDLE mode.
+ ExitIdleModeForTesting any // func(*grpc.ClientConn) error
)
// HealthChecker defines the signature of the client-side LB channel health checking function.
diff --git a/vendor/google.golang.org/grpc/internal/status/status.go b/vendor/google.golang.org/grpc/internal/status/status.go
index 4cf85cad..03ef2fed 100644
--- a/vendor/google.golang.org/grpc/internal/status/status.go
+++ b/vendor/google.golang.org/grpc/internal/status/status.go
@@ -43,6 +43,34 @@ type Status struct {
s *spb.Status
}
+// NewWithProto returns a new status including details from statusProto. This
+// is meant to be used by the gRPC library only.
+func NewWithProto(code codes.Code, message string, statusProto []string) *Status {
+ if len(statusProto) != 1 {
+ // No grpc-status-details bin header, or multiple; just ignore.
+ return &Status{s: &spb.Status{Code: int32(code), Message: message}}
+ }
+ st := &spb.Status{}
+ if err := proto.Unmarshal([]byte(statusProto[0]), st); err != nil {
+ // Probably not a google.rpc.Status proto; do not provide details.
+ return &Status{s: &spb.Status{Code: int32(code), Message: message}}
+ }
+ if st.Code == int32(code) {
+ // The codes match between the grpc-status header and the
+ // grpc-status-details-bin header; use the full details proto.
+ return &Status{s: st}
+ }
+ return &Status{
+ s: &spb.Status{
+ Code: int32(codes.Internal),
+ Message: fmt.Sprintf(
+ "grpc-status-details-bin mismatch: grpc-status=%v, grpc-message=%q, grpc-status-details-bin=%+v",
+ code, message, st,
+ ),
+ },
+ }
+}
+
// New returns a Status representing c and msg.
func New(c codes.Code, msg string) *Status {
return &Status{s: &spb.Status{Code: int32(c), Message: msg}}
diff --git a/vendor/google.golang.org/grpc/internal/transport/handler_server.go b/vendor/google.golang.org/grpc/internal/transport/handler_server.go
index 98f80e3f..17f7a21b 100644
--- a/vendor/google.golang.org/grpc/internal/transport/handler_server.go
+++ b/vendor/google.golang.org/grpc/internal/transport/handler_server.go
@@ -220,18 +220,20 @@ func (ht *serverHandlerTransport) WriteStatus(s *Stream, st *status.Status) erro
h.Set("Grpc-Message", encodeGrpcMessage(m))
}
+ s.hdrMu.Lock()
if p := st.Proto(); p != nil && len(p.Details) > 0 {
+ delete(s.trailer, grpcStatusDetailsBinHeader)
stBytes, err := proto.Marshal(p)
if err != nil {
// TODO: return error instead, when callers are able to handle it.
panic(err)
}
- h.Set("Grpc-Status-Details-Bin", encodeBinHeader(stBytes))
+ h.Set(grpcStatusDetailsBinHeader, encodeBinHeader(stBytes))
}
- if md := s.Trailer(); len(md) > 0 {
- for k, vv := range md {
+ if len(s.trailer) > 0 {
+ for k, vv := range s.trailer {
// Clients don't tolerate reading restricted headers after some non restricted ones were sent.
if isReservedHeader(k) {
continue
@@ -243,6 +245,7 @@ func (ht *serverHandlerTransport) WriteStatus(s *Stream, st *status.Status) erro
}
}
}
+ s.hdrMu.Unlock()
})
if err == nil { // transport has not been closed
@@ -287,7 +290,7 @@ func (ht *serverHandlerTransport) writeCommonHeaders(s *Stream) {
}
// writeCustomHeaders sets custom headers set on the stream via SetHeader
-// on the first write call (Write, WriteHeader, or WriteStatus).
+// on the first write call (Write, WriteHeader, or WriteStatus)
func (ht *serverHandlerTransport) writeCustomHeaders(s *Stream) {
h := ht.rw.Header()
@@ -344,7 +347,7 @@ func (ht *serverHandlerTransport) WriteHeader(s *Stream, md metadata.MD) error {
return err
}
-func (ht *serverHandlerTransport) HandleStreams(startStream func(*Stream), traceCtx func(context.Context, string) context.Context) {
+func (ht *serverHandlerTransport) HandleStreams(startStream func(*Stream)) {
// With this transport type there will be exactly 1 stream: this HTTP request.
ctx := ht.req.Context()
diff --git a/vendor/google.golang.org/grpc/internal/transport/http2_client.go b/vendor/google.golang.org/grpc/internal/transport/http2_client.go
index badab8ac..d6f5c493 100644
--- a/vendor/google.golang.org/grpc/internal/transport/http2_client.go
+++ b/vendor/google.golang.org/grpc/internal/transport/http2_client.go
@@ -1399,7 +1399,6 @@ func (t *http2Client) operateHeaders(frame *http2.MetaHeadersFrame) {
mdata = make(map[string][]string)
contentTypeErr = "malformed header: missing HTTP content-type"
grpcMessage string
- statusGen *status.Status
recvCompress string
httpStatusCode *int
httpStatusErr string
@@ -1434,12 +1433,6 @@ func (t *http2Client) operateHeaders(frame *http2.MetaHeadersFrame) {
rawStatusCode = codes.Code(uint32(code))
case "grpc-message":
grpcMessage = decodeGrpcMessage(hf.Value)
- case "grpc-status-details-bin":
- var err error
- statusGen, err = decodeGRPCStatusDetails(hf.Value)
- if err != nil {
- headerError = fmt.Sprintf("transport: malformed grpc-status-details-bin: %v", err)
- }
case ":status":
if hf.Value == "200" {
httpStatusErr = ""
@@ -1548,14 +1541,12 @@ func (t *http2Client) operateHeaders(frame *http2.MetaHeadersFrame) {
return
}
- if statusGen == nil {
- statusGen = status.New(rawStatusCode, grpcMessage)
- }
+ status := istatus.NewWithProto(rawStatusCode, grpcMessage, mdata[grpcStatusDetailsBinHeader])
// If client received END_STREAM from server while stream was still active,
// send RST_STREAM.
rstStream := s.getState() == streamActive
- t.closeStream(s, io.EOF, rstStream, http2.ErrCodeNo, statusGen, mdata, true)
+ t.closeStream(s, io.EOF, rstStream, http2.ErrCodeNo, status, mdata, true)
}
// readServerPreface reads and handles the initial settings frame from the
diff --git a/vendor/google.golang.org/grpc/internal/transport/http2_server.go b/vendor/google.golang.org/grpc/internal/transport/http2_server.go
index 8d3a353c..6fa1eb41 100644
--- a/vendor/google.golang.org/grpc/internal/transport/http2_server.go
+++ b/vendor/google.golang.org/grpc/internal/transport/http2_server.go
@@ -171,15 +171,10 @@ func NewServerTransport(conn net.Conn, config *ServerConfig) (_ ServerTransport,
ID: http2.SettingMaxFrameSize,
Val: http2MaxFrameLen,
}}
- // TODO(zhaoq): Have a better way to signal "no limit" because 0 is
- // permitted in the HTTP2 spec.
- maxStreams := config.MaxStreams
- if maxStreams == 0 {
- maxStreams = math.MaxUint32
- } else {
+ if config.MaxStreams != math.MaxUint32 {
isettings = append(isettings, http2.Setting{
ID: http2.SettingMaxConcurrentStreams,
- Val: maxStreams,
+ Val: config.MaxStreams,
})
}
dynamicWindow := true
@@ -258,7 +253,7 @@ func NewServerTransport(conn net.Conn, config *ServerConfig) (_ ServerTransport,
framer: framer,
readerDone: make(chan struct{}),
writerDone: make(chan struct{}),
- maxStreams: maxStreams,
+ maxStreams: config.MaxStreams,
inTapHandle: config.InTapHandle,
fc: &trInFlow{limit: uint32(icwz)},
state: reachable,
@@ -347,7 +342,7 @@ func NewServerTransport(conn net.Conn, config *ServerConfig) (_ ServerTransport,
// operateHeaders takes action on the decoded headers. Returns an error if fatal
// error encountered and transport needs to close, otherwise returns nil.
-func (t *http2Server) operateHeaders(frame *http2.MetaHeadersFrame, handle func(*Stream), traceCtx func(context.Context, string) context.Context) error {
+func (t *http2Server) operateHeaders(frame *http2.MetaHeadersFrame, handle func(*Stream)) error {
// Acquire max stream ID lock for entire duration
t.maxStreamMu.Lock()
defer t.maxStreamMu.Unlock()
@@ -566,7 +561,7 @@ func (t *http2Server) operateHeaders(frame *http2.MetaHeadersFrame, handle func(
}
if t.inTapHandle != nil {
var err error
- if s.ctx, err = t.inTapHandle(s.ctx, &tap.Info{FullMethodName: s.method}); err != nil {
+ if s.ctx, err = t.inTapHandle(s.ctx, &tap.Info{FullMethodName: s.method, Header: mdata}); err != nil {
t.mu.Unlock()
if t.logger.V(logLevel) {
t.logger.Infof("Aborting the stream early due to InTapHandle failure: %v", err)
@@ -597,7 +592,6 @@ func (t *http2Server) operateHeaders(frame *http2.MetaHeadersFrame, handle func(
s.requestRead = func(n int) {
t.adjustWindow(s, uint32(n))
}
- s.ctx = traceCtx(s.ctx, s.method)
for _, sh := range t.stats {
s.ctx = sh.TagRPC(s.ctx, &stats.RPCTagInfo{FullMethodName: s.method})
inHeader := &stats.InHeader{
@@ -635,7 +629,7 @@ func (t *http2Server) operateHeaders(frame *http2.MetaHeadersFrame, handle func(
// HandleStreams receives incoming streams using the given handler. This is
// typically run in a separate goroutine.
// traceCtx attaches trace to ctx and returns the new context.
-func (t *http2Server) HandleStreams(handle func(*Stream), traceCtx func(context.Context, string) context.Context) {
+func (t *http2Server) HandleStreams(handle func(*Stream)) {
defer close(t.readerDone)
for {
t.controlBuf.throttle()
@@ -670,7 +664,7 @@ func (t *http2Server) HandleStreams(handle func(*Stream), traceCtx func(context.
}
switch frame := frame.(type) {
case *http2.MetaHeadersFrame:
- if err := t.operateHeaders(frame, handle, traceCtx); err != nil {
+ if err := t.operateHeaders(frame, handle); err != nil {
t.Close(err)
break
}
@@ -1058,12 +1052,15 @@ func (t *http2Server) WriteStatus(s *Stream, st *status.Status) error {
headerFields = append(headerFields, hpack.HeaderField{Name: "grpc-message", Value: encodeGrpcMessage(st.Message())})
if p := st.Proto(); p != nil && len(p.Details) > 0 {
+ // Do not use the user's grpc-status-details-bin (if present) if we are
+ // even attempting to set our own.
+ delete(s.trailer, grpcStatusDetailsBinHeader)
stBytes, err := proto.Marshal(p)
if err != nil {
// TODO: return error instead, when callers are able to handle it.
t.logger.Errorf("Failed to marshal rpc status: %s, error: %v", pretty.ToJSON(p), err)
} else {
- headerFields = append(headerFields, hpack.HeaderField{Name: "grpc-status-details-bin", Value: encodeBinHeader(stBytes)})
+ headerFields = append(headerFields, hpack.HeaderField{Name: grpcStatusDetailsBinHeader, Value: encodeBinHeader(stBytes)})
}
}
diff --git a/vendor/google.golang.org/grpc/internal/transport/http_util.go b/vendor/google.golang.org/grpc/internal/transport/http_util.go
index 19581400..dc29d590 100644
--- a/vendor/google.golang.org/grpc/internal/transport/http_util.go
+++ b/vendor/google.golang.org/grpc/internal/transport/http_util.go
@@ -34,12 +34,9 @@ import (
"time"
"unicode/utf8"
- "github.com/golang/protobuf/proto"
"golang.org/x/net/http2"
"golang.org/x/net/http2/hpack"
- spb "google.golang.org/genproto/googleapis/rpc/status"
"google.golang.org/grpc/codes"
- "google.golang.org/grpc/status"
)
const (
@@ -88,6 +85,8 @@ var (
}
)
+var grpcStatusDetailsBinHeader = "grpc-status-details-bin"
+
// isReservedHeader checks whether hdr belongs to HTTP2 headers
// reserved by gRPC protocol. Any other headers are classified as the
// user-specified metadata.
@@ -103,7 +102,6 @@ func isReservedHeader(hdr string) bool {
"grpc-message",
"grpc-status",
"grpc-timeout",
- "grpc-status-details-bin",
// Intentionally exclude grpc-previous-rpc-attempts and
// grpc-retry-pushback-ms, which are "reserved", but their API
// intentionally works via metadata.
@@ -154,18 +152,6 @@ func decodeMetadataHeader(k, v string) (string, error) {
return v, nil
}
-func decodeGRPCStatusDetails(rawDetails string) (*status.Status, error) {
- v, err := decodeBinHeader(rawDetails)
- if err != nil {
- return nil, err
- }
- st := &spb.Status{}
- if err = proto.Unmarshal(v, st); err != nil {
- return nil, err
- }
- return status.FromProto(st), nil
-}
-
type timeoutUnit uint8
const (
diff --git a/vendor/google.golang.org/grpc/internal/transport/transport.go b/vendor/google.golang.org/grpc/internal/transport/transport.go
index 74a811fc..aac056e7 100644
--- a/vendor/google.golang.org/grpc/internal/transport/transport.go
+++ b/vendor/google.golang.org/grpc/internal/transport/transport.go
@@ -698,7 +698,7 @@ type ClientTransport interface {
// Write methods for a given Stream will be called serially.
type ServerTransport interface {
// HandleStreams receives incoming streams using the given handler.
- HandleStreams(func(*Stream), func(context.Context, string) context.Context)
+ HandleStreams(func(*Stream))
// WriteHeader sends the header metadata for the given stream.
// WriteHeader may not be called on all streams.
diff --git a/vendor/google.golang.org/grpc/server.go b/vendor/google.golang.org/grpc/server.go
index 244123c6..8f60d421 100644
--- a/vendor/google.golang.org/grpc/server.go
+++ b/vendor/google.golang.org/grpc/server.go
@@ -115,12 +115,6 @@ type serviceInfo struct {
mdata any
}
-type serverWorkerData struct {
- st transport.ServerTransport
- wg *sync.WaitGroup
- stream *transport.Stream
-}
-
// Server is a gRPC server to serve RPC requests.
type Server struct {
opts serverOptions
@@ -145,7 +139,7 @@ type Server struct {
channelzID *channelz.Identifier
czData *channelzData
- serverWorkerChannel chan *serverWorkerData
+ serverWorkerChannel chan func()
}
type serverOptions struct {
@@ -179,6 +173,7 @@ type serverOptions struct {
}
var defaultServerOptions = serverOptions{
+ maxConcurrentStreams: math.MaxUint32,
maxReceiveMessageSize: defaultServerMaxReceiveMessageSize,
maxSendMessageSize: defaultServerMaxSendMessageSize,
connectionTimeout: 120 * time.Second,
@@ -404,6 +399,9 @@ func MaxSendMsgSize(m int) ServerOption {
// MaxConcurrentStreams returns a ServerOption that will apply a limit on the number
// of concurrent streams to each ServerTransport.
func MaxConcurrentStreams(n uint32) ServerOption {
+ if n == 0 {
+ n = math.MaxUint32
+ }
return newFuncServerOption(func(o *serverOptions) {
o.maxConcurrentStreams = n
})
@@ -605,24 +603,19 @@ const serverWorkerResetThreshold = 1 << 16
// [1] https://github.com/golang/go/issues/18138
func (s *Server) serverWorker() {
for completed := 0; completed < serverWorkerResetThreshold; completed++ {
- data, ok := <-s.serverWorkerChannel
+ f, ok := <-s.serverWorkerChannel
if !ok {
return
}
- s.handleSingleStream(data)
+ f()
}
go s.serverWorker()
}
-func (s *Server) handleSingleStream(data *serverWorkerData) {
- defer data.wg.Done()
- s.handleStream(data.st, data.stream, s.traceInfo(data.st, data.stream))
-}
-
// initServerWorkers creates worker goroutines and a channel to process incoming
// connections to reduce the time spent overall on runtime.morestack.
func (s *Server) initServerWorkers() {
- s.serverWorkerChannel = make(chan *serverWorkerData)
+ s.serverWorkerChannel = make(chan func())
for i := uint32(0); i < s.opts.numServerWorkers; i++ {
go s.serverWorker()
}
@@ -982,27 +975,26 @@ func (s *Server) serveStreams(st transport.ServerTransport) {
defer st.Close(errors.New("finished serving streams for the server transport"))
var wg sync.WaitGroup
+ streamQuota := newHandlerQuota(s.opts.maxConcurrentStreams)
st.HandleStreams(func(stream *transport.Stream) {
wg.Add(1)
+
+ streamQuota.acquire()
+ f := func() {
+ defer streamQuota.release()
+ defer wg.Done()
+ s.handleStream(st, stream)
+ }
+
if s.opts.numServerWorkers > 0 {
- data := &serverWorkerData{st: st, wg: &wg, stream: stream}
select {
- case s.serverWorkerChannel <- data:
+ case s.serverWorkerChannel <- f:
return
default:
// If all stream workers are busy, fallback to the default code path.
}
}
- go func() {
- defer wg.Done()
- s.handleStream(st, stream, s.traceInfo(st, stream))
- }()
- }, func(ctx context.Context, method string) context.Context {
- if !EnableTracing {
- return ctx
- }
- tr := trace.New("grpc.Recv."+methodFamily(method), method)
- return trace.NewContext(ctx, tr)
+ go f()
})
wg.Wait()
}
@@ -1051,30 +1043,6 @@ func (s *Server) ServeHTTP(w http.ResponseWriter, r *http.Request) {
s.serveStreams(st)
}
-// traceInfo returns a traceInfo and associates it with stream, if tracing is enabled.
-// If tracing is not enabled, it returns nil.
-func (s *Server) traceInfo(st transport.ServerTransport, stream *transport.Stream) (trInfo *traceInfo) {
- if !EnableTracing {
- return nil
- }
- tr, ok := trace.FromContext(stream.Context())
- if !ok {
- return nil
- }
-
- trInfo = &traceInfo{
- tr: tr,
- firstLine: firstLine{
- client: false,
- remoteAddr: st.RemoteAddr(),
- },
- }
- if dl, ok := stream.Context().Deadline(); ok {
- trInfo.firstLine.deadline = time.Until(dl)
- }
- return trInfo
-}
-
func (s *Server) addConn(addr string, st transport.ServerTransport) bool {
s.mu.Lock()
defer s.mu.Unlock()
@@ -1135,7 +1103,7 @@ func (s *Server) incrCallsFailed() {
atomic.AddInt64(&s.czData.callsFailed, 1)
}
-func (s *Server) sendResponse(t transport.ServerTransport, stream *transport.Stream, msg any, cp Compressor, opts *transport.Options, comp encoding.Compressor) error {
+func (s *Server) sendResponse(ctx context.Context, t transport.ServerTransport, stream *transport.Stream, msg any, cp Compressor, opts *transport.Options, comp encoding.Compressor) error {
data, err := encode(s.getCodec(stream.ContentSubtype()), msg)
if err != nil {
channelz.Error(logger, s.channelzID, "grpc: server failed to encode response: ", err)
@@ -1154,7 +1122,7 @@ func (s *Server) sendResponse(t transport.ServerTransport, stream *transport.Str
err = t.Write(stream, hdr, payload, opts)
if err == nil {
for _, sh := range s.opts.statsHandlers {
- sh.HandleRPC(stream.Context(), outPayload(false, msg, data, payload, time.Now()))
+ sh.HandleRPC(ctx, outPayload(false, msg, data, payload, time.Now()))
}
}
return err
@@ -1196,7 +1164,7 @@ func getChainUnaryHandler(interceptors []UnaryServerInterceptor, curr int, info
}
}
-func (s *Server) processUnaryRPC(t transport.ServerTransport, stream *transport.Stream, info *serviceInfo, md *MethodDesc, trInfo *traceInfo) (err error) {
+func (s *Server) processUnaryRPC(ctx context.Context, t transport.ServerTransport, stream *transport.Stream, info *serviceInfo, md *MethodDesc, trInfo *traceInfo) (err error) {
shs := s.opts.statsHandlers
if len(shs) != 0 || trInfo != nil || channelz.IsOn() {
if channelz.IsOn() {
@@ -1210,7 +1178,7 @@ func (s *Server) processUnaryRPC(t transport.ServerTransport, stream *transport.
IsClientStream: false,
IsServerStream: false,
}
- sh.HandleRPC(stream.Context(), statsBegin)
+ sh.HandleRPC(ctx, statsBegin)
}
if trInfo != nil {
trInfo.tr.LazyLog(&trInfo.firstLine, false)
@@ -1242,7 +1210,7 @@ func (s *Server) processUnaryRPC(t transport.ServerTransport, stream *transport.
if err != nil && err != io.EOF {
end.Error = toRPCErr(err)
}
- sh.HandleRPC(stream.Context(), end)
+ sh.HandleRPC(ctx, end)
}
if channelz.IsOn() {
@@ -1264,7 +1232,6 @@ func (s *Server) processUnaryRPC(t transport.ServerTransport, stream *transport.
}
}
if len(binlogs) != 0 {
- ctx := stream.Context()
md, _ := metadata.FromIncomingContext(ctx)
logEntry := &binarylog.ClientHeader{
Header: md,
@@ -1350,7 +1317,7 @@ func (s *Server) processUnaryRPC(t transport.ServerTransport, stream *transport.
return status.Errorf(codes.Internal, "grpc: error unmarshalling request: %v", err)
}
for _, sh := range shs {
- sh.HandleRPC(stream.Context(), &stats.InPayload{
+ sh.HandleRPC(ctx, &stats.InPayload{
RecvTime: time.Now(),
Payload: v,
Length: len(d),
@@ -1364,7 +1331,7 @@ func (s *Server) processUnaryRPC(t transport.ServerTransport, stream *transport.
Message: d,
}
for _, binlog := range binlogs {
- binlog.Log(stream.Context(), cm)
+ binlog.Log(ctx, cm)
}
}
if trInfo != nil {
@@ -1372,7 +1339,7 @@ func (s *Server) processUnaryRPC(t transport.ServerTransport, stream *transport.
}
return nil
}
- ctx := NewContextWithServerTransportStream(stream.Context(), stream)
+ ctx = NewContextWithServerTransportStream(ctx, stream)
reply, appErr := md.Handler(info.serviceImpl, ctx, df, s.opts.unaryInt)
if appErr != nil {
appStatus, ok := status.FromError(appErr)
@@ -1397,7 +1364,7 @@ func (s *Server) processUnaryRPC(t transport.ServerTransport, stream *transport.
Header: h,
}
for _, binlog := range binlogs {
- binlog.Log(stream.Context(), sh)
+ binlog.Log(ctx, sh)
}
}
st := &binarylog.ServerTrailer{
@@ -1405,7 +1372,7 @@ func (s *Server) processUnaryRPC(t transport.ServerTransport, stream *transport.
Err: appErr,
}
for _, binlog := range binlogs {
- binlog.Log(stream.Context(), st)
+ binlog.Log(ctx, st)
}
}
return appErr
@@ -1420,7 +1387,7 @@ func (s *Server) processUnaryRPC(t transport.ServerTransport, stream *transport.
if stream.SendCompress() != sendCompressorName {
comp = encoding.GetCompressor(stream.SendCompress())
}
- if err := s.sendResponse(t, stream, reply, cp, opts, comp); err != nil {
+ if err := s.sendResponse(ctx, t, stream, reply, cp, opts, comp); err != nil {
if err == io.EOF {
// The entire stream is done (for unary RPC only).
return err
@@ -1447,8 +1414,8 @@ func (s *Server) processUnaryRPC(t transport.ServerTransport, stream *transport.
Err: appErr,
}
for _, binlog := range binlogs {
- binlog.Log(stream.Context(), sh)
- binlog.Log(stream.Context(), st)
+ binlog.Log(ctx, sh)
+ binlog.Log(ctx, st)
}
}
return err
@@ -1462,8 +1429,8 @@ func (s *Server) processUnaryRPC(t transport.ServerTransport, stream *transport.
Message: reply,
}
for _, binlog := range binlogs {
- binlog.Log(stream.Context(), sh)
- binlog.Log(stream.Context(), sm)
+ binlog.Log(ctx, sh)
+ binlog.Log(ctx, sm)
}
}
if channelz.IsOn() {
@@ -1481,7 +1448,7 @@ func (s *Server) processUnaryRPC(t transport.ServerTransport, stream *transport.
Err: appErr,
}
for _, binlog := range binlogs {
- binlog.Log(stream.Context(), st)
+ binlog.Log(ctx, st)
}
}
return t.WriteStatus(stream, statusOK)
@@ -1523,7 +1490,7 @@ func getChainStreamHandler(interceptors []StreamServerInterceptor, curr int, inf
}
}
-func (s *Server) processStreamingRPC(t transport.ServerTransport, stream *transport.Stream, info *serviceInfo, sd *StreamDesc, trInfo *traceInfo) (err error) {
+func (s *Server) processStreamingRPC(ctx context.Context, t transport.ServerTransport, stream *transport.Stream, info *serviceInfo, sd *StreamDesc, trInfo *traceInfo) (err error) {
if channelz.IsOn() {
s.incrCallsStarted()
}
@@ -1537,10 +1504,10 @@ func (s *Server) processStreamingRPC(t transport.ServerTransport, stream *transp
IsServerStream: sd.ServerStreams,
}
for _, sh := range shs {
- sh.HandleRPC(stream.Context(), statsBegin)
+ sh.HandleRPC(ctx, statsBegin)
}
}
- ctx := NewContextWithServerTransportStream(stream.Context(), stream)
+ ctx = NewContextWithServerTransportStream(ctx, stream)
ss := &serverStream{
ctx: ctx,
t: t,
@@ -1576,7 +1543,7 @@ func (s *Server) processStreamingRPC(t transport.ServerTransport, stream *transp
end.Error = toRPCErr(err)
}
for _, sh := range shs {
- sh.HandleRPC(stream.Context(), end)
+ sh.HandleRPC(ctx, end)
}
}
@@ -1618,7 +1585,7 @@ func (s *Server) processStreamingRPC(t transport.ServerTransport, stream *transp
logEntry.PeerAddr = peer.Addr
}
for _, binlog := range ss.binlogs {
- binlog.Log(stream.Context(), logEntry)
+ binlog.Log(ctx, logEntry)
}
}
@@ -1696,7 +1663,7 @@ func (s *Server) processStreamingRPC(t transport.ServerTransport, stream *transp
Err: appErr,
}
for _, binlog := range ss.binlogs {
- binlog.Log(stream.Context(), st)
+ binlog.Log(ctx, st)
}
}
t.WriteStatus(ss.s, appStatus)
@@ -1714,33 +1681,50 @@ func (s *Server) processStreamingRPC(t transport.ServerTransport, stream *transp
Err: appErr,
}
for _, binlog := range ss.binlogs {
- binlog.Log(stream.Context(), st)
+ binlog.Log(ctx, st)
}
}
return t.WriteStatus(ss.s, statusOK)
}
-func (s *Server) handleStream(t transport.ServerTransport, stream *transport.Stream, trInfo *traceInfo) {
+func (s *Server) handleStream(t transport.ServerTransport, stream *transport.Stream) {
+ ctx := stream.Context()
+ var ti *traceInfo
+ if EnableTracing {
+ tr := trace.New("grpc.Recv."+methodFamily(stream.Method()), stream.Method())
+ ctx = trace.NewContext(ctx, tr)
+ ti = &traceInfo{
+ tr: tr,
+ firstLine: firstLine{
+ client: false,
+ remoteAddr: t.RemoteAddr(),
+ },
+ }
+ if dl, ok := ctx.Deadline(); ok {
+ ti.firstLine.deadline = time.Until(dl)
+ }
+ }
+
sm := stream.Method()
if sm != "" && sm[0] == '/' {
sm = sm[1:]
}
pos := strings.LastIndex(sm, "/")
if pos == -1 {
- if trInfo != nil {
- trInfo.tr.LazyLog(&fmtStringer{"Malformed method name %q", []any{sm}}, true)
- trInfo.tr.SetError()
+ if ti != nil {
+ ti.tr.LazyLog(&fmtStringer{"Malformed method name %q", []any{sm}}, true)
+ ti.tr.SetError()
}
errDesc := fmt.Sprintf("malformed method name: %q", stream.Method())
if err := t.WriteStatus(stream, status.New(codes.Unimplemented, errDesc)); err != nil {
- if trInfo != nil {
- trInfo.tr.LazyLog(&fmtStringer{"%v", []any{err}}, true)
- trInfo.tr.SetError()
+ if ti != nil {
+ ti.tr.LazyLog(&fmtStringer{"%v", []any{err}}, true)
+ ti.tr.SetError()
}
channelz.Warningf(logger, s.channelzID, "grpc: Server.handleStream failed to write status: %v", err)
}
- if trInfo != nil {
- trInfo.tr.Finish()
+ if ti != nil {
+ ti.tr.Finish()
}
return
}
@@ -1750,17 +1734,17 @@ func (s *Server) handleStream(t transport.ServerTransport, stream *transport.Str
srv, knownService := s.services[service]
if knownService {
if md, ok := srv.methods[method]; ok {
- s.processUnaryRPC(t, stream, srv, md, trInfo)
+ s.processUnaryRPC(ctx, t, stream, srv, md, ti)
return
}
if sd, ok := srv.streams[method]; ok {
- s.processStreamingRPC(t, stream, srv, sd, trInfo)
+ s.processStreamingRPC(ctx, t, stream, srv, sd, ti)
return
}
}
// Unknown service, or known server unknown method.
if unknownDesc := s.opts.unknownStreamDesc; unknownDesc != nil {
- s.processStreamingRPC(t, stream, nil, unknownDesc, trInfo)
+ s.processStreamingRPC(ctx, t, stream, nil, unknownDesc, ti)
return
}
var errDesc string
@@ -1769,19 +1753,19 @@ func (s *Server) handleStream(t transport.ServerTransport, stream *transport.Str
} else {
errDesc = fmt.Sprintf("unknown method %v for service %v", method, service)
}
- if trInfo != nil {
- trInfo.tr.LazyPrintf("%s", errDesc)
- trInfo.tr.SetError()
+ if ti != nil {
+ ti.tr.LazyPrintf("%s", errDesc)
+ ti.tr.SetError()
}
if err := t.WriteStatus(stream, status.New(codes.Unimplemented, errDesc)); err != nil {
- if trInfo != nil {
- trInfo.tr.LazyLog(&fmtStringer{"%v", []any{err}}, true)
- trInfo.tr.SetError()
+ if ti != nil {
+ ti.tr.LazyLog(&fmtStringer{"%v", []any{err}}, true)
+ ti.tr.SetError()
}
channelz.Warningf(logger, s.channelzID, "grpc: Server.handleStream failed to write status: %v", err)
}
- if trInfo != nil {
- trInfo.tr.Finish()
+ if ti != nil {
+ ti.tr.Finish()
}
}
@@ -2091,3 +2075,34 @@ func validateSendCompressor(name, clientCompressors string) error {
}
return fmt.Errorf("client does not support compressor %q", name)
}
+
+// atomicSemaphore implements a blocking, counting semaphore. acquire should be
+// called synchronously; release may be called asynchronously.
+type atomicSemaphore struct {
+ n atomic.Int64
+ wait chan struct{}
+}
+
+func (q *atomicSemaphore) acquire() {
+ if q.n.Add(-1) < 0 {
+ // We ran out of quota. Block until a release happens.
+ <-q.wait
+ }
+}
+
+func (q *atomicSemaphore) release() {
+ // N.B. the "<= 0" check below should allow for this to work with multiple
+ // concurrent calls to acquire, but also note that with synchronous calls to
+ // acquire, as our system does, n will never be less than -1. There are
+ // fairness issues (queuing) to consider if this was to be generalized.
+ if q.n.Add(1) <= 0 {
+ // An acquire was waiting on us. Unblock it.
+ q.wait <- struct{}{}
+ }
+}
+
+func newHandlerQuota(n uint32) *atomicSemaphore {
+ a := &atomicSemaphore{wait: make(chan struct{}, 1)}
+ a.n.Store(int64(n))
+ return a
+}
diff --git a/vendor/google.golang.org/grpc/stream.go b/vendor/google.golang.org/grpc/stream.go
index 421a41f8..b14b2fbe 100644
--- a/vendor/google.golang.org/grpc/stream.go
+++ b/vendor/google.golang.org/grpc/stream.go
@@ -158,11 +158,6 @@ type ClientStream interface {
// If none of the above happen, a goroutine and a context will be leaked, and grpc
// will not call the optionally-configured stats handler with a stats.End message.
func (cc *ClientConn) NewStream(ctx context.Context, desc *StreamDesc, method string, opts ...CallOption) (ClientStream, error) {
- if err := cc.idlenessMgr.OnCallBegin(); err != nil {
- return nil, err
- }
- defer cc.idlenessMgr.OnCallEnd()
-
// allow interceptor to see all applicable call options, which means those
// configured as defaults from dial option as well as per-call options
opts = combine(cc.dopts.callOptions, opts)
@@ -179,6 +174,16 @@ func NewClientStream(ctx context.Context, desc *StreamDesc, cc *ClientConn, meth
}
func newClientStream(ctx context.Context, desc *StreamDesc, cc *ClientConn, method string, opts ...CallOption) (_ ClientStream, err error) {
+ // Start tracking the RPC for idleness purposes. This is where a stream is
+ // created for both streaming and unary RPCs, and hence is a good place to
+ // track active RPC count.
+ if err := cc.idlenessMgr.OnCallBegin(); err != nil {
+ return nil, err
+ }
+ // Add a calloption, to decrement the active call count, that gets executed
+ // when the RPC completes.
+ opts = append([]CallOption{OnFinish(func(error) { cc.idlenessMgr.OnCallEnd() })}, opts...)
+
if md, added, ok := metadata.FromOutgoingContextRaw(ctx); ok {
// validate md
if err := imetadata.Validate(md); err != nil {
diff --git a/vendor/google.golang.org/grpc/tap/tap.go b/vendor/google.golang.org/grpc/tap/tap.go
index bfa5dfa4..07f01257 100644
--- a/vendor/google.golang.org/grpc/tap/tap.go
+++ b/vendor/google.golang.org/grpc/tap/tap.go
@@ -27,6 +27,8 @@ package tap
import (
"context"
+
+ "google.golang.org/grpc/metadata"
)
// Info defines the relevant information needed by the handles.
@@ -34,6 +36,10 @@ type Info struct {
// FullMethodName is the string of grpc method (in the format of
// /package.service/method).
FullMethodName string
+
+ // Header contains the header metadata received.
+ Header metadata.MD
+
// TODO: More to be added.
}
diff --git a/vendor/google.golang.org/grpc/version.go b/vendor/google.golang.org/grpc/version.go
index 914ce665..6d2cadd7 100644
--- a/vendor/google.golang.org/grpc/version.go
+++ b/vendor/google.golang.org/grpc/version.go
@@ -19,4 +19,4 @@
package grpc
// Version is the current grpc version.
-const Version = "1.58.0"
+const Version = "1.59.0"
diff --git a/vendor/google.golang.org/grpc/vet.sh b/vendor/google.golang.org/grpc/vet.sh
index bbc9e2e3..bb480f1f 100644
--- a/vendor/google.golang.org/grpc/vet.sh
+++ b/vendor/google.golang.org/grpc/vet.sh
@@ -93,6 +93,9 @@ git grep -l -e 'grpclog.I' --or -e 'grpclog.W' --or -e 'grpclog.E' --or -e 'grpc
# - Ensure all ptypes proto packages are renamed when importing.
not git grep "\(import \|^\s*\)\"github.com/golang/protobuf/ptypes/" -- "*.go"
+# - Ensure all usages of grpc_testing package are renamed when importing.
+not git grep "\(import \|^\s*\)\"google.golang.org/grpc/interop/grpc_testing" -- "*.go"
+
# - Ensure all xds proto imports are renamed to *pb or *grpc.
git grep '"github.com/envoyproxy/go-control-plane/envoy' -- '*.go' ':(exclude)*.pb.go' | not grep -v 'pb "\|grpc "'
diff --git a/vendor/modernc.org/libc/Makefile b/vendor/modernc.org/libc/Makefile
index 8664cd6d..1b87fd28 100644
--- a/vendor/modernc.org/libc/Makefile
+++ b/vendor/modernc.org/libc/Makefile
@@ -2,13 +2,14 @@
# Use of this source code is governed by a BSD-style
# license that can be found in the LICENSE file.
-.PHONY: all bench build_all_targets clean cover cpu editor internalError later mem nuke todo edit devbench \
+.PHONY: all bench build_all_targets clean cover cpu editor internalError later mem nuke todo edit work devbench \
darwin_amd64 \
darwin_arm64 \
linux_386 \
linux_amd64 \
linux_arm \
linux_arm64 \
+ strace \
grep=--include=*.go --include=*.l --include=*.y --include=*.yy --include=*.qbe --include=*.ssa
@@ -164,13 +165,15 @@ cpu: clean
edit:
@touch log
- @if [ -f "Session.vim" ]; then gvim -S & else gvim -p Makefile *.go & fi
+ @if [ -f "Session.vim" ]; then novim -S & else novim -p Makefile libc.go & fi
editor:
# go generate 2>&1 | tee log
gofmt -l -s -w *.go
go test -short 2>&1 | tee -a log
go install -v ./...
+ go build -o /dev/null generate.go
+ go build -o /dev/null strace.go
later:
@grep -n $(grep) LATER * || true
@@ -189,3 +192,15 @@ todo:
@grep -nr $(grep) BUG * | grep -v $(ngrep) || true
@grep -nr $(grep) [^[:alpha:]]println * | grep -v $(ngrep) || true
@grep -nir $(grep) 'work.*progress' || true
+
+work:
+ rm -f go.work*
+ go work init
+ go work use .
+ go work use ../ccgo/v4
+ go work use ../ccgo/v3
+ go work use ../cc/v4
+
+strace:
+ go run strace.go
+ go build -v ./...
diff --git a/vendor/modernc.org/libc/build_all_targets.sh b/vendor/modernc.org/libc/build_all_targets.sh
index 6d278e41..37db4f53 100644
--- a/vendor/modernc.org/libc/build_all_targets.sh
+++ b/vendor/modernc.org/libc/build_all_targets.sh
@@ -1,5 +1,5 @@
set -e
-for tag in none dmesg libc.membrk libc.memgrind
+for tag in none libc.dmesg libc.membrk libc.memgrind libc.strace
do
echo "-tags=$tag"
echo "GOOS=darwin GOARCH=amd64"
diff --git a/vendor/modernc.org/libc/etc.go b/vendor/modernc.org/libc/etc.go
index ca188072..c8a64bd7 100644
--- a/vendor/modernc.org/libc/etc.go
+++ b/vendor/modernc.org/libc/etc.go
@@ -9,6 +9,7 @@ import (
"io"
"os"
"path/filepath"
+ "reflect"
"runtime"
"runtime/debug"
"sort"
@@ -436,7 +437,10 @@ func VaList(p uintptr, args ...interface{}) (r uintptr) {
case uintptr:
*(*uintptr)(unsafe.Pointer(p)) = x
default:
- panic(todo("invalid VaList argument type: %T", x))
+ sz := reflect.TypeOf(v).Size()
+ copy(unsafe.Slice((*byte)(unsafe.Pointer(p)), sz), unsafe.Slice((*byte)(unsafe.Pointer((*[2]uintptr)(unsafe.Pointer(&v))[1])), sz))
+ p += roundup(sz, 8)
+ continue
}
p += 8
}
@@ -459,6 +463,18 @@ func NewVaList(args ...interface{}) (va_list uintptr) {
return VaList(NewVaListN(len(args)), args...)
}
+func VaOther(app *uintptr, sz uint64) (r uintptr) {
+ ap := *(*uintptr)(unsafe.Pointer(app))
+ if ap == 0 {
+ return 0
+ }
+
+ r = ap
+ ap = roundup(ap+uintptr(sz), 8)
+ *(*uintptr)(unsafe.Pointer(app)) = ap
+ return r
+}
+
func VaInt32(app *uintptr) int32 {
ap := *(*uintptr)(unsafe.Pointer(app))
if ap == 0 {
@@ -584,6 +600,8 @@ func GoBytes(s uintptr, len int) []byte {
return (*RawMem)(unsafe.Pointer(s))[:len:len]
}
+func Bool(v bool) bool { return v }
+
func Bool32(b bool) int32 {
if b {
return 1
diff --git a/vendor/modernc.org/libc/libc.go b/vendor/modernc.org/libc/libc.go
index 01d6793a..9d1b6e29 100644
--- a/vendor/modernc.org/libc/libc.go
+++ b/vendor/modernc.org/libc/libc.go
@@ -40,6 +40,10 @@ import (
"modernc.org/mathutil"
)
+const (
+ ENOENT = errno.ENOENT
+)
+
type (
// RawMem64 represents the biggest uint64 array the runtime can handle.
RawMem64 [unsafe.Sizeof(RawMem{}) / unsafe.Sizeof(uint64(0))]uint64
@@ -49,6 +53,8 @@ var (
allocMu sync.Mutex
environInitialized bool
isWindows bool
+ ungetcMu sync.Mutex
+ ungetc = map[uintptr]byte{}
)
// Keep these outside of the var block otherwise go generate will miss them.
@@ -76,11 +82,17 @@ func EnvironP() uintptr {
}
func X___errno_location(t *TLS) uintptr {
+ if __ccgo_strace {
+ trc("t=%v, (%v:)", t, origin(2))
+ }
return X__errno_location(t)
}
// int * __errno_location(void);
func X__errno_location(t *TLS) uintptr {
+ if __ccgo_strace {
+ trc("t=%v, (%v:)", t, origin(2))
+ }
return t.errnop
}
@@ -126,7 +138,12 @@ func Start(main func(*TLS, int32, uintptr) int32) {
exit(t, rc, audit)
}
-func Xexit(t *TLS, status int32) { exit(t, status, false) }
+func Xexit(t *TLS, status int32) {
+ if __ccgo_strace {
+ trc("t=%v status=%v, (%v:)", t, status, origin(2))
+ }
+ exit(t, status, false)
+}
func exit(t *TLS, status int32, audit bool) {
if len(Covered) != 0 {
@@ -186,16 +203,25 @@ func SetEnviron(t *TLS, env []string) {
// void setbuf(FILE *stream, char *buf);
func Xsetbuf(t *TLS, stream, buf uintptr) {
+ if __ccgo_strace {
+ trc("t=%v buf=%v, (%v:)", t, buf, origin(2))
+ }
//TODO panic(todo(""))
}
// size_t confstr(int name, char *buf, size_t len);
func Xconfstr(t *TLS, name int32, buf uintptr, len types.Size_t) types.Size_t {
+ if __ccgo_strace {
+ trc("t=%v name=%v buf=%v len=%v, (%v:)", t, name, buf, len, origin(2))
+ }
panic(todo(""))
}
// int puts(const char *s);
func Xputs(t *TLS, s uintptr) int32 {
+ if __ccgo_strace {
+ trc("t=%v s=%v, (%v:)", t, s, origin(2))
+ }
n, err := fmt.Printf("%s\n", GoString(s))
if err != nil {
return stdio.EOF
@@ -211,6 +237,9 @@ var (
// long int random(void);
func Xrandom(t *TLS) long {
+ if __ccgo_strace {
+ trc("t=%v, (%v:)", t, origin(2))
+ }
randomMu.Lock()
r := randomGen.Int63n(math.MaxInt32 + 1)
randomMu.Unlock()
@@ -228,73 +257,310 @@ func write(b []byte) (int, error) {
return len(b), nil
}
-func X__builtin_bzero(t *TLS, s uintptr, n types.Size_t) { Xbzero(t, s, n) }
-func X__builtin_abort(t *TLS) { Xabort(t) }
-func X__builtin_abs(t *TLS, j int32) int32 { return Xabs(t, j) }
-func X__builtin_clz(t *TLS, n uint32) int32 { return int32(mbits.LeadingZeros32(n)) }
-func X__builtin_clzl(t *TLS, n ulong) int32 { return int32(mbits.LeadingZeros64(uint64(n))) }
-func X__builtin_clzll(t *TLS, n uint64) int32 { return int32(mbits.LeadingZeros64(n)) }
-func X__builtin_constant_p_impl() { panic(todo("internal error: should never be called")) }
-func X__builtin_copysign(t *TLS, x, y float64) float64 { return Xcopysign(t, x, y) }
-func X__builtin_copysignf(t *TLS, x, y float32) float32 { return Xcopysignf(t, x, y) }
-func X__builtin_copysignl(t *TLS, x, y float64) float64 { return Xcopysign(t, x, y) }
-func X__builtin_exit(t *TLS, status int32) { Xexit(t, status) }
-func X__builtin_expect(t *TLS, exp, c long) long { return exp }
-func X__builtin_fabs(t *TLS, x float64) float64 { return Xfabs(t, x) }
-func X__builtin_fabsf(t *TLS, x float32) float32 { return Xfabsf(t, x) }
-func X__builtin_fabsl(t *TLS, x float64) float64 { return Xfabsl(t, x) }
-func X__builtin_free(t *TLS, ptr uintptr) { Xfree(t, ptr) }
-func X__builtin_getentropy(t *TLS, buf uintptr, n types.Size_t) int32 { return Xgetentropy(t, buf, n) }
-func X__builtin_huge_val(t *TLS) float64 { return math.Inf(1) }
-func X__builtin_huge_valf(t *TLS) float32 { return float32(math.Inf(1)) }
-func X__builtin_inf(t *TLS) float64 { return math.Inf(1) }
-func X__builtin_inff(t *TLS) float32 { return float32(math.Inf(1)) }
-func X__builtin_infl(t *TLS) float64 { return math.Inf(1) }
-func X__builtin_malloc(t *TLS, size types.Size_t) uintptr { return Xmalloc(t, size) }
-func X__builtin_memcmp(t *TLS, s1, s2 uintptr, n types.Size_t) int32 { return Xmemcmp(t, s1, s2, n) }
-func X__builtin_nan(t *TLS, s uintptr) float64 { return math.NaN() }
-func X__builtin_nanf(t *TLS, s uintptr) float32 { return float32(math.NaN()) }
-func X__builtin_nanl(t *TLS, s uintptr) float64 { return math.NaN() }
-func X__builtin_prefetch(t *TLS, addr, args uintptr) {}
-func X__builtin_printf(t *TLS, s, args uintptr) int32 { return Xprintf(t, s, args) }
-func X__builtin_strchr(t *TLS, s uintptr, c int32) uintptr { return Xstrchr(t, s, c) }
-func X__builtin_strcmp(t *TLS, s1, s2 uintptr) int32 { return Xstrcmp(t, s1, s2) }
-func X__builtin_strcpy(t *TLS, dest, src uintptr) uintptr { return Xstrcpy(t, dest, src) }
-func X__builtin_strlen(t *TLS, s uintptr) types.Size_t { return Xstrlen(t, s) }
-func X__builtin_trap(t *TLS) { Xabort(t) }
-func X__isnan(t *TLS, arg float64) int32 { return X__builtin_isnan(t, arg) }
-func X__isnanf(t *TLS, arg float32) int32 { return Xisnanf(t, arg) }
-func X__isnanl(t *TLS, arg float64) int32 { return Xisnanl(t, arg) }
-
-func Xvfprintf(t *TLS, stream, format, ap uintptr) int32 { return Xfprintf(t, stream, format, ap) }
+func X__builtin_bzero(t *TLS, s uintptr, n types.Size_t) {
+ if __ccgo_strace {
+ trc("t=%v s=%v n=%v, (%v:)", t, s, n, origin(2))
+ }
+ Xbzero(t, s, n)
+}
+
+func X__builtin_abort(t *TLS) {
+ if __ccgo_strace {
+ trc("t=%v, (%v:)", t, origin(2))
+ }
+ Xabort(t)
+}
+
+func X__builtin_abs(t *TLS, j int32) int32 {
+ if __ccgo_strace {
+ trc("t=%v j=%v, (%v:)", t, j, origin(2))
+ }
+ return Xabs(t, j)
+}
+
+func X__builtin_clz(t *TLS, n uint32) int32 {
+ if __ccgo_strace {
+ trc("t=%v n=%v, (%v:)", t, n, origin(2))
+ }
+ return int32(mbits.LeadingZeros32(n))
+}
+
+func X__builtin_clzl(t *TLS, n ulong) int32 {
+ if __ccgo_strace {
+ trc("t=%v n=%v, (%v:)", t, n, origin(2))
+ }
+ return int32(mbits.LeadingZeros64(uint64(n)))
+}
+
+func X__builtin_clzll(t *TLS, n uint64) int32 {
+ if __ccgo_strace {
+ trc("t=%v n=%v, (%v:)", t, n, origin(2))
+ }
+ return int32(mbits.LeadingZeros64(n))
+}
+func X__builtin_constant_p_impl() { panic(todo("internal error: should never be called")) }
+
+func X__builtin_copysign(t *TLS, x, y float64) float64 {
+ if __ccgo_strace {
+ trc("t=%v y=%v, (%v:)", t, y, origin(2))
+ }
+ return Xcopysign(t, x, y)
+}
+
+func X__builtin_copysignf(t *TLS, x, y float32) float32 {
+ if __ccgo_strace {
+ trc("t=%v y=%v, (%v:)", t, y, origin(2))
+ }
+ return Xcopysignf(t, x, y)
+}
+
+func X__builtin_copysignl(t *TLS, x, y float64) float64 {
+ if __ccgo_strace {
+ trc("t=%v y=%v, (%v:)", t, y, origin(2))
+ }
+ return Xcopysign(t, x, y)
+}
+
+func X__builtin_exit(t *TLS, status int32) {
+ if __ccgo_strace {
+ trc("t=%v status=%v, (%v:)", t, status, origin(2))
+ }
+ Xexit(t, status)
+}
+
+func X__builtin_expect(t *TLS, exp, c long) long {
+ if __ccgo_strace {
+ trc("t=%v c=%v, (%v:)", t, c, origin(2))
+ }
+ return exp
+}
+
+func X__builtin_fabs(t *TLS, x float64) float64 {
+ if __ccgo_strace {
+ trc("t=%v x=%v, (%v:)", t, x, origin(2))
+ }
+ return Xfabs(t, x)
+}
+
+func X__builtin_fabsf(t *TLS, x float32) float32 {
+ if __ccgo_strace {
+ trc("t=%v x=%v, (%v:)", t, x, origin(2))
+ }
+ return Xfabsf(t, x)
+}
+
+func X__builtin_fabsl(t *TLS, x float64) float64 {
+ if __ccgo_strace {
+ trc("t=%v x=%v, (%v:)", t, x, origin(2))
+ }
+ return Xfabsl(t, x)
+}
+
+func X__builtin_free(t *TLS, ptr uintptr) {
+ if __ccgo_strace {
+ trc("t=%v ptr=%v, (%v:)", t, ptr, origin(2))
+ }
+ Xfree(t, ptr)
+}
+
+func X__builtin_getentropy(t *TLS, buf uintptr, n types.Size_t) int32 {
+ if __ccgo_strace {
+ trc("t=%v buf=%v n=%v, (%v:)", t, buf, n, origin(2))
+ }
+ return Xgetentropy(t, buf, n)
+}
+
+func X__builtin_huge_val(t *TLS) float64 {
+ if __ccgo_strace {
+ trc("t=%v, (%v:)", t, origin(2))
+ }
+ return math.Inf(1)
+}
+
+func X__builtin_huge_valf(t *TLS) float32 {
+ if __ccgo_strace {
+ trc("t=%v, (%v:)", t, origin(2))
+ }
+ return float32(math.Inf(1))
+}
+
+func X__builtin_inf(t *TLS) float64 {
+ if __ccgo_strace {
+ trc("t=%v, (%v:)", t, origin(2))
+ }
+ return math.Inf(1)
+}
+
+func X__builtin_inff(t *TLS) float32 {
+ if __ccgo_strace {
+ trc("t=%v, (%v:)", t, origin(2))
+ }
+ return float32(math.Inf(1))
+}
+
+func X__builtin_infl(t *TLS) float64 {
+ if __ccgo_strace {
+ trc("t=%v, (%v:)", t, origin(2))
+ }
+ return math.Inf(1)
+}
+
+func X__builtin_malloc(t *TLS, size types.Size_t) uintptr {
+ if __ccgo_strace {
+ trc("t=%v size=%v, (%v:)", t, size, origin(2))
+ }
+ return Xmalloc(t, size)
+}
+
+func X__builtin_memcmp(t *TLS, s1, s2 uintptr, n types.Size_t) int32 {
+ if __ccgo_strace {
+ trc("t=%v s2=%v n=%v, (%v:)", t, s2, n, origin(2))
+ }
+ return Xmemcmp(t, s1, s2, n)
+}
+
+func X__builtin_nan(t *TLS, s uintptr) float64 {
+ if __ccgo_strace {
+ trc("t=%v s=%v, (%v:)", t, s, origin(2))
+ }
+ return math.NaN()
+}
+
+func X__builtin_nanf(t *TLS, s uintptr) float32 {
+ if __ccgo_strace {
+ trc("t=%v s=%v, (%v:)", t, s, origin(2))
+ }
+ return float32(math.NaN())
+}
+
+func X__builtin_nanl(t *TLS, s uintptr) float64 {
+ if __ccgo_strace {
+ trc("t=%v s=%v, (%v:)", t, s, origin(2))
+ }
+ return math.NaN()
+}
+
+func X__builtin_prefetch(t *TLS, addr, args uintptr) {
+ if __ccgo_strace {
+ trc("t=%v args=%v, (%v:)", t, args, origin(2))
+ }
+}
+
+func X__builtin_printf(t *TLS, s, args uintptr) int32 {
+ if __ccgo_strace {
+ trc("t=%v args=%v, (%v:)", t, args, origin(2))
+ }
+ return Xprintf(t, s, args)
+}
+
+func X__builtin_strchr(t *TLS, s uintptr, c int32) uintptr {
+ if __ccgo_strace {
+ trc("t=%v s=%v c=%v, (%v:)", t, s, c, origin(2))
+ }
+ return Xstrchr(t, s, c)
+}
+
+func X__builtin_strcmp(t *TLS, s1, s2 uintptr) int32 {
+ if __ccgo_strace {
+ trc("t=%v s2=%v, (%v:)", t, s2, origin(2))
+ }
+ return Xstrcmp(t, s1, s2)
+}
+
+func X__builtin_strcpy(t *TLS, dest, src uintptr) uintptr {
+ if __ccgo_strace {
+ trc("t=%v src=%v, (%v:)", t, src, origin(2))
+ }
+ return Xstrcpy(t, dest, src)
+}
+
+func X__builtin_strlen(t *TLS, s uintptr) types.Size_t {
+ if __ccgo_strace {
+ trc("t=%v s=%v, (%v:)", t, s, origin(2))
+ }
+ return Xstrlen(t, s)
+}
+
+func X__builtin_trap(t *TLS) {
+ if __ccgo_strace {
+ trc("t=%v, (%v:)", t, origin(2))
+ }
+ Xabort(t)
+}
+
+func X__isnan(t *TLS, arg float64) int32 {
+ if __ccgo_strace {
+ trc("t=%v arg=%v, (%v:)", t, arg, origin(2))
+ }
+ return X__builtin_isnan(t, arg)
+}
+
+func X__isnanf(t *TLS, arg float32) int32 {
+ if __ccgo_strace {
+ trc("t=%v arg=%v, (%v:)", t, arg, origin(2))
+ }
+ return Xisnanf(t, arg)
+}
+
+func X__isnanl(t *TLS, arg float64) int32 {
+ if __ccgo_strace {
+ trc("t=%v arg=%v, (%v:)", t, arg, origin(2))
+ }
+ return Xisnanl(t, arg)
+}
+
+func Xvfprintf(t *TLS, stream, format, ap uintptr) int32 {
+ if __ccgo_strace {
+ trc("t=%v ap=%v, (%v:)", t, ap, origin(2))
+ }
+ return Xfprintf(t, stream, format, ap)
+}
// int __builtin_popcount (unsigned int x)
func X__builtin_popcount(t *TLS, x uint32) int32 {
+ if __ccgo_strace {
+ trc("t=%v x=%v, (%v:)", t, x, origin(2))
+ }
return int32(mbits.OnesCount32(x))
}
// int __builtin_popcountl (unsigned long x)
func X__builtin_popcountl(t *TLS, x ulong) int32 {
+ if __ccgo_strace {
+ trc("t=%v x=%v, (%v:)", t, x, origin(2))
+ }
return int32(mbits.OnesCount64(uint64(x)))
}
// char * __builtin___strcpy_chk (char *dest, const char *src, size_t os);
func X__builtin___strcpy_chk(t *TLS, dest, src uintptr, os types.Size_t) uintptr {
+ if __ccgo_strace {
+ trc("t=%v src=%v os=%v, (%v:)", t, src, os, origin(2))
+ }
return Xstrcpy(t, dest, src)
}
func X__builtin_mmap(t *TLS, addr uintptr, length types.Size_t, prot, flags, fd int32, offset types.Off_t) uintptr {
+ if __ccgo_strace {
+ trc("t=%v addr=%v length=%v fd=%v offset=%v, (%v:)", t, addr, length, fd, offset, origin(2))
+ }
return Xmmap(t, addr, length, prot, flags, fd, offset)
}
// uint16_t __builtin_bswap16 (uint32_t x)
func X__builtin_bswap16(t *TLS, x uint16) uint16 {
+ if __ccgo_strace {
+ trc("t=%v x=%v, (%v:)", t, x, origin(2))
+ }
return x<<8 |
x>>8
}
// uint32_t __builtin_bswap32 (uint32_t x)
func X__builtin_bswap32(t *TLS, x uint32) uint32 {
+ if __ccgo_strace {
+ trc("t=%v x=%v, (%v:)", t, x, origin(2))
+ }
return x<<24 |
x&0xff00<<8 |
x&0xff0000>>8 |
@@ -303,6 +569,9 @@ func X__builtin_bswap32(t *TLS, x uint32) uint32 {
// uint64_t __builtin_bswap64 (uint64_t x)
func X__builtin_bswap64(t *TLS, x uint64) uint64 {
+ if __ccgo_strace {
+ trc("t=%v x=%v, (%v:)", t, x, origin(2))
+ }
return x<<56 |
x&0xff00<<40 |
x&0xff0000<<24 |
@@ -315,6 +584,9 @@ func X__builtin_bswap64(t *TLS, x uint64) uint64 {
// bool __builtin_add_overflow (type1 a, type2 b, type3 *res)
func X__builtin_add_overflowInt64(t *TLS, a, b int64, res uintptr) int32 {
+ if __ccgo_strace {
+ trc("t=%v b=%v res=%v, (%v:)", t, b, res, origin(2))
+ }
r, ovf := mathutil.AddOverflowInt64(a, b)
*(*int64)(unsafe.Pointer(res)) = r
return Bool32(ovf)
@@ -322,6 +594,9 @@ func X__builtin_add_overflowInt64(t *TLS, a, b int64, res uintptr) int32 {
// bool __builtin_add_overflow (type1 a, type2 b, type3 *res)
func X__builtin_add_overflowUint32(t *TLS, a, b uint32, res uintptr) int32 {
+ if __ccgo_strace {
+ trc("t=%v b=%v res=%v, (%v:)", t, b, res, origin(2))
+ }
r := a + b
*(*uint32)(unsafe.Pointer(res)) = r
return Bool32(r < a)
@@ -329,6 +604,9 @@ func X__builtin_add_overflowUint32(t *TLS, a, b uint32, res uintptr) int32 {
// bool __builtin_add_overflow (type1 a, type2 b, type3 *res)
func X__builtin_add_overflowUint64(t *TLS, a, b uint64, res uintptr) int32 {
+ if __ccgo_strace {
+ trc("t=%v b=%v res=%v, (%v:)", t, b, res, origin(2))
+ }
r := a + b
*(*uint64)(unsafe.Pointer(res)) = r
return Bool32(r < a)
@@ -336,6 +614,9 @@ func X__builtin_add_overflowUint64(t *TLS, a, b uint64, res uintptr) int32 {
// bool __builtin_sub_overflow (type1 a, type2 b, type3 *res)
func X__builtin_sub_overflowInt64(t *TLS, a, b int64, res uintptr) int32 {
+ if __ccgo_strace {
+ trc("t=%v b=%v res=%v, (%v:)", t, b, res, origin(2))
+ }
r, ovf := mathutil.SubOverflowInt64(a, b)
*(*int64)(unsafe.Pointer(res)) = r
return Bool32(ovf)
@@ -343,6 +624,9 @@ func X__builtin_sub_overflowInt64(t *TLS, a, b int64, res uintptr) int32 {
// bool __builtin_mul_overflow (type1 a, type2 b, type3 *res)
func X__builtin_mul_overflowInt64(t *TLS, a, b int64, res uintptr) int32 {
+ if __ccgo_strace {
+ trc("t=%v b=%v res=%v, (%v:)", t, b, res, origin(2))
+ }
r, ovf := mathutil.MulOverflowInt64(a, b)
*(*int64)(unsafe.Pointer(res)) = r
return Bool32(ovf)
@@ -350,6 +634,9 @@ func X__builtin_mul_overflowInt64(t *TLS, a, b int64, res uintptr) int32 {
// bool __builtin_mul_overflow (type1 a, type2 b, type3 *res)
func X__builtin_mul_overflowUint64(t *TLS, a, b uint64, res uintptr) int32 {
+ if __ccgo_strace {
+ trc("t=%v b=%v res=%v, (%v:)", t, b, res, origin(2))
+ }
hi, lo := mbits.Mul64(a, b)
*(*uint64)(unsafe.Pointer(res)) = lo
return Bool32(hi != 0)
@@ -357,31 +644,52 @@ func X__builtin_mul_overflowUint64(t *TLS, a, b uint64, res uintptr) int32 {
// bool __builtin_mul_overflow (type1 a, type2 b, type3 *res)
func X__builtin_mul_overflowUint128(t *TLS, a, b Uint128, res uintptr) int32 {
+ if __ccgo_strace {
+ trc("t=%v b=%v res=%v, (%v:)", t, b, res, origin(2))
+ }
r, ovf := a.mulOvf(b)
*(*Uint128)(unsafe.Pointer(res)) = r
return Bool32(ovf)
}
func X__builtin_unreachable(t *TLS) {
+ if __ccgo_strace {
+ trc("t=%v, (%v:)", t, origin(2))
+ }
fmt.Fprintf(os.Stderr, "unrechable\n")
os.Stderr.Sync()
Xexit(t, 1)
}
func X__builtin_snprintf(t *TLS, str uintptr, size types.Size_t, format, args uintptr) int32 {
+ if __ccgo_strace {
+ trc("t=%v str=%v size=%v args=%v, (%v:)", t, str, size, args, origin(2))
+ }
return Xsnprintf(t, str, size, format, args)
}
func X__builtin_sprintf(t *TLS, str, format, args uintptr) (r int32) {
+ if __ccgo_strace {
+ trc("t=%v args=%v, (%v:)", t, args, origin(2))
+ defer func() { trc("-> %v", r) }()
+ }
return Xsprintf(t, str, format, args)
}
func X__builtin_memcpy(t *TLS, dest, src uintptr, n types.Size_t) (r uintptr) {
+ if __ccgo_strace {
+ trc("t=%v src=%v n=%v, (%v:)", t, src, n, origin(2))
+ defer func() { trc("-> %v", r) }()
+ }
return Xmemcpy(t, dest, src, n)
}
// void * __builtin___memcpy_chk (void *dest, const void *src, size_t n, size_t os);
func X__builtin___memcpy_chk(t *TLS, dest, src uintptr, n, os types.Size_t) (r uintptr) {
+ if __ccgo_strace {
+ trc("t=%v src=%v os=%v, (%v:)", t, src, os, origin(2))
+ defer func() { trc("-> %v", r) }()
+ }
if os != ^types.Size_t(0) && n < os {
Xabort(t)
}
@@ -390,11 +698,17 @@ func X__builtin___memcpy_chk(t *TLS, dest, src uintptr, n, os types.Size_t) (r u
}
func X__builtin_memset(t *TLS, s uintptr, c int32, n types.Size_t) uintptr {
+ if __ccgo_strace {
+ trc("t=%v s=%v c=%v n=%v, (%v:)", t, s, c, n, origin(2))
+ }
return Xmemset(t, s, c, n)
}
// void * __builtin___memset_chk (void *s, int c, size_t n, size_t os);
func X__builtin___memset_chk(t *TLS, s uintptr, c int32, n, os types.Size_t) uintptr {
+ if __ccgo_strace {
+ trc("t=%v s=%v c=%v os=%v, (%v:)", t, s, c, os, origin(2))
+ }
if os < n {
Xabort(t)
}
@@ -404,26 +718,28 @@ func X__builtin___memset_chk(t *TLS, s uintptr, c int32, n, os types.Size_t) uin
// size_t __builtin_object_size (const void * ptr, int type)
func X__builtin_object_size(t *TLS, p uintptr, typ int32) types.Size_t {
+ if __ccgo_strace {
+ trc("t=%v p=%v typ=%v, (%v:)", t, p, typ, origin(2))
+ }
return ^types.Size_t(0) //TODO frontend magic
}
var atomicLoadStore16 sync.Mutex
-func AtomicLoadNUint16(ptr uintptr, memorder int32) uint16 {
- atomicLoadStore16.Lock()
- r := *(*uint16)(unsafe.Pointer(ptr))
- atomicLoadStore16.Unlock()
- return r
+func AtomicStoreNUint8(ptr uintptr, val uint8, memorder int32) {
+ a_store_8(ptr, val)
}
func AtomicStoreNUint16(ptr uintptr, val uint16, memorder int32) {
- atomicLoadStore16.Lock()
- *(*uint16)(unsafe.Pointer(ptr)) = val
- atomicLoadStore16.Unlock()
+ a_store_16(ptr, val)
}
// int sprintf(char *str, const char *format, ...);
func Xsprintf(t *TLS, str, format, args uintptr) (r int32) {
+ if __ccgo_strace {
+ trc("t=%v args=%v, (%v:)", t, args, origin(2))
+ defer func() { trc("-> %v", r) }()
+ }
b := printf(format, args)
r = int32(len(b))
copy((*RawMem)(unsafe.Pointer(str))[:r:r], b)
@@ -433,11 +749,18 @@ func Xsprintf(t *TLS, str, format, args uintptr) (r int32) {
// int __builtin___sprintf_chk (char *s, int flag, size_t os, const char *fmt, ...);
func X__builtin___sprintf_chk(t *TLS, s uintptr, flag int32, os types.Size_t, format, args uintptr) (r int32) {
+ if __ccgo_strace {
+ trc("t=%v s=%v flag=%v os=%v args=%v, (%v:)", t, s, flag, os, args, origin(2))
+ defer func() { trc("-> %v", r) }()
+ }
return Xsprintf(t, s, format, args)
}
// void qsort(void *base, size_t nmemb, size_t size, int (*compar)(const void *, const void *));
func Xqsort(t *TLS, base uintptr, nmemb, size types.Size_t, compar uintptr) {
+ if __ccgo_strace {
+ trc("t=%v base=%v size=%v compar=%v, (%v:)", t, base, size, compar, origin(2))
+ }
sort.Sort(&sorter{
len: int(nmemb),
base: base,
@@ -451,6 +774,9 @@ func Xqsort(t *TLS, base uintptr, nmemb, size types.Size_t, compar uintptr) {
// void __assert_fail(const char * assertion, const char * file, unsigned int line, const char * function);
func X__assert_fail(t *TLS, assertion, file uintptr, line uint32, function uintptr) {
+ if __ccgo_strace {
+ trc("t=%v file=%v line=%v function=%v, (%v:)", t, file, line, function, origin(2))
+ }
fmt.Fprintf(os.Stderr, "assertion failure: %s:%d.%s: %s\n", GoString(file), line, GoString(function), GoString(assertion))
if memgrind {
fmt.Fprintf(os.Stderr, "%s\n", debug.Stack())
@@ -460,46 +786,84 @@ func X__assert_fail(t *TLS, assertion, file uintptr, line uint32, function uintp
}
// int vprintf(const char *format, va_list ap);
-func Xvprintf(t *TLS, s, ap uintptr) int32 { return Xprintf(t, s, ap) }
+
+func Xvprintf(t *TLS, s, ap uintptr) int32 {
+ if __ccgo_strace {
+ trc("t=%v ap=%v, (%v:)", t, ap, origin(2))
+ }
+ return Xprintf(t, s, ap)
+}
// int vsprintf(char *str, const char *format, va_list ap);
func Xvsprintf(t *TLS, str, format, va uintptr) int32 {
+ if __ccgo_strace {
+ trc("t=%v va=%v, (%v:)", t, va, origin(2))
+ }
return Xsprintf(t, str, format, va)
}
// int vsnprintf(char *str, size_t size, const char *format, va_list ap);
func Xvsnprintf(t *TLS, str uintptr, size types.Size_t, format, va uintptr) int32 {
+ if __ccgo_strace {
+ trc("t=%v str=%v size=%v va=%v, (%v:)", t, str, size, va, origin(2))
+ }
return Xsnprintf(t, str, size, format, va)
}
+func X__builtin_vsnprintf(t *TLS, str uintptr, size types.Size_t, format, va uintptr) int32 {
+ if __ccgo_strace {
+ trc("t=%v str=%v size=%v va=%v, (%v:)", t, str, size, va, origin(2))
+ }
+ return Xvsnprintf(t, str, size, format, va)
+}
+
// int obstack_vprintf (struct obstack *obstack, const char *template, va_list ap)
func Xobstack_vprintf(t *TLS, obstack, template, va uintptr) int32 {
+ if __ccgo_strace {
+ trc("t=%v va=%v, (%v:)", t, va, origin(2))
+ }
panic(todo(""))
}
// extern void _obstack_newchunk(struct obstack *, int);
func X_obstack_newchunk(t *TLS, obstack uintptr, length int32) int32 {
+ if __ccgo_strace {
+ trc("t=%v obstack=%v length=%v, (%v:)", t, obstack, length, origin(2))
+ }
panic(todo(""))
}
// int _obstack_begin (struct obstack *h, _OBSTACK_SIZE_T size, _OBSTACK_SIZE_T alignment, void *(*chunkfun) (size_t), void (*freefun) (void *))
func X_obstack_begin(t *TLS, obstack uintptr, size, alignment int32, chunkfun, freefun uintptr) int32 {
+ if __ccgo_strace {
+ trc("t=%v obstack=%v alignment=%v freefun=%v, (%v:)", t, obstack, alignment, freefun, origin(2))
+ }
panic(todo(""))
}
// void obstack_free (struct obstack *h, void *obj)
func Xobstack_free(t *TLS, obstack, obj uintptr) {
+ if __ccgo_strace {
+ trc("t=%v obj=%v, (%v:)", t, obj, origin(2))
+ }
panic(todo(""))
}
// unsigned int sleep(unsigned int seconds);
func Xsleep(t *TLS, seconds uint32) uint32 {
+ if __ccgo_strace {
+ trc("t=%v seconds=%v, (%v:)", t, seconds, origin(2))
+ }
gotime.Sleep(gotime.Second * gotime.Duration(seconds))
return 0
}
// size_t strcspn(const char *s, const char *reject);
func Xstrcspn(t *TLS, s, reject uintptr) (r types.Size_t) {
+ if __ccgo_strace {
+ trc("t=%v reject=%v, (%v:)", t, reject, origin(2))
+ defer func() { trc("-> %v", r) }()
+ }
bits := newBits(256)
for {
c := *(*byte)(unsafe.Pointer(reject))
@@ -523,12 +887,19 @@ func Xstrcspn(t *TLS, s, reject uintptr) (r types.Size_t) {
// int printf(const char *format, ...);
func Xprintf(t *TLS, format, args uintptr) int32 {
+ if __ccgo_strace {
+ trc("t=%v args=%v, (%v:)", t, args, origin(2))
+ }
n, _ := write(printf(format, args))
return int32(n)
}
// int snprintf(char *str, size_t size, const char *format, ...);
func Xsnprintf(t *TLS, str uintptr, size types.Size_t, format, args uintptr) (r int32) {
+ if __ccgo_strace {
+ trc("t=%v str=%v size=%v args=%v, (%v:)", t, str, size, args, origin(2))
+ defer func() { trc("-> %v", r) }()
+ }
if format == 0 {
return 0
}
@@ -550,6 +921,10 @@ func Xsnprintf(t *TLS, str uintptr, size types.Size_t, format, args uintptr) (r
// int __builtin___snprintf_chk(char * str, size_t maxlen, int flag, size_t os, const char * format, ...);
func X__builtin___snprintf_chk(t *TLS, str uintptr, maxlen types.Size_t, flag int32, os types.Size_t, format, args uintptr) (r int32) {
+ if __ccgo_strace {
+ trc("t=%v str=%v maxlen=%v flag=%v os=%v args=%v, (%v:)", t, str, maxlen, flag, os, args, origin(2))
+ defer func() { trc("-> %v", r) }()
+ }
if os != ^types.Size_t(0) && maxlen > os {
Xabort(t)
}
@@ -559,6 +934,10 @@ func X__builtin___snprintf_chk(t *TLS, str uintptr, maxlen types.Size_t, flag in
// int __builtin___vsnprintf_chk (char *s, size_t maxlen, int flag, size_t os, const char *fmt, va_list ap);
func X__builtin___vsnprintf_chk(t *TLS, str uintptr, maxlen types.Size_t, flag int32, os types.Size_t, format, args uintptr) (r int32) {
+ if __ccgo_strace {
+ trc("t=%v str=%v maxlen=%v flag=%v os=%v args=%v, (%v:)", t, str, maxlen, flag, os, args, origin(2))
+ defer func() { trc("-> %v", r) }()
+ }
if os != ^types.Size_t(0) && maxlen > os {
Xabort(t)
}
@@ -568,6 +947,9 @@ func X__builtin___vsnprintf_chk(t *TLS, str uintptr, maxlen types.Size_t, flag i
// int abs(int j);
func Xabs(t *TLS, j int32) int32 {
+ if __ccgo_strace {
+ trc("t=%v j=%v, (%v:)", t, j, origin(2))
+ }
if j >= 0 {
return j
}
@@ -576,6 +958,9 @@ func Xabs(t *TLS, j int32) int32 {
}
func Xllabs(tls *TLS, a int64) int64 {
+ if __ccgo_strace {
+ trc("tls=%v a=%v, (%v:)", tls, a, origin(2))
+ }
if a >= int64(0) {
return a
}
@@ -583,53 +968,287 @@ func Xllabs(tls *TLS, a int64) int64 {
return -a
}
-func X__builtin_isnan(t *TLS, x float64) int32 { return Bool32(math.IsNaN(x)) }
-func X__builtin_llabs(tls *TLS, a int64) int64 { return Xllabs(tls, a) }
-func Xacos(t *TLS, x float64) float64 { return math.Acos(x) }
-func Xacosh(t *TLS, x float64) float64 { return math.Acosh(x) }
-func Xasin(t *TLS, x float64) float64 { return math.Asin(x) }
-func Xasinh(t *TLS, x float64) float64 { return math.Asinh(x) }
-func Xatan(t *TLS, x float64) float64 { return math.Atan(x) }
-func Xatan2(t *TLS, x, y float64) float64 { return math.Atan2(x, y) }
-func Xatanh(t *TLS, x float64) float64 { return math.Atanh(x) }
-func Xceil(t *TLS, x float64) float64 { return math.Ceil(x) }
-func Xceilf(t *TLS, x float32) float32 { return float32(math.Ceil(float64(x))) }
-func Xcopysign(t *TLS, x, y float64) float64 { return math.Copysign(x, y) }
-func Xcopysignf(t *TLS, x, y float32) float32 { return float32(math.Copysign(float64(x), float64(y))) }
-func Xcos(t *TLS, x float64) float64 { return math.Cos(x) }
-func Xcosf(t *TLS, x float32) float32 { return float32(math.Cos(float64(x))) }
-func Xcosh(t *TLS, x float64) float64 { return math.Cosh(x) }
-func Xexp(t *TLS, x float64) float64 { return math.Exp(x) }
-func Xfabs(t *TLS, x float64) float64 { return math.Abs(x) }
-func Xfabsf(t *TLS, x float32) float32 { return float32(math.Abs(float64(x))) }
-func Xfloor(t *TLS, x float64) float64 { return math.Floor(x) }
-func Xfmod(t *TLS, x, y float64) float64 { return math.Mod(x, y) }
-func Xhypot(t *TLS, x, y float64) float64 { return math.Hypot(x, y) }
-func Xisnan(t *TLS, x float64) int32 { return X__builtin_isnan(t, x) }
-func Xisnanf(t *TLS, x float32) int32 { return Bool32(math.IsNaN(float64(x))) }
-func Xisnanl(t *TLS, x float64) int32 { return Bool32(math.IsNaN(x)) } // ccgo has to handle long double as double as Go does not support long double.
-func Xldexp(t *TLS, x float64, exp int32) float64 { return math.Ldexp(x, int(exp)) }
-func Xlog(t *TLS, x float64) float64 { return math.Log(x) }
-func Xlog10(t *TLS, x float64) float64 { return math.Log10(x) }
-func Xlog2(t *TLS, x float64) float64 { return math.Log2(x) }
-func Xround(t *TLS, x float64) float64 { return math.Round(x) }
-func Xsin(t *TLS, x float64) float64 { return math.Sin(x) }
-func Xsinf(t *TLS, x float32) float32 { return float32(math.Sin(float64(x))) }
-func Xsinh(t *TLS, x float64) float64 { return math.Sinh(x) }
-func Xsqrt(t *TLS, x float64) float64 { return math.Sqrt(x) }
-func Xtan(t *TLS, x float64) float64 { return math.Tan(x) }
-func Xtanh(t *TLS, x float64) float64 { return math.Tanh(x) }
-func Xtrunc(t *TLS, x float64) float64 { return math.Trunc(x) }
+func X__builtin_isnan(t *TLS, x float64) int32 {
+ if __ccgo_strace {
+ trc("t=%v x=%v, (%v:)", t, x, origin(2))
+ }
+ return Bool32(math.IsNaN(x))
+}
+
+func X__builtin_llabs(tls *TLS, a int64) int64 {
+ if __ccgo_strace {
+ trc("tls=%v a=%v, (%v:)", tls, a, origin(2))
+ }
+ return Xllabs(tls, a)
+}
+
+func Xacos(t *TLS, x float64) float64 {
+ if __ccgo_strace {
+ trc("t=%v x=%v, (%v:)", t, x, origin(2))
+ }
+ return math.Acos(x)
+}
+
+func Xacosh(t *TLS, x float64) float64 {
+ if __ccgo_strace {
+ trc("t=%v x=%v, (%v:)", t, x, origin(2))
+ }
+ return math.Acosh(x)
+}
+
+func Xasin(t *TLS, x float64) float64 {
+ if __ccgo_strace {
+ trc("t=%v x=%v, (%v:)", t, x, origin(2))
+ }
+ return math.Asin(x)
+}
+
+func Xasinh(t *TLS, x float64) float64 {
+ if __ccgo_strace {
+ trc("t=%v x=%v, (%v:)", t, x, origin(2))
+ }
+ return math.Asinh(x)
+}
+
+func Xatan(t *TLS, x float64) float64 {
+ if __ccgo_strace {
+ trc("t=%v x=%v, (%v:)", t, x, origin(2))
+ }
+ return math.Atan(x)
+}
+
+func Xatan2(t *TLS, x, y float64) float64 {
+ if __ccgo_strace {
+ trc("t=%v y=%v, (%v:)", t, y, origin(2))
+ }
+ return math.Atan2(x, y)
+}
+
+func Xatanh(t *TLS, x float64) float64 {
+ if __ccgo_strace {
+ trc("t=%v x=%v, (%v:)", t, x, origin(2))
+ }
+ return math.Atanh(x)
+}
+
+func Xceil(t *TLS, x float64) float64 {
+ if __ccgo_strace {
+ trc("t=%v x=%v, (%v:)", t, x, origin(2))
+ }
+ return math.Ceil(x)
+}
+
+func Xceilf(t *TLS, x float32) float32 {
+ if __ccgo_strace {
+ trc("t=%v x=%v, (%v:)", t, x, origin(2))
+ }
+ return float32(math.Ceil(float64(x)))
+}
+
+func Xcopysign(t *TLS, x, y float64) float64 {
+ if __ccgo_strace {
+ trc("t=%v y=%v, (%v:)", t, y, origin(2))
+ }
+ return math.Copysign(x, y)
+}
+
+func Xcopysignf(t *TLS, x, y float32) float32 {
+ if __ccgo_strace {
+ trc("t=%v y=%v, (%v:)", t, y, origin(2))
+ }
+ return float32(math.Copysign(float64(x), float64(y)))
+}
+
+func Xcos(t *TLS, x float64) float64 {
+ if __ccgo_strace {
+ trc("t=%v x=%v, (%v:)", t, x, origin(2))
+ }
+ return math.Cos(x)
+}
+
+func Xcosf(t *TLS, x float32) float32 {
+ if __ccgo_strace {
+ trc("t=%v x=%v, (%v:)", t, x, origin(2))
+ }
+ return float32(math.Cos(float64(x)))
+}
+
+func Xcosh(t *TLS, x float64) float64 {
+ if __ccgo_strace {
+ trc("t=%v x=%v, (%v:)", t, x, origin(2))
+ }
+ return math.Cosh(x)
+}
+
+func Xexp(t *TLS, x float64) float64 {
+ if __ccgo_strace {
+ trc("t=%v x=%v, (%v:)", t, x, origin(2))
+ }
+ return math.Exp(x)
+}
+
+func Xfabs(t *TLS, x float64) float64 {
+ if __ccgo_strace {
+ trc("t=%v x=%v, (%v:)", t, x, origin(2))
+ }
+ return math.Abs(x)
+}
+
+func Xfabsf(t *TLS, x float32) float32 {
+ if __ccgo_strace {
+ trc("t=%v x=%v, (%v:)", t, x, origin(2))
+ }
+ return float32(math.Abs(float64(x)))
+}
+
+func Xfloor(t *TLS, x float64) float64 {
+ if __ccgo_strace {
+ trc("t=%v x=%v, (%v:)", t, x, origin(2))
+ }
+ return math.Floor(x)
+}
+
+func Xfmod(t *TLS, x, y float64) float64 {
+ if __ccgo_strace {
+ trc("t=%v y=%v, (%v:)", t, y, origin(2))
+ }
+ return math.Mod(x, y)
+}
+
+func Xhypot(t *TLS, x, y float64) float64 {
+ if __ccgo_strace {
+ trc("t=%v y=%v, (%v:)", t, y, origin(2))
+ }
+ return math.Hypot(x, y)
+}
+
+func Xisnan(t *TLS, x float64) int32 {
+ if __ccgo_strace {
+ trc("t=%v x=%v, (%v:)", t, x, origin(2))
+ }
+ return X__builtin_isnan(t, x)
+}
+
+func Xisnanf(t *TLS, x float32) int32 {
+ if __ccgo_strace {
+ trc("t=%v x=%v, (%v:)", t, x, origin(2))
+ }
+ return Bool32(math.IsNaN(float64(x)))
+}
+
+func Xisnanl(t *TLS, x float64) int32 {
+ if __ccgo_strace {
+ trc("t=%v x=%v, (%v:)", t, x, origin(2))
+ }
+ return Bool32(math.IsNaN(x))
+} // ccgo has to handle long double as double as Go does not support long double.
+
+func Xldexp(t *TLS, x float64, exp int32) float64 {
+ if __ccgo_strace {
+ trc("t=%v x=%v exp=%v, (%v:)", t, x, exp, origin(2))
+ }
+ return math.Ldexp(x, int(exp))
+}
+
+func Xlog(t *TLS, x float64) float64 {
+ if __ccgo_strace {
+ trc("t=%v x=%v, (%v:)", t, x, origin(2))
+ }
+ return math.Log(x)
+}
+
+func Xlog10(t *TLS, x float64) float64 {
+ if __ccgo_strace {
+ trc("t=%v x=%v, (%v:)", t, x, origin(2))
+ }
+ return math.Log10(x)
+}
+
+func Xlog2(t *TLS, x float64) float64 {
+ if __ccgo_strace {
+ trc("t=%v x=%v, (%v:)", t, x, origin(2))
+ }
+ return math.Log2(x)
+}
+
+func Xround(t *TLS, x float64) float64 {
+ if __ccgo_strace {
+ trc("t=%v x=%v, (%v:)", t, x, origin(2))
+ }
+ return math.Round(x)
+}
+
+func X__builtin_round(t *TLS, x float64) float64 {
+ if __ccgo_strace {
+ trc("t=%v x=%v, (%v:)", t, x, origin(2))
+ }
+ return math.Round(x)
+}
+
+func Xsin(t *TLS, x float64) float64 {
+ if __ccgo_strace {
+ trc("t=%v x=%v, (%v:)", t, x, origin(2))
+ }
+ return math.Sin(x)
+}
+
+func Xsinf(t *TLS, x float32) float32 {
+ if __ccgo_strace {
+ trc("t=%v x=%v, (%v:)", t, x, origin(2))
+ }
+ return float32(math.Sin(float64(x)))
+}
+
+func Xsinh(t *TLS, x float64) float64 {
+ if __ccgo_strace {
+ trc("t=%v x=%v, (%v:)", t, x, origin(2))
+ }
+ return math.Sinh(x)
+}
+
+func Xsqrt(t *TLS, x float64) float64 {
+ if __ccgo_strace {
+ trc("t=%v x=%v, (%v:)", t, x, origin(2))
+ }
+ return math.Sqrt(x)
+}
+
+func Xtan(t *TLS, x float64) float64 {
+ if __ccgo_strace {
+ trc("t=%v x=%v, (%v:)", t, x, origin(2))
+ }
+ return math.Tan(x)
+}
+
+func Xtanh(t *TLS, x float64) float64 {
+ if __ccgo_strace {
+ trc("t=%v x=%v, (%v:)", t, x, origin(2))
+ }
+ return math.Tanh(x)
+}
+
+func Xtrunc(t *TLS, x float64) float64 {
+ if __ccgo_strace {
+ trc("t=%v x=%v, (%v:)", t, x, origin(2))
+ }
+ return math.Trunc(x)
+}
var nextRand = uint64(1)
// int rand(void);
func Xrand(t *TLS) int32 {
+ if __ccgo_strace {
+ trc("t=%v, (%v:)", t, origin(2))
+ }
nextRand = nextRand*1103515245 + 12345
return int32(uint32(nextRand / (math.MaxUint32 + 1) % math.MaxInt32))
}
func Xpow(t *TLS, x, y float64) float64 {
+ if __ccgo_strace {
+ trc("t=%v y=%v, (%v:)", t, y, origin(2))
+ }
r := math.Pow(x, y)
if x > 0 && r == 1 && y >= -1.0000000000000000715e-18 && y < -1e-30 {
r = 0.9999999999999999
@@ -638,12 +1257,18 @@ func Xpow(t *TLS, x, y float64) float64 {
}
func Xfrexp(t *TLS, x float64, exp uintptr) float64 {
+ if __ccgo_strace {
+ trc("t=%v x=%v exp=%v, (%v:)", t, x, exp, origin(2))
+ }
f, e := math.Frexp(x)
*(*int32)(unsafe.Pointer(exp)) = int32(e)
return f
}
func Xmodf(t *TLS, x float64, iptr uintptr) float64 {
+ if __ccgo_strace {
+ trc("t=%v x=%v iptr=%v, (%v:)", t, x, iptr, origin(2))
+ }
i, f := math.Modf(x)
*(*float64)(unsafe.Pointer(iptr)) = i
return f
@@ -651,6 +1276,10 @@ func Xmodf(t *TLS, x float64, iptr uintptr) float64 {
// char *strncpy(char *dest, const char *src, size_t n)
func Xstrncpy(t *TLS, dest, src uintptr, n types.Size_t) (r uintptr) {
+ if __ccgo_strace {
+ trc("t=%v src=%v n=%v, (%v:)", t, src, n, origin(2))
+ defer func() { trc("-> %v", r) }()
+ }
r = dest
for c := *(*int8)(unsafe.Pointer(src)); c != 0 && n > 0; n-- {
*(*int8)(unsafe.Pointer(dest)) = c
@@ -667,6 +1296,10 @@ func Xstrncpy(t *TLS, dest, src uintptr, n types.Size_t) (r uintptr) {
// char * __builtin___strncpy_chk (char *dest, const char *src, size_t n, size_t os);
func X__builtin___strncpy_chk(t *TLS, dest, src uintptr, n, os types.Size_t) (r uintptr) {
+ if __ccgo_strace {
+ trc("t=%v src=%v os=%v, (%v:)", t, src, os, origin(2))
+ defer func() { trc("-> %v", r) }()
+ }
if n != ^types.Size_t(0) && os < n {
Xabort(t)
}
@@ -676,6 +1309,9 @@ func X__builtin___strncpy_chk(t *TLS, dest, src uintptr, n, os types.Size_t) (r
// int strcmp(const char *s1, const char *s2)
func Xstrcmp(t *TLS, s1, s2 uintptr) int32 {
+ if __ccgo_strace {
+ trc("t=%v s2=%v, (%v:)", t, s2, origin(2))
+ }
for {
ch1 := *(*byte)(unsafe.Pointer(s1))
s1++
@@ -689,6 +1325,10 @@ func Xstrcmp(t *TLS, s1, s2 uintptr) int32 {
// size_t strlen(const char *s)
func Xstrlen(t *TLS, s uintptr) (r types.Size_t) {
+ if __ccgo_strace {
+ trc("t=%v s=%v, (%v:)", t, s, origin(2))
+ defer func() { trc("-> %v", r) }()
+ }
if s == 0 {
return 0
}
@@ -701,6 +1341,10 @@ func Xstrlen(t *TLS, s uintptr) (r types.Size_t) {
// char *strcat(char *dest, const char *src)
func Xstrcat(t *TLS, dest, src uintptr) (r uintptr) {
+ if __ccgo_strace {
+ trc("t=%v src=%v, (%v:)", t, src, origin(2))
+ defer func() { trc("-> %v", r) }()
+ }
r = dest
for *(*int8)(unsafe.Pointer(dest)) != 0 {
dest++
@@ -718,11 +1362,18 @@ func Xstrcat(t *TLS, dest, src uintptr) (r uintptr) {
// char * __builtin___strcat_chk (char *dest, const char *src, size_t os);
func X__builtin___strcat_chk(t *TLS, dest, src uintptr, os types.Size_t) (r uintptr) {
+ if __ccgo_strace {
+ trc("t=%v src=%v os=%v, (%v:)", t, src, os, origin(2))
+ defer func() { trc("-> %v", r) }()
+ }
return Xstrcat(t, dest, src)
}
// int strncmp(const char *s1, const char *s2, size_t n)
func Xstrncmp(t *TLS, s1, s2 uintptr, n types.Size_t) int32 {
+ if __ccgo_strace {
+ trc("t=%v s2=%v n=%v, (%v:)", t, s2, n, origin(2))
+ }
var ch1, ch2 byte
for ; n != 0; n-- {
ch1 = *(*byte)(unsafe.Pointer(s1))
@@ -742,6 +1393,10 @@ func Xstrncmp(t *TLS, s1, s2 uintptr, n types.Size_t) int32 {
// char *strcpy(char *dest, const char *src)
func Xstrcpy(t *TLS, dest, src uintptr) (r uintptr) {
+ if __ccgo_strace {
+ trc("t=%v src=%v, (%v:)", t, src, origin(2))
+ defer func() { trc("-> %v", r) }()
+ }
r = dest
// src0 := src
for ; ; dest++ {
@@ -756,6 +1411,9 @@ func Xstrcpy(t *TLS, dest, src uintptr) (r uintptr) {
// char *strchr(const char *s, int c)
func Xstrchr(t *TLS, s uintptr, c int32) uintptr {
+ if __ccgo_strace {
+ trc("t=%v s=%v c=%v, (%v:)", t, s, c, origin(2))
+ }
for {
ch2 := *(*byte)(unsafe.Pointer(s))
if ch2 == byte(c) {
@@ -772,6 +1430,10 @@ func Xstrchr(t *TLS, s uintptr, c int32) uintptr {
// char *strrchr(const char *s, int c)
func Xstrrchr(t *TLS, s uintptr, c int32) (r uintptr) {
+ if __ccgo_strace {
+ trc("t=%v s=%v c=%v, (%v:)", t, s, c, origin(2))
+ defer func() { trc("-> %v", r) }()
+ }
for {
ch2 := *(*byte)(unsafe.Pointer(s))
if ch2 == 0 {
@@ -787,6 +1449,9 @@ func Xstrrchr(t *TLS, s uintptr, c int32) (r uintptr) {
// void *memset(void *s, int c, size_t n)
func Xmemset(t *TLS, s uintptr, c int32, n types.Size_t) uintptr {
+ if __ccgo_strace {
+ trc("t=%v s=%v c=%v n=%v, (%v:)", t, s, c, n, origin(2))
+ }
if n != 0 {
c := byte(c & 0xff)
@@ -820,6 +1485,10 @@ func Xmemset(t *TLS, s uintptr, c int32, n types.Size_t) uintptr {
// void *memcpy(void *dest, const void *src, size_t n);
func Xmemcpy(t *TLS, dest, src uintptr, n types.Size_t) (r uintptr) {
+ if __ccgo_strace {
+ trc("t=%v src=%v n=%v, (%v:)", t, src, n, origin(2))
+ defer func() { trc("-> %v", r) }()
+ }
if n != 0 {
copy((*RawMem)(unsafe.Pointer(dest))[:n:n], (*RawMem)(unsafe.Pointer(src))[:n:n])
}
@@ -828,6 +1497,9 @@ func Xmemcpy(t *TLS, dest, src uintptr, n types.Size_t) (r uintptr) {
// int memcmp(const void *s1, const void *s2, size_t n);
func Xmemcmp(t *TLS, s1, s2 uintptr, n types.Size_t) int32 {
+ if __ccgo_strace {
+ trc("t=%v s2=%v n=%v, (%v:)", t, s2, n, origin(2))
+ }
for ; n != 0; n-- {
c1 := *(*byte)(unsafe.Pointer(s1))
s1++
@@ -846,6 +1518,9 @@ func Xmemcmp(t *TLS, s1, s2 uintptr, n types.Size_t) int32 {
// void *memchr(const void *s, int c, size_t n);
func Xmemchr(t *TLS, s uintptr, c int32, n types.Size_t) uintptr {
+ if __ccgo_strace {
+ trc("t=%v s=%v c=%v n=%v, (%v:)", t, s, c, n, origin(2))
+ }
for ; n != 0; n-- {
if *(*byte)(unsafe.Pointer(s)) == byte(c) {
return s
@@ -858,6 +1533,9 @@ func Xmemchr(t *TLS, s uintptr, c int32, n types.Size_t) uintptr {
// void *memmove(void *dest, const void *src, size_t n);
func Xmemmove(t *TLS, dest, src uintptr, n types.Size_t) uintptr {
+ if __ccgo_strace {
+ trc("t=%v src=%v n=%v, (%v:)", t, src, n, origin(2))
+ }
if n == 0 {
return dest
}
@@ -868,6 +1546,9 @@ func Xmemmove(t *TLS, dest, src uintptr, n types.Size_t) uintptr {
// void * __builtin___memmove_chk (void *dest, const void *src, size_t n, size_t os);
func X__builtin___memmove_chk(t *TLS, dest, src uintptr, n, os types.Size_t) uintptr {
+ if __ccgo_strace {
+ trc("t=%v src=%v os=%v, (%v:)", t, src, os, origin(2))
+ }
if os != ^types.Size_t(0) && os < n {
Xabort(t)
}
@@ -877,6 +1558,9 @@ func X__builtin___memmove_chk(t *TLS, dest, src uintptr, n, os types.Size_t) uin
// char *getenv(const char *name);
func Xgetenv(t *TLS, name uintptr) uintptr {
+ if __ccgo_strace {
+ trc("t=%v name=%v, (%v:)", t, name, origin(2))
+ }
return getenv(Environ(), GoString(name))
}
@@ -901,6 +1585,9 @@ func getenv(p uintptr, nm string) uintptr {
// char *strstr(const char *haystack, const char *needle);
func Xstrstr(t *TLS, haystack, needle uintptr) uintptr {
+ if __ccgo_strace {
+ trc("t=%v needle=%v, (%v:)", t, needle, origin(2))
+ }
hs := GoString(haystack)
nd := GoString(needle)
if i := strings.Index(hs, nd); i >= 0 {
@@ -913,11 +1600,18 @@ func Xstrstr(t *TLS, haystack, needle uintptr) uintptr {
// int putc(int c, FILE *stream);
func Xputc(t *TLS, c int32, fp uintptr) int32 {
+ if __ccgo_strace {
+ trc("t=%v c=%v fp=%v, (%v:)", t, c, fp, origin(2))
+ }
return Xfputc(t, c, fp)
}
// int atoi(const char *nptr);
func Xatoi(t *TLS, nptr uintptr) int32 {
+ if __ccgo_strace {
+ trc("t=%v nptr=%v, (%v:)", t, nptr, origin(2))
+ }
+
_, neg, _, n, _ := strToUint64(t, nptr, 10)
switch {
case neg:
@@ -929,6 +1623,9 @@ func Xatoi(t *TLS, nptr uintptr) int32 {
// double atof(const char *nptr);
func Xatof(t *TLS, nptr uintptr) float64 {
+ if __ccgo_strace {
+ trc("t=%v nptr=%v, (%v:)", t, nptr, origin(2))
+ }
n, _ := strToFloatt64(t, nptr, 64)
// if dmesgs {
// dmesg("%v: %q: %v", origin(1), GoString(nptr), n)
@@ -938,6 +1635,9 @@ func Xatof(t *TLS, nptr uintptr) float64 {
// int tolower(int c);
func Xtolower(t *TLS, c int32) int32 {
+ if __ccgo_strace {
+ trc("t=%v c=%v, (%v:)", t, c, origin(2))
+ }
if c >= 'A' && c <= 'Z' {
return c + ('a' - 'A')
}
@@ -947,6 +1647,9 @@ func Xtolower(t *TLS, c int32) int32 {
// int toupper(int c);
func Xtoupper(t *TLS, c int32) int32 {
+ if __ccgo_strace {
+ trc("t=%v c=%v, (%v:)", t, c, origin(2))
+ }
if c >= 'a' && c <= 'z' {
return c - ('a' - 'A')
}
@@ -956,11 +1659,17 @@ func Xtoupper(t *TLS, c int32) int32 {
// int isatty(int fd);
func Xisatty(t *TLS, fd int32) int32 {
+ if __ccgo_strace {
+ trc("t=%v fd=%v, (%v:)", t, fd, origin(2))
+ }
return Bool32(isatty.IsTerminal(uintptr(fd)))
}
// long atol(const char *nptr);
func Xatol(t *TLS, nptr uintptr) long {
+ if __ccgo_strace {
+ trc("t=%v nptr=%v, (%v:)", t, nptr, origin(2))
+ }
_, neg, _, n, _ := strToUint64(t, nptr, 10)
switch {
case neg:
@@ -987,6 +1696,9 @@ func getLocalLocation() (loc *gotime.Location) {
// time_t mktime(struct tm *tm);
func Xmktime(t *TLS, ptm uintptr) time.Time_t {
+ if __ccgo_strace {
+ trc("t=%v ptm=%v, (%v:)", t, ptm, origin(2))
+ }
loc := getLocalLocation()
tt := gotime.Date(
int((*time.Tm)(unsafe.Pointer(ptm)).Ftm_year+1900),
@@ -1005,6 +1717,9 @@ func Xmktime(t *TLS, ptm uintptr) time.Time_t {
// char *strpbrk(const char *s, const char *accept);
func Xstrpbrk(t *TLS, s, accept uintptr) uintptr {
+ if __ccgo_strace {
+ trc("t=%v accept=%v, (%v:)", t, accept, origin(2))
+ }
bits := newBits(256)
for {
b := *(*byte)(unsafe.Pointer(accept))
@@ -1031,6 +1746,9 @@ func Xstrpbrk(t *TLS, s, accept uintptr) uintptr {
// int strcasecmp(const char *s1, const char *s2);
func Xstrcasecmp(t *TLS, s1, s2 uintptr) int32 {
+ if __ccgo_strace {
+ trc("t=%v s2=%v, (%v:)", t, s2, origin(2))
+ }
for {
ch1 := *(*byte)(unsafe.Pointer(s1))
if ch1 >= 'a' && ch1 <= 'z' {
@@ -1050,11 +1768,17 @@ func Xstrcasecmp(t *TLS, s1, s2 uintptr) int32 {
}
func Xntohs(t *TLS, netshort uint16) uint16 {
+ if __ccgo_strace {
+ trc("t=%v netshort=%v, (%v:)", t, netshort, origin(2))
+ }
return uint16((*[2]byte)(unsafe.Pointer(&netshort))[0])<<8 | uint16((*[2]byte)(unsafe.Pointer(&netshort))[1])
}
// uint16_t htons(uint16_t hostshort);
func Xhtons(t *TLS, hostshort uint16) uint16 {
+ if __ccgo_strace {
+ trc("t=%v hostshort=%v, (%v:)", t, hostshort, origin(2))
+ }
var a [2]byte
a[0] = byte(hostshort >> 8)
a[1] = byte(hostshort)
@@ -1063,6 +1787,9 @@ func Xhtons(t *TLS, hostshort uint16) uint16 {
// uint32_t htonl(uint32_t hostlong);
func Xhtonl(t *TLS, hostlong uint32) uint32 {
+ if __ccgo_strace {
+ trc("t=%v hostlong=%v, (%v:)", t, hostlong, origin(2))
+ }
var a [4]byte
a[0] = byte(hostlong >> 24)
a[1] = byte(hostlong >> 16)
@@ -1073,6 +1800,9 @@ func Xhtonl(t *TLS, hostlong uint32) uint32 {
// FILE *fopen(const char *pathname, const char *mode);
func Xfopen(t *TLS, pathname, mode uintptr) uintptr {
+ if __ccgo_strace {
+ trc("t=%v mode=%v, (%v:)", t, mode, origin(2))
+ }
return Xfopen64(t, pathname, mode) //TODO 32 bit
}
@@ -1084,6 +1814,9 @@ func Dmesg(s string, args ...interface{}) {
// void sqlite3_log(int iErrCode, const char *zFormat, ...);
func X__ccgo_sqlite3_log(t *TLS, iErrCode int32, zFormat uintptr, args uintptr) {
+ if __ccgo_strace {
+ trc("t=%v iErrCode=%v zFormat=%v args=%v, (%v:)", t, iErrCode, zFormat, args, origin(2))
+ }
// if dmesgs {
// dmesg("%v: iErrCode: %v, msg: %s\n%s", origin(1), iErrCode, printf(zFormat, args), debug.Stack())
// }
@@ -1091,11 +1824,17 @@ func X__ccgo_sqlite3_log(t *TLS, iErrCode int32, zFormat uintptr, args uintptr)
// int _IO_putc(int __c, _IO_FILE *__fp);
func X_IO_putc(t *TLS, c int32, fp uintptr) int32 {
+ if __ccgo_strace {
+ trc("t=%v c=%v fp=%v, (%v:)", t, c, fp, origin(2))
+ }
return Xputc(t, c, fp)
}
// int atexit(void (*function)(void));
func Xatexit(t *TLS, function uintptr) int32 {
+ if __ccgo_strace {
+ trc("t=%v function=%v, (%v:)", t, function, origin(2))
+ }
AtExit(func() {
(*struct{ f func(*TLS) })(unsafe.Pointer(&struct{ uintptr }{function})).f(t)
})
@@ -1104,6 +1843,9 @@ func Xatexit(t *TLS, function uintptr) int32 {
// int vasprintf(char **strp, const char *fmt, va_list ap);
func Xvasprintf(t *TLS, strp, fmt, ap uintptr) int32 {
+ if __ccgo_strace {
+ trc("t=%v ap=%v, (%v:)", t, ap, origin(2))
+ }
panic(todo(""))
}
@@ -1215,31 +1957,49 @@ func AtomicAddFloat64(addr *float64, delta float64) (new float64) {
// size_t mbstowcs(wchar_t *dest, const char *src, size_t n);
func Xmbstowcs(t *TLS, dest, src uintptr, n types.Size_t) types.Size_t {
+ if __ccgo_strace {
+ trc("t=%v src=%v n=%v, (%v:)", t, src, n, origin(2))
+ }
panic(todo(""))
}
// int mbtowc(wchar_t *pwc, const char *s, size_t n);
func Xmbtowc(t *TLS, pwc, s uintptr, n types.Size_t) int32 {
+ if __ccgo_strace {
+ trc("t=%v s=%v n=%v, (%v:)", t, s, n, origin(2))
+ }
panic(todo(""))
}
// size_t __ctype_get_mb_cur_max(void);
func X__ctype_get_mb_cur_max(t *TLS) types.Size_t {
+ if __ccgo_strace {
+ trc("t=%v, (%v:)", t, origin(2))
+ }
panic(todo(""))
}
// int wctomb(char *s, wchar_t wc);
func Xwctomb(t *TLS, s uintptr, wc wchar_t) int32 {
+ if __ccgo_strace {
+ trc("t=%v s=%v wc=%v, (%v:)", t, s, wc, origin(2))
+ }
panic(todo(""))
}
// int mblen(const char *s, size_t n);
func Xmblen(t *TLS, s uintptr, n types.Size_t) int32 {
+ if __ccgo_strace {
+ trc("t=%v s=%v n=%v, (%v:)", t, s, n, origin(2))
+ }
panic(todo(""))
}
// ssize_t readv(int fd, const struct iovec *iov, int iovcnt);
func Xreadv(t *TLS, fd int32, iov uintptr, iovcnt int32) types.Ssize_t {
+ if __ccgo_strace {
+ trc("t=%v fd=%v iov=%v iovcnt=%v, (%v:)", t, fd, iov, iovcnt, origin(2))
+ }
panic(todo(""))
}
@@ -1248,11 +2008,17 @@ func Xreadv(t *TLS, fd int32, iov uintptr, iovcnt int32) types.Ssize_t {
// const struct termios *termp,
// const struct winsize *winp);
func Xopenpty(t *TLS, amaster, aslave, name, termp, winp uintptr) int32 {
+ if __ccgo_strace {
+ trc("t=%v winp=%v, (%v:)", t, winp, origin(2))
+ }
panic(todo(""))
}
// pid_t setsid(void);
func Xsetsid(t *TLS) types.Pid_t {
+ if __ccgo_strace {
+ trc("t=%v, (%v:)", t, origin(2))
+ }
panic(todo(""))
}
@@ -1261,26 +2027,41 @@ func Xsetsid(t *TLS) types.Pid_t {
// fd_set *exceptfds, const struct timespec *timeout,
// const sigset_t *sigmask);
func Xpselect(t *TLS, nfds int32, readfds, writefds, exceptfds, timeout, sigmask uintptr) int32 {
+ if __ccgo_strace {
+ trc("t=%v nfds=%v sigmask=%v, (%v:)", t, nfds, sigmask, origin(2))
+ }
panic(todo(""))
}
// int kill(pid_t pid, int sig);
func Xkill(t *TLS, pid types.Pid_t, sig int32) int32 {
+ if __ccgo_strace {
+ trc("t=%v pid=%v sig=%v, (%v:)", t, pid, sig, origin(2))
+ }
panic(todo(""))
}
// int tcsendbreak(int fd, int duration);
func Xtcsendbreak(t *TLS, fd, duration int32) int32 {
+ if __ccgo_strace {
+ trc("t=%v duration=%v, (%v:)", t, duration, origin(2))
+ }
panic(todo(""))
}
// int wcwidth(wchar_t c);
func Xwcwidth(t *TLS, c wchar_t) int32 {
+ if __ccgo_strace {
+ trc("t=%v c=%v, (%v:)", t, c, origin(2))
+ }
panic(todo(""))
}
// int clock_gettime(clockid_t clk_id, struct timespec *tp);
func Xclock_gettime(t *TLS, clk_id int32, tp uintptr) int32 {
+ if __ccgo_strace {
+ trc("t=%v clk_id=%v tp=%v, (%v:)", t, clk_id, tp, origin(2))
+ }
panic(todo(""))
}
@@ -1294,6 +2075,9 @@ func AtExit(f func()) {
}
func X__ccgo_dmesg(t *TLS, fmt uintptr, va uintptr) {
+ if __ccgo_strace {
+ trc("t=%v fmt=%v va=%v, (%v:)", t, fmt, va, origin(2))
+ }
if dmesgs {
dmesg("%s", printf(fmt, va))
}
@@ -1305,6 +2089,9 @@ func X__ccgo_dmesg(t *TLS, fmt uintptr, va uintptr) {
// to the buffer starting at the location pointed to by buffer. The maximum
// permitted value for the length argument is 256.
func Xgetentropy(t *TLS, buffer uintptr, length size_t) int32 {
+ if __ccgo_strace {
+ trc("t=%v buffer=%v length=%v, (%v:)", t, buffer, length, origin(2))
+ }
const max = 256
switch {
case length == 0:
@@ -1327,6 +2114,9 @@ func Xgetentropy(t *TLS, buffer uintptr, length size_t) int32 {
// void * reallocarray(void *ptr, size_t nmemb, size_t size);
func Xreallocarray(t *TLS, ptr uintptr, nmemb, size size_t) uintptr {
+ if __ccgo_strace {
+ trc("t=%v ptr=%v size=%v, (%v:)", t, ptr, size, origin(2))
+ }
hi, lo := mathutil.MulUint128_64(uint64(nmemb), uint64(size))
if hi != 0 || lo > uint64(unsafe.Sizeof(RawMem{})) {
t.setErrno(errno.ENOMEM)
@@ -1338,11 +2128,17 @@ func Xreallocarray(t *TLS, ptr uintptr, nmemb, size size_t) uintptr {
// int setjmp(jmp_buf env);
func Xsetjmp(t *TLS, env uintptr) int32 {
+ if __ccgo_strace {
+ trc("t=%v env=%v, (%v:)", t, env, origin(2))
+ }
return 0 //TODO
}
// void longjmp(jmp_buf env, int val);
func Xlongjmp(t *TLS, env uintptr, val int32) {
+ if __ccgo_strace {
+ trc("t=%v env=%v val=%v, (%v:)", t, env, val, origin(2))
+ }
panic(todo(""))
}
@@ -1354,36 +2150,57 @@ func Xlongjmp(t *TLS, env uintptr, val int32) {
// int _setjmp(jmp_buf env);
func X_setjmp(t *TLS, env uintptr) int32 {
+ if __ccgo_strace {
+ trc("t=%v env=%v, (%v:)", t, env, origin(2))
+ }
return 0 //TODO
}
// void _longjmp(jmp_buf env, int val);
func X_longjmp(t *TLS, env uintptr, val int32) {
+ if __ccgo_strace {
+ trc("t=%v env=%v val=%v, (%v:)", t, env, val, origin(2))
+ }
panic(todo(""))
}
// unsigned __sync_add_and_fetch_uint32(*unsigned, unsigned)
func X__sync_add_and_fetch_uint32(t *TLS, p uintptr, v uint32) uint32 {
+ if __ccgo_strace {
+ trc("t=%v p=%v v=%v, (%v:)", t, p, v, origin(2))
+ }
return atomic.AddUint32((*uint32)(unsafe.Pointer(p)), v)
}
// unsigned __sync_sub_and_fetch_uint32(*unsigned, unsigned)
func X__sync_sub_and_fetch_uint32(t *TLS, p uintptr, v uint32) uint32 {
+ if __ccgo_strace {
+ trc("t=%v p=%v v=%v, (%v:)", t, p, v, origin(2))
+ }
return atomic.AddUint32((*uint32)(unsafe.Pointer(p)), -v)
}
// int sched_yield(void);
func Xsched_yield(t *TLS) {
+ if __ccgo_strace {
+ trc("t=%v, (%v:)", t, origin(2))
+ }
runtime.Gosched()
}
// int getc(FILE *stream);
func Xgetc(t *TLS, stream uintptr) int32 {
+ if __ccgo_strace {
+ trc("t=%v stream=%v, (%v:)", t, stream, origin(2))
+ }
return Xfgetc(t, stream)
}
// char *fgets(char *s, int size, FILE *stream);
func Xfgets(t *TLS, s uintptr, size int32, stream uintptr) uintptr {
+ if __ccgo_strace {
+ trc("t=%v s=%v size=%v stream=%v, (%v:)", t, s, size, stream, origin(2))
+ }
var b []byte
out:
for ; size > 0; size-- {
@@ -1408,6 +2225,9 @@ out:
// void bzero(void *s, size_t n);
func Xbzero(t *TLS, s uintptr, n types.Size_t) {
+ if __ccgo_strace {
+ trc("t=%v s=%v n=%v, (%v:)", t, s, n, origin(2))
+ }
b := (*RawMem)(unsafe.Pointer(s))[:n]
for i := range b {
b[i] = 0
@@ -1416,6 +2236,9 @@ func Xbzero(t *TLS, s uintptr, n types.Size_t) {
// char *rindex(const char *s, int c);
func Xrindex(t *TLS, s uintptr, c int32) uintptr {
+ if __ccgo_strace {
+ trc("t=%v s=%v c=%v, (%v:)", t, s, c, origin(2))
+ }
if s == 0 {
return 0
}
@@ -1437,9 +2260,62 @@ func Xrindex(t *TLS, s uintptr, c int32) uintptr {
// int isascii(int c);
func Xisascii(t *TLS, c int32) int32 {
+ if __ccgo_strace {
+ trc("t=%v c=%v, (%v:)", t, c, origin(2))
+ }
return Bool32(c >= 0 && c <= 0x7f)
}
func X__builtin_isunordered(t *TLS, a, b float64) int32 {
+ if __ccgo_strace {
+ trc("t=%v b=%v, (%v:)", t, b, origin(2))
+ }
return Bool32(math.IsNaN(a) || math.IsNaN(b))
}
+
+func AtomicLoadNUint16(ptr uintptr, memorder int32) uint16 {
+ atomicLoadStore16.Lock()
+ r := *(*uint16)(unsafe.Pointer(ptr))
+ atomicLoadStore16.Unlock()
+ return r
+}
+
+func PreIncAtomicInt32P(p uintptr, d int32) int32 {
+ return atomic.AddInt32((*int32)(unsafe.Pointer(p)), d)
+}
+
+func PreIncAtomicInt64P(p uintptr, d int64) int64 {
+ return atomic.AddInt64((*int64)(unsafe.Pointer(p)), d)
+}
+
+func PreIncAtomicUint32P(p uintptr, d uint32) uint32 {
+ return atomic.AddUint32((*uint32)(unsafe.Pointer(p)), d)
+}
+
+func PreIncAtomicUint64P(p uintptr, d uint64) uint64 {
+ return atomic.AddUint64((*uint64)(unsafe.Pointer(p)), d)
+}
+
+func PreInrAtomicUintptrP(p uintptr, d uintptr) uintptr {
+ return atomic.AddUintptr((*uintptr)(unsafe.Pointer(p)), d)
+}
+
+func X__builtin_ffs(tls *TLS, i int32) (r int32) {
+ if __ccgo_strace {
+ trc("tls=%v i=%v, (%v:)", tls, i, origin(2))
+ defer func() { trc("-> %v", r) }()
+ }
+ return Xffs(tls, i)
+}
+
+func Xffs(tls *TLS, i int32) (r int32) {
+ if __ccgo_strace {
+ trc("tls=%v i=%v, (%v:)", tls, i, origin(2))
+ defer func() { trc("-> %v", r) }()
+ }
+ if i == 0 {
+ return 0
+ }
+
+ return int32(mbits.TrailingZeros32(uint32(i))) + 1
+}
diff --git a/vendor/modernc.org/libc/libc32.go b/vendor/modernc.org/libc/libc32.go
index 06072848..b0943d25 100644
--- a/vendor/modernc.org/libc/libc32.go
+++ b/vendor/modernc.org/libc/libc32.go
@@ -7,6 +7,13 @@
package libc // import "modernc.org/libc"
+import (
+ "unsafe"
+
+ "modernc.org/libc/limits"
+ "modernc.org/libc/sys/types"
+)
+
const (
heapSize = 1 << 30 // Adjust for your debugging session requirements and system RAM size.
)
@@ -28,3 +35,48 @@ type bits []int
func newBits(n int) (r bits) { return make(bits, (n+31)>>5) }
func (b bits) has(n int) bool { return b != nil && b[n>>5]&(1<>5] |= 1 << uint(n&31) }
+
+func Xstrchrnul(tls *TLS, s uintptr, c int32) (r uintptr) {
+ return x___strchrnul(tls, s, c)
+}
+
+func x___strchrnul(tls *TLS, s uintptr, c int32) (r uintptr) {
+ var k types.Size_t
+ var w uintptr
+ _, _ = k, w
+ c = int32(uint8(c))
+ if !(c != 0) {
+ return s + uintptr(Xstrlen(tls, s))
+ }
+ for {
+ if !(uint32(s)%Uint32FromInt64(4) != 0) {
+ break
+ }
+ if !(*(*int8)(unsafe.Pointer(s)) != 0) || int32(*(*uint8)(unsafe.Pointer(s))) == c {
+ return s
+ }
+ goto _1
+ _1:
+ s++
+ }
+ k = uint32(-Int32FromInt32(1)) / Uint32FromInt32(limits.UCHAR_MAX) * uint32(c)
+ w = s
+ for {
+ if !(!((*(*uint32)(unsafe.Pointer(w))-uint32(-Int32FromInt32(1))/Uint32FromInt32(limits.UCHAR_MAX)) & ^*(*uint32)(unsafe.Pointer(w)) & (uint32(-Int32FromInt32(1))/Uint32FromInt32(limits.UCHAR_MAX)*uint32(Int32FromInt32(limits.UCHAR_MAX)/Int32FromInt32(2)+Int32FromInt32(1))) != 0) && !((*(*uint32)(unsafe.Pointer(w))^k-uint32(-Int32FromInt32(1))/Uint32FromInt32(limits.UCHAR_MAX)) & ^(*(*uint32)(unsafe.Pointer(w))^k) & (uint32(-Int32FromInt32(1))/Uint32FromInt32(limits.UCHAR_MAX)*uint32(Int32FromInt32(limits.UCHAR_MAX)/Int32FromInt32(2)+Int32FromInt32(1))) != 0)) {
+ break
+ }
+ goto _2
+ _2:
+ w += 4
+ }
+ s = w
+ for {
+ if !(*(*int8)(unsafe.Pointer(s)) != 0 && int32(*(*uint8)(unsafe.Pointer(s))) != c) {
+ break
+ }
+ goto _3
+ _3:
+ s++
+ }
+ return s
+}
diff --git a/vendor/modernc.org/libc/libc64.go b/vendor/modernc.org/libc/libc64.go
index 01690fe8..8e77fb40 100644
--- a/vendor/modernc.org/libc/libc64.go
+++ b/vendor/modernc.org/libc/libc64.go
@@ -7,6 +7,13 @@
package libc // import "modernc.org/libc"
+import (
+ "unsafe"
+
+ "modernc.org/libc/limits"
+ "modernc.org/libc/sys/types"
+)
+
const (
heapSize = 2 << 30 // Adjust for your debugging session requirements and system RAM size.
)
@@ -26,3 +33,48 @@ type bits []int
func newBits(n int) (r bits) { return make(bits, (n+63)>>6) }
func (b bits) has(n int) bool { return b != nil && b[n>>6]&(1<>6] |= 1 << uint(n&63) }
+
+func Xstrchrnul(tls *TLS, s uintptr, c int32) (r uintptr) {
+ if __ccgo_strace {
+ trc("tls=%v s=%v c=%v, (%v:)", tls, s, c, origin(2))
+ defer func() { trc("-> %v", r) }()
+ }
+ var k types.Size_t
+ var w uintptr
+ _, _ = k, w
+ c = int32(uint8(uint8(c)))
+ if !(c != 0) {
+ return s + uintptr(Xstrlen(tls, s))
+ }
+ for {
+ if !(uint64(uint64(s))%Uint64FromInt64(8) != 0) {
+ break
+ }
+ if !(*(*int8)(unsafe.Pointer(s)) != 0) || int32(*(*uint8)(unsafe.Pointer(s))) == c {
+ return s
+ }
+ goto _1
+ _1:
+ s++
+ }
+ k = uint64(-Int32FromInt32(1)) / Uint64FromInt32(limits.UCHAR_MAX) * uint64(uint64(c))
+ w = s
+ for {
+ if !(!((*(*uint64)(unsafe.Pointer(w))-uint64(-Int32FromInt32(1))/Uint64FromInt32(limits.UCHAR_MAX)) & ^*(*uint64)(unsafe.Pointer(w)) & (uint64(-Int32FromInt32(1))/Uint64FromInt32(limits.UCHAR_MAX)*uint64(Int32FromInt32(limits.UCHAR_MAX)/Int32FromInt32(2)+Int32FromInt32(1))) != 0) && !((*(*uint64)(unsafe.Pointer(w))^k-uint64(-Int32FromInt32(1))/Uint64FromInt32(limits.UCHAR_MAX)) & ^(*(*uint64)(unsafe.Pointer(w))^k) & (uint64(-Int32FromInt32(1))/Uint64FromInt32(limits.UCHAR_MAX)*uint64(Int32FromInt32(limits.UCHAR_MAX)/Int32FromInt32(2)+Int32FromInt32(1))) != 0)) {
+ break
+ }
+ goto _2
+ _2:
+ w += 8
+ }
+ s = w
+ for {
+ if !(*(*int8)(unsafe.Pointer(s)) != 0 && int32(*(*uint8)(unsafe.Pointer(s))) != c) {
+ break
+ }
+ goto _3
+ _3:
+ s++
+ }
+ return s
+}
diff --git a/vendor/modernc.org/libc/libc_386.go b/vendor/modernc.org/libc/libc_386.go
new file mode 100644
index 00000000..de3e3497
--- /dev/null
+++ b/vendor/modernc.org/libc/libc_386.go
@@ -0,0 +1,38 @@
+// Copyright 2023 The Libc 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 libc // import "modernc.org/libc"
+
+import (
+ "fmt"
+ "unsafe"
+)
+
+// Byte loads are atomic on this CPU.
+func a_load_8(addr uintptr) uint32 {
+ return uint32(*(*byte)(unsafe.Pointer(addr)))
+}
+
+// int16 loads are atomic on this CPU when properly aligned.
+func a_load_16(addr uintptr) uint32 {
+ if addr&1 != 0 {
+ panic(fmt.Errorf("unaligned atomic 16 bit access at %#0x", addr))
+ }
+
+ return uint32(*(*uint16)(unsafe.Pointer(addr)))
+}
+
+// Byte sores are atomic on this CPU.
+func a_store_8(addr uintptr, b byte) {
+ *(*byte)(unsafe.Pointer(addr)) = b
+}
+
+// int16 stores are atomic on this CPU when properly aligned.
+func a_store_16(addr uintptr, n uint16) {
+ if addr&1 != 0 {
+ panic(fmt.Errorf("unaligned atomic 16 bit access at %#0x", addr))
+ }
+
+ *(*uint16)(unsafe.Pointer(addr)) = n
+}
diff --git a/vendor/modernc.org/libc/libc_amd64.go b/vendor/modernc.org/libc/libc_amd64.go
new file mode 100644
index 00000000..de3e3497
--- /dev/null
+++ b/vendor/modernc.org/libc/libc_amd64.go
@@ -0,0 +1,38 @@
+// Copyright 2023 The Libc 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 libc // import "modernc.org/libc"
+
+import (
+ "fmt"
+ "unsafe"
+)
+
+// Byte loads are atomic on this CPU.
+func a_load_8(addr uintptr) uint32 {
+ return uint32(*(*byte)(unsafe.Pointer(addr)))
+}
+
+// int16 loads are atomic on this CPU when properly aligned.
+func a_load_16(addr uintptr) uint32 {
+ if addr&1 != 0 {
+ panic(fmt.Errorf("unaligned atomic 16 bit access at %#0x", addr))
+ }
+
+ return uint32(*(*uint16)(unsafe.Pointer(addr)))
+}
+
+// Byte sores are atomic on this CPU.
+func a_store_8(addr uintptr, b byte) {
+ *(*byte)(unsafe.Pointer(addr)) = b
+}
+
+// int16 stores are atomic on this CPU when properly aligned.
+func a_store_16(addr uintptr, n uint16) {
+ if addr&1 != 0 {
+ panic(fmt.Errorf("unaligned atomic 16 bit access at %#0x", addr))
+ }
+
+ *(*uint16)(unsafe.Pointer(addr)) = n
+}
diff --git a/vendor/modernc.org/libc/libc_arm.go b/vendor/modernc.org/libc/libc_arm.go
new file mode 100644
index 00000000..de3e3497
--- /dev/null
+++ b/vendor/modernc.org/libc/libc_arm.go
@@ -0,0 +1,38 @@
+// Copyright 2023 The Libc 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 libc // import "modernc.org/libc"
+
+import (
+ "fmt"
+ "unsafe"
+)
+
+// Byte loads are atomic on this CPU.
+func a_load_8(addr uintptr) uint32 {
+ return uint32(*(*byte)(unsafe.Pointer(addr)))
+}
+
+// int16 loads are atomic on this CPU when properly aligned.
+func a_load_16(addr uintptr) uint32 {
+ if addr&1 != 0 {
+ panic(fmt.Errorf("unaligned atomic 16 bit access at %#0x", addr))
+ }
+
+ return uint32(*(*uint16)(unsafe.Pointer(addr)))
+}
+
+// Byte sores are atomic on this CPU.
+func a_store_8(addr uintptr, b byte) {
+ *(*byte)(unsafe.Pointer(addr)) = b
+}
+
+// int16 stores are atomic on this CPU when properly aligned.
+func a_store_16(addr uintptr, n uint16) {
+ if addr&1 != 0 {
+ panic(fmt.Errorf("unaligned atomic 16 bit access at %#0x", addr))
+ }
+
+ *(*uint16)(unsafe.Pointer(addr)) = n
+}
diff --git a/vendor/modernc.org/libc/libc_arm64.go b/vendor/modernc.org/libc/libc_arm64.go
new file mode 100644
index 00000000..de3e3497
--- /dev/null
+++ b/vendor/modernc.org/libc/libc_arm64.go
@@ -0,0 +1,38 @@
+// Copyright 2023 The Libc 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 libc // import "modernc.org/libc"
+
+import (
+ "fmt"
+ "unsafe"
+)
+
+// Byte loads are atomic on this CPU.
+func a_load_8(addr uintptr) uint32 {
+ return uint32(*(*byte)(unsafe.Pointer(addr)))
+}
+
+// int16 loads are atomic on this CPU when properly aligned.
+func a_load_16(addr uintptr) uint32 {
+ if addr&1 != 0 {
+ panic(fmt.Errorf("unaligned atomic 16 bit access at %#0x", addr))
+ }
+
+ return uint32(*(*uint16)(unsafe.Pointer(addr)))
+}
+
+// Byte sores are atomic on this CPU.
+func a_store_8(addr uintptr, b byte) {
+ *(*byte)(unsafe.Pointer(addr)) = b
+}
+
+// int16 stores are atomic on this CPU when properly aligned.
+func a_store_16(addr uintptr, n uint16) {
+ if addr&1 != 0 {
+ panic(fmt.Errorf("unaligned atomic 16 bit access at %#0x", addr))
+ }
+
+ *(*uint16)(unsafe.Pointer(addr)) = n
+}
diff --git a/vendor/modernc.org/libc/libc_darwin.go b/vendor/modernc.org/libc/libc_darwin.go
index 334bf8fe..0dc83330 100644
--- a/vendor/modernc.org/libc/libc_darwin.go
+++ b/vendor/modernc.org/libc/libc_darwin.go
@@ -121,24 +121,50 @@ func fwrite(fd int32, b []byte) (int, error) {
return unix.Write(int(fd), b)
}
-func X__inline_isnand(t *TLS, x float64) int32 { return Xisnan(t, x) }
-func X__inline_isnanf(t *TLS, x float32) int32 { return Xisnanf(t, x) }
-func X__inline_isnanl(t *TLS, x float64) int32 { return Xisnan(t, x) }
+func X__inline_isnand(t *TLS, x float64) int32 {
+ if __ccgo_strace {
+ trc("t=%v x=%v, (%v:)", t, x, origin(2))
+ }
+ return Xisnan(t, x)
+}
+
+func X__inline_isnanf(t *TLS, x float32) int32 {
+ if __ccgo_strace {
+ trc("t=%v x=%v, (%v:)", t, x, origin(2))
+ }
+ return Xisnanf(t, x)
+}
+
+func X__inline_isnanl(t *TLS, x float64) int32 {
+ if __ccgo_strace {
+ trc("t=%v x=%v, (%v:)", t, x, origin(2))
+ }
+ return Xisnan(t, x)
+}
// int fprintf(FILE *stream, const char *format, ...);
func Xfprintf(t *TLS, stream, format, args uintptr) int32 {
+ if __ccgo_strace {
+ trc("t=%v args=%v, (%v:)", t, args, origin(2))
+ }
n, _ := fwrite(int32((*stdio.FILE)(unsafe.Pointer(stream)).F_file), printf(format, args))
return int32(n)
}
// int usleep(useconds_t usec);
func Xusleep(t *TLS, usec types.Useconds_t) int32 {
+ if __ccgo_strace {
+ trc("t=%v usec=%v, (%v:)", t, usec, origin(2))
+ }
gotime.Sleep(gotime.Microsecond * gotime.Duration(usec))
return 0
}
// int futimes(int fd, const struct timeval tv[2]);
func Xfutimes(t *TLS, fd int32, tv uintptr) int32 {
+ if __ccgo_strace {
+ trc("t=%v fd=%v tv=%v, (%v:)", t, fd, tv, origin(2))
+ }
var a []unix.Timeval
if tv != 0 {
a = make([]unix.Timeval, 2)
@@ -161,11 +187,17 @@ func Xfutimes(t *TLS, fd int32, tv uintptr) int32 {
// void srandomdev(void);
func Xsrandomdev(t *TLS) {
+ if __ccgo_strace {
+ trc("t=%v, (%v:)", t, origin(2))
+ }
panic(todo(""))
}
// int gethostuuid(uuid_t id, const struct timespec *wait);
func Xgethostuuid(t *TLS, id uintptr, wait uintptr) int32 {
+ if __ccgo_strace {
+ trc("t=%v id=%v wait=%v, (%v:)", t, id, wait, origin(2))
+ }
if _, _, err := unix.Syscall(unix.SYS_GETHOSTUUID, id, wait, 0); err != 0 { // Cannot avoid the syscall here.
if dmesgs {
dmesg("%v: %v FAIL", origin(1), err)
@@ -182,6 +214,9 @@ func Xgethostuuid(t *TLS, id uintptr, wait uintptr) int32 {
// int flock(int fd, int operation);
func Xflock(t *TLS, fd, operation int32) int32 {
+ if __ccgo_strace {
+ trc("t=%v operation=%v, (%v:)", t, operation, origin(2))
+ }
if err := unix.Flock(int(fd), int(operation)); err != nil {
if dmesgs {
dmesg("%v: %v FAIL", origin(1), err)
@@ -198,6 +233,9 @@ func Xflock(t *TLS, fd, operation int32) int32 {
// int fsctl(const char *,unsigned long,void*,unsigned int);
func Xfsctl(t *TLS, path uintptr, request ulong, data uintptr, options uint32) int32 {
+ if __ccgo_strace {
+ trc("t=%v path=%v request=%v data=%v options=%v, (%v:)", t, path, request, data, options, origin(2))
+ }
panic(todo(""))
// if _, _, err := unix.Syscall6(unix.SYS_FSCTL, path, uintptr(request), data, uintptr(options), 0, 0); err != 0 {
// t.setErrno(err)
@@ -209,16 +247,25 @@ func Xfsctl(t *TLS, path uintptr, request ulong, data uintptr, options uint32) i
// int * __error(void);
func X__error(t *TLS) uintptr {
+ if __ccgo_strace {
+ trc("t=%v, (%v:)", t, origin(2))
+ }
return t.errnop
}
// int isspace(int c);
func Xisspace(t *TLS, c int32) int32 {
+ if __ccgo_strace {
+ trc("t=%v c=%v, (%v:)", t, c, origin(2))
+ }
return __isspace(t, c)
}
// void __assert_rtn(const char *, const char *, int, const char *)
func X__assert_rtn(t *TLS, function, file uintptr, line int32, assertion uintptr) {
+ if __ccgo_strace {
+ trc("t=%v file=%v line=%v assertion=%v, (%v:)", t, file, line, assertion, origin(2))
+ }
panic(todo(""))
// fmt.Fprintf(os.Stderr, "assertion failure: %s:%d.%s: %s\n", GoString(file), line, GoString(function), GoString(assertion))
// os.Stderr.Sync()
@@ -227,6 +274,9 @@ func X__assert_rtn(t *TLS, function, file uintptr, line int32, assertion uintptr
// int getrusage(int who, struct rusage *usage);
func Xgetrusage(t *TLS, who int32, usage uintptr) int32 {
+ if __ccgo_strace {
+ trc("t=%v who=%v usage=%v, (%v:)", t, who, usage, origin(2))
+ }
panic(todo(""))
// if _, _, err := unix.Syscall(unix.SYS_GETRUSAGE, uintptr(who), usage, 0); err != 0 {
// t.setErrno(err)
@@ -238,6 +288,9 @@ func Xgetrusage(t *TLS, who int32, usage uintptr) int32 {
// int fgetc(FILE *stream);
func Xfgetc(t *TLS, stream uintptr) int32 {
+ if __ccgo_strace {
+ trc("t=%v stream=%v, (%v:)", t, stream, origin(2))
+ }
fd := int((*stdio.FILE)(unsafe.Pointer(stream)).F_file)
var buf [1]byte
if n, _ := unix.Read(fd, buf[:]); n != 0 {
@@ -249,16 +302,25 @@ func Xfgetc(t *TLS, stream uintptr) int32 {
// int lstat(const char *pathname, struct stat *statbuf);
func Xlstat(t *TLS, pathname, statbuf uintptr) int32 {
+ if __ccgo_strace {
+ trc("t=%v statbuf=%v, (%v:)", t, statbuf, origin(2))
+ }
return Xlstat64(t, pathname, statbuf)
}
// int stat(const char *pathname, struct stat *statbuf);
func Xstat(t *TLS, pathname, statbuf uintptr) int32 {
+ if __ccgo_strace {
+ trc("t=%v statbuf=%v, (%v:)", t, statbuf, origin(2))
+ }
return Xstat64(t, pathname, statbuf)
}
// int chdir(const char *path);
func Xchdir(t *TLS, path uintptr) int32 {
+ if __ccgo_strace {
+ trc("t=%v path=%v, (%v:)", t, path, origin(2))
+ }
if err := unix.Chdir(GoString(path)); err != nil {
if dmesgs {
dmesg("%v: %q: %v FAIL", origin(1), GoString(path), err)
@@ -311,6 +373,9 @@ func Xlocaltime_r(_ *TLS, timep, result uintptr) uintptr {
// int open(const char *pathname, int flags, ...);
func Xopen(t *TLS, pathname uintptr, flags int32, args uintptr) int32 {
+ if __ccgo_strace {
+ trc("t=%v pathname=%v flags=%v args=%v, (%v:)", t, pathname, flags, args, origin(2))
+ }
var mode types.Mode_t
if args != 0 {
mode = (types.Mode_t)(VaUint32(&args))
@@ -332,6 +397,9 @@ func Xopen(t *TLS, pathname uintptr, flags int32, args uintptr) int32 {
// off_t lseek(int fd, off_t offset, int whence);
func Xlseek(t *TLS, fd int32, offset types.Off_t, whence int32) types.Off_t {
+ if __ccgo_strace {
+ trc("t=%v fd=%v offset=%v whence=%v, (%v:)", t, fd, offset, whence, origin(2))
+ }
return types.Off_t(Xlseek64(t, fd, offset, whence))
}
@@ -352,6 +420,9 @@ var fsyncStatbuf stat.Stat
// int fsync(int fd);
func Xfsync(t *TLS, fd int32) int32 {
+ if __ccgo_strace {
+ trc("t=%v fd=%v, (%v:)", t, fd, origin(2))
+ }
if noFsync {
// Simulate -DSQLITE_NO_SYNC for sqlite3 testfixture, see function full_sync in sqlite3.c
return Xfstat(t, fd, uintptr(unsafe.Pointer(&fsyncStatbuf)))
@@ -373,6 +444,9 @@ func Xfsync(t *TLS, fd int32) int32 {
// long sysconf(int name);
func Xsysconf(t *TLS, name int32) long {
+ if __ccgo_strace {
+ trc("t=%v name=%v, (%v:)", t, name, origin(2))
+ }
switch name {
case unistd.X_SC_PAGESIZE:
return long(unix.Getpagesize())
@@ -385,6 +459,9 @@ func Xsysconf(t *TLS, name int32) long {
// int close(int fd);
func Xclose(t *TLS, fd int32) int32 {
+ if __ccgo_strace {
+ trc("t=%v fd=%v, (%v:)", t, fd, origin(2))
+ }
if err := unix.Close(int(fd)); err != nil {
if dmesgs {
dmesg("%v: %v FAIL", origin(1), err)
@@ -401,6 +478,9 @@ func Xclose(t *TLS, fd int32) int32 {
// char *getcwd(char *buf, size_t size);
func Xgetcwd(t *TLS, buf uintptr, size types.Size_t) uintptr {
+ if __ccgo_strace {
+ trc("t=%v buf=%v size=%v, (%v:)", t, buf, size, origin(2))
+ }
if _, err := unix.Getcwd((*RawMem)(unsafe.Pointer(buf))[:size:size]); err != nil {
if dmesgs {
dmesg("%v: %v FAIL", origin(1), err)
@@ -417,11 +497,17 @@ func Xgetcwd(t *TLS, buf uintptr, size types.Size_t) uintptr {
// int fstat(int fd, struct stat *statbuf);
func Xfstat(t *TLS, fd int32, statbuf uintptr) int32 {
+ if __ccgo_strace {
+ trc("t=%v fd=%v statbuf=%v, (%v:)", t, fd, statbuf, origin(2))
+ }
return Xfstat64(t, fd, statbuf)
}
// int ftruncate(int fd, off_t length);
func Xftruncate(t *TLS, fd int32, length types.Off_t) int32 {
+ if __ccgo_strace {
+ trc("t=%v fd=%v length=%v, (%v:)", t, fd, length, origin(2))
+ }
if err := unix.Ftruncate(int(fd), int64(length)); err != nil {
if dmesgs {
dmesg("%v: fd %d: %v FAIL", origin(1), fd, err)
@@ -438,11 +524,17 @@ func Xftruncate(t *TLS, fd int32, length types.Off_t) int32 {
// int fcntl(int fd, int cmd, ... /* arg */ );
func Xfcntl(t *TLS, fd, cmd int32, args uintptr) int32 {
+ if __ccgo_strace {
+ trc("t=%v cmd=%v args=%v, (%v:)", t, cmd, args, origin(2))
+ }
return Xfcntl64(t, fd, cmd, args)
}
// ssize_t read(int fd, void *buf, size_t count);
func Xread(t *TLS, fd int32, buf uintptr, count types.Size_t) types.Ssize_t {
+ if __ccgo_strace {
+ trc("t=%v fd=%v buf=%v count=%v, (%v:)", t, fd, buf, count, origin(2))
+ }
var n int
var err error
switch {
@@ -470,6 +562,9 @@ func Xread(t *TLS, fd int32, buf uintptr, count types.Size_t) types.Ssize_t {
// ssize_t write(int fd, const void *buf, size_t count);
func Xwrite(t *TLS, fd int32, buf uintptr, count types.Size_t) types.Ssize_t {
+ if __ccgo_strace {
+ trc("t=%v fd=%v buf=%v count=%v, (%v:)", t, fd, buf, count, origin(2))
+ }
var n int
var err error
switch {
@@ -497,6 +592,9 @@ func Xwrite(t *TLS, fd int32, buf uintptr, count types.Size_t) types.Ssize_t {
// int fchmod(int fd, mode_t mode);
func Xfchmod(t *TLS, fd int32, mode types.Mode_t) int32 {
+ if __ccgo_strace {
+ trc("t=%v fd=%v mode=%v, (%v:)", t, fd, mode, origin(2))
+ }
if err := unix.Fchmod(int(fd), uint32(mode)); err != nil {
if dmesgs {
dmesg("%v: %d %#o: %v FAIL", origin(1), fd, mode, err)
@@ -513,6 +611,9 @@ func Xfchmod(t *TLS, fd int32, mode types.Mode_t) int32 {
// int fchown(int fd, uid_t owner, gid_t group);
func Xfchown(t *TLS, fd int32, owner types.Uid_t, group types.Gid_t) int32 {
+ if __ccgo_strace {
+ trc("t=%v fd=%v owner=%v group=%v, (%v:)", t, fd, owner, group, origin(2))
+ }
if _, _, err := unix.Syscall(unix.SYS_FCHOWN, uintptr(fd), uintptr(owner), uintptr(group)); err != 0 {
t.setErrno(err)
return -1
@@ -523,6 +624,9 @@ func Xfchown(t *TLS, fd int32, owner types.Uid_t, group types.Gid_t) int32 {
// uid_t geteuid(void);
func Xgeteuid(t *TLS) types.Uid_t {
+ if __ccgo_strace {
+ trc("t=%v, (%v:)", t, origin(2))
+ }
r := types.Uid_t(unix.Geteuid())
if dmesgs {
dmesg("%v: %v", origin(1), r)
@@ -532,6 +636,9 @@ func Xgeteuid(t *TLS) types.Uid_t {
// void *mmap(void *addr, size_t length, int prot, int flags, int fd, off_t offset);
func Xmmap(t *TLS, addr uintptr, length types.Size_t, prot, flags, fd int32, offset types.Off_t) uintptr {
+ if __ccgo_strace {
+ trc("t=%v addr=%v length=%v fd=%v offset=%v, (%v:)", t, addr, length, fd, offset, origin(2))
+ }
// Cannot avoid the syscall here, addr sometimes matter.
data, _, err := unix.Syscall6(unix.SYS_MMAP, addr, uintptr(length), uintptr(prot), uintptr(flags), uintptr(fd), uintptr(offset))
if err != 0 {
@@ -550,6 +657,9 @@ func Xmmap(t *TLS, addr uintptr, length types.Size_t, prot, flags, fd int32, off
// int munmap(void *addr, size_t length);
func Xmunmap(t *TLS, addr uintptr, length types.Size_t) int32 {
+ if __ccgo_strace {
+ trc("t=%v addr=%v length=%v, (%v:)", t, addr, length, origin(2))
+ }
if _, _, err := unix.Syscall(unix.SYS_MUNMAP, addr, uintptr(length), 0); err != 0 { // Cannot avoid the syscall here, must pair with mmap.
if dmesgs {
dmesg("%v: %v FAIL", origin(1), err)
@@ -563,6 +673,9 @@ func Xmunmap(t *TLS, addr uintptr, length types.Size_t) int32 {
// int gettimeofday(struct timeval *tv, struct timezone *tz);
func Xgettimeofday(t *TLS, tv, tz uintptr) int32 {
+ if __ccgo_strace {
+ trc("t=%v tz=%v, (%v:)", t, tz, origin(2))
+ }
if tz != 0 {
panic(todo(""))
}
@@ -583,6 +696,9 @@ func Xgettimeofday(t *TLS, tv, tz uintptr) int32 {
// int getsockopt(int sockfd, int level, int optname, void *optval, socklen_t *optlen);
func Xgetsockopt(t *TLS, sockfd, level, optname int32, optval, optlen uintptr) int32 {
+ if __ccgo_strace {
+ trc("t=%v optname=%v optlen=%v, (%v:)", t, optname, optlen, origin(2))
+ }
if _, _, err := unix.Syscall6(unix.SYS_GETSOCKOPT, uintptr(sockfd), uintptr(level), uintptr(optname), optval, optlen, 0); err != 0 {
t.setErrno(err)
return -1
@@ -593,6 +709,9 @@ func Xgetsockopt(t *TLS, sockfd, level, optname int32, optval, optlen uintptr) i
// int setsockopt(int sockfd, int level, int optname, const void *optval, socklen_t optlen);
func Xsetsockopt(t *TLS, sockfd, level, optname int32, optval uintptr, optlen socket.Socklen_t) int32 {
+ if __ccgo_strace {
+ trc("t=%v optname=%v optval=%v optlen=%v, (%v:)", t, optname, optval, optlen, origin(2))
+ }
if _, _, err := unix.Syscall6(unix.SYS_SETSOCKOPT, uintptr(sockfd), uintptr(level), uintptr(optname), optval, uintptr(optlen), 0); err != 0 {
t.setErrno(err)
return -1
@@ -603,6 +722,9 @@ func Xsetsockopt(t *TLS, sockfd, level, optname int32, optval uintptr, optlen so
// int ioctl(int fd, unsigned long request, ...);
func Xioctl(t *TLS, fd int32, request ulong, va uintptr) int32 {
+ if __ccgo_strace {
+ trc("t=%v fd=%v request=%v va=%v, (%v:)", t, fd, request, va, origin(2))
+ }
var argp uintptr
if va != 0 {
argp = VaUintptr(&va)
@@ -618,6 +740,9 @@ func Xioctl(t *TLS, fd int32, request ulong, va uintptr) int32 {
// int getsockname(int sockfd, struct sockaddr *addr, socklen_t *addrlen);
func Xgetsockname(t *TLS, sockfd int32, addr, addrlen uintptr) int32 {
+ if __ccgo_strace {
+ trc("t=%v sockfd=%v addrlen=%v, (%v:)", t, sockfd, addrlen, origin(2))
+ }
if _, _, err := unix.Syscall(unix.SYS_GETSOCKNAME, uintptr(sockfd), addr, addrlen); err != 0 { // Cannot avoid the syscall here.
if dmesgs {
dmesg("%v: fd %v: %v FAIL", origin(1), sockfd, err)
@@ -634,6 +759,9 @@ func Xgetsockname(t *TLS, sockfd int32, addr, addrlen uintptr) int32 {
// int select(int nfds, fd_set *readfds, fd_set *writefds, fd_set *exceptfds, struct timeval *timeout);
func Xselect(t *TLS, nfds int32, readfds, writefds, exceptfds, timeout uintptr) int32 {
+ if __ccgo_strace {
+ trc("t=%v nfds=%v timeout=%v, (%v:)", t, nfds, timeout, origin(2))
+ }
n, err := unix.Select(
int(nfds),
(*unix.FdSet)(unsafe.Pointer(readfds)),
@@ -657,6 +785,9 @@ func Xselect(t *TLS, nfds int32, readfds, writefds, exceptfds, timeout uintptr)
// int mkfifo(const char *pathname, mode_t mode);
func Xmkfifo(t *TLS, pathname uintptr, mode types.Mode_t) int32 {
+ if __ccgo_strace {
+ trc("t=%v pathname=%v mode=%v, (%v:)", t, pathname, mode, origin(2))
+ }
if err := unix.Mkfifo(GoString(pathname), uint32(mode)); err != nil {
t.setErrno(err)
return -1
@@ -667,6 +798,9 @@ func Xmkfifo(t *TLS, pathname uintptr, mode types.Mode_t) int32 {
// mode_t umask(mode_t mask);
func Xumask(t *TLS, mask types.Mode_t) types.Mode_t {
+ if __ccgo_strace {
+ trc("t=%v mask=%v, (%v:)", t, mask, origin(2))
+ }
return types.Mode_t(unix.Umask(int(mask)))
}
@@ -682,6 +816,9 @@ func Xumask(t *TLS, mask types.Mode_t) types.Mode_t {
// pid_t (pid_t pid, int *wstatus, int options);
func Xwaitpid(t *TLS, pid types.Pid_t, wstatus uintptr, optname int32) types.Pid_t {
+ if __ccgo_strace {
+ trc("t=%v pid=%v wstatus=%v optname=%v, (%v:)", t, pid, wstatus, optname, origin(2))
+ }
n, err := unix.Wait4(int(pid), (*unix.WaitStatus)(unsafe.Pointer(wstatus)), int(optname), nil)
if err != nil {
if dmesgs {
@@ -699,6 +836,9 @@ func Xwaitpid(t *TLS, pid types.Pid_t, wstatus uintptr, optname int32) types.Pid
// int uname(struct utsname *buf);
func Xuname(t *TLS, buf uintptr) int32 {
+ if __ccgo_strace {
+ trc("t=%v buf=%v, (%v:)", t, buf, origin(2))
+ }
if err := unix.Uname((*unix.Utsname)(unsafe.Pointer(buf))); err != nil {
if dmesgs {
dmesg("%v: %v FAIL", origin(1), err)
@@ -715,6 +855,9 @@ func Xuname(t *TLS, buf uintptr) int32 {
// ssize_t recv(int sockfd, void *buf, size_t len, int flags);
func Xrecv(t *TLS, sockfd int32, buf uintptr, len types.Size_t, flags int32) types.Ssize_t {
+ if __ccgo_strace {
+ trc("t=%v sockfd=%v buf=%v len=%v flags=%v, (%v:)", t, sockfd, buf, len, flags, origin(2))
+ }
n, _, err := unix.Syscall6(unix.SYS_RECVFROM, uintptr(sockfd), buf, uintptr(len), uintptr(flags), 0, 0)
if err != 0 {
t.setErrno(err)
@@ -726,6 +869,9 @@ func Xrecv(t *TLS, sockfd int32, buf uintptr, len types.Size_t, flags int32) typ
// ssize_t send(int sockfd, const void *buf, size_t len, int flags);
func Xsend(t *TLS, sockfd int32, buf uintptr, len types.Size_t, flags int32) types.Ssize_t {
+ if __ccgo_strace {
+ trc("t=%v sockfd=%v buf=%v len=%v flags=%v, (%v:)", t, sockfd, buf, len, flags, origin(2))
+ }
n, _, err := unix.Syscall6(unix.SYS_SENDTO, uintptr(sockfd), buf, uintptr(len), uintptr(flags), 0, 0)
if err != 0 {
t.setErrno(err)
@@ -737,6 +883,9 @@ func Xsend(t *TLS, sockfd int32, buf uintptr, len types.Size_t, flags int32) typ
// int shutdown(int sockfd, int how);
func Xshutdown(t *TLS, sockfd, how int32) int32 {
+ if __ccgo_strace {
+ trc("t=%v how=%v, (%v:)", t, how, origin(2))
+ }
if _, _, err := unix.Syscall(unix.SYS_SHUTDOWN, uintptr(sockfd), uintptr(how), 0); err != 0 {
t.setErrno(err)
return -1
@@ -747,6 +896,9 @@ func Xshutdown(t *TLS, sockfd, how int32) int32 {
// int getpeername(int sockfd, struct sockaddr *addr, socklen_t *addrlen);
func Xgetpeername(t *TLS, sockfd int32, addr uintptr, addrlen uintptr) int32 {
+ if __ccgo_strace {
+ trc("t=%v sockfd=%v addr=%v addrlen=%v, (%v:)", t, sockfd, addr, addrlen, origin(2))
+ }
if _, _, err := unix.Syscall(unix.SYS_GETPEERNAME, uintptr(sockfd), addr, uintptr(addrlen)); err != 0 {
t.setErrno(err)
return -1
@@ -757,6 +909,9 @@ func Xgetpeername(t *TLS, sockfd int32, addr uintptr, addrlen uintptr) int32 {
// int socket(int domain, int type, int protocol);
func Xsocket(t *TLS, domain, type1, protocol int32) int32 {
+ if __ccgo_strace {
+ trc("t=%v protocol=%v, (%v:)", t, protocol, origin(2))
+ }
n, _, err := unix.Syscall(unix.SYS_SOCKET, uintptr(domain), uintptr(type1), uintptr(protocol))
if err != 0 {
t.setErrno(err)
@@ -768,6 +923,9 @@ func Xsocket(t *TLS, domain, type1, protocol int32) int32 {
// int bind(int sockfd, const struct sockaddr *addr, socklen_t addrlen);
func Xbind(t *TLS, sockfd int32, addr uintptr, addrlen uint32) int32 {
+ if __ccgo_strace {
+ trc("t=%v sockfd=%v addr=%v addrlen=%v, (%v:)", t, sockfd, addr, addrlen, origin(2))
+ }
n, _, err := unix.Syscall(unix.SYS_BIND, uintptr(sockfd), addr, uintptr(addrlen))
if err != 0 {
t.setErrno(err)
@@ -779,6 +937,9 @@ func Xbind(t *TLS, sockfd int32, addr uintptr, addrlen uint32) int32 {
// int connect(int sockfd, const struct sockaddr *addr, socklen_t addrlen);
func Xconnect(t *TLS, sockfd int32, addr uintptr, addrlen uint32) int32 {
+ if __ccgo_strace {
+ trc("t=%v sockfd=%v addr=%v addrlen=%v, (%v:)", t, sockfd, addr, addrlen, origin(2))
+ }
if _, _, err := unix.Syscall(unix.SYS_CONNECT, uintptr(sockfd), addr, uintptr(addrlen)); err != 0 {
t.setErrno(err)
return -1
@@ -789,6 +950,9 @@ func Xconnect(t *TLS, sockfd int32, addr uintptr, addrlen uint32) int32 {
// int listen(int sockfd, int backlog);
func Xlisten(t *TLS, sockfd, backlog int32) int32 {
+ if __ccgo_strace {
+ trc("t=%v backlog=%v, (%v:)", t, backlog, origin(2))
+ }
if _, _, err := unix.Syscall(unix.SYS_LISTEN, uintptr(sockfd), uintptr(backlog), 0); err != 0 {
t.setErrno(err)
return -1
@@ -799,6 +963,9 @@ func Xlisten(t *TLS, sockfd, backlog int32) int32 {
// int accept(int sockfd, struct sockaddr *addr, socklen_t *addrlen);
func Xaccept(t *TLS, sockfd int32, addr uintptr, addrlen uintptr) int32 {
+ if __ccgo_strace {
+ trc("t=%v sockfd=%v addr=%v addrlen=%v, (%v:)", t, sockfd, addr, addrlen, origin(2))
+ }
panic(todo(""))
// n, _, err := unix.Syscall6(unix.SYS_ACCEPT4, uintptr(sockfd), addr, uintptr(addrlen), 0, 0, 0)
// if err != 0 {
@@ -831,6 +998,9 @@ func Xaccept(t *TLS, sockfd int32, addr uintptr, addrlen uintptr) int32 {
// uid_t getuid(void);
func Xgetuid(t *TLS) types.Uid_t {
+ if __ccgo_strace {
+ trc("t=%v, (%v:)", t, origin(2))
+ }
r := types.Uid_t(os.Getuid())
if dmesgs {
dmesg("%v: %v", origin(1), r)
@@ -840,6 +1010,9 @@ func Xgetuid(t *TLS) types.Uid_t {
// pid_t getpid(void);
func Xgetpid(t *TLS) int32 {
+ if __ccgo_strace {
+ trc("t=%v, (%v:)", t, origin(2))
+ }
r := int32(os.Getpid())
if dmesgs {
dmesg("%v: %v", origin(1), r)
@@ -849,6 +1022,9 @@ func Xgetpid(t *TLS) int32 {
// int system(const char *command);
func Xsystem(t *TLS, command uintptr) int32 {
+ if __ccgo_strace {
+ trc("t=%v command=%v, (%v:)", t, command, origin(2))
+ }
s := GoString(command)
if command == 0 {
panic(todo(""))
@@ -868,11 +1044,17 @@ func Xsystem(t *TLS, command uintptr) int32 {
// int setvbuf(FILE *stream, char *buf, int mode, size_t size);
func Xsetvbuf(t *TLS, stream, buf uintptr, mode int32, size types.Size_t) int32 {
+ if __ccgo_strace {
+ trc("t=%v buf=%v mode=%v size=%v, (%v:)", t, buf, mode, size, origin(2))
+ }
return 0 //TODO
}
// int raise(int sig);
func Xraise(t *TLS, sig int32) int32 {
+ if __ccgo_strace {
+ trc("t=%v sig=%v, (%v:)", t, sig, origin(2))
+ }
panic(todo(""))
}
@@ -888,6 +1070,9 @@ func Xraise(t *TLS, sig int32) int32 {
// int fileno(FILE *stream);
func Xfileno(t *TLS, stream uintptr) int32 {
+ if __ccgo_strace {
+ trc("t=%v stream=%v, (%v:)", t, stream, origin(2))
+ }
if stream == 0 {
if dmesgs {
dmesg("%v: FAIL", origin(1))
@@ -961,6 +1146,9 @@ func (f *ftstream) close(t *TLS) {
// FTS *fts_open(char * const *path_argv, int options, int (*compar)(const FTSENT **, const FTSENT **));
func Xfts_open(t *TLS, path_argv uintptr, options int32, compar uintptr) uintptr {
+ if __ccgo_strace {
+ trc("t=%v path_argv=%v options=%v compar=%v, (%v:)", t, path_argv, options, compar, origin(2))
+ }
f := &ftstream{}
var walk func(string)
@@ -1065,6 +1253,9 @@ func Xfts_open(t *TLS, path_argv uintptr, options int32, compar uintptr) uintptr
// FTSENT *fts_read(FTS *ftsp);
func Xfts_read(t *TLS, ftsp uintptr) uintptr {
+ if __ccgo_strace {
+ trc("t=%v ftsp=%v, (%v:)", t, ftsp, origin(2))
+ }
f := getObject(ftsp).(*ftstream)
if f.x == len(f.s) {
if dmesgs {
@@ -1087,6 +1278,9 @@ func Xfts_read(t *TLS, ftsp uintptr) uintptr {
// int fts_close(FTS *ftsp);
func Xfts_close(t *TLS, ftsp uintptr) int32 {
+ if __ccgo_strace {
+ trc("t=%v ftsp=%v, (%v:)", t, ftsp, origin(2))
+ }
getObject(ftsp).(*ftstream).close(t)
removeObject(ftsp)
return 0
@@ -1094,41 +1288,65 @@ func Xfts_close(t *TLS, ftsp uintptr) int32 {
// void tzset (void);
func Xtzset(t *TLS) {
+ if __ccgo_strace {
+ trc("t=%v, (%v:)", t, origin(2))
+ }
//TODO
}
// char *strerror(int errnum);
func Xstrerror(t *TLS, errnum int32) uintptr {
+ if __ccgo_strace {
+ trc("t=%v errnum=%v, (%v:)", t, errnum, origin(2))
+ }
panic(todo(""))
}
// void *dlopen(const char *filename, int flags);
func Xdlopen(t *TLS, filename uintptr, flags int32) uintptr {
+ if __ccgo_strace {
+ trc("t=%v filename=%v flags=%v, (%v:)", t, filename, flags, origin(2))
+ }
panic(todo(""))
}
// char *dlerror(void);
func Xdlerror(t *TLS) uintptr {
+ if __ccgo_strace {
+ trc("t=%v, (%v:)", t, origin(2))
+ }
panic(todo(""))
}
// int dlclose(void *handle);
func Xdlclose(t *TLS, handle uintptr) int32 {
+ if __ccgo_strace {
+ trc("t=%v handle=%v, (%v:)", t, handle, origin(2))
+ }
panic(todo(""))
}
// void *dlsym(void *handle, const char *symbol);
func Xdlsym(t *TLS, handle, symbol uintptr) uintptr {
+ if __ccgo_strace {
+ trc("t=%v symbol=%v, (%v:)", t, symbol, origin(2))
+ }
panic(todo(""))
}
// void perror(const char *s);
func Xperror(t *TLS, s uintptr) {
+ if __ccgo_strace {
+ trc("t=%v s=%v, (%v:)", t, s, origin(2))
+ }
panic(todo(""))
}
// int pclose(FILE *stream);
func Xpclose(t *TLS, stream uintptr) int32 {
+ if __ccgo_strace {
+ trc("t=%v stream=%v, (%v:)", t, stream, origin(2))
+ }
panic(todo(""))
}
@@ -1136,6 +1354,9 @@ func Xpclose(t *TLS, stream uintptr) int32 {
// const char *gai_strerror(int errcode);
func Xgai_strerror(t *TLS, errcode int32) uintptr {
+ if __ccgo_strace {
+ trc("t=%v errcode=%v, (%v:)", t, errcode, origin(2))
+ }
panic(todo(""))
// copy(gai_strerrorBuf[:], fmt.Sprintf("gai error %d\x00", errcode))
// return uintptr(unsafe.Pointer(&gai_strerrorBuf))
@@ -1143,16 +1364,25 @@ func Xgai_strerror(t *TLS, errcode int32) uintptr {
// int tcgetattr(int fd, struct termios *termios_p);
func Xtcgetattr(t *TLS, fd int32, termios_p uintptr) int32 {
+ if __ccgo_strace {
+ trc("t=%v fd=%v termios_p=%v, (%v:)", t, fd, termios_p, origin(2))
+ }
panic(todo(""))
}
// int tcsetattr(int fd, int optional_actions, const struct termios *termios_p);
func Xtcsetattr(t *TLS, fd, optional_actions int32, termios_p uintptr) int32 {
+ if __ccgo_strace {
+ trc("t=%v optional_actions=%v termios_p=%v, (%v:)", t, optional_actions, termios_p, origin(2))
+ }
panic(todo(""))
}
// speed_t cfgetospeed(const struct termios *termios_p);
func Xcfgetospeed(t *TLS, termios_p uintptr) termios.Speed_t {
+ if __ccgo_strace {
+ trc("t=%v termios_p=%v, (%v:)", t, termios_p, origin(2))
+ }
panic(todo(""))
}
@@ -1170,6 +1400,9 @@ func Xcfsetispeed(...interface{}) int32 {
// pid_t fork(void);
func Xfork(t *TLS) int32 {
+ if __ccgo_strace {
+ trc("t=%v, (%v:)", t, origin(2))
+ }
if dmesgs {
dmesg("%v: FAIL", origin(1))
}
@@ -1181,21 +1414,33 @@ var emptyStr = [1]byte{}
// char *setlocale(int category, const char *locale);
func Xsetlocale(t *TLS, category int32, locale uintptr) uintptr {
+ if __ccgo_strace {
+ trc("t=%v category=%v locale=%v, (%v:)", t, category, locale, origin(2))
+ }
return uintptr(unsafe.Pointer(&emptyStr)) //TODO
}
// char *nl_langinfo(nl_item item);
func Xnl_langinfo(t *TLS, item langinfo.Nl_item) uintptr {
+ if __ccgo_strace {
+ trc("t=%v item=%v, (%v:)", t, item, origin(2))
+ }
return uintptr(unsafe.Pointer(&emptyStr)) //TODO
}
// FILE *popen(const char *command, const char *type);
func Xpopen(t *TLS, command, type1 uintptr) uintptr {
+ if __ccgo_strace {
+ trc("t=%v type1=%v, (%v:)", t, type1, origin(2))
+ }
panic(todo(""))
}
// char *realpath(const char *path, char *resolved_path);
func Xrealpath(t *TLS, path, resolved_path uintptr) uintptr {
+ if __ccgo_strace {
+ trc("t=%v resolved_path=%v, (%v:)", t, resolved_path, origin(2))
+ }
s, err := filepath.EvalSymlinks(GoString(path))
if err != nil {
if os.IsNotExist(err) {
@@ -1227,20 +1472,32 @@ func Xrealpath(t *TLS, path, resolved_path uintptr) uintptr {
// struct tm *gmtime_r(const time_t *timep, struct tm *result);
func Xgmtime_r(t *TLS, timep, result uintptr) uintptr {
+ if __ccgo_strace {
+ trc("t=%v result=%v, (%v:)", t, result, origin(2))
+ }
panic(todo(""))
}
// char *inet_ntoa(struct in_addr in);
func Xinet_ntoa(t *TLS, in1 in.In_addr) uintptr {
+ if __ccgo_strace {
+ trc("t=%v in1=%v, (%v:)", t, in1, origin(2))
+ }
panic(todo(""))
}
func X__ccgo_in6addr_anyp(t *TLS) uintptr {
+ if __ccgo_strace {
+ trc("t=%v, (%v:)", t, origin(2))
+ }
panic(todo(""))
// return uintptr(unsafe.Pointer(&in6_addr_any))
}
func Xabort(t *TLS) {
+ if __ccgo_strace {
+ trc("t=%v, (%v:)", t, origin(2))
+ }
if dmesgs {
dmesg("%v:", origin(1))
}
@@ -1258,11 +1515,17 @@ func Xabort(t *TLS) {
// int fflush(FILE *stream);
func Xfflush(t *TLS, stream uintptr) int32 {
+ if __ccgo_strace {
+ trc("t=%v stream=%v, (%v:)", t, stream, origin(2))
+ }
return 0 //TODO
}
// size_t fread(void *ptr, size_t size, size_t nmemb, FILE *stream);
func Xfread(t *TLS, ptr uintptr, size, nmemb types.Size_t, stream uintptr) types.Size_t {
+ if __ccgo_strace {
+ trc("t=%v ptr=%v nmemb=%v stream=%v, (%v:)", t, ptr, nmemb, stream, origin(2))
+ }
fd := uintptr(file(stream).fd())
count := size * nmemb
var n int
@@ -1292,6 +1555,9 @@ func Xfread(t *TLS, ptr uintptr, size, nmemb types.Size_t, stream uintptr) types
// size_t fwrite(const void *ptr, size_t size, size_t nmemb, FILE *stream);
func Xfwrite(t *TLS, ptr uintptr, size, nmemb types.Size_t, stream uintptr) types.Size_t {
+ if __ccgo_strace {
+ trc("t=%v ptr=%v nmemb=%v stream=%v, (%v:)", t, ptr, nmemb, stream, origin(2))
+ }
fd := uintptr(file(stream).fd())
count := size * nmemb
var n int
@@ -1321,6 +1587,9 @@ func Xfwrite(t *TLS, ptr uintptr, size, nmemb types.Size_t, stream uintptr) type
// int fclose(FILE *stream);
func Xfclose(t *TLS, stream uintptr) int32 {
+ if __ccgo_strace {
+ trc("t=%v stream=%v, (%v:)", t, stream, origin(2))
+ }
r := file(stream).close(t)
if r != 0 {
if dmesgs {
@@ -1338,6 +1607,9 @@ func Xfclose(t *TLS, stream uintptr) int32 {
// int fputc(int c, FILE *stream);
func Xfputc(t *TLS, c int32, stream uintptr) int32 {
+ if __ccgo_strace {
+ trc("t=%v c=%v stream=%v, (%v:)", t, c, stream, origin(2))
+ }
if _, err := fwrite(file(stream).fd(), []byte{byte(c)}); err != nil {
return stdio.EOF
}
@@ -1347,6 +1619,9 @@ func Xfputc(t *TLS, c int32, stream uintptr) int32 {
// int fseek(FILE *stream, long offset, int whence);
func Xfseek(t *TLS, stream uintptr, offset long, whence int32) int32 {
+ if __ccgo_strace {
+ trc("t=%v stream=%v offset=%v whence=%v, (%v:)", t, stream, offset, whence, origin(2))
+ }
if n := Xlseek(t, int32(file(stream).fd()), types.Off_t(offset), whence); n < 0 {
if dmesgs {
dmesg("%v: fd %v, off %#x, whence %v: %v", origin(1), file(stream).fd(), offset, whenceStr(whence), n)
@@ -1363,6 +1638,9 @@ func Xfseek(t *TLS, stream uintptr, offset long, whence int32) int32 {
// long ftell(FILE *stream);
func Xftell(t *TLS, stream uintptr) long {
+ if __ccgo_strace {
+ trc("t=%v stream=%v, (%v:)", t, stream, origin(2))
+ }
n := Xlseek(t, file(stream).fd(), 0, stdio.SEEK_CUR)
if n < 0 {
file(stream).setErr()
@@ -1377,11 +1655,17 @@ func Xftell(t *TLS, stream uintptr) long {
// int ferror(FILE *stream);
func Xferror(t *TLS, stream uintptr) int32 {
+ if __ccgo_strace {
+ trc("t=%v stream=%v, (%v:)", t, stream, origin(2))
+ }
return Bool32(file(stream).err())
}
// int fputs(const char *s, FILE *stream);
func Xfputs(t *TLS, s, stream uintptr) int32 {
+ if __ccgo_strace {
+ trc("t=%v stream=%v, (%v:)", t, stream, origin(2))
+ }
panic(todo(""))
// if _, _, err := unix.Syscall(unix.SYS_WRITE, uintptr(file(stream).fd()), s, uintptr(Xstrlen(t, s))); err != 0 {
// return -1
@@ -1394,6 +1678,9 @@ var getservbynameStaticResult netdb.Servent
// struct servent *getservbyname(const char *name, const char *proto);
func Xgetservbyname(t *TLS, name, proto uintptr) uintptr {
+ if __ccgo_strace {
+ trc("t=%v proto=%v, (%v:)", t, proto, origin(2))
+ }
var protoent *gonetdb.Protoent
if proto != 0 {
protoent = gonetdb.GetProtoByName(GoString(proto))
@@ -1528,6 +1815,9 @@ func fcntlCmdStr(cmd int32) string {
// ssize_t pwrite(int fd, const void *buf, size_t count, off_t offset);
func Xpwrite(t *TLS, fd int32, buf uintptr, count types.Size_t, offset types.Off_t) types.Ssize_t {
+ if __ccgo_strace {
+ trc("t=%v fd=%v buf=%v count=%v offset=%v, (%v:)", t, fd, buf, count, offset, origin(2))
+ }
var n int
var err error
switch {
@@ -1555,11 +1845,17 @@ func Xpwrite(t *TLS, fd int32, buf uintptr, count types.Size_t, offset types.Off
// char***_NSGetEnviron()
func X_NSGetEnviron(t *TLS) uintptr {
+ if __ccgo_strace {
+ trc("t=%v, (%v:)", t, origin(2))
+ }
return EnvironP()
}
// int chflags(const char *path, u_int flags);
func Xchflags(t *TLS, path uintptr, flags uint32) int32 {
+ if __ccgo_strace {
+ trc("t=%v path=%v flags=%v, (%v:)", t, path, flags, origin(2))
+ }
if err := unix.Chflags(GoString(path), int(flags)); err != nil {
if dmesgs {
dmesg("%v: %v FAIL", origin(1), err)
@@ -1576,6 +1872,9 @@ func Xchflags(t *TLS, path uintptr, flags uint32) int32 {
// int rmdir(const char *pathname);
func Xrmdir(t *TLS, pathname uintptr) int32 {
+ if __ccgo_strace {
+ trc("t=%v pathname=%v, (%v:)", t, pathname, origin(2))
+ }
if err := unix.Rmdir(GoString(pathname)); err != nil {
if dmesgs {
dmesg("%v: %v FAIL", origin(1), err)
@@ -1592,6 +1891,9 @@ func Xrmdir(t *TLS, pathname uintptr) int32 {
// uint64_t mach_absolute_time(void);
func Xmach_absolute_time(t *TLS) uint64 {
+ if __ccgo_strace {
+ trc("t=%v, (%v:)", t, origin(2))
+ }
return uint64(gotime.Now().UnixNano())
}
@@ -1603,12 +1905,18 @@ type machTimebaseInfo = struct {
// kern_return_t mach_timebase_info(mach_timebase_info_t info);
func Xmach_timebase_info(t *TLS, info uintptr) int32 {
+ if __ccgo_strace {
+ trc("t=%v info=%v, (%v:)", t, info, origin(2))
+ }
*(*machTimebaseInfo)(unsafe.Pointer(info)) = machTimebaseInfo{Fnumer: 1, Fdenom: 1}
return 0
}
// int getattrlist(const char* path, struct attrlist * attrList, void * attrBuf, size_t attrBufSize, unsigned long options);
func Xgetattrlist(t *TLS, path, attrList, attrBuf uintptr, attrBufSize types.Size_t, options uint32) int32 {
+ if __ccgo_strace {
+ trc("t=%v attrBuf=%v attrBufSize=%v options=%v, (%v:)", t, attrBuf, attrBufSize, options, origin(2))
+ }
if _, _, err := unix.Syscall6(unix.SYS_GETATTRLIST, path, attrList, attrBuf, uintptr(attrBufSize), uintptr(options), 0); err != 0 { // Cannot avoid the syscall here.
if dmesgs {
dmesg("%v: %v FAIL", origin(1), err)
@@ -1625,6 +1933,9 @@ func Xgetattrlist(t *TLS, path, attrList, attrBuf uintptr, attrBufSize types.Siz
// int setattrlist(const char* path, struct attrlist * attrList, void * attrBuf, size_t attrBufSize, unsigned long options);
func Xsetattrlist(t *TLS, path, attrList, attrBuf uintptr, attrBufSize types.Size_t, options uint32) int32 {
+ if __ccgo_strace {
+ trc("t=%v attrBuf=%v attrBufSize=%v options=%v, (%v:)", t, attrBuf, attrBufSize, options, origin(2))
+ }
if _, _, err := unix.Syscall6(unix.SYS_SETATTRLIST, path, attrList, attrBuf, uintptr(attrBufSize), uintptr(options), 0); err != 0 { // Cannot avoid the syscall here.
if dmesgs {
dmesg("%v: %v FAIL", origin(1), err)
@@ -1660,6 +1971,9 @@ type darwinDir struct {
// DIR *opendir(const char *name);
func Xopendir(t *TLS, name uintptr) uintptr {
+ if __ccgo_strace {
+ trc("t=%v name=%v, (%v:)", t, name, origin(2))
+ }
p := Xmalloc(t, uint64(unsafe.Sizeof(darwinDir{})))
if p == 0 {
panic("OOM")
@@ -1688,6 +2002,9 @@ func Xopendir(t *TLS, name uintptr) uintptr {
// struct dirent *readdir(DIR *dirp);
func Xreaddir(t *TLS, dir uintptr) uintptr {
+ if __ccgo_strace {
+ trc("t=%v dir=%v, (%v:)", t, dir, origin(2))
+ }
if (*darwinDir)(unsafe.Pointer(dir)).eof {
return 0
}
@@ -1719,6 +2036,9 @@ func Xreaddir(t *TLS, dir uintptr) uintptr {
}
func Xclosedir(t *TLS, dir uintptr) int32 {
+ if __ccgo_strace {
+ trc("t=%v dir=%v, (%v:)", t, dir, origin(2))
+ }
// trc("---- closedir: %#x", dir)
r := Xclose(t, int32((*darwinDir)(unsafe.Pointer(dir)).fd))
Xfree(t, dir)
@@ -1727,6 +2047,9 @@ func Xclosedir(t *TLS, dir uintptr) int32 {
// int pipe(int pipefd[2]);
func Xpipe(t *TLS, pipefd uintptr) int32 {
+ if __ccgo_strace {
+ trc("t=%v pipefd=%v, (%v:)", t, pipefd, origin(2))
+ }
var a [2]int
if err := syscall.Pipe(a[:]); err != nil {
if dmesgs {
@@ -1745,6 +2068,9 @@ func Xpipe(t *TLS, pipefd uintptr) int32 {
// int __isoc99_sscanf(const char *str, const char *format, ...);
func X__isoc99_sscanf(t *TLS, str, format, va uintptr) int32 {
+ if __ccgo_strace {
+ trc("t=%v va=%v, (%v:)", t, va, origin(2))
+ }
r := scanf(strings.NewReader(GoString(str)), format, va)
// if dmesgs {
// dmesg("%v: %q %q: %d", origin(1), GoString(str), GoString(format), r)
@@ -1754,6 +2080,9 @@ func X__isoc99_sscanf(t *TLS, str, format, va uintptr) int32 {
// int sscanf(const char *str, const char *format, ...);
func Xsscanf(t *TLS, str, format, va uintptr) int32 {
+ if __ccgo_strace {
+ trc("t=%v va=%v, (%v:)", t, va, origin(2))
+ }
r := scanf(strings.NewReader(GoString(str)), format, va)
// if dmesgs {
// dmesg("%v: %q %q: %d", origin(1), GoString(str), GoString(format), r)
@@ -1763,26 +2092,41 @@ func Xsscanf(t *TLS, str, format, va uintptr) int32 {
// int posix_fadvise(int fd, off_t offset, off_t len, int advice);
func Xposix_fadvise(t *TLS, fd int32, offset, len types.Off_t, advice int32) int32 {
+ if __ccgo_strace {
+ trc("t=%v fd=%v len=%v advice=%v, (%v:)", t, fd, len, advice, origin(2))
+ }
panic(todo(""))
}
// clock_t clock(void);
func Xclock(t *TLS) time.Clock_t {
+ if __ccgo_strace {
+ trc("t=%v, (%v:)", t, origin(2))
+ }
return time.Clock_t(gotime.Since(startTime) * gotime.Duration(time.CLOCKS_PER_SEC) / gotime.Second)
}
// int iswspace(wint_t wc);
func Xiswspace(t *TLS, wc wctype.Wint_t) int32 {
+ if __ccgo_strace {
+ trc("t=%v wc=%v, (%v:)", t, wc, origin(2))
+ }
return Bool32(unicode.IsSpace(rune(wc)))
}
// int iswalnum(wint_t wc);
func Xiswalnum(t *TLS, wc wctype.Wint_t) int32 {
+ if __ccgo_strace {
+ trc("t=%v wc=%v, (%v:)", t, wc, origin(2))
+ }
return Bool32(unicode.IsLetter(rune(wc)) || unicode.IsNumber(rune(wc)))
}
// void arc4random_buf(void *buf, size_t nbytes);
func Xarc4random_buf(t *TLS, buf uintptr, buflen size_t) {
+ if __ccgo_strace {
+ trc("t=%v buf=%v buflen=%v, (%v:)", t, buf, buflen, origin(2))
+ }
if _, err := crand.Read((*RawMem)(unsafe.Pointer(buf))[:buflen]); err != nil {
panic(todo(""))
}
@@ -1799,35 +2143,59 @@ type darwin_mutex_t struct {
}
func X__ccgo_pthreadMutexattrGettype(tls *TLS, a uintptr) int32 {
+ if __ccgo_strace {
+ trc("tls=%v a=%v, (%v:)", tls, a, origin(2))
+ }
return (int32((*darwin_mutexattr_t)(unsafe.Pointer(a)).x[4] >> 2 & 3))
}
func X__ccgo_getMutexType(tls *TLS, m uintptr) int32 {
+ if __ccgo_strace {
+ trc("tls=%v m=%v, (%v:)", tls, m, origin(2))
+ }
return (int32((*darwin_mutex_t)(unsafe.Pointer(m)).x[4] >> 2 & 3))
}
func X__ccgo_pthreadAttrGetDetachState(tls *TLS, a uintptr) int32 {
+ if __ccgo_strace {
+ trc("tls=%v a=%v, (%v:)", tls, a, origin(2))
+ }
panic(todo(""))
}
func Xpthread_attr_getdetachstate(tls *TLS, a uintptr, state uintptr) int32 {
+ if __ccgo_strace {
+ trc("tls=%v a=%v state=%v, (%v:)", tls, a, state, origin(2))
+ }
panic(todo(""))
}
func Xpthread_attr_setdetachstate(tls *TLS, a uintptr, state int32) int32 {
+ if __ccgo_strace {
+ trc("tls=%v a=%v state=%v, (%v:)", tls, a, state, origin(2))
+ }
panic(todo(""))
}
func Xpthread_mutexattr_destroy(tls *TLS, a uintptr) int32 {
+ if __ccgo_strace {
+ trc("tls=%v a=%v, (%v:)", tls, a, origin(2))
+ }
return 0
}
func Xpthread_mutexattr_init(tls *TLS, a uintptr) int32 {
+ if __ccgo_strace {
+ trc("tls=%v a=%v, (%v:)", tls, a, origin(2))
+ }
*(*darwin_mutexattr_t)(unsafe.Pointer(a)) = darwin_mutexattr_t{}
return 0
}
func Xpthread_mutexattr_settype(tls *TLS, a uintptr, type1 int32) int32 {
+ if __ccgo_strace {
+ trc("tls=%v a=%v type1=%v, (%v:)", tls, a, type1, origin(2))
+ }
if uint32(type1) > uint32(2) {
return errno.EINVAL
}
@@ -1837,6 +2205,9 @@ func Xpthread_mutexattr_settype(tls *TLS, a uintptr, type1 int32) int32 {
// ssize_t writev(int fd, const struct iovec *iov, int iovcnt);
func Xwritev(t *TLS, fd int32, iov uintptr, iovcnt int32) types.Ssize_t {
+ if __ccgo_strace {
+ trc("t=%v fd=%v iov=%v iovcnt=%v, (%v:)", t, fd, iov, iovcnt, origin(2))
+ }
// if dmesgs {
// dmesg("%v: fd %v iov %#x iovcnt %v", origin(1), fd, iov, iovcnt)
// }
@@ -1854,6 +2225,9 @@ func Xwritev(t *TLS, fd int32, iov uintptr, iovcnt int32) types.Ssize_t {
// int pause(void);
func Xpause(t *TLS) int32 {
+ if __ccgo_strace {
+ trc("t=%v, (%v:)", t, origin(2))
+ }
c := make(chan os.Signal)
gosignal.Notify(c,
syscall.SIGABRT,
@@ -1911,6 +2285,9 @@ func Xpause(t *TLS) int32 {
// (_p->fds_bits[(unsigned long)_fd / __DARWIN_NFDBITS] |= ((__int32_t)(((unsigned long)1) << ((unsigned long)_fd % __DARWIN_NFDBITS))));
// }
func X__darwin_fd_set(tls *TLS, _fd int32, _p uintptr) int32 { /* main.c:12:1: */
+ if __ccgo_strace {
+ trc("tls=%v _fd=%v _p=%v, (%v:)", tls, _fd, _p, origin(2))
+ }
*(*int32)(unsafe.Pointer(_p + uintptr(uint64(_fd)/(uint64(unsafe.Sizeof(int32(0)))*uint64(8)))*4)) |= int32(uint64(uint64(1)) << (uint64(_fd) % (uint64(unsafe.Sizeof(int32(0))) * uint64(8))))
return int32(0)
}
@@ -1921,6 +2298,9 @@ func X__darwin_fd_set(tls *TLS, _fd int32, _p uintptr) int32 { /* main.c:12:1: *
// return _p->fds_bits[(unsigned long)_fd / __DARWIN_NFDBITS] & ((__int32_t)(((unsigned long)1) << ((unsigned long)_fd % __DARWIN_NFDBITS)));
// }
func X__darwin_fd_isset(tls *TLS, _fd int32, _p uintptr) int32 { /* main.c:17:1: */
+ if __ccgo_strace {
+ trc("tls=%v _fd=%v _p=%v, (%v:)", tls, _fd, _p, origin(2))
+ }
return *(*int32)(unsafe.Pointer(_p + uintptr(uint64(_fd)/(uint64(unsafe.Sizeof(int32(0)))*uint64(8)))*4)) & int32(uint64(uint64(1))<<(uint64(_fd)%(uint64(unsafe.Sizeof(int32(0)))*uint64(8))))
}
@@ -1930,17 +2310,26 @@ func X__darwin_fd_isset(tls *TLS, _fd int32, _p uintptr) int32 { /* main.c:17:1:
// (_p->fds_bits[(unsigned long)_fd / __DARWIN_NFDBITS] &= ~((__int32_t)(((unsigned long)1) << ((unsigned long)_fd % __DARWIN_NFDBITS))));
// }
func X__darwin_fd_clr(tls *TLS, _fd int32, _p uintptr) int32 { /* main.c:22:1: */
+ if __ccgo_strace {
+ trc("tls=%v _fd=%v _p=%v, (%v:)", tls, _fd, _p, origin(2))
+ }
*(*int32)(unsafe.Pointer(_p + uintptr(uint64(_fd)/(uint64(unsafe.Sizeof(int32(0)))*uint64(8)))*4)) &= ^int32(uint64(uint64(1)) << (uint64(_fd) % (uint64(unsafe.Sizeof(int32(0))) * uint64(8))))
return int32(0)
}
// int ungetc(int c, FILE *stream);
func Xungetc(t *TLS, c int32, stream uintptr) int32 {
+ if __ccgo_strace {
+ trc("t=%v c=%v stream=%v, (%v:)", t, c, stream, origin(2))
+ }
panic(todo(""))
}
// int issetugid(void);
func Xissetugid(t *TLS) int32 {
+ if __ccgo_strace {
+ trc("t=%v, (%v:)", t, origin(2))
+ }
panic(todo(""))
}
@@ -1948,6 +2337,9 @@ var progname uintptr
// const char *getprogname(void);
func Xgetprogname(t *TLS) uintptr {
+ if __ccgo_strace {
+ trc("t=%v, (%v:)", t, origin(2))
+ }
if progname != 0 {
return progname
}
@@ -1964,11 +2356,17 @@ func Xgetprogname(t *TLS) uintptr {
// void uuid_copy(uuid_t dst, uuid_t src);
func Xuuid_copy(t *TLS, dst, src uintptr) {
+ if __ccgo_strace {
+ trc("t=%v src=%v, (%v:)", t, src, origin(2))
+ }
*(*uuid.Uuid_t)(unsafe.Pointer(dst)) = *(*uuid.Uuid_t)(unsafe.Pointer(src))
}
// int uuid_parse( char *in, uuid_t uu);
func Xuuid_parse(t *TLS, in uintptr, uu uintptr) int32 {
+ if __ccgo_strace {
+ trc("t=%v in=%v uu=%v, (%v:)", t, in, uu, origin(2))
+ }
r, err := guuid.Parse(GoString(in))
if err != nil {
return -1
@@ -2004,15 +2402,24 @@ func X__sincospi_stret(t *TLS, f float64) struct{ F__sinval, F__cosval float64 }
// int __srget(FILE *);
func X__srget(t *TLS, f uintptr) int32 {
+ if __ccgo_strace {
+ trc("t=%v f=%v, (%v:)", t, f, origin(2))
+ }
panic(todo(""))
}
// int __svfscanf(FILE *, const char *, va_list) __scanflike(2, 0);
func X__svfscanf(t *TLS, f uintptr, p, q uintptr) int32 {
+ if __ccgo_strace {
+ trc("t=%v f=%v q=%v, (%v:)", t, f, q, origin(2))
+ }
panic(todo(""))
}
// int __swbuf(int, FILE *);
func X__swbuf(t *TLS, i int32, f uintptr) int32 {
+ if __ccgo_strace {
+ trc("t=%v i=%v f=%v, (%v:)", t, i, f, origin(2))
+ }
panic(todo(""))
}
diff --git a/vendor/modernc.org/libc/libc_darwin_amd64.go b/vendor/modernc.org/libc/libc_darwin_amd64.go
index e8f46c49..5f3929e6 100644
--- a/vendor/modernc.org/libc/libc_darwin_amd64.go
+++ b/vendor/modernc.org/libc/libc_darwin_amd64.go
@@ -17,6 +17,9 @@ import (
// int sigaction(int signum, const struct sigaction *act, struct sigaction *oldact);
func Xsigaction(t *TLS, signum int32, act, oldact uintptr) int32 {
+ if __ccgo_strace {
+ trc("t=%v signum=%v oldact=%v, (%v:)", t, signum, oldact, origin(2))
+ }
var kact, koldact uintptr
if act != 0 {
sz := int(unsafe.Sizeof(signal.X__sigaction{}))
@@ -44,6 +47,10 @@ func Xsigaction(t *TLS, signum int32, act, oldact uintptr) int32 {
// int fcntl(int fd, int cmd, ... /* arg */ );
func Xfcntl64(t *TLS, fd, cmd int32, args uintptr) (r int32) {
+ if __ccgo_strace {
+ trc("t=%v cmd=%v args=%v, (%v:)", t, cmd, args, origin(2))
+ defer func() { trc("-> %v", r) }()
+ }
var err error
var p uintptr
var i int
@@ -76,6 +83,9 @@ func Xfcntl64(t *TLS, fd, cmd int32, args uintptr) (r int32) {
// int lstat(const char *pathname, struct stat *statbuf);
func Xlstat64(t *TLS, pathname, statbuf uintptr) int32 {
+ if __ccgo_strace {
+ trc("t=%v statbuf=%v, (%v:)", t, statbuf, origin(2))
+ }
if err := unix.Lstat(GoString(pathname), (*unix.Stat_t)(unsafe.Pointer(statbuf))); err != nil {
if dmesgs {
dmesg("%v: %q: %v FAIL", origin(1), GoString(pathname), err)
@@ -92,6 +102,9 @@ func Xlstat64(t *TLS, pathname, statbuf uintptr) int32 {
// int stat(const char *pathname, struct stat *statbuf);
func Xstat64(t *TLS, pathname, statbuf uintptr) int32 {
+ if __ccgo_strace {
+ trc("t=%v statbuf=%v, (%v:)", t, statbuf, origin(2))
+ }
if err := unix.Stat(GoString(pathname), (*unix.Stat_t)(unsafe.Pointer(statbuf))); err != nil {
if dmesgs {
dmesg("%v: %q: %v FAIL", origin(1), GoString(pathname), err)
@@ -108,6 +121,9 @@ func Xstat64(t *TLS, pathname, statbuf uintptr) int32 {
// int fstatfs(int fd, struct statfs *buf);
func Xfstatfs(t *TLS, fd int32, buf uintptr) int32 {
+ if __ccgo_strace {
+ trc("t=%v fd=%v buf=%v, (%v:)", t, fd, buf, origin(2))
+ }
if err := unix.Fstatfs(int(fd), (*unix.Statfs_t)(unsafe.Pointer(buf))); err != nil {
if dmesgs {
dmesg("%v: %v: %v FAIL", origin(1), fd, err)
@@ -124,6 +140,9 @@ func Xfstatfs(t *TLS, fd int32, buf uintptr) int32 {
// int statfs(const char *path, struct statfs *buf);
func Xstatfs(t *TLS, path uintptr, buf uintptr) int32 {
+ if __ccgo_strace {
+ trc("t=%v path=%v buf=%v, (%v:)", t, path, buf, origin(2))
+ }
if err := unix.Statfs(GoString(path), (*unix.Statfs_t)(unsafe.Pointer(buf))); err != nil {
if dmesgs {
dmesg("%v: %q: %v FAIL", origin(1), GoString(path), err)
@@ -140,6 +159,9 @@ func Xstatfs(t *TLS, path uintptr, buf uintptr) int32 {
// int fstat(int fd, struct stat *statbuf);
func Xfstat64(t *TLS, fd int32, statbuf uintptr) int32 {
+ if __ccgo_strace {
+ trc("t=%v fd=%v statbuf=%v, (%v:)", t, fd, statbuf, origin(2))
+ }
if err := unix.Fstat(int(fd), (*unix.Stat_t)(unsafe.Pointer(statbuf))); err != nil {
if dmesgs {
dmesg("%v: fd %d: %v FAIL", origin(1), fd, err)
@@ -156,6 +178,9 @@ func Xfstat64(t *TLS, fd int32, statbuf uintptr) int32 {
// off64_t lseek64(int fd, off64_t offset, int whence);
func Xlseek64(t *TLS, fd int32, offset types.Off_t, whence int32) types.Off_t {
+ if __ccgo_strace {
+ trc("t=%v fd=%v offset=%v whence=%v, (%v:)", t, fd, offset, whence, origin(2))
+ }
n, err := unix.Seek(int(fd), int64(offset), int(whence))
if err != nil {
if dmesgs {
@@ -173,6 +198,9 @@ func Xlseek64(t *TLS, fd int32, offset types.Off_t, whence int32) types.Off_t {
// int utime(const char *filename, const struct utimbuf *times);
func Xutime(t *TLS, filename, times uintptr) int32 {
+ if __ccgo_strace {
+ trc("t=%v times=%v, (%v:)", t, times, origin(2))
+ }
var a []unix.Timeval
if times != 0 {
a = make([]unix.Timeval, 2)
@@ -195,6 +223,9 @@ func Xutime(t *TLS, filename, times uintptr) int32 {
// unsigned int alarm(unsigned int seconds);
func Xalarm(t *TLS, seconds uint32) uint32 {
+ if __ccgo_strace {
+ trc("t=%v seconds=%v, (%v:)", t, seconds, origin(2))
+ }
panic(todo(""))
// n, _, err := unix.Syscall(unix.SYS_ALARM, uintptr(seconds), 0, 0)
// if err != 0 {
@@ -206,6 +237,9 @@ func Xalarm(t *TLS, seconds uint32) uint32 {
// time_t time(time_t *tloc);
func Xtime(t *TLS, tloc uintptr) types.Time_t {
+ if __ccgo_strace {
+ trc("t=%v tloc=%v, (%v:)", t, tloc, origin(2))
+ }
panic(todo(""))
// n := time.Now().UTC().Unix()
// if tloc != 0 {
@@ -226,6 +260,9 @@ func Xtime(t *TLS, tloc uintptr) types.Time_t {
// int mkdir(const char *path, mode_t mode);
func Xmkdir(t *TLS, path uintptr, mode types.Mode_t) int32 {
+ if __ccgo_strace {
+ trc("t=%v path=%v mode=%v, (%v:)", t, path, mode, origin(2))
+ }
if err := unix.Mkdir(GoString(path), uint32(mode)); err != nil {
if dmesgs {
dmesg("%v: %q: %v FAIL", origin(1), GoString(path), err)
@@ -242,6 +279,9 @@ func Xmkdir(t *TLS, path uintptr, mode types.Mode_t) int32 {
// int symlink(const char *target, const char *linkpath);
func Xsymlink(t *TLS, target, linkpath uintptr) int32 {
+ if __ccgo_strace {
+ trc("t=%v linkpath=%v, (%v:)", t, linkpath, origin(2))
+ }
if err := unix.Symlink(GoString(target), GoString(linkpath)); err != nil {
if dmesgs {
dmesg("%v: %v FAIL", origin(1), err)
@@ -258,6 +298,9 @@ func Xsymlink(t *TLS, target, linkpath uintptr) int32 {
// int chmod(const char *pathname, mode_t mode)
func Xchmod(t *TLS, pathname uintptr, mode types.Mode_t) int32 {
+ if __ccgo_strace {
+ trc("t=%v pathname=%v mode=%v, (%v:)", t, pathname, mode, origin(2))
+ }
if err := unix.Chmod(GoString(pathname), uint32(mode)); err != nil {
if dmesgs {
dmesg("%v: %q %#o: %v FAIL", origin(1), GoString(pathname), mode, err)
@@ -274,6 +317,9 @@ func Xchmod(t *TLS, pathname uintptr, mode types.Mode_t) int32 {
// int utimes(const char *filename, const struct timeval times[2]);
func Xutimes(t *TLS, filename, times uintptr) int32 {
+ if __ccgo_strace {
+ trc("t=%v times=%v, (%v:)", t, times, origin(2))
+ }
var a []unix.Timeval
if times != 0 {
a = make([]unix.Timeval, 2)
@@ -296,6 +342,9 @@ func Xutimes(t *TLS, filename, times uintptr) int32 {
// int unlink(const char *pathname);
func Xunlink(t *TLS, pathname uintptr) int32 {
+ if __ccgo_strace {
+ trc("t=%v pathname=%v, (%v:)", t, pathname, origin(2))
+ }
if err := unix.Unlink(GoString(pathname)); err != nil {
if dmesgs {
dmesg("%v: %q: %v", origin(1), GoString(pathname), err)
@@ -312,6 +361,9 @@ func Xunlink(t *TLS, pathname uintptr) int32 {
// int access(const char *pathname, int mode);
func Xaccess(t *TLS, pathname uintptr, mode int32) int32 {
+ if __ccgo_strace {
+ trc("t=%v pathname=%v mode=%v, (%v:)", t, pathname, mode, origin(2))
+ }
if err := unix.Access(GoString(pathname), uint32(mode)); err != nil {
if dmesgs {
dmesg("%v: %q %#o: %v FAIL", origin(1), GoString(pathname), mode, err)
@@ -328,6 +380,9 @@ func Xaccess(t *TLS, pathname uintptr, mode int32) int32 {
// int rename(const char *oldpath, const char *newpath);
func Xrename(t *TLS, oldpath, newpath uintptr) int32 {
+ if __ccgo_strace {
+ trc("t=%v newpath=%v, (%v:)", t, newpath, origin(2))
+ }
if err := unix.Rename(GoString(oldpath), GoString(newpath)); err != nil {
if dmesgs {
dmesg("%v: %v FAIL", origin(1), err)
@@ -344,6 +399,9 @@ func Xrename(t *TLS, oldpath, newpath uintptr) int32 {
// int mknod(const char *pathname, mode_t mode, dev_t dev);
func Xmknod(t *TLS, pathname uintptr, mode types.Mode_t, dev types.Dev_t) int32 {
+ if __ccgo_strace {
+ trc("t=%v pathname=%v mode=%v dev=%v, (%v:)", t, pathname, mode, dev, origin(2))
+ }
panic(todo(""))
// if _, _, err := unix.Syscall(unix.SYS_MKNOD, pathname, uintptr(mode), uintptr(dev)); err != 0 {
// t.setErrno(err)
@@ -355,6 +413,9 @@ func Xmknod(t *TLS, pathname uintptr, mode types.Mode_t, dev types.Dev_t) int32
// int chown(const char *pathname, uid_t owner, gid_t group);
func Xchown(t *TLS, pathname uintptr, owner types.Uid_t, group types.Gid_t) int32 {
+ if __ccgo_strace {
+ trc("t=%v pathname=%v owner=%v group=%v, (%v:)", t, pathname, owner, group, origin(2))
+ }
panic(todo(""))
// if _, _, err := unix.Syscall(unix.SYS_CHOWN, pathname, uintptr(owner), uintptr(group)); err != 0 {
// t.setErrno(err)
@@ -366,6 +427,9 @@ func Xchown(t *TLS, pathname uintptr, owner types.Uid_t, group types.Gid_t) int3
// int link(const char *oldpath, const char *newpath);
func Xlink(t *TLS, oldpath, newpath uintptr) int32 {
+ if __ccgo_strace {
+ trc("t=%v newpath=%v, (%v:)", t, newpath, origin(2))
+ }
panic(todo(""))
// if _, _, err := unix.Syscall(unix.SYS_LINK, oldpath, newpath, 0); err != 0 {
// t.setErrno(err)
@@ -377,6 +441,9 @@ func Xlink(t *TLS, oldpath, newpath uintptr) int32 {
// int dup2(int oldfd, int newfd);
func Xdup2(t *TLS, oldfd, newfd int32) int32 {
+ if __ccgo_strace {
+ trc("t=%v newfd=%v, (%v:)", t, newfd, origin(2))
+ }
n, _, err := unix.Syscall(unix.SYS_DUP2, uintptr(oldfd), uintptr(newfd), 0)
if err != 0 {
t.setErrno(err)
@@ -388,6 +455,9 @@ func Xdup2(t *TLS, oldfd, newfd int32) int32 {
// ssize_t readlink(const char *restrict path, char *restrict buf, size_t bufsize);
func Xreadlink(t *TLS, path, buf uintptr, bufsize types.Size_t) types.Ssize_t {
+ if __ccgo_strace {
+ trc("t=%v buf=%v bufsize=%v, (%v:)", t, buf, bufsize, origin(2))
+ }
var n int
var err error
switch {
@@ -412,6 +482,9 @@ func Xreadlink(t *TLS, path, buf uintptr, bufsize types.Size_t) types.Ssize_t {
// FILE *fopen64(const char *pathname, const char *mode);
func Xfopen64(t *TLS, pathname, mode uintptr) uintptr {
+ if __ccgo_strace {
+ trc("t=%v mode=%v, (%v:)", t, mode, origin(2))
+ }
m := strings.ReplaceAll(GoString(mode), "b", "")
var flags int
switch m {
diff --git a/vendor/modernc.org/libc/libc_darwin_arm64.go b/vendor/modernc.org/libc/libc_darwin_arm64.go
index 3864d311..b156eae1 100644
--- a/vendor/modernc.org/libc/libc_darwin_arm64.go
+++ b/vendor/modernc.org/libc/libc_darwin_arm64.go
@@ -18,6 +18,9 @@ import (
// int sigaction(int signum, const struct sigaction *act, struct sigaction *oldact);
func Xsigaction(t *TLS, signum int32, act, oldact uintptr) int32 {
+ if __ccgo_strace {
+ trc("t=%v signum=%v oldact=%v, (%v:)", t, signum, oldact, origin(2))
+ }
var kact, koldact uintptr
if act != 0 {
sz := int(unsafe.Sizeof(signal.X__sigaction{}))
@@ -45,6 +48,10 @@ func Xsigaction(t *TLS, signum int32, act, oldact uintptr) int32 {
// int fcntl(int fd, int cmd, ... /* arg */ );
func Xfcntl64(t *TLS, fd, cmd int32, args uintptr) (r int32) {
+ if __ccgo_strace {
+ trc("t=%v cmd=%v args=%v, (%v:)", t, cmd, args, origin(2))
+ defer func() { trc("-> %v", r) }()
+ }
var err error
var p uintptr
var i int
@@ -77,6 +84,9 @@ func Xfcntl64(t *TLS, fd, cmd int32, args uintptr) (r int32) {
// int lstat(const char *pathname, struct stat *statbuf);
func Xlstat64(t *TLS, pathname, statbuf uintptr) int32 {
+ if __ccgo_strace {
+ trc("t=%v statbuf=%v, (%v:)", t, statbuf, origin(2))
+ }
if err := unix.Lstat(GoString(pathname), (*unix.Stat_t)(unsafe.Pointer(statbuf))); err != nil {
if dmesgs {
dmesg("%v: %q: %v FAIL", origin(1), GoString(pathname), err)
@@ -93,6 +103,9 @@ func Xlstat64(t *TLS, pathname, statbuf uintptr) int32 {
// int stat(const char *pathname, struct stat *statbuf);
func Xstat64(t *TLS, pathname, statbuf uintptr) int32 {
+ if __ccgo_strace {
+ trc("t=%v statbuf=%v, (%v:)", t, statbuf, origin(2))
+ }
if err := unix.Stat(GoString(pathname), (*unix.Stat_t)(unsafe.Pointer(statbuf))); err != nil {
if dmesgs {
dmesg("%v: %q: %v FAIL", origin(1), GoString(pathname), err)
@@ -109,6 +122,9 @@ func Xstat64(t *TLS, pathname, statbuf uintptr) int32 {
// int fstatfs(int fd, struct statfs *buf);
func Xfstatfs(t *TLS, fd int32, buf uintptr) int32 {
+ if __ccgo_strace {
+ trc("t=%v fd=%v buf=%v, (%v:)", t, fd, buf, origin(2))
+ }
if err := unix.Fstatfs(int(fd), (*unix.Statfs_t)(unsafe.Pointer(buf))); err != nil {
if dmesgs {
dmesg("%v: %v: %v FAIL", origin(1), fd, err)
@@ -125,6 +141,9 @@ func Xfstatfs(t *TLS, fd int32, buf uintptr) int32 {
// int statfs(const char *path, struct statfs *buf);
func Xstatfs(t *TLS, path uintptr, buf uintptr) int32 {
+ if __ccgo_strace {
+ trc("t=%v path=%v buf=%v, (%v:)", t, path, buf, origin(2))
+ }
if err := unix.Statfs(GoString(path), (*unix.Statfs_t)(unsafe.Pointer(buf))); err != nil {
if dmesgs {
dmesg("%v: %q: %v FAIL", origin(1), GoString(path), err)
@@ -141,6 +160,9 @@ func Xstatfs(t *TLS, path uintptr, buf uintptr) int32 {
// int fstat(int fd, struct stat *statbuf);
func Xfstat64(t *TLS, fd int32, statbuf uintptr) int32 {
+ if __ccgo_strace {
+ trc("t=%v fd=%v statbuf=%v, (%v:)", t, fd, statbuf, origin(2))
+ }
if err := unix.Fstat(int(fd), (*unix.Stat_t)(unsafe.Pointer(statbuf))); err != nil {
if dmesgs {
dmesg("%v: fd %d: %v FAIL", origin(1), fd, err)
@@ -157,6 +179,9 @@ func Xfstat64(t *TLS, fd int32, statbuf uintptr) int32 {
// off64_t lseek64(int fd, off64_t offset, int whence);
func Xlseek64(t *TLS, fd int32, offset types.Off_t, whence int32) types.Off_t {
+ if __ccgo_strace {
+ trc("t=%v fd=%v offset=%v whence=%v, (%v:)", t, fd, offset, whence, origin(2))
+ }
n, err := unix.Seek(int(fd), int64(offset), int(whence))
if err != nil {
if dmesgs {
@@ -174,6 +199,9 @@ func Xlseek64(t *TLS, fd int32, offset types.Off_t, whence int32) types.Off_t {
// int utime(const char *filename, const struct utimbuf *times);
func Xutime(t *TLS, filename, times uintptr) int32 {
+ if __ccgo_strace {
+ trc("t=%v times=%v, (%v:)", t, times, origin(2))
+ }
var a []unix.Timeval
if times != 0 {
a = make([]unix.Timeval, 2)
@@ -196,6 +224,9 @@ func Xutime(t *TLS, filename, times uintptr) int32 {
// unsigned int alarm(unsigned int seconds);
func Xalarm(t *TLS, seconds uint32) uint32 {
+ if __ccgo_strace {
+ trc("t=%v seconds=%v, (%v:)", t, seconds, origin(2))
+ }
panic(todo(""))
// n, _, err := unix.Syscall(unix.SYS_ALARM, uintptr(seconds), 0, 0)
// if err != 0 {
@@ -207,6 +238,9 @@ func Xalarm(t *TLS, seconds uint32) uint32 {
// time_t time(time_t *tloc);
func Xtime(t *TLS, tloc uintptr) types.Time_t {
+ if __ccgo_strace {
+ trc("t=%v tloc=%v, (%v:)", t, tloc, origin(2))
+ }
n := time.Now().UTC().Unix()
if tloc != 0 {
*(*types.Time_t)(unsafe.Pointer(tloc)) = types.Time_t(n)
@@ -226,6 +260,9 @@ func Xtime(t *TLS, tloc uintptr) types.Time_t {
// int mkdir(const char *path, mode_t mode);
func Xmkdir(t *TLS, path uintptr, mode types.Mode_t) int32 {
+ if __ccgo_strace {
+ trc("t=%v path=%v mode=%v, (%v:)", t, path, mode, origin(2))
+ }
if err := unix.Mkdir(GoString(path), uint32(mode)); err != nil {
if dmesgs {
dmesg("%v: %q: %v FAIL", origin(1), GoString(path), err)
@@ -242,6 +279,9 @@ func Xmkdir(t *TLS, path uintptr, mode types.Mode_t) int32 {
// int symlink(const char *target, const char *linkpath);
func Xsymlink(t *TLS, target, linkpath uintptr) int32 {
+ if __ccgo_strace {
+ trc("t=%v linkpath=%v, (%v:)", t, linkpath, origin(2))
+ }
if err := unix.Symlink(GoString(target), GoString(linkpath)); err != nil {
if dmesgs {
dmesg("%v: %v FAIL", origin(1), err)
@@ -258,6 +298,9 @@ func Xsymlink(t *TLS, target, linkpath uintptr) int32 {
// int chmod(const char *pathname, mode_t mode)
func Xchmod(t *TLS, pathname uintptr, mode types.Mode_t) int32 {
+ if __ccgo_strace {
+ trc("t=%v pathname=%v mode=%v, (%v:)", t, pathname, mode, origin(2))
+ }
if err := unix.Chmod(GoString(pathname), uint32(mode)); err != nil {
if dmesgs {
dmesg("%v: %q %#o: %v FAIL", origin(1), GoString(pathname), mode, err)
@@ -274,6 +317,9 @@ func Xchmod(t *TLS, pathname uintptr, mode types.Mode_t) int32 {
// int utimes(const char *filename, const struct timeval times[2]);
func Xutimes(t *TLS, filename, times uintptr) int32 {
+ if __ccgo_strace {
+ trc("t=%v times=%v, (%v:)", t, times, origin(2))
+ }
var a []unix.Timeval
if times != 0 {
a = make([]unix.Timeval, 2)
@@ -296,6 +342,9 @@ func Xutimes(t *TLS, filename, times uintptr) int32 {
// int unlink(const char *pathname);
func Xunlink(t *TLS, pathname uintptr) int32 {
+ if __ccgo_strace {
+ trc("t=%v pathname=%v, (%v:)", t, pathname, origin(2))
+ }
if err := unix.Unlink(GoString(pathname)); err != nil {
if dmesgs {
dmesg("%v: %q: %v", origin(1), GoString(pathname), err)
@@ -312,6 +361,9 @@ func Xunlink(t *TLS, pathname uintptr) int32 {
// int access(const char *pathname, int mode);
func Xaccess(t *TLS, pathname uintptr, mode int32) int32 {
+ if __ccgo_strace {
+ trc("t=%v pathname=%v mode=%v, (%v:)", t, pathname, mode, origin(2))
+ }
if err := unix.Access(GoString(pathname), uint32(mode)); err != nil {
if dmesgs {
dmesg("%v: %q %#o: %v FAIL", origin(1), GoString(pathname), mode, err)
@@ -328,6 +380,9 @@ func Xaccess(t *TLS, pathname uintptr, mode int32) int32 {
// int rename(const char *oldpath, const char *newpath);
func Xrename(t *TLS, oldpath, newpath uintptr) int32 {
+ if __ccgo_strace {
+ trc("t=%v newpath=%v, (%v:)", t, newpath, origin(2))
+ }
if err := unix.Rename(GoString(oldpath), GoString(newpath)); err != nil {
if dmesgs {
dmesg("%v: %v FAIL", origin(1), err)
@@ -344,6 +399,9 @@ func Xrename(t *TLS, oldpath, newpath uintptr) int32 {
// int mknod(const char *pathname, mode_t mode, dev_t dev);
func Xmknod(t *TLS, pathname uintptr, mode types.Mode_t, dev types.Dev_t) int32 {
+ if __ccgo_strace {
+ trc("t=%v pathname=%v mode=%v dev=%v, (%v:)", t, pathname, mode, dev, origin(2))
+ }
panic(todo(""))
// if _, _, err := unix.Syscall(unix.SYS_MKNOD, pathname, uintptr(mode), uintptr(dev)); err != 0 {
// t.setErrno(err)
@@ -355,6 +413,9 @@ func Xmknod(t *TLS, pathname uintptr, mode types.Mode_t, dev types.Dev_t) int32
// int chown(const char *pathname, uid_t owner, gid_t group);
func Xchown(t *TLS, pathname uintptr, owner types.Uid_t, group types.Gid_t) int32 {
+ if __ccgo_strace {
+ trc("t=%v pathname=%v owner=%v group=%v, (%v:)", t, pathname, owner, group, origin(2))
+ }
panic(todo(""))
// if _, _, err := unix.Syscall(unix.SYS_CHOWN, pathname, uintptr(owner), uintptr(group)); err != 0 {
// t.setErrno(err)
@@ -366,6 +427,9 @@ func Xchown(t *TLS, pathname uintptr, owner types.Uid_t, group types.Gid_t) int3
// int link(const char *oldpath, const char *newpath);
func Xlink(t *TLS, oldpath, newpath uintptr) int32 {
+ if __ccgo_strace {
+ trc("t=%v newpath=%v, (%v:)", t, newpath, origin(2))
+ }
if _, _, err := unix.Syscall(unix.SYS_LINK, oldpath, newpath, 0); err != 0 {
t.setErrno(err)
return -1
@@ -376,6 +440,9 @@ func Xlink(t *TLS, oldpath, newpath uintptr) int32 {
// int dup2(int oldfd, int newfd);
func Xdup2(t *TLS, oldfd, newfd int32) int32 {
+ if __ccgo_strace {
+ trc("t=%v newfd=%v, (%v:)", t, newfd, origin(2))
+ }
panic(todo(""))
// n, _, err := unix.Syscall(unix.SYS_DUP2, uintptr(oldfd), uintptr(newfd), 0)
// if err != 0 {
@@ -388,6 +455,9 @@ func Xdup2(t *TLS, oldfd, newfd int32) int32 {
// ssize_t readlink(const char *restrict path, char *restrict buf, size_t bufsize);
func Xreadlink(t *TLS, path, buf uintptr, bufsize types.Size_t) types.Ssize_t {
+ if __ccgo_strace {
+ trc("t=%v buf=%v bufsize=%v, (%v:)", t, buf, bufsize, origin(2))
+ }
var n int
var err error
switch {
@@ -412,6 +482,9 @@ func Xreadlink(t *TLS, path, buf uintptr, bufsize types.Size_t) types.Ssize_t {
// FILE *fopen64(const char *pathname, const char *mode);
func Xfopen64(t *TLS, pathname, mode uintptr) uintptr {
+ if __ccgo_strace {
+ trc("t=%v mode=%v, (%v:)", t, mode, origin(2))
+ }
m := strings.ReplaceAll(GoString(mode), "b", "")
var flags int
switch m {
diff --git a/vendor/modernc.org/libc/libc_freebsd.go b/vendor/modernc.org/libc/libc_freebsd.go
index 96282190..825195e5 100644
--- a/vendor/modernc.org/libc/libc_freebsd.go
+++ b/vendor/modernc.org/libc/libc_freebsd.go
@@ -60,6 +60,9 @@ var X_ThreadRuneLocale uintptr //TODO initialize and implement _Thread_local sem
// include/xlocale/_ctype.h:54:_RuneLocale *__runes_for_locale(locale_t, int*);
func X__runes_for_locale(t *TLS, l locale_t, p uintptr) uintptr {
+ if __ccgo_strace {
+ trc("t=%v l=%v p=%v, (%v:)", t, l, p, origin(2))
+ }
panic(todo(""))
}
@@ -108,23 +111,35 @@ func fwrite(fd int32, b []byte) (int, error) {
// unsigned long ___runetype(__ct_rune_t) __pure;
func X___runetype(t *TLS, x types.X__ct_rune_t) ulong {
+ if __ccgo_strace {
+ trc("t=%v x=%v, (%v:)", t, x, origin(2))
+ }
panic(todo(""))
}
// int fprintf(FILE *stream, const char *format, ...);
func Xfprintf(t *TLS, stream, format, args uintptr) int32 {
+ if __ccgo_strace {
+ trc("t=%v args=%v, (%v:)", t, args, origin(2))
+ }
n, _ := fwrite(int32((*stdio.FILE)(unsafe.Pointer(stream)).F_file), printf(format, args))
return int32(n)
}
// int usleep(useconds_t usec);
func Xusleep(t *TLS, usec types.X__useconds_t) int32 {
+ if __ccgo_strace {
+ trc("t=%v usec=%v, (%v:)", t, usec, origin(2))
+ }
gotime.Sleep(gotime.Microsecond * gotime.Duration(usec))
return 0
}
// int getrusage(int who, struct rusage *usage);
func Xgetrusage(t *TLS, who int32, usage uintptr) int32 {
+ if __ccgo_strace {
+ trc("t=%v who=%v usage=%v, (%v:)", t, who, usage, origin(2))
+ }
if _, _, err := unix.Syscall(unix.SYS_GETRUSAGE, uintptr(who), usage, 0); err != 0 {
t.setErrno(err)
return -1
@@ -135,6 +150,9 @@ func Xgetrusage(t *TLS, who int32, usage uintptr) int32 {
// int fgetc(FILE *stream);
func Xfgetc(t *TLS, stream uintptr) int32 {
+ if __ccgo_strace {
+ trc("t=%v stream=%v, (%v:)", t, stream, origin(2))
+ }
fd := int((*stdio.FILE)(unsafe.Pointer(stream)).F_file)
var buf [1]byte
if n, _ := unix.Read(fd, buf[:]); n != 0 {
@@ -146,16 +164,25 @@ func Xfgetc(t *TLS, stream uintptr) int32 {
// int lstat(const char *pathname, struct stat *statbuf);
func Xlstat(t *TLS, pathname, statbuf uintptr) int32 {
+ if __ccgo_strace {
+ trc("t=%v statbuf=%v, (%v:)", t, statbuf, origin(2))
+ }
return Xlstat64(t, pathname, statbuf)
}
// int stat(const char *pathname, struct stat *statbuf);
func Xstat(t *TLS, pathname, statbuf uintptr) int32 {
+ if __ccgo_strace {
+ trc("t=%v statbuf=%v, (%v:)", t, statbuf, origin(2))
+ }
return Xstat64(t, pathname, statbuf)
}
// int chdir(const char *path);
func Xchdir(t *TLS, path uintptr) int32 {
+ if __ccgo_strace {
+ trc("t=%v path=%v, (%v:)", t, path, origin(2))
+ }
if _, _, err := unix.Syscall(unix.SYS_CHDIR, path, 0, 0); err != 0 {
t.setErrno(err)
return -1
@@ -205,11 +232,17 @@ func Xlocaltime_r(_ *TLS, timep, result uintptr) uintptr {
// int open(const char *pathname, int flags, ...);
func Xopen(t *TLS, pathname uintptr, flags int32, args uintptr) int32 {
+ if __ccgo_strace {
+ trc("t=%v pathname=%v flags=%v args=%v, (%v:)", t, pathname, flags, args, origin(2))
+ }
return Xopen64(t, pathname, flags, args)
}
// int open(const char *pathname, int flags, ...);
func Xopen64(t *TLS, pathname uintptr, flags int32, args uintptr) int32 {
+ if __ccgo_strace {
+ trc("t=%v pathname=%v flags=%v args=%v, (%v:)", t, pathname, flags, args, origin(2))
+ }
var mode types.Mode_t
if args != 0 {
mode = (types.Mode_t)(VaUint32(&args))
@@ -232,6 +265,9 @@ func Xopen64(t *TLS, pathname uintptr, flags int32, args uintptr) int32 {
// off_t lseek(int fd, off_t offset, int whence);
func Xlseek(t *TLS, fd int32, offset types.Off_t, whence int32) types.Off_t {
+ if __ccgo_strace {
+ trc("t=%v fd=%v offset=%v whence=%v, (%v:)", t, fd, offset, whence, origin(2))
+ }
return types.Off_t(Xlseek64(t, fd, offset, whence))
}
@@ -243,6 +279,9 @@ var fsyncStatbuf stat.Stat
// int fsync(int fd);
func Xfsync(t *TLS, fd int32) int32 {
+ if __ccgo_strace {
+ trc("t=%v fd=%v, (%v:)", t, fd, origin(2))
+ }
if noFsync {
// Simulate -DSQLITE_NO_SYNC for sqlite3 testfixture, see function full_sync in sqlite3.c
return Xfstat(t, fd, uintptr(unsafe.Pointer(&fsyncStatbuf)))
@@ -261,6 +300,9 @@ func Xfsync(t *TLS, fd int32) int32 {
// long sysconf(int name);
func Xsysconf(t *TLS, name int32) long {
+ if __ccgo_strace {
+ trc("t=%v name=%v, (%v:)", t, name, origin(2))
+ }
switch name {
case unistd.X_SC_PAGESIZE:
return long(unix.Getpagesize())
@@ -277,6 +319,9 @@ func Xsysconf(t *TLS, name int32) long {
// int close(int fd);
func Xclose(t *TLS, fd int32) int32 {
+ if __ccgo_strace {
+ trc("t=%v fd=%v, (%v:)", t, fd, origin(2))
+ }
if _, _, err := unix.Syscall(unix.SYS_CLOSE, uintptr(fd), 0, 0); err != 0 {
t.setErrno(err)
return -1
@@ -290,6 +335,9 @@ func Xclose(t *TLS, fd int32) int32 {
// char *getcwd(char *buf, size_t size);
func Xgetcwd(t *TLS, buf uintptr, size types.Size_t) uintptr {
+ if __ccgo_strace {
+ trc("t=%v buf=%v size=%v, (%v:)", t, buf, size, origin(2))
+ }
if _, err := unix.Getcwd((*RawMem)(unsafe.Pointer(buf))[:size:size]); err != nil {
if dmesgs {
dmesg("%v: %v FAIL", origin(1), err)
@@ -306,11 +354,17 @@ func Xgetcwd(t *TLS, buf uintptr, size types.Size_t) uintptr {
// int fstat(int fd, struct stat *statbuf);
func Xfstat(t *TLS, fd int32, statbuf uintptr) int32 {
+ if __ccgo_strace {
+ trc("t=%v fd=%v statbuf=%v, (%v:)", t, fd, statbuf, origin(2))
+ }
return Xfstat64(t, fd, statbuf)
}
// int ftruncate(int fd, off_t length);
func Xftruncate(t *TLS, fd int32, length types.Off_t) int32 {
+ if __ccgo_strace {
+ trc("t=%v fd=%v length=%v, (%v:)", t, fd, length, origin(2))
+ }
if err := unix.Ftruncate(int(fd), int64(length)); err != nil {
if dmesgs {
dmesg("%v: fd %d: %v FAIL", origin(1), fd, err)
@@ -327,11 +381,17 @@ func Xftruncate(t *TLS, fd int32, length types.Off_t) int32 {
// int fcntl(int fd, int cmd, ... /* arg */ );
func Xfcntl(t *TLS, fd, cmd int32, args uintptr) int32 {
+ if __ccgo_strace {
+ trc("t=%v cmd=%v args=%v, (%v:)", t, cmd, args, origin(2))
+ }
return Xfcntl64(t, fd, cmd, args)
}
// ssize_t read(int fd, void *buf, size_t count);
func Xread(t *TLS, fd int32, buf uintptr, count types.Size_t) types.Ssize_t {
+ if __ccgo_strace {
+ trc("t=%v fd=%v buf=%v count=%v, (%v:)", t, fd, buf, count, origin(2))
+ }
n, _, err := unix.Syscall(unix.SYS_READ, uintptr(fd), buf, uintptr(count))
if err != 0 {
t.setErrno(err)
@@ -347,6 +407,9 @@ func Xread(t *TLS, fd int32, buf uintptr, count types.Size_t) types.Ssize_t {
// ssize_t write(int fd, const void *buf, size_t count);
func Xwrite(t *TLS, fd int32, buf uintptr, count types.Size_t) types.Ssize_t {
+ if __ccgo_strace {
+ trc("t=%v fd=%v buf=%v count=%v, (%v:)", t, fd, buf, count, origin(2))
+ }
const retry = 5
var err syscall.Errno
for i := 0; i < retry; i++ {
@@ -372,6 +435,9 @@ func Xwrite(t *TLS, fd int32, buf uintptr, count types.Size_t) types.Ssize_t {
// int fchmod(int fd, mode_t mode);
func Xfchmod(t *TLS, fd int32, mode types.Mode_t) int32 {
+ if __ccgo_strace {
+ trc("t=%v fd=%v mode=%v, (%v:)", t, fd, mode, origin(2))
+ }
if _, _, err := unix.Syscall(unix.SYS_FCHMOD, uintptr(fd), uintptr(mode), 0); err != 0 {
t.setErrno(err)
return -1
@@ -385,6 +451,9 @@ func Xfchmod(t *TLS, fd int32, mode types.Mode_t) int32 {
// int fchown(int fd, uid_t owner, gid_t group);
func Xfchown(t *TLS, fd int32, owner types.Uid_t, group types.Gid_t) int32 {
+ if __ccgo_strace {
+ trc("t=%v fd=%v owner=%v group=%v, (%v:)", t, fd, owner, group, origin(2))
+ }
if _, _, err := unix.Syscall(unix.SYS_FCHOWN, uintptr(fd), uintptr(owner), uintptr(group)); err != 0 {
t.setErrno(err)
return -1
@@ -395,12 +464,18 @@ func Xfchown(t *TLS, fd int32, owner types.Uid_t, group types.Gid_t) int32 {
// uid_t geteuid(void);
func Xgeteuid(t *TLS) types.Uid_t {
+ if __ccgo_strace {
+ trc("t=%v, (%v:)", t, origin(2))
+ }
n, _, _ := unix.Syscall(unix.SYS_GETEUID, 0, 0, 0)
return types.Uid_t(n)
}
// int munmap(void *addr, size_t length);
func Xmunmap(t *TLS, addr uintptr, length types.Size_t) int32 {
+ if __ccgo_strace {
+ trc("t=%v addr=%v length=%v, (%v:)", t, addr, length, origin(2))
+ }
if _, _, err := unix.Syscall(unix.SYS_MUNMAP, addr, uintptr(length), 0); err != 0 {
t.setErrno(err)
return -1
@@ -411,6 +486,9 @@ func Xmunmap(t *TLS, addr uintptr, length types.Size_t) int32 {
// int gettimeofday(struct timeval *tv, struct timezone *tz);
func Xgettimeofday(t *TLS, tv, tz uintptr) int32 {
+ if __ccgo_strace {
+ trc("t=%v tz=%v, (%v:)", t, tz, origin(2))
+ }
if tz != 0 {
panic(todo(""))
}
@@ -428,6 +506,9 @@ func Xgettimeofday(t *TLS, tv, tz uintptr) int32 {
// int getsockopt(int sockfd, int level, int optname, void *optval, socklen_t *optlen);
func Xgetsockopt(t *TLS, sockfd, level, optname int32, optval, optlen uintptr) int32 {
+ if __ccgo_strace {
+ trc("t=%v optname=%v optlen=%v, (%v:)", t, optname, optlen, origin(2))
+ }
if _, _, err := unix.Syscall6(unix.SYS_GETSOCKOPT, uintptr(sockfd), uintptr(level), uintptr(optname), optval, optlen, 0); err != 0 {
t.setErrno(err)
return -1
@@ -438,6 +519,9 @@ func Xgetsockopt(t *TLS, sockfd, level, optname int32, optval, optlen uintptr) i
// int setsockopt(int sockfd, int level, int optname, const void *optval, socklen_t optlen);
func Xsetsockopt(t *TLS, sockfd, level, optname int32, optval uintptr, optlen socket.Socklen_t) int32 {
+ if __ccgo_strace {
+ trc("t=%v optname=%v optval=%v optlen=%v, (%v:)", t, optname, optval, optlen, origin(2))
+ }
if _, _, err := unix.Syscall6(unix.SYS_SETSOCKOPT, uintptr(sockfd), uintptr(level), uintptr(optname), optval, uintptr(optlen), 0); err != 0 {
t.setErrno(err)
return -1
@@ -448,6 +532,9 @@ func Xsetsockopt(t *TLS, sockfd, level, optname int32, optval uintptr, optlen so
// int ioctl(int fd, unsigned long request, ...);
func Xioctl(t *TLS, fd int32, request ulong, va uintptr) int32 {
+ if __ccgo_strace {
+ trc("t=%v fd=%v request=%v va=%v, (%v:)", t, fd, request, va, origin(2))
+ }
var argp uintptr
if va != 0 {
argp = VaUintptr(&va)
@@ -463,6 +550,9 @@ func Xioctl(t *TLS, fd int32, request ulong, va uintptr) int32 {
// int getsockname(int sockfd, struct sockaddr *addr, socklen_t *addrlen);
func Xgetsockname(t *TLS, sockfd int32, addr, addrlen uintptr) int32 {
+ if __ccgo_strace {
+ trc("t=%v sockfd=%v addrlen=%v, (%v:)", t, sockfd, addrlen, origin(2))
+ }
if _, _, err := unix.Syscall(unix.SYS_GETSOCKNAME, uintptr(sockfd), addr, addrlen); err != 0 {
// if dmesgs {
// dmesg("%v: fd %v: %v", origin(1), sockfd, err)
@@ -476,6 +566,9 @@ func Xgetsockname(t *TLS, sockfd int32, addr, addrlen uintptr) int32 {
// int select(int nfds, fd_set *readfds, fd_set *writefds, fd_set *exceptfds, struct timeval *timeout);
func Xselect(t *TLS, nfds int32, readfds, writefds, exceptfds, timeout uintptr) int32 {
+ if __ccgo_strace {
+ trc("t=%v nfds=%v timeout=%v, (%v:)", t, nfds, timeout, origin(2))
+ }
n, err := unix.Select(
int(nfds),
(*unix.FdSet)(unsafe.Pointer(readfds)),
@@ -493,17 +586,26 @@ func Xselect(t *TLS, nfds int32, readfds, writefds, exceptfds, timeout uintptr)
// int mkfifo(const char *pathname, mode_t mode);
func Xmkfifo(t *TLS, pathname uintptr, mode types.Mode_t) int32 {
+ if __ccgo_strace {
+ trc("t=%v pathname=%v mode=%v, (%v:)", t, pathname, mode, origin(2))
+ }
panic(todo(""))
}
// mode_t umask(mode_t mask);
func Xumask(t *TLS, mask types.Mode_t) types.Mode_t {
+ if __ccgo_strace {
+ trc("t=%v mask=%v, (%v:)", t, mask, origin(2))
+ }
n, _, _ := unix.Syscall(unix.SYS_UMASK, uintptr(mask), 0, 0)
return types.Mode_t(n)
}
// int execvp(const char *file, char *const argv[]);
func Xexecvp(t *TLS, file, argv uintptr) int32 {
+ if __ccgo_strace {
+ trc("t=%v argv=%v, (%v:)", t, argv, origin(2))
+ }
if _, _, err := unix.Syscall(unix.SYS_EXECVE, file, argv, Environ()); err != 0 {
t.setErrno(err)
return -1
@@ -514,6 +616,9 @@ func Xexecvp(t *TLS, file, argv uintptr) int32 {
// pid_t waitpid(pid_t pid, int *wstatus, int options);
func Xwaitpid(t *TLS, pid types.Pid_t, wstatus uintptr, optname int32) types.Pid_t {
+ if __ccgo_strace {
+ trc("t=%v pid=%v wstatus=%v optname=%v, (%v:)", t, pid, wstatus, optname, origin(2))
+ }
n, _, err := unix.Syscall6(unix.SYS_WAIT4, uintptr(pid), wstatus, uintptr(optname), 0, 0, 0)
if err != 0 {
t.setErrno(err)
@@ -525,6 +630,9 @@ func Xwaitpid(t *TLS, pid types.Pid_t, wstatus uintptr, optname int32) types.Pid
// int uname(struct utsname *buf);
func Xuname(t *TLS, buf uintptr) int32 {
+ if __ccgo_strace {
+ trc("t=%v buf=%v, (%v:)", t, buf, origin(2))
+ }
if err := unix.Uname((*unix.Utsname)(unsafe.Pointer(buf))); err != nil {
if dmesgs {
dmesg("%v: %v FAIL", origin(1), err)
@@ -541,6 +649,9 @@ func Xuname(t *TLS, buf uintptr) int32 {
// ssize_t recv(int sockfd, void *buf, size_t len, int flags);
func Xrecv(t *TLS, sockfd int32, buf uintptr, len types.Size_t, flags int32) types.Ssize_t {
+ if __ccgo_strace {
+ trc("t=%v sockfd=%v buf=%v len=%v flags=%v, (%v:)", t, sockfd, buf, len, flags, origin(2))
+ }
n, _, err := unix.Syscall6(unix.SYS_RECVFROM, uintptr(sockfd), buf, uintptr(len), uintptr(flags), 0, 0)
if err != 0 {
t.setErrno(err)
@@ -552,6 +663,9 @@ func Xrecv(t *TLS, sockfd int32, buf uintptr, len types.Size_t, flags int32) typ
// ssize_t send(int sockfd, const void *buf, size_t len, int flags);
func Xsend(t *TLS, sockfd int32, buf uintptr, len types.Size_t, flags int32) types.Ssize_t {
+ if __ccgo_strace {
+ trc("t=%v sockfd=%v buf=%v len=%v flags=%v, (%v:)", t, sockfd, buf, len, flags, origin(2))
+ }
n, _, err := unix.Syscall6(unix.SYS_SENDTO, uintptr(sockfd), buf, uintptr(len), uintptr(flags), 0, 0)
if err != 0 {
t.setErrno(err)
@@ -563,6 +677,9 @@ func Xsend(t *TLS, sockfd int32, buf uintptr, len types.Size_t, flags int32) typ
// int shutdown(int sockfd, int how);
func Xshutdown(t *TLS, sockfd, how int32) int32 {
+ if __ccgo_strace {
+ trc("t=%v how=%v, (%v:)", t, how, origin(2))
+ }
if _, _, err := unix.Syscall(unix.SYS_SHUTDOWN, uintptr(sockfd), uintptr(how), 0); err != 0 {
t.setErrno(err)
return -1
@@ -573,6 +690,9 @@ func Xshutdown(t *TLS, sockfd, how int32) int32 {
// int getpeername(int sockfd, struct sockaddr *addr, socklen_t *addrlen);
func Xgetpeername(t *TLS, sockfd int32, addr uintptr, addrlen uintptr) int32 {
+ if __ccgo_strace {
+ trc("t=%v sockfd=%v addr=%v addrlen=%v, (%v:)", t, sockfd, addr, addrlen, origin(2))
+ }
if _, _, err := unix.Syscall(unix.SYS_GETPEERNAME, uintptr(sockfd), addr, uintptr(addrlen)); err != 0 {
t.setErrno(err)
return -1
@@ -583,6 +703,9 @@ func Xgetpeername(t *TLS, sockfd int32, addr uintptr, addrlen uintptr) int32 {
// int socket(int domain, int type, int protocol);
func Xsocket(t *TLS, domain, type1, protocol int32) int32 {
+ if __ccgo_strace {
+ trc("t=%v protocol=%v, (%v:)", t, protocol, origin(2))
+ }
n, _, err := unix.Syscall(unix.SYS_SOCKET, uintptr(domain), uintptr(type1), uintptr(protocol))
if err != 0 {
t.setErrno(err)
@@ -594,6 +717,9 @@ func Xsocket(t *TLS, domain, type1, protocol int32) int32 {
// int bind(int sockfd, const struct sockaddr *addr, socklen_t addrlen);
func Xbind(t *TLS, sockfd int32, addr uintptr, addrlen uint32) int32 {
+ if __ccgo_strace {
+ trc("t=%v sockfd=%v addr=%v addrlen=%v, (%v:)", t, sockfd, addr, addrlen, origin(2))
+ }
n, _, err := unix.Syscall(unix.SYS_BIND, uintptr(sockfd), addr, uintptr(addrlen))
if err != 0 {
t.setErrno(err)
@@ -605,6 +731,9 @@ func Xbind(t *TLS, sockfd int32, addr uintptr, addrlen uint32) int32 {
// int connect(int sockfd, const struct sockaddr *addr, socklen_t addrlen);
func Xconnect(t *TLS, sockfd int32, addr uintptr, addrlen uint32) int32 {
+ if __ccgo_strace {
+ trc("t=%v sockfd=%v addr=%v addrlen=%v, (%v:)", t, sockfd, addr, addrlen, origin(2))
+ }
if _, _, err := unix.Syscall(unix.SYS_CONNECT, uintptr(sockfd), addr, uintptr(addrlen)); err != 0 {
t.setErrno(err)
return -1
@@ -615,6 +744,9 @@ func Xconnect(t *TLS, sockfd int32, addr uintptr, addrlen uint32) int32 {
// int listen(int sockfd, int backlog);
func Xlisten(t *TLS, sockfd, backlog int32) int32 {
+ if __ccgo_strace {
+ trc("t=%v backlog=%v, (%v:)", t, backlog, origin(2))
+ }
if _, _, err := unix.Syscall(unix.SYS_LISTEN, uintptr(sockfd), uintptr(backlog), 0); err != 0 {
t.setErrno(err)
return -1
@@ -625,6 +757,9 @@ func Xlisten(t *TLS, sockfd, backlog int32) int32 {
// int accept(int sockfd, struct sockaddr *addr, socklen_t *addrlen);
func Xaccept(t *TLS, sockfd int32, addr uintptr, addrlen uintptr) int32 {
+ if __ccgo_strace {
+ trc("t=%v sockfd=%v addr=%v addrlen=%v, (%v:)", t, sockfd, addr, addrlen, origin(2))
+ }
n, _, err := unix.Syscall6(unix.SYS_ACCEPT4, uintptr(sockfd), addr, uintptr(addrlen), 0, 0, 0)
if err != 0 {
t.setErrno(err)
@@ -636,16 +771,25 @@ func Xaccept(t *TLS, sockfd int32, addr uintptr, addrlen uintptr) int32 {
// int getrlimit(int resource, struct rlimit *rlim);
func Xgetrlimit(t *TLS, resource int32, rlim uintptr) int32 {
+ if __ccgo_strace {
+ trc("t=%v resource=%v rlim=%v, (%v:)", t, resource, rlim, origin(2))
+ }
return Xgetrlimit64(t, resource, rlim)
}
// int setrlimit(int resource, const struct rlimit *rlim);
func Xsetrlimit(t *TLS, resource int32, rlim uintptr) int32 {
+ if __ccgo_strace {
+ trc("t=%v resource=%v rlim=%v, (%v:)", t, resource, rlim, origin(2))
+ }
return Xsetrlimit64(t, resource, rlim)
}
// int setrlimit(int resource, const struct rlimit *rlim);
func Xsetrlimit64(t *TLS, resource int32, rlim uintptr) int32 {
+ if __ccgo_strace {
+ trc("t=%v resource=%v rlim=%v, (%v:)", t, resource, rlim, origin(2))
+ }
if _, _, err := unix.Syscall(unix.SYS_SETRLIMIT, uintptr(resource), uintptr(rlim), 0); err != 0 {
t.setErrno(err)
return -1
@@ -656,16 +800,25 @@ func Xsetrlimit64(t *TLS, resource int32, rlim uintptr) int32 {
// uid_t getuid(void);
func Xgetuid(t *TLS) types.Uid_t {
+ if __ccgo_strace {
+ trc("t=%v, (%v:)", t, origin(2))
+ }
return types.Uid_t(os.Getuid())
}
// pid_t getpid(void);
func Xgetpid(t *TLS) int32 {
+ if __ccgo_strace {
+ trc("t=%v, (%v:)", t, origin(2))
+ }
return int32(os.Getpid())
}
// int system(const char *command);
func Xsystem(t *TLS, command uintptr) int32 {
+ if __ccgo_strace {
+ trc("t=%v command=%v, (%v:)", t, command, origin(2))
+ }
s := GoString(command)
if command == 0 {
panic(todo(""))
@@ -685,26 +838,41 @@ func Xsystem(t *TLS, command uintptr) int32 {
// int setvbuf(FILE *stream, char *buf, int mode, size_t size);
func Xsetvbuf(t *TLS, stream, buf uintptr, mode int32, size types.Size_t) int32 {
+ if __ccgo_strace {
+ trc("t=%v buf=%v mode=%v size=%v, (%v:)", t, buf, mode, size, origin(2))
+ }
return 0 //TODO
}
// int raise(int sig);
func Xraise(t *TLS, sig int32) int32 {
+ if __ccgo_strace {
+ trc("t=%v sig=%v, (%v:)", t, sig, origin(2))
+ }
panic(todo(""))
}
// int backtrace(void **buffer, int size);
func Xbacktrace(t *TLS, buf uintptr, size int32) int32 {
+ if __ccgo_strace {
+ trc("t=%v buf=%v size=%v, (%v:)", t, buf, size, origin(2))
+ }
panic(todo(""))
}
// void backtrace_symbols_fd(void *const *buffer, int size, int fd);
func Xbacktrace_symbols_fd(t *TLS, buffer uintptr, size, fd int32) {
+ if __ccgo_strace {
+ trc("t=%v buffer=%v fd=%v, (%v:)", t, buffer, fd, origin(2))
+ }
panic(todo(""))
}
// int fileno(FILE *stream);
func Xfileno(t *TLS, stream uintptr) int32 {
+ if __ccgo_strace {
+ trc("t=%v stream=%v, (%v:)", t, stream, origin(2))
+ }
panic(todo(""))
}
@@ -738,11 +906,17 @@ func (f *ftstream) close(t *TLS) {
// FTS *fts_open(char * const *path_argv, int options, int (*compar)(const FTSENT **, const FTSENT **));
func Xfts_open(t *TLS, path_argv uintptr, options int32, compar uintptr) uintptr {
+ if __ccgo_strace {
+ trc("t=%v path_argv=%v options=%v compar=%v, (%v:)", t, path_argv, options, compar, origin(2))
+ }
return Xfts64_open(t, path_argv, options, compar)
}
// FTS *fts_open(char * const *path_argv, int options, int (*compar)(const FTSENT **, const FTSENT **));
func Xfts64_open(t *TLS, path_argv uintptr, options int32, compar uintptr) uintptr {
+ if __ccgo_strace {
+ trc("t=%v path_argv=%v options=%v compar=%v, (%v:)", t, path_argv, options, compar, origin(2))
+ }
f := &ftstream{}
var walk func(string)
@@ -847,11 +1021,17 @@ func Xfts64_open(t *TLS, path_argv uintptr, options int32, compar uintptr) uintp
// FTSENT *fts_read(FTS *ftsp);
func Xfts_read(t *TLS, ftsp uintptr) uintptr {
+ if __ccgo_strace {
+ trc("t=%v ftsp=%v, (%v:)", t, ftsp, origin(2))
+ }
return Xfts64_read(t, ftsp)
}
// FTSENT *fts_read(FTS *ftsp);
func Xfts64_read(t *TLS, ftsp uintptr) uintptr {
+ if __ccgo_strace {
+ trc("t=%v ftsp=%v, (%v:)", t, ftsp, origin(2))
+ }
f := getObject(ftsp).(*ftstream)
if f.x == len(f.s) {
t.setErrno(0)
@@ -868,11 +1048,17 @@ func Xfts64_read(t *TLS, ftsp uintptr) uintptr {
// int fts_close(FTS *ftsp);
func Xfts_close(t *TLS, ftsp uintptr) int32 {
+ if __ccgo_strace {
+ trc("t=%v ftsp=%v, (%v:)", t, ftsp, origin(2))
+ }
return Xfts64_close(t, ftsp)
}
// int fts_close(FTS *ftsp);
func Xfts64_close(t *TLS, ftsp uintptr) int32 {
+ if __ccgo_strace {
+ trc("t=%v ftsp=%v, (%v:)", t, ftsp, origin(2))
+ }
getObject(ftsp).(*ftstream).close(t)
removeObject(ftsp)
return 0
@@ -880,6 +1066,9 @@ func Xfts64_close(t *TLS, ftsp uintptr) int32 {
// void tzset (void);
func Xtzset(t *TLS) {
+ if __ccgo_strace {
+ trc("t=%v, (%v:)", t, origin(2))
+ }
//TODO
}
@@ -887,6 +1076,9 @@ var strerrorBuf [100]byte
// char *strerror(int errnum);
func Xstrerror(t *TLS, errnum int32) uintptr {
+ if __ccgo_strace {
+ trc("t=%v errnum=%v, (%v:)", t, errnum, origin(2))
+ }
if dmesgs {
dmesg("%v: %v\n%s", origin(1), errnum, debug.Stack())
}
@@ -896,31 +1088,49 @@ func Xstrerror(t *TLS, errnum int32) uintptr {
// void *dlopen(const char *filename, int flags);
func Xdlopen(t *TLS, filename uintptr, flags int32) uintptr {
+ if __ccgo_strace {
+ trc("t=%v filename=%v flags=%v, (%v:)", t, filename, flags, origin(2))
+ }
panic(todo(""))
}
// char *dlerror(void);
func Xdlerror(t *TLS) uintptr {
+ if __ccgo_strace {
+ trc("t=%v, (%v:)", t, origin(2))
+ }
panic(todo(""))
}
// int dlclose(void *handle);
func Xdlclose(t *TLS, handle uintptr) int32 {
+ if __ccgo_strace {
+ trc("t=%v handle=%v, (%v:)", t, handle, origin(2))
+ }
panic(todo(""))
}
// void *dlsym(void *handle, const char *symbol);
func Xdlsym(t *TLS, handle, symbol uintptr) uintptr {
+ if __ccgo_strace {
+ trc("t=%v symbol=%v, (%v:)", t, symbol, origin(2))
+ }
panic(todo(""))
}
// void perror(const char *s);
func Xperror(t *TLS, s uintptr) {
+ if __ccgo_strace {
+ trc("t=%v s=%v, (%v:)", t, s, origin(2))
+ }
panic(todo(""))
}
// int pclose(FILE *stream);
func Xpclose(t *TLS, stream uintptr) int32 {
+ if __ccgo_strace {
+ trc("t=%v stream=%v, (%v:)", t, stream, origin(2))
+ }
panic(todo(""))
}
@@ -928,37 +1138,58 @@ var gai_strerrorBuf [100]byte
// const char *gai_strerror(int errcode);
func Xgai_strerror(t *TLS, errcode int32) uintptr {
+ if __ccgo_strace {
+ trc("t=%v errcode=%v, (%v:)", t, errcode, origin(2))
+ }
copy(gai_strerrorBuf[:], fmt.Sprintf("gai error %d\x00", errcode))
return uintptr(unsafe.Pointer(&gai_strerrorBuf))
}
// int tcgetattr(int fd, struct termios *termios_p);
func Xtcgetattr(t *TLS, fd int32, termios_p uintptr) int32 {
+ if __ccgo_strace {
+ trc("t=%v fd=%v termios_p=%v, (%v:)", t, fd, termios_p, origin(2))
+ }
panic(todo(""))
}
// int tcsetattr(int fd, int optional_actions, const struct termios *termios_p);
func Xtcsetattr(t *TLS, fd, optional_actions int32, termios_p uintptr) int32 {
+ if __ccgo_strace {
+ trc("t=%v optional_actions=%v termios_p=%v, (%v:)", t, optional_actions, termios_p, origin(2))
+ }
panic(todo(""))
}
// speed_t cfgetospeed(const struct termios *termios_p);
func Xcfgetospeed(t *TLS, termios_p uintptr) termios.Speed_t {
+ if __ccgo_strace {
+ trc("t=%v termios_p=%v, (%v:)", t, termios_p, origin(2))
+ }
panic(todo(""))
}
// int cfsetospeed(struct termios *termios_p, speed_t speed);
func Xcfsetospeed(t *TLS, termios_p uintptr, speed uint32) int32 {
+ if __ccgo_strace {
+ trc("t=%v termios_p=%v speed=%v, (%v:)", t, termios_p, speed, origin(2))
+ }
panic(todo(""))
}
// int cfsetispeed(struct termios *termios_p, speed_t speed);
func Xcfsetispeed(t *TLS, termios_p uintptr, speed uint32) int32 {
+ if __ccgo_strace {
+ trc("t=%v termios_p=%v speed=%v, (%v:)", t, termios_p, speed, origin(2))
+ }
panic(todo(""))
}
// pid_t fork(void);
func Xfork(t *TLS) int32 {
+ if __ccgo_strace {
+ trc("t=%v, (%v:)", t, origin(2))
+ }
t.setErrno(errno.ENOSYS)
return -1
}
@@ -967,21 +1198,33 @@ var emptyStr = [1]byte{}
// char *setlocale(int category, const char *locale);
func Xsetlocale(t *TLS, category int32, locale uintptr) uintptr {
+ if __ccgo_strace {
+ trc("t=%v category=%v locale=%v, (%v:)", t, category, locale, origin(2))
+ }
return uintptr(unsafe.Pointer(&emptyStr)) //TODO
}
// char *nl_langinfo(nl_item item);
func Xnl_langinfo(t *TLS, item langinfo.Nl_item) uintptr {
+ if __ccgo_strace {
+ trc("t=%v item=%v, (%v:)", t, item, origin(2))
+ }
return uintptr(unsafe.Pointer(&emptyStr)) //TODO
}
// FILE *popen(const char *command, const char *type);
func Xpopen(t *TLS, command, type1 uintptr) uintptr {
+ if __ccgo_strace {
+ trc("t=%v type1=%v, (%v:)", t, type1, origin(2))
+ }
panic(todo(""))
}
// char *realpath(const char *path, char *resolved_path);
func Xrealpath(t *TLS, path, resolved_path uintptr) uintptr {
+ if __ccgo_strace {
+ trc("t=%v resolved_path=%v, (%v:)", t, resolved_path, origin(2))
+ }
s, err := filepath.EvalSymlinks(GoString(path))
if err != nil {
if os.IsNotExist(err) {
@@ -1010,19 +1253,31 @@ func Xrealpath(t *TLS, path, resolved_path uintptr) uintptr {
// struct tm *gmtime_r(const time_t *timep, struct tm *result);
func Xgmtime_r(t *TLS, timep, result uintptr) uintptr {
+ if __ccgo_strace {
+ trc("t=%v result=%v, (%v:)", t, result, origin(2))
+ }
panic(todo(""))
}
// char *inet_ntoa(struct in_addr in);
func Xinet_ntoa(t *TLS, in1 in.In_addr) uintptr {
+ if __ccgo_strace {
+ trc("t=%v in1=%v, (%v:)", t, in1, origin(2))
+ }
panic(todo(""))
}
func X__ccgo_in6addr_anyp(t *TLS) uintptr {
+ if __ccgo_strace {
+ trc("t=%v, (%v:)", t, origin(2))
+ }
return uintptr(unsafe.Pointer(&in6_addr_any))
}
func Xabort(t *TLS) {
+ if __ccgo_strace {
+ trc("t=%v, (%v:)", t, origin(2))
+ }
if dmesgs {
dmesg("%v:", origin(1))
}
@@ -1040,11 +1295,17 @@ func Xabort(t *TLS) {
// int fflush(FILE *stream);
func Xfflush(t *TLS, stream uintptr) int32 {
+ if __ccgo_strace {
+ trc("t=%v stream=%v, (%v:)", t, stream, origin(2))
+ }
return 0 //TODO
}
// size_t fread(void *ptr, size_t size, size_t nmemb, FILE *stream);
func Xfread(t *TLS, ptr uintptr, size, nmemb types.Size_t, stream uintptr) types.Size_t {
+ if __ccgo_strace {
+ trc("t=%v ptr=%v nmemb=%v stream=%v, (%v:)", t, ptr, nmemb, stream, origin(2))
+ }
m, _, err := unix.Syscall(unix.SYS_READ, uintptr(file(stream).fd()), ptr, uintptr(size*nmemb))
if err != 0 {
file(stream).setErr()
@@ -1060,6 +1321,9 @@ func Xfread(t *TLS, ptr uintptr, size, nmemb types.Size_t, stream uintptr) types
// size_t fwrite(const void *ptr, size_t size, size_t nmemb, FILE *stream);
func Xfwrite(t *TLS, ptr uintptr, size, nmemb types.Size_t, stream uintptr) types.Size_t {
+ if __ccgo_strace {
+ trc("t=%v ptr=%v nmemb=%v stream=%v, (%v:)", t, ptr, nmemb, stream, origin(2))
+ }
m, _, err := unix.Syscall(unix.SYS_WRITE, uintptr(file(stream).fd()), ptr, uintptr(size*nmemb))
if err != 0 {
file(stream).setErr()
@@ -1075,11 +1339,17 @@ func Xfwrite(t *TLS, ptr uintptr, size, nmemb types.Size_t, stream uintptr) type
// int fclose(FILE *stream);
func Xfclose(t *TLS, stream uintptr) int32 {
+ if __ccgo_strace {
+ trc("t=%v stream=%v, (%v:)", t, stream, origin(2))
+ }
return file(stream).close(t)
}
// int fputc(int c, FILE *stream);
func Xfputc(t *TLS, c int32, stream uintptr) int32 {
+ if __ccgo_strace {
+ trc("t=%v c=%v stream=%v, (%v:)", t, c, stream, origin(2))
+ }
if _, err := fwrite(file(stream).fd(), []byte{byte(c)}); err != nil {
return stdio.EOF
}
@@ -1089,6 +1359,9 @@ func Xfputc(t *TLS, c int32, stream uintptr) int32 {
// int fseek(FILE *stream, long offset, int whence);
func Xfseek(t *TLS, stream uintptr, offset long, whence int32) int32 {
+ if __ccgo_strace {
+ trc("t=%v stream=%v offset=%v whence=%v, (%v:)", t, stream, offset, whence, origin(2))
+ }
if n := Xlseek(t, int32(file(stream).fd()), types.Off_t(offset), whence); n < 0 {
// if dmesgs {
// dmesg("%v: fd %v, off %#x, whence %v: %v", origin(1), file(stream).fd(), offset, whenceStr(whence), n)
@@ -1105,6 +1378,9 @@ func Xfseek(t *TLS, stream uintptr, offset long, whence int32) int32 {
// long ftell(FILE *stream);
func Xftell(t *TLS, stream uintptr) long {
+ if __ccgo_strace {
+ trc("t=%v stream=%v, (%v:)", t, stream, origin(2))
+ }
n := Xlseek(t, file(stream).fd(), 0, stdio.SEEK_CUR)
if n < 0 {
file(stream).setErr()
@@ -1119,21 +1395,33 @@ func Xftell(t *TLS, stream uintptr) long {
// int ferror(FILE *stream);
func Xferror(t *TLS, stream uintptr) int32 {
+ if __ccgo_strace {
+ trc("t=%v stream=%v, (%v:)", t, stream, origin(2))
+ }
return Bool32(file(stream).err())
}
// int ungetc(int c, FILE *stream);
func Xungetc(t *TLS, c int32, stream uintptr) int32 {
+ if __ccgo_strace {
+ trc("t=%v c=%v stream=%v, (%v:)", t, c, stream, origin(2))
+ }
panic(todo(""))
}
// int fscanf(FILE *stream, const char *format, ...);
func Xfscanf(t *TLS, stream, format, va uintptr) int32 {
+ if __ccgo_strace {
+ trc("t=%v va=%v, (%v:)", t, va, origin(2))
+ }
panic(todo(""))
}
// int fputs(const char *s, FILE *stream);
func Xfputs(t *TLS, s, stream uintptr) int32 {
+ if __ccgo_strace {
+ trc("t=%v stream=%v, (%v:)", t, stream, origin(2))
+ }
if _, _, err := unix.Syscall(unix.SYS_WRITE, uintptr(file(stream).fd()), s, uintptr(Xstrlen(t, s))); err != 0 {
return -1
}
@@ -1145,6 +1433,9 @@ var getservbynameStaticResult netdb.Servent
// struct servent *getservbyname(const char *name, const char *proto);
func Xgetservbyname(t *TLS, name, proto uintptr) uintptr {
+ if __ccgo_strace {
+ trc("t=%v proto=%v, (%v:)", t, proto, origin(2))
+ }
var protoent *gonetdb.Protoent
if proto != 0 {
protoent = gonetdb.GetProtoByName(GoString(proto))
@@ -1222,6 +1513,9 @@ func Xgetservbyname(t *TLS, name, proto uintptr) uintptr {
}
func Xreaddir64(t *TLS, dir uintptr) uintptr {
+ if __ccgo_strace {
+ trc("t=%v dir=%v, (%v:)", t, dir, origin(2))
+ }
return Xreaddir(t, dir)
}
@@ -1234,14 +1528,23 @@ func __syscall(r, _ uintptr, errno syscall.Errno) long {
}
func X__syscall1(t *TLS, trap, p1 long) long {
+ if __ccgo_strace {
+ trc("t=%v p1=%v, (%v:)", t, p1, origin(2))
+ }
return __syscall(unix.Syscall(uintptr(trap), uintptr(p1), 0, 0))
}
func X__syscall3(t *TLS, trap, p1, p2, p3 long) long {
+ if __ccgo_strace {
+ trc("t=%v p3=%v, (%v:)", t, p3, origin(2))
+ }
return __syscall(unix.Syscall(uintptr(trap), uintptr(p1), uintptr(p2), uintptr(p3)))
}
func X__syscall4(t *TLS, trap, p1, p2, p3, p4 long) long {
+ if __ccgo_strace {
+ trc("t=%v p4=%v, (%v:)", t, p4, origin(2))
+ }
return __syscall(unix.Syscall6(uintptr(trap), uintptr(p1), uintptr(p2), uintptr(p3), uintptr(p4), 0, 0))
}
@@ -1264,26 +1567,41 @@ func fcntlCmdStr(cmd int32) string {
// int setenv(const char *name, const char *value, int overwrite);
func Xsetenv(t *TLS, name, value uintptr, overwrite int32) int32 {
+ if __ccgo_strace {
+ trc("t=%v value=%v overwrite=%v, (%v:)", t, value, overwrite, origin(2))
+ }
panic(todo(""))
}
// int unsetenv(const char *name);
func Xunsetenv(t *TLS, name uintptr) int32 {
+ if __ccgo_strace {
+ trc("t=%v name=%v, (%v:)", t, name, origin(2))
+ }
panic(todo(""))
}
// int pause(void);
func Xpause(t *TLS) int32 {
+ if __ccgo_strace {
+ trc("t=%v, (%v:)", t, origin(2))
+ }
panic(todo(""))
}
// ssize_t writev(int fd, const struct iovec *iov, int iovcnt);
func Xwritev(t *TLS, fd int32, iov uintptr, iovcnt int32) types.Ssize_t {
+ if __ccgo_strace {
+ trc("t=%v fd=%v iov=%v iovcnt=%v, (%v:)", t, fd, iov, iovcnt, origin(2))
+ }
panic(todo(""))
}
// int __isoc99_sscanf(const char *str, const char *format, ...);
func X__isoc99_sscanf(t *TLS, str, format, va uintptr) int32 {
+ if __ccgo_strace {
+ trc("t=%v va=%v, (%v:)", t, va, origin(2))
+ }
r := Xsscanf(t, str, format, va)
// if dmesgs {
// dmesg("%v: %q %q: %d", origin(1), GoString(str), GoString(format), r)
@@ -1293,16 +1611,25 @@ func X__isoc99_sscanf(t *TLS, str, format, va uintptr) int32 {
// void __assert(const char * func, const char * file, int line, const char *expr) __dead2;
func X__assert(t *TLS, fn, file uintptr, line int32, expr uintptr) {
+ if __ccgo_strace {
+ trc("t=%v file=%v line=%v expr=%v, (%v:)", t, file, line, expr, origin(2))
+ }
X__assert_fail(t, expr, file, uint32(line), fn)
}
// include/stdio.h:456:int __swbuf(int, FILE *);
func X__swbuf(t *TLS, n int32, file uintptr) int32 {
+ if __ccgo_strace {
+ trc("t=%v n=%v file=%v, (%v:)", t, n, file, origin(2))
+ }
return Xfputc(t, n, file) //TODO improve performance, use a real buffer.
}
// int rmdir(const char *pathname);
func Xrmdir(t *TLS, pathname uintptr) int32 {
+ if __ccgo_strace {
+ trc("t=%v pathname=%v, (%v:)", t, pathname, origin(2))
+ }
if err := unix.Rmdir(GoString(pathname)); err != nil {
if dmesgs {
dmesg("%v: %v FAIL", origin(1), err)
@@ -1319,6 +1646,9 @@ func Xrmdir(t *TLS, pathname uintptr) int32 {
// struct dirent *readdir(DIR *dirp);
func Xreaddir(t *TLS, dir uintptr) uintptr {
+ if __ccgo_strace {
+ trc("t=%v dir=%v, (%v:)", t, dir, origin(2))
+ }
if (*darwinDir)(unsafe.Pointer(dir)).eof {
return 0
}
@@ -1357,6 +1687,9 @@ type darwinDir struct {
// int sscanf(const char *str, const char *format, ...);
func Xsscanf(t *TLS, str, format, va uintptr) int32 {
+ if __ccgo_strace {
+ trc("t=%v va=%v, (%v:)", t, va, origin(2))
+ }
r := scanf(strings.NewReader(GoString(str)), format, va)
// if dmesgs {
// dmesg("%v: %q %q: %d", origin(1), GoString(str), GoString(format), r)
@@ -1366,10 +1699,16 @@ func Xsscanf(t *TLS, str, format, va uintptr) int32 {
// int * __error(void);
func X__error(t *TLS) uintptr {
+ if __ccgo_strace {
+ trc("t=%v, (%v:)", t, origin(2))
+ }
return t.errnop
}
func Xclosedir(t *TLS, dir uintptr) int32 {
+ if __ccgo_strace {
+ trc("t=%v dir=%v, (%v:)", t, dir, origin(2))
+ }
r := Xclose(t, int32((*darwinDir)(unsafe.Pointer(dir)).fd))
Xfree(t, dir)
return r
@@ -1377,11 +1716,17 @@ func Xclosedir(t *TLS, dir uintptr) int32 {
// int __xuname(int namesize, void *namebuf)
func X__xuname(t *TLS, namesize int32, namebuf uintptr) int32 {
+ if __ccgo_strace {
+ trc("t=%v namesize=%v namebuf=%v, (%v:)", t, namesize, namebuf, origin(2))
+ }
return Xuname(t, namebuf)
}
// int pipe(int pipefd[2]);
func Xpipe(t *TLS, pipefd uintptr) int32 {
+ if __ccgo_strace {
+ trc("t=%v pipefd=%v, (%v:)", t, pipefd, origin(2))
+ }
var a [2]int
if err := syscall.Pipe(a[:]); err != nil {
if dmesgs {
@@ -1400,10 +1745,16 @@ func Xpipe(t *TLS, pipefd uintptr) int32 {
// char *inet_ntoa(struct in_addr in);
func X__inet_ntoa(t *TLS, in1 in.In_addr) uintptr {
+ if __ccgo_strace {
+ trc("t=%v in1=%v, (%v:)", t, in1, origin(2))
+ }
panic(todo(""))
}
func Xmmap(t *TLS, addr uintptr, length types.Size_t, prot, flags, fd int32, offset types.Off_t) uintptr {
+ if __ccgo_strace {
+ trc("t=%v addr=%v length=%v fd=%v offset=%v, (%v:)", t, addr, length, fd, offset, origin(2))
+ }
// Cannot avoid the syscall here, addr sometimes matter.
data, _, err := unix.Syscall6(unix.SYS_MMAP, addr, uintptr(length), uintptr(prot), uintptr(flags), uintptr(fd), uintptr(offset))
if err != 0 {
@@ -1423,18 +1774,30 @@ func Xmmap(t *TLS, addr uintptr, length types.Size_t, prot, flags, fd int32, off
const PTHREAD_MUTEX_DEFAULT = 0
func X__ccgo_pthreadMutexattrGettype(tls *TLS, a uintptr) int32 { /* pthread_attr_get.c:93:5: */
+ if __ccgo_strace {
+ trc("tls=%v a=%v, (%v:)", tls, a, origin(2))
+ }
return (int32((*pthread_mutexattr_t)(unsafe.Pointer(a)).F__attr & uint32(3)))
}
func X__ccgo_getMutexType(tls *TLS, m uintptr) int32 { /* pthread_mutex_lock.c:3:5: */
+ if __ccgo_strace {
+ trc("tls=%v m=%v, (%v:)", tls, m, origin(2))
+ }
return (*(*int32)(unsafe.Pointer((m /* &.__u */ /* &.__i */))) & 15)
}
func X__ccgo_pthreadAttrGetDetachState(tls *TLS, a uintptr) int32 { /* pthread_attr_get.c:3:5: */
+ if __ccgo_strace {
+ trc("tls=%v a=%v, (%v:)", tls, a, origin(2))
+ }
return *(*int32)(unsafe.Pointer((a /* &.__u */ /* &.__i */) + 6*4))
}
func Xpthread_attr_init(t *TLS, pAttr uintptr) int32 {
+ if __ccgo_strace {
+ trc("t=%v pAttr=%v, (%v:)", t, pAttr, origin(2))
+ }
*(*pthread.Pthread_attr_t)(unsafe.Pointer(pAttr)) = pthread.Pthread_attr_t(0)
return 0
}
@@ -1451,6 +1814,9 @@ func Xpthread_attr_init(t *TLS, pAttr uintptr) int32 {
//
// int pthread_mutex_init(pthread_mutex_t *restrict mutex, const pthread_mutexattr_t *restrict attr);
func Xpthread_mutex_init(t *TLS, pMutex, pAttr uintptr) int32 {
+ if __ccgo_strace {
+ trc("t=%v pAttr=%v, (%v:)", t, pAttr, origin(2))
+ }
typ := PTHREAD_MUTEX_DEFAULT
if pAttr != 0 {
typ = int(X__ccgo_pthreadMutexattrGettype(t, pAttr))
@@ -1464,11 +1830,17 @@ func Xpthread_mutex_init(t *TLS, pMutex, pAttr uintptr) int32 {
}
func Xpthread_attr_getdetachstate(tls *TLS, a uintptr, state uintptr) int32 { /* pthread_attr_get.c:7:5: */
+ if __ccgo_strace {
+ trc("tls=%v a=%v state=%v, (%v:)", tls, a, state, origin(2))
+ }
*(*int32)(unsafe.Pointer(state)) = *(*int32)(unsafe.Pointer((a /* &.__u */ /* &.__i */) + 6*4))
return 0
}
func Xpthread_attr_setdetachstate(tls *TLS, a uintptr, state int32) int32 { /* pthread_attr_setdetachstate.c:3:5: */
+ if __ccgo_strace {
+ trc("tls=%v a=%v state=%v, (%v:)", tls, a, state, origin(2))
+ }
if uint32(state) > 1 {
return 22
}
@@ -1477,15 +1849,24 @@ func Xpthread_attr_setdetachstate(tls *TLS, a uintptr, state int32) int32 { /* p
}
func Xpthread_mutexattr_destroy(tls *TLS, a uintptr) int32 { /* pthread_mutexattr_destroy.c:3:5: */
+ if __ccgo_strace {
+ trc("tls=%v a=%v, (%v:)", tls, a, origin(2))
+ }
return 0
}
func Xpthread_mutexattr_init(tls *TLS, a uintptr) int32 { /* pthread_mutexattr_init.c:3:5: */
+ if __ccgo_strace {
+ trc("tls=%v a=%v, (%v:)", tls, a, origin(2))
+ }
*(*pthread_mutexattr_t)(unsafe.Pointer(a)) = pthread_mutexattr_t{}
return 0
}
func Xpthread_mutexattr_settype(tls *TLS, a uintptr, type1 int32) int32 { /* pthread_mutexattr_settype.c:3:5: */
+ if __ccgo_strace {
+ trc("tls=%v a=%v type1=%v, (%v:)", tls, a, type1, origin(2))
+ }
if uint32(type1) > uint32(2) {
return 22
}
@@ -1495,6 +1876,9 @@ func Xpthread_mutexattr_settype(tls *TLS, a uintptr, type1 int32) int32 { /* pth
// int uuid_parse( char *in, uuid_t uu);
func Xuuid_parse(t *TLS, in uintptr, uu uintptr) int32 {
+ if __ccgo_strace {
+ trc("t=%v in=%v uu=%v, (%v:)", t, in, uu, origin(2))
+ }
r, err := guuid.Parse(GoString(in))
if err != nil {
return -1
@@ -1504,27 +1888,47 @@ func Xuuid_parse(t *TLS, in uintptr, uu uintptr) int32 {
return 0
}
-func X__srget(t *TLS, stream uintptr) int32 { return Xgetc(t, stream) }
+func X__srget(t *TLS, stream uintptr) int32 {
+ if __ccgo_strace {
+ trc("t=%v stream=%v, (%v:)", t, stream, origin(2))
+ }
+ return Xgetc(t, stream)
+}
func X___tolower(t *TLS, r rune) rune {
+ if __ccgo_strace {
+ trc("t=%v r=%v, (%v:)", t, r, origin(2))
+ }
return unicode.ToLower(r)
}
func X___toupper(t *TLS, r rune) rune {
+ if __ccgo_strace {
+ trc("t=%v r=%v, (%v:)", t, r, origin(2))
+ }
return unicode.ToLower(r)
}
// uint16_t __builtin_bswap16 (uint32_t x)
func Xbswap16(t *TLS, x uint16) uint16 {
+ if __ccgo_strace {
+ trc("t=%v x=%v, (%v:)", t, x, origin(2))
+ }
return X__builtin_bswap16(t, x)
}
// uint32_t __builtin_bswap32 (uint32_t x)
func Xbswap32(t *TLS, x uint32) uint32 {
+ if __ccgo_strace {
+ trc("t=%v x=%v, (%v:)", t, x, origin(2))
+ }
return X__builtin_bswap32(t, x)
}
// uint64_t __builtin_bswap64 (uint64_t x)
func Xbswap64(t *TLS, x uint64) uint64 {
+ if __ccgo_strace {
+ trc("t=%v x=%v, (%v:)", t, x, origin(2))
+ }
return X__builtin_bswap64(t, x)
}
diff --git a/vendor/modernc.org/libc/libc_freebsd_386.go b/vendor/modernc.org/libc/libc_freebsd_386.go
index 29444877..1fee674c 100644
--- a/vendor/modernc.org/libc/libc_freebsd_386.go
+++ b/vendor/modernc.org/libc/libc_freebsd_386.go
@@ -24,6 +24,9 @@ type (
// int sigaction(int signum, const struct sigaction *act, struct sigaction *oldact);
func Xsigaction(t *TLS, signum int32, act, oldact uintptr) int32 {
+ if __ccgo_strace {
+ trc("t=%v signum=%v oldact=%v, (%v:)", t, signum, oldact, origin(2))
+ }
if _, _, err := unix.Syscall(unix.SYS_SIGACTION, uintptr(signum), act, oldact); err != 0 {
t.setErrno(err)
return -1
@@ -34,6 +37,9 @@ func Xsigaction(t *TLS, signum int32, act, oldact uintptr) int32 {
// FILE *fopen64(const char *pathname, const char *mode);
func Xfopen64(t *TLS, pathname, mode uintptr) uintptr {
+ if __ccgo_strace {
+ trc("t=%v mode=%v, (%v:)", t, mode, origin(2))
+ }
m := strings.ReplaceAll(GoString(mode), "b", "")
var flags int
switch m {
@@ -73,6 +79,9 @@ func Xfopen64(t *TLS, pathname, mode uintptr) uintptr {
// int lstat(const char *pathname, struct stat *statbuf);
func Xlstat64(t *TLS, pathname, statbuf uintptr) int32 {
+ if __ccgo_strace {
+ trc("t=%v statbuf=%v, (%v:)", t, statbuf, origin(2))
+ }
if err := unix.Lstat(GoString(pathname), (*unix.Stat_t)(unsafe.Pointer(statbuf))); err != nil {
if dmesgs {
dmesg("%v: %q: %v FAIL", origin(1), GoString(pathname), err)
@@ -89,6 +98,9 @@ func Xlstat64(t *TLS, pathname, statbuf uintptr) int32 {
// int stat(const char *pathname, struct stat *statbuf);
func Xstat64(t *TLS, pathname, statbuf uintptr) int32 {
+ if __ccgo_strace {
+ trc("t=%v statbuf=%v, (%v:)", t, statbuf, origin(2))
+ }
if err := unix.Stat(GoString(pathname), (*unix.Stat_t)(unsafe.Pointer(statbuf))); err != nil {
if dmesgs {
dmesg("%v: %q: %v FAIL", origin(1), GoString(pathname), err)
@@ -105,6 +117,9 @@ func Xstat64(t *TLS, pathname, statbuf uintptr) int32 {
// int mkdir(const char *path, mode_t mode);
func Xmkdir(t *TLS, path uintptr, mode types.Mode_t) int32 {
+ if __ccgo_strace {
+ trc("t=%v path=%v mode=%v, (%v:)", t, path, mode, origin(2))
+ }
if err := unix.Mkdir(GoString(path), uint32(mode)); err != nil {
if dmesgs {
dmesg("%v: %q: %v FAIL", origin(1), GoString(path), err)
@@ -121,6 +136,9 @@ func Xmkdir(t *TLS, path uintptr, mode types.Mode_t) int32 {
// int access(const char *pathname, int mode);
func Xaccess(t *TLS, pathname uintptr, mode int32) int32 {
+ if __ccgo_strace {
+ trc("t=%v pathname=%v mode=%v, (%v:)", t, pathname, mode, origin(2))
+ }
if err := unix.Access(GoString(pathname), uint32(mode)); err != nil {
if dmesgs {
dmesg("%v: %q %#o: %v FAIL", origin(1), GoString(pathname), mode, err)
@@ -137,6 +155,9 @@ func Xaccess(t *TLS, pathname uintptr, mode int32) int32 {
// int unlink(const char *pathname);
func Xunlink(t *TLS, pathname uintptr) int32 {
+ if __ccgo_strace {
+ trc("t=%v pathname=%v, (%v:)", t, pathname, origin(2))
+ }
if err := unix.Unlink(GoString(pathname)); err != nil {
if dmesgs {
dmesg("%v: %q: %v", origin(1), GoString(pathname), err)
@@ -153,6 +174,9 @@ func Xunlink(t *TLS, pathname uintptr) int32 {
// ssize_t readlink(const char *restrict path, char *restrict buf, size_t bufsize);
func Xreadlink(t *TLS, path, buf uintptr, bufsize types.Size_t) types.Ssize_t {
+ if __ccgo_strace {
+ trc("t=%v buf=%v bufsize=%v, (%v:)", t, buf, bufsize, origin(2))
+ }
var n int
var err error
switch {
@@ -177,6 +201,9 @@ func Xreadlink(t *TLS, path, buf uintptr, bufsize types.Size_t) types.Ssize_t {
// int symlink(const char *target, const char *linkpath);
func Xsymlink(t *TLS, target, linkpath uintptr) int32 {
+ if __ccgo_strace {
+ trc("t=%v linkpath=%v, (%v:)", t, linkpath, origin(2))
+ }
if err := unix.Symlink(GoString(target), GoString(linkpath)); err != nil {
if dmesgs {
dmesg("%v: %v FAIL", origin(1), err)
@@ -193,6 +220,9 @@ func Xsymlink(t *TLS, target, linkpath uintptr) int32 {
// int chmod(const char *pathname, mode_t mode)
func Xchmod(t *TLS, pathname uintptr, mode types.Mode_t) int32 {
+ if __ccgo_strace {
+ trc("t=%v pathname=%v mode=%v, (%v:)", t, pathname, mode, origin(2))
+ }
if err := unix.Chmod(GoString(pathname), uint32(mode)); err != nil {
if dmesgs {
dmesg("%v: %q %#o: %v FAIL", origin(1), GoString(pathname), mode, err)
@@ -209,6 +239,9 @@ func Xchmod(t *TLS, pathname uintptr, mode types.Mode_t) int32 {
// time_t time(time_t *tloc);
func Xtime(t *TLS, tloc uintptr) time.Time_t {
+ if __ccgo_strace {
+ trc("t=%v tloc=%v, (%v:)", t, tloc, origin(2))
+ }
panic(todo(""))
// n := time.Now().UTC().Unix()
// if tloc != 0 {
@@ -219,6 +252,9 @@ func Xtime(t *TLS, tloc uintptr) time.Time_t {
// int utimes(const char *filename, const struct timeval times[2]);
func Xutimes(t *TLS, filename, times uintptr) int32 {
+ if __ccgo_strace {
+ trc("t=%v times=%v, (%v:)", t, times, origin(2))
+ }
var a []unix.Timeval
if times != 0 {
a = make([]unix.Timeval, 2)
@@ -241,6 +277,9 @@ func Xutimes(t *TLS, filename, times uintptr) int32 {
// int fstat(int fd, struct stat *statbuf);
func Xfstat64(t *TLS, fd int32, statbuf uintptr) int32 {
+ if __ccgo_strace {
+ trc("t=%v fd=%v statbuf=%v, (%v:)", t, fd, statbuf, origin(2))
+ }
if err := unix.Fstat(int(fd), (*unix.Stat_t)(unsafe.Pointer(statbuf))); err != nil {
if dmesgs {
dmesg("%v: fd %d: %v FAIL", origin(1), fd, err)
@@ -257,6 +296,9 @@ func Xfstat64(t *TLS, fd int32, statbuf uintptr) int32 {
// off64_t lseek64(int fd, off64_t offset, int whence);
func Xlseek64(t *TLS, fd int32, offset types.Off_t, whence int32) types.Off_t {
+ if __ccgo_strace {
+ trc("t=%v fd=%v offset=%v whence=%v, (%v:)", t, fd, offset, whence, origin(2))
+ }
n, err := unix.Seek(int(fd), int64(offset), int(whence))
if err != nil {
if dmesgs {
@@ -273,6 +315,9 @@ func Xlseek64(t *TLS, fd int32, offset types.Off_t, whence int32) types.Off_t {
}
func Xfcntl64(t *TLS, fd, cmd int32, args uintptr) int32 {
+ if __ccgo_strace {
+ trc("t=%v cmd=%v args=%v, (%v:)", t, cmd, args, origin(2))
+ }
var arg uintptr
if args != 0 {
arg = *(*uintptr)(unsafe.Pointer(args))
@@ -294,6 +339,9 @@ func Xfcntl64(t *TLS, fd, cmd int32, args uintptr) int32 {
// int rename(const char *oldpath, const char *newpath);
func Xrename(t *TLS, oldpath, newpath uintptr) int32 {
+ if __ccgo_strace {
+ trc("t=%v newpath=%v, (%v:)", t, newpath, origin(2))
+ }
if err := unix.Rename(GoString(oldpath), GoString(newpath)); err != nil {
if dmesgs {
dmesg("%v: %v FAIL", origin(1), err)
@@ -310,6 +358,9 @@ func Xrename(t *TLS, oldpath, newpath uintptr) int32 {
// int mknod(const char *pathname, mode_t mode, dev_t dev);
func Xmknod(t *TLS, pathname uintptr, mode types.Mode_t, dev types.Dev_t) int32 {
+ if __ccgo_strace {
+ trc("t=%v pathname=%v mode=%v dev=%v, (%v:)", t, pathname, mode, dev, origin(2))
+ }
panic(todo(""))
// if _, _, err := unix.Syscall(unix.SYS_MKNOD, pathname, uintptr(mode), uintptr(dev)); err != 0 {
// t.setErrno(err)
@@ -321,6 +372,9 @@ func Xmknod(t *TLS, pathname uintptr, mode types.Mode_t, dev types.Dev_t) int32
// int utime(const char *filename, const struct utimbuf *times);
func Xutime(t *TLS, filename, times uintptr) int32 {
+ if __ccgo_strace {
+ trc("t=%v times=%v, (%v:)", t, times, origin(2))
+ }
var a []unix.Timeval
if times != 0 {
a = make([]unix.Timeval, 2)
@@ -343,6 +397,9 @@ func Xutime(t *TLS, filename, times uintptr) int32 {
// int chown(const char *pathname, uid_t owner, gid_t group);
func Xchown(t *TLS, pathname uintptr, owner types.Uid_t, group types.Gid_t) int32 {
+ if __ccgo_strace {
+ trc("t=%v pathname=%v owner=%v group=%v, (%v:)", t, pathname, owner, group, origin(2))
+ }
if _, _, err := unix.Syscall(unix.SYS_CHOWN, pathname, uintptr(owner), uintptr(group)); err != 0 {
t.setErrno(err)
return -1
@@ -353,6 +410,9 @@ func Xchown(t *TLS, pathname uintptr, owner types.Uid_t, group types.Gid_t) int3
// int link(const char *oldpath, const char *newpath);
func Xlink(t *TLS, oldpath, newpath uintptr) int32 {
+ if __ccgo_strace {
+ trc("t=%v newpath=%v, (%v:)", t, newpath, origin(2))
+ }
panic(todo(""))
// if _, _, err := unix.Syscall(unix.SYS_LINK, oldpath, newpath, 0); err != 0 {
// t.setErrno(err)
@@ -364,6 +424,9 @@ func Xlink(t *TLS, oldpath, newpath uintptr) int32 {
// int dup2(int oldfd, int newfd);
func Xdup2(t *TLS, oldfd, newfd int32) int32 {
+ if __ccgo_strace {
+ trc("t=%v newfd=%v, (%v:)", t, newfd, origin(2))
+ }
panic(todo(""))
// n, _, err := unix.Syscall(unix.SYS_DUP2, uintptr(oldfd), uintptr(newfd), 0)
// if err != 0 {
@@ -376,6 +439,9 @@ func Xdup2(t *TLS, oldfd, newfd int32) int32 {
// unsigned int alarm(unsigned int seconds);
func Xalarm(t *TLS, seconds uint32) uint32 {
+ if __ccgo_strace {
+ trc("t=%v seconds=%v, (%v:)", t, seconds, origin(2))
+ }
panic(todo(""))
// n, _, err := unix.Syscall(unix.SYS_ALARM, uintptr(seconds), 0, 0)
// if err != 0 {
@@ -386,6 +452,9 @@ func Xalarm(t *TLS, seconds uint32) uint32 {
}
func Xgetnameinfo(tls *TLS, sa1 uintptr, sl socklen_t, node uintptr, nodelen size_t, serv uintptr, servlen size_t, flags int32) int32 { /* getnameinfo.c:125:5: */
+ if __ccgo_strace {
+ trc("tls=%v sa1=%v sl=%v node=%v nodelen=%v serv=%v servlen=%v flags=%v, (%v:)", tls, sa1, sl, node, nodelen, serv, servlen, flags, origin(2))
+ }
panic(todo(""))
//TODO bp := tls.Alloc(347)
//TODO defer tls.Free(347)
@@ -485,6 +554,9 @@ func Xgetnameinfo(tls *TLS, sa1 uintptr, sl socklen_t, node uintptr, nodelen siz
}
func Xgethostbyaddr_r(tls *TLS, a uintptr, l socklen_t, af int32, h uintptr, buf uintptr, buflen size_t, res uintptr, err uintptr) int32 { /* gethostbyaddr_r.c:10:5: */
+ if __ccgo_strace {
+ trc("tls=%v a=%v l=%v af=%v h=%v buf=%v buflen=%v res=%v err=%v, (%v:)", tls, a, l, af, h, buf, buflen, res, err, origin(2))
+ }
panic(todo(""))
//TODO bp := tls.Alloc(28)
//TODO defer tls.Free(28)
@@ -572,6 +644,9 @@ func Xgethostbyaddr_r(tls *TLS, a uintptr, l socklen_t, af int32, h uintptr, buf
// int getrlimit(int resource, struct rlimit *rlim);
func Xgetrlimit64(t *TLS, resource int32, rlim uintptr) int32 {
+ if __ccgo_strace {
+ trc("t=%v resource=%v rlim=%v, (%v:)", t, resource, rlim, origin(2))
+ }
if _, _, err := unix.Syscall(unix.SYS_GETRLIMIT, uintptr(resource), uintptr(rlim), 0); err != 0 {
t.setErrno(err)
return -1
@@ -606,6 +681,9 @@ func newFtsent(t *TLS, info int, path string, stat *unix.Stat_t, err syscall.Err
// DIR *opendir(const char *name);
func Xopendir(t *TLS, name uintptr) uintptr {
+ if __ccgo_strace {
+ trc("t=%v name=%v, (%v:)", t, name, origin(2))
+ }
p := Xmalloc(t, uint32(unsafe.Sizeof(darwinDir{})))
if p == 0 {
panic("OOM")
@@ -632,6 +710,9 @@ func Xopendir(t *TLS, name uintptr) uintptr {
// int chflags(const char *path, u_int flags);
func Xchflags(t *TLS, path uintptr, flags uint32) int32 {
+ if __ccgo_strace {
+ trc("t=%v path=%v flags=%v, (%v:)", t, path, flags, origin(2))
+ }
if err := unix.Chflags(GoString(path), int(flags)); err != nil {
if dmesgs {
dmesg("%v: %v FAIL", origin(1), err)
diff --git a/vendor/modernc.org/libc/libc_freebsd_amd64.go b/vendor/modernc.org/libc/libc_freebsd_amd64.go
index 48f7fd78..e2e31e0b 100644
--- a/vendor/modernc.org/libc/libc_freebsd_amd64.go
+++ b/vendor/modernc.org/libc/libc_freebsd_amd64.go
@@ -24,6 +24,9 @@ type (
// int sigaction(int signum, const struct sigaction *act, struct sigaction *oldact);
func Xsigaction(t *TLS, signum int32, act, oldact uintptr) int32 {
+ if __ccgo_strace {
+ trc("t=%v signum=%v oldact=%v, (%v:)", t, signum, oldact, origin(2))
+ }
if _, _, err := unix.Syscall(unix.SYS_SIGACTION, uintptr(signum), act, oldact); err != 0 {
t.setErrno(err)
return -1
@@ -34,6 +37,9 @@ func Xsigaction(t *TLS, signum int32, act, oldact uintptr) int32 {
// FILE *fopen64(const char *pathname, const char *mode);
func Xfopen64(t *TLS, pathname, mode uintptr) uintptr {
+ if __ccgo_strace {
+ trc("t=%v mode=%v, (%v:)", t, mode, origin(2))
+ }
m := strings.ReplaceAll(GoString(mode), "b", "")
var flags int
switch m {
@@ -73,6 +79,9 @@ func Xfopen64(t *TLS, pathname, mode uintptr) uintptr {
// int lstat(const char *pathname, struct stat *statbuf);
func Xlstat64(t *TLS, pathname, statbuf uintptr) int32 {
+ if __ccgo_strace {
+ trc("t=%v statbuf=%v, (%v:)", t, statbuf, origin(2))
+ }
if err := unix.Lstat(GoString(pathname), (*unix.Stat_t)(unsafe.Pointer(statbuf))); err != nil {
if dmesgs {
dmesg("%v: %q: %v FAIL", origin(1), GoString(pathname), err)
@@ -89,6 +98,9 @@ func Xlstat64(t *TLS, pathname, statbuf uintptr) int32 {
// int stat(const char *pathname, struct stat *statbuf);
func Xstat64(t *TLS, pathname, statbuf uintptr) int32 {
+ if __ccgo_strace {
+ trc("t=%v statbuf=%v, (%v:)", t, statbuf, origin(2))
+ }
if err := unix.Stat(GoString(pathname), (*unix.Stat_t)(unsafe.Pointer(statbuf))); err != nil {
if dmesgs {
dmesg("%v: %q: %v FAIL", origin(1), GoString(pathname), err)
@@ -105,6 +117,9 @@ func Xstat64(t *TLS, pathname, statbuf uintptr) int32 {
// int mkdir(const char *path, mode_t mode);
func Xmkdir(t *TLS, path uintptr, mode types.Mode_t) int32 {
+ if __ccgo_strace {
+ trc("t=%v path=%v mode=%v, (%v:)", t, path, mode, origin(2))
+ }
if err := unix.Mkdir(GoString(path), uint32(mode)); err != nil {
if dmesgs {
dmesg("%v: %q: %v FAIL", origin(1), GoString(path), err)
@@ -121,6 +136,9 @@ func Xmkdir(t *TLS, path uintptr, mode types.Mode_t) int32 {
// int access(const char *pathname, int mode);
func Xaccess(t *TLS, pathname uintptr, mode int32) int32 {
+ if __ccgo_strace {
+ trc("t=%v pathname=%v mode=%v, (%v:)", t, pathname, mode, origin(2))
+ }
if err := unix.Access(GoString(pathname), uint32(mode)); err != nil {
if dmesgs {
dmesg("%v: %q %#o: %v FAIL", origin(1), GoString(pathname), mode, err)
@@ -137,6 +155,9 @@ func Xaccess(t *TLS, pathname uintptr, mode int32) int32 {
// int unlink(const char *pathname);
func Xunlink(t *TLS, pathname uintptr) int32 {
+ if __ccgo_strace {
+ trc("t=%v pathname=%v, (%v:)", t, pathname, origin(2))
+ }
if err := unix.Unlink(GoString(pathname)); err != nil {
if dmesgs {
dmesg("%v: %q: %v", origin(1), GoString(pathname), err)
@@ -153,6 +174,9 @@ func Xunlink(t *TLS, pathname uintptr) int32 {
// ssize_t readlink(const char *restrict path, char *restrict buf, size_t bufsize);
func Xreadlink(t *TLS, path, buf uintptr, bufsize types.Size_t) types.Ssize_t {
+ if __ccgo_strace {
+ trc("t=%v buf=%v bufsize=%v, (%v:)", t, buf, bufsize, origin(2))
+ }
var n int
var err error
switch {
@@ -177,6 +201,9 @@ func Xreadlink(t *TLS, path, buf uintptr, bufsize types.Size_t) types.Ssize_t {
// int symlink(const char *target, const char *linkpath);
func Xsymlink(t *TLS, target, linkpath uintptr) int32 {
+ if __ccgo_strace {
+ trc("t=%v linkpath=%v, (%v:)", t, linkpath, origin(2))
+ }
if err := unix.Symlink(GoString(target), GoString(linkpath)); err != nil {
if dmesgs {
dmesg("%v: %v FAIL", origin(1), err)
@@ -193,6 +220,9 @@ func Xsymlink(t *TLS, target, linkpath uintptr) int32 {
// int chmod(const char *pathname, mode_t mode)
func Xchmod(t *TLS, pathname uintptr, mode types.Mode_t) int32 {
+ if __ccgo_strace {
+ trc("t=%v pathname=%v mode=%v, (%v:)", t, pathname, mode, origin(2))
+ }
if err := unix.Chmod(GoString(pathname), uint32(mode)); err != nil {
if dmesgs {
dmesg("%v: %q %#o: %v FAIL", origin(1), GoString(pathname), mode, err)
@@ -209,6 +239,9 @@ func Xchmod(t *TLS, pathname uintptr, mode types.Mode_t) int32 {
// time_t time(time_t *tloc);
func Xtime(t *TLS, tloc uintptr) time.Time_t {
+ if __ccgo_strace {
+ trc("t=%v tloc=%v, (%v:)", t, tloc, origin(2))
+ }
panic(todo(""))
// n := time.Now().UTC().Unix()
// if tloc != 0 {
@@ -219,6 +252,9 @@ func Xtime(t *TLS, tloc uintptr) time.Time_t {
// int utimes(const char *filename, const struct timeval times[2]);
func Xutimes(t *TLS, filename, times uintptr) int32 {
+ if __ccgo_strace {
+ trc("t=%v times=%v, (%v:)", t, times, origin(2))
+ }
var a []unix.Timeval
if times != 0 {
a = make([]unix.Timeval, 2)
@@ -241,6 +277,9 @@ func Xutimes(t *TLS, filename, times uintptr) int32 {
// int fstat(int fd, struct stat *statbuf);
func Xfstat64(t *TLS, fd int32, statbuf uintptr) int32 {
+ if __ccgo_strace {
+ trc("t=%v fd=%v statbuf=%v, (%v:)", t, fd, statbuf, origin(2))
+ }
if err := unix.Fstat(int(fd), (*unix.Stat_t)(unsafe.Pointer(statbuf))); err != nil {
if dmesgs {
dmesg("%v: fd %d: %v FAIL", origin(1), fd, err)
@@ -257,6 +296,9 @@ func Xfstat64(t *TLS, fd int32, statbuf uintptr) int32 {
// off64_t lseek64(int fd, off64_t offset, int whence);
func Xlseek64(t *TLS, fd int32, offset types.Off_t, whence int32) types.Off_t {
+ if __ccgo_strace {
+ trc("t=%v fd=%v offset=%v whence=%v, (%v:)", t, fd, offset, whence, origin(2))
+ }
n, err := unix.Seek(int(fd), int64(offset), int(whence))
if err != nil {
if dmesgs {
@@ -273,6 +315,9 @@ func Xlseek64(t *TLS, fd int32, offset types.Off_t, whence int32) types.Off_t {
}
func Xfcntl64(t *TLS, fd, cmd int32, args uintptr) int32 {
+ if __ccgo_strace {
+ trc("t=%v cmd=%v args=%v, (%v:)", t, cmd, args, origin(2))
+ }
var arg uintptr
if args != 0 {
arg = *(*uintptr)(unsafe.Pointer(args))
@@ -294,6 +339,9 @@ func Xfcntl64(t *TLS, fd, cmd int32, args uintptr) int32 {
// int rename(const char *oldpath, const char *newpath);
func Xrename(t *TLS, oldpath, newpath uintptr) int32 {
+ if __ccgo_strace {
+ trc("t=%v newpath=%v, (%v:)", t, newpath, origin(2))
+ }
if err := unix.Rename(GoString(oldpath), GoString(newpath)); err != nil {
if dmesgs {
dmesg("%v: %v FAIL", origin(1), err)
@@ -310,6 +358,9 @@ func Xrename(t *TLS, oldpath, newpath uintptr) int32 {
// int mknod(const char *pathname, mode_t mode, dev_t dev);
func Xmknod(t *TLS, pathname uintptr, mode types.Mode_t, dev types.Dev_t) int32 {
+ if __ccgo_strace {
+ trc("t=%v pathname=%v mode=%v dev=%v, (%v:)", t, pathname, mode, dev, origin(2))
+ }
panic(todo(""))
// if _, _, err := unix.Syscall(unix.SYS_MKNOD, pathname, uintptr(mode), uintptr(dev)); err != 0 {
// t.setErrno(err)
@@ -321,6 +372,9 @@ func Xmknod(t *TLS, pathname uintptr, mode types.Mode_t, dev types.Dev_t) int32
// int utime(const char *filename, const struct utimbuf *times);
func Xutime(t *TLS, filename, times uintptr) int32 {
+ if __ccgo_strace {
+ trc("t=%v times=%v, (%v:)", t, times, origin(2))
+ }
var a []unix.Timeval
if times != 0 {
a = make([]unix.Timeval, 2)
@@ -343,6 +397,9 @@ func Xutime(t *TLS, filename, times uintptr) int32 {
// int chown(const char *pathname, uid_t owner, gid_t group);
func Xchown(t *TLS, pathname uintptr, owner types.Uid_t, group types.Gid_t) int32 {
+ if __ccgo_strace {
+ trc("t=%v pathname=%v owner=%v group=%v, (%v:)", t, pathname, owner, group, origin(2))
+ }
if _, _, err := unix.Syscall(unix.SYS_CHOWN, pathname, uintptr(owner), uintptr(group)); err != 0 {
t.setErrno(err)
return -1
@@ -353,6 +410,9 @@ func Xchown(t *TLS, pathname uintptr, owner types.Uid_t, group types.Gid_t) int3
// int link(const char *oldpath, const char *newpath);
func Xlink(t *TLS, oldpath, newpath uintptr) int32 {
+ if __ccgo_strace {
+ trc("t=%v newpath=%v, (%v:)", t, newpath, origin(2))
+ }
panic(todo(""))
// if _, _, err := unix.Syscall(unix.SYS_LINK, oldpath, newpath, 0); err != 0 {
// t.setErrno(err)
@@ -364,6 +424,9 @@ func Xlink(t *TLS, oldpath, newpath uintptr) int32 {
// int dup2(int oldfd, int newfd);
func Xdup2(t *TLS, oldfd, newfd int32) int32 {
+ if __ccgo_strace {
+ trc("t=%v newfd=%v, (%v:)", t, newfd, origin(2))
+ }
panic(todo(""))
// n, _, err := unix.Syscall(unix.SYS_DUP2, uintptr(oldfd), uintptr(newfd), 0)
// if err != 0 {
@@ -376,6 +439,9 @@ func Xdup2(t *TLS, oldfd, newfd int32) int32 {
// unsigned int alarm(unsigned int seconds);
func Xalarm(t *TLS, seconds uint32) uint32 {
+ if __ccgo_strace {
+ trc("t=%v seconds=%v, (%v:)", t, seconds, origin(2))
+ }
panic(todo(""))
// n, _, err := unix.Syscall(unix.SYS_ALARM, uintptr(seconds), 0, 0)
// if err != 0 {
@@ -386,6 +452,9 @@ func Xalarm(t *TLS, seconds uint32) uint32 {
}
func Xgetnameinfo(tls *TLS, sa1 uintptr, sl socklen_t, node uintptr, nodelen size_t, serv uintptr, servlen size_t, flags int32) int32 { /* getnameinfo.c:125:5: */
+ if __ccgo_strace {
+ trc("tls=%v sa1=%v sl=%v node=%v nodelen=%v serv=%v servlen=%v flags=%v, (%v:)", tls, sa1, sl, node, nodelen, serv, servlen, flags, origin(2))
+ }
panic(todo(""))
//TODO bp := tls.Alloc(347)
//TODO defer tls.Free(347)
@@ -485,6 +554,9 @@ func Xgetnameinfo(tls *TLS, sa1 uintptr, sl socklen_t, node uintptr, nodelen siz
}
func Xgethostbyaddr_r(tls *TLS, a uintptr, l socklen_t, af int32, h uintptr, buf uintptr, buflen size_t, res uintptr, err uintptr) int32 { /* gethostbyaddr_r.c:10:5: */
+ if __ccgo_strace {
+ trc("tls=%v a=%v l=%v af=%v h=%v buf=%v buflen=%v res=%v err=%v, (%v:)", tls, a, l, af, h, buf, buflen, res, err, origin(2))
+ }
panic(todo(""))
//TODO bp := tls.Alloc(28)
//TODO defer tls.Free(28)
@@ -572,6 +644,9 @@ func Xgethostbyaddr_r(tls *TLS, a uintptr, l socklen_t, af int32, h uintptr, buf
// int getrlimit(int resource, struct rlimit *rlim);
func Xgetrlimit64(t *TLS, resource int32, rlim uintptr) int32 {
+ if __ccgo_strace {
+ trc("t=%v resource=%v rlim=%v, (%v:)", t, resource, rlim, origin(2))
+ }
if _, _, err := unix.Syscall(unix.SYS_GETRLIMIT, uintptr(resource), uintptr(rlim), 0); err != 0 {
t.setErrno(err)
return -1
@@ -606,6 +681,9 @@ func newFtsent(t *TLS, info int, path string, stat *unix.Stat_t, err syscall.Err
// DIR *opendir(const char *name);
func Xopendir(t *TLS, name uintptr) uintptr {
+ if __ccgo_strace {
+ trc("t=%v name=%v, (%v:)", t, name, origin(2))
+ }
p := Xmalloc(t, uint64(unsafe.Sizeof(darwinDir{})))
if p == 0 {
panic("OOM")
@@ -632,6 +710,9 @@ func Xopendir(t *TLS, name uintptr) uintptr {
// int chflags(const char *path, u_int flags);
func Xchflags(t *TLS, path uintptr, flags uint64) int32 {
+ if __ccgo_strace {
+ trc("t=%v path=%v flags=%v, (%v:)", t, path, flags, origin(2))
+ }
if err := unix.Chflags(GoString(path), int(flags)); err != nil {
if dmesgs {
dmesg("%v: %v FAIL", origin(1), err)
diff --git a/vendor/modernc.org/libc/libc_freebsd_arm.go b/vendor/modernc.org/libc/libc_freebsd_arm.go
index 29444877..1fee674c 100644
--- a/vendor/modernc.org/libc/libc_freebsd_arm.go
+++ b/vendor/modernc.org/libc/libc_freebsd_arm.go
@@ -24,6 +24,9 @@ type (
// int sigaction(int signum, const struct sigaction *act, struct sigaction *oldact);
func Xsigaction(t *TLS, signum int32, act, oldact uintptr) int32 {
+ if __ccgo_strace {
+ trc("t=%v signum=%v oldact=%v, (%v:)", t, signum, oldact, origin(2))
+ }
if _, _, err := unix.Syscall(unix.SYS_SIGACTION, uintptr(signum), act, oldact); err != 0 {
t.setErrno(err)
return -1
@@ -34,6 +37,9 @@ func Xsigaction(t *TLS, signum int32, act, oldact uintptr) int32 {
// FILE *fopen64(const char *pathname, const char *mode);
func Xfopen64(t *TLS, pathname, mode uintptr) uintptr {
+ if __ccgo_strace {
+ trc("t=%v mode=%v, (%v:)", t, mode, origin(2))
+ }
m := strings.ReplaceAll(GoString(mode), "b", "")
var flags int
switch m {
@@ -73,6 +79,9 @@ func Xfopen64(t *TLS, pathname, mode uintptr) uintptr {
// int lstat(const char *pathname, struct stat *statbuf);
func Xlstat64(t *TLS, pathname, statbuf uintptr) int32 {
+ if __ccgo_strace {
+ trc("t=%v statbuf=%v, (%v:)", t, statbuf, origin(2))
+ }
if err := unix.Lstat(GoString(pathname), (*unix.Stat_t)(unsafe.Pointer(statbuf))); err != nil {
if dmesgs {
dmesg("%v: %q: %v FAIL", origin(1), GoString(pathname), err)
@@ -89,6 +98,9 @@ func Xlstat64(t *TLS, pathname, statbuf uintptr) int32 {
// int stat(const char *pathname, struct stat *statbuf);
func Xstat64(t *TLS, pathname, statbuf uintptr) int32 {
+ if __ccgo_strace {
+ trc("t=%v statbuf=%v, (%v:)", t, statbuf, origin(2))
+ }
if err := unix.Stat(GoString(pathname), (*unix.Stat_t)(unsafe.Pointer(statbuf))); err != nil {
if dmesgs {
dmesg("%v: %q: %v FAIL", origin(1), GoString(pathname), err)
@@ -105,6 +117,9 @@ func Xstat64(t *TLS, pathname, statbuf uintptr) int32 {
// int mkdir(const char *path, mode_t mode);
func Xmkdir(t *TLS, path uintptr, mode types.Mode_t) int32 {
+ if __ccgo_strace {
+ trc("t=%v path=%v mode=%v, (%v:)", t, path, mode, origin(2))
+ }
if err := unix.Mkdir(GoString(path), uint32(mode)); err != nil {
if dmesgs {
dmesg("%v: %q: %v FAIL", origin(1), GoString(path), err)
@@ -121,6 +136,9 @@ func Xmkdir(t *TLS, path uintptr, mode types.Mode_t) int32 {
// int access(const char *pathname, int mode);
func Xaccess(t *TLS, pathname uintptr, mode int32) int32 {
+ if __ccgo_strace {
+ trc("t=%v pathname=%v mode=%v, (%v:)", t, pathname, mode, origin(2))
+ }
if err := unix.Access(GoString(pathname), uint32(mode)); err != nil {
if dmesgs {
dmesg("%v: %q %#o: %v FAIL", origin(1), GoString(pathname), mode, err)
@@ -137,6 +155,9 @@ func Xaccess(t *TLS, pathname uintptr, mode int32) int32 {
// int unlink(const char *pathname);
func Xunlink(t *TLS, pathname uintptr) int32 {
+ if __ccgo_strace {
+ trc("t=%v pathname=%v, (%v:)", t, pathname, origin(2))
+ }
if err := unix.Unlink(GoString(pathname)); err != nil {
if dmesgs {
dmesg("%v: %q: %v", origin(1), GoString(pathname), err)
@@ -153,6 +174,9 @@ func Xunlink(t *TLS, pathname uintptr) int32 {
// ssize_t readlink(const char *restrict path, char *restrict buf, size_t bufsize);
func Xreadlink(t *TLS, path, buf uintptr, bufsize types.Size_t) types.Ssize_t {
+ if __ccgo_strace {
+ trc("t=%v buf=%v bufsize=%v, (%v:)", t, buf, bufsize, origin(2))
+ }
var n int
var err error
switch {
@@ -177,6 +201,9 @@ func Xreadlink(t *TLS, path, buf uintptr, bufsize types.Size_t) types.Ssize_t {
// int symlink(const char *target, const char *linkpath);
func Xsymlink(t *TLS, target, linkpath uintptr) int32 {
+ if __ccgo_strace {
+ trc("t=%v linkpath=%v, (%v:)", t, linkpath, origin(2))
+ }
if err := unix.Symlink(GoString(target), GoString(linkpath)); err != nil {
if dmesgs {
dmesg("%v: %v FAIL", origin(1), err)
@@ -193,6 +220,9 @@ func Xsymlink(t *TLS, target, linkpath uintptr) int32 {
// int chmod(const char *pathname, mode_t mode)
func Xchmod(t *TLS, pathname uintptr, mode types.Mode_t) int32 {
+ if __ccgo_strace {
+ trc("t=%v pathname=%v mode=%v, (%v:)", t, pathname, mode, origin(2))
+ }
if err := unix.Chmod(GoString(pathname), uint32(mode)); err != nil {
if dmesgs {
dmesg("%v: %q %#o: %v FAIL", origin(1), GoString(pathname), mode, err)
@@ -209,6 +239,9 @@ func Xchmod(t *TLS, pathname uintptr, mode types.Mode_t) int32 {
// time_t time(time_t *tloc);
func Xtime(t *TLS, tloc uintptr) time.Time_t {
+ if __ccgo_strace {
+ trc("t=%v tloc=%v, (%v:)", t, tloc, origin(2))
+ }
panic(todo(""))
// n := time.Now().UTC().Unix()
// if tloc != 0 {
@@ -219,6 +252,9 @@ func Xtime(t *TLS, tloc uintptr) time.Time_t {
// int utimes(const char *filename, const struct timeval times[2]);
func Xutimes(t *TLS, filename, times uintptr) int32 {
+ if __ccgo_strace {
+ trc("t=%v times=%v, (%v:)", t, times, origin(2))
+ }
var a []unix.Timeval
if times != 0 {
a = make([]unix.Timeval, 2)
@@ -241,6 +277,9 @@ func Xutimes(t *TLS, filename, times uintptr) int32 {
// int fstat(int fd, struct stat *statbuf);
func Xfstat64(t *TLS, fd int32, statbuf uintptr) int32 {
+ if __ccgo_strace {
+ trc("t=%v fd=%v statbuf=%v, (%v:)", t, fd, statbuf, origin(2))
+ }
if err := unix.Fstat(int(fd), (*unix.Stat_t)(unsafe.Pointer(statbuf))); err != nil {
if dmesgs {
dmesg("%v: fd %d: %v FAIL", origin(1), fd, err)
@@ -257,6 +296,9 @@ func Xfstat64(t *TLS, fd int32, statbuf uintptr) int32 {
// off64_t lseek64(int fd, off64_t offset, int whence);
func Xlseek64(t *TLS, fd int32, offset types.Off_t, whence int32) types.Off_t {
+ if __ccgo_strace {
+ trc("t=%v fd=%v offset=%v whence=%v, (%v:)", t, fd, offset, whence, origin(2))
+ }
n, err := unix.Seek(int(fd), int64(offset), int(whence))
if err != nil {
if dmesgs {
@@ -273,6 +315,9 @@ func Xlseek64(t *TLS, fd int32, offset types.Off_t, whence int32) types.Off_t {
}
func Xfcntl64(t *TLS, fd, cmd int32, args uintptr) int32 {
+ if __ccgo_strace {
+ trc("t=%v cmd=%v args=%v, (%v:)", t, cmd, args, origin(2))
+ }
var arg uintptr
if args != 0 {
arg = *(*uintptr)(unsafe.Pointer(args))
@@ -294,6 +339,9 @@ func Xfcntl64(t *TLS, fd, cmd int32, args uintptr) int32 {
// int rename(const char *oldpath, const char *newpath);
func Xrename(t *TLS, oldpath, newpath uintptr) int32 {
+ if __ccgo_strace {
+ trc("t=%v newpath=%v, (%v:)", t, newpath, origin(2))
+ }
if err := unix.Rename(GoString(oldpath), GoString(newpath)); err != nil {
if dmesgs {
dmesg("%v: %v FAIL", origin(1), err)
@@ -310,6 +358,9 @@ func Xrename(t *TLS, oldpath, newpath uintptr) int32 {
// int mknod(const char *pathname, mode_t mode, dev_t dev);
func Xmknod(t *TLS, pathname uintptr, mode types.Mode_t, dev types.Dev_t) int32 {
+ if __ccgo_strace {
+ trc("t=%v pathname=%v mode=%v dev=%v, (%v:)", t, pathname, mode, dev, origin(2))
+ }
panic(todo(""))
// if _, _, err := unix.Syscall(unix.SYS_MKNOD, pathname, uintptr(mode), uintptr(dev)); err != 0 {
// t.setErrno(err)
@@ -321,6 +372,9 @@ func Xmknod(t *TLS, pathname uintptr, mode types.Mode_t, dev types.Dev_t) int32
// int utime(const char *filename, const struct utimbuf *times);
func Xutime(t *TLS, filename, times uintptr) int32 {
+ if __ccgo_strace {
+ trc("t=%v times=%v, (%v:)", t, times, origin(2))
+ }
var a []unix.Timeval
if times != 0 {
a = make([]unix.Timeval, 2)
@@ -343,6 +397,9 @@ func Xutime(t *TLS, filename, times uintptr) int32 {
// int chown(const char *pathname, uid_t owner, gid_t group);
func Xchown(t *TLS, pathname uintptr, owner types.Uid_t, group types.Gid_t) int32 {
+ if __ccgo_strace {
+ trc("t=%v pathname=%v owner=%v group=%v, (%v:)", t, pathname, owner, group, origin(2))
+ }
if _, _, err := unix.Syscall(unix.SYS_CHOWN, pathname, uintptr(owner), uintptr(group)); err != 0 {
t.setErrno(err)
return -1
@@ -353,6 +410,9 @@ func Xchown(t *TLS, pathname uintptr, owner types.Uid_t, group types.Gid_t) int3
// int link(const char *oldpath, const char *newpath);
func Xlink(t *TLS, oldpath, newpath uintptr) int32 {
+ if __ccgo_strace {
+ trc("t=%v newpath=%v, (%v:)", t, newpath, origin(2))
+ }
panic(todo(""))
// if _, _, err := unix.Syscall(unix.SYS_LINK, oldpath, newpath, 0); err != 0 {
// t.setErrno(err)
@@ -364,6 +424,9 @@ func Xlink(t *TLS, oldpath, newpath uintptr) int32 {
// int dup2(int oldfd, int newfd);
func Xdup2(t *TLS, oldfd, newfd int32) int32 {
+ if __ccgo_strace {
+ trc("t=%v newfd=%v, (%v:)", t, newfd, origin(2))
+ }
panic(todo(""))
// n, _, err := unix.Syscall(unix.SYS_DUP2, uintptr(oldfd), uintptr(newfd), 0)
// if err != 0 {
@@ -376,6 +439,9 @@ func Xdup2(t *TLS, oldfd, newfd int32) int32 {
// unsigned int alarm(unsigned int seconds);
func Xalarm(t *TLS, seconds uint32) uint32 {
+ if __ccgo_strace {
+ trc("t=%v seconds=%v, (%v:)", t, seconds, origin(2))
+ }
panic(todo(""))
// n, _, err := unix.Syscall(unix.SYS_ALARM, uintptr(seconds), 0, 0)
// if err != 0 {
@@ -386,6 +452,9 @@ func Xalarm(t *TLS, seconds uint32) uint32 {
}
func Xgetnameinfo(tls *TLS, sa1 uintptr, sl socklen_t, node uintptr, nodelen size_t, serv uintptr, servlen size_t, flags int32) int32 { /* getnameinfo.c:125:5: */
+ if __ccgo_strace {
+ trc("tls=%v sa1=%v sl=%v node=%v nodelen=%v serv=%v servlen=%v flags=%v, (%v:)", tls, sa1, sl, node, nodelen, serv, servlen, flags, origin(2))
+ }
panic(todo(""))
//TODO bp := tls.Alloc(347)
//TODO defer tls.Free(347)
@@ -485,6 +554,9 @@ func Xgetnameinfo(tls *TLS, sa1 uintptr, sl socklen_t, node uintptr, nodelen siz
}
func Xgethostbyaddr_r(tls *TLS, a uintptr, l socklen_t, af int32, h uintptr, buf uintptr, buflen size_t, res uintptr, err uintptr) int32 { /* gethostbyaddr_r.c:10:5: */
+ if __ccgo_strace {
+ trc("tls=%v a=%v l=%v af=%v h=%v buf=%v buflen=%v res=%v err=%v, (%v:)", tls, a, l, af, h, buf, buflen, res, err, origin(2))
+ }
panic(todo(""))
//TODO bp := tls.Alloc(28)
//TODO defer tls.Free(28)
@@ -572,6 +644,9 @@ func Xgethostbyaddr_r(tls *TLS, a uintptr, l socklen_t, af int32, h uintptr, buf
// int getrlimit(int resource, struct rlimit *rlim);
func Xgetrlimit64(t *TLS, resource int32, rlim uintptr) int32 {
+ if __ccgo_strace {
+ trc("t=%v resource=%v rlim=%v, (%v:)", t, resource, rlim, origin(2))
+ }
if _, _, err := unix.Syscall(unix.SYS_GETRLIMIT, uintptr(resource), uintptr(rlim), 0); err != 0 {
t.setErrno(err)
return -1
@@ -606,6 +681,9 @@ func newFtsent(t *TLS, info int, path string, stat *unix.Stat_t, err syscall.Err
// DIR *opendir(const char *name);
func Xopendir(t *TLS, name uintptr) uintptr {
+ if __ccgo_strace {
+ trc("t=%v name=%v, (%v:)", t, name, origin(2))
+ }
p := Xmalloc(t, uint32(unsafe.Sizeof(darwinDir{})))
if p == 0 {
panic("OOM")
@@ -632,6 +710,9 @@ func Xopendir(t *TLS, name uintptr) uintptr {
// int chflags(const char *path, u_int flags);
func Xchflags(t *TLS, path uintptr, flags uint32) int32 {
+ if __ccgo_strace {
+ trc("t=%v path=%v flags=%v, (%v:)", t, path, flags, origin(2))
+ }
if err := unix.Chflags(GoString(path), int(flags)); err != nil {
if dmesgs {
dmesg("%v: %v FAIL", origin(1), err)
diff --git a/vendor/modernc.org/libc/libc_freebsd_arm64.go b/vendor/modernc.org/libc/libc_freebsd_arm64.go
index 48f7fd78..e2e31e0b 100644
--- a/vendor/modernc.org/libc/libc_freebsd_arm64.go
+++ b/vendor/modernc.org/libc/libc_freebsd_arm64.go
@@ -24,6 +24,9 @@ type (
// int sigaction(int signum, const struct sigaction *act, struct sigaction *oldact);
func Xsigaction(t *TLS, signum int32, act, oldact uintptr) int32 {
+ if __ccgo_strace {
+ trc("t=%v signum=%v oldact=%v, (%v:)", t, signum, oldact, origin(2))
+ }
if _, _, err := unix.Syscall(unix.SYS_SIGACTION, uintptr(signum), act, oldact); err != 0 {
t.setErrno(err)
return -1
@@ -34,6 +37,9 @@ func Xsigaction(t *TLS, signum int32, act, oldact uintptr) int32 {
// FILE *fopen64(const char *pathname, const char *mode);
func Xfopen64(t *TLS, pathname, mode uintptr) uintptr {
+ if __ccgo_strace {
+ trc("t=%v mode=%v, (%v:)", t, mode, origin(2))
+ }
m := strings.ReplaceAll(GoString(mode), "b", "")
var flags int
switch m {
@@ -73,6 +79,9 @@ func Xfopen64(t *TLS, pathname, mode uintptr) uintptr {
// int lstat(const char *pathname, struct stat *statbuf);
func Xlstat64(t *TLS, pathname, statbuf uintptr) int32 {
+ if __ccgo_strace {
+ trc("t=%v statbuf=%v, (%v:)", t, statbuf, origin(2))
+ }
if err := unix.Lstat(GoString(pathname), (*unix.Stat_t)(unsafe.Pointer(statbuf))); err != nil {
if dmesgs {
dmesg("%v: %q: %v FAIL", origin(1), GoString(pathname), err)
@@ -89,6 +98,9 @@ func Xlstat64(t *TLS, pathname, statbuf uintptr) int32 {
// int stat(const char *pathname, struct stat *statbuf);
func Xstat64(t *TLS, pathname, statbuf uintptr) int32 {
+ if __ccgo_strace {
+ trc("t=%v statbuf=%v, (%v:)", t, statbuf, origin(2))
+ }
if err := unix.Stat(GoString(pathname), (*unix.Stat_t)(unsafe.Pointer(statbuf))); err != nil {
if dmesgs {
dmesg("%v: %q: %v FAIL", origin(1), GoString(pathname), err)
@@ -105,6 +117,9 @@ func Xstat64(t *TLS, pathname, statbuf uintptr) int32 {
// int mkdir(const char *path, mode_t mode);
func Xmkdir(t *TLS, path uintptr, mode types.Mode_t) int32 {
+ if __ccgo_strace {
+ trc("t=%v path=%v mode=%v, (%v:)", t, path, mode, origin(2))
+ }
if err := unix.Mkdir(GoString(path), uint32(mode)); err != nil {
if dmesgs {
dmesg("%v: %q: %v FAIL", origin(1), GoString(path), err)
@@ -121,6 +136,9 @@ func Xmkdir(t *TLS, path uintptr, mode types.Mode_t) int32 {
// int access(const char *pathname, int mode);
func Xaccess(t *TLS, pathname uintptr, mode int32) int32 {
+ if __ccgo_strace {
+ trc("t=%v pathname=%v mode=%v, (%v:)", t, pathname, mode, origin(2))
+ }
if err := unix.Access(GoString(pathname), uint32(mode)); err != nil {
if dmesgs {
dmesg("%v: %q %#o: %v FAIL", origin(1), GoString(pathname), mode, err)
@@ -137,6 +155,9 @@ func Xaccess(t *TLS, pathname uintptr, mode int32) int32 {
// int unlink(const char *pathname);
func Xunlink(t *TLS, pathname uintptr) int32 {
+ if __ccgo_strace {
+ trc("t=%v pathname=%v, (%v:)", t, pathname, origin(2))
+ }
if err := unix.Unlink(GoString(pathname)); err != nil {
if dmesgs {
dmesg("%v: %q: %v", origin(1), GoString(pathname), err)
@@ -153,6 +174,9 @@ func Xunlink(t *TLS, pathname uintptr) int32 {
// ssize_t readlink(const char *restrict path, char *restrict buf, size_t bufsize);
func Xreadlink(t *TLS, path, buf uintptr, bufsize types.Size_t) types.Ssize_t {
+ if __ccgo_strace {
+ trc("t=%v buf=%v bufsize=%v, (%v:)", t, buf, bufsize, origin(2))
+ }
var n int
var err error
switch {
@@ -177,6 +201,9 @@ func Xreadlink(t *TLS, path, buf uintptr, bufsize types.Size_t) types.Ssize_t {
// int symlink(const char *target, const char *linkpath);
func Xsymlink(t *TLS, target, linkpath uintptr) int32 {
+ if __ccgo_strace {
+ trc("t=%v linkpath=%v, (%v:)", t, linkpath, origin(2))
+ }
if err := unix.Symlink(GoString(target), GoString(linkpath)); err != nil {
if dmesgs {
dmesg("%v: %v FAIL", origin(1), err)
@@ -193,6 +220,9 @@ func Xsymlink(t *TLS, target, linkpath uintptr) int32 {
// int chmod(const char *pathname, mode_t mode)
func Xchmod(t *TLS, pathname uintptr, mode types.Mode_t) int32 {
+ if __ccgo_strace {
+ trc("t=%v pathname=%v mode=%v, (%v:)", t, pathname, mode, origin(2))
+ }
if err := unix.Chmod(GoString(pathname), uint32(mode)); err != nil {
if dmesgs {
dmesg("%v: %q %#o: %v FAIL", origin(1), GoString(pathname), mode, err)
@@ -209,6 +239,9 @@ func Xchmod(t *TLS, pathname uintptr, mode types.Mode_t) int32 {
// time_t time(time_t *tloc);
func Xtime(t *TLS, tloc uintptr) time.Time_t {
+ if __ccgo_strace {
+ trc("t=%v tloc=%v, (%v:)", t, tloc, origin(2))
+ }
panic(todo(""))
// n := time.Now().UTC().Unix()
// if tloc != 0 {
@@ -219,6 +252,9 @@ func Xtime(t *TLS, tloc uintptr) time.Time_t {
// int utimes(const char *filename, const struct timeval times[2]);
func Xutimes(t *TLS, filename, times uintptr) int32 {
+ if __ccgo_strace {
+ trc("t=%v times=%v, (%v:)", t, times, origin(2))
+ }
var a []unix.Timeval
if times != 0 {
a = make([]unix.Timeval, 2)
@@ -241,6 +277,9 @@ func Xutimes(t *TLS, filename, times uintptr) int32 {
// int fstat(int fd, struct stat *statbuf);
func Xfstat64(t *TLS, fd int32, statbuf uintptr) int32 {
+ if __ccgo_strace {
+ trc("t=%v fd=%v statbuf=%v, (%v:)", t, fd, statbuf, origin(2))
+ }
if err := unix.Fstat(int(fd), (*unix.Stat_t)(unsafe.Pointer(statbuf))); err != nil {
if dmesgs {
dmesg("%v: fd %d: %v FAIL", origin(1), fd, err)
@@ -257,6 +296,9 @@ func Xfstat64(t *TLS, fd int32, statbuf uintptr) int32 {
// off64_t lseek64(int fd, off64_t offset, int whence);
func Xlseek64(t *TLS, fd int32, offset types.Off_t, whence int32) types.Off_t {
+ if __ccgo_strace {
+ trc("t=%v fd=%v offset=%v whence=%v, (%v:)", t, fd, offset, whence, origin(2))
+ }
n, err := unix.Seek(int(fd), int64(offset), int(whence))
if err != nil {
if dmesgs {
@@ -273,6 +315,9 @@ func Xlseek64(t *TLS, fd int32, offset types.Off_t, whence int32) types.Off_t {
}
func Xfcntl64(t *TLS, fd, cmd int32, args uintptr) int32 {
+ if __ccgo_strace {
+ trc("t=%v cmd=%v args=%v, (%v:)", t, cmd, args, origin(2))
+ }
var arg uintptr
if args != 0 {
arg = *(*uintptr)(unsafe.Pointer(args))
@@ -294,6 +339,9 @@ func Xfcntl64(t *TLS, fd, cmd int32, args uintptr) int32 {
// int rename(const char *oldpath, const char *newpath);
func Xrename(t *TLS, oldpath, newpath uintptr) int32 {
+ if __ccgo_strace {
+ trc("t=%v newpath=%v, (%v:)", t, newpath, origin(2))
+ }
if err := unix.Rename(GoString(oldpath), GoString(newpath)); err != nil {
if dmesgs {
dmesg("%v: %v FAIL", origin(1), err)
@@ -310,6 +358,9 @@ func Xrename(t *TLS, oldpath, newpath uintptr) int32 {
// int mknod(const char *pathname, mode_t mode, dev_t dev);
func Xmknod(t *TLS, pathname uintptr, mode types.Mode_t, dev types.Dev_t) int32 {
+ if __ccgo_strace {
+ trc("t=%v pathname=%v mode=%v dev=%v, (%v:)", t, pathname, mode, dev, origin(2))
+ }
panic(todo(""))
// if _, _, err := unix.Syscall(unix.SYS_MKNOD, pathname, uintptr(mode), uintptr(dev)); err != 0 {
// t.setErrno(err)
@@ -321,6 +372,9 @@ func Xmknod(t *TLS, pathname uintptr, mode types.Mode_t, dev types.Dev_t) int32
// int utime(const char *filename, const struct utimbuf *times);
func Xutime(t *TLS, filename, times uintptr) int32 {
+ if __ccgo_strace {
+ trc("t=%v times=%v, (%v:)", t, times, origin(2))
+ }
var a []unix.Timeval
if times != 0 {
a = make([]unix.Timeval, 2)
@@ -343,6 +397,9 @@ func Xutime(t *TLS, filename, times uintptr) int32 {
// int chown(const char *pathname, uid_t owner, gid_t group);
func Xchown(t *TLS, pathname uintptr, owner types.Uid_t, group types.Gid_t) int32 {
+ if __ccgo_strace {
+ trc("t=%v pathname=%v owner=%v group=%v, (%v:)", t, pathname, owner, group, origin(2))
+ }
if _, _, err := unix.Syscall(unix.SYS_CHOWN, pathname, uintptr(owner), uintptr(group)); err != 0 {
t.setErrno(err)
return -1
@@ -353,6 +410,9 @@ func Xchown(t *TLS, pathname uintptr, owner types.Uid_t, group types.Gid_t) int3
// int link(const char *oldpath, const char *newpath);
func Xlink(t *TLS, oldpath, newpath uintptr) int32 {
+ if __ccgo_strace {
+ trc("t=%v newpath=%v, (%v:)", t, newpath, origin(2))
+ }
panic(todo(""))
// if _, _, err := unix.Syscall(unix.SYS_LINK, oldpath, newpath, 0); err != 0 {
// t.setErrno(err)
@@ -364,6 +424,9 @@ func Xlink(t *TLS, oldpath, newpath uintptr) int32 {
// int dup2(int oldfd, int newfd);
func Xdup2(t *TLS, oldfd, newfd int32) int32 {
+ if __ccgo_strace {
+ trc("t=%v newfd=%v, (%v:)", t, newfd, origin(2))
+ }
panic(todo(""))
// n, _, err := unix.Syscall(unix.SYS_DUP2, uintptr(oldfd), uintptr(newfd), 0)
// if err != 0 {
@@ -376,6 +439,9 @@ func Xdup2(t *TLS, oldfd, newfd int32) int32 {
// unsigned int alarm(unsigned int seconds);
func Xalarm(t *TLS, seconds uint32) uint32 {
+ if __ccgo_strace {
+ trc("t=%v seconds=%v, (%v:)", t, seconds, origin(2))
+ }
panic(todo(""))
// n, _, err := unix.Syscall(unix.SYS_ALARM, uintptr(seconds), 0, 0)
// if err != 0 {
@@ -386,6 +452,9 @@ func Xalarm(t *TLS, seconds uint32) uint32 {
}
func Xgetnameinfo(tls *TLS, sa1 uintptr, sl socklen_t, node uintptr, nodelen size_t, serv uintptr, servlen size_t, flags int32) int32 { /* getnameinfo.c:125:5: */
+ if __ccgo_strace {
+ trc("tls=%v sa1=%v sl=%v node=%v nodelen=%v serv=%v servlen=%v flags=%v, (%v:)", tls, sa1, sl, node, nodelen, serv, servlen, flags, origin(2))
+ }
panic(todo(""))
//TODO bp := tls.Alloc(347)
//TODO defer tls.Free(347)
@@ -485,6 +554,9 @@ func Xgetnameinfo(tls *TLS, sa1 uintptr, sl socklen_t, node uintptr, nodelen siz
}
func Xgethostbyaddr_r(tls *TLS, a uintptr, l socklen_t, af int32, h uintptr, buf uintptr, buflen size_t, res uintptr, err uintptr) int32 { /* gethostbyaddr_r.c:10:5: */
+ if __ccgo_strace {
+ trc("tls=%v a=%v l=%v af=%v h=%v buf=%v buflen=%v res=%v err=%v, (%v:)", tls, a, l, af, h, buf, buflen, res, err, origin(2))
+ }
panic(todo(""))
//TODO bp := tls.Alloc(28)
//TODO defer tls.Free(28)
@@ -572,6 +644,9 @@ func Xgethostbyaddr_r(tls *TLS, a uintptr, l socklen_t, af int32, h uintptr, buf
// int getrlimit(int resource, struct rlimit *rlim);
func Xgetrlimit64(t *TLS, resource int32, rlim uintptr) int32 {
+ if __ccgo_strace {
+ trc("t=%v resource=%v rlim=%v, (%v:)", t, resource, rlim, origin(2))
+ }
if _, _, err := unix.Syscall(unix.SYS_GETRLIMIT, uintptr(resource), uintptr(rlim), 0); err != 0 {
t.setErrno(err)
return -1
@@ -606,6 +681,9 @@ func newFtsent(t *TLS, info int, path string, stat *unix.Stat_t, err syscall.Err
// DIR *opendir(const char *name);
func Xopendir(t *TLS, name uintptr) uintptr {
+ if __ccgo_strace {
+ trc("t=%v name=%v, (%v:)", t, name, origin(2))
+ }
p := Xmalloc(t, uint64(unsafe.Sizeof(darwinDir{})))
if p == 0 {
panic("OOM")
@@ -632,6 +710,9 @@ func Xopendir(t *TLS, name uintptr) uintptr {
// int chflags(const char *path, u_int flags);
func Xchflags(t *TLS, path uintptr, flags uint64) int32 {
+ if __ccgo_strace {
+ trc("t=%v path=%v flags=%v, (%v:)", t, path, flags, origin(2))
+ }
if err := unix.Chflags(GoString(path), int(flags)); err != nil {
if dmesgs {
dmesg("%v: %v FAIL", origin(1), err)
diff --git a/vendor/modernc.org/libc/libc_linux.go b/vendor/modernc.org/libc/libc_linux.go
index 08f67be8..9638a87f 100644
--- a/vendor/modernc.org/libc/libc_linux.go
+++ b/vendor/modernc.org/libc/libc_linux.go
@@ -5,13 +5,14 @@
package libc // import "modernc.org/libc"
import (
- "encoding/hex"
+ // "encoding/hex"
"fmt"
+ "io"
"os"
"os/exec"
"path/filepath"
"runtime"
- "runtime/debug"
+ // "runtime/debug"
"syscall"
"time"
"unsafe"
@@ -37,6 +38,11 @@ import (
"modernc.org/libc/uuid/uuid"
)
+const (
+ // musl/src/internal/stdio_impl.h:16:#define F_EOF 16
+ m_F_EOF = 16
+)
+
var (
in6_addr_any in.In6_addr
_ = X__ctype_b_loc
@@ -49,10 +55,13 @@ type (
type file uintptr
-func (f file) fd() int32 { return (*stdio.FILE)(unsafe.Pointer(f)).F_fileno }
-func (f file) setFd(fd int32) { (*stdio.FILE)(unsafe.Pointer(f)).F_fileno = fd }
-func (f file) err() bool { return (*stdio.FILE)(unsafe.Pointer(f)).F_flags2&stdio.X_IO_ERR_SEEN != 0 }
-func (f file) setErr() { (*stdio.FILE)(unsafe.Pointer(f)).F_flags2 |= stdio.X_IO_ERR_SEEN }
+func (f file) fd() int32 { return (*stdio.FILE)(unsafe.Pointer(f)).F_fileno }
+func (f file) setFd(fd int32) { (*stdio.FILE)(unsafe.Pointer(f)).F_fileno = fd }
+func (f file) err() bool { return (*stdio.FILE)(unsafe.Pointer(f)).F_flags2&stdio.X_IO_ERR_SEEN != 0 }
+func (f file) setErr() { (*stdio.FILE)(unsafe.Pointer(f)).F_flags2 |= stdio.X_IO_ERR_SEEN }
+func (f file) flags() int32 { return (*stdio.FILE)(unsafe.Pointer(f)).F_flags }
+func (f file) orFlags(n int32) { (*stdio.FILE)(unsafe.Pointer(f)).F_flags |= n }
+func (f file) xorFlags(n int32) { (*stdio.FILE)(unsafe.Pointer(f)).F_flags ^= n }
func (f file) close(t *TLS) int32 {
r := Xclose(t, f.fd())
@@ -86,18 +95,27 @@ func fwrite(fd int32, b []byte) (int, error) {
// int fprintf(FILE *stream, const char *format, ...);
func Xfprintf(t *TLS, stream, format, args uintptr) int32 {
+ if __ccgo_strace {
+ trc("t=%v args=%v, (%v:)", t, args, origin(2))
+ }
n, _ := fwrite((*stdio.FILE)(unsafe.Pointer(stream)).F_fileno, printf(format, args))
return int32(n)
}
// int usleep(useconds_t usec);
func Xusleep(t *TLS, usec types.X__useconds_t) int32 {
+ if __ccgo_strace {
+ trc("t=%v usec=%v, (%v:)", t, usec, origin(2))
+ }
time.Sleep(time.Microsecond * time.Duration(usec))
return 0
}
// int getrusage(int who, struct rusage *usage);
func Xgetrusage(t *TLS, who int32, usage uintptr) int32 {
+ if __ccgo_strace {
+ trc("t=%v who=%v usage=%v, (%v:)", t, who, usage, origin(2))
+ }
if _, _, err := unix.Syscall(unix.SYS_GETRUSAGE, uintptr(who), usage, 0); err != 0 {
t.setErrno(err)
return -1
@@ -108,16 +126,25 @@ func Xgetrusage(t *TLS, who int32, usage uintptr) int32 {
// int lstat(const char *pathname, struct stat *statbuf);
func Xlstat(t *TLS, pathname, statbuf uintptr) int32 {
+ if __ccgo_strace {
+ trc("t=%v statbuf=%v, (%v:)", t, statbuf, origin(2))
+ }
return Xlstat64(t, pathname, statbuf)
}
// int stat(const char *pathname, struct stat *statbuf);
func Xstat(t *TLS, pathname, statbuf uintptr) int32 {
+ if __ccgo_strace {
+ trc("t=%v statbuf=%v, (%v:)", t, statbuf, origin(2))
+ }
return Xstat64(t, pathname, statbuf)
}
// int chdir(const char *path);
func Xchdir(t *TLS, path uintptr) int32 {
+ if __ccgo_strace {
+ trc("t=%v path=%v, (%v:)", t, path, origin(2))
+ }
if _, _, err := unix.Syscall(unix.SYS_CHDIR, path, 0, 0); err != 0 {
t.setErrno(err)
return -1
@@ -167,11 +194,17 @@ func Xlocaltime_r(_ *TLS, timep, result uintptr) uintptr {
// int open(const char *pathname, int flags, ...);
func Xopen(t *TLS, pathname uintptr, flags int32, args uintptr) int32 {
+ if __ccgo_strace {
+ trc("t=%v pathname=%v flags=%v args=%v, (%v:)", t, pathname, flags, args, origin(2))
+ }
return Xopen64(t, pathname, flags, args)
}
// int open(const char *pathname, int flags, ...);
func Xopen64(t *TLS, pathname uintptr, flags int32, args uintptr) int32 {
+ if __ccgo_strace {
+ trc("t=%v pathname=%v flags=%v args=%v, (%v:)", t, pathname, flags, args, origin(2))
+ }
//TODO- flags |= fcntl.O_LARGEFILE
var mode types.Mode_t
if args != 0 {
@@ -195,6 +228,9 @@ func Xopen64(t *TLS, pathname uintptr, flags int32, args uintptr) int32 {
// int openat(int dirfd, const char *pathname, int flags, mode_t mode);
func Xopenat(t *TLS, dirfd int32, pathname uintptr, flags int32, mode types.Mode_t) int32 {
+ if __ccgo_strace {
+ trc("t=%v dirfd=%v pathname=%v flags=%v mode=%v, (%v:)", t, dirfd, pathname, flags, mode, origin(2))
+ }
// From golang.org/x/sys/unix/zsyscall_linux.go
fd, _, err := unix.Syscall6(unix.SYS_OPENAT, uintptr(dirfd), pathname, uintptr(flags), uintptr(mode), 0, 0)
if err != 0 {
@@ -207,6 +243,9 @@ func Xopenat(t *TLS, dirfd int32, pathname uintptr, flags int32, mode types.Mode
// off_t lseek(int fd, off_t offset, int whence);
func Xlseek(t *TLS, fd int32, offset types.Off_t, whence int32) types.Off_t {
+ if __ccgo_strace {
+ trc("t=%v fd=%v offset=%v whence=%v, (%v:)", t, fd, offset, whence, origin(2))
+ }
return types.Off_t(Xlseek64(t, fd, offset, whence))
}
@@ -227,6 +266,9 @@ var fsyncStatbuf stat.Stat
// int fsync(int fd);
func Xfsync(t *TLS, fd int32) int32 {
+ if __ccgo_strace {
+ trc("t=%v fd=%v, (%v:)", t, fd, origin(2))
+ }
if noFsync {
// Simulate -DSQLITE_NO_SYNC for sqlite3 testfixture, see function full_sync in sqlite3.c
return Xfstat(t, fd, uintptr(unsafe.Pointer(&fsyncStatbuf)))
@@ -245,6 +287,9 @@ func Xfsync(t *TLS, fd int32) int32 {
// long sysconf(int name);
func Xsysconf(t *TLS, name int32) long {
+ if __ccgo_strace {
+ trc("t=%v name=%v, (%v:)", t, name, origin(2))
+ }
switch name {
case unistd.X_SC_PAGESIZE:
return long(unix.Getpagesize())
@@ -261,6 +306,9 @@ func Xsysconf(t *TLS, name int32) long {
// int close(int fd);
func Xclose(t *TLS, fd int32) int32 {
+ if __ccgo_strace {
+ trc("t=%v fd=%v, (%v:)", t, fd, origin(2))
+ }
if _, _, err := unix.Syscall(unix.SYS_CLOSE, uintptr(fd), 0, 0); err != 0 {
t.setErrno(err)
return -1
@@ -274,6 +322,9 @@ func Xclose(t *TLS, fd int32) int32 {
// char *getcwd(char *buf, size_t size);
func Xgetcwd(t *TLS, buf uintptr, size types.Size_t) uintptr {
+ if __ccgo_strace {
+ trc("t=%v buf=%v size=%v, (%v:)", t, buf, size, origin(2))
+ }
n, _, err := unix.Syscall(unix.SYS_GETCWD, buf, uintptr(size), 0)
if err != 0 {
t.setErrno(err)
@@ -288,21 +339,33 @@ func Xgetcwd(t *TLS, buf uintptr, size types.Size_t) uintptr {
// int fstat(int fd, struct stat *statbuf);
func Xfstat(t *TLS, fd int32, statbuf uintptr) int32 {
+ if __ccgo_strace {
+ trc("t=%v fd=%v statbuf=%v, (%v:)", t, fd, statbuf, origin(2))
+ }
return Xfstat64(t, fd, statbuf)
}
// int ftruncate(int fd, off_t length);
func Xftruncate(t *TLS, fd int32, length types.Off_t) int32 {
+ if __ccgo_strace {
+ trc("t=%v fd=%v length=%v, (%v:)", t, fd, length, origin(2))
+ }
return Xftruncate64(t, fd, length)
}
// int fcntl(int fd, int cmd, ... /* arg */ );
func Xfcntl(t *TLS, fd, cmd int32, args uintptr) int32 {
+ if __ccgo_strace {
+ trc("t=%v cmd=%v args=%v, (%v:)", t, cmd, args, origin(2))
+ }
return Xfcntl64(t, fd, cmd, args)
}
// ssize_t read(int fd, void *buf, size_t count);
func Xread(t *TLS, fd int32, buf uintptr, count types.Size_t) types.Ssize_t {
+ if __ccgo_strace {
+ trc("t=%v fd=%v buf=%v count=%v, (%v:)", t, fd, buf, count, origin(2))
+ }
n, _, err := unix.Syscall(unix.SYS_READ, uintptr(fd), buf, uintptr(count))
if err != 0 {
t.setErrno(err)
@@ -318,6 +381,9 @@ func Xread(t *TLS, fd int32, buf uintptr, count types.Size_t) types.Ssize_t {
// ssize_t write(int fd, const void *buf, size_t count);
func Xwrite(t *TLS, fd int32, buf uintptr, count types.Size_t) types.Ssize_t {
+ if __ccgo_strace {
+ trc("t=%v fd=%v buf=%v count=%v, (%v:)", t, fd, buf, count, origin(2))
+ }
const retry = 5
var err syscall.Errno
for i := 0; i < retry; i++ {
@@ -343,6 +409,9 @@ func Xwrite(t *TLS, fd int32, buf uintptr, count types.Size_t) types.Ssize_t {
// int fchmod(int fd, mode_t mode);
func Xfchmod(t *TLS, fd int32, mode types.Mode_t) int32 {
+ if __ccgo_strace {
+ trc("t=%v fd=%v mode=%v, (%v:)", t, fd, mode, origin(2))
+ }
if _, _, err := unix.Syscall(unix.SYS_FCHMOD, uintptr(fd), uintptr(mode), 0); err != 0 {
t.setErrno(err)
return -1
@@ -356,6 +425,9 @@ func Xfchmod(t *TLS, fd int32, mode types.Mode_t) int32 {
// int fchmodat(int dirfd, const char *pathname, mode_t mode, int flags);
func Xfchmodat(t *TLS, dirfd int32, pathname uintptr, mode types.Mode_t, flags int32) int32 {
+ if __ccgo_strace {
+ trc("t=%v dirfd=%v pathname=%v mode=%v flags=%v, (%v:)", t, dirfd, pathname, mode, flags, origin(2))
+ }
// From golang.org/x/sys/unix/syscall_linux.go
// Linux fchmodat doesn't support the flags parameter. Mimick glibc's behavior
// and check the flags. Otherwise the mode would be applied to the symlink
@@ -379,6 +451,9 @@ func Xfchmodat(t *TLS, dirfd int32, pathname uintptr, mode types.Mode_t, flags i
// int fchown(int fd, uid_t owner, gid_t group);
func Xfchown(t *TLS, fd int32, owner types.Uid_t, group types.Gid_t) int32 {
+ if __ccgo_strace {
+ trc("t=%v fd=%v owner=%v group=%v, (%v:)", t, fd, owner, group, origin(2))
+ }
if _, _, err := unix.Syscall(unix.SYS_FCHOWN, uintptr(fd), uintptr(owner), uintptr(group)); err != 0 {
t.setErrno(err)
return -1
@@ -389,12 +464,18 @@ func Xfchown(t *TLS, fd int32, owner types.Uid_t, group types.Gid_t) int32 {
// uid_t geteuid(void);
func Xgeteuid(t *TLS) types.Uid_t {
+ if __ccgo_strace {
+ trc("t=%v, (%v:)", t, origin(2))
+ }
n, _, _ := unix.Syscall(unix.SYS_GETEUID, 0, 0, 0)
return types.Uid_t(n)
}
// int munmap(void *addr, size_t length);
func Xmunmap(t *TLS, addr uintptr, length types.Size_t) int32 {
+ if __ccgo_strace {
+ trc("t=%v addr=%v length=%v, (%v:)", t, addr, length, origin(2))
+ }
if _, _, err := unix.Syscall(unix.SYS_MUNMAP, addr, uintptr(length), 0); err != 0 {
t.setErrno(err)
return -1
@@ -405,6 +486,9 @@ func Xmunmap(t *TLS, addr uintptr, length types.Size_t) int32 {
// int gettimeofday(struct timeval *tv, struct timezone *tz);
func Xgettimeofday(t *TLS, tv, tz uintptr) int32 {
+ if __ccgo_strace {
+ trc("t=%v tz=%v, (%v:)", t, tz, origin(2))
+ }
if tz != 0 {
panic(todo(""))
}
@@ -422,6 +506,9 @@ func Xgettimeofday(t *TLS, tv, tz uintptr) int32 {
// int getsockopt(int sockfd, int level, int optname, void *optval, socklen_t *optlen);
func Xgetsockopt(t *TLS, sockfd, level, optname int32, optval, optlen uintptr) int32 {
+ if __ccgo_strace {
+ trc("t=%v optname=%v optlen=%v, (%v:)", t, optname, optlen, origin(2))
+ }
if _, _, err := unix.Syscall6(unix.SYS_GETSOCKOPT, uintptr(sockfd), uintptr(level), uintptr(optname), optval, optlen, 0); err != 0 {
t.setErrno(err)
return -1
@@ -432,6 +519,9 @@ func Xgetsockopt(t *TLS, sockfd, level, optname int32, optval, optlen uintptr) i
// int setsockopt(int sockfd, int level, int optname, const void *optval, socklen_t optlen);
func Xsetsockopt(t *TLS, sockfd, level, optname int32, optval uintptr, optlen socket.Socklen_t) int32 {
+ if __ccgo_strace {
+ trc("t=%v optname=%v optval=%v optlen=%v, (%v:)", t, optname, optval, optlen, origin(2))
+ }
if _, _, err := unix.Syscall6(unix.SYS_SETSOCKOPT, uintptr(sockfd), uintptr(level), uintptr(optname), optval, uintptr(optlen), 0); err != 0 {
t.setErrno(err)
return -1
@@ -442,6 +532,9 @@ func Xsetsockopt(t *TLS, sockfd, level, optname int32, optval uintptr, optlen so
// int ioctl(int fd, unsigned long request, ...);
func Xioctl(t *TLS, fd int32, request ulong, va uintptr) int32 {
+ if __ccgo_strace {
+ trc("t=%v fd=%v request=%v va=%v, (%v:)", t, fd, request, va, origin(2))
+ }
var argp uintptr
if va != 0 {
argp = VaUintptr(&va)
@@ -457,6 +550,9 @@ func Xioctl(t *TLS, fd int32, request ulong, va uintptr) int32 {
// int getsockname(int sockfd, struct sockaddr *addr, socklen_t *addrlen);
func Xgetsockname(t *TLS, sockfd int32, addr, addrlen uintptr) int32 {
+ if __ccgo_strace {
+ trc("t=%v sockfd=%v addrlen=%v, (%v:)", t, sockfd, addrlen, origin(2))
+ }
if _, _, err := unix.Syscall(unix.SYS_GETSOCKNAME, uintptr(sockfd), addr, addrlen); err != 0 {
// if dmesgs {
// dmesg("%v: fd %v: %v", origin(1), sockfd, err)
@@ -470,6 +566,9 @@ func Xgetsockname(t *TLS, sockfd int32, addr, addrlen uintptr) int32 {
// int select(int nfds, fd_set *readfds, fd_set *writefds, fd_set *exceptfds, struct timeval *timeout);
func Xselect(t *TLS, nfds int32, readfds, writefds, exceptfds, timeout uintptr) int32 {
+ if __ccgo_strace {
+ trc("t=%v nfds=%v timeout=%v, (%v:)", t, nfds, timeout, origin(2))
+ }
n, err := unix.Select(
int(nfds),
(*unix.FdSet)(unsafe.Pointer(readfds)),
@@ -487,6 +586,9 @@ func Xselect(t *TLS, nfds int32, readfds, writefds, exceptfds, timeout uintptr)
// int mkfifo(const char *pathname, mode_t mode);
func Xmkfifo(t *TLS, pathname uintptr, mode types.Mode_t) int32 {
+ if __ccgo_strace {
+ trc("t=%v pathname=%v mode=%v, (%v:)", t, pathname, mode, origin(2))
+ }
if err := unix.Mkfifo(GoString(pathname), mode); err != nil {
t.setErrno(err)
return -1
@@ -497,12 +599,18 @@ func Xmkfifo(t *TLS, pathname uintptr, mode types.Mode_t) int32 {
// mode_t umask(mode_t mask);
func Xumask(t *TLS, mask types.Mode_t) types.Mode_t {
+ if __ccgo_strace {
+ trc("t=%v mask=%v, (%v:)", t, mask, origin(2))
+ }
n, _, _ := unix.Syscall(unix.SYS_UMASK, uintptr(mask), 0, 0)
return types.Mode_t(n)
}
// int execvp(const char *file, char *const argv[]);
func Xexecvp(t *TLS, file, argv uintptr) int32 {
+ if __ccgo_strace {
+ trc("t=%v argv=%v, (%v:)", t, argv, origin(2))
+ }
if _, _, err := unix.Syscall(unix.SYS_EXECVE, file, argv, Environ()); err != 0 {
t.setErrno(err)
return -1
@@ -513,6 +621,9 @@ func Xexecvp(t *TLS, file, argv uintptr) int32 {
// pid_t waitpid(pid_t pid, int *wstatus, int options);
func Xwaitpid(t *TLS, pid types.Pid_t, wstatus uintptr, optname int32) types.Pid_t {
+ if __ccgo_strace {
+ trc("t=%v pid=%v wstatus=%v optname=%v, (%v:)", t, pid, wstatus, optname, origin(2))
+ }
n, _, err := unix.Syscall6(unix.SYS_WAIT4, uintptr(pid), wstatus, uintptr(optname), 0, 0, 0)
if err != 0 {
t.setErrno(err)
@@ -524,6 +635,9 @@ func Xwaitpid(t *TLS, pid types.Pid_t, wstatus uintptr, optname int32) types.Pid
// int uname(struct utsname *buf);
func Xuname(t *TLS, buf uintptr) int32 {
+ if __ccgo_strace {
+ trc("t=%v buf=%v, (%v:)", t, buf, origin(2))
+ }
if _, _, err := unix.Syscall(unix.SYS_UNAME, buf, 0, 0); err != 0 {
t.setErrno(err)
return -1
@@ -534,6 +648,9 @@ func Xuname(t *TLS, buf uintptr) int32 {
// ssize_t recv(int sockfd, void *buf, size_t len, int flags);
func Xrecv(t *TLS, sockfd int32, buf uintptr, len types.Size_t, flags int32) types.Ssize_t {
+ if __ccgo_strace {
+ trc("t=%v sockfd=%v buf=%v len=%v flags=%v, (%v:)", t, sockfd, buf, len, flags, origin(2))
+ }
n, _, err := unix.Syscall6(unix.SYS_RECVFROM, uintptr(sockfd), buf, uintptr(len), uintptr(flags), 0, 0)
if err != 0 {
t.setErrno(err)
@@ -545,6 +662,9 @@ func Xrecv(t *TLS, sockfd int32, buf uintptr, len types.Size_t, flags int32) typ
// ssize_t send(int sockfd, const void *buf, size_t len, int flags);
func Xsend(t *TLS, sockfd int32, buf uintptr, len types.Size_t, flags int32) types.Ssize_t {
+ if __ccgo_strace {
+ trc("t=%v sockfd=%v buf=%v len=%v flags=%v, (%v:)", t, sockfd, buf, len, flags, origin(2))
+ }
n, _, err := unix.Syscall6(unix.SYS_SENDTO, uintptr(sockfd), buf, uintptr(len), uintptr(flags), 0, 0)
if err != 0 {
t.setErrno(err)
@@ -556,6 +676,9 @@ func Xsend(t *TLS, sockfd int32, buf uintptr, len types.Size_t, flags int32) typ
// int shutdown(int sockfd, int how);
func Xshutdown(t *TLS, sockfd, how int32) int32 {
+ if __ccgo_strace {
+ trc("t=%v how=%v, (%v:)", t, how, origin(2))
+ }
if _, _, err := unix.Syscall(unix.SYS_SHUTDOWN, uintptr(sockfd), uintptr(how), 0); err != 0 {
t.setErrno(err)
return -1
@@ -566,6 +689,9 @@ func Xshutdown(t *TLS, sockfd, how int32) int32 {
// int getpeername(int sockfd, struct sockaddr *addr, socklen_t *addrlen);
func Xgetpeername(t *TLS, sockfd int32, addr uintptr, addrlen uintptr) int32 {
+ if __ccgo_strace {
+ trc("t=%v sockfd=%v addr=%v addrlen=%v, (%v:)", t, sockfd, addr, addrlen, origin(2))
+ }
if _, _, err := unix.Syscall(unix.SYS_GETPEERNAME, uintptr(sockfd), addr, uintptr(addrlen)); err != 0 {
t.setErrno(err)
return -1
@@ -576,6 +702,9 @@ func Xgetpeername(t *TLS, sockfd int32, addr uintptr, addrlen uintptr) int32 {
// int socket(int domain, int type, int protocol);
func Xsocket(t *TLS, domain, type1, protocol int32) int32 {
+ if __ccgo_strace {
+ trc("t=%v protocol=%v, (%v:)", t, protocol, origin(2))
+ }
n, _, err := unix.Syscall(unix.SYS_SOCKET, uintptr(domain), uintptr(type1), uintptr(protocol))
if err != 0 {
t.setErrno(err)
@@ -587,6 +716,9 @@ func Xsocket(t *TLS, domain, type1, protocol int32) int32 {
// int bind(int sockfd, const struct sockaddr *addr, socklen_t addrlen);
func Xbind(t *TLS, sockfd int32, addr uintptr, addrlen uint32) int32 {
+ if __ccgo_strace {
+ trc("t=%v sockfd=%v addr=%v addrlen=%v, (%v:)", t, sockfd, addr, addrlen, origin(2))
+ }
n, _, err := unix.Syscall(unix.SYS_BIND, uintptr(sockfd), addr, uintptr(addrlen))
if err != 0 {
t.setErrno(err)
@@ -598,6 +730,9 @@ func Xbind(t *TLS, sockfd int32, addr uintptr, addrlen uint32) int32 {
// int connect(int sockfd, const struct sockaddr *addr, socklen_t addrlen);
func Xconnect(t *TLS, sockfd int32, addr uintptr, addrlen uint32) int32 {
+ if __ccgo_strace {
+ trc("t=%v sockfd=%v addr=%v addrlen=%v, (%v:)", t, sockfd, addr, addrlen, origin(2))
+ }
if _, _, err := unix.Syscall(unix.SYS_CONNECT, uintptr(sockfd), addr, uintptr(addrlen)); err != 0 {
t.setErrno(err)
return -1
@@ -608,6 +743,9 @@ func Xconnect(t *TLS, sockfd int32, addr uintptr, addrlen uint32) int32 {
// int listen(int sockfd, int backlog);
func Xlisten(t *TLS, sockfd, backlog int32) int32 {
+ if __ccgo_strace {
+ trc("t=%v backlog=%v, (%v:)", t, backlog, origin(2))
+ }
if _, _, err := unix.Syscall(unix.SYS_LISTEN, uintptr(sockfd), uintptr(backlog), 0); err != 0 {
t.setErrno(err)
return -1
@@ -618,6 +756,9 @@ func Xlisten(t *TLS, sockfd, backlog int32) int32 {
// int accept(int sockfd, struct sockaddr *addr, socklen_t *addrlen);
func Xaccept(t *TLS, sockfd int32, addr uintptr, addrlen uintptr) int32 {
+ if __ccgo_strace {
+ trc("t=%v sockfd=%v addr=%v addrlen=%v, (%v:)", t, sockfd, addr, addrlen, origin(2))
+ }
n, _, err := unix.Syscall6(unix.SYS_ACCEPT4, uintptr(sockfd), addr, uintptr(addrlen), 0, 0, 0)
if err != 0 {
t.setErrno(err)
@@ -629,26 +770,41 @@ func Xaccept(t *TLS, sockfd int32, addr uintptr, addrlen uintptr) int32 {
// int getrlimit(int resource, struct rlimit *rlim);
func Xgetrlimit(t *TLS, resource int32, rlim uintptr) int32 {
+ if __ccgo_strace {
+ trc("t=%v resource=%v rlim=%v, (%v:)", t, resource, rlim, origin(2))
+ }
return Xgetrlimit64(t, resource, rlim)
}
// int setrlimit(int resource, const struct rlimit *rlim);
func Xsetrlimit(t *TLS, resource int32, rlim uintptr) int32 {
+ if __ccgo_strace {
+ trc("t=%v resource=%v rlim=%v, (%v:)", t, resource, rlim, origin(2))
+ }
return Xsetrlimit64(t, resource, rlim)
}
// uid_t getuid(void);
func Xgetuid(t *TLS) types.Uid_t {
+ if __ccgo_strace {
+ trc("t=%v, (%v:)", t, origin(2))
+ }
return types.Uid_t(os.Getuid())
}
// pid_t getpid(void);
func Xgetpid(t *TLS) int32 {
+ if __ccgo_strace {
+ trc("t=%v, (%v:)", t, origin(2))
+ }
return int32(os.Getpid())
}
// int system(const char *command);
func Xsystem(t *TLS, command uintptr) int32 {
+ if __ccgo_strace {
+ trc("t=%v command=%v, (%v:)", t, command, origin(2))
+ }
s := GoString(command)
if command == 0 {
panic(todo(""))
@@ -668,26 +824,41 @@ func Xsystem(t *TLS, command uintptr) int32 {
// int setvbuf(FILE *stream, char *buf, int mode, size_t size);
func Xsetvbuf(t *TLS, stream, buf uintptr, mode int32, size types.Size_t) int32 {
+ if __ccgo_strace {
+ trc("t=%v buf=%v mode=%v size=%v, (%v:)", t, buf, mode, size, origin(2))
+ }
return 0 //TODO
}
// int raise(int sig);
func Xraise(t *TLS, sig int32) int32 {
+ if __ccgo_strace {
+ trc("t=%v sig=%v, (%v:)", t, sig, origin(2))
+ }
panic(todo(""))
}
// int backtrace(void **buffer, int size);
func Xbacktrace(t *TLS, buf uintptr, size int32) int32 {
+ if __ccgo_strace {
+ trc("t=%v buf=%v size=%v, (%v:)", t, buf, size, origin(2))
+ }
panic(todo(""))
}
// void backtrace_symbols_fd(void *const *buffer, int size, int fd);
func Xbacktrace_symbols_fd(t *TLS, buffer uintptr, size, fd int32) {
+ if __ccgo_strace {
+ trc("t=%v buffer=%v fd=%v, (%v:)", t, buffer, fd, origin(2))
+ }
panic(todo(""))
}
// int fileno(FILE *stream);
func Xfileno(t *TLS, stream uintptr) int32 {
+ if __ccgo_strace {
+ trc("t=%v stream=%v, (%v:)", t, stream, origin(2))
+ }
if stream == 0 {
t.setErrno(errno.EBADF)
return -1
@@ -755,11 +926,17 @@ func (f *ftstream) close(t *TLS) {
// FTS *fts_open(char * const *path_argv, int options, int (*compar)(const FTSENT **, const FTSENT **));
func Xfts_open(t *TLS, path_argv uintptr, options int32, compar uintptr) uintptr {
+ if __ccgo_strace {
+ trc("t=%v path_argv=%v options=%v compar=%v, (%v:)", t, path_argv, options, compar, origin(2))
+ }
return Xfts64_open(t, path_argv, options, compar)
}
// FTS *fts_open(char * const *path_argv, int options, int (*compar)(const FTSENT **, const FTSENT **));
func Xfts64_open(t *TLS, path_argv uintptr, options int32, compar uintptr) uintptr {
+ if __ccgo_strace {
+ trc("t=%v path_argv=%v options=%v compar=%v, (%v:)", t, path_argv, options, compar, origin(2))
+ }
f := &ftstream{}
var walk func(string)
@@ -864,11 +1041,17 @@ func Xfts64_open(t *TLS, path_argv uintptr, options int32, compar uintptr) uintp
// FTSENT *fts_read(FTS *ftsp);
func Xfts_read(t *TLS, ftsp uintptr) uintptr {
+ if __ccgo_strace {
+ trc("t=%v ftsp=%v, (%v:)", t, ftsp, origin(2))
+ }
return Xfts64_read(t, ftsp)
}
// FTSENT *fts_read(FTS *ftsp);
func Xfts64_read(t *TLS, ftsp uintptr) uintptr {
+ if __ccgo_strace {
+ trc("t=%v ftsp=%v, (%v:)", t, ftsp, origin(2))
+ }
f := getObject(ftsp).(*ftstream)
if f.x == len(f.s) {
t.setErrno(0)
@@ -885,11 +1068,17 @@ func Xfts64_read(t *TLS, ftsp uintptr) uintptr {
// int fts_close(FTS *ftsp);
func Xfts_close(t *TLS, ftsp uintptr) int32 {
+ if __ccgo_strace {
+ trc("t=%v ftsp=%v, (%v:)", t, ftsp, origin(2))
+ }
return Xfts64_close(t, ftsp)
}
// int fts_close(FTS *ftsp);
func Xfts64_close(t *TLS, ftsp uintptr) int32 {
+ if __ccgo_strace {
+ trc("t=%v ftsp=%v, (%v:)", t, ftsp, origin(2))
+ }
getObject(ftsp).(*ftstream).close(t)
removeObject(ftsp)
return 0
@@ -897,6 +1086,9 @@ func Xfts64_close(t *TLS, ftsp uintptr) int32 {
// void tzset (void);
func Xtzset(t *TLS) {
+ if __ccgo_strace {
+ trc("t=%v, (%v:)", t, origin(2))
+ }
//TODO
}
@@ -904,40 +1096,61 @@ var strerrorBuf [100]byte
// char *strerror(int errnum);
func Xstrerror(t *TLS, errnum int32) uintptr {
- if dmesgs {
- dmesg("%v: %v\n%s", origin(1), errnum, debug.Stack())
+ if __ccgo_strace {
+ trc("t=%v errnum=%v, (%v:)", t, errnum, origin(2))
}
+ // if dmesgs {
+ // dmesg("%v: %v\n%s", origin(1), errnum, debug.Stack())
+ // }
copy(strerrorBuf[:], fmt.Sprintf("strerror(%d)\x00", errnum))
return uintptr(unsafe.Pointer(&strerrorBuf[0]))
}
// void *dlopen(const char *filename, int flags);
func Xdlopen(t *TLS, filename uintptr, flags int32) uintptr {
+ if __ccgo_strace {
+ trc("t=%v filename=%v flags=%v, (%v:)", t, filename, flags, origin(2))
+ }
panic(todo("%q", GoString(filename)))
}
// char *dlerror(void);
func Xdlerror(t *TLS) uintptr {
+ if __ccgo_strace {
+ trc("t=%v, (%v:)", t, origin(2))
+ }
panic(todo(""))
}
// int dlclose(void *handle);
func Xdlclose(t *TLS, handle uintptr) int32 {
+ if __ccgo_strace {
+ trc("t=%v handle=%v, (%v:)", t, handle, origin(2))
+ }
panic(todo(""))
}
// void *dlsym(void *handle, const char *symbol);
func Xdlsym(t *TLS, handle, symbol uintptr) uintptr {
+ if __ccgo_strace {
+ trc("t=%v symbol=%v, (%v:)", t, symbol, origin(2))
+ }
panic(todo(""))
}
// void perror(const char *s);
func Xperror(t *TLS, s uintptr) {
+ if __ccgo_strace {
+ trc("t=%v s=%v, (%v:)", t, s, origin(2))
+ }
panic(todo(""))
}
// int pclose(FILE *stream);
func Xpclose(t *TLS, stream uintptr) int32 {
+ if __ccgo_strace {
+ trc("t=%v stream=%v, (%v:)", t, stream, origin(2))
+ }
panic(todo(""))
}
@@ -945,37 +1158,58 @@ var gai_strerrorBuf [100]byte
// const char *gai_strerror(int errcode);
func Xgai_strerror(t *TLS, errcode int32) uintptr {
+ if __ccgo_strace {
+ trc("t=%v errcode=%v, (%v:)", t, errcode, origin(2))
+ }
copy(gai_strerrorBuf[:], fmt.Sprintf("gai error %d\x00", errcode))
return uintptr(unsafe.Pointer(&gai_strerrorBuf))
}
// int tcgetattr(int fd, struct termios *termios_p);
func Xtcgetattr(t *TLS, fd int32, termios_p uintptr) int32 {
+ if __ccgo_strace {
+ trc("t=%v fd=%v termios_p=%v, (%v:)", t, fd, termios_p, origin(2))
+ }
panic(todo(""))
}
// int tcsetattr(int fd, int optional_actions, const struct termios *termios_p);
func Xtcsetattr(t *TLS, fd, optional_actions int32, termios_p uintptr) int32 {
+ if __ccgo_strace {
+ trc("t=%v optional_actions=%v termios_p=%v, (%v:)", t, optional_actions, termios_p, origin(2))
+ }
panic(todo(""))
}
// speed_t cfgetospeed(const struct termios *termios_p);
func Xcfgetospeed(t *TLS, termios_p uintptr) termios.Speed_t {
+ if __ccgo_strace {
+ trc("t=%v termios_p=%v, (%v:)", t, termios_p, origin(2))
+ }
panic(todo(""))
}
// int cfsetospeed(struct termios *termios_p, speed_t speed);
func Xcfsetospeed(t *TLS, termios_p uintptr, speed uint32) int32 {
+ if __ccgo_strace {
+ trc("t=%v termios_p=%v speed=%v, (%v:)", t, termios_p, speed, origin(2))
+ }
panic(todo(""))
}
// int cfsetispeed(struct termios *termios_p, speed_t speed);
func Xcfsetispeed(t *TLS, termios_p uintptr, speed uint32) int32 {
+ if __ccgo_strace {
+ trc("t=%v termios_p=%v speed=%v, (%v:)", t, termios_p, speed, origin(2))
+ }
panic(todo(""))
}
// pid_t fork(void);
func Xfork(t *TLS) int32 {
+ if __ccgo_strace {
+ trc("t=%v, (%v:)", t, origin(2))
+ }
t.setErrno(errno.ENOSYS)
return -1
}
@@ -984,21 +1218,33 @@ var emptyStr = [1]byte{}
// char *setlocale(int category, const char *locale);
func Xsetlocale(t *TLS, category int32, locale uintptr) uintptr {
+ if __ccgo_strace {
+ trc("t=%v category=%v locale=%v, (%v:)", t, category, locale, origin(2))
+ }
return uintptr(unsafe.Pointer(&emptyStr)) //TODO
}
// char *nl_langinfo(nl_item item);
func Xnl_langinfo(t *TLS, item langinfo.Nl_item) uintptr {
+ if __ccgo_strace {
+ trc("t=%v item=%v, (%v:)", t, item, origin(2))
+ }
return uintptr(unsafe.Pointer(&emptyStr)) //TODO
}
// FILE *popen(const char *command, const char *type);
func Xpopen(t *TLS, command, type1 uintptr) uintptr {
+ if __ccgo_strace {
+ trc("t=%v type1=%v, (%v:)", t, type1, origin(2))
+ }
panic(todo(""))
}
// char *realpath(const char *path, char *resolved_path);
func Xrealpath(t *TLS, path, resolved_path uintptr) uintptr {
+ if __ccgo_strace {
+ trc("t=%v resolved_path=%v, (%v:)", t, resolved_path, origin(2))
+ }
s, err := filepath.EvalSymlinks(GoString(path))
if err != nil {
if os.IsNotExist(err) {
@@ -1027,19 +1273,31 @@ func Xrealpath(t *TLS, path, resolved_path uintptr) uintptr {
// struct tm *gmtime_r(const time_t *timep, struct tm *result);
func Xgmtime_r(t *TLS, timep, result uintptr) uintptr {
+ if __ccgo_strace {
+ trc("t=%v result=%v, (%v:)", t, result, origin(2))
+ }
panic(todo(""))
}
// char *inet_ntoa(struct in_addr in);
func Xinet_ntoa(t *TLS, in1 in.In_addr) uintptr {
+ if __ccgo_strace {
+ trc("t=%v in1=%v, (%v:)", t, in1, origin(2))
+ }
panic(todo(""))
}
func X__ccgo_in6addr_anyp(t *TLS) uintptr {
+ if __ccgo_strace {
+ trc("t=%v, (%v:)", t, origin(2))
+ }
return uintptr(unsafe.Pointer(&in6_addr_any))
}
func Xabort(t *TLS) {
+ if __ccgo_strace {
+ trc("t=%v, (%v:)", t, origin(2))
+ }
// if dmesgs {
// dmesg("%v:\n%s", origin(1), debug.Stack())
// }
@@ -1059,12 +1317,21 @@ func Xabort(t *TLS) {
// int fflush(FILE *stream);
func Xfflush(t *TLS, stream uintptr) int32 {
+ if __ccgo_strace {
+ trc("t=%v stream=%v, (%v:)", t, stream, origin(2))
+ }
return 0 //TODO
}
// size_t fread(void *ptr, size_t size, size_t nmemb, FILE *stream);
func Xfread(t *TLS, ptr uintptr, size, nmemb types.Size_t, stream uintptr) types.Size_t {
+ if __ccgo_strace {
+ trc("t=%v ptr=%v nmemb=%v stream=%v, (%v:)", t, ptr, nmemb, stream, origin(2))
+ }
m, _, err := unix.Syscall(unix.SYS_READ, uintptr(file(stream).fd()), ptr, uintptr(size*nmemb))
+ if m == 0 {
+ file(stream).orFlags(m_F_EOF)
+ }
if err != 0 {
file(stream).setErr()
return 0
@@ -1079,6 +1346,9 @@ func Xfread(t *TLS, ptr uintptr, size, nmemb types.Size_t, stream uintptr) types
// size_t fwrite(const void *ptr, size_t size, size_t nmemb, FILE *stream);
func Xfwrite(t *TLS, ptr uintptr, size, nmemb types.Size_t, stream uintptr) types.Size_t {
+ if __ccgo_strace {
+ trc("t=%v ptr=%v nmemb=%v stream=%v, (%v:)", t, ptr, nmemb, stream, origin(2))
+ }
m, _, err := unix.Syscall(unix.SYS_WRITE, uintptr(file(stream).fd()), ptr, uintptr(size*nmemb))
if err != 0 {
file(stream).setErr()
@@ -1094,11 +1364,17 @@ func Xfwrite(t *TLS, ptr uintptr, size, nmemb types.Size_t, stream uintptr) type
// int fclose(FILE *stream);
func Xfclose(t *TLS, stream uintptr) int32 {
+ if __ccgo_strace {
+ trc("t=%v stream=%v, (%v:)", t, stream, origin(2))
+ }
return file(stream).close(t)
}
// int fputc(int c, FILE *stream);
func Xfputc(t *TLS, c int32, stream uintptr) int32 {
+ if __ccgo_strace {
+ trc("t=%v c=%v stream=%v, (%v:)", t, c, stream, origin(2))
+ }
if _, err := fwrite(file(stream).fd(), []byte{byte(c)}); err != nil {
return stdio.EOF
}
@@ -1108,6 +1384,9 @@ func Xfputc(t *TLS, c int32, stream uintptr) int32 {
// int fseek(FILE *stream, long offset, int whence);
func Xfseek(t *TLS, stream uintptr, offset long, whence int32) int32 {
+ if __ccgo_strace {
+ trc("t=%v stream=%v offset=%v whence=%v, (%v:)", t, stream, offset, whence, origin(2))
+ }
if n := Xlseek(t, int32(file(stream).fd()), types.Off_t(offset), whence); n < 0 {
// if dmesgs {
// dmesg("%v: fd %v, off %#x, whence %v: %v", origin(1), file(stream).fd(), offset, whenceStr(whence), n)
@@ -1119,11 +1398,15 @@ func Xfseek(t *TLS, stream uintptr, offset long, whence int32) int32 {
// if dmesgs {
// dmesg("%v: fd %v, off %#x, whence %v: ok", origin(1), file(stream).fd(), offset, whenceStr(whence))
// }
+ file(stream).xorFlags(m_F_EOF)
return 0
}
// long ftell(FILE *stream);
func Xftell(t *TLS, stream uintptr) long {
+ if __ccgo_strace {
+ trc("t=%v stream=%v, (%v:)", t, stream, origin(2))
+ }
n := Xlseek(t, file(stream).fd(), 0, stdio.SEEK_CUR)
if n < 0 {
file(stream).setErr()
@@ -1138,21 +1421,40 @@ func Xftell(t *TLS, stream uintptr) long {
// int ferror(FILE *stream);
func Xferror(t *TLS, stream uintptr) int32 {
+ if __ccgo_strace {
+ trc("t=%v stream=%v, (%v:)", t, stream, origin(2))
+ }
return Bool32(file(stream).err())
}
// int ungetc(int c, FILE *stream);
func Xungetc(t *TLS, c int32, stream uintptr) int32 {
- panic(todo(""))
+ if __ccgo_strace {
+ trc("t=%v c=%v stream=%v, (%v:)", t, c, stream, origin(2))
+ }
+ if c == stdio.EOF {
+ return c
+ }
+
+ ungetcMu.Lock()
+ ungetc[stream] = byte(c)
+ ungetcMu.Unlock()
+ return int32(byte(c))
}
// int fscanf(FILE *stream, const char *format, ...);
func Xfscanf(t *TLS, stream, format, va uintptr) int32 {
- panic(todo(""))
+ if __ccgo_strace {
+ trc("t=%v va=%v, (%v:)", t, va, origin(2))
+ }
+ return scanf(&byteScanner{t: t, stream: stream}, format, va)
}
// int fputs(const char *s, FILE *stream);
func Xfputs(t *TLS, s, stream uintptr) int32 {
+ if __ccgo_strace {
+ trc("t=%v stream=%v, (%v:)", t, stream, origin(2))
+ }
if _, _, err := unix.Syscall(unix.SYS_WRITE, uintptr(file(stream).fd()), s, uintptr(Xstrlen(t, s))); err != 0 {
return -1
}
@@ -1164,6 +1466,9 @@ var getservbynameStaticResult netdb.Servent
// struct servent *getservbyname(const char *name, const char *proto);
func Xgetservbyname(t *TLS, name, proto uintptr) uintptr {
+ if __ccgo_strace {
+ trc("t=%v proto=%v, (%v:)", t, proto, origin(2))
+ }
var protoent *gonetdb.Protoent
if proto != 0 {
protoent = gonetdb.GetProtoByName(GoString(proto))
@@ -1241,6 +1546,9 @@ func Xgetservbyname(t *TLS, name, proto uintptr) uintptr {
}
func Xreaddir64(t *TLS, dir uintptr) uintptr {
+ if __ccgo_strace {
+ trc("t=%v dir=%v, (%v:)", t, dir, origin(2))
+ }
return Xreaddir(t, dir)
}
@@ -1253,14 +1561,23 @@ func __syscall(r, _ uintptr, errno syscall.Errno) long {
}
func X__syscall1(t *TLS, trap, p1 long) long {
+ if __ccgo_strace {
+ trc("t=%v p1=%v, (%v:)", t, p1, origin(2))
+ }
return __syscall(unix.Syscall(uintptr(trap), uintptr(p1), 0, 0))
}
func X__syscall3(t *TLS, trap, p1, p2, p3 long) long {
+ if __ccgo_strace {
+ trc("t=%v p3=%v, (%v:)", t, p3, origin(2))
+ }
return __syscall(unix.Syscall(uintptr(trap), uintptr(p1), uintptr(p2), uintptr(p3)))
}
func X__syscall4(t *TLS, trap, p1, p2, p3, p4 long) long {
+ if __ccgo_strace {
+ trc("t=%v p4=%v, (%v:)", t, p4, origin(2))
+ }
return __syscall(unix.Syscall6(uintptr(trap), uintptr(p1), uintptr(p2), uintptr(p3), uintptr(p4), 0, 0))
}
@@ -1283,16 +1600,25 @@ func fcntlCmdStr(cmd int32) string {
// int setenv(const char *name, const char *value, int overwrite);
func Xsetenv(t *TLS, name, value uintptr, overwrite int32) int32 {
+ if __ccgo_strace {
+ trc("t=%v value=%v overwrite=%v, (%v:)", t, value, overwrite, origin(2))
+ }
panic(todo(""))
}
// int unsetenv(const char *name);
func Xunsetenv(t *TLS, name uintptr) int32 {
+ if __ccgo_strace {
+ trc("t=%v name=%v, (%v:)", t, name, origin(2))
+ }
panic(todo(""))
}
// int pause(void);
func Xpause(t *TLS) int32 {
+ if __ccgo_strace {
+ trc("t=%v, (%v:)", t, origin(2))
+ }
err := unix.Pause()
if err != nil {
t.setErrno(err)
@@ -1303,6 +1629,9 @@ func Xpause(t *TLS) int32 {
// ssize_t writev(int fd, const struct iovec *iov, int iovcnt);
func Xwritev(t *TLS, fd int32, iov uintptr, iovcnt int32) types.Ssize_t {
+ if __ccgo_strace {
+ trc("t=%v fd=%v iov=%v iovcnt=%v, (%v:)", t, fd, iov, iovcnt, origin(2))
+ }
// if dmesgs {
// dmesg("%v: fd %v iov %#x iovcnt %v", origin(1), fd, iov, iovcnt)
// }
@@ -1335,6 +1664,9 @@ func Xwritev(t *TLS, fd int32, iov uintptr, iovcnt int32) types.Ssize_t {
// int __isoc99_sscanf(const char *str, const char *format, ...);
func X__isoc99_sscanf(t *TLS, str, format, va uintptr) int32 {
+ if __ccgo_strace {
+ trc("t=%v va=%v, (%v:)", t, va, origin(2))
+ }
r := Xsscanf(t, str, format, va)
// if dmesgs {
// dmesg("%v: %q %q: %d", origin(1), GoString(str), GoString(format), r)
@@ -1360,6 +1692,9 @@ func X__isoc99_sscanf(t *TLS, str, format, va uintptr) int32 {
// ssize_t pwrite(int fd, const void *buf, size_t count, off_t offset);
func Xpwrite(t *TLS, fd int32, buf uintptr, count types.Size_t, offset types.Off_t) types.Ssize_t {
+ if __ccgo_strace {
+ trc("t=%v fd=%v buf=%v count=%v offset=%v, (%v:)", t, fd, buf, count, offset, origin(2))
+ }
var n int
var err error
switch {
@@ -1367,26 +1702,29 @@ func Xpwrite(t *TLS, fd int32, buf uintptr, count types.Size_t, offset types.Off
n, err = unix.Pwrite(int(fd), nil, int64(offset))
default:
n, err = unix.Pwrite(int(fd), (*RawMem)(unsafe.Pointer(buf))[:count:count], int64(offset))
- if dmesgs {
- dmesg("%v: fd %v, off %#x, count %#x\n%s", origin(1), fd, offset, count, hex.Dump((*RawMem)(unsafe.Pointer(buf))[:count:count]))
- }
+ // if dmesgs {
+ // dmesg("%v: fd %v, off %#x, count %#x\n%s", origin(1), fd, offset, count, hex.Dump((*RawMem)(unsafe.Pointer(buf))[:count:count]))
+ // }
}
if err != nil {
- if dmesgs {
- dmesg("%v: %v FAIL", origin(1), err)
- }
+ // if dmesgs {
+ // dmesg("%v: %v FAIL", origin(1), err)
+ // }
t.setErrno(err)
return -1
}
- if dmesgs {
- dmesg("%v: ok", origin(1))
- }
+ // if dmesgs {
+ // dmesg("%v: ok", origin(1))
+ // }
return types.Ssize_t(n)
}
// int fstatfs(int fd, struct statfs *buf);
func Xfstatfs(t *TLS, fd int32, buf uintptr) int32 {
+ if __ccgo_strace {
+ trc("t=%v fd=%v buf=%v, (%v:)", t, fd, buf, origin(2))
+ }
if err := unix.Fstatfs(int(fd), (*unix.Statfs_t)(unsafe.Pointer(buf))); err != nil {
t.setErrno(err)
return -1
@@ -1397,6 +1735,9 @@ func Xfstatfs(t *TLS, fd int32, buf uintptr) int32 {
// ssize_t getrandom(void *buf, size_t buflen, unsigned int flags);
func Xgetrandom(t *TLS, buf uintptr, buflen size_t, flags uint32) ssize_t {
+ if __ccgo_strace {
+ trc("t=%v buf=%v buflen=%v flags=%v, (%v:)", t, buf, buflen, flags, origin(2))
+ }
n, err := unix.Getrandom((*RawMem)(unsafe.Pointer(buf))[:buflen], int(flags))
if err != nil {
t.setErrno(err)
@@ -1408,6 +1749,9 @@ func Xgetrandom(t *TLS, buf uintptr, buflen size_t, flags uint32) ssize_t {
// int posix_fadvise(int fd, off_t offset, off_t len, int advice);
func Xposix_fadvise(t *TLS, fd int32, offset, len types.Off_t, advice int32) int32 {
+ if __ccgo_strace {
+ trc("t=%v fd=%v len=%v advice=%v, (%v:)", t, fd, len, advice, origin(2))
+ }
if err := unix.Fadvise(int(fd), int64(offset), int64(len), int(advice)); err != nil {
return int32(err.(unix.Errno))
}
@@ -1417,22 +1761,40 @@ func Xposix_fadvise(t *TLS, fd int32, offset, len types.Off_t, advice int32) int
// int fgetc(FILE *stream);
func Xfgetc(t *TLS, stream uintptr) int32 {
+ if __ccgo_strace {
+ trc("t=%v stream=%v, (%v:)", t, stream, origin(2))
+ }
+ ungetcMu.Lock()
+ c, ok := ungetc[stream]
+ delete(ungetc, stream)
+ ungetcMu.Unlock()
+ if ok {
+ return int32(c)
+ }
+
fd := int((*stdio.FILE)(unsafe.Pointer(stream)).F_fileno)
var buf [1]byte
if n, _ := unix.Read(fd, buf[:]); n != 0 {
return int32(buf[0])
}
+ file(stream).orFlags(m_F_EOF)
return stdio.EOF
}
// void uuid_copy(uuid_t dst, uuid_t src);
func Xuuid_copy(t *TLS, dst, src uintptr) {
+ if __ccgo_strace {
+ trc("t=%v src=%v, (%v:)", t, src, origin(2))
+ }
*(*uuid.Uuid_t)(unsafe.Pointer(dst)) = *(*uuid.Uuid_t)(unsafe.Pointer(src))
}
// int uuid_parse( char *in, uuid_t uu);
func Xuuid_parse(t *TLS, in uintptr, uu uintptr) int32 {
+ if __ccgo_strace {
+ trc("t=%v in=%v uu=%v, (%v:)", t, in, uu, origin(2))
+ }
r, err := guuid.Parse(GoString(in))
if err != nil {
return -1
@@ -1444,6 +1806,9 @@ func Xuuid_parse(t *TLS, in uintptr, uu uintptr) int32 {
// int mkdirat(int dirfd, const char *pathname, mode_t mode);
func Xmkdirat(t *TLS, dirfd int32, pathname uintptr, mode types.Mode_t) int32 {
+ if __ccgo_strace {
+ trc("t=%v dirfd=%v pathname=%v mode=%v, (%v:)", t, dirfd, pathname, mode, origin(2))
+ }
// From golang.org/x/sys/unix/zsyscall_linux.go
if _, _, err := unix.Syscall(unix.SYS_MKDIRAT, uintptr(dirfd), pathname, uintptr(mode)); err != 0 {
t.setErrno(err)
@@ -1455,6 +1820,9 @@ func Xmkdirat(t *TLS, dirfd int32, pathname uintptr, mode types.Mode_t) int32 {
// int symlinkat(const char *target, int newdirfd, const char *linkpath);
func Xsymlinkat(t *TLS, target uintptr, newdirfd int32, linkpath uintptr) int32 {
+ if __ccgo_strace {
+ trc("t=%v target=%v newdirfd=%v linkpath=%v, (%v:)", t, target, newdirfd, linkpath, origin(2))
+ }
// From golang.org/x/sys/unix/zsyscall_linux.go
if _, _, err := unix.Syscall(unix.SYS_SYMLINKAT, target, uintptr(newdirfd), linkpath); err != 0 {
t.setErrno(err)
@@ -1466,6 +1834,9 @@ func Xsymlinkat(t *TLS, target uintptr, newdirfd int32, linkpath uintptr) int32
// int utimensat(int dirfd, const char *pathname, const struct timespec times[2], int flags);
func Xutimensat(t *TLS, dirfd int32, pathname, times uintptr, flags int32) int32 {
+ if __ccgo_strace {
+ trc("t=%v dirfd=%v times=%v flags=%v, (%v:)", t, dirfd, times, flags, origin(2))
+ }
// From golang.org/x/sys/unix/zsyscall_linux.go
if _, _, err := unix.Syscall6(unix.SYS_UTIMENSAT, uintptr(dirfd), pathname, times, uintptr(flags), 0, 0); err != 0 {
t.setErrno(err)
@@ -1477,6 +1848,9 @@ func Xutimensat(t *TLS, dirfd int32, pathname, times uintptr, flags int32) int32
// int unlinkat(int dirfd, const char *pathname, int flags);
func Xunlinkat(t *TLS, dirfd int32, pathname uintptr, flags int32) int32 {
+ if __ccgo_strace {
+ trc("t=%v dirfd=%v pathname=%v flags=%v, (%v:)", t, dirfd, pathname, flags, origin(2))
+ }
// From golang.org/x/sys/unix/zsyscall_linux.go
if _, _, err := unix.Syscall(unix.SYS_UNLINKAT, uintptr(dirfd), pathname, uintptr(flags)); err != 0 {
t.setErrno(err)
@@ -1488,6 +1862,9 @@ func Xunlinkat(t *TLS, dirfd int32, pathname uintptr, flags int32) int32 {
// int faccessat(int dirfd, const char *pathname, int mode, int flags);
func Xfaccessat(t *TLS, dirfd int32, pathname uintptr, mode, flags int32) int32 {
+ if __ccgo_strace {
+ trc("t=%v dirfd=%v pathname=%v flags=%v, (%v:)", t, dirfd, pathname, flags, origin(2))
+ }
// From golang.org/x/sys/unix/zsyscall_linux.go
if _, _, err := unix.Syscall(unix.SYS_FACCESSAT, uintptr(dirfd), pathname, uintptr(mode)); err != 0 {
t.setErrno(err)
@@ -1499,6 +1876,9 @@ func Xfaccessat(t *TLS, dirfd int32, pathname uintptr, mode, flags int32) int32
// int renameat2(int olddirfd, const char *oldpath, int newdirfd, const char *newpath, unsigned int flags);
func Xrenameat2(t *TLS, olddirfd int32, oldpath uintptr, newdirfd int32, newpath uintptr, flags int32) int32 {
+ if __ccgo_strace {
+ trc("t=%v olddirfd=%v oldpath=%v newdirfd=%v newpath=%v flags=%v, (%v:)", t, olddirfd, oldpath, newdirfd, newpath, flags, origin(2))
+ }
// From golang.org/x/sys/unix/zsyscall_linux.go
if _, _, err := unix.Syscall6(unix.SYS_RENAMEAT2, uintptr(olddirfd), oldpath, uintptr(newdirfd), newpath, uintptr(flags), 0); err != 0 {
t.setErrno(err)
@@ -1510,6 +1890,9 @@ func Xrenameat2(t *TLS, olddirfd int32, oldpath uintptr, newdirfd int32, newpath
// int mknodat(int dirfd, const char *pathname, mode_t mode, dev_t dev);
func Xmknodat(t *TLS, dirfd int32, pathname uintptr, mode types.Mode_t, dev types.Dev_t) int32 {
+ if __ccgo_strace {
+ trc("t=%v dirfd=%v pathname=%v mode=%v dev=%v, (%v:)", t, dirfd, pathname, mode, dev, origin(2))
+ }
// From golang.org/x/sys/unix/zsyscall_linux.go
if _, _, err := unix.Syscall6(unix.SYS_MKNODAT, uintptr(dirfd), pathname, uintptr(mode), uintptr(dev), 0, 0); err != 0 {
t.setErrno(err)
@@ -1521,6 +1904,9 @@ func Xmknodat(t *TLS, dirfd int32, pathname uintptr, mode types.Mode_t, dev type
// int fchownat(int dirfd, const char *pathname, uid_t owner, gid_t group, int flags);
func Xfchownat(t *TLS, dirfd int32, pathname uintptr, uid types.Uid_t, gid types.Gid_t, flags int32) int32 {
+ if __ccgo_strace {
+ trc("t=%v dirfd=%v pathname=%v uid=%v gid=%v flags=%v, (%v:)", t, dirfd, pathname, uid, gid, flags, origin(2))
+ }
// From golang.org/x/sys/unix/zsyscall_linux.go
if _, _, err := unix.Syscall6(unix.SYS_FCHOWNAT, uintptr(dirfd), pathname, uintptr(uid), uintptr(gid), uintptr(flags), 0); err != 0 {
t.setErrno(err)
@@ -1532,6 +1918,9 @@ func Xfchownat(t *TLS, dirfd int32, pathname uintptr, uid types.Uid_t, gid types
// int linkat(int olddirfd, const char *oldpath, int newdirfd, const char *newpath, int flags);
func Xlinkat(t *TLS, olddirfd int32, oldpath uintptr, newdirfd int32, newpath uintptr, flags int32) int32 {
+ if __ccgo_strace {
+ trc("t=%v olddirfd=%v oldpath=%v newdirfd=%v newpath=%v flags=%v, (%v:)", t, olddirfd, oldpath, newdirfd, newpath, flags, origin(2))
+ }
// From golang.org/x/sys/unix/zsyscall_linux.go
if _, _, err := unix.Syscall6(unix.SYS_LINKAT, uintptr(olddirfd), oldpath, uintptr(newdirfd), newpath, uintptr(flags), 0); err != 0 {
t.setErrno(err)
@@ -1543,6 +1932,9 @@ func Xlinkat(t *TLS, olddirfd int32, oldpath uintptr, newdirfd int32, newpath ui
// int pipe2(int pipefd[2], int flags);
func Xpipe2(t *TLS, pipefd uintptr, flags int32) int32 {
+ if __ccgo_strace {
+ trc("t=%v pipefd=%v flags=%v, (%v:)", t, pipefd, flags, origin(2))
+ }
// From golang.org/x/sys/unix/zsyscall_linux.go
if _, _, err := unix.Syscall(unix.SYS_PIPE2, pipefd, uintptr(flags), 0); err != 0 {
t.setErrno(t)
@@ -1554,6 +1946,9 @@ func Xpipe2(t *TLS, pipefd uintptr, flags int32) int32 {
// int dup3(int oldfd, int newfd, int flags);
func Xdup3(t *TLS, oldfd int32, newfd int32, flags int32) int32 {
+ if __ccgo_strace {
+ trc("t=%v oldfd=%v newfd=%v flags=%v, (%v:)", t, oldfd, newfd, flags, origin(2))
+ }
// From golang.org/x/sys/unix/zsyscall_linux.go
if _, _, err := unix.Syscall(unix.SYS_DUP3, uintptr(oldfd), uintptr(newfd), uintptr(flags)); err != 0 {
t.setErrno(err)
@@ -1565,6 +1960,9 @@ func Xdup3(t *TLS, oldfd int32, newfd int32, flags int32) int32 {
// ssize_t readlinkat(int dirfd, const char *pathname, char *buf, size_t bufsiz);
func Xreadlinkat(t *TLS, dirfd int32, pathname, buf uintptr, bufsiz types.Size_t) types.Ssize_t {
+ if __ccgo_strace {
+ trc("t=%v dirfd=%v buf=%v bufsiz=%v, (%v:)", t, dirfd, buf, bufsiz, origin(2))
+ }
// From golang.org/x/sys/unix/zsyscall_linux.go
n, _, err := unix.Syscall6(unix.SYS_READLINKAT, uintptr(dirfd), pathname, buf, uintptr(bufsiz), 0, 0)
if err != 0 {
@@ -1577,7 +1975,43 @@ func Xreadlinkat(t *TLS, dirfd int32, pathname, buf uintptr, bufsiz types.Size_t
// int nanosleep(const struct timespec *req, struct timespec *rem);
func Xnanosleep(t *TLS, req, rem uintptr) int32 {
+ if __ccgo_strace {
+ trc("t=%v rem=%v, (%v:)", t, rem, origin(2))
+ }
v := *(*ctime.Timespec)(unsafe.Pointer(req))
time.Sleep(time.Second*time.Duration(v.Ftv_sec) + time.Duration(v.Ftv_nsec))
return 0
}
+
+func Xfeof(t *TLS, f uintptr) (r int32) {
+ if __ccgo_strace {
+ trc("t=%v f=%v, (%v:)", t, f, origin(2))
+ defer func() { trc("-> %v", r) }()
+ }
+ X__lockfile(t, f)
+ r = BoolInt32(!!((*stdio.FILE)(unsafe.Pointer(f)).F_flags&Int32FromInt32(m_F_EOF) != 0))
+ X__unlockfile(t, f)
+ return r
+}
+
+type byteScanner struct {
+ t *TLS
+ stream uintptr
+
+ last byte
+}
+
+func (s *byteScanner) ReadByte() (byte, error) {
+ c := Xfgetc(s.t, s.stream)
+ if c < 0 {
+ return 0, io.EOF
+ }
+
+ s.last = byte(c)
+ return byte(c), nil
+}
+
+func (s *byteScanner) UnreadByte() error {
+ Xungetc(s.t, int32(s.last), s.stream)
+ return nil
+}
diff --git a/vendor/modernc.org/libc/libc_linux_386.go b/vendor/modernc.org/libc/libc_linux_386.go
index c1369dd5..affa82cf 100644
--- a/vendor/modernc.org/libc/libc_linux_386.go
+++ b/vendor/modernc.org/libc/libc_linux_386.go
@@ -13,12 +13,16 @@ import (
"modernc.org/libc/errno"
"modernc.org/libc/fcntl"
"modernc.org/libc/signal"
+ "modernc.org/libc/stdio"
"modernc.org/libc/sys/stat"
"modernc.org/libc/sys/types"
)
// int sigaction(int signum, const struct sigaction *act, struct sigaction *oldact);
func Xsigaction(t *TLS, signum int32, act, oldact uintptr) int32 {
+ if __ccgo_strace {
+ trc("t=%v signum=%v oldact=%v, (%v:)", t, signum, oldact, origin(2))
+ }
// musl/arch/x32/ksigaction.h
//
// struct k_sigaction {
@@ -64,6 +68,9 @@ func Xsigaction(t *TLS, signum int32, act, oldact uintptr) int32 {
// int fcntl(int fd, int cmd, ... /* arg */ );
func Xfcntl64(t *TLS, fd, cmd int32, args uintptr) int32 {
+ if __ccgo_strace {
+ trc("t=%v cmd=%v args=%v, (%v:)", t, cmd, args, origin(2))
+ }
var arg uintptr
if args != 0 {
arg = *(*uintptr)(unsafe.Pointer(args))
@@ -88,6 +95,9 @@ func Xfcntl64(t *TLS, fd, cmd int32, args uintptr) int32 {
// int lstat(const char *pathname, struct stat *statbuf);
func Xlstat64(t *TLS, pathname, statbuf uintptr) int32 {
+ if __ccgo_strace {
+ trc("t=%v statbuf=%v, (%v:)", t, statbuf, origin(2))
+ }
if _, _, err := unix.Syscall(unix.SYS_LSTAT64, pathname, statbuf, 0); err != 0 {
if dmesgs {
dmesg("%v: %q: %v", origin(1), GoString(pathname), err)
@@ -104,6 +114,9 @@ func Xlstat64(t *TLS, pathname, statbuf uintptr) int32 {
// int stat(const char *pathname, struct stat *statbuf);
func Xstat64(t *TLS, pathname, statbuf uintptr) int32 {
+ if __ccgo_strace {
+ trc("t=%v statbuf=%v, (%v:)", t, statbuf, origin(2))
+ }
if _, _, err := unix.Syscall(unix.SYS_STAT64, pathname, statbuf, 0); err != 0 {
if dmesgs {
dmesg("%v: %q: %v", origin(1), GoString(pathname), err)
@@ -120,6 +133,9 @@ func Xstat64(t *TLS, pathname, statbuf uintptr) int32 {
// int fstat(int fd, struct stat *statbuf);
func Xfstat64(t *TLS, fd int32, statbuf uintptr) int32 {
+ if __ccgo_strace {
+ trc("t=%v fd=%v statbuf=%v, (%v:)", t, fd, statbuf, origin(2))
+ }
if _, _, err := unix.Syscall(unix.SYS_FSTAT64, uintptr(fd), statbuf, 0); err != 0 {
if dmesgs {
dmesg("%v: fd %d: %v", origin(1), fd, err)
@@ -136,6 +152,9 @@ func Xfstat64(t *TLS, fd int32, statbuf uintptr) int32 {
// void *mremap(void *old_address, size_t old_size, size_t new_size, int flags, ... /* void *new_address */);
func Xmremap(t *TLS, old_address uintptr, old_size, new_size types.Size_t, flags int32, args uintptr) uintptr {
+ if __ccgo_strace {
+ trc("t=%v old_address=%v new_size=%v flags=%v args=%v, (%v:)", t, old_address, new_size, flags, args, origin(2))
+ }
var arg uintptr
if args != 0 {
arg = *(*uintptr)(unsafe.Pointer(args))
@@ -156,11 +175,17 @@ func Xmremap(t *TLS, old_address uintptr, old_size, new_size types.Size_t, flags
}
func Xmmap(t *TLS, addr uintptr, length types.Size_t, prot, flags, fd int32, offset types.Off_t) uintptr {
+ if __ccgo_strace {
+ trc("t=%v addr=%v length=%v fd=%v offset=%v, (%v:)", t, addr, length, fd, offset, origin(2))
+ }
return Xmmap64(t, addr, length, prot, flags, fd, offset)
}
// void *mmap(void *addr, size_t length, int prot, int flags, int fd, off_t offset);
func Xmmap64(t *TLS, addr uintptr, length types.Size_t, prot, flags, fd int32, offset types.Off_t) uintptr {
+ if __ccgo_strace {
+ trc("t=%v addr=%v length=%v fd=%v offset=%v, (%v:)", t, addr, length, fd, offset, origin(2))
+ }
data, _, err := unix.Syscall6(unix.SYS_MMAP2, addr, uintptr(length), uintptr(prot), uintptr(flags), uintptr(fd), uintptr(offset>>12))
if err != 0 {
if dmesgs {
@@ -178,6 +203,9 @@ func Xmmap64(t *TLS, addr uintptr, length types.Size_t, prot, flags, fd int32, o
// int ftruncate(int fd, off_t length);
func Xftruncate64(t *TLS, fd int32, length types.Off_t) int32 {
+ if __ccgo_strace {
+ trc("t=%v fd=%v length=%v, (%v:)", t, fd, length, origin(2))
+ }
if _, _, err := unix.Syscall(unix.SYS_FTRUNCATE64, uintptr(fd), uintptr(length), uintptr(length>>32)); err != 0 {
if dmesgs {
dmesg("%v: fd %d: %v", origin(1), fd, err)
@@ -194,6 +222,9 @@ func Xftruncate64(t *TLS, fd int32, length types.Off_t) int32 {
// off64_t lseek64(int fd, off64_t offset, int whence);
func Xlseek64(t *TLS, fd int32, offset types.Off_t, whence int32) types.Off_t {
+ if __ccgo_strace {
+ trc("t=%v fd=%v offset=%v whence=%v, (%v:)", t, fd, offset, whence, origin(2))
+ }
bp := t.Alloc(int(unsafe.Sizeof(types.X__loff_t(0))))
defer t.Free(int(unsafe.Sizeof(types.X__loff_t(0))))
if _, _, err := unix.Syscall6(unix.SYS__LLSEEK, uintptr(fd), uintptr(offset>>32), uintptr(offset), bp, uintptr(whence), 0); err != 0 {
@@ -212,6 +243,9 @@ func Xlseek64(t *TLS, fd int32, offset types.Off_t, whence int32) types.Off_t {
// int utime(const char *filename, const struct utimbuf *times);
func Xutime(t *TLS, filename, times uintptr) int32 {
+ if __ccgo_strace {
+ trc("t=%v times=%v, (%v:)", t, times, origin(2))
+ }
if _, _, err := unix.Syscall(unix.SYS_UTIME, filename, times, 0); err != 0 {
t.setErrno(err)
return -1
@@ -222,6 +256,9 @@ func Xutime(t *TLS, filename, times uintptr) int32 {
// unsigned int alarm(unsigned int seconds);
func Xalarm(t *TLS, seconds uint32) uint32 {
+ if __ccgo_strace {
+ trc("t=%v seconds=%v, (%v:)", t, seconds, origin(2))
+ }
n, _, err := unix.Syscall(unix.SYS_ALARM, uintptr(seconds), 0, 0)
if err != 0 {
panic(todo(""))
@@ -232,6 +269,9 @@ func Xalarm(t *TLS, seconds uint32) uint32 {
// int getrlimit(int resource, struct rlimit *rlim);
func Xgetrlimit64(t *TLS, resource int32, rlim uintptr) int32 {
+ if __ccgo_strace {
+ trc("t=%v resource=%v rlim=%v, (%v:)", t, resource, rlim, origin(2))
+ }
if _, _, err := unix.Syscall(unix.SYS_GETRLIMIT, uintptr(resource), uintptr(rlim), 0); err != 0 {
t.setErrno(err)
return -1
@@ -242,6 +282,9 @@ func Xgetrlimit64(t *TLS, resource int32, rlim uintptr) int32 {
// time_t time(time_t *tloc);
func Xtime(t *TLS, tloc uintptr) types.Time_t {
+ if __ccgo_strace {
+ trc("t=%v tloc=%v, (%v:)", t, tloc, origin(2))
+ }
n, _, err := unix.Syscall(unix.SYS_TIME, tloc, 0, 0)
if err != 0 {
t.setErrno(err)
@@ -256,6 +299,9 @@ func Xtime(t *TLS, tloc uintptr) types.Time_t {
// int mkdir(const char *path, mode_t mode);
func Xmkdir(t *TLS, path uintptr, mode types.Mode_t) int32 {
+ if __ccgo_strace {
+ trc("t=%v path=%v mode=%v, (%v:)", t, path, mode, origin(2))
+ }
if _, _, err := unix.Syscall(unix.SYS_MKDIR, path, uintptr(mode), 0); err != 0 {
t.setErrno(err)
return -1
@@ -269,6 +315,9 @@ func Xmkdir(t *TLS, path uintptr, mode types.Mode_t) int32 {
// int symlink(const char *target, const char *linkpath);
func Xsymlink(t *TLS, target, linkpath uintptr) int32 {
+ if __ccgo_strace {
+ trc("t=%v linkpath=%v, (%v:)", t, linkpath, origin(2))
+ }
if _, _, err := unix.Syscall(unix.SYS_SYMLINK, target, linkpath, 0); err != 0 {
t.setErrno(err)
return -1
@@ -282,6 +331,9 @@ func Xsymlink(t *TLS, target, linkpath uintptr) int32 {
// int chmod(const char *pathname, mode_t mode)
func Xchmod(t *TLS, pathname uintptr, mode types.Mode_t) int32 {
+ if __ccgo_strace {
+ trc("t=%v pathname=%v mode=%v, (%v:)", t, pathname, mode, origin(2))
+ }
if _, _, err := unix.Syscall(unix.SYS_CHMOD, pathname, uintptr(mode), 0); err != 0 {
t.setErrno(err)
return -1
@@ -295,6 +347,9 @@ func Xchmod(t *TLS, pathname uintptr, mode types.Mode_t) int32 {
// int utimes(const char *filename, const struct timeval times[2]);
func Xutimes(t *TLS, filename, times uintptr) int32 {
+ if __ccgo_strace {
+ trc("t=%v times=%v, (%v:)", t, times, origin(2))
+ }
if _, _, err := unix.Syscall(unix.SYS_UTIMES, filename, times, 0); err != 0 {
t.setErrno(err)
return -1
@@ -308,6 +363,9 @@ func Xutimes(t *TLS, filename, times uintptr) int32 {
// int unlink(const char *pathname);
func Xunlink(t *TLS, pathname uintptr) int32 {
+ if __ccgo_strace {
+ trc("t=%v pathname=%v, (%v:)", t, pathname, origin(2))
+ }
if _, _, err := unix.Syscall(unix.SYS_UNLINK, pathname, 0, 0); err != 0 {
t.setErrno(err)
return -1
@@ -321,6 +379,9 @@ func Xunlink(t *TLS, pathname uintptr) int32 {
// int access(const char *pathname, int mode);
func Xaccess(t *TLS, pathname uintptr, mode int32) int32 {
+ if __ccgo_strace {
+ trc("t=%v pathname=%v mode=%v, (%v:)", t, pathname, mode, origin(2))
+ }
if _, _, err := unix.Syscall(unix.SYS_ACCESS, pathname, uintptr(mode), 0); err != 0 {
if dmesgs {
dmesg("%v: %q: %v", origin(1), GoString(pathname), err)
@@ -337,6 +398,9 @@ func Xaccess(t *TLS, pathname uintptr, mode int32) int32 {
// int rmdir(const char *pathname);
func Xrmdir(t *TLS, pathname uintptr) int32 {
+ if __ccgo_strace {
+ trc("t=%v pathname=%v, (%v:)", t, pathname, origin(2))
+ }
if _, _, err := unix.Syscall(unix.SYS_RMDIR, pathname, 0, 0); err != 0 {
t.setErrno(err)
return -1
@@ -350,6 +414,9 @@ func Xrmdir(t *TLS, pathname uintptr) int32 {
// int rename(const char *oldpath, const char *newpath);
func Xrename(t *TLS, oldpath, newpath uintptr) int32 {
+ if __ccgo_strace {
+ trc("t=%v newpath=%v, (%v:)", t, newpath, origin(2))
+ }
if _, _, err := unix.Syscall(unix.SYS_RENAME, oldpath, newpath, 0); err != 0 {
t.setErrno(err)
return -1
@@ -360,6 +427,9 @@ func Xrename(t *TLS, oldpath, newpath uintptr) int32 {
// int mknod(const char *pathname, mode_t mode, dev_t dev);
func Xmknod(t *TLS, pathname uintptr, mode types.Mode_t, dev types.Dev_t) int32 {
+ if __ccgo_strace {
+ trc("t=%v pathname=%v mode=%v dev=%v, (%v:)", t, pathname, mode, dev, origin(2))
+ }
if _, _, err := unix.Syscall(unix.SYS_MKNOD, pathname, uintptr(mode), uintptr(dev)); err != 0 {
t.setErrno(err)
return -1
@@ -370,6 +440,9 @@ func Xmknod(t *TLS, pathname uintptr, mode types.Mode_t, dev types.Dev_t) int32
// int chown(const char *pathname, uid_t owner, gid_t group);
func Xchown(t *TLS, pathname uintptr, owner types.Uid_t, group types.Gid_t) int32 {
+ if __ccgo_strace {
+ trc("t=%v pathname=%v owner=%v group=%v, (%v:)", t, pathname, owner, group, origin(2))
+ }
if _, _, err := unix.Syscall(unix.SYS_CHOWN, pathname, uintptr(owner), uintptr(group)); err != 0 {
t.setErrno(err)
return -1
@@ -380,6 +453,9 @@ func Xchown(t *TLS, pathname uintptr, owner types.Uid_t, group types.Gid_t) int3
// int link(const char *oldpath, const char *newpath);
func Xlink(t *TLS, oldpath, newpath uintptr) int32 {
+ if __ccgo_strace {
+ trc("t=%v newpath=%v, (%v:)", t, newpath, origin(2))
+ }
if _, _, err := unix.Syscall(unix.SYS_LINK, oldpath, newpath, 0); err != 0 {
t.setErrno(err)
return -1
@@ -390,6 +466,9 @@ func Xlink(t *TLS, oldpath, newpath uintptr) int32 {
// int pipe(int pipefd[2]);
func Xpipe(t *TLS, pipefd uintptr) int32 {
+ if __ccgo_strace {
+ trc("t=%v pipefd=%v, (%v:)", t, pipefd, origin(2))
+ }
if _, _, err := unix.Syscall(unix.SYS_PIPE, pipefd, 0, 0); err != 0 {
t.setErrno(err)
return -1
@@ -400,6 +479,9 @@ func Xpipe(t *TLS, pipefd uintptr) int32 {
// int dup2(int oldfd, int newfd);
func Xdup2(t *TLS, oldfd, newfd int32) int32 {
+ if __ccgo_strace {
+ trc("t=%v newfd=%v, (%v:)", t, newfd, origin(2))
+ }
n, _, err := unix.Syscall(unix.SYS_DUP2, uintptr(oldfd), uintptr(newfd), 0)
if err != 0 {
t.setErrno(err)
@@ -411,6 +493,9 @@ func Xdup2(t *TLS, oldfd, newfd int32) int32 {
// ssize_t readlink(const char *restrict path, char *restrict buf, size_t bufsize);
func Xreadlink(t *TLS, path, buf uintptr, bufsize types.Size_t) types.Ssize_t {
+ if __ccgo_strace {
+ trc("t=%v buf=%v bufsize=%v, (%v:)", t, buf, bufsize, origin(2))
+ }
n, _, err := unix.Syscall(unix.SYS_READLINK, path, buf, uintptr(bufsize))
if err != 0 {
t.setErrno(err)
@@ -422,6 +507,9 @@ func Xreadlink(t *TLS, path, buf uintptr, bufsize types.Size_t) types.Ssize_t {
// FILE *fopen64(const char *pathname, const char *mode);
func Xfopen64(t *TLS, pathname, mode uintptr) uintptr {
+ if __ccgo_strace {
+ trc("t=%v mode=%v, (%v:)", t, mode, origin(2))
+ }
m := strings.ReplaceAll(GoString(mode), "b", "")
var flags int
switch m {
@@ -458,6 +546,9 @@ func Xfopen64(t *TLS, pathname, mode uintptr) uintptr {
// int setrlimit(int resource, const struct rlimit *rlim);
func Xsetrlimit64(t *TLS, resource int32, rlim uintptr) int32 {
+ if __ccgo_strace {
+ trc("t=%v resource=%v rlim=%v, (%v:)", t, resource, rlim, origin(2))
+ }
if _, _, err := unix.Syscall(unix.SYS_SETRLIMIT, uintptr(resource), uintptr(rlim), 0); err != 0 {
t.setErrno(err)
return -1
@@ -465,3 +556,180 @@ func Xsetrlimit64(t *TLS, resource int32, rlim uintptr) int32 {
return 0
}
+
+var _table1 = [384]int32{
+ 129: int32(1),
+ 130: int32(2),
+ 131: int32(3),
+ 132: int32(4),
+ 133: int32(5),
+ 134: int32(6),
+ 135: int32(7),
+ 136: int32(8),
+ 137: int32(9),
+ 138: int32(10),
+ 139: int32(11),
+ 140: int32(12),
+ 141: int32(13),
+ 142: int32(14),
+ 143: int32(15),
+ 144: int32(16),
+ 145: int32(17),
+ 146: int32(18),
+ 147: int32(19),
+ 148: int32(20),
+ 149: int32(21),
+ 150: int32(22),
+ 151: int32(23),
+ 152: int32(24),
+ 153: int32(25),
+ 154: int32(26),
+ 155: int32(27),
+ 156: int32(28),
+ 157: int32(29),
+ 158: int32(30),
+ 159: int32(31),
+ 160: int32(32),
+ 161: int32(33),
+ 162: int32(34),
+ 163: int32(35),
+ 164: int32(36),
+ 165: int32(37),
+ 166: int32(38),
+ 167: int32(39),
+ 168: int32(40),
+ 169: int32(41),
+ 170: int32(42),
+ 171: int32(43),
+ 172: int32(44),
+ 173: int32(45),
+ 174: int32(46),
+ 175: int32(47),
+ 176: int32(48),
+ 177: int32(49),
+ 178: int32(50),
+ 179: int32(51),
+ 180: int32(52),
+ 181: int32(53),
+ 182: int32(54),
+ 183: int32(55),
+ 184: int32(56),
+ 185: int32(57),
+ 186: int32(58),
+ 187: int32(59),
+ 188: int32(60),
+ 189: int32(61),
+ 190: int32(62),
+ 191: int32(63),
+ 192: int32(64),
+ 193: int32('a'),
+ 194: int32('b'),
+ 195: int32('c'),
+ 196: int32('d'),
+ 197: int32('e'),
+ 198: int32('f'),
+ 199: int32('g'),
+ 200: int32('h'),
+ 201: int32('i'),
+ 202: int32('j'),
+ 203: int32('k'),
+ 204: int32('l'),
+ 205: int32('m'),
+ 206: int32('n'),
+ 207: int32('o'),
+ 208: int32('p'),
+ 209: int32('q'),
+ 210: int32('r'),
+ 211: int32('s'),
+ 212: int32('t'),
+ 213: int32('u'),
+ 214: int32('v'),
+ 215: int32('w'),
+ 216: int32('x'),
+ 217: int32('y'),
+ 218: int32('z'),
+ 219: int32(91),
+ 220: int32(92),
+ 221: int32(93),
+ 222: int32(94),
+ 223: int32(95),
+ 224: int32(96),
+ 225: int32('a'),
+ 226: int32('b'),
+ 227: int32('c'),
+ 228: int32('d'),
+ 229: int32('e'),
+ 230: int32('f'),
+ 231: int32('g'),
+ 232: int32('h'),
+ 233: int32('i'),
+ 234: int32('j'),
+ 235: int32('k'),
+ 236: int32('l'),
+ 237: int32('m'),
+ 238: int32('n'),
+ 239: int32('o'),
+ 240: int32('p'),
+ 241: int32('q'),
+ 242: int32('r'),
+ 243: int32('s'),
+ 244: int32('t'),
+ 245: int32('u'),
+ 246: int32('v'),
+ 247: int32('w'),
+ 248: int32('x'),
+ 249: int32('y'),
+ 250: int32('z'),
+ 251: int32(123),
+ 252: int32(124),
+ 253: int32(125),
+ 254: int32(126),
+ 255: int32(127),
+}
+
+var _ptable1 = uintptr(unsafe.Pointer(&_table1)) + uintptr(128)*4
+
+func X__ctype_tolower_loc(tls *TLS) (r uintptr) {
+ if __ccgo_strace {
+ trc("tls=%v, (%v:)", tls, origin(2))
+ defer func() { trc("-> %v", r) }()
+ }
+ return uintptr(unsafe.Pointer(&_ptable1))
+}
+
+var Xin6addr_any = Tin6_addr{}
+
+type Tin6_addr = struct {
+ F__in6_union struct {
+ F__s6_addr16 [0][8]uint16
+ F__s6_addr32 [0][4]uint32
+ F__s6_addr [16]uint8
+ }
+}
+
+func Xrewinddir(tls *TLS, f uintptr) {
+ if __ccgo_strace {
+ trc("tls=%v f=%v, (%v:)", tls, f, origin(2))
+ }
+ Xfseek(tls, f, 0, stdio.SEEK_SET)
+}
+
+func AtomicLoadPInt8(addr uintptr) (val int8) {
+ return int8(a_load_8(addr))
+}
+
+func AtomicLoadPInt16(addr uintptr) (val int16) {
+ return int16(a_load_16(addr))
+}
+
+func AtomicLoadPUint8(addr uintptr) byte {
+ return byte(a_load_8(addr))
+}
+
+func AtomicLoadPUint16(addr uintptr) uint16 {
+ return uint16(a_load_16(addr))
+}
+
+func AtomicLoadNUint8(ptr uintptr, memorder int32) uint8 {
+ return byte(a_load_8(ptr))
+}
diff --git a/vendor/modernc.org/libc/libc_linux_amd64.go b/vendor/modernc.org/libc/libc_linux_amd64.go
index 4d3bf1a5..4aa05557 100644
--- a/vendor/modernc.org/libc/libc_linux_amd64.go
+++ b/vendor/modernc.org/libc/libc_linux_amd64.go
@@ -7,6 +7,7 @@ package libc // import "modernc.org/libc"
import (
"os"
"strings"
+ gotime "time"
"unicode"
"unsafe"
@@ -14,12 +15,21 @@ import (
"modernc.org/libc/errno"
"modernc.org/libc/fcntl"
"modernc.org/libc/signal"
+ "modernc.org/libc/stdio"
"modernc.org/libc/sys/types"
+ "modernc.org/libc/time"
"modernc.org/libc/wctype"
)
+var (
+ startTime = gotime.Now() // For clock(3)
+)
+
// int sigaction(int signum, const struct sigaction *act, struct sigaction *oldact);
func Xsigaction(t *TLS, signum int32, act, oldact uintptr) int32 {
+ if __ccgo_strace {
+ trc("t=%v signum=%v oldact=%v, (%v:)", t, signum, oldact, origin(2))
+ }
// musl/arch/x86_64/ksigaction.h
//
// struct k_sigaction {
@@ -65,6 +75,9 @@ func Xsigaction(t *TLS, signum int32, act, oldact uintptr) int32 {
// int fcntl(int fd, int cmd, ... /* arg */ );
func Xfcntl64(t *TLS, fd, cmd int32, args uintptr) int32 {
+ if __ccgo_strace {
+ trc("t=%v cmd=%v args=%v, (%v:)", t, cmd, args, origin(2))
+ }
var arg uintptr
if args != 0 {
arg = *(*uintptr)(unsafe.Pointer(args))
@@ -89,6 +102,9 @@ func Xfcntl64(t *TLS, fd, cmd int32, args uintptr) int32 {
// int lstat(const char *pathname, struct stat *statbuf);
func Xlstat64(t *TLS, pathname, statbuf uintptr) int32 {
+ if __ccgo_strace {
+ trc("t=%v statbuf=%v, (%v:)", t, statbuf, origin(2))
+ }
if _, _, err := unix.Syscall(unix.SYS_LSTAT, pathname, statbuf, 0); err != 0 {
// if dmesgs {
// dmesg("%v: %q: %v", origin(1), GoString(pathname), err)
@@ -105,6 +121,9 @@ func Xlstat64(t *TLS, pathname, statbuf uintptr) int32 {
// int stat(const char *pathname, struct stat *statbuf);
func Xstat64(t *TLS, pathname, statbuf uintptr) int32 {
+ if __ccgo_strace {
+ trc("t=%v statbuf=%v, (%v:)", t, statbuf, origin(2))
+ }
if _, _, err := unix.Syscall(unix.SYS_STAT, pathname, statbuf, 0); err != 0 {
// if dmesgs {
// dmesg("%v: %q: %v", origin(1), GoString(pathname), err)
@@ -121,6 +140,9 @@ func Xstat64(t *TLS, pathname, statbuf uintptr) int32 {
// int fstat(int fd, struct stat *statbuf);
func Xfstat64(t *TLS, fd int32, statbuf uintptr) int32 {
+ if __ccgo_strace {
+ trc("t=%v fd=%v statbuf=%v, (%v:)", t, fd, statbuf, origin(2))
+ }
if _, _, err := unix.Syscall(unix.SYS_FSTAT, uintptr(fd), statbuf, 0); err != 0 {
// if dmesgs {
// dmesg("%v: fd %d: %v", origin(1), fd, err)
@@ -136,11 +158,17 @@ func Xfstat64(t *TLS, fd int32, statbuf uintptr) int32 {
}
func Xmmap(t *TLS, addr uintptr, length types.Size_t, prot, flags, fd int32, offset types.Off_t) uintptr {
+ if __ccgo_strace {
+ trc("t=%v addr=%v length=%v fd=%v offset=%v, (%v:)", t, addr, length, fd, offset, origin(2))
+ }
return Xmmap64(t, addr, length, prot, flags, fd, offset)
}
// void *mmap(void *addr, size_t length, int prot, int flags, int fd, off_t offset);
func Xmmap64(t *TLS, addr uintptr, length types.Size_t, prot, flags, fd int32, offset types.Off_t) uintptr {
+ if __ccgo_strace {
+ trc("t=%v addr=%v length=%v fd=%v offset=%v, (%v:)", t, addr, length, fd, offset, origin(2))
+ }
data, _, err := unix.Syscall6(unix.SYS_MMAP, addr, uintptr(length), uintptr(prot), uintptr(flags), uintptr(fd), uintptr(offset))
if err != 0 {
// if dmesgs {
@@ -158,6 +186,9 @@ func Xmmap64(t *TLS, addr uintptr, length types.Size_t, prot, flags, fd int32, o
// void *mremap(void *old_address, size_t old_size, size_t new_size, int flags, ... /* void *new_address */);
func Xmremap(t *TLS, old_address uintptr, old_size, new_size types.Size_t, flags int32, args uintptr) uintptr {
+ if __ccgo_strace {
+ trc("t=%v old_address=%v new_size=%v flags=%v args=%v, (%v:)", t, old_address, new_size, flags, args, origin(2))
+ }
var arg uintptr
if args != 0 {
arg = *(*uintptr)(unsafe.Pointer(args))
@@ -179,6 +210,9 @@ func Xmremap(t *TLS, old_address uintptr, old_size, new_size types.Size_t, flags
// int ftruncate(int fd, off_t length);
func Xftruncate64(t *TLS, fd int32, length types.Off_t) int32 {
+ if __ccgo_strace {
+ trc("t=%v fd=%v length=%v, (%v:)", t, fd, length, origin(2))
+ }
if _, _, err := unix.Syscall(unix.SYS_FTRUNCATE, uintptr(fd), uintptr(length), 0); err != 0 {
// if dmesgs {
// dmesg("%v: fd %d: %v", origin(1), fd, err)
@@ -195,6 +229,9 @@ func Xftruncate64(t *TLS, fd int32, length types.Off_t) int32 {
// off64_t lseek64(int fd, off64_t offset, int whence);
func Xlseek64(t *TLS, fd int32, offset types.Off_t, whence int32) types.Off_t {
+ if __ccgo_strace {
+ trc("t=%v fd=%v offset=%v whence=%v, (%v:)", t, fd, offset, whence, origin(2))
+ }
n, _, err := unix.Syscall(unix.SYS_LSEEK, uintptr(fd), uintptr(offset), uintptr(whence))
if err != 0 {
// if dmesgs {
@@ -212,6 +249,9 @@ func Xlseek64(t *TLS, fd int32, offset types.Off_t, whence int32) types.Off_t {
// int utime(const char *filename, const struct utimbuf *times);
func Xutime(t *TLS, filename, times uintptr) int32 {
+ if __ccgo_strace {
+ trc("t=%v times=%v, (%v:)", t, times, origin(2))
+ }
if _, _, err := unix.Syscall(unix.SYS_UTIME, filename, times, 0); err != 0 {
t.setErrno(err)
return -1
@@ -222,6 +262,9 @@ func Xutime(t *TLS, filename, times uintptr) int32 {
// unsigned int alarm(unsigned int seconds);
func Xalarm(t *TLS, seconds uint32) uint32 {
+ if __ccgo_strace {
+ trc("t=%v seconds=%v, (%v:)", t, seconds, origin(2))
+ }
n, _, err := unix.Syscall(unix.SYS_ALARM, uintptr(seconds), 0, 0)
if err != 0 {
panic(todo(""))
@@ -232,6 +275,9 @@ func Xalarm(t *TLS, seconds uint32) uint32 {
// time_t time(time_t *tloc);
func Xtime(t *TLS, tloc uintptr) types.Time_t {
+ if __ccgo_strace {
+ trc("t=%v tloc=%v, (%v:)", t, tloc, origin(2))
+ }
n, _, err := unix.Syscall(unix.SYS_TIME, tloc, 0, 0)
if err != 0 {
t.setErrno(err)
@@ -246,6 +292,9 @@ func Xtime(t *TLS, tloc uintptr) types.Time_t {
// int getrlimit(int resource, struct rlimit *rlim);
func Xgetrlimit64(t *TLS, resource int32, rlim uintptr) int32 {
+ if __ccgo_strace {
+ trc("t=%v resource=%v rlim=%v, (%v:)", t, resource, rlim, origin(2))
+ }
if _, _, err := unix.Syscall(unix.SYS_GETRLIMIT, uintptr(resource), uintptr(rlim), 0); err != 0 {
t.setErrno(err)
return -1
@@ -256,6 +305,9 @@ func Xgetrlimit64(t *TLS, resource int32, rlim uintptr) int32 {
// int mkdir(const char *path, mode_t mode);
func Xmkdir(t *TLS, path uintptr, mode types.Mode_t) int32 {
+ if __ccgo_strace {
+ trc("t=%v path=%v mode=%v, (%v:)", t, path, mode, origin(2))
+ }
if _, _, err := unix.Syscall(unix.SYS_MKDIR, path, uintptr(mode), 0); err != 0 {
t.setErrno(err)
return -1
@@ -269,6 +321,9 @@ func Xmkdir(t *TLS, path uintptr, mode types.Mode_t) int32 {
// int symlink(const char *target, const char *linkpath);
func Xsymlink(t *TLS, target, linkpath uintptr) int32 {
+ if __ccgo_strace {
+ trc("t=%v linkpath=%v, (%v:)", t, linkpath, origin(2))
+ }
if _, _, err := unix.Syscall(unix.SYS_SYMLINK, target, linkpath, 0); err != 0 {
t.setErrno(err)
return -1
@@ -282,6 +337,9 @@ func Xsymlink(t *TLS, target, linkpath uintptr) int32 {
// int chmod(const char *pathname, mode_t mode)
func Xchmod(t *TLS, pathname uintptr, mode types.Mode_t) int32 {
+ if __ccgo_strace {
+ trc("t=%v pathname=%v mode=%v, (%v:)", t, pathname, mode, origin(2))
+ }
if _, _, err := unix.Syscall(unix.SYS_CHMOD, pathname, uintptr(mode), 0); err != 0 {
t.setErrno(err)
return -1
@@ -295,6 +353,9 @@ func Xchmod(t *TLS, pathname uintptr, mode types.Mode_t) int32 {
// int utimes(const char *filename, const struct timeval times[2]);
func Xutimes(t *TLS, filename, times uintptr) int32 {
+ if __ccgo_strace {
+ trc("t=%v times=%v, (%v:)", t, times, origin(2))
+ }
if _, _, err := unix.Syscall(unix.SYS_UTIMES, filename, times, 0); err != 0 {
t.setErrno(err)
return -1
@@ -308,6 +369,9 @@ func Xutimes(t *TLS, filename, times uintptr) int32 {
// int unlink(const char *pathname);
func Xunlink(t *TLS, pathname uintptr) int32 {
+ if __ccgo_strace {
+ trc("t=%v pathname=%v, (%v:)", t, pathname, origin(2))
+ }
if _, _, err := unix.Syscall(unix.SYS_UNLINK, pathname, 0, 0); err != 0 {
t.setErrno(err)
return -1
@@ -321,6 +385,9 @@ func Xunlink(t *TLS, pathname uintptr) int32 {
// int access(const char *pathname, int mode);
func Xaccess(t *TLS, pathname uintptr, mode int32) int32 {
+ if __ccgo_strace {
+ trc("t=%v pathname=%v mode=%v, (%v:)", t, pathname, mode, origin(2))
+ }
if _, _, err := unix.Syscall(unix.SYS_ACCESS, pathname, uintptr(mode), 0); err != 0 {
// if dmesgs {
// dmesg("%v: %q: %v", origin(1), GoString(pathname), err)
@@ -337,6 +404,9 @@ func Xaccess(t *TLS, pathname uintptr, mode int32) int32 {
// int rmdir(const char *pathname);
func Xrmdir(t *TLS, pathname uintptr) int32 {
+ if __ccgo_strace {
+ trc("t=%v pathname=%v, (%v:)", t, pathname, origin(2))
+ }
if _, _, err := unix.Syscall(unix.SYS_RMDIR, pathname, 0, 0); err != 0 {
t.setErrno(err)
return -1
@@ -350,6 +420,9 @@ func Xrmdir(t *TLS, pathname uintptr) int32 {
// int rename(const char *oldpath, const char *newpath);
func Xrename(t *TLS, oldpath, newpath uintptr) int32 {
+ if __ccgo_strace {
+ trc("t=%v newpath=%v, (%v:)", t, newpath, origin(2))
+ }
if _, _, err := unix.Syscall(unix.SYS_RENAME, oldpath, newpath, 0); err != 0 {
t.setErrno(err)
return -1
@@ -360,6 +433,9 @@ func Xrename(t *TLS, oldpath, newpath uintptr) int32 {
// int mknod(const char *pathname, mode_t mode, dev_t dev);
func Xmknod(t *TLS, pathname uintptr, mode types.Mode_t, dev types.Dev_t) int32 {
+ if __ccgo_strace {
+ trc("t=%v pathname=%v mode=%v dev=%v, (%v:)", t, pathname, mode, dev, origin(2))
+ }
if _, _, err := unix.Syscall(unix.SYS_MKNOD, pathname, uintptr(mode), uintptr(dev)); err != 0 {
t.setErrno(err)
return -1
@@ -370,6 +446,9 @@ func Xmknod(t *TLS, pathname uintptr, mode types.Mode_t, dev types.Dev_t) int32
// int chown(const char *pathname, uid_t owner, gid_t group);
func Xchown(t *TLS, pathname uintptr, owner types.Uid_t, group types.Gid_t) int32 {
+ if __ccgo_strace {
+ trc("t=%v pathname=%v owner=%v group=%v, (%v:)", t, pathname, owner, group, origin(2))
+ }
if _, _, err := unix.Syscall(unix.SYS_CHOWN, pathname, uintptr(owner), uintptr(group)); err != 0 {
t.setErrno(err)
return -1
@@ -380,6 +459,9 @@ func Xchown(t *TLS, pathname uintptr, owner types.Uid_t, group types.Gid_t) int3
// int link(const char *oldpath, const char *newpath);
func Xlink(t *TLS, oldpath, newpath uintptr) int32 {
+ if __ccgo_strace {
+ trc("t=%v newpath=%v, (%v:)", t, newpath, origin(2))
+ }
if _, _, err := unix.Syscall(unix.SYS_LINK, oldpath, newpath, 0); err != 0 {
t.setErrno(err)
return -1
@@ -390,6 +472,9 @@ func Xlink(t *TLS, oldpath, newpath uintptr) int32 {
// int pipe(int pipefd[2]);
func Xpipe(t *TLS, pipefd uintptr) int32 {
+ if __ccgo_strace {
+ trc("t=%v pipefd=%v, (%v:)", t, pipefd, origin(2))
+ }
if _, _, err := unix.Syscall(unix.SYS_PIPE, pipefd, 0, 0); err != 0 {
t.setErrno(err)
return -1
@@ -400,6 +485,9 @@ func Xpipe(t *TLS, pipefd uintptr) int32 {
// int dup2(int oldfd, int newfd);
func Xdup2(t *TLS, oldfd, newfd int32) int32 {
+ if __ccgo_strace {
+ trc("t=%v newfd=%v, (%v:)", t, newfd, origin(2))
+ }
n, _, err := unix.Syscall(unix.SYS_DUP2, uintptr(oldfd), uintptr(newfd), 0)
if err != 0 {
t.setErrno(err)
@@ -411,6 +499,9 @@ func Xdup2(t *TLS, oldfd, newfd int32) int32 {
// ssize_t readlink(const char *restrict path, char *restrict buf, size_t bufsize);
func Xreadlink(t *TLS, path, buf uintptr, bufsize types.Size_t) types.Ssize_t {
+ if __ccgo_strace {
+ trc("t=%v buf=%v bufsize=%v, (%v:)", t, buf, bufsize, origin(2))
+ }
n, _, err := unix.Syscall(unix.SYS_READLINK, path, buf, uintptr(bufsize))
if err != 0 {
t.setErrno(err)
@@ -422,6 +513,9 @@ func Xreadlink(t *TLS, path, buf uintptr, bufsize types.Size_t) types.Ssize_t {
// FILE *fopen64(const char *pathname, const char *mode);
func Xfopen64(t *TLS, pathname, mode uintptr) uintptr {
+ if __ccgo_strace {
+ trc("t=%v mode=%v, (%v:)", t, mode, origin(2))
+ }
m := strings.ReplaceAll(GoString(mode), "b", "")
var flags int
switch m {
@@ -458,16 +552,25 @@ func Xfopen64(t *TLS, pathname, mode uintptr) uintptr {
// int iswspace(wint_t wc);
func Xiswspace(t *TLS, wc wctype.Wint_t) int32 {
+ if __ccgo_strace {
+ trc("t=%v wc=%v, (%v:)", t, wc, origin(2))
+ }
return Bool32(unicode.IsSpace(rune(wc)))
}
// int iswalnum(wint_t wc);
func Xiswalnum(t *TLS, wc wctype.Wint_t) int32 {
+ if __ccgo_strace {
+ trc("t=%v wc=%v, (%v:)", t, wc, origin(2))
+ }
return Bool32(unicode.IsLetter(rune(wc)) || unicode.IsNumber(rune(wc)))
}
// int setrlimit(int resource, const struct rlimit *rlim);
func Xsetrlimit64(t *TLS, resource int32, rlim uintptr) int32 {
+ if __ccgo_strace {
+ trc("t=%v resource=%v rlim=%v, (%v:)", t, resource, rlim, origin(2))
+ }
if _, _, err := unix.Syscall(unix.SYS_SETRLIMIT, uintptr(resource), uintptr(rlim), 0); err != 0 {
t.setErrno(err)
return -1
@@ -475,3 +578,188 @@ func Xsetrlimit64(t *TLS, resource int32, rlim uintptr) int32 {
return 0
}
+
+func AtomicLoadPInt8(addr uintptr) (val int8) {
+ return int8(a_load_8(addr))
+}
+
+func AtomicLoadPInt16(addr uintptr) (val int16) {
+ return int16(a_load_16(addr))
+}
+
+func AtomicLoadPUint8(addr uintptr) byte {
+ return byte(a_load_8(addr))
+}
+
+func AtomicLoadPUint16(addr uintptr) uint16 {
+ return uint16(a_load_16(addr))
+}
+
+func AtomicLoadNUint8(ptr uintptr, memorder int32) uint8 {
+ return byte(a_load_8(ptr))
+}
+
+var _table1 = [384]int32{
+ 129: int32(1),
+ 130: int32(2),
+ 131: int32(3),
+ 132: int32(4),
+ 133: int32(5),
+ 134: int32(6),
+ 135: int32(7),
+ 136: int32(8),
+ 137: int32(9),
+ 138: int32(10),
+ 139: int32(11),
+ 140: int32(12),
+ 141: int32(13),
+ 142: int32(14),
+ 143: int32(15),
+ 144: int32(16),
+ 145: int32(17),
+ 146: int32(18),
+ 147: int32(19),
+ 148: int32(20),
+ 149: int32(21),
+ 150: int32(22),
+ 151: int32(23),
+ 152: int32(24),
+ 153: int32(25),
+ 154: int32(26),
+ 155: int32(27),
+ 156: int32(28),
+ 157: int32(29),
+ 158: int32(30),
+ 159: int32(31),
+ 160: int32(32),
+ 161: int32(33),
+ 162: int32(34),
+ 163: int32(35),
+ 164: int32(36),
+ 165: int32(37),
+ 166: int32(38),
+ 167: int32(39),
+ 168: int32(40),
+ 169: int32(41),
+ 170: int32(42),
+ 171: int32(43),
+ 172: int32(44),
+ 173: int32(45),
+ 174: int32(46),
+ 175: int32(47),
+ 176: int32(48),
+ 177: int32(49),
+ 178: int32(50),
+ 179: int32(51),
+ 180: int32(52),
+ 181: int32(53),
+ 182: int32(54),
+ 183: int32(55),
+ 184: int32(56),
+ 185: int32(57),
+ 186: int32(58),
+ 187: int32(59),
+ 188: int32(60),
+ 189: int32(61),
+ 190: int32(62),
+ 191: int32(63),
+ 192: int32(64),
+ 193: int32('a'),
+ 194: int32('b'),
+ 195: int32('c'),
+ 196: int32('d'),
+ 197: int32('e'),
+ 198: int32('f'),
+ 199: int32('g'),
+ 200: int32('h'),
+ 201: int32('i'),
+ 202: int32('j'),
+ 203: int32('k'),
+ 204: int32('l'),
+ 205: int32('m'),
+ 206: int32('n'),
+ 207: int32('o'),
+ 208: int32('p'),
+ 209: int32('q'),
+ 210: int32('r'),
+ 211: int32('s'),
+ 212: int32('t'),
+ 213: int32('u'),
+ 214: int32('v'),
+ 215: int32('w'),
+ 216: int32('x'),
+ 217: int32('y'),
+ 218: int32('z'),
+ 219: int32(91),
+ 220: int32(92),
+ 221: int32(93),
+ 222: int32(94),
+ 223: int32(95),
+ 224: int32(96),
+ 225: int32('a'),
+ 226: int32('b'),
+ 227: int32('c'),
+ 228: int32('d'),
+ 229: int32('e'),
+ 230: int32('f'),
+ 231: int32('g'),
+ 232: int32('h'),
+ 233: int32('i'),
+ 234: int32('j'),
+ 235: int32('k'),
+ 236: int32('l'),
+ 237: int32('m'),
+ 238: int32('n'),
+ 239: int32('o'),
+ 240: int32('p'),
+ 241: int32('q'),
+ 242: int32('r'),
+ 243: int32('s'),
+ 244: int32('t'),
+ 245: int32('u'),
+ 246: int32('v'),
+ 247: int32('w'),
+ 248: int32('x'),
+ 249: int32('y'),
+ 250: int32('z'),
+ 251: int32(123),
+ 252: int32(124),
+ 253: int32(125),
+ 254: int32(126),
+ 255: int32(127),
+}
+
+var _ptable1 = uintptr(unsafe.Pointer(&_table1)) + uintptr(128)*4
+
+func X__ctype_tolower_loc(tls *TLS) (r uintptr) {
+ if __ccgo_strace {
+ trc("tls=%v, (%v:)", tls, origin(2))
+ defer func() { trc("-> %v", r) }()
+ }
+ return uintptr(unsafe.Pointer(&_ptable1))
+}
+
+type Tin6_addr = struct {
+ F__in6_union struct {
+ F__s6_addr16 [0][8]uint16
+ F__s6_addr32 [0][4]uint32
+ F__s6_addr [16]uint8
+ }
+}
+
+var Xin6addr_any = Tin6_addr{}
+
+func Xrewinddir(tls *TLS, f uintptr) {
+ if __ccgo_strace {
+ trc("tls=%v f=%v, (%v:)", tls, f, origin(2))
+ }
+ Xfseek(tls, f, 0, stdio.SEEK_SET)
+}
+
+// clock_t clock(void);
+func Xclock(t *TLS) time.Clock_t {
+ if __ccgo_strace {
+ trc("t=%v, (%v:)", t, origin(2))
+ }
+ return time.Clock_t(gotime.Since(startTime) * gotime.Duration(time.CLOCKS_PER_SEC) / gotime.Second)
+}
diff --git a/vendor/modernc.org/libc/libc_linux_arm.go b/vendor/modernc.org/libc/libc_linux_arm.go
index ce45b1ae..debbcba0 100644
--- a/vendor/modernc.org/libc/libc_linux_arm.go
+++ b/vendor/modernc.org/libc/libc_linux_arm.go
@@ -7,19 +7,23 @@ package libc // import "modernc.org/libc"
import (
"os"
"strings"
- "time"
+ time "time"
"unsafe"
"golang.org/x/sys/unix"
"modernc.org/libc/errno"
"modernc.org/libc/fcntl"
"modernc.org/libc/signal"
- "modernc.org/libc/sys/stat"
+ "modernc.org/libc/stdio"
+ // "modernc.org/libc/sys/stat"
"modernc.org/libc/sys/types"
)
// int sigaction(int signum, const struct sigaction *act, struct sigaction *oldact);
func Xsigaction(t *TLS, signum int32, act, oldact uintptr) int32 {
+ if __ccgo_strace {
+ trc("t=%v signum=%v oldact=%v, (%v:)", t, signum, oldact, origin(2))
+ }
// musl/arch/x32/ksigaction.h
//
// struct k_sigaction {
@@ -65,6 +69,9 @@ func Xsigaction(t *TLS, signum int32, act, oldact uintptr) int32 {
// int fcntl(int fd, int cmd, ... /* arg */ );
func Xfcntl64(t *TLS, fd, cmd int32, args uintptr) int32 {
+ if __ccgo_strace {
+ trc("t=%v cmd=%v args=%v, (%v:)", t, cmd, args, origin(2))
+ }
var arg uintptr
if args != 0 {
arg = *(*uintptr)(unsafe.Pointer(args))
@@ -74,186 +81,249 @@ func Xfcntl64(t *TLS, fd, cmd int32, args uintptr) int32 {
}
n, _, err := unix.Syscall(unix.SYS_FCNTL64, uintptr(fd), uintptr(cmd), arg)
if err != 0 {
- if dmesgs {
- dmesg("%v: fd %v cmd %v", origin(1), fcntlCmdStr(fd), cmd)
- }
+ // if dmesgs {
+ // dmesg("%v: fd %v cmd %v", origin(1), fcntlCmdStr(fd), cmd)
+ // }
t.setErrno(err)
return -1
}
- if dmesgs {
- dmesg("%v: %d %s %#x: %d", origin(1), fd, fcntlCmdStr(cmd), arg, n)
- }
+ // if dmesgs {
+ // dmesg("%v: %d %s %#x: %d", origin(1), fd, fcntlCmdStr(cmd), arg, n)
+ // }
return int32(n)
}
// int lstat(const char *pathname, struct stat *statbuf);
func Xlstat64(t *TLS, pathname, statbuf uintptr) int32 {
+ if __ccgo_strace {
+ trc("t=%v statbuf=%v, (%v:)", t, statbuf, origin(2))
+ }
if err := unix.Lstat(GoString(pathname), (*unix.Stat_t)(unsafe.Pointer(statbuf))); err != nil {
- if dmesgs {
- dmesg("%v: %q: %v", origin(1), GoString(pathname), err)
- }
+ // if dmesgs {
+ // dmesg("%v: %q: %v", origin(1), GoString(pathname), err)
+ // }
t.setErrno(err)
return -1
}
- if dmesgs {
- dmesg("%v: %q: ok", origin(1), GoString(pathname))
- }
+ // if dmesgs {
+ // dmesg("%v: %q: ok", origin(1), GoString(pathname))
+ // }
return 0
}
// int stat(const char *pathname, struct stat *statbuf);
func Xstat64(t *TLS, pathname, statbuf uintptr) int32 {
+ if __ccgo_strace {
+ trc("t=%v statbuf=%v, (%v:)", t, statbuf, origin(2))
+ }
if _, _, err := unix.Syscall(unix.SYS_STAT64, pathname, statbuf, 0); err != 0 {
- if dmesgs {
- dmesg("%v: %q: %v", origin(1), GoString(pathname), err)
- }
+ // if dmesgs {
+ // dmesg("%v: %q: %v", origin(1), GoString(pathname), err)
+ // }
t.setErrno(err)
return -1
}
- if dmesgs {
- dmesg("%v: %q: ok", origin(1), GoString(pathname))
- }
+ // if dmesgs {
+ // dmesg("%v: %q: ok", origin(1), GoString(pathname))
+ // }
return 0
}
// int fstat(int fd, struct stat *statbuf);
func Xfstat64(t *TLS, fd int32, statbuf uintptr) int32 {
+ if __ccgo_strace {
+ trc("t=%v fd=%v statbuf=%v, (%v:)", t, fd, statbuf, origin(2))
+ }
if _, _, err := unix.Syscall(unix.SYS_FSTAT64, uintptr(fd), statbuf, 0); err != 0 {
- if dmesgs {
- dmesg("%v: fd %d: %v", origin(1), fd, err)
- }
+ // if dmesgs {
+ // dmesg("%v: fd %d: %v", origin(1), fd, err)
+ // }
t.setErrno(err)
return -1
}
- if dmesgs {
- dmesg("%v: %d, size %#x: ok\n%+v", origin(1), fd, (*stat.Stat)(unsafe.Pointer(statbuf)).Fst_size, (*stat.Stat)(unsafe.Pointer(statbuf)))
- }
+ // if dmesgs {
+ // dmesg("%v: %d, size %#x: ok\n%+v", origin(1), fd, (*stat.Stat)(unsafe.Pointer(statbuf)).Fst_size, (*stat.Stat)(unsafe.Pointer(statbuf)))
+ // }
return 0
}
// void *mremap(void *old_address, size_t old_size, size_t new_size, int flags, ... /* void *new_address */);
func Xmremap(t *TLS, old_address uintptr, old_size, new_size types.Size_t, flags int32, args uintptr) uintptr {
+ if __ccgo_strace {
+ trc("t=%v old_address=%v new_size=%v flags=%v args=%v, (%v:)", t, old_address, new_size, flags, args, origin(2))
+ }
var arg uintptr
if args != 0 {
arg = *(*uintptr)(unsafe.Pointer(args))
}
data, _, err := unix.Syscall6(unix.SYS_MREMAP, old_address, uintptr(old_size), uintptr(new_size), uintptr(flags), arg, 0)
if err != 0 {
- if dmesgs {
- dmesg("%v: %v", origin(1), err)
- }
+ // if dmesgs {
+ // dmesg("%v: %v", origin(1), err)
+ // }
t.setErrno(err)
return ^uintptr(0) // (void*)-1
}
- if dmesgs {
- dmesg("%v: %#x", origin(1), data)
- }
+ // if dmesgs {
+ // dmesg("%v: %#x", origin(1), data)
+ // }
return data
}
// void *mmap(void *addr, size_t length, int prot, int flags, int fd, off_t offset);
func Xmmap(t *TLS, addr uintptr, length types.Size_t, prot, flags, fd int32, offset types.Off_t) uintptr {
+ if __ccgo_strace {
+ trc("t=%v addr=%v length=%v fd=%v offset=%v, (%v:)", t, addr, length, fd, offset, origin(2))
+ }
return Xmmap64(t, addr, length, prot, flags, fd, offset)
}
// void *mmap(void *addr, size_t length, int prot, int flags, int fd, off_t offset);
func Xmmap64(t *TLS, addr uintptr, length types.Size_t, prot, flags, fd int32, offset types.Off_t) uintptr {
+ if __ccgo_strace {
+ trc("t=%v addr=%v length=%v fd=%v offset=%v, (%v:)", t, addr, length, fd, offset, origin(2))
+ }
data, _, err := unix.Syscall6(unix.SYS_MMAP2, addr, uintptr(length), uintptr(prot), uintptr(flags), uintptr(fd), uintptr(offset>>12))
if err != 0 {
- if dmesgs {
- dmesg("%v: %v", origin(1), err)
- }
+ // if dmesgs {
+ // dmesg("%v: %v", origin(1), err)
+ // }
t.setErrno(err)
return ^uintptr(0) // (void*)-1
}
- if dmesgs {
- dmesg("%v: %#x", origin(1), data)
- }
+ // if dmesgs {
+ // dmesg("%v: %#x", origin(1), data)
+ // }
return data
}
// int symlink(const char *target, const char *linkpath);
func Xsymlink(t *TLS, target, linkpath uintptr) int32 {
+ if __ccgo_strace {
+ trc("t=%v linkpath=%v, (%v:)", t, linkpath, origin(2))
+ }
if err := unix.Symlink(GoString(target), GoString(linkpath)); err != nil {
t.setErrno(err)
return -1
}
- if dmesgs {
- dmesg("%v: %q %q: ok", origin(1), GoString(target), GoString(linkpath))
- }
+ // if dmesgs {
+ // dmesg("%v: %q %q: ok", origin(1), GoString(target), GoString(linkpath))
+ // }
return 0
}
// int chmod(const char *pathname, mode_t mode)
func Xchmod(t *TLS, pathname uintptr, mode types.Mode_t) int32 {
+ if __ccgo_strace {
+ trc("t=%v pathname=%v mode=%v, (%v:)", t, pathname, mode, origin(2))
+ }
if err := unix.Chmod(GoString(pathname), uint32(mode)); err != nil {
t.setErrno(err)
return -1
}
- if dmesgs {
- dmesg("%v: %q %#o: ok", origin(1), GoString(pathname), mode)
- }
+ // if dmesgs {
+ // dmesg("%v: %q %#o: ok", origin(1), GoString(pathname), mode)
+ // }
return 0
}
// int ftruncate(int fd, off_t length);
func Xftruncate64(t *TLS, fd int32, length types.Off_t) int32 {
+ if __ccgo_strace {
+ trc("t=%v fd=%v length=%v, (%v:)", t, fd, length, origin(2))
+ }
if _, _, err := unix.Syscall6(unix.SYS_FTRUNCATE64, uintptr(fd), 0, uintptr(length), uintptr(length>>32), 0, 0); err != 0 {
- if dmesgs {
- dmesg("%v: fd %d: %v", origin(1), fd, err)
- }
+ // if dmesgs {
+ // dmesg("%v: fd %d: %v", origin(1), fd, err)
+ // }
t.setErrno(err)
return -1
}
- if dmesgs {
- dmesg("%v: %d %#x: ok", origin(1), fd, length)
- }
+ // if dmesgs {
+ // dmesg("%v: %d %#x: ok", origin(1), fd, length)
+ // }
return 0
}
// off64_t lseek64(int fd, off64_t offset, int whence);
func Xlseek64(t *TLS, fd int32, offset types.Off_t, whence int32) types.Off_t {
+ if __ccgo_strace {
+ trc("t=%v fd=%v offset=%v whence=%v, (%v:)", t, fd, offset, whence, origin(2))
+ }
n, err := unix.Seek(int(fd), int64(offset), int(whence))
if err != nil {
- if dmesgs {
- dmesg("%v: fd %v, off %#x, whence %v: %v", origin(1), fd, offset, whenceStr(whence), err)
- }
+ // if dmesgs {
+ // dmesg("%v: fd %v, off %#x, whence %v: %v", origin(1), fd, offset, whenceStr(whence), err)
+ // }
t.setErrno(err)
return -1
}
- if dmesgs {
- dmesg("%v: fd %v, off %#x, whence %v: %#x", origin(1), fd, offset, whenceStr(whence), n)
- }
+ // if dmesgs {
+ // dmesg("%v: fd %v, off %#x, whence %v: %#x", origin(1), fd, offset, whenceStr(whence), n)
+ // }
return types.Off_t(n)
}
// int utime(const char *filename, const struct utimbuf *times);
func Xutime(t *TLS, filename, times uintptr) int32 {
- if err := unix.Utime(GoString(filename), (*unix.Utimbuf)(unsafe.Pointer(times))); err != nil {
- t.setErrno(err)
- return -1
+ if __ccgo_strace {
+ trc("t=%v times=%v, (%v:)", t, times, origin(2))
+ }
+ if dmesgs {
+ dmesg("t=%v filename=%q times=%v, (%v:)", t, GoString(filename), times, origin(2))
+ }
+ switch {
+ case times == 0:
+ var buf unix.Utimbuf
+ tm := time.Now().Unix()
+ buf.Actime = int32(tm)
+ buf.Modtime = int32(tm)
+ if err := unix.Utime(GoString(filename), &buf); err != nil {
+ if dmesgs {
+ dmesg("t=%v err=%v", t, err)
+ }
+ t.setErrno(err)
+ return -1
+ }
+ default:
+ if err := unix.Utime(GoString(filename), (*unix.Utimbuf)(unsafe.Pointer(times))); err != nil {
+ if dmesgs {
+ dmesg("t=%v err=%v", t, err)
+ }
+ t.setErrno(err)
+ return -1
+ }
}
+ if dmesgs {
+ dmesg("t=%v OK", t)
+ }
return 0
}
// unsigned int alarm(unsigned int seconds);
func Xalarm(t *TLS, seconds uint32) uint32 {
+ if __ccgo_strace {
+ trc("t=%v seconds=%v, (%v:)", t, seconds, origin(2))
+ }
panic(todo(""))
}
// int getrlimit(int resource, struct rlimit *rlim);
func Xgetrlimit64(t *TLS, resource int32, rlim uintptr) int32 {
+ if __ccgo_strace {
+ trc("t=%v resource=%v rlim=%v, (%v:)", t, resource, rlim, origin(2))
+ }
if err := unix.Getrlimit(int(resource), (*unix.Rlimit)(unsafe.Pointer(rlim))); err != nil {
t.setErrno(err)
return -1
@@ -264,6 +334,9 @@ func Xgetrlimit64(t *TLS, resource int32, rlim uintptr) int32 {
// time_t time(time_t *tloc);
func Xtime(t *TLS, tloc uintptr) types.Time_t {
+ if __ccgo_strace {
+ trc("t=%v tloc=%v, (%v:)", t, tloc, origin(2))
+ }
n := time.Now().UTC().Unix()
if tloc != 0 {
*(*types.Time_t)(unsafe.Pointer(tloc)) = types.Time_t(n)
@@ -273,6 +346,9 @@ func Xtime(t *TLS, tloc uintptr) types.Time_t {
// int utimes(const char *filename, const struct timeval times[2]);
func Xutimes(t *TLS, filename, times uintptr) int32 {
+ if __ccgo_strace {
+ trc("t=%v times=%v, (%v:)", t, times, origin(2))
+ }
var tv []unix.Timeval
if times != 0 {
tv = make([]unix.Timeval, 2)
@@ -286,56 +362,68 @@ func Xutimes(t *TLS, filename, times uintptr) int32 {
if times != 0 {
*(*[2]unix.Timeval)(unsafe.Pointer(times)) = *(*[2]unix.Timeval)(unsafe.Pointer(&tv[0]))
}
- if dmesgs {
- dmesg("%v: %q: ok", origin(1), GoString(filename))
- }
+ // if dmesgs {
+ // dmesg("%v: %q: ok", origin(1), GoString(filename))
+ // }
return 0
}
// int unlink(const char *pathname);
func Xunlink(t *TLS, pathname uintptr) int32 {
+ if __ccgo_strace {
+ trc("t=%v pathname=%v, (%v:)", t, pathname, origin(2))
+ }
if err := unix.Unlinkat(unix.AT_FDCWD, GoString(pathname), 0); err != nil {
t.setErrno(err)
return -1
}
- if dmesgs {
- dmesg("%v: %q: ok", origin(1), GoString(pathname))
- }
+ // if dmesgs {
+ // dmesg("%v: %q: ok", origin(1), GoString(pathname))
+ // }
return 0
}
// int access(const char *pathname, int mode);
func Xaccess(t *TLS, pathname uintptr, mode int32) int32 {
+ if __ccgo_strace {
+ trc("t=%v pathname=%v mode=%v, (%v:)", t, pathname, mode, origin(2))
+ }
if err := unix.Faccessat(unix.AT_FDCWD, GoString(pathname), uint32(mode), 0); err != nil {
- if dmesgs {
- dmesg("%v: %q: %v", origin(1), GoString(pathname), err)
- }
+ // if dmesgs {
+ // dmesg("%v: %q: %v", origin(1), GoString(pathname), err)
+ // }
t.setErrno(err)
return -1
}
- if dmesgs {
- dmesg("%v: %q %#o: ok", origin(1), GoString(pathname), mode)
- }
+ // if dmesgs {
+ // dmesg("%v: %q %#o: ok", origin(1), GoString(pathname), mode)
+ // }
return 0
}
// int rmdir(const char *pathname);
func Xrmdir(t *TLS, pathname uintptr) int32 {
+ if __ccgo_strace {
+ trc("t=%v pathname=%v, (%v:)", t, pathname, origin(2))
+ }
if err := unix.Rmdir(GoString(pathname)); err != nil {
t.setErrno(err)
return -1
}
- if dmesgs {
- dmesg("%v: %q: ok", origin(1), GoString(pathname))
- }
+ // if dmesgs {
+ // dmesg("%v: %q: ok", origin(1), GoString(pathname))
+ // }
return 0
}
// int rename(const char *oldpath, const char *newpath);
func Xrename(t *TLS, oldpath, newpath uintptr) int32 {
+ if __ccgo_strace {
+ trc("t=%v newpath=%v, (%v:)", t, newpath, origin(2))
+ }
if err := unix.Rename(GoString(oldpath), GoString(newpath)); err != nil {
t.setErrno(err)
return -1
@@ -346,11 +434,17 @@ func Xrename(t *TLS, oldpath, newpath uintptr) int32 {
// int mknod(const char *pathname, mode_t mode, dev_t dev);
func Xmknod(t *TLS, pathname uintptr, mode types.Mode_t, dev types.Dev_t) int32 {
+ if __ccgo_strace {
+ trc("t=%v pathname=%v mode=%v dev=%v, (%v:)", t, pathname, mode, dev, origin(2))
+ }
panic(todo(""))
}
// int chown(const char *pathname, uid_t owner, gid_t group);
func Xchown(t *TLS, pathname uintptr, owner types.Uid_t, group types.Gid_t) int32 {
+ if __ccgo_strace {
+ trc("t=%v pathname=%v owner=%v group=%v, (%v:)", t, pathname, owner, group, origin(2))
+ }
if err := unix.Chown(GoString(pathname), int(owner), int(group)); err != nil {
t.setErrno(err)
return -1
@@ -361,11 +455,17 @@ func Xchown(t *TLS, pathname uintptr, owner types.Uid_t, group types.Gid_t) int3
// int link(const char *oldpath, const char *newpath);
func Xlink(t *TLS, oldpath, newpath uintptr) int32 {
+ if __ccgo_strace {
+ trc("t=%v newpath=%v, (%v:)", t, newpath, origin(2))
+ }
panic(todo(""))
}
// int pipe(int pipefd[2]);
func Xpipe(t *TLS, pipefd uintptr) int32 {
+ if __ccgo_strace {
+ trc("t=%v pipefd=%v, (%v:)", t, pipefd, origin(2))
+ }
if _, _, err := unix.Syscall(unix.SYS_PIPE2, pipefd, 0, 0); err != 0 {
t.setErrno(err)
return -1
@@ -376,11 +476,17 @@ func Xpipe(t *TLS, pipefd uintptr) int32 {
// int dup2(int oldfd, int newfd);
func Xdup2(t *TLS, oldfd, newfd int32) int32 {
+ if __ccgo_strace {
+ trc("t=%v newfd=%v, (%v:)", t, newfd, origin(2))
+ }
panic(todo(""))
}
// ssize_t readlink(const char *restrict path, char *restrict buf, size_t bufsize);
func Xreadlink(t *TLS, path, buf uintptr, bufsize types.Size_t) types.Ssize_t {
+ if __ccgo_strace {
+ trc("t=%v buf=%v bufsize=%v, (%v:)", t, buf, bufsize, origin(2))
+ }
n, err := unix.Readlink(GoString(path), GoBytes(buf, int(bufsize)))
if err != nil {
t.setErrno(err)
@@ -392,6 +498,9 @@ func Xreadlink(t *TLS, path, buf uintptr, bufsize types.Size_t) types.Ssize_t {
// FILE *fopen64(const char *pathname, const char *mode);
func Xfopen64(t *TLS, pathname, mode uintptr) uintptr {
+ if __ccgo_strace {
+ trc("t=%v mode=%v, (%v:)", t, mode, origin(2))
+ }
m := strings.ReplaceAll(GoString(mode), "b", "")
var flags int
switch m {
@@ -428,14 +537,17 @@ func Xfopen64(t *TLS, pathname, mode uintptr) uintptr {
// int mkdir(const char *path, mode_t mode);
func Xmkdir(t *TLS, path uintptr, mode types.Mode_t) int32 {
+ if __ccgo_strace {
+ trc("t=%v path=%v mode=%v, (%v:)", t, path, mode, origin(2))
+ }
if err := unix.Mkdir(GoString(path), uint32(mode)); err != nil {
t.setErrno(err)
return -1
}
- if dmesgs {
- dmesg("%v: %q: ok", origin(1), GoString(path))
- }
+ // if dmesgs {
+ // dmesg("%v: %q: ok", origin(1), GoString(path))
+ // }
return 0
}
@@ -450,6 +562,9 @@ func Xmkdir(t *TLS, path uintptr, mode types.Mode_t) int32 {
// int setrlimit(int resource, const struct rlimit *rlim);
func Xsetrlimit64(t *TLS, resource int32, rlim uintptr) int32 {
+ if __ccgo_strace {
+ trc("t=%v resource=%v rlim=%v, (%v:)", t, resource, rlim, origin(2))
+ }
if _, _, err := unix.Syscall(unix.SYS_SETRLIMIT, uintptr(resource), uintptr(rlim), 0); err != 0 {
t.setErrno(err)
return -1
@@ -457,3 +572,164 @@ func Xsetrlimit64(t *TLS, resource int32, rlim uintptr) int32 {
return 0
}
+
+var _table1 = [384]int32{
+ 129: int32(1),
+ 130: int32(2),
+ 131: int32(3),
+ 132: int32(4),
+ 133: int32(5),
+ 134: int32(6),
+ 135: int32(7),
+ 136: int32(8),
+ 137: int32(9),
+ 138: int32(10),
+ 139: int32(11),
+ 140: int32(12),
+ 141: int32(13),
+ 142: int32(14),
+ 143: int32(15),
+ 144: int32(16),
+ 145: int32(17),
+ 146: int32(18),
+ 147: int32(19),
+ 148: int32(20),
+ 149: int32(21),
+ 150: int32(22),
+ 151: int32(23),
+ 152: int32(24),
+ 153: int32(25),
+ 154: int32(26),
+ 155: int32(27),
+ 156: int32(28),
+ 157: int32(29),
+ 158: int32(30),
+ 159: int32(31),
+ 160: int32(32),
+ 161: int32(33),
+ 162: int32(34),
+ 163: int32(35),
+ 164: int32(36),
+ 165: int32(37),
+ 166: int32(38),
+ 167: int32(39),
+ 168: int32(40),
+ 169: int32(41),
+ 170: int32(42),
+ 171: int32(43),
+ 172: int32(44),
+ 173: int32(45),
+ 174: int32(46),
+ 175: int32(47),
+ 176: int32(48),
+ 177: int32(49),
+ 178: int32(50),
+ 179: int32(51),
+ 180: int32(52),
+ 181: int32(53),
+ 182: int32(54),
+ 183: int32(55),
+ 184: int32(56),
+ 185: int32(57),
+ 186: int32(58),
+ 187: int32(59),
+ 188: int32(60),
+ 189: int32(61),
+ 190: int32(62),
+ 191: int32(63),
+ 192: int32(64),
+ 193: int32('a'),
+ 194: int32('b'),
+ 195: int32('c'),
+ 196: int32('d'),
+ 197: int32('e'),
+ 198: int32('f'),
+ 199: int32('g'),
+ 200: int32('h'),
+ 201: int32('i'),
+ 202: int32('j'),
+ 203: int32('k'),
+ 204: int32('l'),
+ 205: int32('m'),
+ 206: int32('n'),
+ 207: int32('o'),
+ 208: int32('p'),
+ 209: int32('q'),
+ 210: int32('r'),
+ 211: int32('s'),
+ 212: int32('t'),
+ 213: int32('u'),
+ 214: int32('v'),
+ 215: int32('w'),
+ 216: int32('x'),
+ 217: int32('y'),
+ 218: int32('z'),
+ 219: int32(91),
+ 220: int32(92),
+ 221: int32(93),
+ 222: int32(94),
+ 223: int32(95),
+ 224: int32(96),
+ 225: int32('a'),
+ 226: int32('b'),
+ 227: int32('c'),
+ 228: int32('d'),
+ 229: int32('e'),
+ 230: int32('f'),
+ 231: int32('g'),
+ 232: int32('h'),
+ 233: int32('i'),
+ 234: int32('j'),
+ 235: int32('k'),
+ 236: int32('l'),
+ 237: int32('m'),
+ 238: int32('n'),
+ 239: int32('o'),
+ 240: int32('p'),
+ 241: int32('q'),
+ 242: int32('r'),
+ 243: int32('s'),
+ 244: int32('t'),
+ 245: int32('u'),
+ 246: int32('v'),
+ 247: int32('w'),
+ 248: int32('x'),
+ 249: int32('y'),
+ 250: int32('z'),
+ 251: int32(123),
+ 252: int32(124),
+ 253: int32(125),
+ 254: int32(126),
+ 255: int32(127),
+}
+
+var _ptable1 = uintptr(unsafe.Pointer(&_table1)) + uintptr(128)*4
+
+func X__ctype_tolower_loc(tls *TLS) (r uintptr) {
+ if __ccgo_strace {
+ trc("tls=%v, (%v:)", tls, origin(2))
+ defer func() { trc("-> %v", r) }()
+ }
+ return uintptr(unsafe.Pointer(&_ptable1))
+}
+
+var Xin6addr_any = Tin6_addr{}
+
+type Tin6_addr = struct {
+ F__in6_union struct {
+ F__s6_addr16 [0][8]uint16
+ F__s6_addr32 [0][4]uint32
+ F__s6_addr [16]uint8
+ }
+}
+
+func Xrewinddir(tls *TLS, f uintptr) {
+ if __ccgo_strace {
+ trc("tls=%v f=%v, (%v:)", tls, f, origin(2))
+ }
+ Xfseek(tls, f, 0, stdio.SEEK_SET)
+}
+
+func AtomicLoadNUint8(ptr uintptr, memorder int32) uint8 {
+ return byte(a_load_8(ptr))
+}
diff --git a/vendor/modernc.org/libc/libc_linux_arm64.go b/vendor/modernc.org/libc/libc_linux_arm64.go
index 1b83364e..c3ea7fd0 100644
--- a/vendor/modernc.org/libc/libc_linux_arm64.go
+++ b/vendor/modernc.org/libc/libc_linux_arm64.go
@@ -20,6 +20,9 @@ import (
// int sigaction(int signum, const struct sigaction *act, struct sigaction *oldact);
func Xsigaction(t *TLS, signum int32, act, oldact uintptr) int32 {
+ if __ccgo_strace {
+ trc("t=%v signum=%v oldact=%v, (%v:)", t, signum, oldact, origin(2))
+ }
// musl/src/internal/ksigaction.h
//
// struct k_sigaction {
@@ -65,6 +68,9 @@ func Xsigaction(t *TLS, signum int32, act, oldact uintptr) int32 {
// int lstat(const char *pathname, struct stat *statbuf);
func Xlstat64(t *TLS, pathname, statbuf uintptr) int32 {
+ if __ccgo_strace {
+ trc("t=%v statbuf=%v, (%v:)", t, statbuf, origin(2))
+ }
if err := unix.Lstat(GoString(pathname), (*unix.Stat_t)(unsafe.Pointer(statbuf))); err != nil {
if dmesgs {
dmesg("%v: %q: %v", origin(1), GoString(pathname), err)
@@ -81,6 +87,9 @@ func Xlstat64(t *TLS, pathname, statbuf uintptr) int32 {
// int stat(const char *pathname, struct stat *statbuf);
func Xstat64(t *TLS, pathname, statbuf uintptr) int32 {
+ if __ccgo_strace {
+ trc("t=%v statbuf=%v, (%v:)", t, statbuf, origin(2))
+ }
if err := unix.Fstatat(unix.AT_FDCWD, GoString(pathname), (*unix.Stat_t)(unsafe.Pointer(statbuf)), 0); err != nil {
if dmesgs {
dmesg("%v: %q: %v", origin(1), GoString(pathname), err)
@@ -97,6 +106,9 @@ func Xstat64(t *TLS, pathname, statbuf uintptr) int32 {
// int unlink(const char *pathname);
func Xunlink(t *TLS, pathname uintptr) int32 {
+ if __ccgo_strace {
+ trc("t=%v pathname=%v, (%v:)", t, pathname, origin(2))
+ }
if err := unix.Unlinkat(unix.AT_FDCWD, GoString(pathname), 0); err != nil {
t.setErrno(err)
return -1
@@ -110,6 +122,9 @@ func Xunlink(t *TLS, pathname uintptr) int32 {
// int access(const char *pathname, int mode);
func Xaccess(t *TLS, pathname uintptr, mode int32) int32 {
+ if __ccgo_strace {
+ trc("t=%v pathname=%v mode=%v, (%v:)", t, pathname, mode, origin(2))
+ }
if err := unix.Faccessat(unix.AT_FDCWD, GoString(pathname), uint32(mode), 0); err != nil {
if dmesgs {
dmesg("%v: %q: %v", origin(1), GoString(pathname), err)
@@ -126,6 +141,9 @@ func Xaccess(t *TLS, pathname uintptr, mode int32) int32 {
// off64_t lseek64(int fd, off64_t offset, int whence);
func Xlseek64(t *TLS, fd int32, offset types.Off_t, whence int32) types.Off_t {
+ if __ccgo_strace {
+ trc("t=%v fd=%v offset=%v whence=%v, (%v:)", t, fd, offset, whence, origin(2))
+ }
n, _, err := unix.Syscall(unix.SYS_LSEEK, uintptr(fd), uintptr(offset), uintptr(whence))
if err != 0 {
if dmesgs {
@@ -143,6 +161,9 @@ func Xlseek64(t *TLS, fd int32, offset types.Off_t, whence int32) types.Off_t {
// int fstat(int fd, struct stat *statbuf);
func Xfstat64(t *TLS, fd int32, statbuf uintptr) int32 {
+ if __ccgo_strace {
+ trc("t=%v fd=%v statbuf=%v, (%v:)", t, fd, statbuf, origin(2))
+ }
if _, _, err := unix.Syscall(unix.SYS_FSTAT, uintptr(fd), statbuf, 0); err != 0 {
if dmesgs {
dmesg("%v: fd %d: %v", origin(1), fd, err)
@@ -159,6 +180,9 @@ func Xfstat64(t *TLS, fd int32, statbuf uintptr) int32 {
// int ftruncate(int fd, off_t length);
func Xftruncate64(t *TLS, fd int32, length types.Off_t) int32 {
+ if __ccgo_strace {
+ trc("t=%v fd=%v length=%v, (%v:)", t, fd, length, origin(2))
+ }
if _, _, err := unix.Syscall(unix.SYS_FTRUNCATE, uintptr(fd), uintptr(length), 0); err != 0 {
if dmesgs {
dmesg("%v: fd %d: %v", origin(1), fd, err)
@@ -175,6 +199,9 @@ func Xftruncate64(t *TLS, fd int32, length types.Off_t) int32 {
// int fcntl(int fd, int cmd, ... /* arg */ );
func Xfcntl64(t *TLS, fd, cmd int32, args uintptr) int32 {
+ if __ccgo_strace {
+ trc("t=%v cmd=%v args=%v, (%v:)", t, cmd, args, origin(2))
+ }
var arg uintptr
if args != 0 {
arg = *(*uintptr)(unsafe.Pointer(args))
@@ -199,6 +226,9 @@ func Xfcntl64(t *TLS, fd, cmd int32, args uintptr) int32 {
// int rmdir(const char *pathname);
func Xrmdir(t *TLS, pathname uintptr) int32 {
+ if __ccgo_strace {
+ trc("t=%v pathname=%v, (%v:)", t, pathname, origin(2))
+ }
if err := unix.Rmdir(GoString(pathname)); err != nil {
t.setErrno(err)
return -1
@@ -212,6 +242,9 @@ func Xrmdir(t *TLS, pathname uintptr) int32 {
// int rename(const char *oldpath, const char *newpath);
func Xrename(t *TLS, oldpath, newpath uintptr) int32 {
+ if __ccgo_strace {
+ trc("t=%v newpath=%v, (%v:)", t, newpath, origin(2))
+ }
if err := unix.Rename(GoString(oldpath), GoString(newpath)); err != nil {
t.setErrno(err)
return -1
@@ -222,11 +255,17 @@ func Xrename(t *TLS, oldpath, newpath uintptr) int32 {
// int mknod(const char *pathname, mode_t mode, dev_t dev);
func Xmknod(t *TLS, pathname uintptr, mode types.Mode_t, dev types.Dev_t) int32 {
+ if __ccgo_strace {
+ trc("t=%v pathname=%v mode=%v dev=%v, (%v:)", t, pathname, mode, dev, origin(2))
+ }
panic(todo(""))
}
// int chown(const char *pathname, uid_t owner, gid_t group);
func Xchown(t *TLS, pathname uintptr, owner types.Uid_t, group types.Gid_t) int32 {
+ if __ccgo_strace {
+ trc("t=%v pathname=%v owner=%v group=%v, (%v:)", t, pathname, owner, group, origin(2))
+ }
if err := unix.Chown(GoString(pathname), int(owner), int(group)); err != nil {
t.setErrno(err)
return -1
@@ -237,11 +276,17 @@ func Xchown(t *TLS, pathname uintptr, owner types.Uid_t, group types.Gid_t) int3
// int link(const char *oldpath, const char *newpath);
func Xlink(t *TLS, oldpath, newpath uintptr) int32 {
+ if __ccgo_strace {
+ trc("t=%v newpath=%v, (%v:)", t, newpath, origin(2))
+ }
panic(todo(""))
}
// int pipe(int pipefd[2]);
func Xpipe(t *TLS, pipefd uintptr) int32 {
+ if __ccgo_strace {
+ trc("t=%v pipefd=%v, (%v:)", t, pipefd, origin(2))
+ }
if _, _, err := unix.Syscall(unix.SYS_PIPE2, pipefd, 0, 0); err != 0 {
t.setErrno(err)
return -1
@@ -252,11 +297,17 @@ func Xpipe(t *TLS, pipefd uintptr) int32 {
// int dup2(int oldfd, int newfd);
func Xdup2(t *TLS, oldfd, newfd int32) int32 {
+ if __ccgo_strace {
+ trc("t=%v newfd=%v, (%v:)", t, newfd, origin(2))
+ }
panic(todo(""))
}
// int getrlimit(int resource, struct rlimit *rlim);
func Xgetrlimit64(t *TLS, resource int32, rlim uintptr) int32 {
+ if __ccgo_strace {
+ trc("t=%v resource=%v rlim=%v, (%v:)", t, resource, rlim, origin(2))
+ }
if _, _, err := unix.Syscall(unix.SYS_GETRLIMIT, uintptr(resource), uintptr(rlim), 0); err != 0 {
t.setErrno(err)
return -1
@@ -267,6 +318,9 @@ func Xgetrlimit64(t *TLS, resource int32, rlim uintptr) int32 {
// ssize_t readlink(const char *restrict path, char *restrict buf, size_t bufsize);
func Xreadlink(t *TLS, path, buf uintptr, bufsize types.Size_t) types.Ssize_t {
+ if __ccgo_strace {
+ trc("t=%v buf=%v bufsize=%v, (%v:)", t, buf, bufsize, origin(2))
+ }
n, err := unix.Readlink(GoString(path), GoBytes(buf, int(bufsize)))
if err != nil {
t.setErrno(err)
@@ -278,6 +332,9 @@ func Xreadlink(t *TLS, path, buf uintptr, bufsize types.Size_t) types.Ssize_t {
// FILE *fopen64(const char *pathname, const char *mode);
func Xfopen64(t *TLS, pathname, mode uintptr) uintptr {
+ if __ccgo_strace {
+ trc("t=%v mode=%v, (%v:)", t, mode, origin(2))
+ }
m := strings.ReplaceAll(GoString(mode), "b", "")
var flags int
switch m {
@@ -314,6 +371,9 @@ func Xfopen64(t *TLS, pathname, mode uintptr) uintptr {
// int mkdir(const char *path, mode_t mode);
func Xmkdir(t *TLS, path uintptr, mode types.Mode_t) int32 {
+ if __ccgo_strace {
+ trc("t=%v path=%v mode=%v, (%v:)", t, path, mode, origin(2))
+ }
if err := unix.Mkdir(GoString(path), uint32(mode)); err != nil {
t.setErrno(err)
return -1
@@ -327,6 +387,9 @@ func Xmkdir(t *TLS, path uintptr, mode types.Mode_t) int32 {
// void *mremap(void *old_address, size_t old_size, size_t new_size, int flags, ... /* void *new_address */);
func Xmremap(t *TLS, old_address uintptr, old_size, new_size types.Size_t, flags int32, args uintptr) uintptr {
+ if __ccgo_strace {
+ trc("t=%v old_address=%v new_size=%v flags=%v args=%v, (%v:)", t, old_address, new_size, flags, args, origin(2))
+ }
var arg uintptr
if args != 0 {
arg = *(*uintptr)(unsafe.Pointer(args))
@@ -347,11 +410,17 @@ func Xmremap(t *TLS, old_address uintptr, old_size, new_size types.Size_t, flags
}
func Xmmap(t *TLS, addr uintptr, length types.Size_t, prot, flags, fd int32, offset types.Off_t) uintptr {
+ if __ccgo_strace {
+ trc("t=%v addr=%v length=%v fd=%v offset=%v, (%v:)", t, addr, length, fd, offset, origin(2))
+ }
return Xmmap64(t, addr, length, prot, flags, fd, offset)
}
// void *mmap(void *addr, size_t length, int prot, int flags, int fd, off_t offset);
func Xmmap64(t *TLS, addr uintptr, length types.Size_t, prot, flags, fd int32, offset types.Off_t) uintptr {
+ if __ccgo_strace {
+ trc("t=%v addr=%v length=%v fd=%v offset=%v, (%v:)", t, addr, length, fd, offset, origin(2))
+ }
data, _, err := unix.Syscall6(unix.SYS_MMAP, addr, uintptr(length), uintptr(prot), uintptr(flags), uintptr(fd), uintptr(offset))
if err != 0 {
if dmesgs {
@@ -369,6 +438,9 @@ func Xmmap64(t *TLS, addr uintptr, length types.Size_t, prot, flags, fd int32, o
// int symlink(const char *target, const char *linkpath);
func Xsymlink(t *TLS, target, linkpath uintptr) int32 {
+ if __ccgo_strace {
+ trc("t=%v linkpath=%v, (%v:)", t, linkpath, origin(2))
+ }
if err := unix.Symlink(GoString(target), GoString(linkpath)); err != nil {
t.setErrno(err)
return -1
@@ -382,6 +454,9 @@ func Xsymlink(t *TLS, target, linkpath uintptr) int32 {
// int chmod(const char *pathname, mode_t mode)
func Xchmod(t *TLS, pathname uintptr, mode types.Mode_t) int32 {
+ if __ccgo_strace {
+ trc("t=%v pathname=%v mode=%v, (%v:)", t, pathname, mode, origin(2))
+ }
if err := unix.Chmod(GoString(pathname), uint32(mode)); err != nil {
t.setErrno(err)
return -1
@@ -395,6 +470,9 @@ func Xchmod(t *TLS, pathname uintptr, mode types.Mode_t) int32 {
// time_t time(time_t *tloc);
func Xtime(t *TLS, tloc uintptr) types.Time_t {
+ if __ccgo_strace {
+ trc("t=%v tloc=%v, (%v:)", t, tloc, origin(2))
+ }
n := time.Now().UTC().Unix()
if tloc != 0 {
*(*types.Time_t)(unsafe.Pointer(tloc)) = types.Time_t(n)
@@ -404,6 +482,9 @@ func Xtime(t *TLS, tloc uintptr) types.Time_t {
// int utimes(const char *filename, const struct timeval times[2]);
func Xutimes(t *TLS, filename, times uintptr) int32 {
+ if __ccgo_strace {
+ trc("t=%v times=%v, (%v:)", t, times, origin(2))
+ }
var tv []unix.Timeval
if times != 0 {
tv = make([]unix.Timeval, 2)
@@ -425,6 +506,9 @@ func Xutimes(t *TLS, filename, times uintptr) int32 {
// int utime(const char *filename, const struct utimbuf *times);
func Xutime(t *TLS, filename, times uintptr) int32 {
+ if __ccgo_strace {
+ trc("t=%v times=%v, (%v:)", t, times, origin(2))
+ }
if err := unix.Utime(GoString(filename), (*unix.Utimbuf)(unsafe.Pointer(times))); err != nil {
t.setErrno(err)
return -1
@@ -435,11 +519,17 @@ func Xutime(t *TLS, filename, times uintptr) int32 {
// unsigned int alarm(unsigned int seconds);
func Xalarm(t *TLS, seconds uint32) uint32 {
+ if __ccgo_strace {
+ trc("t=%v seconds=%v, (%v:)", t, seconds, origin(2))
+ }
panic(todo(""))
}
// int setrlimit(int resource, const struct rlimit *rlim);
func Xsetrlimit64(t *TLS, resource int32, rlim uintptr) int32 {
+ if __ccgo_strace {
+ trc("t=%v resource=%v rlim=%v, (%v:)", t, resource, rlim, origin(2))
+ }
if _, _, err := unix.Syscall(unix.SYS_SETRLIMIT, uintptr(resource), uintptr(rlim), 0); err != 0 {
t.setErrno(err)
return -1
@@ -447,3 +537,7 @@ func Xsetrlimit64(t *TLS, resource int32, rlim uintptr) int32 {
return 0
}
+
+func AtomicLoadNUint8(ptr uintptr, memorder int32) uint8 {
+ return byte(a_load_8(ptr))
+}
diff --git a/vendor/modernc.org/libc/libc_linux_loong64.go b/vendor/modernc.org/libc/libc_linux_loong64.go
index 5dc8d5e0..b8b4f94f 100644
--- a/vendor/modernc.org/libc/libc_linux_loong64.go
+++ b/vendor/modernc.org/libc/libc_linux_loong64.go
@@ -5,10 +5,10 @@
package libc // import "modernc.org/libc"
import (
- "unicode"
- "unsafe"
"os"
"strings"
+ "unicode"
+ "unsafe"
"golang.org/x/sys/unix"
"modernc.org/libc/errno"
@@ -20,6 +20,9 @@ import (
// int sigaction(int signum, const struct sigaction *act, struct sigaction *oldact);
func Xsigaction(t *TLS, signum int32, act, oldact uintptr) int32 {
+ if __ccgo_strace {
+ trc("t=%v signum=%v oldact=%v, (%v:)", t, signum, oldact, origin(2))
+ }
// musl/arch/x86_64/ksigaction.h
//
// struct k_sigaction {
@@ -65,6 +68,9 @@ func Xsigaction(t *TLS, signum int32, act, oldact uintptr) int32 {
// int fcntl(int fd, int cmd, ... /* arg */ );
func Xfcntl64(t *TLS, fd, cmd int32, args uintptr) int32 {
+ if __ccgo_strace {
+ trc("t=%v cmd=%v args=%v, (%v:)", t, cmd, args, origin(2))
+ }
var arg uintptr
if args != 0 {
arg = *(*uintptr)(unsafe.Pointer(args))
@@ -89,6 +95,9 @@ func Xfcntl64(t *TLS, fd, cmd int32, args uintptr) int32 {
// int lstat(const char *pathname, struct stat *statbuf);
func Xlstat64(t *TLS, pathname, statbuf uintptr) int32 {
+ if __ccgo_strace {
+ trc("t=%v statbuf=%v, (%v:)", t, statbuf, origin(2))
+ }
panic(todo(""))
// if _, _, err := unix.Syscall(unix.SYS_LSTAT, pathname, statbuf, 0); err != 0 {
// // if dmesgs {
@@ -106,6 +115,9 @@ func Xlstat64(t *TLS, pathname, statbuf uintptr) int32 {
// int stat(const char *pathname, struct stat *statbuf);
func Xstat64(t *TLS, pathname, statbuf uintptr) int32 {
+ if __ccgo_strace {
+ trc("t=%v statbuf=%v, (%v:)", t, statbuf, origin(2))
+ }
panic(todo(""))
// if _, _, err := unix.Syscall(unix.SYS_STAT, pathname, statbuf, 0); err != 0 {
// // if dmesgs {
@@ -123,6 +135,9 @@ func Xstat64(t *TLS, pathname, statbuf uintptr) int32 {
// int fstat(int fd, struct stat *statbuf);
func Xfstat64(t *TLS, fd int32, statbuf uintptr) int32 {
+ if __ccgo_strace {
+ trc("t=%v fd=%v statbuf=%v, (%v:)", t, fd, statbuf, origin(2))
+ }
panic(todo(""))
// if _, _, err := unix.Syscall(unix.SYS_FSTAT, uintptr(fd), statbuf, 0); err != 0 {
// // if dmesgs {
@@ -139,11 +154,17 @@ func Xfstat64(t *TLS, fd int32, statbuf uintptr) int32 {
}
func Xmmap(t *TLS, addr uintptr, length types.Size_t, prot, flags, fd int32, offset types.Off_t) uintptr {
+ if __ccgo_strace {
+ trc("t=%v addr=%v length=%v fd=%v offset=%v, (%v:)", t, addr, length, fd, offset, origin(2))
+ }
return Xmmap64(t, addr, length, prot, flags, fd, offset)
}
// void *mmap(void *addr, size_t length, int prot, int flags, int fd, off_t offset);
func Xmmap64(t *TLS, addr uintptr, length types.Size_t, prot, flags, fd int32, offset types.Off_t) uintptr {
+ if __ccgo_strace {
+ trc("t=%v addr=%v length=%v fd=%v offset=%v, (%v:)", t, addr, length, fd, offset, origin(2))
+ }
data, _, err := unix.Syscall6(unix.SYS_MMAP, addr, uintptr(length), uintptr(prot), uintptr(flags), uintptr(fd), uintptr(offset))
if err != 0 {
// if dmesgs {
@@ -161,6 +182,9 @@ func Xmmap64(t *TLS, addr uintptr, length types.Size_t, prot, flags, fd int32, o
// void *mremap(void *old_address, size_t old_size, size_t new_size, int flags, ... /* void *new_address */);
func Xmremap(t *TLS, old_address uintptr, old_size, new_size types.Size_t, flags int32, args uintptr) uintptr {
+ if __ccgo_strace {
+ trc("t=%v old_address=%v new_size=%v flags=%v args=%v, (%v:)", t, old_address, new_size, flags, args, origin(2))
+ }
var arg uintptr
if args != 0 {
arg = *(*uintptr)(unsafe.Pointer(args))
@@ -182,6 +206,9 @@ func Xmremap(t *TLS, old_address uintptr, old_size, new_size types.Size_t, flags
// int ftruncate(int fd, off_t length);
func Xftruncate64(t *TLS, fd int32, length types.Off_t) int32 {
+ if __ccgo_strace {
+ trc("t=%v fd=%v length=%v, (%v:)", t, fd, length, origin(2))
+ }
if _, _, err := unix.Syscall(unix.SYS_FTRUNCATE, uintptr(fd), uintptr(length), 0); err != 0 {
// if dmesgs {
// dmesg("%v: fd %d: %v", origin(1), fd, err)
@@ -198,6 +225,9 @@ func Xftruncate64(t *TLS, fd int32, length types.Off_t) int32 {
// off64_t lseek64(int fd, off64_t offset, int whence);
func Xlseek64(t *TLS, fd int32, offset types.Off_t, whence int32) types.Off_t {
+ if __ccgo_strace {
+ trc("t=%v fd=%v offset=%v whence=%v, (%v:)", t, fd, offset, whence, origin(2))
+ }
n, _, err := unix.Syscall(unix.SYS_LSEEK, uintptr(fd), uintptr(offset), uintptr(whence))
if err != 0 {
// if dmesgs {
@@ -215,6 +245,9 @@ func Xlseek64(t *TLS, fd int32, offset types.Off_t, whence int32) types.Off_t {
// int utime(const char *filename, const struct utimbuf *times);
func Xutime(t *TLS, filename, times uintptr) int32 {
+ if __ccgo_strace {
+ trc("t=%v times=%v, (%v:)", t, times, origin(2))
+ }
panic(todo(""))
// if _, _, err := unix.Syscall(unix.SYS_UTIME, filename, times, 0); err != 0 {
// t.setErrno(err)
@@ -226,6 +259,9 @@ func Xutime(t *TLS, filename, times uintptr) int32 {
// unsigned int alarm(unsigned int seconds);
func Xalarm(t *TLS, seconds uint32) uint32 {
+ if __ccgo_strace {
+ trc("t=%v seconds=%v, (%v:)", t, seconds, origin(2))
+ }
panic(todo(""))
// n, _, err := unix.Syscall(unix.SYS_ALARM, uintptr(seconds), 0, 0)
// if err != 0 {
@@ -237,6 +273,9 @@ func Xalarm(t *TLS, seconds uint32) uint32 {
// time_t time(time_t *tloc);
func Xtime(t *TLS, tloc uintptr) types.Time_t {
+ if __ccgo_strace {
+ trc("t=%v tloc=%v, (%v:)", t, tloc, origin(2))
+ }
panic(todo(""))
// n, _, err := unix.Syscall(unix.SYS_TIME, tloc, 0, 0)
// if err != 0 {
@@ -252,6 +291,9 @@ func Xtime(t *TLS, tloc uintptr) types.Time_t {
// int getrlimit(int resource, struct rlimit *rlim);
func Xgetrlimit64(t *TLS, resource int32, rlim uintptr) int32 {
+ if __ccgo_strace {
+ trc("t=%v resource=%v rlim=%v, (%v:)", t, resource, rlim, origin(2))
+ }
panic(todo(""))
// if _, _, err := unix.Syscall(unix.SYS_GETRLIMIT, uintptr(resource), uintptr(rlim), 0); err != 0 {
// t.setErrno(err)
@@ -263,6 +305,9 @@ func Xgetrlimit64(t *TLS, resource int32, rlim uintptr) int32 {
// int mkdir(const char *path, mode_t mode);
func Xmkdir(t *TLS, path uintptr, mode types.Mode_t) int32 {
+ if __ccgo_strace {
+ trc("t=%v path=%v mode=%v, (%v:)", t, path, mode, origin(2))
+ }
panic(todo(""))
// if _, _, err := unix.Syscall(unix.SYS_MKDIR, path, uintptr(mode), 0); err != 0 {
// t.setErrno(err)
@@ -277,6 +322,9 @@ func Xmkdir(t *TLS, path uintptr, mode types.Mode_t) int32 {
// int symlink(const char *target, const char *linkpath);
func Xsymlink(t *TLS, target, linkpath uintptr) int32 {
+ if __ccgo_strace {
+ trc("t=%v linkpath=%v, (%v:)", t, linkpath, origin(2))
+ }
panic(todo(""))
// if _, _, err := unix.Syscall(unix.SYS_SYMLINK, target, linkpath, 0); err != 0 {
// t.setErrno(err)
@@ -291,6 +339,9 @@ func Xsymlink(t *TLS, target, linkpath uintptr) int32 {
// int chmod(const char *pathname, mode_t mode)
func Xchmod(t *TLS, pathname uintptr, mode types.Mode_t) int32 {
+ if __ccgo_strace {
+ trc("t=%v pathname=%v mode=%v, (%v:)", t, pathname, mode, origin(2))
+ }
panic(todo(""))
// if _, _, err := unix.Syscall(unix.SYS_CHMOD, pathname, uintptr(mode), 0); err != 0 {
// t.setErrno(err)
@@ -305,6 +356,9 @@ func Xchmod(t *TLS, pathname uintptr, mode types.Mode_t) int32 {
// int utimes(const char *filename, const struct timeval times[2]);
func Xutimes(t *TLS, filename, times uintptr) int32 {
+ if __ccgo_strace {
+ trc("t=%v times=%v, (%v:)", t, times, origin(2))
+ }
panic(todo(""))
// if _, _, err := unix.Syscall(unix.SYS_UTIMES, filename, times, 0); err != 0 {
// t.setErrno(err)
@@ -319,6 +373,9 @@ func Xutimes(t *TLS, filename, times uintptr) int32 {
// int unlink(const char *pathname);
func Xunlink(t *TLS, pathname uintptr) int32 {
+ if __ccgo_strace {
+ trc("t=%v pathname=%v, (%v:)", t, pathname, origin(2))
+ }
panic(todo(""))
// if _, _, err := unix.Syscall(unix.SYS_UNLINK, pathname, 0, 0); err != 0 {
// t.setErrno(err)
@@ -333,6 +390,9 @@ func Xunlink(t *TLS, pathname uintptr) int32 {
// int access(const char *pathname, int mode);
func Xaccess(t *TLS, pathname uintptr, mode int32) int32 {
+ if __ccgo_strace {
+ trc("t=%v pathname=%v mode=%v, (%v:)", t, pathname, mode, origin(2))
+ }
panic(todo(""))
// if _, _, err := unix.Syscall(unix.SYS_ACCESS, pathname, uintptr(mode), 0); err != 0 {
// // if dmesgs {
@@ -350,6 +410,9 @@ func Xaccess(t *TLS, pathname uintptr, mode int32) int32 {
// int rmdir(const char *pathname);
func Xrmdir(t *TLS, pathname uintptr) int32 {
+ if __ccgo_strace {
+ trc("t=%v pathname=%v, (%v:)", t, pathname, origin(2))
+ }
panic(todo(""))
// if _, _, err := unix.Syscall(unix.SYS_RMDIR, pathname, 0, 0); err != 0 {
// t.setErrno(err)
@@ -364,6 +427,9 @@ func Xrmdir(t *TLS, pathname uintptr) int32 {
// int rename(const char *oldpath, const char *newpath);
func Xrename(t *TLS, oldpath, newpath uintptr) int32 {
+ if __ccgo_strace {
+ trc("t=%v newpath=%v, (%v:)", t, newpath, origin(2))
+ }
panic(todo(""))
// if _, _, err := unix.Syscall(unix.SYS_RENAME, oldpath, newpath, 0); err != 0 {
// t.setErrno(err)
@@ -375,6 +441,9 @@ func Xrename(t *TLS, oldpath, newpath uintptr) int32 {
// int mknod(const char *pathname, mode_t mode, dev_t dev);
func Xmknod(t *TLS, pathname uintptr, mode types.Mode_t, dev types.Dev_t) int32 {
+ if __ccgo_strace {
+ trc("t=%v pathname=%v mode=%v dev=%v, (%v:)", t, pathname, mode, dev, origin(2))
+ }
panic(todo(""))
// if _, _, err := unix.Syscall(unix.SYS_MKNOD, pathname, uintptr(mode), uintptr(dev)); err != 0 {
// t.setErrno(err)
@@ -386,6 +455,9 @@ func Xmknod(t *TLS, pathname uintptr, mode types.Mode_t, dev types.Dev_t) int32
// int chown(const char *pathname, uid_t owner, gid_t group);
func Xchown(t *TLS, pathname uintptr, owner types.Uid_t, group types.Gid_t) int32 {
+ if __ccgo_strace {
+ trc("t=%v pathname=%v owner=%v group=%v, (%v:)", t, pathname, owner, group, origin(2))
+ }
panic(todo(""))
// // if _, _, err := unix.Syscall(unix.SYS_CHOWN, pathname, uintptr(owner), uintptr(group)); err != 0 {
// // t.setErrno(err)
@@ -397,6 +469,9 @@ func Xchown(t *TLS, pathname uintptr, owner types.Uid_t, group types.Gid_t) int3
// int link(const char *oldpath, const char *newpath);
func Xlink(t *TLS, oldpath, newpath uintptr) int32 {
+ if __ccgo_strace {
+ trc("t=%v newpath=%v, (%v:)", t, newpath, origin(2))
+ }
panic(todo(""))
// if _, _, err := unix.Syscall(unix.SYS_LINK, oldpath, newpath, 0); err != 0 {
// t.setErrno(err)
@@ -408,6 +483,9 @@ func Xlink(t *TLS, oldpath, newpath uintptr) int32 {
// int pipe(int pipefd[2]);
func Xpipe(t *TLS, pipefd uintptr) int32 {
+ if __ccgo_strace {
+ trc("t=%v pipefd=%v, (%v:)", t, pipefd, origin(2))
+ }
panic(todo(""))
// if _, _, err := unix.Syscall(unix.SYS_PIPE, pipefd, 0, 0); err != 0 {
// t.setErrno(err)
@@ -419,6 +497,9 @@ func Xpipe(t *TLS, pipefd uintptr) int32 {
// int dup2(int oldfd, int newfd);
func Xdup2(t *TLS, oldfd, newfd int32) int32 {
+ if __ccgo_strace {
+ trc("t=%v newfd=%v, (%v:)", t, newfd, origin(2))
+ }
panic(todo(""))
// n, _, err := unix.Syscall(unix.SYS_DUP2, uintptr(oldfd), uintptr(newfd), 0)
// if err != 0 {
@@ -431,6 +512,9 @@ func Xdup2(t *TLS, oldfd, newfd int32) int32 {
// ssize_t readlink(const char *restrict path, char *restrict buf, size_t bufsize);
func Xreadlink(t *TLS, path, buf uintptr, bufsize types.Size_t) types.Ssize_t {
+ if __ccgo_strace {
+ trc("t=%v buf=%v bufsize=%v, (%v:)", t, buf, bufsize, origin(2))
+ }
panic(todo(""))
// n, _, err := unix.Syscall(unix.SYS_READLINK, path, buf, uintptr(bufsize))
// if err != 0 {
@@ -443,6 +527,9 @@ func Xreadlink(t *TLS, path, buf uintptr, bufsize types.Size_t) types.Ssize_t {
// FILE *fopen64(const char *pathname, const char *mode);
func Xfopen64(t *TLS, pathname, mode uintptr) uintptr {
+ if __ccgo_strace {
+ trc("t=%v mode=%v, (%v:)", t, mode, origin(2))
+ }
m := strings.ReplaceAll(GoString(mode), "b", "")
var flags int
switch m {
@@ -478,16 +565,25 @@ func Xfopen64(t *TLS, pathname, mode uintptr) uintptr {
// int iswspace(wint_t wc);
func Xiswspace(t *TLS, wc wctype.Wint_t) int32 {
+ if __ccgo_strace {
+ trc("t=%v wc=%v, (%v:)", t, wc, origin(2))
+ }
return Bool32(unicode.IsSpace(rune(wc)))
}
// int iswalnum(wint_t wc);
func Xiswalnum(t *TLS, wc wctype.Wint_t) int32 {
+ if __ccgo_strace {
+ trc("t=%v wc=%v, (%v:)", t, wc, origin(2))
+ }
return Bool32(unicode.IsLetter(rune(wc)) || unicode.IsNumber(rune(wc)))
}
// int setrlimit(int resource, const struct rlimit *rlim);
func Xsetrlimit64(t *TLS, resource int32, rlim uintptr) int32 {
+ if __ccgo_strace {
+ trc("t=%v resource=%v rlim=%v, (%v:)", t, resource, rlim, origin(2))
+ }
panic(todo(""))
// if _, _, err := unix.Syscall(unix.SYS_SETRLIMIT, uintptr(resource), uintptr(rlim), 0); err != 0 {
// t.setErrno(err)
diff --git a/vendor/modernc.org/libc/libc_linux_ppc64le.go b/vendor/modernc.org/libc/libc_linux_ppc64le.go
index d23be04f..75ac3c25 100644
--- a/vendor/modernc.org/libc/libc_linux_ppc64le.go
+++ b/vendor/modernc.org/libc/libc_linux_ppc64le.go
@@ -20,6 +20,9 @@ import (
// int sigaction(int signum, const struct sigaction *act, struct sigaction *oldact);
func Xsigaction(t *TLS, signum int32, act, oldact uintptr) int32 {
+ if __ccgo_strace {
+ trc("t=%v signum=%v oldact=%v, (%v:)", t, signum, oldact, origin(2))
+ }
// musl/arch/x86_64/ksigaction.h
//
// struct k_sigaction {
@@ -65,6 +68,9 @@ func Xsigaction(t *TLS, signum int32, act, oldact uintptr) int32 {
// int fcntl(int fd, int cmd, ... /* arg */ );
func Xfcntl64(t *TLS, fd, cmd int32, args uintptr) int32 {
+ if __ccgo_strace {
+ trc("t=%v cmd=%v args=%v, (%v:)", t, cmd, args, origin(2))
+ }
var arg uintptr
if args != 0 {
arg = *(*uintptr)(unsafe.Pointer(args))
@@ -97,6 +103,9 @@ func Xfcntl64(t *TLS, fd, cmd int32, args uintptr) int32 {
// int lstat(const char *pathname, struct stat *statbuf);
func Xlstat64(t *TLS, pathname, statbuf uintptr) int32 {
+ if __ccgo_strace {
+ trc("t=%v statbuf=%v, (%v:)", t, statbuf, origin(2))
+ }
if _, _, err := unix.Syscall(unix.SYS_LSTAT, pathname, statbuf, 0); err != 0 {
// if dmesgs {
// dmesg("%v: %q: %v", origin(1), GoString(pathname), err)
@@ -113,6 +122,9 @@ func Xlstat64(t *TLS, pathname, statbuf uintptr) int32 {
// int stat(const char *pathname, struct stat *statbuf);
func Xstat64(t *TLS, pathname, statbuf uintptr) int32 {
+ if __ccgo_strace {
+ trc("t=%v statbuf=%v, (%v:)", t, statbuf, origin(2))
+ }
if _, _, err := unix.Syscall(unix.SYS_STAT, pathname, statbuf, 0); err != 0 {
// if dmesgs {
// dmesg("%v: %q: %v", origin(1), GoString(pathname), err)
@@ -129,6 +141,9 @@ func Xstat64(t *TLS, pathname, statbuf uintptr) int32 {
// int fstat(int fd, struct stat *statbuf);
func Xfstat64(t *TLS, fd int32, statbuf uintptr) int32 {
+ if __ccgo_strace {
+ trc("t=%v fd=%v statbuf=%v, (%v:)", t, fd, statbuf, origin(2))
+ }
if _, _, err := unix.Syscall(unix.SYS_FSTAT, uintptr(fd), statbuf, 0); err != 0 {
// if dmesgs {
// dmesg("%v: fd %d: %v", origin(1), fd, err)
@@ -144,11 +159,17 @@ func Xfstat64(t *TLS, fd int32, statbuf uintptr) int32 {
}
func Xmmap(t *TLS, addr uintptr, length types.Size_t, prot, flags, fd int32, offset types.Off_t) uintptr {
+ if __ccgo_strace {
+ trc("t=%v addr=%v length=%v fd=%v offset=%v, (%v:)", t, addr, length, fd, offset, origin(2))
+ }
return Xmmap64(t, addr, length, prot, flags, fd, offset)
}
// void *mmap(void *addr, size_t length, int prot, int flags, int fd, off_t offset);
func Xmmap64(t *TLS, addr uintptr, length types.Size_t, prot, flags, fd int32, offset types.Off_t) uintptr {
+ if __ccgo_strace {
+ trc("t=%v addr=%v length=%v fd=%v offset=%v, (%v:)", t, addr, length, fd, offset, origin(2))
+ }
data, _, err := unix.Syscall6(unix.SYS_MMAP, addr, uintptr(length), uintptr(prot), uintptr(flags), uintptr(fd), uintptr(offset))
if err != 0 {
// if dmesgs {
@@ -166,6 +187,9 @@ func Xmmap64(t *TLS, addr uintptr, length types.Size_t, prot, flags, fd int32, o
// void *mremap(void *old_address, size_t old_size, size_t new_size, int flags, ... /* void *new_address */);
func Xmremap(t *TLS, old_address uintptr, old_size, new_size types.Size_t, flags int32, args uintptr) uintptr {
+ if __ccgo_strace {
+ trc("t=%v old_address=%v new_size=%v flags=%v args=%v, (%v:)", t, old_address, new_size, flags, args, origin(2))
+ }
var arg uintptr
if args != 0 {
arg = *(*uintptr)(unsafe.Pointer(args))
@@ -187,6 +211,9 @@ func Xmremap(t *TLS, old_address uintptr, old_size, new_size types.Size_t, flags
// int ftruncate(int fd, off_t length);
func Xftruncate64(t *TLS, fd int32, length types.Off_t) int32 {
+ if __ccgo_strace {
+ trc("t=%v fd=%v length=%v, (%v:)", t, fd, length, origin(2))
+ }
if _, _, err := unix.Syscall(unix.SYS_FTRUNCATE, uintptr(fd), uintptr(length), 0); err != 0 {
// if dmesgs {
// dmesg("%v: fd %d: %v", origin(1), fd, err)
@@ -203,6 +230,9 @@ func Xftruncate64(t *TLS, fd int32, length types.Off_t) int32 {
// off64_t lseek64(int fd, off64_t offset, int whence);
func Xlseek64(t *TLS, fd int32, offset types.Off_t, whence int32) types.Off_t {
+ if __ccgo_strace {
+ trc("t=%v fd=%v offset=%v whence=%v, (%v:)", t, fd, offset, whence, origin(2))
+ }
n, _, err := unix.Syscall(unix.SYS_LSEEK, uintptr(fd), uintptr(offset), uintptr(whence))
if err != 0 {
// if dmesgs {
@@ -220,6 +250,9 @@ func Xlseek64(t *TLS, fd int32, offset types.Off_t, whence int32) types.Off_t {
// int utime(const char *filename, const struct utimbuf *times);
func Xutime(t *TLS, filename, times uintptr) int32 {
+ if __ccgo_strace {
+ trc("t=%v times=%v, (%v:)", t, times, origin(2))
+ }
if _, _, err := unix.Syscall(unix.SYS_UTIME, filename, times, 0); err != 0 {
t.setErrno(err)
return -1
@@ -230,6 +263,9 @@ func Xutime(t *TLS, filename, times uintptr) int32 {
// unsigned int alarm(unsigned int seconds);
func Xalarm(t *TLS, seconds uint32) uint32 {
+ if __ccgo_strace {
+ trc("t=%v seconds=%v, (%v:)", t, seconds, origin(2))
+ }
n, _, err := unix.Syscall(unix.SYS_ALARM, uintptr(seconds), 0, 0)
if err != 0 {
panic(todo(""))
@@ -240,6 +276,9 @@ func Xalarm(t *TLS, seconds uint32) uint32 {
// time_t time(time_t *tloc);
func Xtime(t *TLS, tloc uintptr) types.Time_t {
+ if __ccgo_strace {
+ trc("t=%v tloc=%v, (%v:)", t, tloc, origin(2))
+ }
n, _, err := unix.Syscall(unix.SYS_TIME, tloc, 0, 0)
if err != 0 {
t.setErrno(err)
@@ -254,6 +293,9 @@ func Xtime(t *TLS, tloc uintptr) types.Time_t {
// int getrlimit(int resource, struct rlimit *rlim);
func Xgetrlimit64(t *TLS, resource int32, rlim uintptr) int32 {
+ if __ccgo_strace {
+ trc("t=%v resource=%v rlim=%v, (%v:)", t, resource, rlim, origin(2))
+ }
if _, _, err := unix.Syscall(unix.SYS_GETRLIMIT, uintptr(resource), uintptr(rlim), 0); err != 0 {
t.setErrno(err)
return -1
@@ -264,6 +306,9 @@ func Xgetrlimit64(t *TLS, resource int32, rlim uintptr) int32 {
// int mkdir(const char *path, mode_t mode);
func Xmkdir(t *TLS, path uintptr, mode types.Mode_t) int32 {
+ if __ccgo_strace {
+ trc("t=%v path=%v mode=%v, (%v:)", t, path, mode, origin(2))
+ }
if _, _, err := unix.Syscall(unix.SYS_MKDIR, path, uintptr(mode), 0); err != 0 {
t.setErrno(err)
return -1
@@ -277,6 +322,9 @@ func Xmkdir(t *TLS, path uintptr, mode types.Mode_t) int32 {
// int symlink(const char *target, const char *linkpath);
func Xsymlink(t *TLS, target, linkpath uintptr) int32 {
+ if __ccgo_strace {
+ trc("t=%v linkpath=%v, (%v:)", t, linkpath, origin(2))
+ }
if _, _, err := unix.Syscall(unix.SYS_SYMLINK, target, linkpath, 0); err != 0 {
t.setErrno(err)
return -1
@@ -290,6 +338,9 @@ func Xsymlink(t *TLS, target, linkpath uintptr) int32 {
// int chmod(const char *pathname, mode_t mode)
func Xchmod(t *TLS, pathname uintptr, mode types.Mode_t) int32 {
+ if __ccgo_strace {
+ trc("t=%v pathname=%v mode=%v, (%v:)", t, pathname, mode, origin(2))
+ }
if _, _, err := unix.Syscall(unix.SYS_CHMOD, pathname, uintptr(mode), 0); err != 0 {
t.setErrno(err)
return -1
@@ -303,6 +354,9 @@ func Xchmod(t *TLS, pathname uintptr, mode types.Mode_t) int32 {
// int utimes(const char *filename, const struct timeval times[2]);
func Xutimes(t *TLS, filename, times uintptr) int32 {
+ if __ccgo_strace {
+ trc("t=%v times=%v, (%v:)", t, times, origin(2))
+ }
if _, _, err := unix.Syscall(unix.SYS_UTIMES, filename, times, 0); err != 0 {
t.setErrno(err)
return -1
@@ -316,6 +370,9 @@ func Xutimes(t *TLS, filename, times uintptr) int32 {
// int unlink(const char *pathname);
func Xunlink(t *TLS, pathname uintptr) int32 {
+ if __ccgo_strace {
+ trc("t=%v pathname=%v, (%v:)", t, pathname, origin(2))
+ }
if _, _, err := unix.Syscall(unix.SYS_UNLINK, pathname, 0, 0); err != 0 {
t.setErrno(err)
return -1
@@ -329,6 +386,9 @@ func Xunlink(t *TLS, pathname uintptr) int32 {
// int access(const char *pathname, int mode);
func Xaccess(t *TLS, pathname uintptr, mode int32) int32 {
+ if __ccgo_strace {
+ trc("t=%v pathname=%v mode=%v, (%v:)", t, pathname, mode, origin(2))
+ }
if _, _, err := unix.Syscall(unix.SYS_ACCESS, pathname, uintptr(mode), 0); err != 0 {
// if dmesgs {
// dmesg("%v: %q: %v", origin(1), GoString(pathname), err)
@@ -345,6 +405,9 @@ func Xaccess(t *TLS, pathname uintptr, mode int32) int32 {
// int rmdir(const char *pathname);
func Xrmdir(t *TLS, pathname uintptr) int32 {
+ if __ccgo_strace {
+ trc("t=%v pathname=%v, (%v:)", t, pathname, origin(2))
+ }
if _, _, err := unix.Syscall(unix.SYS_RMDIR, pathname, 0, 0); err != 0 {
t.setErrno(err)
return -1
@@ -358,6 +421,9 @@ func Xrmdir(t *TLS, pathname uintptr) int32 {
// int rename(const char *oldpath, const char *newpath);
func Xrename(t *TLS, oldpath, newpath uintptr) int32 {
+ if __ccgo_strace {
+ trc("t=%v newpath=%v, (%v:)", t, newpath, origin(2))
+ }
if _, _, err := unix.Syscall(unix.SYS_RENAME, oldpath, newpath, 0); err != 0 {
t.setErrno(err)
return -1
@@ -368,6 +434,9 @@ func Xrename(t *TLS, oldpath, newpath uintptr) int32 {
// int mknod(const char *pathname, mode_t mode, dev_t dev);
func Xmknod(t *TLS, pathname uintptr, mode types.Mode_t, dev types.Dev_t) int32 {
+ if __ccgo_strace {
+ trc("t=%v pathname=%v mode=%v dev=%v, (%v:)", t, pathname, mode, dev, origin(2))
+ }
if _, _, err := unix.Syscall(unix.SYS_MKNOD, pathname, uintptr(mode), uintptr(dev)); err != 0 {
t.setErrno(err)
return -1
@@ -378,6 +447,9 @@ func Xmknod(t *TLS, pathname uintptr, mode types.Mode_t, dev types.Dev_t) int32
// int chown(const char *pathname, uid_t owner, gid_t group);
func Xchown(t *TLS, pathname uintptr, owner types.Uid_t, group types.Gid_t) int32 {
+ if __ccgo_strace {
+ trc("t=%v pathname=%v owner=%v group=%v, (%v:)", t, pathname, owner, group, origin(2))
+ }
if _, _, err := unix.Syscall(unix.SYS_CHOWN, pathname, uintptr(owner), uintptr(group)); err != 0 {
t.setErrno(err)
return -1
@@ -388,6 +460,9 @@ func Xchown(t *TLS, pathname uintptr, owner types.Uid_t, group types.Gid_t) int3
// int link(const char *oldpath, const char *newpath);
func Xlink(t *TLS, oldpath, newpath uintptr) int32 {
+ if __ccgo_strace {
+ trc("t=%v newpath=%v, (%v:)", t, newpath, origin(2))
+ }
if _, _, err := unix.Syscall(unix.SYS_LINK, oldpath, newpath, 0); err != 0 {
t.setErrno(err)
return -1
@@ -398,6 +473,9 @@ func Xlink(t *TLS, oldpath, newpath uintptr) int32 {
// int pipe(int pipefd[2]);
func Xpipe(t *TLS, pipefd uintptr) int32 {
+ if __ccgo_strace {
+ trc("t=%v pipefd=%v, (%v:)", t, pipefd, origin(2))
+ }
if _, _, err := unix.Syscall(unix.SYS_PIPE, pipefd, 0, 0); err != 0 {
t.setErrno(err)
return -1
@@ -408,6 +486,9 @@ func Xpipe(t *TLS, pipefd uintptr) int32 {
// int dup2(int oldfd, int newfd);
func Xdup2(t *TLS, oldfd, newfd int32) int32 {
+ if __ccgo_strace {
+ trc("t=%v newfd=%v, (%v:)", t, newfd, origin(2))
+ }
n, _, err := unix.Syscall(unix.SYS_DUP2, uintptr(oldfd), uintptr(newfd), 0)
if err != 0 {
t.setErrno(err)
@@ -419,6 +500,9 @@ func Xdup2(t *TLS, oldfd, newfd int32) int32 {
// ssize_t readlink(const char *restrict path, char *restrict buf, size_t bufsize);
func Xreadlink(t *TLS, path, buf uintptr, bufsize types.Size_t) types.Ssize_t {
+ if __ccgo_strace {
+ trc("t=%v buf=%v bufsize=%v, (%v:)", t, buf, bufsize, origin(2))
+ }
n, _, err := unix.Syscall(unix.SYS_READLINK, path, buf, uintptr(bufsize))
if err != 0 {
t.setErrno(err)
@@ -430,6 +514,9 @@ func Xreadlink(t *TLS, path, buf uintptr, bufsize types.Size_t) types.Ssize_t {
// FILE *fopen64(const char *pathname, const char *mode);
func Xfopen64(t *TLS, pathname, mode uintptr) uintptr {
+ if __ccgo_strace {
+ trc("t=%v mode=%v, (%v:)", t, mode, origin(2))
+ }
m := strings.ReplaceAll(GoString(mode), "b", "")
var flags int
switch m {
@@ -466,11 +553,17 @@ func Xfopen64(t *TLS, pathname, mode uintptr) uintptr {
// int iswspace(wint_t wc);
func Xiswspace(t *TLS, wc wctype.Wint_t) int32 {
+ if __ccgo_strace {
+ trc("t=%v wc=%v, (%v:)", t, wc, origin(2))
+ }
return Bool32(unicode.IsSpace(rune(wc)))
}
// int iswalnum(wint_t wc);
func Xiswalnum(t *TLS, wc wctype.Wint_t) int32 {
+ if __ccgo_strace {
+ trc("t=%v wc=%v, (%v:)", t, wc, origin(2))
+ }
return Bool32(unicode.IsLetter(rune(wc)) || unicode.IsNumber(rune(wc)))
}
@@ -488,6 +581,9 @@ func __syscall4(t *TLS, trap, p1, p2, p3, p4 long) long {
// int setrlimit(int resource, const struct rlimit *rlim);
func Xsetrlimit64(t *TLS, resource int32, rlim uintptr) int32 {
+ if __ccgo_strace {
+ trc("t=%v resource=%v rlim=%v, (%v:)", t, resource, rlim, origin(2))
+ }
if _, _, err := unix.Syscall(unix.SYS_SETRLIMIT, uintptr(resource), uintptr(rlim), 0); err != 0 {
t.setErrno(err)
return -1
@@ -495,3 +591,7 @@ func Xsetrlimit64(t *TLS, resource int32, rlim uintptr) int32 {
return 0
}
+
+func AtomicLoadNUint8(ptr uintptr, memorder int32) uint8 {
+ return byte(a_load_8(ptr))
+}
diff --git a/vendor/modernc.org/libc/libc_linux_riscv64.go b/vendor/modernc.org/libc/libc_linux_riscv64.go
index e49c0f44..86d3b942 100644
--- a/vendor/modernc.org/libc/libc_linux_riscv64.go
+++ b/vendor/modernc.org/libc/libc_linux_riscv64.go
@@ -21,6 +21,9 @@ import (
// int sigaction(int signum, const struct sigaction *act, struct sigaction *oldact);
func Xsigaction(t *TLS, signum int32, act, oldact uintptr) int32 {
+ if __ccgo_strace {
+ trc("t=%v signum=%v oldact=%v, (%v:)", t, signum, oldact, origin(2))
+ }
// musl/arch/x86_64/ksigaction.h
//
// struct k_sigaction {
@@ -66,6 +69,9 @@ func Xsigaction(t *TLS, signum int32, act, oldact uintptr) int32 {
// int fcntl(int fd, int cmd, ... /* arg */ );
func Xfcntl64(t *TLS, fd, cmd int32, args uintptr) int32 {
+ if __ccgo_strace {
+ trc("t=%v cmd=%v args=%v, (%v:)", t, cmd, args, origin(2))
+ }
var arg uintptr
if args != 0 {
arg = *(*uintptr)(unsafe.Pointer(args))
@@ -90,6 +96,9 @@ func Xfcntl64(t *TLS, fd, cmd int32, args uintptr) int32 {
// int fstatat(int dirfd, const char *pathname, struct stat *statbuf, int flags);
func Xfstatat(t *TLS, dirfd int32, pathname, statbuf uintptr, flags int32) int32 {
+ if __ccgo_strace {
+ trc("t=%v dirfd=%v statbuf=%v flags=%v, (%v:)", t, dirfd, statbuf, flags, origin(2))
+ }
// From golang.org/x/sys/unix/zsyscall_linux_riscv64.go
if _, _, err := unix.Syscall6(unix.SYS_FSTATAT, uintptr(dirfd), pathname, statbuf, uintptr(flags), 0, 0); err != 0 {
t.setErrno(err)
@@ -101,18 +110,27 @@ func Xfstatat(t *TLS, dirfd int32, pathname, statbuf uintptr, flags int32) int32
// int lstat(const char *pathname, struct stat *statbuf);
func Xlstat64(t *TLS, pathname, statbuf uintptr) int32 {
+ if __ccgo_strace {
+ trc("t=%v statbuf=%v, (%v:)", t, statbuf, origin(2))
+ }
// From golang.org/x/sys/unix/syscall_linux_riscv64.go
return Xfstatat(t, unix.AT_FDCWD, pathname, statbuf, unix.AT_SYMLINK_NOFOLLOW)
}
// int stat(const char *pathname, struct stat *statbuf);
func Xstat64(t *TLS, pathname, statbuf uintptr) int32 {
+ if __ccgo_strace {
+ trc("t=%v statbuf=%v, (%v:)", t, statbuf, origin(2))
+ }
// From golang.org/x/sys/unix/syscall_linux_riscv64.go
return Xfstatat(t, unix.AT_FDCWD, pathname, statbuf, 0)
}
// int fstat(int fd, struct stat *statbuf);
func Xfstat64(t *TLS, fd int32, statbuf uintptr) int32 {
+ if __ccgo_strace {
+ trc("t=%v fd=%v statbuf=%v, (%v:)", t, fd, statbuf, origin(2))
+ }
if _, _, err := unix.Syscall(unix.SYS_FSTAT, uintptr(fd), statbuf, 0); err != 0 {
// if dmesgs {
// dmesg("%v: fd %d: %v", origin(1), fd, err)
@@ -128,11 +146,17 @@ func Xfstat64(t *TLS, fd int32, statbuf uintptr) int32 {
}
func Xmmap(t *TLS, addr uintptr, length types.Size_t, prot, flags, fd int32, offset types.Off_t) uintptr {
+ if __ccgo_strace {
+ trc("t=%v addr=%v length=%v fd=%v offset=%v, (%v:)", t, addr, length, fd, offset, origin(2))
+ }
return Xmmap64(t, addr, length, prot, flags, fd, offset)
}
// void *mmap(void *addr, size_t length, int prot, int flags, int fd, off_t offset);
func Xmmap64(t *TLS, addr uintptr, length types.Size_t, prot, flags, fd int32, offset types.Off_t) uintptr {
+ if __ccgo_strace {
+ trc("t=%v addr=%v length=%v fd=%v offset=%v, (%v:)", t, addr, length, fd, offset, origin(2))
+ }
data, _, err := unix.Syscall6(unix.SYS_MMAP, addr, uintptr(length), uintptr(prot), uintptr(flags), uintptr(fd), uintptr(offset))
if err != 0 {
// if dmesgs {
@@ -150,6 +174,9 @@ func Xmmap64(t *TLS, addr uintptr, length types.Size_t, prot, flags, fd int32, o
// void *mremap(void *old_address, size_t old_size, size_t new_size, int flags, ... /* void *new_address */);
func Xmremap(t *TLS, old_address uintptr, old_size, new_size types.Size_t, flags int32, args uintptr) uintptr {
+ if __ccgo_strace {
+ trc("t=%v old_address=%v new_size=%v flags=%v args=%v, (%v:)", t, old_address, new_size, flags, args, origin(2))
+ }
var arg uintptr
if args != 0 {
arg = *(*uintptr)(unsafe.Pointer(args))
@@ -171,6 +198,9 @@ func Xmremap(t *TLS, old_address uintptr, old_size, new_size types.Size_t, flags
// int ftruncate(int fd, off_t length);
func Xftruncate64(t *TLS, fd int32, length types.Off_t) int32 {
+ if __ccgo_strace {
+ trc("t=%v fd=%v length=%v, (%v:)", t, fd, length, origin(2))
+ }
if _, _, err := unix.Syscall(unix.SYS_FTRUNCATE, uintptr(fd), uintptr(length), 0); err != 0 {
// if dmesgs {
// dmesg("%v: fd %d: %v", origin(1), fd, err)
@@ -187,6 +217,9 @@ func Xftruncate64(t *TLS, fd int32, length types.Off_t) int32 {
// off64_t lseek64(int fd, off64_t offset, int whence);
func Xlseek64(t *TLS, fd int32, offset types.Off_t, whence int32) types.Off_t {
+ if __ccgo_strace {
+ trc("t=%v fd=%v offset=%v whence=%v, (%v:)", t, fd, offset, whence, origin(2))
+ }
n, _, err := unix.Syscall(unix.SYS_LSEEK, uintptr(fd), uintptr(offset), uintptr(whence))
if err != 0 {
// if dmesgs {
@@ -218,6 +251,9 @@ type utimbuf struct {
// int utime(const char *filename, const struct utimbuf *times);
func Xutime(t *TLS, filename, times uintptr) int32 {
+ if __ccgo_strace {
+ trc("t=%v times=%v, (%v:)", t, times, origin(2))
+ }
if times == 0 {
return Xutimes(t, filename, 0)
}
@@ -234,6 +270,9 @@ func Xutime(t *TLS, filename, times uintptr) int32 {
// unsigned int alarm(unsigned int seconds);
func Xalarm(t *TLS, seconds uint32) uint32 {
+ if __ccgo_strace {
+ trc("t=%v seconds=%v, (%v:)", t, seconds, origin(2))
+ }
panic(todo(""))
// No alarm syscall on linux/riscv64. And cannot implement with setitimer as in musl,
// because of missing defination to constant ITIMER_REAL in types_linux_riscv64.go.
@@ -241,6 +280,9 @@ func Xalarm(t *TLS, seconds uint32) uint32 {
// time_t time(time_t *tloc);
func Xtime(t *TLS, tloc uintptr) types.Time_t {
+ if __ccgo_strace {
+ trc("t=%v tloc=%v, (%v:)", t, tloc, origin(2))
+ }
// From golang.org/x/sys/unix/syscall_linux_riscv64.go
var tv types.Timeval
if err := Xgettimeofday(t, uintptr(unsafe.Pointer(&tv)), 0); err != 0 {
@@ -256,6 +298,9 @@ func Xtime(t *TLS, tloc uintptr) types.Time_t {
// int getrlimit(int resource, struct rlimit *rlim);
func Xgetrlimit64(t *TLS, resource int32, rlim uintptr) int32 {
+ if __ccgo_strace {
+ trc("t=%v resource=%v rlim=%v, (%v:)", t, resource, rlim, origin(2))
+ }
if _, _, err := unix.Syscall(unix.SYS_GETRLIMIT, uintptr(resource), uintptr(rlim), 0); err != 0 {
t.setErrno(err)
return -1
@@ -266,95 +311,143 @@ func Xgetrlimit64(t *TLS, resource int32, rlim uintptr) int32 {
// int mkdir(const char *path, mode_t mode);
func Xmkdir(t *TLS, path uintptr, mode types.Mode_t) int32 {
+ if __ccgo_strace {
+ trc("t=%v path=%v mode=%v, (%v:)", t, path, mode, origin(2))
+ }
// From golang.org/x/sys/unix/syscall_linux.go
return Xmkdirat(t, unix.AT_FDCWD, path, mode)
}
// int symlink(const char *target, const char *linkpath);
func Xsymlink(t *TLS, target, linkpath uintptr) int32 {
+ if __ccgo_strace {
+ trc("t=%v linkpath=%v, (%v:)", t, linkpath, origin(2))
+ }
// From golang.org/x/sys/unix/syscall_linux.go
return Xsymlinkat(t, target, unix.AT_FDCWD, linkpath)
}
// int chmod(const char *pathname, mode_t mode)
func Xchmod(t *TLS, pathname uintptr, mode types.Mode_t) int32 {
+ if __ccgo_strace {
+ trc("t=%v pathname=%v mode=%v, (%v:)", t, pathname, mode, origin(2))
+ }
// From golang.org/x/sys/unix/syscall_linux.go
return Xfchmodat(t, unix.AT_FDCWD, pathname, mode, 0)
}
// int utimes(const char *filename, const struct timeval times[2]);
func Xutimes(t *TLS, filename, times uintptr) int32 {
+ if __ccgo_strace {
+ trc("t=%v times=%v, (%v:)", t, times, origin(2))
+ }
return Xutimensat(t, unix.AT_FDCWD, filename, times, 0)
}
// int unlink(const char *pathname);
func Xunlink(t *TLS, pathname uintptr) int32 {
+ if __ccgo_strace {
+ trc("t=%v pathname=%v, (%v:)", t, pathname, origin(2))
+ }
// From golang.org/x/sys/unix/syscall_linux.go
return Xunlinkat(t, unix.AT_FDCWD, pathname, 0)
}
// int access(const char *pathname, int mode);
func Xaccess(t *TLS, pathname uintptr, mode int32) int32 {
+ if __ccgo_strace {
+ trc("t=%v pathname=%v mode=%v, (%v:)", t, pathname, mode, origin(2))
+ }
// From golang.org/x/sys/unix/syscall_linux.go
return Xfaccessat(t, unix.AT_FDCWD, pathname, mode, 0)
}
// int rmdir(const char *pathname);
func Xrmdir(t *TLS, pathname uintptr) int32 {
+ if __ccgo_strace {
+ trc("t=%v pathname=%v, (%v:)", t, pathname, origin(2))
+ }
// From golang.org/x/sys/unix/syscall_linux.go
return Xunlinkat(t, unix.AT_FDCWD, pathname, unix.AT_REMOVEDIR)
}
// int rename(const char *oldpath, const char *newpath);
func Xrename(t *TLS, oldpath, newpath uintptr) int32 {
+ if __ccgo_strace {
+ trc("t=%v newpath=%v, (%v:)", t, newpath, origin(2))
+ }
// From golang.org/x/sys/unix/syscall_linux.go
return Xrenameat(t, unix.AT_FDCWD, oldpath, unix.AT_FDCWD, newpath)
}
// int renameat(int olddirfd, const char *oldpath, int newdirfd, const char *newpath);
func Xrenameat(t *TLS, olddirfd int32, oldpath uintptr, newdirfd int32, newpath uintptr) int32 {
+ if __ccgo_strace {
+ trc("t=%v olddirfd=%v oldpath=%v newdirfd=%v newpath=%v, (%v:)", t, olddirfd, oldpath, newdirfd, newpath, origin(2))
+ }
// From golang.org/x/sys/unix/syscall_linux_riscv64.go
return Xrenameat2(t, olddirfd, oldpath, newdirfd, newpath, 0)
}
// int mknod(const char *pathname, mode_t mode, dev_t dev);
func Xmknod(t *TLS, pathname uintptr, mode types.Mode_t, dev types.Dev_t) int32 {
+ if __ccgo_strace {
+ trc("t=%v pathname=%v mode=%v dev=%v, (%v:)", t, pathname, mode, dev, origin(2))
+ }
// From golang.org/x/sys/unix/syscall_linux.go
return Xmknodat(t, unix.AT_FDCWD, pathname, mode, dev)
}
// int chown(const char *pathname, uid_t owner, gid_t group);
func Xchown(t *TLS, pathname uintptr, owner types.Uid_t, group types.Gid_t) int32 {
+ if __ccgo_strace {
+ trc("t=%v pathname=%v owner=%v group=%v, (%v:)", t, pathname, owner, group, origin(2))
+ }
// From golang.org/x/sys/unix/syscall_linux.go
return Xfchownat(t, unix.AT_FDCWD, pathname, owner, group, 0)
}
// int link(const char *oldpath, const char *newpath);
func Xlink(t *TLS, oldpath, newpath uintptr) int32 {
+ if __ccgo_strace {
+ trc("t=%v newpath=%v, (%v:)", t, newpath, origin(2))
+ }
// From golang.org/x/sys/unix/syscall_linux.go
return Xlinkat(t, unix.AT_FDCWD, oldpath, unix.AT_FDCWD, newpath, 0)
}
// int pipe(int pipefd[2]);
func Xpipe(t *TLS, pipefd uintptr) int32 {
+ if __ccgo_strace {
+ trc("t=%v pipefd=%v, (%v:)", t, pipefd, origin(2))
+ }
// From golang.org/x/sys/unix/syscall_linux.go
return Xpipe2(t, pipefd, 0)
}
// int dup2(int oldfd, int newfd);
func Xdup2(t *TLS, oldfd, newfd int32) int32 {
+ if __ccgo_strace {
+ trc("t=%v newfd=%v, (%v:)", t, newfd, origin(2))
+ }
// From golang.org/x/sys/unix/syscall_linux.go
return Xdup3(t, oldfd, newfd, 0)
}
// ssize_t readlink(const char *restrict path, char *restrict buf, size_t bufsize);
func Xreadlink(t *TLS, path, buf uintptr, bufsize types.Size_t) types.Ssize_t {
+ if __ccgo_strace {
+ trc("t=%v buf=%v bufsize=%v, (%v:)", t, buf, bufsize, origin(2))
+ }
// From golang.org/x/sys/unix/syscall_linux.go
return Xreadlinkat(t, unix.AT_FDCWD, path, buf, bufsize)
}
// FILE *fopen64(const char *pathname, const char *mode);
func Xfopen64(t *TLS, pathname, mode uintptr) uintptr {
+ if __ccgo_strace {
+ trc("t=%v mode=%v, (%v:)", t, mode, origin(2))
+ }
m := strings.ReplaceAll(GoString(mode), "b", "")
var flags int
switch m {
@@ -392,11 +485,17 @@ func Xfopen64(t *TLS, pathname, mode uintptr) uintptr {
// int iswspace(wint_t wc);
func Xiswspace(t *TLS, wc wctype.Wint_t) int32 {
+ if __ccgo_strace {
+ trc("t=%v wc=%v, (%v:)", t, wc, origin(2))
+ }
return Bool32(unicode.IsSpace(rune(wc)))
}
// int iswalnum(wint_t wc);
func Xiswalnum(t *TLS, wc wctype.Wint_t) int32 {
+ if __ccgo_strace {
+ trc("t=%v wc=%v, (%v:)", t, wc, origin(2))
+ }
return Bool32(unicode.IsLetter(rune(wc)) || unicode.IsNumber(rune(wc)))
}
@@ -414,6 +513,9 @@ func __syscall4(t *TLS, trap, p1, p2, p3, p4 long) long {
// int setrlimit(int resource, const struct rlimit *rlim);
func Xsetrlimit64(t *TLS, resource int32, rlim uintptr) int32 {
+ if __ccgo_strace {
+ trc("t=%v resource=%v rlim=%v, (%v:)", t, resource, rlim, origin(2))
+ }
if _, _, err := unix.Syscall(unix.SYS_SETRLIMIT, uintptr(resource), uintptr(rlim), 0); err != 0 {
t.setErrno(err)
return -1
@@ -421,3 +523,8 @@ func Xsetrlimit64(t *TLS, resource int32, rlim uintptr) int32 {
return 0
}
+
+func AtomicLoadNUint8(ptr uintptr, memorder int32) uint8 {
+ return byte(a_load_8(ptr))
+}
+
diff --git a/vendor/modernc.org/libc/libc_linux_s390x.go b/vendor/modernc.org/libc/libc_linux_s390x.go
index d5a0aa6e..a6d2961a 100644
--- a/vendor/modernc.org/libc/libc_linux_s390x.go
+++ b/vendor/modernc.org/libc/libc_linux_s390x.go
@@ -18,6 +18,9 @@ import (
// int sigaction(int signum, const struct sigaction *act, struct sigaction *oldact);
func Xsigaction(t *TLS, signum int32, act, oldact uintptr) int32 {
+ if __ccgo_strace {
+ trc("t=%v signum=%v oldact=%v, (%v:)", t, signum, oldact, origin(2))
+ }
// musl/src/internal/ksigaction.h
// struct k_sigaction {
// void (*handler)(int);
@@ -62,6 +65,9 @@ func Xsigaction(t *TLS, signum int32, act, oldact uintptr) int32 {
// int fcntl(int fd, int cmd, ... /* arg */ );
func Xfcntl64(t *TLS, fd, cmd int32, args uintptr) int32 {
+ if __ccgo_strace {
+ trc("t=%v cmd=%v args=%v, (%v:)", t, cmd, args, origin(2))
+ }
var arg uintptr
if args != 0 {
arg = *(*uintptr)(unsafe.Pointer(args))
@@ -86,6 +92,9 @@ func Xfcntl64(t *TLS, fd, cmd int32, args uintptr) int32 {
// int lstat(const char *pathname, struct stat *statbuf);
func Xlstat64(t *TLS, pathname, statbuf uintptr) int32 {
+ if __ccgo_strace {
+ trc("t=%v statbuf=%v, (%v:)", t, statbuf, origin(2))
+ }
if _, _, err := unix.Syscall(unix.SYS_LSTAT, pathname, statbuf, 0); err != 0 {
// if dmesgs {
// dmesg("%v: %q: %v", origin(1), GoString(pathname), err)
@@ -102,6 +111,9 @@ func Xlstat64(t *TLS, pathname, statbuf uintptr) int32 {
// int stat(const char *pathname, struct stat *statbuf);
func Xstat64(t *TLS, pathname, statbuf uintptr) int32 {
+ if __ccgo_strace {
+ trc("t=%v statbuf=%v, (%v:)", t, statbuf, origin(2))
+ }
if _, _, err := unix.Syscall(unix.SYS_STAT, pathname, statbuf, 0); err != 0 {
// if dmesgs {
// dmesg("%v: %q: %v", origin(1), GoString(pathname), err)
@@ -118,6 +130,9 @@ func Xstat64(t *TLS, pathname, statbuf uintptr) int32 {
// int fstat(int fd, struct stat *statbuf);
func Xfstat64(t *TLS, fd int32, statbuf uintptr) int32 {
+ if __ccgo_strace {
+ trc("t=%v fd=%v statbuf=%v, (%v:)", t, fd, statbuf, origin(2))
+ }
if _, _, err := unix.Syscall(unix.SYS_FSTAT, uintptr(fd), statbuf, 0); err != 0 {
// if dmesgs {
// dmesg("%v: fd %d: %v", origin(1), fd, err)
@@ -133,11 +148,17 @@ func Xfstat64(t *TLS, fd int32, statbuf uintptr) int32 {
}
func Xmmap(t *TLS, addr uintptr, length types.Size_t, prot, flags, fd int32, offset types.Off_t) uintptr {
+ if __ccgo_strace {
+ trc("t=%v addr=%v length=%v fd=%v offset=%v, (%v:)", t, addr, length, fd, offset, origin(2))
+ }
return Xmmap64(t, addr, length, prot, flags, fd, offset)
}
// void *mmap(void *addr, size_t length, int prot, int flags, int fd, off_t offset);
func Xmmap64(t *TLS, addr uintptr, length types.Size_t, prot, flags, fd int32, offset types.Off_t) uintptr {
+ if __ccgo_strace {
+ trc("t=%v addr=%v length=%v fd=%v offset=%v, (%v:)", t, addr, length, fd, offset, origin(2))
+ }
// https://github.com/golang/go/blob/7d822af4500831d131562f17dcf53374469d823e/src/syscall/syscall_linux_s390x.go#L77
args := [6]uintptr{addr, uintptr(length), uintptr(prot), uintptr(flags), uintptr(fd), uintptr(offset)}
data, _, err := unix.Syscall(unix.SYS_MMAP, uintptr(unsafe.Pointer(&args[0])), 0, 0)
@@ -157,6 +178,9 @@ func Xmmap64(t *TLS, addr uintptr, length types.Size_t, prot, flags, fd int32, o
// void *mremap(void *old_address, size_t old_size, size_t new_size, int flags, ... /* void *new_address */);
func Xmremap(t *TLS, old_address uintptr, old_size, new_size types.Size_t, flags int32, args uintptr) uintptr {
+ if __ccgo_strace {
+ trc("t=%v old_address=%v new_size=%v flags=%v args=%v, (%v:)", t, old_address, new_size, flags, args, origin(2))
+ }
var arg uintptr
if args != 0 {
arg = *(*uintptr)(unsafe.Pointer(args))
@@ -178,6 +202,9 @@ func Xmremap(t *TLS, old_address uintptr, old_size, new_size types.Size_t, flags
// int ftruncate(int fd, off_t length);
func Xftruncate64(t *TLS, fd int32, length types.Off_t) int32 {
+ if __ccgo_strace {
+ trc("t=%v fd=%v length=%v, (%v:)", t, fd, length, origin(2))
+ }
if _, _, err := unix.Syscall(unix.SYS_FTRUNCATE, uintptr(fd), uintptr(length), 0); err != 0 {
// if dmesgs {
// dmesg("%v: fd %d: %v", origin(1), fd, err)
@@ -194,6 +221,9 @@ func Xftruncate64(t *TLS, fd int32, length types.Off_t) int32 {
// off64_t lseek64(int fd, off64_t offset, int whence);
func Xlseek64(t *TLS, fd int32, offset types.Off_t, whence int32) types.Off_t {
+ if __ccgo_strace {
+ trc("t=%v fd=%v offset=%v whence=%v, (%v:)", t, fd, offset, whence, origin(2))
+ }
n, _, err := unix.Syscall(unix.SYS_LSEEK, uintptr(fd), uintptr(offset), uintptr(whence))
if err != 0 {
// if dmesgs {
@@ -211,6 +241,9 @@ func Xlseek64(t *TLS, fd int32, offset types.Off_t, whence int32) types.Off_t {
// int utime(const char *filename, const struct utimbuf *times);
func Xutime(t *TLS, filename, times uintptr) int32 {
+ if __ccgo_strace {
+ trc("t=%v times=%v, (%v:)", t, times, origin(2))
+ }
if _, _, err := unix.Syscall(unix.SYS_UTIME, filename, times, 0); err != 0 {
t.setErrno(err)
return -1
@@ -221,6 +254,9 @@ func Xutime(t *TLS, filename, times uintptr) int32 {
// unsigned int alarm(unsigned int seconds);
func Xalarm(t *TLS, seconds uint32) uint32 {
+ if __ccgo_strace {
+ trc("t=%v seconds=%v, (%v:)", t, seconds, origin(2))
+ }
n, _, err := unix.Syscall(unix.SYS_ALARM, uintptr(seconds), 0, 0)
if err != 0 {
panic(todo(""))
@@ -231,6 +267,9 @@ func Xalarm(t *TLS, seconds uint32) uint32 {
// time_t time(time_t *tloc);
func Xtime(t *TLS, tloc uintptr) types.Time_t {
+ if __ccgo_strace {
+ trc("t=%v tloc=%v, (%v:)", t, tloc, origin(2))
+ }
n, err := unix.Time((*unix.Time_t)(unsafe.Pointer(tloc)))
if err != nil {
t.setErrno(err)
@@ -242,6 +281,9 @@ func Xtime(t *TLS, tloc uintptr) types.Time_t {
// int getrlimit(int resource, struct rlimit *rlim);
func Xgetrlimit64(t *TLS, resource int32, rlim uintptr) int32 {
+ if __ccgo_strace {
+ trc("t=%v resource=%v rlim=%v, (%v:)", t, resource, rlim, origin(2))
+ }
if _, _, err := unix.Syscall(unix.SYS_GETRLIMIT, uintptr(resource), uintptr(rlim), 0); err != 0 {
t.setErrno(err)
return -1
@@ -252,6 +294,9 @@ func Xgetrlimit64(t *TLS, resource int32, rlim uintptr) int32 {
// int mkdir(const char *path, mode_t mode);
func Xmkdir(t *TLS, path uintptr, mode types.Mode_t) int32 {
+ if __ccgo_strace {
+ trc("t=%v path=%v mode=%v, (%v:)", t, path, mode, origin(2))
+ }
if _, _, err := unix.Syscall(unix.SYS_MKDIR, path, uintptr(mode), 0); err != 0 {
t.setErrno(err)
return -1
@@ -265,6 +310,9 @@ func Xmkdir(t *TLS, path uintptr, mode types.Mode_t) int32 {
// int symlink(const char *target, const char *linkpath);
func Xsymlink(t *TLS, target, linkpath uintptr) int32 {
+ if __ccgo_strace {
+ trc("t=%v linkpath=%v, (%v:)", t, linkpath, origin(2))
+ }
if _, _, err := unix.Syscall(unix.SYS_SYMLINK, target, linkpath, 0); err != 0 {
t.setErrno(err)
return -1
@@ -278,6 +326,9 @@ func Xsymlink(t *TLS, target, linkpath uintptr) int32 {
// int chmod(const char *pathname, mode_t mode)
func Xchmod(t *TLS, pathname uintptr, mode types.Mode_t) int32 {
+ if __ccgo_strace {
+ trc("t=%v pathname=%v mode=%v, (%v:)", t, pathname, mode, origin(2))
+ }
if _, _, err := unix.Syscall(unix.SYS_CHMOD, pathname, uintptr(mode), 0); err != 0 {
t.setErrno(err)
return -1
@@ -291,6 +342,9 @@ func Xchmod(t *TLS, pathname uintptr, mode types.Mode_t) int32 {
// int utimes(const char *filename, const struct timeval times[2]);
func Xutimes(t *TLS, filename, times uintptr) int32 {
+ if __ccgo_strace {
+ trc("t=%v times=%v, (%v:)", t, times, origin(2))
+ }
if _, _, err := unix.Syscall(unix.SYS_UTIMES, filename, times, 0); err != 0 {
t.setErrno(err)
return -1
@@ -304,6 +358,9 @@ func Xutimes(t *TLS, filename, times uintptr) int32 {
// int unlink(const char *pathname);
func Xunlink(t *TLS, pathname uintptr) int32 {
+ if __ccgo_strace {
+ trc("t=%v pathname=%v, (%v:)", t, pathname, origin(2))
+ }
if _, _, err := unix.Syscall(unix.SYS_UNLINK, pathname, 0, 0); err != 0 {
t.setErrno(err)
return -1
@@ -317,6 +374,9 @@ func Xunlink(t *TLS, pathname uintptr) int32 {
// int access(const char *pathname, int mode);
func Xaccess(t *TLS, pathname uintptr, mode int32) int32 {
+ if __ccgo_strace {
+ trc("t=%v pathname=%v mode=%v, (%v:)", t, pathname, mode, origin(2))
+ }
if _, _, err := unix.Syscall(unix.SYS_ACCESS, pathname, uintptr(mode), 0); err != 0 {
// if dmesgs {
// dmesg("%v: %q: %v", origin(1), GoString(pathname), err)
@@ -333,6 +393,9 @@ func Xaccess(t *TLS, pathname uintptr, mode int32) int32 {
// int rmdir(const char *pathname);
func Xrmdir(t *TLS, pathname uintptr) int32 {
+ if __ccgo_strace {
+ trc("t=%v pathname=%v, (%v:)", t, pathname, origin(2))
+ }
if _, _, err := unix.Syscall(unix.SYS_RMDIR, pathname, 0, 0); err != 0 {
t.setErrno(err)
return -1
@@ -346,6 +409,9 @@ func Xrmdir(t *TLS, pathname uintptr) int32 {
// int rename(const char *oldpath, const char *newpath);
func Xrename(t *TLS, oldpath, newpath uintptr) int32 {
+ if __ccgo_strace {
+ trc("t=%v newpath=%v, (%v:)", t, newpath, origin(2))
+ }
if _, _, err := unix.Syscall(unix.SYS_RENAME, oldpath, newpath, 0); err != 0 {
t.setErrno(err)
return -1
@@ -356,6 +422,9 @@ func Xrename(t *TLS, oldpath, newpath uintptr) int32 {
// int mknod(const char *pathname, mode_t mode, dev_t dev);
func Xmknod(t *TLS, pathname uintptr, mode types.Mode_t, dev types.Dev_t) int32 {
+ if __ccgo_strace {
+ trc("t=%v pathname=%v mode=%v dev=%v, (%v:)", t, pathname, mode, dev, origin(2))
+ }
if _, _, err := unix.Syscall(unix.SYS_MKNOD, pathname, uintptr(mode), uintptr(dev)); err != 0 {
t.setErrno(err)
return -1
@@ -366,6 +435,9 @@ func Xmknod(t *TLS, pathname uintptr, mode types.Mode_t, dev types.Dev_t) int32
// int chown(const char *pathname, uid_t owner, gid_t group);
func Xchown(t *TLS, pathname uintptr, owner types.Uid_t, group types.Gid_t) int32 {
+ if __ccgo_strace {
+ trc("t=%v pathname=%v owner=%v group=%v, (%v:)", t, pathname, owner, group, origin(2))
+ }
if _, _, err := unix.Syscall(unix.SYS_CHOWN, pathname, uintptr(owner), uintptr(group)); err != 0 {
t.setErrno(err)
return -1
@@ -376,6 +448,9 @@ func Xchown(t *TLS, pathname uintptr, owner types.Uid_t, group types.Gid_t) int3
// int link(const char *oldpath, const char *newpath);
func Xlink(t *TLS, oldpath, newpath uintptr) int32 {
+ if __ccgo_strace {
+ trc("t=%v newpath=%v, (%v:)", t, newpath, origin(2))
+ }
if _, _, err := unix.Syscall(unix.SYS_LINK, oldpath, newpath, 0); err != 0 {
t.setErrno(err)
return -1
@@ -386,6 +461,9 @@ func Xlink(t *TLS, oldpath, newpath uintptr) int32 {
// int pipe(int pipefd[2]);
func Xpipe(t *TLS, pipefd uintptr) int32 {
+ if __ccgo_strace {
+ trc("t=%v pipefd=%v, (%v:)", t, pipefd, origin(2))
+ }
if _, _, err := unix.Syscall(unix.SYS_PIPE, pipefd, 0, 0); err != 0 {
t.setErrno(err)
return -1
@@ -396,6 +474,9 @@ func Xpipe(t *TLS, pipefd uintptr) int32 {
// int dup2(int oldfd, int newfd);
func Xdup2(t *TLS, oldfd, newfd int32) int32 {
+ if __ccgo_strace {
+ trc("t=%v newfd=%v, (%v:)", t, newfd, origin(2))
+ }
n, _, err := unix.Syscall(unix.SYS_DUP2, uintptr(oldfd), uintptr(newfd), 0)
if err != 0 {
t.setErrno(err)
@@ -407,6 +488,9 @@ func Xdup2(t *TLS, oldfd, newfd int32) int32 {
// ssize_t readlink(const char *restrict path, char *restrict buf, size_t bufsize);
func Xreadlink(t *TLS, path, buf uintptr, bufsize types.Size_t) types.Ssize_t {
+ if __ccgo_strace {
+ trc("t=%v buf=%v bufsize=%v, (%v:)", t, buf, bufsize, origin(2))
+ }
n, _, err := unix.Syscall(unix.SYS_READLINK, path, buf, uintptr(bufsize))
if err != 0 {
t.setErrno(err)
@@ -418,6 +502,9 @@ func Xreadlink(t *TLS, path, buf uintptr, bufsize types.Size_t) types.Ssize_t {
// FILE *fopen64(const char *pathname, const char *mode);
func Xfopen64(t *TLS, pathname, mode uintptr) uintptr {
+ if __ccgo_strace {
+ trc("t=%v mode=%v, (%v:)", t, mode, origin(2))
+ }
m := strings.ReplaceAll(GoString(mode), "b", "")
var flags int
switch m {
@@ -467,6 +554,9 @@ func __syscall4(t *TLS, trap, p1, p2, p3, p4 long) long {
// int setrlimit(int resource, const struct rlimit *rlim);
func Xsetrlimit64(t *TLS, resource int32, rlim uintptr) int32 {
+ if __ccgo_strace {
+ trc("t=%v resource=%v rlim=%v, (%v:)", t, resource, rlim, origin(2))
+ }
if _, _, err := unix.Syscall(unix.SYS_SETRLIMIT, uintptr(resource), uintptr(rlim), 0); err != 0 {
t.setErrno(err)
return -1
diff --git a/vendor/modernc.org/libc/libc_loong64.go b/vendor/modernc.org/libc/libc_loong64.go
new file mode 100644
index 00000000..de3e3497
--- /dev/null
+++ b/vendor/modernc.org/libc/libc_loong64.go
@@ -0,0 +1,38 @@
+// Copyright 2023 The Libc 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 libc // import "modernc.org/libc"
+
+import (
+ "fmt"
+ "unsafe"
+)
+
+// Byte loads are atomic on this CPU.
+func a_load_8(addr uintptr) uint32 {
+ return uint32(*(*byte)(unsafe.Pointer(addr)))
+}
+
+// int16 loads are atomic on this CPU when properly aligned.
+func a_load_16(addr uintptr) uint32 {
+ if addr&1 != 0 {
+ panic(fmt.Errorf("unaligned atomic 16 bit access at %#0x", addr))
+ }
+
+ return uint32(*(*uint16)(unsafe.Pointer(addr)))
+}
+
+// Byte sores are atomic on this CPU.
+func a_store_8(addr uintptr, b byte) {
+ *(*byte)(unsafe.Pointer(addr)) = b
+}
+
+// int16 stores are atomic on this CPU when properly aligned.
+func a_store_16(addr uintptr, n uint16) {
+ if addr&1 != 0 {
+ panic(fmt.Errorf("unaligned atomic 16 bit access at %#0x", addr))
+ }
+
+ *(*uint16)(unsafe.Pointer(addr)) = n
+}
diff --git a/vendor/modernc.org/libc/libc_netbsd.go b/vendor/modernc.org/libc/libc_netbsd.go
index f4ed268f..2a440124 100644
--- a/vendor/modernc.org/libc/libc_netbsd.go
+++ b/vendor/modernc.org/libc/libc_netbsd.go
@@ -79,6 +79,9 @@ var X_ThreadRuneLocale uintptr //TODO initialize and implement _Thread_local sem
// include/xlocale/_ctype.h:54:_RuneLocale *__runes_for_locale(locale_t, int*);
func X__runes_for_locale(t *TLS, l locale_t, p uintptr) uintptr {
+ if __ccgo_strace {
+ trc("t=%v l=%v p=%v, (%v:)", t, l, p, origin(2))
+ }
panic(todo(""))
}
@@ -142,23 +145,35 @@ func fwrite(fd int32, b []byte) (int, error) {
// unsigned long ___runetype(__ct_rune_t) __pure;
func X___runetype(t *TLS, x int32) ulong {
+ if __ccgo_strace {
+ trc("t=%v x=%v, (%v:)", t, x, origin(2))
+ }
panic(todo(""))
}
// int fprintf(FILE *stream, const char *format, ...);
func Xfprintf(t *TLS, stream, format, args uintptr) int32 {
+ if __ccgo_strace {
+ trc("t=%v args=%v, (%v:)", t, args, origin(2))
+ }
n, _ := fwrite(int32((*stdio.FILE)(unsafe.Pointer(stream)).F_file), printf(format, args))
return int32(n)
}
// int usleep(useconds_t usec);
func Xusleep(t *TLS, usec uint32) int32 {
+ if __ccgo_strace {
+ trc("t=%v usec=%v, (%v:)", t, usec, origin(2))
+ }
gotime.Sleep(gotime.Microsecond * gotime.Duration(usec))
return 0
}
// int getrusage(int who, struct rusage *usage);
func Xgetrusage(t *TLS, who int32, usage uintptr) int32 {
+ if __ccgo_strace {
+ trc("t=%v who=%v usage=%v, (%v:)", t, who, usage, origin(2))
+ }
if _, _, err := unix.Syscall(unix.SYS_GETRUSAGE, uintptr(who), usage, 0); err != 0 {
t.setErrno(err)
return -1
@@ -169,6 +184,9 @@ func Xgetrusage(t *TLS, who int32, usage uintptr) int32 {
// int fgetc(FILE *stream);
func Xfgetc(t *TLS, stream uintptr) int32 {
+ if __ccgo_strace {
+ trc("t=%v stream=%v, (%v:)", t, stream, origin(2))
+ }
fd := int((*stdio.FILE)(unsafe.Pointer(stream)).F_file)
var buf [1]byte
if n, _ := unix.Read(fd, buf[:]); n != 0 {
@@ -180,16 +198,25 @@ func Xfgetc(t *TLS, stream uintptr) int32 {
// int lstat(const char *pathname, struct stat *statbuf);
func Xlstat(t *TLS, pathname, statbuf uintptr) int32 {
+ if __ccgo_strace {
+ trc("t=%v statbuf=%v, (%v:)", t, statbuf, origin(2))
+ }
return Xlstat64(t, pathname, statbuf)
}
// int stat(const char *pathname, struct stat *statbuf);
func Xstat(t *TLS, pathname, statbuf uintptr) int32 {
+ if __ccgo_strace {
+ trc("t=%v statbuf=%v, (%v:)", t, statbuf, origin(2))
+ }
return Xstat64(t, pathname, statbuf)
}
// int chdir(const char *path);
func Xchdir(t *TLS, path uintptr) int32 {
+ if __ccgo_strace {
+ trc("t=%v path=%v, (%v:)", t, path, origin(2))
+ }
if _, _, err := unix.Syscall(unix.SYS_CHDIR, path, 0, 0); err != 0 {
t.setErrno(err)
return -1
@@ -239,11 +266,17 @@ func Xlocaltime_r(_ *TLS, timep, result uintptr) uintptr {
// int open(const char *pathname, int flags, ...);
func Xopen(t *TLS, pathname uintptr, flags int32, args uintptr) int32 {
+ if __ccgo_strace {
+ trc("t=%v pathname=%v flags=%v args=%v, (%v:)", t, pathname, flags, args, origin(2))
+ }
return Xopen64(t, pathname, flags, args)
}
// int open(const char *pathname, int flags, ...);
func Xopen64(t *TLS, pathname uintptr, flags int32, args uintptr) int32 {
+ if __ccgo_strace {
+ trc("t=%v pathname=%v flags=%v args=%v, (%v:)", t, pathname, flags, args, origin(2))
+ }
var mode types.Mode_t
if args != 0 {
mode = (types.Mode_t)(VaUint32(&args))
@@ -266,6 +299,9 @@ func Xopen64(t *TLS, pathname uintptr, flags int32, args uintptr) int32 {
// off_t lseek(int fd, off_t offset, int whence);
func Xlseek(t *TLS, fd int32, offset types.Off_t, whence int32) types.Off_t {
+ if __ccgo_strace {
+ trc("t=%v fd=%v offset=%v whence=%v, (%v:)", t, fd, offset, whence, origin(2))
+ }
return types.Off_t(Xlseek64(t, fd, offset, whence))
}
@@ -277,6 +313,9 @@ var fsyncStatbuf stat.Stat
// int fsync(int fd);
func Xfsync(t *TLS, fd int32) int32 {
+ if __ccgo_strace {
+ trc("t=%v fd=%v, (%v:)", t, fd, origin(2))
+ }
if noFsync {
// Simulate -DSQLITE_NO_SYNC for sqlite3 testfixture, see function full_sync in sqlite3.c
return Xfstat(t, fd, uintptr(unsafe.Pointer(&fsyncStatbuf)))
@@ -295,6 +334,9 @@ func Xfsync(t *TLS, fd int32) int32 {
// long sysconf(int name);
func Xsysconf(t *TLS, name int32) long {
+ if __ccgo_strace {
+ trc("t=%v name=%v, (%v:)", t, name, origin(2))
+ }
switch name {
case unistd.X_SC_PAGESIZE:
return long(unix.Getpagesize())
@@ -311,6 +353,9 @@ func Xsysconf(t *TLS, name int32) long {
// int close(int fd);
func Xclose(t *TLS, fd int32) int32 {
+ if __ccgo_strace {
+ trc("t=%v fd=%v, (%v:)", t, fd, origin(2))
+ }
if _, _, err := unix.Syscall(unix.SYS_CLOSE, uintptr(fd), 0, 0); err != 0 {
t.setErrno(err)
return -1
@@ -324,6 +369,9 @@ func Xclose(t *TLS, fd int32) int32 {
// char *getcwd(char *buf, size_t size);
func Xgetcwd(t *TLS, buf uintptr, size types.Size_t) uintptr {
+ if __ccgo_strace {
+ trc("t=%v buf=%v size=%v, (%v:)", t, buf, size, origin(2))
+ }
if _, err := unix.Getcwd((*RawMem)(unsafe.Pointer(buf))[:size:size]); err != nil {
if dmesgs {
dmesg("%v: %v FAIL", origin(1), err)
@@ -340,11 +388,17 @@ func Xgetcwd(t *TLS, buf uintptr, size types.Size_t) uintptr {
// int fstat(int fd, struct stat *statbuf);
func Xfstat(t *TLS, fd int32, statbuf uintptr) int32 {
+ if __ccgo_strace {
+ trc("t=%v fd=%v statbuf=%v, (%v:)", t, fd, statbuf, origin(2))
+ }
return Xfstat64(t, fd, statbuf)
}
// int ftruncate(int fd, off_t length);
func Xftruncate(t *TLS, fd int32, length types.Off_t) int32 {
+ if __ccgo_strace {
+ trc("t=%v fd=%v length=%v, (%v:)", t, fd, length, origin(2))
+ }
if err := unix.Ftruncate(int(fd), int64(length)); err != nil {
if dmesgs {
dmesg("%v: fd %d: %v FAIL", origin(1), fd, err)
@@ -361,11 +415,17 @@ func Xftruncate(t *TLS, fd int32, length types.Off_t) int32 {
// int fcntl(int fd, int cmd, ... /* arg */ );
func Xfcntl(t *TLS, fd, cmd int32, args uintptr) int32 {
+ if __ccgo_strace {
+ trc("t=%v cmd=%v args=%v, (%v:)", t, cmd, args, origin(2))
+ }
return Xfcntl64(t, fd, cmd, args)
}
// ssize_t read(int fd, void *buf, size_t count);
func Xread(t *TLS, fd int32, buf uintptr, count types.Size_t) types.Ssize_t {
+ if __ccgo_strace {
+ trc("t=%v fd=%v buf=%v count=%v, (%v:)", t, fd, buf, count, origin(2))
+ }
n, _, err := unix.Syscall(unix.SYS_READ, uintptr(fd), buf, uintptr(count))
if err != 0 {
t.setErrno(err)
@@ -381,6 +441,9 @@ func Xread(t *TLS, fd int32, buf uintptr, count types.Size_t) types.Ssize_t {
// ssize_t write(int fd, const void *buf, size_t count);
func Xwrite(t *TLS, fd int32, buf uintptr, count types.Size_t) types.Ssize_t {
+ if __ccgo_strace {
+ trc("t=%v fd=%v buf=%v count=%v, (%v:)", t, fd, buf, count, origin(2))
+ }
const retry = 5
var err syscall.Errno
for i := 0; i < retry; i++ {
@@ -406,6 +469,9 @@ func Xwrite(t *TLS, fd int32, buf uintptr, count types.Size_t) types.Ssize_t {
// int fchmod(int fd, mode_t mode);
func Xfchmod(t *TLS, fd int32, mode types.Mode_t) int32 {
+ if __ccgo_strace {
+ trc("t=%v fd=%v mode=%v, (%v:)", t, fd, mode, origin(2))
+ }
if _, _, err := unix.Syscall(unix.SYS_FCHMOD, uintptr(fd), uintptr(mode), 0); err != 0 {
t.setErrno(err)
return -1
@@ -419,6 +485,9 @@ func Xfchmod(t *TLS, fd int32, mode types.Mode_t) int32 {
// int fchown(int fd, uid_t owner, gid_t group);
func Xfchown(t *TLS, fd int32, owner types.Uid_t, group types.Gid_t) int32 {
+ if __ccgo_strace {
+ trc("t=%v fd=%v owner=%v group=%v, (%v:)", t, fd, owner, group, origin(2))
+ }
if _, _, err := unix.Syscall(unix.SYS_FCHOWN, uintptr(fd), uintptr(owner), uintptr(group)); err != 0 {
t.setErrno(err)
return -1
@@ -429,12 +498,18 @@ func Xfchown(t *TLS, fd int32, owner types.Uid_t, group types.Gid_t) int32 {
// uid_t geteuid(void);
func Xgeteuid(t *TLS) types.Uid_t {
+ if __ccgo_strace {
+ trc("t=%v, (%v:)", t, origin(2))
+ }
n, _, _ := unix.Syscall(unix.SYS_GETEUID, 0, 0, 0)
return types.Uid_t(n)
}
// int munmap(void *addr, size_t length);
func Xmunmap(t *TLS, addr uintptr, length types.Size_t) int32 {
+ if __ccgo_strace {
+ trc("t=%v addr=%v length=%v, (%v:)", t, addr, length, origin(2))
+ }
if _, _, err := unix.Syscall(unix.SYS_MUNMAP, addr, uintptr(length), 0); err != 0 {
t.setErrno(err)
return -1
@@ -445,6 +520,9 @@ func Xmunmap(t *TLS, addr uintptr, length types.Size_t) int32 {
// int gettimeofday(struct timeval *tv, struct timezone *tz);
func Xgettimeofday(t *TLS, tv, tz uintptr) int32 {
+ if __ccgo_strace {
+ trc("t=%v tz=%v, (%v:)", t, tz, origin(2))
+ }
if tz != 0 {
panic(todo(""))
}
@@ -462,6 +540,9 @@ func Xgettimeofday(t *TLS, tv, tz uintptr) int32 {
// int getsockopt(int sockfd, int level, int optname, void *optval, socklen_t *optlen);
func Xgetsockopt(t *TLS, sockfd, level, optname int32, optval, optlen uintptr) int32 {
+ if __ccgo_strace {
+ trc("t=%v optname=%v optlen=%v, (%v:)", t, optname, optlen, origin(2))
+ }
if _, _, err := unix.Syscall6(unix.SYS_GETSOCKOPT, uintptr(sockfd), uintptr(level), uintptr(optname), optval, optlen, 0); err != 0 {
t.setErrno(err)
return -1
@@ -472,6 +553,9 @@ func Xgetsockopt(t *TLS, sockfd, level, optname int32, optval, optlen uintptr) i
// int setsockopt(int sockfd, int level, int optname, const void *optval, socklen_t optlen);
func Xsetsockopt(t *TLS, sockfd, level, optname int32, optval uintptr, optlen socket.Socklen_t) int32 {
+ if __ccgo_strace {
+ trc("t=%v optname=%v optval=%v optlen=%v, (%v:)", t, optname, optval, optlen, origin(2))
+ }
if _, _, err := unix.Syscall6(unix.SYS_SETSOCKOPT, uintptr(sockfd), uintptr(level), uintptr(optname), optval, uintptr(optlen), 0); err != 0 {
t.setErrno(err)
return -1
@@ -482,6 +566,9 @@ func Xsetsockopt(t *TLS, sockfd, level, optname int32, optval uintptr, optlen so
// int ioctl(int fd, unsigned long request, ...);
func Xioctl(t *TLS, fd int32, request ulong, va uintptr) int32 {
+ if __ccgo_strace {
+ trc("t=%v fd=%v request=%v va=%v, (%v:)", t, fd, request, va, origin(2))
+ }
var argp uintptr
if va != 0 {
argp = VaUintptr(&va)
@@ -497,6 +584,9 @@ func Xioctl(t *TLS, fd int32, request ulong, va uintptr) int32 {
// int getsockname(int sockfd, struct sockaddr *addr, socklen_t *addrlen);
func Xgetsockname(t *TLS, sockfd int32, addr, addrlen uintptr) int32 {
+ if __ccgo_strace {
+ trc("t=%v sockfd=%v addrlen=%v, (%v:)", t, sockfd, addrlen, origin(2))
+ }
if _, _, err := unix.Syscall(unix.SYS_GETSOCKNAME, uintptr(sockfd), addr, addrlen); err != 0 {
// if dmesgs {
// dmesg("%v: fd %v: %v", origin(1), sockfd, err)
@@ -510,6 +600,9 @@ func Xgetsockname(t *TLS, sockfd int32, addr, addrlen uintptr) int32 {
// int select(int nfds, fd_set *readfds, fd_set *writefds, fd_set *exceptfds, struct timeval *timeout);
func Xselect(t *TLS, nfds int32, readfds, writefds, exceptfds, timeout uintptr) int32 {
+ if __ccgo_strace {
+ trc("t=%v nfds=%v timeout=%v, (%v:)", t, nfds, timeout, origin(2))
+ }
n, err := unix.Select(
int(nfds),
(*unix.FdSet)(unsafe.Pointer(readfds)),
@@ -527,17 +620,26 @@ func Xselect(t *TLS, nfds int32, readfds, writefds, exceptfds, timeout uintptr)
// int mkfifo(const char *pathname, mode_t mode);
func Xmkfifo(t *TLS, pathname uintptr, mode types.Mode_t) int32 {
+ if __ccgo_strace {
+ trc("t=%v pathname=%v mode=%v, (%v:)", t, pathname, mode, origin(2))
+ }
panic(todo(""))
}
// mode_t umask(mode_t mask);
func Xumask(t *TLS, mask types.Mode_t) types.Mode_t {
+ if __ccgo_strace {
+ trc("t=%v mask=%v, (%v:)", t, mask, origin(2))
+ }
n, _, _ := unix.Syscall(unix.SYS_UMASK, uintptr(mask), 0, 0)
return types.Mode_t(n)
}
// int execvp(const char *file, char *const argv[]);
func Xexecvp(t *TLS, file, argv uintptr) int32 {
+ if __ccgo_strace {
+ trc("t=%v argv=%v, (%v:)", t, argv, origin(2))
+ }
if _, _, err := unix.Syscall(unix.SYS_EXECVE, file, argv, Environ()); err != 0 {
t.setErrno(err)
return -1
@@ -548,6 +650,9 @@ func Xexecvp(t *TLS, file, argv uintptr) int32 {
// pid_t waitpid(pid_t pid, int *wstatus, int options);
func Xwaitpid(t *TLS, pid types.Pid_t, wstatus uintptr, optname int32) types.Pid_t {
+ if __ccgo_strace {
+ trc("t=%v pid=%v wstatus=%v optname=%v, (%v:)", t, pid, wstatus, optname, origin(2))
+ }
n, _, err := unix.Syscall6(unix.SYS_WAIT4, uintptr(pid), wstatus, uintptr(optname), 0, 0, 0)
if err != 0 {
t.setErrno(err)
@@ -559,6 +664,9 @@ func Xwaitpid(t *TLS, pid types.Pid_t, wstatus uintptr, optname int32) types.Pid
// int uname(struct utsname *buf);
func Xuname(t *TLS, buf uintptr) int32 {
+ if __ccgo_strace {
+ trc("t=%v buf=%v, (%v:)", t, buf, origin(2))
+ }
if err := unix.Uname((*unix.Utsname)(unsafe.Pointer(buf))); err != nil {
if dmesgs {
dmesg("%v: %v FAIL", origin(1), err)
@@ -575,6 +683,9 @@ func Xuname(t *TLS, buf uintptr) int32 {
// ssize_t recv(int sockfd, void *buf, size_t len, int flags);
func Xrecv(t *TLS, sockfd int32, buf uintptr, len types.Size_t, flags int32) types.Ssize_t {
+ if __ccgo_strace {
+ trc("t=%v sockfd=%v buf=%v len=%v flags=%v, (%v:)", t, sockfd, buf, len, flags, origin(2))
+ }
n, _, err := unix.Syscall6(unix.SYS_RECVFROM, uintptr(sockfd), buf, uintptr(len), uintptr(flags), 0, 0)
if err != 0 {
t.setErrno(err)
@@ -586,6 +697,9 @@ func Xrecv(t *TLS, sockfd int32, buf uintptr, len types.Size_t, flags int32) typ
// ssize_t send(int sockfd, const void *buf, size_t len, int flags);
func Xsend(t *TLS, sockfd int32, buf uintptr, len types.Size_t, flags int32) types.Ssize_t {
+ if __ccgo_strace {
+ trc("t=%v sockfd=%v buf=%v len=%v flags=%v, (%v:)", t, sockfd, buf, len, flags, origin(2))
+ }
n, _, err := unix.Syscall6(unix.SYS_SENDTO, uintptr(sockfd), buf, uintptr(len), uintptr(flags), 0, 0)
if err != 0 {
t.setErrno(err)
@@ -597,6 +711,9 @@ func Xsend(t *TLS, sockfd int32, buf uintptr, len types.Size_t, flags int32) typ
// int shutdown(int sockfd, int how);
func Xshutdown(t *TLS, sockfd, how int32) int32 {
+ if __ccgo_strace {
+ trc("t=%v how=%v, (%v:)", t, how, origin(2))
+ }
if _, _, err := unix.Syscall(unix.SYS_SHUTDOWN, uintptr(sockfd), uintptr(how), 0); err != 0 {
t.setErrno(err)
return -1
@@ -607,6 +724,9 @@ func Xshutdown(t *TLS, sockfd, how int32) int32 {
// int getpeername(int sockfd, struct sockaddr *addr, socklen_t *addrlen);
func Xgetpeername(t *TLS, sockfd int32, addr uintptr, addrlen uintptr) int32 {
+ if __ccgo_strace {
+ trc("t=%v sockfd=%v addr=%v addrlen=%v, (%v:)", t, sockfd, addr, addrlen, origin(2))
+ }
if _, _, err := unix.Syscall(unix.SYS_GETPEERNAME, uintptr(sockfd), addr, uintptr(addrlen)); err != 0 {
t.setErrno(err)
return -1
@@ -617,6 +737,9 @@ func Xgetpeername(t *TLS, sockfd int32, addr uintptr, addrlen uintptr) int32 {
// int socket(int domain, int type, int protocol);
func Xsocket(t *TLS, domain, type1, protocol int32) int32 {
+ if __ccgo_strace {
+ trc("t=%v protocol=%v, (%v:)", t, protocol, origin(2))
+ }
n, _, err := unix.Syscall(unix.SYS_SOCKET, uintptr(domain), uintptr(type1), uintptr(protocol))
if err != 0 {
t.setErrno(err)
@@ -628,6 +751,9 @@ func Xsocket(t *TLS, domain, type1, protocol int32) int32 {
// int bind(int sockfd, const struct sockaddr *addr, socklen_t addrlen);
func Xbind(t *TLS, sockfd int32, addr uintptr, addrlen uint32) int32 {
+ if __ccgo_strace {
+ trc("t=%v sockfd=%v addr=%v addrlen=%v, (%v:)", t, sockfd, addr, addrlen, origin(2))
+ }
n, _, err := unix.Syscall(unix.SYS_BIND, uintptr(sockfd), addr, uintptr(addrlen))
if err != 0 {
t.setErrno(err)
@@ -639,6 +765,9 @@ func Xbind(t *TLS, sockfd int32, addr uintptr, addrlen uint32) int32 {
// int connect(int sockfd, const struct sockaddr *addr, socklen_t addrlen);
func Xconnect(t *TLS, sockfd int32, addr uintptr, addrlen uint32) int32 {
+ if __ccgo_strace {
+ trc("t=%v sockfd=%v addr=%v addrlen=%v, (%v:)", t, sockfd, addr, addrlen, origin(2))
+ }
if _, _, err := unix.Syscall(unix.SYS_CONNECT, uintptr(sockfd), addr, uintptr(addrlen)); err != 0 {
t.setErrno(err)
return -1
@@ -649,6 +778,9 @@ func Xconnect(t *TLS, sockfd int32, addr uintptr, addrlen uint32) int32 {
// int listen(int sockfd, int backlog);
func Xlisten(t *TLS, sockfd, backlog int32) int32 {
+ if __ccgo_strace {
+ trc("t=%v backlog=%v, (%v:)", t, backlog, origin(2))
+ }
if _, _, err := unix.Syscall(unix.SYS_LISTEN, uintptr(sockfd), uintptr(backlog), 0); err != 0 {
t.setErrno(err)
return -1
@@ -659,6 +791,9 @@ func Xlisten(t *TLS, sockfd, backlog int32) int32 {
// int accept(int sockfd, struct sockaddr *addr, socklen_t *addrlen);
func Xaccept(t *TLS, sockfd int32, addr uintptr, addrlen uintptr) int32 {
+ if __ccgo_strace {
+ trc("t=%v sockfd=%v addr=%v addrlen=%v, (%v:)", t, sockfd, addr, addrlen, origin(2))
+ }
panic(todo(""))
// n, _, err := unix.Syscall6(unix.SYS_ACCEPT4, uintptr(sockfd), addr, uintptr(addrlen), 0, 0, 0)
// if err != 0 {
@@ -671,16 +806,25 @@ func Xaccept(t *TLS, sockfd int32, addr uintptr, addrlen uintptr) int32 {
// int getrlimit(int resource, struct rlimit *rlim);
func Xgetrlimit(t *TLS, resource int32, rlim uintptr) int32 {
+ if __ccgo_strace {
+ trc("t=%v resource=%v rlim=%v, (%v:)", t, resource, rlim, origin(2))
+ }
return Xgetrlimit64(t, resource, rlim)
}
// int setrlimit(int resource, const struct rlimit *rlim);
func Xsetrlimit(t *TLS, resource int32, rlim uintptr) int32 {
+ if __ccgo_strace {
+ trc("t=%v resource=%v rlim=%v, (%v:)", t, resource, rlim, origin(2))
+ }
return Xsetrlimit64(t, resource, rlim)
}
// int setrlimit(int resource, const struct rlimit *rlim);
func Xsetrlimit64(t *TLS, resource int32, rlim uintptr) int32 {
+ if __ccgo_strace {
+ trc("t=%v resource=%v rlim=%v, (%v:)", t, resource, rlim, origin(2))
+ }
if _, _, err := unix.Syscall(unix.SYS_SETRLIMIT, uintptr(resource), uintptr(rlim), 0); err != 0 {
t.setErrno(err)
return -1
@@ -691,16 +835,25 @@ func Xsetrlimit64(t *TLS, resource int32, rlim uintptr) int32 {
// uid_t getuid(void);
func Xgetuid(t *TLS) types.Uid_t {
+ if __ccgo_strace {
+ trc("t=%v, (%v:)", t, origin(2))
+ }
return types.Uid_t(os.Getuid())
}
// pid_t getpid(void);
func Xgetpid(t *TLS) int32 {
+ if __ccgo_strace {
+ trc("t=%v, (%v:)", t, origin(2))
+ }
return int32(os.Getpid())
}
// int system(const char *command);
func Xsystem(t *TLS, command uintptr) int32 {
+ if __ccgo_strace {
+ trc("t=%v command=%v, (%v:)", t, command, origin(2))
+ }
s := GoString(command)
if command == 0 {
panic(todo(""))
@@ -720,26 +873,41 @@ func Xsystem(t *TLS, command uintptr) int32 {
// int setvbuf(FILE *stream, char *buf, int mode, size_t size);
func Xsetvbuf(t *TLS, stream, buf uintptr, mode int32, size types.Size_t) int32 {
+ if __ccgo_strace {
+ trc("t=%v buf=%v mode=%v size=%v, (%v:)", t, buf, mode, size, origin(2))
+ }
return 0 //TODO
}
// int raise(int sig);
func Xraise(t *TLS, sig int32) int32 {
+ if __ccgo_strace {
+ trc("t=%v sig=%v, (%v:)", t, sig, origin(2))
+ }
panic(todo(""))
}
// int backtrace(void **buffer, int size);
func Xbacktrace(t *TLS, buf uintptr, size int32) int32 {
+ if __ccgo_strace {
+ trc("t=%v buf=%v size=%v, (%v:)", t, buf, size, origin(2))
+ }
panic(todo(""))
}
// void backtrace_symbols_fd(void *const *buffer, int size, int fd);
func Xbacktrace_symbols_fd(t *TLS, buffer uintptr, size, fd int32) {
+ if __ccgo_strace {
+ trc("t=%v buffer=%v fd=%v, (%v:)", t, buffer, fd, origin(2))
+ }
panic(todo(""))
}
// int fileno(FILE *stream);
func Xfileno(t *TLS, stream uintptr) int32 {
+ if __ccgo_strace {
+ trc("t=%v stream=%v, (%v:)", t, stream, origin(2))
+ }
panic(todo(""))
}
@@ -773,11 +941,17 @@ func (f *ftstream) close(t *TLS) {
// FTS *fts_open(char * const *path_argv, int options, int (*compar)(const FTSENT **, const FTSENT **));
func Xfts_open(t *TLS, path_argv uintptr, options int32, compar uintptr) uintptr {
+ if __ccgo_strace {
+ trc("t=%v path_argv=%v options=%v compar=%v, (%v:)", t, path_argv, options, compar, origin(2))
+ }
return Xfts64_open(t, path_argv, options, compar)
}
// FTS *fts_open(char * const *path_argv, int options, int (*compar)(const FTSENT **, const FTSENT **));
func Xfts64_open(t *TLS, path_argv uintptr, options int32, compar uintptr) uintptr {
+ if __ccgo_strace {
+ trc("t=%v path_argv=%v options=%v compar=%v, (%v:)", t, path_argv, options, compar, origin(2))
+ }
f := &ftstream{}
var walk func(string)
@@ -882,11 +1056,17 @@ func Xfts64_open(t *TLS, path_argv uintptr, options int32, compar uintptr) uintp
// FTSENT *fts_read(FTS *ftsp);
func Xfts_read(t *TLS, ftsp uintptr) uintptr {
+ if __ccgo_strace {
+ trc("t=%v ftsp=%v, (%v:)", t, ftsp, origin(2))
+ }
return Xfts64_read(t, ftsp)
}
// FTSENT *fts_read(FTS *ftsp);
func Xfts64_read(t *TLS, ftsp uintptr) uintptr {
+ if __ccgo_strace {
+ trc("t=%v ftsp=%v, (%v:)", t, ftsp, origin(2))
+ }
f := getObject(ftsp).(*ftstream)
if f.x == len(f.s) {
t.setErrno(0)
@@ -903,11 +1083,17 @@ func Xfts64_read(t *TLS, ftsp uintptr) uintptr {
// int fts_close(FTS *ftsp);
func Xfts_close(t *TLS, ftsp uintptr) int32 {
+ if __ccgo_strace {
+ trc("t=%v ftsp=%v, (%v:)", t, ftsp, origin(2))
+ }
return Xfts64_close(t, ftsp)
}
// int fts_close(FTS *ftsp);
func Xfts64_close(t *TLS, ftsp uintptr) int32 {
+ if __ccgo_strace {
+ trc("t=%v ftsp=%v, (%v:)", t, ftsp, origin(2))
+ }
getObject(ftsp).(*ftstream).close(t)
removeObject(ftsp)
return 0
@@ -915,6 +1101,9 @@ func Xfts64_close(t *TLS, ftsp uintptr) int32 {
// void tzset (void);
func Xtzset(t *TLS) {
+ if __ccgo_strace {
+ trc("t=%v, (%v:)", t, origin(2))
+ }
//TODO
}
@@ -922,6 +1111,9 @@ var strerrorBuf [100]byte
// char *strerror(int errnum);
func Xstrerror(t *TLS, errnum int32) uintptr {
+ if __ccgo_strace {
+ trc("t=%v errnum=%v, (%v:)", t, errnum, origin(2))
+ }
if dmesgs {
dmesg("%v: %v\n%s", origin(1), errnum, debug.Stack())
}
@@ -931,31 +1123,49 @@ func Xstrerror(t *TLS, errnum int32) uintptr {
// void *dlopen(const char *filename, int flags);
func Xdlopen(t *TLS, filename uintptr, flags int32) uintptr {
+ if __ccgo_strace {
+ trc("t=%v filename=%v flags=%v, (%v:)", t, filename, flags, origin(2))
+ }
panic(todo(""))
}
// char *dlerror(void);
func Xdlerror(t *TLS) uintptr {
+ if __ccgo_strace {
+ trc("t=%v, (%v:)", t, origin(2))
+ }
panic(todo(""))
}
// int dlclose(void *handle);
func Xdlclose(t *TLS, handle uintptr) int32 {
+ if __ccgo_strace {
+ trc("t=%v handle=%v, (%v:)", t, handle, origin(2))
+ }
panic(todo(""))
}
// void *dlsym(void *handle, const char *symbol);
func Xdlsym(t *TLS, handle, symbol uintptr) uintptr {
+ if __ccgo_strace {
+ trc("t=%v symbol=%v, (%v:)", t, symbol, origin(2))
+ }
panic(todo(""))
}
// void perror(const char *s);
func Xperror(t *TLS, s uintptr) {
+ if __ccgo_strace {
+ trc("t=%v s=%v, (%v:)", t, s, origin(2))
+ }
panic(todo(""))
}
// int pclose(FILE *stream);
func Xpclose(t *TLS, stream uintptr) int32 {
+ if __ccgo_strace {
+ trc("t=%v stream=%v, (%v:)", t, stream, origin(2))
+ }
panic(todo(""))
}
@@ -963,37 +1173,58 @@ var gai_strerrorBuf [100]byte
// const char *gai_strerror(int errcode);
func Xgai_strerror(t *TLS, errcode int32) uintptr {
+ if __ccgo_strace {
+ trc("t=%v errcode=%v, (%v:)", t, errcode, origin(2))
+ }
copy(gai_strerrorBuf[:], fmt.Sprintf("gai error %d\x00", errcode))
return uintptr(unsafe.Pointer(&gai_strerrorBuf))
}
// int tcgetattr(int fd, struct termios *termios_p);
func Xtcgetattr(t *TLS, fd int32, termios_p uintptr) int32 {
+ if __ccgo_strace {
+ trc("t=%v fd=%v termios_p=%v, (%v:)", t, fd, termios_p, origin(2))
+ }
panic(todo(""))
}
// int tcsetattr(int fd, int optional_actions, const struct termios *termios_p);
func Xtcsetattr(t *TLS, fd, optional_actions int32, termios_p uintptr) int32 {
+ if __ccgo_strace {
+ trc("t=%v optional_actions=%v termios_p=%v, (%v:)", t, optional_actions, termios_p, origin(2))
+ }
panic(todo(""))
}
// speed_t cfgetospeed(const struct termios *termios_p);
func Xcfgetospeed(t *TLS, termios_p uintptr) termios.Speed_t {
+ if __ccgo_strace {
+ trc("t=%v termios_p=%v, (%v:)", t, termios_p, origin(2))
+ }
panic(todo(""))
}
// int cfsetospeed(struct termios *termios_p, speed_t speed);
func Xcfsetospeed(t *TLS, termios_p uintptr, speed uint32) int32 {
+ if __ccgo_strace {
+ trc("t=%v termios_p=%v speed=%v, (%v:)", t, termios_p, speed, origin(2))
+ }
panic(todo(""))
}
// int cfsetispeed(struct termios *termios_p, speed_t speed);
func Xcfsetispeed(t *TLS, termios_p uintptr, speed uint32) int32 {
+ if __ccgo_strace {
+ trc("t=%v termios_p=%v speed=%v, (%v:)", t, termios_p, speed, origin(2))
+ }
panic(todo(""))
}
// pid_t fork(void);
func Xfork(t *TLS) int32 {
+ if __ccgo_strace {
+ trc("t=%v, (%v:)", t, origin(2))
+ }
t.setErrno(errno.ENOSYS)
return -1
}
@@ -1002,21 +1233,33 @@ var emptyStr = [1]byte{}
// char *setlocale(int category, const char *locale);
func Xsetlocale(t *TLS, category int32, locale uintptr) uintptr {
+ if __ccgo_strace {
+ trc("t=%v category=%v locale=%v, (%v:)", t, category, locale, origin(2))
+ }
return uintptr(unsafe.Pointer(&emptyStr)) //TODO
}
// char *nl_langinfo(nl_item item);
func Xnl_langinfo(t *TLS, item langinfo.Nl_item) uintptr {
+ if __ccgo_strace {
+ trc("t=%v item=%v, (%v:)", t, item, origin(2))
+ }
return uintptr(unsafe.Pointer(&emptyStr)) //TODO
}
// FILE *popen(const char *command, const char *type);
func Xpopen(t *TLS, command, type1 uintptr) uintptr {
+ if __ccgo_strace {
+ trc("t=%v type1=%v, (%v:)", t, type1, origin(2))
+ }
panic(todo(""))
}
// char *realpath(const char *path, char *resolved_path);
func Xrealpath(t *TLS, path, resolved_path uintptr) uintptr {
+ if __ccgo_strace {
+ trc("t=%v resolved_path=%v, (%v:)", t, resolved_path, origin(2))
+ }
s, err := filepath.EvalSymlinks(GoString(path))
if err != nil {
if os.IsNotExist(err) {
@@ -1045,19 +1288,31 @@ func Xrealpath(t *TLS, path, resolved_path uintptr) uintptr {
// struct tm *gmtime_r(const time_t *timep, struct tm *result);
func Xgmtime_r(t *TLS, timep, result uintptr) uintptr {
+ if __ccgo_strace {
+ trc("t=%v result=%v, (%v:)", t, result, origin(2))
+ }
panic(todo(""))
}
// char *inet_ntoa(struct in_addr in);
func Xinet_ntoa(t *TLS, in1 in.In_addr) uintptr {
+ if __ccgo_strace {
+ trc("t=%v in1=%v, (%v:)", t, in1, origin(2))
+ }
panic(todo(""))
}
func X__ccgo_in6addr_anyp(t *TLS) uintptr {
+ if __ccgo_strace {
+ trc("t=%v, (%v:)", t, origin(2))
+ }
return uintptr(unsafe.Pointer(&in6_addr_any))
}
func Xabort(t *TLS) {
+ if __ccgo_strace {
+ trc("t=%v, (%v:)", t, origin(2))
+ }
panic(todo("")) //TODO
// if dmesgs {
// dmesg("%v:", origin(1))
@@ -1076,11 +1331,17 @@ func Xabort(t *TLS) {
// int fflush(FILE *stream);
func Xfflush(t *TLS, stream uintptr) int32 {
+ if __ccgo_strace {
+ trc("t=%v stream=%v, (%v:)", t, stream, origin(2))
+ }
return 0 //TODO
}
// size_t fread(void *ptr, size_t size, size_t nmemb, FILE *stream);
func Xfread(t *TLS, ptr uintptr, size, nmemb types.Size_t, stream uintptr) types.Size_t {
+ if __ccgo_strace {
+ trc("t=%v ptr=%v nmemb=%v stream=%v, (%v:)", t, ptr, nmemb, stream, origin(2))
+ }
m, _, err := unix.Syscall(unix.SYS_READ, uintptr(file(stream).fd()), ptr, uintptr(size*nmemb))
if err != 0 {
file(stream).setErr()
@@ -1096,6 +1357,9 @@ func Xfread(t *TLS, ptr uintptr, size, nmemb types.Size_t, stream uintptr) types
// size_t fwrite(const void *ptr, size_t size, size_t nmemb, FILE *stream);
func Xfwrite(t *TLS, ptr uintptr, size, nmemb types.Size_t, stream uintptr) types.Size_t {
+ if __ccgo_strace {
+ trc("t=%v ptr=%v nmemb=%v stream=%v, (%v:)", t, ptr, nmemb, stream, origin(2))
+ }
m, _, err := unix.Syscall(unix.SYS_WRITE, uintptr(file(stream).fd()), ptr, uintptr(size*nmemb))
if err != 0 {
file(stream).setErr()
@@ -1111,11 +1375,17 @@ func Xfwrite(t *TLS, ptr uintptr, size, nmemb types.Size_t, stream uintptr) type
// int fclose(FILE *stream);
func Xfclose(t *TLS, stream uintptr) int32 {
+ if __ccgo_strace {
+ trc("t=%v stream=%v, (%v:)", t, stream, origin(2))
+ }
return file(stream).close(t)
}
// int fputc(int c, FILE *stream);
func Xfputc(t *TLS, c int32, stream uintptr) int32 {
+ if __ccgo_strace {
+ trc("t=%v c=%v stream=%v, (%v:)", t, c, stream, origin(2))
+ }
if _, err := fwrite(file(stream).fd(), []byte{byte(c)}); err != nil {
return stdio.EOF
}
@@ -1125,6 +1395,9 @@ func Xfputc(t *TLS, c int32, stream uintptr) int32 {
// int fseek(FILE *stream, long offset, int whence);
func Xfseek(t *TLS, stream uintptr, offset long, whence int32) int32 {
+ if __ccgo_strace {
+ trc("t=%v stream=%v offset=%v whence=%v, (%v:)", t, stream, offset, whence, origin(2))
+ }
if n := Xlseek(t, int32(file(stream).fd()), types.Off_t(offset), whence); n < 0 {
// if dmesgs {
// dmesg("%v: fd %v, off %#x, whence %v: %v", origin(1), file(stream).fd(), offset, whenceStr(whence), n)
@@ -1141,6 +1414,9 @@ func Xfseek(t *TLS, stream uintptr, offset long, whence int32) int32 {
// long ftell(FILE *stream);
func Xftell(t *TLS, stream uintptr) long {
+ if __ccgo_strace {
+ trc("t=%v stream=%v, (%v:)", t, stream, origin(2))
+ }
n := Xlseek(t, file(stream).fd(), 0, stdio.SEEK_CUR)
if n < 0 {
file(stream).setErr()
@@ -1155,21 +1431,33 @@ func Xftell(t *TLS, stream uintptr) long {
// int ferror(FILE *stream);
func Xferror(t *TLS, stream uintptr) int32 {
+ if __ccgo_strace {
+ trc("t=%v stream=%v, (%v:)", t, stream, origin(2))
+ }
return Bool32(file(stream).err())
}
// int ungetc(int c, FILE *stream);
func Xungetc(t *TLS, c int32, stream uintptr) int32 {
+ if __ccgo_strace {
+ trc("t=%v c=%v stream=%v, (%v:)", t, c, stream, origin(2))
+ }
panic(todo(""))
}
// int fscanf(FILE *stream, const char *format, ...);
func Xfscanf(t *TLS, stream, format, va uintptr) int32 {
+ if __ccgo_strace {
+ trc("t=%v va=%v, (%v:)", t, va, origin(2))
+ }
panic(todo(""))
}
// int fputs(const char *s, FILE *stream);
func Xfputs(t *TLS, s, stream uintptr) int32 {
+ if __ccgo_strace {
+ trc("t=%v stream=%v, (%v:)", t, stream, origin(2))
+ }
if _, _, err := unix.Syscall(unix.SYS_WRITE, uintptr(file(stream).fd()), s, uintptr(Xstrlen(t, s))); err != 0 {
return -1
}
@@ -1181,6 +1469,9 @@ var getservbynameStaticResult netdb.Servent
// struct servent *getservbyname(const char *name, const char *proto);
func Xgetservbyname(t *TLS, name, proto uintptr) uintptr {
+ if __ccgo_strace {
+ trc("t=%v proto=%v, (%v:)", t, proto, origin(2))
+ }
var protoent *gonetdb.Protoent
if proto != 0 {
protoent = gonetdb.GetProtoByName(GoString(proto))
@@ -1258,6 +1549,9 @@ func Xgetservbyname(t *TLS, name, proto uintptr) uintptr {
}
func Xreaddir64(t *TLS, dir uintptr) uintptr {
+ if __ccgo_strace {
+ trc("t=%v dir=%v, (%v:)", t, dir, origin(2))
+ }
return Xreaddir(t, dir)
}
@@ -1270,14 +1564,23 @@ func __syscall(r, _ uintptr, errno syscall.Errno) long {
}
func X__syscall1(t *TLS, trap, p1 long) long {
+ if __ccgo_strace {
+ trc("t=%v p1=%v, (%v:)", t, p1, origin(2))
+ }
return __syscall(unix.Syscall(uintptr(trap), uintptr(p1), 0, 0))
}
func X__syscall3(t *TLS, trap, p1, p2, p3 long) long {
+ if __ccgo_strace {
+ trc("t=%v p3=%v, (%v:)", t, p3, origin(2))
+ }
return __syscall(unix.Syscall(uintptr(trap), uintptr(p1), uintptr(p2), uintptr(p3)))
}
func X__syscall4(t *TLS, trap, p1, p2, p3, p4 long) long {
+ if __ccgo_strace {
+ trc("t=%v p4=%v, (%v:)", t, p4, origin(2))
+ }
return __syscall(unix.Syscall6(uintptr(trap), uintptr(p1), uintptr(p2), uintptr(p3), uintptr(p4), 0, 0))
}
@@ -1300,26 +1603,41 @@ func fcntlCmdStr(cmd int32) string {
// int setenv(const char *name, const char *value, int overwrite);
func Xsetenv(t *TLS, name, value uintptr, overwrite int32) int32 {
+ if __ccgo_strace {
+ trc("t=%v value=%v overwrite=%v, (%v:)", t, value, overwrite, origin(2))
+ }
panic(todo(""))
}
// int unsetenv(const char *name);
func Xunsetenv(t *TLS, name uintptr) int32 {
+ if __ccgo_strace {
+ trc("t=%v name=%v, (%v:)", t, name, origin(2))
+ }
panic(todo(""))
}
// int pause(void);
func Xpause(t *TLS) int32 {
+ if __ccgo_strace {
+ trc("t=%v, (%v:)", t, origin(2))
+ }
panic(todo(""))
}
// ssize_t writev(int fd, const struct iovec *iov, int iovcnt);
func Xwritev(t *TLS, fd int32, iov uintptr, iovcnt int32) types.Ssize_t {
+ if __ccgo_strace {
+ trc("t=%v fd=%v iov=%v iovcnt=%v, (%v:)", t, fd, iov, iovcnt, origin(2))
+ }
panic(todo(""))
}
// int __isoc99_sscanf(const char *str, const char *format, ...);
func X__isoc99_sscanf(t *TLS, str, format, va uintptr) int32 {
+ if __ccgo_strace {
+ trc("t=%v va=%v, (%v:)", t, va, origin(2))
+ }
r := Xsscanf(t, str, format, va)
// if dmesgs {
// dmesg("%v: %q %q: %d", origin(1), GoString(str), GoString(format), r)
@@ -1329,20 +1647,32 @@ func X__isoc99_sscanf(t *TLS, str, format, va uintptr) int32 {
// void __assert(const char * func, const char * file, int line, const char *expr) __dead2;
func X__assert(t *TLS, fn, file uintptr, line int32, expr uintptr) {
+ if __ccgo_strace {
+ trc("t=%v file=%v line=%v expr=%v, (%v:)", t, file, line, expr, origin(2))
+ }
X__assert_fail(t, expr, file, uint32(line), fn)
}
func X__assert13(t *TLS, file uintptr, line int32, fn, msg uintptr) {
+ if __ccgo_strace {
+ trc("t=%v file=%v line=%v msg=%v, (%v:)", t, file, line, msg, origin(2))
+ }
X__assert_fail(t, msg, file, uint32(line), fn)
}
// include/stdio.h:456:int __swbuf(int, FILE *);
func X__swbuf(t *TLS, n int32, file uintptr) int32 {
+ if __ccgo_strace {
+ trc("t=%v n=%v file=%v, (%v:)", t, n, file, origin(2))
+ }
return Xfputc(t, n, file) //TODO improve performance, use a real buffer.
}
// int rmdir(const char *pathname);
func Xrmdir(t *TLS, pathname uintptr) int32 {
+ if __ccgo_strace {
+ trc("t=%v pathname=%v, (%v:)", t, pathname, origin(2))
+ }
if err := unix.Rmdir(GoString(pathname)); err != nil {
if dmesgs {
dmesg("%v: %v FAIL", origin(1), err)
@@ -1359,6 +1689,9 @@ func Xrmdir(t *TLS, pathname uintptr) int32 {
// struct dirent *readdir(DIR *dirp);
func Xreaddir(t *TLS, dir uintptr) uintptr {
+ if __ccgo_strace {
+ trc("t=%v dir=%v, (%v:)", t, dir, origin(2))
+ }
if (*darwinDir)(unsafe.Pointer(dir)).eof {
return 0
}
@@ -1397,6 +1730,9 @@ type darwinDir struct {
// int sscanf(const char *str, const char *format, ...);
func Xsscanf(t *TLS, str, format, va uintptr) int32 {
+ if __ccgo_strace {
+ trc("t=%v va=%v, (%v:)", t, va, origin(2))
+ }
r := scanf(strings.NewReader(GoString(str)), format, va)
// if dmesgs {
// dmesg("%v: %q %q: %d", origin(1), GoString(str), GoString(format), r)
@@ -1406,10 +1742,16 @@ func Xsscanf(t *TLS, str, format, va uintptr) int32 {
// int * __error(void);
func X__error(t *TLS) uintptr {
+ if __ccgo_strace {
+ trc("t=%v, (%v:)", t, origin(2))
+ }
return t.errnop
}
func Xclosedir(t *TLS, dir uintptr) int32 {
+ if __ccgo_strace {
+ trc("t=%v dir=%v, (%v:)", t, dir, origin(2))
+ }
r := Xclose(t, int32((*darwinDir)(unsafe.Pointer(dir)).fd))
Xfree(t, dir)
return r
@@ -1417,11 +1759,17 @@ func Xclosedir(t *TLS, dir uintptr) int32 {
// int __xuname(int namesize, void *namebuf)
func X__xuname(t *TLS, namesize int32, namebuf uintptr) int32 {
+ if __ccgo_strace {
+ trc("t=%v namesize=%v namebuf=%v, (%v:)", t, namesize, namebuf, origin(2))
+ }
return Xuname(t, namebuf)
}
// int chflags(const char *path, u_int flags);
func Xchflags(t *TLS, path uintptr, flags uint64) int32 {
+ if __ccgo_strace {
+ trc("t=%v path=%v flags=%v, (%v:)", t, path, flags, origin(2))
+ }
if err := unix.Chflags(GoString(path), int(flags)); err != nil {
if dmesgs {
dmesg("%v: %v FAIL", origin(1), err)
@@ -1438,6 +1786,9 @@ func Xchflags(t *TLS, path uintptr, flags uint64) int32 {
// int pipe(int pipefd[2]);
func Xpipe(t *TLS, pipefd uintptr) int32 {
+ if __ccgo_strace {
+ trc("t=%v pipefd=%v, (%v:)", t, pipefd, origin(2))
+ }
var a [2]int
if err := syscall.Pipe(a[:]); err != nil {
if dmesgs {
@@ -1456,10 +1807,16 @@ func Xpipe(t *TLS, pipefd uintptr) int32 {
// char *inet_ntoa(struct in_addr in);
func X__inet_ntoa(t *TLS, in1 in.In_addr) uintptr {
+ if __ccgo_strace {
+ trc("t=%v in1=%v, (%v:)", t, in1, origin(2))
+ }
panic(todo(""))
}
func Xmmap(t *TLS, addr uintptr, length types.Size_t, prot, flags, fd int32, offset types.Off_t) uintptr {
+ if __ccgo_strace {
+ trc("t=%v addr=%v length=%v fd=%v offset=%v, (%v:)", t, addr, length, fd, offset, origin(2))
+ }
// Cannot avoid the syscall here, addr sometimes matter.
data, _, err := unix.Syscall6(unix.SYS_MMAP, addr, uintptr(length), uintptr(prot), uintptr(flags), uintptr(fd), uintptr(offset))
if err != 0 {
@@ -1477,27 +1834,45 @@ func Xmmap(t *TLS, addr uintptr, length types.Size_t, prot, flags, fd int32, off
}
func X__errno(t *TLS) uintptr {
+ if __ccgo_strace {
+ trc("t=%v, (%v:)", t, origin(2))
+ }
return X__errno_location(t)
}
func X__ccgo_pthreadMutexattrGettype(tls *TLS, a uintptr) int32 { /* pthread_attr_get.c:93:5: */
+ if __ccgo_strace {
+ trc("tls=%v a=%v, (%v:)", tls, a, origin(2))
+ }
return (int32((*pthread_mutexattr_t)(unsafe.Pointer(a)).F__attr & uint32(3)))
}
func X__ccgo_getMutexType(tls *TLS, m uintptr) int32 { /* pthread_mutex_lock.c:3:5: */
+ if __ccgo_strace {
+ trc("tls=%v m=%v, (%v:)", tls, m, origin(2))
+ }
return (*(*int32)(unsafe.Pointer((m /* &.__u */ /* &.__i */))) & 15)
}
func X__ccgo_pthreadAttrGetDetachState(tls *TLS, a uintptr) int32 { /* pthread_attr_get.c:3:5: */
+ if __ccgo_strace {
+ trc("tls=%v a=%v, (%v:)", tls, a, origin(2))
+ }
return *(*int32)(unsafe.Pointer((a /* &.__u */ /* &.__i */) + 6*4))
}
func Xpthread_attr_getdetachstate(tls *TLS, a uintptr, state uintptr) int32 { /* pthread_attr_get.c:7:5: */
+ if __ccgo_strace {
+ trc("tls=%v a=%v state=%v, (%v:)", tls, a, state, origin(2))
+ }
*(*int32)(unsafe.Pointer(state)) = *(*int32)(unsafe.Pointer((a /* &.__u */ /* &.__i */) + 6*4))
return 0
}
func Xpthread_attr_setdetachstate(tls *TLS, a uintptr, state int32) int32 { /* pthread_attr_setdetachstate.c:3:5: */
+ if __ccgo_strace {
+ trc("tls=%v a=%v state=%v, (%v:)", tls, a, state, origin(2))
+ }
if uint32(state) > 1 {
return 22
}
@@ -1506,15 +1881,24 @@ func Xpthread_attr_setdetachstate(tls *TLS, a uintptr, state int32) int32 { /* p
}
func Xpthread_mutexattr_destroy(tls *TLS, a uintptr) int32 { /* pthread_mutexattr_destroy.c:3:5: */
+ if __ccgo_strace {
+ trc("tls=%v a=%v, (%v:)", tls, a, origin(2))
+ }
return 0
}
func Xpthread_mutexattr_init(tls *TLS, a uintptr) int32 { /* pthread_mutexattr_init.c:3:5: */
+ if __ccgo_strace {
+ trc("tls=%v a=%v, (%v:)", tls, a, origin(2))
+ }
*(*pthread_mutexattr_t)(unsafe.Pointer(a)) = pthread_mutexattr_t{}
return 0
}
func Xpthread_mutexattr_settype(tls *TLS, a uintptr, type1 int32) int32 { /* pthread_mutexattr_settype.c:3:5: */
+ if __ccgo_strace {
+ trc("tls=%v a=%v type1=%v, (%v:)", tls, a, type1, origin(2))
+ }
if uint32(type1) > uint32(2) {
return 22
}
@@ -1524,6 +1908,9 @@ func Xpthread_mutexattr_settype(tls *TLS, a uintptr, type1 int32) int32 { /* pth
// int uuid_parse( char *in, uuid_t uu);
func Xuuid_parse(t *TLS, in uintptr, uu uintptr) int32 {
+ if __ccgo_strace {
+ trc("t=%v in=%v uu=%v, (%v:)", t, in, uu, origin(2))
+ }
r, err := guuid.Parse(GoString(in))
if err != nil {
return -1
@@ -1533,19 +1920,33 @@ func Xuuid_parse(t *TLS, in uintptr, uu uintptr) int32 {
return 0
}
-func X__srget(t *TLS, stream uintptr) int32 { return Xgetc(t, stream) }
+func X__srget(t *TLS, stream uintptr) int32 {
+ if __ccgo_strace {
+ trc("t=%v stream=%v, (%v:)", t, stream, origin(2))
+ }
+ return Xgetc(t, stream)
+}
// uint16_t __builtin_bswap16 (uint32_t x)
func Xbswap16(t *TLS, x uint16) uint16 {
+ if __ccgo_strace {
+ trc("t=%v x=%v, (%v:)", t, x, origin(2))
+ }
return X__builtin_bswap16(t, x)
}
// uint32_t __builtin_bswap32 (uint32_t x)
func Xbswap32(t *TLS, x uint32) uint32 {
+ if __ccgo_strace {
+ trc("t=%v x=%v, (%v:)", t, x, origin(2))
+ }
return X__builtin_bswap32(t, x)
}
// uint64_t __builtin_bswap64 (uint64_t x)
func Xbswap64(t *TLS, x uint64) uint64 {
+ if __ccgo_strace {
+ trc("t=%v x=%v, (%v:)", t, x, origin(2))
+ }
return X__builtin_bswap64(t, x)
}
diff --git a/vendor/modernc.org/libc/libc_netbsd_amd64.go b/vendor/modernc.org/libc/libc_netbsd_amd64.go
index c418ad4f..7c4026fa 100644
--- a/vendor/modernc.org/libc/libc_netbsd_amd64.go
+++ b/vendor/modernc.org/libc/libc_netbsd_amd64.go
@@ -24,6 +24,9 @@ type (
// int sigaction(int signum, const struct sigaction *act, struct sigaction *oldact);
func Xsigaction(t *TLS, signum int32, act, oldact uintptr) int32 {
+ if __ccgo_strace {
+ trc("t=%v signum=%v oldact=%v, (%v:)", t, signum, oldact, origin(2))
+ }
panic(todo(""))
// if _, _, err := unix.Syscall(unix.SYS_SIGACTION, uintptr(signum), act, oldact); err != 0 {
// t.setErrno(err)
@@ -35,6 +38,9 @@ func Xsigaction(t *TLS, signum int32, act, oldact uintptr) int32 {
// FILE *fopen64(const char *pathname, const char *mode);
func Xfopen64(t *TLS, pathname, mode uintptr) uintptr {
+ if __ccgo_strace {
+ trc("t=%v mode=%v, (%v:)", t, mode, origin(2))
+ }
m := strings.ReplaceAll(GoString(mode), "b", "")
var flags int
switch m {
@@ -74,6 +80,9 @@ func Xfopen64(t *TLS, pathname, mode uintptr) uintptr {
// int lstat(const char *pathname, struct stat *statbuf);
func Xlstat64(t *TLS, pathname, statbuf uintptr) int32 {
+ if __ccgo_strace {
+ trc("t=%v statbuf=%v, (%v:)", t, statbuf, origin(2))
+ }
if err := unix.Lstat(GoString(pathname), (*unix.Stat_t)(unsafe.Pointer(statbuf))); err != nil {
if dmesgs {
dmesg("%v: %q: %v FAIL", origin(1), GoString(pathname), err)
@@ -90,6 +99,9 @@ func Xlstat64(t *TLS, pathname, statbuf uintptr) int32 {
// int stat(const char *pathname, struct stat *statbuf);
func Xstat64(t *TLS, pathname, statbuf uintptr) int32 {
+ if __ccgo_strace {
+ trc("t=%v statbuf=%v, (%v:)", t, statbuf, origin(2))
+ }
if err := unix.Stat(GoString(pathname), (*unix.Stat_t)(unsafe.Pointer(statbuf))); err != nil {
if dmesgs {
dmesg("%v: %q: %v FAIL", origin(1), GoString(pathname), err)
@@ -106,6 +118,9 @@ func Xstat64(t *TLS, pathname, statbuf uintptr) int32 {
// int mkdir(const char *path, mode_t mode);
func Xmkdir(t *TLS, path uintptr, mode types.Mode_t) int32 {
+ if __ccgo_strace {
+ trc("t=%v path=%v mode=%v, (%v:)", t, path, mode, origin(2))
+ }
if err := unix.Mkdir(GoString(path), uint32(mode)); err != nil {
if dmesgs {
dmesg("%v: %q: %v FAIL", origin(1), GoString(path), err)
@@ -122,6 +137,9 @@ func Xmkdir(t *TLS, path uintptr, mode types.Mode_t) int32 {
// int access(const char *pathname, int mode);
func Xaccess(t *TLS, pathname uintptr, mode int32) int32 {
+ if __ccgo_strace {
+ trc("t=%v pathname=%v mode=%v, (%v:)", t, pathname, mode, origin(2))
+ }
if err := unix.Access(GoString(pathname), uint32(mode)); err != nil {
if dmesgs {
dmesg("%v: %q %#o: %v FAIL", origin(1), GoString(pathname), mode, err)
@@ -138,6 +156,9 @@ func Xaccess(t *TLS, pathname uintptr, mode int32) int32 {
// int unlink(const char *pathname);
func Xunlink(t *TLS, pathname uintptr) int32 {
+ if __ccgo_strace {
+ trc("t=%v pathname=%v, (%v:)", t, pathname, origin(2))
+ }
if err := unix.Unlink(GoString(pathname)); err != nil {
if dmesgs {
dmesg("%v: %q: %v", origin(1), GoString(pathname), err)
@@ -154,6 +175,9 @@ func Xunlink(t *TLS, pathname uintptr) int32 {
// ssize_t readlink(const char *restrict path, char *restrict buf, size_t bufsize);
func Xreadlink(t *TLS, path, buf uintptr, bufsize types.Size_t) types.Ssize_t {
+ if __ccgo_strace {
+ trc("t=%v buf=%v bufsize=%v, (%v:)", t, buf, bufsize, origin(2))
+ }
var n int
var err error
switch {
@@ -178,6 +202,9 @@ func Xreadlink(t *TLS, path, buf uintptr, bufsize types.Size_t) types.Ssize_t {
// int symlink(const char *target, const char *linkpath);
func Xsymlink(t *TLS, target, linkpath uintptr) int32 {
+ if __ccgo_strace {
+ trc("t=%v linkpath=%v, (%v:)", t, linkpath, origin(2))
+ }
if err := unix.Symlink(GoString(target), GoString(linkpath)); err != nil {
if dmesgs {
dmesg("%v: %v FAIL", origin(1), err)
@@ -194,6 +221,9 @@ func Xsymlink(t *TLS, target, linkpath uintptr) int32 {
// int chmod(const char *pathname, mode_t mode)
func Xchmod(t *TLS, pathname uintptr, mode types.Mode_t) int32 {
+ if __ccgo_strace {
+ trc("t=%v pathname=%v mode=%v, (%v:)", t, pathname, mode, origin(2))
+ }
if err := unix.Chmod(GoString(pathname), uint32(mode)); err != nil {
if dmesgs {
dmesg("%v: %q %#o: %v FAIL", origin(1), GoString(pathname), mode, err)
@@ -210,6 +240,9 @@ func Xchmod(t *TLS, pathname uintptr, mode types.Mode_t) int32 {
// time_t time(time_t *tloc);
func Xtime(t *TLS, tloc uintptr) time.Time_t {
+ if __ccgo_strace {
+ trc("t=%v tloc=%v, (%v:)", t, tloc, origin(2))
+ }
panic(todo(""))
// n := time.Now().UTC().Unix()
// if tloc != 0 {
@@ -220,6 +253,9 @@ func Xtime(t *TLS, tloc uintptr) time.Time_t {
// int utimes(const char *filename, const struct timeval times[2]);
func Xutimes(t *TLS, filename, times uintptr) int32 {
+ if __ccgo_strace {
+ trc("t=%v times=%v, (%v:)", t, times, origin(2))
+ }
var a []unix.Timeval
if times != 0 {
a = make([]unix.Timeval, 2)
@@ -242,6 +278,9 @@ func Xutimes(t *TLS, filename, times uintptr) int32 {
// int fstat(int fd, struct stat *statbuf);
func Xfstat64(t *TLS, fd int32, statbuf uintptr) int32 {
+ if __ccgo_strace {
+ trc("t=%v fd=%v statbuf=%v, (%v:)", t, fd, statbuf, origin(2))
+ }
if err := unix.Fstat(int(fd), (*unix.Stat_t)(unsafe.Pointer(statbuf))); err != nil {
if dmesgs {
dmesg("%v: fd %d: %v FAIL", origin(1), fd, err)
@@ -258,6 +297,9 @@ func Xfstat64(t *TLS, fd int32, statbuf uintptr) int32 {
// off64_t lseek64(int fd, off64_t offset, int whence);
func Xlseek64(t *TLS, fd int32, offset types.Off_t, whence int32) types.Off_t {
+ if __ccgo_strace {
+ trc("t=%v fd=%v offset=%v whence=%v, (%v:)", t, fd, offset, whence, origin(2))
+ }
n, err := unix.Seek(int(fd), int64(offset), int(whence))
if err != nil {
if dmesgs {
@@ -274,6 +316,9 @@ func Xlseek64(t *TLS, fd int32, offset types.Off_t, whence int32) types.Off_t {
}
func Xfcntl64(t *TLS, fd, cmd int32, args uintptr) int32 {
+ if __ccgo_strace {
+ trc("t=%v cmd=%v args=%v, (%v:)", t, cmd, args, origin(2))
+ }
var arg uintptr
if args != 0 {
arg = *(*uintptr)(unsafe.Pointer(args))
@@ -295,6 +340,9 @@ func Xfcntl64(t *TLS, fd, cmd int32, args uintptr) int32 {
// int rename(const char *oldpath, const char *newpath);
func Xrename(t *TLS, oldpath, newpath uintptr) int32 {
+ if __ccgo_strace {
+ trc("t=%v newpath=%v, (%v:)", t, newpath, origin(2))
+ }
if err := unix.Rename(GoString(oldpath), GoString(newpath)); err != nil {
if dmesgs {
dmesg("%v: %v FAIL", origin(1), err)
@@ -311,6 +359,9 @@ func Xrename(t *TLS, oldpath, newpath uintptr) int32 {
// int mknod(const char *pathname, mode_t mode, dev_t dev);
func Xmknod(t *TLS, pathname uintptr, mode types.Mode_t, dev types.Dev_t) int32 {
+ if __ccgo_strace {
+ trc("t=%v pathname=%v mode=%v dev=%v, (%v:)", t, pathname, mode, dev, origin(2))
+ }
panic(todo(""))
// if _, _, err := unix.Syscall(unix.SYS_MKNOD, pathname, uintptr(mode), uintptr(dev)); err != 0 {
// t.setErrno(err)
@@ -322,6 +373,9 @@ func Xmknod(t *TLS, pathname uintptr, mode types.Mode_t, dev types.Dev_t) int32
// int utime(const char *filename, const struct utimbuf *times);
func Xutime(t *TLS, filename, times uintptr) int32 {
+ if __ccgo_strace {
+ trc("t=%v times=%v, (%v:)", t, times, origin(2))
+ }
var a []unix.Timeval
if times != 0 {
a = make([]unix.Timeval, 2)
@@ -344,6 +398,9 @@ func Xutime(t *TLS, filename, times uintptr) int32 {
// int chown(const char *pathname, uid_t owner, gid_t group);
func Xchown(t *TLS, pathname uintptr, owner types.Uid_t, group types.Gid_t) int32 {
+ if __ccgo_strace {
+ trc("t=%v pathname=%v owner=%v group=%v, (%v:)", t, pathname, owner, group, origin(2))
+ }
if _, _, err := unix.Syscall(unix.SYS_CHOWN, pathname, uintptr(owner), uintptr(group)); err != 0 {
t.setErrno(err)
return -1
@@ -354,6 +411,9 @@ func Xchown(t *TLS, pathname uintptr, owner types.Uid_t, group types.Gid_t) int3
// int link(const char *oldpath, const char *newpath);
func Xlink(t *TLS, oldpath, newpath uintptr) int32 {
+ if __ccgo_strace {
+ trc("t=%v newpath=%v, (%v:)", t, newpath, origin(2))
+ }
panic(todo(""))
// if _, _, err := unix.Syscall(unix.SYS_LINK, oldpath, newpath, 0); err != 0 {
// t.setErrno(err)
@@ -365,6 +425,9 @@ func Xlink(t *TLS, oldpath, newpath uintptr) int32 {
// int dup2(int oldfd, int newfd);
func Xdup2(t *TLS, oldfd, newfd int32) int32 {
+ if __ccgo_strace {
+ trc("t=%v newfd=%v, (%v:)", t, newfd, origin(2))
+ }
panic(todo(""))
// n, _, err := unix.Syscall(unix.SYS_DUP2, uintptr(oldfd), uintptr(newfd), 0)
// if err != 0 {
@@ -377,6 +440,9 @@ func Xdup2(t *TLS, oldfd, newfd int32) int32 {
// unsigned int alarm(unsigned int seconds);
func Xalarm(t *TLS, seconds uint32) uint32 {
+ if __ccgo_strace {
+ trc("t=%v seconds=%v, (%v:)", t, seconds, origin(2))
+ }
panic(todo(""))
// n, _, err := unix.Syscall(unix.SYS_ALARM, uintptr(seconds), 0, 0)
// if err != 0 {
@@ -388,6 +454,9 @@ func Xalarm(t *TLS, seconds uint32) uint32 {
// int getnameinfo(const struct sockaddr * restrict sa, socklen_t salen, char * restrict host, socklen_t hostlen, char * restrict serv, socklen_t servlen, int flags);
func Xgetnameinfo(tls *TLS, sa1 uintptr, sl socklen_t, node uintptr, nodelen socklen_t, serv uintptr, servlen socklen_t, flags int32) int32 { /* getnameinfo.c:125:5: */
+ if __ccgo_strace {
+ trc("tls=%v sa1=%v sl=%v node=%v nodelen=%v serv=%v servlen=%v flags=%v, (%v:)", tls, sa1, sl, node, nodelen, serv, servlen, flags, origin(2))
+ }
panic(todo(""))
//TODO bp := tls.Alloc(347)
//TODO defer tls.Free(347)
@@ -487,6 +556,9 @@ func Xgetnameinfo(tls *TLS, sa1 uintptr, sl socklen_t, node uintptr, nodelen soc
}
func Xgethostbyaddr_r(tls *TLS, a uintptr, l socklen_t, af int32, h uintptr, buf uintptr, buflen size_t, res uintptr, err uintptr) int32 { /* gethostbyaddr_r.c:10:5: */
+ if __ccgo_strace {
+ trc("tls=%v a=%v l=%v af=%v h=%v buf=%v buflen=%v res=%v err=%v, (%v:)", tls, a, l, af, h, buf, buflen, res, err, origin(2))
+ }
panic(todo(""))
//TODO bp := tls.Alloc(28)
//TODO defer tls.Free(28)
@@ -574,6 +646,9 @@ func Xgethostbyaddr_r(tls *TLS, a uintptr, l socklen_t, af int32, h uintptr, buf
// int getrlimit(int resource, struct rlimit *rlim);
func Xgetrlimit64(t *TLS, resource int32, rlim uintptr) int32 {
+ if __ccgo_strace {
+ trc("t=%v resource=%v rlim=%v, (%v:)", t, resource, rlim, origin(2))
+ }
if _, _, err := unix.Syscall(unix.SYS_GETRLIMIT, uintptr(resource), uintptr(rlim), 0); err != 0 {
t.setErrno(err)
return -1
@@ -608,6 +683,9 @@ func newFtsent(t *TLS, info int, path string, stat *unix.Stat_t, err syscall.Err
// DIR *opendir(const char *name);
func Xopendir(t *TLS, name uintptr) uintptr {
+ if __ccgo_strace {
+ trc("t=%v name=%v, (%v:)", t, name, origin(2))
+ }
p := Xmalloc(t, uint64(unsafe.Sizeof(darwinDir{})))
if p == 0 {
panic("OOM")
diff --git a/vendor/modernc.org/libc/libc_netbsd_arm.go b/vendor/modernc.org/libc/libc_netbsd_arm.go
index 7f10ac9c..1a4ebd2f 100644
--- a/vendor/modernc.org/libc/libc_netbsd_arm.go
+++ b/vendor/modernc.org/libc/libc_netbsd_arm.go
@@ -24,6 +24,9 @@ type (
// int sigaction(int signum, const struct sigaction *act, struct sigaction *oldact);
func Xsigaction(t *TLS, signum int32, act, oldact uintptr) int32 {
+ if __ccgo_strace {
+ trc("t=%v signum=%v oldact=%v, (%v:)", t, signum, oldact, origin(2))
+ }
panic(todo(""))
// if _, _, err := unix.Syscall(unix.SYS_SIGACTION, uintptr(signum), act, oldact); err != 0 {
// t.setErrno(err)
@@ -35,6 +38,9 @@ func Xsigaction(t *TLS, signum int32, act, oldact uintptr) int32 {
// FILE *fopen64(const char *pathname, const char *mode);
func Xfopen64(t *TLS, pathname, mode uintptr) uintptr {
+ if __ccgo_strace {
+ trc("t=%v mode=%v, (%v:)", t, mode, origin(2))
+ }
m := strings.ReplaceAll(GoString(mode), "b", "")
var flags int
switch m {
@@ -74,6 +80,9 @@ func Xfopen64(t *TLS, pathname, mode uintptr) uintptr {
// int lstat(const char *pathname, struct stat *statbuf);
func Xlstat64(t *TLS, pathname, statbuf uintptr) int32 {
+ if __ccgo_strace {
+ trc("t=%v statbuf=%v, (%v:)", t, statbuf, origin(2))
+ }
if err := unix.Lstat(GoString(pathname), (*unix.Stat_t)(unsafe.Pointer(statbuf))); err != nil {
if dmesgs {
dmesg("%v: %q: %v FAIL", origin(1), GoString(pathname), err)
@@ -90,6 +99,9 @@ func Xlstat64(t *TLS, pathname, statbuf uintptr) int32 {
// int stat(const char *pathname, struct stat *statbuf);
func Xstat64(t *TLS, pathname, statbuf uintptr) int32 {
+ if __ccgo_strace {
+ trc("t=%v statbuf=%v, (%v:)", t, statbuf, origin(2))
+ }
if err := unix.Stat(GoString(pathname), (*unix.Stat_t)(unsafe.Pointer(statbuf))); err != nil {
if dmesgs {
dmesg("%v: %q: %v FAIL", origin(1), GoString(pathname), err)
@@ -106,6 +118,9 @@ func Xstat64(t *TLS, pathname, statbuf uintptr) int32 {
// int mkdir(const char *path, mode_t mode);
func Xmkdir(t *TLS, path uintptr, mode types.Mode_t) int32 {
+ if __ccgo_strace {
+ trc("t=%v path=%v mode=%v, (%v:)", t, path, mode, origin(2))
+ }
if err := unix.Mkdir(GoString(path), uint32(mode)); err != nil {
if dmesgs {
dmesg("%v: %q: %v FAIL", origin(1), GoString(path), err)
@@ -122,6 +137,9 @@ func Xmkdir(t *TLS, path uintptr, mode types.Mode_t) int32 {
// int access(const char *pathname, int mode);
func Xaccess(t *TLS, pathname uintptr, mode int32) int32 {
+ if __ccgo_strace {
+ trc("t=%v pathname=%v mode=%v, (%v:)", t, pathname, mode, origin(2))
+ }
if err := unix.Access(GoString(pathname), uint32(mode)); err != nil {
if dmesgs {
dmesg("%v: %q %#o: %v FAIL", origin(1), GoString(pathname), mode, err)
@@ -138,6 +156,9 @@ func Xaccess(t *TLS, pathname uintptr, mode int32) int32 {
// int unlink(const char *pathname);
func Xunlink(t *TLS, pathname uintptr) int32 {
+ if __ccgo_strace {
+ trc("t=%v pathname=%v, (%v:)", t, pathname, origin(2))
+ }
if err := unix.Unlink(GoString(pathname)); err != nil {
if dmesgs {
dmesg("%v: %q: %v", origin(1), GoString(pathname), err)
@@ -154,6 +175,9 @@ func Xunlink(t *TLS, pathname uintptr) int32 {
// ssize_t readlink(const char *restrict path, char *restrict buf, size_t bufsize);
func Xreadlink(t *TLS, path, buf uintptr, bufsize types.Size_t) types.Ssize_t {
+ if __ccgo_strace {
+ trc("t=%v buf=%v bufsize=%v, (%v:)", t, buf, bufsize, origin(2))
+ }
var n int
var err error
switch {
@@ -178,6 +202,9 @@ func Xreadlink(t *TLS, path, buf uintptr, bufsize types.Size_t) types.Ssize_t {
// int symlink(const char *target, const char *linkpath);
func Xsymlink(t *TLS, target, linkpath uintptr) int32 {
+ if __ccgo_strace {
+ trc("t=%v linkpath=%v, (%v:)", t, linkpath, origin(2))
+ }
if err := unix.Symlink(GoString(target), GoString(linkpath)); err != nil {
if dmesgs {
dmesg("%v: %v FAIL", origin(1), err)
@@ -194,6 +221,9 @@ func Xsymlink(t *TLS, target, linkpath uintptr) int32 {
// int chmod(const char *pathname, mode_t mode)
func Xchmod(t *TLS, pathname uintptr, mode types.Mode_t) int32 {
+ if __ccgo_strace {
+ trc("t=%v pathname=%v mode=%v, (%v:)", t, pathname, mode, origin(2))
+ }
if err := unix.Chmod(GoString(pathname), uint32(mode)); err != nil {
if dmesgs {
dmesg("%v: %q %#o: %v FAIL", origin(1), GoString(pathname), mode, err)
@@ -210,6 +240,9 @@ func Xchmod(t *TLS, pathname uintptr, mode types.Mode_t) int32 {
// time_t time(time_t *tloc);
func Xtime(t *TLS, tloc uintptr) time.Time_t {
+ if __ccgo_strace {
+ trc("t=%v tloc=%v, (%v:)", t, tloc, origin(2))
+ }
panic(todo(""))
// n := time.Now().UTC().Unix()
// if tloc != 0 {
@@ -220,6 +253,9 @@ func Xtime(t *TLS, tloc uintptr) time.Time_t {
// int utimes(const char *filename, const struct timeval times[2]);
func Xutimes(t *TLS, filename, times uintptr) int32 {
+ if __ccgo_strace {
+ trc("t=%v times=%v, (%v:)", t, times, origin(2))
+ }
var a []unix.Timeval
if times != 0 {
a = make([]unix.Timeval, 2)
@@ -242,6 +278,9 @@ func Xutimes(t *TLS, filename, times uintptr) int32 {
// int fstat(int fd, struct stat *statbuf);
func Xfstat64(t *TLS, fd int32, statbuf uintptr) int32 {
+ if __ccgo_strace {
+ trc("t=%v fd=%v statbuf=%v, (%v:)", t, fd, statbuf, origin(2))
+ }
if err := unix.Fstat(int(fd), (*unix.Stat_t)(unsafe.Pointer(statbuf))); err != nil {
if dmesgs {
dmesg("%v: fd %d: %v FAIL", origin(1), fd, err)
@@ -258,6 +297,9 @@ func Xfstat64(t *TLS, fd int32, statbuf uintptr) int32 {
// off64_t lseek64(int fd, off64_t offset, int whence);
func Xlseek64(t *TLS, fd int32, offset types.Off_t, whence int32) types.Off_t {
+ if __ccgo_strace {
+ trc("t=%v fd=%v offset=%v whence=%v, (%v:)", t, fd, offset, whence, origin(2))
+ }
n, err := unix.Seek(int(fd), int64(offset), int(whence))
if err != nil {
if dmesgs {
@@ -274,6 +316,9 @@ func Xlseek64(t *TLS, fd int32, offset types.Off_t, whence int32) types.Off_t {
}
func Xfcntl64(t *TLS, fd, cmd int32, args uintptr) int32 {
+ if __ccgo_strace {
+ trc("t=%v cmd=%v args=%v, (%v:)", t, cmd, args, origin(2))
+ }
var arg uintptr
if args != 0 {
arg = *(*uintptr)(unsafe.Pointer(args))
@@ -295,6 +340,9 @@ func Xfcntl64(t *TLS, fd, cmd int32, args uintptr) int32 {
// int rename(const char *oldpath, const char *newpath);
func Xrename(t *TLS, oldpath, newpath uintptr) int32 {
+ if __ccgo_strace {
+ trc("t=%v newpath=%v, (%v:)", t, newpath, origin(2))
+ }
if err := unix.Rename(GoString(oldpath), GoString(newpath)); err != nil {
if dmesgs {
dmesg("%v: %v FAIL", origin(1), err)
@@ -311,6 +359,9 @@ func Xrename(t *TLS, oldpath, newpath uintptr) int32 {
// int mknod(const char *pathname, mode_t mode, dev_t dev);
func Xmknod(t *TLS, pathname uintptr, mode types.Mode_t, dev types.Dev_t) int32 {
+ if __ccgo_strace {
+ trc("t=%v pathname=%v mode=%v dev=%v, (%v:)", t, pathname, mode, dev, origin(2))
+ }
panic(todo(""))
// if _, _, err := unix.Syscall(unix.SYS_MKNOD, pathname, uintptr(mode), uintptr(dev)); err != 0 {
// t.setErrno(err)
@@ -322,6 +373,9 @@ func Xmknod(t *TLS, pathname uintptr, mode types.Mode_t, dev types.Dev_t) int32
// int utime(const char *filename, const struct utimbuf *times);
func Xutime(t *TLS, filename, times uintptr) int32 {
+ if __ccgo_strace {
+ trc("t=%v times=%v, (%v:)", t, times, origin(2))
+ }
var a []unix.Timeval
if times != 0 {
a = make([]unix.Timeval, 2)
@@ -344,6 +398,9 @@ func Xutime(t *TLS, filename, times uintptr) int32 {
// int chown(const char *pathname, uid_t owner, gid_t group);
func Xchown(t *TLS, pathname uintptr, owner types.Uid_t, group types.Gid_t) int32 {
+ if __ccgo_strace {
+ trc("t=%v pathname=%v owner=%v group=%v, (%v:)", t, pathname, owner, group, origin(2))
+ }
if _, _, err := unix.Syscall(unix.SYS_CHOWN, pathname, uintptr(owner), uintptr(group)); err != 0 {
t.setErrno(err)
return -1
@@ -354,6 +411,9 @@ func Xchown(t *TLS, pathname uintptr, owner types.Uid_t, group types.Gid_t) int3
// int link(const char *oldpath, const char *newpath);
func Xlink(t *TLS, oldpath, newpath uintptr) int32 {
+ if __ccgo_strace {
+ trc("t=%v newpath=%v, (%v:)", t, newpath, origin(2))
+ }
panic(todo(""))
// if _, _, err := unix.Syscall(unix.SYS_LINK, oldpath, newpath, 0); err != 0 {
// t.setErrno(err)
@@ -365,6 +425,9 @@ func Xlink(t *TLS, oldpath, newpath uintptr) int32 {
// int dup2(int oldfd, int newfd);
func Xdup2(t *TLS, oldfd, newfd int32) int32 {
+ if __ccgo_strace {
+ trc("t=%v newfd=%v, (%v:)", t, newfd, origin(2))
+ }
panic(todo(""))
// n, _, err := unix.Syscall(unix.SYS_DUP2, uintptr(oldfd), uintptr(newfd), 0)
// if err != 0 {
@@ -377,6 +440,9 @@ func Xdup2(t *TLS, oldfd, newfd int32) int32 {
// unsigned int alarm(unsigned int seconds);
func Xalarm(t *TLS, seconds uint32) uint32 {
+ if __ccgo_strace {
+ trc("t=%v seconds=%v, (%v:)", t, seconds, origin(2))
+ }
panic(todo(""))
// n, _, err := unix.Syscall(unix.SYS_ALARM, uintptr(seconds), 0, 0)
// if err != 0 {
@@ -387,6 +453,9 @@ func Xalarm(t *TLS, seconds uint32) uint32 {
}
func Xgetnameinfo(tls *TLS, sa1 uintptr, sl socklen_t, node uintptr, nodelen size_t, serv uintptr, servlen size_t, flags int32) int32 { /* getnameinfo.c:125:5: */
+ if __ccgo_strace {
+ trc("tls=%v sa1=%v sl=%v node=%v nodelen=%v serv=%v servlen=%v flags=%v, (%v:)", tls, sa1, sl, node, nodelen, serv, servlen, flags, origin(2))
+ }
panic(todo(""))
//TODO bp := tls.Alloc(347)
//TODO defer tls.Free(347)
@@ -486,6 +555,9 @@ func Xgetnameinfo(tls *TLS, sa1 uintptr, sl socklen_t, node uintptr, nodelen siz
}
func Xgethostbyaddr_r(tls *TLS, a uintptr, l socklen_t, af int32, h uintptr, buf uintptr, buflen size_t, res uintptr, err uintptr) int32 { /* gethostbyaddr_r.c:10:5: */
+ if __ccgo_strace {
+ trc("tls=%v a=%v l=%v af=%v h=%v buf=%v buflen=%v res=%v err=%v, (%v:)", tls, a, l, af, h, buf, buflen, res, err, origin(2))
+ }
panic(todo(""))
//TODO bp := tls.Alloc(28)
//TODO defer tls.Free(28)
@@ -573,6 +645,9 @@ func Xgethostbyaddr_r(tls *TLS, a uintptr, l socklen_t, af int32, h uintptr, buf
// int getrlimit(int resource, struct rlimit *rlim);
func Xgetrlimit64(t *TLS, resource int32, rlim uintptr) int32 {
+ if __ccgo_strace {
+ trc("t=%v resource=%v rlim=%v, (%v:)", t, resource, rlim, origin(2))
+ }
if _, _, err := unix.Syscall(unix.SYS_GETRLIMIT, uintptr(resource), uintptr(rlim), 0); err != 0 {
t.setErrno(err)
return -1
@@ -607,6 +682,9 @@ func newFtsent(t *TLS, info int, path string, stat *unix.Stat_t, err syscall.Err
// DIR *opendir(const char *name);
func Xopendir(t *TLS, name uintptr) uintptr {
+ if __ccgo_strace {
+ trc("t=%v name=%v, (%v:)", t, name, origin(2))
+ }
p := Xmalloc(t, uint32(unsafe.Sizeof(darwinDir{})))
if p == 0 {
panic("OOM")
diff --git a/vendor/modernc.org/libc/libc_openbsd.go b/vendor/modernc.org/libc/libc_openbsd.go
index 767fddfe..b9c27c99 100644
--- a/vendor/modernc.org/libc/libc_openbsd.go
+++ b/vendor/modernc.org/libc/libc_openbsd.go
@@ -79,6 +79,9 @@ var X_ThreadRuneLocale uintptr //TODO initialize and implement _Thread_local sem
// include/xlocale/_ctype.h:54:_RuneLocale *__runes_for_locale(locale_t, int*);
func X__runes_for_locale(t *TLS, l locale_t, p uintptr) uintptr {
+ if __ccgo_strace {
+ trc("t=%v l=%v p=%v, (%v:)", t, l, p, origin(2))
+ }
panic(todo(""))
}
@@ -142,23 +145,35 @@ func fwrite(fd int32, b []byte) (int, error) {
// unsigned long ___runetype(__ct_rune_t) __pure;
func X___runetype(t *TLS, x int32) ulong {
+ if __ccgo_strace {
+ trc("t=%v x=%v, (%v:)", t, x, origin(2))
+ }
panic(todo(""))
}
// int fprintf(FILE *stream, const char *format, ...);
func Xfprintf(t *TLS, stream, format, args uintptr) int32 {
+ if __ccgo_strace {
+ trc("t=%v args=%v, (%v:)", t, args, origin(2))
+ }
n, _ := fwrite(int32((*stdio.FILE)(unsafe.Pointer(stream)).F_file), printf(format, args))
return int32(n)
}
// int usleep(useconds_t usec);
func Xusleep(t *TLS, usec uint32) int32 {
+ if __ccgo_strace {
+ trc("t=%v usec=%v, (%v:)", t, usec, origin(2))
+ }
gotime.Sleep(gotime.Microsecond * gotime.Duration(usec))
return 0
}
// int getrusage(int who, struct rusage *usage);
func Xgetrusage(t *TLS, who int32, usage uintptr) int32 {
+ if __ccgo_strace {
+ trc("t=%v who=%v usage=%v, (%v:)", t, who, usage, origin(2))
+ }
if _, _, err := unix.Syscall(unix.SYS_GETRUSAGE, uintptr(who), usage, 0); err != 0 {
t.setErrno(err)
return -1
@@ -169,6 +184,9 @@ func Xgetrusage(t *TLS, who int32, usage uintptr) int32 {
// int fgetc(FILE *stream);
func Xfgetc(t *TLS, stream uintptr) int32 {
+ if __ccgo_strace {
+ trc("t=%v stream=%v, (%v:)", t, stream, origin(2))
+ }
fd := int((*stdio.FILE)(unsafe.Pointer(stream)).F_file)
var buf [1]byte
if n, _ := unix.Read(fd, buf[:]); n != 0 {
@@ -180,16 +198,25 @@ func Xfgetc(t *TLS, stream uintptr) int32 {
// int lstat(const char *pathname, struct stat *statbuf);
func Xlstat(t *TLS, pathname, statbuf uintptr) int32 {
+ if __ccgo_strace {
+ trc("t=%v statbuf=%v, (%v:)", t, statbuf, origin(2))
+ }
return Xlstat64(t, pathname, statbuf)
}
// int stat(const char *pathname, struct stat *statbuf);
func Xstat(t *TLS, pathname, statbuf uintptr) int32 {
+ if __ccgo_strace {
+ trc("t=%v statbuf=%v, (%v:)", t, statbuf, origin(2))
+ }
return Xstat64(t, pathname, statbuf)
}
// int chdir(const char *path);
func Xchdir(t *TLS, path uintptr) int32 {
+ if __ccgo_strace {
+ trc("t=%v path=%v, (%v:)", t, path, origin(2))
+ }
if _, _, err := unix.Syscall(unix.SYS_CHDIR, path, 0, 0); err != 0 {
t.setErrno(err)
return -1
@@ -239,11 +266,17 @@ func Xlocaltime_r(_ *TLS, timep, result uintptr) uintptr {
// int open(const char *pathname, int flags, ...);
func Xopen(t *TLS, pathname uintptr, flags int32, args uintptr) int32 {
+ if __ccgo_strace {
+ trc("t=%v pathname=%v flags=%v args=%v, (%v:)", t, pathname, flags, args, origin(2))
+ }
return Xopen64(t, pathname, flags, args)
}
// int open(const char *pathname, int flags, ...);
func Xopen64(t *TLS, pathname uintptr, flags int32, args uintptr) int32 {
+ if __ccgo_strace {
+ trc("t=%v pathname=%v flags=%v args=%v, (%v:)", t, pathname, flags, args, origin(2))
+ }
var mode types.Mode_t
if args != 0 {
mode = (types.Mode_t)(VaUint32(&args))
@@ -266,6 +299,9 @@ func Xopen64(t *TLS, pathname uintptr, flags int32, args uintptr) int32 {
// off_t lseek(int fd, off_t offset, int whence);
func Xlseek(t *TLS, fd int32, offset types.Off_t, whence int32) types.Off_t {
+ if __ccgo_strace {
+ trc("t=%v fd=%v offset=%v whence=%v, (%v:)", t, fd, offset, whence, origin(2))
+ }
return types.Off_t(Xlseek64(t, fd, offset, whence))
}
@@ -277,6 +313,9 @@ var fsyncStatbuf stat.Stat
// int fsync(int fd);
func Xfsync(t *TLS, fd int32) int32 {
+ if __ccgo_strace {
+ trc("t=%v fd=%v, (%v:)", t, fd, origin(2))
+ }
if noFsync {
// Simulate -DSQLITE_NO_SYNC for sqlite3 testfixture, see function full_sync in sqlite3.c
return Xfstat(t, fd, uintptr(unsafe.Pointer(&fsyncStatbuf)))
@@ -295,6 +334,9 @@ func Xfsync(t *TLS, fd int32) int32 {
// long sysconf(int name);
func Xsysconf(t *TLS, name int32) long {
+ if __ccgo_strace {
+ trc("t=%v name=%v, (%v:)", t, name, origin(2))
+ }
switch name {
case unistd.X_SC_PAGESIZE:
return long(unix.Getpagesize())
@@ -311,6 +353,9 @@ func Xsysconf(t *TLS, name int32) long {
// int close(int fd);
func Xclose(t *TLS, fd int32) int32 {
+ if __ccgo_strace {
+ trc("t=%v fd=%v, (%v:)", t, fd, origin(2))
+ }
if _, _, err := unix.Syscall(unix.SYS_CLOSE, uintptr(fd), 0, 0); err != 0 {
t.setErrno(err)
return -1
@@ -324,6 +369,9 @@ func Xclose(t *TLS, fd int32) int32 {
// char *getcwd(char *buf, size_t size);
func Xgetcwd(t *TLS, buf uintptr, size types.Size_t) uintptr {
+ if __ccgo_strace {
+ trc("t=%v buf=%v size=%v, (%v:)", t, buf, size, origin(2))
+ }
if _, err := unix.Getcwd((*RawMem)(unsafe.Pointer(buf))[:size:size]); err != nil {
if dmesgs {
dmesg("%v: %v FAIL", origin(1), err)
@@ -340,11 +388,17 @@ func Xgetcwd(t *TLS, buf uintptr, size types.Size_t) uintptr {
// int fstat(int fd, struct stat *statbuf);
func Xfstat(t *TLS, fd int32, statbuf uintptr) int32 {
+ if __ccgo_strace {
+ trc("t=%v fd=%v statbuf=%v, (%v:)", t, fd, statbuf, origin(2))
+ }
return Xfstat64(t, fd, statbuf)
}
// int ftruncate(int fd, off_t length);
func Xftruncate(t *TLS, fd int32, length types.Off_t) int32 {
+ if __ccgo_strace {
+ trc("t=%v fd=%v length=%v, (%v:)", t, fd, length, origin(2))
+ }
if err := unix.Ftruncate(int(fd), int64(length)); err != nil {
if dmesgs {
dmesg("%v: fd %d: %v FAIL", origin(1), fd, err)
@@ -361,11 +415,17 @@ func Xftruncate(t *TLS, fd int32, length types.Off_t) int32 {
// int fcntl(int fd, int cmd, ... /* arg */ );
func Xfcntl(t *TLS, fd, cmd int32, args uintptr) int32 {
+ if __ccgo_strace {
+ trc("t=%v cmd=%v args=%v, (%v:)", t, cmd, args, origin(2))
+ }
return Xfcntl64(t, fd, cmd, args)
}
// ssize_t read(int fd, void *buf, size_t count);
func Xread(t *TLS, fd int32, buf uintptr, count types.Size_t) types.Ssize_t {
+ if __ccgo_strace {
+ trc("t=%v fd=%v buf=%v count=%v, (%v:)", t, fd, buf, count, origin(2))
+ }
n, _, err := unix.Syscall(unix.SYS_READ, uintptr(fd), buf, uintptr(count))
if err != 0 {
t.setErrno(err)
@@ -381,6 +441,9 @@ func Xread(t *TLS, fd int32, buf uintptr, count types.Size_t) types.Ssize_t {
// ssize_t write(int fd, const void *buf, size_t count);
func Xwrite(t *TLS, fd int32, buf uintptr, count types.Size_t) types.Ssize_t {
+ if __ccgo_strace {
+ trc("t=%v fd=%v buf=%v count=%v, (%v:)", t, fd, buf, count, origin(2))
+ }
const retry = 5
var err syscall.Errno
for i := 0; i < retry; i++ {
@@ -406,6 +469,9 @@ func Xwrite(t *TLS, fd int32, buf uintptr, count types.Size_t) types.Ssize_t {
// int fchmod(int fd, mode_t mode);
func Xfchmod(t *TLS, fd int32, mode types.Mode_t) int32 {
+ if __ccgo_strace {
+ trc("t=%v fd=%v mode=%v, (%v:)", t, fd, mode, origin(2))
+ }
if _, _, err := unix.Syscall(unix.SYS_FCHMOD, uintptr(fd), uintptr(mode), 0); err != 0 {
t.setErrno(err)
return -1
@@ -419,6 +485,9 @@ func Xfchmod(t *TLS, fd int32, mode types.Mode_t) int32 {
// int fchown(int fd, uid_t owner, gid_t group);
func Xfchown(t *TLS, fd int32, owner types.Uid_t, group types.Gid_t) int32 {
+ if __ccgo_strace {
+ trc("t=%v fd=%v owner=%v group=%v, (%v:)", t, fd, owner, group, origin(2))
+ }
if _, _, err := unix.Syscall(unix.SYS_FCHOWN, uintptr(fd), uintptr(owner), uintptr(group)); err != 0 {
t.setErrno(err)
return -1
@@ -429,12 +498,18 @@ func Xfchown(t *TLS, fd int32, owner types.Uid_t, group types.Gid_t) int32 {
// uid_t geteuid(void);
func Xgeteuid(t *TLS) types.Uid_t {
+ if __ccgo_strace {
+ trc("t=%v, (%v:)", t, origin(2))
+ }
n, _, _ := unix.Syscall(unix.SYS_GETEUID, 0, 0, 0)
return types.Uid_t(n)
}
// int munmap(void *addr, size_t length);
func Xmunmap(t *TLS, addr uintptr, length types.Size_t) int32 {
+ if __ccgo_strace {
+ trc("t=%v addr=%v length=%v, (%v:)", t, addr, length, origin(2))
+ }
if _, _, err := unix.Syscall(unix.SYS_MUNMAP, addr, uintptr(length), 0); err != 0 {
t.setErrno(err)
return -1
@@ -445,6 +520,9 @@ func Xmunmap(t *TLS, addr uintptr, length types.Size_t) int32 {
// int gettimeofday(struct timeval *tv, struct timezone *tz);
func Xgettimeofday(t *TLS, tv, tz uintptr) int32 {
+ if __ccgo_strace {
+ trc("t=%v tz=%v, (%v:)", t, tz, origin(2))
+ }
if tz != 0 {
panic(todo(""))
}
@@ -462,6 +540,9 @@ func Xgettimeofday(t *TLS, tv, tz uintptr) int32 {
// int getsockopt(int sockfd, int level, int optname, void *optval, socklen_t *optlen);
func Xgetsockopt(t *TLS, sockfd, level, optname int32, optval, optlen uintptr) int32 {
+ if __ccgo_strace {
+ trc("t=%v optname=%v optlen=%v, (%v:)", t, optname, optlen, origin(2))
+ }
if _, _, err := unix.Syscall6(unix.SYS_GETSOCKOPT, uintptr(sockfd), uintptr(level), uintptr(optname), optval, optlen, 0); err != 0 {
t.setErrno(err)
return -1
@@ -472,6 +553,9 @@ func Xgetsockopt(t *TLS, sockfd, level, optname int32, optval, optlen uintptr) i
// int setsockopt(int sockfd, int level, int optname, const void *optval, socklen_t optlen);
func Xsetsockopt(t *TLS, sockfd, level, optname int32, optval uintptr, optlen socket.Socklen_t) int32 {
+ if __ccgo_strace {
+ trc("t=%v optname=%v optval=%v optlen=%v, (%v:)", t, optname, optval, optlen, origin(2))
+ }
if _, _, err := unix.Syscall6(unix.SYS_SETSOCKOPT, uintptr(sockfd), uintptr(level), uintptr(optname), optval, uintptr(optlen), 0); err != 0 {
t.setErrno(err)
return -1
@@ -482,6 +566,9 @@ func Xsetsockopt(t *TLS, sockfd, level, optname int32, optval uintptr, optlen so
// int ioctl(int fd, unsigned long request, ...);
func Xioctl(t *TLS, fd int32, request ulong, va uintptr) int32 {
+ if __ccgo_strace {
+ trc("t=%v fd=%v request=%v va=%v, (%v:)", t, fd, request, va, origin(2))
+ }
var argp uintptr
if va != 0 {
argp = VaUintptr(&va)
@@ -497,6 +584,9 @@ func Xioctl(t *TLS, fd int32, request ulong, va uintptr) int32 {
// int getsockname(int sockfd, struct sockaddr *addr, socklen_t *addrlen);
func Xgetsockname(t *TLS, sockfd int32, addr, addrlen uintptr) int32 {
+ if __ccgo_strace {
+ trc("t=%v sockfd=%v addrlen=%v, (%v:)", t, sockfd, addrlen, origin(2))
+ }
if _, _, err := unix.Syscall(unix.SYS_GETSOCKNAME, uintptr(sockfd), addr, addrlen); err != 0 {
// if dmesgs {
// dmesg("%v: fd %v: %v", origin(1), sockfd, err)
@@ -510,6 +600,9 @@ func Xgetsockname(t *TLS, sockfd int32, addr, addrlen uintptr) int32 {
// int select(int nfds, fd_set *readfds, fd_set *writefds, fd_set *exceptfds, struct timeval *timeout);
func Xselect(t *TLS, nfds int32, readfds, writefds, exceptfds, timeout uintptr) int32 {
+ if __ccgo_strace {
+ trc("t=%v nfds=%v timeout=%v, (%v:)", t, nfds, timeout, origin(2))
+ }
n, err := unix.Select(
int(nfds),
(*unix.FdSet)(unsafe.Pointer(readfds)),
@@ -527,17 +620,26 @@ func Xselect(t *TLS, nfds int32, readfds, writefds, exceptfds, timeout uintptr)
// int mkfifo(const char *pathname, mode_t mode);
func Xmkfifo(t *TLS, pathname uintptr, mode types.Mode_t) int32 {
+ if __ccgo_strace {
+ trc("t=%v pathname=%v mode=%v, (%v:)", t, pathname, mode, origin(2))
+ }
panic(todo(""))
}
// mode_t umask(mode_t mask);
func Xumask(t *TLS, mask types.Mode_t) types.Mode_t {
+ if __ccgo_strace {
+ trc("t=%v mask=%v, (%v:)", t, mask, origin(2))
+ }
n, _, _ := unix.Syscall(unix.SYS_UMASK, uintptr(mask), 0, 0)
return types.Mode_t(n)
}
// int execvp(const char *file, char *const argv[]);
func Xexecvp(t *TLS, file, argv uintptr) int32 {
+ if __ccgo_strace {
+ trc("t=%v argv=%v, (%v:)", t, argv, origin(2))
+ }
if _, _, err := unix.Syscall(unix.SYS_EXECVE, file, argv, Environ()); err != 0 {
t.setErrno(err)
return -1
@@ -548,6 +650,9 @@ func Xexecvp(t *TLS, file, argv uintptr) int32 {
// pid_t waitpid(pid_t pid, int *wstatus, int options);
func Xwaitpid(t *TLS, pid types.Pid_t, wstatus uintptr, optname int32) types.Pid_t {
+ if __ccgo_strace {
+ trc("t=%v pid=%v wstatus=%v optname=%v, (%v:)", t, pid, wstatus, optname, origin(2))
+ }
n, _, err := unix.Syscall6(unix.SYS_WAIT4, uintptr(pid), wstatus, uintptr(optname), 0, 0, 0)
if err != 0 {
t.setErrno(err)
@@ -559,6 +664,9 @@ func Xwaitpid(t *TLS, pid types.Pid_t, wstatus uintptr, optname int32) types.Pid
// int uname(struct utsname *buf);
func Xuname(t *TLS, buf uintptr) int32 {
+ if __ccgo_strace {
+ trc("t=%v buf=%v, (%v:)", t, buf, origin(2))
+ }
if err := unix.Uname((*unix.Utsname)(unsafe.Pointer(buf))); err != nil {
if dmesgs {
dmesg("%v: %v FAIL", origin(1), err)
@@ -575,6 +683,9 @@ func Xuname(t *TLS, buf uintptr) int32 {
// ssize_t recv(int sockfd, void *buf, size_t len, int flags);
func Xrecv(t *TLS, sockfd int32, buf uintptr, len types.Size_t, flags int32) types.Ssize_t {
+ if __ccgo_strace {
+ trc("t=%v sockfd=%v buf=%v len=%v flags=%v, (%v:)", t, sockfd, buf, len, flags, origin(2))
+ }
n, _, err := unix.Syscall6(unix.SYS_RECVFROM, uintptr(sockfd), buf, uintptr(len), uintptr(flags), 0, 0)
if err != 0 {
t.setErrno(err)
@@ -586,6 +697,9 @@ func Xrecv(t *TLS, sockfd int32, buf uintptr, len types.Size_t, flags int32) typ
// ssize_t send(int sockfd, const void *buf, size_t len, int flags);
func Xsend(t *TLS, sockfd int32, buf uintptr, len types.Size_t, flags int32) types.Ssize_t {
+ if __ccgo_strace {
+ trc("t=%v sockfd=%v buf=%v len=%v flags=%v, (%v:)", t, sockfd, buf, len, flags, origin(2))
+ }
n, _, err := unix.Syscall6(unix.SYS_SENDTO, uintptr(sockfd), buf, uintptr(len), uintptr(flags), 0, 0)
if err != 0 {
t.setErrno(err)
@@ -597,6 +711,9 @@ func Xsend(t *TLS, sockfd int32, buf uintptr, len types.Size_t, flags int32) typ
// int shutdown(int sockfd, int how);
func Xshutdown(t *TLS, sockfd, how int32) int32 {
+ if __ccgo_strace {
+ trc("t=%v how=%v, (%v:)", t, how, origin(2))
+ }
if _, _, err := unix.Syscall(unix.SYS_SHUTDOWN, uintptr(sockfd), uintptr(how), 0); err != 0 {
t.setErrno(err)
return -1
@@ -607,6 +724,9 @@ func Xshutdown(t *TLS, sockfd, how int32) int32 {
// int getpeername(int sockfd, struct sockaddr *addr, socklen_t *addrlen);
func Xgetpeername(t *TLS, sockfd int32, addr uintptr, addrlen uintptr) int32 {
+ if __ccgo_strace {
+ trc("t=%v sockfd=%v addr=%v addrlen=%v, (%v:)", t, sockfd, addr, addrlen, origin(2))
+ }
if _, _, err := unix.Syscall(unix.SYS_GETPEERNAME, uintptr(sockfd), addr, uintptr(addrlen)); err != 0 {
t.setErrno(err)
return -1
@@ -617,6 +737,9 @@ func Xgetpeername(t *TLS, sockfd int32, addr uintptr, addrlen uintptr) int32 {
// int socket(int domain, int type, int protocol);
func Xsocket(t *TLS, domain, type1, protocol int32) int32 {
+ if __ccgo_strace {
+ trc("t=%v protocol=%v, (%v:)", t, protocol, origin(2))
+ }
n, _, err := unix.Syscall(unix.SYS_SOCKET, uintptr(domain), uintptr(type1), uintptr(protocol))
if err != 0 {
t.setErrno(err)
@@ -628,6 +751,9 @@ func Xsocket(t *TLS, domain, type1, protocol int32) int32 {
// int bind(int sockfd, const struct sockaddr *addr, socklen_t addrlen);
func Xbind(t *TLS, sockfd int32, addr uintptr, addrlen uint32) int32 {
+ if __ccgo_strace {
+ trc("t=%v sockfd=%v addr=%v addrlen=%v, (%v:)", t, sockfd, addr, addrlen, origin(2))
+ }
n, _, err := unix.Syscall(unix.SYS_BIND, uintptr(sockfd), addr, uintptr(addrlen))
if err != 0 {
t.setErrno(err)
@@ -639,6 +765,9 @@ func Xbind(t *TLS, sockfd int32, addr uintptr, addrlen uint32) int32 {
// int connect(int sockfd, const struct sockaddr *addr, socklen_t addrlen);
func Xconnect(t *TLS, sockfd int32, addr uintptr, addrlen uint32) int32 {
+ if __ccgo_strace {
+ trc("t=%v sockfd=%v addr=%v addrlen=%v, (%v:)", t, sockfd, addr, addrlen, origin(2))
+ }
if _, _, err := unix.Syscall(unix.SYS_CONNECT, uintptr(sockfd), addr, uintptr(addrlen)); err != 0 {
t.setErrno(err)
return -1
@@ -649,6 +778,9 @@ func Xconnect(t *TLS, sockfd int32, addr uintptr, addrlen uint32) int32 {
// int listen(int sockfd, int backlog);
func Xlisten(t *TLS, sockfd, backlog int32) int32 {
+ if __ccgo_strace {
+ trc("t=%v backlog=%v, (%v:)", t, backlog, origin(2))
+ }
if _, _, err := unix.Syscall(unix.SYS_LISTEN, uintptr(sockfd), uintptr(backlog), 0); err != 0 {
t.setErrno(err)
return -1
@@ -659,6 +791,9 @@ func Xlisten(t *TLS, sockfd, backlog int32) int32 {
// int accept(int sockfd, struct sockaddr *addr, socklen_t *addrlen);
func Xaccept(t *TLS, sockfd int32, addr uintptr, addrlen uintptr) int32 {
+ if __ccgo_strace {
+ trc("t=%v sockfd=%v addr=%v addrlen=%v, (%v:)", t, sockfd, addr, addrlen, origin(2))
+ }
panic(todo(""))
// n, _, err := unix.Syscall6(unix.SYS_ACCEPT4, uintptr(sockfd), addr, uintptr(addrlen), 0, 0, 0)
// if err != 0 {
@@ -671,16 +806,25 @@ func Xaccept(t *TLS, sockfd int32, addr uintptr, addrlen uintptr) int32 {
// int getrlimit(int resource, struct rlimit *rlim);
func Xgetrlimit(t *TLS, resource int32, rlim uintptr) int32 {
+ if __ccgo_strace {
+ trc("t=%v resource=%v rlim=%v, (%v:)", t, resource, rlim, origin(2))
+ }
return Xgetrlimit64(t, resource, rlim)
}
// int setrlimit(int resource, const struct rlimit *rlim);
func Xsetrlimit(t *TLS, resource int32, rlim uintptr) int32 {
+ if __ccgo_strace {
+ trc("t=%v resource=%v rlim=%v, (%v:)", t, resource, rlim, origin(2))
+ }
return Xsetrlimit64(t, resource, rlim)
}
// int setrlimit(int resource, const struct rlimit *rlim);
func Xsetrlimit64(t *TLS, resource int32, rlim uintptr) int32 {
+ if __ccgo_strace {
+ trc("t=%v resource=%v rlim=%v, (%v:)", t, resource, rlim, origin(2))
+ }
if _, _, err := unix.Syscall(unix.SYS_SETRLIMIT, uintptr(resource), uintptr(rlim), 0); err != 0 {
t.setErrno(err)
return -1
@@ -691,16 +835,25 @@ func Xsetrlimit64(t *TLS, resource int32, rlim uintptr) int32 {
// uid_t getuid(void);
func Xgetuid(t *TLS) types.Uid_t {
+ if __ccgo_strace {
+ trc("t=%v, (%v:)", t, origin(2))
+ }
return types.Uid_t(os.Getuid())
}
// pid_t getpid(void);
func Xgetpid(t *TLS) int32 {
+ if __ccgo_strace {
+ trc("t=%v, (%v:)", t, origin(2))
+ }
return int32(os.Getpid())
}
// int system(const char *command);
func Xsystem(t *TLS, command uintptr) int32 {
+ if __ccgo_strace {
+ trc("t=%v command=%v, (%v:)", t, command, origin(2))
+ }
s := GoString(command)
if command == 0 {
panic(todo(""))
@@ -720,26 +873,41 @@ func Xsystem(t *TLS, command uintptr) int32 {
// int setvbuf(FILE *stream, char *buf, int mode, size_t size);
func Xsetvbuf(t *TLS, stream, buf uintptr, mode int32, size types.Size_t) int32 {
+ if __ccgo_strace {
+ trc("t=%v buf=%v mode=%v size=%v, (%v:)", t, buf, mode, size, origin(2))
+ }
return 0 //TODO
}
// int raise(int sig);
func Xraise(t *TLS, sig int32) int32 {
+ if __ccgo_strace {
+ trc("t=%v sig=%v, (%v:)", t, sig, origin(2))
+ }
panic(todo(""))
}
// int backtrace(void **buffer, int size);
func Xbacktrace(t *TLS, buf uintptr, size int32) int32 {
+ if __ccgo_strace {
+ trc("t=%v buf=%v size=%v, (%v:)", t, buf, size, origin(2))
+ }
panic(todo(""))
}
// void backtrace_symbols_fd(void *const *buffer, int size, int fd);
func Xbacktrace_symbols_fd(t *TLS, buffer uintptr, size, fd int32) {
+ if __ccgo_strace {
+ trc("t=%v buffer=%v fd=%v, (%v:)", t, buffer, fd, origin(2))
+ }
panic(todo(""))
}
// int fileno(FILE *stream);
func Xfileno(t *TLS, stream uintptr) int32 {
+ if __ccgo_strace {
+ trc("t=%v stream=%v, (%v:)", t, stream, origin(2))
+ }
panic(todo(""))
}
@@ -773,11 +941,17 @@ func (f *ftstream) close(t *TLS) {
// FTS *fts_open(char * const *path_argv, int options, int (*compar)(const FTSENT **, const FTSENT **));
func Xfts_open(t *TLS, path_argv uintptr, options int32, compar uintptr) uintptr {
+ if __ccgo_strace {
+ trc("t=%v path_argv=%v options=%v compar=%v, (%v:)", t, path_argv, options, compar, origin(2))
+ }
return Xfts64_open(t, path_argv, options, compar)
}
// FTS *fts_open(char * const *path_argv, int options, int (*compar)(const FTSENT **, const FTSENT **));
func Xfts64_open(t *TLS, path_argv uintptr, options int32, compar uintptr) uintptr {
+ if __ccgo_strace {
+ trc("t=%v path_argv=%v options=%v compar=%v, (%v:)", t, path_argv, options, compar, origin(2))
+ }
f := &ftstream{}
var walk func(string)
@@ -882,11 +1056,17 @@ func Xfts64_open(t *TLS, path_argv uintptr, options int32, compar uintptr) uintp
// FTSENT *fts_read(FTS *ftsp);
func Xfts_read(t *TLS, ftsp uintptr) uintptr {
+ if __ccgo_strace {
+ trc("t=%v ftsp=%v, (%v:)", t, ftsp, origin(2))
+ }
return Xfts64_read(t, ftsp)
}
// FTSENT *fts_read(FTS *ftsp);
func Xfts64_read(t *TLS, ftsp uintptr) uintptr {
+ if __ccgo_strace {
+ trc("t=%v ftsp=%v, (%v:)", t, ftsp, origin(2))
+ }
f := getObject(ftsp).(*ftstream)
if f.x == len(f.s) {
t.setErrno(0)
@@ -903,11 +1083,17 @@ func Xfts64_read(t *TLS, ftsp uintptr) uintptr {
// int fts_close(FTS *ftsp);
func Xfts_close(t *TLS, ftsp uintptr) int32 {
+ if __ccgo_strace {
+ trc("t=%v ftsp=%v, (%v:)", t, ftsp, origin(2))
+ }
return Xfts64_close(t, ftsp)
}
// int fts_close(FTS *ftsp);
func Xfts64_close(t *TLS, ftsp uintptr) int32 {
+ if __ccgo_strace {
+ trc("t=%v ftsp=%v, (%v:)", t, ftsp, origin(2))
+ }
getObject(ftsp).(*ftstream).close(t)
removeObject(ftsp)
return 0
@@ -915,6 +1101,9 @@ func Xfts64_close(t *TLS, ftsp uintptr) int32 {
// void tzset (void);
func Xtzset(t *TLS) {
+ if __ccgo_strace {
+ trc("t=%v, (%v:)", t, origin(2))
+ }
//TODO
}
@@ -922,6 +1111,9 @@ var strerrorBuf [100]byte
// char *strerror(int errnum);
func Xstrerror(t *TLS, errnum int32) uintptr {
+ if __ccgo_strace {
+ trc("t=%v errnum=%v, (%v:)", t, errnum, origin(2))
+ }
if dmesgs {
dmesg("%v: %v\n%s", origin(1), errnum, debug.Stack())
}
@@ -931,31 +1123,49 @@ func Xstrerror(t *TLS, errnum int32) uintptr {
// void *dlopen(const char *filename, int flags);
func Xdlopen(t *TLS, filename uintptr, flags int32) uintptr {
+ if __ccgo_strace {
+ trc("t=%v filename=%v flags=%v, (%v:)", t, filename, flags, origin(2))
+ }
panic(todo(""))
}
// char *dlerror(void);
func Xdlerror(t *TLS) uintptr {
+ if __ccgo_strace {
+ trc("t=%v, (%v:)", t, origin(2))
+ }
panic(todo(""))
}
// int dlclose(void *handle);
func Xdlclose(t *TLS, handle uintptr) int32 {
+ if __ccgo_strace {
+ trc("t=%v handle=%v, (%v:)", t, handle, origin(2))
+ }
panic(todo(""))
}
// void *dlsym(void *handle, const char *symbol);
func Xdlsym(t *TLS, handle, symbol uintptr) uintptr {
+ if __ccgo_strace {
+ trc("t=%v symbol=%v, (%v:)", t, symbol, origin(2))
+ }
panic(todo(""))
}
// void perror(const char *s);
func Xperror(t *TLS, s uintptr) {
+ if __ccgo_strace {
+ trc("t=%v s=%v, (%v:)", t, s, origin(2))
+ }
panic(todo(""))
}
// int pclose(FILE *stream);
func Xpclose(t *TLS, stream uintptr) int32 {
+ if __ccgo_strace {
+ trc("t=%v stream=%v, (%v:)", t, stream, origin(2))
+ }
panic(todo(""))
}
@@ -963,37 +1173,58 @@ var gai_strerrorBuf [100]byte
// const char *gai_strerror(int errcode);
func Xgai_strerror(t *TLS, errcode int32) uintptr {
+ if __ccgo_strace {
+ trc("t=%v errcode=%v, (%v:)", t, errcode, origin(2))
+ }
copy(gai_strerrorBuf[:], fmt.Sprintf("gai error %d\x00", errcode))
return uintptr(unsafe.Pointer(&gai_strerrorBuf))
}
// int tcgetattr(int fd, struct termios *termios_p);
func Xtcgetattr(t *TLS, fd int32, termios_p uintptr) int32 {
+ if __ccgo_strace {
+ trc("t=%v fd=%v termios_p=%v, (%v:)", t, fd, termios_p, origin(2))
+ }
panic(todo(""))
}
// int tcsetattr(int fd, int optional_actions, const struct termios *termios_p);
func Xtcsetattr(t *TLS, fd, optional_actions int32, termios_p uintptr) int32 {
+ if __ccgo_strace {
+ trc("t=%v optional_actions=%v termios_p=%v, (%v:)", t, optional_actions, termios_p, origin(2))
+ }
panic(todo(""))
}
// speed_t cfgetospeed(const struct termios *termios_p);
func Xcfgetospeed(t *TLS, termios_p uintptr) termios.Speed_t {
+ if __ccgo_strace {
+ trc("t=%v termios_p=%v, (%v:)", t, termios_p, origin(2))
+ }
panic(todo(""))
}
// int cfsetospeed(struct termios *termios_p, speed_t speed);
func Xcfsetospeed(t *TLS, termios_p uintptr, speed uint32) int32 {
+ if __ccgo_strace {
+ trc("t=%v termios_p=%v speed=%v, (%v:)", t, termios_p, speed, origin(2))
+ }
panic(todo(""))
}
// int cfsetispeed(struct termios *termios_p, speed_t speed);
func Xcfsetispeed(t *TLS, termios_p uintptr, speed uint32) int32 {
+ if __ccgo_strace {
+ trc("t=%v termios_p=%v speed=%v, (%v:)", t, termios_p, speed, origin(2))
+ }
panic(todo(""))
}
// pid_t fork(void);
func Xfork(t *TLS) int32 {
+ if __ccgo_strace {
+ trc("t=%v, (%v:)", t, origin(2))
+ }
t.setErrno(errno.ENOSYS)
return -1
}
@@ -1002,21 +1233,33 @@ var emptyStr = [1]byte{}
// char *setlocale(int category, const char *locale);
func Xsetlocale(t *TLS, category int32, locale uintptr) uintptr {
+ if __ccgo_strace {
+ trc("t=%v category=%v locale=%v, (%v:)", t, category, locale, origin(2))
+ }
return uintptr(unsafe.Pointer(&emptyStr)) //TODO
}
// char *nl_langinfo(nl_item item);
func Xnl_langinfo(t *TLS, item langinfo.Nl_item) uintptr {
+ if __ccgo_strace {
+ trc("t=%v item=%v, (%v:)", t, item, origin(2))
+ }
return uintptr(unsafe.Pointer(&emptyStr)) //TODO
}
// FILE *popen(const char *command, const char *type);
func Xpopen(t *TLS, command, type1 uintptr) uintptr {
+ if __ccgo_strace {
+ trc("t=%v type1=%v, (%v:)", t, type1, origin(2))
+ }
panic(todo(""))
}
// char *realpath(const char *path, char *resolved_path);
func Xrealpath(t *TLS, path, resolved_path uintptr) uintptr {
+ if __ccgo_strace {
+ trc("t=%v resolved_path=%v, (%v:)", t, resolved_path, origin(2))
+ }
s, err := filepath.EvalSymlinks(GoString(path))
if err != nil {
if os.IsNotExist(err) {
@@ -1045,19 +1288,31 @@ func Xrealpath(t *TLS, path, resolved_path uintptr) uintptr {
// struct tm *gmtime_r(const time_t *timep, struct tm *result);
func Xgmtime_r(t *TLS, timep, result uintptr) uintptr {
+ if __ccgo_strace {
+ trc("t=%v result=%v, (%v:)", t, result, origin(2))
+ }
panic(todo(""))
}
// char *inet_ntoa(struct in_addr in);
func Xinet_ntoa(t *TLS, in1 in.In_addr) uintptr {
+ if __ccgo_strace {
+ trc("t=%v in1=%v, (%v:)", t, in1, origin(2))
+ }
panic(todo(""))
}
func X__ccgo_in6addr_anyp(t *TLS) uintptr {
+ if __ccgo_strace {
+ trc("t=%v, (%v:)", t, origin(2))
+ }
return uintptr(unsafe.Pointer(&in6_addr_any))
}
func Xabort(t *TLS) {
+ if __ccgo_strace {
+ trc("t=%v, (%v:)", t, origin(2))
+ }
panic(todo("")) //TODO
// if dmesgs {
// dmesg("%v:", origin(1))
@@ -1076,11 +1331,17 @@ func Xabort(t *TLS) {
// int fflush(FILE *stream);
func Xfflush(t *TLS, stream uintptr) int32 {
+ if __ccgo_strace {
+ trc("t=%v stream=%v, (%v:)", t, stream, origin(2))
+ }
return 0 //TODO
}
// size_t fread(void *ptr, size_t size, size_t nmemb, FILE *stream);
func Xfread(t *TLS, ptr uintptr, size, nmemb types.Size_t, stream uintptr) types.Size_t {
+ if __ccgo_strace {
+ trc("t=%v ptr=%v nmemb=%v stream=%v, (%v:)", t, ptr, nmemb, stream, origin(2))
+ }
m, _, err := unix.Syscall(unix.SYS_READ, uintptr(file(stream).fd()), ptr, uintptr(size*nmemb))
if err != 0 {
file(stream).setErr()
@@ -1096,6 +1357,9 @@ func Xfread(t *TLS, ptr uintptr, size, nmemb types.Size_t, stream uintptr) types
// size_t fwrite(const void *ptr, size_t size, size_t nmemb, FILE *stream);
func Xfwrite(t *TLS, ptr uintptr, size, nmemb types.Size_t, stream uintptr) types.Size_t {
+ if __ccgo_strace {
+ trc("t=%v ptr=%v nmemb=%v stream=%v, (%v:)", t, ptr, nmemb, stream, origin(2))
+ }
m, _, err := unix.Syscall(unix.SYS_WRITE, uintptr(file(stream).fd()), ptr, uintptr(size*nmemb))
if err != 0 {
file(stream).setErr()
@@ -1111,11 +1375,17 @@ func Xfwrite(t *TLS, ptr uintptr, size, nmemb types.Size_t, stream uintptr) type
// int fclose(FILE *stream);
func Xfclose(t *TLS, stream uintptr) int32 {
+ if __ccgo_strace {
+ trc("t=%v stream=%v, (%v:)", t, stream, origin(2))
+ }
return file(stream).close(t)
}
// int fputc(int c, FILE *stream);
func Xfputc(t *TLS, c int32, stream uintptr) int32 {
+ if __ccgo_strace {
+ trc("t=%v c=%v stream=%v, (%v:)", t, c, stream, origin(2))
+ }
if _, err := fwrite(file(stream).fd(), []byte{byte(c)}); err != nil {
return stdio.EOF
}
@@ -1125,6 +1395,9 @@ func Xfputc(t *TLS, c int32, stream uintptr) int32 {
// int fseek(FILE *stream, long offset, int whence);
func Xfseek(t *TLS, stream uintptr, offset long, whence int32) int32 {
+ if __ccgo_strace {
+ trc("t=%v stream=%v offset=%v whence=%v, (%v:)", t, stream, offset, whence, origin(2))
+ }
if n := Xlseek(t, int32(file(stream).fd()), types.Off_t(offset), whence); n < 0 {
// if dmesgs {
// dmesg("%v: fd %v, off %#x, whence %v: %v", origin(1), file(stream).fd(), offset, whenceStr(whence), n)
@@ -1141,6 +1414,9 @@ func Xfseek(t *TLS, stream uintptr, offset long, whence int32) int32 {
// long ftell(FILE *stream);
func Xftell(t *TLS, stream uintptr) long {
+ if __ccgo_strace {
+ trc("t=%v stream=%v, (%v:)", t, stream, origin(2))
+ }
n := Xlseek(t, file(stream).fd(), 0, stdio.SEEK_CUR)
if n < 0 {
file(stream).setErr()
@@ -1155,21 +1431,33 @@ func Xftell(t *TLS, stream uintptr) long {
// int ferror(FILE *stream);
func Xferror(t *TLS, stream uintptr) int32 {
+ if __ccgo_strace {
+ trc("t=%v stream=%v, (%v:)", t, stream, origin(2))
+ }
return Bool32(file(stream).err())
}
// int ungetc(int c, FILE *stream);
func Xungetc(t *TLS, c int32, stream uintptr) int32 {
+ if __ccgo_strace {
+ trc("t=%v c=%v stream=%v, (%v:)", t, c, stream, origin(2))
+ }
panic(todo(""))
}
// int fscanf(FILE *stream, const char *format, ...);
func Xfscanf(t *TLS, stream, format, va uintptr) int32 {
+ if __ccgo_strace {
+ trc("t=%v va=%v, (%v:)", t, va, origin(2))
+ }
panic(todo(""))
}
// int fputs(const char *s, FILE *stream);
func Xfputs(t *TLS, s, stream uintptr) int32 {
+ if __ccgo_strace {
+ trc("t=%v stream=%v, (%v:)", t, stream, origin(2))
+ }
if _, _, err := unix.Syscall(unix.SYS_WRITE, uintptr(file(stream).fd()), s, uintptr(Xstrlen(t, s))); err != 0 {
return -1
}
@@ -1181,6 +1469,9 @@ var getservbynameStaticResult netdb.Servent
// struct servent *getservbyname(const char *name, const char *proto);
func Xgetservbyname(t *TLS, name, proto uintptr) uintptr {
+ if __ccgo_strace {
+ trc("t=%v proto=%v, (%v:)", t, proto, origin(2))
+ }
var protoent *gonetdb.Protoent
if proto != 0 {
protoent = gonetdb.GetProtoByName(GoString(proto))
@@ -1258,6 +1549,9 @@ func Xgetservbyname(t *TLS, name, proto uintptr) uintptr {
}
func Xreaddir64(t *TLS, dir uintptr) uintptr {
+ if __ccgo_strace {
+ trc("t=%v dir=%v, (%v:)", t, dir, origin(2))
+ }
return Xreaddir(t, dir)
}
@@ -1270,14 +1564,23 @@ func __syscall(r, _ uintptr, errno syscall.Errno) long {
}
func X__syscall1(t *TLS, trap, p1 long) long {
+ if __ccgo_strace {
+ trc("t=%v p1=%v, (%v:)", t, p1, origin(2))
+ }
return __syscall(unix.Syscall(uintptr(trap), uintptr(p1), 0, 0))
}
func X__syscall3(t *TLS, trap, p1, p2, p3 long) long {
+ if __ccgo_strace {
+ trc("t=%v p3=%v, (%v:)", t, p3, origin(2))
+ }
return __syscall(unix.Syscall(uintptr(trap), uintptr(p1), uintptr(p2), uintptr(p3)))
}
func X__syscall4(t *TLS, trap, p1, p2, p3, p4 long) long {
+ if __ccgo_strace {
+ trc("t=%v p4=%v, (%v:)", t, p4, origin(2))
+ }
return __syscall(unix.Syscall6(uintptr(trap), uintptr(p1), uintptr(p2), uintptr(p3), uintptr(p4), 0, 0))
}
@@ -1300,26 +1603,41 @@ func fcntlCmdStr(cmd int32) string {
// int setenv(const char *name, const char *value, int overwrite);
func Xsetenv(t *TLS, name, value uintptr, overwrite int32) int32 {
+ if __ccgo_strace {
+ trc("t=%v value=%v overwrite=%v, (%v:)", t, value, overwrite, origin(2))
+ }
panic(todo(""))
}
// int unsetenv(const char *name);
func Xunsetenv(t *TLS, name uintptr) int32 {
+ if __ccgo_strace {
+ trc("t=%v name=%v, (%v:)", t, name, origin(2))
+ }
panic(todo(""))
}
// int pause(void);
func Xpause(t *TLS) int32 {
+ if __ccgo_strace {
+ trc("t=%v, (%v:)", t, origin(2))
+ }
panic(todo(""))
}
// ssize_t writev(int fd, const struct iovec *iov, int iovcnt);
func Xwritev(t *TLS, fd int32, iov uintptr, iovcnt int32) types.Ssize_t {
+ if __ccgo_strace {
+ trc("t=%v fd=%v iov=%v iovcnt=%v, (%v:)", t, fd, iov, iovcnt, origin(2))
+ }
panic(todo(""))
}
// int __isoc99_sscanf(const char *str, const char *format, ...);
func X__isoc99_sscanf(t *TLS, str, format, va uintptr) int32 {
+ if __ccgo_strace {
+ trc("t=%v va=%v, (%v:)", t, va, origin(2))
+ }
r := Xsscanf(t, str, format, va)
// if dmesgs {
// dmesg("%v: %q %q: %d", origin(1), GoString(str), GoString(format), r)
@@ -1329,20 +1647,32 @@ func X__isoc99_sscanf(t *TLS, str, format, va uintptr) int32 {
// void __assert(const char * func, const char * file, int line, const char *expr) __dead2;
func X__assert(t *TLS, fn, file uintptr, line int32, expr uintptr) {
+ if __ccgo_strace {
+ trc("t=%v file=%v line=%v expr=%v, (%v:)", t, file, line, expr, origin(2))
+ }
X__assert_fail(t, expr, file, uint32(line), fn)
}
func X__assert13(t *TLS, file uintptr, line int32, fn, msg uintptr) {
+ if __ccgo_strace {
+ trc("t=%v file=%v line=%v msg=%v, (%v:)", t, file, line, msg, origin(2))
+ }
X__assert_fail(t, msg, file, uint32(line), fn)
}
// include/stdio.h:456:int __swbuf(int, FILE *);
func X__swbuf(t *TLS, n int32, file uintptr) int32 {
+ if __ccgo_strace {
+ trc("t=%v n=%v file=%v, (%v:)", t, n, file, origin(2))
+ }
return Xfputc(t, n, file) //TODO improve performance, use a real buffer.
}
// int rmdir(const char *pathname);
func Xrmdir(t *TLS, pathname uintptr) int32 {
+ if __ccgo_strace {
+ trc("t=%v pathname=%v, (%v:)", t, pathname, origin(2))
+ }
if err := unix.Rmdir(GoString(pathname)); err != nil {
if dmesgs {
dmesg("%v: %v FAIL", origin(1), err)
@@ -1359,6 +1689,9 @@ func Xrmdir(t *TLS, pathname uintptr) int32 {
// struct dirent *readdir(DIR *dirp);
func Xreaddir(t *TLS, dir uintptr) uintptr {
+ if __ccgo_strace {
+ trc("t=%v dir=%v, (%v:)", t, dir, origin(2))
+ }
if (*darwinDir)(unsafe.Pointer(dir)).eof {
return 0
}
@@ -1397,6 +1730,9 @@ type darwinDir struct {
// int sscanf(const char *str, const char *format, ...);
func Xsscanf(t *TLS, str, format, va uintptr) int32 {
+ if __ccgo_strace {
+ trc("t=%v va=%v, (%v:)", t, va, origin(2))
+ }
r := scanf(strings.NewReader(GoString(str)), format, va)
// if dmesgs {
// dmesg("%v: %q %q: %d", origin(1), GoString(str), GoString(format), r)
@@ -1406,10 +1742,16 @@ func Xsscanf(t *TLS, str, format, va uintptr) int32 {
// int * __error(void);
func X__error(t *TLS) uintptr {
+ if __ccgo_strace {
+ trc("t=%v, (%v:)", t, origin(2))
+ }
return t.errnop
}
func Xclosedir(t *TLS, dir uintptr) int32 {
+ if __ccgo_strace {
+ trc("t=%v dir=%v, (%v:)", t, dir, origin(2))
+ }
r := Xclose(t, int32((*darwinDir)(unsafe.Pointer(dir)).fd))
Xfree(t, dir)
return r
@@ -1417,11 +1759,17 @@ func Xclosedir(t *TLS, dir uintptr) int32 {
// int __xuname(int namesize, void *namebuf)
func X__xuname(t *TLS, namesize int32, namebuf uintptr) int32 {
+ if __ccgo_strace {
+ trc("t=%v namesize=%v namebuf=%v, (%v:)", t, namesize, namebuf, origin(2))
+ }
return Xuname(t, namebuf)
}
// int chflags(const char *path, u_int flags);
func Xchflags(t *TLS, path uintptr, flags uint32) int32 {
+ if __ccgo_strace {
+ trc("t=%v path=%v flags=%v, (%v:)", t, path, flags, origin(2))
+ }
if err := unix.Chflags(GoString(path), int(flags)); err != nil {
if dmesgs {
dmesg("%v: %v FAIL", origin(1), err)
@@ -1438,6 +1786,9 @@ func Xchflags(t *TLS, path uintptr, flags uint32) int32 {
// int pipe(int pipefd[2]);
func Xpipe(t *TLS, pipefd uintptr) int32 {
+ if __ccgo_strace {
+ trc("t=%v pipefd=%v, (%v:)", t, pipefd, origin(2))
+ }
var a [2]int
if err := syscall.Pipe(a[:]); err != nil {
if dmesgs {
@@ -1456,10 +1807,16 @@ func Xpipe(t *TLS, pipefd uintptr) int32 {
// char *inet_ntoa(struct in_addr in);
func X__inet_ntoa(t *TLS, in1 in.In_addr) uintptr {
+ if __ccgo_strace {
+ trc("t=%v in1=%v, (%v:)", t, in1, origin(2))
+ }
panic(todo(""))
}
func Xmmap(t *TLS, addr uintptr, length types.Size_t, prot, flags, fd int32, offset types.Off_t) uintptr {
+ if __ccgo_strace {
+ trc("t=%v addr=%v length=%v fd=%v offset=%v, (%v:)", t, addr, length, fd, offset, origin(2))
+ }
// On 2021-12-23, a new syscall for mmap was introduced:
//
// 49 STD NOLOCK { void *sys_mmap(void *addr, size_t len, int prot, \
@@ -1485,27 +1842,45 @@ func Xmmap(t *TLS, addr uintptr, length types.Size_t, prot, flags, fd int32, off
}
func X__errno(t *TLS) uintptr {
+ if __ccgo_strace {
+ trc("t=%v, (%v:)", t, origin(2))
+ }
return X__errno_location(t)
}
func X__ccgo_pthreadMutexattrGettype(tls *TLS, a uintptr) int32 { /* pthread_attr_get.c:93:5: */
+ if __ccgo_strace {
+ trc("tls=%v a=%v, (%v:)", tls, a, origin(2))
+ }
return (int32((*pthread_mutexattr_t)(unsafe.Pointer(a)).F__attr & uint32(3)))
}
func X__ccgo_getMutexType(tls *TLS, m uintptr) int32 { /* pthread_mutex_lock.c:3:5: */
+ if __ccgo_strace {
+ trc("tls=%v m=%v, (%v:)", tls, m, origin(2))
+ }
return (*(*int32)(unsafe.Pointer((m /* &.__u */ /* &.__i */))) & 15)
}
func X__ccgo_pthreadAttrGetDetachState(tls *TLS, a uintptr) int32 { /* pthread_attr_get.c:3:5: */
+ if __ccgo_strace {
+ trc("tls=%v a=%v, (%v:)", tls, a, origin(2))
+ }
return *(*int32)(unsafe.Pointer((a /* &.__u */ /* &.__i */) + 6*4))
}
func Xpthread_attr_getdetachstate(tls *TLS, a uintptr, state uintptr) int32 { /* pthread_attr_get.c:7:5: */
+ if __ccgo_strace {
+ trc("tls=%v a=%v state=%v, (%v:)", tls, a, state, origin(2))
+ }
*(*int32)(unsafe.Pointer(state)) = *(*int32)(unsafe.Pointer((a /* &.__u */ /* &.__i */) + 6*4))
return 0
}
func Xpthread_attr_setdetachstate(tls *TLS, a uintptr, state int32) int32 { /* pthread_attr_setdetachstate.c:3:5: */
+ if __ccgo_strace {
+ trc("tls=%v a=%v state=%v, (%v:)", tls, a, state, origin(2))
+ }
if uint32(state) > 1 {
return 22
}
@@ -1514,15 +1889,24 @@ func Xpthread_attr_setdetachstate(tls *TLS, a uintptr, state int32) int32 { /* p
}
func Xpthread_mutexattr_destroy(tls *TLS, a uintptr) int32 { /* pthread_mutexattr_destroy.c:3:5: */
+ if __ccgo_strace {
+ trc("tls=%v a=%v, (%v:)", tls, a, origin(2))
+ }
return 0
}
func Xpthread_mutexattr_init(tls *TLS, a uintptr) int32 { /* pthread_mutexattr_init.c:3:5: */
+ if __ccgo_strace {
+ trc("tls=%v a=%v, (%v:)", tls, a, origin(2))
+ }
*(*pthread_mutexattr_t)(unsafe.Pointer(a)) = pthread_mutexattr_t{}
return 0
}
func Xpthread_mutexattr_settype(tls *TLS, a uintptr, type1 int32) int32 { /* pthread_mutexattr_settype.c:3:5: */
+ if __ccgo_strace {
+ trc("tls=%v a=%v type1=%v, (%v:)", tls, a, type1, origin(2))
+ }
if uint32(type1) > uint32(2) {
return 22
}
@@ -1532,6 +1916,9 @@ func Xpthread_mutexattr_settype(tls *TLS, a uintptr, type1 int32) int32 { /* pth
// int uuid_parse( char *in, uuid_t uu);
func Xuuid_parse(t *TLS, in uintptr, uu uintptr) int32 {
+ if __ccgo_strace {
+ trc("t=%v in=%v uu=%v, (%v:)", t, in, uu, origin(2))
+ }
r, err := guuid.Parse(GoString(in))
if err != nil {
return -1
@@ -1541,16 +1928,27 @@ func Xuuid_parse(t *TLS, in uintptr, uu uintptr) int32 {
return 0
}
-func X__srget(t *TLS, stream uintptr) int32 { return Xgetc(t, stream) }
+func X__srget(t *TLS, stream uintptr) int32 {
+ if __ccgo_strace {
+ trc("t=%v stream=%v, (%v:)", t, stream, origin(2))
+ }
+ return Xgetc(t, stream)
+}
// void __assert2(const char *, int, const char *, const char *);
// __assert2(__FILE__, __LINE__, __func__, #e))
func X__assert2(t *TLS, file uintptr, line int32, fn, expr uintptr) {
+ if __ccgo_strace {
+ trc("t=%v file=%v line=%v expr=%v, (%v:)", t, file, line, expr, origin(2))
+ }
X__assert_fail(t, expr, file, uint32(line), fn)
}
// int getpagesize(void);
func Xgetpagesize(t *TLS) int32 {
+ if __ccgo_strace {
+ trc("t=%v, (%v:)", t, origin(2))
+ }
return int32(unix.Getpagesize())
}
@@ -1568,6 +1966,9 @@ const PTHREAD_MUTEX_DEFAULT = 0
//
// int pthread_mutex_init(pthread_mutex_t *restrict mutex, const pthread_mutexattr_t *restrict attr);
func Xpthread_mutex_init(t *TLS, pMutex, pAttr uintptr) int32 {
+ if __ccgo_strace {
+ trc("t=%v pAttr=%v, (%v:)", t, pAttr, origin(2))
+ }
typ := PTHREAD_MUTEX_DEFAULT
if pAttr != 0 {
typ = int(X__ccgo_pthreadMutexattrGettype(t, pAttr))
@@ -1582,17 +1983,31 @@ func Xpthread_mutex_init(t *TLS, pMutex, pAttr uintptr) int32 {
// uint16_t __builtin_bswap16 (uint32_t x)
func Xbswap16(t *TLS, x uint16) uint16 {
+ if __ccgo_strace {
+ trc("t=%v x=%v, (%v:)", t, x, origin(2))
+ }
return X__builtin_bswap16(t, x)
}
// uint32_t __builtin_bswap32 (uint32_t x)
func Xbswap32(t *TLS, x uint32) uint32 {
+ if __ccgo_strace {
+ trc("t=%v x=%v, (%v:)", t, x, origin(2))
+ }
return X__builtin_bswap32(t, x)
}
// uint64_t __builtin_bswap64 (uint64_t x)
func Xbswap64(t *TLS, x uint64) uint64 {
+ if __ccgo_strace {
+ trc("t=%v x=%v, (%v:)", t, x, origin(2))
+ }
return X__builtin_bswap64(t, x)
}
-func X__builtin_isblank(t *TLS, _c int32) int32 { return Xisblank(t, _c) }
+func X__builtin_isblank(t *TLS, _c int32) int32 {
+ if __ccgo_strace {
+ trc("t=%v _c=%v, (%v:)", t, _c, origin(2))
+ }
+ return Xisblank(t, _c)
+}
diff --git a/vendor/modernc.org/libc/libc_openbsd_386.go b/vendor/modernc.org/libc/libc_openbsd_386.go
index 8c30e7b5..5b414c18 100644
--- a/vendor/modernc.org/libc/libc_openbsd_386.go
+++ b/vendor/modernc.org/libc/libc_openbsd_386.go
@@ -24,6 +24,9 @@ type (
// int sigaction(int signum, const struct sigaction *act, struct sigaction *oldact);
func Xsigaction(t *TLS, signum int32, act, oldact uintptr) int32 {
+ if __ccgo_strace {
+ trc("t=%v signum=%v oldact=%v, (%v:)", t, signum, oldact, origin(2))
+ }
if _, _, err := unix.Syscall(unix.SYS_SIGACTION, uintptr(signum), act, oldact); err != 0 {
t.setErrno(err)
return -1
@@ -34,6 +37,9 @@ func Xsigaction(t *TLS, signum int32, act, oldact uintptr) int32 {
// FILE *fopen64(const char *pathname, const char *mode);
func Xfopen64(t *TLS, pathname, mode uintptr) uintptr {
+ if __ccgo_strace {
+ trc("t=%v mode=%v, (%v:)", t, mode, origin(2))
+ }
m := strings.ReplaceAll(GoString(mode), "b", "")
var flags int
switch m {
@@ -73,6 +79,9 @@ func Xfopen64(t *TLS, pathname, mode uintptr) uintptr {
// int lstat(const char *pathname, struct stat *statbuf);
func Xlstat64(t *TLS, pathname, statbuf uintptr) int32 {
+ if __ccgo_strace {
+ trc("t=%v statbuf=%v, (%v:)", t, statbuf, origin(2))
+ }
if err := unix.Lstat(GoString(pathname), (*unix.Stat_t)(unsafe.Pointer(statbuf))); err != nil {
if dmesgs {
dmesg("%v: %q: %v FAIL", origin(1), GoString(pathname), err)
@@ -89,6 +98,9 @@ func Xlstat64(t *TLS, pathname, statbuf uintptr) int32 {
// int stat(const char *pathname, struct stat *statbuf);
func Xstat64(t *TLS, pathname, statbuf uintptr) int32 {
+ if __ccgo_strace {
+ trc("t=%v statbuf=%v, (%v:)", t, statbuf, origin(2))
+ }
if err := unix.Stat(GoString(pathname), (*unix.Stat_t)(unsafe.Pointer(statbuf))); err != nil {
if dmesgs {
dmesg("%v: %q: %v FAIL", origin(1), GoString(pathname), err)
@@ -105,6 +117,9 @@ func Xstat64(t *TLS, pathname, statbuf uintptr) int32 {
// int mkdir(const char *path, mode_t mode);
func Xmkdir(t *TLS, path uintptr, mode types.Mode_t) int32 {
+ if __ccgo_strace {
+ trc("t=%v path=%v mode=%v, (%v:)", t, path, mode, origin(2))
+ }
if err := unix.Mkdir(GoString(path), uint32(mode)); err != nil {
if dmesgs {
dmesg("%v: %q: %v FAIL", origin(1), GoString(path), err)
@@ -121,6 +136,9 @@ func Xmkdir(t *TLS, path uintptr, mode types.Mode_t) int32 {
// int access(const char *pathname, int mode);
func Xaccess(t *TLS, pathname uintptr, mode int32) int32 {
+ if __ccgo_strace {
+ trc("t=%v pathname=%v mode=%v, (%v:)", t, pathname, mode, origin(2))
+ }
if err := unix.Access(GoString(pathname), uint32(mode)); err != nil {
if dmesgs {
dmesg("%v: %q %#o: %v FAIL", origin(1), GoString(pathname), mode, err)
@@ -137,6 +155,9 @@ func Xaccess(t *TLS, pathname uintptr, mode int32) int32 {
// int unlink(const char *pathname);
func Xunlink(t *TLS, pathname uintptr) int32 {
+ if __ccgo_strace {
+ trc("t=%v pathname=%v, (%v:)", t, pathname, origin(2))
+ }
if err := unix.Unlink(GoString(pathname)); err != nil {
if dmesgs {
dmesg("%v: %q: %v", origin(1), GoString(pathname), err)
@@ -153,6 +174,9 @@ func Xunlink(t *TLS, pathname uintptr) int32 {
// ssize_t readlink(const char *restrict path, char *restrict buf, size_t bufsize);
func Xreadlink(t *TLS, path, buf uintptr, bufsize types.Size_t) types.Ssize_t {
+ if __ccgo_strace {
+ trc("t=%v buf=%v bufsize=%v, (%v:)", t, buf, bufsize, origin(2))
+ }
var n int
var err error
switch {
@@ -177,6 +201,9 @@ func Xreadlink(t *TLS, path, buf uintptr, bufsize types.Size_t) types.Ssize_t {
// int symlink(const char *target, const char *linkpath);
func Xsymlink(t *TLS, target, linkpath uintptr) int32 {
+ if __ccgo_strace {
+ trc("t=%v linkpath=%v, (%v:)", t, linkpath, origin(2))
+ }
if err := unix.Symlink(GoString(target), GoString(linkpath)); err != nil {
if dmesgs {
dmesg("%v: %v FAIL", origin(1), err)
@@ -193,6 +220,9 @@ func Xsymlink(t *TLS, target, linkpath uintptr) int32 {
// int chmod(const char *pathname, mode_t mode)
func Xchmod(t *TLS, pathname uintptr, mode types.Mode_t) int32 {
+ if __ccgo_strace {
+ trc("t=%v pathname=%v mode=%v, (%v:)", t, pathname, mode, origin(2))
+ }
if err := unix.Chmod(GoString(pathname), uint32(mode)); err != nil {
if dmesgs {
dmesg("%v: %q %#o: %v FAIL", origin(1), GoString(pathname), mode, err)
@@ -209,6 +239,9 @@ func Xchmod(t *TLS, pathname uintptr, mode types.Mode_t) int32 {
// time_t time(time_t *tloc);
func Xtime(t *TLS, tloc uintptr) time.Time_t {
+ if __ccgo_strace {
+ trc("t=%v tloc=%v, (%v:)", t, tloc, origin(2))
+ }
panic(todo(""))
// n := time.Now().UTC().Unix()
// if tloc != 0 {
@@ -219,6 +252,9 @@ func Xtime(t *TLS, tloc uintptr) time.Time_t {
// int utimes(const char *filename, const struct timeval times[2]);
func Xutimes(t *TLS, filename, times uintptr) int32 {
+ if __ccgo_strace {
+ trc("t=%v times=%v, (%v:)", t, times, origin(2))
+ }
var a []unix.Timeval
if times != 0 {
a = make([]unix.Timeval, 2)
@@ -241,6 +277,9 @@ func Xutimes(t *TLS, filename, times uintptr) int32 {
// int fstat(int fd, struct stat *statbuf);
func Xfstat64(t *TLS, fd int32, statbuf uintptr) int32 {
+ if __ccgo_strace {
+ trc("t=%v fd=%v statbuf=%v, (%v:)", t, fd, statbuf, origin(2))
+ }
if err := unix.Fstat(int(fd), (*unix.Stat_t)(unsafe.Pointer(statbuf))); err != nil {
if dmesgs {
dmesg("%v: fd %d: %v FAIL", origin(1), fd, err)
@@ -257,6 +296,9 @@ func Xfstat64(t *TLS, fd int32, statbuf uintptr) int32 {
// off64_t lseek64(int fd, off64_t offset, int whence);
func Xlseek64(t *TLS, fd int32, offset types.Off_t, whence int32) types.Off_t {
+ if __ccgo_strace {
+ trc("t=%v fd=%v offset=%v whence=%v, (%v:)", t, fd, offset, whence, origin(2))
+ }
n, err := unix.Seek(int(fd), int64(offset), int(whence))
if err != nil {
if dmesgs {
@@ -273,6 +315,9 @@ func Xlseek64(t *TLS, fd int32, offset types.Off_t, whence int32) types.Off_t {
}
func Xfcntl64(t *TLS, fd, cmd int32, args uintptr) int32 {
+ if __ccgo_strace {
+ trc("t=%v cmd=%v args=%v, (%v:)", t, cmd, args, origin(2))
+ }
var arg uintptr
if args != 0 {
arg = *(*uintptr)(unsafe.Pointer(args))
@@ -294,6 +339,9 @@ func Xfcntl64(t *TLS, fd, cmd int32, args uintptr) int32 {
// int rename(const char *oldpath, const char *newpath);
func Xrename(t *TLS, oldpath, newpath uintptr) int32 {
+ if __ccgo_strace {
+ trc("t=%v newpath=%v, (%v:)", t, newpath, origin(2))
+ }
if err := unix.Rename(GoString(oldpath), GoString(newpath)); err != nil {
if dmesgs {
dmesg("%v: %v FAIL", origin(1), err)
@@ -310,6 +358,9 @@ func Xrename(t *TLS, oldpath, newpath uintptr) int32 {
// int mknod(const char *pathname, mode_t mode, dev_t dev);
func Xmknod(t *TLS, pathname uintptr, mode types.Mode_t, dev types.Dev_t) int32 {
+ if __ccgo_strace {
+ trc("t=%v pathname=%v mode=%v dev=%v, (%v:)", t, pathname, mode, dev, origin(2))
+ }
panic(todo(""))
// if _, _, err := unix.Syscall(unix.SYS_MKNOD, pathname, uintptr(mode), uintptr(dev)); err != 0 {
// t.setErrno(err)
@@ -321,6 +372,9 @@ func Xmknod(t *TLS, pathname uintptr, mode types.Mode_t, dev types.Dev_t) int32
// int utime(const char *filename, const struct utimbuf *times);
func Xutime(t *TLS, filename, times uintptr) int32 {
+ if __ccgo_strace {
+ trc("t=%v times=%v, (%v:)", t, times, origin(2))
+ }
var a []unix.Timeval
if times != 0 {
a = make([]unix.Timeval, 2)
@@ -343,6 +397,9 @@ func Xutime(t *TLS, filename, times uintptr) int32 {
// int chown(const char *pathname, uid_t owner, gid_t group);
func Xchown(t *TLS, pathname uintptr, owner types.Uid_t, group types.Gid_t) int32 {
+ if __ccgo_strace {
+ trc("t=%v pathname=%v owner=%v group=%v, (%v:)", t, pathname, owner, group, origin(2))
+ }
if _, _, err := unix.Syscall(unix.SYS_CHOWN, pathname, uintptr(owner), uintptr(group)); err != 0 {
t.setErrno(err)
return -1
@@ -353,6 +410,9 @@ func Xchown(t *TLS, pathname uintptr, owner types.Uid_t, group types.Gid_t) int3
// int link(const char *oldpath, const char *newpath);
func Xlink(t *TLS, oldpath, newpath uintptr) int32 {
+ if __ccgo_strace {
+ trc("t=%v newpath=%v, (%v:)", t, newpath, origin(2))
+ }
panic(todo(""))
// if _, _, err := unix.Syscall(unix.SYS_LINK, oldpath, newpath, 0); err != 0 {
// t.setErrno(err)
@@ -364,6 +424,9 @@ func Xlink(t *TLS, oldpath, newpath uintptr) int32 {
// int dup2(int oldfd, int newfd);
func Xdup2(t *TLS, oldfd, newfd int32) int32 {
+ if __ccgo_strace {
+ trc("t=%v newfd=%v, (%v:)", t, newfd, origin(2))
+ }
panic(todo(""))
// n, _, err := unix.Syscall(unix.SYS_DUP2, uintptr(oldfd), uintptr(newfd), 0)
// if err != 0 {
@@ -376,6 +439,9 @@ func Xdup2(t *TLS, oldfd, newfd int32) int32 {
// unsigned int alarm(unsigned int seconds);
func Xalarm(t *TLS, seconds uint32) uint32 {
+ if __ccgo_strace {
+ trc("t=%v seconds=%v, (%v:)", t, seconds, origin(2))
+ }
panic(todo(""))
// n, _, err := unix.Syscall(unix.SYS_ALARM, uintptr(seconds), 0, 0)
// if err != 0 {
@@ -386,6 +452,9 @@ func Xalarm(t *TLS, seconds uint32) uint32 {
}
func Xgetnameinfo(tls *TLS, sa1 uintptr, sl socklen_t, node uintptr, nodelen size_t, serv uintptr, servlen size_t, flags int32) int32 { /* getnameinfo.c:125:5: */
+ if __ccgo_strace {
+ trc("tls=%v sa1=%v sl=%v node=%v nodelen=%v serv=%v servlen=%v flags=%v, (%v:)", tls, sa1, sl, node, nodelen, serv, servlen, flags, origin(2))
+ }
panic(todo(""))
//TODO bp := tls.Alloc(347)
//TODO defer tls.Free(347)
@@ -485,6 +554,9 @@ func Xgetnameinfo(tls *TLS, sa1 uintptr, sl socklen_t, node uintptr, nodelen siz
}
func Xgethostbyaddr_r(tls *TLS, a uintptr, l socklen_t, af int32, h uintptr, buf uintptr, buflen size_t, res uintptr, err uintptr) int32 { /* gethostbyaddr_r.c:10:5: */
+ if __ccgo_strace {
+ trc("tls=%v a=%v l=%v af=%v h=%v buf=%v buflen=%v res=%v err=%v, (%v:)", tls, a, l, af, h, buf, buflen, res, err, origin(2))
+ }
panic(todo(""))
//TODO bp := tls.Alloc(28)
//TODO defer tls.Free(28)
@@ -572,6 +644,9 @@ func Xgethostbyaddr_r(tls *TLS, a uintptr, l socklen_t, af int32, h uintptr, buf
// int getrlimit(int resource, struct rlimit *rlim);
func Xgetrlimit64(t *TLS, resource int32, rlim uintptr) int32 {
+ if __ccgo_strace {
+ trc("t=%v resource=%v rlim=%v, (%v:)", t, resource, rlim, origin(2))
+ }
if _, _, err := unix.Syscall(unix.SYS_GETRLIMIT, uintptr(resource), uintptr(rlim), 0); err != 0 {
t.setErrno(err)
return -1
@@ -606,6 +681,9 @@ func newFtsent(t *TLS, info int, path string, stat *unix.Stat_t, err syscall.Err
// DIR *opendir(const char *name);
func Xopendir(t *TLS, name uintptr) uintptr {
+ if __ccgo_strace {
+ trc("t=%v name=%v, (%v:)", t, name, origin(2))
+ }
p := Xmalloc(t, uint32(unsafe.Sizeof(darwinDir{})))
if p == 0 {
panic("OOM")
diff --git a/vendor/modernc.org/libc/libc_openbsd_amd64.go b/vendor/modernc.org/libc/libc_openbsd_amd64.go
index 434f06bb..20017d9a 100644
--- a/vendor/modernc.org/libc/libc_openbsd_amd64.go
+++ b/vendor/modernc.org/libc/libc_openbsd_amd64.go
@@ -24,6 +24,9 @@ type (
// int sigaction(int signum, const struct sigaction *act, struct sigaction *oldact);
func Xsigaction(t *TLS, signum int32, act, oldact uintptr) int32 {
+ if __ccgo_strace {
+ trc("t=%v signum=%v oldact=%v, (%v:)", t, signum, oldact, origin(2))
+ }
panic(todo(""))
// if _, _, err := unix.Syscall(unix.SYS_SIGACTION, uintptr(signum), act, oldact); err != 0 {
// t.setErrno(err)
@@ -35,6 +38,9 @@ func Xsigaction(t *TLS, signum int32, act, oldact uintptr) int32 {
// FILE *fopen64(const char *pathname, const char *mode);
func Xfopen64(t *TLS, pathname, mode uintptr) uintptr {
+ if __ccgo_strace {
+ trc("t=%v mode=%v, (%v:)", t, mode, origin(2))
+ }
m := strings.ReplaceAll(GoString(mode), "b", "")
var flags int
switch m {
@@ -74,6 +80,9 @@ func Xfopen64(t *TLS, pathname, mode uintptr) uintptr {
// int lstat(const char *pathname, struct stat *statbuf);
func Xlstat64(t *TLS, pathname, statbuf uintptr) int32 {
+ if __ccgo_strace {
+ trc("t=%v statbuf=%v, (%v:)", t, statbuf, origin(2))
+ }
if err := unix.Lstat(GoString(pathname), (*unix.Stat_t)(unsafe.Pointer(statbuf))); err != nil {
if dmesgs {
dmesg("%v: %q: %v FAIL", origin(1), GoString(pathname), err)
@@ -90,6 +99,9 @@ func Xlstat64(t *TLS, pathname, statbuf uintptr) int32 {
// int stat(const char *pathname, struct stat *statbuf);
func Xstat64(t *TLS, pathname, statbuf uintptr) int32 {
+ if __ccgo_strace {
+ trc("t=%v statbuf=%v, (%v:)", t, statbuf, origin(2))
+ }
if err := unix.Stat(GoString(pathname), (*unix.Stat_t)(unsafe.Pointer(statbuf))); err != nil {
if dmesgs {
dmesg("%v: %q: %v FAIL", origin(1), GoString(pathname), err)
@@ -106,6 +118,9 @@ func Xstat64(t *TLS, pathname, statbuf uintptr) int32 {
// int mkdir(const char *path, mode_t mode);
func Xmkdir(t *TLS, path uintptr, mode types.Mode_t) int32 {
+ if __ccgo_strace {
+ trc("t=%v path=%v mode=%v, (%v:)", t, path, mode, origin(2))
+ }
if err := unix.Mkdir(GoString(path), uint32(mode)); err != nil {
if dmesgs {
dmesg("%v: %q: %v FAIL", origin(1), GoString(path), err)
@@ -122,6 +137,9 @@ func Xmkdir(t *TLS, path uintptr, mode types.Mode_t) int32 {
// int access(const char *pathname, int mode);
func Xaccess(t *TLS, pathname uintptr, mode int32) int32 {
+ if __ccgo_strace {
+ trc("t=%v pathname=%v mode=%v, (%v:)", t, pathname, mode, origin(2))
+ }
if err := unix.Access(GoString(pathname), uint32(mode)); err != nil {
if dmesgs {
dmesg("%v: %q %#o: %v FAIL", origin(1), GoString(pathname), mode, err)
@@ -138,6 +156,9 @@ func Xaccess(t *TLS, pathname uintptr, mode int32) int32 {
// int unlink(const char *pathname);
func Xunlink(t *TLS, pathname uintptr) int32 {
+ if __ccgo_strace {
+ trc("t=%v pathname=%v, (%v:)", t, pathname, origin(2))
+ }
if err := unix.Unlink(GoString(pathname)); err != nil {
if dmesgs {
dmesg("%v: %q: %v", origin(1), GoString(pathname), err)
@@ -154,6 +175,9 @@ func Xunlink(t *TLS, pathname uintptr) int32 {
// ssize_t readlink(const char *restrict path, char *restrict buf, size_t bufsize);
func Xreadlink(t *TLS, path, buf uintptr, bufsize types.Size_t) types.Ssize_t {
+ if __ccgo_strace {
+ trc("t=%v buf=%v bufsize=%v, (%v:)", t, buf, bufsize, origin(2))
+ }
var n int
var err error
switch {
@@ -178,6 +202,9 @@ func Xreadlink(t *TLS, path, buf uintptr, bufsize types.Size_t) types.Ssize_t {
// int symlink(const char *target, const char *linkpath);
func Xsymlink(t *TLS, target, linkpath uintptr) int32 {
+ if __ccgo_strace {
+ trc("t=%v linkpath=%v, (%v:)", t, linkpath, origin(2))
+ }
if err := unix.Symlink(GoString(target), GoString(linkpath)); err != nil {
if dmesgs {
dmesg("%v: %v FAIL", origin(1), err)
@@ -194,6 +221,9 @@ func Xsymlink(t *TLS, target, linkpath uintptr) int32 {
// int chmod(const char *pathname, mode_t mode)
func Xchmod(t *TLS, pathname uintptr, mode types.Mode_t) int32 {
+ if __ccgo_strace {
+ trc("t=%v pathname=%v mode=%v, (%v:)", t, pathname, mode, origin(2))
+ }
if err := unix.Chmod(GoString(pathname), uint32(mode)); err != nil {
if dmesgs {
dmesg("%v: %q %#o: %v FAIL", origin(1), GoString(pathname), mode, err)
@@ -210,6 +240,9 @@ func Xchmod(t *TLS, pathname uintptr, mode types.Mode_t) int32 {
// time_t time(time_t *tloc);
func Xtime(t *TLS, tloc uintptr) time.Time_t {
+ if __ccgo_strace {
+ trc("t=%v tloc=%v, (%v:)", t, tloc, origin(2))
+ }
panic(todo(""))
// n := time.Now().UTC().Unix()
// if tloc != 0 {
@@ -220,6 +253,9 @@ func Xtime(t *TLS, tloc uintptr) time.Time_t {
// int utimes(const char *filename, const struct timeval times[2]);
func Xutimes(t *TLS, filename, times uintptr) int32 {
+ if __ccgo_strace {
+ trc("t=%v times=%v, (%v:)", t, times, origin(2))
+ }
var a []unix.Timeval
if times != 0 {
a = make([]unix.Timeval, 2)
@@ -242,6 +278,9 @@ func Xutimes(t *TLS, filename, times uintptr) int32 {
// int fstat(int fd, struct stat *statbuf);
func Xfstat64(t *TLS, fd int32, statbuf uintptr) int32 {
+ if __ccgo_strace {
+ trc("t=%v fd=%v statbuf=%v, (%v:)", t, fd, statbuf, origin(2))
+ }
if err := unix.Fstat(int(fd), (*unix.Stat_t)(unsafe.Pointer(statbuf))); err != nil {
if dmesgs {
dmesg("%v: fd %d: %v FAIL", origin(1), fd, err)
@@ -258,6 +297,9 @@ func Xfstat64(t *TLS, fd int32, statbuf uintptr) int32 {
// off64_t lseek64(int fd, off64_t offset, int whence);
func Xlseek64(t *TLS, fd int32, offset types.Off_t, whence int32) types.Off_t {
+ if __ccgo_strace {
+ trc("t=%v fd=%v offset=%v whence=%v, (%v:)", t, fd, offset, whence, origin(2))
+ }
n, err := unix.Seek(int(fd), int64(offset), int(whence))
if err != nil {
if dmesgs {
@@ -274,6 +316,9 @@ func Xlseek64(t *TLS, fd int32, offset types.Off_t, whence int32) types.Off_t {
}
func Xfcntl64(t *TLS, fd, cmd int32, args uintptr) int32 {
+ if __ccgo_strace {
+ trc("t=%v cmd=%v args=%v, (%v:)", t, cmd, args, origin(2))
+ }
var arg uintptr
if args != 0 {
arg = *(*uintptr)(unsafe.Pointer(args))
@@ -295,6 +340,9 @@ func Xfcntl64(t *TLS, fd, cmd int32, args uintptr) int32 {
// int rename(const char *oldpath, const char *newpath);
func Xrename(t *TLS, oldpath, newpath uintptr) int32 {
+ if __ccgo_strace {
+ trc("t=%v newpath=%v, (%v:)", t, newpath, origin(2))
+ }
if err := unix.Rename(GoString(oldpath), GoString(newpath)); err != nil {
if dmesgs {
dmesg("%v: %v FAIL", origin(1), err)
@@ -311,6 +359,9 @@ func Xrename(t *TLS, oldpath, newpath uintptr) int32 {
// int mknod(const char *pathname, mode_t mode, dev_t dev);
func Xmknod(t *TLS, pathname uintptr, mode types.Mode_t, dev types.Dev_t) int32 {
+ if __ccgo_strace {
+ trc("t=%v pathname=%v mode=%v dev=%v, (%v:)", t, pathname, mode, dev, origin(2))
+ }
panic(todo(""))
// if _, _, err := unix.Syscall(unix.SYS_MKNOD, pathname, uintptr(mode), uintptr(dev)); err != 0 {
// t.setErrno(err)
@@ -322,6 +373,9 @@ func Xmknod(t *TLS, pathname uintptr, mode types.Mode_t, dev types.Dev_t) int32
// int utime(const char *filename, const struct utimbuf *times);
func Xutime(t *TLS, filename, times uintptr) int32 {
+ if __ccgo_strace {
+ trc("t=%v times=%v, (%v:)", t, times, origin(2))
+ }
var a []unix.Timeval
if times != 0 {
a = make([]unix.Timeval, 2)
@@ -344,6 +398,9 @@ func Xutime(t *TLS, filename, times uintptr) int32 {
// int chown(const char *pathname, uid_t owner, gid_t group);
func Xchown(t *TLS, pathname uintptr, owner types.Uid_t, group types.Gid_t) int32 {
+ if __ccgo_strace {
+ trc("t=%v pathname=%v owner=%v group=%v, (%v:)", t, pathname, owner, group, origin(2))
+ }
if _, _, err := unix.Syscall(unix.SYS_CHOWN, pathname, uintptr(owner), uintptr(group)); err != 0 {
t.setErrno(err)
return -1
@@ -354,6 +411,9 @@ func Xchown(t *TLS, pathname uintptr, owner types.Uid_t, group types.Gid_t) int3
// int link(const char *oldpath, const char *newpath);
func Xlink(t *TLS, oldpath, newpath uintptr) int32 {
+ if __ccgo_strace {
+ trc("t=%v newpath=%v, (%v:)", t, newpath, origin(2))
+ }
panic(todo(""))
// if _, _, err := unix.Syscall(unix.SYS_LINK, oldpath, newpath, 0); err != 0 {
// t.setErrno(err)
@@ -365,6 +425,9 @@ func Xlink(t *TLS, oldpath, newpath uintptr) int32 {
// int dup2(int oldfd, int newfd);
func Xdup2(t *TLS, oldfd, newfd int32) int32 {
+ if __ccgo_strace {
+ trc("t=%v newfd=%v, (%v:)", t, newfd, origin(2))
+ }
panic(todo(""))
// n, _, err := unix.Syscall(unix.SYS_DUP2, uintptr(oldfd), uintptr(newfd), 0)
// if err != 0 {
@@ -377,6 +440,9 @@ func Xdup2(t *TLS, oldfd, newfd int32) int32 {
// unsigned int alarm(unsigned int seconds);
func Xalarm(t *TLS, seconds uint32) uint32 {
+ if __ccgo_strace {
+ trc("t=%v seconds=%v, (%v:)", t, seconds, origin(2))
+ }
panic(todo(""))
// n, _, err := unix.Syscall(unix.SYS_ALARM, uintptr(seconds), 0, 0)
// if err != 0 {
@@ -388,6 +454,9 @@ func Xalarm(t *TLS, seconds uint32) uint32 {
// int getnameinfo(const struct sockaddr * restrict sa, socklen_t salen, char * restrict host, socklen_t hostlen, char * restrict serv, socklen_t servlen, int flags);
func Xgetnameinfo(tls *TLS, sa1 uintptr, sl socklen_t, node uintptr, nodelen size_t, serv uintptr, servlen size_t, flags int32) int32 { /* getnameinfo.c:125:5: */
+ if __ccgo_strace {
+ trc("tls=%v sa1=%v sl=%v node=%v nodelen=%v serv=%v servlen=%v flags=%v, (%v:)", tls, sa1, sl, node, nodelen, serv, servlen, flags, origin(2))
+ }
panic(todo(""))
//TODO bp := tls.Alloc(347)
//TODO defer tls.Free(347)
@@ -487,6 +556,9 @@ func Xgetnameinfo(tls *TLS, sa1 uintptr, sl socklen_t, node uintptr, nodelen siz
}
func Xgethostbyaddr_r(tls *TLS, a uintptr, l socklen_t, af int32, h uintptr, buf uintptr, buflen size_t, res uintptr, err uintptr) int32 { /* gethostbyaddr_r.c:10:5: */
+ if __ccgo_strace {
+ trc("tls=%v a=%v l=%v af=%v h=%v buf=%v buflen=%v res=%v err=%v, (%v:)", tls, a, l, af, h, buf, buflen, res, err, origin(2))
+ }
panic(todo(""))
//TODO bp := tls.Alloc(28)
//TODO defer tls.Free(28)
@@ -574,6 +646,9 @@ func Xgethostbyaddr_r(tls *TLS, a uintptr, l socklen_t, af int32, h uintptr, buf
// int getrlimit(int resource, struct rlimit *rlim);
func Xgetrlimit64(t *TLS, resource int32, rlim uintptr) int32 {
+ if __ccgo_strace {
+ trc("t=%v resource=%v rlim=%v, (%v:)", t, resource, rlim, origin(2))
+ }
if _, _, err := unix.Syscall(unix.SYS_GETRLIMIT, uintptr(resource), uintptr(rlim), 0); err != 0 {
t.setErrno(err)
return -1
@@ -608,6 +683,9 @@ func newFtsent(t *TLS, info int, path string, stat *unix.Stat_t, err syscall.Err
// DIR *opendir(const char *name);
func Xopendir(t *TLS, name uintptr) uintptr {
+ if __ccgo_strace {
+ trc("t=%v name=%v, (%v:)", t, name, origin(2))
+ }
p := Xmalloc(t, uint64(unsafe.Sizeof(darwinDir{})))
if p == 0 {
panic("OOM")
diff --git a/vendor/modernc.org/libc/libc_openbsd_arm64.go b/vendor/modernc.org/libc/libc_openbsd_arm64.go
index 8843f989..b0dbcfa7 100644
--- a/vendor/modernc.org/libc/libc_openbsd_arm64.go
+++ b/vendor/modernc.org/libc/libc_openbsd_arm64.go
@@ -24,6 +24,9 @@ type (
// int sigaction(int signum, const struct sigaction *act, struct sigaction *oldact);
func Xsigaction(t *TLS, signum int32, act, oldact uintptr) int32 {
+ if __ccgo_strace {
+ trc("t=%v signum=%v oldact=%v, (%v:)", t, signum, oldact, origin(2))
+ }
panic(todo(""))
// if _, _, err := unix.Syscall(unix.SYS_SIGACTION, uintptr(signum), act, oldact); err != 0 {
// t.setErrno(err)
@@ -35,6 +38,9 @@ func Xsigaction(t *TLS, signum int32, act, oldact uintptr) int32 {
// FILE *fopen64(const char *pathname, const char *mode);
func Xfopen64(t *TLS, pathname, mode uintptr) uintptr {
+ if __ccgo_strace {
+ trc("t=%v mode=%v, (%v:)", t, mode, origin(2))
+ }
m := strings.ReplaceAll(GoString(mode), "b", "")
var flags int
switch m {
@@ -74,6 +80,9 @@ func Xfopen64(t *TLS, pathname, mode uintptr) uintptr {
// int lstat(const char *pathname, struct stat *statbuf);
func Xlstat64(t *TLS, pathname, statbuf uintptr) int32 {
+ if __ccgo_strace {
+ trc("t=%v statbuf=%v, (%v:)", t, statbuf, origin(2))
+ }
if err := unix.Lstat(GoString(pathname), (*unix.Stat_t)(unsafe.Pointer(statbuf))); err != nil {
if dmesgs {
dmesg("%v: %q: %v FAIL", origin(1), GoString(pathname), err)
@@ -90,6 +99,9 @@ func Xlstat64(t *TLS, pathname, statbuf uintptr) int32 {
// int stat(const char *pathname, struct stat *statbuf);
func Xstat64(t *TLS, pathname, statbuf uintptr) int32 {
+ if __ccgo_strace {
+ trc("t=%v statbuf=%v, (%v:)", t, statbuf, origin(2))
+ }
if err := unix.Stat(GoString(pathname), (*unix.Stat_t)(unsafe.Pointer(statbuf))); err != nil {
if dmesgs {
dmesg("%v: %q: %v FAIL", origin(1), GoString(pathname), err)
@@ -106,6 +118,9 @@ func Xstat64(t *TLS, pathname, statbuf uintptr) int32 {
// int mkdir(const char *path, mode_t mode);
func Xmkdir(t *TLS, path uintptr, mode types.Mode_t) int32 {
+ if __ccgo_strace {
+ trc("t=%v path=%v mode=%v, (%v:)", t, path, mode, origin(2))
+ }
if err := unix.Mkdir(GoString(path), uint32(mode)); err != nil {
if dmesgs {
dmesg("%v: %q: %v FAIL", origin(1), GoString(path), err)
@@ -122,6 +137,9 @@ func Xmkdir(t *TLS, path uintptr, mode types.Mode_t) int32 {
// int access(const char *pathname, int mode);
func Xaccess(t *TLS, pathname uintptr, mode int32) int32 {
+ if __ccgo_strace {
+ trc("t=%v pathname=%v mode=%v, (%v:)", t, pathname, mode, origin(2))
+ }
if err := unix.Access(GoString(pathname), uint32(mode)); err != nil {
if dmesgs {
dmesg("%v: %q %#o: %v FAIL", origin(1), GoString(pathname), mode, err)
@@ -138,6 +156,9 @@ func Xaccess(t *TLS, pathname uintptr, mode int32) int32 {
// int unlink(const char *pathname);
func Xunlink(t *TLS, pathname uintptr) int32 {
+ if __ccgo_strace {
+ trc("t=%v pathname=%v, (%v:)", t, pathname, origin(2))
+ }
if err := unix.Unlink(GoString(pathname)); err != nil {
if dmesgs {
dmesg("%v: %q: %v", origin(1), GoString(pathname), err)
@@ -154,6 +175,9 @@ func Xunlink(t *TLS, pathname uintptr) int32 {
// ssize_t readlink(const char *restrict path, char *restrict buf, size_t bufsize);
func Xreadlink(t *TLS, path, buf uintptr, bufsize types.Size_t) types.Ssize_t {
+ if __ccgo_strace {
+ trc("t=%v buf=%v bufsize=%v, (%v:)", t, buf, bufsize, origin(2))
+ }
var n int
var err error
switch {
@@ -178,6 +202,9 @@ func Xreadlink(t *TLS, path, buf uintptr, bufsize types.Size_t) types.Ssize_t {
// int symlink(const char *target, const char *linkpath);
func Xsymlink(t *TLS, target, linkpath uintptr) int32 {
+ if __ccgo_strace {
+ trc("t=%v linkpath=%v, (%v:)", t, linkpath, origin(2))
+ }
if err := unix.Symlink(GoString(target), GoString(linkpath)); err != nil {
if dmesgs {
dmesg("%v: %v FAIL", origin(1), err)
@@ -194,6 +221,9 @@ func Xsymlink(t *TLS, target, linkpath uintptr) int32 {
// int chmod(const char *pathname, mode_t mode)
func Xchmod(t *TLS, pathname uintptr, mode types.Mode_t) int32 {
+ if __ccgo_strace {
+ trc("t=%v pathname=%v mode=%v, (%v:)", t, pathname, mode, origin(2))
+ }
if err := unix.Chmod(GoString(pathname), uint32(mode)); err != nil {
if dmesgs {
dmesg("%v: %q %#o: %v FAIL", origin(1), GoString(pathname), mode, err)
@@ -210,6 +240,9 @@ func Xchmod(t *TLS, pathname uintptr, mode types.Mode_t) int32 {
// time_t time(time_t *tloc);
func Xtime(t *TLS, tloc uintptr) time.Time_t {
+ if __ccgo_strace {
+ trc("t=%v tloc=%v, (%v:)", t, tloc, origin(2))
+ }
panic(todo(""))
// n := time.Now().UTC().Unix()
// if tloc != 0 {
@@ -220,6 +253,9 @@ func Xtime(t *TLS, tloc uintptr) time.Time_t {
// int utimes(const char *filename, const struct timeval times[2]);
func Xutimes(t *TLS, filename, times uintptr) int32 {
+ if __ccgo_strace {
+ trc("t=%v times=%v, (%v:)", t, times, origin(2))
+ }
var a []unix.Timeval
if times != 0 {
a = make([]unix.Timeval, 2)
@@ -242,6 +278,9 @@ func Xutimes(t *TLS, filename, times uintptr) int32 {
// int fstat(int fd, struct stat *statbuf);
func Xfstat64(t *TLS, fd int32, statbuf uintptr) int32 {
+ if __ccgo_strace {
+ trc("t=%v fd=%v statbuf=%v, (%v:)", t, fd, statbuf, origin(2))
+ }
if err := unix.Fstat(int(fd), (*unix.Stat_t)(unsafe.Pointer(statbuf))); err != nil {
if dmesgs {
dmesg("%v: fd %d: %v FAIL", origin(1), fd, err)
@@ -258,6 +297,9 @@ func Xfstat64(t *TLS, fd int32, statbuf uintptr) int32 {
// off64_t lseek64(int fd, off64_t offset, int whence);
func Xlseek64(t *TLS, fd int32, offset types.Off_t, whence int32) types.Off_t {
+ if __ccgo_strace {
+ trc("t=%v fd=%v offset=%v whence=%v, (%v:)", t, fd, offset, whence, origin(2))
+ }
n, err := unix.Seek(int(fd), int64(offset), int(whence))
if err != nil {
if dmesgs {
@@ -274,6 +316,9 @@ func Xlseek64(t *TLS, fd int32, offset types.Off_t, whence int32) types.Off_t {
}
func Xfcntl64(t *TLS, fd, cmd int32, args uintptr) int32 {
+ if __ccgo_strace {
+ trc("t=%v cmd=%v args=%v, (%v:)", t, cmd, args, origin(2))
+ }
var arg uintptr
if args != 0 {
arg = *(*uintptr)(unsafe.Pointer(args))
@@ -295,6 +340,9 @@ func Xfcntl64(t *TLS, fd, cmd int32, args uintptr) int32 {
// int rename(const char *oldpath, const char *newpath);
func Xrename(t *TLS, oldpath, newpath uintptr) int32 {
+ if __ccgo_strace {
+ trc("t=%v newpath=%v, (%v:)", t, newpath, origin(2))
+ }
if err := unix.Rename(GoString(oldpath), GoString(newpath)); err != nil {
if dmesgs {
dmesg("%v: %v FAIL", origin(1), err)
@@ -311,6 +359,9 @@ func Xrename(t *TLS, oldpath, newpath uintptr) int32 {
// int mknod(const char *pathname, mode_t mode, dev_t dev);
func Xmknod(t *TLS, pathname uintptr, mode types.Mode_t, dev types.Dev_t) int32 {
+ if __ccgo_strace {
+ trc("t=%v pathname=%v mode=%v dev=%v, (%v:)", t, pathname, mode, dev, origin(2))
+ }
panic(todo(""))
// if _, _, err := unix.Syscall(unix.SYS_MKNOD, pathname, uintptr(mode), uintptr(dev)); err != 0 {
// t.setErrno(err)
@@ -322,6 +373,9 @@ func Xmknod(t *TLS, pathname uintptr, mode types.Mode_t, dev types.Dev_t) int32
// int utime(const char *filename, const struct utimbuf *times);
func Xutime(t *TLS, filename, times uintptr) int32 {
+ if __ccgo_strace {
+ trc("t=%v times=%v, (%v:)", t, times, origin(2))
+ }
var a []unix.Timeval
if times != 0 {
a = make([]unix.Timeval, 2)
@@ -344,6 +398,9 @@ func Xutime(t *TLS, filename, times uintptr) int32 {
// int chown(const char *pathname, uid_t owner, gid_t group);
func Xchown(t *TLS, pathname uintptr, owner types.Uid_t, group types.Gid_t) int32 {
+ if __ccgo_strace {
+ trc("t=%v pathname=%v owner=%v group=%v, (%v:)", t, pathname, owner, group, origin(2))
+ }
if _, _, err := unix.Syscall(unix.SYS_CHOWN, pathname, uintptr(owner), uintptr(group)); err != 0 {
t.setErrno(err)
return -1
@@ -354,6 +411,9 @@ func Xchown(t *TLS, pathname uintptr, owner types.Uid_t, group types.Gid_t) int3
// int link(const char *oldpath, const char *newpath);
func Xlink(t *TLS, oldpath, newpath uintptr) int32 {
+ if __ccgo_strace {
+ trc("t=%v newpath=%v, (%v:)", t, newpath, origin(2))
+ }
panic(todo(""))
// if _, _, err := unix.Syscall(unix.SYS_LINK, oldpath, newpath, 0); err != 0 {
// t.setErrno(err)
@@ -365,6 +425,9 @@ func Xlink(t *TLS, oldpath, newpath uintptr) int32 {
// int dup2(int oldfd, int newfd);
func Xdup2(t *TLS, oldfd, newfd int32) int32 {
+ if __ccgo_strace {
+ trc("t=%v newfd=%v, (%v:)", t, newfd, origin(2))
+ }
panic(todo(""))
// n, _, err := unix.Syscall(unix.SYS_DUP2, uintptr(oldfd), uintptr(newfd), 0)
// if err != 0 {
@@ -377,6 +440,9 @@ func Xdup2(t *TLS, oldfd, newfd int32) int32 {
// unsigned int alarm(unsigned int seconds);
func Xalarm(t *TLS, seconds uint32) uint32 {
+ if __ccgo_strace {
+ trc("t=%v seconds=%v, (%v:)", t, seconds, origin(2))
+ }
panic(todo(""))
// n, _, err := unix.Syscall(unix.SYS_ALARM, uintptr(seconds), 0, 0)
// if err != 0 {
@@ -388,6 +454,9 @@ func Xalarm(t *TLS, seconds uint32) uint32 {
// int getnameinfo(const struct sockaddr * restrict sa, socklen_t salen, char * restrict host, socklen_t hostlen, char * restrict serv, socklen_t servlen, int flags);
func Xgetnameinfo(tls *TLS, sa1 uintptr, sl socklen_t, node uintptr, nodelen size_t, serv uintptr, servlen size_t, flags int32) int32 { /* getnameinfo.c:125:5: */
+ if __ccgo_strace {
+ trc("tls=%v sa1=%v sl=%v node=%v nodelen=%v serv=%v servlen=%v flags=%v, (%v:)", tls, sa1, sl, node, nodelen, serv, servlen, flags, origin(2))
+ }
panic(todo(""))
//TODO bp := tls.Alloc(347)
//TODO defer tls.Free(347)
@@ -487,6 +556,9 @@ func Xgetnameinfo(tls *TLS, sa1 uintptr, sl socklen_t, node uintptr, nodelen siz
}
func Xgethostbyaddr_r(tls *TLS, a uintptr, l socklen_t, af int32, h uintptr, buf uintptr, buflen size_t, res uintptr, err uintptr) int32 { /* gethostbyaddr_r.c:10:5: */
+ if __ccgo_strace {
+ trc("tls=%v a=%v l=%v af=%v h=%v buf=%v buflen=%v res=%v err=%v, (%v:)", tls, a, l, af, h, buf, buflen, res, err, origin(2))
+ }
panic(todo(""))
//TODO bp := tls.Alloc(28)
//TODO defer tls.Free(28)
@@ -574,6 +646,9 @@ func Xgethostbyaddr_r(tls *TLS, a uintptr, l socklen_t, af int32, h uintptr, buf
// int getrlimit(int resource, struct rlimit *rlim);
func Xgetrlimit64(t *TLS, resource int32, rlim uintptr) int32 {
+ if __ccgo_strace {
+ trc("t=%v resource=%v rlim=%v, (%v:)", t, resource, rlim, origin(2))
+ }
if _, _, err := unix.Syscall(unix.SYS_GETRLIMIT, uintptr(resource), uintptr(rlim), 0); err != 0 {
t.setErrno(err)
return -1
@@ -608,6 +683,9 @@ func newFtsent(t *TLS, info int, path string, stat *unix.Stat_t, err syscall.Err
// DIR *opendir(const char *name);
func Xopendir(t *TLS, name uintptr) uintptr {
+ if __ccgo_strace {
+ trc("t=%v name=%v, (%v:)", t, name, origin(2))
+ }
p := Xmalloc(t, uint64(unsafe.Sizeof(darwinDir{})))
if p == 0 {
panic("OOM")
diff --git a/vendor/modernc.org/libc/libc_ppc64le.go b/vendor/modernc.org/libc/libc_ppc64le.go
new file mode 100644
index 00000000..de3e3497
--- /dev/null
+++ b/vendor/modernc.org/libc/libc_ppc64le.go
@@ -0,0 +1,38 @@
+// Copyright 2023 The Libc 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 libc // import "modernc.org/libc"
+
+import (
+ "fmt"
+ "unsafe"
+)
+
+// Byte loads are atomic on this CPU.
+func a_load_8(addr uintptr) uint32 {
+ return uint32(*(*byte)(unsafe.Pointer(addr)))
+}
+
+// int16 loads are atomic on this CPU when properly aligned.
+func a_load_16(addr uintptr) uint32 {
+ if addr&1 != 0 {
+ panic(fmt.Errorf("unaligned atomic 16 bit access at %#0x", addr))
+ }
+
+ return uint32(*(*uint16)(unsafe.Pointer(addr)))
+}
+
+// Byte sores are atomic on this CPU.
+func a_store_8(addr uintptr, b byte) {
+ *(*byte)(unsafe.Pointer(addr)) = b
+}
+
+// int16 stores are atomic on this CPU when properly aligned.
+func a_store_16(addr uintptr, n uint16) {
+ if addr&1 != 0 {
+ panic(fmt.Errorf("unaligned atomic 16 bit access at %#0x", addr))
+ }
+
+ *(*uint16)(unsafe.Pointer(addr)) = n
+}
diff --git a/vendor/modernc.org/libc/libc_riscv64.go b/vendor/modernc.org/libc/libc_riscv64.go
new file mode 100644
index 00000000..de3e3497
--- /dev/null
+++ b/vendor/modernc.org/libc/libc_riscv64.go
@@ -0,0 +1,38 @@
+// Copyright 2023 The Libc 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 libc // import "modernc.org/libc"
+
+import (
+ "fmt"
+ "unsafe"
+)
+
+// Byte loads are atomic on this CPU.
+func a_load_8(addr uintptr) uint32 {
+ return uint32(*(*byte)(unsafe.Pointer(addr)))
+}
+
+// int16 loads are atomic on this CPU when properly aligned.
+func a_load_16(addr uintptr) uint32 {
+ if addr&1 != 0 {
+ panic(fmt.Errorf("unaligned atomic 16 bit access at %#0x", addr))
+ }
+
+ return uint32(*(*uint16)(unsafe.Pointer(addr)))
+}
+
+// Byte sores are atomic on this CPU.
+func a_store_8(addr uintptr, b byte) {
+ *(*byte)(unsafe.Pointer(addr)) = b
+}
+
+// int16 stores are atomic on this CPU when properly aligned.
+func a_store_16(addr uintptr, n uint16) {
+ if addr&1 != 0 {
+ panic(fmt.Errorf("unaligned atomic 16 bit access at %#0x", addr))
+ }
+
+ *(*uint16)(unsafe.Pointer(addr)) = n
+}
diff --git a/vendor/modernc.org/libc/libc_s390x.go b/vendor/modernc.org/libc/libc_s390x.go
new file mode 100644
index 00000000..de3e3497
--- /dev/null
+++ b/vendor/modernc.org/libc/libc_s390x.go
@@ -0,0 +1,38 @@
+// Copyright 2023 The Libc 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 libc // import "modernc.org/libc"
+
+import (
+ "fmt"
+ "unsafe"
+)
+
+// Byte loads are atomic on this CPU.
+func a_load_8(addr uintptr) uint32 {
+ return uint32(*(*byte)(unsafe.Pointer(addr)))
+}
+
+// int16 loads are atomic on this CPU when properly aligned.
+func a_load_16(addr uintptr) uint32 {
+ if addr&1 != 0 {
+ panic(fmt.Errorf("unaligned atomic 16 bit access at %#0x", addr))
+ }
+
+ return uint32(*(*uint16)(unsafe.Pointer(addr)))
+}
+
+// Byte sores are atomic on this CPU.
+func a_store_8(addr uintptr, b byte) {
+ *(*byte)(unsafe.Pointer(addr)) = b
+}
+
+// int16 stores are atomic on this CPU when properly aligned.
+func a_store_16(addr uintptr, n uint16) {
+ if addr&1 != 0 {
+ panic(fmt.Errorf("unaligned atomic 16 bit access at %#0x", addr))
+ }
+
+ *(*uint16)(unsafe.Pointer(addr)) = n
+}
diff --git a/vendor/modernc.org/libc/libc_unix.go b/vendor/modernc.org/libc/libc_unix.go
index 085c86b3..5d251d3e 100644
--- a/vendor/modernc.org/libc/libc_unix.go
+++ b/vendor/modernc.org/libc/libc_unix.go
@@ -9,7 +9,7 @@ package libc // import "modernc.org/libc"
import (
"bufio"
- "encoding/hex"
+ // "encoding/hex"
"io/ioutil"
"math"
"math/rand"
@@ -44,6 +44,9 @@ func init() {
// sighandler_t signal(int signum, sighandler_t handler);
func Xsignal(t *TLS, signum int32, handler uintptr) uintptr { //TODO use sigaction?
+ if __ccgo_strace {
+ trc("t=%v signum=%v handler=%v, (%v:)", t, signum, handler, origin(2))
+ }
signalsMu.Lock()
defer signalsMu.Unlock()
@@ -88,11 +91,17 @@ func Xsignal(t *TLS, signum int32, handler uintptr) uintptr { //TODO use sigacti
// void rewind(FILE *stream);
func Xrewind(t *TLS, stream uintptr) {
+ if __ccgo_strace {
+ trc("t=%v stream=%v, (%v:)", t, stream, origin(2))
+ }
Xfseek(t, stream, 0, stdio.SEEK_SET)
}
// int putchar(int c);
func Xputchar(t *TLS, c int32) int32 {
+ if __ccgo_strace {
+ trc("t=%v c=%v, (%v:)", t, c, origin(2))
+ }
if _, err := write([]byte{byte(c)}); err != nil {
return stdio.EOF
}
@@ -102,6 +111,9 @@ func Xputchar(t *TLS, c int32) int32 {
// int gethostname(char *name, size_t len);
func Xgethostname(t *TLS, name uintptr, slen types.Size_t) int32 {
+ if __ccgo_strace {
+ trc("t=%v name=%v slen=%v, (%v:)", t, name, slen, origin(2))
+ }
if slen < 0 {
t.setErrno(errno.EINVAL)
return -1
@@ -128,41 +140,65 @@ func Xgethostname(t *TLS, name uintptr, slen types.Size_t) int32 {
// int remove(const char *pathname);
func Xremove(t *TLS, pathname uintptr) int32 {
+ if __ccgo_strace {
+ trc("t=%v pathname=%v, (%v:)", t, pathname, origin(2))
+ }
panic(todo(""))
}
// long pathconf(const char *path, int name);
func Xpathconf(t *TLS, path uintptr, name int32) long {
+ if __ccgo_strace {
+ trc("t=%v path=%v name=%v, (%v:)", t, path, name, origin(2))
+ }
panic(todo(""))
}
// ssize_t recvfrom(int sockfd, void *buf, size_t len, int flags, struct sockaddr *src_addr, socklen_t *addrlen);
func Xrecvfrom(t *TLS, sockfd int32, buf uintptr, len types.Size_t, flags int32, src_addr, addrlen uintptr) types.Ssize_t {
+ if __ccgo_strace {
+ trc("t=%v sockfd=%v buf=%v len=%v flags=%v addrlen=%v, (%v:)", t, sockfd, buf, len, flags, addrlen, origin(2))
+ }
panic(todo(""))
}
// ssize_t sendto(int sockfd, const void *buf, size_t len, int flags, const struct sockaddr *dest_addr, socklen_t addrlen);
func Xsendto(t *TLS, sockfd int32, buf uintptr, len types.Size_t, flags int32, src_addr uintptr, addrlen socklen_t) types.Ssize_t {
+ if __ccgo_strace {
+ trc("t=%v sockfd=%v buf=%v len=%v flags=%v src_addr=%v addrlen=%v, (%v:)", t, sockfd, buf, len, flags, src_addr, addrlen, origin(2))
+ }
panic(todo(""))
}
// void srand48(long int seedval);
func Xsrand48(t *TLS, seedval long) {
+ if __ccgo_strace {
+ trc("t=%v seedval=%v, (%v:)", t, seedval, origin(2))
+ }
panic(todo(""))
}
// long int lrand48(void);
func Xlrand48(t *TLS) long {
+ if __ccgo_strace {
+ trc("t=%v, (%v:)", t, origin(2))
+ }
panic(todo(""))
}
// ssize_t sendmsg(int sockfd, const struct msghdr *msg, int flags);
func Xsendmsg(t *TLS, sockfd int32, msg uintptr, flags int32) types.Ssize_t {
+ if __ccgo_strace {
+ trc("t=%v sockfd=%v msg=%v flags=%v, (%v:)", t, sockfd, msg, flags, origin(2))
+ }
panic(todo(""))
}
// int poll(struct pollfd *fds, nfds_t nfds, int timeout);
func Xpoll(t *TLS, fds uintptr, nfds poll.Nfds_t, timeout int32) int32 {
+ if __ccgo_strace {
+ trc("t=%v fds=%v nfds=%v timeout=%v, (%v:)", t, fds, nfds, timeout, origin(2))
+ }
if nfds == 0 {
panic(todo(""))
}
@@ -184,6 +220,9 @@ func Xpoll(t *TLS, fds uintptr, nfds poll.Nfds_t, timeout int32) int32 {
// ssize_t recvmsg(int sockfd, struct msghdr *msg, int flags);
func Xrecvmsg(t *TLS, sockfd int32, msg uintptr, flags int32) types.Ssize_t {
+ if __ccgo_strace {
+ trc("t=%v sockfd=%v msg=%v flags=%v, (%v:)", t, sockfd, msg, flags, origin(2))
+ }
n, _, err := unix.Syscall(unix.SYS_RECVMSG, uintptr(sockfd), msg, uintptr(flags))
if err != 0 {
t.setErrno(err)
@@ -195,51 +234,81 @@ func Xrecvmsg(t *TLS, sockfd int32, msg uintptr, flags int32) types.Ssize_t {
// struct cmsghdr *CMSG_NXTHDR(struct msghdr *msgh, struct cmsghdr *cmsg);
func X__cmsg_nxthdr(t *TLS, msgh, cmsg uintptr) uintptr {
+ if __ccgo_strace {
+ trc("t=%v cmsg=%v, (%v:)", t, cmsg, origin(2))
+ }
panic(todo(""))
}
// wchar_t *wcschr(const wchar_t *wcs, wchar_t wc);
func Xwcschr(t *TLS, wcs uintptr, wc wchar_t) wchar_t {
+ if __ccgo_strace {
+ trc("t=%v wcs=%v wc=%v, (%v:)", t, wcs, wc, origin(2))
+ }
panic(todo(""))
}
// gid_t getegid(void);
func Xgetegid(t *TLS) types.Gid_t {
+ if __ccgo_strace {
+ trc("t=%v, (%v:)", t, origin(2))
+ }
panic(todo(""))
}
// gid_t getgid(void);
func Xgetgid(t *TLS) types.Gid_t {
+ if __ccgo_strace {
+ trc("t=%v, (%v:)", t, origin(2))
+ }
panic(todo(""))
}
// void *shmat(int shmid, const void *shmaddr, int shmflg);
func Xshmat(t *TLS, shmid int32, shmaddr uintptr, shmflg int32) uintptr {
+ if __ccgo_strace {
+ trc("t=%v shmid=%v shmaddr=%v shmflg=%v, (%v:)", t, shmid, shmaddr, shmflg, origin(2))
+ }
panic(todo(""))
}
// int shmctl(int shmid, int cmd, struct shmid_ds *buf);
func Xshmctl(t *TLS, shmid, cmd int32, buf uintptr) int32 {
+ if __ccgo_strace {
+ trc("t=%v cmd=%v buf=%v, (%v:)", t, cmd, buf, origin(2))
+ }
panic(todo(""))
}
// int shmdt(const void *shmaddr);
func Xshmdt(t *TLS, shmaddr uintptr) int32 {
+ if __ccgo_strace {
+ trc("t=%v shmaddr=%v, (%v:)", t, shmaddr, origin(2))
+ }
panic(todo(""))
}
// int getresuid(uid_t *ruid, uid_t *euid, uid_t *suid);
func Xgetresuid(t *TLS, ruid, euid, suid uintptr) int32 {
+ if __ccgo_strace {
+ trc("t=%v suid=%v, (%v:)", t, suid, origin(2))
+ }
panic(todo(""))
}
// int getresgid(gid_t *rgid, gid_t *egid, gid_t *sgid);
func Xgetresgid(t *TLS, rgid, egid, sgid uintptr) int32 {
+ if __ccgo_strace {
+ trc("t=%v sgid=%v, (%v:)", t, sgid, origin(2))
+ }
panic(todo(""))
}
// FILE *tmpfile(void);
func Xtmpfile(t *TLS) uintptr {
+ if __ccgo_strace {
+ trc("t=%v, (%v:)", t, origin(2))
+ }
f, err := ioutil.TempFile("", "tmpfile-")
if err != nil {
t.setErrno(err)
@@ -258,6 +327,9 @@ func Xtmpfile(t *TLS) uintptr {
// FILE *fdopen(int fd, const char *mode);
func Xfdopen(t *TLS, fd int32, mode uintptr) uintptr {
+ if __ccgo_strace {
+ trc("t=%v fd=%v mode=%v, (%v:)", t, fd, mode, origin(2))
+ }
m := strings.ReplaceAll(GoString(mode), "b", "")
switch m {
case
@@ -282,6 +354,9 @@ func Xfdopen(t *TLS, fd int32, mode uintptr) uintptr {
// struct passwd *getpwnam(const char *name);
func Xgetpwnam(t *TLS, name uintptr) uintptr {
+ if __ccgo_strace {
+ trc("t=%v name=%v, (%v:)", t, name, origin(2))
+ }
f, err := os.Open("/etc/passwd")
if err != nil {
panic(todo("", err))
@@ -334,6 +409,9 @@ func Xgetpwnam(t *TLS, name uintptr) uintptr {
// int getpwnam_r(char *name, struct passwd *pwd, char *buf, size_t buflen, struct passwd **result);
func Xgetpwnam_r(t *TLS, name, cpwd, buf uintptr, buflen types.Size_t, result uintptr) int32 {
+ if __ccgo_strace {
+ trc("t=%v buf=%v buflen=%v result=%v, (%v:)", t, buf, buflen, result, origin(2))
+ }
f, err := os.Open("/etc/passwd")
if err != nil {
panic(todo("", err))
@@ -399,6 +477,9 @@ var staticGetgrgid grp.Group
// struct group *getgrgid(gid_t gid);
func Xgetgrgid(t *TLS, gid uint32) uintptr {
+ if __ccgo_strace {
+ trc("t=%v gid=%v, (%v:)", t, gid, origin(2))
+ }
f, err := os.Open("/etc/group")
if err != nil {
panic(todo(""))
@@ -440,6 +521,9 @@ func Xgetgrgid(t *TLS, gid uint32) uintptr {
// int getgrgid_r(gid_t gid, struct group *grp, char *buf, size_t buflen, struct group **result);
func Xgetgrgid_r(t *TLS, gid uint32, pGrp, buf uintptr, buflen types.Size_t, result uintptr) int32 {
+ if __ccgo_strace {
+ trc("t=%v gid=%v buf=%v buflen=%v result=%v, (%v:)", t, gid, buf, buflen, result, origin(2))
+ }
f, err := os.Open("/etc/group")
if err != nil {
panic(todo(""))
@@ -626,6 +710,9 @@ func init() {
// struct passwd *getpwuid(uid_t uid);
func Xgetpwuid(t *TLS, uid uint32) uintptr {
+ if __ccgo_strace {
+ trc("t=%v uid=%v, (%v:)", t, uid, origin(2))
+ }
f, err := os.Open("/etc/passwd")
if err != nil {
panic(todo("", err))
@@ -688,6 +775,9 @@ func initPasswd(t *TLS, p *pwd.Passwd, name, pwd string, uid, gid uint32, gecos,
// struct group *getgrnam(const char *name);
func Xgetgrnam(t *TLS, name uintptr) uintptr {
+ if __ccgo_strace {
+ trc("t=%v name=%v, (%v:)", t, name, origin(2))
+ }
f, err := os.Open("/etc/group")
if err != nil {
panic(todo(""))
@@ -734,6 +824,9 @@ func Xgetgrnam(t *TLS, name uintptr) uintptr {
// int getgrnam_r(const char *name, struct group *grp, char *buf, size_t buflen, struct group **result);
func Xgetgrnam_r(t *TLS, name, pGrp, buf uintptr, buflen types.Size_t, result uintptr) int32 {
+ if __ccgo_strace {
+ trc("t=%v buf=%v buflen=%v result=%v, (%v:)", t, buf, buflen, result, origin(2))
+ }
f, err := os.Open("/etc/group")
if err != nil {
panic(todo(""))
@@ -787,6 +880,9 @@ func Xgetgrnam_r(t *TLS, name, pGrp, buf uintptr, buflen types.Size_t, result ui
// int getpwuid_r(uid_t uid, struct passwd *pwd, char *buf, size_t buflen, struct passwd **result);
func Xgetpwuid_r(t *TLS, uid types.Uid_t, cpwd, buf uintptr, buflen types.Size_t, result uintptr) int32 {
+ if __ccgo_strace {
+ trc("t=%v uid=%v buf=%v buflen=%v result=%v, (%v:)", t, uid, buf, buflen, result, origin(2))
+ }
f, err := os.Open("/etc/passwd")
if err != nil {
panic(todo("", err))
@@ -846,6 +942,9 @@ func Xgetpwuid_r(t *TLS, uid types.Uid_t, cpwd, buf uintptr, buflen types.Size_t
// int mkostemp(char *template, int flags);
func Xmkostemp(t *TLS, template uintptr, flags int32) int32 {
+ if __ccgo_strace {
+ trc("t=%v template=%v flags=%v, (%v:)", t, template, flags, origin(2))
+ }
len := uintptr(Xstrlen(t, template))
x := template + uintptr(len-6)
for i := uintptr(0); i < 6; i++ {
@@ -866,12 +965,18 @@ func Xmkostemp(t *TLS, template uintptr, flags int32) int32 {
// void uuid_generate_random(uuid_t out);
func Xuuid_generate_random(t *TLS, out uintptr) {
+ if __ccgo_strace {
+ trc("t=%v out=%v, (%v:)", t, out, origin(2))
+ }
x := guuid.New()
copy((*RawMem)(unsafe.Pointer(out))[:], x[:])
}
// void uuid_unparse(uuid_t uu, char *out);
func Xuuid_unparse(t *TLS, uu, out uintptr) {
+ if __ccgo_strace {
+ trc("t=%v out=%v, (%v:)", t, out, origin(2))
+ }
s := (*guuid.UUID)(unsafe.Pointer(uu)).String()
copy((*RawMem)(unsafe.Pointer(out))[:], s)
*(*byte)(unsafe.Pointer(out + uintptr(len(s)))) = 0
@@ -881,12 +986,18 @@ var staticRandomData = &rand.Rand{}
// char *initstate(unsigned seed, char *state, size_t size);
func Xinitstate(t *TLS, seed uint32, statebuf uintptr, statelen types.Size_t) uintptr {
+ if __ccgo_strace {
+ trc("t=%v seed=%v statebuf=%v statelen=%v, (%v:)", t, seed, statebuf, statelen, origin(2))
+ }
staticRandomData = rand.New(rand.NewSource(int64(seed)))
return 0
}
// char *setstate(const char *state);
func Xsetstate(t *TLS, state uintptr) uintptr {
+ if __ccgo_strace {
+ trc("t=%v state=%v, (%v:)", t, state, origin(2))
+ }
t.setErrno(errno.EINVAL) //TODO
return 0
}
@@ -902,6 +1013,9 @@ func Xsetstate(t *TLS, state uintptr) uintptr {
//
// char *initstate_r(unsigned int seed, char *statebuf, size_t statelen, struct random_data *buf);
func Xinitstate_r(t *TLS, seed uint32, statebuf uintptr, statelen types.Size_t, buf uintptr) int32 {
+ if __ccgo_strace {
+ trc("t=%v seed=%v statebuf=%v statelen=%v buf=%v, (%v:)", t, seed, statebuf, statelen, buf, origin(2))
+ }
if buf == 0 {
panic(todo(""))
}
@@ -921,11 +1035,17 @@ var (
// int mkstemps(char *template, int suffixlen);
func Xmkstemps(t *TLS, template uintptr, suffixlen int32) int32 {
+ if __ccgo_strace {
+ trc("t=%v template=%v suffixlen=%v, (%v:)", t, template, suffixlen, origin(2))
+ }
return Xmkstemps64(t, template, suffixlen)
}
// int mkstemps(char *template, int suffixlen);
func Xmkstemps64(t *TLS, template uintptr, suffixlen int32) int32 {
+ if __ccgo_strace {
+ trc("t=%v template=%v suffixlen=%v, (%v:)", t, template, suffixlen, origin(2))
+ }
len := uintptr(Xstrlen(t, template))
x := template + uintptr(len-6) - uintptr(suffixlen)
for i := uintptr(0); i < 6; i++ {
@@ -946,16 +1066,25 @@ func Xmkstemps64(t *TLS, template uintptr, suffixlen int32) int32 {
// int mkstemp(char *template);
func Xmkstemp(t *TLS, template uintptr) int32 {
+ if __ccgo_strace {
+ trc("t=%v template=%v, (%v:)", t, template, origin(2))
+ }
return Xmkstemp64(t, template)
}
// int mkstemp(char *template);
func Xmkstemp64(t *TLS, template uintptr) int32 {
+ if __ccgo_strace {
+ trc("t=%v template=%v, (%v:)", t, template, origin(2))
+ }
return Xmkstemps64(t, template, 0)
}
// int random_r(struct random_data *buf, int32_t *result);
func Xrandom_r(t *TLS, buf, result uintptr) int32 {
+ if __ccgo_strace {
+ trc("t=%v result=%v, (%v:)", t, result, origin(2))
+ }
randomDataMu.Lock()
defer randomDataMu.Unlock()
@@ -970,11 +1099,17 @@ func Xrandom_r(t *TLS, buf, result uintptr) int32 {
// int strerror_r(int errnum, char *buf, size_t buflen);
func Xstrerror_r(t *TLS, errnum int32, buf uintptr, buflen size_t) int32 {
+ if __ccgo_strace {
+ trc("t=%v errnum=%v buf=%v buflen=%v, (%v:)", t, errnum, buf, buflen, origin(2))
+ }
panic(todo(""))
}
// void endpwent(void);
func Xendpwent(t *TLS) {
+ if __ccgo_strace {
+ trc("t=%v, (%v:)", t, origin(2))
+ }
// nop
}
@@ -982,11 +1117,17 @@ var ctimeStaticBuf [32]byte
// char *ctime(const time_t *timep);
func Xctime(t *TLS, timep uintptr) uintptr {
+ if __ccgo_strace {
+ trc("t=%v timep=%v, (%v:)", t, timep, origin(2))
+ }
return Xctime_r(t, timep, uintptr(unsafe.Pointer(&ctimeStaticBuf[0])))
}
// char *ctime_r(const time_t *timep, char *buf);
func Xctime_r(t *TLS, timep, buf uintptr) uintptr {
+ if __ccgo_strace {
+ trc("t=%v buf=%v, (%v:)", t, buf, origin(2))
+ }
ut := *(*ctime.Time_t)(unsafe.Pointer(timep))
tm := time.Unix(int64(ut), 0).Local()
s := tm.Format(time.ANSIC) + "\n\x00"
@@ -996,6 +1137,9 @@ func Xctime_r(t *TLS, timep, buf uintptr) uintptr {
// ssize_t pread(int fd, void *buf, size_t count, off_t offset);
func Xpread(t *TLS, fd int32, buf uintptr, count types.Size_t, offset types.Off_t) types.Ssize_t {
+ if __ccgo_strace {
+ trc("t=%v fd=%v buf=%v count=%v offset=%v, (%v:)", t, fd, buf, count, offset, origin(2))
+ }
var n int
var err error
switch {
@@ -1003,20 +1147,20 @@ func Xpread(t *TLS, fd int32, buf uintptr, count types.Size_t, offset types.Off_
n, err = unix.Pread(int(fd), nil, int64(offset))
default:
n, err = unix.Pread(int(fd), (*RawMem)(unsafe.Pointer(buf))[:count:count], int64(offset))
- if dmesgs && err == nil {
- dmesg("%v: fd %v, off %#x, count %#x, n %#x\n%s", origin(1), fd, offset, count, n, hex.Dump((*RawMem)(unsafe.Pointer(buf))[:n:n]))
- }
+ // if dmesgs && err == nil {
+ // dmesg("%v: fd %v, off %#x, count %#x, n %#x\n%s", origin(1), fd, offset, count, n, hex.Dump((*RawMem)(unsafe.Pointer(buf))[:n:n]))
+ // }
}
if err != nil {
- if dmesgs {
- dmesg("%v: %v FAIL", origin(1), err)
- }
+ // if dmesgs {
+ // dmesg("%v: %v FAIL", origin(1), err)
+ // }
t.setErrno(err)
return -1
}
- if dmesgs {
- dmesg("%v: ok", origin(1))
- }
+ // if dmesgs {
+ // dmesg("%v: ok", origin(1))
+ // }
return types.Ssize_t(n)
}
diff --git a/vendor/modernc.org/libc/libc_windows.go b/vendor/modernc.org/libc/libc_windows.go
index fc36dc5a..81f4078b 100644
--- a/vendor/modernc.org/libc/libc_windows.go
+++ b/vendor/modernc.org/libc/libc_windows.go
@@ -344,6 +344,9 @@ func fwrite(fd int32, b []byte) (int, error) {
// int fprintf(FILE *stream, const char *format, ...);
func Xfprintf(t *TLS, stream, format, args uintptr) int32 {
+ if __ccgo_strace {
+ trc("t=%v args=%v, (%v:)", t, args, origin(2))
+ }
f, ok := winGetObject(stream).(*file)
if !ok {
t.setErrno(errno.EBADF)
@@ -356,12 +359,18 @@ func Xfprintf(t *TLS, stream, format, args uintptr) int32 {
// int usleep(useconds_t usec);
func Xusleep(t *TLS, usec types.Useconds_t) int32 {
+ if __ccgo_strace {
+ trc("t=%v usec=%v, (%v:)", t, usec, origin(2))
+ }
gotime.Sleep(gotime.Microsecond * gotime.Duration(usec))
return 0
}
// int getrusage(int who, struct rusage *usage);
func Xgetrusage(t *TLS, who int32, usage uintptr) int32 {
+ if __ccgo_strace {
+ trc("t=%v who=%v usage=%v, (%v:)", t, who, usage, origin(2))
+ }
panic(todo(""))
// if _, _, err := unix.Syscall(unix.SYS_GETRUSAGE, uintptr(who), usage, 0); err != 0 {
// t.setErrno(err)
@@ -373,16 +382,25 @@ func Xgetrusage(t *TLS, who int32, usage uintptr) int32 {
// int lstat(const char *pathname, struct stat *statbuf);
func Xlstat(t *TLS, pathname, statbuf uintptr) int32 {
+ if __ccgo_strace {
+ trc("t=%v statbuf=%v, (%v:)", t, statbuf, origin(2))
+ }
return Xlstat64(t, pathname, statbuf)
}
// int stat(const char *pathname, struct stat *statbuf);
func Xstat(t *TLS, pathname, statbuf uintptr) int32 {
+ if __ccgo_strace {
+ trc("t=%v statbuf=%v, (%v:)", t, statbuf, origin(2))
+ }
return Xstat64(t, pathname, statbuf)
}
// int chdir(const char *path);
func Xchdir(t *TLS, path uintptr) int32 {
+ if __ccgo_strace {
+ trc("t=%v path=%v, (%v:)", t, path, origin(2))
+ }
err := syscall.Chdir(GoString(path))
if err != nil {
t.setErrno(err)
@@ -445,6 +463,9 @@ func Xlocaltime_r(_ *TLS, timep, result uintptr) uintptr {
//
// );
func X_wopen(t *TLS, pathname uintptr, flags int32, args uintptr) int32 {
+ if __ccgo_strace {
+ trc("t=%v pathname=%v flags=%v args=%v, (%v:)", t, pathname, flags, args, origin(2))
+ }
var mode types.Mode_t
if args != 0 {
mode = *(*types.Mode_t)(unsafe.Pointer(args))
@@ -469,11 +490,17 @@ func X_wopen(t *TLS, pathname uintptr, flags int32, args uintptr) int32 {
// int open(const char *pathname, int flags, ...);
func Xopen(t *TLS, pathname uintptr, flags int32, args uintptr) int32 {
+ if __ccgo_strace {
+ trc("t=%v pathname=%v flags=%v args=%v, (%v:)", t, pathname, flags, args, origin(2))
+ }
return Xopen64(t, pathname, flags, args)
}
// int open(const char *pathname, int flags, ...);
func Xopen64(t *TLS, pathname uintptr, flags int32, cmode uintptr) int32 {
+ if __ccgo_strace {
+ trc("t=%v pathname=%v flags=%v cmode=%v, (%v:)", t, pathname, flags, cmode, origin(2))
+ }
var mode types.Mode_t
if cmode != 0 {
@@ -500,6 +527,9 @@ func Xopen64(t *TLS, pathname uintptr, flags int32, cmode uintptr) int32 {
// off_t lseek(int fd, off_t offset, int whence);
func Xlseek(t *TLS, fd int32, offset types.Off_t, whence int32) types.Off_t {
+ if __ccgo_strace {
+ trc("t=%v fd=%v offset=%v whence=%v, (%v:)", t, fd, offset, whence, origin(2))
+ }
return types.Off_t(Xlseek64(t, fd, offset, whence))
}
@@ -520,6 +550,9 @@ var fsyncStatbuf stat.Stat
// int fsync(int fd);
func Xfsync(t *TLS, fd int32) int32 {
+ if __ccgo_strace {
+ trc("t=%v fd=%v, (%v:)", t, fd, origin(2))
+ }
f, ok := fdToFile(fd)
if !ok {
@@ -540,6 +573,9 @@ func Xfsync(t *TLS, fd int32) int32 {
// long sysconf(int name);
func Xsysconf(t *TLS, name int32) long {
+ if __ccgo_strace {
+ trc("t=%v name=%v, (%v:)", t, name, origin(2))
+ }
panic(todo(""))
// switch name {
// case unistd.X_SC_PAGESIZE:
@@ -551,6 +587,9 @@ func Xsysconf(t *TLS, name int32) long {
// int close(int fd);
func Xclose(t *TLS, fd int32) int32 {
+ if __ccgo_strace {
+ trc("t=%v fd=%v, (%v:)", t, fd, origin(2))
+ }
f, ok := fdToFile(fd)
if !ok {
@@ -572,6 +611,9 @@ func Xclose(t *TLS, fd int32) int32 {
// char *getcwd(char *buf, size_t size);
func Xgetcwd(t *TLS, buf uintptr, size types.Size_t) uintptr {
+ if __ccgo_strace {
+ trc("t=%v buf=%v size=%v, (%v:)", t, buf, size, origin(2))
+ }
b := make([]uint16, size)
n, err := syscall.GetCurrentDirectory(uint32(len(b)), &b[0])
@@ -597,16 +639,25 @@ func Xgetcwd(t *TLS, buf uintptr, size types.Size_t) uintptr {
// int fstat(int fd, struct stat *statbuf);
func Xfstat(t *TLS, fd int32, statbuf uintptr) int32 {
+ if __ccgo_strace {
+ trc("t=%v fd=%v statbuf=%v, (%v:)", t, fd, statbuf, origin(2))
+ }
return Xfstat64(t, fd, statbuf)
}
// int ftruncate(int fd, off_t length);
func Xftruncate(t *TLS, fd int32, length types.Off_t) int32 {
+ if __ccgo_strace {
+ trc("t=%v fd=%v length=%v, (%v:)", t, fd, length, origin(2))
+ }
return Xftruncate64(t, fd, length)
}
// int fcntl(int fd, int cmd, ... /* arg */ );
func Xfcntl(t *TLS, fd, cmd int32, args uintptr) int32 {
+ if __ccgo_strace {
+ trc("t=%v cmd=%v args=%v, (%v:)", t, cmd, args, origin(2))
+ }
return Xfcntl64(t, fd, cmd, args)
}
@@ -618,6 +669,9 @@ func Xfcntl(t *TLS, fd, cmd int32, args uintptr) int32 {
//
// );
func Xread(t *TLS, fd int32, buf uintptr, count uint32) int32 {
+ if __ccgo_strace {
+ trc("t=%v fd=%v buf=%v count=%v, (%v:)", t, fd, buf, count, origin(2))
+ }
f, ok := fdToFile(fd)
if !ok {
t.setErrno(errno.EBADF)
@@ -646,6 +700,9 @@ func Xread(t *TLS, fd int32, buf uintptr, count uint32) int32 {
//
// );
func Xwrite(t *TLS, fd int32, buf uintptr, count uint32) int32 {
+ if __ccgo_strace {
+ trc("t=%v fd=%v buf=%v count=%v, (%v:)", t, fd, buf, count, origin(2))
+ }
f, ok := fdToFile(fd)
if !ok {
t.setErrno(errno.EBADF)
@@ -671,6 +728,9 @@ func Xwrite(t *TLS, fd int32, buf uintptr, count uint32) int32 {
// int fchmod(int fd, mode_t mode);
func Xfchmod(t *TLS, fd int32, mode types.Mode_t) int32 {
+ if __ccgo_strace {
+ trc("t=%v fd=%v mode=%v, (%v:)", t, fd, mode, origin(2))
+ }
panic(todo(""))
// if _, _, err := unix.Syscall(unix.SYS_FCHMOD, uintptr(fd), uintptr(mode), 0); err != 0 {
// t.setErrno(err)
@@ -701,6 +761,9 @@ func Xfchmod(t *TLS, fd int32, mode types.Mode_t) int32 {
// int munmap(void *addr, size_t length);
func Xmunmap(t *TLS, addr uintptr, length types.Size_t) int32 {
+ if __ccgo_strace {
+ trc("t=%v addr=%v length=%v, (%v:)", t, addr, length, origin(2))
+ }
panic(todo(""))
// if _, _, err := unix.Syscall(unix.SYS_MUNMAP, addr, uintptr(length), 0); err != 0 {
// t.setErrno(err)
@@ -712,6 +775,9 @@ func Xmunmap(t *TLS, addr uintptr, length types.Size_t) int32 {
// int gettimeofday(struct timeval *tv, struct timezone *tz);
func Xgettimeofday(t *TLS, tv, tz uintptr) int32 {
+ if __ccgo_strace {
+ trc("t=%v tz=%v, (%v:)", t, tz, origin(2))
+ }
panic(todo(""))
// if tz != 0 {
// panic(todo(""))
@@ -746,6 +812,9 @@ func Xsetsockopt(t *TLS, _ ...interface{}) int32 {
// int ioctl(int fd, unsigned long request, ...);
func Xioctl(t *TLS, fd int32, request ulong, va uintptr) int32 {
+ if __ccgo_strace {
+ trc("t=%v fd=%v request=%v va=%v, (%v:)", t, fd, request, va, origin(2))
+ }
panic(todo(""))
// var argp uintptr
// if va != 0 {
@@ -762,6 +831,9 @@ func Xioctl(t *TLS, fd int32, request ulong, va uintptr) int32 {
// int select(int nfds, fd_set *readfds, fd_set *writefds, fd_set *exceptfds, struct timeval *timeout);
func Xselect(t *TLS, nfds int32, readfds, writefds, exceptfds, timeout uintptr) int32 {
+ if __ccgo_strace {
+ trc("t=%v nfds=%v timeout=%v, (%v:)", t, nfds, timeout, origin(2))
+ }
panic(todo(""))
// n, err := unix.Select(
// int(nfds),
@@ -780,6 +852,9 @@ func Xselect(t *TLS, nfds int32, readfds, writefds, exceptfds, timeout uintptr)
// int mkfifo(const char *pathname, mode_t mode);
func Xmkfifo(t *TLS, pathname uintptr, mode types.Mode_t) int32 {
+ if __ccgo_strace {
+ trc("t=%v pathname=%v mode=%v, (%v:)", t, pathname, mode, origin(2))
+ }
panic(todo(""))
// if err := unix.Mkfifo(GoString(pathname), mode); err != nil {
// t.setErrno(err)
@@ -791,6 +866,9 @@ func Xmkfifo(t *TLS, pathname uintptr, mode types.Mode_t) int32 {
// mode_t umask(mode_t mask);
func Xumask(t *TLS, mask types.Mode_t) types.Mode_t {
+ if __ccgo_strace {
+ trc("t=%v mask=%v, (%v:)", t, mask, origin(2))
+ }
panic(todo(""))
// n, _, _ := unix.Syscall(unix.SYS_UMASK, uintptr(mask), 0, 0)
// return types.Mode_t(n)
@@ -798,6 +876,9 @@ func Xumask(t *TLS, mask types.Mode_t) types.Mode_t {
// int execvp(const char *file, char *const argv[]);
func Xexecvp(t *TLS, file, argv uintptr) int32 {
+ if __ccgo_strace {
+ trc("t=%v argv=%v, (%v:)", t, argv, origin(2))
+ }
panic(todo(""))
// if _, _, err := unix.Syscall(unix.SYS_EXECVE, file, argv, Environ()); err != 0 {
// t.setErrno(err)
@@ -809,6 +890,9 @@ func Xexecvp(t *TLS, file, argv uintptr) int32 {
// pid_t waitpid(pid_t pid, int *wstatus, int options);
func Xwaitpid(t *TLS, pid types.Pid_t, wstatus uintptr, optname int32) types.Pid_t {
+ if __ccgo_strace {
+ trc("t=%v pid=%v wstatus=%v optname=%v, (%v:)", t, pid, wstatus, optname, origin(2))
+ }
panic(todo(""))
// n, _, err := unix.Syscall6(unix.SYS_WAIT4, uintptr(pid), wstatus, uintptr(optname), 0, 0, 0)
// if err != 0 {
@@ -821,6 +905,9 @@ func Xwaitpid(t *TLS, pid types.Pid_t, wstatus uintptr, optname int32) types.Pid
// int uname(struct utsname *buf);
func Xuname(t *TLS, buf uintptr) int32 {
+ if __ccgo_strace {
+ trc("t=%v buf=%v, (%v:)", t, buf, origin(2))
+ }
panic(todo(""))
// if _, _, err := unix.Syscall(unix.SYS_UNAME, buf, 0, 0); err != 0 {
// t.setErrno(err)
@@ -832,16 +919,25 @@ func Xuname(t *TLS, buf uintptr) int32 {
// int getrlimit(int resource, struct rlimit *rlim);
func Xgetrlimit(t *TLS, resource int32, rlim uintptr) int32 {
+ if __ccgo_strace {
+ trc("t=%v resource=%v rlim=%v, (%v:)", t, resource, rlim, origin(2))
+ }
return Xgetrlimit64(t, resource, rlim)
}
// int setrlimit(int resource, const struct rlimit *rlim);
func Xsetrlimit(t *TLS, resource int32, rlim uintptr) int32 {
+ if __ccgo_strace {
+ trc("t=%v resource=%v rlim=%v, (%v:)", t, resource, rlim, origin(2))
+ }
return Xsetrlimit64(t, resource, rlim)
}
// int setrlimit(int resource, const struct rlimit *rlim);
func Xsetrlimit64(t *TLS, resource int32, rlim uintptr) int32 {
+ if __ccgo_strace {
+ trc("t=%v resource=%v rlim=%v, (%v:)", t, resource, rlim, origin(2))
+ }
panic(todo(""))
// if _, _, err := unix.Syscall(unix.SYS_SETRLIMIT, uintptr(resource), uintptr(rlim), 0); err != 0 {
// t.setErrno(err)
@@ -858,11 +954,17 @@ func Xsetrlimit64(t *TLS, resource int32, rlim uintptr) int32 {
// pid_t getpid(void);
func Xgetpid(t *TLS) int32 {
+ if __ccgo_strace {
+ trc("t=%v, (%v:)", t, origin(2))
+ }
return int32(os.Getpid())
}
// int system(const char *command);
func Xsystem(t *TLS, command uintptr) int32 {
+ if __ccgo_strace {
+ trc("t=%v command=%v, (%v:)", t, command, origin(2))
+ }
s := GoString(command)
if command == 0 {
panic(todo(""))
@@ -897,6 +999,9 @@ func Xsystem(t *TLS, command uintptr) int32 {
// struct passwd *getpwuid(uid_t uid);
func Xgetpwuid(t *TLS, uid uint32) uintptr {
+ if __ccgo_strace {
+ trc("t=%v uid=%v, (%v:)", t, uid, origin(2))
+ }
panic(todo(""))
// f, err := os.Open("/etc/passwd")
// if err != nil {
@@ -955,26 +1060,41 @@ func Xgetpwuid(t *TLS, uid uint32) uintptr {
// int setvbuf(FILE *stream, char *buf, int mode, size_t size);
func Xsetvbuf(t *TLS, stream, buf uintptr, mode int32, size types.Size_t) int32 {
+ if __ccgo_strace {
+ trc("t=%v buf=%v mode=%v size=%v, (%v:)", t, buf, mode, size, origin(2))
+ }
return 0 //TODO
}
// int raise(int sig);
func Xraise(t *TLS, sig int32) int32 {
+ if __ccgo_strace {
+ trc("t=%v sig=%v, (%v:)", t, sig, origin(2))
+ }
panic(todo(""))
}
// int backtrace(void **buffer, int size);
func Xbacktrace(t *TLS, buf uintptr, size int32) int32 {
+ if __ccgo_strace {
+ trc("t=%v buf=%v size=%v, (%v:)", t, buf, size, origin(2))
+ }
panic(todo(""))
}
// void backtrace_symbols_fd(void *const *buffer, int size, int fd);
func Xbacktrace_symbols_fd(t *TLS, buffer uintptr, size, fd int32) {
+ if __ccgo_strace {
+ trc("t=%v buffer=%v fd=%v, (%v:)", t, buffer, fd, origin(2))
+ }
panic(todo(""))
}
// int fileno(FILE *stream);
func Xfileno(t *TLS, stream uintptr) int32 {
+ if __ccgo_strace {
+ trc("t=%v stream=%v, (%v:)", t, stream, origin(2))
+ }
if stream == 0 {
t.setErrno(errno.EBADF)
return -1
@@ -1152,11 +1272,17 @@ func Xfileno(t *TLS, stream uintptr) int32 {
// int mkstemps(char *template, int suffixlen);
func Xmkstemps(t *TLS, template uintptr, suffixlen int32) int32 {
+ if __ccgo_strace {
+ trc("t=%v template=%v suffixlen=%v, (%v:)", t, template, suffixlen, origin(2))
+ }
return Xmkstemps64(t, template, suffixlen)
}
// int mkstemps(char *template, int suffixlen);
func Xmkstemps64(t *TLS, template uintptr, suffixlen int32) int32 {
+ if __ccgo_strace {
+ trc("t=%v template=%v suffixlen=%v, (%v:)", t, template, suffixlen, origin(2))
+ }
panic(todo(""))
// len := uintptr(Xstrlen(t, template))
// x := template + uintptr(len-6) - uintptr(suffixlen)
@@ -1178,6 +1304,9 @@ func Xmkstemps64(t *TLS, template uintptr, suffixlen int32) int32 {
// int mkstemp(char *template);
func Xmkstemp64(t *TLS, template uintptr) int32 {
+ if __ccgo_strace {
+ trc("t=%v template=%v, (%v:)", t, template, origin(2))
+ }
return Xmkstemps64(t, template, 0)
}
@@ -1240,6 +1369,9 @@ type ftstream struct {
// FTS *fts_open(char * const *path_argv, int options, int (*compar)(const FTSENT **, const FTSENT **));
func Xfts64_open(t *TLS, path_argv uintptr, options int32, compar uintptr) uintptr {
+ if __ccgo_strace {
+ trc("t=%v path_argv=%v options=%v compar=%v, (%v:)", t, path_argv, options, compar, origin(2))
+ }
panic(todo(""))
// f := &ftstream{}
//
@@ -1345,11 +1477,17 @@ func Xfts64_open(t *TLS, path_argv uintptr, options int32, compar uintptr) uintp
// FTSENT *fts_read(FTS *ftsp);
func Xfts_read(t *TLS, ftsp uintptr) uintptr {
+ if __ccgo_strace {
+ trc("t=%v ftsp=%v, (%v:)", t, ftsp, origin(2))
+ }
return Xfts64_read(t, ftsp)
}
// FTSENT *fts_read(FTS *ftsp);
func Xfts64_read(t *TLS, ftsp uintptr) uintptr {
+ if __ccgo_strace {
+ trc("t=%v ftsp=%v, (%v:)", t, ftsp, origin(2))
+ }
panic(todo(""))
// f := winGetObject(ftsp).(*ftstream)
// if f.x == len(f.s) {
@@ -1367,11 +1505,17 @@ func Xfts64_read(t *TLS, ftsp uintptr) uintptr {
// int fts_close(FTS *ftsp);
func Xfts_close(t *TLS, ftsp uintptr) int32 {
+ if __ccgo_strace {
+ trc("t=%v ftsp=%v, (%v:)", t, ftsp, origin(2))
+ }
return Xfts64_close(t, ftsp)
}
// int fts_close(FTS *ftsp);
func Xfts64_close(t *TLS, ftsp uintptr) int32 {
+ if __ccgo_strace {
+ trc("t=%v ftsp=%v, (%v:)", t, ftsp, origin(2))
+ }
panic(todo(""))
// winGetObject(ftsp).(*ftstream).close(t)
// removeObject(ftsp)
@@ -1380,6 +1524,9 @@ func Xfts64_close(t *TLS, ftsp uintptr) int32 {
// void tzset (void);
func Xtzset(t *TLS) {
+ if __ccgo_strace {
+ trc("t=%v, (%v:)", t, origin(2))
+ }
//TODO
}
@@ -1387,37 +1534,58 @@ var strerrorBuf [256]byte
// char *strerror(int errnum);
func Xstrerror(t *TLS, errnum int32) uintptr {
+ if __ccgo_strace {
+ trc("t=%v errnum=%v, (%v:)", t, errnum, origin(2))
+ }
copy((*RawMem)(unsafe.Pointer(&strerrorBuf[0]))[:len(strerrorBuf):len(strerrorBuf)], fmt.Sprintf("errno %d\x00", errnum))
return uintptr(unsafe.Pointer(&strerrorBuf[0]))
}
// void *dlopen(const char *filename, int flags);
func Xdlopen(t *TLS, filename uintptr, flags int32) uintptr {
+ if __ccgo_strace {
+ trc("t=%v filename=%v flags=%v, (%v:)", t, filename, flags, origin(2))
+ }
panic(todo(""))
}
// char *dlerror(void);
func Xdlerror(t *TLS) uintptr {
+ if __ccgo_strace {
+ trc("t=%v, (%v:)", t, origin(2))
+ }
panic(todo(""))
}
// int dlclose(void *handle);
func Xdlclose(t *TLS, handle uintptr) int32 {
+ if __ccgo_strace {
+ trc("t=%v handle=%v, (%v:)", t, handle, origin(2))
+ }
panic(todo(""))
}
// void *dlsym(void *handle, const char *symbol);
func Xdlsym(t *TLS, handle, symbol uintptr) uintptr {
+ if __ccgo_strace {
+ trc("t=%v symbol=%v, (%v:)", t, symbol, origin(2))
+ }
panic(todo(""))
}
// void perror(const char *s);
func Xperror(t *TLS, s uintptr) {
+ if __ccgo_strace {
+ trc("t=%v s=%v, (%v:)", t, s, origin(2))
+ }
panic(todo(""))
}
// int pclose(FILE *stream);
func Xpclose(t *TLS, stream uintptr) int32 {
+ if __ccgo_strace {
+ trc("t=%v stream=%v, (%v:)", t, stream, origin(2))
+ }
panic(todo(""))
}
@@ -1425,17 +1593,26 @@ var gai_strerrorBuf [100]byte
// const char *gai_strerror(int errcode);
func Xgai_strerror(t *TLS, errcode int32) uintptr {
+ if __ccgo_strace {
+ trc("t=%v errcode=%v, (%v:)", t, errcode, origin(2))
+ }
copy(gai_strerrorBuf[:], fmt.Sprintf("gai error %d\x00", errcode))
return uintptr(unsafe.Pointer(&gai_strerrorBuf))
}
// int tcgetattr(int fd, struct termios *termios_p);
func Xtcgetattr(t *TLS, fd int32, termios_p uintptr) int32 {
+ if __ccgo_strace {
+ trc("t=%v fd=%v termios_p=%v, (%v:)", t, fd, termios_p, origin(2))
+ }
panic(todo(""))
}
// int tcsetattr(int fd, int optional_actions, const struct termios *termios_p);
func Xtcsetattr(t *TLS, fd, optional_actions int32, termios_p uintptr) int32 {
+ if __ccgo_strace {
+ trc("t=%v optional_actions=%v termios_p=%v, (%v:)", t, optional_actions, termios_p, origin(2))
+ }
panic(todo(""))
}
@@ -1446,22 +1623,34 @@ func Xtcsetattr(t *TLS, fd, optional_actions int32, termios_p uintptr) int32 {
// int cfsetospeed(struct termios *termios_p, speed_t speed);
func Xcfsetospeed(t *TLS, termios_p uintptr, speed uint32) int32 {
+ if __ccgo_strace {
+ trc("t=%v termios_p=%v speed=%v, (%v:)", t, termios_p, speed, origin(2))
+ }
panic(todo(""))
}
// int cfsetispeed(struct termios *termios_p, speed_t speed);
func Xcfsetispeed(t *TLS, termios_p uintptr, speed uint32) int32 {
+ if __ccgo_strace {
+ trc("t=%v termios_p=%v speed=%v, (%v:)", t, termios_p, speed, origin(2))
+ }
panic(todo(""))
}
// pid_t fork(void);
func Xfork(t *TLS) int32 {
+ if __ccgo_strace {
+ trc("t=%v, (%v:)", t, origin(2))
+ }
t.setErrno(errno.ENOSYS)
return -1
}
// char *setlocale(int category, const char *locale);
func Xsetlocale(t *TLS, category int32, locale uintptr) uintptr {
+ if __ccgo_strace {
+ trc("t=%v category=%v locale=%v, (%v:)", t, category, locale, origin(2))
+ }
return 0 //TODO
}
@@ -1472,11 +1661,17 @@ func Xsetlocale(t *TLS, category int32, locale uintptr) uintptr {
// FILE *popen(const char *command, const char *type);
func Xpopen(t *TLS, command, type1 uintptr) uintptr {
+ if __ccgo_strace {
+ trc("t=%v type1=%v, (%v:)", t, type1, origin(2))
+ }
panic(todo(""))
}
// char *realpath(const char *path, char *resolved_path);
func Xrealpath(t *TLS, path, resolved_path uintptr) uintptr {
+ if __ccgo_strace {
+ trc("t=%v resolved_path=%v, (%v:)", t, resolved_path, origin(2))
+ }
s, err := filepath.EvalSymlinks(GoString(path))
if err != nil {
if os.IsNotExist(err) {
@@ -1505,6 +1700,9 @@ func Xrealpath(t *TLS, path, resolved_path uintptr) uintptr {
// struct tm *gmtime_r(const time_t *timep, struct tm *result);
func Xgmtime_r(t *TLS, timep, result uintptr) uintptr {
+ if __ccgo_strace {
+ trc("t=%v result=%v, (%v:)", t, result, origin(2))
+ }
panic(todo(""))
}
@@ -1518,6 +1716,9 @@ func Xgmtime_r(t *TLS, timep, result uintptr) uintptr {
// }
func Xabort(t *TLS) {
+ if __ccgo_strace {
+ trc("t=%v, (%v:)", t, origin(2))
+ }
panic(todo(""))
// if dmesgs {
// dmesg("%v:\n%s", origin(1), debug.Stack())
@@ -1538,6 +1739,9 @@ func Xabort(t *TLS) {
// int fflush(FILE *stream);
func Xfflush(t *TLS, stream uintptr) int32 {
+ if __ccgo_strace {
+ trc("t=%v stream=%v, (%v:)", t, stream, origin(2))
+ }
f, ok := winGetObject(stream).(*file)
if !ok {
t.setErrno(errno.EBADF)
@@ -1553,6 +1757,9 @@ func Xfflush(t *TLS, stream uintptr) int32 {
// size_t fread(void *ptr, size_t size, size_t nmemb, FILE *stream);
func Xfread(t *TLS, ptr uintptr, size, nmemb types.Size_t, stream uintptr) types.Size_t {
+ if __ccgo_strace {
+ trc("t=%v ptr=%v nmemb=%v stream=%v, (%v:)", t, ptr, nmemb, stream, origin(2))
+ }
f, ok := winGetObject(stream).(*file)
if !ok {
t.setErrno(errno.EBADF)
@@ -1578,6 +1785,9 @@ func Xfread(t *TLS, ptr uintptr, size, nmemb types.Size_t, stream uintptr) types
// size_t fwrite(const void *ptr, size_t size, size_t nmemb, FILE *stream);
func Xfwrite(t *TLS, ptr uintptr, size, nmemb types.Size_t, stream uintptr) types.Size_t {
+ if __ccgo_strace {
+ trc("t=%v ptr=%v nmemb=%v stream=%v, (%v:)", t, ptr, nmemb, stream, origin(2))
+ }
if ptr == 0 || size == 0 {
return 0
}
@@ -1605,6 +1815,9 @@ func Xfwrite(t *TLS, ptr uintptr, size, nmemb types.Size_t, stream uintptr) type
// int fclose(FILE *stream);
func Xfclose(t *TLS, stream uintptr) int32 {
+ if __ccgo_strace {
+ trc("t=%v stream=%v, (%v:)", t, stream, origin(2))
+ }
f, ok := winGetObject(stream).(*file)
if !ok {
t.setErrno(errno.EBADF)
@@ -1615,6 +1828,9 @@ func Xfclose(t *TLS, stream uintptr) int32 {
// int fputc(int c, FILE *stream);
func Xfputc(t *TLS, c int32, stream uintptr) int32 {
+ if __ccgo_strace {
+ trc("t=%v c=%v stream=%v, (%v:)", t, c, stream, origin(2))
+ }
f, ok := winGetObject(stream).(*file)
if !ok {
t.setErrno(errno.EBADF)
@@ -1628,6 +1844,9 @@ func Xfputc(t *TLS, c int32, stream uintptr) int32 {
// int fseek(FILE *stream, long offset, int whence);
func Xfseek(t *TLS, stream uintptr, offset long, whence int32) int32 {
+ if __ccgo_strace {
+ trc("t=%v stream=%v offset=%v whence=%v, (%v:)", t, stream, offset, whence, origin(2))
+ }
f, ok := winGetObject(stream).(*file)
if !ok {
t.setErrno(errno.EBADF)
@@ -1649,6 +1868,9 @@ func Xfseek(t *TLS, stream uintptr, offset long, whence int32) int32 {
// long ftell(FILE *stream);
func Xftell(t *TLS, stream uintptr) long {
+ if __ccgo_strace {
+ trc("t=%v stream=%v, (%v:)", t, stream, origin(2))
+ }
f, ok := winGetObject(stream).(*file)
if !ok {
t.setErrno(errno.EBADF)
@@ -1669,6 +1891,9 @@ func Xftell(t *TLS, stream uintptr) long {
// int ferror(FILE *stream);
func Xferror(t *TLS, stream uintptr) int32 {
+ if __ccgo_strace {
+ trc("t=%v stream=%v, (%v:)", t, stream, origin(2))
+ }
f, ok := winGetObject(stream).(*file)
if !ok {
t.setErrno(errno.EBADF)
@@ -1680,6 +1905,9 @@ func Xferror(t *TLS, stream uintptr) int32 {
// int getc(FILE *stream);
func Xfgetc(t *TLS, stream uintptr) int32 {
+ if __ccgo_strace {
+ trc("t=%v stream=%v, (%v:)", t, stream, origin(2))
+ }
f, ok := winGetObject(stream).(*file)
if !ok {
t.setErrno(errno.EBADF)
@@ -1696,16 +1924,25 @@ func Xfgetc(t *TLS, stream uintptr) int32 {
// int ungetc(int c, FILE *stream);
func Xungetc(t *TLS, c int32, stream uintptr) int32 {
+ if __ccgo_strace {
+ trc("t=%v c=%v stream=%v, (%v:)", t, c, stream, origin(2))
+ }
panic(todo(""))
}
// int fscanf(FILE *stream, const char *format, ...);
func Xfscanf(t *TLS, stream, format, va uintptr) int32 {
+ if __ccgo_strace {
+ trc("t=%v va=%v, (%v:)", t, va, origin(2))
+ }
panic(todo(""))
}
// int fputs(const char *s, FILE *stream);
func Xfputs(t *TLS, s, stream uintptr) int32 {
+ if __ccgo_strace {
+ trc("t=%v stream=%v, (%v:)", t, stream, origin(2))
+ }
f, ok := winGetObject(stream).(*file)
if !ok {
t.setErrno(errno.EBADF)
@@ -1821,51 +2058,81 @@ func Xfputs(t *TLS, s, stream uintptr) int32 {
// _CRTIMP extern int *__cdecl _errno(void); // /usr/share/mingw-w64/include/errno.h:17:
func X_errno(t *TLS) uintptr {
+ if __ccgo_strace {
+ trc("t=%v, (%v:)", t, origin(2))
+ }
return t.errnop
}
// int vfscanf(FILE * restrict stream, const char * restrict format, va_list arg);
func X__ms_vfscanf(t *TLS, stream, format, ap uintptr) int32 {
+ if __ccgo_strace {
+ trc("t=%v ap=%v, (%v:)", t, ap, origin(2))
+ }
panic(todo(""))
}
// int vsscanf(const char *str, const char *format, va_list ap);
func X__ms_vsscanf(t *TLS, str, format, ap uintptr) int32 {
+ if __ccgo_strace {
+ trc("t=%v ap=%v, (%v:)", t, ap, origin(2))
+ }
panic(todo(""))
}
// int vscanf(const char *format, va_list ap);
func X__ms_vscanf(t *TLS, format, ap uintptr) int32 {
+ if __ccgo_strace {
+ trc("t=%v ap=%v, (%v:)", t, ap, origin(2))
+ }
panic(todo(""))
}
// int vsnprintf(char *str, size_t size, const char *format, va_list ap);
func X__ms_vsnprintf(t *TLS, str uintptr, size types.Size_t, format, ap uintptr) int32 {
+ if __ccgo_strace {
+ trc("t=%v str=%v size=%v ap=%v, (%v:)", t, str, size, ap, origin(2))
+ }
return Xvsnprintf(t, str, size, format, ap)
}
// int vfwscanf(FILE *stream, const wchar_t *format, va_list argptr;);
func X__ms_vfwscanf(t *TLS, stream uintptr, format, ap uintptr) int32 {
+ if __ccgo_strace {
+ trc("t=%v stream=%v ap=%v, (%v:)", t, stream, ap, origin(2))
+ }
panic(todo(""))
}
// int vwscanf(const wchar_t * restrict format, va_list arg);
func X__ms_vwscanf(t *TLS, format, ap uintptr) int32 {
+ if __ccgo_strace {
+ trc("t=%v ap=%v, (%v:)", t, ap, origin(2))
+ }
panic(todo(""))
}
// int _vsnwprintf(wchar_t *buffer, size_t count, const wchar_t *format, va_list argptr);
func X_vsnwprintf(t *TLS, buffer uintptr, count types.Size_t, format, ap uintptr) int32 {
+ if __ccgo_strace {
+ trc("t=%v buffer=%v count=%v ap=%v, (%v:)", t, buffer, count, ap, origin(2))
+ }
panic(todo(""))
}
// int vswscanf(const wchar_t *buffer, const wchar_t *format, va_list arglist);
func X__ms_vswscanf(t *TLS, stream uintptr, format, ap uintptr) int32 {
+ if __ccgo_strace {
+ trc("t=%v stream=%v ap=%v, (%v:)", t, stream, ap, origin(2))
+ }
panic(todo(""))
}
// __acrt_iob_func
func X__acrt_iob_func(t *TLS, fd uint32) uintptr {
+ if __ccgo_strace {
+ trc("t=%v fd=%v, (%v:)", t, fd, origin(2))
+ }
f, ok := fdToFile(int32(fd))
if !ok {
@@ -1881,6 +2148,9 @@ func X__acrt_iob_func(t *TLS, fd uint32) uintptr {
//
// );
func XSetEvent(t *TLS, hEvent uintptr) int32 {
+ if __ccgo_strace {
+ trc("t=%v hEvent=%v, (%v:)", t, hEvent, origin(2))
+ }
r0, _, err := syscall.Syscall(procSetEvent.Addr(), 1, hEvent, 0, 0)
if r0 == 0 {
t.setErrno(err)
@@ -1895,6 +2165,9 @@ func XSetEvent(t *TLS, hEvent uintptr) int32 {
//
// );
func X_stricmp(t *TLS, string1, string2 uintptr) int32 {
+ if __ccgo_strace {
+ trc("t=%v string2=%v, (%v:)", t, string2, origin(2))
+ }
var s1 = strings.ToLower(GoString(string1))
var s2 = strings.ToLower(GoString(string2))
return int32(strings.Compare(s1, s2))
@@ -1908,6 +2181,9 @@ func X_stricmp(t *TLS, string1, string2 uintptr) int32 {
//
// );
func XHeapFree(t *TLS, hHeap uintptr, dwFlags uint32, lpMem uintptr) int32 {
+ if __ccgo_strace {
+ trc("t=%v hHeap=%v dwFlags=%v lpMem=%v, (%v:)", t, hHeap, dwFlags, lpMem, origin(2))
+ }
r0, _, err := syscall.Syscall(procHeapFree.Addr(), 3, hHeap, uintptr(dwFlags), lpMem)
if err != 0 {
t.setErrno(err)
@@ -1917,6 +2193,9 @@ func XHeapFree(t *TLS, hHeap uintptr, dwFlags uint32, lpMem uintptr) int32 {
// HANDLE GetProcessHeap();
func XGetProcessHeap(t *TLS) uintptr {
+ if __ccgo_strace {
+ trc("t=%v, (%v:)", t, origin(2))
+ }
r0, _, err := syscall.Syscall(procGetProcessHeap.Addr(), 0, 0, 0, 0)
if r0 == 0 {
t.setErrno(err)
@@ -1932,6 +2211,9 @@ func XGetProcessHeap(t *TLS) uintptr {
//
// );
func XHeapAlloc(t *TLS, hHeap uintptr, dwFlags uint32, dwBytes types.Size_t) uintptr {
+ if __ccgo_strace {
+ trc("t=%v hHeap=%v dwFlags=%v dwBytes=%v, (%v:)", t, hHeap, dwFlags, dwBytes, origin(2))
+ }
r0, _, err := syscall.Syscall(procHeapAlloc.Addr(), 3, hHeap, uintptr(dwFlags), uintptr(dwBytes))
if r0 == 0 {
t.setErrno(err)
@@ -1977,6 +2259,9 @@ func XWspiapiGetAddrInfo(t *TLS, _ ...interface{}) int32 {
//
// );
func Xwcscmp(t *TLS, string1, string2 uintptr) int32 {
+ if __ccgo_strace {
+ trc("t=%v string2=%v, (%v:)", t, string2, origin(2))
+ }
var s1 = goWideString(string1)
var s2 = goWideString(string2)
return int32(strings.Compare(s1, s2))
@@ -1984,6 +2269,9 @@ func Xwcscmp(t *TLS, string1, string2 uintptr) int32 {
// BOOL IsDebuggerPresent();
func XIsDebuggerPresent(t *TLS) int32 {
+ if __ccgo_strace {
+ trc("t=%v, (%v:)", t, origin(2))
+ }
panic(todo(""))
}
@@ -1997,6 +2285,9 @@ func XExitProcess(t *TLS, _ ...interface{}) int32 {
//
// );
func XGetVersionExW(t *TLS, lpVersionInformation uintptr) int32 {
+ if __ccgo_strace {
+ trc("t=%v lpVersionInformation=%v, (%v:)", t, lpVersionInformation, origin(2))
+ }
r0, _, err := syscall.Syscall(procGetVersionExW.Addr(), 1, lpVersionInformation, 0, 0)
if r0 == 0 {
t.setErrno(err)
@@ -2021,6 +2312,9 @@ func XGetVolumeNameForVolumeMountPointW(t *TLS, _ ...interface{}) int32 {
//
// );
func Xwcslen(t *TLS, str uintptr) types.Size_t {
+ if __ccgo_strace {
+ trc("t=%v str=%v, (%v:)", t, str, origin(2))
+ }
r0, _, _ := syscall.Syscall(procLstrlenW.Addr(), 1, str, 0, 0)
return types.Size_t(r0)
}
@@ -2031,6 +2325,9 @@ func Xwcslen(t *TLS, str uintptr) types.Size_t {
//
// );
func XGetStdHandle(t *TLS, nStdHandle uint32) uintptr {
+ if __ccgo_strace {
+ trc("t=%v nStdHandle=%v, (%v:)", t, nStdHandle, origin(2))
+ }
h, err := syscall.GetStdHandle(int(nStdHandle))
if err != nil {
panic("no console")
@@ -2044,6 +2341,9 @@ func XGetStdHandle(t *TLS, nStdHandle uint32) uintptr {
//
// );
func XCloseHandle(t *TLS, hObject uintptr) int32 {
+ if __ccgo_strace {
+ trc("t=%v hObject=%v, (%v:)", t, hObject, origin(2))
+ }
r := syscall.CloseHandle(syscall.Handle(hObject))
if r != nil {
return errno.EINVAL
@@ -2053,6 +2353,9 @@ func XCloseHandle(t *TLS, hObject uintptr) int32 {
// DWORD GetLastError();
func XGetLastError(t *TLS) uint32 {
+ if __ccgo_strace {
+ trc("t=%v, (%v:)", t, origin(2))
+ }
var rv = *(*int32)(unsafe.Pointer(t.errnop))
return uint32(rv)
@@ -2069,6 +2372,9 @@ func XGetLastError(t *TLS) uint32 {
//
// );
func XSetFilePointer(t *TLS, hFile uintptr, lDistanceToMove long, lpDistanceToMoveHigh uintptr, dwMoveMethod uint32) uint32 {
+ if __ccgo_strace {
+ trc("t=%v hFile=%v lDistanceToMove=%v lpDistanceToMoveHigh=%v dwMoveMethod=%v, (%v:)", t, hFile, lDistanceToMove, lpDistanceToMoveHigh, dwMoveMethod, origin(2))
+ }
r0, _, e1 := syscall.Syscall6(procSetFilePointer.Addr(), 4, hFile, uintptr(lDistanceToMove), lpDistanceToMoveHigh, uintptr(dwMoveMethod), 0, 0)
var uOff = uint32(r0)
if uOff == 0xffffffff {
@@ -2087,6 +2393,9 @@ func XSetFilePointer(t *TLS, hFile uintptr, lDistanceToMove long, lpDistanceToMo
//
// );
func XSetEndOfFile(t *TLS, hFile uintptr) int32 {
+ if __ccgo_strace {
+ trc("t=%v hFile=%v, (%v:)", t, hFile, origin(2))
+ }
err := syscall.SetEndOfFile(syscall.Handle(hFile))
if err != nil {
t.setErrno(err)
@@ -2105,6 +2414,9 @@ func XSetEndOfFile(t *TLS, hFile uintptr) int32 {
//
// );
func XReadFile(t *TLS, hFile, lpBuffer uintptr, nNumberOfBytesToRead uint32, lpNumberOfBytesRead, lpOverlapped uintptr) int32 {
+ if __ccgo_strace {
+ trc("t=%v lpBuffer=%v nNumberOfBytesToRead=%v lpOverlapped=%v, (%v:)", t, lpBuffer, nNumberOfBytesToRead, lpOverlapped, origin(2))
+ }
r1, _, e1 := syscall.Syscall6(procReadFile.Addr(), 5,
hFile, lpBuffer, uintptr(nNumberOfBytesToRead), uintptr(lpNumberOfBytesRead), uintptr(lpOverlapped), 0)
if r1 == 0 {
@@ -2128,6 +2440,9 @@ func XReadFile(t *TLS, hFile, lpBuffer uintptr, nNumberOfBytesToRead uint32, lpN
//
// );
func XWriteFile(t *TLS, hFile, lpBuffer uintptr, nNumberOfBytesToWrite uint32, lpNumberOfBytesWritten, lpOverlapped uintptr) int32 {
+ if __ccgo_strace {
+ trc("t=%v lpBuffer=%v nNumberOfBytesToWrite=%v lpOverlapped=%v, (%v:)", t, lpBuffer, nNumberOfBytesToWrite, lpOverlapped, origin(2))
+ }
r1, _, e1 := syscall.Syscall6(procWriteFile.Addr(), 5,
hFile, lpBuffer, uintptr(nNumberOfBytesToWrite), lpNumberOfBytesWritten, lpOverlapped, 0)
if r1 == 0 {
@@ -2147,6 +2462,9 @@ func XWriteFile(t *TLS, hFile, lpBuffer uintptr, nNumberOfBytesToWrite uint32, l
//
// );
func XGetFileAttributesW(t *TLS, lpFileName uintptr) uint32 {
+ if __ccgo_strace {
+ trc("t=%v lpFileName=%v, (%v:)", t, lpFileName, origin(2))
+ }
attrs, err := syscall.GetFileAttributes((*uint16)(unsafe.Pointer(lpFileName)))
if attrs == syscall.INVALID_FILE_ATTRIBUTES {
if err != nil {
@@ -2170,6 +2488,9 @@ func XGetFileAttributesW(t *TLS, lpFileName uintptr) uint32 {
//
// );
func XCreateFileW(t *TLS, lpFileName uintptr, dwDesiredAccess, dwShareMode uint32, lpSecurityAttributes uintptr, dwCreationDisposition, dwFlagsAndAttributes uint32, hTemplateFile uintptr) uintptr {
+ if __ccgo_strace {
+ trc("t=%v lpFileName=%v dwShareMode=%v lpSecurityAttributes=%v dwFlagsAndAttributes=%v hTemplateFile=%v, (%v:)", t, lpFileName, dwShareMode, lpSecurityAttributes, dwFlagsAndAttributes, hTemplateFile, origin(2))
+ }
r0, _, e1 := syscall.Syscall9(procCreateFileW.Addr(), 7, lpFileName, uintptr(dwDesiredAccess), uintptr(dwShareMode), lpSecurityAttributes,
uintptr(dwCreationDisposition), uintptr(dwFlagsAndAttributes), hTemplateFile, 0, 0)
@@ -2197,6 +2518,9 @@ func XCreateFileW(t *TLS, lpFileName uintptr, dwDesiredAccess, dwShareMode uint3
//
// );
func XDuplicateHandle(t *TLS, hSourceProcessHandle, hSourceHandle, hTargetProcessHandle, lpTargetHandle uintptr, dwDesiredAccess uint32, bInheritHandle int32, dwOptions uint32) int32 {
+ if __ccgo_strace {
+ trc("t=%v lpTargetHandle=%v dwDesiredAccess=%v bInheritHandle=%v dwOptions=%v, (%v:)", t, lpTargetHandle, dwDesiredAccess, bInheritHandle, dwOptions, origin(2))
+ }
r0, _, err := syscall.Syscall9(procDuplicateHandle.Addr(), 7, hSourceProcessHandle, hSourceHandle, hTargetProcessHandle,
lpTargetHandle, uintptr(dwDesiredAccess), uintptr(bInheritHandle), uintptr(dwOptions), 0, 0)
if r0 == 0 {
@@ -2207,6 +2531,9 @@ func XDuplicateHandle(t *TLS, hSourceProcessHandle, hSourceHandle, hTargetProces
// HANDLE GetCurrentProcess();
func XGetCurrentProcess(t *TLS) uintptr {
+ if __ccgo_strace {
+ trc("t=%v, (%v:)", t, origin(2))
+ }
r0, _, e1 := syscall.Syscall(procGetCurrentProcess.Addr(), 0, 0, 0, 0)
if r0 == 0 {
if e1 != 0 {
@@ -2224,6 +2551,9 @@ func XGetCurrentProcess(t *TLS) uintptr {
//
// );
func XFlushFileBuffers(t *TLS, hFile uintptr) int32 {
+ if __ccgo_strace {
+ trc("t=%v hFile=%v, (%v:)", t, hFile, origin(2))
+ }
err := syscall.FlushFileBuffers(syscall.Handle(hFile))
if err != nil {
t.setErrno(err)
@@ -2239,6 +2569,9 @@ func XFlushFileBuffers(t *TLS, hFile uintptr) int32 {
//
// );
func XGetFileType(t *TLS, hFile uintptr) uint32 {
+ if __ccgo_strace {
+ trc("t=%v hFile=%v, (%v:)", t, hFile, origin(2))
+ }
n, err := syscall.GetFileType(syscall.Handle(hFile))
if err != nil {
t.setErrno(err)
@@ -2253,6 +2586,9 @@ func XGetFileType(t *TLS, hFile uintptr) uint32 {
//
// );
func XGetConsoleMode(t *TLS, hConsoleHandle, lpMode uintptr) int32 {
+ if __ccgo_strace {
+ trc("t=%v lpMode=%v, (%v:)", t, lpMode, origin(2))
+ }
err := syscall.GetConsoleMode(syscall.Handle(hConsoleHandle), (*uint32)(unsafe.Pointer(lpMode)))
if err != nil {
t.setErrno(err)
@@ -2268,6 +2604,9 @@ func XGetConsoleMode(t *TLS, hConsoleHandle, lpMode uintptr) int32 {
//
// );
func XGetCommState(t *TLS, hFile, lpDCB uintptr) int32 {
+ if __ccgo_strace {
+ trc("t=%v lpDCB=%v, (%v:)", t, lpDCB, origin(2))
+ }
r1, _, err := syscall.Syscall(procGetCommState.Addr(), 2, hFile, lpDCB, 0)
if r1 == 0 {
t.setErrno(err)
@@ -2284,6 +2623,9 @@ func XGetCommState(t *TLS, hFile, lpDCB uintptr) int32 {
//
// );
func X_wcsnicmp(t *TLS, string1, string2 uintptr, count types.Size_t) int32 {
+ if __ccgo_strace {
+ trc("t=%v string2=%v count=%v, (%v:)", t, string2, count, origin(2))
+ }
var s1 = strings.ToLower(goWideString(string1))
var l1 = len(s1)
@@ -2316,6 +2658,9 @@ func X_wcsnicmp(t *TLS, string1, string2 uintptr, count types.Size_t) int32 {
//
// );
func XReadConsoleW(t *TLS, hConsoleInput, lpBuffer uintptr, nNumberOfCharsToRead uint32, lpNumberOfCharsRead, pInputControl uintptr) int32 {
+ if __ccgo_strace {
+ trc("t=%v lpBuffer=%v nNumberOfCharsToRead=%v pInputControl=%v, (%v:)", t, lpBuffer, nNumberOfCharsToRead, pInputControl, origin(2))
+ }
rv, _, err := syscall.Syscall6(procReadConsoleW.Addr(), 5, hConsoleInput,
lpBuffer, uintptr(nNumberOfCharsToRead), lpNumberOfCharsRead, pInputControl, 0)
@@ -2336,6 +2681,9 @@ func XReadConsoleW(t *TLS, hConsoleInput, lpBuffer uintptr, nNumberOfCharsToRead
//
// );
func XWriteConsoleW(t *TLS, hConsoleOutput, lpBuffer uintptr, nNumberOfCharsToWrite uint32, lpNumberOfCharsWritten, lpReserved uintptr) int32 {
+ if __ccgo_strace {
+ trc("t=%v lpBuffer=%v nNumberOfCharsToWrite=%v lpReserved=%v, (%v:)", t, lpBuffer, nNumberOfCharsToWrite, lpReserved, origin(2))
+ }
rv, _, err := syscall.Syscall6(procWriteConsoleW.Addr(), 5, hConsoleOutput,
lpBuffer, uintptr(nNumberOfCharsToWrite), lpNumberOfCharsWritten, lpReserved, 0)
if rv == 0 {
@@ -2351,6 +2699,9 @@ func XWriteConsoleW(t *TLS, hConsoleOutput, lpBuffer uintptr, nNumberOfCharsToWr
//
// );
func XWaitForSingleObject(t *TLS, hHandle uintptr, dwMilliseconds uint32) uint32 {
+ if __ccgo_strace {
+ trc("t=%v hHandle=%v dwMilliseconds=%v, (%v:)", t, hHandle, dwMilliseconds, origin(2))
+ }
rv, err := syscall.WaitForSingleObject(syscall.Handle(hHandle), dwMilliseconds)
if err != nil {
t.setErrno(err)
@@ -2364,6 +2715,9 @@ func XWaitForSingleObject(t *TLS, hHandle uintptr, dwMilliseconds uint32) uint32
//
// );
func XResetEvent(t *TLS, hEvent uintptr) int32 {
+ if __ccgo_strace {
+ trc("t=%v hEvent=%v, (%v:)", t, hEvent, origin(2))
+ }
rv, _, err := syscall.Syscall(procResetEvent.Addr(), 1, hEvent, 0, 0)
if rv == 0 {
t.setErrno(err)
@@ -2380,6 +2734,9 @@ func XResetEvent(t *TLS, hEvent uintptr) int32 {
//
// );
func XPeekConsoleInputW(t *TLS, hConsoleInput, lpBuffer uintptr, nLength uint32, lpNumberOfEventsRead uintptr) int32 {
+ if __ccgo_strace {
+ trc("t=%v lpBuffer=%v nLength=%v lpNumberOfEventsRead=%v, (%v:)", t, lpBuffer, nLength, lpNumberOfEventsRead, origin(2))
+ }
r0, _, err := syscall.Syscall6(procPeekConsoleInputW.Addr(), 4, hConsoleInput, lpBuffer, uintptr(nLength), lpNumberOfEventsRead, 0, 0)
if r0 == 0 {
t.setErrno(err)
@@ -2395,11 +2752,17 @@ func XPeekConsoleInputW(t *TLS, hConsoleInput, lpBuffer uintptr, nLength uint32,
//
// );
func XwsprintfA(t *TLS, buf, format, args uintptr) int32 {
+ if __ccgo_strace {
+ trc("t=%v args=%v, (%v:)", t, args, origin(2))
+ }
return Xsprintf(t, buf, format, args)
}
// UINT WINAPI GetConsoleCP(void);
func XGetConsoleCP(t *TLS) uint32 {
+ if __ccgo_strace {
+ trc("t=%v, (%v:)", t, origin(2))
+ }
r0, _, err := syscall.Syscall(procGetConsoleCP.Addr(), 0, 0, 0, 0)
if r0 == 0 {
t.setErrno(err)
@@ -2426,6 +2789,9 @@ func XGetConsoleCP(t *TLS) uint32 {
//
// );
func XCreateEventW(t *TLS, lpEventAttributes uintptr, bManualReset, bInitialState int32, lpName uintptr) uintptr {
+ if __ccgo_strace {
+ trc("t=%v lpEventAttributes=%v bInitialState=%v lpName=%v, (%v:)", t, lpEventAttributes, bInitialState, lpName, origin(2))
+ }
r0, _, err := syscall.Syscall6(procCreateEventW.Addr(), 4, lpEventAttributes, uintptr(bManualReset),
uintptr(bInitialState), lpName, 0, 0)
if r0 == 0 {
@@ -2467,6 +2833,9 @@ func ThreadProc(p uintptr) uintptr {
//
// );
func XCreateThread(t *TLS, lpThreadAttributes uintptr, dwStackSize types.Size_t, lpStartAddress, lpParameter uintptr, dwCreationFlags uint32, lpThreadId uintptr) uintptr {
+ if __ccgo_strace {
+ trc("t=%v lpThreadAttributes=%v dwStackSize=%v lpParameter=%v dwCreationFlags=%v lpThreadId=%v, (%v:)", t, lpThreadAttributes, dwStackSize, lpParameter, dwCreationFlags, lpThreadId, origin(2))
+ }
f := (*struct{ f func(*TLS, uintptr) uint32 })(unsafe.Pointer(&struct{ uintptr }{lpStartAddress})).f
var tAdp = ThreadAdapter{threadFunc: f, tls: NewTLS(), param: lpParameter}
tAdp.token = addObject(&tAdp)
@@ -2486,6 +2855,9 @@ func XCreateThread(t *TLS, lpThreadAttributes uintptr, dwStackSize types.Size_t,
//
// );
func XSetThreadPriority(t *TLS, hThread uintptr, nPriority int32) int32 {
+ if __ccgo_strace {
+ trc("t=%v hThread=%v nPriority=%v, (%v:)", t, hThread, nPriority, origin(2))
+ }
//r0, _, err := syscall.Syscall(procSetThreadPriority.Addr(), 2, hThread, uintptr(nPriority), 0)
//if r0 == 0 {
@@ -2502,6 +2874,9 @@ func XSetThreadPriority(t *TLS, hThread uintptr, nPriority int32) int32 {
//
// );
func XSetConsoleMode(t *TLS, hConsoleHandle uintptr, dwMode uint32) int32 {
+ if __ccgo_strace {
+ trc("t=%v hConsoleHandle=%v dwMode=%v, (%v:)", t, hConsoleHandle, dwMode, origin(2))
+ }
rv, _, err := syscall.Syscall(procSetConsoleMode.Addr(), 2, hConsoleHandle, uintptr(dwMode), 0)
if rv == 0 {
t.setErrno(err)
@@ -2523,6 +2898,9 @@ func XClearCommError(t *TLS, _ ...interface{}) int32 {
//
// );
func XDeleteCriticalSection(t *TLS, lpCriticalSection uintptr) {
+ if __ccgo_strace {
+ trc("t=%v lpCriticalSection=%v, (%v:)", t, lpCriticalSection, origin(2))
+ }
syscall.Syscall(procDeleteCriticalSection.Addr(), 1, lpCriticalSection, 0, 0)
}
@@ -2532,6 +2910,9 @@ func XDeleteCriticalSection(t *TLS, lpCriticalSection uintptr) {
//
// );
func XEnterCriticalSection(t *TLS, lpCriticalSection uintptr) {
+ if __ccgo_strace {
+ trc("t=%v lpCriticalSection=%v, (%v:)", t, lpCriticalSection, origin(2))
+ }
syscall.Syscall(procEnterCriticalSection.Addr(), 1, lpCriticalSection, 0, 0)
}
@@ -2541,6 +2922,9 @@ func XEnterCriticalSection(t *TLS, lpCriticalSection uintptr) {
//
// );
func XLeaveCriticalSection(t *TLS, lpCriticalSection uintptr) {
+ if __ccgo_strace {
+ trc("t=%v lpCriticalSection=%v, (%v:)", t, lpCriticalSection, origin(2))
+ }
syscall.Syscall(procLeaveCriticalSection.Addr(), 1, lpCriticalSection, 0, 0)
}
@@ -2562,6 +2946,9 @@ func XSetCommTimeouts(t *TLS, _ ...interface{}) int32 {
//
// );
func XInitializeCriticalSection(t *TLS, lpCriticalSection uintptr) {
+ if __ccgo_strace {
+ trc("t=%v lpCriticalSection=%v, (%v:)", t, lpCriticalSection, origin(2))
+ }
// InitializeCriticalSection always succeeds, even in low memory situations.
syscall.Syscall(procInitializeCriticalSection.Addr(), 1, lpCriticalSection, 0, 0)
}
@@ -2593,6 +2980,9 @@ func XGetCommModemStatus(t *TLS, _ ...interface{}) int32 {
//
// );
func XMoveFileW(t *TLS, lpExistingFileName, lpNewFileName uintptr) int32 {
+ if __ccgo_strace {
+ trc("t=%v lpNewFileName=%v, (%v:)", t, lpNewFileName, origin(2))
+ }
r0, _, err := syscall.Syscall(procMoveFileW.Addr(), 2, lpExistingFileName, lpNewFileName, 0)
if err != 0 {
t.setErrno(err)
@@ -2609,6 +2999,9 @@ func XMoveFileW(t *TLS, lpExistingFileName, lpNewFileName uintptr) int32 {
//
// );
func XGetFullPathNameW(t *TLS, lpFileName uintptr, nBufferLength uint32, lpBuffer, lpFilePart uintptr) uint32 {
+ if __ccgo_strace {
+ trc("t=%v lpFileName=%v nBufferLength=%v lpFilePart=%v, (%v:)", t, lpFileName, nBufferLength, lpFilePart, origin(2))
+ }
r0, _, e1 := syscall.Syscall6(procGetFullPathNameW.Addr(), 4, lpFileName, uintptr(nBufferLength), uintptr(lpBuffer), uintptr(lpFilePart), 0, 0)
n := uint32(r0)
if n == 0 {
@@ -2627,6 +3020,9 @@ func XGetFullPathNameW(t *TLS, lpFileName uintptr, nBufferLength uint32, lpBuffe
//
// );
func XCharLowerW(t *TLS, lpsz uintptr) uintptr {
+ if __ccgo_strace {
+ trc("t=%v lpsz=%v, (%v:)", t, lpsz, origin(2))
+ }
panic(todo(""))
}
@@ -2637,6 +3033,9 @@ func XCharLowerW(t *TLS, lpsz uintptr) uintptr {
//
// );
func XCreateDirectoryW(t *TLS, lpPathName, lpSecurityAttributes uintptr) int32 {
+ if __ccgo_strace {
+ trc("t=%v lpSecurityAttributes=%v, (%v:)", t, lpSecurityAttributes, origin(2))
+ }
err := syscall.CreateDirectory((*uint16)(unsafe.Pointer(lpPathName)),
(*syscall.SecurityAttributes)(unsafe.Pointer(lpSecurityAttributes)))
if err != nil {
@@ -2653,6 +3052,9 @@ func XCreateDirectoryW(t *TLS, lpPathName, lpSecurityAttributes uintptr) int32 {
//
// );
func XSetFileAttributesW(t *TLS, lpFileName uintptr, dwFileAttributes uint32) int32 {
+ if __ccgo_strace {
+ trc("t=%v lpFileName=%v dwFileAttributes=%v, (%v:)", t, lpFileName, dwFileAttributes, origin(2))
+ }
err := syscall.SetFileAttributes((*uint16)(unsafe.Pointer(lpFileName)), dwFileAttributes)
if err != nil {
t.setErrno(err)
@@ -2670,6 +3072,9 @@ func XSetFileAttributesW(t *TLS, lpFileName uintptr, dwFileAttributes uint32) in
//
// );
func XGetTempFileNameW(t *TLS, lpPathName, lpPrefixString uintptr, uUnique uint32, lpTempFileName uintptr) uint32 {
+ if __ccgo_strace {
+ trc("t=%v lpPrefixString=%v uUnique=%v lpTempFileName=%v, (%v:)", t, lpPrefixString, uUnique, lpTempFileName, origin(2))
+ }
r0, _, e1 := syscall.Syscall6(procGetTempFileNameW.Addr(), 4, lpPathName, lpPrefixString, uintptr(uUnique), lpTempFileName, 0, 0)
if r0 == 0 {
t.setErrno(e1)
@@ -2685,6 +3090,9 @@ func XGetTempFileNameW(t *TLS, lpPathName, lpPrefixString uintptr, uUnique uint3
//
// );
func XCopyFileW(t *TLS, lpExistingFileName, lpNewFileName uintptr, bFailIfExists int32) int32 {
+ if __ccgo_strace {
+ trc("t=%v lpNewFileName=%v bFailIfExists=%v, (%v:)", t, lpNewFileName, bFailIfExists, origin(2))
+ }
r0, _, e1 := syscall.Syscall(procCopyFileW.Addr(), 3, lpExistingFileName, lpNewFileName, uintptr(bFailIfExists))
if r0 == 0 {
t.setErrno(e1)
@@ -2698,6 +3106,9 @@ func XCopyFileW(t *TLS, lpExistingFileName, lpNewFileName uintptr, bFailIfExists
//
// );
func XDeleteFileW(t *TLS, lpFileName uintptr) int32 {
+ if __ccgo_strace {
+ trc("t=%v lpFileName=%v, (%v:)", t, lpFileName, origin(2))
+ }
err := syscall.DeleteFile((*uint16)(unsafe.Pointer(lpFileName)))
if err != nil {
t.setErrno(err)
@@ -2712,6 +3123,9 @@ func XDeleteFileW(t *TLS, lpFileName uintptr) int32 {
//
// );
func XRemoveDirectoryW(t *TLS, lpPathName uintptr) int32 {
+ if __ccgo_strace {
+ trc("t=%v lpPathName=%v, (%v:)", t, lpPathName, origin(2))
+ }
err := syscall.RemoveDirectory((*uint16)(unsafe.Pointer(lpPathName)))
if err != nil {
t.setErrno(err)
@@ -2722,6 +3136,9 @@ func XRemoveDirectoryW(t *TLS, lpPathName uintptr) int32 {
// HANDLE FindFirstFileW(LPCWSTR lpFileName, LPWIN32_FIND_DATAW lpFindFileData);
func XFindFirstFileW(t *TLS, lpFileName, lpFindFileData uintptr) uintptr {
+ if __ccgo_strace {
+ trc("t=%v lpFindFileData=%v, (%v:)", t, lpFindFileData, origin(2))
+ }
r0, _, e1 := syscall.Syscall(procFindFirstFileW.Addr(), 2, lpFileName, lpFindFileData, 0)
handle := syscall.Handle(r0)
if handle == syscall.InvalidHandle {
@@ -2745,6 +3162,9 @@ func XFindFirstFileW(t *TLS, lpFileName, lpFindFileData uintptr) uintptr {
//
// );
func XFindFirstFileExW(t *TLS, lpFileName uintptr, fInfoLevelId int32, lpFindFileData uintptr, fSearchOp int32, lpSearchFilter uintptr, dwAdditionalFlags uint32) uintptr {
+ if __ccgo_strace {
+ trc("t=%v lpFileName=%v fInfoLevelId=%v lpFindFileData=%v fSearchOp=%v lpSearchFilter=%v dwAdditionalFlags=%v, (%v:)", t, lpFileName, fInfoLevelId, lpFindFileData, fSearchOp, lpSearchFilter, dwAdditionalFlags, origin(2))
+ }
r0, _, e1 := syscall.Syscall6(procFindFirstFileExW.Addr(), 6, lpFileName, uintptr(fInfoLevelId), lpFindFileData, uintptr(fSearchOp), lpSearchFilter, uintptr(dwAdditionalFlags))
handle := syscall.Handle(r0)
if handle == syscall.InvalidHandle {
@@ -2759,6 +3179,9 @@ func XFindFirstFileExW(t *TLS, lpFileName uintptr, fInfoLevelId int32, lpFindFil
// BOOL FindClose(HANDLE hFindFile);
func XFindClose(t *TLS, hFindFile uintptr) int32 {
+ if __ccgo_strace {
+ trc("t=%v hFindFile=%v, (%v:)", t, hFindFile, origin(2))
+ }
r0, _, e1 := syscall.Syscall(procFindClose.Addr(), 1, hFindFile, 0, 0)
if r0 == 0 {
if e1 != 0 {
@@ -2777,6 +3200,9 @@ func XFindClose(t *TLS, hFindFile uintptr) int32 {
//
// );
func XFindNextFileW(t *TLS, hFindFile, lpFindFileData uintptr) int32 {
+ if __ccgo_strace {
+ trc("t=%v lpFindFileData=%v, (%v:)", t, lpFindFileData, origin(2))
+ }
r0, _, e1 := syscall.Syscall(procFindNextFileW.Addr(), 2, hFindFile, lpFindFileData, 0)
if r0 == 0 {
if e1 != 0 {
@@ -2795,6 +3221,9 @@ func XFindNextFileW(t *TLS, hFindFile, lpFindFileData uintptr) int32 {
//
// );
func XGetLogicalDriveStringsA(t *TLS, nBufferLength uint32, lpBuffer uintptr) uint32 {
+ if __ccgo_strace {
+ trc("t=%v nBufferLength=%v lpBuffer=%v, (%v:)", t, nBufferLength, lpBuffer, origin(2))
+ }
r0, _, err := syscall.Syscall(procGetLogicalDriveStringsA.Addr(), 2, uintptr(nBufferLength), lpBuffer, 0)
if err != 0 {
t.setErrno(err)
@@ -2815,6 +3244,9 @@ func XGetLogicalDriveStringsA(t *TLS, nBufferLength uint32, lpBuffer uintptr) ui
//
// );
func XGetVolumeInformationA(t *TLS, lpRootPathName, lpVolumeNameBuffer uintptr, nVolumeNameSize uint32, lpVolumeSerialNumber, lpMaximumComponentLength, lpFileSystemFlags, lpFileSystemNameBuffer uintptr, nFileSystemNameSize uint32) int32 {
+ if __ccgo_strace {
+ trc("t=%v lpVolumeNameBuffer=%v nVolumeNameSize=%v lpFileSystemNameBuffer=%v nFileSystemNameSize=%v, (%v:)", t, lpVolumeNameBuffer, nVolumeNameSize, lpFileSystemNameBuffer, nFileSystemNameSize, origin(2))
+ }
r0, _, err := syscall.Syscall9(procGetVolumeInformationA.Addr(), 8,
lpRootPathName,
lpVolumeNameBuffer,
@@ -2840,6 +3272,9 @@ func XGetVolumeInformationA(t *TLS, lpRootPathName, lpVolumeNameBuffer uintptr,
//
// );
func XCreateHardLinkW(t *TLS, lpFileName, lpExistingFileName, lpSecurityAttributes uintptr) int32 {
+ if __ccgo_strace {
+ trc("t=%v lpSecurityAttributes=%v, (%v:)", t, lpSecurityAttributes, origin(2))
+ }
r0, _, err := syscall.Syscall(procCreateHardLinkW.Addr(), 1, lpFileName, lpExistingFileName, lpSecurityAttributes)
if err != 0 {
t.setErrno(err)
@@ -2860,6 +3295,9 @@ func XCreateHardLinkW(t *TLS, lpFileName, lpExistingFileName, lpSecurityAttribut
//
// );
func XDeviceIoControl(t *TLS, hDevice uintptr, dwIoControlCode uint32, lpInBuffer uintptr, nInBufferSize uint32, lpOutBuffer uintptr, nOutBufferSize uint32, lpBytesReturned, lpOverlapped uintptr) int32 {
+ if __ccgo_strace {
+ trc("t=%v hDevice=%v dwIoControlCode=%v lpInBuffer=%v nInBufferSize=%v lpOutBuffer=%v nOutBufferSize=%v lpOverlapped=%v, (%v:)", t, hDevice, dwIoControlCode, lpInBuffer, nInBufferSize, lpOutBuffer, nOutBufferSize, lpOverlapped, origin(2))
+ }
r0, _, err := syscall.Syscall9(procDeviceIoControl.Addr(), 8, hDevice, uintptr(dwIoControlCode), lpInBuffer,
uintptr(nInBufferSize), lpOutBuffer, uintptr(nOutBufferSize), lpBytesReturned, lpOverlapped, 0)
if r0 == 0 {
@@ -2876,6 +3314,9 @@ func XDeviceIoControl(t *TLS, hDevice uintptr, dwIoControlCode uint32, lpInBuffe
//
// );
func Xwcsncmp(t *TLS, string1, string2 uintptr, count types.Size_t) int32 {
+ if __ccgo_strace {
+ trc("t=%v string2=%v count=%v, (%v:)", t, string2, count, origin(2))
+ }
var s1 = goWideString(string1)
var l1 = len(s1)
var s2 = goWideString(string2)
@@ -2908,6 +3349,9 @@ func Xwcsncmp(t *TLS, string1, string2 uintptr, count types.Size_t) int32 {
//
// );
func XMultiByteToWideChar(t *TLS, CodePage uint32, dwFlags uint32, lpMultiByteStr uintptr, cbMultiByte int32, lpWideCharStr uintptr, cchWideChar int32) int32 {
+ if __ccgo_strace {
+ trc("t=%v CodePage=%v dwFlags=%v lpMultiByteStr=%v cbMultiByte=%v lpWideCharStr=%v cchWideChar=%v, (%v:)", t, CodePage, dwFlags, lpMultiByteStr, cbMultiByte, lpWideCharStr, cchWideChar, origin(2))
+ }
r1, _, _ := syscall.Syscall6(procMultiByteToWideChar.Addr(), 6,
uintptr(CodePage), uintptr(dwFlags), uintptr(lpMultiByteStr),
uintptr(cbMultiByte), uintptr(lpWideCharStr), uintptr(cchWideChar))
@@ -2920,6 +3364,9 @@ func XMultiByteToWideChar(t *TLS, CodePage uint32, dwFlags uint32, lpMultiByteSt
//
// );
func XOutputDebugStringW(t *TLS, lpOutputString uintptr) {
+ if __ccgo_strace {
+ trc("t=%v lpOutputString=%v, (%v:)", t, lpOutputString, origin(2))
+ }
panic(todo(""))
}
@@ -2937,6 +3384,9 @@ func XMessageBeep(t *TLS, _ ...interface{}) int32 {
//
// );
func X_InterlockedCompareExchange(t *TLS, Destination uintptr, Exchange, Comparand long) long {
+ if __ccgo_strace {
+ trc("t=%v Destination=%v Comparand=%v, (%v:)", t, Destination, Comparand, origin(2))
+ }
// The function returns the initial value of the Destination parameter.
var v = *(*int32)(unsafe.Pointer(Destination))
@@ -2946,11 +3396,17 @@ func X_InterlockedCompareExchange(t *TLS, Destination uintptr, Exchange, Compara
// int rename(const char *oldpath, const char *newpath);
func Xrename(t *TLS, oldpath, newpath uintptr) int32 {
+ if __ccgo_strace {
+ trc("t=%v newpath=%v, (%v:)", t, newpath, origin(2))
+ }
panic(todo(""))
}
// BOOL AreFileApisANSI();
func XAreFileApisANSI(t *TLS) int32 {
+ if __ccgo_strace {
+ trc("t=%v, (%v:)", t, origin(2))
+ }
r0, _, _ := syscall.Syscall(procAreFileApisANSI.Addr(), 0, 0, 0, 0)
return int32(r0)
@@ -2996,6 +3452,9 @@ func XCreateFileA(t *TLS, lpFileName uintptr, dwDesiredAccess, dwShareMode uint3
//
// );
func XCreateFileMappingA(t *TLS, hFile, lpFileMappingAttributes uintptr, flProtect, dwMaximumSizeHigh, dwMaximumSizeLow uint32, lpName uintptr) uintptr {
+ if __ccgo_strace {
+ trc("t=%v lpFileMappingAttributes=%v dwMaximumSizeLow=%v lpName=%v, (%v:)", t, lpFileMappingAttributes, dwMaximumSizeLow, lpName, origin(2))
+ }
panic(todo(""))
}
@@ -3010,6 +3469,9 @@ func XCreateFileMappingA(t *TLS, hFile, lpFileMappingAttributes uintptr, flProte
//
// );
func XCreateFileMappingW(t *TLS, hFile, lpFileMappingAttributes uintptr, flProtect, dwMaximumSizeHigh, dwMaximumSizeLow uint32, lpName uintptr) uintptr {
+ if __ccgo_strace {
+ trc("t=%v lpFileMappingAttributes=%v dwMaximumSizeLow=%v lpName=%v, (%v:)", t, lpFileMappingAttributes, dwMaximumSizeLow, lpName, origin(2))
+ }
h, _, e1 := syscall.Syscall6(procCreateFileMappingW.Addr(), 6, hFile, lpFileMappingAttributes, uintptr(flProtect),
uintptr(dwMaximumSizeHigh), uintptr(dwMaximumSizeLow), lpName)
if h == 0 {
@@ -3030,6 +3492,9 @@ func XCreateFileMappingW(t *TLS, hFile, lpFileMappingAttributes uintptr, flProte
//
// );
func XCreateMutexW(t *TLS, lpMutexAttributes uintptr, bInitialOwner int32, lpName uintptr) uintptr {
+ if __ccgo_strace {
+ trc("t=%v lpMutexAttributes=%v bInitialOwner=%v lpName=%v, (%v:)", t, lpMutexAttributes, bInitialOwner, lpName, origin(2))
+ }
panic(todo(""))
}
@@ -3039,6 +3504,9 @@ func XCreateMutexW(t *TLS, lpMutexAttributes uintptr, bInitialOwner int32, lpNam
//
// );
func XDeleteFileA(t *TLS, lpFileName uintptr) int32 {
+ if __ccgo_strace {
+ trc("t=%v lpFileName=%v, (%v:)", t, lpFileName, origin(2))
+ }
panic(todo(""))
}
@@ -3054,6 +3522,9 @@ func XDeleteFileA(t *TLS, lpFileName uintptr) int32 {
//
// );
func XFormatMessageA(t *TLS, dwFlagsAndAttributes uint32, lpSource uintptr, dwMessageId, dwLanguageId uint32, lpBuffer uintptr, nSize uint32, Arguments uintptr) uint32 {
+ if __ccgo_strace {
+ trc("t=%v dwFlagsAndAttributes=%v lpSource=%v dwLanguageId=%v lpBuffer=%v nSize=%v Arguments=%v, (%v:)", t, dwFlagsAndAttributes, lpSource, dwLanguageId, lpBuffer, nSize, Arguments, origin(2))
+ }
panic(todo(""))
}
@@ -3069,6 +3540,9 @@ func XFormatMessageA(t *TLS, dwFlagsAndAttributes uint32, lpSource uintptr, dwMe
//
// );
func XFormatMessageW(t *TLS, dwFlags uint32, lpSource uintptr, dwMessageId, dwLanguageId uint32, lpBuffer uintptr, nSize uint32, Arguments uintptr) uint32 {
+ if __ccgo_strace {
+ trc("t=%v dwFlags=%v lpSource=%v dwLanguageId=%v lpBuffer=%v nSize=%v Arguments=%v, (%v:)", t, dwFlags, lpSource, dwLanguageId, lpBuffer, nSize, Arguments, origin(2))
+ }
r0, _, e1 := syscall.Syscall9(procFormatMessageW.Addr(), 7,
uintptr(dwFlags), lpSource, uintptr(dwMessageId), uintptr(dwLanguageId),
lpBuffer, uintptr(nSize), Arguments, 0, 0)
@@ -3085,11 +3559,17 @@ func XFormatMessageW(t *TLS, dwFlags uint32, lpSource uintptr, dwMessageId, dwLa
// BOOL FreeLibrary(HMODULE hLibModule);
func XFreeLibrary(t *TLS, hLibModule uintptr) int32 {
+ if __ccgo_strace {
+ trc("t=%v hLibModule=%v, (%v:)", t, hLibModule, origin(2))
+ }
panic(todo(""))
}
// DWORD GetCurrentProcessId();
func XGetCurrentProcessId(t *TLS) uint32 {
+ if __ccgo_strace {
+ trc("t=%v, (%v:)", t, origin(2))
+ }
r0, _, _ := syscall.Syscall(procGetCurrentProcessId.Addr(), 0, 0, 0, 0)
pid := uint32(r0)
return pid
@@ -3105,6 +3585,9 @@ func XGetCurrentProcessId(t *TLS) uint32 {
//
// );
func XGetDiskFreeSpaceA(t *TLS, lpRootPathName, lpSectorsPerCluster, lpBytesPerSector, lpNumberOfFreeClusters, lpTotalNumberOfClusters uintptr) int32 {
+ if __ccgo_strace {
+ trc("t=%v lpTotalNumberOfClusters=%v, (%v:)", t, lpTotalNumberOfClusters, origin(2))
+ }
panic(todo(""))
}
@@ -3118,6 +3601,9 @@ func XGetDiskFreeSpaceA(t *TLS, lpRootPathName, lpSectorsPerCluster, lpBytesPerS
//
// );
func XGetDiskFreeSpaceW(t *TLS, lpRootPathName, lpSectorsPerCluster, lpBytesPerSector, lpNumberOfFreeClusters, lpTotalNumberOfClusters uintptr) int32 {
+ if __ccgo_strace {
+ trc("t=%v lpTotalNumberOfClusters=%v, (%v:)", t, lpTotalNumberOfClusters, origin(2))
+ }
panic(todo(""))
}
@@ -3127,6 +3613,9 @@ func XGetDiskFreeSpaceW(t *TLS, lpRootPathName, lpSectorsPerCluster, lpBytesPerS
//
// );
func XGetFileAttributesA(t *TLS, lpFileName uintptr) uint32 {
+ if __ccgo_strace {
+ trc("t=%v lpFileName=%v, (%v:)", t, lpFileName, origin(2))
+ }
r0, _, err := syscall.Syscall(procGetFileAttributesA.Addr(), 1, lpFileName, 0, 0)
if err != 0 {
t.setErrno(err)
@@ -3142,6 +3631,9 @@ func XGetFileAttributesA(t *TLS, lpFileName uintptr) uint32 {
//
// );
func XGetFileAttributesExW(t *TLS, lpFileName uintptr, fInfoLevelId uint32, lpFileInformation uintptr) int32 {
+ if __ccgo_strace {
+ trc("t=%v lpFileName=%v fInfoLevelId=%v lpFileInformation=%v, (%v:)", t, lpFileName, fInfoLevelId, lpFileInformation, origin(2))
+ }
r1, _, e1 := syscall.Syscall(procGetFileAttributesExW.Addr(), 3, lpFileName, uintptr(fInfoLevelId), lpFileInformation)
if r1 == 0 {
if e1 != 0 {
@@ -3161,6 +3653,9 @@ func XGetFileAttributesExW(t *TLS, lpFileName uintptr, fInfoLevelId uint32, lpFi
//
// );
func XGetFileSize(t *TLS, hFile, lpFileSizeHigh uintptr) uint32 {
+ if __ccgo_strace {
+ trc("t=%v lpFileSizeHigh=%v, (%v:)", t, lpFileSizeHigh, origin(2))
+ }
r1, _, e1 := syscall.Syscall(procGetFileSize.Addr(), 2, hFile, lpFileSizeHigh, 0)
if r1 == math.MaxUint32 {
if lpFileSizeHigh == 0 {
@@ -3188,11 +3683,17 @@ func XGetFileSize(t *TLS, hFile, lpFileSizeHigh uintptr) uint32 {
//
// );
func XGetFullPathNameA(t *TLS, lpFileName uintptr, nBufferLength uint32, lpBuffer, lpFilePart uintptr) uint32 {
+ if __ccgo_strace {
+ trc("t=%v lpFileName=%v nBufferLength=%v lpFilePart=%v, (%v:)", t, lpFileName, nBufferLength, lpFilePart, origin(2))
+ }
panic(todo(""))
}
// FARPROC GetProcAddress(HMODULE hModule, LPCSTR lpProcName);
func XGetProcAddress(t *TLS, hModule, lpProcName uintptr) uintptr {
+ if __ccgo_strace {
+ trc("t=%v lpProcName=%v, (%v:)", t, lpProcName, origin(2))
+ }
return 0
@@ -3211,6 +3712,9 @@ func XGetProcAddress(t *TLS, hModule, lpProcName uintptr) uintptr {
//
// );
func XRtlGetVersion(t *TLS, lpVersionInformation uintptr) uintptr {
+ if __ccgo_strace {
+ trc("t=%v lpVersionInformation=%v, (%v:)", t, lpVersionInformation, origin(2))
+ }
panic(todo(""))
}
@@ -3220,11 +3724,17 @@ func XRtlGetVersion(t *TLS, lpVersionInformation uintptr) uintptr {
//
// );
func XGetSystemInfo(t *TLS, lpSystemInfo uintptr) {
+ if __ccgo_strace {
+ trc("t=%v lpSystemInfo=%v, (%v:)", t, lpSystemInfo, origin(2))
+ }
syscall.Syscall(procGetSystemInfo.Addr(), 1, lpSystemInfo, 0, 0)
}
// void GetSystemTime(LPSYSTEMTIME lpSystemTime);
func XGetSystemTime(t *TLS, lpSystemTime uintptr) {
+ if __ccgo_strace {
+ trc("t=%v lpSystemTime=%v, (%v:)", t, lpSystemTime, origin(2))
+ }
syscall.Syscall(procGetSystemTime.Addr(), 1, lpSystemTime, 0, 0)
}
@@ -3234,6 +3744,9 @@ func XGetSystemTime(t *TLS, lpSystemTime uintptr) {
//
// );
func XGetSystemTimeAsFileTime(t *TLS, lpSystemTimeAsFileTime uintptr) {
+ if __ccgo_strace {
+ trc("t=%v lpSystemTimeAsFileTime=%v, (%v:)", t, lpSystemTimeAsFileTime, origin(2))
+ }
syscall.Syscall(procGetSystemTimeAsFileTime.Addr(), 1, lpSystemTimeAsFileTime, 0, 0)
}
@@ -3244,6 +3757,9 @@ func XGetSystemTimeAsFileTime(t *TLS, lpSystemTimeAsFileTime uintptr) {
//
// );
func XGetTempPathA(t *TLS, nBufferLength uint32, lpBuffer uintptr) uint32 {
+ if __ccgo_strace {
+ trc("t=%v nBufferLength=%v lpBuffer=%v, (%v:)", t, nBufferLength, lpBuffer, origin(2))
+ }
panic(todo(""))
}
@@ -3254,6 +3770,9 @@ func XGetTempPathA(t *TLS, nBufferLength uint32, lpBuffer uintptr) uint32 {
//
// );
func XGetTempPathW(t *TLS, nBufferLength uint32, lpBuffer uintptr) uint32 {
+ if __ccgo_strace {
+ trc("t=%v nBufferLength=%v lpBuffer=%v, (%v:)", t, nBufferLength, lpBuffer, origin(2))
+ }
rv, err := syscall.GetTempPath(nBufferLength, (*uint16)(unsafe.Pointer(lpBuffer)))
if err != nil {
t.setErrno(err)
@@ -3263,6 +3782,9 @@ func XGetTempPathW(t *TLS, nBufferLength uint32, lpBuffer uintptr) uint32 {
// DWORD GetTickCount();
func XGetTickCount(t *TLS) uint32 {
+ if __ccgo_strace {
+ trc("t=%v, (%v:)", t, origin(2))
+ }
r0, _, _ := syscall.Syscall(procGetTickCount.Addr(), 0, 0, 0, 0)
return uint32(r0)
}
@@ -3273,6 +3795,9 @@ func XGetTickCount(t *TLS) uint32 {
//
// );
func XGetVersionExA(t *TLS, lpVersionInformation uintptr) int32 {
+ if __ccgo_strace {
+ trc("t=%v lpVersionInformation=%v, (%v:)", t, lpVersionInformation, origin(2))
+ }
r0, _, err := syscall.Syscall(procGetVersionExA.Addr(), 1, lpVersionInformation, 0, 0)
if r0 == 0 {
t.setErrno(err)
@@ -3288,6 +3813,9 @@ func XGetVersionExA(t *TLS, lpVersionInformation uintptr) int32 {
//
// );
func XHeapCreate(t *TLS, flOptions uint32, dwInitialSize, dwMaximumSize types.Size_t) uintptr {
+ if __ccgo_strace {
+ trc("t=%v flOptions=%v dwMaximumSize=%v, (%v:)", t, flOptions, dwMaximumSize, origin(2))
+ }
panic(todo(""))
}
@@ -3297,6 +3825,9 @@ func XHeapCreate(t *TLS, flOptions uint32, dwInitialSize, dwMaximumSize types.Si
//
// );
func XHeapDestroy(t *TLS, hHeap uintptr) int32 {
+ if __ccgo_strace {
+ trc("t=%v hHeap=%v, (%v:)", t, hHeap, origin(2))
+ }
panic(todo(""))
}
@@ -3309,6 +3840,9 @@ func XHeapDestroy(t *TLS, hHeap uintptr) int32 {
//
// );
func XHeapReAlloc(t *TLS, hHeap uintptr, dwFlags uint32, lpMem uintptr, dwBytes types.Size_t) uintptr {
+ if __ccgo_strace {
+ trc("t=%v hHeap=%v dwFlags=%v lpMem=%v dwBytes=%v, (%v:)", t, hHeap, dwFlags, lpMem, dwBytes, origin(2))
+ }
panic(todo(""))
}
@@ -3320,6 +3854,9 @@ func XHeapReAlloc(t *TLS, hHeap uintptr, dwFlags uint32, lpMem uintptr, dwBytes
//
// );
func XHeapSize(t *TLS, hHeap uintptr, dwFlags uint32, lpMem uintptr) types.Size_t {
+ if __ccgo_strace {
+ trc("t=%v hHeap=%v dwFlags=%v lpMem=%v, (%v:)", t, hHeap, dwFlags, lpMem, origin(2))
+ }
panic(todo(""))
}
@@ -3331,6 +3868,9 @@ func XHeapSize(t *TLS, hHeap uintptr, dwFlags uint32, lpMem uintptr) types.Size_
//
// );
func XHeapValidate(t *TLS, hHeap uintptr, dwFlags uint32, lpMem uintptr) int32 {
+ if __ccgo_strace {
+ trc("t=%v hHeap=%v dwFlags=%v lpMem=%v, (%v:)", t, hHeap, dwFlags, lpMem, origin(2))
+ }
panic(todo(""))
}
@@ -3341,11 +3881,17 @@ func XHeapValidate(t *TLS, hHeap uintptr, dwFlags uint32, lpMem uintptr) int32 {
//
// );
func XHeapCompact(t *TLS, hHeap uintptr, dwFlags uint32) types.Size_t {
+ if __ccgo_strace {
+ trc("t=%v hHeap=%v dwFlags=%v, (%v:)", t, hHeap, dwFlags, origin(2))
+ }
panic(todo(""))
}
// HMODULE LoadLibraryA(LPCSTR lpLibFileName);
func XLoadLibraryA(t *TLS, lpLibFileName uintptr) uintptr {
+ if __ccgo_strace {
+ trc("t=%v lpLibFileName=%v, (%v:)", t, lpLibFileName, origin(2))
+ }
panic(todo(""))
}
@@ -3355,6 +3901,9 @@ func XLoadLibraryA(t *TLS, lpLibFileName uintptr) uintptr {
//
// );
func XLoadLibraryW(t *TLS, lpLibFileName uintptr) uintptr {
+ if __ccgo_strace {
+ trc("t=%v lpLibFileName=%v, (%v:)", t, lpLibFileName, origin(2))
+ }
panic(todo(""))
}
@@ -3364,6 +3913,9 @@ func XLoadLibraryW(t *TLS, lpLibFileName uintptr) uintptr {
//
// );
func XLocalFree(t *TLS, hMem uintptr) uintptr {
+ if __ccgo_strace {
+ trc("t=%v hMem=%v, (%v:)", t, hMem, origin(2))
+ }
h, err := syscall.LocalFree(syscall.Handle(hMem))
if h != 0 {
if err != nil {
@@ -3386,6 +3938,9 @@ func XLocalFree(t *TLS, hMem uintptr) uintptr {
//
// );
func XLockFile(t *TLS, hFile uintptr, dwFileOffsetLow, dwFileOffsetHigh, nNumberOfBytesToLockLow, nNumberOfBytesToLockHigh uint32) int32 {
+ if __ccgo_strace {
+ trc("t=%v hFile=%v nNumberOfBytesToLockHigh=%v, (%v:)", t, hFile, nNumberOfBytesToLockHigh, origin(2))
+ }
r1, _, e1 := syscall.Syscall6(procLockFile.Addr(), 5,
hFile, uintptr(dwFileOffsetLow), uintptr(dwFileOffsetHigh), uintptr(nNumberOfBytesToLockLow), uintptr(nNumberOfBytesToLockHigh), 0)
@@ -3412,6 +3967,9 @@ func XLockFile(t *TLS, hFile uintptr, dwFileOffsetLow, dwFileOffsetHigh, nNumber
//
// );
func XLockFileEx(t *TLS, hFile uintptr, dwFlags, dwReserved, nNumberOfBytesToLockLow, nNumberOfBytesToLockHigh uint32, lpOverlapped uintptr) int32 {
+ if __ccgo_strace {
+ trc("t=%v hFile=%v nNumberOfBytesToLockHigh=%v lpOverlapped=%v, (%v:)", t, hFile, nNumberOfBytesToLockHigh, lpOverlapped, origin(2))
+ }
r1, _, e1 := syscall.Syscall6(procLockFileEx.Addr(), 6,
hFile, uintptr(dwFlags), uintptr(dwReserved), uintptr(nNumberOfBytesToLockLow), uintptr(nNumberOfBytesToLockHigh), lpOverlapped)
if r1 == 0 {
@@ -3435,6 +3993,9 @@ func XLockFileEx(t *TLS, hFile uintptr, dwFlags, dwReserved, nNumberOfBytesToLoc
//
// );
func XMapViewOfFile(t *TLS, hFileMappingObject uintptr, dwDesiredAccess, dwFileOffsetHigh, dwFileOffsetLow uint32, dwNumberOfBytesToMap types.Size_t) uintptr {
+ if __ccgo_strace {
+ trc("t=%v hFileMappingObject=%v dwFileOffsetLow=%v dwNumberOfBytesToMap=%v, (%v:)", t, hFileMappingObject, dwFileOffsetLow, dwNumberOfBytesToMap, origin(2))
+ }
h, _, e1 := syscall.Syscall6(procMapViewOfFile.Addr(), 5, hFileMappingObject, uintptr(dwDesiredAccess),
uintptr(dwFileOffsetHigh), uintptr(dwFileOffsetLow), uintptr(dwNumberOfBytesToMap), 0)
if h == 0 {
@@ -3453,6 +4014,9 @@ func XMapViewOfFile(t *TLS, hFileMappingObject uintptr, dwDesiredAccess, dwFileO
//
// );
func XQueryPerformanceCounter(t *TLS, lpPerformanceCount uintptr) int32 {
+ if __ccgo_strace {
+ trc("t=%v lpPerformanceCount=%v, (%v:)", t, lpPerformanceCount, origin(2))
+ }
r0, _, _ := syscall.Syscall(procQueryPerformanceCounter.Addr(), 1, lpPerformanceCount, 0, 0)
return int32(r0)
}
@@ -3463,11 +4027,17 @@ func XQueryPerformanceCounter(t *TLS, lpPerformanceCount uintptr) int32 {
//
// );
func XSleep(t *TLS, dwMilliseconds uint32) {
+ if __ccgo_strace {
+ trc("t=%v dwMilliseconds=%v, (%v:)", t, dwMilliseconds, origin(2))
+ }
gotime.Sleep(gotime.Duration(dwMilliseconds) * gotime.Millisecond)
}
// BOOL SystemTimeToFileTime(const SYSTEMTIME *lpSystemTime, LPFILETIME lpFileTime);
func XSystemTimeToFileTime(t *TLS, lpSystemTime, lpFileTime uintptr) int32 {
+ if __ccgo_strace {
+ trc("t=%v lpFileTime=%v, (%v:)", t, lpFileTime, origin(2))
+ }
r0, _, _ := syscall.Syscall(procSystemTimeToFileTime.Addr(), 2, lpSystemTime, lpFileTime, 0)
return int32(r0)
}
@@ -3482,6 +4052,9 @@ func XSystemTimeToFileTime(t *TLS, lpSystemTime, lpFileTime uintptr) int32 {
//
// );
func XUnlockFile(t *TLS, hFile uintptr, dwFileOffsetLow, dwFileOffsetHigh, nNumberOfBytesToUnlockLow, nNumberOfBytesToUnlockHigh uint32) int32 {
+ if __ccgo_strace {
+ trc("t=%v hFile=%v nNumberOfBytesToUnlockHigh=%v, (%v:)", t, hFile, nNumberOfBytesToUnlockHigh, origin(2))
+ }
r1, _, e1 := syscall.Syscall6(procUnlockFile.Addr(), 5,
hFile, uintptr(dwFileOffsetLow), uintptr(dwFileOffsetHigh), uintptr(nNumberOfBytesToUnlockLow), uintptr(nNumberOfBytesToUnlockHigh), 0)
if r1 == 0 {
@@ -3505,6 +4078,9 @@ func XUnlockFile(t *TLS, hFile uintptr, dwFileOffsetLow, dwFileOffsetHigh, nNumb
//
// );
func XUnlockFileEx(t *TLS, hFile uintptr, dwReserved, nNumberOfBytesToUnlockLow, nNumberOfBytesToUnlockHigh uint32, lpOverlapped uintptr) int32 {
+ if __ccgo_strace {
+ trc("t=%v hFile=%v nNumberOfBytesToUnlockHigh=%v lpOverlapped=%v, (%v:)", t, hFile, nNumberOfBytesToUnlockHigh, lpOverlapped, origin(2))
+ }
r1, _, e1 := syscall.Syscall6(procUnlockFileEx.Addr(), 5,
hFile, uintptr(dwReserved), uintptr(nNumberOfBytesToUnlockLow), uintptr(nNumberOfBytesToUnlockHigh), lpOverlapped, 0)
if r1 == 0 {
@@ -3524,6 +4100,9 @@ func XUnlockFileEx(t *TLS, hFile uintptr, dwReserved, nNumberOfBytesToUnlockLow,
//
// );
func XUnmapViewOfFile(t *TLS, lpBaseAddress uintptr) int32 {
+ if __ccgo_strace {
+ trc("t=%v lpBaseAddress=%v, (%v:)", t, lpBaseAddress, origin(2))
+ }
err := syscall.UnmapViewOfFile(lpBaseAddress)
if err != nil {
t.setErrno(err)
@@ -3545,6 +4124,9 @@ func XUnmapViewOfFile(t *TLS, lpBaseAddress uintptr) int32 {
//
// );
func XWideCharToMultiByte(t *TLS, CodePage uint32, dwFlags uint32, lpWideCharStr uintptr, cchWideChar int32, lpMultiByteStr uintptr, cbMultiByte int32, lpDefaultChar, lpUsedDefaultChar uintptr) int32 {
+ if __ccgo_strace {
+ trc("t=%v CodePage=%v dwFlags=%v lpWideCharStr=%v cchWideChar=%v lpMultiByteStr=%v cbMultiByte=%v lpUsedDefaultChar=%v, (%v:)", t, CodePage, dwFlags, lpWideCharStr, cchWideChar, lpMultiByteStr, cbMultiByte, lpUsedDefaultChar, origin(2))
+ }
r1, _, _ := syscall.Syscall9(procWideCharToMultiByte.Addr(), 8,
uintptr(CodePage), uintptr(dwFlags), lpWideCharStr,
uintptr(cchWideChar), lpMultiByteStr, uintptr(cbMultiByte),
@@ -3558,6 +4140,9 @@ func XWideCharToMultiByte(t *TLS, CodePage uint32, dwFlags uint32, lpWideCharStr
//
// )
func XOutputDebugStringA(t *TLS, lpOutputString uintptr) {
+ if __ccgo_strace {
+ trc("t=%v lpOutputString=%v, (%v:)", t, lpOutputString, origin(2))
+ }
panic(todo(""))
}
@@ -3568,6 +4153,9 @@ func XOutputDebugStringA(t *TLS, lpOutputString uintptr) {
//
// );
func XFlushViewOfFile(t *TLS, lpBaseAddress uintptr, dwNumberOfBytesToFlush types.Size_t) int32 {
+ if __ccgo_strace {
+ trc("t=%v lpBaseAddress=%v dwNumberOfBytesToFlush=%v, (%v:)", t, lpBaseAddress, dwNumberOfBytesToFlush, origin(2))
+ }
err := syscall.FlushViewOfFile(lpBaseAddress, uintptr(dwNumberOfBytesToFlush))
if err != nil {
t.setErrno(err)
@@ -3605,6 +4193,9 @@ func WindowsTickToUnixSeconds(windowsTicks int64) int64 {
// int _stat64(const char *path, struct __stat64 *buffer);
func X_stat64(t *TLS, path, buffer uintptr) int32 {
+ if __ccgo_strace {
+ trc("t=%v buffer=%v, (%v:)", t, buffer, origin(2))
+ }
var fa syscall.Win32FileAttributeData
r1, _, e1 := syscall.Syscall(procGetFileAttributesExA.Addr(), 3, path, syscall.GetFileExInfoStandard, (uintptr)(unsafe.Pointer(&fa)))
@@ -3658,6 +4249,9 @@ func WindowsAttrbiutesToStat(fa uint32) uint16 {
//
// );
func X_chsize(t *TLS, fd int32, size long) int32 {
+ if __ccgo_strace {
+ trc("t=%v fd=%v size=%v, (%v:)", t, fd, size, origin(2))
+ }
f, ok := fdToFile(fd)
if !ok {
@@ -3676,6 +4270,9 @@ func X_chsize(t *TLS, fd int32, size long) int32 {
// int _snprintf(char *str, size_t size, const char *format, ...);
func X_snprintf(t *TLS, str uintptr, size types.Size_t, format, args uintptr) int32 {
+ if __ccgo_strace {
+ trc("t=%v str=%v size=%v args=%v, (%v:)", t, str, size, args, origin(2))
+ }
return Xsnprintf(t, str, size, format, args)
}
@@ -3711,6 +4308,9 @@ func win32FindDataToFileInfo(t *TLS, fdata *stat.X_finddata64i32_t, wfd *syscall
//
// );
func X_findfirst64i32(t *TLS, filespec, fileinfo uintptr) types.Intptr_t {
+ if __ccgo_strace {
+ trc("t=%v fileinfo=%v, (%v:)", t, fileinfo, origin(2))
+ }
// Note: this is the 'narrow' character findfirst -- expects output
// as mbcs -- conversion below -- via ToFileInfo
@@ -3746,6 +4346,9 @@ func X_findfirst64i32(t *TLS, filespec, fileinfo uintptr) types.Intptr_t {
//
// );
func X_findnext64i32(t *TLS, handle types.Intptr_t, fileinfo uintptr) int32 {
+ if __ccgo_strace {
+ trc("t=%v handle=%v fileinfo=%v, (%v:)", t, handle, fileinfo, origin(2))
+ }
var fdata = (*stat.X_finddata64i32_t)(unsafe.Pointer(fileinfo))
var wfd syscall.Win32finddata
@@ -3769,6 +4372,9 @@ func X_findnext64i32(t *TLS, handle types.Intptr_t, fileinfo uintptr) int32 {
//
// );
func X_findclose(t *TLS, handle types.Intptr_t) int32 {
+ if __ccgo_strace {
+ trc("t=%v handle=%v, (%v:)", t, handle, origin(2))
+ }
err := syscall.FindClose(syscall.Handle(handle))
if err != nil {
@@ -3786,6 +4392,9 @@ func X_findclose(t *TLS, handle types.Intptr_t) int32 {
//
// );
func XGetEnvironmentVariableA(t *TLS, lpName, lpBuffer uintptr, nSize uint32) uint32 {
+ if __ccgo_strace {
+ trc("t=%v lpBuffer=%v nSize=%v, (%v:)", t, lpBuffer, nSize, origin(2))
+ }
r0, _, e1 := syscall.Syscall(procGetEnvironmentVariableA.Addr(), 3, lpName, lpBuffer, uintptr(nSize))
n := uint32(r0)
if n == 0 {
@@ -3805,6 +4414,9 @@ func XGetEnvironmentVariableA(t *TLS, lpName, lpBuffer uintptr, nSize uint32) ui
//
// );
func X_fstat64(t *TLS, fd int32, buffer uintptr) int32 {
+ if __ccgo_strace {
+ trc("t=%v fd=%v buffer=%v, (%v:)", t, fd, buffer, origin(2))
+ }
f, ok := fdToFile(fd)
if !ok {
@@ -3842,6 +4454,9 @@ func X_fstat64(t *TLS, fd int32, buffer uintptr) int32 {
//
// );
func XCreateEventA(t *TLS, lpEventAttributes uintptr, bManualReset, bInitialState int32, lpName uintptr) uintptr {
+ if __ccgo_strace {
+ trc("t=%v lpEventAttributes=%v bInitialState=%v lpName=%v, (%v:)", t, lpEventAttributes, bInitialState, lpName, origin(2))
+ }
r0, _, err := syscall.Syscall6(procCreateEventA.Addr(), 4, lpEventAttributes, uintptr(bManualReset),
uintptr(bInitialState), lpName, 0, 0)
if r0 == 0 {
@@ -3856,6 +4471,9 @@ func XCreateEventA(t *TLS, lpEventAttributes uintptr, bManualReset, bInitialStat
//
// );
func XCancelSynchronousIo(t *TLS, hThread uintptr) int32 {
+ if __ccgo_strace {
+ trc("t=%v hThread=%v, (%v:)", t, hThread, origin(2))
+ }
panic(todo(""))
}
@@ -3868,6 +4486,9 @@ func X_endthreadex(t *TLS, _ ...interface{}) {
// and gets that via the go callback. This is safe because the thread is calling into go
// not a cdecl function which would expect the stack setup of cdecl.
func X_beginthread(t *TLS, procAddr uintptr, stack_sz uint32, args uintptr) int32 {
+ if __ccgo_strace {
+ trc("t=%v procAddr=%v stack_sz=%v args=%v, (%v:)", t, procAddr, stack_sz, args, origin(2))
+ }
f := (*struct{ f func(*TLS, uintptr) uint32 })(unsafe.Pointer(&struct{ uintptr }{procAddr})).f
var tAdp = ThreadAdapter{threadFunc: f, tls: NewTLS(), param: args}
tAdp.token = addObject(&tAdp)
@@ -3905,6 +4526,9 @@ func X_beginthreadex(t *TLS, _ uintptr, stack_sz uint32, procAddr uintptr, args
// DWORD GetCurrentThreadId();
func XGetCurrentThreadId(t *TLS) uint32 {
+ if __ccgo_strace {
+ trc("t=%v, (%v:)", t, origin(2))
+ }
r0, _, _ := syscall.Syscall(procGetCurrentThreadId.Addr(), 0, 0, 0, 0)
return uint32(r0)
//return uint32(t.ID)
@@ -3917,6 +4541,9 @@ func XGetCurrentThreadId(t *TLS) uint32 {
//
// );
func XGetExitCodeThread(t *TLS, hThread, lpExitCode uintptr) int32 {
+ if __ccgo_strace {
+ trc("t=%v lpExitCode=%v, (%v:)", t, lpExitCode, origin(2))
+ }
r0, _, _ := syscall.Syscall(procGetExitCodeThread.Addr(), 2, hThread, lpExitCode, 0)
return int32(r0)
}
@@ -3929,6 +4556,9 @@ func XGetExitCodeThread(t *TLS, hThread, lpExitCode uintptr) int32 {
//
// );
func XWaitForSingleObjectEx(t *TLS, hHandle uintptr, dwMilliseconds uint32, bAlertable int32) uint32 {
+ if __ccgo_strace {
+ trc("t=%v hHandle=%v dwMilliseconds=%v bAlertable=%v, (%v:)", t, hHandle, dwMilliseconds, bAlertable, origin(2))
+ }
rv, _, _ := syscall.Syscall(procWaitForSingleObjectEx.Addr(), 3, hHandle, uintptr(dwMilliseconds), uintptr(bAlertable))
return uint32(rv)
}
@@ -3943,6 +4573,9 @@ func XWaitForSingleObjectEx(t *TLS, hHandle uintptr, dwMilliseconds uint32, bAle
//
// );
func XMsgWaitForMultipleObjectsEx(t *TLS, nCount uint32, pHandles uintptr, dwMilliseconds, dwWakeMask, dwFlags uint32) uint32 {
+ if __ccgo_strace {
+ trc("t=%v nCount=%v pHandles=%v dwFlags=%v, (%v:)", t, nCount, pHandles, dwFlags, origin(2))
+ }
r0, _, err := syscall.Syscall6(procMsgWaitForMultipleObjectsEx.Addr(), 5,
uintptr(nCount),
pHandles,
@@ -3969,6 +4602,9 @@ func XMessageBoxW(t *TLS, _ ...interface{}) int32 {
//
// );
func XGetModuleFileNameW(t *TLS, hModule, lpFileName uintptr, nSize uint32) uint32 {
+ if __ccgo_strace {
+ trc("t=%v lpFileName=%v nSize=%v, (%v:)", t, lpFileName, nSize, origin(2))
+ }
r0, _, err := syscall.Syscall(procGetModuleFileNameW.Addr(), 3, hModule, lpFileName, uintptr(nSize))
if r0 == 0 {
t.setErrno(err)
@@ -3984,6 +4620,9 @@ func XGetModuleFileNameW(t *TLS, hModule, lpFileName uintptr, nSize uint32) uint
//
// );
func XNetGetDCName(t *TLS, ServerName, DomainName, Buffer uintptr) int32 {
+ if __ccgo_strace {
+ trc("t=%v Buffer=%v, (%v:)", t, Buffer, origin(2))
+ }
r0, _, err := syscall.Syscall(procNetGetDCName.Addr(), 3, ServerName, DomainName, Buffer)
if err != 0 {
t.setErrno(err)
@@ -4000,6 +4639,9 @@ func XNetGetDCName(t *TLS, ServerName, DomainName, Buffer uintptr) int32 {
//
// );
func XNetUserGetInfo(t *TLS, servername, username uintptr, level uint32, bufptr uintptr) uint32 {
+ if __ccgo_strace {
+ trc("t=%v username=%v level=%v bufptr=%v, (%v:)", t, username, level, bufptr, origin(2))
+ }
r0, _, err := syscall.Syscall6(procNetUserGetInfo.Addr(), 4,
servername,
username,
@@ -4025,6 +4667,9 @@ func XlstrlenW(t *TLS, _ ...interface{}) int32 {
//
// );
func XGetProfilesDirectoryW(t *TLS, lpProfileDir, lpcchSize uintptr) int32 {
+ if __ccgo_strace {
+ trc("t=%v lpcchSize=%v, (%v:)", t, lpcchSize, origin(2))
+ }
r0, _, err := syscall.Syscall(procGetProfilesDirectoryW.Addr(), 2, lpProfileDir, lpcchSize, 0)
if err != 0 {
t.setErrno(err)
@@ -4047,6 +4692,9 @@ func XNetApiBufferFree(t *TLS, _ ...interface{}) int32 {
//
// );
func XGetPrivateProfileStringA(t *TLS, lpAppName, lpKeyName, lpDefault, lpReturnedString uintptr, nSize uint32, lpFileName uintptr) uint32 {
+ if __ccgo_strace {
+ trc("t=%v lpReturnedString=%v nSize=%v lpFileName=%v, (%v:)", t, lpReturnedString, nSize, lpFileName, origin(2))
+ }
r0, _, err := syscall.Syscall6(procGetPrivateProfileStringA.Addr(), 4,
lpAppName,
lpKeyName,
@@ -4075,6 +4723,9 @@ func XGetWindowsDirectoryA(t *TLS, _ ...interface{}) int32 {
//
// );
func XGetFileSecurityW(t *TLS, lpFileName uintptr, RequestedInformation uint32, pSecurityDescriptor uintptr, nLength uint32, lpnLengthNeeded uintptr) int32 {
+ if __ccgo_strace {
+ trc("t=%v lpFileName=%v RequestedInformation=%v pSecurityDescriptor=%v nLength=%v lpnLengthNeeded=%v, (%v:)", t, lpFileName, RequestedInformation, pSecurityDescriptor, nLength, lpnLengthNeeded, origin(2))
+ }
r0, _, err := syscall.Syscall6(procGetFileSecurityW.Addr(), 5, lpFileName, uintptr(RequestedInformation), pSecurityDescriptor, uintptr(nLength), lpnLengthNeeded, 0)
if err != 0 {
t.setErrno(err)
@@ -4090,6 +4741,9 @@ func XGetFileSecurityW(t *TLS, lpFileName uintptr, RequestedInformation uint32,
//
// );
func XGetSecurityDescriptorOwner(t *TLS, pSecurityDescriptor, pOwner, lpbOwnerDefaulted uintptr) int32 {
+ if __ccgo_strace {
+ trc("t=%v lpbOwnerDefaulted=%v, (%v:)", t, lpbOwnerDefaulted, origin(2))
+ }
r0, _, err := syscall.Syscall(procGetSecurityDescriptorOwner.Addr(), 3, pSecurityDescriptor, pOwner, lpbOwnerDefaulted)
if err != 0 {
t.setErrno(err)
@@ -4104,6 +4758,9 @@ func XGetSecurityDescriptorOwner(t *TLS, pSecurityDescriptor, pOwner, lpbOwnerDe
//
// );
func XGetSidIdentifierAuthority(t *TLS, pSid uintptr) uintptr {
+ if __ccgo_strace {
+ trc("t=%v pSid=%v, (%v:)", t, pSid, origin(2))
+ }
r0, _, err := syscall.Syscall(procGetSidIdentifierAuthority.Addr(), 1, pSid, 0, 0)
if err != 0 {
t.setErrno(err)
@@ -4117,6 +4774,9 @@ func XGetSidIdentifierAuthority(t *TLS, pSid uintptr) uintptr {
//
// );
func XImpersonateSelf(t *TLS, ImpersonationLevel int32) int32 {
+ if __ccgo_strace {
+ trc("t=%v ImpersonationLevel=%v, (%v:)", t, ImpersonationLevel, origin(2))
+ }
r0, _, err := syscall.Syscall(procImpersonateSelf.Addr(), 1, uintptr(ImpersonationLevel), 0, 0)
if err != 0 {
t.setErrno(err)
@@ -4133,6 +4793,9 @@ func XImpersonateSelf(t *TLS, ImpersonationLevel int32) int32 {
//
// );
func XOpenThreadToken(t *TLS, ThreadHandle uintptr, DesiredAccess uint32, OpenAsSelf int32, TokenHandle uintptr) int32 {
+ if __ccgo_strace {
+ trc("t=%v ThreadHandle=%v DesiredAccess=%v OpenAsSelf=%v TokenHandle=%v, (%v:)", t, ThreadHandle, DesiredAccess, OpenAsSelf, TokenHandle, origin(2))
+ }
r0, _, err := syscall.Syscall6(procOpenThreadToken.Addr(), 4, ThreadHandle, uintptr(DesiredAccess), uintptr(OpenAsSelf), TokenHandle, 0, 0)
if err != 0 {
t.setErrno(err)
@@ -4142,6 +4805,9 @@ func XOpenThreadToken(t *TLS, ThreadHandle uintptr, DesiredAccess uint32, OpenAs
// HANDLE GetCurrentThread();
func XGetCurrentThread(t *TLS) uintptr {
+ if __ccgo_strace {
+ trc("t=%v, (%v:)", t, origin(2))
+ }
r0, _, err := syscall.Syscall(procGetCurrentThread.Addr(), 0, 0, 0, 0)
if err != 0 {
t.setErrno(err)
@@ -4151,6 +4817,9 @@ func XGetCurrentThread(t *TLS) uintptr {
// BOOL RevertToSelf();
func XRevertToSelf(t *TLS) int32 {
+ if __ccgo_strace {
+ trc("t=%v, (%v:)", t, origin(2))
+ }
r0, _, err := syscall.Syscall(procRevertToSelf.Addr(), 0, 0, 0, 0)
if err != 0 {
t.setErrno(err)
@@ -4171,6 +4840,9 @@ func XRevertToSelf(t *TLS) int32 {
//
// );
func XAccessCheck(t *TLS, pSecurityDescriptor, ClientToken uintptr, DesiredAccess uint32, GenericMapping, PrivilegeSet, PrivilegeSetLength, GrantedAccess, AccessStatus uintptr) int32 {
+ if __ccgo_strace {
+ trc("t=%v ClientToken=%v DesiredAccess=%v AccessStatus=%v, (%v:)", t, ClientToken, DesiredAccess, AccessStatus, origin(2))
+ }
r0, _, err := syscall.Syscall9(procAccessCheck.Addr(), 8,
pSecurityDescriptor,
ClientToken,
@@ -4195,6 +4867,9 @@ func XAccessCheck(t *TLS, pSecurityDescriptor, ClientToken uintptr, DesiredAcces
//
// );
func Xwcsicmp(t *TLS, string1, string2 uintptr) int32 {
+ if __ccgo_strace {
+ trc("t=%v string2=%v, (%v:)", t, string2, origin(2))
+ }
var s1 = strings.ToLower(goWideString(string1))
var s2 = strings.ToLower(goWideString(string2))
return int32(strings.Compare(s1, s2))
@@ -4206,6 +4881,9 @@ func Xwcsicmp(t *TLS, string1, string2 uintptr) int32 {
//
// );
func XSetCurrentDirectoryW(t *TLS, lpPathName uintptr) int32 {
+ if __ccgo_strace {
+ trc("t=%v lpPathName=%v, (%v:)", t, lpPathName, origin(2))
+ }
err := syscall.SetCurrentDirectory((*uint16)(unsafe.Pointer(lpPathName)))
if err != nil {
t.setErrno(err)
@@ -4221,6 +4899,9 @@ func XSetCurrentDirectoryW(t *TLS, lpPathName uintptr) int32 {
//
// );
func XGetCurrentDirectoryW(t *TLS, nBufferLength uint32, lpBuffer uintptr) uint32 {
+ if __ccgo_strace {
+ trc("t=%v nBufferLength=%v lpBuffer=%v, (%v:)", t, nBufferLength, lpBuffer, origin(2))
+ }
n, err := syscall.GetCurrentDirectory(nBufferLength, (*uint16)(unsafe.Pointer(lpBuffer)))
if err != nil {
t.setErrno(err)
@@ -4235,6 +4916,9 @@ func XGetCurrentDirectoryW(t *TLS, nBufferLength uint32, lpBuffer uintptr) uint3
//
// );
func XGetFileInformationByHandle(t *TLS, hFile, lpFileInformation uintptr) int32 {
+ if __ccgo_strace {
+ trc("t=%v lpFileInformation=%v, (%v:)", t, lpFileInformation, origin(2))
+ }
r1, _, e1 := syscall.Syscall(procGetFileInformationByHandle.Addr(), 2, hFile, lpFileInformation, 0)
if r1 == 0 {
if e1 != 0 {
@@ -4259,6 +4943,9 @@ func XGetFileInformationByHandle(t *TLS, hFile, lpFileInformation uintptr) int32
//
// );
func XGetVolumeInformationW(t *TLS, lpRootPathName, lpVolumeNameBuffer uintptr, nVolumeNameSize uint32, lpVolumeSerialNumber, lpMaximumComponentLength, lpFileSystemFlags, lpFileSystemNameBuffer uintptr, nFileSystemNameSize uint32) int32 {
+ if __ccgo_strace {
+ trc("t=%v lpVolumeNameBuffer=%v nVolumeNameSize=%v lpFileSystemNameBuffer=%v nFileSystemNameSize=%v, (%v:)", t, lpVolumeNameBuffer, nVolumeNameSize, lpFileSystemNameBuffer, nFileSystemNameSize, origin(2))
+ }
r0, _, err := syscall.Syscall9(procGetVolumeInformationW.Addr(), 8,
lpRootPathName,
lpVolumeNameBuffer,
@@ -4283,6 +4970,9 @@ func XGetVolumeInformationW(t *TLS, lpRootPathName, lpVolumeNameBuffer uintptr,
//
// );
func Xwcschr(t *TLS, str uintptr, c wchar_t) uintptr {
+ if __ccgo_strace {
+ trc("t=%v str=%v c=%v, (%v:)", t, str, c, origin(2))
+ }
var source = str
for {
var buf = *(*uint16)(unsafe.Pointer(source))
@@ -4307,6 +4997,9 @@ func Xwcschr(t *TLS, str uintptr, c wchar_t) uintptr {
//
// );
func XSetFileTime(t *TLS, hFile uintptr, lpCreationTime, lpLastAccessTime, lpLastWriteTime uintptr) int32 {
+ if __ccgo_strace {
+ trc("t=%v hFile=%v lpLastWriteTime=%v, (%v:)", t, hFile, lpLastWriteTime, origin(2))
+ }
panic(todo(""))
}
@@ -4323,6 +5016,9 @@ func XSetFileTime(t *TLS, hFile uintptr, lpCreationTime, lpLastAccessTime, lpLas
//
// );
func XGetNamedSecurityInfoW(t *TLS, pObjectName uintptr, ObjectType, SecurityInfo uint32, ppsidOwner, ppsidGroup, ppDacl, ppSacl, ppSecurityDescriptor uintptr) uint32 {
+ if __ccgo_strace {
+ trc("t=%v pObjectName=%v SecurityInfo=%v ppSecurityDescriptor=%v, (%v:)", t, pObjectName, SecurityInfo, ppSecurityDescriptor, origin(2))
+ }
panic(todo(""))
}
@@ -4334,6 +5030,9 @@ func XGetNamedSecurityInfoW(t *TLS, pObjectName uintptr, ObjectType, SecurityInf
//
// );
func XOpenProcessToken(t *TLS, ProcessHandle uintptr, DesiredAccess uint32, TokenHandle uintptr) int32 {
+ if __ccgo_strace {
+ trc("t=%v ProcessHandle=%v DesiredAccess=%v TokenHandle=%v, (%v:)", t, ProcessHandle, DesiredAccess, TokenHandle, origin(2))
+ }
panic(todo(""))
}
@@ -4347,6 +5046,9 @@ func XOpenProcessToken(t *TLS, ProcessHandle uintptr, DesiredAccess uint32, Toke
//
// );
func XGetTokenInformation(t *TLS, TokenHandle uintptr, TokenInformationClass uint32, TokenInformation uintptr, TokenInformationLength uint32, ReturnLength uintptr) int32 {
+ if __ccgo_strace {
+ trc("t=%v TokenHandle=%v TokenInformationClass=%v TokenInformation=%v TokenInformationLength=%v ReturnLength=%v, (%v:)", t, TokenHandle, TokenInformationClass, TokenInformation, TokenInformationLength, ReturnLength, origin(2))
+ }
panic(todo(""))
}
@@ -4357,6 +5059,9 @@ func XGetTokenInformation(t *TLS, TokenHandle uintptr, TokenInformationClass uin
//
// );
func XEqualSid(t *TLS, pSid1, pSid2 uintptr) int32 {
+ if __ccgo_strace {
+ trc("t=%v pSid2=%v, (%v:)", t, pSid2, origin(2))
+ }
panic(todo(""))
}
@@ -4367,6 +5072,9 @@ func XEqualSid(t *TLS, pSid1, pSid2 uintptr) int32 {
//
// );
func XWSAStartup(t *TLS, wVersionRequired uint16, lpWSAData uintptr) int32 {
+ if __ccgo_strace {
+ trc("t=%v wVersionRequired=%v lpWSAData=%v, (%v:)", t, wVersionRequired, lpWSAData, origin(2))
+ }
r0, _, _ := syscall.Syscall(procWSAStartup.Addr(), 2, uintptr(wVersionRequired), lpWSAData, 0)
if r0 != 0 {
t.setErrno(r0)
@@ -4376,6 +5084,9 @@ func XWSAStartup(t *TLS, wVersionRequired uint16, lpWSAData uintptr) int32 {
// HMODULE GetModuleHandleA(LPCSTR lpModuleName);
func XGetModuleHandleA(t *TLS, lpModuleName uintptr) uintptr {
+ if __ccgo_strace {
+ trc("t=%v lpModuleName=%v, (%v:)", t, lpModuleName, origin(2))
+ }
r0, _, err := syscall.Syscall(procGetModuleHandleA.Addr(), 1, lpModuleName, 0, 0)
if r0 == 0 {
t.setErrno(err)
@@ -4389,6 +5100,9 @@ func XGetModuleHandleA(t *TLS, lpModuleName uintptr) uintptr {
//
// );
func XGetModuleHandleW(t *TLS, lpModuleName uintptr) uintptr {
+ if __ccgo_strace {
+ trc("t=%v lpModuleName=%v, (%v:)", t, lpModuleName, origin(2))
+ }
r0, _, err := syscall.Syscall(procGetModuleHandleW.Addr(), 1, lpModuleName, 0, 0)
if r0 == 0 {
t.setErrno(err)
@@ -4404,6 +5118,9 @@ func XGetModuleHandleW(t *TLS, lpModuleName uintptr) uintptr {
//
// );
func XGetEnvironmentVariableW(t *TLS, lpName, lpBuffer uintptr, nSize uint32) uint32 {
+ if __ccgo_strace {
+ trc("t=%v lpBuffer=%v nSize=%v, (%v:)", t, lpBuffer, nSize, origin(2))
+ }
r0, _, e1 := syscall.Syscall(procGetEnvironmentVariableW.Addr(), 3, lpName, lpBuffer, uintptr(nSize))
n := uint32(r0)
if n == 0 {
@@ -4423,6 +5140,9 @@ func XGetEnvironmentVariableW(t *TLS, lpName, lpBuffer uintptr, nSize uint32) ui
//
// );
func XlstrcmpiA(t *TLS, lpString1, lpString2 uintptr) int32 {
+ if __ccgo_strace {
+ trc("t=%v lpString2=%v, (%v:)", t, lpString2, origin(2))
+ }
var s1 = strings.ToLower(GoString(lpString1))
var s2 = strings.ToLower(GoString(lpString2))
return int32(strings.Compare(s1, s2))
@@ -4434,6 +5154,9 @@ func XGetModuleFileNameA(t *TLS, _ ...interface{}) int32 {
// UINT GetACP();
func XGetACP(t *TLS) uint32 {
+ if __ccgo_strace {
+ trc("t=%v, (%v:)", t, origin(2))
+ }
r0, _, _ := syscall.Syscall(procGetACP.Addr(), 0, 0, 0, 0)
return uint32(r0)
}
@@ -4445,6 +5168,9 @@ func XGetACP(t *TLS) uint32 {
//
// );
func XGetUserNameW(t *TLS, lpBuffer, pcbBuffer uintptr) int32 {
+ if __ccgo_strace {
+ trc("t=%v pcbBuffer=%v, (%v:)", t, pcbBuffer, origin(2))
+ }
u, err := user.Current()
if err != nil {
panic(todo(""))
@@ -4473,6 +5199,9 @@ func XGetUserNameW(t *TLS, lpBuffer, pcbBuffer uintptr) int32 {
//
// );
func XLoadLibraryExW(t *TLS, lpLibFileName, hFile uintptr, dwFlags uint32) uintptr {
+ if __ccgo_strace {
+ trc("t=%v hFile=%v dwFlags=%v, (%v:)", t, hFile, dwFlags, origin(2))
+ }
return 0 // If the function fails, the return value is NULL.
}
@@ -4483,6 +5212,9 @@ func XLoadLibraryExW(t *TLS, lpLibFileName, hFile uintptr, dwFlags uint32) uintp
//
// );
func Xwcscpy(t *TLS, strDestination, strSource uintptr) uintptr {
+ if __ccgo_strace {
+ trc("t=%v strSource=%v, (%v:)", t, strSource, origin(2))
+ }
if strSource == 0 {
return 0
}
@@ -4509,6 +5241,9 @@ func XwsprintfW(t *TLS, _ ...interface{}) int32 {
//
// );
func XRegisterClassW(t *TLS, lpWndClass uintptr) int32 {
+ if __ccgo_strace {
+ trc("t=%v lpWndClass=%v, (%v:)", t, lpWndClass, origin(2))
+ }
r0, _, err := syscall.Syscall(procRegisterClassW.Addr(), 1, lpWndClass, 0, 0)
if r0 == 0 {
t.setErrno(err)
@@ -4531,6 +5266,9 @@ func XDestroyWindow(t *TLS, _ ...interface{}) int32 {
//
// );
func XUnregisterClassW(t *TLS, lpClassName, hInstance uintptr) int32 {
+ if __ccgo_strace {
+ trc("t=%v hInstance=%v, (%v:)", t, hInstance, origin(2))
+ }
r0, _, err := syscall.Syscall(procUnregisterClassW.Addr(), 2, lpClassName, hInstance, 0)
if r0 == 0 {
t.setErrno(err)
@@ -4563,6 +5301,9 @@ func XSetTimer(t *TLS, _ ...interface{}) int32 {
//
// );
func XCreateWindowExW(t *TLS, dwExStyle uint32, lpClassName, lpWindowName uintptr, dwStyle uint32, x, y, nWidth, nHeight int32, hWndParent, hMenu, hInstance, lpParam uintptr) uintptr {
+ if __ccgo_strace {
+ trc("t=%v dwExStyle=%v lpWindowName=%v dwStyle=%v nHeight=%v lpParam=%v, (%v:)", t, dwExStyle, lpWindowName, dwStyle, nHeight, lpParam, origin(2))
+ }
r0, _, err := syscall.Syscall12(procCreateWindowExW.Addr(), 12,
uintptr(dwExStyle),
lpClassName,
@@ -4593,6 +5334,9 @@ func XCreateWindowExW(t *TLS, dwExStyle uint32, lpClassName, lpWindowName uintpt
//
// );
func XPeekMessageW(t *TLS, lpMsg, hWnd uintptr, wMsgFilterMin, wMsgFilterMax, wRemoveMsg uint32) int32 {
+ if __ccgo_strace {
+ trc("t=%v hWnd=%v wRemoveMsg=%v, (%v:)", t, hWnd, wRemoveMsg, origin(2))
+ }
r0, _, err := syscall.Syscall6(procPeekMessageW.Addr(), 5,
lpMsg,
hWnd,
@@ -4630,6 +5374,9 @@ func XDispatchMessageW(t *TLS, _ ...interface{}) int32 {
//
// );
func XSleepEx(t *TLS, dwMilliseconds uint32, bAlertable int32) uint32 {
+ if __ccgo_strace {
+ trc("t=%v dwMilliseconds=%v bAlertable=%v, (%v:)", t, dwMilliseconds, bAlertable, origin(2))
+ }
r0, _, _ := syscall.Syscall(procSleepEx.Addr(), 2, uintptr(dwMilliseconds), uintptr(bAlertable), 0)
return uint32(r0)
}
@@ -4643,6 +5390,9 @@ func XSleepEx(t *TLS, dwMilliseconds uint32, bAlertable int32) uint32 {
//
// );
func XCreatePipe(t *TLS, hReadPipe, hWritePipe, lpPipeAttributes uintptr, nSize uint32) int32 {
+ if __ccgo_strace {
+ trc("t=%v lpPipeAttributes=%v nSize=%v, (%v:)", t, lpPipeAttributes, nSize, origin(2))
+ }
r0, _, err := syscall.Syscall6(procCreatePipe.Addr(), 4, hReadPipe, hWritePipe, lpPipeAttributes, uintptr(nSize), 0, 0)
if r0 == 0 {
t.setErrno(err)
@@ -4687,6 +5437,9 @@ func XCreateProcessW(t *TLS, lpApplicationName, lpCommandLine, lpProcessAttribut
//
// );
func XWaitForInputIdle(t *TLS, hProcess uintptr, dwMilliseconds uint32) int32 {
+ if __ccgo_strace {
+ trc("t=%v hProcess=%v dwMilliseconds=%v, (%v:)", t, hProcess, dwMilliseconds, origin(2))
+ }
r0, _, _ := syscall.Syscall(procWaitForInputIdle.Addr(), 2, hProcess, uintptr(dwMilliseconds), 0)
return int32(r0)
}
@@ -4702,6 +5455,9 @@ func XWaitForInputIdle(t *TLS, hProcess uintptr, dwMilliseconds uint32) int32 {
//
// );
func XSearchPathW(t *TLS, lpPath, lpFileName, lpExtension uintptr, nBufferLength uint32, lpBuffer, lpFilePart uintptr) int32 {
+ if __ccgo_strace {
+ trc("t=%v lpExtension=%v nBufferLength=%v lpFilePart=%v, (%v:)", t, lpExtension, nBufferLength, lpFilePart, origin(2))
+ }
r0, _, err := syscall.Syscall6(procSearchPathW.Addr(), 6, lpPath, lpFileName, lpExtension, uintptr(nBufferLength), lpBuffer, lpFilePart)
if r0 == 0 {
t.setErrno(err)
@@ -4720,6 +5476,9 @@ func XGetShortPathNameW(t *TLS, _ ...interface{}) int32 {
//
// );
func XGetExitCodeProcess(t *TLS, hProcess, lpExitCode uintptr) int32 {
+ if __ccgo_strace {
+ trc("t=%v lpExitCode=%v, (%v:)", t, lpExitCode, origin(2))
+ }
r0, _, err := syscall.Syscall(procGetExitCodeProcess.Addr(), 2, hProcess, lpExitCode, 0)
if r0 == 0 {
t.setErrno(err)
@@ -4738,6 +5497,9 @@ func XGetExitCodeProcess(t *TLS, hProcess, lpExitCode uintptr) int32 {
//
// );
func XPeekNamedPipe(t *TLS, hNamedPipe, lpBuffer uintptr, nBufferSize uint32, lpBytesRead, lpTotalBytesAvail, lpBytesLeftThisMessage uintptr) int32 {
+ if __ccgo_strace {
+ trc("t=%v lpBuffer=%v nBufferSize=%v lpBytesLeftThisMessage=%v, (%v:)", t, lpBuffer, nBufferSize, lpBytesLeftThisMessage, origin(2))
+ }
r0, _, err := syscall.Syscall6(procPeekNamedPipe.Addr(), 6, hNamedPipe, lpBuffer, uintptr(nBufferSize), lpBytesRead, lpTotalBytesAvail, lpBytesLeftThisMessage)
if r0 == 0 {
t.setErrno(err)
@@ -4752,6 +5514,9 @@ func XPeekNamedPipe(t *TLS, hNamedPipe, lpBuffer uintptr, nBufferSize uint32, lp
//
// );
func X_InterlockedExchange(t *TLS, Target uintptr, Value long) long {
+ if __ccgo_strace {
+ trc("t=%v Target=%v Value=%v, (%v:)", t, Target, Value, origin(2))
+ }
old := atomic.SwapInt32((*int32)(unsafe.Pointer(Target)), Value)
return old
}
@@ -4763,6 +5528,9 @@ func X_InterlockedExchange(t *TLS, Target uintptr, Value long) long {
//
// );
func XTerminateThread(t *TLS, hThread uintptr, dwExitCode uint32) int32 {
+ if __ccgo_strace {
+ trc("t=%v hThread=%v dwExitCode=%v, (%v:)", t, hThread, dwExitCode, origin(2))
+ }
r0, _, err := syscall.Syscall(procTerminateThread.Addr(), 2, hThread, uintptr(dwExitCode), 0)
if err != 0 {
t.setErrno(err)
@@ -4777,6 +5545,9 @@ func XTerminateThread(t *TLS, hThread uintptr, dwExitCode uint32) int32 {
//
// );
func XGetComputerNameW(t *TLS, lpBuffer, nSize uintptr) int32 {
+ if __ccgo_strace {
+ trc("t=%v nSize=%v, (%v:)", t, nSize, origin(2))
+ }
panic(todo(""))
}
@@ -4850,6 +5621,9 @@ func X_controlfp(t *TLS, _ ...interface{}) uint32 {
//
// );
func XQueryPerformanceFrequency(t *TLS, lpFrequency uintptr) int32 {
+ if __ccgo_strace {
+ trc("t=%v lpFrequency=%v, (%v:)", t, lpFrequency, origin(2))
+ }
r1, _, err := syscall.Syscall(procQueryPerformanceFrequency.Addr(), 1, lpFrequency, 0, 0)
if r1 == 0 {
@@ -4871,6 +5645,9 @@ func inDST(t gotime.Time) bool {
// void _ftime( struct _timeb *timeptr );
func X_ftime(t *TLS, timeptr uintptr) {
+ if __ccgo_strace {
+ trc("t=%v timeptr=%v, (%v:)", t, timeptr, origin(2))
+ }
var tm = gotime.Now()
var tPtr = (*time.X__timeb64)(unsafe.Pointer(timeptr))
tPtr.Ftime = tm.Unix()
@@ -4913,6 +5690,9 @@ func XDdeQueryStringW(t *TLS, _ ...interface{}) int32 {
//
// );
func X_wcsicmp(t *TLS, string1, string2 uintptr) int32 {
+ if __ccgo_strace {
+ trc("t=%v string2=%v, (%v:)", t, string2, origin(2))
+ }
return Xwcsicmp(t, string1, string2)
}
@@ -4981,6 +5761,9 @@ func XDdeGetLastError(t *TLS, _ ...interface{}) uint32 {
//
// );
func XDdeClientTransaction(t *TLS, pData uintptr, cbData uint32, hConv uintptr, hszItem uintptr, wFmt, wType, dwTimeout uint32, pdwResult uintptr) uintptr {
+ if __ccgo_strace {
+ trc("t=%v pData=%v cbData=%v hConv=%v hszItem=%v dwTimeout=%v pdwResult=%v, (%v:)", t, pData, cbData, hConv, hszItem, dwTimeout, pdwResult, origin(2))
+ }
panic(todo(""))
}
@@ -5049,39 +5832,66 @@ func XRegSetValueExW(t *TLS, _ ...interface{}) int32 {
//
// );
func X__mingw_vsnwprintf(t *TLS, buffer uintptr, count types.Size_t, format, va uintptr) int32 {
+ if __ccgo_strace {
+ trc("t=%v buffer=%v count=%v va=%v, (%v:)", t, buffer, count, va, origin(2))
+ }
panic(todo(""))
}
// int vprintf(const char *format, va_list ap);
-func X__mingw_vprintf(t *TLS, s, ap uintptr) int32 { return Xvprintf(t, s, ap) }
+
+func X__mingw_vprintf(t *TLS, s, ap uintptr) int32 {
+ if __ccgo_strace {
+ trc("t=%v ap=%v, (%v:)", t, ap, origin(2))
+ }
+ return Xvprintf(t, s, ap)
+}
// int vfscanf(FILE * restrict stream, const char * restrict format, va_list arg);
func X__mingw_vfscanf(t *TLS, stream, format, ap uintptr) int32 {
+ if __ccgo_strace {
+ trc("t=%v ap=%v, (%v:)", t, ap, origin(2))
+ }
panic(todo(""))
}
// int vsscanf(const char *str, const char *format, va_list ap);
func X__mingw_vsscanf(t *TLS, str, format, ap uintptr) int32 {
+ if __ccgo_strace {
+ trc("t=%v ap=%v, (%v:)", t, ap, origin(2))
+ }
return Xsscanf(t, str, format, ap)
}
// int vfprintf(FILE * restrict stream, const char * restrict format, va_list arg);
func X__mingw_vfprintf(t *TLS, f uintptr, format, va uintptr) int32 {
+ if __ccgo_strace {
+ trc("t=%v f=%v va=%v, (%v:)", t, f, va, origin(2))
+ }
return Xvfprintf(t, f, format, va)
}
// int vsprintf(char * restrict s, const char * restrict format, va_list arg);
func X__mingw_vsprintf(t *TLS, s, format, ap uintptr) int32 {
+ if __ccgo_strace {
+ trc("t=%v ap=%v, (%v:)", t, ap, origin(2))
+ }
return Xvsprintf(t, s, format, ap)
}
// int vsnprintf(char *str, size_t size, const char *format, va_list ap);
func X__mingw_vsnprintf(t *TLS, str uintptr, size types.Size_t, format, ap uintptr) int32 {
+ if __ccgo_strace {
+ trc("t=%v str=%v size=%v ap=%v, (%v:)", t, str, size, ap, origin(2))
+ }
panic(todo(""))
}
// int putchar(int char)
func X_putchar(t *TLS, c int32) int32 {
+ if __ccgo_strace {
+ trc("t=%v c=%v, (%v:)", t, c, origin(2))
+ }
if _, err := fwrite(unistd.STDOUT_FILENO, []byte{byte(c)}); err != nil {
return -1
}
@@ -5090,21 +5900,33 @@ func X_putchar(t *TLS, c int32) int32 {
// int vfwscanf(FILE *stream, const wchar_t *format, va_list argptr;);
func X__mingw_vfwscanf(t *TLS, stream uintptr, format, ap uintptr) int32 {
+ if __ccgo_strace {
+ trc("t=%v stream=%v ap=%v, (%v:)", t, stream, ap, origin(2))
+ }
panic(todo(""))
}
// int vswscanf(const wchar_t *buffer, const wchar_t *format, va_list arglist);
func X__mingw_vswscanf(t *TLS, stream uintptr, format, ap uintptr) int32 {
+ if __ccgo_strace {
+ trc("t=%v stream=%v ap=%v, (%v:)", t, stream, ap, origin(2))
+ }
panic(todo(""))
}
// int vfwprintf(FILE * restrict stream, const wchar_t * restrict format, va_list arg);
func X__mingw_vfwprintf(t *TLS, stream, format, ap uintptr) int32 {
+ if __ccgo_strace {
+ trc("t=%v ap=%v, (%v:)", t, ap, origin(2))
+ }
panic(todo(""))
}
// int putchar(int c);
func Xputchar(t *TLS, c int32) int32 {
+ if __ccgo_strace {
+ trc("t=%v c=%v, (%v:)", t, c, origin(2))
+ }
panic(todo(""))
}
@@ -5116,11 +5938,17 @@ func Xputchar(t *TLS, c int32) int32 {
//
// );
func X_assert(t *TLS, message, filename uintptr, line uint32) {
+ if __ccgo_strace {
+ trc("t=%v filename=%v line=%v, (%v:)", t, filename, line, origin(2))
+ }
panic(todo(""))
}
// char *strdup(const char *s);
func X_strdup(t *TLS, s uintptr) uintptr {
+ if __ccgo_strace {
+ trc("t=%v s=%v, (%v:)", t, s, origin(2))
+ }
panic(todo(""))
}
@@ -5131,6 +5959,9 @@ func X_strdup(t *TLS, s uintptr) uintptr {
//
// );
func X_access(t *TLS, pathname uintptr, mode int32) int32 {
+ if __ccgo_strace {
+ trc("t=%v pathname=%v mode=%v, (%v:)", t, pathname, mode, origin(2))
+ }
var path = GoString(pathname)
@@ -5177,6 +6008,9 @@ func X_access(t *TLS, pathname uintptr, mode int32) int32 {
//
// );
func XSetConsoleCtrlHandler(t *TLS, HandlerRoutine uintptr, Add int32) int32 {
+ if __ccgo_strace {
+ trc("t=%v HandlerRoutine=%v Add=%v, (%v:)", t, HandlerRoutine, Add, origin(2))
+ }
//var fcc = &struct {
// f func(*TLS, uint32) int32
@@ -5198,11 +6032,17 @@ func XSetConsoleCtrlHandler(t *TLS, HandlerRoutine uintptr, Add int32) int32 {
// DebugBreak
func XDebugBreak(t *TLS) {
+ if __ccgo_strace {
+ trc("t=%v, (%v:)", t, origin(2))
+ }
panic(todo(""))
}
// int _isatty( int fd );
func X_isatty(t *TLS, fd int32) int32 {
+ if __ccgo_strace {
+ trc("t=%v fd=%v, (%v:)", t, fd, origin(2))
+ }
f, ok := fdToFile(fd)
if !ok {
@@ -5233,6 +6073,9 @@ func X_isatty(t *TLS, fd int32) int32 {
//
// );
func XSetConsoleTextAttribute(t *TLS, hConsoleOutput uintptr, wAttributes uint16) int32 {
+ if __ccgo_strace {
+ trc("t=%v hConsoleOutput=%v wAttributes=%v, (%v:)", t, hConsoleOutput, wAttributes, origin(2))
+ }
r1, _, _ := syscall.Syscall(procSetConsoleTextAttribute.Addr(), 2, hConsoleOutput, uintptr(wAttributes), 0)
return int32(r1)
}
@@ -5244,6 +6087,9 @@ func XSetConsoleTextAttribute(t *TLS, hConsoleOutput uintptr, wAttributes uint16
//
// );
func XGetConsoleScreenBufferInfo(t *TLS, hConsoleOutput, lpConsoleScreenBufferInfo uintptr) int32 {
+ if __ccgo_strace {
+ trc("t=%v lpConsoleScreenBufferInfo=%v, (%v:)", t, lpConsoleScreenBufferInfo, origin(2))
+ }
r1, _, _ := syscall.Syscall(procGetConsoleScreenBufferInfo.Addr(), 2, hConsoleOutput, lpConsoleScreenBufferInfo, 0)
return int32(r1)
}
@@ -5255,6 +6101,9 @@ func XGetConsoleScreenBufferInfo(t *TLS, hConsoleOutput, lpConsoleScreenBufferIn
//
// );
func X_popen(t *TLS, command, mode uintptr) uintptr {
+ if __ccgo_strace {
+ trc("t=%v mode=%v, (%v:)", t, mode, origin(2))
+ }
panic(todo(""))
}
@@ -5264,18 +6113,30 @@ func X_popen(t *TLS, command, mode uintptr) uintptr {
//
// );
func X_wunlink(t *TLS, filename uintptr) int32 {
+ if __ccgo_strace {
+ trc("t=%v filename=%v, (%v:)", t, filename, origin(2))
+ }
panic(todo(""))
}
func Xclosedir(tls *TLS, dir uintptr) int32 {
+ if __ccgo_strace {
+ trc("tls=%v dir=%v, (%v:)", tls, dir, origin(2))
+ }
panic(todo(""))
}
func Xopendir(tls *TLS, name uintptr) uintptr {
+ if __ccgo_strace {
+ trc("tls=%v name=%v, (%v:)", tls, name, origin(2))
+ }
panic(todo(""))
}
func Xreaddir(tls *TLS, dir uintptr) uintptr {
+ if __ccgo_strace {
+ trc("tls=%v dir=%v, (%v:)", tls, dir, origin(2))
+ }
panic(todo(""))
}
@@ -5285,21 +6146,33 @@ func Xreaddir(tls *TLS, dir uintptr) uintptr {
//
// );
func X_unlink(t *TLS, filename uintptr) int32 {
+ if __ccgo_strace {
+ trc("t=%v filename=%v, (%v:)", t, filename, origin(2))
+ }
panic(todo(""))
}
// int pclose(FILE *stream);
func X_pclose(t *TLS, stream uintptr) int32 {
+ if __ccgo_strace {
+ trc("t=%v stream=%v, (%v:)", t, stream, origin(2))
+ }
panic(todo(""))
}
// int setmode (int fd, int mode);
func Xsetmode(t *TLS, fd, mode int32) int32 {
+ if __ccgo_strace {
+ trc("t=%v mode=%v, (%v:)", t, mode, origin(2))
+ }
return X_setmode(t, fd, mode)
}
// int _setmode (int fd, int mode);
func X_setmode(t *TLS, fd, mode int32) int32 {
+ if __ccgo_strace {
+ trc("t=%v mode=%v, (%v:)", t, mode, origin(2))
+ }
_, ok := fdToFile(fd)
if !ok {
@@ -5320,16 +6193,25 @@ func X_setmode(t *TLS, fd, mode int32) int32 {
// int _mkdir(const char *dirname);
func X_mkdir(t *TLS, dirname uintptr) int32 {
+ if __ccgo_strace {
+ trc("t=%v dirname=%v, (%v:)", t, dirname, origin(2))
+ }
panic(todo(""))
}
// int _chmod( const char *filename, int pmode );
func X_chmod(t *TLS, filename uintptr, pmode int32) int32 {
+ if __ccgo_strace {
+ trc("t=%v filename=%v pmode=%v, (%v:)", t, filename, pmode, origin(2))
+ }
panic(todo(""))
}
// int _fileno(FILE *stream);
func X_fileno(t *TLS, stream uintptr) int32 {
+ if __ccgo_strace {
+ trc("t=%v stream=%v, (%v:)", t, stream, origin(2))
+ }
f, ok := winGetObject(stream).(*file)
if !ok {
t.setErrno(errno.EBADF)
@@ -5340,11 +6222,17 @@ func X_fileno(t *TLS, stream uintptr) int32 {
// void rewind(FILE *stream);
func Xrewind(t *TLS, stream uintptr) {
+ if __ccgo_strace {
+ trc("t=%v stream=%v, (%v:)", t, stream, origin(2))
+ }
Xfseek(t, stream, 0, unistd.SEEK_SET)
}
// __atomic_load_n
func X__atomic_load_n(t *TLS) {
+ if __ccgo_strace {
+ trc("t=%v, (%v:)", t, origin(2))
+ }
panic(todo(""))
}
@@ -5355,16 +6243,25 @@ func X__atomic_store_n(t *TLS, _ ...interface{}) int32 {
// __builtin_add_overflow
func X__builtin_add_overflow(t *TLS) {
+ if __ccgo_strace {
+ trc("t=%v, (%v:)", t, origin(2))
+ }
panic(todo(""))
}
// __builtin_mul_overflow
func X__builtin_mul_overflow(t *TLS) {
+ if __ccgo_strace {
+ trc("t=%v, (%v:)", t, origin(2))
+ }
panic(todo(""))
}
// __builtin_sub_overflow
func X__builtin_sub_overflow(t *TLS) {
+ if __ccgo_strace {
+ trc("t=%v, (%v:)", t, origin(2))
+ }
panic(todo(""))
}
@@ -5426,6 +6323,9 @@ func goWideStringNZ(p uintptr) string {
// LPWSTR GetCommandLineW();
func XGetCommandLineW(t *TLS) uintptr {
+ if __ccgo_strace {
+ trc("t=%v, (%v:)", t, origin(2))
+ }
return uintptr(unsafe.Pointer(syscall.GetCommandLine()))
}
@@ -5438,6 +6338,9 @@ func XGetCommandLineW(t *TLS) uintptr {
//
// );
func XAddAccessDeniedAce(t *TLS, pAcl uintptr, dwAceRevision, AccessMask uint32, pSid uintptr) int32 {
+ if __ccgo_strace {
+ trc("t=%v pAcl=%v AccessMask=%v pSid=%v, (%v:)", t, pAcl, AccessMask, pSid, origin(2))
+ }
panic(todo(""))
}
@@ -5451,6 +6354,9 @@ func XAddAccessDeniedAce(t *TLS, pAcl uintptr, dwAceRevision, AccessMask uint32,
//
// );
func XAddAce(t *TLS, pAcl uintptr, dwAceRevision, dwStartingAceIndex uint32, pAceList uintptr, nAceListLength uint32) int32 {
+ if __ccgo_strace {
+ trc("t=%v pAcl=%v dwStartingAceIndex=%v pAceList=%v nAceListLength=%v, (%v:)", t, pAcl, dwStartingAceIndex, pAceList, nAceListLength, origin(2))
+ }
panic(todo(""))
}
@@ -5462,6 +6368,9 @@ func XAddAce(t *TLS, pAcl uintptr, dwAceRevision, dwStartingAceIndex uint32, pAc
//
// );
func XGetAce(t *TLS, pAcl uintptr, dwAceIndex uint32, pAce uintptr) int32 {
+ if __ccgo_strace {
+ trc("t=%v pAcl=%v dwAceIndex=%v pAce=%v, (%v:)", t, pAcl, dwAceIndex, pAce, origin(2))
+ }
panic(todo(""))
}
@@ -5474,6 +6383,9 @@ func XGetAce(t *TLS, pAcl uintptr, dwAceIndex uint32, pAce uintptr) int32 {
//
// );
func XGetAclInformation(t *TLS, pAcl, pAclInformation uintptr, nAclInformationLength, dwAclInformationClass uint32) int32 {
+ if __ccgo_strace {
+ trc("t=%v pAclInformation=%v dwAclInformationClass=%v, (%v:)", t, pAclInformation, dwAclInformationClass, origin(2))
+ }
r0, _, err := syscall.Syscall6(procGetAclInformation.Addr(), 4,
pAclInformation,
pAclInformation,
@@ -5498,6 +6410,9 @@ func XGetAclInformation(t *TLS, pAcl, pAclInformation uintptr, nAclInformationLe
//
// );
func XGetFileSecurityA(t *TLS, lpFileName uintptr, RequestedInformation uint32, pSecurityDescriptor uintptr, nLength uint32, lpnLengthNeeded uintptr) int32 {
+ if __ccgo_strace {
+ trc("t=%v lpFileName=%v RequestedInformation=%v pSecurityDescriptor=%v nLength=%v lpnLengthNeeded=%v, (%v:)", t, lpFileName, RequestedInformation, pSecurityDescriptor, nLength, lpnLengthNeeded, origin(2))
+ }
r0, _, err := syscall.Syscall6(procGetFileSecurityA.Addr(), 5,
lpFileName,
uintptr(RequestedInformation),
@@ -5518,6 +6433,9 @@ func XGetFileSecurityA(t *TLS, lpFileName uintptr, RequestedInformation uint32,
//
// );
func XGetLengthSid(t *TLS, pSid uintptr) uint32 {
+ if __ccgo_strace {
+ trc("t=%v pSid=%v, (%v:)", t, pSid, origin(2))
+ }
panic(todo(""))
}
@@ -5530,6 +6448,9 @@ func XGetLengthSid(t *TLS, pSid uintptr) uint32 {
//
// );
func XGetSecurityDescriptorDacl(t *TLS, pSecurityDescriptor, lpbDaclPresent, pDacl, lpbDaclDefaulted uintptr) int32 {
+ if __ccgo_strace {
+ trc("t=%v lpbDaclDefaulted=%v, (%v:)", t, lpbDaclDefaulted, origin(2))
+ }
r0, _, err := syscall.Syscall6(procGetSecurityDescriptorDacl.Addr(), 4,
pSecurityDescriptor,
lpbDaclPresent,
@@ -5550,6 +6471,9 @@ func XGetSecurityDescriptorDacl(t *TLS, pSecurityDescriptor, lpbDaclPresent, pDa
//
// );
func XGetSidLengthRequired(t *TLS, nSubAuthorityCount uint8) int32 {
+ if __ccgo_strace {
+ trc("t=%v nSubAuthorityCount=%v, (%v:)", t, nSubAuthorityCount, origin(2))
+ }
r0, _, err := syscall.Syscall(procGetSidLengthRequired.Addr(), 1, uintptr(nSubAuthorityCount), 0, 0)
if err != 0 {
t.setErrno(err)
@@ -5564,6 +6488,9 @@ func XGetSidLengthRequired(t *TLS, nSubAuthorityCount uint8) int32 {
//
// );
func XGetSidSubAuthority(t *TLS, pSid uintptr, nSubAuthority uint32) uintptr {
+ if __ccgo_strace {
+ trc("t=%v pSid=%v nSubAuthority=%v, (%v:)", t, pSid, nSubAuthority, origin(2))
+ }
r0, _, err := syscall.Syscall(procGetSidSubAuthority.Addr(), 2, pSid, uintptr(nSubAuthority), 0)
if err != 0 {
t.setErrno(err)
@@ -5579,6 +6506,9 @@ func XGetSidSubAuthority(t *TLS, pSid uintptr, nSubAuthority uint32) uintptr {
//
// );
func XInitializeAcl(t *TLS, pAcl uintptr, nAclLength, dwAclRevision uint32) int32 {
+ if __ccgo_strace {
+ trc("t=%v pAcl=%v dwAclRevision=%v, (%v:)", t, pAcl, dwAclRevision, origin(2))
+ }
panic(todo(""))
}
@@ -5590,6 +6520,9 @@ func XInitializeAcl(t *TLS, pAcl uintptr, nAclLength, dwAclRevision uint32) int3
//
// );
func XInitializeSid(t *TLS, Sid, pIdentifierAuthority uintptr, nSubAuthorityCount uint8) int32 {
+ if __ccgo_strace {
+ trc("t=%v pIdentifierAuthority=%v nSubAuthorityCount=%v, (%v:)", t, pIdentifierAuthority, nSubAuthorityCount, origin(2))
+ }
r0, _, err := syscall.Syscall(procInitializeSid.Addr(), 3, Sid, pIdentifierAuthority, uintptr(nSubAuthorityCount))
if err != 0 {
t.setErrno(err)
@@ -5606,6 +6539,9 @@ func XInitializeSid(t *TLS, Sid, pIdentifierAuthority uintptr, nSubAuthorityCoun
//
// );
func XRaiseException(t *TLS, dwExceptionCode, dwExceptionFlags, nNumberOfArguments uint32, lpArguments uintptr) {
+ if __ccgo_strace {
+ trc("t=%v nNumberOfArguments=%v lpArguments=%v, (%v:)", t, nNumberOfArguments, lpArguments, origin(2))
+ }
panic(todo(""))
}
@@ -5615,6 +6551,9 @@ func XRaiseException(t *TLS, dwExceptionCode, dwExceptionFlags, nNumberOfArgumen
//
// );
func XSetErrorMode(t *TLS, uMode uint32) int32 {
+ if __ccgo_strace {
+ trc("t=%v uMode=%v, (%v:)", t, uMode, origin(2))
+ }
panic(todo(""))
}
@@ -5630,6 +6569,9 @@ func XSetErrorMode(t *TLS, uMode uint32) int32 {
//
// );
func XSetNamedSecurityInfoA(t *TLS, pObjectName uintptr, ObjectType, SecurityInfo uint32, psidOwner, psidGroup, pDacl, pSacl uintptr) uint32 {
+ if __ccgo_strace {
+ trc("t=%v pObjectName=%v SecurityInfo=%v pSacl=%v, (%v:)", t, pObjectName, SecurityInfo, pSacl, origin(2))
+ }
panic(todo(""))
}
@@ -5679,6 +6621,9 @@ func X_set_abort_behavior(t *TLS, _ ...interface{}) uint32 {
//
// );
func XOpenEventA(t *TLS, dwDesiredAccess uint32, bInheritHandle uint32, lpName uintptr) uintptr {
+ if __ccgo_strace {
+ trc("t=%v dwDesiredAccess=%v bInheritHandle=%v lpName=%v, (%v:)", t, dwDesiredAccess, bInheritHandle, lpName, origin(2))
+ }
r0, _, err := syscall.Syscall(procOpenEventA.Addr(), 3, uintptr(dwDesiredAccess), uintptr(bInheritHandle), lpName)
if r0 == 0 {
t.setErrno(err)
@@ -5692,16 +6637,25 @@ func XOpenEventA(t *TLS, dwDesiredAccess uint32, bInheritHandle uint32, lpName u
//
// );
func X_msize(t *TLS, memblock uintptr) types.Size_t {
+ if __ccgo_strace {
+ trc("t=%v memblock=%v, (%v:)", t, memblock, origin(2))
+ }
return types.Size_t(UsableSize(memblock))
}
// unsigned long _byteswap_ulong ( unsigned long val );
func X_byteswap_ulong(t *TLS, val ulong) ulong {
+ if __ccgo_strace {
+ trc("t=%v val=%v, (%v:)", t, val, origin(2))
+ }
return X__builtin_bswap32(t, val)
}
// unsigned __int64 _byteswap_uint64 ( unsigned __int64 val );
func X_byteswap_uint64(t *TLS, val uint64) uint64 {
+ if __ccgo_strace {
+ trc("t=%v val=%v, (%v:)", t, val, origin(2))
+ }
return X__builtin_bswap64(t, val)
}
@@ -5711,6 +6665,9 @@ func X_byteswap_uint64(t *TLS, val uint64) uint64 {
//
// );
func X_commit(t *TLS, fd int32) int32 {
+ if __ccgo_strace {
+ trc("t=%v fd=%v, (%v:)", t, fd, origin(2))
+ }
return Xfsync(t, fd)
}
@@ -5721,6 +6678,9 @@ func X_commit(t *TLS, fd int32) int32 {
//
// );
func X_stati64(t *TLS, path, buffer uintptr) int32 {
+ if __ccgo_strace {
+ trc("t=%v buffer=%v, (%v:)", t, buffer, origin(2))
+ }
panic(todo(""))
}
@@ -5731,6 +6691,9 @@ func X_stati64(t *TLS, path, buffer uintptr) int32 {
//
// );
func X_fstati64(t *TLS, fd int32, buffer uintptr) int32 {
+ if __ccgo_strace {
+ trc("t=%v fd=%v buffer=%v, (%v:)", t, fd, buffer, origin(2))
+ }
panic(todo(""))
}
@@ -5741,6 +6704,9 @@ func X_fstati64(t *TLS, fd int32, buffer uintptr) int32 {
//
// );
func X_findnext32(t *TLS, handle types.Intptr_t, buffer uintptr) int32 {
+ if __ccgo_strace {
+ trc("t=%v handle=%v buffer=%v, (%v:)", t, handle, buffer, origin(2))
+ }
panic(todo(""))
}
@@ -5751,6 +6717,9 @@ func X_findnext32(t *TLS, handle types.Intptr_t, buffer uintptr) int32 {
//
// );
func X_findfirst32(t *TLS, filespec, fileinfo uintptr) types.Intptr_t {
+ if __ccgo_strace {
+ trc("t=%v fileinfo=%v, (%v:)", t, fileinfo, origin(2))
+ }
panic(todo(""))
}
@@ -5785,6 +6754,9 @@ func X_findfirst32(t *TLS, filespec, fileinfo uintptr) types.Intptr_t {
// long strtol(const char *nptr, char **endptr, int base);
func Xstrtol(t *TLS, nptr, endptr uintptr, base int32) long {
+ if __ccgo_strace {
+ trc("t=%v endptr=%v base=%v, (%v:)", t, endptr, base, origin(2))
+ }
var s uintptr = nptr
var acc ulong
@@ -5919,6 +6891,9 @@ func Xstrtol(t *TLS, nptr, endptr uintptr, base int32) long {
// unsigned long int strtoul(const char *nptr, char **endptr, int base);
func Xstrtoul(t *TLS, nptr, endptr uintptr, base int32) ulong {
+ if __ccgo_strace {
+ trc("t=%v endptr=%v base=%v, (%v:)", t, endptr, base, origin(2))
+ }
var s uintptr = nptr
var acc ulong
var c byte
@@ -6024,6 +6999,9 @@ func Xstrtoul(t *TLS, nptr, endptr uintptr, base int32) ulong {
// int __isoc99_sscanf(const char *str, const char *format, ...);
func X__isoc99_sscanf(t *TLS, str, format, va uintptr) int32 {
+ if __ccgo_strace {
+ trc("t=%v va=%v, (%v:)", t, va, origin(2))
+ }
r := scanf(strings.NewReader(GoString(str)), format, va)
// if dmesgs {
// dmesg("%v: %q %q: %d", origin(1), GoString(str), GoString(format), r)
@@ -6033,6 +7011,9 @@ func X__isoc99_sscanf(t *TLS, str, format, va uintptr) int32 {
// int sscanf(const char *str, const char *format, ...);
func Xsscanf(t *TLS, str, format, va uintptr) int32 {
+ if __ccgo_strace {
+ trc("t=%v va=%v, (%v:)", t, va, origin(2))
+ }
r := scanf(strings.NewReader(GoString(str)), format, va)
// if dmesgs {
// dmesg("%v: %q %q: %d", origin(1), GoString(str), GoString(format), r)
@@ -6041,10 +7022,16 @@ func Xsscanf(t *TLS, str, format, va uintptr) int32 {
}
func Xstrtod(tls *TLS, s uintptr, p uintptr) float64 { /* strtod.c:22:8: */
+ if __ccgo_strace {
+ trc("tls=%v s=%v p=%v, (%v:)", tls, s, p, origin(2))
+ }
panic(todo(""))
}
func Xrint(tls *TLS, x float64) float64 {
+ if __ccgo_strace {
+ trc("tls=%v x=%v, (%v:)", tls, x, origin(2))
+ }
switch {
case x == 0: // also +0 and -0
return 0
@@ -6061,21 +7048,33 @@ func Xrint(tls *TLS, x float64) float64 {
// FILE *fdopen(int fd, const char *mode);
func Xfdopen(t *TLS, fd int32, mode uintptr) uintptr {
+ if __ccgo_strace {
+ trc("t=%v fd=%v mode=%v, (%v:)", t, fd, mode, origin(2))
+ }
panic(todo(""))
}
// struct tm *_gmtime64( const __time64_t *sourceTime );
func X_gmtime64(t *TLS, sourceTime uintptr) uintptr {
+ if __ccgo_strace {
+ trc("t=%v sourceTime=%v, (%v:)", t, sourceTime, origin(2))
+ }
panic(todo(""))
}
// __time64_t _mktime64(struct tm *timeptr);
func X_mktime64(t *TLS, timeptr uintptr) time.X__time64_t {
+ if __ccgo_strace {
+ trc("t=%v timeptr=%v, (%v:)", t, timeptr, origin(2))
+ }
return time.X__time64_t(Xmktime(t, timeptr))
}
// char * gai_strerrorA(int ecode);
func Xgai_strerrorA(t *TLS, ecode int32) uintptr {
+ if __ccgo_strace {
+ trc("t=%v ecode=%v, (%v:)", t, ecode, origin(2))
+ }
panic(todo(""))
}
@@ -6097,6 +7096,9 @@ type __timeb64 struct {
// void _ftime64( struct __timeb64 *timeptr );
func X_ftime64(t *TLS, timeptr uintptr) {
+ if __ccgo_strace {
+ trc("t=%v timeptr=%v, (%v:)", t, timeptr, origin(2))
+ }
tm := gotime.Now()
(*__timeb64)(unsafe.Pointer(timeptr)).time = types.X__time64_t(tm.Unix())
@@ -6107,18 +7109,30 @@ func X_ftime64(t *TLS, timeptr uintptr) {
}
func X__ccgo_getMutexType(tls *TLS, m uintptr) int32 { /* pthread_mutex_lock.c:3:5: */
+ if __ccgo_strace {
+ trc("tls=%v m=%v, (%v:)", tls, m, origin(2))
+ }
return *(*int32)(unsafe.Pointer(m)) & 15
}
func X__ccgo_pthreadAttrGetDetachState(tls *TLS, a uintptr) int32 { /* pthread_attr_get.c:3:5: */
+ if __ccgo_strace {
+ trc("tls=%v a=%v, (%v:)", tls, a, origin(2))
+ }
return *(*int32)(unsafe.Pointer(a))
}
func X__ccgo_pthreadMutexattrGettype(tls *TLS, a uintptr) int32 { /* pthread_attr_get.c:93:5: */
+ if __ccgo_strace {
+ trc("tls=%v a=%v, (%v:)", tls, a, origin(2))
+ }
return *(*int32)(unsafe.Pointer(a)) & int32(3)
}
func Xchmod(t *TLS, pathname uintptr, mode int32) int32 {
+ if __ccgo_strace {
+ trc("t=%v pathname=%v mode=%v, (%v:)", t, pathname, mode, origin(2))
+ }
panic(todo("%q %#o", GoString(pathname), mode))
}
@@ -6142,6 +7156,9 @@ func Xchmod(t *TLS, pathname uintptr, mode int32) int32 {
//
// );
func XGetComputerNameExW(t *TLS, nameType int32, lpBuffer, nSize uintptr) int32 {
+ if __ccgo_strace {
+ trc("t=%v nameType=%v nSize=%v, (%v:)", t, nameType, nSize, origin(2))
+ }
r0, _, err := syscall.Syscall(procGetComputerNameExW.Addr(), 3, uintptr(nameType), lpBuffer, nSize)
if err != 0 {
t.setErrno(err)
@@ -6155,7 +7172,13 @@ func XGetComputerNameExW(t *TLS, nameType int32, lpBuffer, nSize uintptr) int32
// double y
//
// );
-func X_copysign(t *TLS, x, y float64) float64 { return Xcopysign(t, x, y) }
+
+func X_copysign(t *TLS, x, y float64) float64 {
+ if __ccgo_strace {
+ trc("t=%v y=%v, (%v:)", t, y, origin(2))
+ }
+ return Xcopysign(t, x, y)
+}
// int _wtoi(
//
@@ -6163,6 +7186,9 @@ func X_copysign(t *TLS, x, y float64) float64 { return Xcopysign(t, x, y) }
//
// );
func X_wtoi(t *TLS, str uintptr) int32 {
+ if __ccgo_strace {
+ trc("t=%v str=%v, (%v:)", t, str, origin(2))
+ }
panic(todo(""))
}
@@ -6187,6 +7213,9 @@ func allocW(t *TLS, v string) (r uintptr) {
//
// );
func X_wgetenv(t *TLS, varname uintptr) uintptr {
+ if __ccgo_strace {
+ trc("t=%v varname=%v, (%v:)", t, varname, origin(2))
+ }
if !wenvValid {
bootWinEnviron(t)
}
@@ -6210,6 +7239,9 @@ func X_wgetenv(t *TLS, varname uintptr) uintptr {
//
// );
func X_wputenv(t *TLS, envstring uintptr) int32 {
+ if __ccgo_strace {
+ trc("t=%v envstring=%v, (%v:)", t, envstring, origin(2))
+ }
if !wenvValid {
bootWinEnviron(t)
}
@@ -6253,7 +7285,12 @@ func bootWinEnviron(t *TLS) {
wenvValid = true
}
-func Xfabsl(t *TLS, x float64) float64 { return math.Abs(x) }
+func Xfabsl(t *TLS, x float64) float64 {
+ if __ccgo_strace {
+ trc("t=%v x=%v, (%v:)", t, x, origin(2))
+ }
+ return math.Abs(x)
+}
func X__stdio_common_vfprintf(t *TLS, args ...interface{}) int32 { panic("TODO") }
func X__stdio_common_vfprintf_p(t *TLS, args ...interface{}) int32 { panic("TODO") }
diff --git a/vendor/modernc.org/libc/libc_windows_386.go b/vendor/modernc.org/libc/libc_windows_386.go
index d48e6f65..c956813c 100644
--- a/vendor/modernc.org/libc/libc_windows_386.go
+++ b/vendor/modernc.org/libc/libc_windows_386.go
@@ -17,6 +17,9 @@ import (
// int sigaction(int signum, const struct sigaction *act, struct sigaction *oldact);
func Xsigaction(t *TLS, signum int32, act, oldact uintptr) int32 {
+ if __ccgo_strace {
+ trc("t=%v signum=%v oldact=%v, (%v:)", t, signum, oldact, origin(2))
+ }
panic(todo(""))
// // musl/arch/x32/ksigaction.h
// //
@@ -62,6 +65,9 @@ func Xsigaction(t *TLS, signum int32, act, oldact uintptr) int32 {
// int fcntl(int fd, int cmd, ... /* arg */ );
func Xfcntl64(t *TLS, fd, cmd int32, args uintptr) int32 {
+ if __ccgo_strace {
+ trc("t=%v cmd=%v args=%v, (%v:)", t, cmd, args, origin(2))
+ }
panic(todo(""))
// var arg uintptr
// if args != 0 {
@@ -84,6 +90,9 @@ func Xfcntl64(t *TLS, fd, cmd int32, args uintptr) int32 {
// int lstat(const char *pathname, struct stat *statbuf);
func Xlstat64(t *TLS, pathname, statbuf uintptr) int32 {
+ if __ccgo_strace {
+ trc("t=%v statbuf=%v, (%v:)", t, statbuf, origin(2))
+ }
panic(todo(""))
// if _, _, err := unix.Syscall(unix.SYS_LSTAT64, pathname, statbuf, 0); err != 0 {
// if dmesgs {
@@ -101,6 +110,9 @@ func Xlstat64(t *TLS, pathname, statbuf uintptr) int32 {
// int stat(const char *pathname, struct stat *statbuf);
func Xstat64(t *TLS, pathname, statbuf uintptr) int32 {
+ if __ccgo_strace {
+ trc("t=%v statbuf=%v, (%v:)", t, statbuf, origin(2))
+ }
panic(todo(""))
// if _, _, err := unix.Syscall(unix.SYS_STAT64, pathname, statbuf, 0); err != 0 {
// if dmesgs {
@@ -118,6 +130,9 @@ func Xstat64(t *TLS, pathname, statbuf uintptr) int32 {
// int fstat(int fd, struct stat *statbuf);
func Xfstat64(t *TLS, fd int32, statbuf uintptr) int32 {
+ if __ccgo_strace {
+ trc("t=%v fd=%v statbuf=%v, (%v:)", t, fd, statbuf, origin(2))
+ }
panic(todo(""))
// if _, _, err := unix.Syscall(unix.SYS_FSTAT64, uintptr(fd), statbuf, 0); err != 0 {
// if dmesgs {
@@ -135,6 +150,9 @@ func Xfstat64(t *TLS, fd int32, statbuf uintptr) int32 {
// void *mremap(void *old_address, size_t old_size, size_t new_size, int flags, ... /* void *new_address */);
func Xmremap(t *TLS, old_address uintptr, old_size, new_size types.Size_t, flags int32, args uintptr) uintptr {
+ if __ccgo_strace {
+ trc("t=%v old_address=%v new_size=%v flags=%v args=%v, (%v:)", t, old_address, new_size, flags, args, origin(2))
+ }
panic(todo(""))
// var arg uintptr
// if args != 0 {
@@ -156,11 +174,17 @@ func Xmremap(t *TLS, old_address uintptr, old_size, new_size types.Size_t, flags
}
func Xmmap(t *TLS, addr uintptr, length types.Size_t, prot, flags, fd int32, offset types.Off_t) uintptr {
+ if __ccgo_strace {
+ trc("t=%v addr=%v length=%v fd=%v offset=%v, (%v:)", t, addr, length, fd, offset, origin(2))
+ }
return Xmmap64(t, addr, length, prot, flags, fd, offset)
}
// void *mmap(void *addr, size_t length, int prot, int flags, int fd, off_t offset);
func Xmmap64(t *TLS, addr uintptr, length types.Size_t, prot, flags, fd int32, offset types.Off_t) uintptr {
+ if __ccgo_strace {
+ trc("t=%v addr=%v length=%v fd=%v offset=%v, (%v:)", t, addr, length, fd, offset, origin(2))
+ }
panic(todo(""))
// data, _, err := unix.Syscall6(unix.SYS_MMAP2, addr, uintptr(length), uintptr(prot), uintptr(flags), uintptr(fd), uintptr(offset>>12))
// if err != 0 {
@@ -179,6 +203,9 @@ func Xmmap64(t *TLS, addr uintptr, length types.Size_t, prot, flags, fd int32, o
// int ftruncate(int fd, off_t length);
func Xftruncate64(t *TLS, fd int32, length types.Off_t) int32 {
+ if __ccgo_strace {
+ trc("t=%v fd=%v length=%v, (%v:)", t, fd, length, origin(2))
+ }
panic(todo(""))
// if _, _, err := unix.Syscall(unix.SYS_FTRUNCATE64, uintptr(fd), uintptr(length), uintptr(length>>32)); err != 0 {
// if dmesgs {
@@ -196,6 +223,9 @@ func Xftruncate64(t *TLS, fd int32, length types.Off_t) int32 {
// off64_t lseek64(int fd, off64_t offset, int whence);
func Xlseek64(t *TLS, fd int32, offset types.Off_t, whence int32) types.Off_t {
+ if __ccgo_strace {
+ trc("t=%v fd=%v offset=%v whence=%v, (%v:)", t, fd, offset, whence, origin(2))
+ }
panic(todo(""))
// bp := t.Alloc(int(unsafe.Sizeof(types.X__loff_t(0))))
// defer t.Free(int(unsafe.Sizeof(types.X__loff_t(0))))
@@ -215,6 +245,9 @@ func Xlseek64(t *TLS, fd int32, offset types.Off_t, whence int32) types.Off_t {
// int utime(const char *filename, const struct utimbuf *times);
func Xutime(t *TLS, filename, times uintptr) int32 {
+ if __ccgo_strace {
+ trc("t=%v times=%v, (%v:)", t, times, origin(2))
+ }
panic(todo(""))
// if _, _, err := unix.Syscall(unix.SYS_UTIME, filename, times, 0); err != 0 {
// t.setErrno(err)
@@ -226,6 +259,9 @@ func Xutime(t *TLS, filename, times uintptr) int32 {
// unsigned int alarm(unsigned int seconds);
func Xalarm(t *TLS, seconds uint32) uint32 {
+ if __ccgo_strace {
+ trc("t=%v seconds=%v, (%v:)", t, seconds, origin(2))
+ }
panic(todo(""))
// n, _, err := unix.Syscall(unix.SYS_ALARM, uintptr(seconds), 0, 0)
// if err != 0 {
@@ -237,6 +273,9 @@ func Xalarm(t *TLS, seconds uint32) uint32 {
// int getrlimit(int resource, struct rlimit *rlim);
func Xgetrlimit64(t *TLS, resource int32, rlim uintptr) int32 {
+ if __ccgo_strace {
+ trc("t=%v resource=%v rlim=%v, (%v:)", t, resource, rlim, origin(2))
+ }
panic(todo(""))
// if _, _, err := unix.Syscall(unix.SYS_GETRLIMIT, uintptr(resource), uintptr(rlim), 0); err != 0 {
// t.setErrno(err)
@@ -248,6 +287,9 @@ func Xgetrlimit64(t *TLS, resource int32, rlim uintptr) int32 {
// time_t time(time_t *tloc);
func Xtime(t *TLS, tloc uintptr) types.Time_t {
+ if __ccgo_strace {
+ trc("t=%v tloc=%v, (%v:)", t, tloc, origin(2))
+ }
panic(todo(""))
// n, _, err := unix.Syscall(unix.SYS_TIME, tloc, 0, 0)
// if err != 0 {
@@ -263,6 +305,9 @@ func Xtime(t *TLS, tloc uintptr) types.Time_t {
// int mkdir(const char *path, mode_t mode);
func Xmkdir(t *TLS, path uintptr, mode types.Mode_t) int32 {
+ if __ccgo_strace {
+ trc("t=%v path=%v mode=%v, (%v:)", t, path, mode, origin(2))
+ }
panic(todo(""))
// if _, _, err := unix.Syscall(unix.SYS_MKDIR, path, uintptr(mode), 0); err != 0 {
// t.setErrno(err)
@@ -277,6 +322,9 @@ func Xmkdir(t *TLS, path uintptr, mode types.Mode_t) int32 {
// int symlink(const char *target, const char *linkpath);
func Xsymlink(t *TLS, target, linkpath uintptr) int32 {
+ if __ccgo_strace {
+ trc("t=%v linkpath=%v, (%v:)", t, linkpath, origin(2))
+ }
panic(todo(""))
// if _, _, err := unix.Syscall(unix.SYS_SYMLINK, target, linkpath, 0); err != 0 {
// t.setErrno(err)
@@ -291,6 +339,9 @@ func Xsymlink(t *TLS, target, linkpath uintptr) int32 {
// int utimes(const char *filename, const struct timeval times[2]);
func Xutimes(t *TLS, filename, times uintptr) int32 {
+ if __ccgo_strace {
+ trc("t=%v times=%v, (%v:)", t, times, origin(2))
+ }
panic(todo(""))
// if _, _, err := unix.Syscall(unix.SYS_UTIMES, filename, times, 0); err != 0 {
// t.setErrno(err)
@@ -305,6 +356,9 @@ func Xutimes(t *TLS, filename, times uintptr) int32 {
// int unlink(const char *pathname);
func Xunlink(t *TLS, pathname uintptr) int32 {
+ if __ccgo_strace {
+ trc("t=%v pathname=%v, (%v:)", t, pathname, origin(2))
+ }
err := syscall.DeleteFile((*uint16)(unsafe.Pointer(pathname)))
if err != nil {
t.setErrno(err)
@@ -321,6 +375,9 @@ func Xunlink(t *TLS, pathname uintptr) int32 {
// int access(const char *pathname, int mode);
func Xaccess(t *TLS, pathname uintptr, mode int32) int32 {
+ if __ccgo_strace {
+ trc("t=%v pathname=%v mode=%v, (%v:)", t, pathname, mode, origin(2))
+ }
panic(todo(""))
// if _, _, err := unix.Syscall(unix.SYS_ACCESS, pathname, uintptr(mode), 0); err != 0 {
// if dmesgs {
@@ -338,6 +395,9 @@ func Xaccess(t *TLS, pathname uintptr, mode int32) int32 {
// int rmdir(const char *pathname);
func Xrmdir(t *TLS, pathname uintptr) int32 {
+ if __ccgo_strace {
+ trc("t=%v pathname=%v, (%v:)", t, pathname, origin(2))
+ }
panic(todo(""))
// if _, _, err := unix.Syscall(unix.SYS_RMDIR, pathname, 0, 0); err != 0 {
// t.setErrno(err)
@@ -352,6 +412,9 @@ func Xrmdir(t *TLS, pathname uintptr) int32 {
// int mknod(const char *pathname, mode_t mode, dev_t dev);
func Xmknod(t *TLS, pathname uintptr, mode types.Mode_t, dev types.Dev_t) int32 {
+ if __ccgo_strace {
+ trc("t=%v pathname=%v mode=%v dev=%v, (%v:)", t, pathname, mode, dev, origin(2))
+ }
panic(todo(""))
// if _, _, err := unix.Syscall(unix.SYS_MKNOD, pathname, uintptr(mode), uintptr(dev)); err != 0 {
// t.setErrno(err)
@@ -374,6 +437,9 @@ func Xmknod(t *TLS, pathname uintptr, mode types.Mode_t, dev types.Dev_t) int32
// int link(const char *oldpath, const char *newpath);
func Xlink(t *TLS, oldpath, newpath uintptr) int32 {
+ if __ccgo_strace {
+ trc("t=%v newpath=%v, (%v:)", t, newpath, origin(2))
+ }
panic(todo(""))
// if _, _, err := unix.Syscall(unix.SYS_LINK, oldpath, newpath, 0); err != 0 {
// t.setErrno(err)
@@ -385,6 +451,9 @@ func Xlink(t *TLS, oldpath, newpath uintptr) int32 {
// int pipe(int pipefd[2]);
func Xpipe(t *TLS, pipefd uintptr) int32 {
+ if __ccgo_strace {
+ trc("t=%v pipefd=%v, (%v:)", t, pipefd, origin(2))
+ }
panic(todo(""))
// if _, _, err := unix.Syscall(unix.SYS_PIPE, pipefd, 0, 0); err != 0 {
// t.setErrno(err)
@@ -396,6 +465,9 @@ func Xpipe(t *TLS, pipefd uintptr) int32 {
// int dup2(int oldfd, int newfd);
func Xdup2(t *TLS, oldfd, newfd int32) int32 {
+ if __ccgo_strace {
+ trc("t=%v newfd=%v, (%v:)", t, newfd, origin(2))
+ }
panic(todo(""))
// n, _, err := unix.Syscall(unix.SYS_DUP2, uintptr(oldfd), uintptr(newfd), 0)
// if err != 0 {
@@ -408,6 +480,9 @@ func Xdup2(t *TLS, oldfd, newfd int32) int32 {
// ssize_t readlink(const char *restrict path, char *restrict buf, size_t bufsize);
func Xreadlink(t *TLS, path, buf uintptr, bufsize types.Size_t) types.Ssize_t {
+ if __ccgo_strace {
+ trc("t=%v buf=%v bufsize=%v, (%v:)", t, buf, bufsize, origin(2))
+ }
panic(todo(""))
// n, _, err := unix.Syscall(unix.SYS_READLINK, path, buf, uintptr(bufsize))
// if err != 0 {
@@ -420,6 +495,9 @@ func Xreadlink(t *TLS, path, buf uintptr, bufsize types.Size_t) types.Ssize_t {
// FILE *fopen64(const char *pathname, const char *mode);
func Xfopen64(t *TLS, pathname, mode uintptr) uintptr {
+ if __ccgo_strace {
+ trc("t=%v mode=%v, (%v:)", t, mode, origin(2))
+ }
m := strings.ReplaceAll(GoString(mode), "b", "")
var flags int
@@ -456,14 +534,23 @@ func Xfopen64(t *TLS, pathname, mode uintptr) uintptr {
}
func Xrecv(t *TLS, sockfd uint32, buf uintptr, len, flags int32) int32 {
+ if __ccgo_strace {
+ trc("t=%v sockfd=%v buf=%v flags=%v, (%v:)", t, sockfd, buf, flags, origin(2))
+ }
panic(todo(""))
}
func Xsend(t *TLS, sockfd uint32, buf uintptr, len, flags int32) int32 {
+ if __ccgo_strace {
+ trc("t=%v sockfd=%v buf=%v flags=%v, (%v:)", t, sockfd, buf, flags, origin(2))
+ }
panic(todo(""))
}
func Xshutdown(t *TLS, sockfd uint32, how int32) int32 {
+ if __ccgo_strace {
+ trc("t=%v sockfd=%v how=%v, (%v:)", t, sockfd, how, origin(2))
+ }
panic(todo(""))
// if _, _, err := unix.Syscall(unix.SYS_SHUTDOWN, uintptr(sockfd), uintptr(how), 0); err != 0 {
// t.setErrno(err)
@@ -474,40 +561,67 @@ func Xshutdown(t *TLS, sockfd uint32, how int32) int32 {
}
func Xgetpeername(t *TLS, sockfd uint32, addr uintptr, addrlen uintptr) int32 {
+ if __ccgo_strace {
+ trc("t=%v sockfd=%v addr=%v addrlen=%v, (%v:)", t, sockfd, addr, addrlen, origin(2))
+ }
panic(todo(""))
}
func Xgetsockname(t *TLS, sockfd uint32, addr, addrlen uintptr) int32 {
+ if __ccgo_strace {
+ trc("t=%v sockfd=%v addrlen=%v, (%v:)", t, sockfd, addrlen, origin(2))
+ }
panic(todo(""))
}
func Xsocket(t *TLS, domain, type1, protocol int32) uint32 {
+ if __ccgo_strace {
+ trc("t=%v protocol=%v, (%v:)", t, protocol, origin(2))
+ }
panic(todo(""))
}
func Xbind(t *TLS, sockfd uint32, addr uintptr, addrlen int32) int32 {
+ if __ccgo_strace {
+ trc("t=%v sockfd=%v addr=%v addrlen=%v, (%v:)", t, sockfd, addr, addrlen, origin(2))
+ }
panic(todo(""))
}
func Xconnect(t *TLS, sockfd uint32, addr uintptr, addrlen int32) int32 {
+ if __ccgo_strace {
+ trc("t=%v sockfd=%v addr=%v addrlen=%v, (%v:)", t, sockfd, addr, addrlen, origin(2))
+ }
panic(todo(""))
}
func Xlisten(t *TLS, sockfd uint32, backlog int32) int32 {
+ if __ccgo_strace {
+ trc("t=%v sockfd=%v backlog=%v, (%v:)", t, sockfd, backlog, origin(2))
+ }
panic(todo(""))
}
func Xaccept(t *TLS, sockfd uint32, addr uintptr, addrlen uintptr) uint32 {
+ if __ccgo_strace {
+ trc("t=%v sockfd=%v addr=%v addrlen=%v, (%v:)", t, sockfd, addr, addrlen, origin(2))
+ }
panic(todo(""))
}
// struct tm *_localtime32( const __time32_t *sourceTime );
func X_localtime32(t *TLS, sourceTime uintptr) uintptr {
+ if __ccgo_strace {
+ trc("t=%v sourceTime=%v, (%v:)", t, sourceTime, origin(2))
+ }
panic(todo(""))
}
// struct tm *_gmtime32( const __time32_t *sourceTime );
func X_gmtime32(t *TLS, sourceTime uintptr) uintptr {
+ if __ccgo_strace {
+ trc("t=%v sourceTime=%v, (%v:)", t, sourceTime, origin(2))
+ }
panic(todo(""))
}
@@ -519,6 +633,9 @@ func X_gmtime32(t *TLS, sourceTime uintptr) uintptr {
//
// );
func XSetWindowLongW(t *TLS, hwnd uintptr, nIndex int32, dwNewLong long) long {
+ if __ccgo_strace {
+ trc("t=%v hwnd=%v nIndex=%v dwNewLong=%v, (%v:)", t, hwnd, nIndex, dwNewLong, origin(2))
+ }
panic(todo(""))
}
@@ -529,6 +646,9 @@ func XSetWindowLongW(t *TLS, hwnd uintptr, nIndex int32, dwNewLong long) long {
//
// );
func XGetWindowLongW(t *TLS, hwnd uintptr, nIndex int32) long {
+ if __ccgo_strace {
+ trc("t=%v hwnd=%v nIndex=%v, (%v:)", t, hwnd, nIndex, origin(2))
+ }
panic(todo(""))
}
@@ -555,6 +675,9 @@ func XSendMessageTimeoutW(t *TLS, _ ...interface{}) int32 {
//
// );
func X_fstat(t *TLS, fd int32, buffer uintptr) int32 {
+ if __ccgo_strace {
+ trc("t=%v fd=%v buffer=%v, (%v:)", t, fd, buffer, origin(2))
+ }
f, ok := fdToFile(fd)
if !ok {
t.setErrno(EBADF)
diff --git a/vendor/modernc.org/libc/libc_windows_amd64.go b/vendor/modernc.org/libc/libc_windows_amd64.go
index 2b73ab4c..9e65ed53 100644
--- a/vendor/modernc.org/libc/libc_windows_amd64.go
+++ b/vendor/modernc.org/libc/libc_windows_amd64.go
@@ -15,6 +15,9 @@ import (
// int sigaction(int signum, const struct sigaction *act, struct sigaction *oldact);
func Xsigaction(t *TLS, signum int32, act, oldact uintptr) int32 {
+ if __ccgo_strace {
+ trc("t=%v signum=%v oldact=%v, (%v:)", t, signum, oldact, origin(2))
+ }
panic(todo(""))
// musl/arch/x86_64/ksigaction.h
//
@@ -60,6 +63,9 @@ func Xsigaction(t *TLS, signum int32, act, oldact uintptr) int32 {
// int fcntl(int fd, int cmd, ... /* arg */ );
func Xfcntl64(t *TLS, fd, cmd int32, args uintptr) int32 {
+ if __ccgo_strace {
+ trc("t=%v cmd=%v args=%v, (%v:)", t, cmd, args, origin(2))
+ }
panic(todo(""))
// var arg uintptr
// if args != 0 {
@@ -82,6 +88,9 @@ func Xfcntl64(t *TLS, fd, cmd int32, args uintptr) int32 {
// int lstat(const char *pathname, struct stat *statbuf);
func Xlstat64(t *TLS, pathname, statbuf uintptr) int32 {
+ if __ccgo_strace {
+ trc("t=%v statbuf=%v, (%v:)", t, statbuf, origin(2))
+ }
panic(todo(""))
// if _, _, err := unix.Syscall(unix.SYS_LSTAT, pathname, statbuf, 0); err != 0 {
// if dmesgs {
@@ -99,6 +108,9 @@ func Xlstat64(t *TLS, pathname, statbuf uintptr) int32 {
// int stat(const char *pathname, struct stat *statbuf);
func Xstat64(t *TLS, pathname, statbuf uintptr) int32 {
+ if __ccgo_strace {
+ trc("t=%v statbuf=%v, (%v:)", t, statbuf, origin(2))
+ }
panic(todo(""))
// if _, _, err := unix.Syscall(unix.SYS_STAT, pathname, statbuf, 0); err != 0 {
// if dmesgs {
@@ -116,6 +128,9 @@ func Xstat64(t *TLS, pathname, statbuf uintptr) int32 {
// int fstat(int fd, struct stat *statbuf);
func Xfstat64(t *TLS, fd int32, statbuf uintptr) int32 {
+ if __ccgo_strace {
+ trc("t=%v fd=%v statbuf=%v, (%v:)", t, fd, statbuf, origin(2))
+ }
panic(todo(""))
// if _, _, err := unix.Syscall(unix.SYS_FSTAT, uintptr(fd), statbuf, 0); err != 0 {
// if dmesgs {
@@ -132,11 +147,17 @@ func Xfstat64(t *TLS, fd int32, statbuf uintptr) int32 {
}
func Xmmap(t *TLS, addr uintptr, length types.Size_t, prot, flags, fd int32, offset types.Off_t) uintptr {
+ if __ccgo_strace {
+ trc("t=%v addr=%v length=%v fd=%v offset=%v, (%v:)", t, addr, length, fd, offset, origin(2))
+ }
return Xmmap64(t, addr, length, prot, flags, fd, offset)
}
// void *mmap(void *addr, size_t length, int prot, int flags, int fd, off_t offset);
func Xmmap64(t *TLS, addr uintptr, length types.Size_t, prot, flags, fd int32, offset types.Off_t) uintptr {
+ if __ccgo_strace {
+ trc("t=%v addr=%v length=%v fd=%v offset=%v, (%v:)", t, addr, length, fd, offset, origin(2))
+ }
panic(todo(""))
// data, _, err := unix.Syscall6(unix.SYS_MMAP, addr, uintptr(length), uintptr(prot), uintptr(flags), uintptr(fd), uintptr(offset))
// if err != 0 {
@@ -155,6 +176,9 @@ func Xmmap64(t *TLS, addr uintptr, length types.Size_t, prot, flags, fd int32, o
// void *mremap(void *old_address, size_t old_size, size_t new_size, int flags, ... /* void *new_address */);
func Xmremap(t *TLS, old_address uintptr, old_size, new_size types.Size_t, flags int32, args uintptr) uintptr {
+ if __ccgo_strace {
+ trc("t=%v old_address=%v new_size=%v flags=%v args=%v, (%v:)", t, old_address, new_size, flags, args, origin(2))
+ }
panic(todo(""))
// var arg uintptr
// if args != 0 {
@@ -177,6 +201,9 @@ func Xmremap(t *TLS, old_address uintptr, old_size, new_size types.Size_t, flags
// int ftruncate(int fd, off_t length);
func Xftruncate64(t *TLS, fd int32, length types.Off_t) int32 {
+ if __ccgo_strace {
+ trc("t=%v fd=%v length=%v, (%v:)", t, fd, length, origin(2))
+ }
panic(todo(""))
// if _, _, err := unix.Syscall(unix.SYS_FTRUNCATE, uintptr(fd), uintptr(length), 0); err != 0 {
// if dmesgs {
@@ -194,6 +221,9 @@ func Xftruncate64(t *TLS, fd int32, length types.Off_t) int32 {
// off64_t lseek64(int fd, off64_t offset, int whence);
func Xlseek64(t *TLS, fd int32, offset types.Off_t, whence int32) types.Off_t {
+ if __ccgo_strace {
+ trc("t=%v fd=%v offset=%v whence=%v, (%v:)", t, fd, offset, whence, origin(2))
+ }
f, ok := fdToFile(fd)
if !ok {
@@ -218,6 +248,9 @@ func Xlseek64(t *TLS, fd int32, offset types.Off_t, whence int32) types.Off_t {
// int utime(const char *filename, const struct utimbuf *times);
func Xutime(t *TLS, filename, times uintptr) int32 {
+ if __ccgo_strace {
+ trc("t=%v times=%v, (%v:)", t, times, origin(2))
+ }
panic(todo(""))
// if _, _, err := unix.Syscall(unix.SYS_UTIME, filename, times, 0); err != 0 {
// t.setErrno(err)
@@ -229,6 +262,9 @@ func Xutime(t *TLS, filename, times uintptr) int32 {
// unsigned int alarm(unsigned int seconds);
func Xalarm(t *TLS, seconds uint32) uint32 {
+ if __ccgo_strace {
+ trc("t=%v seconds=%v, (%v:)", t, seconds, origin(2))
+ }
panic(todo(""))
// n, _, err := unix.Syscall(unix.SYS_ALARM, uintptr(seconds), 0, 0)
// if err != 0 {
@@ -240,6 +276,9 @@ func Xalarm(t *TLS, seconds uint32) uint32 {
// time_t time(time_t *tloc);
func Xtime(t *TLS, tloc uintptr) types.Time_t {
+ if __ccgo_strace {
+ trc("t=%v tloc=%v, (%v:)", t, tloc, origin(2))
+ }
panic(todo(""))
// n, _, err := unix.Syscall(unix.SYS_TIME, tloc, 0, 0)
// if err != 0 {
@@ -255,6 +294,9 @@ func Xtime(t *TLS, tloc uintptr) types.Time_t {
// int getrlimit(int resource, struct rlimit *rlim);
func Xgetrlimit64(t *TLS, resource int32, rlim uintptr) int32 {
+ if __ccgo_strace {
+ trc("t=%v resource=%v rlim=%v, (%v:)", t, resource, rlim, origin(2))
+ }
panic(todo(""))
// if _, _, err := unix.Syscall(unix.SYS_GETRLIMIT, uintptr(resource), uintptr(rlim), 0); err != 0 {
// t.setErrno(err)
@@ -266,6 +308,9 @@ func Xgetrlimit64(t *TLS, resource int32, rlim uintptr) int32 {
// int mkdir(const char *path, mode_t mode);
func Xmkdir(t *TLS, path uintptr, mode types.Mode_t) int32 {
+ if __ccgo_strace {
+ trc("t=%v path=%v mode=%v, (%v:)", t, path, mode, origin(2))
+ }
panic(todo(""))
// if _, _, err := unix.Syscall(unix.SYS_MKDIR, path, uintptr(mode), 0); err != 0 {
// t.setErrno(err)
@@ -280,6 +325,9 @@ func Xmkdir(t *TLS, path uintptr, mode types.Mode_t) int32 {
// int symlink(const char *target, const char *linkpath);
func Xsymlink(t *TLS, target, linkpath uintptr) int32 {
+ if __ccgo_strace {
+ trc("t=%v linkpath=%v, (%v:)", t, linkpath, origin(2))
+ }
panic(todo(""))
// if _, _, err := unix.Syscall(unix.SYS_SYMLINK, target, linkpath, 0); err != 0 {
// t.setErrno(err)
@@ -294,6 +342,9 @@ func Xsymlink(t *TLS, target, linkpath uintptr) int32 {
// int utimes(const char *filename, const struct timeval times[2]);
func Xutimes(t *TLS, filename, times uintptr) int32 {
+ if __ccgo_strace {
+ trc("t=%v times=%v, (%v:)", t, times, origin(2))
+ }
panic(todo(""))
// if _, _, err := unix.Syscall(unix.SYS_UTIMES, filename, times, 0); err != 0 {
// t.setErrno(err)
@@ -308,6 +359,9 @@ func Xutimes(t *TLS, filename, times uintptr) int32 {
// int unlink(const char *pathname);
func Xunlink(t *TLS, pathname uintptr) int32 {
+ if __ccgo_strace {
+ trc("t=%v pathname=%v, (%v:)", t, pathname, origin(2))
+ }
err := syscall.DeleteFile((*uint16)(unsafe.Pointer(pathname)))
if err != nil {
@@ -324,6 +378,9 @@ func Xunlink(t *TLS, pathname uintptr) int32 {
// int access(const char *pathname, int mode);
func Xaccess(t *TLS, pathname uintptr, mode int32) int32 {
+ if __ccgo_strace {
+ trc("t=%v pathname=%v mode=%v, (%v:)", t, pathname, mode, origin(2))
+ }
panic(todo(""))
// if _, _, err := unix.Syscall(unix.SYS_ACCESS, pathname, uintptr(mode), 0); err != 0 {
// if dmesgs {
@@ -341,6 +398,9 @@ func Xaccess(t *TLS, pathname uintptr, mode int32) int32 {
// int rmdir(const char *pathname);
func Xrmdir(t *TLS, pathname uintptr) int32 {
+ if __ccgo_strace {
+ trc("t=%v pathname=%v, (%v:)", t, pathname, origin(2))
+ }
panic(todo(""))
// if _, _, err := unix.Syscall(unix.SYS_RMDIR, pathname, 0, 0); err != 0 {
// t.setErrno(err)
@@ -355,6 +415,9 @@ func Xrmdir(t *TLS, pathname uintptr) int32 {
// int mknod(const char *pathname, mode_t mode, dev_t dev);
func Xmknod(t *TLS, pathname uintptr, mode types.Mode_t, dev types.Dev_t) int32 {
+ if __ccgo_strace {
+ trc("t=%v pathname=%v mode=%v dev=%v, (%v:)", t, pathname, mode, dev, origin(2))
+ }
panic(todo(""))
// if _, _, err := unix.Syscall(unix.SYS_MKNOD, pathname, uintptr(mode), uintptr(dev)); err != 0 {
// t.setErrno(err)
@@ -377,6 +440,9 @@ func Xmknod(t *TLS, pathname uintptr, mode types.Mode_t, dev types.Dev_t) int32
// int link(const char *oldpath, const char *newpath);
func Xlink(t *TLS, oldpath, newpath uintptr) int32 {
+ if __ccgo_strace {
+ trc("t=%v newpath=%v, (%v:)", t, newpath, origin(2))
+ }
panic(todo(""))
// if _, _, err := unix.Syscall(unix.SYS_LINK, oldpath, newpath, 0); err != 0 {
// t.setErrno(err)
@@ -388,6 +454,9 @@ func Xlink(t *TLS, oldpath, newpath uintptr) int32 {
// int pipe(int pipefd[2]);
func Xpipe(t *TLS, pipefd uintptr) int32 {
+ if __ccgo_strace {
+ trc("t=%v pipefd=%v, (%v:)", t, pipefd, origin(2))
+ }
panic(todo(""))
// if _, _, err := unix.Syscall(unix.SYS_PIPE, pipefd, 0, 0); err != 0 {
// t.setErrno(err)
@@ -399,6 +468,9 @@ func Xpipe(t *TLS, pipefd uintptr) int32 {
// int dup2(int oldfd, int newfd);
func Xdup2(t *TLS, oldfd, newfd int32) int32 {
+ if __ccgo_strace {
+ trc("t=%v newfd=%v, (%v:)", t, newfd, origin(2))
+ }
panic(todo(""))
// n, _, err := unix.Syscall(unix.SYS_DUP2, uintptr(oldfd), uintptr(newfd), 0)
// if err != 0 {
@@ -411,6 +483,9 @@ func Xdup2(t *TLS, oldfd, newfd int32) int32 {
// ssize_t readlink(const char *restrict path, char *restrict buf, size_t bufsize);
func Xreadlink(t *TLS, path, buf uintptr, bufsize types.Size_t) types.Ssize_t {
+ if __ccgo_strace {
+ trc("t=%v buf=%v bufsize=%v, (%v:)", t, buf, bufsize, origin(2))
+ }
panic(todo(""))
// n, _, err := unix.Syscall(unix.SYS_READLINK, path, buf, uintptr(bufsize))
// if err != 0 {
@@ -423,6 +498,9 @@ func Xreadlink(t *TLS, path, buf uintptr, bufsize types.Size_t) types.Ssize_t {
// FILE *fopen64(const char *pathname, const char *mode);
func Xfopen64(t *TLS, pathname, mode uintptr) uintptr {
+ if __ccgo_strace {
+ trc("t=%v mode=%v, (%v:)", t, mode, origin(2))
+ }
m := strings.ReplaceAll(GoString(mode), "b", "")
var flags int
@@ -459,42 +537,72 @@ func Xfopen64(t *TLS, pathname, mode uintptr) uintptr {
}
func Xrecv(t *TLS, sockfd uint64, buf uintptr, len, flags int32) int32 {
+ if __ccgo_strace {
+ trc("t=%v sockfd=%v buf=%v flags=%v, (%v:)", t, sockfd, buf, flags, origin(2))
+ }
panic(todo(""))
}
func Xsend(t *TLS, sockfd uint64, buf uintptr, len, flags int32) int32 {
+ if __ccgo_strace {
+ trc("t=%v sockfd=%v buf=%v flags=%v, (%v:)", t, sockfd, buf, flags, origin(2))
+ }
panic(todo(""))
}
func Xshutdown(t *TLS, sockfd uint64, how int32) int32 {
+ if __ccgo_strace {
+ trc("t=%v sockfd=%v how=%v, (%v:)", t, sockfd, how, origin(2))
+ }
panic(todo(""))
}
func Xgetpeername(t *TLS, sockfd uint64, addr uintptr, addrlen uintptr) int32 {
+ if __ccgo_strace {
+ trc("t=%v sockfd=%v addr=%v addrlen=%v, (%v:)", t, sockfd, addr, addrlen, origin(2))
+ }
panic(todo(""))
}
func Xgetsockname(t *TLS, sockfd uint64, addr, addrlen uintptr) int32 {
+ if __ccgo_strace {
+ trc("t=%v sockfd=%v addrlen=%v, (%v:)", t, sockfd, addrlen, origin(2))
+ }
panic(todo(""))
}
func Xsocket(t *TLS, domain, type1, protocol int32) uint64 {
+ if __ccgo_strace {
+ trc("t=%v protocol=%v, (%v:)", t, protocol, origin(2))
+ }
panic(todo(""))
}
func Xbind(t *TLS, sockfd uint64, addr uintptr, addrlen int32) int32 {
+ if __ccgo_strace {
+ trc("t=%v sockfd=%v addr=%v addrlen=%v, (%v:)", t, sockfd, addr, addrlen, origin(2))
+ }
panic(todo(""))
}
func Xconnect(t *TLS, sockfd uint64, addr uintptr, addrlen int32) int32 {
+ if __ccgo_strace {
+ trc("t=%v sockfd=%v addr=%v addrlen=%v, (%v:)", t, sockfd, addr, addrlen, origin(2))
+ }
panic(todo(""))
}
func Xlisten(t *TLS, sockfd uint64, backlog int32) int32 {
+ if __ccgo_strace {
+ trc("t=%v sockfd=%v backlog=%v, (%v:)", t, sockfd, backlog, origin(2))
+ }
panic(todo(""))
}
func Xaccept(t *TLS, sockfd uint64, addr uintptr, addrlen uintptr) uint64 {
+ if __ccgo_strace {
+ trc("t=%v sockfd=%v addr=%v addrlen=%v, (%v:)", t, sockfd, addr, addrlen, origin(2))
+ }
panic(todo(""))
}
diff --git a/vendor/modernc.org/libc/libc_windows_arm64.go b/vendor/modernc.org/libc/libc_windows_arm64.go
index 2b73ab4c..9e65ed53 100644
--- a/vendor/modernc.org/libc/libc_windows_arm64.go
+++ b/vendor/modernc.org/libc/libc_windows_arm64.go
@@ -15,6 +15,9 @@ import (
// int sigaction(int signum, const struct sigaction *act, struct sigaction *oldact);
func Xsigaction(t *TLS, signum int32, act, oldact uintptr) int32 {
+ if __ccgo_strace {
+ trc("t=%v signum=%v oldact=%v, (%v:)", t, signum, oldact, origin(2))
+ }
panic(todo(""))
// musl/arch/x86_64/ksigaction.h
//
@@ -60,6 +63,9 @@ func Xsigaction(t *TLS, signum int32, act, oldact uintptr) int32 {
// int fcntl(int fd, int cmd, ... /* arg */ );
func Xfcntl64(t *TLS, fd, cmd int32, args uintptr) int32 {
+ if __ccgo_strace {
+ trc("t=%v cmd=%v args=%v, (%v:)", t, cmd, args, origin(2))
+ }
panic(todo(""))
// var arg uintptr
// if args != 0 {
@@ -82,6 +88,9 @@ func Xfcntl64(t *TLS, fd, cmd int32, args uintptr) int32 {
// int lstat(const char *pathname, struct stat *statbuf);
func Xlstat64(t *TLS, pathname, statbuf uintptr) int32 {
+ if __ccgo_strace {
+ trc("t=%v statbuf=%v, (%v:)", t, statbuf, origin(2))
+ }
panic(todo(""))
// if _, _, err := unix.Syscall(unix.SYS_LSTAT, pathname, statbuf, 0); err != 0 {
// if dmesgs {
@@ -99,6 +108,9 @@ func Xlstat64(t *TLS, pathname, statbuf uintptr) int32 {
// int stat(const char *pathname, struct stat *statbuf);
func Xstat64(t *TLS, pathname, statbuf uintptr) int32 {
+ if __ccgo_strace {
+ trc("t=%v statbuf=%v, (%v:)", t, statbuf, origin(2))
+ }
panic(todo(""))
// if _, _, err := unix.Syscall(unix.SYS_STAT, pathname, statbuf, 0); err != 0 {
// if dmesgs {
@@ -116,6 +128,9 @@ func Xstat64(t *TLS, pathname, statbuf uintptr) int32 {
// int fstat(int fd, struct stat *statbuf);
func Xfstat64(t *TLS, fd int32, statbuf uintptr) int32 {
+ if __ccgo_strace {
+ trc("t=%v fd=%v statbuf=%v, (%v:)", t, fd, statbuf, origin(2))
+ }
panic(todo(""))
// if _, _, err := unix.Syscall(unix.SYS_FSTAT, uintptr(fd), statbuf, 0); err != 0 {
// if dmesgs {
@@ -132,11 +147,17 @@ func Xfstat64(t *TLS, fd int32, statbuf uintptr) int32 {
}
func Xmmap(t *TLS, addr uintptr, length types.Size_t, prot, flags, fd int32, offset types.Off_t) uintptr {
+ if __ccgo_strace {
+ trc("t=%v addr=%v length=%v fd=%v offset=%v, (%v:)", t, addr, length, fd, offset, origin(2))
+ }
return Xmmap64(t, addr, length, prot, flags, fd, offset)
}
// void *mmap(void *addr, size_t length, int prot, int flags, int fd, off_t offset);
func Xmmap64(t *TLS, addr uintptr, length types.Size_t, prot, flags, fd int32, offset types.Off_t) uintptr {
+ if __ccgo_strace {
+ trc("t=%v addr=%v length=%v fd=%v offset=%v, (%v:)", t, addr, length, fd, offset, origin(2))
+ }
panic(todo(""))
// data, _, err := unix.Syscall6(unix.SYS_MMAP, addr, uintptr(length), uintptr(prot), uintptr(flags), uintptr(fd), uintptr(offset))
// if err != 0 {
@@ -155,6 +176,9 @@ func Xmmap64(t *TLS, addr uintptr, length types.Size_t, prot, flags, fd int32, o
// void *mremap(void *old_address, size_t old_size, size_t new_size, int flags, ... /* void *new_address */);
func Xmremap(t *TLS, old_address uintptr, old_size, new_size types.Size_t, flags int32, args uintptr) uintptr {
+ if __ccgo_strace {
+ trc("t=%v old_address=%v new_size=%v flags=%v args=%v, (%v:)", t, old_address, new_size, flags, args, origin(2))
+ }
panic(todo(""))
// var arg uintptr
// if args != 0 {
@@ -177,6 +201,9 @@ func Xmremap(t *TLS, old_address uintptr, old_size, new_size types.Size_t, flags
// int ftruncate(int fd, off_t length);
func Xftruncate64(t *TLS, fd int32, length types.Off_t) int32 {
+ if __ccgo_strace {
+ trc("t=%v fd=%v length=%v, (%v:)", t, fd, length, origin(2))
+ }
panic(todo(""))
// if _, _, err := unix.Syscall(unix.SYS_FTRUNCATE, uintptr(fd), uintptr(length), 0); err != 0 {
// if dmesgs {
@@ -194,6 +221,9 @@ func Xftruncate64(t *TLS, fd int32, length types.Off_t) int32 {
// off64_t lseek64(int fd, off64_t offset, int whence);
func Xlseek64(t *TLS, fd int32, offset types.Off_t, whence int32) types.Off_t {
+ if __ccgo_strace {
+ trc("t=%v fd=%v offset=%v whence=%v, (%v:)", t, fd, offset, whence, origin(2))
+ }
f, ok := fdToFile(fd)
if !ok {
@@ -218,6 +248,9 @@ func Xlseek64(t *TLS, fd int32, offset types.Off_t, whence int32) types.Off_t {
// int utime(const char *filename, const struct utimbuf *times);
func Xutime(t *TLS, filename, times uintptr) int32 {
+ if __ccgo_strace {
+ trc("t=%v times=%v, (%v:)", t, times, origin(2))
+ }
panic(todo(""))
// if _, _, err := unix.Syscall(unix.SYS_UTIME, filename, times, 0); err != 0 {
// t.setErrno(err)
@@ -229,6 +262,9 @@ func Xutime(t *TLS, filename, times uintptr) int32 {
// unsigned int alarm(unsigned int seconds);
func Xalarm(t *TLS, seconds uint32) uint32 {
+ if __ccgo_strace {
+ trc("t=%v seconds=%v, (%v:)", t, seconds, origin(2))
+ }
panic(todo(""))
// n, _, err := unix.Syscall(unix.SYS_ALARM, uintptr(seconds), 0, 0)
// if err != 0 {
@@ -240,6 +276,9 @@ func Xalarm(t *TLS, seconds uint32) uint32 {
// time_t time(time_t *tloc);
func Xtime(t *TLS, tloc uintptr) types.Time_t {
+ if __ccgo_strace {
+ trc("t=%v tloc=%v, (%v:)", t, tloc, origin(2))
+ }
panic(todo(""))
// n, _, err := unix.Syscall(unix.SYS_TIME, tloc, 0, 0)
// if err != 0 {
@@ -255,6 +294,9 @@ func Xtime(t *TLS, tloc uintptr) types.Time_t {
// int getrlimit(int resource, struct rlimit *rlim);
func Xgetrlimit64(t *TLS, resource int32, rlim uintptr) int32 {
+ if __ccgo_strace {
+ trc("t=%v resource=%v rlim=%v, (%v:)", t, resource, rlim, origin(2))
+ }
panic(todo(""))
// if _, _, err := unix.Syscall(unix.SYS_GETRLIMIT, uintptr(resource), uintptr(rlim), 0); err != 0 {
// t.setErrno(err)
@@ -266,6 +308,9 @@ func Xgetrlimit64(t *TLS, resource int32, rlim uintptr) int32 {
// int mkdir(const char *path, mode_t mode);
func Xmkdir(t *TLS, path uintptr, mode types.Mode_t) int32 {
+ if __ccgo_strace {
+ trc("t=%v path=%v mode=%v, (%v:)", t, path, mode, origin(2))
+ }
panic(todo(""))
// if _, _, err := unix.Syscall(unix.SYS_MKDIR, path, uintptr(mode), 0); err != 0 {
// t.setErrno(err)
@@ -280,6 +325,9 @@ func Xmkdir(t *TLS, path uintptr, mode types.Mode_t) int32 {
// int symlink(const char *target, const char *linkpath);
func Xsymlink(t *TLS, target, linkpath uintptr) int32 {
+ if __ccgo_strace {
+ trc("t=%v linkpath=%v, (%v:)", t, linkpath, origin(2))
+ }
panic(todo(""))
// if _, _, err := unix.Syscall(unix.SYS_SYMLINK, target, linkpath, 0); err != 0 {
// t.setErrno(err)
@@ -294,6 +342,9 @@ func Xsymlink(t *TLS, target, linkpath uintptr) int32 {
// int utimes(const char *filename, const struct timeval times[2]);
func Xutimes(t *TLS, filename, times uintptr) int32 {
+ if __ccgo_strace {
+ trc("t=%v times=%v, (%v:)", t, times, origin(2))
+ }
panic(todo(""))
// if _, _, err := unix.Syscall(unix.SYS_UTIMES, filename, times, 0); err != 0 {
// t.setErrno(err)
@@ -308,6 +359,9 @@ func Xutimes(t *TLS, filename, times uintptr) int32 {
// int unlink(const char *pathname);
func Xunlink(t *TLS, pathname uintptr) int32 {
+ if __ccgo_strace {
+ trc("t=%v pathname=%v, (%v:)", t, pathname, origin(2))
+ }
err := syscall.DeleteFile((*uint16)(unsafe.Pointer(pathname)))
if err != nil {
@@ -324,6 +378,9 @@ func Xunlink(t *TLS, pathname uintptr) int32 {
// int access(const char *pathname, int mode);
func Xaccess(t *TLS, pathname uintptr, mode int32) int32 {
+ if __ccgo_strace {
+ trc("t=%v pathname=%v mode=%v, (%v:)", t, pathname, mode, origin(2))
+ }
panic(todo(""))
// if _, _, err := unix.Syscall(unix.SYS_ACCESS, pathname, uintptr(mode), 0); err != 0 {
// if dmesgs {
@@ -341,6 +398,9 @@ func Xaccess(t *TLS, pathname uintptr, mode int32) int32 {
// int rmdir(const char *pathname);
func Xrmdir(t *TLS, pathname uintptr) int32 {
+ if __ccgo_strace {
+ trc("t=%v pathname=%v, (%v:)", t, pathname, origin(2))
+ }
panic(todo(""))
// if _, _, err := unix.Syscall(unix.SYS_RMDIR, pathname, 0, 0); err != 0 {
// t.setErrno(err)
@@ -355,6 +415,9 @@ func Xrmdir(t *TLS, pathname uintptr) int32 {
// int mknod(const char *pathname, mode_t mode, dev_t dev);
func Xmknod(t *TLS, pathname uintptr, mode types.Mode_t, dev types.Dev_t) int32 {
+ if __ccgo_strace {
+ trc("t=%v pathname=%v mode=%v dev=%v, (%v:)", t, pathname, mode, dev, origin(2))
+ }
panic(todo(""))
// if _, _, err := unix.Syscall(unix.SYS_MKNOD, pathname, uintptr(mode), uintptr(dev)); err != 0 {
// t.setErrno(err)
@@ -377,6 +440,9 @@ func Xmknod(t *TLS, pathname uintptr, mode types.Mode_t, dev types.Dev_t) int32
// int link(const char *oldpath, const char *newpath);
func Xlink(t *TLS, oldpath, newpath uintptr) int32 {
+ if __ccgo_strace {
+ trc("t=%v newpath=%v, (%v:)", t, newpath, origin(2))
+ }
panic(todo(""))
// if _, _, err := unix.Syscall(unix.SYS_LINK, oldpath, newpath, 0); err != 0 {
// t.setErrno(err)
@@ -388,6 +454,9 @@ func Xlink(t *TLS, oldpath, newpath uintptr) int32 {
// int pipe(int pipefd[2]);
func Xpipe(t *TLS, pipefd uintptr) int32 {
+ if __ccgo_strace {
+ trc("t=%v pipefd=%v, (%v:)", t, pipefd, origin(2))
+ }
panic(todo(""))
// if _, _, err := unix.Syscall(unix.SYS_PIPE, pipefd, 0, 0); err != 0 {
// t.setErrno(err)
@@ -399,6 +468,9 @@ func Xpipe(t *TLS, pipefd uintptr) int32 {
// int dup2(int oldfd, int newfd);
func Xdup2(t *TLS, oldfd, newfd int32) int32 {
+ if __ccgo_strace {
+ trc("t=%v newfd=%v, (%v:)", t, newfd, origin(2))
+ }
panic(todo(""))
// n, _, err := unix.Syscall(unix.SYS_DUP2, uintptr(oldfd), uintptr(newfd), 0)
// if err != 0 {
@@ -411,6 +483,9 @@ func Xdup2(t *TLS, oldfd, newfd int32) int32 {
// ssize_t readlink(const char *restrict path, char *restrict buf, size_t bufsize);
func Xreadlink(t *TLS, path, buf uintptr, bufsize types.Size_t) types.Ssize_t {
+ if __ccgo_strace {
+ trc("t=%v buf=%v bufsize=%v, (%v:)", t, buf, bufsize, origin(2))
+ }
panic(todo(""))
// n, _, err := unix.Syscall(unix.SYS_READLINK, path, buf, uintptr(bufsize))
// if err != 0 {
@@ -423,6 +498,9 @@ func Xreadlink(t *TLS, path, buf uintptr, bufsize types.Size_t) types.Ssize_t {
// FILE *fopen64(const char *pathname, const char *mode);
func Xfopen64(t *TLS, pathname, mode uintptr) uintptr {
+ if __ccgo_strace {
+ trc("t=%v mode=%v, (%v:)", t, mode, origin(2))
+ }
m := strings.ReplaceAll(GoString(mode), "b", "")
var flags int
@@ -459,42 +537,72 @@ func Xfopen64(t *TLS, pathname, mode uintptr) uintptr {
}
func Xrecv(t *TLS, sockfd uint64, buf uintptr, len, flags int32) int32 {
+ if __ccgo_strace {
+ trc("t=%v sockfd=%v buf=%v flags=%v, (%v:)", t, sockfd, buf, flags, origin(2))
+ }
panic(todo(""))
}
func Xsend(t *TLS, sockfd uint64, buf uintptr, len, flags int32) int32 {
+ if __ccgo_strace {
+ trc("t=%v sockfd=%v buf=%v flags=%v, (%v:)", t, sockfd, buf, flags, origin(2))
+ }
panic(todo(""))
}
func Xshutdown(t *TLS, sockfd uint64, how int32) int32 {
+ if __ccgo_strace {
+ trc("t=%v sockfd=%v how=%v, (%v:)", t, sockfd, how, origin(2))
+ }
panic(todo(""))
}
func Xgetpeername(t *TLS, sockfd uint64, addr uintptr, addrlen uintptr) int32 {
+ if __ccgo_strace {
+ trc("t=%v sockfd=%v addr=%v addrlen=%v, (%v:)", t, sockfd, addr, addrlen, origin(2))
+ }
panic(todo(""))
}
func Xgetsockname(t *TLS, sockfd uint64, addr, addrlen uintptr) int32 {
+ if __ccgo_strace {
+ trc("t=%v sockfd=%v addrlen=%v, (%v:)", t, sockfd, addrlen, origin(2))
+ }
panic(todo(""))
}
func Xsocket(t *TLS, domain, type1, protocol int32) uint64 {
+ if __ccgo_strace {
+ trc("t=%v protocol=%v, (%v:)", t, protocol, origin(2))
+ }
panic(todo(""))
}
func Xbind(t *TLS, sockfd uint64, addr uintptr, addrlen int32) int32 {
+ if __ccgo_strace {
+ trc("t=%v sockfd=%v addr=%v addrlen=%v, (%v:)", t, sockfd, addr, addrlen, origin(2))
+ }
panic(todo(""))
}
func Xconnect(t *TLS, sockfd uint64, addr uintptr, addrlen int32) int32 {
+ if __ccgo_strace {
+ trc("t=%v sockfd=%v addr=%v addrlen=%v, (%v:)", t, sockfd, addr, addrlen, origin(2))
+ }
panic(todo(""))
}
func Xlisten(t *TLS, sockfd uint64, backlog int32) int32 {
+ if __ccgo_strace {
+ trc("t=%v sockfd=%v backlog=%v, (%v:)", t, sockfd, backlog, origin(2))
+ }
panic(todo(""))
}
func Xaccept(t *TLS, sockfd uint64, addr uintptr, addrlen uintptr) uint64 {
+ if __ccgo_strace {
+ trc("t=%v sockfd=%v addr=%v addrlen=%v, (%v:)", t, sockfd, addr, addrlen, origin(2))
+ }
panic(todo(""))
}
diff --git a/vendor/modernc.org/libc/mem.go b/vendor/modernc.org/libc/mem.go
index 50056c75..bdd14b19 100644
--- a/vendor/modernc.org/libc/mem.go
+++ b/vendor/modernc.org/libc/mem.go
@@ -21,6 +21,9 @@ var (
// void *malloc(size_t size);
func Xmalloc(t *TLS, n types.Size_t) uintptr {
+ if __ccgo_strace {
+ trc("t=%v n=%v, (%v:)", t, n, origin(2))
+ }
if n == 0 {
return 0
}
@@ -40,6 +43,9 @@ func Xmalloc(t *TLS, n types.Size_t) uintptr {
// void *calloc(size_t nmemb, size_t size);
func Xcalloc(t *TLS, n, size types.Size_t) uintptr {
+ if __ccgo_strace {
+ trc("t=%v size=%v, (%v:)", t, size, origin(2))
+ }
rq := int(n * size)
if rq == 0 {
return 0
@@ -60,6 +66,9 @@ func Xcalloc(t *TLS, n, size types.Size_t) uintptr {
// void *realloc(void *ptr, size_t size);
func Xrealloc(t *TLS, ptr uintptr, size types.Size_t) uintptr {
+ if __ccgo_strace {
+ trc("t=%v ptr=%v size=%v, (%v:)", t, ptr, size, origin(2))
+ }
allocMu.Lock()
defer allocMu.Unlock()
@@ -75,6 +84,9 @@ func Xrealloc(t *TLS, ptr uintptr, size types.Size_t) uintptr {
// void free(void *ptr);
func Xfree(t *TLS, p uintptr) {
+ if __ccgo_strace {
+ trc("t=%v p=%v, (%v:)", t, p, origin(2))
+ }
if p == 0 {
return
}
@@ -86,6 +98,22 @@ func Xfree(t *TLS, p uintptr) {
allocator.UintptrFree(p)
}
+func Xmalloc_usable_size(tls *TLS, p uintptr) (r types.Size_t) {
+ if __ccgo_strace {
+ trc("tls=%v p=%v, (%v:)", tls, p, origin(2))
+ defer func() { trc("-> %v", r) }()
+ }
+ if p == 0 {
+ return 0
+ }
+
+ allocMu.Lock()
+
+ defer allocMu.Unlock()
+
+ return types.Size_t(memory.UintptrUsableSize(p))
+}
+
func UsableSize(p uintptr) types.Size_t {
allocMu.Lock()
diff --git a/vendor/modernc.org/libc/mem_brk.go b/vendor/modernc.org/libc/mem_brk.go
index 00f35043..7b3c2ea5 100644
--- a/vendor/modernc.org/libc/mem_brk.go
+++ b/vendor/modernc.org/libc/mem_brk.go
@@ -32,6 +32,9 @@ var (
// void *malloc(size_t size);
func Xmalloc(t *TLS, n types.Size_t) uintptr {
+ if __ccgo_strace {
+ trc("t=%v n=%v, (%v:)", t, n, origin(2))
+ }
if n == 0 {
return 0
}
@@ -54,11 +57,17 @@ func Xmalloc(t *TLS, n types.Size_t) uintptr {
// void *calloc(size_t nmemb, size_t size);
func Xcalloc(t *TLS, n, size types.Size_t) uintptr {
+ if __ccgo_strace {
+ trc("t=%v size=%v, (%v:)", t, size, origin(2))
+ }
return Xmalloc(t, n*size)
}
// void *realloc(void *ptr, size_t size);
func Xrealloc(t *TLS, ptr uintptr, size types.Size_t) uintptr {
+ if __ccgo_strace {
+ trc("t=%v ptr=%v size=%v, (%v:)", t, ptr, size, origin(2))
+ }
switch {
case ptr != 0 && size != 0:
p := Xmalloc(t, size)
@@ -74,7 +83,12 @@ func Xrealloc(t *TLS, ptr uintptr, size types.Size_t) uintptr {
}
// void free(void *ptr);
-func Xfree(t *TLS, p uintptr) {}
+
+func Xfree(t *TLS, p uintptr) {
+ if __ccgo_strace {
+ trc("t=%v p=%v, (%v:)", t, p, origin(2))
+ }
+}
func UsableSize(p uintptr) types.Size_t {
return types.Size_t(*(*uintptr)(unsafe.Pointer(p - uintptrSize)))
diff --git a/vendor/modernc.org/libc/memgrind.go b/vendor/modernc.org/libc/memgrind.go
index 70044c07..ead9c49d 100644
--- a/vendor/modernc.org/libc/memgrind.go
+++ b/vendor/modernc.org/libc/memgrind.go
@@ -74,6 +74,9 @@ func pc2origin(pc uintptr) string {
// void *malloc(size_t size);
func Xmalloc(t *TLS, size types.Size_t) uintptr {
+ if __ccgo_strace {
+ trc("t=%v size=%v, (%v:)", t, size, origin(2))
+ }
if size == 0 {
return 0
}
@@ -83,9 +86,9 @@ func Xmalloc(t *TLS, size types.Size_t) uintptr {
defer allocMu.Unlock()
p, err := allocator.UintptrCalloc(int(size))
- if dmesgs {
- dmesg("%v: %v -> %#x, %v", origin(1), size, p, err)
- }
+ // if dmesgs {
+ // dmesg("%v: %v -> %#x, %v", origin(1), size, p, err)
+ // }
if err != nil {
t.setErrno(errno.ENOMEM)
return 0
@@ -110,6 +113,9 @@ func Xmalloc(t *TLS, size types.Size_t) uintptr {
// void *calloc(size_t nmemb, size_t size);
func Xcalloc(t *TLS, n, size types.Size_t) uintptr {
+ if __ccgo_strace {
+ trc("t=%v size=%v, (%v:)", t, size, origin(2))
+ }
rq := int(n * size)
if rq == 0 {
return 0
@@ -120,9 +126,9 @@ func Xcalloc(t *TLS, n, size types.Size_t) uintptr {
defer allocMu.Unlock()
p, err := allocator.UintptrCalloc(int(n * size))
- if dmesgs {
- dmesg("%v: %v -> %#x, %v", origin(1), n*size, p, err)
- }
+ // if dmesgs {
+ // dmesg("%v: %v -> %#x, %v", origin(1), n*size, p, err)
+ // }
if err != nil {
t.setErrno(errno.ENOMEM)
return 0
@@ -147,6 +153,9 @@ func Xcalloc(t *TLS, n, size types.Size_t) uintptr {
// void *realloc(void *ptr, size_t size);
func Xrealloc(t *TLS, ptr uintptr, size types.Size_t) uintptr {
+ if __ccgo_strace {
+ trc("t=%v ptr=%v size=%v, (%v:)", t, ptr, size, origin(2))
+ }
allocMu.Lock()
defer allocMu.Unlock()
@@ -176,9 +185,9 @@ func Xrealloc(t *TLS, ptr uintptr, size types.Size_t) uintptr {
}
p, err := allocator.UintptrRealloc(ptr, int(size))
- if dmesgs {
- dmesg("%v: %#x, %v -> %#x, %v", origin(1), ptr, size, p, err)
- }
+ // if dmesgs {
+ // dmesg("%v: %#x, %v -> %#x, %v", origin(1), ptr, size, p, err)
+ // }
if err != nil {
t.setErrno(errno.ENOMEM)
return 0
@@ -198,13 +207,16 @@ func Xrealloc(t *TLS, ptr uintptr, size types.Size_t) uintptr {
// void free(void *ptr);
func Xfree(t *TLS, p uintptr) {
+ if __ccgo_strace {
+ trc("t=%v p=%v, (%v:)", t, p, origin(2))
+ }
if p == 0 {
return
}
- if dmesgs {
- dmesg("%v: %#x", origin(1), p)
- }
+ // if dmesgs {
+ // dmesg("%v: %#x", origin(1), p)
+ // }
allocMu.Lock()
diff --git a/vendor/modernc.org/libc/musl_darwin_amd64.go b/vendor/modernc.org/libc/musl_darwin_amd64.go
index 350e8def..e0333fa3 100644
--- a/vendor/modernc.org/libc/musl_darwin_amd64.go
+++ b/vendor/modernc.org/libc/musl_darwin_amd64.go
@@ -459,6 +459,9 @@ type _RuneLocale = struct {
} /* table.c:1616:3 */
func X__istype(tls *TLS, _c int32, _f uint64) int32 { /* table.c:1670:1: */
+ if __ccgo_strace {
+ trc("tls=%v _c=%v _f=%v, (%v:)", tls, _c, _f, origin(2))
+ }
return func() int32 {
if Xisascii(tls, _c) != 0 {
@@ -470,6 +473,9 @@ func X__istype(tls *TLS, _c int32, _f uint64) int32 { /* table.c:1670:1: */
}
func X__isctype(tls *TLS, _c int32, _f uint64) int32 { /* table.c:1681:1: */
+ if __ccgo_strace {
+ trc("tls=%v _c=%v _f=%v, (%v:)", tls, _c, _f, origin(2))
+ }
if _c < 0 || _c >= int32(1)<<8 {
return 0
@@ -479,6 +485,9 @@ func X__isctype(tls *TLS, _c int32, _f uint64) int32 { /* table.c:1681:1: */
}
func X__wcwidth(tls *TLS, _c int32) int32 { /* table.c:1700:1: */
+ if __ccgo_strace {
+ trc("tls=%v _c=%v, (%v:)", tls, _c, origin(2))
+ }
var _x uint32
if _c == 0 {
@@ -497,90 +506,156 @@ func X__wcwidth(tls *TLS, _c int32) int32 { /* table.c:1700:1: */
}
func Xisalnum(tls *TLS, _c int32) int32 { /* table.c:1718:1: */
+ if __ccgo_strace {
+ trc("tls=%v _c=%v, (%v:)", tls, _c, origin(2))
+ }
return X__istype(tls, _c, uint64(0x00000100|0x00000400))
}
func Xisalpha(tls *TLS, _c int32) int32 { /* table.c:1724:1: */
+ if __ccgo_strace {
+ trc("tls=%v _c=%v, (%v:)", tls, _c, origin(2))
+ }
return X__istype(tls, _c, uint64(0x00000100))
}
func Xisblank(tls *TLS, _c int32) int32 { /* table.c:1730:1: */
+ if __ccgo_strace {
+ trc("tls=%v _c=%v, (%v:)", tls, _c, origin(2))
+ }
return X__istype(tls, _c, uint64(0x00020000))
}
func Xiscntrl(tls *TLS, _c int32) int32 { /* table.c:1736:1: */
+ if __ccgo_strace {
+ trc("tls=%v _c=%v, (%v:)", tls, _c, origin(2))
+ }
return X__istype(tls, _c, uint64(0x00000200))
}
func Xisdigit(tls *TLS, _c int32) int32 { /* table.c:1743:1: */
+ if __ccgo_strace {
+ trc("tls=%v _c=%v, (%v:)", tls, _c, origin(2))
+ }
return X__isctype(tls, _c, uint64(0x00000400))
}
func Xisgraph(tls *TLS, _c int32) int32 { /* table.c:1749:1: */
+ if __ccgo_strace {
+ trc("tls=%v _c=%v, (%v:)", tls, _c, origin(2))
+ }
return X__istype(tls, _c, uint64(0x00000800))
}
func Xislower(tls *TLS, _c int32) int32 { /* table.c:1755:1: */
+ if __ccgo_strace {
+ trc("tls=%v _c=%v, (%v:)", tls, _c, origin(2))
+ }
return X__istype(tls, _c, uint64(0x00001000))
}
func Xisprint(tls *TLS, _c int32) int32 { /* table.c:1761:1: */
+ if __ccgo_strace {
+ trc("tls=%v _c=%v, (%v:)", tls, _c, origin(2))
+ }
return X__istype(tls, _c, uint64(0x00040000))
}
func Xispunct(tls *TLS, _c int32) int32 { /* table.c:1767:1: */
+ if __ccgo_strace {
+ trc("tls=%v _c=%v, (%v:)", tls, _c, origin(2))
+ }
return X__istype(tls, _c, uint64(0x00002000))
}
func Xisupper(tls *TLS, _c int32) int32 { /* table.c:1779:1: */
+ if __ccgo_strace {
+ trc("tls=%v _c=%v, (%v:)", tls, _c, origin(2))
+ }
return X__istype(tls, _c, uint64(0x00008000))
}
func Xisxdigit(tls *TLS, _c int32) int32 { /* table.c:1786:1: */
+ if __ccgo_strace {
+ trc("tls=%v _c=%v, (%v:)", tls, _c, origin(2))
+ }
return X__isctype(tls, _c, uint64(0x00010000))
}
func Xtoascii(tls *TLS, _c int32) int32 { /* table.c:1792:1: */
+ if __ccgo_strace {
+ trc("tls=%v _c=%v, (%v:)", tls, _c, origin(2))
+ }
return _c & 0x7F
}
func Xdigittoint(tls *TLS, _c int32) int32 { /* table.c:1811:1: */
+ if __ccgo_strace {
+ trc("tls=%v _c=%v, (%v:)", tls, _c, origin(2))
+ }
return X__maskrune(tls, _c, uint64(0x0F))
}
func Xishexnumber(tls *TLS, _c int32) int32 { /* table.c:1817:1: */
+ if __ccgo_strace {
+ trc("tls=%v _c=%v, (%v:)", tls, _c, origin(2))
+ }
return X__istype(tls, _c, uint64(0x00010000))
}
func Xisideogram(tls *TLS, _c int32) int32 { /* table.c:1823:1: */
+ if __ccgo_strace {
+ trc("tls=%v _c=%v, (%v:)", tls, _c, origin(2))
+ }
return X__istype(tls, _c, uint64(0x00080000))
}
func Xisnumber(tls *TLS, _c int32) int32 { /* table.c:1829:1: */
+ if __ccgo_strace {
+ trc("tls=%v _c=%v, (%v:)", tls, _c, origin(2))
+ }
return X__istype(tls, _c, uint64(0x00000400))
}
func Xisphonogram(tls *TLS, _c int32) int32 { /* table.c:1835:1: */
+ if __ccgo_strace {
+ trc("tls=%v _c=%v, (%v:)", tls, _c, origin(2))
+ }
return X__istype(tls, _c, uint64(0x00200000))
}
func Xisrune(tls *TLS, _c int32) int32 { /* table.c:1841:1: */
+ if __ccgo_strace {
+ trc("tls=%v _c=%v, (%v:)", tls, _c, origin(2))
+ }
return X__istype(tls, _c, uint64(0xFFFFFFF0))
}
func Xisspecial(tls *TLS, _c int32) int32 { /* table.c:1847:1: */
+ if __ccgo_strace {
+ trc("tls=%v _c=%v, (%v:)", tls, _c, origin(2))
+ }
return X__istype(tls, _c, uint64(0x00100000))
}
func X__maskrune(tls *TLS, _c int32, _f uint64) int32 { /* table.c:1871:2: */
+ if __ccgo_strace {
+ trc("tls=%v _c=%v _f=%v, (%v:)", tls, _c, _f, origin(2))
+ }
return int32(uint32(int32(*(*uint32)(unsafe.Pointer(uintptr(unsafe.Pointer(&X_DefaultRuneLocale)) + 60 + uintptr(_c&0xff)*4)))) & uint32(_f))
}
func X__toupper(tls *TLS, c int32) int32 { /* table.c:1876:20: */
+ if __ccgo_strace {
+ trc("tls=%v c=%v, (%v:)", tls, c, origin(2))
+ }
return Xtoupper(tls, c)
}
func X__tolower(tls *TLS, c int32) int32 { /* table.c:1878:20: */
+ if __ccgo_strace {
+ trc("tls=%v c=%v, (%v:)", tls, c, origin(2))
+ }
return Xtolower(tls, c)
}
@@ -670,6 +745,9 @@ type gid_t = uint32 /* alltypes.h:250:18 */
type useconds_t = uint32 /* alltypes.h:260:18 */
func X__putenv(tls *TLS, s uintptr, l size_t, r uintptr) int32 { /* putenv.c:8:5: */
+ if __ccgo_strace {
+ trc("tls=%v s=%v l=%v r=%v, (%v:)", tls, s, l, r, origin(2))
+ }
var i size_t
var newenv uintptr
var tmp uintptr
@@ -750,6 +828,9 @@ oom:
var _soldenv uintptr /* putenv.c:22:14: */
func Xputenv(tls *TLS, s uintptr) int32 { /* putenv.c:43:5: */
+ if __ccgo_strace {
+ trc("tls=%v s=%v, (%v:)", tls, s, origin(2))
+ }
var l size_t = size_t((int64(X__strchrnul(tls, s, '=')) - int64(s)) / 1)
if !(l != 0) || !(int32(*(*int8)(unsafe.Pointer(s + uintptr(l)))) != 0) {
return Xunsetenv(tls, s)
@@ -758,6 +839,9 @@ func Xputenv(tls *TLS, s uintptr) int32 { /* putenv.c:43:5: */
}
func X__env_rm_add(tls *TLS, old uintptr, new uintptr) { /* setenv.c:5:6: */
+ if __ccgo_strace {
+ trc("tls=%v old=%v new=%v, (%v:)", tls, old, new, origin(2))
+ }
//TODO for (size_t i=0; i < env_alloced_n; i++)
var i size_t = uint64(0)
for ; i < _senv_alloced_n; i++ {
@@ -784,6 +868,9 @@ var _senv_alloced uintptr /* setenv.c:7:14: */
var _senv_alloced_n size_t /* setenv.c:8:16: */
func Xsetenv(tls *TLS, var1 uintptr, value uintptr, overwrite int32) int32 { /* setenv.c:26:5: */
+ if __ccgo_strace {
+ trc("tls=%v var1=%v value=%v overwrite=%v, (%v:)", tls, var1, value, overwrite, origin(2))
+ }
var s uintptr
var l1 size_t
var l2 size_t
@@ -808,6 +895,9 @@ func Xsetenv(tls *TLS, var1 uintptr, value uintptr, overwrite int32) int32 { /*
}
func Xunsetenv(tls *TLS, name uintptr) int32 { /* unsetenv.c:9:5: */
+ if __ccgo_strace {
+ trc("tls=%v name=%v, (%v:)", tls, name, origin(2))
+ }
var l size_t = size_t((int64(X__strchrnul(tls, name, '=')) - int64(name)) / 1)
if !(l != 0) || *(*int8)(unsafe.Pointer(name + uintptr(l))) != 0 {
*(*int32)(unsafe.Pointer(X___errno_location(tls))) = 22
@@ -1549,6 +1639,9 @@ func hexfloat(tls *TLS, f uintptr, bits int32, emin int32, sign int32, pok int32
}
func X__floatscan(tls *TLS, f uintptr, prec int32, pok int32) float64 { /* floatscan.c:427:13: */
+ if __ccgo_strace {
+ trc("tls=%v f=%v prec=%v pok=%v, (%v:)", tls, f, prec, pok, origin(2))
+ }
var sign int32 = 1
var i size_t
var bits int32
@@ -1726,6 +1819,9 @@ var table = [257]uint8{Uint8FromInt32(-1),
} /* intscan.c:7:28 */
func X__intscan(tls *TLS, f uintptr, base uint32, pok int32, lim uint64) uint64 { /* intscan.c:26:20: */
+ if __ccgo_strace {
+ trc("tls=%v f=%v base=%v pok=%v lim=%v, (%v:)", tls, f, base, pok, lim, origin(2))
+ }
var val uintptr
var c int32
var neg int32
@@ -2031,6 +2127,9 @@ __43:
// the actual count.
func X__shlim(tls *TLS, f uintptr, lim off_t) { /* shgetc.c:8:6: */
+ if __ccgo_strace {
+ trc("tls=%v f=%v lim=%v, (%v:)", tls, f, lim, origin(2))
+ }
(*FILE)(unsafe.Pointer(f)).Fshlim = lim
(*FILE)(unsafe.Pointer(f)).Fshcnt = (int64((*FILE)(unsafe.Pointer(f)).Fbuf) - int64((*FILE)(unsafe.Pointer(f)).Frpos)) / 1
// If lim is nonzero, rend must be a valid pointer.
@@ -2042,6 +2141,9 @@ func X__shlim(tls *TLS, f uintptr, lim off_t) { /* shgetc.c:8:6: */
}
func X__shgetc(tls *TLS, f uintptr) int32 { /* shgetc.c:19:5: */
+ if __ccgo_strace {
+ trc("tls=%v f=%v, (%v:)", tls, f, origin(2))
+ }
var c int32
var cnt off_t = (*FILE)(unsafe.Pointer(f)).Fshcnt + (int64((*FILE)(unsafe.Pointer(f)).Frpos)-int64((*FILE)(unsafe.Pointer(f)).Fbuf))/1
if (*FILE)(unsafe.Pointer(f)).Fshlim != 0 && cnt >= (*FILE)(unsafe.Pointer(f)).Fshlim || AssignInt32(&c, X__uflow(tls, f)) < 0 {
@@ -2103,10 +2205,16 @@ type lconv = struct {
var posix_lconv = lconv{Fdecimal_point: ts + 23, Fthousands_sep: ts + 13, Fgrouping: ts + 13, Fint_curr_symbol: ts + 13, Fcurrency_symbol: ts + 13, Fmon_decimal_point: ts + 13, Fmon_thousands_sep: ts + 13, Fmon_grouping: ts + 13, Fpositive_sign: ts + 13, Fnegative_sign: ts + 13, Fint_frac_digits: Int8FromInt32(255), Ffrac_digits: Int8FromInt32(255), Fp_cs_precedes: Int8FromInt32(255), Fp_sep_by_space: Int8FromInt32(255), Fn_cs_precedes: Int8FromInt32(255), Fn_sep_by_space: Int8FromInt32(255), Fp_sign_posn: Int8FromInt32(255), Fn_sign_posn: Int8FromInt32(255), Fint_p_cs_precedes: Int8FromInt32(255), Fint_p_sep_by_space: Int8FromInt32(255), Fint_n_cs_precedes: Int8FromInt32(255), Fint_n_sep_by_space: Int8FromInt32(255), Fint_p_sign_posn: Int8FromInt32(255), Fint_n_sign_posn: Int8FromInt32(255)} /* localeconv.c:4:27 */
func Xlocaleconv(tls *TLS) uintptr { /* localeconv.c:31:14: */
+ if __ccgo_strace {
+ trc("tls=%v, (%v:)", tls, origin(2))
+ }
return uintptr(unsafe.Pointer(&posix_lconv))
}
func X__fpclassify(tls *TLS, x float64) int32 { /* __fpclassify.c:4:5: */
+ if __ccgo_strace {
+ trc("tls=%v x=%v, (%v:)", tls, x, origin(2))
+ }
bp := tls.Alloc(8)
defer tls.Free(8)
@@ -2131,6 +2239,9 @@ func X__fpclassify(tls *TLS, x float64) int32 { /* __fpclassify.c:4:5: */
}
func X__fpclassifyf(tls *TLS, x float32) int32 { /* __fpclassifyf.c:4:5: */
+ if __ccgo_strace {
+ trc("tls=%v x=%v, (%v:)", tls, x, origin(2))
+ }
bp := tls.Alloc(4)
defer tls.Free(4)
@@ -2159,28 +2270,46 @@ func __bswap32(tls *TLS, __x uint32_t) uint32_t { /* endian.h:24:26: */
}
func X__fpclassifyl(tls *TLS, x float64) int32 { /* __fpclassifyl.c:4:5: */
+ if __ccgo_strace {
+ trc("tls=%v x=%v, (%v:)", tls, x, origin(2))
+ }
return X__fpclassify(tls, x)
}
func Xcopysignl(tls *TLS, x float64, y float64) float64 { /* copysignl.c:4:13: */
+ if __ccgo_strace {
+ trc("tls=%v x=%v y=%v, (%v:)", tls, x, y, origin(2))
+ }
return Xcopysign(tls, x, y)
}
func Xfabsl(tls *TLS, x float64) float64 { /* fabsl.c:3:13: */
+ if __ccgo_strace {
+ trc("tls=%v x=%v, (%v:)", tls, x, origin(2))
+ }
return Xfabs(tls, x)
}
func Xfmodl(tls *TLS, x float64, y float64) float64 { /* fmodl.c:4:13: */
+ if __ccgo_strace {
+ trc("tls=%v x=%v y=%v, (%v:)", tls, x, y, origin(2))
+ }
return Xfmod(tls, x, y)
}
func Xnanf(tls *TLS, s uintptr) float32 { /* nanf.c:3:7: */
+ if __ccgo_strace {
+ trc("tls=%v s=%v, (%v:)", tls, s, origin(2))
+ }
return X__builtin_nanf(tls, ts+13)
}
var toint double_t = float64(float64(1)) / 2.22044604925031308085e-16 /* rint.c:10:23 */
func Xrint(tls *TLS, x float64) float64 { /* rint.c:12:8: */
+ if __ccgo_strace {
+ trc("tls=%v x=%v, (%v:)", tls, x, origin(2))
+ }
bp := tls.Alloc(8)
defer tls.Free(8)
@@ -2210,6 +2339,9 @@ func Xrint(tls *TLS, x float64) float64 { /* rint.c:12:8: */
}
func Xscalbn(tls *TLS, x float64, n int32) float64 { /* scalbn.c:4:8: */
+ if __ccgo_strace {
+ trc("tls=%v x=%v n=%v, (%v:)", tls, x, n, origin(2))
+ }
bp := tls.Alloc(8)
defer tls.Free(8)
@@ -2246,6 +2378,9 @@ func Xscalbn(tls *TLS, x float64, n int32) float64 { /* scalbn.c:4:8: */
}
func Xscalbnl(tls *TLS, x float64, n int32) float64 { /* scalbnl.c:4:13: */
+ if __ccgo_strace {
+ trc("tls=%v x=%v n=%v, (%v:)", tls, x, n, origin(2))
+ }
return Xscalbn(tls, x, n)
}
@@ -2558,6 +2693,9 @@ type resolvconf = struct {
} /* lookup.h:34:1 */
func Xfreeaddrinfo(tls *TLS, p uintptr) { /* freeaddrinfo.c:7:6: */
+ if __ccgo_strace {
+ trc("tls=%v p=%v, (%v:)", tls, p, origin(2))
+ }
var cnt size_t
cnt = uint64(1)
__1:
@@ -2693,6 +2831,9 @@ type __ptcb = struct {
} /* pthread.h:206:1 */
func Xgetaddrinfo(tls *TLS, host uintptr, serv uintptr, hint uintptr, res uintptr) int32 { /* getaddrinfo.c:12:5: */
+ if __ccgo_strace {
+ trc("tls=%v host=%v serv=%v hint=%v res=%v, (%v:)", tls, host, serv, hint, res, origin(2))
+ }
bp := tls.Alloc(1608)
defer tls.Free(1608)
@@ -2897,6 +3038,9 @@ type mmsghdr = struct {
} /* socket.h:63:1 */
func Xgethostbyaddr(tls *TLS, a uintptr, l socklen_t, af int32) uintptr { /* gethostbyaddr.c:7:16: */
+ if __ccgo_strace {
+ trc("tls=%v a=%v l=%v af=%v, (%v:)", tls, a, l, af, origin(2))
+ }
bp := tls.Alloc(8)
defer tls.Free(8)
@@ -2923,6 +3067,9 @@ func Xgethostbyaddr(tls *TLS, a uintptr, l socklen_t, af int32) uintptr { /* get
var _sh uintptr /* gethostbyaddr.c:9:24: */
func Xgethostbyaddr_r(tls *TLS, a uintptr, l socklen_t, af int32, h uintptr, buf uintptr, buflen size_t, res uintptr, err uintptr) int32 { /* gethostbyaddr_r.c:10:5: */
+ if __ccgo_strace {
+ trc("tls=%v a=%v l=%v af=%v h=%v buf=%v buflen=%v res=%v err=%v, (%v:)", tls, a, l, af, h, buf, buflen, res, err, origin(2))
+ }
bp := tls.Alloc(28)
defer tls.Free(28)
@@ -3008,10 +3155,16 @@ func Xgethostbyaddr_r(tls *TLS, a uintptr, l socklen_t, af int32, h uintptr, buf
}
func Xgethostbyname(tls *TLS, name uintptr) uintptr { /* gethostbyname.c:8:16: */
+ if __ccgo_strace {
+ trc("tls=%v name=%v, (%v:)", tls, name, origin(2))
+ }
return Xgethostbyname2(tls, name, 2)
}
func Xgethostbyname2(tls *TLS, name uintptr, af int32) uintptr { /* gethostbyname2.c:8:16: */
+ if __ccgo_strace {
+ trc("tls=%v name=%v af=%v, (%v:)", tls, name, af, origin(2))
+ }
bp := tls.Alloc(8)
defer tls.Free(8)
@@ -3038,6 +3191,9 @@ func Xgethostbyname2(tls *TLS, name uintptr, af int32) uintptr { /* gethostbynam
var _sh1 uintptr /* gethostbyname2.c:10:24: */
func Xgethostbyname2_r(tls *TLS, name uintptr, af int32, h uintptr, buf uintptr, buflen size_t, res uintptr, err uintptr) int32 { /* gethostbyname2_r.c:11:5: */
+ if __ccgo_strace {
+ trc("tls=%v name=%v af=%v h=%v buf=%v buflen=%v res=%v err=%v, (%v:)", tls, name, af, h, buf, buflen, res, err, origin(2))
+ }
bp := tls.Alloc(1600)
defer tls.Free(1600)
@@ -3424,6 +3580,9 @@ func reverse_services(tls *TLS, buf uintptr, port int32, dgram int32) { /* getna
}
func Xgetnameinfo(tls *TLS, sa1 uintptr, sl socklen_t, node uintptr, nodelen socklen_t, serv uintptr, servlen socklen_t, flags int32) int32 { /* getnameinfo.c:125:5: */
+ if __ccgo_strace {
+ trc("tls=%v sa1=%v sl=%v node=%v nodelen=%v serv=%v servlen=%v flags=%v, (%v:)", tls, sa1, sl, node, nodelen, serv, servlen, flags, origin(2))
+ }
bp := tls.Alloc(347)
defer tls.Free(347)
@@ -3524,10 +3683,16 @@ func Xgetnameinfo(tls *TLS, sa1 uintptr, sl socklen_t, node uintptr, nodelen soc
var Xh_errno int32 /* h_errno.c:4:5: */
func X__h_errno_location(tls *TLS) uintptr { /* h_errno.c:6:5: */
+ if __ccgo_strace {
+ trc("tls=%v, (%v:)", tls, origin(2))
+ }
return uintptr(unsafe.Pointer(&Xh_errno))
}
func X__inet_aton(tls *TLS, s0 uintptr, dest uintptr) int32 { /* inet_aton.c:7:5: */
+ if __ccgo_strace {
+ trc("tls=%v s0=%v dest=%v, (%v:)", tls, s0, dest, origin(2))
+ }
bp := tls.Alloc(40)
defer tls.Free(40)
@@ -3579,6 +3744,9 @@ func X__inet_aton(tls *TLS, s0 uintptr, dest uintptr) int32 { /* inet_aton.c:7:5
}
func Xinet_ntop(tls *TLS, af int32, a0 uintptr, s uintptr, l socklen_t) uintptr { /* inet_ntop.c:7:12: */
+ if __ccgo_strace {
+ trc("tls=%v af=%v a0=%v s=%v l=%v, (%v:)", tls, af, a0, s, l, origin(2))
+ }
bp := tls.Alloc(276)
defer tls.Free(276)
@@ -3653,6 +3821,9 @@ func hexval(tls *TLS, c uint32) int32 { /* inet_pton.c:7:12: */
}
func Xinet_pton(tls *TLS, af int32, s uintptr, a0 uintptr) int32 { /* inet_pton.c:15:5: */
+ if __ccgo_strace {
+ trc("tls=%v af=%v s=%v a0=%v, (%v:)", tls, af, s, a0, origin(2))
+ }
bp := tls.Alloc(16)
defer tls.Free(16)
@@ -3750,6 +3921,9 @@ func Xinet_pton(tls *TLS, af int32, s uintptr, a0 uintptr) int32 { /* inet_pton.
}
func X__lookup_ipliteral(tls *TLS, buf uintptr, name uintptr, family int32) int32 { /* lookup_ipliteral.c:12:5: */
+ if __ccgo_strace {
+ trc("tls=%v buf=%v name=%v family=%v, (%v:)", tls, buf, name, family, origin(2))
+ }
bp := tls.Alloc(96)
defer tls.Free(96)
@@ -4072,6 +4246,9 @@ func addrcmp(tls *TLS, _a uintptr, _b uintptr) int32 { /* lookup_name.c:305:12:
}
func X__lookup_name(tls *TLS, buf uintptr, canon uintptr, name uintptr, family int32, flags int32) int32 { /* lookup_name.c:311:5: */
+ if __ccgo_strace {
+ trc("tls=%v buf=%v canon=%v name=%v family=%v flags=%v, (%v:)", tls, buf, canon, name, family, flags, origin(2))
+ }
bp := tls.Alloc(92)
defer tls.Free(92)
@@ -4238,6 +4415,9 @@ func X__lookup_name(tls *TLS, buf uintptr, canon uintptr, name uintptr, family i
}
func X__lookup_serv(tls *TLS, buf uintptr, name uintptr, proto int32, socktype int32, flags int32) int32 { /* lookup_serv.c:12:5: */
+ if __ccgo_strace {
+ trc("tls=%v buf=%v name=%v proto=%v socktype=%v flags=%v, (%v:)", tls, buf, name, proto, socktype, flags, origin(2))
+ }
bp := tls.Alloc(8)
defer tls.Free(8)
@@ -4371,10 +4551,16 @@ func temper(tls *TLS, x uint32) uint32 { /* rand_r.c:3:17: */
}
func Xrand_r(tls *TLS, seed uintptr) int32 { /* rand_r.c:12:5: */
+ if __ccgo_strace {
+ trc("tls=%v seed=%v, (%v:)", tls, seed, origin(2))
+ }
return int32(temper(tls, AssignPtrUint32(seed, *(*uint32)(unsafe.Pointer(seed))*uint32(1103515245)+uint32(12345))) / uint32(2))
}
func X__toread(tls *TLS, f uintptr) int32 { /* __toread.c:3:5: */
+ if __ccgo_strace {
+ trc("tls=%v f=%v, (%v:)", tls, f, origin(2))
+ }
*(*int32)(unsafe.Pointer(f + 136)) |= (*FILE)(unsafe.Pointer(f)).Fmode - 1
if (*FILE)(unsafe.Pointer(f)).Fwpos != (*FILE)(unsafe.Pointer(f)).Fwbase {
(*struct {
@@ -4394,6 +4580,9 @@ func X__toread(tls *TLS, f uintptr) int32 { /* __toread.c:3:5: */
}
func X__toread_needs_stdio_exit(tls *TLS) { /* __toread.c:16:13: */
+ if __ccgo_strace {
+ trc("tls=%v, (%v:)", tls, origin(2))
+ }
X__builtin_abort(tls) //TODO-
// __stdio_exit_needed();
}
@@ -4402,6 +4591,9 @@ func X__toread_needs_stdio_exit(tls *TLS) { /* __toread.c:16:13: */
// data buffered for reading.
func X__uflow(tls *TLS, f uintptr) int32 { /* __uflow.c:6:5: */
+ if __ccgo_strace {
+ trc("tls=%v f=%v, (%v:)", tls, f, origin(2))
+ }
bp := tls.Alloc(1)
defer tls.Free(1)
@@ -4416,6 +4608,9 @@ func X__uflow(tls *TLS, f uintptr) int32 { /* __uflow.c:6:5: */
}
func Xbsearch(tls *TLS, key uintptr, base uintptr, nel size_t, width size_t, cmp uintptr) uintptr { /* bsearch.c:3:6: */
+ if __ccgo_strace {
+ trc("tls=%v key=%v base=%v nel=%v width=%v cmp=%v, (%v:)", tls, key, base, nel, width, cmp, origin(2))
+ }
var try uintptr
var sign int32
for nel > uint64(0) {
@@ -4458,14 +4653,23 @@ func strtox(tls *TLS, s uintptr, p uintptr, prec int32) float64 { /* strtod.c:6:
}
func Xstrtof(tls *TLS, s uintptr, p uintptr) float32 { /* strtod.c:17:7: */
+ if __ccgo_strace {
+ trc("tls=%v s=%v p=%v, (%v:)", tls, s, p, origin(2))
+ }
return float32(strtox(tls, s, p, 0))
}
func Xstrtod(tls *TLS, s uintptr, p uintptr) float64 { /* strtod.c:22:8: */
+ if __ccgo_strace {
+ trc("tls=%v s=%v p=%v, (%v:)", tls, s, p, origin(2))
+ }
return strtox(tls, s, p, 1)
}
func Xstrtold(tls *TLS, s uintptr, p uintptr) float64 { /* strtod.c:27:13: */
+ if __ccgo_strace {
+ trc("tls=%v s=%v p=%v, (%v:)", tls, s, p, origin(2))
+ }
return strtox(tls, s, p, 2)
}
@@ -4487,26 +4691,44 @@ func strtox1(tls *TLS, s uintptr, p uintptr, base int32, lim uint64) uint64 { /*
}
func Xstrtoull(tls *TLS, s uintptr, p uintptr, base int32) uint64 { /* strtol.c:21:20: */
+ if __ccgo_strace {
+ trc("tls=%v s=%v p=%v base=%v, (%v:)", tls, s, p, base, origin(2))
+ }
return strtox1(tls, s, p, base, 2*uint64(0x7fffffffffffffff)+uint64(1))
}
func Xstrtoll(tls *TLS, s uintptr, p uintptr, base int32) int64 { /* strtol.c:26:11: */
+ if __ccgo_strace {
+ trc("tls=%v s=%v p=%v base=%v, (%v:)", tls, s, p, base, origin(2))
+ }
return int64(strtox1(tls, s, p, base, Uint64FromInt64(-0x7fffffffffffffff-int64(1))))
}
func Xstrtoul(tls *TLS, s uintptr, p uintptr, base int32) uint64 { /* strtol.c:31:15: */
+ if __ccgo_strace {
+ trc("tls=%v s=%v p=%v base=%v, (%v:)", tls, s, p, base, origin(2))
+ }
return uint64(strtox1(tls, s, p, base, 2*uint64(0x7fffffffffffffff)+uint64(1)))
}
func Xstrtol(tls *TLS, s uintptr, p uintptr, base int32) int64 { /* strtol.c:36:6: */
+ if __ccgo_strace {
+ trc("tls=%v s=%v p=%v base=%v, (%v:)", tls, s, p, base, origin(2))
+ }
return int64(strtox1(tls, s, p, base, 0+Uint64FromInt64(Int64(-Int64(0x7fffffffffffffff))-Int64FromInt32(1))))
}
func Xstrtoimax(tls *TLS, s uintptr, p uintptr, base int32) intmax_t { /* strtol.c:41:10: */
+ if __ccgo_strace {
+ trc("tls=%v s=%v p=%v base=%v, (%v:)", tls, s, p, base, origin(2))
+ }
return intmax_t(Xstrtoll(tls, s, p, base))
}
func Xstrtoumax(tls *TLS, s uintptr, p uintptr, base int32) uintmax_t { /* strtol.c:46:11: */
+ if __ccgo_strace {
+ trc("tls=%v s=%v p=%v base=%v, (%v:)", tls, s, p, base, origin(2))
+ }
return uintmax_t(Xstrtoull(tls, s, p, base))
}
@@ -4520,6 +4742,9 @@ func Xstrtoumax(tls *TLS, s uintptr, p uintptr, base int32) uintmax_t { /* strto
// from SUS and have nothing to do with the host system.
func X__strchrnul(tls *TLS, s uintptr, c int32) uintptr { /* strchrnul.c:10:6: */
+ if __ccgo_strace {
+ trc("tls=%v s=%v c=%v, (%v:)", tls, s, c, origin(2))
+ }
c = int32(uint8(c))
if !(c != 0) {
return s + uintptr(Xstrlen(tls, s))
@@ -4540,6 +4765,9 @@ func X__strchrnul(tls *TLS, s uintptr, c int32) uintptr { /* strchrnul.c:10:6: *
}
func Xstrdup(tls *TLS, s uintptr) uintptr { /* strdup.c:4:6: */
+ if __ccgo_strace {
+ trc("tls=%v s=%v, (%v:)", tls, s, origin(2))
+ }
var l size_t = Xstrlen(tls, s)
var d uintptr = Xmalloc(tls, l+uint64(1))
if !(d != 0) {
@@ -4549,6 +4777,9 @@ func Xstrdup(tls *TLS, s uintptr) uintptr { /* strdup.c:4:6: */
}
func Xstrlcat(tls *TLS, d uintptr, s uintptr, n size_t) size_t { /* strlcat.c:4:8: */
+ if __ccgo_strace {
+ trc("tls=%v d=%v s=%v n=%v, (%v:)", tls, d, s, n, origin(2))
+ }
var l size_t = Xstrnlen(tls, d, n)
if l == n {
return l + Xstrlen(tls, s)
@@ -4566,6 +4797,9 @@ func Xstrlcat(tls *TLS, d uintptr, s uintptr, n size_t) size_t { /* strlcat.c:4:
// from SUS and have nothing to do with the host system.
func Xstrlcpy(tls *TLS, d uintptr, s uintptr, n size_t) size_t { /* strlcpy.c:11:8: */
+ if __ccgo_strace {
+ trc("tls=%v d=%v s=%v n=%v, (%v:)", tls, d, s, n, origin(2))
+ }
var d0 uintptr
var wd uintptr
var ws uintptr
@@ -4637,6 +4871,9 @@ finish:
}
func Xstrncasecmp(tls *TLS, _l uintptr, _r uintptr, n size_t) int32 { /* strncasecmp.c:4:5: */
+ if __ccgo_strace {
+ trc("tls=%v _l=%v _r=%v n=%v, (%v:)", tls, _l, _r, n, origin(2))
+ }
var l uintptr = _l
var r uintptr = _r
if !(int32(PostDecUint64(&n, 1)) != 0) {
@@ -4659,10 +4896,16 @@ __3:
}
func X__strncasecmp_l(tls *TLS, l uintptr, r uintptr, n size_t, loc locale_t) int32 { /* strncasecmp.c:12:5: */
+ if __ccgo_strace {
+ trc("tls=%v l=%v r=%v n=%v loc=%v, (%v:)", tls, l, r, n, loc, origin(2))
+ }
return Xstrncasecmp(tls, l, r, n)
}
func Xstrncat(tls *TLS, d uintptr, s uintptr, n size_t) uintptr { /* strncat.c:3:6: */
+ if __ccgo_strace {
+ trc("tls=%v d=%v s=%v n=%v, (%v:)", tls, d, s, n, origin(2))
+ }
var a uintptr = d
d += uintptr(Xstrlen(tls, d))
for n != 0 && *(*int8)(unsafe.Pointer(s)) != 0 {
@@ -4674,6 +4917,9 @@ func Xstrncat(tls *TLS, d uintptr, s uintptr, n size_t) uintptr { /* strncat.c:3
}
func Xstrnlen(tls *TLS, s uintptr, n size_t) size_t { /* strnlen.c:3:8: */
+ if __ccgo_strace {
+ trc("tls=%v s=%v n=%v, (%v:)", tls, s, n, origin(2))
+ }
var p uintptr = Xmemchr(tls, s, 0, n)
if p != 0 {
return uint64((int64(p) - int64(s)) / 1)
@@ -4682,6 +4928,9 @@ func Xstrnlen(tls *TLS, s uintptr, n size_t) size_t { /* strnlen.c:3:8: */
}
func Xstrspn(tls *TLS, s uintptr, c uintptr) size_t { /* strspn.c:6:8: */
+ if __ccgo_strace {
+ trc("tls=%v s=%v c=%v, (%v:)", tls, s, c, origin(2))
+ }
bp := tls.Alloc(32)
defer tls.Free(32)
@@ -4705,6 +4954,9 @@ func Xstrspn(tls *TLS, s uintptr, c uintptr) size_t { /* strspn.c:6:8: */
}
func Xstrtok(tls *TLS, s uintptr, sep uintptr) uintptr { /* strtok.c:3:6: */
+ if __ccgo_strace {
+ trc("tls=%v s=%v sep=%v, (%v:)", tls, s, sep, origin(2))
+ }
if !(s != 0) && !(int32(AssignUintptr(&s, _sp)) != 0) {
return uintptr(0)
}
diff --git a/vendor/modernc.org/libc/musl_darwin_arm64.go b/vendor/modernc.org/libc/musl_darwin_arm64.go
index e6fc642a..65b8c536 100644
--- a/vendor/modernc.org/libc/musl_darwin_arm64.go
+++ b/vendor/modernc.org/libc/musl_darwin_arm64.go
@@ -459,6 +459,9 @@ type _RuneLocale = struct {
} /* table.c:1616:3 */
func X__istype(tls *TLS, _c int32, _f uint64) int32 { /* table.c:1670:1: */
+ if __ccgo_strace {
+ trc("tls=%v _c=%v _f=%v, (%v:)", tls, _c, _f, origin(2))
+ }
return func() int32 {
if Xisascii(tls, _c) != 0 {
@@ -470,6 +473,9 @@ func X__istype(tls *TLS, _c int32, _f uint64) int32 { /* table.c:1670:1: */
}
func X__isctype(tls *TLS, _c int32, _f uint64) int32 { /* table.c:1681:1: */
+ if __ccgo_strace {
+ trc("tls=%v _c=%v _f=%v, (%v:)", tls, _c, _f, origin(2))
+ }
if _c < 0 || _c >= int32(1)<<8 {
return 0
@@ -479,6 +485,9 @@ func X__isctype(tls *TLS, _c int32, _f uint64) int32 { /* table.c:1681:1: */
}
func X__wcwidth(tls *TLS, _c int32) int32 { /* table.c:1700:1: */
+ if __ccgo_strace {
+ trc("tls=%v _c=%v, (%v:)", tls, _c, origin(2))
+ }
var _x uint32
if _c == 0 {
@@ -497,90 +506,156 @@ func X__wcwidth(tls *TLS, _c int32) int32 { /* table.c:1700:1: */
}
func Xisalnum(tls *TLS, _c int32) int32 { /* table.c:1718:1: */
+ if __ccgo_strace {
+ trc("tls=%v _c=%v, (%v:)", tls, _c, origin(2))
+ }
return X__istype(tls, _c, uint64(0x00000100|0x00000400))
}
func Xisalpha(tls *TLS, _c int32) int32 { /* table.c:1724:1: */
+ if __ccgo_strace {
+ trc("tls=%v _c=%v, (%v:)", tls, _c, origin(2))
+ }
return X__istype(tls, _c, uint64(0x00000100))
}
func Xisblank(tls *TLS, _c int32) int32 { /* table.c:1730:1: */
+ if __ccgo_strace {
+ trc("tls=%v _c=%v, (%v:)", tls, _c, origin(2))
+ }
return X__istype(tls, _c, uint64(0x00020000))
}
func Xiscntrl(tls *TLS, _c int32) int32 { /* table.c:1736:1: */
+ if __ccgo_strace {
+ trc("tls=%v _c=%v, (%v:)", tls, _c, origin(2))
+ }
return X__istype(tls, _c, uint64(0x00000200))
}
func Xisdigit(tls *TLS, _c int32) int32 { /* table.c:1743:1: */
+ if __ccgo_strace {
+ trc("tls=%v _c=%v, (%v:)", tls, _c, origin(2))
+ }
return X__isctype(tls, _c, uint64(0x00000400))
}
func Xisgraph(tls *TLS, _c int32) int32 { /* table.c:1749:1: */
+ if __ccgo_strace {
+ trc("tls=%v _c=%v, (%v:)", tls, _c, origin(2))
+ }
return X__istype(tls, _c, uint64(0x00000800))
}
func Xislower(tls *TLS, _c int32) int32 { /* table.c:1755:1: */
+ if __ccgo_strace {
+ trc("tls=%v _c=%v, (%v:)", tls, _c, origin(2))
+ }
return X__istype(tls, _c, uint64(0x00001000))
}
func Xisprint(tls *TLS, _c int32) int32 { /* table.c:1761:1: */
+ if __ccgo_strace {
+ trc("tls=%v _c=%v, (%v:)", tls, _c, origin(2))
+ }
return X__istype(tls, _c, uint64(0x00040000))
}
func Xispunct(tls *TLS, _c int32) int32 { /* table.c:1767:1: */
+ if __ccgo_strace {
+ trc("tls=%v _c=%v, (%v:)", tls, _c, origin(2))
+ }
return X__istype(tls, _c, uint64(0x00002000))
}
func Xisupper(tls *TLS, _c int32) int32 { /* table.c:1779:1: */
+ if __ccgo_strace {
+ trc("tls=%v _c=%v, (%v:)", tls, _c, origin(2))
+ }
return X__istype(tls, _c, uint64(0x00008000))
}
func Xisxdigit(tls *TLS, _c int32) int32 { /* table.c:1786:1: */
+ if __ccgo_strace {
+ trc("tls=%v _c=%v, (%v:)", tls, _c, origin(2))
+ }
return X__isctype(tls, _c, uint64(0x00010000))
}
func Xtoascii(tls *TLS, _c int32) int32 { /* table.c:1792:1: */
+ if __ccgo_strace {
+ trc("tls=%v _c=%v, (%v:)", tls, _c, origin(2))
+ }
return _c & 0x7F
}
func Xdigittoint(tls *TLS, _c int32) int32 { /* table.c:1811:1: */
+ if __ccgo_strace {
+ trc("tls=%v _c=%v, (%v:)", tls, _c, origin(2))
+ }
return X__maskrune(tls, _c, uint64(0x0F))
}
func Xishexnumber(tls *TLS, _c int32) int32 { /* table.c:1817:1: */
+ if __ccgo_strace {
+ trc("tls=%v _c=%v, (%v:)", tls, _c, origin(2))
+ }
return X__istype(tls, _c, uint64(0x00010000))
}
func Xisideogram(tls *TLS, _c int32) int32 { /* table.c:1823:1: */
+ if __ccgo_strace {
+ trc("tls=%v _c=%v, (%v:)", tls, _c, origin(2))
+ }
return X__istype(tls, _c, uint64(0x00080000))
}
func Xisnumber(tls *TLS, _c int32) int32 { /* table.c:1829:1: */
+ if __ccgo_strace {
+ trc("tls=%v _c=%v, (%v:)", tls, _c, origin(2))
+ }
return X__istype(tls, _c, uint64(0x00000400))
}
func Xisphonogram(tls *TLS, _c int32) int32 { /* table.c:1835:1: */
+ if __ccgo_strace {
+ trc("tls=%v _c=%v, (%v:)", tls, _c, origin(2))
+ }
return X__istype(tls, _c, uint64(0x00200000))
}
func Xisrune(tls *TLS, _c int32) int32 { /* table.c:1841:1: */
+ if __ccgo_strace {
+ trc("tls=%v _c=%v, (%v:)", tls, _c, origin(2))
+ }
return X__istype(tls, _c, uint64(0xFFFFFFF0))
}
func Xisspecial(tls *TLS, _c int32) int32 { /* table.c:1847:1: */
+ if __ccgo_strace {
+ trc("tls=%v _c=%v, (%v:)", tls, _c, origin(2))
+ }
return X__istype(tls, _c, uint64(0x00100000))
}
func X__maskrune(tls *TLS, _c int32, _f uint64) int32 { /* table.c:1871:2: */
+ if __ccgo_strace {
+ trc("tls=%v _c=%v _f=%v, (%v:)", tls, _c, _f, origin(2))
+ }
return int32(uint32(int32(*(*uint32)(unsafe.Pointer(uintptr(unsafe.Pointer(&X_DefaultRuneLocale)) + 60 + uintptr(_c&0xff)*4)))) & uint32(_f))
}
func X__toupper(tls *TLS, c int32) int32 { /* table.c:1876:20: */
+ if __ccgo_strace {
+ trc("tls=%v c=%v, (%v:)", tls, c, origin(2))
+ }
return Xtoupper(tls, c)
}
func X__tolower(tls *TLS, c int32) int32 { /* table.c:1878:20: */
+ if __ccgo_strace {
+ trc("tls=%v c=%v, (%v:)", tls, c, origin(2))
+ }
return Xtolower(tls, c)
}
@@ -670,6 +745,9 @@ type gid_t = uint32 /* alltypes.h:258:18 */
type useconds_t = uint32 /* alltypes.h:268:18 */
func X__putenv(tls *TLS, s uintptr, l size_t, r uintptr) int32 { /* putenv.c:8:5: */
+ if __ccgo_strace {
+ trc("tls=%v s=%v l=%v r=%v, (%v:)", tls, s, l, r, origin(2))
+ }
var i size_t
var newenv uintptr
var tmp uintptr
@@ -750,6 +828,9 @@ oom:
var _soldenv uintptr /* putenv.c:22:14: */
func Xputenv(tls *TLS, s uintptr) int32 { /* putenv.c:43:5: */
+ if __ccgo_strace {
+ trc("tls=%v s=%v, (%v:)", tls, s, origin(2))
+ }
var l size_t = size_t((int64(X__strchrnul(tls, s, '=')) - int64(s)) / 1)
if !(l != 0) || !(int32(*(*int8)(unsafe.Pointer(s + uintptr(l)))) != 0) {
return Xunsetenv(tls, s)
@@ -758,6 +839,9 @@ func Xputenv(tls *TLS, s uintptr) int32 { /* putenv.c:43:5: */
}
func X__env_rm_add(tls *TLS, old uintptr, new uintptr) { /* setenv.c:5:6: */
+ if __ccgo_strace {
+ trc("tls=%v old=%v new=%v, (%v:)", tls, old, new, origin(2))
+ }
//TODO for (size_t i=0; i < env_alloced_n; i++)
var i size_t = uint64(0)
for ; i < _senv_alloced_n; i++ {
@@ -784,6 +868,9 @@ var _senv_alloced uintptr /* setenv.c:7:14: */
var _senv_alloced_n size_t /* setenv.c:8:16: */
func Xsetenv(tls *TLS, var1 uintptr, value uintptr, overwrite int32) int32 { /* setenv.c:26:5: */
+ if __ccgo_strace {
+ trc("tls=%v var1=%v value=%v overwrite=%v, (%v:)", tls, var1, value, overwrite, origin(2))
+ }
var s uintptr
var l1 size_t
var l2 size_t
@@ -808,6 +895,9 @@ func Xsetenv(tls *TLS, var1 uintptr, value uintptr, overwrite int32) int32 { /*
}
func Xunsetenv(tls *TLS, name uintptr) int32 { /* unsetenv.c:9:5: */
+ if __ccgo_strace {
+ trc("tls=%v name=%v, (%v:)", tls, name, origin(2))
+ }
var l size_t = size_t((int64(X__strchrnul(tls, name, '=')) - int64(name)) / 1)
if !(l != 0) || *(*int8)(unsafe.Pointer(name + uintptr(l))) != 0 {
*(*int32)(unsafe.Pointer(X___errno_location(tls))) = 22
@@ -1549,6 +1639,9 @@ func hexfloat(tls *TLS, f uintptr, bits int32, emin int32, sign int32, pok int32
}
func X__floatscan(tls *TLS, f uintptr, prec int32, pok int32) float64 { /* floatscan.c:427:13: */
+ if __ccgo_strace {
+ trc("tls=%v f=%v prec=%v pok=%v, (%v:)", tls, f, prec, pok, origin(2))
+ }
var sign int32 = 1
var i size_t
var bits int32
@@ -1726,6 +1819,9 @@ var table = [257]uint8{Uint8FromInt32(-1),
} /* intscan.c:7:28 */
func X__intscan(tls *TLS, f uintptr, base uint32, pok int32, lim uint64) uint64 { /* intscan.c:26:20: */
+ if __ccgo_strace {
+ trc("tls=%v f=%v base=%v pok=%v lim=%v, (%v:)", tls, f, base, pok, lim, origin(2))
+ }
var val uintptr
var c int32
var neg int32
@@ -2031,6 +2127,9 @@ __43:
// the actual count.
func X__shlim(tls *TLS, f uintptr, lim off_t) { /* shgetc.c:8:6: */
+ if __ccgo_strace {
+ trc("tls=%v f=%v lim=%v, (%v:)", tls, f, lim, origin(2))
+ }
(*FILE)(unsafe.Pointer(f)).Fshlim = lim
(*FILE)(unsafe.Pointer(f)).Fshcnt = (int64((*FILE)(unsafe.Pointer(f)).Fbuf) - int64((*FILE)(unsafe.Pointer(f)).Frpos)) / 1
// If lim is nonzero, rend must be a valid pointer.
@@ -2042,6 +2141,9 @@ func X__shlim(tls *TLS, f uintptr, lim off_t) { /* shgetc.c:8:6: */
}
func X__shgetc(tls *TLS, f uintptr) int32 { /* shgetc.c:19:5: */
+ if __ccgo_strace {
+ trc("tls=%v f=%v, (%v:)", tls, f, origin(2))
+ }
var c int32
var cnt off_t = (*FILE)(unsafe.Pointer(f)).Fshcnt + (int64((*FILE)(unsafe.Pointer(f)).Frpos)-int64((*FILE)(unsafe.Pointer(f)).Fbuf))/1
if (*FILE)(unsafe.Pointer(f)).Fshlim != 0 && cnt >= (*FILE)(unsafe.Pointer(f)).Fshlim || AssignInt32(&c, X__uflow(tls, f)) < 0 {
@@ -2103,10 +2205,16 @@ type lconv = struct {
var posix_lconv = lconv{Fdecimal_point: ts + 23, Fthousands_sep: ts + 13, Fgrouping: ts + 13, Fint_curr_symbol: ts + 13, Fcurrency_symbol: ts + 13, Fmon_decimal_point: ts + 13, Fmon_thousands_sep: ts + 13, Fmon_grouping: ts + 13, Fpositive_sign: ts + 13, Fnegative_sign: ts + 13, Fint_frac_digits: Int8FromInt32(255), Ffrac_digits: Int8FromInt32(255), Fp_cs_precedes: Int8FromInt32(255), Fp_sep_by_space: Int8FromInt32(255), Fn_cs_precedes: Int8FromInt32(255), Fn_sep_by_space: Int8FromInt32(255), Fp_sign_posn: Int8FromInt32(255), Fn_sign_posn: Int8FromInt32(255), Fint_p_cs_precedes: Int8FromInt32(255), Fint_p_sep_by_space: Int8FromInt32(255), Fint_n_cs_precedes: Int8FromInt32(255), Fint_n_sep_by_space: Int8FromInt32(255), Fint_p_sign_posn: Int8FromInt32(255), Fint_n_sign_posn: Int8FromInt32(255)} /* localeconv.c:4:27 */
func Xlocaleconv(tls *TLS) uintptr { /* localeconv.c:31:14: */
+ if __ccgo_strace {
+ trc("tls=%v, (%v:)", tls, origin(2))
+ }
return uintptr(unsafe.Pointer(&posix_lconv))
}
func X__fpclassify(tls *TLS, x float64) int32 { /* __fpclassify.c:4:5: */
+ if __ccgo_strace {
+ trc("tls=%v x=%v, (%v:)", tls, x, origin(2))
+ }
bp := tls.Alloc(8)
defer tls.Free(8)
@@ -2131,6 +2239,9 @@ func X__fpclassify(tls *TLS, x float64) int32 { /* __fpclassify.c:4:5: */
}
func X__fpclassifyf(tls *TLS, x float32) int32 { /* __fpclassifyf.c:4:5: */
+ if __ccgo_strace {
+ trc("tls=%v x=%v, (%v:)", tls, x, origin(2))
+ }
bp := tls.Alloc(4)
defer tls.Free(4)
@@ -2159,28 +2270,46 @@ func __bswap32(tls *TLS, __x uint32_t) uint32_t { /* endian.h:24:26: */
}
func X__fpclassifyl(tls *TLS, x float64) int32 { /* __fpclassifyl.c:4:5: */
+ if __ccgo_strace {
+ trc("tls=%v x=%v, (%v:)", tls, x, origin(2))
+ }
return X__fpclassify(tls, x)
}
func Xcopysignl(tls *TLS, x float64, y float64) float64 { /* copysignl.c:4:13: */
+ if __ccgo_strace {
+ trc("tls=%v x=%v y=%v, (%v:)", tls, x, y, origin(2))
+ }
return Xcopysign(tls, x, y)
}
func Xfabsl(tls *TLS, x float64) float64 { /* fabsl.c:3:13: */
+ if __ccgo_strace {
+ trc("tls=%v x=%v, (%v:)", tls, x, origin(2))
+ }
return Xfabs(tls, x)
}
func Xfmodl(tls *TLS, x float64, y float64) float64 { /* fmodl.c:4:13: */
+ if __ccgo_strace {
+ trc("tls=%v x=%v y=%v, (%v:)", tls, x, y, origin(2))
+ }
return Xfmod(tls, x, y)
}
func Xnanf(tls *TLS, s uintptr) float32 { /* nanf.c:3:7: */
+ if __ccgo_strace {
+ trc("tls=%v s=%v, (%v:)", tls, s, origin(2))
+ }
return X__builtin_nanf(tls, ts+13)
}
var toint double_t = float64(float64(1)) / 2.22044604925031308085e-16 /* rint.c:10:23 */
func Xrint(tls *TLS, x float64) float64 { /* rint.c:12:8: */
+ if __ccgo_strace {
+ trc("tls=%v x=%v, (%v:)", tls, x, origin(2))
+ }
bp := tls.Alloc(8)
defer tls.Free(8)
@@ -2210,6 +2339,9 @@ func Xrint(tls *TLS, x float64) float64 { /* rint.c:12:8: */
}
func Xscalbn(tls *TLS, x float64, n int32) float64 { /* scalbn.c:4:8: */
+ if __ccgo_strace {
+ trc("tls=%v x=%v n=%v, (%v:)", tls, x, n, origin(2))
+ }
bp := tls.Alloc(8)
defer tls.Free(8)
@@ -2246,6 +2378,9 @@ func Xscalbn(tls *TLS, x float64, n int32) float64 { /* scalbn.c:4:8: */
}
func Xscalbnl(tls *TLS, x float64, n int32) float64 { /* scalbnl.c:4:13: */
+ if __ccgo_strace {
+ trc("tls=%v x=%v n=%v, (%v:)", tls, x, n, origin(2))
+ }
return Xscalbn(tls, x, n)
}
@@ -2558,6 +2693,9 @@ type resolvconf = struct {
} /* lookup.h:34:1 */
func Xfreeaddrinfo(tls *TLS, p uintptr) { /* freeaddrinfo.c:7:6: */
+ if __ccgo_strace {
+ trc("tls=%v p=%v, (%v:)", tls, p, origin(2))
+ }
var cnt size_t
cnt = uint64(1)
__1:
@@ -2693,6 +2831,9 @@ type __ptcb = struct {
} /* pthread.h:206:1 */
func Xgetaddrinfo(tls *TLS, host uintptr, serv uintptr, hint uintptr, res uintptr) int32 { /* getaddrinfo.c:12:5: */
+ if __ccgo_strace {
+ trc("tls=%v host=%v serv=%v hint=%v res=%v, (%v:)", tls, host, serv, hint, res, origin(2))
+ }
bp := tls.Alloc(1608)
defer tls.Free(1608)
@@ -2897,6 +3038,9 @@ type mmsghdr = struct {
} /* socket.h:63:1 */
func Xgethostbyaddr(tls *TLS, a uintptr, l socklen_t, af int32) uintptr { /* gethostbyaddr.c:7:16: */
+ if __ccgo_strace {
+ trc("tls=%v a=%v l=%v af=%v, (%v:)", tls, a, l, af, origin(2))
+ }
bp := tls.Alloc(8)
defer tls.Free(8)
@@ -2923,6 +3067,9 @@ func Xgethostbyaddr(tls *TLS, a uintptr, l socklen_t, af int32) uintptr { /* get
var _sh uintptr /* gethostbyaddr.c:9:24: */
func Xgethostbyaddr_r(tls *TLS, a uintptr, l socklen_t, af int32, h uintptr, buf uintptr, buflen size_t, res uintptr, err uintptr) int32 { /* gethostbyaddr_r.c:10:5: */
+ if __ccgo_strace {
+ trc("tls=%v a=%v l=%v af=%v h=%v buf=%v buflen=%v res=%v err=%v, (%v:)", tls, a, l, af, h, buf, buflen, res, err, origin(2))
+ }
bp := tls.Alloc(28)
defer tls.Free(28)
@@ -3008,10 +3155,16 @@ func Xgethostbyaddr_r(tls *TLS, a uintptr, l socklen_t, af int32, h uintptr, buf
}
func Xgethostbyname(tls *TLS, name uintptr) uintptr { /* gethostbyname.c:8:16: */
+ if __ccgo_strace {
+ trc("tls=%v name=%v, (%v:)", tls, name, origin(2))
+ }
return Xgethostbyname2(tls, name, 2)
}
func Xgethostbyname2(tls *TLS, name uintptr, af int32) uintptr { /* gethostbyname2.c:8:16: */
+ if __ccgo_strace {
+ trc("tls=%v name=%v af=%v, (%v:)", tls, name, af, origin(2))
+ }
bp := tls.Alloc(8)
defer tls.Free(8)
@@ -3038,6 +3191,9 @@ func Xgethostbyname2(tls *TLS, name uintptr, af int32) uintptr { /* gethostbynam
var _sh1 uintptr /* gethostbyname2.c:10:24: */
func Xgethostbyname2_r(tls *TLS, name uintptr, af int32, h uintptr, buf uintptr, buflen size_t, res uintptr, err uintptr) int32 { /* gethostbyname2_r.c:11:5: */
+ if __ccgo_strace {
+ trc("tls=%v name=%v af=%v h=%v buf=%v buflen=%v res=%v err=%v, (%v:)", tls, name, af, h, buf, buflen, res, err, origin(2))
+ }
bp := tls.Alloc(1600)
defer tls.Free(1600)
@@ -3424,6 +3580,9 @@ func reverse_services(tls *TLS, buf uintptr, port int32, dgram int32) { /* getna
}
func Xgetnameinfo(tls *TLS, sa1 uintptr, sl socklen_t, node uintptr, nodelen socklen_t, serv uintptr, servlen socklen_t, flags int32) int32 { /* getnameinfo.c:125:5: */
+ if __ccgo_strace {
+ trc("tls=%v sa1=%v sl=%v node=%v nodelen=%v serv=%v servlen=%v flags=%v, (%v:)", tls, sa1, sl, node, nodelen, serv, servlen, flags, origin(2))
+ }
bp := tls.Alloc(347)
defer tls.Free(347)
@@ -3524,10 +3683,16 @@ func Xgetnameinfo(tls *TLS, sa1 uintptr, sl socklen_t, node uintptr, nodelen soc
var Xh_errno int32 /* h_errno.c:4:5: */
func X__h_errno_location(tls *TLS) uintptr { /* h_errno.c:6:5: */
+ if __ccgo_strace {
+ trc("tls=%v, (%v:)", tls, origin(2))
+ }
return uintptr(unsafe.Pointer(&Xh_errno))
}
func X__inet_aton(tls *TLS, s0 uintptr, dest uintptr) int32 { /* inet_aton.c:7:5: */
+ if __ccgo_strace {
+ trc("tls=%v s0=%v dest=%v, (%v:)", tls, s0, dest, origin(2))
+ }
bp := tls.Alloc(40)
defer tls.Free(40)
@@ -3579,6 +3744,9 @@ func X__inet_aton(tls *TLS, s0 uintptr, dest uintptr) int32 { /* inet_aton.c:7:5
}
func Xinet_ntop(tls *TLS, af int32, a0 uintptr, s uintptr, l socklen_t) uintptr { /* inet_ntop.c:7:12: */
+ if __ccgo_strace {
+ trc("tls=%v af=%v a0=%v s=%v l=%v, (%v:)", tls, af, a0, s, l, origin(2))
+ }
bp := tls.Alloc(276)
defer tls.Free(276)
@@ -3653,6 +3821,9 @@ func hexval(tls *TLS, c uint32) int32 { /* inet_pton.c:7:12: */
}
func Xinet_pton(tls *TLS, af int32, s uintptr, a0 uintptr) int32 { /* inet_pton.c:15:5: */
+ if __ccgo_strace {
+ trc("tls=%v af=%v s=%v a0=%v, (%v:)", tls, af, s, a0, origin(2))
+ }
bp := tls.Alloc(16)
defer tls.Free(16)
@@ -3750,6 +3921,9 @@ func Xinet_pton(tls *TLS, af int32, s uintptr, a0 uintptr) int32 { /* inet_pton.
}
func X__lookup_ipliteral(tls *TLS, buf uintptr, name uintptr, family int32) int32 { /* lookup_ipliteral.c:12:5: */
+ if __ccgo_strace {
+ trc("tls=%v buf=%v name=%v family=%v, (%v:)", tls, buf, name, family, origin(2))
+ }
bp := tls.Alloc(96)
defer tls.Free(96)
@@ -4072,6 +4246,9 @@ func addrcmp(tls *TLS, _a uintptr, _b uintptr) int32 { /* lookup_name.c:305:12:
}
func X__lookup_name(tls *TLS, buf uintptr, canon uintptr, name uintptr, family int32, flags int32) int32 { /* lookup_name.c:311:5: */
+ if __ccgo_strace {
+ trc("tls=%v buf=%v canon=%v name=%v family=%v flags=%v, (%v:)", tls, buf, canon, name, family, flags, origin(2))
+ }
bp := tls.Alloc(92)
defer tls.Free(92)
@@ -4238,6 +4415,9 @@ func X__lookup_name(tls *TLS, buf uintptr, canon uintptr, name uintptr, family i
}
func X__lookup_serv(tls *TLS, buf uintptr, name uintptr, proto int32, socktype int32, flags int32) int32 { /* lookup_serv.c:12:5: */
+ if __ccgo_strace {
+ trc("tls=%v buf=%v name=%v proto=%v socktype=%v flags=%v, (%v:)", tls, buf, name, proto, socktype, flags, origin(2))
+ }
bp := tls.Alloc(8)
defer tls.Free(8)
@@ -4371,10 +4551,16 @@ func temper(tls *TLS, x uint32) uint32 { /* rand_r.c:3:17: */
}
func Xrand_r(tls *TLS, seed uintptr) int32 { /* rand_r.c:12:5: */
+ if __ccgo_strace {
+ trc("tls=%v seed=%v, (%v:)", tls, seed, origin(2))
+ }
return int32(temper(tls, AssignPtrUint32(seed, *(*uint32)(unsafe.Pointer(seed))*uint32(1103515245)+uint32(12345))) / uint32(2))
}
func X__toread(tls *TLS, f uintptr) int32 { /* __toread.c:3:5: */
+ if __ccgo_strace {
+ trc("tls=%v f=%v, (%v:)", tls, f, origin(2))
+ }
*(*int32)(unsafe.Pointer(f + 136)) |= (*FILE)(unsafe.Pointer(f)).Fmode - 1
if (*FILE)(unsafe.Pointer(f)).Fwpos != (*FILE)(unsafe.Pointer(f)).Fwbase {
(*struct {
@@ -4394,6 +4580,9 @@ func X__toread(tls *TLS, f uintptr) int32 { /* __toread.c:3:5: */
}
func X__toread_needs_stdio_exit(tls *TLS) { /* __toread.c:16:13: */
+ if __ccgo_strace {
+ trc("tls=%v, (%v:)", tls, origin(2))
+ }
X__builtin_abort(tls) //TODO-
// __stdio_exit_needed();
}
@@ -4402,6 +4591,9 @@ func X__toread_needs_stdio_exit(tls *TLS) { /* __toread.c:16:13: */
// data buffered for reading.
func X__uflow(tls *TLS, f uintptr) int32 { /* __uflow.c:6:5: */
+ if __ccgo_strace {
+ trc("tls=%v f=%v, (%v:)", tls, f, origin(2))
+ }
bp := tls.Alloc(1)
defer tls.Free(1)
@@ -4416,6 +4608,9 @@ func X__uflow(tls *TLS, f uintptr) int32 { /* __uflow.c:6:5: */
}
func Xbsearch(tls *TLS, key uintptr, base uintptr, nel size_t, width size_t, cmp uintptr) uintptr { /* bsearch.c:3:6: */
+ if __ccgo_strace {
+ trc("tls=%v key=%v base=%v nel=%v width=%v cmp=%v, (%v:)", tls, key, base, nel, width, cmp, origin(2))
+ }
var try uintptr
var sign int32
for nel > uint64(0) {
@@ -4458,14 +4653,23 @@ func strtox(tls *TLS, s uintptr, p uintptr, prec int32) float64 { /* strtod.c:6:
}
func Xstrtof(tls *TLS, s uintptr, p uintptr) float32 { /* strtod.c:17:7: */
+ if __ccgo_strace {
+ trc("tls=%v s=%v p=%v, (%v:)", tls, s, p, origin(2))
+ }
return float32(strtox(tls, s, p, 0))
}
func Xstrtod(tls *TLS, s uintptr, p uintptr) float64 { /* strtod.c:22:8: */
+ if __ccgo_strace {
+ trc("tls=%v s=%v p=%v, (%v:)", tls, s, p, origin(2))
+ }
return strtox(tls, s, p, 1)
}
func Xstrtold(tls *TLS, s uintptr, p uintptr) float64 { /* strtod.c:27:13: */
+ if __ccgo_strace {
+ trc("tls=%v s=%v p=%v, (%v:)", tls, s, p, origin(2))
+ }
return strtox(tls, s, p, 2)
}
@@ -4487,26 +4691,44 @@ func strtox1(tls *TLS, s uintptr, p uintptr, base int32, lim uint64) uint64 { /*
}
func Xstrtoull(tls *TLS, s uintptr, p uintptr, base int32) uint64 { /* strtol.c:21:20: */
+ if __ccgo_strace {
+ trc("tls=%v s=%v p=%v base=%v, (%v:)", tls, s, p, base, origin(2))
+ }
return strtox1(tls, s, p, base, 2*uint64(0x7fffffffffffffff)+uint64(1))
}
func Xstrtoll(tls *TLS, s uintptr, p uintptr, base int32) int64 { /* strtol.c:26:11: */
+ if __ccgo_strace {
+ trc("tls=%v s=%v p=%v base=%v, (%v:)", tls, s, p, base, origin(2))
+ }
return int64(strtox1(tls, s, p, base, Uint64FromInt64(-0x7fffffffffffffff-int64(1))))
}
func Xstrtoul(tls *TLS, s uintptr, p uintptr, base int32) uint64 { /* strtol.c:31:15: */
+ if __ccgo_strace {
+ trc("tls=%v s=%v p=%v base=%v, (%v:)", tls, s, p, base, origin(2))
+ }
return uint64(strtox1(tls, s, p, base, 2*uint64(0x7fffffffffffffff)+uint64(1)))
}
func Xstrtol(tls *TLS, s uintptr, p uintptr, base int32) int64 { /* strtol.c:36:6: */
+ if __ccgo_strace {
+ trc("tls=%v s=%v p=%v base=%v, (%v:)", tls, s, p, base, origin(2))
+ }
return int64(strtox1(tls, s, p, base, 0+Uint64FromInt64(Int64(-Int64(0x7fffffffffffffff))-Int64FromInt32(1))))
}
func Xstrtoimax(tls *TLS, s uintptr, p uintptr, base int32) intmax_t { /* strtol.c:41:10: */
+ if __ccgo_strace {
+ trc("tls=%v s=%v p=%v base=%v, (%v:)", tls, s, p, base, origin(2))
+ }
return intmax_t(Xstrtoll(tls, s, p, base))
}
func Xstrtoumax(tls *TLS, s uintptr, p uintptr, base int32) uintmax_t { /* strtol.c:46:11: */
+ if __ccgo_strace {
+ trc("tls=%v s=%v p=%v base=%v, (%v:)", tls, s, p, base, origin(2))
+ }
return uintmax_t(Xstrtoull(tls, s, p, base))
}
@@ -4520,6 +4742,9 @@ func Xstrtoumax(tls *TLS, s uintptr, p uintptr, base int32) uintmax_t { /* strto
// from SUS and have nothing to do with the host system.
func X__strchrnul(tls *TLS, s uintptr, c int32) uintptr { /* strchrnul.c:10:6: */
+ if __ccgo_strace {
+ trc("tls=%v s=%v c=%v, (%v:)", tls, s, c, origin(2))
+ }
c = int32(uint8(c))
if !(c != 0) {
return s + uintptr(Xstrlen(tls, s))
@@ -4540,6 +4765,9 @@ func X__strchrnul(tls *TLS, s uintptr, c int32) uintptr { /* strchrnul.c:10:6: *
}
func Xstrdup(tls *TLS, s uintptr) uintptr { /* strdup.c:4:6: */
+ if __ccgo_strace {
+ trc("tls=%v s=%v, (%v:)", tls, s, origin(2))
+ }
var l size_t = Xstrlen(tls, s)
var d uintptr = Xmalloc(tls, l+uint64(1))
if !(d != 0) {
@@ -4549,6 +4777,9 @@ func Xstrdup(tls *TLS, s uintptr) uintptr { /* strdup.c:4:6: */
}
func Xstrlcat(tls *TLS, d uintptr, s uintptr, n size_t) size_t { /* strlcat.c:4:8: */
+ if __ccgo_strace {
+ trc("tls=%v d=%v s=%v n=%v, (%v:)", tls, d, s, n, origin(2))
+ }
var l size_t = Xstrnlen(tls, d, n)
if l == n {
return l + Xstrlen(tls, s)
@@ -4566,6 +4797,9 @@ func Xstrlcat(tls *TLS, d uintptr, s uintptr, n size_t) size_t { /* strlcat.c:4:
// from SUS and have nothing to do with the host system.
func Xstrlcpy(tls *TLS, d uintptr, s uintptr, n size_t) size_t { /* strlcpy.c:11:8: */
+ if __ccgo_strace {
+ trc("tls=%v d=%v s=%v n=%v, (%v:)", tls, d, s, n, origin(2))
+ }
var d0 uintptr
var wd uintptr
var ws uintptr
@@ -4637,6 +4871,9 @@ finish:
}
func Xstrncasecmp(tls *TLS, _l uintptr, _r uintptr, n size_t) int32 { /* strncasecmp.c:4:5: */
+ if __ccgo_strace {
+ trc("tls=%v _l=%v _r=%v n=%v, (%v:)", tls, _l, _r, n, origin(2))
+ }
var l uintptr = _l
var r uintptr = _r
if !(int32(PostDecUint64(&n, 1)) != 0) {
@@ -4659,10 +4896,16 @@ __3:
}
func X__strncasecmp_l(tls *TLS, l uintptr, r uintptr, n size_t, loc locale_t) int32 { /* strncasecmp.c:12:5: */
+ if __ccgo_strace {
+ trc("tls=%v l=%v r=%v n=%v loc=%v, (%v:)", tls, l, r, n, loc, origin(2))
+ }
return Xstrncasecmp(tls, l, r, n)
}
func Xstrncat(tls *TLS, d uintptr, s uintptr, n size_t) uintptr { /* strncat.c:3:6: */
+ if __ccgo_strace {
+ trc("tls=%v d=%v s=%v n=%v, (%v:)", tls, d, s, n, origin(2))
+ }
var a uintptr = d
d += uintptr(Xstrlen(tls, d))
for n != 0 && *(*int8)(unsafe.Pointer(s)) != 0 {
@@ -4674,6 +4917,9 @@ func Xstrncat(tls *TLS, d uintptr, s uintptr, n size_t) uintptr { /* strncat.c:3
}
func Xstrnlen(tls *TLS, s uintptr, n size_t) size_t { /* strnlen.c:3:8: */
+ if __ccgo_strace {
+ trc("tls=%v s=%v n=%v, (%v:)", tls, s, n, origin(2))
+ }
var p uintptr = Xmemchr(tls, s, 0, n)
if p != 0 {
return uint64((int64(p) - int64(s)) / 1)
@@ -4682,6 +4928,9 @@ func Xstrnlen(tls *TLS, s uintptr, n size_t) size_t { /* strnlen.c:3:8: */
}
func Xstrspn(tls *TLS, s uintptr, c uintptr) size_t { /* strspn.c:6:8: */
+ if __ccgo_strace {
+ trc("tls=%v s=%v c=%v, (%v:)", tls, s, c, origin(2))
+ }
bp := tls.Alloc(32)
defer tls.Free(32)
@@ -4705,6 +4954,9 @@ func Xstrspn(tls *TLS, s uintptr, c uintptr) size_t { /* strspn.c:6:8: */
}
func Xstrtok(tls *TLS, s uintptr, sep uintptr) uintptr { /* strtok.c:3:6: */
+ if __ccgo_strace {
+ trc("tls=%v s=%v sep=%v, (%v:)", tls, s, sep, origin(2))
+ }
if !(s != 0) && !(int32(AssignUintptr(&s, _sp)) != 0) {
return uintptr(0)
}
diff --git a/vendor/modernc.org/libc/musl_freebsd_386.go b/vendor/modernc.org/libc/musl_freebsd_386.go
index a7fc3180..80883cf7 100644
--- a/vendor/modernc.org/libc/musl_freebsd_386.go
+++ b/vendor/modernc.org/libc/musl_freebsd_386.go
@@ -3319,6 +3319,9 @@ func __isspace(tls *TLS, _c int32) int32 { /* ctype.h:26:21: */
type locale_t = uintptr /* alltypes.h:366:32 */
func Xisalnum(tls *TLS, c int32) int32 { /* isalnum.c:3:5: */
+ if __ccgo_strace {
+ trc("tls=%v c=%v, (%v:)", tls, c, origin(2))
+ }
return Bool32(func() int32 {
if 0 != 0 {
return Xisalpha(tls, c)
@@ -3333,58 +3336,100 @@ func Xisalnum(tls *TLS, c int32) int32 { /* isalnum.c:3:5: */
}
func X__isalnum_l(tls *TLS, c int32, l locale_t) int32 { /* isalnum.c:8:5: */
+ if __ccgo_strace {
+ trc("tls=%v c=%v l=%v, (%v:)", tls, c, l, origin(2))
+ }
return Xisalnum(tls, c)
}
func Xisalpha(tls *TLS, c int32) int32 { /* isalpha.c:4:5: */
+ if __ccgo_strace {
+ trc("tls=%v c=%v, (%v:)", tls, c, origin(2))
+ }
return Bool32(uint32(c)|uint32(32)-uint32('a') < uint32(26))
}
func X__isalpha_l(tls *TLS, c int32, l locale_t) int32 { /* isalpha.c:9:5: */
+ if __ccgo_strace {
+ trc("tls=%v c=%v l=%v, (%v:)", tls, c, l, origin(2))
+ }
return Xisalpha(tls, c)
}
func Xisdigit(tls *TLS, c int32) int32 { /* isdigit.c:4:5: */
+ if __ccgo_strace {
+ trc("tls=%v c=%v, (%v:)", tls, c, origin(2))
+ }
return Bool32(uint32(c)-uint32('0') < uint32(10))
}
func X__isdigit_l(tls *TLS, c int32, l locale_t) int32 { /* isdigit.c:9:5: */
+ if __ccgo_strace {
+ trc("tls=%v c=%v l=%v, (%v:)", tls, c, l, origin(2))
+ }
return Xisdigit(tls, c)
}
func Xislower(tls *TLS, c int32) int32 { /* islower.c:4:5: */
+ if __ccgo_strace {
+ trc("tls=%v c=%v, (%v:)", tls, c, origin(2))
+ }
return Bool32(uint32(c)-uint32('a') < uint32(26))
}
func X__islower_l(tls *TLS, c int32, l locale_t) int32 { /* islower.c:9:5: */
+ if __ccgo_strace {
+ trc("tls=%v c=%v l=%v, (%v:)", tls, c, l, origin(2))
+ }
return Xislower(tls, c)
}
func Xisprint(tls *TLS, c int32) int32 { /* isprint.c:4:5: */
+ if __ccgo_strace {
+ trc("tls=%v c=%v, (%v:)", tls, c, origin(2))
+ }
return Bool32(uint32(c)-uint32(0x20) < uint32(0x5f))
}
func X__isprint_l(tls *TLS, c int32, l locale_t) int32 { /* isprint.c:9:5: */
+ if __ccgo_strace {
+ trc("tls=%v c=%v l=%v, (%v:)", tls, c, l, origin(2))
+ }
return Xisprint(tls, c)
}
func Xisspace(tls *TLS, c int32) int32 { /* isspace.c:4:5: */
+ if __ccgo_strace {
+ trc("tls=%v c=%v, (%v:)", tls, c, origin(2))
+ }
return Bool32(c == ' ' || uint32(c)-uint32('\t') < uint32(5))
}
func X__isspace_l(tls *TLS, c int32, l locale_t) int32 { /* isspace.c:9:5: */
+ if __ccgo_strace {
+ trc("tls=%v c=%v l=%v, (%v:)", tls, c, l, origin(2))
+ }
return Xisspace(tls, c)
}
func Xisupper(tls *TLS, c int32) int32 { /* isupper.c:4:5: */
+ if __ccgo_strace {
+ trc("tls=%v c=%v, (%v:)", tls, c, origin(2))
+ }
return Bool32(uint32(c)-uint32('A') < uint32(26))
}
func X__isupper_l(tls *TLS, c int32, l locale_t) int32 { /* isupper.c:9:5: */
+ if __ccgo_strace {
+ trc("tls=%v c=%v l=%v, (%v:)", tls, c, l, origin(2))
+ }
return Xisupper(tls, c)
}
func Xisxdigit(tls *TLS, c int32) int32 { /* isxdigit.c:3:5: */
+ if __ccgo_strace {
+ trc("tls=%v c=%v, (%v:)", tls, c, origin(2))
+ }
return Bool32(func() int32 {
if 0 != 0 {
return Xisdigit(tls, c)
@@ -3394,6 +3439,9 @@ func Xisxdigit(tls *TLS, c int32) int32 { /* isxdigit.c:3:5: */
}
func X__isxdigit_l(tls *TLS, c int32, l locale_t) int32 { /* isxdigit.c:8:5: */
+ if __ccgo_strace {
+ trc("tls=%v c=%v l=%v, (%v:)", tls, c, l, origin(2))
+ }
return Xisxdigit(tls, c)
}
@@ -4113,6 +4161,9 @@ func hexfloat(tls *TLS, f uintptr, bits int32, emin int32, sign int32, pok int32
}
func X__floatscan(tls *TLS, f uintptr, prec int32, pok int32) float64 { /* floatscan.c:427:13: */
+ if __ccgo_strace {
+ trc("tls=%v f=%v prec=%v pok=%v, (%v:)", tls, f, prec, pok, origin(2))
+ }
var sign int32 = 1
var i size_t
var bits int32
@@ -4290,6 +4341,9 @@ var table = [257]uint8{Uint8FromInt32(-1),
} /* intscan.c:7:28 */
func X__intscan(tls *TLS, f uintptr, base uint32, pok int32, lim uint64) uint64 { /* intscan.c:26:20: */
+ if __ccgo_strace {
+ trc("tls=%v f=%v base=%v pok=%v lim=%v, (%v:)", tls, f, base, pok, lim, origin(2))
+ }
var val uintptr
var c int32
var neg int32
@@ -4595,6 +4649,9 @@ __43:
// the actual count.
func X__shlim(tls *TLS, f uintptr, lim off_t) { /* shgetc.c:8:6: */
+ if __ccgo_strace {
+ trc("tls=%v f=%v lim=%v, (%v:)", tls, f, lim, origin(2))
+ }
(*FILE)(unsafe.Pointer(f)).Fshlim = lim
(*FILE)(unsafe.Pointer(f)).Fshcnt = off_t((int32((*FILE)(unsafe.Pointer(f)).Fbuf) - int32((*FILE)(unsafe.Pointer(f)).Frpos)) / 1)
// If lim is nonzero, rend must be a valid pointer.
@@ -4606,6 +4663,9 @@ func X__shlim(tls *TLS, f uintptr, lim off_t) { /* shgetc.c:8:6: */
}
func X__shgetc(tls *TLS, f uintptr) int32 { /* shgetc.c:19:5: */
+ if __ccgo_strace {
+ trc("tls=%v f=%v, (%v:)", tls, f, origin(2))
+ }
var c int32
var cnt off_t = (*FILE)(unsafe.Pointer(f)).Fshcnt + off_t((int32((*FILE)(unsafe.Pointer(f)).Frpos)-int32((*FILE)(unsafe.Pointer(f)).Fbuf))/1)
if (*FILE)(unsafe.Pointer(f)).Fshlim != 0 && cnt >= (*FILE)(unsafe.Pointer(f)).Fshlim || AssignInt32(&c, X__uflow(tls, f)) < 0 {
@@ -4632,20 +4692,32 @@ func __bswap32(tls *TLS, __x uint32_t) uint32_t { /* endian.h:24:26: */
}
func Xcopysignl(tls *TLS, x float64, y float64) float64 { /* copysignl.c:4:13: */
+ if __ccgo_strace {
+ trc("tls=%v x=%v y=%v, (%v:)", tls, x, y, origin(2))
+ }
return Xcopysign(tls, x, y)
}
func Xfabsl(tls *TLS, x float64) float64 { /* fabsl.c:3:13: */
+ if __ccgo_strace {
+ trc("tls=%v x=%v, (%v:)", tls, x, origin(2))
+ }
return Xfabs(tls, x)
}
func Xfmodl(tls *TLS, x float64, y float64) float64 { /* fmodl.c:4:13: */
+ if __ccgo_strace {
+ trc("tls=%v x=%v y=%v, (%v:)", tls, x, y, origin(2))
+ }
return Xfmod(tls, x, y)
}
var toint double_t = float64(float64(1)) / 2.22044604925031308085e-16 /* rint.c:10:23 */
func Xrint(tls *TLS, x float64) float64 { /* rint.c:12:8: */
+ if __ccgo_strace {
+ trc("tls=%v x=%v, (%v:)", tls, x, origin(2))
+ }
bp := tls.Alloc(8)
defer tls.Free(8)
@@ -4675,6 +4747,9 @@ func Xrint(tls *TLS, x float64) float64 { /* rint.c:12:8: */
}
func Xscalbn(tls *TLS, x float64, n int32) float64 { /* scalbn.c:4:8: */
+ if __ccgo_strace {
+ trc("tls=%v x=%v n=%v, (%v:)", tls, x, n, origin(2))
+ }
bp := tls.Alloc(8)
defer tls.Free(8)
@@ -4711,6 +4786,9 @@ func Xscalbn(tls *TLS, x float64, n int32) float64 { /* scalbn.c:4:8: */
}
func Xscalbnl(tls *TLS, x float64, n int32) float64 { /* scalbnl.c:4:13: */
+ if __ccgo_strace {
+ trc("tls=%v x=%v n=%v, (%v:)", tls, x, n, origin(2))
+ }
return Xscalbn(tls, x, n)
}
@@ -5029,6 +5107,9 @@ type resolvconf = struct {
} /* lookup.h:34:1 */
func Xfreeaddrinfo(tls *TLS, p uintptr) { /* freeaddrinfo.c:7:6: */
+ if __ccgo_strace {
+ trc("tls=%v p=%v, (%v:)", tls, p, origin(2))
+ }
var cnt size_t
cnt = size_t(1)
__1:
@@ -5139,6 +5220,9 @@ type __ptcb = struct {
type useconds_t = uint32 /* alltypes.h:283:18 */
func Xgetaddrinfo(tls *TLS, host uintptr, serv uintptr, hint uintptr, res uintptr) int32 { /* getaddrinfo.c:12:5: */
+ if __ccgo_strace {
+ trc("tls=%v host=%v serv=%v hint=%v res=%v, (%v:)", tls, host, serv, hint, res, origin(2))
+ }
bp := tls.Alloc(1608)
defer tls.Free(1608)
@@ -5338,6 +5422,9 @@ type mmsghdr = struct {
} /* socket.h:63:1 */
func Xgethostbyaddr(tls *TLS, a uintptr, l socklen_t, af int32) uintptr { /* gethostbyaddr.c:7:16: */
+ if __ccgo_strace {
+ trc("tls=%v a=%v l=%v af=%v, (%v:)", tls, a, l, af, origin(2))
+ }
bp := tls.Alloc(4)
defer tls.Free(4)
@@ -5364,10 +5451,16 @@ func Xgethostbyaddr(tls *TLS, a uintptr, l socklen_t, af int32) uintptr { /* get
var _sh uintptr /* gethostbyaddr.c:9:24: */
func Xgethostbyname(tls *TLS, name uintptr) uintptr { /* gethostbyname.c:8:16: */
+ if __ccgo_strace {
+ trc("tls=%v name=%v, (%v:)", tls, name, origin(2))
+ }
return Xgethostbyname2(tls, name, 2)
}
func Xgethostbyname2(tls *TLS, name uintptr, af int32) uintptr { /* gethostbyname2.c:8:16: */
+ if __ccgo_strace {
+ trc("tls=%v name=%v af=%v, (%v:)", tls, name, af, origin(2))
+ }
bp := tls.Alloc(4)
defer tls.Free(4)
@@ -5394,6 +5487,9 @@ func Xgethostbyname2(tls *TLS, name uintptr, af int32) uintptr { /* gethostbynam
var _sh1 uintptr /* gethostbyname2.c:10:24: */
func Xgethostbyname2_r(tls *TLS, name uintptr, af int32, h uintptr, buf uintptr, buflen size_t, res uintptr, err uintptr) int32 { /* gethostbyname2_r.c:11:5: */
+ if __ccgo_strace {
+ trc("tls=%v name=%v af=%v h=%v buf=%v buflen=%v res=%v err=%v, (%v:)", tls, name, af, h, buf, buflen, res, err, origin(2))
+ }
bp := tls.Alloc(1600)
defer tls.Free(1600)
@@ -5772,10 +5868,16 @@ func reverse_services(tls *TLS, buf uintptr, port int32, dgram int32) { /* getna
var Xh_errno int32 /* h_errno.c:4:5: */
func X__h_errno_location(tls *TLS) uintptr { /* h_errno.c:6:5: */
+ if __ccgo_strace {
+ trc("tls=%v, (%v:)", tls, origin(2))
+ }
return uintptr(unsafe.Pointer(&Xh_errno))
}
func X__inet_aton(tls *TLS, s0 uintptr, dest uintptr) int32 { /* inet_aton.c:7:5: */
+ if __ccgo_strace {
+ trc("tls=%v s0=%v dest=%v, (%v:)", tls, s0, dest, origin(2))
+ }
bp := tls.Alloc(20)
defer tls.Free(20)
@@ -5827,6 +5929,9 @@ func X__inet_aton(tls *TLS, s0 uintptr, dest uintptr) int32 { /* inet_aton.c:7:5
}
func Xinet_ntop(tls *TLS, af int32, a0 uintptr, s uintptr, l socklen_t) uintptr { /* inet_ntop.c:7:12: */
+ if __ccgo_strace {
+ trc("tls=%v af=%v a0=%v s=%v l=%v, (%v:)", tls, af, a0, s, l, origin(2))
+ }
bp := tls.Alloc(276)
defer tls.Free(276)
@@ -5901,6 +6006,9 @@ func hexval(tls *TLS, c uint32) int32 { /* inet_pton.c:7:12: */
}
func Xinet_pton(tls *TLS, af int32, s uintptr, a0 uintptr) int32 { /* inet_pton.c:15:5: */
+ if __ccgo_strace {
+ trc("tls=%v af=%v s=%v a0=%v, (%v:)", tls, af, s, a0, origin(2))
+ }
bp := tls.Alloc(16)
defer tls.Free(16)
@@ -5998,6 +6106,9 @@ func Xinet_pton(tls *TLS, af int32, s uintptr, a0 uintptr) int32 { /* inet_pton.
}
func X__lookup_ipliteral(tls *TLS, buf uintptr, name uintptr, family int32) int32 { /* lookup_ipliteral.c:12:5: */
+ if __ccgo_strace {
+ trc("tls=%v buf=%v name=%v family=%v, (%v:)", tls, buf, name, family, origin(2))
+ }
bp := tls.Alloc(88)
defer tls.Free(88)
@@ -6317,6 +6428,9 @@ func addrcmp(tls *TLS, _a uintptr, _b uintptr) int32 { /* lookup_name.c:305:12:
}
func X__lookup_name(tls *TLS, buf uintptr, canon uintptr, name uintptr, family int32, flags int32) int32 { /* lookup_name.c:311:5: */
+ if __ccgo_strace {
+ trc("tls=%v buf=%v canon=%v name=%v family=%v flags=%v, (%v:)", tls, buf, canon, name, family, flags, origin(2))
+ }
bp := tls.Alloc(92)
defer tls.Free(92)
@@ -6483,6 +6597,9 @@ func X__lookup_name(tls *TLS, buf uintptr, canon uintptr, name uintptr, family i
}
func X__lookup_serv(tls *TLS, buf uintptr, name uintptr, proto int32, socktype int32, flags int32) int32 { /* lookup_serv.c:12:5: */
+ if __ccgo_strace {
+ trc("tls=%v buf=%v name=%v proto=%v socktype=%v flags=%v, (%v:)", tls, buf, name, proto, socktype, flags, origin(2))
+ }
bp := tls.Alloc(4)
defer tls.Free(4)
@@ -6608,6 +6725,9 @@ func X__lookup_serv(tls *TLS, buf uintptr, name uintptr, proto int32, socktype i
}
func X__toread(tls *TLS, f uintptr) int32 { /* __toread.c:3:5: */
+ if __ccgo_strace {
+ trc("tls=%v f=%v, (%v:)", tls, f, origin(2))
+ }
*(*int32)(unsafe.Pointer(f + 72)) |= (*FILE)(unsafe.Pointer(f)).Fmode - 1
if (*FILE)(unsafe.Pointer(f)).Fwpos != (*FILE)(unsafe.Pointer(f)).Fwbase {
(*struct {
@@ -6627,6 +6747,9 @@ func X__toread(tls *TLS, f uintptr) int32 { /* __toread.c:3:5: */
}
func X__toread_needs_stdio_exit(tls *TLS) { /* __toread.c:16:13: */
+ if __ccgo_strace {
+ trc("tls=%v, (%v:)", tls, origin(2))
+ }
X__builtin_abort(tls) //TODO-
// __stdio_exit_needed();
}
@@ -6635,6 +6758,9 @@ func X__toread_needs_stdio_exit(tls *TLS) { /* __toread.c:16:13: */
// data buffered for reading.
func X__uflow(tls *TLS, f uintptr) int32 { /* __uflow.c:6:5: */
+ if __ccgo_strace {
+ trc("tls=%v f=%v, (%v:)", tls, f, origin(2))
+ }
bp := tls.Alloc(1)
defer tls.Free(1)
@@ -6649,6 +6775,9 @@ func X__uflow(tls *TLS, f uintptr) int32 { /* __uflow.c:6:5: */
}
func Xbsearch(tls *TLS, key uintptr, base uintptr, nel size_t, width size_t, cmp uintptr) uintptr { /* bsearch.c:3:6: */
+ if __ccgo_strace {
+ trc("tls=%v key=%v base=%v nel=%v width=%v cmp=%v, (%v:)", tls, key, base, nel, width, cmp, origin(2))
+ }
var try uintptr
var sign int32
for nel > size_t(0) {
@@ -6691,14 +6820,23 @@ func strtox(tls *TLS, s uintptr, p uintptr, prec int32) float64 { /* strtod.c:6:
}
func Xstrtof(tls *TLS, s uintptr, p uintptr) float32 { /* strtod.c:17:7: */
+ if __ccgo_strace {
+ trc("tls=%v s=%v p=%v, (%v:)", tls, s, p, origin(2))
+ }
return float32(strtox(tls, s, p, 0))
}
func Xstrtod(tls *TLS, s uintptr, p uintptr) float64 { /* strtod.c:22:8: */
+ if __ccgo_strace {
+ trc("tls=%v s=%v p=%v, (%v:)", tls, s, p, origin(2))
+ }
return strtox(tls, s, p, 1)
}
func Xstrtold(tls *TLS, s uintptr, p uintptr) float64 { /* strtod.c:27:13: */
+ if __ccgo_strace {
+ trc("tls=%v s=%v p=%v, (%v:)", tls, s, p, origin(2))
+ }
return strtox(tls, s, p, 2)
}
@@ -6720,30 +6858,51 @@ func strtox1(tls *TLS, s uintptr, p uintptr, base int32, lim uint64) uint64 { /*
}
func Xstrtoull(tls *TLS, s uintptr, p uintptr, base int32) uint64 { /* strtol.c:21:20: */
+ if __ccgo_strace {
+ trc("tls=%v s=%v p=%v base=%v, (%v:)", tls, s, p, base, origin(2))
+ }
return strtox1(tls, s, p, base, 2*uint64(0x7fffffffffffffff)+uint64(1))
}
func Xstrtoll(tls *TLS, s uintptr, p uintptr, base int32) int64 { /* strtol.c:26:11: */
+ if __ccgo_strace {
+ trc("tls=%v s=%v p=%v base=%v, (%v:)", tls, s, p, base, origin(2))
+ }
return int64(strtox1(tls, s, p, base, Uint64FromInt64(-0x7fffffffffffffff-int64(1))))
}
func Xstrtoul(tls *TLS, s uintptr, p uintptr, base int32) uint32 { /* strtol.c:31:15: */
+ if __ccgo_strace {
+ trc("tls=%v s=%v p=%v base=%v, (%v:)", tls, s, p, base, origin(2))
+ }
return uint32(strtox1(tls, s, p, base, uint64(2*uint32(0x7fffffff)+uint32(1))))
}
func Xstrtol(tls *TLS, s uintptr, p uintptr, base int32) int32 { /* strtol.c:36:6: */
+ if __ccgo_strace {
+ trc("tls=%v s=%v p=%v base=%v, (%v:)", tls, s, p, base, origin(2))
+ }
return int32(strtox1(tls, s, p, base, uint64(0+Uint32FromInt32(Int32(-Int32(0x7fffffff))-Int32FromInt32(1)))))
}
func Xstrtoimax(tls *TLS, s uintptr, p uintptr, base int32) intmax_t { /* strtol.c:41:10: */
+ if __ccgo_strace {
+ trc("tls=%v s=%v p=%v base=%v, (%v:)", tls, s, p, base, origin(2))
+ }
return Xstrtoll(tls, s, p, base)
}
func Xstrtoumax(tls *TLS, s uintptr, p uintptr, base int32) uintmax_t { /* strtol.c:46:11: */
+ if __ccgo_strace {
+ trc("tls=%v s=%v p=%v base=%v, (%v:)", tls, s, p, base, origin(2))
+ }
return Xstrtoull(tls, s, p, base)
}
func Xstrdup(tls *TLS, s uintptr) uintptr { /* strdup.c:4:6: */
+ if __ccgo_strace {
+ trc("tls=%v s=%v, (%v:)", tls, s, origin(2))
+ }
var l size_t = Xstrlen(tls, s)
var d uintptr = Xmalloc(tls, l+size_t(1))
if !(d != 0) {
@@ -6753,6 +6912,9 @@ func Xstrdup(tls *TLS, s uintptr) uintptr { /* strdup.c:4:6: */
}
func Xstrnlen(tls *TLS, s uintptr, n size_t) size_t { /* strnlen.c:3:8: */
+ if __ccgo_strace {
+ trc("tls=%v s=%v n=%v, (%v:)", tls, s, n, origin(2))
+ }
var p uintptr = Xmemchr(tls, s, 0, n)
if p != 0 {
return uint32((int32(p) - int32(s)) / 1)
@@ -6761,6 +6923,9 @@ func Xstrnlen(tls *TLS, s uintptr, n size_t) size_t { /* strnlen.c:3:8: */
}
func Xstrspn(tls *TLS, s uintptr, c uintptr) size_t { /* strspn.c:6:8: */
+ if __ccgo_strace {
+ trc("tls=%v s=%v c=%v, (%v:)", tls, s, c, origin(2))
+ }
bp := tls.Alloc(32)
defer tls.Free(32)
diff --git a/vendor/modernc.org/libc/musl_freebsd_amd64.go b/vendor/modernc.org/libc/musl_freebsd_amd64.go
index ae1a70af..a301e3a3 100644
--- a/vendor/modernc.org/libc/musl_freebsd_amd64.go
+++ b/vendor/modernc.org/libc/musl_freebsd_amd64.go
@@ -3323,6 +3323,9 @@ func __isspace(tls *TLS, _c int32) int32 { /* ctype.h:26:21: */
type locale_t = uintptr /* alltypes.h:343:32 */
func Xisalnum(tls *TLS, c int32) int32 { /* isalnum.c:3:5: */
+ if __ccgo_strace {
+ trc("tls=%v c=%v, (%v:)", tls, c, origin(2))
+ }
return Bool32(func() int32 {
if 0 != 0 {
return Xisalpha(tls, c)
@@ -3337,58 +3340,100 @@ func Xisalnum(tls *TLS, c int32) int32 { /* isalnum.c:3:5: */
}
func X__isalnum_l(tls *TLS, c int32, l locale_t) int32 { /* isalnum.c:8:5: */
+ if __ccgo_strace {
+ trc("tls=%v c=%v l=%v, (%v:)", tls, c, l, origin(2))
+ }
return Xisalnum(tls, c)
}
func Xisalpha(tls *TLS, c int32) int32 { /* isalpha.c:4:5: */
+ if __ccgo_strace {
+ trc("tls=%v c=%v, (%v:)", tls, c, origin(2))
+ }
return Bool32(uint32(c)|uint32(32)-uint32('a') < uint32(26))
}
func X__isalpha_l(tls *TLS, c int32, l locale_t) int32 { /* isalpha.c:9:5: */
+ if __ccgo_strace {
+ trc("tls=%v c=%v l=%v, (%v:)", tls, c, l, origin(2))
+ }
return Xisalpha(tls, c)
}
func Xisdigit(tls *TLS, c int32) int32 { /* isdigit.c:4:5: */
+ if __ccgo_strace {
+ trc("tls=%v c=%v, (%v:)", tls, c, origin(2))
+ }
return Bool32(uint32(c)-uint32('0') < uint32(10))
}
func X__isdigit_l(tls *TLS, c int32, l locale_t) int32 { /* isdigit.c:9:5: */
+ if __ccgo_strace {
+ trc("tls=%v c=%v l=%v, (%v:)", tls, c, l, origin(2))
+ }
return Xisdigit(tls, c)
}
func Xislower(tls *TLS, c int32) int32 { /* islower.c:4:5: */
+ if __ccgo_strace {
+ trc("tls=%v c=%v, (%v:)", tls, c, origin(2))
+ }
return Bool32(uint32(c)-uint32('a') < uint32(26))
}
func X__islower_l(tls *TLS, c int32, l locale_t) int32 { /* islower.c:9:5: */
+ if __ccgo_strace {
+ trc("tls=%v c=%v l=%v, (%v:)", tls, c, l, origin(2))
+ }
return Xislower(tls, c)
}
func Xisprint(tls *TLS, c int32) int32 { /* isprint.c:4:5: */
+ if __ccgo_strace {
+ trc("tls=%v c=%v, (%v:)", tls, c, origin(2))
+ }
return Bool32(uint32(c)-uint32(0x20) < uint32(0x5f))
}
func X__isprint_l(tls *TLS, c int32, l locale_t) int32 { /* isprint.c:9:5: */
+ if __ccgo_strace {
+ trc("tls=%v c=%v l=%v, (%v:)", tls, c, l, origin(2))
+ }
return Xisprint(tls, c)
}
func Xisspace(tls *TLS, c int32) int32 { /* isspace.c:4:5: */
+ if __ccgo_strace {
+ trc("tls=%v c=%v, (%v:)", tls, c, origin(2))
+ }
return Bool32(c == ' ' || uint32(c)-uint32('\t') < uint32(5))
}
func X__isspace_l(tls *TLS, c int32, l locale_t) int32 { /* isspace.c:9:5: */
+ if __ccgo_strace {
+ trc("tls=%v c=%v l=%v, (%v:)", tls, c, l, origin(2))
+ }
return Xisspace(tls, c)
}
func Xisupper(tls *TLS, c int32) int32 { /* isupper.c:4:5: */
+ if __ccgo_strace {
+ trc("tls=%v c=%v, (%v:)", tls, c, origin(2))
+ }
return Bool32(uint32(c)-uint32('A') < uint32(26))
}
func X__isupper_l(tls *TLS, c int32, l locale_t) int32 { /* isupper.c:9:5: */
+ if __ccgo_strace {
+ trc("tls=%v c=%v l=%v, (%v:)", tls, c, l, origin(2))
+ }
return Xisupper(tls, c)
}
func Xisxdigit(tls *TLS, c int32) int32 { /* isxdigit.c:3:5: */
+ if __ccgo_strace {
+ trc("tls=%v c=%v, (%v:)", tls, c, origin(2))
+ }
return Bool32(func() int32 {
if 0 != 0 {
return Xisdigit(tls, c)
@@ -3398,6 +3443,9 @@ func Xisxdigit(tls *TLS, c int32) int32 { /* isxdigit.c:3:5: */
}
func X__isxdigit_l(tls *TLS, c int32, l locale_t) int32 { /* isxdigit.c:8:5: */
+ if __ccgo_strace {
+ trc("tls=%v c=%v l=%v, (%v:)", tls, c, l, origin(2))
+ }
return Xisxdigit(tls, c)
}
@@ -4119,6 +4167,9 @@ func hexfloat(tls *TLS, f uintptr, bits int32, emin int32, sign int32, pok int32
}
func X__floatscan(tls *TLS, f uintptr, prec int32, pok int32) float64 { /* floatscan.c:427:13: */
+ if __ccgo_strace {
+ trc("tls=%v f=%v prec=%v pok=%v, (%v:)", tls, f, prec, pok, origin(2))
+ }
var sign int32 = 1
var i size_t
var bits int32
@@ -4296,6 +4347,9 @@ var table = [257]uint8{Uint8FromInt32(-1),
} /* intscan.c:7:28 */
func X__intscan(tls *TLS, f uintptr, base uint32, pok int32, lim uint64) uint64 { /* intscan.c:26:20: */
+ if __ccgo_strace {
+ trc("tls=%v f=%v base=%v pok=%v lim=%v, (%v:)", tls, f, base, pok, lim, origin(2))
+ }
var val uintptr
var c int32
var neg int32
@@ -4601,6 +4655,9 @@ __43:
// the actual count.
func X__shlim(tls *TLS, f uintptr, lim off_t) { /* shgetc.c:8:6: */
+ if __ccgo_strace {
+ trc("tls=%v f=%v lim=%v, (%v:)", tls, f, lim, origin(2))
+ }
(*FILE)(unsafe.Pointer(f)).Fshlim = lim
(*FILE)(unsafe.Pointer(f)).Fshcnt = (int64((*FILE)(unsafe.Pointer(f)).Fbuf) - int64((*FILE)(unsafe.Pointer(f)).Frpos)) / 1
// If lim is nonzero, rend must be a valid pointer.
@@ -4612,6 +4669,9 @@ func X__shlim(tls *TLS, f uintptr, lim off_t) { /* shgetc.c:8:6: */
}
func X__shgetc(tls *TLS, f uintptr) int32 { /* shgetc.c:19:5: */
+ if __ccgo_strace {
+ trc("tls=%v f=%v, (%v:)", tls, f, origin(2))
+ }
var c int32
var cnt off_t = (*FILE)(unsafe.Pointer(f)).Fshcnt + (int64((*FILE)(unsafe.Pointer(f)).Frpos)-int64((*FILE)(unsafe.Pointer(f)).Fbuf))/1
if (*FILE)(unsafe.Pointer(f)).Fshlim != 0 && cnt >= (*FILE)(unsafe.Pointer(f)).Fshlim || AssignInt32(&c, X__uflow(tls, f)) < 0 {
@@ -4638,20 +4698,32 @@ func __bswap32(tls *TLS, __x uint32_t) uint32_t { /* endian.h:24:26: */
}
func Xcopysignl(tls *TLS, x float64, y float64) float64 { /* copysignl.c:4:13: */
+ if __ccgo_strace {
+ trc("tls=%v x=%v y=%v, (%v:)", tls, x, y, origin(2))
+ }
return Xcopysign(tls, x, y)
}
func Xfabsl(tls *TLS, x float64) float64 { /* fabsl.c:3:13: */
+ if __ccgo_strace {
+ trc("tls=%v x=%v, (%v:)", tls, x, origin(2))
+ }
return Xfabs(tls, x)
}
func Xfmodl(tls *TLS, x float64, y float64) float64 { /* fmodl.c:4:13: */
+ if __ccgo_strace {
+ trc("tls=%v x=%v y=%v, (%v:)", tls, x, y, origin(2))
+ }
return Xfmod(tls, x, y)
}
var toint double_t = float64(float64(1)) / 2.22044604925031308085e-16 /* rint.c:10:23 */
func Xrint(tls *TLS, x float64) float64 { /* rint.c:12:8: */
+ if __ccgo_strace {
+ trc("tls=%v x=%v, (%v:)", tls, x, origin(2))
+ }
bp := tls.Alloc(8)
defer tls.Free(8)
@@ -4681,6 +4753,9 @@ func Xrint(tls *TLS, x float64) float64 { /* rint.c:12:8: */
}
func Xscalbn(tls *TLS, x float64, n int32) float64 { /* scalbn.c:4:8: */
+ if __ccgo_strace {
+ trc("tls=%v x=%v n=%v, (%v:)", tls, x, n, origin(2))
+ }
bp := tls.Alloc(8)
defer tls.Free(8)
@@ -4717,6 +4792,9 @@ func Xscalbn(tls *TLS, x float64, n int32) float64 { /* scalbn.c:4:8: */
}
func Xscalbnl(tls *TLS, x float64, n int32) float64 { /* scalbnl.c:4:13: */
+ if __ccgo_strace {
+ trc("tls=%v x=%v n=%v, (%v:)", tls, x, n, origin(2))
+ }
return Xscalbn(tls, x, n)
}
@@ -5048,6 +5126,9 @@ type resolvconf = struct {
} /* lookup.h:34:1 */
func Xfreeaddrinfo(tls *TLS, p uintptr) { /* freeaddrinfo.c:7:6: */
+ if __ccgo_strace {
+ trc("tls=%v p=%v, (%v:)", tls, p, origin(2))
+ }
var cnt size_t
cnt = uint64(1)
__1:
@@ -5185,6 +5266,9 @@ type __ptcb = struct {
type useconds_t = uint32 /* alltypes.h:260:18 */
func Xgetaddrinfo(tls *TLS, host uintptr, serv uintptr, hint uintptr, res uintptr) int32 { /* getaddrinfo.c:12:5: */
+ if __ccgo_strace {
+ trc("tls=%v host=%v serv=%v hint=%v res=%v, (%v:)", tls, host, serv, hint, res, origin(2))
+ }
bp := tls.Alloc(1608)
defer tls.Free(1608)
@@ -5389,6 +5473,9 @@ type mmsghdr = struct {
} /* socket.h:63:1 */
func Xgethostbyaddr(tls *TLS, a uintptr, l socklen_t, af int32) uintptr { /* gethostbyaddr.c:7:16: */
+ if __ccgo_strace {
+ trc("tls=%v a=%v l=%v af=%v, (%v:)", tls, a, l, af, origin(2))
+ }
bp := tls.Alloc(8)
defer tls.Free(8)
@@ -5415,10 +5502,16 @@ func Xgethostbyaddr(tls *TLS, a uintptr, l socklen_t, af int32) uintptr { /* get
var _sh uintptr /* gethostbyaddr.c:9:24: */
func Xgethostbyname(tls *TLS, name uintptr) uintptr { /* gethostbyname.c:8:16: */
+ if __ccgo_strace {
+ trc("tls=%v name=%v, (%v:)", tls, name, origin(2))
+ }
return Xgethostbyname2(tls, name, 2)
}
func Xgethostbyname2(tls *TLS, name uintptr, af int32) uintptr { /* gethostbyname2.c:8:16: */
+ if __ccgo_strace {
+ trc("tls=%v name=%v af=%v, (%v:)", tls, name, af, origin(2))
+ }
bp := tls.Alloc(8)
defer tls.Free(8)
@@ -5445,6 +5538,9 @@ func Xgethostbyname2(tls *TLS, name uintptr, af int32) uintptr { /* gethostbynam
var _sh1 uintptr /* gethostbyname2.c:10:24: */
func Xgethostbyname2_r(tls *TLS, name uintptr, af int32, h uintptr, buf uintptr, buflen size_t, res uintptr, err uintptr) int32 { /* gethostbyname2_r.c:11:5: */
+ if __ccgo_strace {
+ trc("tls=%v name=%v af=%v h=%v buf=%v buflen=%v res=%v err=%v, (%v:)", tls, name, af, h, buf, buflen, res, err, origin(2))
+ }
bp := tls.Alloc(1600)
defer tls.Free(1600)
@@ -5833,10 +5929,16 @@ func reverse_services(tls *TLS, buf uintptr, port int32, dgram int32) { /* getna
var Xh_errno int32 /* h_errno.c:4:5: */
func X__h_errno_location(tls *TLS) uintptr { /* h_errno.c:6:5: */
+ if __ccgo_strace {
+ trc("tls=%v, (%v:)", tls, origin(2))
+ }
return uintptr(unsafe.Pointer(&Xh_errno))
}
func X__inet_aton(tls *TLS, s0 uintptr, dest uintptr) int32 { /* inet_aton.c:7:5: */
+ if __ccgo_strace {
+ trc("tls=%v s0=%v dest=%v, (%v:)", tls, s0, dest, origin(2))
+ }
bp := tls.Alloc(40)
defer tls.Free(40)
@@ -5888,6 +5990,9 @@ func X__inet_aton(tls *TLS, s0 uintptr, dest uintptr) int32 { /* inet_aton.c:7:5
}
func Xinet_ntop(tls *TLS, af int32, a0 uintptr, s uintptr, l socklen_t) uintptr { /* inet_ntop.c:7:12: */
+ if __ccgo_strace {
+ trc("tls=%v af=%v a0=%v s=%v l=%v, (%v:)", tls, af, a0, s, l, origin(2))
+ }
bp := tls.Alloc(276)
defer tls.Free(276)
@@ -5962,6 +6067,9 @@ func hexval(tls *TLS, c uint32) int32 { /* inet_pton.c:7:12: */
}
func Xinet_pton(tls *TLS, af int32, s uintptr, a0 uintptr) int32 { /* inet_pton.c:15:5: */
+ if __ccgo_strace {
+ trc("tls=%v af=%v s=%v a0=%v, (%v:)", tls, af, s, a0, origin(2))
+ }
bp := tls.Alloc(16)
defer tls.Free(16)
@@ -6059,6 +6167,9 @@ func Xinet_pton(tls *TLS, af int32, s uintptr, a0 uintptr) int32 { /* inet_pton.
}
func X__lookup_ipliteral(tls *TLS, buf uintptr, name uintptr, family int32) int32 { /* lookup_ipliteral.c:12:5: */
+ if __ccgo_strace {
+ trc("tls=%v buf=%v name=%v family=%v, (%v:)", tls, buf, name, family, origin(2))
+ }
bp := tls.Alloc(96)
defer tls.Free(96)
@@ -6381,6 +6492,9 @@ func addrcmp(tls *TLS, _a uintptr, _b uintptr) int32 { /* lookup_name.c:305:12:
}
func X__lookup_name(tls *TLS, buf uintptr, canon uintptr, name uintptr, family int32, flags int32) int32 { /* lookup_name.c:311:5: */
+ if __ccgo_strace {
+ trc("tls=%v buf=%v canon=%v name=%v family=%v flags=%v, (%v:)", tls, buf, canon, name, family, flags, origin(2))
+ }
bp := tls.Alloc(92)
defer tls.Free(92)
@@ -6547,6 +6661,9 @@ func X__lookup_name(tls *TLS, buf uintptr, canon uintptr, name uintptr, family i
}
func X__lookup_serv(tls *TLS, buf uintptr, name uintptr, proto int32, socktype int32, flags int32) int32 { /* lookup_serv.c:12:5: */
+ if __ccgo_strace {
+ trc("tls=%v buf=%v name=%v proto=%v socktype=%v flags=%v, (%v:)", tls, buf, name, proto, socktype, flags, origin(2))
+ }
bp := tls.Alloc(8)
defer tls.Free(8)
@@ -6672,6 +6789,9 @@ func X__lookup_serv(tls *TLS, buf uintptr, name uintptr, proto int32, socktype i
}
func X__toread(tls *TLS, f uintptr) int32 { /* __toread.c:3:5: */
+ if __ccgo_strace {
+ trc("tls=%v f=%v, (%v:)", tls, f, origin(2))
+ }
*(*int32)(unsafe.Pointer(f + 136)) |= (*FILE)(unsafe.Pointer(f)).Fmode - 1
if (*FILE)(unsafe.Pointer(f)).Fwpos != (*FILE)(unsafe.Pointer(f)).Fwbase {
(*struct {
@@ -6691,6 +6811,9 @@ func X__toread(tls *TLS, f uintptr) int32 { /* __toread.c:3:5: */
}
func X__toread_needs_stdio_exit(tls *TLS) { /* __toread.c:16:13: */
+ if __ccgo_strace {
+ trc("tls=%v, (%v:)", tls, origin(2))
+ }
X__builtin_abort(tls) //TODO-
// __stdio_exit_needed();
}
@@ -6699,6 +6822,9 @@ func X__toread_needs_stdio_exit(tls *TLS) { /* __toread.c:16:13: */
// data buffered for reading.
func X__uflow(tls *TLS, f uintptr) int32 { /* __uflow.c:6:5: */
+ if __ccgo_strace {
+ trc("tls=%v f=%v, (%v:)", tls, f, origin(2))
+ }
bp := tls.Alloc(1)
defer tls.Free(1)
@@ -6713,6 +6839,9 @@ func X__uflow(tls *TLS, f uintptr) int32 { /* __uflow.c:6:5: */
}
func Xbsearch(tls *TLS, key uintptr, base uintptr, nel size_t, width size_t, cmp uintptr) uintptr { /* bsearch.c:3:6: */
+ if __ccgo_strace {
+ trc("tls=%v key=%v base=%v nel=%v width=%v cmp=%v, (%v:)", tls, key, base, nel, width, cmp, origin(2))
+ }
var try uintptr
var sign int32
for nel > uint64(0) {
@@ -6755,14 +6884,23 @@ func strtox(tls *TLS, s uintptr, p uintptr, prec int32) float64 { /* strtod.c:6:
}
func Xstrtof(tls *TLS, s uintptr, p uintptr) float32 { /* strtod.c:17:7: */
+ if __ccgo_strace {
+ trc("tls=%v s=%v p=%v, (%v:)", tls, s, p, origin(2))
+ }
return float32(strtox(tls, s, p, 0))
}
func Xstrtod(tls *TLS, s uintptr, p uintptr) float64 { /* strtod.c:22:8: */
+ if __ccgo_strace {
+ trc("tls=%v s=%v p=%v, (%v:)", tls, s, p, origin(2))
+ }
return strtox(tls, s, p, 1)
}
func Xstrtold(tls *TLS, s uintptr, p uintptr) float64 { /* strtod.c:27:13: */
+ if __ccgo_strace {
+ trc("tls=%v s=%v p=%v, (%v:)", tls, s, p, origin(2))
+ }
return strtox(tls, s, p, 2)
}
@@ -6784,30 +6922,51 @@ func strtox1(tls *TLS, s uintptr, p uintptr, base int32, lim uint64) uint64 { /*
}
func Xstrtoull(tls *TLS, s uintptr, p uintptr, base int32) uint64 { /* strtol.c:21:20: */
+ if __ccgo_strace {
+ trc("tls=%v s=%v p=%v base=%v, (%v:)", tls, s, p, base, origin(2))
+ }
return strtox1(tls, s, p, base, 2*uint64(0x7fffffffffffffff)+uint64(1))
}
func Xstrtoll(tls *TLS, s uintptr, p uintptr, base int32) int64 { /* strtol.c:26:11: */
+ if __ccgo_strace {
+ trc("tls=%v s=%v p=%v base=%v, (%v:)", tls, s, p, base, origin(2))
+ }
return int64(strtox1(tls, s, p, base, Uint64FromInt64(-0x7fffffffffffffff-int64(1))))
}
func Xstrtoul(tls *TLS, s uintptr, p uintptr, base int32) uint64 { /* strtol.c:31:15: */
+ if __ccgo_strace {
+ trc("tls=%v s=%v p=%v base=%v, (%v:)", tls, s, p, base, origin(2))
+ }
return uint64(strtox1(tls, s, p, base, 2*uint64(0x7fffffffffffffff)+uint64(1)))
}
func Xstrtol(tls *TLS, s uintptr, p uintptr, base int32) int64 { /* strtol.c:36:6: */
+ if __ccgo_strace {
+ trc("tls=%v s=%v p=%v base=%v, (%v:)", tls, s, p, base, origin(2))
+ }
return int64(strtox1(tls, s, p, base, 0+Uint64FromInt64(Int64(-Int64(0x7fffffffffffffff))-Int64FromInt32(1))))
}
func Xstrtoimax(tls *TLS, s uintptr, p uintptr, base int32) intmax_t { /* strtol.c:41:10: */
+ if __ccgo_strace {
+ trc("tls=%v s=%v p=%v base=%v, (%v:)", tls, s, p, base, origin(2))
+ }
return intmax_t(Xstrtoll(tls, s, p, base))
}
func Xstrtoumax(tls *TLS, s uintptr, p uintptr, base int32) uintmax_t { /* strtol.c:46:11: */
+ if __ccgo_strace {
+ trc("tls=%v s=%v p=%v base=%v, (%v:)", tls, s, p, base, origin(2))
+ }
return uintmax_t(Xstrtoull(tls, s, p, base))
}
func Xstrdup(tls *TLS, s uintptr) uintptr { /* strdup.c:4:6: */
+ if __ccgo_strace {
+ trc("tls=%v s=%v, (%v:)", tls, s, origin(2))
+ }
var l size_t = Xstrlen(tls, s)
var d uintptr = Xmalloc(tls, l+uint64(1))
if !(d != 0) {
@@ -6817,6 +6976,9 @@ func Xstrdup(tls *TLS, s uintptr) uintptr { /* strdup.c:4:6: */
}
func Xstrnlen(tls *TLS, s uintptr, n size_t) size_t { /* strnlen.c:3:8: */
+ if __ccgo_strace {
+ trc("tls=%v s=%v n=%v, (%v:)", tls, s, n, origin(2))
+ }
var p uintptr = Xmemchr(tls, s, 0, n)
if p != 0 {
return uint64((int64(p) - int64(s)) / 1)
@@ -6825,6 +6987,9 @@ func Xstrnlen(tls *TLS, s uintptr, n size_t) size_t { /* strnlen.c:3:8: */
}
func Xstrspn(tls *TLS, s uintptr, c uintptr) size_t { /* strspn.c:6:8: */
+ if __ccgo_strace {
+ trc("tls=%v s=%v c=%v, (%v:)", tls, s, c, origin(2))
+ }
bp := tls.Alloc(32)
defer tls.Free(32)
diff --git a/vendor/modernc.org/libc/musl_freebsd_arm.go b/vendor/modernc.org/libc/musl_freebsd_arm.go
index d444461d..cb4f02d9 100644
--- a/vendor/modernc.org/libc/musl_freebsd_arm.go
+++ b/vendor/modernc.org/libc/musl_freebsd_arm.go
@@ -3319,6 +3319,9 @@ func __isspace(tls *TLS, _c int32) int32 { /* ctype.h:26:21: */
type locale_t = uintptr /* alltypes.h:336:32 */
func Xisalnum(tls *TLS, c int32) int32 { /* isalnum.c:3:5: */
+ if __ccgo_strace {
+ trc("tls=%v c=%v, (%v:)", tls, c, origin(2))
+ }
return Bool32(func() int32 {
if 0 != 0 {
return Xisalpha(tls, c)
@@ -3333,58 +3336,100 @@ func Xisalnum(tls *TLS, c int32) int32 { /* isalnum.c:3:5: */
}
func X__isalnum_l(tls *TLS, c int32, l locale_t) int32 { /* isalnum.c:8:5: */
+ if __ccgo_strace {
+ trc("tls=%v c=%v l=%v, (%v:)", tls, c, l, origin(2))
+ }
return Xisalnum(tls, c)
}
func Xisalpha(tls *TLS, c int32) int32 { /* isalpha.c:4:5: */
+ if __ccgo_strace {
+ trc("tls=%v c=%v, (%v:)", tls, c, origin(2))
+ }
return Bool32(uint32(c)|uint32(32)-uint32('a') < uint32(26))
}
func X__isalpha_l(tls *TLS, c int32, l locale_t) int32 { /* isalpha.c:9:5: */
+ if __ccgo_strace {
+ trc("tls=%v c=%v l=%v, (%v:)", tls, c, l, origin(2))
+ }
return Xisalpha(tls, c)
}
func Xisdigit(tls *TLS, c int32) int32 { /* isdigit.c:4:5: */
+ if __ccgo_strace {
+ trc("tls=%v c=%v, (%v:)", tls, c, origin(2))
+ }
return Bool32(uint32(c)-uint32('0') < uint32(10))
}
func X__isdigit_l(tls *TLS, c int32, l locale_t) int32 { /* isdigit.c:9:5: */
+ if __ccgo_strace {
+ trc("tls=%v c=%v l=%v, (%v:)", tls, c, l, origin(2))
+ }
return Xisdigit(tls, c)
}
func Xislower(tls *TLS, c int32) int32 { /* islower.c:4:5: */
+ if __ccgo_strace {
+ trc("tls=%v c=%v, (%v:)", tls, c, origin(2))
+ }
return Bool32(uint32(c)-uint32('a') < uint32(26))
}
func X__islower_l(tls *TLS, c int32, l locale_t) int32 { /* islower.c:9:5: */
+ if __ccgo_strace {
+ trc("tls=%v c=%v l=%v, (%v:)", tls, c, l, origin(2))
+ }
return Xislower(tls, c)
}
func Xisprint(tls *TLS, c int32) int32 { /* isprint.c:4:5: */
+ if __ccgo_strace {
+ trc("tls=%v c=%v, (%v:)", tls, c, origin(2))
+ }
return Bool32(uint32(c)-uint32(0x20) < uint32(0x5f))
}
func X__isprint_l(tls *TLS, c int32, l locale_t) int32 { /* isprint.c:9:5: */
+ if __ccgo_strace {
+ trc("tls=%v c=%v l=%v, (%v:)", tls, c, l, origin(2))
+ }
return Xisprint(tls, c)
}
func Xisspace(tls *TLS, c int32) int32 { /* isspace.c:4:5: */
+ if __ccgo_strace {
+ trc("tls=%v c=%v, (%v:)", tls, c, origin(2))
+ }
return Bool32(c == ' ' || uint32(c)-uint32('\t') < uint32(5))
}
func X__isspace_l(tls *TLS, c int32, l locale_t) int32 { /* isspace.c:9:5: */
+ if __ccgo_strace {
+ trc("tls=%v c=%v l=%v, (%v:)", tls, c, l, origin(2))
+ }
return Xisspace(tls, c)
}
func Xisupper(tls *TLS, c int32) int32 { /* isupper.c:4:5: */
+ if __ccgo_strace {
+ trc("tls=%v c=%v, (%v:)", tls, c, origin(2))
+ }
return Bool32(uint32(c)-uint32('A') < uint32(26))
}
func X__isupper_l(tls *TLS, c int32, l locale_t) int32 { /* isupper.c:9:5: */
+ if __ccgo_strace {
+ trc("tls=%v c=%v l=%v, (%v:)", tls, c, l, origin(2))
+ }
return Xisupper(tls, c)
}
func Xisxdigit(tls *TLS, c int32) int32 { /* isxdigit.c:3:5: */
+ if __ccgo_strace {
+ trc("tls=%v c=%v, (%v:)", tls, c, origin(2))
+ }
return Bool32(func() int32 {
if 0 != 0 {
return Xisdigit(tls, c)
@@ -3394,6 +3439,9 @@ func Xisxdigit(tls *TLS, c int32) int32 { /* isxdigit.c:3:5: */
}
func X__isxdigit_l(tls *TLS, c int32, l locale_t) int32 { /* isxdigit.c:8:5: */
+ if __ccgo_strace {
+ trc("tls=%v c=%v l=%v, (%v:)", tls, c, l, origin(2))
+ }
return Xisxdigit(tls, c)
}
@@ -4115,6 +4163,9 @@ func hexfloat(tls *TLS, f uintptr, bits int32, emin int32, sign int32, pok int32
}
func X__floatscan(tls *TLS, f uintptr, prec int32, pok int32) float64 { /* floatscan.c:427:13: */
+ if __ccgo_strace {
+ trc("tls=%v f=%v prec=%v pok=%v, (%v:)", tls, f, prec, pok, origin(2))
+ }
var sign int32 = 1
var i size_t
var bits int32
@@ -4292,6 +4343,9 @@ var table = [257]uint8{Uint8FromInt32(-1),
} /* intscan.c:7:28 */
func X__intscan(tls *TLS, f uintptr, base uint32, pok int32, lim uint64) uint64 { /* intscan.c:26:20: */
+ if __ccgo_strace {
+ trc("tls=%v f=%v base=%v pok=%v lim=%v, (%v:)", tls, f, base, pok, lim, origin(2))
+ }
var val uintptr
var c int32
var neg int32
@@ -4597,6 +4651,9 @@ __43:
// the actual count.
func X__shlim(tls *TLS, f uintptr, lim off_t) { /* shgetc.c:8:6: */
+ if __ccgo_strace {
+ trc("tls=%v f=%v lim=%v, (%v:)", tls, f, lim, origin(2))
+ }
(*FILE)(unsafe.Pointer(f)).Fshlim = lim
(*FILE)(unsafe.Pointer(f)).Fshcnt = off_t((int32((*FILE)(unsafe.Pointer(f)).Fbuf) - int32((*FILE)(unsafe.Pointer(f)).Frpos)) / 1)
// If lim is nonzero, rend must be a valid pointer.
@@ -4608,6 +4665,9 @@ func X__shlim(tls *TLS, f uintptr, lim off_t) { /* shgetc.c:8:6: */
}
func X__shgetc(tls *TLS, f uintptr) int32 { /* shgetc.c:19:5: */
+ if __ccgo_strace {
+ trc("tls=%v f=%v, (%v:)", tls, f, origin(2))
+ }
var c int32
var cnt off_t = (*FILE)(unsafe.Pointer(f)).Fshcnt + off_t((int32((*FILE)(unsafe.Pointer(f)).Frpos)-int32((*FILE)(unsafe.Pointer(f)).Fbuf))/1)
if (*FILE)(unsafe.Pointer(f)).Fshlim != 0 && cnt >= (*FILE)(unsafe.Pointer(f)).Fshlim || AssignInt32(&c, X__uflow(tls, f)) < 0 {
@@ -4634,20 +4694,32 @@ func __bswap32(tls *TLS, __x uint32_t) uint32_t { /* endian.h:24:26: */
}
func Xcopysignl(tls *TLS, x float64, y float64) float64 { /* copysignl.c:4:13: */
+ if __ccgo_strace {
+ trc("tls=%v x=%v y=%v, (%v:)", tls, x, y, origin(2))
+ }
return Xcopysign(tls, x, y)
}
func Xfabsl(tls *TLS, x float64) float64 { /* fabsl.c:3:13: */
+ if __ccgo_strace {
+ trc("tls=%v x=%v, (%v:)", tls, x, origin(2))
+ }
return Xfabs(tls, x)
}
func Xfmodl(tls *TLS, x float64, y float64) float64 { /* fmodl.c:4:13: */
+ if __ccgo_strace {
+ trc("tls=%v x=%v y=%v, (%v:)", tls, x, y, origin(2))
+ }
return Xfmod(tls, x, y)
}
var toint double_t = float64(float64(1)) / 2.22044604925031308085e-16 /* rint.c:10:23 */
func Xrint(tls *TLS, x float64) float64 { /* rint.c:12:8: */
+ if __ccgo_strace {
+ trc("tls=%v x=%v, (%v:)", tls, x, origin(2))
+ }
bp := tls.Alloc(8)
defer tls.Free(8)
@@ -4677,6 +4749,9 @@ func Xrint(tls *TLS, x float64) float64 { /* rint.c:12:8: */
}
func Xscalbn(tls *TLS, x float64, n int32) float64 { /* scalbn.c:4:8: */
+ if __ccgo_strace {
+ trc("tls=%v x=%v n=%v, (%v:)", tls, x, n, origin(2))
+ }
bp := tls.Alloc(8)
defer tls.Free(8)
@@ -4713,6 +4788,9 @@ func Xscalbn(tls *TLS, x float64, n int32) float64 { /* scalbn.c:4:8: */
}
func Xscalbnl(tls *TLS, x float64, n int32) float64 { /* scalbnl.c:4:13: */
+ if __ccgo_strace {
+ trc("tls=%v x=%v n=%v, (%v:)", tls, x, n, origin(2))
+ }
return Xscalbn(tls, x, n)
}
@@ -5031,6 +5109,9 @@ type resolvconf = struct {
} /* lookup.h:34:1 */
func Xfreeaddrinfo(tls *TLS, p uintptr) { /* freeaddrinfo.c:7:6: */
+ if __ccgo_strace {
+ trc("tls=%v p=%v, (%v:)", tls, p, origin(2))
+ }
var cnt size_t
cnt = size_t(1)
__1:
@@ -5141,6 +5222,9 @@ type __ptcb = struct {
type useconds_t = uint32 /* alltypes.h:253:18 */
func Xgetaddrinfo(tls *TLS, host uintptr, serv uintptr, hint uintptr, res uintptr) int32 { /* getaddrinfo.c:12:5: */
+ if __ccgo_strace {
+ trc("tls=%v host=%v serv=%v hint=%v res=%v, (%v:)", tls, host, serv, hint, res, origin(2))
+ }
bp := tls.Alloc(1608)
defer tls.Free(1608)
@@ -5340,6 +5424,9 @@ type mmsghdr = struct {
} /* socket.h:63:1 */
func Xgethostbyaddr(tls *TLS, a uintptr, l socklen_t, af int32) uintptr { /* gethostbyaddr.c:7:16: */
+ if __ccgo_strace {
+ trc("tls=%v a=%v l=%v af=%v, (%v:)", tls, a, l, af, origin(2))
+ }
bp := tls.Alloc(4)
defer tls.Free(4)
@@ -5366,10 +5453,16 @@ func Xgethostbyaddr(tls *TLS, a uintptr, l socklen_t, af int32) uintptr { /* get
var _sh uintptr /* gethostbyaddr.c:9:24: */
func Xgethostbyname(tls *TLS, name uintptr) uintptr { /* gethostbyname.c:8:16: */
+ if __ccgo_strace {
+ trc("tls=%v name=%v, (%v:)", tls, name, origin(2))
+ }
return Xgethostbyname2(tls, name, 2)
}
func Xgethostbyname2(tls *TLS, name uintptr, af int32) uintptr { /* gethostbyname2.c:8:16: */
+ if __ccgo_strace {
+ trc("tls=%v name=%v af=%v, (%v:)", tls, name, af, origin(2))
+ }
bp := tls.Alloc(4)
defer tls.Free(4)
@@ -5396,6 +5489,9 @@ func Xgethostbyname2(tls *TLS, name uintptr, af int32) uintptr { /* gethostbynam
var _sh1 uintptr /* gethostbyname2.c:10:24: */
func Xgethostbyname2_r(tls *TLS, name uintptr, af int32, h uintptr, buf uintptr, buflen size_t, res uintptr, err uintptr) int32 { /* gethostbyname2_r.c:11:5: */
+ if __ccgo_strace {
+ trc("tls=%v name=%v af=%v h=%v buf=%v buflen=%v res=%v err=%v, (%v:)", tls, name, af, h, buf, buflen, res, err, origin(2))
+ }
bp := tls.Alloc(1600)
defer tls.Free(1600)
@@ -5774,10 +5870,16 @@ func reverse_services(tls *TLS, buf uintptr, port int32, dgram int32) { /* getna
var Xh_errno int32 /* h_errno.c:4:5: */
func X__h_errno_location(tls *TLS) uintptr { /* h_errno.c:6:5: */
+ if __ccgo_strace {
+ trc("tls=%v, (%v:)", tls, origin(2))
+ }
return uintptr(unsafe.Pointer(&Xh_errno))
}
func X__inet_aton(tls *TLS, s0 uintptr, dest uintptr) int32 { /* inet_aton.c:7:5: */
+ if __ccgo_strace {
+ trc("tls=%v s0=%v dest=%v, (%v:)", tls, s0, dest, origin(2))
+ }
bp := tls.Alloc(20)
defer tls.Free(20)
@@ -5829,6 +5931,9 @@ func X__inet_aton(tls *TLS, s0 uintptr, dest uintptr) int32 { /* inet_aton.c:7:5
}
func Xinet_ntop(tls *TLS, af int32, a0 uintptr, s uintptr, l socklen_t) uintptr { /* inet_ntop.c:7:12: */
+ if __ccgo_strace {
+ trc("tls=%v af=%v a0=%v s=%v l=%v, (%v:)", tls, af, a0, s, l, origin(2))
+ }
bp := tls.Alloc(276)
defer tls.Free(276)
@@ -5903,6 +6008,9 @@ func hexval(tls *TLS, c uint32) int32 { /* inet_pton.c:7:12: */
}
func Xinet_pton(tls *TLS, af int32, s uintptr, a0 uintptr) int32 { /* inet_pton.c:15:5: */
+ if __ccgo_strace {
+ trc("tls=%v af=%v s=%v a0=%v, (%v:)", tls, af, s, a0, origin(2))
+ }
bp := tls.Alloc(16)
defer tls.Free(16)
@@ -6000,6 +6108,9 @@ func Xinet_pton(tls *TLS, af int32, s uintptr, a0 uintptr) int32 { /* inet_pton.
}
func X__lookup_ipliteral(tls *TLS, buf uintptr, name uintptr, family int32) int32 { /* lookup_ipliteral.c:12:5: */
+ if __ccgo_strace {
+ trc("tls=%v buf=%v name=%v family=%v, (%v:)", tls, buf, name, family, origin(2))
+ }
bp := tls.Alloc(88)
defer tls.Free(88)
@@ -6321,6 +6432,9 @@ func addrcmp(tls *TLS, _a uintptr, _b uintptr) int32 { /* lookup_name.c:305:12:
}
func X__lookup_name(tls *TLS, buf uintptr, canon uintptr, name uintptr, family int32, flags int32) int32 { /* lookup_name.c:311:5: */
+ if __ccgo_strace {
+ trc("tls=%v buf=%v canon=%v name=%v family=%v flags=%v, (%v:)", tls, buf, canon, name, family, flags, origin(2))
+ }
bp := tls.Alloc(92)
defer tls.Free(92)
@@ -6487,6 +6601,9 @@ func X__lookup_name(tls *TLS, buf uintptr, canon uintptr, name uintptr, family i
}
func X__lookup_serv(tls *TLS, buf uintptr, name uintptr, proto int32, socktype int32, flags int32) int32 { /* lookup_serv.c:12:5: */
+ if __ccgo_strace {
+ trc("tls=%v buf=%v name=%v proto=%v socktype=%v flags=%v, (%v:)", tls, buf, name, proto, socktype, flags, origin(2))
+ }
bp := tls.Alloc(4)
defer tls.Free(4)
@@ -6612,6 +6729,9 @@ func X__lookup_serv(tls *TLS, buf uintptr, name uintptr, proto int32, socktype i
}
func X__toread(tls *TLS, f uintptr) int32 { /* __toread.c:3:5: */
+ if __ccgo_strace {
+ trc("tls=%v f=%v, (%v:)", tls, f, origin(2))
+ }
*(*int32)(unsafe.Pointer(f + 72)) |= (*FILE)(unsafe.Pointer(f)).Fmode - 1
if (*FILE)(unsafe.Pointer(f)).Fwpos != (*FILE)(unsafe.Pointer(f)).Fwbase {
(*struct {
@@ -6631,6 +6751,9 @@ func X__toread(tls *TLS, f uintptr) int32 { /* __toread.c:3:5: */
}
func X__toread_needs_stdio_exit(tls *TLS) { /* __toread.c:16:13: */
+ if __ccgo_strace {
+ trc("tls=%v, (%v:)", tls, origin(2))
+ }
X__builtin_abort(tls) //TODO-
// __stdio_exit_needed();
}
@@ -6639,6 +6762,9 @@ func X__toread_needs_stdio_exit(tls *TLS) { /* __toread.c:16:13: */
// data buffered for reading.
func X__uflow(tls *TLS, f uintptr) int32 { /* __uflow.c:6:5: */
+ if __ccgo_strace {
+ trc("tls=%v f=%v, (%v:)", tls, f, origin(2))
+ }
bp := tls.Alloc(1)
defer tls.Free(1)
@@ -6653,6 +6779,9 @@ func X__uflow(tls *TLS, f uintptr) int32 { /* __uflow.c:6:5: */
}
func Xbsearch(tls *TLS, key uintptr, base uintptr, nel size_t, width size_t, cmp uintptr) uintptr { /* bsearch.c:3:6: */
+ if __ccgo_strace {
+ trc("tls=%v key=%v base=%v nel=%v width=%v cmp=%v, (%v:)", tls, key, base, nel, width, cmp, origin(2))
+ }
var try uintptr
var sign int32
for nel > size_t(0) {
@@ -6695,14 +6824,23 @@ func strtox(tls *TLS, s uintptr, p uintptr, prec int32) float64 { /* strtod.c:6:
}
func Xstrtof(tls *TLS, s uintptr, p uintptr) float32 { /* strtod.c:17:7: */
+ if __ccgo_strace {
+ trc("tls=%v s=%v p=%v, (%v:)", tls, s, p, origin(2))
+ }
return float32(strtox(tls, s, p, 0))
}
func Xstrtod(tls *TLS, s uintptr, p uintptr) float64 { /* strtod.c:22:8: */
+ if __ccgo_strace {
+ trc("tls=%v s=%v p=%v, (%v:)", tls, s, p, origin(2))
+ }
return strtox(tls, s, p, 1)
}
func Xstrtold(tls *TLS, s uintptr, p uintptr) float64 { /* strtod.c:27:13: */
+ if __ccgo_strace {
+ trc("tls=%v s=%v p=%v, (%v:)", tls, s, p, origin(2))
+ }
return strtox(tls, s, p, 2)
}
@@ -6724,30 +6862,51 @@ func strtox1(tls *TLS, s uintptr, p uintptr, base int32, lim uint64) uint64 { /*
}
func Xstrtoull(tls *TLS, s uintptr, p uintptr, base int32) uint64 { /* strtol.c:21:20: */
+ if __ccgo_strace {
+ trc("tls=%v s=%v p=%v base=%v, (%v:)", tls, s, p, base, origin(2))
+ }
return strtox1(tls, s, p, base, 2*uint64(0x7fffffffffffffff)+uint64(1))
}
func Xstrtoll(tls *TLS, s uintptr, p uintptr, base int32) int64 { /* strtol.c:26:11: */
+ if __ccgo_strace {
+ trc("tls=%v s=%v p=%v base=%v, (%v:)", tls, s, p, base, origin(2))
+ }
return int64(strtox1(tls, s, p, base, Uint64FromInt64(-0x7fffffffffffffff-int64(1))))
}
func Xstrtoul(tls *TLS, s uintptr, p uintptr, base int32) uint32 { /* strtol.c:31:15: */
+ if __ccgo_strace {
+ trc("tls=%v s=%v p=%v base=%v, (%v:)", tls, s, p, base, origin(2))
+ }
return uint32(strtox1(tls, s, p, base, uint64(2*uint32(0x7fffffff)+uint32(1))))
}
func Xstrtol(tls *TLS, s uintptr, p uintptr, base int32) int32 { /* strtol.c:36:6: */
+ if __ccgo_strace {
+ trc("tls=%v s=%v p=%v base=%v, (%v:)", tls, s, p, base, origin(2))
+ }
return int32(strtox1(tls, s, p, base, uint64(0+Uint32FromInt32(Int32(-Int32(0x7fffffff))-Int32FromInt32(1)))))
}
func Xstrtoimax(tls *TLS, s uintptr, p uintptr, base int32) intmax_t { /* strtol.c:41:10: */
+ if __ccgo_strace {
+ trc("tls=%v s=%v p=%v base=%v, (%v:)", tls, s, p, base, origin(2))
+ }
return Xstrtoll(tls, s, p, base)
}
func Xstrtoumax(tls *TLS, s uintptr, p uintptr, base int32) uintmax_t { /* strtol.c:46:11: */
+ if __ccgo_strace {
+ trc("tls=%v s=%v p=%v base=%v, (%v:)", tls, s, p, base, origin(2))
+ }
return Xstrtoull(tls, s, p, base)
}
func Xstrdup(tls *TLS, s uintptr) uintptr { /* strdup.c:4:6: */
+ if __ccgo_strace {
+ trc("tls=%v s=%v, (%v:)", tls, s, origin(2))
+ }
var l size_t = Xstrlen(tls, s)
var d uintptr = Xmalloc(tls, l+size_t(1))
if !(d != 0) {
@@ -6757,6 +6916,9 @@ func Xstrdup(tls *TLS, s uintptr) uintptr { /* strdup.c:4:6: */
}
func Xstrnlen(tls *TLS, s uintptr, n size_t) size_t { /* strnlen.c:3:8: */
+ if __ccgo_strace {
+ trc("tls=%v s=%v n=%v, (%v:)", tls, s, n, origin(2))
+ }
var p uintptr = Xmemchr(tls, s, 0, n)
if p != 0 {
return uint32((int32(p) - int32(s)) / 1)
@@ -6765,6 +6927,9 @@ func Xstrnlen(tls *TLS, s uintptr, n size_t) size_t { /* strnlen.c:3:8: */
}
func Xstrspn(tls *TLS, s uintptr, c uintptr) size_t { /* strspn.c:6:8: */
+ if __ccgo_strace {
+ trc("tls=%v s=%v c=%v, (%v:)", tls, s, c, origin(2))
+ }
bp := tls.Alloc(32)
defer tls.Free(32)
diff --git a/vendor/modernc.org/libc/musl_freebsd_arm64.go b/vendor/modernc.org/libc/musl_freebsd_arm64.go
index ae1a70af..a301e3a3 100644
--- a/vendor/modernc.org/libc/musl_freebsd_arm64.go
+++ b/vendor/modernc.org/libc/musl_freebsd_arm64.go
@@ -3323,6 +3323,9 @@ func __isspace(tls *TLS, _c int32) int32 { /* ctype.h:26:21: */
type locale_t = uintptr /* alltypes.h:343:32 */
func Xisalnum(tls *TLS, c int32) int32 { /* isalnum.c:3:5: */
+ if __ccgo_strace {
+ trc("tls=%v c=%v, (%v:)", tls, c, origin(2))
+ }
return Bool32(func() int32 {
if 0 != 0 {
return Xisalpha(tls, c)
@@ -3337,58 +3340,100 @@ func Xisalnum(tls *TLS, c int32) int32 { /* isalnum.c:3:5: */
}
func X__isalnum_l(tls *TLS, c int32, l locale_t) int32 { /* isalnum.c:8:5: */
+ if __ccgo_strace {
+ trc("tls=%v c=%v l=%v, (%v:)", tls, c, l, origin(2))
+ }
return Xisalnum(tls, c)
}
func Xisalpha(tls *TLS, c int32) int32 { /* isalpha.c:4:5: */
+ if __ccgo_strace {
+ trc("tls=%v c=%v, (%v:)", tls, c, origin(2))
+ }
return Bool32(uint32(c)|uint32(32)-uint32('a') < uint32(26))
}
func X__isalpha_l(tls *TLS, c int32, l locale_t) int32 { /* isalpha.c:9:5: */
+ if __ccgo_strace {
+ trc("tls=%v c=%v l=%v, (%v:)", tls, c, l, origin(2))
+ }
return Xisalpha(tls, c)
}
func Xisdigit(tls *TLS, c int32) int32 { /* isdigit.c:4:5: */
+ if __ccgo_strace {
+ trc("tls=%v c=%v, (%v:)", tls, c, origin(2))
+ }
return Bool32(uint32(c)-uint32('0') < uint32(10))
}
func X__isdigit_l(tls *TLS, c int32, l locale_t) int32 { /* isdigit.c:9:5: */
+ if __ccgo_strace {
+ trc("tls=%v c=%v l=%v, (%v:)", tls, c, l, origin(2))
+ }
return Xisdigit(tls, c)
}
func Xislower(tls *TLS, c int32) int32 { /* islower.c:4:5: */
+ if __ccgo_strace {
+ trc("tls=%v c=%v, (%v:)", tls, c, origin(2))
+ }
return Bool32(uint32(c)-uint32('a') < uint32(26))
}
func X__islower_l(tls *TLS, c int32, l locale_t) int32 { /* islower.c:9:5: */
+ if __ccgo_strace {
+ trc("tls=%v c=%v l=%v, (%v:)", tls, c, l, origin(2))
+ }
return Xislower(tls, c)
}
func Xisprint(tls *TLS, c int32) int32 { /* isprint.c:4:5: */
+ if __ccgo_strace {
+ trc("tls=%v c=%v, (%v:)", tls, c, origin(2))
+ }
return Bool32(uint32(c)-uint32(0x20) < uint32(0x5f))
}
func X__isprint_l(tls *TLS, c int32, l locale_t) int32 { /* isprint.c:9:5: */
+ if __ccgo_strace {
+ trc("tls=%v c=%v l=%v, (%v:)", tls, c, l, origin(2))
+ }
return Xisprint(tls, c)
}
func Xisspace(tls *TLS, c int32) int32 { /* isspace.c:4:5: */
+ if __ccgo_strace {
+ trc("tls=%v c=%v, (%v:)", tls, c, origin(2))
+ }
return Bool32(c == ' ' || uint32(c)-uint32('\t') < uint32(5))
}
func X__isspace_l(tls *TLS, c int32, l locale_t) int32 { /* isspace.c:9:5: */
+ if __ccgo_strace {
+ trc("tls=%v c=%v l=%v, (%v:)", tls, c, l, origin(2))
+ }
return Xisspace(tls, c)
}
func Xisupper(tls *TLS, c int32) int32 { /* isupper.c:4:5: */
+ if __ccgo_strace {
+ trc("tls=%v c=%v, (%v:)", tls, c, origin(2))
+ }
return Bool32(uint32(c)-uint32('A') < uint32(26))
}
func X__isupper_l(tls *TLS, c int32, l locale_t) int32 { /* isupper.c:9:5: */
+ if __ccgo_strace {
+ trc("tls=%v c=%v l=%v, (%v:)", tls, c, l, origin(2))
+ }
return Xisupper(tls, c)
}
func Xisxdigit(tls *TLS, c int32) int32 { /* isxdigit.c:3:5: */
+ if __ccgo_strace {
+ trc("tls=%v c=%v, (%v:)", tls, c, origin(2))
+ }
return Bool32(func() int32 {
if 0 != 0 {
return Xisdigit(tls, c)
@@ -3398,6 +3443,9 @@ func Xisxdigit(tls *TLS, c int32) int32 { /* isxdigit.c:3:5: */
}
func X__isxdigit_l(tls *TLS, c int32, l locale_t) int32 { /* isxdigit.c:8:5: */
+ if __ccgo_strace {
+ trc("tls=%v c=%v l=%v, (%v:)", tls, c, l, origin(2))
+ }
return Xisxdigit(tls, c)
}
@@ -4119,6 +4167,9 @@ func hexfloat(tls *TLS, f uintptr, bits int32, emin int32, sign int32, pok int32
}
func X__floatscan(tls *TLS, f uintptr, prec int32, pok int32) float64 { /* floatscan.c:427:13: */
+ if __ccgo_strace {
+ trc("tls=%v f=%v prec=%v pok=%v, (%v:)", tls, f, prec, pok, origin(2))
+ }
var sign int32 = 1
var i size_t
var bits int32
@@ -4296,6 +4347,9 @@ var table = [257]uint8{Uint8FromInt32(-1),
} /* intscan.c:7:28 */
func X__intscan(tls *TLS, f uintptr, base uint32, pok int32, lim uint64) uint64 { /* intscan.c:26:20: */
+ if __ccgo_strace {
+ trc("tls=%v f=%v base=%v pok=%v lim=%v, (%v:)", tls, f, base, pok, lim, origin(2))
+ }
var val uintptr
var c int32
var neg int32
@@ -4601,6 +4655,9 @@ __43:
// the actual count.
func X__shlim(tls *TLS, f uintptr, lim off_t) { /* shgetc.c:8:6: */
+ if __ccgo_strace {
+ trc("tls=%v f=%v lim=%v, (%v:)", tls, f, lim, origin(2))
+ }
(*FILE)(unsafe.Pointer(f)).Fshlim = lim
(*FILE)(unsafe.Pointer(f)).Fshcnt = (int64((*FILE)(unsafe.Pointer(f)).Fbuf) - int64((*FILE)(unsafe.Pointer(f)).Frpos)) / 1
// If lim is nonzero, rend must be a valid pointer.
@@ -4612,6 +4669,9 @@ func X__shlim(tls *TLS, f uintptr, lim off_t) { /* shgetc.c:8:6: */
}
func X__shgetc(tls *TLS, f uintptr) int32 { /* shgetc.c:19:5: */
+ if __ccgo_strace {
+ trc("tls=%v f=%v, (%v:)", tls, f, origin(2))
+ }
var c int32
var cnt off_t = (*FILE)(unsafe.Pointer(f)).Fshcnt + (int64((*FILE)(unsafe.Pointer(f)).Frpos)-int64((*FILE)(unsafe.Pointer(f)).Fbuf))/1
if (*FILE)(unsafe.Pointer(f)).Fshlim != 0 && cnt >= (*FILE)(unsafe.Pointer(f)).Fshlim || AssignInt32(&c, X__uflow(tls, f)) < 0 {
@@ -4638,20 +4698,32 @@ func __bswap32(tls *TLS, __x uint32_t) uint32_t { /* endian.h:24:26: */
}
func Xcopysignl(tls *TLS, x float64, y float64) float64 { /* copysignl.c:4:13: */
+ if __ccgo_strace {
+ trc("tls=%v x=%v y=%v, (%v:)", tls, x, y, origin(2))
+ }
return Xcopysign(tls, x, y)
}
func Xfabsl(tls *TLS, x float64) float64 { /* fabsl.c:3:13: */
+ if __ccgo_strace {
+ trc("tls=%v x=%v, (%v:)", tls, x, origin(2))
+ }
return Xfabs(tls, x)
}
func Xfmodl(tls *TLS, x float64, y float64) float64 { /* fmodl.c:4:13: */
+ if __ccgo_strace {
+ trc("tls=%v x=%v y=%v, (%v:)", tls, x, y, origin(2))
+ }
return Xfmod(tls, x, y)
}
var toint double_t = float64(float64(1)) / 2.22044604925031308085e-16 /* rint.c:10:23 */
func Xrint(tls *TLS, x float64) float64 { /* rint.c:12:8: */
+ if __ccgo_strace {
+ trc("tls=%v x=%v, (%v:)", tls, x, origin(2))
+ }
bp := tls.Alloc(8)
defer tls.Free(8)
@@ -4681,6 +4753,9 @@ func Xrint(tls *TLS, x float64) float64 { /* rint.c:12:8: */
}
func Xscalbn(tls *TLS, x float64, n int32) float64 { /* scalbn.c:4:8: */
+ if __ccgo_strace {
+ trc("tls=%v x=%v n=%v, (%v:)", tls, x, n, origin(2))
+ }
bp := tls.Alloc(8)
defer tls.Free(8)
@@ -4717,6 +4792,9 @@ func Xscalbn(tls *TLS, x float64, n int32) float64 { /* scalbn.c:4:8: */
}
func Xscalbnl(tls *TLS, x float64, n int32) float64 { /* scalbnl.c:4:13: */
+ if __ccgo_strace {
+ trc("tls=%v x=%v n=%v, (%v:)", tls, x, n, origin(2))
+ }
return Xscalbn(tls, x, n)
}
@@ -5048,6 +5126,9 @@ type resolvconf = struct {
} /* lookup.h:34:1 */
func Xfreeaddrinfo(tls *TLS, p uintptr) { /* freeaddrinfo.c:7:6: */
+ if __ccgo_strace {
+ trc("tls=%v p=%v, (%v:)", tls, p, origin(2))
+ }
var cnt size_t
cnt = uint64(1)
__1:
@@ -5185,6 +5266,9 @@ type __ptcb = struct {
type useconds_t = uint32 /* alltypes.h:260:18 */
func Xgetaddrinfo(tls *TLS, host uintptr, serv uintptr, hint uintptr, res uintptr) int32 { /* getaddrinfo.c:12:5: */
+ if __ccgo_strace {
+ trc("tls=%v host=%v serv=%v hint=%v res=%v, (%v:)", tls, host, serv, hint, res, origin(2))
+ }
bp := tls.Alloc(1608)
defer tls.Free(1608)
@@ -5389,6 +5473,9 @@ type mmsghdr = struct {
} /* socket.h:63:1 */
func Xgethostbyaddr(tls *TLS, a uintptr, l socklen_t, af int32) uintptr { /* gethostbyaddr.c:7:16: */
+ if __ccgo_strace {
+ trc("tls=%v a=%v l=%v af=%v, (%v:)", tls, a, l, af, origin(2))
+ }
bp := tls.Alloc(8)
defer tls.Free(8)
@@ -5415,10 +5502,16 @@ func Xgethostbyaddr(tls *TLS, a uintptr, l socklen_t, af int32) uintptr { /* get
var _sh uintptr /* gethostbyaddr.c:9:24: */
func Xgethostbyname(tls *TLS, name uintptr) uintptr { /* gethostbyname.c:8:16: */
+ if __ccgo_strace {
+ trc("tls=%v name=%v, (%v:)", tls, name, origin(2))
+ }
return Xgethostbyname2(tls, name, 2)
}
func Xgethostbyname2(tls *TLS, name uintptr, af int32) uintptr { /* gethostbyname2.c:8:16: */
+ if __ccgo_strace {
+ trc("tls=%v name=%v af=%v, (%v:)", tls, name, af, origin(2))
+ }
bp := tls.Alloc(8)
defer tls.Free(8)
@@ -5445,6 +5538,9 @@ func Xgethostbyname2(tls *TLS, name uintptr, af int32) uintptr { /* gethostbynam
var _sh1 uintptr /* gethostbyname2.c:10:24: */
func Xgethostbyname2_r(tls *TLS, name uintptr, af int32, h uintptr, buf uintptr, buflen size_t, res uintptr, err uintptr) int32 { /* gethostbyname2_r.c:11:5: */
+ if __ccgo_strace {
+ trc("tls=%v name=%v af=%v h=%v buf=%v buflen=%v res=%v err=%v, (%v:)", tls, name, af, h, buf, buflen, res, err, origin(2))
+ }
bp := tls.Alloc(1600)
defer tls.Free(1600)
@@ -5833,10 +5929,16 @@ func reverse_services(tls *TLS, buf uintptr, port int32, dgram int32) { /* getna
var Xh_errno int32 /* h_errno.c:4:5: */
func X__h_errno_location(tls *TLS) uintptr { /* h_errno.c:6:5: */
+ if __ccgo_strace {
+ trc("tls=%v, (%v:)", tls, origin(2))
+ }
return uintptr(unsafe.Pointer(&Xh_errno))
}
func X__inet_aton(tls *TLS, s0 uintptr, dest uintptr) int32 { /* inet_aton.c:7:5: */
+ if __ccgo_strace {
+ trc("tls=%v s0=%v dest=%v, (%v:)", tls, s0, dest, origin(2))
+ }
bp := tls.Alloc(40)
defer tls.Free(40)
@@ -5888,6 +5990,9 @@ func X__inet_aton(tls *TLS, s0 uintptr, dest uintptr) int32 { /* inet_aton.c:7:5
}
func Xinet_ntop(tls *TLS, af int32, a0 uintptr, s uintptr, l socklen_t) uintptr { /* inet_ntop.c:7:12: */
+ if __ccgo_strace {
+ trc("tls=%v af=%v a0=%v s=%v l=%v, (%v:)", tls, af, a0, s, l, origin(2))
+ }
bp := tls.Alloc(276)
defer tls.Free(276)
@@ -5962,6 +6067,9 @@ func hexval(tls *TLS, c uint32) int32 { /* inet_pton.c:7:12: */
}
func Xinet_pton(tls *TLS, af int32, s uintptr, a0 uintptr) int32 { /* inet_pton.c:15:5: */
+ if __ccgo_strace {
+ trc("tls=%v af=%v s=%v a0=%v, (%v:)", tls, af, s, a0, origin(2))
+ }
bp := tls.Alloc(16)
defer tls.Free(16)
@@ -6059,6 +6167,9 @@ func Xinet_pton(tls *TLS, af int32, s uintptr, a0 uintptr) int32 { /* inet_pton.
}
func X__lookup_ipliteral(tls *TLS, buf uintptr, name uintptr, family int32) int32 { /* lookup_ipliteral.c:12:5: */
+ if __ccgo_strace {
+ trc("tls=%v buf=%v name=%v family=%v, (%v:)", tls, buf, name, family, origin(2))
+ }
bp := tls.Alloc(96)
defer tls.Free(96)
@@ -6381,6 +6492,9 @@ func addrcmp(tls *TLS, _a uintptr, _b uintptr) int32 { /* lookup_name.c:305:12:
}
func X__lookup_name(tls *TLS, buf uintptr, canon uintptr, name uintptr, family int32, flags int32) int32 { /* lookup_name.c:311:5: */
+ if __ccgo_strace {
+ trc("tls=%v buf=%v canon=%v name=%v family=%v flags=%v, (%v:)", tls, buf, canon, name, family, flags, origin(2))
+ }
bp := tls.Alloc(92)
defer tls.Free(92)
@@ -6547,6 +6661,9 @@ func X__lookup_name(tls *TLS, buf uintptr, canon uintptr, name uintptr, family i
}
func X__lookup_serv(tls *TLS, buf uintptr, name uintptr, proto int32, socktype int32, flags int32) int32 { /* lookup_serv.c:12:5: */
+ if __ccgo_strace {
+ trc("tls=%v buf=%v name=%v proto=%v socktype=%v flags=%v, (%v:)", tls, buf, name, proto, socktype, flags, origin(2))
+ }
bp := tls.Alloc(8)
defer tls.Free(8)
@@ -6672,6 +6789,9 @@ func X__lookup_serv(tls *TLS, buf uintptr, name uintptr, proto int32, socktype i
}
func X__toread(tls *TLS, f uintptr) int32 { /* __toread.c:3:5: */
+ if __ccgo_strace {
+ trc("tls=%v f=%v, (%v:)", tls, f, origin(2))
+ }
*(*int32)(unsafe.Pointer(f + 136)) |= (*FILE)(unsafe.Pointer(f)).Fmode - 1
if (*FILE)(unsafe.Pointer(f)).Fwpos != (*FILE)(unsafe.Pointer(f)).Fwbase {
(*struct {
@@ -6691,6 +6811,9 @@ func X__toread(tls *TLS, f uintptr) int32 { /* __toread.c:3:5: */
}
func X__toread_needs_stdio_exit(tls *TLS) { /* __toread.c:16:13: */
+ if __ccgo_strace {
+ trc("tls=%v, (%v:)", tls, origin(2))
+ }
X__builtin_abort(tls) //TODO-
// __stdio_exit_needed();
}
@@ -6699,6 +6822,9 @@ func X__toread_needs_stdio_exit(tls *TLS) { /* __toread.c:16:13: */
// data buffered for reading.
func X__uflow(tls *TLS, f uintptr) int32 { /* __uflow.c:6:5: */
+ if __ccgo_strace {
+ trc("tls=%v f=%v, (%v:)", tls, f, origin(2))
+ }
bp := tls.Alloc(1)
defer tls.Free(1)
@@ -6713,6 +6839,9 @@ func X__uflow(tls *TLS, f uintptr) int32 { /* __uflow.c:6:5: */
}
func Xbsearch(tls *TLS, key uintptr, base uintptr, nel size_t, width size_t, cmp uintptr) uintptr { /* bsearch.c:3:6: */
+ if __ccgo_strace {
+ trc("tls=%v key=%v base=%v nel=%v width=%v cmp=%v, (%v:)", tls, key, base, nel, width, cmp, origin(2))
+ }
var try uintptr
var sign int32
for nel > uint64(0) {
@@ -6755,14 +6884,23 @@ func strtox(tls *TLS, s uintptr, p uintptr, prec int32) float64 { /* strtod.c:6:
}
func Xstrtof(tls *TLS, s uintptr, p uintptr) float32 { /* strtod.c:17:7: */
+ if __ccgo_strace {
+ trc("tls=%v s=%v p=%v, (%v:)", tls, s, p, origin(2))
+ }
return float32(strtox(tls, s, p, 0))
}
func Xstrtod(tls *TLS, s uintptr, p uintptr) float64 { /* strtod.c:22:8: */
+ if __ccgo_strace {
+ trc("tls=%v s=%v p=%v, (%v:)", tls, s, p, origin(2))
+ }
return strtox(tls, s, p, 1)
}
func Xstrtold(tls *TLS, s uintptr, p uintptr) float64 { /* strtod.c:27:13: */
+ if __ccgo_strace {
+ trc("tls=%v s=%v p=%v, (%v:)", tls, s, p, origin(2))
+ }
return strtox(tls, s, p, 2)
}
@@ -6784,30 +6922,51 @@ func strtox1(tls *TLS, s uintptr, p uintptr, base int32, lim uint64) uint64 { /*
}
func Xstrtoull(tls *TLS, s uintptr, p uintptr, base int32) uint64 { /* strtol.c:21:20: */
+ if __ccgo_strace {
+ trc("tls=%v s=%v p=%v base=%v, (%v:)", tls, s, p, base, origin(2))
+ }
return strtox1(tls, s, p, base, 2*uint64(0x7fffffffffffffff)+uint64(1))
}
func Xstrtoll(tls *TLS, s uintptr, p uintptr, base int32) int64 { /* strtol.c:26:11: */
+ if __ccgo_strace {
+ trc("tls=%v s=%v p=%v base=%v, (%v:)", tls, s, p, base, origin(2))
+ }
return int64(strtox1(tls, s, p, base, Uint64FromInt64(-0x7fffffffffffffff-int64(1))))
}
func Xstrtoul(tls *TLS, s uintptr, p uintptr, base int32) uint64 { /* strtol.c:31:15: */
+ if __ccgo_strace {
+ trc("tls=%v s=%v p=%v base=%v, (%v:)", tls, s, p, base, origin(2))
+ }
return uint64(strtox1(tls, s, p, base, 2*uint64(0x7fffffffffffffff)+uint64(1)))
}
func Xstrtol(tls *TLS, s uintptr, p uintptr, base int32) int64 { /* strtol.c:36:6: */
+ if __ccgo_strace {
+ trc("tls=%v s=%v p=%v base=%v, (%v:)", tls, s, p, base, origin(2))
+ }
return int64(strtox1(tls, s, p, base, 0+Uint64FromInt64(Int64(-Int64(0x7fffffffffffffff))-Int64FromInt32(1))))
}
func Xstrtoimax(tls *TLS, s uintptr, p uintptr, base int32) intmax_t { /* strtol.c:41:10: */
+ if __ccgo_strace {
+ trc("tls=%v s=%v p=%v base=%v, (%v:)", tls, s, p, base, origin(2))
+ }
return intmax_t(Xstrtoll(tls, s, p, base))
}
func Xstrtoumax(tls *TLS, s uintptr, p uintptr, base int32) uintmax_t { /* strtol.c:46:11: */
+ if __ccgo_strace {
+ trc("tls=%v s=%v p=%v base=%v, (%v:)", tls, s, p, base, origin(2))
+ }
return uintmax_t(Xstrtoull(tls, s, p, base))
}
func Xstrdup(tls *TLS, s uintptr) uintptr { /* strdup.c:4:6: */
+ if __ccgo_strace {
+ trc("tls=%v s=%v, (%v:)", tls, s, origin(2))
+ }
var l size_t = Xstrlen(tls, s)
var d uintptr = Xmalloc(tls, l+uint64(1))
if !(d != 0) {
@@ -6817,6 +6976,9 @@ func Xstrdup(tls *TLS, s uintptr) uintptr { /* strdup.c:4:6: */
}
func Xstrnlen(tls *TLS, s uintptr, n size_t) size_t { /* strnlen.c:3:8: */
+ if __ccgo_strace {
+ trc("tls=%v s=%v n=%v, (%v:)", tls, s, n, origin(2))
+ }
var p uintptr = Xmemchr(tls, s, 0, n)
if p != 0 {
return uint64((int64(p) - int64(s)) / 1)
@@ -6825,6 +6987,9 @@ func Xstrnlen(tls *TLS, s uintptr, n size_t) size_t { /* strnlen.c:3:8: */
}
func Xstrspn(tls *TLS, s uintptr, c uintptr) size_t { /* strspn.c:6:8: */
+ if __ccgo_strace {
+ trc("tls=%v s=%v c=%v, (%v:)", tls, s, c, origin(2))
+ }
bp := tls.Alloc(32)
defer tls.Free(32)
diff --git a/vendor/modernc.org/libc/musl_linux_386.go b/vendor/modernc.org/libc/musl_linux_386.go
index 3b730c21..3fc9b3ba 100644
--- a/vendor/modernc.org/libc/musl_linux_386.go
+++ b/vendor/modernc.org/libc/musl_linux_386.go
@@ -403,6 +403,9 @@ var table = [384]uint16{
var ptable uintptr = 0 /* __ctype_b_loc.c:36:29 */
func X__ctype_b_loc(tls *TLS) uintptr { /* __ctype_b_loc.c:38:22: */
+ if __ccgo_strace {
+ trc("tls=%v, (%v:)", tls, origin(2))
+ }
return uintptr(unsafe.Pointer(&ptable))
}
@@ -415,6 +418,9 @@ type __locale_struct = struct{ cat [6]uintptr } /* alltypes.h:366:9 */
type locale_t = uintptr /* alltypes.h:366:32 */
func Xisalnum(tls *TLS, c int32) int32 { /* isalnum.c:3:5: */
+ if __ccgo_strace {
+ trc("tls=%v c=%v, (%v:)", tls, c, origin(2))
+ }
return Bool32(func() int32 {
if 0 != 0 {
return Xisalpha(tls, c)
@@ -429,50 +435,86 @@ func Xisalnum(tls *TLS, c int32) int32 { /* isalnum.c:3:5: */
}
func X__isalnum_l(tls *TLS, c int32, l locale_t) int32 { /* isalnum.c:8:5: */
+ if __ccgo_strace {
+ trc("tls=%v c=%v l=%v, (%v:)", tls, c, l, origin(2))
+ }
return Xisalnum(tls, c)
}
func Xisalpha(tls *TLS, c int32) int32 { /* isalpha.c:4:5: */
+ if __ccgo_strace {
+ trc("tls=%v c=%v, (%v:)", tls, c, origin(2))
+ }
return Bool32(uint32(c)|uint32(32)-uint32('a') < uint32(26))
}
func X__isalpha_l(tls *TLS, c int32, l locale_t) int32 { /* isalpha.c:9:5: */
+ if __ccgo_strace {
+ trc("tls=%v c=%v l=%v, (%v:)", tls, c, l, origin(2))
+ }
return Xisalpha(tls, c)
}
func Xisdigit(tls *TLS, c int32) int32 { /* isdigit.c:4:5: */
+ if __ccgo_strace {
+ trc("tls=%v c=%v, (%v:)", tls, c, origin(2))
+ }
return Bool32(uint32(c)-uint32('0') < uint32(10))
}
func X__isdigit_l(tls *TLS, c int32, l locale_t) int32 { /* isdigit.c:9:5: */
+ if __ccgo_strace {
+ trc("tls=%v c=%v l=%v, (%v:)", tls, c, l, origin(2))
+ }
return Xisdigit(tls, c)
}
func Xislower(tls *TLS, c int32) int32 { /* islower.c:4:5: */
+ if __ccgo_strace {
+ trc("tls=%v c=%v, (%v:)", tls, c, origin(2))
+ }
return Bool32(uint32(c)-uint32('a') < uint32(26))
}
func X__islower_l(tls *TLS, c int32, l locale_t) int32 { /* islower.c:9:5: */
+ if __ccgo_strace {
+ trc("tls=%v c=%v l=%v, (%v:)", tls, c, l, origin(2))
+ }
return Xislower(tls, c)
}
func Xisprint(tls *TLS, c int32) int32 { /* isprint.c:4:5: */
+ if __ccgo_strace {
+ trc("tls=%v c=%v, (%v:)", tls, c, origin(2))
+ }
return Bool32(uint32(c)-uint32(0x20) < uint32(0x5f))
}
func X__isprint_l(tls *TLS, c int32, l locale_t) int32 { /* isprint.c:9:5: */
+ if __ccgo_strace {
+ trc("tls=%v c=%v l=%v, (%v:)", tls, c, l, origin(2))
+ }
return Xisprint(tls, c)
}
func Xisupper(tls *TLS, c int32) int32 { /* isupper.c:4:5: */
+ if __ccgo_strace {
+ trc("tls=%v c=%v, (%v:)", tls, c, origin(2))
+ }
return Bool32(uint32(c)-uint32('A') < uint32(26))
}
func X__isupper_l(tls *TLS, c int32, l locale_t) int32 { /* isupper.c:9:5: */
+ if __ccgo_strace {
+ trc("tls=%v c=%v l=%v, (%v:)", tls, c, l, origin(2))
+ }
return Xisupper(tls, c)
}
func Xisxdigit(tls *TLS, c int32) int32 { /* isxdigit.c:3:5: */
+ if __ccgo_strace {
+ trc("tls=%v c=%v, (%v:)", tls, c, origin(2))
+ }
return Bool32(func() int32 {
if 0 != 0 {
return Xisdigit(tls, c)
@@ -482,6 +524,9 @@ func Xisxdigit(tls *TLS, c int32) int32 { /* isxdigit.c:3:5: */
}
func X__isxdigit_l(tls *TLS, c int32, l locale_t) int32 { /* isxdigit.c:8:5: */
+ if __ccgo_strace {
+ trc("tls=%v c=%v l=%v, (%v:)", tls, c, l, origin(2))
+ }
return Xisxdigit(tls, c)
}
@@ -535,6 +580,9 @@ type lldiv_t = struct {
} /* stdlib.h:64:41 */
func Xclosedir(tls *TLS, dir uintptr) int32 { /* closedir.c:6:5: */
+ if __ccgo_strace {
+ trc("tls=%v dir=%v, (%v:)", tls, dir, origin(2))
+ }
var ret int32 = Xclose(tls, (*DIR)(unsafe.Pointer(dir)).fd)
Xfree(tls, dir)
return ret
@@ -569,6 +617,9 @@ type f_owner_ex = struct {
type syscall_arg_t = int32 /* syscall.h:22:14 */
func Xopendir(tls *TLS, name uintptr) uintptr { /* opendir.c:8:5: */
+ if __ccgo_strace {
+ trc("tls=%v name=%v, (%v:)", tls, name, origin(2))
+ }
var fd int32
var dir uintptr
@@ -591,6 +642,9 @@ type max_align_t = struct {
type dirstream_buf_alignment_check = [1]int8 /* readdir.c:7:14 */
func Xreaddir(tls *TLS, dir uintptr) uintptr { /* readdir.c:10:15: */
+ if __ccgo_strace {
+ trc("tls=%v dir=%v, (%v:)", tls, dir, origin(2))
+ }
var de uintptr
if (*DIR)(unsafe.Pointer(dir)).buf_pos >= (*DIR)(unsafe.Pointer(dir)).buf_end {
@@ -1350,6 +1404,9 @@ func hexfloat(tls *TLS, f uintptr, bits int32, emin int32, sign int32, pok int32
}
func X__floatscan(tls *TLS, f uintptr, prec int32, pok int32) float64 { /* floatscan.c:427:13: */
+ if __ccgo_strace {
+ trc("tls=%v f=%v prec=%v pok=%v, (%v:)", tls, f, prec, pok, origin(2))
+ }
var sign int32 = 1
var i size_t
var bits int32
@@ -1527,6 +1584,9 @@ var table1 = [257]uint8{Uint8FromInt32(-1),
} /* intscan.c:7:28 */
func X__intscan(tls *TLS, f uintptr, base uint32, pok int32, lim uint64) uint64 { /* intscan.c:26:20: */
+ if __ccgo_strace {
+ trc("tls=%v f=%v base=%v pok=%v lim=%v, (%v:)", tls, f, base, pok, lim, origin(2))
+ }
var val uintptr
var c int32
var neg int32
@@ -1832,6 +1892,9 @@ __43:
// the actual count.
func X__shlim(tls *TLS, f uintptr, lim off_t) { /* shgetc.c:8:6: */
+ if __ccgo_strace {
+ trc("tls=%v f=%v lim=%v, (%v:)", tls, f, lim, origin(2))
+ }
(*FILE)(unsafe.Pointer(f)).shlim = lim
(*FILE)(unsafe.Pointer(f)).shcnt = off_t((int32((*FILE)(unsafe.Pointer(f)).buf) - int32((*FILE)(unsafe.Pointer(f)).rpos)) / 1)
// If lim is nonzero, rend must be a valid pointer.
@@ -1843,6 +1906,9 @@ func X__shlim(tls *TLS, f uintptr, lim off_t) { /* shgetc.c:8:6: */
}
func X__shgetc(tls *TLS, f uintptr) int32 { /* shgetc.c:19:5: */
+ if __ccgo_strace {
+ trc("tls=%v f=%v, (%v:)", tls, f, origin(2))
+ }
var c int32
var cnt off_t = (*FILE)(unsafe.Pointer(f)).shcnt + off_t((int32((*FILE)(unsafe.Pointer(f)).rpos)-int32((*FILE)(unsafe.Pointer(f)).buf))/1)
if (*FILE)(unsafe.Pointer(f)).shlim != 0 && cnt >= (*FILE)(unsafe.Pointer(f)).shlim || AssignInt32(&c, X__uflow(tls, f)) < 0 {
@@ -1904,10 +1970,16 @@ type lconv = struct {
var posix_lconv = lconv{decimal_point: ts + 23, thousands_sep: ts + 13, grouping: ts + 13, int_curr_symbol: ts + 13, currency_symbol: ts + 13, mon_decimal_point: ts + 13, mon_thousands_sep: ts + 13, mon_grouping: ts + 13, positive_sign: ts + 13, negative_sign: ts + 13, int_frac_digits: Int8FromInt32(255), frac_digits: Int8FromInt32(255), p_cs_precedes: Int8FromInt32(255), p_sep_by_space: Int8FromInt32(255), n_cs_precedes: Int8FromInt32(255), n_sep_by_space: Int8FromInt32(255), p_sign_posn: Int8FromInt32(255), n_sign_posn: Int8FromInt32(255), int_p_cs_precedes: Int8FromInt32(255), int_p_sep_by_space: Int8FromInt32(255), int_n_cs_precedes: Int8FromInt32(255), int_n_sep_by_space: Int8FromInt32(255), int_p_sign_posn: Int8FromInt32(255), int_n_sign_posn: Int8FromInt32(255)} /* localeconv.c:4:27 */
func Xlocaleconv(tls *TLS) uintptr { /* localeconv.c:31:14: */
+ if __ccgo_strace {
+ trc("tls=%v, (%v:)", tls, origin(2))
+ }
return uintptr(unsafe.Pointer(&posix_lconv))
}
func X__fpclassify(tls *TLS, x float64) int32 { /* __fpclassify.c:4:5: */
+ if __ccgo_strace {
+ trc("tls=%v x=%v, (%v:)", tls, x, origin(2))
+ }
bp := tls.Alloc(8)
defer tls.Free(8)
@@ -1932,6 +2004,9 @@ func X__fpclassify(tls *TLS, x float64) int32 { /* __fpclassify.c:4:5: */
}
func X__fpclassifyf(tls *TLS, x float32) int32 { /* __fpclassifyf.c:4:5: */
+ if __ccgo_strace {
+ trc("tls=%v x=%v, (%v:)", tls, x, origin(2))
+ }
bp := tls.Alloc(4)
defer tls.Free(4)
@@ -1956,28 +2031,46 @@ func X__fpclassifyf(tls *TLS, x float32) int32 { /* __fpclassifyf.c:4:5: */
}
func X__fpclassifyl(tls *TLS, x float64) int32 { /* __fpclassifyl.c:4:5: */
+ if __ccgo_strace {
+ trc("tls=%v x=%v, (%v:)", tls, x, origin(2))
+ }
return X__fpclassify(tls, x)
}
func Xcopysignl(tls *TLS, x float64, y float64) float64 { /* copysignl.c:4:13: */
+ if __ccgo_strace {
+ trc("tls=%v x=%v y=%v, (%v:)", tls, x, y, origin(2))
+ }
return Xcopysign(tls, x, y)
}
func Xfabsl(tls *TLS, x float64) float64 { /* fabsl.c:3:13: */
+ if __ccgo_strace {
+ trc("tls=%v x=%v, (%v:)", tls, x, origin(2))
+ }
return Xfabs(tls, x)
}
func Xfmodl(tls *TLS, x float64, y float64) float64 { /* fmodl.c:4:13: */
+ if __ccgo_strace {
+ trc("tls=%v x=%v y=%v, (%v:)", tls, x, y, origin(2))
+ }
return Xfmod(tls, x, y)
}
func Xnanf(tls *TLS, s uintptr) float32 { /* nanf.c:3:7: */
+ if __ccgo_strace {
+ trc("tls=%v s=%v, (%v:)", tls, s, origin(2))
+ }
return X__builtin_nanf(tls, ts+13)
}
var toint double_t = float64(float64(1)) / 2.22044604925031308085e-16 /* rint.c:10:23 */
func Xrint(tls *TLS, x float64) float64 { /* rint.c:12:8: */
+ if __ccgo_strace {
+ trc("tls=%v x=%v, (%v:)", tls, x, origin(2))
+ }
bp := tls.Alloc(8)
defer tls.Free(8)
@@ -2007,6 +2100,9 @@ func Xrint(tls *TLS, x float64) float64 { /* rint.c:12:8: */
}
func Xscalbn(tls *TLS, x float64, n int32) float64 { /* scalbn.c:4:8: */
+ if __ccgo_strace {
+ trc("tls=%v x=%v n=%v, (%v:)", tls, x, n, origin(2))
+ }
bp := tls.Alloc(8)
defer tls.Free(8)
@@ -2043,6 +2139,9 @@ func Xscalbn(tls *TLS, x float64, n int32) float64 { /* scalbn.c:4:8: */
}
func Xscalbnl(tls *TLS, x float64, n int32) float64 { /* scalbnl.c:4:13: */
+ if __ccgo_strace {
+ trc("tls=%v x=%v n=%v, (%v:)", tls, x, n, origin(2))
+ }
return Xscalbn(tls, x, n)
}
@@ -3360,6 +3459,9 @@ type __mbstate_t = struct {
type mbstate_t = __mbstate_t /* alltypes.h:360:63 */
func Xmbrtowc(tls *TLS, wc uintptr, src uintptr, n size_t, st uintptr) size_t { /* mbrtowc.c:6:8: */
+ if __ccgo_strace {
+ trc("tls=%v wc=%v src=%v n=%v st=%v, (%v:)", tls, wc, src, n, st, origin(2))
+ }
bp := tls.Alloc(4)
defer tls.Free(4)
@@ -3483,6 +3585,9 @@ ilseq:
var _sinternal_state uint32 /* mbrtowc.c:8:18: */
func Xmbsinit(tls *TLS, st uintptr) int32 { /* mbsinit.c:3:5: */
+ if __ccgo_strace {
+ trc("tls=%v st=%v, (%v:)", tls, st, origin(2))
+ }
return Bool32(!(st != 0) || !(int32(*(*uint32)(unsafe.Pointer(st))) != 0))
}
@@ -3772,6 +3877,9 @@ type resolvconf = struct {
} /* lookup.h:34:1 */
func Xfreeaddrinfo(tls *TLS, p uintptr) { /* freeaddrinfo.c:7:6: */
+ if __ccgo_strace {
+ trc("tls=%v p=%v, (%v:)", tls, p, origin(2))
+ }
var cnt size_t
cnt = size_t(1)
__1:
@@ -3796,6 +3904,9 @@ __3:
}
func Xgetaddrinfo(tls *TLS, host uintptr, serv uintptr, hint uintptr, res uintptr) int32 { /* getaddrinfo.c:12:5: */
+ if __ccgo_strace {
+ trc("tls=%v host=%v serv=%v hint=%v res=%v, (%v:)", tls, host, serv, hint, res, origin(2))
+ }
bp := tls.Alloc(1608)
defer tls.Free(1608)
@@ -3995,6 +4106,9 @@ type mmsghdr = struct {
} /* socket.h:63:1 */
func Xgethostbyaddr(tls *TLS, a uintptr, l socklen_t, af int32) uintptr { /* gethostbyaddr.c:7:16: */
+ if __ccgo_strace {
+ trc("tls=%v a=%v l=%v af=%v, (%v:)", tls, a, l, af, origin(2))
+ }
bp := tls.Alloc(4)
defer tls.Free(4)
@@ -4021,6 +4135,9 @@ func Xgethostbyaddr(tls *TLS, a uintptr, l socklen_t, af int32) uintptr { /* get
var _sh uintptr /* gethostbyaddr.c:9:24: */
func Xgethostbyaddr_r(tls *TLS, a uintptr, l socklen_t, af int32, h uintptr, buf uintptr, buflen size_t, res uintptr, err uintptr) int32 { /* gethostbyaddr_r.c:10:5: */
+ if __ccgo_strace {
+ trc("tls=%v a=%v l=%v af=%v h=%v buf=%v buflen=%v res=%v err=%v, (%v:)", tls, a, l, af, h, buf, buflen, res, err, origin(2))
+ }
bp := tls.Alloc(28)
defer tls.Free(28)
@@ -4106,10 +4223,16 @@ func Xgethostbyaddr_r(tls *TLS, a uintptr, l socklen_t, af int32, h uintptr, buf
}
func Xgethostbyname(tls *TLS, name uintptr) uintptr { /* gethostbyname.c:8:16: */
+ if __ccgo_strace {
+ trc("tls=%v name=%v, (%v:)", tls, name, origin(2))
+ }
return Xgethostbyname2(tls, name, 2)
}
func Xgethostbyname2(tls *TLS, name uintptr, af int32) uintptr { /* gethostbyname2.c:8:16: */
+ if __ccgo_strace {
+ trc("tls=%v name=%v af=%v, (%v:)", tls, name, af, origin(2))
+ }
bp := tls.Alloc(4)
defer tls.Free(4)
@@ -4136,6 +4259,9 @@ func Xgethostbyname2(tls *TLS, name uintptr, af int32) uintptr { /* gethostbynam
var _sh1 uintptr /* gethostbyname2.c:10:24: */
func Xgethostbyname2_r(tls *TLS, name uintptr, af int32, h uintptr, buf uintptr, buflen size_t, res uintptr, err uintptr) int32 { /* gethostbyname2_r.c:11:5: */
+ if __ccgo_strace {
+ trc("tls=%v name=%v af=%v h=%v buf=%v buflen=%v res=%v err=%v, (%v:)", tls, name, af, h, buf, buflen, res, err, origin(2))
+ }
bp := tls.Alloc(1600)
defer tls.Free(1600)
@@ -4227,6 +4353,9 @@ func Xgethostbyname2_r(tls *TLS, name uintptr, af int32, h uintptr, buf uintptr,
}
func Xgethostbyname_r(tls *TLS, name uintptr, h uintptr, buf uintptr, buflen size_t, res uintptr, err uintptr) int32 { /* gethostbyname_r.c:6:5: */
+ if __ccgo_strace {
+ trc("tls=%v name=%v h=%v buf=%v buflen=%v res=%v err=%v, (%v:)", tls, name, h, buf, buflen, res, err, origin(2))
+ }
return Xgethostbyname2_r(tls, name, 2, h, buf, buflen, res, err)
}
@@ -4516,6 +4645,9 @@ func reverse_services(tls *TLS, buf uintptr, port int32, dgram int32) { /* getna
}
func Xgetnameinfo(tls *TLS, sa1 uintptr, sl socklen_t, node uintptr, nodelen socklen_t, serv uintptr, servlen socklen_t, flags int32) int32 { /* getnameinfo.c:125:5: */
+ if __ccgo_strace {
+ trc("tls=%v sa1=%v sl=%v node=%v nodelen=%v serv=%v servlen=%v flags=%v, (%v:)", tls, sa1, sl, node, nodelen, serv, servlen, flags, origin(2))
+ }
bp := tls.Alloc(347)
defer tls.Free(347)
@@ -4616,10 +4748,16 @@ func Xgetnameinfo(tls *TLS, sa1 uintptr, sl socklen_t, node uintptr, nodelen soc
var Xh_errno int32 /* h_errno.c:4:5: */
func X__h_errno_location(tls *TLS) uintptr { /* h_errno.c:6:5: */
+ if __ccgo_strace {
+ trc("tls=%v, (%v:)", tls, origin(2))
+ }
return uintptr(unsafe.Pointer(&Xh_errno))
}
func X__inet_aton(tls *TLS, s0 uintptr, dest uintptr) int32 { /* inet_aton.c:7:5: */
+ if __ccgo_strace {
+ trc("tls=%v s0=%v dest=%v, (%v:)", tls, s0, dest, origin(2))
+ }
bp := tls.Alloc(20)
defer tls.Free(20)
@@ -4671,6 +4809,9 @@ func X__inet_aton(tls *TLS, s0 uintptr, dest uintptr) int32 { /* inet_aton.c:7:5
}
func Xinet_ntop(tls *TLS, af int32, a0 uintptr, s uintptr, l socklen_t) uintptr { /* inet_ntop.c:7:12: */
+ if __ccgo_strace {
+ trc("tls=%v af=%v a0=%v s=%v l=%v, (%v:)", tls, af, a0, s, l, origin(2))
+ }
bp := tls.Alloc(276)
defer tls.Free(276)
@@ -4745,6 +4886,9 @@ func hexval(tls *TLS, c uint32) int32 { /* inet_pton.c:7:12: */
}
func Xinet_pton(tls *TLS, af int32, s uintptr, a0 uintptr) int32 { /* inet_pton.c:15:5: */
+ if __ccgo_strace {
+ trc("tls=%v af=%v s=%v a0=%v, (%v:)", tls, af, s, a0, origin(2))
+ }
bp := tls.Alloc(16)
defer tls.Free(16)
@@ -4842,6 +4986,9 @@ func Xinet_pton(tls *TLS, af int32, s uintptr, a0 uintptr) int32 { /* inet_pton.
}
func X__lookup_ipliteral(tls *TLS, buf uintptr, name uintptr, family int32) int32 { /* lookup_ipliteral.c:12:5: */
+ if __ccgo_strace {
+ trc("tls=%v buf=%v name=%v family=%v, (%v:)", tls, buf, name, family, origin(2))
+ }
bp := tls.Alloc(88)
defer tls.Free(88)
@@ -5151,6 +5298,9 @@ func addrcmp(tls *TLS, _a uintptr, _b uintptr) int32 { /* lookup_name.c:305:12:
}
func X__lookup_name(tls *TLS, buf uintptr, canon uintptr, name uintptr, family int32, flags int32) int32 { /* lookup_name.c:311:5: */
+ if __ccgo_strace {
+ trc("tls=%v buf=%v canon=%v name=%v family=%v flags=%v, (%v:)", tls, buf, canon, name, family, flags, origin(2))
+ }
bp := tls.Alloc(92)
defer tls.Free(92)
@@ -5317,6 +5467,9 @@ func X__lookup_name(tls *TLS, buf uintptr, canon uintptr, name uintptr, family i
}
func X__lookup_serv(tls *TLS, buf uintptr, name uintptr, proto int32, socktype int32, flags int32) int32 { /* lookup_serv.c:12:5: */
+ if __ccgo_strace {
+ trc("tls=%v buf=%v name=%v proto=%v socktype=%v flags=%v, (%v:)", tls, buf, name, proto, socktype, flags, origin(2))
+ }
bp := tls.Alloc(4)
defer tls.Free(4)
@@ -5450,10 +5603,16 @@ func temper(tls *TLS, x uint32) uint32 { /* rand_r.c:3:17: */
}
func Xrand_r(tls *TLS, seed uintptr) int32 { /* rand_r.c:12:5: */
+ if __ccgo_strace {
+ trc("tls=%v seed=%v, (%v:)", tls, seed, origin(2))
+ }
return int32(temper(tls, AssignPtrUint32(seed, *(*uint32)(unsafe.Pointer(seed))*uint32(1103515245)+uint32(12345))) / uint32(2))
}
func X__lockfile(tls *TLS, f uintptr) int32 { /* __lockfile.c:4:5: */
+ if __ccgo_strace {
+ trc("tls=%v f=%v, (%v:)", tls, f, origin(2))
+ }
var owner int32 = (*FILE)(unsafe.Pointer(f)).lock
var tid int32 = (*__pthread)(unsafe.Pointer(__pthread_self(tls))).tid
if owner&CplInt32(0x40000000) == tid {
@@ -5472,12 +5631,18 @@ func X__lockfile(tls *TLS, f uintptr) int32 { /* __lockfile.c:4:5: */
}
func X__unlockfile(tls *TLS, f uintptr) { /* __lockfile.c:19:6: */
+ if __ccgo_strace {
+ trc("tls=%v f=%v, (%v:)", tls, f, origin(2))
+ }
if a_swap(tls, f+76, 0)&0x40000000 != 0 {
__wake(tls, f+76, 1, 1)
}
}
func X__toread(tls *TLS, f uintptr) int32 { /* __toread.c:3:5: */
+ if __ccgo_strace {
+ trc("tls=%v f=%v, (%v:)", tls, f, origin(2))
+ }
*(*int32)(unsafe.Pointer(f + 72)) |= (*FILE)(unsafe.Pointer(f)).mode - 1
if (*FILE)(unsafe.Pointer(f)).wpos != (*FILE)(unsafe.Pointer(f)).wbase {
(*struct {
@@ -5497,6 +5662,9 @@ func X__toread(tls *TLS, f uintptr) int32 { /* __toread.c:3:5: */
}
func X__toread_needs_stdio_exit(tls *TLS) { /* __toread.c:16:13: */
+ if __ccgo_strace {
+ trc("tls=%v, (%v:)", tls, origin(2))
+ }
X__builtin_abort(tls) //TODO-
// __stdio_exit_needed();
}
@@ -5505,6 +5673,9 @@ func X__toread_needs_stdio_exit(tls *TLS) { /* __toread.c:16:13: */
// data buffered for reading.
func X__uflow(tls *TLS, f uintptr) int32 { /* __uflow.c:6:5: */
+ if __ccgo_strace {
+ trc("tls=%v f=%v, (%v:)", tls, f, origin(2))
+ }
bp := tls.Alloc(1)
defer tls.Free(1)
@@ -5519,6 +5690,9 @@ func X__uflow(tls *TLS, f uintptr) int32 { /* __uflow.c:6:5: */
}
func Xsscanf(tls *TLS, s uintptr, fmt uintptr, va uintptr) int32 { /* sscanf.c:4:5: */
+ if __ccgo_strace {
+ trc("tls=%v s=%v fmt=%v va=%v, (%v:)", tls, s, fmt, va, origin(2))
+ }
var ret int32
var ap va_list
_ = ap
@@ -5568,6 +5742,9 @@ func arg_n(tls *TLS, ap va_list, n uint32) uintptr { /* vfscanf.c:44:13: */
}
func Xvfscanf(tls *TLS, f uintptr, fmt uintptr, ap va_list) int32 { /* vfscanf.c:56:5: */
+ if __ccgo_strace {
+ trc("tls=%v f=%v fmt=%v ap=%v, (%v:)", tls, f, fmt, ap, origin(2))
+ }
bp := tls.Alloc(276)
defer tls.Free(276)
@@ -6443,6 +6620,9 @@ func string_read(tls *TLS, f uintptr, buf uintptr, len size_t) size_t { /* vssca
}
func Xvsscanf(tls *TLS, s uintptr, fmt uintptr, ap va_list) int32 { /* vsscanf.c:18:5: */
+ if __ccgo_strace {
+ trc("tls=%v s=%v fmt=%v ap=%v, (%v:)", tls, s, fmt, ap, origin(2))
+ }
bp := tls.Alloc(136)
defer tls.Free(136)
@@ -6453,6 +6633,9 @@ func Xvsscanf(tls *TLS, s uintptr, fmt uintptr, ap va_list) int32 { /* vsscanf.c
}
func Xbsearch(tls *TLS, key uintptr, base uintptr, nel size_t, width size_t, cmp uintptr) uintptr { /* bsearch.c:3:6: */
+ if __ccgo_strace {
+ trc("tls=%v key=%v base=%v nel=%v width=%v cmp=%v, (%v:)", tls, key, base, nel, width, cmp, origin(2))
+ }
var try uintptr
var sign int32
for nel > size_t(0) {
@@ -6495,14 +6678,23 @@ func strtox(tls *TLS, s uintptr, p uintptr, prec int32) float64 { /* strtod.c:6:
}
func Xstrtof(tls *TLS, s uintptr, p uintptr) float32 { /* strtod.c:17:7: */
+ if __ccgo_strace {
+ trc("tls=%v s=%v p=%v, (%v:)", tls, s, p, origin(2))
+ }
return float32(strtox(tls, s, p, 0))
}
func Xstrtod(tls *TLS, s uintptr, p uintptr) float64 { /* strtod.c:22:8: */
+ if __ccgo_strace {
+ trc("tls=%v s=%v p=%v, (%v:)", tls, s, p, origin(2))
+ }
return strtox(tls, s, p, 1)
}
func Xstrtold(tls *TLS, s uintptr, p uintptr) float64 { /* strtod.c:27:13: */
+ if __ccgo_strace {
+ trc("tls=%v s=%v p=%v, (%v:)", tls, s, p, origin(2))
+ }
return strtox(tls, s, p, 2)
}
@@ -6524,30 +6716,51 @@ func strtox1(tls *TLS, s uintptr, p uintptr, base int32, lim uint64) uint64 { /*
}
func Xstrtoull(tls *TLS, s uintptr, p uintptr, base int32) uint64 { /* strtol.c:21:20: */
+ if __ccgo_strace {
+ trc("tls=%v s=%v p=%v base=%v, (%v:)", tls, s, p, base, origin(2))
+ }
return strtox1(tls, s, p, base, 2*uint64(0x7fffffffffffffff)+uint64(1))
}
func Xstrtoll(tls *TLS, s uintptr, p uintptr, base int32) int64 { /* strtol.c:26:11: */
+ if __ccgo_strace {
+ trc("tls=%v s=%v p=%v base=%v, (%v:)", tls, s, p, base, origin(2))
+ }
return int64(strtox1(tls, s, p, base, Uint64FromInt64(-0x7fffffffffffffff-int64(1))))
}
func Xstrtoul(tls *TLS, s uintptr, p uintptr, base int32) uint32 { /* strtol.c:31:15: */
+ if __ccgo_strace {
+ trc("tls=%v s=%v p=%v base=%v, (%v:)", tls, s, p, base, origin(2))
+ }
return uint32(strtox1(tls, s, p, base, uint64(2*uint32(0x7fffffff)+uint32(1))))
}
func Xstrtol(tls *TLS, s uintptr, p uintptr, base int32) int32 { /* strtol.c:36:6: */
+ if __ccgo_strace {
+ trc("tls=%v s=%v p=%v base=%v, (%v:)", tls, s, p, base, origin(2))
+ }
return int32(strtox1(tls, s, p, base, uint64(0+Uint32FromInt32(Int32(-Int32(0x7fffffff))-Int32FromInt32(1)))))
}
func Xstrtoimax(tls *TLS, s uintptr, p uintptr, base int32) intmax_t { /* strtol.c:41:10: */
+ if __ccgo_strace {
+ trc("tls=%v s=%v p=%v base=%v, (%v:)", tls, s, p, base, origin(2))
+ }
return Xstrtoll(tls, s, p, base)
}
func Xstrtoumax(tls *TLS, s uintptr, p uintptr, base int32) uintmax_t { /* strtol.c:46:11: */
+ if __ccgo_strace {
+ trc("tls=%v s=%v p=%v base=%v, (%v:)", tls, s, p, base, origin(2))
+ }
return Xstrtoull(tls, s, p, base)
}
func Xstrdup(tls *TLS, s uintptr) uintptr { /* strdup.c:4:6: */
+ if __ccgo_strace {
+ trc("tls=%v s=%v, (%v:)", tls, s, origin(2))
+ }
var l size_t = Xstrlen(tls, s)
var d uintptr = Xmalloc(tls, l+size_t(1))
if !(d != 0) {
@@ -6557,6 +6770,9 @@ func Xstrdup(tls *TLS, s uintptr) uintptr { /* strdup.c:4:6: */
}
func Xstrlcat(tls *TLS, d uintptr, s uintptr, n size_t) size_t { /* strlcat.c:4:8: */
+ if __ccgo_strace {
+ trc("tls=%v d=%v s=%v n=%v, (%v:)", tls, d, s, n, origin(2))
+ }
var l size_t = Xstrnlen(tls, d, n)
if l == n {
return l + Xstrlen(tls, s)
@@ -6574,6 +6790,9 @@ func Xstrlcat(tls *TLS, d uintptr, s uintptr, n size_t) size_t { /* strlcat.c:4:
// from SUS and have nothing to do with the host system.
func Xstrlcpy(tls *TLS, d uintptr, s uintptr, n size_t) size_t { /* strlcpy.c:11:8: */
+ if __ccgo_strace {
+ trc("tls=%v d=%v s=%v n=%v, (%v:)", tls, d, s, n, origin(2))
+ }
var d0 uintptr
var wd uintptr
var ws uintptr
@@ -6645,6 +6864,9 @@ finish:
}
func Xstrncasecmp(tls *TLS, _l uintptr, _r uintptr, n size_t) int32 { /* strncasecmp.c:4:5: */
+ if __ccgo_strace {
+ trc("tls=%v _l=%v _r=%v n=%v, (%v:)", tls, _l, _r, n, origin(2))
+ }
var l uintptr = _l
var r uintptr = _r
if !(int32(PostDecUint32(&n, 1)) != 0) {
@@ -6667,10 +6889,16 @@ __3:
}
func X__strncasecmp_l(tls *TLS, l uintptr, r uintptr, n size_t, loc locale_t) int32 { /* strncasecmp.c:12:5: */
+ if __ccgo_strace {
+ trc("tls=%v l=%v r=%v n=%v loc=%v, (%v:)", tls, l, r, n, loc, origin(2))
+ }
return Xstrncasecmp(tls, l, r, n)
}
func Xstrncat(tls *TLS, d uintptr, s uintptr, n size_t) uintptr { /* strncat.c:3:6: */
+ if __ccgo_strace {
+ trc("tls=%v d=%v s=%v n=%v, (%v:)", tls, d, s, n, origin(2))
+ }
var a uintptr = d
d += uintptr(Xstrlen(tls, d))
for n != 0 && *(*int8)(unsafe.Pointer(s)) != 0 {
@@ -6682,6 +6910,9 @@ func Xstrncat(tls *TLS, d uintptr, s uintptr, n size_t) uintptr { /* strncat.c:3
}
func Xstrnlen(tls *TLS, s uintptr, n size_t) size_t { /* strnlen.c:3:8: */
+ if __ccgo_strace {
+ trc("tls=%v s=%v n=%v, (%v:)", tls, s, n, origin(2))
+ }
var p uintptr = Xmemchr(tls, s, 0, n)
if p != 0 {
return uint32((int32(p) - int32(s)) / 1)
@@ -6690,6 +6921,9 @@ func Xstrnlen(tls *TLS, s uintptr, n size_t) size_t { /* strnlen.c:3:8: */
}
func Xstrspn(tls *TLS, s uintptr, c uintptr) size_t { /* strspn.c:6:8: */
+ if __ccgo_strace {
+ trc("tls=%v s=%v c=%v, (%v:)", tls, s, c, origin(2))
+ }
bp := tls.Alloc(32)
defer tls.Free(32)
@@ -6713,6 +6947,9 @@ func Xstrspn(tls *TLS, s uintptr, c uintptr) size_t { /* strspn.c:6:8: */
}
func Xstrtok(tls *TLS, s uintptr, sep uintptr) uintptr { /* strtok.c:3:6: */
+ if __ccgo_strace {
+ trc("tls=%v s=%v sep=%v, (%v:)", tls, s, sep, origin(2))
+ }
if !(s != 0) && !(int32(AssignUintptr(&s, _sp)) != 0) {
return uintptr(0)
}
@@ -6732,10 +6969,16 @@ func Xstrtok(tls *TLS, s uintptr, sep uintptr) uintptr { /* strtok.c:3:6: */
var _sp uintptr /* strtok.c:5:14: */
func X__ccgo_pthreadAttrGetDetachState(tls *TLS, a uintptr) int32 { /* pthread_attr_get.c:3:5: */
+ if __ccgo_strace {
+ trc("tls=%v a=%v, (%v:)", tls, a, origin(2))
+ }
return *(*int32)(unsafe.Pointer(a + 3*4))
}
func Xpthread_attr_getdetachstate(tls *TLS, a uintptr, state uintptr) int32 { /* pthread_attr_get.c:7:5: */
+ if __ccgo_strace {
+ trc("tls=%v a=%v state=%v, (%v:)", tls, a, state, origin(2))
+ }
*(*int32)(unsafe.Pointer(state)) = *(*int32)(unsafe.Pointer(a + 3*4))
return 0
}
@@ -6822,6 +7065,9 @@ func Xpthread_attr_getdetachstate(tls *TLS, a uintptr, state uintptr) int32 { /*
// }
func X__ccgo_pthreadMutexattrGettype(tls *TLS, a uintptr) int32 { /* pthread_attr_get.c:93:5: */
+ if __ccgo_strace {
+ trc("tls=%v a=%v, (%v:)", tls, a, origin(2))
+ }
return int32((*pthread_mutexattr_t)(unsafe.Pointer(a)).__attr & uint32(3))
}
@@ -6838,6 +7084,9 @@ func X__ccgo_pthreadMutexattrGettype(tls *TLS, a uintptr) int32 { /* pthread_att
// }
func Xpthread_attr_setdetachstate(tls *TLS, a uintptr, state int32) int32 { /* pthread_attr_setdetachstate.c:3:5: */
+ if __ccgo_strace {
+ trc("tls=%v a=%v state=%v, (%v:)", tls, a, state, origin(2))
+ }
if uint32(state) > 1 {
return 22
}
@@ -6846,6 +7095,9 @@ func Xpthread_attr_setdetachstate(tls *TLS, a uintptr, state int32) int32 { /* p
}
func X__ccgo_getMutexType(tls *TLS, m uintptr) int32 { /* pthread_mutex_lock.c:3:5: */
+ if __ccgo_strace {
+ trc("tls=%v m=%v, (%v:)", tls, m, origin(2))
+ }
return *(*int32)(unsafe.Pointer(m)) & 15
}
@@ -6861,15 +7113,24 @@ func X__ccgo_getMutexType(tls *TLS, m uintptr) int32 { /* pthread_mutex_lock.c:3
// weak_alias(__pthread_mutex_lock, pthread_mutex_lock);
func Xpthread_mutexattr_destroy(tls *TLS, a uintptr) int32 { /* pthread_mutexattr_destroy.c:3:5: */
+ if __ccgo_strace {
+ trc("tls=%v a=%v, (%v:)", tls, a, origin(2))
+ }
return 0
}
func Xpthread_mutexattr_init(tls *TLS, a uintptr) int32 { /* pthread_mutexattr_init.c:3:5: */
+ if __ccgo_strace {
+ trc("tls=%v a=%v, (%v:)", tls, a, origin(2))
+ }
*(*pthread_mutexattr_t)(unsafe.Pointer(a)) = pthread_mutexattr_t{}
return 0
}
func Xpthread_mutexattr_settype(tls *TLS, a uintptr, type1 int32) int32 { /* pthread_mutexattr_settype.c:3:5: */
+ if __ccgo_strace {
+ trc("tls=%v a=%v type1=%v, (%v:)", tls, a, type1, origin(2))
+ }
if uint32(type1) > uint32(2) {
return 22
}
diff --git a/vendor/modernc.org/libc/musl_linux_amd64.go b/vendor/modernc.org/libc/musl_linux_amd64.go
index 7921d992..ab2f2ff2 100644
--- a/vendor/modernc.org/libc/musl_linux_amd64.go
+++ b/vendor/modernc.org/libc/musl_linux_amd64.go
@@ -403,6 +403,9 @@ var table = [384]uint16{
var ptable uintptr = 0 /* __ctype_b_loc.c:36:29 */
func X__ctype_b_loc(tls *TLS) uintptr { /* __ctype_b_loc.c:38:22: */
+ if __ccgo_strace {
+ trc("tls=%v, (%v:)", tls, origin(2))
+ }
return uintptr(unsafe.Pointer(&ptable))
}
@@ -415,6 +418,9 @@ type __locale_struct = struct{ cat [6]uintptr } /* alltypes.h:343:9 */
type locale_t = uintptr /* alltypes.h:343:32 */
func Xisalnum(tls *TLS, c int32) int32 { /* isalnum.c:3:5: */
+ if __ccgo_strace {
+ trc("tls=%v c=%v, (%v:)", tls, c, origin(2))
+ }
return Bool32(func() int32 {
if 0 != 0 {
return Xisalpha(tls, c)
@@ -429,50 +435,93 @@ func Xisalnum(tls *TLS, c int32) int32 { /* isalnum.c:3:5: */
}
func X__isalnum_l(tls *TLS, c int32, l locale_t) int32 { /* isalnum.c:8:5: */
+ if __ccgo_strace {
+ trc("tls=%v c=%v l=%v, (%v:)", tls, c, l, origin(2))
+ }
return Xisalnum(tls, c)
}
func Xisalpha(tls *TLS, c int32) int32 { /* isalpha.c:4:5: */
+ if __ccgo_strace {
+ trc("tls=%v c=%v, (%v:)", tls, c, origin(2))
+ }
return Bool32(uint32(c)|uint32(32)-uint32('a') < uint32(26))
}
func X__isalpha_l(tls *TLS, c int32, l locale_t) int32 { /* isalpha.c:9:5: */
+ if __ccgo_strace {
+ trc("tls=%v c=%v l=%v, (%v:)", tls, c, l, origin(2))
+ }
return Xisalpha(tls, c)
}
func Xisdigit(tls *TLS, c int32) int32 { /* isdigit.c:4:5: */
+ if __ccgo_strace {
+ trc("tls=%v c=%v, (%v:)", tls, c, origin(2))
+ }
return Bool32(uint32(c)-uint32('0') < uint32(10))
}
func X__isdigit_l(tls *TLS, c int32, l locale_t) int32 { /* isdigit.c:9:5: */
+ if __ccgo_strace {
+ trc("tls=%v c=%v l=%v, (%v:)", tls, c, l, origin(2))
+ }
return Xisdigit(tls, c)
}
func Xislower(tls *TLS, c int32) int32 { /* islower.c:4:5: */
+ if __ccgo_strace {
+ trc("tls=%v c=%v, (%v:)", tls, c, origin(2))
+ }
return Bool32(uint32(c)-uint32('a') < uint32(26))
}
func X__islower_l(tls *TLS, c int32, l locale_t) int32 { /* islower.c:9:5: */
+ if __ccgo_strace {
+ trc("tls=%v c=%v l=%v, (%v:)", tls, c, l, origin(2))
+ }
return Xislower(tls, c)
}
func Xisprint(tls *TLS, c int32) int32 { /* isprint.c:4:5: */
+ if __ccgo_strace {
+ trc("tls=%v c=%v, (%v:)", tls, c, origin(2))
+ }
+ return Bool32(uint32(c)-uint32(0x20) < uint32(0x5f))
+}
+
+func X__builtin_isprint(tls *TLS, c int32) int32 { /* isprint.c:4:5: */
+ if __ccgo_strace {
+ trc("tls=%v c=%v, (%v:)", tls, c, origin(2))
+ }
return Bool32(uint32(c)-uint32(0x20) < uint32(0x5f))
}
func X__isprint_l(tls *TLS, c int32, l locale_t) int32 { /* isprint.c:9:5: */
+ if __ccgo_strace {
+ trc("tls=%v c=%v l=%v, (%v:)", tls, c, l, origin(2))
+ }
return Xisprint(tls, c)
}
func Xisupper(tls *TLS, c int32) int32 { /* isupper.c:4:5: */
+ if __ccgo_strace {
+ trc("tls=%v c=%v, (%v:)", tls, c, origin(2))
+ }
return Bool32(uint32(c)-uint32('A') < uint32(26))
}
func X__isupper_l(tls *TLS, c int32, l locale_t) int32 { /* isupper.c:9:5: */
+ if __ccgo_strace {
+ trc("tls=%v c=%v l=%v, (%v:)", tls, c, l, origin(2))
+ }
return Xisupper(tls, c)
}
func Xisxdigit(tls *TLS, c int32) int32 { /* isxdigit.c:3:5: */
+ if __ccgo_strace {
+ trc("tls=%v c=%v, (%v:)", tls, c, origin(2))
+ }
return Bool32(func() int32 {
if 0 != 0 {
return Xisdigit(tls, c)
@@ -482,6 +531,9 @@ func Xisxdigit(tls *TLS, c int32) int32 { /* isxdigit.c:3:5: */
}
func X__isxdigit_l(tls *TLS, c int32, l locale_t) int32 { /* isxdigit.c:8:5: */
+ if __ccgo_strace {
+ trc("tls=%v c=%v l=%v, (%v:)", tls, c, l, origin(2))
+ }
return Xisxdigit(tls, c)
}
@@ -535,6 +587,9 @@ type lldiv_t = struct {
} /* stdlib.h:64:41 */
func Xclosedir(tls *TLS, dir uintptr) int32 { /* closedir.c:6:5: */
+ if __ccgo_strace {
+ trc("tls=%v dir=%v, (%v:)", tls, dir, origin(2))
+ }
var ret int32 = Xclose(tls, (*DIR)(unsafe.Pointer(dir)).fd)
Xfree(tls, dir)
return ret
@@ -571,6 +626,9 @@ type f_owner_ex = struct {
type syscall_arg_t = int64 /* syscall.h:22:14 */
func Xopendir(tls *TLS, name uintptr) uintptr { /* opendir.c:8:5: */
+ if __ccgo_strace {
+ trc("tls=%v name=%v, (%v:)", tls, name, origin(2))
+ }
var fd int32
var dir uintptr
@@ -593,6 +651,9 @@ type max_align_t = struct {
type dirstream_buf_alignment_check = [1]int8 /* readdir.c:7:14 */
func Xreaddir(tls *TLS, dir uintptr) uintptr { /* readdir.c:10:15: */
+ if __ccgo_strace {
+ trc("tls=%v dir=%v, (%v:)", tls, dir, origin(2))
+ }
var de uintptr
if (*DIR)(unsafe.Pointer(dir)).buf_pos >= (*DIR)(unsafe.Pointer(dir)).buf_end {
@@ -1356,6 +1417,9 @@ func hexfloat(tls *TLS, f uintptr, bits int32, emin int32, sign int32, pok int32
}
func X__floatscan(tls *TLS, f uintptr, prec int32, pok int32) float64 { /* floatscan.c:427:13: */
+ if __ccgo_strace {
+ trc("tls=%v f=%v prec=%v pok=%v, (%v:)", tls, f, prec, pok, origin(2))
+ }
var sign int32 = 1
var i size_t
var bits int32
@@ -1533,6 +1597,9 @@ var table1 = [257]uint8{Uint8FromInt32(-1),
} /* intscan.c:7:28 */
func X__intscan(tls *TLS, f uintptr, base uint32, pok int32, lim uint64) uint64 { /* intscan.c:26:20: */
+ if __ccgo_strace {
+ trc("tls=%v f=%v base=%v pok=%v lim=%v, (%v:)", tls, f, base, pok, lim, origin(2))
+ }
var val uintptr
var c int32
var neg int32
@@ -1838,6 +1905,9 @@ __43:
// the actual count.
func X__shlim(tls *TLS, f uintptr, lim off_t) { /* shgetc.c:8:6: */
+ if __ccgo_strace {
+ trc("tls=%v f=%v lim=%v, (%v:)", tls, f, lim, origin(2))
+ }
(*FILE)(unsafe.Pointer(f)).shlim = lim
(*FILE)(unsafe.Pointer(f)).shcnt = (int64((*FILE)(unsafe.Pointer(f)).buf) - int64((*FILE)(unsafe.Pointer(f)).rpos)) / 1
// If lim is nonzero, rend must be a valid pointer.
@@ -1849,6 +1919,9 @@ func X__shlim(tls *TLS, f uintptr, lim off_t) { /* shgetc.c:8:6: */
}
func X__shgetc(tls *TLS, f uintptr) int32 { /* shgetc.c:19:5: */
+ if __ccgo_strace {
+ trc("tls=%v f=%v, (%v:)", tls, f, origin(2))
+ }
var c int32
var cnt off_t = (*FILE)(unsafe.Pointer(f)).shcnt + (int64((*FILE)(unsafe.Pointer(f)).rpos)-int64((*FILE)(unsafe.Pointer(f)).buf))/1
if (*FILE)(unsafe.Pointer(f)).shlim != 0 && cnt >= (*FILE)(unsafe.Pointer(f)).shlim || AssignInt32(&c, X__uflow(tls, f)) < 0 {
@@ -1910,10 +1983,16 @@ type lconv = struct {
var posix_lconv = lconv{decimal_point: ts + 23, thousands_sep: ts + 13, grouping: ts + 13, int_curr_symbol: ts + 13, currency_symbol: ts + 13, mon_decimal_point: ts + 13, mon_thousands_sep: ts + 13, mon_grouping: ts + 13, positive_sign: ts + 13, negative_sign: ts + 13, int_frac_digits: Int8FromInt32(255), frac_digits: Int8FromInt32(255), p_cs_precedes: Int8FromInt32(255), p_sep_by_space: Int8FromInt32(255), n_cs_precedes: Int8FromInt32(255), n_sep_by_space: Int8FromInt32(255), p_sign_posn: Int8FromInt32(255), n_sign_posn: Int8FromInt32(255), int_p_cs_precedes: Int8FromInt32(255), int_p_sep_by_space: Int8FromInt32(255), int_n_cs_precedes: Int8FromInt32(255), int_n_sep_by_space: Int8FromInt32(255), int_p_sign_posn: Int8FromInt32(255), int_n_sign_posn: Int8FromInt32(255)} /* localeconv.c:4:27 */
func Xlocaleconv(tls *TLS) uintptr { /* localeconv.c:31:14: */
+ if __ccgo_strace {
+ trc("tls=%v, (%v:)", tls, origin(2))
+ }
return uintptr(unsafe.Pointer(&posix_lconv))
}
func X__fpclassify(tls *TLS, x float64) int32 { /* __fpclassify.c:4:5: */
+ if __ccgo_strace {
+ trc("tls=%v x=%v, (%v:)", tls, x, origin(2))
+ }
bp := tls.Alloc(8)
defer tls.Free(8)
@@ -1938,6 +2017,9 @@ func X__fpclassify(tls *TLS, x float64) int32 { /* __fpclassify.c:4:5: */
}
func X__fpclassifyf(tls *TLS, x float32) int32 { /* __fpclassifyf.c:4:5: */
+ if __ccgo_strace {
+ trc("tls=%v x=%v, (%v:)", tls, x, origin(2))
+ }
bp := tls.Alloc(4)
defer tls.Free(4)
@@ -1962,28 +2044,46 @@ func X__fpclassifyf(tls *TLS, x float32) int32 { /* __fpclassifyf.c:4:5: */
}
func X__fpclassifyl(tls *TLS, x float64) int32 { /* __fpclassifyl.c:4:5: */
+ if __ccgo_strace {
+ trc("tls=%v x=%v, (%v:)", tls, x, origin(2))
+ }
return X__fpclassify(tls, x)
}
func Xcopysignl(tls *TLS, x float64, y float64) float64 { /* copysignl.c:4:13: */
+ if __ccgo_strace {
+ trc("tls=%v x=%v y=%v, (%v:)", tls, x, y, origin(2))
+ }
return Xcopysign(tls, x, y)
}
func Xfabsl(tls *TLS, x float64) float64 { /* fabsl.c:3:13: */
+ if __ccgo_strace {
+ trc("tls=%v x=%v, (%v:)", tls, x, origin(2))
+ }
return Xfabs(tls, x)
}
func Xfmodl(tls *TLS, x float64, y float64) float64 { /* fmodl.c:4:13: */
+ if __ccgo_strace {
+ trc("tls=%v x=%v y=%v, (%v:)", tls, x, y, origin(2))
+ }
return Xfmod(tls, x, y)
}
func Xnanf(tls *TLS, s uintptr) float32 { /* nanf.c:3:7: */
+ if __ccgo_strace {
+ trc("tls=%v s=%v, (%v:)", tls, s, origin(2))
+ }
return X__builtin_nanf(tls, ts+13)
}
var toint double_t = float64(float64(1)) / 2.22044604925031308085e-16 /* rint.c:10:23 */
func Xrint(tls *TLS, x float64) float64 { /* rint.c:12:8: */
+ if __ccgo_strace {
+ trc("tls=%v x=%v, (%v:)", tls, x, origin(2))
+ }
bp := tls.Alloc(8)
defer tls.Free(8)
@@ -2013,6 +2113,9 @@ func Xrint(tls *TLS, x float64) float64 { /* rint.c:12:8: */
}
func Xscalbn(tls *TLS, x float64, n int32) float64 { /* scalbn.c:4:8: */
+ if __ccgo_strace {
+ trc("tls=%v x=%v n=%v, (%v:)", tls, x, n, origin(2))
+ }
bp := tls.Alloc(8)
defer tls.Free(8)
@@ -2049,6 +2152,9 @@ func Xscalbn(tls *TLS, x float64, n int32) float64 { /* scalbn.c:4:8: */
}
func Xscalbnl(tls *TLS, x float64, n int32) float64 { /* scalbnl.c:4:13: */
+ if __ccgo_strace {
+ trc("tls=%v x=%v n=%v, (%v:)", tls, x, n, origin(2))
+ }
return Xscalbn(tls, x, n)
}
@@ -3386,6 +3492,9 @@ type __mbstate_t = struct {
type mbstate_t = __mbstate_t /* alltypes.h:337:63 */
func Xmbrtowc(tls *TLS, wc uintptr, src uintptr, n size_t, st uintptr) size_t { /* mbrtowc.c:6:8: */
+ if __ccgo_strace {
+ trc("tls=%v wc=%v src=%v n=%v st=%v, (%v:)", tls, wc, src, n, st, origin(2))
+ }
bp := tls.Alloc(4)
defer tls.Free(4)
@@ -3509,6 +3618,9 @@ ilseq:
var _sinternal_state uint32 /* mbrtowc.c:8:18: */
func Xmbsinit(tls *TLS, st uintptr) int32 { /* mbsinit.c:3:5: */
+ if __ccgo_strace {
+ trc("tls=%v st=%v, (%v:)", tls, st, origin(2))
+ }
return Bool32(!(st != 0) || !(int32(*(*uint32)(unsafe.Pointer(st))) != 0))
}
@@ -3811,6 +3923,9 @@ type resolvconf = struct {
} /* lookup.h:34:1 */
func Xfreeaddrinfo(tls *TLS, p uintptr) { /* freeaddrinfo.c:7:6: */
+ if __ccgo_strace {
+ trc("tls=%v p=%v, (%v:)", tls, p, origin(2))
+ }
var cnt size_t
cnt = uint64(1)
__1:
@@ -3835,6 +3950,9 @@ __3:
}
func Xgetaddrinfo(tls *TLS, host uintptr, serv uintptr, hint uintptr, res uintptr) int32 { /* getaddrinfo.c:12:5: */
+ if __ccgo_strace {
+ trc("tls=%v host=%v serv=%v hint=%v res=%v, (%v:)", tls, host, serv, hint, res, origin(2))
+ }
bp := tls.Alloc(1608)
defer tls.Free(1608)
@@ -4039,6 +4157,9 @@ type mmsghdr = struct {
} /* socket.h:63:1 */
func Xgethostbyaddr(tls *TLS, a uintptr, l socklen_t, af int32) uintptr { /* gethostbyaddr.c:7:16: */
+ if __ccgo_strace {
+ trc("tls=%v a=%v l=%v af=%v, (%v:)", tls, a, l, af, origin(2))
+ }
bp := tls.Alloc(8)
defer tls.Free(8)
@@ -4065,6 +4186,9 @@ func Xgethostbyaddr(tls *TLS, a uintptr, l socklen_t, af int32) uintptr { /* get
var _sh uintptr /* gethostbyaddr.c:9:24: */
func Xgethostbyaddr_r(tls *TLS, a uintptr, l socklen_t, af int32, h uintptr, buf uintptr, buflen size_t, res uintptr, err uintptr) int32 { /* gethostbyaddr_r.c:10:5: */
+ if __ccgo_strace {
+ trc("tls=%v a=%v l=%v af=%v h=%v buf=%v buflen=%v res=%v err=%v, (%v:)", tls, a, l, af, h, buf, buflen, res, err, origin(2))
+ }
bp := tls.Alloc(28)
defer tls.Free(28)
@@ -4150,10 +4274,16 @@ func Xgethostbyaddr_r(tls *TLS, a uintptr, l socklen_t, af int32, h uintptr, buf
}
func Xgethostbyname(tls *TLS, name uintptr) uintptr { /* gethostbyname.c:8:16: */
+ if __ccgo_strace {
+ trc("tls=%v name=%v, (%v:)", tls, name, origin(2))
+ }
return Xgethostbyname2(tls, name, 2)
}
func Xgethostbyname2(tls *TLS, name uintptr, af int32) uintptr { /* gethostbyname2.c:8:16: */
+ if __ccgo_strace {
+ trc("tls=%v name=%v af=%v, (%v:)", tls, name, af, origin(2))
+ }
bp := tls.Alloc(8)
defer tls.Free(8)
@@ -4180,6 +4310,9 @@ func Xgethostbyname2(tls *TLS, name uintptr, af int32) uintptr { /* gethostbynam
var _sh1 uintptr /* gethostbyname2.c:10:24: */
func Xgethostbyname2_r(tls *TLS, name uintptr, af int32, h uintptr, buf uintptr, buflen size_t, res uintptr, err uintptr) int32 { /* gethostbyname2_r.c:11:5: */
+ if __ccgo_strace {
+ trc("tls=%v name=%v af=%v h=%v buf=%v buflen=%v res=%v err=%v, (%v:)", tls, name, af, h, buf, buflen, res, err, origin(2))
+ }
bp := tls.Alloc(1600)
defer tls.Free(1600)
@@ -4271,6 +4404,9 @@ func Xgethostbyname2_r(tls *TLS, name uintptr, af int32, h uintptr, buf uintptr,
}
func Xgethostbyname_r(tls *TLS, name uintptr, h uintptr, buf uintptr, buflen size_t, res uintptr, err uintptr) int32 { /* gethostbyname_r.c:6:5: */
+ if __ccgo_strace {
+ trc("tls=%v name=%v h=%v buf=%v buflen=%v res=%v err=%v, (%v:)", tls, name, h, buf, buflen, res, err, origin(2))
+ }
return Xgethostbyname2_r(tls, name, 2, h, buf, buflen, res, err)
}
@@ -4570,6 +4706,9 @@ func reverse_services(tls *TLS, buf uintptr, port int32, dgram int32) { /* getna
}
func Xgetnameinfo(tls *TLS, sa1 uintptr, sl socklen_t, node uintptr, nodelen socklen_t, serv uintptr, servlen socklen_t, flags int32) int32 { /* getnameinfo.c:125:5: */
+ if __ccgo_strace {
+ trc("tls=%v sa1=%v sl=%v node=%v nodelen=%v serv=%v servlen=%v flags=%v, (%v:)", tls, sa1, sl, node, nodelen, serv, servlen, flags, origin(2))
+ }
bp := tls.Alloc(347)
defer tls.Free(347)
@@ -4670,10 +4809,16 @@ func Xgetnameinfo(tls *TLS, sa1 uintptr, sl socklen_t, node uintptr, nodelen soc
var Xh_errno int32 /* h_errno.c:4:5: */
func X__h_errno_location(tls *TLS) uintptr { /* h_errno.c:6:5: */
+ if __ccgo_strace {
+ trc("tls=%v, (%v:)", tls, origin(2))
+ }
return uintptr(unsafe.Pointer(&Xh_errno))
}
func X__inet_aton(tls *TLS, s0 uintptr, dest uintptr) int32 { /* inet_aton.c:7:5: */
+ if __ccgo_strace {
+ trc("tls=%v s0=%v dest=%v, (%v:)", tls, s0, dest, origin(2))
+ }
bp := tls.Alloc(40)
defer tls.Free(40)
@@ -4725,6 +4870,9 @@ func X__inet_aton(tls *TLS, s0 uintptr, dest uintptr) int32 { /* inet_aton.c:7:5
}
func Xinet_ntop(tls *TLS, af int32, a0 uintptr, s uintptr, l socklen_t) uintptr { /* inet_ntop.c:7:12: */
+ if __ccgo_strace {
+ trc("tls=%v af=%v a0=%v s=%v l=%v, (%v:)", tls, af, a0, s, l, origin(2))
+ }
bp := tls.Alloc(276)
defer tls.Free(276)
@@ -4799,6 +4947,9 @@ func hexval(tls *TLS, c uint32) int32 { /* inet_pton.c:7:12: */
}
func Xinet_pton(tls *TLS, af int32, s uintptr, a0 uintptr) int32 { /* inet_pton.c:15:5: */
+ if __ccgo_strace {
+ trc("tls=%v af=%v s=%v a0=%v, (%v:)", tls, af, s, a0, origin(2))
+ }
bp := tls.Alloc(16)
defer tls.Free(16)
@@ -4896,6 +5047,9 @@ func Xinet_pton(tls *TLS, af int32, s uintptr, a0 uintptr) int32 { /* inet_pton.
}
func X__lookup_ipliteral(tls *TLS, buf uintptr, name uintptr, family int32) int32 { /* lookup_ipliteral.c:12:5: */
+ if __ccgo_strace {
+ trc("tls=%v buf=%v name=%v family=%v, (%v:)", tls, buf, name, family, origin(2))
+ }
bp := tls.Alloc(96)
defer tls.Free(96)
@@ -5206,6 +5360,9 @@ func addrcmp(tls *TLS, _a uintptr, _b uintptr) int32 { /* lookup_name.c:305:12:
}
func X__lookup_name(tls *TLS, buf uintptr, canon uintptr, name uintptr, family int32, flags int32) int32 { /* lookup_name.c:311:5: */
+ if __ccgo_strace {
+ trc("tls=%v buf=%v canon=%v name=%v family=%v flags=%v, (%v:)", tls, buf, canon, name, family, flags, origin(2))
+ }
bp := tls.Alloc(92)
defer tls.Free(92)
@@ -5372,6 +5529,9 @@ func X__lookup_name(tls *TLS, buf uintptr, canon uintptr, name uintptr, family i
}
func X__lookup_serv(tls *TLS, buf uintptr, name uintptr, proto int32, socktype int32, flags int32) int32 { /* lookup_serv.c:12:5: */
+ if __ccgo_strace {
+ trc("tls=%v buf=%v name=%v proto=%v socktype=%v flags=%v, (%v:)", tls, buf, name, proto, socktype, flags, origin(2))
+ }
bp := tls.Alloc(8)
defer tls.Free(8)
@@ -5505,10 +5665,16 @@ func temper(tls *TLS, x uint32) uint32 { /* rand_r.c:3:17: */
}
func Xrand_r(tls *TLS, seed uintptr) int32 { /* rand_r.c:12:5: */
+ if __ccgo_strace {
+ trc("tls=%v seed=%v, (%v:)", tls, seed, origin(2))
+ }
return int32(temper(tls, AssignPtrUint32(seed, *(*uint32)(unsafe.Pointer(seed))*uint32(1103515245)+uint32(12345))) / uint32(2))
}
func X__lockfile(tls *TLS, f uintptr) int32 { /* __lockfile.c:4:5: */
+ if __ccgo_strace {
+ trc("tls=%v f=%v, (%v:)", tls, f, origin(2))
+ }
var owner int32 = (*FILE)(unsafe.Pointer(f)).lock
var tid int32 = (*__pthread)(unsafe.Pointer(__pthread_self(tls))).tid
if owner&CplInt32(0x40000000) == tid {
@@ -5527,12 +5693,18 @@ func X__lockfile(tls *TLS, f uintptr) int32 { /* __lockfile.c:4:5: */
}
func X__unlockfile(tls *TLS, f uintptr) { /* __lockfile.c:19:6: */
+ if __ccgo_strace {
+ trc("tls=%v f=%v, (%v:)", tls, f, origin(2))
+ }
if a_swap(tls, f+140, 0)&0x40000000 != 0 {
__wake(tls, f+140, 1, 1)
}
}
func X__toread(tls *TLS, f uintptr) int32 { /* __toread.c:3:5: */
+ if __ccgo_strace {
+ trc("tls=%v f=%v, (%v:)", tls, f, origin(2))
+ }
*(*int32)(unsafe.Pointer(f + 136)) |= (*FILE)(unsafe.Pointer(f)).mode - 1
if (*FILE)(unsafe.Pointer(f)).wpos != (*FILE)(unsafe.Pointer(f)).wbase {
(*struct {
@@ -5552,6 +5724,9 @@ func X__toread(tls *TLS, f uintptr) int32 { /* __toread.c:3:5: */
}
func X__toread_needs_stdio_exit(tls *TLS) { /* __toread.c:16:13: */
+ if __ccgo_strace {
+ trc("tls=%v, (%v:)", tls, origin(2))
+ }
X__builtin_abort(tls) //TODO-
// __stdio_exit_needed();
}
@@ -5560,6 +5735,9 @@ func X__toread_needs_stdio_exit(tls *TLS) { /* __toread.c:16:13: */
// data buffered for reading.
func X__uflow(tls *TLS, f uintptr) int32 { /* __uflow.c:6:5: */
+ if __ccgo_strace {
+ trc("tls=%v f=%v, (%v:)", tls, f, origin(2))
+ }
bp := tls.Alloc(1)
defer tls.Free(1)
@@ -5574,6 +5752,9 @@ func X__uflow(tls *TLS, f uintptr) int32 { /* __uflow.c:6:5: */
}
func Xsscanf(tls *TLS, s uintptr, fmt uintptr, va uintptr) int32 { /* sscanf.c:4:5: */
+ if __ccgo_strace {
+ trc("tls=%v s=%v fmt=%v va=%v, (%v:)", tls, s, fmt, va, origin(2))
+ }
var ret int32
var ap va_list
_ = ap
@@ -5623,6 +5804,9 @@ func arg_n(tls *TLS, ap va_list, n uint32) uintptr { /* vfscanf.c:44:13: */
}
func Xvfscanf(tls *TLS, f uintptr, fmt uintptr, ap va_list) int32 { /* vfscanf.c:56:5: */
+ if __ccgo_strace {
+ trc("tls=%v f=%v fmt=%v ap=%v, (%v:)", tls, f, fmt, ap, origin(2))
+ }
bp := tls.Alloc(276)
defer tls.Free(276)
@@ -5656,12 +5840,7 @@ func Xvfscanf(tls *TLS, f uintptr, fmt uintptr, ap va_list) int32 { /* vfscanf.c
dest = uintptr(0)
matches = 0
pos = int64(0)
- __need_unlock = func() int32 {
- if (*FILE)(unsafe.Pointer(f)).lock >= 0 {
- return X__lockfile(tls, f)
- }
- return 0
- }()
+ __need_unlock = 0
if !!(int32((*FILE)(unsafe.Pointer(f)).rpos) != 0) {
goto __1
@@ -6498,6 +6677,9 @@ func string_read(tls *TLS, f uintptr, buf uintptr, len size_t) size_t { /* vssca
}
func Xvsscanf(tls *TLS, s uintptr, fmt uintptr, ap va_list) int32 { /* vsscanf.c:18:5: */
+ if __ccgo_strace {
+ trc("tls=%v s=%v fmt=%v ap=%v, (%v:)", tls, s, fmt, ap, origin(2))
+ }
bp := tls.Alloc(232)
defer tls.Free(232)
@@ -6508,6 +6690,9 @@ func Xvsscanf(tls *TLS, s uintptr, fmt uintptr, ap va_list) int32 { /* vsscanf.c
}
func Xbsearch(tls *TLS, key uintptr, base uintptr, nel size_t, width size_t, cmp uintptr) uintptr { /* bsearch.c:3:6: */
+ if __ccgo_strace {
+ trc("tls=%v key=%v base=%v nel=%v width=%v cmp=%v, (%v:)", tls, key, base, nel, width, cmp, origin(2))
+ }
var try uintptr
var sign int32
for nel > uint64(0) {
@@ -6550,14 +6735,23 @@ func strtox(tls *TLS, s uintptr, p uintptr, prec int32) float64 { /* strtod.c:6:
}
func Xstrtof(tls *TLS, s uintptr, p uintptr) float32 { /* strtod.c:17:7: */
+ if __ccgo_strace {
+ trc("tls=%v s=%v p=%v, (%v:)", tls, s, p, origin(2))
+ }
return float32(strtox(tls, s, p, 0))
}
func Xstrtod(tls *TLS, s uintptr, p uintptr) float64 { /* strtod.c:22:8: */
+ if __ccgo_strace {
+ trc("tls=%v s=%v p=%v, (%v:)", tls, s, p, origin(2))
+ }
return strtox(tls, s, p, 1)
}
func Xstrtold(tls *TLS, s uintptr, p uintptr) float64 { /* strtod.c:27:13: */
+ if __ccgo_strace {
+ trc("tls=%v s=%v p=%v, (%v:)", tls, s, p, origin(2))
+ }
return strtox(tls, s, p, 2)
}
@@ -6579,30 +6773,51 @@ func strtox1(tls *TLS, s uintptr, p uintptr, base int32, lim uint64) uint64 { /*
}
func Xstrtoull(tls *TLS, s uintptr, p uintptr, base int32) uint64 { /* strtol.c:21:20: */
+ if __ccgo_strace {
+ trc("tls=%v s=%v p=%v base=%v, (%v:)", tls, s, p, base, origin(2))
+ }
return strtox1(tls, s, p, base, 2*uint64(0x7fffffffffffffff)+uint64(1))
}
func Xstrtoll(tls *TLS, s uintptr, p uintptr, base int32) int64 { /* strtol.c:26:11: */
+ if __ccgo_strace {
+ trc("tls=%v s=%v p=%v base=%v, (%v:)", tls, s, p, base, origin(2))
+ }
return int64(strtox1(tls, s, p, base, Uint64FromInt64(-0x7fffffffffffffff-int64(1))))
}
func Xstrtoul(tls *TLS, s uintptr, p uintptr, base int32) uint64 { /* strtol.c:31:15: */
+ if __ccgo_strace {
+ trc("tls=%v s=%v p=%v base=%v, (%v:)", tls, s, p, base, origin(2))
+ }
return uint64(strtox1(tls, s, p, base, 2*uint64(0x7fffffffffffffff)+uint64(1)))
}
func Xstrtol(tls *TLS, s uintptr, p uintptr, base int32) int64 { /* strtol.c:36:6: */
+ if __ccgo_strace {
+ trc("tls=%v s=%v p=%v base=%v, (%v:)", tls, s, p, base, origin(2))
+ }
return int64(strtox1(tls, s, p, base, 0+Uint64FromInt64(Int64(-Int64(0x7fffffffffffffff))-Int64FromInt32(1))))
}
func Xstrtoimax(tls *TLS, s uintptr, p uintptr, base int32) intmax_t { /* strtol.c:41:10: */
+ if __ccgo_strace {
+ trc("tls=%v s=%v p=%v base=%v, (%v:)", tls, s, p, base, origin(2))
+ }
return intmax_t(Xstrtoll(tls, s, p, base))
}
func Xstrtoumax(tls *TLS, s uintptr, p uintptr, base int32) uintmax_t { /* strtol.c:46:11: */
+ if __ccgo_strace {
+ trc("tls=%v s=%v p=%v base=%v, (%v:)", tls, s, p, base, origin(2))
+ }
return uintmax_t(Xstrtoull(tls, s, p, base))
}
func Xstrdup(tls *TLS, s uintptr) uintptr { /* strdup.c:4:6: */
+ if __ccgo_strace {
+ trc("tls=%v s=%v, (%v:)", tls, s, origin(2))
+ }
var l size_t = Xstrlen(tls, s)
var d uintptr = Xmalloc(tls, l+uint64(1))
if !(d != 0) {
@@ -6612,6 +6827,9 @@ func Xstrdup(tls *TLS, s uintptr) uintptr { /* strdup.c:4:6: */
}
func Xstrlcat(tls *TLS, d uintptr, s uintptr, n size_t) size_t { /* strlcat.c:4:8: */
+ if __ccgo_strace {
+ trc("tls=%v d=%v s=%v n=%v, (%v:)", tls, d, s, n, origin(2))
+ }
var l size_t = Xstrnlen(tls, d, n)
if l == n {
return l + Xstrlen(tls, s)
@@ -6629,6 +6847,9 @@ func Xstrlcat(tls *TLS, d uintptr, s uintptr, n size_t) size_t { /* strlcat.c:4:
// from SUS and have nothing to do with the host system.
func Xstrlcpy(tls *TLS, d uintptr, s uintptr, n size_t) size_t { /* strlcpy.c:11:8: */
+ if __ccgo_strace {
+ trc("tls=%v d=%v s=%v n=%v, (%v:)", tls, d, s, n, origin(2))
+ }
var d0 uintptr
var wd uintptr
var ws uintptr
@@ -6700,6 +6921,9 @@ finish:
}
func Xstrncasecmp(tls *TLS, _l uintptr, _r uintptr, n size_t) int32 { /* strncasecmp.c:4:5: */
+ if __ccgo_strace {
+ trc("tls=%v _l=%v _r=%v n=%v, (%v:)", tls, _l, _r, n, origin(2))
+ }
var l uintptr = _l
var r uintptr = _r
if !(int32(PostDecUint64(&n, 1)) != 0) {
@@ -6722,10 +6946,16 @@ __3:
}
func X__strncasecmp_l(tls *TLS, l uintptr, r uintptr, n size_t, loc locale_t) int32 { /* strncasecmp.c:12:5: */
+ if __ccgo_strace {
+ trc("tls=%v l=%v r=%v n=%v loc=%v, (%v:)", tls, l, r, n, loc, origin(2))
+ }
return Xstrncasecmp(tls, l, r, n)
}
func Xstrncat(tls *TLS, d uintptr, s uintptr, n size_t) uintptr { /* strncat.c:3:6: */
+ if __ccgo_strace {
+ trc("tls=%v d=%v s=%v n=%v, (%v:)", tls, d, s, n, origin(2))
+ }
var a uintptr = d
d += uintptr(Xstrlen(tls, d))
for n != 0 && *(*int8)(unsafe.Pointer(s)) != 0 {
@@ -6737,6 +6967,9 @@ func Xstrncat(tls *TLS, d uintptr, s uintptr, n size_t) uintptr { /* strncat.c:3
}
func Xstrnlen(tls *TLS, s uintptr, n size_t) size_t { /* strnlen.c:3:8: */
+ if __ccgo_strace {
+ trc("tls=%v s=%v n=%v, (%v:)", tls, s, n, origin(2))
+ }
var p uintptr = Xmemchr(tls, s, 0, n)
if p != 0 {
return uint64((int64(p) - int64(s)) / 1)
@@ -6745,6 +6978,9 @@ func Xstrnlen(tls *TLS, s uintptr, n size_t) size_t { /* strnlen.c:3:8: */
}
func Xstrspn(tls *TLS, s uintptr, c uintptr) size_t { /* strspn.c:6:8: */
+ if __ccgo_strace {
+ trc("tls=%v s=%v c=%v, (%v:)", tls, s, c, origin(2))
+ }
bp := tls.Alloc(32)
defer tls.Free(32)
@@ -6768,6 +7004,9 @@ func Xstrspn(tls *TLS, s uintptr, c uintptr) size_t { /* strspn.c:6:8: */
}
func Xstrtok(tls *TLS, s uintptr, sep uintptr) uintptr { /* strtok.c:3:6: */
+ if __ccgo_strace {
+ trc("tls=%v s=%v sep=%v, (%v:)", tls, s, sep, origin(2))
+ }
if !(s != 0) && !(int32(AssignUintptr(&s, _sp)) != 0) {
return uintptr(0)
}
@@ -6787,10 +7026,16 @@ func Xstrtok(tls *TLS, s uintptr, sep uintptr) uintptr { /* strtok.c:3:6: */
var _sp uintptr /* strtok.c:5:14: */
func X__ccgo_pthreadAttrGetDetachState(tls *TLS, a uintptr) int32 { /* pthread_attr_get.c:3:5: */
+ if __ccgo_strace {
+ trc("tls=%v a=%v, (%v:)", tls, a, origin(2))
+ }
return *(*int32)(unsafe.Pointer(a + 6*4))
}
func Xpthread_attr_getdetachstate(tls *TLS, a uintptr, state uintptr) int32 { /* pthread_attr_get.c:7:5: */
+ if __ccgo_strace {
+ trc("tls=%v a=%v state=%v, (%v:)", tls, a, state, origin(2))
+ }
*(*int32)(unsafe.Pointer(state)) = *(*int32)(unsafe.Pointer(a + 6*4))
return 0
}
@@ -6877,6 +7122,9 @@ func Xpthread_attr_getdetachstate(tls *TLS, a uintptr, state uintptr) int32 { /*
// }
func X__ccgo_pthreadMutexattrGettype(tls *TLS, a uintptr) int32 { /* pthread_attr_get.c:93:5: */
+ if __ccgo_strace {
+ trc("tls=%v a=%v, (%v:)", tls, a, origin(2))
+ }
return int32((*pthread_mutexattr_t)(unsafe.Pointer(a)).__attr & uint32(3))
}
@@ -6893,6 +7141,9 @@ func X__ccgo_pthreadMutexattrGettype(tls *TLS, a uintptr) int32 { /* pthread_att
// }
func Xpthread_attr_setdetachstate(tls *TLS, a uintptr, state int32) int32 { /* pthread_attr_setdetachstate.c:3:5: */
+ if __ccgo_strace {
+ trc("tls=%v a=%v state=%v, (%v:)", tls, a, state, origin(2))
+ }
if uint32(state) > 1 {
return 22
}
@@ -6901,6 +7152,9 @@ func Xpthread_attr_setdetachstate(tls *TLS, a uintptr, state int32) int32 { /* p
}
func X__ccgo_getMutexType(tls *TLS, m uintptr) int32 { /* pthread_mutex_lock.c:3:5: */
+ if __ccgo_strace {
+ trc("tls=%v m=%v, (%v:)", tls, m, origin(2))
+ }
return *(*int32)(unsafe.Pointer(m)) & 15
}
@@ -6916,15 +7170,24 @@ func X__ccgo_getMutexType(tls *TLS, m uintptr) int32 { /* pthread_mutex_lock.c:3
// weak_alias(__pthread_mutex_lock, pthread_mutex_lock);
func Xpthread_mutexattr_destroy(tls *TLS, a uintptr) int32 { /* pthread_mutexattr_destroy.c:3:5: */
+ if __ccgo_strace {
+ trc("tls=%v a=%v, (%v:)", tls, a, origin(2))
+ }
return 0
}
func Xpthread_mutexattr_init(tls *TLS, a uintptr) int32 { /* pthread_mutexattr_init.c:3:5: */
+ if __ccgo_strace {
+ trc("tls=%v a=%v, (%v:)", tls, a, origin(2))
+ }
*(*pthread_mutexattr_t)(unsafe.Pointer(a)) = pthread_mutexattr_t{}
return 0
}
func Xpthread_mutexattr_settype(tls *TLS, a uintptr, type1 int32) int32 { /* pthread_mutexattr_settype.c:3:5: */
+ if __ccgo_strace {
+ trc("tls=%v a=%v type1=%v, (%v:)", tls, a, type1, origin(2))
+ }
if uint32(type1) > uint32(2) {
return 22
}
diff --git a/vendor/modernc.org/libc/musl_linux_arm.go b/vendor/modernc.org/libc/musl_linux_arm.go
index 8d420884..0ac66443 100644
--- a/vendor/modernc.org/libc/musl_linux_arm.go
+++ b/vendor/modernc.org/libc/musl_linux_arm.go
@@ -403,6 +403,9 @@ var table = [384]uint16{
var ptable uintptr = 0 /* __ctype_b_loc.c:36:29 */
func X__ctype_b_loc(tls *TLS) uintptr { /* __ctype_b_loc.c:38:22: */
+ if __ccgo_strace {
+ trc("tls=%v, (%v:)", tls, origin(2))
+ }
return uintptr(unsafe.Pointer(&ptable))
}
@@ -415,6 +418,9 @@ type __locale_struct = struct{ cat [6]uintptr } /* alltypes.h:336:9 */
type locale_t = uintptr /* alltypes.h:336:32 */
func Xisalnum(tls *TLS, c int32) int32 { /* isalnum.c:3:5: */
+ if __ccgo_strace {
+ trc("tls=%v c=%v, (%v:)", tls, c, origin(2))
+ }
return Bool32(func() int32 {
if 0 != 0 {
return Xisalpha(tls, c)
@@ -429,50 +435,86 @@ func Xisalnum(tls *TLS, c int32) int32 { /* isalnum.c:3:5: */
}
func X__isalnum_l(tls *TLS, c int32, l locale_t) int32 { /* isalnum.c:8:5: */
+ if __ccgo_strace {
+ trc("tls=%v c=%v l=%v, (%v:)", tls, c, l, origin(2))
+ }
return Xisalnum(tls, c)
}
func Xisalpha(tls *TLS, c int32) int32 { /* isalpha.c:4:5: */
+ if __ccgo_strace {
+ trc("tls=%v c=%v, (%v:)", tls, c, origin(2))
+ }
return Bool32(uint32(c)|uint32(32)-uint32('a') < uint32(26))
}
func X__isalpha_l(tls *TLS, c int32, l locale_t) int32 { /* isalpha.c:9:5: */
+ if __ccgo_strace {
+ trc("tls=%v c=%v l=%v, (%v:)", tls, c, l, origin(2))
+ }
return Xisalpha(tls, c)
}
func Xisdigit(tls *TLS, c int32) int32 { /* isdigit.c:4:5: */
+ if __ccgo_strace {
+ trc("tls=%v c=%v, (%v:)", tls, c, origin(2))
+ }
return Bool32(uint32(c)-uint32('0') < uint32(10))
}
func X__isdigit_l(tls *TLS, c int32, l locale_t) int32 { /* isdigit.c:9:5: */
+ if __ccgo_strace {
+ trc("tls=%v c=%v l=%v, (%v:)", tls, c, l, origin(2))
+ }
return Xisdigit(tls, c)
}
func Xislower(tls *TLS, c int32) int32 { /* islower.c:4:5: */
+ if __ccgo_strace {
+ trc("tls=%v c=%v, (%v:)", tls, c, origin(2))
+ }
return Bool32(uint32(c)-uint32('a') < uint32(26))
}
func X__islower_l(tls *TLS, c int32, l locale_t) int32 { /* islower.c:9:5: */
+ if __ccgo_strace {
+ trc("tls=%v c=%v l=%v, (%v:)", tls, c, l, origin(2))
+ }
return Xislower(tls, c)
}
func Xisprint(tls *TLS, c int32) int32 { /* isprint.c:4:5: */
+ if __ccgo_strace {
+ trc("tls=%v c=%v, (%v:)", tls, c, origin(2))
+ }
return Bool32(uint32(c)-uint32(0x20) < uint32(0x5f))
}
func X__isprint_l(tls *TLS, c int32, l locale_t) int32 { /* isprint.c:9:5: */
+ if __ccgo_strace {
+ trc("tls=%v c=%v l=%v, (%v:)", tls, c, l, origin(2))
+ }
return Xisprint(tls, c)
}
func Xisupper(tls *TLS, c int32) int32 { /* isupper.c:4:5: */
+ if __ccgo_strace {
+ trc("tls=%v c=%v, (%v:)", tls, c, origin(2))
+ }
return Bool32(uint32(c)-uint32('A') < uint32(26))
}
func X__isupper_l(tls *TLS, c int32, l locale_t) int32 { /* isupper.c:9:5: */
+ if __ccgo_strace {
+ trc("tls=%v c=%v l=%v, (%v:)", tls, c, l, origin(2))
+ }
return Xisupper(tls, c)
}
func Xisxdigit(tls *TLS, c int32) int32 { /* isxdigit.c:3:5: */
+ if __ccgo_strace {
+ trc("tls=%v c=%v, (%v:)", tls, c, origin(2))
+ }
return Bool32(func() int32 {
if 0 != 0 {
return Xisdigit(tls, c)
@@ -482,6 +524,9 @@ func Xisxdigit(tls *TLS, c int32) int32 { /* isxdigit.c:3:5: */
}
func X__isxdigit_l(tls *TLS, c int32, l locale_t) int32 { /* isxdigit.c:8:5: */
+ if __ccgo_strace {
+ trc("tls=%v c=%v l=%v, (%v:)", tls, c, l, origin(2))
+ }
return Xisxdigit(tls, c)
}
@@ -535,6 +580,9 @@ type lldiv_t = struct {
} /* stdlib.h:64:41 */
func Xclosedir(tls *TLS, dir uintptr) int32 { /* closedir.c:6:5: */
+ if __ccgo_strace {
+ trc("tls=%v dir=%v, (%v:)", tls, dir, origin(2))
+ }
var ret int32 = Xclose(tls, (*DIR)(unsafe.Pointer(dir)).fd)
Xfree(tls, dir)
return ret
@@ -571,6 +619,9 @@ type f_owner_ex = struct {
type syscall_arg_t = int32 /* syscall.h:22:14 */
func Xopendir(tls *TLS, name uintptr) uintptr { /* opendir.c:8:5: */
+ if __ccgo_strace {
+ trc("tls=%v name=%v, (%v:)", tls, name, origin(2))
+ }
var fd int32
var dir uintptr
@@ -593,6 +644,9 @@ type max_align_t = struct {
type dirstream_buf_alignment_check = [1]uint8 /* readdir.c:7:14 */
func Xreaddir(tls *TLS, dir uintptr) uintptr { /* readdir.c:10:15: */
+ if __ccgo_strace {
+ trc("tls=%v dir=%v, (%v:)", tls, dir, origin(2))
+ }
var de uintptr
if (*DIR)(unsafe.Pointer(dir)).buf_pos >= (*DIR)(unsafe.Pointer(dir)).buf_end {
@@ -1354,6 +1408,9 @@ func hexfloat(tls *TLS, f uintptr, bits int32, emin int32, sign int32, pok int32
}
func X__floatscan(tls *TLS, f uintptr, prec int32, pok int32) float64 { /* floatscan.c:427:13: */
+ if __ccgo_strace {
+ trc("tls=%v f=%v prec=%v pok=%v, (%v:)", tls, f, prec, pok, origin(2))
+ }
var sign int32 = 1
var i size_t
var bits int32
@@ -1531,6 +1588,9 @@ var table1 = [257]uint8{Uint8FromInt32(-1),
} /* intscan.c:7:28 */
func X__intscan(tls *TLS, f uintptr, base uint32, pok int32, lim uint64) uint64 { /* intscan.c:26:20: */
+ if __ccgo_strace {
+ trc("tls=%v f=%v base=%v pok=%v lim=%v, (%v:)", tls, f, base, pok, lim, origin(2))
+ }
var val uintptr
var c int32
var neg int32
@@ -1836,6 +1896,9 @@ __43:
// the actual count.
func X__shlim(tls *TLS, f uintptr, lim off_t) { /* shgetc.c:8:6: */
+ if __ccgo_strace {
+ trc("tls=%v f=%v lim=%v, (%v:)", tls, f, lim, origin(2))
+ }
(*FILE)(unsafe.Pointer(f)).shlim = lim
(*FILE)(unsafe.Pointer(f)).shcnt = off_t((int32((*FILE)(unsafe.Pointer(f)).buf) - int32((*FILE)(unsafe.Pointer(f)).rpos)) / 1)
// If lim is nonzero, rend must be a valid pointer.
@@ -1847,6 +1910,9 @@ func X__shlim(tls *TLS, f uintptr, lim off_t) { /* shgetc.c:8:6: */
}
func X__shgetc(tls *TLS, f uintptr) int32 { /* shgetc.c:19:5: */
+ if __ccgo_strace {
+ trc("tls=%v f=%v, (%v:)", tls, f, origin(2))
+ }
var c int32
var cnt off_t = (*FILE)(unsafe.Pointer(f)).shcnt + off_t((int32((*FILE)(unsafe.Pointer(f)).rpos)-int32((*FILE)(unsafe.Pointer(f)).buf))/1)
if (*FILE)(unsafe.Pointer(f)).shlim != 0 && cnt >= (*FILE)(unsafe.Pointer(f)).shlim || AssignInt32(&c, X__uflow(tls, f)) < 0 {
@@ -1908,10 +1974,16 @@ type lconv = struct {
var posix_lconv = lconv{decimal_point: ts + 23, thousands_sep: ts + 13, grouping: ts + 13, int_curr_symbol: ts + 13, currency_symbol: ts + 13, mon_decimal_point: ts + 13, mon_thousands_sep: ts + 13, mon_grouping: ts + 13, positive_sign: ts + 13, negative_sign: ts + 13, int_frac_digits: uint8(255), frac_digits: uint8(255), p_cs_precedes: uint8(255), p_sep_by_space: uint8(255), n_cs_precedes: uint8(255), n_sep_by_space: uint8(255), p_sign_posn: uint8(255), n_sign_posn: uint8(255), int_p_cs_precedes: uint8(255), int_p_sep_by_space: uint8(255), int_n_cs_precedes: uint8(255), int_n_sep_by_space: uint8(255), int_p_sign_posn: uint8(255), int_n_sign_posn: uint8(255)} /* localeconv.c:4:27 */
func Xlocaleconv(tls *TLS) uintptr { /* localeconv.c:31:14: */
+ if __ccgo_strace {
+ trc("tls=%v, (%v:)", tls, origin(2))
+ }
return uintptr(unsafe.Pointer(&posix_lconv))
}
func X__fpclassify(tls *TLS, x float64) int32 { /* __fpclassify.c:4:5: */
+ if __ccgo_strace {
+ trc("tls=%v x=%v, (%v:)", tls, x, origin(2))
+ }
bp := tls.Alloc(8)
defer tls.Free(8)
@@ -1936,6 +2008,9 @@ func X__fpclassify(tls *TLS, x float64) int32 { /* __fpclassify.c:4:5: */
}
func X__fpclassifyf(tls *TLS, x float32) int32 { /* __fpclassifyf.c:4:5: */
+ if __ccgo_strace {
+ trc("tls=%v x=%v, (%v:)", tls, x, origin(2))
+ }
bp := tls.Alloc(4)
defer tls.Free(4)
@@ -1960,28 +2035,46 @@ func X__fpclassifyf(tls *TLS, x float32) int32 { /* __fpclassifyf.c:4:5: */
}
func X__fpclassifyl(tls *TLS, x float64) int32 { /* __fpclassifyl.c:4:5: */
+ if __ccgo_strace {
+ trc("tls=%v x=%v, (%v:)", tls, x, origin(2))
+ }
return X__fpclassify(tls, x)
}
func Xcopysignl(tls *TLS, x float64, y float64) float64 { /* copysignl.c:4:13: */
+ if __ccgo_strace {
+ trc("tls=%v x=%v y=%v, (%v:)", tls, x, y, origin(2))
+ }
return Xcopysign(tls, x, y)
}
func Xfabsl(tls *TLS, x float64) float64 { /* fabsl.c:3:13: */
+ if __ccgo_strace {
+ trc("tls=%v x=%v, (%v:)", tls, x, origin(2))
+ }
return Xfabs(tls, x)
}
func Xfmodl(tls *TLS, x float64, y float64) float64 { /* fmodl.c:4:13: */
+ if __ccgo_strace {
+ trc("tls=%v x=%v y=%v, (%v:)", tls, x, y, origin(2))
+ }
return Xfmod(tls, x, y)
}
func Xnanf(tls *TLS, s uintptr) float32 { /* nanf.c:3:7: */
+ if __ccgo_strace {
+ trc("tls=%v s=%v, (%v:)", tls, s, origin(2))
+ }
return X__builtin_nanf(tls, ts+13)
}
var toint double_t = float64(float64(1)) / 2.22044604925031308085e-16 /* rint.c:10:23 */
func Xrint(tls *TLS, x float64) float64 { /* rint.c:12:8: */
+ if __ccgo_strace {
+ trc("tls=%v x=%v, (%v:)", tls, x, origin(2))
+ }
bp := tls.Alloc(8)
defer tls.Free(8)
@@ -2011,6 +2104,9 @@ func Xrint(tls *TLS, x float64) float64 { /* rint.c:12:8: */
}
func Xscalbn(tls *TLS, x float64, n int32) float64 { /* scalbn.c:4:8: */
+ if __ccgo_strace {
+ trc("tls=%v x=%v n=%v, (%v:)", tls, x, n, origin(2))
+ }
bp := tls.Alloc(8)
defer tls.Free(8)
@@ -2047,6 +2143,9 @@ func Xscalbn(tls *TLS, x float64, n int32) float64 { /* scalbn.c:4:8: */
}
func Xscalbnl(tls *TLS, x float64, n int32) float64 { /* scalbnl.c:4:13: */
+ if __ccgo_strace {
+ trc("tls=%v x=%v n=%v, (%v:)", tls, x, n, origin(2))
+ }
return Xscalbn(tls, x, n)
}
@@ -3393,6 +3492,9 @@ type __mbstate_t = struct {
type mbstate_t = __mbstate_t /* alltypes.h:330:63 */
func Xmbrtowc(tls *TLS, wc uintptr, src uintptr, n size_t, st uintptr) size_t { /* mbrtowc.c:6:8: */
+ if __ccgo_strace {
+ trc("tls=%v wc=%v src=%v n=%v st=%v, (%v:)", tls, wc, src, n, st, origin(2))
+ }
bp := tls.Alloc(4)
defer tls.Free(4)
@@ -3516,6 +3618,9 @@ ilseq:
var _sinternal_state uint32 /* mbrtowc.c:8:18: */
func Xmbsinit(tls *TLS, st uintptr) int32 { /* mbsinit.c:3:5: */
+ if __ccgo_strace {
+ trc("tls=%v st=%v, (%v:)", tls, st, origin(2))
+ }
return Bool32(!(st != 0) || !(int32(*(*uint32)(unsafe.Pointer(st))) != 0))
}
@@ -3805,6 +3910,9 @@ type resolvconf = struct {
} /* lookup.h:34:1 */
func Xfreeaddrinfo(tls *TLS, p uintptr) { /* freeaddrinfo.c:7:6: */
+ if __ccgo_strace {
+ trc("tls=%v p=%v, (%v:)", tls, p, origin(2))
+ }
var cnt size_t
cnt = size_t(1)
__1:
@@ -3829,6 +3937,9 @@ __3:
}
func Xgetaddrinfo(tls *TLS, host uintptr, serv uintptr, hint uintptr, res uintptr) int32 { /* getaddrinfo.c:12:5: */
+ if __ccgo_strace {
+ trc("tls=%v host=%v serv=%v hint=%v res=%v, (%v:)", tls, host, serv, hint, res, origin(2))
+ }
bp := tls.Alloc(1608)
defer tls.Free(1608)
@@ -4028,6 +4139,9 @@ type mmsghdr = struct {
} /* socket.h:63:1 */
func Xgethostbyaddr(tls *TLS, a uintptr, l socklen_t, af int32) uintptr { /* gethostbyaddr.c:7:16: */
+ if __ccgo_strace {
+ trc("tls=%v a=%v l=%v af=%v, (%v:)", tls, a, l, af, origin(2))
+ }
bp := tls.Alloc(4)
defer tls.Free(4)
@@ -4054,6 +4168,9 @@ func Xgethostbyaddr(tls *TLS, a uintptr, l socklen_t, af int32) uintptr { /* get
var _sh uintptr /* gethostbyaddr.c:9:24: */
func Xgethostbyaddr_r(tls *TLS, a uintptr, l socklen_t, af int32, h uintptr, buf uintptr, buflen size_t, res uintptr, err uintptr) int32 { /* gethostbyaddr_r.c:10:5: */
+ if __ccgo_strace {
+ trc("tls=%v a=%v l=%v af=%v h=%v buf=%v buflen=%v res=%v err=%v, (%v:)", tls, a, l, af, h, buf, buflen, res, err, origin(2))
+ }
bp := tls.Alloc(28)
defer tls.Free(28)
@@ -4139,10 +4256,16 @@ func Xgethostbyaddr_r(tls *TLS, a uintptr, l socklen_t, af int32, h uintptr, buf
}
func Xgethostbyname(tls *TLS, name uintptr) uintptr { /* gethostbyname.c:8:16: */
+ if __ccgo_strace {
+ trc("tls=%v name=%v, (%v:)", tls, name, origin(2))
+ }
return Xgethostbyname2(tls, name, 2)
}
func Xgethostbyname2(tls *TLS, name uintptr, af int32) uintptr { /* gethostbyname2.c:8:16: */
+ if __ccgo_strace {
+ trc("tls=%v name=%v af=%v, (%v:)", tls, name, af, origin(2))
+ }
bp := tls.Alloc(4)
defer tls.Free(4)
@@ -4169,6 +4292,9 @@ func Xgethostbyname2(tls *TLS, name uintptr, af int32) uintptr { /* gethostbynam
var _sh1 uintptr /* gethostbyname2.c:10:24: */
func Xgethostbyname2_r(tls *TLS, name uintptr, af int32, h uintptr, buf uintptr, buflen size_t, res uintptr, err uintptr) int32 { /* gethostbyname2_r.c:11:5: */
+ if __ccgo_strace {
+ trc("tls=%v name=%v af=%v h=%v buf=%v buflen=%v res=%v err=%v, (%v:)", tls, name, af, h, buf, buflen, res, err, origin(2))
+ }
bp := tls.Alloc(1600)
defer tls.Free(1600)
@@ -4260,6 +4386,9 @@ func Xgethostbyname2_r(tls *TLS, name uintptr, af int32, h uintptr, buf uintptr,
}
func Xgethostbyname_r(tls *TLS, name uintptr, h uintptr, buf uintptr, buflen size_t, res uintptr, err uintptr) int32 { /* gethostbyname_r.c:6:5: */
+ if __ccgo_strace {
+ trc("tls=%v name=%v h=%v buf=%v buflen=%v res=%v err=%v, (%v:)", tls, name, h, buf, buflen, res, err, origin(2))
+ }
return Xgethostbyname2_r(tls, name, 2, h, buf, buflen, res, err)
}
@@ -4549,6 +4678,9 @@ func reverse_services(tls *TLS, buf uintptr, port int32, dgram int32) { /* getna
}
func Xgetnameinfo(tls *TLS, sa1 uintptr, sl socklen_t, node uintptr, nodelen socklen_t, serv uintptr, servlen socklen_t, flags int32) int32 { /* getnameinfo.c:125:5: */
+ if __ccgo_strace {
+ trc("tls=%v sa1=%v sl=%v node=%v nodelen=%v serv=%v servlen=%v flags=%v, (%v:)", tls, sa1, sl, node, nodelen, serv, servlen, flags, origin(2))
+ }
bp := tls.Alloc(347)
defer tls.Free(347)
@@ -4649,10 +4781,16 @@ func Xgetnameinfo(tls *TLS, sa1 uintptr, sl socklen_t, node uintptr, nodelen soc
var Xh_errno int32 /* h_errno.c:4:5: */
func X__h_errno_location(tls *TLS) uintptr { /* h_errno.c:6:5: */
+ if __ccgo_strace {
+ trc("tls=%v, (%v:)", tls, origin(2))
+ }
return uintptr(unsafe.Pointer(&Xh_errno))
}
func X__inet_aton(tls *TLS, s0 uintptr, dest uintptr) int32 { /* inet_aton.c:7:5: */
+ if __ccgo_strace {
+ trc("tls=%v s0=%v dest=%v, (%v:)", tls, s0, dest, origin(2))
+ }
bp := tls.Alloc(20)
defer tls.Free(20)
@@ -4704,6 +4842,9 @@ func X__inet_aton(tls *TLS, s0 uintptr, dest uintptr) int32 { /* inet_aton.c:7:5
}
func Xinet_ntop(tls *TLS, af int32, a0 uintptr, s uintptr, l socklen_t) uintptr { /* inet_ntop.c:7:12: */
+ if __ccgo_strace {
+ trc("tls=%v af=%v a0=%v s=%v l=%v, (%v:)", tls, af, a0, s, l, origin(2))
+ }
bp := tls.Alloc(276)
defer tls.Free(276)
@@ -4778,6 +4919,9 @@ func hexval(tls *TLS, c uint32) int32 { /* inet_pton.c:7:12: */
}
func Xinet_pton(tls *TLS, af int32, s uintptr, a0 uintptr) int32 { /* inet_pton.c:15:5: */
+ if __ccgo_strace {
+ trc("tls=%v af=%v s=%v a0=%v, (%v:)", tls, af, s, a0, origin(2))
+ }
bp := tls.Alloc(16)
defer tls.Free(16)
@@ -4875,6 +5019,9 @@ func Xinet_pton(tls *TLS, af int32, s uintptr, a0 uintptr) int32 { /* inet_pton.
}
func X__lookup_ipliteral(tls *TLS, buf uintptr, name uintptr, family int32) int32 { /* lookup_ipliteral.c:12:5: */
+ if __ccgo_strace {
+ trc("tls=%v buf=%v name=%v family=%v, (%v:)", tls, buf, name, family, origin(2))
+ }
bp := tls.Alloc(88)
defer tls.Free(88)
@@ -5184,6 +5331,9 @@ func addrcmp(tls *TLS, _a uintptr, _b uintptr) int32 { /* lookup_name.c:305:12:
}
func X__lookup_name(tls *TLS, buf uintptr, canon uintptr, name uintptr, family int32, flags int32) int32 { /* lookup_name.c:311:5: */
+ if __ccgo_strace {
+ trc("tls=%v buf=%v canon=%v name=%v family=%v flags=%v, (%v:)", tls, buf, canon, name, family, flags, origin(2))
+ }
bp := tls.Alloc(92)
defer tls.Free(92)
@@ -5350,6 +5500,9 @@ func X__lookup_name(tls *TLS, buf uintptr, canon uintptr, name uintptr, family i
}
func X__lookup_serv(tls *TLS, buf uintptr, name uintptr, proto int32, socktype int32, flags int32) int32 { /* lookup_serv.c:12:5: */
+ if __ccgo_strace {
+ trc("tls=%v buf=%v name=%v proto=%v socktype=%v flags=%v, (%v:)", tls, buf, name, proto, socktype, flags, origin(2))
+ }
bp := tls.Alloc(4)
defer tls.Free(4)
@@ -5483,10 +5636,16 @@ func temper(tls *TLS, x uint32) uint32 { /* rand_r.c:3:17: */
}
func Xrand_r(tls *TLS, seed uintptr) int32 { /* rand_r.c:12:5: */
+ if __ccgo_strace {
+ trc("tls=%v seed=%v, (%v:)", tls, seed, origin(2))
+ }
return int32(temper(tls, AssignPtrUint32(seed, *(*uint32)(unsafe.Pointer(seed))*uint32(1103515245)+uint32(12345))) / uint32(2))
}
func X__lockfile(tls *TLS, f uintptr) int32 { /* __lockfile.c:4:5: */
+ if __ccgo_strace {
+ trc("tls=%v f=%v, (%v:)", tls, f, origin(2))
+ }
var owner int32 = (*FILE)(unsafe.Pointer(f)).lock
var tid int32 = (*__pthread)(unsafe.Pointer(__pthread_self(tls))).tid
if owner&CplInt32(0x40000000) == tid {
@@ -5505,12 +5664,18 @@ func X__lockfile(tls *TLS, f uintptr) int32 { /* __lockfile.c:4:5: */
}
func X__unlockfile(tls *TLS, f uintptr) { /* __lockfile.c:19:6: */
+ if __ccgo_strace {
+ trc("tls=%v f=%v, (%v:)", tls, f, origin(2))
+ }
if a_swap(tls, f+76, 0)&0x40000000 != 0 {
__wake(tls, f+76, 1, 1)
}
}
func X__toread(tls *TLS, f uintptr) int32 { /* __toread.c:3:5: */
+ if __ccgo_strace {
+ trc("tls=%v f=%v, (%v:)", tls, f, origin(2))
+ }
*(*int32)(unsafe.Pointer(f + 72)) |= (*FILE)(unsafe.Pointer(f)).mode - 1
if (*FILE)(unsafe.Pointer(f)).wpos != (*FILE)(unsafe.Pointer(f)).wbase {
(*struct {
@@ -5530,6 +5695,9 @@ func X__toread(tls *TLS, f uintptr) int32 { /* __toread.c:3:5: */
}
func X__toread_needs_stdio_exit(tls *TLS) { /* __toread.c:16:13: */
+ if __ccgo_strace {
+ trc("tls=%v, (%v:)", tls, origin(2))
+ }
X__builtin_abort(tls) //TODO-
// __stdio_exit_needed();
}
@@ -5538,6 +5706,9 @@ func X__toread_needs_stdio_exit(tls *TLS) { /* __toread.c:16:13: */
// data buffered for reading.
func X__uflow(tls *TLS, f uintptr) int32 { /* __uflow.c:6:5: */
+ if __ccgo_strace {
+ trc("tls=%v f=%v, (%v:)", tls, f, origin(2))
+ }
bp := tls.Alloc(1)
defer tls.Free(1)
@@ -5552,6 +5723,9 @@ func X__uflow(tls *TLS, f uintptr) int32 { /* __uflow.c:6:5: */
}
func Xsscanf(tls *TLS, s uintptr, fmt uintptr, va uintptr) int32 { /* sscanf.c:4:5: */
+ if __ccgo_strace {
+ trc("tls=%v s=%v fmt=%v va=%v, (%v:)", tls, s, fmt, va, origin(2))
+ }
var ret int32
var ap va_list
_ = ap
@@ -5601,6 +5775,9 @@ func arg_n(tls *TLS, ap va_list, n uint32) uintptr { /* vfscanf.c:44:13: */
}
func Xvfscanf(tls *TLS, f uintptr, fmt uintptr, ap va_list) int32 { /* vfscanf.c:56:5: */
+ if __ccgo_strace {
+ trc("tls=%v f=%v fmt=%v ap=%v, (%v:)", tls, f, fmt, ap, origin(2))
+ }
bp := tls.Alloc(276)
defer tls.Free(276)
@@ -6476,6 +6653,9 @@ func string_read(tls *TLS, f uintptr, buf uintptr, len size_t) size_t { /* vssca
}
func Xvsscanf(tls *TLS, s uintptr, fmt uintptr, ap va_list) int32 { /* vsscanf.c:18:5: */
+ if __ccgo_strace {
+ trc("tls=%v s=%v fmt=%v ap=%v, (%v:)", tls, s, fmt, ap, origin(2))
+ }
bp := tls.Alloc(144)
defer tls.Free(144)
@@ -6486,6 +6666,9 @@ func Xvsscanf(tls *TLS, s uintptr, fmt uintptr, ap va_list) int32 { /* vsscanf.c
}
func Xbsearch(tls *TLS, key uintptr, base uintptr, nel size_t, width size_t, cmp uintptr) uintptr { /* bsearch.c:3:6: */
+ if __ccgo_strace {
+ trc("tls=%v key=%v base=%v nel=%v width=%v cmp=%v, (%v:)", tls, key, base, nel, width, cmp, origin(2))
+ }
var try uintptr
var sign int32
for nel > size_t(0) {
@@ -6528,14 +6711,23 @@ func strtox(tls *TLS, s uintptr, p uintptr, prec int32) float64 { /* strtod.c:6:
}
func Xstrtof(tls *TLS, s uintptr, p uintptr) float32 { /* strtod.c:17:7: */
+ if __ccgo_strace {
+ trc("tls=%v s=%v p=%v, (%v:)", tls, s, p, origin(2))
+ }
return float32(strtox(tls, s, p, 0))
}
func Xstrtod(tls *TLS, s uintptr, p uintptr) float64 { /* strtod.c:22:8: */
+ if __ccgo_strace {
+ trc("tls=%v s=%v p=%v, (%v:)", tls, s, p, origin(2))
+ }
return strtox(tls, s, p, 1)
}
func Xstrtold(tls *TLS, s uintptr, p uintptr) float64 { /* strtod.c:27:13: */
+ if __ccgo_strace {
+ trc("tls=%v s=%v p=%v, (%v:)", tls, s, p, origin(2))
+ }
return strtox(tls, s, p, 2)
}
@@ -6557,30 +6749,51 @@ func strtox1(tls *TLS, s uintptr, p uintptr, base int32, lim uint64) uint64 { /*
}
func Xstrtoull(tls *TLS, s uintptr, p uintptr, base int32) uint64 { /* strtol.c:21:20: */
+ if __ccgo_strace {
+ trc("tls=%v s=%v p=%v base=%v, (%v:)", tls, s, p, base, origin(2))
+ }
return strtox1(tls, s, p, base, 2*uint64(0x7fffffffffffffff)+uint64(1))
}
func Xstrtoll(tls *TLS, s uintptr, p uintptr, base int32) int64 { /* strtol.c:26:11: */
+ if __ccgo_strace {
+ trc("tls=%v s=%v p=%v base=%v, (%v:)", tls, s, p, base, origin(2))
+ }
return int64(strtox1(tls, s, p, base, Uint64FromInt64(-0x7fffffffffffffff-int64(1))))
}
func Xstrtoul(tls *TLS, s uintptr, p uintptr, base int32) uint32 { /* strtol.c:31:15: */
+ if __ccgo_strace {
+ trc("tls=%v s=%v p=%v base=%v, (%v:)", tls, s, p, base, origin(2))
+ }
return uint32(strtox1(tls, s, p, base, uint64(2*uint32(0x7fffffff)+uint32(1))))
}
func Xstrtol(tls *TLS, s uintptr, p uintptr, base int32) int32 { /* strtol.c:36:6: */
+ if __ccgo_strace {
+ trc("tls=%v s=%v p=%v base=%v, (%v:)", tls, s, p, base, origin(2))
+ }
return int32(strtox1(tls, s, p, base, uint64(0+Uint32FromInt32(Int32(-Int32(0x7fffffff))-Int32FromInt32(1)))))
}
func Xstrtoimax(tls *TLS, s uintptr, p uintptr, base int32) intmax_t { /* strtol.c:41:10: */
+ if __ccgo_strace {
+ trc("tls=%v s=%v p=%v base=%v, (%v:)", tls, s, p, base, origin(2))
+ }
return Xstrtoll(tls, s, p, base)
}
func Xstrtoumax(tls *TLS, s uintptr, p uintptr, base int32) uintmax_t { /* strtol.c:46:11: */
+ if __ccgo_strace {
+ trc("tls=%v s=%v p=%v base=%v, (%v:)", tls, s, p, base, origin(2))
+ }
return Xstrtoull(tls, s, p, base)
}
func Xstrdup(tls *TLS, s uintptr) uintptr { /* strdup.c:4:6: */
+ if __ccgo_strace {
+ trc("tls=%v s=%v, (%v:)", tls, s, origin(2))
+ }
var l size_t = Xstrlen(tls, s)
var d uintptr = Xmalloc(tls, l+size_t(1))
if !(d != 0) {
@@ -6590,6 +6803,9 @@ func Xstrdup(tls *TLS, s uintptr) uintptr { /* strdup.c:4:6: */
}
func Xstrlcat(tls *TLS, d uintptr, s uintptr, n size_t) size_t { /* strlcat.c:4:8: */
+ if __ccgo_strace {
+ trc("tls=%v d=%v s=%v n=%v, (%v:)", tls, d, s, n, origin(2))
+ }
var l size_t = Xstrnlen(tls, d, n)
if l == n {
return l + Xstrlen(tls, s)
@@ -6607,6 +6823,9 @@ func Xstrlcat(tls *TLS, d uintptr, s uintptr, n size_t) size_t { /* strlcat.c:4:
// from SUS and have nothing to do with the host system.
func Xstrlcpy(tls *TLS, d uintptr, s uintptr, n size_t) size_t { /* strlcpy.c:11:8: */
+ if __ccgo_strace {
+ trc("tls=%v d=%v s=%v n=%v, (%v:)", tls, d, s, n, origin(2))
+ }
var d0 uintptr
var wd uintptr
var ws uintptr
@@ -6678,6 +6897,9 @@ finish:
}
func Xstrncasecmp(tls *TLS, _l uintptr, _r uintptr, n size_t) int32 { /* strncasecmp.c:4:5: */
+ if __ccgo_strace {
+ trc("tls=%v _l=%v _r=%v n=%v, (%v:)", tls, _l, _r, n, origin(2))
+ }
var l uintptr = _l
var r uintptr = _r
if !(int32(PostDecUint32(&n, 1)) != 0) {
@@ -6700,10 +6922,16 @@ __3:
}
func X__strncasecmp_l(tls *TLS, l uintptr, r uintptr, n size_t, loc locale_t) int32 { /* strncasecmp.c:12:5: */
+ if __ccgo_strace {
+ trc("tls=%v l=%v r=%v n=%v loc=%v, (%v:)", tls, l, r, n, loc, origin(2))
+ }
return Xstrncasecmp(tls, l, r, n)
}
func Xstrncat(tls *TLS, d uintptr, s uintptr, n size_t) uintptr { /* strncat.c:3:6: */
+ if __ccgo_strace {
+ trc("tls=%v d=%v s=%v n=%v, (%v:)", tls, d, s, n, origin(2))
+ }
var a uintptr = d
d += uintptr(Xstrlen(tls, d))
for n != 0 && *(*uint8)(unsafe.Pointer(s)) != 0 {
@@ -6715,6 +6943,9 @@ func Xstrncat(tls *TLS, d uintptr, s uintptr, n size_t) uintptr { /* strncat.c:3
}
func Xstrnlen(tls *TLS, s uintptr, n size_t) size_t { /* strnlen.c:3:8: */
+ if __ccgo_strace {
+ trc("tls=%v s=%v n=%v, (%v:)", tls, s, n, origin(2))
+ }
var p uintptr = Xmemchr(tls, s, 0, n)
if p != 0 {
return uint32((int32(p) - int32(s)) / 1)
@@ -6723,6 +6954,9 @@ func Xstrnlen(tls *TLS, s uintptr, n size_t) size_t { /* strnlen.c:3:8: */
}
func Xstrspn(tls *TLS, s uintptr, c uintptr) size_t { /* strspn.c:6:8: */
+ if __ccgo_strace {
+ trc("tls=%v s=%v c=%v, (%v:)", tls, s, c, origin(2))
+ }
bp := tls.Alloc(32)
defer tls.Free(32)
@@ -6746,6 +6980,9 @@ func Xstrspn(tls *TLS, s uintptr, c uintptr) size_t { /* strspn.c:6:8: */
}
func Xstrtok(tls *TLS, s uintptr, sep uintptr) uintptr { /* strtok.c:3:6: */
+ if __ccgo_strace {
+ trc("tls=%v s=%v sep=%v, (%v:)", tls, s, sep, origin(2))
+ }
if !(s != 0) && !(int32(AssignUintptr(&s, _sp)) != 0) {
return uintptr(0)
}
@@ -6765,10 +7002,16 @@ func Xstrtok(tls *TLS, s uintptr, sep uintptr) uintptr { /* strtok.c:3:6: */
var _sp uintptr /* strtok.c:5:14: */
func X__ccgo_pthreadAttrGetDetachState(tls *TLS, a uintptr) int32 { /* pthread_attr_get.c:3:5: */
+ if __ccgo_strace {
+ trc("tls=%v a=%v, (%v:)", tls, a, origin(2))
+ }
return *(*int32)(unsafe.Pointer(a + 3*4))
}
func Xpthread_attr_getdetachstate(tls *TLS, a uintptr, state uintptr) int32 { /* pthread_attr_get.c:7:5: */
+ if __ccgo_strace {
+ trc("tls=%v a=%v state=%v, (%v:)", tls, a, state, origin(2))
+ }
*(*int32)(unsafe.Pointer(state)) = *(*int32)(unsafe.Pointer(a + 3*4))
return 0
}
@@ -6855,6 +7098,9 @@ func Xpthread_attr_getdetachstate(tls *TLS, a uintptr, state uintptr) int32 { /*
// }
func X__ccgo_pthreadMutexattrGettype(tls *TLS, a uintptr) int32 { /* pthread_attr_get.c:93:5: */
+ if __ccgo_strace {
+ trc("tls=%v a=%v, (%v:)", tls, a, origin(2))
+ }
return int32((*pthread_mutexattr_t)(unsafe.Pointer(a)).__attr & uint32(3))
}
@@ -6871,6 +7117,9 @@ func X__ccgo_pthreadMutexattrGettype(tls *TLS, a uintptr) int32 { /* pthread_att
// }
func Xpthread_attr_setdetachstate(tls *TLS, a uintptr, state int32) int32 { /* pthread_attr_setdetachstate.c:3:5: */
+ if __ccgo_strace {
+ trc("tls=%v a=%v state=%v, (%v:)", tls, a, state, origin(2))
+ }
if uint32(state) > 1 {
return 22
}
@@ -6879,6 +7128,9 @@ func Xpthread_attr_setdetachstate(tls *TLS, a uintptr, state int32) int32 { /* p
}
func X__ccgo_getMutexType(tls *TLS, m uintptr) int32 { /* pthread_mutex_lock.c:3:5: */
+ if __ccgo_strace {
+ trc("tls=%v m=%v, (%v:)", tls, m, origin(2))
+ }
return *(*int32)(unsafe.Pointer(m)) & 15
}
@@ -6894,15 +7146,24 @@ func X__ccgo_getMutexType(tls *TLS, m uintptr) int32 { /* pthread_mutex_lock.c:3
// weak_alias(__pthread_mutex_lock, pthread_mutex_lock);
func Xpthread_mutexattr_destroy(tls *TLS, a uintptr) int32 { /* pthread_mutexattr_destroy.c:3:5: */
+ if __ccgo_strace {
+ trc("tls=%v a=%v, (%v:)", tls, a, origin(2))
+ }
return 0
}
func Xpthread_mutexattr_init(tls *TLS, a uintptr) int32 { /* pthread_mutexattr_init.c:3:5: */
+ if __ccgo_strace {
+ trc("tls=%v a=%v, (%v:)", tls, a, origin(2))
+ }
*(*pthread_mutexattr_t)(unsafe.Pointer(a)) = pthread_mutexattr_t{}
return 0
}
func Xpthread_mutexattr_settype(tls *TLS, a uintptr, type1 int32) int32 { /* pthread_mutexattr_settype.c:3:5: */
+ if __ccgo_strace {
+ trc("tls=%v a=%v type1=%v, (%v:)", tls, a, type1, origin(2))
+ }
if uint32(type1) > uint32(2) {
return 22
}
diff --git a/vendor/modernc.org/libc/musl_linux_arm64.go b/vendor/modernc.org/libc/musl_linux_arm64.go
index 0e3b64c1..65e3ed7e 100644
--- a/vendor/modernc.org/libc/musl_linux_arm64.go
+++ b/vendor/modernc.org/libc/musl_linux_arm64.go
@@ -403,6 +403,9 @@ var table = [384]uint16{
var ptable uintptr = 0 /* __ctype_b_loc.c:36:29 */
func X__ctype_b_loc(tls *TLS) uintptr { /* __ctype_b_loc.c:38:22: */
+ if __ccgo_strace {
+ trc("tls=%v, (%v:)", tls, origin(2))
+ }
return uintptr(unsafe.Pointer(&ptable))
}
@@ -415,6 +418,9 @@ type __locale_struct = struct{ cat [6]uintptr } /* alltypes.h:351:9 */
type locale_t = uintptr /* alltypes.h:351:32 */
func Xisalnum(tls *TLS, c int32) int32 { /* isalnum.c:3:5: */
+ if __ccgo_strace {
+ trc("tls=%v c=%v, (%v:)", tls, c, origin(2))
+ }
return Bool32(func() int32 {
if 0 != 0 {
return Xisalpha(tls, c)
@@ -429,50 +435,86 @@ func Xisalnum(tls *TLS, c int32) int32 { /* isalnum.c:3:5: */
}
func X__isalnum_l(tls *TLS, c int32, l locale_t) int32 { /* isalnum.c:8:5: */
+ if __ccgo_strace {
+ trc("tls=%v c=%v l=%v, (%v:)", tls, c, l, origin(2))
+ }
return Xisalnum(tls, c)
}
func Xisalpha(tls *TLS, c int32) int32 { /* isalpha.c:4:5: */
+ if __ccgo_strace {
+ trc("tls=%v c=%v, (%v:)", tls, c, origin(2))
+ }
return Bool32(uint32(c)|uint32(32)-uint32('a') < uint32(26))
}
func X__isalpha_l(tls *TLS, c int32, l locale_t) int32 { /* isalpha.c:9:5: */
+ if __ccgo_strace {
+ trc("tls=%v c=%v l=%v, (%v:)", tls, c, l, origin(2))
+ }
return Xisalpha(tls, c)
}
func Xisdigit(tls *TLS, c int32) int32 { /* isdigit.c:4:5: */
+ if __ccgo_strace {
+ trc("tls=%v c=%v, (%v:)", tls, c, origin(2))
+ }
return Bool32(uint32(c)-uint32('0') < uint32(10))
}
func X__isdigit_l(tls *TLS, c int32, l locale_t) int32 { /* isdigit.c:9:5: */
+ if __ccgo_strace {
+ trc("tls=%v c=%v l=%v, (%v:)", tls, c, l, origin(2))
+ }
return Xisdigit(tls, c)
}
func Xislower(tls *TLS, c int32) int32 { /* islower.c:4:5: */
+ if __ccgo_strace {
+ trc("tls=%v c=%v, (%v:)", tls, c, origin(2))
+ }
return Bool32(uint32(c)-uint32('a') < uint32(26))
}
func X__islower_l(tls *TLS, c int32, l locale_t) int32 { /* islower.c:9:5: */
+ if __ccgo_strace {
+ trc("tls=%v c=%v l=%v, (%v:)", tls, c, l, origin(2))
+ }
return Xislower(tls, c)
}
func Xisprint(tls *TLS, c int32) int32 { /* isprint.c:4:5: */
+ if __ccgo_strace {
+ trc("tls=%v c=%v, (%v:)", tls, c, origin(2))
+ }
return Bool32(uint32(c)-uint32(0x20) < uint32(0x5f))
}
func X__isprint_l(tls *TLS, c int32, l locale_t) int32 { /* isprint.c:9:5: */
+ if __ccgo_strace {
+ trc("tls=%v c=%v l=%v, (%v:)", tls, c, l, origin(2))
+ }
return Xisprint(tls, c)
}
func Xisupper(tls *TLS, c int32) int32 { /* isupper.c:4:5: */
+ if __ccgo_strace {
+ trc("tls=%v c=%v, (%v:)", tls, c, origin(2))
+ }
return Bool32(uint32(c)-uint32('A') < uint32(26))
}
func X__isupper_l(tls *TLS, c int32, l locale_t) int32 { /* isupper.c:9:5: */
+ if __ccgo_strace {
+ trc("tls=%v c=%v l=%v, (%v:)", tls, c, l, origin(2))
+ }
return Xisupper(tls, c)
}
func Xisxdigit(tls *TLS, c int32) int32 { /* isxdigit.c:3:5: */
+ if __ccgo_strace {
+ trc("tls=%v c=%v, (%v:)", tls, c, origin(2))
+ }
return Bool32(func() int32 {
if 0 != 0 {
return Xisdigit(tls, c)
@@ -482,6 +524,9 @@ func Xisxdigit(tls *TLS, c int32) int32 { /* isxdigit.c:3:5: */
}
func X__isxdigit_l(tls *TLS, c int32, l locale_t) int32 { /* isxdigit.c:8:5: */
+ if __ccgo_strace {
+ trc("tls=%v c=%v l=%v, (%v:)", tls, c, l, origin(2))
+ }
return Xisxdigit(tls, c)
}
@@ -535,6 +580,9 @@ type lldiv_t = struct {
} /* stdlib.h:64:41 */
func Xclosedir(tls *TLS, dir uintptr) int32 { /* closedir.c:6:5: */
+ if __ccgo_strace {
+ trc("tls=%v dir=%v, (%v:)", tls, dir, origin(2))
+ }
var ret int32 = Xclose(tls, (*DIR)(unsafe.Pointer(dir)).fd)
Xfree(tls, dir)
return ret
@@ -571,6 +619,9 @@ type f_owner_ex = struct {
type syscall_arg_t = int64 /* syscall.h:22:14 */
func Xopendir(tls *TLS, name uintptr) uintptr { /* opendir.c:8:5: */
+ if __ccgo_strace {
+ trc("tls=%v name=%v, (%v:)", tls, name, origin(2))
+ }
var fd int32
var dir uintptr
@@ -593,6 +644,9 @@ type max_align_t = struct {
type dirstream_buf_alignment_check = [1]uint8 /* readdir.c:7:14 */
func Xreaddir(tls *TLS, dir uintptr) uintptr { /* readdir.c:10:15: */
+ if __ccgo_strace {
+ trc("tls=%v dir=%v, (%v:)", tls, dir, origin(2))
+ }
var de uintptr
if (*DIR)(unsafe.Pointer(dir)).buf_pos >= (*DIR)(unsafe.Pointer(dir)).buf_end {
@@ -1356,6 +1410,9 @@ func hexfloat(tls *TLS, f uintptr, bits int32, emin int32, sign int32, pok int32
}
func X__floatscan(tls *TLS, f uintptr, prec int32, pok int32) float64 { /* floatscan.c:427:13: */
+ if __ccgo_strace {
+ trc("tls=%v f=%v prec=%v pok=%v, (%v:)", tls, f, prec, pok, origin(2))
+ }
var sign int32 = 1
var i size_t
var bits int32
@@ -1533,6 +1590,9 @@ var table1 = [257]uint8{Uint8FromInt32(-1),
} /* intscan.c:7:28 */
func X__intscan(tls *TLS, f uintptr, base uint32, pok int32, lim uint64) uint64 { /* intscan.c:26:20: */
+ if __ccgo_strace {
+ trc("tls=%v f=%v base=%v pok=%v lim=%v, (%v:)", tls, f, base, pok, lim, origin(2))
+ }
var val uintptr
var c int32
var neg int32
@@ -1838,6 +1898,9 @@ __43:
// the actual count.
func X__shlim(tls *TLS, f uintptr, lim off_t) { /* shgetc.c:8:6: */
+ if __ccgo_strace {
+ trc("tls=%v f=%v lim=%v, (%v:)", tls, f, lim, origin(2))
+ }
(*FILE)(unsafe.Pointer(f)).shlim = lim
(*FILE)(unsafe.Pointer(f)).shcnt = (int64((*FILE)(unsafe.Pointer(f)).buf) - int64((*FILE)(unsafe.Pointer(f)).rpos)) / 1
// If lim is nonzero, rend must be a valid pointer.
@@ -1849,6 +1912,9 @@ func X__shlim(tls *TLS, f uintptr, lim off_t) { /* shgetc.c:8:6: */
}
func X__shgetc(tls *TLS, f uintptr) int32 { /* shgetc.c:19:5: */
+ if __ccgo_strace {
+ trc("tls=%v f=%v, (%v:)", tls, f, origin(2))
+ }
var c int32
var cnt off_t = (*FILE)(unsafe.Pointer(f)).shcnt + (int64((*FILE)(unsafe.Pointer(f)).rpos)-int64((*FILE)(unsafe.Pointer(f)).buf))/1
if (*FILE)(unsafe.Pointer(f)).shlim != 0 && cnt >= (*FILE)(unsafe.Pointer(f)).shlim || AssignInt32(&c, X__uflow(tls, f)) < 0 {
@@ -1910,10 +1976,16 @@ type lconv = struct {
var posix_lconv = lconv{decimal_point: ts + 23, thousands_sep: ts + 13, grouping: ts + 13, int_curr_symbol: ts + 13, currency_symbol: ts + 13, mon_decimal_point: ts + 13, mon_thousands_sep: ts + 13, mon_grouping: ts + 13, positive_sign: ts + 13, negative_sign: ts + 13, int_frac_digits: uint8(255), frac_digits: uint8(255), p_cs_precedes: uint8(255), p_sep_by_space: uint8(255), n_cs_precedes: uint8(255), n_sep_by_space: uint8(255), p_sign_posn: uint8(255), n_sign_posn: uint8(255), int_p_cs_precedes: uint8(255), int_p_sep_by_space: uint8(255), int_n_cs_precedes: uint8(255), int_n_sep_by_space: uint8(255), int_p_sign_posn: uint8(255), int_n_sign_posn: uint8(255)} /* localeconv.c:4:27 */
func Xlocaleconv(tls *TLS) uintptr { /* localeconv.c:31:14: */
+ if __ccgo_strace {
+ trc("tls=%v, (%v:)", tls, origin(2))
+ }
return uintptr(unsafe.Pointer(&posix_lconv))
}
func X__fpclassify(tls *TLS, x float64) int32 { /* __fpclassify.c:4:5: */
+ if __ccgo_strace {
+ trc("tls=%v x=%v, (%v:)", tls, x, origin(2))
+ }
bp := tls.Alloc(8)
defer tls.Free(8)
@@ -1938,6 +2010,9 @@ func X__fpclassify(tls *TLS, x float64) int32 { /* __fpclassify.c:4:5: */
}
func X__fpclassifyf(tls *TLS, x float32) int32 { /* __fpclassifyf.c:4:5: */
+ if __ccgo_strace {
+ trc("tls=%v x=%v, (%v:)", tls, x, origin(2))
+ }
bp := tls.Alloc(4)
defer tls.Free(4)
@@ -1962,28 +2037,46 @@ func X__fpclassifyf(tls *TLS, x float32) int32 { /* __fpclassifyf.c:4:5: */
}
func X__fpclassifyl(tls *TLS, x float64) int32 { /* __fpclassifyl.c:4:5: */
+ if __ccgo_strace {
+ trc("tls=%v x=%v, (%v:)", tls, x, origin(2))
+ }
return X__fpclassify(tls, x)
}
func Xcopysignl(tls *TLS, x float64, y float64) float64 { /* copysignl.c:4:13: */
+ if __ccgo_strace {
+ trc("tls=%v x=%v y=%v, (%v:)", tls, x, y, origin(2))
+ }
return Xcopysign(tls, x, y)
}
func Xfabsl(tls *TLS, x float64) float64 { /* fabsl.c:3:13: */
+ if __ccgo_strace {
+ trc("tls=%v x=%v, (%v:)", tls, x, origin(2))
+ }
return Xfabs(tls, x)
}
func Xfmodl(tls *TLS, x float64, y float64) float64 { /* fmodl.c:4:13: */
+ if __ccgo_strace {
+ trc("tls=%v x=%v y=%v, (%v:)", tls, x, y, origin(2))
+ }
return Xfmod(tls, x, y)
}
func Xnanf(tls *TLS, s uintptr) float32 { /* nanf.c:3:7: */
+ if __ccgo_strace {
+ trc("tls=%v s=%v, (%v:)", tls, s, origin(2))
+ }
return X__builtin_nanf(tls, ts+13)
}
var toint double_t = float64(float64(1)) / 2.22044604925031308085e-16 /* rint.c:10:23 */
func Xrint(tls *TLS, x float64) float64 { /* rint.c:12:8: */
+ if __ccgo_strace {
+ trc("tls=%v x=%v, (%v:)", tls, x, origin(2))
+ }
bp := tls.Alloc(8)
defer tls.Free(8)
@@ -2013,6 +2106,9 @@ func Xrint(tls *TLS, x float64) float64 { /* rint.c:12:8: */
}
func Xscalbn(tls *TLS, x float64, n int32) float64 { /* scalbn.c:4:8: */
+ if __ccgo_strace {
+ trc("tls=%v x=%v n=%v, (%v:)", tls, x, n, origin(2))
+ }
bp := tls.Alloc(8)
defer tls.Free(8)
@@ -2049,6 +2145,9 @@ func Xscalbn(tls *TLS, x float64, n int32) float64 { /* scalbn.c:4:8: */
}
func Xscalbnl(tls *TLS, x float64, n int32) float64 { /* scalbnl.c:4:13: */
+ if __ccgo_strace {
+ trc("tls=%v x=%v n=%v, (%v:)", tls, x, n, origin(2))
+ }
return Xscalbn(tls, x, n)
}
@@ -3474,6 +3573,9 @@ type __mbstate_t = struct {
type mbstate_t = __mbstate_t /* alltypes.h:345:63 */
func Xmbrtowc(tls *TLS, wc uintptr, src uintptr, n size_t, st uintptr) size_t { /* mbrtowc.c:6:8: */
+ if __ccgo_strace {
+ trc("tls=%v wc=%v src=%v n=%v st=%v, (%v:)", tls, wc, src, n, st, origin(2))
+ }
bp := tls.Alloc(4)
defer tls.Free(4)
@@ -3597,6 +3699,9 @@ ilseq:
var _sinternal_state uint32 /* mbrtowc.c:8:18: */
func Xmbsinit(tls *TLS, st uintptr) int32 { /* mbsinit.c:3:5: */
+ if __ccgo_strace {
+ trc("tls=%v st=%v, (%v:)", tls, st, origin(2))
+ }
return Bool32(!(st != 0) || !(int32(*(*uint32)(unsafe.Pointer(st))) != 0))
}
@@ -3899,6 +4004,9 @@ type resolvconf = struct {
} /* lookup.h:34:1 */
func Xfreeaddrinfo(tls *TLS, p uintptr) { /* freeaddrinfo.c:7:6: */
+ if __ccgo_strace {
+ trc("tls=%v p=%v, (%v:)", tls, p, origin(2))
+ }
var cnt size_t
cnt = uint64(1)
__1:
@@ -3923,6 +4031,9 @@ __3:
}
func Xgetaddrinfo(tls *TLS, host uintptr, serv uintptr, hint uintptr, res uintptr) int32 { /* getaddrinfo.c:12:5: */
+ if __ccgo_strace {
+ trc("tls=%v host=%v serv=%v hint=%v res=%v, (%v:)", tls, host, serv, hint, res, origin(2))
+ }
bp := tls.Alloc(1608)
defer tls.Free(1608)
@@ -4127,6 +4238,9 @@ type mmsghdr = struct {
} /* socket.h:63:1 */
func Xgethostbyaddr(tls *TLS, a uintptr, l socklen_t, af int32) uintptr { /* gethostbyaddr.c:7:16: */
+ if __ccgo_strace {
+ trc("tls=%v a=%v l=%v af=%v, (%v:)", tls, a, l, af, origin(2))
+ }
bp := tls.Alloc(8)
defer tls.Free(8)
@@ -4153,6 +4267,9 @@ func Xgethostbyaddr(tls *TLS, a uintptr, l socklen_t, af int32) uintptr { /* get
var _sh uintptr /* gethostbyaddr.c:9:24: */
func Xgethostbyaddr_r(tls *TLS, a uintptr, l socklen_t, af int32, h uintptr, buf uintptr, buflen size_t, res uintptr, err uintptr) int32 { /* gethostbyaddr_r.c:10:5: */
+ if __ccgo_strace {
+ trc("tls=%v a=%v l=%v af=%v h=%v buf=%v buflen=%v res=%v err=%v, (%v:)", tls, a, l, af, h, buf, buflen, res, err, origin(2))
+ }
bp := tls.Alloc(28)
defer tls.Free(28)
@@ -4238,10 +4355,16 @@ func Xgethostbyaddr_r(tls *TLS, a uintptr, l socklen_t, af int32, h uintptr, buf
}
func Xgethostbyname(tls *TLS, name uintptr) uintptr { /* gethostbyname.c:8:16: */
+ if __ccgo_strace {
+ trc("tls=%v name=%v, (%v:)", tls, name, origin(2))
+ }
return Xgethostbyname2(tls, name, 2)
}
func Xgethostbyname2(tls *TLS, name uintptr, af int32) uintptr { /* gethostbyname2.c:8:16: */
+ if __ccgo_strace {
+ trc("tls=%v name=%v af=%v, (%v:)", tls, name, af, origin(2))
+ }
bp := tls.Alloc(8)
defer tls.Free(8)
@@ -4268,6 +4391,9 @@ func Xgethostbyname2(tls *TLS, name uintptr, af int32) uintptr { /* gethostbynam
var _sh1 uintptr /* gethostbyname2.c:10:24: */
func Xgethostbyname2_r(tls *TLS, name uintptr, af int32, h uintptr, buf uintptr, buflen size_t, res uintptr, err uintptr) int32 { /* gethostbyname2_r.c:11:5: */
+ if __ccgo_strace {
+ trc("tls=%v name=%v af=%v h=%v buf=%v buflen=%v res=%v err=%v, (%v:)", tls, name, af, h, buf, buflen, res, err, origin(2))
+ }
bp := tls.Alloc(1600)
defer tls.Free(1600)
@@ -4359,6 +4485,9 @@ func Xgethostbyname2_r(tls *TLS, name uintptr, af int32, h uintptr, buf uintptr,
}
func Xgethostbyname_r(tls *TLS, name uintptr, h uintptr, buf uintptr, buflen size_t, res uintptr, err uintptr) int32 { /* gethostbyname_r.c:6:5: */
+ if __ccgo_strace {
+ trc("tls=%v name=%v h=%v buf=%v buflen=%v res=%v err=%v, (%v:)", tls, name, h, buf, buflen, res, err, origin(2))
+ }
return Xgethostbyname2_r(tls, name, 2, h, buf, buflen, res, err)
}
@@ -4658,6 +4787,9 @@ func reverse_services(tls *TLS, buf uintptr, port int32, dgram int32) { /* getna
}
func Xgetnameinfo(tls *TLS, sa1 uintptr, sl socklen_t, node uintptr, nodelen socklen_t, serv uintptr, servlen socklen_t, flags int32) int32 { /* getnameinfo.c:125:5: */
+ if __ccgo_strace {
+ trc("tls=%v sa1=%v sl=%v node=%v nodelen=%v serv=%v servlen=%v flags=%v, (%v:)", tls, sa1, sl, node, nodelen, serv, servlen, flags, origin(2))
+ }
bp := tls.Alloc(347)
defer tls.Free(347)
@@ -4758,10 +4890,16 @@ func Xgetnameinfo(tls *TLS, sa1 uintptr, sl socklen_t, node uintptr, nodelen soc
var Xh_errno int32 /* h_errno.c:4:5: */
func X__h_errno_location(tls *TLS) uintptr { /* h_errno.c:6:5: */
+ if __ccgo_strace {
+ trc("tls=%v, (%v:)", tls, origin(2))
+ }
return uintptr(unsafe.Pointer(&Xh_errno))
}
func X__inet_aton(tls *TLS, s0 uintptr, dest uintptr) int32 { /* inet_aton.c:7:5: */
+ if __ccgo_strace {
+ trc("tls=%v s0=%v dest=%v, (%v:)", tls, s0, dest, origin(2))
+ }
bp := tls.Alloc(40)
defer tls.Free(40)
@@ -4813,6 +4951,9 @@ func X__inet_aton(tls *TLS, s0 uintptr, dest uintptr) int32 { /* inet_aton.c:7:5
}
func Xinet_ntop(tls *TLS, af int32, a0 uintptr, s uintptr, l socklen_t) uintptr { /* inet_ntop.c:7:12: */
+ if __ccgo_strace {
+ trc("tls=%v af=%v a0=%v s=%v l=%v, (%v:)", tls, af, a0, s, l, origin(2))
+ }
bp := tls.Alloc(276)
defer tls.Free(276)
@@ -4887,6 +5028,9 @@ func hexval(tls *TLS, c uint32) int32 { /* inet_pton.c:7:12: */
}
func Xinet_pton(tls *TLS, af int32, s uintptr, a0 uintptr) int32 { /* inet_pton.c:15:5: */
+ if __ccgo_strace {
+ trc("tls=%v af=%v s=%v a0=%v, (%v:)", tls, af, s, a0, origin(2))
+ }
bp := tls.Alloc(16)
defer tls.Free(16)
@@ -4984,6 +5128,9 @@ func Xinet_pton(tls *TLS, af int32, s uintptr, a0 uintptr) int32 { /* inet_pton.
}
func X__lookup_ipliteral(tls *TLS, buf uintptr, name uintptr, family int32) int32 { /* lookup_ipliteral.c:12:5: */
+ if __ccgo_strace {
+ trc("tls=%v buf=%v name=%v family=%v, (%v:)", tls, buf, name, family, origin(2))
+ }
bp := tls.Alloc(96)
defer tls.Free(96)
@@ -5294,6 +5441,9 @@ func addrcmp(tls *TLS, _a uintptr, _b uintptr) int32 { /* lookup_name.c:305:12:
}
func X__lookup_name(tls *TLS, buf uintptr, canon uintptr, name uintptr, family int32, flags int32) int32 { /* lookup_name.c:311:5: */
+ if __ccgo_strace {
+ trc("tls=%v buf=%v canon=%v name=%v family=%v flags=%v, (%v:)", tls, buf, canon, name, family, flags, origin(2))
+ }
bp := tls.Alloc(92)
defer tls.Free(92)
@@ -5460,6 +5610,9 @@ func X__lookup_name(tls *TLS, buf uintptr, canon uintptr, name uintptr, family i
}
func X__lookup_serv(tls *TLS, buf uintptr, name uintptr, proto int32, socktype int32, flags int32) int32 { /* lookup_serv.c:12:5: */
+ if __ccgo_strace {
+ trc("tls=%v buf=%v name=%v proto=%v socktype=%v flags=%v, (%v:)", tls, buf, name, proto, socktype, flags, origin(2))
+ }
bp := tls.Alloc(8)
defer tls.Free(8)
@@ -5593,10 +5746,16 @@ func temper(tls *TLS, x uint32) uint32 { /* rand_r.c:3:17: */
}
func Xrand_r(tls *TLS, seed uintptr) int32 { /* rand_r.c:12:5: */
+ if __ccgo_strace {
+ trc("tls=%v seed=%v, (%v:)", tls, seed, origin(2))
+ }
return int32(temper(tls, AssignPtrUint32(seed, *(*uint32)(unsafe.Pointer(seed))*uint32(1103515245)+uint32(12345))) / uint32(2))
}
func X__lockfile(tls *TLS, f uintptr) int32 { /* __lockfile.c:4:5: */
+ if __ccgo_strace {
+ trc("tls=%v f=%v, (%v:)", tls, f, origin(2))
+ }
var owner int32 = (*FILE)(unsafe.Pointer(f)).lock
var tid int32 = (*__pthread)(unsafe.Pointer(__pthread_self(tls))).tid
if owner&CplInt32(0x40000000) == tid {
@@ -5615,12 +5774,18 @@ func X__lockfile(tls *TLS, f uintptr) int32 { /* __lockfile.c:4:5: */
}
func X__unlockfile(tls *TLS, f uintptr) { /* __lockfile.c:19:6: */
+ if __ccgo_strace {
+ trc("tls=%v f=%v, (%v:)", tls, f, origin(2))
+ }
if a_swap(tls, f+140, 0)&0x40000000 != 0 {
__wake(tls, f+140, 1, 1)
}
}
func X__toread(tls *TLS, f uintptr) int32 { /* __toread.c:3:5: */
+ if __ccgo_strace {
+ trc("tls=%v f=%v, (%v:)", tls, f, origin(2))
+ }
*(*int32)(unsafe.Pointer(f + 136)) |= (*FILE)(unsafe.Pointer(f)).mode - 1
if (*FILE)(unsafe.Pointer(f)).wpos != (*FILE)(unsafe.Pointer(f)).wbase {
(*struct {
@@ -5640,6 +5805,9 @@ func X__toread(tls *TLS, f uintptr) int32 { /* __toread.c:3:5: */
}
func X__toread_needs_stdio_exit(tls *TLS) { /* __toread.c:16:13: */
+ if __ccgo_strace {
+ trc("tls=%v, (%v:)", tls, origin(2))
+ }
X__builtin_abort(tls) //TODO-
// __stdio_exit_needed();
}
@@ -5648,6 +5816,9 @@ func X__toread_needs_stdio_exit(tls *TLS) { /* __toread.c:16:13: */
// data buffered for reading.
func X__uflow(tls *TLS, f uintptr) int32 { /* __uflow.c:6:5: */
+ if __ccgo_strace {
+ trc("tls=%v f=%v, (%v:)", tls, f, origin(2))
+ }
bp := tls.Alloc(1)
defer tls.Free(1)
@@ -5662,6 +5833,9 @@ func X__uflow(tls *TLS, f uintptr) int32 { /* __uflow.c:6:5: */
}
func Xsscanf(tls *TLS, s uintptr, fmt uintptr, va uintptr) int32 { /* sscanf.c:4:5: */
+ if __ccgo_strace {
+ trc("tls=%v s=%v fmt=%v va=%v, (%v:)", tls, s, fmt, va, origin(2))
+ }
var ret int32
var ap va_list
_ = ap
@@ -5711,6 +5885,9 @@ func arg_n(tls *TLS, ap va_list, n uint32) uintptr { /* vfscanf.c:44:13: */
}
func Xvfscanf(tls *TLS, f uintptr, fmt uintptr, ap va_list) int32 { /* vfscanf.c:56:5: */
+ if __ccgo_strace {
+ trc("tls=%v f=%v fmt=%v ap=%v, (%v:)", tls, f, fmt, ap, origin(2))
+ }
bp := tls.Alloc(276)
defer tls.Free(276)
@@ -6586,6 +6763,9 @@ func string_read(tls *TLS, f uintptr, buf uintptr, len size_t) size_t { /* vssca
}
func Xvsscanf(tls *TLS, s uintptr, fmt uintptr, ap va_list) int32 { /* vsscanf.c:18:5: */
+ if __ccgo_strace {
+ trc("tls=%v s=%v fmt=%v ap=%v, (%v:)", tls, s, fmt, ap, origin(2))
+ }
bp := tls.Alloc(232)
defer tls.Free(232)
@@ -6596,6 +6776,9 @@ func Xvsscanf(tls *TLS, s uintptr, fmt uintptr, ap va_list) int32 { /* vsscanf.c
}
func Xbsearch(tls *TLS, key uintptr, base uintptr, nel size_t, width size_t, cmp uintptr) uintptr { /* bsearch.c:3:6: */
+ if __ccgo_strace {
+ trc("tls=%v key=%v base=%v nel=%v width=%v cmp=%v, (%v:)", tls, key, base, nel, width, cmp, origin(2))
+ }
var try uintptr
var sign int32
for nel > uint64(0) {
@@ -6638,14 +6821,23 @@ func strtox(tls *TLS, s uintptr, p uintptr, prec int32) float64 { /* strtod.c:6:
}
func Xstrtof(tls *TLS, s uintptr, p uintptr) float32 { /* strtod.c:17:7: */
+ if __ccgo_strace {
+ trc("tls=%v s=%v p=%v, (%v:)", tls, s, p, origin(2))
+ }
return float32(strtox(tls, s, p, 0))
}
func Xstrtod(tls *TLS, s uintptr, p uintptr) float64 { /* strtod.c:22:8: */
+ if __ccgo_strace {
+ trc("tls=%v s=%v p=%v, (%v:)", tls, s, p, origin(2))
+ }
return strtox(tls, s, p, 1)
}
func Xstrtold(tls *TLS, s uintptr, p uintptr) float64 { /* strtod.c:27:13: */
+ if __ccgo_strace {
+ trc("tls=%v s=%v p=%v, (%v:)", tls, s, p, origin(2))
+ }
return strtox(tls, s, p, 2)
}
@@ -6667,30 +6859,51 @@ func strtox1(tls *TLS, s uintptr, p uintptr, base int32, lim uint64) uint64 { /*
}
func Xstrtoull(tls *TLS, s uintptr, p uintptr, base int32) uint64 { /* strtol.c:21:20: */
+ if __ccgo_strace {
+ trc("tls=%v s=%v p=%v base=%v, (%v:)", tls, s, p, base, origin(2))
+ }
return strtox1(tls, s, p, base, 2*uint64(0x7fffffffffffffff)+uint64(1))
}
func Xstrtoll(tls *TLS, s uintptr, p uintptr, base int32) int64 { /* strtol.c:26:11: */
+ if __ccgo_strace {
+ trc("tls=%v s=%v p=%v base=%v, (%v:)", tls, s, p, base, origin(2))
+ }
return int64(strtox1(tls, s, p, base, Uint64FromInt64(-0x7fffffffffffffff-int64(1))))
}
func Xstrtoul(tls *TLS, s uintptr, p uintptr, base int32) uint64 { /* strtol.c:31:15: */
+ if __ccgo_strace {
+ trc("tls=%v s=%v p=%v base=%v, (%v:)", tls, s, p, base, origin(2))
+ }
return uint64(strtox1(tls, s, p, base, 2*uint64(0x7fffffffffffffff)+uint64(1)))
}
func Xstrtol(tls *TLS, s uintptr, p uintptr, base int32) int64 { /* strtol.c:36:6: */
+ if __ccgo_strace {
+ trc("tls=%v s=%v p=%v base=%v, (%v:)", tls, s, p, base, origin(2))
+ }
return int64(strtox1(tls, s, p, base, 0+Uint64FromInt64(Int64(-Int64(0x7fffffffffffffff))-Int64FromInt32(1))))
}
func Xstrtoimax(tls *TLS, s uintptr, p uintptr, base int32) intmax_t { /* strtol.c:41:10: */
+ if __ccgo_strace {
+ trc("tls=%v s=%v p=%v base=%v, (%v:)", tls, s, p, base, origin(2))
+ }
return intmax_t(Xstrtoll(tls, s, p, base))
}
func Xstrtoumax(tls *TLS, s uintptr, p uintptr, base int32) uintmax_t { /* strtol.c:46:11: */
+ if __ccgo_strace {
+ trc("tls=%v s=%v p=%v base=%v, (%v:)", tls, s, p, base, origin(2))
+ }
return uintmax_t(Xstrtoull(tls, s, p, base))
}
func Xstrdup(tls *TLS, s uintptr) uintptr { /* strdup.c:4:6: */
+ if __ccgo_strace {
+ trc("tls=%v s=%v, (%v:)", tls, s, origin(2))
+ }
var l size_t = Xstrlen(tls, s)
var d uintptr = Xmalloc(tls, l+uint64(1))
if !(d != 0) {
@@ -6700,6 +6913,9 @@ func Xstrdup(tls *TLS, s uintptr) uintptr { /* strdup.c:4:6: */
}
func Xstrlcat(tls *TLS, d uintptr, s uintptr, n size_t) size_t { /* strlcat.c:4:8: */
+ if __ccgo_strace {
+ trc("tls=%v d=%v s=%v n=%v, (%v:)", tls, d, s, n, origin(2))
+ }
var l size_t = Xstrnlen(tls, d, n)
if l == n {
return l + Xstrlen(tls, s)
@@ -6717,6 +6933,9 @@ func Xstrlcat(tls *TLS, d uintptr, s uintptr, n size_t) size_t { /* strlcat.c:4:
// from SUS and have nothing to do with the host system.
func Xstrlcpy(tls *TLS, d uintptr, s uintptr, n size_t) size_t { /* strlcpy.c:11:8: */
+ if __ccgo_strace {
+ trc("tls=%v d=%v s=%v n=%v, (%v:)", tls, d, s, n, origin(2))
+ }
var d0 uintptr
var wd uintptr
var ws uintptr
@@ -6788,6 +7007,9 @@ finish:
}
func Xstrncasecmp(tls *TLS, _l uintptr, _r uintptr, n size_t) int32 { /* strncasecmp.c:4:5: */
+ if __ccgo_strace {
+ trc("tls=%v _l=%v _r=%v n=%v, (%v:)", tls, _l, _r, n, origin(2))
+ }
var l uintptr = _l
var r uintptr = _r
if !(int32(PostDecUint64(&n, 1)) != 0) {
@@ -6810,10 +7032,16 @@ __3:
}
func X__strncasecmp_l(tls *TLS, l uintptr, r uintptr, n size_t, loc locale_t) int32 { /* strncasecmp.c:12:5: */
+ if __ccgo_strace {
+ trc("tls=%v l=%v r=%v n=%v loc=%v, (%v:)", tls, l, r, n, loc, origin(2))
+ }
return Xstrncasecmp(tls, l, r, n)
}
func Xstrncat(tls *TLS, d uintptr, s uintptr, n size_t) uintptr { /* strncat.c:3:6: */
+ if __ccgo_strace {
+ trc("tls=%v d=%v s=%v n=%v, (%v:)", tls, d, s, n, origin(2))
+ }
var a uintptr = d
d += uintptr(Xstrlen(tls, d))
for n != 0 && *(*uint8)(unsafe.Pointer(s)) != 0 {
@@ -6825,6 +7053,9 @@ func Xstrncat(tls *TLS, d uintptr, s uintptr, n size_t) uintptr { /* strncat.c:3
}
func Xstrnlen(tls *TLS, s uintptr, n size_t) size_t { /* strnlen.c:3:8: */
+ if __ccgo_strace {
+ trc("tls=%v s=%v n=%v, (%v:)", tls, s, n, origin(2))
+ }
var p uintptr = Xmemchr(tls, s, 0, n)
if p != 0 {
return uint64((int64(p) - int64(s)) / 1)
@@ -6833,6 +7064,9 @@ func Xstrnlen(tls *TLS, s uintptr, n size_t) size_t { /* strnlen.c:3:8: */
}
func Xstrspn(tls *TLS, s uintptr, c uintptr) size_t { /* strspn.c:6:8: */
+ if __ccgo_strace {
+ trc("tls=%v s=%v c=%v, (%v:)", tls, s, c, origin(2))
+ }
bp := tls.Alloc(32)
defer tls.Free(32)
@@ -6856,6 +7090,9 @@ func Xstrspn(tls *TLS, s uintptr, c uintptr) size_t { /* strspn.c:6:8: */
}
func Xstrtok(tls *TLS, s uintptr, sep uintptr) uintptr { /* strtok.c:3:6: */
+ if __ccgo_strace {
+ trc("tls=%v s=%v sep=%v, (%v:)", tls, s, sep, origin(2))
+ }
if !(s != 0) && !(int32(AssignUintptr(&s, _sp)) != 0) {
return uintptr(0)
}
@@ -6875,10 +7112,16 @@ func Xstrtok(tls *TLS, s uintptr, sep uintptr) uintptr { /* strtok.c:3:6: */
var _sp uintptr /* strtok.c:5:14: */
func X__ccgo_pthreadAttrGetDetachState(tls *TLS, a uintptr) int32 { /* pthread_attr_get.c:3:5: */
+ if __ccgo_strace {
+ trc("tls=%v a=%v, (%v:)", tls, a, origin(2))
+ }
return *(*int32)(unsafe.Pointer(a + 6*4))
}
func Xpthread_attr_getdetachstate(tls *TLS, a uintptr, state uintptr) int32 { /* pthread_attr_get.c:7:5: */
+ if __ccgo_strace {
+ trc("tls=%v a=%v state=%v, (%v:)", tls, a, state, origin(2))
+ }
*(*int32)(unsafe.Pointer(state)) = *(*int32)(unsafe.Pointer(a + 6*4))
return 0
}
@@ -6965,6 +7208,9 @@ func Xpthread_attr_getdetachstate(tls *TLS, a uintptr, state uintptr) int32 { /*
// }
func X__ccgo_pthreadMutexattrGettype(tls *TLS, a uintptr) int32 { /* pthread_attr_get.c:93:5: */
+ if __ccgo_strace {
+ trc("tls=%v a=%v, (%v:)", tls, a, origin(2))
+ }
return int32((*pthread_mutexattr_t)(unsafe.Pointer(a)).__attr & uint32(3))
}
@@ -6981,6 +7227,9 @@ func X__ccgo_pthreadMutexattrGettype(tls *TLS, a uintptr) int32 { /* pthread_att
// }
func Xpthread_attr_setdetachstate(tls *TLS, a uintptr, state int32) int32 { /* pthread_attr_setdetachstate.c:3:5: */
+ if __ccgo_strace {
+ trc("tls=%v a=%v state=%v, (%v:)", tls, a, state, origin(2))
+ }
if uint32(state) > 1 {
return 22
}
@@ -6989,6 +7238,9 @@ func Xpthread_attr_setdetachstate(tls *TLS, a uintptr, state int32) int32 { /* p
}
func X__ccgo_getMutexType(tls *TLS, m uintptr) int32 { /* pthread_mutex_lock.c:3:5: */
+ if __ccgo_strace {
+ trc("tls=%v m=%v, (%v:)", tls, m, origin(2))
+ }
return *(*int32)(unsafe.Pointer(m)) & 15
}
@@ -7004,15 +7256,24 @@ func X__ccgo_getMutexType(tls *TLS, m uintptr) int32 { /* pthread_mutex_lock.c:3
// weak_alias(__pthread_mutex_lock, pthread_mutex_lock);
func Xpthread_mutexattr_destroy(tls *TLS, a uintptr) int32 { /* pthread_mutexattr_destroy.c:3:5: */
+ if __ccgo_strace {
+ trc("tls=%v a=%v, (%v:)", tls, a, origin(2))
+ }
return 0
}
func Xpthread_mutexattr_init(tls *TLS, a uintptr) int32 { /* pthread_mutexattr_init.c:3:5: */
+ if __ccgo_strace {
+ trc("tls=%v a=%v, (%v:)", tls, a, origin(2))
+ }
*(*pthread_mutexattr_t)(unsafe.Pointer(a)) = pthread_mutexattr_t{}
return 0
}
func Xpthread_mutexattr_settype(tls *TLS, a uintptr, type1 int32) int32 { /* pthread_mutexattr_settype.c:3:5: */
+ if __ccgo_strace {
+ trc("tls=%v a=%v type1=%v, (%v:)", tls, a, type1, origin(2))
+ }
if uint32(type1) > uint32(2) {
return 22
}
diff --git a/vendor/modernc.org/libc/musl_linux_loong64.go b/vendor/modernc.org/libc/musl_linux_loong64.go
index 7921d992..9171f999 100644
--- a/vendor/modernc.org/libc/musl_linux_loong64.go
+++ b/vendor/modernc.org/libc/musl_linux_loong64.go
@@ -403,6 +403,9 @@ var table = [384]uint16{
var ptable uintptr = 0 /* __ctype_b_loc.c:36:29 */
func X__ctype_b_loc(tls *TLS) uintptr { /* __ctype_b_loc.c:38:22: */
+ if __ccgo_strace {
+ trc("tls=%v, (%v:)", tls, origin(2))
+ }
return uintptr(unsafe.Pointer(&ptable))
}
@@ -415,6 +418,9 @@ type __locale_struct = struct{ cat [6]uintptr } /* alltypes.h:343:9 */
type locale_t = uintptr /* alltypes.h:343:32 */
func Xisalnum(tls *TLS, c int32) int32 { /* isalnum.c:3:5: */
+ if __ccgo_strace {
+ trc("tls=%v c=%v, (%v:)", tls, c, origin(2))
+ }
return Bool32(func() int32 {
if 0 != 0 {
return Xisalpha(tls, c)
@@ -429,50 +435,86 @@ func Xisalnum(tls *TLS, c int32) int32 { /* isalnum.c:3:5: */
}
func X__isalnum_l(tls *TLS, c int32, l locale_t) int32 { /* isalnum.c:8:5: */
+ if __ccgo_strace {
+ trc("tls=%v c=%v l=%v, (%v:)", tls, c, l, origin(2))
+ }
return Xisalnum(tls, c)
}
func Xisalpha(tls *TLS, c int32) int32 { /* isalpha.c:4:5: */
+ if __ccgo_strace {
+ trc("tls=%v c=%v, (%v:)", tls, c, origin(2))
+ }
return Bool32(uint32(c)|uint32(32)-uint32('a') < uint32(26))
}
func X__isalpha_l(tls *TLS, c int32, l locale_t) int32 { /* isalpha.c:9:5: */
+ if __ccgo_strace {
+ trc("tls=%v c=%v l=%v, (%v:)", tls, c, l, origin(2))
+ }
return Xisalpha(tls, c)
}
func Xisdigit(tls *TLS, c int32) int32 { /* isdigit.c:4:5: */
+ if __ccgo_strace {
+ trc("tls=%v c=%v, (%v:)", tls, c, origin(2))
+ }
return Bool32(uint32(c)-uint32('0') < uint32(10))
}
func X__isdigit_l(tls *TLS, c int32, l locale_t) int32 { /* isdigit.c:9:5: */
+ if __ccgo_strace {
+ trc("tls=%v c=%v l=%v, (%v:)", tls, c, l, origin(2))
+ }
return Xisdigit(tls, c)
}
func Xislower(tls *TLS, c int32) int32 { /* islower.c:4:5: */
+ if __ccgo_strace {
+ trc("tls=%v c=%v, (%v:)", tls, c, origin(2))
+ }
return Bool32(uint32(c)-uint32('a') < uint32(26))
}
func X__islower_l(tls *TLS, c int32, l locale_t) int32 { /* islower.c:9:5: */
+ if __ccgo_strace {
+ trc("tls=%v c=%v l=%v, (%v:)", tls, c, l, origin(2))
+ }
return Xislower(tls, c)
}
func Xisprint(tls *TLS, c int32) int32 { /* isprint.c:4:5: */
+ if __ccgo_strace {
+ trc("tls=%v c=%v, (%v:)", tls, c, origin(2))
+ }
return Bool32(uint32(c)-uint32(0x20) < uint32(0x5f))
}
func X__isprint_l(tls *TLS, c int32, l locale_t) int32 { /* isprint.c:9:5: */
+ if __ccgo_strace {
+ trc("tls=%v c=%v l=%v, (%v:)", tls, c, l, origin(2))
+ }
return Xisprint(tls, c)
}
func Xisupper(tls *TLS, c int32) int32 { /* isupper.c:4:5: */
+ if __ccgo_strace {
+ trc("tls=%v c=%v, (%v:)", tls, c, origin(2))
+ }
return Bool32(uint32(c)-uint32('A') < uint32(26))
}
func X__isupper_l(tls *TLS, c int32, l locale_t) int32 { /* isupper.c:9:5: */
+ if __ccgo_strace {
+ trc("tls=%v c=%v l=%v, (%v:)", tls, c, l, origin(2))
+ }
return Xisupper(tls, c)
}
func Xisxdigit(tls *TLS, c int32) int32 { /* isxdigit.c:3:5: */
+ if __ccgo_strace {
+ trc("tls=%v c=%v, (%v:)", tls, c, origin(2))
+ }
return Bool32(func() int32 {
if 0 != 0 {
return Xisdigit(tls, c)
@@ -482,6 +524,9 @@ func Xisxdigit(tls *TLS, c int32) int32 { /* isxdigit.c:3:5: */
}
func X__isxdigit_l(tls *TLS, c int32, l locale_t) int32 { /* isxdigit.c:8:5: */
+ if __ccgo_strace {
+ trc("tls=%v c=%v l=%v, (%v:)", tls, c, l, origin(2))
+ }
return Xisxdigit(tls, c)
}
@@ -535,6 +580,9 @@ type lldiv_t = struct {
} /* stdlib.h:64:41 */
func Xclosedir(tls *TLS, dir uintptr) int32 { /* closedir.c:6:5: */
+ if __ccgo_strace {
+ trc("tls=%v dir=%v, (%v:)", tls, dir, origin(2))
+ }
var ret int32 = Xclose(tls, (*DIR)(unsafe.Pointer(dir)).fd)
Xfree(tls, dir)
return ret
@@ -571,6 +619,9 @@ type f_owner_ex = struct {
type syscall_arg_t = int64 /* syscall.h:22:14 */
func Xopendir(tls *TLS, name uintptr) uintptr { /* opendir.c:8:5: */
+ if __ccgo_strace {
+ trc("tls=%v name=%v, (%v:)", tls, name, origin(2))
+ }
var fd int32
var dir uintptr
@@ -593,6 +644,9 @@ type max_align_t = struct {
type dirstream_buf_alignment_check = [1]int8 /* readdir.c:7:14 */
func Xreaddir(tls *TLS, dir uintptr) uintptr { /* readdir.c:10:15: */
+ if __ccgo_strace {
+ trc("tls=%v dir=%v, (%v:)", tls, dir, origin(2))
+ }
var de uintptr
if (*DIR)(unsafe.Pointer(dir)).buf_pos >= (*DIR)(unsafe.Pointer(dir)).buf_end {
@@ -1356,6 +1410,9 @@ func hexfloat(tls *TLS, f uintptr, bits int32, emin int32, sign int32, pok int32
}
func X__floatscan(tls *TLS, f uintptr, prec int32, pok int32) float64 { /* floatscan.c:427:13: */
+ if __ccgo_strace {
+ trc("tls=%v f=%v prec=%v pok=%v, (%v:)", tls, f, prec, pok, origin(2))
+ }
var sign int32 = 1
var i size_t
var bits int32
@@ -1533,6 +1590,9 @@ var table1 = [257]uint8{Uint8FromInt32(-1),
} /* intscan.c:7:28 */
func X__intscan(tls *TLS, f uintptr, base uint32, pok int32, lim uint64) uint64 { /* intscan.c:26:20: */
+ if __ccgo_strace {
+ trc("tls=%v f=%v base=%v pok=%v lim=%v, (%v:)", tls, f, base, pok, lim, origin(2))
+ }
var val uintptr
var c int32
var neg int32
@@ -1838,6 +1898,9 @@ __43:
// the actual count.
func X__shlim(tls *TLS, f uintptr, lim off_t) { /* shgetc.c:8:6: */
+ if __ccgo_strace {
+ trc("tls=%v f=%v lim=%v, (%v:)", tls, f, lim, origin(2))
+ }
(*FILE)(unsafe.Pointer(f)).shlim = lim
(*FILE)(unsafe.Pointer(f)).shcnt = (int64((*FILE)(unsafe.Pointer(f)).buf) - int64((*FILE)(unsafe.Pointer(f)).rpos)) / 1
// If lim is nonzero, rend must be a valid pointer.
@@ -1849,6 +1912,9 @@ func X__shlim(tls *TLS, f uintptr, lim off_t) { /* shgetc.c:8:6: */
}
func X__shgetc(tls *TLS, f uintptr) int32 { /* shgetc.c:19:5: */
+ if __ccgo_strace {
+ trc("tls=%v f=%v, (%v:)", tls, f, origin(2))
+ }
var c int32
var cnt off_t = (*FILE)(unsafe.Pointer(f)).shcnt + (int64((*FILE)(unsafe.Pointer(f)).rpos)-int64((*FILE)(unsafe.Pointer(f)).buf))/1
if (*FILE)(unsafe.Pointer(f)).shlim != 0 && cnt >= (*FILE)(unsafe.Pointer(f)).shlim || AssignInt32(&c, X__uflow(tls, f)) < 0 {
@@ -1910,10 +1976,16 @@ type lconv = struct {
var posix_lconv = lconv{decimal_point: ts + 23, thousands_sep: ts + 13, grouping: ts + 13, int_curr_symbol: ts + 13, currency_symbol: ts + 13, mon_decimal_point: ts + 13, mon_thousands_sep: ts + 13, mon_grouping: ts + 13, positive_sign: ts + 13, negative_sign: ts + 13, int_frac_digits: Int8FromInt32(255), frac_digits: Int8FromInt32(255), p_cs_precedes: Int8FromInt32(255), p_sep_by_space: Int8FromInt32(255), n_cs_precedes: Int8FromInt32(255), n_sep_by_space: Int8FromInt32(255), p_sign_posn: Int8FromInt32(255), n_sign_posn: Int8FromInt32(255), int_p_cs_precedes: Int8FromInt32(255), int_p_sep_by_space: Int8FromInt32(255), int_n_cs_precedes: Int8FromInt32(255), int_n_sep_by_space: Int8FromInt32(255), int_p_sign_posn: Int8FromInt32(255), int_n_sign_posn: Int8FromInt32(255)} /* localeconv.c:4:27 */
func Xlocaleconv(tls *TLS) uintptr { /* localeconv.c:31:14: */
+ if __ccgo_strace {
+ trc("tls=%v, (%v:)", tls, origin(2))
+ }
return uintptr(unsafe.Pointer(&posix_lconv))
}
func X__fpclassify(tls *TLS, x float64) int32 { /* __fpclassify.c:4:5: */
+ if __ccgo_strace {
+ trc("tls=%v x=%v, (%v:)", tls, x, origin(2))
+ }
bp := tls.Alloc(8)
defer tls.Free(8)
@@ -1938,6 +2010,9 @@ func X__fpclassify(tls *TLS, x float64) int32 { /* __fpclassify.c:4:5: */
}
func X__fpclassifyf(tls *TLS, x float32) int32 { /* __fpclassifyf.c:4:5: */
+ if __ccgo_strace {
+ trc("tls=%v x=%v, (%v:)", tls, x, origin(2))
+ }
bp := tls.Alloc(4)
defer tls.Free(4)
@@ -1962,28 +2037,46 @@ func X__fpclassifyf(tls *TLS, x float32) int32 { /* __fpclassifyf.c:4:5: */
}
func X__fpclassifyl(tls *TLS, x float64) int32 { /* __fpclassifyl.c:4:5: */
+ if __ccgo_strace {
+ trc("tls=%v x=%v, (%v:)", tls, x, origin(2))
+ }
return X__fpclassify(tls, x)
}
func Xcopysignl(tls *TLS, x float64, y float64) float64 { /* copysignl.c:4:13: */
+ if __ccgo_strace {
+ trc("tls=%v x=%v y=%v, (%v:)", tls, x, y, origin(2))
+ }
return Xcopysign(tls, x, y)
}
func Xfabsl(tls *TLS, x float64) float64 { /* fabsl.c:3:13: */
+ if __ccgo_strace {
+ trc("tls=%v x=%v, (%v:)", tls, x, origin(2))
+ }
return Xfabs(tls, x)
}
func Xfmodl(tls *TLS, x float64, y float64) float64 { /* fmodl.c:4:13: */
+ if __ccgo_strace {
+ trc("tls=%v x=%v y=%v, (%v:)", tls, x, y, origin(2))
+ }
return Xfmod(tls, x, y)
}
func Xnanf(tls *TLS, s uintptr) float32 { /* nanf.c:3:7: */
+ if __ccgo_strace {
+ trc("tls=%v s=%v, (%v:)", tls, s, origin(2))
+ }
return X__builtin_nanf(tls, ts+13)
}
var toint double_t = float64(float64(1)) / 2.22044604925031308085e-16 /* rint.c:10:23 */
func Xrint(tls *TLS, x float64) float64 { /* rint.c:12:8: */
+ if __ccgo_strace {
+ trc("tls=%v x=%v, (%v:)", tls, x, origin(2))
+ }
bp := tls.Alloc(8)
defer tls.Free(8)
@@ -2013,6 +2106,9 @@ func Xrint(tls *TLS, x float64) float64 { /* rint.c:12:8: */
}
func Xscalbn(tls *TLS, x float64, n int32) float64 { /* scalbn.c:4:8: */
+ if __ccgo_strace {
+ trc("tls=%v x=%v n=%v, (%v:)", tls, x, n, origin(2))
+ }
bp := tls.Alloc(8)
defer tls.Free(8)
@@ -2049,6 +2145,9 @@ func Xscalbn(tls *TLS, x float64, n int32) float64 { /* scalbn.c:4:8: */
}
func Xscalbnl(tls *TLS, x float64, n int32) float64 { /* scalbnl.c:4:13: */
+ if __ccgo_strace {
+ trc("tls=%v x=%v n=%v, (%v:)", tls, x, n, origin(2))
+ }
return Xscalbn(tls, x, n)
}
@@ -3386,6 +3485,9 @@ type __mbstate_t = struct {
type mbstate_t = __mbstate_t /* alltypes.h:337:63 */
func Xmbrtowc(tls *TLS, wc uintptr, src uintptr, n size_t, st uintptr) size_t { /* mbrtowc.c:6:8: */
+ if __ccgo_strace {
+ trc("tls=%v wc=%v src=%v n=%v st=%v, (%v:)", tls, wc, src, n, st, origin(2))
+ }
bp := tls.Alloc(4)
defer tls.Free(4)
@@ -3509,6 +3611,9 @@ ilseq:
var _sinternal_state uint32 /* mbrtowc.c:8:18: */
func Xmbsinit(tls *TLS, st uintptr) int32 { /* mbsinit.c:3:5: */
+ if __ccgo_strace {
+ trc("tls=%v st=%v, (%v:)", tls, st, origin(2))
+ }
return Bool32(!(st != 0) || !(int32(*(*uint32)(unsafe.Pointer(st))) != 0))
}
@@ -3811,6 +3916,9 @@ type resolvconf = struct {
} /* lookup.h:34:1 */
func Xfreeaddrinfo(tls *TLS, p uintptr) { /* freeaddrinfo.c:7:6: */
+ if __ccgo_strace {
+ trc("tls=%v p=%v, (%v:)", tls, p, origin(2))
+ }
var cnt size_t
cnt = uint64(1)
__1:
@@ -3835,6 +3943,9 @@ __3:
}
func Xgetaddrinfo(tls *TLS, host uintptr, serv uintptr, hint uintptr, res uintptr) int32 { /* getaddrinfo.c:12:5: */
+ if __ccgo_strace {
+ trc("tls=%v host=%v serv=%v hint=%v res=%v, (%v:)", tls, host, serv, hint, res, origin(2))
+ }
bp := tls.Alloc(1608)
defer tls.Free(1608)
@@ -4039,6 +4150,9 @@ type mmsghdr = struct {
} /* socket.h:63:1 */
func Xgethostbyaddr(tls *TLS, a uintptr, l socklen_t, af int32) uintptr { /* gethostbyaddr.c:7:16: */
+ if __ccgo_strace {
+ trc("tls=%v a=%v l=%v af=%v, (%v:)", tls, a, l, af, origin(2))
+ }
bp := tls.Alloc(8)
defer tls.Free(8)
@@ -4065,6 +4179,9 @@ func Xgethostbyaddr(tls *TLS, a uintptr, l socklen_t, af int32) uintptr { /* get
var _sh uintptr /* gethostbyaddr.c:9:24: */
func Xgethostbyaddr_r(tls *TLS, a uintptr, l socklen_t, af int32, h uintptr, buf uintptr, buflen size_t, res uintptr, err uintptr) int32 { /* gethostbyaddr_r.c:10:5: */
+ if __ccgo_strace {
+ trc("tls=%v a=%v l=%v af=%v h=%v buf=%v buflen=%v res=%v err=%v, (%v:)", tls, a, l, af, h, buf, buflen, res, err, origin(2))
+ }
bp := tls.Alloc(28)
defer tls.Free(28)
@@ -4150,10 +4267,16 @@ func Xgethostbyaddr_r(tls *TLS, a uintptr, l socklen_t, af int32, h uintptr, buf
}
func Xgethostbyname(tls *TLS, name uintptr) uintptr { /* gethostbyname.c:8:16: */
+ if __ccgo_strace {
+ trc("tls=%v name=%v, (%v:)", tls, name, origin(2))
+ }
return Xgethostbyname2(tls, name, 2)
}
func Xgethostbyname2(tls *TLS, name uintptr, af int32) uintptr { /* gethostbyname2.c:8:16: */
+ if __ccgo_strace {
+ trc("tls=%v name=%v af=%v, (%v:)", tls, name, af, origin(2))
+ }
bp := tls.Alloc(8)
defer tls.Free(8)
@@ -4180,6 +4303,9 @@ func Xgethostbyname2(tls *TLS, name uintptr, af int32) uintptr { /* gethostbynam
var _sh1 uintptr /* gethostbyname2.c:10:24: */
func Xgethostbyname2_r(tls *TLS, name uintptr, af int32, h uintptr, buf uintptr, buflen size_t, res uintptr, err uintptr) int32 { /* gethostbyname2_r.c:11:5: */
+ if __ccgo_strace {
+ trc("tls=%v name=%v af=%v h=%v buf=%v buflen=%v res=%v err=%v, (%v:)", tls, name, af, h, buf, buflen, res, err, origin(2))
+ }
bp := tls.Alloc(1600)
defer tls.Free(1600)
@@ -4271,6 +4397,9 @@ func Xgethostbyname2_r(tls *TLS, name uintptr, af int32, h uintptr, buf uintptr,
}
func Xgethostbyname_r(tls *TLS, name uintptr, h uintptr, buf uintptr, buflen size_t, res uintptr, err uintptr) int32 { /* gethostbyname_r.c:6:5: */
+ if __ccgo_strace {
+ trc("tls=%v name=%v h=%v buf=%v buflen=%v res=%v err=%v, (%v:)", tls, name, h, buf, buflen, res, err, origin(2))
+ }
return Xgethostbyname2_r(tls, name, 2, h, buf, buflen, res, err)
}
@@ -4570,6 +4699,9 @@ func reverse_services(tls *TLS, buf uintptr, port int32, dgram int32) { /* getna
}
func Xgetnameinfo(tls *TLS, sa1 uintptr, sl socklen_t, node uintptr, nodelen socklen_t, serv uintptr, servlen socklen_t, flags int32) int32 { /* getnameinfo.c:125:5: */
+ if __ccgo_strace {
+ trc("tls=%v sa1=%v sl=%v node=%v nodelen=%v serv=%v servlen=%v flags=%v, (%v:)", tls, sa1, sl, node, nodelen, serv, servlen, flags, origin(2))
+ }
bp := tls.Alloc(347)
defer tls.Free(347)
@@ -4670,10 +4802,16 @@ func Xgetnameinfo(tls *TLS, sa1 uintptr, sl socklen_t, node uintptr, nodelen soc
var Xh_errno int32 /* h_errno.c:4:5: */
func X__h_errno_location(tls *TLS) uintptr { /* h_errno.c:6:5: */
+ if __ccgo_strace {
+ trc("tls=%v, (%v:)", tls, origin(2))
+ }
return uintptr(unsafe.Pointer(&Xh_errno))
}
func X__inet_aton(tls *TLS, s0 uintptr, dest uintptr) int32 { /* inet_aton.c:7:5: */
+ if __ccgo_strace {
+ trc("tls=%v s0=%v dest=%v, (%v:)", tls, s0, dest, origin(2))
+ }
bp := tls.Alloc(40)
defer tls.Free(40)
@@ -4725,6 +4863,9 @@ func X__inet_aton(tls *TLS, s0 uintptr, dest uintptr) int32 { /* inet_aton.c:7:5
}
func Xinet_ntop(tls *TLS, af int32, a0 uintptr, s uintptr, l socklen_t) uintptr { /* inet_ntop.c:7:12: */
+ if __ccgo_strace {
+ trc("tls=%v af=%v a0=%v s=%v l=%v, (%v:)", tls, af, a0, s, l, origin(2))
+ }
bp := tls.Alloc(276)
defer tls.Free(276)
@@ -4799,6 +4940,9 @@ func hexval(tls *TLS, c uint32) int32 { /* inet_pton.c:7:12: */
}
func Xinet_pton(tls *TLS, af int32, s uintptr, a0 uintptr) int32 { /* inet_pton.c:15:5: */
+ if __ccgo_strace {
+ trc("tls=%v af=%v s=%v a0=%v, (%v:)", tls, af, s, a0, origin(2))
+ }
bp := tls.Alloc(16)
defer tls.Free(16)
@@ -4896,6 +5040,9 @@ func Xinet_pton(tls *TLS, af int32, s uintptr, a0 uintptr) int32 { /* inet_pton.
}
func X__lookup_ipliteral(tls *TLS, buf uintptr, name uintptr, family int32) int32 { /* lookup_ipliteral.c:12:5: */
+ if __ccgo_strace {
+ trc("tls=%v buf=%v name=%v family=%v, (%v:)", tls, buf, name, family, origin(2))
+ }
bp := tls.Alloc(96)
defer tls.Free(96)
@@ -5206,6 +5353,9 @@ func addrcmp(tls *TLS, _a uintptr, _b uintptr) int32 { /* lookup_name.c:305:12:
}
func X__lookup_name(tls *TLS, buf uintptr, canon uintptr, name uintptr, family int32, flags int32) int32 { /* lookup_name.c:311:5: */
+ if __ccgo_strace {
+ trc("tls=%v buf=%v canon=%v name=%v family=%v flags=%v, (%v:)", tls, buf, canon, name, family, flags, origin(2))
+ }
bp := tls.Alloc(92)
defer tls.Free(92)
@@ -5372,6 +5522,9 @@ func X__lookup_name(tls *TLS, buf uintptr, canon uintptr, name uintptr, family i
}
func X__lookup_serv(tls *TLS, buf uintptr, name uintptr, proto int32, socktype int32, flags int32) int32 { /* lookup_serv.c:12:5: */
+ if __ccgo_strace {
+ trc("tls=%v buf=%v name=%v proto=%v socktype=%v flags=%v, (%v:)", tls, buf, name, proto, socktype, flags, origin(2))
+ }
bp := tls.Alloc(8)
defer tls.Free(8)
@@ -5505,10 +5658,16 @@ func temper(tls *TLS, x uint32) uint32 { /* rand_r.c:3:17: */
}
func Xrand_r(tls *TLS, seed uintptr) int32 { /* rand_r.c:12:5: */
+ if __ccgo_strace {
+ trc("tls=%v seed=%v, (%v:)", tls, seed, origin(2))
+ }
return int32(temper(tls, AssignPtrUint32(seed, *(*uint32)(unsafe.Pointer(seed))*uint32(1103515245)+uint32(12345))) / uint32(2))
}
func X__lockfile(tls *TLS, f uintptr) int32 { /* __lockfile.c:4:5: */
+ if __ccgo_strace {
+ trc("tls=%v f=%v, (%v:)", tls, f, origin(2))
+ }
var owner int32 = (*FILE)(unsafe.Pointer(f)).lock
var tid int32 = (*__pthread)(unsafe.Pointer(__pthread_self(tls))).tid
if owner&CplInt32(0x40000000) == tid {
@@ -5527,12 +5686,18 @@ func X__lockfile(tls *TLS, f uintptr) int32 { /* __lockfile.c:4:5: */
}
func X__unlockfile(tls *TLS, f uintptr) { /* __lockfile.c:19:6: */
+ if __ccgo_strace {
+ trc("tls=%v f=%v, (%v:)", tls, f, origin(2))
+ }
if a_swap(tls, f+140, 0)&0x40000000 != 0 {
__wake(tls, f+140, 1, 1)
}
}
func X__toread(tls *TLS, f uintptr) int32 { /* __toread.c:3:5: */
+ if __ccgo_strace {
+ trc("tls=%v f=%v, (%v:)", tls, f, origin(2))
+ }
*(*int32)(unsafe.Pointer(f + 136)) |= (*FILE)(unsafe.Pointer(f)).mode - 1
if (*FILE)(unsafe.Pointer(f)).wpos != (*FILE)(unsafe.Pointer(f)).wbase {
(*struct {
@@ -5552,6 +5717,9 @@ func X__toread(tls *TLS, f uintptr) int32 { /* __toread.c:3:5: */
}
func X__toread_needs_stdio_exit(tls *TLS) { /* __toread.c:16:13: */
+ if __ccgo_strace {
+ trc("tls=%v, (%v:)", tls, origin(2))
+ }
X__builtin_abort(tls) //TODO-
// __stdio_exit_needed();
}
@@ -5560,6 +5728,9 @@ func X__toread_needs_stdio_exit(tls *TLS) { /* __toread.c:16:13: */
// data buffered for reading.
func X__uflow(tls *TLS, f uintptr) int32 { /* __uflow.c:6:5: */
+ if __ccgo_strace {
+ trc("tls=%v f=%v, (%v:)", tls, f, origin(2))
+ }
bp := tls.Alloc(1)
defer tls.Free(1)
@@ -5574,6 +5745,9 @@ func X__uflow(tls *TLS, f uintptr) int32 { /* __uflow.c:6:5: */
}
func Xsscanf(tls *TLS, s uintptr, fmt uintptr, va uintptr) int32 { /* sscanf.c:4:5: */
+ if __ccgo_strace {
+ trc("tls=%v s=%v fmt=%v va=%v, (%v:)", tls, s, fmt, va, origin(2))
+ }
var ret int32
var ap va_list
_ = ap
@@ -5623,6 +5797,9 @@ func arg_n(tls *TLS, ap va_list, n uint32) uintptr { /* vfscanf.c:44:13: */
}
func Xvfscanf(tls *TLS, f uintptr, fmt uintptr, ap va_list) int32 { /* vfscanf.c:56:5: */
+ if __ccgo_strace {
+ trc("tls=%v f=%v fmt=%v ap=%v, (%v:)", tls, f, fmt, ap, origin(2))
+ }
bp := tls.Alloc(276)
defer tls.Free(276)
@@ -6498,6 +6675,9 @@ func string_read(tls *TLS, f uintptr, buf uintptr, len size_t) size_t { /* vssca
}
func Xvsscanf(tls *TLS, s uintptr, fmt uintptr, ap va_list) int32 { /* vsscanf.c:18:5: */
+ if __ccgo_strace {
+ trc("tls=%v s=%v fmt=%v ap=%v, (%v:)", tls, s, fmt, ap, origin(2))
+ }
bp := tls.Alloc(232)
defer tls.Free(232)
@@ -6508,6 +6688,9 @@ func Xvsscanf(tls *TLS, s uintptr, fmt uintptr, ap va_list) int32 { /* vsscanf.c
}
func Xbsearch(tls *TLS, key uintptr, base uintptr, nel size_t, width size_t, cmp uintptr) uintptr { /* bsearch.c:3:6: */
+ if __ccgo_strace {
+ trc("tls=%v key=%v base=%v nel=%v width=%v cmp=%v, (%v:)", tls, key, base, nel, width, cmp, origin(2))
+ }
var try uintptr
var sign int32
for nel > uint64(0) {
@@ -6550,14 +6733,23 @@ func strtox(tls *TLS, s uintptr, p uintptr, prec int32) float64 { /* strtod.c:6:
}
func Xstrtof(tls *TLS, s uintptr, p uintptr) float32 { /* strtod.c:17:7: */
+ if __ccgo_strace {
+ trc("tls=%v s=%v p=%v, (%v:)", tls, s, p, origin(2))
+ }
return float32(strtox(tls, s, p, 0))
}
func Xstrtod(tls *TLS, s uintptr, p uintptr) float64 { /* strtod.c:22:8: */
+ if __ccgo_strace {
+ trc("tls=%v s=%v p=%v, (%v:)", tls, s, p, origin(2))
+ }
return strtox(tls, s, p, 1)
}
func Xstrtold(tls *TLS, s uintptr, p uintptr) float64 { /* strtod.c:27:13: */
+ if __ccgo_strace {
+ trc("tls=%v s=%v p=%v, (%v:)", tls, s, p, origin(2))
+ }
return strtox(tls, s, p, 2)
}
@@ -6579,30 +6771,51 @@ func strtox1(tls *TLS, s uintptr, p uintptr, base int32, lim uint64) uint64 { /*
}
func Xstrtoull(tls *TLS, s uintptr, p uintptr, base int32) uint64 { /* strtol.c:21:20: */
+ if __ccgo_strace {
+ trc("tls=%v s=%v p=%v base=%v, (%v:)", tls, s, p, base, origin(2))
+ }
return strtox1(tls, s, p, base, 2*uint64(0x7fffffffffffffff)+uint64(1))
}
func Xstrtoll(tls *TLS, s uintptr, p uintptr, base int32) int64 { /* strtol.c:26:11: */
+ if __ccgo_strace {
+ trc("tls=%v s=%v p=%v base=%v, (%v:)", tls, s, p, base, origin(2))
+ }
return int64(strtox1(tls, s, p, base, Uint64FromInt64(-0x7fffffffffffffff-int64(1))))
}
func Xstrtoul(tls *TLS, s uintptr, p uintptr, base int32) uint64 { /* strtol.c:31:15: */
+ if __ccgo_strace {
+ trc("tls=%v s=%v p=%v base=%v, (%v:)", tls, s, p, base, origin(2))
+ }
return uint64(strtox1(tls, s, p, base, 2*uint64(0x7fffffffffffffff)+uint64(1)))
}
func Xstrtol(tls *TLS, s uintptr, p uintptr, base int32) int64 { /* strtol.c:36:6: */
+ if __ccgo_strace {
+ trc("tls=%v s=%v p=%v base=%v, (%v:)", tls, s, p, base, origin(2))
+ }
return int64(strtox1(tls, s, p, base, 0+Uint64FromInt64(Int64(-Int64(0x7fffffffffffffff))-Int64FromInt32(1))))
}
func Xstrtoimax(tls *TLS, s uintptr, p uintptr, base int32) intmax_t { /* strtol.c:41:10: */
+ if __ccgo_strace {
+ trc("tls=%v s=%v p=%v base=%v, (%v:)", tls, s, p, base, origin(2))
+ }
return intmax_t(Xstrtoll(tls, s, p, base))
}
func Xstrtoumax(tls *TLS, s uintptr, p uintptr, base int32) uintmax_t { /* strtol.c:46:11: */
+ if __ccgo_strace {
+ trc("tls=%v s=%v p=%v base=%v, (%v:)", tls, s, p, base, origin(2))
+ }
return uintmax_t(Xstrtoull(tls, s, p, base))
}
func Xstrdup(tls *TLS, s uintptr) uintptr { /* strdup.c:4:6: */
+ if __ccgo_strace {
+ trc("tls=%v s=%v, (%v:)", tls, s, origin(2))
+ }
var l size_t = Xstrlen(tls, s)
var d uintptr = Xmalloc(tls, l+uint64(1))
if !(d != 0) {
@@ -6612,6 +6825,9 @@ func Xstrdup(tls *TLS, s uintptr) uintptr { /* strdup.c:4:6: */
}
func Xstrlcat(tls *TLS, d uintptr, s uintptr, n size_t) size_t { /* strlcat.c:4:8: */
+ if __ccgo_strace {
+ trc("tls=%v d=%v s=%v n=%v, (%v:)", tls, d, s, n, origin(2))
+ }
var l size_t = Xstrnlen(tls, d, n)
if l == n {
return l + Xstrlen(tls, s)
@@ -6629,6 +6845,9 @@ func Xstrlcat(tls *TLS, d uintptr, s uintptr, n size_t) size_t { /* strlcat.c:4:
// from SUS and have nothing to do with the host system.
func Xstrlcpy(tls *TLS, d uintptr, s uintptr, n size_t) size_t { /* strlcpy.c:11:8: */
+ if __ccgo_strace {
+ trc("tls=%v d=%v s=%v n=%v, (%v:)", tls, d, s, n, origin(2))
+ }
var d0 uintptr
var wd uintptr
var ws uintptr
@@ -6700,6 +6919,9 @@ finish:
}
func Xstrncasecmp(tls *TLS, _l uintptr, _r uintptr, n size_t) int32 { /* strncasecmp.c:4:5: */
+ if __ccgo_strace {
+ trc("tls=%v _l=%v _r=%v n=%v, (%v:)", tls, _l, _r, n, origin(2))
+ }
var l uintptr = _l
var r uintptr = _r
if !(int32(PostDecUint64(&n, 1)) != 0) {
@@ -6722,10 +6944,16 @@ __3:
}
func X__strncasecmp_l(tls *TLS, l uintptr, r uintptr, n size_t, loc locale_t) int32 { /* strncasecmp.c:12:5: */
+ if __ccgo_strace {
+ trc("tls=%v l=%v r=%v n=%v loc=%v, (%v:)", tls, l, r, n, loc, origin(2))
+ }
return Xstrncasecmp(tls, l, r, n)
}
func Xstrncat(tls *TLS, d uintptr, s uintptr, n size_t) uintptr { /* strncat.c:3:6: */
+ if __ccgo_strace {
+ trc("tls=%v d=%v s=%v n=%v, (%v:)", tls, d, s, n, origin(2))
+ }
var a uintptr = d
d += uintptr(Xstrlen(tls, d))
for n != 0 && *(*int8)(unsafe.Pointer(s)) != 0 {
@@ -6737,6 +6965,9 @@ func Xstrncat(tls *TLS, d uintptr, s uintptr, n size_t) uintptr { /* strncat.c:3
}
func Xstrnlen(tls *TLS, s uintptr, n size_t) size_t { /* strnlen.c:3:8: */
+ if __ccgo_strace {
+ trc("tls=%v s=%v n=%v, (%v:)", tls, s, n, origin(2))
+ }
var p uintptr = Xmemchr(tls, s, 0, n)
if p != 0 {
return uint64((int64(p) - int64(s)) / 1)
@@ -6745,6 +6976,9 @@ func Xstrnlen(tls *TLS, s uintptr, n size_t) size_t { /* strnlen.c:3:8: */
}
func Xstrspn(tls *TLS, s uintptr, c uintptr) size_t { /* strspn.c:6:8: */
+ if __ccgo_strace {
+ trc("tls=%v s=%v c=%v, (%v:)", tls, s, c, origin(2))
+ }
bp := tls.Alloc(32)
defer tls.Free(32)
@@ -6768,6 +7002,9 @@ func Xstrspn(tls *TLS, s uintptr, c uintptr) size_t { /* strspn.c:6:8: */
}
func Xstrtok(tls *TLS, s uintptr, sep uintptr) uintptr { /* strtok.c:3:6: */
+ if __ccgo_strace {
+ trc("tls=%v s=%v sep=%v, (%v:)", tls, s, sep, origin(2))
+ }
if !(s != 0) && !(int32(AssignUintptr(&s, _sp)) != 0) {
return uintptr(0)
}
@@ -6787,10 +7024,16 @@ func Xstrtok(tls *TLS, s uintptr, sep uintptr) uintptr { /* strtok.c:3:6: */
var _sp uintptr /* strtok.c:5:14: */
func X__ccgo_pthreadAttrGetDetachState(tls *TLS, a uintptr) int32 { /* pthread_attr_get.c:3:5: */
+ if __ccgo_strace {
+ trc("tls=%v a=%v, (%v:)", tls, a, origin(2))
+ }
return *(*int32)(unsafe.Pointer(a + 6*4))
}
func Xpthread_attr_getdetachstate(tls *TLS, a uintptr, state uintptr) int32 { /* pthread_attr_get.c:7:5: */
+ if __ccgo_strace {
+ trc("tls=%v a=%v state=%v, (%v:)", tls, a, state, origin(2))
+ }
*(*int32)(unsafe.Pointer(state)) = *(*int32)(unsafe.Pointer(a + 6*4))
return 0
}
@@ -6877,6 +7120,9 @@ func Xpthread_attr_getdetachstate(tls *TLS, a uintptr, state uintptr) int32 { /*
// }
func X__ccgo_pthreadMutexattrGettype(tls *TLS, a uintptr) int32 { /* pthread_attr_get.c:93:5: */
+ if __ccgo_strace {
+ trc("tls=%v a=%v, (%v:)", tls, a, origin(2))
+ }
return int32((*pthread_mutexattr_t)(unsafe.Pointer(a)).__attr & uint32(3))
}
@@ -6893,6 +7139,9 @@ func X__ccgo_pthreadMutexattrGettype(tls *TLS, a uintptr) int32 { /* pthread_att
// }
func Xpthread_attr_setdetachstate(tls *TLS, a uintptr, state int32) int32 { /* pthread_attr_setdetachstate.c:3:5: */
+ if __ccgo_strace {
+ trc("tls=%v a=%v state=%v, (%v:)", tls, a, state, origin(2))
+ }
if uint32(state) > 1 {
return 22
}
@@ -6901,6 +7150,9 @@ func Xpthread_attr_setdetachstate(tls *TLS, a uintptr, state int32) int32 { /* p
}
func X__ccgo_getMutexType(tls *TLS, m uintptr) int32 { /* pthread_mutex_lock.c:3:5: */
+ if __ccgo_strace {
+ trc("tls=%v m=%v, (%v:)", tls, m, origin(2))
+ }
return *(*int32)(unsafe.Pointer(m)) & 15
}
@@ -6916,15 +7168,24 @@ func X__ccgo_getMutexType(tls *TLS, m uintptr) int32 { /* pthread_mutex_lock.c:3
// weak_alias(__pthread_mutex_lock, pthread_mutex_lock);
func Xpthread_mutexattr_destroy(tls *TLS, a uintptr) int32 { /* pthread_mutexattr_destroy.c:3:5: */
+ if __ccgo_strace {
+ trc("tls=%v a=%v, (%v:)", tls, a, origin(2))
+ }
return 0
}
func Xpthread_mutexattr_init(tls *TLS, a uintptr) int32 { /* pthread_mutexattr_init.c:3:5: */
+ if __ccgo_strace {
+ trc("tls=%v a=%v, (%v:)", tls, a, origin(2))
+ }
*(*pthread_mutexattr_t)(unsafe.Pointer(a)) = pthread_mutexattr_t{}
return 0
}
func Xpthread_mutexattr_settype(tls *TLS, a uintptr, type1 int32) int32 { /* pthread_mutexattr_settype.c:3:5: */
+ if __ccgo_strace {
+ trc("tls=%v a=%v type1=%v, (%v:)", tls, a, type1, origin(2))
+ }
if uint32(type1) > uint32(2) {
return 22
}
diff --git a/vendor/modernc.org/libc/musl_linux_ppc64le.go b/vendor/modernc.org/libc/musl_linux_ppc64le.go
index 03045ca5..1f5f7f14 100644
--- a/vendor/modernc.org/libc/musl_linux_ppc64le.go
+++ b/vendor/modernc.org/libc/musl_linux_ppc64le.go
@@ -403,6 +403,9 @@ var table = [384]uint16{
var ptable uintptr = 0 /* __ctype_b_loc.c:36:29 */
func X__ctype_b_loc(tls *TLS) uintptr { /* __ctype_b_loc.c:38:22: */
+ if __ccgo_strace {
+ trc("tls=%v, (%v:)", tls, origin(2))
+ }
return uintptr(unsafe.Pointer(&ptable))
}
@@ -415,6 +418,9 @@ type __locale_struct = struct{ cat [6]uintptr } /* alltypes.h:335:9 */
type locale_t = uintptr /* alltypes.h:335:32 */
func Xisalnum(tls *TLS, c int32) int32 { /* isalnum.c:3:5: */
+ if __ccgo_strace {
+ trc("tls=%v c=%v, (%v:)", tls, c, origin(2))
+ }
return Bool32(func() int32 {
if 0 != 0 {
return Xisalpha(tls, c)
@@ -429,50 +435,86 @@ func Xisalnum(tls *TLS, c int32) int32 { /* isalnum.c:3:5: */
}
func X__isalnum_l(tls *TLS, c int32, l locale_t) int32 { /* isalnum.c:8:5: */
+ if __ccgo_strace {
+ trc("tls=%v c=%v l=%v, (%v:)", tls, c, l, origin(2))
+ }
return Xisalnum(tls, c)
}
func Xisalpha(tls *TLS, c int32) int32 { /* isalpha.c:4:5: */
+ if __ccgo_strace {
+ trc("tls=%v c=%v, (%v:)", tls, c, origin(2))
+ }
return Bool32(uint32(c)|uint32(32)-uint32('a') < uint32(26))
}
func X__isalpha_l(tls *TLS, c int32, l locale_t) int32 { /* isalpha.c:9:5: */
+ if __ccgo_strace {
+ trc("tls=%v c=%v l=%v, (%v:)", tls, c, l, origin(2))
+ }
return Xisalpha(tls, c)
}
func Xisdigit(tls *TLS, c int32) int32 { /* isdigit.c:4:5: */
+ if __ccgo_strace {
+ trc("tls=%v c=%v, (%v:)", tls, c, origin(2))
+ }
return Bool32(uint32(c)-uint32('0') < uint32(10))
}
func X__isdigit_l(tls *TLS, c int32, l locale_t) int32 { /* isdigit.c:9:5: */
+ if __ccgo_strace {
+ trc("tls=%v c=%v l=%v, (%v:)", tls, c, l, origin(2))
+ }
return Xisdigit(tls, c)
}
func Xislower(tls *TLS, c int32) int32 { /* islower.c:4:5: */
+ if __ccgo_strace {
+ trc("tls=%v c=%v, (%v:)", tls, c, origin(2))
+ }
return Bool32(uint32(c)-uint32('a') < uint32(26))
}
func X__islower_l(tls *TLS, c int32, l locale_t) int32 { /* islower.c:9:5: */
+ if __ccgo_strace {
+ trc("tls=%v c=%v l=%v, (%v:)", tls, c, l, origin(2))
+ }
return Xislower(tls, c)
}
func Xisprint(tls *TLS, c int32) int32 { /* isprint.c:4:5: */
+ if __ccgo_strace {
+ trc("tls=%v c=%v, (%v:)", tls, c, origin(2))
+ }
return Bool32(uint32(c)-uint32(0x20) < uint32(0x5f))
}
func X__isprint_l(tls *TLS, c int32, l locale_t) int32 { /* isprint.c:9:5: */
+ if __ccgo_strace {
+ trc("tls=%v c=%v l=%v, (%v:)", tls, c, l, origin(2))
+ }
return Xisprint(tls, c)
}
func Xisupper(tls *TLS, c int32) int32 { /* isupper.c:4:5: */
+ if __ccgo_strace {
+ trc("tls=%v c=%v, (%v:)", tls, c, origin(2))
+ }
return Bool32(uint32(c)-uint32('A') < uint32(26))
}
func X__isupper_l(tls *TLS, c int32, l locale_t) int32 { /* isupper.c:9:5: */
+ if __ccgo_strace {
+ trc("tls=%v c=%v l=%v, (%v:)", tls, c, l, origin(2))
+ }
return Xisupper(tls, c)
}
func Xisxdigit(tls *TLS, c int32) int32 { /* isxdigit.c:3:5: */
+ if __ccgo_strace {
+ trc("tls=%v c=%v, (%v:)", tls, c, origin(2))
+ }
return Bool32(func() int32 {
if 0 != 0 {
return Xisdigit(tls, c)
@@ -482,6 +524,9 @@ func Xisxdigit(tls *TLS, c int32) int32 { /* isxdigit.c:3:5: */
}
func X__isxdigit_l(tls *TLS, c int32, l locale_t) int32 { /* isxdigit.c:8:5: */
+ if __ccgo_strace {
+ trc("tls=%v c=%v l=%v, (%v:)", tls, c, l, origin(2))
+ }
return Xisxdigit(tls, c)
}
@@ -535,6 +580,9 @@ type lldiv_t = struct {
} /* stdlib.h:64:41 */
func Xclosedir(tls *TLS, dir uintptr) int32 { /* closedir.c:6:5: */
+ if __ccgo_strace {
+ trc("tls=%v dir=%v, (%v:)", tls, dir, origin(2))
+ }
var ret int32 = Xclose(tls, (*DIR)(unsafe.Pointer(dir)).fd)
Xfree(tls, dir)
return ret
@@ -571,6 +619,9 @@ type f_owner_ex = struct {
type syscall_arg_t = int64 /* syscall.h:22:14 */
func Xopendir(tls *TLS, name uintptr) uintptr { /* opendir.c:8:5: */
+ if __ccgo_strace {
+ trc("tls=%v name=%v, (%v:)", tls, name, origin(2))
+ }
var fd int32
var dir uintptr
@@ -593,6 +644,9 @@ type max_align_t = struct {
type dirstream_buf_alignment_check = [1]uint8 /* readdir.c:7:14 */
func Xreaddir(tls *TLS, dir uintptr) uintptr { /* readdir.c:10:15: */
+ if __ccgo_strace {
+ trc("tls=%v dir=%v, (%v:)", tls, dir, origin(2))
+ }
var de uintptr
if (*DIR)(unsafe.Pointer(dir)).buf_pos >= (*DIR)(unsafe.Pointer(dir)).buf_end {
@@ -1356,6 +1410,9 @@ func hexfloat(tls *TLS, f uintptr, bits int32, emin int32, sign int32, pok int32
}
func X__floatscan(tls *TLS, f uintptr, prec int32, pok int32) float64 { /* floatscan.c:427:13: */
+ if __ccgo_strace {
+ trc("tls=%v f=%v prec=%v pok=%v, (%v:)", tls, f, prec, pok, origin(2))
+ }
var sign int32 = 1
var i size_t
var bits int32
@@ -1533,6 +1590,9 @@ var table1 = [257]uint8{Uint8FromInt32(-1),
} /* intscan.c:7:28 */
func X__intscan(tls *TLS, f uintptr, base uint32, pok int32, lim uint64) uint64 { /* intscan.c:26:20: */
+ if __ccgo_strace {
+ trc("tls=%v f=%v base=%v pok=%v lim=%v, (%v:)", tls, f, base, pok, lim, origin(2))
+ }
var val uintptr
var c int32
var neg int32
@@ -1838,6 +1898,9 @@ __43:
// the actual count.
func X__shlim(tls *TLS, f uintptr, lim off_t) { /* shgetc.c:8:6: */
+ if __ccgo_strace {
+ trc("tls=%v f=%v lim=%v, (%v:)", tls, f, lim, origin(2))
+ }
(*FILE)(unsafe.Pointer(f)).shlim = lim
(*FILE)(unsafe.Pointer(f)).shcnt = (int64((*FILE)(unsafe.Pointer(f)).buf) - int64((*FILE)(unsafe.Pointer(f)).rpos)) / 1
// If lim is nonzero, rend must be a valid pointer.
@@ -1849,6 +1912,9 @@ func X__shlim(tls *TLS, f uintptr, lim off_t) { /* shgetc.c:8:6: */
}
func X__shgetc(tls *TLS, f uintptr) int32 { /* shgetc.c:19:5: */
+ if __ccgo_strace {
+ trc("tls=%v f=%v, (%v:)", tls, f, origin(2))
+ }
var c int32
var cnt off_t = (*FILE)(unsafe.Pointer(f)).shcnt + (int64((*FILE)(unsafe.Pointer(f)).rpos)-int64((*FILE)(unsafe.Pointer(f)).buf))/1
if (*FILE)(unsafe.Pointer(f)).shlim != 0 && cnt >= (*FILE)(unsafe.Pointer(f)).shlim || AssignInt32(&c, X__uflow(tls, f)) < 0 {
@@ -1910,10 +1976,16 @@ type lconv = struct {
var posix_lconv = lconv{decimal_point: ts + 23, thousands_sep: ts + 13, grouping: ts + 13, int_curr_symbol: ts + 13, currency_symbol: ts + 13, mon_decimal_point: ts + 13, mon_thousands_sep: ts + 13, mon_grouping: ts + 13, positive_sign: ts + 13, negative_sign: ts + 13, int_frac_digits: uint8(255), frac_digits: uint8(255), p_cs_precedes: uint8(255), p_sep_by_space: uint8(255), n_cs_precedes: uint8(255), n_sep_by_space: uint8(255), p_sign_posn: uint8(255), n_sign_posn: uint8(255), int_p_cs_precedes: uint8(255), int_p_sep_by_space: uint8(255), int_n_cs_precedes: uint8(255), int_n_sep_by_space: uint8(255), int_p_sign_posn: uint8(255), int_n_sign_posn: uint8(255)} /* localeconv.c:4:27 */
func Xlocaleconv(tls *TLS) uintptr { /* localeconv.c:31:14: */
+ if __ccgo_strace {
+ trc("tls=%v, (%v:)", tls, origin(2))
+ }
return uintptr(unsafe.Pointer(&posix_lconv))
}
func X__fpclassify(tls *TLS, x float64) int32 { /* __fpclassify.c:4:5: */
+ if __ccgo_strace {
+ trc("tls=%v x=%v, (%v:)", tls, x, origin(2))
+ }
bp := tls.Alloc(8)
defer tls.Free(8)
@@ -1938,6 +2010,9 @@ func X__fpclassify(tls *TLS, x float64) int32 { /* __fpclassify.c:4:5: */
}
func X__fpclassifyf(tls *TLS, x float32) int32 { /* __fpclassifyf.c:4:5: */
+ if __ccgo_strace {
+ trc("tls=%v x=%v, (%v:)", tls, x, origin(2))
+ }
bp := tls.Alloc(4)
defer tls.Free(4)
@@ -1962,28 +2037,46 @@ func X__fpclassifyf(tls *TLS, x float32) int32 { /* __fpclassifyf.c:4:5: */
}
func X__fpclassifyl(tls *TLS, x float64) int32 { /* __fpclassifyl.c:4:5: */
+ if __ccgo_strace {
+ trc("tls=%v x=%v, (%v:)", tls, x, origin(2))
+ }
return X__fpclassify(tls, x)
}
func Xcopysignl(tls *TLS, x float64, y float64) float64 { /* copysignl.c:4:13: */
+ if __ccgo_strace {
+ trc("tls=%v x=%v y=%v, (%v:)", tls, x, y, origin(2))
+ }
return Xcopysign(tls, x, y)
}
func Xfabsl(tls *TLS, x float64) float64 { /* fabsl.c:3:13: */
+ if __ccgo_strace {
+ trc("tls=%v x=%v, (%v:)", tls, x, origin(2))
+ }
return Xfabs(tls, x)
}
func Xfmodl(tls *TLS, x float64, y float64) float64 { /* fmodl.c:4:13: */
+ if __ccgo_strace {
+ trc("tls=%v x=%v y=%v, (%v:)", tls, x, y, origin(2))
+ }
return Xfmod(tls, x, y)
}
func Xnanf(tls *TLS, s uintptr) float32 { /* nanf.c:3:7: */
+ if __ccgo_strace {
+ trc("tls=%v s=%v, (%v:)", tls, s, origin(2))
+ }
return X__builtin_nanf(tls, ts+13)
}
var toint double_t = float64(float64(1)) / 2.22044604925031308085e-16 /* rint.c:10:23 */
func Xrint(tls *TLS, x float64) float64 { /* rint.c:12:8: */
+ if __ccgo_strace {
+ trc("tls=%v x=%v, (%v:)", tls, x, origin(2))
+ }
bp := tls.Alloc(8)
defer tls.Free(8)
@@ -2013,6 +2106,9 @@ func Xrint(tls *TLS, x float64) float64 { /* rint.c:12:8: */
}
func Xscalbn(tls *TLS, x float64, n int32) float64 { /* scalbn.c:4:8: */
+ if __ccgo_strace {
+ trc("tls=%v x=%v n=%v, (%v:)", tls, x, n, origin(2))
+ }
bp := tls.Alloc(8)
defer tls.Free(8)
@@ -2049,6 +2145,9 @@ func Xscalbn(tls *TLS, x float64, n int32) float64 { /* scalbn.c:4:8: */
}
func Xscalbnl(tls *TLS, x float64, n int32) float64 { /* scalbnl.c:4:13: */
+ if __ccgo_strace {
+ trc("tls=%v x=%v n=%v, (%v:)", tls, x, n, origin(2))
+ }
return Xscalbn(tls, x, n)
}
@@ -3458,6 +3557,9 @@ type __mbstate_t = struct {
type mbstate_t = __mbstate_t /* alltypes.h:329:63 */
func Xmbrtowc(tls *TLS, wc uintptr, src uintptr, n size_t, st uintptr) size_t { /* mbrtowc.c:6:8: */
+ if __ccgo_strace {
+ trc("tls=%v wc=%v src=%v n=%v st=%v, (%v:)", tls, wc, src, n, st, origin(2))
+ }
bp := tls.Alloc(4)
defer tls.Free(4)
@@ -3581,6 +3683,9 @@ ilseq:
var _sinternal_state uint32 /* mbrtowc.c:8:18: */
func Xmbsinit(tls *TLS, st uintptr) int32 { /* mbsinit.c:3:5: */
+ if __ccgo_strace {
+ trc("tls=%v st=%v, (%v:)", tls, st, origin(2))
+ }
return Bool32(!(st != 0) || !(int32(*(*uint32)(unsafe.Pointer(st))) != 0))
}
@@ -3883,6 +3988,9 @@ type resolvconf = struct {
} /* lookup.h:34:1 */
func Xfreeaddrinfo(tls *TLS, p uintptr) { /* freeaddrinfo.c:7:6: */
+ if __ccgo_strace {
+ trc("tls=%v p=%v, (%v:)", tls, p, origin(2))
+ }
var cnt size_t
cnt = uint64(1)
__1:
@@ -3907,6 +4015,9 @@ __3:
}
func Xgetaddrinfo(tls *TLS, host uintptr, serv uintptr, hint uintptr, res uintptr) int32 { /* getaddrinfo.c:12:5: */
+ if __ccgo_strace {
+ trc("tls=%v host=%v serv=%v hint=%v res=%v, (%v:)", tls, host, serv, hint, res, origin(2))
+ }
bp := tls.Alloc(1608)
defer tls.Free(1608)
@@ -4111,6 +4222,9 @@ type mmsghdr = struct {
} /* socket.h:63:1 */
func Xgethostbyaddr(tls *TLS, a uintptr, l socklen_t, af int32) uintptr { /* gethostbyaddr.c:7:16: */
+ if __ccgo_strace {
+ trc("tls=%v a=%v l=%v af=%v, (%v:)", tls, a, l, af, origin(2))
+ }
bp := tls.Alloc(8)
defer tls.Free(8)
@@ -4137,6 +4251,9 @@ func Xgethostbyaddr(tls *TLS, a uintptr, l socklen_t, af int32) uintptr { /* get
var _sh uintptr /* gethostbyaddr.c:9:24: */
func Xgethostbyaddr_r(tls *TLS, a uintptr, l socklen_t, af int32, h uintptr, buf uintptr, buflen size_t, res uintptr, err uintptr) int32 { /* gethostbyaddr_r.c:10:5: */
+ if __ccgo_strace {
+ trc("tls=%v a=%v l=%v af=%v h=%v buf=%v buflen=%v res=%v err=%v, (%v:)", tls, a, l, af, h, buf, buflen, res, err, origin(2))
+ }
bp := tls.Alloc(28)
defer tls.Free(28)
@@ -4222,10 +4339,16 @@ func Xgethostbyaddr_r(tls *TLS, a uintptr, l socklen_t, af int32, h uintptr, buf
}
func Xgethostbyname(tls *TLS, name uintptr) uintptr { /* gethostbyname.c:8:16: */
+ if __ccgo_strace {
+ trc("tls=%v name=%v, (%v:)", tls, name, origin(2))
+ }
return Xgethostbyname2(tls, name, 2)
}
func Xgethostbyname2(tls *TLS, name uintptr, af int32) uintptr { /* gethostbyname2.c:8:16: */
+ if __ccgo_strace {
+ trc("tls=%v name=%v af=%v, (%v:)", tls, name, af, origin(2))
+ }
bp := tls.Alloc(8)
defer tls.Free(8)
@@ -4252,6 +4375,9 @@ func Xgethostbyname2(tls *TLS, name uintptr, af int32) uintptr { /* gethostbynam
var _sh1 uintptr /* gethostbyname2.c:10:24: */
func Xgethostbyname2_r(tls *TLS, name uintptr, af int32, h uintptr, buf uintptr, buflen size_t, res uintptr, err uintptr) int32 { /* gethostbyname2_r.c:11:5: */
+ if __ccgo_strace {
+ trc("tls=%v name=%v af=%v h=%v buf=%v buflen=%v res=%v err=%v, (%v:)", tls, name, af, h, buf, buflen, res, err, origin(2))
+ }
bp := tls.Alloc(1600)
defer tls.Free(1600)
@@ -4343,6 +4469,9 @@ func Xgethostbyname2_r(tls *TLS, name uintptr, af int32, h uintptr, buf uintptr,
}
func Xgethostbyname_r(tls *TLS, name uintptr, h uintptr, buf uintptr, buflen size_t, res uintptr, err uintptr) int32 { /* gethostbyname_r.c:6:5: */
+ if __ccgo_strace {
+ trc("tls=%v name=%v h=%v buf=%v buflen=%v res=%v err=%v, (%v:)", tls, name, h, buf, buflen, res, err, origin(2))
+ }
return Xgethostbyname2_r(tls, name, 2, h, buf, buflen, res, err)
}
@@ -4642,6 +4771,9 @@ func reverse_services(tls *TLS, buf uintptr, port int32, dgram int32) { /* getna
}
func Xgetnameinfo(tls *TLS, sa1 uintptr, sl socklen_t, node uintptr, nodelen socklen_t, serv uintptr, servlen socklen_t, flags int32) int32 { /* getnameinfo.c:125:5: */
+ if __ccgo_strace {
+ trc("tls=%v sa1=%v sl=%v node=%v nodelen=%v serv=%v servlen=%v flags=%v, (%v:)", tls, sa1, sl, node, nodelen, serv, servlen, flags, origin(2))
+ }
bp := tls.Alloc(347)
defer tls.Free(347)
@@ -4742,10 +4874,16 @@ func Xgetnameinfo(tls *TLS, sa1 uintptr, sl socklen_t, node uintptr, nodelen soc
var Xh_errno int32 /* h_errno.c:4:5: */
func X__h_errno_location(tls *TLS) uintptr { /* h_errno.c:6:5: */
+ if __ccgo_strace {
+ trc("tls=%v, (%v:)", tls, origin(2))
+ }
return uintptr(unsafe.Pointer(&Xh_errno))
}
func X__inet_aton(tls *TLS, s0 uintptr, dest uintptr) int32 { /* inet_aton.c:7:5: */
+ if __ccgo_strace {
+ trc("tls=%v s0=%v dest=%v, (%v:)", tls, s0, dest, origin(2))
+ }
bp := tls.Alloc(40)
defer tls.Free(40)
@@ -4797,6 +4935,9 @@ func X__inet_aton(tls *TLS, s0 uintptr, dest uintptr) int32 { /* inet_aton.c:7:5
}
func Xinet_ntop(tls *TLS, af int32, a0 uintptr, s uintptr, l socklen_t) uintptr { /* inet_ntop.c:7:12: */
+ if __ccgo_strace {
+ trc("tls=%v af=%v a0=%v s=%v l=%v, (%v:)", tls, af, a0, s, l, origin(2))
+ }
bp := tls.Alloc(276)
defer tls.Free(276)
@@ -4871,6 +5012,9 @@ func hexval(tls *TLS, c uint32) int32 { /* inet_pton.c:7:12: */
}
func Xinet_pton(tls *TLS, af int32, s uintptr, a0 uintptr) int32 { /* inet_pton.c:15:5: */
+ if __ccgo_strace {
+ trc("tls=%v af=%v s=%v a0=%v, (%v:)", tls, af, s, a0, origin(2))
+ }
bp := tls.Alloc(16)
defer tls.Free(16)
@@ -4968,6 +5112,9 @@ func Xinet_pton(tls *TLS, af int32, s uintptr, a0 uintptr) int32 { /* inet_pton.
}
func X__lookup_ipliteral(tls *TLS, buf uintptr, name uintptr, family int32) int32 { /* lookup_ipliteral.c:12:5: */
+ if __ccgo_strace {
+ trc("tls=%v buf=%v name=%v family=%v, (%v:)", tls, buf, name, family, origin(2))
+ }
bp := tls.Alloc(96)
defer tls.Free(96)
@@ -5278,6 +5425,9 @@ func addrcmp(tls *TLS, _a uintptr, _b uintptr) int32 { /* lookup_name.c:305:12:
}
func X__lookup_name(tls *TLS, buf uintptr, canon uintptr, name uintptr, family int32, flags int32) int32 { /* lookup_name.c:311:5: */
+ if __ccgo_strace {
+ trc("tls=%v buf=%v canon=%v name=%v family=%v flags=%v, (%v:)", tls, buf, canon, name, family, flags, origin(2))
+ }
bp := tls.Alloc(92)
defer tls.Free(92)
@@ -5444,6 +5594,9 @@ func X__lookup_name(tls *TLS, buf uintptr, canon uintptr, name uintptr, family i
}
func X__lookup_serv(tls *TLS, buf uintptr, name uintptr, proto int32, socktype int32, flags int32) int32 { /* lookup_serv.c:12:5: */
+ if __ccgo_strace {
+ trc("tls=%v buf=%v name=%v proto=%v socktype=%v flags=%v, (%v:)", tls, buf, name, proto, socktype, flags, origin(2))
+ }
bp := tls.Alloc(8)
defer tls.Free(8)
@@ -5577,10 +5730,16 @@ func temper(tls *TLS, x uint32) uint32 { /* rand_r.c:3:17: */
}
func Xrand_r(tls *TLS, seed uintptr) int32 { /* rand_r.c:12:5: */
+ if __ccgo_strace {
+ trc("tls=%v seed=%v, (%v:)", tls, seed, origin(2))
+ }
return int32(temper(tls, AssignPtrUint32(seed, *(*uint32)(unsafe.Pointer(seed))*uint32(1103515245)+uint32(12345))) / uint32(2))
}
func X__lockfile(tls *TLS, f uintptr) int32 { /* __lockfile.c:4:5: */
+ if __ccgo_strace {
+ trc("tls=%v f=%v, (%v:)", tls, f, origin(2))
+ }
var owner int32 = (*FILE)(unsafe.Pointer(f)).lock
var tid int32 = (*__pthread)(unsafe.Pointer(__pthread_self(tls))).tid
if owner&CplInt32(0x40000000) == tid {
@@ -5599,12 +5758,18 @@ func X__lockfile(tls *TLS, f uintptr) int32 { /* __lockfile.c:4:5: */
}
func X__unlockfile(tls *TLS, f uintptr) { /* __lockfile.c:19:6: */
+ if __ccgo_strace {
+ trc("tls=%v f=%v, (%v:)", tls, f, origin(2))
+ }
if a_swap(tls, f+140, 0)&0x40000000 != 0 {
__wake(tls, f+140, 1, 1)
}
}
func X__toread(tls *TLS, f uintptr) int32 { /* __toread.c:3:5: */
+ if __ccgo_strace {
+ trc("tls=%v f=%v, (%v:)", tls, f, origin(2))
+ }
*(*int32)(unsafe.Pointer(f + 136)) |= (*FILE)(unsafe.Pointer(f)).mode - 1
if (*FILE)(unsafe.Pointer(f)).wpos != (*FILE)(unsafe.Pointer(f)).wbase {
(*struct {
@@ -5624,6 +5789,9 @@ func X__toread(tls *TLS, f uintptr) int32 { /* __toread.c:3:5: */
}
func X__toread_needs_stdio_exit(tls *TLS) { /* __toread.c:16:13: */
+ if __ccgo_strace {
+ trc("tls=%v, (%v:)", tls, origin(2))
+ }
X__builtin_abort(tls) //TODO-
// __stdio_exit_needed();
}
@@ -5632,6 +5800,9 @@ func X__toread_needs_stdio_exit(tls *TLS) { /* __toread.c:16:13: */
// data buffered for reading.
func X__uflow(tls *TLS, f uintptr) int32 { /* __uflow.c:6:5: */
+ if __ccgo_strace {
+ trc("tls=%v f=%v, (%v:)", tls, f, origin(2))
+ }
bp := tls.Alloc(1)
defer tls.Free(1)
@@ -5646,6 +5817,9 @@ func X__uflow(tls *TLS, f uintptr) int32 { /* __uflow.c:6:5: */
}
func Xsscanf(tls *TLS, s uintptr, fmt uintptr, va uintptr) int32 { /* sscanf.c:4:5: */
+ if __ccgo_strace {
+ trc("tls=%v s=%v fmt=%v va=%v, (%v:)", tls, s, fmt, va, origin(2))
+ }
var ret int32
var ap va_list
_ = ap
@@ -5695,6 +5869,9 @@ func arg_n(tls *TLS, ap va_list, n uint32) uintptr { /* vfscanf.c:44:13: */
}
func Xvfscanf(tls *TLS, f uintptr, fmt uintptr, ap va_list) int32 { /* vfscanf.c:56:5: */
+ if __ccgo_strace {
+ trc("tls=%v f=%v fmt=%v ap=%v, (%v:)", tls, f, fmt, ap, origin(2))
+ }
bp := tls.Alloc(276)
defer tls.Free(276)
@@ -6570,6 +6747,9 @@ func string_read(tls *TLS, f uintptr, buf uintptr, len size_t) size_t { /* vssca
}
func Xvsscanf(tls *TLS, s uintptr, fmt uintptr, ap va_list) int32 { /* vsscanf.c:18:5: */
+ if __ccgo_strace {
+ trc("tls=%v s=%v fmt=%v ap=%v, (%v:)", tls, s, fmt, ap, origin(2))
+ }
bp := tls.Alloc(232)
defer tls.Free(232)
@@ -6580,6 +6760,9 @@ func Xvsscanf(tls *TLS, s uintptr, fmt uintptr, ap va_list) int32 { /* vsscanf.c
}
func Xbsearch(tls *TLS, key uintptr, base uintptr, nel size_t, width size_t, cmp uintptr) uintptr { /* bsearch.c:3:6: */
+ if __ccgo_strace {
+ trc("tls=%v key=%v base=%v nel=%v width=%v cmp=%v, (%v:)", tls, key, base, nel, width, cmp, origin(2))
+ }
var try uintptr
var sign int32
for nel > uint64(0) {
@@ -6622,14 +6805,23 @@ func strtox(tls *TLS, s uintptr, p uintptr, prec int32) float64 { /* strtod.c:6:
}
func Xstrtof(tls *TLS, s uintptr, p uintptr) float32 { /* strtod.c:17:7: */
+ if __ccgo_strace {
+ trc("tls=%v s=%v p=%v, (%v:)", tls, s, p, origin(2))
+ }
return float32(strtox(tls, s, p, 0))
}
func Xstrtod(tls *TLS, s uintptr, p uintptr) float64 { /* strtod.c:22:8: */
+ if __ccgo_strace {
+ trc("tls=%v s=%v p=%v, (%v:)", tls, s, p, origin(2))
+ }
return strtox(tls, s, p, 1)
}
func Xstrtold(tls *TLS, s uintptr, p uintptr) float64 { /* strtod.c:27:13: */
+ if __ccgo_strace {
+ trc("tls=%v s=%v p=%v, (%v:)", tls, s, p, origin(2))
+ }
return strtox(tls, s, p, 2)
}
@@ -6651,30 +6843,51 @@ func strtox1(tls *TLS, s uintptr, p uintptr, base int32, lim uint64) uint64 { /*
}
func Xstrtoull(tls *TLS, s uintptr, p uintptr, base int32) uint64 { /* strtol.c:21:20: */
+ if __ccgo_strace {
+ trc("tls=%v s=%v p=%v base=%v, (%v:)", tls, s, p, base, origin(2))
+ }
return strtox1(tls, s, p, base, 2*uint64(0x7fffffffffffffff)+uint64(1))
}
func Xstrtoll(tls *TLS, s uintptr, p uintptr, base int32) int64 { /* strtol.c:26:11: */
+ if __ccgo_strace {
+ trc("tls=%v s=%v p=%v base=%v, (%v:)", tls, s, p, base, origin(2))
+ }
return int64(strtox1(tls, s, p, base, Uint64FromInt64(-0x7fffffffffffffff-int64(1))))
}
func Xstrtoul(tls *TLS, s uintptr, p uintptr, base int32) uint64 { /* strtol.c:31:15: */
+ if __ccgo_strace {
+ trc("tls=%v s=%v p=%v base=%v, (%v:)", tls, s, p, base, origin(2))
+ }
return uint64(strtox1(tls, s, p, base, 2*uint64(0x7fffffffffffffff)+uint64(1)))
}
func Xstrtol(tls *TLS, s uintptr, p uintptr, base int32) int64 { /* strtol.c:36:6: */
+ if __ccgo_strace {
+ trc("tls=%v s=%v p=%v base=%v, (%v:)", tls, s, p, base, origin(2))
+ }
return int64(strtox1(tls, s, p, base, 0+Uint64FromInt64(Int64(-Int64(0x7fffffffffffffff))-Int64FromInt32(1))))
}
func Xstrtoimax(tls *TLS, s uintptr, p uintptr, base int32) intmax_t { /* strtol.c:41:10: */
+ if __ccgo_strace {
+ trc("tls=%v s=%v p=%v base=%v, (%v:)", tls, s, p, base, origin(2))
+ }
return intmax_t(Xstrtoll(tls, s, p, base))
}
func Xstrtoumax(tls *TLS, s uintptr, p uintptr, base int32) uintmax_t { /* strtol.c:46:11: */
+ if __ccgo_strace {
+ trc("tls=%v s=%v p=%v base=%v, (%v:)", tls, s, p, base, origin(2))
+ }
return uintmax_t(Xstrtoull(tls, s, p, base))
}
func Xstrdup(tls *TLS, s uintptr) uintptr { /* strdup.c:4:6: */
+ if __ccgo_strace {
+ trc("tls=%v s=%v, (%v:)", tls, s, origin(2))
+ }
var l size_t = Xstrlen(tls, s)
var d uintptr = Xmalloc(tls, l+uint64(1))
if !(d != 0) {
@@ -6684,6 +6897,9 @@ func Xstrdup(tls *TLS, s uintptr) uintptr { /* strdup.c:4:6: */
}
func Xstrlcat(tls *TLS, d uintptr, s uintptr, n size_t) size_t { /* strlcat.c:4:8: */
+ if __ccgo_strace {
+ trc("tls=%v d=%v s=%v n=%v, (%v:)", tls, d, s, n, origin(2))
+ }
var l size_t = Xstrnlen(tls, d, n)
if l == n {
return l + Xstrlen(tls, s)
@@ -6701,6 +6917,9 @@ func Xstrlcat(tls *TLS, d uintptr, s uintptr, n size_t) size_t { /* strlcat.c:4:
// from SUS and have nothing to do with the host system.
func Xstrlcpy(tls *TLS, d uintptr, s uintptr, n size_t) size_t { /* strlcpy.c:11:8: */
+ if __ccgo_strace {
+ trc("tls=%v d=%v s=%v n=%v, (%v:)", tls, d, s, n, origin(2))
+ }
var d0 uintptr
var wd uintptr
var ws uintptr
@@ -6772,6 +6991,9 @@ finish:
}
func Xstrncasecmp(tls *TLS, _l uintptr, _r uintptr, n size_t) int32 { /* strncasecmp.c:4:5: */
+ if __ccgo_strace {
+ trc("tls=%v _l=%v _r=%v n=%v, (%v:)", tls, _l, _r, n, origin(2))
+ }
var l uintptr = _l
var r uintptr = _r
if !(int32(PostDecUint64(&n, 1)) != 0) {
@@ -6794,10 +7016,16 @@ __3:
}
func X__strncasecmp_l(tls *TLS, l uintptr, r uintptr, n size_t, loc locale_t) int32 { /* strncasecmp.c:12:5: */
+ if __ccgo_strace {
+ trc("tls=%v l=%v r=%v n=%v loc=%v, (%v:)", tls, l, r, n, loc, origin(2))
+ }
return Xstrncasecmp(tls, l, r, n)
}
func Xstrncat(tls *TLS, d uintptr, s uintptr, n size_t) uintptr { /* strncat.c:3:6: */
+ if __ccgo_strace {
+ trc("tls=%v d=%v s=%v n=%v, (%v:)", tls, d, s, n, origin(2))
+ }
var a uintptr = d
d += uintptr(Xstrlen(tls, d))
for n != 0 && *(*uint8)(unsafe.Pointer(s)) != 0 {
@@ -6809,6 +7037,9 @@ func Xstrncat(tls *TLS, d uintptr, s uintptr, n size_t) uintptr { /* strncat.c:3
}
func Xstrnlen(tls *TLS, s uintptr, n size_t) size_t { /* strnlen.c:3:8: */
+ if __ccgo_strace {
+ trc("tls=%v s=%v n=%v, (%v:)", tls, s, n, origin(2))
+ }
var p uintptr = Xmemchr(tls, s, 0, n)
if p != 0 {
return uint64((int64(p) - int64(s)) / 1)
@@ -6817,6 +7048,9 @@ func Xstrnlen(tls *TLS, s uintptr, n size_t) size_t { /* strnlen.c:3:8: */
}
func Xstrspn(tls *TLS, s uintptr, c uintptr) size_t { /* strspn.c:6:8: */
+ if __ccgo_strace {
+ trc("tls=%v s=%v c=%v, (%v:)", tls, s, c, origin(2))
+ }
bp := tls.Alloc(32)
defer tls.Free(32)
@@ -6840,6 +7074,9 @@ func Xstrspn(tls *TLS, s uintptr, c uintptr) size_t { /* strspn.c:6:8: */
}
func Xstrtok(tls *TLS, s uintptr, sep uintptr) uintptr { /* strtok.c:3:6: */
+ if __ccgo_strace {
+ trc("tls=%v s=%v sep=%v, (%v:)", tls, s, sep, origin(2))
+ }
if !(s != 0) && !(int32(AssignUintptr(&s, _sp)) != 0) {
return uintptr(0)
}
@@ -6859,10 +7096,16 @@ func Xstrtok(tls *TLS, s uintptr, sep uintptr) uintptr { /* strtok.c:3:6: */
var _sp uintptr /* strtok.c:5:14: */
func X__ccgo_pthreadAttrGetDetachState(tls *TLS, a uintptr) int32 { /* pthread_attr_get.c:3:5: */
+ if __ccgo_strace {
+ trc("tls=%v a=%v, (%v:)", tls, a, origin(2))
+ }
return *(*int32)(unsafe.Pointer(a + 6*4))
}
func Xpthread_attr_getdetachstate(tls *TLS, a uintptr, state uintptr) int32 { /* pthread_attr_get.c:7:5: */
+ if __ccgo_strace {
+ trc("tls=%v a=%v state=%v, (%v:)", tls, a, state, origin(2))
+ }
*(*int32)(unsafe.Pointer(state)) = *(*int32)(unsafe.Pointer(a + 6*4))
return 0
}
@@ -6949,6 +7192,9 @@ func Xpthread_attr_getdetachstate(tls *TLS, a uintptr, state uintptr) int32 { /*
// }
func X__ccgo_pthreadMutexattrGettype(tls *TLS, a uintptr) int32 { /* pthread_attr_get.c:93:5: */
+ if __ccgo_strace {
+ trc("tls=%v a=%v, (%v:)", tls, a, origin(2))
+ }
return int32((*pthread_mutexattr_t)(unsafe.Pointer(a)).__attr & uint32(3))
}
@@ -6965,6 +7211,9 @@ func X__ccgo_pthreadMutexattrGettype(tls *TLS, a uintptr) int32 { /* pthread_att
// }
func Xpthread_attr_setdetachstate(tls *TLS, a uintptr, state int32) int32 { /* pthread_attr_setdetachstate.c:3:5: */
+ if __ccgo_strace {
+ trc("tls=%v a=%v state=%v, (%v:)", tls, a, state, origin(2))
+ }
if uint32(state) > 1 {
return 22
}
@@ -6973,6 +7222,9 @@ func Xpthread_attr_setdetachstate(tls *TLS, a uintptr, state int32) int32 { /* p
}
func X__ccgo_getMutexType(tls *TLS, m uintptr) int32 { /* pthread_mutex_lock.c:3:5: */
+ if __ccgo_strace {
+ trc("tls=%v m=%v, (%v:)", tls, m, origin(2))
+ }
return *(*int32)(unsafe.Pointer(m)) & 15
}
@@ -6988,15 +7240,24 @@ func X__ccgo_getMutexType(tls *TLS, m uintptr) int32 { /* pthread_mutex_lock.c:3
// weak_alias(__pthread_mutex_lock, pthread_mutex_lock);
func Xpthread_mutexattr_destroy(tls *TLS, a uintptr) int32 { /* pthread_mutexattr_destroy.c:3:5: */
+ if __ccgo_strace {
+ trc("tls=%v a=%v, (%v:)", tls, a, origin(2))
+ }
return 0
}
func Xpthread_mutexattr_init(tls *TLS, a uintptr) int32 { /* pthread_mutexattr_init.c:3:5: */
+ if __ccgo_strace {
+ trc("tls=%v a=%v, (%v:)", tls, a, origin(2))
+ }
*(*pthread_mutexattr_t)(unsafe.Pointer(a)) = pthread_mutexattr_t{}
return 0
}
func Xpthread_mutexattr_settype(tls *TLS, a uintptr, type1 int32) int32 { /* pthread_mutexattr_settype.c:3:5: */
+ if __ccgo_strace {
+ trc("tls=%v a=%v type1=%v, (%v:)", tls, a, type1, origin(2))
+ }
if uint32(type1) > uint32(2) {
return 22
}
diff --git a/vendor/modernc.org/libc/musl_linux_riscv64.go b/vendor/modernc.org/libc/musl_linux_riscv64.go
index 57470023..47141392 100644
--- a/vendor/modernc.org/libc/musl_linux_riscv64.go
+++ b/vendor/modernc.org/libc/musl_linux_riscv64.go
@@ -403,6 +403,9 @@ var table = [384]uint16{
var ptable uintptr = 0 /* __ctype_b_loc.c:36:29 */
func X__ctype_b_loc(tls *TLS) uintptr { /* __ctype_b_loc.c:38:22: */
+ if __ccgo_strace {
+ trc("tls=%v, (%v:)", tls, origin(2))
+ }
return uintptr(unsafe.Pointer(&ptable))
}
@@ -415,6 +418,9 @@ type __locale_struct = struct{ cat [6]uintptr } /* alltypes.h:341:9 */
type locale_t = uintptr /* alltypes.h:341:32 */
func Xisalnum(tls *TLS, c int32) int32 { /* isalnum.c:3:5: */
+ if __ccgo_strace {
+ trc("tls=%v c=%v, (%v:)", tls, c, origin(2))
+ }
return Bool32(func() int32 {
if 0 != 0 {
return Xisalpha(tls, c)
@@ -429,50 +435,86 @@ func Xisalnum(tls *TLS, c int32) int32 { /* isalnum.c:3:5: */
}
func X__isalnum_l(tls *TLS, c int32, l locale_t) int32 { /* isalnum.c:8:5: */
+ if __ccgo_strace {
+ trc("tls=%v c=%v l=%v, (%v:)", tls, c, l, origin(2))
+ }
return Xisalnum(tls, c)
}
func Xisalpha(tls *TLS, c int32) int32 { /* isalpha.c:4:5: */
+ if __ccgo_strace {
+ trc("tls=%v c=%v, (%v:)", tls, c, origin(2))
+ }
return Bool32(uint32(c)|uint32(32)-uint32('a') < uint32(26))
}
func X__isalpha_l(tls *TLS, c int32, l locale_t) int32 { /* isalpha.c:9:5: */
+ if __ccgo_strace {
+ trc("tls=%v c=%v l=%v, (%v:)", tls, c, l, origin(2))
+ }
return Xisalpha(tls, c)
}
func Xisdigit(tls *TLS, c int32) int32 { /* isdigit.c:4:5: */
+ if __ccgo_strace {
+ trc("tls=%v c=%v, (%v:)", tls, c, origin(2))
+ }
return Bool32(uint32(c)-uint32('0') < uint32(10))
}
func X__isdigit_l(tls *TLS, c int32, l locale_t) int32 { /* isdigit.c:9:5: */
+ if __ccgo_strace {
+ trc("tls=%v c=%v l=%v, (%v:)", tls, c, l, origin(2))
+ }
return Xisdigit(tls, c)
}
func Xislower(tls *TLS, c int32) int32 { /* islower.c:4:5: */
+ if __ccgo_strace {
+ trc("tls=%v c=%v, (%v:)", tls, c, origin(2))
+ }
return Bool32(uint32(c)-uint32('a') < uint32(26))
}
func X__islower_l(tls *TLS, c int32, l locale_t) int32 { /* islower.c:9:5: */
+ if __ccgo_strace {
+ trc("tls=%v c=%v l=%v, (%v:)", tls, c, l, origin(2))
+ }
return Xislower(tls, c)
}
func Xisprint(tls *TLS, c int32) int32 { /* isprint.c:4:5: */
+ if __ccgo_strace {
+ trc("tls=%v c=%v, (%v:)", tls, c, origin(2))
+ }
return Bool32(uint32(c)-uint32(0x20) < uint32(0x5f))
}
func X__isprint_l(tls *TLS, c int32, l locale_t) int32 { /* isprint.c:9:5: */
+ if __ccgo_strace {
+ trc("tls=%v c=%v l=%v, (%v:)", tls, c, l, origin(2))
+ }
return Xisprint(tls, c)
}
func Xisupper(tls *TLS, c int32) int32 { /* isupper.c:4:5: */
+ if __ccgo_strace {
+ trc("tls=%v c=%v, (%v:)", tls, c, origin(2))
+ }
return Bool32(uint32(c)-uint32('A') < uint32(26))
}
func X__isupper_l(tls *TLS, c int32, l locale_t) int32 { /* isupper.c:9:5: */
+ if __ccgo_strace {
+ trc("tls=%v c=%v l=%v, (%v:)", tls, c, l, origin(2))
+ }
return Xisupper(tls, c)
}
func Xisxdigit(tls *TLS, c int32) int32 { /* isxdigit.c:3:5: */
+ if __ccgo_strace {
+ trc("tls=%v c=%v, (%v:)", tls, c, origin(2))
+ }
return Bool32(func() int32 {
if 0 != 0 {
return Xisdigit(tls, c)
@@ -482,6 +524,9 @@ func Xisxdigit(tls *TLS, c int32) int32 { /* isxdigit.c:3:5: */
}
func X__isxdigit_l(tls *TLS, c int32, l locale_t) int32 { /* isxdigit.c:8:5: */
+ if __ccgo_strace {
+ trc("tls=%v c=%v l=%v, (%v:)", tls, c, l, origin(2))
+ }
return Xisxdigit(tls, c)
}
@@ -535,6 +580,9 @@ type lldiv_t = struct {
} /* stdlib.h:64:41 */
func Xclosedir(tls *TLS, dir uintptr) int32 { /* closedir.c:6:5: */
+ if __ccgo_strace {
+ trc("tls=%v dir=%v, (%v:)", tls, dir, origin(2))
+ }
var ret int32 = Xclose(tls, (*DIR)(unsafe.Pointer(dir)).fd)
Xfree(tls, dir)
return ret
@@ -575,6 +623,9 @@ type f_owner_ex = struct {
type syscall_arg_t = int64 /* syscall.h:22:14 */
func Xopendir(tls *TLS, name uintptr) uintptr { /* opendir.c:8:5: */
+ if __ccgo_strace {
+ trc("tls=%v name=%v, (%v:)", tls, name, origin(2))
+ }
var fd int32
var dir uintptr
@@ -597,6 +648,9 @@ type max_align_t = struct {
type dirstream_buf_alignment_check = [1]uint8 /* readdir.c:7:14 */
func Xreaddir(tls *TLS, dir uintptr) uintptr { /* readdir.c:10:15: */
+ if __ccgo_strace {
+ trc("tls=%v dir=%v, (%v:)", tls, dir, origin(2))
+ }
var de uintptr
if (*DIR)(unsafe.Pointer(dir)).buf_pos >= (*DIR)(unsafe.Pointer(dir)).buf_end {
@@ -1360,6 +1414,9 @@ func hexfloat(tls *TLS, f uintptr, bits int32, emin int32, sign int32, pok int32
}
func X__floatscan(tls *TLS, f uintptr, prec int32, pok int32) float64 { /* floatscan.c:427:13: */
+ if __ccgo_strace {
+ trc("tls=%v f=%v prec=%v pok=%v, (%v:)", tls, f, prec, pok, origin(2))
+ }
var sign int32 = 1
var i size_t
var bits int32
@@ -1537,6 +1594,9 @@ var table1 = [257]uint8{Uint8FromInt32(-1),
} /* intscan.c:7:28 */
func X__intscan(tls *TLS, f uintptr, base uint32, pok int32, lim uint64) uint64 { /* intscan.c:26:20: */
+ if __ccgo_strace {
+ trc("tls=%v f=%v base=%v pok=%v lim=%v, (%v:)", tls, f, base, pok, lim, origin(2))
+ }
var val uintptr
var c int32
var neg int32
@@ -1842,6 +1902,9 @@ __43:
// the actual count.
func X__shlim(tls *TLS, f uintptr, lim off_t) { /* shgetc.c:8:6: */
+ if __ccgo_strace {
+ trc("tls=%v f=%v lim=%v, (%v:)", tls, f, lim, origin(2))
+ }
(*FILE)(unsafe.Pointer(f)).shlim = lim
(*FILE)(unsafe.Pointer(f)).shcnt = (int64((*FILE)(unsafe.Pointer(f)).buf) - int64((*FILE)(unsafe.Pointer(f)).rpos)) / 1
// If lim is nonzero, rend must be a valid pointer.
@@ -1853,6 +1916,9 @@ func X__shlim(tls *TLS, f uintptr, lim off_t) { /* shgetc.c:8:6: */
}
func X__shgetc(tls *TLS, f uintptr) int32 { /* shgetc.c:19:5: */
+ if __ccgo_strace {
+ trc("tls=%v f=%v, (%v:)", tls, f, origin(2))
+ }
var c int32
var cnt off_t = (*FILE)(unsafe.Pointer(f)).shcnt + (int64((*FILE)(unsafe.Pointer(f)).rpos)-int64((*FILE)(unsafe.Pointer(f)).buf))/1
if (*FILE)(unsafe.Pointer(f)).shlim != 0 && cnt >= (*FILE)(unsafe.Pointer(f)).shlim || AssignInt32(&c, X__uflow(tls, f)) < 0 {
@@ -1914,10 +1980,16 @@ type lconv = struct {
var posix_lconv = lconv{decimal_point: ts + 23, thousands_sep: ts + 13, grouping: ts + 13, int_curr_symbol: ts + 13, currency_symbol: ts + 13, mon_decimal_point: ts + 13, mon_thousands_sep: ts + 13, mon_grouping: ts + 13, positive_sign: ts + 13, negative_sign: ts + 13, int_frac_digits: uint8(255), frac_digits: uint8(255), p_cs_precedes: uint8(255), p_sep_by_space: uint8(255), n_cs_precedes: uint8(255), n_sep_by_space: uint8(255), p_sign_posn: uint8(255), n_sign_posn: uint8(255), int_p_cs_precedes: uint8(255), int_p_sep_by_space: uint8(255), int_n_cs_precedes: uint8(255), int_n_sep_by_space: uint8(255), int_p_sign_posn: uint8(255), int_n_sign_posn: uint8(255)} /* localeconv.c:4:27 */
func Xlocaleconv(tls *TLS) uintptr { /* localeconv.c:31:14: */
+ if __ccgo_strace {
+ trc("tls=%v, (%v:)", tls, origin(2))
+ }
return uintptr(unsafe.Pointer(&posix_lconv))
}
func X__fpclassify(tls *TLS, x float64) int32 { /* __fpclassify.c:4:5: */
+ if __ccgo_strace {
+ trc("tls=%v x=%v, (%v:)", tls, x, origin(2))
+ }
bp := tls.Alloc(8)
defer tls.Free(8)
@@ -1942,6 +2014,9 @@ func X__fpclassify(tls *TLS, x float64) int32 { /* __fpclassify.c:4:5: */
}
func X__fpclassifyf(tls *TLS, x float32) int32 { /* __fpclassifyf.c:4:5: */
+ if __ccgo_strace {
+ trc("tls=%v x=%v, (%v:)", tls, x, origin(2))
+ }
bp := tls.Alloc(4)
defer tls.Free(4)
@@ -1966,28 +2041,46 @@ func X__fpclassifyf(tls *TLS, x float32) int32 { /* __fpclassifyf.c:4:5: */
}
func X__fpclassifyl(tls *TLS, x float64) int32 { /* __fpclassifyl.c:4:5: */
+ if __ccgo_strace {
+ trc("tls=%v x=%v, (%v:)", tls, x, origin(2))
+ }
return X__fpclassify(tls, x)
}
func Xcopysignl(tls *TLS, x float64, y float64) float64 { /* copysignl.c:4:13: */
+ if __ccgo_strace {
+ trc("tls=%v x=%v y=%v, (%v:)", tls, x, y, origin(2))
+ }
return Xcopysign(tls, x, y)
}
func Xfabsl(tls *TLS, x float64) float64 { /* fabsl.c:3:13: */
+ if __ccgo_strace {
+ trc("tls=%v x=%v, (%v:)", tls, x, origin(2))
+ }
return Xfabs(tls, x)
}
func Xfmodl(tls *TLS, x float64, y float64) float64 { /* fmodl.c:4:13: */
+ if __ccgo_strace {
+ trc("tls=%v x=%v y=%v, (%v:)", tls, x, y, origin(2))
+ }
return Xfmod(tls, x, y)
}
func Xnanf(tls *TLS, s uintptr) float32 { /* nanf.c:3:7: */
+ if __ccgo_strace {
+ trc("tls=%v s=%v, (%v:)", tls, s, origin(2))
+ }
return X__builtin_nanf(tls, ts+13)
}
var toint double_t = float64(float64(1)) / 2.22044604925031308085e-16 /* rint.c:10:23 */
func Xrint(tls *TLS, x float64) float64 { /* rint.c:12:8: */
+ if __ccgo_strace {
+ trc("tls=%v x=%v, (%v:)", tls, x, origin(2))
+ }
bp := tls.Alloc(8)
defer tls.Free(8)
@@ -2017,6 +2110,9 @@ func Xrint(tls *TLS, x float64) float64 { /* rint.c:12:8: */
}
func Xscalbn(tls *TLS, x float64, n int32) float64 { /* scalbn.c:4:8: */
+ if __ccgo_strace {
+ trc("tls=%v x=%v n=%v, (%v:)", tls, x, n, origin(2))
+ }
bp := tls.Alloc(8)
defer tls.Free(8)
@@ -2053,6 +2149,9 @@ func Xscalbn(tls *TLS, x float64, n int32) float64 { /* scalbn.c:4:8: */
}
func Xscalbnl(tls *TLS, x float64, n int32) float64 { /* scalbnl.c:4:13: */
+ if __ccgo_strace {
+ trc("tls=%v x=%v n=%v, (%v:)", tls, x, n, origin(2))
+ }
return Xscalbn(tls, x, n)
}
@@ -3443,6 +3542,9 @@ type __mbstate_t = struct {
type mbstate_t = __mbstate_t /* alltypes.h:335:63 */
func Xmbrtowc(tls *TLS, wc uintptr, src uintptr, n size_t, st uintptr) size_t { /* mbrtowc.c:6:8: */
+ if __ccgo_strace {
+ trc("tls=%v wc=%v src=%v n=%v st=%v, (%v:)", tls, wc, src, n, st, origin(2))
+ }
bp := tls.Alloc(4)
defer tls.Free(4)
@@ -3566,6 +3668,9 @@ ilseq:
var _sinternal_state uint32 /* mbrtowc.c:8:18: */
func Xmbsinit(tls *TLS, st uintptr) int32 { /* mbsinit.c:3:5: */
+ if __ccgo_strace {
+ trc("tls=%v st=%v, (%v:)", tls, st, origin(2))
+ }
return Bool32(!(st != 0) || !(int32(*(*uint32)(unsafe.Pointer(st))) != 0))
}
@@ -3868,6 +3973,9 @@ type resolvconf = struct {
} /* lookup.h:34:1 */
func Xfreeaddrinfo(tls *TLS, p uintptr) { /* freeaddrinfo.c:7:6: */
+ if __ccgo_strace {
+ trc("tls=%v p=%v, (%v:)", tls, p, origin(2))
+ }
var cnt size_t
cnt = uint64(1)
__1:
@@ -3892,6 +4000,9 @@ __3:
}
func Xgetaddrinfo(tls *TLS, host uintptr, serv uintptr, hint uintptr, res uintptr) int32 { /* getaddrinfo.c:12:5: */
+ if __ccgo_strace {
+ trc("tls=%v host=%v serv=%v hint=%v res=%v, (%v:)", tls, host, serv, hint, res, origin(2))
+ }
bp := tls.Alloc(1608)
defer tls.Free(1608)
@@ -4096,6 +4207,9 @@ type mmsghdr = struct {
} /* socket.h:63:1 */
func Xgethostbyaddr(tls *TLS, a uintptr, l socklen_t, af int32) uintptr { /* gethostbyaddr.c:7:16: */
+ if __ccgo_strace {
+ trc("tls=%v a=%v l=%v af=%v, (%v:)", tls, a, l, af, origin(2))
+ }
bp := tls.Alloc(8)
defer tls.Free(8)
@@ -4122,6 +4236,9 @@ func Xgethostbyaddr(tls *TLS, a uintptr, l socklen_t, af int32) uintptr { /* get
var _sh uintptr /* gethostbyaddr.c:9:24: */
func Xgethostbyaddr_r(tls *TLS, a uintptr, l socklen_t, af int32, h uintptr, buf uintptr, buflen size_t, res uintptr, err uintptr) int32 { /* gethostbyaddr_r.c:10:5: */
+ if __ccgo_strace {
+ trc("tls=%v a=%v l=%v af=%v h=%v buf=%v buflen=%v res=%v err=%v, (%v:)", tls, a, l, af, h, buf, buflen, res, err, origin(2))
+ }
bp := tls.Alloc(28)
defer tls.Free(28)
@@ -4207,10 +4324,16 @@ func Xgethostbyaddr_r(tls *TLS, a uintptr, l socklen_t, af int32, h uintptr, buf
}
func Xgethostbyname(tls *TLS, name uintptr) uintptr { /* gethostbyname.c:8:16: */
+ if __ccgo_strace {
+ trc("tls=%v name=%v, (%v:)", tls, name, origin(2))
+ }
return Xgethostbyname2(tls, name, 2)
}
func Xgethostbyname2(tls *TLS, name uintptr, af int32) uintptr { /* gethostbyname2.c:8:16: */
+ if __ccgo_strace {
+ trc("tls=%v name=%v af=%v, (%v:)", tls, name, af, origin(2))
+ }
bp := tls.Alloc(8)
defer tls.Free(8)
@@ -4237,6 +4360,9 @@ func Xgethostbyname2(tls *TLS, name uintptr, af int32) uintptr { /* gethostbynam
var _sh1 uintptr /* gethostbyname2.c:10:24: */
func Xgethostbyname2_r(tls *TLS, name uintptr, af int32, h uintptr, buf uintptr, buflen size_t, res uintptr, err uintptr) int32 { /* gethostbyname2_r.c:11:5: */
+ if __ccgo_strace {
+ trc("tls=%v name=%v af=%v h=%v buf=%v buflen=%v res=%v err=%v, (%v:)", tls, name, af, h, buf, buflen, res, err, origin(2))
+ }
bp := tls.Alloc(1600)
defer tls.Free(1600)
@@ -4328,6 +4454,9 @@ func Xgethostbyname2_r(tls *TLS, name uintptr, af int32, h uintptr, buf uintptr,
}
func Xgethostbyname_r(tls *TLS, name uintptr, h uintptr, buf uintptr, buflen size_t, res uintptr, err uintptr) int32 { /* gethostbyname_r.c:6:5: */
+ if __ccgo_strace {
+ trc("tls=%v name=%v h=%v buf=%v buflen=%v res=%v err=%v, (%v:)", tls, name, h, buf, buflen, res, err, origin(2))
+ }
return Xgethostbyname2_r(tls, name, 2, h, buf, buflen, res, err)
}
@@ -4627,6 +4756,9 @@ func reverse_services(tls *TLS, buf uintptr, port int32, dgram int32) { /* getna
}
func Xgetnameinfo(tls *TLS, sa1 uintptr, sl socklen_t, node uintptr, nodelen socklen_t, serv uintptr, servlen socklen_t, flags int32) int32 { /* getnameinfo.c:125:5: */
+ if __ccgo_strace {
+ trc("tls=%v sa1=%v sl=%v node=%v nodelen=%v serv=%v servlen=%v flags=%v, (%v:)", tls, sa1, sl, node, nodelen, serv, servlen, flags, origin(2))
+ }
bp := tls.Alloc(347)
defer tls.Free(347)
@@ -4727,10 +4859,16 @@ func Xgetnameinfo(tls *TLS, sa1 uintptr, sl socklen_t, node uintptr, nodelen soc
var Xh_errno int32 /* h_errno.c:4:5: */
func X__h_errno_location(tls *TLS) uintptr { /* h_errno.c:6:5: */
+ if __ccgo_strace {
+ trc("tls=%v, (%v:)", tls, origin(2))
+ }
return uintptr(unsafe.Pointer(&Xh_errno))
}
func X__inet_aton(tls *TLS, s0 uintptr, dest uintptr) int32 { /* inet_aton.c:7:5: */
+ if __ccgo_strace {
+ trc("tls=%v s0=%v dest=%v, (%v:)", tls, s0, dest, origin(2))
+ }
bp := tls.Alloc(40)
defer tls.Free(40)
@@ -4782,6 +4920,9 @@ func X__inet_aton(tls *TLS, s0 uintptr, dest uintptr) int32 { /* inet_aton.c:7:5
}
func Xinet_ntop(tls *TLS, af int32, a0 uintptr, s uintptr, l socklen_t) uintptr { /* inet_ntop.c:7:12: */
+ if __ccgo_strace {
+ trc("tls=%v af=%v a0=%v s=%v l=%v, (%v:)", tls, af, a0, s, l, origin(2))
+ }
bp := tls.Alloc(276)
defer tls.Free(276)
@@ -4856,6 +4997,9 @@ func hexval(tls *TLS, c uint32) int32 { /* inet_pton.c:7:12: */
}
func Xinet_pton(tls *TLS, af int32, s uintptr, a0 uintptr) int32 { /* inet_pton.c:15:5: */
+ if __ccgo_strace {
+ trc("tls=%v af=%v s=%v a0=%v, (%v:)", tls, af, s, a0, origin(2))
+ }
bp := tls.Alloc(16)
defer tls.Free(16)
@@ -4953,6 +5097,9 @@ func Xinet_pton(tls *TLS, af int32, s uintptr, a0 uintptr) int32 { /* inet_pton.
}
func X__lookup_ipliteral(tls *TLS, buf uintptr, name uintptr, family int32) int32 { /* lookup_ipliteral.c:12:5: */
+ if __ccgo_strace {
+ trc("tls=%v buf=%v name=%v family=%v, (%v:)", tls, buf, name, family, origin(2))
+ }
bp := tls.Alloc(96)
defer tls.Free(96)
@@ -5263,6 +5410,9 @@ func addrcmp(tls *TLS, _a uintptr, _b uintptr) int32 { /* lookup_name.c:305:12:
}
func X__lookup_name(tls *TLS, buf uintptr, canon uintptr, name uintptr, family int32, flags int32) int32 { /* lookup_name.c:311:5: */
+ if __ccgo_strace {
+ trc("tls=%v buf=%v canon=%v name=%v family=%v flags=%v, (%v:)", tls, buf, canon, name, family, flags, origin(2))
+ }
bp := tls.Alloc(92)
defer tls.Free(92)
@@ -5429,6 +5579,9 @@ func X__lookup_name(tls *TLS, buf uintptr, canon uintptr, name uintptr, family i
}
func X__lookup_serv(tls *TLS, buf uintptr, name uintptr, proto int32, socktype int32, flags int32) int32 { /* lookup_serv.c:12:5: */
+ if __ccgo_strace {
+ trc("tls=%v buf=%v name=%v proto=%v socktype=%v flags=%v, (%v:)", tls, buf, name, proto, socktype, flags, origin(2))
+ }
bp := tls.Alloc(8)
defer tls.Free(8)
@@ -5562,10 +5715,16 @@ func temper(tls *TLS, x uint32) uint32 { /* rand_r.c:3:17: */
}
func Xrand_r(tls *TLS, seed uintptr) int32 { /* rand_r.c:12:5: */
+ if __ccgo_strace {
+ trc("tls=%v seed=%v, (%v:)", tls, seed, origin(2))
+ }
return int32(temper(tls, AssignPtrUint32(seed, *(*uint32)(unsafe.Pointer(seed))*uint32(1103515245)+uint32(12345))) / uint32(2))
}
func X__lockfile(tls *TLS, f uintptr) int32 { /* __lockfile.c:4:5: */
+ if __ccgo_strace {
+ trc("tls=%v f=%v, (%v:)", tls, f, origin(2))
+ }
var owner int32 = (*FILE)(unsafe.Pointer(f)).lock
var tid int32 = (*__pthread)(unsafe.Pointer(__pthread_self(tls))).tid
if owner&CplInt32(0x40000000) == tid {
@@ -5584,12 +5743,18 @@ func X__lockfile(tls *TLS, f uintptr) int32 { /* __lockfile.c:4:5: */
}
func X__unlockfile(tls *TLS, f uintptr) { /* __lockfile.c:19:6: */
+ if __ccgo_strace {
+ trc("tls=%v f=%v, (%v:)", tls, f, origin(2))
+ }
if a_swap(tls, f+140, 0)&0x40000000 != 0 {
__wake(tls, f+140, 1, 1)
}
}
func X__toread(tls *TLS, f uintptr) int32 { /* __toread.c:3:5: */
+ if __ccgo_strace {
+ trc("tls=%v f=%v, (%v:)", tls, f, origin(2))
+ }
*(*int32)(unsafe.Pointer(f + 136)) |= (*FILE)(unsafe.Pointer(f)).mode - 1
if (*FILE)(unsafe.Pointer(f)).wpos != (*FILE)(unsafe.Pointer(f)).wbase {
(*struct {
@@ -5609,6 +5774,9 @@ func X__toread(tls *TLS, f uintptr) int32 { /* __toread.c:3:5: */
}
func X__toread_needs_stdio_exit(tls *TLS) { /* __toread.c:16:13: */
+ if __ccgo_strace {
+ trc("tls=%v, (%v:)", tls, origin(2))
+ }
X__builtin_abort(tls) //TODO-
// __stdio_exit_needed();
}
@@ -5617,6 +5785,9 @@ func X__toread_needs_stdio_exit(tls *TLS) { /* __toread.c:16:13: */
// data buffered for reading.
func X__uflow(tls *TLS, f uintptr) int32 { /* __uflow.c:6:5: */
+ if __ccgo_strace {
+ trc("tls=%v f=%v, (%v:)", tls, f, origin(2))
+ }
bp := tls.Alloc(1)
defer tls.Free(1)
@@ -5631,6 +5802,9 @@ func X__uflow(tls *TLS, f uintptr) int32 { /* __uflow.c:6:5: */
}
func Xsscanf(tls *TLS, s uintptr, fmt uintptr, va uintptr) int32 { /* sscanf.c:4:5: */
+ if __ccgo_strace {
+ trc("tls=%v s=%v fmt=%v va=%v, (%v:)", tls, s, fmt, va, origin(2))
+ }
var ret int32
var ap va_list
_ = ap
@@ -5680,6 +5854,9 @@ func arg_n(tls *TLS, ap va_list, n uint32) uintptr { /* vfscanf.c:44:13: */
}
func Xvfscanf(tls *TLS, f uintptr, fmt uintptr, ap va_list) int32 { /* vfscanf.c:56:5: */
+ if __ccgo_strace {
+ trc("tls=%v f=%v fmt=%v ap=%v, (%v:)", tls, f, fmt, ap, origin(2))
+ }
bp := tls.Alloc(276)
defer tls.Free(276)
@@ -6555,6 +6732,9 @@ func string_read(tls *TLS, f uintptr, buf uintptr, len size_t) size_t { /* vssca
}
func Xvsscanf(tls *TLS, s uintptr, fmt uintptr, ap va_list) int32 { /* vsscanf.c:18:5: */
+ if __ccgo_strace {
+ trc("tls=%v s=%v fmt=%v ap=%v, (%v:)", tls, s, fmt, ap, origin(2))
+ }
bp := tls.Alloc(232)
defer tls.Free(232)
@@ -6565,6 +6745,9 @@ func Xvsscanf(tls *TLS, s uintptr, fmt uintptr, ap va_list) int32 { /* vsscanf.c
}
func Xbsearch(tls *TLS, key uintptr, base uintptr, nel size_t, width size_t, cmp uintptr) uintptr { /* bsearch.c:3:6: */
+ if __ccgo_strace {
+ trc("tls=%v key=%v base=%v nel=%v width=%v cmp=%v, (%v:)", tls, key, base, nel, width, cmp, origin(2))
+ }
var try uintptr
var sign int32
for nel > uint64(0) {
@@ -6607,14 +6790,23 @@ func strtox(tls *TLS, s uintptr, p uintptr, prec int32) float64 { /* strtod.c:6:
}
func Xstrtof(tls *TLS, s uintptr, p uintptr) float32 { /* strtod.c:17:7: */
+ if __ccgo_strace {
+ trc("tls=%v s=%v p=%v, (%v:)", tls, s, p, origin(2))
+ }
return float32(strtox(tls, s, p, 0))
}
func Xstrtod(tls *TLS, s uintptr, p uintptr) float64 { /* strtod.c:22:8: */
+ if __ccgo_strace {
+ trc("tls=%v s=%v p=%v, (%v:)", tls, s, p, origin(2))
+ }
return strtox(tls, s, p, 1)
}
func Xstrtold(tls *TLS, s uintptr, p uintptr) float64 { /* strtod.c:27:13: */
+ if __ccgo_strace {
+ trc("tls=%v s=%v p=%v, (%v:)", tls, s, p, origin(2))
+ }
return strtox(tls, s, p, 2)
}
@@ -6636,30 +6828,51 @@ func strtox1(tls *TLS, s uintptr, p uintptr, base int32, lim uint64) uint64 { /*
}
func Xstrtoull(tls *TLS, s uintptr, p uintptr, base int32) uint64 { /* strtol.c:21:20: */
+ if __ccgo_strace {
+ trc("tls=%v s=%v p=%v base=%v, (%v:)", tls, s, p, base, origin(2))
+ }
return strtox1(tls, s, p, base, 2*uint64(0x7fffffffffffffff)+uint64(1))
}
func Xstrtoll(tls *TLS, s uintptr, p uintptr, base int32) int64 { /* strtol.c:26:11: */
+ if __ccgo_strace {
+ trc("tls=%v s=%v p=%v base=%v, (%v:)", tls, s, p, base, origin(2))
+ }
return int64(strtox1(tls, s, p, base, Uint64FromInt64(-0x7fffffffffffffff-int64(1))))
}
func Xstrtoul(tls *TLS, s uintptr, p uintptr, base int32) uint64 { /* strtol.c:31:15: */
+ if __ccgo_strace {
+ trc("tls=%v s=%v p=%v base=%v, (%v:)", tls, s, p, base, origin(2))
+ }
return uint64(strtox1(tls, s, p, base, 2*uint64(0x7fffffffffffffff)+uint64(1)))
}
func Xstrtol(tls *TLS, s uintptr, p uintptr, base int32) int64 { /* strtol.c:36:6: */
+ if __ccgo_strace {
+ trc("tls=%v s=%v p=%v base=%v, (%v:)", tls, s, p, base, origin(2))
+ }
return int64(strtox1(tls, s, p, base, 0+Uint64FromInt64(Int64(-Int64(0x7fffffffffffffff))-Int64FromInt32(1))))
}
func Xstrtoimax(tls *TLS, s uintptr, p uintptr, base int32) intmax_t { /* strtol.c:41:10: */
+ if __ccgo_strace {
+ trc("tls=%v s=%v p=%v base=%v, (%v:)", tls, s, p, base, origin(2))
+ }
return intmax_t(Xstrtoll(tls, s, p, base))
}
func Xstrtoumax(tls *TLS, s uintptr, p uintptr, base int32) uintmax_t { /* strtol.c:46:11: */
+ if __ccgo_strace {
+ trc("tls=%v s=%v p=%v base=%v, (%v:)", tls, s, p, base, origin(2))
+ }
return uintmax_t(Xstrtoull(tls, s, p, base))
}
func Xstrdup(tls *TLS, s uintptr) uintptr { /* strdup.c:4:6: */
+ if __ccgo_strace {
+ trc("tls=%v s=%v, (%v:)", tls, s, origin(2))
+ }
var l size_t = Xstrlen(tls, s)
var d uintptr = Xmalloc(tls, l+uint64(1))
if !(d != 0) {
@@ -6669,6 +6882,9 @@ func Xstrdup(tls *TLS, s uintptr) uintptr { /* strdup.c:4:6: */
}
func Xstrlcat(tls *TLS, d uintptr, s uintptr, n size_t) size_t { /* strlcat.c:4:8: */
+ if __ccgo_strace {
+ trc("tls=%v d=%v s=%v n=%v, (%v:)", tls, d, s, n, origin(2))
+ }
var l size_t = Xstrnlen(tls, d, n)
if l == n {
return l + Xstrlen(tls, s)
@@ -6686,6 +6902,9 @@ func Xstrlcat(tls *TLS, d uintptr, s uintptr, n size_t) size_t { /* strlcat.c:4:
// from SUS and have nothing to do with the host system.
func Xstrlcpy(tls *TLS, d uintptr, s uintptr, n size_t) size_t { /* strlcpy.c:11:8: */
+ if __ccgo_strace {
+ trc("tls=%v d=%v s=%v n=%v, (%v:)", tls, d, s, n, origin(2))
+ }
var d0 uintptr
var wd uintptr
var ws uintptr
@@ -6757,6 +6976,9 @@ finish:
}
func Xstrncasecmp(tls *TLS, _l uintptr, _r uintptr, n size_t) int32 { /* strncasecmp.c:4:5: */
+ if __ccgo_strace {
+ trc("tls=%v _l=%v _r=%v n=%v, (%v:)", tls, _l, _r, n, origin(2))
+ }
var l uintptr = _l
var r uintptr = _r
if !(int32(PostDecUint64(&n, 1)) != 0) {
@@ -6779,10 +7001,16 @@ __3:
}
func X__strncasecmp_l(tls *TLS, l uintptr, r uintptr, n size_t, loc locale_t) int32 { /* strncasecmp.c:12:5: */
+ if __ccgo_strace {
+ trc("tls=%v l=%v r=%v n=%v loc=%v, (%v:)", tls, l, r, n, loc, origin(2))
+ }
return Xstrncasecmp(tls, l, r, n)
}
func Xstrncat(tls *TLS, d uintptr, s uintptr, n size_t) uintptr { /* strncat.c:3:6: */
+ if __ccgo_strace {
+ trc("tls=%v d=%v s=%v n=%v, (%v:)", tls, d, s, n, origin(2))
+ }
var a uintptr = d
d += uintptr(Xstrlen(tls, d))
for n != 0 && *(*uint8)(unsafe.Pointer(s)) != 0 {
@@ -6794,6 +7022,9 @@ func Xstrncat(tls *TLS, d uintptr, s uintptr, n size_t) uintptr { /* strncat.c:3
}
func Xstrnlen(tls *TLS, s uintptr, n size_t) size_t { /* strnlen.c:3:8: */
+ if __ccgo_strace {
+ trc("tls=%v s=%v n=%v, (%v:)", tls, s, n, origin(2))
+ }
var p uintptr = Xmemchr(tls, s, 0, n)
if p != 0 {
return uint64((int64(p) - int64(s)) / 1)
@@ -6802,6 +7033,9 @@ func Xstrnlen(tls *TLS, s uintptr, n size_t) size_t { /* strnlen.c:3:8: */
}
func Xstrspn(tls *TLS, s uintptr, c uintptr) size_t { /* strspn.c:6:8: */
+ if __ccgo_strace {
+ trc("tls=%v s=%v c=%v, (%v:)", tls, s, c, origin(2))
+ }
bp := tls.Alloc(32)
defer tls.Free(32)
@@ -6825,6 +7059,9 @@ func Xstrspn(tls *TLS, s uintptr, c uintptr) size_t { /* strspn.c:6:8: */
}
func Xstrtok(tls *TLS, s uintptr, sep uintptr) uintptr { /* strtok.c:3:6: */
+ if __ccgo_strace {
+ trc("tls=%v s=%v sep=%v, (%v:)", tls, s, sep, origin(2))
+ }
if !(s != 0) && !(int32(AssignUintptr(&s, _sp)) != 0) {
return uintptr(0)
}
@@ -6844,10 +7081,16 @@ func Xstrtok(tls *TLS, s uintptr, sep uintptr) uintptr { /* strtok.c:3:6: */
var _sp uintptr /* strtok.c:5:14: */
func X__ccgo_pthreadAttrGetDetachState(tls *TLS, a uintptr) int32 { /* pthread_attr_get.c:3:5: */
+ if __ccgo_strace {
+ trc("tls=%v a=%v, (%v:)", tls, a, origin(2))
+ }
return *(*int32)(unsafe.Pointer(a + 6*4))
}
func Xpthread_attr_getdetachstate(tls *TLS, a uintptr, state uintptr) int32 { /* pthread_attr_get.c:7:5: */
+ if __ccgo_strace {
+ trc("tls=%v a=%v state=%v, (%v:)", tls, a, state, origin(2))
+ }
*(*int32)(unsafe.Pointer(state)) = *(*int32)(unsafe.Pointer(a + 6*4))
return 0
}
@@ -6934,6 +7177,9 @@ func Xpthread_attr_getdetachstate(tls *TLS, a uintptr, state uintptr) int32 { /*
// }
func X__ccgo_pthreadMutexattrGettype(tls *TLS, a uintptr) int32 { /* pthread_attr_get.c:93:5: */
+ if __ccgo_strace {
+ trc("tls=%v a=%v, (%v:)", tls, a, origin(2))
+ }
return int32((*pthread_mutexattr_t)(unsafe.Pointer(a)).__attr & uint32(3))
}
@@ -6950,6 +7196,9 @@ func X__ccgo_pthreadMutexattrGettype(tls *TLS, a uintptr) int32 { /* pthread_att
// }
func Xpthread_attr_setdetachstate(tls *TLS, a uintptr, state int32) int32 { /* pthread_attr_setdetachstate.c:3:5: */
+ if __ccgo_strace {
+ trc("tls=%v a=%v state=%v, (%v:)", tls, a, state, origin(2))
+ }
if uint32(state) > 1 {
return 22
}
@@ -6958,6 +7207,9 @@ func Xpthread_attr_setdetachstate(tls *TLS, a uintptr, state int32) int32 { /* p
}
func X__ccgo_getMutexType(tls *TLS, m uintptr) int32 { /* pthread_mutex_lock.c:3:5: */
+ if __ccgo_strace {
+ trc("tls=%v m=%v, (%v:)", tls, m, origin(2))
+ }
return *(*int32)(unsafe.Pointer(m)) & 15
}
@@ -6973,15 +7225,24 @@ func X__ccgo_getMutexType(tls *TLS, m uintptr) int32 { /* pthread_mutex_lock.c:3
// weak_alias(__pthread_mutex_lock, pthread_mutex_lock);
func Xpthread_mutexattr_destroy(tls *TLS, a uintptr) int32 { /* pthread_mutexattr_destroy.c:3:5: */
+ if __ccgo_strace {
+ trc("tls=%v a=%v, (%v:)", tls, a, origin(2))
+ }
return 0
}
func Xpthread_mutexattr_init(tls *TLS, a uintptr) int32 { /* pthread_mutexattr_init.c:3:5: */
+ if __ccgo_strace {
+ trc("tls=%v a=%v, (%v:)", tls, a, origin(2))
+ }
*(*pthread_mutexattr_t)(unsafe.Pointer(a)) = pthread_mutexattr_t{}
return 0
}
func Xpthread_mutexattr_settype(tls *TLS, a uintptr, type1 int32) int32 { /* pthread_mutexattr_settype.c:3:5: */
+ if __ccgo_strace {
+ trc("tls=%v a=%v type1=%v, (%v:)", tls, a, type1, origin(2))
+ }
if uint32(type1) > uint32(2) {
return 22
}
diff --git a/vendor/modernc.org/libc/musl_linux_s390x.go b/vendor/modernc.org/libc/musl_linux_s390x.go
index fd790654..25de30f0 100644
--- a/vendor/modernc.org/libc/musl_linux_s390x.go
+++ b/vendor/modernc.org/libc/musl_linux_s390x.go
@@ -403,6 +403,9 @@ var table = [384]uint16{
var ptable uintptr = 0 /* __ctype_b_loc.c:36:29 */
func X__ctype_b_loc(tls *TLS) uintptr { /* __ctype_b_loc.c:38:22: */
+ if __ccgo_strace {
+ trc("tls=%v, (%v:)", tls, origin(2))
+ }
return uintptr(unsafe.Pointer(&ptable))
}
@@ -415,6 +418,9 @@ type __locale_struct = struct{ cat [6]uintptr } /* alltypes.h:330:9 */
type locale_t = uintptr /* alltypes.h:330:32 */
func Xisalnum(tls *TLS, c int32) int32 { /* isalnum.c:3:5: */
+ if __ccgo_strace {
+ trc("tls=%v c=%v, (%v:)", tls, c, origin(2))
+ }
return Bool32(func() int32 {
if 0 != 0 {
return Xisalpha(tls, c)
@@ -429,50 +435,86 @@ func Xisalnum(tls *TLS, c int32) int32 { /* isalnum.c:3:5: */
}
func X__isalnum_l(tls *TLS, c int32, l locale_t) int32 { /* isalnum.c:8:5: */
+ if __ccgo_strace {
+ trc("tls=%v c=%v l=%v, (%v:)", tls, c, l, origin(2))
+ }
return Xisalnum(tls, c)
}
func Xisalpha(tls *TLS, c int32) int32 { /* isalpha.c:4:5: */
+ if __ccgo_strace {
+ trc("tls=%v c=%v, (%v:)", tls, c, origin(2))
+ }
return Bool32(uint32(c)|uint32(32)-uint32('a') < uint32(26))
}
func X__isalpha_l(tls *TLS, c int32, l locale_t) int32 { /* isalpha.c:9:5: */
+ if __ccgo_strace {
+ trc("tls=%v c=%v l=%v, (%v:)", tls, c, l, origin(2))
+ }
return Xisalpha(tls, c)
}
func Xisdigit(tls *TLS, c int32) int32 { /* isdigit.c:4:5: */
+ if __ccgo_strace {
+ trc("tls=%v c=%v, (%v:)", tls, c, origin(2))
+ }
return Bool32(uint32(c)-uint32('0') < uint32(10))
}
func X__isdigit_l(tls *TLS, c int32, l locale_t) int32 { /* isdigit.c:9:5: */
+ if __ccgo_strace {
+ trc("tls=%v c=%v l=%v, (%v:)", tls, c, l, origin(2))
+ }
return Xisdigit(tls, c)
}
func Xislower(tls *TLS, c int32) int32 { /* islower.c:4:5: */
+ if __ccgo_strace {
+ trc("tls=%v c=%v, (%v:)", tls, c, origin(2))
+ }
return Bool32(uint32(c)-uint32('a') < uint32(26))
}
func X__islower_l(tls *TLS, c int32, l locale_t) int32 { /* islower.c:9:5: */
+ if __ccgo_strace {
+ trc("tls=%v c=%v l=%v, (%v:)", tls, c, l, origin(2))
+ }
return Xislower(tls, c)
}
func Xisprint(tls *TLS, c int32) int32 { /* isprint.c:4:5: */
+ if __ccgo_strace {
+ trc("tls=%v c=%v, (%v:)", tls, c, origin(2))
+ }
return Bool32(uint32(c)-uint32(0x20) < uint32(0x5f))
}
func X__isprint_l(tls *TLS, c int32, l locale_t) int32 { /* isprint.c:9:5: */
+ if __ccgo_strace {
+ trc("tls=%v c=%v l=%v, (%v:)", tls, c, l, origin(2))
+ }
return Xisprint(tls, c)
}
func Xisupper(tls *TLS, c int32) int32 { /* isupper.c:4:5: */
+ if __ccgo_strace {
+ trc("tls=%v c=%v, (%v:)", tls, c, origin(2))
+ }
return Bool32(uint32(c)-uint32('A') < uint32(26))
}
func X__isupper_l(tls *TLS, c int32, l locale_t) int32 { /* isupper.c:9:5: */
+ if __ccgo_strace {
+ trc("tls=%v c=%v l=%v, (%v:)", tls, c, l, origin(2))
+ }
return Xisupper(tls, c)
}
func Xisxdigit(tls *TLS, c int32) int32 { /* isxdigit.c:3:5: */
+ if __ccgo_strace {
+ trc("tls=%v c=%v, (%v:)", tls, c, origin(2))
+ }
return Bool32(func() int32 {
if 0 != 0 {
return Xisdigit(tls, c)
@@ -482,6 +524,9 @@ func Xisxdigit(tls *TLS, c int32) int32 { /* isxdigit.c:3:5: */
}
func X__isxdigit_l(tls *TLS, c int32, l locale_t) int32 { /* isxdigit.c:8:5: */
+ if __ccgo_strace {
+ trc("tls=%v c=%v l=%v, (%v:)", tls, c, l, origin(2))
+ }
return Xisxdigit(tls, c)
}
@@ -535,6 +580,9 @@ type lldiv_t = struct {
} /* stdlib.h:64:41 */
func Xclosedir(tls *TLS, dir uintptr) int32 { /* closedir.c:6:5: */
+ if __ccgo_strace {
+ trc("tls=%v dir=%v, (%v:)", tls, dir, origin(2))
+ }
var ret int32 = Xclose(tls, (*DIR)(unsafe.Pointer(dir)).fd)
Xfree(tls, dir)
return ret
@@ -571,6 +619,9 @@ type f_owner_ex = struct {
type syscall_arg_t = int64 /* syscall.h:22:14 */
func Xopendir(tls *TLS, name uintptr) uintptr { /* opendir.c:8:5: */
+ if __ccgo_strace {
+ trc("tls=%v name=%v, (%v:)", tls, name, origin(2))
+ }
var fd int32
var dir uintptr
@@ -593,6 +644,9 @@ type max_align_t = struct {
type dirstream_buf_alignment_check = [1]uint8 /* readdir.c:7:14 */
func Xreaddir(tls *TLS, dir uintptr) uintptr { /* readdir.c:10:15: */
+ if __ccgo_strace {
+ trc("tls=%v dir=%v, (%v:)", tls, dir, origin(2))
+ }
var de uintptr
if (*DIR)(unsafe.Pointer(dir)).buf_pos >= (*DIR)(unsafe.Pointer(dir)).buf_end {
@@ -1356,6 +1410,9 @@ func hexfloat(tls *TLS, f uintptr, bits int32, emin int32, sign int32, pok int32
}
func X__floatscan(tls *TLS, f uintptr, prec int32, pok int32) float64 { /* floatscan.c:427:13: */
+ if __ccgo_strace {
+ trc("tls=%v f=%v prec=%v pok=%v, (%v:)", tls, f, prec, pok, origin(2))
+ }
var sign int32 = 1
var i size_t
var bits int32
@@ -1533,6 +1590,9 @@ var table1 = [257]uint8{Uint8FromInt32(-1),
} /* intscan.c:7:28 */
func X__intscan(tls *TLS, f uintptr, base uint32, pok int32, lim uint64) uint64 { /* intscan.c:26:20: */
+ if __ccgo_strace {
+ trc("tls=%v f=%v base=%v pok=%v lim=%v, (%v:)", tls, f, base, pok, lim, origin(2))
+ }
var val uintptr
var c int32
var neg int32
@@ -1838,6 +1898,9 @@ __43:
// the actual count.
func X__shlim(tls *TLS, f uintptr, lim off_t) { /* shgetc.c:8:6: */
+ if __ccgo_strace {
+ trc("tls=%v f=%v lim=%v, (%v:)", tls, f, lim, origin(2))
+ }
(*FILE)(unsafe.Pointer(f)).shlim = lim
(*FILE)(unsafe.Pointer(f)).shcnt = (int64((*FILE)(unsafe.Pointer(f)).buf) - int64((*FILE)(unsafe.Pointer(f)).rpos)) / 1
// If lim is nonzero, rend must be a valid pointer.
@@ -1849,6 +1912,9 @@ func X__shlim(tls *TLS, f uintptr, lim off_t) { /* shgetc.c:8:6: */
}
func X__shgetc(tls *TLS, f uintptr) int32 { /* shgetc.c:19:5: */
+ if __ccgo_strace {
+ trc("tls=%v f=%v, (%v:)", tls, f, origin(2))
+ }
var c int32
var cnt off_t = (*FILE)(unsafe.Pointer(f)).shcnt + (int64((*FILE)(unsafe.Pointer(f)).rpos)-int64((*FILE)(unsafe.Pointer(f)).buf))/1
if (*FILE)(unsafe.Pointer(f)).shlim != 0 && cnt >= (*FILE)(unsafe.Pointer(f)).shlim || AssignInt32(&c, X__uflow(tls, f)) < 0 {
@@ -1910,10 +1976,16 @@ type lconv = struct {
var posix_lconv = lconv{decimal_point: ts + 23, thousands_sep: ts + 13, grouping: ts + 13, int_curr_symbol: ts + 13, currency_symbol: ts + 13, mon_decimal_point: ts + 13, mon_thousands_sep: ts + 13, mon_grouping: ts + 13, positive_sign: ts + 13, negative_sign: ts + 13, int_frac_digits: uint8(255), frac_digits: uint8(255), p_cs_precedes: uint8(255), p_sep_by_space: uint8(255), n_cs_precedes: uint8(255), n_sep_by_space: uint8(255), p_sign_posn: uint8(255), n_sign_posn: uint8(255), int_p_cs_precedes: uint8(255), int_p_sep_by_space: uint8(255), int_n_cs_precedes: uint8(255), int_n_sep_by_space: uint8(255), int_p_sign_posn: uint8(255), int_n_sign_posn: uint8(255)} /* localeconv.c:4:27 */
func Xlocaleconv(tls *TLS) uintptr { /* localeconv.c:31:14: */
+ if __ccgo_strace {
+ trc("tls=%v, (%v:)", tls, origin(2))
+ }
return uintptr(unsafe.Pointer(&posix_lconv))
}
func X__fpclassify(tls *TLS, x float64) int32 { /* __fpclassify.c:4:5: */
+ if __ccgo_strace {
+ trc("tls=%v x=%v, (%v:)", tls, x, origin(2))
+ }
bp := tls.Alloc(8)
defer tls.Free(8)
@@ -1938,6 +2010,9 @@ func X__fpclassify(tls *TLS, x float64) int32 { /* __fpclassify.c:4:5: */
}
func X__fpclassifyf(tls *TLS, x float32) int32 { /* __fpclassifyf.c:4:5: */
+ if __ccgo_strace {
+ trc("tls=%v x=%v, (%v:)", tls, x, origin(2))
+ }
bp := tls.Alloc(4)
defer tls.Free(4)
@@ -1962,28 +2037,46 @@ func X__fpclassifyf(tls *TLS, x float32) int32 { /* __fpclassifyf.c:4:5: */
}
func X__fpclassifyl(tls *TLS, x float64) int32 { /* __fpclassifyl.c:4:5: */
+ if __ccgo_strace {
+ trc("tls=%v x=%v, (%v:)", tls, x, origin(2))
+ }
return X__fpclassify(tls, x)
}
func Xcopysignl(tls *TLS, x float64, y float64) float64 { /* copysignl.c:4:13: */
+ if __ccgo_strace {
+ trc("tls=%v x=%v y=%v, (%v:)", tls, x, y, origin(2))
+ }
return Xcopysign(tls, x, y)
}
func Xfabsl(tls *TLS, x float64) float64 { /* fabsl.c:3:13: */
+ if __ccgo_strace {
+ trc("tls=%v x=%v, (%v:)", tls, x, origin(2))
+ }
return Xfabs(tls, x)
}
func Xfmodl(tls *TLS, x float64, y float64) float64 { /* fmodl.c:4:13: */
+ if __ccgo_strace {
+ trc("tls=%v x=%v y=%v, (%v:)", tls, x, y, origin(2))
+ }
return Xfmod(tls, x, y)
}
func Xnanf(tls *TLS, s uintptr) float32 { /* nanf.c:3:7: */
+ if __ccgo_strace {
+ trc("tls=%v s=%v, (%v:)", tls, s, origin(2))
+ }
return X__builtin_nanf(tls, ts+13)
}
var toint double_t = float64(float64(1)) / 2.22044604925031308085e-16 /* rint.c:10:23 */
func Xrint(tls *TLS, x float64) float64 { /* rint.c:12:8: */
+ if __ccgo_strace {
+ trc("tls=%v x=%v, (%v:)", tls, x, origin(2))
+ }
bp := tls.Alloc(8)
defer tls.Free(8)
@@ -2013,6 +2106,9 @@ func Xrint(tls *TLS, x float64) float64 { /* rint.c:12:8: */
}
func Xscalbn(tls *TLS, x float64, n int32) float64 { /* scalbn.c:4:8: */
+ if __ccgo_strace {
+ trc("tls=%v x=%v n=%v, (%v:)", tls, x, n, origin(2))
+ }
bp := tls.Alloc(8)
defer tls.Free(8)
@@ -2049,6 +2145,9 @@ func Xscalbn(tls *TLS, x float64, n int32) float64 { /* scalbn.c:4:8: */
}
func Xscalbnl(tls *TLS, x float64, n int32) float64 { /* scalbnl.c:4:13: */
+ if __ccgo_strace {
+ trc("tls=%v x=%v n=%v, (%v:)", tls, x, n, origin(2))
+ }
return Xscalbn(tls, x, n)
}
@@ -3414,6 +3513,9 @@ type __mbstate_t = struct {
type mbstate_t = __mbstate_t /* alltypes.h:324:63 */
func Xmbrtowc(tls *TLS, wc uintptr, src uintptr, n size_t, st uintptr) size_t { /* mbrtowc.c:6:8: */
+ if __ccgo_strace {
+ trc("tls=%v wc=%v src=%v n=%v st=%v, (%v:)", tls, wc, src, n, st, origin(2))
+ }
bp := tls.Alloc(4)
defer tls.Free(4)
@@ -3537,6 +3639,9 @@ ilseq:
var _sinternal_state uint32 /* mbrtowc.c:8:18: */
func Xmbsinit(tls *TLS, st uintptr) int32 { /* mbsinit.c:3:5: */
+ if __ccgo_strace {
+ trc("tls=%v st=%v, (%v:)", tls, st, origin(2))
+ }
return Bool32(!(st != 0) || !(int32(*(*uint32)(unsafe.Pointer(st))) != 0))
}
@@ -3839,6 +3944,9 @@ type resolvconf = struct {
} /* lookup.h:34:1 */
func Xfreeaddrinfo(tls *TLS, p uintptr) { /* freeaddrinfo.c:7:6: */
+ if __ccgo_strace {
+ trc("tls=%v p=%v, (%v:)", tls, p, origin(2))
+ }
var cnt size_t
cnt = uint64(1)
__1:
@@ -3863,6 +3971,9 @@ __3:
}
func Xgetaddrinfo(tls *TLS, host uintptr, serv uintptr, hint uintptr, res uintptr) int32 { /* getaddrinfo.c:12:5: */
+ if __ccgo_strace {
+ trc("tls=%v host=%v serv=%v hint=%v res=%v, (%v:)", tls, host, serv, hint, res, origin(2))
+ }
bp := tls.Alloc(1608)
defer tls.Free(1608)
@@ -4067,6 +4178,9 @@ type mmsghdr = struct {
} /* socket.h:63:1 */
func Xgethostbyaddr(tls *TLS, a uintptr, l socklen_t, af int32) uintptr { /* gethostbyaddr.c:7:16: */
+ if __ccgo_strace {
+ trc("tls=%v a=%v l=%v af=%v, (%v:)", tls, a, l, af, origin(2))
+ }
bp := tls.Alloc(8)
defer tls.Free(8)
@@ -4093,6 +4207,9 @@ func Xgethostbyaddr(tls *TLS, a uintptr, l socklen_t, af int32) uintptr { /* get
var _sh uintptr /* gethostbyaddr.c:9:24: */
func Xgethostbyaddr_r(tls *TLS, a uintptr, l socklen_t, af int32, h uintptr, buf uintptr, buflen size_t, res uintptr, err uintptr) int32 { /* gethostbyaddr_r.c:10:5: */
+ if __ccgo_strace {
+ trc("tls=%v a=%v l=%v af=%v h=%v buf=%v buflen=%v res=%v err=%v, (%v:)", tls, a, l, af, h, buf, buflen, res, err, origin(2))
+ }
bp := tls.Alloc(28)
defer tls.Free(28)
@@ -4178,10 +4295,16 @@ func Xgethostbyaddr_r(tls *TLS, a uintptr, l socklen_t, af int32, h uintptr, buf
}
func Xgethostbyname(tls *TLS, name uintptr) uintptr { /* gethostbyname.c:8:16: */
+ if __ccgo_strace {
+ trc("tls=%v name=%v, (%v:)", tls, name, origin(2))
+ }
return Xgethostbyname2(tls, name, 2)
}
func Xgethostbyname2(tls *TLS, name uintptr, af int32) uintptr { /* gethostbyname2.c:8:16: */
+ if __ccgo_strace {
+ trc("tls=%v name=%v af=%v, (%v:)", tls, name, af, origin(2))
+ }
bp := tls.Alloc(8)
defer tls.Free(8)
@@ -4208,6 +4331,9 @@ func Xgethostbyname2(tls *TLS, name uintptr, af int32) uintptr { /* gethostbynam
var _sh1 uintptr /* gethostbyname2.c:10:24: */
func Xgethostbyname2_r(tls *TLS, name uintptr, af int32, h uintptr, buf uintptr, buflen size_t, res uintptr, err uintptr) int32 { /* gethostbyname2_r.c:11:5: */
+ if __ccgo_strace {
+ trc("tls=%v name=%v af=%v h=%v buf=%v buflen=%v res=%v err=%v, (%v:)", tls, name, af, h, buf, buflen, res, err, origin(2))
+ }
bp := tls.Alloc(1600)
defer tls.Free(1600)
@@ -4299,6 +4425,9 @@ func Xgethostbyname2_r(tls *TLS, name uintptr, af int32, h uintptr, buf uintptr,
}
func Xgethostbyname_r(tls *TLS, name uintptr, h uintptr, buf uintptr, buflen size_t, res uintptr, err uintptr) int32 { /* gethostbyname_r.c:6:5: */
+ if __ccgo_strace {
+ trc("tls=%v name=%v h=%v buf=%v buflen=%v res=%v err=%v, (%v:)", tls, name, h, buf, buflen, res, err, origin(2))
+ }
return Xgethostbyname2_r(tls, name, 2, h, buf, buflen, res, err)
}
@@ -4598,6 +4727,9 @@ func reverse_services(tls *TLS, buf uintptr, port int32, dgram int32) { /* getna
}
func Xgetnameinfo(tls *TLS, sa1 uintptr, sl socklen_t, node uintptr, nodelen socklen_t, serv uintptr, servlen socklen_t, flags int32) int32 { /* getnameinfo.c:125:5: */
+ if __ccgo_strace {
+ trc("tls=%v sa1=%v sl=%v node=%v nodelen=%v serv=%v servlen=%v flags=%v, (%v:)", tls, sa1, sl, node, nodelen, serv, servlen, flags, origin(2))
+ }
bp := tls.Alloc(347)
defer tls.Free(347)
@@ -4698,10 +4830,16 @@ func Xgetnameinfo(tls *TLS, sa1 uintptr, sl socklen_t, node uintptr, nodelen soc
var Xh_errno int32 /* h_errno.c:4:5: */
func X__h_errno_location(tls *TLS) uintptr { /* h_errno.c:6:5: */
+ if __ccgo_strace {
+ trc("tls=%v, (%v:)", tls, origin(2))
+ }
return uintptr(unsafe.Pointer(&Xh_errno))
}
func X__inet_aton(tls *TLS, s0 uintptr, dest uintptr) int32 { /* inet_aton.c:7:5: */
+ if __ccgo_strace {
+ trc("tls=%v s0=%v dest=%v, (%v:)", tls, s0, dest, origin(2))
+ }
bp := tls.Alloc(40)
defer tls.Free(40)
@@ -4753,6 +4891,9 @@ func X__inet_aton(tls *TLS, s0 uintptr, dest uintptr) int32 { /* inet_aton.c:7:5
}
func Xinet_ntop(tls *TLS, af int32, a0 uintptr, s uintptr, l socklen_t) uintptr { /* inet_ntop.c:7:12: */
+ if __ccgo_strace {
+ trc("tls=%v af=%v a0=%v s=%v l=%v, (%v:)", tls, af, a0, s, l, origin(2))
+ }
bp := tls.Alloc(276)
defer tls.Free(276)
@@ -4827,6 +4968,9 @@ func hexval(tls *TLS, c uint32) int32 { /* inet_pton.c:7:12: */
}
func Xinet_pton(tls *TLS, af int32, s uintptr, a0 uintptr) int32 { /* inet_pton.c:15:5: */
+ if __ccgo_strace {
+ trc("tls=%v af=%v s=%v a0=%v, (%v:)", tls, af, s, a0, origin(2))
+ }
bp := tls.Alloc(16)
defer tls.Free(16)
@@ -4924,6 +5068,9 @@ func Xinet_pton(tls *TLS, af int32, s uintptr, a0 uintptr) int32 { /* inet_pton.
}
func X__lookup_ipliteral(tls *TLS, buf uintptr, name uintptr, family int32) int32 { /* lookup_ipliteral.c:12:5: */
+ if __ccgo_strace {
+ trc("tls=%v buf=%v name=%v family=%v, (%v:)", tls, buf, name, family, origin(2))
+ }
bp := tls.Alloc(96)
defer tls.Free(96)
@@ -5234,6 +5381,9 @@ func addrcmp(tls *TLS, _a uintptr, _b uintptr) int32 { /* lookup_name.c:305:12:
}
func X__lookup_name(tls *TLS, buf uintptr, canon uintptr, name uintptr, family int32, flags int32) int32 { /* lookup_name.c:311:5: */
+ if __ccgo_strace {
+ trc("tls=%v buf=%v canon=%v name=%v family=%v flags=%v, (%v:)", tls, buf, canon, name, family, flags, origin(2))
+ }
bp := tls.Alloc(92)
defer tls.Free(92)
@@ -5400,6 +5550,9 @@ func X__lookup_name(tls *TLS, buf uintptr, canon uintptr, name uintptr, family i
}
func X__lookup_serv(tls *TLS, buf uintptr, name uintptr, proto int32, socktype int32, flags int32) int32 { /* lookup_serv.c:12:5: */
+ if __ccgo_strace {
+ trc("tls=%v buf=%v name=%v proto=%v socktype=%v flags=%v, (%v:)", tls, buf, name, proto, socktype, flags, origin(2))
+ }
bp := tls.Alloc(8)
defer tls.Free(8)
@@ -5533,10 +5686,16 @@ func temper(tls *TLS, x uint32) uint32 { /* rand_r.c:3:17: */
}
func Xrand_r(tls *TLS, seed uintptr) int32 { /* rand_r.c:12:5: */
+ if __ccgo_strace {
+ trc("tls=%v seed=%v, (%v:)", tls, seed, origin(2))
+ }
return int32(temper(tls, AssignPtrUint32(seed, *(*uint32)(unsafe.Pointer(seed))*uint32(1103515245)+uint32(12345))) / uint32(2))
}
func X__lockfile(tls *TLS, f uintptr) int32 { /* __lockfile.c:4:5: */
+ if __ccgo_strace {
+ trc("tls=%v f=%v, (%v:)", tls, f, origin(2))
+ }
var owner int32 = (*FILE)(unsafe.Pointer(f)).lock
var tid int32 = (*__pthread)(unsafe.Pointer(__pthread_self(tls))).tid
if owner&CplInt32(0x40000000) == tid {
@@ -5555,12 +5714,18 @@ func X__lockfile(tls *TLS, f uintptr) int32 { /* __lockfile.c:4:5: */
}
func X__unlockfile(tls *TLS, f uintptr) { /* __lockfile.c:19:6: */
+ if __ccgo_strace {
+ trc("tls=%v f=%v, (%v:)", tls, f, origin(2))
+ }
if a_swap(tls, f+140, 0)&0x40000000 != 0 {
__wake(tls, f+140, 1, 1)
}
}
func X__toread(tls *TLS, f uintptr) int32 { /* __toread.c:3:5: */
+ if __ccgo_strace {
+ trc("tls=%v f=%v, (%v:)", tls, f, origin(2))
+ }
*(*int32)(unsafe.Pointer(f + 136)) |= (*FILE)(unsafe.Pointer(f)).mode - 1
if (*FILE)(unsafe.Pointer(f)).wpos != (*FILE)(unsafe.Pointer(f)).wbase {
(*struct {
@@ -5580,6 +5745,9 @@ func X__toread(tls *TLS, f uintptr) int32 { /* __toread.c:3:5: */
}
func X__toread_needs_stdio_exit(tls *TLS) { /* __toread.c:16:13: */
+ if __ccgo_strace {
+ trc("tls=%v, (%v:)", tls, origin(2))
+ }
X__builtin_abort(tls) //TODO-
// __stdio_exit_needed();
}
@@ -5588,6 +5756,9 @@ func X__toread_needs_stdio_exit(tls *TLS) { /* __toread.c:16:13: */
// data buffered for reading.
func X__uflow(tls *TLS, f uintptr) int32 { /* __uflow.c:6:5: */
+ if __ccgo_strace {
+ trc("tls=%v f=%v, (%v:)", tls, f, origin(2))
+ }
bp := tls.Alloc(1)
defer tls.Free(1)
@@ -5602,6 +5773,9 @@ func X__uflow(tls *TLS, f uintptr) int32 { /* __uflow.c:6:5: */
}
func Xsscanf(tls *TLS, s uintptr, fmt uintptr, va uintptr) int32 { /* sscanf.c:4:5: */
+ if __ccgo_strace {
+ trc("tls=%v s=%v fmt=%v va=%v, (%v:)", tls, s, fmt, va, origin(2))
+ }
var ret int32
var ap va_list
_ = ap
@@ -5651,6 +5825,9 @@ func arg_n(tls *TLS, ap va_list, n uint32) uintptr { /* vfscanf.c:44:13: */
}
func Xvfscanf(tls *TLS, f uintptr, fmt uintptr, ap va_list) int32 { /* vfscanf.c:56:5: */
+ if __ccgo_strace {
+ trc("tls=%v f=%v fmt=%v ap=%v, (%v:)", tls, f, fmt, ap, origin(2))
+ }
bp := tls.Alloc(276)
defer tls.Free(276)
@@ -6526,6 +6703,9 @@ func string_read(tls *TLS, f uintptr, buf uintptr, len size_t) size_t { /* vssca
}
func Xvsscanf(tls *TLS, s uintptr, fmt uintptr, ap va_list) int32 { /* vsscanf.c:18:5: */
+ if __ccgo_strace {
+ trc("tls=%v s=%v fmt=%v ap=%v, (%v:)", tls, s, fmt, ap, origin(2))
+ }
bp := tls.Alloc(232)
defer tls.Free(232)
@@ -6536,6 +6716,9 @@ func Xvsscanf(tls *TLS, s uintptr, fmt uintptr, ap va_list) int32 { /* vsscanf.c
}
func Xbsearch(tls *TLS, key uintptr, base uintptr, nel size_t, width size_t, cmp uintptr) uintptr { /* bsearch.c:3:6: */
+ if __ccgo_strace {
+ trc("tls=%v key=%v base=%v nel=%v width=%v cmp=%v, (%v:)", tls, key, base, nel, width, cmp, origin(2))
+ }
var try uintptr
var sign int32
for nel > uint64(0) {
@@ -6578,14 +6761,23 @@ func strtox(tls *TLS, s uintptr, p uintptr, prec int32) float64 { /* strtod.c:6:
}
func Xstrtof(tls *TLS, s uintptr, p uintptr) float32 { /* strtod.c:17:7: */
+ if __ccgo_strace {
+ trc("tls=%v s=%v p=%v, (%v:)", tls, s, p, origin(2))
+ }
return float32(strtox(tls, s, p, 0))
}
func Xstrtod(tls *TLS, s uintptr, p uintptr) float64 { /* strtod.c:22:8: */
+ if __ccgo_strace {
+ trc("tls=%v s=%v p=%v, (%v:)", tls, s, p, origin(2))
+ }
return strtox(tls, s, p, 1)
}
func Xstrtold(tls *TLS, s uintptr, p uintptr) float64 { /* strtod.c:27:13: */
+ if __ccgo_strace {
+ trc("tls=%v s=%v p=%v, (%v:)", tls, s, p, origin(2))
+ }
return strtox(tls, s, p, 2)
}
@@ -6607,30 +6799,51 @@ func strtox1(tls *TLS, s uintptr, p uintptr, base int32, lim uint64) uint64 { /*
}
func Xstrtoull(tls *TLS, s uintptr, p uintptr, base int32) uint64 { /* strtol.c:21:20: */
+ if __ccgo_strace {
+ trc("tls=%v s=%v p=%v base=%v, (%v:)", tls, s, p, base, origin(2))
+ }
return strtox1(tls, s, p, base, 2*uint64(0x7fffffffffffffff)+uint64(1))
}
func Xstrtoll(tls *TLS, s uintptr, p uintptr, base int32) int64 { /* strtol.c:26:11: */
+ if __ccgo_strace {
+ trc("tls=%v s=%v p=%v base=%v, (%v:)", tls, s, p, base, origin(2))
+ }
return int64(strtox1(tls, s, p, base, Uint64FromInt64(-0x7fffffffffffffff-int64(1))))
}
func Xstrtoul(tls *TLS, s uintptr, p uintptr, base int32) uint64 { /* strtol.c:31:15: */
+ if __ccgo_strace {
+ trc("tls=%v s=%v p=%v base=%v, (%v:)", tls, s, p, base, origin(2))
+ }
return uint64(strtox1(tls, s, p, base, 2*uint64(0x7fffffffffffffff)+uint64(1)))
}
func Xstrtol(tls *TLS, s uintptr, p uintptr, base int32) int64 { /* strtol.c:36:6: */
+ if __ccgo_strace {
+ trc("tls=%v s=%v p=%v base=%v, (%v:)", tls, s, p, base, origin(2))
+ }
return int64(strtox1(tls, s, p, base, 0+Uint64FromInt64(Int64(-Int64(0x7fffffffffffffff))-Int64FromInt32(1))))
}
func Xstrtoimax(tls *TLS, s uintptr, p uintptr, base int32) intmax_t { /* strtol.c:41:10: */
+ if __ccgo_strace {
+ trc("tls=%v s=%v p=%v base=%v, (%v:)", tls, s, p, base, origin(2))
+ }
return intmax_t(Xstrtoll(tls, s, p, base))
}
func Xstrtoumax(tls *TLS, s uintptr, p uintptr, base int32) uintmax_t { /* strtol.c:46:11: */
+ if __ccgo_strace {
+ trc("tls=%v s=%v p=%v base=%v, (%v:)", tls, s, p, base, origin(2))
+ }
return uintmax_t(Xstrtoull(tls, s, p, base))
}
func Xstrdup(tls *TLS, s uintptr) uintptr { /* strdup.c:4:6: */
+ if __ccgo_strace {
+ trc("tls=%v s=%v, (%v:)", tls, s, origin(2))
+ }
var l size_t = Xstrlen(tls, s)
var d uintptr = Xmalloc(tls, l+uint64(1))
if !(d != 0) {
@@ -6640,6 +6853,9 @@ func Xstrdup(tls *TLS, s uintptr) uintptr { /* strdup.c:4:6: */
}
func Xstrlcat(tls *TLS, d uintptr, s uintptr, n size_t) size_t { /* strlcat.c:4:8: */
+ if __ccgo_strace {
+ trc("tls=%v d=%v s=%v n=%v, (%v:)", tls, d, s, n, origin(2))
+ }
var l size_t = Xstrnlen(tls, d, n)
if l == n {
return l + Xstrlen(tls, s)
@@ -6657,6 +6873,9 @@ func Xstrlcat(tls *TLS, d uintptr, s uintptr, n size_t) size_t { /* strlcat.c:4:
// from SUS and have nothing to do with the host system.
func Xstrlcpy(tls *TLS, d uintptr, s uintptr, n size_t) size_t { /* strlcpy.c:11:8: */
+ if __ccgo_strace {
+ trc("tls=%v d=%v s=%v n=%v, (%v:)", tls, d, s, n, origin(2))
+ }
var d0 uintptr
var wd uintptr
var ws uintptr
@@ -6728,6 +6947,9 @@ finish:
}
func Xstrncasecmp(tls *TLS, _l uintptr, _r uintptr, n size_t) int32 { /* strncasecmp.c:4:5: */
+ if __ccgo_strace {
+ trc("tls=%v _l=%v _r=%v n=%v, (%v:)", tls, _l, _r, n, origin(2))
+ }
var l uintptr = _l
var r uintptr = _r
if !(int32(PostDecUint64(&n, 1)) != 0) {
@@ -6750,10 +6972,16 @@ __3:
}
func X__strncasecmp_l(tls *TLS, l uintptr, r uintptr, n size_t, loc locale_t) int32 { /* strncasecmp.c:12:5: */
+ if __ccgo_strace {
+ trc("tls=%v l=%v r=%v n=%v loc=%v, (%v:)", tls, l, r, n, loc, origin(2))
+ }
return Xstrncasecmp(tls, l, r, n)
}
func Xstrncat(tls *TLS, d uintptr, s uintptr, n size_t) uintptr { /* strncat.c:3:6: */
+ if __ccgo_strace {
+ trc("tls=%v d=%v s=%v n=%v, (%v:)", tls, d, s, n, origin(2))
+ }
var a uintptr = d
d += uintptr(Xstrlen(tls, d))
for n != 0 && *(*uint8)(unsafe.Pointer(s)) != 0 {
@@ -6765,6 +6993,9 @@ func Xstrncat(tls *TLS, d uintptr, s uintptr, n size_t) uintptr { /* strncat.c:3
}
func Xstrnlen(tls *TLS, s uintptr, n size_t) size_t { /* strnlen.c:3:8: */
+ if __ccgo_strace {
+ trc("tls=%v s=%v n=%v, (%v:)", tls, s, n, origin(2))
+ }
var p uintptr = Xmemchr(tls, s, 0, n)
if p != 0 {
return uint64((int64(p) - int64(s)) / 1)
@@ -6773,6 +7004,9 @@ func Xstrnlen(tls *TLS, s uintptr, n size_t) size_t { /* strnlen.c:3:8: */
}
func Xstrspn(tls *TLS, s uintptr, c uintptr) size_t { /* strspn.c:6:8: */
+ if __ccgo_strace {
+ trc("tls=%v s=%v c=%v, (%v:)", tls, s, c, origin(2))
+ }
bp := tls.Alloc(32)
defer tls.Free(32)
@@ -6796,6 +7030,9 @@ func Xstrspn(tls *TLS, s uintptr, c uintptr) size_t { /* strspn.c:6:8: */
}
func Xstrtok(tls *TLS, s uintptr, sep uintptr) uintptr { /* strtok.c:3:6: */
+ if __ccgo_strace {
+ trc("tls=%v s=%v sep=%v, (%v:)", tls, s, sep, origin(2))
+ }
if !(s != 0) && !(int32(AssignUintptr(&s, _sp)) != 0) {
return uintptr(0)
}
@@ -6815,10 +7052,16 @@ func Xstrtok(tls *TLS, s uintptr, sep uintptr) uintptr { /* strtok.c:3:6: */
var _sp uintptr /* strtok.c:5:14: */
func X__ccgo_pthreadAttrGetDetachState(tls *TLS, a uintptr) int32 { /* pthread_attr_get.c:3:5: */
+ if __ccgo_strace {
+ trc("tls=%v a=%v, (%v:)", tls, a, origin(2))
+ }
return *(*int32)(unsafe.Pointer(a + 6*4))
}
func Xpthread_attr_getdetachstate(tls *TLS, a uintptr, state uintptr) int32 { /* pthread_attr_get.c:7:5: */
+ if __ccgo_strace {
+ trc("tls=%v a=%v state=%v, (%v:)", tls, a, state, origin(2))
+ }
*(*int32)(unsafe.Pointer(state)) = *(*int32)(unsafe.Pointer(a + 6*4))
return 0
}
@@ -6905,6 +7148,9 @@ func Xpthread_attr_getdetachstate(tls *TLS, a uintptr, state uintptr) int32 { /*
// }
func X__ccgo_pthreadMutexattrGettype(tls *TLS, a uintptr) int32 { /* pthread_attr_get.c:93:5: */
+ if __ccgo_strace {
+ trc("tls=%v a=%v, (%v:)", tls, a, origin(2))
+ }
return int32((*pthread_mutexattr_t)(unsafe.Pointer(a)).__attr & uint32(3))
}
@@ -6921,6 +7167,9 @@ func X__ccgo_pthreadMutexattrGettype(tls *TLS, a uintptr) int32 { /* pthread_att
// }
func Xpthread_attr_setdetachstate(tls *TLS, a uintptr, state int32) int32 { /* pthread_attr_setdetachstate.c:3:5: */
+ if __ccgo_strace {
+ trc("tls=%v a=%v state=%v, (%v:)", tls, a, state, origin(2))
+ }
if uint32(state) > 1 {
return 22
}
@@ -6929,6 +7178,9 @@ func Xpthread_attr_setdetachstate(tls *TLS, a uintptr, state int32) int32 { /* p
}
func X__ccgo_getMutexType(tls *TLS, m uintptr) int32 { /* pthread_mutex_lock.c:3:5: */
+ if __ccgo_strace {
+ trc("tls=%v m=%v, (%v:)", tls, m, origin(2))
+ }
return *(*int32)(unsafe.Pointer(m)) & 15
}
@@ -6944,15 +7196,24 @@ func X__ccgo_getMutexType(tls *TLS, m uintptr) int32 { /* pthread_mutex_lock.c:3
// weak_alias(__pthread_mutex_lock, pthread_mutex_lock);
func Xpthread_mutexattr_destroy(tls *TLS, a uintptr) int32 { /* pthread_mutexattr_destroy.c:3:5: */
+ if __ccgo_strace {
+ trc("tls=%v a=%v, (%v:)", tls, a, origin(2))
+ }
return 0
}
func Xpthread_mutexattr_init(tls *TLS, a uintptr) int32 { /* pthread_mutexattr_init.c:3:5: */
+ if __ccgo_strace {
+ trc("tls=%v a=%v, (%v:)", tls, a, origin(2))
+ }
*(*pthread_mutexattr_t)(unsafe.Pointer(a)) = pthread_mutexattr_t{}
return 0
}
func Xpthread_mutexattr_settype(tls *TLS, a uintptr, type1 int32) int32 { /* pthread_mutexattr_settype.c:3:5: */
+ if __ccgo_strace {
+ trc("tls=%v a=%v type1=%v, (%v:)", tls, a, type1, origin(2))
+ }
if uint32(type1) > uint32(2) {
return 22
}
diff --git a/vendor/modernc.org/libc/musl_netbsd_amd64.go b/vendor/modernc.org/libc/musl_netbsd_amd64.go
index b21d3d94..28a98053 100644
--- a/vendor/modernc.org/libc/musl_netbsd_amd64.go
+++ b/vendor/modernc.org/libc/musl_netbsd_amd64.go
@@ -860,6 +860,9 @@ func __isspace(tls *TLS, _c int32) int32 { /* ctype.h:26:21: */
type locale_t1 = uintptr /* alltypes.h:343:32 */
func Xisalnum(tls *TLS, c int32) int32 { /* isalnum.c:3:5: */
+ if __ccgo_strace {
+ trc("tls=%v c=%v, (%v:)", tls, c, origin(2))
+ }
return Bool32(func() int32 {
if 0 != 0 {
return Xisalpha(tls, c)
@@ -874,30 +877,51 @@ func Xisalnum(tls *TLS, c int32) int32 { /* isalnum.c:3:5: */
}
func X__isalnum_l(tls *TLS, c int32, l locale_t1) int32 { /* isalnum.c:8:5: */
+ if __ccgo_strace {
+ trc("tls=%v c=%v l=%v, (%v:)", tls, c, l, origin(2))
+ }
return Xisalnum(tls, c)
}
func Xisalpha(tls *TLS, c int32) int32 { /* isalpha.c:4:5: */
+ if __ccgo_strace {
+ trc("tls=%v c=%v, (%v:)", tls, c, origin(2))
+ }
return Bool32(uint32(c)|uint32(32)-uint32('a') < uint32(26))
}
func X__isalpha_l(tls *TLS, c int32, l locale_t1) int32 { /* isalpha.c:9:5: */
+ if __ccgo_strace {
+ trc("tls=%v c=%v l=%v, (%v:)", tls, c, l, origin(2))
+ }
return Xisalpha(tls, c)
}
func Xisdigit(tls *TLS, c int32) int32 { /* isdigit.c:4:5: */
+ if __ccgo_strace {
+ trc("tls=%v c=%v, (%v:)", tls, c, origin(2))
+ }
return Bool32(uint32(c)-uint32('0') < uint32(10))
}
func X__isdigit_l(tls *TLS, c int32, l locale_t1) int32 { /* isdigit.c:9:5: */
+ if __ccgo_strace {
+ trc("tls=%v c=%v l=%v, (%v:)", tls, c, l, origin(2))
+ }
return Xisdigit(tls, c)
}
func Xisprint(tls *TLS, c int32) int32 { /* isprint.c:4:5: */
+ if __ccgo_strace {
+ trc("tls=%v c=%v, (%v:)", tls, c, origin(2))
+ }
return Bool32(uint32(c)-uint32(0x20) < uint32(0x5f))
}
func X__isprint_l(tls *TLS, c int32, l locale_t1) int32 { /* isprint.c:9:5: */
+ if __ccgo_strace {
+ trc("tls=%v c=%v l=%v, (%v:)", tls, c, l, origin(2))
+ }
return Xisprint(tls, c)
}
@@ -1615,6 +1639,9 @@ func hexfloat(tls *TLS, f uintptr, bits int32, emin int32, sign int32, pok int32
}
func X__floatscan(tls *TLS, f uintptr, prec int32, pok int32) float64 { /* floatscan.c:427:13: */
+ if __ccgo_strace {
+ trc("tls=%v f=%v prec=%v pok=%v, (%v:)", tls, f, prec, pok, origin(2))
+ }
var sign int32 = 1
var i size_t
var bits int32
@@ -1792,6 +1819,9 @@ var table = [257]uint8{Uint8FromInt32(-1),
} /* intscan.c:7:28 */
func X__intscan(tls *TLS, f uintptr, base uint32, pok int32, lim uint64) uint64 { /* intscan.c:26:20: */
+ if __ccgo_strace {
+ trc("tls=%v f=%v base=%v pok=%v lim=%v, (%v:)", tls, f, base, pok, lim, origin(2))
+ }
var val uintptr
var c int32
var neg int32
@@ -2097,6 +2127,9 @@ __43:
// the actual count.
func X__shlim(tls *TLS, f uintptr, lim off_t) { /* shgetc.c:8:6: */
+ if __ccgo_strace {
+ trc("tls=%v f=%v lim=%v, (%v:)", tls, f, lim, origin(2))
+ }
(*FILE1)(unsafe.Pointer(f)).Fshlim = lim
(*FILE1)(unsafe.Pointer(f)).Fshcnt = (int64((*FILE1)(unsafe.Pointer(f)).Fbuf) - int64((*FILE1)(unsafe.Pointer(f)).Frpos)) / 1
// If lim is nonzero, rend must be a valid pointer.
@@ -2108,6 +2141,9 @@ func X__shlim(tls *TLS, f uintptr, lim off_t) { /* shgetc.c:8:6: */
}
func X__shgetc(tls *TLS, f uintptr) int32 { /* shgetc.c:19:5: */
+ if __ccgo_strace {
+ trc("tls=%v f=%v, (%v:)", tls, f, origin(2))
+ }
var c int32
var cnt off_t = (*FILE1)(unsafe.Pointer(f)).Fshcnt + (int64((*FILE1)(unsafe.Pointer(f)).Frpos)-int64((*FILE1)(unsafe.Pointer(f)).Fbuf))/1
if (*FILE1)(unsafe.Pointer(f)).Fshlim != 0 && cnt >= (*FILE1)(unsafe.Pointer(f)).Fshlim || AssignInt32(&c, X__uflow(tls, f)) < 0 {
@@ -2134,20 +2170,32 @@ func __bswap32(tls *TLS, __x uint32_t) uint32_t { /* endian.h:24:26: */
}
func Xcopysignl(tls *TLS, x float64, y float64) float64 { /* copysignl.c:4:13: */
+ if __ccgo_strace {
+ trc("tls=%v x=%v y=%v, (%v:)", tls, x, y, origin(2))
+ }
return Xcopysign(tls, x, y)
}
func Xfabsl(tls *TLS, x float64) float64 { /* fabsl.c:3:13: */
+ if __ccgo_strace {
+ trc("tls=%v x=%v, (%v:)", tls, x, origin(2))
+ }
return Xfabs(tls, x)
}
func Xfmodl(tls *TLS, x float64, y float64) float64 { /* fmodl.c:4:13: */
+ if __ccgo_strace {
+ trc("tls=%v x=%v y=%v, (%v:)", tls, x, y, origin(2))
+ }
return Xfmod(tls, x, y)
}
var toint double_t = float64(float64(1)) / 2.22044604925031308085e-16 /* rint.c:10:23 */
func Xrint(tls *TLS, x float64) float64 { /* rint.c:12:8: */
+ if __ccgo_strace {
+ trc("tls=%v x=%v, (%v:)", tls, x, origin(2))
+ }
bp := tls.Alloc(8)
defer tls.Free(8)
@@ -2177,6 +2225,9 @@ func Xrint(tls *TLS, x float64) float64 { /* rint.c:12:8: */
}
func Xscalbn(tls *TLS, x float64, n int32) float64 { /* scalbn.c:4:8: */
+ if __ccgo_strace {
+ trc("tls=%v x=%v n=%v, (%v:)", tls, x, n, origin(2))
+ }
bp := tls.Alloc(8)
defer tls.Free(8)
@@ -2213,6 +2264,9 @@ func Xscalbn(tls *TLS, x float64, n int32) float64 { /* scalbn.c:4:8: */
}
func Xscalbnl(tls *TLS, x float64, n int32) float64 { /* scalbnl.c:4:13: */
+ if __ccgo_strace {
+ trc("tls=%v x=%v n=%v, (%v:)", tls, x, n, origin(2))
+ }
return Xscalbn(tls, x, n)
}
@@ -2544,6 +2598,9 @@ type resolvconf = struct {
} /* lookup.h:34:1 */
func Xfreeaddrinfo(tls *TLS, p uintptr) { /* freeaddrinfo.c:7:6: */
+ if __ccgo_strace {
+ trc("tls=%v p=%v, (%v:)", tls, p, origin(2))
+ }
var cnt size_t
cnt = uint64(1)
__1:
@@ -2681,6 +2738,9 @@ type __ptcb = struct {
type useconds_t = uint32 /* alltypes.h:260:18 */
func Xgetaddrinfo(tls *TLS, host uintptr, serv uintptr, hint uintptr, res uintptr) int32 { /* getaddrinfo.c:12:5: */
+ if __ccgo_strace {
+ trc("tls=%v host=%v serv=%v hint=%v res=%v, (%v:)", tls, host, serv, hint, res, origin(2))
+ }
bp := tls.Alloc(1608)
defer tls.Free(1608)
@@ -2885,6 +2945,9 @@ type mmsghdr = struct {
} /* socket.h:63:1 */
func Xgethostbyaddr(tls *TLS, a uintptr, l socklen_t, af int32) uintptr { /* gethostbyaddr.c:7:16: */
+ if __ccgo_strace {
+ trc("tls=%v a=%v l=%v af=%v, (%v:)", tls, a, l, af, origin(2))
+ }
bp := tls.Alloc(8)
defer tls.Free(8)
@@ -2911,10 +2974,16 @@ func Xgethostbyaddr(tls *TLS, a uintptr, l socklen_t, af int32) uintptr { /* get
var _sh uintptr /* gethostbyaddr.c:9:24: */
func Xgethostbyname(tls *TLS, name uintptr) uintptr { /* gethostbyname.c:8:16: */
+ if __ccgo_strace {
+ trc("tls=%v name=%v, (%v:)", tls, name, origin(2))
+ }
return Xgethostbyname2(tls, name, 2)
}
func Xgethostbyname2(tls *TLS, name uintptr, af int32) uintptr { /* gethostbyname2.c:8:16: */
+ if __ccgo_strace {
+ trc("tls=%v name=%v af=%v, (%v:)", tls, name, af, origin(2))
+ }
bp := tls.Alloc(8)
defer tls.Free(8)
@@ -2941,6 +3010,9 @@ func Xgethostbyname2(tls *TLS, name uintptr, af int32) uintptr { /* gethostbynam
var _sh1 uintptr /* gethostbyname2.c:10:24: */
func Xgethostbyname2_r(tls *TLS, name uintptr, af int32, h uintptr, buf uintptr, buflen size_t, res uintptr, err uintptr) int32 { /* gethostbyname2_r.c:11:5: */
+ if __ccgo_strace {
+ trc("tls=%v name=%v af=%v h=%v buf=%v buflen=%v res=%v err=%v, (%v:)", tls, name, af, h, buf, buflen, res, err, origin(2))
+ }
bp := tls.Alloc(1600)
defer tls.Free(1600)
@@ -3329,10 +3401,16 @@ func reverse_services(tls *TLS, buf uintptr, port int32, dgram int32) { /* getna
var Xh_errno int32 /* h_errno.c:4:5: */
func X__h_errno_location(tls *TLS) uintptr { /* h_errno.c:6:5: */
+ if __ccgo_strace {
+ trc("tls=%v, (%v:)", tls, origin(2))
+ }
return uintptr(unsafe.Pointer(&Xh_errno))
}
func X__inet_aton(tls *TLS, s0 uintptr, dest uintptr) int32 { /* inet_aton.c:7:5: */
+ if __ccgo_strace {
+ trc("tls=%v s0=%v dest=%v, (%v:)", tls, s0, dest, origin(2))
+ }
bp := tls.Alloc(40)
defer tls.Free(40)
@@ -3384,6 +3462,9 @@ func X__inet_aton(tls *TLS, s0 uintptr, dest uintptr) int32 { /* inet_aton.c:7:5
}
func Xinet_ntop(tls *TLS, af int32, a0 uintptr, s uintptr, l socklen_t) uintptr { /* inet_ntop.c:7:12: */
+ if __ccgo_strace {
+ trc("tls=%v af=%v a0=%v s=%v l=%v, (%v:)", tls, af, a0, s, l, origin(2))
+ }
bp := tls.Alloc(276)
defer tls.Free(276)
@@ -3458,6 +3539,9 @@ func hexval(tls *TLS, c uint32) int32 { /* inet_pton.c:7:12: */
}
func Xinet_pton(tls *TLS, af int32, s uintptr, a0 uintptr) int32 { /* inet_pton.c:15:5: */
+ if __ccgo_strace {
+ trc("tls=%v af=%v s=%v a0=%v, (%v:)", tls, af, s, a0, origin(2))
+ }
bp := tls.Alloc(16)
defer tls.Free(16)
@@ -3555,6 +3639,9 @@ func Xinet_pton(tls *TLS, af int32, s uintptr, a0 uintptr) int32 { /* inet_pton.
}
func X__lookup_ipliteral(tls *TLS, buf uintptr, name uintptr, family int32) int32 { /* lookup_ipliteral.c:12:5: */
+ if __ccgo_strace {
+ trc("tls=%v buf=%v name=%v family=%v, (%v:)", tls, buf, name, family, origin(2))
+ }
bp := tls.Alloc(96)
defer tls.Free(96)
@@ -3877,6 +3964,9 @@ func addrcmp(tls *TLS, _a uintptr, _b uintptr) int32 { /* lookup_name.c:305:12:
}
func X__lookup_name(tls *TLS, buf uintptr, canon uintptr, name uintptr, family int32, flags int32) int32 { /* lookup_name.c:311:5: */
+ if __ccgo_strace {
+ trc("tls=%v buf=%v canon=%v name=%v family=%v flags=%v, (%v:)", tls, buf, canon, name, family, flags, origin(2))
+ }
bp := tls.Alloc(92)
defer tls.Free(92)
@@ -4043,6 +4133,9 @@ func X__lookup_name(tls *TLS, buf uintptr, canon uintptr, name uintptr, family i
}
func X__lookup_serv(tls *TLS, buf uintptr, name uintptr, proto int32, socktype int32, flags int32) int32 { /* lookup_serv.c:12:5: */
+ if __ccgo_strace {
+ trc("tls=%v buf=%v name=%v proto=%v socktype=%v flags=%v, (%v:)", tls, buf, name, proto, socktype, flags, origin(2))
+ }
bp := tls.Alloc(8)
defer tls.Free(8)
@@ -4168,6 +4261,9 @@ func X__lookup_serv(tls *TLS, buf uintptr, name uintptr, proto int32, socktype i
}
func X__toread(tls *TLS, f uintptr) int32 { /* __toread.c:3:5: */
+ if __ccgo_strace {
+ trc("tls=%v f=%v, (%v:)", tls, f, origin(2))
+ }
*(*int32)(unsafe.Pointer(f + 136)) |= (*FILE1)(unsafe.Pointer(f)).Fmode - 1
if (*FILE1)(unsafe.Pointer(f)).Fwpos != (*FILE1)(unsafe.Pointer(f)).Fwbase {
(*struct {
@@ -4187,6 +4283,9 @@ func X__toread(tls *TLS, f uintptr) int32 { /* __toread.c:3:5: */
}
func X__toread_needs_stdio_exit(tls *TLS) { /* __toread.c:16:13: */
+ if __ccgo_strace {
+ trc("tls=%v, (%v:)", tls, origin(2))
+ }
X__builtin_abort(tls) //TODO-
// __stdio_exit_needed();
}
@@ -4195,6 +4294,9 @@ func X__toread_needs_stdio_exit(tls *TLS) { /* __toread.c:16:13: */
// data buffered for reading.
func X__uflow(tls *TLS, f uintptr) int32 { /* __uflow.c:6:5: */
+ if __ccgo_strace {
+ trc("tls=%v f=%v, (%v:)", tls, f, origin(2))
+ }
bp := tls.Alloc(1)
defer tls.Free(1)
@@ -4209,6 +4311,9 @@ func X__uflow(tls *TLS, f uintptr) int32 { /* __uflow.c:6:5: */
}
func Xbsearch(tls *TLS, key uintptr, base uintptr, nel size_t, width size_t, cmp uintptr) uintptr { /* bsearch.c:3:6: */
+ if __ccgo_strace {
+ trc("tls=%v key=%v base=%v nel=%v width=%v cmp=%v, (%v:)", tls, key, base, nel, width, cmp, origin(2))
+ }
var try uintptr
var sign int32
for nel > uint64(0) {
@@ -4251,14 +4356,23 @@ func strtox(tls *TLS, s uintptr, p uintptr, prec int32) float64 { /* strtod.c:6:
}
func Xstrtof(tls *TLS, s uintptr, p uintptr) float32 { /* strtod.c:17:7: */
+ if __ccgo_strace {
+ trc("tls=%v s=%v p=%v, (%v:)", tls, s, p, origin(2))
+ }
return float32(strtox(tls, s, p, 0))
}
func Xstrtod(tls *TLS, s uintptr, p uintptr) float64 { /* strtod.c:22:8: */
+ if __ccgo_strace {
+ trc("tls=%v s=%v p=%v, (%v:)", tls, s, p, origin(2))
+ }
return strtox(tls, s, p, 1)
}
func Xstrtold(tls *TLS, s uintptr, p uintptr) float64 { /* strtod.c:27:13: */
+ if __ccgo_strace {
+ trc("tls=%v s=%v p=%v, (%v:)", tls, s, p, origin(2))
+ }
return strtox(tls, s, p, 2)
}
@@ -4280,30 +4394,51 @@ func strtox1(tls *TLS, s uintptr, p uintptr, base int32, lim uint64) uint64 { /*
}
func Xstrtoull(tls *TLS, s uintptr, p uintptr, base int32) uint64 { /* strtol.c:21:20: */
+ if __ccgo_strace {
+ trc("tls=%v s=%v p=%v base=%v, (%v:)", tls, s, p, base, origin(2))
+ }
return strtox1(tls, s, p, base, 2*uint64(0x7fffffffffffffff)+uint64(1))
}
func Xstrtoll(tls *TLS, s uintptr, p uintptr, base int32) int64 { /* strtol.c:26:11: */
+ if __ccgo_strace {
+ trc("tls=%v s=%v p=%v base=%v, (%v:)", tls, s, p, base, origin(2))
+ }
return int64(strtox1(tls, s, p, base, Uint64FromInt64(-0x7fffffffffffffff-int64(1))))
}
func Xstrtoul(tls *TLS, s uintptr, p uintptr, base int32) uint64 { /* strtol.c:31:15: */
+ if __ccgo_strace {
+ trc("tls=%v s=%v p=%v base=%v, (%v:)", tls, s, p, base, origin(2))
+ }
return uint64(strtox1(tls, s, p, base, 2*uint64(0x7fffffffffffffff)+uint64(1)))
}
func Xstrtol(tls *TLS, s uintptr, p uintptr, base int32) int64 { /* strtol.c:36:6: */
+ if __ccgo_strace {
+ trc("tls=%v s=%v p=%v base=%v, (%v:)", tls, s, p, base, origin(2))
+ }
return int64(strtox1(tls, s, p, base, 0+Uint64FromInt64(Int64(-Int64(0x7fffffffffffffff))-Int64FromInt32(1))))
}
func Xstrtoimax(tls *TLS, s uintptr, p uintptr, base int32) intmax_t { /* strtol.c:41:10: */
+ if __ccgo_strace {
+ trc("tls=%v s=%v p=%v base=%v, (%v:)", tls, s, p, base, origin(2))
+ }
return intmax_t(Xstrtoll(tls, s, p, base))
}
func Xstrtoumax(tls *TLS, s uintptr, p uintptr, base int32) uintmax_t { /* strtol.c:46:11: */
+ if __ccgo_strace {
+ trc("tls=%v s=%v p=%v base=%v, (%v:)", tls, s, p, base, origin(2))
+ }
return uintmax_t(Xstrtoull(tls, s, p, base))
}
func Xstrdup(tls *TLS, s uintptr) uintptr { /* strdup.c:4:6: */
+ if __ccgo_strace {
+ trc("tls=%v s=%v, (%v:)", tls, s, origin(2))
+ }
var l size_t = Xstrlen(tls, s)
var d uintptr = Xmalloc(tls, l+uint64(1))
if !(d != 0) {
@@ -4313,6 +4448,9 @@ func Xstrdup(tls *TLS, s uintptr) uintptr { /* strdup.c:4:6: */
}
func Xstrnlen(tls *TLS, s uintptr, n size_t) size_t { /* strnlen.c:3:8: */
+ if __ccgo_strace {
+ trc("tls=%v s=%v n=%v, (%v:)", tls, s, n, origin(2))
+ }
var p uintptr = Xmemchr(tls, s, 0, n)
if p != 0 {
return uint64((int64(p) - int64(s)) / 1)
@@ -4321,6 +4459,9 @@ func Xstrnlen(tls *TLS, s uintptr, n size_t) size_t { /* strnlen.c:3:8: */
}
func Xstrspn(tls *TLS, s uintptr, c uintptr) size_t { /* strspn.c:6:8: */
+ if __ccgo_strace {
+ trc("tls=%v s=%v c=%v, (%v:)", tls, s, c, origin(2))
+ }
bp := tls.Alloc(32)
defer tls.Free(32)
diff --git a/vendor/modernc.org/libc/musl_netbsd_arm.go b/vendor/modernc.org/libc/musl_netbsd_arm.go
index 5eea7fb2..cf5de9c8 100644
--- a/vendor/modernc.org/libc/musl_netbsd_arm.go
+++ b/vendor/modernc.org/libc/musl_netbsd_arm.go
@@ -854,6 +854,9 @@ func __isspace(tls *TLS, _c int32) int32 { /* ctype.h:26:21: */
type locale_t1 = uintptr /* alltypes.h:336:32 */
func Xisalnum(tls *TLS, c int32) int32 { /* isalnum.c:3:5: */
+ if __ccgo_strace {
+ trc("tls=%v c=%v, (%v:)", tls, c, origin(2))
+ }
return Bool32(func() int32 {
if 0 != 0 {
return Xisalpha(tls, c)
@@ -868,30 +871,51 @@ func Xisalnum(tls *TLS, c int32) int32 { /* isalnum.c:3:5: */
}
func X__isalnum_l(tls *TLS, c int32, l locale_t1) int32 { /* isalnum.c:8:5: */
+ if __ccgo_strace {
+ trc("tls=%v c=%v l=%v, (%v:)", tls, c, l, origin(2))
+ }
return Xisalnum(tls, c)
}
func Xisalpha(tls *TLS, c int32) int32 { /* isalpha.c:4:5: */
+ if __ccgo_strace {
+ trc("tls=%v c=%v, (%v:)", tls, c, origin(2))
+ }
return Bool32(uint32(c)|uint32(32)-uint32('a') < uint32(26))
}
func X__isalpha_l(tls *TLS, c int32, l locale_t1) int32 { /* isalpha.c:9:5: */
+ if __ccgo_strace {
+ trc("tls=%v c=%v l=%v, (%v:)", tls, c, l, origin(2))
+ }
return Xisalpha(tls, c)
}
func Xisdigit(tls *TLS, c int32) int32 { /* isdigit.c:4:5: */
+ if __ccgo_strace {
+ trc("tls=%v c=%v, (%v:)", tls, c, origin(2))
+ }
return Bool32(uint32(c)-uint32('0') < uint32(10))
}
func X__isdigit_l(tls *TLS, c int32, l locale_t1) int32 { /* isdigit.c:9:5: */
+ if __ccgo_strace {
+ trc("tls=%v c=%v l=%v, (%v:)", tls, c, l, origin(2))
+ }
return Xisdigit(tls, c)
}
func Xisprint(tls *TLS, c int32) int32 { /* isprint.c:4:5: */
+ if __ccgo_strace {
+ trc("tls=%v c=%v, (%v:)", tls, c, origin(2))
+ }
return Bool32(uint32(c)-uint32(0x20) < uint32(0x5f))
}
func X__isprint_l(tls *TLS, c int32, l locale_t1) int32 { /* isprint.c:9:5: */
+ if __ccgo_strace {
+ trc("tls=%v c=%v l=%v, (%v:)", tls, c, l, origin(2))
+ }
return Xisprint(tls, c)
}
@@ -1611,6 +1635,9 @@ func hexfloat(tls *TLS, f uintptr, bits int32, emin int32, sign int32, pok int32
}
func X__floatscan(tls *TLS, f uintptr, prec int32, pok int32) float64 { /* floatscan.c:427:13: */
+ if __ccgo_strace {
+ trc("tls=%v f=%v prec=%v pok=%v, (%v:)", tls, f, prec, pok, origin(2))
+ }
var sign int32 = 1
var i size_t
var bits int32
@@ -1788,6 +1815,9 @@ var table = [257]uint8{Uint8FromInt32(-1),
} /* intscan.c:7:28 */
func X__intscan(tls *TLS, f uintptr, base uint32, pok int32, lim uint64) uint64 { /* intscan.c:26:20: */
+ if __ccgo_strace {
+ trc("tls=%v f=%v base=%v pok=%v lim=%v, (%v:)", tls, f, base, pok, lim, origin(2))
+ }
var val uintptr
var c int32
var neg int32
@@ -2093,6 +2123,9 @@ __43:
// the actual count.
func X__shlim(tls *TLS, f uintptr, lim off_t1) { /* shgetc.c:8:6: */
+ if __ccgo_strace {
+ trc("tls=%v f=%v lim=%v, (%v:)", tls, f, lim, origin(2))
+ }
(*FILE1)(unsafe.Pointer(f)).Fshlim = lim
(*FILE1)(unsafe.Pointer(f)).Fshcnt = off_t1((int32((*FILE1)(unsafe.Pointer(f)).Fbuf) - int32((*FILE1)(unsafe.Pointer(f)).Frpos)) / 1)
// If lim is nonzero, rend must be a valid pointer.
@@ -2104,6 +2137,9 @@ func X__shlim(tls *TLS, f uintptr, lim off_t1) { /* shgetc.c:8:6: */
}
func X__shgetc(tls *TLS, f uintptr) int32 { /* shgetc.c:19:5: */
+ if __ccgo_strace {
+ trc("tls=%v f=%v, (%v:)", tls, f, origin(2))
+ }
var c int32
var cnt off_t1 = (*FILE1)(unsafe.Pointer(f)).Fshcnt + off_t1((int32((*FILE1)(unsafe.Pointer(f)).Frpos)-int32((*FILE1)(unsafe.Pointer(f)).Fbuf))/1)
if (*FILE1)(unsafe.Pointer(f)).Fshlim != 0 && cnt >= (*FILE1)(unsafe.Pointer(f)).Fshlim || AssignInt32(&c, X__uflow(tls, f)) < 0 {
@@ -2130,20 +2166,32 @@ func __bswap32(tls *TLS, __x uint32_t) uint32_t { /* endian.h:24:26: */
}
func Xcopysignl(tls *TLS, x float64, y float64) float64 { /* copysignl.c:4:13: */
+ if __ccgo_strace {
+ trc("tls=%v x=%v y=%v, (%v:)", tls, x, y, origin(2))
+ }
return Xcopysign(tls, x, y)
}
func Xfabsl(tls *TLS, x float64) float64 { /* fabsl.c:3:13: */
+ if __ccgo_strace {
+ trc("tls=%v x=%v, (%v:)", tls, x, origin(2))
+ }
return Xfabs(tls, x)
}
func Xfmodl(tls *TLS, x float64, y float64) float64 { /* fmodl.c:4:13: */
+ if __ccgo_strace {
+ trc("tls=%v x=%v y=%v, (%v:)", tls, x, y, origin(2))
+ }
return Xfmod(tls, x, y)
}
var toint double_t = float64(float64(1)) / 2.22044604925031308085e-16 /* rint.c:10:23 */
func Xrint(tls *TLS, x float64) float64 { /* rint.c:12:8: */
+ if __ccgo_strace {
+ trc("tls=%v x=%v, (%v:)", tls, x, origin(2))
+ }
bp := tls.Alloc(8)
defer tls.Free(8)
@@ -2173,6 +2221,9 @@ func Xrint(tls *TLS, x float64) float64 { /* rint.c:12:8: */
}
func Xscalbn(tls *TLS, x float64, n int32) float64 { /* scalbn.c:4:8: */
+ if __ccgo_strace {
+ trc("tls=%v x=%v n=%v, (%v:)", tls, x, n, origin(2))
+ }
bp := tls.Alloc(8)
defer tls.Free(8)
@@ -2209,6 +2260,9 @@ func Xscalbn(tls *TLS, x float64, n int32) float64 { /* scalbn.c:4:8: */
}
func Xscalbnl(tls *TLS, x float64, n int32) float64 { /* scalbnl.c:4:13: */
+ if __ccgo_strace {
+ trc("tls=%v x=%v n=%v, (%v:)", tls, x, n, origin(2))
+ }
return Xscalbn(tls, x, n)
}
@@ -2527,6 +2581,9 @@ type resolvconf = struct {
} /* lookup.h:34:1 */
func Xfreeaddrinfo(tls *TLS, p uintptr) { /* freeaddrinfo.c:7:6: */
+ if __ccgo_strace {
+ trc("tls=%v p=%v, (%v:)", tls, p, origin(2))
+ }
var cnt size_t
cnt = size_t(1)
__1:
@@ -2637,6 +2694,9 @@ type __ptcb = struct {
type useconds_t = uint32 /* alltypes.h:253:18 */
func Xgetaddrinfo(tls *TLS, host uintptr, serv uintptr, hint uintptr, res uintptr) int32 { /* getaddrinfo.c:12:5: */
+ if __ccgo_strace {
+ trc("tls=%v host=%v serv=%v hint=%v res=%v, (%v:)", tls, host, serv, hint, res, origin(2))
+ }
bp := tls.Alloc(1608)
defer tls.Free(1608)
@@ -2836,6 +2896,9 @@ type mmsghdr = struct {
} /* socket.h:63:1 */
func Xgethostbyaddr(tls *TLS, a uintptr, l socklen_t, af int32) uintptr { /* gethostbyaddr.c:7:16: */
+ if __ccgo_strace {
+ trc("tls=%v a=%v l=%v af=%v, (%v:)", tls, a, l, af, origin(2))
+ }
bp := tls.Alloc(4)
defer tls.Free(4)
@@ -2862,10 +2925,16 @@ func Xgethostbyaddr(tls *TLS, a uintptr, l socklen_t, af int32) uintptr { /* get
var _sh uintptr /* gethostbyaddr.c:9:24: */
func Xgethostbyname(tls *TLS, name uintptr) uintptr { /* gethostbyname.c:8:16: */
+ if __ccgo_strace {
+ trc("tls=%v name=%v, (%v:)", tls, name, origin(2))
+ }
return Xgethostbyname2(tls, name, 2)
}
func Xgethostbyname2(tls *TLS, name uintptr, af int32) uintptr { /* gethostbyname2.c:8:16: */
+ if __ccgo_strace {
+ trc("tls=%v name=%v af=%v, (%v:)", tls, name, af, origin(2))
+ }
bp := tls.Alloc(4)
defer tls.Free(4)
@@ -2892,6 +2961,9 @@ func Xgethostbyname2(tls *TLS, name uintptr, af int32) uintptr { /* gethostbynam
var _sh1 uintptr /* gethostbyname2.c:10:24: */
func Xgethostbyname2_r(tls *TLS, name uintptr, af int32, h uintptr, buf uintptr, buflen size_t, res uintptr, err uintptr) int32 { /* gethostbyname2_r.c:11:5: */
+ if __ccgo_strace {
+ trc("tls=%v name=%v af=%v h=%v buf=%v buflen=%v res=%v err=%v, (%v:)", tls, name, af, h, buf, buflen, res, err, origin(2))
+ }
bp := tls.Alloc(1600)
defer tls.Free(1600)
@@ -3270,10 +3342,16 @@ func reverse_services(tls *TLS, buf uintptr, port int32, dgram int32) { /* getna
var Xh_errno int32 /* h_errno.c:4:5: */
func X__h_errno_location(tls *TLS) uintptr { /* h_errno.c:6:5: */
+ if __ccgo_strace {
+ trc("tls=%v, (%v:)", tls, origin(2))
+ }
return uintptr(unsafe.Pointer(&Xh_errno))
}
func X__inet_aton(tls *TLS, s0 uintptr, dest uintptr) int32 { /* inet_aton.c:7:5: */
+ if __ccgo_strace {
+ trc("tls=%v s0=%v dest=%v, (%v:)", tls, s0, dest, origin(2))
+ }
bp := tls.Alloc(20)
defer tls.Free(20)
@@ -3325,6 +3403,9 @@ func X__inet_aton(tls *TLS, s0 uintptr, dest uintptr) int32 { /* inet_aton.c:7:5
}
func Xinet_ntop(tls *TLS, af int32, a0 uintptr, s uintptr, l socklen_t) uintptr { /* inet_ntop.c:7:12: */
+ if __ccgo_strace {
+ trc("tls=%v af=%v a0=%v s=%v l=%v, (%v:)", tls, af, a0, s, l, origin(2))
+ }
bp := tls.Alloc(276)
defer tls.Free(276)
@@ -3399,6 +3480,9 @@ func hexval(tls *TLS, c uint32) int32 { /* inet_pton.c:7:12: */
}
func Xinet_pton(tls *TLS, af int32, s uintptr, a0 uintptr) int32 { /* inet_pton.c:15:5: */
+ if __ccgo_strace {
+ trc("tls=%v af=%v s=%v a0=%v, (%v:)", tls, af, s, a0, origin(2))
+ }
bp := tls.Alloc(16)
defer tls.Free(16)
@@ -3496,6 +3580,9 @@ func Xinet_pton(tls *TLS, af int32, s uintptr, a0 uintptr) int32 { /* inet_pton.
}
func X__lookup_ipliteral(tls *TLS, buf uintptr, name uintptr, family int32) int32 { /* lookup_ipliteral.c:12:5: */
+ if __ccgo_strace {
+ trc("tls=%v buf=%v name=%v family=%v, (%v:)", tls, buf, name, family, origin(2))
+ }
bp := tls.Alloc(88)
defer tls.Free(88)
@@ -3817,6 +3904,9 @@ func addrcmp(tls *TLS, _a uintptr, _b uintptr) int32 { /* lookup_name.c:305:12:
}
func X__lookup_name(tls *TLS, buf uintptr, canon uintptr, name uintptr, family int32, flags int32) int32 { /* lookup_name.c:311:5: */
+ if __ccgo_strace {
+ trc("tls=%v buf=%v canon=%v name=%v family=%v flags=%v, (%v:)", tls, buf, canon, name, family, flags, origin(2))
+ }
bp := tls.Alloc(92)
defer tls.Free(92)
@@ -3983,6 +4073,9 @@ func X__lookup_name(tls *TLS, buf uintptr, canon uintptr, name uintptr, family i
}
func X__lookup_serv(tls *TLS, buf uintptr, name uintptr, proto int32, socktype int32, flags int32) int32 { /* lookup_serv.c:12:5: */
+ if __ccgo_strace {
+ trc("tls=%v buf=%v name=%v proto=%v socktype=%v flags=%v, (%v:)", tls, buf, name, proto, socktype, flags, origin(2))
+ }
bp := tls.Alloc(4)
defer tls.Free(4)
@@ -4108,6 +4201,9 @@ func X__lookup_serv(tls *TLS, buf uintptr, name uintptr, proto int32, socktype i
}
func X__toread(tls *TLS, f uintptr) int32 { /* __toread.c:3:5: */
+ if __ccgo_strace {
+ trc("tls=%v f=%v, (%v:)", tls, f, origin(2))
+ }
*(*int32)(unsafe.Pointer(f + 72)) |= (*FILE1)(unsafe.Pointer(f)).Fmode - 1
if (*FILE1)(unsafe.Pointer(f)).Fwpos != (*FILE1)(unsafe.Pointer(f)).Fwbase {
(*struct {
@@ -4127,6 +4223,9 @@ func X__toread(tls *TLS, f uintptr) int32 { /* __toread.c:3:5: */
}
func X__toread_needs_stdio_exit(tls *TLS) { /* __toread.c:16:13: */
+ if __ccgo_strace {
+ trc("tls=%v, (%v:)", tls, origin(2))
+ }
X__builtin_abort(tls) //TODO-
// __stdio_exit_needed();
}
@@ -4135,6 +4234,9 @@ func X__toread_needs_stdio_exit(tls *TLS) { /* __toread.c:16:13: */
// data buffered for reading.
func X__uflow(tls *TLS, f uintptr) int32 { /* __uflow.c:6:5: */
+ if __ccgo_strace {
+ trc("tls=%v f=%v, (%v:)", tls, f, origin(2))
+ }
bp := tls.Alloc(1)
defer tls.Free(1)
@@ -4149,6 +4251,9 @@ func X__uflow(tls *TLS, f uintptr) int32 { /* __uflow.c:6:5: */
}
func Xbsearch(tls *TLS, key uintptr, base uintptr, nel size_t, width size_t, cmp uintptr) uintptr { /* bsearch.c:3:6: */
+ if __ccgo_strace {
+ trc("tls=%v key=%v base=%v nel=%v width=%v cmp=%v, (%v:)", tls, key, base, nel, width, cmp, origin(2))
+ }
var try uintptr
var sign int32
for nel > size_t(0) {
@@ -4191,14 +4296,23 @@ func strtox(tls *TLS, s uintptr, p uintptr, prec int32) float64 { /* strtod.c:6:
}
func Xstrtof(tls *TLS, s uintptr, p uintptr) float32 { /* strtod.c:17:7: */
+ if __ccgo_strace {
+ trc("tls=%v s=%v p=%v, (%v:)", tls, s, p, origin(2))
+ }
return float32(strtox(tls, s, p, 0))
}
func Xstrtod(tls *TLS, s uintptr, p uintptr) float64 { /* strtod.c:22:8: */
+ if __ccgo_strace {
+ trc("tls=%v s=%v p=%v, (%v:)", tls, s, p, origin(2))
+ }
return strtox(tls, s, p, 1)
}
func Xstrtold(tls *TLS, s uintptr, p uintptr) float64 { /* strtod.c:27:13: */
+ if __ccgo_strace {
+ trc("tls=%v s=%v p=%v, (%v:)", tls, s, p, origin(2))
+ }
return strtox(tls, s, p, 2)
}
@@ -4220,30 +4334,51 @@ func strtox1(tls *TLS, s uintptr, p uintptr, base int32, lim uint64) uint64 { /*
}
func Xstrtoull(tls *TLS, s uintptr, p uintptr, base int32) uint64 { /* strtol.c:21:20: */
+ if __ccgo_strace {
+ trc("tls=%v s=%v p=%v base=%v, (%v:)", tls, s, p, base, origin(2))
+ }
return strtox1(tls, s, p, base, 2*uint64(0x7fffffffffffffff)+uint64(1))
}
func Xstrtoll(tls *TLS, s uintptr, p uintptr, base int32) int64 { /* strtol.c:26:11: */
+ if __ccgo_strace {
+ trc("tls=%v s=%v p=%v base=%v, (%v:)", tls, s, p, base, origin(2))
+ }
return int64(strtox1(tls, s, p, base, Uint64FromInt64(-0x7fffffffffffffff-int64(1))))
}
func Xstrtoul(tls *TLS, s uintptr, p uintptr, base int32) uint32 { /* strtol.c:31:15: */
+ if __ccgo_strace {
+ trc("tls=%v s=%v p=%v base=%v, (%v:)", tls, s, p, base, origin(2))
+ }
return uint32(strtox1(tls, s, p, base, uint64(2*uint32(0x7fffffff)+uint32(1))))
}
func Xstrtol(tls *TLS, s uintptr, p uintptr, base int32) int32 { /* strtol.c:36:6: */
+ if __ccgo_strace {
+ trc("tls=%v s=%v p=%v base=%v, (%v:)", tls, s, p, base, origin(2))
+ }
return int32(strtox1(tls, s, p, base, uint64(0+Uint32FromInt32(Int32(-Int32(0x7fffffff))-Int32FromInt32(1)))))
}
func Xstrtoimax(tls *TLS, s uintptr, p uintptr, base int32) intmax_t { /* strtol.c:41:10: */
+ if __ccgo_strace {
+ trc("tls=%v s=%v p=%v base=%v, (%v:)", tls, s, p, base, origin(2))
+ }
return Xstrtoll(tls, s, p, base)
}
func Xstrtoumax(tls *TLS, s uintptr, p uintptr, base int32) uintmax_t { /* strtol.c:46:11: */
+ if __ccgo_strace {
+ trc("tls=%v s=%v p=%v base=%v, (%v:)", tls, s, p, base, origin(2))
+ }
return Xstrtoull(tls, s, p, base)
}
func Xstrdup(tls *TLS, s uintptr) uintptr { /* strdup.c:4:6: */
+ if __ccgo_strace {
+ trc("tls=%v s=%v, (%v:)", tls, s, origin(2))
+ }
var l size_t = Xstrlen(tls, s)
var d uintptr = Xmalloc(tls, l+size_t(1))
if !(d != 0) {
@@ -4253,6 +4388,9 @@ func Xstrdup(tls *TLS, s uintptr) uintptr { /* strdup.c:4:6: */
}
func Xstrnlen(tls *TLS, s uintptr, n size_t) size_t { /* strnlen.c:3:8: */
+ if __ccgo_strace {
+ trc("tls=%v s=%v n=%v, (%v:)", tls, s, n, origin(2))
+ }
var p uintptr = Xmemchr(tls, s, 0, n)
if p != 0 {
return uint32((int32(p) - int32(s)) / 1)
@@ -4261,6 +4399,9 @@ func Xstrnlen(tls *TLS, s uintptr, n size_t) size_t { /* strnlen.c:3:8: */
}
func Xstrspn(tls *TLS, s uintptr, c uintptr) size_t { /* strspn.c:6:8: */
+ if __ccgo_strace {
+ trc("tls=%v s=%v c=%v, (%v:)", tls, s, c, origin(2))
+ }
bp := tls.Alloc(32)
defer tls.Free(32)
diff --git a/vendor/modernc.org/libc/musl_openbsd_386.go b/vendor/modernc.org/libc/musl_openbsd_386.go
index 3bc61739..edc3f1c4 100644
--- a/vendor/modernc.org/libc/musl_openbsd_386.go
+++ b/vendor/modernc.org/libc/musl_openbsd_386.go
@@ -501,6 +501,9 @@ type wchar_t = int32 /* :15:24 */
// extern __inline __attribute__((__gnu_inline__))
func Xisblank(tls *TLS, _c int32) int32 { /* ctype_.c:144:5: */
+ if __ccgo_strace {
+ trc("tls=%v _c=%v, (%v:)", tls, _c, origin(2))
+ }
return Bool32(_c == ' ' || _c == '\t')
}
@@ -681,6 +684,9 @@ func __isspace(tls *TLS, _c int32) int32 { /* ctype.h:26:21: */
type locale_t = uintptr /* alltypes.h:366:32 */
func Xisalnum(tls *TLS, c int32) int32 { /* isalnum.c:3:5: */
+ if __ccgo_strace {
+ trc("tls=%v c=%v, (%v:)", tls, c, origin(2))
+ }
return Bool32(func() int32 {
if 0 != 0 {
return Xisalpha(tls, c)
@@ -695,58 +701,100 @@ func Xisalnum(tls *TLS, c int32) int32 { /* isalnum.c:3:5: */
}
func X__isalnum_l(tls *TLS, c int32, l locale_t) int32 { /* isalnum.c:8:5: */
+ if __ccgo_strace {
+ trc("tls=%v c=%v l=%v, (%v:)", tls, c, l, origin(2))
+ }
return Xisalnum(tls, c)
}
func Xisalpha(tls *TLS, c int32) int32 { /* isalpha.c:4:5: */
+ if __ccgo_strace {
+ trc("tls=%v c=%v, (%v:)", tls, c, origin(2))
+ }
return Bool32(uint32(c)|uint32(32)-uint32('a') < uint32(26))
}
func X__isalpha_l(tls *TLS, c int32, l locale_t) int32 { /* isalpha.c:9:5: */
+ if __ccgo_strace {
+ trc("tls=%v c=%v l=%v, (%v:)", tls, c, l, origin(2))
+ }
return Xisalpha(tls, c)
}
func Xisdigit(tls *TLS, c int32) int32 { /* isdigit.c:4:5: */
+ if __ccgo_strace {
+ trc("tls=%v c=%v, (%v:)", tls, c, origin(2))
+ }
return Bool32(uint32(c)-uint32('0') < uint32(10))
}
func X__isdigit_l(tls *TLS, c int32, l locale_t) int32 { /* isdigit.c:9:5: */
+ if __ccgo_strace {
+ trc("tls=%v c=%v l=%v, (%v:)", tls, c, l, origin(2))
+ }
return Xisdigit(tls, c)
}
func Xislower(tls *TLS, c int32) int32 { /* islower.c:4:5: */
+ if __ccgo_strace {
+ trc("tls=%v c=%v, (%v:)", tls, c, origin(2))
+ }
return Bool32(uint32(c)-uint32('a') < uint32(26))
}
func X__islower_l(tls *TLS, c int32, l locale_t) int32 { /* islower.c:9:5: */
+ if __ccgo_strace {
+ trc("tls=%v c=%v l=%v, (%v:)", tls, c, l, origin(2))
+ }
return Xislower(tls, c)
}
func Xisprint(tls *TLS, c int32) int32 { /* isprint.c:4:5: */
+ if __ccgo_strace {
+ trc("tls=%v c=%v, (%v:)", tls, c, origin(2))
+ }
return Bool32(uint32(c)-uint32(0x20) < uint32(0x5f))
}
func X__isprint_l(tls *TLS, c int32, l locale_t) int32 { /* isprint.c:9:5: */
+ if __ccgo_strace {
+ trc("tls=%v c=%v l=%v, (%v:)", tls, c, l, origin(2))
+ }
return Xisprint(tls, c)
}
func Xisspace(tls *TLS, c int32) int32 { /* isspace.c:4:5: */
+ if __ccgo_strace {
+ trc("tls=%v c=%v, (%v:)", tls, c, origin(2))
+ }
return Bool32(c == ' ' || uint32(c)-uint32('\t') < uint32(5))
}
func X__isspace_l(tls *TLS, c int32, l locale_t) int32 { /* isspace.c:9:5: */
+ if __ccgo_strace {
+ trc("tls=%v c=%v l=%v, (%v:)", tls, c, l, origin(2))
+ }
return Xisspace(tls, c)
}
func Xisupper(tls *TLS, c int32) int32 { /* isupper.c:4:5: */
+ if __ccgo_strace {
+ trc("tls=%v c=%v, (%v:)", tls, c, origin(2))
+ }
return Bool32(uint32(c)-uint32('A') < uint32(26))
}
func X__isupper_l(tls *TLS, c int32, l locale_t) int32 { /* isupper.c:9:5: */
+ if __ccgo_strace {
+ trc("tls=%v c=%v l=%v, (%v:)", tls, c, l, origin(2))
+ }
return Xisupper(tls, c)
}
func Xisxdigit(tls *TLS, c int32) int32 { /* isxdigit.c:3:5: */
+ if __ccgo_strace {
+ trc("tls=%v c=%v, (%v:)", tls, c, origin(2))
+ }
return Bool32(func() int32 {
if 0 != 0 {
return Xisdigit(tls, c)
@@ -756,6 +804,9 @@ func Xisxdigit(tls *TLS, c int32) int32 { /* isxdigit.c:3:5: */
}
func X__isxdigit_l(tls *TLS, c int32, l locale_t) int32 { /* isxdigit.c:8:5: */
+ if __ccgo_strace {
+ trc("tls=%v c=%v l=%v, (%v:)", tls, c, l, origin(2))
+ }
return Xisxdigit(tls, c)
}
@@ -1475,6 +1526,9 @@ func hexfloat(tls *TLS, f uintptr, bits int32, emin int32, sign int32, pok int32
}
func X__floatscan(tls *TLS, f uintptr, prec int32, pok int32) float64 { /* floatscan.c:427:13: */
+ if __ccgo_strace {
+ trc("tls=%v f=%v prec=%v pok=%v, (%v:)", tls, f, prec, pok, origin(2))
+ }
var sign int32 = 1
var i size_t
var bits int32
@@ -1652,6 +1706,9 @@ var table = [257]uint8{Uint8FromInt32(-1),
} /* intscan.c:7:28 */
func X__intscan(tls *TLS, f uintptr, base uint32, pok int32, lim uint64) uint64 { /* intscan.c:26:20: */
+ if __ccgo_strace {
+ trc("tls=%v f=%v base=%v pok=%v lim=%v, (%v:)", tls, f, base, pok, lim, origin(2))
+ }
var val uintptr
var c int32
var neg int32
@@ -1957,6 +2014,9 @@ __43:
// the actual count.
func X__shlim(tls *TLS, f uintptr, lim off_t) { /* shgetc.c:8:6: */
+ if __ccgo_strace {
+ trc("tls=%v f=%v lim=%v, (%v:)", tls, f, lim, origin(2))
+ }
(*FILE)(unsafe.Pointer(f)).Fshlim = lim
(*FILE)(unsafe.Pointer(f)).Fshcnt = off_t((int32((*FILE)(unsafe.Pointer(f)).Fbuf) - int32((*FILE)(unsafe.Pointer(f)).Frpos)) / 1)
// If lim is nonzero, rend must be a valid pointer.
@@ -1968,6 +2028,9 @@ func X__shlim(tls *TLS, f uintptr, lim off_t) { /* shgetc.c:8:6: */
}
func X__shgetc(tls *TLS, f uintptr) int32 { /* shgetc.c:19:5: */
+ if __ccgo_strace {
+ trc("tls=%v f=%v, (%v:)", tls, f, origin(2))
+ }
var c int32
var cnt off_t = (*FILE)(unsafe.Pointer(f)).Fshcnt + off_t((int32((*FILE)(unsafe.Pointer(f)).Frpos)-int32((*FILE)(unsafe.Pointer(f)).Fbuf))/1)
if (*FILE)(unsafe.Pointer(f)).Fshlim != 0 && cnt >= (*FILE)(unsafe.Pointer(f)).Fshlim || AssignInt32(&c, X__uflow(tls, f)) < 0 {
@@ -1994,20 +2057,32 @@ func __bswap32(tls *TLS, __x uint32_t) uint32_t { /* endian.h:24:26: */
}
func Xcopysignl(tls *TLS, x float64, y float64) float64 { /* copysignl.c:4:13: */
+ if __ccgo_strace {
+ trc("tls=%v x=%v y=%v, (%v:)", tls, x, y, origin(2))
+ }
return Xcopysign(tls, x, y)
}
func Xfabsl(tls *TLS, x float64) float64 { /* fabsl.c:3:13: */
+ if __ccgo_strace {
+ trc("tls=%v x=%v, (%v:)", tls, x, origin(2))
+ }
return Xfabs(tls, x)
}
func Xfmodl(tls *TLS, x float64, y float64) float64 { /* fmodl.c:4:13: */
+ if __ccgo_strace {
+ trc("tls=%v x=%v y=%v, (%v:)", tls, x, y, origin(2))
+ }
return Xfmod(tls, x, y)
}
var toint double_t = float64(float64(1)) / 2.22044604925031308085e-16 /* rint.c:10:23 */
func Xrint(tls *TLS, x float64) float64 { /* rint.c:12:8: */
+ if __ccgo_strace {
+ trc("tls=%v x=%v, (%v:)", tls, x, origin(2))
+ }
bp := tls.Alloc(8)
defer tls.Free(8)
@@ -2037,6 +2112,9 @@ func Xrint(tls *TLS, x float64) float64 { /* rint.c:12:8: */
}
func Xscalbn(tls *TLS, x float64, n int32) float64 { /* scalbn.c:4:8: */
+ if __ccgo_strace {
+ trc("tls=%v x=%v n=%v, (%v:)", tls, x, n, origin(2))
+ }
bp := tls.Alloc(8)
defer tls.Free(8)
@@ -2073,6 +2151,9 @@ func Xscalbn(tls *TLS, x float64, n int32) float64 { /* scalbn.c:4:8: */
}
func Xscalbnl(tls *TLS, x float64, n int32) float64 { /* scalbnl.c:4:13: */
+ if __ccgo_strace {
+ trc("tls=%v x=%v n=%v, (%v:)", tls, x, n, origin(2))
+ }
return Xscalbn(tls, x, n)
}
@@ -2391,6 +2472,9 @@ type resolvconf = struct {
} /* lookup.h:34:1 */
func Xfreeaddrinfo(tls *TLS, p uintptr) { /* freeaddrinfo.c:7:6: */
+ if __ccgo_strace {
+ trc("tls=%v p=%v, (%v:)", tls, p, origin(2))
+ }
var cnt size_t
cnt = size_t(1)
__1:
@@ -2501,6 +2585,9 @@ type __ptcb = struct {
type useconds_t = uint32 /* alltypes.h:283:18 */
func Xgetaddrinfo(tls *TLS, host uintptr, serv uintptr, hint uintptr, res uintptr) int32 { /* getaddrinfo.c:12:5: */
+ if __ccgo_strace {
+ trc("tls=%v host=%v serv=%v hint=%v res=%v, (%v:)", tls, host, serv, hint, res, origin(2))
+ }
bp := tls.Alloc(1608)
defer tls.Free(1608)
@@ -2700,6 +2787,9 @@ type mmsghdr = struct {
} /* socket.h:63:1 */
func Xgethostbyaddr(tls *TLS, a uintptr, l socklen_t, af int32) uintptr { /* gethostbyaddr.c:7:16: */
+ if __ccgo_strace {
+ trc("tls=%v a=%v l=%v af=%v, (%v:)", tls, a, l, af, origin(2))
+ }
bp := tls.Alloc(4)
defer tls.Free(4)
@@ -2726,10 +2816,16 @@ func Xgethostbyaddr(tls *TLS, a uintptr, l socklen_t, af int32) uintptr { /* get
var _sh uintptr /* gethostbyaddr.c:9:24: */
func Xgethostbyname(tls *TLS, name uintptr) uintptr { /* gethostbyname.c:8:16: */
+ if __ccgo_strace {
+ trc("tls=%v name=%v, (%v:)", tls, name, origin(2))
+ }
return Xgethostbyname2(tls, name, 2)
}
func Xgethostbyname2(tls *TLS, name uintptr, af int32) uintptr { /* gethostbyname2.c:8:16: */
+ if __ccgo_strace {
+ trc("tls=%v name=%v af=%v, (%v:)", tls, name, af, origin(2))
+ }
bp := tls.Alloc(4)
defer tls.Free(4)
@@ -2756,6 +2852,9 @@ func Xgethostbyname2(tls *TLS, name uintptr, af int32) uintptr { /* gethostbynam
var _sh1 uintptr /* gethostbyname2.c:10:24: */
func Xgethostbyname2_r(tls *TLS, name uintptr, af int32, h uintptr, buf uintptr, buflen size_t, res uintptr, err uintptr) int32 { /* gethostbyname2_r.c:11:5: */
+ if __ccgo_strace {
+ trc("tls=%v name=%v af=%v h=%v buf=%v buflen=%v res=%v err=%v, (%v:)", tls, name, af, h, buf, buflen, res, err, origin(2))
+ }
bp := tls.Alloc(1600)
defer tls.Free(1600)
@@ -3134,10 +3233,16 @@ func reverse_services(tls *TLS, buf uintptr, port int32, dgram int32) { /* getna
var Xh_errno int32 /* h_errno.c:4:5: */
func X__h_errno_location(tls *TLS) uintptr { /* h_errno.c:6:5: */
+ if __ccgo_strace {
+ trc("tls=%v, (%v:)", tls, origin(2))
+ }
return uintptr(unsafe.Pointer(&Xh_errno))
}
func X__inet_aton(tls *TLS, s0 uintptr, dest uintptr) int32 { /* inet_aton.c:7:5: */
+ if __ccgo_strace {
+ trc("tls=%v s0=%v dest=%v, (%v:)", tls, s0, dest, origin(2))
+ }
bp := tls.Alloc(20)
defer tls.Free(20)
@@ -3189,6 +3294,9 @@ func X__inet_aton(tls *TLS, s0 uintptr, dest uintptr) int32 { /* inet_aton.c:7:5
}
func Xinet_ntop(tls *TLS, af int32, a0 uintptr, s uintptr, l socklen_t) uintptr { /* inet_ntop.c:7:12: */
+ if __ccgo_strace {
+ trc("tls=%v af=%v a0=%v s=%v l=%v, (%v:)", tls, af, a0, s, l, origin(2))
+ }
bp := tls.Alloc(276)
defer tls.Free(276)
@@ -3263,6 +3371,9 @@ func hexval(tls *TLS, c uint32) int32 { /* inet_pton.c:7:12: */
}
func Xinet_pton(tls *TLS, af int32, s uintptr, a0 uintptr) int32 { /* inet_pton.c:15:5: */
+ if __ccgo_strace {
+ trc("tls=%v af=%v s=%v a0=%v, (%v:)", tls, af, s, a0, origin(2))
+ }
bp := tls.Alloc(16)
defer tls.Free(16)
@@ -3360,6 +3471,9 @@ func Xinet_pton(tls *TLS, af int32, s uintptr, a0 uintptr) int32 { /* inet_pton.
}
func X__lookup_ipliteral(tls *TLS, buf uintptr, name uintptr, family int32) int32 { /* lookup_ipliteral.c:12:5: */
+ if __ccgo_strace {
+ trc("tls=%v buf=%v name=%v family=%v, (%v:)", tls, buf, name, family, origin(2))
+ }
bp := tls.Alloc(88)
defer tls.Free(88)
@@ -3679,6 +3793,9 @@ func addrcmp(tls *TLS, _a uintptr, _b uintptr) int32 { /* lookup_name.c:305:12:
}
func X__lookup_name(tls *TLS, buf uintptr, canon uintptr, name uintptr, family int32, flags int32) int32 { /* lookup_name.c:311:5: */
+ if __ccgo_strace {
+ trc("tls=%v buf=%v canon=%v name=%v family=%v flags=%v, (%v:)", tls, buf, canon, name, family, flags, origin(2))
+ }
bp := tls.Alloc(92)
defer tls.Free(92)
@@ -3845,6 +3962,9 @@ func X__lookup_name(tls *TLS, buf uintptr, canon uintptr, name uintptr, family i
}
func X__lookup_serv(tls *TLS, buf uintptr, name uintptr, proto int32, socktype int32, flags int32) int32 { /* lookup_serv.c:12:5: */
+ if __ccgo_strace {
+ trc("tls=%v buf=%v name=%v proto=%v socktype=%v flags=%v, (%v:)", tls, buf, name, proto, socktype, flags, origin(2))
+ }
bp := tls.Alloc(4)
defer tls.Free(4)
@@ -3970,6 +4090,9 @@ func X__lookup_serv(tls *TLS, buf uintptr, name uintptr, proto int32, socktype i
}
func X__toread(tls *TLS, f uintptr) int32 { /* __toread.c:3:5: */
+ if __ccgo_strace {
+ trc("tls=%v f=%v, (%v:)", tls, f, origin(2))
+ }
*(*int32)(unsafe.Pointer(f + 72)) |= (*FILE)(unsafe.Pointer(f)).Fmode - 1
if (*FILE)(unsafe.Pointer(f)).Fwpos != (*FILE)(unsafe.Pointer(f)).Fwbase {
(*struct {
@@ -3989,6 +4112,9 @@ func X__toread(tls *TLS, f uintptr) int32 { /* __toread.c:3:5: */
}
func X__toread_needs_stdio_exit(tls *TLS) { /* __toread.c:16:13: */
+ if __ccgo_strace {
+ trc("tls=%v, (%v:)", tls, origin(2))
+ }
X__builtin_abort(tls) //TODO-
// __stdio_exit_needed();
}
@@ -3997,6 +4123,9 @@ func X__toread_needs_stdio_exit(tls *TLS) { /* __toread.c:16:13: */
// data buffered for reading.
func X__uflow(tls *TLS, f uintptr) int32 { /* __uflow.c:6:5: */
+ if __ccgo_strace {
+ trc("tls=%v f=%v, (%v:)", tls, f, origin(2))
+ }
bp := tls.Alloc(1)
defer tls.Free(1)
@@ -4011,6 +4140,9 @@ func X__uflow(tls *TLS, f uintptr) int32 { /* __uflow.c:6:5: */
}
func Xbsearch(tls *TLS, key uintptr, base uintptr, nel size_t, width size_t, cmp uintptr) uintptr { /* bsearch.c:3:6: */
+ if __ccgo_strace {
+ trc("tls=%v key=%v base=%v nel=%v width=%v cmp=%v, (%v:)", tls, key, base, nel, width, cmp, origin(2))
+ }
var try uintptr
var sign int32
for nel > size_t(0) {
@@ -4053,14 +4185,23 @@ func strtox(tls *TLS, s uintptr, p uintptr, prec int32) float64 { /* strtod.c:6:
}
func Xstrtof(tls *TLS, s uintptr, p uintptr) float32 { /* strtod.c:17:7: */
+ if __ccgo_strace {
+ trc("tls=%v s=%v p=%v, (%v:)", tls, s, p, origin(2))
+ }
return float32(strtox(tls, s, p, 0))
}
func Xstrtod(tls *TLS, s uintptr, p uintptr) float64 { /* strtod.c:22:8: */
+ if __ccgo_strace {
+ trc("tls=%v s=%v p=%v, (%v:)", tls, s, p, origin(2))
+ }
return strtox(tls, s, p, 1)
}
func Xstrtold(tls *TLS, s uintptr, p uintptr) float64 { /* strtod.c:27:13: */
+ if __ccgo_strace {
+ trc("tls=%v s=%v p=%v, (%v:)", tls, s, p, origin(2))
+ }
return strtox(tls, s, p, 2)
}
@@ -4082,30 +4223,51 @@ func strtox1(tls *TLS, s uintptr, p uintptr, base int32, lim uint64) uint64 { /*
}
func Xstrtoull(tls *TLS, s uintptr, p uintptr, base int32) uint64 { /* strtol.c:21:20: */
+ if __ccgo_strace {
+ trc("tls=%v s=%v p=%v base=%v, (%v:)", tls, s, p, base, origin(2))
+ }
return strtox1(tls, s, p, base, 2*uint64(0x7fffffffffffffff)+uint64(1))
}
func Xstrtoll(tls *TLS, s uintptr, p uintptr, base int32) int64 { /* strtol.c:26:11: */
+ if __ccgo_strace {
+ trc("tls=%v s=%v p=%v base=%v, (%v:)", tls, s, p, base, origin(2))
+ }
return int64(strtox1(tls, s, p, base, Uint64FromInt64(-0x7fffffffffffffff-int64(1))))
}
func Xstrtoul(tls *TLS, s uintptr, p uintptr, base int32) uint32 { /* strtol.c:31:15: */
+ if __ccgo_strace {
+ trc("tls=%v s=%v p=%v base=%v, (%v:)", tls, s, p, base, origin(2))
+ }
return uint32(strtox1(tls, s, p, base, uint64(2*uint32(0x7fffffff)+uint32(1))))
}
func Xstrtol(tls *TLS, s uintptr, p uintptr, base int32) int32 { /* strtol.c:36:6: */
+ if __ccgo_strace {
+ trc("tls=%v s=%v p=%v base=%v, (%v:)", tls, s, p, base, origin(2))
+ }
return int32(strtox1(tls, s, p, base, uint64(0+Uint32FromInt32(Int32(-Int32(0x7fffffff))-Int32FromInt32(1)))))
}
func Xstrtoimax(tls *TLS, s uintptr, p uintptr, base int32) intmax_t { /* strtol.c:41:10: */
+ if __ccgo_strace {
+ trc("tls=%v s=%v p=%v base=%v, (%v:)", tls, s, p, base, origin(2))
+ }
return Xstrtoll(tls, s, p, base)
}
func Xstrtoumax(tls *TLS, s uintptr, p uintptr, base int32) uintmax_t { /* strtol.c:46:11: */
+ if __ccgo_strace {
+ trc("tls=%v s=%v p=%v base=%v, (%v:)", tls, s, p, base, origin(2))
+ }
return Xstrtoull(tls, s, p, base)
}
func Xstrdup(tls *TLS, s uintptr) uintptr { /* strdup.c:4:6: */
+ if __ccgo_strace {
+ trc("tls=%v s=%v, (%v:)", tls, s, origin(2))
+ }
var l size_t = Xstrlen(tls, s)
var d uintptr = Xmalloc(tls, l+size_t(1))
if !(d != 0) {
@@ -4115,6 +4277,9 @@ func Xstrdup(tls *TLS, s uintptr) uintptr { /* strdup.c:4:6: */
}
func Xstrnlen(tls *TLS, s uintptr, n size_t) size_t { /* strnlen.c:3:8: */
+ if __ccgo_strace {
+ trc("tls=%v s=%v n=%v, (%v:)", tls, s, n, origin(2))
+ }
var p uintptr = Xmemchr(tls, s, 0, n)
if p != 0 {
return uint32((int32(p) - int32(s)) / 1)
@@ -4123,6 +4288,9 @@ func Xstrnlen(tls *TLS, s uintptr, n size_t) size_t { /* strnlen.c:3:8: */
}
func Xstrspn(tls *TLS, s uintptr, c uintptr) size_t { /* strspn.c:6:8: */
+ if __ccgo_strace {
+ trc("tls=%v s=%v c=%v, (%v:)", tls, s, c, origin(2))
+ }
bp := tls.Alloc(32)
defer tls.Free(32)
diff --git a/vendor/modernc.org/libc/musl_openbsd_amd64.go b/vendor/modernc.org/libc/musl_openbsd_amd64.go
index c0493349..c8abed68 100644
--- a/vendor/modernc.org/libc/musl_openbsd_amd64.go
+++ b/vendor/modernc.org/libc/musl_openbsd_amd64.go
@@ -501,6 +501,9 @@ type wchar_t = int32 /* :15:24 */
// extern __inline __attribute__((__gnu_inline__))
func Xisblank(tls *TLS, _c int32) int32 { /* ctype_.c:144:5: */
+ if __ccgo_strace {
+ trc("tls=%v _c=%v, (%v:)", tls, _c, origin(2))
+ }
return Bool32(_c == ' ' || _c == '\t')
}
@@ -681,6 +684,9 @@ func __isspace(tls *TLS, _c int32) int32 { /* ctype.h:26:21: */
type locale_t = uintptr /* alltypes.h:343:32 */
func Xisalnum(tls *TLS, c int32) int32 { /* isalnum.c:3:5: */
+ if __ccgo_strace {
+ trc("tls=%v c=%v, (%v:)", tls, c, origin(2))
+ }
return Bool32(func() int32 {
if 0 != 0 {
return Xisalpha(tls, c)
@@ -695,58 +701,100 @@ func Xisalnum(tls *TLS, c int32) int32 { /* isalnum.c:3:5: */
}
func X__isalnum_l(tls *TLS, c int32, l locale_t) int32 { /* isalnum.c:8:5: */
+ if __ccgo_strace {
+ trc("tls=%v c=%v l=%v, (%v:)", tls, c, l, origin(2))
+ }
return Xisalnum(tls, c)
}
func Xisalpha(tls *TLS, c int32) int32 { /* isalpha.c:4:5: */
+ if __ccgo_strace {
+ trc("tls=%v c=%v, (%v:)", tls, c, origin(2))
+ }
return Bool32(uint32(c)|uint32(32)-uint32('a') < uint32(26))
}
func X__isalpha_l(tls *TLS, c int32, l locale_t) int32 { /* isalpha.c:9:5: */
+ if __ccgo_strace {
+ trc("tls=%v c=%v l=%v, (%v:)", tls, c, l, origin(2))
+ }
return Xisalpha(tls, c)
}
func Xisdigit(tls *TLS, c int32) int32 { /* isdigit.c:4:5: */
+ if __ccgo_strace {
+ trc("tls=%v c=%v, (%v:)", tls, c, origin(2))
+ }
return Bool32(uint32(c)-uint32('0') < uint32(10))
}
func X__isdigit_l(tls *TLS, c int32, l locale_t) int32 { /* isdigit.c:9:5: */
+ if __ccgo_strace {
+ trc("tls=%v c=%v l=%v, (%v:)", tls, c, l, origin(2))
+ }
return Xisdigit(tls, c)
}
func Xislower(tls *TLS, c int32) int32 { /* islower.c:4:5: */
+ if __ccgo_strace {
+ trc("tls=%v c=%v, (%v:)", tls, c, origin(2))
+ }
return Bool32(uint32(c)-uint32('a') < uint32(26))
}
func X__islower_l(tls *TLS, c int32, l locale_t) int32 { /* islower.c:9:5: */
+ if __ccgo_strace {
+ trc("tls=%v c=%v l=%v, (%v:)", tls, c, l, origin(2))
+ }
return Xislower(tls, c)
}
func Xisprint(tls *TLS, c int32) int32 { /* isprint.c:4:5: */
+ if __ccgo_strace {
+ trc("tls=%v c=%v, (%v:)", tls, c, origin(2))
+ }
return Bool32(uint32(c)-uint32(0x20) < uint32(0x5f))
}
func X__isprint_l(tls *TLS, c int32, l locale_t) int32 { /* isprint.c:9:5: */
+ if __ccgo_strace {
+ trc("tls=%v c=%v l=%v, (%v:)", tls, c, l, origin(2))
+ }
return Xisprint(tls, c)
}
func Xisspace(tls *TLS, c int32) int32 { /* isspace.c:4:5: */
+ if __ccgo_strace {
+ trc("tls=%v c=%v, (%v:)", tls, c, origin(2))
+ }
return Bool32(c == ' ' || uint32(c)-uint32('\t') < uint32(5))
}
func X__isspace_l(tls *TLS, c int32, l locale_t) int32 { /* isspace.c:9:5: */
+ if __ccgo_strace {
+ trc("tls=%v c=%v l=%v, (%v:)", tls, c, l, origin(2))
+ }
return Xisspace(tls, c)
}
func Xisupper(tls *TLS, c int32) int32 { /* isupper.c:4:5: */
+ if __ccgo_strace {
+ trc("tls=%v c=%v, (%v:)", tls, c, origin(2))
+ }
return Bool32(uint32(c)-uint32('A') < uint32(26))
}
func X__isupper_l(tls *TLS, c int32, l locale_t) int32 { /* isupper.c:9:5: */
+ if __ccgo_strace {
+ trc("tls=%v c=%v l=%v, (%v:)", tls, c, l, origin(2))
+ }
return Xisupper(tls, c)
}
func Xisxdigit(tls *TLS, c int32) int32 { /* isxdigit.c:3:5: */
+ if __ccgo_strace {
+ trc("tls=%v c=%v, (%v:)", tls, c, origin(2))
+ }
return Bool32(func() int32 {
if 0 != 0 {
return Xisdigit(tls, c)
@@ -756,6 +804,9 @@ func Xisxdigit(tls *TLS, c int32) int32 { /* isxdigit.c:3:5: */
}
func X__isxdigit_l(tls *TLS, c int32, l locale_t) int32 { /* isxdigit.c:8:5: */
+ if __ccgo_strace {
+ trc("tls=%v c=%v l=%v, (%v:)", tls, c, l, origin(2))
+ }
return Xisxdigit(tls, c)
}
@@ -1477,6 +1528,9 @@ func hexfloat(tls *TLS, f uintptr, bits int32, emin int32, sign int32, pok int32
}
func X__floatscan(tls *TLS, f uintptr, prec int32, pok int32) float64 { /* floatscan.c:427:13: */
+ if __ccgo_strace {
+ trc("tls=%v f=%v prec=%v pok=%v, (%v:)", tls, f, prec, pok, origin(2))
+ }
var sign int32 = 1
var i size_t
var bits int32
@@ -1654,6 +1708,9 @@ var table = [257]uint8{Uint8FromInt32(-1),
} /* intscan.c:7:28 */
func X__intscan(tls *TLS, f uintptr, base uint32, pok int32, lim uint64) uint64 { /* intscan.c:26:20: */
+ if __ccgo_strace {
+ trc("tls=%v f=%v base=%v pok=%v lim=%v, (%v:)", tls, f, base, pok, lim, origin(2))
+ }
var val uintptr
var c int32
var neg int32
@@ -1959,6 +2016,9 @@ __43:
// the actual count.
func X__shlim(tls *TLS, f uintptr, lim off_t) { /* shgetc.c:8:6: */
+ if __ccgo_strace {
+ trc("tls=%v f=%v lim=%v, (%v:)", tls, f, lim, origin(2))
+ }
(*FILE)(unsafe.Pointer(f)).Fshlim = lim
(*FILE)(unsafe.Pointer(f)).Fshcnt = (int64((*FILE)(unsafe.Pointer(f)).Fbuf) - int64((*FILE)(unsafe.Pointer(f)).Frpos)) / 1
// If lim is nonzero, rend must be a valid pointer.
@@ -1970,6 +2030,9 @@ func X__shlim(tls *TLS, f uintptr, lim off_t) { /* shgetc.c:8:6: */
}
func X__shgetc(tls *TLS, f uintptr) int32 { /* shgetc.c:19:5: */
+ if __ccgo_strace {
+ trc("tls=%v f=%v, (%v:)", tls, f, origin(2))
+ }
var c int32
var cnt off_t = (*FILE)(unsafe.Pointer(f)).Fshcnt + (int64((*FILE)(unsafe.Pointer(f)).Frpos)-int64((*FILE)(unsafe.Pointer(f)).Fbuf))/1
if (*FILE)(unsafe.Pointer(f)).Fshlim != 0 && cnt >= (*FILE)(unsafe.Pointer(f)).Fshlim || AssignInt32(&c, X__uflow(tls, f)) < 0 {
@@ -1996,20 +2059,32 @@ func __bswap32(tls *TLS, __x uint32_t) uint32_t { /* endian.h:24:26: */
}
func Xcopysignl(tls *TLS, x float64, y float64) float64 { /* copysignl.c:4:13: */
+ if __ccgo_strace {
+ trc("tls=%v x=%v y=%v, (%v:)", tls, x, y, origin(2))
+ }
return Xcopysign(tls, x, y)
}
func Xfabsl(tls *TLS, x float64) float64 { /* fabsl.c:3:13: */
+ if __ccgo_strace {
+ trc("tls=%v x=%v, (%v:)", tls, x, origin(2))
+ }
return Xfabs(tls, x)
}
func Xfmodl(tls *TLS, x float64, y float64) float64 { /* fmodl.c:4:13: */
+ if __ccgo_strace {
+ trc("tls=%v x=%v y=%v, (%v:)", tls, x, y, origin(2))
+ }
return Xfmod(tls, x, y)
}
var toint double_t = float64(float64(1)) / 2.22044604925031308085e-16 /* rint.c:10:23 */
func Xrint(tls *TLS, x float64) float64 { /* rint.c:12:8: */
+ if __ccgo_strace {
+ trc("tls=%v x=%v, (%v:)", tls, x, origin(2))
+ }
bp := tls.Alloc(8)
defer tls.Free(8)
@@ -2039,6 +2114,9 @@ func Xrint(tls *TLS, x float64) float64 { /* rint.c:12:8: */
}
func Xscalbn(tls *TLS, x float64, n int32) float64 { /* scalbn.c:4:8: */
+ if __ccgo_strace {
+ trc("tls=%v x=%v n=%v, (%v:)", tls, x, n, origin(2))
+ }
bp := tls.Alloc(8)
defer tls.Free(8)
@@ -2075,6 +2153,9 @@ func Xscalbn(tls *TLS, x float64, n int32) float64 { /* scalbn.c:4:8: */
}
func Xscalbnl(tls *TLS, x float64, n int32) float64 { /* scalbnl.c:4:13: */
+ if __ccgo_strace {
+ trc("tls=%v x=%v n=%v, (%v:)", tls, x, n, origin(2))
+ }
return Xscalbn(tls, x, n)
}
@@ -2406,6 +2487,9 @@ type resolvconf = struct {
} /* lookup.h:34:1 */
func Xfreeaddrinfo(tls *TLS, p uintptr) { /* freeaddrinfo.c:7:6: */
+ if __ccgo_strace {
+ trc("tls=%v p=%v, (%v:)", tls, p, origin(2))
+ }
var cnt size_t
cnt = uint64(1)
__1:
@@ -2543,6 +2627,9 @@ type __ptcb = struct {
type useconds_t = uint32 /* alltypes.h:260:18 */
func Xgetaddrinfo(tls *TLS, host uintptr, serv uintptr, hint uintptr, res uintptr) int32 { /* getaddrinfo.c:12:5: */
+ if __ccgo_strace {
+ trc("tls=%v host=%v serv=%v hint=%v res=%v, (%v:)", tls, host, serv, hint, res, origin(2))
+ }
bp := tls.Alloc(1608)
defer tls.Free(1608)
@@ -2747,6 +2834,9 @@ type mmsghdr = struct {
} /* socket.h:63:1 */
func Xgethostbyaddr(tls *TLS, a uintptr, l socklen_t, af int32) uintptr { /* gethostbyaddr.c:7:16: */
+ if __ccgo_strace {
+ trc("tls=%v a=%v l=%v af=%v, (%v:)", tls, a, l, af, origin(2))
+ }
bp := tls.Alloc(8)
defer tls.Free(8)
@@ -2773,10 +2863,16 @@ func Xgethostbyaddr(tls *TLS, a uintptr, l socklen_t, af int32) uintptr { /* get
var _sh uintptr /* gethostbyaddr.c:9:24: */
func Xgethostbyname(tls *TLS, name uintptr) uintptr { /* gethostbyname.c:8:16: */
+ if __ccgo_strace {
+ trc("tls=%v name=%v, (%v:)", tls, name, origin(2))
+ }
return Xgethostbyname2(tls, name, 2)
}
func Xgethostbyname2(tls *TLS, name uintptr, af int32) uintptr { /* gethostbyname2.c:8:16: */
+ if __ccgo_strace {
+ trc("tls=%v name=%v af=%v, (%v:)", tls, name, af, origin(2))
+ }
bp := tls.Alloc(8)
defer tls.Free(8)
@@ -2803,6 +2899,9 @@ func Xgethostbyname2(tls *TLS, name uintptr, af int32) uintptr { /* gethostbynam
var _sh1 uintptr /* gethostbyname2.c:10:24: */
func Xgethostbyname2_r(tls *TLS, name uintptr, af int32, h uintptr, buf uintptr, buflen size_t, res uintptr, err uintptr) int32 { /* gethostbyname2_r.c:11:5: */
+ if __ccgo_strace {
+ trc("tls=%v name=%v af=%v h=%v buf=%v buflen=%v res=%v err=%v, (%v:)", tls, name, af, h, buf, buflen, res, err, origin(2))
+ }
bp := tls.Alloc(1600)
defer tls.Free(1600)
@@ -3191,10 +3290,16 @@ func reverse_services(tls *TLS, buf uintptr, port int32, dgram int32) { /* getna
var Xh_errno int32 /* h_errno.c:4:5: */
func X__h_errno_location(tls *TLS) uintptr { /* h_errno.c:6:5: */
+ if __ccgo_strace {
+ trc("tls=%v, (%v:)", tls, origin(2))
+ }
return uintptr(unsafe.Pointer(&Xh_errno))
}
func X__inet_aton(tls *TLS, s0 uintptr, dest uintptr) int32 { /* inet_aton.c:7:5: */
+ if __ccgo_strace {
+ trc("tls=%v s0=%v dest=%v, (%v:)", tls, s0, dest, origin(2))
+ }
bp := tls.Alloc(40)
defer tls.Free(40)
@@ -3246,6 +3351,9 @@ func X__inet_aton(tls *TLS, s0 uintptr, dest uintptr) int32 { /* inet_aton.c:7:5
}
func Xinet_ntop(tls *TLS, af int32, a0 uintptr, s uintptr, l socklen_t) uintptr { /* inet_ntop.c:7:12: */
+ if __ccgo_strace {
+ trc("tls=%v af=%v a0=%v s=%v l=%v, (%v:)", tls, af, a0, s, l, origin(2))
+ }
bp := tls.Alloc(276)
defer tls.Free(276)
@@ -3320,6 +3428,9 @@ func hexval(tls *TLS, c uint32) int32 { /* inet_pton.c:7:12: */
}
func Xinet_pton(tls *TLS, af int32, s uintptr, a0 uintptr) int32 { /* inet_pton.c:15:5: */
+ if __ccgo_strace {
+ trc("tls=%v af=%v s=%v a0=%v, (%v:)", tls, af, s, a0, origin(2))
+ }
bp := tls.Alloc(16)
defer tls.Free(16)
@@ -3417,6 +3528,9 @@ func Xinet_pton(tls *TLS, af int32, s uintptr, a0 uintptr) int32 { /* inet_pton.
}
func X__lookup_ipliteral(tls *TLS, buf uintptr, name uintptr, family int32) int32 { /* lookup_ipliteral.c:12:5: */
+ if __ccgo_strace {
+ trc("tls=%v buf=%v name=%v family=%v, (%v:)", tls, buf, name, family, origin(2))
+ }
bp := tls.Alloc(96)
defer tls.Free(96)
@@ -3739,6 +3853,9 @@ func addrcmp(tls *TLS, _a uintptr, _b uintptr) int32 { /* lookup_name.c:305:12:
}
func X__lookup_name(tls *TLS, buf uintptr, canon uintptr, name uintptr, family int32, flags int32) int32 { /* lookup_name.c:311:5: */
+ if __ccgo_strace {
+ trc("tls=%v buf=%v canon=%v name=%v family=%v flags=%v, (%v:)", tls, buf, canon, name, family, flags, origin(2))
+ }
bp := tls.Alloc(92)
defer tls.Free(92)
@@ -3905,6 +4022,9 @@ func X__lookup_name(tls *TLS, buf uintptr, canon uintptr, name uintptr, family i
}
func X__lookup_serv(tls *TLS, buf uintptr, name uintptr, proto int32, socktype int32, flags int32) int32 { /* lookup_serv.c:12:5: */
+ if __ccgo_strace {
+ trc("tls=%v buf=%v name=%v proto=%v socktype=%v flags=%v, (%v:)", tls, buf, name, proto, socktype, flags, origin(2))
+ }
bp := tls.Alloc(8)
defer tls.Free(8)
@@ -4030,6 +4150,9 @@ func X__lookup_serv(tls *TLS, buf uintptr, name uintptr, proto int32, socktype i
}
func X__toread(tls *TLS, f uintptr) int32 { /* __toread.c:3:5: */
+ if __ccgo_strace {
+ trc("tls=%v f=%v, (%v:)", tls, f, origin(2))
+ }
*(*int32)(unsafe.Pointer(f + 136)) |= (*FILE)(unsafe.Pointer(f)).Fmode - 1
if (*FILE)(unsafe.Pointer(f)).Fwpos != (*FILE)(unsafe.Pointer(f)).Fwbase {
(*struct {
@@ -4049,6 +4172,9 @@ func X__toread(tls *TLS, f uintptr) int32 { /* __toread.c:3:5: */
}
func X__toread_needs_stdio_exit(tls *TLS) { /* __toread.c:16:13: */
+ if __ccgo_strace {
+ trc("tls=%v, (%v:)", tls, origin(2))
+ }
X__builtin_abort(tls) //TODO-
// __stdio_exit_needed();
}
@@ -4057,6 +4183,9 @@ func X__toread_needs_stdio_exit(tls *TLS) { /* __toread.c:16:13: */
// data buffered for reading.
func X__uflow(tls *TLS, f uintptr) int32 { /* __uflow.c:6:5: */
+ if __ccgo_strace {
+ trc("tls=%v f=%v, (%v:)", tls, f, origin(2))
+ }
bp := tls.Alloc(1)
defer tls.Free(1)
@@ -4071,6 +4200,9 @@ func X__uflow(tls *TLS, f uintptr) int32 { /* __uflow.c:6:5: */
}
func Xbsearch(tls *TLS, key uintptr, base uintptr, nel size_t, width size_t, cmp uintptr) uintptr { /* bsearch.c:3:6: */
+ if __ccgo_strace {
+ trc("tls=%v key=%v base=%v nel=%v width=%v cmp=%v, (%v:)", tls, key, base, nel, width, cmp, origin(2))
+ }
var try uintptr
var sign int32
for nel > uint64(0) {
@@ -4113,14 +4245,23 @@ func strtox(tls *TLS, s uintptr, p uintptr, prec int32) float64 { /* strtod.c:6:
}
func Xstrtof(tls *TLS, s uintptr, p uintptr) float32 { /* strtod.c:17:7: */
+ if __ccgo_strace {
+ trc("tls=%v s=%v p=%v, (%v:)", tls, s, p, origin(2))
+ }
return float32(strtox(tls, s, p, 0))
}
func Xstrtod(tls *TLS, s uintptr, p uintptr) float64 { /* strtod.c:22:8: */
+ if __ccgo_strace {
+ trc("tls=%v s=%v p=%v, (%v:)", tls, s, p, origin(2))
+ }
return strtox(tls, s, p, 1)
}
func Xstrtold(tls *TLS, s uintptr, p uintptr) float64 { /* strtod.c:27:13: */
+ if __ccgo_strace {
+ trc("tls=%v s=%v p=%v, (%v:)", tls, s, p, origin(2))
+ }
return strtox(tls, s, p, 2)
}
@@ -4142,30 +4283,51 @@ func strtox1(tls *TLS, s uintptr, p uintptr, base int32, lim uint64) uint64 { /*
}
func Xstrtoull(tls *TLS, s uintptr, p uintptr, base int32) uint64 { /* strtol.c:21:20: */
+ if __ccgo_strace {
+ trc("tls=%v s=%v p=%v base=%v, (%v:)", tls, s, p, base, origin(2))
+ }
return strtox1(tls, s, p, base, 2*uint64(0x7fffffffffffffff)+uint64(1))
}
func Xstrtoll(tls *TLS, s uintptr, p uintptr, base int32) int64 { /* strtol.c:26:11: */
+ if __ccgo_strace {
+ trc("tls=%v s=%v p=%v base=%v, (%v:)", tls, s, p, base, origin(2))
+ }
return int64(strtox1(tls, s, p, base, Uint64FromInt64(-0x7fffffffffffffff-int64(1))))
}
func Xstrtoul(tls *TLS, s uintptr, p uintptr, base int32) uint64 { /* strtol.c:31:15: */
+ if __ccgo_strace {
+ trc("tls=%v s=%v p=%v base=%v, (%v:)", tls, s, p, base, origin(2))
+ }
return uint64(strtox1(tls, s, p, base, 2*uint64(0x7fffffffffffffff)+uint64(1)))
}
func Xstrtol(tls *TLS, s uintptr, p uintptr, base int32) int64 { /* strtol.c:36:6: */
+ if __ccgo_strace {
+ trc("tls=%v s=%v p=%v base=%v, (%v:)", tls, s, p, base, origin(2))
+ }
return int64(strtox1(tls, s, p, base, 0+Uint64FromInt64(Int64(-Int64(0x7fffffffffffffff))-Int64FromInt32(1))))
}
func Xstrtoimax(tls *TLS, s uintptr, p uintptr, base int32) intmax_t { /* strtol.c:41:10: */
+ if __ccgo_strace {
+ trc("tls=%v s=%v p=%v base=%v, (%v:)", tls, s, p, base, origin(2))
+ }
return intmax_t(Xstrtoll(tls, s, p, base))
}
func Xstrtoumax(tls *TLS, s uintptr, p uintptr, base int32) uintmax_t { /* strtol.c:46:11: */
+ if __ccgo_strace {
+ trc("tls=%v s=%v p=%v base=%v, (%v:)", tls, s, p, base, origin(2))
+ }
return uintmax_t(Xstrtoull(tls, s, p, base))
}
func Xstrdup(tls *TLS, s uintptr) uintptr { /* strdup.c:4:6: */
+ if __ccgo_strace {
+ trc("tls=%v s=%v, (%v:)", tls, s, origin(2))
+ }
var l size_t = Xstrlen(tls, s)
var d uintptr = Xmalloc(tls, l+uint64(1))
if !(d != 0) {
@@ -4175,6 +4337,9 @@ func Xstrdup(tls *TLS, s uintptr) uintptr { /* strdup.c:4:6: */
}
func Xstrnlen(tls *TLS, s uintptr, n size_t) size_t { /* strnlen.c:3:8: */
+ if __ccgo_strace {
+ trc("tls=%v s=%v n=%v, (%v:)", tls, s, n, origin(2))
+ }
var p uintptr = Xmemchr(tls, s, 0, n)
if p != 0 {
return uint64((int64(p) - int64(s)) / 1)
@@ -4183,6 +4348,9 @@ func Xstrnlen(tls *TLS, s uintptr, n size_t) size_t { /* strnlen.c:3:8: */
}
func Xstrspn(tls *TLS, s uintptr, c uintptr) size_t { /* strspn.c:6:8: */
+ if __ccgo_strace {
+ trc("tls=%v s=%v c=%v, (%v:)", tls, s, c, origin(2))
+ }
bp := tls.Alloc(32)
defer tls.Free(32)
diff --git a/vendor/modernc.org/libc/musl_openbsd_arm64.go b/vendor/modernc.org/libc/musl_openbsd_arm64.go
index ba015fc4..e8f50492 100644
--- a/vendor/modernc.org/libc/musl_openbsd_arm64.go
+++ b/vendor/modernc.org/libc/musl_openbsd_arm64.go
@@ -501,6 +501,9 @@ type wchar_t = int32 /* :15:24 */
// extern __inline __attribute__((__gnu_inline__))
func Xisblank(tls *TLS, _c int32) int32 { /* ctype_.c:144:5: */
+ if __ccgo_strace {
+ trc("tls=%v _c=%v, (%v:)", tls, _c, origin(2))
+ }
return Bool32(_c == ' ' || _c == '\t')
}
@@ -681,6 +684,9 @@ func __isspace(tls *TLS, _c int32) int32 { /* ctype.h:26:21: */
type locale_t = uintptr /* alltypes.h:351:32 */
func Xisalnum(tls *TLS, c int32) int32 { /* isalnum.c:3:5: */
+ if __ccgo_strace {
+ trc("tls=%v c=%v, (%v:)", tls, c, origin(2))
+ }
return Bool32(func() int32 {
if 0 != 0 {
return Xisalpha(tls, c)
@@ -695,58 +701,100 @@ func Xisalnum(tls *TLS, c int32) int32 { /* isalnum.c:3:5: */
}
func X__isalnum_l(tls *TLS, c int32, l locale_t) int32 { /* isalnum.c:8:5: */
+ if __ccgo_strace {
+ trc("tls=%v c=%v l=%v, (%v:)", tls, c, l, origin(2))
+ }
return Xisalnum(tls, c)
}
func Xisalpha(tls *TLS, c int32) int32 { /* isalpha.c:4:5: */
+ if __ccgo_strace {
+ trc("tls=%v c=%v, (%v:)", tls, c, origin(2))
+ }
return Bool32(uint32(c)|uint32(32)-uint32('a') < uint32(26))
}
func X__isalpha_l(tls *TLS, c int32, l locale_t) int32 { /* isalpha.c:9:5: */
+ if __ccgo_strace {
+ trc("tls=%v c=%v l=%v, (%v:)", tls, c, l, origin(2))
+ }
return Xisalpha(tls, c)
}
func Xisdigit(tls *TLS, c int32) int32 { /* isdigit.c:4:5: */
+ if __ccgo_strace {
+ trc("tls=%v c=%v, (%v:)", tls, c, origin(2))
+ }
return Bool32(uint32(c)-uint32('0') < uint32(10))
}
func X__isdigit_l(tls *TLS, c int32, l locale_t) int32 { /* isdigit.c:9:5: */
+ if __ccgo_strace {
+ trc("tls=%v c=%v l=%v, (%v:)", tls, c, l, origin(2))
+ }
return Xisdigit(tls, c)
}
func Xislower(tls *TLS, c int32) int32 { /* islower.c:4:5: */
+ if __ccgo_strace {
+ trc("tls=%v c=%v, (%v:)", tls, c, origin(2))
+ }
return Bool32(uint32(c)-uint32('a') < uint32(26))
}
func X__islower_l(tls *TLS, c int32, l locale_t) int32 { /* islower.c:9:5: */
+ if __ccgo_strace {
+ trc("tls=%v c=%v l=%v, (%v:)", tls, c, l, origin(2))
+ }
return Xislower(tls, c)
}
func Xisprint(tls *TLS, c int32) int32 { /* isprint.c:4:5: */
+ if __ccgo_strace {
+ trc("tls=%v c=%v, (%v:)", tls, c, origin(2))
+ }
return Bool32(uint32(c)-uint32(0x20) < uint32(0x5f))
}
func X__isprint_l(tls *TLS, c int32, l locale_t) int32 { /* isprint.c:9:5: */
+ if __ccgo_strace {
+ trc("tls=%v c=%v l=%v, (%v:)", tls, c, l, origin(2))
+ }
return Xisprint(tls, c)
}
func Xisspace(tls *TLS, c int32) int32 { /* isspace.c:4:5: */
+ if __ccgo_strace {
+ trc("tls=%v c=%v, (%v:)", tls, c, origin(2))
+ }
return Bool32(c == ' ' || uint32(c)-uint32('\t') < uint32(5))
}
func X__isspace_l(tls *TLS, c int32, l locale_t) int32 { /* isspace.c:9:5: */
+ if __ccgo_strace {
+ trc("tls=%v c=%v l=%v, (%v:)", tls, c, l, origin(2))
+ }
return Xisspace(tls, c)
}
func Xisupper(tls *TLS, c int32) int32 { /* isupper.c:4:5: */
+ if __ccgo_strace {
+ trc("tls=%v c=%v, (%v:)", tls, c, origin(2))
+ }
return Bool32(uint32(c)-uint32('A') < uint32(26))
}
func X__isupper_l(tls *TLS, c int32, l locale_t) int32 { /* isupper.c:9:5: */
+ if __ccgo_strace {
+ trc("tls=%v c=%v l=%v, (%v:)", tls, c, l, origin(2))
+ }
return Xisupper(tls, c)
}
func Xisxdigit(tls *TLS, c int32) int32 { /* isxdigit.c:3:5: */
+ if __ccgo_strace {
+ trc("tls=%v c=%v, (%v:)", tls, c, origin(2))
+ }
return Bool32(func() int32 {
if 0 != 0 {
return Xisdigit(tls, c)
@@ -756,6 +804,9 @@ func Xisxdigit(tls *TLS, c int32) int32 { /* isxdigit.c:3:5: */
}
func X__isxdigit_l(tls *TLS, c int32, l locale_t) int32 { /* isxdigit.c:8:5: */
+ if __ccgo_strace {
+ trc("tls=%v c=%v l=%v, (%v:)", tls, c, l, origin(2))
+ }
return Xisxdigit(tls, c)
}
@@ -1477,6 +1528,9 @@ func hexfloat(tls *TLS, f uintptr, bits int32, emin int32, sign int32, pok int32
}
func X__floatscan(tls *TLS, f uintptr, prec int32, pok int32) float64 { /* floatscan.c:427:13: */
+ if __ccgo_strace {
+ trc("tls=%v f=%v prec=%v pok=%v, (%v:)", tls, f, prec, pok, origin(2))
+ }
var sign int32 = 1
var i size_t
var bits int32
@@ -1654,6 +1708,9 @@ var table = [257]uint8{Uint8FromInt32(-1),
} /* intscan.c:7:28 */
func X__intscan(tls *TLS, f uintptr, base uint32, pok int32, lim uint64) uint64 { /* intscan.c:26:20: */
+ if __ccgo_strace {
+ trc("tls=%v f=%v base=%v pok=%v lim=%v, (%v:)", tls, f, base, pok, lim, origin(2))
+ }
var val uintptr
var c int32
var neg int32
@@ -1959,6 +2016,9 @@ __43:
// the actual count.
func X__shlim(tls *TLS, f uintptr, lim off_t) { /* shgetc.c:8:6: */
+ if __ccgo_strace {
+ trc("tls=%v f=%v lim=%v, (%v:)", tls, f, lim, origin(2))
+ }
(*FILE)(unsafe.Pointer(f)).Fshlim = lim
(*FILE)(unsafe.Pointer(f)).Fshcnt = (int64((*FILE)(unsafe.Pointer(f)).Fbuf) - int64((*FILE)(unsafe.Pointer(f)).Frpos)) / 1
// If lim is nonzero, rend must be a valid pointer.
@@ -1970,6 +2030,9 @@ func X__shlim(tls *TLS, f uintptr, lim off_t) { /* shgetc.c:8:6: */
}
func X__shgetc(tls *TLS, f uintptr) int32 { /* shgetc.c:19:5: */
+ if __ccgo_strace {
+ trc("tls=%v f=%v, (%v:)", tls, f, origin(2))
+ }
var c int32
var cnt off_t = (*FILE)(unsafe.Pointer(f)).Fshcnt + (int64((*FILE)(unsafe.Pointer(f)).Frpos)-int64((*FILE)(unsafe.Pointer(f)).Fbuf))/1
if (*FILE)(unsafe.Pointer(f)).Fshlim != 0 && cnt >= (*FILE)(unsafe.Pointer(f)).Fshlim || AssignInt32(&c, X__uflow(tls, f)) < 0 {
@@ -1996,20 +2059,32 @@ func __bswap32(tls *TLS, __x uint32_t) uint32_t { /* endian.h:24:26: */
}
func Xcopysignl(tls *TLS, x float64, y float64) float64 { /* copysignl.c:4:13: */
+ if __ccgo_strace {
+ trc("tls=%v x=%v y=%v, (%v:)", tls, x, y, origin(2))
+ }
return Xcopysign(tls, x, y)
}
func Xfabsl(tls *TLS, x float64) float64 { /* fabsl.c:3:13: */
+ if __ccgo_strace {
+ trc("tls=%v x=%v, (%v:)", tls, x, origin(2))
+ }
return Xfabs(tls, x)
}
func Xfmodl(tls *TLS, x float64, y float64) float64 { /* fmodl.c:4:13: */
+ if __ccgo_strace {
+ trc("tls=%v x=%v y=%v, (%v:)", tls, x, y, origin(2))
+ }
return Xfmod(tls, x, y)
}
var toint double_t = float64(float64(1)) / 2.22044604925031308085e-16 /* rint.c:10:23 */
func Xrint(tls *TLS, x float64) float64 { /* rint.c:12:8: */
+ if __ccgo_strace {
+ trc("tls=%v x=%v, (%v:)", tls, x, origin(2))
+ }
bp := tls.Alloc(8)
defer tls.Free(8)
@@ -2039,6 +2114,9 @@ func Xrint(tls *TLS, x float64) float64 { /* rint.c:12:8: */
}
func Xscalbn(tls *TLS, x float64, n int32) float64 { /* scalbn.c:4:8: */
+ if __ccgo_strace {
+ trc("tls=%v x=%v n=%v, (%v:)", tls, x, n, origin(2))
+ }
bp := tls.Alloc(8)
defer tls.Free(8)
@@ -2075,6 +2153,9 @@ func Xscalbn(tls *TLS, x float64, n int32) float64 { /* scalbn.c:4:8: */
}
func Xscalbnl(tls *TLS, x float64, n int32) float64 { /* scalbnl.c:4:13: */
+ if __ccgo_strace {
+ trc("tls=%v x=%v n=%v, (%v:)", tls, x, n, origin(2))
+ }
return Xscalbn(tls, x, n)
}
@@ -2406,6 +2487,9 @@ type resolvconf = struct {
} /* lookup.h:34:1 */
func Xfreeaddrinfo(tls *TLS, p uintptr) { /* freeaddrinfo.c:7:6: */
+ if __ccgo_strace {
+ trc("tls=%v p=%v, (%v:)", tls, p, origin(2))
+ }
var cnt size_t
cnt = uint64(1)
__1:
@@ -2543,6 +2627,9 @@ type __ptcb = struct {
type useconds_t = uint32 /* alltypes.h:268:18 */
func Xgetaddrinfo(tls *TLS, host uintptr, serv uintptr, hint uintptr, res uintptr) int32 { /* getaddrinfo.c:12:5: */
+ if __ccgo_strace {
+ trc("tls=%v host=%v serv=%v hint=%v res=%v, (%v:)", tls, host, serv, hint, res, origin(2))
+ }
bp := tls.Alloc(1608)
defer tls.Free(1608)
@@ -2747,6 +2834,9 @@ type mmsghdr = struct {
} /* socket.h:63:1 */
func Xgethostbyaddr(tls *TLS, a uintptr, l socklen_t, af int32) uintptr { /* gethostbyaddr.c:7:16: */
+ if __ccgo_strace {
+ trc("tls=%v a=%v l=%v af=%v, (%v:)", tls, a, l, af, origin(2))
+ }
bp := tls.Alloc(8)
defer tls.Free(8)
@@ -2773,10 +2863,16 @@ func Xgethostbyaddr(tls *TLS, a uintptr, l socklen_t, af int32) uintptr { /* get
var _sh uintptr /* gethostbyaddr.c:9:24: */
func Xgethostbyname(tls *TLS, name uintptr) uintptr { /* gethostbyname.c:8:16: */
+ if __ccgo_strace {
+ trc("tls=%v name=%v, (%v:)", tls, name, origin(2))
+ }
return Xgethostbyname2(tls, name, 2)
}
func Xgethostbyname2(tls *TLS, name uintptr, af int32) uintptr { /* gethostbyname2.c:8:16: */
+ if __ccgo_strace {
+ trc("tls=%v name=%v af=%v, (%v:)", tls, name, af, origin(2))
+ }
bp := tls.Alloc(8)
defer tls.Free(8)
@@ -2803,6 +2899,9 @@ func Xgethostbyname2(tls *TLS, name uintptr, af int32) uintptr { /* gethostbynam
var _sh1 uintptr /* gethostbyname2.c:10:24: */
func Xgethostbyname2_r(tls *TLS, name uintptr, af int32, h uintptr, buf uintptr, buflen size_t, res uintptr, err uintptr) int32 { /* gethostbyname2_r.c:11:5: */
+ if __ccgo_strace {
+ trc("tls=%v name=%v af=%v h=%v buf=%v buflen=%v res=%v err=%v, (%v:)", tls, name, af, h, buf, buflen, res, err, origin(2))
+ }
bp := tls.Alloc(1600)
defer tls.Free(1600)
@@ -3191,10 +3290,16 @@ func reverse_services(tls *TLS, buf uintptr, port int32, dgram int32) { /* getna
var Xh_errno int32 /* h_errno.c:4:5: */
func X__h_errno_location(tls *TLS) uintptr { /* h_errno.c:6:5: */
+ if __ccgo_strace {
+ trc("tls=%v, (%v:)", tls, origin(2))
+ }
return uintptr(unsafe.Pointer(&Xh_errno))
}
func X__inet_aton(tls *TLS, s0 uintptr, dest uintptr) int32 { /* inet_aton.c:7:5: */
+ if __ccgo_strace {
+ trc("tls=%v s0=%v dest=%v, (%v:)", tls, s0, dest, origin(2))
+ }
bp := tls.Alloc(40)
defer tls.Free(40)
@@ -3246,6 +3351,9 @@ func X__inet_aton(tls *TLS, s0 uintptr, dest uintptr) int32 { /* inet_aton.c:7:5
}
func Xinet_ntop(tls *TLS, af int32, a0 uintptr, s uintptr, l socklen_t) uintptr { /* inet_ntop.c:7:12: */
+ if __ccgo_strace {
+ trc("tls=%v af=%v a0=%v s=%v l=%v, (%v:)", tls, af, a0, s, l, origin(2))
+ }
bp := tls.Alloc(276)
defer tls.Free(276)
@@ -3320,6 +3428,9 @@ func hexval(tls *TLS, c uint32) int32 { /* inet_pton.c:7:12: */
}
func Xinet_pton(tls *TLS, af int32, s uintptr, a0 uintptr) int32 { /* inet_pton.c:15:5: */
+ if __ccgo_strace {
+ trc("tls=%v af=%v s=%v a0=%v, (%v:)", tls, af, s, a0, origin(2))
+ }
bp := tls.Alloc(16)
defer tls.Free(16)
@@ -3417,6 +3528,9 @@ func Xinet_pton(tls *TLS, af int32, s uintptr, a0 uintptr) int32 { /* inet_pton.
}
func X__lookup_ipliteral(tls *TLS, buf uintptr, name uintptr, family int32) int32 { /* lookup_ipliteral.c:12:5: */
+ if __ccgo_strace {
+ trc("tls=%v buf=%v name=%v family=%v, (%v:)", tls, buf, name, family, origin(2))
+ }
bp := tls.Alloc(96)
defer tls.Free(96)
@@ -3739,6 +3853,9 @@ func addrcmp(tls *TLS, _a uintptr, _b uintptr) int32 { /* lookup_name.c:305:12:
}
func X__lookup_name(tls *TLS, buf uintptr, canon uintptr, name uintptr, family int32, flags int32) int32 { /* lookup_name.c:311:5: */
+ if __ccgo_strace {
+ trc("tls=%v buf=%v canon=%v name=%v family=%v flags=%v, (%v:)", tls, buf, canon, name, family, flags, origin(2))
+ }
bp := tls.Alloc(92)
defer tls.Free(92)
@@ -3905,6 +4022,9 @@ func X__lookup_name(tls *TLS, buf uintptr, canon uintptr, name uintptr, family i
}
func X__lookup_serv(tls *TLS, buf uintptr, name uintptr, proto int32, socktype int32, flags int32) int32 { /* lookup_serv.c:12:5: */
+ if __ccgo_strace {
+ trc("tls=%v buf=%v name=%v proto=%v socktype=%v flags=%v, (%v:)", tls, buf, name, proto, socktype, flags, origin(2))
+ }
bp := tls.Alloc(8)
defer tls.Free(8)
@@ -4030,6 +4150,9 @@ func X__lookup_serv(tls *TLS, buf uintptr, name uintptr, proto int32, socktype i
}
func X__toread(tls *TLS, f uintptr) int32 { /* __toread.c:3:5: */
+ if __ccgo_strace {
+ trc("tls=%v f=%v, (%v:)", tls, f, origin(2))
+ }
*(*int32)(unsafe.Pointer(f + 136)) |= (*FILE)(unsafe.Pointer(f)).Fmode - 1
if (*FILE)(unsafe.Pointer(f)).Fwpos != (*FILE)(unsafe.Pointer(f)).Fwbase {
(*struct {
@@ -4049,6 +4172,9 @@ func X__toread(tls *TLS, f uintptr) int32 { /* __toread.c:3:5: */
}
func X__toread_needs_stdio_exit(tls *TLS) { /* __toread.c:16:13: */
+ if __ccgo_strace {
+ trc("tls=%v, (%v:)", tls, origin(2))
+ }
X__builtin_abort(tls) //TODO-
// __stdio_exit_needed();
}
@@ -4057,6 +4183,9 @@ func X__toread_needs_stdio_exit(tls *TLS) { /* __toread.c:16:13: */
// data buffered for reading.
func X__uflow(tls *TLS, f uintptr) int32 { /* __uflow.c:6:5: */
+ if __ccgo_strace {
+ trc("tls=%v f=%v, (%v:)", tls, f, origin(2))
+ }
bp := tls.Alloc(1)
defer tls.Free(1)
@@ -4071,6 +4200,9 @@ func X__uflow(tls *TLS, f uintptr) int32 { /* __uflow.c:6:5: */
}
func Xbsearch(tls *TLS, key uintptr, base uintptr, nel size_t, width size_t, cmp uintptr) uintptr { /* bsearch.c:3:6: */
+ if __ccgo_strace {
+ trc("tls=%v key=%v base=%v nel=%v width=%v cmp=%v, (%v:)", tls, key, base, nel, width, cmp, origin(2))
+ }
var try uintptr
var sign int32
for nel > uint64(0) {
@@ -4113,14 +4245,23 @@ func strtox(tls *TLS, s uintptr, p uintptr, prec int32) float64 { /* strtod.c:6:
}
func Xstrtof(tls *TLS, s uintptr, p uintptr) float32 { /* strtod.c:17:7: */
+ if __ccgo_strace {
+ trc("tls=%v s=%v p=%v, (%v:)", tls, s, p, origin(2))
+ }
return float32(strtox(tls, s, p, 0))
}
func Xstrtod(tls *TLS, s uintptr, p uintptr) float64 { /* strtod.c:22:8: */
+ if __ccgo_strace {
+ trc("tls=%v s=%v p=%v, (%v:)", tls, s, p, origin(2))
+ }
return strtox(tls, s, p, 1)
}
func Xstrtold(tls *TLS, s uintptr, p uintptr) float64 { /* strtod.c:27:13: */
+ if __ccgo_strace {
+ trc("tls=%v s=%v p=%v, (%v:)", tls, s, p, origin(2))
+ }
return strtox(tls, s, p, 2)
}
@@ -4142,30 +4283,51 @@ func strtox1(tls *TLS, s uintptr, p uintptr, base int32, lim uint64) uint64 { /*
}
func Xstrtoull(tls *TLS, s uintptr, p uintptr, base int32) uint64 { /* strtol.c:21:20: */
+ if __ccgo_strace {
+ trc("tls=%v s=%v p=%v base=%v, (%v:)", tls, s, p, base, origin(2))
+ }
return strtox1(tls, s, p, base, 2*uint64(0x7fffffffffffffff)+uint64(1))
}
func Xstrtoll(tls *TLS, s uintptr, p uintptr, base int32) int64 { /* strtol.c:26:11: */
+ if __ccgo_strace {
+ trc("tls=%v s=%v p=%v base=%v, (%v:)", tls, s, p, base, origin(2))
+ }
return int64(strtox1(tls, s, p, base, Uint64FromInt64(-0x7fffffffffffffff-int64(1))))
}
func Xstrtoul(tls *TLS, s uintptr, p uintptr, base int32) uint64 { /* strtol.c:31:15: */
+ if __ccgo_strace {
+ trc("tls=%v s=%v p=%v base=%v, (%v:)", tls, s, p, base, origin(2))
+ }
return uint64(strtox1(tls, s, p, base, 2*uint64(0x7fffffffffffffff)+uint64(1)))
}
func Xstrtol(tls *TLS, s uintptr, p uintptr, base int32) int64 { /* strtol.c:36:6: */
+ if __ccgo_strace {
+ trc("tls=%v s=%v p=%v base=%v, (%v:)", tls, s, p, base, origin(2))
+ }
return int64(strtox1(tls, s, p, base, 0+Uint64FromInt64(Int64(-Int64(0x7fffffffffffffff))-Int64FromInt32(1))))
}
func Xstrtoimax(tls *TLS, s uintptr, p uintptr, base int32) intmax_t { /* strtol.c:41:10: */
+ if __ccgo_strace {
+ trc("tls=%v s=%v p=%v base=%v, (%v:)", tls, s, p, base, origin(2))
+ }
return intmax_t(Xstrtoll(tls, s, p, base))
}
func Xstrtoumax(tls *TLS, s uintptr, p uintptr, base int32) uintmax_t { /* strtol.c:46:11: */
+ if __ccgo_strace {
+ trc("tls=%v s=%v p=%v base=%v, (%v:)", tls, s, p, base, origin(2))
+ }
return uintmax_t(Xstrtoull(tls, s, p, base))
}
func Xstrdup(tls *TLS, s uintptr) uintptr { /* strdup.c:4:6: */
+ if __ccgo_strace {
+ trc("tls=%v s=%v, (%v:)", tls, s, origin(2))
+ }
var l size_t = Xstrlen(tls, s)
var d uintptr = Xmalloc(tls, l+uint64(1))
if !(d != 0) {
@@ -4175,6 +4337,9 @@ func Xstrdup(tls *TLS, s uintptr) uintptr { /* strdup.c:4:6: */
}
func Xstrnlen(tls *TLS, s uintptr, n size_t) size_t { /* strnlen.c:3:8: */
+ if __ccgo_strace {
+ trc("tls=%v s=%v n=%v, (%v:)", tls, s, n, origin(2))
+ }
var p uintptr = Xmemchr(tls, s, 0, n)
if p != 0 {
return uint64((int64(p) - int64(s)) / 1)
@@ -4183,6 +4348,9 @@ func Xstrnlen(tls *TLS, s uintptr, n size_t) size_t { /* strnlen.c:3:8: */
}
func Xstrspn(tls *TLS, s uintptr, c uintptr) size_t { /* strspn.c:6:8: */
+ if __ccgo_strace {
+ trc("tls=%v s=%v c=%v, (%v:)", tls, s, c, origin(2))
+ }
bp := tls.Alloc(32)
defer tls.Free(32)
diff --git a/vendor/modernc.org/libc/musl_windows_386.go b/vendor/modernc.org/libc/musl_windows_386.go
index 24c5b240..4b101db7 100644
--- a/vendor/modernc.org/libc/musl_windows_386.go
+++ b/vendor/modernc.org/libc/musl_windows_386.go
@@ -230,6 +230,9 @@ type __locale_struct = struct{ cat [6]uintptr } /* alltypes.h:366:9 */
type locale_t = uintptr /* alltypes.h:366:32 */
func Xisalnum(tls *TLS, c int32) int32 { /* isalnum.c:3:5: */
+ if __ccgo_strace {
+ trc("tls=%v c=%v, (%v:)", tls, c, origin(2))
+ }
return Bool32(func() int32 {
if 0 != 0 {
return Xisalpha(tls, c)
@@ -244,50 +247,86 @@ func Xisalnum(tls *TLS, c int32) int32 { /* isalnum.c:3:5: */
}
func X__isalnum_l(tls *TLS, c int32, l locale_t) int32 { /* isalnum.c:8:5: */
+ if __ccgo_strace {
+ trc("tls=%v c=%v l=%v, (%v:)", tls, c, l, origin(2))
+ }
return Xisalnum(tls, c)
}
func Xisalpha(tls *TLS, c int32) int32 { /* isalpha.c:4:5: */
+ if __ccgo_strace {
+ trc("tls=%v c=%v, (%v:)", tls, c, origin(2))
+ }
return Bool32(uint32(c)|uint32(32)-uint32('a') < uint32(26))
}
func X__isalpha_l(tls *TLS, c int32, l locale_t) int32 { /* isalpha.c:9:5: */
+ if __ccgo_strace {
+ trc("tls=%v c=%v l=%v, (%v:)", tls, c, l, origin(2))
+ }
return Xisalpha(tls, c)
}
func Xisdigit(tls *TLS, c int32) int32 { /* isdigit.c:4:5: */
+ if __ccgo_strace {
+ trc("tls=%v c=%v, (%v:)", tls, c, origin(2))
+ }
return Bool32(uint32(c)-uint32('0') < uint32(10))
}
func X__isdigit_l(tls *TLS, c int32, l locale_t) int32 { /* isdigit.c:9:5: */
+ if __ccgo_strace {
+ trc("tls=%v c=%v l=%v, (%v:)", tls, c, l, origin(2))
+ }
return Xisdigit(tls, c)
}
func Xislower(tls *TLS, c int32) int32 { /* islower.c:4:5: */
+ if __ccgo_strace {
+ trc("tls=%v c=%v, (%v:)", tls, c, origin(2))
+ }
return Bool32(uint32(c)-uint32('a') < uint32(26))
}
func X__islower_l(tls *TLS, c int32, l locale_t) int32 { /* islower.c:9:5: */
+ if __ccgo_strace {
+ trc("tls=%v c=%v l=%v, (%v:)", tls, c, l, origin(2))
+ }
return Xislower(tls, c)
}
func Xisprint(tls *TLS, c int32) int32 { /* isprint.c:4:5: */
+ if __ccgo_strace {
+ trc("tls=%v c=%v, (%v:)", tls, c, origin(2))
+ }
return Bool32(uint32(c)-uint32(0x20) < uint32(0x5f))
}
func X__isprint_l(tls *TLS, c int32, l locale_t) int32 { /* isprint.c:9:5: */
+ if __ccgo_strace {
+ trc("tls=%v c=%v l=%v, (%v:)", tls, c, l, origin(2))
+ }
return Xisprint(tls, c)
}
func Xisspace(tls *TLS, c int32) int32 { /* isspace.c:4:5: */
+ if __ccgo_strace {
+ trc("tls=%v c=%v, (%v:)", tls, c, origin(2))
+ }
return Bool32(c == ' ' || uint32(c)-uint32('\t') < uint32(5))
}
func X__isspace_l(tls *TLS, c int32, l locale_t) int32 { /* isspace.c:9:5: */
+ if __ccgo_strace {
+ trc("tls=%v c=%v l=%v, (%v:)", tls, c, l, origin(2))
+ }
return Xisspace(tls, c)
}
func Xisxdigit(tls *TLS, c int32) int32 { /* isxdigit.c:3:5: */
+ if __ccgo_strace {
+ trc("tls=%v c=%v, (%v:)", tls, c, origin(2))
+ }
return Bool32(func() int32 {
if 0 != 0 {
return Xisdigit(tls, c)
@@ -297,6 +336,9 @@ func Xisxdigit(tls *TLS, c int32) int32 { /* isxdigit.c:3:5: */
}
func X__isxdigit_l(tls *TLS, c int32, l locale_t) int32 { /* isxdigit.c:8:5: */
+ if __ccgo_strace {
+ trc("tls=%v c=%v l=%v, (%v:)", tls, c, l, origin(2))
+ }
return Xisxdigit(tls, c)
}
@@ -328,6 +370,9 @@ type gid_t = uint32 /* alltypes.h:273:18 */
type useconds_t = uint32 /* alltypes.h:283:18 */
func X__putenv(tls *TLS, s uintptr, l size_t, r uintptr) int32 { /* putenv.c:8:5: */
+ if __ccgo_strace {
+ trc("tls=%v s=%v l=%v r=%v, (%v:)", tls, s, l, r, origin(2))
+ }
var i size_t
var newenv uintptr
var tmp uintptr
@@ -408,6 +453,9 @@ oom:
var _soldenv uintptr /* putenv.c:22:14: */
func Xputenv(tls *TLS, s uintptr) int32 { /* putenv.c:43:5: */
+ if __ccgo_strace {
+ trc("tls=%v s=%v, (%v:)", tls, s, origin(2))
+ }
var l size_t = size_t((int32(X__strchrnul(tls, s, '=')) - int32(s)) / 1)
if !(l != 0) || !(int32(*(*int8)(unsafe.Pointer(s + uintptr(l)))) != 0) {
return Xunsetenv(tls, s)
@@ -416,6 +464,9 @@ func Xputenv(tls *TLS, s uintptr) int32 { /* putenv.c:43:5: */
}
func X__env_rm_add(tls *TLS, old uintptr, new uintptr) { /* setenv.c:5:6: */
+ if __ccgo_strace {
+ trc("tls=%v old=%v new=%v, (%v:)", tls, old, new, origin(2))
+ }
//TODO for (size_t i=0; i < env_alloced_n; i++)
var i size_t = size_t(0)
for ; i < _senv_alloced_n; i++ {
@@ -442,6 +493,9 @@ var _senv_alloced uintptr /* setenv.c:7:14: */
var _senv_alloced_n size_t /* setenv.c:8:16: */
func Xsetenv(tls *TLS, var1 uintptr, value uintptr, overwrite int32) int32 { /* setenv.c:26:5: */
+ if __ccgo_strace {
+ trc("tls=%v var1=%v value=%v overwrite=%v, (%v:)", tls, var1, value, overwrite, origin(2))
+ }
var s uintptr
var l1 size_t
var l2 size_t
@@ -466,6 +520,9 @@ func Xsetenv(tls *TLS, var1 uintptr, value uintptr, overwrite int32) int32 { /*
}
func Xunsetenv(tls *TLS, name uintptr) int32 { /* unsetenv.c:9:5: */
+ if __ccgo_strace {
+ trc("tls=%v name=%v, (%v:)", tls, name, origin(2))
+ }
var l size_t = size_t((int32(X__strchrnul(tls, name, '=')) - int32(name)) / 1)
if !(l != 0) || *(*int8)(unsafe.Pointer(name + uintptr(l))) != 0 {
*(*int32)(unsafe.Pointer(X___errno_location(tls))) = 22
@@ -922,6 +979,9 @@ func __pthread_self(tls *TLS) uintptr { /* pthread_arch.h:1:30: */
}
func Xwcrtomb(tls *TLS, s uintptr, wc wchar_t, st uintptr) size_t { /* wcrtomb.c:6:8: */
+ if __ccgo_strace {
+ trc("tls=%v s=%v wc=%v st=%v, (%v:)", tls, s, wc, st, origin(2))
+ }
if !(s != 0) {
return size_t(1)
}
@@ -961,6 +1021,9 @@ func Xwcrtomb(tls *TLS, s uintptr, wc wchar_t, st uintptr) size_t { /* wcrtomb.c
}
func Xwcsrtombs(tls *TLS, s uintptr, ws uintptr, n size_t, st uintptr) size_t { /* wcsrtombs.c:3:8: */
+ if __ccgo_strace {
+ trc("tls=%v s=%v ws=%v n=%v st=%v, (%v:)", tls, s, ws, n, st, origin(2))
+ }
bp := tls.Alloc(4)
defer tls.Free(4)
@@ -1031,6 +1094,9 @@ func Xwcsrtombs(tls *TLS, s uintptr, ws uintptr, n size_t, st uintptr) size_t {
}
func Xwcstombs(tls *TLS, s uintptr, ws uintptr, n size_t) size_t { /* wcstombs.c:4:8: */
+ if __ccgo_strace {
+ trc("tls=%v s=%v ws=%v n=%v, (%v:)", tls, s, ws, n, origin(2))
+ }
bp := tls.Alloc(4)
defer tls.Free(4)
*(*uintptr)(unsafe.Pointer(bp)) = ws
@@ -1049,6 +1115,9 @@ func Xwcstombs(tls *TLS, s uintptr, ws uintptr, n size_t) size_t { /* wcstombs.c
// from SUS and have nothing to do with the host system.
func X__strchrnul(tls *TLS, s uintptr, c int32) uintptr { /* strchrnul.c:10:6: */
+ if __ccgo_strace {
+ trc("tls=%v s=%v c=%v, (%v:)", tls, s, c, origin(2))
+ }
c = int32(uint8(c))
if !(c != 0) {
return s + uintptr(Xstrlen(tls, s))
@@ -1069,6 +1138,9 @@ func X__strchrnul(tls *TLS, s uintptr, c int32) uintptr { /* strchrnul.c:10:6: *
}
func Xstrdup(tls *TLS, s uintptr) uintptr { /* strdup.c:4:6: */
+ if __ccgo_strace {
+ trc("tls=%v s=%v, (%v:)", tls, s, origin(2))
+ }
var l size_t = Xstrlen(tls, s)
var d uintptr = Xmalloc(tls, l+size_t(1))
if !(d != 0) {
diff --git a/vendor/modernc.org/libc/musl_windows_amd64.go b/vendor/modernc.org/libc/musl_windows_amd64.go
index d586fb8b..e71c59fa 100644
--- a/vendor/modernc.org/libc/musl_windows_amd64.go
+++ b/vendor/modernc.org/libc/musl_windows_amd64.go
@@ -230,6 +230,9 @@ type __locale_struct = struct{ cat [6]uintptr } /* alltypes.h:343:9 */
type locale_t = uintptr /* alltypes.h:343:32 */
func Xisalnum(tls *TLS, c int32) int32 { /* isalnum.c:3:5: */
+ if __ccgo_strace {
+ trc("tls=%v c=%v, (%v:)", tls, c, origin(2))
+ }
return Bool32(func() int32 {
if 0 != 0 {
return Xisalpha(tls, c)
@@ -244,50 +247,86 @@ func Xisalnum(tls *TLS, c int32) int32 { /* isalnum.c:3:5: */
}
func X__isalnum_l(tls *TLS, c int32, l locale_t) int32 { /* isalnum.c:8:5: */
+ if __ccgo_strace {
+ trc("tls=%v c=%v l=%v, (%v:)", tls, c, l, origin(2))
+ }
return Xisalnum(tls, c)
}
func Xisalpha(tls *TLS, c int32) int32 { /* isalpha.c:4:5: */
+ if __ccgo_strace {
+ trc("tls=%v c=%v, (%v:)", tls, c, origin(2))
+ }
return Bool32(uint32(c)|uint32(32)-uint32('a') < uint32(26))
}
func X__isalpha_l(tls *TLS, c int32, l locale_t) int32 { /* isalpha.c:9:5: */
+ if __ccgo_strace {
+ trc("tls=%v c=%v l=%v, (%v:)", tls, c, l, origin(2))
+ }
return Xisalpha(tls, c)
}
func Xisdigit(tls *TLS, c int32) int32 { /* isdigit.c:4:5: */
+ if __ccgo_strace {
+ trc("tls=%v c=%v, (%v:)", tls, c, origin(2))
+ }
return Bool32(uint32(c)-uint32('0') < uint32(10))
}
func X__isdigit_l(tls *TLS, c int32, l locale_t) int32 { /* isdigit.c:9:5: */
+ if __ccgo_strace {
+ trc("tls=%v c=%v l=%v, (%v:)", tls, c, l, origin(2))
+ }
return Xisdigit(tls, c)
}
func Xislower(tls *TLS, c int32) int32 { /* islower.c:4:5: */
+ if __ccgo_strace {
+ trc("tls=%v c=%v, (%v:)", tls, c, origin(2))
+ }
return Bool32(uint32(c)-uint32('a') < uint32(26))
}
func X__islower_l(tls *TLS, c int32, l locale_t) int32 { /* islower.c:9:5: */
+ if __ccgo_strace {
+ trc("tls=%v c=%v l=%v, (%v:)", tls, c, l, origin(2))
+ }
return Xislower(tls, c)
}
func Xisprint(tls *TLS, c int32) int32 { /* isprint.c:4:5: */
+ if __ccgo_strace {
+ trc("tls=%v c=%v, (%v:)", tls, c, origin(2))
+ }
return Bool32(uint32(c)-uint32(0x20) < uint32(0x5f))
}
func X__isprint_l(tls *TLS, c int32, l locale_t) int32 { /* isprint.c:9:5: */
+ if __ccgo_strace {
+ trc("tls=%v c=%v l=%v, (%v:)", tls, c, l, origin(2))
+ }
return Xisprint(tls, c)
}
func Xisspace(tls *TLS, c int32) int32 { /* isspace.c:4:5: */
+ if __ccgo_strace {
+ trc("tls=%v c=%v, (%v:)", tls, c, origin(2))
+ }
return Bool32(c == ' ' || uint32(c)-uint32('\t') < uint32(5))
}
func X__isspace_l(tls *TLS, c int32, l locale_t) int32 { /* isspace.c:9:5: */
+ if __ccgo_strace {
+ trc("tls=%v c=%v l=%v, (%v:)", tls, c, l, origin(2))
+ }
return Xisspace(tls, c)
}
func Xisxdigit(tls *TLS, c int32) int32 { /* isxdigit.c:3:5: */
+ if __ccgo_strace {
+ trc("tls=%v c=%v, (%v:)", tls, c, origin(2))
+ }
return Bool32(func() int32 {
if 0 != 0 {
return Xisdigit(tls, c)
@@ -297,6 +336,9 @@ func Xisxdigit(tls *TLS, c int32) int32 { /* isxdigit.c:3:5: */
}
func X__isxdigit_l(tls *TLS, c int32, l locale_t) int32 { /* isxdigit.c:8:5: */
+ if __ccgo_strace {
+ trc("tls=%v c=%v l=%v, (%v:)", tls, c, l, origin(2))
+ }
return Xisxdigit(tls, c)
}
@@ -328,6 +370,9 @@ type gid_t = uint32 /* alltypes.h:250:18 */
type useconds_t = uint32 /* alltypes.h:260:18 */
func X__putenv(tls *TLS, s uintptr, l size_t, r uintptr) int32 { /* putenv.c:8:5: */
+ if __ccgo_strace {
+ trc("tls=%v s=%v l=%v r=%v, (%v:)", tls, s, l, r, origin(2))
+ }
var i size_t
var newenv uintptr
var tmp uintptr
@@ -408,6 +453,9 @@ oom:
var _soldenv uintptr /* putenv.c:22:14: */
func Xputenv(tls *TLS, s uintptr) int32 { /* putenv.c:43:5: */
+ if __ccgo_strace {
+ trc("tls=%v s=%v, (%v:)", tls, s, origin(2))
+ }
var l size_t = size_t((int64(X__strchrnul(tls, s, '=')) - int64(s)) / 1)
if !(l != 0) || !(int32(*(*int8)(unsafe.Pointer(s + uintptr(l)))) != 0) {
return Xunsetenv(tls, s)
@@ -416,6 +464,9 @@ func Xputenv(tls *TLS, s uintptr) int32 { /* putenv.c:43:5: */
}
func X__env_rm_add(tls *TLS, old uintptr, new uintptr) { /* setenv.c:5:6: */
+ if __ccgo_strace {
+ trc("tls=%v old=%v new=%v, (%v:)", tls, old, new, origin(2))
+ }
//TODO for (size_t i=0; i < env_alloced_n; i++)
var i size_t = uint64(0)
for ; i < _senv_alloced_n; i++ {
@@ -442,6 +493,9 @@ var _senv_alloced uintptr /* setenv.c:7:14: */
var _senv_alloced_n size_t /* setenv.c:8:16: */
func Xsetenv(tls *TLS, var1 uintptr, value uintptr, overwrite int32) int32 { /* setenv.c:26:5: */
+ if __ccgo_strace {
+ trc("tls=%v var1=%v value=%v overwrite=%v, (%v:)", tls, var1, value, overwrite, origin(2))
+ }
var s uintptr
var l1 size_t
var l2 size_t
@@ -466,6 +520,9 @@ func Xsetenv(tls *TLS, var1 uintptr, value uintptr, overwrite int32) int32 { /*
}
func Xunsetenv(tls *TLS, name uintptr) int32 { /* unsetenv.c:9:5: */
+ if __ccgo_strace {
+ trc("tls=%v name=%v, (%v:)", tls, name, origin(2))
+ }
var l size_t = size_t((int64(X__strchrnul(tls, name, '=')) - int64(name)) / 1)
if !(l != 0) || *(*int8)(unsafe.Pointer(name + uintptr(l))) != 0 {
*(*int32)(unsafe.Pointer(X___errno_location(tls))) = 22
@@ -945,6 +1002,9 @@ func __pthread_self(tls *TLS) uintptr { /* pthread_arch.h:1:30: */
}
func Xwcrtomb(tls *TLS, s uintptr, wc wchar_t, st uintptr) size_t { /* wcrtomb.c:6:8: */
+ if __ccgo_strace {
+ trc("tls=%v s=%v wc=%v st=%v, (%v:)", tls, s, wc, st, origin(2))
+ }
if !(s != 0) {
return uint64(1)
}
@@ -984,6 +1044,9 @@ func Xwcrtomb(tls *TLS, s uintptr, wc wchar_t, st uintptr) size_t { /* wcrtomb.c
}
func Xwcsrtombs(tls *TLS, s uintptr, ws uintptr, n size_t, st uintptr) size_t { /* wcsrtombs.c:3:8: */
+ if __ccgo_strace {
+ trc("tls=%v s=%v ws=%v n=%v st=%v, (%v:)", tls, s, ws, n, st, origin(2))
+ }
bp := tls.Alloc(4)
defer tls.Free(4)
@@ -1054,6 +1117,9 @@ func Xwcsrtombs(tls *TLS, s uintptr, ws uintptr, n size_t, st uintptr) size_t {
}
func Xwcstombs(tls *TLS, s uintptr, ws uintptr, n size_t) size_t { /* wcstombs.c:4:8: */
+ if __ccgo_strace {
+ trc("tls=%v s=%v ws=%v n=%v, (%v:)", tls, s, ws, n, origin(2))
+ }
bp := tls.Alloc(8)
defer tls.Free(8)
*(*uintptr)(unsafe.Pointer(bp)) = ws
@@ -1063,6 +1129,9 @@ func Xwcstombs(tls *TLS, s uintptr, ws uintptr, n size_t) size_t { /* wcstombs.c
}
func Xbsearch(tls *TLS, key uintptr, base uintptr, nel size_t, width size_t, cmp uintptr) uintptr { /* bsearch.c:3:6: */
+ if __ccgo_strace {
+ trc("tls=%v key=%v base=%v nel=%v width=%v cmp=%v, (%v:)", tls, key, base, nel, width, cmp, origin(2))
+ }
var try uintptr
var sign int32
for nel > uint64(0) {
@@ -1092,6 +1161,9 @@ func Xbsearch(tls *TLS, key uintptr, base uintptr, nel size_t, width size_t, cmp
// from SUS and have nothing to do with the host system.
func X__strchrnul(tls *TLS, s uintptr, c int32) uintptr { /* strchrnul.c:10:6: */
+ if __ccgo_strace {
+ trc("tls=%v s=%v c=%v, (%v:)", tls, s, c, origin(2))
+ }
c = int32(uint8(c))
if !(c != 0) {
return s + uintptr(Xstrlen(tls, s))
@@ -1112,6 +1184,9 @@ func X__strchrnul(tls *TLS, s uintptr, c int32) uintptr { /* strchrnul.c:10:6: *
}
func Xstrdup(tls *TLS, s uintptr) uintptr { /* strdup.c:4:6: */
+ if __ccgo_strace {
+ trc("tls=%v s=%v, (%v:)", tls, s, origin(2))
+ }
var l size_t = Xstrlen(tls, s)
var d uintptr = Xmalloc(tls, l+uint64(1))
if !(d != 0) {
diff --git a/vendor/modernc.org/libc/musl_windows_arm64.go b/vendor/modernc.org/libc/musl_windows_arm64.go
index 2804cdc9..f370a01a 100644
--- a/vendor/modernc.org/libc/musl_windows_arm64.go
+++ b/vendor/modernc.org/libc/musl_windows_arm64.go
@@ -230,6 +230,9 @@ type __locale_struct = struct{ cat [6]uintptr } /* alltypes.h:351:9 */
type locale_t = uintptr /* alltypes.h:351:32 */
func Xisalnum(tls *TLS, c int32) int32 { /* isalnum.c:3:5: */
+ if __ccgo_strace {
+ trc("tls=%v c=%v, (%v:)", tls, c, origin(2))
+ }
return Bool32(func() int32 {
if 0 != 0 {
return Xisalpha(tls, c)
@@ -244,50 +247,86 @@ func Xisalnum(tls *TLS, c int32) int32 { /* isalnum.c:3:5: */
}
func X__isalnum_l(tls *TLS, c int32, l locale_t) int32 { /* isalnum.c:8:5: */
+ if __ccgo_strace {
+ trc("tls=%v c=%v l=%v, (%v:)", tls, c, l, origin(2))
+ }
return Xisalnum(tls, c)
}
func Xisalpha(tls *TLS, c int32) int32 { /* isalpha.c:4:5: */
+ if __ccgo_strace {
+ trc("tls=%v c=%v, (%v:)", tls, c, origin(2))
+ }
return Bool32(uint32(c)|uint32(32)-uint32('a') < uint32(26))
}
func X__isalpha_l(tls *TLS, c int32, l locale_t) int32 { /* isalpha.c:9:5: */
+ if __ccgo_strace {
+ trc("tls=%v c=%v l=%v, (%v:)", tls, c, l, origin(2))
+ }
return Xisalpha(tls, c)
}
func Xisdigit(tls *TLS, c int32) int32 { /* isdigit.c:4:5: */
+ if __ccgo_strace {
+ trc("tls=%v c=%v, (%v:)", tls, c, origin(2))
+ }
return Bool32(uint32(c)-uint32('0') < uint32(10))
}
func X__isdigit_l(tls *TLS, c int32, l locale_t) int32 { /* isdigit.c:9:5: */
+ if __ccgo_strace {
+ trc("tls=%v c=%v l=%v, (%v:)", tls, c, l, origin(2))
+ }
return Xisdigit(tls, c)
}
func Xislower(tls *TLS, c int32) int32 { /* islower.c:4:5: */
+ if __ccgo_strace {
+ trc("tls=%v c=%v, (%v:)", tls, c, origin(2))
+ }
return Bool32(uint32(c)-uint32('a') < uint32(26))
}
func X__islower_l(tls *TLS, c int32, l locale_t) int32 { /* islower.c:9:5: */
+ if __ccgo_strace {
+ trc("tls=%v c=%v l=%v, (%v:)", tls, c, l, origin(2))
+ }
return Xislower(tls, c)
}
func Xisprint(tls *TLS, c int32) int32 { /* isprint.c:4:5: */
+ if __ccgo_strace {
+ trc("tls=%v c=%v, (%v:)", tls, c, origin(2))
+ }
return Bool32(uint32(c)-uint32(0x20) < uint32(0x5f))
}
func X__isprint_l(tls *TLS, c int32, l locale_t) int32 { /* isprint.c:9:5: */
+ if __ccgo_strace {
+ trc("tls=%v c=%v l=%v, (%v:)", tls, c, l, origin(2))
+ }
return Xisprint(tls, c)
}
func Xisspace(tls *TLS, c int32) int32 { /* isspace.c:4:5: */
+ if __ccgo_strace {
+ trc("tls=%v c=%v, (%v:)", tls, c, origin(2))
+ }
return Bool32(c == ' ' || uint32(c)-uint32('\t') < uint32(5))
}
func X__isspace_l(tls *TLS, c int32, l locale_t) int32 { /* isspace.c:9:5: */
+ if __ccgo_strace {
+ trc("tls=%v c=%v l=%v, (%v:)", tls, c, l, origin(2))
+ }
return Xisspace(tls, c)
}
func Xisxdigit(tls *TLS, c int32) int32 { /* isxdigit.c:3:5: */
+ if __ccgo_strace {
+ trc("tls=%v c=%v, (%v:)", tls, c, origin(2))
+ }
return Bool32(func() int32 {
if 0 != 0 {
return Xisdigit(tls, c)
@@ -297,6 +336,9 @@ func Xisxdigit(tls *TLS, c int32) int32 { /* isxdigit.c:3:5: */
}
func X__isxdigit_l(tls *TLS, c int32, l locale_t) int32 { /* isxdigit.c:8:5: */
+ if __ccgo_strace {
+ trc("tls=%v c=%v l=%v, (%v:)", tls, c, l, origin(2))
+ }
return Xisxdigit(tls, c)
}
@@ -328,6 +370,9 @@ type gid_t = uint32 /* alltypes.h:258:18 */
type useconds_t = uint32 /* alltypes.h:268:18 */
func X__putenv(tls *TLS, s uintptr, l size_t, r uintptr) int32 { /* putenv.c:8:5: */
+ if __ccgo_strace {
+ trc("tls=%v s=%v l=%v r=%v, (%v:)", tls, s, l, r, origin(2))
+ }
var i size_t
var newenv uintptr
var tmp uintptr
@@ -408,6 +453,9 @@ oom:
var _soldenv uintptr /* putenv.c:22:14: */
func Xputenv(tls *TLS, s uintptr) int32 { /* putenv.c:43:5: */
+ if __ccgo_strace {
+ trc("tls=%v s=%v, (%v:)", tls, s, origin(2))
+ }
var l size_t = size_t((int64(X__strchrnul(tls, s, '=')) - int64(s)) / 1)
if !(l != 0) || !(int32(*(*int8)(unsafe.Pointer(s + uintptr(l)))) != 0) {
return Xunsetenv(tls, s)
@@ -416,6 +464,9 @@ func Xputenv(tls *TLS, s uintptr) int32 { /* putenv.c:43:5: */
}
func X__env_rm_add(tls *TLS, old uintptr, new uintptr) { /* setenv.c:5:6: */
+ if __ccgo_strace {
+ trc("tls=%v old=%v new=%v, (%v:)", tls, old, new, origin(2))
+ }
//TODO for (size_t i=0; i < env_alloced_n; i++)
var i size_t = uint64(0)
for ; i < _senv_alloced_n; i++ {
@@ -442,6 +493,9 @@ var _senv_alloced uintptr /* setenv.c:7:14: */
var _senv_alloced_n size_t /* setenv.c:8:16: */
func Xsetenv(tls *TLS, var1 uintptr, value uintptr, overwrite int32) int32 { /* setenv.c:26:5: */
+ if __ccgo_strace {
+ trc("tls=%v var1=%v value=%v overwrite=%v, (%v:)", tls, var1, value, overwrite, origin(2))
+ }
var s uintptr
var l1 size_t
var l2 size_t
@@ -466,6 +520,9 @@ func Xsetenv(tls *TLS, var1 uintptr, value uintptr, overwrite int32) int32 { /*
}
func Xunsetenv(tls *TLS, name uintptr) int32 { /* unsetenv.c:9:5: */
+ if __ccgo_strace {
+ trc("tls=%v name=%v, (%v:)", tls, name, origin(2))
+ }
var l size_t = size_t((int64(X__strchrnul(tls, name, '=')) - int64(name)) / 1)
if !(l != 0) || *(*int8)(unsafe.Pointer(name + uintptr(l))) != 0 {
*(*int32)(unsafe.Pointer(X___errno_location(tls))) = 22
@@ -1023,6 +1080,9 @@ func __pthread_self(tls *TLS) uintptr { /* pthread_arch.h:1:30: */
}
func Xwcrtomb(tls *TLS, s uintptr, wc wchar_t, st uintptr) size_t { /* wcrtomb.c:6:8: */
+ if __ccgo_strace {
+ trc("tls=%v s=%v wc=%v st=%v, (%v:)", tls, s, wc, st, origin(2))
+ }
if !(s != 0) {
return uint64(1)
}
@@ -1062,6 +1122,9 @@ func Xwcrtomb(tls *TLS, s uintptr, wc wchar_t, st uintptr) size_t { /* wcrtomb.c
}
func Xwcsrtombs(tls *TLS, s uintptr, ws uintptr, n size_t, st uintptr) size_t { /* wcsrtombs.c:3:8: */
+ if __ccgo_strace {
+ trc("tls=%v s=%v ws=%v n=%v st=%v, (%v:)", tls, s, ws, n, st, origin(2))
+ }
bp := tls.Alloc(4)
defer tls.Free(4)
@@ -1132,6 +1195,9 @@ func Xwcsrtombs(tls *TLS, s uintptr, ws uintptr, n size_t, st uintptr) size_t {
}
func Xwcstombs(tls *TLS, s uintptr, ws uintptr, n size_t) size_t { /* wcstombs.c:4:8: */
+ if __ccgo_strace {
+ trc("tls=%v s=%v ws=%v n=%v, (%v:)", tls, s, ws, n, origin(2))
+ }
bp := tls.Alloc(8)
defer tls.Free(8)
*(*uintptr)(unsafe.Pointer(bp)) = ws
@@ -1141,6 +1207,9 @@ func Xwcstombs(tls *TLS, s uintptr, ws uintptr, n size_t) size_t { /* wcstombs.c
}
func Xbsearch(tls *TLS, key uintptr, base uintptr, nel size_t, width size_t, cmp uintptr) uintptr { /* bsearch.c:3:6: */
+ if __ccgo_strace {
+ trc("tls=%v key=%v base=%v nel=%v width=%v cmp=%v, (%v:)", tls, key, base, nel, width, cmp, origin(2))
+ }
var try uintptr
var sign int32
for nel > uint64(0) {
@@ -1170,6 +1239,9 @@ func Xbsearch(tls *TLS, key uintptr, base uintptr, nel size_t, width size_t, cmp
// from SUS and have nothing to do with the host system.
func X__strchrnul(tls *TLS, s uintptr, c int32) uintptr { /* strchrnul.c:10:6: */
+ if __ccgo_strace {
+ trc("tls=%v s=%v c=%v, (%v:)", tls, s, c, origin(2))
+ }
c = int32(uint8(c))
if !(c != 0) {
return s + uintptr(Xstrlen(tls, s))
@@ -1190,6 +1262,9 @@ func X__strchrnul(tls *TLS, s uintptr, c int32) uintptr { /* strchrnul.c:10:6: *
}
func Xstrdup(tls *TLS, s uintptr) uintptr { /* strdup.c:4:6: */
+ if __ccgo_strace {
+ trc("tls=%v s=%v, (%v:)", tls, s, origin(2))
+ }
var l size_t = Xstrlen(tls, s)
var d uintptr = Xmalloc(tls, l+uint64(1))
if !(d != 0) {
diff --git a/vendor/modernc.org/libc/printf.go b/vendor/modernc.org/libc/printf.go
index a26ad40e..20c7ed1b 100644
--- a/vendor/modernc.org/libc/printf.go
+++ b/vendor/modernc.org/libc/printf.go
@@ -38,17 +38,17 @@ const (
// the output stream; and conversion specifications, each of which results in
// fetching zero or more subsequent arguments.
func printf(format, args uintptr) []byte {
- format0 := format
- args0 := args
+ // format0 := format
+ // args0 := args
buf := bytes.NewBuffer(nil)
for {
switch c := *(*byte)(unsafe.Pointer(format)); c {
case '%':
format = printfConversion(buf, format, &args)
case 0:
- if dmesgs {
- dmesg("%v: %q, %#x -> %q", origin(1), GoString(format0), args0, buf.Bytes())
- }
+ // if dmesgs {
+ // dmesg("%v: %q, %#x -> %q", origin(1), GoString(format0), args0, buf.Bytes())
+ // }
return buf.Bytes()
default:
format++
@@ -141,7 +141,7 @@ more:
mod = modNone
}
switch mod {
- case modL, modLL, mod64:
+ case modL, modLL, mod64, modJ:
arg = VaInt64(args)
case modH:
arg = int64(int16(VaInt32(args)))
@@ -149,6 +149,8 @@ more:
arg = int64(int8(VaInt32(args)))
case mod32, modNone:
arg = int64(VaInt32(args))
+ case modT:
+ arg = int64(VaInt64(args))
default:
panic(todo("", mod))
}
@@ -185,6 +187,8 @@ more:
arg = uint64(uint8(VaInt32(args)))
case mod32:
arg = uint64(VaInt32(args))
+ case modZ:
+ arg = uint64(VaInt64(args))
default:
panic(todo("", mod))
}
@@ -235,6 +239,38 @@ more:
f := spec + "o"
str = fmt.Sprintf(f, arg)
+ case 'b':
+ // Base 2.
+ format++
+ var arg uint64
+ if isWindows && mod == modL {
+ mod = modNone
+ }
+ switch mod {
+ case modNone:
+ arg = uint64(VaUint32(args))
+ case modL, modLL, mod64:
+ arg = VaUint64(args)
+ case modH:
+ arg = uint64(uint16(VaInt32(args)))
+ case modHH:
+ arg = uint64(uint8(VaInt32(args)))
+ case mod32:
+ arg = uint64(VaInt32(args))
+ default:
+ panic(todo("", mod))
+ }
+
+ if arg == 0 && hasPrecision && prec == 0 {
+ break
+ }
+
+ if hasPrecision {
+ panic(todo("", prec))
+ }
+
+ f := spec + "b"
+ str = fmt.Sprintf(f, arg)
case 'I':
if !isWindows {
panic(todo("%#U", c))
@@ -609,13 +645,18 @@ func parseLengthModifier(format uintptr) (_ uintptr, n int) {
n = modLD
return format, n
case 'j':
- panic(todo(""))
+ format++
+ n = modJ
+ return format, n
case 'z':
- panic(todo(""))
+ format++
+ return format, modZ
case 'Z':
- panic(todo(""))
+ format++
+ return format, modCapitalZ
case 't':
- panic(todo(""))
+ format++
+ return format, modT
default:
return format, 0
}
diff --git a/vendor/modernc.org/libc/pthread.go b/vendor/modernc.org/libc/pthread.go
index 06792905..f47156a8 100644
--- a/vendor/modernc.org/libc/pthread.go
+++ b/vendor/modernc.org/libc/pthread.go
@@ -34,7 +34,9 @@ var (
// Thread local storage.
type TLS struct {
- errnop uintptr
+ errnop uintptr
+ allocaStack [][]uintptr
+ allocas []uintptr
pthreadData
stack stackHeader
@@ -61,6 +63,39 @@ func newTLS(detached bool) *TLS {
return t
}
+func (t *TLS) alloca(n size_t) (r uintptr) {
+ r = Xmalloc(t, n)
+ t.allocas = append(t.allocas, r)
+ return r
+}
+
+func (t *TLS) FreeAlloca() func() {
+ t.allocaStack = append(t.allocaStack, t.allocas)
+ t.allocas = nil
+ return func() {
+ for _, v := range t.allocas {
+ Xfree(t, v)
+ }
+ n := len(t.allocaStack)
+ t.allocas = t.allocaStack[n-1]
+ t.allocaStack = t.allocaStack[:n-1]
+ }
+}
+
+func Xalloca(tls *TLS, size size_t) uintptr {
+ if __ccgo_strace {
+ trc("tls=%v size=%v, (%v:)", tls, size, origin(2))
+ }
+ return tls.alloca(size)
+}
+
+func X__builtin_alloca(tls *TLS, size size_t) uintptr {
+ if __ccgo_strace {
+ trc("tls=%v size=%v, (%v:)", tls, size, origin(2))
+ }
+ return Xalloca(tls, size)
+}
+
// Pthread specific part of a TLS.
type pthreadData struct {
done chan struct{}
@@ -97,11 +132,17 @@ func (d *pthreadData) close(t *TLS) {
// int pthread_attr_destroy(pthread_attr_t *attr);
func Xpthread_attr_destroy(t *TLS, pAttr uintptr) int32 {
+ if __ccgo_strace {
+ trc("t=%v pAttr=%v, (%v:)", t, pAttr, origin(2))
+ }
return 0
}
// int pthread_attr_setscope(pthread_attr_t *attr, int contentionscope);
func Xpthread_attr_setscope(t *TLS, pAttr uintptr, contentionScope int32) int32 {
+ if __ccgo_strace {
+ trc("t=%v pAttr=%v contentionScope=%v, (%v:)", t, pAttr, contentionScope, origin(2))
+ }
switch contentionScope {
case pthread.PTHREAD_SCOPE_SYSTEM:
return 0
@@ -112,6 +153,9 @@ func Xpthread_attr_setscope(t *TLS, pAttr uintptr, contentionScope int32) int32
// int pthread_attr_setstacksize(pthread_attr_t *attr, size_t stacksize);
func Xpthread_attr_setstacksize(t *TLS, attr uintptr, stackSize types.Size_t) int32 {
+ if __ccgo_strace {
+ trc("t=%v attr=%v stackSize=%v, (%v:)", t, attr, stackSize, origin(2))
+ }
panic(todo(""))
}
@@ -161,6 +205,9 @@ func (c *cond) signal(all bool) int32 {
//
// int pthread_cond_init(pthread_cond_t *restrict cond, const pthread_condattr_t *restrict attr);
func Xpthread_cond_init(t *TLS, pCond, pAttr uintptr) int32 {
+ if __ccgo_strace {
+ trc("t=%v pAttr=%v, (%v:)", t, pAttr, origin(2))
+ }
if pCond == 0 {
return errno.EINVAL
}
@@ -179,6 +226,9 @@ func Xpthread_cond_init(t *TLS, pCond, pAttr uintptr) int32 {
// int pthread_cond_destroy(pthread_cond_t *cond);
func Xpthread_cond_destroy(t *TLS, pCond uintptr) int32 {
+ if __ccgo_strace {
+ trc("t=%v pCond=%v, (%v:)", t, pCond, origin(2))
+ }
if pCond == 0 {
return errno.EINVAL
}
@@ -206,11 +256,17 @@ func Xpthread_cond_destroy(t *TLS, pCond uintptr) int32 {
// int pthread_cond_signal(pthread_cond_t *cond);
func Xpthread_cond_signal(t *TLS, pCond uintptr) int32 {
+ if __ccgo_strace {
+ trc("t=%v pCond=%v, (%v:)", t, pCond, origin(2))
+ }
return condSignal(pCond, false)
}
// int pthread_cond_broadcast(pthread_cond_t *cond);
func Xpthread_cond_broadcast(t *TLS, pCond uintptr) int32 {
+ if __ccgo_strace {
+ trc("t=%v pCond=%v, (%v:)", t, pCond, origin(2))
+ }
return condSignal(pCond, true)
}
@@ -228,6 +284,9 @@ func condSignal(pCond uintptr, all bool) int32 {
// int pthread_cond_wait(pthread_cond_t *restrict cond, pthread_mutex_t *restrict mutex);
func Xpthread_cond_wait(t *TLS, pCond, pMutex uintptr) int32 {
+ if __ccgo_strace {
+ trc("t=%v pMutex=%v, (%v:)", t, pMutex, origin(2))
+ }
if pCond == 0 {
return errno.EINVAL
}
@@ -257,6 +316,9 @@ func Xpthread_cond_wait(t *TLS, pCond, pMutex uintptr) int32 {
// int pthread_cond_timedwait(pthread_cond_t *restrict cond, pthread_mutex_t *restrict mutex, const struct timespec *restrict abstime);
func Xpthread_cond_timedwait(t *TLS, pCond, pMutex, pAbsTime uintptr) int32 {
+ if __ccgo_strace {
+ trc("t=%v pAbsTime=%v, (%v:)", t, pAbsTime, origin(2))
+ }
if pCond == 0 {
return errno.EINVAL
}
@@ -428,6 +490,9 @@ func (m *mutex) unlock() int32 {
// int pthread_mutex_destroy(pthread_mutex_t *mutex);
func Xpthread_mutex_destroy(t *TLS, pMutex uintptr) int32 {
+ if __ccgo_strace {
+ trc("t=%v pMutex=%v, (%v:)", t, pMutex, origin(2))
+ }
mutexesMu.Lock()
defer mutexesMu.Unlock()
@@ -438,6 +503,9 @@ func Xpthread_mutex_destroy(t *TLS, pMutex uintptr) int32 {
// int pthread_mutex_lock(pthread_mutex_t *mutex);
func Xpthread_mutex_lock(t *TLS, pMutex uintptr) int32 {
+ if __ccgo_strace {
+ trc("t=%v pMutex=%v, (%v:)", t, pMutex, origin(2))
+ }
mutexesMu.Lock()
mu := mutexes[pMutex]
if mu == nil { // static initialized mutexes are valid
@@ -450,6 +518,9 @@ func Xpthread_mutex_lock(t *TLS, pMutex uintptr) int32 {
// int pthread_mutex_trylock(pthread_mutex_t *mutex);
func Xpthread_mutex_trylock(t *TLS, pMutex uintptr) int32 {
+ if __ccgo_strace {
+ trc("t=%v pMutex=%v, (%v:)", t, pMutex, origin(2))
+ }
mutexesMu.Lock()
mu := mutexes[pMutex]
if mu == nil { // static initialized mutexes are valid
@@ -462,6 +533,9 @@ func Xpthread_mutex_trylock(t *TLS, pMutex uintptr) int32 {
// int pthread_mutex_unlock(pthread_mutex_t *mutex);
func Xpthread_mutex_unlock(t *TLS, pMutex uintptr) int32 {
+ if __ccgo_strace {
+ trc("t=%v pMutex=%v, (%v:)", t, pMutex, origin(2))
+ }
mutexesMu.Lock()
defer mutexesMu.Unlock()
@@ -486,6 +560,9 @@ func Xpthread_key_create(t *TLS, pKey, destructor uintptr) int32 {
// int pthread_key_delete(pthread_key_t key);
func Xpthread_key_delete(t *TLS, key pthread.Pthread_key_t) int32 {
+ if __ccgo_strace {
+ trc("t=%v key=%v, (%v:)", t, key, origin(2))
+ }
if _, ok := t.kv[key]; ok {
delete(t.kv, key)
return 0
@@ -497,11 +574,17 @@ func Xpthread_key_delete(t *TLS, key pthread.Pthread_key_t) int32 {
// void *pthread_getspecific(pthread_key_t key);
func Xpthread_getspecific(t *TLS, key pthread.Pthread_key_t) uintptr {
+ if __ccgo_strace {
+ trc("t=%v key=%v, (%v:)", t, key, origin(2))
+ }
return t.kv[key]
}
// int pthread_setspecific(pthread_key_t key, const void *value);
func Xpthread_setspecific(t *TLS, key pthread.Pthread_key_t, value uintptr) int32 {
+ if __ccgo_strace {
+ trc("t=%v key=%v value=%v, (%v:)", t, key, value, origin(2))
+ }
if t.kv == nil {
t.kv = map[pthread.Pthread_key_t]uintptr{}
}
@@ -511,6 +594,9 @@ func Xpthread_setspecific(t *TLS, key pthread.Pthread_key_t, value uintptr) int3
// int pthread_create(pthread_t *thread, const pthread_attr_t *attr, void *(*start_routine) (void *), void *arg);
func Xpthread_create(t *TLS, pThread, pAttr, startRoutine, arg uintptr) int32 {
+ if __ccgo_strace {
+ trc("t=%v arg=%v, (%v:)", t, arg, origin(2))
+ }
fn := (*struct {
f func(*TLS, uintptr) uintptr
})(unsafe.Pointer(&struct{ uintptr }{startRoutine})).f
@@ -527,6 +613,9 @@ func Xpthread_create(t *TLS, pThread, pAttr, startRoutine, arg uintptr) int32 {
// int pthread_detach(pthread_t thread);
func Xpthread_detach(t *TLS, thread pthread.Pthread_t) int32 {
+ if __ccgo_strace {
+ trc("t=%v thread=%v, (%v:)", t, thread, origin(2))
+ }
threadsMu.Lock()
threads[int32(thread)].detached = true
threadsMu.Unlock()
@@ -535,11 +624,17 @@ func Xpthread_detach(t *TLS, thread pthread.Pthread_t) int32 {
// int pthread_equal(pthread_t t1, pthread_t t2);
func Xpthread_equal(t *TLS, t1, t2 pthread.Pthread_t) int32 {
+ if __ccgo_strace {
+ trc("t=%v t2=%v, (%v:)", t, t2, origin(2))
+ }
return Bool32(t1 == t2)
}
// void pthread_exit(void *value_ptr);
func Xpthread_exit(t *TLS, value uintptr) {
+ if __ccgo_strace {
+ trc("t=%v value=%v, (%v:)", t, value, origin(2))
+ }
t.retVal = value
// At thread exit, if a key value has a non-NULL destructor pointer, and the
@@ -576,6 +671,9 @@ func Xpthread_exit(t *TLS, value uintptr) {
// int pthread_join(pthread_t thread, void **value_ptr);
func Xpthread_join(t *TLS, thread pthread.Pthread_t, pValue uintptr) int32 {
+ if __ccgo_strace {
+ trc("t=%v thread=%v pValue=%v, (%v:)", t, thread, pValue, origin(2))
+ }
threadsMu.Lock()
tls := threads[int32(thread)]
delete(threads, int32(thread))
@@ -589,5 +687,8 @@ func Xpthread_join(t *TLS, thread pthread.Pthread_t, pValue uintptr) int32 {
// pthread_t pthread_self(void);
func Xpthread_self(t *TLS) pthread.Pthread_t {
+ if __ccgo_strace {
+ trc("t=%v, (%v:)", t, origin(2))
+ }
return pthread.Pthread_t(t.ID)
}
diff --git a/vendor/modernc.org/libc/pthread_all.go b/vendor/modernc.org/libc/pthread_all.go
index 4e2b7f10..2b23b585 100644
--- a/vendor/modernc.org/libc/pthread_all.go
+++ b/vendor/modernc.org/libc/pthread_all.go
@@ -15,6 +15,9 @@ import (
// int pthread_attr_init(pthread_attr_t *attr);
func Xpthread_attr_init(t *TLS, pAttr uintptr) int32 {
+ if __ccgo_strace {
+ trc("t=%v pAttr=%v, (%v:)", t, pAttr, origin(2))
+ }
*(*pthread.Pthread_attr_t)(unsafe.Pointer(pAttr)) = pthread.Pthread_attr_t{}
return 0
}
@@ -31,6 +34,9 @@ func Xpthread_attr_init(t *TLS, pAttr uintptr) int32 {
//
// int pthread_mutex_init(pthread_mutex_t *restrict mutex, const pthread_mutexattr_t *restrict attr);
func Xpthread_mutex_init(t *TLS, pMutex, pAttr uintptr) int32 {
+ if __ccgo_strace {
+ trc("t=%v pAttr=%v, (%v:)", t, pAttr, origin(2))
+ }
typ := pthread.PTHREAD_MUTEX_DEFAULT
if pAttr != 0 {
typ = int(X__ccgo_pthreadMutexattrGettype(t, pAttr))
diff --git a/vendor/modernc.org/libc/scanf.go b/vendor/modernc.org/libc/scanf.go
index ead0830e..cc35da35 100644
--- a/vendor/modernc.org/libc/scanf.go
+++ b/vendor/modernc.org/libc/scanf.go
@@ -5,7 +5,8 @@
package libc // import "modernc.org/libc"
import (
- "strings"
+ "io"
+ "strconv"
"unsafe"
)
@@ -15,7 +16,7 @@ import (
// be either of the following: input failure, meaning that input characters
// were unavailable, or matching failure, meaning that the input was
// inappropriate.
-func scanf(r *strings.Reader, format, args uintptr) (nvalues int32) {
+func scanf(r io.ByteScanner, format, args uintptr) (nvalues int32) {
// var src []byte //TODO-
var ok bool
out:
@@ -75,7 +76,7 @@ out:
return -1 // stdio.EOF but not defined for windows
}
-func scanfConversion(r *strings.Reader, format uintptr, args *uintptr) (_ uintptr, nvalues int, match bool) {
+func scanfConversion(r io.ByteScanner, format uintptr, args *uintptr) (_ uintptr, nvalues int, match bool) {
format++ // '%'
// Each conversion specification in format begins with either the character '%'
@@ -157,7 +158,7 @@ flags:
break dec
}
- panic(todo("", err))
+ return 0, 0, false
}
if allowSign {
@@ -301,7 +302,38 @@ flags:
// Matches an optionally signed floating-point number; the next pointer must be
// a pointer to float.
format++
- panic(todo(""))
+ skipReaderWhiteSpace(r)
+ seq := fpLiteral(r)
+ if len(seq) == 0 {
+ return 0, 0, false
+ }
+
+ var neg bool
+ switch seq[0] {
+ case '+':
+ seq = seq[1:]
+ case '-':
+ neg = true
+ seq = seq[1:]
+ }
+ n, err := strconv.ParseFloat(string(seq), 64)
+ if err != nil {
+ panic(todo("", err))
+ }
+
+ arg := VaUintptr(args)
+ if neg {
+ n = -n
+ }
+ switch mod {
+ case modNone:
+ *(*float32)(unsafe.Pointer(arg)) = float32(n)
+ case modL:
+ *(*float64)(unsafe.Pointer(arg)) = n
+ default:
+ panic(todo("", mod, neg, n))
+ }
+ return format, 1, true
case 's':
// Matches a sequence of non-white-space characters; the next pointer must be
// a pointer to the initial element of a character array that is long enough to
@@ -414,7 +446,7 @@ flags:
return format, nvalues, match
}
-func skipReaderWhiteSpace(r *strings.Reader) error {
+func skipReaderWhiteSpace(r io.ByteScanner) error {
for {
c, err := r.ReadByte()
if err != nil {
@@ -441,3 +473,157 @@ func skipWhiteSpace(s uintptr) uintptr {
}
}
}
+
+// [-+]?([0-9]*[.])?[0-9]+([eE][-+]?\d+)?
+func fpLiteral(rd io.ByteScanner) (seq []byte) {
+ const endOfText = 0x110000
+ var pos, width, length int
+
+ defer func() {
+ if len(seq) > length {
+ rd.UnreadByte()
+ seq = seq[:len(seq)-1]
+ }
+ }()
+
+ var r rune
+ step := func(pos int) (rune, int) {
+ b, err := rd.ReadByte()
+ if err != nil {
+ return endOfText, 0
+ }
+
+ seq = append(seq, b)
+ return rune(b), 1
+ }
+ move := func() {
+ pos += width
+ if r != endOfText {
+ r, width = step(pos + width)
+ }
+ }
+ accept := func(x rune) bool {
+ if r == x {
+ move()
+ return true
+ }
+ return false
+ }
+ accept2 := func(x rune) bool {
+ if r <= x {
+ move()
+ return true
+ }
+ return false
+ }
+ r = endOfText
+ width = 0
+ r, width = step(pos)
+ if accept('.') {
+ goto l7
+ }
+ if accept('+') {
+ goto l30
+ }
+ if accept('-') {
+ goto l30
+ }
+ if r < '0' {
+ goto l4out
+ }
+ if accept2('9') {
+ goto l35
+ }
+l4out:
+ return seq
+l7:
+ if r < '0' {
+ goto l7out
+ }
+ if accept2('9') {
+ goto l10
+ }
+l7out:
+ return seq
+l10:
+ length = pos
+ if accept('E') {
+ goto l18
+ }
+ if accept('e') {
+ goto l18
+ }
+ if r < '0' {
+ goto l15out
+ }
+ if accept2('9') {
+ goto l10
+ }
+l15out:
+ return seq
+l18:
+ if accept('+') {
+ goto l23
+ }
+ if accept('-') {
+ goto l23
+ }
+ if r < '0' {
+ goto l20out
+ }
+ if accept2('9') {
+ goto l26
+ }
+l20out:
+ return seq
+l23:
+ if r < '0' {
+ goto l23out
+ }
+ if accept2('9') {
+ goto l26
+ }
+l23out:
+ return seq
+l26:
+ length = pos
+ if r < '0' {
+ goto l27out
+ }
+ if accept2('9') {
+ goto l26
+ }
+l27out:
+ return seq
+l30:
+ if accept('.') {
+ goto l7
+ }
+ if r < '0' {
+ goto l32out
+ }
+ if accept2('9') {
+ goto l35
+ }
+l32out:
+ return seq
+l35:
+ length = pos
+ if accept('.') {
+ goto l7
+ }
+ if accept('E') {
+ goto l18
+ }
+ if accept('e') {
+ goto l18
+ }
+ if r < '0' {
+ goto l42out
+ }
+ if accept2('9') {
+ goto l35
+ }
+l42out:
+ return seq
+}
diff --git a/vendor/modernc.org/libc/straceoff.go b/vendor/modernc.org/libc/straceoff.go
new file mode 100644
index 00000000..f955d54b
--- /dev/null
+++ b/vendor/modernc.org/libc/straceoff.go
@@ -0,0 +1,10 @@
+// Copyright 2023 The Libc Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style
+// license that can be found in the LICENSE file.
+
+//go:build !libc.strace
+// +build !libc.strace
+
+package libc // import "modernc.org/libc"
+
+const __ccgo_strace = false
diff --git a/vendor/modernc.org/libc/straceon.go b/vendor/modernc.org/libc/straceon.go
new file mode 100644
index 00000000..ac8c73fb
--- /dev/null
+++ b/vendor/modernc.org/libc/straceon.go
@@ -0,0 +1,10 @@
+// Copyright 2023 The Libc Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style
+// license that can be found in the LICENSE file.
+
+//go:build libc.strace
+// +build libc.strace
+
+package libc // import "modernc.org/libc"
+
+const __ccgo_strace = true
diff --git a/vendor/modernc.org/libc/sync.go b/vendor/modernc.org/libc/sync.go
index f4f91f6c..28f2bb4b 100644
--- a/vendor/modernc.org/libc/sync.go
+++ b/vendor/modernc.org/libc/sync.go
@@ -12,6 +12,9 @@ var __sync_synchronize_dummy int32
// __sync_synchronize();
func X__sync_synchronize(t *TLS) {
+ if __ccgo_strace {
+ trc("t=%v, (%v:)", t, origin(2))
+ }
// Attempt to implement a full memory barrier without assembler.
atomic.StoreInt32(&__sync_synchronize_dummy, atomic.LoadInt32(&__sync_synchronize_dummy)+1)
}
diff --git a/vendor/modernc.org/libc/time/time_linux_amd64.go b/vendor/modernc.org/libc/time/time_linux_amd64.go
index e7f73f0d..1e08a9c9 100644
--- a/vendor/modernc.org/libc/time/time_linux_amd64.go
+++ b/vendor/modernc.org/libc/time/time_linux_amd64.go
@@ -61,6 +61,9 @@ const (
X_T_SIZE_ = 0 // stddef.h:185:1:
Linux = 1 // :231:1:
Unix = 1 // :177:1:
+
+ // #define CLOCKS_PER_SEC ((__clock_t) 1000000)
+ CLOCKS_PER_SEC = 1000000
)
type Ptrdiff_t = int64 /* :3:26 */
diff --git a/vendor/modernc.org/memory/memory.go b/vendor/modernc.org/memory/memory.go
index a97b4d02..c6d02df8 100644
--- a/vendor/modernc.org/memory/memory.go
+++ b/vendor/modernc.org/memory/memory.go
@@ -4,118 +4,53 @@
// Package memory implements a memory allocator.
//
-// Build status
+// # Build status
//
// available at https://modern-c.appspot.com/-/builder/?importpath=modernc.org%2fmemory
//
-// Changelog
+// # Changelog
//
// 2017-10-03 Added alternative, unsafe.Pointer-based API.
//
// Package memory implements a memory allocator.
//
-// Changelog
+// # Changelog
//
// 2017-10-03 Added alternative, unsafe.Pointer-based API.
//
-// Benchmarks
+// # Benchmarks
//
-// AMD Ryzen 9 3900X 12-Core Processor × 24
-//
-// jnml@3900x:~/src/modernc.org/memory$ date ; go version ; go test -run @ -bench . -benchmem |& tee log
-// Fri Nov 20 17:23:04 CET 2020
-// go version go1.15.5 linux/amd64
-// goos: linux
-// goarch: amd64
-// pkg: modernc.org/memory
-// BenchmarkFree16-24 141188362 8.26 ns/op 0 B/op 0 allocs/op
-// BenchmarkFree32-24 100000000 11.4 ns/op 0 B/op 0 allocs/op
-// BenchmarkFree64-24 67160647 18.3 ns/op 0 B/op 0 allocs/op
-// BenchmarkCalloc16-24 60612698 19.8 ns/op 0 B/op 0 allocs/op
-// BenchmarkCalloc32-24 47968105 23.8 ns/op 0 B/op 0 allocs/op
-// BenchmarkCalloc64-24 40752181 28.6 ns/op 0 B/op 0 allocs/op
-// BenchmarkGoCalloc16-24 66487354 17.8 ns/op 16 B/op 1 allocs/op
-// BenchmarkGoCalloc32-24 56009206 21.2 ns/op 32 B/op 1 allocs/op
-// BenchmarkGoCalloc64-24 52086571 23.4 ns/op 64 B/op 1 allocs/op
-// BenchmarkMalloc16-24 113943390 10.2 ns/op 0 B/op 0 allocs/op
-// BenchmarkMalloc32-24 113520471 10.2 ns/op 0 B/op 0 allocs/op
-// BenchmarkMalloc64-24 108787056 10.7 ns/op 0 B/op 0 allocs/op
-// BenchmarkUintptrFree16-24 146110286 7.94 ns/op 0 B/op 0 allocs/op
-// BenchmarkUintptrFree32-24 93052707 12.0 ns/op 0 B/op 0 allocs/op
-// BenchmarkUintptrFree64-24 69805262 17.3 ns/op 0 B/op 0 allocs/op
-// BenchmarkUintptrCalloc16-24 85282725 13.7 ns/op 0 B/op 0 allocs/op
-// BenchmarkUintptrCalloc32-24 66489789 17.9 ns/op 0 B/op 0 allocs/op
-// BenchmarkUintptrCalloc64-24 53561092 22.7 ns/op 0 B/op 0 allocs/op
-// BenchmarkUintptrMalloc16-24 222978858 5.28 ns/op 0 B/op 0 allocs/op
-// BenchmarkUintptrMalloc32-24 210443384 5.30 ns/op 0 B/op 0 allocs/op
-// BenchmarkUintptrMalloc64-24 213706227 5.47 ns/op 0 B/op 0 allocs/op
-// PASS
-// ok modernc.org/memory 70.528s
-// jnml@3900x:~/src/modernc.org/memory$
-//
-// Intel® Core™ i5-4670 CPU @ 3.40GHz × 4
-//
-// ==== jnml@4670:~/src/modernc.org/memory> date ; go version ; go test -run @ -bench . -benchmem |& tee log
-// Sat Dec 8 12:56:53 CET 2018
-// go version go1.11.2 linux/amd64
-// goos: linux
-// goarch: amd64
-// pkg: modernc.org/memory
-// BenchmarkFree16-4 100000000 14.7 ns/op 0 B/op 0 allocs/op
-// BenchmarkFree32-4 100000000 20.5 ns/op 0 B/op 0 allocs/op
-// BenchmarkFree64-4 50000000 32.8 ns/op 0 B/op 0 allocs/op
-// BenchmarkCalloc16-4 50000000 24.4 ns/op 0 B/op 0 allocs/op
-// BenchmarkCalloc32-4 50000000 29.2 ns/op 0 B/op 0 allocs/op
-// BenchmarkCalloc64-4 50000000 35.7 ns/op 0 B/op 0 allocs/op
-// BenchmarkGoCalloc16-4 50000000 27.0 ns/op 16 B/op 1 allocs/op
-// BenchmarkGoCalloc32-4 50000000 27.3 ns/op 32 B/op 1 allocs/op
-// BenchmarkGoCalloc64-4 30000000 37.9 ns/op 64 B/op 1 allocs/op
-// BenchmarkMalloc16-4 100000000 12.9 ns/op 0 B/op 0 allocs/op
-// BenchmarkMalloc32-4 100000000 12.9 ns/op 0 B/op 0 allocs/op
-// BenchmarkMalloc64-4 100000000 13.2 ns/op 0 B/op 0 allocs/op
-// BenchmarkUintptrFree16-4 100000000 12.0 ns/op 0 B/op 0 allocs/op
-// BenchmarkUintptrFree32-4 100000000 17.5 ns/op 0 B/op 0 allocs/op
-// BenchmarkUintptrFree64-4 50000000 28.9 ns/op 0 B/op 0 allocs/op
-// BenchmarkUintptrCalloc16-4 100000000 17.8 ns/op 0 B/op 0 allocs/op
-// BenchmarkUintptrCalloc32-4 100000000 22.9 ns/op 0 B/op 0 allocs/op
-// BenchmarkUintptrCalloc64-4 50000000 29.6 ns/op 0 B/op 0 allocs/op
-// BenchmarkUintptrMalloc16-4 200000000 7.31 ns/op 0 B/op 0 allocs/op
-// BenchmarkUintptrMalloc32-4 200000000 7.47 ns/op 0 B/op 0 allocs/op
-// BenchmarkUintptrMalloc64-4 200000000 7.68 ns/op 0 B/op 0 allocs/op
-// PASS
-// ok modernc.org/memory 73.859s
-// //
-// Intel® Xeon(R) CPU E5-1650 v2 @ 3.50GHz × 12
-//
-// ==== jnml@e5-1650:~/src/modernc.org/memory> date ; go version ; go test -run @ -bench . -benchmem
-// Fri Dec 7 14:18:50 CET 2018
-// go version go1.11.2 linux/amd64
-// goos: linux
-// goarch: amd64
-// pkg: modernc.org/memory
-// BenchmarkFree16-12 100000000 16.7 ns/op 0 B/op 0 allocs/op
-// BenchmarkFree32-12 50000000 25.0 ns/op 0 B/op 0 allocs/op
-// BenchmarkFree64-12 30000000 39.7 ns/op 0 B/op 0 allocs/op
-// BenchmarkCalloc16-12 50000000 26.3 ns/op 0 B/op 0 allocs/op
-// BenchmarkCalloc32-12 50000000 33.4 ns/op 0 B/op 0 allocs/op
-// BenchmarkCalloc64-12 30000000 38.3 ns/op 0 B/op 0 allocs/op
-// BenchmarkGoCalloc16-12 50000000 26.6 ns/op 16 B/op 1 allocs/op
-// BenchmarkGoCalloc32-12 50000000 26.8 ns/op 32 B/op 1 allocs/op
-// BenchmarkGoCalloc64-12 30000000 35.1 ns/op 64 B/op 1 allocs/op
-// BenchmarkMalloc16-12 100000000 13.5 ns/op 0 B/op 0 allocs/op
-// BenchmarkMalloc32-12 100000000 13.4 ns/op 0 B/op 0 allocs/op
-// BenchmarkMalloc64-12 100000000 14.1 ns/op 0 B/op 0 allocs/op
-// BenchmarkUintptrFree16-12 100000000 14.4 ns/op 0 B/op 0 allocs/op
-// BenchmarkUintptrFree32-12 100000000 21.7 ns/op 0 B/op 0 allocs/op
-// BenchmarkUintptrFree64-12 50000000 36.7 ns/op 0 B/op 0 allocs/op
-// BenchmarkUintptrCalloc16-12 100000000 20.4 ns/op 0 B/op 0 allocs/op
-// BenchmarkUintptrCalloc32-12 50000000 27.1 ns/op 0 B/op 0 allocs/op
-// BenchmarkUintptrCalloc64-12 50000000 33.4 ns/op 0 B/op 0 allocs/op
-// BenchmarkUintptrMalloc16-12 200000000 8.02 ns/op 0 B/op 0 allocs/op
-// BenchmarkUintptrMalloc32-12 200000000 8.28 ns/op 0 B/op 0 allocs/op
-// BenchmarkUintptrMalloc64-12 200000000 8.29 ns/op 0 B/op 0 allocs/op
-// PASS
-// ok modernc.org/memory 80.896s
+// jnml@3900x:~/src/modernc.org/memory$ date ; go version ; go test -run @ -bench . -benchmem |& tee log
+// Mon Sep 25 16:02:02 CEST 2023
+// go version go1.21.1 linux/amd64
+// goos: linux
+// goarch: amd64
+// pkg: modernc.org/memory
+// cpu: AMD Ryzen 9 3900X 12-Core Processor
+// BenchmarkFree16-24 123506772 9.802 ns/op 0 B/op 0 allocs/op
+// BenchmarkFree32-24 73853230 15.08 ns/op 0 B/op 0 allocs/op
+// BenchmarkFree64-24 43070334 25.15 ns/op 0 B/op 0 allocs/op
+// BenchmarkCalloc16-24 59353304 18.92 ns/op 0 B/op 0 allocs/op
+// BenchmarkCalloc32-24 39415004 29.00 ns/op 0 B/op 0 allocs/op
+// BenchmarkCalloc64-24 35825725 32.02 ns/op 0 B/op 0 allocs/op
+// BenchmarkGoCalloc16-24 38274313 26.99 ns/op 16 B/op 1 allocs/op
+// BenchmarkGoCalloc32-24 44590477 33.06 ns/op 32 B/op 1 allocs/op
+// BenchmarkGoCalloc64-24 44233016 37.20 ns/op 64 B/op 1 allocs/op
+// BenchmarkMalloc16-24 145736911 7.720 ns/op 0 B/op 0 allocs/op
+// BenchmarkMalloc32-24 128898334 7.887 ns/op 0 B/op 0 allocs/op
+// BenchmarkMalloc64-24 149569483 7.994 ns/op 0 B/op 0 allocs/op
+// BenchmarkUintptrFree16-24 117043012 9.205 ns/op 0 B/op 0 allocs/op
+// BenchmarkUintptrFree32-24 77399617 14.20 ns/op 0 B/op 0 allocs/op
+// BenchmarkUintptrFree64-24 48770785 25.04 ns/op 0 B/op 0 allocs/op
+// BenchmarkUintptrCalloc16-24 79257636 15.44 ns/op 0 B/op 0 allocs/op
+// BenchmarkUintptrCalloc32-24 49644562 23.62 ns/op 0 B/op 0 allocs/op
+// BenchmarkUintptrCalloc64-24 39854710 28.22 ns/op 0 B/op 0 allocs/op
+// BenchmarkUintptrMalloc16-24 252987727 4.525 ns/op 0 B/op 0 allocs/op
+// BenchmarkUintptrMalloc32-24 241423840 4.433 ns/op 0 B/op 0 allocs/op
+// BenchmarkUintptrMalloc64-24 256450324 4.669 ns/op 0 B/op 0 allocs/op
+// PASS
+// ok modernc.org/memory 93.178s
+// jnml@3900x:~/src/modernc.org/memory$
package memory // import "modernc.org/memory"
import (
diff --git a/vendor/modernc.org/sqlite/AUTHORS b/vendor/modernc.org/sqlite/AUTHORS
index c3925152..e724f81c 100644
--- a/vendor/modernc.org/sqlite/AUTHORS
+++ b/vendor/modernc.org/sqlite/AUTHORS
@@ -17,9 +17,11 @@ FerretDB Inc.
Jaap Aarts
Jan Mercl <0xjnml@gmail.com>
Josh Bleecher Snyder
+Josh Klein
Logan Snow
Michael Hoffmann
Michael Rykov
Ross Light
Saed SayedAhmed
Steffen Butzer
+W. Michael Petullo
diff --git a/vendor/modernc.org/sqlite/CONTRIBUTORS b/vendor/modernc.org/sqlite/CONTRIBUTORS
index 8e196430..ba51f056 100644
--- a/vendor/modernc.org/sqlite/CONTRIBUTORS
+++ b/vendor/modernc.org/sqlite/CONTRIBUTORS
@@ -19,7 +19,9 @@ Gleb Sakhnov
Jaap Aarts
Jan Mercl <0xjnml@gmail.com>
Josh Bleecher Snyder
+Josh Klein
Logan Snow
+Mark Summerfield
Matthew Gabeler-Lee
Michael Hoffmann
Michael Rykov
@@ -28,4 +30,5 @@ Ross Light
Saed SayedAhmed
Sean McGivern
Steffen Butzer
+W. Michael Petullo
Yaacov Akiba Slama
diff --git a/vendor/modules.txt b/vendor/modules.txt
index b1fba494..2aed0b4b 100644
--- a/vendor/modules.txt
+++ b/vendor/modules.txt
@@ -1,6 +1,16 @@
-# github.com/aws/aws-sdk-go-v2 v1.21.0
-## explicit; go 1.15
-github.com/aws/aws-sdk-go-v2
+# filippo.io/age v1.1.1
+## explicit; go 1.19
+filippo.io/age
+filippo.io/age/agessh
+filippo.io/age/internal/bech32
+filippo.io/age/internal/format
+filippo.io/age/internal/stream
+# filippo.io/edwards25519 v1.0.0
+## explicit; go 1.17
+filippo.io/edwards25519
+filippo.io/edwards25519/field
+# github.com/aws/aws-sdk-go-v2 v1.23.0
+## explicit; go 1.19
github.com/aws/aws-sdk-go-v2/aws
github.com/aws/aws-sdk-go-v2/aws/arn
github.com/aws/aws-sdk-go-v2/aws/defaults
@@ -14,7 +24,9 @@ github.com/aws/aws-sdk-go-v2/aws/signer/internal/v4
github.com/aws/aws-sdk-go-v2/aws/signer/v4
github.com/aws/aws-sdk-go-v2/aws/transport/http
github.com/aws/aws-sdk-go-v2/internal/auth
+github.com/aws/aws-sdk-go-v2/internal/auth/smithy
github.com/aws/aws-sdk-go-v2/internal/awsutil
+github.com/aws/aws-sdk-go-v2/internal/endpoints
github.com/aws/aws-sdk-go-v2/internal/endpoints/awsrulesfn
github.com/aws/aws-sdk-go-v2/internal/rand
github.com/aws/aws-sdk-go-v2/internal/sdk
@@ -23,15 +35,15 @@ github.com/aws/aws-sdk-go-v2/internal/shareddefaults
github.com/aws/aws-sdk-go-v2/internal/strings
github.com/aws/aws-sdk-go-v2/internal/sync/singleflight
github.com/aws/aws-sdk-go-v2/internal/timeconv
-# github.com/aws/aws-sdk-go-v2/aws/protocol/eventstream v1.4.13
-## explicit; go 1.15
+# github.com/aws/aws-sdk-go-v2/aws/protocol/eventstream v1.5.1
+## explicit; go 1.19
github.com/aws/aws-sdk-go-v2/aws/protocol/eventstream
github.com/aws/aws-sdk-go-v2/aws/protocol/eventstream/eventstreamapi
-# github.com/aws/aws-sdk-go-v2/config v1.18.39
-## explicit; go 1.15
+# github.com/aws/aws-sdk-go-v2/config v1.25.3
+## explicit; go 1.19
github.com/aws/aws-sdk-go-v2/config
-# github.com/aws/aws-sdk-go-v2/credentials v1.13.37
-## explicit; go 1.15
+# github.com/aws/aws-sdk-go-v2/credentials v1.16.2
+## explicit; go 1.19
github.com/aws/aws-sdk-go-v2/credentials
github.com/aws/aws-sdk-go-v2/credentials/ec2rolecreds
github.com/aws/aws-sdk-go-v2/credentials/endpointcreds
@@ -39,66 +51,67 @@ github.com/aws/aws-sdk-go-v2/credentials/endpointcreds/internal/client
github.com/aws/aws-sdk-go-v2/credentials/processcreds
github.com/aws/aws-sdk-go-v2/credentials/ssocreds
github.com/aws/aws-sdk-go-v2/credentials/stscreds
-# github.com/aws/aws-sdk-go-v2/feature/ec2/imds v1.13.11
-## explicit; go 1.15
+# github.com/aws/aws-sdk-go-v2/feature/ec2/imds v1.14.4
+## explicit; go 1.19
github.com/aws/aws-sdk-go-v2/feature/ec2/imds
github.com/aws/aws-sdk-go-v2/feature/ec2/imds/internal/config
-# github.com/aws/aws-sdk-go-v2/feature/s3/manager v1.11.83
-## explicit; go 1.15
+# github.com/aws/aws-sdk-go-v2/feature/s3/manager v1.14.0
+## explicit; go 1.19
github.com/aws/aws-sdk-go-v2/feature/s3/manager
-# github.com/aws/aws-sdk-go-v2/internal/configsources v1.1.41
-## explicit; go 1.15
+# github.com/aws/aws-sdk-go-v2/internal/configsources v1.2.3
+## explicit; go 1.19
github.com/aws/aws-sdk-go-v2/internal/configsources
-# github.com/aws/aws-sdk-go-v2/internal/endpoints/v2 v2.4.35
-## explicit; go 1.15
+# github.com/aws/aws-sdk-go-v2/internal/endpoints/v2 v2.5.3
+## explicit; go 1.19
github.com/aws/aws-sdk-go-v2/internal/endpoints/v2
-# github.com/aws/aws-sdk-go-v2/internal/ini v1.3.42
-## explicit; go 1.15
+# github.com/aws/aws-sdk-go-v2/internal/ini v1.7.1
+## explicit; go 1.19
github.com/aws/aws-sdk-go-v2/internal/ini
-# github.com/aws/aws-sdk-go-v2/internal/v4a v1.1.4
-## explicit; go 1.15
+# github.com/aws/aws-sdk-go-v2/internal/v4a v1.2.3
+## explicit; go 1.19
github.com/aws/aws-sdk-go-v2/internal/v4a
github.com/aws/aws-sdk-go-v2/internal/v4a/internal/crypto
github.com/aws/aws-sdk-go-v2/internal/v4a/internal/v4
-# github.com/aws/aws-sdk-go-v2/service/internal/accept-encoding v1.9.14
-## explicit; go 1.15
+# github.com/aws/aws-sdk-go-v2/service/internal/accept-encoding v1.10.1
+## explicit; go 1.19
github.com/aws/aws-sdk-go-v2/service/internal/accept-encoding
-# github.com/aws/aws-sdk-go-v2/service/internal/checksum v1.1.36
-## explicit; go 1.15
+# github.com/aws/aws-sdk-go-v2/service/internal/checksum v1.2.3
+## explicit; go 1.19
github.com/aws/aws-sdk-go-v2/service/internal/checksum
-# github.com/aws/aws-sdk-go-v2/service/internal/presigned-url v1.9.35
-## explicit; go 1.15
+# github.com/aws/aws-sdk-go-v2/service/internal/presigned-url v1.10.3
+## explicit; go 1.19
github.com/aws/aws-sdk-go-v2/service/internal/presigned-url
-# github.com/aws/aws-sdk-go-v2/service/internal/s3shared v1.15.4
-## explicit; go 1.15
+# github.com/aws/aws-sdk-go-v2/service/internal/s3shared v1.16.3
+## explicit; go 1.19
github.com/aws/aws-sdk-go-v2/service/internal/s3shared
github.com/aws/aws-sdk-go-v2/service/internal/s3shared/arn
github.com/aws/aws-sdk-go-v2/service/internal/s3shared/config
-# github.com/aws/aws-sdk-go-v2/service/s3 v1.38.5
-## explicit; go 1.15
+# github.com/aws/aws-sdk-go-v2/service/s3 v1.43.0
+## explicit; go 1.19
github.com/aws/aws-sdk-go-v2/service/s3
github.com/aws/aws-sdk-go-v2/service/s3/internal/arn
github.com/aws/aws-sdk-go-v2/service/s3/internal/customizations
github.com/aws/aws-sdk-go-v2/service/s3/internal/endpoints
github.com/aws/aws-sdk-go-v2/service/s3/types
-# github.com/aws/aws-sdk-go-v2/service/sso v1.13.6
-## explicit; go 1.15
+# github.com/aws/aws-sdk-go-v2/service/sso v1.17.2
+## explicit; go 1.19
github.com/aws/aws-sdk-go-v2/service/sso
github.com/aws/aws-sdk-go-v2/service/sso/internal/endpoints
github.com/aws/aws-sdk-go-v2/service/sso/types
-# github.com/aws/aws-sdk-go-v2/service/ssooidc v1.15.6
-## explicit; go 1.15
+# github.com/aws/aws-sdk-go-v2/service/ssooidc v1.20.0
+## explicit; go 1.19
github.com/aws/aws-sdk-go-v2/service/ssooidc
github.com/aws/aws-sdk-go-v2/service/ssooidc/internal/endpoints
github.com/aws/aws-sdk-go-v2/service/ssooidc/types
-# github.com/aws/aws-sdk-go-v2/service/sts v1.21.5
-## explicit; go 1.15
+# github.com/aws/aws-sdk-go-v2/service/sts v1.25.3
+## explicit; go 1.19
github.com/aws/aws-sdk-go-v2/service/sts
github.com/aws/aws-sdk-go-v2/service/sts/internal/endpoints
github.com/aws/aws-sdk-go-v2/service/sts/types
-# github.com/aws/smithy-go v1.14.2
-## explicit; go 1.15
+# github.com/aws/smithy-go v1.17.0
+## explicit; go 1.19
github.com/aws/smithy-go
+github.com/aws/smithy-go/auth
github.com/aws/smithy-go/auth/bearer
github.com/aws/smithy-go/context
github.com/aws/smithy-go/document
@@ -122,7 +135,7 @@ github.com/aws/smithy-go/waiter
# github.com/benbjohnson/clock v1.3.5
## explicit; go 1.15
github.com/benbjohnson/clock
-# github.com/conductorone/baton-sdk v0.1.5
+# github.com/conductorone/baton-sdk v0.1.27
## explicit; go 1.20
github.com/conductorone/baton-sdk/internal/connector
github.com/conductorone/baton-sdk/pb/c1/c1z/v1
@@ -137,10 +150,14 @@ github.com/conductorone/baton-sdk/pkg/cli
github.com/conductorone/baton-sdk/pkg/connectorbuilder
github.com/conductorone/baton-sdk/pkg/connectorrunner
github.com/conductorone/baton-sdk/pkg/connectorstore
+github.com/conductorone/baton-sdk/pkg/crypto
+github.com/conductorone/baton-sdk/pkg/crypto/providers
+github.com/conductorone/baton-sdk/pkg/crypto/providers/jwk
github.com/conductorone/baton-sdk/pkg/dotc1z
github.com/conductorone/baton-sdk/pkg/dotc1z/manager
github.com/conductorone/baton-sdk/pkg/dotc1z/manager/local
github.com/conductorone/baton-sdk/pkg/dotc1z/manager/s3
+github.com/conductorone/baton-sdk/pkg/helpers
github.com/conductorone/baton-sdk/pkg/logging
github.com/conductorone/baton-sdk/pkg/pagination
github.com/conductorone/baton-sdk/pkg/provisioner
@@ -174,13 +191,13 @@ github.com/dustin/go-humanize
# github.com/envoyproxy/protoc-gen-validate v1.0.2
## explicit; go 1.19
github.com/envoyproxy/protoc-gen-validate/validate
-# github.com/fsnotify/fsnotify v1.6.0
-## explicit; go 1.16
+# github.com/fsnotify/fsnotify v1.7.0
+## explicit; go 1.17
github.com/fsnotify/fsnotify
# github.com/glebarez/go-sqlite v1.21.2
## explicit; go 1.17
github.com/glebarez/go-sqlite
-# github.com/go-jose/go-jose/v3 v3.0.0
+# github.com/go-jose/go-jose/v3 v3.0.1
## explicit; go 1.12
github.com/go-jose/go-jose/v3
github.com/go-jose/go-jose/v3/cipher
@@ -197,7 +214,7 @@ github.com/golang/protobuf/ptypes
github.com/golang/protobuf/ptypes/any
github.com/golang/protobuf/ptypes/duration
github.com/golang/protobuf/ptypes/timestamp
-# github.com/google/uuid v1.3.1
+# github.com/google/uuid v1.4.0
## explicit
github.com/google/uuid
# github.com/grpc-ecosystem/go-grpc-middleware v1.4.0
@@ -228,8 +245,8 @@ github.com/inconshreveable/mousetrap
# github.com/jmespath/go-jmespath v0.4.0
## explicit; go 1.14
github.com/jmespath/go-jmespath
-# github.com/klauspost/compress v1.16.7
-## explicit; go 1.18
+# github.com/klauspost/compress v1.17.3
+## explicit; go 1.19
github.com/klauspost/compress
github.com/klauspost/compress/fse
github.com/klauspost/compress/huff0
@@ -237,13 +254,13 @@ github.com/klauspost/compress/internal/cpuinfo
github.com/klauspost/compress/internal/snapref
github.com/klauspost/compress/zstd
github.com/klauspost/compress/zstd/internal/xxhash
-# github.com/lufia/plan9stats v0.0.0-20230326075908-cb1d2100619a
+# github.com/lufia/plan9stats v0.0.0-20231016141302-07b5767bb0ed
## explicit; go 1.16
github.com/lufia/plan9stats
# github.com/magiconair/properties v1.8.7
## explicit; go 1.19
github.com/magiconair/properties
-# github.com/mattn/go-isatty v0.0.19
+# github.com/mattn/go-isatty v0.0.20
## explicit; go 1.15
github.com/mattn/go-isatty
# github.com/mitchellh/mapstructure v1.5.0
@@ -265,10 +282,16 @@ github.com/pquerna/xjwt
# github.com/remyoudompheng/bigfft v0.0.0-20230129092748-24d4a6f8daec
## explicit; go 1.12
github.com/remyoudompheng/bigfft
+# github.com/sagikazarmark/locafero v0.3.0
+## explicit; go 1.20
+github.com/sagikazarmark/locafero
+# github.com/sagikazarmark/slog-shim v0.1.0
+## explicit; go 1.20
+github.com/sagikazarmark/slog-shim
# github.com/segmentio/ksuid v1.0.4
## explicit; go 1.12
github.com/segmentio/ksuid
-# github.com/shirou/gopsutil/v3 v3.23.8
+# github.com/shirou/gopsutil/v3 v3.23.10
## explicit; go 1.15
github.com/shirou/gopsutil/v3/common
github.com/shirou/gopsutil/v3/cpu
@@ -280,7 +303,13 @@ github.com/shirou/gopsutil/v3/process
# github.com/shoenig/go-m1cpu v0.1.6
## explicit; go 1.20
github.com/shoenig/go-m1cpu
-# github.com/spf13/afero v1.9.5
+# github.com/sourcegraph/conc v0.3.0
+## explicit; go 1.19
+github.com/sourcegraph/conc
+github.com/sourcegraph/conc/internal/multierror
+github.com/sourcegraph/conc/iter
+github.com/sourcegraph/conc/panics
+# github.com/spf13/afero v1.10.0
## explicit; go 1.16
github.com/spf13/afero
github.com/spf13/afero/internal/common
@@ -288,17 +317,14 @@ github.com/spf13/afero/mem
# github.com/spf13/cast v1.5.1
## explicit; go 1.18
github.com/spf13/cast
-# github.com/spf13/cobra v1.7.0
+# github.com/spf13/cobra v1.8.0
## explicit; go 1.15
github.com/spf13/cobra
-# github.com/spf13/jwalterweatherman v1.1.0
-## explicit
-github.com/spf13/jwalterweatherman
# github.com/spf13/pflag v1.0.5
## explicit; go 1.12
github.com/spf13/pflag
-# github.com/spf13/viper v1.16.0
-## explicit; go 1.17
+# github.com/spf13/viper v1.17.0
+## explicit; go 1.18
github.com/spf13/viper
github.com/spf13/viper/internal/encoding
github.com/spf13/viper/internal/encoding/dotenv
@@ -320,15 +346,13 @@ github.com/tklauser/numcpus
# github.com/yusufpapurcu/wmi v1.2.3
## explicit; go 1.16
github.com/yusufpapurcu/wmi
-# go.uber.org/atomic v1.11.0
-## explicit; go 1.18
# go.uber.org/multierr v1.11.0
## explicit; go 1.19
go.uber.org/multierr
# go.uber.org/ratelimit v0.3.0
## explicit; go 1.18
go.uber.org/ratelimit
-# go.uber.org/zap v1.25.0
+# go.uber.org/zap v1.26.0
## explicit; go 1.19
go.uber.org/zap
go.uber.org/zap/buffer
@@ -337,30 +361,52 @@ go.uber.org/zap/internal/bufferpool
go.uber.org/zap/internal/color
go.uber.org/zap/internal/exit
go.uber.org/zap/internal/pool
+go.uber.org/zap/internal/stacktrace
go.uber.org/zap/zapcore
-# golang.org/x/crypto v0.13.0
-## explicit; go 1.17
+# golang.org/x/crypto v0.17.0
+## explicit; go 1.18
+golang.org/x/crypto/blowfish
+golang.org/x/crypto/chacha20
+golang.org/x/crypto/chacha20poly1305
+golang.org/x/crypto/curve25519
+golang.org/x/crypto/curve25519/internal/field
golang.org/x/crypto/ed25519
+golang.org/x/crypto/hkdf
+golang.org/x/crypto/internal/alias
+golang.org/x/crypto/internal/poly1305
golang.org/x/crypto/pbkdf2
-# golang.org/x/net v0.15.0
-## explicit; go 1.17
+golang.org/x/crypto/poly1305
+golang.org/x/crypto/scrypt
+golang.org/x/crypto/ssh
+golang.org/x/crypto/ssh/internal/bcrypt_pbkdf
+# golang.org/x/exp v0.0.0-20231110203233-9a3e6036ecaa
+## explicit; go 1.20
+golang.org/x/exp/constraints
+golang.org/x/exp/slices
+golang.org/x/exp/slog
+golang.org/x/exp/slog/internal
+golang.org/x/exp/slog/internal/buffer
+# golang.org/x/net v0.18.0
+## explicit; go 1.18
golang.org/x/net/http/httpguts
golang.org/x/net/http2
golang.org/x/net/http2/hpack
golang.org/x/net/idna
golang.org/x/net/internal/timeseries
golang.org/x/net/trace
-# golang.org/x/oauth2 v0.12.0
+# golang.org/x/oauth2 v0.14.0
## explicit; go 1.18
golang.org/x/oauth2
+golang.org/x/oauth2/clientcredentials
golang.org/x/oauth2/internal
-# golang.org/x/sync v0.3.0
-## explicit; go 1.17
+golang.org/x/oauth2/jws
+golang.org/x/oauth2/jwt
+# golang.org/x/sync v0.5.0
+## explicit; go 1.18
golang.org/x/sync/semaphore
-# golang.org/x/sys v0.12.0
-## explicit; go 1.17
-golang.org/x/sys/internal/unsafeheader
-golang.org/x/sys/plan9
+# golang.org/x/sys v0.15.0
+## explicit; go 1.18
+golang.org/x/sys/cpu
golang.org/x/sys/unix
golang.org/x/sys/windows
golang.org/x/sys/windows/registry
@@ -368,11 +414,8 @@ golang.org/x/sys/windows/svc
golang.org/x/sys/windows/svc/debug
golang.org/x/sys/windows/svc/eventlog
golang.org/x/sys/windows/svc/mgr
-# golang.org/x/term v0.12.0
-## explicit; go 1.17
-golang.org/x/term
-# golang.org/x/text v0.13.0
-## explicit; go 1.17
+# golang.org/x/text v0.14.0
+## explicit; go 1.18
golang.org/x/text/encoding
golang.org/x/text/encoding/internal
golang.org/x/text/encoding/internal/identifier
@@ -392,10 +435,10 @@ google.golang.org/appengine/internal/log
google.golang.org/appengine/internal/remote_api
google.golang.org/appengine/internal/urlfetch
google.golang.org/appengine/urlfetch
-# google.golang.org/genproto/googleapis/rpc v0.0.0-20230911183012-2d3300fd4832
+# google.golang.org/genproto/googleapis/rpc v0.0.0-20231106174013-bbf56f31fb17
## explicit; go 1.19
google.golang.org/genproto/googleapis/rpc/status
-# google.golang.org/grpc v1.58.0
+# google.golang.org/grpc v1.59.0
## explicit; go 1.19
google.golang.org/grpc
google.golang.org/grpc/attributes
@@ -496,8 +539,8 @@ gopkg.in/yaml.v2
# gopkg.in/yaml.v3 v3.0.1
## explicit
gopkg.in/yaml.v3
-# modernc.org/libc v1.24.1
-## explicit; go 1.18
+# modernc.org/libc v1.34.7
+## explicit; go 1.20
modernc.org/libc
modernc.org/libc/errno
modernc.org/libc/fcntl
@@ -527,9 +570,9 @@ modernc.org/libc/wctype
# modernc.org/mathutil v1.6.0
## explicit; go 1.18
modernc.org/mathutil
-# modernc.org/memory v1.7.1
+# modernc.org/memory v1.7.2
## explicit; go 1.18
modernc.org/memory
-# modernc.org/sqlite v1.25.0
-## explicit; go 1.18
+# modernc.org/sqlite v1.27.0
+## explicit; go 1.19
modernc.org/sqlite/lib