зеркало из https://github.com/Azure/ARO-RP.git
Hive version bump to resolve RHSA-2024:5535 (CVE-2023-6597) (#3893)
* Updated hive apis module to 986c5efa21 * Update hive cmd/mirror to use hive image tag 986c5efa21
This commit is contained in:
Родитель
d64782c410
Коммит
f7404a1877
|
@ -111,7 +111,7 @@ func mirror(ctx context.Context, log *logrus.Entry) error {
|
|||
"quay.io/app-sre/managed-upgrade-operator:v0.1.952-44b631a",
|
||||
|
||||
// https://quay.io/repository/app-sre/hive?tab=tags
|
||||
"quay.io/app-sre/hive:bdf9d08a06",
|
||||
"quay.io/app-sre/hive:986c5efa21",
|
||||
} {
|
||||
log.Printf("mirroring %s -> %s", ref, pkgmirror.Dest(dstAcr+acrDomainSuffix, ref))
|
||||
|
||||
|
|
20
go.mod
20
go.mod
|
@ -60,7 +60,7 @@ require (
|
|||
github.com/openshift/api v0.0.0-20240103200955-7ca3a4634e46
|
||||
github.com/openshift/client-go v0.0.0-20221019143426-16aed247da5c
|
||||
github.com/openshift/cloud-credential-operator v0.0.0-00010101000000-000000000000
|
||||
github.com/openshift/hive/apis v0.0.0-20240812130639-bdf9d08a060a
|
||||
github.com/openshift/hive/apis v0.0.0-20241008210644-986c5efa21e7
|
||||
github.com/openshift/library-go v0.0.0-20220525173854-9b950a41acdc
|
||||
github.com/openshift/machine-config-operator v0.0.1-0.20230519222939-1abc13efbb0d
|
||||
github.com/pires/go-proxyproto v0.6.2
|
||||
|
@ -76,21 +76,21 @@ require (
|
|||
github.com/ugorji/go/codec v1.2.12
|
||||
github.com/vincent-petithory/dataurl v1.0.0
|
||||
go.uber.org/mock v0.4.0
|
||||
golang.org/x/crypto v0.26.0
|
||||
golang.org/x/net v0.28.0
|
||||
golang.org/x/crypto v0.28.0
|
||||
golang.org/x/net v0.30.0
|
||||
golang.org/x/oauth2 v0.18.0
|
||||
golang.org/x/sync v0.8.0
|
||||
golang.org/x/text v0.17.0
|
||||
golang.org/x/text v0.19.0
|
||||
golang.org/x/tools v0.21.1-0.20240508182429-e35e4ccd0d2d
|
||||
gopkg.in/go-jose/go-jose.v2 v2.6.3
|
||||
k8s.io/api v0.30.3
|
||||
k8s.io/api v0.31.1
|
||||
k8s.io/apiextensions-apiserver v0.25.0
|
||||
k8s.io/apimachinery v0.30.3
|
||||
k8s.io/apimachinery v0.31.1
|
||||
k8s.io/cli-runtime v0.25.16
|
||||
k8s.io/client-go v0.26.2
|
||||
k8s.io/kubectl v0.24.17
|
||||
k8s.io/kubernetes v1.28.4
|
||||
k8s.io/utils v0.0.0-20240711033017-18e509b52bc8
|
||||
k8s.io/utils v0.0.0-20240921022957-49e7df575cb6
|
||||
sigs.k8s.io/controller-runtime v0.13.1
|
||||
sigs.k8s.io/yaml v1.4.0
|
||||
)
|
||||
|
@ -262,8 +262,8 @@ require (
|
|||
go.starlark.net v0.0.0-20220328144851-d1966c6b9fcd // indirect
|
||||
golang.org/x/exp v0.0.0-20240222234643-814bf88cf225 // indirect
|
||||
golang.org/x/mod v0.17.0 // indirect
|
||||
golang.org/x/sys v0.23.0 // indirect
|
||||
golang.org/x/term v0.23.0 // indirect
|
||||
golang.org/x/sys v0.26.0 // indirect
|
||||
golang.org/x/term v0.25.0 // indirect
|
||||
golang.org/x/time v0.5.0 // indirect
|
||||
gomodules.xyz/jsonpatch/v2 v2.2.0 // indirect
|
||||
google.golang.org/appengine v1.6.8 // indirect
|
||||
|
@ -281,7 +281,7 @@ require (
|
|||
k8s.io/klog/v2 v2.130.1 // indirect
|
||||
k8s.io/kube-aggregator v0.24.1 // indirect
|
||||
k8s.io/kube-openapi v0.0.0-20220803162953-67bda5d908f1 // indirect
|
||||
sigs.k8s.io/json v0.0.0-20221116044647-bc3834ca7abd // indirect
|
||||
sigs.k8s.io/json v0.0.0-20241009153224-e386a8af8d30 // indirect
|
||||
sigs.k8s.io/kube-storage-version-migrator v0.0.4 // indirect
|
||||
sigs.k8s.io/kustomize/api v0.12.1 // indirect
|
||||
sigs.k8s.io/kustomize/kyaml v0.13.9 // indirect
|
||||
|
|
28
go.sum
28
go.sum
|
@ -694,29 +694,29 @@ go.uber.org/zap v1.26.0 h1:sI7k6L95XOKS281NhVKOFCUNIvv9e0w4BF8N3u+tCRo=
|
|||
go.uber.org/zap v1.26.0/go.mod h1:dtElttAiwGvoJ/vj4IwHBS/gXsEu/pZ50mUIRWuG0so=
|
||||
golang.org/x/crypto v0.1.0/go.mod h1:RecgLatLF4+eUMCP1PoPZQb+cVrJcOPbHkTkbkB9sbw=
|
||||
golang.org/x/crypto v0.19.0/go.mod h1:Iy9bg/ha4yyC70EfRS8jz+B6ybOBKMaSxLj6P6oBDfU=
|
||||
golang.org/x/crypto v0.26.0 h1:RrRspgV4mU+YwB4FYnuBoKsUapNIL5cohGAmSH3azsw=
|
||||
golang.org/x/crypto v0.26.0/go.mod h1:GY7jblb9wI+FOo5y8/S2oY4zWP07AkOJ4+jxCqdqn54=
|
||||
golang.org/x/crypto v0.28.0 h1:GBDwsMXVQi34v5CCYUm2jkJvu4cbtru2U4TN2PSyQnw=
|
||||
golang.org/x/crypto v0.28.0/go.mod h1:rmgy+3RHxRZMyY0jjAJShp2zgEdOqj2AO7U0pYmeQ7U=
|
||||
golang.org/x/exp v0.0.0-20240222234643-814bf88cf225 h1:LfspQV/FYTatPTr/3HzIcmiUFH7PGP+OQ6mgDYo3yuQ=
|
||||
golang.org/x/exp v0.0.0-20240222234643-814bf88cf225/go.mod h1:CxmFvTBINI24O/j8iY7H1xHzx2i4OsyguNBmN/uPtqc=
|
||||
golang.org/x/mod v0.17.0 h1:zY54UmvipHiNd+pm+m0x9KhZ9hl1/7QNMyxXbc6ICqA=
|
||||
golang.org/x/mod v0.17.0/go.mod h1:hTbmBsO62+eylJbnUtE2MGJUyE7QWk4xUqPFrRgJ+7c=
|
||||
golang.org/x/net v0.1.0/go.mod h1:Cx3nUiGt4eDBEyega/BKRp+/AlGL8hYe7U9odMt2Cco=
|
||||
golang.org/x/net v0.28.0 h1:a9JDOJc5GMUJ0+UDqmLT86WiEy7iWyIhz8gz8E4e5hE=
|
||||
golang.org/x/net v0.28.0/go.mod h1:yqtgsTWOOnlGLG9GFRrK3++bGOUEkNBoHZc8MEDWPNg=
|
||||
golang.org/x/net v0.30.0 h1:AcW1SDZMkb8IpzCdQUaIq2sP4sZ4zw+55h6ynffypl4=
|
||||
golang.org/x/net v0.30.0/go.mod h1:2wGyMJ5iFasEhkwi13ChkO/t1ECNC4X4eBKkVFyYFlU=
|
||||
golang.org/x/oauth2 v0.18.0 h1:09qnuIAgzdx1XplqJvW6CQqMCtGZykZWcXzPMPUusvI=
|
||||
golang.org/x/oauth2 v0.18.0/go.mod h1:Wf7knwG0MPoWIMMBgFlEaSUDaKskp0dCfrlJRJXbBi8=
|
||||
golang.org/x/sync v0.8.0 h1:3NFvSEYkUoMifnESzZl15y791HH1qU2xm6eCJU5ZPXQ=
|
||||
golang.org/x/sync v0.8.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk=
|
||||
golang.org/x/sys v0.17.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
|
||||
golang.org/x/sys v0.23.0 h1:YfKFowiIMvtgl1UERQoTPPToxltDeZfbj4H7dVUCwmM=
|
||||
golang.org/x/sys v0.23.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
|
||||
golang.org/x/sys v0.26.0 h1:KHjCJyddX0LoSTb3J+vWpupP9p0oznkqVk/IfjymZbo=
|
||||
golang.org/x/sys v0.26.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
|
||||
golang.org/x/term v0.1.0/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8=
|
||||
golang.org/x/term v0.17.0/go.mod h1:lLRBjIVuehSbZlaOtGMbcMncT+aqLLLmKrsjNrUguwk=
|
||||
golang.org/x/term v0.23.0 h1:F6D4vR+EHoL9/sWAWgAR1H2DcHr4PareCbAaCo1RpuU=
|
||||
golang.org/x/term v0.23.0/go.mod h1:DgV24QBUrK6jhZXl+20l6UWznPlwAHm1Q1mGHtydmSk=
|
||||
golang.org/x/term v0.25.0 h1:WtHI/ltw4NvSUig5KARz9h521QvRC8RmF/cuYqifU24=
|
||||
golang.org/x/term v0.25.0/go.mod h1:RPyXicDX+6vLxogjjRxjgD2TKtmAO6NZBsBRfrOLu7M=
|
||||
golang.org/x/text v0.14.0/go.mod h1:18ZOQIKpY8NJVqYksKHtTdi31H5itFRjB5/qKTNYzSU=
|
||||
golang.org/x/text v0.17.0 h1:XtiM5bkSOt+ewxlOE/aE/AKEHibwj/6gvWMl9Rsh0Qc=
|
||||
golang.org/x/text v0.17.0/go.mod h1:BuEKDfySbSR4drPmRPG/7iBdf8hvFMuRexcpahXilzY=
|
||||
golang.org/x/text v0.19.0 h1:kTxAhCbGbxhK0IwgSKiMO5awPoDQ0RpfiVYBfK860YM=
|
||||
golang.org/x/text v0.19.0/go.mod h1:BuEKDfySbSR4drPmRPG/7iBdf8hvFMuRexcpahXilzY=
|
||||
golang.org/x/time v0.5.0 h1:o7cqy6amK/52YcAKIPlM3a+Fpj35zvRj2TP+e1xFSfk=
|
||||
golang.org/x/time v0.5.0/go.mod h1:3BpzKBy/shNhVucY/MWOyx10tF3SFh9QdLuxbVysPQM=
|
||||
golang.org/x/tools v0.21.1-0.20240508182429-e35e4ccd0d2d h1:vU5i/LfpvrRCpgM/VPfJLg5KjxD3E+hfT1SH+d9zLwg=
|
||||
|
@ -782,12 +782,12 @@ k8s.io/kubectl v0.25.16 h1:6TK2I58rj3Og6CZlkc6j2ARICag25ko9ALsr5w/Oe6A=
|
|||
k8s.io/kubectl v0.25.16/go.mod h1:mmyKlLfVqm6s6zcKNwK8f36Vf5MAmrmudRko9/wibNA=
|
||||
k8s.io/kubernetes v1.25.16 h1:pdtEdre7aInDvXas+mWzpTiK/7cpcaGRyYB+Bedr2+Q=
|
||||
k8s.io/kubernetes v1.25.16/go.mod h1:ZrRRMmY0nDNxlnPnJopZRhF2i0tzfB3+DnitJcDe8Vw=
|
||||
k8s.io/utils v0.0.0-20240711033017-18e509b52bc8 h1:pUdcCO1Lk/tbT5ztQWOBi5HBgbBP1J8+AsQnQCKsi8A=
|
||||
k8s.io/utils v0.0.0-20240711033017-18e509b52bc8/go.mod h1:OLgZIPagt7ERELqWJFomSt595RzquPNLL48iOWgYOg0=
|
||||
k8s.io/utils v0.0.0-20240921022957-49e7df575cb6 h1:MDF6h2H/h4tbzmtIKTuctcwZmY0tY9mD9fNT47QO6HI=
|
||||
k8s.io/utils v0.0.0-20240921022957-49e7df575cb6/go.mod h1:OLgZIPagt7ERELqWJFomSt595RzquPNLL48iOWgYOg0=
|
||||
sigs.k8s.io/controller-runtime v0.11.2 h1:H5GTxQl0Mc9UjRJhORusqfJCIjBO8UtUxGggCwL1rLA=
|
||||
sigs.k8s.io/controller-runtime v0.11.2/go.mod h1:P6QCzrEjLaZGqHsfd+os7JQ+WFZhvB8MRFsn4dWF7O4=
|
||||
sigs.k8s.io/json v0.0.0-20221116044647-bc3834ca7abd h1:EDPBXCAspyGV4jQlpZSudPeMmr1bNJefnuqLsRAsHZo=
|
||||
sigs.k8s.io/json v0.0.0-20221116044647-bc3834ca7abd/go.mod h1:B8JuhiUyNFVKdsE8h686QcCxMaH6HrOAZj4vswFpcB0=
|
||||
sigs.k8s.io/json v0.0.0-20241009153224-e386a8af8d30 h1:ObU1vgTtAle8WwCKgcDkPjLJYwlazQpIjzSA0asMhy4=
|
||||
sigs.k8s.io/json v0.0.0-20241009153224-e386a8af8d30/go.mod h1:B8JuhiUyNFVKdsE8h686QcCxMaH6HrOAZj4vswFpcB0=
|
||||
sigs.k8s.io/kube-storage-version-migrator v0.0.4 h1:qsCecgZHgdismlTt8xCmS/3numvpxrj58RWJeIg76wc=
|
||||
sigs.k8s.io/kube-storage-version-migrator v0.0.4/go.mod h1:mXfSLkx9xbJHQsgNDDUZK/iQTs2tMbx/hsJlWe6Fthw=
|
||||
sigs.k8s.io/kustomize/api v0.11.2 h1:6YvCJHFDwsLwAX7zNHBxMZi3k7dGIXI8G9l0saYQI0E=
|
||||
|
|
|
@ -9,7 +9,7 @@ main() {
|
|||
trap "cleanup $tmpdir" EXIT
|
||||
|
||||
# This is the commit sha that the image was built from and ensures we use the correct configs for the release
|
||||
local -r default_commit="bdf9d08a06"
|
||||
local -r default_commit="986c5efa21"
|
||||
local -r hive_image_commit_hash="${1:-$default_commit}"
|
||||
log "Using hive commit: $hive_image_commit_hash"
|
||||
# shellcheck disable=SC2034
|
||||
|
|
11317
vendor/golang.org/x/crypto/chacha20poly1305/chacha20poly1305_amd64.s
сгенерированный
поставляемый
11317
vendor/golang.org/x/crypto/chacha20poly1305/chacha20poly1305_amd64.s
сгенерированный
поставляемый
Разница между файлами не показана из-за своего большого размера
Загрузить разницу
|
@ -1,108 +1,93 @@
|
|||
// 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.
|
||||
// Code generated by command: go run sum_amd64_asm.go -out ../sum_amd64.s -pkg poly1305. DO NOT EDIT.
|
||||
|
||||
//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)
|
||||
// func update(state *macState, 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
|
||||
MOVQ (DI), R8
|
||||
MOVQ 8(DI), R9
|
||||
MOVQ 16(DI), R10
|
||||
MOVQ 24(DI), R11
|
||||
MOVQ 32(DI), R12
|
||||
CMPQ R15, $0x10
|
||||
JB bytes_between_0_and_15
|
||||
|
||||
loop:
|
||||
POLY1305_ADD(SI, R8, R9, R10)
|
||||
ADDQ (SI), R8
|
||||
ADCQ 8(SI), R9
|
||||
ADCQ $0x01, R10
|
||||
LEAQ 16(SI), SI
|
||||
|
||||
multiply:
|
||||
POLY1305_MUL(R8, R9, R10, R11, R12, BX, CX, R13, R14)
|
||||
SUBQ $16, R15
|
||||
CMPQ R15, $16
|
||||
MOVQ R11, AX
|
||||
MULQ R8
|
||||
MOVQ AX, BX
|
||||
MOVQ DX, CX
|
||||
MOVQ R11, AX
|
||||
MULQ R9
|
||||
ADDQ AX, CX
|
||||
ADCQ $0x00, DX
|
||||
MOVQ R11, R13
|
||||
IMULQ R10, R13
|
||||
ADDQ DX, R13
|
||||
MOVQ R12, AX
|
||||
MULQ R8
|
||||
ADDQ AX, CX
|
||||
ADCQ $0x00, DX
|
||||
MOVQ DX, R8
|
||||
MOVQ R12, R14
|
||||
IMULQ R10, R14
|
||||
MOVQ R12, AX
|
||||
MULQ R9
|
||||
ADDQ AX, R13
|
||||
ADCQ DX, R14
|
||||
ADDQ R8, R13
|
||||
ADCQ $0x00, R14
|
||||
MOVQ BX, R8
|
||||
MOVQ CX, R9
|
||||
MOVQ R13, R10
|
||||
ANDQ $0x03, R10
|
||||
MOVQ R13, BX
|
||||
ANDQ $-4, BX
|
||||
ADDQ BX, R8
|
||||
ADCQ R14, R9
|
||||
ADCQ $0x00, R10
|
||||
SHRQ $0x02, R14, R13
|
||||
SHRQ $0x02, R14
|
||||
ADDQ R13, R8
|
||||
ADCQ R14, R9
|
||||
ADCQ $0x00, R10
|
||||
SUBQ $0x10, R15
|
||||
CMPQ R15, $0x10
|
||||
JAE loop
|
||||
|
||||
bytes_between_0_and_15:
|
||||
TESTQ R15, R15
|
||||
JZ done
|
||||
MOVQ $1, BX
|
||||
MOVQ $0x00000001, BX
|
||||
XORQ CX, CX
|
||||
XORQ R13, R13
|
||||
ADDQ R15, SI
|
||||
|
||||
flush_buffer:
|
||||
SHLQ $8, BX, CX
|
||||
SHLQ $8, BX
|
||||
SHLQ $0x08, BX, CX
|
||||
SHLQ $0x08, 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
|
||||
ADCQ $0x00, R10
|
||||
MOVQ $0x00000010, R15
|
||||
JMP multiply
|
||||
|
||||
done:
|
||||
MOVQ R8, 0(DI)
|
||||
MOVQ R8, (DI)
|
||||
MOVQ R9, 8(DI)
|
||||
MOVQ R10, 16(DI)
|
||||
RET
|
||||
|
|
Разница между файлами не показана из-за своего большого размера
Загрузить разницу
|
@ -85,9 +85,9 @@ func newCShake(N, S []byte, rate, outputLen int, dsbyte byte) ShakeHash {
|
|||
|
||||
// leftEncode returns max 9 bytes
|
||||
c.initBlock = make([]byte, 0, 9*2+len(N)+len(S))
|
||||
c.initBlock = append(c.initBlock, leftEncode(uint64(len(N)*8))...)
|
||||
c.initBlock = append(c.initBlock, leftEncode(uint64(len(N))*8)...)
|
||||
c.initBlock = append(c.initBlock, N...)
|
||||
c.initBlock = append(c.initBlock, leftEncode(uint64(len(S)*8))...)
|
||||
c.initBlock = append(c.initBlock, leftEncode(uint64(len(S))*8)...)
|
||||
c.initBlock = append(c.initBlock, S...)
|
||||
c.Write(bytepad(c.initBlock, c.rate))
|
||||
return &c
|
||||
|
|
|
@ -175,6 +175,15 @@ func (r *keyring) Add(key AddedKey) error {
|
|||
p.expire = &t
|
||||
}
|
||||
|
||||
// If we already have a Signer with the same public key, replace it with the
|
||||
// new one.
|
||||
for idx, k := range r.keys {
|
||||
if bytes.Equal(k.signer.PublicKey().Marshal(), p.signer.PublicKey().Marshal()) {
|
||||
r.keys[idx] = p
|
||||
return nil
|
||||
}
|
||||
}
|
||||
|
||||
r.keys = append(r.keys, p)
|
||||
|
||||
return nil
|
||||
|
|
|
@ -510,8 +510,8 @@ userAuthLoop:
|
|||
if err := s.transport.writePacket(Marshal(discMsg)); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
return nil, discMsg
|
||||
authErrs = append(authErrs, discMsg)
|
||||
return nil, &ServerAuthError{Errors: authErrs}
|
||||
}
|
||||
|
||||
var userAuthReq userAuthRequestMsg
|
||||
|
|
|
@ -0,0 +1,122 @@
|
|||
// Copyright 2024 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 http2
|
||||
|
||||
import (
|
||||
"math"
|
||||
"net/http"
|
||||
"time"
|
||||
)
|
||||
|
||||
// http2Config is a package-internal version of net/http.HTTP2Config.
|
||||
//
|
||||
// http.HTTP2Config was added in Go 1.24.
|
||||
// When running with a version of net/http that includes HTTP2Config,
|
||||
// we merge the configuration with the fields in Transport or Server
|
||||
// to produce an http2Config.
|
||||
//
|
||||
// Zero valued fields in http2Config are interpreted as in the
|
||||
// net/http.HTTPConfig documentation.
|
||||
//
|
||||
// Precedence order for reconciling configurations is:
|
||||
//
|
||||
// - Use the net/http.{Server,Transport}.HTTP2Config value, when non-zero.
|
||||
// - Otherwise use the http2.{Server.Transport} value.
|
||||
// - If the resulting value is zero or out of range, use a default.
|
||||
type http2Config struct {
|
||||
MaxConcurrentStreams uint32
|
||||
MaxDecoderHeaderTableSize uint32
|
||||
MaxEncoderHeaderTableSize uint32
|
||||
MaxReadFrameSize uint32
|
||||
MaxUploadBufferPerConnection int32
|
||||
MaxUploadBufferPerStream int32
|
||||
SendPingTimeout time.Duration
|
||||
PingTimeout time.Duration
|
||||
WriteByteTimeout time.Duration
|
||||
PermitProhibitedCipherSuites bool
|
||||
CountError func(errType string)
|
||||
}
|
||||
|
||||
// configFromServer merges configuration settings from
|
||||
// net/http.Server.HTTP2Config and http2.Server.
|
||||
func configFromServer(h1 *http.Server, h2 *Server) http2Config {
|
||||
conf := http2Config{
|
||||
MaxConcurrentStreams: h2.MaxConcurrentStreams,
|
||||
MaxEncoderHeaderTableSize: h2.MaxEncoderHeaderTableSize,
|
||||
MaxDecoderHeaderTableSize: h2.MaxDecoderHeaderTableSize,
|
||||
MaxReadFrameSize: h2.MaxReadFrameSize,
|
||||
MaxUploadBufferPerConnection: h2.MaxUploadBufferPerConnection,
|
||||
MaxUploadBufferPerStream: h2.MaxUploadBufferPerStream,
|
||||
SendPingTimeout: h2.ReadIdleTimeout,
|
||||
PingTimeout: h2.PingTimeout,
|
||||
WriteByteTimeout: h2.WriteByteTimeout,
|
||||
PermitProhibitedCipherSuites: h2.PermitProhibitedCipherSuites,
|
||||
CountError: h2.CountError,
|
||||
}
|
||||
fillNetHTTPServerConfig(&conf, h1)
|
||||
setConfigDefaults(&conf, true)
|
||||
return conf
|
||||
}
|
||||
|
||||
// configFromServer merges configuration settings from h2 and h2.t1.HTTP2
|
||||
// (the net/http Transport).
|
||||
func configFromTransport(h2 *Transport) http2Config {
|
||||
conf := http2Config{
|
||||
MaxEncoderHeaderTableSize: h2.MaxEncoderHeaderTableSize,
|
||||
MaxDecoderHeaderTableSize: h2.MaxDecoderHeaderTableSize,
|
||||
MaxReadFrameSize: h2.MaxReadFrameSize,
|
||||
SendPingTimeout: h2.ReadIdleTimeout,
|
||||
PingTimeout: h2.PingTimeout,
|
||||
WriteByteTimeout: h2.WriteByteTimeout,
|
||||
}
|
||||
|
||||
// Unlike most config fields, where out-of-range values revert to the default,
|
||||
// Transport.MaxReadFrameSize clips.
|
||||
if conf.MaxReadFrameSize < minMaxFrameSize {
|
||||
conf.MaxReadFrameSize = minMaxFrameSize
|
||||
} else if conf.MaxReadFrameSize > maxFrameSize {
|
||||
conf.MaxReadFrameSize = maxFrameSize
|
||||
}
|
||||
|
||||
if h2.t1 != nil {
|
||||
fillNetHTTPTransportConfig(&conf, h2.t1)
|
||||
}
|
||||
setConfigDefaults(&conf, false)
|
||||
return conf
|
||||
}
|
||||
|
||||
func setDefault[T ~int | ~int32 | ~uint32 | ~int64](v *T, minval, maxval, defval T) {
|
||||
if *v < minval || *v > maxval {
|
||||
*v = defval
|
||||
}
|
||||
}
|
||||
|
||||
func setConfigDefaults(conf *http2Config, server bool) {
|
||||
setDefault(&conf.MaxConcurrentStreams, 1, math.MaxUint32, defaultMaxStreams)
|
||||
setDefault(&conf.MaxEncoderHeaderTableSize, 1, math.MaxUint32, initialHeaderTableSize)
|
||||
setDefault(&conf.MaxDecoderHeaderTableSize, 1, math.MaxUint32, initialHeaderTableSize)
|
||||
if server {
|
||||
setDefault(&conf.MaxUploadBufferPerConnection, initialWindowSize, math.MaxInt32, 1<<20)
|
||||
} else {
|
||||
setDefault(&conf.MaxUploadBufferPerConnection, initialWindowSize, math.MaxInt32, transportDefaultConnFlow)
|
||||
}
|
||||
if server {
|
||||
setDefault(&conf.MaxUploadBufferPerStream, 1, math.MaxInt32, 1<<20)
|
||||
} else {
|
||||
setDefault(&conf.MaxUploadBufferPerStream, 1, math.MaxInt32, transportDefaultStreamFlow)
|
||||
}
|
||||
setDefault(&conf.MaxReadFrameSize, minMaxFrameSize, maxFrameSize, defaultMaxReadFrameSize)
|
||||
setDefault(&conf.PingTimeout, 1, math.MaxInt64, 15*time.Second)
|
||||
}
|
||||
|
||||
// adjustHTTP1MaxHeaderSize converts a limit in bytes on the size of an HTTP/1 header
|
||||
// to an HTTP/2 MAX_HEADER_LIST_SIZE value.
|
||||
func adjustHTTP1MaxHeaderSize(n int64) int64 {
|
||||
// http2's count is in a slightly different unit and includes 32 bytes per pair.
|
||||
// So, take the net/http.Server value and pad it up a bit, assuming 10 headers.
|
||||
const perFieldOverhead = 32 // per http2 spec
|
||||
const typicalHeaders = 10 // conservative
|
||||
return n + typicalHeaders*perFieldOverhead
|
||||
}
|
|
@ -0,0 +1,61 @@
|
|||
// Copyright 2024 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.24
|
||||
|
||||
package http2
|
||||
|
||||
import "net/http"
|
||||
|
||||
// fillNetHTTPServerConfig sets fields in conf from srv.HTTP2.
|
||||
func fillNetHTTPServerConfig(conf *http2Config, srv *http.Server) {
|
||||
fillNetHTTPConfig(conf, srv.HTTP2)
|
||||
}
|
||||
|
||||
// fillNetHTTPServerConfig sets fields in conf from tr.HTTP2.
|
||||
func fillNetHTTPTransportConfig(conf *http2Config, tr *http.Transport) {
|
||||
fillNetHTTPConfig(conf, tr.HTTP2)
|
||||
}
|
||||
|
||||
func fillNetHTTPConfig(conf *http2Config, h2 *http.HTTP2Config) {
|
||||
if h2 == nil {
|
||||
return
|
||||
}
|
||||
if h2.MaxConcurrentStreams != 0 {
|
||||
conf.MaxConcurrentStreams = uint32(h2.MaxConcurrentStreams)
|
||||
}
|
||||
if h2.MaxEncoderHeaderTableSize != 0 {
|
||||
conf.MaxEncoderHeaderTableSize = uint32(h2.MaxEncoderHeaderTableSize)
|
||||
}
|
||||
if h2.MaxDecoderHeaderTableSize != 0 {
|
||||
conf.MaxDecoderHeaderTableSize = uint32(h2.MaxDecoderHeaderTableSize)
|
||||
}
|
||||
if h2.MaxConcurrentStreams != 0 {
|
||||
conf.MaxConcurrentStreams = uint32(h2.MaxConcurrentStreams)
|
||||
}
|
||||
if h2.MaxReadFrameSize != 0 {
|
||||
conf.MaxReadFrameSize = uint32(h2.MaxReadFrameSize)
|
||||
}
|
||||
if h2.MaxReceiveBufferPerConnection != 0 {
|
||||
conf.MaxUploadBufferPerConnection = int32(h2.MaxReceiveBufferPerConnection)
|
||||
}
|
||||
if h2.MaxReceiveBufferPerStream != 0 {
|
||||
conf.MaxUploadBufferPerStream = int32(h2.MaxReceiveBufferPerStream)
|
||||
}
|
||||
if h2.SendPingTimeout != 0 {
|
||||
conf.SendPingTimeout = h2.SendPingTimeout
|
||||
}
|
||||
if h2.PingTimeout != 0 {
|
||||
conf.PingTimeout = h2.PingTimeout
|
||||
}
|
||||
if h2.WriteByteTimeout != 0 {
|
||||
conf.WriteByteTimeout = h2.WriteByteTimeout
|
||||
}
|
||||
if h2.PermitProhibitedCipherSuites {
|
||||
conf.PermitProhibitedCipherSuites = true
|
||||
}
|
||||
if h2.CountError != nil {
|
||||
conf.CountError = h2.CountError
|
||||
}
|
||||
}
|
|
@ -0,0 +1,16 @@
|
|||
// Copyright 2024 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.24
|
||||
|
||||
package http2
|
||||
|
||||
import "net/http"
|
||||
|
||||
// Pre-Go 1.24 fallback.
|
||||
// The Server.HTTP2 and Transport.HTTP2 config fields were added in Go 1.24.
|
||||
|
||||
func fillNetHTTPServerConfig(conf *http2Config, srv *http.Server) {}
|
||||
|
||||
func fillNetHTTPTransportConfig(conf *http2Config, tr *http.Transport) {}
|
|
@ -19,8 +19,9 @@ import (
|
|||
"bufio"
|
||||
"context"
|
||||
"crypto/tls"
|
||||
"errors"
|
||||
"fmt"
|
||||
"io"
|
||||
"net"
|
||||
"net/http"
|
||||
"os"
|
||||
"sort"
|
||||
|
@ -238,12 +239,18 @@ func (cw closeWaiter) Wait() {
|
|||
// idle memory usage with many connections.
|
||||
type bufferedWriter struct {
|
||||
_ incomparable
|
||||
w io.Writer // immutable
|
||||
group synctestGroupInterface // immutable
|
||||
conn net.Conn // immutable
|
||||
bw *bufio.Writer // non-nil when data is buffered
|
||||
byteTimeout time.Duration // immutable, WriteByteTimeout
|
||||
}
|
||||
|
||||
func newBufferedWriter(w io.Writer) *bufferedWriter {
|
||||
return &bufferedWriter{w: w}
|
||||
func newBufferedWriter(group synctestGroupInterface, conn net.Conn, timeout time.Duration) *bufferedWriter {
|
||||
return &bufferedWriter{
|
||||
group: group,
|
||||
conn: conn,
|
||||
byteTimeout: timeout,
|
||||
}
|
||||
}
|
||||
|
||||
// bufWriterPoolBufferSize is the size of bufio.Writer's
|
||||
|
@ -270,7 +277,7 @@ func (w *bufferedWriter) Available() int {
|
|||
func (w *bufferedWriter) Write(p []byte) (n int, err error) {
|
||||
if w.bw == nil {
|
||||
bw := bufWriterPool.Get().(*bufio.Writer)
|
||||
bw.Reset(w.w)
|
||||
bw.Reset((*bufferedWriterTimeoutWriter)(w))
|
||||
w.bw = bw
|
||||
}
|
||||
return w.bw.Write(p)
|
||||
|
@ -288,6 +295,38 @@ func (w *bufferedWriter) Flush() error {
|
|||
return err
|
||||
}
|
||||
|
||||
type bufferedWriterTimeoutWriter bufferedWriter
|
||||
|
||||
func (w *bufferedWriterTimeoutWriter) Write(p []byte) (n int, err error) {
|
||||
return writeWithByteTimeout(w.group, w.conn, w.byteTimeout, p)
|
||||
}
|
||||
|
||||
// writeWithByteTimeout writes to conn.
|
||||
// If more than timeout passes without any bytes being written to the connection,
|
||||
// the write fails.
|
||||
func writeWithByteTimeout(group synctestGroupInterface, conn net.Conn, timeout time.Duration, p []byte) (n int, err error) {
|
||||
if timeout <= 0 {
|
||||
return conn.Write(p)
|
||||
}
|
||||
for {
|
||||
var now time.Time
|
||||
if group == nil {
|
||||
now = time.Now()
|
||||
} else {
|
||||
now = group.Now()
|
||||
}
|
||||
conn.SetWriteDeadline(now.Add(timeout))
|
||||
nn, err := conn.Write(p[n:])
|
||||
n += nn
|
||||
if n == len(p) || nn == 0 || !errors.Is(err, os.ErrDeadlineExceeded) {
|
||||
// Either we finished the write, made no progress, or hit the deadline.
|
||||
// Whichever it is, we're done now.
|
||||
conn.SetWriteDeadline(time.Time{})
|
||||
return n, err
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func mustUint31(v int32) uint32 {
|
||||
if v < 0 || v > 2147483647 {
|
||||
panic("out of range")
|
||||
|
|
|
@ -29,6 +29,7 @@ import (
|
|||
"bufio"
|
||||
"bytes"
|
||||
"context"
|
||||
"crypto/rand"
|
||||
"crypto/tls"
|
||||
"errors"
|
||||
"fmt"
|
||||
|
@ -56,6 +57,10 @@ const (
|
|||
firstSettingsTimeout = 2 * time.Second // should be in-flight with preface anyway
|
||||
handlerChunkWriteSize = 4 << 10
|
||||
defaultMaxStreams = 250 // TODO: make this 100 as the GFE seems to?
|
||||
|
||||
// maxQueuedControlFrames is the maximum number of control frames like
|
||||
// SETTINGS, PING and RST_STREAM that will be queued for writing before
|
||||
// the connection is closed to prevent memory exhaustion attacks.
|
||||
maxQueuedControlFrames = 10000
|
||||
)
|
||||
|
||||
|
@ -127,6 +132,22 @@ type Server struct {
|
|||
// If zero or negative, there is no timeout.
|
||||
IdleTimeout time.Duration
|
||||
|
||||
// ReadIdleTimeout is the timeout after which a health check using a ping
|
||||
// frame will be carried out if no frame is received on the connection.
|
||||
// If zero, no health check is performed.
|
||||
ReadIdleTimeout time.Duration
|
||||
|
||||
// PingTimeout is the timeout after which the connection will be closed
|
||||
// if a response to a ping is not received.
|
||||
// If zero, a default of 15 seconds is used.
|
||||
PingTimeout time.Duration
|
||||
|
||||
// WriteByteTimeout is the timeout after which a connection will be
|
||||
// closed if no data can be written to it. The timeout begins when data is
|
||||
// available to write, and is extended whenever any bytes are written.
|
||||
// If zero or negative, there is no timeout.
|
||||
WriteByteTimeout time.Duration
|
||||
|
||||
// MaxUploadBufferPerConnection is the size of the initial flow
|
||||
// control window for each connections. The HTTP/2 spec does not
|
||||
// allow this to be smaller than 65535 or larger than 2^32-1.
|
||||
|
@ -189,57 +210,6 @@ func (s *Server) afterFunc(d time.Duration, f func()) timer {
|
|||
return timeTimer{time.AfterFunc(d, f)}
|
||||
}
|
||||
|
||||
func (s *Server) initialConnRecvWindowSize() int32 {
|
||||
if s.MaxUploadBufferPerConnection >= initialWindowSize {
|
||||
return s.MaxUploadBufferPerConnection
|
||||
}
|
||||
return 1 << 20
|
||||
}
|
||||
|
||||
func (s *Server) initialStreamRecvWindowSize() int32 {
|
||||
if s.MaxUploadBufferPerStream > 0 {
|
||||
return s.MaxUploadBufferPerStream
|
||||
}
|
||||
return 1 << 20
|
||||
}
|
||||
|
||||
func (s *Server) maxReadFrameSize() uint32 {
|
||||
if v := s.MaxReadFrameSize; v >= minMaxFrameSize && v <= maxFrameSize {
|
||||
return v
|
||||
}
|
||||
return defaultMaxReadFrameSize
|
||||
}
|
||||
|
||||
func (s *Server) maxConcurrentStreams() uint32 {
|
||||
if v := s.MaxConcurrentStreams; v > 0 {
|
||||
return v
|
||||
}
|
||||
return defaultMaxStreams
|
||||
}
|
||||
|
||||
func (s *Server) maxDecoderHeaderTableSize() uint32 {
|
||||
if v := s.MaxDecoderHeaderTableSize; v > 0 {
|
||||
return v
|
||||
}
|
||||
return initialHeaderTableSize
|
||||
}
|
||||
|
||||
func (s *Server) maxEncoderHeaderTableSize() uint32 {
|
||||
if v := s.MaxEncoderHeaderTableSize; v > 0 {
|
||||
return v
|
||||
}
|
||||
return initialHeaderTableSize
|
||||
}
|
||||
|
||||
// maxQueuedControlFrames is the maximum number of control frames like
|
||||
// SETTINGS, PING and RST_STREAM that will be queued for writing before
|
||||
// the connection is closed to prevent memory exhaustion attacks.
|
||||
func (s *Server) maxQueuedControlFrames() int {
|
||||
// TODO: if anybody asks, add a Server field, and remember to define the
|
||||
// behavior of negative values.
|
||||
return maxQueuedControlFrames
|
||||
}
|
||||
|
||||
type serverInternalState struct {
|
||||
mu sync.Mutex
|
||||
activeConns map[*serverConn]struct{}
|
||||
|
@ -440,13 +410,15 @@ func (s *Server) serveConn(c net.Conn, opts *ServeConnOpts, newf func(*serverCon
|
|||
baseCtx, cancel := serverConnBaseContext(c, opts)
|
||||
defer cancel()
|
||||
|
||||
http1srv := opts.baseConfig()
|
||||
conf := configFromServer(http1srv, s)
|
||||
sc := &serverConn{
|
||||
srv: s,
|
||||
hs: opts.baseConfig(),
|
||||
hs: http1srv,
|
||||
conn: c,
|
||||
baseCtx: baseCtx,
|
||||
remoteAddrStr: c.RemoteAddr().String(),
|
||||
bw: newBufferedWriter(c),
|
||||
bw: newBufferedWriter(s.group, c, conf.WriteByteTimeout),
|
||||
handler: opts.handler(),
|
||||
streams: make(map[uint32]*stream),
|
||||
readFrameCh: make(chan readFrameResult),
|
||||
|
@ -456,9 +428,12 @@ func (s *Server) serveConn(c net.Conn, opts *ServeConnOpts, newf func(*serverCon
|
|||
bodyReadCh: make(chan bodyReadMsg), // buffering doesn't matter either way
|
||||
doneServing: make(chan struct{}),
|
||||
clientMaxStreams: math.MaxUint32, // Section 6.5.2: "Initially, there is no limit to this value"
|
||||
advMaxStreams: s.maxConcurrentStreams(),
|
||||
advMaxStreams: conf.MaxConcurrentStreams,
|
||||
initialStreamSendWindowSize: initialWindowSize,
|
||||
initialStreamRecvWindowSize: conf.MaxUploadBufferPerStream,
|
||||
maxFrameSize: initialMaxFrameSize,
|
||||
pingTimeout: conf.PingTimeout,
|
||||
countErrorFunc: conf.CountError,
|
||||
serveG: newGoroutineLock(),
|
||||
pushEnabled: true,
|
||||
sawClientPreface: opts.SawClientPreface,
|
||||
|
@ -491,15 +466,15 @@ func (s *Server) serveConn(c net.Conn, opts *ServeConnOpts, newf func(*serverCon
|
|||
sc.flow.add(initialWindowSize)
|
||||
sc.inflow.init(initialWindowSize)
|
||||
sc.hpackEncoder = hpack.NewEncoder(&sc.headerWriteBuf)
|
||||
sc.hpackEncoder.SetMaxDynamicTableSizeLimit(s.maxEncoderHeaderTableSize())
|
||||
sc.hpackEncoder.SetMaxDynamicTableSizeLimit(conf.MaxEncoderHeaderTableSize)
|
||||
|
||||
fr := NewFramer(sc.bw, c)
|
||||
if s.CountError != nil {
|
||||
fr.countError = s.CountError
|
||||
if conf.CountError != nil {
|
||||
fr.countError = conf.CountError
|
||||
}
|
||||
fr.ReadMetaHeaders = hpack.NewDecoder(s.maxDecoderHeaderTableSize(), nil)
|
||||
fr.ReadMetaHeaders = hpack.NewDecoder(conf.MaxDecoderHeaderTableSize, nil)
|
||||
fr.MaxHeaderListSize = sc.maxHeaderListSize()
|
||||
fr.SetMaxReadFrameSize(s.maxReadFrameSize())
|
||||
fr.SetMaxReadFrameSize(conf.MaxReadFrameSize)
|
||||
sc.framer = fr
|
||||
|
||||
if tc, ok := c.(connectionStater); ok {
|
||||
|
@ -532,7 +507,7 @@ func (s *Server) serveConn(c net.Conn, opts *ServeConnOpts, newf func(*serverCon
|
|||
// So for now, do nothing here again.
|
||||
}
|
||||
|
||||
if !s.PermitProhibitedCipherSuites && isBadCipher(sc.tlsState.CipherSuite) {
|
||||
if !conf.PermitProhibitedCipherSuites && isBadCipher(sc.tlsState.CipherSuite) {
|
||||
// "Endpoints MAY choose to generate a connection error
|
||||
// (Section 5.4.1) of type INADEQUATE_SECURITY if one of
|
||||
// the prohibited cipher suites are negotiated."
|
||||
|
@ -569,7 +544,7 @@ func (s *Server) serveConn(c net.Conn, opts *ServeConnOpts, newf func(*serverCon
|
|||
opts.UpgradeRequest = nil
|
||||
}
|
||||
|
||||
sc.serve()
|
||||
sc.serve(conf)
|
||||
}
|
||||
|
||||
func serverConnBaseContext(c net.Conn, opts *ServeConnOpts) (ctx context.Context, cancel func()) {
|
||||
|
@ -609,6 +584,7 @@ type serverConn struct {
|
|||
tlsState *tls.ConnectionState // shared by all handlers, like net/http
|
||||
remoteAddrStr string
|
||||
writeSched WriteScheduler
|
||||
countErrorFunc func(errType string)
|
||||
|
||||
// Everything following is owned by the serve loop; use serveG.check():
|
||||
serveG goroutineLock // used to verify funcs are on serve()
|
||||
|
@ -628,6 +604,7 @@ type serverConn struct {
|
|||
streams map[uint32]*stream
|
||||
unstartedHandlers []unstartedHandler
|
||||
initialStreamSendWindowSize int32
|
||||
initialStreamRecvWindowSize int32
|
||||
maxFrameSize int32
|
||||
peerMaxHeaderListSize uint32 // zero means unknown (default)
|
||||
canonHeader map[string]string // http2-lower-case -> Go-Canonical-Case
|
||||
|
@ -638,9 +615,14 @@ type serverConn struct {
|
|||
inGoAway bool // we've started to or sent GOAWAY
|
||||
inFrameScheduleLoop bool // whether we're in the scheduleFrameWrite loop
|
||||
needToSendGoAway bool // we need to schedule a GOAWAY frame write
|
||||
pingSent bool
|
||||
sentPingData [8]byte
|
||||
goAwayCode ErrCode
|
||||
shutdownTimer timer // nil until used
|
||||
idleTimer timer // nil if unused
|
||||
readIdleTimeout time.Duration
|
||||
pingTimeout time.Duration
|
||||
readIdleTimer timer // nil if unused
|
||||
|
||||
// Owned by the writeFrameAsync goroutine:
|
||||
headerWriteBuf bytes.Buffer
|
||||
|
@ -655,11 +637,7 @@ func (sc *serverConn) maxHeaderListSize() uint32 {
|
|||
if n <= 0 {
|
||||
n = http.DefaultMaxHeaderBytes
|
||||
}
|
||||
// http2's count is in a slightly different unit and includes 32 bytes per pair.
|
||||
// So, take the net/http.Server value and pad it up a bit, assuming 10 headers.
|
||||
const perFieldOverhead = 32 // per http2 spec
|
||||
const typicalHeaders = 10 // conservative
|
||||
return uint32(n + typicalHeaders*perFieldOverhead)
|
||||
return uint32(adjustHTTP1MaxHeaderSize(int64(n)))
|
||||
}
|
||||
|
||||
func (sc *serverConn) curOpenStreams() uint32 {
|
||||
|
@ -923,7 +901,7 @@ func (sc *serverConn) notePanic() {
|
|||
}
|
||||
}
|
||||
|
||||
func (sc *serverConn) serve() {
|
||||
func (sc *serverConn) serve(conf http2Config) {
|
||||
sc.serveG.check()
|
||||
defer sc.notePanic()
|
||||
defer sc.conn.Close()
|
||||
|
@ -937,18 +915,18 @@ func (sc *serverConn) serve() {
|
|||
|
||||
sc.writeFrame(FrameWriteRequest{
|
||||
write: writeSettings{
|
||||
{SettingMaxFrameSize, sc.srv.maxReadFrameSize()},
|
||||
{SettingMaxFrameSize, conf.MaxReadFrameSize},
|
||||
{SettingMaxConcurrentStreams, sc.advMaxStreams},
|
||||
{SettingMaxHeaderListSize, sc.maxHeaderListSize()},
|
||||
{SettingHeaderTableSize, sc.srv.maxDecoderHeaderTableSize()},
|
||||
{SettingInitialWindowSize, uint32(sc.srv.initialStreamRecvWindowSize())},
|
||||
{SettingHeaderTableSize, conf.MaxDecoderHeaderTableSize},
|
||||
{SettingInitialWindowSize, uint32(sc.initialStreamRecvWindowSize)},
|
||||
},
|
||||
})
|
||||
sc.unackedSettings++
|
||||
|
||||
// Each connection starts with initialWindowSize inflow tokens.
|
||||
// If a higher value is configured, we add more tokens.
|
||||
if diff := sc.srv.initialConnRecvWindowSize() - initialWindowSize; diff > 0 {
|
||||
if diff := conf.MaxUploadBufferPerConnection - initialWindowSize; diff > 0 {
|
||||
sc.sendWindowUpdate(nil, int(diff))
|
||||
}
|
||||
|
||||
|
@ -968,11 +946,18 @@ func (sc *serverConn) serve() {
|
|||
defer sc.idleTimer.Stop()
|
||||
}
|
||||
|
||||
if conf.SendPingTimeout > 0 {
|
||||
sc.readIdleTimeout = conf.SendPingTimeout
|
||||
sc.readIdleTimer = sc.srv.afterFunc(conf.SendPingTimeout, sc.onReadIdleTimer)
|
||||
defer sc.readIdleTimer.Stop()
|
||||
}
|
||||
|
||||
go sc.readFrames() // closed by defer sc.conn.Close above
|
||||
|
||||
settingsTimer := sc.srv.afterFunc(firstSettingsTimeout, sc.onSettingsTimer)
|
||||
defer settingsTimer.Stop()
|
||||
|
||||
lastFrameTime := sc.srv.now()
|
||||
loopNum := 0
|
||||
for {
|
||||
loopNum++
|
||||
|
@ -986,6 +971,7 @@ func (sc *serverConn) serve() {
|
|||
case res := <-sc.wroteFrameCh:
|
||||
sc.wroteFrame(res)
|
||||
case res := <-sc.readFrameCh:
|
||||
lastFrameTime = sc.srv.now()
|
||||
// Process any written frames before reading new frames from the client since a
|
||||
// written frame could have triggered a new stream to be started.
|
||||
if sc.writingFrameAsync {
|
||||
|
@ -1017,6 +1003,8 @@ func (sc *serverConn) serve() {
|
|||
case idleTimerMsg:
|
||||
sc.vlogf("connection is idle")
|
||||
sc.goAway(ErrCodeNo)
|
||||
case readIdleTimerMsg:
|
||||
sc.handlePingTimer(lastFrameTime)
|
||||
case shutdownTimerMsg:
|
||||
sc.vlogf("GOAWAY close timer fired; closing conn from %v", sc.conn.RemoteAddr())
|
||||
return
|
||||
|
@ -1039,7 +1027,7 @@ func (sc *serverConn) serve() {
|
|||
// If the peer is causing us to generate a lot of control frames,
|
||||
// but not reading them from us, assume they are trying to make us
|
||||
// run out of memory.
|
||||
if sc.queuedControlFrames > sc.srv.maxQueuedControlFrames() {
|
||||
if sc.queuedControlFrames > maxQueuedControlFrames {
|
||||
sc.vlogf("http2: too many control frames in send queue, closing connection")
|
||||
return
|
||||
}
|
||||
|
@ -1055,12 +1043,39 @@ func (sc *serverConn) serve() {
|
|||
}
|
||||
}
|
||||
|
||||
func (sc *serverConn) handlePingTimer(lastFrameReadTime time.Time) {
|
||||
if sc.pingSent {
|
||||
sc.vlogf("timeout waiting for PING response")
|
||||
sc.conn.Close()
|
||||
return
|
||||
}
|
||||
|
||||
pingAt := lastFrameReadTime.Add(sc.readIdleTimeout)
|
||||
now := sc.srv.now()
|
||||
if pingAt.After(now) {
|
||||
// We received frames since arming the ping timer.
|
||||
// Reset it for the next possible timeout.
|
||||
sc.readIdleTimer.Reset(pingAt.Sub(now))
|
||||
return
|
||||
}
|
||||
|
||||
sc.pingSent = true
|
||||
// Ignore crypto/rand.Read errors: It generally can't fail, and worse case if it does
|
||||
// is we send a PING frame containing 0s.
|
||||
_, _ = rand.Read(sc.sentPingData[:])
|
||||
sc.writeFrame(FrameWriteRequest{
|
||||
write: &writePing{data: sc.sentPingData},
|
||||
})
|
||||
sc.readIdleTimer.Reset(sc.pingTimeout)
|
||||
}
|
||||
|
||||
type serverMessage int
|
||||
|
||||
// Message values sent to serveMsgCh.
|
||||
var (
|
||||
settingsTimerMsg = new(serverMessage)
|
||||
idleTimerMsg = new(serverMessage)
|
||||
readIdleTimerMsg = new(serverMessage)
|
||||
shutdownTimerMsg = new(serverMessage)
|
||||
gracefulShutdownMsg = new(serverMessage)
|
||||
handlerDoneMsg = new(serverMessage)
|
||||
|
@ -1068,6 +1083,7 @@ var (
|
|||
|
||||
func (sc *serverConn) onSettingsTimer() { sc.sendServeMsg(settingsTimerMsg) }
|
||||
func (sc *serverConn) onIdleTimer() { sc.sendServeMsg(idleTimerMsg) }
|
||||
func (sc *serverConn) onReadIdleTimer() { sc.sendServeMsg(readIdleTimerMsg) }
|
||||
func (sc *serverConn) onShutdownTimer() { sc.sendServeMsg(shutdownTimerMsg) }
|
||||
|
||||
func (sc *serverConn) sendServeMsg(msg interface{}) {
|
||||
|
@ -1320,6 +1336,10 @@ func (sc *serverConn) wroteFrame(res frameWriteResult) {
|
|||
sc.writingFrame = false
|
||||
sc.writingFrameAsync = false
|
||||
|
||||
if res.err != nil {
|
||||
sc.conn.Close()
|
||||
}
|
||||
|
||||
wr := res.wr
|
||||
|
||||
if writeEndsStream(wr.write) {
|
||||
|
@ -1594,6 +1614,11 @@ func (sc *serverConn) processFrame(f Frame) error {
|
|||
func (sc *serverConn) processPing(f *PingFrame) error {
|
||||
sc.serveG.check()
|
||||
if f.IsAck() {
|
||||
if sc.pingSent && sc.sentPingData == f.Data {
|
||||
// This is a response to a PING we sent.
|
||||
sc.pingSent = false
|
||||
sc.readIdleTimer.Reset(sc.readIdleTimeout)
|
||||
}
|
||||
// 6.7 PING: " An endpoint MUST NOT respond to PING frames
|
||||
// containing this flag."
|
||||
return nil
|
||||
|
@ -2160,7 +2185,7 @@ func (sc *serverConn) newStream(id, pusherID uint32, state streamState) *stream
|
|||
st.cw.Init()
|
||||
st.flow.conn = &sc.flow // link to conn-level counter
|
||||
st.flow.add(sc.initialStreamSendWindowSize)
|
||||
st.inflow.init(sc.srv.initialStreamRecvWindowSize())
|
||||
st.inflow.init(sc.initialStreamRecvWindowSize)
|
||||
if sc.hs.WriteTimeout > 0 {
|
||||
st.writeDeadline = sc.srv.afterFunc(sc.hs.WriteTimeout, st.onWriteTimeout)
|
||||
}
|
||||
|
@ -3301,7 +3326,7 @@ func (sc *serverConn) countError(name string, err error) error {
|
|||
if sc == nil || sc.srv == nil {
|
||||
return err
|
||||
}
|
||||
f := sc.srv.CountError
|
||||
f := sc.countErrorFunc
|
||||
if f == nil {
|
||||
return err
|
||||
}
|
||||
|
|
|
@ -25,7 +25,6 @@ import (
|
|||
"net/http"
|
||||
"net/http/httptrace"
|
||||
"net/textproto"
|
||||
"os"
|
||||
"sort"
|
||||
"strconv"
|
||||
"strings"
|
||||
|
@ -227,40 +226,26 @@ func (t *Transport) contextWithTimeout(ctx context.Context, d time.Duration) (co
|
|||
}
|
||||
|
||||
func (t *Transport) maxHeaderListSize() uint32 {
|
||||
if t.MaxHeaderListSize == 0 {
|
||||
n := int64(t.MaxHeaderListSize)
|
||||
if t.t1 != nil && t.t1.MaxResponseHeaderBytes != 0 {
|
||||
n = t.t1.MaxResponseHeaderBytes
|
||||
if n > 0 {
|
||||
n = adjustHTTP1MaxHeaderSize(n)
|
||||
}
|
||||
}
|
||||
if n <= 0 {
|
||||
return 10 << 20
|
||||
}
|
||||
if t.MaxHeaderListSize == 0xffffffff {
|
||||
if n >= 0xffffffff {
|
||||
return 0
|
||||
}
|
||||
return t.MaxHeaderListSize
|
||||
}
|
||||
|
||||
func (t *Transport) maxFrameReadSize() uint32 {
|
||||
if t.MaxReadFrameSize == 0 {
|
||||
return 0 // use the default provided by the peer
|
||||
}
|
||||
if t.MaxReadFrameSize < minMaxFrameSize {
|
||||
return minMaxFrameSize
|
||||
}
|
||||
if t.MaxReadFrameSize > maxFrameSize {
|
||||
return maxFrameSize
|
||||
}
|
||||
return t.MaxReadFrameSize
|
||||
return uint32(n)
|
||||
}
|
||||
|
||||
func (t *Transport) disableCompression() bool {
|
||||
return t.DisableCompression || (t.t1 != nil && t.t1.DisableCompression)
|
||||
}
|
||||
|
||||
func (t *Transport) pingTimeout() time.Duration {
|
||||
if t.PingTimeout == 0 {
|
||||
return 15 * time.Second
|
||||
}
|
||||
return t.PingTimeout
|
||||
|
||||
}
|
||||
|
||||
// ConfigureTransport configures a net/http HTTP/1 Transport to use HTTP/2.
|
||||
// It returns an error if t1 has already been HTTP/2-enabled.
|
||||
//
|
||||
|
@ -375,6 +360,9 @@ type ClientConn struct {
|
|||
peerMaxHeaderListSize uint64
|
||||
peerMaxHeaderTableSize uint32
|
||||
initialWindowSize uint32
|
||||
initialStreamRecvWindowSize int32
|
||||
readIdleTimeout time.Duration
|
||||
pingTimeout time.Duration
|
||||
|
||||
// reqHeaderMu is a 1-element semaphore channel controlling access to sending new requests.
|
||||
// Write to reqHeaderMu to lock it, read from it to unlock.
|
||||
|
@ -499,6 +487,7 @@ func (cs *clientStream) closeReqBodyLocked() {
|
|||
}
|
||||
|
||||
type stickyErrWriter struct {
|
||||
group synctestGroupInterface
|
||||
conn net.Conn
|
||||
timeout time.Duration
|
||||
err *error
|
||||
|
@ -508,22 +497,9 @@ func (sew stickyErrWriter) Write(p []byte) (n int, err error) {
|
|||
if *sew.err != nil {
|
||||
return 0, *sew.err
|
||||
}
|
||||
for {
|
||||
if sew.timeout != 0 {
|
||||
sew.conn.SetWriteDeadline(time.Now().Add(sew.timeout))
|
||||
}
|
||||
nn, err := sew.conn.Write(p[n:])
|
||||
n += nn
|
||||
if n < len(p) && nn > 0 && errors.Is(err, os.ErrDeadlineExceeded) {
|
||||
// Keep extending the deadline so long as we're making progress.
|
||||
continue
|
||||
}
|
||||
if sew.timeout != 0 {
|
||||
sew.conn.SetWriteDeadline(time.Time{})
|
||||
}
|
||||
n, err = writeWithByteTimeout(sew.group, sew.conn, sew.timeout, p)
|
||||
*sew.err = err
|
||||
return n, err
|
||||
}
|
||||
}
|
||||
|
||||
// noCachedConnError is the concrete type of ErrNoCachedConn, which
|
||||
|
@ -758,25 +734,12 @@ func (t *Transport) expectContinueTimeout() time.Duration {
|
|||
return t.t1.ExpectContinueTimeout
|
||||
}
|
||||
|
||||
func (t *Transport) maxDecoderHeaderTableSize() uint32 {
|
||||
if v := t.MaxDecoderHeaderTableSize; v > 0 {
|
||||
return v
|
||||
}
|
||||
return initialHeaderTableSize
|
||||
}
|
||||
|
||||
func (t *Transport) maxEncoderHeaderTableSize() uint32 {
|
||||
if v := t.MaxEncoderHeaderTableSize; v > 0 {
|
||||
return v
|
||||
}
|
||||
return initialHeaderTableSize
|
||||
}
|
||||
|
||||
func (t *Transport) NewClientConn(c net.Conn) (*ClientConn, error) {
|
||||
return t.newClientConn(c, t.disableKeepAlives())
|
||||
}
|
||||
|
||||
func (t *Transport) newClientConn(c net.Conn, singleUse bool) (*ClientConn, error) {
|
||||
conf := configFromTransport(t)
|
||||
cc := &ClientConn{
|
||||
t: t,
|
||||
tconn: c,
|
||||
|
@ -784,18 +747,23 @@ func (t *Transport) newClientConn(c net.Conn, singleUse bool) (*ClientConn, erro
|
|||
nextStreamID: 1,
|
||||
maxFrameSize: 16 << 10, // spec default
|
||||
initialWindowSize: 65535, // spec default
|
||||
initialStreamRecvWindowSize: conf.MaxUploadBufferPerStream,
|
||||
maxConcurrentStreams: initialMaxConcurrentStreams, // "infinite", per spec. Use a smaller value until we have received server settings.
|
||||
peerMaxHeaderListSize: 0xffffffffffffffff, // "infinite", per spec. Use 2^64-1 instead.
|
||||
streams: make(map[uint32]*clientStream),
|
||||
singleUse: singleUse,
|
||||
wantSettingsAck: true,
|
||||
readIdleTimeout: conf.SendPingTimeout,
|
||||
pingTimeout: conf.PingTimeout,
|
||||
pings: make(map[[8]byte]chan struct{}),
|
||||
reqHeaderMu: make(chan struct{}, 1),
|
||||
}
|
||||
var group synctestGroupInterface
|
||||
if t.transportTestHooks != nil {
|
||||
t.markNewGoroutine()
|
||||
t.transportTestHooks.newclientconn(cc)
|
||||
c = cc.tconn
|
||||
group = t.group
|
||||
}
|
||||
if VerboseLogs {
|
||||
t.vlogf("http2: Transport creating client conn %p to %v", cc, c.RemoteAddr())
|
||||
|
@ -807,24 +775,23 @@ func (t *Transport) newClientConn(c net.Conn, singleUse bool) (*ClientConn, erro
|
|||
// TODO: adjust this writer size to account for frame size +
|
||||
// MTU + crypto/tls record padding.
|
||||
cc.bw = bufio.NewWriter(stickyErrWriter{
|
||||
group: group,
|
||||
conn: c,
|
||||
timeout: t.WriteByteTimeout,
|
||||
timeout: conf.WriteByteTimeout,
|
||||
err: &cc.werr,
|
||||
})
|
||||
cc.br = bufio.NewReader(c)
|
||||
cc.fr = NewFramer(cc.bw, cc.br)
|
||||
if t.maxFrameReadSize() != 0 {
|
||||
cc.fr.SetMaxReadFrameSize(t.maxFrameReadSize())
|
||||
}
|
||||
cc.fr.SetMaxReadFrameSize(conf.MaxReadFrameSize)
|
||||
if t.CountError != nil {
|
||||
cc.fr.countError = t.CountError
|
||||
}
|
||||
maxHeaderTableSize := t.maxDecoderHeaderTableSize()
|
||||
maxHeaderTableSize := conf.MaxDecoderHeaderTableSize
|
||||
cc.fr.ReadMetaHeaders = hpack.NewDecoder(maxHeaderTableSize, nil)
|
||||
cc.fr.MaxHeaderListSize = t.maxHeaderListSize()
|
||||
|
||||
cc.henc = hpack.NewEncoder(&cc.hbuf)
|
||||
cc.henc.SetMaxDynamicTableSizeLimit(t.maxEncoderHeaderTableSize())
|
||||
cc.henc.SetMaxDynamicTableSizeLimit(conf.MaxEncoderHeaderTableSize)
|
||||
cc.peerMaxHeaderTableSize = initialHeaderTableSize
|
||||
|
||||
if cs, ok := c.(connectionStater); ok {
|
||||
|
@ -834,11 +801,9 @@ func (t *Transport) newClientConn(c net.Conn, singleUse bool) (*ClientConn, erro
|
|||
|
||||
initialSettings := []Setting{
|
||||
{ID: SettingEnablePush, Val: 0},
|
||||
{ID: SettingInitialWindowSize, Val: transportDefaultStreamFlow},
|
||||
}
|
||||
if max := t.maxFrameReadSize(); max != 0 {
|
||||
initialSettings = append(initialSettings, Setting{ID: SettingMaxFrameSize, Val: max})
|
||||
{ID: SettingInitialWindowSize, Val: uint32(cc.initialStreamRecvWindowSize)},
|
||||
}
|
||||
initialSettings = append(initialSettings, Setting{ID: SettingMaxFrameSize, Val: conf.MaxReadFrameSize})
|
||||
if max := t.maxHeaderListSize(); max != 0 {
|
||||
initialSettings = append(initialSettings, Setting{ID: SettingMaxHeaderListSize, Val: max})
|
||||
}
|
||||
|
@ -848,8 +813,8 @@ func (t *Transport) newClientConn(c net.Conn, singleUse bool) (*ClientConn, erro
|
|||
|
||||
cc.bw.Write(clientPreface)
|
||||
cc.fr.WriteSettings(initialSettings...)
|
||||
cc.fr.WriteWindowUpdate(0, transportDefaultConnFlow)
|
||||
cc.inflow.init(transportDefaultConnFlow + initialWindowSize)
|
||||
cc.fr.WriteWindowUpdate(0, uint32(conf.MaxUploadBufferPerConnection))
|
||||
cc.inflow.init(conf.MaxUploadBufferPerConnection + initialWindowSize)
|
||||
cc.bw.Flush()
|
||||
if cc.werr != nil {
|
||||
cc.Close()
|
||||
|
@ -867,7 +832,7 @@ func (t *Transport) newClientConn(c net.Conn, singleUse bool) (*ClientConn, erro
|
|||
}
|
||||
|
||||
func (cc *ClientConn) healthCheck() {
|
||||
pingTimeout := cc.t.pingTimeout()
|
||||
pingTimeout := cc.pingTimeout
|
||||
// We don't need to periodically ping in the health check, because the readLoop of ClientConn will
|
||||
// trigger the healthCheck again if there is no frame received.
|
||||
ctx, cancel := cc.t.contextWithTimeout(context.Background(), pingTimeout)
|
||||
|
@ -2199,7 +2164,7 @@ type resAndError struct {
|
|||
func (cc *ClientConn) addStreamLocked(cs *clientStream) {
|
||||
cs.flow.add(int32(cc.initialWindowSize))
|
||||
cs.flow.setConnFlow(&cc.flow)
|
||||
cs.inflow.init(transportDefaultStreamFlow)
|
||||
cs.inflow.init(cc.initialStreamRecvWindowSize)
|
||||
cs.ID = cc.nextStreamID
|
||||
cc.nextStreamID += 2
|
||||
cc.streams[cs.ID] = cs
|
||||
|
@ -2345,7 +2310,7 @@ func (cc *ClientConn) countReadFrameError(err error) {
|
|||
func (rl *clientConnReadLoop) run() error {
|
||||
cc := rl.cc
|
||||
gotSettings := false
|
||||
readIdleTimeout := cc.t.ReadIdleTimeout
|
||||
readIdleTimeout := cc.readIdleTimeout
|
||||
var t timer
|
||||
if readIdleTimeout != 0 {
|
||||
t = cc.t.afterFunc(readIdleTimeout, cc.healthCheck)
|
||||
|
|
|
@ -131,6 +131,16 @@ func (se StreamError) writeFrame(ctx writeContext) error {
|
|||
|
||||
func (se StreamError) staysWithinBuffer(max int) bool { return frameHeaderLen+4 <= max }
|
||||
|
||||
type writePing struct {
|
||||
data [8]byte
|
||||
}
|
||||
|
||||
func (w writePing) writeFrame(ctx writeContext) error {
|
||||
return ctx.Framer().WritePing(false, w.data)
|
||||
}
|
||||
|
||||
func (w writePing) staysWithinBuffer(max int) bool { return frameHeaderLen+len(w.data) <= max }
|
||||
|
||||
type writePingAck struct{ pf *PingFrame }
|
||||
|
||||
func (w writePingAck) writeFrame(ctx writeContext) error {
|
||||
|
|
|
@ -201,6 +201,25 @@ var S390X struct {
|
|||
_ CacheLinePad
|
||||
}
|
||||
|
||||
// RISCV64 contains the supported CPU features and performance characteristics for riscv64
|
||||
// platforms. The booleans in RISCV64, with the exception of HasFastMisaligned, indicate
|
||||
// the presence of RISC-V extensions.
|
||||
//
|
||||
// It is safe to assume that all the RV64G extensions are supported and so they are omitted from
|
||||
// this structure. As riscv64 Go programs require at least RV64G, the code that populates
|
||||
// this structure cannot run successfully if some of the RV64G extensions are missing.
|
||||
// The struct is padded to avoid false sharing.
|
||||
var RISCV64 struct {
|
||||
_ CacheLinePad
|
||||
HasFastMisaligned bool // Fast misaligned accesses
|
||||
HasC bool // Compressed instruction-set extension
|
||||
HasV bool // Vector extension compatible with RVV 1.0
|
||||
HasZba bool // Address generation instructions extension
|
||||
HasZbb bool // Basic bit-manipulation extension
|
||||
HasZbs bool // Single-bit instructions extension
|
||||
_ CacheLinePad
|
||||
}
|
||||
|
||||
func init() {
|
||||
archInit()
|
||||
initOptions()
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
// 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
|
||||
//go:build linux && !arm && !arm64 && !mips64 && !mips64le && !ppc64 && !ppc64le && !s390x && !riscv64
|
||||
|
||||
package cpu
|
||||
|
||||
|
|
|
@ -0,0 +1,137 @@
|
|||
// Copyright 2024 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"
|
||||
)
|
||||
|
||||
// RISC-V extension discovery code for Linux. The approach here is to first try the riscv_hwprobe
|
||||
// syscall falling back to HWCAP to check for the C extension if riscv_hwprobe is not available.
|
||||
//
|
||||
// A note on detection of the Vector extension using HWCAP.
|
||||
//
|
||||
// Support for the Vector extension version 1.0 was added to the Linux kernel in release 6.5.
|
||||
// Support for the riscv_hwprobe syscall was added in 6.4. It follows that if the riscv_hwprobe
|
||||
// syscall is not available then neither is the Vector extension (which needs kernel support).
|
||||
// The riscv_hwprobe syscall should then be all we need to detect the Vector extension.
|
||||
// However, some RISC-V board manufacturers ship boards with an older kernel on top of which
|
||||
// they have back-ported various versions of the Vector extension patches but not the riscv_hwprobe
|
||||
// patches. These kernels advertise support for the Vector extension using HWCAP. Falling
|
||||
// back to HWCAP to detect the Vector extension, if riscv_hwprobe is not available, or simply not
|
||||
// bothering with riscv_hwprobe at all and just using HWCAP may then seem like an attractive option.
|
||||
//
|
||||
// Unfortunately, simply checking the 'V' bit in AT_HWCAP will not work as this bit is used by
|
||||
// RISC-V board and cloud instance providers to mean different things. The Lichee Pi 4A board
|
||||
// and the Scaleway RV1 cloud instances use the 'V' bit to advertise their support for the unratified
|
||||
// 0.7.1 version of the Vector Specification. The Banana Pi BPI-F3 and the CanMV-K230 board use
|
||||
// it to advertise support for 1.0 of the Vector extension. Versions 0.7.1 and 1.0 of the Vector
|
||||
// extension are binary incompatible. HWCAP can then not be used in isolation to populate the
|
||||
// HasV field as this field indicates that the underlying CPU is compatible with RVV 1.0.
|
||||
//
|
||||
// There is a way at runtime to distinguish between versions 0.7.1 and 1.0 of the Vector
|
||||
// specification by issuing a RVV 1.0 vsetvli instruction and checking the vill bit of the vtype
|
||||
// register. This check would allow us to safely detect version 1.0 of the Vector extension
|
||||
// with HWCAP, if riscv_hwprobe were not available. However, the check cannot
|
||||
// be added until the assembler supports the Vector instructions.
|
||||
//
|
||||
// Note the riscv_hwprobe syscall does not suffer from these ambiguities by design as all of the
|
||||
// extensions it advertises support for are explicitly versioned. It's also worth noting that
|
||||
// the riscv_hwprobe syscall is the only way to detect multi-letter RISC-V extensions, e.g., Zba.
|
||||
// These cannot be detected using HWCAP and so riscv_hwprobe must be used to detect the majority
|
||||
// of RISC-V extensions.
|
||||
//
|
||||
// Please see https://docs.kernel.org/arch/riscv/hwprobe.html for more information.
|
||||
|
||||
// golang.org/x/sys/cpu is not allowed to depend on golang.org/x/sys/unix so we must
|
||||
// reproduce the constants, types and functions needed to make the riscv_hwprobe syscall
|
||||
// here.
|
||||
|
||||
const (
|
||||
// Copied from golang.org/x/sys/unix/ztypes_linux_riscv64.go.
|
||||
riscv_HWPROBE_KEY_IMA_EXT_0 = 0x4
|
||||
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_FAST = 0x3
|
||||
riscv_HWPROBE_MISALIGNED_MASK = 0x7
|
||||
)
|
||||
|
||||
const (
|
||||
// sys_RISCV_HWPROBE is copied from golang.org/x/sys/unix/zsysnum_linux_riscv64.go.
|
||||
sys_RISCV_HWPROBE = 258
|
||||
)
|
||||
|
||||
// riscvHWProbePairs is copied from golang.org/x/sys/unix/ztypes_linux_riscv64.go.
|
||||
type riscvHWProbePairs struct {
|
||||
key int64
|
||||
value uint64
|
||||
}
|
||||
|
||||
const (
|
||||
// CPU features
|
||||
hwcap_RISCV_ISA_C = 1 << ('C' - 'A')
|
||||
)
|
||||
|
||||
func doinit() {
|
||||
// A slice of key/value pair structures is passed to the RISCVHWProbe syscall. The key
|
||||
// field should be initialised with one of the key constants defined above, e.g.,
|
||||
// RISCV_HWPROBE_KEY_IMA_EXT_0. The syscall will set the value field to the appropriate value.
|
||||
// If the kernel does not recognise a key it will set the key field to -1 and the value field to 0.
|
||||
|
||||
pairs := []riscvHWProbePairs{
|
||||
{riscv_HWPROBE_KEY_IMA_EXT_0, 0},
|
||||
{riscv_HWPROBE_KEY_CPUPERF_0, 0},
|
||||
}
|
||||
|
||||
// This call only indicates that extensions are supported if they are implemented on all cores.
|
||||
if riscvHWProbe(pairs, 0) {
|
||||
if pairs[0].key != -1 {
|
||||
v := uint(pairs[0].value)
|
||||
RISCV64.HasC = isSet(v, riscv_HWPROBE_IMA_C)
|
||||
RISCV64.HasV = isSet(v, riscv_HWPROBE_IMA_V)
|
||||
RISCV64.HasZba = isSet(v, riscv_HWPROBE_EXT_ZBA)
|
||||
RISCV64.HasZbb = isSet(v, riscv_HWPROBE_EXT_ZBB)
|
||||
RISCV64.HasZbs = isSet(v, riscv_HWPROBE_EXT_ZBS)
|
||||
}
|
||||
if pairs[1].key != -1 {
|
||||
v := pairs[1].value & riscv_HWPROBE_MISALIGNED_MASK
|
||||
RISCV64.HasFastMisaligned = v == riscv_HWPROBE_MISALIGNED_FAST
|
||||
}
|
||||
}
|
||||
|
||||
// Let's double check with HWCAP if the C extension does not appear to be supported.
|
||||
// This may happen if we're running on a kernel older than 6.4.
|
||||
|
||||
if !RISCV64.HasC {
|
||||
RISCV64.HasC = isSet(hwCap, hwcap_RISCV_ISA_C)
|
||||
}
|
||||
}
|
||||
|
||||
func isSet(hwc uint, value uint) bool {
|
||||
return hwc&value != 0
|
||||
}
|
||||
|
||||
// riscvHWProbe is a simplified version of the generated wrapper function found in
|
||||
// golang.org/x/sys/unix/zsyscall_linux_riscv64.go. We simplify it by removing the
|
||||
// cpuCount and cpus parameters which we do not need. We always want to pass 0 for
|
||||
// these parameters here so the kernel only reports the extensions that are present
|
||||
// on all cores.
|
||||
func riscvHWProbe(pairs []riscvHWProbePairs, flags uint) bool {
|
||||
var _zero uintptr
|
||||
var p0 unsafe.Pointer
|
||||
if len(pairs) > 0 {
|
||||
p0 = unsafe.Pointer(&pairs[0])
|
||||
} else {
|
||||
p0 = unsafe.Pointer(&_zero)
|
||||
}
|
||||
|
||||
_, _, e1 := syscall.Syscall6(sys_RISCV_HWPROBE, uintptr(p0), uintptr(len(pairs)), uintptr(0), uintptr(0), uintptr(flags), 0)
|
||||
return e1 == 0
|
||||
}
|
|
@ -8,4 +8,13 @@ package cpu
|
|||
|
||||
const cacheLineSize = 64
|
||||
|
||||
func initOptions() {}
|
||||
func initOptions() {
|
||||
options = []option{
|
||||
{Name: "fastmisaligned", Feature: &RISCV64.HasFastMisaligned},
|
||||
{Name: "c", Feature: &RISCV64.HasC},
|
||||
{Name: "v", Feature: &RISCV64.HasV},
|
||||
{Name: "zba", Feature: &RISCV64.HasZba},
|
||||
{Name: "zbb", Feature: &RISCV64.HasZbb},
|
||||
{Name: "zbs", Feature: &RISCV64.HasZbs},
|
||||
}
|
||||
}
|
||||
|
|
|
@ -156,7 +156,7 @@ from the generated architecture-specific files listed below, and merge these
|
|||
into a common file for each OS.
|
||||
|
||||
The merge is performed in the following steps:
|
||||
1. Construct the set of common code that is idential in all architecture-specific files.
|
||||
1. Construct the set of common code that is identical in all architecture-specific files.
|
||||
2. Write this common code to the merged file.
|
||||
3. Remove the common code from all architecture-specific files.
|
||||
|
||||
|
|
|
@ -552,6 +552,7 @@ ccflags="$@"
|
|||
$2 !~ /^RTC_VL_(ACCURACY|BACKUP|DATA)/ &&
|
||||
$2 ~ /^(NETLINK|NLM|NLMSG|NLA|IFA|IFAN|RT|RTC|RTCF|RTN|RTPROT|RTNH|ARPHRD|ETH_P|NETNSA)_/ ||
|
||||
$2 ~ /^SOCK_|SK_DIAG_|SKNLGRP_$/ ||
|
||||
$2 ~ /^(CONNECT|SAE)_/ ||
|
||||
$2 ~ /^FIORDCHK$/ ||
|
||||
$2 ~ /^SIOC/ ||
|
||||
$2 ~ /^TIOC/ ||
|
||||
|
@ -655,7 +656,7 @@ errors=$(
|
|||
signals=$(
|
||||
echo '#include <signal.h>' | $CC -x c - -E -dM $ccflags |
|
||||
awk '$1=="#define" && $2 ~ /^SIG[A-Z0-9]+$/ { print $2 }' |
|
||||
grep -v 'SIGSTKSIZE\|SIGSTKSZ\|SIGRT\|SIGMAX64' |
|
||||
grep -E -v '(SIGSTKSIZE|SIGSTKSZ|SIGRT|SIGMAX64)' |
|
||||
sort
|
||||
)
|
||||
|
||||
|
@ -665,7 +666,7 @@ echo '#include <errno.h>' | $CC -x c - -E -dM $ccflags |
|
|||
sort >_error.grep
|
||||
echo '#include <signal.h>' | $CC -x c - -E -dM $ccflags |
|
||||
awk '$1=="#define" && $2 ~ /^SIG[A-Z0-9]+$/ { print "^\t" $2 "[ \t]*=" }' |
|
||||
grep -v 'SIGSTKSIZE\|SIGSTKSZ\|SIGRT\|SIGMAX64' |
|
||||
grep -E -v '(SIGSTKSIZE|SIGSTKSZ|SIGRT|SIGMAX64)' |
|
||||
sort >_signal.grep
|
||||
|
||||
echo '// mkerrors.sh' "$@"
|
||||
|
|
|
@ -360,7 +360,7 @@ func Wait4(pid int, wstatus *WaitStatus, options int, rusage *Rusage) (wpid int,
|
|||
var status _C_int
|
||||
var r Pid_t
|
||||
err = ERESTART
|
||||
// AIX wait4 may return with ERESTART errno, while the processus is still
|
||||
// AIX wait4 may return with ERESTART errno, while the process is still
|
||||
// active.
|
||||
for err == ERESTART {
|
||||
r, err = wait4(Pid_t(pid), &status, options, rusage)
|
||||
|
|
|
@ -566,6 +566,43 @@ func PthreadFchdir(fd int) (err error) {
|
|||
return pthread_fchdir_np(fd)
|
||||
}
|
||||
|
||||
// Connectx calls connectx(2) to initiate a connection on a socket.
|
||||
//
|
||||
// srcIf, srcAddr, and dstAddr are filled into a [SaEndpoints] struct and passed as the endpoints argument.
|
||||
//
|
||||
// - srcIf is the optional source interface index. 0 means unspecified.
|
||||
// - srcAddr is the optional source address. nil means unspecified.
|
||||
// - dstAddr is the destination address.
|
||||
//
|
||||
// On success, Connectx returns the number of bytes enqueued for transmission.
|
||||
func Connectx(fd int, srcIf uint32, srcAddr, dstAddr Sockaddr, associd SaeAssocID, flags uint32, iov []Iovec, connid *SaeConnID) (n uintptr, err error) {
|
||||
endpoints := SaEndpoints{
|
||||
Srcif: srcIf,
|
||||
}
|
||||
|
||||
if srcAddr != nil {
|
||||
addrp, addrlen, err := srcAddr.sockaddr()
|
||||
if err != nil {
|
||||
return 0, err
|
||||
}
|
||||
endpoints.Srcaddr = (*RawSockaddr)(addrp)
|
||||
endpoints.Srcaddrlen = uint32(addrlen)
|
||||
}
|
||||
|
||||
if dstAddr != nil {
|
||||
addrp, addrlen, err := dstAddr.sockaddr()
|
||||
if err != nil {
|
||||
return 0, err
|
||||
}
|
||||
endpoints.Dstaddr = (*RawSockaddr)(addrp)
|
||||
endpoints.Dstaddrlen = uint32(addrlen)
|
||||
}
|
||||
|
||||
err = connectx(fd, &endpoints, associd, flags, iov, &n, connid)
|
||||
return
|
||||
}
|
||||
|
||||
//sys connectx(fd int, endpoints *SaEndpoints, associd SaeAssocID, flags uint32, iov []Iovec, n *uintptr, connid *SaeConnID) (err error)
|
||||
//sys sendfile(infd int, outfd int, offset int64, len *int64, hdtr unsafe.Pointer, flags int) (err error)
|
||||
|
||||
//sys shmat(id int, addr uintptr, flag int) (ret uintptr, err error)
|
||||
|
|
|
@ -11,6 +11,7 @@ package unix
|
|||
int ioctl(int, unsigned long int, uintptr_t);
|
||||
*/
|
||||
import "C"
|
||||
import "unsafe"
|
||||
|
||||
func ioctl(fd int, req uint, arg uintptr) (err error) {
|
||||
r0, er := C.ioctl(C.int(fd), C.ulong(req), C.uintptr_t(arg))
|
||||
|
|
|
@ -1295,6 +1295,48 @@ func GetsockoptTCPInfo(fd, level, opt int) (*TCPInfo, error) {
|
|||
return &value, err
|
||||
}
|
||||
|
||||
// GetsockoptTCPCCVegasInfo returns algorithm specific congestion control information for a socket using the "vegas"
|
||||
// algorithm.
|
||||
//
|
||||
// The socket's congestion control algorighm can be retrieved via [GetsockoptString] with the [TCP_CONGESTION] option:
|
||||
//
|
||||
// algo, err := unix.GetsockoptString(fd, unix.IPPROTO_TCP, unix.TCP_CONGESTION)
|
||||
func GetsockoptTCPCCVegasInfo(fd, level, opt int) (*TCPVegasInfo, error) {
|
||||
var value [SizeofTCPCCInfo / 4]uint32 // ensure proper alignment
|
||||
vallen := _Socklen(SizeofTCPCCInfo)
|
||||
err := getsockopt(fd, level, opt, unsafe.Pointer(&value[0]), &vallen)
|
||||
out := (*TCPVegasInfo)(unsafe.Pointer(&value[0]))
|
||||
return out, err
|
||||
}
|
||||
|
||||
// GetsockoptTCPCCDCTCPInfo returns algorithm specific congestion control information for a socket using the "dctp"
|
||||
// algorithm.
|
||||
//
|
||||
// The socket's congestion control algorighm can be retrieved via [GetsockoptString] with the [TCP_CONGESTION] option:
|
||||
//
|
||||
// algo, err := unix.GetsockoptString(fd, unix.IPPROTO_TCP, unix.TCP_CONGESTION)
|
||||
func GetsockoptTCPCCDCTCPInfo(fd, level, opt int) (*TCPDCTCPInfo, error) {
|
||||
var value [SizeofTCPCCInfo / 4]uint32 // ensure proper alignment
|
||||
vallen := _Socklen(SizeofTCPCCInfo)
|
||||
err := getsockopt(fd, level, opt, unsafe.Pointer(&value[0]), &vallen)
|
||||
out := (*TCPDCTCPInfo)(unsafe.Pointer(&value[0]))
|
||||
return out, err
|
||||
}
|
||||
|
||||
// GetsockoptTCPCCBBRInfo returns algorithm specific congestion control information for a socket using the "bbr"
|
||||
// algorithm.
|
||||
//
|
||||
// The socket's congestion control algorighm can be retrieved via [GetsockoptString] with the [TCP_CONGESTION] option:
|
||||
//
|
||||
// algo, err := unix.GetsockoptString(fd, unix.IPPROTO_TCP, unix.TCP_CONGESTION)
|
||||
func GetsockoptTCPCCBBRInfo(fd, level, opt int) (*TCPBBRInfo, error) {
|
||||
var value [SizeofTCPCCInfo / 4]uint32 // ensure proper alignment
|
||||
vallen := _Socklen(SizeofTCPCCInfo)
|
||||
err := getsockopt(fd, level, opt, unsafe.Pointer(&value[0]), &vallen)
|
||||
out := (*TCPBBRInfo)(unsafe.Pointer(&value[0]))
|
||||
return out, err
|
||||
}
|
||||
|
||||
// GetsockoptString returns the string value of the socket option opt for the
|
||||
// socket associated with fd at the given socket level.
|
||||
func GetsockoptString(fd, level, opt int) (string, error) {
|
||||
|
@ -1959,7 +2001,26 @@ func Getpgrp() (pid int) {
|
|||
//sysnb Getpid() (pid int)
|
||||
//sysnb Getppid() (ppid int)
|
||||
//sys Getpriority(which int, who int) (prio int, err error)
|
||||
//sys Getrandom(buf []byte, flags int) (n int, err error)
|
||||
|
||||
func Getrandom(buf []byte, flags int) (n int, err error) {
|
||||
vdsoRet, supported := vgetrandom(buf, uint32(flags))
|
||||
if supported {
|
||||
if vdsoRet < 0 {
|
||||
return 0, errnoErr(syscall.Errno(-vdsoRet))
|
||||
}
|
||||
return vdsoRet, nil
|
||||
}
|
||||
var p *byte
|
||||
if len(buf) > 0 {
|
||||
p = &buf[0]
|
||||
}
|
||||
r, _, e := Syscall(SYS_GETRANDOM, uintptr(unsafe.Pointer(p)), uintptr(len(buf)), uintptr(flags))
|
||||
if e != 0 {
|
||||
return 0, errnoErr(e)
|
||||
}
|
||||
return int(r), nil
|
||||
}
|
||||
|
||||
//sysnb Getrusage(who int, rusage *Rusage) (err error)
|
||||
//sysnb Getsid(pid int) (sid int, err error)
|
||||
//sysnb Gettid() (tid int)
|
||||
|
|
|
@ -182,3 +182,5 @@ func KexecFileLoad(kernelFd int, initrdFd int, cmdline string, flags int) error
|
|||
}
|
||||
return kexecFileLoad(kernelFd, initrdFd, cmdlineLen, cmdline, flags)
|
||||
}
|
||||
|
||||
const SYS_FSTATAT = SYS_NEWFSTATAT
|
||||
|
|
|
@ -214,3 +214,5 @@ func KexecFileLoad(kernelFd int, initrdFd int, cmdline string, flags int) error
|
|||
}
|
||||
return kexecFileLoad(kernelFd, initrdFd, cmdlineLen, cmdline, flags)
|
||||
}
|
||||
|
||||
const SYS_FSTATAT = SYS_NEWFSTATAT
|
||||
|
|
|
@ -187,3 +187,5 @@ func RISCVHWProbe(pairs []RISCVHWProbePairs, set *CPUSet, flags uint) (err error
|
|||
}
|
||||
return riscvHWProbe(pairs, setSize, set, flags)
|
||||
}
|
||||
|
||||
const SYS_FSTATAT = SYS_NEWFSTATAT
|
||||
|
|
|
@ -0,0 +1,13 @@
|
|||
// Copyright 2024 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 && go1.24
|
||||
|
||||
package unix
|
||||
|
||||
import _ "unsafe"
|
||||
|
||||
//go:linkname vgetrandom runtime.vgetrandom
|
||||
//go:noescape
|
||||
func vgetrandom(p []byte, flags uint32) (ret int, supported bool)
|
|
@ -0,0 +1,11 @@
|
|||
// Copyright 2024 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 || !go1.24
|
||||
|
||||
package unix
|
||||
|
||||
func vgetrandom(p []byte, flags uint32) (ret int, supported bool) {
|
||||
return -1, false
|
||||
}
|
|
@ -237,6 +237,9 @@ const (
|
|||
CLOCK_UPTIME_RAW_APPROX = 0x9
|
||||
CLONE_NOFOLLOW = 0x1
|
||||
CLONE_NOOWNERCOPY = 0x2
|
||||
CONNECT_DATA_AUTHENTICATED = 0x4
|
||||
CONNECT_DATA_IDEMPOTENT = 0x2
|
||||
CONNECT_RESUME_ON_READ_WRITE = 0x1
|
||||
CR0 = 0x0
|
||||
CR1 = 0x1000
|
||||
CR2 = 0x2000
|
||||
|
@ -1265,6 +1268,10 @@ const (
|
|||
RTV_SSTHRESH = 0x20
|
||||
RUSAGE_CHILDREN = -0x1
|
||||
RUSAGE_SELF = 0x0
|
||||
SAE_ASSOCID_ALL = 0xffffffff
|
||||
SAE_ASSOCID_ANY = 0x0
|
||||
SAE_CONNID_ALL = 0xffffffff
|
||||
SAE_CONNID_ANY = 0x0
|
||||
SCM_CREDS = 0x3
|
||||
SCM_RIGHTS = 0x1
|
||||
SCM_TIMESTAMP = 0x2
|
||||
|
|
|
@ -237,6 +237,9 @@ const (
|
|||
CLOCK_UPTIME_RAW_APPROX = 0x9
|
||||
CLONE_NOFOLLOW = 0x1
|
||||
CLONE_NOOWNERCOPY = 0x2
|
||||
CONNECT_DATA_AUTHENTICATED = 0x4
|
||||
CONNECT_DATA_IDEMPOTENT = 0x2
|
||||
CONNECT_RESUME_ON_READ_WRITE = 0x1
|
||||
CR0 = 0x0
|
||||
CR1 = 0x1000
|
||||
CR2 = 0x2000
|
||||
|
@ -1265,6 +1268,10 @@ const (
|
|||
RTV_SSTHRESH = 0x20
|
||||
RUSAGE_CHILDREN = -0x1
|
||||
RUSAGE_SELF = 0x0
|
||||
SAE_ASSOCID_ALL = 0xffffffff
|
||||
SAE_ASSOCID_ANY = 0x0
|
||||
SAE_CONNID_ALL = 0xffffffff
|
||||
SAE_CONNID_ANY = 0x0
|
||||
SCM_CREDS = 0x3
|
||||
SCM_RIGHTS = 0x1
|
||||
SCM_TIMESTAMP = 0x2
|
||||
|
|
|
@ -495,6 +495,7 @@ const (
|
|||
BPF_F_TEST_REG_INVARIANTS = 0x80
|
||||
BPF_F_TEST_RND_HI32 = 0x4
|
||||
BPF_F_TEST_RUN_ON_CPU = 0x1
|
||||
BPF_F_TEST_SKB_CHECKSUM_COMPLETE = 0x4
|
||||
BPF_F_TEST_STATE_FREQ = 0x8
|
||||
BPF_F_TEST_XDP_LIVE_FRAMES = 0x2
|
||||
BPF_F_XDP_DEV_BOUND_ONLY = 0x40
|
||||
|
@ -1922,6 +1923,7 @@ const (
|
|||
MNT_EXPIRE = 0x4
|
||||
MNT_FORCE = 0x1
|
||||
MNT_ID_REQ_SIZE_VER0 = 0x18
|
||||
MNT_ID_REQ_SIZE_VER1 = 0x20
|
||||
MODULE_INIT_COMPRESSED_FILE = 0x4
|
||||
MODULE_INIT_IGNORE_MODVERSIONS = 0x1
|
||||
MODULE_INIT_IGNORE_VERMAGIC = 0x2
|
||||
|
@ -2187,7 +2189,7 @@ const (
|
|||
NFT_REG_SIZE = 0x10
|
||||
NFT_REJECT_ICMPX_MAX = 0x3
|
||||
NFT_RT_MAX = 0x4
|
||||
NFT_SECMARK_CTX_MAXLEN = 0x100
|
||||
NFT_SECMARK_CTX_MAXLEN = 0x1000
|
||||
NFT_SET_MAXNAMELEN = 0x100
|
||||
NFT_SOCKET_MAX = 0x3
|
||||
NFT_TABLE_F_MASK = 0x7
|
||||
|
@ -2356,9 +2358,11 @@ const (
|
|||
PERF_MEM_LVLNUM_IO = 0xa
|
||||
PERF_MEM_LVLNUM_L1 = 0x1
|
||||
PERF_MEM_LVLNUM_L2 = 0x2
|
||||
PERF_MEM_LVLNUM_L2_MHB = 0x5
|
||||
PERF_MEM_LVLNUM_L3 = 0x3
|
||||
PERF_MEM_LVLNUM_L4 = 0x4
|
||||
PERF_MEM_LVLNUM_LFB = 0xc
|
||||
PERF_MEM_LVLNUM_MSC = 0x6
|
||||
PERF_MEM_LVLNUM_NA = 0xf
|
||||
PERF_MEM_LVLNUM_PMEM = 0xe
|
||||
PERF_MEM_LVLNUM_RAM = 0xd
|
||||
|
@ -2431,6 +2435,7 @@ const (
|
|||
PRIO_PGRP = 0x1
|
||||
PRIO_PROCESS = 0x0
|
||||
PRIO_USER = 0x2
|
||||
PROCFS_IOCTL_MAGIC = 'f'
|
||||
PROC_SUPER_MAGIC = 0x9fa0
|
||||
PROT_EXEC = 0x4
|
||||
PROT_GROWSDOWN = 0x1000000
|
||||
|
@ -2933,11 +2938,12 @@ const (
|
|||
RUSAGE_SELF = 0x0
|
||||
RUSAGE_THREAD = 0x1
|
||||
RWF_APPEND = 0x10
|
||||
RWF_ATOMIC = 0x40
|
||||
RWF_DSYNC = 0x2
|
||||
RWF_HIPRI = 0x1
|
||||
RWF_NOAPPEND = 0x20
|
||||
RWF_NOWAIT = 0x8
|
||||
RWF_SUPPORTED = 0x3f
|
||||
RWF_SUPPORTED = 0x7f
|
||||
RWF_SYNC = 0x4
|
||||
RWF_WRITE_LIFE_NOT_SET = 0x0
|
||||
SCHED_BATCH = 0x3
|
||||
|
@ -3210,6 +3216,7 @@ const (
|
|||
STATX_ATTR_MOUNT_ROOT = 0x2000
|
||||
STATX_ATTR_NODUMP = 0x40
|
||||
STATX_ATTR_VERITY = 0x100000
|
||||
STATX_ATTR_WRITE_ATOMIC = 0x400000
|
||||
STATX_BASIC_STATS = 0x7ff
|
||||
STATX_BLOCKS = 0x400
|
||||
STATX_BTIME = 0x800
|
||||
|
@ -3226,6 +3233,7 @@ const (
|
|||
STATX_SUBVOL = 0x8000
|
||||
STATX_TYPE = 0x1
|
||||
STATX_UID = 0x8
|
||||
STATX_WRITE_ATOMIC = 0x10000
|
||||
STATX__RESERVED = 0x80000000
|
||||
SYNC_FILE_RANGE_WAIT_AFTER = 0x4
|
||||
SYNC_FILE_RANGE_WAIT_BEFORE = 0x1
|
||||
|
@ -3624,6 +3632,7 @@ const (
|
|||
XDP_UMEM_PGOFF_COMPLETION_RING = 0x180000000
|
||||
XDP_UMEM_PGOFF_FILL_RING = 0x100000000
|
||||
XDP_UMEM_REG = 0x4
|
||||
XDP_UMEM_TX_METADATA_LEN = 0x4
|
||||
XDP_UMEM_TX_SW_CSUM = 0x2
|
||||
XDP_UMEM_UNALIGNED_CHUNK_FLAG = 0x1
|
||||
XDP_USE_NEED_WAKEUP = 0x8
|
||||
|
|
|
@ -153,9 +153,14 @@ const (
|
|||
NFDBITS = 0x20
|
||||
NLDLY = 0x100
|
||||
NOFLSH = 0x80
|
||||
NS_GET_MNTNS_ID = 0x8008b705
|
||||
NS_GET_NSTYPE = 0xb703
|
||||
NS_GET_OWNER_UID = 0xb704
|
||||
NS_GET_PARENT = 0xb702
|
||||
NS_GET_PID_FROM_PIDNS = 0x8004b706
|
||||
NS_GET_PID_IN_PIDNS = 0x8004b708
|
||||
NS_GET_TGID_FROM_PIDNS = 0x8004b707
|
||||
NS_GET_TGID_IN_PIDNS = 0x8004b709
|
||||
NS_GET_USERNS = 0xb701
|
||||
OLCUC = 0x2
|
||||
ONLCR = 0x4
|
||||
|
|
|
@ -153,9 +153,14 @@ const (
|
|||
NFDBITS = 0x40
|
||||
NLDLY = 0x100
|
||||
NOFLSH = 0x80
|
||||
NS_GET_MNTNS_ID = 0x8008b705
|
||||
NS_GET_NSTYPE = 0xb703
|
||||
NS_GET_OWNER_UID = 0xb704
|
||||
NS_GET_PARENT = 0xb702
|
||||
NS_GET_PID_FROM_PIDNS = 0x8004b706
|
||||
NS_GET_PID_IN_PIDNS = 0x8004b708
|
||||
NS_GET_TGID_FROM_PIDNS = 0x8004b707
|
||||
NS_GET_TGID_IN_PIDNS = 0x8004b709
|
||||
NS_GET_USERNS = 0xb701
|
||||
OLCUC = 0x2
|
||||
ONLCR = 0x4
|
||||
|
|
|
@ -150,9 +150,14 @@ const (
|
|||
NFDBITS = 0x20
|
||||
NLDLY = 0x100
|
||||
NOFLSH = 0x80
|
||||
NS_GET_MNTNS_ID = 0x8008b705
|
||||
NS_GET_NSTYPE = 0xb703
|
||||
NS_GET_OWNER_UID = 0xb704
|
||||
NS_GET_PARENT = 0xb702
|
||||
NS_GET_PID_FROM_PIDNS = 0x8004b706
|
||||
NS_GET_PID_IN_PIDNS = 0x8004b708
|
||||
NS_GET_TGID_FROM_PIDNS = 0x8004b707
|
||||
NS_GET_TGID_IN_PIDNS = 0x8004b709
|
||||
NS_GET_USERNS = 0xb701
|
||||
OLCUC = 0x2
|
||||
ONLCR = 0x4
|
||||
|
|
|
@ -154,9 +154,14 @@ const (
|
|||
NFDBITS = 0x40
|
||||
NLDLY = 0x100
|
||||
NOFLSH = 0x80
|
||||
NS_GET_MNTNS_ID = 0x8008b705
|
||||
NS_GET_NSTYPE = 0xb703
|
||||
NS_GET_OWNER_UID = 0xb704
|
||||
NS_GET_PARENT = 0xb702
|
||||
NS_GET_PID_FROM_PIDNS = 0x8004b706
|
||||
NS_GET_PID_IN_PIDNS = 0x8004b708
|
||||
NS_GET_TGID_FROM_PIDNS = 0x8004b707
|
||||
NS_GET_TGID_IN_PIDNS = 0x8004b709
|
||||
NS_GET_USERNS = 0xb701
|
||||
OLCUC = 0x2
|
||||
ONLCR = 0x4
|
||||
|
|
|
@ -154,9 +154,14 @@ const (
|
|||
NFDBITS = 0x40
|
||||
NLDLY = 0x100
|
||||
NOFLSH = 0x80
|
||||
NS_GET_MNTNS_ID = 0x8008b705
|
||||
NS_GET_NSTYPE = 0xb703
|
||||
NS_GET_OWNER_UID = 0xb704
|
||||
NS_GET_PARENT = 0xb702
|
||||
NS_GET_PID_FROM_PIDNS = 0x8004b706
|
||||
NS_GET_PID_IN_PIDNS = 0x8004b708
|
||||
NS_GET_TGID_FROM_PIDNS = 0x8004b707
|
||||
NS_GET_TGID_IN_PIDNS = 0x8004b709
|
||||
NS_GET_USERNS = 0xb701
|
||||
OLCUC = 0x2
|
||||
ONLCR = 0x4
|
||||
|
|
|
@ -150,9 +150,14 @@ const (
|
|||
NFDBITS = 0x20
|
||||
NLDLY = 0x100
|
||||
NOFLSH = 0x80
|
||||
NS_GET_MNTNS_ID = 0x4008b705
|
||||
NS_GET_NSTYPE = 0x2000b703
|
||||
NS_GET_OWNER_UID = 0x2000b704
|
||||
NS_GET_PARENT = 0x2000b702
|
||||
NS_GET_PID_FROM_PIDNS = 0x4004b706
|
||||
NS_GET_PID_IN_PIDNS = 0x4004b708
|
||||
NS_GET_TGID_FROM_PIDNS = 0x4004b707
|
||||
NS_GET_TGID_IN_PIDNS = 0x4004b709
|
||||
NS_GET_USERNS = 0x2000b701
|
||||
OLCUC = 0x2
|
||||
ONLCR = 0x4
|
||||
|
|
|
@ -150,9 +150,14 @@ const (
|
|||
NFDBITS = 0x40
|
||||
NLDLY = 0x100
|
||||
NOFLSH = 0x80
|
||||
NS_GET_MNTNS_ID = 0x4008b705
|
||||
NS_GET_NSTYPE = 0x2000b703
|
||||
NS_GET_OWNER_UID = 0x2000b704
|
||||
NS_GET_PARENT = 0x2000b702
|
||||
NS_GET_PID_FROM_PIDNS = 0x4004b706
|
||||
NS_GET_PID_IN_PIDNS = 0x4004b708
|
||||
NS_GET_TGID_FROM_PIDNS = 0x4004b707
|
||||
NS_GET_TGID_IN_PIDNS = 0x4004b709
|
||||
NS_GET_USERNS = 0x2000b701
|
||||
OLCUC = 0x2
|
||||
ONLCR = 0x4
|
||||
|
|
|
@ -150,9 +150,14 @@ const (
|
|||
NFDBITS = 0x40
|
||||
NLDLY = 0x100
|
||||
NOFLSH = 0x80
|
||||
NS_GET_MNTNS_ID = 0x4008b705
|
||||
NS_GET_NSTYPE = 0x2000b703
|
||||
NS_GET_OWNER_UID = 0x2000b704
|
||||
NS_GET_PARENT = 0x2000b702
|
||||
NS_GET_PID_FROM_PIDNS = 0x4004b706
|
||||
NS_GET_PID_IN_PIDNS = 0x4004b708
|
||||
NS_GET_TGID_FROM_PIDNS = 0x4004b707
|
||||
NS_GET_TGID_IN_PIDNS = 0x4004b709
|
||||
NS_GET_USERNS = 0x2000b701
|
||||
OLCUC = 0x2
|
||||
ONLCR = 0x4
|
||||
|
|
|
@ -150,9 +150,14 @@ const (
|
|||
NFDBITS = 0x20
|
||||
NLDLY = 0x100
|
||||
NOFLSH = 0x80
|
||||
NS_GET_MNTNS_ID = 0x4008b705
|
||||
NS_GET_NSTYPE = 0x2000b703
|
||||
NS_GET_OWNER_UID = 0x2000b704
|
||||
NS_GET_PARENT = 0x2000b702
|
||||
NS_GET_PID_FROM_PIDNS = 0x4004b706
|
||||
NS_GET_PID_IN_PIDNS = 0x4004b708
|
||||
NS_GET_TGID_FROM_PIDNS = 0x4004b707
|
||||
NS_GET_TGID_IN_PIDNS = 0x4004b709
|
||||
NS_GET_USERNS = 0x2000b701
|
||||
OLCUC = 0x2
|
||||
ONLCR = 0x4
|
||||
|
|
|
@ -152,9 +152,14 @@ const (
|
|||
NL3 = 0x300
|
||||
NLDLY = 0x300
|
||||
NOFLSH = 0x80000000
|
||||
NS_GET_MNTNS_ID = 0x4008b705
|
||||
NS_GET_NSTYPE = 0x2000b703
|
||||
NS_GET_OWNER_UID = 0x2000b704
|
||||
NS_GET_PARENT = 0x2000b702
|
||||
NS_GET_PID_FROM_PIDNS = 0x4004b706
|
||||
NS_GET_PID_IN_PIDNS = 0x4004b708
|
||||
NS_GET_TGID_FROM_PIDNS = 0x4004b707
|
||||
NS_GET_TGID_IN_PIDNS = 0x4004b709
|
||||
NS_GET_USERNS = 0x2000b701
|
||||
OLCUC = 0x4
|
||||
ONLCR = 0x2
|
||||
|
|
|
@ -152,9 +152,14 @@ const (
|
|||
NL3 = 0x300
|
||||
NLDLY = 0x300
|
||||
NOFLSH = 0x80000000
|
||||
NS_GET_MNTNS_ID = 0x4008b705
|
||||
NS_GET_NSTYPE = 0x2000b703
|
||||
NS_GET_OWNER_UID = 0x2000b704
|
||||
NS_GET_PARENT = 0x2000b702
|
||||
NS_GET_PID_FROM_PIDNS = 0x4004b706
|
||||
NS_GET_PID_IN_PIDNS = 0x4004b708
|
||||
NS_GET_TGID_FROM_PIDNS = 0x4004b707
|
||||
NS_GET_TGID_IN_PIDNS = 0x4004b709
|
||||
NS_GET_USERNS = 0x2000b701
|
||||
OLCUC = 0x4
|
||||
ONLCR = 0x2
|
||||
|
|
|
@ -152,9 +152,14 @@ const (
|
|||
NL3 = 0x300
|
||||
NLDLY = 0x300
|
||||
NOFLSH = 0x80000000
|
||||
NS_GET_MNTNS_ID = 0x4008b705
|
||||
NS_GET_NSTYPE = 0x2000b703
|
||||
NS_GET_OWNER_UID = 0x2000b704
|
||||
NS_GET_PARENT = 0x2000b702
|
||||
NS_GET_PID_FROM_PIDNS = 0x4004b706
|
||||
NS_GET_PID_IN_PIDNS = 0x4004b708
|
||||
NS_GET_TGID_FROM_PIDNS = 0x4004b707
|
||||
NS_GET_TGID_IN_PIDNS = 0x4004b709
|
||||
NS_GET_USERNS = 0x2000b701
|
||||
OLCUC = 0x4
|
||||
ONLCR = 0x2
|
||||
|
|
|
@ -150,9 +150,14 @@ const (
|
|||
NFDBITS = 0x40
|
||||
NLDLY = 0x100
|
||||
NOFLSH = 0x80
|
||||
NS_GET_MNTNS_ID = 0x8008b705
|
||||
NS_GET_NSTYPE = 0xb703
|
||||
NS_GET_OWNER_UID = 0xb704
|
||||
NS_GET_PARENT = 0xb702
|
||||
NS_GET_PID_FROM_PIDNS = 0x8004b706
|
||||
NS_GET_PID_IN_PIDNS = 0x8004b708
|
||||
NS_GET_TGID_FROM_PIDNS = 0x8004b707
|
||||
NS_GET_TGID_IN_PIDNS = 0x8004b709
|
||||
NS_GET_USERNS = 0xb701
|
||||
OLCUC = 0x2
|
||||
ONLCR = 0x4
|
||||
|
|
|
@ -150,9 +150,14 @@ const (
|
|||
NFDBITS = 0x40
|
||||
NLDLY = 0x100
|
||||
NOFLSH = 0x80
|
||||
NS_GET_MNTNS_ID = 0x8008b705
|
||||
NS_GET_NSTYPE = 0xb703
|
||||
NS_GET_OWNER_UID = 0xb704
|
||||
NS_GET_PARENT = 0xb702
|
||||
NS_GET_PID_FROM_PIDNS = 0x8004b706
|
||||
NS_GET_PID_IN_PIDNS = 0x8004b708
|
||||
NS_GET_TGID_FROM_PIDNS = 0x8004b707
|
||||
NS_GET_TGID_IN_PIDNS = 0x8004b709
|
||||
NS_GET_USERNS = 0xb701
|
||||
OLCUC = 0x2
|
||||
ONLCR = 0x4
|
||||
|
|
|
@ -155,9 +155,14 @@ const (
|
|||
NFDBITS = 0x40
|
||||
NLDLY = 0x100
|
||||
NOFLSH = 0x80
|
||||
NS_GET_MNTNS_ID = 0x4008b705
|
||||
NS_GET_NSTYPE = 0x2000b703
|
||||
NS_GET_OWNER_UID = 0x2000b704
|
||||
NS_GET_PARENT = 0x2000b702
|
||||
NS_GET_PID_FROM_PIDNS = 0x4004b706
|
||||
NS_GET_PID_IN_PIDNS = 0x4004b708
|
||||
NS_GET_TGID_FROM_PIDNS = 0x4004b707
|
||||
NS_GET_TGID_IN_PIDNS = 0x4004b709
|
||||
NS_GET_USERNS = 0x2000b701
|
||||
OLCUC = 0x2
|
||||
ONLCR = 0x4
|
||||
|
|
|
@ -581,6 +581,8 @@ const (
|
|||
AT_EMPTY_PATH = 0x1000
|
||||
AT_REMOVEDIR = 0x200
|
||||
RENAME_NOREPLACE = 1 << 0
|
||||
ST_RDONLY = 1
|
||||
ST_NOSUID = 2
|
||||
)
|
||||
|
||||
const (
|
||||
|
|
|
@ -841,6 +841,26 @@ var libc_pthread_fchdir_np_trampoline_addr uintptr
|
|||
|
||||
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
|
||||
|
||||
func connectx(fd int, endpoints *SaEndpoints, associd SaeAssocID, flags uint32, iov []Iovec, n *uintptr, connid *SaeConnID) (err error) {
|
||||
var _p0 unsafe.Pointer
|
||||
if len(iov) > 0 {
|
||||
_p0 = unsafe.Pointer(&iov[0])
|
||||
} else {
|
||||
_p0 = unsafe.Pointer(&_zero)
|
||||
}
|
||||
_, _, e1 := syscall_syscall9(libc_connectx_trampoline_addr, uintptr(fd), uintptr(unsafe.Pointer(endpoints)), uintptr(associd), uintptr(flags), uintptr(_p0), uintptr(len(iov)), uintptr(unsafe.Pointer(n)), uintptr(unsafe.Pointer(connid)), 0)
|
||||
if e1 != 0 {
|
||||
err = errnoErr(e1)
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
var libc_connectx_trampoline_addr uintptr
|
||||
|
||||
//go:cgo_import_dynamic libc_connectx connectx "/usr/lib/libSystem.B.dylib"
|
||||
|
||||
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
|
||||
|
||||
func sendfile(infd int, outfd int, offset int64, len *int64, hdtr unsafe.Pointer, flags int) (err error) {
|
||||
_, _, e1 := syscall_syscall6(libc_sendfile_trampoline_addr, uintptr(infd), uintptr(outfd), uintptr(offset), uintptr(unsafe.Pointer(len)), uintptr(hdtr), uintptr(flags))
|
||||
if e1 != 0 {
|
||||
|
|
|
@ -248,6 +248,11 @@ TEXT libc_pthread_fchdir_np_trampoline<>(SB),NOSPLIT,$0-0
|
|||
GLOBL ·libc_pthread_fchdir_np_trampoline_addr(SB), RODATA, $8
|
||||
DATA ·libc_pthread_fchdir_np_trampoline_addr(SB)/8, $libc_pthread_fchdir_np_trampoline<>(SB)
|
||||
|
||||
TEXT libc_connectx_trampoline<>(SB),NOSPLIT,$0-0
|
||||
JMP libc_connectx(SB)
|
||||
GLOBL ·libc_connectx_trampoline_addr(SB), RODATA, $8
|
||||
DATA ·libc_connectx_trampoline_addr(SB)/8, $libc_connectx_trampoline<>(SB)
|
||||
|
||||
TEXT libc_sendfile_trampoline<>(SB),NOSPLIT,$0-0
|
||||
JMP libc_sendfile(SB)
|
||||
GLOBL ·libc_sendfile_trampoline_addr(SB), RODATA, $8
|
||||
|
|
|
@ -841,6 +841,26 @@ var libc_pthread_fchdir_np_trampoline_addr uintptr
|
|||
|
||||
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
|
||||
|
||||
func connectx(fd int, endpoints *SaEndpoints, associd SaeAssocID, flags uint32, iov []Iovec, n *uintptr, connid *SaeConnID) (err error) {
|
||||
var _p0 unsafe.Pointer
|
||||
if len(iov) > 0 {
|
||||
_p0 = unsafe.Pointer(&iov[0])
|
||||
} else {
|
||||
_p0 = unsafe.Pointer(&_zero)
|
||||
}
|
||||
_, _, e1 := syscall_syscall9(libc_connectx_trampoline_addr, uintptr(fd), uintptr(unsafe.Pointer(endpoints)), uintptr(associd), uintptr(flags), uintptr(_p0), uintptr(len(iov)), uintptr(unsafe.Pointer(n)), uintptr(unsafe.Pointer(connid)), 0)
|
||||
if e1 != 0 {
|
||||
err = errnoErr(e1)
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
var libc_connectx_trampoline_addr uintptr
|
||||
|
||||
//go:cgo_import_dynamic libc_connectx connectx "/usr/lib/libSystem.B.dylib"
|
||||
|
||||
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
|
||||
|
||||
func sendfile(infd int, outfd int, offset int64, len *int64, hdtr unsafe.Pointer, flags int) (err error) {
|
||||
_, _, e1 := syscall_syscall6(libc_sendfile_trampoline_addr, uintptr(infd), uintptr(outfd), uintptr(offset), uintptr(unsafe.Pointer(len)), uintptr(hdtr), uintptr(flags))
|
||||
if e1 != 0 {
|
||||
|
|
|
@ -248,6 +248,11 @@ TEXT libc_pthread_fchdir_np_trampoline<>(SB),NOSPLIT,$0-0
|
|||
GLOBL ·libc_pthread_fchdir_np_trampoline_addr(SB), RODATA, $8
|
||||
DATA ·libc_pthread_fchdir_np_trampoline_addr(SB)/8, $libc_pthread_fchdir_np_trampoline<>(SB)
|
||||
|
||||
TEXT libc_connectx_trampoline<>(SB),NOSPLIT,$0-0
|
||||
JMP libc_connectx(SB)
|
||||
GLOBL ·libc_connectx_trampoline_addr(SB), RODATA, $8
|
||||
DATA ·libc_connectx_trampoline_addr(SB)/8, $libc_connectx_trampoline<>(SB)
|
||||
|
||||
TEXT libc_sendfile_trampoline<>(SB),NOSPLIT,$0-0
|
||||
JMP libc_sendfile(SB)
|
||||
GLOBL ·libc_sendfile_trampoline_addr(SB), RODATA, $8
|
||||
|
|
|
@ -971,23 +971,6 @@ func Getpriority(which int, who int) (prio int, err error) {
|
|||
|
||||
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
|
||||
|
||||
func Getrandom(buf []byte, flags int) (n int, err error) {
|
||||
var _p0 unsafe.Pointer
|
||||
if len(buf) > 0 {
|
||||
_p0 = unsafe.Pointer(&buf[0])
|
||||
} else {
|
||||
_p0 = unsafe.Pointer(&_zero)
|
||||
}
|
||||
r0, _, e1 := Syscall(SYS_GETRANDOM, uintptr(_p0), uintptr(len(buf)), uintptr(flags))
|
||||
n = int(r0)
|
||||
if e1 != 0 {
|
||||
err = errnoErr(e1)
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
|
||||
|
||||
func Getrusage(who int, rusage *Rusage) (err error) {
|
||||
_, _, e1 := RawSyscall(SYS_GETRUSAGE, uintptr(who), uintptr(unsafe.Pointer(rusage)), 0)
|
||||
if e1 != 0 {
|
||||
|
|
|
@ -341,6 +341,7 @@ const (
|
|||
SYS_STATX = 332
|
||||
SYS_IO_PGETEVENTS = 333
|
||||
SYS_RSEQ = 334
|
||||
SYS_URETPROBE = 335
|
||||
SYS_PIDFD_SEND_SIGNAL = 424
|
||||
SYS_IO_URING_SETUP = 425
|
||||
SYS_IO_URING_ENTER = 426
|
||||
|
|
|
@ -85,7 +85,7 @@ const (
|
|||
SYS_SPLICE = 76
|
||||
SYS_TEE = 77
|
||||
SYS_READLINKAT = 78
|
||||
SYS_FSTATAT = 79
|
||||
SYS_NEWFSTATAT = 79
|
||||
SYS_FSTAT = 80
|
||||
SYS_SYNC = 81
|
||||
SYS_FSYNC = 82
|
||||
|
|
|
@ -84,6 +84,8 @@ const (
|
|||
SYS_SPLICE = 76
|
||||
SYS_TEE = 77
|
||||
SYS_READLINKAT = 78
|
||||
SYS_NEWFSTATAT = 79
|
||||
SYS_FSTAT = 80
|
||||
SYS_SYNC = 81
|
||||
SYS_FSYNC = 82
|
||||
SYS_FDATASYNC = 83
|
||||
|
|
|
@ -84,7 +84,7 @@ const (
|
|||
SYS_SPLICE = 76
|
||||
SYS_TEE = 77
|
||||
SYS_READLINKAT = 78
|
||||
SYS_FSTATAT = 79
|
||||
SYS_NEWFSTATAT = 79
|
||||
SYS_FSTAT = 80
|
||||
SYS_SYNC = 81
|
||||
SYS_FSYNC = 82
|
||||
|
|
|
@ -306,6 +306,19 @@ type XVSockPgen struct {
|
|||
|
||||
type _Socklen uint32
|
||||
|
||||
type SaeAssocID uint32
|
||||
|
||||
type SaeConnID uint32
|
||||
|
||||
type SaEndpoints struct {
|
||||
Srcif uint32
|
||||
Srcaddr *RawSockaddr
|
||||
Srcaddrlen uint32
|
||||
Dstaddr *RawSockaddr
|
||||
Dstaddrlen uint32
|
||||
_ [4]byte
|
||||
}
|
||||
|
||||
type Xucred struct {
|
||||
Version uint32
|
||||
Uid uint32
|
||||
|
|
|
@ -306,6 +306,19 @@ type XVSockPgen struct {
|
|||
|
||||
type _Socklen uint32
|
||||
|
||||
type SaeAssocID uint32
|
||||
|
||||
type SaeConnID uint32
|
||||
|
||||
type SaEndpoints struct {
|
||||
Srcif uint32
|
||||
Srcaddr *RawSockaddr
|
||||
Srcaddrlen uint32
|
||||
Dstaddr *RawSockaddr
|
||||
Dstaddrlen uint32
|
||||
_ [4]byte
|
||||
}
|
||||
|
||||
type Xucred struct {
|
||||
Version uint32
|
||||
Uid uint32
|
||||
|
|
|
@ -625,6 +625,7 @@ const (
|
|||
POLLRDNORM = 0x40
|
||||
POLLWRBAND = 0x100
|
||||
POLLWRNORM = 0x4
|
||||
POLLRDHUP = 0x4000
|
||||
)
|
||||
|
||||
type CapRights struct {
|
||||
|
|
|
@ -630,6 +630,7 @@ const (
|
|||
POLLRDNORM = 0x40
|
||||
POLLWRBAND = 0x100
|
||||
POLLWRNORM = 0x4
|
||||
POLLRDHUP = 0x4000
|
||||
)
|
||||
|
||||
type CapRights struct {
|
||||
|
|
|
@ -616,6 +616,7 @@ const (
|
|||
POLLRDNORM = 0x40
|
||||
POLLWRBAND = 0x100
|
||||
POLLWRNORM = 0x4
|
||||
POLLRDHUP = 0x4000
|
||||
)
|
||||
|
||||
type CapRights struct {
|
||||
|
|
|
@ -610,6 +610,7 @@ const (
|
|||
POLLRDNORM = 0x40
|
||||
POLLWRBAND = 0x100
|
||||
POLLWRNORM = 0x4
|
||||
POLLRDHUP = 0x4000
|
||||
)
|
||||
|
||||
type CapRights struct {
|
||||
|
|
|
@ -612,6 +612,7 @@ const (
|
|||
POLLRDNORM = 0x40
|
||||
POLLWRBAND = 0x100
|
||||
POLLWRNORM = 0x4
|
||||
POLLRDHUP = 0x4000
|
||||
)
|
||||
|
||||
type CapRights struct {
|
||||
|
|
|
@ -111,7 +111,11 @@ type Statx_t struct {
|
|||
Dio_mem_align uint32
|
||||
Dio_offset_align uint32
|
||||
Subvol uint64
|
||||
_ [11]uint64
|
||||
Atomic_write_unit_min uint32
|
||||
Atomic_write_unit_max uint32
|
||||
Atomic_write_segments_max uint32
|
||||
_ [1]uint32
|
||||
_ [9]uint64
|
||||
}
|
||||
|
||||
type Fsid struct {
|
||||
|
@ -516,6 +520,29 @@ type TCPInfo struct {
|
|||
Total_rto_time uint32
|
||||
}
|
||||
|
||||
type TCPVegasInfo struct {
|
||||
Enabled uint32
|
||||
Rttcnt uint32
|
||||
Rtt uint32
|
||||
Minrtt uint32
|
||||
}
|
||||
|
||||
type TCPDCTCPInfo struct {
|
||||
Enabled uint16
|
||||
Ce_state uint16
|
||||
Alpha uint32
|
||||
Ab_ecn uint32
|
||||
Ab_tot uint32
|
||||
}
|
||||
|
||||
type TCPBBRInfo struct {
|
||||
Bw_lo uint32
|
||||
Bw_hi uint32
|
||||
Min_rtt uint32
|
||||
Pacing_gain uint32
|
||||
Cwnd_gain uint32
|
||||
}
|
||||
|
||||
type CanFilter struct {
|
||||
Id uint32
|
||||
Mask uint32
|
||||
|
@ -557,6 +584,7 @@ const (
|
|||
SizeofICMPv6Filter = 0x20
|
||||
SizeofUcred = 0xc
|
||||
SizeofTCPInfo = 0xf8
|
||||
SizeofTCPCCInfo = 0x14
|
||||
SizeofCanFilter = 0x8
|
||||
SizeofTCPRepairOpt = 0x8
|
||||
)
|
||||
|
@ -2486,7 +2514,7 @@ type XDPMmapOffsets struct {
|
|||
type XDPUmemReg struct {
|
||||
Addr uint64
|
||||
Len uint64
|
||||
Chunk_size uint32
|
||||
Size uint32
|
||||
Headroom uint32
|
||||
Flags uint32
|
||||
Tx_metadata_len uint32
|
||||
|
@ -3766,7 +3794,7 @@ const (
|
|||
ETHTOOL_MSG_PSE_GET = 0x24
|
||||
ETHTOOL_MSG_PSE_SET = 0x25
|
||||
ETHTOOL_MSG_RSS_GET = 0x26
|
||||
ETHTOOL_MSG_USER_MAX = 0x2b
|
||||
ETHTOOL_MSG_USER_MAX = 0x2c
|
||||
ETHTOOL_MSG_KERNEL_NONE = 0x0
|
||||
ETHTOOL_MSG_STRSET_GET_REPLY = 0x1
|
||||
ETHTOOL_MSG_LINKINFO_GET_REPLY = 0x2
|
||||
|
@ -3806,7 +3834,10 @@ const (
|
|||
ETHTOOL_MSG_MODULE_NTF = 0x24
|
||||
ETHTOOL_MSG_PSE_GET_REPLY = 0x25
|
||||
ETHTOOL_MSG_RSS_GET_REPLY = 0x26
|
||||
ETHTOOL_MSG_KERNEL_MAX = 0x2b
|
||||
ETHTOOL_MSG_KERNEL_MAX = 0x2c
|
||||
ETHTOOL_FLAG_COMPACT_BITSETS = 0x1
|
||||
ETHTOOL_FLAG_OMIT_REPLY = 0x2
|
||||
ETHTOOL_FLAG_STATS = 0x4
|
||||
ETHTOOL_A_HEADER_UNSPEC = 0x0
|
||||
ETHTOOL_A_HEADER_DEV_INDEX = 0x1
|
||||
ETHTOOL_A_HEADER_DEV_NAME = 0x2
|
||||
|
@ -3948,7 +3979,7 @@ const (
|
|||
ETHTOOL_A_COALESCE_RATE_SAMPLE_INTERVAL = 0x17
|
||||
ETHTOOL_A_COALESCE_USE_CQE_MODE_TX = 0x18
|
||||
ETHTOOL_A_COALESCE_USE_CQE_MODE_RX = 0x19
|
||||
ETHTOOL_A_COALESCE_MAX = 0x1c
|
||||
ETHTOOL_A_COALESCE_MAX = 0x1e
|
||||
ETHTOOL_A_PAUSE_UNSPEC = 0x0
|
||||
ETHTOOL_A_PAUSE_HEADER = 0x1
|
||||
ETHTOOL_A_PAUSE_AUTONEG = 0x2
|
||||
|
@ -4606,7 +4637,7 @@ const (
|
|||
NL80211_ATTR_MAC_HINT = 0xc8
|
||||
NL80211_ATTR_MAC_MASK = 0xd7
|
||||
NL80211_ATTR_MAX_AP_ASSOC_STA = 0xca
|
||||
NL80211_ATTR_MAX = 0x14a
|
||||
NL80211_ATTR_MAX = 0x14c
|
||||
NL80211_ATTR_MAX_CRIT_PROT_DURATION = 0xb4
|
||||
NL80211_ATTR_MAX_CSA_COUNTERS = 0xce
|
||||
NL80211_ATTR_MAX_MATCH_SETS = 0x85
|
||||
|
@ -5210,7 +5241,7 @@ const (
|
|||
NL80211_FREQUENCY_ATTR_GO_CONCURRENT = 0xf
|
||||
NL80211_FREQUENCY_ATTR_INDOOR_ONLY = 0xe
|
||||
NL80211_FREQUENCY_ATTR_IR_CONCURRENT = 0xf
|
||||
NL80211_FREQUENCY_ATTR_MAX = 0x20
|
||||
NL80211_FREQUENCY_ATTR_MAX = 0x21
|
||||
NL80211_FREQUENCY_ATTR_MAX_TX_POWER = 0x6
|
||||
NL80211_FREQUENCY_ATTR_NO_10MHZ = 0x11
|
||||
NL80211_FREQUENCY_ATTR_NO_160MHZ = 0xc
|
||||
|
|
|
@ -727,6 +727,37 @@ const (
|
|||
RISCV_HWPROBE_EXT_ZBA = 0x8
|
||||
RISCV_HWPROBE_EXT_ZBB = 0x10
|
||||
RISCV_HWPROBE_EXT_ZBS = 0x20
|
||||
RISCV_HWPROBE_EXT_ZICBOZ = 0x40
|
||||
RISCV_HWPROBE_EXT_ZBC = 0x80
|
||||
RISCV_HWPROBE_EXT_ZBKB = 0x100
|
||||
RISCV_HWPROBE_EXT_ZBKC = 0x200
|
||||
RISCV_HWPROBE_EXT_ZBKX = 0x400
|
||||
RISCV_HWPROBE_EXT_ZKND = 0x800
|
||||
RISCV_HWPROBE_EXT_ZKNE = 0x1000
|
||||
RISCV_HWPROBE_EXT_ZKNH = 0x2000
|
||||
RISCV_HWPROBE_EXT_ZKSED = 0x4000
|
||||
RISCV_HWPROBE_EXT_ZKSH = 0x8000
|
||||
RISCV_HWPROBE_EXT_ZKT = 0x10000
|
||||
RISCV_HWPROBE_EXT_ZVBB = 0x20000
|
||||
RISCV_HWPROBE_EXT_ZVBC = 0x40000
|
||||
RISCV_HWPROBE_EXT_ZVKB = 0x80000
|
||||
RISCV_HWPROBE_EXT_ZVKG = 0x100000
|
||||
RISCV_HWPROBE_EXT_ZVKNED = 0x200000
|
||||
RISCV_HWPROBE_EXT_ZVKNHA = 0x400000
|
||||
RISCV_HWPROBE_EXT_ZVKNHB = 0x800000
|
||||
RISCV_HWPROBE_EXT_ZVKSED = 0x1000000
|
||||
RISCV_HWPROBE_EXT_ZVKSH = 0x2000000
|
||||
RISCV_HWPROBE_EXT_ZVKT = 0x4000000
|
||||
RISCV_HWPROBE_EXT_ZFH = 0x8000000
|
||||
RISCV_HWPROBE_EXT_ZFHMIN = 0x10000000
|
||||
RISCV_HWPROBE_EXT_ZIHINTNTL = 0x20000000
|
||||
RISCV_HWPROBE_EXT_ZVFH = 0x40000000
|
||||
RISCV_HWPROBE_EXT_ZVFHMIN = 0x80000000
|
||||
RISCV_HWPROBE_EXT_ZFA = 0x100000000
|
||||
RISCV_HWPROBE_EXT_ZTSO = 0x200000000
|
||||
RISCV_HWPROBE_EXT_ZACAS = 0x400000000
|
||||
RISCV_HWPROBE_EXT_ZICOND = 0x800000000
|
||||
RISCV_HWPROBE_EXT_ZIHINTPAUSE = 0x1000000000
|
||||
RISCV_HWPROBE_KEY_CPUPERF_0 = 0x5
|
||||
RISCV_HWPROBE_MISALIGNED_UNKNOWN = 0x0
|
||||
RISCV_HWPROBE_MISALIGNED_EMULATED = 0x1
|
||||
|
@ -734,4 +765,6 @@ const (
|
|||
RISCV_HWPROBE_MISALIGNED_FAST = 0x3
|
||||
RISCV_HWPROBE_MISALIGNED_UNSUPPORTED = 0x4
|
||||
RISCV_HWPROBE_MISALIGNED_MASK = 0x7
|
||||
RISCV_HWPROBE_KEY_ZICBOZ_BLOCK_SIZE = 0x6
|
||||
RISCV_HWPROBE_WHICH_CPUS = 0x1
|
||||
)
|
||||
|
|
|
@ -65,7 +65,7 @@ func LoadDLL(name string) (dll *DLL, err error) {
|
|||
return d, nil
|
||||
}
|
||||
|
||||
// MustLoadDLL is like LoadDLL but panics if load operation failes.
|
||||
// MustLoadDLL is like LoadDLL but panics if load operation fails.
|
||||
func MustLoadDLL(name string) *DLL {
|
||||
d, e := LoadDLL(name)
|
||||
if e != nil {
|
||||
|
|
|
@ -313,6 +313,10 @@ func NewCallbackCDecl(fn interface{}) uintptr {
|
|||
//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 GetConsoleCP() (cp uint32, err error) = kernel32.GetConsoleCP
|
||||
//sys GetConsoleOutputCP() (cp uint32, err error) = kernel32.GetConsoleOutputCP
|
||||
//sys SetConsoleCP(cp uint32) (err error) = kernel32.SetConsoleCP
|
||||
//sys SetConsoleOutputCP(cp uint32) (err error) = kernel32.SetConsoleOutputCP
|
||||
//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
|
||||
|
|
|
@ -1060,6 +1060,7 @@ const (
|
|||
SIO_GET_EXTENSION_FUNCTION_POINTER = IOC_INOUT | IOC_WS2 | 6
|
||||
SIO_KEEPALIVE_VALS = IOC_IN | IOC_VENDOR | 4
|
||||
SIO_UDP_CONNRESET = IOC_IN | IOC_VENDOR | 12
|
||||
SIO_UDP_NETRESET = IOC_IN | IOC_VENDOR | 15
|
||||
|
||||
// cf. http://support.microsoft.com/default.aspx?scid=kb;en-us;257460
|
||||
|
||||
|
@ -2031,6 +2032,50 @@ const (
|
|||
IF_TYPE_IEEE1394 = 144
|
||||
)
|
||||
|
||||
// Enum NL_PREFIX_ORIGIN for [IpAdapterUnicastAddress], see
|
||||
// https://learn.microsoft.com/en-us/windows/win32/api/nldef/ne-nldef-nl_prefix_origin
|
||||
const (
|
||||
IpPrefixOriginOther = 0
|
||||
IpPrefixOriginManual = 1
|
||||
IpPrefixOriginWellKnown = 2
|
||||
IpPrefixOriginDhcp = 3
|
||||
IpPrefixOriginRouterAdvertisement = 4
|
||||
IpPrefixOriginUnchanged = 1 << 4
|
||||
)
|
||||
|
||||
// Enum NL_SUFFIX_ORIGIN for [IpAdapterUnicastAddress], see
|
||||
// https://learn.microsoft.com/en-us/windows/win32/api/nldef/ne-nldef-nl_suffix_origin
|
||||
const (
|
||||
NlsoOther = 0
|
||||
NlsoManual = 1
|
||||
NlsoWellKnown = 2
|
||||
NlsoDhcp = 3
|
||||
NlsoLinkLayerAddress = 4
|
||||
NlsoRandom = 5
|
||||
IpSuffixOriginOther = 0
|
||||
IpSuffixOriginManual = 1
|
||||
IpSuffixOriginWellKnown = 2
|
||||
IpSuffixOriginDhcp = 3
|
||||
IpSuffixOriginLinkLayerAddress = 4
|
||||
IpSuffixOriginRandom = 5
|
||||
IpSuffixOriginUnchanged = 1 << 4
|
||||
)
|
||||
|
||||
// Enum NL_DAD_STATE for [IpAdapterUnicastAddress], see
|
||||
// https://learn.microsoft.com/en-us/windows/win32/api/nldef/ne-nldef-nl_dad_state
|
||||
const (
|
||||
NldsInvalid = 0
|
||||
NldsTentative = 1
|
||||
NldsDuplicate = 2
|
||||
NldsDeprecated = 3
|
||||
NldsPreferred = 4
|
||||
IpDadStateInvalid = 0
|
||||
IpDadStateTentative = 1
|
||||
IpDadStateDuplicate = 2
|
||||
IpDadStateDeprecated = 3
|
||||
IpDadStatePreferred = 4
|
||||
)
|
||||
|
||||
type SocketAddress struct {
|
||||
Sockaddr *syscall.RawSockaddrAny
|
||||
SockaddrLength int32
|
||||
|
|
|
@ -247,7 +247,9 @@ var (
|
|||
procGetCommandLineW = modkernel32.NewProc("GetCommandLineW")
|
||||
procGetComputerNameExW = modkernel32.NewProc("GetComputerNameExW")
|
||||
procGetComputerNameW = modkernel32.NewProc("GetComputerNameW")
|
||||
procGetConsoleCP = modkernel32.NewProc("GetConsoleCP")
|
||||
procGetConsoleMode = modkernel32.NewProc("GetConsoleMode")
|
||||
procGetConsoleOutputCP = modkernel32.NewProc("GetConsoleOutputCP")
|
||||
procGetConsoleScreenBufferInfo = modkernel32.NewProc("GetConsoleScreenBufferInfo")
|
||||
procGetCurrentDirectoryW = modkernel32.NewProc("GetCurrentDirectoryW")
|
||||
procGetCurrentProcessId = modkernel32.NewProc("GetCurrentProcessId")
|
||||
|
@ -347,8 +349,10 @@ var (
|
|||
procSetCommMask = modkernel32.NewProc("SetCommMask")
|
||||
procSetCommState = modkernel32.NewProc("SetCommState")
|
||||
procSetCommTimeouts = modkernel32.NewProc("SetCommTimeouts")
|
||||
procSetConsoleCP = modkernel32.NewProc("SetConsoleCP")
|
||||
procSetConsoleCursorPosition = modkernel32.NewProc("SetConsoleCursorPosition")
|
||||
procSetConsoleMode = modkernel32.NewProc("SetConsoleMode")
|
||||
procSetConsoleOutputCP = modkernel32.NewProc("SetConsoleOutputCP")
|
||||
procSetCurrentDirectoryW = modkernel32.NewProc("SetCurrentDirectoryW")
|
||||
procSetDefaultDllDirectories = modkernel32.NewProc("SetDefaultDllDirectories")
|
||||
procSetDllDirectoryW = modkernel32.NewProc("SetDllDirectoryW")
|
||||
|
@ -2162,6 +2166,15 @@ func GetComputerName(buf *uint16, n *uint32) (err error) {
|
|||
return
|
||||
}
|
||||
|
||||
func GetConsoleCP() (cp uint32, err error) {
|
||||
r0, _, e1 := syscall.Syscall(procGetConsoleCP.Addr(), 0, 0, 0, 0)
|
||||
cp = uint32(r0)
|
||||
if cp == 0 {
|
||||
err = errnoErr(e1)
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
func GetConsoleMode(console Handle, mode *uint32) (err error) {
|
||||
r1, _, e1 := syscall.Syscall(procGetConsoleMode.Addr(), 2, uintptr(console), uintptr(unsafe.Pointer(mode)), 0)
|
||||
if r1 == 0 {
|
||||
|
@ -2170,6 +2183,15 @@ func GetConsoleMode(console Handle, mode *uint32) (err error) {
|
|||
return
|
||||
}
|
||||
|
||||
func GetConsoleOutputCP() (cp uint32, err error) {
|
||||
r0, _, e1 := syscall.Syscall(procGetConsoleOutputCP.Addr(), 0, 0, 0, 0)
|
||||
cp = uint32(r0)
|
||||
if cp == 0 {
|
||||
err = errnoErr(e1)
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
func GetConsoleScreenBufferInfo(console Handle, info *ConsoleScreenBufferInfo) (err error) {
|
||||
r1, _, e1 := syscall.Syscall(procGetConsoleScreenBufferInfo.Addr(), 2, uintptr(console), uintptr(unsafe.Pointer(info)), 0)
|
||||
if r1 == 0 {
|
||||
|
@ -3038,6 +3060,14 @@ func SetCommTimeouts(handle Handle, timeouts *CommTimeouts) (err error) {
|
|||
return
|
||||
}
|
||||
|
||||
func SetConsoleCP(cp uint32) (err error) {
|
||||
r1, _, e1 := syscall.Syscall(procSetConsoleCP.Addr(), 1, uintptr(cp), 0, 0)
|
||||
if r1 == 0 {
|
||||
err = errnoErr(e1)
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
func setConsoleCursorPosition(console Handle, position uint32) (err error) {
|
||||
r1, _, e1 := syscall.Syscall(procSetConsoleCursorPosition.Addr(), 2, uintptr(console), uintptr(position), 0)
|
||||
if r1 == 0 {
|
||||
|
@ -3054,6 +3084,14 @@ func SetConsoleMode(console Handle, mode uint32) (err error) {
|
|||
return
|
||||
}
|
||||
|
||||
func SetConsoleOutputCP(cp uint32) (err error) {
|
||||
r1, _, e1 := syscall.Syscall(procSetConsoleOutputCP.Addr(), 1, uintptr(cp), 0, 0)
|
||||
if r1 == 0 {
|
||||
err = errnoErr(e1)
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
func SetCurrentDirectory(path *uint16) (err error) {
|
||||
r1, _, e1 := syscall.Syscall(procSetCurrentDirectoryW.Addr(), 1, uintptr(unsafe.Pointer(path)), 0, 0)
|
||||
if r1 == 0 {
|
||||
|
|
|
@ -26,6 +26,7 @@ func makeRaw(fd int) (*State, error) {
|
|||
return nil, err
|
||||
}
|
||||
raw := st &^ (windows.ENABLE_ECHO_INPUT | windows.ENABLE_PROCESSED_INPUT | windows.ENABLE_LINE_INPUT | windows.ENABLE_PROCESSED_OUTPUT)
|
||||
raw |= windows.ENABLE_VIRTUAL_TERMINAL_INPUT
|
||||
if err := windows.SetConsoleMode(windows.Handle(fd), raw); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
|
|
@ -18,7 +18,8 @@ package integer
|
|||
|
||||
import "math"
|
||||
|
||||
// IntMax returns the maximum of the params
|
||||
// IntMax returns the maximum of the params.
|
||||
// Deprecated: for new code, use the max() builtin instead.
|
||||
func IntMax(a, b int) int {
|
||||
if b > a {
|
||||
return b
|
||||
|
@ -26,7 +27,8 @@ func IntMax(a, b int) int {
|
|||
return a
|
||||
}
|
||||
|
||||
// IntMin returns the minimum of the params
|
||||
// IntMin returns the minimum of the params.
|
||||
// Deprecated: for new code, use the min() builtin instead.
|
||||
func IntMin(a, b int) int {
|
||||
if b < a {
|
||||
return b
|
||||
|
@ -34,7 +36,8 @@ func IntMin(a, b int) int {
|
|||
return a
|
||||
}
|
||||
|
||||
// Int32Max returns the maximum of the params
|
||||
// Int32Max returns the maximum of the params.
|
||||
// Deprecated: for new code, use the max() builtin instead.
|
||||
func Int32Max(a, b int32) int32 {
|
||||
if b > a {
|
||||
return b
|
||||
|
@ -42,7 +45,8 @@ func Int32Max(a, b int32) int32 {
|
|||
return a
|
||||
}
|
||||
|
||||
// Int32Min returns the minimum of the params
|
||||
// Int32Min returns the minimum of the params.
|
||||
// Deprecated: for new code, use the min() builtin instead.
|
||||
func Int32Min(a, b int32) int32 {
|
||||
if b < a {
|
||||
return b
|
||||
|
@ -50,7 +54,8 @@ func Int32Min(a, b int32) int32 {
|
|||
return a
|
||||
}
|
||||
|
||||
// Int64Max returns the maximum of the params
|
||||
// Int64Max returns the maximum of the params.
|
||||
// Deprecated: for new code, use the max() builtin instead.
|
||||
func Int64Max(a, b int64) int64 {
|
||||
if b > a {
|
||||
return b
|
||||
|
@ -58,7 +63,8 @@ func Int64Max(a, b int64) int64 {
|
|||
return a
|
||||
}
|
||||
|
||||
// Int64Min returns the minimum of the params
|
||||
// Int64Min returns the minimum of the params.
|
||||
// Deprecated: for new code, use the min() builtin instead.
|
||||
func Int64Min(a, b int64) int64 {
|
||||
if b < a {
|
||||
return b
|
||||
|
|
|
@ -1158,7 +1158,7 @@ github.com/openshift/cloud-credential-operator/pkg/apis/cloudcredential/v1
|
|||
# github.com/openshift/custom-resource-status v1.1.3-0.20220503160415-f2fdb4999d87
|
||||
## explicit; go 1.12
|
||||
github.com/openshift/custom-resource-status/conditions/v1
|
||||
# github.com/openshift/hive/apis v0.0.0-20240812130639-bdf9d08a060a => github.com/openshift/hive/apis v0.0.0-20231116161336-9dd47f8bfa1f
|
||||
# github.com/openshift/hive/apis v0.0.0-20241008210644-986c5efa21e7 => github.com/openshift/hive/apis v0.0.0-20231116161336-9dd47f8bfa1f
|
||||
## explicit; go 1.20
|
||||
github.com/openshift/hive/apis/hive/v1
|
||||
github.com/openshift/hive/apis/hive/v1/agent
|
||||
|
@ -1406,7 +1406,7 @@ go.starlark.net/syntax
|
|||
## explicit; go 1.20
|
||||
go.uber.org/mock/gomock
|
||||
go.uber.org/mock/mockgen/model
|
||||
# golang.org/x/crypto v0.26.0
|
||||
# golang.org/x/crypto v0.28.0
|
||||
## explicit; go 1.20
|
||||
golang.org/x/crypto/blowfish
|
||||
golang.org/x/crypto/cast5
|
||||
|
@ -1442,7 +1442,7 @@ golang.org/x/exp/slices
|
|||
# golang.org/x/mod v0.17.0
|
||||
## explicit; go 1.18
|
||||
golang.org/x/mod/semver
|
||||
# golang.org/x/net v0.28.0
|
||||
# golang.org/x/net v0.30.0
|
||||
## explicit; go 1.18
|
||||
golang.org/x/net/context
|
||||
golang.org/x/net/html
|
||||
|
@ -1466,17 +1466,17 @@ golang.org/x/oauth2/internal
|
|||
## explicit; go 1.18
|
||||
golang.org/x/sync/errgroup
|
||||
golang.org/x/sync/semaphore
|
||||
# golang.org/x/sys v0.23.0
|
||||
# golang.org/x/sys v0.26.0
|
||||
## explicit; go 1.18
|
||||
golang.org/x/sys/cpu
|
||||
golang.org/x/sys/plan9
|
||||
golang.org/x/sys/unix
|
||||
golang.org/x/sys/windows
|
||||
golang.org/x/sys/windows/registry
|
||||
# golang.org/x/term v0.23.0
|
||||
# golang.org/x/term v0.25.0
|
||||
## explicit; go 1.18
|
||||
golang.org/x/term
|
||||
# golang.org/x/text v0.17.0
|
||||
# golang.org/x/text v0.19.0
|
||||
## explicit; go 1.18
|
||||
golang.org/x/text/cases
|
||||
golang.org/x/text/encoding
|
||||
|
@ -1658,7 +1658,7 @@ gopkg.in/yaml.v2
|
|||
# gopkg.in/yaml.v3 v3.0.1
|
||||
## explicit
|
||||
gopkg.in/yaml.v3
|
||||
# k8s.io/api v0.30.3 => k8s.io/api v0.25.16
|
||||
# k8s.io/api v0.31.1 => k8s.io/api v0.25.16
|
||||
## explicit; go 1.19
|
||||
k8s.io/api/admission/v1
|
||||
k8s.io/api/admission/v1beta1
|
||||
|
@ -1727,7 +1727,7 @@ k8s.io/apiextensions-apiserver/pkg/client/clientset/clientset/scheme
|
|||
k8s.io/apiextensions-apiserver/pkg/client/clientset/clientset/typed/apiextensions/v1
|
||||
k8s.io/apiextensions-apiserver/pkg/client/clientset/clientset/typed/apiextensions/v1beta1
|
||||
k8s.io/apiextensions-apiserver/third_party/forked/celopenapi/model
|
||||
# k8s.io/apimachinery v0.30.3 => k8s.io/apimachinery v0.25.16
|
||||
# k8s.io/apimachinery v0.31.1 => k8s.io/apimachinery v0.25.16
|
||||
## explicit; go 1.19
|
||||
k8s.io/apimachinery/pkg/api/equality
|
||||
k8s.io/apimachinery/pkg/api/errors
|
||||
|
@ -2159,7 +2159,7 @@ k8s.io/kubernetes/pkg/apis/rbac/v1
|
|||
k8s.io/kubernetes/pkg/features
|
||||
k8s.io/kubernetes/pkg/kubelet/events
|
||||
k8s.io/kubernetes/pkg/util/parsers
|
||||
# k8s.io/utils v0.0.0-20240711033017-18e509b52bc8
|
||||
# k8s.io/utils v0.0.0-20240921022957-49e7df575cb6
|
||||
## explicit; go 1.18
|
||||
k8s.io/utils/buffer
|
||||
k8s.io/utils/clock
|
||||
|
@ -2215,7 +2215,7 @@ sigs.k8s.io/controller-runtime/pkg/webhook
|
|||
sigs.k8s.io/controller-runtime/pkg/webhook/admission
|
||||
sigs.k8s.io/controller-runtime/pkg/webhook/conversion
|
||||
sigs.k8s.io/controller-runtime/pkg/webhook/internal/metrics
|
||||
# sigs.k8s.io/json v0.0.0-20221116044647-bc3834ca7abd
|
||||
# sigs.k8s.io/json v0.0.0-20241009153224-e386a8af8d30
|
||||
## explicit; go 1.18
|
||||
sigs.k8s.io/json
|
||||
sigs.k8s.io/json/internal/golang/encoding/json
|
||||
|
|
|
@ -19,7 +19,7 @@ vet:
|
|||
go vet sigs.k8s.io/json
|
||||
|
||||
@echo "checking for external dependencies"
|
||||
@deps=$$(go mod graph); \
|
||||
@deps=$$(go list -f '{{ if not (or .Standard .Module.Main) }}{{.ImportPath}}{{ end }}' -deps sigs.k8s.io/json/... || true); \
|
||||
if [ -n "$${deps}" ]; then \
|
||||
echo "only stdlib dependencies allowed, found:"; \
|
||||
echo "$${deps}"; \
|
||||
|
|
|
@ -2,5 +2,5 @@
|
|||
|
||||
approvers:
|
||||
- deads2k
|
||||
- lavalamp
|
||||
- jpbetz
|
||||
- liggitt
|
||||
|
|
Загрузка…
Ссылка в новой задаче